1 // Copyright (C) 2011-2012 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()
91 ASSERT( myHomardIteration );
92 char* IterName = GetName() ;
93 MESSAGE ( "Delete : destruction de l'iteration " << IterName );
94 return _gen_i->DeleteIteration(IterName) ;
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 CORBA::Long HOMARD_Iteration_i::GetTimeStep()
197 ASSERT( myHomardIteration );
198 return CORBA::Long( myHomardIteration->GetTimeStep() );
200 //=============================================================================
201 CORBA::Long HOMARD_Iteration_i::GetRank()
203 ASSERT( myHomardIteration );
204 return CORBA::Long( myHomardIteration->GetRank() );
206 //=============================================================================
207 void HOMARD_Iteration_i::SetMessFile( const char* MessFile )
209 ASSERT( myHomardIteration );
210 myHomardIteration->SetMessFile( MessFile );
212 //=============================================================================
213 char* HOMARD_Iteration_i::GetMessFile()
215 ASSERT( myHomardIteration );
216 return CORBA::string_dup( myHomardIteration->GetMessFile().c_str() );
218 //=============================================================================
219 CORBA::Long HOMARD_Iteration_i::Compute(CORBA::Long etatMenage)
221 MESSAGE ( "Compute : calcul d'une iteration" );
222 ASSERT( myHomardIteration );
224 // Nom de l'iteration
225 char* IterName = GetName() ;
226 MESSAGE ( "Compute : calcul de l'teration " << IterName );
227 return _gen_i->Compute(IterName, etatMenage) ;
229 //=============================================================================
230 //=============================================================================
231 // Liens avec les autres iterations
232 //=============================================================================
233 //=============================================================================
234 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::NextIteration( const char* IterName )
236 // Nom de l'iteration parent
237 char* NomIterParent = GetName() ;
238 MESSAGE ( "NextIteration : creation de l'iteration " << IterName << " comme fille de " << NomIterParent );
239 return _gen_i->CreateIteration(IterName, NomIterParent) ;
241 //=============================================================================
242 void HOMARD_Iteration_i::LinkNextIteration( const char* NomIteration )
244 ASSERT( myHomardIteration );
245 myHomardIteration->LinkNextIteration( NomIteration );
247 //=============================================================================
248 void HOMARD_Iteration_i::UnLinkNextIteration( const char* NomIteration )
250 ASSERT( myHomardIteration );
251 myHomardIteration->UnLinkNextIteration( NomIteration );
253 //=============================================================================
254 HOMARD::listeIterFilles* HOMARD_Iteration_i::GetIterations()
256 ASSERT( myHomardIteration );
257 const std::list<std::string>& maListe = myHomardIteration->GetIterations();
258 HOMARD::listeIterFilles_var aResult = new HOMARD::listeIterFilles;
259 aResult->length( maListe.size() );
260 std::list<std::string>::const_iterator it;
262 for ( it = maListe.begin(); it != maListe.end(); it++ )
264 aResult[i++] = CORBA::string_dup( (*it).c_str() );
266 return aResult._retn();
268 //=============================================================================
269 void HOMARD_Iteration_i::SetIterParentName( const char* NomIterParent )
271 ASSERT( myHomardIteration );
272 myHomardIteration->SetIterParentName( NomIterParent );
274 //=============================================================================
275 char* HOMARD_Iteration_i::GetIterParentName()
277 ASSERT( myHomardIteration );
278 return CORBA::string_dup( myHomardIteration->GetIterParentName().c_str() );
280 //=============================================================================
281 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::GetIterParent()
283 // Nom de l'iteration parent
284 char* NomIterParent = GetIterParentName() ;
285 MESSAGE ( "GetIterParent : NomIterParent = " << NomIterParent );
286 return _gen_i->GetIteration(NomIterParent) ;
288 //=============================================================================
289 //=============================================================================
290 // Liens avec les autres structures
291 //=============================================================================
292 //=============================================================================
293 void HOMARD_Iteration_i::SetCaseName( const char* NomCas )
295 ASSERT( myHomardIteration );
296 myHomardIteration->SetCaseName( NomCas );
298 //=============================================================================
299 char* HOMARD_Iteration_i::GetCaseName()
301 ASSERT( myHomardIteration );
302 return CORBA::string_dup( myHomardIteration->GetCaseName().c_str() );
304 //=============================================================================
305 void HOMARD_Iteration_i::AssociateHypo( const char* NomHypo )
307 ASSERT( myHomardIteration );
309 // Nom de l'iteration
310 char* IterName = GetName() ;
311 MESSAGE ( ". IterName = " << IterName );
312 return _gen_i->AssociateIterHypo(IterName, NomHypo) ;
314 //=============================================================================
315 void HOMARD_Iteration_i::SetHypoName( const char* NomHypo )
317 ASSERT( myHomardIteration );
318 myHomardIteration->SetHypoName( NomHypo );
320 //=============================================================================
321 char* HOMARD_Iteration_i::GetHypoName()
323 ASSERT( myHomardIteration );
324 return CORBA::string_dup( myHomardIteration->GetHypoName().c_str() );