Wildmeshing Toolkit
tuples_preserving_primitive_types.cpp
Go to the documentation of this file.
2 
3 #include <cassert>
4 #include <wmtk/Mesh.hpp>
6 
7 namespace wmtk::simplex {
8 
10  const Mesh& mesh,
11  const Tuple& t,
12  const PrimitiveType simplex_ptype,
13  const PrimitiveType face_ptype)
14 {
15  std::vector<PrimitiveType> switch_tuple_types =
16  wmtk::utils::primitive_range(simplex_ptype, face_ptype);
17 
18  Tuple t_iter = t;
19 
20  std::vector<Tuple> intersection_tuples;
21  do {
22  intersection_tuples.emplace_back(t_iter);
23  for (size_t i = 1; i < switch_tuple_types.size() - 1; ++i) {
24  t_iter = mesh.switch_tuple(t_iter, switch_tuple_types[i]);
25  }
26  } while (t != t_iter);
27 
28  return intersection_tuples;
29 }
30 
31 } // namespace wmtk::simplex
virtual Tuple switch_tuple(const Tuple &tuple, PrimitiveType type) const =0
switch the orientation of the Tuple of the given dimension
std::vector< Tuple > tuples_preserving_primitive_types(const Mesh &mesh, const Tuple &t, const PrimitiveType simplex_ptype, const PrimitiveType face_ptype)
Compute all tuples that contain simplex(ptype1, t) and that are contained by simplex(ptype2,...
std::vector< PrimitiveType > primitive_range(PrimitiveType pt0, PrimitiveType pt1)