From: eap Date: Tue, 9 Aug 2016 16:41:01 +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=297850bfc64f55e8a9ae9770a9ed3d9db9fe6630;p=plugins%2Fhexoticplugin.git 23307: [EDF 7315] Improvement of DISTENE meshing plugins --- diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_advanced_options.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_advanced_options.png new file mode 100644 index 0000000..79bd05b Binary files /dev/null and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_advanced_options.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_local_size_parameters.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_local_size_parameters.png index 5cf1043..84c2a05 100644 Binary files a/doc/salome/gui/HexoticPLUGIN/images/hexotic_local_size_parameters.png and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_local_size_parameters.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png index 6f5e126..1bd2539 100644 Binary files a/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_vl_parameters.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_vl_parameters.png index 16099a8..45574bf 100644 Binary files a/doc/salome/gui/HexoticPLUGIN/images/hexotic_vl_parameters.png and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_vl_parameters.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc b/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc index a5897f3..ab29eb8 100644 --- a/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc +++ b/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc @@ -51,9 +51,6 @@ Parameters by default).
  • sd 4 : meshes non-manifold geometries as such and generates subdomains accordingly.
  • - -
  • Options as text - allows to input in the command line any text for MG-Hexa, for example, advanced options. -
  • \note If MG-CADSurf is used as 2D algo, and if a GMF file is defined as output file (using SetGMFFile(my2Dmesh.mesh)), then MG-Hexa will use this file as input. @@ -61,6 +58,15 @@ This allows to avoid the reconstruction of the GMF file from the SMESH structure
    See Also a sample TUI Script of the \ref tui_hexotic "creation of a MG-Hexa mesh" +\section hexotic_adv_options Advanced parameters + +\image html hexotic_advanced_options.png + +In \b Advanced tab page you can specify advanced options of MG-Hexa not exposed in other pages. + +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. + \section hexotic_local_size_parameters Local size The local size allows you to drive locally the density of the 3D mesh. diff --git a/idl/HexoticPlugin_Algorithm.idl b/idl/HexoticPlugin_Algorithm.idl index 3a2ea29..c2b1127 100644 --- a/idl/HexoticPlugin_Algorithm.idl +++ b/idl/HexoticPlugin_Algorithm.idl @@ -92,7 +92,9 @@ module HexoticPlugin void SetHexoticMaxMemory(in long value); long GetHexoticMaxMemory(); - void SetTextOptions(in string option); + void SetAdvancedOption(in string option); + string GetAdvancedOption(); + void SetTextOptions(in string option);// obsolete string GetTextOptions(); void SetSizeMapEntry(in string entry, diff --git a/src/GUI/CMakeLists.txt b/src/GUI/CMakeLists.txt index d1eb103..c9d56b3 100644 --- a/src/GUI/CMakeLists.txt +++ b/src/GUI/CMakeLists.txt @@ -51,6 +51,7 @@ ADD_DEFINITIONS( SET(_link_LIBRARIES ${SMESH_SMESH} ${SMESH_StdMeshersGUI} + ${SMESH_PluginUtils} ${CAS_KERNEL} ${GUI_suit} ${GUI_qtx} diff --git a/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx b/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx index 9dbc465..be6ab02 100644 --- a/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx @@ -27,7 +27,8 @@ #include #include -#include "SMESH_NumberFilter.hxx" +#include +#include #include "utilities.h" @@ -58,6 +59,7 @@ // Main widget tabs identification enum { STD_TAB = 0, + ADV_TAB, SMP_TAB, VL_TAB }; @@ -202,6 +204,7 @@ QFrame* HexoticPluginGUI_HypothesisCreator::buildFrame() l->addWidget( myStdWidget, row++, 0, 1, 3 ); myStdWidget->onSdModeSelected(SD_MODE_4); + myAdvWidget = new SMESH_AdvOptionsWdg( aTabWidget ); // SIZE MAPS TAB QWidget* aSmpGroup = new QWidget(); @@ -277,9 +280,10 @@ QFrame* HexoticPluginGUI_HypothesisCreator::buildFrame() // resizeEvent(); - aTabWidget->insertTab( STD_TAB, aStdGroup, tr( "SMESH_ARGUMENTS" ) ); - aTabWidget->insertTab( SMP_TAB, aSmpGroup, tr( "LOCAL_SIZE" ) ); - aTabWidget->insertTab( VL_TAB, aVLGroup, tr( "Hexotic_VISCOUS_LAYERS") ); + aTabWidget->insertTab( STD_TAB, aStdGroup, tr( "SMESH_ARGUMENTS" )); + aTabWidget->insertTab( ADV_TAB, myAdvWidget, tr( "SMESH_ADVANCED" )); + aTabWidget->insertTab( SMP_TAB, aSmpGroup, tr( "LOCAL_SIZE" )); + aTabWidget->insertTab( VL_TAB, aVLGroup, tr( "Hexotic_VISCOUS_LAYERS")); myIs3D = true; @@ -452,7 +456,7 @@ void HexoticPluginGUI_HypothesisCreator::retrieveParams() const myStdWidget->myHexoticSdMode->setCurrentIndex(data.myHexoticSdMode); - myStdWidget->myTextOptions->setText(data.myTextOptions); + myAdvWidget->SetCustomOptions(data.myTextOptions); HexoticPlugin_Hypothesis::THexoticSizeMaps::const_iterator it = data.mySizeMaps.begin(); for ( int row = 0; it != data.mySizeMaps.end(); it++, row++ ) @@ -577,7 +581,7 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromHypo( HexoticHypothesisDa h_data.myHexoticVerbosity = h->GetHexoticVerbosity(); h_data.myHexoticMaxMemory = h->GetHexoticMaxMemory(); h_data.myHexoticSdMode = h->GetHexoticSdMode()-1; - h_data.myTextOptions = h->GetTextOptions(); + h_data.myTextOptions = h->GetAdvancedOption(); // Size maps HexoticPlugin::HexoticPluginSizeMapsList_var sizeMaps = h->GetSizeMaps(); @@ -629,7 +633,7 @@ bool HexoticPluginGUI_HypothesisCreator::storeParamsToHypo( const HexoticHypothe h->SetHexoticVerbosity( h_data.myHexoticVerbosity ); h->SetHexoticMaxMemory( h_data.myHexoticMaxMemory ); h->SetHexoticSdMode( h_data.myHexoticSdMode+1 ); - h->SetTextOptions( h_data.myTextOptions.toLatin1().constData() ); + h->SetAdvancedOption( h_data.myTextOptions.toLatin1().constData() ); HexoticPlugin_Hypothesis::THexoticSizeMaps::const_iterator it; @@ -685,7 +689,7 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromWidgets( HexoticHypothesi h_data.myHexoticVerbosity = myStdWidget->myHexoticVerbosity->value(); h_data.myHexoticMaxMemory = myStdWidget->myHexoticMaxMemory->value(); h_data.myHexoticSdMode = myStdWidget->myHexoticSdMode->currentIndex(); - h_data.myTextOptions = myStdWidget->myTextOptions->text(); + h_data.myTextOptions = myAdvWidget->GetCustomOptions(); h_data.myMinSize = myStdWidget->myMinSize->text().isEmpty() ? 0.0 : myStdWidget->myMinSize->value(); h_data.myMaxSize = myStdWidget->myMaxSize->text().isEmpty() ? 0.0 : myStdWidget->myMaxSize->value(); diff --git a/src/GUI/HexoticPluginGUI_HypothesisCreator.h b/src/GUI/HexoticPluginGUI_HypothesisCreator.h index b94bcd6..f8164e5 100644 --- a/src/GUI/HexoticPluginGUI_HypothesisCreator.h +++ b/src/GUI/HexoticPluginGUI_HypothesisCreator.h @@ -41,6 +41,7 @@ class QTableWidgetItem; class HexoticPluginGUI_StdWidget; class HexoticPluginGUI_SizeMapsWidget; class HexoticPluginGUI_ViscousLayersWidget; +class SMESH_AdvOptionsWdg; typedef struct { @@ -101,9 +102,10 @@ private: private: -// QWidget* myStdGroup; - QLineEdit* myName; - HexoticPluginGUI_StdWidget* myStdWidget; +// QWidget* myStdGroup; + QLineEdit* myName; + HexoticPluginGUI_StdWidget* myStdWidget; + SMESH_AdvOptionsWdg* myAdvWidget; HexoticPluginGUI_SizeMapsWidget* mySmpWidget; HexoticPluginGUI_ViscousLayersWidget* myVLWidget; StdMeshersGUI_ObjectReferenceParamWdg* myGeomSelWdg; diff --git a/src/GUI/HexoticPluginGUI_StdWidget_QTD.ui b/src/GUI/HexoticPluginGUI_StdWidget_QTD.ui index e6c40b9..2ee4018 100644 --- a/src/GUI/HexoticPluginGUI_StdWidget_QTD.ui +++ b/src/GUI/HexoticPluginGUI_StdWidget_QTD.ui @@ -11,9 +11,38 @@ - + 0 + + 0 + + + 0 + + + 0 + + + + + Hexotic_SHARP_ANGLE_THRESHOLD + + + + + + + 99999 + + + 128 + + + 2048 + + + @@ -43,6 +72,50 @@ + + + + Hexotic_MAX_MEMORY + + + + + + + Hexotic_WORKING_DIR + + + + + + + + 0 + 0 + + + + Hexotic_SELECT_DIR + + + + + + + Hexotic_INVALID_ELEMENTS + + + + + + + 2 + + + 1 + + + @@ -72,73 +145,29 @@ - - - - Hexotic_IGNORE_RIDGES - - - - - - - Hexotic_SHARP_ANGLE_THRESHOLD - - - - - - - Hexotic_NB_PROC - - - - - + + - Hexotic_WORKING_DIR + Hexotic_IGNORE_RIDGES - - - - - 0 - 0 - - + + - Hexotic_SELECT_DIR + Hexotic_NB_PROC - - - - Hexotic_VERBOSITY - - - - - - - 2 - - - 1 - - - @@ -200,52 +229,10 @@ - - - - Hexotic_ADVANCED - - - - 6 - - - - - Hexotic_TEXT_OPTIONS - - - - - - - - - - - - - Hexotic_INVALID_ELEMENTS - - - - - + + - Hexotic_MAX_MEMORY - - - - - - - 99999 - - - 128 - - - 2048 + Hexotic_VERBOSITY diff --git a/src/HexoticPlugin/HexoticPLUGINBuilder.py b/src/HexoticPlugin/HexoticPLUGINBuilder.py index 8794c8d..7fd42ce 100644 --- a/src/HexoticPlugin/HexoticPLUGINBuilder.py +++ b/src/HexoticPlugin/HexoticPLUGINBuilder.py @@ -112,6 +112,13 @@ class Hexotic_Algorithm(Mesh_Algorithm): self.Parameters().UnsetSizeMap(theObject) return self.Parameters() + ## Set values of advanced options + # @param theOptions string in a form "option_1 v1 option_2 v2" + def SetAdvancedOption(self, theOptions): + self.Parameters().SetAdvancedOption(theOptions) + def GetAdvancedOption(self): + return self.Parameters().GetAdvancedOption() + ## (OBSOLETE) Defines "MinMaxQuad" hypothesis to give three MG-Hexa parameters # @param min minimal level of recursive partitioning on the initial octree cube # @param max maximal level of recursive partitioning on the initial octree cube diff --git a/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx b/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx index 111ef22..96a09d0 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx @@ -513,9 +513,9 @@ static bool readResult(std::string theFile, case 4: { // "Edges" nodeDim = 2; aHexoticElement = theMesh->AddEdge( node[0], node[1] ); - int iNode = 1; - if ( nodeAssigne[ nodeID[0] ] == 0 || nodeAssigne[ nodeID[0] ] == 2 ) - iNode = 0; + // int iNode = 1; + // if ( nodeAssigne[ nodeID[0] ] == 0 || nodeAssigne[ nodeID[0] ] == 2 ) + // iNode = 0; shapeID = dummy; break; } @@ -795,7 +795,7 @@ void HexoticPlugin_Hexotic::SetParameters(const HexoticPlugin_Hypothesis* hyp) { _hexoticVerbosity = hyp->GetHexoticVerbosity(); _hexoticMaxMemory = hyp->GetHexoticMaxMemory(); _hexoticSdMode = hyp->GetHexoticSdMode(); - _textOptions = hyp->GetTextOptions(); + _textOptions = hyp->GetAdvancedOption(); _sizeMaps = hyp->GetSizeMaps(); _nbLayers = hyp->GetNbLayers(); _firstLayerSize = hyp->GetFirstLayerSize(); diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx index 1842d64..2891afd 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx @@ -162,6 +162,13 @@ void HexoticPlugin_Hypothesis::SetHexoticMaxMemory(int theVal) { } } +void HexoticPlugin_Hypothesis::SetAdvancedOption(const std::string& theOptions) +{ + if (_textOptions != theOptions ) { + _textOptions = theOptions; + NotifySubMeshesHypothesisModification(); + } +} void HexoticPlugin_Hypothesis::SetTextOptions(const std::string& theOptions) { if (_textOptions != theOptions ) { @@ -278,8 +285,9 @@ std::ostream& HexoticPlugin_Hypothesis::SaveTo(std::ostream& save) save<<"hexoticSdMode="<<_hexoticSdMode<<";"; save<<"hexoticVerbosity="<<_hexoticVerbosity<<";"; save<<"hexoticMaxMemory="<<_hexoticMaxMemory<<";"; - replace(_textOptions.begin(), _textOptions.end(), ' ', '*'); - save<<"textOptions="<<_textOptions<<";"; + std::string textOptions = _textOptions; // save _textOptions + replace(textOptions.begin(), textOptions.end(), ' ', '*'); + save<<"textOptions="<GetImpl()->SetTextOptions(theOptions); + std::string oldValue(GetAdvancedOption()); + this->GetImpl()->SetAdvancedOption(theOptions); if (theOptions != oldValue) - SMESH::TPythonDump() << _this() << ".SetTextOptions( '" << theOptions << "' )"; + SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << theOptions << "' )"; +} + +void HexoticPlugin_Hypothesis_i::SetAdvancedOption(const char* theOptions) +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::SetAdvancedOption"); + ASSERT(myBaseImpl); + std::string oldValue(GetAdvancedOption()); + this->GetImpl()->SetAdvancedOption(theOptions); + if (theOptions != oldValue) + SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << theOptions << "' )"; } HexoticPlugin::HexoticPluginSizeMapsList* HexoticPlugin_Hypothesis_i::GetSizeMaps () @@ -454,11 +464,17 @@ CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory() return this->GetImpl()->GetHexoticMaxMemory(); } +char* HexoticPlugin_Hypothesis_i::GetAdvancedOption() +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetAdvancedOption"); + ASSERT(myBaseImpl); + return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() ); +} char* HexoticPlugin_Hypothesis_i::GetTextOptions() { // MESSAGE("HexoticPlugin_Hypothesis_i::GetTextOptions"); ASSERT(myBaseImpl); - return CORBA::string_dup( this->GetImpl()->GetTextOptions().c_str() ); + return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() ); } CORBA::Long HexoticPlugin_Hypothesis_i::GetNbLayers() diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx index 0b8f412..cd62558 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx @@ -84,7 +84,9 @@ class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hypothesis_i: void SetHexoticMaxMemory(CORBA::Long theVal); CORBA::Long GetHexoticMaxMemory(); - void SetTextOptions(const char* theOptions); + void SetAdvancedOption(const char* theOptions); + char* GetAdvancedOption(); + void SetTextOptions(const char* theOptions); // obsolete char* GetTextOptions(); void SetSizeMapEntry(const char* theEntry, CORBA::Double theSize);