TUI first dev

This commit is contained in:
azakir 2021-01-12 14:18:03 +01:00
parent 8b1d1d4dbc
commit 6e11711875
20 changed files with 702 additions and 555 deletions

View File

@ -24,11 +24,13 @@
#include "SALOME_Component.idl"
#include "SALOME_Exception.idl"
#include "SALOME_GenericObj.idl"
#include "SALOMEDS.idl"
#include "SMESH_Mesh.idl"
module ADAPT{
module SMESH{
typedef sequence<string > string_array ;
typedef sequence<string> str_array ;
struct MgAdaptHypothesisData
{
string myFileInDir, myMeshFileIn, myInMeshName, myMeshFileBackground, myOutMeshName,
@ -46,10 +48,10 @@ module ADAPT{
};
interface MG_ADAPT : Engines::EngineComponent
interface MG_ADAPT : SALOME::GenericObj
{
void setData( in MgAdaptHypothesisData data);
//MG_ADAPT CreateMG_ADAPT(in PortableServer::POA_var poa);
void setData( inout MgAdaptHypothesisData data);
void setMedFileIn(in string MedFileIn );
string getMedFileIn();
@ -77,6 +79,9 @@ module ADAPT{
void setRankTimeStep(in long s, in long f);
long getRank();
void setTimeStepRankLast();
void setNoTimeStep();
void setLogFile(in string f);
string getLogFile();
@ -119,12 +124,12 @@ module ADAPT{
boolean setAll();
string getCommandToRun() ;
long compute(inout string errStr);
long compute(out string errStr);
string getFileName() ;
string getExeName();
void copyMgAdaptHypothesisData(in MgAdaptHypothesisData f ) ;
void checkDirPath(in string f);
//void checkDirPath(inout string f);
@ -132,9 +137,9 @@ module ADAPT{
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() ;
inout boolean isDefault) raises (SALOME::SALOME_Exception);
str_array getCustomOptionValuesStrVec() ;
str_array getOptionValuesStrVec() ;
};

View File

@ -43,6 +43,7 @@ module SMESH
interface FilterManager;
interface SMESH_Pattern;
interface Measurements;
interface MG_ADAPT;
/*!
* Tags definition
@ -136,7 +137,6 @@ module SMESH
SMESH_Pattern GetPattern();
Measurements CreateMeasurements();
/*!
Set the current mode
*/
@ -584,7 +584,8 @@ module SMESH
in GEOM::GEOM_Object theGeom,
in double theTolerance );
MG_ADAPT CreateMG_ADAPT();
};
};

View File

@ -50,7 +50,7 @@ SET(ADAPTImpl_HEADERS
HOMARD_YACS.hxx
HomardDriver.hxx
YACSDriver.hxx
MG_ADAPT.hxx
#~MG_ADAPT.hxx
)
# --- sources ---
@ -67,7 +67,7 @@ SET(ADAPTImpl_SOURCES
HOMARD_YACS.cxx
HomardDriver.cxx
YACSDriver.cxx
MG_ADAPT.cxx
#~MG_ADAPT.cxx
)
# --- rules ---

View File

@ -39,6 +39,8 @@ INCLUDE_DIRECTORIES(
${PROJECT_BINARY_DIR}/adm_local/unix
${PROJECT_SOURCE_DIR}/src/ADAPT
${PROJECT_SOURCE_DIR}/src/ADAPT_I
${PROJECT_SOURCE_DIR}/src/SMESH_I
${PROJECT_SOURCE_DIR}/src/SMESH
${MEDCOUPLING_INCLUDE_DIRS}
)
@ -56,8 +58,10 @@ SET(_link_LIBRARIES
${KERNEL_SalomeDS}
${GUI_SalomeApp}
${SMESH_SalomeIDLSMESH}
${SMESH_SMESHEngine}
ADAPTEngine
${MEDCoupling_medloader}
SMESHimpl
)
# --- resources ---
@ -114,7 +118,7 @@ SET(_moc_HEADERS
MonCreateYACS.h
MonEditYACS.h
MonEditFile.h
MG_ADAPTGUI.hxx
#~MG_ADAPTGUI.hxx
)
# header files / uic wrappings
@ -163,7 +167,7 @@ SET(_other_SOURCES
MonEditYACS.cxx
MonEditFile.cxx
HomardQtCommun.cxx
MG_ADAPTGUI.cxx
#~MG_ADAPTGUI.cxx
)
# sources / to compile

View File

@ -57,9 +57,9 @@ SET(_link_LIBRARIES
${SMESH_SalomeIDLSMESH}
${SMESH_SMESHEngine}
${MEDCoupling_medloader}
SMESHimpl
ADAPTFrontTrack
ADAPTImpl
SMESHimpl
)
# --- headers ---
@ -75,7 +75,7 @@ SET(ADAPTEngine_HEADERS
HOMARD_YACS_i.hxx
HomardMedCommun.h
HOMARD_i.hxx
MG_ADAPT_i.cxx
#~MG_ADAPT_i.hxx
)
# --- sources ---
@ -90,7 +90,7 @@ SET(ADAPTEngine_SOURCES
HOMARD_Boundary_i.cxx
HOMARD_YACS_i.cxx
HomardMedCommun.cxx
MG_ADAPT_i.cxx
#~MG_ADAPT_i.cxx
)
# --- rules ---

View File

@ -1,302 +0,0 @@
// 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 <std::string> MG_ADAPT_i::getCustomOptionValuesStrVec() const
{
return myMgAdapt->getCustomOptionValuesStrVec();
}
std::vector <std::string> MG_ADAPT_i::getOptionValuesStrVec() const
{
return myMgAdapt->getOptionValuesStrVec();
}
//~TOptionValues MG_ADAPT_i::getOptionValues() const;
//~const TOptionValues& MG_ADAPT_i::getCustomOptionValues() const ;

View File

@ -1,123 +0,0 @@
#ifndef MG_ADAPT_I_HXX
#define MG_ADAPT_I_HXX
#include <SALOMEconfig.h>
#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 <string>
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 <std::string> getCustomOptionValuesStrVec() const;
std::vector <std::string> 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

View File

@ -38,6 +38,7 @@ INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}/src/SMDS
${PROJECT_SOURCE_DIR}/src/SMESHDS
${PROJECT_SOURCE_DIR}/src/SMESHUtils
${MEDCOUPLING_INCLUDE_DIRS}
)
# additional preprocessor / compiler flags
@ -67,6 +68,7 @@ SET(_link_LIBRARIES
MeshDriverUNV
MeshDriverGMF
${DriverCGNS_LIB}
${MEDCoupling_medloader}
)
# --- headers ---
@ -86,6 +88,7 @@ SET(SMESHimpl_HEADERS
SMESH_MesherHelper.hxx
SMESH_ProxyMesh.hxx
SMESH_SMESH.hxx
MG_ADAPT.hxx
)
# --- sources ---
@ -104,6 +107,7 @@ SET(SMESHimpl_SOURCES
SMESH_HypoFilter.cxx
SMESH_ProxyMesh.cxx
SMESH_MesherHelper.cxx
MG_ADAPT.cxx
)
# --- rules ---

