Remplacement des taquets de tabulations paor des espaces

This commit is contained in:
GERALD NICOLAS 2021-02-03 15:55:16 +01:00
parent 55f658966b
commit 36e723d3d3
9 changed files with 2783 additions and 2843 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
// Copyright (C) 2011-2020 CEA/DEN, EDF R&D // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
@ -14,9 +14,9 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : MG_ADAPT.hxx // File : MG_ADAPT.hxx
// //
#ifndef MG_ADAPT_HXX #ifndef MG_ADAPT_HXX
#define MG_ADAPT_HXX #define MG_ADAPT_HXX
@ -40,22 +40,21 @@ namespace MG_ADAPT{
class MgAdapt; class MgAdapt;
typedef std::map< std::string, std::string > TOptionValues; typedef std::map< std::string, std::string > TOptionValues;
typedef std::set< std::string > TOptionNames; typedef std::set< std::string > TOptionNames;
struct MgAdaptHypothesisData struct MgAdaptHypothesisData
{ {
std::string myFileInDir, myMeshFileIn, myInMeshName, myMeshFileBackground, myOutMeshName, std::string myFileInDir, myMeshFileIn, myInMeshName, myMeshFileBackground, myOutMeshName,
myMeshFileOut, myFileOutDir, myFileSizeMapDir, myFieldName; myMeshFileOut, myFileOutDir, myFileSizeMapDir, myFieldName;
bool fromMedFile; bool fromMedFile;
bool myPublish, myMeshOutMed; bool myPublish, myMeshOutMed;
bool myUseLocalMap, myUseBackgroundMap, myUseConstantValue; bool myUseLocalMap, myUseBackgroundMap, myUseConstantValue;
double myConstantValue; double myConstantValue;
int myRank, myTimeStep; int myRank, myTimeStep;
bool myUseNoTimeStep, myUseLastTimeStep, myUseChosenTimeStep; bool myUseNoTimeStep, myUseLastTimeStep, myUseChosenTimeStep;
std::string myWorkingDir, myLogFile; std::string myWorkingDir, myLogFile;
bool myPrintLogInFile, myKeepFiles, myRemoveLogOnSuccess; bool myPrintLogInFile, myKeepFiles, myRemoveLogOnSuccess;
int myVerboseLevel; int myVerboseLevel;
}; };
class outFileStream : public std::ofstream{ class outFileStream : public std::ofstream{
@ -68,43 +67,43 @@ public:
*/ */
class ToComment : public std::string class ToComment : public std::string
{ {
std::ostringstream _s ; std::ostringstream _s ;
public : public :
ToComment():std::string("") {} ToComment():std::string("") {}
ToComment(const ToComment& c):std::string() { ToComment(const ToComment& c):std::string() {
_s << c.c_str() ; _s << c.c_str() ;
this->std::string::operator=( _s.str() ); this->std::string::operator=( _s.str() );
} }
ToComment & operator=(const ToComment& c) { ToComment & operator=(const ToComment& c) {
_s << c.c_str() ; _s << c.c_str() ;
this->std::string::operator=( _s.str() ); this->std::string::operator=( _s.str() );
return *this; return *this;
} }
template <class T> template <class T>
ToComment( const T &anything ) { ToComment( const T &anything ) {
_s << anything ; _s << anything ;
this->std::string::operator=( _s.str() ); this->std::string::operator=( _s.str() );
} }
template <class T> template <class T>
ToComment & operator<<( const T &anything ) { ToComment & operator<<( const T &anything ) {
_s << anything ; _s << anything ;
this->std::string::operator=( _s.str() ); this->std::string::operator=( _s.str() );
return *this ; return *this ;
} }
operator char*() const { operator char*() const {
return (char*)c_str(); return (char*)c_str();
} }
std::ostream& Stream() { std::ostream& Stream() {
return _s; return _s;
} }
}; };
@ -113,227 +112,223 @@ class MgAdapt
public: public:
MgAdapt(); MgAdapt();
MgAdapt(MgAdaptHypothesisData*); MgAdapt(MgAdaptHypothesisData*);
MgAdapt(const MgAdapt&); MgAdapt(const MgAdapt&);
~MgAdapt(); ~MgAdapt();
void buildModel(); void buildModel();
void setData( MgAdaptHypothesisData* data); void setData( MgAdaptHypothesisData* data);
void setMedFileIn(std::string fileName); void setMedFileIn(std::string fileName);
std::string getMedFileIn(); std::string getMedFileIn();
void setMedFileOut(std::string fileOut); void setMedFileOut(std::string fileOut);
std::string getMedFileOut(); std::string getMedFileOut();
void setMeshName(std::string name); void setMeshName(std::string name);
std::string getMeshName(); std::string getMeshName();
void setMeshNameOut(std::string name); void setMeshNameOut(std::string name);
std::string getMeshNameOut(); std::string getMeshNameOut();
void setMeshOutMed(bool mybool); void setMeshOutMed(bool mybool);
bool getMeshOutMed(); bool getMeshOutMed();
void setPublish(bool mybool); void setPublish(bool mybool);
bool getPublish(); bool getPublish();
void setFieldName(std::string myFieldName); void setFieldName(std::string myFieldName);
std::string getFieldName(); std::string getFieldName();
void setTimeStep(int time); void setTimeStep(int time);
int getTimeStep() const; int getTimeStep() const;
void setRankTimeStep(int time, int myRank); void setRankTimeStep(int time, int myRank);
int getRank(); int getRank();
void setTimeStepRankLast(); void setTimeStepRankLast();
void setNoTimeStep(); void setNoTimeStep();
void setChosenTimeStepRank(); void setChosenTimeStepRank();
void updateTimeStepRank(); void updateTimeStepRank();
void setLogFile(std::string); void setLogFile(std::string);
std::string getLogFile(); std::string getLogFile();
void setVerbosityLevel(int verbosity); void setVerbosityLevel(int verbosity);
int getVerbosityLevel(); int getVerbosityLevel();
void setRemoveOnSuccess(bool mybool); void setRemoveOnSuccess(bool mybool);
bool getRemoveOnSuccess(); bool getRemoveOnSuccess();
MgAdaptHypothesisData* getData() const; MgAdaptHypothesisData* getData() const;
void setUseLocalMap(bool mybool); void setUseLocalMap(bool mybool);
bool getUseLocalMap(); bool getUseLocalMap();
void setUseBackgroundMap(bool mybool); void setUseBackgroundMap(bool mybool);
bool getUseBackgroundMap(); bool getUseBackgroundMap();
void setUseConstantValue(bool mybool); void setUseConstantValue(bool mybool);
bool getUseConstantValue(); bool getUseConstantValue();
void setConstantValue(double cnst); void setConstantValue(double cnst);
double getConstantValue() const; double getConstantValue() const;
void setSizeMapFile(std::string mapFile); void setSizeMapFile(std::string mapFile);
std::string getSizeMapFile(); std::string getSizeMapFile();
void setFromMedFile(bool mybool); void setFromMedFile(bool mybool);
bool isFromMedFile(); bool isFromMedFile();
void setKeepWorkingFiles(bool mybool); void setKeepWorkingFiles(bool mybool);
bool getKeepWorkingFiles(); bool getKeepWorkingFiles();
void setPrintLogInFile(bool mybool); void setPrintLogInFile(bool mybool);
bool getPrintLogInFile(); bool getPrintLogInFile();
void setWorkingDir(std::string dir); void setWorkingDir(std::string dir);
std::string getWorkingDir() const; std::string getWorkingDir() const;
bool setAll(); bool setAll();
static std::string getCommandToRun(MgAdapt* ); static std::string getCommandToRun(MgAdapt* );
std::string getCommandToRun() ; std::string getCommandToRun() ;
int compute(std::string& errStr); int compute(std::string& errStr);
std::string getFileName() const; std::string getFileName() const;
static std::string getExeName(); static std::string getExeName();
void copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from) ; void copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from) ;
void checkDirPath(std::string& dirPath); void checkDirPath(std::string& dirPath);
bool hasOptionDefined( const std::string& optionName ) const; bool hasOptionDefined( const std::string& optionName ) const;
void setOptionValue(const std::string& optionName, void setOptionValue(const std::string& optionName,
const std::string& optionValue) throw (std::invalid_argument); const std::string& optionValue) throw (std::invalid_argument);
std::string getOptionValue(const std::string& optionName, std::string getOptionValue(const std::string& optionName,
bool* isDefault=0) const throw (std::invalid_argument); bool* isDefault=0) const throw (std::invalid_argument);
std::vector <std::string> getCustomOptionValuesStrVec() const; std::vector <std::string> getCustomOptionValuesStrVec() const;
std::vector <std::string> getOptionValuesStrVec() const; std::vector <std::string> getOptionValuesStrVec() const;
TOptionValues getOptionValues() const; TOptionValues getOptionValues() const;
const TOptionValues& getCustomOptionValues() const ; const TOptionValues& getCustomOptionValues() const ;
static double toDbl(const std::string&, bool* isOk = 0) throw (std::invalid_argument); static double toDbl(const std::string&, bool* isOk = 0) throw (std::invalid_argument);
static bool toBool(const std::string&, bool* isOk = 0) throw (std::invalid_argument); static bool toBool(const std::string&, bool* isOk = 0) throw (std::invalid_argument);
static int toInt(const std::string&, bool* isOk = 0 ) throw (std::invalid_argument); static int toInt(const std::string&, bool* isOk = 0 ) throw (std::invalid_argument);
static std::string toLowerStr(const std::string& str); static std::string toLowerStr(const std::string& str);
/* default values */
static std::string defaultWorkingDirectory();
static std::string defaultLogFile();
static bool defaultKeepFiles();
static bool defaultRemoveLogOnSuccess();
static int defaultVerboseLevel();
static bool defaultPrintLogInFile();
static bool defaultFromMedFile();
static bool defaultMeshOutMed();
static bool defaultPublish();
static bool defaultUseLocalMap();
static bool defaultUseBackgroundMap();
static bool defaultUseConstantValue();
static bool defaultUseNoTimeStep();
static bool defaultUseLastTimeStep();
static bool defaultUseChosenTimeStep();
static double defaultMaximumMemory();
static bool isFileExist(const std::string& fName);
/* default values */ enum Status {
static std::string defaultWorkingDirectory(); DRS_OK,
static std::string defaultLogFile(); DRS_EMPTY, // a file contains no mesh with the given name
static bool defaultKeepFiles(); DRS_WARN_RENUMBER, // a file has overlapped ranges of element numbers,
static bool defaultRemoveLogOnSuccess(); // so the numbers from the file are ignored
static int defaultVerboseLevel(); DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
static bool defaultPrintLogInFile(); DRS_WARN_DESCENDING, // some elements were skipped due to descending connectivity
static bool defaultFromMedFile(); DRS_FAIL, // general failure (exception etc.)
static bool defaultMeshOutMed(); DRS_NO_TIME_STEP // general failure (exception etc.)
static bool defaultPublish(); };
static bool defaultUseLocalMap();
static bool defaultUseBackgroundMap();
static bool defaultUseConstantValue();
static bool defaultUseNoTimeStep();
static bool defaultUseLastTimeStep();
static bool defaultUseChosenTimeStep();
static double defaultMaximumMemory();
static bool isFileExist(const std::string& fName);
struct group {
std::string _name;
std::vector<MEDCoupling::mcIdType> _famListId;
std::vector<std::string> _famNames;
group(std::string name, std::vector<MEDCoupling::mcIdType> famListId, std::vector<std::string> famNames):_name(name)
{
std::vector<MEDCoupling::mcIdType>::iterator it = famListId.begin();
for (; it!=famListId.end(); ++it)
_famListId.push_back(*it);
std::vector<std::string>::iterator itt = famNames.begin();
for (; itt!=famNames.end(); ++itt)
_famNames.push_back(*itt);
}
};
enum Status { struct family {
DRS_OK, std::string _famName;
DRS_EMPTY, // a file contains no mesh with the given name mcIdType _famId;
DRS_WARN_RENUMBER, // a file has overlapped ranges of element numbers, family(std::string famName, MEDCoupling::mcIdType famId):_famName(famName), _famId(famId) {}
// so the numbers from the file are ignored };
DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
DRS_WARN_DESCENDING, // some elements were skipped due to descending connectivity
DRS_FAIL, // general failure (exception etc.)
DRS_NO_TIME_STEP // general failure (exception etc.)
};
struct group {
std::string _name;
std::vector<MEDCoupling::mcIdType> _famListId;
std::vector<std::string> _famNames;
group(std::string name, std::vector<MEDCoupling::mcIdType> famListId, std::vector<std::string> famNames):_name(name)
{
std::vector<MEDCoupling::mcIdType>::iterator it = famListId.begin();
for (; it!=famListId.end(); ++it)
_famListId.push_back(*it);
std::vector<std::string>::iterator itt = famNames.begin();
for (; itt!=famNames.end(); ++itt)
_famNames.push_back(*itt);
}
};
struct family {
std::string _famName;
mcIdType _famId;
family(std::string famName, MEDCoupling::mcIdType famId):_famName(famName), _famId(famId) {}
};
private : private :
bool fromMedFile; bool fromMedFile;
std::string medFileIn; std::string medFileIn;
std::string medFileOut; std::string medFileOut;
std::string meshName; std::string meshName;
std::string meshNameOut; std::string meshNameOut;
bool publish, meshOutMed; bool publish, meshOutMed;
bool useLocalMap, useBackgroundMap, useConstantValue; bool useLocalMap, useBackgroundMap, useConstantValue;
bool myUseLastTimeStep, myUseNoTimeStep, myUseChosenTimeStep; bool myUseLastTimeStep, myUseNoTimeStep, myUseChosenTimeStep;
std::string sizeMapFile; std::string sizeMapFile;
std::string fieldName; std::string fieldName;
double constantValue; double constantValue;
int rank, timeStep; int rank, timeStep;
/* advanced options */ /* advanced options */
std::string logFile; std::string logFile;
std::string workingDir; std::string workingDir;
int verbosityLevel; int verbosityLevel;
bool removeOnSuccess; bool removeOnSuccess;
bool toKeepWorkingFiles; bool toKeepWorkingFiles;
bool printLogInFile; bool printLogInFile;
/* Model DATA */ /* Model DATA */
MgAdaptHypothesisData* data; MgAdaptHypothesisData* data;
/* */ /* */
TOptionValues _option2value, _customOption2value; // user defined values TOptionValues _option2value, _customOption2value; // user defined values
TOptionValues _defaultOptionValues; // default values TOptionValues _defaultOptionValues; // default values
TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
std::vector <std::string> _myErrorMessages; std::vector <std::string> _myErrorMessages;
Status _myStatus; Status _myStatus;
std::string meshFormatOutputMesh; std::string meshFormatOutputMesh;
std::vector< std::string> solFormatOutput; std::vector< std::string> solFormatOutput;
std::vector <group> groupVec; std::vector <group> groupVec;
std::vector <family> famVec; std::vector <family> famVec;
std::vector< std::string> tmpFilesToBeDeleted; std::vector< std::string> tmpFilesToBeDeleted;
/* convert MED-->.mesh format */ /* convert MED-->.mesh format */
void convertMedFile(std::string& meshIn,std::string& solFileIn, std::string& sizeMapIn) ; void convertMedFile(std::string& meshIn,std::string& solFileIn, std::string& sizeMapIn) ;
void storeGroups(MEDCoupling::MEDFileMesh* fileMesh); void storeGroups(MEDCoupling::MEDFileMesh* fileMesh);
void restoreGroups(MEDCoupling::MEDFileMesh* fileMesh) const; void restoreGroups(MEDCoupling::MEDFileMesh* fileMesh) const;
void storefams(MEDCoupling::MEDFileMesh* fileMesh); void storefams(MEDCoupling::MEDFileMesh* fileMesh);
void restorefams(MEDCoupling::MEDFileMesh* fileMesh) const; void restorefams(MEDCoupling::MEDFileMesh* fileMesh) const;
void storeGroupsAndFams(MEDCoupling::MEDFileMesh* fileMesh); void storeGroupsAndFams(MEDCoupling::MEDFileMesh* fileMesh);
void restoreGroupsAndFams(MEDCoupling::MEDFileMesh* fileMesh) const; void restoreGroupsAndFams(MEDCoupling::MEDFileMesh* fileMesh) const;
void convertMeshFile(std::string& meshFormatIn, std::vector< std::string>& solFieldFileNames) const ; void convertMeshFile(std::string& meshFormatIn, std::vector< std::string>& solFieldFileNames) const ;
void buildConstantSizeMapSolFile(const std::string& solFormatFieldFileName, const int dim, const int version, const mcIdType nbNodes) const; void buildConstantSizeMapSolFile(const std::string& solFormatFieldFileName, const int dim, const int version, const mcIdType nbNodes) const;
void buildBackGroundMeshAndSolFiles(const std::vector<std::string>& fieldFileNames, const std::string& meshFormatsizeMapFile) const; void buildBackGroundMeshAndSolFiles(const std::vector<std::string>& fieldFileNames, const std::string& meshFormatsizeMapFile) const;
void getTimeStepInfos(std::string aFile, med_int& numdt, med_int& numit); void getTimeStepInfos(std::string aFile, med_int& numdt, med_int& numit);
Status addMessage(const std::string& msg, const bool isFatal = false); Status addMessage(const std::string& msg, const bool isFatal = false);
med_idt openMedFile(const std::string aFile) ; med_idt openMedFile(const std::string aFile) ;
void execCmd( const char* cmd, int& err); void execCmd( const char* cmd, int& err);
void cleanUp(); void cleanUp();
void appendMsgToLogFile(std::string& msg); void appendMsgToLogFile(std::string& msg);
}; };
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,7 @@
// Copyright (C) 2011-2020 CEA/DEN, EDF R&D // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
@ -16,9 +19,8 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// SMESH SMESHGUI : GUI for the adaptation in the SMESH component // SMESH SMESHGUI : GUI for the adaptation in the SMESH component
// File : MG_ADAPTGUI.hxx // File : MG_ADAPTGUI.hxx
// //
#ifndef MG_ADAPTGUI_HXX #ifndef MG_ADAPTGUI_HXX
#define MG_ADAPTGUI_HXX #define MG_ADAPTGUI_HXX
@ -103,9 +105,9 @@ std::string remove_extension(const std::string& filename);
enum ADAPTATION_MODE{ enum ADAPTATION_MODE{
SURFACE, // surface adaption when meshDim == 2 SURFACE, // surface adaption when meshDim == 2
VOLUME, // VOLUME, //
BOTH BOTH
}; };
//================================================================================= //=================================================================================
// class : SMESHGUI_MgAdaptDlg // class : SMESHGUI_MgAdaptDlg
@ -113,148 +115,146 @@ enum ADAPTATION_MODE{
//================================================================================= //=================================================================================
class SMESHGUI_MgAdaptDlg : public QDialog class SMESHGUI_MgAdaptDlg : public QDialog
{ {
Q_OBJECT; Q_OBJECT;
public: public:
//! Property type //! Property type
enum Mode { Arguments, AdvancedOptions}; enum Mode { Arguments, AdvancedOptions};
SMESHGUI_MgAdaptDlg( SalomeApp_Module*, SMESH::MG_ADAPT_ptr, QWidget* parent= 0,bool isCreation = true ); SMESHGUI_MgAdaptDlg( SalomeApp_Module*, SMESH::MG_ADAPT_ptr, QWidget* parent= 0,bool isCreation = true );
~SMESHGUI_MgAdaptDlg(); ~SMESHGUI_MgAdaptDlg();
void buildDlg(); void buildDlg();
void reject(); void reject();
bool checkParams(QString& msg) ; bool checkParams(QString& msg) ;
//~void setModel(MgAdapt*); //~void setModel(MgAdapt*);
SMESH::MG_ADAPT_ptr getModel() const; SMESH::MG_ADAPT_ptr getModel() const;
public slots: public slots:
protected slots: protected slots:
virtual bool clickOnApply(); virtual bool clickOnApply();
private slots: private slots:
virtual void clickOnHelp(); virtual void clickOnHelp();
virtual void clickOnOk(); virtual void clickOnOk();
protected : protected :
SMESHGUI_MgAdaptArguments* myArgs; SMESHGUI_MgAdaptArguments* myArgs;
MgAdaptAdvWidget* myAdvOpt; MgAdaptAdvWidget* myAdvOpt;
bool readParamsFromHypo( ) const ; bool readParamsFromHypo( ) const ;
bool readParamsFromWidgets( ) ; bool readParamsFromWidgets( ) ;
bool storeParamsToHypo( const SMESH::MgAdaptHypothesisData & ) const; bool storeParamsToHypo( const SMESH::MgAdaptHypothesisData & ) const;
private: private:
SalomeApp_Module* mySMESHGUI; /* Current SMESHGUI object */
SalomeApp_Module* mySMESHGUI; /* Current SMESHGUI object */ QTabWidget* myTabWidget;
QTabWidget* myTabWidget;
SMESH::MgAdaptHypothesisData* myData; SMESH::MgAdaptHypothesisData* myData;
SMESH::MG_ADAPT_ptr model; SMESH::MG_ADAPT_ptr model;
}; };
class SMESHGUI_MgAdaptArguments : public QWidget class SMESHGUI_MgAdaptArguments : public QWidget
{ {
Q_OBJECT; Q_OBJECT;
public: public:
//! Property type //! Property type
enum Mode { Mesh, Browser}; enum Mode { Mesh, Browser};
enum SIZEMAP { Local, Background, Constant}; enum SIZEMAP { Local, Background, Constant};
SMESHGUI_MgAdaptArguments( QWidget* parent); SMESHGUI_MgAdaptArguments( QWidget* parent);
~SMESHGUI_MgAdaptArguments(); ~SMESHGUI_MgAdaptArguments();
void setMode( const Mode, const SIZEMAP ); void setMode( const Mode, const SIZEMAP );
med_int getMeshDim() const; med_int getMeshDim() const;
QString* myFileInDir; QString* myFileInDir;
QString* myFileOutDir; QString* myFileOutDir;
QString* myFileSizeMapDir; QString* myFileSizeMapDir;
QGroupBox* aMeshIn ; QGroupBox* aMeshIn ;
QRadioButton* aMedfile; QRadioButton* aMedfile;
QRadioButton* aBrowser ; QRadioButton* aBrowser ;
QLineEdit* aBrowserObject; QLineEdit* aBrowserObject;
QPushButton* selectMedFilebutton ; QPushButton* selectMedFilebutton ;
QSpacerItem* hspacer; QSpacerItem* hspacer;
QLineEdit* selectMedFileLineEdit ; QLineEdit* selectMedFileLineEdit ;
QButtonGroup* meshInGroup ; QButtonGroup* meshInGroup ;
QGridLayout* meshIn ; QGridLayout* meshIn ;
QGroupBox* aMeshOut ; QGroupBox* aMeshOut ;
QLabel* meshName; QLabel* meshName;
QLineEdit* meshNameLineEdit; QLineEdit* meshNameLineEdit;
QSpacerItem* secondHspacer; QSpacerItem* secondHspacer;
QCheckBox* medFileCheckBox; QCheckBox* medFileCheckBox;
QPushButton* selectOutMedFilebutton; QPushButton* selectOutMedFilebutton;
QLineEdit* selectOutMedFileLineEdit; QLineEdit* selectOutMedFileLineEdit;
QSpacerItem* thirdHspacer; QSpacerItem* thirdHspacer;
QCheckBox* publishOut; QCheckBox* publishOut;
QGridLayout* meshOut ; QGridLayout* meshOut ;
QGroupBox* sizeMapDefinition ; QGroupBox* sizeMapDefinition ;
QRadioButton* localButton; QRadioButton* localButton;
QRadioButton* backgroundButton ; QRadioButton* backgroundButton ;
QRadioButton* constantButton ; QRadioButton* constantButton ;
QLabel* medFileBackground; QLabel* medFileBackground;
QPushButton* selectMedFileBackgroundbutton; QPushButton* selectMedFileBackgroundbutton;
QLineEdit* selectMedFileBackgroundLineEdit; QLineEdit* selectMedFileBackgroundLineEdit;
QLabel* valueLabel; QLabel* valueLabel;
QDoubleSpinBox* dvalue; QDoubleSpinBox* dvalue;
QButtonGroup* sizeMapDefGroup ; QButtonGroup* sizeMapDefGroup ;
QGridLayout* sizeMapDefGroupLayout; QGridLayout* sizeMapDefGroupLayout;
QGroupBox* sizeMapField; QGroupBox* sizeMapField;
QLabel* fieldName; QLabel* fieldName;
QComboBox* fieldNameCmb; QComboBox* fieldNameCmb;
QRadioButton* noTimeStep; QRadioButton* noTimeStep;
QRadioButton* lastTimeStep ; QRadioButton* lastTimeStep ;
QRadioButton* chosenTimeStep; QRadioButton* chosenTimeStep;
QLabel* timeStepLabel; QLabel* timeStepLabel;
QSpinBox* timeStep; QSpinBox* timeStep;
QLabel* rankLabel; QLabel* rankLabel;
QSpinBox* rankSpinBox; QSpinBox* rankSpinBox;
QButtonGroup* timeStepGroup; QButtonGroup* timeStepGroup;
QGridLayout* sizeMapFieldGroupLayout; QGridLayout* sizeMapFieldGroupLayout;
signals: signals:
void updateSelection(); void updateSelection();
void toExportMED(const char *); void toExportMED(const char *);
void meshDimSignal(ADAPTATION_MODE aMode); void meshDimSignal(ADAPTATION_MODE aMode);
public slots: public slots:
protected slots: protected slots:
private slots: private slots:
void modeChanged( int); void modeChanged( int);
void sizeMapDefChanged(int); void sizeMapDefChanged(int);
void timeStepGroupChanged(int timeStepType, bool disableOther = false, int vmax = 0); void timeStepGroupChanged(int timeStepType, bool disableOther = false, int vmax = 0);
void onSelectMedFilebuttonClicked(); void onSelectMedFilebuttonClicked();
void clear(); void clear();
void onMedFileCheckBox(int); void onMedFileCheckBox(int);
void onPublishOut(int); void onPublishOut(int);
void onSelectOutMedFilebutton(); void onSelectOutMedFilebutton();
void onSelectMedFileBackgroundbutton(); void onSelectMedFileBackgroundbutton();
void onLocalSelected(QString); void onLocalSelected(QString);
void onNoTimeStep(bool disableOther = false); void onNoTimeStep(bool disableOther = false);
void onLastTimeStep(bool disableOther = false); void onLastTimeStep(bool disableOther = false);
void onChosenTimeStep(bool disableOther = false, int vmax = 0); void onChosenTimeStep(bool disableOther = false, int vmax = 0);
void visibleTimeStepRankLabel(bool visible); void visibleTimeStepRankLabel(bool visible);
private: private:
QString getMedFileName(bool avertir); QString getMedFileName(bool avertir);
LightApp_SelectionMgr* selMgr ; LightApp_SelectionMgr* selMgr ;
med_int meshDim; med_int meshDim;
std::map<QString, int> myFieldList; std::map<QString, int> myFieldList;
}; };
enum { enum {
OPTION_ID_COLUMN = 0, OPTION_ID_COLUMN = 0,
OPTION_TYPE_COLUMN, OPTION_TYPE_COLUMN,
OPTION_NAME_COLUMN = 0, OPTION_NAME_COLUMN = 0,
OPTION_VALUE_COLUMN, OPTION_VALUE_COLUMN,
NB_COLUMNS, NB_COLUMNS,
}; };
////////////////////////////////////////// //////////////////////////////////////////
@ -262,44 +262,44 @@ enum {
////////////////////////////////////////// //////////////////////////////////////////
class MgAdaptAdvWidget : public QWidget class MgAdaptAdvWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
MgAdaptAdvWidget( QWidget* = 0, std::vector <std::string> * = nullptr, Qt::WindowFlags = 0 ); MgAdaptAdvWidget( QWidget* = 0, std::vector <std::string> * = nullptr, Qt::WindowFlags = 0 );
~MgAdaptAdvWidget(); ~MgAdaptAdvWidget();
std::vector < std::string > * myOptions; std::vector < std::string > * myOptions;
QGridLayout *gridLayout_4; QGridLayout *gridLayout_4;
MgAdaptAdvWidgetTreeWidget *myOptionTable; MgAdaptAdvWidgetTreeWidget *myOptionTable;
QPushButton *addBtn; QPushButton *addBtn;
QSpacerItem *horizontalSpacer; QSpacerItem *horizontalSpacer;
QGroupBox *logGroupBox; QGroupBox *logGroupBox;
QGridLayout *gridLayout_2; QGridLayout *gridLayout_2;
QGridLayout *gridLayout; QGridLayout *gridLayout;
QLabel *workingDirectoryLabel; QLabel *workingDirectoryLabel;
QLineEdit *workingDirectoryLineEdit; QLineEdit *workingDirectoryLineEdit;
QPushButton *workingDirectoryPushButton; QPushButton *workingDirectoryPushButton;
QLabel *verboseLevelLabel; QLabel *verboseLevelLabel;
QSpinBox *verboseLevelSpin; QSpinBox *verboseLevelSpin;
QHBoxLayout *horizontalLayout; QHBoxLayout *horizontalLayout;
QCheckBox *logInFileCheck; QCheckBox *logInFileCheck;
QCheckBox *removeLogOnSuccessCheck; QCheckBox *removeLogOnSuccessCheck;
QCheckBox *keepWorkingFilesCheck; QCheckBox *keepWorkingFilesCheck;
void AddOption( const char* name_value_type, bool isCustom = false );
void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt );
void setupWidget();
void AddOption( const char* name_value_type, bool isCustom = false );
void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt );
void setupWidget();
public slots: public slots:
void onAddOption();
void onAddOption(); void itemChanged(QTreeWidgetItem * tblRow, int column);
void itemChanged(QTreeWidgetItem * tblRow, int column); void onMeshDimChanged(ADAPTATION_MODE aMode);
void onMeshDimChanged(ADAPTATION_MODE aMode);
private slots: private slots:
void _onWorkingDirectoryPushButton(); void _onWorkingDirectoryPushButton();
private: private:
void setOptionValue(QString& option, QString& value); void setOptionValue(QString& option, QString& value);
std::map<QString, QTreeWidgetItem *> optionTreeWidgetItem; std::map<QString, QTreeWidgetItem *> optionTreeWidgetItem;
QTreeWidgetItem* getNewQTreeWidgetItem(QTreeWidget* table, const char* option, QString& name, bool isCustom); QTreeWidgetItem* getNewQTreeWidgetItem(QTreeWidget* table, const char* option, QString& name, bool isCustom);
}; };
@ -307,26 +307,23 @@ enum { EDITABLE_ROLE = Qt::UserRole + 1, PARAM_NAME,
NAME_COL = 0, VALUE_COL NAME_COL = 0, VALUE_COL
}; };
class ItemDelegate: public QItemDelegate class ItemDelegate: public QItemDelegate
{ {
public: public:
ItemDelegate(QObject* parent=0): QItemDelegate(parent) {} ItemDelegate(QObject* parent=0): QItemDelegate(parent) {}
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &o, const QModelIndex &index) const; QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &o, const QModelIndex &index) const;
}; };
class MgAdaptAdvWidgetTreeWidget : public QTreeWidget class MgAdaptAdvWidgetTreeWidget : public QTreeWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
MgAdaptAdvWidgetTreeWidget( QWidget* ); MgAdaptAdvWidgetTreeWidget( QWidget* );
protected: protected:
QModelIndex moveCursor( CursorAction, Qt::KeyboardModifiers ); QModelIndex moveCursor( CursorAction, Qt::KeyboardModifiers );
void keyPressEvent( QKeyEvent* ); void keyPressEvent( QKeyEvent* );
}; };
#endif // MG_ADAPTGUI_HXX #endif // MG_ADAPTGUI_HXX

