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( -1 ), _Rank( -1 ),
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 // Le fichier des champs, avec l'instant eventuel
98 if ( _FieldFile != "" ) {
99 aScript << "\t" << _NomIter << ".SetFieldFile(\"" << _FieldFile << "\")\n";
100 if ( ( _TimeStep != -1 ) and ( _Rank != -1 ) ) {
101 aScript << "\t" << _NomIter << ".SetTimeStepRank( " << _TimeStep << ", " << _Rank << " )\n";
105 aScript << "\thomard.AssociateIterHypo(\"" <<_NomIter << "\", \"" << _NomHypo << "\")\n";
108 aScript << "\tcodret = " <<_NomIter << ".Compute(1)\n";
112 aScript << "\t#codret = " <<_NomIter << ".Compute(1)\n";
115 return aScript.str();
117 //=============================================================================
120 //=============================================================================
121 void HOMARD_Iteration::SetEtat( bool etat )
126 //=============================================================================
129 //=============================================================================
130 bool HOMARD_Iteration::GetEtat() const
135 //=============================================================================
138 //=============================================================================
139 void HOMARD_Iteration::SetNumber( int NumIter )
144 //=============================================================================
147 //=============================================================================
148 int HOMARD_Iteration::GetNumber() const
153 //=============================================================================
156 //=============================================================================
157 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
159 _NomMesh = std::string( NomMesh );
162 //=============================================================================
165 //=============================================================================
166 std::string HOMARD_Iteration::GetMeshName() const
171 //=============================================================================
174 //=============================================================================
175 void HOMARD_Iteration::SetIterParent( const char* IterParent )
177 _IterParent = IterParent;
180 //=============================================================================
183 //=============================================================================
184 std::string HOMARD_Iteration::GetIterParent() const
189 //=============================================================================
192 //=============================================================================
193 void HOMARD_Iteration::AddIteration( const char* NomIteration )
195 _mesIterFilles.push_back( std::string( NomIteration ) );
198 //=============================================================================
201 //=============================================================================
202 const std::list<std::string>& HOMARD_Iteration::GetIterations() const
204 return _mesIterFilles;
207 //=============================================================================
210 //=============================================================================
211 void HOMARD_Iteration::SupprIterations()
213 _mesIterFilles.clear();
216 //=============================================================================
219 //=============================================================================
220 void HOMARD_Iteration::SetHypoName( const char* NomHypo )
222 _NomHypo = std::string( NomHypo );
225 //=============================================================================
228 //=============================================================================
229 std::string HOMARD_Iteration::GetHypoName() const
234 //=============================================================================
237 //=============================================================================
238 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
240 _MeshFile = std::string( MeshFile );
243 //=============================================================================
246 //=============================================================================
247 std::string HOMARD_Iteration::GetMeshFile() const
252 //=============================================================================
255 //=============================================================================
256 void HOMARD_Iteration::SetFieldFile( const char* FieldFile )
258 _FieldFile = std::string( FieldFile );
260 //=============================================================================
261 std::string HOMARD_Iteration::GetFieldFile() const
266 //=============================================================================
269 //=============================================================================
270 void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank )
272 _TimeStep = TimeStep;
275 //=============================================================================
276 int HOMARD_Iteration::GetTimeStep() const
280 //=============================================================================
281 int HOMARD_Iteration::GetRank() const
286 //=============================================================================
289 //=============================================================================
290 void HOMARD_Iteration::SetCaseName( const char* NomCas )
292 _NomCas = std::string( NomCas );
295 //=============================================================================
298 //=============================================================================
299 std::string HOMARD_Iteration::GetCaseName() const
303 //=============================================================================
306 //=============================================================================
307 void HOMARD_Iteration::SetDirName( const char* NomDir )
309 _NomDir = std::string( NomDir );
311 //=============================================================================
314 //=============================================================================
315 std::string HOMARD_Iteration::GetDirName() const
321 //=============================================================================
322 void HOMARD_Iteration::SetMessFile( const char* MessFile )
324 _MessFile = std::string( MessFile );
327 //=============================================================================
330 //=============================================================================
331 std::string HOMARD_Iteration::GetMessFile() const