]> SALOME platform Git repositories - plugins/gmshplugin.git/blob - src/GMSHPlugin/GMSHPlugin_Hypothesis_i.hxx
Salome HOME
ff78e181df8dc144ff7c8f64a36628a8456c83e5
[plugins/gmshplugin.git] / src / GMSHPlugin / GMSHPlugin_Hypothesis_i.hxx
1 // Copyright (C) 2012-2015  ALNEOS
2 // Copyright (C) 2016-2023  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   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   
83   void SetCompoundOnShape(GEOM::GEOM_Object_ptr GeomObj);
84   void SetCompoundOnEntry(const char* entry);
85   void UnsetCompoundOnShape(GEOM::GEOM_Object_ptr GeomObj);
86   void UnsetCompoundOnEntry(const char* entry);
87   GMSHPlugin::string_array* GetCompoundOnEntries();
88   
89   // fin d'ajout
90
91   void SetGrowthRate(CORBA::Double theRate);
92   CORBA::Double GetGrowthRate();
93
94   void SetNbSegPerEdge(CORBA::Double theVal);
95   CORBA::Double GetNbSegPerEdge();
96
97   void SetNbSegPerRadius(CORBA::Double theVal);
98   CORBA::Double GetNbSegPerRadius();
99
100   // void SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double localSize);
101   // void SetLocalSizeOnEntry(const char* entry, CORBA::Double localSize);
102   // CORBA::Double GetLocalSizeOnEntry(const char* entry);
103   // GMSHPlugin::string_array* GetLocalSizeEntries();
104   
105   void UnsetLocalSizeOnEntry(const char* entry);
106
107   // Get implementation
108   ::GMSHPlugin_Hypothesis* GetImpl();
109   
110   // Verify whether hypothesis supports given entity type 
111   CORBA::Boolean IsDimSupported( SMESH::Dimension type );
112
113  protected:
114
115   // to remember whether a parameter is already set (issue 0021364)
116   enum SettingMethod
117   {
118     METH_SetMeshCurvatureSize = 5,
119     METH_SetMaxSize          = 1,
120     METH_SetMinSize          = 2,
121     METH_SetSecondOrder      = 4,
122
123     //METH_SetFineness         = 16,
124     METH_SetGrowthRate       = 32,
125     METH_SetNbSegPerEdge     = 64,
126     METH_SetNbSegPerRadius   = 128,
127     METH_SetLocalSizeOnEntry = 256,
128     // ajout ici
129     METH_SetCompoundOnEntry    = 299,
130     METH_Set2DAlgo           = 300,
131     METH_Set3DAlgo           = 301,
132     METH_SetRecomb2DAlgo     = 302,
133     METH_SetRecombineAll     = 303,
134     METH_SetSubdivAlgo       = 304,
135     METH_SetRemeshAlgo       = 305,
136     METH_SetRemeshPara       = 306,
137     METH_SetSmouthSteps      = 307,
138     METH_SetSizeFactor       = 308,
139     METH_SetUseIncomplElem   = 309,
140     METH_SetIs2d             = 310,
141     // fin d'ajout
142     METH_LAST                = METH_SetLocalSizeOnEntry
143   };
144   int mySetMethodFlags;
145
146   // Return true if a parameter is not yet set, else return true if a parameter changes.
147   // PythonDumping depends on the result of this function.
148   // Checking only change of a parameter is not enough because then the default values are
149   // not dumped and if the defaults will change then the behaviour of scripts
150   // created without dump of the default parameters will also change what is not good.
151   template<typename T>
152     bool isToSetParameter(T curValue, T newValue, /*SettingMethod*/int meth)
153   {
154     if ( mySetMethodFlags & meth ) // already set, check if a value is changing
155       return ( curValue != newValue );
156     else
157       return ( mySetMethodFlags |= meth ); // == return true
158   }
159
160  public:
161   // method intended to remove explicit treatment of Netagen hypotheses from
162   // SMESH_NoteBook to assure backward compatibility after implemeneting
163   // issue 0021308: Remove hard-coded dependency of the external mesh plugins
164   virtual int getParamIndex(const TCollection_AsciiString& method, int nbVars) const;
165
166   // method used to convert variable parameters stored in an old study
167   // into myMethod2VarParams. It should return a method name for an index of
168   // variable parameters. Index is countered from zero
169   virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
170
171
172   // Methods for copying mesh definition to other geometry
173
174   // Return geometry this hypothesis depends on. Return false if there is no geometry parameter
175   virtual bool getObjectsDependOn( std::vector< std::string > & entryArray,
176                                    std::vector< int >         & subIDArray ) const;
177
178   // Set new geometry instead of that returned by getObjectsDependOn()
179   virtual bool setObjectsDependOn( std::vector< std::string > & entryArray,
180                                    std::vector< int >         & subIDArray );
181 };
182
183 #endif