Wildmeshing Toolkit
Loading...
Searching...
No Matches
same_simplex_dimension_bijection.cpp
Go to the documentation of this file.
1
3#include <numeric>
4#include <wmtk/Mesh.hpp>
6
7
8namespace wmtk::multimesh {
9std::vector<std::array<Tuple, 2>> same_simplex_dimension_bijection(
10 const Mesh& parent,
11 const Mesh& child)
12{
13 PrimitiveType primitive_type = parent.top_simplex_type();
14 int64_t size = parent.capacity(primitive_type);
15#if !defined(NDEBUG)
16 if (primitive_type != child.top_simplex_type()) {
17 throw std::runtime_error(
18 "Cannot use same_simplex_dimension_bijection on meshes with simplex dimensions");
19 }
20 // TODO: this code is not aware of the difference between the size of a mesh and the capcity of
21 // an attribute
22 if (size != child.capacity(primitive_type)) {
23 throw std::runtime_error(
24 "Cannot use same_simplex_dimension_bijection on meshes with different capacities");
25 }
26#endif
27 std::vector<int64_t> ps(size);
28 std::iota(ps.begin(), ps.end(), 0);
29 return same_simplex_dimension_surjection(parent, child, ps);
30}
31
32} // namespace wmtk::multimesh
int64_t capacity(PrimitiveType type) const
read in the m_capacities return the upper bound for the number of entities of the given dimension
PrimitiveType top_simplex_type() const
Definition Mesh.hpp:982
std::vector< std::array< Tuple, 2 > > same_simplex_dimension_surjection(const Mesh &parent, const Mesh &child, const std::vector< int64_t > &parent_simplices)
std::vector< std::array< Tuple, 2 > > same_simplex_dimension_bijection(const Mesh &parent, const Mesh &child)