VTK-m  2.0
CellTraits.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_CellTraits_h
11 #define vtk_m_CellTraits_h
12 
13 #include <vtkm/CellShape.h>
14 
15 namespace vtkm
16 {
17 
22 template <vtkm::IdComponent dimension>
24 {
25 };
26 
30 {
31 };
32 
36 {
37 };
38 
45 template <class CellTag>
46 struct CellTraits
47 #ifdef VTKM_DOXYGEN_ONLY
48 {
53 
60 
68 
74  static constexpr vtkm::IdComponent NUM_POINTS = 3;
75 };
76 #else // VTKM_DOXYGEN_ONLY
77  ;
78 #endif // VTKM_DOXYGEN_ONLY
79 
80 //-----------------------------------------------------------------------------
81 
82 // Define traits for every cell type.
83 
84 #define VTKM_DEFINE_CELL_TRAITS(name, dimensions, numPoints) \
85  template <> \
86  struct CellTraits<vtkm::CellShapeTag##name> \
87  { \
88  static constexpr vtkm::IdComponent TOPOLOGICAL_DIMENSIONS = dimensions; \
89  using TopologicalDimensionsTag = vtkm::CellTopologicalDimensionsTag<TOPOLOGICAL_DIMENSIONS>; \
90  using IsSizeFixed = vtkm::CellTraitsTagSizeFixed; \
91  static constexpr vtkm::IdComponent NUM_POINTS = numPoints; \
92  }
93 
94 #define VTKM_DEFINE_CELL_TRAITS_VARIABLE(name, dimensions) \
95  template <> \
96  struct CellTraits<vtkm::CellShapeTag##name> \
97  { \
98  static constexpr vtkm::IdComponent TOPOLOGICAL_DIMENSIONS = dimensions; \
99  using TopologicalDimensionsTag = vtkm::CellTopologicalDimensionsTag<TOPOLOGICAL_DIMENSIONS>; \
100  using IsSizeFixed = vtkm::CellTraitsTagSizeVariable; \
101  }
102 
103 VTKM_DEFINE_CELL_TRAITS(Empty, 0, 0);
104 VTKM_DEFINE_CELL_TRAITS(Vertex, 0, 1);
105 //VTKM_DEFINE_CELL_TRAITS_VARIABLE(PolyVertex, 0);
108 VTKM_DEFINE_CELL_TRAITS(Triangle, 2, 3);
109 //VTKM_DEFINE_CELL_TRAITS_VARIABLE(TriangleStrip, 2);
111 //VTKM_DEFINE_CELL_TRAITS(Pixel, 2, 4);
112 VTKM_DEFINE_CELL_TRAITS(Quad, 2, 4);
113 VTKM_DEFINE_CELL_TRAITS(Tetra, 3, 4);
114 //VTKM_DEFINE_CELL_TRAITS(Voxel, 3, 8);
115 VTKM_DEFINE_CELL_TRAITS(Hexahedron, 3, 8);
116 VTKM_DEFINE_CELL_TRAITS(Wedge, 3, 6);
117 VTKM_DEFINE_CELL_TRAITS(Pyramid, 3, 5);
118 
119 #undef VTKM_DEFINE_CELL_TRAITS
120 
121 } // namespace vtkm
122 
123 #endif //vtk_m_CellTraits_h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::CellTraitsTagSizeVariable
Tag for cell shapes that can have a variable number of points.
Definition: CellTraits.h:35
CellShape.h
vtkm::Line
Ray< CoordType, Dim, true > Line
Lines are two-sided rays:
Definition: Geometry.h:330
vtkm::CellTopologicalDimensionsTag
vtkm::CellTraits::TopologyDimensionType is typedef to this with the template parameter set to TOPOLOG...
Definition: CellTraits.h:23
vtkm::VTKM_DEFINE_CELL_TRAITS_VARIABLE
VTKM_DEFINE_CELL_TRAITS_VARIABLE(PolyLine, 1)
vtkm::CellTraits::TOPOLOGICAL_DIMENSIONS
static const vtkm::IdComponent TOPOLOGICAL_DIMENSIONS
This defines the topological dimensions of the cell type.
Definition: CellTraits.h:52
vtkm::VTKM_DEFINE_CELL_TRAITS
VTKM_DEFINE_CELL_TRAITS(Empty, 0, 0)
vtkm::CellTraitsTagSizeFixed
Tag for cell shapes with a fixed number of points.
Definition: CellTraits.h:29
vtkm::CellTraits
Information about a cell based on its tag.
Definition: CellTraits.h:46
vtkm::CellTraits::NUM_POINTS
static constexpr vtkm::IdComponent NUM_POINTS
Number of points in the cell.
Definition: CellTraits.h:74