mesh adaptation with mg-adapt

This commit is contained in:
azakir 2020-12-10 16:15:09 +01:00
parent 665d037f93
commit d8fb185943
7 changed files with 4312 additions and 0 deletions

View File

@ -46,6 +46,7 @@ INCLUDE_DIRECTORIES(
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/idl
${PROJECT_BINARY_DIR}/src/ADAPTGUI
${MEDCOUPLING_INCLUDE_DIRS}
)
# additional preprocessor / compiler flags
@ -78,6 +79,7 @@ SET(_link_LIBRARIES
ADAPTGUI
ADAPTImpl
ADAPTEngine
${MEDCoupling_medloader}
)
# --- headers ---
@ -151,6 +153,8 @@ SET(_moc_HEADERS
SMESHGUI_IdPreview.h
SMESHGUI_PreVisualObj.h
SMESHGUI_AdaptDlg.h
SMESHGUI_MG_ADAPTDRIVER.h
MG_ADAPTGUI.hxx # to replace in ../ADAPTGUI/
)
# header files / no moc processing
@ -173,6 +177,7 @@ SET(_other_HEADERS
SMESHGUI_FileValidator.h
SMESHGUI_SelectionProxy.h
SMESH_SMESHGUI.hxx
MG_ADAPT.hxx # to replace in ../ADAPT/
)
# header files / to install
@ -267,6 +272,9 @@ SET(_other_SOURCES
SMESHGUI_PreVisualObj.cxx
SMESHGUI_IdPreview.cxx
SMESHGUI_AdaptDlg.cxx
SMESHGUI_MG_ADAPTDRIVER.cxx
MG_ADAPTGUI.cxx # to replace in ../ADAPTGUI/
MG_ADAPT.cxx # to replace in ../ADAPT/
)
# sources / to compile

1297
src/SMESHGUI/MG_ADAPT.cxx Normal file

File diff suppressed because it is too large Load Diff

330
src/SMESHGUI/MG_ADAPT.hxx Normal file
View File

