Wildmeshing Toolkit
Loading...
Searching...
No Matches
wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim > Class Template Reference

An Accessor that uses tuples for accessing attributes instead of indices. More...

#include <Accessor.hpp>

Inheritance diagram for wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >:
[legend]
Collaboration diagram for wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >:
[legend]

Public Types

using Scalar = T
 
using AttributeType = AttributeType_
 
template<int D = Dim>
using MapResult = typename AttributeType::template MapResult< D >
 
template<int D = Dim>
using ConstMapResult = typename AttributeType::template ConstMapResult< D >
 

Public Member Functions

 Accessor (MeshType &m, const TypedAttributeHandle< T > &handle)
 
 Accessor (const MeshType &m, const TypedAttributeHandle< T > &handle)
 
template<typename OMType , typename OAT , int D>
 Accessor (const Accessor< T, OMType, OAT, D > &o)
 
auto dimension () const -> int64_t
 
auto reserved_size () const -> int64_t
 
auto default_value () const -> const Scalar &
 
template<int D = Dim, typename ArgType = wmtk::Tuple>
MapResult< std::max(D, Dim)> vector_attribute (const ArgType &t)
 Access function for a vector attribute.
 
template<int D = Dim, typename ArgType = wmtk::Tuple>
ConstMapResult< std::max(D, Dim)> const_vector_attribute (const ArgType &t) const
 Constant access function for a vector attribute.
 
template<typename ArgType >
Scalarscalar_attribute (const ArgType &t)
 Access function for a scalar attribute.
 
template<typename ArgType >
const Scalarconst_scalar_attribute (const ArgType &t) const
 Constant access function for a scalar attribute.
 
const T & const_topological_scalar_attribute (const Tuple &t, PrimitiveType pt) const
 
MeshType & mesh ()
 
const MeshType & mesh () const
 
int64_t transaction_depth () const
 
MeshAttributeHandle handle () const
 
const TypedAttributeHandle< T > & typed_handle () const
 
PrimitiveType primitive_type () const
 
template<int D, typename ArgType >
auto const_vector_attribute (const ArgType &t) const -> ConstMapResult< std::max(D, Dim)>
 
template<int D, typename ArgType >
auto vector_attribute (const ArgType &t) -> MapResult< std::max(D, Dim)>
 
template<typename ArgType >
auto scalar_attribute (const ArgType &t) -> Scalar &
 
template<typename ArgType >
auto const_scalar_attribute (const ArgType &t) const -> const Scalar &
 

Protected Member Functions

int64_t index (const Tuple &t) const
 Retrieve the global ID of the given simplex.
 
int64_t index (const simplex::Simplex &t) const
 Retrieve the global ID of the given simplex.
 
int64_t index (const simplex::IdSimplex &t) const
 Same as with Simplex.
 
int64_t index (const int64_t t) const
 
AttributeTypeattribute ()
 
const AttributeTypeattribute () const
 

Private Attributes

TypedAttributeHandle< T > m_handle
 
MeshType & m_mesh
 
AttributeTypem_attribute
 

Friends

class wmtk::Mesh
 
class wmtk::tests::DEBUG_PointMesh
 
class wmtk::tests::DEBUG_EdgeMesh
 
class wmtk::tests::DEBUG_TriMesh
 
class wmtk::tests_3d::DEBUG_TetMesh
 
class IndexFlagAccessor< MeshType >
 
class wmtk::HDF5Reader
 

Detailed Description

template<typename T, typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
class wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >

An Accessor that uses tuples for accessing attributes instead of indices.

The parameter T is the type of the attribute data, and always must match the underlying attribute's type MeshType can default to Mesh, but specializing it with the specific type of mesh this attribute lies in avoids some virtual calls AttributeType_ specifies the type of teh underlying attribute, which should almost always be CachingAttribute<T> to take advantage of our transactional caching system, but for unit tests (or guaranteed raw access to the underlying buffers) this can be changed to Attribute<T> Dim specifies the dimension of the underlying attribute - specifying this parameter when possible can have a notable performance improvement, so specify it when possible. This performance change is the change between passing a single pointer for each attribute vs a pointer + int size for each value

Definition at line 43 of file Accessor.hpp.

Member Typedef Documentation

◆ AttributeType

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
using wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::AttributeType = AttributeType_

Definition at line 56 of file Accessor.hpp.

◆ ConstMapResult

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
template<int D = Dim>
using wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::ConstMapResult = typename AttributeType::template ConstMapResult<D>

Definition at line 66 of file Accessor.hpp.

