Salome HOME
Merge from V6_main_20120808 08Aug12
[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
20 #include "HOMARD_Iteration_i.hxx"
21 #include "HOMARD_Gen_i.hxx"
22 #include "HOMARD_Iteration.hxx"
23 #include "HOMARD_DriverTools.hxx"
24
25 #include "SALOMEDS_Tool.hxx"
26
27 #include "utilities.h"
28
29 //=============================================================================
30 /*!
31  *  standard constructor
32  */
33 //=============================================================================
34 HOMARD_Iteration_i::HOMARD_Iteration_i()
35 {
36   MESSAGE( "Default constructor, not for use" );
37   ASSERT( 0 );
38 }
39
40 //=============================================================================
41 /*!
42  *  standard constructor
43  */
44 //=============================================================================
45 HOMARD_Iteration_i::HOMARD_Iteration_i( CORBA::ORB_ptr orb,
46                                         HOMARD::HOMARD_Gen_var engine )
47 {
48   MESSAGE("constructor");
49   _gen_i = engine;
50   _orb = orb;
51   myHomardIteration = new ::HOMARD_Iteration();
52   ASSERT( myHomardIteration );
53 }
54
55 //=============================================================================
56 /*!
57  *  standard destructor
58  */
59 //=============================================================================
60 HOMARD_Iteration_i::~HOMARD_Iteration_i()
61 {
62 }
63
64 //=============================================================================
65 /*!
66  */
67 //=============================================================================
68 void HOMARD_Iteration_i::SetName( const char* NomIter )
69 {
70   ASSERT( myHomardIteration );
71   myHomardIteration->SetName( NomIter );
72 }
73
74 //=============================================================================
75 char* HOMARD_Iteration_i::GetName()
76 {
77   ASSERT( myHomardIteration );
78   return CORBA::string_dup( myHomardIteration->GetName().c_str() );
79 }
80
81 //=============================================================================
82 char* HOMARD_Iteration_i::GetDumpPython()
83 {
84   ASSERT( myHomardIteration );
85   return CORBA::string_dup( myHomardIteration->GetDumpPython().c_str() );
86 }
87
88 //=============================================================================
89 void HOMARD_Iteration_i::SetEtat( CORBA::Boolean Etat )
90 {
91   ASSERT( myHomardIteration );
92   myHomardIteration->SetEtat( Etat );
93 }
94
95 //=============================================================================
96 CORBA::Boolean HOMARD_Iteration_i::GetEtat()
97 {
98   ASSERT( myHomardIteration );
99   return CORBA::Boolean( myHomardIteration->GetEtat());
100 }
101
102 //=============================================================================
103 void HOMARD_Iteration_i::SetNumber( CORBA::Long NumIter )
104 {
105   ASSERT( myHomardIteration );
106   myHomardIteration->SetNumber( NumIter );
107 }
108
109 //=============================================================================
110 CORBA::Long HOMARD_Iteration_i::GetNumber()
111 {
112   ASSERT( myHomardIteration );
113   return  myHomardIteration->GetNumber() ;
114 }
115
116 //=============================================================================
117 void HOMARD_Iteration_i::SetMeshName( const char* NomMesh )
118 {
119   ASSERT( myHomardIteration );
120   myHomardIteration->SetMeshName( NomMesh );
121 }
122
123 //=============================================================================
124 char* HOMARD_Iteration_i::GetMeshName()
125 {
126   ASSERT( myHomardIteration );
127   return CORBA::string_dup( myHomardIteration->GetMeshName().c_str() );
128 }
129
130 //=============================================================================
131 char* HOMARD_Iteration_i::GetIterParent()
132 {
133   ASSERT( myHomardIteration );
134   return CORBA::string_dup( myHomardIteration->GetIterParent().c_str() );
135
136 }
137
138 //=============================================================================
139 HOMARD::listeIterFilles* HOMARD_Iteration_i::GetIterations()
140 {
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;
146   int i = 0;
147   for ( it = maListe.begin(); it != maListe.end(); it++ )
148   {
149     aResult[i++] = CORBA::string_dup( (*it).c_str() );
150   }
151   return aResult._retn();
152 }
153
154 //=============================================================================
155 void HOMARD_Iteration_i::SetIterParent( const char* NomIterParent )
156 {
157   ASSERT( myHomardIteration );
158   myHomardIteration->SetIterParent( NomIterParent );
159 }
160
161 //=============================================================================
162 void HOMARD_Iteration_i::AddIteration( const char* NomIter )
163 {
164   ASSERT( myHomardIteration );
165   myHomardIteration->AddIteration( NomIter );
166 }
167
168 //=============================================================================
169 CORBA::Long  HOMARD_Iteration_i::Compute(CORBA::Long etatMenage)
170 {
171   MESSAGE ( "Compute : calcul d'une iteration" );
172   ASSERT( myHomardIteration );
173 //
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) ;
180 }
181
182 //=============================================================================
183 void HOMARD_Iteration_i::SetMeshFile( const char* MeshFile )
184 {
185   ASSERT( myHomardIteration );
186   myHomardIteration->SetMeshFile( MeshFile );
187 }
188
189 //=============================================================================
190 char* HOMARD_Iteration_i::GetMeshFile()
191 {
192   ASSERT( myHomardIteration );
193   return CORBA::string_dup( myHomardIteration->GetMeshFile().c_str() );
194 }
195
196 //=============================================================================
197 char* HOMARD_Iteration_i::GetCaseName()
198 {
199   ASSERT( myHomardIteration );
200   return CORBA::string_dup( myHomardIteration->GetCaseName().c_str() );
201 }
202
203 //=============================================================================
204 void HOMARD_Iteration_i::SetCaseName( const char* NomCas )
205 {
206   ASSERT( myHomardIteration );
207   myHomardIteration->SetCaseName( NomCas );
208 }
209
210 //=============================================================================
211 char* HOMARD_Iteration_i::GetDirName()
212 {
213   ASSERT( myHomardIteration );
214   return CORBA::string_dup( myHomardIteration->GetDirName().c_str() );
215 }
216
217 //=============================================================================
218 void HOMARD_Iteration_i::SetDirName( const char* NomDir )
219 {
220   ASSERT( myHomardIteration );
221   myHomardIteration->SetDirName( NomDir );
222 }
223
224 //=============================================================================
225 char* HOMARD_Iteration_i::GetHypoName()
226 {
227   ASSERT( myHomardIteration );
228   return CORBA::string_dup( myHomardIteration->GetHypoName().c_str() );
229
230 }
231
232 //=============================================================================
233 void HOMARD_Iteration_i::SetHypoName( const char* NomHypo )
234 {
235   ASSERT( myHomardIteration );
236   myHomardIteration->SetHypoName( NomHypo );
237 }
238
239 //=============================================================================
240 void HOMARD_Iteration_i::SetFieldFile( const char* FieldFile )
241 {
242   ASSERT( myHomardIteration );
243   myHomardIteration->SetFieldFile( FieldFile );
244 }
245
246 //=============================================================================
247 char* HOMARD_Iteration_i::GetFieldFile()
248 {
249   ASSERT( myHomardIteration );
250   return CORBA::string_dup( myHomardIteration->GetFieldFile().c_str() );
251 }
252
253 //=============================================================================
254 void HOMARD_Iteration_i::SetTimeStepRank( CORBA::Long TimeStep, CORBA::Long Rank )
255 {
256   ASSERT( myHomardIteration );
257   myHomardIteration->SetTimeStepRank( TimeStep, Rank );
258 }
259
260 //=============================================================================
261 CORBA::Long HOMARD_Iteration_i::GetTimeStep()
262 {
263   ASSERT( myHomardIteration );
264   return  CORBA::Long( myHomardIteration->GetTimeStep() );
265 }
266
267 //=============================================================================
268 CORBA::Long HOMARD_Iteration_i::GetRank()
269 {
270   ASSERT( myHomardIteration );
271   return  CORBA::Long( myHomardIteration->GetRank() );
272 }
273
274 //=============================================================================
275 void HOMARD_Iteration_i::SetMessFile( const char* MessFile )
276 {
277   ASSERT( myHomardIteration );
278   myHomardIteration->SetMessFile( MessFile );
279 }
280
281 //=============================================================================
282 char* HOMARD_Iteration_i::GetMessFile()
283 {
284   ASSERT( myHomardIteration );
285   return CORBA::string_dup( myHomardIteration->GetMessFile().c_str() );
286 }
287 //=============================================================================
288 std::string HOMARD_Iteration_i::Dump() const
289 {
290   return HOMARD::Dump( *myHomardIteration );
291 }
292
293 //=============================================================================
294 bool HOMARD_Iteration_i::Restore( const std::string& stream )
295 {
296   return HOMARD::Restore( *myHomardIteration, stream );
297 }