1 // Copyright (C) 2011-2020 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // L'ordre de description des fonctions est le meme dans tous les fichiers
22 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
23 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
24 // 2. Les caracteristiques
25 // 3. Le lien avec les autres structures
27 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
30 #include "MG_ADAPT_i.hxx"
31 //~#include "ADAPT_Gen_i.hxx"
33 #include "SMESH_Gen_i.hxx"
34 #include <SMESH_Gen.hxx>
35 #include <SALOMEconfig.h>
36 #include CORBA_CLIENT_HEADER(SALOMEDS)
37 //~#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
38 //~#include CORBA_CLIENT_HEADER(SMESH_Gen)
41 //=============================================================================
43 * SMESH_Gen_i::CreateMG_ADAPT
45 * Create measurement instance
47 //=============================================================================
50 using namespace SMESH;
51 void MG_ADAPT_i::copyHypothesisDataToImpl(const SMESH::MgAdaptHypothesisData& from, ::MG_ADAPT::MgAdaptHypothesisData* to) const
53 to->myFileInDir = from.myFileInDir;
54 to->myMeshFileIn = from.myMeshFileIn;
55 to->myMeshFileBackground = from.myMeshFileBackground;
56 to->myOutMeshName = from.myOutMeshName;
57 to->myMeshFileOut = from.myMeshFileOut;
58 to->myFileOutDir = from.myFileOutDir;
59 to->myFileSizeMapDir = from.myFileSizeMapDir;
60 to->myFieldName = from.myFieldName;
61 to->fromMedFile = from.fromMedFile;
62 to->myPublish = from.myPublish;
63 to->myMeshOutMed = from.myMeshOutMed;
64 to->myUseLocalMap = from.myUseLocalMap;
65 to->myUseBackgroundMap = from.myUseBackgroundMap;
66 to->myUseConstantValue = from.myUseConstantValue;
67 to->myConstantValue = from.myConstantValue;
68 to->myTimeStep = from.myTimeStep;
69 to->myRank = from.myRank;
70 to->myUseNoTimeStep = from.myUseNoTimeStep;
71 to->myUseLastTimeStep = from.myUseLastTimeStep;
72 to->myUseChosenTimeStep = from.myUseChosenTimeStep;
73 to->myWorkingDir = from.myWorkingDir;
74 to->myLogFile = from.myLogFile;
75 to->myPrintLogInFile = from.myPrintLogInFile;
76 to->myKeepFiles = from.myKeepFiles;
77 to->myRemoveLogOnSuccess = from.myRemoveLogOnSuccess;
78 to->myVerboseLevel = from.myVerboseLevel;
80 void MG_ADAPT_i::copyHypothesisDataFromImpl(const ::MG_ADAPT::MgAdaptHypothesisData* from, SMESH::MgAdaptHypothesisData* to) const
82 to->myFileInDir = CORBA::string_dup(from->myFileInDir.c_str());
83 to->myMeshFileIn = CORBA::string_dup(from->myMeshFileIn.c_str());
84 to->myMeshFileBackground = CORBA::string_dup(from->myMeshFileBackground.c_str());
85 to->myOutMeshName = CORBA::string_dup(from->myOutMeshName.c_str());
86 to->myMeshFileOut = CORBA::string_dup(from->myMeshFileOut.c_str());
87 to->myFileOutDir = CORBA::string_dup(from->myFileOutDir.c_str());
88 to->myFileSizeMapDir = CORBA::string_dup(from->myFileSizeMapDir.c_str());
89 to->myFieldName = CORBA::string_dup(from->myFieldName.c_str());
90 to->fromMedFile = from->fromMedFile;
91 to->myPublish = from->myPublish;
92 to->myMeshOutMed = from->myMeshOutMed;
93 to->myUseLocalMap = from->myUseLocalMap;
94 to->myUseBackgroundMap = from->myUseBackgroundMap;
95 to->myUseConstantValue = from->myUseConstantValue;
96 to->myConstantValue = from->myConstantValue;
97 to->myTimeStep = from->myTimeStep;
98 to->myRank = from->myRank;
99 to->myUseNoTimeStep = from->myUseNoTimeStep;
100 to->myUseLastTimeStep = from->myUseLastTimeStep;
101 to->myUseChosenTimeStep = from->myUseChosenTimeStep;
102 to->myWorkingDir = CORBA::string_dup(from->myWorkingDir.c_str());
103 to->myLogFile = CORBA::string_dup(from->myLogFile.c_str());
104 to->myPrintLogInFile = from->myPrintLogInFile;
105 to->myKeepFiles = from->myKeepFiles;
106 to->myRemoveLogOnSuccess = from->myRemoveLogOnSuccess;
107 to->myVerboseLevel = from->myVerboseLevel;
109 SMESH::MG_ADAPT_ptr SMESH_Gen_i::CreateMG_ADAPT()
111 SMESH::MG_ADAPT_i* aMGadapt = new SMESH::MG_ADAPT_i();
112 SMESH::MG_ADAPT_var anObj = aMGadapt->_this();
113 return anObj._retn();
115 //~SMESH::MG_ADAPT_ptr MG_ADAPT_i::CreateMG_ADAPT()
118 //~SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
119 //~SMESH::MG_ADAPT_i* aMGadapt = new SMESH::MG_ADAPT_i(smeshGen_i->GetPOA());
120 //~SMESH::MG_ADAPT_var anObj = aMGadapt->_this();
121 //~return anObj._retn();
123 //=============================================================================
125 * standard constructor
127 //=============================================================================
128 MG_ADAPT_i::MG_ADAPT_i(): SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
130 myMgAdapt = new ::MG_ADAPT::MgAdapt();
132 //~MG_ADAPT_i::MG_ADAPT_i(PortableServer::POA_var myPoa): SALOME::GenericObj_i( myPoa )
134 //~myMgAdapt = new ::MG_ADAPT::MgAdapt();
137 //=============================================================================
139 * standard constructor
141 //=============================================================================
142 //~MG_ADAPT_i::MG_ADAPT_i( CORBA::ORB_ptr orb,
143 //~ADAPT::ADAPT_Gen_var engine )
148 //~myMgAdapt = new MgAdapt();
151 //=============================================================================
153 * standard destructor
155 //=============================================================================
156 MG_ADAPT_i::~MG_ADAPT_i()
159 void MG_ADAPT_i::setData( SMESH::MgAdaptHypothesisData& data)
161 ::MG_ADAPT::MgAdaptHypothesisData* baseData = new ::MG_ADAPT::MgAdaptHypothesisData();
162 copyHypothesisDataToImpl(data, baseData);
163 myMgAdapt->setData(baseData);
166 void MG_ADAPT_i::setMedFileIn(const char* str)
168 myMgAdapt->setMedFileIn(str);
170 char* MG_ADAPT_i::getMedFileIn()
172 return CORBA::string_dup(myMgAdapt->getMedFileIn().c_str());
174 void MG_ADAPT_i::setMedFileOut(const char* str)
176 myMgAdapt->setMedFileOut(str);
178 char* MG_ADAPT_i::getMedFileOut()
180 return CORBA::string_dup(myMgAdapt->getMedFileOut().c_str());
182 void MG_ADAPT_i::setMeshName(const char* str)
184 myMgAdapt->setMeshName(str);
186 char* MG_ADAPT_i::getMeshName()
188 return CORBA::string_dup(myMgAdapt->getMeshName().c_str());
190 void MG_ADAPT_i::setMeshNameOut(const char* str)
192 myMgAdapt->setMeshNameOut(str);
194 char* MG_ADAPT_i::getMeshNameOut()
196 return CORBA::string_dup(myMgAdapt->getMeshNameOut().c_str());
198 void MG_ADAPT_i::setMeshOutMed(bool mybool)
200 myMgAdapt->setMeshOutMed(mybool);
202 bool MG_ADAPT_i::getMeshOutMed()
204 return myMgAdapt->getMeshOutMed();
206 void MG_ADAPT_i::setPublish(bool mybool)
208 myMgAdapt->setPublish(mybool);
210 bool MG_ADAPT_i::getPublish()
212 return myMgAdapt->getPublish();
214 void MG_ADAPT_i::setFieldName(const char* str)
216 myMgAdapt->setFieldName(str);
218 char* MG_ADAPT_i::getFieldName()
220 return CORBA::string_dup(myMgAdapt->getFieldName().c_str());
222 void MG_ADAPT_i::setTimeStep(CORBA::Long t)
224 myMgAdapt->setTimeStep(t);
226 CORBA::Long MG_ADAPT_i::getTimeStep()
228 return myMgAdapt->getTimeStep();
230 void MG_ADAPT_i::setRankTimeStep(CORBA::Long t, CORBA::Long r)
232 myMgAdapt->setRankTimeStep(t, r);
234 CORBA::Long MG_ADAPT_i::getRank()
236 return myMgAdapt->getRank();
238 void MG_ADAPT_i::setTimeStepRankLast()
240 myMgAdapt->setTimeStepRankLast();
242 void MG_ADAPT_i::setNoTimeStep()
244 myMgAdapt->setNoTimeStep();
246 void MG_ADAPT_i::setLogFile(const char* str)
248 myMgAdapt->setLogFile(str);
250 char* MG_ADAPT_i::getLogFile()
252 return CORBA::string_dup(myMgAdapt->getLogFile().c_str());
255 void MG_ADAPT_i::setVerbosityLevel(CORBA::Long v)
257 myMgAdapt->setVerbosityLevel(v);
259 CORBA::Long MG_ADAPT_i::getVerbosityLevel()
261 return myMgAdapt->getVerbosityLevel();
263 void MG_ADAPT_i::setRemoveOnSuccess(bool mybool)
265 myMgAdapt->setRemoveOnSuccess(mybool);
267 bool MG_ADAPT_i::getRemoveOnSuccess()
269 myMgAdapt->getRemoveOnSuccess();
271 SMESH::MgAdaptHypothesisData* MG_ADAPT_i::getData()
273 SMESH::MgAdaptHypothesisData* result = new SMESH::MgAdaptHypothesisData();
274 ::MG_ADAPT::MgAdaptHypothesisData* from = myMgAdapt->getData();
275 copyHypothesisDataFromImpl(from, result);
278 void MG_ADAPT_i::setUseLocalMap(bool mybool)
280 myMgAdapt->setUseLocalMap(mybool);
282 bool MG_ADAPT_i::getUseLocalMap()
284 return myMgAdapt->getUseLocalMap();
286 void MG_ADAPT_i::setUseBackgroundMap(bool mybool)
288 myMgAdapt->setUseBackgroundMap(mybool);
290 bool MG_ADAPT_i::getUseBackgroundMap()
292 return myMgAdapt->getUseBackgroundMap();
294 void MG_ADAPT_i::setUseConstantValue(bool mybool)
296 myMgAdapt->setUseConstantValue(mybool);
298 bool MG_ADAPT_i::getUseConstantValue()
300 return myMgAdapt->getUseConstantValue();
303 void MG_ADAPT_i::setConstantValue(double value)
305 myMgAdapt->setConstantValue(value);
307 double MG_ADAPT_i::getConstantValue()
309 return myMgAdapt->getConstantValue();
311 void MG_ADAPT_i::setSizeMapFile(const char* str)
313 myMgAdapt->setSizeMapFile(str);
315 char* MG_ADAPT_i::getSizeMapFile()
317 return CORBA::string_dup(myMgAdapt->getSizeMapFile().c_str());
319 void MG_ADAPT_i::setFromMedFile(bool mybool)
321 myMgAdapt->setFromMedFile(mybool);
323 bool MG_ADAPT_i::isFromMedFile()
325 return myMgAdapt->isFromMedFile();
328 void MG_ADAPT_i::setKeepWorkingFiles(bool mybool)
330 myMgAdapt->setKeepWorkingFiles(mybool);
332 bool MG_ADAPT_i::getKeepWorkingFiles()
334 return myMgAdapt->getKeepWorkingFiles();
337 //~void MG_ADAPT_i::setPrCORBA::LongLogInFile(bool);
338 //~bool MG_ADAPT_i::getPrCORBA::LongLogInFile();
340 void MG_ADAPT_i::setWorkingDir(const char* dir)
342 myMgAdapt->setWorkingDir(dir);
344 char* MG_ADAPT_i::getWorkingDir()
346 return CORBA::string_dup(myMgAdapt->getWorkingDir().c_str());
348 bool MG_ADAPT_i::setAll()
350 return myMgAdapt->setAll();
352 char* MG_ADAPT_i::getCommandToRun()
354 return CORBA::string_dup(myMgAdapt->getCommandToRun().c_str());
357 CORBA::Long MG_ADAPT_i::compute(::CORBA::String_out errStr)
360 CORBA::Long ret = myMgAdapt->compute(err);
361 errStr = err.c_str();
364 char* MG_ADAPT_i::getFileName()
366 return CORBA::string_dup(myMgAdapt->getFileName().c_str());
368 char* MG_ADAPT_i::getExeName()
370 return CORBA::string_dup(myMgAdapt->getExeName().c_str());
372 void MG_ADAPT_i::copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data)
374 ::MG_ADAPT::MgAdaptHypothesisData* baseData = new ::MG_ADAPT::MgAdaptHypothesisData();
375 copyHypothesisDataToImpl(data, baseData);
376 myMgAdapt->copyMgAdaptHypothesisData(baseData);
380 //~void MG_ADAPT_i::checkDirPath(char*& str)
382 //~myMgAdapt->checkDirPath(str);
385 bool MG_ADAPT_i::hasOptionDefined( const char* optionName )
387 return myMgAdapt->hasOptionDefined(optionName);
389 void MG_ADAPT_i::setOptionValue(const char* optionName,
390 const char* optionValue) throw (std::invalid_argument)
392 myMgAdapt->setOptionValue(optionName, optionValue);
395 char* MG_ADAPT_i::getOptionValue(const char* optionName,
396 bool& isDefault) throw (std::invalid_argument)
398 return CORBA::string_dup(myMgAdapt->getOptionValue(optionName, &isDefault).c_str());
400 str_array* MG_ADAPT_i::getCustomOptionValuesStrVec()
402 SMESH::str_array_var result = new SMESH::str_array();
403 std::vector <std::string> vals = myMgAdapt->getCustomOptionValuesStrVec();
404 result->length(vals.size());
405 for (int i = 0; i<vals.size(); i++) result[i] = CORBA::string_dup(vals[i].c_str());
406 return result._retn();
408 str_array* MG_ADAPT_i::getOptionValuesStrVec()
411 SMESH::str_array_var result = new SMESH::str_array();
412 std::vector <std::string> vals = myMgAdapt->getOptionValuesStrVec();
413 result->length(vals.size());
414 for (int i = 0; i<vals.size(); i++) result[i] = CORBA::string_dup(vals[i].c_str());
415 return result._retn();
418 void MG_ADAPT_i::setPrintLogInFile(bool mybool)
420 myMgAdapt->setPrintLogInFile(mybool);
422 bool MG_ADAPT_i::getPrintLogInFile()
424 return myMgAdapt->getPrintLogInFile();
426 //~TOptionValues MG_ADAPT_i::getOptionValues() const;
427 //~const TOptionValues& MG_ADAPT_i::getCustomOptionValues() const ;