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