Wildmeshing Toolkit
Loading...
Searching...
No Matches
CofacesInSimplexIterable.cpp
Go to the documentation of this file.
2
3namespace wmtk::simplex {
4
6 const Mesh& mesh,
7 const Simplex& simplex,
8 const PrimitiveType in_simplex_type)
9 : m_mesh(mesh)
10 , m_simplex(simplex)
11 , m_in_simplex_type(in_simplex_type)
12{
13 assert(in_simplex_type <= mesh.top_simplex_type());
14}
15
17 const CofacesInSimplexIterable& container,
18 const Tuple& t)
19 : m_container(container)
20 , m_t(t)
21{
23 m_t = Tuple();
24 }
25}
26
28{
29 constexpr std::array<PrimitiveType, 3> pts = {
31
32 const Mesh& mesh = m_container.m_mesh;
33 const simplex::Simplex& simplex = m_container.m_simplex;
34
35 const int8_t pt_start = get_primitive_type_id(simplex.primitive_type()) + 1;
36 const int8_t pt_end = get_primitive_type_id(m_container.m_in_simplex_type);
37
38
39 for (int8_t i = pt_start; i < pt_end; ++i) {
40 m_t = mesh.switch_tuple(m_t, pts[i]);
41 }
42
43
44 if (m_t == simplex.tuple()) {
45 m_t = Tuple();
46 }
47
48 return *this;
49}
50
52{
53 return m_t != other.m_t;
54}
55
60
61} // namespace wmtk::simplex
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
Iterator(const CofacesInSimplexIterable &container, const Tuple &t=Tuple())
Get all cofaces that are in a specific simplex type.
CofacesInSimplexIterable(const Mesh &mesh, const Simplex &simplex, const PrimitiveType in_simplex_type)
const Tuple & tuple() const
Definition Simplex.hpp:53
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.