3 #ifndef DUNE_ALU3DITERATORS_HH
4 #define DUNE_ALU3DITERATORS_HH
22 template<
int codim,
class Comm >
26 typedef typename AccessIterator< HElementType >::Handle
IteratorType;
32 template<
int codim,
class Comm >
35 template<
class Comm >
41 template<
class Comm >
47 template<
class Comm >
53 template<
class Comm >
63 template<
class val_t >
65 :
public IteratorSTI< val_t >
70 virtual int size () = 0;
71 virtual void next () = 0;
72 virtual void first() = 0;
73 virtual int done ()
const = 0;
74 virtual val_t &
item ()
const = 0;
75 virtual IteratorSTI< val_t > *
clone ()
const { assert(
false); abort();
return 0; }
81 template<
int codim,
class Comm >
86 typedef pair< ElType *, HBndSegType * >
val_t;
89 template<
int codim, PartitionIteratorType pitype,
class Comm >
93 template< PartitionIteratorType pitype,
class Comm >
99 typedef ALU3DSPACE LevelIterator< ElType > IteratorType;
109 template<
class Gr
idImp >
111 : it_( grid.myGrid(), level ),
112 elem_( (ElType *) 0, (HBndSegType *) 0 )
117 : it_( org.it_ ), elem_(org.elem_)
120 int size () {
return it_->size(); }
123 int done ()
const {
return it_->done(); }
127 elem_.first = & it_->item();
133 template< PartitionIteratorType pitype,
class Comm >
139 #ifdef ALUGRID_PERIODIC_BOUNDARY
140 typedef ALU3DSPACE any_has_level_periodic< ElType > StopRule_t;
141 typedef GridIterator< ElType, StopRule_t > IteratorType;
143 typedef ALU3DSPACE LevelIterator< ElType > IteratorType;
154 template<
class Gr
idImp >
156 #ifdef ALUGRID_PERIODIC_BOUNDARY
157 : it_( grid.myGrid(), StopRule_t(level) ),
159 : it_( grid.myGrid(), level ),
161 elem_( (ElType *) 0, (HBndSegType*) 0 )
166 : it_( org.it_ ), elem_(org.elem_)
169 int size () {
return it_->size(); }
172 int done ()
const {
return it_->done(); }
176 elem_.first = & it_->item();
184 template< PartitionIteratorType pitype,
class Comm >
193 VertexListType & vxList_;
203 template<
class Gr
idImp >
205 : vxList_ ( grid.getVertexList( level ) ),
207 size_( vxList_.size() ),
208 elem_( (ElType *) 0, (HBndSegType *) 0 )
215 : vxList_(org.vxList_) , count_(org.count_) , size_(org.size_)
225 if( done () ) return ;
231 int done ()
const {
return (count_ >= size_) ? 1 : 0; }
236 assert( elem_.first );
241 template<
int codim, PartitionIteratorType pitype,
class Comm >
250 template< PartitionIteratorType pitype,
class Comm >
256 typedef LeafIterator< ElType > IteratorType;
269 template<
class Gr
idImp >
271 : it_( grid.myGrid() ),
272 elem_( (ElType *) 0, (HBndSegType *) 0 )
277 : it_( org.it_ ), elem_(org.elem_)
280 int size () {
return it_->size(); }
283 int done ()
const {
return it_->done(); }
287 elem_.first = & it_->item();
292 template<
class ElType, PartitionIteratorType pitype,
class Comm >
301 #if ALU3DGRID_PARALLEL
302 template<
class ElType >
305 typedef is_interior_leaf_entity< ElType >
StopRule_t;
307 #endif // #if ALU3DGRID_PARALLEL
310 template< PartitionIteratorType pitype,
class Comm >
317 typedef GridIterator< ElType, StopRule_t > IteratorType;
328 template<
class Gr
idImp >
330 : it_( grid.myGrid(), StopRule_t() ),
331 elem_( (ElType *) 0, (HBndSegType *) 0 )
336 : it_( org.it_ ), elem_(org.elem_) {}
341 int size () {
return it_->size(); }
344 int done ()
const {
return it_->done(); }
348 elem_.first = & it_->item();
353 template< PartitionIteratorType pitype,
class Comm >
360 typedef GridIterator< ElType, StopRule_t > IteratorType;
373 template<
class Gr
idImp >
375 : it_( grid.myGrid(), StopRule_t() ),
376 elem_( (ElType *) 0, (HBndSegType *) 0 )
381 : it_( org.it_ ), elem_(org.elem_) {}
383 int size () {
return it_->size(); }
386 int done ()
const {
return it_->done(); }
390 elem_.first = & it_->item();
397 template< PartitionIteratorType pitype,
class Comm >
408 LeafVertexListType & vxList_;
420 template<
class Gr
idImp >
422 : vxList_( grid.getLeafVertexList() ),
424 size_( vxList_.size() ),
425 elem_( (ElType *) 0, (HBndSegType *) 0 ),
433 : vxList_(org.vxList_)
434 , count_(org.count_) , size_(org.size_)
455 int done ()
const {
return (count_ >= size_) ? 1 : 0; }
459 assert( elem_.first );
463 val_t & getItem ()
const
472 if( done() ) return ;
473 if( getItem().first == 0)
480 assert( elem_.first );
481 if(! rule_( elem_.first ) )
490 #if ALU3DGRID_PARALLEL
491 template<
int codim >
492 class LeafLevelIteratorTTProxy
499 typedef IteratorSTI< ElType > IteratorType;
500 IteratorType * inner_;
501 IteratorType * outer_;
505 LeafLevelIteratorTTProxy( GitterImplType & gitter ,
int link )
507 pair < IteratorSTI< ElType > * , IteratorSTI< ElType > * >
508 p = gitter.leafBorderIteratorTT( (ElType *) 0 , link );
515 LeafLevelIteratorTTProxy( GitterImplType & gitter ,
int link ,
int level )
517 pair < IteratorSTI< ElType > * , IteratorSTI< ElType > * >
518 p = gitter.levelBorderIteratorTT( (ElType *) 0 , link , level );
524 LeafLevelIteratorTTProxy(
const LeafLevelIteratorTTProxy & org )
525 : inner_(org.inner_->clone())
526 , outer_(org.outer_->clone())
529 ~LeafLevelIteratorTTProxy()
535 IteratorType & inner () { assert(inner_);
return *inner_; }
536 IteratorType & outer () { assert(outer_);
return *outer_; }
547 class ALU3dGridGhostIterator
548 :
public IteratorWrapperInterface< LeafValType >
557 GitterImplType & gitter_;
562 typedef LeafLevelIteratorTTProxy< 1 > IteratorType;
564 IteratorType * iterTT_;
566 typedef IteratorSTI < ElType > InnerIteratorType;
567 InnerIteratorType * it_;
577 typedef LeafValType val_t;
582 const bool ghostCellsEnabled_ ;
584 typedef ElementPllXIF_t ItemType;
586 template<
class Gr
idImp >
587 ALU3dGridGhostIterator (
const GridImp &grid,
int level,
const int nlinks )
588 : gitter_( grid.myGrid() ),
593 elem_( (HElementType *) 0, (HBndSegType *) 0 ),
594 ghostCellsEnabled_( grid.ghostCellsEnabled() )
597 ALU3dGridGhostIterator (
const ALU3dGridGhostIterator & org)
598 : gitter_(org.gitter_)
599 , iterTT_(0) , it_(0)
604 , ghostCellsEnabled_( org.ghostCellsEnabled_ )
608 iterTT_ =
new IteratorType ( *org.iterTT_ );
609 usingInner_ = org.usingInner_;
612 assert( ! org.it_->done() );
613 it_ = (usingInner_) ? &( iterTT_->inner() ) : &( iterTT_->outer() );
618 ~ALU3dGridGhostIterator ()
624 virtual IteratorType * newIterator()
626 return new IteratorType ( gitter_, link_ );
629 void removeIterators()
631 if(iterTT_)
delete iterTT_;
637 void createIterator()
639 if (usingInner_) checkInnerOuter();
648 iterTT_ = newIterator();
651 if (!it_) createIterator();
656 void checkInnerOuter()
662 it_ = &( iterTT_->inner() );
663 InnerIteratorType & it = iterTT_->inner();
668 pair < ElementPllXIF_t *, int > p = it.item ().accessPllX ().accessOuterPllX () ;
669 pair< HElementType *, HBndSegType * > elems( (HElementType *)0, (HBndSegType *)0 );
670 p.first->getAttachedElement(elems);
672 assert( elems.first || elems.second );
682 InnerIteratorType & out = iterTT_->outer();
686 pair < ElementPllXIF_t *, int > p = out.item ().accessPllX ().accessOuterPllX () ;
687 pair< HElementType *, HBndSegType * > elems( (HElementType *)0, (HBndSegType *)0 );
688 p.first->getAttachedElement(elems);
690 assert( elems.second );
698 virtual void checkLeafEntity ()
705 HBndSegType * pll = el.second;
710 if ( ! pll->isLeafEntity() ) next();
733 if( !it_->done() ) it_->next();
736 if( it_->done() ) createIterator();
744 if( ghostCellsEnabled_ )
751 if( it_ ) assert( !it_->done());
757 assert( (link_ >= nl_) ? (it_ == 0) : 1 );
758 return ((link_ >= nl_ || !it_ ) ? 1 : 0);
761 val_t & item ()
const
764 pair < ElementPllXIF_t *, int > p = it_->item ().accessPllX ().accessOuterPllX () ;
765 pair < HElementType * , HBndSegType * > p2;
766 p.first->getAttachedElement(p2);
768 elem_.second = p2.second;
778 :
public ALU3dGridGhostIterator
781 typedef LeafLevelIteratorTTProxy<1> IteratorType;
782 IteratorType * newIterator()
784 return new IteratorType ( this->gitter_, this->link_ );
787 void checkLeafEntity ()
791 if(! this->it_->done())
793 val_t & el = this->item();
794 HBndSegType * pll = el.second;
799 if ( ! pll->isLeafEntity() ) this->next();
805 template <
class Gr
idImp>
806 ALU3dGridLeafIteratorWrapper(
const GridImp & grid,
int level ,
const int nlinks )
807 : ALU3dGridGhostIterator(grid,level,nlinks) {}
809 ALU3dGridLeafIteratorWrapper(
const ALU3dGridLeafIteratorWrapper & org)
810 : ALU3dGridGhostIterator(org) {}
816 :
public ALU3dGridGhostIterator
821 typedef LeafLevelIteratorTTProxy<1> IteratorType;
822 IteratorType * newIterator()
825 return new IteratorType ( this->gitter_, this->link_ , level_ );
829 void checkLeafEntity ()
833 if(! this->it_->done())
835 val_t & el = this->item();
838 HBndSegType & pll = *(el.second);
845 if( pll.ghostLevel() != level_ ) this->next();
852 template <
class Gr
idImp>
853 ALU3dGridLevelIteratorWrapper(
const GridImp & grid,
int level ,
const int nlinks )
854 : ALU3dGridGhostIterator(grid,level,nlinks)
855 , level_(level) , mxl_(grid.maxLevel()){}
857 ALU3dGridLevelIteratorWrapper(
const ALU3dGridLevelIteratorWrapper & org)
858 : ALU3dGridGhostIterator(org) , level_(org.level_) , mxl_(org.mxl_){}
866 template<
class Gr
idImp,
int cd >
869 template<
class Gr
idImp >
870 struct GetItem< GridImp, 1 >
873 enum { elType = GridImp::elementType };
875 typedef typename GridImp::MPICommunicatorType Comm;
883 return el.myhface3( i );
888 return el.myhface4( i );
891 static ItemType *getItem ( HElementType &el,
int i )
893 return getItemFromEl( static_cast< GEOElementType & >( el ), i );
896 static int numItems ()
902 template<
class Gr
idImp >
903 struct GetItem< GridImp, 2 >
906 enum { elType = GridImp::elementType };
908 typedef typename GridImp::MPICommunicatorType Comm;
914 static ItemType *getItem ( HElementType &el,
int i )
916 return static_cast< GEOElementType &
>( el ).myhedge1( i );
919 static int numItems ()
925 template<
class Gr
idImp >
926 struct GetItem< GridImp, 3 >
929 enum { elType = GridImp::elementType };
931 typedef typename GridImp::MPICommunicatorType Comm;
937 static ItemType *getItem ( HElementType &el,
int i )
939 return static_cast< GEOElementType &
>( el ).myvertex( i );
942 static int numItems ()
950 template<
int codim >
951 class ALU3dGridGhostIteratorHigherCodim
952 :
public IteratorWrapperInterface< typename IteratorElType< codim, MPI_Comm >::val_t >
958 typedef typename IteratorElType< codim, MPI_Comm >::ElType ElType;
959 typedef typename IteratorElType< codim, MPI_Comm >::val_t val_t;
962 template< Dune::ALU3dGr
idElementType elType,
int cd >
965 template< Dune::ALU3dGr
idElementType elType >
966 struct SelectVector< elType, 1 >
970 static const vector< int > &getNotOnItemVector (
int face )
972 return GEOElementType::facesNotOnFace( face );
976 template< Dune::ALU3dGr
idElementType elType >
977 struct SelectVector< elType, 2 >
980 static const vector< int > &getNotOnItemVector(
int face )
982 return GEOElementType::edgesNotOnFace( face );
986 template< Dune::ALU3dGr
idElementType elType >
987 struct SelectVector< elType, 3 >
990 static const vector< int > &getNotOnItemVector (
int face )
992 return GEOElementType::verticesNotOnFace( face );
996 typedef ElType *getItemFunc_t ( HElementType &el,
int i );
1000 GhostItemListType &ghList_;
1001 typedef typename GhostItemListType :: IteratorType IteratorType;
1004 mutable val_t elem_;
1005 mutable size_t count_;
1006 const bool ghostCellsEnabled_ ;
1009 template<
class GhostElementIteratorImp,
class Gr
idImp >
1010 ALU3dGridGhostIteratorHigherCodim ( GhostElementIteratorImp *,
const GridImp &grid,
1011 int level,
const int nlinks, GhostItemListType &ghList )
1012 : ghList_( ghList ),
1013 elem_( (ElType *) 0, (HBndSegType *) 0 ),
1015 ghostCellsEnabled_( grid.ghostCellsEnabled() )
1017 if( ! ghostCellsEnabled_ )
1019 count_ = ghList_.getItemList().size() ;
1023 if( ! ghList_.up2Date() )
1025 GhostElementIteratorImp ghostIter(grid,level,nlinks);
1026 updateGhostList(grid,ghostIter,ghList_);
1030 ALU3dGridGhostIteratorHigherCodim(
const ALU3dGridGhostIteratorHigherCodim & org)
1031 : ghList_( org.ghList_ )
1033 , count_(org.count_)
1034 , ghostCellsEnabled_(org.ghostCellsEnabled_)
1037 int size () {
return ghList_.getItemList().size(); }
1038 void first() {
if( ghostCellsEnabled_ ) count_ = 0;}
1039 void next () { ++count_; }
1040 int done ()
const {
return (count_ >= ghList_.getItemList().size() ? 1 : 0); }
1041 val_t & item ()
const
1044 void * item = ghList_.getItemList()[count_];
1045 elem_.first = ((ElType * ) item);
1046 assert( elem_.first );
1051 template <
class Gr
idImp,
class GhostElementIteratorImp>
1052 void updateGhostList(
const GridImp & grid, GhostElementIteratorImp & ghostIter, GhostItemListType & ghList)
1055 for( ghostIter.first(); !ghostIter.done(); ghostIter.next() )
1060 const int numItems = SelectVector<GridImp::elementType,codim>::getNotOnItemVector(0).size();
1061 const int maxSize = numItems * count;
1063 ghList.getItemList().reserve(maxSize);
1064 ghList.getItemList().resize(0);
1065 map< int , int > visited;
1067 const map<int,int>::iterator visitedEnd = visited.end();
1068 for( ghostIter.first(); !ghostIter.done(); ghostIter.next() )
1070 GhostPairType ghPair = ghostIter.item().second->getGhost();
1071 const vector<int> & notOnFace = SelectVector<GridImp::elementType,codim>::
1072 getNotOnItemVector(ghPair.second);
1073 for(
int i=0; i<numItems; ++i)
1075 ElType * item = GetItem<GridImp,codim>::getItem( *(ghPair.first) , notOnFace[i] );
1076 int idx = item->getIndex();
1077 if( visited.find(idx) == visitedEnd )
1079 ghList.getItemList().push_back( (
void *) item );
1084 ghList.markAsUp2Date();
1091 :
public ALU3dGridGhostIteratorHigherCodim< 1 >
1094 typedef ALU3dGridLeafIteratorWrapper< 0, Dune::Ghost_Partition, MPI_Comm > GhostElementIteratorType;
1097 template <
class Gr
idImp>
1098 ALU3dGridLeafIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1099 : ALU3dGridGhostIteratorHigherCodim<codim>((GhostElementIteratorType *) 0,grid,level,nlinks,grid.getGhostLeafList(codim)) {}
1101 ALU3dGridLeafIteratorWrapper (
const ALU3dGridLeafIteratorWrapper & org )
1102 : ALU3dGridGhostIteratorHigherCodim<codim>(org) {}
1108 :
public ALU3dGridGhostIteratorHigherCodim< 2 >
1111 typedef ALU3dGridLeafIteratorWrapper< 0, Dune::Ghost_Partition, MPI_Comm > GhostElementIteratorType;
1114 template <
class Gr
idImp>
1115 ALU3dGridLeafIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1116 : ALU3dGridGhostIteratorHigherCodim<codim>((GhostElementIteratorType *) 0,grid,level,nlinks,grid.getGhostLeafList(codim)) {}
1118 ALU3dGridLeafIteratorWrapper (
const ALU3dGridLeafIteratorWrapper & org )
1119 : ALU3dGridGhostIteratorHigherCodim<codim>(org) {}
1125 :
public ALU3dGridGhostIteratorHigherCodim< 3 >
1128 typedef ALU3dGridLeafIteratorWrapper< 0, Dune::Ghost_Partition, MPI_Comm > GhostElementIteratorType;
1131 template <
class Gr
idImp>
1132 ALU3dGridLeafIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1133 : ALU3dGridGhostIteratorHigherCodim<codim>((GhostElementIteratorType *) 0,grid,level,nlinks,grid.getGhostLeafList(codim)) {}
1135 ALU3dGridLeafIteratorWrapper (
const ALU3dGridLeafIteratorWrapper & org )
1136 : ALU3dGridGhostIteratorHigherCodim<codim>(org) {}
1142 :
public ALU3dGridGhostIteratorHigherCodim< 1 >
1145 typedef ALU3dGridLevelIteratorWrapper< 0, Dune::Ghost_Partition, MPI_Comm > GhostElementIteratorType;
1148 template <
class Gr
idImp>
1149 ALU3dGridLevelIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1150 : ALU3dGridGhostIteratorHigherCodim<codim>((GhostElementIteratorType *) 0,grid,level,nlinks,grid.getGhostLevelList(codim,level)) {}
1152 ALU3dGridLevelIteratorWrapper (
const ALU3dGridLevelIteratorWrapper & org )
1153 : ALU3dGridGhostIteratorHigherCodim<codim>(org) {}
1159 :
public ALU3dGridGhostIteratorHigherCodim< 2 >
1162 typedef ALU3dGridLevelIteratorWrapper< 0, Dune::Ghost_Partition, MPI_Comm > GhostElementIteratorType;
1165 template <
class Gr
idImp>
1166 ALU3dGridLevelIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1167 : ALU3dGridGhostIteratorHigherCodim<codim>((GhostElementIteratorType *) 0,grid,level,nlinks,grid.getGhostLevelList(codim,level)) {}
1169 ALU3dGridLevelIteratorWrapper (
const ALU3dGridLevelIteratorWrapper & org )
1170 : ALU3dGridGhostIteratorHigherCodim<codim>(org) {}
1176 :
public ALU3dGridGhostIteratorHigherCodim< 3 >
1179 typedef ALU3dGridLevelIteratorWrapper< 0, Dune::Ghost_Partition, MPI_Comm > GhostElementIteratorType;
1182 template <
class Gr
idImp>
1183 ALU3dGridLevelIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1184 : ALU3dGridGhostIteratorHigherCodim<codim>((GhostElementIteratorType *) 0,grid,level,nlinks,grid.getGhostLevelList(codim,level)) {}
1186 ALU3dGridLevelIteratorWrapper (
const ALU3dGridLevelIteratorWrapper & org )
1187 : ALU3dGridGhostIteratorHigherCodim<codim>(org) {}
1193 :
public IteratorWrapperInterface< IteratorElType< 0, MPI_Comm >::val_t >
1196 typedef ALU3dGridLeafIteratorWrapper< codim, Dune::InteriorBorder_Partition, MPI_Comm > InteriorIteratorType;
1197 typedef ALU3dGridLeafIteratorWrapper< codim, Dune::Ghost_Partition, MPI_Comm > GhostIteratorType;
1200 typedef IteratorElType< codim, MPI_Comm >::val_t val_t;
1202 typedef AlignIterator< InteriorIteratorType, GhostIteratorType, val_t > IteratorType;
1207 template <
class Gr
idImp>
1208 ALU3dGridLeafIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1209 : iter_ ( InteriorIteratorType ( grid, level, nlinks ) ,
1210 GhostIteratorType ( grid, level, nlinks ) )
1213 ALU3dGridLeafIteratorWrapper (
const ALU3dGridLeafIteratorWrapper & org )
1214 : iter_ (org.iter_) {}
1216 int size () {
return iter_.size(); }
1217 void next () { iter_.next(); }
1218 void first() { iter_.first(); }
1219 int done ()
const {
return iter_.done(); }
1220 val_t & item ()
const { assert( ! done() );
return iter_.item(); }
1226 :
public IteratorWrapperInterface< IteratorElType< 1, MPI_Comm >::val_t >
1229 typedef ALU3dGridLeafIteratorWrapper< codim, Dune::InteriorBorder_Partition, MPI_Comm > InteriorIteratorType;
1230 typedef ALU3dGridLeafIteratorWrapper< codim, Dune::Ghost_Partition, MPI_Comm > GhostIteratorType;
1233 typedef IteratorElType< codim, MPI_Comm >::val_t val_t;
1235 typedef AlignIterator< InteriorIteratorType, GhostIteratorType, val_t > IteratorType;
1240 template <
class Gr
idImp>
1241 ALU3dGridLeafIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1242 : iter_ ( InteriorIteratorType ( grid, level, nlinks ) ,
1243 GhostIteratorType ( grid, level, nlinks ) )
1246 ALU3dGridLeafIteratorWrapper (
const ALU3dGridLeafIteratorWrapper & org )
1247 : iter_ (org.iter_) {}
1249 int size () {
return iter_.size(); }
1250 void next () { iter_.next(); }
1251 void first() { iter_.first(); }
1252 int done ()
const {
return iter_.done(); }
1253 val_t & item ()
const { assert( ! done() );
return iter_.item(); }
1259 :
public IteratorWrapperInterface< IteratorElType< 2, MPI_Comm >::val_t >
1262 typedef ALU3dGridLeafIteratorWrapper< codim, Dune::InteriorBorder_Partition, MPI_Comm > InteriorIteratorType;
1263 typedef ALU3dGridLeafIteratorWrapper< codim, Dune::Ghost_Partition, MPI_Comm > GhostIteratorType;
1266 typedef IteratorElType< codim, MPI_Comm >::val_t val_t;
1268 typedef AlignIterator< InteriorIteratorType, GhostIteratorType, val_t > IteratorType;
1273 template <
class Gr
idImp>
1274 ALU3dGridLeafIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1275 : iter_ ( InteriorIteratorType ( grid, level, nlinks ) ,
1276 GhostIteratorType ( grid, level, nlinks ) )
1279 ALU3dGridLeafIteratorWrapper (
const ALU3dGridLeafIteratorWrapper & org )
1280 : iter_ (org.iter_) {}
1282 int size () {
return iter_.size(); }
1283 void next () { iter_.next(); }
1284 void first() { iter_.first(); }
1285 int done ()
const {
return iter_.done(); }
1286 val_t & item ()
const { assert( ! done() );
return iter_.item(); }
1292 :
public IteratorWrapperInterface< IteratorElType< 3, MPI_Comm >::val_t >
1295 typedef ALU3dGridLeafIteratorWrapper< codim, Dune::InteriorBorder_Partition, MPI_Comm > InteriorIteratorType;
1296 typedef ALU3dGridLeafIteratorWrapper< codim, Dune::Ghost_Partition, MPI_Comm > GhostIteratorType;
1299 typedef IteratorElType< codim, MPI_Comm >::val_t val_t;
1301 typedef AlignIterator< InteriorIteratorType, GhostIteratorType, val_t > IteratorType;
1306 template <
class Gr
idImp>
1307 ALU3dGridLeafIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1308 : iter_ ( InteriorIteratorType ( grid, level, nlinks ) ,
1309 GhostIteratorType ( grid, level, nlinks ) )
1312 ALU3dGridLeafIteratorWrapper (
const ALU3dGridLeafIteratorWrapper & org )
1313 : iter_ (org.iter_) {}
1315 int size () {
return iter_.size(); }
1316 void next () { iter_.next(); }
1317 void first() { iter_.first(); }
1318 int done ()
const {
return iter_.done(); }
1319 val_t & item ()
const { assert( ! done() );
return iter_.item(); }
1325 :
public IteratorWrapperInterface< LeafValType >
1327 typedef ALU3dGridLevelIteratorWrapper< 0, Dune::InteriorBorder_Partition, MPI_Comm > InteriorIteratorType;
1328 typedef ALU3dGridLevelIteratorWrapper< 0, Dune::Ghost_Partition, MPI_Comm > GhostIteratorType;
1331 typedef LeafValType val_t;
1333 typedef AlignIterator< InteriorIteratorType, GhostIteratorType, val_t > IteratorType;
1338 template <
class Gr
idImp>
1339 ALU3dGridLevelIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1340 : iter_ ( InteriorIteratorType ( grid, level, nlinks ) ,
1341 GhostIteratorType ( grid, level, nlinks ) )
1344 ALU3dGridLevelIteratorWrapper (
const ALU3dGridLevelIteratorWrapper & org)
1345 : iter_(org.iter_) {}
1347 int size () {
return iter_.size(); }
1348 void next () { iter_.next(); }
1349 void first() { iter_.first(); }
1350 int done ()
const {
return iter_.done(); }
1351 val_t & item ()
const { assert( ! done() );
return iter_.item(); }
1353 #endif // #if ALU3DGRID_PARALLEL
1357 template< PartitionIteratorType pitype,
class Comm >
1369 mutable val_t elem_;
1373 ItemListType & edgeList_;
1380 template<
class Gr
idImp >
1382 : elem_( (ElType *) 0, (HBndSegType *) 0 ),
1384 edgeList_( grid.getEdgeList( level ) ),
1388 updateEdgeList(grid,level,nlinks);
1394 , level_(org.level_)
1395 , edgeList_( org.edgeList_ )
1396 , count_(org.count_)
1410 int done ()
const {
return ((count_ >= edgeList_.
size()) ? 1 : 0); }
1414 assert( ! done () );
1415 elem_.first = ( (ElType *) edgeList_.
getItemList()[count_]);
1417 assert( elem_.first );
1422 template <
class Gr
idImp>
1423 void updateEdgeList(
const GridImp & grid,
int level,
int nlinks)
1426 typedef typename ElementLevelIterator :: val_t el_val_t;
1427 ElementLevelIterator iter(grid,level,nlinks);
1430 map < int , int > visited;
1432 for( iter.first(); ! iter.done(); iter.next() )
1437 GEOElementType *elem = 0;
1438 el_val_t & item = iter.item();
1441 elem =
static_cast< GEOElementType *
> (item.first);
1442 else if( item.second )
1443 elem =
static_cast< GEOElementType *
> (item.second->getGhost().first);
1446 for(
int e=0; e<numEdges; ++e)
1448 ElType * edge = elem->myhedge1(e);
1449 if( edge->isGhost() )
continue;
1451 int idx = edge->getIndex();
1452 if( visited.find(idx) == visited.end() )
1454 edgeList_.
getItemList().push_back( (
void *) edge );
1463 #if ALU3DGRID_PARALLEL
1467 :
public IteratorWrapperInterface< IteratorElType< 1, MPI_Comm >::val_t >
1470 typedef ALU3dGridLevelIteratorWrapper< codim, Dune::InteriorBorder_Partition, MPI_Comm > InteriorIteratorType;
1471 typedef ALU3dGridLevelIteratorWrapper< codim, Dune::Ghost_Partition, MPI_Comm > GhostIteratorType;
1474 typedef IteratorElType< codim, MPI_Comm >::val_t val_t;
1476 typedef AlignIterator< InteriorIteratorType, GhostIteratorType, val_t > IteratorType;
1481 template <
class Gr
idImp>
1482 ALU3dGridLevelIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1483 : iter_ ( InteriorIteratorType ( grid, level, nlinks ) ,
1484 GhostIteratorType ( grid, level, nlinks ) )
1487 ALU3dGridLevelIteratorWrapper (
const ALU3dGridLevelIteratorWrapper & org )
1488 : iter_ (org.iter_) {}
1490 int size () {
return iter_.size(); }
1491 void next () { iter_.next(); }
1492 void first() { iter_.first(); }
1493 int done ()
const {
return iter_.done(); }
1494 val_t & item ()
const { assert( ! done() );
return iter_.item(); }
1500 :
public IteratorWrapperInterface< IteratorElType< 2, MPI_Comm >::val_t >
1503 typedef ALU3dGridLevelIteratorWrapper< codim, Dune::InteriorBorder_Partition, MPI_Comm > InteriorIteratorType;
1504 typedef ALU3dGridLevelIteratorWrapper< codim, Dune::Ghost_Partition, MPI_Comm > GhostIteratorType;
1507 typedef IteratorElType< codim, MPI_Comm >::val_t val_t;
1509 typedef AlignIterator< InteriorIteratorType, GhostIteratorType, val_t > IteratorType;
1514 template <
class Gr
idImp>
1515 ALU3dGridLevelIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1516 : iter_ ( InteriorIteratorType ( grid, level, nlinks ) ,
1517 GhostIteratorType ( grid, level, nlinks ) )
1520 ALU3dGridLevelIteratorWrapper (
const ALU3dGridLevelIteratorWrapper & org )
1521 : iter_ (org.iter_) {}
1523 int size () {
return iter_.size(); }
1524 void next () { iter_.next(); }
1525 void first() { iter_.first(); }
1526 int done ()
const {
return iter_.done(); }
1527 val_t & item ()
const { assert( ! done() );
return iter_.item(); }
1533 :
public IteratorWrapperInterface < IteratorElType< 3, MPI_Comm >::val_t >
1536 typedef ALU3dGridLevelIteratorWrapper< codim, Dune::InteriorBorder_Partition, MPI_Comm > InteriorIteratorType;
1537 typedef ALU3dGridLevelIteratorWrapper< codim, Dune::Ghost_Partition, MPI_Comm > GhostIteratorType;
1540 typedef IteratorElType< codim, MPI_Comm >::val_t val_t;
1542 typedef AlignIterator< InteriorIteratorType, GhostIteratorType, val_t > IteratorType;
1547 template <
class Gr
idImp>
1548 ALU3dGridLevelIteratorWrapper (
const GridImp & grid,
int level ,
const int nlinks )
1549 : iter_ ( InteriorIteratorType ( grid, level, nlinks ) ,
1550 GhostIteratorType ( grid, level, nlinks ) )
1553 ALU3dGridLevelIteratorWrapper (
const ALU3dGridLevelIteratorWrapper & org )
1554 : iter_ (org.iter_) {}
1556 int size () {
return iter_.size(); }
1557 void next () { iter_.next(); }
1558 void first() { iter_.first(); }
1559 int done ()
const {
return iter_.done(); }
1560 val_t & item ()
const { assert( ! done() );
return iter_.item(); }
1562 #endif // #if ALU3DGRID_PARALLEL
1566 #endif // #ifndef DUNE_ALU3DITERATORS_HH
val_t & item() const
Definition: alu3diterators.hh:284
Definition: alu3dinclude.hh:329
Dune::ALU3dBasicImplTraits< Comm >::HEdgeType ElementType
Definition: alu3diterators.hh:50
ALU3dGridLevelIteratorWrapper(const GridImp &grid, int level, const int nlinks)
Definition: alu3diterators.hh:155
val_t elem_
Definition: alu3diterators.hh:151
ALU3dGridLevelIteratorWrapper(const GridImp &grid, int level, const int nlinks)
Definition: alu3diterators.hh:1381
Dune::ALU3dBasicImplTraits< Comm >::VertexType ElementType
Definition: alu3diterators.hh:56
int done() const
Definition: alu3diterators.hh:455
IteratorElType< 1, Comm >::val_t val_t
Definition: alu3diterators.hh:150
void first()
Definition: alu3diterators.hh:230
ALU3dGridLevelIteratorWrapper(const ALU3dGridLevelIteratorWrapper &org)
Definition: alu3diterators.hh:1392
Definition: alu3dinclude.hh:201
Definition: alu3diterators.hh:82
IteratorElType< 0, Comm >::val_t val_t
Definition: alu3diterators.hh:262
void next()
Definition: alu3diterators.hh:281
IteratorElType< 0, Comm >::val_t val_t
Definition: alu3diterators.hh:105
bool up2Date() const
Definition: alu3dinclude.hh:343
void next()
Definition: alu3diterators.hh:121
Definition: alu3diterators.hh:90
only ghost entities
Definition: gridenums.hh:140
int size()
Definition: alu3diterators.hh:120
Dune::ALU3dBasicImplTraits< Comm >::GEOEdgeType GEOEdgeType
Definition: alu3diterators.hh:1364
VertexListType & getItemList()
Definition: alu3dinclude.hh:353
int size()
Definition: alu3diterators.hh:1399
Dune::ALU3dBasicImplTraits< Comm >::HBndSegType HBndSegType
Definition: alu3diterators.hh:1363
Dune::ALU3dBasicImplTraits< Comm >::HElementType HElementType
Definition: alu3diterators.hh:25
int size()
Definition: alu3diterators.hh:220
void first()
Definition: alu3diterators.hh:385
ALU3dGridLeafIteratorWrapper(const ALU3dGridLeafIteratorWrapper &org)
Definition: alu3diterators.hh:335
only interior entities
Definition: gridenums.hh:135
val_t & item() const
Definition: alu3diterators.hh:232
ALU3dGridLeafIteratorWrapper(const GridImp &grid, int level, const int links)
Definition: alu3diterators.hh:270
~ALU3dGridLeafIteratorWrapper()
Definition: alu3diterators.hh:338
int size()
Definition: alu3diterators.hh:169
Definition: alu3dinclude.hh:43
void first()
Definition: alu3diterators.hh:1405
void next()
Definition: alu3diterators.hh:384
void next()
if level of item is larger then walk level, go next
Definition: alu3diterators.hh:223
val_t elem_
Definition: alu3diterators.hh:200
Dune::ALU3dBasicImplTraits< Comm >::HFaceType ElementType
Definition: alu3diterators.hh:44
val_t & item() const
Definition: alu3diterators.hh:456
Definition: alu3diterators.hh:33
void first()
Definition: alu3diterators.hh:171
val_t & item() const
Definition: alu3diterators.hh:345
int size()
Definition: alu3diterators.hh:383
val_t & item() const
Definition: alu3diterators.hh:173
ALU3dGridLevelIteratorWrapper(const ALU3dGridLevelIteratorWrapper &org)
Definition: alu3diterators.hh:116
Definition: alu3diterators.hh:23
is_leaf_entity< ElType > StopRule_t
Definition: alu3diterators.hh:295
VertexListType::iterator IteratorType
Definition: alu3dinclude.hh:335
const StopRule_t rule_
Definition: alu3diterators.hh:417
void next()
Definition: alu3diterators.hh:1400
int done() const
Definition: alu3diterators.hh:344
Definition: alu3dinclude.hh:296
std::pair< VertexType *, int > ItemType
Definition: alu3dinclude.hh:333
all entities
Definition: gridenums.hh:139
val_t & item() const
Definition: alu3diterators.hh:124
Different resources needed by all grid implementations.
ALU3dGridLeafIteratorWrapper(const GridImp &grid, int level, const int links)
Definition: alu3diterators.hh:329
Dune::ALU3dBasicImplTraits< Comm >::HBndSegType HBndSegType
Definition: alu3diterators.hh:85
ALU3dGridLevelIteratorWrapper(const GridImp &grid, int level, const int nlinks)
Definition: alu3diterators.hh:204
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:134
Definition: alu3diterators.hh:64
IteratorElType< 2, Comm >::val_t val_t
Definition: alu3diterators.hh:1366
val_t & item() const
Definition: alu3diterators.hh:387
AccessIterator< HElementType >::Handle IteratorType
Definition: alu3diterators.hh:26
ALU3dGridLeafIteratorWrapper(const GridImp &grid, int level, const int links)
Definition: alu3diterators.hh:374
Definition: alu3dinclude.hh:373
void next()
if level of item is larger then walk level, go next
Definition: alu3diterators.hh:443
ALU3dGridLeafIteratorWrapper(const GridImp &grid, int level, const int nlinks)
Definition: alu3diterators.hh:421
IteratorElType< 3, Comm >::val_t val_t
Definition: alu3diterators.hh:199
ALUHElementType< codim, Comm >::ElementType ElType
Definition: alu3diterators.hh:84
int size()
Definition: alu3diterators.hh:280
size_t size() const
Definition: alu3dinclude.hh:382
IteratorElType< 2, Comm >::val_t val_t
Definition: alu3diterators.hh:363
VertexListType::iterator IteratorType
Definition: alu3dinclude.hh:301
void next()
Definition: alu3diterators.hh:170
#define ALU3DSPACE
Definition: alu3dinclude.hh:26
int done() const
Definition: alu3diterators.hh:1410
int size()
Definition: alu3diterators.hh:341
bool up2Date() const
Definition: alu3dinclude.hh:384
ALU3dGridLeafIteratorWrapper(const ALU3dGridLeafIteratorWrapper &org)
Definition: alu3diterators.hh:380
ALU3dGridLeafIteratorWrapper(const ALU3dGridLeafIteratorWrapper &org)
Definition: alu3diterators.hh:432
ALU3dGridLevelIteratorWrapper(const GridImp &grid, int level, const int nlinks)
Definition: alu3diterators.hh:110
virtual val_t & item() const =0
void next()
Definition: alu3diterators.hh:342
void markAsUp2Date()
Definition: alu3dinclude.hh:387
Definition: topology.hh:16
virtual IteratorSTI< val_t > * clone() const
Definition: alu3diterators.hh:75
void first()
Definition: alu3diterators.hh:343
VertexListType & getItemList()
Definition: alu3dinclude.hh:319
ALUHElementType< 2, Comm >::ElementType ElType
Definition: alu3diterators.hh:1362
int done() const
Definition: alu3diterators.hh:283
ElementType
Definition: alu2dinclude.hh:55
bool up2Date() const
Definition: alu3dinclude.hh:309
val_t elem_
Definition: alu3diterators.hh:416
pair< ElType *, HBndSegType * > val_t
Definition: alu3diterators.hh:86
void first()
Definition: alu3diterators.hh:282
Dune::ALU3dBasicImplTraits< Comm >::HElementType ElementType
Definition: alu3diterators.hh:38
ALU3dGridLeafIteratorWrapper(const ALU3dGridLeafIteratorWrapper &org)
Definition: alu3diterators.hh:276
ALU3dGridLevelIteratorWrapper(const ALU3dGridLevelIteratorWrapper &org)
Definition: alu3diterators.hh:214
int done() const
Definition: alu3diterators.hh:123
IteratorElType< 1, Comm >::val_t val_t
Definition: alu3diterators.hh:323
val_t elem_
Definition: alu3diterators.hh:106
Definition: alu3dinclude.hh:67
Include standard header files.
Definition: agrid.hh:59
int done() const
Definition: alu3diterators.hh:231
int size()
Definition: alu3diterators.hh:440
ItemListType & getItemList()
Definition: alu3dinclude.hh:392
virtual ~IteratorWrapperInterface()
Definition: alu3diterators.hh:68
void first()
Definition: alu3diterators.hh:122
int done() const
Definition: alu3diterators.hh:386
Definition: alu3diterators.hh:293
val_t & item() const
Definition: alu3diterators.hh:1412
Dune::PartitionIteratorType PartitionIteratorType
Definition: alu3diterators.hh:78
void first()
Definition: alu3diterators.hh:450
virtual int done() const =0
Definition: alu3diterators.hh:242
IteratorElType< 3, Comm >::val_t val_t
Definition: alu3diterators.hh:415
ALU3dGridLevelIteratorWrapper(const ALU3dGridLevelIteratorWrapper &org)
Definition: alu3diterators.hh:165
int done() const
Definition: alu3diterators.hh:172