]> SALOME platform Git repositories - modules/homard.git/blob - src/HOMARD/HOMARD_Iteration.cxx
Salome HOME
version 5_1_4 HOMARD_SRC
[modules/homard.git] / src / HOMARD / HOMARD_Iteration.cxx
1 //  HOMARD HOMARD : implementation of HOMARD idl descriptions
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //
24 //  File   : HOMARD_Iteration.cxx
25 //  Author : Paul RASCLE, EDF
26 //  Module : HOMARD
27
28 #include "HOMARD_Iteration.hxx"
29 #include "utilities.h"
30
31 //=============================================================================
32 /*!
33  *  default constructor:
34  */
35 //=============================================================================
36 HOMARD_Iteration::HOMARD_Iteration():
37   _NomIter( "" ), _Etat( false ),
38  _NumIter( -1 ),
39   _NomMesh( "" ), _MeshFile( "" ),
40   _FieldFile( "" ), _TimeStep( 0 ), _Rank( 0 ),
41   _MessFile( "" ),
42   _IterParent( "" ),
43   _NomHypo( "" ), _NomCas( "" ), _NomDir( "" )
44 {
45   MESSAGE("HOMARD_Iter");
46 }
47
48 //=============================================================================
49 /*!
50  *
51  */
52 //=============================================================================
53 HOMARD_Iteration::~HOMARD_Iteration()
54 {
55   MESSAGE("~HOMARD_Iteration");
56 }
57
58 //=============================================================================
59 /*!
60  *
61  */
62 //=============================================================================
63 bool HOMARD_Iteration::Compute()
64 {
65   MESSAGE("Compute --> ne fait rien");
66   _Etat=true;
67   return true;
68 }
69
70 //=============================================================================
71 /*!
72 */
73 //=============================================================================
74 void HOMARD_Iteration::SetName( const char* NomIter )
75 {
76   _NomIter = std::string( NomIter );
77 }
78
79 //=============================================================================
80 /*!
81 */
82 //=============================================================================
83 std::string HOMARD_Iteration::GetName() const
84 {
85   return _NomIter;
86 }
87
88 //=============================================================================
89 /*!
90 */
91 //=============================================================================
92 std::string HOMARD_Iteration::GetDumpPython() const
93 {
94   if (_IterParent == "") return std::string(" ") ;   // Pas de creation explicite de iteration 0";
95
96   std::ostringstream aScript;
97   aScript << "\n# Creation of the iteration " << _NomIter << "\n";
98   if( _NumIter == 1 )
99   {
100        aScript << "\t" << _NomIter << " = homard.CreateIteration('";
101        aScript <<  _NomIter << "', "<<  _NomCas << ".GetIter0Name() )\n";
102   }
103    else
104   {
105        aScript << "\t" << _NomIter << " = homard.CreateIteration('";
106        aScript <<  _NomIter << "', '" << _IterParent << "')\n";
107   }
108 // Le nom du maillage produit
109   aScript << "\t" << _NomIter << ".SetMeshName('" << _NomMesh << "')\n" ;
110 // Le fichier du maillage produit
111   aScript << "\t" << _NomIter << ".SetMeshFile('" << _MeshFile << "')\n";
112   if (_FieldFile != "") {
113     aScript << "\t" << _NomIter << ".SetFieldFile('" << _FieldFile << "')\n";
114     aScript << "\t" << _NomIter << ".SetTimeStepRank(" << _Rank << ", " << _TimeStep << ")\n";
115   }
116
117   aScript << "\thomard.AssociateIterHypo('" <<_NomIter << "', '" << _NomHypo << "')\n";
118   if (_Etat == true)
119   {
120      aScript << "\tresult = homard.Compute('" <<_NomIter << "', 1)\n";
121   }
122   else
123   {
124      aScript << "\t# result = homard.Compute('" <<_NomIter << "', 1)\n";
125   }
126
127   return aScript.str();
128 }
129 //=============================================================================
130 /*!
131 */
132 //=============================================================================
133 void HOMARD_Iteration::SetEtat( bool etat )
134 {
135   _Etat = etat;
136 }
137
138 //=============================================================================
139 /*!
140 */
141 //=============================================================================
142 bool HOMARD_Iteration::GetEtat() const
143 {
144   return _Etat;
145 }
146
147 //=============================================================================
148 /*!
149 */
150 //=============================================================================
151 void HOMARD_Iteration::SetNumber( int NumIter )
152 {
153   _NumIter = NumIter;
154 }
155
156 //=============================================================================
157 /*!
158 */
159 //=============================================================================
160 int HOMARD_Iteration::GetNumber() const
161 {
162   return _NumIter;
163 }
164
165 //=============================================================================
166 /*!
167 */
168 //=============================================================================
169 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
170 {
171   _NomMesh = std::string( NomMesh );
172 }
173
174 //=============================================================================
175 /*!
176 */
177 //=============================================================================
178 std::string HOMARD_Iteration::GetMeshName() const
179 {
180   return _NomMesh;
181 }
182
183 //=============================================================================
184 /*!
185 */
186 //=============================================================================
187 void HOMARD_Iteration::SetIterParent( const char* IterParent )
188 {
189   _IterParent = IterParent;
190 }
191
192 //=============================================================================
193 /*!
194 */
195 //=============================================================================
196 std::string HOMARD_Iteration::GetIterParent() const
197 {
198   return _IterParent;
199 }
200
201 //=============================================================================
202 /*!
203 */
204 //=============================================================================
205 void HOMARD_Iteration::AddIteration( const char* NomIteration )
206 {
207   _mesIterFilles.push_back( std::string( NomIteration ) );
208 }
209
210 //=============================================================================
211 /*!
212 */
213 //=============================================================================
214 const std::list<std::string>& HOMARD_Iteration::GetIterations() const
215 {
216   return _mesIterFilles;
217 }
218
219 //=============================================================================
220 /*!
221 */
222 //=============================================================================
223 void HOMARD_Iteration::SupprIterations()
224 {
225   _mesIterFilles.clear();
226 }
227
228 //=============================================================================
229 /*!
230 */
231 //=============================================================================
232 void HOMARD_Iteration::SetHypoName( const char* NomHypo )
233 {
234   _NomHypo = std::string( NomHypo );
235 }
236
237 //=============================================================================
238 /*!
239 */
240 //=============================================================================
241 std::string HOMARD_Iteration::GetHypoName() const
242 {
243   return _NomHypo;
244 }
245
246 //=============================================================================
247 /*!
248 */
249 //=============================================================================
250 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
251 {
252   _MeshFile = std::string( MeshFile );
253 }
254
255 //=============================================================================
256 /*!
257 */
258 //=============================================================================
259 std::string HOMARD_Iteration::GetMeshFile() const
260 {
261   return _MeshFile;
262 }
263
264 //=============================================================================
265 /*!
266 */
267 //=============================================================================
268 void HOMARD_Iteration::SetFieldFile( const char* FieldFile )
269 {
270   _FieldFile = std::string( FieldFile );
271 }
272 //=============================================================================
273 std::string HOMARD_Iteration::GetFieldFile() const
274 {
275   return _FieldFile;
276 }
277
278 //=============================================================================
279 /*!
280 */
281 //=============================================================================
282 void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank )
283 {
284   _TimeStep = TimeStep;
285   _Rank = Rank;
286 }
287 //=============================================================================
288 int HOMARD_Iteration::GetTimeStep() const
289 {
290   return _TimeStep;
291 }
292 //=============================================================================
293 int HOMARD_Iteration::GetRank() const
294 {
295   return _Rank;
296 }
297
298 //=============================================================================
299 /*!
300 */
301 //=============================================================================
302 void HOMARD_Iteration::SetCaseName( const char* NomCas )
303 {
304   _NomCas = std::string( NomCas );
305 }
306
307 //=============================================================================
308 /*!
309 */
310 //=============================================================================
311 std::string HOMARD_Iteration::GetCaseName() const
312 {
313   return _NomCas;
314 }
315 //=============================================================================
316 /*!
317 */
318 //=============================================================================
319 void HOMARD_Iteration::SetDirName( const char* NomDir )
320 {
321   _NomDir = std::string( NomDir );
322 }
323 //=============================================================================
324 /*!
325 */
326 //=============================================================================
327 std::string HOMARD_Iteration::GetDirName() const
328 {
329    return _NomDir;
330 }
331 /*!
332 */
333 //=============================================================================
334 void HOMARD_Iteration::SetMessFile( const char* MessFile )
335 {
336   _MessFile = std::string( MessFile );
337 }
338
339 //=============================================================================
340 /*!
341 */
342 //=============================================================================
343 std::string HOMARD_Iteration::GetMessFile() const
344 {
345   return _MessFile;
346 }