]> SALOME platform Git repositories - plugins/ghs3dplugin.git/commitdiff
Salome HOME
23307: [EDF 7315] Improvement of DISTENE meshing plugins
authoreap <eap@opencascade.com>
Tue, 9 Aug 2016 16:46:06 +0000 (19:46 +0300)
committereap <eap@opencascade.com>
Tue, 9 Aug 2016 16:46:06 +0000 (19:46 +0300)
15 files changed:
doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_meshes.png
doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_vertices.png
doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_advanced.png
doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_basic.png
doc/salome/gui/GHS3DPLUGIN/input/ghs3d_hypo.doc
idl/GHS3DPlugin_Algorithm.idl
src/GHS3DPlugin/GHS3DPluginBuilder.py
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx
src/GUI/CMakeLists.txt
src/GUI/GHS3DPluginGUI_AdvWidget.cxx
src/GUI/GHS3DPluginGUI_AdvWidget_QTD.ui
src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx

index b612ced57ae324cf6ff3496b3bc2497314ba3090..29a98b4af4a5c6ccd24ba9de7ea688ab7508a96a 100644 (file)
Binary files a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_meshes.png and b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_meshes.png differ
index 2b85f9f11ccd4fba81b9f84ca47a99ceda10a937..9c5cf7780b90b8ae0afc7e55c282f1679ce1c882 100644 (file)
Binary files a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_vertices.png and b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_vertices.png differ
index 81439d70f1b8ca11eb3e2e2a7231de2be2b54a75..4372e3cc5458cec803efcd51ff0416d00d4778b6 100644 (file)
Binary files a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_advanced.png and b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_advanced.png differ
index 08feab4c200e8363a5c9034fb21fa727cc6ec5e4..8963bd09e7a266281b0d835cf4397b971a8728bc 100644 (file)
Binary files a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_basic.png and b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_basic.png differ
index 8aa14701299fb387faacea312947f1a0d90a8f4b..9e29026dac10e829abd65a1f3ab522603530b632 100644 (file)
@@ -128,8 +128,11 @@ By default, the FEM correction is not used.
 - <b>Volumic gradation</b> - Defines the volumic ratio between 2 consecutive elements.
 WARNING: Changing the default value of this parameter may dramatically decrease the quality of the resulting mesh.
 
-- <b>Option as text</b> - allows to input in the command line any text
-for MG-Tetra, for example, advanced options.
+- A table at the page bottom allows to input in the command line any text
+for MG-Tetra, for example, advanced options. <br> 
+<b>Add option</b> - 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.
+
 
 \ref ghs3d_top "Back to top"
 
index 3f127d7327e3fbe34a5eaf9f7af509b2aee47760..f18b3ac5cc463369af973eb1ee92033936e897f0 100644 (file)
@@ -145,7 +145,9 @@ module GHS3DPlugin
     /*!
      * To set hiden/undocumented/advanced options
      */
-    void SetTextOption(in string option);
+    void SetAdvancedOption(in string option);
+    string GetAdvancedOption();
+    void SetTextOption(in string option); // obsolete
     string GetTextOption();
     /*!
      * To define the volumic gradation
index d0b96248dfbe0a22a4cd7a127c6ef2ba30dafc1b..2d1a630a33ad7b2a4792f9e20987100e542c456e 100644 (file)
@@ -260,7 +260,13 @@ class GHS3D_Algorithm(Mesh_Algorithm):
     ## Sets command line option as text.
     #  @param option command line option
     def SetTextOption(self, option):
-        self.Parameters().SetTextOption(option)
+        self.Parameters().SetAdvancedOption(option)
+        pass
+    
+    ## Sets command line option as text.
+    #  @param option command line option
+    def SetAdvancedOption(self, option):
+        self.Parameters().SetAdvancedOption(option)
         pass
     
     pass # end of GHS3D_Algorithm class
index 59d38c6e5979c96c143d72da0f7a0bd6773f9256..5f3e70d8bfff8e79e7f8482285b9ac4ca295bc30 100644 (file)
@@ -345,10 +345,10 @@ bool GHS3DPlugin_Hypothesis::GetToRemoveCentralPoint() const
 }
 
 //=======================================================================
-//function : SetTextOption
+//function : SetAdvancedOption
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis::SetTextOption(const std::string& option)
+void GHS3DPlugin_Hypothesis::SetAdvancedOption(const std::string& option)
 {
   if ( myTextOption != option ) {
     myTextOption = option;
@@ -357,10 +357,10 @@ void GHS3DPlugin_Hypothesis::SetTextOption(const std::string& option)
 }
 
 //=======================================================================
-//function : GetTextOption
+//function : GetAdvancedOption
 //=======================================================================
 
-std::string GHS3DPlugin_Hypothesis::GetTextOption() const
+std::string GHS3DPlugin_Hypothesis::GetAdvancedOption() const
 {
   return myTextOption;
 }
index 58b298649280d3a7ccc2a83a1b16d315f9129a39..06c26ffd03225e5c3bf902e9c3b6513605a09f50 100644 (file)
@@ -197,8 +197,8 @@ public:
   /*!
    * To set hiden/undocumented/advanced options
    */
