VTK-m  2.0
Classes | Namespaces | Macros | Enumerations | Functions
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::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...
 

Functions

 vtkm::VTKM_DEFINE_CELL_TAG (Empty, CELL_SHAPE_EMPTY)
 
 vtkm::VTKM_DEFINE_CELL_TAG (Vertex, CELL_SHAPE_VERTEX)
 
 vtkm::VTKM_DEFINE_CELL_TAG (Line, CELL_SHAPE_LINE)
 
 vtkm::VTKM_DEFINE_CELL_TAG (PolyLine, CELL_SHAPE_POLY_LINE)
 
 vtkm::VTKM_DEFINE_CELL_TAG (Triangle, CELL_SHAPE_TRIANGLE)
 
 vtkm::VTKM_DEFINE_CELL_TAG (Polygon, CELL_SHAPE_POLYGON)
 
 vtkm::VTKM_DEFINE_CELL_TAG (Quad, CELL_SHAPE_QUAD)
 
 vtkm::VTKM_DEFINE_CELL_TAG (Tetra, CELL_SHAPE_TETRA)
 
 vtkm::VTKM_DEFINE_CELL_TAG (Hexahedron, CELL_SHAPE_HEXAHEDRON)
 
 vtkm::VTKM_DEFINE_CELL_TAG (Wedge, CELL_SHAPE_WEDGE)
 
 vtkm::VTKM_DEFINE_CELL_TAG (Pyramid, CELL_SHAPE_PYRAMID)
 

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
Definition: CellShape.h:49
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkmGenericCellShapeMacroCase
#define vtkmGenericCellShapeMacroCase(cellShapeId, call)
Definition: CellShape.h:192
vtkm::CellShapeIdToTag
A traits-like class to get an CellShapeId known at compile time to a tag.
Definition: CellShape.h:89
vtkm::CELL_SHAPE_EMPTY
@ CELL_SHAPE_EMPTY
Definition: CellShape.h:36
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkmGenericCellShapeMacro
#define vtkmGenericCellShapeMacro(call)
A macro used in a switch statement to determine cell shape.
Definition: CellShape.h:230
vtkm::CELL_SHAPE_POLY_LINE
@ CELL_SHAPE_POLY_LINE
Definition: CellShape.h:40
vtkm::CELL_SHAPE_TETRA
@ CELL_SHAPE_TETRA
Definition: CellShape.h:46
VTKM_STATIC_ASSERT_MSG
#define VTKM_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:18
vtkm::CELL_SHAPE_HEXAHEDRON
@ CELL_SHAPE_HEXAHEDRON
Definition: CellShape.h:48
vtkm::UInt8
uint8_t UInt8
Definition: Types.h:157
vtkm::CELL_SHAPE_TRIANGLE
@ CELL_SHAPE_TRIANGLE
Definition: CellShape.h:41
vtkm::CELL_SHAPE_LINE
@ CELL_SHAPE_LINE
Definition: CellShape.h:39
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:152
vtkm::CELL_SHAPE_PYRAMID
@ CELL_SHAPE_PYRAMID
Definition: CellShape.h:50
vtkm::CELL_SHAPE_POLYGON
@ CELL_SHAPE_POLYGON
Definition: CellShape.h:43
vtkm::exec::FunctorBase::RaiseError
VTKM_EXEC void RaiseError(const char *message) const
Definition: FunctorBase.h:40
vtkm::CELL_SHAPE_VERTEX
@ CELL_SHAPE_VERTEX
Definition: CellShape.h:37
vtkm::CELL_SHAPE_QUAD
@ CELL_SHAPE_QUAD
Definition: CellShape.h:45