Salome HOME
Merge multi-study removal branch. Before_python3_27062017
authorrnv <rnv@opencascade.com>
Thu, 8 Jun 2017 14:20:35 +0000 (17:20 +0300)
committerrnv <rnv@opencascade.com>
Thu, 8 Jun 2017 14:20:35 +0000 (17:20 +0300)
37 files changed:
CMakeLists.txt
doc/salome/examples/ghs3d_optimization.py [new file with mode: 0644]
doc/salome/gui/GHS3DPLUGIN/images/mgtetra_optim_adv_params.png [new file with mode: 0644]
doc/salome/gui/GHS3DPLUGIN/images/mgtetra_optim_gen_params.png [new file with mode: 0644]
doc/salome/gui/GHS3DPLUGIN/input/ghs3dplugin_python_interface.doc
doc/salome/gui/GHS3DPLUGIN/input/index.doc
doc/salome/gui/GHS3DPLUGIN/input/optimization_hypo.doc [new file with mode: 0644]
doc/salome/gui/GHS3DPLUGIN/static/footer.html
idl/GHS3DPlugin_Algorithm.idl
resources/GHS3DPlugin.xml
src/GHS3DPlugin/CMakeLists.txt
src/GHS3DPlugin/GHS3DPluginBuilder.py
src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx
src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx
src/GHS3DPlugin/GHS3DPlugin_GHS3D_i.cxx
src/GHS3DPlugin/GHS3DPlugin_GHS3D_i.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_Optimizer.cxx [new file with mode: 0644]
src/GHS3DPlugin/GHS3DPlugin_Optimizer.hxx [new file with mode: 0644]
src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis.cxx [new file with mode: 0644]
src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis.hxx [new file with mode: 0644]
src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis_i.cxx [new file with mode: 0644]
src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis_i.hxx [new file with mode: 0644]
src/GHS3DPlugin/GHS3DPlugin_i.cxx
src/GHS3DPlugin/MG_Tetra_API.cxx
src/GHS3DPlugin/MG_Tetra_API.hxx
src/GUI/GHS3DPluginGUI.cxx
src/GUI/GHS3DPluginGUI_AdvWidget_QTD.ui
src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx
src/GUI/GHS3DPluginGUI_HypothesisCreator.h
src/GUI/GHS3DPlugin_images.ts
src/GUI/GHS3DPlugin_msg_en.ts
src/GUI/GHS3DPlugin_msg_fr.ts
src/GUI/GHS3DPlugin_msg_ja.ts

index 1b633fec93b25fe39574b05460692a27ae187928..15d6dbb385d10a94408cdd2a75f01bd1bde0532f 100755 (executable)
@@ -31,7 +31,7 @@ ENDIF(WIN32)
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
 
 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 1)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 3)
 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
 SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
diff --git a/doc/salome/examples/ghs3d_optimization.py b/doc/salome/examples/ghs3d_optimization.py
new file mode 100644 (file)
index 0000000..a7ecaf6
--- /dev/null
@@ -0,0 +1,60 @@
+# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+
+import salome
+salome.salome_init()
+
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+from salome.smesh import smeshBuilder
+smesh =  smeshBuilder.New(salome.myStudy)
+
+# create a disk
+disk = geompy.MakeDiskR(100., 1, theName="disk")
+
+# triangulate the disk
+mesh = smesh.Mesh( disk )
+cadsurf = mesh.Triangle( smeshBuilder.MG_CADSurf )
+cadsurf.SetQuadAllowed( True )
+mesh.Compute()
+
+# extrude the 2D mesh into a prismatic mesh
+mesh.ExtrusionSweepObject( mesh, [0,0,10], 7 )
+
+# split prisms into tetrahedra
+mesh.SplitVolumesIntoTetra( mesh )
+
+# copy the mesh into a new mesh, since only a mesh not based of geometry
+# can be optimized using MG-Tetra Optimization
+optMesh = smesh.CopyMesh( mesh, "optimization" )
+
+# add MG-Tetra Optimization
+mg_opt = optMesh.Tetrahedron( smeshBuilder.MG_Tetra_Optimization )
+mg_opt.SetSmoothOffSlivers( True )
+mg_opt.SetOptimizationLevel( smeshBuilder.Strong_Optimization )
+
+# run optimization
+optMesh.Compute()
+
+print "Nb tetra before optimization", mesh.NbTetras()
+print "Nb tetra after  optimization", optMesh.NbTetras()
+
+# End of script
+
diff --git a/doc/salome/gui/GHS3DPLUGIN/images/mgtetra_optim_adv_params.png b/doc/salome/gui/GHS3DPLUGIN/images/mgtetra_optim_adv_params.png
new file mode 100644 (file)
index 0000000..4f308c1
Binary files /dev/null and b/doc/salome/gui/GHS3DPLUGIN/images/mgtetra_optim_adv_params.png differ
diff --git a/doc/salome/gui/GHS3DPLUGIN/images/mgtetra_optim_gen_params.png b/doc/salome/gui/GHS3DPLUGIN/images/mgtetra_optim_gen_params.png
new file mode 100644 (file)
index 0000000..35a1a68
Binary files /dev/null and b/doc/salome/gui/GHS3DPLUGIN/images/mgtetra_optim_gen_params.png differ
index ad46d523f556414e392f9f9cb5d127bab81a3ea2..3a75b5a1302acb57e72cd198782f24e0bb718e96 100644 (file)
@@ -24,6 +24,7 @@ Below you can see examples of usage of this class for tetrahedral mesh generatio
 -# \ref tui_ghs3d_basic
 -# \ref tui_ghs3d_enforced_vertices
 -# \ref tui_ghs3d_enforced_meshes
+-# \ref tui_ghs3d_optimization
 
 \section tui_ghs3d_basic Construction of Mesh using MG-Tetra algorithm
 
@@ -57,6 +58,11 @@ Below you can see examples of usage of this class for tetrahedral mesh generatio
 \image html ghs3d_screenshot_enf5.png
 \image html ghs3d_screenshot_enf6.png
 
+\section tui_ghs3d_optimization Mesh optimization
+
+<h2>Example of mesh optimization with MG-Tetra Optimization:</h2>
+\tui_script{ghs3d_optimization.py}
+
 \ref tui_ghs3d "Back to top"
 
 */
index bcc3e4af0d0253a6def434a62baeeb74346592fc..9313082eac8cde69d589552d3ee336c32f5d3cb2 100644 (file)
@@ -2,18 +2,28 @@
 
 \mainpage Introduction to MG-Tetra plug-in
 
-\b MG-Tetra plug-in adds MG-Tetra (former GHS3D) meshing
-algorithm to the SALOME Mesh module.
+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 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.
+  - Meshing 3D geometric entities: solids are split into tetrahedral (pyramidal) elements.
+  - Generating 3D meshes from 2D meshes (triangles and quadrangles), working without geometrical objects.
+
+<b>MG-Tetra Optimization</b> algorithm optimizes linear tetrahedral
+meshes not based on geometry. 
+- To be able to optimize a mesh generated on geometry, copy
+this mesh (menu <b>Mesh > Copy Mesh</b>) and assign MG-Tetra
+Optimization algorithm to the new mesh in <b>Edit Mesh</b> dialog.
+- To re-optimize a just optimized mesh, invoke <b>Clear Mesh
+  Data</b> command and then \b Compute the mesh again.
 
 \note MG-Tetra plug-in uses MG-Tetra commercial mesher and requires a
 license to be used within the Mesh module.
 To obtain a license, visit http://www.meshgems.com/meshgems-products.html
 
-To manage parameters of the MG-Tetra mesher use \subpage ghs3d_hypo_page and \subpage additional_hypo_page
+To manage parameters of the MG-Tetra mesher use 
+\subpage ghs3d_hypo_page and \subpage additional_hypo_page. 
+Parameters of MG-Tetra Optimization can be managed via \subpage optimization_page.
 
 Also all MG-Tetra functionalities are accessible via
 \subpage ghs3dplugin_python_interface_page "MG-Tetra Python interface".
diff --git a/doc/salome/gui/GHS3DPLUGIN/input/optimization_hypo.doc b/doc/salome/gui/GHS3DPLUGIN/input/optimization_hypo.doc
new file mode 100644 (file)
index 0000000..e1868b5
--- /dev/null
@@ -0,0 +1,122 @@
+/*!
+
+\page optimization_page MG-Tetra Optimization Parameters hypothesis
+
+\anchor optimization_top
+MG-Tetra Optimization Parameters hypothesis works only
+with <b>MG-Tetra Optimization</b> 
+algorithm. This algorithm is a commercial software.
+
+To get a license, visit http://www.meshgems.com/meshgems-products.html
+
+\tableofcontents
+
+\section mgtetra_optim_gen_params General parameters
+
+\image html mgtetra_optim_gen_params.png
+
+- <b>Name</b> - allows to define the name of the hypothesis (MG-Tetra
+Parameters by default).
+
+- <b>Optimization</b> - sets the optimisation type. If <b>Optimization</b> is:
+  - No : no optimisation is applied
+  - Yes (default): optimisation is performed upon mesh generation using
+          the <b>Optimisation level</b> parameter 
+  - Only : only optimisation is performed to an existing mesh.
+
+- <b>Optimization level</b> - allows choosing the required
+optimization level (higher level of optimization provides better mesh,
+but can be time-consuming):
+  - none
+  - light
+  - medium (standard)
+  - standard+
+  - strong
+
+- <b>Split overconstrained elements</b> - sets treatment of element
+having all their vertices on the input surface. 
+If <b>Split overconstrained elements</b> is:
+  - No (default): no correction is applied
+  - Yes : correction is applied upon mesh generation
+  - Only : only correction is applied to an existing mesh.
+
+- <b>PThreads mode</b> - sets optimization mode when using multithread
+capabilities. Valid values are:
+  - Safe : slower but quality can only get better
+  - Aggressive : faster but quality may be altered
+  - None (default): not activated.
+
+- <b>Max number of threads</b> - sets the maximum number of threads to
+be used in parallel.
+
+- <b>Smooth off sliver elements</b> - activates elimination of sliver
+elements as much as possible.
+
+- <b>Create new nodes</b> - allows insertion of new nodes.
+
+\ref optimization_top "Back to top"
+
+
+\section ghs3d_advanced_parameters Advanced parameters
+
+\image html mgtetra_optim_adv_params.png
+
+\subsection memory_settings Memory settings
+
+- <b>Initial memory size</b> - starts MG-Tetra software with
+the specified amount of work space, in Mbytes. If this option is checked off, the
+software will be started with 100 Megabytes of working space.
+
+- <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
+checked off, the software will be launched with 7O% of the total RAM space.
+
+\subsection log Logs and debug
+
+- <b>Working directory</b> - allows defining the folder for input and output
+files of MG-Tetra software, which are the files starting with "GHS3D_" prefix.
+
+- <b>Verbose level</b> - to choose verbosity level in the range from
+0 to 10.
+
+  - 0, no standard output,
+
+  - 2, prints the data, quality statistics of the skin and final
+  meshes and indicates when the final mesh is being saved. In addition
+  the software gives indication regarding the CPU time.
+
+  - 10, same as 2 plus the main steps in the computation, quality
+  statistics histogram of the skin mesh, quality statistics histogram
+  together with the characteristics of the final mesh.
+  
+- <b>Print log in a file</b> - if this option is checked on the log is
+printed in a file placed in the working directory, otherwise it is
+printed on the standard output.
+
+- <b>Remove log on success</b> - if this option is checked on the log
+file is kept only if an error occurs during the computation. This
+option is only available if <b>Print log in a file</b> is enabled
+(there must be a log file to delete it) and <b>Keep all working
+  files</b> is disabled (in this case the log file is always kept).
+
+- <b>Keep all working files</b> - allows checking input and output
+files of MG-Tetra software, while usually these files are removed
+after the launch of the mesher. The log file (if any) is also kept if
+this option is checked.
+
+\subsection advanced_meshing_options Advanced meshing options
+
+- A table 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.
+
+<br><b>See Also</b> a sample TUI Script of the 
+\ref tui_ghs3d "creation of a MG-Tetra Optimization hypothesis".
+
+\ref optimization_top "Back to top"
+
+*/
index de6db6a6c6d55ea90befc28cce87b52271f01395..b52879b324cd1a20463b652cf748696954337439 100755 (executable)
@@ -4,7 +4,7 @@
   <ul>
     $navpath
     <li class="footer">
-      Copyright &copy; 2007-2016  CEA/DEN, EDF R&amp;D<br>
+      Copyright &copy; 2007-2017  CEA/DEN, EDF R&amp;D<br>
     </li>
   </ul>
 </div>
index f18b3ac5cc463369af973eb1ee92033936e897f0..262d08209249ad5e1cf044c2cd746228404f408a 100644 (file)
@@ -54,7 +54,7 @@ module GHS3DPlugin
   typedef sequence<GHS3DEnforcedMesh> GHS3DEnforcedMeshList;
 
   /*!
-   * GHS3DPlugin_GHS3D: interface of "Tetrahedron (GHS3D)" algorithm
+   * GHS3DPlugin_GHS3D: interface of "MG-Tetra" algorithm
    */
   interface GHS3DPlugin_GHS3D : SMESH::SMESH_3D_Algo
   {
@@ -62,7 +62,7 @@ module GHS3DPlugin
   };
 
   /*!
-   * Parameters of "Tetrahedron (GHS3D)" algorithm
+   * Parameters of "MG-Tetra" algorithm
    */
   interface GHS3DPlugin_Hypothesis : SMESH::SMESH_Hypothesis
   {
@@ -82,15 +82,15 @@ module GHS3DPlugin
      * Maximal size of memory to be used by the algorithm (in Megabytes).
      * Negative value means not to use this option
      */
-    void SetMaximumMemory(in long MB) raises (SALOME::SALOME_Exception);
-    long GetMaximumMemory();
+    void SetMaximumMemory(in float MB) raises (SALOME::SALOME_Exception);
+    float GetMaximumMemory();
     /*!
      * Initial size of memory to be used by the algorithm (in Megabytes) in
      * automatic memory adjustment mode. Default is zero.
      * Negative value means not to use this option
      */
-    void SetInitialMemory(in long MB) raises (SALOME::SALOME_Exception);
-    long GetInitialMemory();
+    void SetInitialMemory(in float MB) raises (SALOME::SALOME_Exception);
+    float GetInitialMemory();
     /*!
      * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium
      */
@@ -202,6 +202,49 @@ module GHS3DPlugin
     */
     boolean p_SetEnforcedMesh(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in string name, in string groupName) raises (SALOME::SALOME_Exception);
   };
+
+  /*!
+   * GHS3DPlugin_Optimizer: interface of "MG-Tetra Optimization" algorithm
+   */
+  interface GHS3DPlugin_Optimizer : SMESH::SMESH_3D_Algo
+  {
+  };
+
+  enum PThreadsMode { SAFE, AGGRESSIVE, NONE };
+  enum Mode { NO, YES, ONLY };
+
+  /*!
+   * Parameters of "MG-Tetra Optimization" algorithm
+   *
+   * params inherited from GHS3DPlugin_Hypothesis:
+   * - create new nodes
+   * - optimization level
+   * - init and max memory
+   * - work dir
+   * - verbosity
+   * - log to file
+   * - keep work files
+   * - remove log file
+   * - advanced options
+   */
+  interface GHS3DPlugin_OptimizerHypothesis: GHS3DPlugin_Hypothesis
+  {
+    void SetOptimization( in Mode optMode );
+    Mode GetOptimization();
+
+    void SetSplitOverConstrained( in Mode ovcMode );
+    Mode GetSplitOverConstrained();
+
+    void SetSmoothOffSlivers( in boolean toSmooth );
+    boolean GetSmoothOffSlivers();
+
+    void SetPThreadsMode( in PThreadsMode mode );
+    PThreadsMode GetPThreadsMode();
+
+    void SetMaximalNumberOfThreads( in short nb );
+    short GetMaximalNumberOfThreads();
+  };
+
 };
 
 #endif
index 684b313c53833d9d919f8147c577bf690f9f152b..1989d2087be54e9f0298dec71fa602436cf13e5c 100644 (file)
         </accumulative-methods>
       </python-wrap>
     </hypothesis>
+
+    <hypothesis type    ="MG-Tetra Optimization Parameters"
+                label-id="MG-Tetra Optimization Parameters"
+                icon-id ="mesh_hypo_ghs3d.png"
+                dim     ="3">
+    </hypothesis>
+
   </hypotheses>
 
   <algorithms>
       </python-wrap>
     </algorithm>
 
+    <algorithm type     ="MG-Tetra Optimization"
+               label-id ="MG-Tetra Optimization"
+               icon-id  ="mesh_tree_hypo_ghs3d.png"
+               group-id ="2"
+               input    ="TETRA"
+               output   ="TETRA"
+               need-geom="never"
+               opt-hypos="MG-Tetra Optimization Parameters"
+               dim      ="3">
+      <python-wrap>
+        <algo>MG-Tetra Optimization=Tetrahedron(algo=smeshBuilder.MG_Tetra_Optimization)</algo>
+        <hypo>MG-Tetra Optimization Parameters=Parameters()</hypo>
+      </python-wrap>
+    </algorithm>
+
   </algorithms>
 </meshers-group>
 
index 1f49d548e1deec2f0858935f52dd976ce17309f5..0747cb898d9170784788b7229a93010278bcbcfb 100644 (file)
@@ -71,6 +71,9 @@ SET(GHS3DEngine_HEADERS
   GHS3DPlugin_GHS3D_i.hxx
   GHS3DPlugin_Hypothesis.hxx
   GHS3DPlugin_Hypothesis_i.hxx
+  GHS3DPlugin_Optimizer.hxx
+  GHS3DPlugin_OptimizerHypothesis.hxx
+  GHS3DPlugin_OptimizerHypothesis_i.hxx
   MG_Tetra_API.hxx
 )
 
@@ -83,6 +86,9 @@ SET(GHS3DEngine_SOURCES
   GHS3DPlugin_i.cxx
   GHS3DPlugin_Hypothesis.cxx
   GHS3DPlugin_Hypothesis_i.cxx
+  GHS3DPlugin_Optimizer.cxx
+  GHS3DPlugin_OptimizerHypothesis.cxx
+  GHS3DPlugin_OptimizerHypothesis_i.cxx
   MG_Tetra_API.cxx
 )
 
index 2d1a630a33ad7b2a4792f9e20987100e542c456e..d65efc58b87cec9da5bc388696b3128d112e6699 100644 (file)
@@ -38,6 +38,12 @@ None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization
 # V4.1 (partialy redefines V3.1). Issue 0020574
 None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization, Strong_Optimization = 0,1,2,3,4
 
+# import items of enums
+for e in GHS3DPlugin.Mode._items: exec('%s = GHS3DPlugin.%s'%(e,e))
+for e in GHS3DPlugin.PThreadsMode._items: exec('%s = GHS3DPlugin.%s'%(e,e))
+Mode_NO, Mode_YES, Mode_ONLY = GHS3DPlugin.Mode._items
+Mode_SAFE, Mode_AGGRESSIVE, Mode_NONE = GHS3DPlugin.PThreadsMode._items
+
 #----------------------------
 # Mesh algo type identifiers
 #----------------------------
@@ -45,6 +51,7 @@ None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optim
 ## Algorithm type: MG-Tetra tetrahedron 3D algorithm, see GHS3D_Algorithm
 MG_Tetra = "MG-Tetra"
 GHS3D = MG_Tetra
+MG_Tetra_Optimization = "MG-Tetra Optimization"
 
 ## Tetrahedron MG-Tetra 3D algorithm
 #  
@@ -59,7 +66,7 @@ class GHS3D_Algorithm(Mesh_Algorithm):
     algoType   = MG_Tetra
     ## doc string of the method in smeshBuilder.Mesh class
     #  @internal
-    docHelper  = "Creates tetrahedron 3D algorithm for volumes"
+    docHelper  = "Creates tetrahedron 3D algorithm"
 
     ## Private constructor.
     #  @param mesh parent mesh object algorithm is assigned to
@@ -270,3 +277,169 @@ class GHS3D_Algorithm(Mesh_Algorithm):
         pass
     
     pass # end of GHS3D_Algorithm class