◆ MapResult

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
template<int D = Dim>
using wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::MapResult = typename AttributeType::template MapResult<D>

Definition at line 63 of file Accessor.hpp.

◆ Scalar

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
using wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::Scalar = T

Definition at line 54 of file Accessor.hpp.

Constructor & Destructor Documentation

◆ Accessor() [1/3]

template<typename T , typename MeshType , typename AttributeType , int Dim>
wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::Accessor ( MeshType &  m,
const TypedAttributeHandle< T > &  handle 
)
inline

Definition at line 9 of file Accessor.hxx.

◆ Accessor() [2/3]

template<typename T , typename MeshType , typename AttributeType , int Dim>
wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::Accessor ( const MeshType &  m,
const TypedAttributeHandle< T > &  handle 
)

Definition at line 17 of file Accessor.hxx.

◆ Accessor() [3/3]

template<typename T , typename MeshType , typename AttributeType , int Dim>
template<typename OMType , typename OAT , int D>
wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::Accessor ( const Accessor< T, OMType, OAT, D > &  o)

Definition at line 24 of file Accessor.hxx.

Member Function Documentation

◆ attribute() [1/2]

template<typename T , typename MeshType , typename AttributeType , int Dim>
auto wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::attribute ( )
inlineprotected

Definition at line 159 of file Accessor.hxx.

Referenced by wmtk::attribute::IndexFlagAccessor< MeshType >::attribute(), wmtk::attribute::IndexFlagAccessor< MeshType >::attribute(), wmtk::Mesh::consolidate(), wmtk::Mesh::get_index_access(), and wmtk::Mesh::get_index_access().

Here is the caller graph for this function:

◆ attribute() [2/2]

template<typename T , typename MeshType , typename AttributeType , int Dim>
auto wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::attribute ( ) const
inlineprotected

Definition at line 164 of file Accessor.hxx.

◆ const_scalar_attribute() [1/2]

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
template<typename ArgType >
const Scalar & wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::const_scalar_attribute ( const ArgType &  t) const

Constant access function for a scalar attribute.

The scalar attribute circumvents the Eigen::Map that is necessary for vector attributes.

Parameters
tTuple, Simplex, or IdSimplex for which the attribute should be accessed.
Returns
A const reference to the attribute value.

Referenced by wmtk::TodoInvariant::before(), wmtk::TodoLargerInvariant::before(), wmtk::TodoSmallerInvariant::before(), wmtk::components::internal::MultiMeshFromTag::compute_substructure_mesh(), wmtk::components::internal::MultiMeshFromTag::create_substructure_soup(), wmtk::multimesh::utils::internal::TupleTag::get_edge_tag(), wmtk::multimesh::utils::internal::TupleTag::get_vertex_tag(), wmtk::TetMesh::is_connectivity_valid(), wmtk::TriMesh::is_connectivity_valid(), wmtk::EdgeMesh::is_connectivity_valid(), wmtk::components::TagAttribute::is_tagged(), wmtk::components::Marching::process(), wmtk::components::internal::RegularSpace::regularize_tags(), and wmtk::EdgeMesh::vertex_tuple_from_id().

Here is the caller graph for this function:

◆ const_scalar_attribute() [2/2]

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
template<typename ArgType >
auto wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::const_scalar_attribute ( const ArgType &  t) const -> const Scalar&

Definition at line 86 of file Accessor.hxx.

◆ const_topological_scalar_attribute()

template<typename T , typename MeshType , typename AttributeType , int Dim>
const T & wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::const_topological_scalar_attribute ( const Tuple t,
PrimitiveType  pt 
) const

Definition at line 103 of file Accessor.hxx.

References wmtk::Edge, wmtk::Tuple::global_cid(), wmtk::Tuple::local_eid(), wmtk::Tuple::local_fid(), wmtk::Tuple::local_vid(), wmtk::Tetrahedron, wmtk::Triangle, and wmtk::Vertex.

Here is the call graph for this function:

◆ const_vector_attribute() [1/2]

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
template<int D = Dim, typename ArgType = wmtk::Tuple>
ConstMapResult< std::max(D, Dim)> wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::const_vector_attribute ( const ArgType &  t) const

Constant access function for a vector attribute.

Parameters
tTuple, Simplex, or IdSimplex for which the attribute should be accessed.
Returns
A const reference (some Eigen::Map) to the attribute value.

