00001 #ifndef NMWR_GB_CELL_ON_CELL2D_ITERATOR_H 00002 #define NMWR_GB_CELL_ON_CELL2D_ITERATOR_H 00003 00004 00005 00006 // $LICENSE 00007 00008 00009 #include "Gral/Grids/Complex2D/complex2d.h" 00010 #include "Gral/Grids/Complex2D/internal/edge-on-cell2d-it.h" 00011 00012 class CellOnCell2D_Iterator : public complex2d_types { 00013 typedef CellOnCell2D_Iterator self; 00014 private: 00015 //----- DATA -------- 00016 EdgeOnCell2D_Iterator _f; 00017 public: 00018 friend class Complex2D; 00019 friend class Cell2D; 00020 friend class EdgeOnCell2D_Iterator; 00021 00022 typedef Cell value_type; 00023 typedef Cell element_type; 00024 typedef Cell anchor_type; 00025 00026 //--------- constructors ----------------------------------- 00027 00028 CellOnCell2D_Iterator() {} 00029 CellOnCell2D_Iterator(Cell const& C); 00030 CellOnCell2D_Iterator(int cnt, const Cell& C) : _f(cnt,C) 00031 { make_valid(); } 00032 CellOnCell2D_Iterator(const EdgeOnCell2D_Iterator f) : _f(f) 00033 { make_valid(); } 00034 00035 00036 ~CellOnCell2D_Iterator() {} 00037 00038 //----------- iterator operations -------------------------- 00039 00040 Cell operator*() const { return (_f.OtherCell()); } 00041 00042 self& operator++() { 00043 ++_f; 00044 make_valid(); 00045 return (*this); 00046 } 00047 00048 inline self& operator--(); 00049 00050 00051 inline self CyclicSucc() const; 00052 inline self CyclicPred() const; 00053 00054 bool IsDone() const { return _f.IsDone();} 00055 operator bool() const { return !IsDone();} 00056 int LocalNumber() const { return _f.LocalNumber(); } 00057 00058 Cell TheCell() const { return(_f.TheCell());} 00059 Complex2D const& TheGrid() const { return(_f.TheGrid());} 00060 00061 friend bool operator==(const self& ls, const self& rs) 00062 { return (ls._f == rs._f); } 00063 friend bool operator!=(const self& lhs, const self& rhs) 00064 { return !(lhs == rhs);} 00065 00066 private: 00067 inline void make_valid(); 00068 }; 00069 00070 00071 00072 #endif 00073