1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 // vi: set et ts=4 sw=2 sts=2: 3 #include "config.h" 4 5 #include <dune/grid/uggrid.hh> 6 #include <dune/grid/uggrid/uggridhieriterator.hh> 7 8 namespace Dune { 9 10 //*************************************************************** 11 // 12 // --UGGridHierarchicIterator 13 // --HierarchicIterator 14 // 15 //*************************************************************** 16 17 template<class GridImp> increment()18void UGGridHierarchicIterator<GridImp>::increment() 19 { 20 if (elementStack_.empty()) 21 return; 22 23 const int dim = GridImp::dimension; 24 25 const typename UG_NS<dim>::Element* oldTarget = elementStack_.top(); 26 elementStack_.pop(); 27 28 // Traverse the tree no deeper than maxlevel 29 if (UG_NS<dim>::myLevel(oldTarget) < maxlevel_) { 30 31 typename UG_NS<dim>::Element* sonList[UG_NS<dim>::MAX_SONS]; 32 UG_NS<dim>::GetSons(oldTarget, sonList); 33 34 // Load sons of old target onto the iterator stack 35 for (int i=0; i<UG_NS<dim>::nSons(oldTarget); i++) 36 elementStack_.push(sonList[i]); 37 38 } 39 40 if (elementStack_.empty()) 41 this->entity_.impl().setToTarget(nullptr,nullptr); 42 else 43 this->entity_.impl().setToTarget(elementStack_.top(),gridImp_); 44 45 } 46 47 ///////////////////////////////////////////////////////////////////////////////// 48 // Explicit template instantiations 49 ///////////////////////////////////////////////////////////////////////////////// 50 51 template class UGGridHierarchicIterator<const UGGrid<2> >; 52 template class UGGridHierarchicIterator<const UGGrid<3> >; 53 54 } /* namespace Dune */ 55