View File

@ -38,6 +38,7 @@
#include <cstdlib>
#include <boost/filesystem.hpp>
using namespace MG_ADAPT;
static std::string removeFile(std::string fileName, int& notOk)
{
std::string errStr;
@ -280,11 +281,24 @@ int MgAdapt::getRank()
{
return rank;
}
void MgAdapt::setTimeStepRankLast()
{
med_int aRank, tmst;
std::string fieldFile = useBackgroundMap ? sizeMapFile : medFileIn;
getTimeStepInfos(fieldFile, tmst, aRank);
setRankTimeStep((int) tmst, (int) aRank);
}
void MgAdapt::setNoTimeStep()
{
int aRank = (int)MED_NO_IT;
int tmst = (int)MED_NO_DT ;
setRankTimeStep(tmst, aRank);
}
void MgAdapt::setUseLocalMap(bool myLocal)
{
useLocalMap = myLocal;
useLocalMap = myLocal;
}
bool MgAdapt::getUseLocalMap()
{
return useLocalMap;
@ -293,8 +307,8 @@ bool MgAdapt::getUseLocalMap()
void MgAdapt::setUseBackgroundMap(bool bckg)
{
useBackgroundMap = bckg;
}
bool MgAdapt::getUseBackgroundMap()
{
return useBackgroundMap;
@ -303,7 +317,6 @@ bool MgAdapt::getUseBackgroundMap()
void MgAdapt::setUseConstantValue(bool cnst)
{
useConstantValue = cnst;
}
bool MgAdapt::getUseConstantValue()
{
@ -400,6 +413,7 @@ bool MgAdapt::getPrintLogInFile()
return printLogInFile;
}
bool MgAdapt::setAll()
{
@ -1068,7 +1082,7 @@ std::string MgAdapt::getExeName()
{
return "mg-adapt.exe";
}
void MgAdapt::copyMgAdaptHypothesisData( MgAdaptHypothesisData* from)
void MgAdapt::copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from)
{
data->myFileInDir = from->myFileInDir;

View File

@ -36,7 +36,7 @@
//~#include <med.h>
namespace MG_ADAPT{
class MgAdapt;
typedef std::map< std::string, std::string > TOptionValues;
@ -118,7 +118,7 @@ public:
MgAdapt(const MgAdapt&);
~MgAdapt();
void buildModel();
void setData( MgAdaptHypothesisData*);
void setData( MgAdaptHypothesisData* data);
void setMedFileIn(std::string fileName);
std::string getMedFileIn();
@ -142,11 +142,14 @@ public:
std::string getFieldName();
void setTimeStep(int time);
int getTimeStep() const;
int getTimeStep() const;
void setRankTimeStep(int time, int myRank);
int getRank();
void setTimeStepRankLast();
void setNoTimeStep();
void setLogFile(std::string);
std::string getLogFile();
@ -192,12 +195,10 @@ public:
int compute(std::string& errStr);
std::string getFileName() const;
static std::string getExeName();
void copyMgAdaptHypothesisData( MgAdaptHypothesisData* from) ;
void copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from) ;
void checkDirPath(std::string& dirPath);
bool hasOptionDefined( const std::string& optionName ) const;
void setOptionValue(const std::string& optionName,
const std::string& optionValue) throw (std::invalid_argument);
@ -332,6 +333,6 @@ private :
void appendMsgToLogFile(std::string& msg);
};
}
#endif // MG_ADAPT_HXX

View File

@ -43,11 +43,12 @@ INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}/src/SMESHClient
${PROJECT_SOURCE_DIR}/src/MEDWrapper
${PROJECT_SOURCE_DIR}/src/ADAPT
${PROJECT_SOURCE_DIR}/src/ADAPT_I
${PROJECT_SOURCE_DIR}/src/ADAPTGUI
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/idl
${PROJECT_BINARY_DIR}/src/ADAPTGUI
${PROJECT_BINARY_DIR}/src/ADAPT
${PROJECT_BINARY_DIR}/src/ADAPT_I
${MEDCOUPLING_INCLUDE_DIRS}
)
@ -156,7 +157,7 @@ SET(_moc_HEADERS
SMESHGUI_PreVisualObj.h
SMESHGUI_AdaptDlg.h
SMESHGUI_MG_ADAPTDRIVER.h
#~MG_ADAPTGUI.hxx # to replace in ../ADAPTGUI/
MG_ADAPTGUI.hxx # to replace in ../ADAPTGUI/
)
# header files / no moc processing
@ -275,7 +276,7 @@ SET(_other_SOURCES
SMESHGUI_IdPreview.cxx
SMESHGUI_AdaptDlg.cxx
SMESHGUI_MG_ADAPTDRIVER.cxx
#~MG_ADAPTGUI.cxx # to replace in ../ADAPTGUI/
MG_ADAPTGUI.cxx # to replace in ../ADAPTGUI/
#MG_ADAPT.cxx
)

