Wildmeshing Toolkit
Loading...
Searching...
No Matches
AccessorBase.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <type_traits>
6
7#include <Eigen/Dense>
8
9namespace wmtk {
11}
12namespace wmtk::attribute {
13
14template <typename T>
15class Attribute;
16template <typename T, typename MeshType, int Dim>
17class Accessor;
18template <typename T>
19class MeshAttributes;
20template <typename T>
22
23// The basic implementation of an accessor using indices.
24// This should never be externally used except within the main accessor
25// interface, in unit tests, or in topological updates
26template <typename _T, int Dim = Eigen::Dynamic>
28{
29public:
30 using T = _T;
31 friend class AccessorCache<T>;
33 template <typename U, typename MeshType, int D>
34 friend class Accessor;
36
37 template <int D = Dim>
39 template <int D = Dim>
41
42
43public:
44 // returns the size of the underlying attribute
45 int64_t reserved_size() const;
46 int64_t dimension() const;
47 const T& default_value() const;
48
49
50 void set_attribute(std::vector<T> value);
51
52 template <int D = Dim>
53 ConstMapResult<D> const_vector_attribute(const int64_t index) const;
54 template <int D = Dim>
55 MapResult<D> vector_attribute(const int64_t index);
56
57 T const_scalar_attribute(const int64_t index) const;
58 T& scalar_attribute(const int64_t index);
59
60 T const_scalar_attribute(const int64_t index, const int8_t offset) const;
61 T& scalar_attribute(const int64_t index, const int8_t offset);
62
64 const MeshAttributes<T>& attributes() const;
65
67 const Attribute<T>& attribute() const;
68
69
73
77
78 Mesh& mesh();
79 const Mesh& mesh() const;
80
81
82protected:
86
89};
90
91
92} // namespace wmtk::attribute
93#include "AccessorBase.hxx"
T const_scalar_attribute(const int64_t index) const
const T & default_value() const
MeshAttributes< T > & attributes()
TypedAttributeHandle< T > m_handle
const TypedAttributeHandle< T > & typed_handle() const
MeshAttributeHandle handle() const
internal::ConstMapResult< T, D > ConstMapResult
const AttributeManager & attribute_manager() const
PrimitiveType primitive_type() const
void set_attribute(std::vector< T > value)
MapResult< D > vector_attribute(const int64_t index)
T & scalar_attribute(const int64_t index)
ConstMapResult< D > const_vector_attribute(const int64_t index) const
internal::MapResult< T, D > MapResult
A CachingAccessor that uses tuples for accessing attributes instead of indices.
Definition Accessor.hpp:28
This class stores data of type T in a vector.
Definition Attribute.hpp:32
Contains all attributes of type T for a single mesh.
Handle that represents attributes for some mesh.
typename VectorResult< T, R >::MapType MapResult
the default map type used by attributes is a map of our vector type.
Definition MapTypes.hpp:21
typename VectorResult< T, R >::ConstMapType ConstMapResult
Definition MapTypes.hpp:23