]> SALOME platform Git repositories - modules/homard.git/blob - src/HOMARD_I/HOMARD_Iteration_i.cxx
Salome HOME
integration of modifications from Gerald Nicolas
[modules/homard.git] / src / HOMARD_I / HOMARD_Iteration_i.cxx
1 // Copyright (C) 2011-2012  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Remarques :
20 // L'ordre de description des fonctions est le meme dans tous les fichiers
21 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
22 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
23 // 2. Les caracteristiques
24 // 3. Le lien avec les autres structures
25 //
26 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
27 //
28
29 #include "HOMARD_Iteration_i.hxx"
30 #include "HOMARD_Gen_i.hxx"
31 #include "HOMARD_Iteration.hxx"
32 #include "HOMARD_DriverTools.hxx"
33
34 #include "SALOMEDS_Tool.hxx"
35
36 #include "utilities.h"
37
38 //=============================================================================
39 /*!
40  *  standard constructor
41  */
42 //=============================================================================
43 HOMARD_Iteration_i::HOMARD_Iteration_i()
44 {
45   MESSAGE( "Default constructor, not for use" );
46   ASSERT( 0 );
47 }
48
49 //=============================================================================
50 /*!
51  *  standard constructor
52  */
53 //=============================================================================
54 HOMARD_Iteration_i::HOMARD_Iteration_i( CORBA::ORB_ptr orb,
55                                         HOMARD::HOMARD_Gen_var engine )
56 {
57   MESSAGE("constructor");
58   _gen_i = engine;
59   _orb = orb;
60   myHomardIteration = new ::HOMARD_Iteration();
61   ASSERT( myHomardIteration );
62 }
63
64 //=============================================================================
65 /*!
66  *  standard destructor
67  */
68 //=============================================================================
69 HOMARD_Iteration_i::~HOMARD_Iteration_i()
70 {
71 }
72 //=============================================================================
73 //=============================================================================
74 // Generalites
75 //=============================================================================
76 //=============================================================================
77 void HOMARD_Iteration_i::SetName( const char* Name )
78 {
79   ASSERT( myHomardIteration );
80   myHomardIteration->SetName( Name );
81 }
82 //=============================================================================
83 char* HOMARD_Iteration_i::GetName()
84 {
85   ASSERT( myHomardIteration );
86   return CORBA::string_dup( myHomardIteration->GetName().c_str() );
87 }
88 //=============================================================================
89 CORBA::Long  HOMARD_Iteration_i::Delete()
90 {
91   ASSERT( myHomardIteration );
92   char* IterName = GetName() ;
93   MESSAGE ( "Delete : destruction de l'iteration " << IterName );
94   return _gen_i->DeleteIteration(IterName) ;
95 }
96 //=============================================================================
97 char* HOMARD_Iteration_i::GetDumpPython()
98 {
99   ASSERT( myHomardIteration );
100   return CORBA::string_dup( myHomardIteration->GetDumpPython().c_str() );
101 }
102 //=============================================================================
103 std::string HOMARD_Iteration_i::Dump() const
104 {
105   return HOMARD::Dump( *myHomardIteration );
106 }
107 //=============================================================================
108 bool HOMARD_Iteration_i::Restore( const std::string& stream )
109 {
110   return HOMARD::Restore( *myHomardIteration, stream );
111 }
112 //=============================================================================
113 //=============================================================================
114 // Caracteristiques
115 //=============================================================================
116 //=============================================================================
117 void HOMARD_Iteration_i::SetDirName( const char* NomDir )
118 {
119   ASSERT( myHomardIteration );
120   myHomardIteration->SetDirName( NomDir );
121 }
122 //=============================================================================
123 char* HOMARD_Iteration_i::GetDirName()
124 {
125   ASSERT( myHomardIteration );
126   return CORBA::string_dup( myHomardIteration->GetDirName().c_str() );
127 }
128 //=============================================================================
129 void HOMARD_Iteration_i::SetNumber( CORBA::Long NumIter )
130 {
131   ASSERT( myHomardIteration );
132   myHomardIteration->SetNumber( NumIter );
133 }
134 //=============================================================================
135 CORBA::Long HOMARD_Iteration_i::GetNumber()
136 {
137   ASSERT( myHomardIteration );
138   return  myHomardIteration->GetNumber() ;
139 }
140 //=============================================================================
141 void HOMARD_Iteration_i::SetEtat( CORBA::Boolean Etat )
142 {
143   ASSERT( myHomardIteration );
144   myHomardIteration->SetEtat( Etat );
145 }
146 //=============================================================================
147 CORBA::Boolean HOMARD_Iteration_i::GetEtat()
148 {
149   ASSERT( myHomardIteration );
150   return CORBA::Boolean( myHomardIteration->GetEtat());
151 }
152 //=============================================================================
153 void HOMARD_Iteration_i::SetMeshName( const char* NomMesh )
154 {
155   ASSERT( myHomardIteration );
156   myHomardIteration->SetMeshName( NomMesh );
157 }
158 //=============================================================================
159 char* HOMARD_Iteration_i::GetMeshName()
160 {
161   ASSERT( myHomardIteration );
162   return CORBA::string_dup( myHomardIteration->GetMeshName().c_str() );
163 }
164 //=============================================================================
165 void HOMARD_Iteration_i::SetMeshFile( const char* MeshFile )
166 {
167   ASSERT( myHomardIteration );
168   myHomardIteration->SetMeshFile( MeshFile );
169 }
170 //=============================================================================
171 char* HOMARD_Iteration_i::GetMeshFile()
172 {
173   ASSERT( myHomardIteration );
174   return CORBA::string_dup( myHomardIteration->GetMeshFile().c_str() );
175 }
176 //=============================================================================
177 void HOMARD_Iteration_i::SetFieldFile( const char* FieldFile )
178 {
179   ASSERT( myHomardIteration );
180   myHomardIteration->SetFieldFile( FieldFile );
181 }
182 //=============================================================================
183 char* HOMARD_Iteration_i::GetFieldFile()
184 {
185   ASSERT( myHomardIteration );
186   return CORBA::string_dup( myHomardIteration->GetFieldFile().c_str() );
187 }
188 //=============================================================================
189 void HOMARD_Iteration_i::SetTimeStepRank( CORBA::Long TimeStep, CORBA::Long Rank )
190 {
191   ASSERT( myHomardIteration );
192   myHomardIteration->SetTimeStepRank( TimeStep, Rank );
193 }
194 //=============================================================================
195 CORBA::Long HOMARD_Iteration_i::GetTimeStep()
196 {
197   ASSERT( myHomardIteration );
198   return  CORBA::Long( myHomardIteration->GetTimeStep() );
199 }
200 //=============================================================================
201 CORBA::Long HOMARD_Iteration_i::GetRank()
202 {
203   ASSERT( myHomardIteration );
204   return  CORBA::Long( myHomardIteration->GetRank() );
205 }
206 //=============================================================================
207 void HOMARD_Iteration_i::SetMessFile( const char* MessFile )
208 {
209   ASSERT( myHomardIteration );
210   myHomardIteration->SetMessFile( MessFile );
211 }
212 //=============================================================================
213 char* HOMARD_Iteration_i::GetMessFile()
214 {
215   ASSERT( myHomardIteration );
216   return CORBA::string_dup( myHomardIteration->GetMessFile().c_str() );
217 }
218 //=============================================================================
219 CORBA::Long  HOMARD_Iteration_i::Compute(CORBA::Long etatMenage)
220 {
221   MESSAGE ( "Compute : calcul d'une iteration" );
222   ASSERT( myHomardIteration );
223 //
224 // Nom de l'iteration
225   char* IterName = GetName() ;
226   MESSAGE ( "Compute : calcul de l'teration " << IterName );
227   return _gen_i->Compute(IterName, etatMenage) ;
228 }
229 //=============================================================================
230 //=============================================================================
231 // Liens avec les autres iterations
232 //=============================================================================
233 //=============================================================================
234 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::NextIteration( const char* IterName )
235 {
236 // Nom de l'iteration parent
237   char* NomIterParent = GetName() ;
238   MESSAGE ( "NextIteration : creation de l'iteration " << IterName << " comme fille de " << NomIterParent );
239   return _gen_i->CreateIteration(IterName, NomIterParent) ;
240 }
241 //=============================================================================
242 void HOMARD_Iteration_i::LinkNextIteration( const char* NomIteration )
243 {
244   ASSERT( myHomardIteration );
245   myHomardIteration->LinkNextIteration( NomIteration );
246 }
247 //=============================================================================
248 void HOMARD_Iteration_i::UnLinkNextIteration( const char* NomIteration )
249 {
250   ASSERT( myHomardIteration );
251   myHomardIteration->UnLinkNextIteration( NomIteration );
252 }
253 //=============================================================================
254 HOMARD::listeIterFilles* HOMARD_Iteration_i::GetIterations()
255 {
256   ASSERT( myHomardIteration );
257   const std::list<std::string>& maListe = myHomardIteration->GetIterations();
258   HOMARD::listeIterFilles_var aResult = new HOMARD::listeIterFilles;
259   aResult->length( maListe.size() );
260   std::list<std::string>::const_iterator it;
261   int i = 0;
262   for ( it = maListe.begin(); it != maListe.end(); it++ )
263   {
264     aResult[i++] = CORBA::string_dup( (*it).c_str() );
265   }
266   return aResult._retn();
267 }
268 //=============================================================================
269 void HOMARD_Iteration_i::SetIterParentName( const char* NomIterParent )
270 {
271   ASSERT( myHomardIteration );
272   myHomardIteration->SetIterParentName( NomIterParent );
273 }
274 //=============================================================================
275 char* HOMARD_Iteration_i::GetIterParentName()
276 {
277   ASSERT( myHomardIteration );
278   return CORBA::string_dup( myHomardIteration->GetIterParentName().c_str() );
279 }
280 //=============================================================================
281 HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::GetIterParent()
282 {
283 // Nom de l'iteration parent
284   char* NomIterParent = GetIterParentName() ;
285   MESSAGE ( "GetIterParent : NomIterParent = " << NomIterParent );
286   return _gen_i->GetIteration(NomIterParent) ;
287 }
288 //=============================================================================
289 //=============================================================================
290 // Liens avec les autres structures
291 //=============================================================================
292 //=============================================================================
293 void HOMARD_Iteration_i::SetCaseName( const char* NomCas )
294 {
295   ASSERT( myHomardIteration );
296   myHomardIteration->SetCaseName( NomCas );
297 }
298 //=============================================================================
299 char* HOMARD_Iteration_i::GetCaseName()
300 {
301   ASSERT( myHomardIteration );
302   return CORBA::string_dup( myHomardIteration->GetCaseName().c_str() );
303 }
304 //=============================================================================
305 void HOMARD_Iteration_i::AssociateHypo( const char* NomHypo )
306 {
307   ASSERT( myHomardIteration );
308 //
309 // Nom de l'iteration
310   char* IterName = GetName() ;
311   MESSAGE ( ". IterName = " << IterName );
312   return _gen_i->AssociateIterHypo(IterName, NomHypo) ;
313 }
314 //=============================================================================
315 void HOMARD_Iteration_i::SetHypoName( const char* NomHypo )
316 {
317   ASSERT( myHomardIteration );
318   myHomardIteration->SetHypoName( NomHypo );
319 }
320 //=============================================================================
321 char* HOMARD_Iteration_i::GetHypoName()
322 {
323   ASSERT( myHomardIteration );
324   return CORBA::string_dup( myHomardIteration->GetHypoName().c_str() );
325 }