10 #ifndef vtk_m_exec_CellMeasure_h
11 #define vtk_m_exec_CellMeasure_h
29 template <
typename OutType,
typename Po
intCoordVecType,
typename CellShapeType>
31 const PointCoordVecType& pts,
43 template <
typename OutType,
typename Po
intCoordVecType>
45 const PointCoordVecType& pts,
49 OutType arcLength(0.0);
56 arcLength =
static_cast<OutType
>(
Magnitude(pts[1] - pts[0]));
57 for (
int ii = 2; ii < numPts; ++ii)
59 arcLength +=
static_cast<OutType
>(
Magnitude(pts[ii] - pts[ii - 1]));
67 template <
typename OutType,
typename Po
intCoordVecType>
69 const PointCoordVecType& pts,
78 typename PointCoordVecType::ComponentType v1 = pts[1] - pts[0];
79 typename PointCoordVecType::ComponentType v2 = pts[2] - pts[0];
80 OutType area = OutType(0.5) *
static_cast<OutType
>(
Magnitude(
Cross(v1, v2)));
85 template <
typename OutType,
typename Po
intCoordVecType>
87 const PointCoordVecType& pts,
97 typename PointCoordVecType::ComponentType edges[4] = {
110 typename PointCoordVecType::ComponentType cornerNormals[4] = {
111 Cross(edges[3], edges[0]),
112 Cross(edges[0], edges[1]),
113 Cross(edges[1], edges[2]),
114 Cross(edges[2], edges[3]),
118 typename PointCoordVecType::ComponentType principalAxes[2] = {
124 typename PointCoordVecType::ComponentType unitCenterNormal =
125 Cross(principalAxes[0], principalAxes[1]);
129 static_cast<OutType
>(
130 (Dot(unitCenterNormal, cornerNormals[0]) + Dot(unitCenterNormal, cornerNormals[1]) +
131 Dot(unitCenterNormal, cornerNormals[2]) + Dot(unitCenterNormal, cornerNormals[3]))) *
136 template <
typename OutType,
typename Po
intCoordVecType>
138 const PointCoordVecType&,
149 template <
typename OutType,
typename Po
intCoordVecType>
151 const PointCoordVecType& pts,
161 typename PointCoordVecType::ComponentType v1 = pts[1] - pts[0];
162 typename PointCoordVecType::ComponentType v2 = pts[2] - pts[0];
163 typename PointCoordVecType::ComponentType v3 = pts[3] - pts[0];
164 OutType volume =
static_cast<OutType
>(Dot(
Cross(v1, v2), v3)) / OutType(6.0);
169 template <
typename OutType,
typename Po
intCoordVecType>
171 const PointCoordVecType& pts,
208 OutType volume =
static_cast<OutType
>(Dot(
Cross(efg2, efg3), efg1)) / OutType(64.0);
213 template <
typename OutType,
typename Po
intCoordVecType>
215 const PointCoordVecType& pts,
225 typename PointCoordVecType::ComponentType v0 = pts[1] - pts[0];
226 typename PointCoordVecType::ComponentType v1 = pts[2] - pts[0];
227 typename PointCoordVecType::ComponentType v2 = pts[3] - pts[0];
228 OutType volume =
static_cast<OutType
>(Dot(
Cross(v0, v1), v2)) / OutType(6.0);
230 typename PointCoordVecType::ComponentType v3 = pts[4] - pts[1];
231 typename PointCoordVecType::ComponentType v4 = pts[5] - pts[1];
232 typename PointCoordVecType::ComponentType v5 = pts[3] - pts[1];
233 volume +=
static_cast<OutType
>(Dot(
Cross(v3, v4), v5)) / OutType(6.0);
235 typename PointCoordVecType::ComponentType v6 = pts[5] - pts[1];
236 typename PointCoordVecType::ComponentType v7 = pts[2] - pts[1];
237 typename PointCoordVecType::ComponentType v8 = pts[3] - pts[1];
238 volume +=
static_cast<OutType
>(Dot(
Cross(v6, v7), v8)) / OutType(6.0);
244 template <
typename OutType,
typename Po
intCoordVecType>
246 const PointCoordVecType& pts,
256 typename PointCoordVecType::ComponentType v1 = pts[1] - pts[0];
257 typename PointCoordVecType::ComponentType v2 = pts[3] - pts[0];
258 typename PointCoordVecType::ComponentType v3 = pts[4] - pts[0];
259 OutType volume =
static_cast<OutType
>(Dot(
Cross(v1, v2), v3)) / OutType(6.0);
261 typename PointCoordVecType::ComponentType v4 = pts[1] - pts[2];
262 typename PointCoordVecType::ComponentType v5 = pts[3] - pts[2];
263 typename PointCoordVecType::ComponentType v6 = pts[4] - pts[2];
264 volume +=
static_cast<OutType
>(Dot(
Cross(v5, v4), v6)) / OutType(6.0);
271 #endif // vtk_m_exec_CellMeasure_h