00001 #ifndef NMWR_GB_VERTEX2D_H 00002 #define NMWR_GB_VERTEX2D_H 00003 00004 00005 // $LICENSE 00006 00007 00008 #include "Gral/Grids/Complex2D/complex2d.h" 00009 00010 class Vertex2D : public complex2d_types { 00011 //---- DATA ---- 00012 private: 00013 vertex_handle _pos; 00014 ComplexPtr _cc; // reference to grid 00015 00016 public: 00017 typedef Vertex2D self; 00018 typedef CellOnVertexIterator CellIterator; 00019 00020 //---------- construction ------------------- 00021 00022 Vertex2D() : _pos(-1), _cc(0) {} 00023 explicit Vertex2D(Complex2D const& cc); 00024 Vertex2D(Complex2D const& cc, vertex_handle pos) 00025 : _pos(pos), _cc(&cc) {} 00026 00027 00028 ~Vertex2D() {} 00029 00030 //--------------- iteration & sizes ------------------- 00031 00032 CellOnVertexIterator FirstCell() const; 00033 CellOnVertexIterator EndCell() const; 00034 00035 int NumOfCells() const { return (base()._cells.size());} 00036 int NumOfEdges() const { return NumOfCells();} 00037 int NumOfVertices() const { return NumOfCells();} 00038 00039 00040 00041 //-------------- anchors ------------ 00042 00043 Complex const& TheGrid() const {return (*_cc);} 00044 Complex const& TheAnchor() const {return (*_cc);} 00045 00046 vertex_handle handle() const { return _pos;} 00047 00048 //----------------- comparision -------------- 00049 00050 friend bool operator<(const self& lhs, const self& rhs) 00051 { return (lhs._pos < rhs._pos);} 00052 friend bool operator==(const self& lhs, const self& rhs) 00053 { return (lhs._pos == rhs._pos);} 00054 friend bool operator!=(const self& lhs, const self& rhs) 00055 { return !(lhs == rhs);} 00056 friend ostream& operator <<(ostream& out, self const& rs) 00057 { return (out << rs._pos << ' ' << rs._cc); } 00058 00059 private: 00060 friend class Complex2D; 00061 friend class CellOnVertex2D_Iterator; 00062 00063 inline cell_handle cell(int lc) const; 00064 00065 vertex_base const& base() const; 00066 }; 00067 00068 00069 #endif 00070