View File

@ -5154,7 +5154,7 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
lab = lab + tr("INFO_COMPUTE") + "<br/>"; lab = lab + tr("INFO_COMPUTE") + "<br/>";
lab = lab + tr("INFO_REFINE") + ":"; lab = lab + tr("INFO_REFINE") + ":";
items << wrap(tr("INFO_REFINE_LOCAL_SIZE"), "li") items << wrap(tr("INFO_REFINE_LOCAL_SIZE"), "li")
<< wrap(tr("INFO_REFINE_SUBMESH"), "li"); << wrap(tr("INFO_REFINE_SUBMESH"), "li");
lab = lab + wrap(items.join(""), "ul"); lab = lab + wrap(items.join(""), "ul");
items.clear(); items.clear();
@ -5162,11 +5162,11 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
gb = app->infoPanel()->addGroup(tr("INFO_GRP_IMPORT_MESH")); gb = app->infoPanel()->addGroup(tr("INFO_GRP_IMPORT_MESH"));
items << wrap("UNV", "li") items << wrap("UNV", "li")
<< wrap("MED", "li") << wrap("MED", "li")
<< wrap("STL", "li") << wrap("STL", "li")
<< wrap("CGNS", "li") << wrap("CGNS", "li")
<< wrap("SAUV", "li") << wrap("SAUV", "li")
<< wrap("GMF", "li"); << wrap("GMF", "li");
lab = tr("INFO_AVAILABLE_FORMATS") + ":" + wrap(items.join(""), "ul"); lab = tr("INFO_AVAILABLE_FORMATS") + ":" + wrap(items.join(""), "ul");
items.clear(); items.clear();
@ -5175,9 +5175,9 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
gb = app->infoPanel()->addGroup(tr("INFO_GRP_CHECK_MESH")); gb = app->infoPanel()->addGroup(tr("INFO_GRP_CHECK_MESH"));
lab = tr("INFO_DISPLAY") + "<br/>"; lab = tr("INFO_DISPLAY") + "<br/>";
items << wrap(tr("INFO_QUALITY_AREA"), "li") items << wrap(tr("INFO_QUALITY_AREA"), "li")
<< wrap(tr("INFO_QUALITY_VOLUME"), "li") << wrap(tr("INFO_QUALITY_VOLUME"), "li")
<< wrap(tr("INFO_QUALITY_ASPECT_RATION"), "li") << wrap(tr("INFO_QUALITY_ASPECT_RATION"), "li")
<< wrap("...", "li"); << wrap("...", "li");
lab = lab + tr("INFO_QUALITY_INFO") + ":" + wrap(items.join(""), "ul"); lab = lab + tr("INFO_QUALITY_INFO") + ":" + wrap(items.join(""), "ul");
items.clear(); items.clear();
lab = lab + tr("INFO_CLIPPING"); lab = lab + tr("INFO_CLIPPING");

