dune-grid  2.3beta2
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Dune::PersistentContainer< G, T > Class Template Reference

A class for storing data during an adaptation cycle. More...

#include <dune/grid/utility/persistentcontainer.hh>

Inheritance diagram for Dune::PersistentContainer< G, T >:
Inheritance graph

Public Types

typedef Base::Grid Grid
typedef Base::Value Value
typedef std::map
< G::LocalIdSet::IdType, T >
::size_type 
Size
typedef IteratorWrapper< const
Value, typename std::map
< G::LocalIdSet::IdType, T >
::const_iterator > 
ConstIterator
typedef IteratorWrapper< Value,
typename std::map
< G::LocalIdSet::IdType, T >
::iterator > 
Iterator
typedef Grid GridType
typedef Value Data

Public Member Functions

 PersistentContainer (const Grid &grid, int codim, const Value &value=Value())
const Valueoperator[] (const Entity &entity) const
Valueoperator[] (const Entity &entity)
const Valueoperator() (const Entity &entity, int subEntity) const
Valueoperator() (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
void reserve ()
void clear ()
void update ()

Protected Member Functions

void resize (const Value &value)
const Gridgrid () const
void migrateLevel (int level, const Value &value, std::map< G::LocalIdSet::IdType, T > &data, integral_constant< bool, true >)
void migrateLevel (int level, const Value &value, std::map< G::LocalIdSet::IdType, T > &data, integral_constant< bool, false >)
const G::LocalIdSet & idSet () const

Static Protected Member Functions

static void migrateEntry (const typename G::LocalIdSet::IdType &id, const Value &value, std::map< G::LocalIdSet::IdType, T > &oldData, std::map< G::LocalIdSet::IdType, T > &newData)

Protected Attributes

const Gridgrid_
int codim_
const G::LocalIdSet * idSet_
std::map
< G::LocalIdSet::IdType, T > 
data_

Detailed Description

template<class G, class T>
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
GGrid type
TContainer's value type

Member Typedef Documentation

typedef IteratorWrapper< const Value, typename std::map< G::LocalIdSet::IdType, T > ::const_iterator > Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::ConstIterator
inherited
typedef Value Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::Data
inherited
Deprecated:
"Use Value instead."
template<class G, class T>
typedef Base::Grid Dune::PersistentContainer< G, T >::Grid
typedef Grid Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::GridType
inherited
Deprecated:
"Use Grid instead."
typedef IteratorWrapper< Value, typename std::map< G::LocalIdSet::IdType, T > ::iterator > Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::Iterator
inherited
typedef std::map< G::LocalIdSet::IdType, T > ::size_type Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::Size
inherited
template<class G, class T>
typedef Base::Value Dune::PersistentContainer< G, T >::Value

Constructor & Destructor Documentation

template<class G, class T>
Dune::PersistentContainer< G, T >::PersistentContainer ( const Grid grid,
int  codim,
const Value value = Value() 
)
inline

Member Function Documentation

ConstIterator Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::begin ( ) const
inherited
Iterator Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::begin ( )
inherited
void Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::clear ( )
inlineinherited
Deprecated:
"Use resize() instead."
int Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::codimension ( ) const
inlineinherited
ConstIterator Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::end ( ) const
inherited
Iterator Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::end ( )
inherited
void Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::fill ( const Value value)
inlineinherited
const Grid& Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::grid ( ) const
inlineprotectedinherited
const G::LocalIdSet & Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::idSet ( ) const
inlineprotectedinherited
static void Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::migrateEntry ( const typename G::LocalIdSet ::IdType &  id,
const Value value,
std::map< G::LocalIdSet::IdType, T > &  oldData,
std::map< G::LocalIdSet::IdType, T > &  newData 
)
staticprotectedinherited
void Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::migrateLevel ( int  level,
const Value value,
std::map< G::LocalIdSet::IdType, T > &  data,
integral_constant< bool, true >   
)
protectedinherited
void Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::migrateLevel ( int  level,
const Value value,
std::map< G::LocalIdSet::IdType, T > &  data,
integral_constant< bool, false >   
)
protectedinherited
const Value& Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::operator() ( const Entity entity,
int  subEntity 
) const
inlineinherited
Value& Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::operator() ( const Entity entity,
int  subEntity 
)
inlineinherited
const Value& Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::operator[] ( const Entity entity) const
inlineinherited
Value& Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::operator[] ( const Entity entity)
inlineinherited
void Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::reserve ( )
inlineinherited
Deprecated:
"Use resize() instead."
void Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::resize ( const Value value = Value())
inlineinherited
void Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::resize ( const Value value)
protectedinherited
void Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::shrinkToFit ( )
inlineinherited
Size Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::size ( ) const
inlineinherited
void Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::swap ( This other)
inlineinherited
void Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::update ( )
inlineinherited
Deprecated:
"Use resize() instead."

Member Data Documentation

int Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::codim_
protectedinherited
std::map< G::LocalIdSet::IdType, T > Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::data_
protectedinherited
const Grid* Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::grid_
protectedinherited
const G::LocalIdSet * Dune::PersistentContainerMap< G, G::LocalIdSet , std::map< G::LocalIdSet::IdType, T > >::idSet_
protectedinherited

The documentation for this class was generated from the following file: