1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : HOMARD_Iteration.cxx
25 // Author : Paul RASCLE, EDF
28 #include "HOMARD_Iteration.hxx"
29 #include "utilities.h"
31 //=============================================================================
33 * default constructor:
35 //=============================================================================
36 HOMARD_Iteration::HOMARD_Iteration():
37 _NomIter( "" ), _Etat( false ),
39 _NomMesh( "" ), _MeshFile( "" ),
40 _FieldFile( "" ), _TimeStep( 0 ), _Rank( 0 ),
43 _NomHypo( "" ), _NomCas( "" ), _NomDir( "" )
45 MESSAGE("HOMARD_Iter");
48 //=============================================================================
52 //=============================================================================
53 HOMARD_Iteration::~HOMARD_Iteration()
55 MESSAGE("~HOMARD_Iteration");
58 //=============================================================================
62 //=============================================================================
63 bool HOMARD_Iteration::Compute()
65 MESSAGE("Compute --> ne fait rien");
70 //=============================================================================
73 //=============================================================================
74 void HOMARD_Iteration::SetName( const char* NomIter )
76 _NomIter = std::string( NomIter );
79 //=============================================================================
82 //=============================================================================
83 std::string HOMARD_Iteration::GetName() const
88 //=============================================================================
91 //=============================================================================
92 std::string HOMARD_Iteration::GetDumpPython() const
94 if (_IterParent == "") return std::string(" ") ; // Pas de creation explicite de iteration 0";
96 std::ostringstream aScript;
97 aScript << "\n# Creation of the iteration " << _NomIter << "\n";
100 aScript << "\t" << _NomIter << " = homard.CreateIteration('";
101 aScript << _NomIter << "', "<< _NomCas << ".GetIter0Name() )\n";
105 aScript << "\t" << _NomIter << " = homard.CreateIteration('";
106 aScript << _NomIter << "', '" << _IterParent << "')\n";
108 // Le nom du maillage produit
109 aScript << "\t" << _NomIter << ".SetMeshName('" << _NomMesh << "')\n" ;
110 // Le fichier du maillage produit
111 aScript << "\t" << _NomIter << ".SetMeshFile('" << _MeshFile << "')\n";
112 if (_FieldFile != "") {
113 aScript << "\t" << _NomIter << ".SetFieldFile('" << _FieldFile << "')\n";
114 aScript << "\t" << _NomIter << ".SetTimeStepRank(" << _Rank << ", " << _TimeStep << ")\n";
117 aScript << "\thomard.AssociateIterHypo('" <<_NomIter << "', '" << _NomHypo << "')\n";
120 aScript << "\tresult = homard.Compute('" <<_NomIter << "', 1)\n";
124 aScript << "\t# result = homard.Compute('" <<_NomIter << "', 1)\n";
127 return aScript.str();
129 //=============================================================================
132 //=============================================================================
133 void HOMARD_Iteration::SetEtat( bool etat )
138 //=============================================================================
141 //=============================================================================
142 bool HOMARD_Iteration::GetEtat() const
147 //=============================================================================
150 //=============================================================================
151 void HOMARD_Iteration::SetNumber( int NumIter )
156 //=============================================================================
159 //=============================================================================
160 int HOMARD_Iteration::GetNumber() const
165 //=============================================================================
168 //=============================================================================
169 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
171 _NomMesh = std::string( NomMesh );
174 //=============================================================================
177 //=============================================================================
178 std::string HOMARD_Iteration::GetMeshName() const
183 //=============================================================================
186 //=============================================================================
187 void HOMARD_Iteration::SetIterParent( const char* IterParent )
189 _IterParent = IterParent;
192 //=============================================================================
195 //=============================================================================
196 std::string HOMARD_Iteration::GetIterParent() const
201 //=============================================================================
204 //=============================================================================
205 void HOMARD_Iteration::AddIteration( const char* NomIteration )
207 _mesIterFilles.push_back( std::string( NomIteration ) );
210 //=============================================================================
213 //=============================================================================
214 const std::list<std::string>& HOMARD_Iteration::GetIterations() const
216 return _mesIterFilles;
219 //=============================================================================
222 //=============================================================================
223 void HOMARD_Iteration::SupprIterations()
225 _mesIterFilles.clear();
228 //=============================================================================
231 //=============================================================================
232 void HOMARD_Iteration::SetHypoName( const char* NomHypo )
234 _NomHypo = std::string( NomHypo );
237 //=============================================================================
240 //=============================================================================
241 std::string HOMARD_Iteration::GetHypoName() const
246 //=============================================================================
249 //=============================================================================
250 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
252 _MeshFile = std::string( MeshFile );
255 //=============================================================================
258 //=============================================================================
259 std::string HOMARD_Iteration::GetMeshFile() const
264 //=============================================================================
267 //=============================================================================
268 void HOMARD_Iteration::SetFieldFile( const char* FieldFile )
270 _FieldFile = std::string( FieldFile );
272 //=============================================================================
273 std::string HOMARD_Iteration::GetFieldFile() const
278 //=============================================================================
281 //=============================================================================
282 void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank )
284 _TimeStep = TimeStep;
287 //=============================================================================
288 int HOMARD_Iteration::GetTimeStep() const
292 //=============================================================================
293 int HOMARD_Iteration::GetRank() const
298 //=============================================================================
301 //=============================================================================
302 void HOMARD_Iteration::SetCaseName( const char* NomCas )
304 _NomCas = std::string( NomCas );
307 //=============================================================================
310 //=============================================================================
311 std::string HOMARD_Iteration::GetCaseName() const
315 //=============================================================================
318 //=============================================================================
319 void HOMARD_Iteration::SetDirName( const char* NomDir )
321 _NomDir = std::string( NomDir );
323 //=============================================================================
326 //=============================================================================
327 std::string HOMARD_Iteration::GetDirName() const
333 //=============================================================================
334 void HOMARD_Iteration::SetMessFile( const char* MessFile )
336 _MessFile = std::string( MessFile );
339 //=============================================================================
342 //=============================================================================
343 std::string HOMARD_Iteration::GetMessFile() const