3 #ifndef DUNE_GRID_YASPGRIDPERSISTENTCONTAINER_HH 4 #define DUNE_GRID_YASPGRIDPERSISTENTCONTAINER_HH 15 #include "../yaspgrid.hh" 31 template<
typename Gr
id>
32 class YaspPersistentContainerIndex
37 : _grid(grid), _codim(codim)
46 template<
class Entity>
50 std::size_t level = e.
level();
51 return _grid.indexsets[level]->template index<cc>(e) + _offsets[level];
55 template<
class Entity >
60 std::size_t level = e.
level();
61 return _grid.indexsets[level]->template subIndex<cc>(e,i,codim) + _offsets[level];
65 std::size_t
size (
int codim)
const 67 if (_grid.indexsets.
size()+1 != _offsets.size())
69 return _offsets.back();
73 void recomputeOffsets()
const 75 _offsets.resize(_grid.indexsets.
size()+1,0);
77 for (std::size_t i=0; i<_grid.indexsets.
size(); i++)
78 _offsets[i+1] = _offsets[i] + _grid.indexsets[i]->
size(_codim);
83 mutable std::vector<std::size_t> _offsets;
92 template<
int dim,
class CoordCont,
class T>
100 YaspPersistentContainerIndex< const YaspGrid<dim, CoordCont> >,
113 : IndexSet(grid, codim),
114 Base(*this, codim, value)
120 #endif // end DUNE_GRID_YASPGRIDPERSISTENTCONTAINER_HH YaspPersistentContainerIndex(const Grid &grid, int codim)
Definition: yaspgridpersistentcontainer.hh:36
A class for storing data during an adaptation cycle.
Definition: utility/persistentcontainer.hh:18
[ provides Dune::Grid ]
Definition: yaspgrid.hh:58
IndexType index(const Entity &e) const
Map entity to index. The result of calling this method with an entity that is not in the index set is...
Definition: yaspgridpersistentcontainer.hh:47
vector-based implementation of the PersistentContainer
Definition: persistentcontainervector.hh:48
Grid abstract base classThis class is the base class for all grid implementations. Although no virtual functions are used we call it abstract since its methods do not contain an implementation but forward to the methods of the derived class via the Barton-Nackman trick.
Definition: common/grid.hh:373
Vector::value_type Value
Definition: persistentcontainervector.hh:55
Wrapper class for entities.
Definition: common/entity.hh:63
int size(int level, int codim) const
Return number of grid entities of a given codim on a given level in this process. ...
Definition: common/grid.hh:542
std::size_t size(int codim) const
Return total number of entities of given geometry type in entity set .
Definition: yaspgridpersistentcontainer.hh:65
PersistentContainer(const Grid &grid, int codim, const Value &value=Value())
Definition: yaspgridpersistentcontainer.hh:112
int level() const
The level of this entity.
Definition: common/entity.hh:126
Know your own codimension.
Definition: common/entity.hh:105
Base::Grid Grid
Definition: yaspgridpersistentcontainer.hh:107
std::size_t IndexType
The type used for the indices.
Definition: yaspgridpersistentcontainer.hh:43
Definition: yaspgrid.hh:68
Base::Value Value
Definition: yaspgridpersistentcontainer.hh:108
IndexType subIndex(const Entity &e, int i, unsigned int codim) const
Map a subentity to an index.
Definition: yaspgridpersistentcontainer.hh:56
Include standard header files.
Definition: agrid.hh:58
G Grid
Definition: persistentcontainervector.hh:53