TTK
Loading...
Searching...
No Matches
PeriodicPreconditions.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace ttk {
10 : public PeriodicImplicitTriangulationCRTP<PeriodicWithPreconditions> {
11 public:
13 this->setDebugMsgPrefix("PeriodicTriangulationWithPreconditions");
14 }
15
16 int preconditionVerticesInternal() override;
17 int preconditionEdgesInternal() override;
18 int preconditionTrianglesInternal() override;
20
21 inline std::array<SimplexId, 3> const &
22 getVertexCoords(const SimplexId v) const {
23 return this->vertexCoords_[v];
24 }
25 inline EdgePosition getEdgePosition(const SimplexId e) const {
26 return this->edgePositions_[e];
27 }
28 inline std::array<SimplexId, 3> const &
29 getEdgeCoords(const SimplexId e) const {
30 return this->edgeCoords_[e];
31 }
33 return this->trianglePositions_[t];
34 }
35 inline std::array<SimplexId, 3> const &
37 return this->triangleCoords_[t];
38 }
39 inline std::array<SimplexId, 3> const &
41 return this->tetrahedronCoords_[t];
42 }
44 return this->edgeVertexAccelerated_[e];
45 }
46
47 inline int clear() {
48 vertexCoords_ = std::vector<std::array<SimplexId, 3>>{};
49 edgePositions_ = std::vector<EdgePosition>{};
50 edgeCoords_ = std::vector<std::array<SimplexId, 3>>{};
51 trianglePositions_ = std::vector<TrianglePosition>{};
52 triangleCoords_ = std::vector<std::array<SimplexId, 3>>{};
53 tetrahedronCoords_ = std::vector<std::array<SimplexId, 3>>{};
54 edgeVertexAccelerated_ = std::vector<SimplexId>{};
57 }
58
59 private:
60 // for every vertex, its coordinates on the grid
61 std::vector<std::array<SimplexId, 3>> vertexCoords_{};
62 // for every edge, its position on the grid
63 std::vector<EdgePosition> edgePositions_{};
64 // for every edge, its coordinates on the grid
65 std::vector<std::array<SimplexId, 3>> edgeCoords_{};
66 // for every triangle, its position on the grid
67 std::vector<TrianglePosition> trianglePositions_{};
68 // for every triangle, its coordinates on the grid
69 std::vector<std::array<SimplexId, 3>> triangleCoords_{};
70 // for every tetrahedron, its coordinates on the grid
71 std::vector<std::array<SimplexId, 3>> tetrahedronCoords_{};
72
73 // cache some edge vertex computation wrt acceleration
74 std::vector<SimplexId> edgeVertexAccelerated_{};
75 };
76
81 : public PeriodicImplicitTriangulationCRTP<PeriodicNoPreconditions> {
82 public:
84 this->setDebugMsgPrefix("PeriodicTriangulationNoPreconditions");
85 }
86
87 inline int preconditionVerticesInternal() override {
88 return 0;
89 }
90 inline int preconditionEdgesInternal() override {
91 return 0;
92 }
93 inline int preconditionTrianglesInternal() override {
94 return 0;
95 }
96 inline int preconditionTetrahedronsInternal() override {
97 return 0;
98 }
99
100 inline std::array<SimplexId, 3> getVertexCoords(const SimplexId v) const {
101 std::array<SimplexId, 3> p{};
102 if(this->dimensionality_ == 2) {
103 this->vertexToPosition2d(v, p.data());
104 } else if(this->dimensionality_ == 3) {
105 this->vertexToPosition(v, p.data());
106 }
107 return p;
108 }
109
111 std::array<SimplexId, 3> getEdgeCoords(const SimplexId e) const;
113 std::array<SimplexId, 3> getTriangleCoords(const SimplexId t) const;
114
115 inline std::array<SimplexId, 3>
117 std::array<SimplexId, 3> p{};
118 this->tetrahedronToPosition(t, p.data());
119 return p;
120 }
121
123 const auto p{this->getEdgeCoords(e)};
124 if(this->isAccelerated_) {
125 return (p[1] << this->div_[0]) + (p[2] << this->div_[1]);
126 } else {
127 return p[1] * this->vshift_[0] + p[2] * this->vshift_[1];
128 }
129 }
130 };
131
132} // namespace ttk
void setDebugMsgPrefix(const std::string &prefix)
Definition Debug.h:364
Periodic implicit Triangulation class without preconditioning.
EdgePosition getEdgePosition(const SimplexId e) const
std::array< SimplexId, 3 > getEdgeCoords(const SimplexId e) const
std::array< SimplexId, 3 > getVertexCoords(const SimplexId v) const
TrianglePosition getTrianglePosition(const SimplexId t) const
SimplexId getEdgeVertexAccelerated(const SimplexId e) const
std::array< SimplexId, 3 > getTriangleCoords(const SimplexId t) const
std::array< SimplexId, 3 > getTetrahedronCoords(const SimplexId t) const
Periodic implicit Triangulation class with preconditioning.
TrianglePosition getTrianglePosition(const SimplexId t) const
std::array< SimplexId, 3 > const & getTetrahedronCoords(const SimplexId t) const
EdgePosition getEdgePosition(const SimplexId e) const
std::array< SimplexId, 3 > const & getEdgeCoords(const SimplexId e) const
SimplexId getEdgeVertexAccelerated(const SimplexId e) const
std::array< SimplexId, 3 > const & getVertexCoords(const SimplexId v) const
std::array< SimplexId, 3 > const & getTriangleCoords(const SimplexId t) 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