00001 #ifndef _MY_DelIndexLst_ 00002 #define _MY_DelIndexLst_ 00003 #include <vector> 00004 #include <assert.h> 00005 00006 00032 class DelIndexLst 00033 { 00034 public: 00035 typedef unsigned Index; 00036 00037 private: 00038 00039 class Info 00040 { 00041 friend class DelIndexLst; 00042 protected: 00043 Index m_i,m_off,m_ghostOff; 00044 public: 00045 Info(Index i,Index off){m_i=i;m_off=off;m_ghostOff=0;} 00046 Index ghostOff() const {return m_ghostOff;} 00047 Index index() const {return m_i;} 00048 Index off() const {return m_off;} 00049 bool operator<(const Info &info) const {return m_i < info.m_i;} 00050 Index adjust(Index i) const 00051 { 00052 assert(m_i > i); 00053 return i-m_off; 00054 } 00055 00056 }; 00057 00058 std::vector<Info> m_vec; 00059 00060 00061 bool m_bClosed; 00062 unsigned m_nNonGhosts; 00063 00064 protected: 00065 00066 public: 00067 //Types 00068 typedef std::vector<Info>::const_iterator Iterator ; 00069 00070 00071 DelIndexLst(); 00072 void addIndex(Index i,bool isInnerDelCell=false); 00073 void addUniqueIndex(Index i); 00074 bool exist(Index i); 00075 unsigned getNumInnerGhostCells(); 00076 00077 void close(); 00078 unsigned size(){return m_vec.size()-2;} 00079 Index adjust(Index i,Iterator &it) const; 00080 Index convert(Index i,Iterator &it) const; 00081 Index convertGhost(const Index &i,Iterator &it,const Index &Off) const; 00082 00083 Index index_to_raw_index(Index i) const; 00084 Index adjustI(Index i,Iterator it) const; 00085 Iterator begin() const {return ++(m_vec.begin());} 00086 Iterator end() const {return m_vec.end();} 00087 Iterator findLUEntry(const Index i) const; 00088 ~DelIndexLst(); 00089 00090 }; 00091 00092 #endif