17 const std::shared_ptr<Mesh>& child_mesh_ptr,
18 const std::vector<std::array<Tuple, 2>>& map_tuples)
42 throw std::runtime_error(
43 "Attempted to map between two simplices in different multi-mesh structures");
52 throw std::runtime_error(
53 "Attempted to map between two simplices in different multi-mesh structures");
59 const Mesh& other_mesh,
60 const std::vector<simplex::Simplex>& simplices)
const
62 std::vector<simplex::Simplex> ret;
63 ret.reserve(simplices.size());
64 for (
const auto& s : simplices) {
65 auto v =
map(other_mesh, s);
66 ret.insert(ret.end(), v.begin(), v.end());
73 const Mesh& other_mesh,
77 throw std::runtime_error(
78 "Attempted to map between two simplices in different multi-mesh structures");
84 const Mesh& other_mesh,
85 const std::vector<simplex::Simplex>& simplices)
const
87 std::vector<simplex::Simplex> ret;
88 ret.reserve(simplices.size());
89 for (
const auto& s : simplices) {
90 auto v =
lub_map(other_mesh, s);
91 ret.insert(ret.end(), v.begin(), v.end());
101 throw std::runtime_error(
"Attempted to map a simplex to parent despite being a root");
111 const Mesh& child_mesh,
115 throw std::runtime_error(
116 "Attempted to map between two simplices in different multi-mesh structures");
125 throw std::runtime_error(
126 "Attempted to map between two simplices in different multi-mesh structures");
134 std::vector<Tuple> ret;
135 ret.reserve(tuples.size());
136 for (
const auto& t : tuples) {
138 ret.insert(ret.end(), v.begin(), v.end());
147 throw std::runtime_error(
148 "Attempted to map between two simplices in different multi-mesh structures");
154 const Mesh& other_mesh,
156 const std::vector<Tuple>& tuples)
const
158 std::vector<Tuple> ret;
159 ret.reserve(tuples.size());
160 for (
const auto& t : tuples) {
162 ret.insert(ret.end(), v.begin(), v.end());
171 throw std::runtime_error(
"Attempted to map a simplex to parent despite being a root");
180 const Mesh& child_mesh,
184 throw std::runtime_error(
185 "Attempted to map between two simplices in different multi-mesh structures");
229 std::vector<std::shared_ptr<Mesh>> children;
231 for (
const auto& child : direct_children) {
232 children.emplace_back(child);
233 auto child_children = child->get_all_child_meshes();
234 if (child_children.empty()) {
237 std::copy(child_children.begin(), child_children.end(), std::back_inserter(children));
245 std::vector<std::shared_ptr<Mesh const>> meshes;
246 meshes.emplace_back(shared_from_this());
247 for(
const auto& m: meshes2) {
248 meshes.emplace_back(m);
std::vector< int64_t > absolute_multi_mesh_id() const
returns a unique identifier for this mesh within a single multimesh structure
std::vector< simplex::Simplex > lub_map(const Mesh &other_mesh, const simplex::Simplex &my_simplex) const
maps a simplex from this mesh to any other mesh using LUB mesh as root
void update_child_handles()
Update the child handles after clearing attributes.
Mesh & get_multi_mesh_child_mesh(const std::vector< int64_t > &relative_id)
Tuple map_to_root_tuple(const simplex::Simplex &my_simplex) const
maps a simplex from this mesh to the root mesh
std::vector< std::shared_ptr< Mesh > > get_all_child_meshes() const
returns all multimesh child meshes
multimesh::MultiMeshManager m_multi_mesh_manager
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
bool is_multi_mesh_root() const
return true if this mesh is the root of a multimesh tree
Tuple map_to_parent_tuple(const simplex::Simplex &my_simplex) const
optimized map from a simplex from this mesh to its direct parent
simplex::Simplex map_to_root(const simplex::Simplex &my_simplex) const
maps a simplex from this mesh to the root mesh
Mesh & get_multi_mesh_root()
returns a reference to the root of a multimesh tree
std::vector< std::shared_ptr< const Mesh > > get_all_meshes() const
returns all meshes in multimesh
simplex::Simplex map_to_parent(const simplex::Simplex &my_simplex) const
optimized map from a simplex from this mesh to its direct parent
void register_child_mesh(const std::shared_ptr< Mesh > &child_mesh_ptr, const std::vector< std::array< Tuple, 2 >> &map_tuples)
register a mesh as the child of this mesh
std::vector< simplex::Simplex > map(const Mesh &other_mesh, const simplex::Simplex &my_simplex) const
maps a simplex from this mesh to any other mesh
Mesh & get_multi_mesh_mesh(const std::vector< int64_t > &absolute_id)
bool can_map(const Mesh &other_mesh, const simplex::Simplex &my_simplex) const
bool is_from_same_multi_mesh_structure(const Mesh &other) const
void deregister_child_mesh(const std::shared_ptr< Mesh > &child_mesh_ptr)
Deregister a child mesh.
std::vector< Tuple > map_to_child_tuples(const Mesh &child_mesh, const simplex::Simplex &my_simplex) const
optimized map fromsimplex from this mesh to one of its direct children
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
std::vector< std::shared_ptr< Mesh > > get_child_meshes() const
returns the direct multimesh child meshes for the current mesh
std::vector< Tuple > lub_map_tuples(const Mesh &other_mesh, const simplex::Simplex &my_simplex) const
maps a simplex from this mesh to any other mesh using LUB mesh as root
Tuple map_to_root_tuple(const Mesh &my_mesh, const simplex::Simplex &my_simplex) const
maps a simplex from this mesh to the root mesh
const Mesh & get_root_mesh(const Mesh &my_mesh) const
void register_child_mesh(Mesh &my_mesh, const std::shared_ptr< Mesh > &child_mesh, const std::vector< std::array< Tuple, 2 >> &child_tuple_my_tuple_map)
register a another mesh as a child of this mesh.
Mesh & get_mesh(Mesh &m, const std::vector< int64_t > &absolute_id)
void deregister_child_mesh(Mesh &my_mesh, const std::shared_ptr< Mesh > &child_mesh_ptr)
Deregister a child mesh.
bool is_root() const
Specifies whether this structure is the root of a multi-mesh tree.
std::vector< int64_t > absolute_id() const
std::vector< simplex::Simplex > map(const Mesh &my_mesh, const Mesh &other_mesh, const simplex::Simplex &my_simplex) const
maps a simplex from this mesh to any other mesh
std::vector< std::shared_ptr< Mesh > > get_child_meshes() const
std::vector< Tuple > lub_map_tuples(const Mesh &my_mesh, const Mesh &other_mesh, const simplex::Simplex &my_simplex) const
maps a simplex from this mesh to any other mesh using the LUB as the root
void update_child_handles(Mesh &my_mesh)
Clean up child data after deleting attributes.
simplex::Simplex map_to_root(const Mesh &my_mesh, const simplex::Simplex &my_simplex) const
maps a simplex from this mesh to the root mesh
simplex::Simplex map_to_parent(const Mesh &my_mesh, const simplex::Simplex &my_simplex) const
optimized map from a simplex from this mesh to its direct parent
std::vector< Tuple > map_tuples(const Mesh &my_mesh, const Mesh &other_mesh, const simplex::Simplex &my_simplex) const
maps a simplex from this mesh to any other mesh
Tuple map_to_parent_tuple(const Mesh &my_mesh, const simplex::Simplex &my_simplex) const
optimized map from a simplex from this mesh to its direct parent
bool can_map(const Mesh &my_mesh, const Mesh &other_mesh, const simplex::Simplex &my_simplex) const
std::vector< Tuple > map_to_child_tuples(const Mesh &my_mesh, const Mesh &child_mesh, const simplex::Simplex &my_simplex) const
Mesh & get_child_mesh(Mesh &m, const std::vector< int64_t > &relative_id)
std::vector< simplex::Simplex > map_to_child(const Mesh &my_mesh, const Mesh &child_mesh, const simplex::Simplex &my_simplex) const
optimized map fromsimplex from this mesh to one of its direct children
std::vector< simplex::Simplex > lub_map(const Mesh &my_mesh, const Mesh &other_mesh, const simplex::Simplex &my_simplex) const
maps a simplex from this mesh to any other mesh using the LUB as the root