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