DUNE PDELab (git)
A class for storing data during an adaptation cycle. More...
#include <dune/grid/utility/persistentcontainer.hh>
Detailed Description
class Dune::PersistentContainer< G, T >
A class for storing data during an adaptation cycle.
This container allows to store data which is to remain persistent even during adaptation cycles. It provides storage for all entities in the hierarchy of a given codimension (provided dynamically during construction) and behaves much like an STL container.
The container stores one entry for each entity in the hierarchical grid. However, it may also store some additional entries, which are not (or no longer) attached to an entity.
After grid modification the method resize must be called to ensure entries for each entity in the modified grid. Accessing newly created entities before calling resize results in undefined behavior (e.g., a segmentation fault). To reduce the amount of overallocated entries, the method shrinkToFit may be called. It is explicitly possible that the grid adapts any persistent containers directly during the adaptation process.
The containers are also be persistent over backup / restore of the grid. After 'shrinkToFit', the entries in the container (and their order) must match those of a newly created container, even after a backup and restore of the grid.
There is a default implementation based on std::map but a grid implementation may provide a specialized implementation. Grids with a hashable id type can use std::unordered_map to store the data by simply deriving their PersistentContainer from Dune::PersistentContainerMap. For grids providing an id set suitable addressing vector-like storages, i.e., the id is an integral type and a method size() is provided, Dune::PersistentContainerVector can be used.
- Template Parameters
-
G Grid type T Container's value type
The documentation for this class was generated from the following file:
- dune/grid/utility/persistentcontainer.hh