Referenced by wmtk::invariants::EnvelopeInvariant::after(), wmtk::operations::CollapseNewAttributeStrategy< T >::assign_collapsed(), wmtk::operations::SplitNewAttributeStrategy< T >::assign_split(), wmtk::operations::SplitNewAttributeStrategy< T >::assign_split_ribs(), wmtk::MaxEdgeLengthInvariant::before(), wmtk::invariants::MinEdgeLengthInvariant::before(), wmtk::components::internal::MultiMeshFromTag::build_adjacency_matrix(), wmtk::mesh_utils::compute_face_normal_area_weighted(), wmtk::components::internal::MultiMeshFromTag::compute_substructure_ids(), wmtk::invariants::EnvelopeInvariant::EnvelopeInvariant(), wmtk::EdgeMesh::id(), wmtk::operations::OptimizationSmoothing::WMTKProblem< T >::initial_value(), wmtk::TetMesh::is_boundary_face(), wmtk::EdgeMesh::is_boundary_vertex(), wmtk::TetMesh::is_connectivity_valid(), wmtk::TriMesh::is_connectivity_valid(), wmtk::EdgeMesh::is_connectivity_valid(), wmtk::operations::composite::ProjectOperation::ProjectOperation(), wmtk::multimesh::utils::read_tuple_map_attribute(), wmtk::EdgeMesh::switch_tuple(), wmtk::EdgeMesh::tuple_from_global_ids(), wmtk::EdgeMesh::vertex_tuple_from_id(), and wmtk::multimesh::utils::write_tuple_map_attribute().

Here is the caller graph for this function:

◆ const_vector_attribute() [2/2]

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
template<int D, typename ArgType >
auto wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::const_vector_attribute ( const ArgType &  t) const -> ConstMapResult<std::max(D, Dim)>

Definition at line 60 of file Accessor.hxx.

◆ default_value()

template<typename T , typename MeshType , typename AttributeType , int Dim>
auto wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::default_value ( ) const -> const Scalar&
inline

Definition at line 153 of file Accessor.hxx.

◆ dimension()

template<typename T , typename MeshType , typename AttributeType , int Dim>
int64_t wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::dimension ( ) const -> int64_t
inline

Definition at line 147 of file Accessor.hxx.

Referenced by wmtk::invariants::EnvelopeInvariant::after(), wmtk::invariants::EnvelopeInvariant::EnvelopeInvariant(), wmtk::multimesh::utils::read_tuple_map_attribute(), and wmtk::multimesh::utils::write_tuple_map_attribute().

Here is the caller graph for this function:

◆ handle()

template<typename T , typename MeshType , typename AttributeType , int Dim>
MeshAttributeHandle wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::handle ( ) const
inline

Definition at line 175 of file Accessor.hxx.

◆ index() [1/4]

template<typename T , typename MeshType , typename AttributeType_ , int Dim>
int64_t wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::index ( const int64_t  t) const
inlineprotected

Definition at line 53 of file Accessor.hxx.

◆ index() [2/4]

template<typename T , typename MeshType , typename AttributeType , int Dim>
int64_t wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::index ( const simplex::IdSimplex t) const
protected

Same as with Simplex.

Definition at line 46 of file Accessor.hxx.

References wmtk::simplex::IdSimplex::primitive_type().

Here is the call graph for this function:

◆ index() [3/4]

template<typename T , typename MeshType , typename AttributeType , int Dim>
int64_t wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::index ( const simplex::Simplex t) const
protected

Retrieve the global ID of the given simplex.

Simplex's primitive type must match this attribute, should assert failure if not.

Parameters
tSimplex for accessing.
Returns
Global simplex ID.

Definition at line 39 of file Accessor.hxx.

References wmtk::simplex::Simplex::primitive_type(), and wmtk::simplex::Simplex::tuple().

Here is the call graph for this function:

◆ index() [4/4]

template<typename T , typename MeshType , typename AttributeType , int Dim>
int64_t wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::index ( const Tuple t) const
protected

Retrieve the global ID of the given simplex.

The simplex is defined by the given Tuple t and the PrimitiveType of the attribute.

Parameters
tTuple used for accessing.
Returns
Global simplex ID.

Definition at line 32 of file Accessor.hxx.

◆ mesh() [1/2]

template<typename T , typename MeshType , typename AttributeType , int Dim>
MeshType & wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::mesh ( )
inline

Definition at line 124 of file Accessor.hxx.

Referenced by wmtk::operations::composite::ProjectOperation::execute(), and wmtk::operations::composite::ProjectOperation::ProjectOperation().

Here is the caller graph for this function:

◆ mesh() [2/2]

template<typename T , typename MeshType , typename AttributeType , int Dim>
const MeshType & wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::mesh ( ) const
inline

Definition at line 129 of file Accessor.hxx.

◆ primitive_type()

