Wildmeshing Toolkit
Loading...
Searching...
No Matches
CachingAccessor.hxx
Go to the documentation of this file.
1#pragma once
2
4#include "AttributeScope.hpp"
6#include "CachingAccessor.hpp"
7
8namespace wmtk::attribute {
9
10template <typename T, int Dim>
12 Mesh& mesh_in,
13 const TypedAttributeHandle<T>& handle)
14 : BaseType(mesh_in, handle)
15 , m_cache_stack(attribute().get_local_scope_stack())
16{}
17template <typename T, int Dim>
19 : BaseType(mesh_in, handle)
20 , m_cache_stack(attribute().get_local_scope_stack())
21{}
22
23template <typename T, int Dim>
25
26template <typename T, int Dim>
28{
29 return !m_cache_stack.empty();
30}
31
32template <typename T, int Dim>
34{
35 return m_cache_stack.writing_enabled();
38template <typename T, int Dim>
40{
41 return m_cache_stack.size();
42}
43
44template <typename T, int Dim>
45template <int D>
47{
48 return m_cache_stack.template vector_attribute<D>(*this, index);
49 // return BaseType::template vector_attribute<D>( index);
50}
51
52
53template <typename T, int Dim>
54inline auto CachingAccessor<T, Dim>::scalar_attribute(const int64_t index) -> T&
55{
56 return m_cache_stack.scalar_attribute(*this, index);
57}
58
59template <typename T, int Dim>
60template <int D>
61inline auto CachingAccessor<T, Dim>::const_vector_attribute(const int64_t index) const
63{
64 return m_cache_stack.template const_vector_attribute<D>(*this, index);
65}
66
68template <typename T, int Dim>
69inline auto CachingAccessor<T, Dim>::const_scalar_attribute(const int64_t index) const -> T
70{
71 return m_cache_stack.const_scalar_attribute(*this, index);
72}
74template <typename T, int Dim>
75inline auto CachingAccessor<T, Dim>::vector_attribute(const int64_t index) const -> ConstMapResult<>
76{
77 return const_vector_attribute(index);
79template <typename T, int Dim>
80inline T CachingAccessor<T, Dim>::scalar_attribute(const int64_t index) const
81{
82 return const_scalar_attribute(index);
83}
84
85template <typename T, int Dim>
86inline auto CachingAccessor<T, Dim>::scalar_attribute(const int64_t index, int8_t offset) -> T&
87{
88 return m_cache_stack.scalar_attribute(*this, index, offset);
89}
90
91
92template <typename T, int Dim>
93inline auto CachingAccessor<T, Dim>::const_scalar_attribute(const int64_t index, int8_t offset)
94 const -> T
95{
96 return m_cache_stack.const_scalar_attribute(*this, index, offset);
97}
98
99// template class CachingAccessor<char>;
100// template class CachingAccessor<int64_t>;
101// template class CachingAccessor<double>;
102// template class CachingAccessor<Rational>;
103} // namespace wmtk::attribute
typename BaseType::template MapResult< D > MapResult
typename BaseType::template ConstMapResult< D > ConstMapResult
T const_scalar_attribute(const int64_t index) const
T & scalar_attribute(const int64_t index)
CachingAccessor(Mesh &m, const TypedAttributeHandle< T > &handle)
ConstMapResult< D > const_vector_attribute(const int64_t index) const
MapResult< D > vector_attribute(const int64_t index)
Handle that represents attributes for some mesh.