00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MxQuadrangleCellExtract_h
00024 #define _MxQuadrangleCellExtract_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
00056 class MESHIVIZ_API MxQuadrangleCellExtract
00057 {
00058 public:
00059
00073 static MbVec3d getIsoParametricCoord(const MiGeometryI& meshGeometry, const MiSurfaceCell* quadrangleCell, const MbVec3d &point);
00074
00080 static MbVec3d getIsoParametricCoord(size_t nodeIndex);
00081
00101 static void getWeight(const MiGeometryI& meshGeometry, const MiSurfaceCell* quadrangleCell, const MbVec3d &point, std::vector<double>& weights)
00102 {
00103 getWeight(getIsoParametricCoord(meshGeometry,quadrangleCell,point),weights);
00104 }
00105
00118 static void getWeight(const MbVec3d &ipcoord, std::vector<double>& weights)
00119 {
00120 double rm, sm;
00121
00122 rm = 1. - ipcoord[0];
00123 sm = 1. - ipcoord[1];
00124
00125 weights[0] = rm*sm;
00126 weights[1] = ipcoord[0]*sm;
00127 weights[2] = ipcoord[0]*ipcoord[1];
00128 weights[3] = rm*ipcoord[1];
00129 }
00130
00142 static void getDerivs(const MbVec3d &ipcoord, std::vector<double>& derivs);
00143
00157 static bool isPointInsideCell(const MiGeometryI& meshGeometry, const MiSurfaceCell* quadrangleCell, const MbVec3d &point, std::vector<double>& weights)
00158 {
00159 MbVec3d pcoord = getIsoParametricCoord(meshGeometry,quadrangleCell,point);
00160 bool inside = ( -1.E-5 < pcoord[0] && pcoord[0] < 1 + 1.E-5 &&
00161 -1.E-5 < pcoord[1] && pcoord[1] < 1 + 1.E-5 );
00162 if (inside)
00163 getWeight(pcoord,weights);
00164 return inside;
00165 }
00166
00170 static double getLongestEdgeLength(const MiGeometryI& meshGeometry, const MiSurfaceCell* cell);
00171
00175 static double getShortestEdgeLength(const MiGeometryI& meshGeometry, const MiSurfaceCell* cell);
00176
00177 private:
00178
00179 static bool initClass();
00180 static void exitClass();
00181
00182 static bool s_isInit;
00183 static double s_nodesIsoParametricCoords[4][3];
00184 };
00185
00186 #endif
00187
00188