Salome HOME
bos #32737 Allow to choose between MG-Tetra and MG-Tetra_HPC multithread cce/32737_proposal_squashed_rebased
authorcconopoima <cesar.conopoima@gmail.com>
Fri, 24 Mar 2023 18:07:46 +0000 (15:07 -0300)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Fri, 21 Apr 2023 08:17:03 +0000 (10:17 +0200)
Update documentation to reflect availability of MGTetra HPC optionalities.

Doc improvement. Define new Set... methods in GHS3DPluginBuilder.py

Update methods SaveTo and LoadFrom to include new hypothesis options. Solve problems observed with hdf dumped files.

Fixing issues pointed. Eliminate reference to MG_TetraHPC_API class since it is not be used. Fix typo when MGTetra HPC (parallel_mode is parallel_strategy). Reuse the same command line for MGTetra and MGTetraHPC changing the called executable depending on the user selection. Define ghs3dSetParametersDemo.py as test folling suggested instructions.

Solving more issues. Carefull var init in constructor to avoid compilation warnings. Diasable EnforcedVertice and EnforceMesh widget when MGTetraHPC is selected. Avoid ref to non initialized class member on call to CommandToRun static method.

Fixing CmakeLists in examples to properly copy the test from python example file into the SALOME_TEST_INSTALLDIR. Add missing CTestTestfileInstall.cmake file as suggested.

Set reproducible_given_max_number_of_thread as default for MGTetraHPC and safe by default for MG-Tetra.

Set Maximal number of threads to true as default on the hypothesis.

24 files changed:
CMakeLists.txt
doc/salome/examples/CMakeLists.txt
doc/salome/examples/CTestTestfileInstall.cmake [new file with mode: 0644]
doc/salome/examples/examples.set [new file with mode: 0644]
doc/salome/examples/ghs3dSetParametersDemo.py [new file with mode: 0644]
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
doc/salome/gui/GHS3DPLUGIN/input/index.doc
idl/GHS3DPlugin_Algorithm.idl
src/GHS3DPlugin/GHS3DPluginBuilder.py
src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx
src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx
src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis.cxx
src/GUI/GHS3DPluginGUI_AdvWidget.cxx
src/GUI/GHS3DPluginGUI_Dlg.h
src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx
src/GUI/GHS3DPluginGUI_HypothesisCreator.h
src/GUI/GHS3DPlugin_msg_en.ts
src/GUI/GHS3DPlugin_msg_fr.ts

index 4683a3081b6ef10f6e32138204cba2e773fdc47c..376548c4b287a5c6a2f09d1bf3ea5a8fb4458557 100644 (file)
@@ -195,12 +195,14 @@ SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME
 SET(SALOME_GHS3DPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/ghs3dplugin" CACHE PATH 
     "Install path: SALOME GHS3DPLUGIN specific data")
 
+SET(SALOME_GHS3DPLUGIN_INSTALL_TESTS "${SALOME_INSTALL_BINS}/test")
+
 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS  SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
-MARK_AS_ADVANCED(SALOME_GHS3DPLUGIN_INSTALL_RES_DATA)
+MARK_AS_ADVANCED(SALOME_GHS3DPLUGIN_INSTALL_RES_DATA SALOME_GHS3DPLUGIN_INSTALL_TESTS)
 
 # Accumulate environment variables for GHS3DPLUGIN module
 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
index edf8555bf363fca2c1748cd15000d6ffe3e41a61..ab22a12d02e0bba93135241ff2d0319f6ed9e64b 100644 (file)
 #
 
 FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
-INSTALL(FILES ${files} DESTINATION ${SALOME_INSTALL_DOC}/examples/GHS3DPLUGIN)
+INCLUDE(examples.set)
+
+SET(COMPONENT_NAME GHS3DPLUGIN)
+
+SET(TEST_INSTALL_DIRECTORY ${SALOME_GHS3DPLUGIN_INSTALL_TESTS})
+
+# make test
+SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
+
+FOREACH(tfile ${EXAMPLE_NAMES})
+  SET(TEST_NAME ${COMPONENT_NAME}_${tfile})
+  ADD_TEST(NAME ${TEST_NAME}
+           COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py)           
+  SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}")
+  SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+  MESSAGE( ${SALOME_INSTALL_DOC})
+  INSTALL(FILES ${tfile}.py DESTINATION ${SALOME_INSTALL_DOC}/examples/GHS3DPLUGIN)
+ENDFOREACH()
+
+# salome test
+FOREACH(tfile ${EXAMPLE_NAMES})
+  INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py
+          DESTINATION ${TEST_INSTALL_DIRECTORY})
+ENDFOREACH()
+
+INSTALL(FILES CTestTestfileInstall.cmake
+  DESTINATION ${TEST_INSTALL_DIRECTORY}
+  RENAME CTestTestfile.cmake)
+
+INSTALL(FILES examples.set DESTINATION ${TEST_INSTALL_DIRECTORY})
\ No newline at end of file
diff --git a/doc/salome/examples/CTestTestfileInstall.cmake b/doc/salome/examples/CTestTestfileInstall.cmake
new file mode 100644 (file)
index 0000000..0e36b3f
--- /dev/null
@@ -0,0 +1,31 @@
+# Copyright (C) 2016-2022  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
+#
+
+INCLUDE(examples.set)
+
+SET(COMPONENT_NAME GHS3DPLUGIN)
+SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/python_test_driver.py")
+SET(TIMEOUT        300)
+
+
+FOREACH(tfile ${EXAMPLE_NAMES})
+  SET(TEST_NAME ${COMPONENT_NAME}_${tfile})
+  ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile}.py)
+  SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDFOREACH()
diff --git a/doc/salome/examples/examples.set b/doc/salome/examples/examples.set
new file mode 100644 (file)
index 0000000..11f137d
--- /dev/null
@@ -0,0 +1,22 @@
+# Copyright (C) 2016-2022  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
+#
+
+SET(EXAMPLE_NAMES
+  ghs3dSetParametersDemo
+)
\ No newline at end of file
diff --git a/doc/salome/examples/ghs3dSetParametersDemo.py b/doc/salome/examples/ghs3dSetParametersDemo.py
new file mode 100644 (file)
index 0000000..b2c6f4c
--- /dev/null
@@ -0,0 +1,49 @@
+import unittest
+
+import salome
+salome.salome_init()
+
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+from salome.smesh import smeshBuilder
+smesh =  smeshBuilder.New()
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
+geompy.addToStudy(box, "box")
+
+# create a mesh on the box
+mgtetraMesh = smesh.Mesh(box,"box: MG-Tetra and NETGEN_1D_2D mesh")
+
+# create a NETGEN1D2D algorithm for faces and vertices
+NETGEN_1D_2D   = mgtetraMesh.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+NETGEN_2D_Parameters_1 = NETGEN_1D_2D.Parameters()
+MG_Tetra       = mgtetraMesh.Tetrahedron(algo=smeshBuilder.MG_Tetra)
+MG_Tetra_Parameters_1 = MG_Tetra.Parameters()
+MG_Tetra_Parameters_1.SetAlgorithm( 1 )         # 1 MGTetra (Default) - 0 MGTetra HPC
+MG_Tetra_Parameters_1.SetUseNumOfThreads( 1 )   # 1 true - 0 false
+MG_Tetra_Parameters_1.SetNumOfThreads( 6 )      # Number of threads
+MG_Tetra_Parameters_1.SetPthreadMode( 1 )       # 0 - none, 1 - aggressive, 2 - safe
+
+# compute the mesh with MGTetra
+status = mgtetraMesh.Compute()
+assert( status )
+
+mgtetraHPCMesh       = smesh.Mesh(box,"box: MG-Tetra HPC and NETGEN_1D_2D mesh")
+status               = mgtetraHPCMesh.AddHypothesis(NETGEN_2D_Parameters_1)
+NETGEN_1D_2D_1       = mgtetraHPCMesh.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+MG_Tetra_1           = mgtetraHPCMesh.Tetrahedron(algo=smeshBuilder.MG_Tetra)
+MG_Tetra_Parameters_2 = MG_Tetra_1.Parameters()
+MG_Tetra_Parameters_2.SetAlgorithm( 0 )         # 1 MGTetra (Default) - 0 MGTetra HPC
+MG_Tetra_Parameters_2.SetUseNumOfThreads( 1 )   # 1 true - 0 false
+MG_Tetra_Parameters_2.SetNumOfThreads( 6 )      # Number of threads
+MG_Tetra_Parameters_2.SetParallelMode( 1 )      # 0 - none, 1 - reproducible_given_max_num_of_threads, 2 - reproducible, 3 - aggressive
+
+# compute the mesh  with MGTetra HPC
+status = mgtetraHPCMesh.Compute()
+assert( status )
+
+
+# End of script
+
index a0bca6ada0636b84e2c24f4269055c1850a58092..e28fdb2fc313fdf53238efbeeddcebe45396051b 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 3ecb4f2c4c8321af4e8d2c9c8342e8ad5ac848c3..c29c3bee5133a53a859ff70a7bb94f200aae6e21 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 af2ab1915948d988c9c7460a27cff458b0f9e95b..d66b2f88420dbda3ad081b4e66447d4ad8d4781b 100644 (file)
@@ -17,6 +17,8 @@ To get a license, visit http://www.meshgems.com/meshgems-products.html
 - <b>Name</b> - allows to define the name of the hypothesis (MG-Tetra
 Parameters by default).
 
+- <b>Algorithm Selection</b> - allows to select the version of MG-Tetra algorithm to be used.
+
 - <b>Optimization level</b> - allows choosing the required
 optimization level (higher level of optimization provides better mesh,
 but can be time-consuming):
@@ -27,7 +29,7 @@ but can be time-consuming):
 
   - medium (standard)
 
-  - standard+
+  - standard+ (not available whem MG-Tetra HPC is selected)
 
   - strong
 
@@ -35,6 +37,22 @@ but can be time-consuming):
 
 - <b>Maximal size</b> - sets the maximum edge size in the generated mesh.
 
