00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MxHexahedron27CellExtract_h
00024 #define _MxHexahedron27CellExtract_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 MxHexahedron27CellExtract
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]+24);
00188 return 8;
00189 }
00190
00199 static size_t getSubTetrahedronNodesIndex (std::vector<size_t>& tetrahedronNodeIds)
00200 {
00201 tetrahedronNodeIds.assign(s_subTetrahedronNodeIds,s_subTetrahedronNodeIds+(48*4));
00202 return 48;
00203 }
00204
00205
00206 private:
00213 static void get27Derivs(double r, double s, double t, size_t numNodes, std::vector<double>& derivs);
00214
00215 friend std::ostream& operator << (std::ostream& s, const MxHexahedron27CellExtract& cell);
00216 private:
00217
00218 static bool initClass();
00219 static void exitClass();
00220
00221 static void computeSubTetrahedronNodesIndex();
00222 static void addSubWedge(size_t n0,size_t n1,size_t n2, size_t n3,size_t n4,size_t n5, size_t orient, std::vector<size_t>& wedgeNodeIds);
00223 template <typename _F>
00224 static void addSymetricWedgesByPlane(_F& symetricByPlane, std::vector<size_t>& wedgeNodeIds);
00225 static void decomposeWedge(size_t orient, size_t n0,size_t n1,size_t n2, size_t n3,size_t n4,size_t n5, std::vector<size_t>& tetraNodeIds);
00226
00227 static void computeSubTriangleNodesIndex();
00228 template <typename _F>
00229 static void addSymetricTrianglesByPlane(_F& symetricByPlane, std::vector<size_t>& triangleNodeIds);
00230 static void addTriangle(size_t n0, size_t n1, size_t n2, std::vector<size_t>& triangleNodeIds);
00231 static bool s_isInit;
00232 static double s_nodesIsoParametricCoords[27][3];
00233 static size_t s_subFacetNode[6][24];
00234
00235 static size_t s_subTetrahedronNodeIds[48*4];
00236 static size_t s_facetNode[6][4];
00237
00238 static int s_imat0[36];
00239 static int s_imat1[24];
00240 static int s_imat2[24];
00241 static int s_imat3[18];
00242 static int s_iperm[24];
00243 };
00244
00245 #endif
00246
00247