1 // Copyright (C) 2011-2014 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
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
27 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
30 #include "HOMARD_Hypothesis_i.hxx"
31 #include "HOMARD_Gen_i.hxx"
32 #include "HOMARD_Hypothesis.hxx"
33 #include "HOMARD_DriverTools.hxx"
35 #include "utilities.h"
37 //=============================================================================
39 * standard constructor
41 //=============================================================================
42 HOMARD_Hypothesis_i::HOMARD_Hypothesis_i()
44 MESSAGE( "Default constructor, not for use" );
48 //=============================================================================
50 * standard constructor
52 //=============================================================================
53 HOMARD_Hypothesis_i::HOMARD_Hypothesis_i( CORBA::ORB_ptr orb,
54 HOMARD::HOMARD_Gen_var engine )
56 MESSAGE( "standard constructor" );
59 myHomardHypothesis = new ::HOMARD_Hypothesis();
60 ASSERT( myHomardHypothesis );
63 //=============================================================================
67 //=============================================================================
68 HOMARD_Hypothesis_i::~HOMARD_Hypothesis_i()
71 //=============================================================================
72 //=============================================================================
74 //=============================================================================
75 //=============================================================================
76 void HOMARD_Hypothesis_i::SetName( const char* Name )
78 ASSERT( myHomardHypothesis );
79 myHomardHypothesis->SetName( Name );
81 //=============================================================================
82 char* HOMARD_Hypothesis_i::GetName()
84 ASSERT( myHomardHypothesis );
85 return CORBA::string_dup( myHomardHypothesis->GetName().c_str() );
87 //=============================================================================
88 CORBA::Long HOMARD_Hypothesis_i::Delete()
90 ASSERT( myHomardHypothesis );
91 char* HypoName = GetName() ;
92 MESSAGE ( "Delete : destruction de l'hypothese " << HypoName );
93 return _gen_i->DeleteHypo(HypoName) ;
95 //=============================================================================
96 char* HOMARD_Hypothesis_i::GetDumpPython()
98 ASSERT( myHomardHypothesis );
99 return CORBA::string_dup( myHomardHypothesis->GetDumpPython().c_str() );
101 //=============================================================================
102 std::string HOMARD_Hypothesis_i::Dump() const
104 return HOMARD::Dump( *myHomardHypothesis );
106 //=============================================================================
107 bool HOMARD_Hypothesis_i::Restore( const std::string& stream )
109 return HOMARD::Restore( *myHomardHypothesis, stream );
111 //=============================================================================
112 //=============================================================================
114 //=============================================================================
115 //=============================================================================
116 void HOMARD_Hypothesis_i::SetUnifRefinUnRef( CORBA::Long TypeRaffDera )
118 ASSERT( myHomardHypothesis );
119 int TypeRaff, TypeDera ;
120 if ( TypeRaffDera == 1 )
130 myHomardHypothesis->SetAdapType( -1 );
131 myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
133 //=============================================================================
134 HOMARD::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef()
136 ASSERT( myHomardHypothesis );
137 HOMARD::listeTypes_var aResult = new HOMARD::listeTypes;
138 aResult->length( 3 );
139 aResult[0] = CORBA::Long( myHomardHypothesis->GetAdapType() );
140 aResult[1] = CORBA::Long( myHomardHypothesis->GetRefinType() );
141 aResult[2] = CORBA::Long( myHomardHypothesis->GetUnRefType() );
142 return aResult._retn();
144 //=============================================================================
145 CORBA::Long HOMARD_Hypothesis_i::GetAdapType()
147 ASSERT( myHomardHypothesis );
148 return CORBA::Long( myHomardHypothesis->GetAdapType() );
150 //=============================================================================
151 CORBA::Long HOMARD_Hypothesis_i::GetRefinType()
153 ASSERT( myHomardHypothesis );
154 return CORBA::Long( myHomardHypothesis->GetRefinType() );
156 //=============================================================================
157 CORBA::Long HOMARD_Hypothesis_i::GetUnRefType()
159 ASSERT( myHomardHypothesis );
160 return CORBA::Long( myHomardHypothesis->GetUnRefType() );
162 //=============================================================================
163 void HOMARD_Hypothesis_i::SetField( const char* FieldName )
165 myHomardHypothesis->SetField( FieldName );
167 //=============================================================================
168 char* HOMARD_Hypothesis_i::GetFieldName()
170 ASSERT( myHomardHypothesis );
171 return CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
173 //=============================================================================
174 void HOMARD_Hypothesis_i::SetUseField( CORBA::Long UsField )
176 myHomardHypothesis->SetUseField( UsField );
178 //=============================================================================
179 HOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField()
181 ASSERT( myHomardHypothesis );
182 HOMARD::InfosHypo* aInfosHypo = new HOMARD::InfosHypo();
183 aInfosHypo->FieldName = CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
184 aInfosHypo->TypeThR = CORBA::Long( myHomardHypothesis->GetRefinThrType() );
185 aInfosHypo->ThreshR = CORBA::Double( myHomardHypothesis->GetThreshR() );
186 aInfosHypo->TypeThC = CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
187 aInfosHypo->ThreshC = CORBA::Double( myHomardHypothesis->GetThreshC() );
188 aInfosHypo->UsField = CORBA::Long( myHomardHypothesis->GetUseField() );
189 aInfosHypo->UsCmpI = CORBA::Long( myHomardHypothesis->GetUseComp() );
192 //=============================================================================
193 void HOMARD_Hypothesis_i::SetUseComp( CORBA::Long UsCmpI )
195 myHomardHypothesis->SetUseComp( UsCmpI );
197 //=============================================================================
198 void HOMARD_Hypothesis_i::AddComp( const char* NomComp )
200 ASSERT( myHomardHypothesis );
201 myHomardHypothesis->AddComp( NomComp );
203 //=============================================================================
204 void HOMARD_Hypothesis_i::SupprComp( const char* NomComp )
206 ASSERT( myHomardHypothesis );
207 myHomardHypothesis->SupprComp(NomComp);
209 //=============================================================================
210 void HOMARD_Hypothesis_i::SupprComps()
212 ASSERT( myHomardHypothesis );
213 myHomardHypothesis->SupprComps();
215 //=============================================================================
216 HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps()
218 ASSERT( myHomardHypothesis );
219 const std::list<std::string>& ListString = myHomardHypothesis->GetComps();
220 HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo;
221 aResult->length( ListString.size() );
222 std::list<std::string>::const_iterator it;
224 for ( it = ListString.begin(); it != ListString.end(); it++ )
226 aResult[i++] = CORBA::string_dup( (*it).c_str() );
228 return aResult._retn();
230 //=============================================================================
231 void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR )
233 myHomardHypothesis->SetAdapType( 1 );
234 int TypeDera = myHomardHypothesis->GetUnRefType() ;
235 myHomardHypothesis->SetRefinTypeDera( 1, TypeDera );
236 myHomardHypothesis->SetRefinThr( TypeThR, ThreshR );
238 //=============================================================================
239 CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType()
241 ASSERT( myHomardHypothesis );
242 return CORBA::Long( myHomardHypothesis->GetRefinThrType() );
244 //=============================================================================
245 void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC )
247 myHomardHypothesis->SetAdapType( 1 );
248 int TypeRaff = myHomardHypothesis->GetRefinType() ;
249 myHomardHypothesis->SetRefinTypeDera( TypeRaff, 1 );
250 myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC );
252 //=============================================================================
253 CORBA::Long HOMARD_Hypothesis_i::GetUnRefThrType()
255 ASSERT( myHomardHypothesis );
256 return CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
258 //=============================================================================
259 void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax )
261 ASSERT( myHomardHypothesis );
262 myHomardHypothesis->SetNivMax( NivMax );
264 //=============================================================================
265 CORBA::Long HOMARD_Hypothesis_i::GetNivMax()
267 ASSERT( myHomardHypothesis );
268 return myHomardHypothesis->GetNivMax();
270 //=============================================================================
271 void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin )
273 ASSERT( myHomardHypothesis );
274 myHomardHypothesis->SetDiamMin( DiamMin );
276 //=============================================================================
277 CORBA::Double HOMARD_Hypothesis_i::GetDiamMin()
279 ASSERT( myHomardHypothesis );
280 return myHomardHypothesis->GetDiamMin();
282 //=============================================================================
283 void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit )
285 ASSERT( myHomardHypothesis );
286 myHomardHypothesis->SetAdapInit( AdapInit );
288 //=============================================================================
289 CORBA::Long HOMARD_Hypothesis_i::GetAdapInit()
291 ASSERT( myHomardHypothesis );
292 return myHomardHypothesis->GetAdapInit();
294 //=============================================================================
295 void HOMARD_Hypothesis_i::SetLevelOutput( CORBA::Long LevelOutput )
297 ASSERT( myHomardHypothesis );
298 myHomardHypothesis->SetLevelOutput( LevelOutput );
300 //=============================================================================
301 CORBA::Long HOMARD_Hypothesis_i::GetLevelOutput()
303 ASSERT( myHomardHypothesis );
304 return myHomardHypothesis->GetLevelOutput();
306 //=============================================================================
307 void HOMARD_Hypothesis_i::AddGroup( const char* Group)
309 ASSERT( myHomardHypothesis );
310 myHomardHypothesis->AddGroup( Group );
312 //=============================================================================
313 void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
315 ASSERT( myHomardHypothesis );
316 std::list<std::string> ListString;
317 for ( int i = 0; i < ListGroup.length(); i++ )
319 ListString.push_back(std::string(ListGroup[i]));
321 myHomardHypothesis->SetGroups( ListString );
323 //=============================================================================
324 HOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups()
326 ASSERT( myHomardHypothesis );
327 const std::list<std::string>& ListString = myHomardHypothesis->GetGroups();
328 HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
329 aResult->length( ListString.size() );
330 std::list<std::string>::const_iterator it;
332 for ( it = ListString.begin(); it != ListString.end(); it++ )
334 aResult[i++] = CORBA::string_dup( (*it).c_str() );
336 return aResult._retn();
338 //=============================================================================
339 void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp )
341 ASSERT( myHomardHypothesis );
342 myHomardHypothesis->SetTypeFieldInterp( TypeFieldInterp );
344 //=============================================================================
345 CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp()
347 ASSERT( myHomardHypothesis );
348 return CORBA::Long( myHomardHypothesis->GetTypeFieldInterp() );
350 //=============================================================================
351 void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp )
353 ASSERT( myHomardHypothesis );
354 myHomardHypothesis->AddFieldInterpType( FieldInterp, 0 );
356 //=============================================================================
357 void HOMARD_Hypothesis_i::AddFieldInterpType( const char* FieldInterp, CORBA::Long TypeInterp )
359 ASSERT( myHomardHypothesis );
360 myHomardHypothesis->AddFieldInterpType( FieldInterp, TypeInterp );
362 //=============================================================================
363 void HOMARD_Hypothesis_i::SupprFieldInterp( const char* FieldInterp )
365 ASSERT( myHomardHypothesis );
366 myHomardHypothesis->SupprFieldInterp(FieldInterp);
368 //=============================================================================
369 void HOMARD_Hypothesis_i::SupprFieldInterps()
371 ASSERT( myHomardHypothesis );
372 myHomardHypothesis->SupprFieldInterps();
374 //=============================================================================
375 HOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps()
377 ASSERT( myHomardHypothesis );
378 const std::list<std::string>& ListString = myHomardHypothesis->GetFieldInterps();
379 HOMARD::listeFieldInterpsHypo_var aResult = new HOMARD::listeFieldInterpsHypo;
380 aResult->length( ListString.size() );
381 std::list<std::string>::const_iterator it;
383 for ( it = ListString.begin(); it != ListString.end(); it++ )
385 aResult[i++] = CORBA::string_dup( (*it).c_str() );
387 return aResult._retn();
389 //=============================================================================
390 //=============================================================================
391 // Liens avec les autres structures
392 //=============================================================================
393 //=============================================================================
394 void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation )
396 ASSERT( myHomardHypothesis );
397 myHomardHypothesis->SetCaseCreation( NomCaseCreation );
399 //=============================================================================
400 char* HOMARD_Hypothesis_i::GetCaseCreation()
402 ASSERT( myHomardHypothesis );
403 return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() );
405 //=============================================================================
406 void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration )
408 ASSERT( myHomardHypothesis );
409 myHomardHypothesis->LinkIteration( NomIteration );
411 //=============================================================================
412 void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration )
414 ASSERT( myHomardHypothesis );
415 myHomardHypothesis->UnLinkIteration( NomIteration );
417 //=============================================================================
418 HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations()
420 ASSERT( myHomardHypothesis );
421 const std::list<std::string>& ListString = myHomardHypothesis->GetIterations();
422 HOMARD::listeIters_var aResult = new HOMARD::listeIters;
423 aResult->length( ListString.size() );
424 std::list<std::string>::const_iterator it;
426 for ( it = ListString.begin(); it != ListString.end(); it++ )
428 aResult[i++] = CORBA::string_dup( (*it).c_str() );
430 return aResult._retn();
432 //=============================================================================
433 void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse )
435 MESSAGE ("Dans AddZone pour " << NomZone << " et TypeUse = " << TypeUse ) ;
436 ASSERT( myHomardHypothesis );
437 myHomardHypothesis->SetAdapType( 0 );
438 int TypeRaff, TypeDera ;
442 TypeDera = myHomardHypothesis->GetUnRefType() ;
444 else if ( TypeUse == -1 )
446 TypeRaff = myHomardHypothesis->GetRefinType() ;
451 ASSERT( "TypeUse should be 1 or -1" == 0 );
453 myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
454 char* NomHypo = GetName() ;
455 return _gen_i->AssociateHypoZone(NomHypo, NomZone, TypeUse) ;
457 //=============================================================================
458 void HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse )
460 MESSAGE ("Dans AddZone0 pour " << NomZone) ;
461 ASSERT( myHomardHypothesis );
462 myHomardHypothesis->AddZone( NomZone, TypeUse );
464 //=============================================================================
465 void HOMARD_Hypothesis_i::SupprZone(const char * NomZone)
467 ASSERT( myHomardHypothesis );
468 myHomardHypothesis->SupprZone( NomZone);
470 //=============================================================================
471 void HOMARD_Hypothesis_i::SupprZones()
473 ASSERT( myHomardHypothesis );
474 myHomardHypothesis->SupprZones();
476 //=============================================================================
477 HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones()
479 ASSERT( myHomardHypothesis );
480 const std::list<std::string>& ListString = myHomardHypothesis->GetZones();
481 HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo;
482 aResult->length( ListString.size() );
483 std::list<std::string>::const_iterator it;
485 for ( it = ListString.begin(); it != ListString.end(); it++ )
487 aResult[i++] = CORBA::string_dup( (*it).c_str() );
489 return aResult._retn();