-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathElement.h
116 lines (91 loc) · 2.46 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
// 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_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
*/
[[nodiscard]] auto gid() const -> unsigned long { 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
*/
[[nodiscard]] auto isShared() const -> bool { return !m_sharedRanks.empty(); }
/**
* @return A vector of ranks that also has this element
*/
[[nodiscard]] auto shared() const -> const std::vector<int>& { 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
*/
[[nodiscard]] auto coordinate() const -> const double* { 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()]{};
};
} // namespace PUML
#endif // PUML_ELEMENT_H