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