Wildmeshing Toolkit
TupleTag.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <set>
3 #include <wmtk/Mesh.hpp>
4 #include <wmtk/Tuple.hpp>
16 class TupleTag
17 {
18 public:
19  TupleTag(Mesh& mesh, const std::set<int64_t>& critical_points);
20  const Mesh& mesh() const { return m_mesh; }
21  Mesh& mesh() { return m_mesh; }
26  void initialize();
27  std::set<int64_t> run();
36  bool is_critical_vertex(const Tuple& v) const;
37 
38  bool vertex_is_root(const Tuple& v) const;
39  int64_t vertex_get_root(const Tuple& v) const;
40  void vertex_set_root(const Tuple& v, int64_t root);
41 
48  void vertex_sets_unify(const Tuple& v1, const Tuple& v2);
56  void run(const Tuple& e);
57 
58  int64_t get_vertex_tag(const Tuple& tuple) const;
59  int64_t get_edge_tag(const Tuple& tuple) const;
60  void set_vertex_tag(const Tuple& tuple, int64_t tag);
61  void set_edge_tag(const Tuple& tuple, int64_t tag);
62  int64_t vid(const Tuple& tuple) const;
63  Tuple v_tuple(int64_t vid) const;
64 
66  std::set<int64_t> m_critical_points;
69 
70 
71  // this is shoved in this class to reduce the number of times we have to friend mesh - this is
72  // called by wmtk::multimesh::utils::extract_child_mesh_from_tag
73  template <typename T>
74  static std::shared_ptr<Mesh> extract_and_register_child_mesh_from_tag_handle(
75  Mesh& m,
77  const T& tag_value, bool child_is_free);
78 };
79 } // namespace wmtk::multimesh::utils::internal
Handle that represents attributes for some mesh.
TupleTag is a util helper class for tagging edges in a triangle mesh.
Definition: TupleTag.hpp:17
wmtk::attribute::Accessor< int64_t > m_vertex_tag_acc
Definition: TupleTag.hpp:67
int64_t get_edge_tag(const Tuple &tuple) const
Definition: TupleTag.cpp:87
bool vertex_is_root(const Tuple &v) const
Definition: TupleTag.cpp:113
void set_edge_tag(const Tuple &tuple, int64_t tag)
Definition: TupleTag.cpp:97
bool is_critical_vertex(const Tuple &v) const
Check if a vertex is a critical point.
Definition: TupleTag.cpp:78
void vertex_set_root(const Tuple &v, int64_t root)
Definition: TupleTag.cpp:129
wmtk::attribute::Accessor< int64_t > m_edge_tag_acc
Definition: TupleTag.hpp:68
void set_vertex_tag(const Tuple &tuple, int64_t tag)
Definition: TupleTag.cpp:92
void vertex_sets_unify(const Tuple &v1, const Tuple &v2)
Given two vertex tuple, join the sets that contain them.
Definition: TupleTag.cpp:140
TupleTag(Mesh &mesh, const std::set< int64_t > &critical_points)
Definition: TupleTag.cpp:5
int64_t vertex_get_root(const Tuple &v) const
Definition: TupleTag.cpp:119
void initialize()
Go through edges of the parent mesh (triangle mesh) and initialize all the vertex tags to be -1.
Definition: TupleTag.cpp:16
int64_t vid(const Tuple &tuple) const
Definition: TupleTag.cpp:102
static std::shared_ptr< Mesh > extract_and_register_child_mesh_from_tag_handle(Mesh &m, const wmtk::attribute::TypedAttributeHandle< T > &tag_handle, const T &tag_value, bool child_is_free)
int64_t get_vertex_tag(const Tuple &tuple) const
Definition: TupleTag.cpp:83