Viskores  1.0
Classes | Namespaces | Macros | Enumerations
CellShape.h File Reference
#include <viskores/StaticAssert.h>
#include <viskores/Types.h>
#include <lcl/Polygon.h>
#include <lcl/Shapes.h>

Go to the source code of this file.

Classes

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

Namespaces

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

Macros

#define VISKORES_IS_CELL_SHAPE_TAG(tag)
 Checks that the argument is a proper cell shape tag. More...
 
#define VISKORES_DEFINE_CELL_TAG(name, idname)
 
#define viskoresGenericCellShapeMacroCase(cellShapeId, call)
 
#define viskoresGenericCellShapeMacro(call)
 A macro used in a switch statement to determine cell shape. More...
 

Enumerations

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

Macro Definition Documentation

◆ VISKORES_DEFINE_CELL_TAG

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

◆ VISKORES_IS_CELL_SHAPE_TAG

#define VISKORES_IS_CELL_SHAPE_TAG (   tag)
Value:
VISKORES_STATIC_ASSERT_MSG(::viskores::internal::CellShapeTagCheck<tag>::value, \
"Provided type is not a valid Viskores 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.

◆ viskoresGenericCellShapeMacro

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

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

The viskoresGenericCellShapeMacro is a series of case statements for all of the cell shapes supported by Viskores. 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(viskores::CellShapeTagGeneric cellShape,
{
switch(cellShape.CellShapeId)
{
MyCellOperation(CellShapeTag())
);
default: worklet.RaiseError("Encountered unknown cell shape."); break
}
}

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

◆ viskoresGenericCellShapeMacroCase

#define viskoresGenericCellShapeMacroCase (   cellShapeId,
  call 
)
Value:
case viskores::cellShapeId: \
{ \
call; \
} \
break
viskores::CELL_SHAPE_PYRAMID
@ CELL_SHAPE_PYRAMID
A pyramid with a quadrilateral base and four triangular faces.0.
Definition: CellShape.h:76
viskores::CELL_SHAPE_POLYGON
@ CELL_SHAPE_POLYGON
A general polygon shape.
Definition: CellShape.h:61
viskores::exec::FunctorBase
Base class for all user worklets invoked in the execution environment from a call to viskores::cont::...
Definition: FunctorBase.h:38
viskoresGenericCellShapeMacro
#define viskoresGenericCellShapeMacro(call)
A macro used in a switch statement to determine cell shape.
Definition: CellShape.h:257
viskores::CELL_SHAPE_HEXAHEDRON
@ CELL_SHAPE_HEXAHEDRON
A hexahedron.
Definition: CellShape.h:70
VISKORES_EXEC_CONT
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
viskores::CellShapeTagGeneric
A special cell shape tag that holds a cell shape that is not known at compile time.
Definition: CellShape.h:178
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores::CELL_SHAPE_WEDGE
@ CELL_SHAPE_WEDGE
A wedge.
Definition: CellShape.h:74
viskores::CELL_SHAPE_TRIANGLE
@ CELL_SHAPE_TRIANGLE
A triangle.
Definition: CellShape.h:56
viskores::CELL_SHAPE_TETRA
@ CELL_SHAPE_TETRA
A tetrahedron.
Definition: CellShape.h:67
viskores::CELL_SHAPE_EMPTY
@ CELL_SHAPE_EMPTY
Placeholder for empty or invalid cells.
Definition: CellShape.h:45
VISKORES_STATIC_ASSERT_MSG
#define VISKORES_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:26
viskores::UInt8
uint8_t UInt8
Base type to use for 8-bit unsigned integer numbers.
Definition: Types.h:177
viskores::CellShapeIdToTag
A traits-like class to get an CellShapeId known at compile time to a tag.
Definition: CellShape.h:115
viskores::CELL_SHAPE_VERTEX
@ CELL_SHAPE_VERTEX
Vertex cells of a single point.
Definition: CellShape.h:47
viskores::CELL_SHAPE_QUAD
@ CELL_SHAPE_QUAD
A four-sided polygon.
Definition: CellShape.h:64
viskores::CELL_SHAPE_POLY_LINE
@ CELL_SHAPE_POLY_LINE
A sequence of line segments.
Definition: CellShape.h:54
VISKORES_EXEC
#define VISKORES_EXEC
Definition: ExportMacros.h:59
viskores::exec::FunctorBase::RaiseError
void RaiseError(const char *message) const
Definition: FunctorBase.h:45
viskoresGenericCellShapeMacroCase
#define viskoresGenericCellShapeMacroCase(cellShapeId, call)
Definition: CellShape.h:219
viskores::CELL_SHAPE_LINE
@ CELL_SHAPE_LINE
A line cell connecting two points.
Definition: CellShape.h:50