Wildmeshing Toolkit
FrozenVertexInvariant.cpp
Go to the documentation of this file.
2 #include <wmtk/Mesh.hpp>
3 
4 namespace wmtk::invariants {
6  const Mesh& m,
7  const TypedAttributeHandle<int64_t>& frozen_vertex_handle)
8  : Invariant(m, true, false, false)
9  , m_frozen_vertex_handle(frozen_vertex_handle)
10 {}
11 
13 {
14  const auto accessor = mesh().create_const_accessor(m_frozen_vertex_handle);
15 
16  if (accessor.const_scalar_attribute(simplex::Simplex::vertex(mesh(), t.tuple())) == 1) {
17  return false;
18  }
19  return true;
20 }
21 
23  const Mesh& m,
24  const TypedAttributeHandle<int64_t>& frozen_vertex_handle)
25  : Invariant(m, true, false, false)
26  , m_frozen_vertex_handle(frozen_vertex_handle)
27 {}
28 
30 {
31  assert(t.primitive_type() == PrimitiveType::Edge);
32  const auto accessor = mesh().create_const_accessor(m_frozen_vertex_handle);
33 
34  if (accessor.const_scalar_attribute(simplex::Simplex::vertex(
35  mesh(),
36  mesh().switch_tuple(t.tuple(), PrimitiveType::Vertex))) == 1) {
37  return false;
38  }
39  return true;
40 }
41 } // namespace wmtk::invariants
const attribute::Accessor< T, Mesh, D > create_const_accessor(const attribute::MeshAttributeHandle &handle) const
Handle that represents attributes for some mesh.
bool before(const simplex::Simplex &t) const override
const TypedAttributeHandle< int64_t > m_frozen_vertex_handle
FrozenOppVertexInvariant(const Mesh &m, const TypedAttributeHandle< int64_t > &frozen_vertex_handle)
bool before(const simplex::Simplex &t) const override
FrozenVertexInvariant(const Mesh &m, const TypedAttributeHandle< int64_t > &frozen_vertex_handle)
const TypedAttributeHandle< int64_t > m_frozen_vertex_handle
const Mesh & mesh() const
Definition: Invariant.cpp:35
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