-  void SetTextOption(const std::string& option);
-  std::string GetTextOption() const;
+  void SetAdvancedOption(const std::string& option);
+  std::string GetAdvancedOption() const;
   /*!
   * To define the volumic gradation
   */
index 8ea23914a72beaa45b20ee5e60daa71dfe083c29..dd3239f6c4f2d6ebb419d53f7e48aa3f60901e4e 100644 (file)
@@ -360,8 +360,8 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToRemoveCentralPoint()
 void GHS3DPlugin_Hypothesis_i::SetTextOption(const char* option)
 {
   ASSERT(myBaseImpl);
-  this->GetImpl()->SetTextOption(option);
-  SMESH::TPythonDump() << _this() << ".SetTextOption( '" << option << "' )";
+  this->GetImpl()->SetAdvancedOption(option);
+  SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << option << "' )";
 }
 
 //=======================================================================
@@ -371,7 +371,28 @@ void GHS3DPlugin_Hypothesis_i::SetTextOption(const char* option)
 char* GHS3DPlugin_Hypothesis_i::GetTextOption()
 {
   ASSERT(myBaseImpl);
-  return CORBA::string_dup( this->GetImpl()->GetTextOption().c_str() );
+  return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
+}
+
+//=======================================================================
+//function : SetAdvancedOption
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetAdvancedOption(const char* option)
+{
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetAdvancedOption(option);
+  SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << option << "' )";
+}
+
+//=======================================================================
+//function : GetAdvancedOption
+//=======================================================================
+
+char* GHS3DPlugin_Hypothesis_i::GetAdvancedOption()
+{
+  ASSERT(myBaseImpl);
+  return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
 }
 
 //=======================================================================
index 8c33eda9b558f9c43c016d78da13873aa9976fa5..d48a49d0bcfd38d48ce2268ef9d7f0a8940f44c5 100644 (file)
@@ -127,7 +127,9 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i:
   /*!
    * To set hiden/undocumented/advanced options
    */
