From: eap Date: Tue, 9 Aug 2016 16:48:29 +0000 (+0300) Subject: 23307: [EDF 7315] Improvement of DISTENE meshing plugins X-Git-Tag: V8_1_0b1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3f613a8479a3f762cb01b9ce0fadef15331ecf75;p=plugins%2Fghs3dprlplugin.git 23307: [EDF 7315] Improvement of DISTENE meshing plugins --- diff --git a/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_advanced.png b/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_advanced.png new file mode 100644 index 0000000..74265b7 Binary files /dev/null and b/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_advanced.png differ diff --git a/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_basic.png b/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_basic.png index 78b3695..32a7c36 100644 Binary files a/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_basic.png and b/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_basic.png differ diff --git a/doc/salome/gui/GHS3DPRLPLUGIN/input/ghs3dprl_hypo.doc b/doc/salome/gui/GHS3DPRLPLUGIN/input/ghs3dprl_hypo.doc index 1d14049..fa0a8c1 100644 --- a/doc/salome/gui/GHS3DPRLPLUGIN/input/ghs3dprl_hypo.doc +++ b/doc/salome/gui/GHS3DPRLPLUGIN/input/ghs3dprl_hypo.doc @@ -72,6 +72,13 @@ combination with the Merge subdomains option). (mesh, global numbering and interfaces). +\image html ghs3dprl_parameters_advanced.png + +In \b Advanced tab page you can specify not exposed options of MG_Tetra-hpc. + +Add option adds a line to the table where you can type an option and its value as text. +A check box in the first column activates/deactivates the option of the current row. A deactivated option will be erased upon pressing \a Ok. +

Modifying MG-Tetra-hpc Advanced Parameters


