Wildmeshing Toolkit
ClosedStarIterable.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <wmtk/Mesh.hpp>
7 
9 
10 namespace wmtk::simplex {
11 
17 {
18 public:
20 
21  class Iterator
22  {
23  public:
24  Iterator(ClosedStarIterable& container, const Tuple& t = Tuple());
26  bool operator!=(const Iterator& other) const;
28  const IdSimplex operator*() const;
29 
30  private:
36  int64_t depth();
37 
41  void init();
42 
48 
52 
54 
55  bool step_faces();
56  bool step_faces_edge();
57  bool step_faces_triangle();
59 
60  private:
62  const Mesh& m_mesh;
63 
66  int8_t m_pt = -1;
67  int8_t m_face_counter = 0;
68  IteratorPhase m_phase = IteratorPhase::Faces;
69  };
70 
71 public:
72  ClosedStarIterable(const Mesh& mesh, const Simplex& simplex);
73 
74  Iterator begin() { return Iterator(*this, m_simplex.tuple()); }
75  Iterator end() { return Iterator(*this); }
76 
77 private:
78  const Mesh& m_mesh;
82 
83  std::array<simplex::internal::VisitedArray<simplex::IdSimplex>, 2>
84  m_visited_cofaces; // for depth 3 iteration
85  std::array<simplex::internal::VisitedArray<simplex::IdSimplex>, 2>
86  m_visited_link; // for depth 3 iteration
87 };
88 
89 } // namespace wmtk::simplex
TopDimensionCofacesIterable::Iterator m_it
Iterator & step_depth_3()
Use breadth first search to find all d-simplices, and iterate through all cofaces in a d-simplex.
bool operator!=(const Iterator &other) const
int64_t depth()
Compute the depth from the mesh and the simplex type.
Iterator(ClosedStarIterable &container, const Tuple &t=Tuple())
void init()
Depending on the depth, the iterator must be initialized differently.
This iterator internally uses TopDimensionCofacesIterable.
std::array< simplex::internal::VisitedArray< simplex::IdSimplex >, 2 > m_visited_cofaces
TopDimensionCofacesIterable m_tdc_itrbl
TopDimensionCofacesIterable::Iterator m_it_end
ClosedStarIterable(const Mesh &mesh, const Simplex &simplex)
std::array< simplex::internal::VisitedArray< simplex::IdSimplex >, 2 > m_visited_link
const Tuple & tuple() const
Definition: Simplex.hpp:53
Iterating through the d-simplices of a mesh can be done in different ways, depending on the simplex d...