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