]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
#17845 [EDF] Modifications of Automatic meshing
authoreap <eap@opencascade.com>
Tue, 22 Oct 2019 14:24:35 +0000 (17:24 +0300)
committereap <eap@opencascade.com>
Tue, 22 Oct 2019 14:24:35 +0000 (17:24 +0300)
32 files changed:
CMakeLists.txt
doc/salome/gui/SMESH/images/hypo_sets.png
doc/salome/gui/SMESH/images/pref21.png
doc/salome/gui/SMESH/input/constructing_meshes.rst
doc/salome/gui/SMESH/input/mesh_preferences.rst
idl/SMESH_Gen.idl
resources/CMakeLists.txt
resources/SalomeApp.xml.in
resources/StdMeshers.xml.in
resources/mesh_tree_hypo_import_source_1d.png [new file with mode: 0644]
resources/mesh_tree_hypo_import_source_2d.png [new file with mode: 0644]
resources/mesh_tree_hypo_layers_distribution_2d.png [new file with mode: 0644]
src/SMESH/SMESH_Hypothesis.hxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx
src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.h
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.h
src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx
src/SMESHGUI/SMESHGUI_MeshDlg.cxx
src/SMESHGUI/SMESHGUI_MeshDlg.h
src/SMESHGUI/SMESHGUI_MeshOp.cxx
src/SMESHGUI/SMESHGUI_MeshOp.h
src/SMESHGUI/SMESHGUI_XmlHandler.cxx
src/SMESHGUI/SMESH_msg_en.ts
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Gen_i.hxx
src/SMESH_I/SMESH_Gen_i_1.cxx
src/SMESH_SWIG/StdMeshersBuilder.py
src/SMESH_SWIG/smeshBuilder.py
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
src/StdMeshersGUI/StdMeshers_images.ts

index 147ce7f9df493958d17b857fc9e74916c8b5a669..1320fd7045250319f038f019992e0a5c59e5b225 100644 (file)
@@ -76,10 +76,11 @@ OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
 OPTION(SALOME_BUILD_DOC "Generate SALOME SMESH documentation" ON)
   
 # Advanced options:
-OPTION(SALOME_BUILD_GUI            "Enable GUI" ON)
-OPTION(SALOME_SMESH_USE_CGNS       "Enable import/export to CGNS format" OFF)
-OPTION(SALOME_SMESH_USE_TBB        "Enable parallel computation" OFF)
-OPTION(SALOME_SMESH_DYNLOAD_LOCAL  "Load plug-ins' symbols locally (Linux only)" ON)
+OPTION(SALOME_BUILD_GUI           "Enable GUI" ON)
+OPTION(SALOME_SMESH_USE_CGNS      "Enable import/export to CGNS format" OFF)
+OPTION(SALOME_SMESH_USE_TBB       "Enable parallel computation" OFF)
+OPTION(SALOME_SMESH_DYNLOAD_LOCAL "Load plug-ins' symbols locally (Linux only)" ON)
+OPTION(SMESH_USE_MESHGEMS_HYPOSET "Prefer MeshGems algorithms in sets of hypotheses" OFF)
 CMAKE_DEPENDENT_OPTION(SALOME_SMESH_BUILD_FRENCH_DOC "Generate SALOME SMESH French documentation" OFF
                        "SALOME_BUILD_DOC" OFF)
 
@@ -87,6 +88,12 @@ IF(SALOME_SMESH_DYNLOAD_LOCAL)
   ADD_DEFINITIONS(-DDYNLOAD_LOCAL)
 ENDIF(SALOME_SMESH_DYNLOAD_LOCAL)
 
+IF(SMESH_USE_MESHGEMS_HYPOSET)
+  SET(SMESH_USE_MESHGEMS_HYPOSET_VAR "true")
+ELSE(SMESH_USE_MESHGEMS_HYPOSET)
+  SET(SMESH_USE_MESHGEMS_HYPOSET_VAR "false")
+ENDIF(SMESH_USE_MESHGEMS_HYPOSET)
+
 #On Linux use Fortran to compile MEFISTO2D
 IF(NOT WIN32)
   ENABLE_LANGUAGE(Fortran)
@@ -94,7 +101,7 @@ IF(NOT WIN32)
   ADD_DEFINITIONS(-DENABLE_MEFISTO)
 ENDIF(NOT WIN32)
 
-MARK_AS_ADVANCED(SALOME_BUILD_GUI SALOME_SMESH_USE_CGNS SALOME_SMESH_USE_TBB SALOME_SMESH_DYNLOAD_LOCAL)
+MARK_AS_ADVANCED(SALOME_BUILD_GUI SALOME_SMESH_USE_CGNS SALOME_SMESH_USE_TBB SALOME_SMESH_DYNLOAD_LOCAL SMESH_USE_MESHGEMS_HYPOSET)
 
 # Prerequisites
 # =============
index 2a9859d231e9b79fe6e8de4d5611c00656334918..14af9af48a178f666fb66c0662ecc2328795ab82 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/hypo_sets.png and b/doc/salome/gui/SMESH/images/hypo_sets.png differ
index 1f5d63cf92ee2e0b0e7848f4546c6682c2959070..b0d756fd7f1fdb4713631ff7328fccde21706be3 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/pref21.png and b/doc/salome/gui/SMESH/images/pref21.png differ
index f5aca445734b3be786822858befb1c7d4acac3c5..05c4c0d39d08b42f9f1fb22f033f8577bc8ca75b 100644 (file)
@@ -160,7 +160,6 @@ To construct a mesh:
       List of sets of hypotheses. Tag *[custom]* is automatically added to the sets defined by the user.
 
    .. note::
-      * *"Automatic"* in the names of predefined sets of hypotheses does not actually mean that they are suitable for meshing any geometry.
       * The list of sets of hypotheses can be shorter than in the above image depending on the geometry dimension.
   
 
index 734011f1b2076ae2f04fcb79919439564d45a616..027518e91d6b510905319dae4486cbf590a23126 100644 (file)
@@ -101,6 +101,10 @@ General Preferences
 
   * **Default Number of Segments** - defines the default number of segments in :ref:`Number of Segments <number_of_segments_anchor>` hypothesis.
 
+.. _use_meshgems_pref:
+
+  * **Use MeshGems meshers when assigning set of hypotheses** - if activated, commercial meshers of MeshGems suite are used instead of a free mesher NETGEN when assigning a set of hypotheses in Create Mesh/Sub-mesh dialog.
+  
 * **Mesh loading**
 
   * **No mesh loading from study file at hypothesis modification** - if activated, the mesh data will not be loaded from the study file when a hypothesis is modified. This allows saving time by omitting loading data of a large mesh that is planned to be recomputed with other parameters.
index cdb800e87d8317736b0011750ccaa77662d669d5..4dbeb2ef0bc5d026aae1e7865c0f54c3e719127e 100644 (file)
@@ -116,6 +116,15 @@ module SMESH
   };
   typedef sequence<ComputeError> compute_error_array;
 