template<typename T , typename MeshType , typename AttributeType , int Dim>
PrimitiveType wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::primitive_type ( ) const
inline

Definition at line 181 of file Accessor.hxx.

Referenced by wmtk::operations::CollapseNewAttributeStrategy< T >::assign_collapsed(), wmtk::operations::SplitNewAttributeStrategy< T >::assign_split(), and wmtk::operations::SplitNewAttributeStrategy< T >::assign_split_ribs().

Here is the caller graph for this function:

◆ reserved_size()

template<typename T , typename MeshType , typename AttributeType , int Dim>
int64_t wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::reserved_size ( ) const -> int64_t
inline

Definition at line 141 of file Accessor.hxx.

Referenced by wmtk::Mesh::request_simplex_indices(), and wmtk::Mesh::set_capacities_from_flags().

Here is the caller graph for this function:

◆ scalar_attribute() [1/2]

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
template<typename ArgType >
Scalar & wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::scalar_attribute ( const ArgType &  t)

Access function for a scalar attribute.

The scalar attribute circumvents the Eigen::Map that is necessary for vector attributes.

Parameters
tTuple, Simplex, or IdSimplex for which the attribute should be accessed.
Returns
A reference to the attribute value.

Referenced by wmtk::EdgeMesh::initialize(), wmtk::TriMesh::initialize(), wmtk::components::Marching::process(), wmtk::components::internal::RegularSpace::regularize_tags(), wmtk::multimesh::utils::internal::TupleTag::set_edge_tag(), wmtk::components::TagAttribute::set_tag(), wmtk::multimesh::utils::internal::TupleTag::set_vertex_tag(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), and TEST_CASE().

Here is the caller graph for this function:

◆ scalar_attribute() [2/2]

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
template<typename ArgType >
auto wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::scalar_attribute ( const ArgType &  t) -> Scalar&

Definition at line 78 of file Accessor.hxx.

◆ transaction_depth()

template<typename T , typename MeshType , typename AttributeType_ , int Dim>
int64_t wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::transaction_depth ( ) const
inline

Definition at line 135 of file Accessor.hxx.

◆ typed_handle()

template<typename T , typename MeshType , typename AttributeType , int Dim>
auto wmtk::attribute::Accessor< T, MeshType, AttributeType, Dim >::typed_handle ( ) const
inline

Definition at line 169 of file Accessor.hxx.

◆ vector_attribute() [1/2]

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
template<int D = Dim, typename ArgType = wmtk::Tuple>
MapResult< std::max(D, Dim)> wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::vector_attribute ( const ArgType &  t)

◆ vector_attribute() [2/2]

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
template<int D, typename ArgType >
auto wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::vector_attribute ( const ArgType &  t) -> MapResult<std::max(D, Dim)>

Definition at line 69 of file Accessor.hxx.

Friends And Related Symbol Documentation

◆ IndexFlagAccessor< MeshType >

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
friend class IndexFlagAccessor< MeshType >
friend

Definition at line 50 of file Accessor.hpp.

◆ wmtk::HDF5Reader

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
friend class wmtk::HDF5Reader
friend

Definition at line 52 of file Accessor.hpp.

◆ wmtk::Mesh

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
friend class wmtk::Mesh
friend

Definition at line 46 of file Accessor.hpp.

◆ wmtk::tests::DEBUG_EdgeMesh

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
friend class wmtk::tests::DEBUG_EdgeMesh
friend

Definition at line 48 of file Accessor.hpp.

◆ wmtk::tests::DEBUG_PointMesh

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
friend class wmtk::tests::DEBUG_PointMesh
friend

Definition at line 47 of file Accessor.hpp.

◆ wmtk::tests::DEBUG_TriMesh

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
friend class wmtk::tests::DEBUG_TriMesh
friend

Definition at line 49 of file Accessor.hpp.

◆ wmtk::tests_3d::DEBUG_TetMesh

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
friend class wmtk::tests_3d::DEBUG_TetMesh
friend

Definition at line 50 of file Accessor.hpp.

Member Data Documentation

◆ m_attribute

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
AttributeType& wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::m_attribute
private

Definition at line 182 of file Accessor.hpp.

◆ m_handle

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
TypedAttributeHandle<T> wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::m_handle
private

Definition at line 180 of file Accessor.hpp.

◆ m_mesh

template<typename T , typename MeshType = Mesh, typename AttributeType_ = CachingAttribute<T>, int Dim = Eigen::Dynamic>
MeshType& wmtk::attribute::Accessor< T, MeshType, AttributeType_, Dim >::m_mesh
private

Definition at line 181 of file Accessor.hpp.


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