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