]> SALOME platform Git repositories - plugins/gmshplugin.git/blob - src/GMSHPlugin/GMSHPlugin_Mesher.hxx
Salome HOME
Copyright update 2021
[plugins/gmshplugin.git] / src / GMSHPlugin / GMSHPlugin_Mesher.hxx
1 // Copyright (C) 2012-2015  ALNEOS
2 // Copyright (C) 2016-2021  EDF R&D
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 //
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.alneos.com/ or email : contact@alneos.fr
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21
22 #ifndef _GMSHPlugin_Mesher_HXX_
23 #define _GMSHPlugin_Mesher_HXX_
24
25 #include <stdio.h>
26 #include "GmshVersion.h"
27 #if GMSH_MAJOR_VERSION >=4 
28 #include "gmsh.h"
29 #else 
30 #include "Gmsh.h"
31 #endif
32 #include "GmshConfig.h"
33 #include "GModelIO_OCC.h"
34 #include "GModelIO_GEO.h"
35 #include "Geo.h"
36 #if GMSH_MAJOR_VERSION >=4
37 #include "GEdge.h" 
38 #include "GFace.h"
39 #else
40 #include "GEdgeCompound.h"
41 #include "GFaceCompound.h"
42 #endif
43 #include "MElement.h"
44
45 #include "GMSHPlugin_Defs.hxx"
46 #include "StdMeshers_FaceSide.hxx"
47 #include "SMDS_MeshElement.hxx"
48 #include "SMESH_Algo.hxx"
49
50 #include <map>
51 #include <vector>
52 #include <set>
53
54 class SMESH_Mesh;
55 class SMESH_Comment;
56 class SMESHDS_Mesh;
57 class TopoDS_Shape;
58 //class TopTools_DataMapOfShapeShape;
59 //class TopTools_IndexedMapOfShape;
60 class GMSHPlugin_Hypothesis;
61
62
63 //=============================================================================
64 /*!
65  * \brief This class calls the GMSH mesher of OCC geometry
66  */
67 //=============================================================================
68
69 class GMSHPLUGIN_EXPORT GMSHPlugin_Mesher 
70 {
71  public:
72   // ---------- PUBLIC METHODS ----------
73
74   GMSHPlugin_Mesher (SMESH_Mesh* mesh, const TopoDS_Shape& aShape);
75
76   void SetParameters(const GMSHPlugin_Hypothesis*          hyp);
77
78   bool Compute();
79
80   bool Evaluate(MapShapeNbElems& aResMap);
81   
82   static float DistBoundingBox(const SBoundingBox3d& bounds, const SPoint3& point);
83
84  private:
85   SMESH_Mesh*          _mesh;
86   const TopoDS_Shape&  _shape;
87   int                  _algo2d;
88   int                  _algo3d;
89   int                  _recomb2DAlgo;
90   bool                 _recombineAll;
91   int                  _subdivAlgo;
92   int                  _remeshAlgo;
93   int                  _remeshPara;
94   double               _smouthSteps;
95   double               _sizeFactor;
96   double               _minSize, _maxSize;
97   bool                 _secondOrder, _useIncomplElem;
98   bool                 _is2d;
99   GModel*              _gModel;
100   
101   std::set<std::string> _compounds;
102   
103   void SetGmshOptions();
104   void CreateGmshCompounds();
105   void FillSMesh();
106
107   class mymsg : public GmshMessage
108   {
109   private:
110     GModel* _gModel;
111   public:
112     mymsg(GModel* _gModel) :  GmshMessage(), _gModel(_gModel) {}
113     void operator()(std::string level, std::string msg);
114   };
115 };
116
117 #endif