Back to index

salome-smesh  6.5.0
StdMeshers_Quadrangle_2D.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  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 //  File   : StdMeshers_Quadrangle_2D.hxx
00023 //           Moved here from SMESH_Quadrangle_2D.hxx
00024 //  Author : Paul RASCLE, EDF
00025 //  Module : SMESH
00026 //  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx,v 1.13.2.3.6.5.8.1 2012-04-13 09:31:21 vsr Exp $
00027 
00028 #ifndef _SMESH_QUADRANGLE_2D_HXX_
00029 #define _SMESH_QUADRANGLE_2D_HXX_
00030 
00031 #include "SMESH_StdMeshers.hxx"
00032 
00033 #include "StdMeshers_QuadrangleParams.hxx"
00034 
00035 #include "SMESH_2D_Algo.hxx"
00036 #include "Utils_SALOME_Exception.hxx"
00037 
00038 class SMESH_Mesh;
00039 class SMESH_MesherHelper;
00040 class StdMeshers_FaceSide;
00041 class SMDS_MeshNode;
00042 class TopoDS_Face;
00043 struct uvPtStruct;
00044 
00045 
00046 enum TSideID { BOTTOM_SIDE=0, RIGHT_SIDE, TOP_SIDE, LEFT_SIDE, NB_SIDES };
00047 
00048 typedef uvPtStruct UVPtStruct;
00049 typedef struct faceQuadStruct
00050 {
00051   std::vector< StdMeshers_FaceSide*> side;
00052   bool isEdgeOut[4]; // true, if an edge has more nodes, than the opposite
00053   UVPtStruct* uv_grid;
00054   TopoDS_Face face;
00055   ~faceQuadStruct();
00056 } FaceQuadStruct;
00057 
00058 class STDMESHERS_EXPORT StdMeshers_Quadrangle_2D: public SMESH_2D_Algo
00059 {
00060 public:
00061   StdMeshers_Quadrangle_2D(int hypId, int studyId, SMESH_Gen* gen);
00062   virtual ~StdMeshers_Quadrangle_2D();
00063 
00064   virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
00065                                const TopoDS_Shape& aShape,
00066                                SMESH_Hypothesis::Hypothesis_Status& aStatus);
00067 
00068   virtual bool Compute(SMESH_Mesh& aMesh,
00069                        const TopoDS_Shape& aShape);
00070 
00071   virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
00072                         MapShapeNbElems& aResMap);
00073 
00074   FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh,
00075                                     const TopoDS_Shape& aShape,
00076                                     const bool CreateQuadratic);
00077 
00078   FaceQuadStruct* CheckNbEdges(SMESH_Mesh& aMesh,
00079                                const TopoDS_Shape& aShape);
00080 
00081 protected:
00082 
00083   bool CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
00084                                const TopoDS_Shape & aShape,
00085                                MapShapeNbElems& aResMap,
00086                                std::vector<int>& aNbNodes,
00087                                bool& IsQuadratic);
00088 
00089   bool SetNormalizedGrid(SMESH_Mesh& aMesh,
00090                          const TopoDS_Shape& aShape,
00091                          FaceQuadStruct*& quad);
00092   
00093   void SplitQuad(SMESHDS_Mesh *theMeshDS,
00094                  const int theFaceID,
00095                  const SMDS_MeshNode* theNode1,
00096                  const SMDS_MeshNode* theNode2,
00097                  const SMDS_MeshNode* theNode3,
00098                  const SMDS_MeshNode* theNode4);
00099 
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   bool ComputeReduced (SMESH_Mesh& aMesh,
00111                        const TopoDS_Shape& aShape,
00112                        FaceQuadStruct* quad);
00113 
00114   void UpdateDegenUV(FaceQuadStruct* quad);
00115 
00116   void Smooth (FaceQuadStruct* quad);
00117 
00118 
00119   // true if QuadranglePreference hypothesis is assigned that forces
00120   // construction of quadrangles if the number of nodes on opposite edges
00121   // is not the same in the case where the global number of nodes on edges
00122   // is even
00123   bool myQuadranglePreference;
00124 
00125   bool myTrianglePreference;
00126 
00127   int myTriaVertexID;
00128 
00129   StdMeshers_QuadType myQuadType;
00130 
00131   SMESH_MesherHelper* myHelper; // tool for working with quadratic elements
00132 
00133   bool myNeedSmooth;
00134 };
00135 
00136 #endif