+- <b>Maximal number of threads</b> - define the maximal number of threads to be used by the meshing algorithm. 
+                                      On selection of this box the Pthread mode is activated when MG-Tetra is selected and 
+                                      Parallel mode is activated if the MG-Tetra HPC algorithm is selected.
+
+- <b>Pthread mode</b> - define the parallel strategy used by the mesher when MG-Tetra is selected.
+  - none
+  - aggresive - is faster than the sequential mode, but the quality of the resulting mesh may altered compared to the sequential mode.
+  - safe - is slower than the sequential mode, but the quality of the mesh can only improve;
+
+- <b>Paralle strategy (HPC)</b> - define the parallel strategy used by the mesher when MG-Tetra HPC is selected.
+  - none
+  - reproducible_given_max_number_of_threads
+  - reproducible
+  - aggressive
+
+
 - <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.
@@ -58,7 +76,7 @@ domain.<br>
 
 \image html ghs3d_parameters_advanced.png
 
-\subsection advanced_meshing_options Advanced meshing options
+\subsection advanced_meshing_options Advanced meshing options for MG-Tetra algorithm
 
 Advanced page tab expose mostly useful advanced options. Initially,
 default values of the options are displayed and they are not
@@ -130,10 +148,6 @@ option will be erased upon pressing \a Ok.
   to a given maximum number of errors. At least 1 error is printed and
   at most 100 errors are printed to prevent infinite loops.
 
-- <b>Maximal number of threads</b> - This allows to set the maximal
-  number of threads the software can use in parallel for the
-  multi-threading optimization mode.
-
 - <b>No central point</b> - <b>yes</b> prevents adding an internal point at the
    centre of gravity of the bounding box that MeshGems-Tetra uses by
    default in order to speed up and to simplify the meshing
@@ -151,17 +165,6 @@ option will be erased upon pressing \a Ok.
 - <b>Optimise worst elements</b> - Applies an optimization processing
   to improve the worst quality elements whenever possible. 
 
-- <b>Mode of pthreads</b> - This option sets the optimization mode
-  when using multithread capabilities. By default, this option is not
-  activated which means that only a sequential optimization is
-  performed.
-
-  - <b>safe</b> is slower than the sequential mode, but the
-    quality of the mesh can only improve;
-
-  - <b>aggressive</b> - is faster than the sequential mode, but
-    the quality of the resulting mesh may altered compared to the sequential mode.
-
 - <b>Rectify jacobian</b> - This option activates correction of some
   nodes so as to make the Jacobian of element strictly positive when
   generating a quadratic mesh.
@@ -172,6 +175,19 @@ option will be erased upon pressing \a Ok.
   caracterizes a sliver : any tetrahedron which has at least an angle
   below this value will be considered as a sliver.
 
+- <b>Target quality</b> - Sets the desired maximum target of worst
+  quality acceptable for the volume mesh used during optimisation
+  phase. When defined, an optimization processing is applied to
+  improve the quality until the given target is reached whenever
+  possible. By default, this option is not activated which means that
+  only the standard optimisations are performed (the quality target is
+  the target quality computed by the program).
+
+\subsection advanced_meshing_options_HPC Advanced meshing options for MG-Tetra and MG-Tetra HPC algorithms
+
+This option is common to both algorithms. When MG-Tetra HPC algorithm is selected on the General Parameters view, all advanced options
+are disabled except the follow ones:
+
 - <b>Remove overconstrained tetrahedra</b> - This option can be used
   to only split the tetrahadra which have at least two facets that
   belong to the surface mesh. It will not split the overconstrained
@@ -185,15 +201,7 @@ option will be erased upon pressing \a Ok.
 
   - <b>only</b> means only correction is applied to an existing mesh.
 
-- <b>Target quality</b> - Sets the desired maximum target of worst
-  quality acceptable for the volume mesh used during optimisation
-  phase. When defined, an optimization processing is applied to
-  improve the quality until the given target is reached whenever
-  possible. By default, this option is not activated which means that
-  only the standard optimisations are performed (the quality target is
-  the target quality computed by the program).
-
-\subsection memory_settings Memory settings
+\subsection memory_settings Memory settings (disable when MG-Tetra HPC is selected)
 
 - <b>Maximum memory size</b> - launches MG-Tetra software with
 work space limited to the specified amount of RAM, in Mbytes. If this option is
index 9313082eac8cde69d589552d3ee336c32f5d3cb2..8fd532ee4caff63c51b3235563395a53da68a033 100644 (file)
@@ -3,9 +3,9 @@
 \mainpage Introduction to MG-Tetra plug-in
 
 MG-Tetra plug-in adds two meshing algorithm to the SALOME Mesh: 
-\b MG-Tetra (former GHS3D) and <b>MG-Tetra Optimization</b>.
+<b> MG-Tetra or MG-Tetra HPC</b> (former GHS3D) and <b>MG-Tetra Optimization</b>.
 
-\b MG-Tetra meshing algorithm is destined for:
+<b> MG-Tetra or MG-Tetra HPC</b> meshing algorithm is destined for:
   - Meshing 3D geometric entities: solids are split into tetrahedral (pyramidal) elements.
   - Generating 3D meshes from 2D meshes (triangles and quadrangles), working without geometrical objects.
 
index ad673c2013f96383fb53ab960bf79eb20dc62c2e..3467b6f435b973171f2ccadfa51c22f2ad0f589b 100644 (file)
@@ -118,6 +118,31 @@ module GHS3DPlugin
      */
     void SetOptimizationLevel(in short level) raises (SALOME::SALOME_Exception);
     short GetOptimizationLevel();
+    /*!
+     * Algorithm selection: 0-MGTetra HPC, 1-MGTetra
+     */
+    void SetAlgorithm(in short level) raises (SALOME::SALOME_Exception);
+    short GetAlgorithm();
+    /*!
+     * Set use number of threads
+     */
+    void SetUseNumOfThreads(in boolean setThread) raises (SALOME::SALOME_Exception);
+    boolean GetUseNumOfThreads();
+    /*!
+     * Set number of threads to use
+     */
+    void SetNumOfThreads(in short numThreads);
+    short GetNumOfThreads();
+     /*!
+     * PThreadMode defined for MGTetra
+     */
+    void SetPthreadMode(in short pThreadMode) raises (SALOME::SALOME_Exception);
+    short GetPthreadMode();
+     /*!
+     * ParallelMode defined for MGTetra HPC
+     */
+    void SetParallelMode(in short parallelMode) raises (SALOME::SALOME_Exception);
+    short GetParallelMode();
     /*!
      * Path to working directory
      */
index 06f1a875a8afd1121dcddf1a1c3ce7a8945bd777..8ce03ed1bf556716680f81fcfb1d7d18dfae6ca5 100644 (file)
@@ -222,6 +222,43 @@ class GHS3D_Algorithm(Mesh_Algorithm):
         self.Parameters().SetToRemoveCentralPoint(toRemove)
         pass
 
+    ## To set the algorithm id
+    #  @param algorithm ID 0 MGTetra HPC - 1 MGTetra
+    def SetAlgorithm(self,algoId):
+        self.Parameters().SetAlgorithm(algoId)    
+        pass
+    
+    ## To use parallel mode
+    #  @param toUseNumOfThreads "use max number of threads" flag value
+    def SetUseNumOfThreads(self,useThreads):
+        self.Parameters().SetUseNumOfThreads(useThreads)    
+        pass
+
+    ## To set the number of threads to be used
+    #  @param numberOfThreads define max_num_threads for MGTetra and MGTetra HPC
+    def SetNumOfThreads(self,numThreads):
+        self.Parameters().SetNumOfThreads(numThreads)    
+        pass
+    
+    ## Set SetPthreadMode.
+    #  @param pthreadMode for parallel algorithm in MGTetra
+    #  - 0 - none
+    #  - 1 - aggresive
+    #  - 2 - safe
+    def SetPthreadMode(self,pthreadMode):
+        self.Parameters().SetPthreadMode(pthreadMode)    
+        pass
+    
+    ## Set SetParallelMode.
+    #  @param parallelMode for parallel algorithm in MGTetra HPC
+    #  - 0 - none
+    #  - 1 - reproducible_given_max_number_of_threads
+    #  - 2 - reproducible
+    #  - 3 - aggressive 
+    def SetPthreadMode(self,parallelMode):
+        self.Parameters().SetParallelMode(parallelMode)    
+        pass
+
     ## To set an enforced vertex.
     #  @param x            : x coordinate
     #  @param y            : y coordinate
index b7b3109306d3b3b7c098e2dac32da08c8fd93335..ba449ce325ac80d906747858a291536da94b5c2a 100644 (file)
@@ -1580,12 +1580,12 @@ static bool writeGMFFile(MG_Tetra_API*                                   MGInput
   return true;
 }
 
+
 //=============================================================================
 /*!
  *Here we are going to use the MG-Tetra mesher with geometry
  */
 //=============================================================================
-
 bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
                                 const TopoDS_Shape& theShape)
 {
@@ -1872,6 +1872,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
  *Here we are going to use the MG-Tetra mesher w/o geometry
  */
 //=============================================================================
+
 bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
                                 SMESH_MesherHelper* theHelper)
 {
index 620d33670b25fed770a424585cbffe75d96ded29..7f5a6b590e3c160e228f8a787e7e13f326c92984 100644 (file)
@@ -57,19 +57,18 @@ public:
   virtual bool CheckHypothesis(SMESH_Mesh&         aMesh,
                                const TopoDS_Shape& aShape,
                                Hypothesis_Status&  aStatus);
-
-  virtual bool Compute(SMESH_Mesh&         aMesh,
-                       const TopoDS_Shape& aShape);
-
   virtual void CancelCompute();
   bool         computeCanceled() { return _computeCanceled; }
 
   virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
                         MapShapeNbElems& aResMap);
 
