5#ifndef DUNE_GRID_YASPGRIDHIERARCHICITERATOR_HH
6#define DUNE_GRID_YASPGRIDHIERARCHICITERATOR_HH
18 template<
class Gr
idImp>
21 constexpr static int dim = GridImp::dimension;
27 typedef typename GridImp::YGridLevelIterator
YGLI;
28 typedef typename GridImp::YGrid::Iterator
I;
29 typedef typename GridImp::template Codim<0>::Entity
Entity;
41 StackElem se(entity.
_g);
42 std::copy(entity.
_it.coord().begin(), entity.
_it.coord().end(), se.coord.begin());
46 _maxlevel =
std::min(maxlevel,entity.
_g->mg->maxLevel());
49 if (entity.
_g->level()<_maxlevel)
63 if (stack.empty())
return;
66 if (_entity.impl()._g->level()<_maxlevel)
76 return (_entity == rhs._entity);
85 void print (std::ostream& s)
const
89 s <<
"HIER: " <<
"level=" << entity.
_g.level()
90 <<
" position=" << entity.
_it.coord()
91 <<
" superindex=" << entity.
_it.superindex()
92 <<
" maxlevel=" << entity._maxlevel
93 <<
" stacksize=" << stack.size()
104 std::array<int,dim> coord;
105 StackElem(
YGLI gg) : g(gg) {}
107 std::stack<StackElem> stack;
113 YaspEntityImp& entity = _entity.
impl();
116 YGLI finer = entity._g;
119 for (
int i=0; i<(1<<dim); i++)
121 for (
int k=0; k<dim; k++)
123 se.coord[k] = entity._it.coord(k)*2+1;
125 se.coord[k] = entity._it.coord(k)*2;
128 for (
int k=0; k<dim; k++)
129 if ((se.coord[k] < finer->overlap[0].dataBegin()->origin(k)) || (se.coord[k] >= finer->overlap[0].dataBegin()->origin(k)+finer->overlap[0].dataBegin()->size(k)))
139 StackElem se = stack.top();
141 YaspEntityImp& entity = _entity.
impl();
143 entity._it.reinit(entity._g->overlap[0],se.coord);
Include standard header files.
Definition: agrid.hh:60
int min(const DofVectorPointer< int > &dofVector)
Definition: dofvector.hh:348
Wrapper class for entities.
Definition: common/entity.hh:66
Implementation & impl()
access to the underlying implementation
Definition: common/entity.hh:80
YGLI _g
Definition: yaspgridentity.hh:426
I _it
Definition: yaspgridentity.hh:425
YaspHierarchicIterator enables iteration over son entities of codim 0.
Definition: yaspgridhierarchiciterator.hh:20
YaspHierarchicIterator()
default constructor creating empty iterator
Definition: yaspgridhierarchiciterator.hh:32
GridImp::template Codim< 0 >::Entity Entity
Definition: yaspgridhierarchiciterator.hh:29
void print(std::ostream &s) const
Definition: yaspgridhierarchiciterator.hh:85
GridImp::YGrid::Iterator I
Definition: yaspgridhierarchiciterator.hh:28
const Entity & dereference() const
dereferencing
Definition: yaspgridhierarchiciterator.hh:80
GridImp::YGridLevelIterator YGLI
Definition: yaspgridhierarchiciterator.hh:27
void increment()
increment
Definition: yaspgridhierarchiciterator.hh:60
bool equals(const YaspHierarchicIterator &rhs) const
equality
Definition: yaspgridhierarchiciterator.hh:74
YaspHierarchicIterator(const YGLI &g, const I &it, int maxlevel)
constructor
Definition: yaspgridhierarchiciterator.hh:35