VTK-m  2.1
Classes | Namespaces | Macros | Enumerations
CellShape.h File Reference
#include <vtkm/StaticAssert.h>
#include <vtkm/Types.h>
#include <lcl/Polygon.h>
#include <lcl/Shapes.h>

Go to the source code of this file.

Classes

struct  vtkm::CellShapeIdToTag< Id >
 A traits-like class to get an CellShapeId known at compile time to a tag. More...
 
struct  vtkm::CellShapeTagEmpty
 
struct  vtkm::CellShapeIdToTag< vtkm::CELL_SHAPE_EMPTY >
 
struct  vtkm::CellShapeTagVertex
 
struct  vtkm::CellShapeIdToTag< vtkm::CELL_SHAPE_VERTEX >
 
struct  vtkm::CellShapeTagLine
 
struct  vtkm::CellShapeIdToTag< vtkm::CELL_SHAPE_LINE >
 
struct  vtkm::CellShapeTagPolyLine
 
struct  vtkm::CellShapeIdToTag< vtkm::CELL_SHAPE_POLY_LINE >
 
struct  vtkm::CellShapeTagTriangle
 
struct  vtkm::CellShapeIdToTag< vtkm::CELL_SHAPE_TRIANGLE >
 
struct  vtkm::CellShapeTagPolygon
 
struct  vtkm::CellShapeIdToTag< vtkm::CELL_SHAPE_POLYGON >
 
struct  vtkm::CellShapeTagQuad
 
struct  vtkm::CellShapeIdToTag< vtkm::CELL_SHAPE_QUAD >
 
struct  vtkm::CellShapeTagTetra
 
struct  vtkm::CellShapeIdToTag< vtkm::CELL_SHAPE_TETRA >
 
struct  vtkm::CellShapeTagHexahedron
 
struct  vtkm::CellShapeIdToTag< vtkm::CELL_SHAPE_HEXAHEDRON >
 
struct  vtkm::CellShapeTagWedge
 
struct  vtkm::CellShapeIdToTag< vtkm::CELL_SHAPE_WEDGE >
 
struct  vtkm::CellShapeTagPyramid
 
struct  vtkm::CellShapeIdToTag< vtkm::CELL_SHAPE_PYRAMID >
 
struct  vtkm::CellShapeTagGeneric
 A special cell shape tag that holds a cell shape that is not known at compile time. More...
 

Namespaces

 lcl
 
 vtkm
 Groups connected points that have the same field value.
 

Macros

#define VTKM_IS_CELL_SHAPE_TAG(tag)
 Checks that the argument is a proper cell shape tag. More...
 
#define VTKM_DEFINE_CELL_TAG(name, idname)
 
#define vtkmGenericCellShapeMacroCase(cellShapeId, call)
 
#define vtkmGenericCellShapeMacro(call)
 A macro used in a switch statement to determine cell shape. More...
 

Enumerations

enum  vtkm::CellShapeIdEnum {
  vtkm::CELL_SHAPE_EMPTY = lcl::ShapeId::EMPTY, vtkm::CELL_SHAPE_VERTEX = lcl::ShapeId::VERTEX, vtkm::CELL_SHAPE_LINE = lcl::ShapeId::LINE, vtkm::CELL_SHAPE_POLY_LINE = 4,
  vtkm::CELL_SHAPE_TRIANGLE = lcl::ShapeId::TRIANGLE, vtkm::CELL_SHAPE_POLYGON = lcl::ShapeId::POLYGON, vtkm::CELL_SHAPE_QUAD = lcl::ShapeId::QUAD, vtkm::CELL_SHAPE_TETRA = lcl::ShapeId::TETRA,
  vtkm::CELL_SHAPE_HEXAHEDRON = lcl::ShapeId::HEXAHEDRON, vtkm::CELL_SHAPE_WEDGE = lcl::ShapeId::WEDGE, vtkm::CELL_SHAPE_PYRAMID = lcl::ShapeId::PYRAMID, vtkm::NUMBER_OF_CELL_SHAPES
}
 CellShapeId identifies the type of each cell. More...
 

Macro Definition Documentation

◆ VTKM_DEFINE_CELL_TAG

