Wildmeshing Toolkit
|
This class stores data of type T in a vector. More...
#include <Attribute.hpp>
Public Types | |
template<int D = Eigen::Dynamic> | |
using | MapResult = internal::MapResult< T, D > |
template<int D = Eigen::Dynamic> | |
using | ConstMapResult = internal::ConstMapResult< T, D > |
Public Member Functions | |
std::map< std::string, size_t > | child_hashes () const override |
void | serialize (const std::string &name, const int dim, MeshWriter &writer) const |
Attribute (const std::string &name, int64_t dimension, T default_value=T(0), int64_t size=0) | |
Initialize the attribute. More... | |
Attribute (Attribute &&o) | |
~Attribute () | |
Attribute & | operator= (Attribute &&o) |
template<int D = Eigen::Dynamic> | |
ConstMapResult< D > | const_vector_attribute (const int64_t index) const |
template<int D = Eigen::Dynamic> | |
MapResult< D > | vector_attribute (const int64_t index) |
template<int D = Eigen::Dynamic> | |
MapResult< D > | vector_attribute2 (const int64_t index) |
T | const_scalar_attribute (const int64_t index) const |
T & | scalar_attribute (const int64_t index) |
T | const_scalar_attribute (const int64_t index, const int8_t offset) const |
T & | scalar_attribute (const int64_t index, const int8_t offset) |
void | set (std::vector< T > val) |
Replace the internal data with val . More... | |
int64_t | reserved_size () const |
The total number of elements in a vector. More... | |
int64_t | dimension () const |
The number of values for each index. More... | |
void | reserve (const int64_t size) |
const T & | default_value () const |
returns the default value of this attribute More... | |
bool | operator== (const Attribute< T > &o) const |
void | push_scope () |
void | pop_scope (bool apply_updates) |
void | rollback_current_scope () |
const internal::AttributeTransactionStack< T > & | get_local_scope_stack () const |
internal::AttributeTransactionStack< T > & | get_local_scope_stack () |
void | consolidate (const std::vector< int64_t > &new2old) |
Consolidate the vector, using the new2old map m provided and resizing the vector to m.size() More... | |
void | index_remap (const std::vector< T > &old2new) |
Applies the scalar old2new map to the indices in the attribute This is commonly used after a consolidate to account for the change in global indices. More... | |
void | index_remap (const std::vector< T > &old2new, const std::vector< Eigen::Index > &cols) |
template<int D = Eigen::Dynamic> | |
ConstMapResult< D > | const_vector_attribute (const int64_t index, const std::vector< T > &data) const |
Accesses the attribute using the specified vector as the underlying data This is internally used by the single-arg const_vector_attribute and to help with serialization. More... | |
template<int D = Eigen::Dynamic> | |
ConstMapResult< D > | const_vector_attribute_from_start (const int64_t index, const std::vector< T > &data) const |
Accesses the attribute using the specified vector as the underlying data This is internally used by the single-arg const_vector_attribute and to help with serialization. More... | |
template<int D = Eigen::Dynamic> | |
MapResult< D > | vector_attribute (const int64_t index, std::vector< T > &data) const |
Accesses the attribute using the specified vector as the underlying data This is internally used by the single-arg vector_attribute and to help with serialization. More... | |
template<int D = Eigen::Dynamic> | |
MapResult< D > | vector_attribute_from_start (const int64_t index, std::vector< T > &data) const |
Accesses the attribute using the specified vector as the underlying data This is internally used by the single-arg const_vector_attribute and to help with serialization. More... | |
T | const_scalar_attribute (const int64_t index, const std::vector< T > &data) const |
Accesses the attribute using the specified scalar as the underlying data This is internally used by the single-arg const_scalar_attribute and to help with serialization. More... | |
T & | scalar_attribute (const int64_t index, std::vector< T > &data) const |
Accesses the attribute using the specified scalar as the underlying data This is internally used by the single-arg scalar_attribute and to help with serialization. More... | |
T | const_scalar_attribute (const int64_t index, const int8_t offset, const std::vector< T > &data) const |
Accesses the attribute using the specified scalar as the underlying data This is internally used by the single-arg const_scalar_attribute and to help with serialization. More... | |
T & | scalar_attribute (const int64_t index, const int8_t offset, std::vector< T > &data) const |
Accesses the attribute using the specified scalar as the underlying data This is internally used by the single-arg scalar_attribute and to help with serialization. More... | |
int64_t | reserved_size (const std::vector< T > &data) const |
template<int D> | |
auto | const_vector_attribute (const int64_t index) const -> ConstMapResult< D > |
template<int D> | |
auto | const_vector_attribute (const int64_t index, const std::vector< T > &data) const -> ConstMapResult< D > |
template<int D> | |
auto | const_vector_attribute_from_start (const int64_t start, const std::vector< T > &data) const -> ConstMapResult< D > |
template<int D> | |
auto | vector_attribute (const int64_t index) -> MapResult< D > |
template<int D> | |
auto | vector_attribute2 (const int64_t index) -> MapResult< D > |
template<int D> | |
auto | vector_attribute (const int64_t index, std::vector< T > &data) const -> MapResult< D > |
template<int D> | |
auto | vector_attribute_from_start (const int64_t start, std::vector< T > &data) const -> MapResult< D > |
Public Member Functions inherited from wmtk::utils::Hashable | |
Hashable () | |
Hashable (const Hashable &) | |
Hashable (Hashable &&) | |
Hashable & | operator= (const Hashable &) |
Hashable & | operator= (Hashable &&) |
virtual | ~Hashable () |
virtual std::size_t | hash () const |
Public Attributes | |
std::string | m_name |
Private Attributes | |
std::vector< T > | m_data |
PerThreadAttributeScopeStacks< T > | m_scope_stacks |
int64_t | m_dimension = -1 |
T | m_default_value = T(0) |
Friends | |
template<typename U , int D> | |
class | AccessorBase |
class | internal::AttributeTransactionStack< T > |
This class stores data of type T in a vector.
If multiple values should be hold per index, the data will be automatically linearized. For example, per index we have a 3-dimensional vector. Then the data vector will contain: [x0,y0,z0,x1,y1,z1,...]
Definition at line 31 of file Attribute.hpp.
using wmtk::attribute::Attribute< T >::ConstMapResult = internal::ConstMapResult<T, D> |
Definition at line 37 of file Attribute.hpp.
using wmtk::attribute::Attribute< T >::MapResult = internal::MapResult<T, D> |
Definition at line 35 of file Attribute.hpp.
wmtk::attribute::Attribute< T >::Attribute | ( | const std::string & | name, |
int64_t | dimension, | ||
T | default_value = T(0) , |
||
int64_t | size = 0 |
||
) |
Initialize the attribute.
dimension | The dimension of the attribute, e.g. 3 for a 3d vector. |
default_value | A default value that is applied to every entry, also to new ones that are added later. |
size | The number of expected indices. If size < 0 then the internal data is not initialized. |
Definition at line 20 of file Attribute.cpp.
|
default |
|
default |
|
overridevirtual |
Reimplemented from wmtk::utils::Hashable.
Definition at line 36 of file Attribute.cpp.
References wmtk::utils::vector_hash().
void wmtk::attribute::Attribute< T >::consolidate | ( | const std::vector< int64_t > & | new2old | ) |
Consolidate the vector, using the new2old map m provided and resizing the vector to m.size()
Definition at line 91 of file Attribute.cpp.
|
inline |
Definition at line 269 of file Attribute.hpp.
|
inline |
Definition at line 295 of file Attribute.hpp.
|
inline |
Accesses the attribute using the specified scalar as the underlying data This is internally used by the single-arg const_scalar_attribute and to help with serialization.
Definition at line 300 of file Attribute.hpp.
|
inline |
Accesses the attribute using the specified scalar as the underlying data This is internally used by the single-arg const_scalar_attribute and to help with serialization.
Definition at line 274 of file Attribute.hpp.
ConstMapResult<D> wmtk::attribute::Attribute< T >::const_vector_attribute | ( | const int64_t | index | ) | const |
|
inline |
Definition at line 192 of file Attribute.hpp.
ConstMapResult<D> wmtk::attribute::Attribute< T >::const_vector_attribute | ( | const int64_t | index, |
const std::vector< T > & | data | ||
) | const |
Accesses the attribute using the specified vector as the underlying data This is internally used by the single-arg const_vector_attribute and to help with serialization.
|
inline |
Definition at line 199 of file Attribute.hpp.
ConstMapResult<D> wmtk::attribute::Attribute< T >::const_vector_attribute_from_start | ( | const int64_t | index, |
const std::vector< T > & | data | ||
) | const |
Accesses the attribute using the specified vector as the underlying data This is internally used by the single-arg const_vector_attribute and to help with serialization.
Start allows for assignment to buffers that dont' represent a 2d array
Referenced by wmtk::attribute::internal::AttributeFlatCache< T >::apply_to(), and wmtk::attribute::internal::AttributeTransactionStack< T >::apply_to().
|
inline |
Definition at line 209 of file Attribute.hpp.
|
inline |
returns the default value of this attribute
Definition at line 332 of file Attribute.hpp.
|
inline |
The number of values for each index.
Definition at line 326 of file Attribute.hpp.
|
inline |
Definition at line 343 of file Attribute.hpp.
|
inline |
Definition at line 338 of file Attribute.hpp.
void wmtk::attribute::Attribute< T >::index_remap | ( | const std::vector< T > & | old2new | ) |
Applies the scalar old2new map to the indices in the attribute This is commonly used after a consolidate to account for the change in global indices.
Definition at line 105 of file Attribute.cpp.
void wmtk::attribute::Attribute< T >::index_remap | ( | const std::vector< T > & | old2new, |
const std::vector< Eigen::Index > & | cols | ||
) |
Definition at line 113 of file Attribute.cpp.
|
default |
bool wmtk::attribute::Attribute< T >::operator== | ( | const Attribute< T > & | o | ) | const |
Definition at line 58 of file Attribute.cpp.
References wmtk::attribute::Attribute< T >::m_data, wmtk::attribute::Attribute< T >::m_default_value, wmtk::attribute::Attribute< T >::m_dimension, and wmtk::attribute::Attribute< T >::m_name.
|
inline |
Definition at line 354 of file Attribute.hpp.
|
inline |
Definition at line 349 of file Attribute.hpp.
void wmtk::attribute::Attribute< T >::reserve | ( | const int64_t | size | ) |
Definition at line 66 of file Attribute.cpp.
int64_t wmtk::attribute::Attribute< T >::reserved_size |
The total number of elements in a vector.
This is greater than the number of active values in the attribute, and the set of active values is handled by a higher level abstraction
Definition at line 73 of file Attribute.cpp.
int64_t wmtk::attribute::Attribute< T >::reserved_size | ( | const std::vector< T > & | data | ) | const |
Definition at line 78 of file Attribute.cpp.
|
inline |
Definition at line 360 of file Attribute.hpp.
|
inline |
Definition at line 282 of file Attribute.hpp.
|
inline |
Definition at line 311 of file Attribute.hpp.
|
inline |
Accesses the attribute using the specified scalar as the underlying data This is internally used by the single-arg scalar_attribute and to help with serialization.
Definition at line 317 of file Attribute.hpp.
|
inline |
Accesses the attribute using the specified scalar as the underlying data This is internally used by the single-arg scalar_attribute and to help with serialization.
Definition at line 287 of file Attribute.hpp.
void wmtk::attribute::Attribute< T >::serialize | ( | const std::string & | name, |
const int | dim, | ||
MeshWriter & | writer | ||
) | const |
Definition at line 12 of file Attribute.cpp.
References wmtk::MeshWriter::write().
void wmtk::attribute::Attribute< T >::set | ( | std::vector< T > | val | ) |
Replace the internal data with val
.
Definition at line 84 of file Attribute.cpp.
MapResult<D> wmtk::attribute::Attribute< T >::vector_attribute | ( | const int64_t | index | ) |
Referenced by wmtk::attribute::internal::AttributeFlatCache< T >::apply_to(), and wmtk::attribute::internal::AttributeTransactionStack< T >::apply_to().
|
inline |
Definition at line 227 of file Attribute.hpp.
MapResult<D> wmtk::attribute::Attribute< T >::vector_attribute | ( | const int64_t | index, |
std::vector< T > & | data | ||
) | const |
Accesses the attribute using the specified vector as the underlying data This is internally used by the single-arg vector_attribute and to help with serialization.
|
inline |
Definition at line 243 of file Attribute.hpp.
MapResult<D> wmtk::attribute::Attribute< T >::vector_attribute2 | ( | const int64_t | index | ) |
|
inline |
Definition at line 235 of file Attribute.hpp.
MapResult<D> wmtk::attribute::Attribute< T >::vector_attribute_from_start | ( | const int64_t | index, |
std::vector< T > & | data | ||
) | const |
Accesses the attribute using the specified vector as the underlying data This is internally used by the single-arg const_vector_attribute and to help with serialization.
Start allows for assignment to buffers that dont' represent a 2d array
|
inline |
Definition at line 254 of file Attribute.hpp.
Definition at line 45 of file Attribute.hpp.
|
friend |
Definition at line 45 of file Attribute.hpp.
|
private |
Definition at line 181 of file Attribute.hpp.
Referenced by wmtk::attribute::internal::AttributeTransactionStack< T >::apply_to(), and wmtk::attribute::Attribute< T >::operator==().
|
private |
Definition at line 184 of file Attribute.hpp.
Referenced by wmtk::attribute::Attribute< T >::operator==().
|
private |
Definition at line 183 of file Attribute.hpp.
Referenced by wmtk::attribute::Attribute< T >::operator==().
std::string wmtk::attribute::Attribute< T >::m_name |
Definition at line 187 of file Attribute.hpp.
Referenced by wmtk::attribute::Attribute< T >::operator==().
|
private |
Definition at line 182 of file Attribute.hpp.