Wildmeshing Toolkit
TypedAttributeHandle.cpp
Go to the documentation of this file.
1
#include <fmt/format.h>
2
#include <cassert>
3
#include <tuple>
4
#include <
wmtk/utils/Rational.hpp
>
5
#include "
MeshAttributeHandle.hpp
"
6
7
namespace
wmtk::attribute
{
8
9
template
<
typename
T>
10
TypedAttributeHandle<T>::operator
std::string()
const
11
{
12
return
fmt::format(
13
"{}:{}"
,
14
m_base_handle.index,
15
wmtk::primitive_type_name
(m_primitive_type)
16
17
);
18
}
19
20
template
<
typename
T>
21
bool
TypedAttributeHandle<T>::operator<
(
const
TypedAttributeHandle<T>
& o)
const
22
{
23
return
std::tie(m_base_handle, m_primitive_type) <
24
std::tie(o.
m_base_handle
, o.
m_primitive_type
);
25
}
26
template
<
typename
T>
27
TypedAttributeHandle<T>::TypedAttributeHandle
(
const
MeshAttributeHandle
& h)
28
:
TypedAttributeHandle
(h.as<T>())
29
{
30
assert(h.
holds
<T>());
31
}
32
33
template
class
TypedAttributeHandle<double>
;
34
template
class
TypedAttributeHandle<int64_t>
;
35
template
class
TypedAttributeHandle<Rational>
;
36
template
class
TypedAttributeHandle<char>
;
37
}
// namespace wmtk::attribute
MeshAttributeHandle.hpp
Rational.hpp
wmtk::attribute::MeshAttributeHandle
Definition:
MeshAttributeHandle.hpp:26
wmtk::attribute::MeshAttributeHandle::holds
bool holds() const
Definition:
MeshAttributeHandle.hpp:168
wmtk::attribute::TypedAttributeHandle
Handle that represents attributes for some mesh.
Definition:
TypedAttributeHandle.hpp:28
wmtk::attribute::TypedAttributeHandle::operator<
bool operator<(const TypedAttributeHandle< T > &o) const
Definition:
TypedAttributeHandle.cpp:21
wmtk::attribute::TypedAttributeHandle::TypedAttributeHandle
TypedAttributeHandle()=default
wmtk::attribute::TypedAttributeHandle::m_base_handle
wmtk::attribute::AttributeHandle m_base_handle
Definition:
TypedAttributeHandle.hpp:41
wmtk::attribute::TypedAttributeHandle::m_primitive_type
wmtk::PrimitiveType m_primitive_type
Definition:
TypedAttributeHandle.hpp:42
wmtk::attribute
Definition:
Accessor.hpp:17
wmtk::primitive_type_name
std::string_view primitive_type_name(PrimitiveType t)
Definition:
PrimitiveType.cpp:41
src
wmtk
attribute
TypedAttributeHandle.cpp
Generated by
1.9.1