View File

@ -98,10 +98,11 @@ const int MARGIN = 9; // layout margin
// function : SMESHGUI_MgAdaptDlg()
// purpose :
//=================================================================================
SMESHGUI_MgAdaptDlg::SMESHGUI_MgAdaptDlg( SalomeApp_Module* theModule, MgAdapt* myModel, QWidget* parent, bool isCreation )
SMESHGUI_MgAdaptDlg::SMESHGUI_MgAdaptDlg( SalomeApp_Module* theModule, SMESH::MG_ADAPT_ptr myModel, QWidget* parent, bool isCreation )
: mySMESHGUI( theModule ), QDialog(parent)
{
model = new MgAdapt(*myModel);
//~model = new MgAdapt(*myModel);
model = SMESH::MG_ADAPT::_duplicate(myModel);
myData = model->getData();
buildDlg();
if (!isCreation) readParamsFromHypo();
@ -120,11 +121,15 @@ void SMESHGUI_MgAdaptDlg::buildDlg()
// Arguments
myArgs = new SMESHGUI_MgAdaptArguments( myTabWidget );
std::vector <std::string> str = model->getOptionValuesStrVec();
std::vector <std::string> str2 = model->getCustomOptionValuesStrVec();
str.insert( str.end(), str2.begin(), str2.end() );
SMESH::str_array* str = model->getOptionValuesStrVec();
SMESH::str_array* str2 = model->getCustomOptionValuesStrVec();
std::vector<std::string> s;
for (int i = 0; i< str->length(); i++) s.push_back( (*str)[i].in());
for (int j = str->length(); j< str2->length(); j++) s.push_back((*str2)[ j - str->length() ].in() );
//~str.insert( str.end(), str2.begin(), str2.end() );
myAdvOpt = new MgAdaptAdvWidget(myTabWidget, &str);
myAdvOpt = new MgAdaptAdvWidget(myTabWidget, &s);
int argsTab = myTabWidget->addTab( myArgs, tr( "Args" ) );
int advTab = myTabWidget->addTab( myAdvOpt, tr( "ADVOP" ) );
@ -187,14 +192,14 @@ void SMESHGUI_MgAdaptDlg::buildDlg()
//=================================================================================
SMESHGUI_MgAdaptDlg::~SMESHGUI_MgAdaptDlg()
{
delete model;
//~delete model;
}
void SMESHGUI_MgAdaptDlg::setModel(MgAdapt* mg)
{
model = mg;
}
MgAdapt* SMESHGUI_MgAdaptDlg::getModel() const
//~void SMESHGUI_MgAdaptDlg::setModel(MgAdapt* mg)
//~{
//~model = mg;
//~}
SMESH::MG_ADAPT_ptr SMESHGUI_MgAdaptDlg::getModel() const
{
return model;
}
@ -222,24 +227,24 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromHypo( ) const
if (myData->fromMedFile)
{
*(myArgs->myFileInDir) = QString(myData->myFileInDir.c_str()) ;
myArgs->selectMedFileLineEdit->setText(myData->myMeshFileIn.c_str()) ;
*(myArgs->myFileInDir) = QString(myData->myFileInDir) ;
myArgs->selectMedFileLineEdit->setText(QString(myData->myMeshFileIn)) ;
// myData->myInMeshName = // TODO
}
else
{
myArgs->aBrowserObject->setText(myData->myInMeshName.c_str());
myArgs->aBrowserObject->setText(QString(myData->myInMeshName));
//~ myArgs->myFileInDir =""; // TODO
//~ myArgs->selectMedFileLineEdit->setText(); // TODO
}
myArgs->meshNameLineEdit->setText(myData->myOutMeshName.c_str());
myArgs->meshNameLineEdit->setText(QString(myData->myOutMeshName));
myArgs->medFileCheckBox->setChecked(myData->myMeshOutMed);
if(myData->myMeshOutMed)
{
*(myArgs->myFileOutDir) = QString(myData->myFileOutDir.c_str());
myArgs->selectOutMedFileLineEdit->setText(myData->myMeshFileOut.c_str());
*(myArgs->myFileOutDir) = QString(myData->myFileOutDir);
myArgs->selectOutMedFileLineEdit->setText(QString(myData->myMeshFileOut));
}
else
@ -265,8 +270,8 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromHypo( ) const
if (myData->myUseBackgroundMap)
{
*(myArgs->myFileSizeMapDir) = QString(myData->myFileSizeMapDir.c_str()) ;
myArgs->selectMedFileBackgroundLineEdit->setText(myData->myMeshFileBackground.c_str());
*(myArgs->myFileSizeMapDir) = QString(myData->myFileSizeMapDir) ;
myArgs->selectMedFileBackgroundLineEdit->setText(QString(myData->myMeshFileBackground));
}
else
{
@ -274,7 +279,7 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromHypo( ) const
myArgs->selectMedFileBackgroundLineEdit->setText(""); //TODO
}
myArgs->fieldNameCmb->setCurrentText(myData->myFieldName.c_str());
myArgs->fieldNameCmb->setCurrentText(QString(myData->myFieldName));
myArgs->noTimeStep->setChecked(myData->myUseNoTimeStep);
myArgs->lastTimeStep->setChecked( myData->myUseLastTimeStep);
myArgs->chosenTimeStep->setChecked(myData->myUseChosenTimeStep);
@ -284,7 +289,7 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromHypo( ) const
myArgs->timeStep->setValue(myData->myTimeStep);
}
myAdvOpt->workingDirectoryLineEdit->setText(myData->myWorkingDir.c_str());
myAdvOpt->workingDirectoryLineEdit->setText(QString(myData->myWorkingDir));
myAdvOpt->logInFileCheck->setChecked(myData->myPrintLogInFile);
myAdvOpt->verboseLevelSpin->setValue(myData->myVerboseLevel);
@ -299,21 +304,21 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromHypo( ) const
bool SMESHGUI_MgAdaptDlg::readParamsFromWidgets()
{
bool ret = true;
MgAdaptHypothesisData* aData = new MgAdaptHypothesisData();
SMESH::MgAdaptHypothesisData* aData = new SMESH::MgAdaptHypothesisData();
aData->fromMedFile = myArgs->aMedfile->isChecked();
if (aData->fromMedFile)
{
aData->myFileInDir = myArgs->myFileInDir->toStdString();
aData->myMeshFileIn = myArgs->selectMedFileLineEdit->text().toStdString();
aData->myFileInDir = CORBA::string_dup(myArgs->myFileInDir->toStdString().c_str());
aData->myMeshFileIn = CORBA::string_dup(myArgs->selectMedFileLineEdit->text().toStdString().c_str());
// aData->myInMeshName = // TODO
}
else // TODO browser
{
aData->myInMeshName = myArgs->aBrowserObject->text().toStdString();
aData->myFileInDir = myAdvOpt->workingDirectoryLineEdit->text().toStdString();
aData->myInMeshName = CORBA::string_dup(myArgs->aBrowserObject->text().toStdString().c_str());
aData->myFileInDir = CORBA::string_dup(myAdvOpt->workingDirectoryLineEdit->text().toStdString().c_str());
TCollection_AsciiString aGenericName = (char*)aData->myFileInDir.c_str();
TCollection_AsciiString aGenericName = (char*)aData->myFileInDir;
TCollection_AsciiString aGenericName2 = "MgAdapt_";
aGenericName2 += getpid();
aGenericName2 += "_";
@ -323,12 +328,12 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromWidgets()
emit myArgs->toExportMED(aGenericName.ToCString());
aData->myMeshFileIn = aGenericName2.ToCString();
}
aData->myOutMeshName = myArgs->meshNameLineEdit->text().toStdString();
aData->myOutMeshName = CORBA::string_dup(myArgs->meshNameLineEdit->text().toStdString().c_str());
aData->myMeshOutMed = myArgs->medFileCheckBox->isChecked();
if(aData->myMeshOutMed)
{
aData->myFileOutDir = myArgs->myFileOutDir->toStdString();
aData->myMeshFileOut = myArgs->selectOutMedFileLineEdit->text().toStdString();
aData->myFileOutDir = CORBA::string_dup(myArgs->myFileOutDir->toStdString().c_str());
aData->myMeshFileOut = CORBA::string_dup(myArgs->selectOutMedFileLineEdit->text().toStdString().c_str());
}
else
@ -352,15 +357,15 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromWidgets()
}
if (aData->myUseBackgroundMap)
{
aData->myFileSizeMapDir = myArgs->myFileSizeMapDir->toStdString();
aData->myMeshFileBackground = myArgs->selectMedFileBackgroundLineEdit->text().toStdString();
aData->myFileSizeMapDir = CORBA::string_dup(myArgs->myFileSizeMapDir->toStdString().c_str());
aData->myMeshFileBackground = CORBA::string_dup(myArgs->selectMedFileBackgroundLineEdit->text().toStdString().c_str());
}
else
{
aData->myMeshFileBackground = "";
}
aData->myFieldName = myArgs->fieldNameCmb->currentText().toStdString();
aData->myFieldName = CORBA::string_dup(myArgs->fieldNameCmb->currentText().toStdString().c_str());
aData->myUseNoTimeStep = myArgs->noTimeStep->isChecked();
aData->myUseLastTimeStep = myArgs->lastTimeStep->isChecked();
aData->myUseChosenTimeStep = myArgs->chosenTimeStep->isChecked();
@ -372,18 +377,18 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromWidgets()
}
aData->myWorkingDir = myAdvOpt->workingDirectoryLineEdit->text().toStdString();
aData->myWorkingDir = CORBA::string_dup(myAdvOpt->workingDirectoryLineEdit->text().toStdString().c_str());
aData->myPrintLogInFile = myAdvOpt->logInFileCheck->isChecked();
aData->myVerboseLevel = myAdvOpt->verboseLevelSpin->value();
aData->myRemoveLogOnSuccess = myAdvOpt->removeLogOnSuccessCheck->isChecked();
aData->myKeepFiles = myAdvOpt->keepWorkingFilesCheck->isChecked();
model->setData(aData);
model->setData(*aData);
QString msg;
checkParams(msg);
delete aData;
return ret;
}
bool SMESHGUI_MgAdaptDlg::storeParamsToHypo( const MgAdaptHypothesisData& ) const
bool SMESHGUI_MgAdaptDlg::storeParamsToHypo( const SMESH::MgAdaptHypothesisData& ) const
{
}