@ -0,0 +1,330 @@
// Copyright (C) 2011-2020 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
// File : MG_ADAPT.hxx
//
#ifndef MG_ADAPT_HXX
#define MG_ADAPT_HXX
#include <string>
# include <sstream>
#include <map>
#include <vector>
#include <set>
#include <fstream>
#include "MCAuto.hxx"
#include "MCType.hxx"
#include "MEDFileMesh.hxx"
#include <med.h>
// SMESH includes
//~#include <med.h>
class MgAdapt;
typedef std::map< std::string, std::string > TOptionValues;
typedef std::set< std::string > TOptionNames;
struct MgAdaptHypothesisData
{
std::string myFileInDir, myMeshFileIn, myInMeshName, myMeshFileBackground, myOutMeshName,
myMeshFileOut, myFileOutDir, myFileSizeMapDir, myFieldName;
bool fromMedFile;
bool myPublish, myMeshOutMed;
bool myUseLocalMap, myUseBackgroundMap, myUseConstantValue;
double myConstantValue;
int myRank, myTimeStep;
bool myUseNoTimeStep, myUseLastTimeStep, myUseChosenTimeStep;
std::string myWorkingDir, myLogFile;
bool myPrintLogInFile, myKeepFiles, myRemoveLogOnSuccess;
int myVerboseLevel;
};
/*!
* \brief Class to generate string from any type
*/
class ToComment : public std::string
{
std::ostringstream _s ;
public :
ToComment():std::string("") {}
ToComment(const ToComment& c):std::string() {
_s << c.c_str() ;
this->std::string::operator=( _s.str() );
}
ToComment & operator=(const ToComment& c) {
_s << c.c_str() ;
this->std::string::operator=( _s.str() );
return *this;
}
template <class T>
ToComment( const T &anything ) {
_s << anything ;
this->std::string::operator=( _s.str() );
}
template <class T>
ToComment & operator<<( const T &anything ) {
_s << anything ;
this->std::string::operator=( _s.str() );
return *this ;
}
operator char*() const {
return (char*)c_str();
}
std::ostream& Stream() {
return _s;
}
};
class MgAdapt
{
enum YesNo {YES, NO};
public:
MgAdapt();
MgAdapt(MgAdaptHypothesisData*);
MgAdapt(const MgAdapt&);
~MgAdapt();
void buildModel();
void setData( MgAdaptHypothesisData*);
void setMedFileIn(std::string);
std::string getMedFileIn();
void setMedFileOut(std::string);
std::string getMedFileOut();
void setMeshName(std::string);
std::string getMeshName();
void setMeshNameOut(std::string);
std::string getMeshNameOut();
void setMeshOutMed(bool);
bool getMeshOutMed();
void setPublish(bool);
bool getPublish();
void setFieldName(std::string);
std::string getFieldName();
void setTimeStep(int);
int getTimeStep() const;
void setRankTimeStep(int, int );
int getRank();
void setLogFile(std::string);
std::string getLogFile();
void setVerbosityLevel(int);
int getVerbosityLevel();
void setRemoveOnSuccess(bool);
bool getRemoveOnSuccess();
MgAdaptHypothesisData* getData() const;
void setUseLocalMap(bool);
bool getUseLocalMap();
void setUseBackgroundMap(bool);
bool getUseBackgroundMap();
void setUseConstantValue(bool);
bool getUseConstantValue();
void setConstantValue(double);
bool getConstantValue();
void setSizeMapFile(std::string);
std::string getSizeMapFile();
void setFromMedFile(bool);
bool isFromMedFile();
void setKeepWorkingFiles(bool);
bool getKeepWorkingFiles();
void setPrintLogInFile(bool);
bool getPrintLogInFile();
void setWorkingDir(std::string);
std::string getWorkingDir() const;
bool setAll();
static std::string getCommandToRun(MgAdapt* );
std::string getCommandToRun() ;
int compute(std::string& errStr);
std::string getFileName() const;
static std::string getExeName();
void copyMgAdaptHypothesisData( MgAdaptHypothesisData* ) ;
void checkDirPath(std::string& );
bool hasOptionDefined( const std::string& optionName ) const;
void setOptionValue(const std::string& optionName,
const std::string& optionValue) throw (std::invalid_argument);
std::string getOptionValue(const std::string& optionName,
bool* isDefault=0) const throw (std::invalid_argument);
std::vector <std::string> getCustomOptionValuesStrVec() const;
std::vector <std::string> getOptionValuesStrVec() const;
TOptionValues getOptionValues() const;
const TOptionValues& getCustomOptionValues() const ;
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 int toInt(const std::string&, bool* isOk = 0 ) throw (std::invalid_argument);
/* 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();
enum Status {
DRS_OK,
DRS_EMPTY, // a file contains no mesh with the given name
DRS_WARN_RENUMBER, // a file has overlapped ranges of element numbers,
// 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 :
bool fromMedFile;
std::string medFileIn;
std::string medFileOut;
std::string meshName;
std::string meshNameOut;
bool publish, meshOutMed;
bool useLocalMap, useBackgroundMap, useConstantValue;
std::string sizeMapFile;
std::string fieldName;
double constantValue;
int rank, timeStep;
/* advanced options */
std::string logFile;
std::string workingDir;
int verbosityLevel;
bool removeOnSuccess;
bool toKeepWorkingFiles;
bool printLogInFile;
/* Model DATA */
MgAdaptHypothesisData* data;
/* */
TOptionValues _option2value, _customOption2value; // user defined values
TOptionValues _defaultOptionValues; // default values
TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
std::vector <std::string> _myErrorMessages;
Status _myStatus;
std::string meshFormatOutputMesh;
std::vector< std::string> solFormatOutput;
std::vector <group> groupVec;
std::vector <family> famVec;
/* convert MED-->.mesh format */
void convertMedFile(std::string& meshIn,std::string& solFileIn, std::string& sizeMapIn) ;
void storeGroups(MEDCoupling::MEDFileMesh* fileMesh);
void restoreGroups(MEDCoupling::MEDFileMesh* fileMesh) const;
void storefams(MEDCoupling::MEDFileMesh* fileMesh);
void restorefams(MEDCoupling::MEDFileMesh* fileMesh) const;
void storeGroupsAndFams(MEDCoupling::MEDFileMesh* fileMesh);
void restoreGroupsAndFams(MEDCoupling::MEDFileMesh* fileMesh) const;
void convertMeshFile(std::string& meshFormatIn, std::vector< std::string>& solFieldFileNames) const ;
void getTimeStepInfos(std::string aFile, int& numdt, int& numit);
Status addMessage(const std::string& msg, const bool isFatal = false);
med_idt openMedFile(const std::string aFile) ;
bool isFileExist(std::string& fName) const;
void execCmd( const char* cmd, int& err);
};
#endif // MG_ADAPT_HXX

