00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _PB_CARTESIANGRID3D_
00025 #define _PB_CARTESIANGRID3D_
00026
00027 #include <MeshViz/3Ddata/PbGrid3D.h>
00028
00029 class PbHexahedronCell;
00030
00046 class PbCartesianGrid3D : public PbGrid3D {
00047
00048
00049 public:
00050
00054 PbCartesianGrid3D(SbBool is_data_duplicated=TRUE) ;
00055
00059 PbCartesianGrid3D(const PbCartesianGrid3D &);
00060
00064 PbCartesianGrid3D(int num_x, int num_y, int num_z, const float *xnod, const float *ynod, const float *znod,
00065 SbBool is_data_duplicated=TRUE) ;
00066
00070 ~PbCartesianGrid3D() ;
00071
00075 PbCartesianGrid3D& operator=(const PbCartesianGrid3D &mesh) ;
00076
00080 friend int operator ==(const PbCartesianGrid3D &m1, const PbCartesianGrid3D &m2);
00081
00085 friend int operator !=(const PbCartesianGrid3D &m1, const PbCartesianGrid3D &m2)
00086 { return !(m1 == m2); }
00087
00094 void setCoordinates(const float *xnod, const float *ynod, const float *znod);
00095
00106 void getCoordinates(const float* &xnod, const float* &ynod, const float* &znod,
00107 int &size_xnod, int &size_ynod, int &size_znod) const {
00108 xnod = x[0][0];
00109 ynod = y[0][0];
00110 znod = z[0][0];
00111 size_xnod = size_ynod = size_znod = numMeshNodes;
00112 }
00113
00118 void getGeometry(int &num_x, int &num_y, int &num_z, const float*** &xa, const float*** &ya, const float*** &za) const;
00119
00125 void getGeometry(int &num_x, int &num_y, int &num_z, const float* &xa, const float* &ya, const float* &za) const {
00126 PbGrid3D::getGeometry(num_x,num_y,num_z,xa,ya,za);
00127 };
00128
00135 virtual const PbCell *getCell(int cell_index) const;
00136
00140 virtual SbVec3f getNodeCoord(int nod_index) const;
00141
00145 SbVec3f getNodeCoord(int i, int j, int k) const {return SbVec3f(x[i][j][k],y[i][j][k],z[i][j][k]);};
00146
00147
00148
00149
00150 private:
00151
00152 float getLongestEdgeLength();
00153
00154
00155 void meshCrossSection(PoMeshCrossSection *cross_section) const;
00156 void meshCrossContour(PoMeshCrossContour *cross_contour) const ;
00157 void meshSkeleton(PoMeshSkeleton *skeleton, const float *nod_values,
00158 float *x_cont, float *y_cont,float *z_cont) const;
00159 void mesh3DVec(PoMesh3DVec *mesh_vec) const ;
00160 void print(FILE *fp) const;
00161 void printInfo() const {print(stdout);};
00162
00163
00164 virtual const PbCell *getTopoCell(int cell_index) const;
00165
00166 private:
00167 PbCartesianGrid3D(int num_x, int num_y, int num_z, SbBool is_data_duplicate=TRUE) ;
00168 void updateCellBoundingBox() const;
00169 void setXYZGeometry(int num_x, int num_y, int num_z, const float *x, const float *y, const float *z);
00170 void getXYZGeometry(const float* &x, const float* &y, const float* &z) const;
00171 virtual void grid3DSkin(PoMeshSkin *_PoMeshSkin) const;
00172
00173 private:
00174 void updateBoundingBox() const;
00175
00176 float ***x, ***y, ***z;
00177
00178 void copy(const PbCartesianGrid3D &mesh) ;
00179 void destroy();
00180
00181 mutable PbHexahedronCell *m_hexahedron;
00182
00183 } ;
00184
00185
00186
00187 #endif
00188
00189
00190
00191
00192
00193
00194
00195