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   virtual void increment() { };
00131 
00133   int level () const;
00134 
00136   bool boundary() const;
00137   
00138   int boundaryId () const;
00139      
00141   bool neighbor () const; 
00142   
00144   EntityPointer inside() const;
00145   
00147   EntityPointer outside() const;
00148 
00150   int numberInSelf () const;
00151   
00153   int numberInNeighbor () const;  
00154   
00155   NormalType & outerNormal (const FieldVector<alu2d_ctype, dim-1>& local) const;
00156   NormalType & integrationOuterNormal (const FieldVector<alu2d_ctype, dim-1>& local) const;
00157   NormalType & unitOuterNormal (const FieldVector<alu2d_ctype, dim-1>& local) const;
00158     
00159   const LocalGeometry & intersectionSelfLocal () const;
00160   const LocalGeometry & intersectionNeighborLocal () const;
00161   const Geometry & intersectionGlobal () const;    
00162   
00163 protected:
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   int nrOfHangingNodes_;
00192 }; // end ALU2dGridIntersectionBase 
00193   
00194   
00195   
00196      
00197 //**********************************************************************
00198 //
00199 // --ALU2dGridLevelIntersectionIterator
00200 // --IntersectionLevelIterator
00201 //**********************************************************************
00202 
00203 template<class GridImp>
00204  class ALU2dGridLevelIntersectionIterator
00205   : public ALU2dGridIntersectionBase<GridImp>
00206    //,  public IntersectionIteratorDefaultImplementation <GridImp, ALU2dGridLevelIntersectionIterator >   
00207 {
00208 
00209   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00210   friend class LevelIntersectionIteratorWrapper<GridImp>;
00211 
00212   typedef ALU2dGridLevelIntersectionIterator<GridImp> ThisType; 
00213   friend class IntersectionIteratorWrapper<GridImp,ThisType>;
00214 
00215   typedef std::pair<HElementType *, std::pair<int, bool> > IntersectionInfo;
00216 
00217 public:
00218   typedef ALUMemoryProvider< ThisType > StorageType;
00219   
00220   enum { dim       = GridImp::dimension };
00221   enum { dimworld  = GridImp::dimensionworld };
00222   
00223   enum { dimension       = GridImp::dimension };
00224   enum { dimensionworld  = GridImp::dimensionworld };
00225 
00226   typedef typename GridImp::template Codim<0>::Entity Entity;
00227 
00228   typedef typename GridImp::template Codim<1>::Geometry Geometry;
00229   typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
00230   typedef ALU2dGridEntity<0,dim,GridImp> EntityImp;
00231   typedef ALU2dGridGeometry<dim-1,dimworld,GridImp> GeometryImp;
00232   typedef ALU2dGridGeometry<dim-1,dimworld,GridImp> LocalGeometryImp;
00233   typedef FieldVector<alu2d_ctype, dimworld> NormalType;
00234   typedef ALU2dGridEntityPointer<0,GridImp> EntityPointer;
00235 
00236   typedef MakeableInterfaceObject< Geometry > GeometryObject;
00237    
00239   ALU2dGridLevelIntersectionIterator(const GridImp & grid, int wLevel);
00240   
00242   ALU2dGridLevelIntersectionIterator(const GridImp & grid, const HElementType* el, int wLevel, bool end=true);
00243   
00245   ALU2dGridLevelIntersectionIterator(const ALU2dGridLevelIntersectionIterator<GridImp> & org);
00246 
00247   void assign (const ALU2dGridLevelIntersectionIterator<GridImp> & org);
00248 
00250   EntityPointer outside() const;    
00251   
00253   void increment ();
00254 
00257   bool conforming () const 
00258   { 
00259     return ( this->nrOfHangingNodes_) ? 
00260               true : 
00261               ((this->neighbor()) ? (this->current.isNotConform_) : true); 
00262   }
00263 
00264 private:    
00265   // reset IntersectionIterator to first neighbour
00266   void setFirstItem(const HElementType & elem, int wLevel);  
00267   
00268   // reset IntersectionIterator to first neighbour
00269   template <class EntityType>
00270   void first(const EntityType & en, int wLevel);   
00271 
00272   void addNeighboursToStack();
00273   
00274   int getOppositeInFather(int nrInChild, int nrOfChild) const;
00275   int getOppositeInChild(int nrInFather, int nrOfChild) const;
00276       
00277   mutable std::stack<IntersectionInfo> neighbourStack_;
00278 }; // end ALU2dGridLevelIntersectionIterator 
00279 
00280 
00281 //********************************************************************
00282 //
00283 //  --ALU2dGridLeafIntersectionIterator
00284 //  
00285 // 
00286 //********************************************************************
00287 
00288 template<class GridImp>
00289 class ALU2dGridLeafIntersectionIterator 
00290   : public ALU2dGridIntersectionBase<GridImp>
00291   //, public IntersectionIteratorDefaultImplementation<GridImp, ALU2dGridLevelIntersectionIterator>
00292 {
00293   typedef ALU2dGridLeafIntersectionIterator<GridImp> ThisType; 
00294   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00295   friend class LeafIntersectionIteratorWrapper<GridImp>;
00296   friend class IntersectionIteratorWrapper<GridImp,ThisType>;
00297   
00298   typedef std::pair<ALU2DSPACE Thinelement*, std::pair<int, bool> > IntersectionInfo;
00299 
00300 public:
00301   typedef ALUMemoryProvider< ThisType > StorageType;
00302   enum { dim       = GridImp::dimension };
00303   enum { dimworld  = GridImp::dimensionworld };
00304   
00305   enum { dimension       = GridImp::dimension };
00306   enum { dimensionworld  = GridImp::dimensionworld };
00307 
00308   typedef typename GridImp::template Codim<0>::Entity Entity;
00309   typedef typename GridImp::template Codim<1>::Geometry Geometry;
00310   typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
00311   typedef ALU2dGridEntity<0,dim,GridImp> EntityImp;
00312   typedef ALU2dGridGeometry<dim-1,dimworld,GridImp> GeometryImp;
00313   typedef ALU2dGridGeometry<dim-1,dimworld,GridImp> LocalGeometryImp;
00314   typedef FieldVector<alu2d_ctype, dimworld> NormalType;
00315   typedef ALU2dGridEntityPointer<0,GridImp> EntityPointer;
00316 
00317   typedef MakeableInterfaceObject< Geometry > GeometryObject;
00318   
00320   ALU2dGridLeafIntersectionIterator(const GridImp & grid, int wLevel);
00321   
00323   ALU2dGridLeafIntersectionIterator(const GridImp & grid, const HElementType* el, int wLevel, bool end=true);
00324   
00326   ALU2dGridLeafIntersectionIterator(const ALU2dGridLeafIntersectionIterator<GridImp> & org);
00327 
00328   void assign (const ALU2dGridLeafIntersectionIterator<GridImp> & org);
00329 
00331   void increment ();
00332     
00334   bool conforming () const 
00335   { 
00336     return ( this->nrOfHangingNodes_ ) ? 
00337             ((this->neighbor()) ? (this->current.item_->level() == this->current.neigh_->level()) : true ) : 
00338             true; 
00339   }
00340 
00341 private:
00342   // reset IntersectionIterator to first neighbour
00343   void setFirstItem(const HElementType & elem, int wLevel);  
00344   
00345   // reset IntersectionIterator to first neighbour
00346   template <class EntityType>
00347   void first(const EntityType & en, int wLevel);    
00348 
00349   std::stack<IntersectionInfo> nbStack_;
00350   
00351 
00352 }; // end ALU2dGridLeafIntersectionIterator
00353 
00354 
00355 
00356 //********************************************************************
00357 //  --ALU2dGridLeafIterator
00358 //  --LeafIterator   
00359 //  --for codim = 0,2
00360 //
00361 //********************************************************************
00362 
00363 template<int cdim, PartitionIteratorType pitype, class GridImp>
00364 class ALU2dGridLeafIterator :
00365     public ALU2dGridEntityPointer<cdim,GridImp>,
00366     public LeafIteratorDefaultImplementation<cdim, pitype, GridImp, ALU2dGridLeafIterator> 
00367 {
00368   enum { dim = GridImp::dimension };    
00369   enum { dimworld  = GridImp::dimensionworld }; 
00370   enum { codim = cdim }; 
00371         
00372   friend class ALU2dGridEntity<0,dimworld,GridImp>;
00373   friend class ALU2dGridEntity<1,dimworld,GridImp>;
00374   friend class ALU2dGridEntity<dim,dimworld,GridImp>;  
00375   friend class ALU2dGrid < dim , dimworld >;
00376     
00377   typedef ALU2dGridEntityPointer<cdim,GridImp> EntityPointerType;  
00378   typedef ALU2dGridEntity<cdim,dim,GridImp> EntityImp;      
00379 
00380   typedef ALU2dGridLeafIterator<cdim, pitype, GridImp> ThisType;
00381  
00382   typedef typename GridImp :: ALU2dGridLeafMarkerVectorType LeafMarkerVectorType;
00383 
00384   // default impl for elements 
00385   template <class ElementImp, class MarkerVectorImp, int codim> 
00386   struct GetLevel
00387   {
00388     // return level of element 
00389     static int level(const ElementImp & elem, const MarkerVectorImp& marker)
00390     {
00391       return elem.level();
00392     }
00393   };
00394  
00395   // specialization for vertices 
00396   template <class ElementImp, class MarkerVectorImp> 
00397   struct GetLevel<ElementImp,MarkerVectorImp,2>
00398   {
00399     // return level of leaf vertex 
00400     static int level(const ElementImp & elem, const MarkerVectorImp& marker)
00401     {
00402       return marker.levelOfVertex(elem.getIndex()); 
00403     }
00404   };
00405  
00406  public:
00408   typedef typename GridImp::template Codim<cdim>::Entity Entity;
00409   typedef typename Dune::ALU2dImplTraits::template Codim<cdim>::InterfaceType ElementType;  
00410 
00412   ALU2dGridLeafIterator(const GridImp & grid, bool end);
00413   
00415   ALU2dGridLeafIterator(const ThisType & org);
00416 
00418   void increment ();
00419 
00421   ThisType & operator = (const ThisType & org);
00422 
00423 private:
00425   bool endIter_;
00427   int level_;    
00428   ElementType * elem_;   
00429   typedef ALU2DSPACE Listwalkptr< ElementType > IteratorType;
00430   // Listwalkptr, behaves like a proxy for Leafwalk and Levelwalk Ptrs
00431   IteratorType iter_;
00432   
00433   // for the codim 2 case
00434   LeafMarkerVectorType & marker_;
00435 };  // end ALU2dGridLeafIterator
00436 
00437 
00438 //********************************************************************
00439 //  --ALU2dGridLeafIterator
00440 //  --LeafIterator   
00441 //  --specialized for codim = 1
00442 //
00443 //********************************************************************
00444 
00445 template<PartitionIteratorType pitype, class GridImp>
00446 class ALU2dGridLeafIterator<1,pitype,GridImp> :
00447     public ALU2dGridEntityPointer<1,GridImp>,
00448     public LeafIteratorDefaultImplementation<1, pitype, GridImp, ALU2dGridLeafIterator> 
00449 {
00450   enum { dim = GridImp::dimension };    
00451   enum { dimworld  = GridImp::dimensionworld }; 
00452   enum { codim = 1 }; 
00453         
00454   friend class ALU2dGridEntity<0,dimworld,GridImp>;
00455   friend class ALU2dGridEntity<1,dimworld,GridImp>;
00456   friend class ALU2dGridEntity<dim,dimworld,GridImp>;  
00457   friend class ALU2dGrid < dim , dimworld >;
00458     
00459   typedef ALU2dGridEntityPointer<1,GridImp> EntityPointerType;  
00460   typedef ALU2dGridEntity<1,dim,GridImp> EntityImp;      
00461 
00462   typedef ALU2dGridLeafIterator<1, pitype, GridImp> ThisType;
00463 
00464   typedef typename GridImp :: ALU2dGridLeafMarkerVectorType LeafMarkerVectorType;
00465  
00466  public:
00468   typedef typename GridImp::template Codim<1>::Entity Entity;
00469   typedef typename Dune::ALU2dImplTraits::template Codim<1>::InterfaceType ElementType;  
00470 
00472   ALU2dGridLeafIterator(const GridImp & grid, bool end);
00473   
00475   ALU2dGridLeafIterator(const ThisType & org);
00476 
00478   void increment ();
00479 
00481   ThisType & operator = (const ThisType & org);
00482 
00483 private:  
00484   int goNextElement();
00485 
00487   bool endIter_;
00489   int level_; 
00491   int face_;  
00492     
00493   ElementType * elem_;
00494    
00495   typedef ALU2DSPACE Listwalkptr< ElementType > IteratorType;
00496 
00497   // Listwalkptr, behaves like a proxy for Leafwalk and Levelwalk Ptrs
00498   IteratorType iter_;
00499 
00500   // for the codim 1 case
00501   LeafMarkerVectorType & marker_;
00502 
00503 };  // end ALU2dGridLeafIterator
00504 
00505 //**********************************************************************
00506 //
00507 // --ALU2dGridLevelIterator
00508 // --LevelIterator, specialized for cd=0
00509 //**********************************************************************
00510 
00511 template<PartitionIteratorType pitype, class GridImp>
00512 class ALU2dGridLevelIterator<0, pitype, GridImp> : 
00513 public LevelIteratorDefaultImplementation <0, pitype, GridImp, ALU2dGridLevelIterator>,
00514   public ALU2dGridEntityPointer<0,GridImp> 
00515   {
00516   enum { dim       = GridImp::dimension };
00517   enum { dimworld  = GridImp::dimensionworld };
00518   enum { codim  = 0 };
00519   
00520   friend class ALU2dGridEntity<dim,dimworld,GridImp>;
00521   friend class ALU2dGridEntity<1,dimworld,GridImp>;
00522   friend class ALU2dGridEntity<0,dimworld,GridImp>;
00523   friend class ALU2dGrid < dim , dimworld >;
00524   
00525   typedef ALU2dGridEntityPointer<codim,GridImp> EntityPointerType; 
00526   typedef ALU2dGridEntity<codim,dim,GridImp> EntityImp;      
00527   
00528   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00529   typedef ALU2dGridLevelIterator<0,pitype,GridImp> ThisType; 
00530   
00531 public:  
00532 
00533   typedef typename GridImp::template Codim<codim>::Entity Entity;
00534  
00536   ALU2dGridLevelIterator(const GridImp & grid, int level, bool end);  
00537     
00539   ALU2dGridLevelIterator(const ThisType & org);      
00540   
00542   void increment ();
00543 
00545   ThisType & operator = (const ThisType & org);
00546 
00547 private:
00549   bool endIter_;
00551   int level_; 
00552   
00553   HElementType * item_;  
00554   
00556   typedef typename Dune::ALU2dImplTraits::template Codim<0>::InterfaceType ElementType;   
00557   typedef ALU2DSPACE Listwalkptr< ElementType > IteratorType;
00558   IteratorType iter_;  
00559   
00560 }; 
00561 
00562 //**********************************************************************
00563 //
00564 // --ALU2dGridLevelIterator
00565 // --LevelIterator, specialized for cd=1
00566 //**********************************************************************
00567 
00568 template<PartitionIteratorType pitype, class GridImp>
00569 class ALU2dGridLevelIterator<1, pitype, GridImp> : 
00570 public LevelIteratorDefaultImplementation <1, pitype, GridImp, ALU2dGridLevelIterator>,
00571 public ALU2dGridEntityPointer<1,GridImp> 
00572   {
00573   enum { dim       = GridImp::dimension };
00574   enum { dimworld  = GridImp::dimensionworld };
00575   enum { codim  = 1 };
00576   
00577   friend class ALU2dGridEntity<dim,dimworld,GridImp>;
00578   friend class ALU2dGridEntity<1,dimworld,GridImp>;
00579   friend class ALU2dGridEntity<0,dimworld,GridImp>;
00580   friend class ALU2dGrid < dim , dimworld >;
00581   
00582   typedef ALU2dGridEntityPointer<codim,GridImp> EntityPointerType; 
00583   typedef ALU2dGridEntity<codim,dim,GridImp> EntityImp;      
00584   
00585   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00586   
00587   typedef ALU2dGridLevelIterator<1,pitype,GridImp> ThisType; 
00588 public:  
00589 
00590   typedef typename GridImp::template Codim<codim>::Entity Entity;
00591  
00593   ALU2dGridLevelIterator(const GridImp & grid, int level, bool end);  
00594     
00596   ALU2dGridLevelIterator(const ThisType & org);      
00597   
00598   ~ALU2dGridLevelIterator();      
00599   
00601   void increment ();
00602 
00604   ThisType & operator = (const ThisType & org);
00605 
00606 private:
00608   bool endIter_;
00610   int level_; 
00612   int myFace_;  
00613 
00614   // current item 
00615   HElementType * item_;  
00617   typedef typename Dune::ALU2dImplTraits::template Codim<1>::InterfaceType ElementType;  
00618   ElementType * elem_;
00619   // Listwalkptr is a proxy for iterator pointers 
00620   typedef ALU2DSPACE Listwalkptr< ElementType > IteratorType;
00621 
00622   IteratorType iter_;  
00623   
00624   ALU2dGridMarkerVector * marker_;
00625 
00626   ALU2dGridMarkerVector & marker() 
00627   { 
00628     assert( marker_ );
00629     return *marker_; 
00630   }
00631 }; 
00632 
00633 //**********************************************************************
00634 //
00635 // --ALU2dGridLevelIterator
00636 // --LevelIterator, specialized for cd=2
00637 //**********************************************************************
00638 
00639 template<PartitionIteratorType pitype, class GridImp>
00640 class ALU2dGridLevelIterator<2, pitype, GridImp> : 
00641 public LevelIteratorDefaultImplementation <2, pitype, GridImp, ALU2dGridLevelIterator>,
00642   public ALU2dGridEntityPointer<2,GridImp> 
00643   {
00644   enum { dim       = GridImp::dimension };
00645   enum { dimworld  = GridImp::dimensionworld };
00646   enum { codim  = 2 };
00647   
00648   friend class ALU2dGridEntity<dim,dimworld,GridImp>;
00649   friend class ALU2dGridEntity<1,dimworld,GridImp>;
00650   friend class ALU2dGridEntity<0,dimworld,GridImp>;
00651   friend class ALU2dGrid < dim , dimworld >;
00652   
00653   typedef ALU2dGridEntityPointer<codim,GridImp> EntityPointerType; 
00654   typedef ALU2dGridEntity<codim,dim,GridImp> EntityImp;      
00655   
00656   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00657   typedef ALU2dGridLevelIterator<2,pitype,GridImp> ThisType; 
00658   
00659 public:  
00660 
00661   typedef typename GridImp::template Codim<codim>::Entity Entity;
00662  
00664   ALU2dGridLevelIterator(const GridImp & grid, int level, bool end);  
00665     
00667   ALU2dGridLevelIterator(const ThisType & org);      
00668   
00669   ~ALU2dGridLevelIterator();      
00670   
00672   void increment ();
00673 
00675   ThisType & operator = (const ThisType & org);
00676 
00677 private:
00679   bool endIter_;
00681   int level_; 
00683   int myFace_;  
00685     
00686   HElementType * item_;
00687   ALU2DSPACE Vertex * vertex_;
00688   
00690   typedef typename Dune::ALU2dImplTraits::template Codim<0>::InterfaceType ElementType;  
00691  
00692   typedef ALU2DSPACE Listwalkptr< ElementType > IteratorType;
00693   IteratorType iter_;  
00694   
00695   // marker vector to tell on which element vertex is visited 
00696   ALU2dGridMarkerVector * marker_;
00697   ALU2dGridMarkerVector & marker() 
00698   { 
00699     assert( marker_ );
00700     return *marker_; 
00701   }
00702 }; 
00703 
00704 //***************************************************************
00705 //
00706 // - HierarchicIteraror
00707 // --HierarchicIterator
00708 //***************************************************************
00709 
00711 template<class GridImp>
00712 class ALU2dGridHierarchicIterator :
00713 public ALU2dGridEntityPointer<0,GridImp> ,
00714 public HierarchicIteratorDefaultImplementation <GridImp,ALU2dGridHierarchicIterator>
00715 {
00716   enum { dim = GridImp::dimension };
00717   // my type 
00718   typedef ALU2dGridHierarchicIterator<GridImp> ThisType;
00719   
00720   typedef typename ALU2DSPACE Hmesh_basic::helement_t HElementType ;
00721   
00722 public:
00724   typedef typename GridImp::template Codim<0>::Entity Entity;
00726   typedef typename GridImp::ctype ctype;
00728   typedef ALU2dGridEntity<0,dim,GridImp> EntityImp;
00729 
00731   ALU2dGridHierarchicIterator(const GridImp &grid, const HElementType & elem, int maxlevel, bool end=false);
00732   
00734   ALU2dGridHierarchicIterator(const ALU2dGridHierarchicIterator<GridImp> &org);
00735     
00737   void increment();
00738   
00740   ThisType & operator = (const ALU2dGridHierarchicIterator<GridImp> &org)
00741   {
00742     ALU2dGridEntityPointer<0,GridImp> :: operator = (org);
00743     elem_ = org.elem_;
00744     maxlevel_= org.maxlevel_;
00745     endIter_ = org.endIter_;
00746     return *this;
00747   };
00748   
00749 private:
00750 
00752   HElementType * goNextElement (HElementType * oldEl);
00753     
00755   const HElementType * elem_;
00756      
00758   int maxlevel_;
00760   bool endIter_;
00761 };  // end ALU2dHierarchicIterator 
00762 
00763 } // end namespace Dune
00764 
00765 #include "iterator_imp.cc"
00766 
00767 #endif

Generated on 12 Dec 2007 with Doxygen (ver 1.5.1)