23 const std::vector<Tuple>& tuples,
28 for (
const Tuple& t : tuples) {
31 r.insert(r.end(), tups.begin(), tups.end());
35 std::sort(r.begin(), r.end(), [&](
const Tuple& a,
const Tuple& b) ->
bool {
36 return utils::SimplexComparisons::less(mesh, boundary_pt, a, b);
38 auto last = std::unique(r.begin(), r.end(), [&](
const Tuple& a,
const Tuple& b) ->
bool {
39 return utils::SimplexComparisons::equal(mesh, boundary_pt, a, b);
41 r.erase(last, r.end());
47 std::vector<Tuple> cofaces_single_dimension_vertex(
49 const Simplex& my_simplex,
53 return {my_simplex.tuple()};
64 std::vector<Tuple> tuples;
67 assert(mesh.is_valid(my_simplex.tuple()));
68 const Tuple t_in = my_simplex.tuple();
72 tuples.emplace_back(t);
74 if (mesh.is_boundary_edge(t)) {
77 t = mesh.switch_tuples(t, {
PF,
PE});
81 if (t == t_in && !mesh.is_boundary_edge(t)) {
85 t = mesh.switch_edge(t_in);
87 tuples.emplace_back(t);
88 if (mesh.is_boundary_edge(t)) {
91 t = mesh.switch_tuples(t, {
PF,
PE});
94 tuples.emplace_back(t);
96 if (mesh.is_boundary_edge(t)) {
99 t = mesh.switch_tuples(t, {
PF,
PE});
105 std::vector<Tuple> cofaces_single_dimension_edge(
107 const Simplex& my_simplex,
111 return {my_simplex.tuple()};
118 std::vector<Tuple> cofaces_single_dimension_face(
120 const Simplex& my_simplex,
124 return {my_simplex.tuple()};
135 std::vector<Tuple> tuples;
137 tuples = {my_simplex.
tuple()};
147 for (
const auto& pt : range) {
174 if (sort_and_clean) {
190 if (sort_and_clean) {
204 return cofaces_single_dimension_vertex(mesh, my_simplex, cofaces_type);
205 case PrimitiveType::Edge:
return cofaces_single_dimension_edge(mesh, my_simplex, cofaces_type);
207 return cofaces_single_dimension_face(mesh, my_simplex, cofaces_type);
PrimitiveType top_simplex_type() const
void sort_and_clean()
Sort simplex vector and remove duplicates.
const Tuple & tuple() const
PrimitiveType primitive_type() const
constexpr wmtk::PrimitiveType PF
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)
void top_dimension_cofaces_tuples(const PointMesh &mesh, const Simplex &simplex, SimplexCollection &collection)
SimplexCollection cofaces_single_dimension(const Mesh &mesh, const Simplex &my_simplex, PrimitiveType cofaces_type, bool sort_and_clean)
Returns all cofaces of a simplex that are of the provided primitive type.
std::vector< Simplex > cofaces_single_dimension_simplices(const Mesh &mesh, const Simplex &simplex, PrimitiveType cofaces_type)
std::vector< Tuple > cofaces_single_dimension_tuples(const Mesh &mesh, const Simplex &my_simplex, PrimitiveType cofaces_type)
std::vector< PrimitiveType > primitive_range(PrimitiveType pt0, PrimitiveType pt1)
constexpr PrimitiveType get_primitive_type_from_id(int8_t id)
Get the primitive type corresponding to its unique integer id.
void log_and_throw_error(const std::string &msg)
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