-
Notifications
You must be signed in to change notification settings - Fork 4
/
Element.h
126 lines (101 loc) · 2.24 KB
/
Element.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/**
* @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_ELEMENT_H
#define PUML_ELEMENT_H
#include <vector>
#include "Topology.h"
namespace PUML
{
namespace internal
{
class Utils;
} // namespace internal
template<TopoType Topo>
class PUML;
class Downward;
class Upward;
template<typename utype>
class Element
{
template<TopoType Topo>
friend class PUML;
friend class Upward;
friend class internal::Utils;
private:
/** The global id */
unsigned long m_gid;
/** The local/global ids of the upper elements */
utype m_upward;
public:
/**
* @return The global ID of the element
*/
unsigned long gid() const
{ return m_gid; }
};
/**
* Elements that can be on partition boundaries (all except cells)
*/
template<typename utype>
class BoundaryElement : public Element<utype>
{
template<TopoType Topo>
friend class PUML;
private:
/** A listof ranks that contain the same vertex */
std::vector<int> m_sharedRanks;
public:
/**
* @return <code>True</code> if the element is on a partition boundary
*/
bool isShared() const
{ return m_sharedRanks.size() > 0; }
/**
* @return A vector of ranks that also has this element
*/
const std::vector<int>& shared() const
{ return m_sharedRanks; }
};
class Vertex : public BoundaryElement<std::vector<int> >
{
template<TopoType Topo>
friend class PUML;
private:
double m_coordinate[3];
public:
/**
* @return A pointer to an array with 3 components containing
* x, y and z
*/
const double* coordinate() const
{ return m_coordinate; }
};
class Edge : public BoundaryElement<std::vector<int> >
{
template<TopoType Topo>
friend class PUML;
};
class Face : public BoundaryElement<int[2]>
{
template<TopoType Topo>
friend class PUML;
};
template<TopoType Topo>
class Cell : public Element<std::array<int, 0>>
{
friend class PUML<Topo>;
friend class Downward;
private:
unsigned int m_vertices[internal::Topology<Topo>::cellvertices()];
};
}
#endif // PUML_ELEMENT_H