Go to the documentation of this file.
10 #ifndef vtk_m_rendering_raytracing_MortonCodes_h
11 #define vtk_m_rendering_raytracing_MortonCodes_h
37 x32 = (x32 | (x32 << 16)) & 0x030000FF;
38 x32 = (x32 | (x32 << 8)) & 0x0300F00F;
39 x32 = (x32 | (x32 << 4)) & 0x030C30C3;
40 x32 = (x32 | (x32 << 2)) & 0x09249249;
46 vtkm::UInt64 x64 = x & 0x1FFFFF;
47 x64 = (x64 | x64 << 32) & 0x1F00000000FFFF;
48 x64 = (x64 | x64 << 16) & 0x1F0000FF0000FF;
49 x64 = (x64 | x64 << 8) & 0x100F00F00F00F00F;
50 x64 = (x64 | x64 << 4) & 0x10c30c30c30c30c3;
51 x64 = (x64 | x64 << 2) & 0x1249249249249249;
61 x = vtkm::Min(vtkm::Max(x * 1024.0f, 0.0f), 1023.0f);
62 y = vtkm::Min(vtkm::Max(y * 1024.0f, 0.0f), 1023.0f);
63 z = vtkm::Min(vtkm::Max(z * 1024.0f, 0.0f), 1023.0f);
69 return (zz << 2 | yy << 1 | xx);
77 x = vtkm::Min(vtkm::Max(x * 2097152.0f, 0.0f), 2097151.0f);
78 y = vtkm::Min(vtkm::Max(y * 2097152.0f, 0.0f), 2097151.0f);
79 z = vtkm::Min(vtkm::Max(z * 2097152.0f, 0.0f), 2097151.0f);
85 return (zz << 2 | yy << 1 | xx);
102 if (indices[0] < indices[1])
105 indices[1] = indices[0];
108 if (indices[2] < indices[3])
111 indices[3] = indices[2];
114 if (indices[0] < indices[2])
117 indices[2] = indices[0];
120 if (indices[1] < indices[3])
123 indices[3] = indices[1];
126 if (indices[1] < indices[2])
129 indices[2] = indices[1];
143 void(CellSetIn cellset, WholeArrayIn,
FieldInCell, WholeArrayOut, WholeArrayOut);
147 template <
typename CellShape,
148 typename CellNodeVecType,
149 typename PointPortalType,
150 typename MortonPortalType,
151 typename CellFaceIdsPortalType>
153 const CellNodeVecType& cellIndices,
155 const PointPortalType& points,
157 MortonPortalType& mortonCodes,
158 CellFaceIdsPortalType& cellFaceIds)
const
195 cellFace[0] = cellId;
207 faceIndices[j - 1] = cellIndices[tables.
ShapesFaceList(tableOffset + i, j)];
214 center = points.Get(faceIndices[0]);
215 for (
int idx = 1; idx < indiceCount; ++idx)
218 center = center + points.Get(faceIndices[idx]);
226 code =
Morton3D(center[0], center[1], center[2]);
228 mortonCodes.Set(offset + i, code);
232 cellFaceIds.Set(offset + i, cellFace);
266 vtkm::Float32 halfDistance = sqrtf(vtkm::Dot(direction, direction)) * 0.5f;
275 mortonCode =
Morton3D(centroidx, centroidy, centroidz);
VTKM_EXEC vtkm::Int32 FaceLookUp(vtkm::Int32 x, vtkm::Int32 y) const
Definition: CellTables.h:48
@ CELL_SHAPE_WEDGE
Definition: CellShape.h:49
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
A control signature tag for output fields.
Definition: WorkletMapField.h:60
VTKM_EXEC_CONT void Normalize(T &x)
Changes a vector to be normal.
Definition: VectorAnalysis.h:168
VTKM_EXEC void Sort4(vtkm::Id4 &indices) const
Definition: MortonCodes.h:100
vtkm::Vec3f_32 InverseExtent
Definition: MortonCodes.h:92
VTKM_EXEC void operator()(const CellShape &cellShape, const CellNodeVecType &cellIndices, const vtkm::Id &cellId, const PointPortalType &points, const vtkm::Id &offset, MortonPortalType &mortonCodes, CellFaceIdsPortalType &cellFaceIds) const
Definition: MortonCodes.h:152
void(CellShape, IncidentElementIndices, WorkIndex, _2, _3, _4, _5) ExecutionSignature
Definition: MortonCodes.h:145
vtkm::Vec3f_32 MinCoordinate
Definition: MortonCodes.h:93
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
Definition: MortonCodes.h:237
Definition: CellTables.h:22
A control signature tag for input fields.
Definition: WorkletMapField.h:49
vtkm::Vec3f_32 InverseExtent
Definition: MortonCodes.h:241
void(_1, _2, _3, _4, _5, _6, _7) ExecutionSignature
Definition: MortonCodes.h:253
vtkm::Vec3f_32 MinCoordinate
Definition: MortonCodes.h:242
@ CELL_SHAPE_TETRA
Definition: CellShape.h:46
Base class for worklets that map from Points to Cells.
Definition: WorkletMapTopology.h:255
#define VTKM_CONT
Definition: ExportMacros.h:57
@ CELL_SHAPE_HEXAHEDRON
Definition: CellShape.h:48
VTKM_EXEC vtkm::UInt64 ExpandBits64(vtkm::UInt32 x)
Definition: MortonCodes.h:44
VTKM_CONT MortonCodeAABB(const vtkm::Vec3f_32 &inverseExtent, const vtkm::Vec3f_32 &minCoordinate)
Definition: MortonCodes.h:246
VTKM_EXEC vtkm::Int32 ShapesFaceList(vtkm::Int32 x, vtkm::Int32 y) const
Definition: CellTables.h:68
VTKM_EXEC void operator()(const vtkm::Float32 &xmin, const vtkm::Float32 &ymin, const vtkm::Float32 &zmin, const vtkm::Float32 &xmax, const vtkm::Float32 &ymax, const vtkm::Float32 &zmax, vtkm::UInt32 &mortonCode) const
Definition: MortonCodes.h:257
VTKM_EXEC vtkm::UInt32 Morton3D(vtkm::Float32 &x, vtkm::Float32 &y, vtkm::Float32 &z)
Definition: MortonCodes.h:58
#define BOUNDS_CHECK(HANDLE, INDEX)
Definition: RayTracingTypeDefs.h:31
uint32_t UInt32
Definition: Types.h:161
void(FieldIn, FieldIn, FieldIn, FieldIn, FieldIn, FieldIn, FieldOut) ControlSignature
Definition: MortonCodes.h:252
float Float32
Definition: Types.h:154
VTKM_EXEC vtkm::UInt64 Morton3D64(vtkm::Float32 &x, vtkm::Float32 &y, vtkm::Float32 &z)
Definition: MortonCodes.h:74
int32_t Int32
Definition: Types.h:160
_7 InputDomain
Definition: MortonCodes.h:254
void(CellSetIn cellset, WholeArrayIn, FieldInCell, WholeArrayOut, WholeArrayOut) ControlSignature
Definition: MortonCodes.h:143
@ CELL_SHAPE_PYRAMID
Definition: CellShape.h:50
Definition: MortonCodes.h:88
VTKM_EXEC vtkm::UInt32 ExpandBits32(vtkm::UInt32 x32)
Definition: MortonCodes.h:35
VTKM_EXEC void Normalize(vtkm::Vec3f_32 &point) const
Definition: MortonCodes.h:95
FieldInVisit FieldInCell
Definition: WorkletMapTopology.h:261
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38
VTKM_CONT MortonCodeFace(const vtkm::Vec3f_32 &inverseExtent, const vtkm::Vec3f_32 &minCoordinate)
Definition: MortonCodes.h:136
The ExecutionSignature tag to use to get the work index.
Definition: WorkIndex.h:39