+  /*!
+   * Way to initialize hypothesis
+   */
+  struct HypInitParams
+  {
+    short   way; // 0 - by mesh, 1 - by geometry size + prefered parameters, 2 - by averageLength
+    double  averageLength;
+    boolean quadDominated;
+  };
 
   interface SMESH_Gen : Engines::EngineComponent, SALOMEDS::Driver
   {
@@ -175,7 +184,7 @@ module SMESH
                                                    in string            theLibName,
                                                    in SMESH_Mesh        theMesh,
                                                    in GEOM::GEOM_Object theGeom,
-                                                   in boolean           byMesh)
+                                                   in HypInitParams     theWay)
       raises ( SALOME::SALOME_Exception );
 
     /*!
index 7b880a7031b846ec630362dd6523b6c626c5094c..d0d99adcb9749d2d6e8040f210111b423a839b50 100644 (file)
 #
 
 SET(SMESH_RESOURCES_FILES
+  ModuleMesh.png
+  advanced_mesh_info.png
+  bare_border_face.png
+  bare_border_volume.png
+  copy_mesh.png
+  copy_mesh_with_geom.png
   delete.png
+  mesh.png
+  mesh_0D_elem.png
+  mesh_0D_on_all_nodes.png
+  mesh_2d_from_3d.png
+  mesh_add.png
   mesh_add_sub.png
   mesh_algo_hexa.png
   mesh_algo_mefisto.png
@@ -29,211 +40,203 @@ SET(SMESH_RESOURCES_FILES
   mesh_algo_regular.png
   mesh_algo_tetra.png
   mesh_angle.png
+  mesh_angle_measure.png
   mesh_area.png
   mesh_aspect.png
   mesh_aspect_3d.png
+  mesh_ball.png
   mesh_biquad_quadrangle.png
   mesh_biquad_triangle.png
+  mesh_bounding_box.png
+  mesh_build_compound.png
   mesh_choose.png
   mesh_choose_all.png
   mesh_clear.png
   mesh_compute.png
-  mesh_evaluate.png
-  mesh_order.png
+  mesh_conv_to_quad.png
+  mesh_cutGroups.png
+  mesh_cutquad.png
+  mesh_deflection.png
+  mesh_deleteGroups.png
   mesh_diagonal.png
+  mesh_duplicate_elem_only.png
+  mesh_duplicate_group_boundary.png
+  mesh_duplicate_nodes.png
+  mesh_duplicate_nodes_with_elem.png
   mesh_edit.png
-  mesh_hexa.png
-  mesh_hypo_area.png
-  mesh_hypo_length.png
-  mesh_hypo_segment.png
-  mesh_hypo_volume.png
-  mesh_hypo_edit.png
-  mesh_plus.png
-  mesh_minus.png
-  mesh_info.png
-  advanced_mesh_info.png
-  standard_mesh_info.png
+  mesh_edit_group.png
   mesh_elem_info.png
   mesh_equal_edge.png
   mesh_equal_face.png
   mesh_equal_node.png
   mesh_equal_volume.png
-  mesh_whatis.png
-  mesh_init.png
-  mesh_length.png
-  mesh_length_2d.png
+  mesh_evaluate.png
+  mesh_extmeth_face_offset.png
+  mesh_extmeth_node_offset.png
+  mesh_extmeth_surf_offset_smooth.png
+  mesh_extractGroup.png
+  mesh_extrusion.png
+  mesh_extrusionpath.png
+  mesh_face_groups_by_edges.png
   mesh_find_elem_by_point.png
   mesh_free_edges.png
   mesh_free_edges_2d.png
+  mesh_free_faces.png
   mesh_free_nodes.png
+  mesh_group.png
+  mesh_groups_from_gemetry.png
+  mesh_hexa.png
+  mesh_hide.png
+  mesh_hypo_area.png
+  mesh_hypo_edit.png
+  mesh_hypo_layer_distribution.png
+  mesh_hypo_length.png
+  mesh_hypo_segment.png
+  mesh_hypo_source_3d.png
+  mesh_hypo_source_edge.png
+  mesh_hypo_source_face.png
+  mesh_hypo_viscous_layers.png
+  mesh_hypo_volume.png
+  mesh_info.png
+  mesh_init.png
+  mesh_intersectGroups.png
+  mesh_length.png
+  mesh_length_2d.png
+  mesh_line.png
+  mesh_line_n.png
+  mesh_make_group.png
   mesh_max_element_length_2d.png
   mesh_max_element_length_3d.png
-  mesh_multi_edges.png
-  mesh_multi_edges_2d.png
-  mesh_line_n.png
-  mesh_line.png
+  mesh_measure_area.png
+  mesh_measure_basic_props.png
+  mesh_measure_length.png
+  mesh_measure_volume.png
+  mesh_merge_elements.png
+  mesh_merge_nodes.png
+  mesh_min_dist.png
+  mesh_minus.png
   mesh_move_node.png
   mesh_move_without_node.png
+  mesh_multi_edges.png
+  mesh_multi_edges_2d.png
+  mesh_node_to_point.png
   mesh_octahedron.png
+  mesh_offset.png
+  mesh_order.png
   mesh_orientation.png
-  mesh.png
+  mesh_pattern.png
+  mesh_pentahedron.png
   mesh_plugins_meshcut.png
+  mesh_plus.png
+  mesh_points.png
   mesh_polygon.png
   mesh_polyhedron.png
-  mesh_pyramid_n.png
+  mesh_precompute.png
   mesh_pyramid.png
-  mesh_quad_n.png
+  mesh_pyramid_n.png
   mesh_quad.png
+  mesh_quad_edge.png
+  mesh_quad_hexahedron.png
+  mesh_quad_n.png
+  mesh_quad_pentahedron.png
+  mesh_quad_polygon.png
+  mesh_quad_pyramid.png
+  mesh_quad_quadrangle.png
+  mesh_quad_tetrahedron.png
+  mesh_quad_triangle.png
   mesh_quadrangle_quadpref.png
   mesh_quadrangle_quadpref_reversed.png
   mesh_quadrangle_reduced.png
   mesh_quadrangle_standard.png
   mesh_quadrangle_triapref.png
+  mesh_quality.png
   mesh_rem_element.png
   mesh_rem_node.png
   mesh_rem_orphan_nodes.png
+  mesh_remove.png
+  mesh_renumbering_elements.png
+  mesh_renumbering_nodes.png
+  mesh_revolution.png
+  mesh_rotation.png
+  mesh_sew_bordertoside.png
+  mesh_sew_conform_freeborders.png
+  mesh_sew_freeborders.png
+  mesh_sew_sideelements.png
   mesh_shading.png
+  mesh_show.png
   mesh_shrink.png
   mesh_skew.png
+  mesh_smoothing.png
+  mesh_symmetry_axis.png
+  mesh_symmetry_plane.png
+  mesh_symmetry_point.png
   mesh_taper.png
   mesh_tetra.png
+  mesh_translation_points.png
+  mesh_translation_vector.png
+  mesh_tree_algo.png
+  mesh_tree_algo_0D.png
+  mesh_tree_algo_existing_2D.png
   mesh_tree_algo_hexa.png
   mesh_tree_algo_mefisto.png
   mesh_tree_algo_polygon.png
-  mesh_tree_algo.png
-  mesh_tree_algo_0D.png
+  mesh_tree_algo_prism.png
+  mesh_tree_algo_projection_2d.png
   mesh_tree_algo_quad.png
+  mesh_tree_algo_radial_prism.png
+  mesh_tree_algo_radial_quadrangle_1D2D.png
   mesh_tree_algo_regular.png
   mesh_tree_algo_tetra.png
+  mesh_tree_group.png
+  mesh_tree_group_on_filter.png
+  mesh_tree_hypo.png
   mesh_tree_hypo_area.png
+  mesh_tree_hypo_cartesian.png
+  mesh_tree_hypo_import_source_1d.png
+  mesh_tree_hypo_import_source_2d.png
+  mesh_tree_hypo_layers_distribution.png
+  mesh_tree_hypo_layers_distribution_2d.png
   mesh_tree_hypo_length.png
-  mesh_tree_hypo.png
+  mesh_tree_hypo_projection_2d.png
+  mesh_tree_hypo_projection_3d.png
+  mesh_tree_hypo_quadratic.png
   mesh_tree_hypo_segment.png
+  mesh_tree_hypo_source_3d_shape.png
+  mesh_tree_hypo_source_edge.png
+  mesh_tree_hypo_source_face.png
+  mesh_tree_hypo_viscous_layers.png
   mesh_tree_hypo_volume.png
-  mesh_tree_hypo_cartesian.png
-  mesh_tree_mesh.png
   mesh_tree_importedmesh.png
+  mesh_tree_mesh.png
+  mesh_tree_mesh_partial.png
   mesh_tree_mesh_warn.png
+  mesh_triangle.png
   mesh_triangle_n.png
   mesh_triquad_hexahedron.png
-  mesh_triangle.png
+  mesh_union2tri.png
+  mesh_unionGroups.png
+  mesh_uniontri.png
   mesh_update.png
-  mesh_vertex_n.png
   mesh_vertex.png
-  mesh_0D_elem.png
-  mesh_0D_on_all_nodes.png
+  mesh_vertex_n.png
   mesh_volume_3d.png
-  bare_border_volume.png
-  bare_border_face.png
-  over_constrained_volume.png
-  over_constrained_face.png
+  mesh_whatis.png
   mesh_wireframe.png
-  mesh_points.png
   mesh_wrap.png
-  mesh_group.png
-  mesh_tree_group.png
-  mesh_tree_group_on_filter.png
-  mesh_edit_group.png
-  mesh_make_group.png
-  mesh_groups_from_gemetry.png
-  mesh_union2tri.png
-  mesh_uniontri.png
-  mesh_cutquad.png
-  mesh_smoothing.png
-  mesh_renumbering_nodes.png
-  mesh_renumbering_elements.png
-  mesh_extrusion.png
-  mesh_extrusionpath.png
-  mesh_revolution.png
-  ModuleMesh.png
-  mesh_unionGroups.png
-  mesh_intersectGroups.png
-  mesh_cutGroups.png
-  mesh_deleteGroups.png
-  mesh_translation_vector.png
-  mesh_translation_points.png
-  mesh_rotation.png
-  mesh_symmetry_point.png
-  mesh_symmetry_axis.png
-  mesh_symmetry_plane.png
-  mesh_sew_freeborders.png
-  mesh_sew_conform_freeborders.png
-  mesh_sew_bordertoside.png
-  mesh_sew_sideelements.png
-  mesh_merge_nodes.png
-  mesh_merge_elements.png
-  select1.png
   open.png
-  mesh_pattern.png
-  mesh_pentahedron.png
+  over_constrained_face.png
+  over_constrained_volume.png
   pattern_sample_2d.png
   pattern_sample_3D.png
-  mesh_add.png
-  mesh_remove.png
-  mesh_quad_edge.png
-  mesh_quad_triangle.png
-  mesh_quad_quadrangle.png
-  mesh_quad_polygon.png
-  mesh_quad_tetrahedron.png
-  mesh_quad_pyramid.png
-  mesh_quad_pentahedron.png
-  mesh_quad_hexahedron.png
-  mesh_conv_to_quad.png
-  mesh_tree_hypo_layers_distribution.png
-  mesh_tree_algo_radial_prism.png
-  mesh_tree_algo_radial_quadrangle_1D2D.png
-  mesh_tree_algo_existing_2D.png
-  mesh_tree_algo_prism.png
-  mesh_tree_algo_projection_2d.png
-  mesh_hypo_source_edge.png
-  mesh_hypo_source_3d.png
-  mesh_hypo_layer_distribution.png
-  mesh_hypo_source_face.png
-  mesh_tree_hypo_source_face.png
-  mesh_tree_hypo_source_edge.png
-  mesh_tree_hypo_source_3d_shape.png
-  mesh_tree_hypo_projection_3d.png
-  mesh_tree_hypo_projection_2d.png
-  mesh_tree_hypo_quadratic.png
-  mesh_build_compound.png
-  copy_mesh.png
-  copy_mesh_with_geom.png
-  mesh_node_to_point.png
-  mesh_tree_mesh_partial.png
-  mesh_extractGroup.png
-  mesh_precompute.png
-  mesh_2d_from_3d.png
-  mesh_free_faces.png
+  reorient_faces_face.png
+  reorient_faces_point.png
+  reorient_faces_volume.png
   scale.png
   scale_along_axes.png
-  split_into_tetra.png
+  select1.png
   split_biquad.png
-  mesh_duplicate_nodes.png
-  mesh_duplicate_nodes_with_elem.png
-  mesh_duplicate_elem_only.png
-  mesh_duplicate_group_boundary.png
-  mesh_bounding_box.png
-  mesh_hypo_viscous_layers.png
-  mesh_tree_hypo_viscous_layers.png
-  mesh_min_dist.png
-  reorient_faces_point.png
-  reorient_faces_face.png
-  reorient_faces_volume.png
-  mesh_ball.png
-  mesh_measure_basic_props.png
-  mesh_measure_length.png
-  mesh_measure_area.png
-  mesh_measure_volume.png
-  mesh_extmeth_node_offset.png
-  mesh_extmeth_surf_offset_smooth.png
-  mesh_extmeth_face_offset.png
-  mesh_quality.png
-  mesh_show.png
-  mesh_hide.png
-  mesh_deflection.png
-  mesh_offset.png
-  mesh_face_groups_by_edges.png
-  mesh_angle_measure.png
+  split_into_tetra.png
+  standard_mesh_info.png
 )
 
 INSTALL(FILES ${SMESH_RESOURCES_FILES} DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA})
index b78f7a903e4c854df58309ea969cfa87d783a67c..4af56219a913e9b9c8307ba0a26f7ffee0aeed48 100644 (file)
@@ -76,6 +76,7 @@
     <parameter name="info_dump_ctrl"               value="true" />
     <parameter name="segmentation"                 value="10"/>
     <parameter name="nb_segments_per_edge"         value="15"/>
+    <parameter name="use-meshgems-hypo-sets"       value="@SMESH_USE_MESHGEMS_HYPOSET_VAR@"/>
     <parameter name="forget_mesh_on_hyp_modif"     value="true"/>
     <parameter name="quadratic_mode"               value="0"/>
     <parameter name="max_angle"                    value="2"/>
index 14ed93a0c9b0abefee7f9e86d5df842ed55b678a..bf2204b86b13cd491c805be214549da5d5fb62d2 100644 (file)
 
 <hypotheses-set-group>
 
-    <hypotheses-set name="Automatic Tetrahedralization"
-                    hypos="MaxLength"
-                    algos="Regular_1D, @MEFISTO2D_NAME@, NETGEN_3D"/>
-
-    <hypotheses-set name="Automatic Hexahedralization"
+    <hypotheses-set name="Tetrahedralization"
+                    use-common-size="true"
+                    hypos="MG-CADSurf Parameters"
+                    algos="MG-CADSurf, MG-Tetra"
+                    alt-hypos="NETGEN_Parameters"
+                    alt-algos="NETGEN_2D3D"
+                    intern-edge-hypos="LocalLength"
+                    intern-edge-algos="Regular_1D"/>
+
+    <hypotheses-set name="Mapped Hexahedralization"
                     hypos="NumberOfSegments"
                     algos="Regular_1D, Quadrangle_2D, Hexa_3D"/>
 
-    <hypotheses-set name="Automatic Triangulation"
-                    hypos="MaxLength"
-                    algos="Regular_1D, @MEFISTO2D_NAME@"/>
-
-    <hypotheses-set name="Automatic Quadrangulation"
+    <hypotheses-set name="Free Hexahedralization"
+                    use-common-size="true"
+                    hypos="MG-CADSurf Parameters"
+                    algos="MG-CADSurf, MG-Hexa"
+                    intern-edge-hypos="LocalLength"
+                    intern-edge-algos="Regular_1D"/>
+
+    <hypotheses-set name="Triangulation"
+                    use-common-size="true"
+                    hypos="MG-CADSurf Parameters"
+                    algos="MG-CADSurf"
+                    alt-hypos="NETGEN_Parameters_2D"
+                    alt-algos="NETGEN_2D"/>
+
+    <hypotheses-set name="Mapped Quadrangulation"
                     hypos="NumberOfSegments"
                     algos="Regular_1D, Quadrangle_2D"/>
 
+    <hypotheses-set name="Free Quadrangulation"
+                    use-common-size="true"
+                    quad-dominated="true"
+                    hypos="MG-CADSurf Parameters"
+                    algos="MG-CADSurf"
+                    alt-hypos="NETGEN_Parameters_2D"
+                    alt-algos="NETGEN_2D"/>
+
 </hypotheses-set-group>
 
 </meshers>
diff --git a/resources/mesh_tree_hypo_import_source_1d.png b/resources/mesh_tree_hypo_import_source_1d.png
new file mode 100644 (file)
index 0000000..8db6260
Binary files /dev/null and b/resources/mesh_tree_hypo_import_source_1d.png differ
diff --git a/resources/mesh_tree_hypo_import_source_2d.png b/resources/mesh_tree_hypo_import_source_2d.png
new file mode 100644 (file)
index 0000000..3d4e1e2
Binary files /dev/null and b/resources/mesh_tree_hypo_import_source_2d.png differ
diff --git a/resources/mesh_tree_hypo_layers_distribution_2d.png b/resources/mesh_tree_hypo_layers_distribution_2d.png
new file mode 100644 (file)
index 0000000..fb5082f
Binary files /dev/null and b/resources/mesh_tree_hypo_layers_distribution_2d.png differ
index d1301c452085ad858bf0829673a1845ae1364bac..520e724778660b118eed96874c23ee9da24eb53d 100644 (file)
@@ -95,11 +95,18 @@ public:
    */
   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape)=0;
 
