]> SALOME platform Git repositories - modules/homard.git/blob - src/HOMARD_I/HOMARD_Hypothesis_i.cxx
Salome HOME
e9d2f3d2479408c8e269fda6f8f6fa91b97abd3b
[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* NomComp )
187 {
188   ASSERT( myHomardHypothesis );
189   myHomardHypothesis->AddComp( NomComp );
190 }
191 //=============================================================================
192 void HOMARD_Hypothesis_i::SupprComp( const char* NomComp )
193 {
194   ASSERT( myHomardHypothesis );
195   myHomardHypothesis->SupprComp(NomComp);
196 }
197 //=============================================================================
198 void HOMARD_Hypothesis_i::SupprComps()
199 {
200   ASSERT( myHomardHypothesis );
201   myHomardHypothesis->SupprComps();
202 }
203 //=============================================================================
204 HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps()
205 {
206   ASSERT( myHomardHypothesis );
207   const std::list<std::string>& ListString = myHomardHypothesis->GetComps();
208   HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo;
209   aResult->length( ListString.size() );
210   std::list<std::string>::const_iterator it;
211   int i = 0;
212   for ( it = ListString.begin(); it != ListString.end(); it++ )
213   {
214     aResult[i++] = CORBA::string_dup( (*it).c_str() );
215   }
216   return aResult._retn();
217 }
218 //=============================================================================
219 void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR )
220 {
221   myHomardHypothesis->SetRefinThr( TypeThR, ThreshR );
222 }
223 //=============================================================================
224 CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType()
225 {
226   ASSERT( myHomardHypothesis );
227   return CORBA::Long( myHomardHypothesis->GetRefinThrType() );
228 }
229 //=============================================================================
230 void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC )
231 {
232   myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC );
233 }
234 //=============================================================================
235 CORBA::Long HOMARD_Hypothesis_i::GetUnRefThrType()
236 {
237   ASSERT( myHomardHypothesis );
238   return CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
239 }
240 //=============================================================================
241 void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax )
242 {
243   ASSERT( myHomardHypothesis );
244   myHomardHypothesis->SetNivMax( NivMax );
245 }
246 //=============================================================================
247 CORBA::Long HOMARD_Hypothesis_i::GetNivMax()
248 {
249   ASSERT( myHomardHypothesis );
250   return myHomardHypothesis->GetNivMax();
251 }
252 //=============================================================================
253 void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin )
254 {
255   ASSERT( myHomardHypothesis );
256   myHomardHypothesis->SetDiamMin( DiamMin );
257 }
258 //=============================================================================
259 CORBA::Double HOMARD_Hypothesis_i::GetDiamMin()
260 {
261   ASSERT( myHomardHypothesis );
262   return myHomardHypothesis->GetDiamMin();
263 }
264 //=============================================================================
265 void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit )
266 {
267   ASSERT( myHomardHypothesis );
268   myHomardHypothesis->SetAdapInit( AdapInit );
269 }
270 //=============================================================================
271 CORBA::Long HOMARD_Hypothesis_i::GetAdapInit()
272 {
273   ASSERT( myHomardHypothesis );
274   return myHomardHypothesis->GetAdapInit();
275 }
276 //=============================================================================
277 void HOMARD_Hypothesis_i::SetLevelOutput( CORBA::Long LevelOutput )
278 {
279   ASSERT( myHomardHypothesis );
280   myHomardHypothesis->SetLevelOutput( LevelOutput );
281 }
282 //=============================================================================
283 CORBA::Long HOMARD_Hypothesis_i::GetLevelOutput()
284 {
285   ASSERT( myHomardHypothesis );
286   return myHomardHypothesis->GetLevelOutput();
287 }
288 //=============================================================================
289 void HOMARD_Hypothesis_i::AddGroup( const char* Group)
290 {
291   ASSERT( myHomardHypothesis );
292   myHomardHypothesis->AddGroup( Group );
293 }
294 //=============================================================================
295 void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
296 {
297   ASSERT( myHomardHypothesis );
298   std::list<std::string> ListString;
299   for ( int i = 0; i < ListGroup.length(); i++ )
300   {
301     ListString.push_back(std::string(ListGroup[i]));
302   }
303   myHomardHypothesis->SetGroups( ListString );
304 }
305 //=============================================================================
306 HOMARD::ListGroupType*  HOMARD_Hypothesis_i::GetGroups()
307 {
308   ASSERT( myHomardHypothesis );
309   const std::list<std::string>& ListString = myHomardHypothesis->GetGroups();
310   HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
311   aResult->length( ListString.size() );
312   std::list<std::string>::const_iterator it;
313   int i = 0;
314   for ( it = ListString.begin(); it != ListString.end(); it++ )
315   {
316     aResult[i++] = CORBA::string_dup( (*it).c_str() );
317   }
318   return aResult._retn();
319 }
320 //=============================================================================
321 void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp )
322 {
323   ASSERT( myHomardHypothesis );
324   myHomardHypothesis->SetTypeFieldInterp( TypeFieldInterp );
325 }
326 //=============================================================================
327 CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp()
328 {
329   ASSERT( myHomardHypothesis );
330   return CORBA::Long( myHomardHypothesis->GetTypeFieldInterp() );
331 }
332 //=============================================================================
333 void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp )
334 {
335   ASSERT( myHomardHypothesis );
336   myHomardHypothesis->AddFieldInterpType( FieldInterp, 0 );
337 }
338 //=============================================================================
339 void HOMARD_Hypothesis_i::AddFieldInterpType( const char* FieldInterp, CORBA::Long TypeInterp )
340 {
341   ASSERT( myHomardHypothesis );
342   myHomardHypothesis->AddFieldInterpType( FieldInterp, TypeInterp );
343 }
344 //=============================================================================
345 void HOMARD_Hypothesis_i::SupprFieldInterp( const char* FieldInterp )
346 {
347   ASSERT( myHomardHypothesis );
348   myHomardHypothesis->SupprFieldInterp(FieldInterp);
349 }
350 //=============================================================================
351 void HOMARD_Hypothesis_i::SupprFieldInterps()
352 {
353   ASSERT( myHomardHypothesis );
354   myHomardHypothesis->SupprFieldInterps();
355 }
356 //=============================================================================
357 HOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps()
358 {
359   ASSERT( myHomardHypothesis );
360   const std::list<std::string>& ListString = myHomardHypothesis->GetFieldInterps();
361   HOMARD::listeFieldInterpsHypo_var aResult = new HOMARD::listeFieldInterpsHypo;
362   aResult->length( ListString.size() );
363   std::list<std::string>::const_iterator it;
364   int i = 0;
365   for ( it = ListString.begin(); it != ListString.end(); it++ )
366   {
367     aResult[i++] = CORBA::string_dup( (*it).c_str() );
368   }
369   return aResult._retn();
370 }
371 //=============================================================================
372 //=============================================================================
373 // Liens avec les autres structures
374 //=============================================================================
375 //=============================================================================
376 void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation )
377 {
378   ASSERT( myHomardHypothesis );
379   myHomardHypothesis->SetCaseCreation( NomCaseCreation );
380 }
381 //=============================================================================
382 char* HOMARD_Hypothesis_i::GetCaseCreation()
383 {
384   ASSERT( myHomardHypothesis );
385   return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() );
386 }
387 //=============================================================================
388 void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration )
389 {
390   ASSERT( myHomardHypothesis );
391   myHomardHypothesis->LinkIteration( NomIteration );
392 }
393 //=============================================================================
394 void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration )
395 {
396   ASSERT( myHomardHypothesis );
397   myHomardHypothesis->UnLinkIteration( NomIteration );
398 }
399 //=============================================================================
400 HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations()
401 {
402   ASSERT( myHomardHypothesis );
403   const std::list<std::string>& ListString = myHomardHypothesis->GetIterations();
404   HOMARD::listeIters_var aResult = new HOMARD::listeIters;
405   aResult->length( ListString.size() );
406   std::list<std::string>::const_iterator it;
407   int i = 0;
408   for ( it = ListString.begin(); it != ListString.end(); it++ )
409   {
410     aResult[i++] = CORBA::string_dup( (*it).c_str() );
411   }
412   return aResult._retn();
413 }
414 //=============================================================================
415 void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse )
416 {
417   MESSAGE ("Dans AddZone pour " << NomZone) ;
418   ASSERT( myHomardHypothesis );
419   char* NomHypo = GetName() ;
420   return _gen_i->AssociateHypoZone(NomHypo, NomZone, TypeUse) ;
421 }
422 //=============================================================================
423 void HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse )
424 {
425   MESSAGE ("Dans AddZone0 pour " << NomZone) ;
426   ASSERT( myHomardHypothesis );
427   myHomardHypothesis->AddZone( NomZone, TypeUse );
428 }
429 //=============================================================================
430 void HOMARD_Hypothesis_i::SupprZone(const char * NomZone)
431 {
432   ASSERT( myHomardHypothesis );
433   myHomardHypothesis->SupprZone( NomZone);
434 }
435 //=============================================================================
436 void HOMARD_Hypothesis_i::SupprZones()
437 {
438   ASSERT( myHomardHypothesis );
439   myHomardHypothesis->SupprZones();
440 }
441 //=============================================================================
442 HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones()
443 {
444   ASSERT( myHomardHypothesis );
445   const std::list<std::string>& ListString = myHomardHypothesis->GetZones();
446   HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo;
447   aResult->length( ListString.size() );
448   std::list<std::string>::const_iterator it;
449   int i = 0;
450   for ( it = ListString.begin(); it != ListString.end(); it++ )
451   {
452     aResult[i++] = CORBA::string_dup( (*it).c_str() );
453   }
454   return aResult._retn();
455 }