Commit 133b0d78 authored by Steven Walton's avatar Steven Walton

Dimension integrated

Chased down an error for a long time because vtkm caches with cmake
poorly and preserved an error that was fixed.
Adjusted test case from != to a tolerance based value based on the
precision.
parent f5a5950d
......@@ -19,6 +19,7 @@
##============================================================================
set(headers
CellDimensionMetric.h
CellDiagonalRatioMetric.h
CellEdgeRatioMetric.h
CellJacobianMetric.h
......@@ -26,7 +27,6 @@ set(headers
TypeOfCellQuadrilateral.h
TypeOfCellTetrahedral.h
TypeOfCellTriangle.h
CellDimensionMetric.h
)
......
......@@ -76,12 +76,6 @@ VTKM_EXEC OutType CellDimensionMetric(const vtkm::IdComponent& numPts,
vtkm::CellShapeTagHexahedron,
const vtkm::exec::FunctorBase& worklet)
{
/*
FloatType volume = vtkm::exec::CellMeasure(numPts,
pts,
vtkm::CellShapeTagHexahedron,
worklet);
*/
OutType gradop[8][3];
OutType x1 = pts[0][0];
OutType x2 = pts[1][0];
......@@ -261,7 +255,7 @@ VTKM_EXEC OutType CellDimensionMetric(const vtkm::IdComponent& numPts,
+ pts[5][0] * gradop[5][0]
+ pts[6][0] * gradop[6][0]
+ pts[7][0] * gradop[7][0];
OutType aspect = .5*SQR(volume) /
OutType aspect = .5*vtkm::Pow(volume, 2.) /
( vtkm::Pow(gradop[0][0],2.) + vtkm::Pow(gradop[1][0],2.)
+ vtkm::Pow(gradop[2][0],2.) + vtkm::Pow(gradop[3][0],2.)
+ vtkm::Pow(gradop[4][0],2.) + vtkm::Pow(gradop[5][0],2.)
......@@ -278,4 +272,8 @@ VTKM_EXEC OutType CellDimensionMetric(const vtkm::IdComponent& numPts,
return vtkm::Sqrt(aspect);
}
} // cell metrics
} // exec
} // vtkm
#endif // vtk_m_exec_cellmetrics_CellDimensionMetric_h
......@@ -138,7 +138,8 @@ bool TestMeshQualityFilter(const vtkm::cont::DataSet& input,
for (unsigned long i = 0; i < expectedVals.size(); i++)
{
vtkm::Id id = (vtkm::Id)i;
if (portal1.Get(id) != expectedVals[i])
const vtkm::FloatDefault tol = 1.e-6;
if (vtkm::Abs(portal1.Get(id) - expectedVals[i]) > tol)
{
printf("Metric \"%s\" for cell type \"%s\" does not match. Expected %f and got %f\n",
outputname.c_str(),
......@@ -146,6 +147,8 @@ bool TestMeshQualityFilter(const vtkm::cont::DataSet& input,
expectedVals[i],
portal1.Get(id));
anyFailures = true;
vtkm::FloatDefault diff = vtkm::Abs(portal1.Get(id) - expectedVals[i]);
printf("Difference is %.16f", diff);
}
}
return anyFailures;
......@@ -183,7 +186,7 @@ int TestMeshQuality()
metrics.push_back(vtkm::filter::CellMetric::DIAGONAL_RATIO);
metricName.push_back("diagonalRatio");
*/
FloatVec dimExpectedValues = {-1, -1, -1, -1, -1, -1, 0.707107};
FloatVec dimExpectedValues = {-1, -1, -1, -1, -1, 0.707107};
expectedValues.push_back(dimExpectedValues);
metrics.push_back(vtkm::filter::CellMetric::DIMENSION);
metricName.push_back("dimension");
......
......@@ -115,6 +115,7 @@ protected:
case MetricTagType::DIMENSION:
metricValue =
vtkm::exec::cellmetrics::CellDimensionMetric<OutType>(numPts, pts, tag, *this);
break;
case MetricTagType::EMPTY:
break;
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment