#include <Rodin/Geometry/GeometryIndexed.h>
template<class T>
GeometryIndexed class
Template container indexed by polytope geometry types.
| 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::Wedge, 6} }; 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)
- Copy constructor.
- GeometryIndexed(GeometryIndexed&& other) noexcept(…)
- Move constructor.
- ~GeometryIndexed()
- Destructor that properly destroys all stored objects.
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
template<class T>
Rodin:: Geometry:: GeometryIndexed<T>:: 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 |
template<class T>
Rodin:: Geometry:: GeometryIndexed<T>:: GeometryIndexed(const GeometryIndexed& other)
Copy constructor.
| Parameters | |
|---|---|
| other | GeometryIndexed object to copy from |
template<class T>
Rodin:: Geometry:: GeometryIndexed<T>:: GeometryIndexed(GeometryIndexed&& other) noexcept(…)
Move constructor.
| Parameters | |
|---|---|
| other | GeometryIndexed object to move from |
template<class T>
GeometryIndexed& Rodin:: Geometry:: GeometryIndexed<T>:: operator=(const GeometryIndexed& other) noexcept(…)
Copy assignment operator.
| Parameters | |
|---|---|
| other | GeometryIndexed object to copy from |
| Returns | Reference to this object |
template<class T>
GeometryIndexed& Rodin:: Geometry:: GeometryIndexed<T>:: operator=(GeometryIndexed&& other) noexcept(…)
Move assignment operator.
| Parameters | |
|---|---|
| other | GeometryIndexed object to move from |
| Returns | Reference to this object |
template<class T>
T& Rodin:: Geometry:: GeometryIndexed<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 |
template<class T>
const T& Rodin:: Geometry:: GeometryIndexed<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 |
template<class T>
size_t Rodin:: Geometry:: GeometryIndexed<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 Rodin:: Geometry:: GeometryIndexed<T>:: 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) |