20 #ifndef vtk_m_worklet_cellmetrics_CellRelativeSizeSquaredMetric_h
21 #define vtk_m_worklet_cellmetrics_CellRelativeSizeSquaredMetric_h
45 #define UNUSED(expr) (void)(expr);
59 template <
typename OutType,
typename Po
intCoordVecType,
typename CellShapeType>
61 const PointCoordVecType& pts,
62 const OutType& avgArea,
75 template <
typename OutType,
typename Po
intCoordVecType>
77 const PointCoordVecType& pts,
78 const OutType& avgArea,
79 vtkm::CellShapeTagTriangle tag,
88 OutType A = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, ec);
89 OutType R = A / avgArea;
92 OutType q = vtkm::Pow(vtkm::Min(R, OutType(1.) / R), OutType(2.));
96 template <
typename OutType,
typename Po
intCoordVecType>
98 const PointCoordVecType& pts,
99 const OutType& avgArea,
100 vtkm::CellShapeTagQuad tag,
109 OutType A = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, ec);
110 OutType R = A / avgArea;
111 if (R == OutType(0.))
113 OutType q = vtkm::Pow(vtkm::Min(R, OutType(1.) / R), OutType(2.));
119 template <
typename OutType,
typename Po
intCoordVecType>
121 const PointCoordVecType& pts,
122 const OutType& avgVolume,
123 vtkm::CellShapeTagTetra tag,
132 OutType V = vtkm::exec::CellMeasure<OutType>(numPts, pts, tag, ec);
133 OutType R = V / avgVolume;
134 if (R == OutType(0.))
136 OutType q = vtkm::Pow(vtkm::Min(R, OutType(1.) / R), OutType(2.));
140 template <
typename OutType,
typename Po
intCoordVecType>
142 const PointCoordVecType& pts,
143 const OutType& avgVolume,
144 vtkm::CellShapeTagHexahedron tag,
154 OutType X1x =
static_cast<OutType
>((pts[1][0] - pts[0][0]) + (pts[2][0] - pts[3][0]) +
155 (pts[5][0] - pts[4][0]) + (pts[6][0] - pts[7][0]));
156 OutType X1y =
static_cast<OutType
>((pts[1][1] - pts[0][1]) + (pts[2][1] - pts[3][1]) +
157 (pts[5][1] - pts[4][1]) + (pts[6][1] - pts[7][1]));
158 OutType X1z =
static_cast<OutType
>((pts[1][2] - pts[0][2]) + (pts[2][2] - pts[3][2]) +
159 (pts[5][2] - pts[4][2]) + (pts[6][2] - pts[7][2]));
161 OutType X2x =
static_cast<OutType
>((pts[2][0] - pts[0][0]) + (pts[2][0] - pts[1][0]) +
162 (pts[7][0] - pts[4][0]) + (pts[6][0] - pts[5][0]));
163 OutType X2y =
static_cast<OutType
>((pts[2][1] - pts[0][1]) + (pts[2][1] - pts[1][1]) +
164 (pts[7][1] - pts[4][1]) + (pts[6][1] - pts[5][1]));
165 OutType X2z =
static_cast<OutType
>((pts[2][2] - pts[0][2]) + (pts[2][2] - pts[1][2]) +
166 (pts[7][2] - pts[4][2]) + (pts[6][2] - pts[5][2]));
168 OutType X3x =
static_cast<OutType
>((pts[4][0] - pts[0][0]) + (pts[5][0] - pts[1][0]) +
169 (pts[6][0] - pts[2][0]) + (pts[7][0] - pts[3][0]));
170 OutType X3y =
static_cast<OutType
>((pts[4][1] - pts[0][1]) + (pts[5][1] - pts[1][1]) +
171 (pts[6][1] - pts[2][1]) + (pts[7][1] - pts[3][1]));
172 OutType X3z =
static_cast<OutType
>((pts[4][2] - pts[0][2]) + (pts[5][2] - pts[1][2]) +
173 (pts[6][2] - pts[2][2]) + (pts[7][2] - pts[3][2]));
179 D = D / (OutType(64.) * avgVolume);
180 if (D == OutType(0.))
182 OutType q = vtkm::Pow(vtkm::Min(D, OutType(1.) / D), OutType(2.));
190 #endif // vtk_m_worklet_cellmetrics_CellRelativeSizeSquaredMetric_h