73 #ifndef vtkm_worklet_contourtree_mesh2d_dem_saddle_starter_h
74 #define vtkm_worklet_contourtree_mesh2d_dem_saddle_starter_h
95 WholeArrayIn linkMask,
96 WholeArrayIn arcArray,
97 WholeArrayIn inverseIndex,
98 WholeArrayOut edgeNear,
99 WholeArrayOut edgeFar,
100 WholeArrayOut activeEdges);
118 template <
typename InFieldPortalType,
typename OutFieldPortalType>
122 const InFieldPortalType& linkMask,
123 const InFieldPortalType& arcArray,
124 const InFieldPortalType& inverseIndex,
125 const OutFieldPortalType& edgeNear,
126 const OutFieldPortalType& edgeFar,
127 const OutFieldPortalType& activeEdges)
const
136 vtkm::Id nbrMask = linkMask.Get(valueIndex);
147 if ((nbrMask & 0x30) == 0x20)
148 farEnds[outDegree++] = inverseIndex.Get(arcArray.Get(
VERTEX_ID(row - 1, col,
nCols)));
149 if ((nbrMask & 0x18) == 0x10)
150 farEnds[outDegree++] = inverseIndex.Get(arcArray.Get(
VERTEX_ID(row - 1, col - 1,
nCols)));
151 if ((nbrMask & 0x0C) == 0x08)
152 farEnds[outDegree++] = inverseIndex.Get(arcArray.Get(
VERTEX_ID(row, col - 1,
nCols)));
153 if ((nbrMask & 0x06) == 0x04)
154 farEnds[outDegree++] = inverseIndex.Get(arcArray.Get(
VERTEX_ID(row + 1, col,
nCols)));
155 if ((nbrMask & 0x03) == 0x02)
156 farEnds[outDegree++] = inverseIndex.Get(arcArray.Get(
VERTEX_ID(row + 1, col + 1,
nCols)));
157 if ((nbrMask & 0x21) == 0x01)
158 farEnds[outDegree++] = inverseIndex.Get(arcArray.Get(
VERTEX_ID(row, col + 1,
nCols)));
161 if ((outDegree == 2) && (farEnds[0] == farEnds[1]))
166 else if (outDegree == 3)
168 if (farEnds[0] == farEnds[1])
170 if (farEnds[0] == farEnds[2])
178 farEnds[1] = farEnds[2];
183 else if ((farEnds[0] == farEnds[2]) || (farEnds[1] == farEnds[2]))
191 for (
vtkm::Id edge = 0; edge < outDegree; edge++)
197 edgeNear.Set(edgeID, vertex);
198 edgeFar.Set(edgeID, farEnds[edge]);
199 activeEdges.Set(edgeID, edgeID);