20 #ifndef vtk_m_worklet_CellTaperMetric_h
21 #define vtk_m_worklet_CellTaperMetric_h
41 #define UNUSED(expr) (void)(expr);
52 template <
typename OutType,
typename Po
intCoordVecType,
typename CellShapeType>
54 const PointCoordVecType& pts,
65 template <
typename OutType,
typename Po
intCoordVecType>
67 const PointCoordVecType& pts,
68 vtkm::CellShapeTagQuad,
73 using Scalar = OutType;
74 using CollectionOfPoints = PointCoordVecType;
75 using Vector =
typename PointCoordVecType::ComponentType;
77 const Vector X12 = Vector((pts[0] - pts[1]) + (pts[2] - pts[3]));
78 const Vector X1 = GetQuadX0<Scalar, Vector, CollectionOfPoints>(pts);
79 const Vector X2 = GetQuadX1<Scalar, Vector, CollectionOfPoints>(pts);
84 const Scalar minLength = vtkm::Min(x1, x2);
86 if (minLength <= Scalar(0.0))
88 return vtkm::Infinity<Scalar>();
91 const Scalar q = x12 / minLength;
97 template <
typename OutType,
typename Po
intCoordVecType>
99 const PointCoordVecType& pts,
100 vtkm::CellShapeTagHexahedron,
105 using Scalar = OutType;
108 (pts[1] - pts[0]) + (pts[2] - pts[3]) + (pts[5] - pts[4]) + (pts[6] - pts[7]))));
110 (pts[3] - pts[0]) + (pts[2] - pts[1]) + (pts[7] - pts[4]) + (pts[6] - pts[5]))));
112 (pts[4] - pts[0]) + (pts[5] - pts[1]) + (pts[6] - pts[2]) + (pts[7] - pts[3]))));
113 if ((X1 <= Scalar(0.0)) || (X2 <= Scalar(0.0)) || (X3 <= Scalar(0.0)))
115 return vtkm::Infinity<Scalar>();
118 ((pts[2] - pts[3]) - (pts[1] - pts[0])) + ((pts[6] - pts[7]) - (pts[5] - pts[4])))));
120 ((pts[5] - pts[1]) - (pts[4] - pts[0])) + ((pts[6] - pts[2]) - (pts[7] - pts[3])))));
122 ((pts[7] - pts[4]) - (pts[3] - pts[0])) + ((pts[6] - pts[5]) - (pts[2] - pts[1])))));
123 Scalar T12 = X12 / vtkm::Min(X1, X2);
124 Scalar T13 = X13 / vtkm::Min(X1, X3);
125 Scalar T23 = X23 / vtkm::Min(X2, X3);
126 return vtkm::Max(T12, vtkm::Max(T13, T23));
131 #endif // vtk_m_worklet_CellTaperMetric_h