+  enum InitWay { BY_MESH, BY_GEOM, BY_AVERAGE_LENGTH };
   struct TDefaults
   {
+    InitWay       _way;
     double        _elemLength;
     int           _nbSegments;
+    bool          _quadDominated;
+    double        _diagonal;
     TopoDS_Shape* _shape; // future shape of the mesh being created
+
+    TDefaults():
+      _way(BY_GEOM), _elemLength(0),_nbSegments(0),_quadDominated(false),_diagonal(0),_shape(0) {}
   };
   /*!
    * \brief Initialize my parameter values by default parameters.
index 82d159350f3e8b4aa4a6a9c70d2ddf44dc0e0672..deb3711c98137118d89efaf5052d15fffff3b381 100644 (file)
@@ -5211,6 +5211,7 @@ void SMESHGUI::createPreferences()
                              "SMESH", "nb_segments_per_edge" );
   setPreferenceProperty( nbSeg, "min", 1 );
   setPreferenceProperty( nbSeg, "max", 10000000 );
+  addPreference( tr( "PREF_USE_MESHGEMS_HYPOSET" ), segGroup, LightApp_Preferences::Bool, "SMESH", "use-meshgems-hypo-sets" );
 
   int loadGroup = addPreference( tr( "SMESH_PREF_MESH_LOADING" ), genTab );
   addPreference( tr( "PREF_FORGET_MESH_AT_HYP_MODIF" ), loadGroup, LightApp_Preferences::Bool,
index 6a0f17d332c3f0f7119ef456504d083d5120644b..9a939559b2a691b524037d2e544e826df25949d9 100644 (file)
@@ -206,7 +206,7 @@ LightApp_Dialog* SMESHGUI_GroupOnShapeOp::dlg() const
  */
 //================================================================================
 
-static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
+SMESH::ElementType SMESHGUI_GroupOnShapeOp::ElementType(GEOM::GEOM_Object_var geom)
 {
   if ( !geom->_is_nil() ) {
     switch ( geom->GetShapeType() ) {
@@ -232,7 +232,7 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
         GEOM::ListOfLong_var        ids = aGroupOp->GetObjects( geom );
         if ( ids->length() && !mainShape->_is_nil() && !aShapeOp->_is_nil() ) {
           GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( mainShape, ids[0] );
-          return elementType( member );
+          return ElementType( member );
         }
       }
     }
@@ -240,7 +240,7 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
       GEOM::ListOfLong_var ids = aShapeOp->SubShapeAllIDs( geom, GEOM::SHAPE, false );
       if ( ids->length() ) {
         GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( geom, ids[0] );
-        return elementType( member );
+        return ElementType( member );
       }
     }
   }
@@ -335,7 +335,7 @@ bool SMESHGUI_GroupOnShapeOp::onApply()
       if ( geom->_is_nil() ) continue;
 
       // group type
-      SMESH::ElementType elemType = isNode ? SMESH::NODE : elementType( geom );
+      SMESH::ElementType elemType = isNode ? SMESH::NODE : ElementType( geom );
       if ( elemType == SMESH::ALL )
         continue;
 
index 63d946b7a82bb186e5f2239d7b503945e68ec89b..f88e9bef52db6fce54bff68f43dca32caecc424e 100644 (file)
@@ -49,6 +49,7 @@ public:
 
     virtual LightApp_Dialog*    dlg() const;  
     static QString              GetDefaultName(const QString& theOperation);
+    static SMESH::ElementType   ElementType(GEOM::GEOM_Object_var geom);
 
 public slots:
 
index 5522e314482121f3d72f3a22183146998255fd73..2c22e5a54af5f2f388089a357ce9ad0535eddc31 100644 (file)
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_HypothesesUtils.h"
-#include "SMESHGUI_Utils.h"
 #include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESH_Actor.h"
+#include "SMESH_TypeDefs.hxx"
 
 // SALOME KERNEL includes
 #include <SALOMEDSClient_Study.hxx>
@@ -147,10 +148,14 @@ void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
     Dlg->setWindowTitle( caption() );
     Dlg->setObjectName( theHypName );
     Dlg->setHIcon( icon() );
-    Dlg->setType( type() );
+    if ( theHypName == HypothesesSet::getCommonHypoSetHypoType() )
+      Dlg->setType( tr( HypothesesSet::getCommonHypoSetHypoType()) );
+    else
+      Dlg->setType( type() );
     retrieveParams();
-    Dlg->show();
+    Dlg->show(); // w/o this Dlg blocks selection
     Dlg->resize( Dlg->minimumSizeHint() );
+    Dlg->exec(); // w/o this we cant wait until edition ends when applying a hypo-set
   }
   else {
     emit finished( QDialog::Accepted );
@@ -671,6 +676,14 @@ SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
   delete myCreator;
 }
 
