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_Iteration_i.hxx"
31 #include "HOMARD_Gen_i.hxx"
32 #include "HOMARD_Iteration.hxx"
33 #include "HOMARD_DriverTools.hxx"
35 #include "SALOMEDS_Tool.hxx"
37 #include "utilities.h"
39 //=============================================================================
41 * standard constructor
43 //=============================================================================
44 HOMARD_Iteration_i::HOMARD_Iteration_i()
46 MESSAGE( "Default constructor, not for use" );
49 //=============================================================================
51 * standard constructor
53 //=============================================================================
54 HOMARD_Iteration_i::HOMARD_Iteration_i( CORBA::ORB_ptr orb,
55 HOMARD::HOMARD_Gen_var engine )
57 MESSAGE("constructor");
60 myHomardIteration = new ::HOMARD_Iteration();
61 ASSERT( myHomardIteration );
63 //=============================================================================
67 //=============================================================================
68 HOMARD_Iteration_i::~HOMARD_Iteration_i()
71 //=============================================================================
72 //=============================================================================
74 //=============================================================================
75 //=============================================================================
76 void HOMARD_Iteration_i::SetName( const char* Name )
78 ASSERT( myHomardIteration );
79 myHomardIteration->SetName( Name );
81 //=============================================================================
82 char* HOMARD_Iteration_i::GetName()
84 ASSERT( myHomardIteration );
85 return CORBA::string_dup( myHomardIteration->GetName().c_str() );
87 //=============================================================================
88 CORBA::Long HOMARD_Iteration_i::Delete( CORBA::Long Option )
90 ASSERT( myHomardIteration );
91 char* IterName = GetName() ;
92 MESSAGE ( "Delete : destruction de l'iteration " << IterName << ", Option = " << Option );
93 return _gen_i->DeleteIteration(IterName, Option) ;
95 //=============================================================================
96 char* HOMARD_Iteration_i::GetDumpPython()
98 ASSERT( myHomardIteration );
99 return CORBA::string_dup( myHomardIteration->GetDumpPython().c_str() );
101 //=============================================================================
102 std::string HOMARD_Iteration_i::Dump() const
104 return HOMARD::Dump( *myHomardIteration );
106 //=============================================================================
107 bool HOMARD_Iteration_i::Restore( const std::string& stream )
109 return HOMARD::Restore( *myHomardIteration, stream );
111 //=============================================================================
112 //=============================================================================
114 //=============================================================================
115 //=============================================================================
116 void HOMARD_Iteration_i::SetDirNameLoc( const char* NomDir )
118 ASSERT( myHomardIteration );
119 myHomardIteration->SetDirNameLoc( NomDir );
121 //=============================================================================
122 char* HOMARD_Iteration_i::GetDirNameLoc()
124 ASSERT( myHomardIteration );
125 return CORBA::string_dup( myHomardIteration->GetDirNameLoc().c_str() );
127 //=============================================================================
128 char* HOMARD_Iteration_i::GetDirName()
130 ASSERT( myHomardIteration );
131 std::string casename = myHomardIteration->GetCaseName() ;
132 HOMARD::HOMARD_Cas_ptr caseiter = _gen_i->GetCase(casename.c_str()) ;
133 std::string dirnamecase = caseiter->GetDirName() ;
134 std::string dirname = dirnamecase + "/" + GetDirNameLoc() ;
135 return CORBA::string_dup( dirname.c_str() );
137 //=============================================================================
138 void HOMARD_Iteration_i::SetNumber( CORBA::Long NumIter )
140 ASSERT( myHomardIteration );
141 myHomardIteration->SetNumber( NumIter );
143 //=============================================================================
144 CORBA::Long HOMARD_Iteration_i::GetNumber()
146 ASSERT( myHomardIteration );
147 return myHomardIteration->GetNumber() ;
149 //=============================================================================
150 void HOMARD_Iteration_i::SetState( CORBA::Long Etat )
152 ASSERT( myHomardIteration );
153 myHomardIteration->SetState( Etat );
155 //=============================================================================
156 CORBA::Long HOMARD_Iteration_i::GetState()
158 ASSERT( myHomardIteration );
159 return myHomardIteration->GetState() ;
161 //=============================================================================
162 void HOMARD_Iteration_i::SetMeshName( const char* NomMesh )
164 ASSERT( myHomardIteration );
165 myHomardIteration->SetMeshName( NomMesh );
167 //=============================================================================
168 char* HOMARD_Iteration_i::GetMeshName()
170 ASSERT( myHomardIteration );
171 return CORBA::string_dup( myHomardIteration->GetMeshName().c_str() );
173 //=============================================================================
174 void HOMARD_Iteration_i::SetMeshFile( const char* MeshFile )
176 ASSERT( myHomardIteration );
177 myHomardIteration->SetMeshFile( MeshFile );
179 //=============================================================================
180 char* HOMARD_Iteration_i::GetMeshFile()
182 ASSERT( myHomardIteration );
183 return CORBA::string_dup( myHomardIteration->GetMeshFile().c_str() );
185 //=============================================================================
186 void HOMARD_Iteration_i::SetFieldFile( const char* FieldFile )
188 ASSERT( myHomardIteration );
189 myHomardIteration->SetFieldFile( FieldFile );
191 //=============================================================================
192 char* HOMARD_Iteration_i::GetFieldFile()
194 ASSERT( myHomardIteration );
195 return CORBA::string_dup( myHomardIteration->GetFieldFile().c_str() );
197 //=============================================================================
198 // Instants pour le champ de pilotage
199 //=============================================================================
200 void HOMARD_Iteration_i::SetTimeStep( CORBA::Long TimeStep )
202 ASSERT( myHomardIteration );
203 myHomardIteration->SetTimeStep( TimeStep );
205 //=============================================================================
206 void HOMARD_Iteration_i::SetTimeStepRank( CORBA::Long TimeStep, CORBA::Long Rank )
208 ASSERT( myHomardIteration );
209 myHomardIteration->SetTimeStepRank( TimeStep, Rank );
211 //=============================================================================
212 void HOMARD_Iteration_i::SetTimeStepRankLast()
214 ASSERT( myHomardIteration );
215 myHomardIteration->SetTimeStepRankLast();
217 //=============================================================================
218 CORBA::Long HOMARD_Iteration_i::GetTimeStep()
220 ASSERT( myHomardIteration );
221 return CORBA::Long( myHomardIteration->GetTimeStep() );
223 //=============================================================================
224 CORBA::Long HOMARD_Iteration_i::GetRank()
226 ASSERT( myHomardIteration );
227 return CORBA::Long( myHomardIteration->GetRank() );
229 //=============================================================================
230 // Instants pour un champ a interpoler
231 //=============================================================================
232 void HOMARD_Iteration_i::SetFieldInterpTimeStep( const char* FieldInterp, CORBA::Long TimeStep )
234 SetFieldInterpTimeStepRank( FieldInterp, TimeStep, TimeStep );
236 //=============================================================================
237 void HOMARD_Iteration_i::SetFieldInterpTimeStepRank( const char* FieldInterp, CORBA::Long TimeStep, CORBA::Long Rank )
239 ASSERT( myHomardIteration );
240 myHomardIteration->SetFieldInterpTimeStepRank( FieldInterp, TimeStep, Rank );
242 //=============================================================================
243 HOMARD::listeFieldInterpTSRsIter* HOMARD_Iteration_i::GetFieldInterpsTimeStepRank()
245 ASSERT( myHomardIteration );
246 const std::list<std::string>& ListString = myHomardIteration->GetFieldInterpsTimeStepRank();
247 HOMARD::listeFieldInterpTSRsIter_var aResult = new HOMARD::listeFieldInterpTSRsIter;
248 aResult->length( ListString.size() );
249 std::list<std::string>::const_iterator it;
251 for ( it = ListString.begin(); it != ListString.end(); it++ )
253 aResult[i++] = CORBA::string_dup( (*it).c_str() );
255 return aResult._retn();
257 //=============================================================================
258 void HOMARD_Iteration_i::SetFieldInterp( const char* FieldInterp )
260 myHomardIteration->SetFieldInterp( FieldInterp );
262 //=============================================================================
263 HOMARD::listeFieldInterpsIter* HOMARD_Iteration_i::GetFieldInterps()
265 ASSERT( myHomardIteration );
266 const std::list<std::string>& ListString = myHomardIteration->GetFieldInterps();
267 HOMARD::listeFieldInterpsIter_var aResult = new HOMARD::listeFieldInterpsIter;
268 aResult->length( ListString.size() );
269 std::list<std::string>::const_iterator it;
271 for ( it = ListString.begin(); it != ListString.end(); it++ )
273 aResult[i++] = CORBA::string_dup( (*it).c_str() );
275 return aResult._retn();
277 //=============================================================================
278 void HOMARD_Iteration_i::SupprFieldInterps()
280 ASSERT( myHomardIteration );
281 myHomardIteration->SupprFieldInterps();
283 //=============================================================================
284 void HOMARD_Iteration_i::SetLogFile( const char* LogFile )
286 ASSERT( myHomardIteration );
287 myHomardIteration->SetLogFile( LogFile );
289 //=============================================================================
290 char* HOMARD_Iteration_i::GetLogFile()
292 ASSERT( myHomardIteration );
293 return CORBA::string_dup( myHomardIteration->GetLogFile().c_str() );
295 //=============================================================================
296 CORBA::Long HOMARD_Iteration_i::Compute(CORBA::Long etatMenage, CORBA::Long Option)
298 MESSAGE ( "Compute : calcul d'une iteration, etatMenage = "<<etatMenage<<", Option = "<<Option );
299 ASSERT( myHomardIteration );
301 // Nom de l'iteration
302 char* IterName = GetName() ;
303 CORBA::Long modeHOMARD = 1 ;
304 CORBA::Long Option1 = 1 ;
305 MESSAGE ( "Compute : calcul de l'teration " << IterName );
306 return _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option1, Option) ;
308 //=============================================================================
309 void HOMARD_Iteration_i::MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte)
311 MESSAGE ( "MeshInfo : information sur le maillage associe a une iteration" );
312 ASSERT( myHomardIteration );
315 MeshInfoOption( Qual, Diam, Conn, Tail, Inte, Option ) ;
319 //=============================================================================
320 void HOMARD_Iteration_i::MeshInfoOption(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte, CORBA::Long Option)
322 MESSAGE ( "MeshInfoOption : information sur le maillage associe a une iteration" );
323 ASSERT( myHomardIteration );
325 // Nom de l'iteration
326 char* IterName = GetName() ;
327 CORBA::Long etatMenage = -1 ;
328 CORBA::Long modeHOMARD = 7 ;
329 if ( Qual != 0 ) { modeHOMARD = modeHOMARD*5 ; }
330 if ( Diam != 0 ) { modeHOMARD = modeHOMARD*19 ; }
331 if ( Conn != 0 ) { modeHOMARD = modeHOMARD*11 ; }
332 if ( Tail != 0 ) { modeHOMARD = modeHOMARD*13 ; }
333 if ( Inte != 0 ) { modeHOMARD = modeHOMARD*3 ; }
334 MESSAGE ( "MeshInfoOption : information sur le maillage de l'iteration " << IterName );
335 CORBA::Long Option2 = 1 ;
336 CORBA::Long codret = _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option, Option2) ;
337 MESSAGE ( "MeshInfoOption : codret = " << codret );
341 //=============================================================================
342 void HOMARD_Iteration_i::SetFileInfo( const char* FileInfo )
344 ASSERT( myHomardIteration );
345 myHomardIteration->SetFileInfo( FileInfo );
347 //=============================================================================
348 char* HOMARD_Iteration_i::GetFileInfo()
350 ASSERT( myHomardIteration );
351 return CORBA::string_dup( myHomardIteration->GetFileInfo().c_str() );
353 //=============================================================================
354 //=============================================================================
355 // Liens avec les autres iterations
356 //=============================================================================
357 //=============================================================================
358 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::NextIteration( const char* IterName )
360 // Nom de l'iteration parent
361 char* NomIterParent = GetName() ;
362 MESSAGE ( "NextIteration : creation de l'iteration " << IterName << " comme fille de " << NomIterParent );
363 return _gen_i->CreateIteration(IterName, NomIterParent) ;
365 //=============================================================================
366 void HOMARD_Iteration_i::LinkNextIteration( const char* NomIteration )
368 ASSERT( myHomardIteration );
369 myHomardIteration->LinkNextIteration( NomIteration );
371 //=============================================================================
372 void HOMARD_Iteration_i::UnLinkNextIteration( const char* NomIteration )
374 ASSERT( myHomardIteration );
375 myHomardIteration->UnLinkNextIteration( NomIteration );
377 //=============================================================================
378 HOMARD::listeIterFilles* HOMARD_Iteration_i::GetIterations()
380 ASSERT( myHomardIteration );
381 const std::list<std::string>& maListe = myHomardIteration->GetIterations();
382 HOMARD::listeIterFilles_var aResult = new HOMARD::listeIterFilles;
383 aResult->length( maListe.size() );
384 std::list<std::string>::const_iterator it;
386 for ( it = maListe.begin(); it != maListe.end(); it++ )
388 aResult[i++] = CORBA::string_dup( (*it).c_str() );
390 return aResult._retn();
392 //=============================================================================
393 void HOMARD_Iteration_i::SetIterParentName( const char* NomIterParent )
395 ASSERT( myHomardIteration );
396 myHomardIteration->SetIterParentName( NomIterParent );
398 //=============================================================================
399 char* HOMARD_Iteration_i::GetIterParentName()
401 ASSERT( myHomardIteration );
402 return CORBA::string_dup( myHomardIteration->GetIterParentName().c_str() );
404 //=============================================================================
405 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::GetIterParent()
407 // Nom de l'iteration parent
408 char* NomIterParent = GetIterParentName() ;
409 MESSAGE ( "GetIterParent : NomIterParent = " << NomIterParent );
410 return _gen_i->GetIteration(NomIterParent) ;
412 //=============================================================================
413 //=============================================================================
414 // Liens avec les autres structures
415 //=============================================================================
416 //=============================================================================
417 void HOMARD_Iteration_i::SetCaseName( const char* NomCas )
419 ASSERT( myHomardIteration );
420 myHomardIteration->SetCaseName( NomCas );
422 //=============================================================================
423 char* HOMARD_Iteration_i::GetCaseName()
425 ASSERT( myHomardIteration );
426 return CORBA::string_dup( myHomardIteration->GetCaseName().c_str() );
428 //=============================================================================
429 void HOMARD_Iteration_i::AssociateHypo( const char* NomHypo )
431 ASSERT( myHomardIteration );
433 // Nom de l'iteration
434 char* IterName = GetName() ;
435 MESSAGE ( ". IterName = " << IterName );
436 return _gen_i->AssociateIterHypo(IterName, NomHypo) ;
438 //=============================================================================
439 void HOMARD_Iteration_i::SetHypoName( const char* NomHypo )
441 ASSERT( myHomardIteration );
442 myHomardIteration->SetHypoName( NomHypo );
444 //=============================================================================
445 char* HOMARD_Iteration_i::GetHypoName()
447 ASSERT( myHomardIteration );
448 return CORBA::string_dup( myHomardIteration->GetHypoName().c_str() );
450 //=============================================================================
451 //=============================================================================
453 //=============================================================================
454 //=============================================================================
455 void HOMARD_Iteration_i::SetInfoCompute( CORBA::Long MessInfo )
457 ASSERT( myHomardIteration );
458 myHomardIteration->SetInfoCompute( MessInfo );
460 //=============================================================================
461 CORBA::Long HOMARD_Iteration_i::GetInfoCompute()
463 ASSERT( myHomardIteration );
464 return myHomardIteration->GetInfoCompute() ;