+
+
+## MG-Tetra Optimization algorithm - optimizer of tetrahedral meshes
+#
+#  It can be created by calling smeshBuilder.Mesh.Tetrahedron( smeshBuilder.MG_Tetra_Optimization )
+class GHS3D_Optimizer(GHS3D_Algorithm):
+
+    ## name of the dynamic method in smeshBuilder.Mesh class
+    #  @internal
+    meshMethod = "Tetrahedron"
+    ## type of algorithm used with helper function in smeshBuilder.Mesh class
+    #  @internal
+    algoType   = MG_Tetra_Optimization
+    ## doc string of the method in smeshBuilder.Mesh class
+    #  @internal
+    docHelper  = "Creates MG-Tetra optimizer of tetrahedral meshes"
+
+    ## Private constructor.
+    #  @param mesh parent mesh object algorithm is assigned to
+    #  @param geom - not used
+    def __init__(self, mesh, geom=0):
+        GHS3D_Algorithm.__init__(self, mesh)
+
+        # remove some inherited methods
+        # del self.SetToMeshHoles
+        # del self.SetToMakeGroupsOfDomains
+        # del self.SetToUseBoundaryRecoveryVersion
+        # del self.SetFEMCorrection
+        # del self.SetToRemoveCentralPoint
+        # del self.SetEnforcedVertex
+        # del self.SetEnforcedVertexGeom
+        # del self.RemoveEnforcedVertex
+        # del self.RemoveEnforcedVertexGeom
+        # del self.SetEnforcedMesh
+        # del self.SetTextOption
+        pass
+
+    ## Defines hypothesis having several parameters
+    #  @return hypothesis object
+    def Parameters(self):
+        if not self.params:
+            self.params = self.Hypothesis("MG-Tetra Optimization Parameters", [],
+                                          "libGHS3DEngine.so", UseExisting=0)
+            pass
+        return self.params
+
+    ## Set Optimization mode
+    #  @param optMode optimization mode, one of the following values:
+    #  smeshBuilder.Mode_NO,
+    #  smeshBuilder.Mode_YES (default),
+    #  smeshBuilder.MODE_ONLY
+    def SetOptimizationOnly(self, optMode ):
+        self.Parameters().SetOptimizationOnly(optMode)
+        pass
+
+    ## Set mode of splitting over-constrained elements
+    #  @param ovcMode, one of the following values
+    #  smeshBuilder.Mode_NO (default),
+    #  smeshBuilder.Mode_YES,
+    #  smeshBuilder.Mode_ONLY
+    def SetSplitOverConstrained(self, ovcMode ):
+        self.Parameters().SetSplitOverConstrained(ovcMode)
+        pass
+
+    ## Activate smoothing sliver elements:
+    #  @param toSmooth - Boolean flag
+    def SetSmoothOffSlivers(self, toSmooth ):
+        self.Parameters().SetSmoothOffSlivers(toSmooth)
+        pass
+
+    ## Set multithread mode
+    #  @param mode - the mode, one of the following values:
+    #  smeshBuilder.Mode_SAFE,
+    #  smeshBuilder.Mode_AGGRESSIVE,
+    #  smeshBuilder.Mode_NONE (default)
+    def SetPThreadsMode(self, mode ):
+        self.Parameters().SetPThreadsMode(mode)
+        pass
+
+    ## Set maximal number of threads
+    #  @param nb - number of threads
+    def SetMaximalNumberOfThreads(self, nb ):
+        self.Parameters().SetMaximalNumberOfThreads(nb)
+        pass
+
+
+    ## Set Optimization level:
+    #  @param level optimization level, one of the following values
+    #  - None_Optimization
+    #  - Light_Optimization
+    #  - Standard_Optimization
+    #  - StandardPlus_Optimization
+    #  - Strong_Optimization.
+    #  .
+    #  Default is Standard_Optimization
+    def SetOptimizationLevel(self, level):
+        self.Parameters().SetOptimizationLevel(level)
+        pass
+
+    ## Set maximal size of memory to be used by the algorithm (in Megabytes).
+    #  @param MB maximal size of memory
+    def SetMaximumMemory(self, MB):
+        self.Parameters().SetMaximumMemory(MB)
+        pass
+
+    ## Set initial size of memory to be used by the algorithm (in Megabytes) in
+    #  automatic memory adjustment mode.
+    #  @param MB initial size of memory
+    def SetInitialMemory(self, MB):
+        self.Parameters().SetInitialMemory(MB)
+        pass
+
+    ## Set path to working directory.
+    #  @param path working directory
+    def SetWorkingDirectory(self, path):
+        self.Parameters().SetWorkingDirectory(path)
+        pass
+
+    ## To keep working files or remove them.
+    #  @param toKeep "keep working files" flag value
+    def SetKeepFiles(self, toKeep):
+        self.Parameters().SetKeepFiles(toKeep)
+        pass
+
+    ## Remove or not the log file (if any) in case of successful computation.
+    #  The log file remains in case of errors anyway. If
+    #  the "keep working files" flag is set to true, this option
+    #  has no effect.
+    #  @param toRemove "remove log on success" flag value
+    def SetRemoveLogOnSuccess(self, toRemove):
+        self.Parameters().SetRemoveLogOnSuccess(toRemove)
+        pass
+
+    ## Print the the log in a file. If set to false, the
+    # log is printed on the standard output
+    #  @param toPrintLogInFile "print log in a file" flag value
+    def SetPrintLogInFile(self, toPrintLogInFile):
+        self.Parameters().SetStandardOutputLog(not toPrintLogInFile)
+        pass
+
+    ## Set verbosity level [0-10].
+    #  @param level verbosity level
+    #  - 0 - no standard output,
+    #  - 2 - prints the data, quality statistics of the skin and final meshes and
+    #    indicates when the final mesh is being saved. In addition the software
+    #    gives indication regarding the CPU time.
+    #  - 10 - same as 2 plus the main steps in the computation, quality statistics
+    #    histogram of the skin mesh, quality statistics histogram together with
+    #    the characteristics of the final mesh.
+    def SetVerboseLevel(self, level):
+        self.Parameters().SetVerboseLevel(level)
+        pass
+
+    ## To create new nodes.
+    #  @param toCreate "create new nodes" flag value
+    def SetToCreateNewNodes(self, toCreate):
+        self.Parameters().SetToCreateNewNodes(toCreate)
+        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_Optimizer class
index daad21397b37f8bf56b1acfebc326f61289403b9..fd943e4bdfeac4d8f608f372ef27a2a401c236d9 100644 (file)
@@ -135,7 +135,6 @@ static void removeFile( const TCollection_AsciiString& fileName )
 GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D(int hypId, SMESH_Gen* gen)
   : SMESH_3D_Algo(hypId, gen), _isLibUsed( false )
 {
-  MESSAGE("GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D");
   _name = Name();
   _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type
   _onlyUnaryInput = false; // Compute() will be called on a compound of solids
@@ -151,18 +150,17 @@ GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D(int hypId, SMESH_Gen* gen)
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
 GHS3DPlugin_GHS3D::~GHS3DPlugin_GHS3D()
 {
-  MESSAGE("GHS3DPlugin_GHS3D::~GHS3DPlugin_GHS3D");
 }
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -190,8 +188,8 @@ bool GHS3DPlugin_GHS3D::CheckHypothesis ( SMESH_Mesh&         aMesh,
   }
   if ( _hyp )
   {
-    _keepFiles = _hyp->GetKeepFiles();
-    _removeLogOnSuccess = _hyp->GetRemoveLogOnSuccess();
+    _keepFiles           = _hyp->GetKeepFiles();
+    _removeLogOnSuccess  = _hyp->GetRemoveLogOnSuccess();
     _logInStandardOutput = _hyp->GetStandardOutputLog();
   }
 
@@ -209,7 +207,8 @@ bool GHS3DPlugin_GHS3D::CheckHypothesis ( SMESH_Mesh&         aMesh,
 
 TopoDS_Shape GHS3DPlugin_GHS3D::entryToShape(std::string entry)
 {
-  MESSAGE("GHS3DPlugin_GHS3D::entryToShape "<<entry );
+  if ( SMESH_Gen_i::getStudyServant()->_is_nil() )
+    throw SALOME_Exception("MG-Tetra plugin can't work w/o publishing in the study");
 
   GEOM::GEOM_Object_var aGeomObj;
   TopoDS_Shape S = TopoDS_Shape();
@@ -226,8 +225,9 @@ TopoDS_Shape GHS3DPlugin_GHS3D::entryToShape(std::string entry)
 
 //================================================================================
 /*!
- * \brief returns id of a solid if a triangle defined by the nodes is a temporary face on a
- * side facet of pyramid and defines sub-domian outside the pyramid; else returns HOLE_ID
+ * \brief returns id of a solid if a triangle defined by the nodes is a temporary face
+ * either on a side facet of pyramid or a top of pentahedron and defines sub-domian
+ * outside the volume; else returns HOLE_ID
  */
 //================================================================================
 
@@ -239,26 +239,34 @@ static int checkTmpFace(const SMDS_MeshNode* node1,
   SMDS_ElemIteratorPtr vIt1 = node1->GetInverseElementIterator(SMDSAbs_Volume);
   while ( vIt1->more() )
   {
-    const SMDS_MeshElement* pyram = vIt1->next();
-    if ( pyram->NbCornerNodes() != 5 ) continue;
+    const SMDS_MeshElement* vol = vIt1->next();
+    const int           nbNodes = vol->NbCornerNodes();
+    if ( nbNodes != 5 && nbNodes != 6 ) continue;
     int i2, i3;
-    if ( (i2 = pyram->GetNodeIndex( node2 )) >= 0 &&
-         (i3 = pyram->GetNodeIndex( node3 )) >= 0 )
+    if ( (i2 = vol->GetNodeIndex( node2 )) >= 0 &&
+         (i3 = vol->GetNodeIndex( node3 )) >= 0 )
     {
-      // Triangle defines sub-domian inside the pyramid if it's
-      // normal points out of the pyram
-
-      // make i2 and i3 hold indices of base nodes of the pyram while
-      // keeping the nodes order in the triangle
-      const int iApex = 4;
-      if ( i2 == iApex )
-        i2 = i3, i3 = pyram->GetNodeIndex( node1 );
-      else if ( i3 == iApex )
-        i3 = i2, i2 = pyram->GetNodeIndex( node1 );
-
-      int i3base = (i2+1) % 4; // next index after i2 within the pyramid base
-      bool isDomainInPyramid = ( i3base != i3 );
-      return isDomainInPyramid ? HOLE_ID : pyram->getshapeId();
+      if ( nbNodes == 5 )
+      {
+        // Triangle defines sub-domian inside the pyramid if it's
+        // normal points out of the vol
+
+        // make i2 and i3 hold indices of base nodes of the vol while
+        // keeping the nodes order in the triangle
+        const int iApex = 4;
+        if ( i2 == iApex )
+          i2 = i3, i3 = vol->GetNodeIndex( node1 );
+        else if ( i3 == iApex )
+          i3 = i2, i2 = vol->GetNodeIndex( node1 );
+
+        int i3base = (i2+1) % 4; // next index after i2 within the pyramid base
+        bool isDomainInPyramid = ( i3base != i3 );
+        return isDomainInPyramid ? HOLE_ID : vol->getshapeId();
+      }
+      else
+      {
+        return vol->getshapeId(); // triangle is a prism top
+      }
     }
   }
   return HOLE_ID;
@@ -290,7 +298,7 @@ static int findShapeID(SMESH_Mesh&          mesh,
   const SMDS_MeshElement * face = meshDS->FindElement( nodes, SMDSAbs_Face, /*noMedium=*/true);
   if ( !face )
     return checkTmpFace(node1, node2, node3);
-#ifdef _DEBUG_
+#ifdef _MY_DEBUG_
   std::cout << "bnd face " << face->GetID() << " - ";
 #endif
   // geom face the face assigned to
@@ -441,7 +449,6 @@ static void addElemInMeshGroup(SMESH_Mesh*             theMesh,
       SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( groupDS );
       aGroupDS->SMDSGroup().Add(anElem);
       groupDone = true;
-//       MESSAGE("Successfully added enforced element to existing group " << groupName);
       break;
     }
   }
@@ -453,7 +460,6 @@ static void addElemInMeshGroup(SMESH_Mesh*             theMesh,
     aGroup->SetName( groupName.c_str() );
     SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( aGroup->GetGroupDS() );
     aGroupDS->SMDSGroup().Add(anElem);
-//     MESSAGE("Successfully created enforced vertex group " << groupName);
     groupDone = true;
   }
   if (!groupDone)
@@ -477,7 +483,6 @@ static void updateMeshGroups(SMESH_Mesh* theMesh, std::set<std::string> groupsTo
     std::string currentGroupName = (string)group->GetName();
     if (groupDS->IsEmpty() && groupsToRemove.find(currentGroupName) != groupsToRemove.end()) {
       // Previous group created by enforced elements
-      MESSAGE("Delete previous group created by removed enforced elements: " << group->GetName())
       theMesh->RemoveGroup(groupDS->GetID());
     }
   }
@@ -588,16 +593,14 @@ static bool readGMFFile(MG_Tetra_API*                   MGOutput,
   const bool hasGeom = ( theHelper->GetMesh()->HasShapeToMesh() );
 
   int nbInitialNodes = theNodeByGhs3dId.size();
-  int nbMeshNodes = theMeshDS->NbNodes();
   
+#ifdef _MY_DEBUG_
   const bool isQuadMesh = 
     theHelper->GetMesh()->NbEdges( ORDER_QUADRATIC ) ||
     theHelper->GetMesh()->NbFaces( ORDER_QUADRATIC ) ||
     theHelper->GetMesh()->NbVolumes( ORDER_QUADRATIC );
-    
-#ifdef _DEBUG_
   std::cout << "theNodeByGhs3dId.size(): " << nbInitialNodes << std::endl;
-  std::cout << "theHelper->GetMesh()->NbNodes(): " << nbMeshNodes << std::endl;
+  std::cout << "theHelper->GetMesh()->NbNodes(): " << theMeshDS->NbNodes() << std::endl;
   std::cout << "isQuadMesh: " << isQuadMesh << std::endl;
 #endif
   
@@ -608,7 +611,7 @@ static bool readGMFFile(MG_Tetra_API*                   MGOutput,
   int nbElem = 0, nbRef = 0;
   int aGMFNodeID = 0;
   std::vector< const SMDS_MeshNode*> GMFNode;
-#ifdef _DEBUG_
+#ifdef _MY_DEBUG_
   std::map<int, std::set<int> > subdomainId2tetraId;
 #endif
   std::map <GmfKwdCod,int> tabRef;
@@ -625,11 +628,9 @@ static bool readGMFFile(MG_Tetra_API*                   MGOutput,
   tabRef[GmfHexahedra]      = 8;
 
   int ver, dim;
-  MESSAGE("Read " << theFile << " file");
   int InpMsh = MGOutput->GmfOpenMesh( theFile, GmfRead, &ver, &dim);
   if (!InpMsh)
     return false;
-  MESSAGE("Done ");
 
   // Read ids of domains
   vector< int > solidIDByDomain;
@@ -666,7 +667,7 @@ static bool readGMFFile(MG_Tetra_API*                   MGOutput,
             findShapeID( *theHelper->GetMesh(), nn[0], nn[1], nn[2], toMeshHoles );
           if ( solidIDByDomain[ domainNb ] > 0 )
           {
-#ifdef _DEBUG_
+#ifdef _MY_DEBUG_
             std::cout << "solid " << solidIDByDomain[ domainNb ] << std::endl;
 #endif
             const TopoDS_Shape& foundShape = theMeshDS->IndexToShape( solidIDByDomain[ domainNb ] );
@@ -796,7 +797,7 @@ static bool readGMFFile(MG_Tetra_API*                   MGOutput,
       (nbElem <= 1) ? tmpStr = " Tetrahedron" : tmpStr = " Tetrahedra";
       for ( int iElem = 0; iElem < nbElem; iElem++ ) {
         MGOutput->GmfGetLin( InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3], &domainID[iElem]);
-#ifdef _DEBUG_
+#ifdef _MY_DEBUG_
         subdomainId2tetraId[dummy].insert(iElem+1);
 #endif
       }
@@ -969,8 +970,7 @@ static bool readGMFFile(MG_Tetra_API*                   MGOutput,
   if ( toMakeGroupsOfDomains )
     makeDomainGroups( elemsOfDomain, theHelper );
 
-#ifdef _DEBUG_
-  MESSAGE("Nb subdomains " << subdomainId2tetraId.size());
+#ifdef _MY_DEBUG_
   std::map<int, std::set<int> >::const_iterator subdomainIt = subdomainId2tetraId.begin();
   TCollection_AsciiString aSubdomainFileName = theFile;
   aSubdomainFileName = aSubdomainFileName + ".subdomain";
@@ -980,7 +980,6 @@ static bool readGMFFile(MG_Tetra_API*                   MGOutput,
   for(;subdomainIt != subdomainId2tetraId.end() ; ++subdomainIt) {
     int subdomainId = subdomainIt->first;
     std::set<int> tetraIds = subdomainIt->second;
-    MESSAGE("Subdomain #"<<subdomainId<<": "<<tetraIds.size()<<" tetrahedrons");
     std::set<int>::const_iterator tetraIdsIt = tetraIds.begin();
     aSubdomainFile << subdomainId << std::endl;
     for(;tetraIdsIt != tetraIds.end() ; ++tetraIdsIt) {
@@ -1014,7 +1013,6 @@ static bool writeGMFFile(MG_Tetra_API*                                   MGInput
                          GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues & theEnforcedVertices,
                          int &                                           theInvalidEnforcedFlags)
 {
-  MESSAGE("writeGMFFile w/o geometry");
   std::string tmpStr;
   int idx, idxRequired = 0, idxSol = 0;
   const int dummyint = 0;
@@ -1650,8 +1648,8 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
   // MG-Tetra for domain indication
   SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( theMesh ));
 
-  // make prisms on quadrangles
-  if ( theMesh.NbQuadrangles() > 0 )
+  // make prisms on quadrangles and viscous layers
+  if ( theMesh.NbQuadrangles() > 0 || _viscousLayersHyp )
   {
     vector<SMESH_ProxyMesh::Ptr> components;
     for (expBox.ReInit(); expBox.More(); expBox.Next())
@@ -1662,21 +1660,24 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
         if ( !proxyMesh )
           return false;
       }
-      StdMeshers_QuadToTriaAdaptor* q2t = new StdMeshers_QuadToTriaAdaptor;
-      Ok = q2t->Compute( theMesh, expBox.Current(), proxyMesh.get() );
-      components.push_back( SMESH_ProxyMesh::Ptr( q2t ));
-      if ( !Ok )
-        return false;
+      if ( theMesh.NbQuadrangles() > 0 )
+      {
+        StdMeshers_QuadToTriaAdaptor* q2t = new StdMeshers_QuadToTriaAdaptor;
+        Ok = q2t->Compute( theMesh, expBox.Current(), proxyMesh.get() );
+        components.push_back( SMESH_ProxyMesh::Ptr( q2t ));
+        if ( !Ok )
+          return false;
+      }
     }
     proxyMesh.reset( new SMESH_ProxyMesh( components ));
   }
   // build viscous layers
-  else if ( _viscousLayersHyp )
-  {
-    proxyMesh = _viscousLayersHyp->Compute( theMesh, theShape );
-    if ( !proxyMesh )
-      return false;
-  }
+  // else if ( _viscousLayersHyp )
+  // {
+  //   proxyMesh = _viscousLayersHyp->Compute( theMesh, theShape );
+  //   if ( !proxyMesh )
+  //     return false;
+  // }
 
   int anInvalidEnforcedFlags = 0;
   Ok = writeGMFFile(&mgTetra,
@@ -1788,10 +1789,15 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
   }
   else if ( mgTetra.HasLog() )
   {
-    // get problem description from the log file
-    _Ghs2smdsConvertor conv( aNodeByGhs3dId, proxyMesh );
-    storeErrorDescription( _logInStandardOutput ? 0 : aLogFileName.ToCString(),
-                           mgTetra.GetLog(), conv );
+    if( _computeCanceled )
+      error( "interruption initiated by user" );
+    else
+    {
+      // get problem description from the log file
+      _Ghs2smdsConvertor conv( aNodeByGhs3dId, proxyMesh );
+      error( getErrorDescription( _logInStandardOutput ? 0 : aLogFileName.ToCString(),
+                                  mgTetra.GetLog(), conv ));
+    }
   }
   else if ( !errStr.empty() )
   {
@@ -1834,8 +1840,6 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
 bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
                                 SMESH_MesherHelper* theHelper)
 {
-  MESSAGE("GHS3DPlugin_GHS3D::Compute()");
-
   theHelper->IsQuadraticSubMesh( theHelper->GetSubShape() );
 
   // a unique working file name
@@ -2007,10 +2011,15 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
   }
   else if ( mgTetra.HasLog() )
   {
-    // get problem description from the log file
-    _Ghs2smdsConvertor conv( aNodeByGhs3dId, proxyMesh );
-    storeErrorDescription( _logInStandardOutput ? 0 : aLogFileName.ToCString(),
-                           mgTetra.GetLog(), conv );
+    if( _computeCanceled )
+      error( "interruption initiated by user" );
+    else
+    {
+      // get problem description from the log file
+      _Ghs2smdsConvertor conv( aNodeByGhs3dId, proxyMesh );
+      error( getErrorDescription( _logInStandardOutput ? 0 : aLogFileName.ToCString(),
+                                  mgTetra.GetLog(), conv ));
+    }
   }
   else {
     // the log file is empty
@@ -2035,8 +2044,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
 void GHS3DPlugin_GHS3D::CancelCompute()
 {
   _computeCanceled = true;
-#ifdef WIN32
-#else
+#if !defined WIN32 && !defined __APPLE__
   std::string cmd = "ps xo pid,args | grep " + _genericName;
   //cmd += " | grep -e \"^ *[0-9]\\+ \\+" + GHS3DPlugin_Hypothesis::GetExeName() + "\"";
   cmd += " | awk '{print $1}' | xargs kill -9 > /dev/null 2>&1";
@@ -2366,17 +2374,13 @@ static char* getIds( char* ptr, int nbIds, vector<int>& ids )
  */
 //================================================================================
 
-bool GHS3DPlugin_GHS3D::storeErrorDescription(const char*                logFile,
-                                              const std::string&         log,
-                                              const _Ghs2smdsConvertor & toSmdsConvertor )
+SMESH_ComputeErrorPtr
+GHS3DPlugin_GHS3D::getErrorDescription(const char*                logFile,
+                                       const std::string&         log,
+                                       const _Ghs2smdsConvertor & toSmdsConvertor,
+                                       const bool                 isOk/* = false*/ )
 {
-  if(_computeCanceled)
-    return error(SMESH_Comment("interruption initiated by user"));
-
-  // read file
-  // SMESH_File file( logFile.ToCString() );
-  // if ( file.size() == 0 )
-  //   return error( SMESH_Comment("See ") << logFile << " for problem description");
+  SMESH_ComputeErrorPtr err = SMESH_ComputeError::New( COMPERR_ALGO_FAILED );
 
   char* ptr = const_cast<char*>( log.c_str() );
   char* buf = ptr, * bufEnd = ptr + log.size();
@@ -2414,7 +2418,7 @@ bool GHS3DPlugin_GHS3D::storeErrorDescription(const char*                logFile
     if ( strncmp( ptr, "ERR ", 4 ) != 0 )
       continue;
 
-    list<const SMDS_MeshElement*> badElems;
+    list<const SMDS_MeshElement*>& badElems = err->myBadElements;
     vector<int> nodeIds;
 
     ptr += 4;
@@ -2588,13 +2592,6 @@ bool GHS3DPlugin_GHS3D::storeErrorDescription(const char*                logFile
 //         continue; // not to report different types of errors with bad elements
 //     }
 
-    // store bad elements
-    //if ( allElemsOk ) {
-      list<const SMDS_MeshElement*>::iterator elem = badElems.begin();
-      for ( ; elem != badElems.end(); ++elem )
-        addBadInputElement( *elem );
-      //}
-
     // make error text
     string text = translateError( errNum );
     if ( errDescription.find( text ) == text.npos ) {
@@ -2619,14 +2616,20 @@ bool GHS3DPlugin_GHS3D::storeErrorDescription(const char*                logFile
     }
   }
 
-  if ( logFile && logFile[0] )
+  if ( !isOk && logFile && logFile[0] )
   {
     if ( errDescription.empty() )
       errDescription << "See " << logFile << " for problem description";
     else
       errDescription << "\nSee " << logFile << " for more information";
   }
-  return error( errDescription );
+
+  err->myComment = errDescription;
+
+  if ( err->myComment.empty() && err->myBadElements.empty() )
+    err = SMESH_ComputeError::New(); // OK
+
+  return err;
 }
 
 //================================================================================
@@ -2924,7 +2927,7 @@ double GHS3DPlugin_GHS3D::GetProgress() const
   if ( _isLibUsed )
   {
     // this->_progress is advanced by MG_Tetra_API according to messages from MG library
-    // but sharply. Advanced it a bit to get smoother advancement.
+    // but sharply. Advance it a bit to get smoother advancement.
     GHS3DPlugin_GHS3D* me = const_cast<GHS3DPlugin_GHS3D*>( this );
     if ( _progress < 0.1 ) // the first message is at 10%
       me->_progress = GetProgressByTic();
index a52924f627835c2bffb1df2b0a83194c98048008..b01ea3c5c433dcaa2b38ba152251518a19d25368 100644 (file)
@@ -50,6 +50,7 @@ class TopoDS_Shape;
 class GHS3DPlugin_GHS3D: public SMESH_3D_Algo
 {
 public:
+
   GHS3DPlugin_GHS3D(int hypId, SMESH_Gen* gen);
   virtual ~GHS3DPlugin_GHS3D();
 
@@ -75,20 +76,23 @@ public:
 
   bool         importGMFMesh(const char* aGMFFileName, SMESH_Mesh& aMesh);
 
+  virtual double GetProgress() const;
+
+
   static const char* Name() { return "MG-Tetra"; }
 
-  virtual double GetProgress() const;
+  static SMESH_ComputeErrorPtr getErrorDescription(const char*                logFile,
+                                                   const std::string&         log,
+                                                   const _Ghs2smdsConvertor & toSmdsConvertor,
+                                                   const bool                 isOK = false);
 
 protected:
   const GHS3DPlugin_Hypothesis*   _hyp;
   const StdMeshers_ViscousLayers* _viscousLayersHyp;
   std::string                     _genericName;
-   
+
 private:
 
-  bool         storeErrorDescription(const char*                logFile,
-                                     const std::string&         log,
-                                     const _Ghs2smdsConvertor & toSmdsConvertor );
   TopoDS_Shape entryToShape(std::string entry);
 
   int                 _iShape;
index 3215bef20eaf1bbc7cbb163fc3aaa7a7d9987222..ba7dbeba937d1ef576079b7c8967a58b780ee9ac 100644 (file)
 //  $Header$
 //
 #include "GHS3DPlugin_GHS3D_i.hxx"
-#include "SMESH_Gen.hxx"
-#include "SMESH_Mesh_i.hxx"
-#include "SMESH_Gen_i.hxx"
+
 #include "GHS3DPlugin_GHS3D.hxx"
-#include "SMESH_PythonDump.hxx"
+#include "GHS3DPlugin_Optimizer.hxx"
+
+#include <SMESH_Gen.hxx>
+#include <SMESH_Gen_i.hxx>
+#include <SMESH_Mesh_i.hxx>
+#include <SMESH_PythonDump.hxx>
 
-#include "utilities.h"
+#include <utilities.h>
 #include <cstring>
 
 //=============================================================================
@@ -48,7 +51,6 @@ GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_i (PortableServer::POA_ptr thePOA,
        SMESH_Algo_i( thePOA ),
        SMESH_3D_Algo_i( thePOA )
 {
-  MESSAGE( "GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_i" );
   myBaseImpl = new ::GHS3DPlugin_GHS3D (theGenImpl->GetANewId(),
                                         theGenImpl );
 }
@@ -63,7 +65,6 @@ GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_i (PortableServer::POA_ptr thePOA,
 
 GHS3DPlugin_GHS3D_i::~GHS3DPlugin_GHS3D_i()
 {
-  MESSAGE( "GHS3DPlugin_GHS3D_i::~GHS3DPlugin_GHS3D_i" );
 }
 
 //=============================================================================
@@ -76,7 +77,6 @@ GHS3DPlugin_GHS3D_i::~GHS3DPlugin_GHS3D_i()
 
 ::GHS3DPlugin_GHS3D* GHS3DPlugin_GHS3D_i::GetImpl()
 {
-  MESSAGE( "GHS3DPlugin_GHS3D_i::GetImpl" );
   return ( ::GHS3DPlugin_GHS3D* )myBaseImpl;
 }
 
@@ -90,7 +90,6 @@ GHS3DPlugin_GHS3D_i::~GHS3DPlugin_GHS3D_i()
 
 SMESH::SMESH_Mesh_ptr GHS3DPlugin_GHS3D_i::importGMFMesh(const char* theGMFFileName)
 {
-  MESSAGE( "GHS3DPlugin_GHS3D_i::importGMFMesh" );
   SMESH_Gen_i* smeshGen = SMESH_Gen_i::GetSMESHGen();
   SMESH::SMESH_Mesh_ptr theMesh = smeshGen->CreateEmptyMesh();
   smeshGen->RemoveLastFromPythonScript();
@@ -112,3 +111,23 @@ SMESH::SMESH_Mesh_ptr GHS3DPlugin_GHS3D_i::importGMFMesh(const char* theGMFFileN
   }
   return theMesh;
 }
+
+//=============================================================================
+/*!
+ *  GHS3DPlugin_Optimizer_i::GHS3DPlugin_Optimizer_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+GHS3DPlugin_Optimizer_i::GHS3DPlugin_Optimizer_i (PortableServer::POA_ptr thePOA,
+                                                  ::SMESH_Gen*            theGenImpl )
+  : SALOME::GenericObj_i( thePOA ),
+    SMESH_Hypothesis_i( thePOA ),
+    SMESH_Algo_i( thePOA ),
+    SMESH_3D_Algo_i( thePOA )
+{
+  myBaseImpl = new ::GHS3DPlugin_Optimizer (theGenImpl->GetANewId(),
+                                            theGenImpl );
+}
+
index b94b154601d6d70ad0c8beec9b25cdbe0fa7192f..9aa51879565172e4a43f810defcd86ffdfeb96e7 100644 (file)
@@ -52,4 +52,17 @@ public:
   virtual SMESH::SMESH_Mesh_ptr importGMFMesh(const char* theGMFFileName);
 };
 
+// ======================================================
+// MG-Tetra Optimization 3d algorithm
+// ======================================================
+class GHS3DPlugin_Optimizer_i:
+  public virtual POA_GHS3DPlugin::GHS3DPlugin_Optimizer,
+  public virtual SMESH_3D_Algo_i
+{
+public:
+  // Constructor
+  GHS3DPlugin_Optimizer_i (PortableServer::POA_ptr thePOA,
+                           ::SMESH_Gen*            theGenImpl );
+};
+
 #endif
index 2672ddcdab37d975f2e194913a5768b4ec85f99c..f3dbdfd8f4f23044b4e2e4b6872f7962daae8ae9 100644 (file)
@@ -137,7 +137,7 @@ bool GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains(const GHS3DPlugin_Hypothes
 //function : SetMaximumMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis::SetMaximumMemory(long MB)
+void GHS3DPlugin_Hypothesis::SetMaximumMemory(float MB)
 {
   if ( myMaximumMemory != MB ) {
     myMaximumMemory = MB;
@@ -150,7 +150,7 @@ void GHS3DPlugin_Hypothesis::SetMaximumMemory(long MB)
 //           * automatic memory adjustment mode. Default is zero
 //=======================================================================
 
-long GHS3DPlugin_Hypothesis::GetMaximumMemory() const
+float GHS3DPlugin_Hypothesis::GetMaximumMemory() const
 {
   return myMaximumMemory;
 }
@@ -159,7 +159,7 @@ long GHS3DPlugin_Hypothesis::GetMaximumMemory() const
 //function : SetInitialMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis::SetInitialMemory(long MB)
+void GHS3DPlugin_Hypothesis::SetInitialMemory(float MB)
 {
   if ( myInitialMemory != MB ) {
     myInitialMemory = MB;
@@ -171,7 +171,7 @@ void GHS3DPlugin_Hypothesis::SetInitialMemory(long MB)
 //function : GetInitialMemory
 //=======================================================================
 
-long GHS3DPlugin_Hypothesis::GetInitialMemory() const
+float GHS3DPlugin_Hypothesis::GetInitialMemory() const
 {
   return myInitialMemory;
 }
@@ -851,29 +851,29 @@ bool GHS3DPlugin_Hypothesis::DefaultToMakeGroupsOfDomains()
 //function : DefaultMaximumMemory
 //=======================================================================
 
-#ifndef WIN32
-#include <sys/sysinfo.h>
-#else
+#if defined(WIN32)
 #include <windows.h>
+#elif !defined(__APPLE__)
+#include <sys/sysinfo.h>
 #endif
 
-long  GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
+float GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
 {
-#ifndef WIN32
-  struct sysinfo si;
-  long err = sysinfo( &si );
-  if ( err == 0 ) {
-    long ramMB = si.totalram * si.mem_unit / 1024 / 1024;
-    return ( 0.7 * ramMB );
-  }
-#else
+#if defined(WIN32)
   // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
   MEMORYSTATUSEX statex;
   statex.dwLength = sizeof (statex);
   long err = GlobalMemoryStatusEx (&statex);
   if (err != 0) {
     double totMB = (double)statex.ullAvailPhys / 1024. / 1024.;
-    return (long)( 0.7 * totMB );
+    return (float)( 0.7 * totMB );
+  }
+#elif !defined(__APPLE__)
+  struct sysinfo si;
+  long err = sysinfo( &si );
+  if ( err == 0 ) {
+    long ramMB = si.totalram * si.mem_unit / 1024 / 1024;
+    return ( 0.7 * ramMB );
   }
 #endif
   return 1024;
@@ -883,7 +883,7 @@ long  GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
 //function : DefaultInitialMemory
 //=======================================================================
 
-long  GHS3DPlugin_Hypothesis::DefaultInitialMemory()
+float GHS3DPlugin_Hypothesis::DefaultInitialMemory()
 {
   return DefaultMaximumMemory();
 }
@@ -892,7 +892,7 @@ long  GHS3DPlugin_Hypothesis::DefaultInitialMemory()
 //function : DefaultOptimizationLevel
 //=======================================================================
 
-short  GHS3DPlugin_Hypothesis::DefaultOptimizationLevel()
+short GHS3DPlugin_Hypothesis::DefaultOptimizationLevel()
 {
   return Medium;
 }
@@ -1461,7 +1461,7 @@ bool GHS3DPlugin_Hypothesis::SetParametersByDefaults(const TDefaults&  dflts,
 
 std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
                                                  const bool                    hasShapeToMesh,
-                                                 const bool                    forExucutable)
+                                                 const bool                    forExecutable)
 {
   std::string cmd = GetExeName();
   // check if any option is overridden by hyp->myTextOption
@@ -1485,13 +1485,13 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
   // 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 ) {
-    long aMaximumMemory = hyp ? hyp->myMaximumMemory : -1;
+    float aMaximumMemory = hyp ? hyp->myMaximumMemory : -1;
     cmd += " --max_memory ";
     if ( aMaximumMemory < 0 ) cmd += SMESH_Comment( DefaultMaximumMemory() );
     else                      cmd += SMESH_Comment( aMaximumMemory );
   }
   if ( auto_memory && !useBndRecovery ) {
-    long aInitialMemory = hyp ? hyp->myInitialMemory : -1;
+    float aInitialMemory = hyp ? hyp->myInitialMemory : -1;
     cmd += " --automatic_memory ";
     if ( aInitialMemory > 0 ) cmd += SMESH_Comment( aInitialMemory );
     else                      cmd += "100";
@@ -1523,7 +1523,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
 
   // to create internal nodes
   if ( no_int_points && !toCreateNewNodes ) {
-    if ( forExucutable )
+    if ( forExecutable )
       cmd += " --no_internal_points";
     else
       cmd += " --internalpoints no";
@@ -1546,7 +1546,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
 
   // to remove initial central point.
   if ( rem && hyp && hyp->myToRemoveCentralPoint) {
-    if ( forExucutable )
+    if ( forExecutable )
       cmd += " --no_initial_central_point";
     else
       cmd += " --centralpoint no";
@@ -1559,7 +1559,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
 
   // to define volumic gradation.
   if ( gra && hyp ) {
-    if ( forExucutable )
+    if ( forExecutable )
       cmd += " -Dcpropa=" + SMESH_Comment( hyp->myGradation );
     else
       cmd += " --gradation " + SMESH_Comment( hyp->myGradation );
index fcec94ff65a52a05b81e9819ec19537ecbff95b9..47f8e91ac0e954bdd031246a5a952e3289214da9 100644 (file)
@@ -134,14 +134,14 @@ public:
   /*!
    * Maximal size of memory to be used by the algorithm (in Megabytes)
    */
-  void SetMaximumMemory(long MB);
-  long GetMaximumMemory() const;
+  void SetMaximumMemory(float MB);
+  float GetMaximumMemory() const;
   /*!
    * Initial size of memory to be used by the algorithm (in Megabytes) in
    * automatic memory adjustment mode. Default is zero
    */
-  void SetInitialMemory(long MB);
-  long GetInitialMemory() const;
+  void SetInitialMemory(float MB);
+  float GetInitialMemory() const;
   /*!
    * Optimization level: 0-none, 1-light, 2-medium, 3-standard+, 4-strong. Default is medium
    */
@@ -290,8 +290,8 @@ public:
   
   static bool   DefaultMeshHoles();
   static bool   DefaultToMakeGroupsOfDomains();
-  static long   DefaultMaximumMemory();
-  static long   DefaultInitialMemory();
+  static float  DefaultMaximumMemory();
+  static float  DefaultInitialMemory();
   static short  DefaultOptimizationLevel();
   static std::string DefaultWorkingDirectory();
   static bool   DefaultKeepFiles();
@@ -323,8 +323,6 @@ public:
   // Persistence
   virtual std::ostream & SaveTo(std::ostream & save);
   virtual std::istream & LoadFrom(std::istream & load);
-  friend GHS3DPLUGIN_EXPORT std::ostream & operator <<(std::ostream & save, GHS3DPlugin_Hypothesis & hyp);
-  friend GHS3DPLUGIN_EXPORT std::istream & operator >>(std::istream & load, GHS3DPlugin_Hypothesis & hyp);
 
   /*!
    * \brief Does nothing
@@ -336,12 +334,12 @@ public:
    */
   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
 
-private:
+protected:
 
   bool        myToMeshHoles;
   bool        myToMakeGroupsOfDomains;
-  long        myMaximumMemory;
-  long        myInitialMemory;
+  float       myMaximumMemory;
+  float       myInitialMemory;
   short       myOptimizationLevel;
   bool        myKeepFiles;
   std::string myWorkingDirectory;
index 557f7421e6225e3e3d1eed8b6ac6436ce84847f8..21af792e85ad661f628cbbd4db373b5dd1e72e3a 100644 (file)
 //
 #include "GHS3DPlugin_Hypothesis_i.hxx"
 
-#include "SMESH_Gen.hxx"
-#include "SMESH_PythonDump.hxx"
-//#include "SMESH_Mesh.hxx"
-//#include "SMESH_ProxyMesh.hxx"
-//#include <StdMeshers_QuadToTriaAdaptor.hxx>
-
-#include "Utils_CorbaException.hxx"
-#include "utilities.h"
-#include "SMESH_Mesh_i.hxx"
-#include "SMESH_Group_i.hxx"
-#include "SMESH_Gen_i.hxx"
-#include "SMESH_TypeDefs.hxx"
-#include "SMESHDS_GroupBase.hxx"
+#include <SMESH_Gen.hxx>
+#include <SMESH_PythonDump.hxx>
+
+#include <Utils_CorbaException.hxx>
+#include <utilities.h>
+#include <SMESH_Mesh_i.hxx>
+#include <SMESH_Group_i.hxx>
+#include <SMESH_Gen_i.hxx>
+//#include <SMESH_TypeDefs.hxx>
+#include <SMESHDS_GroupBase.hxx>
 
 // SALOME KERNEL includes
-#include "SALOMEDSClient.hxx"
-#include <SALOMEDSClient_definitions.hxx>
-// // IDL headers
-// #include <SALOMEconfig.h>
-// #include CORBA_SERVER_HEADER(SALOMEDS)
+// #include <SALOMEDSClient.hxx>
+// #include <SALOMEDSClient_definitions.hxx>
 
 using namespace std;
 
@@ -55,7 +49,6 @@ GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr theP
   : SALOME::GenericObj_i( thePOA ), 
     SMESH_Hypothesis_i( thePOA )
 {
-  MESSAGE( "GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i" );
   myBaseImpl = new ::GHS3DPlugin_Hypothesis (theGenImpl->GetANewId(),
                                              theGenImpl);
 }
@@ -66,7 +59,6 @@ GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr theP
 
 GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i()
 {
-  MESSAGE( "GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i" );
 }
 
 //=======================================================================
@@ -115,8 +107,8 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
 //function : SetMaximumMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Long MB)
-   throw ( SALOME::SALOME_Exception )
+void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Float MB)
+  throw ( SALOME::SALOME_Exception )
 {
   if ( MB == 0 )
     THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
@@ -129,7 +121,7 @@ void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Long MB)
 //function : GetMaximumMemory
 //=======================================================================
 
-CORBA::Long GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
+CORBA::Float GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
 {
   ASSERT(myBaseImpl);
   return this->GetImpl()->GetMaximumMemory();
@@ -139,7 +131,7 @@ CORBA::Long GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
 //function : SetInitialMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Long MB)
+void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Float MB)
   throw ( SALOME::SALOME_Exception )
 {
   if ( MB == 0 )
@@ -153,7 +145,7 @@ void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Long MB)
 //function : GetInitialMemory
 //=======================================================================
 
-CORBA::Long GHS3DPlugin_Hypothesis_i::GetInitialMemory()
+CORBA::Float GHS3DPlugin_Hypothesis_i::GetInitialMemory()
 {
   ASSERT(myBaseImpl);
   return this->GetImpl()->GetInitialMemory();
@@ -167,7 +159,7 @@ void GHS3DPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
   throw ( SALOME::SALOME_Exception )
 {
   ::GHS3DPlugin_Hypothesis::OptimizationLevel l =
-      (::GHS3DPlugin_Hypothesis::OptimizationLevel) level;
+    (::GHS3DPlugin_Hypothesis::OptimizationLevel) level;
   if ( l < ::GHS3DPlugin_Hypothesis::None ||
        l > ::GHS3DPlugin_Hypothesis::Strong )
     THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
@@ -463,39 +455,34 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
 //=======================================================================
 
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
-    throw (SALOME::SALOME_Exception) {
+  throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : SetEnforcedVertex( "<< x << ", " << y << ", " << z << ", " << size << ")");
   return p_SetEnforcedVertex(size, x, y, z);
 }
 
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
-    throw (SALOME::SALOME_Exception) {
+  throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : SetEnforcedVertexNamed( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ")");
   return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
 }
 
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
-    throw (SALOME::SALOME_Exception) {
+  throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theGroupName << ")");
   return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
 }
 
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
-    throw (SALOME::SALOME_Exception) {
+  throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ", " << theGroupName << ")");
   return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
 }
 
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
-    throw (SALOME::SALOME_Exception) {
+  throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
   
   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
-    MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
   }
   
@@ -526,21 +513,18 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVe
       return false;
     
     measureOp->PointCoordinates (theVertex, x, y, z);
-    MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
   }
 
   string theVertexName = theVertex->GetName();
-  MESSAGE("IDL : SetEnforcedVertexGeom( "<< theVertexEntry << ", " << size<< ")");
   
   return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
 }
 
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
-    throw (SALOME::SALOME_Exception) {
+  throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
   
   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
-    MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
   }
   
@@ -571,21 +555,18 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_
       return false;
     
     measureOp->PointCoordinates (theVertex, x, y, z);
-    MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
   }
     
   string theVertexName = theVertex->GetName();
-  MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theVertexEntry << ", " << size<< ", " << theGroupName << ")");
   
   return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
 }
 
 bool GHS3DPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
-                                                   const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
-                                                   CORBA::Boolean isCompound)
-    throw (SALOME::SALOME_Exception) {
+                                                    const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
+                                                    CORBA::Boolean isCompound)
+  throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : p_SetEnforcedVertex(" << size << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\", " << isCompound<< ")");
   bool newValue = false;
 
   ::GHS3DPlugin_Hypothesis::TCoordsGHS3DEnforcedVertexMap coordsList;
@@ -597,20 +578,13 @@ bool GHS3DPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::D
     coords.push_back(y);
     coords.push_back(z);
     if (coordsList.find(coords) == coordsList.end()) {
-      MESSAGE("Coords not found: add it in coordsList");
       newValue = true;
     }
     else {
-      MESSAGE("Coords already found, compare names");
       ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
       if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
-        MESSAGE("The names or size are different: update");
-//          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
         newValue = true;
       }
-      else {
-        MESSAGE("The names and size are identical");
-      }
     }
 
     if (newValue) {
@@ -629,24 +603,15 @@ bool GHS3DPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::D
     }
   } 
   else {
-//   if (isCompound || (!isCompound && !string(theVertexEntry).empty())) {
     enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
-//     ::BLSURFPlugin_Hypothesis::TGeomEntryGHS3DEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
     if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
-      MESSAGE("Geom entry not found: add it in enfVertexEntryList");
       newValue = true;
     }
     else {
-      MESSAGE("Geom entry already found, compare names");
       ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
       if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
-        MESSAGE("The names or size are different: update");
-//          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
         newValue = true;
       }
-      else {
-        MESSAGE("The names and size are identical");
-      }
     }
 
     if (newValue) {
@@ -660,7 +625,6 @@ bool GHS3DPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::D
   if (newValue)
     this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
 
-  MESSAGE("IDL : SetEnforcedVertexEntry END");
   return newValue;
 }
 
@@ -678,12 +642,7 @@ CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA
     return isDone;
   }
   catch (const std::invalid_argument& ex) {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = ex.what();
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-    ExDescription.lineNumber = 513;
-    throw SALOME::SALOME_Exception(ExDescription);
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
   }
   catch (SALOME_Exception& ex) {
     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
@@ -700,7 +659,6 @@ CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_
   ASSERT(myBaseImpl);
   
   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
-    MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
   }
   
@@ -728,12 +686,7 @@ CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_
     return isDone;
   }
   catch (const std::invalid_argument& ex) {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = ex.what();
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-    ExDescription.lineNumber = 538;
-    throw SALOME::SALOME_Exception(ExDescription);
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
   }
   catch (SALOME_Exception& ex) {
     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
@@ -775,9 +728,9 @@ GHS3DPlugin::GHS3DEnforcedVertexList* GHS3DPlugin_Hypothesis_i::GetEnforcedVerti
     enfVertex->isCompound = currentVertex->isCompound;
     
     result[i]=enfVertex;
-    }
+  }
   
-//   SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
+  //   SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
 
   return result._retn();
 }
@@ -796,12 +749,7 @@ bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Doub
     return res;
   }
   catch (const std::invalid_argument& ex) {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = ex.what();
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-    ExDescription.lineNumber = 625;
-    throw SALOME::SALOME_Exception(ExDescription);
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
   }
   catch (SALOME_Exception& ex) {
     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
@@ -814,7 +762,6 @@ bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr th
   ASSERT(myBaseImpl);
   
   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
-    MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
   }
   
@@ -840,12 +787,7 @@ bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr th
     return res;
   }
   catch (const std::invalid_argument& ex) {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = ex.what();
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-    ExDescription.lineNumber = 648;
-    throw SALOME::SALOME_Exception(ExDescription);
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
   }
   catch (SALOME_Exception& ex) {
     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
@@ -901,9 +843,9 @@ GHS3DPlugin::GHS3DEnforcedMeshList* GHS3DPlugin_Hypothesis_i::GetEnforcedMeshes(
     enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
     
     result[i]=enfMesh;
-    }
+  }
   
-//   SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
+  //   SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
 
   return result._retn();
 }
@@ -914,16 +856,7 @@ GHS3DPlugin::GHS3DEnforcedMeshList* GHS3DPlugin_Hypothesis_i::GetEnforcedMeshes(
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
   throw (SALOME::SALOME_Exception)
 {
-// #if GHS3D_VERSION >= 42
   return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
-// #else
-//   SALOME::ExceptionStruct ExDescription;
-//   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
-//   ExDescription.type = SALOME::BAD_PARAM;
-//   ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-//   ExDescription.lineNumber = 719;
-//   throw SALOME::SALOME_Exception(ExDescription);
-// #endif
 }
 
 /*!
@@ -932,17 +865,7 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_pt
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
   throw (SALOME::SALOME_Exception)
 {
-//   MESSAGE("GHS3DPlugin_Hypothesis_i::SetEnforcedMesh");
-// #if GHS3D_VERSION >= 42
   return p_SetEnforcedMesh(theSource, theType);
-// #else
-//   SALOME::ExceptionStruct ExDescription;
-//   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
-//   ExDescription.type = SALOME::BAD_PARAM;
-//   ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-//   ExDescription.lineNumber = 750;
-//   throw SALOME::SALOME_Exception(ExDescription);
-// #endif
 }
 
 /*!
@@ -951,16 +874,7 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSour
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
   throw (SALOME::SALOME_Exception)
 {
-// #if GHS3D_VERSION >= 42
   return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
-// #else
-//   SALOME::ExceptionStruct ExDescription;
-//   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
-//   ExDescription.type = SALOME::BAD_PARAM;
-//   ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-//   ExDescription.lineNumber = 750;
-//   throw SALOME::SALOME_Exception(ExDescription);
-// #endif
 }
 
 /*!
@@ -969,64 +883,32 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSourc
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
   throw (SALOME::SALOME_Exception)
 {
-// #if GHS3D_VERSION >= 42
   return p_SetEnforcedMesh(theSource, theType);
-// #else
-//   SALOME::ExceptionStruct ExDescription;
-//   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
-//   ExDescription.type = SALOME::BAD_PARAM;
-//   ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-//   ExDescription.lineNumber = 750;
-//   throw SALOME::SALOME_Exception(ExDescription);
-// #endif
 }
 
-bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
+bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource,
+                                                 SMESH::ElementType        theType,
+                                                 const char*               theName,
+                                                 const char*               theGroupName)
   throw (SALOME::SALOME_Exception)
 {
-  MESSAGE("GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh");
   ASSERT(myBaseImpl);
-  
+
   if (CORBA::is_nil( theSource ))
-  {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = "The source mesh CORBA object is NULL";
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-    ExDescription.lineNumber = 840;
-    throw SALOME::SALOME_Exception(ExDescription);
-  }
-  
+    THROW_SALOME_CORBA_EXCEPTION( "The source mesh CORBA object is NULL" ,SALOME::BAD_PARAM );
+
   switch (theType) {
-    case SMESH::NODE:
-      MESSAGE("Required type is NODE");
-      break;
-    case SMESH::EDGE:
-      MESSAGE("Required type is EDGE");
-      break;
-    case SMESH::FACE:
-      MESSAGE("Required type is FACE");
-      break;
-    default:
-        MESSAGE("Incompatible required type: " << theType);
-        return false;
+  case SMESH::NODE:
+  case SMESH::EDGE:
+  case SMESH::FACE: break;
+  default:
+    return false;
   }
-//   MESSAGE("Required type is "<<theType);
   SMESH::array_of_ElementType_var types = theSource->GetTypes();
-  MESSAGE("Available types:");
-  for ( CORBA::ULong i=0;i<types->length();i++){MESSAGE(types[i]);}
   if ( types->length() >= 1 && types[types->length()-1] <  theType)
   {
-    MESSAGE("Required type not available");
     return false;
-//     SALOME::ExceptionStruct ExDescription;
-//     ExDescription.text = "The source mesh has bad type";
-//     ExDescription.type = SALOME::BAD_PARAM;
-//     ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-//     ExDescription.lineNumber = 840;
-//     throw SALOME::SALOME_Exception(ExDescription);
   }
-  
 
   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
   SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(theSource);
@@ -1068,21 +950,20 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
   }
   else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
   {
-    MESSAGE("The source is a group")
-      try {
-        bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
-        if ( theGroupName && theGroupName[0] ) {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
-                                << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
-        }
-        else {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
-                                << theSource << ", " << theType << " )";
-        }
-        return res;
+    try {
+      bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
+      if ( theGroupName && theGroupName[0] ) {
+        SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
+                              << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
       }
-      catch (const std::invalid_argument& ex) {
-        SALOME::ExceptionStruct ExDescription;
+      else {
+        SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
+                              << theSource << ", " << theType << " )";
+      }
+      return res;
+    }
+    catch (const std::invalid_argument& ex) {
+      SALOME::ExceptionStruct ExDescription;
       ExDescription.text = ex.what();
       ExDescription.type = SALOME::BAD_PARAM;
       ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
@@ -1095,17 +976,16 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
   }
   else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
   {
-    MESSAGE("The source is a group on geom")
     try {
-        bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
-        if ( theGroupName && theGroupName[0] ) {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
-                                << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
-        }
-        else {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
-                                << theSource << ", " << theType << " )";
-        }
+      bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
+      if ( theGroupName && theGroupName[0] ) {
+        SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
+                              << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
+      }
+      else {
+        SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
+                              << theSource << ", " << theType << " )";
+      }
       return res;
     }
     catch (const std::invalid_argument& ex) {
@@ -1143,4 +1023,3 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
 {
   return type == SMESH::DIM_3D;
 }
-
index 3787dbaf52fc8413ecf1541dc940fc3b0f06c9ea..3e6a82b8e8c5a8e20b5b72983d77ab07f432f8f9 100644 (file)
@@ -64,14 +64,14 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i:
   /*!
    * Maximal size of memory to be used by the algorithm (in Megabytes)
    */
-  void SetMaximumMemory(CORBA::Long MB) throw ( SALOME::SALOME_Exception );
-  CORBA::Long GetMaximumMemory();
+  void SetMaximumMemory(CORBA::Float MB) throw ( SALOME::SALOME_Exception );
+  CORBA::Float GetMaximumMemory();
   /*!
    * Initial size of memory to be used by the algorithm (in Megabytes) in
    * automatic memory adjustment mode. Default is zero
    */
-  void SetInitialMemory(CORBA::Long MB) throw ( SALOME::SALOME_Exception );
-  CORBA::Long GetInitialMemory();
+  void SetInitialMemory(CORBA::Float MB) throw ( SALOME::SALOME_Exception );
+  CORBA::Float GetInitialMemory();
   /*!
    * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium
    */
diff --git a/src/GHS3DPlugin/GHS3DPlugin_Optimizer.cxx b/src/GHS3DPlugin/GHS3DPlugin_Optimizer.cxx
new file mode 100644 (file)
index 0000000..4244aff
--- /dev/null
@@ -0,0 +1,492 @@
+// Copyright (C) 2004-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File      : GHS3DPlugin_Optimizer.cxx
+// Created   : Mon Oct 31 20:05:28 2016
+
+#include "GHS3DPlugin_Optimizer.hxx"
+
+#include "GHS3DPlugin_GHS3D.hxx"
+#include "GHS3DPlugin_OptimizerHypothesis.hxx"
+#include "MG_Tetra_API.hxx"
+
+#include <SMDS_VolumeTool.hxx>
+#include <SMESHDS_Mesh.hxx>
+#include <SMESH_File.hxx>
+#include <SMESH_Mesh.hxx>
+#include <SMESH_MesherHelper.hxx>
+
+#include <TopoDS_Shape.hxx>
+
+//================================================================================
+/*!
+ * \brief Constructor
+ */
+//================================================================================
+
+GHS3DPlugin_Optimizer::GHS3DPlugin_Optimizer(int hypId, SMESH_Gen* gen)
+  : SMESH_3D_Algo(hypId, gen)
+{
+  _name = Name();
+  _compatibleHypothesis.push_back( GHS3DPlugin_OptimizerHypothesis::GetHypType());
+  _requireShape = false; // work without shape only
+}
+
+//================================================================================
+/*!
+ * \brief Get a hypothesis
+ */
+//================================================================================
+
+bool GHS3DPlugin_Optimizer::CheckHypothesis(SMESH_Mesh&         aMesh,
+                                            const TopoDS_Shape& aShape,
+                                            Hypothesis_Status&  aStatus)
+{
+  _hyp = NULL;
+
+  const std::list <const SMESHDS_Hypothesis * >& hyps = GetUsedHypothesis(aMesh, aShape);
+  if ( !hyps.empty() )
+    _hyp = dynamic_cast< const GHS3DPlugin_OptimizerHypothesis* >( hyps.front() );
+
+  aStatus = HYP_OK;
+  return true;
+}
+
+//================================================================================
+/*!
+ * \brief Terminate a process
+ */
+//================================================================================
+
+void GHS3DPlugin_Optimizer::CancelCompute()
+{
+  _computeCanceled = true;
+}
+
+//================================================================================
+/*!
+ * \brief Evaluate nb of elements
+ */
+//================================================================================
+
+bool GHS3DPlugin_Optimizer::Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
+                                     MapShapeNbElems& aResMap)
+{
+  return false;
+}
+//================================================================================
+/*!
+ * \brief Does nothing 
+ */
+//================================================================================
+
+bool GHS3DPlugin_Optimizer::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
+{
+  return false;
+}
+
+namespace
+{
+  //================================================================================
+  /*!
+   * \brief Compute average size of tetrahedra araound a node
+   */
+  //================================================================================
+
+  double getSizeAtNode( const SMDS_MeshNode* node )
+  {
+    double size = 0;
+    int nbTet = 0;
+
+    SMDS_VolumeTool vt;
+    vt.SetExternalNormal();
+
+    SMDS_ElemIteratorPtr volIt = node->GetInverseElementIterator(SMDSAbs_Volume);
+    while ( volIt->more() )
+    {
+      const SMDS_MeshElement* vol = volIt->next();
+      if ( vol->GetGeomType() != SMDSGeom_TETRA )
+        continue;
+      double volSize = 0.;
+      int    nbLinks = 0;
+      int dN = vol->IsQuadratic() ? 2 : 1;
+      vt.Set( vol );
+      for ( int iF = 0, nbF = vt.NbFaces(); iF < nbF; ++iF )
+      {
+        const SMDS_MeshNode** nodes = vt. GetFaceNodes( iF );
+        for ( int iN = 0, nbN = vt.NbFaceNodes( iF ); iN < nbN; iN += dN )
+          if ( nodes[ iN ] < nodes[ iN + dN ]) // use a link once
+          {
+            volSize += SMESH_TNodeXYZ( nodes[ iN ]).Distance( nodes[ iN + dN ]);
+            ++nbLinks;
+          }
+      }
+      size += volSize / nbLinks;
+      ++nbTet;
+    }
+    return nbTet > 0 ? size/nbTet : 0.;
+  }
+
+  //================================================================================
+  /*!
+   * \brief Write a mesh file and a solution file
+   */
+  //================================================================================
+
+  bool writeGMFFile( MG_Tetra_API*       theMGInput,
+                     SMESH_MesherHelper* theHelper,
+                     const std::string&  theMeshFileName,
+                     const std::string&  theSolFileName )
+  {
+    const int tag = 0;
+
+    int mfile = theMGInput->GmfOpenMesh( theMeshFileName.c_str(), GmfWrite, GMFVERSION,GMFDIMENSION );
+    int sfile = theMGInput->GmfOpenMesh( theSolFileName.c_str(), GmfWrite, GMFVERSION,GMFDIMENSION );
+    if ( !mfile || !sfile )
+      return false;
+
+    // write all nodes and volume size at them
+
+    SMESHDS_Mesh* meshDS = theHelper->GetMeshDS();
+    if ( meshDS->NbNodes() != meshDS->MaxNodeID() )
+      meshDS->compactMesh();
+
+    theMGInput->GmfSetKwd( mfile, GmfVertices, meshDS->NbNodes() );
+    int TypTab[] = { GmfSca };
+    theMGInput->GmfSetKwd( sfile, GmfSolAtVertices, meshDS->NbNodes(), 1, TypTab);
+
+    SMDS_NodeIteratorPtr nodeIt = theHelper->GetMeshDS()->nodesIterator();
+    while ( nodeIt->more() )
+    {
+      const SMDS_MeshNode* node = nodeIt->next();
+      theMGInput->GmfSetLin( mfile, GmfVertices, node->X(), node->Y(), node->Z(), tag );
+
+      double size = getSizeAtNode( node );
+      theMGInput->GmfSetLin( sfile, GmfSolAtVertices, &size );
+    }
+
+    // write all triangles
+
+    theMGInput->GmfSetKwd( mfile, GmfTriangles, meshDS->GetMeshInfo().NbTriangles() );
+    SMDS_ElemIteratorPtr triaIt = meshDS->elementGeomIterator( SMDSGeom_TRIANGLE );
+    while ( triaIt->more() )
+    {
+      const SMDS_MeshElement* tria = triaIt->next();
+      theMGInput->GmfSetLin( mfile, GmfTriangles,
+                             tria->GetNode(0)->GetID(),
+                             tria->GetNode(1)->GetID(),
+                             tria->GetNode(2)->GetID(),
+                             tag );
+    }
+
+    // write all tetra
+
+    theMGInput->GmfSetKwd( mfile, GmfTetrahedra, meshDS->GetMeshInfo().NbTetras() );
+    SMDS_ElemIteratorPtr tetIt = meshDS->elementGeomIterator( SMDSGeom_TETRA );
+    while ( tetIt->more() )
+    {
+      const SMDS_MeshElement* tet = tetIt->next();
+      theMGInput->GmfSetLin( mfile, GmfTetrahedra,
+                             tet->GetNode(0)->GetID(),
+                             tet->GetNode(2)->GetID(),
+                             tet->GetNode(1)->GetID(),
+                             tet->GetNode(3)->GetID(),
+                             tag );
+    }
+
+    theMGInput->GmfCloseMesh( mfile );
+    theMGInput->GmfCloseMesh( sfile );
+
+    return true;
+  }
+
+  //================================================================================
+  /*!
+   * \brief Read optimized tetrahedra
+   */
+  //================================================================================
+
+  bool readGMFFile( MG_Tetra_API*       theMGOutput,
+                    SMESH_MesherHelper* theHelper,
+                    const std::string&  theMeshFileName )
+  {
+    int ver, dim, tag;
+    int inFile = theMGOutput->GmfOpenMesh( theMeshFileName.c_str(), GmfRead, &ver, &dim);
+    if ( !inFile )
+      return false;
+
+    SMESHDS_Mesh* meshDS = theHelper->GetMeshDS();
+
+    int nbNodes = theMGOutput->GmfStatKwd( inFile, GmfVertices );
+    int   nbTet = theMGOutput->GmfStatKwd( inFile, GmfTetrahedra );
+    int nbNodesOld = meshDS->NbNodes();
+    int   nbTetOld = meshDS->GetMeshInfo().NbTetras();
+    std::cout << "Optimization input:  "
+              << nbNodesOld << " nodes, \t" << nbTetOld << " tetra" << std::endl;
+    std::cout << "Optimization output: "
+              << nbNodes << " nodes, \t" << nbTet << " tetra" << std::endl;
+
+    double x,y,z;
+    int i1, i2, i3, i4;
+    theMGOutput->GmfGotoKwd( inFile, GmfVertices );
+
+    if ( nbNodes == nbNodesOld && nbTet == nbTetOld )
+    {
+      // move nodes
+      SMDS_NodeIteratorPtr nodeIt = theHelper->GetMeshDS()->nodesIterator();
+      while ( nodeIt->more() )
+      {
+        const SMDS_MeshNode* node = nodeIt->next();
+        theMGOutput->GmfGetLin( inFile, GmfVertices, &x, &y, &z, &tag );
+        meshDS->MoveNode( node, x,y,z );
+      }
+
+      // update tetra
+      const SMDS_MeshNode* nodes[ 4 ];
+      theMGOutput->GmfGotoKwd( inFile, GmfTetrahedra );
+      SMDS_ElemIteratorPtr tetIt = meshDS->elementGeomIterator( SMDSGeom_TETRA );
+      for ( int i = 0; i < nbTet; ++i )
+      {
+        const SMDS_MeshElement* tet = tetIt->next();
+        theMGOutput->GmfGetLin( inFile, GmfTetrahedra, &i1, &i2, &i3, &i4, &tag);
+        nodes[ 0 ] = meshDS->FindNode( i1 );
+        nodes[ 1 ] = meshDS->FindNode( i3 );
+        nodes[ 2 ] = meshDS->FindNode( i2 );
+        nodes[ 3 ] = meshDS->FindNode( i4 );
+        meshDS->ChangeElementNodes( tet, &nodes[0], 4 );
+      }
+    }
+    else if ( nbNodes >= nbNodesOld ) // tetra added/removed
+    {
+      // move or add nodes
+      for ( int iN = 1; iN <= nbNodes; ++iN )
+      {
+        theMGOutput->GmfGetLin( inFile, GmfVertices, &x, &y, &z, &tag );
+        const SMDS_MeshNode* node = meshDS->FindNode( iN );
+        if ( !node )
+          node = meshDS->AddNode( x,y,z );
+        else
+          meshDS->MoveNode( node, x,y,z );
+      }
+
+      // remove tetrahedra
+      SMDS_ElemIteratorPtr tetIt = meshDS->elementGeomIterator( SMDSGeom_TETRA );
+      while ( tetIt->more() )
+        meshDS->RemoveFreeElement( tetIt->next(), /*sm=*/0 );
+
+      // add tetrahedra
+      theMGOutput->GmfGotoKwd( inFile, GmfTetrahedra );
+      for ( int i = 0; i < nbTet; ++i )
+      {
+        theMGOutput->GmfGetLin( inFile, GmfTetrahedra, &i1, &i2, &i3, &i4, &tag);
+        meshDS->AddVolume( meshDS->FindNode( i1 ),
+                           meshDS->FindNode( i3 ),
+                           meshDS->FindNode( i2 ),
+                           meshDS->FindNode( i4 ));
+      }
+    }
+    else if ( nbNodes < nbNodesOld ) // nodes and tetra removed
+    {
+      // unmark nodes
+      SMDS_NodeIteratorPtr nIt = meshDS->nodesIterator();
+      while ( nIt->more() )
+        nIt->next()->setIsMarked( false );
+
+      // remove tetrahedra and mark nodes used by them
+      SMDS_ElemIteratorPtr tetIt = meshDS->elementGeomIterator( SMDSGeom_TETRA );
+      while ( tetIt->more() )
+      {
+        const SMDS_MeshElement* tet = tetIt->next();
+        SMDS_ElemIteratorPtr nIter = tet->nodesIterator();
+        while ( nIter->more() )
+          nIter->next()->setIsMarked( true );
+
+        meshDS->RemoveFreeElement( tet, /*sm=*/0 );
+      }
+
+      // move or add nodes
+      for ( int iN = 1; iN <= nbNodes; ++iN )
+      {
+        theMGOutput->GmfGetLin( inFile, GmfVertices, &x, &y, &z, &tag );
+        const SMDS_MeshNode* node = meshDS->FindNode( iN );
+        if ( !node )
+          node = meshDS->AddNode( x,y,z );
+        else
+          meshDS->MoveNode( node, x,y,z );
+      }
+
+      // add tetrahedra
+      theMGOutput->GmfGotoKwd( inFile, GmfTetrahedra );
+      for ( int i = 0; i < nbTet; ++i )
+      {
+        theMGOutput->GmfGetLin( inFile, GmfTetrahedra, &i1, &i2, &i3, &i4, &tag);
+        meshDS->AddVolume( meshDS->FindNode( i1 ),
+                           meshDS->FindNode( i3 ),
+                           meshDS->FindNode( i2 ),
+                           meshDS->FindNode( i4 ));
+      }
+
+      // remove free marked nodes
+      for ( nIt = meshDS->nodesIterator(); nIt->more(); )
+      {
+        const SMDS_MeshNode* node = nIt->next();
+        if ( node->NbInverseElements() == 0 && node->isMarked() )
+          meshDS->RemoveFreeNode( node, 0 );
+      }
+    }
+
+    // avoid "No mesh elements assigned to a sub-shape" error
+    theHelper->GetMesh()->GetSubMesh( theHelper->GetSubShape() )->SetIsAlwaysComputed( true );
+
+    return true;
+  }
+
+  void getNodeByGhsId( SMESH_Mesh& mesh, std::vector <const SMDS_MeshNode*> & nodeByGhsId )
+  {
+    SMESHDS_Mesh* meshDS = mesh.GetMeshDS();
+    const int nbNodes = meshDS->NbNodes();
+    nodeByGhsId.resize( nbNodes + 1 );
+    SMDS_NodeIteratorPtr nodeIt = meshDS->nodesIterator();
+    while ( nodeIt->more() )
+    {
+      const SMDS_MeshNode* node = nodeIt->next();
+      if ( node->GetID() <= nbNodes )
+        nodeByGhsId[ node->GetID() ] = node;
+#ifdef _DEBUG_
+      else
+        throw SALOME_Exception(LOCALIZED ("bad ID -- not compacted mesh"));
+#endif
+    }
+  }
+
+  void removeFile(const std::string& name)
+  {
+    SMESH_File( name ).remove();
+  }
+}
+
+//================================================================================
+/*!
+ * \brief Optimize an existing tetrahedral mesh
+ */
+//================================================================================
+
+bool GHS3DPlugin_Optimizer::Compute(SMESH_Mesh&         theMesh,
+                                    SMESH_MesherHelper* theHelper)
+{
+  if ( theMesh.NbTetras() == 0 )
+    return error( COMPERR_BAD_INPUT_MESH, "No tetrahedra" );
+  if ( theMesh.NbTetras( ORDER_QUADRATIC ) > 0 )
+    return error( COMPERR_BAD_INPUT_MESH, "Quadratic mesh can't be optimized" );
+  if ( theMesh.NbTriangles() == 0 )
+    return error( COMPERR_BAD_INPUT_MESH, "2D mesh must exist around tetrahedra" );
+
+  std::string aGenericName    = GHS3DPlugin_Hypothesis::GetFileName(_hyp);
+  std::string aLogFileName    = aGenericName + ".log";  // log
+  std::string aGMFFileName    = aGenericName + ".mesh"; // input GMF mesh file
+  std::string aSolFileName    = aGenericName + ".sol";  // input size map file
+  std::string aResultFileName = aGenericName + "_Opt.mesh";  // out GMF mesh file
+  std::string aResSolFileName = aGenericName + "_Opt.sol";   // out size map file
+
+  MG_Tetra_API mgTetra( _computeCanceled, _progress );
+
+  bool Ok = writeGMFFile( &mgTetra, theHelper, aGMFFileName, aSolFileName );
+
+  // -----------------
+  // run MG-Tetra mesher
+  // -----------------
+
+  bool logInStandardOutput = _hyp ? _hyp->GetStandardOutputLog() : false;
+  bool removeLogOnSuccess  = _hyp ? _hyp->GetRemoveLogOnSuccess() : true;
+  bool keepFiles           = _hyp ? _hyp->GetKeepFiles() : false;
+
+  std::string cmd = GHS3DPlugin_OptimizerHypothesis::CommandToRun( _hyp );
+
+  if ( mgTetra.IsExecutable() )
+  {
+    cmd += " --in " + aGMFFileName;
+    cmd += " --out " + aResultFileName;
+  }
+  if ( !logInStandardOutput )
+  {
+    mgTetra.SetLogFile( aLogFileName.c_str() );
+    cmd += " 1>" + aLogFileName;  // dump into file
+  }
+  std::cout << std::endl;
+  std::cout << "MG-Tetra execution..." << std::endl;
+  std::cout << cmd << std::endl;
+
+  _computeCanceled = false;
+
+  std::string errStr;
+  Ok = mgTetra.Compute( cmd, errStr ); // run
+
+  if ( logInStandardOutput && mgTetra.IsLibrary() )
+    std::cout << std::endl << mgTetra.GetLog() << std::endl;
+  if ( Ok )
+    std::cout << std::endl << "End of MG-Tetra execution !" << std::endl;
+
+  // --------------
+  // read a result
+  // --------------
+  Ok = Ok && readGMFFile( &mgTetra, theHelper, aResultFileName );
+
+  // ---------------------
+  // remove working files
+  // ---------------------
+  if ( mgTetra.HasLog() )
+  {
+    if( _computeCanceled )
+      error( "interruption initiated by user" );
+    else
+    {
+      // get problem description from the log file
+      std::vector <const SMDS_MeshNode*> nodeByGhsId;
+      getNodeByGhsId( theMesh, nodeByGhsId );
+      _Ghs2smdsConvertor conv( nodeByGhsId, SMESH_ProxyMesh::Ptr( new SMESH_ProxyMesh( theMesh )));
+      error( GHS3DPlugin_GHS3D::getErrorDescription( logInStandardOutput ? 0 : aLogFileName.c_str(),
+                                                     mgTetra.GetLog(), conv, Ok ));
+    }
+  }
+  else {
+    // the log file is empty
+    removeFile( aLogFileName );
+    INFOS( "MG-Tetra Error, " << errStr);
+    error(COMPERR_ALGO_FAILED, errStr);
+  }
+
+  if ( Ok && removeLogOnSuccess )
+  {
+    removeFile( aLogFileName );
+  }
+  if ( !keepFiles )
+  {
+    if ( !Ok && _computeCanceled )
+      removeFile( aLogFileName );
+    removeFile( aGMFFileName );
+    removeFile( aSolFileName );
+    removeFile( aResultFileName );
+    removeFile( aResSolFileName );
+  }
+  return Ok;
+}
+
+
+// double GHS3DPlugin_Optimizer::GetProgress() const
+// {
+// }
diff --git a/src/GHS3DPlugin/GHS3DPlugin_Optimizer.hxx b/src/GHS3DPlugin/GHS3DPlugin_Optimizer.hxx
new file mode 100644 (file)
index 0000000..7028923
--- /dev/null
@@ -0,0 +1,60 @@
+// Copyright (C) 2004-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File      : GHS3DPlugin_Optimizer.hxx
+// Created   : Mon Oct 31 19:58:02 2016
+
+
+#ifndef __GHS3DPlugin_Optimizer_HXX__
+#define __GHS3DPlugin_Optimizer_HXX__
+
+#include <SMESH_Algo.hxx>
+
+class GHS3DPlugin_OptimizerHypothesis;
+
+class GHS3DPlugin_Optimizer: public SMESH_3D_Algo
+{
+public:
+  GHS3DPlugin_Optimizer(int hypId, SMESH_Gen* gen);
+
+  virtual bool CheckHypothesis(SMESH_Mesh&         aMesh,
+                               const TopoDS_Shape& aShape,
+                               Hypothesis_Status&  aStatus);
+
+  virtual void CancelCompute();
+  bool         computeCanceled() { return _computeCanceled; }
+
+  virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
+                        MapShapeNbElems& aResMap);
+
+  virtual bool Compute(SMESH_Mesh&         theMesh,
+                       SMESH_MesherHelper* theHelper);
+  virtual bool Compute(SMESH_Mesh &         aMesh,
+                       const TopoDS_Shape & aShape);
+
+  static const char* Name() { return "MG-Tetra Optimization"; }
+
+  //virtual double GetProgress() const;
+
+private:
+
+  const GHS3DPlugin_OptimizerHypothesis* _hyp;
+};
+
+
+#endif
diff --git a/src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis.cxx b/src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis.cxx
new file mode 100644 (file)
index 0000000..d183a14
--- /dev/null
@@ -0,0 +1,202 @@
+// Copyright (C) 2004-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File      : GHS3DPlugin_OptimizerHypothesis.cxx
+// Created   : Tue Nov  1 17:18:38 2016
+
+#include "GHS3DPlugin_OptimizerHypothesis.hxx"
+
+#include <SMESH_Gen.hxx>
+
+GHS3DPlugin_OptimizerHypothesis::GHS3DPlugin_OptimizerHypothesis(int         hypId,
+                                                                 SMESH_Gen * gen)
+  :GHS3DPlugin_Hypothesis( hypId, gen ),
+   myOptimization( YES ),
+   mySplitOverConstrained( NO ),
+   mySmoothOffSlivers( false ),
+   myMaximalNumberOfThreads( 4 ),
+   myPThreadsMode( NONE )
+{
+  _name = GetHypType();
+  _param_algo_dim = 3;
+}
+
+void GHS3DPlugin_OptimizerHypothesis::SetOptimization( Mode mode )
+{
+  if ( myOptimization != mode )
+  {
+    myOptimization = mode;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+GHS3DPlugin_OptimizerHypothesis::Mode GHS3DPlugin_OptimizerHypothesis::GetOptimization() const
+{
+  return myOptimization;
+}
+
+void GHS3DPlugin_OptimizerHypothesis::SetSplitOverConstrained( Mode mode )
+{
+  if ( mode != mySplitOverConstrained )
+  {
+    mySplitOverConstrained = mode;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+GHS3DPlugin_OptimizerHypothesis::Mode GHS3DPlugin_OptimizerHypothesis::GetSplitOverConstrained() const
+{
+  return mySplitOverConstrained;
+}
+
+void GHS3DPlugin_OptimizerHypothesis::SetSmoothOffSlivers( bool toSmooth )
+{
+  if ( mySmoothOffSlivers != toSmooth )
+  {
+    mySmoothOffSlivers = toSmooth;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+bool GHS3DPlugin_OptimizerHypothesis::GetSmoothOffSlivers() const
+{
+  return mySmoothOffSlivers;
+}
+
+void GHS3DPlugin_OptimizerHypothesis::SetPThreadsMode( PThreadsMode mode )
+{
+  if ( myPThreadsMode != mode )
+  {
+    myPThreadsMode = mode;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+GHS3DPlugin_OptimizerHypothesis::PThreadsMode GHS3DPlugin_OptimizerHypothesis::GetPThreadsMode() const
+{
+  return myPThreadsMode;
+}
+
+void GHS3DPlugin_OptimizerHypothesis::SetMaximalNumberOfThreads( int nb )
+{
+  if ( myMaximalNumberOfThreads != nb )
+  {
+    myMaximalNumberOfThreads = nb;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+int GHS3DPlugin_OptimizerHypothesis::GetMaximalNumberOfThreads() const
+{
+  return myMaximalNumberOfThreads;
+}
+
+
+std::ostream & GHS3DPlugin_OptimizerHypothesis::SaveTo(std::ostream & save)
+{
+  save << " " << (int)myOptimization
+       << " " << (int)mySplitOverConstrained
+       << " " << (int)mySmoothOffSlivers
+       << " " << (int)myMaximalNumberOfThreads
+       << " " << (int)myPThreadsMode << " ";
+
+  GHS3DPlugin_Hypothesis::SaveTo( save );
+
+  return save;
+}
+
+std::istream & GHS3DPlugin_OptimizerHypothesis::LoadFrom(std::istream & load)
+{
+  int i;
+
+  if ( load >> i )
+    myOptimization = (Mode) i;
+  if ( load >> i )
+    mySplitOverConstrained = (Mode) i;
+  if ( load >> i )
+    mySmoothOffSlivers = (bool) i;
+  if ( load >> i )
+    myMaximalNumberOfThreads = i;
+  if ( load >> i )
+    myPThreadsMode = (PThreadsMode) i;
+
+  GHS3DPlugin_Hypothesis::LoadFrom( load );
+  return load;
+}
+
+bool GHS3DPlugin_OptimizerHypothesis::SetParametersByMesh(const SMESH_Mesh*   theMesh,
+                                                          const TopoDS_Shape& theShape)
+{
+  return false;
+}
+
+bool GHS3DPlugin_OptimizerHypothesis::SetParametersByDefaults(const TDefaults&  theDflts,
+                                                              const SMESH_Mesh* theMesh)
+{
+  return false;
+}
+
+std::string GHS3DPlugin_OptimizerHypothesis::CommandToRun(const GHS3DPlugin_OptimizerHypothesis* hyp)
+{
+  SMESH_Comment cmd( GetExeName() );
+
+  if ( hyp )
+  {
+    const char* mode[3] = { "no", "yes", "only" };
+
+    if ( hyp->GetOptimization() >= 0 && hyp->GetOptimization() < 3 )
+      cmd << " --optimisation " << mode[ hyp->GetOptimization() ];
+
+    if ( hyp->myOptimizationLevel >= 0 && hyp->myOptimizationLevel < 5 ) {
+      const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
+      cmd << " --optimisation_level " << level[ hyp->myOptimizationLevel ];
+    }
+
+    if ( hyp->GetSplitOverConstrained() >= 0 && hyp->GetSplitOverConstrained() < 3 )
+      cmd << " --split_overconstrained_elements " << mode[ hyp->GetSplitOverConstrained() ];
+
+    if ( hyp->GetSmoothOffSlivers() )
+      cmd << " --smooth_off_slivers yes";
+
+    switch ( hyp->GetPThreadsMode() ) {
+    case GHS3DPlugin_OptimizerHypothesis::SAFE:
+      cmd << " --pthreads_mode safe"; break;
+    case GHS3DPlugin_OptimizerHypothesis::AGGRESSIVE:
+      cmd << " --pthreads_mode aggressive"; break;
+    default:;
+    }
+
+    if ( hyp->GetMaximalNumberOfThreads() > 0 )
+      cmd << " --max_number_of_threads " << hyp->GetMaximalNumberOfThreads();
+
+    if ( !hyp->myToCreateNewNodes )
+      cmd << " --no_internal_points";
+
+    if ( hyp->myMaximumMemory > 0 )
+      cmd << " --max_memory " << hyp->myMaximumMemory;
+
+    if ( hyp->myInitialMemory > 0 )
+      cmd << " --automatic_memory " << hyp->myInitialMemory;
+
+    cmd << " --verbose " << hyp->myVerboseLevel;
+    
+    cmd << " " << hyp->myTextOption;
+  }
+
+  return cmd;
+}
diff --git a/src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis.hxx b/src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis.hxx
new file mode 100644 (file)
index 0000000..926c238
--- /dev/null
@@ -0,0 +1,86 @@
+// Copyright (C) 2004-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File      : GHS3DPlugin_OptimizerHypothesis.hxx
+// Created   : Tue Nov  1 17:03:17 2016
+
+#ifndef __GHS3DPlugin_OptimizerHypothesis_HXX__
+#define __GHS3DPlugin_OptimizerHypothesis_HXX__
+
+#include "GHS3DPlugin_Hypothesis.hxx"
+
+
+class GHS3DPlugin_OptimizerHypothesis : public GHS3DPlugin_Hypothesis
+{
+public:
+  GHS3DPlugin_OptimizerHypothesis(int hypId, SMESH_Gen * gen);
+
+  // inherited params:
+  // 1 - create new nodes
+  // 2 - optimization level
+  // 3 - init and max memory
+  // 4 - work dir
+  // 5 - verbosity
+  // 6 - log to file
+  // 7 - keep work files
+  // 8 - remove log file
+  // 9 - advanced options
+
+  enum PThreadsMode { SAFE, AGGRESSIVE, NONE };
+  enum Mode { NO, YES, ONLY };
+
+  void SetOptimization( Mode isOnly );
+  Mode GetOptimization() const;
+
+  void SetSplitOverConstrained( Mode mode );
+  Mode GetSplitOverConstrained() const;
+
+  void SetSmoothOffSlivers( bool toSmooth );
+  bool GetSmoothOffSlivers() const;
+
+  void SetPThreadsMode( PThreadsMode mode );
+  PThreadsMode GetPThreadsMode() const;
+
+  void SetMaximalNumberOfThreads( int nb );
+  int  GetMaximalNumberOfThreads() const;
+
+  static const char* GetHypType() { return "MG-Tetra Optimization Parameters"; }
+
+  // Persistence
+  virtual std::ostream & SaveTo(std::ostream & save);
+  virtual std::istream & LoadFrom(std::istream & load);
+
+  /*!
+   * \brief Does nothing
+   */
+  virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+  virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
+
+  static std::string CommandToRun(const GHS3DPlugin_OptimizerHypothesis* hyp);
+
+private:
+
+  Mode myOptimization; // no, yes, only
+  Mode mySplitOverConstrained; // no, yes, only
+  bool mySmoothOffSlivers;
+  int  myMaximalNumberOfThreads;
+  PThreadsMode myPThreadsMode; // safe, aggressive, none
+
+};
+
+#endif
diff --git a/src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis_i.cxx b/src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis_i.cxx
new file mode 100644 (file)
index 0000000..bec2bc5
--- /dev/null
@@ -0,0 +1,144 @@
+// Copyright (C) 2004-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File      : GHS3DPlugin_OptimizerHypothesis_i.cxx
+// Created   : Tue Nov  1 17:46:39 2016
+
+#include "GHS3DPlugin_OptimizerHypothesis_i.hxx"
+
+#include <SMESH_Gen.hxx>
+#include <SMESH_PythonDump.hxx>
+
+#include <Utils_CorbaException.hxx>
+
+GHS3DPlugin_OptimizerHypothesis_i::
+GHS3DPlugin_OptimizerHypothesis_i (PortableServer::POA_ptr thePOA,
+                                   ::SMESH_Gen*            theGenImpl)
+  : SALOME::GenericObj_i( thePOA ), 
+    SMESH_Hypothesis_i( thePOA ),
+    GHS3DPlugin_Hypothesis_i( thePOA, theGenImpl )
+{
+  int id = myBaseImpl ? myBaseImpl->GetID() : theGenImpl->GetANewId();
+  if ( myBaseImpl )
+    delete myBaseImpl;
+
+  myBaseImpl = new ::GHS3DPlugin_OptimizerHypothesis( id, theGenImpl );
+}
+
+namespace
+{
+  const char* dumpMode( GHS3DPlugin::Mode mode )
+  {
+    switch( mode ) {
+    case GHS3DPlugin::NO:   return "GHS3DPlugin.NO";
+    case GHS3DPlugin::YES:  return "GHS3DPlugin.YES";
+    case GHS3DPlugin::ONLY: return "GHS3DPlugin.ONLY";
+    default:                return "GHS3DPlugin.NO";
+    }
+    return 0;
+  }
+}
+
+void GHS3DPlugin_OptimizerHypothesis_i::SetOptimization( GHS3DPlugin::Mode mode )
+{
+  if ((int) GetImpl()->GetOptimization() != (int) mode )
+  {
+    GetImpl()->SetOptimization( ::GHS3DPlugin_OptimizerHypothesis::Mode( mode ));
+    SMESH::TPythonDump() << _this() << ".SetOptimization( " << dumpMode( mode ) << " )";
+  }
+}
+
+GHS3DPlugin::Mode GHS3DPlugin_OptimizerHypothesis_i::GetOptimization()
+{
+  return GHS3DPlugin::Mode( GetImpl()->GetOptimization() );
+}
+
+void GHS3DPlugin_OptimizerHypothesis_i::SetSplitOverConstrained( GHS3DPlugin::Mode mode )
+{
+  if ((int) GetImpl()->GetSplitOverConstrained() != (int) mode )
+  {
+    GetImpl()->SetSplitOverConstrained((::GHS3DPlugin_OptimizerHypothesis::Mode) mode );
+    SMESH::TPythonDump() << _this() << ".SetSplitOverConstrained( " << dumpMode( mode ) << " )";
+  }
+}
+
+GHS3DPlugin::Mode GHS3DPlugin_OptimizerHypothesis_i::GetSplitOverConstrained()
+{
+  return (GHS3DPlugin::Mode) GetImpl()->GetSplitOverConstrained();
+}
+
+void GHS3DPlugin_OptimizerHypothesis_i::SetSmoothOffSlivers( CORBA::Boolean toSmooth )
+{
+  if ( GetImpl()->GetSmoothOffSlivers() != (bool) toSmooth )
+  {
+    GetImpl()->SetSmoothOffSlivers((bool) toSmooth );
+    SMESH::TPythonDump() << _this() << ".SetSmoothOffSlivers( " << toSmooth << " )";
+  }
+}
+
+CORBA::Boolean GHS3DPlugin_OptimizerHypothesis_i::GetSmoothOffSlivers()
+{
+  return GetImpl()->GetSmoothOffSlivers();
+}
+
+void GHS3DPlugin_OptimizerHypothesis_i::SetPThreadsMode( GHS3DPlugin::PThreadsMode mode )
+{
+  if ((int) GetImpl()->GetPThreadsMode() != (int) mode )
+  {
+    GetImpl()->SetPThreadsMode((::GHS3DPlugin_OptimizerHypothesis::PThreadsMode) mode );
+
+    std::string modeStr;
+    switch( mode ) {
+    case ::GHS3DPlugin_OptimizerHypothesis::SAFE:       modeStr = "SAFE"; break;
+    case ::GHS3DPlugin_OptimizerHypothesis::AGGRESSIVE: modeStr = "AGGRESSIVE"; break;
+    default:                                            modeStr = "NONE";
+    }
+    SMESH::TPythonDump() << _this() << ".SetPThreadsMode( GHS3DPlugin." << modeStr << " )";
+  }
+}
+
+GHS3DPlugin::PThreadsMode GHS3DPlugin_OptimizerHypothesis_i::GetPThreadsMode()
+{
+  return (GHS3DPlugin::PThreadsMode) GetImpl()->GetPThreadsMode();
+}
+
+void GHS3DPlugin_OptimizerHypothesis_i::SetMaximalNumberOfThreads( CORBA::Short nb )
+{
+  if ( GetImpl()->GetMaximalNumberOfThreads() != nb )
+  {
+    GetImpl()->SetMaximalNumberOfThreads( nb );
+    SMESH::TPythonDump() << _this() << ".SetMaximalNumberOfThreads( " << nb << " )";
+  }
+}
+
+CORBA::Short GHS3DPlugin_OptimizerHypothesis_i::GetMaximalNumberOfThreads()
+{
+  return (CORBA::Short) GetImpl()->GetMaximalNumberOfThreads();
+}
+
+::GHS3DPlugin_OptimizerHypothesis* GHS3DPlugin_OptimizerHypothesis_i::GetImpl()
+{
+  return (::GHS3DPlugin_OptimizerHypothesis*)myBaseImpl;
+}
+
+CORBA::Boolean GHS3DPlugin_OptimizerHypothesis_i::IsDimSupported( SMESH::Dimension type )
+{
+  return type == SMESH::DIM_3D;
+}
+
+
diff --git a/src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis_i.hxx b/src/GHS3DPlugin/GHS3DPlugin_OptimizerHypothesis_i.hxx
new file mode 100644 (file)
index 0000000..e94ca90
--- /dev/null
@@ -0,0 +1,80 @@
+// Copyright (C) 2004-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File      : GHS3DPlugin_OptimizerHypothesis_i.hxx
+// Created   : Tue Nov  1 17:36:05 2016
+
+#ifndef __GHS3DPlugin_OptimizerHypothesis_i_HXX__
+#define __GHS3DPlugin_OptimizerHypothesis_i_HXX__
+
+#include "GHS3DPlugin_Defs.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(GHS3DPlugin_Algorithm)
+
+#include "GHS3DPlugin_OptimizerHypothesis.hxx"
+#include "GHS3DPlugin_Hypothesis_i.hxx"
+#include "SMESH_Hypothesis_i.hxx"
+
+class SMESH_Gen;
+
+// GHS3DPlugin Optimization Parameters hypothesis
+
+class GHS3DPLUGIN_EXPORT GHS3DPlugin_OptimizerHypothesis_i:
+  public virtual POA_GHS3DPlugin::GHS3DPlugin_OptimizerHypothesis,
+  public virtual GHS3DPlugin_Hypothesis_i
+{
+ public:
+  GHS3DPlugin_OptimizerHypothesis_i (PortableServer::POA_ptr thePOA,
+                                     ::SMESH_Gen*            theGenImpl);
+  // inherited params:
+  // 1 - create new nodes
+  // 2 - optimization level
+  // 3 - init and max memory
+  // 4 - work dir
+  // 5 - verbosity
+  // 6 - log to file
+  // 7 - keep work files
+  // 8 - remove log file
+  // 9 - advanced options
+
+  void SetOptimization( GHS3DPlugin::Mode mode );
+  GHS3DPlugin::Mode GetOptimization();
+
+  void SetSplitOverConstrained( GHS3DPlugin::Mode mode );
+  GHS3DPlugin::Mode GetSplitOverConstrained();
+
+  void SetSmoothOffSlivers( CORBA::Boolean toSmooth );
+  CORBA::Boolean GetSmoothOffSlivers();
+
+  void SetPThreadsMode( GHS3DPlugin::PThreadsMode mode );
+  GHS3DPlugin::PThreadsMode GetPThreadsMode();
+
+  void SetMaximalNumberOfThreads( CORBA::Short nb );
+  CORBA::Short GetMaximalNumberOfThreads();
+
+
+  // Get implementation
+  ::GHS3DPlugin_OptimizerHypothesis* GetImpl();
+  
+  // Verify whether hypothesis supports given entity type 
+  CORBA::Boolean IsDimSupported( SMESH::Dimension type );
+  
+};
+
+#endif
index a81254aba719f659d4a3905da4f03b44a9ad4674..2e71020c8578bb7ba19dc791c801d5cc10234ff6 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-//  SMESH GHS3DPlugin : implementaion of SMESH idl descriptions
-//  File   : GHS3DPlugin.cxx
-//  Author : Julia DOROVSKIKH
-//  Module : SMESH
-//  $Header$
-//
 #include "SMESH_Hypothesis_i.hxx"
 
-#include "utilities.h"
-
 #include "GHS3DPlugin_GHS3D_i.hxx"
 #include "GHS3DPlugin_Hypothesis_i.hxx"
+#include "GHS3DPlugin_OptimizerHypothesis_i.hxx"
 
 template <class T> class GHS3DPlugin_Creator_i:public HypothesisCreator_i<T>
 {
@@ -49,21 +42,23 @@ extern "C"
   GHS3DPLUGIN_EXPORT
   GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName)
   {
-    MESSAGE("GetHypothesisCreator " << aHypName);
-
     GenericHypothesisCreator_i* aCreator = 0;
 
-    // Hypotheses
-
     // Algorithm
     if (strcmp(aHypName, "GHS3D_3D") == 0 ||
         strcmp(aHypName, "MG-Tetra") == 0)
       aCreator = new GHS3DPlugin_Creator_i<GHS3DPlugin_GHS3D_i>;
+
+    else if (strcmp(aHypName, "MG-Tetra Optimization") == 0)
+      aCreator = new GHS3DPlugin_Creator_i<GHS3DPlugin_Optimizer_i>;
+
     // Hypothesis
     else if (strcmp(aHypName, "GHS3D_Parameters") == 0 ||
              strcmp(aHypName, "MG-Tetra Parameters") == 0)
       aCreator = new GHS3DPlugin_Creator_i<GHS3DPlugin_Hypothesis_i>;
-    else ;
+
+    else if (strcmp(aHypName, "MG-Tetra Optimization Parameters") == 0)
+      aCreator = new GHS3DPlugin_Creator_i<GHS3DPlugin_OptimizerHypothesis_i>;
 
     return aCreator;
   }
index 64677654d212c9e733c3041da002c824cbe88a36..5709912dbd9aefb7a95379d2b58da497525dbaa9 100644 (file)
@@ -53,16 +53,18 @@ struct MG_Tetra_API::LibData
   int                 _nbRequiredEdges;
   std::vector<int>    _triaNodes;
   int                 _nbRequiredTria;
+  std::vector<int>    _tetraNodes;
 
   int                 _count;
   volatile bool&      _cancelled_flag;
   std::string         _errorStr;
   double&             _progress;
+  bool                _progressInCallBack;
 
   LibData( volatile bool & cancelled_flag, double& progress )
     : _context(0), _session(0), _tria_mesh(0), _sizemap(0), _tetra_mesh(0),
       _nbRequiredEdges(0), _nbRequiredTria(0),
-      _cancelled_flag( cancelled_flag ), _progress( progress )
+      _cancelled_flag( cancelled_flag ), _progress( progress ), _progressInCallBack( false )
   {
   }
   // methods setting callbacks implemented after callback definitions
@@ -329,6 +331,11 @@ struct MG_Tetra_API::LibData
     _triaNodes.reserve( nb * 3 );
   }
 
+  void SetNbTetra( int nb )
+  {
+    _tetraNodes.reserve( nb * 4 );
+  }
+
   void SetNbReqVertices( int nb )
   {
     _nodeSize.reserve( nb );
@@ -369,6 +376,14 @@ struct MG_Tetra_API::LibData
     _triaNodes.push_back( node3 );
   }
 
+  void AddTetraNodes( int node1, int node2, int node3, int node4, int domain )
+  {
+    _tetraNodes.push_back( node1 );
+    _tetraNodes.push_back( node2 );
+    _tetraNodes.push_back( node3 );
+    _tetraNodes.push_back( node4 );
+  }
+
   int NbNodes()
   {
     return _xyz.size() / 3;
@@ -394,11 +409,21 @@ struct MG_Tetra_API::LibData
     return _triaNodes.size() / 3;
   }
 
+  int NbTetra()
+  {
+    return _tetraNodes.size() / 4;
+  }
+
   int * GetTriaNodes( int iTria )
   {
     return & _triaNodes[ iTria * 3 ];
   }
 
+  int * GetTetraNodes( int iTet )
+  {
+    return & _tetraNodes[ iTet * 4 ];
+  }
+
   int IsVertexRequired( int iNode )
   {
     return ! ( iNode < int( NbNodes() - _nodeSize.size() ));
@@ -485,26 +510,25 @@ namespace // functions called by MG library to exchange with the application
   //   return STATUS_OK;
   // }
 
-  // status_t get_tetrahedron_count(integer * nbtetra, void *user_data)
-  // {
-  //   MG_Tetra_API::LibData* data = (MG_Tetra_API::LibData *) user_data;
-
-  //   *nbtetra = 0;                 /* the number of tetra in your input mesh (0 if you describe a surface mesh) */
-
-  //   return STATUS_OK;
-  // }
+  status_t get_tetrahedron_count(integer * nbtetra, void *user_data)
+  {
+    MG_Tetra_API::LibData* data = (MG_Tetra_API::LibData *) user_data;
+    *nbtetra = data->NbTetra();
 
-  // status_t get_tetrahedron_vertices(integer itetra, integer * vtetra,
-  //                                   void *user_data)
-  // {
-  //   int j;
-  //   MG_Tetra_API::LibData* data = (MG_Tetra_API::LibData *) user_data;
+    return STATUS_OK;
+  }
 
-  //   for (j = 0; j < 4; j++)
-  //     vtetra[j] = 0;              /* the j'th vertex index of the itetra'th tetrahedron */
+  status_t get_tetrahedron_vertices(integer itetra, integer * vtetra,
+                                    void *user_data)
+  {
+    int j;
+    MG_Tetra_API::LibData* data = (MG_Tetra_API::LibData *) user_data;
+    int* nodes = data->GetTetraNodes( itetra-1 );
+    for (j = 0; j < 4; j++)
+      vtetra[j] = nodes[j];
 
-  //   return STATUS_OK;
-  // }
+    return STATUS_OK;
+  }
 
   status_t get_vertex_required_property(integer ivtx, integer * rvtx, void *user_data)
   {
@@ -534,26 +558,37 @@ namespace // functions called by MG library to exchange with the application
     //std::cout << desc << std::endl;
 #endif
 
-    // Compute progress
-    // corresponding messages are:
-    // "  -- PHASE 1 COMPLETED"               => 10 %
-    // "  -- PHASE 2 COMPLETED"               => 25 %
-    // "     ** ITERATION   1"                => 25.* %
-    // "     ** ITERATION   2"                => 25.* %
-    // "  -- PHASE 3 COMPLETED"               => 70 %
-    // "  -- PHASE 4 COMPLETED"               => 98 %
-
-    if ( strncmp( "-- PHASE ", desc + 2, 9 ) == 0 && desc[ 13 ] == 'C' )
+    if ( strncmp( "MGMESSAGE  1009001 ", desc, 19 ) == 0 )
     {
-      const double progress[] = { 10., 25., 70., 98., 100., 100., 100. };
-      int       phase = atoi( desc + 11 );
-      data->_progress = std::max( data->_progress, progress[ phase - 1 ] / 100. );
+      // progress message (10%): "MGMESSAGE  1009001  0 1 1.000000e+01"
+      data->_progress = atof( desc + 24 );
+
+      _progressInCallBack = true;
     }
-    else if ( strncmp( "** ITERATION ", desc + 5, 13 ) == 0 )
+
+    if ( !_progressInCallBack )
     {
-      int         iter = atoi( desc + 20 );
-      double   percent = 25. + iter * ( 70 - 25 ) / 20.;
-      data->_progress = std::max( data->_progress, ( percent / 100. ));
+      // Compute progress
+      // corresponding messages are:
+      // "  -- PHASE 1 COMPLETED"               => 10 %
+      // "  -- PHASE 2 COMPLETED"               => 25 %
+      // "     ** ITERATION   1"                => 25.* %
+      // "     ** ITERATION   2"                => 25.* %
+      // "  -- PHASE 3 COMPLETED"               => 70 %
+      // "  -- PHASE 4 COMPLETED"               => 98 %
+
+      if ( strncmp( "-- PHASE ", desc + 2, 9 ) == 0 && desc[ 13 ] == 'C' )
+      {
+        const double progress[] = { 10., 25., 70., 98., 100., 100., 100. };
+        int       phase = atoi( desc + 11 );
+        data->_progress = std::max( data->_progress, progress[ phase - 1 ] / 100. );
+      }
+      else if ( strncmp( "** ITERATION ", desc + 5, 13 ) == 0 )
+      {
+        int         iter = atoi( desc + 20 );
+        double   percent = 25. + iter * ( 70 - 25 ) / 20.;
+        data->_progress = std::max( data->_progress, ( percent / 100. ));
+      }
     }
 
     return STATUS_OK;
@@ -595,6 +630,8 @@ void MG_Tetra_API::LibData::Init()
   mesh_set_get_edge_vertices( _tria_mesh, get_edge_vertices, this );
   mesh_set_get_triangle_count( _tria_mesh, get_triangle_count, this );
   mesh_set_get_triangle_vertices( _tria_mesh, get_triangle_vertices, this );
+  mesh_set_get_tetrahedron_count( _tria_mesh, get_tetrahedron_count, this );
+  mesh_set_get_tetrahedron_vertices( _tria_mesh, get_tetrahedron_vertices, this );
 
   // Create a tetra session
   _session = tetra_session_new( _context );
@@ -607,9 +644,19 @@ void MG_Tetra_API::LibData::Init()
 
 bool MG_Tetra_API::LibData::Compute()
 {
-  // Set surface mesh
-  status_t ret = tetra_set_surface_mesh( _session, _tria_mesh );
-  if ( ret != STATUS_OK ) MG_Error( "unable to set surface mesh");
+  status_t ret;
+
+  if ( _tetraNodes.empty() )
+  {
+    // Set surface mesh
+    ret = tetra_set_surface_mesh( _session, _tria_mesh );
+    if ( ret != STATUS_OK ) MG_Error( "unable to set surface mesh");
+  }
+  else
+  {
+    ret = tetra_set_volume_mesh( _session, _tria_mesh );
+    if ( ret != STATUS_OK ) MG_Error( "unable to set volume mesh");
+  }
 
   // Set a sizemap
   if ( !_nodeSize.empty() )
@@ -1136,6 +1183,24 @@ void MG_Tetra_API::GmfSetLin(int iMesh, GmfKwdCod what, int node1, int node2, in
   ::GmfSetLin(iMesh, what, node1, node2, node3, domain );
 }
 
+//================================================================================
+/*!
+ * \brief Add tetra nodes
+ */
+//================================================================================
+
+void MG_Tetra_API::GmfSetLin(int iMesh, GmfKwdCod what,
+                             int node1, int node2, int node3, int node4, int domain )
+{
+  if ( _useLib ) {
+#ifdef USE_MG_LIBS
+    _libData->AddTetraNodes( node1, node2, node3, node4, domain );
+    return;
+#endif
+  }
+  ::GmfSetLin(iMesh, what, node1, node2, node3, node4, domain );
+}
+
 //================================================================================
 /*!
  * \brief Close a file
index ee4ad304e7af18fe831b3bd3d5a8783b7eb8447e..e5f0db4157e94a5f4a7b305cf9d30f6355f88d44 100644 (file)
@@ -51,6 +51,7 @@ public:
   void GmfSetLin(int iMesh, GmfKwdCod what, int node1, int node2, int domain ); // edge
   void GmfSetLin(int iMesh, GmfKwdCod what, int id ); // required
   void GmfSetLin(int iMesh, GmfKwdCod what, int node1, int node2, int node3, int domain ); // tria
+  void GmfSetLin(int iMesh, GmfKwdCod what, int node1, int node2, int node3, int node4, int domain ); // tetra
 
   bool Compute( const std::string& cmdLine, std::string& errStr );
 
index dc0b27895e314b19f5c9fd8674ba63e20c0feb82..86ed21c49d498429790d20075f16ebb6a1a84187 100644 (file)
@@ -36,7 +36,8 @@ extern "C"
   {
     SMESHGUI_GenericHypothesisCreator* aCreator = NULL;
     if ( aHypType == "GHS3D_Parameters" ||
-         aHypType == "MG-Tetra Parameters" )
+         aHypType == "MG-Tetra Parameters" ||
+         aHypType == "MG-Tetra Optimization Parameters" )
       aCreator =  new GHS3DPluginGUI_HypothesisCreator( aHypType );
     return aCreator;
   }
index 6d1ab70739564dbd1f97b22bcfc56c6ac1677cef..e589dc51d9e85b272ff2a16021bcd8174f263be2 100644 (file)
      <layout class="QGridLayout" name="gridLayout_3">
       <item row="3" column="4">
        <widget class="QLabel" name="maxMemoryLabel">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
         <property name="text">
          <string>MB</string>
         </property>
       </item>
       <item row="0" column="4">
        <widget class="QLabel" name="initialMemoryLabel">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
         <property name="text">
          <string>MB</string>
         </property>
        </widget>
       </item>
       <item row="0" column="2" colspan="2">
-       <widget class="SalomeApp_IntSpinBox" name="initialMemorySpin">
+       <widget class="SMESHGUI_SpinBox" name="initialMemorySpin">
         <property name="sizePolicy">
-         <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-          <horstretch>1</horstretch>
+         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+          <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
-        <property name="maximum" stdset="0">
-         <number>999999999</number>
+        <property name="maximum">
+         <double>1000000.000000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>10.000000000000000</double>
         </property>
        </widget>
       </item>
       <item row="3" column="2" colspan="2">
-       <widget class="SalomeApp_IntSpinBox" name="maxMemorySpin">
+       <widget class="SMESHGUI_SpinBox" name="maxMemorySpin">
         <property name="sizePolicy">
-         <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-          <horstretch>1</horstretch>
+         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+          <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
-        <property name="maximum" stdset="0">
-         <number>999999999</number>
+        <property name="maximum">
+         <double>1000000.000000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>10.000000000000000</double>
         </property>
        </widget>
       </item>
    <extends>QDoubleSpinBox</extends>
    <header location="global">SMESHGUI_SpinBox.h</header>
   </customwidget>
-  <customwidget>
-   <class>SalomeApp_IntSpinBox</class>
-   <extends>QLineEdit</extends>
-   <header location="global">SalomeApp_IntSpinBox.h</header>
-  </customwidget>
   <customwidget>
    <class>SMESH_AdvOptionsWdg</class>
    <extends>QWidget</extends>
index 051b40347b22f295b1187c3d74a117f099bd05a1..d163198b0f101d38452a5cb38fbe624ca957bc35 100644 (file)
@@ -25,6 +25,7 @@
 #include "GHS3DPluginGUI_HypothesisCreator.h"
 #include "GHS3DPluginGUI_Enums.h"
 #include "GHS3DPluginGUI_Dlg.h"
+#include "GHS3DPlugin_OptimizerHypothesis.hxx"
 
 #include <GeometryGUI.h>
 
 #include <StdMeshersGUI_ObjectReferenceParamWdg.h>
 
 #include <LightApp_SelectionMgr.h>
-#include <SUIT_Session.h>
+#include <SUIT_FileDlg.h>
 #include <SUIT_MessageBox.h>
 #include <SUIT_ResourceMgr.h>
-#include <SUIT_FileDlg.h>
+#include <SUIT_Session.h>
+#include <SalomeApp_IntSpinBox.h>
 #include <SalomeApp_Tools.h>
 #include <SalomeApp_TypeFilter.h>
 
-#include <TopoDS_Iterator.hxx>
-
+#include <QCheckBox>
 #include <QComboBox>
-#include <QPalette>
-#include <QLabel>
+#include <QFileInfo>
 #include <QFrame>
-#include <QVBoxLayout>
 #include <QGridLayout>
+#include <QGroupBox>
+#include <QHeaderView>
+#include <QLabel>
 #include <QLineEdit>
-#include <QCheckBox>
-#include <QTabWidget>
-#include <QSpinBox>
+#include <QPalette>
 #include <QPushButton>
-#include <QFileInfo>
-#include <QGroupBox>
-
+#include <QSpinBox>
+#include <QTabWidget>
 #include <QTableWidget>
 #include <QTableWidgetItem>
-#include <QHeaderView>
+#include <QVBoxLayout>
 
 #include <stdexcept>
 #include <utilities.h>
 
-#include <boost/algorithm/string.hpp>
+namespace
+{
+  QComboBox* getModeCombo( QWidget* parent, bool isPThreadCombo )
+  {
+    QComboBox* combo = new QComboBox( parent );
+    if ( isPThreadCombo )
+    {
+      combo->insertItem((int) GHS3DPlugin_OptimizerHypothesis::SAFE, QObject::tr("MODE_SAFE"));
+      combo->insertItem((int) GHS3DPlugin_OptimizerHypothesis::AGGRESSIVE, QObject::tr("MODE_AGGRESSIVE"));
+      combo->insertItem((int) GHS3DPlugin_OptimizerHypothesis::NONE, QObject::tr("MODE_NONE"));
+    }
+    else
+    {
+      combo->insertItem((int) GHS3DPlugin_OptimizerHypothesis::NO, QObject::tr("MODE_NO"));
+      combo->insertItem((int) GHS3DPlugin_OptimizerHypothesis::YES, QObject::tr("MODE_YES"));
+      combo->insertItem((int) GHS3DPlugin_OptimizerHypothesis::ONLY, QObject::tr("MODE_ONLY"));
+    }
+    return combo;
+  }
+}
 
 //
 // BEGIN EnforcedVertexTableWidgetDelegate
 //
 
 EnforcedVertexTableWidgetDelegate::EnforcedVertexTableWidgetDelegate(QObject *parent)
-    : QItemDelegate(parent)
+  : QItemDelegate(parent)
 {
 }
 
 QWidget *EnforcedVertexTableWidgetDelegate::createEditor(QWidget *parent,
-                                                  const QStyleOptionViewItem & option ,
-                                                  const QModelIndex & index ) const
+                                                         const QStyleOptionViewItem & option ,
+                                                         const QModelIndex & index ) const
 {
   QModelIndex father = index.parent();
   QString entry = father.child(index.row(), ENF_VER_ENTRY_COLUMN).data().toString();
@@ -97,14 +115,9 @@ QWidget *EnforcedVertexTableWidgetDelegate::createEditor(QWidget *parent,
     editor->setDisabled(!entry.isEmpty());
     return editor;
   }
-//   else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
-//     QCheckBox *editor = new QCheckBox(parent);
-//     editor->setDisabled(!entry.isEmpty());
-//     return editor;
-//   }
   else if (index.column() == ENF_VER_GROUP_COLUMN ||
            index.column() == ENF_VER_NAME_COLUMN) {
-//   else {
+    //   else {
     QLineEdit *editor = new QLineEdit(parent);
     if (index.column() != ENF_VER_GROUP_COLUMN) {
       editor->setReadOnly(!entry.isEmpty());
@@ -116,7 +129,7 @@ QWidget *EnforcedVertexTableWidgetDelegate::createEditor(QWidget *parent,
 }
 
 void EnforcedVertexTableWidgetDelegate::setEditorData(QWidget *editor,
-                                               const QModelIndex &index) const
+                                                      const QModelIndex &index) const
 {
   if (index.column() == ENF_VER_X_COLUMN ||
       index.column() == ENF_VER_Y_COLUMN ||
@@ -136,7 +149,7 @@ void EnforcedVertexTableWidgetDelegate::setEditorData(QWidget *editor,
 }
 
 void EnforcedVertexTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
-                                              const QModelIndex &index) const
+                                                     const QModelIndex &index) const
 {
   QModelIndex parent = index.parent();
   
@@ -179,14 +192,15 @@ void EnforcedVertexTableWidgetDelegate::setModelData(QWidget *editor, QAbstractI
 }
 
 void EnforcedVertexTableWidgetDelegate::updateEditorGeometry(QWidget *editor,
-    const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
+                                                             const QStyleOptionViewItem &option,
+                                                             const QModelIndex &/* index */) const
 {
-    editor->setGeometry(option.rect);
+  editor->setGeometry(option.rect);
 }
 
 bool EnforcedVertexTableWidgetDelegate::vertexExists(QAbstractItemModel *model,
-                                              const QModelIndex &index, 
-                                              QString value) const
+                                                     const QModelIndex &index, 
+                                                     QString value) const
 {
   bool exists = false;
   QModelIndex parent = index.parent();
@@ -243,61 +257,51 @@ bool EnforcedVertexTableWidgetDelegate::vertexExists(QAbstractItemModel *model,
 //
 
 EnforcedMeshTableWidgetDelegate::EnforcedMeshTableWidgetDelegate(QObject *parent)
-    : QItemDelegate(parent)
+  : QItemDelegate(parent)
 {
 }
 
 QWidget *EnforcedMeshTableWidgetDelegate::createEditor(QWidget *parent,
-                                                  const QStyleOptionViewItem & option ,
-                                                  const QModelIndex & index ) const
+                                                       const QStyleOptionViewItem & option ,
+                                                       const QModelIndex & index ) const
 {
   return QItemDelegate::createEditor(parent, option, index);
 }
 
 void EnforcedMeshTableWidgetDelegate::setEditorData(QWidget *editor,
-                                               const QModelIndex &index) const
+                                                    const QModelIndex &index) const
 {
-        QItemDelegate::setEditorData(editor, index);
+  QItemDelegate::setEditorData(editor, index);
 }
 
 void EnforcedMeshTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
-                                              const QModelIndex &index) const
+                                                   const QModelIndex &index) const
 {  
   QItemDelegate::setModelData(editor, model, index);
 
 }
 
 void EnforcedMeshTableWidgetDelegate::updateEditorGeometry(QWidget *editor,
-    const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
+                                                           const QStyleOptionViewItem &option,
+                                                           const QModelIndex &/* index */) const
 {
-    editor->setGeometry(option.rect);
+  editor->setGeometry(option.rect);
 }
 
-// bool EnforcedMeshTableWidgetDelegate::enfMeshExists(QAbstractItemModel *model,
-//                                               const QModelIndex &index, 
-//                                               QString value) const
-// {
-//   bool exists = false;
-//   QModelIndex parent = index.parent();
-//   int row = index.row();
-//   int col = index.column();
-//   return exists;
-// }
-
 //
 // END EnforcedMeshTableWidgetDelegate
 //
 
 
 GHS3DPluginGUI_HypothesisCreator::GHS3DPluginGUI_HypothesisCreator( const QString& theHypType )
-: SMESHGUI_GenericHypothesisCreator( theHypType )
+  : SMESHGUI_GenericHypothesisCreator( theHypType )
 {
   GeomToolSelected = NULL;
   GeomToolSelected = getGeomSelectionTool();
 
   iconVertex  = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_OBJBROWSER_VERTEX")));
   iconCompound  = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_OBJBROWSER_COMPOUND")));
-//   mySelectionMgr = SMESH::GetSelectionMgr(SMESHGUI::GetSMESHGUI());
+  //   mySelectionMgr = SMESH::GetSelectionMgr(SMESHGUI::GetSMESHGUI());
   myEnfMeshConstraintLabels << tr( "GHS3D_ENF_MESH_CONSTRAINT_NODE" ) << tr( "GHS3D_ENF_MESH_CONSTRAINT_EDGE" ) << tr("GHS3D_ENF_MESH_CONSTRAINT_FACE");
 }
 
@@ -325,6 +329,11 @@ GEOM::GEOM_Gen_var GHS3DPluginGUI_HypothesisCreator::getGeomEngine()
   return GeometryGUI::GetGeomGen();
 }
 
+bool GHS3DPluginGUI_HypothesisCreator::isOptimization() const
+{
+  return ( hypType() == GHS3DPlugin_OptimizerHypothesis::GetHypType() );
+}
+
 QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
 {
   QFrame* fr = new QFrame( 0 );
@@ -346,7 +355,7 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
 
   int row = 0;
   myName = 0;
-  if( isCreation() )
+  if ( isCreation() )
   {
     aStdLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), myStdGroup ), row, 0, 1, 1 );
     myName = new QLineEdit( myStdGroup );
@@ -358,16 +367,61 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   myToMakeGroupsOfDomains = new QCheckBox( tr( "GHS3D_TO_MAKE_DOMAIN_GROUPS" ), myStdGroup );
   aStdLayout->addWidget( myToMakeGroupsOfDomains, row++, 1, 1, 1 );
 
-  aStdLayout->addWidget( new QLabel( tr( "GHS3D_OPTIMIZATIOL_LEVEL" ), myStdGroup ), row, 0, 1, 1 );
+  QLabel* optimizationLbl = new QLabel( tr( "GHS3D_OPTIMIZATION" ), myStdGroup );
+  aStdLayout->addWidget( optimizationLbl, row, 0, 1, 1 );
+  myOptimizationCombo = getModeCombo( myStdGroup, false );
+  aStdLayout->addWidget( myOptimizationCombo, row++, 1, 1, 1 );
+
+  QLabel* optimizatiolLevelLbl = new QLabel( tr( "GHS3D_OPTIMIZATIOL_LEVEL" ), myStdGroup );
+  aStdLayout->addWidget( optimizatiolLevelLbl, row, 0, 1, 1 );
   myOptimizationLevelCombo = new QComboBox( myStdGroup );
   aStdLayout->addWidget( myOptimizationLevelCombo, row++, 1, 1, 1 );
 
-  QStringList types;
-  types << tr( "LEVEL_NONE" ) << tr( "LEVEL_LIGHT" ) << tr( "LEVEL_MEDIUM" ) << tr( "LEVEL_STANDARDPLUS" ) << tr( "LEVEL_STRONG" );
-  myOptimizationLevelCombo->addItems( types );
-
+  QLabel* splitOverconstrainedLbl = new QLabel( tr("GHS3D_SPLIT_OVERCONSTRAINED"), myStdGroup );
+  aStdLayout->addWidget( splitOverconstrainedLbl, row, 0, 1, 1 );
+  mySplitOverConstrainedCombo = getModeCombo( myStdGroup, false );
+  aStdLayout->addWidget( mySplitOverConstrainedCombo, row++, 1, 1, 1 );
+
+  QLabel* pthreadsModeLbl = new QLabel( tr( "GHS3D_PTHREADS_MODE" ), myStdGroup);
+  aStdLayout->addWidget( pthreadsModeLbl, row, 0, 1, 1 );
+  myPThreadsModeCombo = getModeCombo( myStdGroup, true );
+  aStdLayout->addWidget( myPThreadsModeCombo, row++, 1, 1, 1 );
+
+  QLabel* nbThreadsLbl = new QLabel( tr( "GHS3D_NB_THREADS" ), myStdGroup);
+  aStdLayout->addWidget( nbThreadsLbl, row, 0, 1, 1 );
+  myNumberOfThreadsSpin = new SalomeApp_IntSpinBox( 0, 1000, 1, myStdGroup );
+  aStdLayout->addWidget( myNumberOfThreadsSpin, row++, 1, 1, 1 );
+
+  mySmoothOffSliversCheck = new QCheckBox( tr( "GHS3D_SMOOTH_OFF_SLIVERS" ), myStdGroup );
+  aStdLayout->addWidget( mySmoothOffSliversCheck, row, 0, 1, 1 );
+  myCreateNewNodesCheck = new QCheckBox( tr( "TO_ADD_NODES" ), myStdGroup );
+  aStdLayout->addWidget( myCreateNewNodesCheck, row++, 1, 1, 1 );
+
+  myOptimizationLevelCombo->addItems( QStringList()
+                                      << tr( "LEVEL_NONE" )   << tr( "LEVEL_LIGHT" )
+                                      << tr( "LEVEL_MEDIUM" ) << tr( "LEVEL_STANDARDPLUS" )
+                                      << tr( "LEVEL_STRONG" ));
   aStdLayout->setRowStretch( row, 10 );
 
+  if ( isOptimization() )
+  {
+    myToMeshHolesCheck->hide();
+    myToMakeGroupsOfDomains->hide();
+  }
+  else
+  {
+    optimizationLbl->hide();
+    myOptimizationCombo->hide();
+    splitOverconstrainedLbl->hide();
+    mySplitOverConstrainedCombo->hide();
+    pthreadsModeLbl->hide();
+    myPThreadsModeCombo->hide();
+    nbThreadsLbl->hide();
+    myNumberOfThreadsSpin->hide();
+    mySmoothOffSliversCheck->hide();
+    myCreateNewNodesCheck->hide();
+  }
+
   // advanced parameters
   myAdvGroup = new QWidget();
   QGridLayout* anAdvLayout = new QGridLayout( myAdvGroup );
@@ -387,7 +441,7 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
 
   myAdvWidget->initialMemoryLabel            ->setText (tr( "MEGABYTE" ));
   myAdvWidget->maxMemoryLabel                ->setText (tr( "MEGABYTE" ));
-  
+
   myAdvWidget->workingDirectoryLabel         ->setText (tr( "WORKING_DIR" ));
   myAdvWidget->workingDirectoryPushButton    ->setText (tr( "SELECT_DIR" ));
   myAdvWidget->keepWorkingFilesCheck         ->setText (tr( "KEEP_WORKING_FILES" ));
@@ -406,6 +460,16 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   myAdvWidget->gradationLabel                ->setText (tr( "GHS3D_GRADATION" ));
   myAdvWidget->gradationSpinBox->RangeStepAndValidator(0.0, 5.0, 0.05, "length_precision");
 
+  if ( isOptimization() )
+  {
+    myAdvWidget->createNewNodesCheck->hide();
+    myAdvWidget->removeInitialCentralPointCheck->hide();
+    myAdvWidget->boundaryRecoveryCheck->hide();
+    myAdvWidget->FEMCorrectionCheck->hide();
+    myAdvWidget->gradationLabel->hide();
+    myAdvWidget->gradationSpinBox->hide();
+  }
+
   // Enforced vertices parameters
   myEnfGroup = new QWidget();
   QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
@@ -415,12 +479,12 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   myEnforcedTableWidget->setRowCount( 0 );
   myEnforcedTableWidget->setColumnCount( ENF_VER_NB_COLUMNS );
   myEnforcedTableWidget->setSortingEnabled(true);
-  QStringList enforcedHeaders;
-  enforcedHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
-                  << tr( "GHS3D_ENF_VER_X_COLUMN" )<< tr( "GHS3D_ENF_VER_Y_COLUMN" ) << tr( "GHS3D_ENF_VER_Z_COLUMN" )
-                  << tr( "GHS3D_ENF_SIZE_COLUMN" ) << tr("GHS3D_ENF_ENTRY_COLUMN") << tr("GHS3D_ENF_VER_COMPOUND_COLUMN") << tr( "GHS3D_ENF_GROUP_COLUMN" );
-
-  myEnforcedTableWidget->setHorizontalHeaderLabels(enforcedHeaders);
+  myEnforcedTableWidget->setHorizontalHeaderLabels
+    ( QStringList()
+      << tr( "GHS3D_ENF_NAME_COLUMN" ) << tr( "GHS3D_ENF_VER_X_COLUMN" )
+      << tr( "GHS3D_ENF_VER_Y_COLUMN" ) << tr( "GHS3D_ENF_VER_Z_COLUMN" )
+      << tr( "GHS3D_ENF_SIZE_COLUMN" ) << tr("GHS3D_ENF_ENTRY_COLUMN")
+      << tr("GHS3D_ENF_VER_COMPOUND_COLUMN") << tr( "GHS3D_ENF_GROUP_COLUMN" ));
   myEnforcedTableWidget->verticalHeader()->hide();
   myEnforcedTableWidget->horizontalHeader()->setStretchLastSection(true);
   myEnforcedTableWidget->setAlternatingRowColors(true);
@@ -437,7 +501,7 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   
   myEnforcedTableWidget->setItemDelegate(new EnforcedVertexTableWidgetDelegate());
   
-// VERTEX SELECTION
+  // VERTEX SELECTION
   TColStd_MapOfInteger shapeTypes;
   shapeTypes.Add( TopAbs_VERTEX );
   shapeTypes.Add( TopAbs_COMPOUND );
@@ -465,20 +529,7 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   addVertexButton = new QPushButton(tr("GHS3D_ENF_ADD"),myEnfGroup);
   addVertexButton->setEnabled(false);
   removeVertexButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfGroup);
-//   myGlobalGroupName = new QCheckBox(tr("GHS3D_ENF_VER_GROUPS"), myEnfGroup);
-//   myGlobalGroupName->setChecked(false);
-  
-  // QGroupBox* GroupBox = new QGroupBox( myEnfGroup );
-  // QLabel* info = new QLabel( GroupBox );
-  // info->setText( tr( "GHS3D_ENF_VER_INFO" ) );
-  // info->setWordWrap( true );
-  // QVBoxLayout* GroupBoxVLayout = new QVBoxLayout( GroupBox );
-  // GroupBoxVLayout->setSpacing( 6 );
-  // GroupBoxVLayout->setMargin( 11 );
-  // GroupBoxVLayout->addWidget( info );
-  
 
-  //anEnfLayout->addWidget(GroupBox,                  ENF_VER_WARNING, 0, 1, 2 );
   anEnfLayout->addWidget(myEnforcedTableWidget,     ENF_VER_VERTEX, 0, ENF_VER_NB_LINES, 1);
   
   QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
@@ -530,9 +581,6 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   
   myEnforcedMeshTableWidget->setItemDelegate(new EnforcedMeshTableWidgetDelegate());
   
-//   myEnfMesh = SMESH::SMESH_Mesh::_nil();
-//   myEnfMeshArray = new SMESH::mesh_array();
-
   myEnfMeshWdg = new StdMeshersGUI_ObjectReferenceParamWdg( SMESH::IDSOURCE, myEnfMeshGroup, /*multiSel=*/true);
   myEnfMeshWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_MESH"), "QLineEdit { color: grey }");
   
@@ -548,19 +596,8 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   myMeshGroupName = new QLineEdit(myEnfMeshGroup);
 
   addEnfMeshButton = new QPushButton(tr("GHS3D_ENF_ADD"),myEnfMeshGroup);
-//   addEnfMeshButton->setEnabled(false);
   removeEnfMeshButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfMeshGroup);
-    
-  // QGroupBox* GroupBox2 = new QGroupBox( myEnfMeshGroup );
-  // QLabel* info2 = new QLabel( GroupBox2 );
-  // info2->setText( tr( "GHS3D_ENF_MESH_INFO" ) );
-  // info2->setWordWrap( true );
-  // QVBoxLayout* GroupBox2VLayout = new QVBoxLayout( GroupBox2 );
-  // GroupBox2VLayout->setSpacing( 6 );
-  // GroupBox2VLayout->setMargin( 11 );
-  // GroupBox2VLayout->addWidget( info2 );
   
-  // anEnfMeshLayout->addWidget( GroupBox2,                ENF_MESH_WARNING, 0, 1, 2 );
   anEnfMeshLayout->addWidget(myEnforcedMeshTableWidget, ENF_MESH_MESH, 0, ENF_MESH_NB_LINES , 1);
   
   QGridLayout* anEnfMeshLayout2 = new QGridLayout(myEnfMeshGroup);
@@ -579,12 +616,13 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   // add tabs
   tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
   tab->insertTab( ADV_TAB, myAdvGroup, tr( "GHS3D_ADV_ARGS" ) );
-  tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "GHS3D_ENFORCED_VERTICES" ) );
-  tab->insertTab( ENF_MESH_TAB, myEnfMeshGroup, tr( "GHS3D_ENFORCED_MESHES" ) );
+  if ( !isOptimization() )
+  {
+    tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "GHS3D_ENFORCED_VERTICES" ) );
+    tab->insertTab( ENF_MESH_TAB, myEnfMeshGroup, tr( "GHS3D_ENFORCED_MESHES" ) );
+  }
   tab->setCurrentIndex( STD_TAB );
 
-  // connections
-  //connect( myToMeshHolesCheck,      SIGNAL( toggled( bool ) ), this, SLOT( onToMeshHoles(bool)));
   connect( myAdvWidget->maxMemoryCheck,             SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
   connect( myAdvWidget->initialMemoryCheck,         SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
   connect( myAdvWidget->boundaryRecoveryCheck,      SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
@@ -611,16 +649,13 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   
   connect( addEnfMeshButton,        SIGNAL( clicked()),                       this, SLOT( onAddEnforcedMesh() ) );
   connect( removeEnfMeshButton,     SIGNAL( clicked()),                       this, SLOT( onRemoveEnforcedMesh() ) );
-//   connect( myEnfMeshWdg,            SIGNAL( contentModified()),              this,  SLOT( checkEnfMeshIsDefined() ) );
-//   connect( myEnfMeshConstraint,     SIGNAL( currentIndexChanged(int) ),      this,  SLOT( checkEnfMeshIsDefined() ) );
-//   connect( this,                    SIGNAL( enfMeshDefined(bool) ), addEnfMeshButton, SLOT( setEnabled(bool) ) );
   
   return fr;
 }
 
 /** 
  * This method checks if an enforced vertex is defined;
-**/
+ **/
 void GHS3DPluginGUI_HypothesisCreator::clearEnfVertexSelection()
 {
   if (myEnfVertexWdg->NbObjects() != 0) {
@@ -636,21 +671,21 @@ void GHS3DPluginGUI_HypothesisCreator::clearEnfVertexSelection()
 
 /** 
  * This method checks if an enforced vertex is defined;
-**/
+ **/
 void GHS3DPluginGUI_HypothesisCreator::checkVertexIsDefined()
 {
   bool enfVertexIsDefined = false;
   enfVertexIsDefined = (!mySizeValue->GetString().isEmpty() &&
-                       (!myEnfVertexWdg->NbObjects() == 0 ||
-                       (myEnfVertexWdg->NbObjects() == 0 && !myXCoord->GetString().isEmpty()
-                                                         && !myYCoord->GetString().isEmpty()
-                                                         && !myZCoord->GetString().isEmpty())));
+                        (!myEnfVertexWdg->NbObjects() == 0 ||
+                         (myEnfVertexWdg->NbObjects() == 0 && !myXCoord->GetString().isEmpty()
+                          && !myYCoord->GetString().isEmpty()
+                          && !myZCoord->GetString().isEmpty())));
   emit vertexDefined(enfVertexIsDefined);
 }
 
 /** 
  * This method checks if an enforced mesh is defined;
-**/
+ **/
 void GHS3DPluginGUI_HypothesisCreator::checkEnfMeshIsDefined()
 {
   emit enfMeshDefined( myEnfVertexWdg->NbObjects() != 0);
@@ -658,27 +693,24 @@ void GHS3DPluginGUI_HypothesisCreator::checkEnfMeshIsDefined()
 
 /** 
  * This method resets the content of the X, Y, Z, size and GroupName widgets;
-**/
+ **/
 void GHS3DPluginGUI_HypothesisCreator::clearEnforcedVertexWidgets()
 {
   myXCoord->setCleared(true);
   myYCoord->setCleared(true);
   myZCoord->setCleared(true);
-//   mySizeValue->setCleared(true);
   myXCoord->setText("");
   myYCoord->setText("");
   myZCoord->setText("");
-//   mySizeValue->setText("");
-//   myGroupName->setText("");
   addVertexButton->setEnabled(false);
 }
 
 /** GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(item)
-This method updates the tooltip of a modified item. The QLineEdit widgets content
-is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
+    This method updates the tooltip of a modified item. The QLineEdit widgets content
+    is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
 */
-void GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetItem* item) {
-//   MESSAGE("GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues");
+void GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetItem* item)
+{
   int row = myEnforcedTableWidget->row(item);
       
   QVariant vertexName = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole);
@@ -709,7 +741,6 @@ void GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetIt
     if (!groupName.isEmpty())
       toolTip += QString(" [") + groupName + QString("]");
 
-//     MESSAGE("Tooltip: " << toolTip.toStdString());
     for (int col=0;col<ENF_VER_NB_COLUMNS;col++)
       myEnforcedTableWidget->item(row,col)->setToolTip(toolTip);
 
@@ -732,13 +763,14 @@ void GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetIt
   }
 }
 
-void GHS3DPluginGUI_HypothesisCreator::onSelectEnforcedVertex() {
+void GHS3DPluginGUI_HypothesisCreator::onSelectEnforcedVertex()
+{
   int nbSelEnfVertex = myEnfVertexWdg->NbObjects();
   clearEnforcedVertexWidgets();
   if (nbSelEnfVertex == 1)
   {
     if ( CORBA::is_nil( getGeomEngine() ) && !GeometryGUI::InitGeomGen() )
-    return ;
+      return ;
 
     myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(nbSelEnfVertex-1);
     if (myEnfVertex == GEOM::GEOM_Object::_nil())
@@ -768,13 +800,13 @@ void GHS3DPluginGUI_HypothesisCreator::onSelectEnforcedVertex() {
 }
 
 /** GHS3DPluginGUI_HypothesisCreator::synchronizeCoords()
-This method synchronizes the QLineEdit/SMESHGUI_SpinBox widgets content with the coordinates
-of the enforced vertex clicked in the tree widget.
+    This method synchronizes the QLineEdit/SMESHGUI_SpinBox widgets content with the coordinates
+    of the enforced vertex clicked in the tree widget.
 */
-void GHS3DPluginGUI_HypothesisCreator::synchronizeCoords() {
+void GHS3DPluginGUI_HypothesisCreator::synchronizeCoords()
+{
   clearEnforcedVertexWidgets();
   QList<QTableWidgetItem *> items = myEnforcedTableWidget->selectedItems();
-//   myEnfVertexWdg->disconnect(SIGNAL(contentModified()));
   disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
   if (! items.isEmpty()) {
     QTableWidgetItem *item;
@@ -799,7 +831,7 @@ void GHS3DPluginGUI_HypothesisCreator::synchronizeCoords() {
       }
       QVariant group = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data( Qt::EditRole);
       if (!x.isNull()/* && entry.isNull()*/) {
-//         disconnect( myXCoord, SIGNAL( textChanged(const QString &)), this, SLOT( onSelectEnforcedVertex() ) );
+        //         disconnect( myXCoord, SIGNAL( textChanged(const QString &)), this, SLOT( onSelectEnforcedVertex() ) );
         disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
         disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
         disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
@@ -846,11 +878,13 @@ void GHS3DPluginGUI_HypothesisCreator::synchronizeCoords() {
 }
 
 /** GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh( meshName, geomEntry, elemType, size, groupName)
-This method adds in the tree widget an enforced mesh from mesh, submesh or group with optionally size and and groupName.
+    This method adds in the tree widget an enforced mesh from mesh, submesh or group with optionally size and and groupName.
 */
-void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName)
+void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name,
+                                                       std::string entry,
+                                                       int elementType,
+                                                       std::string groupName)
 {
-  MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", \"" << groupName << "\")");
   bool okToCreate = true;
   QString itemEntry = "";
   int itemElementType = 0;
@@ -858,23 +892,19 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::st
   bool allColumns = true;
   for (int row = 0;row<rowCount;row++) {
     for (int col = 0 ; col < ENF_MESH_NB_COLUMNS ; col++) {
-      MESSAGE("col: " << col);
       if (col == ENF_MESH_CONSTRAINT_COLUMN){
         if (qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col)) == 0) {
           allColumns = false;
-          MESSAGE("allColumns = false");
           break;
         }
       }
       else if (myEnforcedMeshTableWidget->item(row, col) == 0) {
         allColumns = false;
-        MESSAGE("allColumns = false");
         break;
       }
       if (col == ENF_MESH_CONSTRAINT_COLUMN) {
         QComboBox* itemComboBox = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col));
         itemElementType = itemComboBox->currentIndex();
-        MESSAGE("itemElementType: " << itemElementType);
       }
       else if (col == ENF_MESH_ENTRY_COLUMN)
         itemEntry = myEnforcedMeshTableWidget->item(row, col)->data(Qt::EditRole).toString();
@@ -884,11 +914,6 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::st
       break;
   
     if (itemEntry == QString(entry.c_str()) && itemElementType == elementType) { 
-//       // update group name
-//       if (itemGroupName.toStdString() != groupName) {
-//         MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
-//         myEnforcedMeshTableWidget->item(row, ENF_MESH_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
-//       }
       okToCreate = false;
       break;
     } // if
@@ -898,13 +923,10 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::st
   if (!okToCreate)
     return;
   
-  MESSAGE("Creation of enforced mesh");
-
   myEnforcedMeshTableWidget->setRowCount(rowCount+1);
   myEnforcedMeshTableWidget->setSortingEnabled(false);
   
   for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
-    MESSAGE("Column: " << col);
     if (col == ENF_MESH_CONSTRAINT_COLUMN) {
       QComboBox* comboBox = new QComboBox();
       QPalette pal = comboBox->palette();
@@ -913,56 +935,44 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::st
       comboBox->insertItems(0,myEnfMeshConstraintLabels);
       comboBox->setEditable(false);
       comboBox->setCurrentIndex(elementType);
-      MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
       myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
     }
     else {
       QTableWidgetItem* item = new QTableWidgetItem();
       item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
       switch (col) {
-        case ENF_MESH_NAME_COLUMN:
-          item->setData( 0, name.c_str() );
-          item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-          myEnforcedMeshTableWidget->setItem(rowCount,col,item);
-          break;
-        case ENF_MESH_ENTRY_COLUMN:
-          item->setData( 0, entry.c_str() );
-          item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-          myEnforcedMeshTableWidget->setItem(rowCount,col,item);
-          break;
-        case ENF_MESH_GROUP_COLUMN:
-          item->setData( 0, groupName.c_str() );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-          myEnforcedMeshTableWidget->setItem(rowCount,col,item);
-          break;
-        default:
-          break;
+      case ENF_MESH_NAME_COLUMN:
+        item->setData( 0, name.c_str() );
+        item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+        myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+        break;
+      case ENF_MESH_ENTRY_COLUMN:
+        item->setData( 0, entry.c_str() );
+        item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+        myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+        break;
+      case ENF_MESH_GROUP_COLUMN:
+        item->setData( 0, groupName.c_str() );
+        myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+        break;
+      default:
+        break;
       }
     }
-    MESSAGE("Done");
   }
-
-//   connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this,  SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
-  
   myEnforcedMeshTableWidget->setSortingEnabled(true);
-//   myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
-//   updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
-    
 }
 
 /** GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex( x, y, z, size, vertexName, geomEntry, groupName)
-This method adds in the tree widget an enforced vertex with given size and coords (x,y,z) or GEOM vertex or compound and with optionally groupName.
+    This method adds in the tree widget an enforced vertex with given size and coords (x,y,z) or GEOM vertex or compound and with optionally groupName.
 */
 void GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z, double size, std::string vertexName, std::string geomEntry, std::string groupName, bool isCompound)
 {
-  MESSAGE("addEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ", \"" << vertexName << ", \"" << geomEntry << "\", \"" << groupName << "\", " << isCompound << ")");
   myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
   bool okToCreate = true;
   double itemX,itemY,itemZ,itemSize = 0;
   QString itemEntry, itemGroupName = QString("");
-//   bool itemIsCompound;
+  //   bool itemIsCompound;
   int rowCount = myEnforcedTableWidget->rowCount();
   QVariant data;
   bool allColumns;
@@ -977,29 +987,26 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, dou
       data = myEnforcedTableWidget->item(row, col)->data(Qt::EditRole);
       if (!data.isNull()) {
         switch (col) {
-          case ENF_VER_GROUP_COLUMN:
-            itemGroupName = data.toString();
-            break;
-          case ENF_VER_ENTRY_COLUMN:
-            itemEntry = data.toString();
-            break;
-//           case ENF_VER_COMPOUND_COLUMN:
-//             itemIsCompound = data.toBool();
-//             break;
-          case ENF_VER_X_COLUMN:
-            itemX = data.toDouble();
-            break;
-          case ENF_VER_Y_COLUMN:
-            itemY = data.toDouble();
-            break;
-          case ENF_VER_Z_COLUMN:
-            itemZ = data.toDouble();
-            break;
-          case ENF_VER_SIZE_COLUMN:
-            itemSize = data.toDouble();
-            break;
-          default:
-            break;
+        case ENF_VER_GROUP_COLUMN:
+          itemGroupName = data.toString();
+          break;
+        case ENF_VER_ENTRY_COLUMN:
+          itemEntry = data.toString();
+          break;
+        case ENF_VER_X_COLUMN:
+          itemX = data.toDouble();
+          break;
+        case ENF_VER_Y_COLUMN:
+          itemY = data.toDouble();
+          break;
+        case ENF_VER_Z_COLUMN:
+          itemZ = data.toDouble();
+          break;
+        case ENF_VER_SIZE_COLUMN:
+          itemSize = data.toDouble();
+          break;
+        default:
+          break;
         }
       }
     }
@@ -1013,12 +1020,10 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, dou
     {
       // update size
       if (itemSize != size) {
-        MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
         myEnforcedTableWidget->item(row, ENF_VER_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size));
       }
       // update group name
       if (itemGroupName.toStdString() != groupName) {
-        MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
         myEnforcedTableWidget->item(row, ENF_VER_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
       }
       okToCreate = false;
@@ -1027,21 +1032,12 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, dou
   } // for
   if (!okToCreate) {
     if (geomEntry.empty()) {
-      MESSAGE("Vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
     }
     else {
-      MESSAGE("Vertex with entry " << geomEntry << " already exist: dont create again");
     }
     return;
   }
     
-  if (geomEntry.empty()) {
-    MESSAGE("Vertex with coords " << x << ", " << y << ", " << z<< " is created");
-  }
-  else {
-    MESSAGE("Vertex with geom entry " << geomEntry << " is created");
-  }
-
   int vertexIndex=0;
   int indexRef = -1;
   QString myVertexName;
@@ -1061,73 +1057,67 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, dou
     }
   }
   
-  MESSAGE("myVertexName is \"" << myVertexName.toStdString() << "\"");
   myEnforcedTableWidget->setRowCount(rowCount+1);
   myEnforcedTableWidget->setSortingEnabled(false);
   for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
-    MESSAGE("Column: " << col);
     QTableWidgetItem* item = new QTableWidgetItem();
     item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
     switch (col) {
-      case ENF_VER_NAME_COLUMN:
-        item->setData( Qt::EditRole, myVertexName );
-        if (!geomEntry.empty()) {
-          if (isCompound)
-            item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
-          else
-            item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
-        }
-        break;
-      case ENF_VER_X_COLUMN:
-        if (!isCompound)
-          item->setData( 0, QVariant(x) );
-        break;
-      case ENF_VER_Y_COLUMN:
-        if (!isCompound)
-          item->setData( 0, QVariant(y) );
-        break;
-      case ENF_VER_Z_COLUMN:
-        if (!isCompound)
-          item->setData( 0, QVariant(z) );
-        break;
-      case ENF_VER_SIZE_COLUMN:
-        item->setData( 0, QVariant(size) );
-        break;
-      case ENF_VER_ENTRY_COLUMN:
-        if (!geomEntry.empty())
-          item->setData( 0, QString(geomEntry.c_str()) );
-        break;
-      case ENF_VER_COMPOUND_COLUMN:
-        item->setData( Qt::CheckStateRole, isCompound );
-        item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
-        break;
-      case ENF_VER_GROUP_COLUMN:
-        if (!groupName.empty())
-          item->setData( 0, QString(groupName.c_str()) );
-        break;
-      default:
-        break;
+    case ENF_VER_NAME_COLUMN:
+      item->setData( Qt::EditRole, myVertexName );
+      if (!geomEntry.empty()) {
+        if (isCompound)
+          item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
+        else
+          item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
+      }
+      break;
+    case ENF_VER_X_COLUMN:
+      if (!isCompound)
+        item->setData( 0, QVariant(x) );
+      break;
+    case ENF_VER_Y_COLUMN:
+      if (!isCompound)
+        item->setData( 0, QVariant(y) );
+      break;
+    case ENF_VER_Z_COLUMN:
+      if (!isCompound)
+        item->setData( 0, QVariant(z) );
+      break;
+    case ENF_VER_SIZE_COLUMN:
+      item->setData( 0, QVariant(size) );
+      break;
+    case ENF_VER_ENTRY_COLUMN:
+      if (!geomEntry.empty())
+        item->setData( 0, QString(geomEntry.c_str()) );
+      break;
+    case ENF_VER_COMPOUND_COLUMN:
+      item->setData( Qt::CheckStateRole, isCompound );
+      item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
+      break;
+    case ENF_VER_GROUP_COLUMN:
+      if (!groupName.empty())
+        item->setData( 0, QString(groupName.c_str()) );
+      break;
+    default:
+      break;
     }
     
-    MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
     myEnforcedTableWidget->setItem(rowCount,col,item);
-    MESSAGE("Done");
   }
 
   connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this,  SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
   
   myEnforcedTableWidget->setSortingEnabled(true);
