Go to the documentation of this file.
18 #ifndef viskores_rendering_Quadralizer_h
19 #define viskores_rendering_Quadralizer_h
27 #include <viskores/rendering/raytracing/MeshConnectivityBuilder.h>
33 #define QUAD_PER_CSS 6
101 #if defined(VISKORES_MSVC)
102 #pragma warning(push)
103 #pragma warning(disable : 4127) //conditional expression is constant
105 template <
typename CellNodeVecType,
typename OutIndicesPortal>
109 const CellNodeVecType& cellIndices,
110 OutIndicesPortal& outputIndices)
const
117 outputIndices.Set(offset, quad);
120 template <
typename CellNodeVecType,
typename OutIndicesPortal>
123 OutIndicesPortal& outputIndices)
const
128 cellIndex, { cellIndex, cellIndices[0], cellIndices[1], cellIndices[2], cellIndices[3] });
140 cell2quad(idx, quad, offset, cellIndices, outputIndices);
147 cell2quad(idx, quad, offset, cellIndices, outputIndices);
154 cell2quad(idx, quad, offset, cellIndices, outputIndices);
161 cell2quad(idx, quad, offset, cellIndices, outputIndices);
168 cell2quad(idx, quad, offset, cellIndices, outputIndices);
175 cell2quad(idx, quad, offset, cellIndices, outputIndices);
178 #if defined(VISKORES_MSVC)
193 template <
typename VecType,
typename OutputPortal>
195 const VecType& cellIndices,
201 OutputPortal& outputIndices)
const
209 outputIndices.Set(offset++, quad);
212 template <
typename VecType,
typename OutputPortal>
215 const VecType& cellIndices,
217 OutputPortal& outputIndices)
const
221 cell2quad(offset, cellIndices, cellId, 3, 0, 2, 5, outputIndices);
222 cell2quad(offset, cellIndices, cellId, 1, 4, 5, 2, outputIndices);
223 cell2quad(offset, cellIndices, cellId, 0, 3, 4, 1, outputIndices);
225 template <
typename VecType,
typename OutputPortal>
228 const VecType& cellIndices,
230 OutputPortal& outputIndices)
const
240 outputIndices.Set(offset, quad);
244 template <
typename VecType,
typename OutputPortal>
247 const VecType& cellIndices,
249 OutputPortal& outputIndices)
const
253 cell2quad(offset, cellIndices, cellId, 0, 1, 5, 4, outputIndices);
254 cell2quad(offset, cellIndices, cellId, 1, 2, 6, 5, outputIndices);
255 cell2quad(offset, cellIndices, cellId, 3, 7, 6, 2, outputIndices);
256 cell2quad(offset, cellIndices, cellId, 0, 4, 7, 3, outputIndices);
257 cell2quad(offset, cellIndices, cellId, 0, 3, 2, 1, outputIndices);
258 cell2quad(offset, cellIndices, cellId, 4, 5, 6, 7, outputIndices);
261 template <
typename VecType,
typename OutputPortal>
264 const VecType& cellIndices,
266 OutputPortal& outputIndices)
const
273 quad[1] = cellIndices[0];
274 quad[2] = cellIndices[1];
275 quad[3] = cellIndices[2];
276 quad[4] = cellIndices[3];
277 outputIndices.Set(pointOffset, quad);
282 cell2quad(offset, cellIndices, cellId, 0, 1, 5, 4, outputIndices);
283 cell2quad(offset, cellIndices, cellId, 1, 2, 6, 5, outputIndices);
284 cell2quad(offset, cellIndices, cellId, 3, 7, 6, 2, outputIndices);
285 cell2quad(offset, cellIndices, cellId, 0, 4, 7, 3, outputIndices);
286 cell2quad(offset, cellIndices, cellId, 0, 3, 2, 1, outputIndices);
287 cell2quad(offset, cellIndices, cellId, 4, 5, 6, 7, outputIndices);
293 cell2quad(offset, cellIndices, cellId, 3, 0, 2, 5, outputIndices);
294 cell2quad(offset, cellIndices, cellId, 1, 4, 5, 2, outputIndices);
295 cell2quad(offset, cellIndices, cellId, 0, 3, 4, 1, outputIndices);
301 cell2quad(offset, cellIndices, cellId, 3, 2, 1, 0, outputIndices);
337 outputIndices.Allocate(numCells);
344 auto cellSetUnstructured =
347 invoke(
CountQuads{}, cellSetUnstructured, quadsPerCell);
354 outputIndices.Allocate(total);
356 invoke(
Quadralize{}, cellSetUnstructured, cellOffsets, outputIndices);
A control signature tag for input fields on the cells of the topology.
Definition: WorkletMapTopology.h:299
@ CELL_SHAPE_PYRAMID
A pyramid with a quadrilateral base and four triangular faces.0.
Definition: CellShape.h:76
viskores::UInt8 Id
An identifier that corresponds to one of the CELL_SHAPE_* identifiers.
Definition: CellShape.h:188
Definition: Quadralizer.h:91
CountQuads()
Definition: Quadralizer.h:47
void ExecutionSignature(IncidentElementIndices, _2, _3)
Definition: Quadralizer.h:96
A control signature tag for input connectivity.
Definition: WorkletMapTopology.h:289
Definition: CellShape.h:167
void cell2quad(viskores::Id &offset, const VecType &cellIndices, const viskores::Id &cellId, const viskores::Id Id0, const viskores::Id Id1, const viskores::Id Id2, const viskores::Id Id3, OutputPortal &outputIndices) const
Definition: Quadralizer.h:194
#define viskoresNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:136
static U Reduce(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: Algorithm.h:672
static T ScanExclusive(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:836
void Run(const viskores::cont::UnknownCellSet &cellset, viskores::cont::ArrayHandle< viskores::Vec< viskores::Id, 5 >> &outputIndices, viskores::Id &output)
Definition: Quadralizer.h:312
Definition: Quadralizer.h:40
An execution signature tag to get the shape of the visited cell.
Definition: WorkletMapTopology.h:406
void operator()(const CellNodeVecType &cellIndices, const viskores::Id &cellIndex, OutIndicesPortal &outputIndices) const
Definition: Quadralizer.h:121
Manages an array-worth of data.
Definition: ArrayHandle.h:313
Quadralize()
Definition: Quadralizer.h:189
A control signature tag for output fields.
Definition: WorkletMapTopology.h:339
#define VISKORES_DEFAULT_CELL_SET_LIST_UNSTRUCTURED
Definition: DefaultTypes.h:68
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
@ CELL_SHAPE_HEXAHEDRON
A hexahedron.
Definition: CellShape.h:70
Base class for worklets that map from Points to Cells.
Definition: WorkletMapTopology.h:265
void operator()(viskores::CellShapeTagHexahedron, viskores::Id &quads) const
Definition: Quadralizer.h:68
A special cell shape tag that holds a cell shape that is not known at compile time.
Definition: CellShape.h:178
void ExecutionSignature(CellShape, _2)
Definition: Quadralizer.h:49
An execution signature tag to get the indices of the incident points.
Definition: WorkletMapTopology.h:426
void ControlSignature(CellSetIn cellset, FieldInCell, WholeArrayOut)
Definition: Quadralizer.h:190
Definition: CellShape.h:168
#define QUAD_PER_CSS
Definition: Quadralizer.h:33
void operator()(viskores::CellShapeTagGeneric shapeType, viskores::Id &quads) const
Definition: Quadralizer.h:52
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
@ CELL_SHAPE_WEDGE
A wedge.
Definition: CellShape.h:74
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores::cont::UncertainCellSet< CellSetList > ResetCellSetList(CellSetList) const
Assigns potential cell set types.
Quadralizer()
Definition: Quadralizer.h:309
Groups connected points that have the same field value.
Definition: Atomic.h:27
void operator()(viskores::CellShapeTagWedge, viskores::Id &quads) const
Definition: Quadralizer.h:83
void operator()(viskores::CellShapeTagQuad shapeType, viskores::Id &quads) const
Definition: Quadralizer.h:75
Definition: CellShape.h:164
void ControlSignature(CellSetIn cellset, FieldInCell, WholeArrayOut)
Definition: Quadralizer.h:95
void operator()(const viskores::Id &pointOffset, viskores::CellShapeTagHexahedron, const VecType &cellIndices, const viskores::Id &cellId, OutputPortal &outputIndices) const
Definition: Quadralizer.h:245
Definition: Quadralizer.h:43
void ControlSignature(CellSetIn cellset, FieldOut)
Definition: Quadralizer.h:48
Definition: Quadralizer.h:184
Defines a 1-, 2-, or 3-dimensional structured grid of points.
Definition: CastAndCall.h:40
bool CanConvert() const
Returns true if this cell set can be retrieved as the given type.
Definition: UnknownCellSet.h:172
viskores::Id GetNumberOfCells() const override
Get the number of cells in the topology.
Definition: CellSetStructured.h:53
A CellSet of an unknown type.
Definition: UnknownCellSet.h:56
@ CELL_SHAPE_QUAD
A four-sided polygon.
Definition: CellShape.h:64
void cell2quad(viskores::Id4 idx, viskores::Vec< Id, 5 > &quad, const viskores::Id offset, const CellNodeVecType &cellIndices, OutIndicesPortal &outputIndices) const
Definition: Quadralizer.h:106
SegmentedStructured()
Definition: Quadralizer.h:99
Allows launching any worklet without a dispatcher.
Definition: Invoker.h:49
static constexpr viskores::UInt8 Id
Definition: CellShape.h:164
void operator()(const viskores::Id &pointOffset, viskores::CellShapeTagWedge, const VecType &cellIndices, const viskores::Id &cellId, OutputPortal &outputIndices) const
Definition: Quadralizer.h:213
void operator()(const viskores::Id &offset, viskores::CellShapeTagQuad shapeType, const VecType &cellIndices, const viskores::Id &cellId, OutputPortal &outputIndices) const
Definition: Quadralizer.h:226
A short fixed-length array.
Definition: Types.h:365
void AsCellSet(CellSetType &cellSet) const
Get the cell set as a known type.
Definition: UnknownCellSet.h:189
#define VISKORES_EXEC
Definition: ExportMacros.h:59
void ExecutionSignature(_2, CellShape, PointIndices, WorkIndex, _3)
Definition: Quadralizer.h:191
An implicit array handle containing the its own indices.
Definition: ArrayHandleIndex.h:64
void operator()(const viskores::Id &pointOffset, viskores::CellShapeTagGeneric shapeType, const VecType &cellIndices, const viskores::Id &cellId, OutputPortal &outputIndices) const
Definition: Quadralizer.h:262
The ExecutionSignature tag to use to get the work index.
Definition: WorkIndex.h:47