Wildmeshing Toolkit
Loading...
Searching...
No Matches
CofacesSingleDimensionIterable.cpp
Go to the documentation of this file.
2
5
6namespace wmtk::simplex {
7
8
10 const Mesh& mesh,
11 const Simplex& simplex,
12 const PrimitiveType cofaces_type)
13 : m_mesh(mesh)
14 , m_simplex(simplex)
15 , m_cofaces_type(cofaces_type)
16 , m_tdc_itrbl(mesh, simplex, cofaces_type != mesh.top_simplex_type())
17 , m_it_end(m_tdc_itrbl.end())
18{
19 assert(cofaces_type >= simplex.primitive_type());
20}
21
24 const Tuple& t)
25 : m_container(container)
26 , m_it(container.m_tdc_itrbl, t)
27{
28 if ((*m_it).is_null()) {
29 return;
30 }
31
32 init();
33}
34
36{
37 if (m_container.m_simplex.primitive_type() == m_container.m_cofaces_type) {
38 *m_it = Tuple();
39 return *this;
40 }
41
42 if (depth() == 3) {
43 return step_depth_3();
44 }
45
46 ++m_it;
47 return *this;
48}
49
51{
52 return *m_it != *other;
53}
54
59
61{
62 return *m_it;
63}
64
66{
67 const Mesh& mesh = m_container.m_mesh;
68 const simplex::Simplex& simplex = m_container.m_simplex;
69 assert(mesh.top_cell_dimension() >= get_primitive_type_id(simplex.primitive_type()));
70 assert(mesh.top_cell_dimension() - get_primitive_type_id(simplex.primitive_type()) < 4);
71
73}
74
76{
77 return m_container.m_mesh.top_cell_dimension() ==
78 get_primitive_type_id(m_container.m_cofaces_type);
79}
80
82{
83 if (depth() == 3 && !is_coface_d0()) {
84 const Mesh& mesh = m_container.m_mesh;
85 const PrimitiveType& cofaces_type = m_container.m_cofaces_type;
86
87 m_container.m_visited_cofaces.is_visited(mesh.get_id_simplex(*m_it, cofaces_type));
88 }
89}
90
92{
93 const Mesh& mesh = m_container.m_mesh;
94 const simplex::Simplex& simplex = m_container.m_simplex;
95 const PrimitiveType& cofaces_type = m_container.m_cofaces_type;
96 auto& visited = m_container.m_visited_cofaces;
97
98 if (!is_coface_d0()) {
100 ++m_edge_counter;
101
102 while (!(*m_it).is_null()) {
103 for (; m_edge_counter < 3; ++m_edge_counter) {
104 if (!visited.is_visited(mesh.get_id_simplex(*m_it, cofaces_type))) {
105 return *this;
106 }
108 }
109
110 // go to next cell
111 m_edge_counter = 0;
112 ++m_it;
113 }
114 } else {
115 ++m_it;
116 }
117
118 return *this;
119}
120
121} // namespace wmtk::simplex
Tuple switch_tuples(const Tuple &tuple, const ContainerType &op_sequence) const
Definition Mesh.hpp:953
int64_t top_cell_dimension() const
Definition Mesh.hpp:978
simplex::IdSimplex get_id_simplex(const Tuple &tuple, PrimitiveType pt) const
Retrieve the IdSimplex that is represented by the tuple and primitive type.
Definition Mesh.cpp:28
The Tuple is the basic navigation tool in our mesh data structure.
Definition Tuple.hpp:19
int64_t depth()
Compute the depth from the mesh and the simplex type.
Iterator & step_depth_3()
Use breadth first search to find all d-simplices, and iterate through all cofaces in a d-simplex.
void init()
Depending on the depth, the iterator must be initialized differently.
Iterator(CofacesSingleDimensionIterable &container, const Tuple &t=Tuple())
bool is_coface_d0()
Check if coface type is the mesh's top simplex type.
This iterator internally uses TopDimensionCofacesIterable.
CofacesSingleDimensionIterable(const Mesh &mesh, const Simplex &simplex, const PrimitiveType cofaces_type)
PrimitiveType primitive_type() const
Definition Simplex.hpp:51
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.