+void SMESHGUI_HypothesisDlg::showEvent(QShowEvent *event)
+{
+  // resize( minimumSizeHint() );
+  // adjustSize();
+
+  QtxDialog::showEvent( event );
+}
+
 void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
 {
   if( f )
@@ -779,32 +792,44 @@ HypothesisData::HypothesisData( const QString&     theTypeName,
 {
 }
 
-HypothesesSet::HypothesesSet( const QString& theSetName )
-  : myHypoSetName( theSetName ),
-    myIsAlgo( false ),
-    myIsCustom( false )
-{
-}
-
-HypothesesSet::HypothesesSet( const QString&     theSetName,
-                              const QStringList& theHypoList,
-                              const QStringList& theAlgoList )
-  : myHypoSetName( theSetName ),
-    myHypoList( theHypoList ),
-    myAlgoList( theAlgoList ),
+// HypothesesSet::HypothesesSet( const QString& theSetName )
+//   : myHypoSetName( theSetName ),
+//     myIsAlgo( false ),
+//     myIsCustom( false )
+// {
+// }
+
+HypothesesSet::HypothesesSet( const QString& theSetName,
+                              bool useCommonSize, bool isQuadDominated,
+                              const QStringList& mainHypos, const QStringList& mainAlgos,
+                              const QStringList& altHypos,  const QStringList& altAlgos,
+                              const QStringList& intHypos,  const QStringList& intAlgos )
+  : myUseCommonSize( useCommonSize ),
+    myQuadDominated( isQuadDominated ),
+    myHypoSetName( theSetName ),
+    myHypoList({ mainHypos, altHypos, intHypos }),
+    myAlgoList({ mainAlgos, altAlgos, intAlgos }),
     myIsAlgo( false ),
-    myIsCustom( false )
+    myIsCustom( false ),
+    myIndex( 0 )
 {
+  for ( myHypType = MAIN; myHypType < NB_HYP_TYPES; SMESHUtils::Increment( myHypType ))
+    for ( int isAlgo = myIsAlgo = 0; isAlgo < 2; myIsAlgo = ++isAlgo )
+    {
+      QStringList& hyps = *list();
+      for ( int i = 0; i < hyps.count(); ++i )
+        hyps[ i ] = hyps[ i ].trimmed();
+    }
 }
 
-QStringList* HypothesesSet::list(bool is_algo) const
+QStringList* HypothesesSet::list( bool is_algo, SetType setType) const
 {
-  return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
+  return const_cast<QStringList*>( &( is_algo ? myAlgoList[setType] : myHypoList[setType] ));
 }
 
 QStringList* HypothesesSet::list() const
 {
-  return list( myIsAlgo );
+  return list( myIsAlgo, myHypType );
 }
 
 QString HypothesesSet::name() const
@@ -812,23 +837,24 @@ QString HypothesesSet::name() const
   return myHypoSetName;
 }
 
-void HypothesesSet::set( bool isAlgo, const QStringList& lst )
-{
-  *list(isAlgo) = lst;
-}
+// void HypothesesSet::set( bool isAlgo, const QStringList& lst )
+// {
+//   *list(isAlgo) = lst;
+// }
 
-int HypothesesSet::count( bool isAlgo ) const
-{
-  return list(isAlgo)->count();
-}
+// int HypothesesSet::count( bool isAlgo, SetType setType ) const
+// {
+//   return list(isAlgo,setType)->count();
+// }
 
-bool HypothesesSet::isAlgo() const
-{
-  return myIsAlgo;
-}
+// bool HypothesesSet::isAlgo() const
+// {
+//   return myIsAlgo;
+// }
 
-void HypothesesSet::init( bool isAlgo )
+void HypothesesSet::init( bool isAlgo, SetType setType )
 {
+  myHypType = setType;
   myIsAlgo = isAlgo;
   myIndex = 0;
 }
@@ -858,16 +884,43 @@ bool HypothesesSet::getIsCustom() const
   return myIsCustom;
 }
 
+void HypothesesSet::setAlgoAvailable( SetType type, bool isAvailable )
+{
+  if ( MAIN <= type && type < NB_HYP_TYPES )
+    myIsAlgoAvailable[ type ] = isAvailable;
+}
+
+bool HypothesesSet::getAlgoAvailable( SetType type )
+{
+  bool isAva = false;
+  if ( MAIN <= type && type < NB_HYP_TYPES )
+    isAva = myIsAlgoAvailable[ type ];
+  return isAva;
+}
+
+HypothesesSet::SetType HypothesesSet::getPreferredHypType()
+{
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+  int useAltHypos = !resMgr->booleanValue( "SMESH", "use-meshgems-hypo-sets", false );
+  return ( HypothesesSet::SetType ) useAltHypos;
+}
+
 int HypothesesSet::maxDim() const
 {
   HypothesesSet * thisSet = (HypothesesSet*) this;
   int dim = -1;
-  for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
-  {
-    for ( thisSet->init( isAlgo ); thisSet->more(); thisSet->next() )
-      if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
-        for ( int i = 0; i < hypData->Dim.count(); ++i )
-          dim = qMax( dim, hypData->Dim[i] );
-  }
+  for ( int setType = 0; setType < 2; ++setType )
+    for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
+    {
+      for ( thisSet->init( isAlgo, SetType( setType )); thisSet->more(); thisSet->next() )
+        if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
+          for ( int i = 0; i < hypData->Dim.count(); ++i )
+            dim = qMax( dim, hypData->Dim[i] );
+    }
   return dim;
 }
+
+const char* HypothesesSet::getCommonHypoSetHypoType()
+{
+  return "AverageLengthForHypoSet";
+}
index e75b8226294d510e1c76b08c16a4e73d322bf343..1543af914c29dd169ce77bf290d8e3a64f578790 100644 (file)
@@ -158,6 +158,7 @@ public:
   void setHIcon( const QPixmap& );
   void setCustomFrame( QFrame* );
   void setType( const QString& );
+  void showEvent(QShowEvent *event);
 
 protected slots:
   virtual void accept();
@@ -215,32 +216,53 @@ struct HypothesisData
 class HypothesesSet
 {
 public:
-  HypothesesSet( const QString& );
-  HypothesesSet( const QString&, const QStringList&, const QStringList& );
+
+  enum SetType { MAIN, ALT, INTERN, NB_HYP_TYPES }; //!< hypos/algos type: main, alternative, internal-edges
+
+  //HypothesesSet( const QString& );
+  HypothesesSet( const QString& name,
+                 bool useCommonSize, bool isQuadDominated,
+                 const QStringList& mainHypos, const QStringList& mainAlgos,
+                 const QStringList& altHypos, const QStringList&  altAlgos,
+                 const QStringList& intHypos, const QStringList&  intAlgos );
 
   QString name() const;
-  void set( bool, const QStringList& );
-  int count( bool ) const;
+  bool toUseCommonSize() const { return myUseCommonSize; }
+  bool isQuadDominated() const { return myQuadDominated; }
+  //int count( bool, SetType ) const;
+
+  int maxDim() const;
 
   void setIsCustom( bool );
   bool getIsCustom() const;
-  int maxDim() const;
 
-  bool isAlgo() const;
+  void setAlgoAvailable( SetType type, bool isAvailable );
+  bool getAlgoAvailable( SetType type );
+
+  static SetType getPreferredHypType();
+  static const char* getCommonHypoSetHypoType();
+
+  //bool isAlgo() const;
 
   // CASCADE-like iteration
-  void init( bool );
+  void init( bool, SetType );
   bool more() const;
   void next();
   QString current() const;
 
 private:
-  QStringList* list(bool) const;
+  QStringList* list(bool,SetType) const;
   QStringList* list() const;
 
 private:
+  bool        myUseCommonSize; // Average size is asked only and used to create default hypotheses
+  bool        myQuadDominated;
   QString     myHypoSetName;
-  QStringList myHypoList, myAlgoList;
+  QStringList myHypoList[3], myAlgoList[3]; // per SetType
+  bool        myIsAlgoAvailable[3]; // current state depending on geometry etc
+
+  // iteration
+  SetType myHypType;
   bool myIsAlgo, myIsCustom;
   int myIndex;
 };
index eaaad911c314d9fc2eda03b7dd3382a9b3215cb9..d752566db38822e9826dd8f432b324323de4b1e9 100644 (file)
@@ -329,8 +329,7 @@ namespace SMESH
         hypoSet != myListOfHypothesesSets.end();
         ++hypoSet ) {
       HypothesesSet* aSet = *hypoSet;
-      if ( aSet && ( aSet->count( true ) || aSet->count( false )) &&
-          aSet->maxDim() <= maxDim)
+      if ( aSet && 0 <= aSet->maxDim() && aSet->maxDim() <= maxDim )
       {
         aSetNameList.append( mangledHypoSetName( aSet ));
       }
index a1ee4ec9f25155bd38dbf39655f9181922fe8874..159343161f3dea1c8b4cc3707939fef98d719e09 100644 (file)
@@ -34,6 +34,7 @@
 #include <QtxToolButton.h>
 
 // Qt includes
+#include <QCheckBox>
 #include <QComboBox>
 #include <QCursor>
 #include <QGridLayout>
@@ -572,9 +573,12 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh
   // mesh type
   QLabel* anMeshTypeLbl = new QLabel( tr( "MESH_TYPE" ), this );
   myMeshType = new QComboBox( this );
-  
+  // groups
+  myCreateGroupsCheck = new QCheckBox( tr( "CREATE_ALL_GROUPS" ), this );
+  myCreateGroupsCheck->setChecked( true );
+
   // Create tab widget
-  
+
   myTabWg = new QTabWidget( mainFrame() );
   myTabs[ Dim0D ] = new SMESHGUI_MeshTab( myTabWg );
   myTabs[ Dim1D ] = new SMESHGUI_MeshTab( myTabWg );
@@ -608,9 +612,10 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh
   aLay->addWidget( objectWg( Geom, Control ), 2, 2 );
   aLay->addWidget( anMeshTypeLbl,             3, 0 );
   aLay->addWidget( myMeshType,                3, 2 );
-  aLay->addWidget( myTabWg,                   5, 0, 1, 3 );
-  aLay->addWidget( myHypoSetButton,           6, 0, 1, 3 );
-  aLay->setRowMinimumHeight( 3, 20 );
+  aLay->addWidget( myCreateGroupsCheck,       4, 0, 1, 3 );
+  aLay->addWidget( myTabWg,                   6, 0, 1, 3 );
+  aLay->addWidget( myHypoSetButton,           7, 0, 1, 3 );
+  aLay->setRowMinimumHeight( 4, 20 );
 
   myMeshType->clear();
 
@@ -658,7 +663,7 @@ void SMESHGUI_MeshDlg::setTitile( const bool theToCreate, const bool theIsMesh )
   {
     setWindowTitle( tr( theIsMesh ? "EDIT_MESH" : "EDIT_SUBMESH") );
   }
-  
+  myCreateGroupsCheck-> setVisible( theToCreate && theIsMesh );
 }
 
 //================================================================================