1367
src/SMESHGUI/MG_ADAPTGUI.cxx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,312 @@
// Copyright (C) 2011-2020 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for the adaptation in the SMESH component
// File : MG_ADAPTGUI.hxx
//
#ifndef MG_ADAPTGUI_HXX
#define MG_ADAPTGUI_HXX
#include <set>
// SMESH includes
// Qt includes
#include <QDialog>
#include <QTreeWidget>
#include<QItemDelegate>
#include "LightApp_DataOwner.h"
#include "SalomeApp_Application.h"
#include <SALOMEconfig.h>
#include <SALOME_ListIO.hxx>
#include "SalomeApp_Module.h"
#include "SalomeApp_Study.h"
#include <med.h>
#include <map>
// model
#include "MG_ADAPT.hxx"
class SUIT_ViewWindow;
class SUIT_Desktop;
class SUIT_Study;
class SUIT_ResourceMgr;
class CAM_Module;
class SALOMEDSClient_Study;
class SALOMEDSClient_SObject;
class SalomeApp_Study;
class SalomeApp_Module;
class LightApp_SelectionMgr;
class QButtonGroup;
class QLineEdit;
class QGroupBox;
class QRadioButton;
class QLabel;
class QCheckBox;
class QGridLayout;
class QTabWidget;
class QDoubleSpinBox;
class QSpinBox;
class QTreeWidget;
class QTreeWidgetItem;
class QSpacerItem;
class QHBoxLayout;
class QItemDelegate;
class QComboBox;
// IDL includes
#include <SALOMEconfig.h>
class SVTK_ViewWindow;
class SVTK_Selector;
class SMESHGUI_MgAdaptDlg;
class SMESHGUI_MgAdaptArguments;
class SMESHGUI_SpinBox;
class MgAdaptAdvWidgetTreeWidget;
class MgAdaptAdvWidget;
class MgAdapt;
class QHeaderView;
class QFileDialog;
std::map<QString, int> GetListeChamps(QString aFile, bool errorMessage = true);
QString lireNomMaillage(QString aFile);
QString lireNomMaillage2(med_idt medIdt,int meshId);
med_idt OuvrirFichier(QString aFile);
//=================================================================================
// class : SMESHGUI_MgAdaptDlg
// purpose :
//=================================================================================
class SMESHGUI_MgAdaptDlg : public QDialog
{
Q_OBJECT;
public:
//! Property type
enum Mode { Arguments, AdvancedOptions};
SMESHGUI_MgAdaptDlg( SalomeApp_Module*, MgAdapt*, QWidget* parent= 0,bool isCreation = true );
~SMESHGUI_MgAdaptDlg();
void buildDlg();
void reject();
bool checkParams(QString& msg) ;
void setModel(MgAdapt*);
MgAdapt* getModel() const;
public slots:
protected slots:
virtual bool clickOnApply();
private slots:
virtual void clickOnHelp();
virtual void clickOnOk();
protected :
SMESHGUI_MgAdaptArguments* myArgs;
MgAdaptAdvWidget* myAdvOpt;
bool readParamsFromHypo( ) const ;
bool readParamsFromWidgets( ) ;
bool storeParamsToHypo( const MgAdaptHypothesisData& ) const;
private:
SalomeApp_Module* mySMESHGUI; /* Current SMESHGUI object */
QTabWidget* myTabWidget;
MgAdaptHypothesisData* myData;
MgAdapt* model;
};
class SMESHGUI_MgAdaptArguments : public QWidget
{
Q_OBJECT;
public:
//! Property type
enum Mode { Mesh, Browser};
enum SIZEMAP { Local, Background, Constant};
SMESHGUI_MgAdaptArguments( QWidget* parent);
~SMESHGUI_MgAdaptArguments();
void setMode( const Mode, const SIZEMAP );
QString* myFileInDir;
QString* myFileOutDir;
QString* myFileSizeMapDir;
QGroupBox* aMeshIn ;
QRadioButton* aMedfile;
QRadioButton* aBrowser ;
QLineEdit* aBrowserObject;
QPushButton* selectMedFilebutton ;
QSpacerItem* hspacer;
QLineEdit* selectMedFileLineEdit ;
QButtonGroup* meshInGroup ;
QGridLayout* meshIn ;
QGroupBox* aMeshOut ;
QLabel* meshName;
QLineEdit* meshNameLineEdit;
QSpacerItem* secondHspacer;
QCheckBox* medFileCheckBox;
QPushButton* selectOutMedFilebutton;
QLineEdit* selectOutMedFileLineEdit;
QSpacerItem* thirdHspacer;
QCheckBox* publishOut;
QGridLayout* meshOut ;
QGroupBox* sizeMapDefinition ;
QRadioButton* localButton;
QRadioButton* backgroundButton ;
QRadioButton* constantButton ;
QLabel* medFileBackground;
QPushButton* selectMedFileBackgroundbutton;
QLineEdit* selectMedFileBackgroundLineEdit;
QLabel* valueLabel;
QDoubleSpinBox* dvalue;
QButtonGroup* sizeMapDefGroup ;
QGridLayout* sizeMapDefGroupLayout;
QGroupBox* sizeMapField;
QLabel* fieldName;
QComboBox* fieldNameCmb;
QRadioButton* noTimeStep;
QRadioButton* lastTimeStep ;
QRadioButton* chosenTimeStep;
QLabel* timeStepLabel;
QSpinBox* timeStep;
QLabel* rankLabel;
QSpinBox* rankSpinBox;
QButtonGroup* timeStepGroup;
QGridLayout* sizeMapFieldGroupLayout;
signals:
void updateSelection();
void toExportMED(const char *);
public slots:
protected slots:
private slots:
void modeChanged( int);
void sizeMapDefChanged(int);
void timeStepGroupChanged(int timeStepType, bool disableOther = false, int max = 0);
void onSelectMedFilebuttonClicked();
void clear();
void onMedFileCheckBox(int);
void onPublishOut(int);
void onSelectOutMedFilebutton();
void onSelectMedFileBackgroundbutton();
void onLocalSelected(QString);
void onNoTimeStep(bool disableOther = false);
void onLastTimeStep(bool disableOther = false);
void onChosenTimeStep(bool disableOther = false, int max = 0);
private:
QString getMedFileName(bool avertir);
LightApp_SelectionMgr* selMgr ;
std::map<QString, int> myFieldList;
};
enum {
OPTION_ID_COLUMN = 0,
OPTION_TYPE_COLUMN,
OPTION_NAME_COLUMN = 0,
OPTION_VALUE_COLUMN,
NB_COLUMNS,
};
//////////////////////////////////////////
// MgAdaptAdvWidget
//////////////////////////////////////////
class MgAdaptAdvWidget : public QWidget
{
Q_OBJECT
public:
MgAdaptAdvWidget( QWidget* = 0, std::vector <std::string> * = nullptr, Qt::WindowFlags = 0 );
~MgAdaptAdvWidget();
std::vector < std::string > * myOptions;
QGridLayout *gridLayout_4;
MgAdaptAdvWidgetTreeWidget *myOptionTable;
QPushButton *addBtn;
QSpacerItem *horizontalSpacer;
QGroupBox *logGroupBox;
QGridLayout *gridLayout_2;
QGridLayout *gridLayout;
QLabel *workingDirectoryLabel;
QLineEdit *workingDirectoryLineEdit;
QPushButton *workingDirectoryPushButton;
QLabel *verboseLevelLabel;
QSpinBox *verboseLevelSpin;
QHBoxLayout *horizontalLayout;
QCheckBox *logInFileCheck;
QCheckBox *removeLogOnSuccessCheck;
QCheckBox *keepWorkingFilesCheck;
void AddOption( const char* name_value_type, bool isCustom = false );
void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt );
void setupWidget();
public slots:
void onAddOption();
void itemChanged(QTreeWidgetItem * tblRow, int column);
};
enum { EDITABLE_ROLE = Qt::UserRole + 1, PARAM_NAME,
NAME_COL = 0, VALUE_COL
};
class ItemDelegate: public QItemDelegate
{
public:
ItemDelegate(QObject* parent=0): QItemDelegate(parent) {}
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &o, const QModelIndex &index) const;
};
class MgAdaptAdvWidgetTreeWidget : public QTreeWidget
{
Q_OBJECT
public:
MgAdaptAdvWidgetTreeWidget( QWidget* );
protected:
QModelIndex moveCursor( CursorAction, Qt::KeyboardModifiers );
void keyPressEvent( QKeyEvent* );
};
#endif // MG_ADAPTGUI_HXX

