19 const simplex::Simplex& simplex,
20 std::vector<Simplex>& collection)
26 assert(mesh.is_valid(simplex.tuple()));
27 const Tuple t_in = simplex.tuple();
31 const Tuple t_collect = mesh.switch_tuples(t, {
PV,
PE});
32 collection.emplace_back(simplex::Simplex(mesh,
PV, t_collect));
33 collection.emplace_back(simplex::Simplex(mesh,
PE, t_collect));
35 if (mesh.is_boundary_edge(t)) {
38 t = mesh.switch_tuples(t, {
PF,
PE});
42 if (t == t_in && !mesh.is_boundary_edge(t)) {
46 t = mesh.switch_edge(t_in);
48 collection.emplace_back(simplex::Simplex(mesh,
PV, mesh.switch_tuple(t,
PV)));
49 if (mesh.is_boundary_edge(t)) {
52 t = mesh.switch_tuples(t, {
PF,
PE});
55 const Tuple t_collect = mesh.switch_tuples(t, {
PV,
PE});
56 collection.emplace_back(simplex::Simplex(mesh,
PV, t_collect));
57 collection.emplace_back(simplex::Simplex(mesh,
PE, t_collect));
59 if (mesh.is_boundary_edge(t)) {
62 t = mesh.switch_tuples(t, {
PF,
PE});
88 return link(
static_cast<const TriMesh&
>(mesh), simplex, sort_and_clean);
90 return link(
static_cast<const TetMesh&
>(mesh), simplex, sort_and_clean);
93 default:
return link_slow(mesh, simplex, sort_and_clean);
break;
104 std::vector<Simplex> link_simplices;
105 link_vertex(mesh, simplex, link_simplices);
107 if (sort_and_clean) {
134 std::vector<Simplex> all_cofaces;
137 all_cofaces.reserve(cell_tuples.size() * 7);
138 for (
Tuple t : cell_tuples) {
154 all_cofaces.reserve(cell_tuples.size() * 3);
155 for (
Tuple t : cell_tuples) {
164 all_cofaces.reserve(cell_tuples.size() * 7);
165 for (
Tuple t : cell_tuples) {
177 if (sort_and_clean) {
192 simplex_w_bd.
add(simplex);
Tuple switch_tuples(const Tuple &tuple, const ContainerType &op_sequence) const
Performs a sequence of switch_tuple operations in the order specified in op_sequence.
PrimitiveType top_simplex_type() const
Tuple switch_vertex(const Tuple &tuple) const
void add(const Simplex &simplex)
Add simplex to the collection.
const std::vector< Simplex > & simplex_vector() const
Return const reference to the simplex vector.
static SimplexCollection get_intersection(const SimplexCollection &collection_a, const SimplexCollection &collection_b)
Get intersection of two simplex collections.
void sort_and_clean()
Sort simplex vector and remove duplicates.
static Simplex face(const Mesh &m, const Tuple &t)
static Simplex edge(const Mesh &m, const Tuple &t)
static Simplex vertex(const Mesh &m, const Tuple &t)
PrimitiveType primitive_type() const
constexpr wmtk::PrimitiveType PT
constexpr wmtk::PrimitiveType PF
void top_dimension_cofaces_tuples(const PointMesh &mesh, const Simplex &simplex, SimplexCollection &collection)
SimplexCollection closed_star(const Mesh &mesh, const Simplex &simplex, const bool sort_and_clean)
The closed star contains the input simplex, all its top dimension cofaces, and their faces.
SimplexCollection link(const Mesh &mesh, const simplex::Simplex &simplex, const bool sort_and_clean)
SimplexCollection link_slow(const Mesh &mesh, const simplex::Simplex &simplex, const bool sort_and_clean)
SimplexCollection link_single_dimension(const Mesh &mesh, const simplex::Simplex &simplex, const PrimitiveType link_type, const bool sort_and_clean)
SimplexCollection faces(const Mesh &mesh, const Simplex &simplex, const bool sort_and_clean)
Returns all faces of a simplex.
void log_and_throw_error(const std::string &msg)
constexpr PrimitiveType PV
constexpr PrimitiveType PE