Go to Overview over all GrAL packages.
Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Gral/Grids/Complex2D/internal/edge-on-cell2d-it.h

Go to the documentation of this file.
00001 #ifndef NMWR_GB_EDGE_ON_CELL2D_ITERATOR_H
00002 #define NMWR_GB_EDGE_ON_CELL2D_ITERATOR_H
00003 
00004 
00005 
00006 // $LICENSE
00007 
00008 #include "Utility/pre-post-conditions.h"
00009 #include "Gral/Grids/Complex2D/complex2d.h"
00010 
00011 class EdgeOnCell2D_Iterator : public complex2d_types {
00012   friend class CellOnCell2D_Iterator;
00013   friend class Complex2D;
00014   friend class Cell2D;
00015   friend class Edge2D;
00016   friend class Edge2D_Iterator;
00017 
00018   typedef EdgeOnCell2D_Iterator   self;
00019 private:
00020   //----- DATA --------
00021   Cell            C;  // anchor
00022   int             lf; // local facet, \in [0, TheCell().NumOfFacets()]
00023 
00024 public:
00025   typedef Cell   anchor_type;
00026   typedef Edge   element_type;
00027   typedef Edge   value_type;
00028 
00029   //--------- constructors -----------------------------------
00030 
00031   EdgeOnCell2D_Iterator() 
00032     : C(),   lf(0)  {}
00033   explicit 
00034   EdgeOnCell2D_Iterator(const Cell& CC)
00035     : C(CC), lf(0)   {}
00036   EdgeOnCell2D_Iterator(int cnt, const Cell& CC)
00037     : C(CC), lf(cnt) 
00038   {
00039     REQUIRE( (0 <= cnt), 
00040             "EdgeOnCell2DIterator: invalid cnt = " << cnt << " specified!\n",1);
00041   }
00042   EdgeOnCell2D_Iterator(const Cell& CC, int cnt)
00043     : C(CC), lf(cnt) 
00044   {
00045     REQUIRE( (0 <= cnt), 
00046             "EdgeOnCell2DIterator: invalid cnt = " << cnt << " specified!\n",1);
00047   }
00048   /*
00049   EdgeOnCell2D_Iterator(cell_handle c, int cnt, const Complex2D& cc)
00050     : _cc(&cc), _c(c), lf(cnt) {
00051     REQUIRE( (0 <= cnt), // cnt == NumOfEdges() possible 
00052             "EdgeOnCell2DIterator: invalid cnt = " << cnt << " specified!\n",1);
00053   }
00054   */
00055   EdgeOnCell2D_Iterator(CellOnCell2D_Iterator const& nb);
00056 
00057   ~EdgeOnCell2D_Iterator() {}
00058 
00059   //----------- iterator operations --------------------------
00060 
00061   inline Edge operator*() const;
00062 
00063   self& operator++()      { ++lf;   return (*this);}
00064   self& operator--()      { --lf;   return (*this);}
00065 
00066   
00067   inline self  CyclicSucc() const;
00068   inline self  CyclicPred() const;
00069 
00070   // inline operator Cell2D_Iterator() const;
00071  
00072   bool IsDone() const {return ((lf < 0) || (lf >= TheCell().NumOfEdges()));}
00073   operator bool() const { return !IsDone();}
00074   int LocalNumber() const { return (lf+1);}
00075 
00076   inline vertex_handle v1() const;
00077   inline vertex_handle v2() const;
00078 
00079   inline cell_handle   the_cell()   const;
00080   inline cell_handle   other_cell() const;
00081   inline Cell const&   TheCell()   const;
00082   inline Cell          OtherCell() const;
00083 
00084   //---------------- anchor access ------------------
00085 
00086   anchor_type const&  TheAnchor() const { return C;}
00087   Complex     const&  TheGrid()   const { return C.TheGrid();}
00088 
00089   //----------------- comparison  -----------------------
00090 
00091   friend bool operator==(const self& ls, const self& rs) {
00092     return ((ls.C == rs.C) && (ls.lf == rs.lf));
00093   }
00094   friend bool operator!=(const self& lhs, const self& rhs)
00095     { return !(lhs == rhs);}
00096 
00097   void print(ostream& out)  const;
00098   friend ostream& operator<<(ostream& out, const EdgeOnCell2D_Iterator& it)
00099     { it.print(out); return out; }
00100 
00101   bool bound() const { return C.valid();}
00102   bool valid() const { return C.valid() && (0 <= lf) && (lf < C.NumOfEdges());}
00103 };
00104 
00105 
00106 
00107 #endif
00108 

Copyright (c) Guntram Berti 1997-2002. See the GrAL Homepage for up-to-date information.

Generated at Tue Feb 26 16:06:44 2002 for GrAL Complex2D by doxygen 1.2.11-20011104 written by Dimitri van Heesch, © 1997-2000