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