From: eap Date: Mon, 3 Oct 2016 14:53:47 +0000 (+0300) Subject: 23352: [CEA] Order and naming of meshing algorithms X-Git-Tag: V8_2_0a1~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dd0d39d752a4d5ba58ed2e417651093764bb8d09;p=modules%2Fsmesh.git 23352: [CEA] Order and naming of meshing algorithms --- diff --git a/doc/salome/examples/a3DmeshOnModified2Dmesh.py b/doc/salome/examples/a3DmeshOnModified2Dmesh.py index 7fcdcaca8..ecac4870f 100644 --- a/doc/salome/examples/a3DmeshOnModified2Dmesh.py +++ b/doc/salome/examples/a3DmeshOnModified2Dmesh.py @@ -10,7 +10,7 @@ geompy = geomBuilder.New(salome.myStudy) # The requirement is to have a surface mesh on the cube comprised of # triangles of exactly the same size arranged in a grid pattern. # -# To fulfill this requirement we mesh the box using Quadrangle (Mapping) +# To fulfill this requirement we mesh the box using Quadrangle: Mapping # meshing algorithm, split quadrangles into triangles and then generate # tetrahedrons. diff --git a/doc/salome/examples/defining_hypotheses_ex01.py b/doc/salome/examples/defining_hypotheses_ex01.py index 1d5d281c8..c9f02bc12 100644 --- a/doc/salome/examples/defining_hypotheses_ex01.py +++ b/doc/salome/examples/defining_hypotheses_ex01.py @@ -1,4 +1,4 @@ -# Arithmetic 1D and Geometric Progression +# Arithmetic Progression and Geometric Progression import salome salome.salome_init() diff --git a/doc/salome/examples/defining_hypotheses_ex02.py b/doc/salome/examples/defining_hypotheses_ex02.py index 3662d5632..572404569 100644 --- a/doc/salome/examples/defining_hypotheses_ex02.py +++ b/doc/salome/examples/defining_hypotheses_ex02.py @@ -1,4 +1,4 @@ -# Deflection 1D and Number of Segments +# Deflection and Number of Segments import salome salome.salome_init() diff --git a/doc/salome/examples/defining_hypotheses_ex13.py b/doc/salome/examples/defining_hypotheses_ex13.py index e3eeee8f1..339cd200d 100644 --- a/doc/salome/examples/defining_hypotheses_ex13.py +++ b/doc/salome/examples/defining_hypotheses_ex13.py @@ -1,4 +1,4 @@ -# Radial Quadrangle 1D2D example +# Radial Quadrangle 1D-2D example import salome salome.salome_init() diff --git a/doc/salome/examples/prism_3d_algo.py b/doc/salome/examples/prism_3d_algo.py index e51822561..5aa283edf 100644 --- a/doc/salome/examples/prism_3d_algo.py +++ b/doc/salome/examples/prism_3d_algo.py @@ -1,4 +1,4 @@ -# Usage of 3D Extrusion meshing algorithm +# Usage of Extrusion 3D meshing algorithm import salome salome.salome_init() diff --git a/doc/salome/gui/SMESH/images/pref21.png b/doc/salome/gui/SMESH/images/pref21.png old mode 100755 new mode 100644 index 04bacf393..926c78085 Binary files a/doc/salome/gui/SMESH/images/pref21.png and b/doc/salome/gui/SMESH/images/pref21.png differ diff --git a/doc/salome/gui/SMESH/images/radial_prism_mesh.png b/doc/salome/gui/SMESH/images/radial_prism_mesh.png new file mode 100644 index 000000000..6d9a986c1 Binary files /dev/null and b/doc/salome/gui/SMESH/images/radial_prism_mesh.png differ diff --git a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc index 01deffbcd..c4de6317c 100644 --- a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc +++ b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc @@ -14,25 +14,25 @@ Basic 1D hypothesis specifies:
  • Constantly increasing or decreasing length of segments:
  • Distribution depending on curvature:
  • Arbitrary distribution:
  • @@ -54,15 +54,15 @@ creation of narrow 2D elements. - Max size parameter defines the length of segments on straight edges. - \b Deflection parameter gives maximal distance of a segment from a curved edge. -\image html adaptive1d_sample_mesh.png "Adaptive hypothesis and Netgen 2D algorithm - the size of mesh segments reflects the size of geometrical features" +\image html adaptive1d_sample_mesh.png "Adaptive hypothesis and NETGEN 2D algorithm - the size of mesh segments reflects the size of geometrical features" See Also a \ref tui_1d_adaptive "sample TUI Script" that uses Adaptive hypothesis.
    \anchor arithmetic_1d_anchor -

    Arithmetic 1D hypothesis

    +

    Arithmetic Progression hypothesis

    -Arithmetic 1D hypothesis allows to split edges into segments with a +Arithmetic Progression hypothesis allows to split edges into segments with a length that changes in arithmetic progression (Lk = Lk-1 + d) beginning from a given starting length and up to a given end length. @@ -82,10 +82,10 @@ defining Reversed Edges parameter. \image html a-arithmetic1d.png -\image html b-ithmetic1d.png "Arithmetic 1D hypothesis - the size of mesh elements gradually increases" +\image html b-ithmetic1d.png "Arithmetic Progression hypothesis - the size of mesh elements gradually increases" See Also a sample TUI Script of a -\ref tui_1d_arithmetic "Defining Arithmetic 1D and Geometric Progression hypothesis" operation. +\ref tui_1d_arithmetic "Defining Arithmetic Progression and Geometric Progression hypothesis" operation.
    \anchor geometric_1d_anchor @@ -112,13 +112,13 @@ defining Reversed Edges parameter. \image html a-geometric1d.png See Also a sample TUI Script of a -\ref tui_1d_arithmetic "Defining Arithmetic 1D and Geometric Progression hypothesis" operation. +\ref tui_1d_arithmetic "Defining Arithmetic Progression and Geometric Progression hypothesis" operation.
    \anchor deflection_1d_anchor -

    Deflection 1D hypothesis

    +

    Deflection hypothesis

    -Deflection 1D hypothesis can be applied for meshing curvilinear edges +Deflection hypothesis can be applied for meshing curvilinear edges composing your geometrical object. It defines only one parameter: the value of deflection (or chord error). @@ -130,10 +130,10 @@ two nodes should not exceed the value of deflection. \image html a-deflection1d.png -\image html b-flection1d.png "Deflection 1D hypothesis - useful for meshing curvilinear edges" +\image html b-flection1d.png "Deflection hypothesis - useful for meshing curvilinear edges" See Also a sample TUI Script of a -\ref tui_deflection_1d "Defining Deflection 1D hypothesis" operation. +\ref tui_deflection_1d "Defining Deflection hypothesis" operation.
    \anchor average_length_anchor @@ -174,7 +174,7 @@ consists of setting the maximal allowed \b length of segments. Use preestimated length check box lets you use \b length automatically calculated basing on size of your geometrical object, namely as diagonal of bounding box divided by ten. The divider can be -changed via "Ratio Bounding Box Diagonal / Max Size" +changed via \ref diagonal_size_ratio_pref "Ratio Bounding Box Diagonal / Max Size" preference parameter. Use preestimated length check box is enabled only if the geometrical object has been selected before hypothesis definition. @@ -183,11 +183,14 @@ geometrical object has been selected before hypothesis definition.
    \anchor number_of_segments_anchor -

    Number of segments hypothesis

    +

    Number of Segments hypothesis

    -Number of segments hypothesis can be applied for approximating +Number of Segments hypothesis can be applied for approximating edges by a definite number of mesh segments with length depending on -the selected type of distribution of nodes. +the selected type of distribution of nodes. The default number of +segments can be set via +\ref nb_segments_pref "Automatic Parameters / Default Number of Segments" +preference parameter. The direction of the splitting is defined by the orientation of the underlying geometrical edge. Reverse Edges list box allows to @@ -302,9 +305,9 @@ minimum and maximum value of this parameter.
    \anchor fixed_points_1d_anchor -

    Fixed points 1D hypothesis

    +

    Fixed Points hypothesis

    -Fixed points 1D hypothesis allows splitting edges through a +Fixed Points hypothesis allows splitting edges through a set of points parametrized on the edge (from 1 to 0) and a number of segments for each interval limited by the points. @@ -326,7 +329,7 @@ Object Browser. defining Reversed Edges parameter. -\image html mesh_fixedpnt.png "Example of a sub-mesh on the edge built using Fixed points 1D hypothesis" +\image html mesh_fixedpnt.png "Example of a sub-mesh on the edge built using Fixed Points hypothesis" See Also a sample TUI Script of a \ref tui_fixed_points "Defining Fixed Points" hypothesis operation. diff --git a/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc b/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc index 308a6899a..2005ad8d7 100644 --- a/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc +++ b/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc @@ -75,7 +75,7 @@ algorithms are available: \image html reduce_three_to_one.png "The fastest transition pattern: 3 to 1" -Base vertex tab allows using Quadrangle (Mapping) +Base vertex tab allows using Quadrangle: Mapping algorithm for meshing of trilateral faces. In this case it is necessary to select the vertex, which will be used as the forth degenerated side of quadrangle. diff --git a/doc/salome/gui/SMESH/input/about_hypo.doc b/doc/salome/gui/SMESH/input/about_hypo.doc index 12f5c02e1..f40555940 100644 --- a/doc/salome/gui/SMESH/input/about_hypo.doc +++ b/doc/salome/gui/SMESH/input/about_hypo.doc @@ -30,16 +30,16 @@ In \b MESH there are the following Basic Hypotheses:
  • \subpage a1d_meshing_hypo_page "1D Hypotheses" (for meshing of edges):
  • \subpage a2d_meshing_hypo_page "2D Hypotheses" (for meshing of faces):
  • @@ -66,21 +66,21 @@ The \b Local algorithms and hypotheses to be chosen at Scale Factor=3 is assigned to the highlighted edge. -If 3D extrusion algorithm is assigned to a sub-mesh in a mesh +If Extrusion 3D algorithm is assigned to a sub-mesh in a mesh with multiple sub-meshes, the described above approach may not work as expected. For example the bottom face may be meshed by other algorithm -before 3D extrusion have a chance to project a mesh from the +before Extrusion 3D have a chance to project a mesh from the base face. This thing can happen with vertical edges as well. All these can lead to either a meshing failure or to an incorrect meshing. In such a case, it's necessary to explicitly define algorithms -that 3D extrusion implicitly applies in a simple case: +that Extrusion 3D implicitly applies in a simple case: - assign \ref projection_1D2D algorithm to the top face and - assign a 1D algorithm to a group of all vertical edges. -\image html image157.gif "Prism with 3D extrusion meshing. Vertical division is different on neighbor edges because several local 1D hypotheses are assigned." +\image html image157.gif "Prism with Extrusion 3D meshing. Vertical division is different on neighbor edges because several local 1D hypotheses are assigned." \sa a sample TUI Script of -\ref tui_prism_3d_algo "Use 3D extrusion meshing algorithm". +\ref tui_prism_3d_algo "Use Extrusion 3D meshing algorithm". */ diff --git a/doc/salome/gui/SMESH/input/quad_ijk_algo.doc b/doc/salome/gui/SMESH/input/quad_ijk_algo.doc index 90e7eea94..292a300e5 100644 --- a/doc/salome/gui/SMESH/input/quad_ijk_algo.doc +++ b/doc/salome/gui/SMESH/input/quad_ijk_algo.doc @@ -1,8 +1,8 @@ /*! -\page quad_ijk_algo_page Quadrangle (Mapping) meshing algorithm +\page quad_ijk_algo_page Quadrangle: Mapping meshing algorithm -Quadrangle (Mapping) meshing algorithm is intended for creating +Quadrangle: Mapping meshing algorithm is intended for creating all-quadrangle and quad-dominant meshes on faces without holes and bound by at least three edges. diff --git a/doc/salome/gui/SMESH/input/radial_prism_algo.doc b/doc/salome/gui/SMESH/input/radial_prism_algo.doc index 756e0329a..8c3306857 100644 --- a/doc/salome/gui/SMESH/input/radial_prism_algo.doc +++ b/doc/salome/gui/SMESH/input/radial_prism_algo.doc @@ -10,7 +10,9 @@ shell. The meshes of the shells can consist both of triangles and quadrangles. The Radial Prism algorithm would fill the space between the two shells -with meshes. +with prisms. + +\image html radial_prism_mesh.png "Cut-view of a hollow sphere meshed by Radial Prism algorithm" This algorithm also needs the information concerning the number and distribution of mesh layers between the inner and the outer shapes. @@ -21,4 +23,4 @@ Distribution of layers can be set with any of 1D Hypotheses. \image html distribution_of_layers.png -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc b/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc index 097d217c2..7e49a9a66 100644 --- a/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc +++ b/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc @@ -1,6 +1,6 @@ /*! -\page radial_quadrangle_1D2D_algo_page Radial Quadrangle 1D2D +\page radial_quadrangle_1D2D_algo_page Radial Quadrangle 1D-2D \n This algorithm applies to the meshing of 2D shapes under the following conditions: the face must be a full ellipse or a part of ellipse @@ -21,8 +21,9 @@ end lying on the elliptic curve. If no own hypothesis of the algorithm is assigned, any local or global hypothesis is used by the algorithm to discretize edges. -If no 1D hypothesis is assigned to an edge, "Default Number of -Segments" preferences parameter is used to discretize the edge. +If no 1D hypothesis is assigned to an edge, +\ref nb_segments_pref "Default Number of Segments" preferences +parameter is used to discretize the edge. \image html hypo_radquad_dlg.png diff --git a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc index c19afd1b9..85a3cdf92 100644 --- a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc +++ b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc @@ -8,31 +8,31 @@ This page provides example codes of \ref tui_defining_meshing_algos
  • Wire discretisation 1D algorithm
  • -
  • Triangle (Mefisto) 2D algorithm +
  • Triangle: Mefisto 2D algorithm
  • -
  • Tetrahedron (Netgen) 3D algorithm +
  • NETGEN 3D algorithm
  • \ref tui_projection "Projection Algorithms"
  • -
  • \ref tui_radial_quadrangle "Radial Quadrangle 1D2D" algorithm
  • -
  • Quadrangle (Mapping) 2D algorithm +
  • \ref tui_radial_quadrangle "Radial Quadrangle 1D-2D" algorithm
  • +
  • Quadrangle: Mapping 2D algorithm @@ -45,7 +45,7 @@ This page provides example codes of \ref tui_defining_meshing_algos
    \anchor tui_1d_arithmetic -

    Arithmetic 1D and Geometric Progression

    +

    Arithmetic Progression and Geometric Progression

    \tui_script{defining_hypotheses_ex01.py}
    @@ -55,7 +55,7 @@ This page provides example codes of \ref tui_defining_meshing_algos
    \anchor tui_deflection_1d -

    Deflection 1D and Number of Segments

    +

    Deflection and Number of Segments

    \tui_script{defining_hypotheses_ex02.py}
    @@ -113,7 +113,7 @@ This page provides example codes of \ref tui_defining_meshing_algos \tui_script{defining_hypotheses_ex12.py} \anchor tui_radial_quadrangle -

    Radial Quadrangle 1D2D example

    +

    Radial Quadrangle 1D-2D example

    \tui_script{defining_hypotheses_ex13.py} \anchor tui_quadrangle_parameters diff --git a/doc/salome/gui/SMESH/input/tui_prism_3d_algo.doc b/doc/salome/gui/SMESH/input/tui_prism_3d_algo.doc index 6ba5e25d3..0bd16a9e3 100644 --- a/doc/salome/gui/SMESH/input/tui_prism_3d_algo.doc +++ b/doc/salome/gui/SMESH/input/tui_prism_3d_algo.doc @@ -1,6 +1,6 @@ /*! -\page tui_prism_3d_algo Use 3D extrusion meshing algorithm +\page tui_prism_3d_algo Use Extrusion 3D meshing algorithm \tui_script{prism_3d_algo.py} The result geometry and mesh is shown below diff --git a/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc b/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc index 5fbbadb89..c4831c064 100644 --- a/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc +++ b/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc @@ -2,14 +2,23 @@ \page viewing_meshes_overview_page Viewing meshes -\n After definition of algorithms and hypotheses a new mesh is listed -in the Object Browser. Right-click on it and select \b Compute - the -mesh will be automatically displayed in the VTK 3D Viewer. -Alternatively click Display only to hide all other objects at -the same time. +By default a just \ref compute_anchor "computed" mesh will be +automatically displayed in the VTK 3D Viewer. (You can switch +off \ref automatic_update_pref "Automatic Update" preference parameter +to prevent this.) +Click Display only to hide all other objects at the same time. VTK 3D Viewer is described in detail in the documentation on GUI module. -\n After the mesh has appeared in the Viewer, you can select it with + +Use the following \ref mesh_preferences_page "preference parameters" +to adjust how the mesh is displayed by default: +- \ref automatic_update_pref "Automatic Update" +- \ref display_mode_pref "Default display mode" +- \ref quadratic_2d_mode_pref "Representation of the 2D quadratic elements" +- All parameters of \ref mesh_tab_preferences "Mesh" tab page of the +Preferences dialog. + +After the mesh has appeared in the Viewer, you can select it with left mouse click and get information about it, change its presentation parameters and access to other useful options by right-clicking on the selected mesh. @@ -20,21 +29,21 @@ right-clicking on the selected mesh.
  • Rename - allows to rename the object in the Object browser.
  • Hide all - allows to hide all objects in the viewer.
  • Update - refreshes the presentation of your mesh in the -Object Browser, applying all recent changes.
  • + Object Browser, applying all recent changes.
  • \subpage mesh_infos_page "Mesh Information" - provides -information about the mesh.
  • + information about the mesh.
  • \subpage find_element_by_point_page "Find Element by Point" - -allows to find all mesh elements, to which belongs a point with the + allows to find all mesh elements, to which belongs a point with the given coordinates.
  • Auto Color - switch on / off auto-assigning colors for the groups. If switched on, a default color of a new group in \ref creating_groups_page "Create Group" dialog is chosen randomly.
  • \subpage numbering_page "Numbering" - allows to display the ID -numbers of all meshing elements or nodes composing your mesh in the -viewer.
  • + numbers of all meshing elements or nodes composing your mesh in the + viewer.
  • \subpage display_mode_page "Display Mode" - allows to select between -Wireframe, Shading and Nodes presentation.
  • + Wireframe, Shading and Nodes presentation.
  • \subpage display_entity_page "Display Entity" - allows to display entities by types (Faces, Edges, Volumes etc.).
  • \anchor quadratic_2d_mode @@ -44,24 +53,29 @@ Wireframe, Shading and Nodes presentation. Arc representation applies to 1D and 2D elements only.
  • Orientation of faces - shows vectors of orientation of -faces of the selected mesh. The orientation vector is shown for each 2D mesh element -and for each free face of a 3D mesh element. the vector direction is calculated by -the first three nodes of the face produced by vectors n1-n2 and n1-n3.
  • -
  • \subpage colors_size_page "Properties" - allows to define several properties, including color of elements, shrink size, ....
  • + faces of the selected mesh. The orientation vector is shown for each + 2D mesh element and for each free facet of a 3D mesh element. The + vector direction is calculated by the first three nodes of the face + produced by vectors n1-n2 and n1-n3. +
  • \subpage colors_size_page "Properties" - allows to define several + visual properties, including color of elements, shrink size, ...
  • \subpage transparency_page "Transparency" - allows to change the -transparency of mesh elements.
  • -
  • \ref quality_page "Controls" - graphically -presents various information about meshes.
  • + transparency of mesh elements. +
  • \ref quality_page "Controls" - graphically presents various + information about the mesh.
  • Hide - allows to hide the selected mesh from the viewer.
  • -
  • Show Only -allows to display only the selected mesh, hiding all other from the viewer.
  • -
  • \subpage clipping_page "Clipping" - allows to create cross-sections of the selected objects.
  • -
  • Dump view - exports an object from the viewer in bmp, png, jpg or jpeg image format.
  • +
  • Show Only - allows to display only the selected mesh, + hiding all others from the viewer.
  • +
  • \subpage clipping_page "Clipping" - allows to create + cross-sections of the displayed objects.
  • +
  • Dump view - exports an object from the viewer in bmp, png + or jpeg image format.
  • Change background - allows to redefine the background -color. By default it is black.
  • -
  • View Operations checkbox - allows to show/hide the -visualization toolbar in the viewer window.
  • + color. By default it is black. +
  • View Operations - allows to show/hide the + visualization toolbar in the Viewer window.
  • Recording Operations - allows to show/hide the recording -toolbar in the viewer window.
  • + toolbar in the Viewer window. */ diff --git a/resources/StdMeshers.xml.in b/resources/StdMeshers.xml.in index 5c6e8f8ed..3a4e607b1 100644 --- a/resources/StdMeshers.xml.in +++ b/resources/StdMeshers.xml.in @@ -28,11 +28,11 @@ - + gui-lib ="StdMeshersGUI"> @@ -445,8 +493,10 @@ @@ -472,6 +524,8 @@ @@ -481,8 +535,10 @@ Delete(); myGrid->BuildLinks(); this->Modified(); + + // initialize static maps in SMDS_MeshCell, to be thread-safe + if ( myMeshId == 0 ) + { + SMDS_MeshCell::toVtkType( SMDSEntity_Node ); + SMDS_MeshCell::toVtkOrder( SMDSEntity_Node ); + SMDS_MeshCell::reverseSmdsOrder( SMDSEntity_Node ); + SMDS_MeshCell::interlacedSmdsOrder( SMDSEntity_Node ); + SMDS_MeshCell::toSmdsType( VTK_VERTEX ); + SMDS_MeshCell::fromVtkOrder( SMDSEntity_Node ); + } } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/SMDS/SMDS_MeshCell.hxx b/src/SMDS/SMDS_MeshCell.hxx index 803f48622..413b1265a 100644 --- a/src/SMDS/SMDS_MeshCell.hxx +++ b/src/SMDS/SMDS_MeshCell.hxx @@ -33,7 +33,7 @@ public: virtual ~SMDS_MeshCell(); virtual bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)= 0; - virtual bool vtkOrder(const SMDS_MeshNode* nodes[], const int nbNodes) {return true; } + virtual bool vtkOrder(const SMDS_MeshNode* nodes[], const int nbNodes) { return true; } static VTKCellType toVtkType (SMDSAbs_EntityType vtkType); static SMDSAbs_EntityType toSmdsType(VTKCellType vtkType); diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index 168b9ceb3..b0df38a21 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -1374,7 +1374,7 @@ const TopoDS_Shape& SMESHDS_Mesh::IndexToShape(int ShapeIndex) const if ( ShapeIndex > 0 ) return myIndexToShape.FindKey(ShapeIndex); } - catch ( Standard_OutOfRange ) + catch ( ... ) { } static TopoDS_Shape nullShape; diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 082159299..bda271418 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -5001,19 +5001,6 @@ void SMESHGUI::createPreferences() setPreferenceProperty( lim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) ); addPreference( tr( "PREF_INCREMENTAL_LIMIT" ), autoUpdate, LightApp_Preferences::Bool, "SMESH", "incremental_limit" ); - int qaGroup = addPreference( tr( "PREF_GROUP_QUALITY" ), genTab ); - setPreferenceProperty( qaGroup, "columns", 2 ); - addPreference( tr( "PREF_DISPLAY_ENTITY" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "display_entity" ); - addPreference( tr( "PREF_PRECISION_USE" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "use_precision" ); - int prec = addPreference( tr( "PREF_PRECISION_VALUE" ), qaGroup, LightApp_Preferences::IntSpin, "SMESH", "controls_precision" ); - setPreferenceProperty( prec, "min", 0 ); - setPreferenceProperty( prec, "max", 100 ); - int doubleNodesTol = addPreference( tr( "PREF_EQUAL_NODES_TOL" ), qaGroup, LightApp_Preferences::DblSpin, "SMESH", "equal_nodes_tolerance" ); - setPreferenceProperty( doubleNodesTol, "precision", 10 ); - setPreferenceProperty( doubleNodesTol, "min", 0.0000000001 ); - setPreferenceProperty( doubleNodesTol, "max", 1000000.0 ); - setPreferenceProperty( doubleNodesTol, "step", 0.0000001 ); - int dispgroup = addPreference( tr( "PREF_DISPLAY_MODE_GROUP" ), genTab ); setPreferenceProperty( dispgroup, "columns", 2 ); int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), dispgroup, LightApp_Preferences::Selector, "SMESH", "display_mode" ); @@ -5047,6 +5034,18 @@ void SMESHGUI::createPreferences() setPreferenceProperty( maxAngle, "min", 1 ); setPreferenceProperty( maxAngle, "max", 90 ); + int qaGroup = addPreference( tr( "PREF_GROUP_QUALITY" ), genTab ); + setPreferenceProperty( qaGroup, "columns", 2 ); + addPreference( tr( "PREF_DISPLAY_ENTITY" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "display_entity" ); + addPreference( tr( "PREF_PRECISION_USE" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "use_precision" ); + int prec = addPreference( tr( "PREF_PRECISION_VALUE" ), qaGroup, LightApp_Preferences::IntSpin, "SMESH", "controls_precision" ); + setPreferenceProperty( prec, "min", 0 ); + setPreferenceProperty( prec, "max", 100 ); + int doubleNodesTol = addPreference( tr( "PREF_EQUAL_NODES_TOL" ), qaGroup, LightApp_Preferences::DblSpin, "SMESH", "equal_nodes_tolerance" ); + setPreferenceProperty( doubleNodesTol, "precision", 10 ); + setPreferenceProperty( doubleNodesTol, "min", 0.0000000001 ); + setPreferenceProperty( doubleNodesTol, "max", 1000000.0 ); + setPreferenceProperty( doubleNodesTol, "step", 0.0000001 ); int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab ); diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index 9bfb74ac6..07757c909 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -749,6 +749,8 @@ HypothesisData::HypothesisData( const QString& theTypeName, const QString& theLabel, const QString& theIconId, const QString& theContext, + const int theGroupID, + const int thePriority, const QList& theDim, const bool theIsAuxOrNeedHyp, const QStringList& theBasicHypos, @@ -764,6 +766,8 @@ HypothesisData::HypothesisData( const QString& theTypeName, Label( theLabel ), IconId( theIconId ), Context( theContext ), + GroupID( theGroupID ), + Priority( thePriority ), Dim( theDim ), IsAuxOrNeedHyp( theIsAuxOrNeedHyp ), IsNeedGeometry( theIsNeedGeometry ), diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.h b/src/SMESHGUI/SMESHGUI_Hypotheses.h index 6eb03fa9b..0852bc60e 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.h +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.h @@ -173,7 +173,8 @@ struct HypothesisData { HypothesisData( const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, - const QString&, const QList&, const bool, + const QString&, const int, const int, + const QList&, const bool, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const bool=true, const bool supportSub=false ); @@ -185,11 +186,13 @@ struct HypothesisData QString Label; //!< label QString IconId; //!< icon identifier QString Context; //!< ["GLOBAL","LOCAL","ANY"(default)] + int GroupID; //!< group ID (staring from zero) + int Priority; //!< integer, priority within the group QList Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration) - bool IsAuxOrNeedHyp; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise - //!< TRUE if given algorithm can't work w/o hypotheses + bool IsAuxOrNeedHyp; //!< TRUE if given HYPOTHESIS is auxiliary one, FALSE otherwise + //!< TRUE if given ALGORITHM can't work w/o hypotheses bool IsNeedGeometry; //!< TRUE if the algorithm works with shapes only, FALSE otherwise - bool IsSupportSubmeshes; //!< TRUE if the algo building all-dim elems supports submeshes + bool IsSupportSubmeshes; //!< TRUE if the algorithm building all-dim elems supports sub-meshes // for algorithm only: dependencies algo <-> algo and algo -> hypos QStringList BasicHypos; //!< list of basic hypotheses diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index fc1f8c5e2..71b812566 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -49,9 +49,7 @@ #include // Qt includes -#include #include -//#include // Other includes @@ -180,7 +178,8 @@ namespace SMESH void InitAvailableHypotheses() { SUIT_OverrideCursor wc; - if (myHypothesesMap.empty() && myAlgorithmsMap.empty()) { + if ( myHypothesesMap.empty() && myAlgorithmsMap.empty() ) + { // Resource manager SUIT_ResourceMgr* resMgr = SMESHGUI::resourceMgr(); if (!resMgr) return; @@ -369,6 +368,90 @@ namespace SMESH return aHypData; } + //================================================================================ + /*! + * \brief Return the HypothesisData holding a name of a group of hypotheses + * a given hypothesis belongs to + */ + //================================================================================ + + HypothesisData* GetGroupTitle( const HypothesisData* hyp, const bool isAlgo ) + { + static std::vector< std::vector< HypothesisData > > theGroups; + if ( theGroups.empty() ) + { + theGroups.resize(14); // 14: isAlgo * 10 + dim + + QString dummyS("GROUP"); + QList dummyIL; dummyIL << 1; + QStringList dummySL; + HypothesisData group( dummyS,dummyS,dummyS,dummyS,dummyS,dummyS,dummyS,-1,-1, + dummyIL, 0, dummySL,dummySL,dummySL,dummySL ); + // no group + int key = 0; + theGroups[ key ].push_back( group ); + + // 1D algo + key = 11; + // 0: Basic + group.Label = "GROUP:" + QObject::tr( "SMESH_1D_ALGO_GROUP_BASIC" ); + theGroups[ key ].push_back( group ); + // 1: Advanced + group.Label = "GROUP:" + QObject::tr( "SMESH_1D_ALGO_GROUP_ADVANCED" ); + theGroups[ key ].push_back( group ); + + // 1D hypotheses + key = 01; + // 0: Basic + group.Label = "GROUP:" + QObject::tr( "SMESH_1D_HYP_GROUP_BASIC" ); + theGroups[ key ].push_back( group ); + // 1: Progression + group.Label = "GROUP:" + QObject::tr( "SMESH_1D_HYP_GROUP_PROGRESSION" ); + theGroups[ key ].push_back( group ); + // 2: Advanced + group.Label = "GROUP:" + QObject::tr( "SMESH_1D_HYP_GROUP_ADVANCED" ); + theGroups[ key ].push_back( group ); + + // 2D algo + key = 12; + // 0: Regular + group.Label = "GROUP:" + QObject::tr( "SMESH_2D_ALGO_GROUP_REGULAR" ); + theGroups[ key ].push_back( group ); + // 1: Free + group.Label = "GROUP:" + QObject::tr( "SMESH_2D_ALGO_GROUP_FREE" ); + theGroups[ key ].push_back( group ); + // 2: Advanced + group.Label = "GROUP:" + QObject::tr( "SMESH_2D_ALGO_GROUP_ADVANCED" ); + theGroups[ key ].push_back( group ); + + // 3D algo + key = 13; + // 0: Regular + group.Label = "GROUP:" + QObject::tr( "SMESH_3D_ALGO_GROUP_REGULAR" ); + theGroups[ key ].push_back( group ); + // 1: Free + group.Label = "GROUP:" + QObject::tr( "SMESH_3D_ALGO_GROUP_FREE" ); + theGroups[ key ].push_back( group ); + // 2: Advanced + group.Label = "GROUP:" + QObject::tr( "SMESH_3D_ALGO_GROUP_ADVANCED" ); + theGroups[ key ].push_back( group ); + } + + size_t key = 0, groupID = 0; + if ( hyp && !hyp->Dim.isEmpty() ) + { + key = hyp->Dim[0] + isAlgo * 10; + groupID = hyp->GroupID; + } + + if ( key < theGroups.size() && !theGroups[ key ].empty() ) + { + std::vector< HypothesisData > & group = theGroups[ key ]; + return & ( groupID < group.size() ? group[ groupID ] : group.back() ); + } + return & theGroups[ 0 ][ 0 ]; + } + bool IsAvailableHypothesis(const HypothesisData* algoData, const QString& hypType, bool& isAuxiliary) diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h index 70314e2ca..0bf059af1 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h @@ -78,6 +78,9 @@ namespace SMESH SMESHGUI_EXPORT HypothesisData* GetHypothesisData( const QString& ); + SMESHGUI_EXPORT + HypothesisData* GetGroupTitle( const HypothesisData* hyp, const bool isAlgo ); + SMESHGUI_EXPORT bool IsAvailableHypothesis( const HypothesisData*, const QString&, diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx index ad2adb520..09218ef3d 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx @@ -30,6 +30,7 @@ // SALOME GUI includes #include #include +#include // Qt includes #include @@ -163,19 +164,33 @@ SMESHGUI_MeshTab::~SMESHGUI_MeshTab() * \param [in] txt - item text * \param [in] type - HypType * \param [in] index - index of item in a list of items + * \param [in] isGroup - is the item a group title */ //================================================================================ -void SMESHGUI_MeshTab::addItem( const QString& txt, const int type, const int index ) +void SMESHGUI_MeshTab::addItem( const QString& txt, + const int type, + const int index, + const bool isGroup ) { + const char* prefix = " "; if ( type <= AddHyp ) { - myHypCombo[ type ]->addItem( txt, QVariant( index )); - myHypCombo[ type ]->setMaxVisibleItems( qMax( 10, myHypCombo[ type ]->count() ) ); + if ( isGroup ) + { + int idx = myHypCombo[ type ]->count(); + myHypCombo[ type ]->addItem( txt.mid( 6 ), QVariant( index )); + myHypCombo[ type ]->setItemData( idx, "separator", Qt::AccessibleDescriptionRole ); + } + else + { + myHypCombo[ type ]->addItem( prefix + txt, QVariant( index )); + } + //myHypCombo[ type ]->setMaxVisibleItems( qMax( 10, myHypCombo[ type ]->count() ) ); } else { - QListWidgetItem* item = new QListWidgetItem( txt, myAddHypList ); + QListWidgetItem* item = new QListWidgetItem( prefix + txt, myAddHypList ); item->setData( Qt::UserRole, QVariant( index )); } } @@ -222,7 +237,7 @@ void SMESHGUI_MeshTab::setAvailableHyps( const int theId, const QStringList& the { addItem( tr( "NONE"), Algo, 0 ); for ( int i = 0, nbHyp = theHyps.count(); i < nbHyp; ++i ) - addItem( theHyps[i], Algo, i+1 ); + addItem( theHyps[i], Algo, i+1, theHyps[i].startsWith( "GROUP:" )); myHypCombo[ Algo ]->setCurrentIndex( 0 ); } } @@ -400,15 +415,25 @@ void SMESHGUI_MeshTab::onCreateHyp() { bool isMainHyp = ( sender() == myCreateHypBtn[ MainHyp ]); - QMenu aPopup( this ); + QtxMenu aPopup( this ); QStringList aHypNames = isMainHyp ? myAvailableHypTypes[ MainHyp ] : myAvailableHypTypes[ AddHyp ]; QList actions; for ( int i = 0, n = aHypNames.count(); i < n; i++ ) - actions.append( aPopup.addAction( aHypNames[ i ] ) ); - + { + QAction* a = 0; + if ( aHypNames[ i ].startsWith( "GROUP:" )) + { + aPopup.appendGroupTitle( aHypNames[ i ].mid( 6 )); + } + else + { + a = aPopup.addAction( aHypNames[ i ] ); + } + actions.append( a ); + } QAction* a = aPopup.exec( QCursor::pos() ); if ( a ) emit createHyp( isMainHyp ? MainHyp : AddHyp, actions.indexOf( a ) ); @@ -444,7 +469,18 @@ void SMESHGUI_MeshTab::onEditHyp() //================================================================================ void SMESHGUI_MeshTab::onHyp( int theIndex ) { - const QObject* aSender = sender(); + QObject* aSender = sender(); + + if ( QComboBox* cb = qobject_cast< QComboBox* >( aSender )) + { + // don't allow selecting a group title + if ( cb->itemData( theIndex, Qt::AccessibleDescriptionRole ) == "separator" ) + { + cb->setCurrentIndex( theIndex+1 ); + return; + } + } + if ( aSender == myHypCombo[ Algo ] ) { emit selectAlgo( theIndex - 1 ); // - 1 because there is NONE on the top diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.h b/src/SMESHGUI/SMESHGUI_MeshDlg.h index 9c0337420..afc499f34 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.h @@ -150,7 +150,7 @@ private slots: private: - void addItem( const QString& txt, const int type, const int index ); + void addItem( const QString& txt, const int type, const int index, const bool isGroup=false ); int getCurrentIndex( const int type, const bool curByType=false) const; QMap myAvailableHypTypes; diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 8677fad56..8adb02804 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -943,7 +943,6 @@ void SMESHGUI_MeshOp::availableHyps( const int theDim, bool isAux = ( theHypType >= AddHyp ); QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( isAlgo, theDim, isAux, myIsOnGeometry, !myIsMesh ); - QStringList::const_iterator anIter; GEOM::GEOM_Object_var aGeomVar; QString aCurrentGeomToSelect; if ( !theMeshType.isEmpty() ) { @@ -955,23 +954,50 @@ void SMESHGUI_MeshOp::availableHyps( const int theDim, myHypMapIsApplicable.clear(); } + std::multimap< double, HypothesisData* > sortedHyps; + QStringList::const_iterator anIter; for ( anIter = aHypTypeNameList.begin(); anIter != aHypTypeNameList.end(); ++anIter ) { HypothesisData* aData = SMESH::GetHypothesisData( *anIter ); if ( ( isCompatible ( thePrevAlgoData, aData, theHypType ) && isCompatible ( theNextAlgoData, aData, theHypType ) ) || - ( theMeshType == "ANY" && aData->InputTypes.isEmpty())) { - if ( !theMeshType.isEmpty() && theDim >= SMESH::DIM_2D && + ( theMeshType == "ANY" && aData->InputTypes.isEmpty())) + { + if ( ( !theMeshType.isEmpty() ) && + ( theDim >= SMESH::DIM_2D ) && ( ( theMeshType != "ANY" && !isCompatibleToMeshType( aData, theMeshType )) || - !isCompatibleToGeometry( aData, aCurrentGeomToSelect, aGeomVar ))) + !isCompatibleToGeometry( aData, aCurrentGeomToSelect, aGeomVar ))) continue; + + int groupID = aData->GroupID; + int priority = aData->Priority; + if ( groupID < 0 || groupID > 9 ) groupID = 9; + if ( priority < 0 || priority > 999 ) priority = 999; + + sortedHyps.insert( std::make_pair( groupID + priority * 1e-3, aData )); + } + } + + if ( !sortedHyps.empty() ) + { + HypothesisData* aPrevGroup = SMESH::GetGroupTitle( sortedHyps.rbegin()->second, isAlgo ); + std::multimap< double, HypothesisData* >::iterator key_hyp = sortedHyps.begin(); + for ( ; key_hyp != sortedHyps.end(); ++key_hyp ) + { + HypothesisData* aData = key_hyp->second; + HypothesisData* aGroup = SMESH::GetGroupTitle( aData, isAlgo ); + if ( aPrevGroup != aGroup ) + { + theDataList.append( aGroup ); + theHyps.append( aGroup->Label ); + aPrevGroup = aGroup; + } theDataList.append( aData ); theHyps.append( aData->Label ); } } - if ( !theMeshType.isEmpty() && !aCurrentGeomToSelect.isEmpty() && - myLastGeomToSelect != aCurrentGeomToSelect ) + if ( !theMeshType.isEmpty() && !aCurrentGeomToSelect.isEmpty() ) myLastGeomToSelect = aCurrentGeomToSelect; } diff --git a/src/SMESHGUI/SMESHGUI_XmlHandler.cxx b/src/SMESHGUI/SMESHGUI_XmlHandler.cxx index ec8ed41cd..f164f4fe5 100644 --- a/src/SMESHGUI/SMESHGUI_XmlHandler.cxx +++ b/src/SMESHGUI/SMESHGUI_XmlHandler.cxx @@ -141,11 +141,18 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, else context = context.toUpper(); + bool isOk; + QString groupIDStr = atts.value("group-id"); + int groupID = groupIDStr.toUInt( &isOk ); + if ( !isOk ) groupID = -1; + QString priorityStr = atts.value("priority"); + int priority = priorityStr.toUInt( &isOk ); + if ( !isOk ) priority = -1; + QString aDimStr = atts.value("dim"); aDimStr = aDimStr.remove( ' ' ); QStringList aDimList = aDimStr.split( ',', QString::SkipEmptyParts ); QStringList::iterator anIter; - bool isOk; QList aDim; for ( anIter = aDimList.begin(); anIter != aDimList.end(); ++anIter ) { @@ -170,7 +177,7 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, if ( !aHypAlType.contains( BAD_HYP_FLAG ) ) { HypothesisData* aHypData = new HypothesisData (aHypAlType, myPluginName, myServerLib, myClientLib, - aLabel, anIcon, context, aDim, isAuxOrNeedHyp, + aLabel, anIcon, context, groupID, priority, aDim, isAuxOrNeedHyp, attr[ HYPOS ], attr[ OPT_HYPOS ], attr[ INPUT ], attr[ OUTPUT ], isNeedGeom, isSupportSubmeshes ); diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index d275e1d9f..127fae41b 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -4389,6 +4389,50 @@ It can't be deleted SMESH_ADVANCED Advanced + + SMESH_1D_ALGO_GROUP_BASIC + Basic + + + SMESH_1D_ALGO_GROUP_ADVANCED + Advanced + + + SMESH_1D_HYP_GROUP_BASIC + Basic + + + SMESH_1D_HYP_GROUP_PROGRESSION + Progression + + + SMESH_1D_HYP_GROUP_ADVANCED + Advanced + + + SMESH_2D_ALGO_GROUP_REGULAR + Regular faces + + + SMESH_2D_ALGO_GROUP_FREE + Free faces + + + SMESH_2D_ALGO_GROUP_ADVANCED + Advanced + + + SMESH_3D_ALGO_GROUP_REGULAR + Regular volumes + + + SMESH_3D_ALGO_GROUP_FREE + Free volumes + + + SMESH_3D_ALGO_GROUP_ADVANCED + Advanced + SMESHGUI_FieldSelectorWdg diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index 2be343242..d9b807c24 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -161,7 +161,7 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis } else if (strcmp("TrianglePreference", aHyp->GetName()) == 0){ isFirstParams = false; - myTrianglePreference = true; + myTrianglePreference = true; } else { isFirstParams = false; @@ -174,18 +174,18 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis if (isFirstParams) { if (strcmp("QuadranglePreference", aHyp->GetName()) == 0) { myQuadranglePreference = true; - myTrianglePreference = false; + myTrianglePreference = false; myQuadType = QUAD_STANDARD; } else if (strcmp("TrianglePreference", aHyp->GetName()) == 0){ myQuadranglePreference = false; - myTrianglePreference = true; + myTrianglePreference = true; myQuadType = QUAD_STANDARD; } } - else { - const StdMeshers_QuadrangleParams* aHyp2 = - (const StdMeshers_QuadrangleParams*)aHyp; + else if (const StdMeshers_QuadrangleParams* aHyp2 = + dynamic_cast( aHyp )) + { myTriaVertexID = aHyp2->GetTriaVertex(); if (!myQuadranglePreference && !myTrianglePreference) { // priority of hypos @@ -206,7 +206,7 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis //============================================================================= /*! - * + * */ //=============================================================================