Wildmeshing Toolkit
Loading...
Searching...
No Matches
BoundaryChecker.cpp
Go to the documentation of this file.
1#include "BoundaryChecker.hpp"
2#include <wmtk/Mesh.hpp>
3namespace wmtk::multimesh {
4bool BoundaryChecker::is_boundary(const Mesh& mesh, const wmtk::simplex::Simplex& simplex) const
5{
6 const int64_t my_dimension = mesh.top_cell_dimension();
7 for (const Mesh* checker_ptr : m_meshes) {
8 if (&mesh == checker_ptr) {
9 if (mesh.is_boundary(simplex)) {
10 return true;
11 }
12 } else if (const int64_t checker_dimension = checker_ptr->top_cell_dimension();
13 checker_dimension >= my_dimension) {
14 auto checker_simplices = mesh.map_tuples(*checker_ptr, simplex);
15
16 for (const Tuple& t : checker_simplices) {
17 if (checker_ptr->is_boundary(simplex.primitive_type(), t)) {
18 return true;
19 }
20 }
21 } else if (checker_dimension == my_dimension - 1) {
22 if (mesh.can_map(*checker_ptr, simplex)) {
23 return true;
24 }
25 }
26 }
27 return false;
28}
30 const Mesh& mesh,
31 const wmtk::PrimitiveType pt,
32 const wmtk::Tuple& simplex) const
33{
34 return is_boundary(mesh, wmtk::simplex::Simplex(mesh, pt, simplex));
35}
37{
38 m_meshes.emplace_back(&m);
39}
40
42{
44 bc.add_mesh(m);
45 for (const std::shared_ptr<Mesh>& mptr : m.get_multi_mesh_root().get_all_child_meshes()) {
46 bc.add_mesh(*mptr);
47 }
48 return bc;
49}
50} // namespace wmtk::multimesh
bool is_boundary(const simplex::Simplex &tuple) const
check if a simplex lies on a boundary or not
Definition Mesh.cpp:107
std::vector< std::shared_ptr< Mesh > > get_all_child_meshes() const
returns all multimesh child meshes
std::vector< Tuple > map_tuples(const Mesh &other_mesh, const simplex::Simplex &my_simplex) const
maps a simplex from this mesh to any other mesh
int64_t top_cell_dimension() const
Definition Mesh.hpp:978
Mesh & get_multi_mesh_root()
returns a reference to the root of a multimesh tree
bool can_map(const Mesh &other_mesh, const simplex::Simplex &my_simplex) const
The Tuple is the basic navigation tool in our mesh data structure.
Definition Tuple.hpp:19
static BoundaryChecker for_all_meshes(const Mesh &m)
bool is_boundary(const Mesh &m, const wmtk::simplex::Simplex &simplex) const
std::vector< const Mesh * > m_meshes
PrimitiveType primitive_type() const
Definition Simplex.hpp:51