-
Notifications
You must be signed in to change notification settings - Fork 4
/
Topology.h
100 lines (80 loc) · 1.92 KB
/
Topology.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
* @file
* This file is part of PUML
*
* For conditions of distribution and use, please see the copyright
* notice in the file 'COPYING' at the root directory of this package
* and the copyright notice at https://github.com/TUM-I5/PUMGen
*
* @copyright 2017 Technische Universitaet Muenchen
* @author Sebastian Rettenberger <[email protected]>
*/
#ifndef PUML_TOPOLOGY_H
#define PUML_TOPOLOGY_H
namespace PUML
{
/**
* The topology types
*/
enum TopoType {
TETRAHEDRON,
HEXAHEDRON
};
namespace internal
{
/**
* Class describing the different topologies
*/
template<TopoType>
class Topology
{
public:
/**
* @return The number of vertices of a cell
*/
static constexpr unsigned int cellvertices();
/**
* @return The number of faces of a cell
*/
static constexpr unsigned int cellfaces();
/**
* @return The number of edges for a cell
*/
static constexpr unsigned int celledges();
/**
* @return The number of edges for a face
*/
static constexpr unsigned int faceedges()
{ return facevertices(); /* This is always the same */ }
/**
* @return The number vertices for a face
*/
static constexpr unsigned int facevertices();
};
template<> inline
constexpr unsigned int Topology<TETRAHEDRON>::cellvertices()
{ return 4; }
template<> inline
constexpr unsigned int Topology<HEXAHEDRON>::cellvertices()
{ return 8; }
template<> inline
constexpr unsigned int Topology<TETRAHEDRON>::cellfaces()
{ return 4; }
template<> inline
constexpr unsigned int Topology<HEXAHEDRON>::cellfaces()
{ return 6; }
template<> inline
constexpr unsigned int Topology<TETRAHEDRON>::celledges()
{ return 6; }
template<> inline
constexpr unsigned int Topology<HEXAHEDRON>::celledges()
{ return 12; }
template<> inline
constexpr unsigned int Topology<TETRAHEDRON>::facevertices()
{ return 3; }
template<> inline
constexpr unsigned int Topology<HEXAHEDRON>::facevertices()
{ return 4; }
}
}
#endif // PUML_TOPOLOGY_H