@@ -916,3 +921,14 @@ void SMESHGUI_MeshDlg::setCurrentMeshType( const int theIndex )
   else
     myMeshType->setCurrentIndex( 0 );
 }
+
+//================================================================================
+/*!
+ * \brief Return state of "Create all Groups on Geometry" check-box
+ */
+//================================================================================
+
+bool SMESHGUI_MeshDlg::toCreateAllGroups()
+{
+  return myCreateGroupsCheck->isChecked();
+}
index 3dd5b0697881a354d95c491b95af7a68883adebd..1cfb8762f698baf82f03f2dd0cba5b55763a115a 100644 (file)
 #include <QStringList>
 #include <QMap>
 
-class SMESHGUI_MeshTab;
 class QAction;
+class QCheckBox;
 class QComboBox;
 class QListWidget;
 class QMenu;
 class QTabWidget;
 class QToolButton;
 class QtxToolButton;
+class SMESHGUI_MeshTab;
 
 /*!
  * \brief Dialog for mech creation or editing
@@ -84,6 +85,8 @@ public:
   void                         setCurrentMeshType( const int );
   int                          currentMeshType();
 
+  bool                         toCreateAllGroups();
+
 signals:
   void                         hypoSet( const QString& );
   void                         geomSelectionByMesh( bool );
@@ -101,6 +104,7 @@ private slots:
   QToolButton*                 myHypoSetButton;
   QMenu*                       myGeomPopup;
   QComboBox*                   myMeshType;
+  QCheckBox*                   myCreateGroupsCheck;
 };
 
 /*!
index 443a8a86f6bb9273b22dd7bf384704d888d7a3ca..e232e408f20d6a09593c8c86e26d556523eb942a 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_GEOMGenUtils.h"
+#include "SMESHGUI_GroupOnShapeDlg.h"
 #include "SMESHGUI_Hypotheses.h"
 #include "SMESHGUI_HypothesesUtils.h"
 #include "SMESHGUI_MeshDlg.h"
 #include "SMESHGUI_ShapeByMeshDlg.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESH_NumberFilter.hxx"
+#include "SMESH_TypeDefs.hxx"
 #include "SMESH_TypeFilter.hxx"
 
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
 // SALOME GEOM includes
-#include <GEOM_SelectionFilter.h>
 #include <GEOMBase.h>
-#include <GeometryGUI.h>
-#include <GEOM_wrap.hxx>
 #include <GEOMImpl_Types.hxx>
+#include <GEOM_SelectionFilter.h>
+#include <GEOM_wrap.hxx>
+#include <GeometryGUI.h>
 
 // SALOME GUI includes
-#include <SalomeApp_Tools.h>
-#include <SalomeApp_Application.h>
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 #include <LightApp_UpdateFlags.h>
+#include <SALOME_InteractiveObject.hxx>
+#include <SALOME_ListIO.hxx>
 #include <SUIT_MessageBox.h>
 #include <SUIT_OverrideCursor.h>
+#include <SUIT_ResourceMgr.h>
 #include <SUIT_Session.h>
-#include <SALOME_InteractiveObject.hxx>
-#include <SALOME_ListIO.hxx>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Tools.h>
 
 // SALOME KERNEL includes
 #include <SALOMEDS_SComponent.hxx>
 #include <SALOMEDS_wrap.hxx>
 
 // Qt includes
-#include <QStringList>
-#include <QLineEdit>
 #include <QApplication>
+#include <QLineEdit>
+#include <QStringList>
 
 // OCCT includes
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopExp_Explorer.hxx>
 #include <BRep_Tool.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopoDS.hxx>
 
 //================================================================================
 /*!
@@ -183,6 +188,8 @@ bool SMESHGUI_MeshOp::onApply()
     SUIT_MessageBox::warning( myDlg, tr( "SMESH_ERROR" ), aMess );
   }
 
+  myHypoSet = 0;
+
   return aResult;
 }
 
@@ -257,6 +264,7 @@ void SMESHGUI_MeshOp::startOperation()
 
   selectionDone();
 
+  myHypoSet = 0;
   myHasConcurrentSubBefore = false;
   myObjectToSelect.clear();
 }
@@ -1022,8 +1030,9 @@ void SMESHGUI_MeshOp::existingHyps( const int       theDim,
  */
 //================================================================================
 SMESH::SMESH_Hypothesis_var
-SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
-                                          const QString& aServerLib ) const
+SMESHGUI_MeshOp::getInitParamsHypothesis( const QString&              aHypType,
+                                          const QString&              aServerLib,
+                                          const SMESH::HypInitParams* aParams ) const
 {
   if ( aHypType.isEmpty() || aServerLib.isEmpty() )
     return SMESH::SMESH_Hypothesis::_nil();
@@ -1083,18 +1092,42 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
     }
   }
 
+  SMESH::HypInitParams initParams;
+  enum { BY_MESH, BY_GEOM, BY_AVERAGE_LENGTH }; // same as ::SMESH_Hypothesis::InitWay
+  if ( aParams )
+  {
+    initParams = *aParams;
+  }
+  else
+  {
+    initParams.way = isSubMesh ? BY_MESH : BY_GEOM;
+  }
+
   SMESH::SMESH_Hypothesis_var hyp =
     SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toUtf8().data(),
                                                            aServerLib.toUtf8().data(),
                                                            aMesh,
                                                            aGeomVar,
-                                                           /*byMesh = */isSubMesh);
-  if ( hyp->_is_nil() && isSubMesh )
+                                                           initParams );
+  if ( hyp->_is_nil() && initParams.way == BY_MESH )
+  {
+    initParams.way = BY_GEOM;
+    hyp = SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(),
+                                                                 aServerLib.toUtf8().data(),
+                                                                 aMesh,
+                                                                 aGeomVar,
+                                                                 initParams );
+  }
+  if ( hyp->_is_nil() && initParams.way == BY_GEOM )
+  {
+    initParams.way = BY_AVERAGE_LENGTH;
+    initParams.averageLength = 1.;
     hyp = SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(),
                                                                  aServerLib.toUtf8().data(),
                                                                  aMesh,
                                                                  aGeomVar,
-                                                                 /*byMesh = */false);
+                                                                 initParams );
+  }
   return hyp;
 }
 
@@ -1221,25 +1254,14 @@ namespace
 
 //================================================================================
 /*!
- *  Create hypothesis and update dialog.
- *  \param theDim - dimension of hypothesis to be created
- *  \param theType - hypothesis category (algorithm, hypothesis, additional hypothesis)
- *  \param theTypeName - specifies hypothesis to be created
+ * \brief Return names of all existing hypotheses
  */
 //================================================================================
-void SMESHGUI_MeshOp::createHypothesis(const int theDim,
-                                       const int theType,
-                                       const QString& theTypeName)
-{
-  HypothesisData* aData = SMESH::GetHypothesisData(theTypeName);
-  if (!aData)
-    return;
-
-  myDim = theDim;
-  myType = theType;
 
-  // get a unique hyp name
+QStringList SMESHGUI_MeshOp::getHypoNames()
+{
   QStringList aHypNames;
+
   TDim2Type2HypList::const_iterator aDimIter = myExistingHyps.begin();
   for ( ; aDimIter != myExistingHyps.end(); aDimIter++) {
     const TType2HypList& aType2HypList = aDimIter.value();
@@ -1254,7 +1276,30 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
       }
     }
   }
-  QString aHypName = GetUniqueName( aHypNames, aData->Label);
+  return aHypNames;
+}
+
+//================================================================================
+/*!
+ *  Create hypothesis and update dialog.
+ *  \param theDim - dimension of hypothesis to be created
+ *  \param theType - hypothesis category (algorithm, hypothesis, additional hypothesis)
+ *  \param theTypeName - specifies hypothesis to be created
+ */
+//================================================================================
+void SMESHGUI_MeshOp::createHypothesis(const int      theDim,
+                                       const int      theType,
+                                       const QString& theTypeName)
+{
+  HypothesisData* aData = SMESH::GetHypothesisData(theTypeName);
+  if (!aData)
+    return;
+
+  myDim = theDim;
+  myType = theType;
+
+  // get a unique hyp name
+  QString aHypName = GetUniqueName( getHypoNames(), aData->Label);
 
   // existing hypos
   bool dialog = false;
@@ -1655,6 +1700,179 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
   return;
 }
 