View File

@ -146,7 +146,7 @@ bool SMESHGUI_AdaptDlg::OnGUIEvent (int theCommandID)
SMESH::MG_ADAPT_ptr model = SMESHGUI::GetSMESHGen()->CreateMG_ADAPT(); SMESH::MG_ADAPT_ptr model = SMESHGUI::GetSMESHGen()->CreateMG_ADAPT();
bool isCreation = false; bool isCreation = false;
if (mySMESHGUI->isStudyLocked()) break; if (mySMESHGUI->isStudyLocked()) break;
mySMESHGUI->EmitSignalDeactivateDialog(); mySMESHGUI->EmitSignalDeactivateDialog();
SMESHGUI_MG_ADAPTDRIVER *mgAdapt = new SMESHGUI_MG_ADAPTDRIVER(mySMESHGUI, model, isCreation); SMESHGUI_MG_ADAPTDRIVER *mgAdapt = new SMESHGUI_MG_ADAPTDRIVER(mySMESHGUI, model, isCreation);
mgAdapt->show(); mgAdapt->show();

View File

@ -104,8 +104,8 @@
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
const int SPACING = 6; // layout spacing const int SPACING = 6; // layout spacing
const int MARGIN = 9; // layout margin const int MARGIN = 9; // layout margin
SALOME_ListIO mySelected; SALOME_ListIO mySelected;
@ -116,8 +116,8 @@ SALOME_ListIO mySelected;
//================================================================ //================================================================
Handle(SALOME_InteractiveObject) firstIObject() Handle(SALOME_InteractiveObject) firstIObject()
{ {
const SALOME_ListIO& aList = selectedIO(); const SALOME_ListIO& aList = selectedIO();
return aList.Extent() > 0 ? aList.First() : Handle(SALOME_InteractiveObject)(); return aList.Extent() > 0 ? aList.First() : Handle(SALOME_InteractiveObject)();
} }
//================================================================ //================================================================
// Function : selectedIO // Function : selectedIO
@ -125,15 +125,15 @@ Handle(SALOME_InteractiveObject) firstIObject()
//================================================================ //================================================================
const SALOME_ListIO& selectedIO() const SALOME_ListIO& selectedIO()
{ {
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* > ( SUIT_Session::session()->activeApplication() ); SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* > ( SUIT_Session::session()->activeApplication() );
LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr(); LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr();
if( aSelectionMgr ) if( aSelectionMgr )
{ {
aSelectionMgr->selectedObjects( mySelected ); aSelectionMgr->selectedObjects( mySelected );
for (SALOME_ListIteratorOfListIO it (mySelected); it.More(); it.Next()) for (SALOME_ListIteratorOfListIO it (mySelected); it.More(); it.Next())
SCRUTE(it.Value()->getEntry()); SCRUTE(it.Value()->getEntry());
}; };
return mySelected; return mySelected;
} }
//================================================================ //================================================================
// Function : getStudy // Function : getStudy
@ -141,76 +141,78 @@ const SALOME_ListIO& selectedIO()
//================================================================ //================================================================
_PTR(Study) getStudy() _PTR(Study) getStudy()
{ {
static _PTR(Study) _study; static _PTR(Study) _study;
if(!_study) if(!_study)
_study = SalomeApp_Application::getStudy(); _study = SalomeApp_Application::getStudy();
return _study; return _study;
} }
bool createAndPublishMed(QString fileName) bool createAndPublishMed(QString fileName)
{ {
SMESH::DriverMED_ReadStatus res; SMESH::DriverMED_ReadStatus res;
SMESH::mesh_array_var aMeshes = new SMESH::mesh_array; SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
// SMESHGUI aGui; // SMESHGUI aGui;
aMeshes = SMESHGUI::GetSMESHGen()->CreateMeshesFromMED( fileName.toUtf8().constData(), res ); aMeshes = SMESHGUI::GetSMESHGen()->CreateMeshesFromMED( fileName.toUtf8().constData(), res );
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[0] ); _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[0] );
_PTR(Study) aStudy = SMESH::getStudy(); _PTR(Study) aStudy = SMESH::getStudy();
QStringList anEntryList; QStringList anEntryList;
// bool isEmpty; // bool isEmpty;
if ( aMeshSO ) { if ( aMeshSO )
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder(); {
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" ); _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" ); _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
anEntryList.append( aMeshSO->GetID().c_str() ); aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
} anEntryList.append( aMeshSO->GetID().c_str() );
else { }
// isEmpty = true; else
return false; {
} // isEmpty = true;
SMESHGUI::GetSMESHGUI()->updateObjBrowser(); return false;
}
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
// browse to the published meshes // browse to the published meshes
if( LightApp_Application* anApp = if( LightApp_Application* anApp =
dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) ) dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
anApp->browseObjects( anEntryList ); anApp->browseObjects( anEntryList );
return true; return true;
} }
bool createMgAdaptObject(MgAdapt *myMgAdapt ) bool createMgAdaptObject(MgAdapt *myMgAdapt )
{ {
// SMESH::SMESH_Mesh_var newMesh = SMESHGUI::GetSMESHGen()->CreateEmptyMesh(); // SMESH::SMESH_Mesh_var newMesh = SMESHGUI::GetSMESHGen()->CreateEmptyMesh();
// _PTR(SObject) aHypothesis; // _PTR(SObject) aHypothesis;
_PTR(Study) aStudy = SMESH::getStudy(); _PTR(Study) aStudy = SMESH::getStudy();
QStringList anEntryList; QStringList anEntryList;
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder(); _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
_PTR(SComponent) mgadapt = aStudy->FindComponent("MG-ADAPT"); _PTR(SComponent) mgadapt = aStudy->FindComponent("MG-ADAPT");
_PTR(GenericAttribute) ga; _PTR(GenericAttribute) ga;
if (!aBuilder->FindAttribute(mgadapt, ga, "AttributeName") ) if (!aBuilder->FindAttribute(mgadapt, ga, "AttributeName") )
{ {
mgadapt = aBuilder->NewComponent("MG-ADAPT"); mgadapt = aBuilder->NewComponent("MG-ADAPT");
_PTR(AttributeName) Name = aBuilder->FindOrCreateAttribute(mgadapt, "AttributeName"); _PTR(AttributeName) Name = aBuilder->FindOrCreateAttribute(mgadapt, "AttributeName");
Name->SetValue("MG-ADAPT"); Name->SetValue("MG-ADAPT");
_PTR(AttributePixMap) myPixmap = aBuilder->FindOrCreateAttribute( mgadapt, "AttributePixMap" ); _PTR(AttributePixMap) myPixmap = aBuilder->FindOrCreateAttribute( mgadapt, "AttributePixMap" );
myPixmap->SetPixMap( "ICON_MG_ADAPT" ); myPixmap->SetPixMap( "ICON_MG_ADAPT" );
anEntryList.append( mgadapt->GetID().c_str() ); anEntryList.append( mgadapt->GetID().c_str() );
} }
_PTR(SObject) obj = aBuilder->NewObject(mgadapt); _PTR(SObject) obj = aBuilder->NewObject(mgadapt);
_PTR(AttributeName) myName = aBuilder->FindOrCreateAttribute(obj, "AttributeName"); _PTR(AttributeName) myName = aBuilder->FindOrCreateAttribute(obj, "AttributeName");
myName->SetValue("hypo"); myName->SetValue("hypo");
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( obj, "AttributePixMap" ); _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( obj, "AttributePixMap" );
aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO" ); aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO" );
anEntryList.append( obj->GetID().c_str() ); anEntryList.append( obj->GetID().c_str() );
SMESHGUI::GetSMESHGUI()->updateObjBrowser(); SMESHGUI::GetSMESHGUI()->updateObjBrowser();
// // browse to the published meshes // // browse to the published meshes
if( LightApp_Application* anApp = if( LightApp_Application* anApp =
dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) ) dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
anApp->browseObjects( anEntryList ); anApp->browseObjects( anEntryList );
return true; return true;
} }
@ -221,122 +223,121 @@ bool createMgAdaptObject(MgAdapt *myMgAdapt )
//================================================================ //================================================================
int IObjectCount() int IObjectCount()
{ {
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr(); LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr();
if( aSelectionMgr ) if( aSelectionMgr )
{ {
aSelectionMgr->selectedObjects( mySelected ); aSelectionMgr->selectedObjects( mySelected );
SCRUTE(mySelected.Extent()); SCRUTE(mySelected.Extent());
return mySelected.Extent(); return mySelected.Extent();
} }
return 0; return 0;
} }
SMESHGUI_MG_ADAPTDRIVER::SMESHGUI_MG_ADAPTDRIVER( SMESHGUI* theModule, SMESH::MG_ADAPT_ptr myModel, bool isCreation ) SMESHGUI_MG_ADAPTDRIVER::SMESHGUI_MG_ADAPTDRIVER( SMESHGUI* theModule, SMESH::MG_ADAPT_ptr myModel, bool isCreation )
: mySMESHGUI( theModule ), : mySMESHGUI( theModule ),
myFilterDlg(0), myFilterDlg(0),
myIsApplyAndClose( false ), myIsApplyAndClose( false ),
SMESHGUI_MgAdaptDlg((SalomeApp_Module*)theModule, myModel, SMESHGUI::desktop(), isCreation) SMESHGUI_MgAdaptDlg((SalomeApp_Module*)theModule, myModel, SMESHGUI::desktop(), isCreation)
{ {
resMgr = resourceMgr(); resMgr = resourceMgr();
selMgr = selectionMgr(); selMgr = selectionMgr();
// connections // connections
connect(myArgs, SIGNAL(updateSelection()), this, SLOT(updateSelection())); connect(myArgs, SIGNAL(updateSelection()), this, SLOT(updateSelection()));
connect(myArgs, SIGNAL(toExportMED(const char*)), this, SLOT(exportMED(const char*))); connect(myArgs, SIGNAL(toExportMED(const char*)), this, SLOT(exportMED(const char*)));
} }
SUIT_ResourceMgr* SMESHGUI_MG_ADAPTDRIVER::resourceMgr() SUIT_ResourceMgr* SMESHGUI_MG_ADAPTDRIVER::resourceMgr()
{ {
return dynamic_cast<SUIT_ResourceMgr*>( SUIT_Session::session()->resourceMgr() ); return dynamic_cast<SUIT_ResourceMgr*>( SUIT_Session::session()->resourceMgr() );
} }
LightApp_SelectionMgr* SMESHGUI_MG_ADAPTDRIVER::selectionMgr() LightApp_SelectionMgr* SMESHGUI_MG_ADAPTDRIVER::selectionMgr()
{ {
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() ); SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
if( anApp ) if( anApp )
return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() ); return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
else else
return 0; return 0;
} }
void SMESHGUI_MG_ADAPTDRIVER::updateSelection() void SMESHGUI_MG_ADAPTDRIVER::updateSelection()
{ {
disconnect( selMgr, 0, this, 0 ); disconnect( selMgr, 0, this, 0 );
selMgr->clearFilters(); selMgr->clearFilters();
SMESH::SetPointRepresentation( true ); SMESH::SetPointRepresentation( true );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() ) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->SetSelectionMode( ActorSelection ); aViewWindow->SetSelectionMode( ActorSelection );
if (myArgs->aBrowser->isChecked()) if (myArgs->aBrowser->isChecked())
{ {
connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() )); connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ));
selectionChanged(); selectionChanged();
} }
} }
void SMESHGUI_MG_ADAPTDRIVER::selectionChanged() void SMESHGUI_MG_ADAPTDRIVER::selectionChanged()
{ {
//~ get selected mesh //~ get selected mesh
SALOME_ListIO aList; SALOME_ListIO aList;
selMgr->selectedObjects(aList); selMgr->selectedObjects(aList);
QString aString = ""; QString aString = "";
int nbSel = aList.Extent(); int nbSel = aList.Extent();
if (nbSel != 1) if (nbSel != 1)
return;
Handle(SALOME_InteractiveObject) IO = aList.First();
SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(IO);
if ( !mesh->_is_nil() )
{
myMesh = mesh;
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
if ( mySelectedObject->_is_nil() )
return; return;
}
else
return;
Handle(SALOME_InteractiveObject) IO = aList.First(); SMESH::GetNameOfSelectedIObjects( selMgr, aString );
SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(IO); if ( aString.isEmpty() ) aString = " ";
if ( !mesh->_is_nil() ) else aString = aString.trimmed();
{
myMesh = mesh;
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
if ( mySelectedObject->_is_nil() )
return;
}
else
return;
SMESH::GetNameOfSelectedIObjects( selMgr, aString );
if ( aString.isEmpty() ) aString = " ";
else aString = aString.trimmed();
bool ok = !aString.isEmpty(); bool ok = !aString.isEmpty();
if ( !mesh->_is_nil() ) if ( !mesh->_is_nil() )
{ {
myArgs->aBrowserObject->setText( aString ); myArgs->aBrowserObject->setText( aString );
myArgs->meshNameLineEdit->setText( aString ); myArgs->meshNameLineEdit->setText( aString );
myArgs->selectOutMedFileLineEdit->setText(aString+QString(".med")); myArgs->selectOutMedFileLineEdit->setText(aString+QString(".med"));
ADAPTATION_MODE aMode; ADAPTATION_MODE aMode;
int nbVolumes = myMesh->NbVolumes(); int nbVolumes = myMesh->NbVolumes();
int nbFaces = myMesh->NbFaces(); int nbFaces = myMesh->NbFaces();
if(nbFaces > 0 && nbVolumes > 0) aMode = ADAPTATION_MODE::BOTH; if(nbFaces > 0 && nbVolumes > 0) aMode = ADAPTATION_MODE::BOTH;
else if(nbFaces > 0) aMode = ADAPTATION_MODE::SURFACE; else if(nbFaces > 0) aMode = ADAPTATION_MODE::SURFACE;
else aMode = ADAPTATION_MODE::VOLUME; else aMode = ADAPTATION_MODE::VOLUME;
emit myArgs->meshDimSignal(aMode); emit myArgs->meshDimSignal(aMode);
} }
} }
void SMESHGUI_MG_ADAPTDRIVER::exportMED(const char* tmp_file) void SMESHGUI_MG_ADAPTDRIVER::exportMED(const char* tmp_file)
{ {
bool toOverwrite = true; bool toOverwrite = true;
bool toFindOutDim = true; bool toFindOutDim = true;
myMesh->ExportMED(tmp_file, false, -1, toOverwrite, toFindOutDim); myMesh->ExportMED(tmp_file, false, -1, toOverwrite, toFindOutDim);
} }
void SMESHGUI_MG_ADAPTDRIVER::setMyMesh(SMESH::SMESH_Mesh_var mesh) void SMESHGUI_MG_ADAPTDRIVER::setMyMesh(SMESH::SMESH_Mesh_var mesh)
{ {
myMesh = mesh; myMesh = mesh;
} }
SMESH::SMESH_Mesh_var SMESHGUI_MG_ADAPTDRIVER::getMyMesh() SMESH::SMESH_Mesh_var SMESHGUI_MG_ADAPTDRIVER::getMyMesh()
{ {
return myMesh; return myMesh;
} }
//================================================================================= //=================================================================================
@ -345,43 +346,42 @@ SMESH::SMESH_Mesh_var SMESHGUI_MG_ADAPTDRIVER::getMyMesh()
//================================================================================= //=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::clickOnOk() void SMESHGUI_MG_ADAPTDRIVER::clickOnOk()
{ {
setIsApplyAndClose( true ); setIsApplyAndClose( true );
clickOnApply(); clickOnApply();
reject(); reject();
} }
bool SMESHGUI_MG_ADAPTDRIVER::clickOnApply() bool SMESHGUI_MG_ADAPTDRIVER::clickOnApply()
{ {
if ( SMESHGUI::isStudyLocked() ) if ( SMESHGUI::isStudyLocked() )
return false; return false;
if( !isValid() ) if( !isValid() )
return false; return false;
SMESHGUI_MgAdaptDlg::clickOnApply(); SMESHGUI_MgAdaptDlg::clickOnApply();
bool ok = execute(); bool ok = execute();
if (getModel()->getPublish()) this->createMeshInObjectBrowser(); if (getModel()->getPublish()) this->createMeshInObjectBrowser();
return ok; return ok;
} }
bool SMESHGUI_MG_ADAPTDRIVER::execute() bool SMESHGUI_MG_ADAPTDRIVER::execute()
{ {
int err;
int err; //~std::string errStr;
//~std::string errStr; char* errStr;
char* errStr; try
try {
{ err = getModel()->compute();
err = getModel()->compute(); errStr = getModel()->getErrMsg();
errStr = getModel()->getErrMsg(); std::string msg = err == 0 ? " ok" : std::string("Not ok \n")+CORBA::string_dup(errStr) ;
std::string msg = err == 0 ? " ok" : std::string("Not ok \n")+CORBA::string_dup(errStr) ; }
} catch (const std::exception& e)
catch (const std::exception& e) {
{ std::cerr<<e.what();
std::cerr<<e.what(); }
} return err == 0? true: false;
return err == 0? true: false;
} }
//================================================================================= //=================================================================================
@ -390,23 +390,23 @@ bool SMESHGUI_MG_ADAPTDRIVER::execute()
//================================================================================= //=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::Init (bool ResetControls) void SMESHGUI_MG_ADAPTDRIVER::Init (bool ResetControls)
{ {
myBusy = false; myBusy = false;
if ( ResetControls ) if ( ResetControls )
{ {
myLineEditElements->clear(); myLineEditElements->clear();
myNbOkElements = 0; myNbOkElements = 0;
buttonOk->setEnabled(false); buttonOk->setEnabled(false);
buttonApply->setEnabled(false); buttonApply->setEnabled(false);
//~myActor = 0; //~myActor = 0;
myMesh = SMESH::SMESH_Mesh::_nil(); myMesh = SMESH::SMESH_Mesh::_nil();
myIdSourceCheck->setChecked(true); myIdSourceCheck->setChecked(true);
onConstructor( 0 ); onConstructor( 0 );
} }
} }
@ -418,23 +418,21 @@ void SMESHGUI_MG_ADAPTDRIVER::Init (bool ResetControls)
void SMESHGUI_MG_ADAPTDRIVER::onConstructor( int withGeom ) void SMESHGUI_MG_ADAPTDRIVER::onConstructor( int withGeom )
{ {
myGeomLabel ->setVisible( withGeom ); myGeomLabel ->setVisible( withGeom );
myGeomNameEdit ->setVisible( withGeom ); myGeomNameEdit ->setVisible( withGeom );
myReuseHypCheck ->setVisible( withGeom ); myReuseHypCheck ->setVisible( withGeom );
myCopyElementsCheck->setVisible( withGeom ); myCopyElementsCheck->setVisible( withGeom );
myFilterBtn ->setVisible( !withGeom ); myFilterBtn ->setVisible( !withGeom );
myIdSourceCheck ->setVisible( !withGeom ); myIdSourceCheck ->setVisible( !withGeom );
if ( !withGeom ) if ( !withGeom )
myMeshNameEdit->setText( SMESH::UniqueMeshName("Mesh")); myMeshNameEdit->setText( SMESH::UniqueMeshName("Mesh"));
} }
//~void SMESHGUI_MG_ADAPTDRIVER::onSelectIdSource( bool ) //~void SMESHGUI_MG_ADAPTDRIVER::onSelectIdSource( bool )
//~{} //~{}
//================================================================================= //=================================================================================
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
@ -442,13 +440,13 @@ void SMESHGUI_MG_ADAPTDRIVER::onConstructor( int withGeom )
void SMESHGUI_MG_ADAPTDRIVER::enterEvent (QEvent*) void SMESHGUI_MG_ADAPTDRIVER::enterEvent (QEvent*)
{ {
// if ( !ConstructorsBox->isEnabled() ) { // if ( !ConstructorsBox->isEnabled() ) {
// SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ); // SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
// if ( aViewWindow && !mySelector ) { // if ( aViewWindow && !mySelector ) {
// mySelector = aViewWindow->GetSelector(); // mySelector = aViewWindow->GetSelector();
// } // }
// activateThisDialog(); // activateThisDialog();
// } // }
} }
@ -459,14 +457,15 @@ void SMESHGUI_MG_ADAPTDRIVER::enterEvent (QEvent*)
void SMESHGUI_MG_ADAPTDRIVER::keyPressEvent( QKeyEvent* e ) void SMESHGUI_MG_ADAPTDRIVER::keyPressEvent( QKeyEvent* e )
{ {
QDialog::keyPressEvent( e ); QDialog::keyPressEvent( e );
if ( e->isAccepted() ) if ( e->isAccepted() )
return; return;
if ( e->key() == Qt::Key_F1 ) { if ( e->key() == Qt::Key_F1 )
e->accept(); {
clickOnHelp(); e->accept();
} clickOnHelp();
}
} }
@ -477,22 +476,21 @@ void SMESHGUI_MG_ADAPTDRIVER::keyPressEvent( QKeyEvent* e )
void SMESHGUI_MG_ADAPTDRIVER::clickOnHelp() void SMESHGUI_MG_ADAPTDRIVER::clickOnHelp()
{ {
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app) if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else { else {
QString platform; QString platform;
#ifdef WIN32 #ifdef WIN32
platform = "winapplication"; platform = "winapplication";
#else #else
platform = "application"; platform = "application";
#endif #endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"), SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser", arg(app->resourceMgr()->stringValue("ExternalBrowser",platform)).
platform)). arg(myHelpFileName));
arg(myHelpFileName)); }
}
} }
@ -502,74 +500,74 @@ void SMESHGUI_MG_ADAPTDRIVER::clickOnHelp()
//======================================================================= //=======================================================================
QString SMESHGUI_MG_ADAPTDRIVER::getErrorMsg( SMESH::string_array_var theInvalidEntries, QString SMESHGUI_MG_ADAPTDRIVER::getErrorMsg( SMESH::string_array_var theInvalidEntries,
QStringList & theEntriesToBrowse ) QStringList & theEntriesToBrowse )
{ {
if ( theInvalidEntries->length() == 0 ) if ( theInvalidEntries->length() == 0 )
return tr("OPERATION_FAILED"); return tr("OPERATION_FAILED");
// theInvalidEntries - SObject's that hold geometry objects whose // theInvalidEntries - SObject's that hold geometry objects whose
// counterparts are not found in the newGeometry, followed by SObject's // counterparts are not found in the newGeometry, followed by SObject's
// holding mesh sub-objects that are invalid because they depend on a not found // holding mesh sub-objects that are invalid because they depend on a not found
// preceding sub-shape // preceding sub-shape
QString msg = tr("SUBSHAPES_NOT_FOUND_MSG") + "\n"; QString msg = tr("SUBSHAPES_NOT_FOUND_MSG") + "\n";
QString objString; QString objString;
for ( CORBA::ULong i = 0; i < theInvalidEntries->length(); ++i ) for ( CORBA::ULong i = 0; i < theInvalidEntries->length(); ++i )
{
_PTR(SObject) so = SMESH::getStudy()->FindObjectID( theInvalidEntries[i].in() );
int objType = SMESHGUI_Selection::type( theInvalidEntries[i].in() );
if ( objType < 0 ) // geom object
{ {
_PTR(SObject) so = SMESH::getStudy()->FindObjectID( theInvalidEntries[i].in() ); objString += "\n";
if ( so )
int objType = SMESHGUI_Selection::type( theInvalidEntries[i].in() ); objString += so->GetName().c_str();
if ( objType < 0 ) // geom object else
{ objString += theInvalidEntries[i].in(); // it's something like "FACE #2"
objString += "\n";
if ( so )
objString += so->GetName().c_str();
else
objString += theInvalidEntries[i].in(); // it's something like "FACE #2"
}
else // smesh object
{
theEntriesToBrowse.push_back( theInvalidEntries[i].in() );
objString += "\n ";
switch ( objType ) {
case SMESH::MESH:
objString += tr("SMESH_MESH");
break;
case SMESH::HYPOTHESIS:
objString += tr("SMESH_HYPOTHESIS");
break;
case SMESH::ALGORITHM:
objString += tr("SMESH_ALGORITHM");
break;
case SMESH::SUBMESH_VERTEX:
case SMESH::SUBMESH_EDGE:
case SMESH::SUBMESH_FACE:
case SMESH::SUBMESH_SOLID:
case SMESH::SUBMESH_COMPOUND:
case SMESH::SUBMESH:
objString += tr("SMESH_SUBMESH");
break;
case SMESH::GROUP:
objString += tr("SMESH_GROUP");
break;
default:
;
}
objString += " \"";
if ( so )
objString += so->GetName().c_str();
objString += "\" (";
objString += theInvalidEntries[i].in();
objString += ")";
}
} }
if ( !objString.isEmpty() ) else // smesh object
msg += objString; {
theEntriesToBrowse.push_back( theInvalidEntries[i].in() );
return msg; objString += "\n ";
switch ( objType ) {
case SMESH::MESH:
objString += tr("SMESH_MESH");
break;
case SMESH::HYPOTHESIS:
objString += tr("SMESH_HYPOTHESIS");
break;
case SMESH::ALGORITHM:
objString += tr("SMESH_ALGORITHM");
break;
case SMESH::SUBMESH_VERTEX:
case SMESH::SUBMESH_EDGE:
case SMESH::SUBMESH_FACE:
case SMESH::SUBMESH_SOLID:
case SMESH::SUBMESH_COMPOUND:
case SMESH::SUBMESH:
objString += tr("SMESH_SUBMESH");
break;
case SMESH::GROUP:
objString += tr("SMESH_GROUP");
break;
default:
;
}
objString += " \"";
if ( so )
objString += so->GetName().c_str();
objString += "\" (";
objString += theInvalidEntries[i].in();
objString += ")";
}
}
if ( !objString.isEmpty() )
msg += objString;
return msg;
} }
//================================================================================= //=================================================================================
@ -579,64 +577,66 @@ QString SMESHGUI_MG_ADAPTDRIVER::getErrorMsg( SMESH::string_array_var theInvalid
bool SMESHGUI_MG_ADAPTDRIVER::isValid() bool SMESHGUI_MG_ADAPTDRIVER::isValid()
{ {
bool ok = true; bool ok = true;
return ok; return ok;
} }
bool SMESHGUI_MG_ADAPTDRIVER::createMeshInObjectBrowser() bool SMESHGUI_MG_ADAPTDRIVER::createMeshInObjectBrowser()
{ {
QString filename(getModel()->getMedFileOut()); QString filename(getModel()->getMedFileOut());
QStringList errors; QStringList errors;
QStringList anEntryList; QStringList anEntryList;
bool isEmpty = false; bool isEmpty = false;
bool ok = false; bool ok = false;
SMESH::SMESH_Gen_var SMESH_Gen_ptr = SMESHGUI::GetSMESHGen(); SMESH::SMESH_Gen_var SMESH_Gen_ptr = SMESHGUI::GetSMESHGen();
if (!SMESH_Gen_ptr) { if (!SMESH_Gen_ptr) {
std::cerr << "Could not retrieve SMESH_Gen_ptr" << std::endl; std::cerr << "Could not retrieve SMESH_Gen_ptr" << std::endl;
throw SALOME_Exception(LOCALIZED("Could not retrieve SMESH::GetSMESHGen()")); throw SALOME_Exception(LOCALIZED("Could not retrieve SMESH::GetSMESHGen()"));
} }
SMESH::mesh_array_var aMeshes = new SMESH::mesh_array; SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
aMeshes->length( 1 ); // one mesh only aMeshes->length( 1 ); // one mesh only
SMESH::DriverMED_ReadStatus res; SMESH::DriverMED_ReadStatus res;
aMeshes = SMESH_Gen_ptr->CreateMeshesFromMED( filename.toUtf8().constData(), res ); aMeshes = SMESH_Gen_ptr->CreateMeshesFromMED( filename.toUtf8().constData(), res );
if ( res != SMESH::DRS_OK ) { if ( res != SMESH::DRS_OK ) {
errors.append( QString( "%1 :\n\t%2" ).arg( filename ).arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) ); errors.append( QString( "%1 :\n\t%2" ).arg( filename ).arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) );
} }
_PTR(Study) aStudy = SMESH::getStudy(); _PTR(Study) aStudy = SMESH::getStudy();
for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ )
{
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
if ( aMeshSO )
{ {
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] ); _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
if ( aMeshSO ) { _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder(); aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" ); // put REFINED mesh ico
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" ); anEntryList.append( aMeshSO->GetID().c_str() );
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" ); // put REFINED mesh ico
anEntryList.append( aMeshSO->GetID().c_str() );
}
else {
isEmpty = true;
}
} }
// update Object browser else
SMESHGUI::GetSMESHGUI()->updateObjBrowser(); {
// browse to the published meshes isEmpty = true;
if( LightApp_Application* anApp = }
dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) ) }
anApp->browseObjects( anEntryList ); // update Object browser
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
// browse to the published meshes
if( LightApp_Application* anApp =
dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
anApp->browseObjects( anEntryList );
// show Error message box if there were errors // show Error message box if there were errors
if ( errors.count() > 0 ) { if ( errors.count() > 0 ) {
SUIT_MessageBox::critical( SMESHGUI::desktop(), SUIT_MessageBox::critical( SMESHGUI::desktop(),
QObject::tr( "SMESH_ERROR" ), QObject::tr( "SMESH_ERROR" ),
QObject::tr( "SMESH_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) ); QObject::tr( "SMESH_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
} }
// show warning message box, if some imported mesh is empty // show warning message box, if some imported mesh is empty
if ( isEmpty ) { if ( isEmpty ) {
SUIT_MessageBox::warning( SMESHGUI::desktop(), SUIT_MessageBox::warning( SMESHGUI::desktop(),
QObject::tr( "SMESH_WRN_WARNING" ), QObject::tr( "SMESH_WRN_WARNING" ),
QObject::tr( "SMESH_DRS_SOME_EMPTY" ) ); QObject::tr( "SMESH_DRS_SOME_EMPTY" ) );
} }
return true; return true;
} }
//================================================================ //================================================================
@ -646,7 +646,7 @@ bool SMESHGUI_MG_ADAPTDRIVER::createMeshInObjectBrowser()
//================================================================ //================================================================
void SMESHGUI_MG_ADAPTDRIVER::setIsApplyAndClose( const bool theFlag ) void SMESHGUI_MG_ADAPTDRIVER::setIsApplyAndClose( const bool theFlag )
{ {
myIsApplyAndClose = theFlag; myIsApplyAndClose = theFlag;
}//================================================================ }//================================================================
// function : isApplyAndClose // function : isApplyAndClose
// Purpose : Get value of the flag indicating that the dialog is // Purpose : Get value of the flag indicating that the dialog is
@ -654,7 +654,7 @@ void SMESHGUI_MG_ADAPTDRIVER::setIsApplyAndClose( const bool theFlag )
//================================================================ //================================================================
bool SMESHGUI_MG_ADAPTDRIVER::isApplyAndClose() const bool SMESHGUI_MG_ADAPTDRIVER::isApplyAndClose() const
{ {
return myIsApplyAndClose; return myIsApplyAndClose;
} }
//================================================================================= //=================================================================================
@ -663,16 +663,16 @@ bool SMESHGUI_MG_ADAPTDRIVER::isApplyAndClose() const
//================================================================================= //=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::deactivateActiveDialog() void SMESHGUI_MG_ADAPTDRIVER::deactivateActiveDialog()
{ {
if (ConstructorsBox->isEnabled())
if (ConstructorsBox->isEnabled()) { {
ConstructorsBox->setEnabled(false); ConstructorsBox->setEnabled(false);
GroupArguments->setEnabled(false); GroupArguments->setEnabled(false);
GroupButtons->setEnabled(false); GroupButtons->setEnabled(false);
mySMESHGUI->ResetState(); mySMESHGUI->ResetState();
mySMESHGUI->SetActiveDialogBox(0); mySMESHGUI->SetActiveDialogBox(0);
if ( selMgr ) if ( selMgr )
selMgr->removeFilter( myIdSourceFilter ); selMgr->removeFilter( myIdSourceFilter );
} }
} }
//================================================================================= //=================================================================================
@ -682,17 +682,17 @@ void SMESHGUI_MG_ADAPTDRIVER::deactivateActiveDialog()
void SMESHGUI_MG_ADAPTDRIVER::activateThisDialog() void SMESHGUI_MG_ADAPTDRIVER::activateThisDialog()
{ {
/* Emit a signal to deactivate the active dialog */ /* Emit a signal to deactivate the active dialog */
// mySMESHGUI->EmitSignalDeactivateDialog(); // mySMESHGUI->EmitSignalDeactivateDialog();
// ConstructorsBox->setEnabled(true); // ConstructorsBox->setEnabled(true);
// GroupArguments->setEnabled(true); // GroupArguments->setEnabled(true);
// GroupButtons->setEnabled(true); // GroupButtons->setEnabled(true);
// mySMESHGUI->SetActiveDialogBox((QDialog*)this); // mySMESHGUI->SetActiveDialogBox((QDialog*)this);
// onSelectIdSource( myIdSourceCheck->isChecked() ); // onSelectIdSource( myIdSourceCheck->isChecked() );
// SelectionIntoArgument(); // SelectionIntoArgument();
} }
//================================================================================= //=================================================================================
@ -701,29 +701,30 @@ void SMESHGUI_MG_ADAPTDRIVER::activateThisDialog()
//================================================================================= //=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::setFilters() void SMESHGUI_MG_ADAPTDRIVER::setFilters()
{ {
if(myMesh->_is_nil()) { if(myMesh->_is_nil())
SUIT_MessageBox::critical(this, {
tr("SMESH_ERROR"), SUIT_MessageBox::critical(this,
tr("NO_MESH_SELECTED")); tr("SMESH_ERROR"),
return; tr("NO_MESH_SELECTED"));
} return;
if ( !myFilterDlg ) }
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL ); if ( !myFilterDlg )
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
QList<int> types; QList<int> types;
if ( myMesh->NbEdges() ) types << SMESH::EDGE; if ( myMesh->NbEdges() ) types << SMESH::EDGE;
if ( myMesh->NbFaces() ) types << SMESH::FACE; if ( myMesh->NbFaces() ) types << SMESH::FACE;
if ( myMesh->NbVolumes() ) types << SMESH::VOLUME; if ( myMesh->NbVolumes() ) types << SMESH::VOLUME;
if ( myMesh->NbBalls() ) types << SMESH::BALL; if ( myMesh->NbBalls() ) types << SMESH::BALL;
if ( myMesh->Nb0DElements()) types << SMESH::ELEM0D; if ( myMesh->Nb0DElements()) types << SMESH::ELEM0D;
if ( types.count() > 1 ) types << SMESH::ALL; if ( types.count() > 1 ) types << SMESH::ALL;
myFilterDlg->Init( types ); myFilterDlg->Init( types );
myFilterDlg->SetSelection(); myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh ); myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSourceWg( myLineEditElements ); myFilterDlg->SetSourceWg( myLineEditElements );
myFilterDlg->show(); myFilterDlg->show();
} }
//================================================================================= //=================================================================================
@ -732,13 +733,13 @@ void SMESHGUI_MG_ADAPTDRIVER::setFilters()
//================================================================================= //=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::onOpenView() void SMESHGUI_MG_ADAPTDRIVER::onOpenView()
{ {
if ( mySelector ) { if ( mySelector ) {
SMESH::SetPointRepresentation(false); SMESH::SetPointRepresentation(false);
} }
else { else {
mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector(); mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector();
activateThisDialog(); activateThisDialog();
} }
} }
//================================================================================= //=================================================================================
@ -747,6 +748,6 @@ void SMESHGUI_MG_ADAPTDRIVER::onOpenView()
//================================================================================= //=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::onCloseView() void SMESHGUI_MG_ADAPTDRIVER::onCloseView()
{ {
deactivateActiveDialog(); deactivateActiveDialog();
mySelector = 0; mySelector = 0;
} }

View File

@ -40,61 +40,61 @@
using namespace SMESH; using namespace SMESH;
void MG_ADAPT_i::copyHypothesisDataToImpl(const SMESH::MgAdaptHypothesisData& from, ::MG_ADAPT::MgAdaptHypothesisData* to) const void MG_ADAPT_i::copyHypothesisDataToImpl(const SMESH::MgAdaptHypothesisData& from, ::MG_ADAPT::MgAdaptHypothesisData* to) const
{ {
to->myFileInDir = from.myFileInDir; to->myFileInDir = from.myFileInDir;
to->myMeshFileIn = from.myMeshFileIn; to->myMeshFileIn = from.myMeshFileIn;
to->myMeshFileBackground = from.myMeshFileBackground; to->myMeshFileBackground = from.myMeshFileBackground;
to->myOutMeshName = from.myOutMeshName; to->myOutMeshName = from.myOutMeshName;
to->myMeshFileOut = from.myMeshFileOut; to->myMeshFileOut = from.myMeshFileOut;
to->myFileOutDir = from.myFileOutDir; to->myFileOutDir = from.myFileOutDir;
to->myFileSizeMapDir = from.myFileSizeMapDir; to->myFileSizeMapDir = from.myFileSizeMapDir;
to->myFieldName = from.myFieldName; to->myFieldName = from.myFieldName;
to->fromMedFile = from.fromMedFile; to->fromMedFile = from.fromMedFile;
to->myPublish = from.myPublish; to->myPublish = from.myPublish;
to->myMeshOutMed = from.myMeshOutMed; to->myMeshOutMed = from.myMeshOutMed;
to->myUseLocalMap = from.myUseLocalMap; to->myUseLocalMap = from.myUseLocalMap;
to->myUseBackgroundMap = from.myUseBackgroundMap; to->myUseBackgroundMap = from.myUseBackgroundMap;
to->myUseConstantValue = from.myUseConstantValue; to->myUseConstantValue = from.myUseConstantValue;
to->myConstantValue = from.myConstantValue; to->myConstantValue = from.myConstantValue;
to->myTimeStep = from.myTimeStep; to->myTimeStep = from.myTimeStep;
to->myRank = from.myRank; to->myRank = from.myRank;
to->myUseNoTimeStep = from.myUseNoTimeStep; to->myUseNoTimeStep = from.myUseNoTimeStep;
to->myUseLastTimeStep = from.myUseLastTimeStep; to->myUseLastTimeStep = from.myUseLastTimeStep;
to->myUseChosenTimeStep = from.myUseChosenTimeStep; to->myUseChosenTimeStep = from.myUseChosenTimeStep;
to->myWorkingDir = from.myWorkingDir; to->myWorkingDir = from.myWorkingDir;
to->myLogFile = from.myLogFile; to->myLogFile = from.myLogFile;
to->myPrintLogInFile = from.myPrintLogInFile; to->myPrintLogInFile = from.myPrintLogInFile;
to->myKeepFiles = from.myKeepFiles; to->myKeepFiles = from.myKeepFiles;
to->myRemoveLogOnSuccess = from.myRemoveLogOnSuccess; to->myRemoveLogOnSuccess = from.myRemoveLogOnSuccess;
to->myVerboseLevel = from.myVerboseLevel; to->myVerboseLevel = from.myVerboseLevel;
} }
void MG_ADAPT_i::copyHypothesisDataFromImpl(const ::MG_ADAPT::MgAdaptHypothesisData* from, SMESH::MgAdaptHypothesisData* to) const void MG_ADAPT_i::copyHypothesisDataFromImpl(const ::MG_ADAPT::MgAdaptHypothesisData* from, SMESH::MgAdaptHypothesisData* to) const
{ {
to->myFileInDir = CORBA::string_dup(from->myFileInDir.c_str()); to->myFileInDir = CORBA::string_dup(from->myFileInDir.c_str());
to->myMeshFileIn = CORBA::string_dup(from->myMeshFileIn.c_str()); to->myMeshFileIn = CORBA::string_dup(from->myMeshFileIn.c_str());
to->myMeshFileBackground = CORBA::string_dup(from->myMeshFileBackground.c_str()); to->myMeshFileBackground = CORBA::string_dup(from->myMeshFileBackground.c_str());
to->myOutMeshName = CORBA::string_dup(from->myOutMeshName.c_str()); to->myOutMeshName = CORBA::string_dup(from->myOutMeshName.c_str());
to->myMeshFileOut = CORBA::string_dup(from->myMeshFileOut.c_str()); to->myMeshFileOut = CORBA::string_dup(from->myMeshFileOut.c_str());
to->myFileOutDir = CORBA::string_dup(from->myFileOutDir.c_str()); to->myFileOutDir = CORBA::string_dup(from->myFileOutDir.c_str());
to->myFileSizeMapDir = CORBA::string_dup(from->myFileSizeMapDir.c_str()); to->myFileSizeMapDir = CORBA::string_dup(from->myFileSizeMapDir.c_str());
to->myFieldName = CORBA::string_dup(from->myFieldName.c_str()); to->myFieldName = CORBA::string_dup(from->myFieldName.c_str());
to->fromMedFile = from->fromMedFile; to->fromMedFile = from->fromMedFile;
to->myPublish = from->myPublish; to->myPublish = from->myPublish;
to->myMeshOutMed = from->myMeshOutMed; to->myMeshOutMed = from->myMeshOutMed;
to->myUseLocalMap = from->myUseLocalMap; to->myUseLocalMap = from->myUseLocalMap;
to->myUseBackgroundMap = from->myUseBackgroundMap; to->myUseBackgroundMap = from->myUseBackgroundMap;
to->myUseConstantValue = from->myUseConstantValue; to->myUseConstantValue = from->myUseConstantValue;
to->myConstantValue = from->myConstantValue; to->myConstantValue = from->myConstantValue;
to->myTimeStep = from->myTimeStep; to->myTimeStep = from->myTimeStep;
to->myRank = from->myRank; to->myRank = from->myRank;
to->myUseNoTimeStep = from->myUseNoTimeStep; to->myUseNoTimeStep = from->myUseNoTimeStep;
to->myUseLastTimeStep = from->myUseLastTimeStep; to->myUseLastTimeStep = from->myUseLastTimeStep;
to->myUseChosenTimeStep = from->myUseChosenTimeStep; to->myUseChosenTimeStep = from->myUseChosenTimeStep;
to->myWorkingDir = CORBA::string_dup(from->myWorkingDir.c_str()); to->myWorkingDir = CORBA::string_dup(from->myWorkingDir.c_str());
to->myLogFile = CORBA::string_dup(from->myLogFile.c_str()); to->myLogFile = CORBA::string_dup(from->myLogFile.c_str());
to->myPrintLogInFile = from->myPrintLogInFile; to->myPrintLogInFile = from->myPrintLogInFile;
to->myKeepFiles = from->myKeepFiles; to->myKeepFiles = from->myKeepFiles;
to->myRemoveLogOnSuccess = from->myRemoveLogOnSuccess; to->myRemoveLogOnSuccess = from->myRemoveLogOnSuccess;
to->myVerboseLevel = from->myVerboseLevel; to->myVerboseLevel = from->myVerboseLevel;
} }
SMESH::MG_ADAPT_ptr SMESH_Gen_i::CreateMG_ADAPT() SMESH::MG_ADAPT_ptr SMESH_Gen_i::CreateMG_ADAPT()
{ {
@ -111,12 +111,12 @@ SMESH::MG_ADAPT_ptr SMESH_Gen_i::CreateAdaptationHypothesis()
SMESH::MG_ADAPT_OBJECT_ptr SMESH_Gen_i::Adaptation( const char* adaptationType) SMESH::MG_ADAPT_OBJECT_ptr SMESH_Gen_i::Adaptation( const char* adaptationType)
{ {
if (!strcmp(adaptationType, "MG_Adapt")){ if (!strcmp(adaptationType, "MG_Adapt"))
SMESH::MG_ADAPT_OBJECT_i* mg_adapt_object = new SMESH::MG_ADAPT_OBJECT_i(); {
SMESH::MG_ADAPT_OBJECT_var anObj = mg_adapt_object->_this(); SMESH::MG_ADAPT_OBJECT_i* mg_adapt_object = new SMESH::MG_ADAPT_OBJECT_i();
return anObj._retn(); SMESH::MG_ADAPT_OBJECT_var anObj = mg_adapt_object->_this();
} return anObj._retn();
}
} }
//~SMESH::MG_ADAPT_ptr MG_ADAPT_i::CreateMG_ADAPT() //~SMESH::MG_ADAPT_ptr MG_ADAPT_i::CreateMG_ADAPT()
@ -165,181 +165,180 @@ MG_ADAPT_i::~MG_ADAPT_i()
} }
void MG_ADAPT_i::setData( SMESH::MgAdaptHypothesisData& data) void MG_ADAPT_i::setData( SMESH::MgAdaptHypothesisData& data)
{ {
::MG_ADAPT::MgAdaptHypothesisData* baseData = new ::MG_ADAPT::MgAdaptHypothesisData(); ::MG_ADAPT::MgAdaptHypothesisData* baseData = new ::MG_ADAPT::MgAdaptHypothesisData();
copyHypothesisDataToImpl(data, baseData); copyHypothesisDataToImpl(data, baseData);
myMgAdapt->setData(baseData); myMgAdapt->setData(baseData);
delete baseData; delete baseData;
} }
void MG_ADAPT_i::setMedFileIn(const char* str) void MG_ADAPT_i::setMedFileIn(const char* str)
{ {
myMgAdapt->setMedFileIn(str); myMgAdapt->setMedFileIn(str);
} }
char* MG_ADAPT_i::getMedFileIn() char* MG_ADAPT_i::getMedFileIn()
{ {
return CORBA::string_dup(myMgAdapt->getMedFileIn().c_str()); return CORBA::string_dup(myMgAdapt->getMedFileIn().c_str());
} }
void MG_ADAPT_i::setMedFileOut(const char* str) void MG_ADAPT_i::setMedFileOut(const char* str)
{ {
myMgAdapt->setMedFileOut(str); myMgAdapt->setMedFileOut(str);
} }
char* MG_ADAPT_i::getMedFileOut() char* MG_ADAPT_i::getMedFileOut()
{ {
return CORBA::string_dup(myMgAdapt->getMedFileOut().c_str()); return CORBA::string_dup(myMgAdapt->getMedFileOut().c_str());
} }
void MG_ADAPT_i::setMeshName(const char* str) void MG_ADAPT_i::setMeshName(const char* str)
{ {
myMgAdapt->setMeshName(str); myMgAdapt->setMeshName(str);
} }
char* MG_ADAPT_i::getMeshName() char* MG_ADAPT_i::getMeshName()
{ {
return CORBA::string_dup(myMgAdapt->getMeshName().c_str()); return CORBA::string_dup(myMgAdapt->getMeshName().c_str());
} }
void MG_ADAPT_i::setMeshNameOut(const char* str) void MG_ADAPT_i::setMeshNameOut(const char* str)
{ {
myMgAdapt->setMeshNameOut(str); myMgAdapt->setMeshNameOut(str);
} }
char* MG_ADAPT_i::getMeshNameOut() char* MG_ADAPT_i::getMeshNameOut()
{ {
return CORBA::string_dup(myMgAdapt->getMeshNameOut().c_str()); return CORBA::string_dup(myMgAdapt->getMeshNameOut().c_str());
} }
void MG_ADAPT_i::setMeshOutMed(bool mybool) void MG_ADAPT_i::setMeshOutMed(bool mybool)
{ {
myMgAdapt->setMeshOutMed(mybool); myMgAdapt->setMeshOutMed(mybool);
} }
bool MG_ADAPT_i::getMeshOutMed() bool MG_ADAPT_i::getMeshOutMed()
{ {
return myMgAdapt->getMeshOutMed(); return myMgAdapt->getMeshOutMed();
} }
void MG_ADAPT_i::setPublish(bool mybool) void MG_ADAPT_i::setPublish(bool mybool)
{ {
myMgAdapt->setPublish(mybool); myMgAdapt->setPublish(mybool);
} }
bool MG_ADAPT_i::getPublish() bool MG_ADAPT_i::getPublish()
{ {
return myMgAdapt->getPublish(); return myMgAdapt->getPublish();
} }
void MG_ADAPT_i::setSizeMapFieldName(const char* str) void MG_ADAPT_i::setSizeMapFieldName(const char* str)
{ {
myMgAdapt->setFieldName(str); myMgAdapt->setFieldName(str);
} }
char* MG_ADAPT_i::getSizeMapFieldName() char* MG_ADAPT_i::getSizeMapFieldName()
{ {
return CORBA::string_dup(myMgAdapt->getFieldName().c_str()); return CORBA::string_dup(myMgAdapt->getFieldName().c_str());
} }
void MG_ADAPT_i::setTimeStep(CORBA::Long t) void MG_ADAPT_i::setTimeStep(CORBA::Long t)
{ {
myMgAdapt->setTimeStep(t); myMgAdapt->setTimeStep(t);
} }
CORBA::Long MG_ADAPT_i::getTimeStep() CORBA::Long MG_ADAPT_i::getTimeStep()
{ {
return myMgAdapt->getTimeStep(); return myMgAdapt->getTimeStep();
} }
void MG_ADAPT_i::setTimeStepRank(CORBA::Long t, CORBA::Long r) void MG_ADAPT_i::setTimeStepRank(CORBA::Long t, CORBA::Long r)
{ {
myMgAdapt->setChosenTimeStepRank(); myMgAdapt->setChosenTimeStepRank();
myMgAdapt->setRankTimeStep(t, r); myMgAdapt->setRankTimeStep(t, r);
} }
CORBA::Long MG_ADAPT_i::getRank() CORBA::Long MG_ADAPT_i::getRank()
{ {
return myMgAdapt->getRank(); return myMgAdapt->getRank();
} }
void MG_ADAPT_i::setTimeStepRankLast() void MG_ADAPT_i::setTimeStepRankLast()
{ {
myMgAdapt->setTimeStepRankLast(); myMgAdapt->setTimeStepRankLast();
} }
void MG_ADAPT_i::setNoTimeStep() void MG_ADAPT_i::setNoTimeStep()
{ {
myMgAdapt->setNoTimeStep(); myMgAdapt->setNoTimeStep();
} }
void MG_ADAPT_i::setLogFile(const char* str) void MG_ADAPT_i::setLogFile(const char* str)
{ {
myMgAdapt->setLogFile(str); myMgAdapt->setLogFile(str);
} }
char* MG_ADAPT_i::getLogFile() char* MG_ADAPT_i::getLogFile()
{ {
return CORBA::string_dup(myMgAdapt->getLogFile().c_str()); return CORBA::string_dup(myMgAdapt->getLogFile().c_str());
} }
void MG_ADAPT_i::setVerbosityLevel(CORBA::Long v) void MG_ADAPT_i::setVerbosityLevel(CORBA::Long v)
{ {
myMgAdapt->setVerbosityLevel(v); myMgAdapt->setVerbosityLevel(v);
} }
CORBA::Long MG_ADAPT_i::getVerbosityLevel() CORBA::Long MG_ADAPT_i::getVerbosityLevel()
{ {
return myMgAdapt->getVerbosityLevel(); return myMgAdapt->getVerbosityLevel();
} }
void MG_ADAPT_i::setRemoveOnSuccess(bool mybool) void MG_ADAPT_i::setRemoveOnSuccess(bool mybool)
{ {
myMgAdapt->setRemoveOnSuccess(mybool); myMgAdapt->setRemoveOnSuccess(mybool);
} }
bool MG_ADAPT_i::getRemoveOnSuccess() bool MG_ADAPT_i::getRemoveOnSuccess()
{ {
myMgAdapt->getRemoveOnSuccess(); myMgAdapt->getRemoveOnSuccess();
} }
SMESH::MgAdaptHypothesisData* MG_ADAPT_i::getData() SMESH::MgAdaptHypothesisData* MG_ADAPT_i::getData()
{ {
SMESH::MgAdaptHypothesisData* result = new SMESH::MgAdaptHypothesisData(); SMESH::MgAdaptHypothesisData* result = new SMESH::MgAdaptHypothesisData();
::MG_ADAPT::MgAdaptHypothesisData* from = myMgAdapt->getData(); ::MG_ADAPT::MgAdaptHypothesisData* from = myMgAdapt->getData();
copyHypothesisDataFromImpl(from, result); copyHypothesisDataFromImpl(from, result);
return result; return result;
} }
void MG_ADAPT_i::setUseLocalMap(bool mybool) void MG_ADAPT_i::setUseLocalMap(bool mybool)
{ {
myMgAdapt->setUseLocalMap(mybool); myMgAdapt->setUseLocalMap(mybool);
} }
bool MG_ADAPT_i::getUseLocalMap() bool MG_ADAPT_i::getUseLocalMap()
{ {
return myMgAdapt->getUseLocalMap(); return myMgAdapt->getUseLocalMap();
} }
void MG_ADAPT_i::setUseBackgroundMap(bool mybool) void MG_ADAPT_i::setUseBackgroundMap(bool mybool)
{ {
myMgAdapt->setUseBackgroundMap(mybool); myMgAdapt->setUseBackgroundMap(mybool);
} }
bool MG_ADAPT_i::getUseBackgroundMap() bool MG_ADAPT_i::getUseBackgroundMap()
{ {
return myMgAdapt->getUseBackgroundMap(); return myMgAdapt->getUseBackgroundMap();
} }
void MG_ADAPT_i::setUseConstantValue(bool mybool) void MG_ADAPT_i::setUseConstantValue(bool mybool)
{ {
myMgAdapt->setUseConstantValue(mybool); myMgAdapt->setUseConstantValue(mybool);
} }
bool MG_ADAPT_i::getUseConstantValue() bool MG_ADAPT_i::getUseConstantValue()
{ {
return myMgAdapt->getUseConstantValue(); return myMgAdapt->getUseConstantValue();
} }
void MG_ADAPT_i::setConstantSize(double value) void MG_ADAPT_i::setConstantSize(double value)
{ {
myMgAdapt->setConstantValue(value); myMgAdapt->setConstantValue(value);
} }
double MG_ADAPT_i::getConstantSize() double MG_ADAPT_i::getConstantSize()
{ {
return myMgAdapt->getConstantValue(); return myMgAdapt->getConstantValue();
} }
void MG_ADAPT_i::setSizeMapFile(const char* str) void MG_ADAPT_i::setSizeMapFile(const char* str)
{ {
myMgAdapt->setSizeMapFile(str); myMgAdapt->setSizeMapFile(str);
} }
char* MG_ADAPT_i::getSizeMapFile() char* MG_ADAPT_i::getSizeMapFile()
{ {
return CORBA::string_dup(myMgAdapt->getSizeMapFile().c_str()); return CORBA::string_dup(myMgAdapt->getSizeMapFile().c_str());
} }
void MG_ADAPT_i::setFromMedFile(bool mybool) void MG_ADAPT_i::setFromMedFile(bool mybool)
{ {
myMgAdapt->setFromMedFile(mybool); myMgAdapt->setFromMedFile(mybool);
} }
bool MG_ADAPT_i::isFromMedFile() bool MG_ADAPT_i::isFromMedFile()
{ {
return myMgAdapt->isFromMedFile(); return myMgAdapt->isFromMedFile();
} }
void MG_ADAPT_i::setKeepWorkingFiles(bool mybool) void MG_ADAPT_i::setKeepWorkingFiles(bool mybool)
{ {
myMgAdapt->setKeepWorkingFiles(mybool); myMgAdapt->setKeepWorkingFiles(mybool);
} }
bool MG_ADAPT_i::getKeepWorkingFiles() bool MG_ADAPT_i::getKeepWorkingFiles()
{ {
return myMgAdapt->getKeepWorkingFiles(); return myMgAdapt->getKeepWorkingFiles();
} }
//~void MG_ADAPT_i::setPrCORBA::LongLogInFile(bool); //~void MG_ADAPT_i::setPrCORBA::LongLogInFile(bool);
@ -347,193 +346,193 @@ bool MG_ADAPT_i::getKeepWorkingFiles()
void MG_ADAPT_i::setSizeMapType(const char* type) void MG_ADAPT_i::setSizeMapType(const char* type)
{ {
setUseLocalMap(false); setUseLocalMap(false);
setUseBackgroundMap(false); setUseBackgroundMap(false);
setUseConstantValue(false); setUseConstantValue(false);
if (!strcmp("Local", type)) if (!strcmp("Local", type))
setUseLocalMap(true); setUseLocalMap(true);
else if (!strcmp("Background", type)) else if (!strcmp("Background", type))
setUseBackgroundMap(true); setUseBackgroundMap(true);
else else
setUseConstantValue(true); setUseConstantValue(true);
} }
void MG_ADAPT_i::setWorkingDir(const char* dir) void MG_ADAPT_i::setWorkingDir(const char* dir)
{ {
myMgAdapt->setWorkingDir(dir); myMgAdapt->setWorkingDir(dir);
} }
char* MG_ADAPT_i::getWorkingDir() char* MG_ADAPT_i::getWorkingDir()
{ {
return CORBA::string_dup(myMgAdapt->getWorkingDir().c_str()); return CORBA::string_dup(myMgAdapt->getWorkingDir().c_str());
} }
bool MG_ADAPT_i::setAll() bool MG_ADAPT_i::setAll()
{ {
return myMgAdapt->setAll(); return myMgAdapt->setAll();
} }
char* MG_ADAPT_i::getCommandToRun() char* MG_ADAPT_i::getCommandToRun()
{ {
return CORBA::string_dup(myMgAdapt->getCommandToRun().c_str()); return CORBA::string_dup(myMgAdapt->getCommandToRun().c_str());
} }
//~CORBA::Long MG_ADAPT_i::compute(::CORBA::String_out errStr) //~CORBA::Long MG_ADAPT_i::compute(::CORBA::String_out errStr)
//~{ //~{
//~std::string err(""); //~std::string err("");
//~CORBA::Long ret = myMgAdapt->compute(err); //~CORBA::Long ret = myMgAdapt->compute(err);
//~errStr = err.c_str(); //~errStr = err.c_str();
//~return ret; //~return ret;
//~} //~}
CORBA::Long MG_ADAPT_i::compute() CORBA::Long MG_ADAPT_i::compute()
{ {
errStr = ""; errStr = "";
CORBA::Long ret; CORBA::Long ret;
try try
{ {
ret = myMgAdapt->compute(errStr); ret = myMgAdapt->compute(errStr);
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
std::cerr<<e.what(); std::cerr<<e.what();
ret = -1; ret = -1;
} }
if(ret!=-1 && myMgAdapt->getPublish()) if(ret!=-1 && myMgAdapt->getPublish())
{ {
SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen(); SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
SMESH::DriverMED_ReadStatus theStatus; SMESH::DriverMED_ReadStatus theStatus;
smeshGen_i->CreateMeshesFromMED(myMgAdapt->getMedFileOut().c_str(), theStatus); smeshGen_i->CreateMeshesFromMED(myMgAdapt->getMedFileOut().c_str(), theStatus);
} }
//~errStr = err.c_str(); //~errStr = err.c_str();
return ret; return ret;
} }
char* MG_ADAPT_i::getErrMsg() char* MG_ADAPT_i::getErrMsg()
{ {
return CORBA::string_dup(errStr.c_str()); return CORBA::string_dup(errStr.c_str());
} }
char* MG_ADAPT_i::getFileName() char* MG_ADAPT_i::getFileName()
{ {
return CORBA::string_dup(myMgAdapt->getFileName().c_str()); return CORBA::string_dup(myMgAdapt->getFileName().c_str());
} }
char* MG_ADAPT_i::getExeName() char* MG_ADAPT_i::getExeName()
{ {
return CORBA::string_dup(myMgAdapt->getExeName().c_str()); return CORBA::string_dup(myMgAdapt->getExeName().c_str());
} }
void MG_ADAPT_i::copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data) void MG_ADAPT_i::copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data)
{ {
::MG_ADAPT::MgAdaptHypothesisData* baseData = new ::MG_ADAPT::MgAdaptHypothesisData(); ::MG_ADAPT::MgAdaptHypothesisData* baseData = new ::MG_ADAPT::MgAdaptHypothesisData();
copyHypothesisDataToImpl(data, baseData); copyHypothesisDataToImpl(data, baseData);
myMgAdapt->copyMgAdaptHypothesisData(baseData); myMgAdapt->copyMgAdaptHypothesisData(baseData);
delete baseData; delete baseData;
} }
//~void MG_ADAPT_i::checkDirPath(char*& str) //~void MG_ADAPT_i::checkDirPath(char*& str)
//~{ //~{
//~myMgAdapt->checkDirPath(str); //~myMgAdapt->checkDirPath(str);
//~} //~}
bool MG_ADAPT_i::hasOptionDefined( const char* optionName ) bool MG_ADAPT_i::hasOptionDefined( const char* optionName )
{ {
return myMgAdapt->hasOptionDefined(optionName); return myMgAdapt->hasOptionDefined(optionName);
} }
void MG_ADAPT_i::setOptionValue(const char* optionName, void MG_ADAPT_i::setOptionValue(const char* optionName,
const char* optionValue) throw (std::invalid_argument) const char* optionValue) throw (std::invalid_argument)
{ {
myMgAdapt->setOptionValue(optionName, optionValue); myMgAdapt->setOptionValue(optionName, optionValue);
} }
char* MG_ADAPT_i::getOptionValue(const char* optionName, char* MG_ADAPT_i::getOptionValue(const char* optionName,
bool& isDefault) throw (std::invalid_argument) bool& isDefault) throw (std::invalid_argument)
{ {
return CORBA::string_dup(myMgAdapt->getOptionValue(optionName, &isDefault).c_str()); return CORBA::string_dup(myMgAdapt->getOptionValue(optionName, &isDefault).c_str());
} }
str_array* MG_ADAPT_i::getCustomOptionValuesStrVec() str_array* MG_ADAPT_i::getCustomOptionValuesStrVec()
{ {
SMESH::str_array_var result = new SMESH::str_array(); SMESH::str_array_var result = new SMESH::str_array();
std::vector <std::string> vals = myMgAdapt->getCustomOptionValuesStrVec(); std::vector <std::string> vals = myMgAdapt->getCustomOptionValuesStrVec();
result->length(vals.size()); result->length(vals.size());
for (int i = 0; i<vals.size(); i++) result[i] = CORBA::string_dup(vals[i].c_str()); for (int i = 0; i<vals.size(); i++) result[i] = CORBA::string_dup(vals[i].c_str());
return result._retn(); return result._retn();
} }
str_array* MG_ADAPT_i::getOptionValuesStrVec() str_array* MG_ADAPT_i::getOptionValuesStrVec()
{ {
SMESH::str_array_var result = new SMESH::str_array(); SMESH::str_array_var result = new SMESH::str_array();
std::vector <std::string> vals = myMgAdapt->getOptionValuesStrVec(); std::vector <std::string> vals = myMgAdapt->getOptionValuesStrVec();
result->length(vals.size()); result->length(vals.size());
for (int i = 0; i<vals.size(); i++) result[i] = CORBA::string_dup(vals[i].c_str()); for (int i = 0; i<vals.size(); i++) result[i] = CORBA::string_dup(vals[i].c_str());
return result._retn(); return result._retn();
} }
void MG_ADAPT_i::setPrintLogInFile(bool mybool) void MG_ADAPT_i::setPrintLogInFile(bool mybool)
{ {
myMgAdapt->setPrintLogInFile(mybool); myMgAdapt->setPrintLogInFile(mybool);
} }
bool MG_ADAPT_i::getPrintLogInFile() bool MG_ADAPT_i::getPrintLogInFile()
{ {
return myMgAdapt->getPrintLogInFile(); return myMgAdapt->getPrintLogInFile();
} }
//~TOptionValues MG_ADAPT_i::getOptionValues() const; //~TOptionValues MG_ADAPT_i::getOptionValues() const;
//~const TOptionValues& MG_ADAPT_i::getCustomOptionValues() const ; //~const TOptionValues& MG_ADAPT_i::getCustomOptionValues() const ;
MG_ADAPT_OBJECT_i::MG_ADAPT_OBJECT_i(): SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() ) MG_ADAPT_OBJECT_i::MG_ADAPT_OBJECT_i(): SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
{ {
medFileIn=""; medFileIn="";
medFileOut=""; medFileOut="";
medFileBackground=""; medFileBackground="";
publish = false; publish = false;
//~myMesh = CORBA::nil; //~myMesh = CORBA::nil;
} }
void MG_ADAPT_OBJECT_i::setMeshIn(SMESH::SMESH_Mesh_ptr theMesh ) void MG_ADAPT_OBJECT_i::setMeshIn(SMESH::SMESH_Mesh_ptr theMesh )
{ {
myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh); myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
} }
void MG_ADAPT_OBJECT_i::setMEDFileIn(const char* f) void MG_ADAPT_OBJECT_i::setMEDFileIn(const char* f)
{ {
medFileIn = f; medFileIn = f;
} }
void MG_ADAPT_OBJECT_i::setMEDFileOut(const char* f) void MG_ADAPT_OBJECT_i::setMEDFileOut(const char* f)
{ {
medFileOut = f; medFileOut = f;
} }
void MG_ADAPT_OBJECT_i::setMEDFileBackground(const char* f) void MG_ADAPT_OBJECT_i::setMEDFileBackground(const char* f)
{ {
medFileBackground = f; medFileBackground = f;
} }
void MG_ADAPT_OBJECT_i::AddHypothesis(SMESH::MG_ADAPT_ptr mg) void MG_ADAPT_OBJECT_i::AddHypothesis(SMESH::MG_ADAPT_ptr mg)
{ {
mg->setMedFileIn(medFileIn.c_str()); mg->setMedFileIn(medFileIn.c_str());
mg->setMedFileOut(medFileOut.c_str()); mg->setMedFileOut(medFileOut.c_str());
mg->setSizeMapFile(medFileBackground.c_str()); mg->setSizeMapFile(medFileBackground.c_str());
hypothesis = SMESH::MG_ADAPT::_duplicate(mg); hypothesis = SMESH::MG_ADAPT::_duplicate(mg);
} }
CORBA::Long MG_ADAPT_OBJECT_i::Compute(bool publish) CORBA::Long MG_ADAPT_OBJECT_i::Compute(bool publish)
{ {
if(!checkMeshFileIn()){ if(!checkMeshFileIn()){
std::cerr<< "\n Error : Please check the MED file input or mesh input. \n"; std::cerr<< "\n Error : Please check the MED file input or mesh input. \n";
return -1; return -1;
} }
hypothesis->setPublish(publish); hypothesis->setPublish(publish);
return hypothesis->compute(); return hypothesis->compute();
} }
bool MG_ADAPT_OBJECT_i::checkMeshFileIn() bool MG_ADAPT_OBJECT_i::checkMeshFileIn()
{ {
bool ret = false; // 1 ok , 0 nook bool ret = false; // 1 ok , 0 nook
if(!::MG_ADAPT::MgAdapt::isFileExist(medFileIn)) if(!::MG_ADAPT::MgAdapt::isFileExist(medFileIn))
{
if(!myMesh->_is_nil())
{ {
if(!myMesh->_is_nil()) bool toOverwrite = true;
{ bool toFindOutDim = true;
bool toOverwrite = true; medFileIn = hypothesis->getFileName();
bool toFindOutDim = true; medFileIn+= ".med";
medFileIn = hypothesis->getFileName(); myMesh->ExportMED(medFileIn.c_str(), false, -1, toOverwrite, toFindOutDim);
medFileIn+= ".med"; hypothesis->setMedFileIn(medFileIn.c_str());
myMesh->ExportMED(medFileIn.c_str(), false, -1, toOverwrite, toFindOutDim); ret = true;
hypothesis->setMedFileIn(medFileIn.c_str()); }
ret = true; }
} else
} ret = true;
else
ret = true;
return ret; return ret;
} }

