Salome HOME
Mise à jour des messages et défaut
[modules/smesh.git] / src / ADAPT_I / HOMARD_Iteration_i.cxx
1 // Copyright (C) 2011-2020  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, or (at your option) any later version.
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
20 // Remarques :
21 // L'ordre de description des fonctions est le meme dans tous les fichiers
22 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
23 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
24 // 2. Les caracteristiques
25 // 3. Le lien avec les autres structures
26 //
27 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
28 //
29
30 #include "HOMARD_Iteration_i.hxx"
31 #include "ADAPT_Gen_i.hxx"
32 #include "HOMARD_Iteration.hxx"
33 #include "HOMARD_DriverTools.hxx"
34
35 #include "SALOMEDS_Tool.hxx"
36
37 #include "utilities.h"
38
39 //=============================================================================
40 /*!
41  *  standard constructor
42  */
43 //=============================================================================
44 HOMARD_Iteration_i::HOMARD_Iteration_i()
45 {
46   MESSAGE( "Default constructor, not for use" );
47   ASSERT( 0 );
48 }
49 //=============================================================================
50 /*!
51  *  standard constructor
52  */
53 //=============================================================================
54 HOMARD_Iteration_i::HOMARD_Iteration_i( CORBA::ORB_ptr orb,
55                                         ADAPT::ADAPT_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  *  standard destructor
66  */
67 //=============================================================================
68 HOMARD_Iteration_i::~HOMARD_Iteration_i()
69 {
70 }
71 //=============================================================================
72 //=============================================================================
73 // Generalites
74 //=============================================================================
75 //=============================================================================
76 void HOMARD_Iteration_i::SetName( const char* Name )
77 {
78   ASSERT( myHomardIteration );
79   myHomardIteration->SetName( Name );
80 }
81 //=============================================================================
82 char* HOMARD_Iteration_i::GetName()
83 {
84   ASSERT( myHomardIteration );
85   return CORBA::string_dup( myHomardIteration->GetName().c_str() );
86 }
87 //=============================================================================
88 CORBA::Long  HOMARD_Iteration_i::Delete( CORBA::Long Option )
89 {
90   ASSERT( myHomardIteration );
91   char* IterName = GetName() ;
92   MESSAGE ( "Delete : destruction de l'iteration " << IterName << ", Option = " << Option );
93   return _gen_i->DeleteIteration(IterName, Option) ;
94 }
95 //=============================================================================
96 char* HOMARD_Iteration_i::GetDumpPython()
97 {
98   ASSERT( myHomardIteration );
99   return CORBA::string_dup( myHomardIteration->GetDumpPython().c_str() );
100 }
101 //=============================================================================
102 std::string HOMARD_Iteration_i::Dump() const
103 {
104   return ADAPT::Dump( *myHomardIteration );
105 }
106 //=============================================================================
107 bool HOMARD_Iteration_i::Restore( const std::string& stream )
108 {
109   return ADAPT::Restore( *myHomardIteration, stream );
110 }
111 //=============================================================================
112 //=============================================================================
113 // Caracteristiques
114 //=============================================================================
115 //=============================================================================
116 void HOMARD_Iteration_i::SetDirNameLoc( const char* NomDir )
117 {
118   ASSERT( myHomardIteration );
119   myHomardIteration->SetDirNameLoc( NomDir );
120 }
121 //=============================================================================
122 char* HOMARD_Iteration_i::GetDirNameLoc()
123 {
124   ASSERT( myHomardIteration );
125   return CORBA::string_dup( myHomardIteration->GetDirNameLoc().c_str() );
126 }
127 //=============================================================================
128 char* HOMARD_Iteration_i::GetDirName()
129 {
130   ASSERT( myHomardIteration );
131   std::string casename = myHomardIteration->GetCaseName() ;
132   ADAPT::HOMARD_Cas_ptr caseiter = _gen_i->GetCase(casename.c_str()) ;
133   std::string dirnamecase = caseiter->GetDirName() ;
134   std::string dirname = dirnamecase + "/" +  GetDirNameLoc() ;
135   return CORBA::string_dup( dirname.c_str() );
136 }
137 //=============================================================================
138 void HOMARD_Iteration_i::SetNumber( CORBA::Long NumIter )
139 {
140   ASSERT( myHomardIteration );
141   myHomardIteration->SetNumber( NumIter );
142 }
143 //=============================================================================
144 CORBA::Long HOMARD_Iteration_i::GetNumber()
145 {
146   ASSERT( myHomardIteration );
147   return myHomardIteration->GetNumber() ;
148 }
149 //=============================================================================
150 void HOMARD_Iteration_i::SetState( CORBA::Long Etat )
151 {
152   ASSERT( myHomardIteration );
153   myHomardIteration->SetState( Etat );
154 }
155 //=============================================================================
156 CORBA::Long HOMARD_Iteration_i::GetState()
157 {
158   ASSERT( myHomardIteration );
159   return myHomardIteration->GetState() ;
160 }
161 //=============================================================================
162 void HOMARD_Iteration_i::SetMeshName( const char* NomMesh )
163 {
164   ASSERT( myHomardIteration );
165   myHomardIteration->SetMeshName( NomMesh );
166 }
167 //=============================================================================
168 char* HOMARD_Iteration_i::GetMeshName()
169 {
170   ASSERT( myHomardIteration );
171   return CORBA::string_dup( myHomardIteration->GetMeshName().c_str() );
172 }
173 //=============================================================================
174 void HOMARD_Iteration_i::SetMeshFile( const char* MeshFile )
175 {
176   ASSERT( myHomardIteration );
177   myHomardIteration->SetMeshFile( MeshFile );
178 }
179 //=============================================================================
180 char* HOMARD_Iteration_i::GetMeshFile()
181 {
182   ASSERT( myHomardIteration );
183   return CORBA::string_dup( myHomardIteration->GetMeshFile().c_str() );
184 }
185 //=============================================================================
186 void HOMARD_Iteration_i::SetFieldFile( const char* FieldFile )
187 {
188   ASSERT( myHomardIteration );
189   myHomardIteration->SetFieldFile( FieldFile );
190 }
191 //=============================================================================
192 char* HOMARD_Iteration_i::GetFieldFile()
193 {
194   ASSERT( myHomardIteration );
195   return CORBA::string_dup( myHomardIteration->GetFieldFile().c_str() );
196 }
197 //=============================================================================
198 // Instants pour le champ de pilotage
199 //=============================================================================
200 void HOMARD_Iteration_i::SetTimeStep( CORBA::Long TimeStep )
201 {
202   ASSERT( myHomardIteration );
203   myHomardIteration->SetTimeStep( TimeStep );
204 }
205 //=============================================================================
206 void HOMARD_Iteration_i::SetTimeStepRank( CORBA::Long TimeStep, CORBA::Long Rank )
207 {
208   ASSERT( myHomardIteration );
209   myHomardIteration->SetTimeStepRank( TimeStep, Rank );
210 }
211 //=============================================================================
212 void HOMARD_Iteration_i::SetTimeStepRankLast()
213 {
214   ASSERT( myHomardIteration );
215   myHomardIteration->SetTimeStepRankLast();
216 }
217 //=============================================================================
218 CORBA::Long HOMARD_Iteration_i::GetTimeStep()
219 {
220   ASSERT( myHomardIteration );
221   return  CORBA::Long( myHomardIteration->GetTimeStep() );
222 }
223 //=============================================================================
224 CORBA::Long HOMARD_Iteration_i::GetRank()
225 {
226   ASSERT( myHomardIteration );
227   return  CORBA::Long( myHomardIteration->GetRank() );
228 }
229 //=============================================================================
230 // Instants pour un champ a interpoler
231 //=============================================================================
232 void HOMARD_Iteration_i::SetFieldInterpTimeStep( const char* FieldInterp, CORBA::Long TimeStep )
233 {
234   SetFieldInterpTimeStepRank( FieldInterp, TimeStep, TimeStep );
235 }
236 //=============================================================================
237 void HOMARD_Iteration_i::SetFieldInterpTimeStepRank( const char* FieldInterp, CORBA::Long TimeStep, CORBA::Long Rank )
238 {
239   ASSERT( myHomardIteration );
240   myHomardIteration->SetFieldInterpTimeStepRank( FieldInterp, TimeStep, Rank );
241 }
242 //=============================================================================
243 ADAPT::listeFieldInterpTSRsIter* HOMARD_Iteration_i::GetFieldInterpsTimeStepRank()
244 {
245   ASSERT( myHomardIteration );
246   const std::list<std::string>& ListString = myHomardIteration->GetFieldInterpsTimeStepRank();
247   ADAPT::listeFieldInterpTSRsIter_var aResult = new ADAPT::listeFieldInterpTSRsIter;
248   aResult->length( ListString.size() );
249   std::list<std::string>::const_iterator it;
250   int i = 0;
251   for ( it = ListString.begin(); it != ListString.end(); it++ )
252   {
253     aResult[i++] = CORBA::string_dup( (*it).c_str() );
254   }
255   return aResult._retn();
256 }
257 //=============================================================================
258 void HOMARD_Iteration_i::SetFieldInterp( const char* FieldInterp )
259 {
260   myHomardIteration->SetFieldInterp( FieldInterp );
261 }
262 //=============================================================================
263 ADAPT::listeFieldInterpsIter* HOMARD_Iteration_i::GetFieldInterps()
264 {
265   ASSERT( myHomardIteration );
266   const std::list<std::string>& ListString = myHomardIteration->GetFieldInterps();
267   ADAPT::listeFieldInterpsIter_var aResult = new ADAPT::listeFieldInterpsIter;
268   aResult->length( ListString.size() );
269   std::list<std::string>::const_iterator it;
270   int i = 0;
271   for ( it = ListString.begin(); it != ListString.end(); it++ )
272   {
273     aResult[i++] = CORBA::string_dup( (*it).c_str() );
274   }
275   return aResult._retn();
276 }
277 //=============================================================================
278 void HOMARD_Iteration_i::SupprFieldInterps()
279 {
280   ASSERT( myHomardIteration );
281   myHomardIteration->SupprFieldInterps();
282 }
283 //=============================================================================
284 void HOMARD_Iteration_i::SetLogFile( const char* LogFile )
285 {
286   ASSERT( myHomardIteration );
287   myHomardIteration->SetLogFile( LogFile );
288 }
289 //=============================================================================
290 char* HOMARD_Iteration_i::GetLogFile()
291 {
292   ASSERT( myHomardIteration );
293   return CORBA::string_dup( myHomardIteration->GetLogFile().c_str() );
294 }
295 //=============================================================================
296 CORBA::Long HOMARD_Iteration_i::Compute(CORBA::Long etatMenage, CORBA::Long Option)
297 {
298   MESSAGE ( "Compute : calcul d'une iteration, etatMenage = "<<etatMenage<<", Option = "<<Option );
299   ASSERT( myHomardIteration );
300 //
301 // Nom de l'iteration
302   char* IterName = GetName() ;
303   CORBA::Long modeHOMARD = 1 ;
304   CORBA::Long Option1 = 1 ;
305   MESSAGE ( "Compute : calcul de l'teration " << IterName );
306   return _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option1, Option) ;
307 }
308 //=============================================================================
309 void HOMARD_Iteration_i::MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte)
310 {
311   MESSAGE ( "MeshInfo : information sur le maillage associe a une iteration" );
312   ASSERT( myHomardIteration );
313 //
314   int Option = 1 ;
315   MeshInfoOption( Qual, Diam, Conn, Tail, Inte, Option ) ;
316 //
317   return ;
318 }
319 //=============================================================================
320 void HOMARD_Iteration_i::MeshInfoOption(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte, CORBA::Long Option)
321 {
322   MESSAGE ( "MeshInfoOption : information sur le maillage associe a une iteration" );
323   ASSERT( myHomardIteration );
324 //
325 // Nom de l'iteration
326   char* IterName = GetName() ;
327   CORBA::Long etatMenage = -1 ;
328   CORBA::Long modeHOMARD = 7 ;
329   if ( Qual != 0 ) { modeHOMARD = modeHOMARD*5 ; }
330   if ( Diam != 0 ) { modeHOMARD = modeHOMARD*19 ; }
331   if ( Conn != 0 ) { modeHOMARD = modeHOMARD*11 ; }
332   if ( Tail != 0 ) { modeHOMARD = modeHOMARD*13 ; }
333   if ( Inte != 0 ) { modeHOMARD = modeHOMARD*3 ; }
334   MESSAGE ( "MeshInfoOption : information sur le maillage de l'iteration " << IterName );
335   CORBA::Long Option2 = 1 ;
336   CORBA::Long codret = _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option, Option2) ;
337   MESSAGE ( "MeshInfoOption : codret = " << codret );
338 //
339   return ;
340 }
341 //=============================================================================
342 void HOMARD_Iteration_i::SetFileInfo( const char* FileInfo )
343 {
344   ASSERT( myHomardIteration );
345   myHomardIteration->SetFileInfo( FileInfo );
346 }
347 //=============================================================================
348 char* HOMARD_Iteration_i::GetFileInfo()
349 {
350   ASSERT( myHomardIteration );
351   return CORBA::string_dup( myHomardIteration->GetFileInfo().c_str() );
352 }
353 //=============================================================================
354 //=============================================================================
355 // Liens avec les autres iterations
356 //=============================================================================
357 //=============================================================================
358 ADAPT::HOMARD_Iteration_ptr HOMARD_Iteration_i::NextIteration( const char* IterName )
359 {
360 // Nom de l'iteration parent
361   char* NomIterParent = GetName() ;
362   MESSAGE ( "NextIteration : creation de l'iteration " << IterName << " comme fille de " << NomIterParent );
363   return _gen_i->CreateIteration(IterName, NomIterParent) ;
364 }
365 //=============================================================================
366 void HOMARD_Iteration_i::LinkNextIteration( const char* NomIteration )
367 {
368   ASSERT( myHomardIteration );
369   myHomardIteration->LinkNextIteration( NomIteration );
370 }
371 //=============================================================================
372 void HOMARD_Iteration_i::UnLinkNextIteration( const char* NomIteration )
373 {
374   ASSERT( myHomardIteration );
375   myHomardIteration->UnLinkNextIteration( NomIteration );
376 }
377 //=============================================================================
378 ADAPT::listeIterFilles* HOMARD_Iteration_i::GetIterations()
379 {
380   ASSERT( myHomardIteration );
381   const std::list<std::string>& maListe = myHomardIteration->GetIterations();
382   ADAPT::listeIterFilles_var aResult = new ADAPT::listeIterFilles;
383   aResult->length( maListe.size() );
384   std::list<std::string>::const_iterator it;
385   int i = 0;
386   for ( it = maListe.begin(); it != maListe.end(); it++ )
387   {
388     aResult[i++] = CORBA::string_dup( (*it).c_str() );
389   }
390   return aResult._retn();
391 }
392 //=============================================================================
393 void HOMARD_Iteration_i::SetIterParentName( const char* NomIterParent )
394 {
395   ASSERT( myHomardIteration );
396   myHomardIteration->SetIterParentName( NomIterParent );
397 }
398 //=============================================================================
399 char* HOMARD_Iteration_i::GetIterParentName()
400 {
401   ASSERT( myHomardIteration );
402   return CORBA::string_dup( myHomardIteration->GetIterParentName().c_str() );
403 }
404 //=============================================================================
405 ADAPT::HOMARD_Iteration_ptr HOMARD_Iteration_i::GetIterParent()
406 {
407 // Nom de l'iteration parent
408   char* NomIterParent = GetIterParentName() ;
409   MESSAGE ( "GetIterParent : NomIterParent = " << NomIterParent );
410   return _gen_i->GetIteration(NomIterParent) ;
411 }
412 //=============================================================================
413 //=============================================================================
414 // Liens avec les autres structures
415 //=============================================================================
416 //=============================================================================
417 void HOMARD_Iteration_i::SetCaseName( const char* NomCas )
418 {
419   ASSERT( myHomardIteration );
420   myHomardIteration->SetCaseName( NomCas );
421 }
422 //=============================================================================
423 char* HOMARD_Iteration_i::GetCaseName()
424 {
425   ASSERT( myHomardIteration );
426   return CORBA::string_dup( myHomardIteration->GetCaseName().c_str() );
427 }
428 //=============================================================================
429 void HOMARD_Iteration_i::AssociateHypo( const char* NomHypo )
430 {
431   ASSERT( myHomardIteration );
432 //
433 // Nom de l'iteration
434   char* IterName = GetName() ;
435   MESSAGE ( ". IterName = " << IterName );
436   return _gen_i->AssociateIterHypo(IterName, NomHypo) ;
437 }
438 //=============================================================================
439 void HOMARD_Iteration_i::SetHypoName( const char* NomHypo )
440 {
441   ASSERT( myHomardIteration );
442   myHomardIteration->SetHypoName( NomHypo );
443 }
444 //=============================================================================
445 char* HOMARD_Iteration_i::GetHypoName()
446 {
447   ASSERT( myHomardIteration );
448   return CORBA::string_dup( myHomardIteration->GetHypoName().c_str() );
449 }
450 //=============================================================================
451 //=============================================================================
452 // Divers
453 //=============================================================================
454 //=============================================================================
455 void HOMARD_Iteration_i::SetInfoCompute( CORBA::Long MessInfo )
456 {
457   ASSERT( myHomardIteration );
458   myHomardIteration->SetInfoCompute( MessInfo );
459 }
460 //=============================================================================
461 CORBA::Long HOMARD_Iteration_i::GetInfoCompute()
462 {
463   ASSERT( myHomardIteration );
464   return myHomardIteration->GetInfoCompute() ;
465 }