Salome HOME
Debug, example
[modules/smesh.git] / src / SMESH_I / SMESH_Homard_i.hxx
1 // Copyright (C) 2011-2021  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 #ifndef _SMESH_HOMARD_I_HXX_
21 #define _SMESH_HOMARD_I_HXX_
22
23 #include <SALOMEconfig.h>
24 #include CORBA_SERVER_HEADER(SMESH_Homard)
25 #include CORBA_CLIENT_HEADER(SALOMEDS)
26 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
27 #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
28 #include CORBA_CLIENT_HEADER(SMESH_Gen)
29 #include CORBA_CLIENT_HEADER(SMESH_Mesh)
30
31 #include "SMESH.hxx"
32 #include "SMESH_Homard.hxx"
33 //#include "FrontTrack.hxx"
34 #include "SALOME_Component_i.hxx"
35 #include "SALOME_NamingService.hxx"
36 #include "Utils_CorbaException.hxx"
37
38 #include <map>
39 #include <set>
40 #include <string>
41 #include <vector>
42
43 namespace SMESHHOMARD_I
44 {
45
46 class SMESH_I_EXPORT HOMARD_Boundary_i : public virtual SALOME::GenericObj_i,
47                                          public virtual POA_SMESHHOMARD::HOMARD_Boundary
48 {
49 public:
50   HOMARD_Boundary_i(SMESHHOMARD::HOMARD_Gen_var gen_i);
51   HOMARD_Boundary_i();
52
53   virtual ~HOMARD_Boundary_i();
54
55   // Generalites
56   void                   SetName(const char* Name);
57   char*                  GetName();
58
59   char*                  GetDumpPython();
60
61   // Caracteristiques
62   void                   SetType(CORBA::Long Type);
63   CORBA::Long            GetType();
64
65   void                   SetMeshName(const char* MeshName);
66   char*                  GetMeshName();
67
68   void                   SetDataFile(const char* DataFile);
69   char*                  GetDataFile();
70
71   void                   SetCylinder(double Xcentre, double Ycentre, double ZCentre,
72                                       double Xaxe, double Yaxe, double Zaxe,
73                                       double rayon);
74   void                   SetSphere(double Xcentre, double Ycentre, double ZCentre,
75                                     double rayon);
76   void                   SetConeR(double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1,
77                                    double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2);
78   void                   SetConeA(double Xaxe, double Yaxe, double Zaxe, double Angle,
79                                    double Xcentre, double Ycentre, double ZCentre);
80   void                   SetTorus(double Xcentre, double Ycentre, double ZCentre,
81                                       double Xaxe, double Yaxe, double Zaxe,
82                                       double rayonRev, double rayonPri);
83
84   SMESHHOMARD::double_array*  GetCoords();
85
86   void                   SetLimit(double Xincr, double Yincr, double Zincr);
87   SMESHHOMARD::double_array*  GetLimit();
88
89   void                   AddGroup(const char* Group);
90   void                   SetGroups(const SMESHHOMARD::ListGroupType& ListGroup);
91   SMESHHOMARD::ListGroupType* GetGroups();
92
93   // Liens avec les autres structures
94   void  SetCaseCreation(const char* NomCaseCreation);
95   char* GetCaseCreation();
96
97
98 private:
99   SMESHHOMARDImpl::HOMARD_Boundary* myHomardBoundary;
100   SMESHHOMARD::HOMARD_Gen_var _gen_i;
101 };
102
103 class SMESH_I_EXPORT HOMARD_Cas_i : public virtual SALOME::GenericObj_i,
104                                     public virtual POA_SMESHHOMARD::HOMARD_Cas
105 {
106 public:
107   HOMARD_Cas_i(SMESHHOMARD::HOMARD_Gen_var gen_i);
108   HOMARD_Cas_i();
109
110   virtual ~HOMARD_Cas_i();
111
112   char* GetName();
113   char* GetDumpPython();
114
115   // Caracteristiques
116   void  SetDirName(const char* NomDir);
117   char* GetDirName();
118
119   void        SetConfType(CORBA::Long ConfType);
120   CORBA::Long GetConfType();
121
122   void                  SetBoundingBox(const SMESHHOMARD::extrema& LesExtremes);
123   SMESHHOMARD::extrema* GetBoundingBox();
124
125   void AddGroup(const char* Group);
126   void SetGroups(const SMESHHOMARD::ListGroupType& ListGroup);
127   SMESHHOMARD::ListGroupType* GetGroups();
128
129   void AddBoundary(const char* Boundary);
130   void AddBoundaryGroup(const char* Boundary, const char* Group);
131   SMESHHOMARD::ListBoundaryGroupType* GetBoundaryGroup();
132   void SupprBoundaryGroup();
133
134   void AddIteration(const char* NomIteration);
135
136 private:
137   SMESHHOMARDImpl::HOMARD_Cas* myHomardCas;
138   SMESHHOMARD::HOMARD_Gen_var _gen_i;
139 };
140
141 class SMESH_I_EXPORT HOMARD_Hypothesis_i : public virtual SALOME::GenericObj_i,
142                                            public virtual POA_SMESHHOMARD::HOMARD_Hypothesis
143 {
144 public:
145   HOMARD_Hypothesis_i(SMESHHOMARD::HOMARD_Gen_var gen_i);
146   HOMARD_Hypothesis_i();
147
148   virtual ~HOMARD_Hypothesis_i();
149
150   // Generalites
151   void SetExtraOutput(CORBA::Long ExtraOutput);
152   CORBA::Long GetExtraOutput();
153
154   void LinkIteration(const char* NomIteration);
155   void UnLinkIteration(const char* NomIteration);
156
157 private:
158   SMESHHOMARDImpl::HOMARD_Hypothesis* myHomardHypothesis;
159   SMESHHOMARD::HOMARD_Gen_var  _gen_i;
160 };
161
162 class SMESH_I_EXPORT HOMARD_Iteration_i : public virtual SALOME::GenericObj_i,
163                                           public virtual POA_SMESHHOMARD::HOMARD_Iteration
164 {
165 public:
166   HOMARD_Iteration_i(SMESHHOMARD::HOMARD_Gen_var gen_i);
167   HOMARD_Iteration_i();
168
169   virtual ~HOMARD_Iteration_i();
170
171   // Generalites
172   void                   SetName(const char* Name);
173   char*                  GetName();
174
175   // Caracteristiques
176   void                   SetDirNameLoc(const char* NomDir);
177   char*                  GetDirNameLoc();
178
179   char*                  GetDirName();
180
181   void                   SetNumber(CORBA::Long NumIter);
182   CORBA::Long            GetNumber();
183
184   void                   SetState(CORBA::Long etat);
185   CORBA::Long            GetState();
186
187   void                   SetMeshName(const char* NomMesh);
188   char*                  GetMeshName();
189
190   void                   SetMeshFile(const char* MeshFile);
191   char*                  GetMeshFile();
192
193   void                   SetLogFile(const char* LogFile);
194   char*                  GetLogFile();
195
196   void                   SetFileInfo(const char* FileInfo);
197   char*                  GetFileInfo();
198
199   // Liens avec les autres iterations
200   void                   LinkNextIteration(const char* NomIteration);
201   void                   UnLinkNextIteration(const char* NomIteration);
202
203   void                   SetIterParentName(const char* NomIterParent);
204   char*                  GetIterParentName();
205
206   // Liens avec les autres structures
207   void                   SetCaseName(const char* NomCas);
208   char*                  GetCaseName();
209
210   void                   SetHypoName(const char* NomHypo);
211
212   // Drivers
213   void                   SetInfoCompute(CORBA::Long MessInfo);
214   CORBA::Long            GetInfoCompute();
215
216 private:
217   SMESHHOMARDImpl::HOMARD_Iteration* myHomardIteration;
218   SMESHHOMARD::HOMARD_Gen_var _gen_i;
219 };
220
221 class SMESH_I_EXPORT HOMARD_Gen_i : public virtual SALOME::GenericObj_i,
222                                     public virtual POA_SMESHHOMARD::HOMARD_Gen
223 {
224 public:
225   HOMARD_Gen_i();
226   virtual ~HOMARD_Gen_i();
227
228   // Les creations
229   SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundary (const char* nomBoundary,
230                                                    CORBA::Long typeBoundary);
231   SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryCAO (const char* nomBoundary,
232                                                       const char* DataFile);
233   SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryDi (const char* nomBoundary,
234                                                      const char* MeshName, const char* DataFile);
235   SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryCylinder
236     (const char* nomBoundary,
237      CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
238      CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis,
239      CORBA::Double Rayon);
240   SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundarySphere
241     (const char* nomBoundary,
242      CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
243      CORBA::Double Rayon);
244   SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryConeR
245     (const char* nomBoundary,
246      CORBA::Double Xcentre1, CORBA::Double Ycentre1, CORBA::Double Zcentre1,
247      CORBA::Double Rayon1,
248      CORBA::Double Xcentre2, CORBA::Double Ycentre2, CORBA::Double Zcentre2,
249      CORBA::Double Rayon2);
250   SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryConeA
251     (const char* nomBoundary,
252      CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis,
253      CORBA::Double Angle,
254      CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre);
255   SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryTorus
256     (const char* nomBoundary,
257      CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
258      CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis,
259      CORBA::Double RayonRev, CORBA::Double RayonPri);
260
261   SMESHHOMARD::HOMARD_Cas_ptr CreateCaseOnMesh (const char* MeshName,
262                                                 SMESH::SMESH_Mesh_ptr smeshMesh,
263                                                 const char* theWorkingDir);
264   SMESHHOMARD::HOMARD_Cas_ptr CreateCase (const char* MeshName,
265                                           const char* FileName,
266                                           const char* theWorkingDir);
267
268   SMESHHOMARD::HOMARD_Iteration_ptr CreateIteration();
269
270   // Les informations
271   SMESHHOMARD::HOMARD_Boundary_ptr  GetBoundary  (const char* nomBoundary);
272   SMESHHOMARD::HOMARD_Cas_ptr       GetCase      ();
273   SMESHHOMARD::HOMARD_Iteration_ptr GetIteration (CORBA::Long numIter);
274
275   SMESHHOMARD::listeBoundarys* GetAllBoundarysName();
276
277   void InvalideBoundary(const char* nomBoundary);
278
279   CORBA::Long DeleteBoundary(const char* nomBoundary);
280   CORBA::Long DeleteCase();
281   CORBA::Long DeleteIteration(int numIter);
282
283   void AssociateCaseIter(int numIter, const char* labelIter);
284   char* CreateDirNameIter(const char* nomrep, CORBA::Long num);
285
286   CORBA::Long Compute();
287   CORBA::Long ComputeAdap(SMESHHOMARD::HOMARD_Cas_var myCase,
288                           SMESHHOMARD::HOMARD_Iteration_var myIteration,
289                           SMESHHOMARDImpl::HomardDriver* myDriver);
290   CORBA::Long ComputeCAO(SMESHHOMARD::HOMARD_Cas_var myCase,
291                          SMESHHOMARD::HOMARD_Iteration_var myIteration);
292   CORBA::Long ComputeCAObis(SMESHHOMARD::HOMARD_Iteration_var myIteration);
293   char* ComputeDirManagement(SMESHHOMARD::HOMARD_Cas_var myCase,
294                              SMESHHOMARD::HOMARD_Iteration_var myIteration);
295   char* ComputeDirPaManagement(SMESHHOMARD::HOMARD_Cas_var myCase,
296                                SMESHHOMARD::HOMARD_Iteration_var myIteration);
297   int   DriverTexteBoundary(SMESHHOMARD::HOMARD_Cas_var myCase,
298                             SMESHHOMARDImpl::HomardDriver* myDriver);
299
300   void PublishResultInSmesh(const char* NomFich, CORBA::Long Option);
301   void DeleteResultInSmesh(std::string NomFich, std::string MeshName);
302
303   void PythonDump();
304
305   // Preferences
306   void SetKeepMedOUT(bool theKeepMedOUT);
307   void SetPublishMeshOUT(bool thePublishMeshOUT);
308   void SetMeshNameOUT (const char* theMeshNameOUT);
309   void SetMeshFileOUT (const char* theMeshFileOUT);
310
311   void SetVerboseLevel (CORBA::Long theVerboseLevel);
312   void SetKeepWorkingFiles(bool theKeepWorkingFiles);
313   void SetLogInFile(bool theLogInFile);
314   void SetLogFile (const char* theLogFile);
315   void SetRemoveLogOnSuccess(bool theRemoveLogOnSuccess);
316
317 private:
318   SMESHHOMARD::HOMARD_Boundary_ptr  newBoundary();
319   SMESHHOMARD::HOMARD_Cas_ptr       newCase();
320   SMESHHOMARD::HOMARD_Iteration_ptr newIteration();
321   void CleanCase();
322
323 private:
324   SMESHHOMARDImpl::HOMARD_Gen* myHomard;
325   std::map<std::string, SMESHHOMARD::HOMARD_Boundary_var> _mesBoundarys;
326   SMESHHOMARD::HOMARD_Hypothesis_var myHypothesis;
327   SMESHHOMARD::HOMARD_Iteration_var  myIteration0;
328   SMESHHOMARD::HOMARD_Iteration_var  myIteration1;
329   SMESHHOMARD::HOMARD_Cas_var        myCase;
330
331   // Preferences
332   bool _KeepMedOUT;
333   bool _PublishMeshOUT;
334   bool _KeepWorkingFiles;
335   bool _LogInFile;
336   bool _RemoveLogOnSuccess;
337   int         _VerboseLevel;
338   std::string _MeshNameOUT;
339   std::string _MeshFileOUT;
340   std::string _LogFile;
341
342   // Input data type
343   bool _CaseOnMedFile;
344   SMESH::SMESH_Mesh_var _SmeshMesh;
345   std::string _TmpMeshFile;
346 };
347
348 SMESH_I_EXPORT std::vector<double>   GetBoundingBoxInMedFile(const char * aFile);
349 SMESH_I_EXPORT std::set<std::string> GetListeGroupesInMedFile(const char * aFile);
350
351 }; // namespace SMESHHOMARD_I
352
353 #endif