1 // Copyright (C) 2012-2015 ALNEOS
2 // Copyright (C) 2016 EDF R&D
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.
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.
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
18 // See http://www.alneos.com/ or email : contact@alneos.fr
20 #ifndef _GMSHPlugin_Hypothesis_i_HXX_
21 #define _GMSHPlugin_Hypothesis_i_HXX_
23 #include "GMSHPlugin_Defs.hxx"
25 #include <SALOMEconfig.h>
26 #include CORBA_SERVER_HEADER(GMSHPlugin_Algorithm)
28 #include "SMESH_Hypothesis_i.hxx"
29 #include "GMSHPlugin_Hypothesis.hxx"
34 // GMSHPlugin parameters hypothesis
36 class GMSHPLUGIN_EXPORT GMSHPlugin_Hypothesis_i:
37 public virtual POA_GMSHPlugin::GMSHPlugin_Hypothesis,
38 public virtual SMESH_Hypothesis_i
42 GMSHPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
44 ::SMESH_Gen* theGenImpl);
46 virtual ~GMSHPlugin_Hypothesis_i();
50 void SetMaxSize(CORBA::Double theSize);
51 CORBA::Double GetMaxSize();
53 void SetMinSize(CORBA::Double theSize);
54 CORBA::Double GetMinSize();
56 void SetSecondOrder(CORBA::Boolean theVal);
57 CORBA::Boolean GetSecondOrder();
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);
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();
89 void SetGrowthRate(CORBA::Double theRate);
90 CORBA::Double GetGrowthRate();
92 void SetNbSegPerEdge(CORBA::Double theVal);
93 CORBA::Double GetNbSegPerEdge();
95 void SetNbSegPerRadius(CORBA::Double theVal);
96 CORBA::Double GetNbSegPerRadius();
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();
103 void UnsetLocalSizeOnEntry(const char* entry);
105 // Get implementation
106 ::GMSHPlugin_Hypothesis* GetImpl();
108 // Verify whether hypothesis supports given entity type
109 CORBA::Boolean IsDimSupported( SMESH::Dimension type );
113 // to remember whether a parameter is already set (issue 0021364)
118 METH_SetSecondOrder = 4,
120 //METH_SetFineness = 16,
121 METH_SetGrowthRate = 32,
122 METH_SetNbSegPerEdge = 64,
123 METH_SetNbSegPerRadius = 128,
124 METH_SetLocalSizeOnEntry = 256,
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,
139 METH_LAST = METH_SetLocalSizeOnEntry
141 int mySetMethodFlags;
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.
149 bool isToSetParameter(T curValue, T newValue, /*SettingMethod*/int meth)
151 if ( mySetMethodFlags & meth ) // already set, check if a value is changing
152 return ( curValue != newValue );
154 return ( mySetMethodFlags |= meth ); // == return true
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;
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;