Template Class HierarchicalGeometryContainer¶
Defined in File HierarchicalGeometryContainer.hpp
Class Documentation¶
-
template<typename
value_t
>
classActs
::
HierarchicalGeometryContainer
¶ Store homogeneous elements anchored in the geometry hierarchy.
The core functionality is to find an equivalent element for a given identifier via
auto it = container.find(GeometryID(...)); if (it != container.end()) { ... }
- Template Parameters
value_t
: stored element type
Trailing zero components of stored geometry identifiers are used as broadcast values to refer to higher-level objects within the geometry, e.g. a geometry identifier with vanishing approach and sensitive index refers to the full layer. All stored geometry identifiers must set at least the highest hierarchy level.
The container also supports range-based iteration over all stored elements
for (const auto& element : container) { ... }
and index-based access to stored elements and associated geometry identifiers
GeometryID id3 = container.idAt(3); const auto& element4 = container.valueAt(4);
Adding elements is potentially expensive as the internal lookup structure must be updated. In addition, modifying an element in-place can potentially change its identifier which would also break the lookup. Thus, the container can not be modified after construction to prevent misuse.
- Note
No guarantees are given for the element order when using range-based or index-based access. Any apparent ordering must be considered an implementation detail and might change.
Public Types
Public Functions
-
template<typename
id_getter_t
= detail::DefaultGeometryIdGetter>HierarchicalGeometryContainer
(std::vector<Value> &&elements, id_getter_t getId = id_getter_t())¶ Construct the container from the given elements.
- Parameters
elements
: input elements (must be unique with respect to identifier)getId
: functor to retrieve the id of an element
- Template Parameters
id_getter_t
: Functor type to retrieve the id of an element
-
HierarchicalGeometryContainer
() = default¶
-
HierarchicalGeometryContainer
(const HierarchicalGeometryContainer&) = default¶
-
HierarchicalGeometryContainer
(HierarchicalGeometryContainer&&) = default¶
-
~HierarchicalGeometryContainer
() = default¶
-
bool
empty
() const¶ Check if any elements are stored.
-
Iterator
find
(GeometryID id) const¶ Find the most specific element for a given geometry identifier.
This can be either the element matching exactly to the given geometry id, if it exists, or the element from the next available higher level within the geometry hierachy.
- Parameters
id
: geometry identifier for which information is requested
- Return Value
iterator
: to an existing element<tt>.end()</tt>
: iterator if no matching element exists
-
GeometryID
idAt
(Size index) const¶ Access the geometry identifier for the i-th element with bounds check.
- Exceptions
std::out_of_range
: for invalid indices
-
HierarchicalGeometryContainer &
operator=
(const HierarchicalGeometryContainer&) = default¶
-
HierarchicalGeometryContainer &
operator=
(HierarchicalGeometryContainer&&) = default¶