00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MxWedgeCellExtract_h
00024 #define _MxWedgeCellExtract_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 MESHVIZXLM_EXTR_API MxWedgeCellExtract
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* wedgeCell, 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* wedgeCell, const MbVec3d &point, std::vector<double>& weights)
00115 {
00116 MbVec3d ipcoord = getIsoParametricCoord(meshGeometry,wedgeCell,point);
00117 getWeight(ipcoord,weights);
00118 }
00119
00132 static void getWeight(const MbVec3d &ipcoord, std::vector<double>& weights)
00133 {
00134 double um, tm;
00135
00136 um = 1. - ipcoord[0] - ipcoord[1];
00137 tm = 1. - ipcoord[2];
00138
00139 weights[0] = um * tm;
00140 weights[1] = ipcoord[0] * tm;
00141 weights[2] = ipcoord[1] * tm;
00142
00143 weights[3] = um * ipcoord[2];
00144 weights[4] = ipcoord[0] * ipcoord[2];
00145 weights[5] = ipcoord[1] * ipcoord[2];
00146 }
00147
00159 static void getDerivs(const MbVec3d &ipcoord, std::vector<double>& derivs);
00160
00174 static bool isPointInsideCell(const MiGeometryI& meshGeometry, const MiVolumeCell* wedgeCell, const MbVec3d &point, std::vector<double>& weights)
00175 {
00176 MbVec3d pcoord = getIsoParametricCoord(meshGeometry,wedgeCell,point);
00177 bool inside = ( -1.E-5 < pcoord[0] && pcoord[0] < 1 + 1.E-5 &&
00178 -1.E-5 < pcoord[1] && pcoord[1] < 1 + 1.E-5 &&
00179 -1.E-5 < pcoord[2] && pcoord[2] < 1 + 1.E-5 &&
00180 -1.E-5 < (pcoord[0]+pcoord[1]) && (pcoord[0]+pcoord[1]) < 1 + 1.E-5);
00181 if (inside)
00182 getWeight(pcoord,weights);
00183 return inside;
00184 }
00185
00189 static double getVolume(const MiGeometryI& meshGeometry, const MiVolumeCell* wedgeCell);
00190
00194 static MbVec3d getFacetNormal(size_t facet, const MiGeometryI& meshGeometry, const MiVolumeCell* wedgeCell);
00195
00199 static double getLongestEdgeLength(const MiGeometryI& meshGeometry, const MiVolumeCell* cell);
00200
00204 static double getShortestEdgeLength(const MiGeometryI& meshGeometry, const MiVolumeCell* cell);
00205
00206 private:
00207
00208 static bool initClass();
00209 static void exitClass();
00210
00211 static void initMarchingCase0();
00212 static void initMarchingCase1();
00213 static void initMarchingCase2();
00214 static void initMarchingCase3();
00215 static void initMarchingCase4();
00216 static void initMarchingCase5();
00217 static void initMarchingCase6();
00218 static void initMarchingCase7();
00219 static void initMarchingCase8();
00220 static void initMarchingCase9();
00221
00222 static bool s_isInit;
00223 static MxTabOfMarchingCase* s_tabOfMarchingWedge;
00224 static double s_nodesIsoParametricCoords[6][3];
00225 };
00226
00227 #endif
00228
00229