1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011-2012 CEA/DEN, EDF R&D
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.
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.
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
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : HOMARD_Iteration.cxx
22 // Author : Paul RASCLE, EDF
25 #include "HOMARD_Iteration.hxx"
26 #include "utilities.h"
28 //=============================================================================
30 * default constructor:
32 //=============================================================================
33 HOMARD_Iteration::HOMARD_Iteration():
34 _NomIter( "" ), _Etat( false ),
36 _NomMesh( "" ), _MeshFile( "" ),
37 _FieldFile( "" ), _TimeStep( 0 ), _Rank( 0 ),
40 _NomHypo( "" ), _NomCas( "" ), _NomDir( "" )
42 MESSAGE("HOMARD_Iter");
45 //=============================================================================
49 //=============================================================================
50 HOMARD_Iteration::~HOMARD_Iteration()
52 MESSAGE("~HOMARD_Iteration");
55 //=============================================================================
58 //=============================================================================
59 void HOMARD_Iteration::SetName( const char* NomIter )
61 _NomIter = std::string( NomIter );
64 //=============================================================================
67 //=============================================================================
68 std::string HOMARD_Iteration::GetName() const
73 //=============================================================================
76 //=============================================================================
77 std::string HOMARD_Iteration::GetDumpPython() const
79 if (_IterParent == "") return std::string(" ") ; // Pas de creation explicite de iteration 0";
81 std::ostringstream aScript;
82 aScript << "\n# Creation of the iteration " << _NomIter << "\n";
85 aScript << "\t" << _NomIter << " = homard.CreateIteration(\"";
86 aScript << _NomIter << "\", "<< _NomCas << ".GetIter0Name() )\n";
90 aScript << "\t" << _NomIter << " = homard.CreateIteration(\"";
91 aScript << _NomIter << "\", \"" << _IterParent << "\")\n";
93 // Le nom du maillage produit
94 aScript << "\t" << _NomIter << ".SetMeshName(\"" << _NomMesh << "\")\n" ;
95 // Le fichier du maillage produit
96 aScript << "\t" << _NomIter << ".SetMeshFile(\"" << _MeshFile << "\")\n";
97 if (_FieldFile != "") {
98 aScript << "\t" << _NomIter << ".SetFieldFile(\"" << _FieldFile << "\")\n";
99 aScript << "\tTimeStep = " << _TimeStep << "\n";
100 aScript << "\tRank = " << _Rank << "\n";
101 aScript << "\t" << _NomIter << ".SetTimeStepRank( TimeStep, Rank )\n";
104 aScript << "\thomard.AssociateIterHypo(\"" <<_NomIter << "\", \"" << _NomHypo << "\")\n";
107 aScript << "\tcodret = homard.Compute(\"" <<_NomIter << "\", 1)\n";
111 aScript << "\t#codret = homard.Compute(\"" <<_NomIter << "\", 1)\n";
114 return aScript.str();
116 //=============================================================================
119 //=============================================================================
120 void HOMARD_Iteration::SetEtat( bool etat )
125 //=============================================================================
128 //=============================================================================
129 bool HOMARD_Iteration::GetEtat() const
134 //=============================================================================
137 //=============================================================================
138 void HOMARD_Iteration::SetNumber( int NumIter )
143 //=============================================================================
146 //=============================================================================
147 int HOMARD_Iteration::GetNumber() const
152 //=============================================================================
155 //=============================================================================
156 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
158 _NomMesh = std::string( NomMesh );
161 //=============================================================================
164 //=============================================================================
165 std::string HOMARD_Iteration::GetMeshName() const
170 //=============================================================================
173 //=============================================================================
174 void HOMARD_Iteration::SetIterParent( const char* IterParent )
176 _IterParent = IterParent;
179 //=============================================================================
182 //=============================================================================
183 std::string HOMARD_Iteration::GetIterParent() const
188 //=============================================================================
191 //=============================================================================
192 void HOMARD_Iteration::AddIteration( const char* NomIteration )
194 _mesIterFilles.push_back( std::string( NomIteration ) );
197 //=============================================================================
200 //=============================================================================
201 const std::list<std::string>& HOMARD_Iteration::GetIterations() const
203 return _mesIterFilles;
206 //=============================================================================
209 //=============================================================================
210 void HOMARD_Iteration::SupprIterations()
212 _mesIterFilles.clear();
215 //=============================================================================
218 //=============================================================================
219 void HOMARD_Iteration::SetHypoName( const char* NomHypo )
221 _NomHypo = std::string( NomHypo );
224 //=============================================================================
227 //=============================================================================
228 std::string HOMARD_Iteration::GetHypoName() const
233 //=============================================================================
236 //=============================================================================
237 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
239 _MeshFile = std::string( MeshFile );
242 //=============================================================================
245 //=============================================================================
246 std::string HOMARD_Iteration::GetMeshFile() const
251 //=============================================================================
254 //=============================================================================
255 void HOMARD_Iteration::SetFieldFile( const char* FieldFile )
257 _FieldFile = std::string( FieldFile );
259 //=============================================================================
260 std::string HOMARD_Iteration::GetFieldFile() const
265 //=============================================================================
268 //=============================================================================
269 void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank )
271 _TimeStep = TimeStep;
274 //=============================================================================
275 int HOMARD_Iteration::GetTimeStep() const
279 //=============================================================================
280 int HOMARD_Iteration::GetRank() const
285 //=============================================================================
288 //=============================================================================
289 void HOMARD_Iteration::SetCaseName( const char* NomCas )
291 _NomCas = std::string( NomCas );
294 //=============================================================================
297 //=============================================================================
298 std::string HOMARD_Iteration::GetCaseName() const
302 //=============================================================================
305 //=============================================================================
306 void HOMARD_Iteration::SetDirName( const char* NomDir )
308 _NomDir = std::string( NomDir );
310 //=============================================================================
313 //=============================================================================
314 std::string HOMARD_Iteration::GetDirName() const
320 //=============================================================================
321 void HOMARD_Iteration::SetMessFile( const char* MessFile )
323 _MessFile = std::string( MessFile );
326 //=============================================================================
329 //=============================================================================
330 std::string HOMARD_Iteration::GetMessFile() const