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 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::SetLevelOutput( CORBA::Long LevelOutput )
304 ASSERT( myHomardHypothesis );
305 myHomardHypothesis->SetLevelOutput( LevelOutput );
307 //=============================================================================
308 CORBA::Long HOMARD_Hypothesis_i::GetLevelOutput()
310 ASSERT( myHomardHypothesis );
311 return myHomardHypothesis->GetLevelOutput();
313 //=============================================================================
314 void HOMARD_Hypothesis_i::AddGroup( const char* Group)
316 ASSERT( myHomardHypothesis );
317 myHomardHypothesis->AddGroup( Group );
319 //=============================================================================
320 void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
322 ASSERT( myHomardHypothesis );
323 std::list<std::string> ListString;
324 for ( int i = 0; i < ListGroup.length(); i++ )
326 ListString.push_back(std::string(ListGroup[i]));
328 myHomardHypothesis->SetGroups( ListString );
330 //=============================================================================
331 HOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups()
333 ASSERT( myHomardHypothesis );
334 const std::list<std::string>& ListString = myHomardHypothesis->GetGroups();
335 HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
336 aResult->length( ListString.size() );
337 std::list<std::string>::const_iterator it;
339 for ( it = ListString.begin(); it != ListString.end(); it++ )
341 aResult[i++] = CORBA::string_dup( (*it).c_str() );
343 return aResult._retn();
345 //=============================================================================
346 void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp )
348 ASSERT( myHomardHypothesis );
349 myHomardHypothesis->SetTypeFieldInterp( TypeFieldInterp );
351 //=============================================================================
352 CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp()
354 ASSERT( myHomardHypothesis );
355 return CORBA::Long( myHomardHypothesis->GetTypeFieldInterp() );
357 //=============================================================================
358 void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp )
360 ASSERT( myHomardHypothesis );
361 myHomardHypothesis->AddFieldInterpType( FieldInterp, 0 );
363 //=============================================================================
364 void HOMARD_Hypothesis_i::AddFieldInterpType( const char* FieldInterp, CORBA::Long TypeInterp )
366 ASSERT( myHomardHypothesis );
367 myHomardHypothesis->AddFieldInterpType( FieldInterp, TypeInterp );
369 //=============================================================================
370 void HOMARD_Hypothesis_i::SupprFieldInterp( const char* FieldInterp )
372 ASSERT( myHomardHypothesis );
373 myHomardHypothesis->SupprFieldInterp(FieldInterp);
375 //=============================================================================
376 void HOMARD_Hypothesis_i::SupprFieldInterps()
378 ASSERT( myHomardHypothesis );
379 myHomardHypothesis->SupprFieldInterps();
381 //=============================================================================
382 HOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps()
384 ASSERT( myHomardHypothesis );
385 const std::list<std::string>& ListString = myHomardHypothesis->GetFieldInterps();
386 HOMARD::listeFieldInterpsHypo_var aResult = new HOMARD::listeFieldInterpsHypo;
387 aResult->length( ListString.size() );
388 std::list<std::string>::const_iterator it;
390 for ( it = ListString.begin(); it != ListString.end(); it++ )
392 aResult[i++] = CORBA::string_dup( (*it).c_str() );
394 return aResult._retn();
396 //=============================================================================
397 //=============================================================================
398 // Liens avec les autres structures
399 //=============================================================================
400 //=============================================================================
401 void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation )
403 ASSERT( myHomardHypothesis );
404 myHomardHypothesis->SetCaseCreation( NomCaseCreation );
406 //=============================================================================
407 char* HOMARD_Hypothesis_i::GetCaseCreation()
409 ASSERT( myHomardHypothesis );
410 return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() );
412 //=============================================================================
413 void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration )
415 ASSERT( myHomardHypothesis );
416 myHomardHypothesis->LinkIteration( NomIteration );
418 //=============================================================================
419 void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration )
421 ASSERT( myHomardHypothesis );
422 myHomardHypothesis->UnLinkIteration( NomIteration );
424 //=============================================================================
425 HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations()
427 ASSERT( myHomardHypothesis );
428 const std::list<std::string>& ListString = myHomardHypothesis->GetIterations();
429 HOMARD::listeIters_var aResult = new HOMARD::listeIters;
430 aResult->length( ListString.size() );
431 std::list<std::string>::const_iterator it;
433 for ( it = ListString.begin(); it != ListString.end(); it++ )
435 aResult[i++] = CORBA::string_dup( (*it).c_str() );
437 return aResult._retn();
439 //=============================================================================
440 void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse )
442 MESSAGE ("Dans AddZone pour " << NomZone << " et TypeUse = " << TypeUse ) ;
443 ASSERT( myHomardHypothesis );
444 VERIFICATION( (TypeUse==1) || (TypeUse==-1) );
445 myHomardHypothesis->SetAdapType( 0 );
446 int TypeRaff, TypeDera ;
450 TypeDera = myHomardHypothesis->GetUnRefType() ;
452 else if ( TypeUse == -1 )
454 TypeRaff = myHomardHypothesis->GetRefinType() ;
457 myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
458 char* NomHypo = GetName() ;
459 return _gen_i->AssociateHypoZone(NomHypo, NomZone, TypeUse) ;
461 //=============================================================================
462 void HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse )
464 MESSAGE ("Dans AddZone0 pour " << NomZone) ;
465 ASSERT( myHomardHypothesis );
466 myHomardHypothesis->AddZone( NomZone, TypeUse );
468 //=============================================================================
469 void HOMARD_Hypothesis_i::SupprZone(const char * NomZone)
471 ASSERT( myHomardHypothesis );
472 myHomardHypothesis->SupprZone( NomZone);
474 //=============================================================================
475 void HOMARD_Hypothesis_i::SupprZones()
477 ASSERT( myHomardHypothesis );
478 myHomardHypothesis->SupprZones();
480 //=============================================================================
481 HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones()
483 ASSERT( myHomardHypothesis );
484 const std::list<std::string>& ListString = myHomardHypothesis->GetZones();
485 HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo;
486 aResult->length( ListString.size() );
487 std::list<std::string>::const_iterator it;
489 for ( it = ListString.begin(); it != ListString.end(); it++ )
491 aResult[i++] = CORBA::string_dup( (*it).c_str() );
493 return aResult._retn();