13 #ifndef vtk_m_worklet_contour_flyingedges_pass4x_with_norms_h
14 #define vtk_m_worklet_contour_flyingedges_pass4x_with_norms_h
26 namespace flying_edges
62 WholeArrayIn cell_tri_count,
63 WholeArrayIn edgeData,
65 WholeArrayOut connectivity,
66 WholeArrayOut edgeIds,
67 WholeArrayOut weights,
68 WholeArrayOut inputCellIds,
70 WholeArrayOut normals);
72 void(
ThreadIndices, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13,
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,
85 typename WholeNormalsField>
87 const FieldInPointId3& axis_sums,
88 const FieldInPointId& axis_mins,
89 const FieldInPointId& axis_maxs,
90 const WholeTriField& cellTriCount,
91 const WholeEdgeField& edges,
92 const WholeDataField& field,
93 const WholeConnField& conn,
94 const WholeEdgeIdField& interpolatedEdgeIds,
95 const WholeWeightField& weights,
96 const WholeCellIdField& inputCellIds,
97 const WholePointField& points,
98 const WholeNormalsField& normals,
105 vtkm::Id cell_tri_offset = cellTriCount.Get(oidx);
106 vtkm::Id next_tri_offset = cellTriCount.Get(oidx + 1);
107 if (cell_tri_offset == next_tri_offset)
114 AxisToSum{}, this->
PointDims, threadIndices, axis_sums, axis_mins, axis_maxs, edges);
124 auto edgeCase =
getEdgeCase(edges, state.startPos, (state.axis_inc * state.left));
126 for (
vtkm::Id i = state.left; i < state.right; ++i)
128 edgeCase =
getEdgeCase(edges, state.startPos, (state.axis_inc * i));
134 state.cellId, edgeCase, numTris, edgeIds, cell_tri_offset, conn, inputCellIds);
142 this->
Generate(state.boundaryStatus,
151 (state.axis_inc * i),
157 state.increment(AxisToSum{}, pdims);
162 template <
typename WholeDataField,
163 typename WholeIEdgeField,
164 typename WholeWeightField,
165 typename WholePointField,
166 typename WholeNormalField>
169 const WholeDataField& field,
170 const WholeIEdgeField& interpolatedEdgeIds,
171 const WholeWeightField& weights,
172 const WholePointField& points,
173 const WholeNormalField& normals,
185 auto s0 = field.Get(pos[0]);
186 auto g0 = this->
ComputeGradient(fullyInterior, ijk, incs, pos[0], field);
191 auto writeIndex = edgeIds[0];
192 pos[1] = startPos[0] + offset + incs[AxisToSum::xindex];
193 auto s1 = field.Get(pos[1]);
194 T t =
static_cast<T
>((this->IsoValue - s0) / (s1 - s0));
196 interpolatedEdgeIds.Set(writeIndex, pos);
201 points.Set(writeIndex, coord);
204 auto g1 = this->
ComputeGradient(fullyInterior, ijk1, incs, pos[1], field);
205 g1 = g0 + (t * (g1 - g0));
210 auto writeIndex = edgeIds[4];
211 pos[1] = startPos[1] + offset;
212 auto s1 = field.Get(pos[1]);
213 T t =
static_cast<T
>((this->IsoValue - s0) / (s1 - s0));
215 interpolatedEdgeIds.Set(writeIndex, pos);
220 points.Set(writeIndex, coord);
223 auto g1 = this->
ComputeGradient(fullyInterior, ijk1, incs, pos[1], field);
224 g1 = g0 + (t * (g1 - g0));
229 auto writeIndex = edgeIds[8];
230 pos[1] = startPos[2] + offset;
231 auto s1 = field.Get(pos[1]);
232 T t =
static_cast<T
>((this->IsoValue - s0) / (s1 - s0));
234 interpolatedEdgeIds.Set(writeIndex, pos);
239 points.Set(writeIndex, coord);
242 auto g1 = this->
ComputeGradient(fullyInterior, ijk1, incs, pos[1], field);
243 g1 = g0 + (t * (g1 - g0));
261 fullyInterior, ijk, pos[0], incs, 5, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points, normals);
263 fullyInterior, ijk, pos[0], incs, 9, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points, normals);
267 fullyInterior, ijk, pos[0], incs, 11, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points, normals);
272 fullyInterior, ijk, pos[0], incs, 7, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points, normals);
278 fullyInterior, ijk, pos[0], incs, 1, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points, normals);
280 fullyInterior, ijk, pos[0], incs, 10, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points, normals);
284 fullyInterior, ijk, pos[0], incs, 3, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points, normals);
290 fullyInterior, ijk, pos[0], incs, 2, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points, normals);
292 fullyInterior, ijk, pos[0], incs, 6, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, points, normals);
299 template <
typename WholeField,
300 typename WholeIEdgeField,
301 typename WholeWeightField,
302 typename WholePointField,
303 typename WholeNormalField>
311 const WholeField& field,
312 const WholeIEdgeField& interpolatedEdgeIds,
313 const WholeWeightField& weights,
314 const WholePointField& points,
315 const WholeNormalField& normals)
const
320 if (!edgeUses[edgeNum])
324 const vtkm::Id writeIndex = edgeIds[edgeNum];
332 vtkm::Id2 iEdge(currentIdx + vtkm::Dot(offsets1, incs), currentIdx + vtkm::Dot(offsets2, incs));
334 interpolatedEdgeIds.Set(writeIndex, iEdge);
336 auto s0 = field.Get(iEdge[0]);
337 auto s1 = field.Get(iEdge[1]);
338 T t =
static_cast<T
>((this->IsoValue - s0) / (s1 - s0));
342 points.Set(writeIndex, coord);
344 auto g0 = this->
ComputeGradient(fullyInterior, ijk + offsets1, incs, iEdge[0], field);
345 auto g1 = this->
ComputeGradient(fullyInterior, ijk + offsets2, incs, iEdge[1], field);
346 g1 = g0 + (t * (g1 - g0));
372 template <
typename WholeDataField>
377 const WholeDataField& field)
const
382 static_cast<vtkm::FloatDefault>(field.Get(pos + incs[0]) - field.Get(pos - incs[0])) * 0.5f,
383 static_cast<vtkm::FloatDefault>(field.Get(pos + incs[1]) - field.Get(pos - incs[1])) * 0.5f,
384 static_cast<vtkm::FloatDefault>(field.Get(pos + incs[2]) - field.Get(pos - incs[2])) * 0.5f
390 auto s = field.Get(pos);
392 for (
int i = 0; i < 3; ++i)
398 else if (ijk[i] >= (this->PointDims[i] - 1))
405 static_cast<vtkm::FloatDefault>(field.Get(pos + incs[i]) - field.Get(pos - incs[i])) *