Wildmeshing Toolkit
boundary_with_preserved_face.cpp
Go to the documentation of this file.
2 #include <wmtk/Mesh.hpp>
4 
5 namespace wmtk::simplex::internal {
6 
8  const Mesh& mesh,
9  const Tuple& t,
10  PrimitiveType pt,
11  PrimitiveType face_pt)
12 {
13  std::vector<Tuple> ret;
14  constexpr static PrimitiveType PV = PrimitiveType::Vertex;
15  constexpr static PrimitiveType PE = PrimitiveType::Edge;
16  constexpr static PrimitiveType PF = PrimitiveType::Triangle;
17  constexpr static PrimitiveType PT = PrimitiveType::Tetrahedron;
18  if (face_pt < pt) {
19  ret.emplace_back(t);
20  }
21  switch (pt) {
22  case PrimitiveType::Vertex: {
23  // vertex does not have a boundary
24  } break;
25  case PrimitiveType::Edge: {
26  } break;
28  if (face_pt < PE) {
29  ret.emplace_back(mesh.switch_tuples(t, {PE}));
30  }
31  } break;
33  if (face_pt < PF) {
34  ret.emplace_back(mesh.switch_tuples(t, {PF}));
35  if (face_pt < PE) {
36  ret.emplace_back(mesh.switch_tuples(t, {PE, PF}));
37  }
38  }
39  } break;
40  default:
41  throw std::runtime_error("called boundary_with_preserveD_coface_tuples with halfedge");
42  break;
43  }
44  return ret;
45 }
46 
47 std::vector<Tuple>
48 boundary_with_preserved_face_tuples(const Mesh& mesh, const Simplex& simplex, PrimitiveType face_pt)
49 {
51  mesh,
52  simplex.tuple(),
53  simplex.primitive_type(),
54  face_pt);
55 }
56 
58  const Mesh& mesh,
59  const Tuple& t,
60  PrimitiveType pt,
61  PrimitiveType face_pt)
62 {
63  if (pt == PrimitiveType::Vertex) {
64  return {};
65  }
67  mesh,
68  boundary_with_preserved_face_tuples(mesh, t, pt, face_pt),
70 }
71 
73  const Mesh& mesh,
74  const Simplex& simplex,
75  PrimitiveType face_pt)
76 {
78  mesh,
79  simplex.tuple(),
80  simplex.primitive_type(),
81  face_pt);
82 }
83 } // namespace wmtk::simplex::internal
Tuple switch_tuples(const Tuple &tuple, const ContainerType &op_sequence) const
Definition: Mesh.hpp:967
const Tuple & tuple() const
Definition: Simplex.hpp:53
PrimitiveType primitive_type() const
Definition: Simplex.hpp:51
constexpr wmtk::PrimitiveType PT
constexpr wmtk::PrimitiveType PF
This class is a utility to perform breadth first search on simplices.
std::vector< Simplex > boundary_with_preserved_face_simplices(const Mesh &mesh, const Tuple &t, PrimitiveType pt, PrimitiveType face_pt)
Returns the faces (single-dimension) of a simplex that are also cofaces of a given face.
std::vector< Tuple > boundary_with_preserved_face_tuples(const Mesh &mesh, const Tuple &t, PrimitiveType pt, PrimitiveType face_pt)
Returns the faces (single-dimension) of a simplex that are also cofaces of a given face.
std::vector< Simplex > tuple_vector_to_homogeneous_simplex_vector(const Mesh &m, const std::vector< Tuple > &tups, PrimitiveType primitive)
constexpr PrimitiveType get_primitive_type_from_id(int8_t id)
Get the primitive type corresponding to its unique integer id.
constexpr PrimitiveType PV
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.
constexpr PrimitiveType PE