Go to the documentation of this file.
18 #ifndef viskores_CellShape_h
19 #define viskores_CellShape_h
24 #include <lcl/Polygon.h>
25 #include <lcl/Shapes.h>
94 struct CellShapeTagCheck : std::false_type
99 template <
typename ViskoresCellShapeTag>
100 struct CellShapeTagViskoresToVtkc;
108 #define VISKORES_IS_CELL_SHAPE_TAG(tag) \
109 VISKORES_STATIC_ASSERT_MSG(::viskores::internal::CellShapeTagCheck<tag>::value, \
110 "Provided type is not a valid Viskores cell shape tag.")
114 template <viskores::IdComponent Id>
127 #define VISKORES_DEFINE_CELL_TAG(name, idname) \
128 struct CellShapeTag##name \
130 static constexpr viskores::UInt8 Id = viskores::idname; \
135 struct CellShapeTagCheck<viskores::CellShapeTag##name> : std::true_type \
139 struct CellShapeTagViskoresToVtkc<viskores::CellShapeTag##name> \
141 using Type = lcl::name; \
144 static inline VISKORES_EXEC_CONT const char* GetCellShapeName(viskores::CellShapeTag##name) \
149 struct CellShapeIdToTag<viskores::idname> \
151 using valid = std::true_type; \
152 using Tag = viskores::CellShapeTag##name; \
171 #undef VISKORES_DEFINE_CELL_TAG
194 template <
typename ViskoresCellShapeTag>
195 VISKORES_EXEC_CONT inline typename CellShapeTagViskoresToVtkc<ViskoresCellShapeTag>::Type
198 using VtkcCellShapeTag =
typename CellShapeTagViskoresToVtkc<ViskoresCellShapeTag>::Type;
199 static_cast<void>(numPoints);
200 return VtkcCellShapeTag{};
207 return lcl::Polygon(numPoints);
214 return lcl::Cell(
static_cast<std::int8_t
>(tag.
Id), numPoints);
219 #define viskoresGenericCellShapeMacroCase(cellShapeId, call) \
220 case viskores::cellShapeId: \
222 using CellShapeTag = viskores::CellShapeIdToTag<viskores::cellShapeId>::Tag; \
257 #define viskoresGenericCellShapeMacro(call) \
258 viskoresGenericCellShapeMacroCase(CELL_SHAPE_EMPTY, call); \
259 viskoresGenericCellShapeMacroCase(CELL_SHAPE_VERTEX, call); \
260 viskoresGenericCellShapeMacroCase(CELL_SHAPE_LINE, call); \
261 viskoresGenericCellShapeMacroCase(CELL_SHAPE_POLY_LINE, call); \
262 viskoresGenericCellShapeMacroCase(CELL_SHAPE_TRIANGLE, call); \
263 viskoresGenericCellShapeMacroCase(CELL_SHAPE_POLYGON, call); \
264 viskoresGenericCellShapeMacroCase(CELL_SHAPE_QUAD, call); \
265 viskoresGenericCellShapeMacroCase(CELL_SHAPE_TETRA, call); \
266 viskoresGenericCellShapeMacroCase(CELL_SHAPE_HEXAHEDRON, call); \
267 viskoresGenericCellShapeMacroCase(CELL_SHAPE_WEDGE, call); \
268 viskoresGenericCellShapeMacroCase(CELL_SHAPE_PYRAMID, call)
272 #endif //viskores_CellShape_h
@ CELL_SHAPE_PYRAMID
A pyramid with a quadrilateral base and four triangular faces.0.
Definition: CellShape.h:76
@ CELL_SHAPE_POLYGON
A general polygon shape.
Definition: CellShape.h:61
viskores::UInt8 Id
An identifier that corresponds to one of the CELL_SHAPE_* identifiers.
Definition: CellShape.h:188
std::false_type valid
Definition: CellShape.h:121
#define VISKORES_DEFINE_CELL_TAG(name, idname)
Definition: CellShape.h:127
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
@ CELL_SHAPE_HEXAHEDRON
A hexahedron.
Definition: CellShape.h:70
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
A special cell shape tag that holds a cell shape that is not known at compile time.
Definition: CellShape.h:178
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
@ CELL_SHAPE_WEDGE
A wedge.
Definition: CellShape.h:74
Groups connected points that have the same field value.
Definition: Atomic.h:27
CellShapeIdEnum
CellShapeId identifies the type of each cell.
Definition: CellShape.h:41
@ CELL_SHAPE_TRIANGLE
A triangle.
Definition: CellShape.h:56
@ CELL_SHAPE_TETRA
A tetrahedron.
Definition: CellShape.h:67
@ CELL_SHAPE_EMPTY
Placeholder for empty or invalid cells.
Definition: CellShape.h:45
Represent an infinite or semi-infinite line segment with a point and a direction.
Definition: Geometry.h:29
uint8_t UInt8
Base type to use for 8-bit unsigned integer numbers.
Definition: Types.h:177
Definition: CellShape.h:162
A traits-like class to get an CellShapeId known at compile time to a tag.
Definition: CellShape.h:115
@ CELL_SHAPE_VERTEX
Vertex cells of a single point.
Definition: CellShape.h:47
@ CELL_SHAPE_QUAD
A four-sided polygon.
Definition: CellShape.h:64
@ NUMBER_OF_CELL_SHAPES
Definition: CellShape.h:78
CellShapeTagGeneric(viskores::UInt8 shape)
Definition: CellShape.h:181
@ CELL_SHAPE_POLY_LINE
A sequence of line segments.
Definition: CellShape.h:54
@ CELL_SHAPE_LINE
A line cell connecting two points.
Definition: CellShape.h:50
Definition: CellShape.h:29