-//   myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
+  //   myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
   updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
 }
 
 /** GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
-This method is called when a item is added into the enforced meshes tree widget
+    This method is called when a item is added into the enforced meshes tree widget
 */
 void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
 {
-  MESSAGE("GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()");
-
   GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
   
   that->getGeomSelectionTool()->selectionMgr()->clearFilters();
@@ -1141,44 +1131,31 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
   if (selEnfMeshes == 0)
     return;
 
-  std::string groupName = myMeshGroupName->text().toStdString();
-//   if (myGlobalGroupName->isChecked())
-//     groupName = myGlobalGroupName->text().toStdString();
-
-  if (boost::trim_copy(groupName).empty())
-    groupName = "";
-
+  std::string groupName = myMeshGroupName->text().simplified().toStdString();
   
   int elementType = myEnfMeshConstraint->currentIndex();
   
   
   _PTR(Study) aStudy = SMESH::getStudy();
-  _PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil;
+  _PTR(SObject) aSObj;
   QString meshEntry = myEnfMeshWdg->GetValue();
-  MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString());
   
   if (selEnfMeshes == 1)
   {
-    MESSAGE("1 SMESH object selected");
-//     myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >();
-//     std::string entry = myEnfMeshWdg->GetValue();
     aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str());
     CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj);
     if (!CORBA::is_nil(anObj)) {
-//       SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
       addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
     }
   }
   else
   {
-    MESSAGE(selEnfMeshes << " SMESH objects selected");
     QStringList meshEntries = meshEntry.split(" ", QString::SkipEmptyParts);
     QStringListIterator meshEntriesIt (meshEntries);
     while (meshEntriesIt.hasNext()) {
       aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str());
       CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj);
       if (!CORBA::is_nil(anObj)) {
-//         SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
         addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
       }
     }
