Wildmeshing Toolkit
wmtk::attribute::MeshAttributes< T > Class Template Reference

Contains all attributes of type T for a single mesh. More...

#include <MeshAttributes.hpp>

Inheritance diagram for wmtk::attribute::MeshAttributes< T >:
[legend]
Collaboration diagram for wmtk::attribute::MeshAttributes< T >:
[legend]

Public Member Functions

 MeshAttributes ()=default
 
 MeshAttributes (const MeshAttributes &o)=delete
 
 MeshAttributes (MeshAttributes &&o)=default
 
MeshAttributesoperator= (const MeshAttributes &o)=delete
 
MeshAttributesoperator= (MeshAttributes &&o)=default
 
void serialize (const int dim, MeshWriter &writer) const
 
std::map< std::string, const wmtk::utils::Hashable * > child_hashables () const override
 
std::map< std::string, std::size_t > child_hashes () const override
 
AttributeHandle register_attribute (const std::string &name, int64_t dimension, bool replace=false, T default_value=T(0))
 
int64_t reserved_size () const
 
void reserve (const int64_t size)
 
void reserve_more (int64_t size)
 
void guarantee_at_least (int64_t size)
 
void remove_attributes (const std::vector< AttributeHandle > &attributes, bool invalidate_handles=true)
 Remove all passed in attributes. More...
 
void remove_attribute (const AttributeHandle &attribute)
 Remove a single attribute. More...
 
bool operator== (const MeshAttributes< T > &other) const
 
void push_scope ()
 
void pop_scope (bool apply_updates=true)
 
void rollback_current_scope ()
 
void change_to_parent_scope () const
 
void change_to_child_scope () const
 
int64_t dimension (const AttributeHandle &handle) const
 
const T & default_value (const AttributeHandle &handle) const
 
std::string get_name (const AttributeHandle &handle) const
 
void set_name (const AttributeHandle &handle, const std::string &name)
 
bool has_attribute (const std::string &name) const
 
size_t attribute_count () const
 
std::vector< AttributeHandleactive_attributes () const
 
void assert_capacity_valid (int64_t cap) const
 
Attribute< T > & attribute (const AttributeHandle &handle)
 
const Attribute< T > & attribute (const AttributeHandle &handle) const
 
AttributeHandle attribute_handle (const std::string &name) const
 
bool is_active (const AttributeHandle &handle) const
 
void set (const AttributeHandle &handle, std::vector< T > val)
 
- Public Member Functions inherited from wmtk::utils::MerkleTreeInteriorNode
std::map< std::string, std::size_t > child_hashes () const override
 
- Public Member Functions inherited from wmtk::utils::Hashable
 Hashable ()
 
 Hashable (const Hashable &)
 
 Hashable (Hashable &&)
 
Hashableoperator= (const Hashable &)
 
Hashableoperator= (Hashable &&)
 
virtual ~Hashable ()
 
virtual std::size_t hash () const
 

Protected Member Functions

void clear_dead_attributes ()
 Clears and compactifies the attribute list. This invalidates all existing handles. More...
 
size_t attribute_size (const AttributeHandle &handle) const
 

Private Types

typedef Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, 1 > > MapResult
 
typedef Eigen::Map< const Eigen::Matrix< T, Eigen::Dynamic, 1 > > ConstMapResult
 

Private Attributes

std::map< std::string, AttributeHandlem_handles
 
int64_t m_reserved_size = -1
 
std::vector< std::unique_ptr< Attribute< T > > > m_attributes
 

Friends

template<typename U , int D>
class AccessorBase
 

Detailed Description

template<typename T>
class wmtk::attribute::MeshAttributes< T >

Contains all attributes of type T for a single mesh.

It also stores a map so that attributes can be accessed through a name.

Definition at line 29 of file MeshAttributes.hpp.

Member Typedef Documentation

◆ ConstMapResult

template<typename T >
typedef Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, 1> > wmtk::attribute::MeshAttributes< T >::ConstMapResult
private

Definition at line 35 of file MeshAttributes.hpp.

◆ MapResult

template<typename T >
typedef Eigen::Map<Eigen::Matrix<T, Eigen::Dynamic, 1> > wmtk::attribute::MeshAttributes< T >::MapResult
private

