00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #ifndef  _MxQuadrangle8CellExtract_h
00024 #define  _MxQuadrangle8CellExtract_h
00025 
00026 #include <MeshVizXLM/mesh/geometry/MiGeometryI.h>
00027 
00028 #include <Inventor/STL/vector>
00029 #include <Inventor/STL/utility>
00030 
00031 class MiSurfaceCell;
00032 
00057 class MESHIVIZ_API MxQuadrangle8CellExtract 
00058 {
00059 public:
00060 
00074   static MbVec3d getIsoParametricCoord(const MiGeometryI& meshGeometry, const MiSurfaceCell* quadrangleCell, const MbVec3d &point);
00075   
00081   static MbVec3d getIsoParametricCoord(size_t nodeIndex)
00082   {
00083     return MbVec3d(s_nodesIsoParametricCoords[nodeIndex]);
00084   }
00085 
00105   static void getWeight(const MiGeometryI& meshGeometry, const MiSurfaceCell* quadrangleCell, const MbVec3d &point, std::vector<double>& weights)
00106   {
00107     getWeight(getIsoParametricCoord(meshGeometry,quadrangleCell,point),weights);
00108   }
00109 
00122   static void getWeight(const MbVec3d &ipcoord, std::vector<double>& weights);
00123 
00135   static void getDerivs(const MbVec3d &ipcoord, std::vector<double>& derivs);
00136 
00150   static bool isPointInsideCell(const MiGeometryI& meshGeometry, const MiSurfaceCell* quadrangleCell, const MbVec3d &point, std::vector<double>& weights)
00151   {
00152     MbVec3d pcoord = getIsoParametricCoord(meshGeometry,quadrangleCell,point);
00153     bool inside = ( -1.E-5 < pcoord[0] &&  pcoord[0] < 1 + 1.E-5 &&
00154                     -1.E-5 < pcoord[1] &&  pcoord[1] < 1 + 1.E-5 );
00155     if (inside)
00156       getWeight(pcoord,weights);
00157     return inside;
00158   }
00159 
00167   static size_t getSubTriangleNodesIndex (std::vector<size_t>& triangleNodeIds)
00168   {
00169     triangleNodeIds.assign(s_subTriangleNodeIds,s_subTriangleNodeIds+(6*3));
00170     return 6;
00171   }
00172 
00173   friend std::ostream& operator << (std::ostream& s, const MxQuadrangle8CellExtract& cell);
00174 
00175 private:
00176   static double s_nodesIsoParametricCoords[8][3];
00177   static size_t s_subTriangleNodeIds[6*3];
00178 };
00179 
00180 #endif 
00181 
00182