SALOME - SMESH
StdMeshers_Quadrangle_2D.hxx
Go to the documentation of this file.
00001 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 //  This library is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU Lesser General Public
00008 //  License as published by the Free Software Foundation; either
00009 //  version 2.1 of the License.
00010 //
00011 //  This library is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 //  Lesser General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU Lesser General Public
00017 //  License along with this library; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 //  SMESH SMESH : implementaion of SMESH idl descriptions
00023 //  File   : StdMeshers_Quadrangle_2D.hxx
00024 //           Moved here from SMESH_Quadrangle_2D.hxx
00025 //  Author : Paul RASCLE, EDF
00026 //  Module : SMESH
00027 //  $Header$
00028 //
00029 #ifndef _SMESH_QUADRANGLE_2D_HXX_
00030 #define _SMESH_QUADRANGLE_2D_HXX_
00031 
00032 #include "SMESH_StdMeshers.hxx"
00033 
00034 #include "SMESH_2D_Algo.hxx"
00035 #include "Utils_SALOME_Exception.hxx"
00036 
00037 class SMESH_Mesh;
00038 class SMESH_MesherHelper;
00039 class StdMeshers_FaceSide;
00040 class SMDS_MeshNode;
00041 struct uvPtStruct;
00042 
00043 
00044 enum TSideID { BOTTOM_SIDE=0, RIGHT_SIDE, TOP_SIDE, LEFT_SIDE, NB_SIDES };
00045 
00046 typedef uvPtStruct UVPtStruct;
00047 typedef struct faceQuadStruct
00048 {
00049   std::vector< StdMeshers_FaceSide*> side;
00050   bool isEdgeOut[4]; // true, if an edge has more nodes, than the opposite
00051   UVPtStruct* uv_grid;
00052   ~faceQuadStruct();
00053 } FaceQuadStruct;
00054 
00055 class STDMESHERS_EXPORT StdMeshers_Quadrangle_2D: public SMESH_2D_Algo
00056 {
00057 public:
00058   StdMeshers_Quadrangle_2D(int hypId, int studyId, SMESH_Gen* gen);
00059   virtual ~StdMeshers_Quadrangle_2D();
00060 
00061   virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
00062                                const TopoDS_Shape& aShape,
00063                                SMESH_Hypothesis::Hypothesis_Status& aStatus);
00064 
00065   virtual bool Compute(SMESH_Mesh& aMesh,
00066                  const TopoDS_Shape& aShape);
00067 
00068   virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
00069                         MapShapeNbElems& aResMap);
00070 
00071   FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh,
00072                         const TopoDS_Shape& aShape,
00073                                     const bool CreateQuadratic);
00074 
00075 protected:
00076 
00077   FaceQuadStruct* CheckNbEdges(SMESH_Mesh& aMesh,
00078                                const TopoDS_Shape& aShape);
00079 
00080   bool CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
00081                       const TopoDS_Shape & aShape,
00082                       MapShapeNbElems& aResMap,
00083                       std::vector<int>& aNbNodes,
00084                                bool& IsQuadratic);
00085 
00086   bool SetNormalizedGrid(SMESH_Mesh& aMesh,
00087                 const TopoDS_Shape& aShape,
00088                 FaceQuadStruct*& quad);
00089   
00090   void SplitQuad(SMESHDS_Mesh *theMeshDS,
00091                  const int theFaceID,
00092                  const SMDS_MeshNode* theNode1,
00093                  const SMDS_MeshNode* theNode2,
00094                  const SMDS_MeshNode* theNode3,
00095                  const SMDS_MeshNode* theNode4);
00096 
00100   bool ComputeQuadPref(SMESH_Mesh& aMesh,
00101                        const TopoDS_Shape& aShape,
00102                        FaceQuadStruct* quad);
00103 
00104   bool EvaluateQuadPref(SMESH_Mesh& aMesh,
00105                const TopoDS_Shape& aShape,
00106                std::vector<int>& aNbNodes,
00107                MapShapeNbElems& aResMap,
00108                         bool IsQuadratic);
00109 
00110   UVPtStruct* LoadEdgePoints2(SMESH_Mesh& aMesh,
00111                      const TopoDS_Face& F, const TopoDS_Edge& E,
00112                               bool IsReverse);
00113 
00114   UVPtStruct* LoadEdgePoints(SMESH_Mesh& aMesh,
00115                     const TopoDS_Face& F, const TopoDS_Edge& E,
00116                     double first, double last);
00117 
00118   UVPtStruct* MakeEdgePoints(SMESH_Mesh& aMesh,
00119                     const TopoDS_Face& F, const TopoDS_Edge& E,
00120                     double first, double last, int nb_segm);
00121 
00122   // true if QuadranglePreference hypothesis is assigned that forces
00123   // construction of quadrangles if the number of nodes on opposite edges
00124   // is not the same in the case where the global number of nodes on edges
00125   // is even
00126   bool myQuadranglePreference;
00127 
00128   bool myTrianglePreference;
00129 
00130   int myTriaVertexID;
00131 
00132   SMESH_MesherHelper* myTool; // tool for working with quadratic elements
00133 };
00134 
00135 #endif