Wildmeshing Toolkit
Loading...
Searching...
No Matches
boundary.cpp
Go to the documentation of this file.
1#include "boundary.hpp"
4
5namespace wmtk::simplex {
6
7std::vector<Tuple> boundary_tuples(const Mesh& m, const Tuple& t, PrimitiveType pt)
8{
9 std::vector<Tuple> ret;
10 constexpr static PrimitiveType PV = PrimitiveType::Vertex;
11 constexpr static PrimitiveType PE = PrimitiveType::Edge;
12 constexpr static PrimitiveType PF = PrimitiveType::Triangle;
14 switch (pt) {
16 // vertex does not have a boundary
17 } break;
19 ret = {t, m.switch_tuple(t, PV)};
20 } break;
22 ret = {
23 t, //
24 m.switch_tuples(t, {PE}),
25 m.switch_tuples(t, {PV, PE})};
26 } break;
28 ret = {
29 t, //
30 m.switch_tuples(t, {PF}), //
31 m.switch_tuples(t, {PE, PF}), //
32 m.switch_tuples(t, {PV, PE, PF})};
33 } break;
34 default: assert(false); break;
35 }
36 return ret;
37}
38
39std::vector<Tuple> boundary_tuples(const Mesh& mesh, const Simplex& simplex)
40{
41 return boundary_tuples(mesh, simplex.tuple(), simplex.primitive_type());
42}
43
44SimplexCollection boundary(const Mesh& mesh, const Simplex& simplex, const bool sort_and_clean)
45{
46 SimplexCollection collection(
47 mesh,
49 mesh,
50 boundary_tuples(mesh, simplex),
51
53
54 if (sort_and_clean) {
55 collection.sort_and_clean();
56 }
57
58 return collection;
59}
60} // namespace wmtk::simplex
Tuple switch_tuples(const Tuple &tuple, const ContainerType &op_sequence) const
Definition Mesh.hpp:951
virtual Tuple switch_tuple(const Tuple &tuple, PrimitiveType type) const =0
switch the orientation of the Tuple of the given dimension
The Tuple is the basic navigation tool in our mesh data structure.
Definition Tuple.hpp:19
void sort_and_clean()
Sort simplex vector and remove duplicates.
const Tuple & tuple() const
Definition Simplex.hpp:53
PrimitiveType primitive_type() const
Definition Simplex.hpp:51
constexpr wmtk::PrimitiveType PT
constexpr wmtk::PrimitiveType PF
std::vector< Simplex > tuple_vector_to_homogeneous_simplex_vector(const Mesh &m, const std::vector< Tuple > &tups, PrimitiveType primitive)
std::vector< Tuple > boundary_tuples(const Mesh &m, const Tuple &t, PrimitiveType pt)
Definition boundary.cpp:7
SimplexCollection boundary(const Mesh &mesh, const Simplex &simplex, const bool sort_and_clean)
Returns all boundary simplices of a simplex.
Definition boundary.cpp:44
constexpr PrimitiveType get_primitive_type_from_id(int8_t id)
Get the primitive type corresponding to its unique integer id.
constexpr PrimitiveType PE
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.
constexpr PrimitiveType PV