Salome HOME
Selection of the last time step; Back to the current directory after a computation...
[modules/homard.git] / src / HOMARD_I / HOMARD_Iteration_i.cxx
1 // Copyright (C) 2011-2012  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Remarques :
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
25 //
26 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
27 //
28
29 #include "HOMARD_Iteration_i.hxx"
30 #include "HOMARD_Gen_i.hxx"
31 #include "HOMARD_Iteration.hxx"
32 #include "HOMARD_DriverTools.hxx"
33
34 #include "SALOMEDS_Tool.hxx"
35
36 #include "utilities.h"
37
38 //=============================================================================
39 /*!
40  *  standard constructor
41  */
42 //=============================================================================
43 HOMARD_Iteration_i::HOMARD_Iteration_i()
44 {
45   MESSAGE( "Default constructor, not for use" );
46   ASSERT( 0 );
47 }
48
49 //=============================================================================
50 /*!
51  *  standard constructor
52  */
53 //=============================================================================
54 HOMARD_Iteration_i::HOMARD_Iteration_i( CORBA::ORB_ptr orb,
55                                         HOMARD::HOMARD_Gen_var engine )
56 {
57   MESSAGE("constructor");
58   _gen_i = engine;
59   _orb = orb;
60   myHomardIteration = new ::HOMARD_Iteration();
61   ASSERT( myHomardIteration );
62 }
63
64 //=============================================================================
65 /*!
66  *  standard destructor
67  */
68 //=============================================================================
69 HOMARD_Iteration_i::~HOMARD_Iteration_i()
70 {
71 }
72 //=============================================================================
73 //=============================================================================
74 // Generalites
75 //=============================================================================
76 //=============================================================================
77 void HOMARD_Iteration_i::SetName( const char* Name )
78 {
79   ASSERT( myHomardIteration );
80   myHomardIteration->SetName( Name );
81 }
82 //=============================================================================
83 char* HOMARD_Iteration_i::GetName()
84 {
85   ASSERT( myHomardIteration );
86   return CORBA::string_dup( myHomardIteration->GetName().c_str() );
87 }
88 //=============================================================================
89 CORBA::Long  HOMARD_Iteration_i::Delete()
90 {
91   ASSERT( myHomardIteration );
92   char* IterName = GetName() ;
93   MESSAGE ( "Delete : destruction de l'iteration " << IterName );
94   return _gen_i->DeleteIteration(IterName) ;
95 }
96 //=============================================================================
97 char* HOMARD_Iteration_i::GetDumpPython()
98 {
99   ASSERT( myHomardIteration );
100   return CORBA::string_dup( myHomardIteration->GetDumpPython().c_str() );
101 }
102 //=============================================================================
103 std::string HOMARD_Iteration_i::Dump() const
104 {
105   return HOMARD::Dump( *myHomardIteration );
106 }
107 //=============================================================================
108 bool HOMARD_Iteration_i::Restore( const std::string& stream )
109 {
110   return HOMARD::Restore( *myHomardIteration, stream );
111 }
112 //=============================================================================
113 //=============================================================================
114 // Caracteristiques
115 //=============================================================================
116 //=============================================================================
117 void HOMARD_Iteration_i::SetDirName( const char* NomDir )
118 {
119   ASSERT( myHomardIteration );
120   myHomardIteration->SetDirName( NomDir );
121 }
122 //=============================================================================
123 char* HOMARD_Iteration_i::GetDirName()
124 {
125   ASSERT( myHomardIteration );
126   return CORBA::string_dup( myHomardIteration->GetDirName().c_str() );
127 }
128 //=============================================================================
129 void HOMARD_Iteration_i::SetNumber( CORBA::Long NumIter )
130 {
131   ASSERT( myHomardIteration );
132   myHomardIteration->SetNumber( NumIter );
133 }
134 //=============================================================================
135 CORBA::Long HOMARD_Iteration_i::GetNumber()
136 {
137   ASSERT( myHomardIteration );
138   return  myHomardIteration->GetNumber() ;
139 }
140 //=============================================================================
141 void HOMARD_Iteration_i::SetEtat( CORBA::Boolean Etat )
142 {
143   ASSERT( myHomardIteration );
144   myHomardIteration->SetEtat( Etat );
145 }
146 //=============================================================================
147 CORBA::Boolean HOMARD_Iteration_i::GetEtat()
148 {
149   ASSERT( myHomardIteration );
150   return CORBA::Boolean( myHomardIteration->GetEtat());
151 }
152 //=============================================================================
153 void HOMARD_Iteration_i::SetMeshName( const char* NomMesh )
154 {
155   ASSERT( myHomardIteration );
156   myHomardIteration->SetMeshName( NomMesh );
157 }
158 //=============================================================================
159 char* HOMARD_Iteration_i::GetMeshName()
160 {
161   ASSERT( myHomardIteration );
162   return CORBA::string_dup( myHomardIteration->GetMeshName().c_str() );
163 }
164 //=============================================================================
165 void HOMARD_Iteration_i::SetMeshFile( const char* MeshFile )
166 {
167   ASSERT( myHomardIteration );
168   myHomardIteration->SetMeshFile( MeshFile );
169 }
170 //=============================================================================
171 char* HOMARD_Iteration_i::GetMeshFile()
172 {
173   ASSERT( myHomardIteration );
174   return CORBA::string_dup( myHomardIteration->GetMeshFile().c_str() );
175 }
176 //=============================================================================
177 void HOMARD_Iteration_i::SetFieldFile( const char* FieldFile )
178 {
179   ASSERT( myHomardIteration );
180   myHomardIteration->SetFieldFile( FieldFile );
181 }
182 //=============================================================================
183 char* HOMARD_Iteration_i::GetFieldFile()
184 {
185   ASSERT( myHomardIteration );
186   return CORBA::string_dup( myHomardIteration->GetFieldFile().c_str() );
187 }
188 //=============================================================================
189 void HOMARD_Iteration_i::SetTimeStepRank( CORBA::Long TimeStep, CORBA::Long Rank )
190 {
191   ASSERT( myHomardIteration );
192   myHomardIteration->SetTimeStepRank( TimeStep, Rank );
193 }
194 //=============================================================================
195 void HOMARD_Iteration_i::SetTimeStepRankLast()
196 {
197   ASSERT( myHomardIteration );
198   myHomardIteration->SetTimeStepRankLast();
199 }
200 //=============================================================================
201 CORBA::Long HOMARD_Iteration_i::GetTimeStep()
202 {
203   ASSERT( myHomardIteration );
204   return  CORBA::Long( myHomardIteration->GetTimeStep() );
205 }
206 //=============================================================================
207 CORBA::Long HOMARD_Iteration_i::GetRank()
208 {
209   ASSERT( myHomardIteration );
210   return  CORBA::Long( myHomardIteration->GetRank() );
211 }
212 //=============================================================================
213 void HOMARD_Iteration_i::SetMessFile( const char* MessFile )
214 {
215   ASSERT( myHomardIteration );
216   myHomardIteration->SetMessFile( MessFile );
217 }
218 //=============================================================================
219 char* HOMARD_Iteration_i::GetMessFile()
220 {
221   ASSERT( myHomardIteration );
222   return CORBA::string_dup( myHomardIteration->GetMessFile().c_str() );
223 }
224 //=============================================================================
225 CORBA::Long  HOMARD_Iteration_i::Compute(CORBA::Long etatMenage)
226 {
227   MESSAGE ( "Compute : calcul d'une iteration" );
228   ASSERT( myHomardIteration );
229 //
230 // Nom de l'iteration
231   char* IterName = GetName() ;
232   MESSAGE ( "Compute : calcul de l'teration " << IterName );
233   return _gen_i->Compute(IterName, etatMenage) ;
234 }
235 //=============================================================================
236 //=============================================================================
237 // Liens avec les autres iterations
238 //=============================================================================
239 //=============================================================================
240 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::NextIteration( const char* IterName )
241 {
242 // Nom de l'iteration parent
243   char* NomIterParent = GetName() ;
244   MESSAGE ( "NextIteration : creation de l'iteration " << IterName << " comme fille de " << NomIterParent );
245   return _gen_i->CreateIteration(IterName, NomIterParent) ;
246 }
247 //=============================================================================
248 void HOMARD_Iteration_i::LinkNextIteration( const char* NomIteration )
249 {
250   ASSERT( myHomardIteration );
251   myHomardIteration->LinkNextIteration( NomIteration );
252 }
253 //=============================================================================
254 void HOMARD_Iteration_i::UnLinkNextIteration( const char* NomIteration )
255 {
256   ASSERT( myHomardIteration );
257   myHomardIteration->UnLinkNextIteration( NomIteration );
258 }
259 //=============================================================================
260 HOMARD::listeIterFilles* HOMARD_Iteration_i::GetIterations()
261 {
262   ASSERT( myHomardIteration );
263   const std::list<std::string>& maListe = myHomardIteration->GetIterations();
264   HOMARD::listeIterFilles_var aResult = new HOMARD::listeIterFilles;
265   aResult->length( maListe.size() );
266   std::list<std::string>::const_iterator it;
267   int i = 0;
268   for ( it = maListe.begin(); it != maListe.end(); it++ )
269   {
270     aResult[i++] = CORBA::string_dup( (*it).c_str() );
271   }
272   return aResult._retn();
273 }
274 //=============================================================================
275 void HOMARD_Iteration_i::SetIterParentName( const char* NomIterParent )
276 {
277   ASSERT( myHomardIteration );
278   myHomardIteration->SetIterParentName( NomIterParent );
279 }
280 //=============================================================================
281 char* HOMARD_Iteration_i::GetIterParentName()
282 {
283   ASSERT( myHomardIteration );
284   return CORBA::string_dup( myHomardIteration->GetIterParentName().c_str() );
285 }
286 //=============================================================================
287 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::GetIterParent()
288 {
289 // Nom de l'iteration parent
290   char* NomIterParent = GetIterParentName() ;
291   MESSAGE ( "GetIterParent : NomIterParent = " << NomIterParent );
292   return _gen_i->GetIteration(NomIterParent) ;
293 }
294 //=============================================================================
295 //=============================================================================
296 // Liens avec les autres structures
297 //=============================================================================
298 //=============================================================================
299 void HOMARD_Iteration_i::SetCaseName( const char* NomCas )
300 {
301   ASSERT( myHomardIteration );
302   myHomardIteration->SetCaseName( NomCas );
303 }
304 //=============================================================================
305 char* HOMARD_Iteration_i::GetCaseName()
306 {
307   ASSERT( myHomardIteration );
308   return CORBA::string_dup( myHomardIteration->GetCaseName().c_str() );
309 }
310 //=============================================================================
311 void HOMARD_Iteration_i::AssociateHypo( const char* NomHypo )
312 {
313   ASSERT( myHomardIteration );
314 //
315 // Nom de l'iteration
316   char* IterName = GetName() ;
317   MESSAGE ( ". IterName = " << IterName );
318   return _gen_i->AssociateIterHypo(IterName, NomHypo) ;
319 }
320 //=============================================================================
321 void HOMARD_Iteration_i::SetHypoName( const char* NomHypo )
322 {
323   ASSERT( myHomardIteration );
324   myHomardIteration->SetHypoName( NomHypo );
325 }
326 //=============================================================================
327 char* HOMARD_Iteration_i::GetHypoName()
328 {
329   ASSERT( myHomardIteration );
330   return CORBA::string_dup( myHomardIteration->GetHypoName().c_str() );
331 }