13 #ifndef vtk_m_worklet_contour_flyingedges_pass4x_h
14 #define vtk_m_worklet_contour_flyingedges_pass4x_h
27 namespace flying_edges
63 WholeArrayIn cell_tri_count,
64 WholeArrayIn edgeData,
66 WholeArrayOut connectivity,
67 WholeArrayOut edgeIds,
68 WholeArrayOut weights,
69 WholeArrayOut inputCellIds,
70 WholeArrayOut points);
72 void(
ThreadIndices, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12,
WorkIndex);
75 typename FieldInPointId3,
76 typename FieldInPointId,
77 typename WholeTriField,
78 typename WholeEdgeField,
79 typename WholeDataField,
80 typename WholeConnField,
81 typename WholeEdgeIdField,
82 typename WholeWeightField,
83 typename WholeCellIdField,
84 typename WholePointField>
86 const FieldInPointId3& axis_sums,
87 const FieldInPointId& axis_mins,
88 const FieldInPointId& axis_maxs,
89 const WholeTriField& cellTriCount,
90 const WholeEdgeField& edges,
91 const WholeDataField& field,
92 const WholeConnField& conn,
93 const WholeEdgeIdField& interpolatedEdgeIds,
94 const WholeWeightField& weights,
95 const WholeCellIdField& inputCellIds,
96 const WholePointField& points,
103 vtkm::Id cell_tri_offset = cellTriCount.Get(oidx);
104 vtkm::Id next_tri_offset = cellTriCount.Get(oidx + 1);
105 if (cell_tri_offset == next_tri_offset)
112 AxisToSum{}, this->
PointDims, threadIndices, axis_sums, axis_mins, axis_maxs, edges);
122 auto edgeCase =
getEdgeCase(edges, state.startPos, (state.axis_inc * state.left));
124 for (
vtkm::Id i = state.left; i < state.right; ++i)
126 edgeCase =
getEdgeCase(edges, state.startPos, (state.axis_inc * i));
132 state.cellId, edgeCase, numTris, edgeIds, cell_tri_offset, conn, inputCellIds);
139 this->
Generate(state.boundaryStatus,
147 (state.axis_inc * i),
153 state.increment(AxisToSum{}, pdims);
158 template <
typename WholeDataField,
159 typename WholeIEdgeField,
160 typename WholeWeightField,
161 typename WholePointField>
164 const WholeDataField& field,
165 const WholeIEdgeField& interpolatedEdgeIds,
166 const WholeWeightField& weights,
167 const WholePointField& points,
178 auto s0 = field.Get(pos[0]);
183 auto writeIndex = edgeIds[0];
184 pos[1] = startPos[0] + offset + incs[AxisToSum::xindex];
185 auto s1 = field.Get(pos[1]);
186 T t =
static_cast<T
>((this->IsoValue - s0) / (s1 - s0));
188 interpolatedEdgeIds.Set(writeIndex, pos);
192 points.Set(writeIndex, coord);
196 auto writeIndex = edgeIds[4];
197 pos[1] = startPos[1] + offset;
198 auto s1 = field.Get(pos[1]);
199 T t =
static_cast<T
>((this->IsoValue - s0) / (s1 - s0));
201 interpolatedEdgeIds.Set(writeIndex, pos);
205 points.Set(writeIndex, coord);
209 auto writeIndex = edgeIds[8];
210 pos[1] = startPos[2] + offset;
211 auto s1 = field.Get(pos[1]);
212 T t =
static_cast<T
>((this->IsoValue - s0) / (s1 - s0));
214 interpolatedEdgeIds.Set(writeIndex, pos);
218 points.Set(writeIndex, coord);
234 this->
InterpolateEdge(ijk, pos[0], incs, 5, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points);
235 this->
InterpolateEdge(ijk, pos[0], incs, 9, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points);
238 this->
InterpolateEdge(ijk, pos[0], incs, 11, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points);
242 this->
InterpolateEdge(ijk, pos[0], incs, 7, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points);
247 this->
InterpolateEdge(ijk, pos[0], incs, 1, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points);
248 this->
InterpolateEdge(ijk, pos[0], incs, 10, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points);
251 this->
InterpolateEdge(ijk, pos[0], incs, 3, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points);
256 this->
InterpolateEdge(ijk, pos[0], incs, 2, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points);
257 this->
InterpolateEdge(ijk, pos[0], incs, 6, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points);
264 template <
typename WholeField,
265 typename WholeIEdgeField,
266 typename WholeWeightField,
267 typename WholePointField>
274 const WholeField& field,
275 const WholeIEdgeField& interpolatedEdgeIds,
276 const WholeWeightField& weights,
277 const WholePointField& points)
const
282 if (!edgeUses[edgeNum])
286 const vtkm::Id writeIndex = edgeIds[edgeNum];
294 vtkm::Id2 iEdge(currentIdx + vtkm::Dot(offsets1, incs), currentIdx + vtkm::Dot(offsets2, incs));
296 interpolatedEdgeIds.Set(writeIndex, iEdge);
298 auto s0 = field.Get(iEdge[0]);
299 auto s1 = field.Get(iEdge[1]);
300 T t =
static_cast<T
>((this->IsoValue - s0) / (s1 - s0));
304 points.Set(writeIndex, coord);