From 8b1d1d4dbc61d8e5b654855eef567cb35738cdfe Mon Sep 17 00:00:00 2001 From: azakir Date: Thu, 7 Jan 2021 17:07:11 +0100 Subject: [PATCH] add src/ADAPT_I/MG_ADAPT_i.* files --- idl/CMakeLists.txt | 1 + idl/MG_ADAPT.idl | 142 +++++++++++++++++ src/ADAPT_I/CMakeLists.txt | 4 + src/ADAPT_I/MG_ADAPT_i.cxx | 302 +++++++++++++++++++++++++++++++++++++ src/ADAPT_I/MG_ADAPT_i.hxx | 123 +++++++++++++++ 5 files changed, 572 insertions(+) create mode 100644 idl/MG_ADAPT.idl create mode 100644 src/ADAPT_I/MG_ADAPT_i.cxx create mode 100644 src/ADAPT_I/MG_ADAPT_i.hxx diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt index 7aabfb53b..4a67452e6 100644 --- a/idl/CMakeLists.txt +++ b/idl/CMakeLists.txt @@ -43,6 +43,7 @@ SET(SalomeIDLSMESH_IDLSOURCES HOMARD_Iteration.idl HOMARD_YACS.idl HOMARD_Zone.idl + MG_ADAPT.idl ) SET(_idl_include_dirs diff --git a/idl/MG_ADAPT.idl b/idl/MG_ADAPT.idl new file mode 100644 index 000000000..3cbda07f7 --- /dev/null +++ b/idl/MG_ADAPT.idl @@ -0,0 +1,142 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : MG_ADAPT.hxx +// +#ifndef MG_ADAPT_IDL +#define MG_ADAPT_IDL + + +#include "SALOME_Component.idl" +#include "SALOME_Exception.idl" +#include "SALOMEDS.idl" + +module ADAPT{ + + typedef sequence string_array ; + struct MgAdaptHypothesisData + { + string myFileInDir, myMeshFileIn, myInMeshName, myMeshFileBackground, myOutMeshName, + myMeshFileOut, myFileOutDir, myFileSizeMapDir, myFieldName; + boolean fromMedFile; + boolean myPublish, myMeshOutMed; + boolean myUseLocalMap, myUseBackgroundMap, myUseConstantValue; + double myConstantValue; + long myRank, myTimeStep; + boolean myUseNoTimeStep, myUseLastTimeStep, myUseChosenTimeStep; + string myWorkingDir, myLogFile; + boolean myPrintLogInFile, myKeepFiles, myRemoveLogOnSuccess; + long myVerboseLevel; + + }; + + + interface MG_ADAPT : Engines::EngineComponent + { + + void setData( in MgAdaptHypothesisData data); + + void setMedFileIn(in string MedFileIn ); + string getMedFileIn(); + + void setMedFileOut(in string MedFileOut); + string getMedFileOut(); + + void setMeshName(in string s); + string getMeshName(); + + void setMeshNameOut(in string s); + string getMeshNameOut(); + + void setMeshOutMed(in boolean b); + boolean getMeshOutMed(); + + void setPublish(in boolean b); + boolean getPublish(); + + void setFieldName(in string s); + string getFieldName(); + + void setTimeStep(in long s); + long getTimeStep() ; + + void setRankTimeStep(in long s, in long f); + long getRank(); + + void setLogFile(in string f); + string getLogFile(); + + void setVerbosityLevel(in long f); + long getVerbosityLevel(); + + void setRemoveOnSuccess(in boolean f); + boolean getRemoveOnSuccess(); + + MgAdaptHypothesisData getData(); + + void setUseLocalMap(in boolean f); + boolean getUseLocalMap(); + + void setUseBackgroundMap(in boolean f); + boolean getUseBackgroundMap(); + + void setUseConstantValue(in boolean f); + boolean getUseConstantValue(); + + void setConstantValue(in double f); + double getConstantValue() ; + + void setSizeMapFile(in string f); + string getSizeMapFile(); + + void setFromMedFile(in boolean f); + boolean isFromMedFile(); + + void setKeepWorkingFiles(in boolean f); + boolean getKeepWorkingFiles(); + + void setPrintLogInFile(in boolean f); + boolean getPrintLogInFile(); + + void setWorkingDir(in string f); + string getWorkingDir() ; + + + boolean setAll(); + string getCommandToRun() ; + long compute(inout string errStr); + string getFileName() ; + string getExeName(); + void copyMgAdaptHypothesisData(in MgAdaptHypothesisData f ) ; + + void checkDirPath(in string f); + + + + boolean hasOptionDefined( in string optionName ) ; + void setOptionValue(in string optionName, + in string optionValue) raises (SALOME::SALOME_Exception); + string getOptionValue(in string optionName, + in boolean isDefault) raises (SALOME::SALOME_Exception); + string_array getCustomOptionValuesStrVec() ; + string_array getOptionValuesStrVec() ; + }; + + +}; +#endif // MG_ADAPT_IDL diff --git a/src/ADAPT_I/CMakeLists.txt b/src/ADAPT_I/CMakeLists.txt index d604458fb..b6e7bad12 100644 --- a/src/ADAPT_I/CMakeLists.txt +++ b/src/ADAPT_I/CMakeLists.txt @@ -37,6 +37,7 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/SMESHDS ${PROJECT_SOURCE_DIR}/src/SMDS ${PROJECT_SOURCE_DIR}/src/SMESHUtils + ${MEDCOUPLING_INCLUDE_DIRS} ) # additional preprocessor / compiler flags ADD_DEFINITIONS( @@ -55,6 +56,7 @@ SET(_link_LIBRARIES ${KERNEL_SalomeGenericObj} ${SMESH_SalomeIDLSMESH} ${SMESH_SMESHEngine} + ${MEDCoupling_medloader} ADAPTFrontTrack ADAPTImpl SMESHimpl @@ -73,6 +75,7 @@ SET(ADAPTEngine_HEADERS HOMARD_YACS_i.hxx HomardMedCommun.h HOMARD_i.hxx + MG_ADAPT_i.cxx ) # --- sources --- @@ -87,6 +90,7 @@ SET(ADAPTEngine_SOURCES HOMARD_Boundary_i.cxx HOMARD_YACS_i.cxx HomardMedCommun.cxx + MG_ADAPT_i.cxx ) # --- rules --- diff --git a/src/ADAPT_I/MG_ADAPT_i.cxx b/src/ADAPT_I/MG_ADAPT_i.cxx new file mode 100644 index 000000000..5a056d955 --- /dev/null +++ b/src/ADAPT_I/MG_ADAPT_i.cxx @@ -0,0 +1,302 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// Remarques : +// L'ordre de description des fonctions est le meme dans tous les fichiers +// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx : +// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore +// 2. Les caracteristiques +// 3. Le lien avec les autres structures +// +// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier +// + +#include "MG_ADAPT_i.hxx" +#include "ADAPT_Gen_i.hxx" +#include "MG_ADAPT.hxx" +#include "string.h" + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +MG_ADAPT_i::MG_ADAPT_i() +{ + MESSAGE( "Default constructor, not for use" ); + ASSERT( 0 ); +} + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +MG_ADAPT_i::MG_ADAPT_i( CORBA::ORB_ptr orb, + ADAPT::ADAPT_Gen_var engine ) +{ + + _gen_i = engine; + _orb = orb; + myMgAdapt = new MgAdapt(); + //~ASSERT( myHomardCas ); +} + +//============================================================================= +/*! + * standard destructor + */ +//============================================================================= +MG_ADAPT_i::~MG_ADAPT_i() +{ +} +void MG_ADAPT_i::setData( MgAdaptHypothesisData* data) +{ + myMgAdapt->setData(data); +} +void MG_ADAPT_i::setMedFileIn(char* str) +{ + myMgAdapt->setMedFileIn(str); +} +char* MG_ADAPT_i::getMedFileIn() +{ + return CORBA::string_dup(myMgAdapt->getMedFileIn().c_str()); +} +void MG_ADAPT_i::setMedFileOut(char* str) +{ + myMgAdapt->setMedFileOut(str); +} +char* MG_ADAPT_i::getMedFileOut() +{ + return CORBA::string_dup(myMgAdapt->getMedFileOut().c_str()); +} +void MG_ADAPT_i::setMeshName(char* str) +{ + myMgAdapt->setMeshName(str); +} +char* MG_ADAPT_i::getMeshName() +{ + return CORBA::string_dup(myMgAdapt->getMeshName().c_str()); +} +void MG_ADAPT_i::setMeshNameOut(char* str) +{ + myMgAdapt->setMeshNameOut(str); +} +char* MG_ADAPT_i::getMeshNameOut() +{ + return CORBA::string_dup(myMgAdapt->getMeshNameOut().c_str()); +} +void MG_ADAPT_i::setMeshOutMed(bool mybool) +{ + myMgAdapt->setMeshOutMed(mybool); +} +bool MG_ADAPT_i::getMeshOutMed() +{ + return myMgAdapt->getMeshOutMed(); +} +void MG_ADAPT_i::setPublish(bool mybool) +{ + myMgAdapt->setPublish(mybool); +} +bool MG_ADAPT_i::getPublish() +{ + return myMgAdapt->getPublish(); +} +void MG_ADAPT_i::setFieldName(char* str) +{ + myMgAdapt->setFieldName(str); +} +char* MG_ADAPT_i::getFieldName() +{ + return CORBA::string_dup(myMgAdapt->getFieldName().c_str()); +} +void MG_ADAPT_i::setTimeStep(CORBA::Long t) +{ + myMgAdapt->setTimeStep(t); +} +CORBA::Long MG_ADAPT_i::getTimeStep() const +{ + return myMgAdapt->getTimeStep(); +} +void MG_ADAPT_i::setRankTimeStep(CORBA::Long t, CORBA::Long r) +{ + myMgAdapt->setRankTimeStep(t, r); +} +CORBA::Long MG_ADAPT_i::getRank() +{ + return myMgAdapt->getRank(); +} +void MG_ADAPT_i::setLogFile(char* str) +{ + myMgAdapt->setLogFile(str); +} +char* MG_ADAPT_i::getLogFile() +{ + return CORBA::string_dup(myMgAdapt->getLogFile().c_str()); +} + +void MG_ADAPT_i::setVerbosityLevel(CORBA::Long v) +{ + myMgAdapt->setVerbosityLevel(v); +} +CORBA::Long MG_ADAPT_i::getVerbosityLevel() +{ + return myMgAdapt->getVerbosityLevel(); +} +void MG_ADAPT_i::setRemoveOnSuccess(bool mybool) +{ + myMgAdapt->setRemoveOnSuccess(mybool); +} +bool MG_ADAPT_i::getRemoveOnSuccess() +{ + myMgAdapt->getRemoveOnSuccess(); +} +MgAdaptHypothesisData* MG_ADAPT_i::getData() const +{ + return myMgAdapt->getData(); +} +void MG_ADAPT_i::setUseLocalMap(bool mybool) +{ + myMgAdapt->setUseLocalMap(mybool); +} +bool MG_ADAPT_i::getUseLocalMap() +{ + return myMgAdapt->getUseLocalMap(); +} +void MG_ADAPT_i::setUseBackgroundMap(bool mybool) +{ + myMgAdapt->setUseBackgroundMap(mybool); +} +bool MG_ADAPT_i::getUseBackgroundMap() +{ + return myMgAdapt->getUseBackgroundMap(); +} +void MG_ADAPT_i::setUseConstantValue(bool mybool) +{ + myMgAdapt->setUseConstantValue(mybool); +} +bool MG_ADAPT_i::getUseConstantValue() +{ + return myMgAdapt->getUseConstantValue(); +} + +void MG_ADAPT_i::setConstantValue(double value) +{ + myMgAdapt->setConstantValue(value); +} +double MG_ADAPT_i::getConstantValue() const +{ + return myMgAdapt->getConstantValue(); +} +void MG_ADAPT_i::setSizeMapFile(char* str) +{ + myMgAdapt->setSizeMapFile(str); +} +char* MG_ADAPT_i::getSizeMapFile() +{ + return CORBA::string_dup(myMgAdapt->getSizeMapFile().c_str()); +} +void MG_ADAPT_i::setFromMedFile(bool mybool) +{ + myMgAdapt->setFromMedFile(mybool); +} +bool MG_ADAPT_i::isFromMedFile() +{ + return myMgAdapt->isFromMedFile(); +} + +void MG_ADAPT_i::setKeepWorkingFiles(bool mybool) +{ + myMgAdapt->setKeepWorkingFiles(mybool); +} +bool MG_ADAPT_i::getKeepWorkingFiles() +{ + return myMgAdapt->getKeepWorkingFiles(); +} + +//~void MG_ADAPT_i::setPrCORBA::LongLogInFile(bool); +//~bool MG_ADAPT_i::getPrCORBA::LongLogInFile(); + +void MG_ADAPT_i::setWorkingDir(char* dir) +{ + myMgAdapt->setWorkingDir(dir); +} +char* MG_ADAPT_i::getWorkingDir() const +{ + return CORBA::string_dup(myMgAdapt->getWorkingDir().c_str()); +} +bool MG_ADAPT_i::setAll() +{ + return myMgAdapt->setAll(); +} +char* MG_ADAPT_i::getCommandToRun() +{ + return CORBA::string_dup(myMgAdapt->getCommandToRun().c_str()); +} +CORBA::Long MG_ADAPT_i::compute(char* errStr) +{ + std::string err(""); + CORBA::Long ret = myMgAdapt->compute(err); + strcpy(errStr, err.c_str()); + return ret; +} +char* MG_ADAPT_i::getFileName() const +{ + return CORBA::string_dup(myMgAdapt->getFileName().c_str()); +} +char* MG_ADAPT_i::getExeName() +{ + return CORBA::string_dup(myMgAdapt->getExeName().c_str()); +} +void MG_ADAPT_i::copyMgAdaptHypothesisData( MgAdaptHypothesisData* data) +{ + myMgAdapt->copyMgAdaptHypothesisData(data); +} + +void MG_ADAPT_i::checkDirPath(std::string& str) +{ + myMgAdapt->checkDirPath(str); +} + +bool MG_ADAPT_i::hasOptionDefined( const char* optionName ) const +{ + return myMgAdapt->hasOptionDefined(optionName); +} +void MG_ADAPT_i::setOptionValue(const char* optionName, + const char* optionValue) throw (std::invalid_argument) +{ + myMgAdapt->setOptionValue(optionName, optionValue); +} +std::string MG_ADAPT_i::getOptionValue(const char* optionName, + bool* isDefault) const throw (std::invalid_argument) +{ + return myMgAdapt->getOptionValue(optionName, isDefault); +} +std::vector MG_ADAPT_i::getCustomOptionValuesStrVec() const +{ + return myMgAdapt->getCustomOptionValuesStrVec(); +} +std::vector MG_ADAPT_i::getOptionValuesStrVec() const +{ + return myMgAdapt->getOptionValuesStrVec(); +} + + +//~TOptionValues MG_ADAPT_i::getOptionValues() const; +//~const TOptionValues& MG_ADAPT_i::getCustomOptionValues() const ; diff --git a/src/ADAPT_I/MG_ADAPT_i.hxx b/src/ADAPT_I/MG_ADAPT_i.hxx new file mode 100644 index 000000000..657fca93a --- /dev/null +++ b/src/ADAPT_I/MG_ADAPT_i.hxx @@ -0,0 +1,123 @@ +#ifndef MG_ADAPT_I_HXX +#define MG_ADAPT_I_HXX + +#include +#include CORBA_SERVER_HEADER(ADAPT_Gen) +#include CORBA_SERVER_HEADER(MG_ADAPT) + +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" + +#include + +struct MgAdaptHypothesisData; +class MgAdapt; + +class MG_ADAPT_i : + public virtual Engines_Component_i, + public virtual POA_ADAPT::MG_ADAPT, + public virtual PortableServer::ServantBase +{ +public: + MG_ADAPT_i( CORBA::ORB_ptr orb, ADAPT::ADAPT_Gen_var gen_i ); + MG_ADAPT_i(); + virtual ~MG_ADAPT_i(); + void setData( MgAdaptHypothesisData*); + + void setMedFileIn(char* str); + char* getMedFileIn(); + + void setMedFileOut(char* str); + char* getMedFileOut(); + + void setMeshName(char* str); + char* getMeshName(); + + void setMeshNameOut(char* str); + char* getMeshNameOut(); + + void setMeshOutMed(bool mybool); + bool getMeshOutMed(); + + void setPublish(bool mybool); + bool getPublish(); + + void setFieldName(char* str); + char* getFieldName(); + + void setTimeStep(CORBA::Long t); + CORBA::Long getTimeStep() const; + + void setRankTimeStep(CORBA::Long t, CORBA::Long r ); + CORBA::Long getRank(); + + void setLogFile(char* str); + char* getLogFile(); + + void setVerbosityLevel(CORBA::Long v); + CORBA::Long getVerbosityLevel(); + + void setRemoveOnSuccess(bool mybool); + bool getRemoveOnSuccess(); + + MgAdaptHypothesisData* getData() const; + + void setUseLocalMap(bool mybool); + bool getUseLocalMap(); + + void setUseBackgroundMap(bool mybool); + bool getUseBackgroundMap(); + + void setUseConstantValue(bool mybool); + bool getUseConstantValue(); + + void setConstantValue(double value); + double getConstantValue() const; + + void setSizeMapFile(char* str); + char* getSizeMapFile(); + + void setFromMedFile(bool mybool); + bool isFromMedFile(); + + void setKeepWorkingFiles(bool mybool); + bool getKeepWorkingFiles(); + + //~void setPrCORBA::LongLogInFile(bool); + //~bool getPrCORBA::LongLogInFile(); + + void setWorkingDir(char* str); + char* getWorkingDir() const; + + + bool setAll(); + char* getCommandToRun() ; + CORBA::Long compute(char* errStr); + char* getFileName() const; + char* getExeName(); + void copyMgAdaptHypothesisData( MgAdaptHypothesisData* data ) ; + + void checkDirPath(std::string& str); + + + + bool hasOptionDefined( const char* optionName ) const; + void setOptionValue(const char* optionName, + const char* optionValue) throw (std::invalid_argument); + std::string getOptionValue(const char* optionName, + bool* isDefault=0) const throw (std::invalid_argument); + std::vector getCustomOptionValuesStrVec() const; + std::vector getOptionValuesStrVec() const; + + + //~TOptionValues getOptionValues() const; + //~const TOptionValues& getCustomOptionValues() const ; +private: + MgAdapt* myMgAdapt; + + CORBA::ORB_ptr _orb; + ADAPT::ADAPT_Gen_var _gen_i; + +}; +#endif // MG_ADAPT_I_HXX -- 2.39.2