Definition at line 34 of file MeshAttributes.hpp.

Constructor & Destructor Documentation

◆ MeshAttributes() [1/3]

template<typename T >
wmtk::attribute::MeshAttributes< T >::MeshAttributes ( )
default

◆ MeshAttributes() [2/3]

template<typename T >
wmtk::attribute::MeshAttributes< T >::MeshAttributes ( const MeshAttributes< T > &  o)
delete

◆ MeshAttributes() [3/3]

template<typename T >
wmtk::attribute::MeshAttributes< T >::MeshAttributes ( MeshAttributes< T > &&  o)
default

Member Function Documentation

◆ active_attributes()

template<typename T >
auto wmtk::attribute::MeshAttributes< T >::active_attributes

Definition at line 209 of file MeshAttributes.cpp.

◆ assert_capacity_valid()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::assert_capacity_valid ( int64_t  cap) const

Definition at line 137 of file MeshAttributes.cpp.

◆ attribute() [1/2]

template<typename T >
Attribute< T > & wmtk::attribute::MeshAttributes< T >::attribute ( const AttributeHandle handle)
inline

Definition at line 136 of file MeshAttributes.hpp.

References wmtk::attribute::AttributeHandle::index.

◆ attribute() [2/2]

template<typename T >
const Attribute< T > & wmtk::attribute::MeshAttributes< T >::attribute ( const AttributeHandle handle) const
inline

Definition at line 142 of file MeshAttributes.hpp.

References wmtk::attribute::AttributeHandle::index.

◆ attribute_count()

template<typename T >
size_t wmtk::attribute::MeshAttributes< T >::attribute_count

Definition at line 204 of file MeshAttributes.cpp.

◆ attribute_handle()

template<typename T >
AttributeHandle wmtk::attribute::MeshAttributes< T >::attribute_handle ( const std::string &  name) const

Definition at line 146 of file MeshAttributes.cpp.

◆ attribute_size()

template<typename T >
size_t wmtk::attribute::MeshAttributes< T >::attribute_size ( const AttributeHandle handle) const
protected

Definition at line 190 of file MeshAttributes.cpp.

References wmtk::attribute::AttributeHandle::index.

◆ change_to_child_scope()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::change_to_child_scope

Definition at line 96 of file MeshAttributes.cpp.

◆ change_to_parent_scope()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::change_to_parent_scope

Definition at line 84 of file MeshAttributes.cpp.

◆ child_hashables()

template<typename T >
std::map< std::string, const wmtk::utils::Hashable * > wmtk::attribute::MeshAttributes< T >::child_hashables
overridevirtual

Implements wmtk::utils::MerkleTreeInteriorNode.

Definition at line 45 of file MeshAttributes.cpp.

◆ child_hashes()

template<typename T >
std::map< std::string, std::size_t > wmtk::attribute::MeshAttributes< T >::child_hashes
overridevirtual

Reimplemented from wmtk::utils::Hashable.

Definition at line 33 of file MeshAttributes.cpp.

References wmtk::utils::MerkleTreeInteriorNode::child_hashes().

Here is the call graph for this function:

◆ clear_dead_attributes()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::clear_dead_attributes
protected

Clears and compactifies the attribute list. This invalidates all existing handles.

Definition at line 293 of file MeshAttributes.cpp.

◆ default_value()

template<typename T >
const T & wmtk::attribute::MeshAttributes< T >::default_value ( const AttributeHandle handle) const
inline

Definition at line 153 of file MeshAttributes.hpp.

◆ dimension()

template<typename T >
int64_t wmtk::attribute::MeshAttributes< T >::dimension ( const AttributeHandle handle) const
inline

Definition at line 148 of file MeshAttributes.hpp.

◆ get_name()

template<typename T >
std::string wmtk::attribute::MeshAttributes< T >::get_name ( const AttributeHandle handle) const

Definition at line 317 of file MeshAttributes.cpp.

◆ guarantee_at_least()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::guarantee_at_least ( int64_t  size)

Definition at line 247 of file MeshAttributes.cpp.

◆ has_attribute()

