TTK
Loading...
Searching...
No Matches
ImplicitPreconditions.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace ttk {
10 : public ImplicitTriangulationCRTP<ImplicitWithPreconditions> {
11 public:
13 this->setDebugMsgPrefix("ImplicitTriangulationWithPreconditions");
14 }
15
16 int preconditionVerticesInternal() override;
17 int preconditionEdgesInternal() override;
18 int preconditionTrianglesInternal() override;
20
22 return this->vertexPositions_[v];
23 }
24 inline std::array<SimplexId, 3> const &
25 getVertexCoords(const SimplexId v) const {
26 return this->vertexCoords_[v];
27 }
28 inline EdgePosition getEdgePosition(const SimplexId e) const {
29 return this->edgePositions_[e];
30 }
31 inline std::array<SimplexId, 3> const &
32 getEdgeCoords(const SimplexId e) const {
33 return this->edgeCoords_[e];
34 }
36 return this->trianglePositions_[t];
37 }
38 inline std::array<SimplexId, 3> const &
40 return this->triangleCoords_[t];
41 }
42 inline const std::array<SimplexId, 3> &
44 return this->tetrahedronCoords_[t];
45 }
46
47 inline int clear() {
48 vertexPositions_ = std::vector<VertexPosition>{};
49 vertexCoords_ = std::vector<std::array<SimplexId, 3>>{};
50 edgePositions_ = std::vector<EdgePosition>{};
51 edgeCoords_ = std::vector<std::array<SimplexId, 3>>{};
52 trianglePositions_ = std::vector<TrianglePosition>{};
53 triangleCoords_ = std::vector<std::array<SimplexId, 3>>{};
54 tetrahedronCoords_ = std::vector<std::array<SimplexId, 3>>{};
57 }
58
59 private:
60 // for every vertex, its position on the grid
61 std::vector<VertexPosition> vertexPositions_{};
62 // for every vertex, its coordinates on the grid
63 std::vector<std::array<SimplexId, 3>> vertexCoords_{};
64 // for every edge, its position on the grid
65 std::vector<EdgePosition> edgePositions_{};
66 // for every edge, its coordinates on the grid
67 std::vector<std::array<SimplexId, 3>> edgeCoords_{};
68 // for every triangle, its position on the grid
69 std::vector<TrianglePosition> trianglePositions_{};
70 // for every triangle, its coordinates on the grid
71 std::vector<std::array<SimplexId, 3>> triangleCoords_{};
72 // for every tetrahedron, its coordinates on the grid
73 std::vector<std::array<SimplexId, 3>> tetrahedronCoords_{};
74 };
75
80 : public ImplicitTriangulationCRTP<ImplicitNoPreconditions> {
81 public:
83 this->setDebugMsgPrefix("ImplicitTriangulationNoPreconditions");
84 }
85
86 inline int preconditionVerticesInternal() override {
87 return 0;
88 }
89 inline int preconditionEdgesInternal() override {
90 return 0;
91 }
92 inline int preconditionTrianglesInternal() override {
93 return 0;
94 }
95 inline int preconditionTetrahedronsInternal() override {
96 return 0;
97 }
98
100
101 inline std::array<SimplexId, 3> getVertexCoords(const SimplexId v) const {
102 std::array<SimplexId, 3> p{};
103 if(this->dimensionality_ == 2) {
104 this->vertexToPosition2d(v, p.data());
105 } else if(this->dimensionality_ == 3) {
106 this->vertexToPosition(v, p.data());
107 }
108 return p;
109 }
110
112 std::array<SimplexId, 3> getEdgeCoords(const SimplexId e) const;
114 std::array<SimplexId, 3> getTriangleCoords(const SimplexId t) const;
115
116 inline std::array<SimplexId, 3>
118 std::array<SimplexId, 3> p{};
119 this->tetrahedronToPosition(t, p.data());
120 return p;
121 }
122 };
123
124} // namespace ttk
void setDebugMsgPrefix(const std::string &prefix)
Definition: Debug.h:364
Implicit Triangulation class without preconditioning.
VertexPosition getVertexPosition(const SimplexId v) const
std::array< SimplexId, 3 > getVertexCoords(const SimplexId v) const
EdgePosition getEdgePosition(const SimplexId e) const
TrianglePosition getTrianglePosition(const SimplexId t) const
std::array< SimplexId, 3 > getTetrahedronCoords(const SimplexId t) const
std::array< SimplexId, 3 > getTriangleCoords(const SimplexId t) const
std::array< SimplexId, 3 > getEdgeCoords(const SimplexId e) const
int preconditionTetrahedronsInternal() override
Implicit Triangulation class with preconditioning.
std::array< SimplexId, 3 > const & getTriangleCoords(const SimplexId t) const
EdgePosition getEdgePosition(const SimplexId e) const
std::array< SimplexId, 3 > const & getVertexCoords(const SimplexId v) const
TrianglePosition getTrianglePosition(const SimplexId t) const
VertexPosition getVertexPosition(const SimplexId v) const
const std::array< SimplexId, 3 > & getTetrahedronCoords(const SimplexId t) const
std::array< SimplexId, 3 > const & getEdgeCoords(const SimplexId e) const
virtual void tetrahedronToPosition(const SimplexId tetrahedron, SimplexId p[3]) const =0
virtual void vertexToPosition(const SimplexId vertex, SimplexId p[3]) const =0
virtual void vertexToPosition2d(const SimplexId vertex, SimplexId p[2]) const =0
The Topology ToolKit.
int SimplexId
Identifier type for simplices of any dimension.
Definition: DataTypes.h:22