#define VTKM_DEFINE_CELL_TAG (   name,
  idname 
)
Value:
struct CellShapeTag##name \
{ \
static constexpr vtkm::UInt8 Id = vtkm::idname; \
}; \
namespace internal \
{ \
template <> \
struct CellShapeTagCheck<vtkm::CellShapeTag##name> : std::true_type \
{ \
}; \
template <> \
struct CellShapeTagVtkmToVtkc<vtkm::CellShapeTag##name> \
{ \
using Type = lcl::name; \
}; \
} \
static inline VTKM_EXEC_CONT const char* GetCellShapeName(vtkm::CellShapeTag##name) \
{ \
return #name; \
} \
template <> \
struct CellShapeIdToTag<vtkm::idname> \
{ \
using valid = std::true_type; \
using Tag = vtkm::CellShapeTag##name; \
}

◆ VTKM_IS_CELL_SHAPE_TAG

#define VTKM_IS_CELL_SHAPE_TAG (   tag)
Value:
VTKM_STATIC_ASSERT_MSG(::vtkm::internal::CellShapeTagCheck<tag>::value, \
"Provided type is not a valid VTK-m cell shape tag.")

Checks that the argument is a proper cell shape tag.

This is a handy concept check to make sure that a template argument is a proper cell shape tag.

◆ vtkmGenericCellShapeMacro

#define vtkmGenericCellShapeMacro (   call)
Value:
vtkmGenericCellShapeMacroCase(CELL_SHAPE_VERTEX, call); \
vtkmGenericCellShapeMacroCase(CELL_SHAPE_LINE, call); \
vtkmGenericCellShapeMacroCase(CELL_SHAPE_POLY_LINE, call); \
vtkmGenericCellShapeMacroCase(CELL_SHAPE_TRIANGLE, call); \
vtkmGenericCellShapeMacroCase(CELL_SHAPE_POLYGON, call); \
vtkmGenericCellShapeMacroCase(CELL_SHAPE_QUAD, call); \
vtkmGenericCellShapeMacroCase(CELL_SHAPE_TETRA, call); \
vtkmGenericCellShapeMacroCase(CELL_SHAPE_HEXAHEDRON, call); \
vtkmGenericCellShapeMacroCase(CELL_SHAPE_WEDGE, call); \
vtkmGenericCellShapeMacroCase(CELL_SHAPE_PYRAMID, call)

A macro used in a switch statement to determine cell shape.

The vtkmGenericCellShapeMacro is a series of case statements for all of the cell shapes supported by VTK-m. This macro is intended to be used inside of a switch statement on a cell type. For each cell shape condition, a CellShapeTag typedef is created and the given call is executed.

A typical use case of this class is to create the specialization of a function overloaded on a cell shape tag for the generic cell shape like as following.

template<typename WorkletType>
void MyCellOperation(vtkm::CellShapeTagGeneric cellShape,
const vtkm::exec::FunctorBase &worklet)
{
switch(cellShape.CellShapeId)
{
MyCellOperation(CellShapeTag())
);
default: worklet.RaiseError("Encountered unknown cell shape."); break
}
}

Note that vtkmGenericCellShapeMacro does not have a default case. You should consider adding one that gives a

◆ vtkmGenericCellShapeMacroCase

#define vtkmGenericCellShapeMacroCase (   cellShapeId,
  call 
)
Value:
case vtkm::cellShapeId: \
{ \
call; \
} \
break
vtkm::CELL_SHAPE_WEDGE
@ CELL_SHAPE_WEDGE
A wedge.
Definition: CellShape.h:66
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm::exec::FunctorBase::RaiseError
void RaiseError(const char *message) const
Definition: FunctorBase.h:37
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkmGenericCellShapeMacroCase
#define vtkmGenericCellShapeMacroCase(cellShapeId, call)
Definition: CellShape.h:212
vtkm::CellShapeIdToTag
A traits-like class to get an CellShapeId known at compile time to a tag.
Definition: CellShape.h:107
vtkm::CELL_SHAPE_EMPTY
@ CELL_SHAPE_EMPTY
Placeholder for empty or invalid cells.
Definition: CellShape.h:37
vtkmGenericCellShapeMacro
#define vtkmGenericCellShapeMacro(call)
A macro used in a switch statement to determine cell shape.
Definition: CellShape.h:250
vtkm::CELL_SHAPE_POLY_LINE
@ CELL_SHAPE_POLY_LINE
A sequence of line segments.
Definition: CellShape.h:46
vtkm::CELL_SHAPE_TETRA
@ CELL_SHAPE_TETRA
A tetrahedron.
Definition: CellShape.h:59
VTKM_STATIC_ASSERT_MSG
#define VTKM_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:18
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
vtkm::CELL_SHAPE_HEXAHEDRON
@ CELL_SHAPE_HEXAHEDRON
A hexahedron.
Definition: CellShape.h:62
vtkm::UInt8
uint8_t UInt8
Base type to use for 8-bit unsigned integer numbers.
Definition: Types.h:169
vtkm::CELL_SHAPE_TRIANGLE
@ CELL_SHAPE_TRIANGLE
A triangle.
Definition: CellShape.h:48
vtkm::CELL_SHAPE_LINE
@ CELL_SHAPE_LINE
A line cell connecting two points.
Definition: CellShape.h:42
vtkm::exec::FunctorBase
Base class for all user worklets invoked in the execution environment from a call to vtkm::cont::Devi...
Definition: FunctorBase.h:30
vtkm::CellShapeTagGeneric
A special cell shape tag that holds a cell shape that is not known at compile time.
Definition: CellShape.h:170
vtkm::CELL_SHAPE_PYRAMID
@ CELL_SHAPE_PYRAMID
A pyramid with a quadrilateral base and four triangular faces.0.
Definition: CellShape.h:68
vtkm::CELL_SHAPE_POLYGON
@ CELL_SHAPE_POLYGON
A general polygon shape.
Definition: CellShape.h:53
vtkm::CELL_SHAPE_VERTEX
@ CELL_SHAPE_VERTEX
Vertex cells of a single point.
Definition: CellShape.h:39
vtkm::CELL_SHAPE_QUAD
@ CELL_SHAPE_QUAD
A four-sided polygon.
Definition: CellShape.h:56