1 // HOMARD HOMARD : implementation of HOMARD idl descriptions
3 // Copyright (C) 2011-2021 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, or (at your option) any later version.
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
22 // Author : Gerald NICOLAS, EDF
25 #ifndef _SMESH_HOMARD_ADAPT_HXX_
26 #define _SMESH_HOMARD_ADAPT_HXX_
28 // C'est le ASSERT de SALOMELocalTrace/utilities.h dans KERNEL
30 #define VERIFICATION(condition) \
31 if (!(condition)){INTERRUPTION("CONDITION "<<#condition<<" NOT VERIFIED")}
32 #endif /* VERIFICATION */
35 #if defined HOMARDIMPL_EXPORTS || defined HOMARDImpl_EXPORTS
36 #define HOMARDIMPL_EXPORT __declspec( dllexport )
38 #define HOMARDIMPL_EXPORT __declspec( dllimport )
41 #define HOMARDIMPL_EXPORT
44 // La gestion des repertoires
61 #pragma warning ( disable: 4251 )
64 namespace SMESHHOMARDImpl
67 class HOMARDIMPL_EXPORT HOMARD_Boundary
74 void SetName( const char* Name );
75 std::string GetName() const;
77 std::string GetDumpPython() const;
80 void SetType( int Type );
83 void SetMeshName( const char* MeshName );
84 std::string GetMeshName() const;
86 void SetDataFile( const char* DataFile );
87 std::string GetDataFile() const;
89 void SetCylinder( double X0, double X1, double X2, double X3,
90 double X4, double X5, double X6 );
91 void SetSphere( double X0, double X1, double X2, double X3 );
92 void SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1,
93 double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2);
94 void SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle,
95 double Xcentre, double Ycentre, double ZCentre);
96 void SetTorus( double X0, double X1, double X2, double X3,
97 double X4, double X5, double X6, double X7 );
99 std::vector<double> GetCoords() const;
101 void SetLimit( double X0, double X1, double X2 );
102 std::vector<double> GetLimit() const;
104 void AddGroup( const char* LeGroupe);
105 void SetGroups(const std::list<std::string>& ListGroup );
106 const std::list<std::string>& GetGroups() const;
108 // Liens avec les autres structures
109 std::string GetCaseCreation() const;
110 void SetCaseCreation( const char* NomCasCreation );
114 std::string _NomCasCreation;
115 std::string _DataFile;
116 std::string _MeshName;
118 double _Xmin, _Xmax, _Ymin, _Ymax, _Zmin, _Zmax;
119 double _Xaxe, _Yaxe, _Zaxe;
120 double _Xcentre, _Ycentre, _Zcentre, _rayon;
121 double _Xincr, _Yincr, _Zincr;
122 double _Xcentre1, _Ycentre1, _Zcentre1, _Rayon1;
123 double _Xcentre2, _Ycentre2, _Zcentre2, _Rayon2;
126 std::list<std::string> _ListGroupSelected;
130 class HOMARDIMPL_EXPORT HOMARD_Cas
137 void SetName( const char* Name );
138 std::string GetName() const;
140 std::string GetDumpPython() const;
143 int SetDirName( const char* NomDir );
144 std::string GetDirName() const;
146 int GetNumberofIter();
148 void SetConfType( int ConfType );
149 const int GetConfType() const;
151 void SetExtType( int ExtType );
152 const int GetExtType() const;
154 void SetBoundingBox( const std::vector<double>& extremas );
155 const std::vector<double>& GetBoundingBox() const;
157 void AddGroup( const char* Group);
158 void SetGroups( const std::list<std::string>& ListGroup );
159 const std::list<std::string>& GetGroups() const;
162 void AddBoundary( const char* Boundary );
163 void AddBoundaryGroup( const char* Boundary, const char* Group );
164 const std::list<std::string>& GetBoundaryGroup() const;
165 void SupprBoundaryGroup();
167 void SetPyram( int Pyram );
168 const int GetPyram() const;
170 // Liens avec les autres structures
171 std::string GetIter0Name() const;
173 void AddIteration( const char* NomIteration );
174 const std::list<std::string>& GetIterations() const;
175 void SupprIterations();
184 std::vector<double> _Boite; // cf HomardQTCommun pour structure du vecteur
185 std::list<std::string> _ListGroup;
186 std::list<std::string> _ListBoundaryGroup;
190 typedef std::string IterName;
191 typedef std::list<IterName> IterNames;
195 class HOMARDIMPL_EXPORT HomardDriver
198 HomardDriver(const std::string siter, const std::string siterp1);
201 void TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue );
202 void TexteInfo( int TypeBila, int NumeIter );
203 void TexteMajCoords( int NumeIter );
204 void CreeFichierDonn();
205 void TexteAdap( int ExtType );
207 void TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres );
208 void TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres );
209 void TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera );
210 void TexteZone( int NumeZone, int ZoneType, int TypeUse, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8 );
211 void TexteGroup( const std::string GroupName );
212 void TexteField( const std::string FieldName, const std::string FieldFile,
213 int TimeStep, int Rank,
214 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
215 int UsField, int UsCmpI );
216 void TexteCompo( int NumeComp, const std::string NomCompo);
218 void TexteBoundaryOption( int BoundaryOption );
219 void TexteBoundaryCAOGr( const std::string GroupName );
220 void TexteBoundaryDi( const std::string MeshName, const std::string MeshFile );
221 void TexteBoundaryDiGr( const std::string GroupName );
222 void TexteBoundaryAn( const std::string NameBoundary, int NumeBoundary, int BoundaryType, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7 );
223 void TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName );
225 void TexteFieldInterp( const std::string FieldFile, const std::string MeshFile );
226 void TexteFieldInterpAll();
227 void TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank );
228 void TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput );
229 void TexteInfoCompute( int MessInfo );
231 int ExecuteHomard(int option);
236 std::string _HOMARD_Exec;
238 std::string _NomFichierConfBase;
239 std::string _NomFichierConf;
240 std::string _NomFichierDonn;
242 std::string _siterp1;
249 class HOMARD_Iteration;
250 class HOMARD_Hypothesis;
252 //! persistence entity type
253 typedef enum { Case, Zone, Hypothesis, Iteration, Boundary } SignatureType;
255 //! get persistence signature
256 HOMARDIMPL_EXPORT std::string GetSignature( SignatureType type );
258 //! get data separator
259 HOMARDIMPL_EXPORT std::string separator();
261 //! dump boundary to the string
262 HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Boundary& boundary );
263 //! dump case to the string
264 HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Cas& cas );
265 //! dump iteration to the string
266 HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Iteration& iteration );
267 //! dump hypothesis to the string
268 HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Hypothesis& hypothesis );
270 //! restore boundary from the string
271 HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Boundary& boundary, const std::string& stream );
272 //! restore case from the string
273 HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Cas& cas, const std::string& stream );
274 //! restore hypothesis from the string
275 HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Hypothesis& hypothesis, const std::string& stream );
276 //! restore iteration from the string
277 HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Iteration& iteration, const std::string& stream );
279 class HOMARDIMPL_EXPORT HOMARD_Gen
286 class HOMARDIMPL_EXPORT HOMARD_Hypothesis
290 ~HOMARD_Hypothesis();
293 void SetName( const char* Name );
294 std::string GetName() const;
296 std::string GetDumpPython() const;
299 void SetAdapType( int TypeAdap );
300 int GetAdapType() const;
301 void SetRefinTypeDera( int TypeRaff, int TypeDera );
302 int GetRefinType() const;
303 int GetUnRefType() const;
305 void SetField( const char* FieldName );
306 std::string GetFieldName() const;
307 void SetUseField( int UsField );
308 int GetUseField() const;
310 void SetUseComp( int UsCmpI );
311 int GetUseComp() const;
312 void AddComp( const char* NomComp );
313 void SupprComp( const char* NomComp );
315 const std::list<std::string>& GetComps() const;
317 void SetRefinThr( int TypeThR, double ThreshR );
318 int GetRefinThrType() const;
319 double GetThreshR() const;
320 void SetUnRefThr( int TypeThC, double ThreshC );
321 int GetUnRefThrType() const;
322 double GetThreshC() const;
324 void SetNivMax( int NivMax );
325 const int GetNivMax() const;
327 void SetDiamMin( double DiamMin );
328 const double GetDiamMin() const;
330 void SetAdapInit( int AdapInit );
331 const int GetAdapInit() const;
333 void SetExtraOutput( int ExtraOutput );
334 const int GetExtraOutput() const;
336 void AddGroup( const char* Group);
337 void SupprGroup( const char* Group );
339 void SetGroups(const std::list<std::string>& ListGroup );
340 const std::list<std::string>& GetGroups() const;
342 void SetTypeFieldInterp( int TypeFieldInterp );
343 int GetTypeFieldInterp() const;
344 void AddFieldInterpType( const char* FieldInterp, int TypeInterp );
345 void SupprFieldInterp( const char* FieldInterp );
346 void SupprFieldInterps();
347 const std::list<std::string>& GetFieldInterps() const;
349 // Liens avec les autres structures
350 void SetCaseCreation( const char* NomCasCreation );
351 std::string GetCaseCreation() const;
353 void LinkIteration( const char* NomIter );
354 void UnLinkIteration( const char* NomIter );
355 void UnLinkIterations();
356 const std::list<std::string>& GetIterations() const;
358 void AddZone( const char* NomZone, int TypeUse );
359 void SupprZone( const char* NomZone );
361 const std::list<std::string>& GetZones() const;
365 std::string _NomCasCreation;
367 int _TypeAdap; // -1 pour une adapation Uniforme,
368 // 0 si l adaptation depend des zones,
381 int _TypeFieldInterp; // 0 pour aucune interpolation,
382 // 1 pour interpolation de tous les champs,
389 std::list<std::string> _ListIter;
390 std::list<std::string> _ListZone;
391 std::list<std::string> _ListComp;
392 std::list<std::string> _ListGroupSelected;
393 std::list<std::string> _ListFieldInterp;
396 class HOMARDIMPL_EXPORT HOMARD_Iteration
403 void SetName( const char* Name );
404 std::string GetName() const;
406 std::string GetDumpPython() const;
409 void SetDirNameLoc( const char* NomDir );
410 std::string GetDirNameLoc() const;
412 void SetNumber( int NumIter );
413 int GetNumber() const;
415 void SetState( int etat );
416 int GetState() const;
418 void SetMeshName( const char* NomMesh );
419 std::string GetMeshName() const;
421 void SetMeshFile( const char* MeshFile );
422 std::string GetMeshFile() const;
424 void SetFieldFile( const char* FieldFile );
425 std::string GetFieldFile() const;
426 // Instants pour le champ de pilotage
427 void SetTimeStep( int TimeStep );
428 void SetTimeStepRank( int TimeStep, int Rank );
429 void SetTimeStepRankLast();
430 int GetTimeStep() const;
432 // Instants pour un champ a interpoler
433 void SetFieldInterpTimeStep( const char* FieldInterp, int TimeStep );
434 void SetFieldInterpTimeStepRank( const char* FieldInterp, int TimeStep, int Rank );
435 const std::list<std::string>& GetFieldInterpsTimeStepRank() const;
436 void SetFieldInterp( const char* FieldInterp );
437 const std::list<std::string>& GetFieldInterps() const;
438 void SupprFieldInterps();
440 void SetLogFile( const char* LogFile );
441 std::string GetLogFile() const;
443 void SetFileInfo( const char* FileInfo );
444 std::string GetFileInfo() const;
446 // Liens avec les autres iterations
447 void LinkNextIteration( const char* NomIteration );
448 void UnLinkNextIteration( const char* NomIteration );
449 void UnLinkNextIterations();
450 const std::list<std::string>& GetIterations() const;
452 void SetIterParentName( const char* iterParent );
453 std::string GetIterParentName() const;
455 // Liens avec les autres structures
456 void SetCaseName( const char* NomCas );
457 std::string GetCaseName() const;
459 void SetHypoName( const char* NomHypo );
460 std::string GetHypoName() const;
463 void SetInfoCompute( int MessInfo );
464 int GetInfoCompute() const;
470 std::string _NomMesh;
471 std::string _MeshFile;
472 std::string _FieldFile;
475 std::string _LogFile;
476 std::string _IterParent;
477 std::string _NomHypo;
480 std::list<std::string> _mesIterFilles;
481 std::string _FileInfo;
483 // La liste des champs retenus par l'hypothese
484 std::list<std::string> _ListFieldInterp;
485 // La liste des triplets (champs, pas de temps, numero d'ordre) retenus par l'iteration
486 std::list<std::string> _ListFieldInterpTSR;
489 }; // namespace SMESHHOMARDImpl