00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #ifndef  _MxHexahedron20CellExtract_h
00024 #define  _MxHexahedron20CellExtract_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 MxHexahedron20CellExtract 
00063 {
00064 public:
00065 
00079   static MbVec3d getIsoParametricCoord(const MiGeometryI& meshGeometry, const MiVolumeCell* hexahedronCell, const MbVec3d &point);
00080   
00086   static MbVec3d getIsoParametricCoord(size_t nodeIndex);
00087 
00107   static void getWeight(const MiGeometryI& meshGeometry, const MiVolumeCell* hexahedronCell, const MbVec3d &point, std::vector<double>& weights)
00108   {
00109     MbVec3d ipcoord = getIsoParametricCoord(meshGeometry,hexahedronCell,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* hexahedronCell, const MbVec3d &point, std::vector<double>& weights)
00154   {
00155     MbVec3d pcoord = getIsoParametricCoord(meshGeometry,hexahedronCell,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     if (inside)
00160       getWeight(pcoord,weights);
00161     return inside;
00162   }
00163 
00171   static size_t getNodesIndexOfFacet (size_t facet, std::vector<size_t>& facetNodes)
00172   {
00173     facetNodes.assign(s_facetNode[facet],s_facetNode[facet]+4);
00174     return 4;
00175   }
00176 
00185   static size_t getSubTriangleNodesIndex(size_t face, std::vector<size_t>& triangleNodeIds)  
00186   {
00187     triangleNodeIds.assign(s_subFacetNode[face],s_subFacetNode[face]+18);
00188     return 6;
00189   }
00190 
00199   static size_t getSubTetrahedronNodesIndex (std::vector<size_t>& tetrahedronNodeIds)
00200   {
00201     tetrahedronNodeIds.assign(s_subTetrahedronNodeIds,s_subTetrahedronNodeIds+88);
00202     return 22;
00203   }
00204 
00205 
00206 private:
00213   static void get20Derivs(double r, double s, double t, size_t numNodes, std::vector<double>& derivs);
00214 
00215 private:
00216 
00217   static bool initClass();
00218   static void exitClass();
00219 
00220   static bool   s_isInit;
00221   static double s_nodesIsoParametricCoords[20][3];
00222   static size_t s_subFacetNode[6][18];
00223   
00224   static size_t s_subTetrahedronNodeIds[22*4]; 
00225   static size_t s_symetricByFace_16_17_18_19[20];
00226 
00227   static size_t s_facetNode[6][4];
00228 };
00229 
00230 #endif 
00231 
00232