Wildmeshing Toolkit
Loading...
Searching...
No Matches
HalfClosedStarIterable.cpp
Go to the documentation of this file.
2
8
9namespace wmtk::simplex {
10
11
13 : m_mesh(mesh)
14 , m_tuple(tuple)
15 , m_tdc_itrbl(mesh, Simplex(mesh, PrimitiveType::Edge, tuple), true)
16 , m_it_end(m_tdc_itrbl.end())
17{}
18
20 : m_container(container)
21 , m_mesh(container.m_mesh)
22 , m_it(container.m_tdc_itrbl, t)
23 , m_t(t)
24{
25 if (m_t.is_null()) {
26 return;
27 }
28
29 m_pt = 1;
30}
31
33{
34 if (m_phase == IteratorPhase::Faces) {
35 if (step_faces()) {
36 return *this;
37 } else {
38 m_face_counter = 0;
39 m_pt = 1;
41 }
42 }
43
45 m_t = Tuple();
46 m_pt = -1;
47 return *this;
48 }
49
50 switch (m_mesh.top_simplex_type()) {
51 case PrimitiveType::Triangle: return step_tri_mesh();
52 case PrimitiveType::Tetrahedron: return step_tet_mesh();
55 default: assert(false); break;
56 }
57
58 // unreachable code
59 m_t = Tuple();
60 m_pt = -1;
61 return *this;
62}
63
65{
66 return (m_t != other.m_t) || (m_pt != other.m_pt);
67}
68
70{
71 return m_container.m_mesh.get_id_simplex(m_t, get_primitive_type_from_id(m_pt));
72}
73
75{
76 return m_container.m_mesh.get_id_simplex(m_t, get_primitive_type_from_id(m_pt));
77}
78
80{
83
84 ++m_face_counter;
85
86 switch (m_face_counter) {
87 case 1: m_pt = 2; return *this;
88 case 2:
89 m_pt = 1;
90 m_t = m_mesh.switch_tuple(m_t, PE);
91 return *this;
92 default: break;
93 }
94 m_pt = 2;
95 m_face_counter = 1;
96
97 ++m_it;
98 m_t = *m_it;
99
100 if (m_t.is_null()) {
101 m_pt = -1;
102 }
103
104 return *this;
105}
106
108{
112
113 ++m_face_counter;
114
115 if (m_it.is_intermediate() && m_face_counter == 3) {
116 m_pt = 2;
117 m_face_counter = 1;
118 ++m_it;
119 m_t = *m_it;
120 if (m_t.is_null()) {
121 m_pt = -1;
122 }
123 return *this;
124 }
125 switch (m_face_counter) {
126 case 1: m_pt = 2; return *this; // coface triangle
127 case 2:
128 m_t = m_mesh.switch_tuples(m_t, {PE, PF});
129 m_pt = 1;
130 return *this;
131 case 3: m_pt = 2; return *this;
132 case 4: m_pt = 3; return *this;
133 default: break;
134 }
135 m_pt = 2;
136 m_face_counter = 1;
137
138 ++m_it;
139 m_t = *m_it;
140
141 if (m_t.is_null()) {
142 m_pt = -1;
143 }
144
145 return *this;
146}
147
149{
150 if (m_face_counter == 1) {
151 return false;
152 }
153 m_pt = 0;
154 ++m_face_counter;
155 return true;
156}
157
158} // namespace wmtk::simplex
Tuple switch_tuples(const Tuple &tuple, const ContainerType &op_sequence) const
Definition Mesh.hpp:953
virtual Tuple switch_tuple(const Tuple &tuple, PrimitiveType type) const =0
switch the orientation of the Tuple of the given dimension
PrimitiveType top_simplex_type() const
Definition Mesh.hpp:982
The Tuple is the basic navigation tool in our mesh data structure.
Definition Tuple.hpp:19
bool is_null() const
Checks if a tuple is "null". This merely implies the global index is -1.
Definition Tuple.hxx:41
Iterator(HalfClosedStarIterable &container, const Tuple &t=Tuple())
This iterator internally uses TopDimensionCofacesIterable.
HalfClosedStarIterable(const Mesh &mesh, const Tuple &tuple)
constexpr wmtk::PrimitiveType PF
constexpr PrimitiveType get_primitive_type_from_id(int8_t id)
Get the primitive type corresponding to its unique integer id.
constexpr PrimitiveType PE
constexpr PrimitiveType PV