1 // Copyright (C) 2011-2020 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 VERIFICATION( (TypeRaffDera==1) || (TypeRaffDera==-1) );
120 int TypeRaff, TypeDera ;
121 if ( TypeRaffDera == 1 )
126 else if ( TypeRaffDera == -1 )
131 myHomardHypothesis->SetAdapType( -1 );
132 myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
134 //=============================================================================
135 HOMARD::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef()
137 ASSERT( myHomardHypothesis );
138 HOMARD::listeTypes_var aResult = new HOMARD::listeTypes;
139 aResult->length( 3 );
140 aResult[0] = CORBA::Long( myHomardHypothesis->GetAdapType() );
141 aResult[1] = CORBA::Long( myHomardHypothesis->GetRefinType() );
142 aResult[2] = CORBA::Long( myHomardHypothesis->GetUnRefType() );
143 return aResult._retn();
145 //=============================================================================
146 CORBA::Long HOMARD_Hypothesis_i::GetAdapType()
148 ASSERT( myHomardHypothesis );
149 return CORBA::Long( myHomardHypothesis->GetAdapType() );
151 //=============================================================================
152 CORBA::Long HOMARD_Hypothesis_i::GetRefinType()
154 ASSERT( myHomardHypothesis );
155 return CORBA::Long( myHomardHypothesis->GetRefinType() );
157 //=============================================================================
158 CORBA::Long HOMARD_Hypothesis_i::GetUnRefType()
160 ASSERT( myHomardHypothesis );
161 return CORBA::Long( myHomardHypothesis->GetUnRefType() );
163 //=============================================================================
164 void HOMARD_Hypothesis_i::SetField( const char* FieldName )
166 myHomardHypothesis->SetField( FieldName );
168 //=============================================================================
169 char* HOMARD_Hypothesis_i::GetFieldName()
171 ASSERT( myHomardHypothesis );
172 return CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
174 //=============================================================================
175 void HOMARD_Hypothesis_i::SetUseField( CORBA::Long UsField )
177 myHomardHypothesis->SetUseField( UsField );
179 //=============================================================================
180 HOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField()
182 ASSERT( myHomardHypothesis );
183 HOMARD::InfosHypo* aInfosHypo = new HOMARD::InfosHypo();
184 aInfosHypo->FieldName = CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
185 aInfosHypo->TypeThR = CORBA::Long( myHomardHypothesis->GetRefinThrType() );
186 aInfosHypo->ThreshR = CORBA::Double( myHomardHypothesis->GetThreshR() );
187 aInfosHypo->TypeThC = CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
188 aInfosHypo->ThreshC = CORBA::Double( myHomardHypothesis->GetThreshC() );
189 aInfosHypo->UsField = CORBA::Long( myHomardHypothesis->GetUseField() );
190 aInfosHypo->UsCmpI = CORBA::Long( myHomardHypothesis->GetUseComp() );
193 //=============================================================================
194 void HOMARD_Hypothesis_i::SetUseComp( CORBA::Long UsCmpI )
196 myHomardHypothesis->SetUseComp( UsCmpI );
198 //=============================================================================
199 void HOMARD_Hypothesis_i::AddComp( const char* NomComp )
201 ASSERT( myHomardHypothesis );
202 myHomardHypothesis->AddComp( NomComp );
204 //=============================================================================
205 void HOMARD_Hypothesis_i::SupprComp( const char* NomComp )
207 ASSERT( myHomardHypothesis );
208 myHomardHypothesis->SupprComp(NomComp);
210 //=============================================================================
211 void HOMARD_Hypothesis_i::SupprComps()
213 ASSERT( myHomardHypothesis );
214 myHomardHypothesis->SupprComps();
216 //=============================================================================
217 HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps()
219 ASSERT( myHomardHypothesis );
220 const std::list<std::string>& ListString = myHomardHypothesis->GetComps();
221 HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo;
222 aResult->length( ListString.size() );
223 std::list<std::string>::const_iterator it;
225 for ( it = ListString.begin(); it != ListString.end(); it++ )
227 aResult[i++] = CORBA::string_dup( (*it).c_str() );
229 return aResult._retn();
231 //=============================================================================
232 void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR )
234 myHomardHypothesis->SetAdapType( 1 );
237 int TypeDera = myHomardHypothesis->GetUnRefType() ;
238 myHomardHypothesis->SetRefinTypeDera( 1, TypeDera );
240 myHomardHypothesis->SetRefinThr( TypeThR, ThreshR );
242 //=============================================================================
243 CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType()
245 ASSERT( myHomardHypothesis );
246 return CORBA::Long( myHomardHypothesis->GetRefinThrType() );
248 //=============================================================================
249 void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC )
251 myHomardHypothesis->SetAdapType( 1 );
254 int TypeRaff = myHomardHypothesis->GetRefinType() ;
255 myHomardHypothesis->SetRefinTypeDera( TypeRaff, 1 );
257 myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC );
259 //=============================================================================
260 CORBA::Long HOMARD_Hypothesis_i::GetUnRefThrType()
262 ASSERT( myHomardHypothesis );
263 return CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
265 //=============================================================================
266 void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax )
268 ASSERT( myHomardHypothesis );
269 myHomardHypothesis->SetNivMax( NivMax );
271 //=============================================================================
272 CORBA::Long HOMARD_Hypothesis_i::GetNivMax()
274 ASSERT( myHomardHypothesis );
275 return myHomardHypothesis->GetNivMax();
277 //=============================================================================
278 void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin )
280 ASSERT( myHomardHypothesis );
281 myHomardHypothesis->SetDiamMin( DiamMin );
283 //=============================================================================
284 CORBA::Double HOMARD_Hypothesis_i::GetDiamMin()
286 ASSERT( myHomardHypothesis );
287 return myHomardHypothesis->GetDiamMin();
289 //=============================================================================
290 void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit )
292 ASSERT( myHomardHypothesis );
293 myHomardHypothesis->SetAdapInit( AdapInit );
295 //=============================================================================
296 CORBA::Long HOMARD_Hypothesis_i::GetAdapInit()
298 ASSERT( myHomardHypothesis );
299 return myHomardHypothesis->GetAdapInit();
301 //=============================================================================
302 void HOMARD_Hypothesis_i::SetExtraOutput( CORBA::Long ExtraOutput )
304 ASSERT( myHomardHypothesis );
305 myHomardHypothesis->SetExtraOutput( ExtraOutput );
307 //=============================================================================
308 CORBA::Long HOMARD_Hypothesis_i::GetExtraOutput()
310 ASSERT( myHomardHypothesis );
311 return myHomardHypothesis->GetExtraOutput();
313 //=============================================================================
314 void HOMARD_Hypothesis_i::AddGroup( const char* Group)
316 ASSERT( myHomardHypothesis );
317 myHomardHypothesis->AddGroup( Group );
319 //=============================================================================
320 void HOMARD_Hypothesis_i::SupprGroup( const char* Group )
322 ASSERT( myHomardHypothesis );
323 myHomardHypothesis->SupprGroup(Group);
325 //=============================================================================
326 void HOMARD_Hypothesis_i::SupprGroups()
328 ASSERT( myHomardHypothesis );
329 myHomardHypothesis->SupprGroups();
331 //=============================================================================
332 void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
334 ASSERT( myHomardHypothesis );
335 std::list<std::string> ListString;
336 for ( int i = 0; i < ListGroup.length(); i++ )
338 ListString.push_back(std::string(ListGroup[i]));
340 myHomardHypothesis->SetGroups( ListString );
342 //=============================================================================
343 HOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups()
345 ASSERT( myHomardHypothesis );
346 const std::list<std::string>& ListString = myHomardHypothesis->GetGroups();
347 HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
348 aResult->length( ListString.size() );
349 std::list<std::string>::const_iterator it;
351 for ( it = ListString.begin(); it != ListString.end(); it++ )
353 aResult[i++] = CORBA::string_dup( (*it).c_str() );
355 return aResult._retn();
357 //=============================================================================
358 void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp )
360 ASSERT( myHomardHypothesis );
361 myHomardHypothesis->SetTypeFieldInterp( TypeFieldInterp );
363 //=============================================================================
364 CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp()
366 ASSERT( myHomardHypothesis );
367 return CORBA::Long( myHomardHypothesis->GetTypeFieldInterp() );
369 //=============================================================================
370 void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp )
372 ASSERT( myHomardHypothesis );
373 myHomardHypothesis->AddFieldInterpType( FieldInterp, 0 );
375 //=============================================================================
376 void HOMARD_Hypothesis_i::AddFieldInterpType( const char* FieldInterp, CORBA::Long TypeInterp )
378 ASSERT( myHomardHypothesis );
379 myHomardHypothesis->AddFieldInterpType( FieldInterp, TypeInterp );
381 //=============================================================================
382 void HOMARD_Hypothesis_i::SupprFieldInterp( const char* FieldInterp )
384 ASSERT( myHomardHypothesis );
385 myHomardHypothesis->SupprFieldInterp(FieldInterp);
387 //=============================================================================
388 void HOMARD_Hypothesis_i::SupprFieldInterps()
390 ASSERT( myHomardHypothesis );
391 myHomardHypothesis->SupprFieldInterps();
393 //=============================================================================
394 HOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps()
396 ASSERT( myHomardHypothesis );
397 const std::list<std::string>& ListString = myHomardHypothesis->GetFieldInterps();
398 HOMARD::listeFieldInterpsHypo_var aResult = new HOMARD::listeFieldInterpsHypo;
399 aResult->length( ListString.size() );
400 std::list<std::string>::const_iterator it;
402 for ( it = ListString.begin(); it != ListString.end(); it++ )
404 aResult[i++] = CORBA::string_dup( (*it).c_str() );
406 return aResult._retn();
408 //=============================================================================
409 //=============================================================================
410 // Liens avec les autres structures
411 //=============================================================================
412 //=============================================================================
413 void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation )
415 ASSERT( myHomardHypothesis );
416 myHomardHypothesis->SetCaseCreation( NomCaseCreation );
418 //=============================================================================
419 char* HOMARD_Hypothesis_i::GetCaseCreation()
421 ASSERT( myHomardHypothesis );
422 return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() );
424 //=============================================================================
425 void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration )
427 ASSERT( myHomardHypothesis );
428 myHomardHypothesis->LinkIteration( NomIteration );
430 //=============================================================================
431 void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration )
433 ASSERT( myHomardHypothesis );
434 myHomardHypothesis->UnLinkIteration( NomIteration );
436 //=============================================================================
437 HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations()
439 ASSERT( myHomardHypothesis );
440 const std::list<std::string>& ListString = myHomardHypothesis->GetIterations();
441 HOMARD::listeIters_var aResult = new HOMARD::listeIters;
442 aResult->length( ListString.size() );
443 std::list<std::string>::const_iterator it;
445 for ( it = ListString.begin(); it != ListString.end(); it++ )
447 aResult[i++] = CORBA::string_dup( (*it).c_str() );
449 return aResult._retn();
451 //=============================================================================
452 void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse )
454 MESSAGE ("Dans AddZone pour " << NomZone << " et TypeUse = " << TypeUse ) ;
455 ASSERT( myHomardHypothesis );
456 VERIFICATION( (TypeUse==1) || (TypeUse==-1) );
457 myHomardHypothesis->SetAdapType( 0 );
458 int TypeRaff, TypeDera ;
462 TypeDera = myHomardHypothesis->GetUnRefType() ;
464 else if ( TypeUse == -1 )
466 TypeRaff = myHomardHypothesis->GetRefinType() ;
469 myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
470 char* NomHypo = GetName() ;
471 return _gen_i->AssociateHypoZone(NomHypo, NomZone, TypeUse) ;
473 //=============================================================================
474 void HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse )
476 MESSAGE ("Dans AddZone0 pour " << NomZone) ;
477 ASSERT( myHomardHypothesis );
478 myHomardHypothesis->AddZone( NomZone, TypeUse );
480 //=============================================================================
481 void HOMARD_Hypothesis_i::SupprZone(const char * NomZone)
483 ASSERT( myHomardHypothesis );
484 myHomardHypothesis->SupprZone( NomZone);
486 //=============================================================================
487 void HOMARD_Hypothesis_i::SupprZones()
489 ASSERT( myHomardHypothesis );
490 myHomardHypothesis->SupprZones();
492 //=============================================================================
493 HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones()
495 ASSERT( myHomardHypothesis );
496 const std::list<std::string>& ListString = myHomardHypothesis->GetZones();
497 HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo;
498 aResult->length( ListString.size() );
499 std::list<std::string>::const_iterator it;
501 for ( it = ListString.begin(); it != ListString.end(); it++ )
503 aResult[i++] = CORBA::string_dup( (*it).c_str() );
505 return aResult._retn();