Go to the documentation of this file.
10 #ifndef vtk_m_rendering_raytracing_MeshConnectivity
11 #define vtk_m_rendering_raytracing_MeshConnectivity
41 , PointDims(pointDims)
50 logicalCellId[0] = cellId % CellDims[0];
51 logicalCellId[1] = (cellId / CellDims[0]) % CellDims[1];
52 logicalCellId[2] = cellId / (CellDims[0] * CellDims[1]);
54 logicalCellId[1] -= 1;
56 logicalCellId[1] += 1;
58 logicalCellId[0] += 1;
60 logicalCellId[0] -= 1;
62 logicalCellId[2] -= 1;
64 logicalCellId[2] += 1;
66 (logicalCellId[2] * CellDims[1] + logicalCellId[1]) * CellDims[0] + logicalCellId[0];
67 bool validCell =
true;
68 if (logicalCellId[0] >= CellDims[0])
70 if (logicalCellId[1] >= CellDims[1])
72 if (logicalCellId[2] >= CellDims[2])
74 vtkm::Id minId = vtkm::Min(logicalCellId[0], vtkm::Min(logicalCellId[1], logicalCellId[2]));
86 cellId[0] = cellIndex % CellDims[0];
87 cellId[1] = (cellIndex / CellDims[0]) % CellDims[1];
88 cellId[2] = cellIndex / (CellDims[0] * CellDims[1]);
89 cellIndices[0] = (cellId[2] * PointDims[1] + cellId[1]) * PointDims[0] + cellId[0];
90 cellIndices[1] = cellIndices[0] + 1;
91 cellIndices[2] = cellIndices[1] + PointDims[0];
92 cellIndices[3] = cellIndices[2] - 1;
93 cellIndices[4] = cellIndices[0] + PointDims[0] * PointDims[1];
94 cellIndices[5] = cellIndices[4] + 1;
95 cellIndices[6] = cellIndices[5] + PointDims[0];
96 cellIndices[7] = cellIndices[6] - 1;
133 : FaceConnPortal(faceConnectivity.PrepareForInput(device, token))
134 , FaceOffsetsPortal(faceOffsets.PrepareForInput(device, token))
135 , CellConnPortal(cellConn.PrepareForInput(device, token))
136 , CellOffsetsPortal(cellOffsets.PrepareForInput(device, token))
137 , ShapesPortal(shapes.PrepareForInput(device, token))
145 vtkm::Id cellStartIndex = FaceOffsetsPortal.Get(cellId);
147 return FaceConnPortal.Get(cellStartIndex + face);
158 const vtkm::Id cellOffset = CellOffsetsPortal.Get(cellId);
163 cellIndices[i] = CellConnPortal.Get(cellOffset + i);
173 return ShapesPortal.Get(cellId);
254 Variant<MeshConnectivityStructured, MeshConnectivityUnstructured, MeshConnectivitySingleType>;
305 return this->Connectivity.CastAndCall(
306 [=](
auto conn) {
return conn.GetConnectingCell(cellId, face); });
312 return this->Connectivity.CastAndCall(
313 [=](
auto conn) {
return conn.GetCellIndices(cellIndices, cellId); });
319 return this->Connectivity.CastAndCall([=](
auto conn) {
return conn.GetCellShape(cellId); });
328 #endif // MeshConnectivity
typename vtkm::cont::ArrayHandle< vtkm::Id > IdHandle
Definition: MeshConnectivity.h:110
vtkm::Id3 CellDims
Definition: MeshConnectivity.h:34
VTKM_EXEC vtkm::Int32 FaceLookUp(vtkm::Int32 x, vtkm::Int32 y) const
Definition: CellTables.h:48
UCharConstPortal ShapesPortal
Definition: MeshConnectivity.h:122
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
typename CountingHandle::ReadPortalType CountingPortal
Definition: MeshConnectivity.h:185
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::cont::ArrayHandle< vtkm::Id4 > Id4Handle
Definition: MeshConnectivity.h:33
vtkm::Id3 PointDims
Definition: MeshConnectivity.h:35
VTKM_EXEC_CONT vtkm::Id GetConnectingCell(const vtkm::Id &cellId, const vtkm::Id &face) const
Definition: MeshConnectivity.h:142
vtkm::exec::Variant< MeshConnectivityStructured, MeshConnectivityUnstructured, MeshConnectivitySingleType > ConnectivityType
Definition: MeshConnectivity.h:254
IdConstPortal FaceOffsetsPortal
Definition: MeshConnectivity.h:118
VTKM_EXEC vtkm::Int32 CellTypeLookUp(vtkm::Int32 x) const
Definition: CellTables.h:25
IdConstPortal FaceConnPortal
Definition: MeshConnectivity.h:117
vtkm::Int32 ShapeId
Definition: MeshConnectivity.h:191
typename UCharHandle::ReadPortalType UCharConstPortal
Definition: MeshConnectivity.h:113
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
VTKM_EXEC_CONT vtkm::UInt8 GetCellShape(const vtkm::Id &cellId) const
Definition: MeshConnectivity.h:317
IdConstPortal FaceConnPortal
Definition: MeshConnectivity.h:187
VTKM_EXEC vtkm::Id GetConnectingCell(const vtkm::Id &cellId, const vtkm::Id &face) const
Definition: MeshConnectivity.h:218
Definition: CellTables.h:22
VTKM_EXEC_CONT vtkm::Int32 GetCellIndices(vtkm::Id cellIndices[8], const vtkm::Id &cellId) const
Definition: MeshConnectivity.h:310
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
General version of mesh connectivity that can be used for all supported mesh types.
Definition: MeshConnectivity.h:251
typename IdHandle::ReadPortalType IdConstPortal
Definition: MeshConnectivity.h:182
IdConstPortal CellConnPortal
Definition: MeshConnectivity.h:120
typename vtkm::cont::ArrayHandle< vtkm::Id > IdHandle
Definition: MeshConnectivity.h:181
vtkm::Int32 NumIndices
Definition: MeshConnectivity.h:192
VTKM_EXEC vtkm::Int32 GetCellIndices(vtkm::Id cellIndices[8], const vtkm::Id &cellId) const
Definition: MeshConnectivity.h:152
VTKM_CONT MeshConnectivitySingleType(const IdHandle &faceConn, const IdHandle &cellConn, const CountingHandle &cellOffsets, vtkm::Int32 shapeId, vtkm::Int32 numIndices, vtkm::Int32 numFaces, vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token)
Definition: MeshConnectivity.h:197
VTKM_CONT MeshConnectivityStructured(const vtkm::Id3 &cellDims, const vtkm::Id3 &pointDims)
Definition: MeshConnectivity.h:39
#define VTKM_CONT
Definition: ExportMacros.h:57
typename vtkm::cont::ArrayHandleCounting< vtkm::Id > CountingHandle
Definition: MeshConnectivity.h:184
@ CELL_SHAPE_HEXAHEDRON
Definition: CellShape.h:48
uint8_t UInt8
Definition: Types.h:157
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
#define BOUNDS_CHECK(HANDLE, INDEX)
Definition: RayTracingTypeDefs.h:31
VTKM_EXEC vtkm::UInt8 GetCellShape(const vtkm::Id &vtkmNotUsed(cellId)) const
Definition: MeshConnectivity.h:243
vtkm::Int32 NumFaces
Definition: MeshConnectivity.h:193
Definition: MeshConnectivity.h:178
Definition: DeviceAdapterTag.h:52
IdConstPortal CellOffsetsPortal
Definition: MeshConnectivity.h:121
typename IdHandle::ReadPortalType IdConstPortal
Definition: MeshConnectivity.h:112
VTKM_EXEC_CONT vtkm::Int32 GetCellIndices(vtkm::Id cellIndices[8], const vtkm::Id &cellIndex) const
Definition: MeshConnectivity.h:83
typename vtkm::cont::ArrayHandle< vtkm::UInt8 > UCharHandle
Definition: MeshConnectivity.h:111
VTKM_EXEC_CONT vtkm::Id GetConnectingCell(const vtkm::Id &cellId, const vtkm::Id &face) const
Definition: MeshConnectivity.h:46
VTKM_CONT MeshConnectivity(const vtkm::cont::ArrayHandle< vtkm::Id > &faceConnectivity, const vtkm::cont::ArrayHandle< vtkm::Id > &faceOffsets, const vtkm::cont::ArrayHandle< vtkm::Id > &cellConn, const vtkm::cont::ArrayHandle< vtkm::Id > &cellOffsets, const vtkm::cont::ArrayHandle< vtkm::UInt8 > &shapes, vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token)
Definition: MeshConnectivity.h:265
VTKM_EXEC vtkm::UInt8 GetCellShape(const vtkm::Id &cellId) const
Definition: MeshConnectivity.h:170
Definition: MeshConnectivity.h:30
int32_t Int32
Definition: Types.h:160
Definition: MeshConnectivity.h:107
VTKM_CONT MeshConnectivity(const vtkm::Id3 &cellDims, const vtkm::Id3 &pointDims)
Definition: MeshConnectivity.h:259
VTKM_CONT MeshConnectivityUnstructured(const IdHandle &faceConnectivity, const IdHandle &faceOffsets, const IdHandle &cellConn, const IdHandle &cellOffsets, const UCharHandle &shapes, vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token)
Definition: MeshConnectivity.h:126
VTKM_EXEC_CONT vtkm::Id GetConnectingCell(const vtkm::Id &cellId, const vtkm::Id &face) const
Definition: MeshConnectivity.h:303
VTKM_EXEC vtkm::Int32 GetCellIndices(vtkm::Id cellIndices[8], const vtkm::Id &cellId) const
Definition: MeshConnectivity.h:227
IdConstPortal CellConnectivityPortal
Definition: MeshConnectivity.h:188
#define VTKM_ALWAYS_EXPORT
Definition: ExportMacros.h:92
VTKM_CONT MeshConnectivity(const vtkm::cont::ArrayHandle< vtkm::Id > &faceConn, const vtkm::cont::ArrayHandle< vtkm::Id > &cellConn, const vtkm::cont::ArrayHandleCounting< vtkm::Id > &cellOffsets, vtkm::Int32 shapeId, vtkm::Int32 numIndices, vtkm::Int32 numFaces, vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token)
Definition: MeshConnectivity.h:283
ConnectivityType Connectivity
Definition: MeshConnectivity.h:255
CountingPortal CellOffsetsPortal
Definition: MeshConnectivity.h:189
VTKM_EXEC vtkm::UInt8 GetCellShape(const vtkm::Id &vtkmNotUsed(cellId)) const
Definition: MeshConnectivity.h:101