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