21 template <
typename T,
int Dim>
31 template <
typename U,
int D>
34 typedef Eigen::Map<Eigen::Matrix<T, Eigen::Dynamic, 1>>
MapResult;
35 typedef Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, 1>>
ConstMapResult;
48 std::map<std::string, const wmtk::utils::Hashable*>
child_hashables()
const override;
49 std::map<std::string, std::size_t>
child_hashes()
const override;
52 const std::string& name,
58 void reserve(
const int64_t size);
72 const std::vector<AttributeHandle>& attributes,
73 bool invalidate_handles =
true);
84 void pop_scope(
bool apply_updates =
true);
135 template <
typename T>
141 template <
typename T>
144 return *m_attributes.at(handle.
index);
147 template <
typename T>
150 return attribute(handle).dimension();
152 template <
typename T>
155 return attribute(handle).default_value();
Internal handle representation used by MeshAttributes.
This class stores data of type T in a vector.
Contains all attributes of type T for a single mesh.
std::map< std::string, std::size_t > child_hashes() const override
size_t attribute_size(const AttributeHandle &handle) const
void clear_dead_attributes()
Clears and compactifies the attribute list. This invalidates all existing handles.
Eigen::Map< const Eigen::Matrix< T, Eigen::Dynamic, 1 > > ConstMapResult
void change_to_child_scope() const
std::vector< std::unique_ptr< Attribute< T > > > m_attributes
void rollback_current_scope()
bool is_active(const AttributeHandle &handle) const
MeshAttributes(const MeshAttributes &o)=delete
int64_t reserved_size() const
void reserve_more(int64_t size)
void guarantee_at_least(int64_t size)
MeshAttributes & operator=(const MeshAttributes &o)=delete
void change_to_parent_scope() const
std::map< std::string, AttributeHandle > m_handles
std::map< std::string, const wmtk::utils::Hashable * > child_hashables() const override
int64_t dimension(const AttributeHandle &handle) const
void remove_attributes(const std::vector< AttributeHandle > &attributes, bool invalidate_handles=true)
Remove all passed in attributes.
MeshAttributes(MeshAttributes &&o)=default
bool operator==(const MeshAttributes< T > &other) const
size_t attribute_count() const
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, 1 > > MapResult
MeshAttributes & operator=(MeshAttributes &&o)=default
AttributeHandle attribute_handle(const std::string &name) const
std::vector< AttributeHandle > active_attributes() const
void remove_attribute(const AttributeHandle &attribute)
Remove a single attribute.
AttributeHandle register_attribute(const std::string &name, int64_t dimension, bool replace=false, T default_value=T(0))
void assert_capacity_valid(int64_t cap) const
void set(const AttributeHandle &handle, std::vector< T > val)
void reserve(const int64_t size)
void pop_scope(bool apply_updates=true)
Attribute< T > & attribute(const AttributeHandle &handle)
bool has_attribute(const std::string &name) const
void set_name(const AttributeHandle &handle, const std::string &name)
std::string get_name(const AttributeHandle &handle) const
void serialize(const int dim, MeshWriter &writer) const
const T & default_value(const AttributeHandle &handle) const