00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MxWedge18CellExtract_h
00024 #define _MxWedge18CellExtract_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 MxWedge18CellExtract
00063 {
00064 public:
00065
00079 static MbVec3d getIsoParametricCoord(const MiGeometryI& meshGeometry, const MiVolumeCell* wedgeCell, const MbVec3d &point);
00080
00086 static MbVec3d getIsoParametricCoord(size_t nodeIndex);
00087
00107 static void getWeight(const MiGeometryI& meshGeometry, const MiVolumeCell* wedgeCell, const MbVec3d &point, std::vector<double>& weights)
00108 {
00109 MbVec3d ipcoord = getIsoParametricCoord(meshGeometry,wedgeCell,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* wedgeCell, const MbVec3d &point, std::vector<double>& weights)
00154 {
00155 MbVec3d pcoord = getIsoParametricCoord(meshGeometry,wedgeCell,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[0]+pcoord[1]) < 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_linearNodesPerFacet[facet],s_linearNodesPerFacet[facet]+s_numLinearNodesPerFacet[facet]);
00175 return s_numLinearNodesPerFacet[facet];
00176 }
00177
00186 static size_t getSubTriangleNodesIndex(size_t face, std::vector<size_t>& triangleNodeIds)
00187 {
00188 triangleNodeIds.assign(s_subTrianglePerFacet[face],s_subTrianglePerFacet[face]+(3*s_numSubTrianglePerFacet[face]));
00189 return s_numSubTrianglePerFacet[face];
00190 }
00191
00200 static size_t getSubTetrahedronNodesIndex (std::vector<size_t>& tetrahedronNodeIds)
00201 {
00202 tetrahedronNodeIds.assign(s_subTetrahedronNodeIds,s_subTetrahedronNodeIds+(24*4));
00203 return 24;
00204 }
00205
00206
00207 private:
00214 static void get18Derivs(double r, double s, double t, size_t numNodes, std::vector<double>& derivs);
00215
00216 friend std::ostream& operator << (std::ostream& s, const MxWedge18CellExtract& cell);
00217 private:
00218
00219 static bool initClass();
00220 static void exitClass();
00221
00222 static void computeSubTetrahedronNodesIndex();
00223 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);
00224
00225 template <typename _F>
00226 static void addSymetricWedgesByPlane(_F& symetricByPlane, std::vector<size_t>& wedgeNodeIds);
00227 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);
00228
00229 static void computeSubTriangleNodesIndex();
00230 template <typename _F>
00231 static std::vector<size_t> getSymetricTriangles(_F& symetricFunctor, const std::vector<size_t>& triangleNodeIds);
00232 template <typename _F>
00233 static std::vector<size_t> getRotateTriangles(_F& rotateFunctor, const std::vector<size_t>& triangleNodeIds);
00234 static void addTriangle(size_t n0, size_t n1, size_t n2, std::vector<size_t>& triangleNodeIds);
00235
00236 static bool s_isInit;
00237
00238 static double s_nodesIsoParametricCoords[18][3];
00239
00240 static size_t s_linearNodesPerFacet[5][4];
00241 static size_t s_numLinearNodesPerFacet[5];
00242
00243 static size_t s_numSubTrianglePerFacet[5];
00244 static size_t s_subTrianglePerFacet[5][24];
00245
00246 static size_t s_subTetrahedronNodeIds[24*4];
00247
00248 static int s_imat0[36];
00249 static int s_imat1[24];
00250 static int s_imat2[24];
00251 static int s_imat3[18];
00252 static int s_iperm[24];
00253 };
00254
00255 #endif
00256
00257