-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTopology.h
105 lines (85 loc) · 2.11 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
101
102
103
104
105
// SPDX-FileCopyrightText: 2017 Technical University of Munich
//
// SPDX-License-Identifier: BSD-3-Clause
/**
* @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
*
* @author Sebastian Rettenberger <sebastian.rettenberger@tum.de>
*/
#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 auto cellvertices() -> unsigned int;
/**
* @return The number of faces of a cell
*/
static constexpr auto cellfaces() -> unsigned int;
/**
* @return The number of edges for a cell
*/
static constexpr auto celledges() -> unsigned int;
/**
* @return The number of edges for a face
*/
static constexpr auto faceedges() -> unsigned int {
return facevertices(); /* This is always the same */
}
/**
* @return The number vertices for a face
*/
static constexpr auto facevertices() -> unsigned int;
};
template <>
constexpr auto Topology<TETRAHEDRON>::cellvertices() -> unsigned int {
return 4;
}
template <>
constexpr auto Topology<HEXAHEDRON>::cellvertices() -> unsigned int {
return 8;
}
template <>
constexpr auto Topology<TETRAHEDRON>::cellfaces() -> unsigned int {
return 4;
}
template <>
constexpr auto Topology<HEXAHEDRON>::cellfaces() -> unsigned int {
return 6;
}
template <>
constexpr auto Topology<TETRAHEDRON>::celledges() -> unsigned int {
return 6;
}
template <>
constexpr auto Topology<HEXAHEDRON>::celledges() -> unsigned int {
return 12;
}
template <>
constexpr auto Topology<TETRAHEDRON>::facevertices() -> unsigned int {
return 3;
}
template <>
constexpr auto Topology<HEXAHEDRON>::facevertices() -> unsigned int {
return 4;
}
} // namespace internal
} // namespace PUML
#endif // PUML_TOPOLOGY_H