14 const bool retrieve_intermediate_tuple)
17 , m_retrieve_intermediate_tuple(retrieve_intermediate_tuple)
23 : m_container(container)
37 case 0:
return step_depth_0();
38 case 1:
return step_depth_1();
39 case 2:
return step_depth_2();
40 case 3:
return step_depth_3();
51 return m_t != other.
m_t;
71 const Mesh& mesh = m_container.m_mesh;
81 const Mesh& mesh = m_container.m_mesh;
90 m_phase = IteratorPhase::Intermediate;
92 }
else if (depth == 3) {
96 add_neighbors_to_queue();
108 const Mesh& mesh = m_container.m_mesh;
111 if (m_phase == IteratorPhase::End || mesh.
is_boundary(pt(1), m_t)) {
116 m_phase = IteratorPhase::End;
123 const Mesh& mesh = m_container.m_mesh;
126 m_is_intermediate =
false;
128 if (m_phase == IteratorPhase::Intermediate) {
132 m_phase = IteratorPhase::End;
135 m_phase = IteratorPhase::Backward;
137 if (m_container.m_retrieve_intermediate_tuple) {
138 m_is_intermediate =
true;
143 if (m_phase == IteratorPhase::End) {
150 if (m_t == simplex.
tuple()) {
156 if (m_phase == IteratorPhase::Forward) {
157 m_phase = IteratorPhase::Intermediate;
159 m_phase = IteratorPhase::End;
168 const Mesh& mesh = m_container.m_mesh;
169 auto& q = m_container.m_q;
170 auto& q_front = m_container.m_q_front;
172 if (q_front == q.size()) {
179 add_neighbors_to_queue();
187 const Mesh& mesh = m_container.m_mesh;
194 for (
size_t i = 0; i < 3; ++i) {
199 if (!m_container.m_visited.is_visited(neigh_id)) {
200 m_container.m_q.emplace_back(neigh);
209 return m_is_intermediate;
bool is_boundary(const simplex::Simplex &tuple) const
check if a simplex lies on a boundary or not
Tuple switch_tuples(const Tuple &tuple, const ContainerType &op_sequence) const
int64_t top_cell_dimension() const
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
bool is_null() const
Checks if a tuple is "null". This merely implies the global index is -1.
const Tuple & tuple() const
PrimitiveType primitive_type() const
Iterator & step_depth_1()
There are at max two d-simplices.
PrimitiveType pt(int64_t depth) const
Get the d - depth primitive type.
Iterator & step_depth_0()
Just return the simplex and stop.
void add_neighbors_to_queue()
bool is_intermediate() const
int64_t depth()
Compute the depth from the mesh and the simplex type.
Iterator(TopDimensionCofacesIterable &container, const Tuple &t=Tuple())
bool operator!=(const Iterator &other) const
void init(int64_t depth)
Depending on the depth, the iterator must be initialized differently.
Iterator & step_depth_2()
Iterate around simplex to find all d-simplices.
Iterator & step_depth_3()
Use breadth first search to find all d-simplices.
Iterating through the d-simplices of a mesh can be done in different ways, depending on the simplex d...
IteratorPhase
The IteratorPhase is only used for depth 1 and 2.
TopDimensionCofacesIterable(const Mesh &mesh, const Simplex &simplex, const bool retrieve_intermediate_tuple=false)
static int64_t global_cid(const Tuple &t)
constexpr PrimitiveType get_primitive_type_from_id(int8_t id)
Get the primitive type corresponding to its unique integer id.
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.