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