00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MxTetrahedronCellExtract_h
00024 #define _MxTetrahedronCellExtract_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 MxTetrahedronCellExtract
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* tetrahedronCell, const MbVec3d &point);
00084
00090 static MbVec3d getIsoParametricCoord(size_t nodeIndex)
00091 {
00092 return MbVec3d(s_nodesIsoParametricCoords[nodeIndex]);
00093 }
00094
00114 static void getWeight(const MiGeometryI& meshGeometry, const MiVolumeCell* tetrahedronCell, const MbVec3d &point, std::vector<double>& weights)
00115 {
00116 MbVec3d ipcoord = getIsoParametricCoord(meshGeometry,tetrahedronCell,point);
00117 getWeight(ipcoord,weights);
00118 }
00119
00132 static void getWeight(const MbVec3d &ipcoord, std::vector<double>& weights)
00133 {
00134 ipcoord.getValue(weights[1],weights[2],weights[3]);
00135 weights[0] = 1.0 - weights[1] - weights[2] - weights[3];
00136 }
00137
00149 static void getDerivs(const MbVec3d &ipcoord, std::vector<double>& derivs);
00150
00164 static bool isPointInsideCell(const MiGeometryI& meshGeometry, const MiVolumeCell* tetrahedronCell, const MbVec3d &point, std::vector<double>& weights)
00165 {
00166 getWeight(getIsoParametricCoord(meshGeometry,tetrahedronCell,point),weights);
00167 return ( -1.E-5 < weights[0] && weights[0] < 1 + 1.E-5 &&
00168 -1.E-5 < weights[1] && weights[1] < 1 + 1.E-5 &&
00169 -1.E-5 < weights[2] && weights[2] < 1 + 1.E-5 &&
00170 -1.E-5 < weights[3] && weights[3] < 1 + 1.E-5);
00171 }
00172
00176 static double getVolume(const MiGeometryI& meshGeometry, const MiVolumeCell* tetrahedronCell);
00177
00181 static MbVec3d getFacetNormal(size_t facetId, const MiGeometryI& meshGeometry, const MiVolumeCell* tetrahedronCell);
00182
00186 static double getLongestEdgeLength(const MiGeometryI& meshGeometry, const MiVolumeCell* cell);
00187
00191 static double getShortestEdgeLength(const MiGeometryI& meshGeometry, const MiVolumeCell* cell);
00192
00193 private:
00194
00195 static bool initClass();
00196 static void exitClass();
00197
00198 static void initMarchingCase0();
00199 static void initMarchingCase1();
00200 static void initMarchingCase2();
00201
00202 static bool s_isInit;
00203 static MxTabOfMarchingCase* s_tabOfMarchingTetra;
00204 static double s_nodesIsoParametricCoords[4][3];
00205 };
00206
00207 #endif
00208
00209