MG-Tetra Parallel plug-in launches a standalone binary executable tetrahpc2med.
diff --git a/idl/GHS3DPRLPlugin_Algorithm.idl b/idl/GHS3DPRLPlugin_Algorithm.idl index adefb3a..8726bde 100755 --- a/idl/GHS3DPRLPlugin_Algorithm.idl +++ b/idl/GHS3DPRLPlugin_Algorithm.idl @@ -74,6 +74,8 @@ module GHS3DPRLPlugin void SetMaxSize(in float value); float GetMaxSize(); + void SetAdvancedOption( in string optAndVals ); + string GetAdvancedOption(); }; }; diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPluginBuilder.py b/src/GHS3DPRLPlugin/GHS3DPRLPluginBuilder.py index b6747cc..195d31d 100644 --- a/src/GHS3DPRLPlugin/GHS3DPRLPluginBuilder.py +++ b/src/GHS3DPRLPlugin/GHS3DPRLPluginBuilder.py @@ -139,4 +139,10 @@ class GHS3DPRL_Algorithm(Mesh_Algorithm): self.Parameters().SetMaxSize(value) pass + ## Sets command line option as text. + # @param option command line option + def SetAdvancedOption(self, option): + self.Parameters().SetAdvancedOption(option) + pass + pass # end of GHS3DPRL_Algorithm class diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx index 6db5e04..9b75f7b 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx @@ -246,15 +246,15 @@ void GHS3DPRLPlugin_GHS3DPRL::SetParameters(const GHS3DPRLPlugin_Hypothesis* hyp { if (hyp) { MESSAGE("GHS3DPRLPlugin_GHS3DPRL::SetParameters"); - _MEDName = hyp->GetMEDName(); //"DOMAIN\0" - _NbPart = hyp->GetNbPart(); - _KeepFiles = hyp->GetKeepFiles(); - _Background = hyp->GetBackground(); + _MEDName = hyp->GetMEDName(); //"DOMAIN\0" + _NbPart = hyp->GetNbPart(); + _KeepFiles = hyp->GetKeepFiles(); + _Background = hyp->GetBackground(); _Multithread = hyp->GetMultithread(); - //_ToMergeSubdomains = hyp->GetToMergeSubdomains(); - _Gradation = hyp->GetGradation(); - _MinSize = hyp->GetMinSize(); - _MaxSize = hyp->GetMaxSize(); + _Gradation = hyp->GetGradation(); + _MinSize = hyp->GetMinSize(); + _MaxSize = hyp->GetMaxSize(); + _AdvOptions = hyp->GetAdvancedOption(); } } @@ -288,181 +288,183 @@ static TCollection_AsciiString getTmpDir() //============================================================================= // Here we are going to use the GHS3DPRL mesher for tetra-hpc (formerly tepal in v3 (2014)) -bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, - const TopoDS_Shape& theShape) +bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, + const TopoDS_Shape& theShape) { - bool Ok=false; - TCollection_AsciiString pluginerror("ghs3dprl: "); - SMESHDS_Mesh* meshDS = theMesh.GetMeshDS(); - //cout<<"GetMeshDS done\n"; - if (_countSubMesh==0){ - MESSAGE("GHS3DPRLPlugin_GHS3DPRL::Compute for tetra-hpc"); - _countTotal=0; - TopExp_Explorer expf(meshDS->ShapeToMesh(), TopAbs_SOLID); - for ( ; expf.More(); expf.Next() ) _countTotal++; - } - _countSubMesh++; - //cout<<"Compute _countSubMesh "<<_countSubMesh<0) { - path=casenamemed.SubString(1,n); - casenamemed=casenamemed.SubString(n+1,casenamemed.Length()); - } - else - path=tmpDir; - - if (casenamemed.Length()>20){ - casenamemed=casenamemed.SubString(1,20); - cerr<<"MEDName truncated (no more 20 characters) = "< avoid warning message - //med_idt fid=MEDouvrir((const char *)fileskinmed.ToCString(),MED_CREATION); - //med_err ret=MEDfermer(fid); - //fileskinmed=fileskinmed + "cp /home/wambeke/empty.med "+ path + "GHS3DPRL_skin.med"; - //system( fileskinmed.ToCString() ); - fileskinmed=path + "GHS3DPRL_skin.med"; - cout<<" Write file "<ShapeToMesh(), TopAbs_SOLID); + for ( ; expf.More(); expf.Next() ) _countTotal++; + } + _countSubMesh++; + //cout<<"Compute _countSubMesh "<<_countSubMesh<0) { + path=casenamemed.SubString(1,n); + casenamemed=casenamemed.SubString(n+1,casenamemed.Length()); + } + else + path=tmpDir; + + if (casenamemed.Length()>20){ + casenamemed=casenamemed.SubString(1,20); + cerr<<"MEDName truncated (no more 20 characters) = "< avoid warning message + //med_idt fid=MEDouvrir((const char *)fileskinmed.ToCString(),MED_CREATION); + //med_err ret=MEDfermer(fid); + //fileskinmed=fileskinmed + "cp /home/wambeke/empty.med "+ path + "GHS3DPRL_skin.med"; + //system( fileskinmed.ToCString() ); + fileskinmed=path + "GHS3DPRL_skin.med"; + cout<<" Write file "<(load >> len >> std::ws); + if ( isOK && len > 0 ) + { + _AdvOptions.resize( len ); + load.get( &_AdvOptions[0], len + 1); + } return load; } @@ -250,7 +264,7 @@ std::istream& operator >>(std::istream& load, GHS3DPRLPlugin_Hypothesis& hyp) */ //================================================================================ bool GHS3DPRLPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh, - const TopoDS_Shape& theShape) + const TopoDS_Shape& theShape) { return false; } diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx index 877bf70..c0cacbe 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx @@ -66,6 +66,8 @@ public: void SetMaxSize(float theVal); float GetMaxSize() const { return _MaxSize; } + void SetAdvancedOption(const char* theOptAndVals ); + std::string GetAdvancedOption() const { return _AdvOptions; } // the parameters default values @@ -81,8 +83,6 @@ public: // Persistence virtual std::ostream& SaveTo(std::ostream& save); virtual std::istream& LoadFrom(std::istream& load); - friend std::ostream& operator <<(std::ostream& save, GHS3DPRLPlugin_Hypothesis& hyp); - friend std::istream& operator >>(std::istream& load, GHS3DPRLPlugin_Hypothesis& hyp); /*! * \brief Does nothing @@ -98,19 +98,19 @@ public: virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0); private: - int _countSubMesh; - int _countTotal; - int _nodeRefNumber; - - std::string _MEDName; // generic path/name of med files - int _NbPart; // number of partitions - bool _KeepFiles; // keep intermediates tepal files or not - bool _Background; // mg-tetra_hpc in background - bool _Multithread; // launch mg-tetra_hpc multithread version, else mpi version -// bool _ToMergeSubdomains; - float _Gradation; - float _MinSize; - float _MaxSize; + int _countSubMesh; + int _countTotal; + int _nodeRefNumber; + + std::string _MEDName; // generic path/name of med files + int _NbPart; // number of partitions + bool _KeepFiles; // keep intermediates tepal files or not + bool _Background; // mg-tetra_hpc in background + bool _Multithread; // launch mg-tetra_hpc multithread version, else mpi version + float _Gradation; + float _MinSize; + float _MaxSize; + std::string _AdvOptions; }; #endif diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.cxx index 5378d6e..68cb74b 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.cxx @@ -228,6 +228,20 @@ CORBA::Float GHS3DPRLPlugin_Hypothesis_i::GetMaxSize() return this->GetImpl()->GetMaxSize(); } +void GHS3DPRLPlugin_Hypothesis_i::SetAdvancedOption(const char* theOptAndVals ) +{ + if ( theOptAndVals && GetImpl()->GetAdvancedOption() != theOptAndVals ) + { + GetImpl()->SetAdvancedOption( theOptAndVals ); + SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << theOptAndVals << "' )"; + } +} + +char* GHS3DPRLPlugin_Hypothesis_i::GetAdvancedOption() +{ + return CORBA::string_dup( GetImpl()->GetAdvancedOption().c_str() ); +} + //============================================================================= /*! * GHS3DPRLPlugin_Hypothesis_i::GetImpl diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx index ab8d888..c10e711 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx @@ -77,6 +77,9 @@ class GHS3DPRLPLUGIN_EXPORT GHS3DPRLPlugin_Hypothesis_i: void SetMaxSize(CORBA::Float theVal); CORBA::Float GetMaxSize(); + void SetAdvancedOption(const char* theOptAndVals ); + char* GetAdvancedOption(); + // Get implementation ::GHS3DPRLPlugin_Hypothesis* GetImpl(); diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index e308e12..cdd0250 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -49,7 +49,7 @@ SET(_link_LIBRARIES ${KERNEL_SALOMELocalTrace} ${GEOM_GEOM} ${SMESH_SMESH} - ${SMESH_GeomSelectionTools} + ${SMESH_PluginUtils} ${SMESH_StdMeshersGUI} ${SMESH_SMESHFiltersSelection} ${GUI_suit} diff --git a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx index a573172..28d533b 100755 --- a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx +++ b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx @@ -26,6 +26,7 @@ #include #include +#include #include CORBA_SERVER_HEADER(GHS3DPRLPlugin_Algorithm) @@ -35,13 +36,14 @@ #include #include +#include #include +#include #include #include #include -#include +#include #include -#include GHS3DPRLPluginGUI_HypothesisCreator::GHS3DPRLPluginGUI_HypothesisCreator( const QString& theHypType ) : SMESHGUI_GenericHypothesisCreator( theHypType ), @@ -71,7 +73,14 @@ QFrame* GHS3DPRLPluginGUI_HypothesisCreator::buildFrame() lay->setMargin( 5 ); lay->setSpacing( 0 ); - QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr ); + // tab + QTabWidget* tab = new QTabWidget( fr ); + tab->setTabShape( QTabWidget::Rounded ); + tab->setTabPosition( QTabWidget::North ); + lay->addWidget( tab ); + + // basic parameters + QWidget* GroupC1 = new QWidget(); lay->addWidget( GroupC1 ); QGridLayout* l = new QGridLayout( GroupC1 ); @@ -155,6 +164,12 @@ QFrame* GHS3DPRLPluginGUI_HypothesisCreator::buildFrame() myIs3D = true; + myAdvTable = new SMESH_AdvOptionsWdg( fr ); + + // add tabs + tab->insertTab( 0, GroupC1, tr( "SMESH_ARGUMENTS" )); + tab->insertTab( 1, myAdvTable, tr( "SMESH_ADVANCED" )); + return fr; } @@ -174,6 +189,7 @@ void GHS3DPRLPluginGUI_HypothesisCreator::retrieveParams() const myGradation->setValue( data.myGradation ); myMinSize->setValue( data.myMinSize ); myMaxSize->setValue( data.myMaxSize ); + myAdvTable->SetCustomOptions( data.myAdvOptions ); } QString GHS3DPRLPluginGUI_HypothesisCreator::storeParams() const @@ -203,17 +219,16 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DPRLHypothesis GHS3DPRLPlugin::GHS3DPRLPlugin_Hypothesis::_narrow( initParamsHypothesis() ); HypothesisData* data = SMESH::GetHypothesisData( hypType() ); - h_data.myName = isCreation() && data ? hypName() : ""; - h_data.myMEDName = h->GetMEDName(); //"DOMAIN\0"; - h_data.myNbPart = h->GetNbPart(); - h_data.myKeepFiles = h->GetKeepFiles(); - h_data.myBackground = h->GetBackground(); + h_data.myName = isCreation() && data ? hypName() : ""; + h_data.myMEDName = SMESH::toQStr( h->GetMEDName() ); //"DOMAIN\0"; + h_data.myNbPart = h->GetNbPart(); + h_data.myKeepFiles = h->GetKeepFiles(); + h_data.myBackground = h->GetBackground(); h_data.myMultithread = h->GetMultithread(); - //h_data.myToMeshHoles = h->GetToMeshHoles(); - //h_data.myToMergeSubdomains = h->GetToMergeSubdomains(); - h_data.myGradation = h->GetGradation(); - h_data.myMinSize = h->GetMinSize(); - h_data.myMaxSize = h->GetMaxSize(); + h_data.myGradation = h->GetGradation(); + h_data.myMinSize = h->GetMinSize(); + h_data.myMaxSize = h->GetMaxSize(); + h_data.myAdvOptions = SMESH::toQStr( h->GetAdvancedOption() ); return true; } @@ -229,16 +244,15 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DPRLHypot if ( isCreation() ) SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() ); - h->SetMEDName( h_data.myMEDName.toLatin1().constData() ); - h->SetNbPart( h_data.myNbPart ); - h->SetKeepFiles( h_data.myKeepFiles ); - h->SetBackground( h_data.myBackground ); - h->SetMultithread( h_data.myMultithread ); - //h->SetToMeshHoles( h_data.myToMeshHoles ); - //h->SetToMergeSubdomains( h_data.myToMergeSubdomains ); - h->SetGradation( h_data.myGradation ); - h->SetMinSize( h_data.myMinSize ); - h->SetMaxSize( h_data.myMaxSize ); + h->SetMEDName ( h_data.myMEDName.toLatin1().constData() ); + h->SetNbPart ( h_data.myNbPart ); + h->SetKeepFiles ( h_data.myKeepFiles ); + h->SetBackground ( h_data.myBackground ); + h->SetMultithread ( h_data.myMultithread ); + h->SetGradation ( h_data.myGradation ); + h->SetMinSize ( h_data.myMinSize ); + h->SetMaxSize ( h_data.myMaxSize ); + h->SetAdvancedOption( h_data.myAdvOptions.toLatin1().constData() ); } catch ( const SALOME::SALOME_Exception& ex ) { @@ -250,16 +264,15 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DPRLHypot bool GHS3DPRLPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DPRLHypothesisData& h_data ) const { - h_data.myName = myName ? myName->text() : ""; - h_data.myMEDName = myMEDName->text().simplified().replace(' ', '_'); - h_data.myNbPart = myNbPart->value(); - h_data.myKeepFiles = myKeepFiles->isChecked(); + h_data.myName = myName ? myName->text() : ""; + h_data.myMEDName = myMEDName->text().simplified().replace(' ', '_'); + h_data.myNbPart = myNbPart->value(); + h_data.myKeepFiles = myKeepFiles->isChecked(); h_data.myBackground = myBackground->isChecked(); - //h_data.myToMeshHoles = myToMeshHoles->isChecked(); - //h_data.myToMergeSubdomains = myToMergeSubdomains->isChecked(); - h_data.myGradation = myGradation->value(); - h_data.myMinSize = myMinSize->value(); - h_data.myMaxSize = myMaxSize->value(); + h_data.myGradation = myGradation->value(); + h_data.myMinSize = myMinSize->value(); + h_data.myMaxSize = myMaxSize->value(); + h_data.myAdvOptions = myAdvTable->GetCustomOptions(); return true; } diff --git a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h index 9ecef8a..fb9fef7 100755 --- a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h +++ b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h @@ -42,6 +42,7 @@ class QtxIntSpinBox; class QtxDoubleSpinBox; class QCheckBox; class QLineEdit; +class SMESH_AdvOptionsWdg; typedef struct { @@ -56,6 +57,7 @@ typedef struct float myGradation; float myMinSize; float myMaxSize; + QString myAdvOptions; } GHS3DPRLHypothesisData; /*! @@ -87,18 +89,17 @@ private: bool storeParamsToHypo( const GHS3DPRLHypothesisData& ) const; private: - QLineEdit* myName; - QLineEdit* myMEDName; - QtxIntSpinBox* myNbPart; - QCheckBox* myKeepFiles; - QCheckBox* myBackground; - QCheckBox* myMultithread; - //QCheckBox* myToMeshHoles; - //QCheckBox* myToMergeSubdomains; - QtxDoubleSpinBox* myGradation; - QtxDoubleSpinBox* myMinSize; - QtxDoubleSpinBox* myMaxSize; - bool myIs3D; + QLineEdit* myName; + QLineEdit* myMEDName; + QtxIntSpinBox* myNbPart; + QCheckBox* myKeepFiles; + QCheckBox* myBackground; + QCheckBox* myMultithread; + QtxDoubleSpinBox* myGradation; + QtxDoubleSpinBox* myMinSize; + QtxDoubleSpinBox* myMaxSize; + bool myIs3D; + SMESH_AdvOptionsWdg* myAdvTable; }; #endif // GHS3DPRLPLUGINGUI_HypothesisCreator_H