-  void SetTextOption(const char* option);
+  void SetAdvancedOption(const char* option);
+  char* GetAdvancedOption();
+  void SetTextOption(const char* option); // obsolete
   char* GetTextOption();
   /*!
   * To define the volumic gradation
index abc4373e8a0d3790893328bfb5b4889c105ffd06..fc83f9e8962652b22572077de77a6f43fbb812bb 100644 (file)
@@ -49,7 +49,7 @@ SET(_link_LIBRARIES
   ${KERNEL_SALOMELocalTrace}
   ${GEOM_GEOM}
   ${SMESH_SMESH}
-  ${SMESH_GeomSelectionTools}
+  ${SMESH_PluginUtils}
   ${SMESH_StdMeshersGUI}
   ${SMESH_SMESHFiltersSelection}
   ${GUI_suit}
index 84af0a809f8a40cba8a46b8d669310114823d1d5..6b4de5c9305ba7cd8bc900ebd9c316e9706a2170 100644 (file)
@@ -38,6 +38,7 @@ GHS3DPluginGUI_AdvWidget::GHS3DPluginGUI_AdvWidget( QWidget* parent, Qt::WindowF
 : QWidget( parent, f )
 {
   setupUi( this );
+  advOptionTable->layout()->setMargin( 0 );
 }
 
 GHS3DPluginGUI_AdvWidget::~GHS3DPluginGUI_AdvWidget()
index 5754262d19922ea9d23c53a13a3ddd907dc7bdc4..6d1ab70739564dbd1f97b22bcfc56c6ac1677cef 100644 (file)
@@ -65,7 +65,7 @@
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
-        <property name="maximum">
+        <property name="maximum" stdset="0">
          <number>999999999</number>
         </property>
        </widget>
@@ -78,7 +78,7 @@
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
-        <property name="maximum">
+        <property name="maximum" stdset="0">
          <number>999999999</number>
         </property>
        </widget>
       <string>Advanced meshing options</string>
      </property>
      <layout class="QGridLayout" name="gridLayout_4">
-      <item row="7" column="1">
-       <widget class="QLineEdit" name="textOptionLineEdit"/>
-      </item>
-      <item row="6" column="0">
-       <widget class="QLabel" name="gradationLabel">
+      <item row="1" column="1">
+       <widget class="QCheckBox" name="FEMCorrectionCheck">
         <property name="text">
-         <string>Volumic gradation</string>
+         <string>Use FEM correction</string>
         </property>
        </widget>
       </item>
-      <item row="7" column="0">
-       <widget class="QLabel" name="textOptionLabel">
+      <item row="1" column="0">
+       <widget class="QCheckBox" name="removeInitialCentralPointCheck">
         <property name="text">
-         <string>Option as text</string>
+         <string>Remove initial central point</string>
         </property>
        </widget>
       </item>
       <item row="6" column="1">
        <widget class="SMESHGUI_SpinBox" name="gradationSpinBox"/>
       </item>
-      <item row="0" column="0">
-       <widget class="QCheckBox" name="createNewNodesCheck">
-        <property name="text">
-         <string>Create new nodes</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0">
-       <widget class="QCheckBox" name="removeInitialCentralPointCheck">
+      <item row="6" column="0">
+       <widget class="QLabel" name="gradationLabel">
         <property name="text">
-         <string>Remove initial central point</string>
+         <string>Volumic gradation</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="1">
-       <widget class="QCheckBox" name="FEMCorrectionCheck">
+      <item row="0" column="0">
+       <widget class="QCheckBox" name="createNewNodesCheck">
         <property name="text">
-         <string>Use FEM correction</string>
+         <string>Create new nodes</string>
         </property>
        </widget>
       </item>
         </property>
        </widget>
       </item>
+      <item row="7" column="0" colspan="2">
+       <widget class="SMESH_AdvOptionsWdg" name="advOptionTable" native="true"/>
+      </item>
      </layout>
     </widget>
    </item>
  <customwidgets>
   <customwidget>
    <class>SMESHGUI_SpinBox</class>
-   <extends>QSpinBox</extends>
-   <header>SMESHGUI_SpinBox.h</header>
+   <extends>QDoubleSpinBox</extends>
+   <header location="global">SMESHGUI_SpinBox.h</header>
   </customwidget>
   <customwidget>
    <class>SalomeApp_IntSpinBox</class>
-   <extends>QSpinBox</extends>
-   <header>SalomeApp_IntSpinBox.h</header>
+   <extends>QLineEdit</extends>
+   <header location="global">SalomeApp_IntSpinBox.h</header>
+  </customwidget>
+  <customwidget>
+   <class>SMESH_AdvOptionsWdg</class>
+   <extends>QWidget</extends>
+   <header location="global">SMESH_AdvOptionsWdg.h</header>
+   <container>1</container>
   </customwidget>
  </customwidgets>
  <resources/>
index ac5b1cabd2aeaf720fcaec4e33ae350c92b53c91..f66769ed7201f7d0eeae8bf4563faa3954814e43 100644 (file)
 
 #include <boost/algorithm/string.hpp>
 
-namespace {
-
-#ifdef WIN32
-#include <windows.h>
-#else
-#include <sys/sysinfo.h>
-#endif
-
-  long maxAvailableMemory()
-  {
-#ifdef WIN32
-    // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
-    MEMORYSTATUSEX statex;
-    statex.dwLength = sizeof (statex);
-    long err = GlobalMemoryStatusEx (&statex);
-    if (err != 0) {
-      long totMB = 
-        statex.ullTotalPhys / 1024 / 1024 +
-        statex.ullTotalPageFile / 1024 / 1024 +
-        statex.ullTotalVirtual / 1024 / 1024;
-      return (long) ( 0.7 * totMB );
-    }
-#else
-    struct sysinfo si;
-    long err = sysinfo( &si );
-    if ( err == 0 ) {
-      long totMB =
-        si.totalram * si.mem_unit / 1024 / 1024 +
-        si.totalswap * si.mem_unit / 1024 / 1024 ;
-      return (long) ( 0.7 * totMB );
-    }
-#endif
-    return 0;
-  }
-}
-
 //
 // BEGIN EnforcedVertexTableWidgetDelegate
 //
@@ -442,7 +406,6 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   myAdvWidget->FEMCorrectionCheck            ->setText (tr( "FEM_CORRECTION" ));
   myAdvWidget->gradationLabel                ->setText (tr( "GHS3D_GRADATION" ));
   myAdvWidget->gradationSpinBox->RangeStepAndValidator(0.0, 5.0, 0.05, "length_precision");
-  myAdvWidget->textOptionLabel->setText(tr( "TEXT_OPTION" ));
 
   // Enforced vertices parameters
   myEnfGroup = new QWidget();
@@ -1443,7 +1406,7 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
   myAdvWidget->boundaryRecoveryCheck          ->setChecked    ( data.myBoundaryRecovery );
   myAdvWidget->FEMCorrectionCheck             ->setChecked    ( data.myFEMCorrection );
   myAdvWidget->gradationSpinBox               ->setValue      ( data.myGradation );
-  myAdvWidget->textOptionLineEdit             ->setText       ( data.myTextOption );
+  myAdvWidget->advOptionTable                 ->SetCustomOptions( data.myTextOption );
   myAdvWidget->logInFileCheck                 ->setChecked    ( !data.myLogInStandardOutput );
   myAdvWidget->removeLogOnSuccessCheck        ->setChecked    ( data.myRemoveLogOnSuccess );
 
@@ -1687,14 +1650,14 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData&
   h_data.myBoundaryRecovery           = h->GetToUseBoundaryRecoveryVersion();
   h_data.myFEMCorrection              = h->GetFEMCorrection();
   h_data.myGradation                  = h->GetGradation();
-  h_data.myTextOption                 = h->GetTextOption();
+  h_data.myTextOption                 = h->GetAdvancedOption();
   h_data.myLogInStandardOutput        = h->GetStandardOutputLog();
   h_data.myRemoveLogOnSuccess         = h->GetRemoveLogOnSuccess();
   
   GHS3DPlugin::GHS3DEnforcedVertexList_var vertices = h->GetEnforcedVertices();
   MESSAGE("vertices->length(): " << vertices->length());
   h_data.myEnforcedVertices.clear();
-  for (int i=0 ; i<vertices->length() ; i++) {
+  for (CORBA::ULong i=0 ; i<vertices->length() ; i++) {
     TEnfVertex* myVertex = new TEnfVertex();
     myVertex->name = CORBA::string_dup(vertices[i].name.in());
     myVertex->geomEntry = CORBA::string_dup(vertices[i].geomEntry.in());
@@ -1702,7 +1665,7 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData&
     myVertex->size = vertices[i].size;
     myVertex->isCompound = vertices[i].isCompound;
     if (vertices[i].coords.length()) {
-      for (int c = 0; c < vertices[i].coords.length() ; c++)
+      for (CORBA::ULong c = 0; c < vertices[i].coords.length() ; c++)
         myVertex->coords.push_back(vertices[i].coords[c]);
       MESSAGE("Add enforced vertex ("<< myVertex->coords.at(0) << ","<< myVertex->coords.at(1) << ","<< myVertex->coords.at(2) << ") ="<< myVertex->size);
     }
@@ -1712,7 +1675,7 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData&
   GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshes = h->GetEnforcedMeshes();
   MESSAGE("enfMeshes->length(): " << enfMeshes->length());
   h_data.myEnforcedMeshes.clear();
-  for (int i=0 ; i<enfMeshes->length() ; i++) {
+  for (CORBA::ULong i=0 ; i<enfMeshes->length() ; i++) {
     TEnfMesh* myEnfMesh = new TEnfMesh();
     myEnfMesh->name = CORBA::string_dup(enfMeshes[i].name.in());
     myEnfMesh->entry = CORBA::string_dup(enfMeshes[i].entry.in());
@@ -1776,8 +1739,8 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD
       h->SetFEMCorrection    ( h_data.myFEMCorrection     );
     if ( h->GetGradation() != h_data.myGradation         )
       h->SetGradation        ( h_data.myGradation         );
-    if ( h->GetTextOption() != h_data.myTextOption       )
-      h->SetTextOption       ( h_data.myTextOption.toLatin1().constData() );
+    if ( h->GetAdvancedOption() != h_data.myTextOption       )
+      h->SetAdvancedOption       ( h_data.myTextOption.toLatin1().constData() );
     if ( h->GetStandardOutputLog() != h_data.myLogInStandardOutput   )
       h->SetStandardOutputLog( h_data.myLogInStandardOutput  );
      if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess   )
@@ -1881,7 +1844,7 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisDat
   h_data.myBoundaryRecovery           = myAdvWidget->boundaryRecoveryCheck->isChecked();
   h_data.myFEMCorrection              = myAdvWidget->FEMCorrectionCheck->isChecked();
   h_data.myGradation                  = myAdvWidget->gradationSpinBox->value();
-  h_data.myTextOption                 = myAdvWidget->textOptionLineEdit->text();
+  h_data.myTextOption                 = myAdvWidget->advOptionTable->GetCustomOptions();
   h_data.myLogInStandardOutput        = !myAdvWidget->logInFileCheck->isChecked();
   h_data.myRemoveLogOnSuccess         = myAdvWidget->removeLogOnSuccessCheck->isChecked();