@@ -1192,12 +1169,10 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
 
 
 /** GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
-This method is called when a item is added into the enforced vertices tree widget
+    This method is called when a item is added into the enforced vertices tree widget
 */
 void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
 {
-  MESSAGE("GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()");
-
   GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
   
   that->getGeomSelectionTool()->selectionMgr()->clearFilters();
@@ -1212,18 +1187,12 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
   if ((selEnfVertex == 0) && coordsEmpty)
     return;
 
-  std::string groupName = myGroupName->text().toStdString();
-//   if (myGlobalGroupName->isChecked())
-//     groupName = myGlobalGroupName->text().toStdString();
-
-  if (boost::trim_copy(groupName).empty())
-    groupName = "";
+  std::string groupName = myGroupName->text().simplified().toStdString();
 
   double size = mySizeValue->GetValue();
   
   if (selEnfVertex <= 1)
   {
-    MESSAGE("0 or 1 GEOM object selected");
     double x = 0, y = 0, z=0;
     if (myXCoord->GetString() != "") {
       x = myXCoord->GetValue();
@@ -1231,7 +1200,6 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
       z = myZCoord->GetValue();
     }
     if (selEnfVertex == 1) {
-      MESSAGE("1 GEOM object selected");
       myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
       std::string entry = "", name = "";
       bool isCompound = false;
@@ -1243,8 +1211,6 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
       addEnforcedVertex(x, y, z, size, name, entry, groupName, isCompound);
     }
     else {
-      MESSAGE("0 GEOM object selected");
-      MESSAGE("Coords: ("<<x<<","<<y<<","<<z<<")");
       addEnforcedVertex(x, y, z, size, "", "", groupName);
     }
   }
@@ -1268,7 +1234,7 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
         if ( measureOp->IsDone() )
           addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
       } else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) {
-          addEnforcedVertex(0., 0., 0., size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName, true);
+        addEnforcedVertex(0., 0., 0., size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName, true);
       }
     }
   }
