Wildmeshing Toolkit
uvEdgeInvariant.cpp
Go to the documentation of this file.
1 #include "uvEdgeInvariant.hpp"
2 #include <wmtk/Mesh.hpp>
4 
5 namespace wmtk::invariants {
6 uvEdgeInvariant::uvEdgeInvariant(const Mesh& position_mesh, const Mesh& uv_mesh)
7  : Invariant(position_mesh)
8  , m_uv_mesh(uv_mesh)
9 {}
10 
12 {
14  auto uv_v = mesh().map_to_child(m_uv_mesh, s);
15  for (const auto& v : uv_v) {
16  if (m_uv_mesh.is_boundary(PrimitiveType::Vertex, v.tuple())) return false;
17  }
18  return true;
19  }
20 
21  else if (s.primitive_type() == PrimitiveType::Edge) {
23  auto uv_v2 = mesh().map_to_child(
24  m_uv_mesh,
26  mesh(),
27  mesh().switch_tuple(s.tuple(), PrimitiveType::Vertex)));
28 
29  for (const auto& v : uv_v1) {
30  if (m_uv_mesh.is_boundary(PrimitiveType::Vertex, v.tuple())) return false;
31  }
32  for (const auto& v : uv_v2) {
33  if (m_uv_mesh.is_boundary(PrimitiveType::Vertex, v.tuple())) return false;
34  }
35 
36  return true;
37  }
38 
39  return true;
40 }
41 
42 
43 } // namespace wmtk::invariants
bool is_boundary(const simplex::Simplex &tuple) const
check if a simplex lies on a boundary or not
Definition: Mesh.cpp:106
std::vector< simplex::Simplex > map_to_child(const Mesh &child_mesh, const simplex::Simplex &my_simplex) const
optimized map fromsimplex from this mesh to one of its direct children
const Mesh & mesh() const
Definition: Invariant.cpp:35
uvEdgeInvariant(const Mesh &position_mesh, const Mesh &uv_mesh)
bool before(const simplex::Simplex &s) const override
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