VTK-m  2.1
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 
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);
114 //VTKM_DEFINE_CELL_TRAITS(Voxel, 3, 8);
115 VTKM_DEFINE_CELL_TRAITS(Hexahedron, 3, 8);
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::Ray
Represent an infinite or semi-infinite line segment with a point and a direction.
Definition: Geometry.h:21
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::IdComponent
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
vtkm::CellTraitsTagSizeVariable
Tag for cell shapes that can have a variable number of points.
Definition: CellTraits.h:35
CellShape.h
VTKM_DEFINE_CELL_TRAITS
#define VTKM_DEFINE_CELL_TRAITS(name, dimensions, numPoints)
Definition: CellTraits.h:84
VTKM_DEFINE_CELL_TRAITS_VARIABLE
#define VTKM_DEFINE_CELL_TRAITS_VARIABLE(name, dimensions)
Definition: CellTraits.h:94
vtkm::CellTopologicalDimensionsTag
vtkm::CellTraits::TopologyDimensionType is typedef to this with the template parameter set to TOPOLOG...
Definition: CellTraits.h:23
vtkm::CellTraits::TOPOLOGICAL_DIMENSIONS
static const vtkm::IdComponent TOPOLOGICAL_DIMENSIONS
This defines the topological dimensions of the cell type.
Definition: CellTraits.h:52
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