53 #ifndef vtk_m_worklet_contourtree_augmented_mesh_dem_mesh_types_mesh_boundary_compute_mesh_boundary_3D_h
54 #define vtk_m_worklet_contourtree_augmented_mesh_dem_mesh_types_mesh_boundary_compute_mesh_boundary_3D_h
63 namespace contourtree_augmented
73 WholeArrayIn sortIndices,
74 ExecObject meshBoundary,
86 template <
typename InFieldPortalType,
typename MeshBoundaryType>
88 const InFieldPortalType sortIndicesPortal,
89 const MeshBoundaryType& meshBoundary,
93 auto meshStructure3D = meshBoundary.GetMeshStructure();
94 vtkm::Id3 meshSize = meshStructure3D.MeshSize;
97 vtkm::Id nBoundary = 2 * meshSize[1] * meshSize[0]
98 + 2 * meshSize[1] * (meshSize[2] - 2)
99 + 2 * (meshSize[0] - 2) * (meshSize[2] - 2);
102 vtkm::Id sliceSize = meshSize[1] * meshSize[0];
103 vtkm::Id sliceBoundarySize = 2 * meshSize[1] + 2 * meshSize[0] - 4;
105 if (boundaryId < sliceSize)
107 pos[0] = boundaryId % meshSize[0];
108 pos[1] = boundaryId / meshSize[0];
112 else if (boundaryId >= nBoundary - sliceSize)
114 pos[0] = (boundaryId - (nBoundary - sliceSize)) % meshSize[0];
115 pos[1] = (boundaryId - (nBoundary - sliceSize)) / meshSize[0];
116 pos[2] = meshSize[2] - 1;
122 vtkm::Id offsetBoundaryid = boundaryId - sliceSize;
124 pos[2] = 1 + offsetBoundaryid / sliceBoundarySize;
126 vtkm::Id sliceBoundaryId = offsetBoundaryid % sliceBoundarySize;
128 if (sliceBoundaryId < meshSize[0])
130 pos[0] = sliceBoundaryId;
133 else if (sliceBoundaryId >= (sliceBoundarySize - meshSize[0]))
135 pos[0] = sliceBoundaryId - (sliceBoundarySize - meshSize[0]);
136 pos[1] = meshSize[1] - 1;
140 pos[0] = ((sliceBoundaryId - meshSize[0]) % 2) ? (meshSize[0] - 1) : 0;
141 pos[1] = ((sliceBoundaryId - meshSize[0]) / 2) + 1;
145 boundaryVertex = meshStructure3D.VertexId(pos);
147 boundarySortIndex = sortIndicesPortal.Get(boundaryVertex);