Wildmeshing Toolkit
Invariant.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <vector>
3 #include <wmtk/PrimitiveType.hpp>
4 namespace wmtk {
5 class Tuple;
6 class Mesh;
7 namespace simplex {
8 class Simplex;
9 }
10 namespace invariants {
11 class Invariant
12 {
13 public:
14  // invariants can add constraints on either the before or after of a function
15  // The default implementation is that both constraints are true so derived classes only have to
16  // define one of the two
17  virtual bool before(const simplex::Simplex& t) const;
18  virtual bool after(
19  const std::vector<Tuple>& top_dimension_tuples_before,
20  const std::vector<Tuple>& top_dimension_tuples_after) const;
21 
22  // have an invariant that sets all three by default
23  Invariant(const Mesh& m);
24  Invariant(
25  const Mesh& m,
26  bool use_before,
29  virtual ~Invariant();
30 
31  const Mesh& mesh() const;
32 
33  // TODO change name
34  virtual bool directly_modified_after(
35  const std::vector<simplex::Simplex>& simplices_before,
36  const std::vector<simplex::Simplex>& simplices_after) const;
37 
38 
39  bool use_before() const;
40  bool use_after() const;
41  bool use_old_state_in_after() const;
42  bool use_new_state_in_after() const;
43 
44 private:
45  const Mesh& m_mesh;
46  const bool m_use_before = true;
47  const bool m_use_old_state_in_after = true;
48  const bool m_use_new_state_in_after = true;
49 
50  const std::vector<Tuple> get_top_dimension_cofaces(
51  const std::vector<simplex::Simplex>& simplices) const;
52 };
53 } // namespace invariants
55 
56 } // namespace wmtk
virtual bool directly_modified_after(const std::vector< simplex::Simplex > &simplices_before, const std::vector< simplex::Simplex > &simplices_after) const
Definition: Invariant.cpp:39
const bool m_use_new_state_in_after
Definition: Invariant.hpp:48
bool use_old_state_in_after() const
Definition: Invariant.cpp:61
const bool m_use_old_state_in_after
Definition: Invariant.hpp:47
bool use_new_state_in_after() const
Definition: Invariant.cpp:65
const std::vector< Tuple > get_top_dimension_cofaces(const std::vector< simplex::Simplex > &simplices) const
Definition: Invariant.cpp:77
Invariant(const Mesh &m)
Definition: Invariant.cpp:10
const Mesh & mesh() const
Definition: Invariant.cpp:35
virtual bool before(const simplex::Simplex &t) const
Definition: Invariant.cpp:24
virtual bool after(const std::vector< Tuple > &top_dimension_tuples_before, const std::vector< Tuple > &top_dimension_tuples_after) const
Definition: Invariant.cpp:28
Definition: Accessor.hpp:6
invariants::Invariant Invariant
Definition: Invariant.hpp:54