2d/iterator.hh

00001 #ifndef DUNE_ALU2DGRIDITERATOR_HH
00002 #define DUNE_ALU2DGRIDITERATOR_HH
00003 
00004 // System includes
00005 
00006 // Dune includes
00007 #include <dune/grid/common/grid.hh>
00008 #include <dune/grid/common/intersectioniteratorwrapper.hh>
00009 #include <stack>
00010 #include <utility>
00011 
00012 
00013 // Local includes 
00014 #include "entity.hh"
00015 
00016 namespace Dune {
00017   // Forward declarations
00018   template<int cd, int dim, class GridImp> 
00019   class ALU2dGridEntity;
00020   template<int cd, PartitionIteratorType pitype, class GridImp >
00021   class ALU2dGridLevelIterator;
00022   template<int cd, class GridImp > 
00023   class ALU2dGridEntityPointer;
00024   template<int mydim, int coorddim, class GridImp>
00025   class ALU2dGridGeometry;
00026   template<class GridImp> 
00027   class ALU2dGridHierarchicIterator;
00028   template<class GridImp>
00029   class ALU2dGridIntersectionBase;
00030   template<class GridImp>
00031   class ALU2dGridLeafIntersectionIterator;
00032   template<class GridImp>
00033   class ALU2dGridLevelIntersectionIterator;
00034   template<int codim, PartitionIteratorType pitype, class GridImp>
00035   class ALU2dGridLeafIterator;
00036   template<int dim, int dimworld> 
00037   class ALU2dGrid;
00038   
00039  
00040 //**********************************************************************
00041 //
00042 // --ALU2dGridIntersectionBase
00043 // --IntersectionBase
00044 //**********************************************************************
00053 template<class GridImp>
00054 class ALU2dGridIntersectionBase : public IntersectionIteratorDefaultImplementation <GridImp, ALU2dGridLevelIntersectionIterator >   
00055 {
00056 public:
00057   enum { dim       = GridImp::dimension };
00058   enum { dimworld  = GridImp::dimensionworld };
00059   
00060   enum { dimension       = GridImp::dimension };
00061   enum { dimensionworld  = GridImp::dimensionworld };
00062 
00063   typedef typename GridImp::template Codim<0>::Entity Entity;
00064   typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
00065   
00066   typedef typename GridImp::template Codim<1>::Geometry Geometry;
00067   typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
00068   typedef ALU2dGridEntity<0,dim,GridImp> EntityImp;
00069   typedef ALU2dGridGeometry<dim-1,dimworld,GridImp> GeometryImp;
00070   typedef ALU2dGridGeometry<dim-1,dimworld,GridImp> LocalGeometryImp;
00071   typedef FieldVector<alu2d_ctype, dimworld> NormalType;
00072   
00073   typedef ALU2dGridEntityPointer<0,GridImp> EntityPointerImp;
00074 
00075   typedef MakeableInterfaceObject< Geometry > GeometryObject;
00076   
00077   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00078 
00079   typedef ALU2dGridIntersectionBase<GridImp> ThisType;
00080   friend class LevelIntersectionIteratorWrapper<GridImp>;
00081   friend class LeafIntersectionIteratorWrapper<GridImp>;
00082 
00083   friend class IntersectionIteratorWrapper<GridImp,ThisType>;
00084 protected:
00085   struct impl 
00086   {    
00087     impl() : item_(0) , neigh_(0) , index_(0) , opposite_(0), isBoundary_(false), isNotConform_(false) { }
00088     impl(const impl & org) : item_(org.item_) , neigh_(org.neigh_) , index_(org.index_) , opposite_(org.opposite_),
00089                              isBoundary_(org.isBoundary_), isNotConform_(org.isNotConform_) { }
00090    
00091     impl & operator = (const impl & org)
00092     {
00093       item_ = org.item_; 
00094       neigh_ = org.neigh_;
00095       index_ = org.index_; 
00096       opposite_ = org.opposite_;
00097       isBoundary_ = org.isBoundary_;
00098       isNotConform_ = org.isNotConform_;
00099       return *this;
00100     }
00101     // current element from which we started the intersection iterator
00102     mutable HElementType* item_; 
00103     mutable HElementType* neigh_;      
00104     mutable int index_;
00105     mutable int opposite_;
00106     mutable bool isBoundary_;
00107     mutable bool isNotConform_;
00108   } current;
00109 
00110 public:  
00112   ALU2dGridIntersectionBase(const GridImp & grid, int wLevel);
00113   
00116   ALU2dGridIntersectionBase(const GridImp & grid, const HElementType* el, int wLevel, bool end=true);
00117   
00119   ALU2dGridIntersectionBase(const ThisType & org);
00120 
00121   virtual ~ALU2dGridIntersectionBase() {}
00122   
00124   void assign (const ThisType & org);
00125 
00127   bool equals (const ThisType & i) const;
00128 
00130   int level () const;
00131 
00133   bool boundary() const;
00134   
00135   int boundaryId () const;
00136      
00138   bool neighbor () const; 
00139   
00141   EntityPointer inside() const;
00142   
00144   EntityPointer outside() const;
00145 
00147   int numberInSelf () const;
00148   
00150   int numberInNeighbor () const;  
00151   
00152   NormalType & outerNormal (const FieldVector<alu2d_ctype, dim-1>& local) const;
00153   NormalType & integrationOuterNormal (const FieldVector<alu2d_ctype, dim-1>& local) const;
00154   NormalType & unitOuterNormal (const FieldVector<alu2d_ctype, dim-1>& local) const;
00155     
00156   const LocalGeometry & intersectionSelfLocal () const;
00157   const LocalGeometry & intersectionNeighborLocal () const;
00158   const Geometry & intersectionGlobal () const;    
00159   
00160 protected:
00162   void checkValid () ;
00163   
00164   // set interator to end iterator
00165   void done () ;  
00166   
00167   // reset IntersectionIterator to first neighbour
00168   template <class EntityType>
00169   void first(const EntityType & en, int wLevel);     
00170   
00171   // reset IntersectionIterator to first neighbour
00172   virtual void setFirstItem(const HElementType & elem, int wLevel);    
00173   // the local geometries
00174   mutable GeometryObject intersectionGlobal_;
00175   mutable GeometryObject intersectionSelfLocal_;
00176   mutable GeometryObject intersectionNeighborLocal_;
00177 
00178   // reference to grid
00179   const GridImp & grid_;
00180   mutable int nFaces_;
00181   mutable int walkLevel_;
00182   mutable bool generatedGlobalGeometry_;
00183   mutable bool generatedLocalGeometries_;
00184 
00185   // unit outer normal
00186   mutable NormalType unitOuterNormal_;
00187   mutable NormalType outerNormal_;
00188 
00189   // true if end iterator
00190   bool done_;  
00191 }; // end ALU2dGridIntersectionBase 
00192   
00193   
00194   
00195      
00196 //**********************************************************************
00197 //
00198 // --ALU2dGridLevelIntersectionIterator
00199 // --IntersectionLevelIterator
00200 //**********************************************************************
00201 
00202 template<class GridImp>
00203  class ALU2dGridLevelIntersectionIterator
00204   : public ALU2dGridIntersectionBase<GridImp>
00205    //,  public IntersectionIteratorDefaultImplementation <GridImp, ALU2dGridLevelIntersectionIterator >   
00206 {
00207 
00208   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00209   friend class LevelIntersectionIteratorWrapper<GridImp>;
00210 
00211   typedef ALU2dGridLevelIntersectionIterator<GridImp> ThisType; 
00212   friend class IntersectionIteratorWrapper<GridImp,ThisType>;
00213 
00214   typedef std::pair<HElementType *, std::pair<int, bool> > IntersectionInfo;
00215 
00216 public:
00217   typedef ALUMemoryProvider< ThisType > StorageType;
00218   
00219   enum { dim       = GridImp::dimension };
00220   enum { dimworld  = GridImp::dimensionworld };
00221   
00222   enum { dimension       = GridImp::dimension };
00223   enum { dimensionworld  = GridImp::dimensionworld };
00224 
00225   typedef typename GridImp::template Codim<0>::Entity Entity;
00226 
00227   typedef typename GridImp::template Codim<1>::Geometry Geometry;
00228   typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
00229   typedef ALU2dGridEntity<0,dim,GridImp> EntityImp;
00230   typedef ALU2dGridGeometry<dim-1,dimworld,GridImp> GeometryImp;
00231   typedef ALU2dGridGeometry<dim-1,dimworld,GridImp> LocalGeometryImp;
00232   typedef FieldVector<alu2d_ctype, dimworld> NormalType;
00233   typedef ALU2dGridEntityPointer<0,GridImp> EntityPointer;
00234 
00235   typedef MakeableInterfaceObject< Geometry > GeometryObject;
00236    
00238   ALU2dGridLevelIntersectionIterator(const GridImp & grid, int wLevel);
00239   
00241   ALU2dGridLevelIntersectionIterator(const GridImp & grid, const HElementType* el, int wLevel, bool end=true);
00242   
00244   ALU2dGridLevelIntersectionIterator(const ALU2dGridLevelIntersectionIterator<GridImp> & org);
00245 
00246   void assign (const ALU2dGridLevelIntersectionIterator<GridImp> & org);
00247 
00249   EntityPointer outside() const;    
00250   
00252   void increment ();
00253 
00254 
00257   bool conforming () const 
00258   { 
00259     return ( this->grid_.nonConform() ) ? 
00260               true : 
00261               ((this->neighbor()) ? (this->current.isNotConform_) : true); 
00262   }
00263 
00264 private:    
00265   void doIncrement ();
00266 
00267   // reset IntersectionIterator to first neighbour
00268   void setFirstItem(const HElementType & elem, int wLevel);  
00269   
00270   // reset IntersectionIterator to first neighbour
00271   template <class EntityType>
00272   void first(const EntityType & en, int wLevel);   
00273 
00274   void addNeighboursToStack();
00275   
00276   int getOppositeInFather(int nrInChild, int nrOfChild) const;
00277   int getOppositeInChild(int nrInFather, int nrOfChild) const;
00278       
00279   mutable std::stack<IntersectionInfo> neighbourStack_;
00280 }; // end ALU2dGridLevelIntersectionIterator 
00281 
00282 
00283 //********************************************************************
00284 //
00285 //  --ALU2dGridLeafIntersectionIterator
00286 //  
00287 // 
00288 //********************************************************************
00289 
00290 template<class GridImp>
00291 class ALU2dGridLeafIntersectionIterator 
00292   : public ALU2dGridIntersectionBase<GridImp>
00293   //, public IntersectionIteratorDefaultImplementation<GridImp, ALU2dGridLevelIntersectionIterator>
00294 {
00295   typedef ALU2dGridLeafIntersectionIterator<GridImp> ThisType; 
00296   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00297   friend class LeafIntersectionIteratorWrapper<GridImp>;
00298   friend class IntersectionIteratorWrapper<GridImp,ThisType>;
00299   
00300   typedef std::pair<ALU2DSPACE Thinelement*, std::pair<int, bool> > IntersectionInfo;
00301 
00302 public:
00303   typedef ALUMemoryProvider< ThisType > StorageType;
00304   enum { dim       = GridImp::dimension };
00305   enum { dimworld  = GridImp::dimensionworld };
00306   
00307   enum { dimension       = GridImp::dimension };
00308   enum { dimensionworld  = GridImp::dimensionworld };
00309 
00310   typedef typename GridImp::template Codim<0>::Entity Entity;
00311   typedef typename GridImp::template Codim<1>::Geometry Geometry;
00312   typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
00313   typedef ALU2dGridEntity<0,dim,GridImp> EntityImp;
00314   typedef ALU2dGridGeometry<dim-1,dimworld,GridImp> GeometryImp;
00315   typedef ALU2dGridGeometry<dim-1,dimworld,GridImp> LocalGeometryImp;
00316   typedef FieldVector<alu2d_ctype, dimworld> NormalType;
00317   typedef ALU2dGridEntityPointer<0,GridImp> EntityPointer;
00318 
00319   typedef MakeableInterfaceObject< Geometry > GeometryObject;
00320   
00322   ALU2dGridLeafIntersectionIterator(const GridImp & grid, int wLevel);
00323   
00325   ALU2dGridLeafIntersectionIterator(const GridImp & grid, const HElementType* el, int wLevel, bool end=true);
00326   
00328   ALU2dGridLeafIntersectionIterator(const ALU2dGridLeafIntersectionIterator<GridImp> & org);
00329 
00330   void assign (const ALU2dGridLeafIntersectionIterator<GridImp> & org);
00331 
00333   void increment ();
00334     
00336   bool conforming () const 
00337   { 
00338     return ( this->grid_.nonConform() ) ? 
00339             ((this->neighbor()) ? (this->current.item_->level() == this->current.neigh_->level()) : true ) : 
00340             true; 
00341   }
00342 
00343 private:
00344   void doIncrement ();
00345   // reset IntersectionIterator to first neighbour
00346   void setFirstItem(const HElementType & elem, int wLevel);  
00347   
00348   // reset IntersectionIterator to first neighbour
00349   template <class EntityType>
00350   void first(const EntityType & en, int wLevel);    
00351 
00352   std::stack<IntersectionInfo> nbStack_;
00353   
00354 
00355 }; // end ALU2dGridLeafIntersectionIterator
00356 
00357 
00358 
00359 //********************************************************************
00360 //  --ALU2dGridLeafIterator
00361 //  --LeafIterator   
00362 //  --for codim = 0,2
00363 //
00364 //********************************************************************
00365 
00366 template<int cdim, PartitionIteratorType pitype, class GridImp>
00367 class ALU2dGridLeafIterator :
00368     public ALU2dGridEntityPointer<cdim,GridImp>,
00369     public LeafIteratorDefaultImplementation<cdim, pitype, GridImp, ALU2dGridLeafIterator> 
00370 {
00371   enum { dim = GridImp::dimension };    
00372   enum { dimworld  = GridImp::dimensionworld }; 
00373   enum { codim = cdim }; 
00374         
00375   friend class ALU2dGridEntity<0,dimworld,GridImp>;
00376   friend class ALU2dGridEntity<1,dimworld,GridImp>;
00377   friend class ALU2dGridEntity<dim,dimworld,GridImp>;  
00378   friend class ALU2dGrid < dim , dimworld >;
00379     
00380   typedef ALU2dGridEntityPointer<cdim,GridImp> EntityPointerType;  
00381   typedef ALU2dGridEntity<cdim,dim,GridImp> EntityImp;      
00382 
00383   typedef ALU2dGridLeafIterator<cdim, pitype, GridImp> ThisType;
00384  
00385   typedef typename GridImp :: ALU2dGridLeafMarkerVectorType LeafMarkerVectorType;
00386 
00387   // default impl for elements 
00388   template <class ElementImp, class MarkerVectorImp, int codim> 
00389   struct GetLevel
00390   {
00391     // return level of element 
00392     static int level(const ElementImp & elem, const MarkerVectorImp& marker)
00393     {
00394       return elem.level();
00395     }
00396   };
00397  
00398   // specialization for vertices 
00399   template <class ElementImp, class MarkerVectorImp> 
00400   struct GetLevel<ElementImp,MarkerVectorImp,2>
00401   {
00402     // return level of leaf vertex 
00403     static int level(const ElementImp & elem, const MarkerVectorImp& marker)
00404     {
00405       return marker.levelOfVertex(elem.getIndex()); 
00406     }
00407   };
00408  
00409  public:
00411   typedef typename GridImp::template Codim<cdim>::Entity Entity;
00412   typedef typename Dune::ALU2dImplTraits::template Codim<cdim>::InterfaceType ElementType;  
00413 
00415   ALU2dGridLeafIterator(const GridImp & grid, bool end);
00416   
00418   ALU2dGridLeafIterator(const ThisType & org);
00419 
00421   void increment ();
00422 
00424   ThisType & operator = (const ThisType & org);
00425 
00426 private:
00428   bool endIter_;
00430   int level_;    
00431   ElementType * elem_;   
00432   typedef ALU2DSPACE Listwalkptr< ElementType > IteratorType;
00433   // Listwalkptr, behaves like a proxy for Leafwalk and Levelwalk Ptrs
00434   IteratorType iter_;
00435   
00436   // for the codim 2 case
00437   LeafMarkerVectorType & marker_;
00438 };  // end ALU2dGridLeafIterator
00439 
00440 
00441 //********************************************************************
00442 //  --ALU2dGridLeafIterator
00443 //  --LeafIterator   
00444 //  --specialized for codim = 1
00445 //
00446 //********************************************************************
00447 
00448 template<PartitionIteratorType pitype, class GridImp>
00449 class ALU2dGridLeafIterator<1,pitype,GridImp> :
00450     public ALU2dGridEntityPointer<1,GridImp>,
00451     public LeafIteratorDefaultImplementation<1, pitype, GridImp, ALU2dGridLeafIterator> 
00452 {
00453   enum { dim = GridImp::dimension };    
00454   enum { dimworld  = GridImp::dimensionworld }; 
00455   enum { codim = 1 }; 
00456         
00457   friend class ALU2dGridEntity<0,dimworld,GridImp>;
00458   friend class ALU2dGridEntity<1,dimworld,GridImp>;
00459   friend class ALU2dGridEntity<dim,dimworld,GridImp>;  
00460   friend class ALU2dGrid < dim , dimworld >;
00461     
00462   typedef ALU2dGridEntityPointer<1,GridImp> EntityPointerType;  
00463   typedef ALU2dGridEntity<1,dim,GridImp> EntityImp;      
00464 
00465   typedef ALU2dGridLeafIterator<1, pitype, GridImp> ThisType;
00466 
00467   typedef typename GridImp :: ALU2dGridLeafMarkerVectorType LeafMarkerVectorType;
00468  
00469  public:
00471   typedef typename GridImp::template Codim<1>::Entity Entity;
00472   typedef typename Dune::ALU2dImplTraits::template Codim<1>::InterfaceType ElementType;  
00473 
00475   ALU2dGridLeafIterator(const GridImp & grid, bool end);
00476   
00478   ALU2dGridLeafIterator(const ThisType & org);
00479 
00481   void increment ();
00482 
00484   ThisType & operator = (const ThisType & org);
00485 
00486 private:  
00487   int goNextElement();
00488 
00490   bool endIter_;
00492   int level_; 
00494   int face_;  
00495     
00496   ElementType * elem_;
00497    
00498   typedef ALU2DSPACE Listwalkptr< ElementType > IteratorType;
00499 
00500   // Listwalkptr, behaves like a proxy for Leafwalk and Levelwalk Ptrs
00501   IteratorType iter_;
00502 
00503   // for the codim 1 case
00504   LeafMarkerVectorType & marker_;
00505 
00506 };  // end ALU2dGridLeafIterator
00507 
00508 //**********************************************************************
00509 //
00510 // --ALU2dGridLevelIterator
00511 // --LevelIterator, specialized for cd=0
00512 //**********************************************************************
00513 
00514 template<PartitionIteratorType pitype, class GridImp>
00515 class ALU2dGridLevelIterator<0, pitype, GridImp> : 
00516 public LevelIteratorDefaultImplementation <0, pitype, GridImp, ALU2dGridLevelIterator>,
00517   public ALU2dGridEntityPointer<0,GridImp> 
00518   {
00519   enum { dim       = GridImp::dimension };
00520   enum { dimworld  = GridImp::dimensionworld };
00521   enum { codim  = 0 };
00522   
00523   friend class ALU2dGridEntity<dim,dimworld,GridImp>;
00524   friend class ALU2dGridEntity<1,dimworld,GridImp>;
00525   friend class ALU2dGridEntity<0,dimworld,GridImp>;
00526   friend class ALU2dGrid < dim , dimworld >;
00527   
00528   typedef ALU2dGridEntityPointer<codim,GridImp> EntityPointerType; 
00529   typedef ALU2dGridEntity<codim,dim,GridImp> EntityImp;      
00530   
00531   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00532   typedef ALU2dGridLevelIterator<0,pitype,GridImp> ThisType; 
00533   
00534 public:  
00535 
00536   typedef typename GridImp::template Codim<codim>::Entity Entity;
00537  
00539   ALU2dGridLevelIterator(const GridImp & grid, int level, bool end);  
00540     
00542   ALU2dGridLevelIterator(const ThisType & org);      
00543   
00545   void increment ();
00546 
00548   ThisType & operator = (const ThisType & org);
00549 
00550 private:
00552   bool endIter_;
00554   int level_; 
00555   
00556   HElementType * item_;  
00557   
00559   typedef typename Dune::ALU2dImplTraits::template Codim<0>::InterfaceType ElementType;   
00560   typedef ALU2DSPACE Listwalkptr< ElementType > IteratorType;
00561   IteratorType iter_;  
00562   
00563 }; 
00564 
00565 //**********************************************************************
00566 //
00567 // --ALU2dGridLevelIterator
00568 // --LevelIterator, specialized for cd=1
00569 //**********************************************************************
00570 
00571 template<PartitionIteratorType pitype, class GridImp>
00572 class ALU2dGridLevelIterator<1, pitype, GridImp> : 
00573 public LevelIteratorDefaultImplementation <1, pitype, GridImp, ALU2dGridLevelIterator>,
00574 public ALU2dGridEntityPointer<1,GridImp> 
00575   {
00576   enum { dim       = GridImp::dimension };
00577   enum { dimworld  = GridImp::dimensionworld };
00578   enum { codim  = 1 };
00579   
00580   friend class ALU2dGridEntity<dim,dimworld,GridImp>;
00581   friend class ALU2dGridEntity<1,dimworld,GridImp>;
00582   friend class ALU2dGridEntity<0,dimworld,GridImp>;
00583   friend class ALU2dGrid < dim , dimworld >;
00584   
00585   typedef ALU2dGridEntityPointer<codim,GridImp> EntityPointerType; 
00586   typedef ALU2dGridEntity<codim,dim,GridImp> EntityImp;      
00587   
00588   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00589   
00590   typedef ALU2dGridLevelIterator<1,pitype,GridImp> ThisType; 
00591 public:  
00592 
00593   typedef typename GridImp::template Codim<codim>::Entity Entity;
00594  
00596   ALU2dGridLevelIterator(const GridImp & grid, int level, bool end);  
00597     
00599   ALU2dGridLevelIterator(const ThisType & org);      
00600   
00601   ~ALU2dGridLevelIterator();      
00602   
00604   void increment ();
00605 
00607   ThisType & operator = (const ThisType & org);
00608 
00609 private:
00611   bool endIter_;
00613   int level_; 
00615   int myFace_;  
00616 
00617   // current item 
00618   HElementType * item_;  
00620   typedef typename Dune::ALU2dImplTraits::template Codim<1>::InterfaceType ElementType;  
00621   ElementType * elem_;
00622   // Listwalkptr is a proxy for iterator pointers 
00623   typedef ALU2DSPACE Listwalkptr< ElementType > IteratorType;
00624 
00625   IteratorType iter_;  
00626   
00627   ALU2dGridMarkerVector * marker_;
00628 
00629   ALU2dGridMarkerVector & marker() 
00630   { 
00631     assert( marker_ );
00632     return *marker_; 
00633   }
00634 }; 
00635 
00636 //**********************************************************************
00637 //
00638 // --ALU2dGridLevelIterator
00639 // --LevelIterator, specialized for cd=2
00640 //**********************************************************************
00641 
00642 template<PartitionIteratorType pitype, class GridImp>
00643 class ALU2dGridLevelIterator<2, pitype, GridImp> : 
00644 public LevelIteratorDefaultImplementation <2, pitype, GridImp, ALU2dGridLevelIterator>,
00645   public ALU2dGridEntityPointer<2,GridImp> 
00646   {
00647   enum { dim       = GridImp::dimension };
00648   enum { dimworld  = GridImp::dimensionworld };
00649   enum { codim  = 2 };
00650   
00651   friend class ALU2dGridEntity<dim,dimworld,GridImp>;
00652   friend class ALU2dGridEntity<1,dimworld,GridImp>;
00653   friend class ALU2dGridEntity<0,dimworld,GridImp>;
00654   friend class ALU2dGrid < dim , dimworld >;
00655   
00656   typedef ALU2dGridEntityPointer<codim,GridImp> EntityPointerType; 
00657   typedef ALU2dGridEntity<codim,dim,GridImp> EntityImp;      
00658   
00659   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00660   typedef ALU2dGridLevelIterator<2,pitype,GridImp> ThisType; 
00661   
00662 public:  
00663 
00664   typedef typename GridImp::template Codim<codim>::Entity Entity;
00665  
00667   ALU2dGridLevelIterator(const GridImp & grid, int level, bool end);  
00668     
00670   ALU2dGridLevelIterator(const ThisType & org);      
00671   
00672   ~ALU2dGridLevelIterator();      
00673   
00675   void increment ();
00676 
00678   ThisType & operator = (const ThisType & org);
00679 
00680 private:
00682   bool endIter_;
00684   int level_; 
00686   int myFace_;  
00688     
00689   HElementType * item_;
00690   ALU2DSPACE Vertex * vertex_;
00691   
00693   typedef typename Dune::ALU2dImplTraits::template Codim<0>::InterfaceType ElementType;  
00694  
00695   typedef ALU2DSPACE Listwalkptr< ElementType > IteratorType;
00696   IteratorType iter_;  
00697   
00698   // marker vector to tell on which element vertex is visited 
00699   ALU2dGridMarkerVector * marker_;
00700   ALU2dGridMarkerVector & marker() 
00701   { 
00702     assert( marker_ );
00703     return *marker_; 
00704   }
00705 }; 
00706 
00707 //***************************************************************
00708 //
00709 // - HierarchicIteraror
00710 // --HierarchicIterator
00711 //***************************************************************
00712 
00714 template<class GridImp>
00715 class ALU2dGridHierarchicIterator :
00716 public ALU2dGridEntityPointer<0,GridImp> ,
00717 public HierarchicIteratorDefaultImplementation <GridImp,ALU2dGridHierarchicIterator>
00718 {
00719   enum { dim = GridImp::dimension };
00720   // my type 
00721   typedef ALU2dGridHierarchicIterator<GridImp> ThisType;
00722   
00723   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00724   
00725 public:
00727   typedef typename GridImp::template Codim<0>::Entity Entity;
00729   typedef typename GridImp::ctype ctype;
00731   typedef ALU2dGridEntity<0,dim,GridImp> EntityImp;
00732 
00734   ALU2dGridHierarchicIterator(const GridImp &grid, const HElementType & elem, int maxlevel, bool end=false);
00735   
00737   ALU2dGridHierarchicIterator(const ALU2dGridHierarchicIterator<GridImp> &org);
00738     
00740   void increment();
00741   
00743   ThisType & operator = (const ALU2dGridHierarchicIterator<GridImp> &org)
00744   {
00745     ALU2dGridEntityPointer<0,GridImp> :: operator = (org);
00746     elem_ = org.elem_;
00747     maxlevel_= org.maxlevel_;
00748     endIter_ = org.endIter_;
00749     return *this;
00750   };
00751   
00752 private:
00753 
00755   HElementType * goNextElement (HElementType * oldEl);
00756     
00758   const HElementType * elem_;
00759      
00761   int maxlevel_;
00763   bool endIter_;
00764 };  // end ALU2dHierarchicIterator 
00765 
00766 } // end namespace Dune
00767 
00768 #include "iterator_imp.cc"
00769 
00770 #endif

Generated on 6 Nov 2008 with Doxygen (ver 1.5.6) [logfile].