53 #ifndef vtk_m_worklet_contourtree_augmented_meshtypes_MeshStructureMarchingCubes_h
54 #define vtk_m_worklet_contourtree_augmented_meshtypes_MeshStructureMarchingCubes_h
68 namespace contourtree_augmented
88 m3d_marchingcubes::LinkVertexConnectionsType::ReadPortalType;
124 LinkVertexConnectionsSixIn.PrepareForInput(device, token);
126 LinkVertexConnectionsEighteenIn.PrepareForInput(device, token);
129 InCubeConnectionsEighteenIn.PrepareForInput(device, token);
138 using namespace m3d_marchingcubes;
213 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
214 #pragma GCC diagnostic push
215 #pragma GCC diagnostic ignored "-Wconversion"
216 #endif // gcc || clang
221 using namespace m3d_marchingcubes;
227 vtkm::Int8 boundaryConfig = ((pos[0] == 0) ? LeftBit : 0) |
228 ((pos[0] == this->
MeshSize[0] - 1) ? RightBit : 0) | ((pos[1] == 0) ? TopBit : 0) |
229 ((pos[1] == this->
MeshSize[1] - 1) ? BottomBit : 0) | ((pos[2] == 0) ? FrontBit : 0) |
230 ((pos[2] == this->
MeshSize[2] - 1) ? BackBit : 0);
234 const int nNeighbours = (!
GetMax ? N_FACE_NEIGHBOURS : N_EDGE_NEIGHBOURS);
235 for (
vtkm::Id nbrNo = 0; nbrNo < nNeighbours; ++nbrNo)
242 if (
GetMax ? (nbrSortIndex > sortIndex) : (nbrSortIndex < sortIndex))
255 bool getMaxComponents)
const
257 using namespace m3d_marchingcubes;
263 vtkm::Int8 boundaryConfig = ((pos[0] == 0) ? LeftBit : 0) |
264 ((pos[0] == this->
MeshSize[0] - 1) ? RightBit : 0) | ((pos[1] == 0) ? TopBit : 0) |
265 ((pos[1] == this->
MeshSize[1] - 1) ? BottomBit : 0) | ((pos[2] == 0) ? FrontBit : 0) |
266 ((pos[2] == this->
MeshSize[2] - 1) ? BackBit : 0);
269 int parentId[N_ALL_NEIGHBOURS];
272 for (
int edgeNo = 0; edgeNo < N_ALL_NEIGHBOURS; ++edgeNo)
278 if (getMaxComponents ? (sortIndex < nbrSortIndex) : (sortIndex > nbrSortIndex))
280 parentId[edgeNo] = edgeNo;
284 parentId[edgeNo] = -1;
289 parentId[edgeNo] = -1;
298 for (
int vtxNo = 0; vtxNo < 7; ++vtxNo)
307 if (getMaxComponents)
309 for (
int edgeNo = 0; edgeNo < 3; ++edgeNo)
318 int root0 = vertex_permutation[edge0];
319 int root1 = vertex_permutation[edge1];
320 VTKM_ASSERT(0 <= root0 && root0 < N_ALL_NEIGHBOURS);
321 VTKM_ASSERT(0 <= root1 && root1 < N_ALL_NEIGHBOURS);
322 while (parentId[root0] != root0)
324 root0 = parentId[root0];
325 VTKM_ASSERT(0 <= root0 && root0 < N_ALL_NEIGHBOURS);
327 while (parentId[root1] != root1)
329 root1 = parentId[root1];
330 VTKM_ASSERT(0 <= root1 && root1 < N_ALL_NEIGHBOURS);
334 VTKM_ASSERT(0 <= root1 && root1 < N_ALL_NEIGHBOURS);
335 parentId[root1] = root0;
342 for (
int edgeNo = 0; edgeNo < 15; ++edgeNo)
351 int root0 = vertex_permutation[edge0];
352 int root1 = vertex_permutation[edge1];
353 VTKM_ASSERT(0 <= root0 && root0 < N_ALL_NEIGHBOURS);
354 VTKM_ASSERT(0 <= root1 && root1 < N_ALL_NEIGHBOURS);
355 while (parentId[root0] != root0)
357 root0 = parentId[root0];
358 VTKM_ASSERT(0 <= root0 && root0 < N_ALL_NEIGHBOURS);
360 while (parentId[root1] != root1)
362 root1 = parentId[root1];
363 VTKM_ASSERT(0 <= root1 && root1 < N_ALL_NEIGHBOURS);
367 VTKM_ASSERT(0 <= root1 && root1 < N_ALL_NEIGHBOURS);
368 parentId[root1] = root0;
376 vtkm::Id neighbourComponentMask = 0;
379 const int nNeighbours = getMaxComponents ? 6 : 18;
380 for (
int nbrNo = 0; nbrNo < nNeighbours; ++nbrNo)
382 if (parentId[nbrNo] == nbrNo)
385 neighbourComponentMask |=
static_cast<vtkm::Id>(1) << nbrNo;
392 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
393 #pragma GCC diagnostic pop
394 #endif // gcc || clang