@@ -1280,7 +1246,7 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
 }
 
 /** GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
-This method is called when a item is removed from the enforced meshes tree widget
+    This method is called when a item is removed from the enforced meshes tree widget
 */
 void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
 {
@@ -1293,21 +1259,20 @@ void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
     if (!selectedRows.contains( row ) )
       selectedRows.append(row);
   }
-  
+
   qSort( selectedRows );
   QListIterator<int> it( selectedRows );
   it.toBack();
   while ( it.hasPrevious() ) {
-      row = it.previous();
-      MESSAGE("delete row #"<< row);
-      myEnforcedMeshTableWidget->removeRow(row );
+    row = it.previous();
+    myEnforcedMeshTableWidget->removeRow(row );
   }
 
   myEnforcedMeshTableWidget->selectionModel()->clearSelection();
 }
 
 /** GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
-This method is called when a item is removed from the enforced vertices tree widget
+    This method is called when a item is removed from the enforced vertices tree widget
 */
 void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
 {
@@ -1325,9 +1290,8 @@ void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
   QListIterator<int> it( selectedRows );
   it.toBack();
   while ( it.hasPrevious() ) {
-      row = it.previous();
-      MESSAGE("delete row #"<< row);
-      myEnforcedTableWidget->removeRow(row );
+    row = it.previous();
+    myEnforcedTableWidget->removeRow(row );
   }
 
   myEnforcedTableWidget->selectionModel()->clearSelection();
@@ -1358,16 +1322,14 @@ void GHS3DPluginGUI_HypothesisCreator::updateWidgets()
        sender() == myAdvWidget->keepWorkingFilesCheck )
   {
     bool logFileRemovable = myAdvWidget->logInFileCheck->isChecked() &&
-                            !myAdvWidget->keepWorkingFilesCheck->isChecked();
-                             
+      !myAdvWidget->keepWorkingFilesCheck->isChecked();
+
     myAdvWidget->removeLogOnSuccessCheck->setEnabled( logFileRemovable );
   }
 }
 
 bool GHS3DPluginGUI_HypothesisCreator::checkParams(QString& msg) const
 {
-  MESSAGE("GHS3DPluginGUI_HypothesisCreator::checkParams");
-
   if ( !QFileInfo( myAdvWidget->workingDirectoryLineEdit->text().trimmed() ).isWritable() ) {
     SUIT_MessageBox::warning( dlg(),
                               tr( "SMESH_WRN_WARNING" ),
@@ -1380,23 +1342,34 @@ bool GHS3DPluginGUI_HypothesisCreator::checkParams(QString& msg) const
 
 void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
 {
-  MESSAGE("GHS3DPluginGUI_HypothesisCreator::retrieveParams");
   GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
   GHS3DHypothesisData data;
   readParamsFromHypo( data );
 
   if ( myName )
+  {
     myName->setText( data.myName );
-  
+
+    int width = QFontMetrics( myName->font() ).width( data.myName );
+    QGridLayout* aStdLayout = (QGridLayout*) myStdGroup->layout();
+    aStdLayout->setColumnMinimumWidth( 1, width + 10 );
+  }
   myToMeshHolesCheck                          ->setChecked    ( data.myToMeshHoles );
   myToMakeGroupsOfDomains                     ->setChecked    ( data.myToMakeGroupsOfDomains );
   myOptimizationLevelCombo                    ->setCurrentIndex( data.myOptimizationLevel );
+  myOptimizationCombo                         ->setCurrentIndex( data.myOptimization );
+  mySplitOverConstrainedCombo                 ->setCurrentIndex( data.mySplitOverConstrained );
+  myPThreadsModeCombo                         ->setCurrentIndex( data.myPThreadsMode );
+  myNumberOfThreadsSpin                       ->setValue      ( data.myNumberOfThreads );
+  mySmoothOffSliversCheck                     ->setChecked    ( data.mySmoothOffSlivers );
+  myCreateNewNodesCheck                       ->setChecked    ( data.myToCreateNewNodes );
+
   myAdvWidget->maxMemoryCheck                 ->setChecked    ( data.myMaximumMemory > 0 );
-  myAdvWidget->maxMemorySpin                  ->setValue      ( qMax( (int)data.myMaximumMemory,
-                                                                      myAdvWidget->maxMemorySpin->minimum() ));
+  myAdvWidget->maxMemorySpin                  ->setValue      ( qMax( data.myMaximumMemory,
+                                                                      (float)myAdvWidget->maxMemorySpin->minimum() ));
   myAdvWidget->initialMemoryCheck             ->setChecked    ( data.myInitialMemory > 0 );
-  myAdvWidget->initialMemorySpin              ->setValue      ( qMax( (int)data.myInitialMemory,
-                                                                      myAdvWidget->initialMemorySpin->minimum() ));
+  myAdvWidget->initialMemorySpin              ->setValue      ( qMax( data.myInitialMemory,
+                                                                      (float)myAdvWidget->initialMemorySpin->minimum() ));
   myAdvWidget->workingDirectoryLineEdit       ->setText       ( data.myWorkingDir );
   myAdvWidget->keepWorkingFilesCheck           ->setChecked    ( data.myKeepFiles );
   myAdvWidget->verboseLevelSpin               ->setValue      ( data.myVerboseLevel );
@@ -1420,63 +1393,52 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
     myEnforcedTableWidget->setRowCount(rowCount+1);
 
     for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
-      MESSAGE("Column: " << col);
-//       MESSAGE("enfVertex->isCompound: " << enfVertex->isCompound);
       QTableWidgetItem* item = new QTableWidgetItem();
       item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
       switch (col) {
-        case ENF_VER_NAME_COLUMN:
-          item->setData( 0, enfVertex->name.c_str() );
-          if (!enfVertex->geomEntry.empty()) {
-            if (enfVertex->isCompound)
-              item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
-            else
-              item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
+      case ENF_VER_NAME_COLUMN:
+        item->setData( 0, enfVertex->name.c_str() );
+        if (!enfVertex->geomEntry.empty()) {
+          if (enfVertex->isCompound)
+            item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
+          else
+            item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
             
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-          }
-          break;
-        case ENF_VER_X_COLUMN:
-          if (!enfVertex->isCompound) {
-            item->setData( 0, enfVertex->coords.at(0) );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-          }
-          break;
-        case ENF_VER_Y_COLUMN:
-          if (!enfVertex->isCompound) {
-            item->setData( 0, enfVertex->coords.at(1) );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-          }
-          break;
-        case ENF_VER_Z_COLUMN:
-          if (!enfVertex->isCompound) {
-            item->setData( 0, enfVertex->coords.at(2) );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-          }
-          break;
-        case ENF_VER_SIZE_COLUMN:
-          item->setData( 0, enfVertex->size );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-          break;
-        case ENF_VER_ENTRY_COLUMN:
-          item->setData( 0, enfVertex->geomEntry.c_str() );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-          break;
-        case ENF_VER_COMPOUND_COLUMN:
-          item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
-          item->setData( Qt::CheckStateRole, enfVertex->isCompound );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << enfVertex->isCompound);
-          break;
-        case ENF_VER_GROUP_COLUMN:
-          item->setData( 0, enfVertex->groupName.c_str() );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-          break;
-        default:
-          break;
+        }
+        break;
+      case ENF_VER_X_COLUMN:
+        if (!enfVertex->isCompound) {
+          item->setData( 0, enfVertex->coords.at(0) );
+        }
+        break;
+      case ENF_VER_Y_COLUMN:
+        if (!enfVertex->isCompound) {
+          item->setData( 0, enfVertex->coords.at(1) );
+        }
+        break;
+      case ENF_VER_Z_COLUMN:
+        if (!enfVertex->isCompound) {
+          item->setData( 0, enfVertex->coords.at(2) );
+        }
+        break;
+      case ENF_VER_SIZE_COLUMN:
+        item->setData( 0, enfVertex->size );
+        break;
+      case ENF_VER_ENTRY_COLUMN:
+        item->setData( 0, enfVertex->geomEntry.c_str() );
+        break;
+      case ENF_VER_COMPOUND_COLUMN:
+        item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
+        item->setData( Qt::CheckStateRole, enfVertex->isCompound );
+        break;
+      case ENF_VER_GROUP_COLUMN:
+        item->setData( 0, enfVertex->groupName.c_str() );
+        break;
+      default:
+        break;
       }
       
       myEnforcedTableWidget->setItem(rowCount,col,item);
-      MESSAGE("Done");
     }
     that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
     rowCount++;
@@ -1493,14 +1455,13 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
   rowCount = 0;
   myEnforcedMeshTableWidget->clearContents();
   myEnforcedMeshTableWidget->setSortingEnabled(false);
-//   myEnforcedMeshTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
+  //   myEnforcedMeshTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
   for(itMesh = data.myEnforcedMeshes.begin() ; itMesh != data.myEnforcedMeshes.end(); itMesh++ )
   {
     TEnfMesh* enfMesh = (*itMesh);
     myEnforcedMeshTableWidget->setRowCount(rowCount+1);
 
     for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
-      MESSAGE("Column: " << col);
       if (col == ENF_MESH_CONSTRAINT_COLUMN) {
         QComboBox* comboBox = new QComboBox();
         QPalette pal = comboBox->palette();
@@ -1509,43 +1470,35 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
         comboBox->insertItems(0,myEnfMeshConstraintLabels);
         comboBox->setEditable(false);
         comboBox->setCurrentIndex(enfMesh->elementType);
-        MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
         myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
       }
       else {
         QTableWidgetItem* item = new QTableWidgetItem();
         item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
         switch (col) {
-          case ENF_MESH_NAME_COLUMN:
-            item->setData( 0, enfMesh->name.c_str() );
-            item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-            myEnforcedMeshTableWidget->setItem(rowCount,col,item);
-            break;
-          case ENF_MESH_ENTRY_COLUMN:
-            item->setData( 0, enfMesh->entry.c_str() );
-            item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-            myEnforcedMeshTableWidget->setItem(rowCount,col,item);
-            break;
-          case ENF_MESH_GROUP_COLUMN:
-            item->setData( 0, enfMesh->groupName.c_str() );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-            myEnforcedMeshTableWidget->setItem(rowCount,col,item);
-            break;
-          default:
-            break;
+        case ENF_MESH_NAME_COLUMN:
+          item->setData( 0, enfMesh->name.c_str() );
+          item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+          myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+          break;
+        case ENF_MESH_ENTRY_COLUMN:
+          item->setData( 0, enfMesh->entry.c_str() );
+          item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+          myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+          break;
+        case ENF_MESH_GROUP_COLUMN:
+          item->setData( 0, enfMesh->groupName.c_str() );
+          myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+          break;
+        default:
+          break;
         }
       }
       
-//       myEnforcedMeshTableWidget->setItem(rowCount,col,item);
-      MESSAGE("Done");
     }
-//     that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
     rowCount++;
   }
 
-//   connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this,  SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
   myEnforcedMeshTableWidget->setSortingEnabled(true);
   
   for (int col=0;col<ENF_MESH_NB_COLUMNS;col++)
@@ -1557,86 +1510,82 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
 
 QString GHS3DPluginGUI_HypothesisCreator::storeParams() const
 {
-    MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParams");
-    GHS3DHypothesisData data;
-    readParamsFromWidgets( data );
-    storeParamsToHypo( data );
-    
-    QString valStr = "";
+  GHS3DHypothesisData data;
+  readParamsFromWidgets( data );
+  storeParamsToHypo( data );
     
-    if ( !data.myBoundaryRecovery )
-        valStr = " --components " + data.myToMeshHoles ? "all" : "outside_components" ;
+  QString valStr = "";
     
-    if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
-        const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
-        valStr += " --optimisation_level ";
-        valStr += level[ data.myOptimizationLevel ];
-    }
-    if ( data.myMaximumMemory > 0 ) {
-        valStr += " --max_memory ";
-        valStr += QString::number( data.myMaximumMemory );
-    }
-    if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
-        valStr += " --automatic_memory ";
-        valStr += QString::number( data.myInitialMemory );
-    }
-    valStr += " --verbose ";
-    valStr += QString::number( data.myVerboseLevel );
+  if ( !data.myBoundaryRecovery )
+    valStr = " --components " + data.myToMeshHoles ? "all" : "outside_components" ;
     
