Rodin::Geometry::AttributeIndex class

Manages attribute assignments for mesh polytopes.

This class maintains a mapping from polytopes (identified by dimension and index) to their associated attributes. Attributes are typically used to identify material regions, boundary markers, or other domain-specific properties.

The class is thread-safe for concurrent access through the use of shared mutexes for each dimension.

Constructors, destructors, conversion operators

AttributeIndex() defaulted
Default constructor.
~AttributeIndex() defaulted
Destructor.
AttributeIndex(const AttributeIndex& other)
Copy constructor.
AttributeIndex(AttributeIndex&& other) noexcept
Move constructor.

Public functions

auto operator=(const AttributeIndex&) -> AttributeIndex& deleted
Copy assignment operator (deleted).
auto operator=(AttributeIndex&& other) -> AttributeIndex& noexcept
Move assignment operator.
void initialize(size_t meshDim)
Initializes the attribute index for a mesh of given dimension.
void resize(size_t d, size_t count)
Resizes the storage for polytopes of dimension d.
void set(const std::pair<size_t, Index>& p, Attribute attr)
Sets the attribute for a polytope.
void set(const std::pair<size_t, Index>& p, size_t count, Attribute attr)
Sets the attribute for a polytope with known count.
auto get(const std::pair<size_t, Index>& p, size_t count) const -> Attribute
Gets the attribute for a polytope.
auto getAttributes(size_t d) const -> FlatSet<Attribute>
Gets all unique attributes in a given dimension.
template<class Archive>
void serialize(Archive& ar, const unsigned int)
Serialization method for Boost.Serialization.

Function documentation

void Rodin::Geometry::AttributeIndex::initialize(size_t meshDim)

Initializes the attribute index for a mesh of given dimension.

Parameters
meshDim in Topological dimension of the mesh

Must be called once before any concurrent access. Allocates storage for dimensions 0 through meshDim.

void Rodin::Geometry::AttributeIndex::resize(size_t d, size_t count)

Resizes the storage for polytopes of dimension d.

Parameters
in Dimension of polytopes
count in Number of polytopes to allocate space for

Ensures that the internal storage can hold at least count polytopes of dimension d.

void Rodin::Geometry::AttributeIndex::set(const std::pair<size_t, Index>& p, Attribute attr)

Sets the attribute for a polytope.

Parameters
in Pair of (dimension, index) identifying the polytope
attr in Attribute value to assign

Automatically resizes storage if needed to accommodate the polytope.

void Rodin::Geometry::AttributeIndex::set(const std::pair<size_t, Index>& p, size_t count, Attribute attr)

Sets the attribute for a polytope with known count.

Parameters
in Pair of (dimension, index) identifying the polytope
count in Expected number of polytopes in this dimension
attr in Attribute value to assign

More efficient than set() when the total count is known in advance.

Attribute Rodin::Geometry::AttributeIndex::get(const std::pair<size_t, Index>& p, size_t count) const

Gets the attribute for a polytope.

Parameters
in Pair of (dimension, index) identifying the polytope
count in Expected number of polytopes in this dimension
Returns The attribute value

Returns the current value, growing storage to count if needed. Uses shared locking for read access, upgrading to exclusive locking only if resizing is required.

FlatSet<Attribute> Rodin::Geometry::AttributeIndex::getAttributes(size_t d) const

Gets all unique attributes in a given dimension.

Parameters
in Dimension of polytopes
Returns Set of all unique attribute values

Useful for identifying all material regions or markers present in the mesh.

template<class Archive>
void Rodin::Geometry::AttributeIndex::serialize(Archive& ar, const unsigned int)

Serialization method for Boost.Serialization.

Parameters
ar in/out Archive object