Wildmeshing Toolkit
TodoInvariant.cpp
Go to the documentation of this file.
1 #include "TodoInvariant.hpp"
2 #include <wmtk/Mesh.hpp>
3 
4 namespace wmtk {
6  const Mesh& m,
7  const TypedAttributeHandle<int64_t>& todo_handle,
8  const int64_t val)
9  : Invariant(m, true, false, false)
10  , m_todo_handle(todo_handle)
11  , m_val(val)
12 {}
13 
15 {
17  const attribute::Accessor<int64_t> split_todo_accessor =
19  return split_todo_accessor.const_scalar_attribute(t) == m_val;
20 }
21 
23  const Mesh& m,
24  const TypedAttributeHandle<double>& todo_handle,
25  const double val)
26  : Invariant(m, true, false, false)
27  , m_todo_handle(todo_handle)
28  , m_val(val)
29 {}
30 
32  const Mesh& m,
33  const TypedAttributeHandle<double>& todo_handle,
34  const TypedAttributeHandle<double>& comparison_handle,
35  const double val)
36  : Invariant(m, true, false, false)
37  , m_todo_handle(todo_handle)
38  , m_comparison_handle(comparison_handle)
39  , m_val(val)
40 {}
41 
43 {
45  const attribute::Accessor<double> split_todo_accessor =
47 
48  if (m_comparison_handle.has_value()) {
49  const attribute::Accessor<double> comp_accessor =
51  return split_todo_accessor.const_scalar_attribute(t) >
52  m_val * comp_accessor.const_scalar_attribute(t);
53  } else {
54  return split_todo_accessor.const_scalar_attribute(t) > m_val;
55  }
56 }
57 
59  const Mesh& m,
60  const TypedAttributeHandle<double>& todo_handle,
61  const double val)
62  : Invariant(m, true, false, false)
63  , m_todo_handle(todo_handle)
64  , m_val(val)
65 {}
66 
68  const Mesh& m,
69  const TypedAttributeHandle<double>& todo_handle,
70  const TypedAttributeHandle<double>& comparison_handle,
71  const double val)
72  : Invariant(m, true, false, false)
73  , m_todo_handle(todo_handle)
74  , m_comparison_handle(comparison_handle)
75  , m_val(val)
76 {}
77 
79 {
81  const attribute::Accessor<double> split_todo_accessor =
83 
84  if (m_comparison_handle.has_value()) {
85  const attribute::Accessor<double> comp_accessor =
87  return split_todo_accessor.const_scalar_attribute(t) <
88  m_val * comp_accessor.const_scalar_attribute(t);
89  } else {
90  return split_todo_accessor.const_scalar_attribute(t) < m_val;
91  }
92 }
93 } // namespace wmtk
const attribute::Accessor< T, Mesh, D > create_const_accessor(const attribute::MeshAttributeHandle &handle) const
bool before(const simplex::Simplex &t) const override
const TypedAttributeHandle< int64_t > m_todo_handle
const int64_t m_val
TodoInvariant(const Mesh &m, const TypedAttributeHandle< int64_t > &todo_handle, const int64_t val=1)
Invariant for todo-list in scheduler.
const std::optional< TypedAttributeHandle< double > > m_comparison_handle
const TypedAttributeHandle< double > m_todo_handle
TodoLargerInvariant(const Mesh &m, const TypedAttributeHandle< double > &todo_handle, const double val)
Invariant for todo-list in scheduler.
bool before(const simplex::Simplex &t) const override
const std::optional< TypedAttributeHandle< double > > m_comparison_handle
TodoSmallerInvariant(const Mesh &m, const TypedAttributeHandle< double > &todo_handle, const double val)
Invariant for todo-list in scheduler.
bool before(const simplex::Simplex &t) const override
const TypedAttributeHandle< double > m_todo_handle
T const_scalar_attribute(const ArgType &t) const
Definition: Accessor.hxx:112
Handle that represents attributes for some mesh.
const Mesh & mesh() const
Definition: Invariant.cpp:35
PrimitiveType primitive_type() const
Definition: Simplex.hpp:51
Definition: Accessor.hpp:6