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 SetBoundingBox( const std::vector<double>& extremas );
152 const std::vector<double>& GetBoundingBox() const;
154 void AddGroup( const char* Group);
155 void SetGroups( const std::list<std::string>& ListGroup );
156 const std::list<std::string>& GetGroups() const;
159 void AddBoundary( const char* Boundary );
160 void AddBoundaryGroup( const char* Boundary, const char* Group );
161 const std::list<std::string>& GetBoundaryGroup() const;
162 void SupprBoundaryGroup();
164 // Liens avec les autres structures
165 std::string GetIter0Name() const;
167 void AddIteration( const char* NomIteration );
168 const std::list<std::string>& GetIterations() const;
169 void SupprIterations();
177 std::vector<double> _Boite; // cf HomardQTCommun pour structure du vecteur
178 std::list<std::string> _ListGroup;
179 std::list<std::string> _ListBoundaryGroup;
181 typedef std::string IterName;
182 typedef std::list<IterName> IterNames;
186 class HOMARDIMPL_EXPORT HomardDriver
189 HomardDriver(const std::string siter, const std::string siterp1);
192 void TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue );
193 void TexteInfo( int TypeBila, int NumeIter );
194 void TexteMajCoords( int NumeIter );
195 void CreeFichierDonn();
198 void TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres );
199 void TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres );
200 void TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera );
201 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 );
202 void TexteGroup( const std::string GroupName );
203 void TexteField( const std::string FieldName, const std::string FieldFile,
204 int TimeStep, int Rank,
205 int TypeThR, double ThreshR, int TypeThC, double ThreshC,
206 int UsField, int UsCmpI );
207 void TexteCompo( int NumeComp, const std::string NomCompo);
209 void TexteBoundaryOption( int BoundaryOption );
210 void TexteBoundaryCAOGr( const std::string GroupName );
211 void TexteBoundaryDi( const std::string MeshName, const std::string MeshFile );
212 void TexteBoundaryDiGr( const std::string GroupName );
213 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 );
214 void TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName );
216 void TexteFieldInterp( const std::string FieldFile, const std::string MeshFile );
217 void TexteFieldInterpAll();
218 void TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank );
219 void TexteAdvanced( int NivMax, double DiamMin, int AdapInit, int LevelOutput );
220 void TexteInfoCompute( int MessInfo );
226 std::string _HOMARD_Exec;
228 std::string _NomFichierConfBase;
229 std::string _NomFichierConf;
230 std::string _NomFichierDonn;
232 std::string _siterp1;
239 class HOMARD_Iteration;
240 class HOMARD_Hypothesis;
242 //! persistence entity type
243 typedef enum { Case, Zone, Hypothesis, Iteration, Boundary } SignatureType;
245 //! get persistence signature
246 HOMARDIMPL_EXPORT std::string GetSignature( SignatureType type );
248 //! get data separator
249 HOMARDIMPL_EXPORT std::string separator();
251 //! dump boundary to the string
252 HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Boundary& boundary );
253 //! dump case to the string
254 HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Cas& cas );
255 //! dump iteration to the string
256 HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Iteration& iteration );
257 //! dump hypothesis to the string
258 HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Hypothesis& hypothesis );
260 //! restore boundary from the string
261 HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Boundary& boundary, const std::string& stream );
262 //! restore case from the string
263 HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Cas& cas, const std::string& stream );
264 //! restore hypothesis from the string
265 HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Hypothesis& hypothesis, const std::string& stream );
266 //! restore iteration from the string
267 HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Iteration& iteration, const std::string& stream );
269 class HOMARDIMPL_EXPORT HOMARD_Gen
276 class HOMARDIMPL_EXPORT HOMARD_Hypothesis
280 ~HOMARD_Hypothesis();
283 void SetName( const char* Name );
284 std::string GetName() const;
287 void SetAdapType( int TypeAdap );
288 int GetAdapType() const;
289 void SetRefinTypeDera( int TypeRaff, int TypeDera );
290 int GetRefinType() const;
291 int GetUnRefType() const;
293 void SetField( const char* FieldName );
294 std::string GetFieldName() const;
295 void SetUseField( int UsField );
296 int GetUseField() const;
298 void SetUseComp( int UsCmpI );
299 int GetUseComp() const;
300 void AddComp( const char* NomComp );
301 void SupprComp( const char* NomComp );
303 const std::list<std::string>& GetComps() const;
305 void SetRefinThr( int TypeThR, double ThreshR );
306 int GetRefinThrType() const;
307 double GetThreshR() const;
308 void SetUnRefThr( int TypeThC, double ThreshC );
309 int GetUnRefThrType() const;
310 double GetThreshC() const;
312 void SetNivMax( int NivMax );
313 const int GetNivMax() const;
315 void SetDiamMin( double DiamMin );
316 const double GetDiamMin() const;
318 void SetAdapInit( int AdapInit );
319 const int GetAdapInit() const;
321 void SetExtraOutput( int ExtraOutput );
322 const int GetExtraOutput() const;
324 void AddGroup( const char* Group);
325 void SupprGroup( const char* Group );
327 void SetGroups(const std::list<std::string>& ListGroup );
328 const std::list<std::string>& GetGroups() const;
330 void SetTypeFieldInterp( int TypeFieldInterp );
331 int GetTypeFieldInterp() const;
332 void AddFieldInterpType( const char* FieldInterp, int TypeInterp );
333 void SupprFieldInterp( const char* FieldInterp );
334 void SupprFieldInterps();
335 const std::list<std::string>& GetFieldInterps() const;
337 // Liens avec les autres structures
338 void SetCaseCreation( const char* NomCasCreation );
339 std::string GetCaseCreation() const;
341 void LinkIteration( const char* NomIter );
342 void UnLinkIteration( const char* NomIter );
343 void UnLinkIterations();
344 const std::list<std::string>& GetIterations() const;
346 void AddZone( const char* NomZone, int TypeUse );
347 void SupprZone( const char* NomZone );
349 const std::list<std::string>& GetZones() const;
353 std::string _NomCasCreation;
355 int _TypeAdap; // -1 pour une adapation Uniforme,
356 // 0 si l adaptation depend des zones,
369 int _TypeFieldInterp; // 0 pour aucune interpolation,
370 // 1 pour interpolation de tous les champs,
377 std::list<std::string> _ListIter;
378 std::list<std::string> _ListZone;
379 std::list<std::string> _ListComp;
380 std::list<std::string> _ListGroupSelected;
381 std::list<std::string> _ListFieldInterp;
384 class HOMARDIMPL_EXPORT HOMARD_Iteration
391 void SetName( const char* Name );
392 std::string GetName() const;
395 void SetDirNameLoc( const char* NomDir );
396 std::string GetDirNameLoc() const;
398 void SetNumber( int NumIter );
399 int GetNumber() const;
401 void SetState( int etat );
402 int GetState() const;
404 void SetMeshName( const char* NomMesh );
405 std::string GetMeshName() const;
407 void SetMeshFile( const char* MeshFile );
408 std::string GetMeshFile() const;
410 void SetFieldFile( const char* FieldFile );
411 std::string GetFieldFile() const;
412 // Instants pour le champ de pilotage
413 void SetTimeStep( int TimeStep );
414 void SetTimeStepRank( int TimeStep, int Rank );
415 void SetTimeStepRankLast();
416 int GetTimeStep() const;
418 // Instants pour un champ a interpoler
419 void SetFieldInterpTimeStep( const char* FieldInterp, int TimeStep );
420 void SetFieldInterpTimeStepRank( const char* FieldInterp, int TimeStep, int Rank );
421 const std::list<std::string>& GetFieldInterpsTimeStepRank() const;
422 void SetFieldInterp( const char* FieldInterp );
423 const std::list<std::string>& GetFieldInterps() const;
424 void SupprFieldInterps();
426 void SetLogFile( const char* LogFile );
427 std::string GetLogFile() const;
429 void SetFileInfo( const char* FileInfo );
430 std::string GetFileInfo() const;
432 // Liens avec les autres iterations
433 void LinkNextIteration( const char* NomIteration );
434 void UnLinkNextIteration( const char* NomIteration );
435 void UnLinkNextIterations();
436 const std::list<std::string>& GetIterations() const;
438 void SetIterParentName( const char* iterParent );
439 std::string GetIterParentName() const;
441 // Liens avec les autres structures
442 void SetCaseName( const char* NomCas );
443 std::string GetCaseName() const;
445 void SetHypoName( const char* NomHypo );
446 std::string GetHypoName() const;
449 void SetInfoCompute( int MessInfo );
450 int GetInfoCompute() const;
456 std::string _NomMesh;
457 std::string _MeshFile;
458 std::string _FieldFile;
461 std::string _LogFile;
462 std::string _IterParent;
463 std::string _NomHypo;
466 std::list<std::string> _mesIterFilles;
467 std::string _FileInfo;
469 // La liste des champs retenus par l'hypothese
470 std::list<std::string> _ListFieldInterp;
471 // La liste des triplets (champs, pas de temps, numero d'ordre) retenus par l'iteration
472 std::list<std::string> _ListFieldInterpTSR;
475 }; // namespace SMESHHOMARDImpl