20 #ifndef vtk_m_worklet_cellmetrics_CellAspectRatioMetric_h
21 #define vtk_m_worklet_cellmetrics_CellAspectRatioMetric_h
41 #define UNUSED(expr) (void)(expr);
55 template <
typename OutType,
typename Po
intCoordVecType,
typename CellShapeType>
57 const PointCoordVecType& pts,
70 template <
typename OutType,
typename Po
intCoordVecType>
72 const PointCoordVecType& pts,
73 vtkm::CellShapeTagTriangle,
82 using Scalar = OutType;
83 using CollectionOfPoints = PointCoordVecType;
84 using Vector =
typename PointCoordVecType::ComponentType;
86 const Scalar lmax = GetTriangleLMax<Scalar, Vector, CollectionOfPoints>(pts);
87 const Scalar r = GetTriangleInradius<Scalar, Vector, CollectionOfPoints>(pts);
88 const Scalar hhalf(0.5);
89 const Scalar three(3.0);
90 const Scalar q = (lmax * hhalf * vtkm::RSqrt(three)) / r;
94 template <
typename OutType,
typename Po
intCoordVecType>
96 const PointCoordVecType& pts,
97 vtkm::CellShapeTagQuad,
106 using Scalar = OutType;
107 using CollectionOfPoints = PointCoordVecType;
108 using Vector =
typename PointCoordVecType::ComponentType;
110 const Vector X1 = GetQuadX0<Scalar, Vector, CollectionOfPoints>(pts);
111 const Vector X2 = GetQuadX1<Scalar, Vector, CollectionOfPoints>(pts);
115 if (x1 <= Scalar(0.0) || x2 <= Scalar(0.0))
117 return vtkm::Infinity<Scalar>();
120 const Scalar q = vtkm::Max(x1 / x2, x2 / x1);
125 template <
typename OutType,
typename Po
intCoordVecType>
127 const PointCoordVecType& pts,
128 vtkm::CellShapeTagHexahedron,
137 using Scalar = OutType;
138 using CollectionOfPoints = PointCoordVecType;
139 using Vector =
typename PointCoordVecType::ComponentType;
141 const Vector X1 = GetHexX1<Scalar, Vector, CollectionOfPoints>(pts);
142 const Vector X2 = GetHexX2<Scalar, Vector, CollectionOfPoints>(pts);
143 const Vector X3 = GetHexX3<Scalar, Vector, CollectionOfPoints>(pts);
149 if (x1 <= Scalar(0.0) || x2 <= Scalar(0.0) || x3 <= Scalar(0.0))
151 return vtkm::Infinity<Scalar>();
154 const Scalar q = vtkm::Max(
156 vtkm::Max(x2 / x1, vtkm::Max(x1 / x3, vtkm::Max(x3 / x1, vtkm::Max(x3 / x2, x3 / x2)))));
161 template <
typename OutType,
typename Po
intCoordVecType>
163 const PointCoordVecType& pts,
164 vtkm::CellShapeTagTetra,
173 using Scalar = OutType;
174 using CollectionOfPoints = PointCoordVecType;
175 using Vector =
typename PointCoordVecType::ComponentType;
177 const Scalar rootSixInvert = vtkm::RSqrt(Scalar(6.0));
178 const Scalar hhalf(0.5);
179 const Scalar lmax = GetTetraLMax<Scalar, Vector, CollectionOfPoints>(pts);
180 const Scalar r = GetTetraInradius<Scalar, Vector, CollectionOfPoints>(pts);
181 const Scalar q = (hhalf * rootSixInvert * lmax) / r;
187 #endif // vtk_m_worklet_cellmetrics_CellAspectRatioMetric_h