3#ifndef DUNE_GRID_YASPGRIDHIERARCHICITERATOR_HH
4#define DUNE_GRID_YASPGRIDHIERARCHICITERATOR_HH
16 template<
class Gr
idImp>
20 enum { dim=GridImp::dimension };
22 typedef YaspEntity<0,GridImp::dimension,GridImp> YaspEntityImp;
26 typedef typename GridImp::YGridLevelIterator YGLI;
27 typedef typename GridImp::YGrid::Iterator I;
35 YaspEntityImp& entity = entityImplementation();
37 StackElem se(entity._g);
38 std::copy(entity._it.coord().begin(), entity._it.coord().end(), se.coord.begin());
42 _maxlevel = std::min(maxlevel,entity._g->mg->maxLevel());
45 if (entity._g->level()<_maxlevel)
58 _maxlevel(it._maxlevel), stack(it.stack)
65 if (stack.empty())
return;
68 if (entityImplementation()._g->level()<_maxlevel)
75 void print (std::ostream& s)
const
78 YaspEntityImp& entity = entityImplementation();
79 s <<
"HIER: " <<
"level=" << entity._g.level()
80 <<
" position=" << entity._it.coord()
81 <<
" superindex=" << entity._it.superindex()
82 <<
" maxlevel=" << entity._maxlevel
83 <<
" stacksize=" << stack.size()
92 std::array<int,dim> coord;
93 StackElem(YGLI gg) : g(gg) {}
95 std::stack<StackElem> stack;
101 YaspEntityImp& entity = entityImplementation();
104 YGLI finer = entity._g;
107 for (
int i=0; i<(1<<dim); i++)
109 for (
int k=0; k<dim; k++)
111 se.coord[k] = entity._it.coord(k)*2+1;
113 se.coord[k] = entity._it.coord(k)*2;
116 for (
int k=0; k<dim; k++)
117 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)))
124 YaspEntityImp& entityImplementation()
126 return GridImp::getRealImplementation(this->
_entity);
132 StackElem se = stack.top();
134 entityImplementation()._g = se.g;
135 entityImplementation()._it.reinit(entityImplementation()._g->overlap[0],se.coord);
A pointer to a YaspGrid::Entity.
Definition: yaspgridentitypointer.hh:16
Entity _entity
use default assignment operator
Definition: yaspgridentitypointer.hh:77
YaspHierarchicIterator enables iteration over son entities of codim 0.
Definition: yaspgridhierarchiciterator.hh:19
YaspHierarchicIterator(const YaspHierarchicIterator &it)
constructor
Definition: yaspgridhierarchiciterator.hh:56
void increment()
increment
Definition: yaspgridhierarchiciterator.hh:62
YaspHierarchicIterator(const YGLI &g, const I &it, int maxlevel)
constructor
Definition: yaspgridhierarchiciterator.hh:31
Dune namespace.
Definition: alignment.hh:11
Static tag representing a codimension.
Definition: dimension.hh:22