Wildmeshing Toolkit
MinIncidentValenceInvariant.cpp
Go to the documentation of this file.
2 
3 #include <wmtk/Mesh.hpp>
5 #include <wmtk/simplex/link.hpp>
6 
7 namespace wmtk::invariants {
8 
9 
11  : Invariant(m, true, false, false)
12  , m_min_valence(min_valence)
13 {}
14 
16 {
17  assert(t.primitive_type() == PrimitiveType::Edge);
18  return is_greater_min_valence(t.tuple());
19 }
20 
22  const std::vector<Tuple>& top_dimension_tuples_before,
23  const std::vector<Tuple>& top_dimension_tuples_after) const
24 {
25  for (const Tuple& e : top_dimension_tuples_after) {
26  const std::vector<Tuple> e_edges = simplex::faces_single_dimension_tuples(
27  mesh(),
28  simplex::Simplex(mesh(), mesh().top_simplex_type(), e),
30  for (const Tuple& edge : e_edges) {
31  if (!is_greater_min_valence(edge)) {
32  return false;
33  }
34  }
35  }
36 
37 
38  return true;
39 }
40 
42 {
43  using namespace simplex;
44 
45  const std::vector<Tuple> vs = faces_single_dimension_tuples(
46  mesh(),
49 
50  const simplex::Simplex v0 = simplex::Simplex::vertex(mesh(), vs[0]);
51  const simplex::Simplex v1 = simplex::Simplex::vertex(mesh(), vs[1]);
52  const int64_t val0 =
53  static_cast<int64_t>(link(mesh(), v0).simplex_vector(PrimitiveType::Vertex).size());
54  const int64_t val1 =
55  static_cast<int64_t>(link(mesh(), v1).simplex_vector(PrimitiveType::Vertex).size());
56 
57  return val0 >= m_min_valence && val1 >= m_min_valence;
58 }
59 
60 } // namespace wmtk::invariants
const Mesh & mesh() const
Definition: Invariant.cpp:35
bool before(const simplex::Simplex &t) const override
bool after(const std::vector< Tuple > &top_dimension_tuples_before, const std::vector< Tuple > &top_dimension_tuples_after) const override
MinIncidentValenceInvariant(const Mesh &m, int64_t min_valence)
const std::vector< Simplex > & simplex_vector() const
Return const reference to the simplex vector.
static Simplex face(const Mesh &m, const Tuple &t)
Definition: Simplex.hpp:63
const Tuple & tuple() const
Definition: Simplex.hpp:53
static Simplex vertex(const Mesh &m, const Tuple &t)
Definition: Simplex.hpp:56
PrimitiveType primitive_type() const
Definition: Simplex.hpp:51
SimplexCollection link(const Mesh &mesh, const simplex::Simplex &simplex, const bool sort_and_clean)
Definition: link.cpp:84
std::vector< Tuple > faces_single_dimension_tuples(const Mesh &mesh, const Simplex &simplex, const PrimitiveType face_type)