1 // Copyright (C) 2011 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 #include "HOMARD_Iteration_i.hxx"
21 #include "HOMARD_Gen_i.hxx"
22 #include "HOMARD_Iteration.hxx"
23 #include "HOMARD_DriverTools.hxx"
25 #include "SALOMEDS_Tool.hxx"
27 #include "utilities.h"
29 //=============================================================================
31 * standard constructor
33 //=============================================================================
34 HOMARD_Iteration_i::HOMARD_Iteration_i()
36 MESSAGE( "Default constructor, not for use" );
40 //=============================================================================
42 * standard constructor
44 //=============================================================================
45 HOMARD_Iteration_i::HOMARD_Iteration_i( CORBA::ORB_ptr orb,
46 HOMARD::HOMARD_Gen_var engine )
48 MESSAGE("constructor");
51 myHomardIteration = new ::HOMARD_Iteration();
52 ASSERT( myHomardIteration );
55 //=============================================================================
59 //=============================================================================
60 HOMARD_Iteration_i::~HOMARD_Iteration_i()
64 //=============================================================================
67 //=============================================================================
68 void HOMARD_Iteration_i::SetName( const char* NomIter )
70 ASSERT( myHomardIteration );
71 myHomardIteration->SetName( NomIter );
74 //=============================================================================
75 char* HOMARD_Iteration_i::GetName()
77 ASSERT( myHomardIteration );
78 return CORBA::string_dup( myHomardIteration->GetName().c_str() );
81 //=============================================================================
82 char* HOMARD_Iteration_i::GetDumpPython()
84 ASSERT( myHomardIteration );
85 return CORBA::string_dup( myHomardIteration->GetDumpPython().c_str() );
88 //=============================================================================
89 void HOMARD_Iteration_i::SetEtat( CORBA::Boolean Etat )
91 ASSERT( myHomardIteration );
92 myHomardIteration->SetEtat( Etat );
95 //=============================================================================
96 CORBA::Boolean HOMARD_Iteration_i::GetEtat()
98 ASSERT( myHomardIteration );
99 return CORBA::Boolean( myHomardIteration->GetEtat());
102 //=============================================================================
103 void HOMARD_Iteration_i::SetNumber( CORBA::Long NumIter )
105 ASSERT( myHomardIteration );
106 myHomardIteration->SetNumber( NumIter );
109 //=============================================================================
110 CORBA::Long HOMARD_Iteration_i::GetNumber()
112 ASSERT( myHomardIteration );
113 return myHomardIteration->GetNumber() ;
116 //=============================================================================
117 void HOMARD_Iteration_i::SetMeshName( const char* NomMesh )
119 ASSERT( myHomardIteration );
120 myHomardIteration->SetMeshName( NomMesh );
123 //=============================================================================
124 char* HOMARD_Iteration_i::GetMeshName()
126 ASSERT( myHomardIteration );
127 return CORBA::string_dup( myHomardIteration->GetMeshName().c_str() );
130 //=============================================================================
131 char* HOMARD_Iteration_i::GetIterParent()
133 ASSERT( myHomardIteration );
134 return CORBA::string_dup( myHomardIteration->GetIterParent().c_str() );
138 //=============================================================================
139 HOMARD::listeIterFilles* HOMARD_Iteration_i::GetIterations()
141 ASSERT( myHomardIteration );
142 const std::list<std::string>& maListe = myHomardIteration->GetIterations();
143 HOMARD::listeIterFilles_var aResult = new HOMARD::listeIterFilles;
144 aResult->length( maListe.size() );
145 std::list<std::string>::const_iterator it;
147 for ( it = maListe.begin(); it != maListe.end(); it++ )
149 aResult[i++] = CORBA::string_dup( (*it).c_str() );
151 return aResult._retn();
154 //=============================================================================
155 void HOMARD_Iteration_i::SetIterParent( const char* NomIterParent )
157 ASSERT( myHomardIteration );
158 myHomardIteration->SetIterParent( NomIterParent );
161 //=============================================================================
162 void HOMARD_Iteration_i::AddIteration( const char* NomIter )
164 ASSERT( myHomardIteration );
165 myHomardIteration->AddIteration( NomIter );
168 //=============================================================================
169 CORBA::Long HOMARD_Iteration_i::Compute(CORBA::Long etatMenage)
171 MESSAGE ( "Compute : calcul d'une iteration" );
172 ASSERT( myHomardIteration );
174 // Nom de l'iteration
175 char* IterName = GetName() ;
176 MESSAGE ( ". IterName = " << IterName );
177 // B. Calcul : on passe par la methode sur l'objet HOMARD
178 // Il serait plus elegant de tout faire ici, mais il est complexe de paser tout le contexte
179 return _gen_i->Compute(IterName, etatMenage) ;
182 //=============================================================================
183 void HOMARD_Iteration_i::SetMeshFile( const char* MeshFile )
185 ASSERT( myHomardIteration );
186 myHomardIteration->SetMeshFile( MeshFile );
189 //=============================================================================
190 char* HOMARD_Iteration_i::GetMeshFile()
192 ASSERT( myHomardIteration );
193 return CORBA::string_dup( myHomardIteration->GetMeshFile().c_str() );
196 //=============================================================================
197 char* HOMARD_Iteration_i::GetCaseName()
199 ASSERT( myHomardIteration );
200 return CORBA::string_dup( myHomardIteration->GetCaseName().c_str() );
203 //=============================================================================
204 void HOMARD_Iteration_i::SetCaseName( const char* NomCas )
206 ASSERT( myHomardIteration );
207 myHomardIteration->SetCaseName( NomCas );
210 //=============================================================================
211 char* HOMARD_Iteration_i::GetDirName()
213 ASSERT( myHomardIteration );
214 return CORBA::string_dup( myHomardIteration->GetDirName().c_str() );
217 //=============================================================================
218 void HOMARD_Iteration_i::SetDirName( const char* NomDir )
220 ASSERT( myHomardIteration );
221 myHomardIteration->SetDirName( NomDir );
224 //=============================================================================
225 char* HOMARD_Iteration_i::GetHypoName()
227 ASSERT( myHomardIteration );
228 return CORBA::string_dup( myHomardIteration->GetHypoName().c_str() );
232 //=============================================================================
233 void HOMARD_Iteration_i::SetHypoName( const char* NomHypo )
235 ASSERT( myHomardIteration );
236 myHomardIteration->SetHypoName( NomHypo );
239 //=============================================================================
240 void HOMARD_Iteration_i::SetFieldFile( const char* FieldFile )
242 ASSERT( myHomardIteration );
243 myHomardIteration->SetFieldFile( FieldFile );
246 //=============================================================================
247 char* HOMARD_Iteration_i::GetFieldFile()
249 ASSERT( myHomardIteration );
250 return CORBA::string_dup( myHomardIteration->GetFieldFile().c_str() );
253 //=============================================================================
254 void HOMARD_Iteration_i::SetTimeStepRank( CORBA::Long TimeStep, CORBA::Long Rank )
256 ASSERT( myHomardIteration );
257 myHomardIteration->SetTimeStepRank( TimeStep, Rank );
260 //=============================================================================
261 CORBA::Long HOMARD_Iteration_i::GetTimeStep()
263 ASSERT( myHomardIteration );
264 return CORBA::Long( myHomardIteration->GetTimeStep() );
267 //=============================================================================
268 CORBA::Long HOMARD_Iteration_i::GetRank()
270 ASSERT( myHomardIteration );
271 return CORBA::Long( myHomardIteration->GetRank() );
274 //=============================================================================
275 void HOMARD_Iteration_i::SetMessFile( const char* MessFile )
277 ASSERT( myHomardIteration );
278 myHomardIteration->SetMessFile( MessFile );
281 //=============================================================================
282 char* HOMARD_Iteration_i::GetMessFile()
284 ASSERT( myHomardIteration );
285 return CORBA::string_dup( myHomardIteration->GetMessFile().c_str() );
287 //=============================================================================
288 std::string HOMARD_Iteration_i::Dump() const
290 return HOMARD::Dump( *myHomardIteration );
293 //=============================================================================
294 bool HOMARD_Iteration_i::Restore( const std::string& stream )
296 return HOMARD::Restore( *myHomardIteration, stream );