View File

@ -0,0 +1,771 @@
// 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
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESHGUI_MG_ADAPTDRIVER.cxx
#include "SMESHGUI_MG_ADAPTDRIVER.h"
#include "SUIT_Desktop.h"
#include "SUIT_Application.h"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Module.h"
#include "SalomeApp_Study.h"
#include "SMESH_Comment.hxx"
#include "SMESH_Actor.h"
#include "SMESHGUI.h"
#include "SMESHGUI_FilterDlg.h"
#include "SMESHGUI_Selection.h"
#include <SUIT_MessageBox.h>
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_MeshEditPreview.h"
#include "SMESHGUI_VTKUtils.h"
#include <SMESH_TypeFilter.hxx>
#include <SMESH_MeshAlgos.hxx>
#include <SMESH_LogicalFilter.hxx>
#include <SMDS_Mesh.hxx>
#include <SMDS_MeshNode.hxx>
#include "SMESHGUI_SpinBox.h"
#include <LightApp_SelectionMgr.h>
#include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
#include <SUIT_FileDlg.h>
#include "SMESHGUI_MeshUtils.h"
#include <QApplication>
#include <QButtonGroup>
#include <QGridLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QKeyEvent>
#include <QLabel>
#include <QLineEdit>
#include <QCheckBox>
#include <QPushButton>
#include <QRadioButton>
#include <QTabWidget>
#include <QVBoxLayout>
#include <QDoubleSpinBox>
#include <QSpinBox>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QSpacerItem>
#include <QString>
#include <QHeaderView>
#include <QItemDelegate>
#include <QFileDialog>
#include <QMessageBox>
#include <QComboBox>
#include <vtkPoints.h>
#include <vtkUnstructuredGrid.h>
#include <vtkIdList.h>
#include <vtkCellArray.h>
#include <vtkUnsignedCharArray.h>
#include <vtkDataSetMapper.h>
#include <VTKViewer_CellLocationsArray.h>
#include <vtkProperty.h>
#include <ElCLib.hxx>
// SALOME KERNEL includes
#include <SALOMEDS_SComponent.hxx>
#include <SALOMEDS_SObject.hxx>
#include <SALOMEDS_Study.hxx>
#include <SALOMEDS_wrap.hxx>
#include "SalomeApp_Tools.h"
#include <SALOMEconfig.h>
#include <med.h>
#include <utilities.h>
#include <TCollection_AsciiString.hxx>
const int SPACING = 6; // layout spacing
const int MARGIN = 9; // layout margin
SALOME_ListIO mySelected;
//================================================================
// Function : firstIObject
// Purpose : Return the first selected object in the selected object list
//================================================================
Handle(SALOME_InteractiveObject) firstIObject()
{
const SALOME_ListIO& aList = selectedIO();
return aList.Extent() > 0 ? aList.First() : Handle(SALOME_InteractiveObject)();
}
//================================================================
// Function : selectedIO
// Return the list of selected SALOME_InteractiveObject's
//================================================================
const SALOME_ListIO& selectedIO()
{
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* > ( SUIT_Session::session()->activeApplication() );
LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr();
if( aSelectionMgr )
{
aSelectionMgr->selectedObjects( mySelected );
for (SALOME_ListIteratorOfListIO it (mySelected); it.More(); it.Next())
SCRUTE(it.Value()->getEntry());
};
return mySelected;
}
//================================================================
// Function : getStudy
// Returne un pointeur sur l'etude active
//================================================================
_PTR(Study) getStudy()
{
static _PTR(Study) _study;
if(!_study)
_study = SalomeApp_Application::getStudy();
return _study;
}
bool createAndPublishMed(QString fileName)
{
SMESH::DriverMED_ReadStatus res;
SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
// SMESHGUI aGui;
aMeshes = SMESHGUI::GetSMESHGen()->CreateMeshesFromMED( fileName.toUtf8().constData(), res );
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[0] );
_PTR(Study) aStudy = SMESH::getStudy();
QStringList anEntryList;
// bool isEmpty;
if ( aMeshSO ) {
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
anEntryList.append( aMeshSO->GetID().c_str() );
}
else {
// isEmpty = true;
return false;
}
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
// browse to the published meshes
if( LightApp_Application* anApp =
dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
anApp->browseObjects( anEntryList );
return true;
}
bool createMgAdaptObject(MgAdapt *myMgAdapt )
{
// SMESH::SMESH_Mesh_var newMesh = SMESHGUI::GetSMESHGen()->CreateEmptyMesh();
// _PTR(SObject) aHypothesis;
_PTR(Study) aStudy = SMESH::getStudy();
QStringList anEntryList;
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
_PTR(SComponent) mgadapt = aStudy->FindComponent("MG-ADAPT");
_PTR(GenericAttribute) ga;
if (!aBuilder->FindAttribute(mgadapt, ga, "AttributeName") )
{
mgadapt = aBuilder->NewComponent("MG-ADAPT");
_PTR(AttributeName) Name = aBuilder->FindOrCreateAttribute(mgadapt, "AttributeName");
Name->SetValue("MG-ADAPT");
_PTR(AttributePixMap) myPixmap = aBuilder->FindOrCreateAttribute( mgadapt, "AttributePixMap" );
myPixmap->SetPixMap( "ICON_MG_ADAPT" );
anEntryList.append( mgadapt->GetID().c_str() );
}
_PTR(SObject) obj = aBuilder->NewObject(mgadapt);
_PTR(AttributeName) myName = aBuilder->FindOrCreateAttribute(obj, "AttributeName");
myName->SetValue("hypo");
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( obj, "AttributePixMap" );
aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO" );
anEntryList.append( obj->GetID().c_str() );
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
// // browse to the published meshes
if( LightApp_Application* anApp =
dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
anApp->browseObjects( anEntryList );
return true;
}
// MG ADAPT UTILS
//================================================================
// Function : IObjectCount
// Return the number of selected objects
//================================================================
int IObjectCount()
{
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr();
if( aSelectionMgr )
{
aSelectionMgr->selectedObjects( mySelected );
SCRUTE(mySelected.Extent());
return mySelected.Extent();
}
return 0;
}
SMESHGUI_MG_AdaptComputeDlg_QThread::SMESHGUI_MG_AdaptComputeDlg_QThread(MgAdapt* aModel)
{
model = aModel;
myResult = -1;
}
void SMESHGUI_MG_AdaptComputeDlg_QThread::run()
{
int err;
std::string errStr;
errStr = model->compute(errStr);
std::string msg = err == 0 ? " ok" : std::string("Not ok \n")+ errStr;
exec();
}
int SMESHGUI_MG_AdaptComputeDlg_QThread::result()
{
return myResult;
}
void SMESHGUI_MG_AdaptComputeDlg_QThread::cancel()
{
//~model->cancel();
}
SMESHGUI_MG_ADAPTDRIVER::SMESHGUI_MG_ADAPTDRIVER( SMESHGUI* theModule, MgAdapt* myModel, bool isCreation )
: mySMESHGUI( theModule ),
myFilterDlg(0),
myIsApplyAndClose( false ),
SMESHGUI_MgAdaptDlg((SalomeApp_Module*)theModule, myModel, SMESHGUI::desktop(), isCreation)
{
resMgr = resourceMgr();
selMgr = selectionMgr();
// connections
connect(myArgs, SIGNAL(updateSelection()), this, SLOT(updateSelection()));
connect(myArgs, SIGNAL(toExportMED(const char*)), this, SLOT(exportMED(const char*)));
}
SUIT_ResourceMgr* SMESHGUI_MG_ADAPTDRIVER::resourceMgr()
{
return dynamic_cast<SUIT_ResourceMgr*>( SUIT_Session::session()->resourceMgr() );
}
LightApp_SelectionMgr* SMESHGUI_MG_ADAPTDRIVER::selectionMgr()
{
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
if( anApp )
return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
else
return 0;
}
void SMESHGUI_MG_ADAPTDRIVER::updateSelection()
{
disconnect( selMgr, 0, this, 0 );
selMgr->clearFilters();
SMESH::SetPointRepresentation( true );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->SetSelectionMode( ActorSelection );
if (myArgs->aBrowser->isChecked())
{
connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ));
selectionChanged();
}
}
void SMESHGUI_MG_ADAPTDRIVER::selectionChanged()
{
//~ get selected mesh
SALOME_ListIO aList;
selMgr->selectedObjects(aList);
QString aString = "";
int nbSel = aList.Extent();
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;
}
else
return;
SMESH::GetNameOfSelectedIObjects( selMgr, aString );
if ( aString.isEmpty() ) aString = " ";
else aString = aString.trimmed();
bool ok = !aString.isEmpty();
if ( !mesh->_is_nil() )
{
myArgs->aBrowserObject->setText( aString );
myArgs->meshNameLineEdit->setText( aString );
myArgs->selectOutMedFileLineEdit->setText(aString+QString(".med"));
}
}
void SMESHGUI_MG_ADAPTDRIVER::exportMED(const char* tmp_file)
{
bool toOverwrite = true;
bool toFindOutDim = true;
myMesh->ExportMED(tmp_file, false, -1, toOverwrite, toFindOutDim);
}
void SMESHGUI_MG_ADAPTDRIVER::setMyMesh(SMESH::SMESH_Mesh_var mesh)
{
myMesh = mesh;
}
SMESH::SMESH_Mesh_var SMESHGUI_MG_ADAPTDRIVER::getMyMesh()
{
return myMesh;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::clickOnOk()
{
setIsApplyAndClose( true );
clickOnApply();
reject();
}
bool SMESHGUI_MG_ADAPTDRIVER::clickOnApply()
{
if ( SMESHGUI::isStudyLocked() )
return false;
if( !isValid() )
return false;
SMESHGUI_MgAdaptDlg::clickOnApply();
bool ok = execute();
//~SMESHGUI_MG_AdaptComputeDlg_QThread atest(getModel());
//~atest.start();
//~atest.quit();
if (getModel()->getPublish()) this->createMeshInObjectBrowser();
return ok;
}
bool SMESHGUI_MG_ADAPTDRIVER::execute()
{
int err;
std::string errStr;
try
{
err = getModel()->compute(errStr);
std::string msg = err == 0 ? " ok" : std::string("Not ok \n")+errStr ;
}
catch (const std::exception& e)
{
std::cerr<<e.what();
}
return err == 0? true: false;
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::Init (bool ResetControls)
{
myBusy = false;
if ( ResetControls )
{
myLineEditElements->clear();
myNbOkElements = 0;
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);
//~myActor = 0;
myMesh = SMESH::SMESH_Mesh::_nil();
myIdSourceCheck->setChecked(true);
onConstructor( 0 );
}
}
//=======================================================================
//function : onConstructor
//purpose : switch operation mode
//=======================================================================
void SMESHGUI_MG_ADAPTDRIVER::onConstructor( int withGeom )
{
myGeomLabel ->setVisible( withGeom );
myGeomNameEdit ->setVisible( withGeom );
myReuseHypCheck ->setVisible( withGeom );
myCopyElementsCheck->setVisible( withGeom );
myFilterBtn ->setVisible( !withGeom );
myIdSourceCheck ->setVisible( !withGeom );
if ( !withGeom )
myMeshNameEdit->setText( SMESH::UniqueMeshName("Mesh"));
}
//~void SMESHGUI_MG_ADAPTDRIVER::onSelectIdSource( bool )
//~{}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::enterEvent (QEvent*)
{
// if ( !ConstructorsBox->isEnabled() ) {
// SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
// if ( aViewWindow && !mySelector ) {
// mySelector = aViewWindow->GetSelector();
// }
// activateThisDialog();
// }
}
//=================================================================================
// function : keyPressEvent()
// purpose :
//=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::keyPressEvent( QKeyEvent* e )
{
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
if ( e->key() == Qt::Key_F1 ) {
e->accept();
clickOnHelp();
}
}
//=================================================================================
// function : clickOnHelp()
// purpose :
//=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::clickOnHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
QString platform;
#ifdef WIN32
platform = "winapplication";
#else
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser",
platform)).
arg(myHelpFileName));
}
}
//=======================================================================
//function : getErrorMsg
//purpose : Return an error message and entries of invalid smesh object
//=======================================================================
QString SMESHGUI_MG_ADAPTDRIVER::getErrorMsg( SMESH::string_array_var theInvalidEntries,
QStringList & theEntriesToBrowse )
{
if ( theInvalidEntries->length() == 0 )
return tr("OPERATION_FAILED");
// theInvalidEntries - SObject's that hold geometry objects whose
// 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
// preceding sub-shape
QString msg = tr("SUBSHAPES_NOT_FOUND_MSG") + "\n";
QString objString;
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
{
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() )
msg += objString;
return msg;
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
bool SMESHGUI_MG_ADAPTDRIVER::isValid()
{
bool ok = true;
return ok;
}
bool SMESHGUI_MG_ADAPTDRIVER::createMeshInObjectBrowser()
{
QString filename(getModel()->getMedFileOut().c_str());
QStringList errors;
QStringList anEntryList;
bool isEmpty = false;
bool ok = false;
SMESH::SMESH_Gen_var SMESH_Gen_ptr = SMESHGUI::GetSMESHGen();
if (!SMESH_Gen_ptr) {
std::cerr << "Could not retrieve SMESH_Gen_ptr" << std::endl;
throw SALOME_Exception(LOCALIZED("Could not retrieve SMESH::GetSMESHGen()"));
}
SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
aMeshes->length( 1 ); // one mesh only
SMESH::DriverMED_ReadStatus res;
aMeshes = SMESH_Gen_ptr->CreateMeshesFromMED( filename.toUtf8().constData(), res );
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() ) ) );
}
_PTR(Study) aStudy = SMESH::getStudy();
for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ )
{
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
if ( aMeshSO ) {
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" ); // put REFINED mesh ico
anEntryList.append( aMeshSO->GetID().c_str() );
}
else {
isEmpty = true;
}
}
// 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
if ( errors.count() > 0 ) {
SUIT_MessageBox::critical( SMESHGUI::desktop(),
QObject::tr( "SMESH_ERROR" ),
QObject::tr( "SMESH_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
}
// show warning message box, if some imported mesh is empty
if ( isEmpty ) {
SUIT_MessageBox::warning( SMESHGUI::desktop(),
QObject::tr( "SMESH_WRN_WARNING" ),
QObject::tr( "SMESH_DRS_SOME_EMPTY" ) );
}
return true;
}
//================================================================
// function : setIsApplyAndClose
// Purpose : Set value of the flag indicating that the dialog is
// accepted by Apply & Close button
//================================================================
void SMESHGUI_MG_ADAPTDRIVER::setIsApplyAndClose( const bool theFlag )
{
myIsApplyAndClose = theFlag;
}//================================================================
// function : isApplyAndClose
// Purpose : Get value of the flag indicating that the dialog is
// accepted by Apply & Close button
//================================================================
bool SMESHGUI_MG_ADAPTDRIVER::isApplyAndClose() const
{
return myIsApplyAndClose;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::deactivateActiveDialog()
{
if (ConstructorsBox->isEnabled()) {
ConstructorsBox->setEnabled(false);
GroupArguments->setEnabled(false);
GroupButtons->setEnabled(false);
mySMESHGUI->ResetState();
mySMESHGUI->SetActiveDialogBox(0);
if ( selMgr )
selMgr->removeFilter( myIdSourceFilter );
}
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::activateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
// mySMESHGUI->EmitSignalDeactivateDialog();
// ConstructorsBox->setEnabled(true);
// GroupArguments->setEnabled(true);
// GroupButtons->setEnabled(true);
// mySMESHGUI->SetActiveDialogBox((QDialog*)this);
// onSelectIdSource( myIdSourceCheck->isChecked() );
// SelectionIntoArgument();
}
//=================================================================================
// function : setFilters()
// purpose : SLOT. Called when "Filter" button pressed.
//=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::setFilters()
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
tr("SMESH_ERROR"),
tr("NO_MESH_SELECTED"));
return;
}
if ( !myFilterDlg )
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
QList<int> types;
if ( myMesh->NbEdges() ) types << SMESH::EDGE;
if ( myMesh->NbFaces() ) types << SMESH::FACE;
if ( myMesh->NbVolumes() ) types << SMESH::VOLUME;
if ( myMesh->NbBalls() ) types << SMESH::BALL;
if ( myMesh->Nb0DElements()) types << SMESH::ELEM0D;
if ( types.count() > 1 ) types << SMESH::ALL;
myFilterDlg->Init( types );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSourceWg( myLineEditElements );
myFilterDlg->show();
}
//=================================================================================
// function : onOpenView()
// purpose :
//=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::onOpenView()
{
if ( mySelector ) {
SMESH::SetPointRepresentation(false);
}
else {
mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector();
activateThisDialog();
}
}
//=================================================================================
// function : onCloseView()
// purpose :
//=================================================================================
void SMESHGUI_MG_ADAPTDRIVER::onCloseView()
{
deactivateActiveDialog();
mySelector = 0;
}