View File

@ -44,7 +44,9 @@
// model
#include "MG_ADAPT.hxx"
//~#include "MG_ADAPT.hxx"
#include CORBA_SERVER_HEADER(MG_ADAPT)
class SUIT_ViewWindow;
class SUIT_Desktop;
@ -88,7 +90,7 @@ class SMESHGUI_MgAdaptArguments;
class SMESHGUI_SpinBox;
class MgAdaptAdvWidgetTreeWidget;
class MgAdaptAdvWidget;
class MgAdapt;
//~class MgAdapt;
class QHeaderView;
class QFileDialog;
@ -115,14 +117,14 @@ class SMESHGUI_MgAdaptDlg : public QDialog
public:
//! Property type
enum Mode { Arguments, AdvancedOptions};
SMESHGUI_MgAdaptDlg( SalomeApp_Module*, MgAdapt*, QWidget* parent= 0,bool isCreation = true );
SMESHGUI_MgAdaptDlg( SalomeApp_Module*, SMESH::MG_ADAPT_ptr, QWidget* parent= 0,bool isCreation = true );
~SMESHGUI_MgAdaptDlg();
void buildDlg();
void reject();
bool checkParams(QString& msg) ;
void setModel(MgAdapt*);
MgAdapt* getModel() const;
//~void setModel(MgAdapt*);
SMESH::MG_ADAPT_ptr getModel() const;
public slots:
@ -138,7 +140,7 @@ protected :
MgAdaptAdvWidget* myAdvOpt;
bool readParamsFromHypo( ) const ;
bool readParamsFromWidgets( ) ;
bool storeParamsToHypo( const MgAdaptHypothesisData& ) const;
bool storeParamsToHypo( const SMESH::MgAdaptHypothesisData & ) const;
private:
@ -147,8 +149,8 @@ private:
QTabWidget* myTabWidget;
MgAdaptHypothesisData* myData;
MgAdapt* model;
SMESH::MgAdaptHypothesisData* myData;
SMESH::MG_ADAPT_ptr model;
};