+//================================================================================
+/*!
+ * \brief Create a sub-mesh on internal edges in the case where the global algorithm
+ *        is of type 1D-2D[-3D] so that the internal edges would remain not meshed.
+ */
+//================================================================================
+
+void SMESHGUI_MeshOp::createSubMeshOnInternalEdges( SMESH::SMESH_Mesh_ptr theMesh,
+                                                    GEOM::GEOM_Object_ptr theMainShape )
+{
+  if ( theMesh->_is_nil() || theMainShape->_is_nil() )
+    return;
+
+  if ( isAccessibleDim( 1 ))
+    return; // global 1D algorithm is/can be assigned
+
+  const HypothesesSet::SetType internSet = HypothesesSet::INTERN;
+  bool toCreate = true;
+  bool toCreateMandatory = ( myHypoSet &&
+                             myAverageSize > 0 &&
+                             ( myHypoSet->init( /*algo=*/ true, internSet ), myHypoSet->more()) &&
+                             ( myHypoSet->init( /*algo=*/false, internSet ), myHypoSet->more()));
+  if ( !toCreateMandatory ) // ask the user
+    toCreate = false; // can't pass both mesh and geometry to Create Submesh operation (so far?)
+    // toCreate = SUIT_MessageBox::warning( SMESHGUI::desktop(),
+    //                                      QObject::tr("SMESH_WRN_WARNING"),
+    //                                      QObject::tr("SMESH_CREATE_SUBMESH_ON_INTERNAL_EDGES"),
+    //                                      QObject::tr("SMESH_BUT_YES"),
+    //                                      QObject::tr("SMESH_BUT_NO"), 1, 0);
+  if ( !toCreate )
+    return;
+
+  TopoDS_Shape shape;
+  if ( !GEOMBase::GetShape( theMainShape, shape ))
+    return;
+
+  std::vector< TopoDS_Shape > internalEdges;
+  for ( TopExp_Explorer edge( shape, TopAbs_EDGE, TopAbs_WIRE ); edge.More(); edge.Next() )
+    internalEdges.push_back( edge.Current() );
+
+  if ( internalEdges.empty() )
+    return;
+
+  TopTools_IndexedMapOfShape shapeIDs;
+  TopExp::MapShapes( shape, shapeIDs );
+
+  std::set< int > intIDSet;
+  for ( size_t i = 0; i < internalEdges.size(); ++i )
+    intIDSet.insert( shapeIDs.FindIndex( internalEdges[ i ]));
+
+  GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
+  if (geomGen->_is_nil()) return;
+
+  GEOM::GEOM_Object_var edgeGroup;
+  GEOM::GEOM_IShapesOperations_wrap sOp = geomGen->GetIShapesOperations();
+  GEOM::GEOM_IGroupOperations_wrap  gOp = geomGen->GetIGroupOperations();
+  GEOM::ListOfGO_var         geomGroups = sOp->GetExistingSubObjects( theMainShape,
+                                                                      /*groupsOnly=*/true );
+  for ( CORBA::ULong i = 0; i < geomGroups->length(); ++i )
+  {
+    GEOM::ListOfLong_var ids = gOp->GetObjects( geomGroups[ i ]);
+    std::set< int > idSet( & ids[0], & ids[0] + ids->length() );
+    if ( idSet == intIDSet )
+    {
+      edgeGroup = geomGroups[ i ];
+      break;
+    }
+  }
+
+  if ( edgeGroup->_is_nil() )
+  {
+    GEOM::GEOM_Object_var edgeGroup = gOp->CreateGroup( theMainShape, TopAbs_EDGE );
+
+    GEOM::ListOfLong_var edgeIDs = new GEOM::ListOfLong;
+    edgeIDs->length( internalEdges.size() );
+    std::set< int >::iterator id = intIDSet.begin();
+    for ( size_t i = 0; i < intIDSet.size(); ++i, ++id )
+      edgeIDs[ i ] = *id;
+    gOp->UnionIDs( edgeGroup, edgeIDs );
+
+    SALOMEDS::SObject_wrap so = geomGen->AddInStudy( edgeGroup, "Internal edges", theMainShape );
+  }
+
+  if ( !toCreateMandatory )
+  {
+    // show Create Sub-mesh dislog
+    // _PTR(SObject) aMeshSO = SMESH::FindSObject( theMesh );
+    // selectionMgr()->clearFilters();
+    // selectObject( pSubmesh );
+    // SMESHGUI::GetSMESHGUI()->switchToOperation( SMESHOp::OpEditMeshOrSubMesh );
+    return;
+  }
+
+  // create a sub-mesh using myAverageSize w/o GUI
+
+  SMESH::SMESH_subMesh_var subMesh = theMesh->GetSubMesh( edgeGroup, "" );
+
+  for ( int isAlgo = 1; isAlgo >= 0; --isAlgo )
+    for ( myHypoSet->init( isAlgo, internSet ); myHypoSet->more(); myHypoSet->next() )
+    {
+      QString    aHypoTypeName = myHypoSet->current();
+      HypothesisData* aHypData = SMESH::GetHypothesisData( aHypoTypeName );
+      if ( !aHypData )
+        continue;
+
+      myDim = aHypData->Dim[0];
+      if ( myDim != 1 )
+        continue;
+
+      // create or/and set
+      SMESH::SMESH_Hypothesis_var newHypo;
+      if ( isAlgo )
+      {
+        myAvailableHypData[ myDim ][ Algo ].clear();
+        myAvailableHypData[ myDim ][ Algo ] << aHypData;
+        QStringList hypList; hypList << aHypoTypeName;
+        myDlg->tab( myDim )->setAvailableHyps( Algo, hypList );
+        setCurrentHyp( myDim, Algo, 0 );
+        newHypo = getAlgo( myDim );
+      }
+      else
+      {
+        SMESH::HypInitParams params = { 2, myAverageSize, false };
+        newHypo = getInitParamsHypothesis( aHypData->TypeName, aHypData->ServerLibName, & params );
+        QString hypName = GetUniqueName( getHypoNames(), aHypData->Label );
+        SALOMEDS::SObject_wrap so =
+          SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(), newHypo,
+                                                   hypName.toUtf8().data() );
+      }
+      SMESH::AddHypothesisOnSubMesh( subMesh, newHypo );
+    }
+
+  return;
+}
+
+//================================================================================
+/*!
+ * \brief Ask the user to enter an average size which will be used to create
+ *        hypotheses of a hypo-set basing on this size
+ *  \param [out] averageSize - average element size
+ *  \return bool - false if the user canceled the dialog
+ */
+//================================================================================
+
+bool SMESHGUI_MeshOp::getAverageSize( double & averageSize )
+{
+  HypothesisData* hypData = SMESH::GetHypothesisData( "MaxLength" );
+  if ( !hypData )
+    return false;
+
+  SMESH::SMESH_Hypothesis_var hyp = getInitParamsHypothesis( hypData->TypeName,
+                                                             hypData->ServerLibName );
+  if ( hyp->_is_nil() )
+    return false;
+
+  SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator( hypData->TypeName );
+  if ( !aCreator )
+    return false;
+  
+  initHypCreator( aCreator );
+  myDlg->setEnabled( false );
+
+  aCreator->edit( hyp.in(), HypothesesSet::getCommonHypoSetHypoType(),
+                  dlg(), this, SLOT( onHypoEdited( int )));
+
+  StdMeshers::StdMeshers_MaxLength_var lenHyp = StdMeshers::StdMeshers_MaxLength::_narrow( hyp );
+  if ( lenHyp->_is_nil() )
+    return false;
+
+  averageSize = lenHyp->GetLength();
+  return true;
+}
+
 //================================================================================
 /*!
  * \brief Creates and selects hypothesis of hypotheses set
@@ -1664,6 +1882,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
 void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
 {
   HypothesesSet* aHypoSet = SMESH::GetHypothesesSet(theSetName);
+  myHypoSet = aHypoSet;
   if (!aHypoSet)
     return;
 
@@ -1676,38 +1895,68 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
     onAlgoSelected( -1, dim );
   }
 
+  HypothesesSet::SetType setType = aHypoSet->getPreferredHypType();
+  if ( !aHypoSet->getAlgoAvailable( setType ))
+  {
+    setType = setType == HypothesesSet::ALT ? HypothesesSet::MAIN : HypothesesSet::ALT;
+    if ( !aHypoSet->getAlgoAvailable( setType ))
+      return;
+  }
+
+  myAverageSize = -1;
+  if ( aHypoSet->toUseCommonSize() && !getAverageSize( myAverageSize ))
+    return;
+
   for ( int isAlgo = 1; isAlgo >= 0; --isAlgo )
-    for ( aHypoSet->init( isAlgo ); aHypoSet->more(); aHypoSet->next() )
+    for ( aHypoSet->init( isAlgo, setType ); aHypoSet->more(); aHypoSet->next() )
     {
       QString    aHypoTypeName = aHypoSet->current();
       HypothesisData* aHypData = SMESH::GetHypothesisData( aHypoTypeName );
       if (!aHypData)
         continue;
 
-      int aDim = aHypData->Dim[0];
+      myDim = aHypData->Dim[0];
       // create or/and set
       if ( isAlgo )
       {
-        int index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
+        int index = myAvailableHypData[myDim][Algo].indexOf( aHypData );
         if ( index >= 0 )
         {
-          setCurrentHyp( aDim, Algo, index );
-          onAlgoSelected( index, aDim );
+          setCurrentHyp( myDim, Algo, index );
+          onAlgoSelected( index, myDim );
         }
       }
       else
       {
-        bool mainHyp = true;
-        int index = myAvailableHypData[aDim][MainHyp].indexOf( aHypData );
+        myType = MainHyp;
+        int index = myAvailableHypData[myDim][MainHyp].indexOf( aHypData );
         if ( index < 0 )
         {
-          mainHyp = false;
-          index = myAvailableHypData[aDim][AddHyp].indexOf( aHypData );
+          myType = AddHyp;
+          index = myAvailableHypData[myDim][AddHyp].indexOf( aHypData );
         }
         if ( index >= 0 )
-          createHypothesis( aDim, mainHyp ? MainHyp : AddHyp, aHypoTypeName );
+        {
+          if ( myAverageSize > 0 )
+          {
+            SMESH::HypInitParams params = { 2, myAverageSize, aHypoSet->isQuadDominated() };
+            SMESH::SMESH_Hypothesis_var hyp =
+              getInitParamsHypothesis( aHypData->TypeName, aHypData->ServerLibName, & params );
+
+            QString hypName = GetUniqueName( getHypoNames(), aHypData->Label );
+            SALOMEDS::SObject_wrap so =
+              SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(), hyp,
+                                                       hypName.toUtf8().data() );
+            onHypoCreated(2);
+          }
+          else
+          {
+            createHypothesis( myDim, myType, aHypoTypeName );
+          }
+        }
       }
     }
+
   return;
 }
 
@@ -1755,7 +2004,7 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
       namePrefix += "_";
   }
   QStringList::Iterator it = aList.begin();
-  for ( int i = 0; it!=aList.end(); it++, ++i )
+  for ( int i = 0; it != aList.end(); it++, ++i )
   {
     QString aGeomEntry = *it;
     _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toUtf8().data() );
@@ -1801,7 +2050,34 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
       if ( !anAlgoVar->_is_nil() )
         SMESH::AddHypothesisOnMesh( aMesh, anAlgoVar );
     }
+
+
+    if ( myDlg->toCreateAllGroups() && !aGeomVar->_is_nil() )
+    {
+      // Create groups on all geom groups
+
+      GEOM::GEOM_Gen_var           geomGen = SMESH::GetGEOMGen();
+      GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
+      GEOM::ListOfGO_var        geomGroups = op->GetExistingSubObjects( aGeomVar,
+                                                                        /*groupsOnly=*/true );
+      SMESH::SMESH_GroupOnGeom_var meshGroup;
+      for ( CORBA::ULong iG = 0; iG < geomGroups->length(); ++iG )
+      {
+        SMESH::ElementType elemType = SMESHGUI_GroupOnShapeOp::ElementType( geomGroups[ iG ] );
+        if ( elemType == SMESH::ALL )
+          continue;
+
+        CORBA::String_var name = geomGroups[ iG ]->GetName();
+        meshGroup = aMesh->CreateGroupFromGEOM( elemType, name, geomGroups[ iG ]);
+        if ( elemType != SMESH::NODE )
+          meshGroup = aMesh->CreateGroupFromGEOM( SMESH::NODE, name, geomGroups[ iG ]);
+      }
+    }
+
+    createSubMeshOnInternalEdges( aMesh, aGeomVar );
+
   }
