Salome HOME
23307: [EDF 7315] Improvement of DISTENE meshing plugins eap/23307
authoreap <eap@opencascade.com>
Tue, 9 Aug 2016 16:30:07 +0000 (19:30 +0300)
committereap <eap@opencascade.com>
Tue, 9 Aug 2016 16:30:07 +0000 (19:30 +0300)
20 files changed:
doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters.png
doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_advanced.png
doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc
idl/BLSURFPlugin_Algorithm.idl
src/BLSURFPlugin/BLSURFPluginBuilder.py
src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx
src/GUI/BLSURFPluginGUI_AdvWidget.cxx
src/GUI/BLSURFPluginGUI_AdvWidget_QTD.ui
src/GUI/BLSURFPluginGUI_Dlg.h
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.h
src/GUI/BLSURFPluginGUI_StdWidget.cxx
src/GUI/BLSURFPluginGUI_StdWidget_QTD.ui
src/GUI/BLSURFPlugin_msg_en.ts
src/GUI/BLSURFPlugin_msg_fr.ts
src/GUI/CMakeLists.txt

index fb2365c09e751b1e2a6fa93cf5180e58d0e7787d..8b743fa1f7d380baad12e84a1e1486e3757ce265 100644 (file)
Binary files a/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters.png and b/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters.png differ
index 7f5757c5d9758027ec440919ac71bd4a421d543e..cb8d6577768ed05bbbc2249c073d8342a8ca7d21 100644 (file)
Binary files a/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_advanced.png and b/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_advanced.png differ
index aa88bedb08361861e2316b68b7a909ed1ff3c627..55ab057f6c065d2dc08f6669da68c54096305b49 100644 (file)
@@ -13,7 +13,9 @@
 - <b>Name</b> - allows defining the name of the hypothesis (MG-CADSurf
 Parameters_n by default).
 
-- <b>Physical Mesh</b> - can be set to <em>None</em>, <em>Global size</em>
+- <b>Physical Size</b> group defines a \a physical sizemap.
+
+- \b Type of the physical sizemap can be set to <em>None</em>, <em>Global size</em>
   or <em>Local size</em>
 
   - if set to <em>Global size</em>, only the <b>User size</b>,
@@ -23,7 +25,9 @@ Parameters_n by default).
   account the "Gradation" parameter and the custom elements sizes given in the
   "Local size" tab.
 
-- <b>Geometrical mesh</b> - can be set to <em>None</em>, <em>Global size</em>
+- <b>Geometrical Size</b> group defines a \a geometrical sizemap.
+
+- \b Type of the geometrical sizemap can be set to <em>None</em>, <em>Global size</em>
 
   - if set to <em>Global size</em>, allows user input in <b>Mesh angle</b>,
   <b>Mesh distance</b> and <b>Gradation</b> fields. These fields control
@@ -41,28 +45,39 @@ is checked, the value is relative to the diagonal of the shape.
 - <b>Min Size</b> - defines the lower limit of mesh element size. If "Relative value"
 is checked, the value is relative to the diagonal of the shape.
 
-- <b>Gradation</b> - maximum ratio between the lengths of two adjacent edges.
-
-- <b>Quadratic mesh</b> - if checked, quadratic elements will be generated.
-
 - <b>Mesh angle</b> - Limiting angle (in degree) between the plane of a triangle of the mesh and each of the tangent planes at the three vertices.
 The smaller this angle is, the closer the mesh is to the exact surface, and the denser the resulting mesh is.
 
 - <b>Mesh distance</b> - Maximum desired distance between a triangle and its supporting CAD surface.
 The smaller this distance is, the closer the mesh is to the exact surface (only available in isotropic meshing).
 
+- <b>Quadratic mesh</b> - if checked, quadratic elements will be generated.
+
+- <b>Gradation</b> - maximum ratio between the lengths of two adjacent edges.
+
+- <b>Mesh optimisation</b> - if checked, the mesh will be optimized in order to get better shaped elements.
+
+- <b>Allow Quadrangles</b> - if checked, allows the creation of quadrilateral elements.
+
 - <b>Anisotropic</b> - if checked, this parameter defines the maximum anisotropic ratio of the metric governing the anisotropic meshing process.
 The default value (0) means that the metric (and thus the generated elements) can be arbitrarily stretched.
 
+- <b>Optimize tiny edges</b> - if checked, the tiny (nano) edges are removed from the generated mesh during local mesh optimization.
+The tiny edge value defines the minimal length under which an edge is considered to be a tiny one.
+
 - <b>Remove tiny edges</b> - if checked, the tiny (nano) edges are removed from the generated mesh.
 The tiny edge value defines the minimal length under which an edge is considered to be a tiny one.
 
 - <b>Remove bad elements</b> - if checked, the bad elements (slivers) are removed from the generated mesh.
 The bad element value defines the aspect ratio triggering the "bad element” classification.
 
-- <b>Mesh optimisation</b> - if checked, the mesh will be optimized in order to get better shaped elements.
+- <b>Correct surface intersections</b> - if checked, the mesher will try to prevent all surface intersections, which is useful for future volume mesh generation. The value defines the time that will be spent in the intersection prevention process. For example, the value 3 means that the time of the intersection removal process won't be more than 3 times the time required to mesh without processing the intersections.
+
+- <b>Volume Gradation</b> - maximum ratio between the lengths of two adjacent edges affecting quality of a future volume mesh, specially in thin volume areas. The volume gradation parameter must be greater than 1, and should be greater or equal to the value of the classic
+surface gradation (at the risk of increasing the time of convergence of the gradation process).
+The closer it is to 1, the smoother the final volume mesh you will build should be.
+
 
-- <b>Allow Quadrangles</b> - if checked, allows the creation of quadrilateral elements.
 
 \ref blsurf_top "Back to top"
 
@@ -72,206 +87,100 @@ The notion of <i>diag</i> used in the descriptions means the diagonal of the bou
 
 \image html blsurf_parameters_advanced.png
 
-- <b>CAD preprocessor options</b>. The CAD preprocessor (formerly known as PreCAD) has two main goals:
-
-  - Complete missing or inadequate CAD descriptions.
-
-  - Perform topology reconstruction and specific geometry
-  enhancement for mesh generation.
-
-  \n The following preprocessor options are the most significant and important ones.
-  All options are unchecked by default. No cleanup is made by default so that the mesh matches the shape.
-  If the user has a bad shape (e.g. imported shape), he can activate some options to improve the mesh.
-
-    - <b>Merge Edges</b> - optimize the geometry by merging some
-    edges. This option is unchecked by default.
-
-    - <b>Remove tiny UV edges</b> - optimize the geometry by removing small
-    tiny edges on the UV face. This option is unchecked by default.
-
-    - <b>Process 3D topology</b> - perform the cleanup processing.
-    This option is unchecked by default.
-
-    - <b>Discard input topology</b> - compute the CAD topology from scratch,
-    without considering the topological information contained in the original CAD
-    (useful for iges files). This option is unchecked by default.
-
-    - <b>Remove duplicate CAD faces</b> - optimize the geometry by merging the
-    duplicate CAD faces. This option is unchecked by default.
-
-- <b>Verbosity level</b> - defines the percentage of "verbosity" of
-MeshGems-CADSurf [0-10].
-
-- <b>ExportGMF</b> - saves the computed mesh into a GMF file (.mesh or .meshb).
-
-- <b>Add option</b> - provides the choice of multiple PreCAD and MG-CADSurf 
-advanced options, which appear, if selected, in a table where it is 
-possible to input the value of the option and edit it later.
-
-- <b>Clear option</b> - removes the option selected in the table.
-
-The following advanced MG-CADSurf options can be used:
-
-- \b volume_gradation (real) - Controls the mesh volume gradation, which can improve the shape quality of a
-volume mesh built afterward, specially in thin volume areas.
-The volume gradation parameter must be greater than 1, and should be greater or equal to the value of the classic
-surface gradation (at the risk of increasing the time of convergence of the gradation process).
-The closer it is to 1, the smoother the final volume mesh you will build should be.
-
-- \b correct_surface_intersections (bool) - If this option is deactivated, MeshGems-CADSurf will not correct
-surface intersections. This particularly useful if you don't want volume filling in a later stage, or if you want to fix the
-intersections in an other way (using MeshGems Cleaner for instance).
-By default this option is 1.
+\b Advanced page tab expose mostly useful advanced options. Initially, default values of the options are displayed and they are not modifiable. If an option is activated using a check-box, its value becomes modifiable.
 
-- \b surface_intersections_processing_max_cost (real) - If correct_surface_intersections = 1, this
-parameter gives the time the user is ready to spend in the intersection prevention process. For example,
-if set to 3, MeshGems-CADSurf will not spend more time in the intersection removal process than
-3 times the time required to mesh without processing the intersections.
+- \b Meshing options
 
-- \b create_tag_on_collision (bool) - If this option is activated, MeshGems-CADSurf will create new tags to
-describe tag collisions (when it locally changes the topology, depending on the patch independent
-options). When this option is not activated, only one tag is preserved while the other one is dropped.
-By default this option is 1.
+  - <b>Enforce CAD edge sizes</b> - Relaxes the given sizemap constraint around CAD edges to allow a better
+element quality and a better geometric approximation. It is only useful in combination with the
+gradation option.
 
-- \b debug (bool) - If debug = 1, MeshGems-CADSurf will be very verbose and will output some intermediate files
-in the working directory. This option is meant to communicate with Distene support mainly.
-By default this option is 0.
+  - <b>Priority of geometry over Jacobian</b> - This parameter determines whether or not the geometry accuracy
+is more important than the negative Jacobian correction. When this parameter is set to 0,
+MeshGems-CADSurf is allowed to lose the CAD-mesh associativity in order to correct the last negative Jacobians.
 
-- \b enforce_cad_edge_sizes (bool) - Relaxes the given sizemap constraint around CAD edges to allow a better
-element quality and a better geometric approximation. It is only useful in combination with the gradation option.
-By default this option is 0.
+  - <b>Maximal number of points per patch</b> - This parameter controls the maximum amount of points MeshGems-CADSurf
+is allowed to generate on a single CAD patch. For an automatic gestion of the memory, you can set this parameter to ”0”.
 
-- \b rectify_jacobian (bool) - The quadratic elements generation is a processing of the MeshGems-CADSurf
+  - <b>Rectify Jacobian</b> - The quadratic elements generation is a processing of the MeshGems-CADSurf
 meshing process which inserts the extra nodes on the CAD. This parameter determines whether
 MeshGems-CADSurf will try to correct or not all the elements of the surface mesh with negative
 Jacobians by moving the internal nodes of the mesh.
-By default this option is 1.
 
-- \b jacobian_rectification_respect_geometry (bool) - This parameter determines whether or not the geometry accuracy
-is more important than the negative Jacobian correction. When this parameter is set to 0,
-MeshGems-CADSurf is allowed to lose the CAD-mesh associativity in order to correct the last negative Jacobians.
-By default this option is 1.
-
-- \b respect_geometry (bool) - This patch independent option can be deactivated to allow MeshGems-CADSurf
+  - <b>Respect geometry</b> - This patch independent option can be deactivated to allow MeshGems-CADSurf
 to lower the geometry accuracy in its patch independent process.
-By default this option is 1.
 
-- \b optimise_tiny_edges (bool) - This patch-independent correction option can be activated to remove the tiny
-edges (defined by the option tiny edge optimisation length) from the generated mesh when it improves
-the local mesh quality, without taking into account the tags (attributes) specifications.
-By default this option is 0.
-
-- \b tiny_edge_avoid_surface_intersections (bool) - This option defines the priority between the tiny feature
+  - <b>Tiny edges avoid surface intersections</b> - This option defines the priority between the tiny feature
 suppression and the surface intersection prevention. By default, MeshGems-CADSurf gives the priority
 to the surface intersection prevention rather than to tiny edge or bad surface element removal. These
 mesh features are then removed only if it does not lead to surface intersections. This behaviour can be
 deactivated by setting this parameter to 0, giving priority to the tiny edge or bad surface element
 removal.
-By default this option is 1.
-
-- \b tiny_edge_optimisation_length (double) - This parameter defines the minimal length under which an edge is
-considered to be a tiny one to be optimised out by the optimise tiny edges option.
-By default this option is \f$\mathrm{diag} \times 10^{-6}\f$.
 
-- \b tiny_edge_respect_geometry (bool) - This option defines the behaviour of the tiny edge removal algorithm
-regarding volume collapse. By default, all tiny edges will be removed, regardless of any potential
-volume collapse. When this option is activated, it will prevent volume from being collapsed during the
-tiny edge removal process.
-By default this option is 0.
 
-- \b max_number_of_points_per_patch (int) - This parameter controls the maximum amount of points MeshGems-CADSurf
-is allowed to generate on a single CAD patch. For an automatic gestion of the memory, one can set this parameter to ”0”.
-By default this option is 100000.
+- <b>CAD preprocessor</b> options. The CAD preprocessor (formerly known as PreCAD) has two main goals:
 
-- \b periodic_tolerance (double) - This parameter defines the maximum size difference between two periodic edges
-and also the maximum distance error between two periodic entities.
-By default this option is diag/100.
-
-- \b required_entities (char) - The required entities control the correction operations. Accepted values for this parameter are:
-
-    - respect : MeshGems-CADSurf is not allowed to alter any required entity, even for correction purposes,
-    - ignore : MeshGems-CADSurf will ignore the required entities in its processing,
-    - clear : MeshGems-CADSurf will clear any required status for the entities. There will not be any entity marked as required in the generated mesh.
-
-    \n By default this option is "respect".
-
-- \b tags (char) - The tag (attribute) system controls the optimisation process. Accepted values for this parameter are:
-
-    - respect : the CAD tags will be preserved and unaltered by the optimisation operations,
-    - ignore : the CAD tags will be ignored by the optimisation operations but they will still be present inthe output mesh,
-    - clear : MeshGems-CADSurf will clear any tag on any entity and optimise accordingly. There will not be any tag in the generated mesh.
-
-    \n By default this option is "respect".
-
-    
-\b Remark: To set boolean options, you have to type 0 or 1.
-
-
-
-The following MG-CADSurf options are deprecated (since MeshGems 1.3) and will be removed in the next version of Salome:
+  - Complete missing or inadequate CAD descriptions.
 
-- frontal
-- hinterpol_flag
-- hmean_flag
-- prox_nb_layer
-- prox_ratio
-- proximity.
+  - Perform topology reconstruction and specific geometry
+  enhancement for mesh generation.
 
+  \n All options are unchecked by default. No cleanup is made by default so that the mesh matches the shape. If the user has a bad shape (e.g. imported shape), he can activate some options to improve the mesh.
 
-The following PreCAD options are commonly usable. 
+  - <b>Closed geometry</b> - describes whether the working geometry should be closed or not. 
+  When activated, this option helps PreCAD to process the dirtiest geometries.
 
-- \b closed_geometry (boolean) - describes whether the working geometry
-should be closed or not. When activated, this option helps PreCAD to process 
-the dirtiest geometries. By default this option is 0.
+  - \b Debug - If debug = yes PreCAD will be very verbose and will output some intermediate files in the working directory.
 
-- \b create_tag_collision (boolean) - creates new tags from original ones in case
-of collision (entity merge or association for example). By default
-this option is 1.
+  - <b>Discard input topology</b> - compute the CAD topology from scratch,
+  without considering the topological information contained in the original CAD
+  (useful for iges files). This option is unchecked by default.
 
-- \b debug (bool) - If debug = 1 PreCAD will be very verbose and will output
-some intermediate files in the working directory. By default this
-option is 0.
+  - <b>Merge Edges</b> - optimize the geometry by merging some
+  edges.
 
-- \b manifold_geometry (int) - describes whether the working geometry should be manifold or not.
-When activated, this option helps PreCAD to process the dirtiest
-geometries. By default this option is 0.
+  - <b>Periodic tolerance</b> - This parameter defines the maximum size difference between two periodic edges and also the maximum distance error between two periodic entities.
 
-- \b periodic_tolerance (real) - defines the maximum distance error accepted between
-two sets of periodic entities. By default this option is \f$\mathrm{diag} \times 10^{-5}\f$.
+  - <b>Remove duplicate CAD faces</b> - optimize the geometry by merging the
+  duplicate CAD faces. This option is unchecked by default.
 
-- \b remove_tiny_edges (boolean) -optimize the geometry by removing the nano edges whenever possible.
-By default this option is 0.
+  - <b>Required entities</b> - The required entities control the correction operations. Accepted values for this parameter are:
+    - respect : MeshGems-CADSurf is not allowed to alter any required entity, even for correction purposes,
+    - ignore : MeshGems-CADSurf will ignore the required entities in its processing,
+    - clear : MeshGems-CADSurf will clear any required status for the entities. There will not be any entity marked as required in the generated mesh.
 
-- \b required_entities (char) -controls the correction operations. Possible values are:
+  - <b>Sewing tolerance</b> - tolerance of the assembly. It rarely requires to be tuned.
 
-  - "respect" - PreCAD is not allowed to correct or optimize a required edge.
+  - \b Tags - controls the optimisation process. Possible values are:
+    - "respect" - PreCAD is not allowed to cross the CAD attributes boundaries for optimisation purpose.
+    - "ignore" - PreCAD is allowed to cross the CAD attributes boundaries for optimisation.
+    - "clear" - PreCAD will erase each tgas of each entities, and will thus be allowed to cross the CAD attributes boundaries in its optimisation purpose.
 
-  - "ignore" - PreCAD is allowed to correct a required edge.
 
-  - "clear" - PreCAD will erase "required" status of each required entities, and will thus
-  be allowed to correct a required edge.
+- <b>Add option</b> - adds a new line in <b>Other options</b> section where you can type an option name and value. The following advanced MG-CADSurf options can be used:
 
-  \n By default this option is "respect".
+  - \b create_tag_on_collision (bool) - If this option is activated, MeshGems-CADSurf will create new tags to
+  describe tag collisions (when it locally changes the topology, depending on the patch independent
+  options). When this option is not activated, only one tag is preserved while the other one is dropped.
+  By default this option is 1.
 
-- \b sewing_tolerance (real) - tolerance of the assembly. It rarely requires to be tuned.
-By default this option is \f$\mathrm{diag} \times 5 \cdot 10^{-4}\f$.
+  - \b tiny_edge_respect_geometry (bool) - This option defines the behaviour of the tiny edge removal algorithm
+  regarding volume collapse. By default, all tiny edges will be removed, regardless of any potential
+  volume collapse. When this option is activated, it will prevent volume from being collapsed during the tiny edge removal process.
+  By default this option is 0.
 
-- \b tags (char) -controls the optimisation process. Possible values are:
+  - \b manifold_geometry (int) - describes whether the working geometry should be manifold or not.
+  When activated, this option helps PreCAD to process the dirtiest
+  geometries. By default this option is 0.
 
-  - "respect" - PreCAD is not allowed to cross the CAD attributes boundaries for optimisation purpose.
 
-  - "ignore" - PreCAD is allowed to cross the CAD attributes boundaries for optimisation.
 
-  - "clear" - PreCAD will erase each tgas of each entities, and will thus
-  be allowed to cross the CAD attributes boundaries in its optimisation purpose.
+- <b>Verbosity level</b> - defines the percentage of "verbosity" of
+MeshGems-CADSurf [0-10].
 
-  \n By default this option is "respect".
+- <b>ExportGMF</b> - saves the computed mesh into a GMF file (.mesh or .meshb).
 
-- \b tiny_edge_length (real) -  the length below which en edge is considered as nano for the topology processing.
-By default this option is \f$10^{-5}\f$.
 
-\note Moreover, user can choose "<Other option>" item in these two pop-up menus 
-(MG-CADSurf and PreCAD) to be able to specify both the option name and the option value. 
 
 \ref blsurf_top "Back to top"
 
index e865c2fd5cd0b58b0ec4b5f1aeb9ef09d0b77028..d7f9c11d15af114446c658525b61b1d118795bff 100644 (file)
@@ -178,9 +178,19 @@ module BLSURFPlugin
     /*!
      * Sets maximal allowed ratio between the lengths of two adjacent edges
      */
+    void SetUseGradation(in boolean toUse);
+    boolean GetUseGradation();
     void SetGradation(in double ratio);
     double GetGradation();
 
+    /*!
+     * Sets maximal allowed ratio between the lengths of two adjacent edges in 3D mesh
+     */
+    void SetUseVolumeGradation(in boolean toUse);
+    boolean GetUseVolumeGradation();
+    void SetVolumeGradation(in double ratio);
+    double GetVolumeGradation();
+
     /*!
      * Sets to create quadrilateral elements or not
      */
@@ -227,6 +237,37 @@ module BLSURFPlugin
     void SetTinyEdgeLength(in double length);
     double GetTinyEdgeLength();
 
+    /*!
+     *  This patch-independent correction option can be activated to remove the tiny
+     * edges (defined by the option tiny edge optimisation length) from the generated
+     * mesh when it improves the local mesh quality, without taking into account the
+     * tags (attributes) specifications.
+     */
+    void SetOptimiseTinyEdges(in boolean toOptimise);
+    boolean GetOptimiseTinyEdges();
+
+    /*!
+     * Defines the minimal length under which an edge is considered to be a tiny one
+     * to be optimised out by the optimise tiny edges option
+     */
+    void SetTinyEdgeOptimisationLength(in double length);
+    double GetTinyEdgeOptimisationLength();
+
+    /*!
+     * Activate correction of all surface intersections
+     */
+    void SetCorrectSurfaceIntersection(in boolean toCorrect);
+    boolean GetCorrectSurfaceIntersection();
+
+    /*!
+     * Defines the time the user is ready to spend in the intersection prevention process.
+     * For example, maxCost = 3 means that MeshGems-CADSurf will not spend more time
+     * in the intersection removal process than 3 times the time required to mesh
+     * without processing the intersections.
+     */
+    void SetCorrectSurfaceIntersectionMaxCost(in double maxCost);
+    double GetCorrectSurfaceIntersectionMaxCost();
+
     /*!
      * This patch independent correction option can be activated to remove the bad 
      * elements (often called slivers) from the generated mesh, without taking into account
@@ -271,6 +312,124 @@ module BLSURFPlugin
     void SetVerbosity(in short theVal) raises (SALOME::SALOME_Exception);
     short GetVerbosity();
 
+    /*!
+     * Set enforce_cad_edge_sizes parameter
+     *
+     * Relaxes the given sizemap constraint around CAD edges to allow a better
+     * element quality and a better geometric approximation. It is only useful in 
+     * combination with the gradation option.
+     */
+    void SetEnforceCadEdgesSize( in boolean toEnforce );
+    boolean GetEnforceCadEdgesSize();
+
+    /*!
+     * Set jacobian_rectification_respect_geometry parameter
+     *
+     * While making the mesh quadratic, allows to lose the CAD-mesh associativity in order
+     * to correct elements with nagative Jacobian
+     */
+    void SetJacobianRectificationRespectGeometry( in boolean allowRectification );
+    boolean GetJacobianRectificationRespectGeometry();
+    
+    /*!
+     * Set rectify_jacobian parameter
+     *
+     * While making the mesh quadratic, allow to fix nagative Jacobian surface elements
+     */
+    void SetJacobianRectification( in boolean allowRectification );
+    boolean GetJacobianRectification();
+
+    /*!
+     * Set max_number_of_points_per_patch parameter
+     * 
+     * This parameter controls the maximum amount of points MeshGems-CADSurf is allowed
+     * to generate on a single CAD patch. For an automatic gestion of the memory, one
+     * can set this parameter to 0
+     */
+    void SetMaxNumberOfPointsPerPatch( in long nb ) raises (SALOME::SALOME_Exception);
+    long GetMaxNumberOfPointsPerPatch();
+
+    /*!
+     * Set respect_geometry parameter
+     *
+     *  This patch independent option can be deactivated to allow MeshGems-CADSurf
+     * to lower the geometry accuracy in its patch independent process.
+     */
+    void SetRespectGeometry( in boolean toRespect );
+    boolean GetRespectGeometry();
+
+    /*!
+     * Set tiny_edges_avoid_surface_intersections parameter
+     *
+     * This option defines the priority between the tiny feature
+     * suppression and the surface intersection prevention. 
+     */
+    void SetTinyEdgesAvoidSurfaceIntersections( in boolean toAvoidIntersection );
+    boolean GetTinyEdgesAvoidSurfaceIntersections();
+
+    /*!
+     * Set closed_geometry parameter parameter
+     *
+     *  Describes whether the geometry is expected to be closed or not. 
+     * When activated, this option helps MeshGems-PreCAD to treat the dirtiest geometries.
+     */
+    void SetClosedGeometry( in boolean isClosed );
+    boolean GetClosedGeometry();
+
+    /*!
+     * Set debug parameter
+     *
+     * Make MeshGems-CADSurf will be very verbose and will output some intermediate
+     * files in the working directory. This option is mainly meant for Distene support issues.
+     */
+    void SetDebug( in boolean isDebug );
+    boolean GetDebug();
+
+    /*!
+     * Set periodic_tolerance parameter
+     * 
+     *  This parameter defines the maximum size difference between two periodic edges
+     * and also the maximum distance error between two periodic entities.
+     */
+    void SetPeriodicTolerance( in double tol ) raises (SALOME::SALOME_Exception);
+    double GetPeriodicTolerance() raises (SALOME::SALOME_Exception);
+
+    /*!
+     * Set required_entities parameter
+     *
+     * The required entities control the correction operations. 
+     * Accepted values for this parameter are :
+     * - "respect" : MeshGems-CADSurf is not allowed to alter any required entity, 
+     *             even for correction purposes,
+     * - "ignore" : MeshGems-CADSurf will ignore the required entities in its processing,
+     * - "clear" : MeshGems-CADSurf will clear any required status for the entities. 
+     *           There will not be any entity marked as required in the generated mesh.
+     */
+    void SetRequiredEntities( in string howToTreat ) raises (SALOME::SALOME_Exception);
+    string GetRequiredEntities();
+
+    /*!
+     * Set sewing_tolerance parameter
+     *
+     * This parameter is the tolerance of the assembly.
+     */
+    void SetSewingTolerance( in double tol ) raises (SALOME::SALOME_Exception);
+    double GetSewingTolerance() raises (SALOME::SALOME_Exception);
+
+    /*!
+     * Set tags parameter
+     *
+     *  The tag (attribute) system controls the optimisation process. 
+     *  Accepted values for this parameter are :
+     * - "respect"  : the CAD tags will be preserved and unaltered by the optimisation operations,
+     * - "ignore" : the CAD tags will be ignored by the optimisation operations 
+     *              but they will still be present in the output mesh,
+     * - "clear" : MeshGems-CADSurf will clear any tag on any entity and optimise accordingly. 
+     *             There will not be any tag in the generated mesh.
+     */
+    void SetTags( in string howToTreat ) raises (SALOME::SALOME_Exception);
+    string GetTags();
+
     /*!
      * To merges edges.
      */
@@ -320,6 +479,8 @@ module BLSURFPlugin
     /*!
      * Adds custom advanced option and its value
      */
