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_INDEXEDMESH3D_
00025 #define _PB_INDEXEDMESH3D_
00026
00027 #include <MeshViz/3Ddata/PbMesh3D.h>
00028
00029 class PbHexahedronCell;
00030 class PbTetrahedronCell;
00031 class PbWedgeCell;
00032 class PbPyramidCell;
00033
00063 class PbIndexedMesh3D : public PbMesh3D {
00064
00065
00066 public:
00067
00068
00069
00073 PbIndexedMesh3D(SbBool is_data_duplicate=TRUE);
00074
00078 PbIndexedMesh3D(const PbIndexedMesh3D &mesh);
00079
00084 PbIndexedMesh3D(int num_nodes, const float *x_nod, const float *y_nod, const float *z_nod,
00085 int num_cells, const int *cell_index, const int *cell_type,
00086 SbBool is_data_duplicate=TRUE) ;
00087
00091 ~PbIndexedMesh3D() ;
00092
00096 PbIndexedMesh3D& operator=(const PbIndexedMesh3D &mesh) ;
00097
00101 friend int operator ==(const PbIndexedMesh3D &m1, const PbIndexedMesh3D &m2);
00102
00106 friend int operator !=(const PbIndexedMesh3D &m1, const PbIndexedMesh3D &m2)
00107 { return !(m1 == m2); }
00108
00112 void setGeometry(int num_nodes, const float *x_nod, const float *y_nod, const float *z_nod,
00113 int num_cells, const int *cell_index, const int *cell_type);
00114
00121 void setCoordinates(const float *x_nod, const float *y_nod, const float *z_nod);
00122
00132 void getCoordinates(const float* &xnod, const float* &ynod, const float* &znod,
00133 int &size_xnod, int &size_ynod, int &size_znod) const {
00134 xnod = xNodes;
00135 ynod = yNodes;
00136 znod = zNodes;
00137 size_xnod = size_ynod = size_znod = numMeshNodes;
00138 }
00139
00145 void getGeometry(int &num_nodes, const float* &x_nod, const float* &y_nod, const float* &z_nod,
00146 int &num_cells, const int *&cell_index, const int *&cell_type) const ;
00147
00153 void getNodes(int &num_nodes, const float* &x_nod, const float* &y_nod, const float* &z_nod) const;
00154
00158 virtual SbVec3f getNodeCoord(int nod_index) const { return SbVec3f(xNodes[nod_index],yNodes[nod_index],zNodes[nod_index]);};
00159
00163 virtual void getNodeOwnerCellsInd(int nod_index, PbArrayOfInt &owner_cells) const;
00164
00171 virtual const PbCell *getCell(int cell_index) const;
00172
00173
00174 private:
00175
00176
00177 float getLongestEdgeLength();
00178
00179 void meshSkin(PoMeshSkin *mesh_skin) const ;
00180 void meshSkinFilter(PoMeshSkin *_PoMeshSkin,const PoCellFilter* cellFilter) const;
00181 void meshCrossSection(PoMeshCrossSection *cross_section) const;
00182 void meshCrossContour(PoMeshCrossContour *cross_contour) const;
00183 void meshSkeleton(PoMeshSkeleton *skeleton, const float *nod_values,
00184 float *x_cont, float *y_cont,float *z_cont) const;
00185 void mesh3DVec(PoMesh3DVec *mesh_vec) const ;
00186 SbBool isEmpty() const;
00187 void print(FILE *fp) const;
00188
00189
00190 virtual const PbCell *getTopoCell(int cell_index) const;
00191
00192 private:
00193 void updateCellBoundingBox() const;
00194 virtual void updateOwnerCellsList() const;
00195 virtual void deleteOwnerCellsList() const;
00196 void updateBoundingBox() const;
00197
00198 int allocNodes;
00199 float *xNodes, *yNodes, *zNodes;
00200 int allocElemIndex, *elemIndex, elemIndexSize;
00201 int allocElem, *elemType;
00202
00203 void setVertices(int num_nodes, const float *x_nod, const float *y_nod, const float *z_nod);
00204
00205 mutable PbArrayOfInt *m_ownerCellsList;
00206
00207
00208 mutable PbArrayOfInt m_firstIndexOfCell;
00209
00210 private:
00211 void copy(const PbIndexedMesh3D &mesh) ;
00212 void destroy();
00213 PbHexahedronCell *m_hexahedron;
00214 PbTetrahedronCell *m_tetrahedron;
00215 PbWedgeCell *m_wedge;
00216 PbPyramidCell *m_pyramid;
00217 } ;
00218
00219
00220 inline void
00221 PbIndexedMesh3D::meshSkinFilter(PoMeshSkin *,const PoCellFilter* ) const
00222 {}
00223
00224
00225
00226 #endif
00227
00228
00229
00230
00231
00232
00233
00234