]> SALOME platform Git repositories - plugins/gmshplugin.git/blob - src/GMSHPlugin/GMSHPlugin_Hypothesis_i.hxx
Salome HOME
68fc75fffe2268f5d1c1dafe5c3f6dbf7576c6f5
[plugins/gmshplugin.git] / src / GMSHPlugin / GMSHPlugin_Hypothesis_i.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_i_HXX_
20 #define _GMSHPlugin_Hypothesis_i_HXX_
21
22 #include "GMSHPlugin_Defs.hxx"
23
24 #include <SALOMEconfig.h>
25 #include CORBA_SERVER_HEADER(GMSHPlugin_Algorithm)
26
27 #include "SMESH_Hypothesis_i.hxx"
28 #include "GMSHPlugin_Hypothesis.hxx"
29
30 class SMESH_Gen;
31 //class GEOM_Object;
32
33 // GMSHPlugin parameters hypothesis
34
35 class GMSHPLUGIN_EXPORT GMSHPlugin_Hypothesis_i:
36   public virtual POA_GMSHPlugin::GMSHPlugin_Hypothesis,
37   public virtual SMESH_Hypothesis_i
38 {
39  public:
40   // Constructor
41   GMSHPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
42                              int                     theStudyId,
43                              ::SMESH_Gen*            theGenImpl);
44   // Destructor
45   virtual ~GMSHPlugin_Hypothesis_i();
46   
47   // Ajout d'un truc
48   
49   void SetMaxSize(CORBA::Double theSize);
50   CORBA::Double GetMaxSize();
51   
52   void SetMinSize(CORBA::Double theSize);
53   CORBA::Double GetMinSize();
54   
55   void SetSecondOrder(CORBA::Boolean theVal);
56   CORBA::Boolean GetSecondOrder();
57   
58   void Set2DAlgo(CORBA::Long the2DAlgo);
59   CORBA::Long Get2DAlgo();
60   void Set3DAlgo(CORBA::Long the3DAlgo);
61   CORBA::Long Get3DAlgo();
62   void SetRecomb2DAlgo(CORBA::Long theRecomb2DAlgo);
63   CORBA::Long GetRecomb2DAlgo();
64   void SetRecombineAll(CORBA::Boolean theRecombineAll);
65   CORBA::Boolean GetRecombineAll();
66   void SetSubdivAlgo(CORBA::Long theSubdivAlgo);
67   CORBA::Long GetSubdivAlgo();
68   void SetRemeshAlgo(CORBA::Long theRemeshAlgo);
69   CORBA::Long GetRemeshAlgo();
70   void SetRemeshPara(CORBA::Long theRemeshPara);
71   CORBA::Long GetRemeshPara();
72   void SetSmouthSteps(CORBA::Double theSmouthSteps);
73   CORBA::Double GetSmouthSteps();
74   void SetSizeFactor(CORBA::Double theSizeFactor);
75   CORBA::Double GetSizeFactor();
76   void SetUseIncomplElem(CORBA::Boolean theUseIncomplElem);
77   CORBA::Boolean GetUseIncomplElem();
78   void SetIs2d(CORBA::Boolean theIs2d);
79   
80   void SetCompoundOnShape(GEOM::GEOM_Object_ptr GeomObj);
81   void SetCompoundOnEntry(const char* entry);
82   void UnsetCompoundOnShape(GEOM::GEOM_Object_ptr GeomObj);
83   void UnsetCompoundOnEntry(const char* entry);
84   GMSHPlugin::string_array* GetCompoundOnEntries();
85   
86   // fin d'ajout
87
88   void SetGrowthRate(CORBA::Double theRate);
89   CORBA::Double GetGrowthRate();
90
91   void SetNbSegPerEdge(CORBA::Double theVal);
92   CORBA::Double GetNbSegPerEdge();
93
94   void SetNbSegPerRadius(CORBA::Double theVal);
95   CORBA::Double GetNbSegPerRadius();
96
97   void SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double localSize);
98   void SetLocalSizeOnEntry(const char* entry, CORBA::Double localSize);
99   CORBA::Double GetLocalSizeOnEntry(const char* entry);
100   GMSHPlugin::string_array* GetLocalSizeEntries();
101   
102   void UnsetLocalSizeOnEntry(const char* entry);
103
104   // Get implementation
105   ::GMSHPlugin_Hypothesis* GetImpl();
106   
107   // Verify whether hypothesis supports given entity type 
108   CORBA::Boolean IsDimSupported( SMESH::Dimension type );
109
110  protected:
111
112   // to remember whether a parameter is already set (issue 0021364)
113   enum SettingMethod
114   {
115     METH_SetMaxSize          = 1,
116     METH_SetMinSize          = 2,
117     METH_SetSecondOrder      = 4,
118
119     //METH_SetFineness         = 16,
120     METH_SetGrowthRate       = 32,
121     METH_SetNbSegPerEdge     = 64,
122     METH_SetNbSegPerRadius   = 128,
123     METH_SetLocalSizeOnEntry = 256,
124     // ajout ici
125     METH_SetCompoundOnEntry    = 299,
126     METH_Set2DAlgo           = 300,
127     METH_Set3DAlgo           = 301,
128     METH_SetRecomb2DAlgo     = 302,
129     METH_SetRecombineAll     = 303,
130     METH_SetSubdivAlgo       = 304,
131     METH_SetRemeshAlgo       = 305,
132     METH_SetRemeshPara       = 306,
133     METH_SetSmouthSteps      = 307,
134     METH_SetSizeFactor       = 308,
135     METH_SetUseIncomplElem   = 309,
136     METH_SetIs2d             = 310,
137     // fin d'ajout
138     METH_LAST                = METH_SetLocalSizeOnEntry
139   };
140   int mySetMethodFlags;
141
142   // Return true if a parameter is not yet set, else return true if a parameter changes.
143   // PythonDumping depends on the result of this function.
144   // Checking only change of a parameter is not enough because then the default values are
145   // not dumped and if the defaults will change then the behaviour of scripts
146   // created without dump of the default parameters will also change what is not good.
147   template<typename T>
148     bool isToSetParameter(T curValue, T newValue, /*SettingMethod*/int meth)
149   {
150     if ( mySetMethodFlags & meth ) // already set, check if a value is changing
151       return ( curValue != newValue );
152     else
153       return ( mySetMethodFlags |= meth ); // == return true
154   }
155
156  public:
157   // method intended to remove explicit treatment of Netagen hypotheses from
158   // SMESH_NoteBook to assure backward compatibility after implemeneting
159   // issue 0021308: Remove hard-coded dependency of the external mesh plugins
160   virtual int getParamIndex(const TCollection_AsciiString& method, int nbVars) const;
161
162   // method used to convert variable parameters stored in an old study
163   // into myMethod2VarParams. It should return a method name for an index of
164   // variable parameters. Index is countered from zero
165   virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
166 };
167
168 #endif