+
   return true;
 }
 
@@ -2435,6 +2711,12 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
     }
   }
 
+  if ( aSubMeshVar->_is_nil() )
+  {
+    GEOM::GEOM_Object_var mainGeom = aMesh->GetShapeToMesh();
+    createSubMeshOnInternalEdges( aMesh, mainGeom );
+  }
+
   myHasConcurrentSubBefore =
     checkSubMeshConcurrency( aMesh, aSubMeshVar, /*askUser=*/!myHasConcurrentSubBefore );
 
@@ -2635,23 +2917,29 @@ void SMESHGUI_MeshOp::updateHypoSets()
   for ( ; inHypoSetName != aHypothesesSetsList.end(); ++inHypoSetName )
   {
     HypothesesSet* currentHypoSet = SMESH::GetHypothesesSet( *inHypoSetName );
-    bool isAvailable = false;
-    for ( currentHypoSet->init( true ); currentHypoSet->more(); currentHypoSet->next() )
+    HypothesesSet::SetType sType;
+    for ( sType = HypothesesSet::MAIN; sType <= HypothesesSet::ALT; SMESHUtils::Increment( sType ))
     {
-      isAvailable = false;
-      if ( HypothesisData* algoDataIn = SMESH::GetHypothesisData( currentHypoSet->current() )) {
-        for (int i = SMESH::DIM_0D; i <= myMaxShapeDim; i++) {
-          int aCurrentAvailableAlgo = myAvailableHypData[i][Algo].indexOf( algoDataIn );
-          if ( aCurrentAvailableAlgo > -1 ) {
-            isAvailable = true;
-            break;
+      bool isAvailable = false;
+      for ( currentHypoSet->init( true, sType ); currentHypoSet->more(); currentHypoSet->next() )
+      {
+        isAvailable = false;
+        if ( HypothesisData* algoDataIn = SMESH::GetHypothesisData( currentHypoSet->current() )) {
+          for ( int dim = SMESH::DIM_0D; dim <= myMaxShapeDim; dim++) {
+            int aCurrentAvailableAlgo = myAvailableHypData[dim][Algo].indexOf( algoDataIn );
+            if ( aCurrentAvailableAlgo > -1 ) {
+              isAvailable = true;
+              break;
+            }
           }
+          if ( !isAvailable )
+            break;
         }
-        if ( !isAvailable )
-          break;
       }
+      currentHypoSet->setAlgoAvailable( sType, isAvailable );
     }
-    if ( isAvailable )
+    if ( currentHypoSet->getAlgoAvailable( HypothesesSet::MAIN ) ||
+         currentHypoSet->getAlgoAvailable( HypothesesSet::ALT ))
       aFilteredHypothesesSetsList.append( *inHypoSetName );
   }
   myDlg->setHypoSets( aFilteredHypothesesSetsList );
index d93e4a12e19b9f007a21a60028f9d8ef79155628..1a117d53f8e0316e5005a7a5de76a66a66fc2cf6 100644 (file)
@@ -121,6 +121,8 @@ private:
   bool                           createMesh( QString&, QStringList& );
   bool                           createSubMesh( QString&, QStringList& );
   bool                           editMeshOrSubMesh( QString& );
+  void                           createSubMeshOnInternalEdges( SMESH::SMESH_Mesh_ptr mesh,
+                                                               GEOM::GEOM_Object_ptr mainShape );
   bool                           checkSubMeshConcurrency( SMESH::SMESH_Mesh_ptr    mesh,
                                                           SMESH::SMESH_subMesh_ptr submesh,
                                                           bool                     askUser=false);
@@ -137,8 +139,10 @@ private:
   int                            find( const SMESH::SMESH_Hypothesis_var&,
                                        const THypList& ) const;
   SMESH::SMESH_Hypothesis_var    getInitParamsHypothesis( const QString&,
-                                                          const QString& ) const;
+                                                          const QString&,
+                                                          const SMESH::HypInitParams* prm=0) const;
   void                           initHypCreator( SMESHGUI_GenericHypothesisCreator* aCreator );
+  bool                           getAverageSize( double & averageSize );
   bool                           isSubshapeOk() const;
   char*                          isSubmeshIgnored() const;
   _PTR(SObject)                  getSubmeshByGeom() const;
@@ -146,6 +150,7 @@ private:
   void                           updateMeshTypeList();
   void                           updateHypoSets();
   void                           setFilteredAlgoData();
+  QStringList                    getHypoNames();
 
 private:
 
@@ -172,6 +177,9 @@ private:
   bool                           myIgnoreAlgoSelection;
   int                            myDim, myType, myMaxShapeDim;
 
+  HypothesesSet*                 myHypoSet; // applied hypo-set
+  double                         myAverageSize; // entered at hypo-set processing
+
   QString                        myObjectToSelect;
 };
 
index 823032fca14b18ffee769ab2c08aea27752bcd19..3993633be21d0ae4b6a336a235b94ff14c58fce9 100644 (file)
@@ -201,14 +201,26 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&,
   {
     if (atts.value("name") != "")
     {
-      QString hypos = atts.value("hypos").remove( ' ' );
-      QString algos = atts.value("algos").remove( ' ' );
+      bool   useCommonSize = ( atts.value("use-common-size") == "true" );
+      bool isQuadDominated = ( atts.value("quad-dominated")  == "true" );
+      QString    hypos = atts.value("hypos");
+      QString    algos = atts.value("algos");
+      QString altHypos = atts.value("alt-hypos");
+      QString altAlgos = atts.value("alt-algos");
+      QString intHypos = atts.value("intern-edge-hypos");
+      QString intAlgos = atts.value("intern-edge-algos");
       bool badSet = hypos.contains( BAD_HYP_FLAG ) || algos.contains( BAD_HYP_FLAG );
 
       if ( !badSet )
-        myListOfHypothesesSets.append( new HypothesesSet ( atts.value("name"),
-                                                           hypos.split( ',', QString::SkipEmptyParts ),
-                                                           algos.split( ',', QString::SkipEmptyParts ) ) );
+        myListOfHypothesesSets.append
+          ( new HypothesesSet ( atts.value("name"),
+                                useCommonSize, isQuadDominated,
+                                hypos.split   ( ',', QString::SkipEmptyParts ),
+                                algos.split   ( ',', QString::SkipEmptyParts ),
+                                altHypos.split( ',', QString::SkipEmptyParts ),
+                                altAlgos.split( ',', QString::SkipEmptyParts ),
+                                intHypos.split( ',', QString::SkipEmptyParts ),
+                                intAlgos.split( ',', QString::SkipEmptyParts )));
     }
   }
   else if ( qName == "python-wrap" ||
index 725431f1cdb6935d2ff0386f513377c03ed72c0b..a998e9d1dd69e7cb4166b65f67c1620af72cecc6 100644 (file)
@@ -4659,6 +4659,10 @@ Please, create VTK viewer and try again</translation>
         <source>PREF_NB_SEGMENTS</source>
         <translation>Default Number of Segments</translation>
     </message>
+    <message>
+        <source>PREF_USE_MESHGEMS_HYPOSET</source>
+        <translation>Use MeshGems meshers when assigning set of hypotheses</translation>
+    </message>
     <message>
         <source>SMESH_PREF_MESH_LOADING</source>
         <translation>Mesh loading</translation>
@@ -6516,6 +6520,10 @@ Please specify them and try again</translation>
         <source>NAME</source>
         <translation>Name</translation>
     </message>
+    <message>
+        <source>CREATE_ALL_GROUPS</source>
+        <translation>Create all Groups on Geometry</translation>
+    </message>
 </context>
 <context>
     <name>SMESHGUI_MeshOp</name>
@@ -8480,4 +8488,11 @@ red in the Object Browser.</translation>
         <translation>Option value</translation>
     </message>
 </context>
+<context>
+    <name>SMESHGUI_GenericHypothesisCreator</name>
+    <message>
+        <source>AverageLengthForHypoSet</source>
+        <translation>Mean Size</translation>
+    </message>
+</context>
 </TS>
index 7b403d9aabe014de939e7796469af2285351e8c5..5e667ac57abb785077d547b9b8879f8a990c9e51 100644 (file)
@@ -764,14 +764,16 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::CreateHypothesis( const char* theHypNam
 //================================================================================
 
 SMESH::SMESH_Hypothesis_ptr
-SMESH_Gen_i::GetHypothesisParameterValues (const char*           theHypType,
-                                           const char*           theLibName,
-                                           SMESH::SMESH_Mesh_ptr theMesh,
-                                           GEOM::GEOM_Object_ptr theGeom,
-                                           CORBA::Boolean        byMesh)
+SMESH_Gen_i::GetHypothesisParameterValues (const char*                 theHypType,
+                                           const char*                 theLibName,
+                                           SMESH::SMESH_Mesh_ptr       theMesh,
+                                           GEOM::GEOM_Object_ptr       theGeom,
+                                           const SMESH::HypInitParams& theParams)
   throw ( SALOME::SALOME_Exception )
 {
   Unexpect aCatch(SALOME_SalomeException);
+
+  const bool byMesh = ( theParams.way == ::SMESH_Hypothesis::BY_MESH );
   if ( byMesh && CORBA::is_nil( theMesh ) )
     return SMESH::SMESH_Hypothesis::_nil();
   if ( byMesh && CORBA::is_nil( theGeom ) )
@@ -826,17 +828,23 @@ SMESH_Gen_i::GetHypothesisParameterValues (const char*           theHypType,
     if ( hyp->SetParametersByMesh( mesh, shape ))
       return SMESH::SMESH_Hypothesis::_duplicate( tmpHyp );
   }
-  else {
-    double diagonal = 0;
-    if ( mesh )
-      diagonal = mesh->GetShapeDiagonalSize();
-    else
-      diagonal = ::SMESH_Mesh::GetShapeDiagonalSize( shape );
+  else
+  {
     ::SMESH_Hypothesis::TDefaults dflts;
-    dflts._elemLength = diagonal / myGen.GetBoundaryBoxSegmentation();
-    dflts._nbSegments = myGen.GetDefaultNbSegments();
-    dflts._shape      = &shape;
-    // let the temporary hypothesis initialize it's values
+    dflts._way           = ( ::SMESH_Hypothesis::InitWay) theParams.way;
+    dflts._nbSegments    = myGen.GetDefaultNbSegments();
+    dflts._elemLength    = theParams.averageLength;
+    dflts._quadDominated = theParams.quadDominated;
+    if ( theParams.way == ::SMESH_Hypothesis::BY_GEOM )
+    {
+      if ( mesh )
+        dflts._diagonal  = mesh->GetShapeDiagonalSize();
+      else
+        dflts._diagonal  = ::SMESH_Mesh::GetShapeDiagonalSize( shape );
+      dflts._elemLength  = dflts._diagonal / myGen.GetBoundaryBoxSegmentation();
+      dflts._shape       = &shape;
+    }
+    // let the hypothesis initialize it's values
     if ( hyp->SetParametersByDefaults( dflts, mesh ))
       return SMESH::SMESH_Hypothesis::_duplicate( tmpHyp );
   }
index 52cd172b484f98d1d2632e8233361d0c8e92a4f8..0952fd1325029369704feaa62e936a135cf27ba0 100644 (file)
@@ -164,11 +164,11 @@ public:
     throw ( SALOME::SALOME_Exception );
 
   // Return hypothesis of given type holding parameter values of the existing mesh
-  SMESH::SMESH_Hypothesis_ptr GetHypothesisParameterValues (const char*           theHypType,
-                                                            const char*           theLibName,
-                                                            SMESH::SMESH_Mesh_ptr theMesh,
-                                                            GEOM::GEOM_Object_ptr theGeom,
-                                                            CORBA::Boolean        byMesh)
+  SMESH::SMESH_Hypothesis_ptr GetHypothesisParameterValues (const char*                 theHypType,
+                                                            const char*                 theLibName,
+                                                            SMESH::SMESH_Mesh_ptr       theMesh,
+                                                            GEOM::GEOM_Object_ptr       theGeom,
+                                                            const SMESH::HypInitParams& theWay)
     throw ( SALOME::SALOME_Exception );
 
   /*
index 1d7301ffe8b59f524767d6d77671cbf5ea5b026a..93848d56fb111532279458b4b64a3e85465f983c 100644 (file)
@@ -839,21 +839,25 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SMESH::SMESH_Mesh_ptr  theMesh,
         SetName( aRootSO, aRootNames[aType] );
 
       // Add new group to corresponding sub-tree
-      int isEmpty = false;
+      int isEmpty = ( theMesh->NbNodes() == 0 );
       std::string pm[2] = { "ICON_SMESH_TREE_GROUP", "ICON_SMESH_TREE_MESH_WARN" };
-      if ( SMESH::DownCast< SMESH_GroupOnFilter_i* > ( theGroup ))
-      {
-        pm[0] = "ICON_SMESH_TREE_GROUP_ON_FILTER";
-      }
-      else if ( SMESH::DownCast< SMESH_Group_i* > ( theGroup ))
+      if ( !isEmpty )
       {
-        if ( theGroup->GetType() == SMESH::NODE )
-          isEmpty = ( theMesh->NbNodes() == 0 );
-        else
+        if ( SMESH::DownCast< SMESH_GroupOnFilter_i* > ( theGroup )) // on filter
         {
-          SMESH::array_of_ElementType_var allElemTypes = theMesh->GetTypes();
-          for ( size_t i =0; i < allElemTypes->length() && isEmpty; ++i )
-            isEmpty = ( allElemTypes[i] != theGroup->GetType() );
+          pm[0] = "ICON_SMESH_TREE_GROUP_ON_FILTER";
+
+          if ( theGroup->GetType() != SMESH::NODE )
+          {
+            isEmpty = true;
+            SMESH::array_of_ElementType_var allElemTypes = theMesh->GetTypes();
+            for ( size_t i =0; i < allElemTypes->length() && isEmpty; ++i )
+              isEmpty = ( allElemTypes[i] != theGroup->GetType() );
+          }
+        }
+        else // standalone or on geometry
+        {
+          isEmpty = ( theGroup->Size() == 0 );
         }
       }
       aGroupSO = publish ( theGroup, aRootSO, 0, pm[isEmpty].c_str() );
@@ -873,14 +877,14 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SMESH::SMESH_Mesh_ptr  theMesh,
 
 //=======================================================================
 //function : PublishHypothesis
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 SALOMEDS::SObject_ptr
-  SMESH_Gen_i::PublishHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp,
-                                  const char*                 theName)
+SMESH_Gen_i::PublishHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp,
+                                const char*                 theName)
 {
-  if(MYDEBUG) MESSAGE("PublishHypothesis")
+  if(MYDEBUG) MESSAGE("PublishHypothesis");
   if ( !myIsEnablePublish )
     return SALOMEDS::SObject::_nil();
   if (theHyp->_is_nil())
index 858820238ad520dc15547e89a0b6bbd581b030d3..0c4241384f6e5686b267ef4555091d4acf37c994 100644 (file)
@@ -174,10 +174,11 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
             hyp.SetLength(length)
         if not UseExisting:
             # set preestimated length
+            import SMESH
             gen = self.mesh.smeshpyD
             initHyp = gen.GetHypothesisParameterValues("MaxLength", "libStdMeshersEngine.so",
                                                        self.mesh.GetMesh(), self.mesh.GetShape(),
-                                                       False) # <- byMesh
+                                                       SMESH.HypInitParams( 1, 1.0, False ))
             preHyp = initHyp._narrow(StdMeshers.StdMeshers_MaxLength)
             if preHyp:
                 hyp.SetPreestimatedLength( preHyp.GetPreestimatedLength() )
index df65f685f28da4cca6393f06636cde752b8d74c9..e843ff1680e695aca305bfe6244a96113a08826a 100644 (file)
@@ -1250,6 +1250,27 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
 
         return hyp
 
+    def GetHypothesisParameterValues( self, hypType, libName, mesh, shape, initParams ):
+        """
+        Create hypothesis initialized according to parameters
+
+        Parameters:
+                hypType (string): hypothesis type
+                libName (string): plug-in library name
+                mesh: optional mesh by which a hypotheses can initialize self
+                shape: optional geometry  by size of which a hypotheses can initialize self
+                initParams: structure SMESH.HypInitParams defining how to initialize a hypothesis
+
+        Returns:
+                created hypothesis instance
+        """
+        if isinstance( mesh, Mesh ):
+            mesh = mesh.GetMesh()
+        if isinstance( initParams, (bool,int)):
+            initParams = SMESH.HypInitParams( not initParams, 1.0, not mesh )
+        return SMESH._objref_SMESH_Gen.GetHypothesisParameterValues(self, hypType, libName,
+                                                                    mesh, shape, initParams )
+
     def GetMeshInfo(self, obj):
         """
         Get the mesh statistic.
index dc1f6b19e87504aa2f1c0e0ef6cc23e17a80be1d..d477b2fc6b81bb74c3ca5b5a542a38b4e97cb63d 100644 (file)
@@ -841,7 +841,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     item.myName = tr("SMESH_USE_PREESTIMATED_LENGTH");
     p.append( item );
     QCheckBox* aQCheckBox = new QCheckBox(dlg());
-    if ( !noPreestimatedAtEdition && h->HavePreestimatedLength() ) {
+    if ( h->HavePreestimatedLength() ) {
       aQCheckBox->setChecked( h->GetUsePreestimatedLength() );
       connect( aQCheckBox, SIGNAL(  stateChanged(int) ), this, SLOT( onValueChanged() ) );
     }
index 36489516b219979ff3ed162762627cb5baf1851e..681bf7bed80000aadedbc890d174e1040688ddf9 100644 (file)
             <source>ICON_SMESH_TREE_HYPO_Geometric1D</source>
             <translation>mesh_tree_hypo_length.png</translation>
         </message>
+        <message>
+            <source>ICON_SMESH_TREE_HYPO_ImportSource1D</source>
+            <translation>mesh_tree_hypo_import_source_1d.png</translation>
+        </message>
+        <message>
+            <source>ICON_SMESH_TREE_HYPO_ImportSource2D</source>
+            <translation>mesh_tree_hypo_import_source_2d.png</translation>
+        </message>
         <message>
             <source>ICON_SMESH_TREE_HYPO_AutomaticLength</source>
             <translation>mesh_tree_hypo_length.png</translation>
             <source>ICON_SMESH_TREE_HYPO_Deflection1D</source>
             <translation>mesh_tree_hypo_length.png</translation>
         </message>
+        <message>
+            <source>ICON_SMESH_TREE_HYPO_FixedPoints1D</source>
+            <translation>mesh_tree_hypo_length.png</translation>
+        </message>
         <message>
             <source>ICON_SMESH_TREE_HYPO_Adaptive1D</source>
             <translation>mesh_tree_hypo_length.png</translation>
             <source>ICON_SMESH_TREE_HYPO_LayerDistribution</source>
             <translation>mesh_tree_hypo_layers_distribution.png</translation>
         </message>
+        <message>
+            <source>ICON_SMESH_TREE_HYPO_LayerDistribution2D</source>
+            <translation>mesh_tree_hypo_layers_distribution_2d.png</translation>
+        </message>
         <message>
             <source>ICON_SMESH_TREE_HYPO_LengthFromEdges</source>
             <translation>mesh_tree_hypo_area.png</translation>
         </message>
         <message>
             <source>ICON_SMESH_TREE_HYPO_NumberOfLayers2D</source>
-            <translation>mesh_tree_hypo_layers_distribution.png</translation>
+            <translation>mesh_tree_hypo_layers_distribution_2d.png</translation>
         </message>
         <message>
             <source>ICON_SMESH_TREE_HYPO_NumberOfSegments</source>