-    if ( !data.myToCreateNewNodes )
-        valStr += " --no_internal_points";
+  if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
+    const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
+    valStr += " --optimisation_level ";
+    valStr += level[ data.myOptimizationLevel ];
+  }
+  if ( data.myMaximumMemory > 0 ) {
+    valStr += " --max_memory ";
+    valStr += QString::number( data.myMaximumMemory );
+  }
+  if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
+    valStr += " --automatic_memory ";
+    valStr += QString::number( data.myInitialMemory );
+  }
+  valStr += " --verbose ";
+  valStr += QString::number( data.myVerboseLevel );
     
-    if ( data.myRemoveInitialCentralPoint )
-        valStr += " --no_initial_central_point";
+  if ( !data.myToCreateNewNodes )
+    valStr += " --no_internal_points";
     
-    if ( data.myBoundaryRecovery )
-        valStr += " -C";
+  if ( data.myRemoveInitialCentralPoint )
+    valStr += " --no_initial_central_point";
     
-    if ( data.myFEMCorrection )
-        valStr += " -FEM";
+  if ( data.myBoundaryRecovery )
+    valStr += " -C";
     
-    if ( data.myGradation != 1.05 ) {
-      valStr += " -Dcpropa=";
-      valStr += QString::number( data.myGradation );
-    }
+  if ( data.myFEMCorrection )
+    valStr += " -FEM";
     
