Viskores  1.0
CellTraits.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_CellTraits_h
19 #define viskores_CellTraits_h
20 
21 #include <viskores/CellShape.h>
22 
23 namespace viskores
24 {
25 
30 template <viskores::IdComponent dimension>
32 {
33 };
34 
38 {
39 };
40 
44 {
45 };
46 
53 template <class CellTag>
54 struct CellTraits
55 #ifdef VISKORES_DOXYGEN_ONLY
56 {
61 
68 
76 
82  static constexpr viskores::IdComponent NUM_POINTS = 3;
83 };
84 #else // VISKORES_DOXYGEN_ONLY
85  ;
86 #endif // VISKORES_DOXYGEN_ONLY
87 
88 //-----------------------------------------------------------------------------
89 
90 // Define traits for every cell type.
91 
92 #define VISKORES_DEFINE_CELL_TRAITS(name, dimensions, numPoints) \
93  template <> \
94  struct CellTraits<viskores::CellShapeTag##name> \
95  { \
96  static constexpr viskores::IdComponent TOPOLOGICAL_DIMENSIONS = dimensions; \
97  using TopologicalDimensionsTag = \
98  viskores::CellTopologicalDimensionsTag<TOPOLOGICAL_DIMENSIONS>; \
99  using IsSizeFixed = viskores::CellTraitsTagSizeFixed; \
100  static constexpr viskores::IdComponent NUM_POINTS = numPoints; \
101  }
102 
103 #define VISKORES_DEFINE_CELL_TRAITS_VARIABLE(name, dimensions) \
104  template <> \
105  struct CellTraits<viskores::CellShapeTag##name> \
106  { \
107  static constexpr viskores::IdComponent TOPOLOGICAL_DIMENSIONS = dimensions; \
108  using TopologicalDimensionsTag = \
109  viskores::CellTopologicalDimensionsTag<TOPOLOGICAL_DIMENSIONS>; \
110  using IsSizeFixed = viskores::CellTraitsTagSizeVariable; \
111  }
112 
115 //VISKORES_DEFINE_CELL_TRAITS_VARIABLE(PolyVertex, 0);
119 //VISKORES_DEFINE_CELL_TRAITS_VARIABLE(TriangleStrip, 2);
121 //VISKORES_DEFINE_CELL_TRAITS(Pixel, 2, 4);
124 //VISKORES_DEFINE_CELL_TRAITS(Voxel, 3, 8);
125 VISKORES_DEFINE_CELL_TRAITS(Hexahedron, 3, 8);
128 
129 #undef VISKORES_DEFINE_CELL_TRAITS
130 
131 } // namespace viskores
132 
133 #endif //viskores_CellTraits_h
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
VISKORES_DEFINE_CELL_TRAITS_VARIABLE
#define VISKORES_DEFINE_CELL_TRAITS_VARIABLE(name, dimensions)
Definition: CellTraits.h:103
CellShape.h
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::CellTraitsTagSizeFixed
Tag for cell shapes with a fixed number of points.
Definition: CellTraits.h:37
viskores::CellTraits
Information about a cell based on its tag.
Definition: CellTraits.h:54
viskores::Ray
Represent an infinite or semi-infinite line segment with a point and a direction.
Definition: Geometry.h:29
viskores::CellTraits::NUM_POINTS
static constexpr viskores::IdComponent NUM_POINTS
Number of points in the cell.
Definition: CellTraits.h:82
viskores::CellTraitsTagSizeVariable
Tag for cell shapes that can have a variable number of points.
Definition: CellTraits.h:43
viskores::CellTraits::TOPOLOGICAL_DIMENSIONS
static const viskores::IdComponent TOPOLOGICAL_DIMENSIONS
This defines the topological dimensions of the cell type.
Definition: CellTraits.h:60
viskores::CellTopologicalDimensionsTag
viskores::CellTraits::TopologyDimensionType is typedef to this with the template parameter set to TOP...
Definition: CellTraits.h:31
VISKORES_DEFINE_CELL_TRAITS
#define VISKORES_DEFINE_CELL_TRAITS(name, dimensions, numPoints)
Definition: CellTraits.h:92