13 #ifndef vtk_m_worklet_contour_flyingedges_helpers_h
14 #define vtk_m_worklet_contour_flyingedges_helpers_h
28 namespace flying_edges
64 template <
typename Device>
98 return vtkm::Id3{ 0, executionSpaceIJK[0], executionSpaceIJK[1] };
102 return vtkm::Id3{ executionSpaceIJK[0], 0, executionSpaceIJK[1] };
110 return vtkm::Id3{ numOfXPoints - 1, executionSpacePDims[0] - 1, executionSpacePDims[1] - 1 };
116 return vtkm::Id3{ executionSpacePDims[0] - 1, numOfYPoints - 1, executionSpacePDims[1] - 1 };
122 return vtkm::Id3{ numOfXPoints, executionSpacePDims[0], executionSpacePDims[1] };
128 return vtkm::Id3{ executionSpacePDims[0], numOfYPoints, executionSpacePDims[1] };
133 return (dims[0] * ijk[1]) + ((dims[0] * dims[1]) * ijk[2]);
137 return ijk[0] + ((dims[0] * dims[1]) * ijk[2]);
149 const auto sliceSize = (pdims[0] * pdims[1]);
150 const auto rowPos = (pdims[0] * ijk[1]);
151 return vtkm::Id4{ rowPos + (sliceSize * ijk[2]),
152 rowPos + pdims[0] + (sliceSize * ijk[2]),
153 rowPos + (sliceSize * (ijk[2] + 1)),
154 rowPos + pdims[0] + (sliceSize * (ijk[2] + 1)) };
165 const auto sliceSize = (pdims[0] * pdims[1]);
166 return vtkm::Id4{ ijk[0] + (sliceSize * ijk[2]),
167 ijk[0] + 1 + (sliceSize * ijk[2]),
168 ijk[0] + (sliceSize * (ijk[2] + 1)),
169 ijk[0] + 1 + (sliceSize * (ijk[2] + 1)) };
184 template <
typename WholeEdgeField>
193 return static_cast<vtkm::UInt8>(e0 | (e1 << 2) | (e2 << 4) | (e3 << 6));
199 template <
typename WholeEdgeField,
typename FieldInPo
intId>
201 const WholeEdgeField& edges,
202 const FieldInPointId& axis_mins,
203 const FieldInPointId& axis_maxs,
210 left = vtkm::Min(axis_mins[0], axis_mins[1]);
211 left = vtkm::Min(left, axis_mins[2]);
212 left = vtkm::Min(left, axis_mins[3]);
214 right = vtkm::Max(axis_maxs[0], axis_maxs[1]);
215 right = vtkm::Max(right, axis_maxs[2]);
216 right = vtkm::Max(right, axis_maxs[3]);
222 if (left > rightMax && right == 0)
225 bool mins_same = (axis_mins[0] == axis_mins[1] && axis_mins[0] == axis_mins[2] &&
226 axis_mins[0] == axis_mins[3]);
227 bool maxs_same = (axis_maxs[0] == axis_maxs[1] && axis_maxs[0] == axis_maxs[2] &&
228 axis_maxs[0] == axis_maxs[3]);
232 if (mins_same && maxs_same)
238 if (e0 == e1 && e1 == e2 && e2 == e3)
248 vtkm::UInt8 e0 = edges.Get(startPos[0] + (left * inc));
249 vtkm::UInt8 e1 = edges.Get(startPos[1] + (left * inc));
250 vtkm::UInt8 e2 = edges.Get(startPos[2] + (left * inc));
251 vtkm::UInt8 e3 = edges.Get(startPos[3] + (left * inc));
252 if ((e0 & 0x1) != (e1 & 0x1) || (e1 & 0x1) != (e2 & 0x1) || (e2 & 0x1) != (e3 & 0x1))
257 e0 = edges.Get(startPos[0] + (right * inc));
258 e1 = edges.Get(startPos[1] + (right * inc));
259 e2 = edges.Get(startPos[2] + (right * inc));
260 e3 = edges.Get(startPos[3] + (right * inc));
261 if ((e0 & 0x2) != (e1 & 0x2) || (e1 & 0x2) != (e2 & 0x2) || (e2 & 0x2) != (e3 & 0x2))