+    void SetAdvancedOption(in string optionsAndValues) // in a form "option_1 v1 option_2 v2'"
+      raises (SALOME::SALOME_Exception);
     void AddOption(in string optionName, in string optionValue);
     void AddPreCADOption(in string optionName, in string optionValue);
     string GetOption(in string optionName);
@@ -329,10 +490,12 @@ module BLSURFPlugin
      * Return array of strings each of which is option name concatenated
      * with option value devided by semicolon - "option_name:option_value:option_type".
      * Option value is empty if an option is not set.
+     * option_type: 1 if user-define, 0 if default
      * Note: the method is mostly for interaction with GUI.
      */
     string_array GetOptionValues();
     string_array GetPreCADOptionValues();
+    string_array GetAdvancedOptionValues();
 
     /*!
      * Set option values each in the form "option_name[:option_value][:option_type]".
@@ -340,6 +503,7 @@ module BLSURFPlugin
      */
     void SetOptionValues(in string_array options) raises (SALOME::SALOME_Exception);
     void SetPreCADOptionValues(in string_array options) raises (SALOME::SALOME_Exception);
+    void SetAdvancedOptionValues(in string_array options);
 
     /*!
      * SizeMap
index 3b443a95783717ff7e7cb72cab50b61b1c98b181..084b8c7561fd4088285fa7ddb4ccdbadee87350a 100644 (file)
@@ -74,6 +74,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
   _bad_surface_element_aspect_ratio = 1000
   _geometric_approximation = 22
   _gradation  = 1.3
+  _volume_gradation  = 2
   _metric = "isotropic"
   _remove_tiny_edges = 0
 
@@ -159,11 +160,22 @@ class BLSURF_Algorithm(Mesh_Algorithm):
 
   ## Sets maximal allowed ratio between the lengths of two adjacent edges.
   #  @param theVal value of maximal length ratio
-  def SetGradation(self, theVal=_gradation):
+  def SetGradation(self, toUseGradation=True, theVal=_gradation):
+    if isinstance( toUseGradation, float ): ## backward compatibility
+      toUseGradation, theVal = True, toUseGradation
     if self.Parameters().GetGeometricMesh() == 0: theVal = self._gradation
+    self.Parameters().SetUseGradation(toUseGradation)
     self.Parameters().SetGradation(theVal)
     pass
 
+  ## Sets maximal allowed ratio between the lengths of two adjacent edges in 3D mesh.
+  #  @param theVal value of maximal length ratio
+  def SetVolumeGradation(self, toUseGradation=True, theVal=_gradation):
+    if self.Parameters().GetGeometricMesh() == 0: theVal = self._volume_gradation
+    self.Parameters().SetUseVolumeGradation(toUseGradation)
+    self.Parameters().SetVolumeGradation(theVal)
+    pass
+
   ## Sets topology usage way.
   # @param way defines how mesh conformity is assured <ul>
   # <li>FromCAD - mesh conformity is assured by conformity of a shape</li>
@@ -191,6 +203,141 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     self.Parameters().SetVerbosity(level)
     pass
 
+  ## Set enforce_cad_edge_sizes parameter
+  #  
+  #  Relaxes the given sizemap constraint around CAD edges to allow a better
+  #  element quality and a better geometric approximation. It is only useful in 
+  #  combination with the gradation option.
+  #  
+  def SetEnforceCadEdgesSize( self, toEnforce ):
+    self.Parameters().SetEnforceCadEdgesSize( toEnforce )
+
+  ## Set jacobian_rectification_respect_geometry parameter
+  #  
+  #  While making the mesh quadratic, allows to lose the CAD-mesh associativity in order
+  #  to correct elements with nagative Jacobian
+  #  
+  def SetJacobianRectificationRespectGeometry( self, allowRectification ):
+    self.Parameters().SetJacobianRectificationRespectGeometry( allowRectification )
+    
+  ## Set rectify_jacobian parameter
+  #  
+  #  While making the mesh quadratic, allow to fix nagative Jacobian surface elements
+  #  
+  def SetJacobianRectification( self, allowRectification ):
+    self.Parameters().SetJacobianRectification( allowRectification )
+
+  ## Set respect_geometry parameter
+  #  
+  #  This patch independent option can be deactivated to allow MeshGems-CADSurf
+  #  to lower the geometry accuracy in its patch independent process.
+  #  
+  def SetRespectGeometry( self, toRespect ):
+    self.Parameters().SetRespectGeometry( toRespect )
+
+  ## Set max_number_of_points_per_patch parameter
+  #  
+  #  This parameter controls the maximum amount of points MeshGems-CADSurf is allowed
+  #  to generate on a single CAD patch. For an automatic gestion of the memory, one
+  #  can set this parameter to 0
+  #  
+  def SetMaxNumberOfPointsPerPatch( self, nb ):
+    self.Parameters().SetMaxNumberOfPointsPerPatch( nb )
+
+  ## Set respect_geometry parameter
+  #  
+  #  This patch independent option can be deactivated to allow MeshGems-CADSurf
+  #  to lower the geometry accuracy in its patch independent process.
+  #  
+  def SetRespectGeometry( self, toRespect ):
+    self.Parameters().SetRespectGeometry( toRespect )
+
+  ## Set tiny_edges_avoid_surface_intersections parameter
+  #  
+  #  This option defines the priority between the tiny feature
+  #  suppression and the surface intersection prevention. 
+  #  
+  def SetTinyEdgesAvoidSurfaceIntersections( self, toAvoidIntersection ):
+    self.Parameters().SetTinyEdgesAvoidSurfaceIntersections( toAvoidIntersection )
+
+  ## Set closed_geometry parameter parameter
+  #  
+  #  Describes whether the geometry is expected to be closed or not. 
+  #  When activated, this option helps MeshGems-PreCAD to treat the dirtiest geometries.
+  #  
+  def SetClosedGeometry( self, isClosed ):
+    self.Parameters().SetClosedGeometry( isClosed )
+
+  ## Set debug parameter
+  #  
+  #  Make MeshGems-CADSurf will be very verbose and will output some intermediate
+  #  files in the working directory. This option is mainly meant for Distene support issues.
+  #  
+  def SetDebug( self, isDebug ):
+    self.Parameters().SetDebug( isDebug )
+
+  ## Set periodic_tolerance parameter
+  #  
+  #  This parameter defines the maximum size difference between two periodic edges
+  #  and also the maximum distance error between two periodic entities.
+  #  
+  def SetPeriodicTolerance( self, tol ):
+    self.Parameters().SetPeriodicTolerance( tol )
+
+  ## Set required_entities parameter
+  #  
+  #  The required entities control the correction operations. 
+  #  Accepted values for this parameter are :
+  #  - "respect" : MeshGems-CADSurf is not allowed to alter any required entity, 
+  #                even for correction purposes,
+  #  - "ignore" : MeshGems-CADSurf will ignore the required entities in its processing,
+  #  - "clear" : MeshGems-CADSurf will clear any required status for the entities. 
+  #              There will not be any entity marked as required in the generated mesh.
+  #  
+  def SetRequiredEntities( self, howToTreat ):
+    self.Parameters().SetRequiredEntities( howToTreat )
+
+  ## Set sewing_tolerance parameter
+  #  
+  #  This parameter is the tolerance of the assembly.
+  #  
+  def SetSewingTolerance( self, tol ):
+    self.Parameters().SetSewingTolerance( tol )
+
+  ## Set tags parameter
+  #  
+  #  The tag (attribute) system controls the optimisation process. 
+  #  Accepted values for this parameter are :
+  #  - "respect"  : the CAD tags will be preserved and unaltered by the optimisation operations,
+  #  - "ignore" : the CAD tags will be ignored by the optimisation operations 
+  #               but they will still be present in the output mesh,
+  #  - "clear" : MeshGems-CADSurf will clear any tag on any entity and optimise accordingly. 
+  #              There will not be any tag in the generated mesh.
+  #  
+  def SetTags( self, howToTreat ):
+    self.Parameters().SetTags( howToTreat )
+
+  ## Activate removal of the tiny edges from the generated
+  # mesh when it improves the local mesh quality, without taking into account the
+  # tags (attributes) specifications.
+  #  @param toOptimise "to optimize" flag value
+  #  @param length minimal length under which an edge is considered to be a tiny
+  def SetOptimiseTinyEdges(self, toOptimise, length=-1):
+    self.Parameters().SetOptimiseTinyEdges( toOptimise )
+    if toOptimise:
+      self.Parameters().SetTinyEdgeOptimisationLength( length )
+
+  ## Activate correction of all surface intersections
+  #  @param toCorrect "to correct" flag value
+  #  @param maxCost  the time the user is ready to spend in the intersection prevention process
+  #         For example, maxCost = 3 means that MeshGems-CADSurf will not spend more time
+  #         in the intersection removal process than 3 times the time required to mesh
+  #         without processing the intersections.
+  def SetCorrectSurfaceIntersection(self, toCorrect, maxCost ):
+    self.Parameters().SetCorrectSurfaceIntersection( toCorrect )
+    if toCorrect:
+      self.Parameters().SetCorrectSurfaceIntersectionMaxCost( maxCost )
+
   ## To optimize merges edges.
   #  @param toMergeEdges "merge edges" flag value
   def SetPreCADMergeEdges(self, toMergeEdges=False):
@@ -251,6 +398,12 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     self.Parameters().SetPreCADOptionValue(optionName,optionValue)
     pass
   
+  ## Adds custom advanced option values
+  #  @param optionsAndValues options and values in a form "option_1 v1 option_2 v2'"
+  def SetAdvancedOption(self, optionsAndValues):
+    self.Parameters().SetAdvancedOption(optionsAndValues)
+    pass
+
   ## Adds custom advanced option value.
   #  @param optionName custom advanced option name
   #  @param level custom advanced option value
index bc6ba82297bd39c5c76b1b3e1ac1fc03774d75a3..ca54cf399db7228228ada1e08581c449c731623d 100644 (file)
@@ -840,7 +840,10 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
   bool   _minSizeRel            = BLSURFPlugin_Hypothesis::GetDefaultMinSizeRel();
   double _maxSize               = BLSURFPlugin_Hypothesis::GetDefaultMaxSize(diagonal);
   bool   _maxSizeRel            = BLSURFPlugin_Hypothesis::GetDefaultMaxSizeRel();
+  double _use_gradation         = BLSURFPlugin_Hypothesis::GetDefaultUseGradation();
   double _gradation             = BLSURFPlugin_Hypothesis::GetDefaultGradation();
+  double _use_volume_gradation  = BLSURFPlugin_Hypothesis::GetDefaultUseVolumeGradation();
+  double _volume_gradation      = BLSURFPlugin_Hypothesis::GetDefaultVolumeGradation();
   bool   _quadAllowed           = BLSURFPlugin_Hypothesis::GetDefaultQuadAllowed();
   double _angleMesh             = BLSURFPlugin_Hypothesis::GetDefaultAngleMesh();
   double _chordalError          = BLSURFPlugin_Hypothesis::GetDefaultChordalError(diagonal);
@@ -848,19 +851,23 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
   double _anisotropicRatio      = BLSURFPlugin_Hypothesis::GetDefaultAnisotropicRatio();
   bool   _removeTinyEdges       = BLSURFPlugin_Hypothesis::GetDefaultRemoveTinyEdges();
   double _tinyEdgeLength        = BLSURFPlugin_Hypothesis::GetDefaultTinyEdgeLength(diagonal);
+  bool   _optimiseTinyEdges     = BLSURFPlugin_Hypothesis::GetDefaultOptimiseTinyEdges();
+  double _tinyEdgeOptimisLength = BLSURFPlugin_Hypothesis::GetDefaultTinyEdgeOptimisationLength(diagonal);
+  bool   _correctSurfaceIntersec= BLSURFPlugin_Hypothesis::GetDefaultCorrectSurfaceIntersection();
+  double _corrSurfaceIntersCost = BLSURFPlugin_Hypothesis::GetDefaultCorrectSurfaceIntersectionMaxCost();
   bool   _badElementRemoval     = BLSURFPlugin_Hypothesis::GetDefaultBadElementRemoval();
   double _badElementAspectRatio = BLSURFPlugin_Hypothesis::GetDefaultBadElementAspectRatio();
   bool   _optimizeMesh          = BLSURFPlugin_Hypothesis::GetDefaultOptimizeMesh();
   bool   _quadraticMesh         = BLSURFPlugin_Hypothesis::GetDefaultQuadraticMesh();
   int    _verb                  = BLSURFPlugin_Hypothesis::GetDefaultVerbosity();
-  int    _topology              = BLSURFPlugin_Hypothesis::GetDefaultTopology();
+  //int    _topology              = BLSURFPlugin_Hypothesis::GetDefaultTopology();
 
   // PreCAD
-  int _precadMergeEdges         = BLSURFPlugin_Hypothesis::GetDefaultPreCADMergeEdges();
+  //int _precadMergeEdges         = BLSURFPlugin_Hypothesis::GetDefaultPreCADMergeEdges();
   int _precadRemoveTinyUVEdges  = BLSURFPlugin_Hypothesis::GetDefaultPreCADRemoveTinyUVEdges();
-  int _precadRemoveDuplicateCADFaces = BLSURFPlugin_Hypothesis::GetDefaultPreCADRemoveDuplicateCADFaces();
+  //int _precadRemoveDuplicateCADFaces = BLSURFPlugin_Hypothesis::GetDefaultPreCADRemoveDuplicateCADFaces();
   int _precadProcess3DTopology  = BLSURFPlugin_Hypothesis::GetDefaultPreCADProcess3DTopology();
-  int _precadDiscardInput       = BLSURFPlugin_Hypothesis::GetDefaultPreCADDiscardInput();
+  //int _precadDiscardInput       = BLSURFPlugin_Hypothesis::GetDefaultPreCADDiscardInput();
 
 
   if (hyp) {
@@ -882,8 +889,12 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
       // if max size is not explicitly specified, "relative" flag is ignored
       _maxSizeRel    = hyp->IsMaxSizeRel();
     }
-    if (hyp->GetGradation() > 0)
+    _use_gradation = hyp->GetUseGradation();
+    if (hyp->GetGradation() > 0 && _use_gradation)
       _gradation     = hyp->GetGradation();
+    _use_volume_gradation    = hyp->GetUseVolumeGradation();
+    if (hyp->GetVolumeGradation() > 0 && _use_volume_gradation )
+      _volume_gradation      = hyp->GetVolumeGradation();
     _quadAllowed     = hyp->GetQuadAllowed();
     if (hyp->GetAngleMesh() > 0)
       _angleMesh     = hyp->GetAngleMesh();
@@ -895,19 +906,25 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
     _removeTinyEdges         = hyp->GetRemoveTinyEdges();
     if (hyp->GetTinyEdgeLength() > 0)
       _tinyEdgeLength        = hyp->GetTinyEdgeLength();
+    _optimiseTinyEdges       = hyp->GetOptimiseTinyEdges();
+    if (hyp->GetTinyEdgeOptimisationLength() > 0)
+      _tinyEdgeOptimisLength = hyp->GetTinyEdgeOptimisationLength();
+    _correctSurfaceIntersec  = hyp->GetCorrectSurfaceIntersection();
+    if (hyp->GetCorrectSurfaceIntersectionMaxCost() > 0)
+      _corrSurfaceIntersCost = hyp->GetCorrectSurfaceIntersectionMaxCost();
     _badElementRemoval       = hyp->GetBadElementRemoval();
     if (hyp->GetBadElementAspectRatio() >= 0)
       _badElementAspectRatio = hyp->GetBadElementAspectRatio();
     _optimizeMesh  = hyp->GetOptimizeMesh();
     _quadraticMesh = hyp->GetQuadraticMesh();
     _verb          = hyp->GetVerbosity();
-    _topology      = (int) hyp->GetTopology();
+    //_topology      = (int) hyp->GetTopology();
     // PreCAD
-    _precadMergeEdges        = hyp->GetPreCADMergeEdges();
+    //_precadMergeEdges        = hyp->GetPreCADMergeEdges();
     _precadRemoveTinyUVEdges = hyp->GetPreCADRemoveTinyUVEdges();
-    _precadRemoveDuplicateCADFaces = hyp->GetPreCADRemoveDuplicateCADFaces();
+    //_precadRemoveDuplicateCADFaces = hyp->GetPreCADRemoveDuplicateCADFaces();
     _precadProcess3DTopology = hyp->GetPreCADProcess3DTopology();
-    _precadDiscardInput      = hyp->GetPreCADDiscardInput();
+    //_precadDiscardInput      = hyp->GetPreCADDiscardInput();
 
     const BLSURFPlugin_Hypothesis::TOptionValues& opts = hyp->GetOptionValues();
     BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt;
@@ -930,35 +947,15 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
         MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second);
         set_param(css, opIt->first.c_str(), opIt->second.c_str());
       }
-
-    const BLSURFPlugin_Hypothesis::TOptionValues& custom_preCADopts = hyp->GetCustomPreCADOptionValues();
-    for ( opIt = custom_preCADopts.begin(); opIt != custom_preCADopts.end(); ++opIt )
-      if ( !opIt->second.empty() ) {
-        MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second);
-        set_param(css, opIt->first.c_str(), opIt->second.c_str());
-      }
   }
-//   else {
-//     //0020968: EDF1545 SMESH: Problem in the creation of a mesh group on geometry
-//     // GetDefaultPhySize() sometimes leads to computation failure
-//     // GDD 26/07/2012 From Distene documentation, global physical size default value = diag/100
-//     _phySize = BLSURFPlugin_Hypothesis::GetDefaultPhySize(diagonal);
-//     _minSize = BLSURFPlugin_Hypothesis::GetDefaultMinSize(diagonal);
-//     _maxSize = BLSURFPlugin_Hypothesis::GetDefaultMaxSize(diagonal);
-//     _chordalError = BLSURFPlugin_Hypothesis::GetDefaultChordalError(diagonal);
-//     _tinyEdgeLength = BLSURFPlugin_Hypothesis::GetDefaultTinyEdgeLength(diagonal);
-//     MESSAGE("BLSURFPlugin_BLSURF::SetParameters using defaults");
-//   }
 
-  // PreProcessor (formerly PreCAD)
-  set_param(css, "merge_edges",            _precadMergeEdges ? "yes" : "no");
+  // PreProcessor (formerly PreCAD) -- commented params are preCADoptions (since 0023307)
+  //set_param(css, "merge_edges",            _precadMergeEdges ? "yes" : "no");
   set_param(css, "remove_tiny_uv_edges",   _precadRemoveTinyUVEdges ? "yes" : "no");
-  set_param(css, "remove_duplicate_cad_faces", _precadRemoveDuplicateCADFaces ? "yes" : "no");
+  //set_param(css, "remove_duplicate_cad_faces", _precadRemoveDuplicateCADFaces ? "yes" : "no");
   set_param(css, "process_3d_topology",    _precadProcess3DTopology ? "1" : "0");
-  set_param(css, "discard_input_topology", _precadDiscardInput ? "1" : "0");
-
-  // unlimit mesh size (issue 0022266)
-  set_param(css, "max_number_of_points_per_patch", "1000000");
+  //set_param(css, "discard_input_topology", _precadDiscardInput ? "1" : "0");
+  //set_param(css, "max_number_of_points_per_patch", "1000000");
   
    bool useGradation = false;
    switch (_physicalMesh)
@@ -1022,8 +1019,10 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
    // anisotropic and quadrangle mesh requires disabling gradation
    if ( _anisotropic && _quadAllowed )
      useGradation = false; // limitation of V1.3
-   if ( useGradation )
-     set_param(css, "gradation",                         val_to_string(_gradation).c_str());
+   if ( useGradation && _use_gradation )
+     set_param(css, "gradation",                       val_to_string(_gradation).c_str());
+   if ( useGradation && _use_volume_gradation )
+     set_param(css, "volume_gradation",                val_to_string(_volume_gradation).c_str());
    set_param(css, "element_generation",                _quadAllowed ? "quad_dominant" : "triangle");
 
 
@@ -1033,6 +1032,12 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
    set_param(css, "remove_tiny_edges",                 _removeTinyEdges ? "1" : "0");
    if ( _removeTinyEdges )
      set_param(css, "tiny_edge_length",                  val_to_string(_tinyEdgeLength).c_str());
+   set_param(css, "optimise_tiny_edges",               _optimiseTinyEdges ? "1" : "0");
+   if ( _optimiseTinyEdges )
+     set_param(css, "tiny_edge_optimisation_length",   val_to_string(_tinyEdgeOptimisLength).c_str());
+   set_param(css, "correct_surface_intersections",     _correctSurfaceIntersec ? "1" : "0");
+   if ( _correctSurfaceIntersec )
+     set_param(css, "surface_intersections_processing_max_cost", val_to_string(_corrSurfaceIntersCost ).c_str());
    set_param(css, "force_bad_surface_element_removal", _badElementRemoval ? "1" : "0");
    if ( _badElementRemoval )
      set_param(css, "bad_surface_element_aspect_ratio",  val_to_string(_badElementAspectRatio).c_str());
@@ -1849,9 +1854,6 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
    */
 
   // PreCAD
-  // If user requests it, send the CAD through Distene preprocessor : PreCAD
-  cad_t *cleanc = NULL; // preprocessed cad
-  dcad_t *cleandc = NULL; // preprocessed dcad
 
   cadsurf_session_t *css = cadsurf_session_new(ctx);
 
@@ -1859,7 +1861,6 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
   BLSURF_Cleaner cleaner( ctx,css,c,dcad );
 
   MESSAGE("BEGIN SetParameters");
-  bool use_precad = false;
   SetParameters(_hypothesis, css, aShape);
   MESSAGE("END SetParameters");
 
@@ -2628,10 +2629,10 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
     mesh_get_composite_tag_definition(msh, tag, &nb_tag, tags_buff);
     if(nb_tag > 1)  
       tag=tags_buff[nb_tag-1];
-    if ( tag > emap.Extent() )
+    if ( tag < 1 || tag > emap.Extent() )
     {
       std::cerr << "MG-CADSurf BUG:::: Edge tag " << tag
-                << " more than nb CAD egdes (" << emap.Extent() << ")" << std::endl;
+                << " does not point to a CAD edge (nb edges " << emap.Extent() << ")" << std::endl;
       continue;
     }
     if (tags[vtx[0]]) {
index 1d59f6979a67f70c806479249fb8fcb18bc732e4..cda6029ac392572730d39eb8507cc77affb1457f 100644 (file)
 #include CORBA_CLIENT_HEADER(SALOMEDS)
 #include CORBA_CLIENT_HEADER(GEOM_Gen)
 
+namespace
+{
+  struct GET_DEFAULT // struct used to get default value from GetOptionValue()
+  {
+    bool isDefault;
+    operator bool* () { return &isDefault; }
+  };
+}
+
 //=============================================================================
 BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen) :
   SMESH_Hypothesis(hypId, studyId, gen), 
@@ -50,7 +59,10 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G
   _maxSize(GetDefaultMaxSize()),
   _minSizeRel(GetDefaultMinSizeRel()),
   _maxSizeRel(GetDefaultMaxSizeRel()),
+  _useGradation(GetDefaultUseGradation()),
   _gradation(GetDefaultGradation()),
+  _useVolumeGradation(GetDefaultUseVolumeGradation()),
+  _volumeGradation(GetDefaultVolumeGradation()),
   _quadAllowed(GetDefaultQuadAllowed()),
   _angleMesh(GetDefaultAngleMesh()),
   _chordalError(GetDefaultChordalError()), 
@@ -58,6 +70,10 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G
   _anisotropicRatio(GetDefaultAnisotropicRatio()),
   _removeTinyEdges(GetDefaultRemoveTinyEdges()),
   _tinyEdgeLength(GetDefaultTinyEdgeLength()),
+  _optimiseTinyEdges(GetDefaultOptimiseTinyEdges()),
+  _tinyEdgeOptimisationLength(GetDefaultTinyEdgeOptimisationLength()),
+  _correctSurfaceIntersec(GetDefaultCorrectSurfaceIntersection()),
+  _corrSurfaceIntersCost(GetDefaultCorrectSurfaceIntersectionMaxCost()),
   _badElementRemoval(GetDefaultBadElementRemoval()),
   _badElementAspectRatio(GetDefaultBadElementAspectRatio()),
   _optimizeMesh(GetDefaultOptimizeMesh()),
@@ -89,52 +105,51 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G
   
 //   _GMFFileMode = false; // GMF ascii mode
 
