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 _Name( "" ), _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* Name )
61 _Name = std::string( Name );
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 MESSAGE (". Ecriture de l iteration " << _Name );
82 std::ostringstream aScript;
83 aScript << "\n# Creation of the iteration " << _Name << "\n";
86 aScript << "\t" << _Name << " = " << _NomCas << ".NextIteration(\"" << _Name << "\")\n";
90 aScript << "\t" << _Name << " = " << _IterParent << ".NextIteration(\"" << _Name << "\")\n";
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";
105 // MESSAGE (".. Hypothese " << _NomHypo );
106 aScript << "\t" << _Name << ".AssociateHypo(\"" << _NomHypo << "\")\n";
110 aScript << "\tcodret = " <<_Name << ".Compute(1)\n";
114 aScript << "\t#codret = " <<_Name << ".Compute(1)\n";
116 // MESSAGE (". Fin de l ecriture de l iteration " << _Name );
118 return aScript.str();
120 //=============================================================================
123 //=============================================================================
124 void HOMARD_Iteration::SetEtat( bool etat )
129 //=============================================================================
132 //=============================================================================
133 bool HOMARD_Iteration::GetEtat() const
138 //=============================================================================
141 //=============================================================================
142 void HOMARD_Iteration::SetNumber( int NumIter )
147 //=============================================================================
150 //=============================================================================
151 int HOMARD_Iteration::GetNumber() const
156 //=============================================================================
159 //=============================================================================
160 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
162 _NomMesh = std::string( NomMesh );
165 //=============================================================================
168 //=============================================================================
169 std::string HOMARD_Iteration::GetMeshName() const
174 //=============================================================================
177 //=============================================================================
178 void HOMARD_Iteration::SetIterParentName( const char* IterParent )
180 _IterParent = IterParent;
183 //=============================================================================
186 //=============================================================================
187 std::string HOMARD_Iteration::GetIterParentName() const
192 //=============================================================================
195 //=============================================================================
196 void HOMARD_Iteration::AddIteration( const char* NomIteration )
198 _mesIterFilles.push_back( std::string( NomIteration ) );
201 //=============================================================================
204 //=============================================================================
205 const std::list<std::string>& HOMARD_Iteration::GetIterations() const
207 return _mesIterFilles;
210 //=============================================================================
213 //=============================================================================
214 void HOMARD_Iteration::SupprIterations()
216 _mesIterFilles.clear();
220 //=============================================================================
223 //=============================================================================
224 void HOMARD_Iteration::SetHypoName( const char* NomHypo )
226 _NomHypo = std::string( NomHypo );
229 //=============================================================================
232 //=============================================================================
233 std::string HOMARD_Iteration::GetHypoName() const
238 //=============================================================================
241 //=============================================================================
242 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
244 _MeshFile = std::string( MeshFile );
247 //=============================================================================
250 //=============================================================================
251 std::string HOMARD_Iteration::GetMeshFile() const
256 //=============================================================================
259 //=============================================================================
260 void HOMARD_Iteration::SetFieldFile( const char* FieldFile )
262 _FieldFile = std::string( FieldFile );
264 //=============================================================================
265 std::string HOMARD_Iteration::GetFieldFile() const
270 //=============================================================================
273 //=============================================================================
274 void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank )
276 _TimeStep = TimeStep;
279 //=============================================================================
280 int HOMARD_Iteration::GetTimeStep() const
284 //=============================================================================
285 int HOMARD_Iteration::GetRank() const
290 //=============================================================================
293 //=============================================================================
294 void HOMARD_Iteration::SetCaseName( const char* NomCas )
296 _NomCas = std::string( NomCas );
299 //=============================================================================
302 //=============================================================================
303 std::string HOMARD_Iteration::GetCaseName() const
307 //=============================================================================
310 //=============================================================================
311 void HOMARD_Iteration::SetDirName( const char* NomDir )
313 _NomDir = std::string( NomDir );
315 //=============================================================================
318 //=============================================================================
319 std::string HOMARD_Iteration::GetDirName() const
325 //=============================================================================
326 void HOMARD_Iteration::SetMessFile( const char* MessFile )
328 _MessFile = std::string( MessFile );
331 //=============================================================================
334 //=============================================================================
335 std::string HOMARD_Iteration::GetMessFile() const