Wildmeshing Toolkit
k_ring.cpp
Go to the documentation of this file.
1 #include "k_ring.hpp"
2 
3 #include "link.hpp"
4 
5 namespace wmtk::simplex {
6 SimplexCollection k_ring(const Mesh& mesh, const Simplex& simplex, int64_t k)
7 {
8  if (k < 1) return SimplexCollection(mesh);
9 
10 
11  SimplexCollection sc = link(mesh, simplex);
12 
13  for (int64_t i = 2; i <= k; ++i) {
14  const auto simplices = sc.simplex_vector();
15  for (const Simplex& s : simplices) {
16  SimplexCollection sc_or = link(mesh, s);
17  sc.add(sc_or);
18  }
19 
20  sc.sort_and_clean();
21  }
22 
23  return sc;
24 }
25 } // namespace wmtk::simplex
void add(const Simplex &simplex)
Add simplex to the collection.
const std::vector< Simplex > & simplex_vector() const
Return const reference to the simplex vector.
void sort_and_clean()
Sort simplex vector and remove duplicates.
SimplexCollection link(const Mesh &mesh, const simplex::Simplex &simplex, const bool sort_and_clean)
Definition: link.cpp:84
SimplexCollection k_ring(const Mesh &mesh, const Simplex &simplex, int64_t k)
Definition: k_ring.cpp:6