View File

@ -25,7 +25,8 @@
#include "SMESHGUI.h"
#include "SMESHGUI_AdaptDlg.h"
#include "SMESHGUI_MG_ADAPTDRIVER.h"
#include "MG_ADAPT.hxx"
//~#include "MG_ADAPT_i.hxx"
//~#include "MG_ADAPT.hxx"
// SALOME GUI includes
#include <SUIT_Desktop.h>
@ -225,13 +226,14 @@ bool SMESHGUI_AdaptDlg::OnGUIEvent (int theCommandID)
INFOS("Interface avec MG-Adapt" );
// A faire
MgAdapt* model = new MgAdapt();
SMESH::MG_ADAPT_ptr model = SMESHGUI::GetSMESHGen()->CreateMG_ADAPT();// = new SMESH::MG_ADAPT_var();
//~SMESH::MG_ADAPT_ptr model = SMESH::MG_ADAPT_i::CreateMG_ADAPT();
bool isCreation = false;
if (mySMESHGUI->isStudyLocked()) break;
mySMESHGUI->EmitSignalDeactivateDialog();
SMESHGUI_MG_ADAPTDRIVER *mgAdapt = new SMESHGUI_MG_ADAPTDRIVER(mySMESHGUI, model, isCreation);
mgAdapt->show();
delete model;
//~delete model;
break;
}

View File

