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::SetDirNameLoc( const char* NomDir )
117 ASSERT( myHomardIteration );
118 myHomardIteration->SetDirNameLoc( NomDir );
120 //=============================================================================
121 char* HOMARD_Iteration_i::GetDirNameLoc()
123 ASSERT( myHomardIteration );
124 return CORBA::string_dup( myHomardIteration->GetDirNameLoc().c_str() );
126 //=============================================================================
127 char* HOMARD_Iteration_i::GetDirName()
129 ASSERT( myHomardIteration );
130 std::string casename = myHomardIteration->GetCaseName() ;
131 HOMARD::HOMARD_Cas_ptr caseiter = _gen_i->GetCase(casename.c_str()) ;
132 std::string dirnamecase = caseiter->GetDirName() ;
133 std::string dirname = dirnamecase + "/" + GetDirNameLoc() ;
134 return CORBA::string_dup( dirname.c_str() );
136 //=============================================================================
137 void HOMARD_Iteration_i::SetNumber( CORBA::Long NumIter )
139 ASSERT( myHomardIteration );
140 myHomardIteration->SetNumber( NumIter );
142 //=============================================================================
143 CORBA::Long HOMARD_Iteration_i::GetNumber()
145 ASSERT( myHomardIteration );
146 return myHomardIteration->GetNumber() ;
148 //=============================================================================
149 void HOMARD_Iteration_i::SetState( CORBA::Long Etat )
151 ASSERT( myHomardIteration );
152 myHomardIteration->SetState( Etat );
154 //=============================================================================
155 CORBA::Long HOMARD_Iteration_i::GetState()
157 ASSERT( myHomardIteration );
158 return myHomardIteration->GetState() ;
160 //=============================================================================
161 void HOMARD_Iteration_i::SetMeshName( const char* NomMesh )
163 ASSERT( myHomardIteration );
164 myHomardIteration->SetMeshName( NomMesh );
166 //=============================================================================
167 char* HOMARD_Iteration_i::GetMeshName()
169 ASSERT( myHomardIteration );
170 return CORBA::string_dup( myHomardIteration->GetMeshName().c_str() );
172 //=============================================================================
173 void HOMARD_Iteration_i::SetMeshFile( const char* MeshFile )
175 ASSERT( myHomardIteration );
176 myHomardIteration->SetMeshFile( MeshFile );
178 //=============================================================================
179 char* HOMARD_Iteration_i::GetMeshFile()
181 ASSERT( myHomardIteration );
182 return CORBA::string_dup( myHomardIteration->GetMeshFile().c_str() );
184 //=============================================================================
185 void HOMARD_Iteration_i::SetFieldFile( const char* FieldFile )
187 ASSERT( myHomardIteration );
188 myHomardIteration->SetFieldFile( FieldFile );
190 //=============================================================================
191 char* HOMARD_Iteration_i::GetFieldFile()
193 ASSERT( myHomardIteration );
194 return CORBA::string_dup( myHomardIteration->GetFieldFile().c_str() );
196 //=============================================================================
197 void HOMARD_Iteration_i::SetTimeStepRank( CORBA::Long TimeStep, CORBA::Long Rank )
199 ASSERT( myHomardIteration );
200 myHomardIteration->SetTimeStepRank( TimeStep, Rank );
202 //=============================================================================
203 void HOMARD_Iteration_i::SetTimeStepRankLast()
205 ASSERT( myHomardIteration );
206 myHomardIteration->SetTimeStepRankLast();
208 //=============================================================================
209 CORBA::Long HOMARD_Iteration_i::GetTimeStep()
211 ASSERT( myHomardIteration );
212 return CORBA::Long( myHomardIteration->GetTimeStep() );
214 //=============================================================================
215 CORBA::Long HOMARD_Iteration_i::GetRank()
217 ASSERT( myHomardIteration );
218 return CORBA::Long( myHomardIteration->GetRank() );
220 //=============================================================================
221 void HOMARD_Iteration_i::SetLogFile( const char* LogFile )
223 ASSERT( myHomardIteration );
224 myHomardIteration->SetLogFile( LogFile );
226 //=============================================================================
227 char* HOMARD_Iteration_i::GetLogFile()
229 ASSERT( myHomardIteration );
230 return CORBA::string_dup( myHomardIteration->GetLogFile().c_str() );
232 //=============================================================================
233 CORBA::Long HOMARD_Iteration_i::Compute(CORBA::Long etatMenage, CORBA::Long Option)
235 MESSAGE ( "Compute : calcul d'une iteration"<<", Option = "<<Option );
236 ASSERT( myHomardIteration );
238 // Nom de l'iteration
239 char* IterName = GetName() ;
240 CORBA::Long modeHOMARD = 1 ;
241 CORBA::Long Option1 = 1 ;
242 MESSAGE ( "Compute : calcul de l'teration " << IterName );
243 return _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option1, Option) ;
245 //=============================================================================
246 void HOMARD_Iteration_i::MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte)
248 MESSAGE ( "MeshInfo : information sur le maillage associe a une iteration" );
249 ASSERT( myHomardIteration );
252 MeshInfoOption( Qual, Diam, Conn, Tail, Inte, Option ) ;
256 //=============================================================================
257 void HOMARD_Iteration_i::MeshInfoOption(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte, CORBA::Long Option)
259 MESSAGE ( "MeshInfoOption : information sur le maillage associe a une iteration" );
260 ASSERT( myHomardIteration );
262 // Nom de l'iteration
263 char* IterName = GetName() ;
264 CORBA::Long etatMenage = -1 ;
265 CORBA::Long modeHOMARD = 7 ;
266 if ( Qual != 0 ) { modeHOMARD = modeHOMARD*5 ; }
267 if ( Diam != 0 ) { modeHOMARD = modeHOMARD*19 ; }
268 if ( Conn != 0 ) { modeHOMARD = modeHOMARD*11 ; }
269 if ( Tail != 0 ) { modeHOMARD = modeHOMARD*13 ; }
270 if ( Inte != 0 ) { modeHOMARD = modeHOMARD*3 ; }
271 MESSAGE ( "MeshInfoOption : information sur le maillage de l'iteration " << IterName );
272 CORBA::Long Option2 = 1 ;
273 CORBA::Long codret = _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option, Option2) ;
274 MESSAGE ( "MeshInfoOption : codret = " << codret );
278 //=============================================================================
279 void HOMARD_Iteration_i::SetFileInfo( const char* FileInfo )
281 ASSERT( myHomardIteration );
282 myHomardIteration->SetFileInfo( FileInfo );
284 //=============================================================================
285 char* HOMARD_Iteration_i::GetFileInfo()
287 ASSERT( myHomardIteration );
288 return CORBA::string_dup( myHomardIteration->GetFileInfo().c_str() );
290 //=============================================================================
291 //=============================================================================
292 // Liens avec les autres iterations
293 //=============================================================================
294 //=============================================================================
295 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::NextIteration( const char* IterName )
297 // Nom de l'iteration parent
298 char* NomIterParent = GetName() ;
299 MESSAGE ( "NextIteration : creation de l'iteration " << IterName << " comme fille de " << NomIterParent );
300 return _gen_i->CreateIteration(IterName, NomIterParent) ;
302 //=============================================================================
303 void HOMARD_Iteration_i::LinkNextIteration( const char* NomIteration )
305 ASSERT( myHomardIteration );
306 myHomardIteration->LinkNextIteration( NomIteration );
308 //=============================================================================
309 void HOMARD_Iteration_i::UnLinkNextIteration( const char* NomIteration )
311 ASSERT( myHomardIteration );
312 myHomardIteration->UnLinkNextIteration( NomIteration );
314 //=============================================================================
315 HOMARD::listeIterFilles* HOMARD_Iteration_i::GetIterations()
317 ASSERT( myHomardIteration );
318 const std::list<std::string>& maListe = myHomardIteration->GetIterations();
319 HOMARD::listeIterFilles_var aResult = new HOMARD::listeIterFilles;
320 aResult->length( maListe.size() );
321 std::list<std::string>::const_iterator it;
323 for ( it = maListe.begin(); it != maListe.end(); it++ )
325 aResult[i++] = CORBA::string_dup( (*it).c_str() );
327 return aResult._retn();
329 //=============================================================================
330 void HOMARD_Iteration_i::SetIterParentName( const char* NomIterParent )
332 ASSERT( myHomardIteration );
333 myHomardIteration->SetIterParentName( NomIterParent );
335 //=============================================================================
336 char* HOMARD_Iteration_i::GetIterParentName()
338 ASSERT( myHomardIteration );
339 return CORBA::string_dup( myHomardIteration->GetIterParentName().c_str() );
341 //=============================================================================
342 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::GetIterParent()
344 // Nom de l'iteration parent
345 char* NomIterParent = GetIterParentName() ;
346 MESSAGE ( "GetIterParent : NomIterParent = " << NomIterParent );
347 return _gen_i->GetIteration(NomIterParent) ;
349 //=============================================================================
350 //=============================================================================
351 // Liens avec les autres structures
352 //=============================================================================
353 //=============================================================================
354 void HOMARD_Iteration_i::SetCaseName( const char* NomCas )
356 ASSERT( myHomardIteration );
357 myHomardIteration->SetCaseName( NomCas );
359 //=============================================================================
360 char* HOMARD_Iteration_i::GetCaseName()
362 ASSERT( myHomardIteration );
363 return CORBA::string_dup( myHomardIteration->GetCaseName().c_str() );
365 //=============================================================================
366 void HOMARD_Iteration_i::AssociateHypo( const char* NomHypo )
368 ASSERT( myHomardIteration );
370 // Nom de l'iteration
371 char* IterName = GetName() ;
372 MESSAGE ( ". IterName = " << IterName );
373 return _gen_i->AssociateIterHypo(IterName, NomHypo) ;
375 //=============================================================================
376 void HOMARD_Iteration_i::SetHypoName( const char* NomHypo )
378 ASSERT( myHomardIteration );
379 myHomardIteration->SetHypoName( NomHypo );
381 //=============================================================================
382 char* HOMARD_Iteration_i::GetHypoName()
384 ASSERT( myHomardIteration );
385 return CORBA::string_dup( myHomardIteration->GetHypoName().c_str() );