-    valStr += " ";
-    valStr += data.myTextOption;
+  if ( data.myGradation != 1.05 ) {
+    valStr += " -Dcpropa=";
+    valStr += QString::number( data.myGradation );
+  }
     
-//     valStr += " #BEGIN ENFORCED VERTICES#";
-//     // Add size map parameters storage
-//     for (int i=0 ; i<mySmpModel->rowCount() ; i++) {
-//         valStr += " (";
-//         double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble();
-//         double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble();
-//         double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble();
-//         double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble();
-//         valStr += QString::number( x );
-//         valStr += ",";
-//         valStr += QString::number( y );
-//         valStr += ",";
-//         valStr += QString::number( z );
-//         valStr += ")=";
-//         valStr += QString::number( size );
-//         if (i!=mySmpModel->rowCount()-1)
-//             valStr += ";";
-//     }
-//     valStr += " #END ENFORCED VERTICES#";
-//     MESSAGE(valStr.toStdString());
+  valStr += " ";
+  valStr += data.myTextOption;
+
   return valStr;
 }
 
 bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& h_data ) const
 {
-  MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo");
   GHS3DPlugin::GHS3DPlugin_Hypothesis_var h =
     GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( initParamsHypothesis() );
+  GHS3DPlugin::GHS3DPlugin_OptimizerHypothesis_var opt =
+    GHS3DPlugin::GHS3DPlugin_OptimizerHypothesis::_narrow( initParamsHypothesis() );
 
   HypothesisData* data = SMESH::GetHypothesisData( hypType() );
   h_data.myName = isCreation() && data ? hypName() : "";
 
+  if ( !opt->_is_nil() )
+  {
+    h_data.myOptimization         = opt->GetOptimization();
+    h_data.mySplitOverConstrained = opt->GetSplitOverConstrained();
+    h_data.myPThreadsMode         = opt->GetPThreadsMode();
+    h_data.myNumberOfThreads      = opt->GetMaximalNumberOfThreads();
+    h_data.mySmoothOffSlivers     = opt->GetSmoothOffSlivers();
+  }
+  else // avoid "Conditional jump or move depends on uninitialised value" error
+  {
+    h_data.myOptimization         = 1;
+    h_data.mySplitOverConstrained = 1;
+    h_data.myPThreadsMode         = 1;
+    h_data.myNumberOfThreads      = 1;
+    h_data.mySmoothOffSlivers     = 1;
+  }
   h_data.myToMeshHoles                = h->GetToMeshHoles();
-  h_data.myToMakeGroupsOfDomains      = /*h->GetToMeshHoles() &&*/ h->GetToMakeGroupsOfDomains();
+  h_data.myToMakeGroupsOfDomains      = h->GetToMakeGroupsOfDomains();
   h_data.myMaximumMemory              = h->GetMaximumMemory();
   h_data.myInitialMemory              = h->GetInitialMemory();
   h_data.myInitialMemory              = h->GetInitialMemory();
@@ -1654,7 +1603,6 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData&
   h_data.myRemoveLogOnSuccess         = h->GetRemoveLogOnSuccess();
   
   GHS3DPlugin::GHS3DEnforcedVertexList_var vertices = h->GetEnforcedVertices();
-  MESSAGE("vertices->length(): " << vertices->length());
   h_data.myEnforcedVertices.clear();
   for (CORBA::ULong i=0 ; i<vertices->length() ; i++) {
     TEnfVertex* myVertex = new TEnfVertex();
@@ -1666,13 +1614,11 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData&
     if (vertices[i].coords.length()) {
       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);
     }
     h_data.myEnforcedVertices.insert(myVertex);
   }
   
   GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshes = h->GetEnforcedMeshes();
