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
00120 using PbGrid3D::getGeometry;
00121
00128 virtual const PbCell *getCell(int cell_index) const;
00129
00133 virtual SbVec3f getNodeCoord(int nod_index) const;
00134
00138 SbVec3f getNodeCoord(int i, int j, int k) const {return SbVec3f(x[i][j][k],y[i][j][k],z[i][j][k]);};
00139
00140
00141
00142
00143 private:
00144
00145 float getLongestEdgeLength();
00146
00147
00148 void meshCrossSection(PoMeshCrossSection *cross_section) const;
00149 void meshCrossContour(PoMeshCrossContour *cross_contour) const ;
00150 void meshSkeleton(PoMeshSkeleton *skeleton, const float *nod_values,
00151 float *x_cont, float *y_cont,float *z_cont) const;
00152 void mesh3DVec(PoMesh3DVec *mesh_vec) const ;
00153 void print(FILE *fp) const;
00154
00155
00156 virtual const PbCell *getTopoCell(int cell_index) const;
00157
00158 private:
00159 PbCartesianGrid3D(int num_x, int num_y, int num_z, SbBool is_data_duplicate=TRUE) ;
00160 void updateCellBoundingBox() const;
00161 void setXYZGeometry(int num_x, int num_y, int num_z, const float *x, const float *y, const float *z);
00162 void getXYZGeometry(const float* &x, const float* &y, const float* &z) const;
00163 virtual void grid3DSkin(PoMeshSkin *_PoMeshSkin) const;
00164
00165 private:
00166 void updateBoundingBox() const;
00167
00168 float ***x, ***y, ***z;
00169
00170 void copy(const PbCartesianGrid3D &mesh) ;
00171 void destroy();
00172
00173 mutable PbHexahedronCell *m_hexahedron;
00174
00175 } ;
00176
00177
00178
00179 #endif
00180
00181
00182
00183
00184
00185
00186
00187