Salome HOME
updated copyright message
[plugins/gmshplugin.git] / src / GMSHPlugin / GMSHPlugin_Hypothesis.hxx
1 // Copyright (C) 2012-2015  ALNEOS
2 // Copyright (C) 2016-2023  EDF
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 #ifndef _GMSHPlugin_Hypothesis_HXX_
22 #define _GMSHPlugin_Hypothesis_HXX_
23
24 #include "GmshVersion.h"
25 #include "GMSHPlugin_Defs.hxx"
26
27 #include "SMESH_Hypothesis.hxx"
28 #include "Utils_SALOME_Exception.hxx"
29
30 #include <set>
31
32 //  Parameters for work of GMSH
33 //
34
35 class GMSHPLUGIN_EXPORT GMSHPlugin_Hypothesis: public SMESH_Hypothesis
36 {
37 public:
38
39   GMSHPlugin_Hypothesis(int hypId, SMESH_Gen * gen);
40
41   enum Algo2D
42   {
43    automatic,
44    meshadapt,
45    delaunay,
46    frontal,
47    delaunayforquad,
48 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
49    packingparallelograms,
50    quadqs
51 #else
52    packingparallelograms
53 #endif
54   };
55
56   void Set2DAlgo(Algo2D the2DAlgo);
57   Algo2D Get2DAlgo() const { return _algo2d; }
58
59   enum Algo3D
60   {
61    delaunay3,
62    frontal3,
63    mmg3d,
64    rtree,
65    hxt
66   };
67
68
69   void Set3DAlgo(Algo3D the3DAlgo);
70   Algo3D Get3DAlgo() const { return _algo3d; }
71
72 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=8
73   enum Recomb2DAlgo
74   {
75    simple,
76    blossom,
77    simplefullquads,
78    blossomfullquads
79   };
80 #else
81   enum Recomb2DAlgo
82   {
83    standard,
84    blossom
85   };
86 #endif
87
88   void SetRecomb2DAlgo(Recomb2DAlgo theRecomb2DAlgo);
89   Recomb2DAlgo GetRecomb2DAlgo() const { return _recomb2DAlgo; }
90   
91   void SetRecombineAll(bool theRecombineAll);
92   bool GetRecombineAll() const { return _recombineAll; }
93
94   enum SubdivAlgo
95   {
96    none,
97    allquads,
98    allhexas
99   };
100   
101   void SetSubdivAlgo(SubdivAlgo theSubdivAlgo);
102   SubdivAlgo GetSubdivAlgo() const { return _subdivAlgo; }
103
104   enum RemeshAlgo
105   {
106    nosplit,
107    automaticR,
108    automaticmetis
109   };
110   
111   void SetRemeshAlgo(RemeshAlgo theRemeshAlgo);
112   RemeshAlgo GetRemeshAlgo() const { return _remeshAlgo; }
113
114   enum RemeshPara
115   {
116    harmonic,
117    conformal,
118    rbfharmonic
119   };
120   
121   void SetRemeshPara(RemeshPara theRemeshPara);
122   RemeshPara GetRemeshPara() const { return _remeshPara; }
123   
124   void SetSmouthSteps(double theSmouthSteps);
125   double GetSmouthSteps() const { return _smouthSteps; }
126   
127   void SetSizeFactor(double theSizeFactor);
128   double GetSizeFactor() const { return _sizeFactor; }
129   
130   void SetUseIncomplElem(bool theUseIncomplElem);
131   bool GetUseIncomplElem() const { return _useIncomplElem; }
132
133 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
134   void SetMeshCurvatureSize(double theMeshCurvatureSize);
135   double GetMeshCurvatureSize() const { return _meshCurvatureSize; }
136 #endif
137   
138   void SetMaxSize(double theSize);
139   double GetMaxSize() const { return _maxSize; }
140   
141   void SetMinSize(double theSize);
142   double GetMinSize() const { return _minSize; }
143
144   void SetSecondOrder(bool theVal);
145   bool GetSecondOrder() const { return _secondOrder; }
146
147   void SetIs2d(bool theIs2d);
148   bool GetIs2d() const { return _is2d; }
149   
150   typedef std::set<std::string> TCompound;
151   void SetCompoundOnEntry(const std::string& entry);
152   const TCompound& GetCompoundOnEntries() const { return _compounds; }
153   void UnsetCompoundOnEntry(const std::string& entry);
154   
155   // Persistence
156   virtual std::ostream & SaveTo(std::ostream & save);
157   virtual std::istream & LoadFrom(std::istream & load);
158
159   /*!
160    * \brief Does nothing
161    * \param theMesh - the built mesh
162    * \param theShape - the geometry of interest
163    * \retval bool - always false
164    */
165   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
166
167   /*!
168    * \brief Initialize my parameter values by default parameters.
169    *  \retval bool - true if parameter values have been successfully defined
170    */
171   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
172
173 private:
174   Algo2D        _algo2d;
175   Algo3D        _algo3d;
176   Recomb2DAlgo  _recomb2DAlgo;
177   bool          _recombineAll;
178   SubdivAlgo    _subdivAlgo;
179   RemeshAlgo    _remeshAlgo;
180   RemeshPara    _remeshPara;
181   double        _smouthSteps;
182   double        _sizeFactor;
183 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
184   double        _meshCurvatureSize;
185 #endif
186   double        _minSize, _maxSize;
187   bool          _secondOrder, _useIncomplElem;
188   bool          _is2d;
189   TCompound     _compounds;
190 };
191
192 #endif