View File

@ -0,0 +1,227 @@
// Copyright (C) 2011-2020 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for the adaptation in the SMESH component
// File : SMESHGUI_MG_ADAPTDRIVER.h
//
#ifndef SMESHGUI_MG_ADAPTDRIVER_H
#define SMESHGUI_MG_ADAPTDRIVER_H
#include <set>
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
// Qt includes
#include <QDialog>
#include <QTreeWidget>
#include<QItemDelegate>
#include <QThread>
#include "LightApp_DataOwner.h"
#include "SalomeApp_Application.h"
#include <SALOMEconfig.h>
#include <SALOME_ListIO.hxx>
#include "SalomeApp_Module.h"
#include "SalomeApp_Study.h"
#include <med.h>
#include <QObject>
// model
//~#include "MG_ADAPT.h"
#include "MG_ADAPTGUI.hxx"
#include "MG_ADAPT.hxx"
class SUIT_ViewWindow;
class SUIT_Desktop;
class SUIT_Study;
class SUIT_ResourceMgr;
class CAM_Module;
class SALOMEDSClient_Study;
class SALOMEDSClient_SObject;
class SalomeApp_Study;
class SalomeApp_Module;
class LightApp_SelectionMgr;
class SUIT_SelectionFilter;
class QButtonGroup;
class QLineEdit;
class QGroupBox;
class QRadioButton;
class QLabel;
class QCheckBox;
class QGridLayout;
class QTabWidget;
class QDoubleSpinBox;
class QSpinBox;
class QTreeWidget;
class QTreeWidgetItem;
class QSpacerItem;
class QHBoxLayout;
class QItemDelegate;
class QComboBox;
class QObject;
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Gen)
class SMESHGUI;
class SMESHGUI_MgAdaptDlg;
class SMESHGUI_IdValidator;
class SMESHGUI_FilterDlg;
class MgAdapt;
class QHeaderView;
class QFileDialog;
int IObjectCount();
const SALOME_ListIO& selectedIO();
_PTR(Study) getStudy();
Handle(SALOME_InteractiveObject) firstIObject();
bool createAndPublishMed(QString fileName);
bool createMgAdaptObject(MgAdapt* myMgAdapt = 0);
class SMESHGUI_EXPORT SMESHGUI_MG_AdaptComputeDlg_QThread : public QThread
{
Q_OBJECT
public:
SMESHGUI_MG_AdaptComputeDlg_QThread(MgAdapt* model);
int result();
void cancel();
protected:
void run();
private:
MgAdapt* model;
int myResult;
};
class SMESHGUI_MG_ADAPTDRIVER : public SMESHGUI_MgAdaptDlg
{
Q_OBJECT;
public :
SMESHGUI_MG_ADAPTDRIVER( SMESHGUI*, MgAdapt*, bool isCreation = true );
void setMyMesh(SMESH::SMESH_Mesh_var);
SMESH::SMESH_Mesh_var getMyMesh() ;
private :
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
LightApp_SelectionMgr* selMgr ;
SUIT_ResourceMgr* resMgr;
SUIT_ResourceMgr* resourceMgr();
LightApp_SelectionMgr* selectionMgr();
SMESH::SMESH_Mesh_var myMesh ;
void Init( bool = true );
void enterEvent( QEvent* ); /* mouse enter the QWidget */
void keyPressEvent( QKeyEvent* );
QString getErrorMsg( SMESH::string_array_var invalidEntries,
QStringList & entriesToBrowse );
bool isValid();
bool createMeshInObjectBrowser();
void setIsApplyAndClose( const bool theFlag );
bool isApplyAndClose() const;
bool execute();
SMESHGUI_IdValidator* myIdValidator;
int myNbOkElements; /* to check when elements are defined */
SVTK_Selector* mySelector;
bool myBusy;
GEOM::GEOM_Object_var myNewGeometry;
//~SMESH_Actor* myActor; //
SUIT_SelectionFilter* myIdSourceFilter;
SMESH::SMESH_IDSource_var mySelectedObject;
QTabWidget* myTabWidget;
QButtonGroup* GroupConstructors;
QGroupBox* ConstructorsBox;
QGroupBox* GroupArguments;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QPushButton* buttonHelp;
QLabel* myTextLabelElements;
QLabel* myGeomLabel;
QLineEdit* myLineEditElements;
QLineEdit* myMeshNameEdit;
QLineEdit* myGeomNameEdit;
QCheckBox* myIdSourceCheck;
QCheckBox* myCopyGroupsCheck;
QCheckBox* myReuseHypCheck;
QCheckBox* myCopyElementsCheck;
QCheckBox* myKeepIdsCheck;
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
QString myHelpFileName;
bool myIsApplyAndClose;
QString inputMeshName;
QString outputMeshName;
private slots:
void selectionChanged();
void updateSelection();
protected slots :
private slots:
void exportMED(const char* );
virtual bool clickOnApply();
virtual void clickOnOk();
virtual void clickOnHelp();
//~void SelectionIntoArgument();
void deactivateActiveDialog();
void activateThisDialog();
void onConstructor( int );
//~void onTextChange( const QString& );
//~void onSelectIdSource( bool );
void setFilters();
void onOpenView();
void onCloseView();
};
#endif // SMESHGUI_MG_ADAPTDRIVER_H