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_HEXAHEDRONCELL_
00025 #define _PB_HEXAHEDRONCELL_
00026
00027 #include <MeshViz/3Ddata/PbCell.h>
00028
00029 #ifdef USE_IOSTREAM
00030 # include <iostream>
00031 #endif
00032
00033 class PbMesh;
00034 class PiMarchingCase;
00035
00064 class PbHexahedronCell : public PbCell {
00065
00066 public:
00067
00071 PbHexahedronCell(const PbMesh *owner_mesh) ;
00072
00076 PbHexahedronCell(const PbHexahedronCell &cell);
00077
00081 ~PbHexahedronCell() ;
00082
00086 PbHexahedronCell& operator=(const PbHexahedronCell &cell) ;
00087
00091 virtual float getLongestEdgeLength() const;
00092
00096 virtual float getVolume() const;
00097
00101 virtual float getArea() const { return 0.0;}
00102
00107 virtual void getNodesIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const;
00108
00113 virtual void getNodesIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const;
00114
00120 virtual void getNodesLocalIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const;
00121
00127 virtual void getNodesLocalIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const;
00128
00133 virtual int locatePoint(const SbVec3f &coord, float tolerance, SbVec3f &pcoord) const;
00134
00138 virtual void getWeight(const SbVec3f &pcoord, float *weight) const;
00139
00144 void getDerivs(const SbVec3f &pcoord, float *weight) const;
00145
00146
00147 private:
00151 SbBool set(int index, int *node_ids, float *x, float *y, float *z);
00152
00153 void print(FILE *fp) const;
00154
00155
00157 virtual int getOrdering() const;
00158
00159 virtual const int* getNodesLocalIndexOfEdge(int edge) const {
00160 return c_edgeNodes[edge];
00161 }
00162
00163
00164 static PiMarchingCase* c_MarchingLookup[256];
00165
00166 PiMarchingCase* getMCcase(unsigned char mc_case) const {
00167 return c_MarchingLookup[mc_case];
00168 }
00169
00170
00171 #ifdef USE_IOSTREAM
00172 friend std::ostream& operator << (std::ostream& s, PbHexahedronCell &cell);
00173 #endif
00174
00175 static SbBool init();
00176 static void finish();
00177
00178
00179 private:
00180 virtual unsigned char getIsosurfCaseId(SbBoolVector &nodes_sign) const;
00181
00182 private:
00183
00184 void copy(const PbHexahedronCell &cell) ;
00185 void destroy();
00186
00187 static PiMarchingCase* addMC(PiMarchingCase *mcase);
00188 static PiMarchingCase* addMCBoth(PiMarchingCase *mcase);
00189
00190 static int c_edgeNodes[12][2];
00191 static SbBool c_isInit;
00192 static size_t c_numInit;
00193
00194 static int c_count;
00195 };
00196
00197
00198
00199 #endif
00200
00201
00202
00203
00204
00205
00206
00207