00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MxHexahedronCellExtract_h
00024 #define _MxHexahedronCellExtract_h
00025
00026 #include <MeshVizXLM/mesh/geometry/MiGeometryI.h>
00027
00028 #include <Inventor/STL/vector>
00029 #include <Inventor/STL/utility>
00030
00031 class MxTabOfMarchingCase;
00032 class MiVolumeCell;
00033
00059 class MESHIVIZ_API MxHexahedronCellExtract
00060 {
00061 public:
00062
00068 static void getIsosurfTopology(unsigned char caseId, std::vector< std::pair<size_t,size_t> >& edgeList );
00069
00083 static MbVec3d getIsoParametricCoord(const MiGeometryI& meshGeometry, const MiVolumeCell* hexahedronCell, const MbVec3d &point);
00084
00090 static MbVec3d getIsoParametricCoord(size_t nodeIndex);
00091
00111 static void getWeight(const MiGeometryI& meshGeometry, const MiVolumeCell* hexahedronCell, const MbVec3d &point, std::vector<double>& weights)
00112 {
00113 MbVec3d ipcoord = getIsoParametricCoord(meshGeometry,hexahedronCell,point);
00114 getWeight(ipcoord,weights);
00115 }
00116
00129 static void getWeight(const MbVec3d &ipcoord, std::vector<double>& weights)
00130 {
00131 double rm, sm, tm;
00132
00133 rm = 1. - ipcoord[0];
00134 sm = 1. - ipcoord[1];
00135 tm = 1. - ipcoord[2];
00136
00137 weights[0] = rm*sm*tm;
00138 weights[1] = ipcoord[0] * sm * tm;
00139 weights[2] = ipcoord[0]*ipcoord[1] * tm;
00140 weights[3] = rm * ipcoord[1] * tm;
00141 weights[4] = rm * sm * ipcoord[2];
00142 weights[5] = ipcoord[0] * sm * ipcoord[2];
00143 weights[6] = ipcoord[0] * ipcoord[1] * ipcoord[2];
00144 weights[7] = rm * ipcoord[1] * ipcoord[2];
00145 }
00146
00158 static void getDerivs(const MbVec3d &ipcoord, std::vector<double>& derivs);
00159
00173 static bool isPointInsideCell(const MiGeometryI& meshGeometry, const MiVolumeCell* hexahedronCell, const MbVec3d &point, std::vector<double>& weights)
00174 {
00175 MbVec3d pcoord = getIsoParametricCoord(meshGeometry,hexahedronCell,point);
00176 bool inside = ( -1.E-5 < pcoord[0] && pcoord[0] < 1 + 1.E-5 &&
00177 -1.E-5 < pcoord[1] && pcoord[1] < 1 + 1.E-5 &&
00178 -1.E-5 < pcoord[2] && pcoord[2] < 1 + 1.E-5 );
00179 if (inside)
00180 getWeight(pcoord,weights);
00181 return inside;
00182 }
00183
00187 static double getVolume(const MiGeometryI& meshGeometry, const MiVolumeCell* hexahedronCell);
00188
00192 static MbVec3d getFacetNormal(size_t facetId, const MiGeometryI& meshGeometry, const MiVolumeCell* pyramidCell);
00193
00197 static double getLongestEdgeLength(const MiGeometryI& meshGeometry, const MiVolumeCell* cell);
00198
00202 static double getShortestEdgeLength(const MiGeometryI& meshGeometry, const MiVolumeCell* cell);
00203
00204 private:
00205
00206 static bool initClass();
00207 static void exitClass();
00208
00209 static void initMarchingCase0();
00210 static void initMarchingCase1();
00211 static void initMarchingCase2();
00212 static void initMarchingCase3();
00213 static void initMarchingCase4();
00214 static void initMarchingCase5();
00215 static void initMarchingCase6();
00216 static void initMarchingCase7();
00217 static void initMarchingCase8();
00218 static void initMarchingCase9();
00219 static void initMarchingCase10();
00220 static void initMarchingCase11();
00221 static void initMarchingCase12();
00222 static void initMarchingCase13();
00223 static void initMarchingCase14();
00224
00225 static bool s_isInit;
00226 static MxTabOfMarchingCase* s_tabOfMarchingCube;
00227 static double s_nodesIsoParametricCoords[8][3];
00228
00229 };
00230
00231 #endif
00232
00233