00001 #ifndef _MY_OrthoCellAccessor_ 00002 #define _MY_OrthoCellAccessor_ 00003 00007 //class OrthoMesh; 00008 //class IteratorAccessor<OrthoCellAccessor>; 00009 00010 class OrthoCellAccessor 00011 { 00012 friend class OrthoMesh; 00013 friend class IteratorAccessor<OrthoCellAccessor>; 00014 private: 00015 00016 protected: 00017 const OrthoMesh* _pMesh; 00018 unsigned _i,_j,_k,_index; 00019 bool advanceRight(); 00020 bool advanceLeft(); 00021 bool advanceUp(); 00022 bool advanceDown(); 00023 bool advanceBack(); 00024 bool advanceFront(); 00025 void operator++ (int); 00026 00027 00028 public: 00029 OrthoCellAccessor(const OrthoMesh &mesh,unsigned index); 00030 OrthoCellAccessor(const OrthoMesh &mesh,unsigned i,unsigned j,unsigned k); 00031 00032 OrthoCellAccessor(); 00033 ~OrthoCellAccessor(){} 00034 00035 bool operator!= (OrthoCellAccessor &cell) const; 00036 void barycenter(Point3D &p) const; //get the barycenter of the cell 00037 Point3D barycenter() const; //get the barycenter of the cell 00038 bool containPoint(Point3D &p) const; 00039 void advance_inner(); 00040 void vertex(VertexDirection3D dir, Point3D &p) const; 00041 Point3D vertex(VertexDirection3D dir) const; 00042 unsigned vertex_index(VertexDirection3D dir) const; 00043 unsigned face_index(FaceDirection3D dir) const; 00044 unsigned face_index_up() const; 00045 unsigned face_index_bottom() const; 00046 unsigned face_index_left() const; 00047 unsigned face_index_right() const; 00048 unsigned face_index_front() const; 00049 unsigned face_index_back() const; 00050 00051 OrthoMesh::Raw_Face_It face(FaceDirection3D dir); 00052 OrthoMesh::Raw_Cell_It neighbor(CellDirection3D dir); 00053 00054 unsigned index() const{return _index;} 00055 unsigned neighbor_index(unsigned int dir) const; 00056 unsigned index_up() const; 00057 unsigned index_bottom() const; 00058 unsigned index_left() const; 00059 unsigned index_right() const; 00060 unsigned index_front() const; 00061 unsigned index_back() const; 00062 00063 00064 00065 00066 unsigned advance(CellDirection3D dir,unsigned stps); 00067 bool advance(CellDirection3D dir); 00068 00069 unsigned getI() const {return _i;} 00070 unsigned getJ() const {return _j;} 00071 unsigned getK() const {return _k;} 00072 bool isValid() const; 00073 bool at_boundary() const; 00074 const OrthoMesh& getMesh() const{return *_pMesh;} 00075 double volume() const {return _pMesh->cellVolume();} 00076 }; 00077 00078 #endif