00001 #ifndef _MY_DealOrthoMeshWithFaceIterators_ 00002 #define _MY_DealOrthoMeshWithFaceIterators_ 00003 #include <vector> 00004 #include "dealbase.h" 00005 00006 00007 class FaceInf; 00008 00009 00021 class DealOrthoMesh : public DealBase 00022 { 00023 private: 00024 00025 std::vector<FaceInf> m_faces; 00026 unsigned nElems[3]; 00027 double m_dX; 00028 double m_dY; 00029 double m_dZ; 00030 double m_FacesArea[3]; 00031 double m_FacesAreaFromCellDirection[6]; 00032 double m_FacesAreaPerVolume[3]; 00033 double m_Vol; 00034 int n_boundary_faces; 00035 Point3D P,Q; 00036 protected: 00037 00038 void buildFaceInformation(Triangulation<3> &tria); 00041 public: 00042 00043 enum NormalOrientation { NORMAL_X=0,NORMAL_Y=1,NORMAL_Z=2}; 00044 typedef std::vector<FaceInf>::iterator Face_It; 00045 00046 00047 Point3D getP() const {return P;} 00048 Point3D getQ() const {return Q;} 00049 00050 DealOrthoMesh(Triangulation<3> &tria); 00051 ~DealOrthoMesh(); 00052 int numFacesAtBoundary(){assert(n_boundary_faces > 0);return n_boundary_faces;} 00053 int numElems(unsigned i){assert(i<3);return nElems[i];} 00054 Face_It begin(){return m_faces.begin();} 00055 Face_It end(){return m_faces.end();} 00056 Face_It begin(int n){return m_faces.begin()+n;} 00057 double faceArea(const Face_It &face); 00058 double faceAreaPerCellVol(const Face_It &face); 00059 double faceValue(const Face_It &face,const VecDouble &fValues); 00060 double getCellVolume(){return m_Vol;} 00061 double getDX() const {return m_dX;} 00062 double getDY() const {return m_dY;} 00063 double getDZ() const {return m_dZ;} 00064 double getCellMeasure() const {return m_Vol;} 00065 void projectCentralValuesAtVertices(const VecDouble &cValues,VecDouble &vValues); 00066 double getL2NormAtCells(const VecDouble &cValues) const; 00067 double getIntegralAtCells(const VecDouble &cValues) const; 00068 bool nonZeroInwardNormalComponenentIsPositive(FaceDirection3D face_no); 00069 Point3D getBarycenter(Face &face); 00070 double faceArea(FaceDirection3D face_no); 00071 void getFacesInYZSlab(double X,VecIndex &fIndices); 00072 00073 00074 using DealBase::faceArea; 00075 }; 00076 00077 00078 00082 class FaceInf 00083 { 00084 friend class DealOrthoMesh; 00085 int m_cell1,m_cell2; 00086 DealOrthoMesh::NormalOrientation m_normal; 00087 00088 void setPosNormalCell(unsigned cell){m_cell1 = cell;} 00089 void setNegNormalCell(unsigned cell){m_cell2 = cell;} 00090 void setNormalDirection(DealOrthoMesh::NormalOrientation normal){m_normal = normal;} 00091 00092 00093 00094 public: 00095 FaceInf() {m_cell1 = m_cell2 = -1;} 00096 int getPosCellIndex() const {return m_cell1;} 00097 int getNegCellIndex() const {return m_cell2;} 00098 int getCell1(){return m_cell1;} 00099 int getCell2(){return m_cell2;} 00100 double normal_multiply(double *v) const; 00101 bool at_boundary() const {return m_cell1 == -1 || m_cell2 == -1;} 00102 DealOrthoMesh::NormalOrientation getNormalOrientation() {return m_normal;} 00103 unsigned getNormalNonZeroComponent(){return m_normal;} 00104 bool hasNegCell() const {return m_cell2 != -1;} 00105 bool hasPosCell() const {return m_cell1 != -1;} 00106 void getAdjCells(int &posCell,int &negCell); 00107 }; 00108 00109 00110 00111 #endif