GeometryIndexed

Template container indexed by polytope geometry types.

Defined in Rodin/Geometry/GeometryIndexed.h

template <
  class T>
class GeometryIndexed;
Template parameters
T Type of values to store

Container that maps polytope types to associated data.

This class provides an efficient mapping from polytope geometry types (Point, Segment, Triangle, etc.) to arbitrary data of type T. It uses compile-time knowledge of the number of polytope types to provide O(1) access with minimal memory overhead.

Usage Example

// Store quadrature orders for each polytope type
GeometryIndexed<int> quadratureOrders = {
  {Polytope::Type::Point, 1},
  {Polytope::Type::Segment, 2},
  {Polytope::Type::Triangle, 3},
  {Polytope::Type::Quadrilateral, 4},
  {Polytope::Type::Tetrahedron, 5},
  {Polytope::Type::Hexahedron, 6}
  {Polytope::Type::Wedge, 7}
};
int order = quadratureOrders[Polytope::Type::Triangle]; // Returns 3

Constructors, destructors, conversion operators

GeometryIndexed()
Default constructor that initializes all entries with default values.
GeometryIndexed(std::initializer_list<std::pair<Polytope::Type, T>> l)
Constructs from an initializer list of polytope type-value pairs.
GeometryIndexed(const GeometryIndexed& other) defaulted
Copy constructor.
GeometryIndexed(GeometryIndexed&& other) defaulted noexcept(…)
Move constructor.
~GeometryIndexed() defaulted
Destroys all retained values, including during constructor unwinding.

Public functions

auto operator=(const GeometryIndexed& other) -> GeometryIndexed& noexcept(…)
Copy assignment operator.
auto operator=(GeometryIndexed&& other) -> GeometryIndexed& noexcept(…)
Move assignment operator.
auto operator[](Polytope::Type type) -> T&
Access operator for mutable access to data by polytope type.
auto operator[](Polytope::Type type) const -> const T&
Access operator for const access to data by polytope type.
auto size() const -> size_t constexpr
Gets the number of polytope types (always constant).
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
Serialization method for Boost.Serialization.

Function documentation

GeometryIndexed(std::initializer_list<std::pair<Polytope::Type, T>> l)

Constructs from an initializer list of polytope type-value pairs.

Parameters
l Initializer list of (polytope type, value) pairs

GeometryIndexed(const GeometryIndexed& other) defaulted

Copy constructor.

Parameters
other GeometryIndexed object to copy from

GeometryIndexed(GeometryIndexed&& other) defaulted noexcept(…)

Move constructor.

Parameters
other GeometryIndexed object to move from

GeometryIndexed& operator=(const GeometryIndexed& other) noexcept(…)

Copy assignment operator.

Parameters
other GeometryIndexed object to copy from
Returns Reference to this object

GeometryIndexed& operator=(GeometryIndexed&& other) noexcept(…)

Move assignment operator.

Parameters
other GeometryIndexed object to move from
Returns Reference to this object

T& operator[](Polytope::Type type)

Access operator for mutable access to data by polytope type.

Parameters
type Polytope type to access
Returns Reference to the associated data

const T& operator[](Polytope::Type type) const

Access operator for const access to data by polytope type.

Parameters
type Polytope type to access
Returns Const reference to the associated data

size_t size() const constexpr

Gets the number of polytope types (always constant).

Returns Number of polytope types supported

template<class T> template<class Archive>
void serialize(Archive& ar, const unsigned int version)

Serialization method for Boost.Serialization.

Template parameters
Archive Archive type for serialization
Parameters
ar Archive object
version Serialization version (unused)