14 void link_vertex_vertex(
16 const simplex::Simplex& simplex,
17 std::vector<Simplex>& collection)
23 assert(mesh.is_valid(simplex.tuple()));
24 const Tuple t_in = simplex.tuple();
28 const Tuple t_collect = mesh.switch_tuples(t, {
PV,
PE});
29 collection.emplace_back(simplex::Simplex(mesh,
PV, t_collect));
31 if (mesh.is_boundary_edge(t)) {
34 t = mesh.switch_tuples(t, {
PF,
PE});
38 if (t == t_in && !mesh.is_boundary_edge(t)) {
42 t = mesh.switch_edge(t_in);
44 collection.emplace_back(simplex::Simplex(mesh,
PV, mesh.switch_tuple(t,
PV)));
45 if (mesh.is_boundary_edge(t)) {
48 t = mesh.switch_tuples(t, {
PF,
PE});
51 const Tuple t_collect = mesh.switch_tuples(t, {
PV,
PE});
52 collection.emplace_back(simplex::Simplex(mesh,
PV, t_collect));
54 if (mesh.is_boundary_edge(t)) {
57 t = mesh.switch_tuples(t, {
PF,
PE});
61 void link_vertex_edge(
63 const simplex::Simplex& simplex,
64 std::vector<Simplex>& collection)
70 assert(mesh.is_valid(simplex.tuple()));
71 const Tuple t_in = simplex.tuple();
75 const Tuple t_collect = mesh.switch_tuples(t, {
PV,
PE});
76 collection.emplace_back(simplex::Simplex(mesh,
PE, t_collect));
78 if (mesh.is_boundary_edge(t)) {
81 t = mesh.switch_tuples(t, {
PF,
PE});
85 if (t == t_in && !mesh.is_boundary_edge(t)) {
89 t = mesh.switch_edge(t_in);
91 if (mesh.is_boundary_edge(t)) {
94 t = mesh.switch_tuples(t, {
PF,
PE});
97 const Tuple t_collect = mesh.switch_tuples(t, {
PV,
PE});
98 collection.emplace_back(simplex::Simplex(mesh,
PE, t_collect));
100 if (mesh.is_boundary_edge(t)) {
103 t = mesh.switch_tuples(t, {
PF,
PE});
109 const simplex::Simplex& simplex,
110 std::vector<Simplex>& collection)
115 const Tuple& t = simplex.tuple();
117 collection.emplace_back(simplex::Simplex(mesh,
PV, mesh.switch_tuples(t, {PE, PV})));
118 if (!mesh.is_boundary_edge(t)) {
119 collection.emplace_back(simplex::Simplex(mesh,
PV, mesh.switch_tuples(t, {PF, PE, PV})));
128 const bool sort_and_clean)
133 static_cast<const TriMesh&
>(mesh),
139 static_cast<const TetMesh&
>(mesh),
153 const bool sort_and_clean)
155 std::vector<Simplex> link_simplices;
159 link_vertex_vertex(mesh, simplex, link_simplices);
161 link_vertex_edge(mesh, simplex, link_simplices);
166 link_edge(mesh, simplex, link_simplices);
176 if (sort_and_clean) {
187 const bool sort_and_clean)
197 std::vector<Simplex> all_cofaces;
201 all_cofaces.reserve(cell_tuples.size() * 3);
202 for (
Tuple t : cell_tuples) {
211 all_cofaces.reserve(cell_tuples.size() * 3);
212 for (
Tuple t : cell_tuples) {
222 all_cofaces.reserve(cell_tuples.size());
223 for (
Tuple t : cell_tuples) {
231 all_cofaces.reserve(cell_tuples.size() * 2);
232 for (
Tuple t : cell_tuples) {
239 all_cofaces.reserve(cell_tuples.size());
240 for (
Tuple t : cell_tuples) {
248 all_cofaces.reserve(cell_tuples.size());
249 for (
Tuple t : cell_tuples) {
261 if (sort_and_clean) {
272 const bool sort_and_clean)
279 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_single_dimension(const Mesh &mesh, const simplex::Simplex &simplex, const PrimitiveType link_type, const bool sort_and_clean)
SimplexCollection link_single_dimension_slow(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