Salome HOME
bos #26453: SMESH: uniform refinement
[modules/smesh.git] / src / SMESH / SMESH_Homard.hxx
1 //  HOMARD HOMARD : implementation of HOMARD idl descriptions
2 //
3 // Copyright (C) 2011-2021  CEA/DEN, EDF R&D
4 //
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.
9 //
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.
14 //
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
18 //
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21 //  File   : HOMARD.hxx
22 //  Author : Gerald NICOLAS, EDF
23 //  Module : HOMARD
24
25 #ifndef _SMESH_HOMARD_ADAPT_HXX_
26 #define _SMESH_HOMARD_ADAPT_HXX_
27
28 #include "SMESH_SMESH.hxx"
29
30 #include <vector>
31 #include <string>
32 #include <list>
33
34 #include <iostream>
35 #include <fstream>
36
37 #if defined WIN32
38 #pragma warning ( disable: 4251 )
39 #endif
40
41 namespace SMESHHOMARDImpl
42 {
43
44 class SMESH_EXPORT HOMARD_Boundary
45 {
46 public:
47   HOMARD_Boundary();
48   ~HOMARD_Boundary();
49
50   // Generalites
51   void                          SetName( const char* Name );
52   std::string                   GetName() const;
53
54   std::string                   GetDumpPython() const;
55
56   // Caracteristiques
57   void                          SetType( int Type );
58   int                           GetType() const;
59
60   void                          SetMeshName( const char* MeshName );
61   std::string                   GetMeshName() const;
62
63   void                          SetDataFile( const char* DataFile );
64   std::string                   GetDataFile() const;
65
66   void                          SetCylinder( double X0, double X1, double X2, double X3,
67                                              double X4, double X5, double X6 );
68   void                          SetSphere( double X0, double X1, double X2, double X3 );
69   void                          SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1,
70                                           double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2);
71   void                          SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle,
72                                           double Xcentre, double Ycentre, double ZCentre);
73   void                          SetTorus( double X0, double X1, double X2, double X3,
74                                              double X4, double X5, double X6, double X7 );
75
76   std::vector<double>           GetCoords() const;
77
78   void                          SetLimit( double X0, double X1, double X2 );
79   std::vector<double>           GetLimit() const;
80
81   void                          AddGroup( const char* LeGroupe);
82   void                          SetGroups(const std::list<std::string>& ListGroup );
83   const std::list<std::string>& GetGroups() const;
84
85 private:
86   std::string                   _Name;
87   std::string                   _DataFile;
88   std::string                   _MeshName;
89   int                           _Type;
90   double                        _Xmin, _Xmax, _Ymin, _Ymax, _Zmin, _Zmax;
91   double                        _Xaxe, _Yaxe, _Zaxe;
92   double                        _Xcentre, _Ycentre, _Zcentre, _rayon;
93   double                        _Xincr, _Yincr, _Zincr;
94   double                        _Xcentre1, _Ycentre1, _Zcentre1, _Rayon1;
95   double                        _Xcentre2, _Ycentre2, _Zcentre2, _Rayon2;
96   double                        _Angle;
97
98   std::list<std::string>        _ListGroupSelected;
99 };
100
101 class SMESH_EXPORT HOMARD_Cas
102 {
103 public:
104   HOMARD_Cas();
105   ~HOMARD_Cas();
106
107   // Generalites
108   std::string                   GetDumpPython() const;
109
110   // Caracteristiques
111   int                           SetDirName( const char* NomDir );
112   std::string                   GetDirName() const;
113
114   void                          SetBoundingBox( const std::vector<double>& extremas );
115   const std::vector<double>&    GetBoundingBox() const;
116
117   void                          AddGroup( const char* Group);
118   void                          SetGroups( const std::list<std::string>& ListGroup );
119   const std::list<std::string>& GetGroups() const;
120   void                          SupprGroups();
121
122   void                          AddBoundary( const char* Boundary );
123   void                          AddBoundaryGroup( const char* Boundary, const char* Group );
124   const std::list<std::string>& GetBoundaryGroup() const;
125   void                          SupprBoundaryGroup();
126
127   void                          AddIteration( const char* NomIteration );
128
129 private:
130   std::string                   _NomDir;
131   int                           _Etat;
132
133   std::vector<double>           _Boite;         // cf HomardQTCommun pour structure du vecteur
134   std::list<std::string>        _ListGroup;
135   std::list<std::string>        _ListBoundaryGroup;
136
137   typedef std::string           IterName;
138   typedef std::list<IterName>   IterNames;
139   IterNames                     _ListIter;
140 };
141
142 class SMESH_EXPORT HomardDriver
143 {
144 public:
145   HomardDriver(const std::string siter, const std::string siterp1);
146   ~HomardDriver();
147   //
148   void        TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue );
149   void        TexteInfo( int TypeBila, int NumeIter );
150   void        TexteMajCoords( int NumeIter );
151   void        CreeFichierDonn();
152   void        TexteAdap();
153   void        CreeFichier();
154   void        TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres );
155   void        TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres );
156   void        TexteConfRaffDera( int ConfType );
157
158   void        TexteBoundaryOption( int BoundaryOption );
159   void        TexteBoundaryCAOGr( const std::string GroupName );
160   void        TexteBoundaryDi( const std::string MeshName, const std::string MeshFile );
161   void        TexteBoundaryDiGr( const std::string GroupName );
162   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 );
163   void        TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName );
164
165   void        TexteAdvanced( int NivMax, double DiamMin, int AdapInit, int LevelOutput );
166   void        TexteInfoCompute( int MessInfo );
167   //
168   int         ExecuteHomard();
169
170 public:
171   int         _modeHOMARD;
172   std::string _HOMARD_Exec;
173   std::string _NomDir;
174   std::string _NomFichierConfBase;
175   std::string _NomFichierConf;
176   std::string _NomFichierDonn;
177   std::string _siter;
178   std::string _siterp1;
179   std::string _Texte;
180   bool _bLu;
181 };
182
183 class HOMARD_Iteration;
184
185 class SMESH_EXPORT HOMARD_Gen
186 {
187 public :
188   HOMARD_Gen();
189   ~HOMARD_Gen();
190 };
191
192 class SMESH_EXPORT HOMARD_Iteration
193 {
194 public:
195   HOMARD_Iteration();
196   ~HOMARD_Iteration();
197
198   // Generalites
199   void                          SetName( const char* Name );
200   std::string                   GetName() const;
201
202   // Caracteristiques
203   void                          SetDirNameLoc( const char* NomDir );
204   std::string                   GetDirNameLoc() const;
205
206   void                          SetNumber( int NumIter );
207   int                           GetNumber() const;
208
209   void                          SetState( int etat );
210   int                           GetState() const;
211
212   void                          SetMeshName( const char* NomMesh );
213   std::string                   GetMeshName() const;
214
215   void                          SetMeshFile( const char* MeshFile );
216   std::string                   GetMeshFile() const;
217
218   void                          SetLogFile( const char* LogFile );
219   std::string                   GetLogFile() const;
220
221   void                          SetFileInfo( const char* FileInfo );
222   std::string                   GetFileInfo() const;
223
224   // Divers
225   void                          SetInfoCompute( int MessInfo );
226   int                           GetInfoCompute() const;
227
228 private:
229   std::string                   _Name;
230   int                           _Etat;
231   int                           _NumIter;
232   std::string                   _NomMesh;
233   std::string                   _MeshFile;
234   std::string                   _LogFile;
235   std::string                   _NomDir;
236   std::string                   _FileInfo;
237   int                           _MessInfo;
238 };
239
240 }; // namespace SMESHHOMARDImpl
241
242 #endif