dune-grid
2.2.0
|
00001 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 00002 // vi: set et ts=8 sw=2 sts=2: 00003 00004 #ifndef DUNE_ALU3DGRIDITERATOR_HH 00005 #define DUNE_ALU3DGRIDITERATOR_HH 00006 00007 // System includes 00008 00009 // Dune includes 00010 #include <dune/grid/common/grid.hh> 00011 #include <dune/grid/alugrid/common/intersectioniteratorwrapper.hh> 00012 #include <dune/grid/alugrid/common/memory.hh> 00013 00014 // Local includes 00015 #include "alu3dinclude.hh" 00016 #include "topology.hh" 00017 #include "faceutility.hh" 00018 #include "alu3diterators.hh" 00019 00020 namespace Dune { 00021 // Forward declarations 00022 template<int cd, int dim, class GridImp> 00023 class ALU3dGridEntity; 00024 template<int cd, PartitionIteratorType pitype, class GridImp > 00025 class ALU3dGridLevelIterator; 00026 template<int cd, class GridImp > 00027 class ALU3dGridEntityPointer; 00028 template<int mydim, int coorddim, class GridImp> 00029 class ALU3dGridGeometry; 00030 template<class GridImp> 00031 class ALU3dGridHierarchicIterator; 00032 template<class GridImp> 00033 class ALU3dGridIntersectionIterator; 00034 template<int codim, PartitionIteratorType pitype, class GridImp> 00035 class ALU3dGridLeafIterator; 00036 template< ALU3dGridElementType, class > 00037 class ALU3dGrid; 00038 template< ALU3dGridElementType, class > 00039 class ALU3dGridFaceInfo; 00040 template< ALU3dGridElementType, class > 00041 class ALU3dGridGeometricFaceInfo; 00042 00043 //********************************************************************** 00044 // 00045 // --ALU3dGridIntersectionIterator 00046 // --IntersectionIterator 00054 template<class GridImp> 00055 class ALU3dGridIntersectionIterator 00056 //: public IntersectionIteratorDefaultImplementation <GridImp,ALU3dGridIntersectionIterator> 00057 { 00058 enum { dim = GridImp::dimension }; 00059 enum { dimworld = GridImp::dimensionworld }; 00060 00061 typedef typename GridImp::MPICommunicatorType Comm; 00062 00063 typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits; 00064 00065 typedef typename ImplTraits::HElementType HElementType ; 00066 typedef typename ImplTraits::HBndSegType HBndSegType; 00067 typedef typename ImplTraits::GEOElementType GEOElementType; 00068 typedef typename ImplTraits::IMPLElementType IMPLElementType; 00069 typedef typename ImplTraits::GEOFaceType GEOFaceType; 00070 typedef typename ImplTraits::NeighbourPairType NeighbourPairType; 00071 typedef typename ImplTraits::BNDFaceType BNDFaceType; 00072 00073 typedef typename ALU3dImplTraits< tetra, Comm >::GEOElementType GEOTetraElementType; 00074 typedef typename ALU3dImplTraits< hexa, Comm >::GEOElementType GEOHexaElementType; 00075 typedef typename ALU3dImplTraits< tetra, Comm >::BNDFaceType GEOTriangleBndType; 00076 typedef typename ALU3dImplTraits< hexa, Comm >::BNDFaceType GEOQuadBndType; 00077 00078 typedef ALU3dGridFaceInfo< GridImp::elementType, Comm > FaceInfoType; 00079 typedef typename std::auto_ptr< FaceInfoType > FaceInfoPointer; 00080 00081 typedef typename SelectType< 00082 tetra == GridImp::elementType, 00083 ALU3dGridGeometricFaceInfoTetra< Comm >, 00084 ALU3dGridGeometricFaceInfoHexa< Comm > >::Type GeometryInfoType; 00085 00086 typedef ElementTopologyMapping<GridImp::elementType> ElementTopo; 00087 typedef FaceTopologyMapping<GridImp::elementType> FaceTopo; 00088 00089 enum { numFaces = EntityCount<GridImp::elementType>::numFaces }; 00090 enum { numVerticesPerFace = 00091 EntityCount<GridImp::elementType>::numVerticesPerFace }; 00092 enum { numVertices = EntityCount<GridImp::elementType>::numVertices }; 00093 00094 typedef ALU3dGridIntersectionIterator<GridImp> ThisType; 00095 00096 friend class ALU3dGridEntity<0,dim,GridImp>; 00097 friend class IntersectionIteratorWrapper<GridImp,ThisType>; 00098 00099 protected: 00100 enum IntersectionIteratorType { IntersectionLeaf , IntersectionLevel, IntersectionBoth }; 00101 00102 typedef typename GridImp::Traits::template Codim< 1 >::GeometryImpl GeometryImpl; 00103 typedef typename GridImp::Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl; 00104 00105 public: 00106 typedef typename GridImp::GridObjectFactoryType FactoryType; 00107 00108 typedef typename GridImp::template Codim<0>::Entity Entity; 00109 typedef typename GridImp::template Codim<1>::Geometry Geometry; 00110 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry; 00111 00112 typedef ALU3dGridIntersectionIterator< GridImp > ImplementationType; 00114 typedef Dune::Intersection< GridImp, Dune::ALU3dGridIntersectionIterator > Intersection; 00115 00116 typedef FieldVector<alu3d_ctype, dimworld> NormalType; 00117 typedef ALU3dGridEntityPointer<0,GridImp> EntityPointer; 00118 00119 typedef ALUMemoryProvider< ThisType > StorageType; 00120 00123 ALU3dGridIntersectionIterator(const FactoryType& factory, 00124 HElementType *el, 00125 int wLevel,bool end=false); 00126 00127 ALU3dGridIntersectionIterator(const FactoryType& factory, int wLevel); 00128 00130 ALU3dGridIntersectionIterator(const ALU3dGridIntersectionIterator<GridImp> & org); 00131 00133 void assign(const ALU3dGridIntersectionIterator<GridImp> & org); 00134 00135 const Intersection &dereference () const 00136 { 00137 return reinterpret_cast< const Intersection & >( *this ); 00138 } 00139 00141 bool equals (const ALU3dGridIntersectionIterator<GridImp> & i) const; 00142 00144 void increment (); 00145 00147 EntityPointer outside() const; 00148 00150 EntityPointer inside() const; 00151 00153 bool boundary () const; 00154 00156 bool neighbor () const; 00157 00159 bool levelNeighbor () const; 00160 00162 bool leafNeighbor () const; 00163 00165 int boundaryId () const; 00166 00168 size_t boundarySegmentIndex() const; 00169 00174 LocalGeometry geometryInInside () const; 00175 00180 Geometry geometry () const; 00181 00183 GeometryType type () const; 00184 00187 int indexInInside () const; 00188 00192 LocalGeometry geometryInOutside () const; 00193 00196 int indexInOutside () const; 00197 00199 int twistInSelf() const { return twistInInside(); } 00200 00202 int twistInNeighbor() const { return twistInOutside(); } 00203 00205 int twistInInside() const; 00206 00208 int twistInOutside() const; 00209 00212 NormalType & unitOuterNormal (const FieldVector<alu3d_ctype, dim-1>& local) const ; 00213 00216 NormalType & outerNormal (const FieldVector<alu3d_ctype, dim-1>& local) const; 00217 00220 NormalType & integrationOuterNormal (const FieldVector<alu3d_ctype, dim-1>& local) const; 00221 00223 int level () const; 00224 00225 int outsideLevel () const { return connector_.outsideLevel(); } 00226 00228 bool conforming () const 00229 { 00230 return (connector_.conformanceState() == FaceInfoType::CONFORMING); 00231 } 00232 00234 const GEOFaceType& getItem() const { return connector_.face(); } 00235 00236 protected: 00237 // set interator to end iterator 00238 void done () ; 00239 template< class EntityType > void done ( const EntityType &en ) { done(); } 00240 00241 // reset IntersectionIterator to first neighbour 00242 void setFirstItem(const HElementType & elem, int wLevel); 00243 00244 // reset IntersectionIterator to first neighbour 00245 void setInteriorItem(const HElementType & elem, 00246 const BNDFaceType& bnd, int wLevel); 00247 00248 // reset IntersectionIterator to first neighbour 00249 template <class EntityType> 00250 void first(const EntityType & en, int wLevel); 00251 00252 // set new face 00253 void setNewFace(const GEOFaceType& newFace); 00254 00255 private: 00256 // set new face (only LeafIntersectionIterator) 00257 void setGhostFace(const GEOFaceType& newFace); 00258 00259 protected: 00260 // generate local geometries 00261 void buildLocalGeometries() const; 00262 00263 // get the face corresponding to the index 00264 const typename ALU3dImplTraits< tetra, Comm >::GEOFaceType * 00265 getFace ( const GEOTriangleBndType &bnd, int index ) const; 00266 00267 // get the face corresponding to the index 00268 const typename ALU3dImplTraits< hexa, Comm >::GEOFaceType * 00269 getFace ( const GEOQuadBndType &bnd, int index ) const; 00270 00271 // get the face corresponding to the index 00272 const typename ALU3dImplTraits< tetra, Comm >::GEOFaceType * 00273 getFace ( const GEOTetraElementType &elem, int index ) const; 00274 00275 const typename ALU3dImplTraits< hexa, Comm >::GEOFaceType * 00276 getFace ( const GEOHexaElementType &elem, int index ) const; 00277 00280 mutable FaceInfoType connector_; 00281 mutable GeometryInfoType geoProvider_; // need to initialise 00282 00283 // reference to factory 00284 const FactoryType& factory_; 00285 00287 const IMPLElementType* item_; 00288 00290 const BNDFaceType* ghost_; 00291 00292 mutable int innerLevel_; 00293 mutable int index_; 00294 00295 mutable GeometryImpl intersectionGlobal_; 00296 mutable GeometryImpl intersectionSelfLocal_; 00297 mutable GeometryImpl intersectionNeighborLocal_; 00298 00299 // unit outer normal 00300 mutable NormalType unitOuterNormal_; 00301 00302 // true if end iterator 00303 bool done_; 00304 }; 00305 00306 template<class GridImp> 00307 class ALU3dGridLevelIntersectionIterator : 00308 public ALU3dGridIntersectionIterator<GridImp> 00309 { 00310 enum { dim = GridImp::dimension }; 00311 enum { dimworld = GridImp::dimensionworld }; 00312 00313 typedef typename GridImp::MPICommunicatorType Comm; 00314 00315 typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits; 00316 00317 typedef typename ImplTraits::HElementType HElementType ; 00318 typedef typename ImplTraits::GEOElementType GEOElementType; 00319 typedef typename ImplTraits::IMPLElementType IMPLElementType; 00320 typedef typename ImplTraits::GEOFaceType GEOFaceType; 00321 typedef typename ImplTraits::NeighbourPairType NeighbourPairType; 00322 typedef typename ImplTraits::BNDFaceType BNDFaceType; 00323 00324 typedef ALU3dGridFaceInfo< GridImp::elementType, Comm > FaceInfoType; 00325 typedef typename std::auto_ptr< FaceInfoType > FaceInfoPointer; 00326 00327 typedef typename SelectType< 00328 tetra == GridImp::elementType, 00329 ALU3dGridGeometricFaceInfoTetra< Comm >, 00330 ALU3dGridGeometricFaceInfoHexa< Comm > >::Type GeometryInfoType; 00331 00332 typedef ElementTopologyMapping<GridImp::elementType> ElementTopo; 00333 typedef FaceTopologyMapping<GridImp::elementType> FaceTopo; 00334 00335 enum { numFaces = EntityCount<GridImp::elementType>::numFaces }; 00336 enum { numVerticesPerFace = 00337 EntityCount<GridImp::elementType>::numVerticesPerFace }; 00338 enum { numVertices = EntityCount<GridImp::elementType>::numVertices }; 00339 00340 typedef ALU3dGridIntersectionIterator<GridImp> BaseType; 00341 typedef ALU3dGridLevelIntersectionIterator<GridImp> ThisType; 00342 00343 friend class ALU3dGridEntity<0,dim,GridImp>; 00344 friend class IntersectionIteratorWrapper<GridImp,ThisType>; 00345 protected: 00346 using BaseType :: item_; 00347 using BaseType :: ghost_; 00348 using BaseType :: innerLevel_; 00349 using BaseType :: index_; 00350 using BaseType :: connector_; 00351 using BaseType :: geoProvider_; 00352 using BaseType :: factory_; 00353 using BaseType :: done_; 00354 using BaseType :: boundary; 00355 using BaseType :: done ; 00356 using BaseType :: getFace; 00357 using BaseType :: neighbor ; 00358 00359 public: 00360 typedef typename GridImp::GridObjectFactoryType FactoryType; 00361 00362 //typedef Dune :: Intersection< const GridImp, ThisType > 00363 typedef ALUMemoryProvider< ThisType > StorageType; 00364 00367 ALU3dGridLevelIntersectionIterator(const FactoryType& factory, 00368 HElementType *el, 00369 int wLevel,bool end=false); 00370 00371 ALU3dGridLevelIntersectionIterator(const FactoryType& factory, int wLevel); 00372 00374 ALU3dGridLevelIntersectionIterator(const ThisType & org); 00375 00377 void assign(const ThisType & org); 00378 00380 void increment (); 00381 00382 // reset IntersectionIterator to first neighbour 00383 template <class EntityType> 00384 void first(const EntityType & en, int wLevel); 00385 00387 bool neighbor () const; 00388 00390 bool levelNeighbor () const; 00391 00393 bool leafNeighbor () const; 00394 00396 bool conforming () const 00397 { 00398 assert( !neighbor() || this->connector_.conformanceState() == FaceInfoType::CONFORMING ); 00399 return true; 00400 } 00401 private: 00402 // set new face 00403 void setNewFace(const GEOFaceType& newFace); 00404 00405 // reset IntersectionIterator to first neighbour 00406 void setFirstItem(const HElementType & elem, int wLevel); 00407 00408 // reset IntersectionIterator to first neighbour 00409 void setInteriorItem(const HElementType & elem, 00410 const BNDFaceType& bnd, int wLevel); 00411 00412 bool levelNeighbor_; 00413 bool isLeafItem_; 00414 }; 00415 00417 // 00418 // --IterationImpl 00419 // 00421 template <class InternalIteratorType > 00422 struct ALU3dGridTreeIterator 00423 { 00424 typedef typename InternalIteratorType :: val_t val_t; 00425 00426 // here the items level will do 00427 template <class GridImp, int codim> 00428 struct GetLevel 00429 { 00430 template <class ItemType> 00431 static int getLevel(const GridImp & grid, const ItemType & item, int level ) 00432 { 00433 assert( & item ); 00434 return (level < 0) ? item.level() : level; 00435 } 00436 }; 00437 00438 // level is not needed for codim = 0 00439 template <class GridImp> 00440 struct GetLevel<GridImp,0> 00441 { 00442 template <class ItemType> 00443 static int getLevel(const GridImp & grid, const ItemType & item, int level ) 00444 { 00445 return level; 00446 } 00447 }; 00448 00449 template <class GridImp> 00450 struct GetLevel<GridImp,3> 00451 { 00452 template <class ItemType> 00453 static int getLevel(const GridImp & grid, const ItemType & item, int level) 00454 { 00455 return (level < 0) ? grid.getLevelOfLeafVertex(item) : level; 00456 } 00457 }; 00458 00459 protected: 00460 // set iterator to first item 00461 template <class GridImp, class IteratorImp> 00462 void firstItem(const GridImp & grid, IteratorImp & it, int level ) 00463 { 00464 InternalIteratorType & iter = it.internalIterator(); 00465 iter.first(); 00466 if( ! iter.done() ) 00467 { 00468 assert( iter.size() > 0 ); 00469 setItem(grid,it,iter,level); 00470 } 00471 else 00472 { 00473 it.removeIter(); 00474 } 00475 } 00476 00477 // set the iterators entity to actual item 00478 template <class GridImp, class IteratorImp> 00479 void setItem (const GridImp & grid, IteratorImp & it, InternalIteratorType & iter, int level) 00480 { 00481 enum { codim = IteratorImp :: codimension }; 00482 val_t & item = iter.item(); 00483 assert( item.first || item.second ); 00484 if( item.first ) 00485 { 00486 it.updateEntityPointer( item.first , 00487 GetLevel<GridImp,codim>::getLevel(grid, *(item.first) , level) ); 00488 } 00489 else 00490 it.updateGhostPointer( *item.second ); 00491 } 00492 00493 // increment iterator 00494 template <class GridImp, class IteratorImp> 00495 void incrementIterator(const GridImp & grid, IteratorImp & it, int level) 00496 { 00497 // if iter_ is zero, then end iterator 00498 InternalIteratorType & iter = it.internalIterator(); 00499 00500 iter.next(); 00501 00502 if(iter.done()) 00503 { 00504 it.removeIter(); 00505 return ; 00506 } 00507 00508 setItem(grid,it,iter,level); 00509 return ; 00510 } 00511 }; 00512 00513 //********************************************************************** 00514 // 00515 // --ALU3dGridLevelIterator 00516 // --LevelIterator 00520 template<int cd, PartitionIteratorType pitype, class GridImp> 00521 class ALU3dGridLevelIterator 00522 : public ALU3dGridEntityPointer< cd, GridImp >, 00523 public ALU3dGridTreeIterator< ALU3DSPACE ALU3dGridLevelIteratorWrapper< cd, pitype, typename GridImp::MPICommunicatorType > > 00524 { 00525 enum { dim = GridImp::dimension }; 00526 enum { dimworld = GridImp::dimensionworld }; 00527 00528 typedef typename GridImp::MPICommunicatorType Comm; 00529 00530 friend class ALU3dGridEntity<3,dim,GridImp>; 00531 friend class ALU3dGridEntity<2,dim,GridImp>; 00532 friend class ALU3dGridEntity<1,dim,GridImp>; 00533 friend class ALU3dGridEntity<0,dim,GridImp>; 00534 friend class ALU3dGrid< GridImp::elementType, Comm >; 00535 00536 friend class ALU3dGridTreeIterator< ALU3DSPACE ALU3dGridLevelIteratorWrapper< cd, pitype, Comm > >; 00537 00538 public: 00539 typedef typename GridImp::GridObjectFactoryType FactoryType; 00540 00541 typedef typename GridImp::template Codim<cd>::Entity Entity; 00542 typedef ALU3dGridVertexList< Comm > VertexListType; 00543 00545 typedef ALU3dGridLevelIterator<cd,pitype,GridImp> ThisType; 00546 // the wrapper for the original iterator of the ALU3dGrid 00547 typedef typename ALU3DSPACE ALU3dGridLevelIteratorWrapper< cd, pitype, Comm > IteratorType; 00548 typedef IteratorType InternalIteratorType; 00549 typedef typename ALU3DSPACE IteratorElType< cd, Comm >::val_t val_t; 00550 00552 ALU3dGridLevelIterator(const FactoryType& factory, int level, bool); 00553 00555 ALU3dGridLevelIterator(const FactoryType& factory, int level); 00556 00558 ALU3dGridLevelIterator(const ThisType & org); 00559 00560 // destructor 00561 ~ALU3dGridLevelIterator(); 00562 00564 void increment (); 00565 00567 Entity & dereference () const; 00568 00570 void releaseEntity () {} 00571 00573 ThisType & operator = (const ThisType & org); 00574 private: 00576 void assign (const ThisType & org); 00577 00578 // actual level 00579 int level_; 00580 00581 // the internal iterator 00582 IteratorType * iter_ ; 00583 00584 // deletes iter_ 00585 void removeIter (); 00586 00587 IteratorType & internalIterator () 00588 { 00589 assert( iter_ ); 00590 return *iter_; 00591 } 00592 }; 00593 00594 //******************************************************************** 00595 // 00596 // --ALU3dGridLeafIterator 00597 // --LeafIterator 00598 // 00599 //******************************************************************** 00601 template<int cdim, PartitionIteratorType pitype, class GridImp> 00602 class ALU3dGridLeafIterator 00603 : public ALU3dGridEntityPointer< cdim, GridImp >, 00604 public ALU3dGridTreeIterator< ALU3DSPACE ALU3dGridLeafIteratorWrapper< cdim, pitype, typename GridImp::MPICommunicatorType > > 00605 { 00606 enum { dim = GridImp :: dimension }; 00607 00608 friend class ALU3dGridEntity<cdim,dim,GridImp>; 00609 enum { codim = cdim }; 00610 00611 typedef typename GridImp::MPICommunicatorType Comm; 00612 00613 public: 00614 typedef typename GridImp::GridObjectFactoryType FactoryType; 00615 00616 typedef typename GridImp::template Codim<cdim>::Entity Entity; 00617 00618 typedef typename ALU3DSPACE ALU3dGridLeafIteratorWrapper< cdim, pitype, Comm > IteratorType ; 00619 friend class ALU3dGridTreeIterator< IteratorType > ; 00620 00621 typedef IteratorType InternalIteratorType; 00622 typedef typename ALU3DSPACE IteratorElType< cdim, Comm >::val_t val_t; 00623 00624 typedef ALU3dGridLeafIterator<cdim, pitype, GridImp> ThisType; 00625 00627 ALU3dGridLeafIterator(const FactoryType& factory, int level); 00628 00630 ALU3dGridLeafIterator(const FactoryType& factory, int level , bool isBegin); 00631 00633 ALU3dGridLeafIterator(const ThisType & org); 00634 00636 ~ALU3dGridLeafIterator(); 00637 00639 void increment (); 00640 00642 Entity & dereference () const; 00643 00645 void releaseEntity () {} 00646 00648 ThisType & operator = (const ThisType & org); 00649 00650 private: 00651 // the internal iterator 00652 IteratorType * iter_; 00653 00654 // max level for iteration 00655 int walkLevel_ ; 00656 00658 void assign (const ThisType & org); 00659 00660 // deletes iter_ 00661 void removeIter () ; 00662 00663 // return reference to iter_ 00664 InternalIteratorType & internalIterator () 00665 { 00666 assert( iter_ ); 00667 return *iter_; 00668 } 00669 }; 00670 00671 // - HierarchicIteraor 00672 // --HierarchicIterator 00673 template<class GridImp> 00674 class ALU3dGridHierarchicIterator 00675 : public ALU3dGridEntityPointer<0,GridImp> 00676 // public HierarchicIteratorDefaultImplementation <GridImp,ALU3dGridHierarchicIterator> 00677 { 00678 typedef ALU3dGridHierarchicIterator<GridImp> ThisType; 00679 enum { dim = GridImp::dimension }; 00680 00681 typedef typename GridImp::MPICommunicatorType Comm; 00682 00683 typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits; 00684 typedef typename ImplTraits::HElementType HElementType; 00685 typedef typename ImplTraits::HBndSegType HBndSegType; 00686 00687 template < class PointerType, class CommT > 00688 class GhostElementStorage; 00689 00691 template < class PointerType > 00692 struct GhostElementStorage< PointerType, No_Comm > 00693 { 00694 GhostElementStorage() {} 00695 explicit GhostElementStorage( const PointerType& ) {} 00696 PointerType& operator * () { PointerType* p = 0; assert( false ); abort(); return *p; } 00697 const PointerType* ghost () const { return 0; } 00698 PointerType* nextGhost () const { return 0; } 00699 PointerType* operator -> () const { return 0; } 00700 bool operator != (const PointerType* ) const { return false; } 00701 bool operator ! () const { return true ; } 00702 GhostElementStorage& operator= (const GhostElementStorage& ) { return *this; } 00703 GhostElementStorage& operator= (const PointerType* ) { return *this; } 00704 bool valid () const { return false; } 00705 }; 00706 00707 #if ALU3DGRID_PARALLEL 00708 00709 template < class PointerType > 00710 struct GhostElementStorage< PointerType, MPI_Comm > 00711 { 00712 private: 00713 // pointers to ghost and current ghost 00714 const HBndSegType * ghost_; 00715 HBndSegType * nextGhost_; 00716 public: 00717 GhostElementStorage() : ghost_( 0 ), nextGhost_( 0 ) {} 00718 explicit GhostElementStorage( const PointerType& gh ) : ghost_( &gh ), nextGhost_( 0 ) {} 00719 GhostElementStorage( const GhostElementStorage& org ) 00720 : ghost_( org.ghost_ ), nextGhost_( org.nextGhost_ ) {} 00721 00722 PointerType& operator * () { assert( nextGhost_ ); return *nextGhost_; } 00723 const PointerType* ghost () const { return ghost_; } 00724 PointerType* nextGhost () const { return nextGhost_; } 00725 PointerType* operator -> () { return nextGhost_; } 00726 bool operator != (const PointerType* p ) const { return (nextGhost_ != p); } 00727 bool operator ! () const { return nextGhost_ == 0; } 00728 GhostElementStorage& operator= (const GhostElementStorage& org) 00729 { 00730 ghost_ = org.ghost_; 00731 nextGhost_ = org.nextGhost_; 00732 return *this; 00733 } 00734 GhostElementStorage& operator= (PointerType* p) 00735 { 00736 nextGhost_ = p; 00737 return *this; 00738 } 00739 bool valid () const { return (ghost_ != 0); } 00740 }; 00741 #endif 00742 00743 public: 00744 typedef typename GridImp::GridObjectFactoryType FactoryType; 00745 00746 typedef typename GridImp::template Codim<0>::Entity Entity; 00747 typedef typename GridImp::ctype ctype; 00748 00750 ALU3dGridHierarchicIterator(const FactoryType& factory, 00751 const HElementType & elem, 00752 int maxlevel, bool end ); 00753 00755 ALU3dGridHierarchicIterator(const FactoryType& factory, 00756 const HBndSegType& ghost, 00757 int maxlevel, 00758 bool end); 00759 00761 ALU3dGridHierarchicIterator(const ThisType &org); 00762 00764 void increment(); 00765 00767 Entity & dereference () const; 00768 00770 void releaseEntity () {} 00771 00773 ThisType & operator = (const ThisType & org); 00774 00775 private: 00776 // assign iterator 00777 void assign(const ThisType & org); 00778 00780 int getLevel(const HElementType* item) const; 00781 00783 int getLevel(const HBndSegType* face) const; 00784 00785 // go to next valid element 00786 template <class HItemType> 00787 HItemType* goNextElement (const HItemType* startElem, HItemType * oldEl); 00788 00790 const HElementType * elem_; 00791 00792 // pointers to ghost and current ghost 00793 GhostElementStorage< HBndSegType, Comm > ghostElem_; 00794 00796 int maxlevel_; 00797 }; 00798 00799 00800 } // end namespace Dune 00801 00802 #include "iterator_imp.cc" 00803 00804 #endif