Salome HOME
Copyright update 2022
[modules/smesh.git] / src / SMESH_I / MG_ADAPT_i.hxx
1 // Copyright (C) 2020-2022  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 MG_ADAPT_I_HXX
21 #define MG_ADAPT_I_HXX
22
23 #include "SMESH.hxx"
24
25 #include <SALOMEconfig.h>
26 #include CORBA_SERVER_HEADER(MG_ADAPT)
27 #include "SALOME_GenericObj_i.hh"
28 #include <SALOME_GenericObj_wrap.hxx>
29
30 #include <string>
31
32 namespace MG_ADAPT
33 {
34   class MgAdaptHypothesisData;
35   class MgAdapt;
36 }
37
38 namespace SMESH
39 {
40
41 class SMESH_I_EXPORT MG_ADAPT_i :
42     public virtual SALOME::GenericObj_i,
43     public virtual POA_SMESH::MG_ADAPT
44 {
45 public:
46   MG_ADAPT_i();
47   virtual ~MG_ADAPT_i();
48   void setData( SMESH::MgAdaptHypothesisData& data);
49
50   void setMedFileIn(const char* str);
51   char* getMedFileIn();
52
53   void setMedFileOut(const char* str);
54   char* getMedFileOut();
55
56   void setMeshName(const char* str);
57   char* getMeshName();
58
59   void setMeshNameOut(const char* str);
60   char* getMeshNameOut();
61
62   void setMeshOutMed(bool mybool);
63   bool getMeshOutMed();
64
65   void setPublish(bool mybool);
66   bool getPublish();
67
68   void setSizeMapFieldName(const char* str);
69   char* getSizeMapFieldName();
70
71   void setTimeStep(CORBA::Long t);
72   CORBA::Long getTimeStep() ;
73
74   void setTimeStepRank(CORBA::Long t, CORBA::Long r );
75   CORBA::Long getRank();
76
77   void setTimeStepRankLast();
78   void setNoTimeStep();
79
80   void setLogFile(const char* str);
81   char* getLogFile();
82
83   void setVerbosityLevel(CORBA::Long v);
84   CORBA::Long getVerbosityLevel();
85
86   void setRemoveOnSuccess(bool mybool);
87   bool getRemoveOnSuccess();
88
89   SMESH::MgAdaptHypothesisData* getData() ;
90   void setSizeMapType(const char* type);
91   void setUseLocalMap(bool mybool);
92   bool getUseLocalMap();
93
94   void setUseBackgroundMap(bool mybool);
95   bool getUseBackgroundMap();
96
97   void setUseConstantValue(bool mybool);
98   bool getUseConstantValue();
99
100   void setConstantSize(double value);
101   double getConstantSize();
102
103   void setSizeMapFile(const char* str);
104   char* getSizeMapFile();
105
106   void setFromMedFile(bool mybool);
107   bool isFromMedFile();
108
109   void setKeepWorkingFiles(bool mybool);
110   bool getKeepWorkingFiles();
111
112   //~void setPrCORBA::LongLogInFile(bool);
113   //~bool getPrCORBA::LongLogInFile();
114
115   void setWorkingDir(const char* str);
116   char* getWorkingDir() ;
117
118   void setPrintLogInFile(bool mybool);
119   bool getPrintLogInFile();
120
121   bool setAll();
122   char* getCommandToRun() ;
123   void compute();
124   char* getFileName();
125   char* getExeName();
126   void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) ;
127   //~void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) {
128           //~copyMgAdaptHypothesisData(&data);
129   //~}
130
131   //~void checkDirPath(char*& str);
132
133   bool hasOptionDefined( const char* optionName ) ;
134   void setOptionValue(const char* optionName,
135                       const char* optionValue);
136   char* getOptionValue(const char* optionName,
137                        bool&       isDefault);
138   SMESH::string_array* getCustomOptionValuesStrVec() ;
139   SMESH::string_array* getOptionValuesStrVec() ;
140   void copyHypothesisDataFromImpl(const ::MG_ADAPT::MgAdaptHypothesisData* from, SMESH::MgAdaptHypothesisData* to) const;
141   void copyHypothesisDataToImpl(const SMESH::MgAdaptHypothesisData& from, ::MG_ADAPT::MgAdaptHypothesisData* to) const;
142   //~TOptionValues        getOptionValues()       const;
143   //~const TOptionValues& getCustomOptionValues() const ;
144   char* getErrMsg();
145 private:
146   ::MG_ADAPT::MgAdapt* myMgAdapt;
147   std::string          errStr;
148
149 };
150
151 class SMESH_I_EXPORT MG_ADAPT_OBJECT_i:
152   public virtual SALOME::GenericObj_i,
153   public virtual POA_SMESH::MG_ADAPT_OBJECT {
154 public :
155   MG_ADAPT_OBJECT_i();
156   void setMeshIn( SMESH::SMESH_Mesh_ptr theMesh );
157   void setMEDFileIn(const char* f);
158   void setMEDFileOut(const char* f);
159   void setMEDFileBackground(const char* f);
160   void AddHypothesis(SMESH::MG_ADAPT_ptr);
161       CORBA::Long Compute(bool Publish);
162 private:
163 std::string medFileIn, medFileOut, medFileBackground;
164 bool checkMeshFileIn();
165 bool publish;
166 SMESH::SMESH_Mesh_var myMesh;
167 SALOME::GenericObj_wrap<SMESH::MG_ADAPT> hypothesis;
168 };
169
170 }
171
172 #endif // MG_ADAPT_I_HXX