dune-grid
2.2.1
|
A class for storing data during an adaptation cycle. More...
#include <dune/grid/utility/persistentcontainer.hh>
Public Types | |
typedef Grid | GridType |
typedef GridType::template Codim< 0 >::Entity | ElementType |
typedef MyIterator< iterator > | Iterator |
typedef MyIterator < const_iterator > | ConstIterator |
Public Member Functions | |
PersistentContainer (const GridType &grid, const int codim, const Allocator &allocator=Allocator()) | |
Data & | operator[] (const Entity &entity) |
random access entity with correct codimension More... | |
const Data & | operator[] (const Entity &entity) const |
random access entity with correct codimension More... | |
Data & | operator() (const ElementType &element, const int subEntity) |
access for sub entity data More... | |
const Data & | operator() (const ElementType &element, const int subEntity) const |
access for sub entity data More... | |
Iterator | begin () |
iterator begin for iterating over data actually stored in container More... | |
ConstIterator | begin () const |
const iterator begin More... | |
Iterator | end () |
iterator end More... | |
ConstIterator | end () const |
const iterator end More... | |
size_t | size () const |
return size of allocated data More... | |
void | reserve () |
enlarge container, compress is not necessary but could be done More... | |
void | clear () |
adjust container to correct size and set all values to default More... | |
void | update () |
adjust container to correct size including compress More... | |
Protected Types | |
typedef Grid::Traits::LocalIdSet | IdSet |
typedef IdSet::IdType | IdType |
typedef Allocator::template rebind< IdType >::other | IdAllocator |
typedef std::map< const IdType, Data, std::less< const IdType > , IdAllocator > | Map |
typedef PersistentContainerMap < Grid, IdSet, Map > | BaseType |
typedef std::map< const Grid::Traits::LocalIdSet::IdType, Data, std::less< const Grid::Traits::LocalIdSet::IdType > , Allocator::template rebind < Grid::Traits::LocalIdSet::IdType > ::other >::mapped_type | Data |
typedef std::map< const Grid::Traits::LocalIdSet::IdType, Data, std::less< const Grid::Traits::LocalIdSet::IdType > , Allocator::template rebind < Grid::Traits::LocalIdSet::IdType > ::other >::iterator | iterator |
typedef std::map< const Grid::Traits::LocalIdSet::IdType, Data, std::less< const Grid::Traits::LocalIdSet::IdType > , Allocator::template rebind < Grid::Traits::LocalIdSet::IdType > ::other >::const_iterator | const_iterator |
Protected Member Functions | |
void | update (const Data &value) |
adjust container to correct size including compress More... | |
void | adaptCodim (const Data &value) |
Protected Attributes | |
const GridType & | grid_ |
const int | codim_ |
const Grid::Traits::LocalIdSet & | id_ |
std::map< const Grid::Traits::LocalIdSet::IdType, Data, std::less< const Grid::Traits::LocalIdSet::IdType > , Allocator::template rebind < Grid::Traits::LocalIdSet::IdType > ::other > | 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. There is a default implementation based on std::map but any grid implementation can provide a specialized implementation.
The container expects that the class Data has a default constructor. This default value is returned if data for an entity is requested which has not yet been added to the container. Therefore no find as for std::map is required and provided. The class furthermore provides a size method and iterators. The guarantee being that the iteration is at least over all entries in the container which are not set to default but the iteration could also include entries with the default value. The size method returns the number of elements visited by an iteration so that size() is larger or equal to the entries which are not set to the default value. The method clear can be used to set all entries in the container to the default value.
After the grid has changed update() or reserve() should to be called. In contrast to the method reserve, the method update can compress the data to reduce memory consumption, whereas reserve() can be implemented not to reduce any memory even if the size of the grid has changed.
Specialized implementations of this class are provided for some grid implementations. Especially grids with an id type with a hash function could use the std::unordered_map to store the data (the implementation Dune::PersistentContainerMap can be used). For grids providing an id set suitable for storage in vector like structures (id type is int and size method provided) Dune::PersistentContainerVector can be used.
|
protected |
|
protectedinherited |
|
inherited |
|
protectedinherited |
|
inherited |
typedef Grid Dune::PersistentContainer< Grid, Data, Allocator >::GridType |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
inherited |
|
protected |
|
inline |
Constructor filling the container with values using the default constructor Depending on the implementation this could be achieved without allocating memory
|
inlineprotectedinherited |
|
inlineinherited |
iterator begin for iterating over data actually stored in container
|
inlineinherited |
const iterator begin
|
inlineinherited |
adjust container to correct size and set all values to default
|
inlineinherited |
iterator end
|
inlineinherited |
const iterator end
|
inlineinherited |
access for sub entity data
|
inlineinherited |
access for sub entity data
|
inlineinherited |
random access entity with correct codimension
|
inlineinherited |
random access entity with correct codimension
|
inlineinherited |
enlarge container, compress is not necessary but could be done
|
inlineinherited |
return size of allocated data
|
inlineinherited |
adjust container to correct size including compress
|
inlineprotectedinherited |
adjust container to correct size including compress
|
protectedinherited |
|
mutableprotectedinherited |
|
protectedinherited |
|
protectedinherited |