-  MESSAGE("enfMeshes->length(): " << enfMeshes->length());
   h_data.myEnforcedMeshes.clear();
   for (CORBA::ULong i=0 ; i<enfMeshes->length() ; i++) {
     TEnfMesh* myEnfMesh = new TEnfMesh();
@@ -1680,19 +1626,19 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData&
     myEnfMesh->entry = CORBA::string_dup(enfMeshes[i].entry.in());
     myEnfMesh->groupName = CORBA::string_dup(enfMeshes[i].groupName.in());
     switch (enfMeshes[i].elementType) {
-      case SMESH::NODE:
-        myEnfMesh->elementType = 0;
-        break;
-      case SMESH::EDGE:
-        myEnfMesh->elementType = 1;
-        break;
-      case SMESH::FACE:
-        myEnfMesh->elementType = 2;
-        break;
-      default:
-        break;
+    case SMESH::NODE:
+      myEnfMesh->elementType = 0;
+      break;
+    case SMESH::EDGE:
+      myEnfMesh->elementType = 1;
+      break;
+    case SMESH::FACE:
+      myEnfMesh->elementType = 2;
+      break;
+    default:
+      break;
     }
-//     myEnfMesh->elementType = enfMeshes[i].elementType;
+    //     myEnfMesh->elementType = enfMeshes[i].elementType;
     h_data.myEnforcedMeshes.insert(myEnfMesh);
   }
   return true;
@@ -1700,9 +1646,10 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData&
 
 bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisData& h_data ) const
 {
-  MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo");
   GHS3DPlugin::GHS3DPlugin_Hypothesis_var h =
     GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( hypothesis() );
+  GHS3DPlugin::GHS3DPlugin_OptimizerHypothesis_var opt =
+    GHS3DPlugin::GHS3DPlugin_OptimizerHypothesis::_narrow( initParamsHypothesis() );
 
   bool ok = true;
   try
@@ -1742,22 +1689,27 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD
       h->SetAdvancedOption       ( h_data.myTextOption.toLatin1().constData() );
     if ( h->GetStandardOutputLog() != h_data.myLogInStandardOutput   )
       h->SetStandardOutputLog( h_data.myLogInStandardOutput  );
-     if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess   )
+    if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess   )
       h->SetRemoveLogOnSuccess( h_data.myRemoveLogOnSuccess  );
-    
+
+    if ( !opt->_is_nil() )
+    {
+      opt->SetOptimization          ( (GHS3DPlugin::Mode) h_data.myOptimization );
+      opt->SetSplitOverConstrained  ( (GHS3DPlugin::Mode) h_data.mySplitOverConstrained );
+      opt->SetPThreadsMode          ( (GHS3DPlugin::PThreadsMode) h_data.myPThreadsMode );
+      opt->SetSmoothOffSlivers      ( h_data.mySmoothOffSlivers );
+      opt->SetMaximalNumberOfThreads( h_data.myNumberOfThreads );
+    }
+
     // Enforced vertices
-    int nbVertex = (int) h_data.myEnforcedVertices.size();
     GHS3DPlugin::GHS3DEnforcedVertexList_var vertexHyp = h->GetEnforcedVertices();
     int nbVertexHyp = vertexHyp->length();
-    
-    MESSAGE("Store params for size maps: " << nbVertex << " enforced vertices");
-    MESSAGE("h->GetEnforcedVertices()->length(): " << nbVertexHyp);
-    
+
     // 1. Clear all enforced vertices in hypothesis
     // 2. Add new enforced vertex according to h_data
     if ( nbVertexHyp > 0)
       h->ClearEnforcedVertices();
-    
+
     TEnfVertexList::const_iterator it;
     double x = 0, y = 0, z = 0;
     for(it = h_data.myEnforcedVertices.begin() ; it != h_data.myEnforcedVertices.end(); it++ ) {
@@ -1770,20 +1722,16 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD
       }
       ok = h->p_SetEnforcedVertex( enfVertex->size, x, y, z, enfVertex->name.c_str(), enfVertex->geomEntry.c_str(), enfVertex->groupName.c_str(), enfVertex->isCompound);
     } // for
-    
+
     // Enforced Meshes
-    int nbEnfMeshes = (int) h_data.myEnforcedMeshes.size();
     GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshListHyp = h->GetEnforcedMeshes();
     int nbEnfMeshListHyp = enfMeshListHyp->length();
-    
-    MESSAGE("Store params for size maps: " << nbEnfMeshes << " enforced meshes");
-    MESSAGE("h->GetEnforcedMeshes()->length(): " << nbEnfMeshListHyp);
-    
+
     // 1. Clear all enforced vertices in hypothesis
     // 2. Add new enforced vertex according to h_data
     if ( nbEnfMeshListHyp > 0)
       h->ClearEnforcedMeshes();
-    
+
     TEnfMeshList::const_iterator itEnfMesh;
 
     _PTR(Study) aStudy = SMESH::getStudy();
@@ -1794,30 +1742,24 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD
       _PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str());
       SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
 
-      MESSAGE("enfMesh->elementType: " << enfMesh->elementType);
       SMESH::ElementType elementType;
       switch(enfMesh->elementType) {
-        case 0:
-          elementType = SMESH::NODE;
-          break;
-        case 1:
-          elementType = SMESH::EDGE;
-          break;
-        case 2:
-          elementType = SMESH::FACE;
-          break;
-        default:
-          break;
+      case 0:
+        elementType = SMESH::NODE;
+        break;
+      case 1:
+        elementType = SMESH::EDGE;
+        break;
+      case 2:
+        elementType = SMESH::FACE;
+        break;
+      default:
+        break;
       }
     
-      std::cout << "h->p_SetEnforcedMesh(theSource, "<< elementType <<", \""<< enfMesh->name << "\", \"" << enfMesh->groupName.c_str() <<"\")"<<std::endl;
       ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->name.c_str(), enfMesh->groupName.c_str());
     } // for
   } // try
-//   catch(const std::exception& ex) {
-//     std::cout << "Exception: " << ex.what() << std::endl;
-//     throw ex;
-//   }
   catch ( const SALOME::SALOME_Exception& ex )
   {
     SalomeApp_Tools::QtCatchCorbaException( ex );
@@ -1828,17 +1770,20 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD
 
 bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisData& h_data ) const
 {
-  MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets");
   h_data.myName                       = myName ? myName->text() : "";
   h_data.myToMeshHoles                = myToMeshHolesCheck->isChecked();
   h_data.myToMakeGroupsOfDomains      = myToMakeGroupsOfDomains->isChecked();
+  h_data.myOptimization               = myOptimizationCombo->currentIndex();
+  h_data.myOptimizationLevel          = myOptimizationLevelCombo->currentIndex();
+  h_data.mySplitOverConstrained       = mySplitOverConstrainedCombo->currentIndex();
+  h_data.myPThreadsMode               = myPThreadsModeCombo->currentIndex();
+  h_data.myNumberOfThreads            = myNumberOfThreadsSpin->value();
+  h_data.mySmoothOffSlivers           = mySmoothOffSliversCheck->isChecked();
   h_data.myMaximumMemory              = myAdvWidget->maxMemoryCheck->isChecked() ? myAdvWidget->maxMemorySpin->value() : -1;
   h_data.myInitialMemory              = myAdvWidget->initialMemoryCheck->isChecked() ? myAdvWidget->initialMemorySpin->value() : -1;
-  h_data.myOptimizationLevel          = myOptimizationLevelCombo->currentIndex();
   h_data.myKeepFiles                  = myAdvWidget->keepWorkingFilesCheck->isChecked();
   h_data.myWorkingDir                 = myAdvWidget->workingDirectoryLineEdit->text().trimmed();
   h_data.myVerboseLevel               = myAdvWidget->verboseLevelSpin->value();
-  h_data.myToCreateNewNodes           = myAdvWidget->createNewNodesCheck->isChecked();
   h_data.myRemoveInitialCentralPoint  = myAdvWidget->removeInitialCentralPointCheck->isChecked();
   h_data.myBoundaryRecovery           = myAdvWidget->boundaryRecoveryCheck->isChecked();
   h_data.myFEMCorrection              = myAdvWidget->FEMCorrectionCheck->isChecked();
@@ -1846,21 +1791,20 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisDat
   h_data.myTextOption                 = myAdvWidget->advOptionTable->GetCustomOptions();
   h_data.myLogInStandardOutput        = !myAdvWidget->logInFileCheck->isChecked();
   h_data.myRemoveLogOnSuccess         = myAdvWidget->removeLogOnSuccessCheck->isChecked();
+  if ( isOptimization() )
+    h_data.myToCreateNewNodes         = myCreateNewNodesCheck->isChecked();
+  else
+    h_data.myToCreateNewNodes         = myAdvWidget->createNewNodesCheck->isChecked();
   
   // Enforced vertices
   h_data.myEnforcedVertices.clear();
   QVariant valueX, valueY, valueZ;
-  for (int row=0 ; row<myEnforcedTableWidget->rowCount() ; row++) {
-    
+  for (int row=0 ; row<myEnforcedTableWidget->rowCount() ; row++)
+  {
     TEnfVertex *myVertex = new TEnfVertex();
     myVertex->name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    MESSAGE("Add new enforced vertex \"" << myVertex->name << "\"" );
     myVertex->geomEntry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    if (myVertex->geomEntry.size())
-      MESSAGE("Geom entry is \"" << myVertex->geomEntry << "\"" );
     myVertex->groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    if (myVertex->groupName.size())
-      MESSAGE("Group name is \"" << myVertex->groupName << "\"" );
     valueX = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data(Qt::EditRole);
     valueY = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data(Qt::EditRole);
     valueZ = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data(Qt::EditRole);
@@ -1868,34 +1812,24 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisDat
       myVertex->coords.push_back(valueX.toDouble());
       myVertex->coords.push_back(valueY.toDouble());
       myVertex->coords.push_back(valueZ.toDouble());
-      MESSAGE("Coords are (" << myVertex->coords.at(0) << ", "
-                             << myVertex->coords.at(1) << ", "
-                             << myVertex->coords.at(2) << ")");
     }
     myVertex->size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data(Qt::EditRole).toDouble();
-    MESSAGE("Size is " << myVertex->size);
     myVertex->isCompound = myEnforcedTableWidget->item(row,ENF_VER_COMPOUND_COLUMN)->data(Qt::CheckStateRole).toBool();
-    MESSAGE("Is compound ? " << myVertex->isCompound);
     h_data.myEnforcedVertices.insert(myVertex);
   }
   
   // Enforced meshes
   h_data.myEnforcedMeshes.clear();
 
-  for (int row=0 ; row<myEnforcedMeshTableWidget->rowCount() ; row++) {
-    
+  for (int row=0 ; row<myEnforcedMeshTableWidget->rowCount() ; row++)
+  {
     TEnfMesh *myEnfMesh = new TEnfMesh();
     myEnfMesh->name = myEnforcedMeshTableWidget->item(row,ENF_MESH_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    MESSAGE("Add new enforced mesh \"" << myEnfMesh->name << "\"" );
     myEnfMesh->entry = myEnforcedMeshTableWidget->item(row,ENF_MESH_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    MESSAGE("Entry is \"" << myEnfMesh->entry << "\"" );
     myEnfMesh->groupName = myEnforcedMeshTableWidget->item(row,ENF_MESH_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    MESSAGE("Group name is \"" << myEnfMesh->groupName << "\"" );
     QComboBox* combo = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row,ENF_MESH_CONSTRAINT_COLUMN));
     myEnfMesh->elementType = combo->currentIndex();
-    MESSAGE("Element type: " << myEnfMesh->elementType);
     h_data.myEnforcedMeshes.insert(myEnfMesh);
-    std::cout << "h_data.myEnforcedMeshes.size(): " << h_data.myEnforcedMeshes.size() << std::endl;
   }
 
   return true;
@@ -1913,10 +1847,10 @@ QPixmap GHS3DPluginGUI_HypothesisCreator::icon() const
 
 QString GHS3DPluginGUI_HypothesisCreator::type() const
 {
-  return tr( "GHS3D_HYPOTHESIS" );
+  return tr( isOptimization() ? "GHS3D_OPTIMIZATIOL_HYPOTHESIS" : "GHS3D_HYPOTHESIS" );
 }
 
 QString GHS3DPluginGUI_HypothesisCreator::helpPage() const
 {
-  return "ghs3d_hypo_page.html";
+  return isOptimization() ? "optimization_page.html" : "ghs3d_hypo_page.html";
 }
index 1c093caf12bf82bfd1afdf3ad7e8b348d989345a..84d03ffae84a64feea52225a75568b7e6d08533b 100644 (file)
@@ -57,11 +57,12 @@ class QTableWidget;
 class QTableWidgetItem;
 class QHeaderView;
 
-class SMESHGUI_SpinBox;
-class StdMeshersGUI_ObjectReferenceParamWdg;
+class GHS3DPluginGUI_AdvWidget;
 class LightApp_SelectionMgr;
+class SMESHGUI_SpinBox;
 class SUIT_SelectionFilter;
-class GHS3DPluginGUI_AdvWidget;
+class SalomeApp_IntSpinBox;
+class StdMeshersGUI_ObjectReferenceParamWdg;
 
 class QTEnfVertex
 {
@@ -143,14 +144,18 @@ typedef struct
 {
   bool    myToMeshHoles,myToMakeGroupsOfDomains,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery,myFEMCorrection,myRemoveInitialCentralPoint,
           myLogInStandardOutput, myRemoveLogOnSuccess;
-  long    myMaximumMemory;
-  long    myInitialMemory;
+  float   myMaximumMemory;
+  float   myInitialMemory;
   int     myOptimizationLevel;
   QString myName,myWorkingDir,myTextOption;
   double  myGradation;
   short   myVerboseLevel;
   TEnfVertexList myEnforcedVertices;
   TEnfMeshList myEnforcedMeshes;
+
+  int myOptimization, mySplitOverConstrained, myPThreadsMode, myNumberOfThreads;
+  bool mySmoothOffSlivers;
+
 } GHS3DHypothesisData;
 
 /*!
@@ -209,46 +214,48 @@ private:
   bool                storeParamsToHypo( const GHS3DHypothesisData& ) const;
   GeomSelectionTools* getGeomSelectionTool();
   GEOM::GEOM_Gen_var  getGeomEngine();
+  bool                isOptimization() const;
 
 private:
-  QWidget*            myStdGroup;
-  QLineEdit*          myName;
-  QCheckBox*          myToMeshHolesCheck;
-  QCheckBox*          myToMakeGroupsOfDomains;
-  QComboBox*          myOptimizationLevelCombo;
+  QWidget*              myStdGroup;
+  QLineEdit*            myName;
+  QCheckBox*            myToMeshHolesCheck;
+  QCheckBox*            myToMakeGroupsOfDomains;
+  QComboBox*            myOptimizationLevelCombo;
+
+  QComboBox*            myOptimizationCombo;
+  QComboBox*            mySplitOverConstrainedCombo;
+  QComboBox*            myPThreadsModeCombo;
+  SalomeApp_IntSpinBox* myNumberOfThreadsSpin;
+  QCheckBox*            mySmoothOffSliversCheck;
+  QCheckBox*            myCreateNewNodesCheck;
 
   QWidget*                  myAdvGroup;
   GHS3DPluginGUI_AdvWidget* myAdvWidget;
   
-  QWidget*            myEnfGroup;
-  QPixmap             iconVertex, iconCompound;
+  QWidget*              myEnfGroup;
+  QPixmap               iconVertex, iconCompound;
   StdMeshersGUI_ObjectReferenceParamWdg *myEnfVertexWdg;
   GEOM::GEOM_Object_var myEnfVertex;
-  QTableWidget*       myEnforcedTableWidget;
-  SMESHGUI_SpinBox*   myXCoord;
-  SMESHGUI_SpinBox*   myYCoord;
-  SMESHGUI_SpinBox*   myZCoord;
-  SMESHGUI_SpinBox*   mySizeValue;
-  QLineEdit*          myGroupName;
-//   QGroupBox*          makeGroupsCheck;
-//   QCheckBox*          myGlobalGroupName;  
-  QPushButton*        addVertexButton;
-  QPushButton*        removeVertexButton;
+  QTableWidget*         myEnforcedTableWidget;
+  SMESHGUI_SpinBox*     myXCoord;
+  SMESHGUI_SpinBox*     myYCoord;
+  SMESHGUI_SpinBox*     myZCoord;
+  SMESHGUI_SpinBox*     mySizeValue;
+  QLineEdit*            myGroupName;
+  QPushButton*          addVertexButton;
+  QPushButton*          removeVertexButton;
   
-  QWidget*            myEnfMeshGroup;
+  QWidget*              myEnfMeshGroup;
   StdMeshersGUI_ObjectReferenceParamWdg *myEnfMeshWdg;
-//   SMESH::SMESH_IDSource_var myEnfMesh;
-  QComboBox*          myEnfMeshConstraint;
-  QStringList         myEnfMeshConstraintLabels;
-//   SMESH::mesh_array_var myEnfMeshArray;
-  QTableWidget*       myEnforcedMeshTableWidget;
-  QLineEdit*          myMeshGroupName;
-  QPushButton*        addEnfMeshButton;
-  QPushButton*        removeEnfMeshButton;
+  QComboBox*            myEnfMeshConstraint;
+  QStringList           myEnfMeshConstraintLabels;
+  QTableWidget*         myEnforcedMeshTableWidget;
+  QLineEdit*            myMeshGroupName;
+  QPushButton*          addEnfMeshButton;
+  QPushButton*          removeEnfMeshButton;
   
   GeomSelectionTools*     GeomToolSelected;
-//   SVTK_Selector*          mySelector;
-//   LightApp_SelectionMgr*  mySelectionMgr; /* User shape selection */
 };
 
 class EnforcedVertexTableWidgetDelegate : public QItemDelegate
index 58d83e2cf90a687548b1bcb0f9ab092925cc5f91..1b5ad2c71d4231b96173bf90fa5b9011eda9eb46 100644 (file)
@@ -7,6 +7,14 @@
             <source>ICON_DLG_GHS3D_PARAMETERS</source>
             <translation>mesh_hypo_ghs3d.png</translation>
         </message>
+        <message>
+            <source>ICON_SMESH_TREE_ALGO_GHS3D_3D</source>
+            <translation>mesh_tree_hypo_ghs3d.png</translation>
+        </message>
+        <message>
+            <source>ICON_SMESH_TREE_HYPO_GHS3D_Parameters</source>
+            <translation>mesh_tree_hypo_ghs3d.png</translation>
+        </message>
         <message>
             <source>ICON_SMESH_TREE_ALGO_MG-Tetra</source>
             <translation>mesh_tree_hypo_ghs3d.png</translation>
@@ -15,5 +23,9 @@
             <source>ICON_SMESH_TREE_HYPO_MG-Tetra Parameters</source>
             <translation>mesh_tree_hypo_ghs3d.png</translation>
         </message>
+        <message>
+            <source>ICON_SMESH_TREE_HYPO_MG-Tetra Optimization Parameters</source>
+            <translation>mesh_tree_hypo_ghs3d.png</translation>
+        </message>
     </context>
 </TS>
index bca2a5947257df5cc6e4795bbb5413e4ec055194..b90dc6d54f96fe7f1b76ddf0eea5b24e83ab1214 100644 (file)
         <source>GHS3D_HYPOTHESIS</source>
         <translation>MG-Tetra</translation>
     </message>
+    <message>
+        <source>GHS3D_OPTIMIZATIOL_HYPOTHESIS</source>
+        <translation>MG-Tetra Optimization</translation>
+    </message>
     <message>
         <source>GHS3D_OPTIMIZATIOL_LEVEL</source>
         <translation>Optimization level</translation>
         <source>GHS3D_ENF_MESH_INFO</source>
         <translation>&lt;b&gt;Warning&lt;/b&gt;: Enforced meshes are currently only taken into account for meshes w/o associated geometry.</translation>
     </message>
+    <message>
+        <source>MODE_SAFE</source>
+        <translation>Safe</translation>
+    </message>
+    <message>
+        <source>MODE_AGGRESSIVE</source>
+        <translation>Aggressive</translation>
+    </message>
+    <message>
+        <source>MODE_NONE</source>
+        <translation>None</translation>
+    </message>
+    <message>
+        <source>MODE_NO</source>
+        <translation>No</translation>
+    </message>
+    <message>
+        <source>MODE_YES</source>
+        <translation>Yes</translation>
+    </message>
+    <message>
+        <source>MODE_ONLY</source>
+        <translation>Only</translation>
+    </message>
+    <message>
+        <source>GHS3D_OPTIMIZATION</source>
+        <translation>Optimization</translation>
+    </message>
+    <message>
+        <source>GHS3D_SPLIT_OVERCONSTRAINED</source>
+        <translation>Split overconstrained elements</translation>
+    </message>
+    <message>
+        <source>GHS3D_PTHREADS_MODE</source>
+        <translation>PThreads mode</translation>
+    </message>
+    <message>
+        <source>GHS3D_NB_THREADS</source>
+        <translation>Max number of threads</translation>
+    </message>
+    <message>
+        <source>GHS3D_SMOOTH_OFF_SLIVERS</source>
+        <translation>Smooth off sliver elements</translation>
+    </message>
 </context>
 </TS>
index 1d3226acc59df4c1d5cbfb26ab6ff6db4c2c64d6..75b294deff1b3326aa556eaede4d5da51ea74fef 100755 (executable)
         <source>GHS3D_HYPOTHESIS</source>
         <translation>MG-Tetra</translation>
     </message>
+    <message>
+        <source>GHS3D_OPTIMIZATIOL_HYPOTHESIS</source>
+        <translation>MG-Tetra Optimisation</translation>
+    </message>
     <message>
         <source>GHS3D_OPTIMIZATIOL_LEVEL</source>
         <translation>Niveau d&apos;optimisation</translation>
         <source>GHS3D_ENF_MESH_INFO</source>
         <translation>&lt;b&gt;Attention&lt;/b&gt;: Les éléments de contraintes ne sont pris en compte que pour des maillage sans géométrie associée.</translation>
     </message>
+    <message>
+        <source>MODE_SAFE</source>
+        <translation>Sûr</translation>
+    </message>
+    <message>
+        <source>MODE_AGGRESSIVE</source>
+        <translation>Aggressif</translation>
+    </message>
+    <message>
+        <source>MODE_NONE</source>
+        <translation>Aucun</translation>
+    </message>
+    <message>
+        <source>MODE_NO</source>
+        <translation>Non</translation>
+    </message>
+    <message>
+        <source>MODE_YES</source>
+        <translation>Oui</translation>
+    </message>
+    <message>
+        <source>MODE_ONLY</source>
+        <translation>Seulement</translation>
+    </message>
+    <message>
+        <source>GHS3D_OPTIMIZATION</source>
+        <translation>Optimisation</translation>
+    </message>
+    <message>
+        <source>GHS3D_SPLIT_OVERCONSTRAINED</source>
+        <translation>Découpe les éléments surcontraints</translation>
+    </message>
+    <message>
+        <source>GHS3D_PTHREADS_MODE</source>
+        <translation>Mode pthreads</translation>
+    </message>
+    <message>
+        <source>GHS3D_NB_THREADS</source>
+        <translation>Nombre max de threads</translation>
+    </message>
+    <message>
+        <source>GHS3D_SMOOTH_OFF_SLIVERS</source>
+        <translation>Polir les élémenst aplatis</translation>
+    </message>
 </context>
 </TS>
index 20a88f0a9fb956cc82d1d88cd3b1d161277cf03d..5c12cbc1dd0d05af4c546f0da9a61e219fd00e25 100644 (file)
       <source>GHS3D_HYPOTHESIS</source>
       <translation>MG-Tetra</translation>
     </message>
+    <message>
+      <source>GHS3D_OPTIMIZATIOL_HYPOTHESIS</source>
+      <translation>MG-Tetra 最適化</translation>
+    </message>
     <message>
       <source>GHS3D_OPTIMIZATIOL_LEVEL</source>
       <translation>最適化のレベル</translation>
       <source>GHS3D_ENF_MESH_INFO</source>
       <translation>&lt;b&gt;注意&lt;/b&gt;: 要素制約の関連付けられたジオメトリなしメッシュ考慮されます。</translation>
     </message>
+    <message>
+      <source>MODE_SAFE</source>
+      <translation>セーフモード</translation>
+    </message>
+    <message>
+      <source>MODE_AGGRESSIVE</source>
+      <translation>アグレッシブモード</translation>
+    </message>
+    <message>
+      <source>MODE_NONE</source>
+      <translation>無モード</translation>
+    </message>
+    <message>
+      <source>MODE_NO</source>
+      <translation>Noモード</translation>
+    </message>
+    <message>
+      <source>MODE_YES</source>
+      <translation>Yesモード</translation>
+    </message>
+    <message>
+      <source>MODE_ONLY</source>
+      <translation>Onlyモード</translation>
+    </message>
+    <message>
+      <source>GHS3D_OPTIMIZATION</source>
+      <translation>最適化</translation>
+    </message>
+    <message>
+      <source>GHS3D_SPLIT_OVERCONSTRAINED</source>
+      <translation>過剰拘束要素の分割</translation>
+    </message>
+    <message>
+      <source>GHS3D_PTHREADS_MODE</source>
+      <translation>PThreads モード</translation>
+    </message>
+    <message>
+      <source>GHS3D_NB_THREADS</source>
+      <translation>最大スレッド数</translation>
+    </message>
+    <message>
+      <source>GHS3D_SMOOTH_OFF_SLIVERS</source>
+      <translation>細長い要素のスムーズ化</translation>
+    </message>
   </context>
 </TS>