Salome HOME
mise a jour pour la poursuite d'iterations
[modules/homard.git] / src / HOMARD_I / HOMARD_Hypothesis_i.cxx
1 // Copyright (C) 2011-2013  CEA/DEN, EDF R&D
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Remarques :
20 // L'ordre de description des fonctions est le meme dans tous les fichiers
21 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
22 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
23 // 2. Les caracteristiques
24 // 3. Le lien avec les autres structures
25 //
26 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
27 //
28
29 #include "HOMARD_Hypothesis_i.hxx"
30 #include "HOMARD_Gen_i.hxx"
31 #include "HOMARD_Hypothesis.hxx"
32 #include "HOMARD_DriverTools.hxx"
33
34 #include "utilities.h"
35
36 //=============================================================================
37 /*!
38  *  standard constructor
39  */
40 //=============================================================================
41 HOMARD_Hypothesis_i::HOMARD_Hypothesis_i()
42 {
43   MESSAGE( "Default constructor, not for use" );
44   ASSERT( 0 );
45 }
46
47 //=============================================================================
48 /*!
49  *  standard constructor
50  */
51 //=============================================================================
52 HOMARD_Hypothesis_i::HOMARD_Hypothesis_i( CORBA::ORB_ptr orb,
53                                           HOMARD::HOMARD_Gen_var engine )
54 {
55   MESSAGE( "standard constructor" );
56   _gen_i = engine;
57   _orb = orb;
58   myHomardHypothesis = new ::HOMARD_Hypothesis();
59   ASSERT( myHomardHypothesis );
60 }
61
62 //=============================================================================
63 /*!
64  *  standard destructor
65  */
66 //=============================================================================
67 HOMARD_Hypothesis_i::~HOMARD_Hypothesis_i()
68 {
69 }
70 //=============================================================================
71 //=============================================================================
72 // Generalites
73 //=============================================================================
74 //=============================================================================
75 void HOMARD_Hypothesis_i::SetName( const char* Name )
76 {
77   ASSERT( myHomardHypothesis );
78   myHomardHypothesis->SetName( Name );
79 }
80 //=============================================================================
81 char* HOMARD_Hypothesis_i::GetName()
82 {
83   ASSERT( myHomardHypothesis );
84   return CORBA::string_dup( myHomardHypothesis->GetName().c_str() );
85 }
86 //=============================================================================
87 CORBA::Long  HOMARD_Hypothesis_i::Delete()
88 {
89   ASSERT( myHomardHypothesis );
90   char* HypoName = GetName() ;
91   MESSAGE ( "Delete : destruction de l'hypothese " << HypoName );
92   return _gen_i->DeleteHypo(HypoName) ;
93 }
94 //=============================================================================
95 char* HOMARD_Hypothesis_i::GetDumpPython()
96 {
97   ASSERT( myHomardHypothesis );
98   return CORBA::string_dup( myHomardHypothesis->GetDumpPython().c_str() );
99 }
100 //=============================================================================
101 std::string HOMARD_Hypothesis_i::Dump() const
102 {
103   return HOMARD::Dump( *myHomardHypothesis );
104 }
105 //=============================================================================
106 bool HOMARD_Hypothesis_i::Restore( const std::string& stream )
107 {
108   return HOMARD::Restore( *myHomardHypothesis, stream );
109 }
110 //=============================================================================
111 //=============================================================================
112 // Caracteristiques
113 //=============================================================================
114 //=============================================================================
115 void HOMARD_Hypothesis_i::SetAdapRefinUnRef( CORBA::Long TypeAdap,CORBA::Long TypeRaff, CORBA::Long TypeDera )
116 {
117   ASSERT( myHomardHypothesis );
118   myHomardHypothesis->SetAdapType( TypeAdap );
119   myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
120 }
121 //=============================================================================
122 HOMARD::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef()
123 {
124   ASSERT( myHomardHypothesis );
125   HOMARD::listeTypes_var aResult = new HOMARD::listeTypes;
126   aResult->length( 3 );
127   aResult[0] = CORBA::Long( myHomardHypothesis->GetAdapType() );
128   aResult[1] = CORBA::Long( myHomardHypothesis->GetRefinType() );
129   aResult[2] = CORBA::Long( myHomardHypothesis->GetUnRefType() );
130   return aResult._retn();
131 }
132 //=============================================================================
133 CORBA::Long HOMARD_Hypothesis_i::GetAdapType()
134 {
135   ASSERT( myHomardHypothesis );
136   return CORBA::Long( myHomardHypothesis->GetAdapType() );
137 }
138 //=============================================================================
139 CORBA::Long HOMARD_Hypothesis_i::GetRefinType()
140 {
141   ASSERT( myHomardHypothesis );
142   return CORBA::Long( myHomardHypothesis->GetRefinType() );
143 }
144 //=============================================================================
145 CORBA::Long HOMARD_Hypothesis_i::GetUnRefType()
146 {
147   ASSERT( myHomardHypothesis );
148   return CORBA::Long( myHomardHypothesis->GetUnRefType() );
149 }
150 //=============================================================================
151 void HOMARD_Hypothesis_i::SetField( const char* FieldName )
152 {
153   myHomardHypothesis->SetField( FieldName );
154 }
155 //=============================================================================
156 char* HOMARD_Hypothesis_i::GetFieldName()
157 {
158   ASSERT( myHomardHypothesis );
159   return CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
160 }
161 //=============================================================================
162 void HOMARD_Hypothesis_i::SetUseField( CORBA::Long UsField )
163 {
164   myHomardHypothesis->SetUseField( UsField );
165 }
166 //=============================================================================
167 HOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField()
168 {
169   ASSERT(myHomardHypothesis);
170   HOMARD::InfosHypo* aInfosHypo = new HOMARD::InfosHypo();
171   aInfosHypo->FieldName  = CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
172   aInfosHypo->TypeThR    = CORBA::Long( myHomardHypothesis->GetRefinThrType() );
173   aInfosHypo->ThreshR    = CORBA::Double( myHomardHypothesis->GetThreshR() );
174   aInfosHypo->TypeThC    = CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
175   aInfosHypo->ThreshC    = CORBA::Double( myHomardHypothesis->GetThreshC() );
176   aInfosHypo->UsField    = CORBA::Long( myHomardHypothesis->GetUseField() );
177   aInfosHypo->UsCmpI     = CORBA::Long( myHomardHypothesis->GetUseComp() );
178   return aInfosHypo;
179 }
180 //=============================================================================
181 void HOMARD_Hypothesis_i::SetUseComp( CORBA::Long UsCmpI )
182 {
183   myHomardHypothesis->SetUseComp( UsCmpI );
184 }
185 //=============================================================================
186 void HOMARD_Hypothesis_i::AddComp( const char* NomComposant )
187 {
188   ASSERT( myHomardHypothesis );
189   myHomardHypothesis->AddComp( NomComposant );
190 }
191 //=============================================================================
192 void HOMARD_Hypothesis_i::SupprComp()
193 {
194   ASSERT( myHomardHypothesis );
195   myHomardHypothesis->SupprComp();
196 }
197 //=============================================================================
198 HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetListComp()
199 {
200   ASSERT( myHomardHypothesis );
201   const std::list<std::string>& ListString = myHomardHypothesis->GetListComp();
202   HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo;
203   aResult->length( ListString.size() );
204   std::list<std::string>::const_iterator it;
205   int i = 0;
206   for ( it = ListString.begin(); it != ListString.end(); it++ )
207   {
208     aResult[i++] = CORBA::string_dup( (*it).c_str() );
209   }
210   return aResult._retn();
211 }
212 //=============================================================================
213 void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR )
214 {
215   myHomardHypothesis->SetRefinThr( TypeThR, ThreshR );
216 }
217 //=============================================================================
218 CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType()
219 {
220   ASSERT( myHomardHypothesis );
221   return CORBA::Long( myHomardHypothesis->GetRefinThrType() );
222 }
223 //=============================================================================
224 void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC )
225 {
226   myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC );
227 }
228 //=============================================================================
229 CORBA::Long HOMARD_Hypothesis_i::GetUnRefThrType()
230 {
231   ASSERT( myHomardHypothesis );
232   return CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
233 }
234 //=============================================================================
235 void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax )
236 {
237   ASSERT( myHomardHypothesis );
238   myHomardHypothesis->SetNivMax( NivMax );
239 }
240 //=============================================================================
241 CORBA::Long HOMARD_Hypothesis_i::GetNivMax()
242 {
243   ASSERT( myHomardHypothesis );
244   return myHomardHypothesis->GetNivMax();
245 }
246 //=============================================================================
247 void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin )
248 {
249   ASSERT( myHomardHypothesis );
250   myHomardHypothesis->SetDiamMin( DiamMin );
251 }
252 //=============================================================================
253 CORBA::Double HOMARD_Hypothesis_i::GetDiamMin()
254 {
255   ASSERT( myHomardHypothesis );
256   return myHomardHypothesis->GetDiamMin();
257 }
258 //=============================================================================
259 void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit )
260 {
261   ASSERT( myHomardHypothesis );
262   myHomardHypothesis->SetAdapInit( AdapInit );
263 }
264 //=============================================================================
265 CORBA::Long HOMARD_Hypothesis_i::GetAdapInit()
266 {
267   ASSERT( myHomardHypothesis );
268   return myHomardHypothesis->GetAdapInit();
269 }
270 //=============================================================================
271 void HOMARD_Hypothesis_i::SetLevelOutput( CORBA::Long LevelOutput )
272 {
273   ASSERT( myHomardHypothesis );
274   myHomardHypothesis->SetLevelOutput( LevelOutput );
275 }
276 //=============================================================================
277 CORBA::Long HOMARD_Hypothesis_i::GetLevelOutput()
278 {
279   ASSERT( myHomardHypothesis );
280   return myHomardHypothesis->GetLevelOutput();
281 }
282 //=============================================================================
283 void HOMARD_Hypothesis_i::AddGroup( const char* Group)
284 {
285   ASSERT( myHomardHypothesis );
286   myHomardHypothesis->AddGroup( Group );
287 }
288 //=============================================================================
289 void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
290 {
291   ASSERT( myHomardHypothesis );
292   std::list<std::string> ListString;
293   for ( int i = 0; i < ListGroup.length(); i++ )
294   {
295     ListString.push_back(std::string(ListGroup[i]));
296   }
297   myHomardHypothesis->SetGroups( ListString );
298 }
299 //=============================================================================
300 HOMARD::ListGroupType*  HOMARD_Hypothesis_i::GetGroups()
301 {
302   ASSERT( myHomardHypothesis );
303   const std::list<std::string>& ListString = myHomardHypothesis->GetGroups();
304   HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
305   aResult->length( ListString.size() );
306   std::list<std::string>::const_iterator it;
307   int i = 0;
308   for ( it = ListString.begin(); it != ListString.end(); it++ )
309   {
310     aResult[i++] = CORBA::string_dup( (*it).c_str() );
311   }
312   return aResult._retn();
313 }
314 //=============================================================================
315 void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp )
316 {
317   ASSERT( myHomardHypothesis );
318   myHomardHypothesis->SetTypeFieldInterp( TypeFieldInterp );
319 }
320 //=============================================================================
321 CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp()
322 {
323   ASSERT( myHomardHypothesis );
324   return CORBA::Long( myHomardHypothesis->GetTypeFieldInterp() );
325 }
326 //=============================================================================
327 void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp )
328 {
329   ASSERT( myHomardHypothesis );
330   myHomardHypothesis->AddFieldInterp( FieldInterp );
331 }
332 //=============================================================================
333 void HOMARD_Hypothesis_i::SupprFieldInterp()
334 {
335   ASSERT( myHomardHypothesis );
336   myHomardHypothesis->SupprFieldInterp();
337 }
338 //=============================================================================
339 HOMARD::listFieldInterpHypo* HOMARD_Hypothesis_i::GetListFieldInterp()
340 {
341   ASSERT( myHomardHypothesis );
342   const std::list<std::string>& ListString = myHomardHypothesis->GetListFieldInterp();
343   HOMARD::listFieldInterpHypo_var aResult = new HOMARD::listFieldInterpHypo;
344   aResult->length( ListString.size() );
345   std::list<std::string>::const_iterator it;
346   int i = 0;
347   for ( it = ListString.begin(); it != ListString.end(); it++ )
348   {
349     aResult[i++] = CORBA::string_dup( (*it).c_str() );
350   }
351   return aResult._retn();
352 }
353 //=============================================================================
354 //=============================================================================
355 // Liens avec les autres structures
356 //=============================================================================
357 //=============================================================================
358 void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation )
359 {
360   ASSERT( myHomardHypothesis );
361   myHomardHypothesis->SetCaseCreation( NomCaseCreation );
362 }
363 //=============================================================================
364 char* HOMARD_Hypothesis_i::GetCaseCreation()
365 {
366   ASSERT( myHomardHypothesis );
367   return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() );
368 }
369 //=============================================================================
370 void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration )
371 {
372   ASSERT(myHomardHypothesis);
373   myHomardHypothesis->LinkIteration( NomIteration );
374 }
375 //=============================================================================
376 void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration )
377 {
378   ASSERT(myHomardHypothesis);
379   myHomardHypothesis->UnLinkIteration( NomIteration );
380 }
381 //=============================================================================
382 HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations()
383 {
384   ASSERT(myHomardHypothesis);
385   const std::list<std::string>& ListString = myHomardHypothesis->GetIterations();
386   HOMARD::listeIters_var aResult = new HOMARD::listeIters;
387   aResult->length( ListString.size() );
388   std::list<std::string>::const_iterator it;
389   int i = 0;
390   for ( it = ListString.begin(); it != ListString.end(); it++ )
391   {
392     aResult[i++] = CORBA::string_dup( (*it).c_str() );
393   }
394   return aResult._retn();
395 }
396 //=============================================================================
397 void  HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse )
398 {
399   MESSAGE ("Dans AddZone pour " << NomZone) ;
400   ASSERT( myHomardHypothesis );
401   char* NomHypo = GetName() ;
402   return _gen_i->AssociateHypoZone(NomHypo, NomZone, TypeUse) ;
403 }
404 //=============================================================================
405 void  HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse )
406 {
407   MESSAGE ("Dans AddZone0 pour " << NomZone) ;
408   ASSERT( myHomardHypothesis );
409   myHomardHypothesis->AddZone( NomZone, TypeUse );
410 }
411 //=============================================================================
412 void  HOMARD_Hypothesis_i::SupprZone(const char * NomZone)
413 {
414   ASSERT(myHomardHypothesis);
415   myHomardHypothesis->SupprZone( NomZone);
416 }
417 //=============================================================================
418 HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones()
419 {
420   ASSERT(myHomardHypothesis);
421   const std::list<std::string>& ListString = myHomardHypothesis->GetZones();
422   HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo;
423   aResult->length( ListString.size() );
424   std::list<std::string>::const_iterator it;
425   int i = 0;
426   for ( it = ListString.begin(); it != ListString.end(); it++ )
427   {
428     aResult[i++] = CORBA::string_dup( (*it).c_str() );
429   }
430   return aResult._retn();
431 }