dune-grid 2.9.0
|
A class for storing data during an adaptation cycle. More...
#include <dune/grid/utility/persistentcontainer.hh>
Public Types | |
typedef Base::Grid | Grid |
typedef Base::Value | Value |
typedef Map::size_type | Size |
typedef IteratorWrapper< const Value, typename Map::const_iterator > | ConstIterator |
typedef IteratorWrapper< Value, typename Map::iterator > | Iterator |
Public Member Functions | |
PersistentContainer (const Grid &grid, int codim, const Value &value=Value()) | |
const Value & | operator[] (const Entity &entity) const |
Value & | operator[] (const Entity &entity) |
const Value & | operator() (const Entity &entity, int subEntity) const |
Value & | operator() (const Entity &entity, int subEntity) |
Size | size () const |
void | resize (const Value &value=Value()) |
void | shrinkToFit () |
void | fill (const Value &value) |
void | swap (This &other) |
ConstIterator | begin () const |
Iterator | begin () |
ConstIterator | end () const |
Iterator | end () |
int | codimension () const |
Protected Member Functions | |
void | resize (const Value &value) |
const Grid & | grid () const |
void | migrateLevel (int level, const Value &value, std::map< G::LocalIdSet::IdType, T > &data, std::integral_constant< bool, true >) |
void | migrateLevel (int level, const Value &value, std::map< G::LocalIdSet::IdType, T > &data, std::integral_constant< bool, false >) |
const G::LocalIdSet & | idSet () const |
Static Protected Member Functions | |
static void | migrateEntry (const typename IdSet::IdType &id, const Value &value, std::map< G::LocalIdSet::IdType, T > &oldData, std::map< G::LocalIdSet::IdType, T > &newData) |
Protected Attributes | |
const Grid * | grid_ |
int | codim_ |
const G::LocalIdSet * | idSet_ |
std::map< G::LocalIdSet::IdType, T > | data_ |
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.
G | Grid type |
T | Container's value type |
|
inherited |
typedef Base::Grid Dune::PersistentContainer< G, T >::Grid |
|
inherited |
|
inherited |
typedef Base::Value Dune::PersistentContainer< G, T >::Value |
|
inline |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlinestaticprotectedinherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
protectedinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |