1 // Copyright (C) 2011-2013 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.
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
20 // L'ordre de description des fonctions est le meme dans tous les fichiers
21 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
22 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
23 // 2. Les caracteristiques
24 // 3. Le lien avec les autres structures
26 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
29 #include "HOMARD_Iteration_i.hxx"
30 #include "HOMARD_Gen_i.hxx"
31 #include "HOMARD_Iteration.hxx"
32 #include "HOMARD_DriverTools.hxx"
34 #include "SALOMEDS_Tool.hxx"
36 #include "utilities.h"
38 //=============================================================================
40 * standard constructor
42 //=============================================================================
43 HOMARD_Iteration_i::HOMARD_Iteration_i()
45 MESSAGE( "Default constructor, not for use" );
48 //=============================================================================
50 * standard constructor
52 //=============================================================================
53 HOMARD_Iteration_i::HOMARD_Iteration_i( CORBA::ORB_ptr orb,
54 HOMARD::HOMARD_Gen_var engine )
56 MESSAGE("constructor");
59 myHomardIteration = new ::HOMARD_Iteration();
60 ASSERT( myHomardIteration );
62 //=============================================================================
66 //=============================================================================
67 HOMARD_Iteration_i::~HOMARD_Iteration_i()
70 //=============================================================================
71 //=============================================================================
73 //=============================================================================
74 //=============================================================================
75 void HOMARD_Iteration_i::SetName( const char* Name )
77 ASSERT( myHomardIteration );
78 myHomardIteration->SetName( Name );
80 //=============================================================================
81 char* HOMARD_Iteration_i::GetName()
83 ASSERT( myHomardIteration );
84 return CORBA::string_dup( myHomardIteration->GetName().c_str() );
86 //=============================================================================
87 CORBA::Long HOMARD_Iteration_i::Delete( CORBA::Long Option )
89 ASSERT( myHomardIteration );
90 char* IterName = GetName() ;
91 MESSAGE ( "Delete : destruction de l'iteration " << IterName << ", Option = " << Option );
92 return _gen_i->DeleteIteration(IterName, Option) ;
94 //=============================================================================
95 char* HOMARD_Iteration_i::GetDumpPython()
97 ASSERT( myHomardIteration );
98 return CORBA::string_dup( myHomardIteration->GetDumpPython().c_str() );
100 //=============================================================================
101 std::string HOMARD_Iteration_i::Dump() const
103 return HOMARD::Dump( *myHomardIteration );
105 //=============================================================================
106 bool HOMARD_Iteration_i::Restore( const std::string& stream )
108 return HOMARD::Restore( *myHomardIteration, stream );
110 //=============================================================================
111 //=============================================================================
113 //=============================================================================
114 //=============================================================================
115 void HOMARD_Iteration_i::SetDirName( const char* NomDir )
117 ASSERT( myHomardIteration );
118 myHomardIteration->SetDirName( NomDir );
120 //=============================================================================
121 char* HOMARD_Iteration_i::GetDirName()
123 ASSERT( myHomardIteration );
124 return CORBA::string_dup( myHomardIteration->GetDirName().c_str() );
126 //=============================================================================
127 void HOMARD_Iteration_i::SetNumber( CORBA::Long NumIter )
129 ASSERT( myHomardIteration );
130 myHomardIteration->SetNumber( NumIter );
132 //=============================================================================
133 CORBA::Long HOMARD_Iteration_i::GetNumber()
135 ASSERT( myHomardIteration );
136 return myHomardIteration->GetNumber() ;
138 //=============================================================================
139 void HOMARD_Iteration_i::SetState( CORBA::Long Etat )
141 ASSERT( myHomardIteration );
142 myHomardIteration->SetState( Etat );
144 //=============================================================================
145 CORBA::Long HOMARD_Iteration_i::GetState()
147 ASSERT( myHomardIteration );
148 return myHomardIteration->GetState() ;
150 //=============================================================================
151 void HOMARD_Iteration_i::SetMeshName( const char* NomMesh )
153 ASSERT( myHomardIteration );
154 myHomardIteration->SetMeshName( NomMesh );
156 //=============================================================================
157 char* HOMARD_Iteration_i::GetMeshName()
159 ASSERT( myHomardIteration );
160 return CORBA::string_dup( myHomardIteration->GetMeshName().c_str() );
162 //=============================================================================
163 void HOMARD_Iteration_i::SetMeshFile( const char* MeshFile )
165 ASSERT( myHomardIteration );
166 myHomardIteration->SetMeshFile( MeshFile );
168 //=============================================================================
169 char* HOMARD_Iteration_i::GetMeshFile()
171 ASSERT( myHomardIteration );
172 return CORBA::string_dup( myHomardIteration->GetMeshFile().c_str() );
174 //=============================================================================
175 void HOMARD_Iteration_i::SetFieldFile( const char* FieldFile )
177 ASSERT( myHomardIteration );
178 myHomardIteration->SetFieldFile( FieldFile );
180 //=============================================================================
181 char* HOMARD_Iteration_i::GetFieldFile()
183 ASSERT( myHomardIteration );
184 return CORBA::string_dup( myHomardIteration->GetFieldFile().c_str() );
186 //=============================================================================
187 void HOMARD_Iteration_i::SetTimeStepRank( CORBA::Long TimeStep, CORBA::Long Rank )
189 ASSERT( myHomardIteration );
190 myHomardIteration->SetTimeStepRank( TimeStep, Rank );
192 //=============================================================================
193 void HOMARD_Iteration_i::SetTimeStepRankLast()
195 ASSERT( myHomardIteration );
196 myHomardIteration->SetTimeStepRankLast();
198 //=============================================================================
199 CORBA::Long HOMARD_Iteration_i::GetTimeStep()
201 ASSERT( myHomardIteration );
202 return CORBA::Long( myHomardIteration->GetTimeStep() );
204 //=============================================================================
205 CORBA::Long HOMARD_Iteration_i::GetRank()
207 ASSERT( myHomardIteration );
208 return CORBA::Long( myHomardIteration->GetRank() );
210 //=============================================================================
211 void HOMARD_Iteration_i::SetLogFile( const char* LogFile )
213 ASSERT( myHomardIteration );
214 myHomardIteration->SetLogFile( LogFile );
216 //=============================================================================
217 char* HOMARD_Iteration_i::GetLogFile()
219 ASSERT( myHomardIteration );
220 return CORBA::string_dup( myHomardIteration->GetLogFile().c_str() );
222 //=============================================================================
223 CORBA::Long HOMARD_Iteration_i::Compute(CORBA::Long etatMenage, CORBA::Long Option)
225 MESSAGE ( "Compute : calcul d'une iteration"<<", Option = "<<Option );
226 ASSERT( myHomardIteration );
228 // Nom de l'iteration
229 char* IterName = GetName() ;
230 CORBA::Long modeHOMARD = 1 ;
231 CORBA::Long Option1 = 1 ;
232 MESSAGE ( "Compute : calcul de l'teration " << IterName );
233 return _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option1, Option) ;
235 //=============================================================================
236 void HOMARD_Iteration_i::MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte)
238 MESSAGE ( "MeshInfo : information sur le maillage associe a une iteration" );
239 ASSERT( myHomardIteration );
242 MeshInfoOption( Qual, Diam, Conn, Tail, Inte, Option ) ;
246 //=============================================================================
247 void HOMARD_Iteration_i::MeshInfoOption(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte, CORBA::Long Option)
249 MESSAGE ( "MeshInfoOption : information sur le maillage associe a une iteration" );
250 ASSERT( myHomardIteration );
252 // Nom de l'iteration
253 char* IterName = GetName() ;
254 CORBA::Long etatMenage = -1 ;
255 CORBA::Long modeHOMARD = 7 ;
256 if ( Qual != 0 ) { modeHOMARD = modeHOMARD*5 ; }
257 if ( Diam != 0 ) { modeHOMARD = modeHOMARD*19 ; }
258 if ( Conn != 0 ) { modeHOMARD = modeHOMARD*11 ; }
259 if ( Tail != 0 ) { modeHOMARD = modeHOMARD*13 ; }
260 if ( Inte != 0 ) { modeHOMARD = modeHOMARD*3 ; }
261 MESSAGE ( "MeshInfoOption : information sur le maillage de l'iteration " << IterName );
262 CORBA::Long Option2 = 1 ;
263 CORBA::Long codret = _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option, Option2) ;
264 MESSAGE ( "MeshInfoOption : codret = " << codret );
268 //=============================================================================
269 void HOMARD_Iteration_i::SetFileInfo( const char* FileInfo )
271 ASSERT( myHomardIteration );
272 myHomardIteration->SetFileInfo( FileInfo );
274 //=============================================================================
275 char* HOMARD_Iteration_i::GetFileInfo()
277 ASSERT( myHomardIteration );
278 return CORBA::string_dup( myHomardIteration->GetFileInfo().c_str() );
280 //=============================================================================
281 //=============================================================================
282 // Liens avec les autres iterations
283 //=============================================================================
284 //=============================================================================
285 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::NextIteration( const char* IterName )
287 // Nom de l'iteration parent
288 char* NomIterParent = GetName() ;
289 MESSAGE ( "NextIteration : creation de l'iteration " << IterName << " comme fille de " << NomIterParent );
290 return _gen_i->CreateIteration(IterName, NomIterParent) ;
292 //=============================================================================
293 void HOMARD_Iteration_i::LinkNextIteration( const char* NomIteration )
295 ASSERT( myHomardIteration );
296 myHomardIteration->LinkNextIteration( NomIteration );
298 //=============================================================================
299 void HOMARD_Iteration_i::UnLinkNextIteration( const char* NomIteration )
301 ASSERT( myHomardIteration );
302 myHomardIteration->UnLinkNextIteration( NomIteration );
304 //=============================================================================
305 HOMARD::listeIterFilles* HOMARD_Iteration_i::GetIterations()
307 ASSERT( myHomardIteration );
308 const std::list<std::string>& maListe = myHomardIteration->GetIterations();
309 HOMARD::listeIterFilles_var aResult = new HOMARD::listeIterFilles;
310 aResult->length( maListe.size() );
311 std::list<std::string>::const_iterator it;
313 for ( it = maListe.begin(); it != maListe.end(); it++ )
315 aResult[i++] = CORBA::string_dup( (*it).c_str() );
317 return aResult._retn();
319 //=============================================================================
320 void HOMARD_Iteration_i::SetIterParentName( const char* NomIterParent )
322 ASSERT( myHomardIteration );
323 myHomardIteration->SetIterParentName( NomIterParent );
325 //=============================================================================
326 char* HOMARD_Iteration_i::GetIterParentName()
328 ASSERT( myHomardIteration );
329 return CORBA::string_dup( myHomardIteration->GetIterParentName().c_str() );
331 //=============================================================================
332 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::GetIterParent()
334 // Nom de l'iteration parent
335 char* NomIterParent = GetIterParentName() ;
336 MESSAGE ( "GetIterParent : NomIterParent = " << NomIterParent );
337 return _gen_i->GetIteration(NomIterParent) ;
339 //=============================================================================
340 //=============================================================================
341 // Liens avec les autres structures
342 //=============================================================================
343 //=============================================================================
344 void HOMARD_Iteration_i::SetCaseName( const char* NomCas )
346 ASSERT( myHomardIteration );
347 myHomardIteration->SetCaseName( NomCas );
349 //=============================================================================
350 char* HOMARD_Iteration_i::GetCaseName()
352 ASSERT( myHomardIteration );
353 return CORBA::string_dup( myHomardIteration->GetCaseName().c_str() );
355 //=============================================================================
356 void HOMARD_Iteration_i::AssociateHypo( const char* NomHypo )
358 ASSERT( myHomardIteration );
360 // Nom de l'iteration
361 char* IterName = GetName() ;
362 MESSAGE ( ". IterName = " << IterName );
363 return _gen_i->AssociateIterHypo(IterName, NomHypo) ;
365 //=============================================================================
366 void HOMARD_Iteration_i::SetHypoName( const char* NomHypo )
368 ASSERT( myHomardIteration );
369 myHomardIteration->SetHypoName( NomHypo );
371 //=============================================================================
372 char* HOMARD_Iteration_i::GetHypoName()
374 ASSERT( myHomardIteration );
375 return CORBA::string_dup( myHomardIteration->GetHypoName().c_str() );