mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
CellMetrics return vtkm::ErrorCode instead of raising errors
- MeshQuality now throws ErrorCode messages Signed-off-by: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>
This commit is contained in:
parent
1d807a08eb
commit
026fd14ba6
@ -21,6 +21,7 @@ enum class ErrorCode
|
||||
Success,
|
||||
InvalidShapeId,
|
||||
InvalidNumberOfPoints,
|
||||
InvalidCellMetric,
|
||||
WrongShapeIdForTagType,
|
||||
InvalidPointId,
|
||||
InvalidEdgeId,
|
||||
@ -46,6 +47,8 @@ inline const char* ErrorString(vtkm::ErrorCode code) noexcept
|
||||
return "Invalid shape id";
|
||||
case vtkm::ErrorCode::InvalidNumberOfPoints:
|
||||
return "Invalid number of points";
|
||||
case vtkm::ErrorCode::InvalidCellMetric:
|
||||
return "Invalid cell metric";
|
||||
case vtkm::ErrorCode::WrongShapeIdForTagType:
|
||||
return "Wrong shape id for tag type";
|
||||
case vtkm::ErrorCode::InvalidPointId:
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include <vtkm/CellShape.h>
|
||||
#include <vtkm/CellTraits.h>
|
||||
#include <vtkm/ErrorCode.h>
|
||||
#include <vtkm/VecTraits.h>
|
||||
#include <vtkm/VectorAnalysis.h>
|
||||
#include <vtkm/exec/FunctorBase.h>
|
||||
@ -29,7 +30,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
(void)numPts;
|
||||
(void)pts;
|
||||
@ -43,12 +44,12 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagLine,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
OutType arcLength(0.0);
|
||||
if (numPts < 2)
|
||||
{
|
||||
worklet.RaiseError("Degenerate line has no arc length.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -67,11 +68,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 3)
|
||||
{
|
||||
worklet.RaiseError("Area(triangle) requires 3 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
typename PointCoordVecType::ComponentType v1 = pts[1] - pts[0];
|
||||
@ -85,11 +86,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Area(quad) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -125,9 +126,9 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType ComputeMeasure(const vtkm::IdComponent&,
|
||||
const PointCoordVecType&,
|
||||
vtkm::CellShapeTagPolygon,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
worklet.RaiseError("CellMeasure does not support area computation for polygons.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -138,11 +139,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Volume(tetrahedron) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -158,11 +159,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("Volume(hexahedron) requires 8 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -202,11 +203,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagWedge,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 6)
|
||||
{
|
||||
worklet.RaiseError("Volume(wedge) requires 6 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -233,11 +234,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagPyramid,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 5)
|
||||
{
|
||||
worklet.RaiseError("Volume(pyramid) requires 5 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,8 @@ protected:
|
||||
#pragma push
|
||||
#pragma diag_suppress = code_is_unreachable
|
||||
#endif
|
||||
|
||||
vtkm::ErrorCode ec;
|
||||
switch (vtkm::CellTraits<CellShapeType>::TOPOLOGICAL_DIMENSIONS)
|
||||
{
|
||||
case 0:
|
||||
@ -99,19 +101,19 @@ protected:
|
||||
case 1:
|
||||
if (vtkm::ListHas<IntegrationTypeList, IntegrateOverCurve>::value)
|
||||
{
|
||||
return vtkm::exec::CellMeasure<OutType>(numPts, pts, CellShapeType(), *this);
|
||||
return vtkm::exec::CellMeasure<OutType>(numPts, pts, CellShapeType(), ec);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (vtkm::ListHas<IntegrationTypeList, IntegrateOverSurface>::value)
|
||||
{
|
||||
return vtkm::exec::CellMeasure<OutType>(numPts, pts, CellShapeType(), *this);
|
||||
return vtkm::exec::CellMeasure<OutType>(numPts, pts, CellShapeType(), ec);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (vtkm::ListHas<IntegrationTypeList, IntegrateOverSolid>::value)
|
||||
{
|
||||
return vtkm::exec::CellMeasure<OutType>(numPts, pts, CellShapeType(), *this);
|
||||
return vtkm::exec::CellMeasure<OutType>(numPts, pts, CellShapeType(), ec);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -21,6 +21,7 @@
|
||||
#ifndef vtk_m_worklet_MeshQuality_h
|
||||
#define vtk_m_worklet_MeshQuality_h
|
||||
|
||||
#include "vtkm/ErrorCode.h"
|
||||
#include "vtkm/worklet/CellMeasure.h"
|
||||
#include "vtkm/worklet/WorkletMapTopology.h"
|
||||
#include "vtkm/worklet/cellmetrics/CellAspectGammaMetric.h"
|
||||
@ -91,7 +92,7 @@ public:
|
||||
vtkmGenericCellShapeMacro(metricValue =
|
||||
this->ComputeMetric<OutType>(numPoints, pts, CellShapeTag()));
|
||||
default:
|
||||
this->RaiseError("Asked for metric of unknown cell type.");
|
||||
this->RaiseError(vtkm::ErrorString(vtkm::ErrorCode::CellNotFound));
|
||||
metricValue = OutType(0.0);
|
||||
}
|
||||
}
|
||||
@ -115,103 +116,104 @@ protected:
|
||||
|
||||
if (dims > 0)
|
||||
{
|
||||
vtkm::ErrorCode ec{ vtkm::ErrorCode::Success };
|
||||
switch (this->Metric)
|
||||
{
|
||||
case MetricTagType::AREA:
|
||||
metricValue = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, *this);
|
||||
metricValue = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, ec);
|
||||
if (dims != 2)
|
||||
metricValue = 0.;
|
||||
break;
|
||||
case MetricTagType::ASPECT_GAMMA:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellAspectGammaMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellAspectGammaMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::ASPECT_RATIO:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellAspectRatioMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellAspectRatioMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::CONDITION:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellConditionMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellConditionMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::DIAGONAL_RATIO:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellDiagonalRatioMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellDiagonalRatioMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::DIMENSION:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellDimensionMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellDimensionMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::JACOBIAN:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellJacobianMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellJacobianMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::MAX_ANGLE:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellMaxAngleMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellMaxAngleMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::MAX_DIAGONAL:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellMaxDiagonalMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellMaxDiagonalMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::MIN_ANGLE:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellMinAngleMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellMinAngleMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::MIN_DIAGONAL:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellMinDiagonalMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellMinDiagonalMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::ODDY:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellOddyMetric<OutType>(numPts, pts, tag, *this);
|
||||
metricValue = vtkm::worklet::cellmetrics::CellOddyMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::RELATIVE_SIZE_SQUARED:
|
||||
metricValue = vtkm::worklet::cellmetrics::CellRelativeSizeSquaredMetric<OutType>(
|
||||
numPts, pts, static_cast<OutType>(average), tag, *this);
|
||||
numPts, pts, static_cast<OutType>(average), tag, ec);
|
||||
break;
|
||||
case MetricTagType::SHAPE_AND_SIZE:
|
||||
metricValue = vtkm::worklet::cellmetrics::CellShapeAndSizeMetric<OutType>(
|
||||
numPts, pts, static_cast<OutType>(average), tag, *this);
|
||||
numPts, pts, static_cast<OutType>(average), tag, ec);
|
||||
break;
|
||||
case MetricTagType::SCALED_JACOBIAN:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellScaledJacobianMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellScaledJacobianMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::SHAPE:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellShapeMetric<OutType>(numPts, pts, tag, *this);
|
||||
metricValue = vtkm::worklet::cellmetrics::CellShapeMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::SHEAR:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellShearMetric<OutType>(numPts, pts, tag, *this);
|
||||
metricValue = vtkm::worklet::cellmetrics::CellShearMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::SKEW:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellSkewMetric<OutType>(numPts, pts, tag, *this);
|
||||
metricValue = vtkm::worklet::cellmetrics::CellSkewMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::STRETCH:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellStretchMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellStretchMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::TAPER:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellTaperMetric<OutType>(numPts, pts, tag, *this);
|
||||
metricValue = vtkm::worklet::cellmetrics::CellTaperMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::VOLUME:
|
||||
metricValue = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, *this);
|
||||
metricValue = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, ec);
|
||||
if (dims != 3)
|
||||
metricValue = 0.;
|
||||
break;
|
||||
case MetricTagType::WARPAGE:
|
||||
metricValue =
|
||||
vtkm::worklet::cellmetrics::CellWarpageMetric<OutType>(numPts, pts, tag, *this);
|
||||
vtkm::worklet::cellmetrics::CellWarpageMetric<OutType>(numPts, pts, tag, ec);
|
||||
break;
|
||||
case MetricTagType::EMPTY:
|
||||
break;
|
||||
default:
|
||||
//Only call metric function if a metric is specified for this shape type
|
||||
this->RaiseError("Asked for unknown metric.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
}
|
||||
|
||||
if (ec != vtkm::ErrorCode::Success)
|
||||
{
|
||||
this->RaiseError(vtkm::ErrorString(ec));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,15 +56,16 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
UNUSED(shape);
|
||||
worklet.RaiseError(
|
||||
"Shape type template must be specialized to compute the aspect frobenius metric.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
} //If the polygon has 3 vertices or 4 vertices, then just call
|
||||
}
|
||||
|
||||
//If the polygon has 3 vertices or 4 vertices, then just call
|
||||
//the functions for Triangle and Quad cell types. Otherwise,
|
||||
//this metric is not supported for (n>4)-vertex polygons, such
|
||||
//as pentagons or hexagons, or (n<3)-vertex polygons, such as lines or points.
|
||||
@ -72,80 +73,91 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagPolygon,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts == 3)
|
||||
return CellAspectFrobeniusMetric<OutType>(numPts, pts, vtkm::CellShapeTagTriangle(), worklet);
|
||||
return CellAspectFrobeniusMetric<OutType>(numPts, pts, vtkm::CellShapeTagTriangle(), ec);
|
||||
else
|
||||
{
|
||||
worklet.RaiseError(
|
||||
"Aspect frobenius metric is not supported for (n<3)- or (n>4)-vertex polygons.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
}
|
||||
} //The aspect frobenius metric is not supported for lines/edges.
|
||||
}
|
||||
|
||||
//The aspect frobenius metric is not supported for lines/edges.
|
||||
template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagLine,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
worklet.RaiseError("Aspect frobenius metric is not supported for lines/edges.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
} //The aspect frobenius metric is not uniquely defined for quads.
|
||||
}
|
||||
|
||||
//The aspect frobenius metric is not uniquely defined for quads.
|
||||
//Instead, use either the mean or max aspect frobenius metrics, which are
|
||||
//defined in terms of the aspect frobenius of triangles.
|
||||
template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
worklet.RaiseError("Aspect frobenius metric is not supported for quads.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
} //The aspect frobenius metric is not uniquely defined for hexahedrons.
|
||||
}
|
||||
|
||||
//The aspect frobenius metric is not uniquely defined for hexahedrons.
|
||||
//Instead, use either the mean or max aspect frobenius metrics, which are
|
||||
//defined in terms of the aspect frobenius of tetrahedrons.
|
||||
template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
worklet.RaiseError("Aspect frobenius metric is not supported for hexahedrons.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
} //The aspect frobenius metric is not uniquely defined for pyramids.
|
||||
}
|
||||
|
||||
//The aspect frobenius metric is not uniquely defined for pyramids.
|
||||
//Instead, use either the mean or max aspect frobenius metrics, which are
|
||||
//defined in terms of the aspect frobenius of tetrahedrons.
|
||||
template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagPyramid,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
worklet.RaiseError("Aspect frobenius metric is not supported for pyramids.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
} //The aspect frobenius metric is not uniquely defined for wedges.
|
||||
}
|
||||
|
||||
//The aspect frobenius metric is not uniquely defined for wedges.
|
||||
//Instead, use either the mean or max aspect frobenius metrics, which are
|
||||
//defined in terms of the aspect frobenius of tetrahedrons.
|
||||
template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagWedge,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
worklet.RaiseError("Aspect frobenius metric is not supported for wedges.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
} // ========================= 2D cells ==================================
|
||||
}
|
||||
|
||||
// ========================= 2D cells ==================================
|
||||
|
||||
// Computes the aspect frobenius of a triangle.
|
||||
// Formula: Sum of lengths of 3 edges, divided by a multiple of the triangle area.
|
||||
@ -156,11 +168,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 3)
|
||||
{
|
||||
worklet.RaiseError("Aspect frobenius metric(triangle) requires 3 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -196,11 +208,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Aspect frobenius metric(tetrahedron) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellAspectGammaMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -67,11 +67,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectGammaMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Aspect gamma metric (tetrahedron) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellAspectRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -71,11 +71,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 3)
|
||||
{
|
||||
worklet.RaiseError("Aspect ratio metric (triangle) requires 3 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -95,11 +95,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Aspect ratio metric (quad) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -126,11 +126,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("Aspect ratio metric (hex) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -162,11 +162,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellAspectRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Aspect ratio metric (tetrahedron) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellConditionMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -69,11 +69,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellConditionMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 3)
|
||||
{
|
||||
worklet.RaiseError("Condition metric(triangle) requires 3 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -101,10 +101,10 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellConditionMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
using Scalar = OutType;
|
||||
using CollectionOfPoints = PointCoordVecType;
|
||||
using Vector = typename PointCoordVecType::ComponentType;
|
||||
@ -141,11 +141,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellConditionMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Condition metric(tetrahedron) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
using Scalar = OutType;
|
||||
@ -187,10 +187,10 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellConditionMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
return CellMaxAspectFrobeniusMetric<OutType, PointCoordVecType>(
|
||||
numPts, pts, vtkm::CellShapeTagHexahedron(), worklet);
|
||||
numPts, pts, vtkm::CellShapeTagHexahedron(), ec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellDiagonalRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -99,11 +99,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellDiagonalRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Diagonal ratio metric(quad) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -128,11 +128,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellDiagonalRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("Diagonal ratio metric(hexahedron) requires 8 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellDimensionMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -74,10 +74,10 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellDimensionMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
|
||||
OutType gradop[8][3];
|
||||
OutType x1 = pts[0][0];
|
||||
|
@ -92,7 +92,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellEdgeRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -110,12 +110,12 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellEdgeRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagLine,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(pts);
|
||||
if (numPts < 2)
|
||||
{
|
||||
worklet.RaiseError("Degenerate line has no edge ratio.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
}
|
||||
return OutType(1.0);
|
||||
@ -130,11 +130,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellEdgeRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 3)
|
||||
{
|
||||
worklet.RaiseError("Edge ratio metric(triangle) requires 3 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -156,11 +156,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellEdgeRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Edge ratio metric(quad) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -187,11 +187,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellEdgeRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Edge ratio metric(tetrahedron) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -214,11 +214,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellEdgeRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("Edge ratio metric(hexahedron) requires 8 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -242,11 +242,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellEdgeRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagWedge,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 6)
|
||||
{
|
||||
worklet.RaiseError("Edge ratio metric(wedge) requires 6 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -271,11 +271,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellEdgeRatioMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagPyramid,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 5)
|
||||
{
|
||||
worklet.RaiseError("Edge ratio metric(pyramid) requires 5 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellJacobianMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -78,11 +78,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellJacobianMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Jacobian metric(quad) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -113,11 +113,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellJacobianMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("Jacobian metric(hexahedron) requires 8 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -160,11 +160,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellJacobianMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Jacobian metric (tetra) requires 4 points");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellMaxAngleMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -75,11 +75,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMaxAngleMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 3)
|
||||
{
|
||||
worklet.RaiseError("Minimum angle metric (triangle) requires 3 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -121,11 +121,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMaxAngleMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Minimum angle metric(quad) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
|
@ -91,13 +91,12 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellMaxAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
UNUSED(shape);
|
||||
worklet.RaiseError(
|
||||
"Shape type template must be specialized to compute the max aspect frobenius metric.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -109,17 +108,16 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMaxAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagPolygon,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts == 3)
|
||||
return vtkm::worklet::cellmetrics::CellAspectFrobeniusMetric<OutType>(
|
||||
numPts, pts, vtkm::CellShapeTagTriangle(), worklet);
|
||||
numPts, pts, vtkm::CellShapeTagTriangle(), ec);
|
||||
if (numPts == 4)
|
||||
return CellMaxAspectFrobeniusMetric<OutType>(numPts, pts, vtkm::CellShapeTagQuad(), worklet);
|
||||
return CellMaxAspectFrobeniusMetric<OutType>(numPts, pts, vtkm::CellShapeTagQuad(), ec);
|
||||
else
|
||||
{
|
||||
worklet.RaiseError(
|
||||
"Max aspect frobenius metric is not supported for (n<3)- or (n>4)-vertex polygons.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
}
|
||||
}
|
||||
@ -129,11 +127,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMaxAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagLine,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
worklet.RaiseError("Max aspect frobenius metric is not supported for lines/edges.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -144,15 +142,15 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMaxAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 3)
|
||||
{
|
||||
worklet.RaiseError("Max aspect frobenius metric(triangle) requires 3 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
return vtkm::worklet::cellmetrics::CellAspectFrobeniusMetric<OutType>(
|
||||
numPts, pts, vtkm::CellShapeTagTriangle(), worklet);
|
||||
numPts, pts, vtkm::CellShapeTagTriangle(), ec);
|
||||
}
|
||||
|
||||
//The max aspect frobenius metric is not supported for pyramids.
|
||||
@ -160,11 +158,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMaxAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagPyramid,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
worklet.RaiseError("Max aspect frobenius metric is not supported for pyramids.");
|
||||
ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -183,11 +181,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMaxAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Max aspect frobenius metric(quad) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
//The 4 edges of a quad
|
||||
@ -240,16 +238,16 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMaxAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Max aspect frobenius metric(tetrahedron) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
return vtkm::worklet::cellmetrics::CellAspectFrobeniusMetric<OutType, PointCoordVecType>(
|
||||
numPts, pts, vtkm::CellShapeTagTetra(), worklet);
|
||||
numPts, pts, vtkm::CellShapeTagTetra(), ec);
|
||||
}
|
||||
|
||||
// Computes the maximum aspect frobenius of a hexahedron.
|
||||
@ -265,11 +263,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMaxAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("Max aspect frobenius metric(hexahedron) requires 8 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -334,11 +332,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMaxAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagWedge,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 6)
|
||||
{
|
||||
worklet.RaiseError("Max aspect frobenius metric(wedge) requires 6 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -358,12 +356,12 @@ VTKM_EXEC OutType CellMaxAspectFrobeniusMetric(const vtkm::IdComponent& numPts,
|
||||
//Return the maximum metric value among all 6 tets as the maximum aspect frobenius.
|
||||
const vtkm::IdComponent tetPts = 4;
|
||||
OutType max_aspect_frobenius = vtkm::worklet::cellmetrics::CellAspectFrobeniusMetric<OutType>(
|
||||
tetPts, tetras[0], vtkm::CellShapeTagTetra(), worklet);
|
||||
tetPts, tetras[0], vtkm::CellShapeTagTetra(), ec);
|
||||
OutType curr;
|
||||
for (vtkm::Id i = 1; i < 6; i++)
|
||||
{
|
||||
curr = vtkm::worklet::cellmetrics::CellAspectFrobeniusMetric<OutType>(
|
||||
tetPts, tetras[i], vtkm::CellShapeTagTetra(), worklet);
|
||||
tetPts, tetras[i], vtkm::CellShapeTagTetra(), ec);
|
||||
if (curr > max_aspect_frobenius)
|
||||
max_aspect_frobenius = curr;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellMaxDiagonalMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -66,11 +66,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMaxDiagonalMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("Max diagonal metric(hexahedron) requires 8 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellMinAngleMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -73,11 +73,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMinAngleMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 3)
|
||||
{
|
||||
worklet.RaiseError("Minimum angle metric(quad) requires 3 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -119,11 +119,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMinAngleMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Minimum angle metric(quad) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
using Scalar = OutType;
|
||||
|
@ -54,7 +54,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellMinDiagonalMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -66,11 +66,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellMinDiagonalMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("Min diagonal metric(hexahedron) requires 8 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellOddyMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -92,11 +92,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellOddyMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Oddy metric(quad) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -139,11 +139,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellOddyMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("Oddy metric(hexahedron) requires 8 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ VTKM_EXEC OutType CellRelativeSizeSquaredMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
const OutType& avgArea,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -77,15 +77,15 @@ VTKM_EXEC OutType CellRelativeSizeSquaredMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
const OutType& avgArea,
|
||||
vtkm::CellShapeTagTriangle tag,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
if (numPts != 3)
|
||||
{
|
||||
worklet.RaiseError("Edge ratio metric(triangle) requires 3 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(-1.);
|
||||
}
|
||||
OutType A = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, worklet);
|
||||
OutType A = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, ec);
|
||||
OutType R = A / avgArea;
|
||||
if (R == OutType(0.))
|
||||
return OutType(0.);
|
||||
@ -98,15 +98,15 @@ VTKM_EXEC OutType CellRelativeSizeSquaredMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
const OutType& avgArea,
|
||||
vtkm::CellShapeTagQuad tag,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Edge ratio metric(quadrilateral) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(-1.);
|
||||
}
|
||||
OutType A = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, worklet);
|
||||
OutType A = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, ec);
|
||||
OutType R = A / avgArea;
|
||||
if (R == OutType(0.))
|
||||
return OutType(0.);
|
||||
@ -121,15 +121,15 @@ VTKM_EXEC OutType CellRelativeSizeSquaredMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
const OutType& avgVolume,
|
||||
vtkm::CellShapeTagTetra tag,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Edge ratio metric(tetrahedral) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(-1.);
|
||||
}
|
||||
OutType V = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, worklet);
|
||||
OutType V = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, ec);
|
||||
OutType R = V / avgVolume;
|
||||
if (R == OutType(0.))
|
||||
return OutType(0.);
|
||||
@ -142,13 +142,13 @@ VTKM_EXEC OutType CellRelativeSizeSquaredMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
const OutType& avgVolume,
|
||||
vtkm::CellShapeTagHexahedron tag,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(tag);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("Edge ratio metric(hexahedral) requires 8 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(-1.);
|
||||
}
|
||||
OutType X1x = (pts[1][0] - pts[0][0]) + (pts[2][0] - pts[3][0]) + (pts[5][0] - pts[4][0]) +
|
||||
|
@ -56,7 +56,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellScaledJacobianMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -78,11 +78,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellScaledJacobianMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 3)
|
||||
{
|
||||
worklet.RaiseError("ScaledJacobian metric(tri) requires 3 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
using Scalar = OutType;
|
||||
@ -135,11 +135,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellScaledJacobianMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("ScaledJacobian metric(quad) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
using Scalar = OutType;
|
||||
@ -195,11 +195,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellScaledJacobianMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("ScaledJacobian metric(hexahedron) requires 8 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -266,11 +266,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellScaledJacobianMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("ScaledJacobian metric requires 4 points");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ VTKM_EXEC OutType CellShapeAndSizeMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
const OutType& avgArea,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -73,11 +73,11 @@ VTKM_EXEC OutType CellShapeAndSizeMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
const OutType& avgArea,
|
||||
vtkm::CellShapeTagTriangle tag,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
OutType rss = vtkm::worklet::cellmetrics::CellRelativeSizeSquaredMetric<OutType>(
|
||||
numPts, pts, avgArea, tag, worklet);
|
||||
OutType shape = vtkm::worklet::cellmetrics::CellShapeMetric<OutType>(numPts, pts, tag, worklet);
|
||||
numPts, pts, avgArea, tag, ec);
|
||||
OutType shape = vtkm::worklet::cellmetrics::CellShapeMetric<OutType>(numPts, pts, tag, ec);
|
||||
OutType q = rss * shape;
|
||||
return OutType(q);
|
||||
}
|
||||
@ -87,11 +87,11 @@ VTKM_EXEC OutType CellShapeAndSizeMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
const OutType& avgArea,
|
||||
vtkm::CellShapeTagQuad tag,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
OutType rss = vtkm::worklet::cellmetrics::CellRelativeSizeSquaredMetric<OutType>(
|
||||
numPts, pts, avgArea, tag, worklet);
|
||||
OutType shape = vtkm::worklet::cellmetrics::CellShapeMetric<OutType>(numPts, pts, tag, worklet);
|
||||
numPts, pts, avgArea, tag, ec);
|
||||
OutType shape = vtkm::worklet::cellmetrics::CellShapeMetric<OutType>(numPts, pts, tag, ec);
|
||||
OutType q = rss * shape;
|
||||
return OutType(q);
|
||||
}
|
||||
@ -103,11 +103,11 @@ VTKM_EXEC OutType CellShapeAndSizeMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
const OutType& avgVolume,
|
||||
vtkm::CellShapeTagTetra tag,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
OutType rss = vtkm::worklet::cellmetrics::CellRelativeSizeSquaredMetric<OutType>(
|
||||
numPts, pts, avgVolume, tag, worklet);
|
||||
OutType shape = vtkm::worklet::cellmetrics::CellShapeMetric<OutType>(numPts, pts, tag, worklet);
|
||||
numPts, pts, avgVolume, tag, ec);
|
||||
OutType shape = vtkm::worklet::cellmetrics::CellShapeMetric<OutType>(numPts, pts, tag, ec);
|
||||
OutType q = rss * shape;
|
||||
return OutType(q);
|
||||
}
|
||||
@ -117,11 +117,11 @@ VTKM_EXEC OutType CellShapeAndSizeMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
const OutType& avgVolume,
|
||||
vtkm::CellShapeTagHexahedron tag,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
OutType rss = vtkm::worklet::cellmetrics::CellRelativeSizeSquaredMetric<OutType>(
|
||||
numPts, pts, avgVolume, tag, worklet);
|
||||
OutType shape = vtkm::worklet::cellmetrics::CellShapeMetric<OutType>(numPts, pts, tag, worklet);
|
||||
numPts, pts, avgVolume, tag, ec);
|
||||
OutType shape = vtkm::worklet::cellmetrics::CellShapeMetric<OutType>(numPts, pts, tag, ec);
|
||||
OutType q = rss * shape;
|
||||
return OutType(q);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellShapeMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -67,11 +67,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellShapeMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTriangle,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 3)
|
||||
{
|
||||
worklet.RaiseError("Shape metric(triangle) requires 3 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
using Scalar = OutType;
|
||||
@ -79,7 +79,7 @@ VTKM_EXEC OutType CellShapeMetric(const vtkm::IdComponent& numPts,
|
||||
|
||||
const Scalar condition =
|
||||
vtkm::worklet::cellmetrics::CellConditionMetric<Scalar, CollectionOfPoints>(
|
||||
numPts, pts, vtkm::CellShapeTagTriangle(), worklet);
|
||||
numPts, pts, vtkm::CellShapeTagTriangle(), ec);
|
||||
const Scalar q(1 / condition);
|
||||
|
||||
return q;
|
||||
@ -90,11 +90,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellShapeMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Area(quad) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
|
||||
@ -130,11 +130,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellShapeMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagTetra,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Shape metric(tetrahedron) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
using Scalar = OutType;
|
||||
@ -148,7 +148,7 @@ VTKM_EXEC OutType CellShapeMetric(const vtkm::IdComponent& numPts,
|
||||
const Scalar three(3.0);
|
||||
const Scalar jacobian =
|
||||
vtkm::worklet::cellmetrics::CellJacobianMetric<Scalar, CollectionOfPoints>(
|
||||
numPts, pts, vtkm::CellShapeTagTetra(), worklet);
|
||||
numPts, pts, vtkm::CellShapeTagTetra(), ec);
|
||||
|
||||
if (jacobian <= zero)
|
||||
{
|
||||
@ -182,11 +182,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellShapeMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("Volume(hexahedron) requires 8 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
using Scalar = OutType;
|
||||
|
@ -59,7 +59,7 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellShearMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
vtkm::ErrorCode&)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
@ -73,11 +73,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellShearMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 4)
|
||||
{
|
||||
worklet.RaiseError("Diagonal ratio metric(quad) requires 4 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(0.0);
|
||||
}
|
||||
using Scalar = OutType;
|
||||
@ -110,11 +110,11 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellShearMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
if (numPts != 8)
|
||||
{
|
||||
worklet.RaiseError("Diagonal ratio metric(hex) requires 8 points.");
|
||||
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
|
||||
return OutType(-1.0);
|
||||
}
|
||||
using Scalar = OutType;
|
||||
|
@ -43,12 +43,12 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellSkewMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
UNUSED(shape);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
return OutType(-1.0);
|
||||
}
|
||||
|
||||
@ -56,10 +56,10 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellSkewMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
using Scalar = OutType;
|
||||
using Vector = typename PointCoordVecType::ComponentType;
|
||||
Vector X1 = (pts[1] - pts[0]) + (pts[2] - pts[3]) + (pts[5] - pts[4]) + (pts[6] - pts[7]);
|
||||
@ -84,10 +84,10 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellSkewMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
using Scalar = OutType;
|
||||
using CollectionOfPoints = PointCoordVecType;
|
||||
using Vector = typename PointCoordVecType::ComponentType;
|
||||
|
@ -52,12 +52,12 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellStretchMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
UNUSED(shape);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
return OutType(-1.0);
|
||||
}
|
||||
|
||||
@ -65,10 +65,10 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellStretchMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
using Scalar = OutType;
|
||||
using CollectionOfPoints = PointCoordVecType;
|
||||
using Vector = typename PointCoordVecType::ComponentType;
|
||||
@ -91,10 +91,10 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellStretchMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
using Scalar = OutType;
|
||||
using CollectionOfPoints = PointCoordVecType;
|
||||
using Vector = typename PointCoordVecType::ComponentType;
|
||||
|
@ -51,12 +51,12 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellTaperMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
UNUSED(shape);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
return OutType(-1.0);
|
||||
}
|
||||
// ========================= 2D cells ==================================
|
||||
@ -64,10 +64,10 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellTaperMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
using Scalar = OutType;
|
||||
using CollectionOfPoints = PointCoordVecType;
|
||||
using Vector = typename PointCoordVecType::ComponentType;
|
||||
@ -96,10 +96,10 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellTaperMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
using Scalar = OutType;
|
||||
|
||||
Scalar X1 = vtkm::Sqrt(vtkm::MagnitudeSquared((pts[1] - pts[0]) + (pts[2] - pts[3]) +
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "vtkm/CellShape.h"
|
||||
#include "vtkm/CellTraits.h"
|
||||
#include "vtkm/ErrorCode.h"
|
||||
#include "vtkm/VecTraits.h"
|
||||
#include "vtkm/VectorAnalysis.h"
|
||||
#include "vtkm/exec/FunctorBase.h"
|
||||
@ -37,13 +38,13 @@ template <typename OutType, typename PointCoordVecType, typename CellShapeType>
|
||||
VTKM_EXEC OutType CellWarpageMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
CellShapeType shape,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(pts);
|
||||
UNUSED(shape);
|
||||
UNUSED(worklet);
|
||||
//worklet.RaiseError("Shape type template must be Quad to compute warpage");
|
||||
UNUSED(ec);
|
||||
//ec = vtkm::ErrorCode::InvalidCellMetric;
|
||||
return OutType(-1.0);
|
||||
}
|
||||
|
||||
@ -51,10 +52,10 @@ template <typename OutType, typename PointCoordVecType>
|
||||
VTKM_EXEC OutType CellWarpageMetric(const vtkm::IdComponent& numPts,
|
||||
const PointCoordVecType& pts,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& worklet)
|
||||
vtkm::ErrorCode& ec)
|
||||
{
|
||||
UNUSED(numPts);
|
||||
UNUSED(worklet);
|
||||
UNUSED(ec);
|
||||
using Scalar = OutType;
|
||||
using CollectionOfPoints = PointCoordVecType;
|
||||
using Vector = typename PointCoordVecType::ComponentType;
|
||||
|
Loading…
Reference in New Issue
Block a user