]> SALOME platform Git repositories - plugins/gmshplugin.git/blob - src/GMSHPlugin/GMSHPlugin_Mesher.hxx
Salome HOME
Migrate on CMake and Qt 5
[plugins/gmshplugin.git] / src / GMSHPlugin / GMSHPlugin_Mesher.hxx
1 // Copyright (C) 2012-2015  ALNEOS
2 // Copyright (C) 2016  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.
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 //
20 #include <stdio.h>
21 #include "Gmsh.h"
22 #include "GmshConfig.h"
23 #include "GModelIO_OCC.h"
24 #include "Geo.h"
25 #include "GEdgeCompound.h"
26 #include "GFaceCompound.h"
27 #include "MElement.h"
28
29 #ifndef _GMSHPlugin_Mesher_HXX_
30 #define _GMSHPlugin_Mesher_HXX_
31
32 #include "GMSHPlugin_Defs.hxx"
33 #include "StdMeshers_FaceSide.hxx"
34 #include "SMDS_MeshElement.hxx"
35 #include "SMESH_Algo.hxx"
36
37 #include <map>
38 #include <vector>
39 #include <set>
40
41 class SMESH_Mesh;
42 class SMESH_Comment;
43 class SMESHDS_Mesh;
44 class TopoDS_Shape;
45 class TopTools_DataMapOfShapeShape;
46 class TopTools_IndexedMapOfShape;
47 class GMSHPlugin_Hypothesis;
48
49
50 //=============================================================================
51 /*!
52  * \brief This class calls the GMSH mesher of OCC geometry
53  */
54 //=============================================================================
55
56 class GMSHPLUGIN_EXPORT GMSHPlugin_Mesher 
57 {
58  public:
59   // ---------- PUBLIC METHODS ----------
60
61   GMSHPlugin_Mesher (SMESH_Mesh* mesh, const TopoDS_Shape& aShape);
62
63   void SetParameters(const GMSHPlugin_Hypothesis*          hyp);
64
65   bool Compute();
66
67   bool Evaluate(MapShapeNbElems& aResMap);
68   
69  private:
70   int                  _studyId;
71   SMESH_Mesh*          _mesh;
72   const TopoDS_Shape&  _shape;
73   int                  _algo2d;
74   int                  _algo3d;
75   int                  _recomb2DAlgo;
76   bool                 _recombineAll;
77   int                  _subdivAlgo;
78   int                  _remeshAlgo;
79   int                  _remeshPara;
80   double               _smouthSteps;
81   double               _sizeFactor;
82   double               _minSize, _maxSize;
83   bool                 _secondOrder, _useIncomplElem;
84   bool                 _is2d;
85   GModel*              _gModel;
86   
87   std::set<std::string> _compounds;
88   
89   void SetGmshOptions();
90   void CreateGmshCompounds();
91   void FillSMesh();
92   float DistBoundingBox(SBoundingBox3d& bounds,SPoint3& point);
93   
94   class mymsg : public GmshMessage
95   {
96     private:
97       GModel* _gModel;
98     public:
99       mymsg(GModel* _gModel) : _gModel(_gModel), GmshMessage() {}
100       void operator()(std::string level, std::string msg);
101   };
102 };
103
104 #endif