00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MxPyramidCellExtract_h
00024 #define _MxPyramidCellExtract_h
00025
00026 #include <MeshVizXLM/mesh/geometry/MiGeometryI.h>
00027 #include <MeshVizXLM/extractors/MxHalfPyramidCell.h>
00028
00029 #include <Inventor/STL/vector>
00030 #include <Inventor/STL/utility>
00031
00032 class MxTabOfMarchingCase;
00033 class MiVolumeCell;
00034
00059 class MESHVIZXLM_EXTR_API MxPyramidCellExtract
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* pyramidCell, const MbVec3d &point);
00084
00104 static void getWeight(const MiGeometryI& meshGeometry, const MiVolumeCell* pyramidCell, const MbVec3d &point, std::vector<double>& weights)
00105 {
00106 getWeight(getIsoParametricCoord(meshGeometry,pyramidCell,point),weights);
00107 }
00108
00121 static void getWeight(const MbVec3d &ipcoord, std::vector<double>& weights)
00122 {
00123 double rm, sm, tm;
00124
00125 rm = 1. - ipcoord[0];
00126 sm = 1. - ipcoord[1];
00127 tm = 1. - ipcoord[2];
00128
00129 weights[0] = rm * sm * tm;
00130 weights[1] = ipcoord[0] * sm * tm;
00131 weights[2] = ipcoord[0] * ipcoord[1] * tm;
00132 weights[3] = ipcoord[1] * rm * tm;
00133 weights[4] = ipcoord[2];
00134 }
00135
00147 static void getDerivs(const MbVec3d &ipcoord, std::vector<double>& derivs);
00148
00162 static bool isPointInsideCell(const MiGeometryI& meshGeometry, const MiVolumeCell* pyramidCell, const MbVec3d &point, std::vector<double>& weights)
00163 {
00164 size_t n0 = pyramidCell->getNodeIndex(0);
00165 size_t n1 = pyramidCell->getNodeIndex(1);
00166 size_t n2 = pyramidCell->getNodeIndex(2);
00167 size_t n3 = pyramidCell->getNodeIndex(3);
00168 size_t n4 = pyramidCell->getNodeIndex(4);
00169 s_halfPyramid.setNodeIds(n0,n1,n2,n4);
00170 bool inside = s_halfPyramid.isPointInsideCell(meshGeometry,point,weights);
00171 if (!inside)
00172 {
00173 s_halfPyramid.setNodeIds(n0,n2,n3,n4);
00174 inside = s_halfPyramid.isPointInsideCell(meshGeometry,point,weights);
00175 }
00176 if(inside)
00177 getWeight(meshGeometry,pyramidCell,point,weights);
00178 return inside;
00179 }
00180
00184 static double getVolume(const MiGeometryI& meshGeometry, const MiVolumeCell* pyramidCell);
00185
00189 static MbVec3d getFacetNormal(size_t facetId, const MiGeometryI& meshGeometry, const MiVolumeCell* pyramidCell);
00190
00194 static double getLongestEdgeLength(const MiGeometryI& meshGeometry, const MiVolumeCell* cell);
00195
00199 static double getShortestEdgeLength(const MiGeometryI& meshGeometry, const MiVolumeCell* cell);
00200
00201 private:
00202
00203 static bool initClass();
00204 static void exitClass();
00205
00206 static void initMarchingCase0();
00207 static void initMarchingCase1();
00208 static void initMarchingCase2();
00209 static void initMarchingCase3();
00210 static void initMarchingCase4();
00211 static void initMarchingCase5();
00212
00213
00214 static bool s_isInit;
00215 static MxTabOfMarchingCase* s_tabOfMarchingPyramid;
00216 static MxHalfPyramidCell s_halfPyramid;
00217 };
00218
00219 #endif
00220
00221