+  virtual bool Compute(SMESH_Mesh&         aMesh,
+                       const TopoDS_Shape& aShape);
+  
   virtual bool Compute(SMESH_Mesh&         theMesh,
-                       SMESH_MesherHelper* aHelper);
-
+                       SMESH_MesherHelper* aHelper);                          
+  
   virtual void SubmeshRestored(SMESH_subMesh* subMesh);
 
   virtual void SetEventListener(SMESH_subMesh* subMesh);
index 73a58fb0d2113ac633b60f2513b7bf49639e802d..989eea6d0dbbe391f08c9d205d3b96b98d6028c0 100644 (file)
@@ -70,6 +70,11 @@ GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, SMESH_Gen * gen)
     myGradation(DefaultGradation()),
     myUseVolumeProximity(DefaultUseVolumeProximity()),
     myNbVolumeProximityLayers(DefaultNbVolumeProximityLayers()),
+    myAlgorithm(DefaultAlgorithm()),    
+    myNumOfThreads(DefaultNumOfThreads()),
+    myUseNumOfThreads(DefaultUseNumOfThreads()),
+    myPthreadModeMG(DefaultMyPthreadMode()),
+    myPthreadModeMGHPC(DefaultMyPthreadModeHPC()),
     myMinSize(0),
     myMinSizeDefault(0),
     myMaxSize(0),
@@ -88,15 +93,13 @@ GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, SMESH_Gen * gen)
                                     "" // mark of end
   };
   const char* intOptionNames[] = { "max_number_of_errors_printed", // 1
-                                   "max_number_of_threads",        // 4
                                    "" // mark of end
   };
   const char* doubleOptionNames[] = { "target_quality",  // 0
                                       "sliver_angle",    // 5
                                       "" // mark of end
   };
-  const char* charOptionNames[] = { "pthreads_mode",                    // ""
-                                    "boundary_regeneration",            // standard
+  const char* charOptionNames[] = { "boundary_regeneration",            // standard
                                     "split_overconstrained_tetrahedra", // no
                                     "" // mark of end
   };
@@ -132,10 +135,8 @@ GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, SMESH_Gen * gen)
   _defaultOptionValues["rectify_jacobian"                                 ] = "yes";
   _defaultOptionValues["jacobian_rectification_respect_input_surface_mesh"] = "yes";
   _defaultOptionValues["max_number_of_errors_printed"                     ] = "1";
-  _defaultOptionValues["max_number_of_threads"                            ] = "4";
   _defaultOptionValues["target_quality"                                   ] = "";//NoValue();
   _defaultOptionValues["sliver_angle"                                     ] = "5";
-  _defaultOptionValues["pthreads_mode"                                    ] = "";//NoValue();
   _defaultOptionValues["boundary_regeneration"                            ] = "standard";
   _defaultOptionValues["split_overconstrained_tetrahedra"                 ] = "no";
 
@@ -354,9 +355,108 @@ void GHS3DPlugin_Hypothesis::SetToCreateNewNodes(bool toCreate)
 }
 
 //=======================================================================
