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" );
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 );
64 //=============================================================================
68 //=============================================================================
69 HOMARD_Iteration_i::~HOMARD_Iteration_i()
72 //=============================================================================
73 //=============================================================================
75 //=============================================================================
76 //=============================================================================
77 void HOMARD_Iteration_i::SetName( const char* Name )
79 ASSERT( myHomardIteration );
80 myHomardIteration->SetName( Name );
82 //=============================================================================
83 char* HOMARD_Iteration_i::GetName()
85 ASSERT( myHomardIteration );
86 return CORBA::string_dup( myHomardIteration->GetName().c_str() );
88 //=============================================================================
89 CORBA::Long HOMARD_Iteration_i::Delete( CORBA::Long Option )
91 ASSERT( myHomardIteration );
92 char* IterName = GetName() ;
93 MESSAGE ( "Delete : destruction de l'iteration " << IterName << ", Option = " << Option );
94 return _gen_i->DeleteIteration(IterName, Option) ;
96 //=============================================================================
97 char* HOMARD_Iteration_i::GetDumpPython()
99 ASSERT( myHomardIteration );
100 return CORBA::string_dup( myHomardIteration->GetDumpPython().c_str() );
102 //=============================================================================
103 std::string HOMARD_Iteration_i::Dump() const
105 return HOMARD::Dump( *myHomardIteration );
107 //=============================================================================
108 bool HOMARD_Iteration_i::Restore( const std::string& stream )
110 return HOMARD::Restore( *myHomardIteration, stream );
112 //=============================================================================
113 //=============================================================================
115 //=============================================================================
116 //=============================================================================
117 void HOMARD_Iteration_i::SetDirName( const char* NomDir )
119 ASSERT( myHomardIteration );
120 myHomardIteration->SetDirName( NomDir );
122 //=============================================================================
123 char* HOMARD_Iteration_i::GetDirName()
125 ASSERT( myHomardIteration );
126 return CORBA::string_dup( myHomardIteration->GetDirName().c_str() );
128 //=============================================================================
129 void HOMARD_Iteration_i::SetNumber( CORBA::Long NumIter )
131 ASSERT( myHomardIteration );
132 myHomardIteration->SetNumber( NumIter );
134 //=============================================================================
135 CORBA::Long HOMARD_Iteration_i::GetNumber()
137 ASSERT( myHomardIteration );
138 return myHomardIteration->GetNumber() ;
140 //=============================================================================
141 void HOMARD_Iteration_i::SetEtat( CORBA::Boolean Etat )
143 ASSERT( myHomardIteration );
144 myHomardIteration->SetEtat( Etat );
146 //=============================================================================
147 CORBA::Boolean HOMARD_Iteration_i::GetEtat()
149 ASSERT( myHomardIteration );
150 return CORBA::Boolean( myHomardIteration->GetEtat());
152 //=============================================================================
153 void HOMARD_Iteration_i::SetMeshName( const char* NomMesh )
155 ASSERT( myHomardIteration );
156 myHomardIteration->SetMeshName( NomMesh );
158 //=============================================================================
159 char* HOMARD_Iteration_i::GetMeshName()
161 ASSERT( myHomardIteration );
162 return CORBA::string_dup( myHomardIteration->GetMeshName().c_str() );
164 //=============================================================================
165 void HOMARD_Iteration_i::SetMeshFile( const char* MeshFile )
167 ASSERT( myHomardIteration );
168 myHomardIteration->SetMeshFile( MeshFile );
170 //=============================================================================
171 char* HOMARD_Iteration_i::GetMeshFile()
173 ASSERT( myHomardIteration );
174 return CORBA::string_dup( myHomardIteration->GetMeshFile().c_str() );
176 //=============================================================================
177 void HOMARD_Iteration_i::SetFieldFile( const char* FieldFile )
179 ASSERT( myHomardIteration );
180 myHomardIteration->SetFieldFile( FieldFile );
182 //=============================================================================
183 char* HOMARD_Iteration_i::GetFieldFile()
185 ASSERT( myHomardIteration );
186 return CORBA::string_dup( myHomardIteration->GetFieldFile().c_str() );
188 //=============================================================================
189 void HOMARD_Iteration_i::SetTimeStepRank( CORBA::Long TimeStep, CORBA::Long Rank )
191 ASSERT( myHomardIteration );
192 myHomardIteration->SetTimeStepRank( TimeStep, Rank );
194 //=============================================================================
195 void HOMARD_Iteration_i::SetTimeStepRankLast()
197 ASSERT( myHomardIteration );
198 myHomardIteration->SetTimeStepRankLast();
200 //=============================================================================
201 CORBA::Long HOMARD_Iteration_i::GetTimeStep()
203 ASSERT( myHomardIteration );
204 return CORBA::Long( myHomardIteration->GetTimeStep() );
206 //=============================================================================
207 CORBA::Long HOMARD_Iteration_i::GetRank()
209 ASSERT( myHomardIteration );
210 return CORBA::Long( myHomardIteration->GetRank() );
212 //=============================================================================
213 void HOMARD_Iteration_i::SetLogFile( const char* LogFile )
215 ASSERT( myHomardIteration );
216 myHomardIteration->SetLogFile( LogFile );
218 //=============================================================================
219 char* HOMARD_Iteration_i::GetLogFile()
221 ASSERT( myHomardIteration );
222 return CORBA::string_dup( myHomardIteration->GetLogFile().c_str() );
224 //=============================================================================
225 CORBA::Long HOMARD_Iteration_i::Compute(CORBA::Long etatMenage)
227 MESSAGE ( "Compute : calcul d'une iteration" );
228 ASSERT( myHomardIteration );
230 // Nom de l'iteration
231 char* IterName = GetName() ;
232 CORBA::Long modeHOMARD = 1 ;
233 CORBA::Long Option = 1 ;
234 MESSAGE ( "Compute : calcul de l'teration " << IterName );
235 return _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option) ;
237 //=============================================================================
238 void HOMARD_Iteration_i::MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte)
240 MESSAGE ( "MeshInfo : information sur le maillage associe a une iteration" );
241 ASSERT( myHomardIteration );
244 MeshInfoOption( Qual, Diam, Conn, Tail, Inte, Option ) ;
248 //=============================================================================
249 void HOMARD_Iteration_i::MeshInfoOption(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte, CORBA::Long Option)
251 MESSAGE ( "MeshInfoOption : information sur le maillage associe a une iteration" );
252 ASSERT( myHomardIteration );
254 // Nom de l'iteration
255 char* IterName = GetName() ;
256 CORBA::Long etatMenage = -1 ;
257 CORBA::Long modeHOMARD = 7 ;
258 if ( Qual != 0 ) { modeHOMARD = modeHOMARD*5 ; }
259 if ( Diam != 0 ) { modeHOMARD = modeHOMARD*19 ; }
260 if ( Conn != 0 ) { modeHOMARD = modeHOMARD*11 ; }
261 if ( Tail != 0 ) { modeHOMARD = modeHOMARD*13 ; }
262 if ( Inte != 0 ) { modeHOMARD = modeHOMARD*3 ; }
263 MESSAGE ( "MeshInfoOption : information sur le maillage de l'iteration " << IterName );
264 CORBA::Long codret = _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option) ;
265 MESSAGE ( "MeshInfoOption : codret = " << codret );
269 //=============================================================================
270 void HOMARD_Iteration_i::SetFileInfo( const char* FileInfo )
272 ASSERT( myHomardIteration );
273 myHomardIteration->SetFileInfo( FileInfo );
275 //=============================================================================
276 char* HOMARD_Iteration_i::GetFileInfo()
278 ASSERT( myHomardIteration );
279 return CORBA::string_dup( myHomardIteration->GetFileInfo().c_str() );
281 //=============================================================================
282 //=============================================================================
283 // Liens avec les autres iterations
284 //=============================================================================
285 //=============================================================================
286 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::NextIteration( const char* IterName )
288 // Nom de l'iteration parent
289 char* NomIterParent = GetName() ;
290 MESSAGE ( "NextIteration : creation de l'iteration " << IterName << " comme fille de " << NomIterParent );
291 return _gen_i->CreateIteration(IterName, NomIterParent) ;
293 //=============================================================================
294 void HOMARD_Iteration_i::LinkNextIteration( const char* NomIteration )
296 ASSERT( myHomardIteration );
297 myHomardIteration->LinkNextIteration( NomIteration );
299 //=============================================================================
300 void HOMARD_Iteration_i::UnLinkNextIteration( const char* NomIteration )
302 ASSERT( myHomardIteration );
303 myHomardIteration->UnLinkNextIteration( NomIteration );
305 //=============================================================================
306 HOMARD::listeIterFilles* HOMARD_Iteration_i::GetIterations()
308 ASSERT( myHomardIteration );
309 const std::list<std::string>& maListe = myHomardIteration->GetIterations();
310 HOMARD::listeIterFilles_var aResult = new HOMARD::listeIterFilles;
311 aResult->length( maListe.size() );
312 std::list<std::string>::const_iterator it;
314 for ( it = maListe.begin(); it != maListe.end(); it++ )
316 aResult[i++] = CORBA::string_dup( (*it).c_str() );
318 return aResult._retn();
320 //=============================================================================
321 void HOMARD_Iteration_i::SetIterParentName( const char* NomIterParent )
323 ASSERT( myHomardIteration );
324 myHomardIteration->SetIterParentName( NomIterParent );
326 //=============================================================================
327 char* HOMARD_Iteration_i::GetIterParentName()
329 ASSERT( myHomardIteration );
330 return CORBA::string_dup( myHomardIteration->GetIterParentName().c_str() );
332 //=============================================================================
333 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::GetIterParent()
335 // Nom de l'iteration parent
336 char* NomIterParent = GetIterParentName() ;
337 MESSAGE ( "GetIterParent : NomIterParent = " << NomIterParent );
338 return _gen_i->GetIteration(NomIterParent) ;
340 //=============================================================================
341 //=============================================================================
342 // Liens avec les autres structures
343 //=============================================================================
344 //=============================================================================
345 void HOMARD_Iteration_i::SetCaseName( const char* NomCas )
347 ASSERT( myHomardIteration );
348 myHomardIteration->SetCaseName( NomCas );
350 //=============================================================================
351 char* HOMARD_Iteration_i::GetCaseName()
353 ASSERT( myHomardIteration );
354 return CORBA::string_dup( myHomardIteration->GetCaseName().c_str() );
356 //=============================================================================
357 void HOMARD_Iteration_i::AssociateHypo( const char* NomHypo )
359 ASSERT( myHomardIteration );
361 // Nom de l'iteration
362 char* IterName = GetName() ;
363 MESSAGE ( ". IterName = " << IterName );
364 return _gen_i->AssociateIterHypo(IterName, NomHypo) ;
366 //=============================================================================
367 void HOMARD_Iteration_i::SetHypoName( const char* NomHypo )
369 ASSERT( myHomardIteration );
370 myHomardIteration->SetHypoName( NomHypo );
372 //=============================================================================
373 char* HOMARD_Iteration_i::GetHypoName()
375 ASSERT( myHomardIteration );
376 return CORBA::string_dup( myHomardIteration->GetHypoName().c_str() );