1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011-2013 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
26 // L'ordre de description des fonctions est le meme dans tous les fichiers
27 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
28 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
29 // 2. Les caracteristiques
30 // 3. Le lien avec les autres structures
32 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
34 #include "HOMARD_Iteration.hxx"
35 #include "utilities.h"
37 //=============================================================================
39 * default constructor:
41 //=============================================================================
42 HOMARD_Iteration::HOMARD_Iteration():
43 _Name( "" ), _Etat( false ),
45 _NomMesh( "" ), _MeshFile( "" ),
46 _FieldFile( "" ), _TimeStep( -1 ), _Rank( -1 ),
49 _NomHypo( "" ), _NomCas( "" ), _NomDir( "" ),
53 MESSAGE("HOMARD_Iter");
55 //=============================================================================
59 //=============================================================================
60 HOMARD_Iteration::~HOMARD_Iteration()
62 MESSAGE("~HOMARD_Iteration");
64 //=============================================================================
65 //=============================================================================
67 //=============================================================================
68 //=============================================================================
69 void HOMARD_Iteration::SetName( const char* Name )
71 _Name = std::string( Name );
73 //=============================================================================
74 std::string HOMARD_Iteration::GetName() const
78 //=============================================================================
79 std::string HOMARD_Iteration::GetDumpPython() const
81 if (_IterParent == "") return std::string(" ") ; // Pas de creation explicite de iteration 0";
83 MESSAGE (". Ecriture de l iteration " << _Name );
84 std::ostringstream aScript;
85 aScript << "\n# Creation of the iteration " << _Name << "\n";
88 aScript << "\t" << _Name << " = " << _NomCas << ".NextIteration(\"" << _Name << "\")\n";
92 aScript << "\t" << _Name << " = " << _IterParent << ".NextIteration(\"" << _Name << "\")\n";
94 // Le nom du maillage produit
95 // MESSAGE (".. maillage produit " << _NomMesh );
96 aScript << "\t" << _Name << ".SetMeshName(\"" << _NomMesh << "\")\n" ;
97 // Le fichier du maillage produit
98 aScript << "\t" << _Name << ".SetMeshFile(\"" << _MeshFile << "\")\n";
99 // Le fichier des champs, avec l'instant eventuel
100 if ( _FieldFile != "" ) {
101 aScript << "\t" << _Name << ".SetFieldFile(\"" << _FieldFile << "\")\n";
102 if ( _TimeStep == -2 ) {
103 aScript << "\t" << _Name << ".SetTimeStepRankLast()\n";
107 if ( ( _TimeStep != -1 ) and ( _Rank != -1 ) ) {
108 aScript << "\t" << _Name << ".SetTimeStepRank( " << _TimeStep << ", " << _Rank << " )\n";
113 // MESSAGE (".. Hypothese " << _NomHypo );
114 aScript << "\t" << _Name << ".AssociateHypo(\"" << _NomHypo << "\")\n";
116 if (_Etat == true) { aScript << "\tcodret = " <<_Name << ".Compute(1, 2)\n"; }
117 else { aScript << "\t#codret = " <<_Name << ".Compute(1, 2)\n"; }
118 // MESSAGE (". Fin de l ecriture de l iteration " << _Name );
120 return aScript.str();
122 //=============================================================================
123 //=============================================================================
125 //=============================================================================
126 //=============================================================================
127 void HOMARD_Iteration::SetDirNameLoc( const char* NomDir )
129 _NomDir = std::string( NomDir );
131 //=============================================================================
132 std::string HOMARD_Iteration::GetDirNameLoc() const
136 //=============================================================================
137 void HOMARD_Iteration::SetNumber( int NumIter )
141 //=============================================================================
142 int HOMARD_Iteration::GetNumber() const
146 //=============================================================================
147 void HOMARD_Iteration::SetState( int etat )
151 //=============================================================================
152 int HOMARD_Iteration::GetState() const
156 //=============================================================================
157 void HOMARD_Iteration::SetMeshName( const char* NomMesh )
159 _NomMesh = std::string( NomMesh );
161 //=============================================================================
162 std::string HOMARD_Iteration::GetMeshName() const
166 //=============================================================================
167 void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
169 _MeshFile = std::string( MeshFile );
171 //=============================================================================
172 std::string HOMARD_Iteration::GetMeshFile() const
176 //=============================================================================
177 void HOMARD_Iteration::SetFieldFile( const char* FieldFile )
179 _FieldFile = std::string( FieldFile );
181 //=============================================================================
182 std::string HOMARD_Iteration::GetFieldFile() const
186 //=============================================================================
187 void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank )
189 _TimeStep = TimeStep;
192 //=============================================================================
193 void HOMARD_Iteration::SetTimeStepRankLast()
197 //=============================================================================
198 int HOMARD_Iteration::GetTimeStep() const
202 //=============================================================================
203 int HOMARD_Iteration::GetRank() const
207 //=============================================================================
208 void HOMARD_Iteration::SetLogFile( const char* LogFile )
210 _LogFile = std::string( LogFile );
212 //=============================================================================
213 std::string HOMARD_Iteration::GetLogFile() const
217 //=============================================================================
218 void HOMARD_Iteration::SetFileInfo( const char* FileInfo )
220 _FileInfo = std::string( FileInfo );
222 //=============================================================================
223 std::string HOMARD_Iteration::GetFileInfo() const
227 //=============================================================================
228 //=============================================================================
229 // Liens avec les autres iterations
230 //=============================================================================
231 //=============================================================================
232 void HOMARD_Iteration::LinkNextIteration( const char* NomIteration )
234 _mesIterFilles.push_back( std::string( NomIteration ) );
236 //=============================================================================
237 void HOMARD_Iteration::UnLinkNextIteration( const char* NomIteration )
239 std::list<std::string>::iterator it = find( _mesIterFilles.begin(), _mesIterFilles.end(), NomIteration ) ;
240 if ( it != _mesIterFilles.end() )
242 MESSAGE ("Dans UnLinkNextIteration pour " << NomIteration) ;
243 it = _mesIterFilles.erase( it ) ;
246 //=============================================================================
247 void HOMARD_Iteration::UnLinkNextIterations()
249 _mesIterFilles.clear();
251 //=============================================================================
252 const std::list<std::string>& HOMARD_Iteration::GetIterations() const
254 return _mesIterFilles;
256 //=============================================================================
257 void HOMARD_Iteration::SetIterParentName( const char* IterParent )
259 _IterParent = IterParent;
261 //=============================================================================
262 std::string HOMARD_Iteration::GetIterParentName() const
266 //=============================================================================
267 //=============================================================================
268 // Liens avec les autres structures
269 //=============================================================================
270 //=============================================================================
271 void HOMARD_Iteration::SetCaseName( const char* NomCas )
273 _NomCas = std::string( NomCas );
275 //=============================================================================
276 std::string HOMARD_Iteration::GetCaseName() const
280 //=============================================================================
281 void HOMARD_Iteration::SetHypoName( const char* NomHypo )
283 _NomHypo = std::string( NomHypo );
285 //=============================================================================
286 std::string HOMARD_Iteration::GetHypoName() const
290 //=============================================================================
291 //=============================================================================
293 //=============================================================================
294 //=============================================================================
295 void HOMARD_Iteration::SetInfoCompute( int MessInfo )
297 _MessInfo = MessInfo;
299 //=============================================================================
300 int HOMARD_Iteration::GetInfoCompute() const