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 )
125 else if ( TypeRaffDera == -1 )
132 ASSERT( "TypeRaffDera should be 1 or -1" == 0 );
134 myHomardHypothesis->SetAdapType( -1 );
135 myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
137 //=============================================================================
138 HOMARD::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef()
140 ASSERT( myHomardHypothesis );
141 HOMARD::listeTypes_var aResult = new HOMARD::listeTypes;
142 aResult->length( 3 );
143 aResult[0] = CORBA::Long( myHomardHypothesis->GetAdapType() );
144 aResult[1] = CORBA::Long( myHomardHypothesis->GetRefinType() );
145 aResult[2] = CORBA::Long( myHomardHypothesis->GetUnRefType() );
146 return aResult._retn();
148 //=============================================================================
149 CORBA::Long HOMARD_Hypothesis_i::GetAdapType()
151 ASSERT( myHomardHypothesis );
152 return CORBA::Long( myHomardHypothesis->GetAdapType() );
154 //=============================================================================
155 CORBA::Long HOMARD_Hypothesis_i::GetRefinType()
157 ASSERT( myHomardHypothesis );
158 return CORBA::Long( myHomardHypothesis->GetRefinType() );
160 //=============================================================================
161 CORBA::Long HOMARD_Hypothesis_i::GetUnRefType()
163 ASSERT( myHomardHypothesis );
164 return CORBA::Long( myHomardHypothesis->GetUnRefType() );
166 //=============================================================================
167 void HOMARD_Hypothesis_i::SetField( const char* FieldName )
169 myHomardHypothesis->SetField( FieldName );
171 //=============================================================================
172 char* HOMARD_Hypothesis_i::GetFieldName()
174 ASSERT( myHomardHypothesis );
175 return CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
177 //=============================================================================
178 void HOMARD_Hypothesis_i::SetUseField( CORBA::Long UsField )
180 myHomardHypothesis->SetUseField( UsField );
182 //=============================================================================
183 HOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField()
185 ASSERT( myHomardHypothesis );
186 HOMARD::InfosHypo* aInfosHypo = new HOMARD::InfosHypo();
187 aInfosHypo->FieldName = CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() );
188 aInfosHypo->TypeThR = CORBA::Long( myHomardHypothesis->GetRefinThrType() );
189 aInfosHypo->ThreshR = CORBA::Double( myHomardHypothesis->GetThreshR() );
190 aInfosHypo->TypeThC = CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
191 aInfosHypo->ThreshC = CORBA::Double( myHomardHypothesis->GetThreshC() );
192 aInfosHypo->UsField = CORBA::Long( myHomardHypothesis->GetUseField() );
193 aInfosHypo->UsCmpI = CORBA::Long( myHomardHypothesis->GetUseComp() );
196 //=============================================================================
197 void HOMARD_Hypothesis_i::SetUseComp( CORBA::Long UsCmpI )
199 myHomardHypothesis->SetUseComp( UsCmpI );
201 //=============================================================================
202 void HOMARD_Hypothesis_i::AddComp( const char* NomComp )
204 ASSERT( myHomardHypothesis );
205 myHomardHypothesis->AddComp( NomComp );
207 //=============================================================================
208 void HOMARD_Hypothesis_i::SupprComp( const char* NomComp )
210 ASSERT( myHomardHypothesis );
211 myHomardHypothesis->SupprComp(NomComp);
213 //=============================================================================
214 void HOMARD_Hypothesis_i::SupprComps()
216 ASSERT( myHomardHypothesis );
217 myHomardHypothesis->SupprComps();
219 //=============================================================================
220 HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps()
222 ASSERT( myHomardHypothesis );
223 const std::list<std::string>& ListString = myHomardHypothesis->GetComps();
224 HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo;
225 aResult->length( ListString.size() );
226 std::list<std::string>::const_iterator it;
228 for ( it = ListString.begin(); it != ListString.end(); it++ )
230 aResult[i++] = CORBA::string_dup( (*it).c_str() );
232 return aResult._retn();
234 //=============================================================================
235 void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR )
237 myHomardHypothesis->SetAdapType( 1 );
240 int TypeDera = myHomardHypothesis->GetUnRefType() ;
241 myHomardHypothesis->SetRefinTypeDera( 1, TypeDera );
243 myHomardHypothesis->SetRefinThr( TypeThR, ThreshR );
245 //=============================================================================
246 CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType()
248 ASSERT( myHomardHypothesis );
249 return CORBA::Long( myHomardHypothesis->GetRefinThrType() );
251 //=============================================================================
252 void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC )
254 myHomardHypothesis->SetAdapType( 1 );
257 int TypeRaff = myHomardHypothesis->GetRefinType() ;
258 myHomardHypothesis->SetRefinTypeDera( TypeRaff, 1 );
260 myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC );
262 //=============================================================================
263 CORBA::Long HOMARD_Hypothesis_i::GetUnRefThrType()
265 ASSERT( myHomardHypothesis );
266 return CORBA::Long( myHomardHypothesis->GetUnRefThrType() );
268 //=============================================================================
269 void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax )
271 ASSERT( myHomardHypothesis );
272 myHomardHypothesis->SetNivMax( NivMax );
274 //=============================================================================
275 CORBA::Long HOMARD_Hypothesis_i::GetNivMax()
277 ASSERT( myHomardHypothesis );
278 return myHomardHypothesis->GetNivMax();
280 //=============================================================================
281 void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin )
283 ASSERT( myHomardHypothesis );
284 myHomardHypothesis->SetDiamMin( DiamMin );
286 //=============================================================================
287 CORBA::Double HOMARD_Hypothesis_i::GetDiamMin()
289 ASSERT( myHomardHypothesis );
290 return myHomardHypothesis->GetDiamMin();
292 //=============================================================================
293 void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit )
295 ASSERT( myHomardHypothesis );
296 myHomardHypothesis->SetAdapInit( AdapInit );
298 //=============================================================================
299 CORBA::Long HOMARD_Hypothesis_i::GetAdapInit()
301 ASSERT( myHomardHypothesis );
302 return myHomardHypothesis->GetAdapInit();
304 //=============================================================================
305 void HOMARD_Hypothesis_i::SetLevelOutput( CORBA::Long LevelOutput )
307 ASSERT( myHomardHypothesis );
308 myHomardHypothesis->SetLevelOutput( LevelOutput );
310 //=============================================================================
311 CORBA::Long HOMARD_Hypothesis_i::GetLevelOutput()
313 ASSERT( myHomardHypothesis );
314 return myHomardHypothesis->GetLevelOutput();
316 //=============================================================================
317 void HOMARD_Hypothesis_i::AddGroup( const char* Group)
319 ASSERT( myHomardHypothesis );
320 myHomardHypothesis->AddGroup( Group );
322 //=============================================================================
323 void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
325 ASSERT( myHomardHypothesis );
326 std::list<std::string> ListString;
327 for ( int i = 0; i < ListGroup.length(); i++ )
329 ListString.push_back(std::string(ListGroup[i]));
331 myHomardHypothesis->SetGroups( ListString );
333 //=============================================================================
334 HOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups()
336 ASSERT( myHomardHypothesis );
337 const std::list<std::string>& ListString = myHomardHypothesis->GetGroups();
338 HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
339 aResult->length( ListString.size() );
340 std::list<std::string>::const_iterator it;
342 for ( it = ListString.begin(); it != ListString.end(); it++ )
344 aResult[i++] = CORBA::string_dup( (*it).c_str() );
346 return aResult._retn();
348 //=============================================================================
349 void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp )
351 ASSERT( myHomardHypothesis );
352 myHomardHypothesis->SetTypeFieldInterp( TypeFieldInterp );
354 //=============================================================================
355 CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp()
357 ASSERT( myHomardHypothesis );
358 return CORBA::Long( myHomardHypothesis->GetTypeFieldInterp() );
360 //=============================================================================
361 void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp )
363 ASSERT( myHomardHypothesis );
364 myHomardHypothesis->AddFieldInterpType( FieldInterp, 0 );
366 //=============================================================================
367 void HOMARD_Hypothesis_i::AddFieldInterpType( const char* FieldInterp, CORBA::Long TypeInterp )
369 ASSERT( myHomardHypothesis );
370 myHomardHypothesis->AddFieldInterpType( FieldInterp, TypeInterp );
372 //=============================================================================
373 void HOMARD_Hypothesis_i::SupprFieldInterp( const char* FieldInterp )
375 ASSERT( myHomardHypothesis );
376 myHomardHypothesis->SupprFieldInterp(FieldInterp);
378 //=============================================================================
379 void HOMARD_Hypothesis_i::SupprFieldInterps()
381 ASSERT( myHomardHypothesis );
382 myHomardHypothesis->SupprFieldInterps();
384 //=============================================================================
385 HOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps()
387 ASSERT( myHomardHypothesis );
388 const std::list<std::string>& ListString = myHomardHypothesis->GetFieldInterps();
389 HOMARD::listeFieldInterpsHypo_var aResult = new HOMARD::listeFieldInterpsHypo;
390 aResult->length( ListString.size() );
391 std::list<std::string>::const_iterator it;
393 for ( it = ListString.begin(); it != ListString.end(); it++ )
395 aResult[i++] = CORBA::string_dup( (*it).c_str() );
397 return aResult._retn();
399 //=============================================================================
400 //=============================================================================
401 // Liens avec les autres structures
402 //=============================================================================
403 //=============================================================================
404 void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation )
406 ASSERT( myHomardHypothesis );
407 myHomardHypothesis->SetCaseCreation( NomCaseCreation );
409 //=============================================================================
410 char* HOMARD_Hypothesis_i::GetCaseCreation()
412 ASSERT( myHomardHypothesis );
413 return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() );
415 //=============================================================================
416 void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration )
418 ASSERT( myHomardHypothesis );
419 myHomardHypothesis->LinkIteration( NomIteration );
421 //=============================================================================
422 void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration )
424 ASSERT( myHomardHypothesis );
425 myHomardHypothesis->UnLinkIteration( NomIteration );
427 //=============================================================================
428 HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations()
430 ASSERT( myHomardHypothesis );
431 const std::list<std::string>& ListString = myHomardHypothesis->GetIterations();
432 HOMARD::listeIters_var aResult = new HOMARD::listeIters;
433 aResult->length( ListString.size() );
434 std::list<std::string>::const_iterator it;
436 for ( it = ListString.begin(); it != ListString.end(); it++ )
438 aResult[i++] = CORBA::string_dup( (*it).c_str() );
440 return aResult._retn();
442 //=============================================================================
443 void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse )
445 MESSAGE ("Dans AddZone pour " << NomZone << " et TypeUse = " << TypeUse ) ;
446 ASSERT( myHomardHypothesis );
447 myHomardHypothesis->SetAdapType( 0 );
448 int TypeRaff, TypeDera ;
452 TypeDera = myHomardHypothesis->GetUnRefType() ;
454 else if ( TypeUse == -1 )
456 TypeRaff = myHomardHypothesis->GetRefinType() ;
461 ASSERT( "TypeUse should be 1 or -1" == 0 );
463 myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera );
464 char* NomHypo = GetName() ;
465 return _gen_i->AssociateHypoZone(NomHypo, NomZone, TypeUse) ;
467 //=============================================================================
468 void HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse )
470 MESSAGE ("Dans AddZone0 pour " << NomZone) ;
471 ASSERT( myHomardHypothesis );
472 myHomardHypothesis->AddZone( NomZone, TypeUse );
474 //=============================================================================
475 void HOMARD_Hypothesis_i::SupprZone(const char * NomZone)
477 ASSERT( myHomardHypothesis );
478 myHomardHypothesis->SupprZone( NomZone);
480 //=============================================================================
481 void HOMARD_Hypothesis_i::SupprZones()
483 ASSERT( myHomardHypothesis );
484 myHomardHypothesis->SupprZones();
486 //=============================================================================
487 HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones()
489 ASSERT( myHomardHypothesis );
490 const std::list<std::string>& ListString = myHomardHypothesis->GetZones();
491 HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo;
492 aResult->length( ListString.size() );
493 std::list<std::string>::const_iterator it;
495 for ( it = ListString.begin(); it != ListString.end(); it++ )
497 aResult[i++] = CORBA::string_dup( (*it).c_str() );
499 return aResult._retn();