Wildmeshing Toolkit
simplicial_embedding.cpp
Go to the documentation of this file.
2 
3 #include <wmtk/Mesh.hpp>
5 #include <wmtk/io/Cache.hpp>
6 #include <wmtk/utils/Logger.hpp>
8 
10 
11 namespace wmtk::components {
12 
14 {
15  using namespace internal;
16 
17  std::vector<attribute::MeshAttributeHandle> tag_attr_vec;
18  for (const PrimitiveType& ptype : wmtk::utils::primitive_below(mesh.top_simplex_type())) {
19  tag_attr_vec.emplace_back(options.tag_attributes.at(ptype));
20  }
21 
22  SimplicialEmbedding rs(mesh, tag_attr_vec, options.value, options.pass_through_attributes);
24 
25  // clean up attributes
26  {
27  std::vector<attribute::MeshAttributeHandle> keeps = options.pass_through_attributes;
28  keeps.insert(keeps.end(), tag_attr_vec.begin(), tag_attr_vec.end());
29  mesh.clear_attributes(keeps);
30  }
31 
32  mesh.consolidate();
33 }
34 
35 } // namespace wmtk::components
void clear_attributes(const std::vector< attribute::MeshAttributeHandle::HandleVariant > &keep_attributes)
Remove all custom attributes besides the one passed in.
PrimitiveType top_simplex_type() const
Definition: Mesh.hpp:997
virtual std::tuple< std::vector< std::vector< int64_t > >, std::vector< std::vector< int64_t > > > consolidate()
Consolidate the attributes, moving all valid simplexes at the beginning of the corresponding vector.
void regularize_tags(bool generate_simplicial_embedding=true)
Regularize tags in mesh.
void simplicial_embedding(Mesh &mesh, const SimplicialEmbeddingOptions &options)
std::vector< PrimitiveType > primitive_below(PrimitiveType pt, bool lower_to_upper)
bool generate_simplicial_embedding
If false, this component forms a simplicial complex out of the tags, i.e., all faces of tagged simpli...
std::map< PrimitiveType, attribute::MeshAttributeHandle > tag_attributes
All simplex dimensions must have an int64_t scalar attribute where the tags are stored.
int64_t value
The value that should be simplicially embedded.
std::vector< attribute::MeshAttributeHandle > pass_through_attributes
Other attributes that should be processed with the default behavior.