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