View on GitHub

Vistle

Distributed Data-parallel Scientific Visualization in VR

celltypes.h
Go to the documentation of this file.
1#ifndef VISTLE_CELLTYPES_H
2#define VISTLE_CELLTYPES_H
3
4#include "scalar.h"
5#include "index.h"
6
7#include <vector>
8
9namespace vistle {
10
11namespace cell {
12
14 GHOST_BIT = 0x80,
15 CONVEX_BIT = 0x40, //<! cell was checked to be convex
16 TYPE_MASK = 0x3f,
17
18 // make sure that these types match those from COVISE: src/kernel/do/coDoUnstructuredGrid.h
19 NONE = 0,
20 BAR = 1,
22 QUAD = 3,
25 PRISM = 6,
27 VPOLYHEDRON = 8, // not in COVISE: polyhedron with facestream as in VTK
28 POLYGON = 9, // not in COVISE
29 POINT = 10,
30 CPOLYHEDRON = 11, // in COVISE, but has to be translated to VPOLYHEDRON
32 NUM_TYPES = 12, // keep last
33};
34
35template<int type>
36struct TypeData;
37
38template<>
39struct TypeData<NONE> {
40 const CellType type = NONE;
41 const int NumVertices = 0;
42};
43
44template<>
45struct TypeData<POINT> {
46 const CellType type = POINT;
47 const int Dimension = 0;
48 const int NumVertices = 1;
49};
50
51template<>
52struct TypeData<BAR> {
53 const CellType type = BAR;
54 const int Dimension = 1;
55 const int NumVertices = 2;
56 const int NumEdges = 1;
57};
58
59template<>
61 const CellType type = TRIANGLE;
62 const int Dimension = 2;
63 const int NumVertices = 3;
64 const int NumEdges = 3;
65 const int NumFaces = 1;
66};
67
68template<>
69struct TypeData<QUAD> {
70 const CellType type = QUAD;
71 const int Dimension = 2;
72 const int NumVertices = 4;
73 const int NumEdges = 4;
74 const int NumFaces = 1;
75};
76
77template<>
79 const CellType type = TETRAHEDRON;
80 const int Dimension = 3;
81 const int NumVertices = 4;
82 const int NumEdges = 4;
83 const int NumFaces = 4;
84};
85
86template<>
88 const CellType type = PYRAMID;
89 const int Dimension = 3;
90 const int NumVertices = 5;
91 const int NumEdges = 8;
92 const int NumFaces = 5;
93};
94
95template<>
96struct TypeData<PRISM> {
97 const CellType type = PRISM;
98 const int Dimension = 3;
99 const int NumVertices = 6;
100 const int NumEdges = 9;
101 const int NumFaces = 5;
102};
103
104template<>
106 const CellType type = HEXAHEDRON;
107 const int Dimension = 3;
108 const int NumVertices = 8;
109 const int NumEdges = 12;
110 const int NumFaces = 6;
111};
112
113template<>
115 const int Dimension = 2;
116 const CellType type = POLYGON;
117 const int NumFaces = 1;
118};
119
120template<>
122 const CellType type = CPOLYHEDRON;
123 const int Dimension = 3;
124};
125
126template<>
128 const CellType type = VPOLYHEDRON;
129 const int Dimension = 3;
130};
131
132} // namespace cell
133
134
135class Cell {
136public:
137 Byte type() const;
138 unsigned dimension() const;
139 unsigned numVertices() const;
140 unsigned numEdges() const;
141 unsigned numFaces() const;
142
144
146 std::vector<Index> edge(Index e) const;
147
148 unsigned numFaceVertices(Index f) const;
149 std::vector<Index> face(Index f) const;
150};
151
152} // namespace vistle
153#endif
Definition: celltypes.h:135
Byte type() const
unsigned dimension() const
Index numEdgeVertices(Index e) const
Index vertex(Index v) const
std::vector< Index > edge(Index e) const
unsigned numFaces() const
std::vector< Index > face(Index f) const
unsigned numFaceVertices(Index f) const
unsigned numEdges() const
unsigned numVertices() const
CellType
Definition: celltypes.h:13
@ NUM_TYPES
Definition: celltypes.h:32
@ NONE
Definition: celltypes.h:19
@ TRIANGLE
Definition: celltypes.h:21
@ POLYHEDRON
Definition: celltypes.h:31
@ BAR
Definition: celltypes.h:20
@ HEXAHEDRON
Definition: celltypes.h:26
@ VPOLYHEDRON
Definition: celltypes.h:27
@ PRISM
Definition: celltypes.h:25
@ PYRAMID
Definition: celltypes.h:24
@ TETRAHEDRON
Definition: celltypes.h:23
@ CONVEX_BIT
Definition: celltypes.h:15
@ TYPE_MASK
Definition: celltypes.h:16
@ CPOLYHEDRON
Definition: celltypes.h:30
@ QUAD
Definition: celltypes.h:22
@ POLYGON
Definition: celltypes.h:28
@ POINT
Definition: celltypes.h:29
@ GHOST_BIT
Definition: celltypes.h:14
Definition: celltypes.h:36
Definition: allobjects.cpp:30
unsigned char Byte
Definition: scalar.h:9
uint32_t Index
Definition: index.h:13