@ -233,33 +233,8 @@ int IObjectCount()
}
SMESHGUI_MG_AdaptComputeDlg_QThread::SMESHGUI_MG_AdaptComputeDlg_QThread(MgAdapt* aModel)
{
model = aModel;
myResult = -1;
}
void SMESHGUI_MG_AdaptComputeDlg_QThread::run()
{
int err;
std::string errStr;
errStr = model->compute(errStr);
std::string msg = err == 0 ? " ok" : std::string("Not ok \n")+ errStr;
exec();
}
int SMESHGUI_MG_AdaptComputeDlg_QThread::result()
{
return myResult;
}
void SMESHGUI_MG_AdaptComputeDlg_QThread::cancel()
{
//~model->cancel();
}
SMESHGUI_MG_ADAPTDRIVER::SMESHGUI_MG_ADAPTDRIVER( SMESHGUI* theModule, MgAdapt* myModel, bool isCreation )
SMESHGUI_MG_ADAPTDRIVER::SMESHGUI_MG_ADAPTDRIVER( SMESHGUI* theModule, SMESH::MG_ADAPT_ptr myModel, bool isCreation )
: mySMESHGUI( theModule ),
myFilterDlg(0),
myIsApplyAndClose( false ),
@ -397,11 +372,12 @@ bool SMESHGUI_MG_ADAPTDRIVER::execute()
{
int err;
std::string errStr;
//~std::string errStr;
char* errStr;
try
{
err = getModel()->compute(errStr);
std::string msg = err == 0 ? " ok" : std::string("Not ok \n")+errStr ;
std::string msg = err == 0 ? " ok" : std::string("Not ok \n")+CORBA::string_dup(errStr) ;
}
catch (const std::exception& e)
{
@ -611,7 +587,7 @@ bool SMESHGUI_MG_ADAPTDRIVER::isValid()
bool SMESHGUI_MG_ADAPTDRIVER::createMeshInObjectBrowser()
{
QString filename(getModel()->getMedFileOut().c_str());
QString filename(getModel()->getMedFileOut());
QStringList errors;
QStringList anEntryList;
bool isEmpty = false;

View File

@ -45,8 +45,9 @@
// model
//~#include "MG_ADAPT.h"
#include "MG_ADAPTGUI.hxx"
#include "MG_ADAPT.hxx"
//~#include "MG_ADAPT.hxx"
#include CORBA_SERVER_HEADER(MG_ADAPT)
class SUIT_ViewWindow;
class SUIT_Desktop;
@ -103,29 +104,13 @@ Handle(SALOME_InteractiveObject) firstIObject();
bool createAndPublishMed(QString fileName);
bool createMgAdaptObject(MgAdapt* myMgAdapt = 0);
class SMESHGUI_EXPORT SMESHGUI_MG_AdaptComputeDlg_QThread : public QThread
{
Q_OBJECT
public:
SMESHGUI_MG_AdaptComputeDlg_QThread(MgAdapt* model);
int result();
void cancel();
protected:
void run();
private:
MgAdapt* model;
int myResult;
};
class SMESHGUI_MG_ADAPTDRIVER : public SMESHGUI_MgAdaptDlg
{
Q_OBJECT;
public :
SMESHGUI_MG_ADAPTDRIVER( SMESHGUI*, MgAdapt*, bool isCreation = true );
SMESHGUI_MG_ADAPTDRIVER( SMESHGUI*, SMESH::MG_ADAPT_ptr, bool isCreation = true );
void setMyMesh(SMESH::SMESH_Mesh_var);
SMESH::SMESH_Mesh_var getMyMesh() ;

View File

@ -37,8 +37,11 @@ INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}/src/DriverCGNS
${PROJECT_SOURCE_DIR}/src/SMESH
${PROJECT_SOURCE_DIR}/src/SMESHUtils
#~${PROJECT_SOURCE_DIR}/src/ADAPT
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/idl
#~${PROJECT_BINARY_DIR}/ADAPT
${MEDCOUPLING_INCLUDE_DIRS}
)
# additional preprocessor / compiler flags
@ -81,6 +84,7 @@ SET(_link_LIBRARIES
SMESHDS
SMESHControls
MeshDriverMED
${MEDCoupling_medloader}
)
# --- headers ---
@ -107,6 +111,7 @@ SET(SMESHEngine_HEADERS
SMESH_PreMeshInfo.hxx
SMESH_MeshPartDS.hxx
SMESH.hxx
MG_ADAPT_i.hxx
)
# --- sources ---
@ -132,6 +137,7 @@ SET(SMESHEngine_SOURCES
SMESH_NoteBook.cxx
SMESH_Measurements_i.cxx
SMESH_PreMeshInfo.cxx
MG_ADAPT_i.cxx
)
# --- rules ---

427
src/SMESH_I/MG_ADAPT_i.cxx Normal file
View File

@ -0,0 +1,427 @@
// 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 "string.h"
#include "SMESH_Gen_i.hxx"
#include <SMESH_Gen.hxx>
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOMEDS)
//~#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
//~#include CORBA_CLIENT_HEADER(SMESH_Gen)
//=============================================================================
/*!
* SMESH_Gen_i::CreateMG_ADAPT
*
* Create measurement instance
*/
//=============================================================================
using namespace SMESH;
void MG_ADAPT_i::copyHypothesisDataToImpl(const SMESH::MgAdaptHypothesisData& from, ::MG_ADAPT::MgAdaptHypothesisData* to) const
{
to->myFileInDir = from.myFileInDir;
to->myMeshFileIn = from.myMeshFileIn;
to->myMeshFileBackground = from.myMeshFileBackground;
to->myOutMeshName = from.myOutMeshName;
to->myMeshFileOut = from.myMeshFileOut;
to->myFileOutDir = from.myFileOutDir;
to->myFileSizeMapDir = from.myFileSizeMapDir;
to->myFieldName = from.myFieldName;
to->fromMedFile = from.fromMedFile;
to->myPublish = from.myPublish;
to->myMeshOutMed = from.myMeshOutMed;
to->myUseLocalMap = from.myUseLocalMap;
to->myUseBackgroundMap = from.myUseBackgroundMap;
to->myUseConstantValue = from.myUseConstantValue;
to->myConstantValue = from.myConstantValue;
to->myTimeStep = from.myTimeStep;
to->myRank = from.myRank;
to->myUseNoTimeStep = from.myUseNoTimeStep;
to->myUseLastTimeStep = from.myUseLastTimeStep;
to->myUseChosenTimeStep = from.myUseChosenTimeStep;
to->myWorkingDir = from.myWorkingDir;
to->myLogFile = from.myLogFile;
to->myPrintLogInFile = from.myPrintLogInFile;
to->myKeepFiles = from.myKeepFiles;
to->myRemoveLogOnSuccess = from.myRemoveLogOnSuccess;
to->myVerboseLevel = from.myVerboseLevel;
}
void MG_ADAPT_i::copyHypothesisDataFromImpl(const ::MG_ADAPT::MgAdaptHypothesisData* from, SMESH::MgAdaptHypothesisData* to) const
{
to->myFileInDir = CORBA::string_dup(from->myFileInDir.c_str());
to->myMeshFileIn = CORBA::string_dup(from->myMeshFileIn.c_str());
to->myMeshFileBackground = CORBA::string_dup(from->myMeshFileBackground.c_str());
to->myOutMeshName = CORBA::string_dup(from->myOutMeshName.c_str());
to->myMeshFileOut = CORBA::string_dup(from->myMeshFileOut.c_str());
to->myFileOutDir = CORBA::string_dup(from->myFileOutDir.c_str());
to->myFileSizeMapDir = CORBA::string_dup(from->myFileSizeMapDir.c_str());
to->myFieldName = CORBA::string_dup(from->myFieldName.c_str());
to->fromMedFile = from->fromMedFile;
to->myPublish = from->myPublish;
to->myMeshOutMed = from->myMeshOutMed;
to->myUseLocalMap = from->myUseLocalMap;
to->myUseBackgroundMap = from->myUseBackgroundMap;
to->myUseConstantValue = from->myUseConstantValue;
to->myConstantValue = from->myConstantValue;
to->myTimeStep = from->myTimeStep;
to->myRank = from->myRank;
to->myUseNoTimeStep = from->myUseNoTimeStep;
to->myUseLastTimeStep = from->myUseLastTimeStep;
to->myUseChosenTimeStep = from->myUseChosenTimeStep;
to->myWorkingDir = CORBA::string_dup(from->myWorkingDir.c_str());
to->myLogFile = CORBA::string_dup(from->myLogFile.c_str());
to->myPrintLogInFile = from->myPrintLogInFile;
to->myKeepFiles = from->myKeepFiles;
to->myRemoveLogOnSuccess = from->myRemoveLogOnSuccess;
to->myVerboseLevel = from->myVerboseLevel;
}
SMESH::MG_ADAPT_ptr SMESH_Gen_i::CreateMG_ADAPT()
{
SMESH::MG_ADAPT_i* aMGadapt = new SMESH::MG_ADAPT_i();
SMESH::MG_ADAPT_var anObj = aMGadapt->_this();
return anObj._retn();
}
//~SMESH::MG_ADAPT_ptr MG_ADAPT_i::CreateMG_ADAPT()
//~{
//~SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
//~SMESH::MG_ADAPT_i* aMGadapt = new SMESH::MG_ADAPT_i(smeshGen_i->GetPOA());
//~SMESH::MG_ADAPT_var anObj = aMGadapt->_this();
//~return anObj._retn();
//~}
//=============================================================================
/*!
* standard constructor
*/
//=============================================================================
MG_ADAPT_i::MG_ADAPT_i(): SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
{
myMgAdapt = new ::MG_ADAPT::MgAdapt();
}
//~MG_ADAPT_i::MG_ADAPT_i(PortableServer::POA_var myPoa): SALOME::GenericObj_i( myPoa )
//~{
//~myMgAdapt = new ::MG_ADAPT::MgAdapt();
//~}
//=============================================================================
/*!
* 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();
//~}
//=============================================================================
/*!
* standard destructor
*/
//=============================================================================
MG_ADAPT_i::~MG_ADAPT_i()
{
}
void MG_ADAPT_i::setData( SMESH::MgAdaptHypothesisData& data)
{
::MG_ADAPT::MgAdaptHypothesisData* baseData = new ::MG_ADAPT::MgAdaptHypothesisData();
copyHypothesisDataToImpl(data, baseData);
myMgAdapt->setData(baseData);
delete baseData;
}
void MG_ADAPT_i::setMedFileIn(const char* str)
{
myMgAdapt->setMedFileIn(str);
}
char* MG_ADAPT_i::getMedFileIn()
{
return CORBA::string_dup(myMgAdapt->getMedFileIn().c_str());
}
void MG_ADAPT_i::setMedFileOut(const char* str)
{
myMgAdapt->setMedFileOut(str);
}
char* MG_ADAPT_i::getMedFileOut()
{
return CORBA::string_dup(myMgAdapt->getMedFileOut().c_str());
}
void MG_ADAPT_i::setMeshName(const char* str)
{
myMgAdapt->setMeshName(str);
}
char* MG_ADAPT_i::getMeshName()
{
return CORBA::string_dup(myMgAdapt->getMeshName().c_str());
}
void MG_ADAPT_i::setMeshNameOut(const 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(const 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()
{
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::setTimeStepRankLast()
{
myMgAdapt->setTimeStepRankLast();
}
void MG_ADAPT_i::setNoTimeStep()
{
myMgAdapt->setNoTimeStep();
}
void MG_ADAPT_i::setLogFile(const 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();
}
SMESH::MgAdaptHypothesisData* MG_ADAPT_i::getData()
{
SMESH::MgAdaptHypothesisData* result = new SMESH::MgAdaptHypothesisData();
::MG_ADAPT::MgAdaptHypothesisData* from = myMgAdapt->getData();
copyHypothesisDataFromImpl(from, result);
return result;
}
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()
{
return myMgAdapt->getConstantValue();
}
void MG_ADAPT_i::setSizeMapFile(const 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(const char* dir)
{
myMgAdapt->setWorkingDir(dir);
}
char* MG_ADAPT_i::getWorkingDir()
{
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(::CORBA::String_out errStr)
{
std::string err("");
CORBA::Long ret = myMgAdapt->compute(err);
errStr = err.c_str();
return ret;
}
char* MG_ADAPT_i::getFileName()
{
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( const SMESH::MgAdaptHypothesisData& data)
{
::MG_ADAPT::MgAdaptHypothesisData* baseData = new ::MG_ADAPT::MgAdaptHypothesisData();
copyHypothesisDataToImpl(data, baseData);
myMgAdapt->copyMgAdaptHypothesisData(baseData);
delete baseData;
}
//~void MG_ADAPT_i::checkDirPath(char*& str)
//~{
//~myMgAdapt->checkDirPath(str);
//~}
bool MG_ADAPT_i::hasOptionDefined( const char* optionName )
{
return myMgAdapt->hasOptionDefined(optionName);
}
void MG_ADAPT_i::setOptionValue(const char* optionName,
const char* optionValue) throw (std::invalid_argument)
{
myMgAdapt->setOptionValue(optionName, optionValue);
}
char* MG_ADAPT_i::getOptionValue(const char* optionName,
bool& isDefault) throw (std::invalid_argument)
{
return CORBA::string_dup(myMgAdapt->getOptionValue(optionName, &isDefault).c_str());
}
str_array* MG_ADAPT_i::getCustomOptionValuesStrVec()
{
SMESH::str_array_var result = new SMESH::str_array();
std::vector <std::string> vals = myMgAdapt->getCustomOptionValuesStrVec();
result->length(vals.size());
for (int i = 0; i<vals.size(); i++) result[i] = CORBA::string_dup(vals[i].c_str());
return result._retn();
}
str_array* MG_ADAPT_i::getOptionValuesStrVec()
{
SMESH::str_array_var result = new SMESH::str_array();
std::vector <std::string> vals = myMgAdapt->getOptionValuesStrVec();
result->length(vals.size());
for (int i = 0; i<vals.size(); i++) result[i] = CORBA::string_dup(vals[i].c_str());
return result._retn();
}
void MG_ADAPT_i::setPrintLogInFile(bool mybool)
{
myMgAdapt->setPrintLogInFile(mybool);
}
bool MG_ADAPT_i::getPrintLogInFile()
{
return myMgAdapt->getPrintLogInFile();
}
//~TOptionValues MG_ADAPT_i::getOptionValues() const;
//~const TOptionValues& MG_ADAPT_i::getCustomOptionValues() const ;

138
src/SMESH_I/MG_ADAPT_i.hxx Normal file
View File

@ -0,0 +1,138 @@
#ifndef MG_ADAPT_I_HXX
#define MG_ADAPT_I_HXX
#include "MG_ADAPT.hxx"
#include "SMESH.hxx"
#include <SALOMEconfig.h>
//~#include CORBA_SERVER_HEADER(ADAPT_Gen)
#include CORBA_SERVER_HEADER(MG_ADAPT)
#include "SALOME_GenericObj_i.hh"
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
#include "Utils_CorbaException.hxx"
#include <string>
//~struct MgAdaptHypothesisData;
//~static void copyHypothesisDataToImpl(SMESH::MgAdaptHypothesisData& from, MG_ADAPT::MgAdaptHypothesisData* to);
//~static void copyHypothesisDataFromImpl(MG_ADAPT::MgAdaptHypothesisData* from, SMESH::MgAdaptHypothesisData& to);
//~class MgAdapt;
namespace SMESH
{
class SMESH_I_EXPORT MG_ADAPT_i :
public virtual SALOME::GenericObj_i,
public virtual POA_SMESH::MG_ADAPT
{
public:
//~MG_ADAPT_i( CORBA::ORB_ptr orb, ADAPT::ADAPT_Gen_var gen_i );
//~static SMESH::MG_ADAPT_ptr CreateMG_ADAPT();
//~MG_ADAPT_i(PortableServer::POA_var poa);
MG_ADAPT_i();
virtual ~MG_ADAPT_i();
//~void setData( SMESH::MgAdaptHypothesisData* data);
void setData( SMESH::MgAdaptHypothesisData& data);
void setMedFileIn(const char* str);
char* getMedFileIn();
void setMedFileOut(const char* str);
char* getMedFileOut();
void setMeshName(const char* str);
char* getMeshName();
void setMeshNameOut(const char* str);
char* getMeshNameOut();
void setMeshOutMed(bool mybool);
bool getMeshOutMed();
void setPublish(bool mybool);
bool getPublish();
void setFieldName(const char* str);
char* getFieldName();
void setTimeStep(CORBA::Long t);
CORBA::Long getTimeStep() ;
void setRankTimeStep(CORBA::Long t, CORBA::Long r );
CORBA::Long getRank();
void setTimeStepRankLast();
void setNoTimeStep();
void setLogFile(const char* str);
char* getLogFile();
void setVerbosityLevel(CORBA::Long v);
CORBA::Long getVerbosityLevel();
void setRemoveOnSuccess(bool mybool);
bool getRemoveOnSuccess();
SMESH::MgAdaptHypothesisData* getData() ;
void setUseLocalMap(bool mybool);
bool getUseLocalMap();
void setUseBackgroundMap(bool mybool);
bool getUseBackgroundMap();
void setUseConstantValue(bool mybool);
bool getUseConstantValue();
void setConstantValue(double value);
double getConstantValue();
void setSizeMapFile(const 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(const char* str);
char* getWorkingDir() ;
void setPrintLogInFile(bool mybool);
bool getPrintLogInFile();
bool setAll();
char* getCommandToRun() ;
CORBA::Long compute(::CORBA::String_out errStr);
char* getFileName();
char* getExeName();
void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) ;
//~void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) {
//~copyMgAdaptHypothesisData(&data);
//~}
//~void checkDirPath(char*& str);
bool hasOptionDefined( const char* optionName ) ;
void setOptionValue(const char* optionName,
const char* optionValue) throw (std::invalid_argument);
char* getOptionValue(const char* optionName,
bool& isDefault) throw (std::invalid_argument);
str_array* getCustomOptionValuesStrVec() ;
str_array* getOptionValuesStrVec() ;
void copyHypothesisDataFromImpl(const ::MG_ADAPT::MgAdaptHypothesisData* from, SMESH::MgAdaptHypothesisData* to) const;
void copyHypothesisDataToImpl(const SMESH::MgAdaptHypothesisData& from, ::MG_ADAPT::MgAdaptHypothesisData* to) const;
//~TOptionValues getOptionValues() const;
//~const TOptionValues& getCustomOptionValues() const ;
private:
::MG_ADAPT::MgAdapt* myMgAdapt;
//~CORBA::ORB_ptr _orb;
//~ADAPT::ADAPT_Gen_var _gen_i;
};
}
#endif // MG_ADAPT_I_HXX

View File

@ -469,6 +469,7 @@ public:
void CleanPythonTrace();
static int CountInPyDump(const TCollection_AsciiString& text);
SMESH::MG_ADAPT_ptr CreateMG_ADAPT();
// *****************************************
// Internal methods