View File

@ -28,110 +28,110 @@ class SMESH_I_EXPORT MG_ADAPT_i :
public virtual POA_SMESH::MG_ADAPT public virtual POA_SMESH::MG_ADAPT
{ {
public: public:
//~MG_ADAPT_i( CORBA::ORB_ptr orb, ADAPT::ADAPT_Gen_var gen_i ); //~MG_ADAPT_i( CORBA::ORB_ptr orb, ADAPT::ADAPT_Gen_var gen_i );
//~static SMESH::MG_ADAPT_ptr CreateMG_ADAPT(); //~static SMESH::MG_ADAPT_ptr CreateMG_ADAPT();
//~MG_ADAPT_i(PortableServer::POA_var poa); //~MG_ADAPT_i(PortableServer::POA_var poa);
MG_ADAPT_i(); MG_ADAPT_i();
virtual ~MG_ADAPT_i(); virtual ~MG_ADAPT_i();
//~void setData( SMESH::MgAdaptHypothesisData* data); //~void setData( SMESH::MgAdaptHypothesisData* data);
void setData( SMESH::MgAdaptHypothesisData& data); void setData( SMESH::MgAdaptHypothesisData& data);
void setMedFileIn(const char* str); void setMedFileIn(const char* str);
char* getMedFileIn(); char* getMedFileIn();
void setMedFileOut(const char* str); void setMedFileOut(const char* str);
char* getMedFileOut(); char* getMedFileOut();
void setMeshName(const char* str); void setMeshName(const char* str);
char* getMeshName(); char* getMeshName();
void setMeshNameOut(const char* str); void setMeshNameOut(const char* str);
char* getMeshNameOut(); char* getMeshNameOut();
void setMeshOutMed(bool mybool); void setMeshOutMed(bool mybool);
bool getMeshOutMed(); bool getMeshOutMed();
void setPublish(bool mybool); void setPublish(bool mybool);
bool getPublish(); bool getPublish();
void setSizeMapFieldName(const char* str); void setSizeMapFieldName(const char* str);
char* getSizeMapFieldName(); char* getSizeMapFieldName();
void setTimeStep(CORBA::Long t); void setTimeStep(CORBA::Long t);
CORBA::Long getTimeStep() ; CORBA::Long getTimeStep() ;
void setTimeStepRank(CORBA::Long t, CORBA::Long r ); void setTimeStepRank(CORBA::Long t, CORBA::Long r );
CORBA::Long getRank(); CORBA::Long getRank();
void setTimeStepRankLast(); void setTimeStepRankLast();
void setNoTimeStep(); void setNoTimeStep();
void setLogFile(const char* str); void setLogFile(const char* str);
char* getLogFile(); char* getLogFile();
void setVerbosityLevel(CORBA::Long v); void setVerbosityLevel(CORBA::Long v);
CORBA::Long getVerbosityLevel(); CORBA::Long getVerbosityLevel();
void setRemoveOnSuccess(bool mybool); void setRemoveOnSuccess(bool mybool);
bool getRemoveOnSuccess(); bool getRemoveOnSuccess();
SMESH::MgAdaptHypothesisData* getData() ; SMESH::MgAdaptHypothesisData* getData() ;
void setSizeMapType(const char* type); void setSizeMapType(const char* type);
void setUseLocalMap(bool mybool); void setUseLocalMap(bool mybool);
bool getUseLocalMap(); bool getUseLocalMap();
void setUseBackgroundMap(bool mybool); void setUseBackgroundMap(bool mybool);
bool getUseBackgroundMap(); bool getUseBackgroundMap();
void setUseConstantValue(bool mybool); void setUseConstantValue(bool mybool);
bool getUseConstantValue(); bool getUseConstantValue();
void setConstantSize(double value); void setConstantSize(double value);
double getConstantSize(); double getConstantSize();
void setSizeMapFile(const char* str); void setSizeMapFile(const char* str);
char* getSizeMapFile(); char* getSizeMapFile();
void setFromMedFile(bool mybool); void setFromMedFile(bool mybool);
bool isFromMedFile(); bool isFromMedFile();
void setKeepWorkingFiles(bool mybool); void setKeepWorkingFiles(bool mybool);
bool getKeepWorkingFiles(); bool getKeepWorkingFiles();
//~void setPrCORBA::LongLogInFile(bool); //~void setPrCORBA::LongLogInFile(bool);
//~bool getPrCORBA::LongLogInFile(); //~bool getPrCORBA::LongLogInFile();
void setWorkingDir(const char* str); void setWorkingDir(const char* str);
char* getWorkingDir() ; char* getWorkingDir() ;
void setPrintLogInFile(bool mybool); void setPrintLogInFile(bool mybool);
bool getPrintLogInFile(); bool getPrintLogInFile();
bool setAll(); bool setAll();
char* getCommandToRun() ; char* getCommandToRun() ;
//~CORBA::Long compute(::CORBA::String_out errStr); //~CORBA::Long compute(::CORBA::String_out errStr);
CORBA::Long compute(); CORBA::Long compute();
char* getFileName(); char* getFileName();
char* getExeName(); char* getExeName();
void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) ; void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) ;
//~void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) { //~void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) {
//~copyMgAdaptHypothesisData(&data); //~copyMgAdaptHypothesisData(&data);
//~} //~}
//~void checkDirPath(char*& str); //~void checkDirPath(char*& str);
bool hasOptionDefined( const char* optionName ) ; bool hasOptionDefined( const char* optionName ) ;
void setOptionValue(const char* optionName, void setOptionValue(const char* optionName,
const char* optionValue) throw (std::invalid_argument); const char* optionValue) throw (std::invalid_argument);
char* getOptionValue(const char* optionName, char* getOptionValue(const char* optionName,
bool& isDefault) throw (std::invalid_argument); bool& isDefault) throw (std::invalid_argument);
str_array* getCustomOptionValuesStrVec() ; str_array* getCustomOptionValuesStrVec() ;
str_array* getOptionValuesStrVec() ; str_array* getOptionValuesStrVec() ;
void copyHypothesisDataFromImpl(const ::MG_ADAPT::MgAdaptHypothesisData* from, SMESH::MgAdaptHypothesisData* to) const; void copyHypothesisDataFromImpl(const ::MG_ADAPT::MgAdaptHypothesisData* from, SMESH::MgAdaptHypothesisData* to) const;
void copyHypothesisDataToImpl(const SMESH::MgAdaptHypothesisData& from, ::MG_ADAPT::MgAdaptHypothesisData* to) const; void copyHypothesisDataToImpl(const SMESH::MgAdaptHypothesisData& from, ::MG_ADAPT::MgAdaptHypothesisData* to) const;
//~TOptionValues getOptionValues() const; //~TOptionValues getOptionValues() const;
//~const TOptionValues& getCustomOptionValues() const ; //~const TOptionValues& getCustomOptionValues() const ;
char* getErrMsg(); char* getErrMsg();
private: private:
::MG_ADAPT::MgAdapt* myMgAdapt; ::MG_ADAPT::MgAdapt* myMgAdapt;
std::string errStr; std::string errStr;
@ -141,16 +141,16 @@ private:
}; };
class SMESH_I_EXPORT MG_ADAPT_OBJECT_i: class SMESH_I_EXPORT MG_ADAPT_OBJECT_i:
public virtual SALOME::GenericObj_i, public virtual SALOME::GenericObj_i,
public virtual POA_SMESH::MG_ADAPT_OBJECT { public virtual POA_SMESH::MG_ADAPT_OBJECT {
public : public :
MG_ADAPT_OBJECT_i(); MG_ADAPT_OBJECT_i();
void setMeshIn( SMESH::SMESH_Mesh_ptr theMesh ); void setMeshIn( SMESH::SMESH_Mesh_ptr theMesh );
void setMEDFileIn(const char* f); void setMEDFileIn(const char* f);
void setMEDFileOut(const char* f); void setMEDFileOut(const char* f);
void setMEDFileBackground(const char* f); void setMEDFileBackground(const char* f);
void AddHypothesis(SMESH::MG_ADAPT_ptr); void AddHypothesis(SMESH::MG_ADAPT_ptr);
CORBA::Long Compute(bool Publish); CORBA::Long Compute(bool Publish);
private: private:
std::string medFileIn, medFileOut, medFileBackground; std::string medFileIn, medFileOut, medFileBackground;
bool checkMeshFileIn(); bool checkMeshFileIn();