-  const char* boolOptionNames[] = {         "correct_surface_intersections",            // default = 1
-                                            "create_tag_on_collision",                  // default = 1
-                                            "debug",                                    // default = 0
-                                            "enforce_cad_edge_sizes",                   // default = 0
-                                            "frontal",                                  // ok default = 1
+  // Advanced options with their defaults according to MG User Manual
+
+  const char* boolOptionNames[] = {         "enforce_cad_edge_sizes",                   // default = 0
+                                            // "correct_surface_intersections",            // default = 1
+                                            // "create_tag_on_collision",                  // default = 1
                                             "jacobian_rectification_respect_geometry",  // default = 1
-                                            "proximity",                                // default = 0
                                             "rectify_jacobian",                         // default = 1
                                             "respect_geometry",                         // default = 1
-                                            "optimise_tiny_edges",                      // default = 0
+                                            // "optimise_tiny_edges",                      // default = 0
+                                            // "remove_duplicate_cad_faces",               // default = 1
                                             "tiny_edge_avoid_surface_intersections",    // default = 1
-                                            "tiny_edge_respect_geometry",               // default = 0
+                                            // "tiny_edge_respect_geometry",               // default = 0
                                             "" // mark of end
       };
 
-  const char* intOptionNames[] = {          "hinterpol_flag",                           // ok default = 0
-                                            "hmean_flag",                               // ok default = 0
-                                            "max_number_of_points_per_patch",           // default = 100000
-                                            "prox_nb_layer",                            // detects the volumic proximity of surfaces
+  const char* intOptionNames[] = {          "max_number_of_points_per_patch",           // default = 100000
                                             "" // mark of end
       };
-  const char* doubleOptionNames[] = {       "surface_intersections_processing_max_cost",// default = 15
-                                            "periodic_tolerance",                       // default = diag/100
-                                            "prox_ratio",
-                                            "volume_gradation",
-                                            "tiny_edge_optimisation_length",            // default = diag * 1e-6
+  const char* doubleOptionNames[] = {       // "surface_intersections_processing_max_cost",// default = 15
+                                            // "periodic_tolerance",                       // default = diag/100
+                                            // "volume_gradation",
+                                            // "tiny_edge_optimisation_length",            // default = diag * 1e-6
                                             "" // mark of end
       };
-  const char* charOptionNames[] = {         "required_entities",                        // default = "respect"
-                                            "tags",                                     // default = "respect"
+  const char* charOptionNames[] = {         // "required_entities",                        // default = "respect"
+                                            // "tags",                                     // default = "respect"
                                             "" // mark of end
       };
 
   // PreCAD advanced options
   const char* preCADboolOptionNames[] = {   "closed_geometry",                          // default = 0
-                                            "create_tag_on_collision",                  // default = 1
+                                            "discard_input_topology",                   // default = 0
+                                            "merge_edges",                              // default =  = 1
+                                            "remove_duplicate_cad_faces",               // default = 1
+                                            // "create_tag_on_collision",                  // default = 1
                                             "debug",                                    // default = 0 
-                                            "remove_tiny_edges",                        // default = 0
+                                            // "remove_tiny_edges",                        // default = 0
                                             "" // mark of end
       };
-  const char* preCADintOptionNames[] = {    "manifold_geometry",                        // default = 0
+  const char* preCADintOptionNames[] = {    // "manifold_geometry",                        // default = 0
                                             "" // mark of end
       };
   const char* preCADdoubleOptionNames[] = { "periodic_tolerance",                       // default = diag * 1e-5
                                             "sewing_tolerance",                         // default = diag * 5e-4
-                                            "tiny_edge_length",                         // default = diag * 1e-5
+                                            // "tiny_edge_length",                         // default = diag * 1e-5
                                             "" // mark of end
       };
   const char* preCADcharOptionNames[] = {   "required_entities",                        // default = "respect"
@@ -144,12 +159,16 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G
   
   int i = 0;
   while (boolOptionNames[i][0])
+  {
+    _boolOptions.insert( boolOptionNames[i] );
     _option2value[boolOptionNames[i++]].clear();
-  
+  }
   i = 0;
   while (preCADboolOptionNames[i][0])
+  {
+    _boolOptions.insert( preCADboolOptionNames[i] );
     _preCADoption2value[preCADboolOptionNames[i++]].clear();
-  
+  }
   i = 0;
   while (intOptionNames[i][0])
     _option2value[intOptionNames[i++]].clear();
@@ -178,8 +197,32 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G
     _preCADcharOptions.insert(preCADcharOptionNames[i]);
     _preCADoption2value[preCADcharOptionNames[i++]].clear();
   }
-  
 
+  // default values to be used while MG meshing
+
+  _defaultOptionValues["enforce_cad_edge_sizes"                 ] = "no";
+  _defaultOptionValues["jacobian_rectification_respect_geometry"] = "yes";
+  _defaultOptionValues["max_number_of_points_per_patch"         ] = "0";
+  _defaultOptionValues["rectify_jacobian"                       ] = "yes";
+  _defaultOptionValues["respect_geometry"                       ] = "yes";
+  _defaultOptionValues["tiny_edge_avoid_surface_intersections"  ] = "yes";
+  _defaultOptionValues["closed_geometry"                        ] = "no";
+  _defaultOptionValues["debug"                                  ] = "no";
+  _defaultOptionValues["discard_input_topology"                 ] = "no";
+  _defaultOptionValues["merge_edges"                            ] = "no";
+  _defaultOptionValues["periodic_tolerance"                     ] = "1e-5*D";
+  _defaultOptionValues["remove_duplicate_cad_faces"             ] = "no";
+  _defaultOptionValues["required_entities"                      ] = "respect";
+  _defaultOptionValues["sewing_tolerance"                       ] = "5e-4*D";
+  _defaultOptionValues["tags"                                   ] = "respect";
+
+#ifdef _DEBUG_
+  // check validity of option names of _defaultOptionValues
+  TOptionValues::iterator n2v = _defaultOptionValues.begin();
+  for ( ; n2v != _defaultOptionValues.end(); ++n2v )
+    ASSERT( _option2value.count( n2v->first ) || _preCADoption2value.count( n2v->first ));
+  ASSERT( _option2value.size() + _preCADoption2value.size() == _defaultOptionValues.size() );
+#endif
       
   _sizeMap.clear();
   _attractors.clear();
@@ -271,6 +314,14 @@ void BLSURFPlugin_Hypothesis::SetMaxSize(double theMaxSize, bool isRelative) {
   }
 }
 
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetUseGradation(bool theVal) {
+  if (theVal != _useGradation) {
+    _useGradation = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
 //=============================================================================
 void BLSURFPlugin_Hypothesis::SetGradation(double theVal) {
   if (theVal != _gradation) {
@@ -279,6 +330,22 @@ void BLSURFPlugin_Hypothesis::SetGradation(double theVal) {
   }
 }
 
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetUseVolumeGradation(bool theVal) {
+  if (theVal != _useVolumeGradation) {
+    _useVolumeGradation = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetVolumeGradation(double theVal) {
+  if (theVal != _volumeGradation) {
+    _volumeGradation = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
 //=============================================================================
 void BLSURFPlugin_Hypothesis::SetQuadAllowed(bool theVal) {
   if (theVal != _quadAllowed) {
@@ -335,6 +402,38 @@ void BLSURFPlugin_Hypothesis::SetTinyEdgeLength(double theVal) {
   }
 }
 
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetOptimiseTinyEdges(bool theVal) {
+  if (theVal != _optimiseTinyEdges) {
+    _optimiseTinyEdges = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetTinyEdgeOptimisationLength(double theVal) {
+  if (theVal != _tinyEdgeOptimisationLength) {
+    _tinyEdgeOptimisationLength = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetCorrectSurfaceIntersection(bool theVal) {
+  if (theVal != _correctSurfaceIntersec) {
+    _correctSurfaceIntersec = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetCorrectSurfaceIntersectionMaxCost(double theVal) {
+  if (theVal != _corrSurfaceIntersCost) {
+    _corrSurfaceIntersCost = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
 //=============================================================================
 void BLSURFPlugin_Hypothesis::SetBadElementRemoval(bool theVal) {
   if (theVal != _badElementRemoval) {
@@ -384,16 +483,218 @@ void BLSURFPlugin_Hypothesis::SetVerbosity(int theVal) {
 }
 
 //=============================================================================
-void BLSURFPlugin_Hypothesis::SetPreCADMergeEdges(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetEnforceCadEdgesSize( bool toEnforce )
+{
+  if ( GetEnforceCadEdgesSize() != toEnforce )
+  {
+    SetOptionValue( "enforce_cad_edge_sizes", toEnforce ? "yes" : "no" );
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+bool BLSURFPlugin_Hypothesis::GetEnforceCadEdgesSize()
+{
+  return ToBool( GetOptionValue( "enforce_cad_edge_sizes" ), GET_DEFAULT() );
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis::SetJacobianRectificationRespectGeometry( bool allowRectification )
+{
+  if ( GetJacobianRectificationRespectGeometry() != allowRectification )
+  {
+    SetOptionValue("jacobian_rectification_respect_geometry", allowRectification ? "yes" : "no" );
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+bool BLSURFPlugin_Hypothesis::GetJacobianRectificationRespectGeometry()
+{
+  return ToBool( GetOptionValue("jacobian_rectification_respect_geometry", GET_DEFAULT()));
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis::SetJacobianRectification( bool allowRectification )
+{
+  if ( GetJacobianRectification() != allowRectification )
+  {
+    SetOptionValue( "rectify_jacobian", allowRectification ? "yes" : "no" );
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+bool BLSURFPlugin_Hypothesis::GetJacobianRectification()
+{
+  return ToBool( GetOptionValue("rectify_jacobian", GET_DEFAULT()));
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis::SetMaxNumberOfPointsPerPatch( CORBA::Long nb )
+  throw (std::invalid_argument)
+{
+  if ( nb < 0 )
+    throw std::invalid_argument( SMESH_Comment("Invalid number of points: ") << nb );
+
+  if ( GetMaxNumberOfPointsPerPatch() != nb )
+  {
+    SetOptionValue("max_number_of_points_per_patch", SMESH_Comment( nb ));
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+int BLSURFPlugin_Hypothesis::GetMaxNumberOfPointsPerPatch()
+{
+  return ToInt( GetOptionValue("max_number_of_points_per_patch", GET_DEFAULT()));
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis::SetRespectGeometry( bool toRespect )
+{
+  if ( GetRespectGeometry() != toRespect )
+  {
+    SetOptionValue("respect_geometry", toRespect ? "yes" : "no" );
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+bool BLSURFPlugin_Hypothesis::GetRespectGeometry()
+{
+  return ToBool( GetOptionValue( "respect_geometry", GET_DEFAULT()));
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis::SetTinyEdgesAvoidSurfaceIntersections( bool toAvoidIntersection )
+{
+  if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
+  {
+    SetOptionValue("tiny_edge_avoid_surface_intersections", toAvoidIntersection ? "yes" : "no" );
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+bool BLSURFPlugin_Hypothesis::GetTinyEdgesAvoidSurfaceIntersections()
+{
+  return ToBool( GetOptionValue("tiny_edge_avoid_surface_intersections", GET_DEFAULT()));
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis::SetClosedGeometry( bool isClosed )
+{
+  if ( GetClosedGeometry() != isClosed )
+  {
+    SetPreCADOptionValue("closed_geometry", isClosed ? "yes" : "no" );
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+bool BLSURFPlugin_Hypothesis::GetClosedGeometry()
+{
+  return ToBool( GetPreCADOptionValue( "closed_geometry", GET_DEFAULT()));
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis::SetDebug( bool isDebug )
+{
+  if ( GetDebug() != isDebug )
+  {
+    SetPreCADOptionValue("debug", isDebug ? "yes" : "no" );
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+bool BLSURFPlugin_Hypothesis::GetDebug()
+{
+  return ToBool( GetPreCADOptionValue("debug", GET_DEFAULT()));
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis::SetPeriodicTolerance( CORBA::Double tol )
+  throw (std::invalid_argument)
+{
+  if ( tol <= 0 )
+    throw std::invalid_argument( SMESH_Comment("Invalid tolerance: ") << tol );
+  if ( GetPeriodicTolerance() != tol )
+  {
+    SetPreCADOptionValue("periodic_tolerance", SMESH_Comment( tol ) );
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+double BLSURFPlugin_Hypothesis::GetPeriodicTolerance()
+{
+  return ToDbl( GetPreCADOptionValue( "periodic_tolerance", GET_DEFAULT()));
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis::SetRequiredEntities( const std::string& howToTreat )
+  throw (std::invalid_argument)
+{
+  if ( howToTreat != "respect" && howToTreat != "ignore" && howToTreat != "clear"  )
+    throw std::invalid_argument
+      ( SMESH_Comment("required_entities must be in ['respect','ignore','clear'] "));
+
+  if ( GetRequiredEntities() != howToTreat )
+  {
+    SetPreCADOptionValue("required_entities", howToTreat );
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+std::string BLSURFPlugin_Hypothesis::GetRequiredEntities()
+{
+  return GetPreCADOptionValue("required_entities", GET_DEFAULT());
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis::SetSewingTolerance( CORBA::Double tol )
+  throw (std::invalid_argument)
+{
+  if ( tol <= 0 )
+    throw std::invalid_argument( SMESH_Comment("Invalid tolerance: ") << tol );
+  if ( GetSewingTolerance() != tol )
+  {
+    SetPreCADOptionValue("sewing_tolerance", SMESH_Comment( tol ) );
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+CORBA::Double BLSURFPlugin_Hypothesis::GetSewingTolerance()
+{
+  return ToDbl( GetPreCADOptionValue("sewing_tolerance", GET_DEFAULT()));
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis::SetTags( const std::string& howToTreat )
+  throw (std::invalid_argument)
+{
+  if ( howToTreat != "respect" && howToTreat != "ignore" && howToTreat != "clear"  )
+    throw std::invalid_argument
+      ( SMESH_Comment("'tags' must be in ['respect','ignore','clear'] "));
+
+  if ( GetTags() != howToTreat )
+  {
+    SetPreCADOptionValue("tags", howToTreat );
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+std::string BLSURFPlugin_Hypothesis::GetTags()
+{
+  return GetPreCADOptionValue("tags", GET_DEFAULT());
+}
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetPreCADMergeEdges(bool theVal)
+{
   if (theVal != _preCADMergeEdges) {
 //     SetTopology(PreCAD);
     _preCADMergeEdges = theVal;
+    SetPreCADOptionValue("merge_edges", theVal ? "yes" : "no" );
     NotifySubMeshesHypothesisModification();
   }
 }
 
 //=============================================================================
-void BLSURFPlugin_Hypothesis::SetPreCADRemoveTinyUVEdges(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetPreCADRemoveTinyUVEdges(bool theVal)
+{
   if (theVal != _preCADRemoveTinyUVEdges) {
 //     SetTopology(PreCAD);
     _preCADRemoveTinyUVEdges = theVal;
@@ -402,28 +703,33 @@ void BLSURFPlugin_Hypothesis::SetPreCADRemoveTinyUVEdges(bool theVal) {
 }
 
 //=============================================================================
-void BLSURFPlugin_Hypothesis::SetPreCADRemoveDuplicateCADFaces(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetPreCADRemoveDuplicateCADFaces(bool theVal)
+{
   if (theVal != _preCADRemoveDuplicateCADFaces) {
-//     SetTopology(PreCAD);
+    //     SetTopology(PreCAD);
     _preCADRemoveDuplicateCADFaces = theVal;
+    SetPreCADOptionValue("remove_duplicate_cad_faces", theVal ? "yes" : "no" );
     NotifySubMeshesHypothesisModification();
   }
 }
 
 //=============================================================================
-void BLSURFPlugin_Hypothesis::SetPreCADProcess3DTopology(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetPreCADProcess3DTopology(bool theVal)
+{
   if (theVal != _preCADProcess3DTopology) {
-//     SetTopology(PreCAD);
+    //     SetTopology(PreCAD);
     _preCADProcess3DTopology = theVal;
     NotifySubMeshesHypothesisModification();
   }
 }
 
 //=============================================================================
-void BLSURFPlugin_Hypothesis::SetPreCADDiscardInput(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetPreCADDiscardInput(bool theVal)
+{
   if (theVal != _preCADDiscardInput) {
-//     SetTopology(PreCAD);
+    //     SetTopology(PreCAD);
     _preCADDiscardInput = theVal;
+    SetPreCADOptionValue("discard_input_topology", theVal ? "yes" : "no" );
     NotifySubMeshesHypothesisModification();
   }
 }
@@ -433,19 +739,26 @@ void BLSURFPlugin_Hypothesis::SetPreCADDiscardInput(bool theVal) {
 void BLSURFPlugin_Hypothesis::SetGMFFile(const std::string& theFileName)
 {
   _GMFFileName = theFileName;
-//   _GMFFileMode = isBinary;
+  //   _GMFFileMode = isBinary;
   NotifySubMeshesHypothesisModification();
 }
 
 //=============================================================================
 void BLSURFPlugin_Hypothesis::SetOptionValue(const std::string& optionName, const std::string& optionValue)
-    throw (std::invalid_argument) {
+  throw (std::invalid_argument) {
+
   TOptionValues::iterator op_val = _option2value.find(optionName);
-  if (op_val == _option2value.end()) {
-    std::string msg = "Unknown MG-CADSurf option: '" + optionName + "'";
-    throw std::invalid_argument(msg);
+  if (op_val == _option2value.end())
+  {
+    op_val = _preCADoption2value.find(optionName);
+    if (op_val == _preCADoption2value.end())
+    {
+      std::string msg = "Unknown MG-CADSurf option: '" + optionName + "'. Try SetAdvancedOption()";
+      throw std::invalid_argument(msg);
+    }
   }
-  if (op_val->second != optionValue) {
+  if (op_val->second != optionValue)
+  {
     const char* ptr = optionValue.c_str();
     // strip white spaces
     while (ptr[0] == ' ')
@@ -458,39 +771,49 @@ void BLSURFPlugin_Hypothesis::SetOptionValue(const std::string& optionName, cons
     std::string typeName;
     if (i == 0) {
       // empty string
-    } else if (_charOptions.find(optionName) != _charOptions.end()) {
+    } else if (_charOptions.count(optionName)) {
       // do not check strings
-    } else if (_doubleOptions.find(optionName) != _doubleOptions.end()) {
+    } else if (_doubleOptions.count(optionName)) {
       // check if value is double
-      char * endPtr;
-      strtod(ptr, &endPtr);
-      typeOk = (ptr != endPtr);
+      ToDbl(ptr, &typeOk);
       typeName = "real";
+    } else if (_boolOptions.count(optionName)) {
+      // check if value is bool
+      ToBool(ptr, &typeOk);
+      typeName = "bool";
     } else {
       // check if value is int
-      char * endPtr;
-      strtol(ptr, &endPtr, 10);
-      typeOk = (ptr != endPtr);
+      ToInt(ptr, &typeOk);
       typeName = "integer";
     }
     if (!typeOk) {
       std::string msg = "Advanced option '" + optionName + "' = '" + optionValue + "' but must be " + typeName;
       throw std::invalid_argument(msg);
     }
-    op_val->second = optionValue;
+    std::string value( ptr, i );
+    if ( _defaultOptionValues[ optionName ] == value )
+      value.clear();
+
+    op_val->second = value;
+
     NotifySubMeshesHypothesisModification();
   }
 }
 
 //=============================================================================
 void BLSURFPlugin_Hypothesis::SetPreCADOptionValue(const std::string& optionName, const std::string& optionValue)
-    throw (std::invalid_argument) {
+  throw (std::invalid_argument) {
+
   TOptionValues::iterator op_val = _preCADoption2value.find(optionName);
   if (op_val == _preCADoption2value.end()) {
-    std::string msg = "Unknown MG-CADSurf option: '" + optionName + "'";
-    throw std::invalid_argument(msg);
+    op_val = _option2value.find(optionName);
+    if (op_val == _option2value.end()) {
+      std::string msg = "Unknown MG-PreCAD option: '" + optionName + "'. Try SetAdvancedOption()";
+      throw std::invalid_argument(msg);
+    }
   }
-  if (op_val->second != optionValue) {
+  if (op_val->second != optionValue)
+  {
     const char* ptr = optionValue.c_str();
     // strip white spaces
     while (ptr[0] == ' ')
@@ -511,6 +834,10 @@ void BLSURFPlugin_Hypothesis::SetPreCADOptionValue(const std::string& optionName
       strtod(ptr, &endPtr);
       typeOk = (ptr != endPtr);
       typeName = "real";
+    } else if (_boolOptions.count(optionName)) {
+      // check if value is bool
+      ToBool(ptr, &typeOk);
+      typeName = "bool";
     } else {
       // check if value is int
       char * endPtr;
@@ -522,35 +849,81 @@ void BLSURFPlugin_Hypothesis::SetPreCADOptionValue(const std::string& optionName
       std::string msg = "PreCAD advanced option '" + optionName + "' = '" + optionValue + "' but must be " + typeName;
       throw std::invalid_argument(msg);
     }
-    op_val->second = optionValue;
+    std::string value( ptr, i );
+    if ( _defaultOptionValues[ optionName ] == value )
+      value.clear();
+
+    op_val->second = value;
+
     NotifySubMeshesHypothesisModification();
   }
 }
 
 //=============================================================================
-std::string BLSURFPlugin_Hypothesis::GetOptionValue(const std::string& optionName) throw (std::invalid_argument) {
-  TOptionValues::iterator op_val = _option2value.find(optionName);
-  if (op_val == _option2value.end()) {
-    std::string msg = "Unknown MG-CADSurf option: <";
-    msg += optionName + ">";
-    throw std::invalid_argument(msg);
+std::string BLSURFPlugin_Hypothesis::GetOptionValue(const std::string& optionName,
+                                                    bool*              isDefault) const
+  throw (std::invalid_argument)
+{
+  TOptionValues::const_iterator op_val = _option2value.find(optionName);
+  if (op_val == _option2value.end())
+  {
+    op_val = _preCADoption2value.find(optionName);
+    if (op_val == _preCADoption2value.end())
+    {
+      op_val = _customOption2value.find(optionName);
+      if (op_val == _customOption2value.end())
+      {
+        std::string msg = "Unknown MG-CADSurf option: <" + optionName + ">";
+        throw std::invalid_argument(msg);
+      }
+    }
+  }
+  std::string val = op_val->second;
+  if ( isDefault ) *isDefault = ( val.empty() );
+
+  if ( val.empty() && isDefault )
+  {
+    op_val = _defaultOptionValues.find( optionName );
+    if (op_val != _defaultOptionValues.end())
+      val = op_val->second;
   }
-  return op_val->second;
+  return val;
 }
 
 //=============================================================================
-std::string BLSURFPlugin_Hypothesis::GetPreCADOptionValue(const std::string& optionName) throw (std::invalid_argument) {
-  TOptionValues::iterator op_val = _preCADoption2value.find(optionName);
-  if (op_val == _preCADoption2value.end()) {
-    std::string msg = "Unknown PRECAD option: <";
-    msg += optionName + ">";
-    throw std::invalid_argument(msg);
+std::string BLSURFPlugin_Hypothesis::GetPreCADOptionValue(const std::string& optionName,
+                                                          bool*              isDefault) const
+  throw (std::invalid_argument)
+{
+  TOptionValues::const_iterator op_val = _preCADoption2value.find(optionName);
+  if (op_val == _preCADoption2value.end())
+  {
+    op_val = _option2value.find(optionName);
+    if (op_val == _option2value.end())
+    {
+      op_val = _customOption2value.find(optionName);
+      if (op_val == _customOption2value.end())
+      {
+        std::string msg = "Unknown MG-CADSurf option: <" + optionName + ">";
+        throw std::invalid_argument(msg);
+      }
+    }
   }
-  return op_val->second;
+  std::string val = op_val->second;
+  if ( isDefault ) *isDefault = ( val.empty() );
+
+  if ( val.empty() && isDefault )
+  {
+    op_val = _defaultOptionValues.find( optionName );
+    if (op_val != _option2value.end())
+      val = op_val->second;
+  }
+  return val;
 }
 
 //=============================================================================
-void BLSURFPlugin_Hypothesis::ClearOption(const std::string& optionName) {
+void BLSURFPlugin_Hypothesis::ClearOption(const std::string& optionName)
+{
   TOptionValues::iterator op_val = _customOption2value.find(optionName);
   if (op_val != _customOption2value.end())
    _customOption2value.erase(op_val);
@@ -558,55 +931,67 @@ void BLSURFPlugin_Hypothesis::ClearOption(const std::string& optionName) {
     op_val = _option2value.find(optionName);
     if (op_val != _option2value.end())
       op_val->second.clear();
+    else {
+      op_val = _preCADoption2value.find(optionName);
+      if (op_val != _preCADoption2value.end())
+        op_val->second.clear();
+    }
   }
 }
 
 //=============================================================================
-void BLSURFPlugin_Hypothesis::ClearPreCADOption(const std::string& optionName) {
-  TOptionValues::iterator op_val = _customPreCADOption2value.find(optionName);
-  if (op_val != _customPreCADOption2value.end())
-    _customPreCADOption2value.erase(op_val);
-  else {
-    op_val = _preCADoption2value.find(optionName);
-    if (op_val != _preCADoption2value.end())
-      op_val->second.clear();
-  }
+void BLSURFPlugin_Hypothesis::ClearPreCADOption(const std::string& optionName)
+{
+  TOptionValues::iterator op_val = _preCADoption2value.find(optionName);
+  if (op_val != _preCADoption2value.end())
+    op_val->second.clear();
 }
 
 //=============================================================================
 void BLSURFPlugin_Hypothesis::AddOption(const std::string& optionName, const std::string& optionValue)
 {
+  bool modif = true;
   TOptionValues::iterator op_val = _option2value.find(optionName);
-  if (op_val != _option2value.end()) {
+  if (op_val != _option2value.end())
+  {
     if (op_val->second != optionValue)
       op_val->second = optionValue;
+    else
+      modif = false;
   }
-  else {
-    op_val = _customOption2value.find(optionName);
-    if (op_val == _customOption2value.end())
-      _customOption2value[optionName] = optionValue;
-    else if (op_val->second != optionValue)
-      op_val->second = optionValue;
+  else
+  {
+    op_val = _preCADoption2value.find(optionName);
+    if (op_val != _preCADoption2value.end())
+    {
+      if (op_val->second != optionValue)
+        op_val->second = optionValue;
+      else
+        modif = false;
+    }
+    else if ( optionValue.empty() )
+    {
+      _customOption2value.erase( optionName );
+    }
+    else
+    {
+      op_val = _customOption2value.find(optionName);
+      if (op_val == _customOption2value.end())
+        _customOption2value[optionName] = optionValue;
+      else if (op_val->second != optionValue)
+        op_val->second = optionValue;
+      else
+        modif = false;
+    }
   }
-  NotifySubMeshesHypothesisModification();
+  if ( modif )
+    NotifySubMeshesHypothesisModification();
 }
 
 //=============================================================================
 void BLSURFPlugin_Hypothesis::AddPreCADOption(const std::string& optionName, const std::string& optionValue)
 {
-  TOptionValues::iterator op_val = _preCADoption2value.find(optionName);
-  if (op_val != _preCADoption2value.end()) {
-    if (op_val->second != optionValue)
-      op_val->second = optionValue;
-  }
-  else {
-    op_val = _customPreCADOption2value.find(optionName);
-    if (op_val == _customPreCADOption2value.end())
-      _customPreCADOption2value[optionName] = optionValue;
-    else if (op_val->second != optionValue)
-      op_val->second = optionValue;
-  }
-  NotifySubMeshesHypothesisModification();
+  AddOption( optionName, optionValue );
 }
 
 //=============================================================================
@@ -622,13 +1007,35 @@ std::string BLSURFPlugin_Hypothesis::GetOption(const std::string& optionName)
 //=============================================================================
 std::string BLSURFPlugin_Hypothesis::GetPreCADOption(const std::string& optionName)
 {
-  TOptionValues::iterator op_val = _customPreCADOption2value.find(optionName);
-  if (op_val != _customPreCADOption2value.end())
+  TOptionValues::iterator op_val = _customOption2value.find(optionName);
+  if (op_val != _customOption2value.end())
     return op_val->second;
   else
     return "";
 }
 
+//=============================================================================
+BLSURFPlugin_Hypothesis::TOptionValues BLSURFPlugin_Hypothesis::GetOptionValues() const
+{
+  TOptionValues vals;
+  TOptionValues::const_iterator op_val = _option2value.begin();
+  for ( ; op_val != _option2value.end(); ++op_val )
+    vals.insert( make_pair( op_val->first, GetOptionValue( op_val->first, GET_DEFAULT() )));
+
+  return vals;
+}
+
+//=============================================================================
+BLSURFPlugin_Hypothesis::TOptionValues BLSURFPlugin_Hypothesis::GetPreCADOptionValues() const
+{
+  TOptionValues vals;
+  TOptionValues::const_iterator op_val = _preCADoption2value.begin();
+  for ( ; op_val != _preCADoption2value.end(); ++op_val )
+    vals.insert( make_pair( op_val->first, GetPreCADOptionValue( op_val->first, GET_DEFAULT() )));
+
+  return vals;
+}
+
 //=======================================================================
 //function : SetSizeMapEntry
 //=======================================================================
@@ -1417,6 +1824,9 @@ std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
   save << " " << (int) _anisotropic << " " << _anisotropicRatio << " " << (int) _removeTinyEdges << " " << _tinyEdgeLength ;
   save << " " << (int) _badElementRemoval << " " << _badElementAspectRatio << " " << (int) _optimizeMesh << " " << (int) _quadraticMesh ;
   save << " " << (int) _preCADProcess3DTopology << " " << (int) _preCADRemoveDuplicateCADFaces << " " << (int) _preCADRemoveTinyUVEdges;
+  save << " " << (int)_optimiseTinyEdges << " " << _tinyEdgeOptimisationLength;
+  save << " " << (int)_correctSurfaceIntersec << " " << _corrSurfaceIntersCost;
+  save << " " << (int)_useGradation << " " << (int)_useVolumeGradation << " " << _volumeGradation;
 
   op_val = _option2value.begin();
   if (op_val != _option2value.end()) {
@@ -1448,16 +1858,6 @@ std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
     save << " " << "__PRECAD_OPTIONS_END__";
   }
 
-  op_val = _customPreCADOption2value.begin();
-  if (op_val != _customPreCADOption2value.end()) {
-    save << " " << "__CUSTOM_PRECAD_OPTIONS_BEGIN__";
-    for (; op_val != _customPreCADOption2value.end(); ++op_val) {
-      if (!op_val->second.empty())
-        save << " " << op_val->first << " " << op_val->second << "%#"; // "%#" is a mark of value end
-    }
-    save << " " << "__CUSTOM_PRECAD_OPTIONS_END__";
-  }
-
   TSizeMap::iterator it_sm = _sizeMap.begin();
   if (it_sm != _sizeMap.end()) {
     save << " " << "__SIZEMAP_BEGIN__";
@@ -1836,7 +2236,6 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
   bool hasOptions = false;
   bool hasCustomOptions = false;
   bool hasPreCADOptions = false;
-  bool hasCustomPreCADOptions = false;
   bool hasSizeMap = false;
   bool hasAttractor = false;
   bool hasNewAttractor = false;
@@ -1860,8 +2259,6 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
       hasCustomOptions = true;
     else if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
       hasPreCADOptions = true;
-    else if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
-      hasCustomPreCADOptions = true;
     else if (option_or_sm == "__SIZEMAP_BEGIN__")
       hasSizeMap = true;
     else if (option_or_sm == "__ATTRACTORS_BEGIN__")
@@ -1954,20 +2351,64 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
     else
       load.clear(std::ios::badbit | load.rdstate());
 
-    isOK = static_cast<bool>(load >> i);
-    if (isOK)
-      _preCADRemoveDuplicateCADFaces = (bool) i;
-    else
-      load.clear(std::ios::badbit | load.rdstate());
-
-    isOK = static_cast<bool>(load >> i);
-    if (isOK)
-      _preCADRemoveTinyUVEdges = (bool) i;
-    else
-      load.clear(std::ios::badbit | load.rdstate());
-
+    if (( load >> std::ws).peek() != '_' )
+    {
+      isOK = static_cast<bool>(load >> i);
+      if (isOK)
+        _preCADRemoveDuplicateCADFaces = (bool) i;
+      else
+        load.clear(std::ios::badbit | load.rdstate());
+
+      isOK = static_cast<bool>(load >> i);
+      if (isOK)
+        _preCADRemoveTinyUVEdges = (bool) i;
+      else
+        load.clear(std::ios::badbit | load.rdstate());
+
+      isOK = static_cast<bool>(load >> i);
+      if (isOK)
+        _optimiseTinyEdges = (bool) i;
+      else
+        load.clear(std::ios::badbit | load.rdstate());
+
+      isOK = static_cast<bool>(load >> val);
+      if (isOK)
+        _tinyEdgeOptimisationLength = val;
+      else
+        load.clear(std::ios::badbit | load.rdstate());
+
+      isOK = static_cast<bool>(load >> i);
+      if (isOK)
+        _correctSurfaceIntersec = (bool) i;
+      else
+        load.clear(std::ios::badbit | load.rdstate());
+
+      isOK = static_cast<bool>(load >> val);
+      if (isOK)
+        _corrSurfaceIntersCost = val;
+      else
+        load.clear(std::ios::badbit | load.rdstate());
+
+      isOK = static_cast<bool>(load >> i);
+      if (isOK)
+        _useGradation = (bool) i;
+      else
+        load.clear(std::ios::badbit | load.rdstate());
+
+      isOK = static_cast<bool>(load >> i);
+      if (isOK)
+        _useVolumeGradation = (bool) i;
+      else
+        load.clear(std::ios::badbit | load.rdstate());
+
+      isOK = static_cast<bool>(load >> val);
+      if (isOK)
+        _volumeGradation = val;
+      else
+        load.clear(std::ios::badbit | load.rdstate());
+    }
   }
-  
+
 
   if (hasCADSurfOptions) {
     isOK = static_cast<bool>(load >> option_or_sm);
@@ -1978,8 +2419,6 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
         hasCustomOptions = true;
       else if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
         hasPreCADOptions = true;
-      else if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
-        hasCustomPreCADOptions = true;
       else if (option_or_sm == "__SIZEMAP_BEGIN__")
         hasSizeMap = true;
       else if (option_or_sm == "__ATTRACTORS_BEGIN__")
@@ -2024,7 +2463,7 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
           break;
         }
       }
-      value[len - 2] = '\0'; //cut off "%#"
+      value.resize(len - 2); //cut off "%#"
     }
   }
 
@@ -2035,8 +2474,6 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
         hasCustomOptions = true;
       else if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
         hasPreCADOptions = true;
-      else if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
-        hasCustomPreCADOptions = true;
       else if (option_or_sm == "__SIZEMAP_BEGIN__")
         hasSizeMap = true;
       else if (option_or_sm == "__ATTRACTORS_BEGIN__")
@@ -2079,8 +2516,8 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
           break;
         }
       }
-      _customOption2value[optName] = value.substr(0,len-2);
-      value[len - 2] = '\0'; //cut off "%#"
+      value.resize(len - 2); //cut off "%#"
+      _customOption2value[optName] = value;
     }
   }
 
@@ -2089,8 +2526,6 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
     if (isOK) {
       if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
         hasPreCADOptions = true;
-      else if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
-        hasCustomPreCADOptions = true;
       else if (option_or_sm == "__SIZEMAP_BEGIN__")
         hasSizeMap = true;
       else if (option_or_sm == "__ATTRACTORS_BEGIN__")
@@ -2134,63 +2569,11 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
           break;
         }
       }
-      value[len - 2] = '\0'; //cut off "%#"
+      value.resize(len - 2); //cut off "%#"
     }
   }
 
   if (hasPreCADOptions) {
-    isOK = static_cast<bool>(load >> option_or_sm);
-    if (isOK) {
-      if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
-        hasCustomPreCADOptions = true;
-      else if (option_or_sm == "__SIZEMAP_BEGIN__")
-        hasSizeMap = true;
-      else if (option_or_sm == "__ATTRACTORS_BEGIN__")
-        hasAttractor = true;
-      else if (option_or_sm == "__NEW_ATTRACTORS_BEGIN__")
-        hasNewAttractor = true;
-      else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
-        hasEnforcedVertex = true;
-      else if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
-        hasPreCADFacesPeriodicity = true;
-      else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
-        hasPreCADEdgesPeriodicity = true;
-      else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
-        hasFacesPeriodicity = true;
-      else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
-        hasEdgesPeriodicity = true;
-      else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
-        hasVerticesPeriodicity = true;
-    }
-  }
-
-  while (isOK && hasCustomPreCADOptions) {
-    isOK = static_cast<bool>(load >> optName);
-    if (isOK) {
-      if (optName == "__CUSTOM_PRECAD_OPTIONS_END__")
-        break;
-      isOK = static_cast<bool>(load >> optValue);
-    }
-    if (isOK) {
-      std::string& value = optValue;
-      int len = value.size();
-      // continue reading until "%#" encountered
-      while (value[len - 1] != '#' || value[len - 2] != '%') {
-        isOK = static_cast<bool>(load >> optValue);
-        if (isOK) {
-          value += " ";
-          value += optValue;
-          len = value.size();
-        } else {
-          break;
-        }
-      }
-      _customPreCADOption2value[optName] = value.substr(0,len-2);
-      value[len - 2] = '\0'; //cut off "%#"
-    }
-  }
-
-  if (hasCustomPreCADOptions) {
     isOK = static_cast<bool>(load >> option_or_sm);
     if (isOK) {
       if (option_or_sm == "__SIZEMAP_BEGIN__")
@@ -2213,7 +2596,7 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
         hasVerticesPeriodicity = true;
     }
   }
-  
   std::string smEntry, smValue;
   while (isOK && hasSizeMap) {
     isOK = static_cast<bool>(load >> smEntry);
@@ -2237,7 +2620,7 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
           break;
         }
       }
-      value2[len2 - 2] = '\0'; //cut off "%#"
+      value2.resize(len2 - 2); //cut off "%#"
     }
   }
 
@@ -2285,7 +2668,7 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
           break;
         }
       }
-      value3[len3 - 2] = '\0'; //cut off "%#"
+      value3.resize(len3 - 2); //cut off "%#"
     }
   }
 
@@ -2942,6 +3325,18 @@ double BLSURFPlugin_Hypothesis::GetDefaultTinyEdgeLength(double diagonal) {
   return undefinedDouble();
 }
 
+//================================================================================
+/*!
+ * \brief Returns default tiny edge optimisation length given a default value of element length ratio
+ */
+//================================================================================
+
+double BLSURFPlugin_Hypothesis::GetDefaultTinyEdgeOptimisationLength(double diagonal) {
+  if (diagonal != 0)
+    return diagonal * 1e-6 ;
+  return undefinedDouble();
+}
+
 //=============================================================================
 /*!
  * \brief Initialize my parameter values by default parameters.
@@ -2954,9 +3349,90 @@ bool BLSURFPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& dflts, co
   _phySize = GetDefaultPhySize(diagonal, _gen->GetBoundaryBoxSegmentation());
   _minSize = GetDefaultMinSize(diagonal);
   _maxSize = GetDefaultMaxSize(diagonal);
-  _chordalError = GetDefaultChordalError(diagonal);
+  _chordalError = 0.5 * _phySize; //GetDefaultChordalError(diagonal); IMP 0023307
   _tinyEdgeLength = GetDefaultTinyEdgeLength(diagonal);
+  _tinyEdgeOptimisationLength = GetDefaultTinyEdgeOptimisationLength(diagonal);
 
   return true;
-//   return bool(_phySize = dflts._elemLength);
 }
+
+//================================================================================
+/*!
+ * \brief Converts a string to a bool
+ */
+//================================================================================
+
+bool BLSURFPlugin_Hypothesis::ToBool(const std::string& str, bool* isOk )
+  throw (std::invalid_argument)
+{
+  std::string s = str;
+  if ( isOk ) *isOk = true;
+
+  for ( size_t i = 0; i <= s.size(); ++i )
+    s[i] = tolower( s[i] );
+
+  if ( s == "1" || s == "true" || s == "active" || s == "yes" )
+    return true;
+
+  if ( s == "0" || s == "false" || s == "inactive" || s == "no" )
+    return false;
+
+  if ( isOk )
+    *isOk = false;
+  else {
+    std::string msg = "Not a Boolean value:'" + str + "'";
+    throw std::invalid_argument(msg);
+  }
+  return false;
+}
+
+//================================================================================
+/*!
+ * \brief Converts a string to a real value
+ */
+//================================================================================
+
+double BLSURFPlugin_Hypothesis::ToDbl(const std::string& str, bool* isOk )
+  throw (std::invalid_argument)
+{
+  if ( str.empty() ) throw std::invalid_argument("Empty value provided");
+
+  char * endPtr;
+  double val = strtod(&str[0], &endPtr);
+  bool ok = (&str[0] != endPtr);
+
+  if ( isOk ) *isOk = ok;
+
+  if ( !ok )
+  {
+    std::string msg = "Not a real value:'" + str + "'";
+    throw std::invalid_argument(msg);
+  }
+  return val;
+}
+
+//================================================================================
+/*!
+ * \brief Converts a string to a integer value
+ */
+//================================================================================
+
+int BLSURFPlugin_Hypothesis::ToInt(const std::string& str, bool* isOk )
+  throw (std::invalid_argument)
+{
+  if ( str.empty() ) throw std::invalid_argument("Empty value provided");
+
+  char * endPtr;
+  int val = (int)strtol( &str[0], &endPtr, 10);
+  bool ok = (&str[0] != endPtr);
+
+  if ( isOk ) *isOk = ok;
+
+  if ( !ok )
+  {
+    std::string msg = "Not an integer value:'" + str + "'";
+    throw std::invalid_argument(msg);
+  }
+  return val;
+}
+
index bee70c63dfb77f85c908a3f29708b81569c79277..70a97abb000e77f95c4c62d0e7dab0a6e80367fd 100644 (file)
@@ -86,9 +86,16 @@ public:
   double GetMaxSize() const { return _maxSize; }
   bool IsMaxSizeRel() const { return _maxSizeRel; }
 
+  void SetUseGradation(bool toUse);
+  bool GetUseGradation() const { return _useGradation; }
   void SetGradation(double theGradation);
   double GetGradation() const { return _gradation; }
 
+  void SetUseVolumeGradation(bool toUse);
+  bool GetUseVolumeGradation() const { return _useVolumeGradation; }
+  void SetVolumeGradation(double theGradation);
+  double GetVolumeGradation() const { return _volumeGradation; }
+
   void SetQuadAllowed(bool theVal);
   bool GetQuadAllowed() const { return _quadAllowed; }
 
@@ -110,6 +117,18 @@ public:
   void SetTinyEdgeLength(double theVal);
   double GetTinyEdgeLength() const { return _tinyEdgeLength; }
 
+  void SetOptimiseTinyEdges(bool theVal);
+  bool GetOptimiseTinyEdges() const { return _optimiseTinyEdges; }
+
+  void SetTinyEdgeOptimisationLength(double theVal);
+  double GetTinyEdgeOptimisationLength() const { return _tinyEdgeOptimisationLength; }
+
+  void SetCorrectSurfaceIntersection(bool theVal);
+  bool GetCorrectSurfaceIntersection() const { return _correctSurfaceIntersec; }
+
+  void SetCorrectSurfaceIntersectionMaxCost(double theVal);
+  double GetCorrectSurfaceIntersectionMaxCost() const { return _corrSurfaceIntersCost; }
+
   void SetBadElementRemoval(bool theVal);
   bool GetBadElementRemoval() const { return _badElementRemoval; }
 
@@ -131,6 +150,42 @@ public:
   void ClearEntry(const std::string& entry, const char * attEntry = 0);
   void ClearSizeMaps();
 
+  void SetEnforceCadEdgesSize( bool toEnforce );
+  bool GetEnforceCadEdgesSize();
+
+  void SetJacobianRectificationRespectGeometry( bool allowRectification );
+  bool GetJacobianRectificationRespectGeometry();
+    
+  void SetJacobianRectification( bool allowRectification );
+  bool GetJacobianRectification();
+
+  void SetMaxNumberOfPointsPerPatch( int nb ) throw (std::invalid_argument);
+  int  GetMaxNumberOfPointsPerPatch();
+
+  void SetRespectGeometry( bool toRespect );
+  bool GetRespectGeometry();
+
+  void SetTinyEdgesAvoidSurfaceIntersections( bool toAvoidIntersection );
+  bool GetTinyEdgesAvoidSurfaceIntersections();
+
+  void SetClosedGeometry( bool isClosed );
+  bool GetClosedGeometry();
+
+  void SetDebug( bool isDebug );
+  bool GetDebug();
+
+  void SetPeriodicTolerance( double tol ) throw (std::invalid_argument);
+  double GetPeriodicTolerance();
+
+  void SetRequiredEntities( const std::string& howToTreat ) throw (std::invalid_argument);
+  std::string GetRequiredEntities();
+
+  void SetSewingTolerance( double tol ) throw (std::invalid_argument);
+  double GetSewingTolerance();
+
+  void SetTags( const std::string& howToTreat ) throw (std::invalid_argument);
+  std::string GetTags();
+
   void SetPreCADMergeEdges(bool theVal);
   bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
 
@@ -342,7 +397,7 @@ public:
 //  bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
 
   static PhysicalMesh    GetDefaultPhysicalMesh() { return PhysicalGlobalSize; }
-  static GeometricMesh   GetDefaultGeometricMesh() { return DefaultGeom; }
+  static GeometricMesh   GetDefaultGeometricMesh() { return GeometricalGlobalSize; }
   static double          GetDefaultPhySize(double diagonal, double bbSegmentation);
   static double          GetDefaultPhySize() { return undefinedDouble(); }
   static bool            GetDefaultPhySizeRel() { return false; }
@@ -352,9 +407,12 @@ public:
   static double          GetDefaultMaxSize(double diagonal);
   static double          GetDefaultMaxSize() { return undefinedDouble(); }
   static bool            GetDefaultMaxSizeRel() { return false; }
+  static bool            GetDefaultUseGradation() { return false; }
   static double          GetDefaultGradation() { return 1.3; }
+  static bool            GetDefaultUseVolumeGradation() { return false; }
+  static double          GetDefaultVolumeGradation() { return 2; }
   static bool            GetDefaultQuadAllowed() { return false; }
-  static double          GetDefaultAngleMesh() { return 22.0; }
+  static double          GetDefaultAngleMesh() { return 8.0; }
   
   static double          GetDefaultChordalError(double diagonal);
   static double          GetDefaultChordalError() { return undefinedDouble(); }
@@ -363,6 +421,11 @@ public:
   static bool            GetDefaultRemoveTinyEdges() { return false; }
   static double          GetDefaultTinyEdgeLength(double diagonal);
   static double          GetDefaultTinyEdgeLength() { return undefinedDouble(); }
+  static bool            GetDefaultOptimiseTinyEdges() { return false; }
+  static double          GetDefaultTinyEdgeOptimisationLength(double diagonal);
+  static double          GetDefaultTinyEdgeOptimisationLength() { return undefinedDouble(); }
+  static bool            GetDefaultCorrectSurfaceIntersection() { return true; }
+  static double          GetDefaultCorrectSurfaceIntersectionMaxCost() { return 15.; }
   static bool            GetDefaultBadElementRemoval() { return false; }
   static double          GetDefaultBadElementAspectRatio() {return 1000.0; } 
   static bool            GetDefaultOptimizeMesh() { return true; }
@@ -433,20 +496,23 @@ public:
                       const std::string& optionValue) throw (std::invalid_argument);
   void SetPreCADOptionValue(const std::string& optionName,
                             const std::string& optionValue) throw (std::invalid_argument);
-  std::string GetOptionValue(const std::string& optionName) throw (std::invalid_argument);
-  std::string GetPreCADOptionValue(const std::string& optionName) throw (std::invalid_argument);
+  std::string GetOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
+  std::string GetPreCADOptionValue(const std::string& optionName, bool* isDefault=0) const throw (std::invalid_argument);
   void ClearOption(const std::string& optionName);
   void ClearPreCADOption(const std::string& optionName);
-  const TOptionValues& GetOptionValues() const { return _option2value; }
-  const TOptionValues& GetPreCADOptionValues() const { return _preCADoption2value; }
+  TOptionValues        GetOptionValues()       const;
+  TOptionValues        GetPreCADOptionValues() const;
   const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
-  const TOptionValues& GetCustomPreCADOptionValues() const { return _customPreCADOption2value; }
 
   void AddOption(const std::string& optionName, const std::string& optionValue);
   void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
   std::string GetOption(const std::string& optionName);
   std::string GetPreCADOption(const std::string& optionName);
 
+  static bool  ToBool(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
+  static double ToDbl(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
+  static int    ToInt(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
+
   /*!
     * Sets the file for export resulting mesh in GMF format
     */
@@ -484,7 +550,10 @@ private:
   bool            _phySizeRel;
   double          _minSize, _maxSize;
   bool            _minSizeRel, _maxSizeRel;
+  bool            _useGradation;
   double          _gradation;
+  bool            _useVolumeGradation;
+  double          _volumeGradation;
   bool            _quadAllowed;
   double          _angleMesh;
   double          _chordalError;
@@ -492,6 +561,10 @@ private:
   double          _anisotropicRatio;
   bool            _removeTinyEdges;
   double          _tinyEdgeLength;
+  bool            _optimiseTinyEdges;
+  double          _tinyEdgeOptimisationLength;
+  bool            _correctSurfaceIntersec;
+  double          _corrSurfaceIntersCost;
   bool            _badElementRemoval;
   double          _badElementAspectRatio;
   bool            _optimizeMesh;
@@ -506,21 +579,22 @@ private:
   bool            _preCADDiscardInput;
   double          _preCADEpsNano;
   
-  TOptionValues   _option2value, _preCADoption2value;
-  TOptionValues   _customOption2value, _customPreCADOption2value;
-  TOptionNames    _doubleOptions, _charOptions;
+  TOptionValues   _option2value, _preCADoption2value, _customOption2value; // user defined values
+  TOptionValues   _defaultOptionValues;               // default values
+  TOptionNames    _doubleOptions, _charOptions, _boolOptions; // to find a type of option
   TOptionNames    _preCADdoubleOptions, _preCADcharOptions;
+
   TSizeMap        _sizeMap;
   TSizeMap        _attractors;
   TAttractorMap   _classAttractors;
   TSizeMap        _attEntry;
   TParamsMap      _attParams;
 
-  TFaceEntryEnfVertexListMap  _faceEntryEnfVertexListMap;
-  TEnfVertexList              _enfVertexList;
+  TFaceEntryEnfVertexListMap      _faceEntryEnfVertexListMap;
+  TEnfVertexList                  _enfVertexList;
   // maps to get "manual" enf vertex (through their coordinates)
-  TFaceEntryCoordsListMap     _faceEntryCoordsListMap;
-  TCoordsEnfVertexMap         _coordsEnfVertexMap;
+  TFaceEntryCoordsListMap         _faceEntryCoordsListMap;
+  TCoordsEnfVertexMap             _coordsEnfVertexMap;
   // maps to get "geom" enf vertex (through their geom entries)
   TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
   TEnfVertexEntryEnfVertexMap     _enfVertexEntryEnfVertexMap;
index f335309eecb12b5e359c8cc90f4d4f6fba19d772..b39f733514a529e5ff2eab428bcb5a0653b4ca4e 100644 (file)
@@ -28,6 +28,7 @@
 #include <SMESH_Gen.hxx>
 #include <SMESH_Gen_i.hxx>
 #include <SMESH_PythonDump.hxx>
+#include <SMESHGUI_Utils.h>
 
 #include <SALOMEDS_wrap.hxx>
 #include <Utils_CorbaException.hxx>
@@ -238,6 +239,35 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() {
   return this->GetImpl()->IsMaxSizeRel();
 }
 
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::SetUseGradation
+ *
+ *  Set true or false
+ */
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue) {
+  MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseGradation");
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetUseGradation(theValue);
+  std::string theValueStr = theValue ? "True" : "False";
+  SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
+}
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::GetUseGradation
+ *
+ *  Get true or false
+ */
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation() {
+  MESSAGE("BLSURFPlugin_Hypothesis_i::GetUseGradation");
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetUseGradation();
+}
+
 //=============================================================================
 /*!
  *  BLSURFPlugin_Hypothesis_i::SetGradation
@@ -265,6 +295,61 @@ CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
   return this->GetImpl()->GetGradation();
 }
 
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
+ *
+ *  Set true or false
+ */
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue) {
+  MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation");
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetUseVolumeGradation(theValue);
+  std::string theValueStr = theValue ? "True" : "False";
+  SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
+}
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
+ *
+ *  Get true or false
+ */
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation() {
+  MESSAGE("BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation");
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetUseVolumeGradation();
+}
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::SetVolumeGradation
+ *
+ *  Set VolumeGradation
+ */
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue) {
+  // MESSAGE("BLSURFPlugin_Hypothesis_i::SetVolumeGradation");
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetVolumeGradation(theValue);
+  SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
+}
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::GetVolumeGradation
+ *
+ *  Get VolumeGradation
+ */
+//=============================================================================
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation() {
+  // MESSAGE("BLSURFPlugin_Hypothesis_i::GetVolumeGradation");
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetVolumeGradation();
+}
+
 //=============================================================================
 /*!
  *  BLSURFPlugin_Hypothesis_i::SetQuadAllowed
@@ -458,6 +543,116 @@ CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
   return this->GetImpl()->GetTinyEdgeLength();
 }
 
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
+ *
+ *  Set true or false
+ */
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
+  // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges");
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetOptimiseTinyEdges(theValue);
+  std::string theValueStr = theValue ? "True" : "False";
+  SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
+}
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
+ *
+ *  Get true or false
+ */
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
+  // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges");
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetOptimiseTinyEdges();
+}
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
+ *
+ *  Set Tiny Edge OptimisationLength
+ */
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
+  // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength");
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
+  SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
+}
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
+ *
+ *  Get Tiny Edge OptimisationLength
+ */
+//=============================================================================
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
+  // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength");
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetTinyEdgeOptimisationLength();
+}
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
+ *
+ *  Set true or false
+ */
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
+  // MESSAGE("BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection");
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
+  std::string theValueStr = theValue ? "True" : "False";
+  SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
+}
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
+ *
+ *  Get true or false
+ */
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
+  // MESSAGE("BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection");
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetCorrectSurfaceIntersection();
+}
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
+ *
+ *  Set Tiny Edge OptimisationLength
+ */
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
+  // MESSAGE("BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost");
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
+  SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
+}
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
+ *
+ *  Get Tiny Edge OptimisationLength
+ */
+//=============================================================================
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
+  // MESSAGE("BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost");
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
+}
+
 //=============================================================================
 /*!
  *  BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
@@ -616,6 +811,240 @@ CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
   return (CORBA::Short) this->GetImpl()->GetVerbosity();
 }
 
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
+{
+  if ( GetEnforceCadEdgesSize() != toEnforce )
+  {
+    this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
+    SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
+  }
+}
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
+{
+  return this->GetImpl()->GetEnforceCadEdgesSize();
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
+{
+  if ( GetJacobianRectificationRespectGeometry() != allowRectification )
+  {
+    this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
+    SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
+  }
+}
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
+{
+  return this->GetImpl()->GetJacobianRectificationRespectGeometry();
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
+{
+  if ( GetJacobianRectification() != allowRectification )
+  {
+    this->GetImpl()->SetJacobianRectification(allowRectification);
+    SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
+  }
+}
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
+{
+  return this->GetImpl()->GetJacobianRectification();
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
+{
+  if ( GetMaxNumberOfPointsPerPatch() != nb )
+  {
+    try {
+      this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
+
+    } catch (const std::invalid_argument& ex) {
+      THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+    } catch (SALOME_Exception& ex) {
+      THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+    }
+    SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
+  }
+}
+//=============================================================================
+CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
+{
+  return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
+{
+  if ( GetRespectGeometry() != toRespect )
+  {
+    this->GetImpl()->SetRespectGeometry(toRespect);
+    SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
+  }
+}
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
+{
+  return this->GetImpl()->GetRespectGeometry();
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
+{
+  if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
+  {
+    this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
+    SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
+  }
+}
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
+{
+  return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
+{
+  if ( GetClosedGeometry() != isClosed )
+  {
+    this->GetImpl()->SetClosedGeometry(isClosed);
+    SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
+  }
+}
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
+{
+  return this->GetImpl()->GetClosedGeometry();
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
+{
+  if ( GetDebug() != isDebug )
+  {
+    this->GetImpl()->SetDebug(isDebug);
+    SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
+  }
+}
+//=============================================================================
+bool BLSURFPlugin_Hypothesis_i::GetDebug()
+{
+  return this->GetImpl()->GetDebug();
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
+{
+  if ( SMESH::toStdStr( GetPreCADOptionValue("periodic_tolerance")) != SMESH_Comment( tol ))
+  {
+    try
+    {
+      this->GetImpl()->SetPeriodicTolerance(tol);
+
+    } catch (const std::invalid_argument& ex) {
+      THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+    } catch (SALOME_Exception& ex) {
+      THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+    }
+    SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
+  }
+}
+//=============================================================================
+double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
+{
+  try{
+    return this->GetImpl()->GetPeriodicTolerance();
+
+  } catch (const std::invalid_argument& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  } catch (SALOME_Exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+  return -1;
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
+{
+  if ( GetImpl()->GetRequiredEntities() != howToTreat )
+  {
+    try {
+      this->GetImpl()->SetRequiredEntities(howToTreat);
+
+    } catch (const std::invalid_argument& ex) {
+      THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+    } catch (SALOME_Exception& ex) {
+      THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+    }
+    SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
+  }
+}
+//=============================================================================
+char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
+{
+  return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
+{
+  if ( SMESH::toStdStr( GetPreCADOptionValue("sewing_tolerance")) != SMESH_Comment( tol ))
+  {
+    try
+    {
+      this->GetImpl()->SetSewingTolerance(tol);
+      SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
+
+    } catch (const std::invalid_argument& ex) {
+      THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+    } catch (SALOME_Exception& ex) {
+      THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+    }
+  }
+}
+//=============================================================================
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
+{
+  try
+  {
+    return this->GetImpl()->GetSewingTolerance();
+
+  } catch (const std::invalid_argument& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  } catch (SALOME_Exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+  return -1;
+}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
+{
+  if ( GetImpl()->GetTags() != howToTreat )
+  {
+    try {
+      this->GetImpl()->SetTags(howToTreat);
+    }
+    catch (const std::invalid_argument& ex) {
+      THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+    } catch (SALOME_Exception& ex) {
+      THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+    }
+  }
+  SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
+}
+//=============================================================================
+char* BLSURFPlugin_Hypothesis_i::GetTags()
+{
+  return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
+}
+
 //=============================================================================
 /*!
  *  BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
@@ -760,44 +1189,168 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
 //=============================================================================
 
 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
-    throw (SALOME::SALOME_Exception) {
+  throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  bool valueChanged = false;
   try {
-    valueChanged = (this->GetImpl()->GetOptionValue(optionName) != optionValue);
-    if (valueChanged)
-      this->GetImpl()->SetOptionValue(optionName, optionValue);
+    std::string name( optionName );
+    if ( !optionValue || !optionValue[0] )
+      UnsetOption( optionName );
+
+    // basic options (visible in Advanced table)
+
+    else if ( name == "enforce_cad_edge_sizes" )
+      SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "jacobian_rectification_respect_geometry" )
+      SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "max_number_of_points_per_patch" )
+      SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
+
+    else if ( name == "rectify_jacobian" )
+      SetJacobianRectification( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "respect_geometry" )
+      SetRespectGeometry( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "tiny_edge_avoid_surface_intersections" )
+      SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "closed_geometry" )
+      SetClosedGeometry( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "debug" )
+      SetDebug( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "discard_input_topology" )
+      SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "merge_edges" )
+      SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "periodic_tolerance" )
+      SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
+
+    else if ( name == "remove_duplicate_cad_faces" )
+      SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "required_entities" )
+      SetRequiredEntities( optionValue );
+
+    else if ( name == "sewing_tolerance" )
+      SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
+
+    else if ( name == "tags" )
+      SetTags( optionValue );
+
+    // other basic options with specific methods
+
+    else if ( name == "correct_surface_intersections" )
+      SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "optimise_tiny_edges" )
+      SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "surface_intersections_processing_max_cost" )
+      SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
+
+    else if ( name == "volume_gradation" )
+      SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
+
+    else if ( name == "tiny_edge_optimisation_length" )
+      SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
+
+    // advanced options (for backward compatibility)
+
+    else if ( name == "create_tag_on_collision" ||
+              name == "tiny_edge_respect_geometry" )
+      AddOption( optionName, optionValue );
+
+    else {
+      bool valueChanged;
+      valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
+                       this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
+      if ( valueChanged )
+      {
+        this->GetImpl()->SetOptionValue(optionName, optionValue);
+        SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
+      }
+    }
   } catch (const std::invalid_argument& ex) {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = ex.what();
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetOptionValue(name,value)";
-    ExDescription.lineNumber = 0;
-    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 );
   }
-  if (valueChanged)
-    SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
 }
 
 //=============================================================================
 
 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
-    throw (SALOME::SALOME_Exception) {
+  throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
   bool valueChanged = false;
   try {
-    valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
-    if (valueChanged)
-      this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
+    std::string name( optionName );
+    if ( !optionValue || !optionValue[0] )
+      UnsetOption( optionName );
+
+    else if ( name == "closed_geometry" )
+      SetClosedGeometry( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "debug" )
+      SetDebug( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "discard_input_topology" )
+      SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "merge_edges" )
+      SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "periodic_tolerance" )
+      SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
+
+    else if ( name == "remove_duplicate_cad_faces" )
+      SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "required_entities" )
+      SetRequiredEntities( optionValue );
+
+    else if ( name == "sewing_tolerance" )
+      SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
+
+    else if ( name == "tags" )
+      SetTags( optionValue );
+
+    // other basic options with specific methods
+
+    else if ( name == "correct_surface_intersections" )
+      SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "optimise_tiny_edges" )
+      SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "surface_intersections_processing_max_cost" )
+      SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
+
+    else if ( name == "volume_gradation" )
+      SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
+
+    else if ( name == "tiny_edge_optimisation_length" )
+      SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
+
+    // advanced options (for backward compatibility)
+
+    else if ( name == "create_tag_on_collision" ||
+              name == "tiny_edge_respect_geometry" )
+      AddOption( optionName, optionValue );
+
+    else {
+      valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
+      if (valueChanged)
+        this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
+    }
   } catch (const std::invalid_argument& ex) {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = ex.what();
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetPreCADOptionValue(name,value)";
-    ExDescription.lineNumber = 0;
-    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 );
   }
@@ -810,14 +1363,10 @@ void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, con
 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
   try {
-    return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
+    bool isDefault;
+    return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
   } catch (const std::invalid_argument& ex) {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = ex.what();
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetOptionValue(name)";
-    ExDescription.lineNumber = 0;
-    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 );
   }
@@ -829,14 +1378,10 @@ char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (S
 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
   try {
-    return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName).c_str());
+    bool isDefault;
+    return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
   } catch (const std::invalid_argument& ex) {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = ex.what();
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetPreCADOptionValue(name)";
-    ExDescription.lineNumber = 0;
-    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 );
   }
@@ -847,16 +1392,22 @@ char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) th
 
 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
   ASSERT(myBaseImpl);
-  this->GetImpl()->ClearOption(optionName);
-  SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
+  if ( !GetImpl()->GetOptionValue( optionName ).empty() )
+  {
+    this->GetImpl()->ClearOption(optionName);
+    SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
+  }
 }
 
 //=============================================================================
 
 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
   ASSERT(myBaseImpl);
-  this->GetImpl()->ClearPreCADOption(optionName);
-  SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
+  if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
+  {
+    this->GetImpl()->ClearPreCADOption(optionName);
+    SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
+  }
 }
 
 //=============================================================================
@@ -866,31 +1417,21 @@ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
 
   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
-  const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
-  result->length(opts.size()+custom_opts.size());
+  result->length(opts.size());
   int i=0;
 
+  bool isDefault;
   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
   for (; opIt != opts.end(); ++opIt, ++i) {
     string name_value_type = opIt->first;
     if (!opIt->second.empty()) {
       name_value_type += ":";
-      name_value_type += opIt->second;
-      name_value_type += ":0";
+      name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
+      name_value_type += isDefault ? ":0" : ":1";
     }
     result[i] = CORBA::string_dup(name_value_type.c_str());
   }
 
-  opIt = custom_opts.begin();
-  for (; opIt != custom_opts.end(); ++opIt,++i) {
-    string name_value_type = opIt->first;
-    if (!opIt->second.empty()) {
-      name_value_type += ":";
-      name_value_type += opIt->second;
-      name_value_type += ":1";
-    }
-    result[i] = CORBA::string_dup(name_value_type.c_str());
-  }
   return result._retn();
 }
 
@@ -901,28 +1442,40 @@ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
 
   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
-  const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomPreCADOptionValues();
-  result->length(opts.size()+custom_opts.size());
+  result->length(opts.size());
   int i=0;
 
+  bool isDefault;
   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
   for (; opIt != opts.end(); ++opIt, ++i) {
     string name_value_type = opIt->first;
     if (!opIt->second.empty()) {
       name_value_type += ":";
-      name_value_type += opIt->second;
-      name_value_type += ":0";
+      name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
+      name_value_type += isDefault ? ":0" : ":1";
     }
     result[i] = CORBA::string_dup(name_value_type.c_str());
   }
+  return result._retn();
+}
+
+//=============================================================================
+
+BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
+{
+  BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
 
-  opIt = custom_opts.begin();
-  for (; opIt != custom_opts.end(); ++opIt,++i) {
+  const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
+  result->length(custom_opts.size());
+  int i=0;
+
+  ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
+  for (; opIt != custom_opts.end(); ++opIt, ++i) {
     string name_value_type = opIt->first;
     if (!opIt->second.empty()) {
       name_value_type += ":";
       name_value_type += opIt->second;
-      name_value_type += ":1";
+      name_value_type += ":1"; // user defined
     }
     result[i] = CORBA::string_dup(name_value_type.c_str());
   }
@@ -940,7 +1493,6 @@ void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array
       continue;
     size_t colonPos = name_value_type.find(':');
     string name, value;
-    bool custom = false;
     if (colonPos == string::npos) // ':' not found
       name = name_value_type;
     else {
@@ -950,10 +1502,11 @@ void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array
         colonPos = value_type.find(':');
         value = value_type.substr(0, colonPos);
         if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
-          custom = atoi((value_type.substr(colonPos + 1)).c_str());
+          if ( value_type.substr(colonPos + 1) == "0" ) // is default
+            value.clear();
       }
     }
-    custom ? AddOption(name.c_str(), value.c_str()) : SetOptionValue(name.c_str(), value.c_str());
+    SetOptionValue(name.c_str(), value.c_str());
   }
 }
 
@@ -968,7 +1521,6 @@ void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string
       continue;
     size_t colonPos = name_value_type.find(':');
     string name, value;
-    bool custom = false;
     if (colonPos == string::npos) // ':' not found
       name = name_value_type;
     else {
@@ -978,11 +1530,72 @@ void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string
         colonPos = value_type.find(':');
         value = value_type.substr(0, colonPos);
         if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
-          custom = atoi((value_type.substr(colonPos + 1)).c_str());
+          if ( value_type.substr(colonPos + 1) == "0" ) // is default
+            value.clear();
       }
     }
-    custom ? AddPreCADOption(name.c_str(), value.c_str()) : SetPreCADOptionValue(name.c_str(), value.c_str());
+    SetPreCADOptionValue(name.c_str(), value.c_str());
+  }
+}
+
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
+{
+  SMESH::TPythonDump dump;
+
+  string optionsAndValues;
+  for ( CORBA::ULong i = 0; i < options.length(); ++i) {
+    string name_value_type = options[i].in();
+    if(name_value_type.empty())
+      continue;
+    size_t colonPos = name_value_type.find(':');
+    string name, value;
+    if (colonPos == string::npos) // ':' not found
+      name = name_value_type;
+    else {
+      name = name_value_type.substr(0, colonPos);
+      if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
+        string value_type = name_value_type.substr(colonPos + 1);
+        colonPos = value_type.find(':');
+        value = value_type.substr(0, colonPos);
+      }
+    }
+    AddOption(name.c_str(), value.c_str());
+
+    optionsAndValues += name + " " + value + " ";
+  }
+
+  if ( !optionsAndValues.empty() )
+    dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
+}
+
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
+  throw (SALOME::SALOME_Exception)
+{
+  if ( !optionsAndValues ) return;
+
+  SMESH::TPythonDump dump;
+
+  std::istringstream strm( optionsAndValues );
+  std::istream_iterator<std::string> sIt( strm ), sEnd;
+  while ( sIt != sEnd )
+  {
+    std::string option = *sIt;
+    if ( ++sIt != sEnd )
+    {
+      std::string value = *sIt;
+      ++sIt;
+      AddOption( option.c_str(), value.c_str() );
+    }
+    else
+    {
+      THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
+    }
   }
+  dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
 }
 
 //=============================================================================
index 1994391013ec6d2688e66402796e729a09205914..eeb20c385ed369fa27db97a250291cc6414968cd 100644 (file)
@@ -66,39 +66,58 @@ public:
   CORBA::Double GetMaxSize();
   CORBA::Boolean IsMaxSizeRel();
 
+  void SetUseGradation(CORBA::Boolean theValue);
+  CORBA::Boolean GetUseGradation();
   void SetGradation(CORBA::Double theValue);
   CORBA::Double GetGradation();
 
+  void SetUseVolumeGradation(CORBA::Boolean theValue);
+  CORBA::Boolean GetUseVolumeGradation();
+  void SetVolumeGradation(CORBA::Double theValue);
+  CORBA::Double GetVolumeGradation();
+
   void SetQuadAllowed(CORBA::Boolean theValue);
   CORBA::Boolean GetQuadAllowed();
 
   void SetAngleMesh(CORBA::Double theValue);
   CORBA::Double GetAngleMesh();
-  
+
   void SetChordalError(CORBA::Double distance);
   CORBA::Double GetChordalError();
-  
+
   void SetAnisotropic(CORBA::Boolean anisotropic);
   CORBA::Boolean GetAnisotropic();
-  
+
   void SetAnisotropicRatio(CORBA::Double ratio);
   CORBA::Double GetAnisotropicRatio();
-  
+
   void SetRemoveTinyEdges(CORBA::Boolean remove);
   CORBA::Boolean GetRemoveTinyEdges();
-  
+
   void SetTinyEdgeLength(CORBA::Double length);
   CORBA::Double GetTinyEdgeLength();
-  
+
+  void SetOptimiseTinyEdges(CORBA::Boolean toOptimise);
+  CORBA::Boolean GetOptimiseTinyEdges();
+
+  void SetTinyEdgeOptimisationLength(CORBA::Double length);
+  CORBA::Double GetTinyEdgeOptimisationLength();
+
+  void SetCorrectSurfaceIntersection(CORBA::Boolean toOptimise);
+  CORBA::Boolean GetCorrectSurfaceIntersection();
+
+  void SetCorrectSurfaceIntersectionMaxCost(CORBA::Double maxCost);
+  CORBA::Double GetCorrectSurfaceIntersectionMaxCost();
+
   void SetBadElementRemoval(CORBA::Boolean remove);
   CORBA::Boolean GetBadElementRemoval();
-  
+
   void SetBadElementAspectRatio(CORBA::Double ratio);
   CORBA::Double GetBadElementAspectRatio();
-  
+
   void SetOptimizeMesh(CORBA::Boolean optimize);
   CORBA::Boolean GetOptimizeMesh();
-  
+
   void SetQuadraticMesh(CORBA::Boolean quadratic);
   CORBA::Boolean GetQuadraticMesh();
 
@@ -108,6 +127,42 @@ public:
   void SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception);
   CORBA::Short GetVerbosity();
 
+  void SetEnforceCadEdgesSize( CORBA::Boolean toEnforce );
+  CORBA::Boolean GetEnforceCadEdgesSize();
+
+  void SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification );
+  CORBA::Boolean GetJacobianRectificationRespectGeometry();
+
+  void SetJacobianRectification( CORBA::Boolean allowRectification );
+  CORBA::Boolean GetJacobianRectification();
+
+  void SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception);
+  CORBA::Long GetMaxNumberOfPointsPerPatch();
+
+  void SetRespectGeometry( CORBA::Boolean toRespect );
+  CORBA::Boolean GetRespectGeometry();
+
+  void SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection );
+  CORBA::Boolean GetTinyEdgesAvoidSurfaceIntersections();
+
+  void SetClosedGeometry( CORBA::Boolean isClosed );
+  CORBA::Boolean GetClosedGeometry();
+
+  void SetDebug( CORBA::Boolean isDebug );
+  bool GetDebug();
+
+  void SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception);
+  double GetPeriodicTolerance() throw (SALOME::SALOME_Exception);
+
+  void SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception);
+  char* GetRequiredEntities();
+
+  void SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception);
+  CORBA::Double GetSewingTolerance() throw (SALOME::SALOME_Exception);
+
+  void SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception);
+  char* GetTags();
+
   void SetPreCADMergeEdges(CORBA::Boolean theValue);
   CORBA::Boolean GetPreCADMergeEdges();
 
@@ -133,9 +188,12 @@ public:
 
   BLSURFPlugin::string_array* GetOptionValues();
   BLSURFPlugin::string_array* GetPreCADOptionValues();
+  BLSURFPlugin::string_array* GetAdvancedOptionValues();
 
   void SetOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
   void SetPreCADOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
+  void SetAdvancedOptionValues(const BLSURFPlugin::string_array& options);
+  void SetAdvancedOption(const char* optionsAndValues) throw (SALOME::SALOME_Exception);
 
   void AddOption(const char* optionName, const char* optionValue);
   void AddPreCADOption(const char* optionName, const char* optionValue);
index 4f68841bf87a200775473774b2e9654979dce4cd..8bd1296b22004d62d9bea7758fb9e918f7294fe4 100644 (file)
 
 #include <iostream>
 
+namespace
+{
+  enum { EDITABLE_ROLE = Qt::UserRole + 1, PARAM_NAME,
+         NAME_COL = 0, VALUE_COL };
+
+  class ItemDelegate: public QItemDelegate {
+  public:
+    ItemDelegate(QObject* parent=0): QItemDelegate(parent) {}
+    QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &o, const QModelIndex &index) const
+    {
+      bool editable = index.data( EDITABLE_ROLE ).toInt();
+      return editable ? QItemDelegate::createEditor( parent, o, index ) : 0;
+    }
+  };
+}
 
 //////////////////////////////////////////
 // BLSURFPluginGUI_AdvWidget
 //////////////////////////////////////////
 
 BLSURFPluginGUI_AdvWidget::BLSURFPluginGUI_AdvWidget( QWidget* parent, Qt::WindowFlags f )
-: QWidget( parent, f )
+  : QWidget( parent, f )
 {
   setupUi( this );
-  myOptionTable->horizontalHeader()->hideSection( OPTION_ID_COLUMN );
+  myOptionTable->topLevelItem( 2 )->setHidden( true ); // hide CUSTOM options
+  myOptionTable->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
+  myOptionTable->setItemDelegate( new ItemDelegate( myOptionTable ) );
+
+  connect( myOptionTable, SIGNAL( itemChanged(QTreeWidgetItem *, int)), SLOT( itemChanged(QTreeWidgetItem *, int )));
 }
 
 BLSURFPluginGUI_AdvWidget::~BLSURFPluginGUI_AdvWidget()
 {
 }
 
-void BLSURFPluginGUI_AdvWidget::onChooseGMFFile() {
+void BLSURFPluginGUI_AdvWidget::onChooseGMFFile()
+{
   QString fileName = QFileDialog::getSaveFileName(0, tr("BLSURF_GMF_FILE_DIALOG"), myGMFFileName->text(), tr("BLSURF_GMF_FILE_FORMAT"));
   std::cout << "fileName: " << fileName.toStdString() << std::endl;
   if (!fileName.endsWith(".mesh") && !fileName.endsWith(".meshb"))
@@ -53,4 +73,72 @@ void BLSURFPluginGUI_AdvWidget::onChooseGMFFile() {
   myGMFFileName->setText(fileName);
 }
 
+void BLSURFPluginGUI_AdvWidget::AddOption( int iTable, const char* option )
+{
+  if ( iTable < 0 || iTable > 2 ) return;
+
+  QTreeWidgetItem * table = myOptionTable->topLevelItem( iTable );
+  table->setExpanded( true );
+
+  QTreeWidgetItem * row = new QTreeWidgetItem( table );
+  row->setData( NAME_COL, EDITABLE_ROLE, int( iTable == 2 && !option ));
+  row->setFlags( row->flags() | Qt::ItemIsEditable );
+
+  QString name, value;
+  bool isDefault = false;
+  if ( option )
+  {
+    QStringList name_value_type = QString(option).split( ":", QString::KeepEmptyParts );
+    if ( name_value_type.size() > 0 )
+      name = name_value_type[0];
+    if ( name_value_type.size() > 1 )
+      value = name_value_type[1];
+    if ( name_value_type.size() > 2 )
+      isDefault = !name_value_type[2].toInt();
+  }
+  row->setText( 0, tr( name.toLatin1().constData() ));
+  row->setText( 1, tr( value.toLatin1().constData() ));
+  row->setCheckState( 0, isDefault ? Qt::Unchecked : Qt::Checked);
+  row->setData( NAME_COL, PARAM_NAME, name );
+
+  if ( iTable == 2 )
+  {
+    table->setHidden( false );
+    if ( !option )
+    {
+      myOptionTable->scrollToItem( row );
+      myOptionTable->editItem( row, NAME_COL );
+    }
+  }
+}
 
+void BLSURFPluginGUI_AdvWidget::GetOptionAndValue( QTreeWidgetItem * tblRow,
+                                                   QString&          option,
+                                                   QString&          value,
+                                                   bool&             isDefault)
+{
+  option    = tblRow->data( NAME_COL, PARAM_NAME ).toString();
+  value     = tblRow->text( VALUE_COL );
+  isDefault = ! tblRow->checkState( NAME_COL );
+}
+
+
+void BLSURFPluginGUI_AdvWidget::itemChanged(QTreeWidgetItem * tblRow, int column)
+{
+  if ( tblRow )
+  {
+    myOptionTable->blockSignals( true );
+
+    tblRow->setData( VALUE_COL, EDITABLE_ROLE, int( tblRow->checkState( NAME_COL )));
+
+    int c = tblRow->checkState( NAME_COL ) ? 0 : 150;
+    tblRow->setForeground( VALUE_COL, QBrush( QColor( c, c, c )));
+
+    if ( column == NAME_COL && tblRow->data( NAME_COL, EDITABLE_ROLE ).toInt() ) // custom table
+    {
+      tblRow->setData( NAME_COL, PARAM_NAME, tblRow->text( NAME_COL ));
+    }
+
+    myOptionTable->blockSignals( false );
+  }
+}
index c83d77d19b40a4474aa901a0abc0feb267313b90..c2f05dfc7a3c2c254b63de496563d92223ee89fd 100644 (file)
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>653</width>
-    <height>226</height>
+    <width>563</width>
+    <height>293</height>
    </rect>
   </property>
-  <layout class="QGridLayout" name="gridLayout_4">
-   <item row="0" column="0">
-    <widget class="QSplitter" name="splitter">
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0" colspan="3">
+    <widget class="QTreeWidget" name="myOptionTable">
+     <property name="editTriggers">
+      <set>QAbstractItemView::DoubleClicked</set>
+     </property>
+     <column>
+      <property name="text">
+       <string>OPTION_NAME_COLUMN</string>
+      </property>
+      <property name="font">
+       <font>
+        <weight>50</weight>
+        <bold>false</bold>
+       </font>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>OPTION_VALUE_COLUMN</string>
+      </property>
+      <property name="font">
+       <font>
+        <weight>50</weight>
+        <bold>false</bold>
+       </font>
+      </property>
+     </column>
+     <item>
+      <property name="text">
+       <string>BLSURF_MESHING_OPTIONS</string>
+      </property>
+      <property name="font">
+       <font>
+        <weight>75</weight>
+        <bold>true</bold>
+       </font>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>BLSURF_PRECAD_OPTIONS</string>
+      </property>
+      <property name="font">
+       <font>
+        <weight>75</weight>
+        <bold>true</bold>
+       </font>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>BLSURF_CUSTOM_OPTIONS</string>
+      </property>
+      <property name="font">
+       <font>
+        <weight>75</weight>
+        <bold>true</bold>
+       </font>
+      </property>
+     </item>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QPushButton" name="addBtn">
+     <property name="text">
+      <string>BLSURF_ADD_OPTION</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QLabel" name="label_2">
+     <property name="text">
+      <string>BLSURF_VERBOSITY</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QSpinBox" name="myVerbosity">
+     <property name="maximum">
+      <number>10</number>
+     </property>
+     <property name="singleStep">
+      <number>5</number>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="2">
+    <spacer name="horizontalSpacer">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
-     <widget class="QWidget" name="layoutWidget">
-      <layout class="QGridLayout" name="gridLayout_3">
-       <item row="0" column="0" colspan="2">
-        <widget class="QTableWidget" name="myOptionTable">
-         <property name="alternatingRowColors">
-          <bool>true</bool>
-         </property>
-         <property name="sortingEnabled">
-          <bool>true</bool>
-         </property>
-         <attribute name="horizontalHeaderStretchLastSection">
-          <bool>true</bool>
-         </attribute>
-         <attribute name="verticalHeaderVisible">
-          <bool>false</bool>
-         </attribute>
-         <column>
-          <property name="text">
-           <string>OPTION_ID_COLUMN</string>
-          </property>
-         </column>
-         <column>
-          <property name="text">
-           <string>OPTION_TYPE_COLUMN</string>
-          </property>
-         </column>
-         <column>
-          <property name="text">
-           <string>OPTION_NAME_COLUMN</string>
-          </property>
-         </column>
-         <column>
-          <property name="text">
-           <string>OPTION_VALUE_COLUMN</string>
-          </property>
-         </column>
-        </widget>
-       </item>
-       <item row="1" column="0">
-        <widget class="QPushButton" name="addBtn">
-         <property name="text">
-          <string>BLSURF_ADD_OPTION</string>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="1">
-        <widget class="QPushButton" name="rmBtn">
-         <property name="text">
-          <string>BLSURF_REMOVE_OPTION</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="layoutWidget">
-      <layout class="QGridLayout" name="gridLayout_2">
-       <property name="topMargin">
-        <number>0</number>
-       </property>
-       <item row="1" column="0" colspan="3">
-        <widget class="QGroupBox" name="myPreCADGroupBox">
-         <property name="title">
-          <string>BLSURF_PRECAD_GROUP</string>
-         </property>
-         <property name="checkable">
-          <bool>false</bool>
-         </property>
-         <property name="checked">
-          <bool>false</bool>
-         </property>
-         <layout class="QGridLayout" name="gridLayout">
-          <item row="0" column="0" colspan="2">
-           <widget class="QCheckBox" name="myPreCADMergeEdges">
-            <property name="text">
-             <string>BLSURF_PRECAD_MERGE_EDGES</string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item row="1" column="0" colspan="2">
-           <widget class="QCheckBox" name="myPreCADRemoveTinyUVEdges">
-            <property name="text">
-             <string>BLSURF_PRECAD_REMOVE_TINY_UV_EDGES</string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item row="2" column="0">
-           <widget class="QCheckBox" name="myPreCADProcess3DTopology">
-            <property name="text">
-             <string>BLSURF_PRECAD_PROCESS_3D_TOPOLOGY</string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item row="3" column="0" colspan="2">
-           <widget class="QCheckBox" name="myPreCADDiscardInput">
-            <property name="text">
-             <string>BLSURF_PRECAD_DISCARD_INPUT</string>
-            </property>
-           </widget>
-          </item>
-          <item row="4" column="0" colspan="2">
-           <widget class="QCheckBox" name="myPreCADRemoveDuplicateCADFaces">
-            <property name="text">
-             <string>BLSURF_PRECAD_REMOVE_DUPLICATE_CAD_FACES</string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </widget>
-       </item>
-       <item row="3" column="0">
-        <widget class="QPushButton" name="chooseGMFBtn">
-         <property name="text">
-          <string>BLSURF_GMF_FILE</string>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="1">
-        <widget class="QLineEdit" name="myGMFFileName"/>
-       </item>
-       <item row="4" column="0" colspan="3">
-        <spacer name="verticalSpacer">
-         <property name="orientation">
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>20</width>
-           <height>53</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item row="2" column="0">
-        <widget class="QLabel" name="label_2">
-         <property name="text">
-          <string>BLSURF_VERBOSITY</string>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="1">
-        <widget class="QSpinBox" name="myVerbosity">
-         <property name="maximum">
-          <number>10</number>
-         </property>
-         <property name="singleStep">
-          <number>5</number>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>362</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="3" column="0">
+    <widget class="QPushButton" name="chooseGMFBtn">
+     <property name="text">
+      <string>BLSURF_GMF_FILE</string>
+     </property>
     </widget>
    </item>
+   <item row="3" column="1" colspan="2">
+    <widget class="QLineEdit" name="myGMFFileName"/>
+   </item>
   </layout>
  </widget>
  <tabstops>
-  <tabstop>myOptionTable</tabstop>
   <tabstop>addBtn</tabstop>
-  <tabstop>rmBtn</tabstop>
-  <tabstop>myPreCADGroupBox</tabstop>
-  <tabstop>myPreCADMergeEdges</tabstop>
-  <tabstop>myPreCADRemoveTinyUVEdges</tabstop>
-  <tabstop>myPreCADRemoveDuplicateCADFaces</tabstop>
-  <tabstop>myPreCADProcess3DTopology</tabstop>
-  <tabstop>myPreCADDiscardInput</tabstop>
   <tabstop>myVerbosity</tabstop>
   <tabstop>chooseGMFBtn</tabstop>
   <tabstop>myGMFFileName</tabstop>
index 878ee34da8514eda4972aeeefe1d53e1dced7e25..7c244265c14e84e25370bf2e74fbf17697f13a65 100644 (file)
@@ -90,8 +90,14 @@ public:
   BLSURFPluginGUI_AdvWidget( QWidget* = 0, Qt::WindowFlags = 0 );
   ~BLSURFPluginGUI_AdvWidget();
 
+  void AddOption( int iTable, const char* name_value_type );
+  void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt );
+
 public slots:
+
   void onChooseGMFFile();
+  void itemChanged(QTreeWidgetItem * tblRow, int column);
+
 };
 
-#endif
\ No newline at end of file
+#endif
index 549ab621f5a8ce12df53832f26c68b2d6a25095b..aecdbe569a53afa9a0c5b5c11f736654bcfaf525 100644 (file)
@@ -93,7 +93,11 @@ enum {
   SMP_ENTRY_COLUMN,
 //  SMP_DIST_COLUMN,
   SMP_NB_COLUMNS,
-// Enforced vertices array columns
+
+  // Adv tables
+  TBL_MESHING = 0, TBL_PRECAD, TBL_CUSTOM,
+
+  // Enforced vertices array columns
   ENF_VER_NAME_COLUMN = 0,
   ENF_VER_FACE_ENTRY_COLUMN,
   ENF_VER_X_COLUMN,
@@ -525,24 +529,43 @@ bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const
     myAdvWidget->myOptionTable->setFocus();
     QApplication::instance()->processEvents();
 
-    int row = 0, nbRows = myAdvWidget->myOptionTable->rowCount();
-    for ( ; row < nbRows; ++row )
+    QString name, value;
+    bool isDefault;
+    int iTbl = 0, nbTbl = myAdvWidget->myOptionTable->topLevelItemCount();
+    for ( ; iTbl < nbTbl; ++iTbl )
     {
-      QString name  = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text();
-      QString value = myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->text().trimmed();
-      bool custom = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->data(Qt::UserRole).toBool();
-      if ( !value.isEmpty() && !custom ) {
+      QTreeWidgetItem* table = myAdvWidget->myOptionTable->topLevelItem( iTbl );
+      int nbRows = table->childCount();
+      for ( int iRow = 0; iRow < nbRows; ++iRow )
+      {
+        QTreeWidgetItem* row = table->child( iRow );
+        myAdvWidget->GetOptionAndValue( row, name, value, isDefault );
+
+        if ( name.simplified().isEmpty() )
+          continue; // invalid custom option
+
+        if ( isDefault ) // not selected option
+          value.clear();
+
         try {
-          QString optionType = myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().trimmed();
-          if (optionType == "PRECAD")
-            h->SetPreCADOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
-          else if (optionType == "BLSURF")
+          switch ( iTbl )
+          {
+          case TBL_MESHING:
             h->SetOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
+            break;
+          case TBL_PRECAD:
+            h->SetPreCADOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
+            break;
+          case TBL_CUSTOM:
+            h->AddOption( name.toLatin1().constData(), value.toLatin1().constData() );
+            break;
+          }
         }
         catch ( const SALOME::SALOME_Exception& ex )
         {
           msg = ex.details.text.in();
           ok = false;
+          break;
         }
       }
     }
@@ -551,6 +574,7 @@ bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const
   {
     h->SetOptionValues( myOptions ); // restore values
     h->SetPreCADOptionValues( myPreCADOptions ); // restore values
+    return ok;
   }
 
   // SizeMap and attractors
@@ -668,14 +692,14 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   }
   aStdLayout->addWidget( myStdWidget,                                   row++, 0, 1, 4 );
   
-  int maxrow = row;
+  //int maxrow = row;
   row = 0;
   if( isCreation() )
     row = 1;
 //   row = max(row,maxrow)+1;
   aStdLayout->setRowStretch(row,1);
   aStdLayout->setColumnStretch(1,1);
-  maxrow = row;
+  //maxrow = row;
 
   
   // advanced parameters
@@ -684,8 +708,8 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   anAdvLayout->setSpacing( 6 );
   anAdvLayout->setMargin( 11 );  
   myAdvWidget = new BLSURFPluginGUI_AdvWidget(myAdvGroup);
-  myAdvWidget->addBtn->setMenu( new QMenu() );
-  anAdvLayout->addWidget( myAdvWidget);
+  //myAdvWidget->addBtn->setMenu( new QMenu() );
+  anAdvLayout->addWidget( myAdvWidget );
 
 
   // Size Maps parameters
@@ -1125,11 +1149,7 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
 
   myTabWidget->setCurrentIndex( STD_TAB );
 
-  connect( myAdvWidget->addBtn->menu(), SIGNAL( aboutToShow() ),           this, SLOT( onAddOption() ) );
-  connect( myAdvWidget->addBtn->menu(), SIGNAL( triggered( QAction* ) ),   this, SLOT( onOptionChosenInPopup( QAction* ) ) );
-  connect( myAdvWidget->rmBtn,          SIGNAL( clicked()),                this, SLOT( onDeleteOption() ) );
-  connect( myAdvWidget->myOptionTable,  SIGNAL( cellPressed( int, int ) ), this, SLOT( onEditOption( int, int ) ) );
-  connect( myAdvWidget->myOptionTable,  SIGNAL( cellChanged( int, int ) ), this, SLOT( onChangeOptionName( int, int ) ) );
+  connect( myAdvWidget->addBtn, SIGNAL( clicked() ),           this, SLOT( onAddOption() ) );
   connect( myStdWidget->myAllowQuadrangles, SIGNAL( stateChanged( int ) ), this, SLOT( onStateChange() ));
 
   // Size Maps
@@ -1672,7 +1692,7 @@ void BLSURFPluginGUI_HypothesisCreator::onPeriodicityByVerticesChecked(bool chec
 {
   if (! checked)
     {
-      for (size_t k=2; k<myPeriodicitySelectionWidgets.size(); k++)
+      for (int k=2; k<myPeriodicitySelectionWidgets.size(); k++)
         {
           StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( myPeriodicitySelectionWidgets[k] );
           w1->deactivateSelection();
@@ -1744,7 +1764,7 @@ void BLSURFPluginGUI_HypothesisCreator::onPeriodicityContentModified()
   BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
 
   ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
-  size_t k=0;
+  int k=0;
   // find wich selection widget is activated
   for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++, k++)
     {
@@ -1798,10 +1818,16 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
   else
     myStdWidget->myMaxSize->SetValue( data.myMaxSize );
   myStdWidget->myMaxSizeRel->setChecked( data.myMaxSizeRel );
-  if (data.myGradation <= 0)
+  myStdWidget->myUseGradation->setChecked( data.myUseGradation );
+  if (data.myGradation <= 0 || !data.myUseGradation )
     myStdWidget->myGradation->setText("");
   else
     myStdWidget->myGradation->SetValue( data.myGradation );
+  myStdWidget->myUseVolumeGradation->setChecked( data.myUseVolumeGradation );
+  if (data.myVolumeGradation <= 0 || !data.myUseVolumeGradation )
+    myStdWidget->myVolumeGradation->setText("");
+  else
+    myStdWidget->myVolumeGradation->SetValue( data.myVolumeGradation );
   myStdWidget->myAllowQuadrangles->setChecked( data.myAllowQuadrangles );
   
   if (data.myAngleMesh < 0)
@@ -1822,6 +1848,16 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
     myStdWidget->myTinyEdgeLength->setText("");
   else
     myStdWidget->myTinyEdgeLength->SetValue( data.myTinyEdgeLength );
+  myStdWidget->myOptimiseTinyEdges->setChecked( data.myOptimiseTinyEdges );
+  if (data.myTinyEdgeOptimisLength <= 0)
+    myStdWidget->myTinyEdgeOptimisLength->setText("");
+  else
+    myStdWidget->myTinyEdgeOptimisLength->SetValue( data.myTinyEdgeOptimisLength );
+  myStdWidget->myCorrectSurfaceIntersection->setChecked( data.myCorrectSurfaceIntersection );
+  if (data.myCorrectSurfaceIntersectionMaxCost <= 0)
+    myStdWidget->myCorrectSurfaceIntersectionMaxCost->setText("");
+  else
+    myStdWidget->myCorrectSurfaceIntersectionMaxCost->SetValue( data.myCorrectSurfaceIntersectionMaxCost );
   myStdWidget->myForceBadElementRemoval->setChecked( data.myForceBadElementRemoval );
   if (data.myBadElementAspectRatio <= 0)
     myStdWidget->myBadElementAspectRatio->setText("");
@@ -1833,72 +1869,18 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
   myStdWidget->resizeWidgets();  
   
   myAdvWidget->myVerbosity->setValue( data.myVerbosity );
-  myAdvWidget->myPreCADGroupBox->setChecked(data.myTopology == PreCAD);
-  myAdvWidget->myPreCADMergeEdges->setChecked( data.myPreCADMergeEdges );
-  myAdvWidget->myPreCADRemoveTinyUVEdges->setChecked( data.myPreCADRemoveTinyUVEdges );
-  myAdvWidget->myPreCADRemoveDuplicateCADFaces->setChecked( data.myPreCADRemoveDuplicateCADFaces );
-  myAdvWidget->myPreCADProcess3DTopology->setChecked( data.myPreCADProcess3DTopology );
-  myAdvWidget->myPreCADDiscardInput->setChecked( data.myPreCADDiscardInput );
 
   if ( myOptions.operator->() ) {
-//     MESSAGE("retrieveParams():myOptions->length() = " << myOptions->length());
-    for ( int i = 0, nb = myOptions->length(); i < nb; ++i ) {
-      QString option = that->myOptions[i].in();
-      QStringList name_value_type = option.split( ":", QString::KeepEmptyParts );
-      bool custom = ( name_value_type.size() == 3 ) ? name_value_type[2].toInt() : false;
-      if ( name_value_type.count() > 1 ) {
-        QString idStr = QString("%1").arg( i );
-        int row = myAdvWidget->myOptionTable->rowCount();
-        myAdvWidget->myOptionTable->setRowCount( row+1 );
-        myAdvWidget->myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) );
-        myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 );
-        myAdvWidget->myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( "BLSURF" ) );
-        myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 );
-        myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value_type[0] ) );
-        if ( custom ) {
-          myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( Qt::ItemIsSelectable |
-                                                                                 Qt::ItemIsEditable   |
-                                                                                 Qt::ItemIsEnabled );
-          myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setData( Qt::UserRole, QVariant(true) );
-        }
-        else
-          myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
-        myAdvWidget->myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value_type[1] ) );
-        myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable |
-                                                                                Qt::ItemIsEditable   |
-                                                                                Qt::ItemIsEnabled );
-      }
-    }
+    for ( int i = 0, nb = myOptions->length(); i < nb; ++i )
+      myAdvWidget->AddOption( TBL_MESHING, that->myOptions[i].in() );
   }
   if ( myPreCADOptions.operator->() ) {
-//     MESSAGE("retrieveParams():myPreCADOptions->length() = " << myPreCADOptions->length());
-    for ( int i = 0, nb = myPreCADOptions->length(); i < nb; ++i ) {
-      QString option = that->myPreCADOptions[i].in();
-      QStringList name_value_type = option.split( ":", QString::KeepEmptyParts );
-      bool custom = ( name_value_type.size() == 3 ) ? name_value_type[2].toInt() : false;
-      if ( name_value_type.count() > 1 ) {
-        QString idStr = QString("%1").arg( i );
-        int row = myAdvWidget->myOptionTable->rowCount();
-        myAdvWidget->myOptionTable->setRowCount( row+1 );
-        myAdvWidget->myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) );
-        myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 );
-        myAdvWidget->myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( "PRECAD" ) );
-        myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 );
-        myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value_type[0] ) );
-        if ( custom ) {
-          myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( Qt::ItemIsSelectable |
-                                                                                 Qt::ItemIsEditable   |
-                                                                                 Qt::ItemIsEnabled );
-          myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setData( Qt::UserRole, QVariant(true) );
-        }
-        else
-          myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
-        myAdvWidget->myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value_type[1] ) );
-        myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable |
-                                                                                Qt::ItemIsEditable   |
-                                                                                Qt::ItemIsEnabled );
-      }
-    }
+    for ( int i = 0, nb = myPreCADOptions->length(); i < nb; ++i )
+      myAdvWidget->AddOption( TBL_PRECAD, that->myPreCADOptions[i].in() );
+  }
+  if ( myCustomOptions.operator->() ) {
+    for ( int i = 0, nb = myCustomOptions->length(); i < nb; ++i )
+      myAdvWidget->AddOption( TBL_CUSTOM, that->myCustomOptions[i].in() );
   }
   myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
   myAdvWidget->myGMFFileName->setText(QString(data.myGMFFileName.c_str()));
@@ -2047,7 +2029,10 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData
   h_data.myMinSizeRel             = h->IsMinSizeRel();
   h_data.myMaxSize                = maxSize > 0 ? maxSize : -1.0;
   h_data.myMaxSizeRel             = h->IsMaxSizeRel();
+  h_data.myUseGradation           = h->GetUseGradation();
   h_data.myGradation              = h->GetGradation();
+  h_data.myUseVolumeGradation     = h->GetUseVolumeGradation();
+  h_data.myVolumeGradation        = h->GetVolumeGradation();
   h_data.myAllowQuadrangles       = h->GetQuadAllowed();
   double angle                    = h->GetAngleMesh();
   h_data.myAngleMesh              = angle > 0 ? angle : -1.0;
@@ -2059,24 +2044,29 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData
   h_data.myRemoveTinyEdges        = h->GetRemoveTinyEdges();
   double myTinyEdgeLength         = h->GetTinyEdgeLength();
   h_data.myTinyEdgeLength         = myTinyEdgeLength > 0 ? myTinyEdgeLength : -1.0;
+  h_data.myOptimiseTinyEdges      = h->GetOptimiseTinyEdges();
+  double myTinyEdgeOptimisLength  = h->GetTinyEdgeOptimisationLength();
+  h_data.myTinyEdgeOptimisLength  = myTinyEdgeOptimisLength > 0 ? myTinyEdgeOptimisLength : -1.0;
+  h_data.myCorrectSurfaceIntersection = h->GetCorrectSurfaceIntersection();
+  double corrSurfaceIntersMaxCost = h->GetCorrectSurfaceIntersectionMaxCost();
+  h_data.myCorrectSurfaceIntersectionMaxCost  = corrSurfaceIntersMaxCost > 0 ? corrSurfaceIntersMaxCost : -1.0;
   h_data.myForceBadElementRemoval = h->GetBadElementRemoval();
   double myBadElementAspectRatio  = h->GetBadElementAspectRatio();
   h_data.myBadElementAspectRatio  = myBadElementAspectRatio > 0 ? myBadElementAspectRatio : -1.0;
   h_data.myOptimizeMesh           = h->GetOptimizeMesh();
   h_data.myQuadraticMesh          = h->GetQuadraticMesh();
   h_data.myVerbosity              = h->GetVerbosity();
-  h_data.myTopology               = (int) h->GetTopology();
+  //h_data.myTopology               = (int) h->GetTopology();
   h_data.myPreCADMergeEdges       = h->GetPreCADMergeEdges();
-  h_data.myPreCADRemoveTinyUVEdges       = h->GetPreCADRemoveTinyUVEdges();
-  h_data.myPreCADRemoveDuplicateCADFaces = h->GetPreCADRemoveDuplicateCADFaces();
   h_data.myPreCADProcess3DTopology  = h->GetPreCADProcess3DTopology();
   h_data.myPreCADDiscardInput     = h->GetPreCADDiscardInput();
 
 
   BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
-  that->myOptions = h->GetOptionValues();
+  that->myOptions       = h->GetOptionValues();
   that->myPreCADOptions = h->GetPreCADOptionValues();
-  
+  that->myCustomOptions = h->GetAdvancedOptionValues();
+
   h_data.myGMFFileName = h->GetGMFFile();
 //   h_data.myGMFFileMode = h->GetGMFFileMode();
 
@@ -2133,7 +2123,7 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData
   BLSURFPlugin::string_array_var allMyAttractors = h->GetAttractorEntries();
 //   MESSAGE("myAttractors->length() = " << allMyAttractors->length());
 
-  for ( int i = 0;i<allMyAttractors->length(); ++i ) {
+  for ( CORBA::ULong i = 0;i<allMyAttractors->length(); ++i ) {
     QString myAttractors =  allMyAttractors[i].in();
     QStringList myAttractorList = myAttractors.split( "|", QString::KeepEmptyParts );
     if ( myAttractorList.count() > 1 ) {
@@ -2147,7 +2137,7 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData
   // attractor new version
   MESSAGE("readParamsFromHypo, Attractors")
   BLSURFPlugin::TAttParamsMap_var allMyAttractorParams = h->GetAttractorParams();
-  for ( int i = 0;i<allMyAttractorParams->length(); ++i ) {
+  for ( CORBA::ULong i = 0;i<allMyAttractorParams->length(); ++i ) {
     BLSURFPlugin::TAttractorParams myAttractorParams =  allMyAttractorParams[i];
     QString faceEntry = myAttractorParams.faceEntry.in();
     QString attEntry  = myAttractorParams.attEntry.in();
@@ -2170,7 +2160,7 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData
   BLSURFPlugin::TFaceEntryEnfVertexListMap_var faceEntryEnfVertexListMap = h->GetAllEnforcedVerticesByFace();
   MESSAGE("faceEntryEnfVertexListMap->length() = " << faceEntryEnfVertexListMap->length());
 
-  for ( int i = 0;i<faceEntryEnfVertexListMap->length(); ++i ) {
+  for ( CORBA::ULong i = 0;i<faceEntryEnfVertexListMap->length(); ++i ) {
     std::string entry =  faceEntryEnfVertexListMap[i].faceEntry.in();
 //     BLSURFPlugin::TEnfVertexList vertexList = faceEntryEnfVertexListMap[i].enfVertexList.in();
     BLSURFPlugin::TEnfVertexList vertexList = faceEntryEnfVertexListMap[i].enfVertexList;
@@ -2178,13 +2168,13 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData
 
 //     TEnfVertexList& enfVertexList = h_data.faceEntryEnfVertexListMap[entry];
 
-    for (int j=0 ; j<vertexList.length(); ++j) {
+    for (CORBA::ULong j=0 ; j<vertexList.length(); ++j) {
       TEnfVertex *enfVertex = new TEnfVertex();
       
       enfVertex->name = CORBA::string_dup(vertexList[j].name.in());
       enfVertex->geomEntry = CORBA::string_dup(vertexList[j].geomEntry.in());
       enfVertex->grpName = CORBA::string_dup(vertexList[j].grpName.in());
-      for (int k=0 ; k< vertexList[j].coords.length();k++)
+      for (CORBA::ULong k=0 ; k< vertexList[j].coords.length();k++)
         enfVertex->coords.push_back(vertexList[j].coords[k]);
 
       h_data.faceEntryEnfVertexListMap[entry].insert(enfVertex);
@@ -2297,8 +2287,15 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi
       else
         h->SetMaxSize( h_data.myMaxSize <= 0 ? -1 : h_data.myMaxSize );
     }
+    if ( h->GetUseGradation() !=  h_data.myUseGradation )
+      h->SetUseGradation( h_data.myUseGradation );
     if ( h->GetGradation() !=  h_data.myGradation )
       h->SetGradation( h_data.myGradation <= 0 ? -1 : h_data.myGradation );
+    if ( h->GetUseVolumeGradation() !=  h_data.myUseVolumeGradation )
+      h->SetUseVolumeGradation( h_data.myUseVolumeGradation );
+    if ( h->GetVolumeGradation() !=  h_data.myVolumeGradation )
+      h->SetVolumeGradation( h_data.myVolumeGradation <= 0 ? -1 : h_data.myVolumeGradation );
+
     if ( h->GetQuadAllowed() != h_data.myAllowQuadrangles )
       h->SetQuadAllowed( h_data.myAllowQuadrangles );
     
@@ -2319,6 +2316,15 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi
     if ( h_data.myRemoveTinyEdges && ( h->GetTinyEdgeLength() != h_data.myTinyEdgeLength ) )
       h->SetTinyEdgeLength( h_data.myTinyEdgeLength <= 0 ? -1 :h_data.myTinyEdgeLength );
     
+    if ( h->GetOptimiseTinyEdges() != h_data.myOptimiseTinyEdges )
+      h->SetOptimiseTinyEdges( h_data.myOptimiseTinyEdges );
+    if ( h_data.myOptimiseTinyEdges && ( h->GetTinyEdgeOptimisationLength() != h_data.myTinyEdgeOptimisLength ) )
+      h->SetTinyEdgeOptimisationLength( h_data.myTinyEdgeOptimisLength <= 0 ? -1 :h_data.myTinyEdgeOptimisLength );
+    if ( h->GetCorrectSurfaceIntersection() != h_data.myCorrectSurfaceIntersection )
+      h->SetCorrectSurfaceIntersection( h_data.myCorrectSurfaceIntersection );
+    if ( h_data.myCorrectSurfaceIntersection && ( h->GetCorrectSurfaceIntersectionMaxCost() != h_data.myCorrectSurfaceIntersectionMaxCost ) )
+      h->SetCorrectSurfaceIntersectionMaxCost( h_data.myCorrectSurfaceIntersectionMaxCost <= 0 ? -1 :h_data.myCorrectSurfaceIntersectionMaxCost );
+    
     if ( h->GetBadElementRemoval() != h_data.myForceBadElementRemoval )
       h->SetBadElementRemoval( h_data.myForceBadElementRemoval );
     if ( h_data.myForceBadElementRemoval && ( h->GetBadElementAspectRatio() != h_data.myBadElementAspectRatio ) )
@@ -2332,21 +2338,18 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi
 
     if ( h->GetVerbosity() != h_data.myVerbosity )
       h->SetVerbosity( h_data.myVerbosity );
-    if ( h->GetTopology() != h_data.myTopology )
-      h->SetTopology( (int) h_data.myTopology );
+    // if ( h->GetTopology() != h_data.myTopology )
+    //   h->SetTopology( (int) h_data.myTopology );
     if ( h->GetPreCADMergeEdges() != h_data.myPreCADMergeEdges )
       h->SetPreCADMergeEdges( h_data.myPreCADMergeEdges );
-    if ( h->GetPreCADRemoveTinyUVEdges() != h_data.myPreCADRemoveTinyUVEdges )
-      h->SetPreCADRemoveTinyUVEdges( h_data.myPreCADRemoveTinyUVEdges );
-    if ( h->GetPreCADRemoveDuplicateCADFaces() != h_data.myPreCADRemoveDuplicateCADFaces )
-      h->SetPreCADRemoveDuplicateCADFaces( h_data.myPreCADRemoveDuplicateCADFaces );
     if ( h->GetPreCADProcess3DTopology() != h_data.myPreCADProcess3DTopology )
       h->SetPreCADProcess3DTopology( h_data.myPreCADProcess3DTopology );
     if ( h->GetPreCADDiscardInput() != h_data.myPreCADDiscardInput )
       h->SetPreCADDiscardInput( h_data.myPreCADDiscardInput );
 
-    h->SetOptionValues( myOptions ); // is set in checkParams()
-    h->SetPreCADOptionValues( myPreCADOptions ); // is set in checkParams()
+    // options are set in checkParams()
+    //h->SetOptionValues( myOptions ); // is set in readParamsFromWidgets()
+    //h->SetPreCADOptionValues( myPreCADOptions ); // is set in readParamsFromWidgets()
     
     if ( h->GetGMFFile() != h_data.myGMFFileName )
 //       || ( h->GetGMFFileMode() != h_data.myGMFFileMode ) )
@@ -2405,7 +2408,7 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi
     }
 
     // Enforced vertices
-    bool ret;
+    //bool ret;
     double x, y, z = 0;
     std::string enfName;
     /* TODO GROUPS
@@ -2435,7 +2438,8 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi
           y = (*evsIt)->coords[1];
           z = (*evsIt)->coords[2];
         }
-        ret = h->SetEnforcedVertexEntry( faceEntry.c_str(), x, y, z, (*evsIt)->name.c_str(), (*evsIt)->geomEntry.c_str(), (*evsIt)->grpName.c_str());
+        //ret =
+        h->SetEnforcedVertexEntry( faceEntry.c_str(), x, y, z, (*evsIt)->name.c_str(), (*evsIt)->geomEntry.c_str(), (*evsIt)->grpName.c_str());
       } // for
     } // for
 
@@ -2521,7 +2525,10 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes
   h_data.myMinSizeRel            = myStdWidget->myMinSizeRel->isChecked();
   h_data.myMaxSize               = myStdWidget->myMaxSize->text().isEmpty() ? -1.0 : myStdWidget->myMaxSize->GetValue();
   h_data.myMaxSizeRel            = myStdWidget->myMaxSizeRel->isChecked();
+  h_data.myUseGradation          = myStdWidget->myUseGradation->isChecked();
   h_data.myGradation             = myStdWidget->myGradation->text().isEmpty() ? -1.0 : myStdWidget->myGradation->GetValue();
+  h_data.myUseVolumeGradation    = myStdWidget->myUseVolumeGradation->isChecked();
+  h_data.myVolumeGradation       = myStdWidget->myVolumeGradation->text().isEmpty() ? -1.0 : myStdWidget->myVolumeGradation->GetValue();
   h_data.myAllowQuadrangles      = myStdWidget->myAllowQuadrangles->isChecked();
   h_data.myAngleMesh             = myStdWidget->myAngleMesh->text().isEmpty() ? -1.0 : myStdWidget->myAngleMesh->GetValue();
   h_data.myChordalError          = myStdWidget->myChordalError->text().isEmpty() ? -1.0 : myStdWidget->myChordalError->GetValue();
@@ -2529,17 +2536,19 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes
   h_data.myAnisotropicRatio      = myStdWidget->myAnisotropicRatio->text().isEmpty() ? -1.0 : myStdWidget->myAnisotropicRatio->GetValue();
   h_data.myRemoveTinyEdges       = myStdWidget->myRemoveTinyEdges->isChecked();
   h_data.myTinyEdgeLength        = myStdWidget->myTinyEdgeLength->text().isEmpty() ? -1.0 : myStdWidget->myTinyEdgeLength->GetValue();
+  h_data.myOptimiseTinyEdges     = myStdWidget->myOptimiseTinyEdges->isChecked();
+  h_data.myTinyEdgeOptimisLength = myStdWidget->myTinyEdgeOptimisLength->text().isEmpty() ? -1.0 : myStdWidget->myTinyEdgeOptimisLength->GetValue();
+  h_data.myCorrectSurfaceIntersection = myStdWidget->myCorrectSurfaceIntersection->isChecked();
+  h_data.myCorrectSurfaceIntersectionMaxCost = myStdWidget->myCorrectSurfaceIntersectionMaxCost->text().isEmpty() ? -1.0 : myStdWidget->myCorrectSurfaceIntersectionMaxCost->GetValue();
   h_data.myForceBadElementRemoval= myStdWidget->myForceBadElementRemoval->isChecked();
   h_data.myBadElementAspectRatio = myStdWidget->myBadElementAspectRatio->text().isEmpty() ? -1.0 : myStdWidget->myBadElementAspectRatio->GetValue();
   h_data.myOptimizeMesh          = myStdWidget->myOptimizeMesh->isChecked();
   h_data.myQuadraticMesh         = myStdWidget->myQuadraticMesh->isChecked();
   h_data.myVerbosity             = myAdvWidget->myVerbosity->value();
-  h_data.myTopology              = myAdvWidget->myPreCADGroupBox->isChecked() ? PreCAD : FromCAD;
-  h_data.myPreCADMergeEdges      = myAdvWidget->myPreCADMergeEdges->isChecked();
-  h_data.myPreCADRemoveTinyUVEdges = myAdvWidget->myPreCADRemoveTinyUVEdges->isChecked();
-  h_data.myPreCADRemoveDuplicateCADFaces = myAdvWidget->myPreCADRemoveDuplicateCADFaces->isChecked();
-  h_data.myPreCADProcess3DTopology = myAdvWidget->myPreCADProcess3DTopology->isChecked();
-  h_data.myPreCADDiscardInput    = myAdvWidget->myPreCADDiscardInput->isChecked();
+  //h_data.myTopology              = myAdvWidget->myPreCADGroupBox->isChecked() ? PreCAD : FromCAD;
+  //h_data.myPreCADMergeEdges      = myAdvWidget->myPreCADMergeEdges->isChecked();
+  //h_data.myPreCADProcess3DTopology = myAdvWidget->myPreCADProcess3DTopology->isChecked();
+  //h_data.myPreCADDiscardInput    = myAdvWidget->myPreCADDiscardInput->isChecked();
 
   QString guiHyp;
   guiHyp += tr("BLSURF_PHY_MESH") + " = " + QString::number( h_data.myPhysicalMesh ) + "; ";
@@ -2568,50 +2577,15 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes
   
   guiHyp += tr("BLSURF_TOPOLOGY") + " = " + QString::number( h_data.myTopology ) + "; ";
   guiHyp += tr("BLSURF_PRECAD_MERGE_EDGES") + " = " + QString(h_data.myPreCADMergeEdges ? "yes" : "no") + "; ";
-  guiHyp += tr("BLSURF_PRECAD_REMOVE_TINY_UV_EDGES") + " = " + QString(h_data.myPreCADRemoveTinyUVEdges ? "yes" : "no") + "; ";
-  guiHyp += tr("BLSURF_PRECAD_REMOVE_DUPLICATE_CAD_FACES") + " = " + QString(h_data.myPreCADRemoveDuplicateCADFaces ? "yes" : "no") + "; ";
   guiHyp += tr("BLSURF_PRECAD_REMOVE_NANO_EDGES") + " = " + QString(h_data.myPreCADProcess3DTopology ? "yes" : "no") + "; ";
   guiHyp += tr("BLSURF_PRECAD_DISCARD_INPUT") + " = " + QString(h_data.myPreCADDiscardInput ? "yes" : "no") + "; ";
-
-  BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
-  int row = 0, nbRows = myAdvWidget->myOptionTable->rowCount();
-  for ( ; row < nbRows; ++row )
-  {
-    int id = myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->text().toInt();
-    std::string optionType = myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().toStdString();
-    bool custom = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->data(Qt::UserRole).toBool();
-    if ( optionType == "BLSURF" && custom ) {
-      id = that->myOptions->length();
-      that->myOptions->length( that->myOptions->length() + 1 );
-    }
-    if ( optionType == "PRECAD" && custom ) {
-      id = that->myPreCADOptions->length();
-      that->myPreCADOptions->length( that->myPreCADOptions->length() + 1 );
-    }
-    if ( custom || ( id >= 0 && ( ( optionType == "BLSURF" && id < myOptions->length() ) || ( optionType == "PRECAD" && id < myPreCADOptions->length() ) ) ) )
-    {
-      QString name  = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text();
-      QString value = myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->text().trimmed();
-      if ( value.isNull() )
-        value = "";
-      if (optionType == "PRECAD")
-        that->myPreCADOptions[ id ] = ( name + ":" + value  + ":" + ( custom ? "1" : "0" ) ).toLatin1().constData();
-      else
-        that->myOptions[ id ] = ( name + ":" + value + ":" + ( custom ? "1" : "0" ) ).toLatin1().constData();
-
-      if ( value != "" ) {
-        if (optionType == "PRECAD")
-          guiHyp += "PRECAD_";
-        guiHyp += name + " = " + value + "; ";
-      }
-    }
-  }
-  
   h_data.myGMFFileName = myAdvWidget->myGMFFileName->text().toStdString();
 //   h_data.myGMFFileMode = myGMFFileMode->isChecked();
 
   // SizeMap
-  row = 0, nbRows = mySizeMapTable->topLevelItemCount();
+  BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
+  int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
   for ( ; row < nbRows; ++row )
   {
       QString entry   = mySizeMapTable->topLevelItem(row)->data(SMP_ENTRY_COLUMN ,Qt::EditRole).toString();
@@ -2681,11 +2655,11 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes
   h_data.preCadPeriodicityVector.clear();
   // For each tree item, store each value. Shapes are stored as entries.
   int nbPeriodicityDescriptions = myPeriodicityTreeWidget->topLevelItemCount();
-  for (size_t i=0 ; i<nbPeriodicityDescriptions ; i++) {
+  for (int i=0 ; i<nbPeriodicityDescriptions ; i++) {
     QTreeWidgetItem* item = myPeriodicityTreeWidget->topLevelItem(i);
     TPreCadPeriodicity periodicity_i;
     if (item) {
-        for (size_t k=0; k<myPeriodicityTreeWidget->columnCount(); ++k)
+        for (int k=0; k<myPeriodicityTreeWidget->columnCount(); ++k)
           {
             MESSAGE(k);
             std::string entry = item->data(k, Qt::UserRole).toString().toStdString();
@@ -2703,166 +2677,16 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes
 
 void BLSURFPluginGUI_HypothesisCreator::onAddOption()
 {
-  QMenu* menu = (QMenu*)sender();
-  // fill popup with option names
-  menu->clear();
-  QStringList name_value_type;
-  if ( myOptions.operator->() ) {
-    QMenu* blsurfMenu = menu->addMenu(tr("OPTION_MENU_BLSURF"));
-    for ( int i = 0, nb = myOptions->length(); i < nb; ++i ) {
-      name_value_type = QString( myOptions[i].in() ).split( ":", QString::KeepEmptyParts );
-      bool custom = ( name_value_type.size() == 3 ) ? name_value_type[2].toInt() : false;
-      if ( !custom && !name_value_type[0].isEmpty() )
-        blsurfMenu->addAction( name_value_type[0] );
-    }
-    // this user-customized action must be last in the menu
-    blsurfMenu->addAction( QString( "<" + tr("BLSURF_OTHER_OPTION") + ">" ) );
-  }
-  if ( myPreCADOptions.operator->() ) {
-    QMenu* preCADmenu = menu->addMenu(tr("OPTION_MENU_PRECAD"));
-    for ( int i = 0, nb = myPreCADOptions->length(); i < nb; ++i ) {
-      name_value_type = QString( myPreCADOptions[i].in() ).split( ":", QString::KeepEmptyParts );
-      bool custom = ( name_value_type.size() == 3 ) ? name_value_type[2].toInt() : false;
-      if ( !custom && !name_value_type[0].isEmpty() )
-        preCADmenu->addAction( name_value_type[0] );
-    }
-    // this user-customized action must be last in the menu
-    preCADmenu->addAction( QString( "<" + tr("BLSURF_OTHER_OPTION") + ">" ) );
-  }
-}
-
-void BLSURFPluginGUI_HypothesisCreator::onOptionChosenInPopup( QAction* a )
-{
-  myAdvWidget->myOptionTable->setFocus();
-  QMenu* menu = (QMenu*)( a->parent() );
-
-  int idx = menu->actions().indexOf( a );
-  bool custom = menu->actions().last() == a;
-
-  QString idStr = QString("%1").arg( idx );
-  QString option, optionType;
-  if (menu->title() == tr("OPTION_MENU_BLSURF")) {
-    if (idx < myOptions->length())
-      option = myOptions[idx].in();
-    optionType = "BLSURF";
-  }
-  else if (menu->title() == tr("OPTION_MENU_PRECAD")) {
-    if (idx < myPreCADOptions->length())
-      option = myPreCADOptions[idx].in();
-    optionType = "PRECAD";
-  }
-  QString optionName = option.split( ":", QString::KeepEmptyParts )[0];
-
-  // look for a row with optionName
-  int row = 0, nbRows = myAdvWidget->myOptionTable->rowCount();
-  for ( ; row < nbRows; ++row )
-    if ( myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->text() == idStr )
-      if ( myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text() == optionType )
-        break;
-  if (custom)
-    row = nbRows;
-  // add a row if not found
-  if ( row == nbRows ) {
-    myAdvWidget->myOptionTable->setRowCount( row+1 );
-    myAdvWidget->myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) );
-    myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 );
-    myAdvWidget->myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( optionType ) );
-    myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 );
-    if (custom) {
-      myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( "" ) );
-      myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( Qt::ItemIsSelectable |
-                                                                             Qt::ItemIsEditable   |
-                                                                             Qt::ItemIsEnabled );
-      myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setData( Qt::UserRole, QVariant(true) );
-    }
-    else {
-      myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( optionName ) );
-      myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
-    }
-    myAdvWidget->myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( "" ) );
-    myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable |
-                                                                            Qt::ItemIsEditable   |
-                                                                            Qt::ItemIsEnabled );
-    myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
-  }
-  myAdvWidget->myOptionTable->clearSelection();
-  int activeColumn = custom ? OPTION_NAME_COLUMN : OPTION_VALUE_COLUMN;
-  myAdvWidget->myOptionTable->scrollToItem( myAdvWidget->myOptionTable->item( row, activeColumn ) );
-  //myAdvWidget->myOptionTable->item( row, activeColumn )->setSelected( true );
-  myAdvWidget->myOptionTable->setCurrentCell( row, activeColumn );
-  //myAdvWidget->myOptionTable->openPersistentEditor( myOptionTable->item( row, activeColumn ) );
-}
-
-void BLSURFPluginGUI_HypothesisCreator::onDeleteOption()
-{
-  BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
-    BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() );
-  // clear option values and remember selected row
-  QList<int> selectedRows;
-  QList<QTableWidgetItem*> selected = myAdvWidget->myOptionTable->selectedItems();
-  QTableWidgetItem* item;
-  foreach( item, selected ) {
-    int row = item->row();
-    if ( !selectedRows.contains( row ) ) {
-      selectedRows.append( row );
-      int id = myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->text().toInt();
-      QString optionType = myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text();
-      bool custom = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->data(Qt::UserRole).toBool();
-      QString name = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text();
-      if ( id >= 0 )
-        if ( optionType == "BLSURF" && id < myOptions->length() )
-          if ( custom ) {
-            h->UnsetOption( name.toLatin1().constData() );
-            myOptions[id] = "";
-          }
-          else
-            myOptions[id] = name.toLatin1().constData();
-        else if ( optionType == "PRECAD" && id < myPreCADOptions->length() )
-          if ( custom ) {
-            h->UnsetPreCADOption( name.toLatin1().constData() );
-            myPreCADOptions[id] = "";
-          }
-          else
-            myPreCADOptions[id] = name.toLatin1().constData();
-    }
-  }
-  qSort( selectedRows );
-  QListIterator<int> it( selectedRows );
-  it.toBack();
-  while ( it.hasPrevious() )
-    myAdvWidget->myOptionTable->removeRow( it.previous() );
-}
-
-void BLSURFPluginGUI_HypothesisCreator::onEditOption( int row, int column )
-{
-  if ( column != OPTION_NAME_COLUMN )
-    return;
-  bool custom = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->data(Qt::UserRole).toBool();
-  if ( !custom )
-    return;
-
-  BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
-    BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() );
-
-  int id = myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->text().toInt();
-  QString optionType = myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().trimmed();
-  QString name = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text();
-  if ( optionType == "PRECAD"  && id < myPreCADOptions->length() ) {
-    h->UnsetPreCADOption(name.toLatin1().constData());
-    myPreCADOptions[id] = "";
-  }
-  else if ( optionType == "BLSURF" && id < myOptions->length() ) {
-    h->UnsetOption(name.toLatin1().constData());
-    myOptions[id] = "";
-  }
+  myAdvWidget->AddOption( TBL_CUSTOM, NULL );
 }
 
 void BLSURFPluginGUI_HypothesisCreator::onChangeOptionName( int row, int column )
 {
-  if ( column != OPTION_NAME_COLUMN )
-    return;
-  myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
+  // if ( column != OPTION_NAME_COLUMN )
+  //   return;
+  // myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
 }
+
 // **********************
 // *** BEGIN SIZE MAP ***
 // **********************
index b120ac9b69958506d52ab733b331654a3fa97a87..811e2256d29cda55c6b82db2db3e971c2b66f869 100644 (file)
@@ -163,13 +163,13 @@ typedef struct
   int     myPhysicalMesh, myGeometricMesh;
   double  myPhySize, myMinSize, myMaxSize;
   bool    myPhySizeRel, myMinSizeRel, myMaxSizeRel;
-  bool    myUseMinSize, myUseMaxSize;
-  double  myGradation, myAngleMesh, myChordalError;
-  bool    myAnisotropic, myRemoveTinyEdges, myForceBadElementRemoval;
-  double  myAnisotropicRatio, myTinyEdgeLength, myBadElementAspectRatio;
+  bool    myUseMinSize, myUseMaxSize, myUseGradation, myUseVolumeGradation;
+  double  myGradation, myVolumeGradation, myAngleMesh, myChordalError;
+  bool    myAnisotropic, myOptimiseTinyEdges, myRemoveTinyEdges, myForceBadElementRemoval, myCorrectSurfaceIntersection;
+  double  myAnisotropicRatio, myTinyEdgeLength, myTinyEdgeOptimisLength, myBadElementAspectRatio, myCorrectSurfaceIntersectionMaxCost;
   bool    myOptimizeMesh, myQuadraticMesh;
   bool    myAllowQuadrangles, mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex,myInternalEnforcedVerticesAllFaces;
-  bool    myPreCADMergeEdges, myPreCADRemoveTinyUVEdges, myPreCADRemoveDuplicateCADFaces, myPreCADProcess3DTopology, myPreCADDiscardInput;
+  bool    myPreCADMergeEdges, myPreCADProcess3DTopology, myPreCADDiscardInput;
 //   bool    myGMFFileMode;
   std::string myGMFFileName, myInternalEnforcedVerticesAllFacesGroup;
   TEnfVertexList enfVertexList;
@@ -376,7 +376,7 @@ private:
   QPushButton* myPeriodicityRemoveButton;
   QSpacerItem* myPeriodicityVerticalSpacer;
 
-  BLSURFPlugin::string_array_var myOptions, myPreCADOptions;
+  BLSURFPlugin::string_array_var myOptions, myPreCADOptions, myCustomOptions;
 
   PyObject *          main_mod;
   PyObject *          main_dict;
index b17ad7d14f38450dd6578e879fb60aeb78966c8f..35a60c4b3749e3c33ac052c91b182e5ef81012e3 100644 (file)
@@ -44,10 +44,13 @@ BLSURFPluginGUI_StdWidget::BLSURFPluginGUI_StdWidget( QWidget* parent, Qt::Windo
   myMinSize->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
   myMaxSize->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
   myGradation->RangeStepAndValidator(1.0, COORD_MAX, 0.1, "length_precision");
+  myVolumeGradation->RangeStepAndValidator(1.0, COORD_MAX, 0.1, "length_precision");
   myAngleMesh->RangeStepAndValidator(0, 90, 0.5, "angular_precision");
   myChordalError->RangeStepAndValidator(0, COORD_MAX, 0.1, "length_precision");
   myAnisotropicRatio->RangeStepAndValidator(0, COORD_MAX, 0.1, "length_precision");
-  myTinyEdgeLength->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, "length_precision");
+  myTinyEdgeLength->RangeStepAndValidator(0, COORD_MAX, 0.1, "length_precision");
+  myTinyEdgeOptimisLength->RangeStepAndValidator(0, COORD_MAX, 0.1, "length_precision");
+  myCorrectSurfaceIntersectionMaxCost->RangeStepAndValidator(0, COORD_MAX, 1);
   myBadElementAspectRatio->RangeStepAndValidator(0, COORD_MAX, 1000, "length_precision");
   myMinSize->setText("");
   myMaxSize->setText("");
@@ -55,6 +58,8 @@ BLSURFPluginGUI_StdWidget::BLSURFPluginGUI_StdWidget( QWidget* parent, Qt::Windo
   myChordalError->setText("");
   myAnisotropicRatio->setText("");
   myTinyEdgeLength->setText("");
+  myTinyEdgeOptimisLength->setText("");
+  myCorrectSurfaceIntersectionMaxCost->setText("");
   myBadElementAspectRatio->setText("");
 }
 
@@ -66,36 +71,17 @@ void BLSURFPluginGUI_StdWidget::onPhysicalMeshChanged() {
   bool isPhysicalGlobalSize = (myPhysicalMesh->currentIndex() == PhysicalGlobalSize);
   bool isPhysicalLocalSize  = (myPhysicalMesh->currentIndex() == PhysicalLocalSize);
   bool isCustom             = (isPhysicalGlobalSize || isPhysicalLocalSize) ;
-  bool geomIsCustom         = (myGeometricMesh->currentIndex() != DefaultGeom);
-  bool isQuadAllowed        = (myAllowQuadrangles->isChecked() );
 
-  myGradation->setEnabled( !isQuadAllowed && ( !isPhysicalGlobalSize || geomIsCustom ));
   myPhySize->setEnabled(isCustom);
   myPhySizeRel->setEnabled(isCustom);
-
-  if ( !isCustom ) {
-    if ( myGeometricMesh->currentIndex() == DefaultGeom ) {
-      myGeometricMesh->setCurrentIndex( GeometricalGlobalSize );
-      onGeometricMeshChanged();
-    }
-  }
 }
 
 void BLSURFPluginGUI_StdWidget::onGeometricMeshChanged() {
   bool isCustom            = (myGeometricMesh->currentIndex() != DefaultGeom);
-  bool isPhysicalLocalSize = (myPhysicalMesh->currentIndex() == PhysicalLocalSize);
-  bool isQuadAllowed       = (myAllowQuadrangles->isChecked() );
-
-  GeomParamsGroupBox->setEnabled(isCustom);
-  myGradation->setEnabled( !isQuadAllowed && ( isCustom || isPhysicalLocalSize ));
-
-  if ( ! isCustom ) {
-    //  hphy_flag = 0 and hgeo_flag = 0 is not allowed (spec)
-    if ( myPhysicalMesh->currentIndex() == DefaultSize ) {
-      myPhysicalMesh->setCurrentIndex( PhysicalGlobalSize );
-      onPhysicalMeshChanged();
-    }
-  }
+
+  myAngleMesh->setEnabled( isCustom );
+  myChordalError->setEnabled( isCustom );
+
 }
 
 void BLSURFPluginGUI_StdWidget::resizeWidgets() {
index 9167973a814194d1d107bb69959e34b55512c46b..53b0517df3b44a93ff33c13cb9f67edb72c442c8 100644 (file)
@@ -7,20 +7,29 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>588</width>
-    <height>244</height>
+    <width>667</width>
+    <height>342</height>
    </rect>
   </property>
   <layout class="QGridLayout" name="gridLayout_5">
-   <property name="margin">
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
     <number>0</number>
    </property>
    <item row="0" column="0">
     <widget class="QGroupBox" name="groupBox">
      <property name="title">
-      <string>BLSURF_MESH_TYPE</string>
+      <string>BLSURF_PHYSICAL_SIZE</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout">
+     <layout class="QGridLayout" name="gridLayout_4">
       <item row="0" column="0">
        <widget class="QLabel" name="label">
         <property name="text">
@@ -28,7 +37,7 @@
         </property>
        </widget>
       </item>
-      <item row="0" column="1">
+      <item row="0" column="1" colspan="2">
        <widget class="QComboBox" name="myPhysicalMesh">
         <property name="toolTip">
          <string>BLSURF_PHY_MESH_TOOLTIP</string>
        </widget>
       </item>
       <item row="1" column="0">
+       <widget class="QLabel" name="label_3">
+        <property name="toolTip">
+         <string>BLSURF_HPHYDEF_TOOLTIP</string>
+        </property>
+        <property name="text">
+         <string>BLSURF_HPHYDEF</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="SMESHGUI_SpinBox" name="myPhySize"/>
+      </item>
+      <item row="1" column="2">
+       <widget class="QCheckBox" name="myPhySizeRel">
+        <property name="toolTip">
+         <string>BLSURF_SIZE_REL_TOOLTIP</string>
+        </property>
+        <property name="text">
+         <string>BLSURF_SIZE_REL</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="label_4">
+        <property name="text">
+         <string>BLSURF_MINSIZE</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <widget class="SMESHGUI_SpinBox" name="myMinSize"/>
+      </item>
+      <item row="2" column="2">
+       <widget class="QCheckBox" name="myMinSizeRel">
+        <property name="toolTip">
+         <string>BLSURF_SIZE_REL_TOOLTIP</string>
+        </property>
+        <property name="text">
+         <string>BLSURF_SIZE_REL</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="0">
+       <widget class="QLabel" name="label_5">
+        <property name="text">
+         <string>BLSURF_MAXSIZE</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1">
+       <widget class="SMESHGUI_SpinBox" name="myMaxSize">
+        <property name="singleStep">
+         <double>10.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="2">
+       <widget class="QCheckBox" name="myMaxSizeRel">
+        <property name="toolTip">
+         <string>BLSURF_SIZE_REL_TOOLTIP</string>
+        </property>
+        <property name="text">
+         <string>BLSURF_SIZE_REL</string>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="1">
+       <spacer name="verticalSpacer_4">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>4</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QGroupBox" name="GeomParamsGroupBox">
+     <property name="enabled">
+      <bool>true</bool>
+     </property>
+     <property name="title">
+      <string>BLSURF_GEOMETRICAL_SIZE</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="0" column="0" colspan="2">
        <widget class="QLabel" name="label_2">
         <property name="text">
          <string>BLSURF_GEOM_MESH</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="1">
+      <item row="0" column="2">
        <widget class="QComboBox" name="myGeometricMesh">
         <property name="toolTip">
          <string>BLSURF_GEOM_MESH_TOOLTIP</string>
         </property>
+        <property name="currentText">
+         <string>GLOBAL_SIZE</string>
+        </property>
         <item>
          <property name="text">
           <string>BLSURF_DEFAULT_USER</string>
         </item>
        </widget>
       </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="0" column="1">
-    <widget class="QGroupBox" name="GeomParamsGroupBox">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="title">
-      <string>BLSURF_GEOMETRICAL_PARAMETERS</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_4">
-      <item row="0" column="1">
-       <widget class="SMESHGUI_SpinBox" name="myAngleMesh"/>
-      </item>
-      <item row="1" column="1">
-       <widget class="SMESHGUI_SpinBox" name="myChordalError"/>
-      </item>
-      <item row="0" column="0">
+      <item row="1" column="0" colspan="2">
        <widget class="QLabel" name="label_6">
         <property name="toolTip">
          <string>BLSURF_ANGLE_MESH_TOOLTIP</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="0">
+      <item row="1" column="2">
+       <widget class="SMESHGUI_SpinBox" name="myAngleMesh">
+        <property name="enabled">
+         <bool>true</bool>
+        </property>
+        <property name="value">
+         <double>8.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0" rowspan="2" colspan="2">
        <widget class="QLabel" name="label_8">
         <property name="toolTip">
          <string>BLSURF_CHORDAL_TOOLTIP</string>
         </property>
        </widget>
       </item>
+      <item row="2" column="2" rowspan="2">
+       <widget class="SMESHGUI_SpinBox" name="myChordalError"/>
+      </item>
+      <item row="3" column="1" rowspan="2">
+       <spacer name="verticalSpacer">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>36</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item row="4" column="2">
+       <spacer name="verticalSpacer_2">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>23</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
      </layout>
     </widget>
    </item>
      <property name="title">
       <string>BLSURF_MAIN_PARAMETERS</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout_2">
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_3">
+     <layout class="QGridLayout" name="gridLayout_3">
+      <item row="2" column="0">
+       <widget class="QCheckBox" name="myOptimizeMesh">
         <property name="toolTip">
-         <string>BLSURF_HPHYDEF_TOOLTIP</string>
+         <string>BLSURF_OPTIMISATION_TOOLTIP</string>
         </property>
         <property name="text">
-         <string>BLSURF_HPHYDEF</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="SMESHGUI_SpinBox" name="myPhySize"/>
-      </item>
-      <item row="0" column="2">
-       <widget class="QCheckBox" name="myPhySizeRel">
-        <property name="toolTip">
-         <string>BLSURF_SIZE_REL_TOOLTIP</string>
+         <string>BLSURF_OPTIMISATION</string>
         </property>
-        <property name="text">
-         <string>BLSURF_SIZE_REL</string>
+        <property name="checked">
+         <bool>true</bool>
         </property>
        </widget>
       </item>
-      <item row="1" column="1">
-       <widget class="SMESHGUI_SpinBox" name="myMinSize"/>
-      </item>
-      <item row="1" column="2">
-       <widget class="QCheckBox" name="myMinSizeRel">
+      <item row="0" column="0">
+       <widget class="QCheckBox" name="myQuadraticMesh">
         <property name="toolTip">
-         <string>BLSURF_SIZE_REL_TOOLTIP</string>
+         <string>BLSURF_ELEMENT_ORDER_TOOLTIP</string>
         </property>
         <property name="text">
-         <string>BLSURF_SIZE_REL</string>
+         <string>BLSURF_ELEMENT_ORDER</string>
         </property>
        </widget>
       </item>
-      <item row="2" column="1">
-       <widget class="SMESHGUI_SpinBox" name="myMaxSize">
-        <property name="singleStep">
-         <double>10.000000000000000</double>
+      <item row="1" column="1">
+       <widget class="SMESHGUI_SpinBox" name="myGradation">
+        <property name="enabled">
+         <bool>false</bool>
         </property>
        </widget>
       </item>
-      <item row="2" column="2">
-       <widget class="QCheckBox" name="myMaxSizeRel">
-        <property name="toolTip">
-         <string>BLSURF_SIZE_REL_TOOLTIP</string>
-        </property>
-        <property name="text">
-         <string>BLSURF_SIZE_REL</string>
-        </property>
-       </widget>
+      <item row="4" column="0">
+       <spacer name="verticalSpacer_3">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>55</height>
+         </size>
+        </property>
+       </spacer>
       </item>
-      <item row="3" column="0">
-       <widget class="QLabel" name="label_7">
+      <item row="1" column="0">
+       <widget class="QCheckBox" name="myUseGradation">
         <property name="toolTip">
          <string>BLSURF_GRADATION_TOOLTIP</string>
         </property>
         </property>
        </widget>
       </item>
-      <item row="3" column="1">
-       <widget class="SMESHGUI_SpinBox" name="myGradation">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="label_4">
-        <property name="text">
-         <string>BLSURF_MINSIZE</string>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0">
-       <widget class="QLabel" name="label_5">
-        <property name="text">
-         <string>BLSURF_MAXSIZE</string>
+      <item row="3" column="0">
+       <widget class="QCheckBox" name="myAllowQuadrangles">
+        <property name="toolTip">
+         <string>BLSURF_ALLOW_QUADRANGLES_TOOLTIP</string>
         </property>
-       </widget>
-      </item>
-      <item row="4" column="0" colspan="3">
-       <widget class="QCheckBox" name="myQuadraticMesh">
         <property name="text">
-         <string>BLSURF_ELEMENT_ORDER</string>
+         <string>BLSURF_ALLOW_QUADRANGLES</string>
         </property>
        </widget>
       </item>
      <property name="title">
       <string>BLSURF_OTHER_PARAMETERS</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout_3">
+     <layout class="QGridLayout" name="gridLayout_2">
       <item row="0" column="0">
        <widget class="QCheckBox" name="myAnisotropic">
         <property name="toolTip">
        </widget>
       </item>
       <item row="1" column="0">
+       <widget class="QCheckBox" name="myOptimiseTinyEdges">
+        <property name="toolTip">
+         <string>BLSURF_OPTIMIZE_TINY_EDGES_TOOLTIP</string>
+        </property>
+        <property name="text">
+         <string>BLSURF_OPTIMISE_TINY_EDGES</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="SMESHGUI_SpinBox" name="myTinyEdgeOptimisLength">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
        <widget class="QCheckBox" name="myRemoveTinyEdges">
         <property name="toolTip">
          <string>BLSURF_REMOVE_TINY_EDGES_TOOLTIP</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="1">
+      <item row="2" column="1">
        <widget class="SMESHGUI_SpinBox" name="myTinyEdgeLength">
         <property name="enabled">
          <bool>false</bool>
         </property>
        </widget>
       </item>
-      <item row="2" column="0">
+      <item row="3" column="0">
        <widget class="QCheckBox" name="myForceBadElementRemoval">
         <property name="toolTip">
          <string>BLSURF_REMOVE_SLIVERS_TOOLTIP</string>
         </property>
        </widget>
       </item>
-      <item row="2" column="1">
+      <item row="3" column="1">
        <widget class="SMESHGUI_SpinBox" name="myBadElementAspectRatio">
         <property name="enabled">
          <bool>false</bool>
         </property>
        </widget>
       </item>
-      <item row="3" column="0" colspan="2">
-       <widget class="QCheckBox" name="myOptimizeMesh">
+      <item row="4" column="0">
+       <widget class="QCheckBox" name="myCorrectSurfaceIntersection">
         <property name="toolTip">
-         <string>BLSURF_OPTIMISATION_TOOLTIP</string>
+         <string>BLSURF_SURFACE_INTERSECTIONS_TOOLTIP</string>
         </property>
         <property name="text">
-         <string>BLSURF_OPTIMISATION</string>
+         <string>BLSURF_SURFACE_INTERSECTIONS</string>
         </property>
-        <property name="checked">
-         <bool>true</bool>
+       </widget>
+      </item>
+      <item row="4" column="1">
+       <widget class="SMESHGUI_SpinBox" name="myCorrectSurfaceIntersectionMaxCost">
+        <property name="enabled">
+         <bool>false</bool>
         </property>
        </widget>
       </item>
-      <item row="5" column="0" colspan="2">
-       <widget class="QCheckBox" name="myAllowQuadrangles">
+      <item row="5" column="0">
+       <widget class="QCheckBox" name="myUseVolumeGradation">
+        <property name="toolTip">
+         <string>BLSURF_VOLUME_GRADATION_TOOLTIP</string>
+        </property>
         <property name="text">
-         <string>BLSURF_ALLOW_QUADRANGLES</string>
+         <string>BLSURF_VOLUME_GRADATION</string>
         </property>
        </widget>
       </item>
+      <item row="5" column="1">
+       <widget class="SMESHGUI_SpinBox" name="myVolumeGradation">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="6" column="0">
+       <spacer name="verticalSpacer_5">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>3</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
      </layout>
     </widget>
    </item>
  </customwidgets>
  <tabstops>
   <tabstop>myPhysicalMesh</tabstop>
-  <tabstop>myGeometricMesh</tabstop>
   <tabstop>myPhySize</tabstop>
   <tabstop>myPhySizeRel</tabstop>
   <tabstop>myMinSize</tabstop>
   <tabstop>myMinSizeRel</tabstop>
   <tabstop>myMaxSize</tabstop>
   <tabstop>myMaxSizeRel</tabstop>
-  <tabstop>myGradation</tabstop>
-  <tabstop>myQuadraticMesh</tabstop>
+  <tabstop>myGeometricMesh</tabstop>
   <tabstop>myAngleMesh</tabstop>
   <tabstop>myChordalError</tabstop>
+  <tabstop>myQuadraticMesh</tabstop>
+  <tabstop>myUseGradation</tabstop>
+  <tabstop>myGradation</tabstop>
+  <tabstop>myOptimizeMesh</tabstop>
+  <tabstop>myAllowQuadrangles</tabstop>
   <tabstop>myAnisotropic</tabstop>
   <tabstop>myAnisotropicRatio</tabstop>
+  <tabstop>myOptimiseTinyEdges</tabstop>
+  <tabstop>myTinyEdgeOptimisLength</tabstop>
   <tabstop>myRemoveTinyEdges</tabstop>
   <tabstop>myTinyEdgeLength</tabstop>
   <tabstop>myForceBadElementRemoval</tabstop>
   <tabstop>myBadElementAspectRatio</tabstop>
-  <tabstop>myOptimizeMesh</tabstop>
-  <tabstop>myAllowQuadrangles</tabstop>
+  <tabstop>myCorrectSurfaceIntersection</tabstop>
+  <tabstop>myCorrectSurfaceIntersectionMaxCost</tabstop>
+  <tabstop>myUseVolumeGradation</tabstop>
+  <tabstop>myVolumeGradation</tabstop>
  </tabstops>
  <resources/>
  <connections>
    <slot>onGeometricMeshChanged()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>188</x>
-     <y>60</y>
+     <x>495</x>
+     <y>48</y>
     </hint>
     <hint type="destinationlabel">
      <x>281</x>
    <slot>onPhysicalMeshChanged()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>188</x>
+     <x>226</x>
      <y>37</y>
     </hint>
     <hint type="destinationlabel">
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>384</x>
-     <y>122</y>
+     <x>488</x>
+     <y>176</y>
     </hint>
     <hint type="destinationlabel">
-     <x>541</x>
-     <y>127</y>
+     <x>655</x>
+     <y>175</y>
     </hint>
    </hints>
   </connection>
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>414</x>
-     <y>151</y>
+     <x>488</x>
+     <y>228</y>
     </hint>
     <hint type="destinationlabel">
-     <x>547</x>
-     <y>152</y>
+     <x>655</x>
+     <y>227</y>
     </hint>
    </hints>
   </connection>
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>448</x>
-     <y>181</y>
+     <x>488</x>
+     <y>254</y>
     </hint>
     <hint type="destinationlabel">
-     <x>542</x>
-     <y>180</y>
+     <x>655</x>
+     <y>253</y>
     </hint>
    </hints>
   </connection>
    <slot>setDisabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>441</x>
-     <y>119</y>
+     <x>488</x>
+     <y>176</y>
     </hint>
     <hint type="destinationlabel">
-     <x>525</x>
-     <y>60</y>
+     <x>495</x>
+     <y>100</y>
     </hint>
    </hints>
   </connection>
    <slot>setDisabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>425</x>
-     <y>121</y>
+     <x>488</x>
+     <y>176</y>
     </hint>
     <hint type="destinationlabel">
-     <x>438</x>
-     <y>64</y>
+     <x>446</x>
+     <y>100</y>
     </hint>
    </hints>
   </connection>
    <hints>
     <hint type="sourcelabel">
      <x>159</x>
-     <y>119</y>
+     <y>74</y>
     </hint>
     <hint type="destinationlabel">
      <x>220</x>
    <slot>onEditingFinished()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>144</x>
-     <y>150</y>
+     <x>159</x>
+     <y>100</y>
     </hint>
     <hint type="destinationlabel">
      <x>205</x>
    <slot>onEditingFinished()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>128</x>
-     <y>176</y>
+     <x>159</x>
+     <y>126</y>
     </hint>
     <hint type="destinationlabel">
      <x>135</x>
    <slot>onEditingFinished()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>170</x>
-     <y>201</y>
+     <x>316</x>
+     <y>199</y>
     </hint>
     <hint type="destinationlabel">
      <x>315</x>
    <slot>onEditingFinished()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>548</x>
-     <y>34</y>
+     <x>495</x>
+     <y>74</y>
     </hint>
     <hint type="destinationlabel">
      <x>566</x>
    <slot>onEditingFinished()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>542</x>
-     <y>56</y>
+     <x>495</x>
+     <y>100</y>
     </hint>
     <hint type="destinationlabel">
      <x>537</x>
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>myOptimiseTinyEdges</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>myTinyEdgeOptimisLength</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>438</x>
+     <y>202</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>655</x>
+     <y>201</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>myCorrectSurfaceIntersection</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>myCorrectSurfaceIntersectionMaxCost</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>450</x>
+     <y>280</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>655</x>
+     <y>279</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>myUseVolumeGradation</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>myVolumeGradation</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>449</x>
+     <y>306</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>655</x>
+     <y>305</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>myUseGradation</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>myGradation</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>115</x>
+     <y>206</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>249</x>
+     <y>211</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>onGeometricMeshChanged()</slot>
index ebfa0fc520cca7a086197b2eed86d2183409fca8..fda49de1d8aa839978cc28e7d70e4d8da489841a 100644 (file)
@@ -9,7 +9,11 @@
     </message>
     <message>
         <source>BLSURF_PHY_MESH</source>
-        <translation>Physical Mesh</translation>
+        <translation>Type</translation>
+    </message>
+    <message>
+        <source>BLSURF_PHYSICAL_SIZE</source>
+        <translation>Physical Size</translation>
     </message>
     <message>
         <source>BLSURF_PHY_MESH_TOOLTIP</source>
@@ -20,7 +24,7 @@
     </message>
     <message>
         <source>BLSURF_GEOM_MESH</source>
-        <translation>Geometrical Mesh</translation>
+        <translation>Type</translation>
     </message>
     <message>
         <source>BLSURF_GEOM_MESH_TOOLTIP</source>
@@ -87,13 +91,25 @@ The default computed value is &lt;em&gt;diag&lt;/em&gt;/5.</translation>
         <source>BLSURF_GRADATION_TOOLTIP</source>
         <translation>Maximum ratio between the lengths of two adjacent edges.</translation>
     </message>
+    <message>
+        <source>BLSURF_VOLUME_GRADATION</source>
+        <translation>Volume Gradation</translation>
+    </message>
+    <message>
+        <source>BLSURF_VOLUME_GRADATION_TOOLTIP</source>
+        <translation>Maximum ratio between the lengths of two adjacent edges in 3D mesh.</translation>
+    </message>
     <message>
         <source>BLSURF_ALLOW_QUADRANGLES</source>
         <translation>Allow Quadrangles</translation>
     </message>
     <message>
-        <source>BLSURF_GEOMETRICAL_PARAMETERS</source>
-        <translation>Geometrical parameters</translation>
+        <source>BLSURF_ALLOW_QUADRANGLES_TOOLTIP</source>
+        <translation>To generate quadrangle dominant mesh</translation>
+    </message>
+    <message>
+        <source>BLSURF_GEOMETRICAL_SIZE</source>
+        <translation>Geometrical size</translation>
     </message>
     <message>
         <source>BLSURF_ANGLE_MESH</source>
@@ -134,6 +150,22 @@ The smaller this distance is, the closer the mesh is to the exact surface (only
         <source>BLSURF_REMOVE_TINY_EDGES_TOOLTIP</source>
         <translation>If checked, this parameter defines the minimal length under which an edge is considered to be a tiny one.</translation>
     </message>
+    <message>
+        <source>BLSURF_OPTIMISE_TINY_EDGES</source>
+        <translation>Optimize tiny edges</translation>
+    </message>
+    <message>
+        <source>BLSURF_OPTIMIZE_TINY_EDGES_TOOLTIP</source>
+        <translation>If checked, this parameter defines the minimal length under which an edge is considered to be a tiny one.</translation>
+    </message>
+    <message>
+        <source>BLSURF_SURFACE_INTERSECTIONS</source>
+        <translation>Correct surface intersections</translation>
+    </message>
+    <message>
+        <source>BLSURF_SURFACE_INTERSECTIONS_TOOLTIP</source>
+        <translation>If checked, this parameter defines the time that will be spent in the intersection prevention process.</translation>
+    </message>
     <message>
         <source>BLSURF_REMOVE_SLIVERS</source>
         <translation>Remove bad elements</translation>
@@ -154,6 +186,10 @@ The smaller this distance is, the closer the mesh is to the exact surface (only
         <source>BLSURF_ELEMENT_ORDER</source>
         <translation>Quadratic mesh</translation>
     </message>
+    <message>
+        <source>BLSURF_ELEMENT_ORDER_TOOLTIP</source>
+        <translation type="unfinished">To generate quadratic mesh</translation>
+    </message>
     <message>
         <source>BLSURF_HYPOTHESIS</source>
         <translation>MG-CADSurf</translation>
@@ -207,12 +243,12 @@ The smaller this distance is, the closer the mesh is to the exact surface (only
         <translation>Value</translation>
     </message>
     <message>
-        <source>OPTION_MENU_BLSURF</source>
-        <translation>MG-CADSurf</translation>
+        <source>BLSURF_MESHING_OPTIONS</source>
+        <translation>Meshing</translation>
     </message>
     <message>
-        <source>OPTION_MENU_PRECAD</source>
-        <translation>PreCAD</translation>
+        <source>BLSURF_PRECAD_OPTIONS</source>
+        <translation>CAD preprocessor</translation>
     </message>
     <message>
         <source>BLSURF_ADD_OPTION</source>
@@ -223,8 +259,8 @@ The smaller this distance is, the closer the mesh is to the exact surface (only
         <translation>Clear option</translation>
     </message>
     <message>
-        <source>BLSURF_OTHER_OPTION</source>
-        <translation>Other option</translation>
+        <source>BLSURF_CUSTOM_OPTIONS</source>
+        <translation>Other options</translation>
     </message>
     <message>
         <source>BLSURF_GMF_FILE</source>
@@ -559,4 +595,71 @@ The smaller this distance is, the closer the mesh is to the exact surface (only
         <translation>Edge</translation>
     </message>
 </context>
+<context>
+    <name>BLSURFPluginGUI_AdvWidget</name>
+    <message>
+        <source>enforce_cad_edge_sizes</source>
+        <translation>Enforce CAD edge sizes</translation>
+    </message>
+    <message>
+        <source>jacobian_rectification_respect_geometry</source>
+        <translation>Priority of geometry over Jacobian</translation>
+    </message>
+    <message>
+        <source>max_number_of_points_per_patch</source>
+        <translation>Maximal number of points per patch</translation>
+    </message>
+    <message>
+        <source>rectify_jacobian</source>
+        <translation>Rectify Jacobian</translation>
+    </message>
+    <message>
+        <source>respect_geometry</source>
+        <translation>Respect geometry</translation>
+    </message>
+    <message>
+        <source>tiny_edge_avoid_surface_intersections</source>
+        <translation>Tiny edges avoid surface intersections</translation>
+    </message>
+    <message>
+        <source>closed_geometry</source>
+        <translation>Closed geometry</translation>
+    </message>
+    <message>
+        <source>debug</source>
+        <translation>Debug</translation>
+    </message>
+    <message>
+        <source>discard_input_topology</source>
+        <translation>Discard input topology</translation>
+    </message>
+    <message>
+        <source>merge_edges</source>
+        <translation>Merge edges</translation>
+    </message>
+    <message>
+        <source>periodic_tolerance</source>
+        <translation>Periodic tolerance</translation>
+    </message>
+    <message>
+        <source>remove_duplicate_cad_faces</source>
+        <translation>Remove duplicate CAD faces</translation>
+    </message>
+    <message>
+        <source>required_entities</source>
+        <translation>Required entities</translation>
+    </message>
+    <message>
+        <source>sewing_tolerance</source>
+        <translation>Sewing tolerance</translation>
+    </message>
+    <message>
+        <source>tags</source>
+        <translation>Tags</translation>
+    </message>
+    <message>
+        <source></source>
+        <translation></translation>
+    </message>
+</context> 
 </TS>
index c7a535d5ec9b4877d10ccbb202d5423b0e989215..952ebeca0506eacf2b375fb7fc1913e821b4fcb3 100755 (executable)
     </message>
     <message>
         <source>BLSURF_PHY_MESH</source>
-        <translation>Maillage physique</translation>
+        <translation>Type</translation>
+    </message>
+    <message>
+        <source>BLSURF_PHYSICAL_SIZE</source>
+        <translation>Taille physique</translation>
     </message>
     <message>
         <source>BLSURF_PHY_MESH_TOOLTIP</source>
@@ -24,7 +28,7 @@
     </message>
     <message>
         <source>BLSURF_GEOM_MESH</source>
-        <translation>Maillage géométrique</translation>
+        <translation>Type</translation>
     </message>
     <message>
         <source>BLSURF_GEOM_MESH_TOOLTIP</source>
@@ -91,13 +95,25 @@ La valeur par défaut est calculée par &lt;em&gt;diag&lt;/em&gt;/5.</translatio
         <source>BLSURF_GRADATION_TOOLTIP</source>
         <translation>Ratio maximum entre les longueurs de deux segments adjacents.</translation>
     </message>
+    <message>
+        <source>BLSURF_VOLUME_GRADATION</source>
+        <translation>Taux d&apos;accroissement 3D</translation>
+    </message>
+    <message>
+        <source>BLSURF_VOLUME_GRADATION_TOOLTIP</source>
+        <translation type="unfinished">Ratio maximum entre les longueurs de deux segments adjacents.</translation>
+    </message>
     <message>
         <source>BLSURF_ALLOW_QUADRANGLES</source>
         <translation>Autoriser les quadrangles</translation>
     </message>
     <message>
-        <source>BLSURF_GEOMETRICAL_PARAMETERS</source>
-        <translation>Paramètres géometriques</translation>
+        <source>BLSURF_ALLOW_QUADRANGLES_TOOLTIP</source>
+        <translation type="unfinished">To generate quadrangle dominant mesh</translation>
+    </message>
+    <message>
+        <source>BLSURF_GEOMETRICAL_SIZE</source>
+        <translation> Taille géométrique </translation>
     </message>
     <message>
         <source>BLSURF_ANGLE_MESH</source>
@@ -138,6 +154,22 @@ Plus la distance est petite, plus le maillage sera proche de la surface (disponi
         <source>BLSURF_REMOVE_TINY_EDGES_TOOLTIP</source>
         <translation>Si activé, ce paramètre défini la longueur minimale sous laquelle une arête est considérée comme toute petite.</translation>
     </message>
+    <message>
+        <source>BLSURF_OPTIMISE_TINY_EDGES</source>
+        <translation type="unfinished">Optimize tiny edges</translation>
+    </message>
+    <message>
+        <source>BLSURF_OPTIMIZE_TINY_EDGES_TOOLTIP</source>
+        <translation type="unfinished">If checked, this parameter defines the minimal length under which an edge is considered to be a tiny one.</translation>
+    </message>
+    <message>
+        <source>BLSURF_SURFACE_INTERSECTIONS</source>
+        <translation type="unfinished">Correct surface intersections</translation>
+    </message>
+    <message>
+        <source>BLSURF_SURFACE_INTERSECTIONS_TOOLTIP</source>
+        <translation type="unfinished">If checked, this parameter defines the time that will be spent in the intersection prevention process.</translation>
+    </message>
     <message>
         <source>BLSURF_REMOVE_SLIVERS</source>
         <translation>Enlever les mauvais éléments</translation>
@@ -158,6 +190,10 @@ Plus la distance est petite, plus le maillage sera proche de la surface (disponi
         <source>BLSURF_ELEMENT_ORDER</source>
         <translation>Maillage quadratique</translation>
     </message>
+    <message>
+        <source>BLSURF_ELEMENT_ORDER_TOOLTIP</source>
+        <translation type="unfinished">To generate quadratic mesh</translation>
+    </message>
     <message>
         <source>BLSURF_HYPOTHESIS</source>
         <translation>MG-CADSurf 2D</translation>
@@ -211,11 +247,11 @@ Plus la distance est petite, plus le maillage sera proche de la surface (disponi
         <translation>Valeur</translation>
     </message>
     <message>
-        <source>OPTION_MENU_BLSURF</source>
-        <translation>MG-CADSurf</translation>
+        <source>BLSURF_MESHING_OPTIONS</source>
+        <translation>Meshing</translation>
     </message>
     <message>
-        <source>OPTION_MENU_PRECAD</source>
+        <source>BLSURF_PRECAD_OPTIONS</source>
         <translation>PreCAD</translation>
     </message>
     <message>
@@ -227,7 +263,7 @@ Plus la distance est petite, plus le maillage sera proche de la surface (disponi
         <translation>Effacer l&apos;option</translation>
     </message>
     <message>
-        <source>BLSURF_OTHER_OPTION</source>
+        <source>BLSURF_CUSTOM_OPTIONS</source>
         <translation>L&apos;autre option</translation>
     </message>
     <message>
@@ -559,4 +595,75 @@ Plus la distance est petite, plus le maillage sera proche de la surface (disponi
         <translation>Arête</translation>
     </message>
 </context>
+<context>
+    <name>BLSURFPluginGUI_AdvWidget</name>
+    <message>
+        <source>enforce_cad_edge_sizes</source>
+        <translation>enforce_cad_edge_sizes</translation>
+    </message>
+    <message>
+        <source>jacobian_rectification_respect_geometry</source>
+        <translation> Priorité de la géométrie sur le Jacobien</translation>
+    </message>
+    <message>
+        <source>max_number_of_points_per_patch</source>
+        <translation>Nombre de points maximal par patch</translation>
+    </message>
+    <message>
+        <source>rectify_jacobian</source>
+        <translation>Ajustement du Jacobien</translation>
+    </message>
+    <message>
+        <source>respect_geometry</source>
+        <translation>Respect de la géométrie</translation>
+    </message>
+    <message>
+        <source>tiny_edge_avoid_surface_intersections</source>
+        <translation>Priorité de l?intersection des surfaces sur le retrait des petites arêtes</translation>
+    </message>
+    <message>
+        <source>closed_geometry</source>
+        <translation>Géométrie fermée</translation>
+    </message>
+    <message>
+        <source>debug</source>
+        <translation>Deboggage</translation>
+    </message>
+    <message>
+        <source>discard_input_topology</source>
+        <translation>discard_input_topology</translation>
+    </message>
+    <message>
+        <source>merge_edges</source>
+        <translation>Fusion des arêtes</translation>
+    </message>
+    <message>
+        <source>periodic_tolerance</source>
+        <translation>Tolérance de périodicité</translation>
+    </message>
+    <message>
+        <source>remove_duplicate_cad_faces</source>
+        <translation>Suppression des faces doubles</translation>
+    </message>
+    <message>
+        <source>required_entities</source>
+        <translation>Entités requises</translation>
+    </message>
+    <message>
+        <source>sewing_tolerance</source>
+        <translation>Tolérance de fusion</translation>
+    </message>
+    <message>
+        <source>tags</source>
+        <translation>Etiquettes</translation>
+    </message>
+    <message>
+        <source>yes</source>
+        <translation>Actif</translation>
+    </message>
+    <message>
+        <source>no</source>
+        <translation>Inactif</translation>
+    </message>
+</context>
 </TS>
index 11722753e12156cf33cd961c329becc6c5676397..b42d57eef2141b3c611f1c3aa030748443f3fdfb 100644 (file)
@@ -58,7 +58,7 @@ SET(_link_LIBRARIES
   ${GEOM_GEOM}
   ${SMESH_SMESH}
   ${SMESH_SMESHEngine}
-  ${SMESH_GeomSelectionTools}
+  ${SMESH_PluginUtils}
   ${SMESH_StdMeshersGUI}
   ${SMESH_SMESHFiltersSelection}
   ${CAS_KERNEL}