1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011 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 //=============================================================================
59 //=============================================================================
60 bool HOMARD_Iteration::Compute()
62 MESSAGE("Compute --> ne fait rien");
67 //=============================================================================
70 //=============================================================================
71 void HOMARD_Iteration::SetName( const char* NomIter )
73 _NomIter = std::string( NomIter );
76 //=============================================================================
79 //=============================================================================
80 std::string HOMARD_Iteration::GetName() const
85 //=============================================================================
88 //=============================================================================
89 std::string HOMARD_Iteration::GetDumpPython() const
91 if (_IterParent == "") return std::string(" ") ; // Pas de creation explicite de iteration 0";
93 std::ostringstream aScript;
94 aScript << "\n# Creation of the iteration " << _NomIter << "\n";
97 aScript << "\t" << _NomIter << " = homard.CreateIteration('";
98 aScript << _NomIter << "', "<< _NomCas << ".GetIter0Name() )\n";
102 aScript << "\t" << _NomIter << " = homard.CreateIteration('";
103 aScript << _NomIter << "', '" << _IterParent << "')\n";
105 // Le nom du maillage produit
106 aScript << "\t" << _NomIter << ".SetMeshName('" << _NomMesh << "')\n" ;
107 // Le fichier du maillage produit
108 aScript << "\t" << _NomIter << ".SetMeshFile('" << _MeshFile << "')\n";
109 if (_FieldFile != "") {
110 aScript << "\t" << _NomIter << ".SetFieldFile('" << _FieldFile << "')\n";
111 aScript << "\t" << _NomIter << ".SetTimeStepRank(" << _Rank << ", " << _TimeStep << ")\n";
114 aScript << "\thomard.AssociateIterHypo('" <<_NomIter << "', '" << _NomHypo << "')\n";
117 aScript << "\tresult = homard.Compute('" <<_NomIter << "', 1)\n";
121 aScript << "\t# result = homard.Compute('" <<_NomIter << "', 1)\n";
124 return aScript.str();
126 //=============================================================================
129 //=============================================================================
130 void HOMARD_Iteration::SetEtat( bool etat )
135 //=============================================================================
138 //=============================================================================
139 bool HOMARD_Iteration::GetEtat() const
144 //=============================================================================
147 //=============================================================================
148 void HOMARD_Iteration::SetNumber( int NumIter )
153 //=============================================================================
156 //=============================================================================
157 int HOMARD_Iteration::GetNumber() const
162 //=============================================================================
165 //=============================================================================
166 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
168 _NomMesh = std::string( NomMesh );
171 //=============================================================================
174 //=============================================================================
175 std::string HOMARD_Iteration::GetMeshName() const
180 //=============================================================================
183 //=============================================================================
184 void HOMARD_Iteration::SetIterParent( const char* IterParent )
186 _IterParent = IterParent;
189 //=============================================================================
192 //=============================================================================
193 std::string HOMARD_Iteration::GetIterParent() const
198 //=============================================================================
201 //=============================================================================
202 void HOMARD_Iteration::AddIteration( const char* NomIteration )
204 _mesIterFilles.push_back( std::string( NomIteration ) );
207 //=============================================================================
210 //=============================================================================
211 const std::list<std::string>& HOMARD_Iteration::GetIterations() const
213 return _mesIterFilles;
216 //=============================================================================
219 //=============================================================================
220 void HOMARD_Iteration::SupprIterations()
222 _mesIterFilles.clear();
225 //=============================================================================
228 //=============================================================================
229 void HOMARD_Iteration::SetHypoName( const char* NomHypo )
231 _NomHypo = std::string( NomHypo );
234 //=============================================================================
237 //=============================================================================
238 std::string HOMARD_Iteration::GetHypoName() const
243 //=============================================================================
246 //=============================================================================
247 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
249 _MeshFile = std::string( MeshFile );
252 //=============================================================================
255 //=============================================================================
256 std::string HOMARD_Iteration::GetMeshFile() const
261 //=============================================================================
264 //=============================================================================
265 void HOMARD_Iteration::SetFieldFile( const char* FieldFile )
267 _FieldFile = std::string( FieldFile );
269 //=============================================================================
270 std::string HOMARD_Iteration::GetFieldFile() const
275 //=============================================================================
278 //=============================================================================
279 void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank )
281 _TimeStep = TimeStep;
284 //=============================================================================
285 int HOMARD_Iteration::GetTimeStep() const
289 //=============================================================================
290 int HOMARD_Iteration::GetRank() const
295 //=============================================================================
298 //=============================================================================
299 void HOMARD_Iteration::SetCaseName( const char* NomCas )
301 _NomCas = std::string( NomCas );
304 //=============================================================================
307 //=============================================================================
308 std::string HOMARD_Iteration::GetCaseName() const
312 //=============================================================================
315 //=============================================================================
316 void HOMARD_Iteration::SetDirName( const char* NomDir )
318 _NomDir = std::string( NomDir );
320 //=============================================================================
323 //=============================================================================
324 std::string HOMARD_Iteration::GetDirName() const
330 //=============================================================================
331 void HOMARD_Iteration::SetMessFile( const char* MessFile )
333 _MessFile = std::string( MessFile );
336 //=============================================================================
339 //=============================================================================
340 std::string HOMARD_Iteration::GetMessFile() const