00001 #ifndef _MY_CashOrthoFaceAccessor_ 00002 #define _MY_CashOrthoFaceAccessor_ 00003 00004 00009 class CashOrthoFaceAccessor 00010 { 00011 00012 00013 private: 00014 friend class OrthoMesh; 00015 const OrthoMesh &m_mesh; 00016 OrthoMesh::FaceCellsTbl_It m_cash; 00017 unsigned m_index; 00018 00029 CashOrthoFaceAccessor(const OrthoMesh &mesh, OrthoMesh::FaceCellsTbl_It m_cash); 00030 protected: 00031 public: 00032 //CashOrthoFaceAccessor(CashOrthoFaceAccessor &fIt); 00033 ~CashOrthoFaceAccessor(){} 00034 00035 bool isValid() const; 00036 00037 bool at_boundary() const 00038 { 00039 return m_cash->c1 == OrthoMesh::INVALID_INDEX || m_cash->c2 == OrthoMesh::INVALID_INDEX; 00040 } 00041 void getAdjCellIndices(unsigned &index1,unsigned &index2) const 00042 { 00043 index1=m_cash->c1;index2=m_cash->c2; 00044 } 00045 void getValidCellIndices(unsigned &index1,unsigned &index2) 00046 { 00047 assert(isValid()); 00048 index1=m_cash->c1; 00049 index2=m_cash->c2; 00050 if (index1 == OrthoMesh::INVALID_INDEX) 00051 index1=index2; 00052 if (index2 == OrthoMesh::INVALID_INDEX) 00053 index2=index1; 00054 } 00055 00056 00057 00058 double normal_multiply(double *v) const 00059 { 00060 return v[static_cast<int>(m_cash->normal)]; 00061 } 00062 OrthoMesh::NORMAL_AXIS getNormalOrientation() const 00063 { 00064 return static_cast<OrthoMesh::NORMAL_AXIS>(m_cash->normal); 00065 } 00066 unsigned getNormalNonZeroComponent() const 00067 { 00068 return m_cash->normal; 00069 } 00070 bool hasPosCell() const 00071 { 00072 return m_cash->c2!=OrthoMesh::INVALID_INDEX; 00073 } 00074 bool hasNegCell() const 00075 { 00076 return m_cash->c1!=OrthoMesh::INVALID_INDEX; 00077 } 00078 unsigned getPosCell() const 00079 { 00080 return m_cash->c1; 00081 } 00082 unsigned getNegCell() const 00083 { 00084 return m_cash->c2; 00085 } 00086 void operator++ (int) 00087 { 00088 m_cash++; 00089 m_index++; 00090 } 00091 bool operator!= (const CashOrthoFaceAccessor& face) const; 00092 unsigned index() const {return m_index;} 00093 const OrthoMesh& getMesh() const {return m_mesh;} 00094 00095 double area() const 00096 { 00097 assert(this->isValid()); 00098 assert(m_index < m_mesh.numFaces()); 00099 return m_mesh._faceArea[static_cast<unsigned>(m_cash->normal)]; 00100 } 00101 double areaPerCellVol() const 00102 { 00103 assert(this->isValid()); 00104 assert(m_index < m_mesh.numFaces()); 00105 return m_mesh._faceAreaPerCellVol[static_cast<unsigned>(m_cash->normal)]; 00106 } 00107 }; 00108 00109 #endif