template<typename T >
bool wmtk::attribute::MeshAttributes< T >::has_attribute ( const std::string &  name) const

Definition at line 151 of file MeshAttributes.cpp.

◆ is_active()

template<typename T >
bool wmtk::attribute::MeshAttributes< T >::is_active ( const AttributeHandle handle) const

Definition at line 222 of file MeshAttributes.cpp.

References wmtk::attribute::AttributeHandle::index.

◆ operator=() [1/2]

template<typename T >
MeshAttributes& wmtk::attribute::MeshAttributes< T >::operator= ( const MeshAttributes< T > &  o)
delete

◆ operator=() [2/2]

template<typename T >
MeshAttributes& wmtk::attribute::MeshAttributes< T >::operator= ( MeshAttributes< T > &&  o)
default

◆ operator==()

template<typename T >
bool wmtk::attribute::MeshAttributes< T >::operator== ( const MeshAttributes< T > &  other) const

◆ pop_scope()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::pop_scope ( bool  apply_updates = true)

Definition at line 66 of file MeshAttributes.cpp.

◆ push_scope()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::push_scope

Definition at line 57 of file MeshAttributes.cpp.

◆ register_attribute()

template<typename T >
AttributeHandle wmtk::attribute::MeshAttributes< T >::register_attribute ( const std::string &  name,
int64_t  dimension,
bool  replace = false,
default_value = T(0) 
)

Definition at line 106 of file MeshAttributes.cpp.

References wmtk::attribute::AttributeHandle::index, wmtk::log_and_throw_error(), and wmtk::simplex::utils::make_unique().

Here is the call graph for this function:

◆ remove_attribute()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::remove_attribute ( const AttributeHandle attribute)

Remove a single attribute.

Parameters
attributethe attribute being deleted

Definition at line 287 of file MeshAttributes.cpp.

References wmtk::attribute::AttributeHandle::index.

◆ remove_attributes()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::remove_attributes ( const std::vector< AttributeHandle > &  attributes,
bool  invalidate_handles = true 
)

Remove all passed in attributes.

Parameters
attributesVector of attributes that should be removed.
invalidate_handlesinvalidates all handles. If true this garbage collects old handles

Definition at line 256 of file MeshAttributes.cpp.

◆ reserve()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::reserve ( const int64_t  size)

Definition at line 230 of file MeshAttributes.cpp.

◆ reserve_more()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::reserve_more ( int64_t  size)

Definition at line 241 of file MeshAttributes.cpp.

◆ reserved_size()

template<typename T >
int64_t wmtk::attribute::MeshAttributes< T >::reserved_size

Definition at line 198 of file MeshAttributes.cpp.

◆ rollback_current_scope()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::rollback_current_scope

Definition at line 75 of file MeshAttributes.cpp.

◆ serialize()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::serialize ( const int  dim,
MeshWriter writer 
) const

Definition at line 20 of file MeshAttributes.cpp.

◆ set()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::set ( const AttributeHandle handle,
std::vector< T >  val 
)

Definition at line 180 of file MeshAttributes.cpp.

References wmtk::attribute::AttributeHandle::index.

◆ set_name()

template<typename T >
void wmtk::attribute::MeshAttributes< T >::set_name ( const AttributeHandle handle,
const std::string &  name 
)

Definition at line 329 of file MeshAttributes.cpp.

References wmtk::attribute::AttributeHandle::index.

Friends And Related Function Documentation

◆ AccessorBase

template<typename T >
template<typename U , int D>
friend class AccessorBase
friend

Definition at line 32 of file MeshAttributes.hpp.

Member Data Documentation

◆ m_attributes

template<typename T >
std::vector<std::unique_ptr<Attribute<T> > > wmtk::attribute::MeshAttributes< T >::m_attributes
private

◆ m_handles

template<typename T >
std::map<std::string, AttributeHandle> wmtk::attribute::MeshAttributes< T >::m_handles
private

◆ m_reserved_size

template<typename T >
int64_t wmtk::attribute::MeshAttributes< T >::m_reserved_size = -1
private

Definition at line 131 of file MeshAttributes.hpp.


The documentation for this class was generated from the following files: