Wildmeshing Toolkit
Loading...
Searching...
No Matches
MeshAttributeHandle.cpp
Go to the documentation of this file.
2#include <cassert>
3#include <wmtk/Mesh.hpp>
5
6namespace wmtk::attribute {
8 : m_mesh(&m)
9 , m_handle(h)
10{}
11
13{
14 assert(m_mesh != nullptr);
15 return m_mesh == &m;
16}
17
19{
20 assert(m_mesh != nullptr);
21 return *m_mesh;
22}
24{
25 assert(m_mesh != nullptr);
26 return *m_mesh;
27}
29{
30 return std::visit(
31 [](const auto& h) -> HeldType {
32 using T = std::decay_t<decltype(h)>;
33 return held_type_from_handle<T>();
34 },
35 m_handle);
36}
37
39{
40 return m_mesh != nullptr &&
41 std::visit([](const auto& h) -> bool { return h.is_valid(); }, m_handle);
42}
43
45{
46 return std::visit(
47 [&](auto&& h) -> int64_t { return mesh().get_attribute_dimension(h); },
48 m_handle);
49}
50
51std::string MeshAttributeHandle::name() const
52{
53 return std::visit([&](auto&& h) { return mesh().get_attribute_name(h); }, m_handle);
54}
55
56
57// AttributeHandle MeshAttributeHandle::base_handle() const
58//{
59// return std::visit([](const auto& h) { return h.m_base_handle; }, m_handle);
60// }
61} // namespace wmtk::attribute
int64_t get_attribute_dimension(const TypedAttributeHandle< T > &handle) const
Definition Mesh.hpp:929
std::string get_attribute_name(const TypedAttributeHandle< T > &handle) const
Definition Mesh.hpp:935
std::variant< TypedAttributeHandle< char >, TypedAttributeHandle< int64_t >, TypedAttributeHandle< double >, TypedAttributeHandle< wmtk::Rational > > HandleVariant