-//function : GetToCreateNewNodes
+//function : SetAlgorithm
+//=======================================================================
+void GHS3DPlugin_Hypothesis::SetAlgorithm(ImplementedAlgorithms algoId)
+{
+  if ( myAlgorithm != algoId ) {
+    myAlgorithm = algoId;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function :   short GetAlgorithm() const;
+
+//=======================================================================
+GHS3DPlugin_Hypothesis::ImplementedAlgorithms GHS3DPlugin_Hypothesis::GetAlgorithm() const
+{
+  return (ImplementedAlgorithms) myAlgorithm;
+}
+
+//=======================================================================
+//function : SetPthreadMode
+//=======================================================================
+void GHS3DPlugin_Hypothesis::SetPthreadMode(PThreadMode pThreadsMode )
+{
+  if ( myPthreadModeMG != pThreadsMode ) {
+    myPthreadModeMG = pThreadsMode;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function :   short GetPthreadMode() const;
+
+//=======================================================================
+GHS3DPlugin_Hypothesis::PThreadMode GHS3DPlugin_Hypothesis::GetPthreadMode() const
+{
+  return (PThreadMode)myPthreadModeMG;
+}
+
+//=======================================================================
+//function : SetParallelMode
+//=======================================================================
+void GHS3DPlugin_Hypothesis::SetParallelMode(ParallelMode parallelMode )
+{
+  if ( myPthreadModeMGHPC != parallelMode ) {
+    myPthreadModeMGHPC = parallelMode;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function :   short GetParallelMode() const;
+
+//=======================================================================
+GHS3DPlugin_Hypothesis::ParallelMode GHS3DPlugin_Hypothesis::GetParallelMode() const
+{
+  return (ParallelMode)myPthreadModeMGHPC;
+}
+
+//=======================================================================
+//function : SetUseNumOfThreads
+//=======================================================================
+void GHS3DPlugin_Hypothesis::SetUseNumOfThreads(bool setUseOfThreads)
+{
+  if ( myUseNumOfThreads != setUseOfThreads ) {
+    myUseNumOfThreads = setUseOfThreads;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
 //=======================================================================
+//function :   bool GetUseNumOfThreads() const;
 
+//=======================================================================
+bool GHS3DPlugin_Hypothesis::GetUseNumOfThreads() const
+{
+  return myUseNumOfThreads;
+}
+
+//=======================================================================
+//function : SetNumOfThreads
+//=======================================================================
+void GHS3DPlugin_Hypothesis::SetNumOfThreads(short numOfThreads)
+{
+  if ( myNumOfThreads != numOfThreads ) {
+    myNumOfThreads = numOfThreads;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function :   short GetUseNumOfThreads() const;
+
+//=======================================================================
+short GHS3DPlugin_Hypothesis::GetNumOfThreads() const
+{
+  return myNumOfThreads;
+}
+
+//=======================================================================
+//function : GetToCreateNewNodes
+//=======================================================================
 bool GHS3DPlugin_Hypothesis::GetToCreateNewNodes() const
 {
   return myToCreateNewNodes;
@@ -1252,6 +1352,13 @@ std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save)
   for ( o2v = _customOption2value.begin(); o2v != _customOption2value.end(); ++o2v )
     save << " -" << o2v->first << " -" << o2v->second;
 
+  // New options (issue #32737) 
+  save << " " << myAlgorithm;
+  save << " " << myUseNumOfThreads;
+  save << " " << myNumOfThreads;
+  save << " " << myPthreadModeMG;
+  save << " " << myPthreadModeMGHPC;
+
   return save;
 }
 
@@ -1608,6 +1715,36 @@ std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load)
     }
   }
 
+  isOK = static_cast<bool>(load >> i);
+  if (isOK)
+    myAlgorithm = (short) i;
+  else
+    load.clear(ios::badbit | load.rdstate());
+  
+  isOK = static_cast<bool>(load >> i);
+  if (isOK)
+    myUseNumOfThreads = (short) i;
+  else
+    load.clear(ios::badbit | load.rdstate());
+  
+  isOK = static_cast<bool>(load >> i);
+  if (isOK)
+    myNumOfThreads = (short) i;
+  else
+    load.clear(ios::badbit | load.rdstate());
+
+  isOK = static_cast<bool>(load >> i);
+  if (isOK)
+    myPthreadModeMG = (short) i;
+  else
+    load.clear(ios::badbit | load.rdstate());
+
+  isOK = static_cast<bool>(load >> i);
+  if (isOK)
+    myPthreadModeMGHPC = (short) i;
+  else
+    load.clear(ios::badbit | load.rdstate());
+
   return load;
 }
 
@@ -1639,17 +1776,57 @@ bool GHS3DPlugin_Hypothesis::SetParametersByDefaults(const TDefaults&  dflts,
   return true;
 }
 
+void GHS3DPlugin_Hypothesis::SetAdvancedOptionsInCommandLine( std::string & cmd ) const
+{
+  std::string option, value;
+  bool isDefault;
+  const TOptionValues* options[] = { & this->_option2value, & this->_customOption2value };
+  for ( int iOp = 0; iOp < 2; ++iOp )
+  {
+    TOptionValues::const_iterator o2v = options[iOp]->begin();
+    for ( ; o2v != options[iOp]->end(); ++o2v )
+    {
+      option = o2v->first;
+      value = this->GetOptionValue( option, &isDefault );
+
+      if ( isDefault )
+        continue;
+
+      if ( value.empty() )//value == NoValue() )
+      {
+        if ( this->_defaultOptionValues.count( option ))
+          continue; // non-custom option with no value
+        //value.clear();
+      }    
+
+      if ( strncmp( "no", option.c_str(), 2 ) == 0 ) // options w/o values: --no_*
+      {
+        if ( !value.empty() && ToBool( value ) == false )
+          continue;
+        value.clear();
+      }
+
+      if ( option[0] != '-' )
+        cmd += " --";
+      else
+        cmd += " ";
+      cmd += option + " " + value;
+    }
+  }
+}
+
 //================================================================================
 /*!
  * \brief Return command to run MG-Tetra mesher excluding file prefix (-f)
  */
 //================================================================================
-
 std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
                                                  const bool                    hasShapeToMesh,
                                                  const bool                    forExecutable)
 {
-  std::string cmd = GetExeName();
+  GHS3DPlugin_Hypothesis::ImplementedAlgorithms algoId = hyp ? (ImplementedAlgorithms) hyp->myAlgorithm : MGTetra;
+  std::string cmd = GetExeName( algoId );
+  
   // check if any option is overridden by hyp->myTextOption
   bool max_memory     = hyp ? !hyp->HasOptionDefined("max_memory")               : true;
   bool auto_memory    = hyp ? !hyp->HasOptionDefined("automatic_memory")         : true;
@@ -1668,20 +1845,20 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
     useBndRecovery = hyp->myToUseBoundaryRecoveryVersion;
 
   // MG-Tetra needs to know amount of memory it may use (MB).
-  // Default memory is defined at MG-Tetra installation but it may be not enough,
-  // so allow to use about all available memory
-  if ( max_memory ) {
+  // Default memory is defined at MG-Tetra installation but it may be not enough,  // so allow to use about all available memory
+  if ( algoId == MGTetra && max_memory ) {
     float aMaximumMemory = hyp ? hyp->myMaximumMemory : -1;
     cmd += " --max_memory ";
     if ( aMaximumMemory < 0 ) cmd += SMESH_Comment( int( DefaultMaximumMemory() ));
     else                      cmd += SMESH_Comment( int( aMaximumMemory ));
   }
-  if ( auto_memory && !useBndRecovery ) {
+  if (  algoId == MGTetra && ( auto_memory && !useBndRecovery ) ) {
     float aInitialMemory = hyp ? hyp->myInitialMemory : -1;
     cmd += " --automatic_memory ";
     if ( aInitialMemory > 0 ) cmd += SMESH_Comment( int( aInitialMemory ));
     else                      cmd += "100";
   }
+
   // component to mesh
   if ( comp && !useBndRecovery ) {
     // We always run MG-Tetra with "to mesh holes'==TRUE (see PAL19680)
@@ -1700,11 +1877,13 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
     cmd += " --optimisation_level none"; // issue 22608
   }
   else if ( optim_level && hyp && !useBndRecovery ) {
-    if ( hyp->myOptimizationLevel >= 0 && hyp->myOptimizationLevel < 5 ) {
-      const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
-      cmd += " --optimisation_level ";
-      cmd += level[ hyp->myOptimizationLevel ];
-    }
+    const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
+    const short myOpt = hyp->myOptimizationLevel;
+    
+    if ( myOpt >= 0 && myOpt < 5 && ( algoId == MGTetra || ( algoId == MGTetraHPC && myOpt != 3 ) ) ) {
+        cmd += " --optimisation_level ";
+        cmd += level[ myOpt ];
+    }    
   }
 
   // to create internal nodes
@@ -1715,101 +1894,66 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
       cmd += " --internalpoints no";
   }
 
-  // verbose mode
-  if ( verbose && hyp ) {
-    cmd += " --verbose " + SMESH_Comment( hyp->myVerboseLevel );
-  }
-
-  // boundary recovery version
-  // if ( useBndRecovery ) {
-  //   cmd += " -C";
-  // }
-
-  // to use FEM correction
-  // if ( fem && hyp && hyp->myToUseFemCorrection) {
-  //   cmd += " -FEM";
-  // }
-
-  // to remove initial central point.
-  if ( rem && hyp && hyp->myToRemoveCentralPoint ) {
-    if ( forExecutable )
-      cmd += " --no_initial_central_point";
-    else
-      cmd += " --centralpoint no";
-  }
+  if ( hyp ) 
+  {
+    // verbose mode
+    if ( verbose ) {
+      cmd += " --verbose " + SMESH_Comment( hyp->myVerboseLevel );
+    }
 
-  // options as text
-  // if ( hyp && !hyp->myTextOption.empty() ) {
-  //   cmd += " " + hyp->myTextOption;
-  // }
+    // to remove initial central point.
+    if ( rem && hyp->myToRemoveCentralPoint ) {
+      if ( forExecutable )
+        cmd += " --no_initial_central_point";
+      else
+        cmd += " --centralpoint no";
+    }
 
-  // min/max size
-  if ( hyp )
-  {
     if ( hyp->GetMinSize() > 0 )
       cmd += " --min_size " + SMESH_Comment( hyp->GetMinSize() );
+
     if ( hyp->GetMaxSize() > 0 )
       cmd += " --max_size " + SMESH_Comment( hyp->GetMaxSize() );
-  }
 
-  // to define volumic gradation.
-  if ( gra && hyp )
-  {
-    cmd += " --gradation " + SMESH_Comment( hyp->myGradation );
-  }
+    // to define volumic gradation.
+    if ( gra )
+      cmd += " --gradation " + SMESH_Comment( hyp->myGradation );
+
+    if ( hyp->GetUseNumOfThreads() )
+    {      
+      cmd += " --max_number_of_threads "  + SMESH_Comment( hyp->GetNumOfThreads() );
+      const char* pthreadMode[] = { "none" , "aggressive" , "safe" };
+      const char* parallelMode[] = { "none", "reproducible_given_max_number_of_threads", "reproducible", "aggressive"  };
+
+      if ( algoId == MGTetra && hyp->myPthreadModeMG >= 1 && hyp->myPthreadModeMG < 3 ) {
+        cmd += " --pthreads_mode ";
+        cmd += pthreadMode[ hyp->myPthreadModeMG ];
+      }
+      else if ( algoId == MGTetraHPC && hyp->myPthreadModeMGHPC >= 1 && hyp->myPthreadModeMGHPC < 4 )
+      {
+        cmd += " --parallel_strategy ";
+        cmd += parallelMode[ hyp->myPthreadModeMGHPC ];
+      }
+    }
 
-  if ( hyp )
-  {
     // proximity
     if ( hyp->GetUseVolumeProximity() )
     {
       cmd += " --volume_proximity_layers " + SMESH_Comment( hyp->GetNbVolumeProximityLayers() );
     }
-
-    std::string option, value;
-    bool isDefault;
-    const TOptionValues* options[] = { & hyp->_option2value, & hyp->_customOption2value };
-    for ( int iOp = 0; iOp < 2; ++iOp )
-    {
-      TOptionValues::const_iterator o2v = options[iOp]->begin();
-      for ( ; o2v != options[iOp]->end(); ++o2v )
-      {
-        option = o2v->first;
-        value = hyp->GetOptionValue( option, &isDefault );
-
-        if ( isDefault )
-          continue;
-        if ( value.empty() )//value == NoValue() )
-        {
-          if ( hyp->_defaultOptionValues.count( option ))
-            continue; // non-custom option with no value
-          //value.clear();
-        }
-        if ( strncmp( "no", option.c_str(), 2 ) == 0 ) // options w/o values: --no_*
-        {
-          if ( !value.empty() && ToBool( value ) == false )
-            continue;
-          value.clear();
-        }
-        if ( option[0] != '-' )
-          cmd += " --";
-        else
-          cmd += " ";
-        cmd += option + " " + value;
-      }
-    }
+    
+    hyp->SetAdvancedOptionsInCommandLine( cmd );
   }
 
 #ifdef WIN32
   cmd += " < NUL";
 #endif
-
   return cmd;
 }
 
 //================================================================================
 /*!
- * \brief Return a unique file name
+ * \brief Return a unique file name for MGTetra
  */
 //================================================================================
 
@@ -1835,15 +1979,51 @@ std::string GHS3DPlugin_Hypothesis::GetFileName(const GHS3DPlugin_Hypothesis* hy
   return aGenericName.ToCString();
 }
 
+//================================================================================
+/*!
+ * \brief Return a unique file name when running MGTetra HPC
+ */
+//================================================================================
+
+std::string GHS3DPlugin_Hypothesis::GetFileNameHPC(const GHS3DPlugin_Hypothesis* hyp)
+{
+  std::string aTmpDir = hyp ? hyp->GetWorkingDirectory() : DefaultWorkingDirectory();
+  if ( !SMESH_File( aTmpDir ).exists() )
+    aTmpDir = Kernel_Utils::GetTmpDirByPath( aTmpDir );
+
+  const char lastChar = *aTmpDir.rbegin();
+#ifdef WIN32
+    if(lastChar != '\\') aTmpDir+='\\';
+#else
+    if(lastChar != '/') aTmpDir+='/';
+#endif      
+
+  TCollection_AsciiString aGenericName = (char*)aTmpDir.c_str();
+  aGenericName += "MGTETRAHPC_";
+  aGenericName += getpid();
+  aGenericName += "_";
+  aGenericName += Abs((Standard_Integer)(long) aGenericName.ToCString());
+
+  return aGenericName.ToCString();
+}
+
 //================================================================================
 /*
  * Return the name of executable
  */
 //================================================================================
 
-std::string GHS3DPlugin_Hypothesis::GetExeName()
+std::string GHS3DPlugin_Hypothesis::GetExeName( ImplementedAlgorithms algoId )
 {
-  return "mg-tetra.exe";
+  switch ( algoId )
+  {
+    case MGTetra:
+      return "mg-tetra.exe";
+    case MGTetraHPC:
+      return "mg-tetra_hpc.exe";
+    default:
+      throw( "Undefined algorithm id: ");
+  }
 }
 
 //================================================================================
index 28279b2bc514728837fe59a042c3cad8ec928e8a..fd8c951af9a19fd5269324f0b9e46fdbae4bfdcf 100644 (file)
@@ -183,6 +183,36 @@ public:
    */
   void SetVerboseLevel(short level);
   short GetVerboseLevel() const;
+  /*!
+   * Implemented algorithms to be executed [0,1]
+   *  0 - MGTetra-HPC
+   *  1 - MGTetra
+   */
+  enum ImplementedAlgorithms { MGTetraHPC = 0,  MGTetra };
+  void SetAlgorithm(ImplementedAlgorithms algoId);
+  ImplementedAlgorithms GetAlgorithm() const;
+  /*!
+   * Set Get for flag to use pthread parallel version of the algorithm
+   */
+  void SetUseNumOfThreads(bool setUseOfThreads);
+  bool GetUseNumOfThreads() const;
+   /*!
+   * Set Get num of threads to be used by MGTetra algorithms
+   */
+  void SetNumOfThreads(short numOfThreads);
+  short GetNumOfThreads() const;
+  /*!
+  * Set Get pthread mode used for MGTetra
+  */
+  enum PThreadMode { PThreadNone = 0, PThreadAggressive,  Safe };
+  void SetPthreadMode(PThreadMode pthreadMode );
+  PThreadMode GetPthreadMode() const;
+  /*!
+  * Set Get paralle mode used for MGTetra HPC
+  */
+  enum ParallelMode { ParallelNone = 0, ReproducibleGivenMaxNumThreads, Reproducible, ParallelAggressive };
+  void SetParallelMode(ParallelMode parallelMode );
+  ParallelMode GetParallelMode() const;
   /*!
    * To create new nodes
    */
@@ -211,7 +241,7 @@ public:
    * To set hiden/undocumented/advanced options
    */
   void SetAdvancedOption(const std::string& option);
-  std::string GetAdvancedOption() const;
+  std::string GetAdvancedOption() const;  
   /*!
   * To define the volumic gradation
   */
@@ -240,16 +270,20 @@ public:
   void ClearOption(const std::string& optionName);
   TOptionValues        GetOptionValues()       const;
   const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
-  //static inline const char* NoValue() { return "_"; }
+
+  // bool isMGTetraHPCOptions( std::string & option ) const;
+  /*!
+   * \brief To set the advanced options in the execution command line
+   */
+  void SetAdvancedOptionsInCommandLine( std::string & cmd ) const;
   
+  //static inline const char* NoValue() { return "_"; }  
 //   struct TEnforcedEdge {
 //     long ID;
 //     long node1;
 //     long node2;
 //     std::string groupName;
 //   };
-  
-
   /*!
    * \brief Return command to run MG-Tetra mesher excluding file prefix (-f)
    */
@@ -260,10 +294,14 @@ public:
    * \brief Return a unique file name
    */
   static std::string GetFileName(const GHS3DPlugin_Hypothesis* hyp);
+  /*!
+   * \brief Return a unique file name for MGTetraHPC will have a GHS3D prefix
+   */
+  static std::string GetFileNameHPC(const GHS3DPlugin_Hypothesis* hyp);
   /*!
    * \brief Return the name of executable
    */
-  static std::string GetExeName();
+  static std::string GetExeName( ImplementedAlgorithms algoId );
 
   /*!
    * To set an enforced vertex
@@ -331,6 +369,11 @@ public:
   static inline double DefaultGradation() { return 1.05; }
   static bool   DefaultUseVolumeProximity() { return false; }
   static int    DefaultNbVolumeProximityLayers() { return 2; }
+  static short  DefaultAlgorithm() { return MGTetra; }
+  static short  DefaultNumOfThreads() { return 4; }
+  static bool   DefaultUseNumOfThreads() { return true; }
+  static short  DefaultMyPthreadMode() { return 2; }    //reproducible_given_max_of_threads
+  static short  DefaultMyPthreadModeHPC() { return 1; } // safe
    
   void SetMinMaxSizeDefault( double theMinSize, double theMaxSize )
   { myMinSizeDefault = theMinSize; myMaxSizeDefault = theMaxSize; }
@@ -374,13 +417,19 @@ protected:
   double      myGradation;
   bool        myUseVolumeProximity;
   int         myNbVolumeProximityLayers;
+  short       myAlgorithm;  //member used to pivot between MG-Tetra and MG-Tetra
+  short       myNumOfThreads;
+  bool        myUseNumOfThreads;
+  short       myPthreadModeMG;
+  short       myPthreadModeMGHPC;
   double      myMinSize, myMinSizeDefault;
   double      myMaxSize, myMaxSizeDefault;
   //std::string myTextOption;
+
   
   TOptionValues _option2value, _customOption2value;         // user defined values
   TOptionValues _defaultOptionValues;                       // default values
-  TOptionNames  _doubleOptions, _charOptions, _boolOptions; // to find a type of option
+  TOptionNames  _doubleOptions, _charOptions, _boolOptions; // to find a type of option  
 
   TGHS3DEnforcedVertexList         _enfVertexList;
   TGHS3DEnforcedVertexCoordsValues _enfVertexCoordsSizeList;
index 1713aa4fbaa52c5c4210eb3378c0456b882540fd..f9bf94baac5e277142b55d6f24976959051c77ad 100644 (file)
@@ -241,7 +241,7 @@ void GHS3DPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
     (::GHS3DPlugin_Hypothesis::OptimizationLevel) level;
   if ( l < ::GHS3DPlugin_Hypothesis::None ||
        l > ::GHS3DPlugin_Hypothesis::Strong )
-    THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
+    THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level", SALOME::BAD_PARAM );
     
   ASSERT(myBaseImpl);
   this->GetImpl()->SetOptimizationLevel(l);
@@ -258,6 +258,121 @@ CORBA::Short GHS3DPlugin_Hypothesis_i::GetOptimizationLevel()
   return this->GetImpl()->GetOptimizationLevel();
 }
 
+//=======================================================================
+//function : SetAlgorithm
+//=======================================================================
+void GHS3DPlugin_Hypothesis_i::SetAlgorithm(CORBA::Short algoId)
+{ 
+  ::GHS3DPlugin_Hypothesis::ImplementedAlgorithms algo =
+    (::GHS3DPlugin_Hypothesis::ImplementedAlgorithms) algoId;
+  if ( algo != ::GHS3DPlugin_Hypothesis::MGTetra && algo != ::GHS3DPlugin_Hypothesis::MGTetraHPC )
+    THROW_SALOME_CORBA_EXCEPTION( "Invalid algorithm type", SALOME::BAD_PARAM );
+
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetAlgorithm(algo);
+  SMESH::TPythonDump() << _this() << ".SetAlgorithm( " << algoId << " )";
+}
+
+//=======================================================================
+//function : GetAlgorithm
+//=======================================================================
+CORBA::Short GHS3DPlugin_Hypothesis_i::GetAlgorithm()
+{
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetAlgorithm();
+}
+
+//=======================================================================
+//function : SetUseNumOfThreads
+//=======================================================================
+void GHS3DPlugin_Hypothesis_i::SetUseNumOfThreads(CORBA::Boolean setThread)
+{ 
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetUseNumOfThreads(setThread);
+  SMESH::TPythonDump() << _this() << ".SetUseNumOfThreads( " << setThread << " )";
+}
+
+//=======================================================================
+//function : GetUseNumOfThreads
+//=======================================================================
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetUseNumOfThreads()
+{
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetUseNumOfThreads();
+}
+
+//=======================================================================
+//function : SetNumOfThreads
+//=======================================================================
+void GHS3DPlugin_Hypothesis_i::SetNumOfThreads(CORBA::Short numOfThreads)
+{ 
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetNumOfThreads(numOfThreads);
+  SMESH::TPythonDump() << _this() << ".SetNumOfThreads( " << numOfThreads << " )";
+}
+
+//=======================================================================
+//function : GetNumOfThreads
+//=======================================================================
+CORBA::Short GHS3DPlugin_Hypothesis_i::GetNumOfThreads()
+{
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetNumOfThreads();
+}
+
+//=======================================================================
+//function : SetNumOfThreads
+//=======================================================================
+void GHS3DPlugin_Hypothesis_i::SetPthreadMode(CORBA::Short pThreadMode)
+{ 
+  ::GHS3DPlugin_Hypothesis::PThreadMode mode =
+    (::GHS3DPlugin_Hypothesis::PThreadMode) pThreadMode;
+  
+   if ( mode < ::GHS3DPlugin_Hypothesis::PThreadNone ||
+       mode > ::GHS3DPlugin_Hypothesis::Safe )
+    THROW_SALOME_CORBA_EXCEPTION( "Invalid pthreadMode type", SALOME::BAD_PARAM );
+
+
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetPthreadMode(mode);
+  SMESH::TPythonDump() << _this() << ".SetPthreadMode( " << pThreadMode << " )";
+}
+
+//=======================================================================
+//function : GetNumOfThreads
+//=======================================================================
+CORBA::Short GHS3DPlugin_Hypothesis_i::GetPthreadMode()
+{
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetPthreadMode();
+}
+
+//=======================================================================
+//function : SetNumOfThreads
+//=======================================================================
+void GHS3DPlugin_Hypothesis_i::SetParallelMode(CORBA::Short parallelMode)
+{ 
+    ::GHS3DPlugin_Hypothesis::ParallelMode mode =
+    (::GHS3DPlugin_Hypothesis::ParallelMode) parallelMode;
+  
+   if ( mode < ::GHS3DPlugin_Hypothesis::ParallelNone ||
+       mode > ::GHS3DPlugin_Hypothesis::ParallelAggressive )
+    THROW_SALOME_CORBA_EXCEPTION( "Invalid parallelMode type", SALOME::BAD_PARAM );
+
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetParallelMode(mode);
+  SMESH::TPythonDump() << _this() << ".SetParallelMode( " << parallelMode << " )";
+}
+
+//=======================================================================
+//function : GetNumOfThreads
+//=======================================================================
+CORBA::Short GHS3DPlugin_Hypothesis_i::GetParallelMode()
+{
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetParallelMode();
+}
+
 //=======================================================================
 //function : SetWorkingDirectory
 //=======================================================================
index 050a8e1d604153e900a35b559143aa6f8c5379c0..b9df09b72bbc44574a32db0579d077d863721ab8 100644 (file)
@@ -93,6 +93,33 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i:
    */
   void SetOptimizationLevel(CORBA::Short level);
   CORBA::Short GetOptimizationLevel();
+  /*!
+   * Algorithm Id: 0-MGTetra HPC, 1-MGTetra
+   */
+  void SetAlgorithm(CORBA::Short algoId);
+  CORBA::Short GetAlgorithm();
+   /*!
+   * Flag for set get optional use parallelism in MGTetra
+   */
+  void SetUseNumOfThreads(CORBA::Boolean useThreads);
+  CORBA::Boolean GetUseNumOfThreads();
+   /*!
+   * Get set number of threads to use on the parallel MGTetra algorithm
+   */
+  void SetNumOfThreads(CORBA::Short numThreads);
+  CORBA::Short GetNumOfThreads();
+  /*!
+   * For MGTetra
+   * PthreadMode: 0-PThreadNone, 1-PThreadAggressive, 2-Safe
+   */
+  void SetPthreadMode(CORBA::Short pThreadMode);
+  CORBA::Short GetPthreadMode();
+  /*!
+   * For MGTetra HPC 
+   * SetParallelMode level: 0-ParallelNone, 1-ReproducibleGivenMaxNumThreads, 2-Reproducible, 3-ParallelAggressive   
+   */
+  void SetParallelMode(CORBA::Short parallelMode);
+  CORBA::Short GetParallelMode();
   /*!
    * Path to working directory
    */
index 7e5cf770fd4ab2d07c1aaaaf4eec743b82a80b1a..a27c823de05ed176fbf4bd4e1e325fad9f09e444 100644 (file)
@@ -153,7 +153,7 @@ bool GHS3DPlugin_OptimizerHypothesis::SetParametersByDefaults(const TDefaults&
 
 std::string GHS3DPlugin_OptimizerHypothesis::CommandToRun(const GHS3DPlugin_OptimizerHypothesis* hyp)
 {
-  SMESH_Comment cmd( GetExeName() );
+  SMESH_Comment cmd( GetExeName( (ImplementedAlgorithms) 1 ) );
 
   cmd << " --max_memory "
       << (( hyp && hyp->myMaximumMemory > 0 ) ? hyp->myMaximumMemory : DefaultMaximumMemory());
index b2dc3a15c0c63f604fe3737a242266379f398a92..e70781f946be6f53064488a8fbe5b7c0f628ab1a 100644 (file)
@@ -135,3 +135,23 @@ void GHS3DPluginGUI_AdvWidget::itemChanged(QTreeWidgetItem * tblRow, int column)
     myOptionTable->blockSignals( false );
   }
 }
+
+void GHS3DPluginGUI_AdvWidget::EnableAdvancedOptions( bool isMGTetra )
+{
+  int iRow = 0, nbRows = myOptionTable->topLevelItemCount();
+  // hard coded: register all possible options here
+  std::vector<std::string>_commonOptions = { "split_overconstrained_tetrahedra" };
+  std::vector<std::string>::iterator tk;
+  for ( ; iRow < nbRows; ++iRow )
+  {
+    // Have to allow advanced option for MGTetra HPC to work
+    tk = std::find( _commonOptions.begin(), 
+                    _commonOptions.end(),  
+                    myOptionTable->topLevelItem( iRow )->data( NAME_COL, PARAM_NAME ).toString().toStdString() 
+                  );
+
+    if ( tk == _commonOptions.end() ) 
+      myOptionTable->topLevelItem( iRow )->setDisabled( !isMGTetra );
+  
+  }
+}
\ No newline at end of file
index 7fb6d65425b6d651c5828b627aef0d09462d008d..8bb619c3c95542248d05708f2ce0a79586ff84f2 100644 (file)
@@ -49,7 +49,7 @@ public:
 
   void AddOption( const char* name_value_type, bool isCustom = false );
   void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt );
-
+  void EnableAdvancedOptions( bool isMGTetra );
 public slots:
 
   void itemChanged(QTreeWidgetItem * tblRow, int column);
index bbdf3668878438fc9c379462fb73301002868558..948855bd35f10313148537af2612e0f4cadfb456 100644 (file)
@@ -49,6 +49,7 @@
 
 #include <QCheckBox>
 #include <QComboBox>
+#include <QButtonGroup>
 #include <QFileInfo>
 #include <QFrame>
 #include <QGridLayout>
@@ -58,7 +59,9 @@
 #include <QLineEdit>
 #include <QPalette>
 #include <QPushButton>
+#include <QRadioButton>
 #include <QSpinBox>
+#include <QtWidgets>
 #include <QTabWidget>
 #include <QTableWidget>
 #include <QTableWidgetItem>
@@ -303,6 +306,8 @@ GHS3DPluginGUI_HypothesisCreator::GHS3DPluginGUI_HypothesisCreator( const QStrin
     myMaxSizeCheck(0),
     myMinSizeSpin(0),
     myMaxSizeSpin(0),
+    myNumOfThreadsCheck(0),
+    myNumOfThreadsSpin(0),
     myGradationCheck(0),
     myGradationSpin(0),
     myUseProximityGroup(0),
@@ -314,7 +319,9 @@ GHS3DPluginGUI_HypothesisCreator::GHS3DPluginGUI_HypothesisCreator( const QStrin
     myPThreadsModeCombo(0),
     myNumberOfThreadsSpin(0),
     mySmoothOffSliversCheck(0),
-    myCreateNewNodesCheck(0)
+    myCreateNewNodesCheck(0),
+    myPthreadMode(0),
+    myParallelMode(0)
 {
   GeomToolSelected = NULL;
   GeomToolSelected = getGeomSelectionTool();
@@ -354,6 +361,70 @@ bool GHS3DPluginGUI_HypothesisCreator::isOptimization() const
   return ( hypType() == GHS3DPlugin_OptimizerHypothesis::GetHypType() );
 }
 
+void GHS3DPluginGUI_HypothesisCreator::onRadioButtonSelect()
+{
+  onNumOfThreadsCheck();
+    
+  // Disable selection of standart+ 
+  QStandardItemModel * model = qobject_cast<QStandardItemModel*>(myOptimizationLevelCombo->model());
+  if(!model) return;
+  QStandardItem * item = model->item( GHS3DPlugin_Hypothesis::StandardPlus );
+  if(!item) return;
+
+  if ( myRadioBottomGroup->checkedId() == GHS3DPlugin_Hypothesis::MGTetra )
+  {
+    // Enable selection of stadart+
+    item->setEnabled(true);
+    // Set possibility to check memory options again.
+    myAdvWidget->maxMemoryCheck     ->setEnabled( true );
+    myAdvWidget->initialMemoryCheck ->setEnabled( true );
+
+    myAdvWidget->EnableAdvancedOptions( true );
+    myEnfGroup->setEnabled( true );
+    myEnfMeshGroup->setEnabled( true );
+  }
+  else if ( myRadioBottomGroup->checkedId() == GHS3DPlugin_Hypothesis::MGTetraHPC )
+  {
+    // Disable selection of stadart+ 
+    item->setEnabled(false);
+    // Set to false memory checks and disable checkbox
+    myAdvWidget->maxMemoryCheck     ->setChecked( false );
+    myAdvWidget->initialMemoryCheck ->setChecked( false );
+    myAdvWidget->maxMemoryCheck     ->setEnabled( false );
+    myAdvWidget->initialMemoryCheck ->setEnabled( false );    
+    myAdvWidget->EnableAdvancedOptions( false );
+    myEnfGroup->setEnabled( false );
+    myEnfMeshGroup->setEnabled( false );
+  }    
+
+}
+
+void GHS3DPluginGUI_HypothesisCreator::onNumOfThreadsCheck()
+{
+  if ( myRadioBottomGroup->checkedId() == GHS3DPlugin_Hypothesis::MGTetra )
+  {
+    if ( myNumOfThreadsCheck->isChecked() )
+      myPthreadMode->setEnabled( true );
+    else
+      myPthreadMode->setEnabled( false );
+    
+    myParallelMode->setEnabled( false );
+  }
+  else if ( myRadioBottomGroup->checkedId() == GHS3DPlugin_Hypothesis::MGTetraHPC )
+  {
+    if ( myNumOfThreadsCheck->isChecked() )
+      myParallelMode->setEnabled( true );
+    else
+      myParallelMode->setEnabled( false );
+    
+    myPthreadMode->setEnabled( false );
+  }
+  else
+  {
+
+  }
+}
+
 QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
 {
   QFrame* fr = new QFrame( 0 );
@@ -419,26 +490,64 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   }
   else
   {
+    // Algorithm selection
+    QGroupBox* radioBottomGroup = new QGroupBox( tr("GHS3D_ALGO_SELECTION"), myStdGroup );
+    myRadioBottomGroup          = new QButtonGroup( radioBottomGroup );
+    
+    QRadioButton * GM_MSH      = new QRadioButton(tr("GHS3D_ALGO_MGTETRA"), radioBottomGroup );
+    QRadioButton * GM_MSH_HPC  = new QRadioButton(tr("GHS3D_ALGO_MGTETRAHPC"), radioBottomGroup );
+
+    myRadioBottomGroup->addButton( GM_MSH, 1 );    
+    myRadioBottomGroup->addButton( GM_MSH_HPC, 0 );
+    GM_MSH->setChecked( true );
+
+    QGridLayout* radioBottomLayout = new QGridLayout( radioBottomGroup );
+    radioBottomLayout->setSpacing( 4 );
+    radioBottomLayout->setMargin( 11 );
+    radioBottomLayout->addWidget( GM_MSH, 0, 0, 1, 1 );
+    radioBottomLayout->addWidget( GM_MSH_HPC, 0, 1, 1, 1 );
+
     // Main parameters
+    QGroupBox* mainGroup          = new QGroupBox( tr("GHS3D_MAIN_PARAMS"), myStdGroup );
+    QLabel* optimizatiolLevelLbl  = new QLabel( tr( "GHS3D_OPTIMIZATIOL_LEVEL" ), mainGroup );
+    QLabel* pthreadModeLbl        = new QLabel( tr( "GHS3D_PTHREAD_MODE" ), mainGroup );
+    QLabel* parallelStrat         = new QLabel( tr( "GHS3D_PARALLE_STRAT" ), mainGroup );
+
+    myOptimizationLevelCombo  = new QComboBox( mainGroup );
+    myMinSizeCheck            = new QCheckBox( tr("GHS3D_MIN_SIZE"), mainGroup );
+    myMaxSizeCheck            = new QCheckBox( tr("GHS3D_MAX_SIZE"), mainGroup );
+    myNumOfThreadsCheck       = new QCheckBox( tr("GHS3D_THREADS_SIZE"), mainGroup );
+    myPthreadMode             = new QComboBox( mainGroup );
+    myParallelMode            = new QComboBox( mainGroup );
+
+    myMinSizeSpin             = new SMESHGUI_SpinBox( mainGroup );
+    myMaxSizeSpin             = new SMESHGUI_SpinBox( mainGroup );
+    myNumOfThreadsSpin        = new SalomeApp_IntSpinBox( 1, 128, 1, mainGroup );
 
-    QGroupBox* mainGroup = new QGroupBox( tr("GHS3D_MAIN_PARAMS"), myStdGroup );
-    QLabel* optimizatiolLevelLbl = new QLabel( tr( "GHS3D_OPTIMIZATIOL_LEVEL" ), mainGroup );
-    myOptimizationLevelCombo = new QComboBox( mainGroup );
-    myMinSizeCheck = new QCheckBox( tr("GHS3D_MIN_SIZE"), mainGroup );
-    myMaxSizeCheck = new QCheckBox( tr("GHS3D_MAX_SIZE"), mainGroup );
-    myMinSizeSpin  = new SMESHGUI_SpinBox( mainGroup );
-    myMaxSizeSpin  = new SMESHGUI_SpinBox( mainGroup );
     myMinSizeCheck->setChecked( false );
     myMaxSizeCheck->setChecked( false );
+    myNumOfThreadsCheck->setChecked( false );
+
     myMinSizeSpin->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
     myMaxSizeSpin->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
-    myMinSizeSpin->setEnabled( false );
-    myMaxSizeSpin->setEnabled( false );
-    connect( myMinSizeCheck, SIGNAL( toggled(bool)), myMinSizeSpin, SLOT( setEnabled(bool)));
-    connect( myMaxSizeCheck, SIGNAL( toggled(bool)), myMaxSizeSpin, SLOT( setEnabled(bool)));
+    myNumOfThreadsSpin->setValue( 4 );
+
+    myMinSizeSpin ->setEnabled( false );
+    myMaxSizeSpin ->setEnabled( false );
+    myNumOfThreadsSpin->setEnabled(false);
+    myPthreadMode ->setEnabled( false );
+    myParallelMode->setEnabled( false );
+
+    // ACTIONS ON BUTTOMS
+    connect( myMinSizeCheck,      SIGNAL( toggled(bool)), myMinSizeSpin,  SLOT( setEnabled(bool)));
+    connect( myMaxSizeCheck,      SIGNAL( toggled(bool)), myMaxSizeSpin,  SLOT( setEnabled(bool)));
+    connect( myNumOfThreadsCheck, SIGNAL( toggled(bool)), myNumOfThreadsSpin, SLOT( setEnabled(bool)));    
+    connect( myNumOfThreadsCheck, SIGNAL( toggled(bool)),  this, SLOT( onNumOfThreadsCheck() ));
+    connect( myNumOfThreadsCheck, SIGNAL( toggled(bool)),  this, SLOT( onNumOfThreadsCheck() ));
+    connect( GM_MSH,              SIGNAL( toggled( bool )),this, SLOT( onRadioButtonSelect() ));
 
     QGridLayout* mainLayout = new QGridLayout( mainGroup );
-    mainLayout->setSpacing( 6 );
+    mainLayout->setSpacing( 12 );
     mainLayout->setMargin( 11 );
     mainLayout->addWidget( optimizatiolLevelLbl,     0, 0, 1, 1 );
     mainLayout->addWidget( myOptimizationLevelCombo, 0, 1, 1, 1 );
@@ -446,7 +555,13 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
     mainLayout->addWidget( myMinSizeSpin,            1, 1, 1, 1 );
     mainLayout->addWidget( myMaxSizeCheck,           2, 0, 1, 1 );
     mainLayout->addWidget( myMaxSizeSpin,            2, 1, 1, 1 );
-
+    mainLayout->addWidget( myNumOfThreadsCheck,      3, 0, 1, 1 );
+    mainLayout->addWidget( myNumOfThreadsSpin,       3, 1, 1, 1 );
+    mainLayout->addWidget( pthreadModeLbl,           4, 0, 1, 1 );
+    mainLayout->addWidget( myPthreadMode,            4, 1, 1, 1 );
+    mainLayout->addWidget( parallelStrat,            5, 0, 1, 1 );
+    mainLayout->addWidget( myParallelMode,           5, 1, 1, 1 );
+    
     // Volume proximity
 
     QGroupBox* proxyGroup = new QGroupBox( tr("GHS3D_VOLUME_PROXIMITY"), myStdGroup );
@@ -484,10 +599,13 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
     otherLayout->addWidget( myToMeshHolesCheck,      0, 0 );
     otherLayout->addWidget( myToMakeGroupsOfDomains, 1, 0 );
 
+    aStdLayout->addWidget( radioBottomGroup,row++, 0, 1, 2 );
+    aStdLayout->addWidget( mainGroup,       row++, 0, 1, 2 );
+    aStdLayout->addWidget( proxyGroup,      row++, 0, 1, 2 );
+    aStdLayout->addWidget( otherGroup,      row++, 0, 1, 2 );
 
-    aStdLayout->addWidget( mainGroup,  row++, 0, 1, 2 );
-    aStdLayout->addWidget( proxyGroup, row++, 0, 1, 2 );
-    aStdLayout->addWidget( otherGroup, row++, 0, 1, 2 );
+    myPthreadMode->addItems( QStringList() << tr( "MODE_NONE" )   << tr( "MODE_AGGRESSIVE" ) << tr( "MODE_SAFE" ) );
+    myParallelMode->addItems( QStringList() << tr( "MODE_NONE" ) << tr( "MODE_REPRODUCIBLE_GIVEN_MAX_THREADS" )  << tr( "MODE_REPRODUCIBLE" ) << tr( "MODE_AGGRESSIVE" ) );
   }
   aStdLayout->setRowStretch( row, 10 );
 
@@ -549,7 +667,7 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
   
   myEnforcedTableWidget = new QTableWidget(myEnfGroup);
-  myEnforcedTableWidget ->setMinimumWidth(300);
+  myEnforcedTableWidget->setMinimumWidth(300);
   myEnforcedTableWidget->setRowCount( 0 );
   myEnforcedTableWidget->setColumnCount( ENF_VER_NB_COLUMNS );
   myEnforcedTableWidget->setSortingEnabled(true);
@@ -1459,7 +1577,12 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
   }
   myToMeshHolesCheck                          ->setChecked    ( data.myToMeshHoles );
   myToMakeGroupsOfDomains                     ->setChecked    ( data.myToMakeGroupsOfDomains );
-  myOptimizationLevelCombo                    ->setCurrentIndex( data.myOptimizationLevel );
+
+  if ( data.myAlgorithm == GHS3DPlugin_Hypothesis::MGTetraHPC && data.myOptimizationLevel == GHS3DPlugin_Hypothesis::StandardPlus /*not implemented by MGTetraHPC*/ )
+    myOptimizationLevelCombo                    ->setCurrentIndex( GHS3DPlugin_Hypothesis::None );
+  else
+    myOptimizationLevelCombo                    ->setCurrentIndex( data.myOptimizationLevel );
+  
   if ( myOptimizationCombo ) // optimizer
   {
     myOptimizationCombo                         ->setCurrentIndex( data.myOptimization );
@@ -1471,14 +1594,19 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
   }
   else
   {
-    myMinSizeSpin->setValue( data.myMinSize );
-    myMinSizeCheck->setChecked( data.myUseMinSize );
-    myMaxSizeSpin->setValue( data.myMaxSize );
-    myMaxSizeCheck->setChecked( data.myUseMaxSize );
-    myGradationCheck->setChecked( data.myUseGradation );
-    myGradationSpin->setValue( data.myUseGradation ? data.myGradation : GHS3DPlugin_Hypothesis::DefaultGradation() );
-    myUseProximityGroup->setChecked( data.myUseProximity );
-    myNbProximityLayers->setValue( data.myNbProximityLayers );
+    myRadioBottomGroup  ->button( data.myAlgorithm )->setChecked( true );
+    myMinSizeSpin       ->setValue( data.myMinSize );
+    myMinSizeCheck      ->setChecked( data.myUseMinSize );
+    myMaxSizeSpin       ->setValue( data.myMaxSize );
+    myMaxSizeCheck      ->setChecked( data.myUseMaxSize );
+    myGradationCheck    ->setChecked( data.myUseGradation );
+    myGradationSpin     ->setValue( data.myUseGradation ? data.myGradation : GHS3DPlugin_Hypothesis::DefaultGradation() );
+    myUseProximityGroup ->setChecked( data.myUseProximity );
+    myNbProximityLayers ->setValue( data.myNbProximityLayers );
+    myNumOfThreadsCheck ->setChecked( data.myUseNumOfThreads );
+    myNumOfThreadsSpin  ->setValue( data.myNumOfThreads );    
+    myPthreadMode       ->setCurrentIndex( data.myPthreadMode );
+    myParallelMode      ->setCurrentIndex( data.myParallelMode );    
   }
   myAdvWidget->maxMemoryCheck                 ->setChecked    ( data.myMaximumMemory > 0 );
   myAdvWidget->maxMemorySpin                  ->setValue
@@ -1501,7 +1629,7 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
       myAdvWidget->AddOption( that->myCustomOptions[i].in() );
   }
   myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
-
+  myAdvWidget->EnableAdvancedOptions( data.myAlgorithm == GHS3DPlugin_Hypothesis::MGTetra );
 
   TEnfVertexList::const_iterator it;
   int rowCount = 0;
@@ -1703,6 +1831,7 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData&
     h_data.myNumberOfThreads      = 1;
     h_data.mySmoothOffSlivers     = 1;
   }
+  h_data.myAlgorithm                  = h->GetAlgorithm();
   h_data.myOptimizationLevel          = h->GetOptimizationLevel();
   h_data.myMinSize                    = h->GetMinSize();
   h_data.myMaxSize                    = h->GetMaxSize();
@@ -1731,6 +1860,10 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData&
   //h_data.myTextOption                 = h->GetAdvancedOption();
   h_data.myLogInStandardOutput        = h->GetStandardOutputLog();
   h_data.myRemoveLogOnSuccess         = h->GetRemoveLogOnSuccess();
+  h_data.myUseNumOfThreads            = h->GetUseNumOfThreads();
+  h_data.myNumOfThreads               = h->GetNumOfThreads();
+  h_data.myPthreadMode                = h->GetPthreadMode();
+  h_data.myParallelMode               = h->GetParallelMode();
 
   GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
   that->myOptions       = h->GetOptionValues();
@@ -1791,19 +1924,28 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD
     if( isCreation() )
       SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() );
 
+    if ( opt->_is_nil() )
+    {
+      h->SetAlgorithm                   ((CORBA::Short) h_data.myAlgorithm );
+      h->SetUseNumOfThreads             ( h_data.myUseNumOfThreads     );
+      h->SetNumOfThreads                ( (CORBA::Short) h_data.myNumOfThreads        );
+      h->SetPthreadMode                 ( (CORBA::Short) h_data.myPthreadMode         );
+      h->SetParallelMode                ( (CORBA::Short) h_data.myParallelMode        );
+      h->SetGradation                   ( h_data.myGradation         );
+      h->SetToMeshHoles                 ( h_data.myToMeshHoles       );
+      h->SetToMakeGroupsOfDomains       ( h_data.myToMakeGroupsOfDomains );
+      h->SetVolumeProximity             ( h_data.myUseProximity      );
+      h->SetNbVolumeProximityLayers     ((CORBA::Short) h_data.myNbProximityLayers );
+    }
+
+    // Common existing options optimization a MGTetra && MGTetraHPC
     h->SetOptimizationLevel           ((CORBA::Short) h_data.myOptimizationLevel );
     h->SetMinSize                     ( h_data.myUseMinSize ? h_data.myMinSize : 0 );
     h->SetMaxSize                     ( h_data.myUseMaxSize ? h_data.myMaxSize : 0 );
     h->SetMinMaxSizeDefault           ( this->myMinSizeDefault, this->myMaxSizeDefault );
-    h->SetGradation                   ( h_data.myGradation         );
-    h->SetVolumeProximity             ( h_data.myUseProximity      );
-    h->SetNbVolumeProximityLayers     ((CORBA::Short) h_data.myNbProximityLayers );
-    h->SetToMeshHoles                 ( h_data.myToMeshHoles       );
-    h->SetToMakeGroupsOfDomains       ( h_data.myToMakeGroupsOfDomains );
 
     h->SetMaximumMemory               ( h_data.myMaximumMemory     );
     h->SetInitialMemory               ( h_data.myInitialMemory     );
-    h->SetInitialMemory               ( h_data.myInitialMemory     );
     h->SetKeepFiles                   ( h_data.myKeepFiles         );
     h->SetWorkingDirectory            ( h_data.myWorkingDir.toLatin1().constData() );
     h->SetVerboseLevel                ( h_data.myVerboseLevel      );
@@ -1812,6 +1954,7 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD
     //h->SetFEMCorrection               ( h_data.myFEMCorrection     );
     h->SetStandardOutputLog           ( h_data.myLogInStandardOutput );
     h->SetRemoveLogOnSuccess          ( h_data.myRemoveLogOnSuccess  );
+    
 
     if ( !opt->_is_nil() )
     {
@@ -1915,6 +2058,11 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisDat
     h_data.myNbProximityLayers     = myNbProximityLayers->value();
     h_data.myToMeshHoles           = myToMeshHolesCheck->isChecked();
     h_data.myToMakeGroupsOfDomains = myToMakeGroupsOfDomains->isChecked();
+    h_data.myAlgorithm             = myRadioBottomGroup->checkedId();
+    h_data.myUseNumOfThreads       = myNumOfThreadsCheck->isChecked();
+    h_data.myNumOfThreads          = myNumOfThreadsSpin->value();
+    h_data.myPthreadMode           = myPthreadMode->currentIndex();
+    h_data.myParallelMode          = myParallelMode->currentIndex();
   }
   h_data.myMaximumMemory           = float( myAdvWidget->maxMemoryCheck->isChecked() ? myAdvWidget->maxMemorySpin->value() : -1 );
   h_data.myInitialMemory           = float( myAdvWidget->initialMemoryCheck->isChecked() ? myAdvWidget->initialMemorySpin->value() : -1 );
index 2212dc51c4f9d5cc347c01d0069904dbc9f0c8c5..7a69145ba1817a21dfb1f211ea2252130146ecf7 100644 (file)
@@ -49,6 +49,7 @@
 #include CORBA_SERVER_HEADER(SMESH_Mesh)
 
 class QWidget;
+class QButtonGroup;
 class QComboBox;
 class QCheckBox;
 class QLineEdit;
@@ -156,6 +157,8 @@ typedef struct
   short   myVerboseLevel;
   TEnfVertexList myEnforcedVertices;
   TEnfMeshList myEnforcedMeshes;
+  short   myAlgorithm, myNumOfThreads, myPthreadMode, myParallelMode;
+  bool    myUseNumOfThreads;
 
   int myOptimization, mySplitOverConstrained, myPThreadsMode, myNumberOfThreads;
   bool mySmoothOffSlivers;
@@ -208,6 +211,8 @@ protected slots:
   void                onRemoveEnforcedMesh();
   //void                synchronizeEnforcedMesh();
   void                checkEnfMeshIsDefined();
+  void                onRadioButtonSelect();
+  void                onNumOfThreadsCheck();
   
 signals:
   void                vertexDefined(bool);
@@ -230,6 +235,8 @@ private:
   QCheckBox*            myMaxSizeCheck;
   SMESHGUI_SpinBox*     myMinSizeSpin;
   SMESHGUI_SpinBox*     myMaxSizeSpin;
+  QCheckBox*            myNumOfThreadsCheck;
+  SalomeApp_IntSpinBox* myNumOfThreadsSpin;
   mutable double        myMinSizeDefault, myMaxSizeDefault;
   // proximity
   QCheckBox*            myGradationCheck;
@@ -246,6 +253,9 @@ private:
   SalomeApp_IntSpinBox* myNumberOfThreadsSpin;
   QCheckBox*            mySmoothOffSliversCheck;
   QCheckBox*            myCreateNewNodesCheck;
+  QComboBox*            myPthreadMode;
+  QComboBox*            myParallelMode;
+  QButtonGroup*         myRadioBottomGroup;
 
   QWidget*                  myAdvGroup;
   GHS3DPluginGUI_AdvWidget* myAdvWidget;
index 52714931a741d43d2b3f8b4be560eb296abf37c0..e5cca7c5c58596c7e5b571479d40fa6f7753fbcc 100644 (file)
         <translation>Light</translation>
     </message>
     <message>
-        <source>LEVEL_MEDIUM</source>
-        <translation>Medium (standard)</translation>
+    <source>LEVEL_MEDIUM</source>
+    <translation>Medium (standard)</translation>
+    </message>
+    <message>
+        <source>GHS3D_PTHREAD_MODE</source>
+        <translation>Pthread Mode</translation>
+    </message>
+    <message>
+    <source>GHS3D_PARALLE_STRAT</source>
+    <translation>Parallel Strategy (HPC)</translation>
+    </message>
+     <message>
+    <source>MODE_NONE</source>
+    <translation>None</translation>
+    </message>
+    <message>
+        <source>MODE_AGGRESSIVE</source>
+        <translation>Aggressive</translation>
+    </message>
+    <message>
+        <source>MODE_SAFE</source>
+        <translation>Safe</translation>
+    </message>
+    <message>
+    <source>MODE_REPRODUCIBLE</source>
+    <translation>Reproducible</translation>
+    </message>
+    <message>
+    <source>MODE_REPRODUCIBLE_GIVEN_MAX_THREADS</source>
+    <translation>Reproducible Given Max Number of Threads</translation>
+    </message>
+    <message>
+        <source>GHS3D_ALGO_SELECTION</source>
+        <translation>Algorithm selection</translation>
+    </message>
+    <message>
+        <source>GHS3D_ALGO_MGTETRA</source>
+        <translation>MG-Tetra</translation>
+    </message>
+    <message>
+        <source>GHS3D_ALGO_MGTETRAHPC</source>
+        <translation>MG-Tetra HPC</translation>
+    </message>
+    <message>
+        <source>GHS3D_THREADS_SIZE</source>
+        <translation>Maximal number of threads</translation>
     </message>
     <message>
         <source>LEVEL_STANDARDPLUS</source>
index 37f7e4a4486ed08b0a8f19ce8b7d92fd74dc9667..b42f7bbab77d646b75e88fdeb4884d7d4f071f1e 100644 (file)
         <source>LEVEL_MEDIUM</source>
         <translation>Moyen (standard)</translation>
     </message>
+    <message>
+        <source>GHS3D_PTHREAD_MODE</source>
+        <translation>Mode Pthread</translation>
+    </message>
+    <message>
+    <source>GHS3D_PARALLE_STRAT</source>
+    <translation>Statégie Parallèle(HPC)</translation>
+    </message>
+     <message>
+    <source>MODE_NONE</source>
+    <translation>Zéro</translation>
+    </message>
+    <message>
+        <source>MODE_AGGRESSIVE</source>
+        <translation>Agressif</translation>
+    </message>
+    <message>
+        <source>MODE_SAFE</source>
+        <translation>Sûr</translation>
+    </message>
+    <message>
+    <source>MODE_REPRODUCIBLE</source>
+    <translation>Reproductible</translation>
+    </message>
+    <message>
+    <source>MODE_REPRODUCIBLE_GIVEN_MAX_THREADS</source>
+    <translation>Reproductible étant donné le nombre max de threads</translation>
+    </message>
+    <message>
+        <source>GHS3D_ALGO_SELECTION</source>
+        <translation>Sélection d&apos;algorithme</translation>
+    </message>
+    <message>
+        <source>GHS3D_ALGO_MGTETRA</source>
+        <translation>MG-Tetra</translation>
+    </message>
+    <message>
+        <source>GHS3D_ALGO_MGTETRAHPC</source>
+        <translation>MG-Tetra HPC</translation>
+    </message>
+    <message>
+        <source>GHS3D_THREADS_SIZE</source>
+        <translation>Nombre max de threads</translation>
+    </message>
     <message>
         <source>LEVEL_STANDARDPLUS</source>
         <translation>Standard+</translation>