Wildmeshing Toolkit
utils.cpp
Go to the documentation of this file.
1 #include <wmtk/Mesh.hpp>
2 #include "tools/TriMesh_examples.hpp"
3 #include "utils.hpp"
5 
6 std::shared_ptr<wmtk::Mesh> make_mesh()
7 {
8  return wmtk::tests::disk(5);
9 }
10 
11 auto make_child(wmtk::Mesh& m, const std::vector<int64_t>& path)
12  -> std::vector<std::shared_ptr<wmtk::Mesh>>
13 {
14  if (path.size() == 0) {
15  // multimesh root mesh already exists so nothing to be done
16  return {};
17  }
18  std::vector<std::shared_ptr<wmtk::Mesh>> meshes;
19  for (size_t j = 0; j < path.size(); ++j) {
20  std::vector<int64_t> p(path.begin(), path.begin() + j);
21  auto& cur_mesh = m.get_multi_mesh_mesh(p);
22  int64_t child_index = path[j];
23  const auto child_meshes = cur_mesh.get_child_meshes();
24  for (int64_t index = child_meshes.size(); index <= child_index; ++index) {
25  auto new_mesh = make_mesh();
26  auto map = wmtk::multimesh::same_simplex_dimension_bijection(cur_mesh, *new_mesh);
27 
28  cur_mesh.register_child_mesh(new_mesh, map);
29  meshes.emplace_back(new_mesh);
30  }
31  }
32  return meshes;
33 }
std::vector< std::array< Tuple, 2 > > same_simplex_dimension_bijection(const Mesh &parent, const Mesh &child)
auto make_child(wmtk::Mesh &m, const std::vector< int64_t > &path) -> std::vector< std::shared_ptr< wmtk::Mesh >>
Definition: utils.cpp:11
std::shared_ptr< wmtk::Mesh > make_mesh()
Definition: utils.cpp:6