00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MxTetrahedron10CellExtract_h
00024 #define _MxTetrahedron10CellExtract_h
00025
00026 #include <MeshVizXLM/mesh/geometry/MiGeometryI.h>
00027
00028 #include <Inventor/STL/vector>
00029 #include <Inventor/STL/utility>
00030
00031 class MiVolumeCell;
00032
00062 class MESHIVIZ_API MxTetrahedron10CellExtract
00063 {
00064 public:
00065
00079 static MbVec3d getIsoParametricCoord(const MiGeometryI& meshGeometry, const MiVolumeCell* tetrahedronCell, const MbVec3d &point);
00080
00086 static MbVec3d getIsoParametricCoord(size_t nodeIndex);
00087
00107 static void getWeight(const MiGeometryI& meshGeometry, const MiVolumeCell* tetrahedronCell, const MbVec3d &point, std::vector<double>& weights)
00108 {
00109 MbVec3d ipcoord = getIsoParametricCoord(meshGeometry,tetrahedronCell,point);
00110 getWeight(ipcoord,weights);
00111 }
00112
00125 static void getWeight(const MbVec3d &ipcoord, std::vector<double>& weights);
00126
00138 static void getDerivs(const MbVec3d &ipcoord, std::vector<double>& derivs);
00139
00153 static bool isPointInsideCell(const MiGeometryI& meshGeometry, const MiVolumeCell* tetrahedronCell, const MbVec3d &point, std::vector<double>& weights)
00154 {
00155 MbVec3d pcoord = getIsoParametricCoord(meshGeometry,tetrahedronCell,point);
00156 bool inside = ( -1.E-5 < pcoord[0] && pcoord[0] < 1 + 1.E-5 &&
00157 -1.E-5 < pcoord[1] && pcoord[1] < 1 + 1.E-5 &&
00158 -1.E-5 < pcoord[2] && pcoord[2] < 1 + 1.E-5 &&
00159 -1.E-5 < (pcoord[0]+pcoord[1]+pcoord[2]) && (pcoord[0]+pcoord[1]+pcoord[2]) < 1 + 1.E-5);
00160 if (inside)
00161 getWeight(pcoord,weights);
00162 return inside;
00163 }
00164
00172 static size_t getNodesIndexOfFacet (size_t facet, std::vector<size_t>& facetNodes)
00173 {
00174 facetNodes.assign(s_facetNode[facet],s_facetNode[facet]+3);
00175 return 3;
00176 }
00177
00186 static size_t getSubTriangleNodesIndex(size_t face, std::vector<size_t>& triangleNodeIds)
00187 {
00188 triangleNodeIds.assign(s_subFacetNode[face],s_subFacetNode[face]+12);
00189 return 4;
00190 }
00191
00200 static size_t getSubTetrahedronNodesIndex (std::vector<size_t>& tetrahedronNodeIds)
00201 {
00202 tetrahedronNodeIds.assign(s_subTetrahedronNodeIds,s_subTetrahedronNodeIds+(8*4));
00203 return 8;
00204 }
00205
00206
00207 private:
00208 friend std::ostream& operator << (std::ostream& s, const MxTetrahedron10CellExtract& cell);
00209
00210 private:
00211
00212 static bool initClass();
00213 static void exitClass();
00214
00215 static bool s_isInit;
00216 static double s_nodesIsoParametricCoords[10][3];
00217 static size_t s_subFacetNode[4][12];
00218
00219 static size_t s_subTetrahedronNodeIds[8*4];
00220 static size_t s_facetNode[4][3];
00221 };
00222
00223 #endif
00224
00225