From: prascle Date: Thu, 1 Jul 2010 16:26:48 +0000 (+0000) Subject: merge V5_1_4 X-Git-Tag: smds_memimp_V5_1_4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0c16e57723ec8522693f2f0b6d3216b4f4e3d686;p=modules%2Fsmesh.git merge V5_1_4 --- diff --git a/doc/salome/gui/SMESH/images/colors_size.png b/doc/salome/gui/SMESH/images/colors_size.png index 58210c0bc..53b14620c 100755 Binary files a/doc/salome/gui/SMESH/images/colors_size.png and b/doc/salome/gui/SMESH/images/colors_size.png differ diff --git a/doc/salome/gui/SMESH/images/pattern2d.png b/doc/salome/gui/SMESH/images/pattern2d.png new file mode 100644 index 000000000..ff488eb8f Binary files /dev/null and b/doc/salome/gui/SMESH/images/pattern2d.png differ diff --git a/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc b/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc index 8e789536f..892cc9f74 100644 --- a/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc +++ b/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc @@ -7,8 +7,6 @@
  • \ref max_element_area_anchor "Max Element Area"
  • \ref length_from_edges_anchor "Length from Edges"
  • \ref hypo_quad_params_anchor "Quadrangle parameters"
  • -
  • \ref quadrangle_preference_anchor "Quadrangle Preference"
  • -
  • \ref triangle_preference_anchor "Triangle Preference"

  • @@ -69,29 +67,5 @@ shows the good (left) and the bad (right) results of meshing. See Also a sample TUI Script of a \ref tui_quadrangle_parameters "Quadrangle Parameters" hypothesis. -\anchor quadrangle_preference_anchor -

    Quadrangle Preference

    - -This algorithm can be used together with Quadrangle (Mapping) and Netgen 2D -algorithms. - -It allows Netgen 2D to build quadrangular meshes at any conditions. - -It allows Quadrangle (Mapping) to build quadrangular meshes even if the number -of nodes at the opposite edges of a meshed face is not equal, -otherwise this mesh will contain some triangular elements. -
    -This hypothesis has one restriction on its work: the total quantity of -segments on all four sides of the face must be even (divisible by 2). - - -
    -\anchor triangle_preference_anchor -

    Triangle Preference

    - -This algorithm can be used only together with Quadrangle (Mapping) -algorithm. It allows to build triangular mesh faces in the refinement -area if the number of nodes at the opposite edges of a meshed face is not equal, -otherwise refinement area will contain some quadrangular elements.
    */ diff --git a/doc/salome/gui/SMESH/input/about_hypo.doc b/doc/salome/gui/SMESH/input/about_hypo.doc index 9d9db7b32..0e8ac1007 100644 --- a/doc/salome/gui/SMESH/input/about_hypo.doc +++ b/doc/salome/gui/SMESH/input/about_hypo.doc @@ -55,6 +55,8 @@ with other hypotheses:
  • Propagation of 1D Hypothesis on opposite edges
  • Non conform mesh allowed
  • Quadratic mesh
  • +
  • Quadrangle preference
  • +
  • Triangle preference
  • The choice of a hypothesis depends on: diff --git a/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc b/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc index 451823b74..5c99e8e79 100644 --- a/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc +++ b/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc @@ -26,10 +26,25 @@ following associated submenu will appear: \image html image146.png From this submenu select the type of element which you would like to add to your mesh. -\note All dialogs intended for adding nodes or elements to mesh (except dialog for adding -0D elements) provide a possibility to add these nodes/elements to the specified group -(or to create the group if it doesn't exist). Add to group box allows to choose -an existing group for created node or element or to specify a name for new group. + +\note All dialogs for adding new node or element to the mesh (except for +the dialog for 0D elements) provide a possibility to add it +automatically to the specified group or to create it anew using +Add to group box, that allows to choose an existing group for +the created node or element or to give the name to a new group. By +default, the Add to group check box is switched off. If user +swiches this check box on, the combo box listing all currently +existing groups of the corresponding type becomes available. By +default, no any group is selected. In such a case, when user presses +Apply or Apply & Close button, the warning message box +informing the user about the necessity to input new group name is +shown. The combo box lists both \ref standalone_group "standalone groups" +and \ref group_on_geom "groups on geometry". If the user has +chosen the group on geometry, he is warned and proposed to +\ref convert_to_standalone "convert this group to the standalone". +If user refuses converting operation, an operation is cancelled and +new node/element is not created! + See Also sample TUI Scripts of diff --git a/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc b/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc index 2a587d147..83736c85d 100644 --- a/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc +++ b/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc @@ -2,7 +2,7 @@ \page adding_quadratic_elements_page Adding Quadratic Elements -\n MESH modules allows you to work with Quadratic Elements. +\n MESH module allows you to work with Quadratic Elements. Quadratic Edge is not a straight but a broken line and can be defined by three points: first, middle and last. All more complex \b Quadratic @@ -18,10 +18,24 @@ one of the following: \image html image152.png -\note All dialogs intended for adding quadratic elements to mesh provide a possibility -to add these elements to the specified group (or to create the group if it doesn't exist). -Add to group box allows to choose an existing group for created element or -to specify a name for new group. +\note All dialogs for adding quadratic element to the mesh +provide a possibility to add new element +automatically to the specified group or to create it anew using +Add to group box, that allows to choose an existing group for +the created node or element or to give the name to a new group. By +default, the Add to group check box is switched off. If user +swiches this check box on, the combo box listing all currently +existing groups of the corresponding type becomes available. By +default, no any group is selected. In such a case, when user presses +Apply or Apply & Close button, the warning message box +informing the user about the necessity to input new group name is +shown. The combo box lists both \ref standalone_group "standalone groups" +and \ref group_on_geom "groups on geometry". If the user has +chosen the group on geometry, he is warned and proposed to +\ref convert_to_standalone "convert this group to the standalone". +If user refuses converting operation, an operation is cancelled and +new node/element is not created! + To create any Quadratic Element specify the nodes which will form your triangle by selecting them in the 3D viewer with pressed Shift diff --git a/doc/salome/gui/SMESH/input/additional_hypo.doc b/doc/salome/gui/SMESH/input/additional_hypo.doc index 9687bdf2d..1205e19b0 100644 --- a/doc/salome/gui/SMESH/input/additional_hypo.doc +++ b/doc/salome/gui/SMESH/input/additional_hypo.doc @@ -28,8 +28,30 @@ hypothesis onto an opposite edge. If a local hypothesis and propagation are defined on an edge of a quadrangular face, the opposite edge will have the same hypothesis, unless another hypothesis has been locally defined on the opposite edge. - +
    See Also a sample TUI Script of a -\ref tui_propagation "Propagation hypothesis" operation. +\ref tui_propagation "Propagation hypothesis" operation + +

    Quadrangle Preference

    + +This additional hypothesis can be used together with Quadrangle (Mapping) and Netgen 2D +algorithms. + +It allows Netgen 2D to build quadrangular meshes at any conditions. + +It allows Quadrangle (Mapping) to build quadrangular meshes even if the number +of nodes at the opposite edges of a meshed face is not equal, +otherwise this mesh will contain some triangular elements. +
    +This hypothesis has one restriction on its work: the total quantity of +segments on all four sides of the face must be even (divisible by 2). + +

    Triangle Preference

    + +This additional hypothesis can be used only together with Quadrangle (Mapping) +algorithm. It allows to build triangular mesh faces in the refinement +area if the number of nodes at the opposite edges of a meshed face is not equal, +otherwise refinement area will contain some quadrangular elements. + -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/SMESH/input/constructing_meshes.doc b/doc/salome/gui/SMESH/input/constructing_meshes.doc index 042b66320..ace081140 100644 --- a/doc/salome/gui/SMESH/input/constructing_meshes.doc +++ b/doc/salome/gui/SMESH/input/constructing_meshes.doc @@ -154,21 +154,20 @@ evaluation will be displayed in the following information box: - \anchor mesh_order_anchor -It is allowed to change submesh priority in mesh computation when -there are concurrent submeshes present. I.e. user can change priority of -applying algorithms on shared subshapes of Mesh shape. + +
  • +If the mesh contains concurrent submeshes, it is possible to change +the priority of their computation, i.e. to change the priority of +applying algorithms to the shared subshapes of the Mesh shape.
  • + To change submesh priority: -
      -
    1. From the Mesh menu choose the "Change submesh priority" on -selected Mesh item, or invoke from popup menu. The opened dialogue box -shows a list of submeshes in the order of their priority. Algorithm and its -hypotheses of a submesh being upper in the list are applied before those of -a submesh lower in the list. -There is an example of submesh order modifications of Mesh created on a Box +
    2. Choose "Change submesh priority" from the Mesh menu or a popup menu. The opened dialogue +shows a list of submeshes in the order of their priority. + +There is an example of submesh order modifications of the Mesh created on a Box shape. The main Mesh object:
      • 3D Tetrahedron (Netgen) with HypothesisMax Element Volume
      • @@ -189,51 +188,50 @@ is: (Number of Segments = 8)
      -And the last third submesh object Submesh_3 created on Face_3 +And the last submesh object Submesh_3 created on Face_3 is:
      • 2D Netgen 1D-2D with Hypothesis Netgen Simple parameters (Number of Segments = 12)
      -The submeshes can become concurrent if their algorithms leads to mesh shared subshape -with different algorithms (or different algorithms parameters, i.e. hypothesises). -In fact, we have three submeshes with concurrent algorithms, because -they have different hypothesises assigned to them. +The submeshes become concurrent if they share subshapes that can be meshed +with different algorithms (or different hypothesises). +In the example, we have three submeshes with concurrent algorithms, +because they have different hypotheses. -The first mesh computation made with: +The first mesh computation is made with: \image html mesh_order_123.png
      "Mesh order SubMesh_1, SubMesh_2, SubMesh_3"
      \image html mesh_order_123_res.png
      "Result mesh with order SubMesh_1, SubMesh_2, SubMesh_3 "
      -The next mesh computation with: +The next mesh computation is made with: \image html mesh_order_213.png
      "Mesh order SubMesh_2, SubMesh_1, SubMesh_3"
      \image html mesh_order_213_res.png
      "Result mesh with order SubMesh_2, SubMesh_1, SubMesh_3 "
      -And the last mesh computation with: +And the last mesh computation is made with: \image html mesh_order_321.png
      "Mesh order SubMesh_3, SubMesh_2, SubMesh_1"
      \image html mesh_order_321_res.png
      "Result mesh with order SubMesh_3, SubMesh_2, SubMesh_1 "
      -As we can see each mesh computation has different number of result -elements and different mesh discretisation on shared edges (edges +As we can see, each mesh computation has a different number of result +elements and a different mesh discretisation on the shared edges (the edges that are shared between Face_1, Face_2 and Face_3) -Additionally, submesh priority (order of algorithms to be applied) can -be modified not only in separate dialog box, but in Preview -also. This helps to preview different mesh results, modifying submesh -order. +Additionally, submesh priority (the order of applied algorithms) can +be modified not only in a separate dialog box, but also in the +Preview. This helps to preview different mesh results, +modifying the order of submeshes. \image html mesh_order_preview.png
      "Preview with submesh priority list box"
      -If there are no concurrent submeshes under Mesh object, then user will see the -following information dialog box +If there are no concurrent submeshes under the Mesh object, the user will see the +following information. \image html mesh_order_no_concurrent.png
      "No concurrent submeshes detected"
      -and no mesh order list box will appear in Preview dialog box.
    diff --git a/doc/salome/gui/SMESH/input/creating_groups.doc b/doc/salome/gui/SMESH/input/creating_groups.doc index 4d74a3aa0..29b17f1ae 100644 --- a/doc/salome/gui/SMESH/input/creating_groups.doc +++ b/doc/salome/gui/SMESH/input/creating_groups.doc @@ -23,7 +23,7 @@ elements which will form your group: SALOME Platform distinguishes between the two Group types: Standalone Group and Group on Geometry. -

    Standalone Group

    +\anchor standalone_group

    "Standalone Group"

    Standalone Group consists of mesh elements, which you can define in two possible ways. @@ -79,7 +79,7 @@ be changed, the new one will not be modified. \ref tui_create_standalone_group "Create a Standalone Group" operation. -

    Group on Geometry

    +\anchor group_on_geom

    "Group on Geometry"

    To create a group on geometry check Group on geometry in the \b Group \b type field. Group on geometry contains the elements of a certain type @@ -98,4 +98,4 @@ selected in green. \ref tui_create_group_on_geometry "Create a Group on Geometry" operation. -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/SMESH/input/editing_groups.doc b/doc/salome/gui/SMESH/input/editing_groups.doc index 6cbe5ceb4..d255c3f82 100644 --- a/doc/salome/gui/SMESH/input/editing_groups.doc +++ b/doc/salome/gui/SMESH/input/editing_groups.doc @@ -22,6 +22,7 @@ remove the elements forming it. For more information see group. +\anchor convert_to_standalone To convert an existing group on geometry into standalone group of elements and modify:
      diff --git a/doc/salome/gui/SMESH/input/find_element_by_point.doc b/doc/salome/gui/SMESH/input/find_element_by_point.doc index 34380aed4..fcdadea29 100644 --- a/doc/salome/gui/SMESH/input/find_element_by_point.doc +++ b/doc/salome/gui/SMESH/input/find_element_by_point.doc @@ -24,8 +24,8 @@ The following dialog box will appear: diff --git a/doc/salome/gui/SMESH/input/index.doc b/doc/salome/gui/SMESH/input/index.doc index 2de722d16..7e18d2b68 100644 --- a/doc/salome/gui/SMESH/input/index.doc +++ b/doc/salome/gui/SMESH/input/index.doc @@ -16,7 +16,8 @@ the VTK viewer; allowing to highlight important elements:
    1. \subpage modifying_meshes_page "modifying meshes" with a vast array of dedicated operations.
    2. -
    3. \subpage using_notebook_mesh_page.
    4. +
    5. easily setting parameters via the variables predefined in +\subpage using_notebook_mesh_page "Salome notebook".
    6. Almost all mesh module functionalities are accessible via diff --git a/doc/salome/gui/SMESH/input/merging_elements.doc b/doc/salome/gui/SMESH/input/merging_elements.doc index d677e179e..50513d58f 100644 --- a/doc/salome/gui/SMESH/input/merging_elements.doc +++ b/doc/salome/gui/SMESH/input/merging_elements.doc @@ -8,32 +8,31 @@ selectable in the dialog box. \image html mergeelems_ico.png "Merge elements button"
        -
      1. From the \b Modification choose \b Transformation and from its -sub-menu select the Merge elements item. The following dialog box +
      2. Choose in the main menu \b Modification -> \b Transformation -> Merge elements item. The following dialog box shall appear:
      3. \image html mergeelems_auto.png
        • \b Name is the name of the mesh whose elements will be merged.
        • -
        • \b Automatic Mode or \b Manual Mode is to switch the dialog -controls type. +
        • \b Automatic or \b Manual Mode allows choosing how the elements +are processed.
      4. Automatic mode:
          -
        • In \b Automatic Mode the elements that were created on the same nodes will be merged.
        • +
        • In the \b Automatic Mode the elements created on the same nodes will be merged.
      5. -
      6. If the \b Manual Mode is selected there are additional controls to -manage the elements to be merged in more detail: +
      7. If the \b Manual Mode is selected, additional controls are +available: \image html mergeelems.png
        • \b Detect button generates the list of coincident elements for the given \b Tolerance.
        • -
        • Coincident elements is a list of groupes of elements for +
        • Coincident elements is a list of groups of elements for merging. All elements of each group will form one after the operation.
          • \b Remove button deletes the selected group from the list.
          • diff --git a/doc/salome/gui/SMESH/input/merging_nodes.doc b/doc/salome/gui/SMESH/input/merging_nodes.doc index d94d6f49d..eb17e0a14 100644 --- a/doc/salome/gui/SMESH/input/merging_nodes.doc +++ b/doc/salome/gui/SMESH/input/merging_nodes.doc @@ -17,25 +17,24 @@ shall appear:
            • \b Name is the name of the mesh whose nodes will be merged.
            • -
            • \b Automatic Mode or \b Manual Mode is to switch the dialog -controls type. +
            • \b Automatic or \b Manual Mode allows choosing how the nodes are +processed.
            • \b Tolerance is a maximum distance between nodes sufficient for -merging, that is able in both dialog modes.
            • +merging.
          • Automatic mode:
              -
            • In \b Automatic Mode to merge the Nodes, just input the tolerance -value and confirm by \b Apply button.
            • +
            • In the \b Automatic Mode all Nodes within the indicated tolerance +will be merged.

          • -
          • If the \b Manual Mode is selected there are additional controls to -manage the nodes to be merged in more detail: +
          • If the \b Manual Mode is selected, additional controls are available:
            • \b Detect button generates the list of coincident nodes for the given \b Tolerance.
            • -
            • Coincident nodes is a list of groupes of nodes for +
            • Coincident nodes is a list of groups of nodes for merging. All nodes of each group will form one after the operation.
                diff --git a/doc/salome/gui/SMESH/input/modifying_meshes.doc b/doc/salome/gui/SMESH/input/modifying_meshes.doc index afa553f1b..05180eb4b 100644 --- a/doc/salome/gui/SMESH/input/modifying_meshes.doc +++ b/doc/salome/gui/SMESH/input/modifying_meshes.doc @@ -23,7 +23,7 @@ the mesh or some of its elements. through a point or a vector of symmetry.
              • Unite meshes by \subpage sewing_meshes_page "sewing" free borders, conform free borders, border to side or side elements.
              • -
              • \subpage merging_nodes_page "Merge Notes", considered coincident +
              • \subpage merging_nodes_page "Merge Nodes", considered coincident within the indicated tolerance.
              • \subpage merging_elements_page "Merge Elements", considered coincident within the indicated tolerance.
              • diff --git a/doc/salome/gui/SMESH/input/pattern_mapping.doc b/doc/salome/gui/SMESH/input/pattern_mapping.doc index db4be4144..1a48a4644 100644 --- a/doc/salome/gui/SMESH/input/pattern_mapping.doc +++ b/doc/salome/gui/SMESH/input/pattern_mapping.doc @@ -11,30 +11,83 @@ located at geometrical vertices. Pattern description is stored in \.smp file. The smp file contains 4 sections: -
                  -
                1. The first line holds the number of nodes (N).
                2. -
                3. The next N lines describe nodes coordinates. Each line holds 2 -coordinates of a node.
                4. - -
                5. A key-points line: indices of nodes to be mapped on geometrical -vertices. An index n refers to a node described on an n-th line of -section 2. The first node index is zero.
                6. - -
                7. The rest lines describe nodal connectivity of elements, one line +-# The first line holds the total number of the pattern nodes (N). +-# The next N lines describe nodes coordinates. Each line holds 2 +coordinates of a node for 2D pattern or 3 cordinates for 3D pattern. +Note, that for 3D pattern only relateive values in range [0;1] are +valid for coordinates of the nodes. +-# A key-points line: indices of nodes to be mapped on geometrical +vertices (for 2D pattern only). An index n refers to a node described +on an n-th line of section 2. The first node index is zero. For 3D +pattern key points are not specified. +-# The rest lines describe nodal connectivity of elements, one line for an element. A line holds indices of nodes forming an element. An index n refers to a node described on an n-th line of the section 2. The first node index is zero. There must be 3 or 4 indices on a -line: only 2d elements are allowed.
                8. -
                +line for 2D pattern (only 2d elements are allowed) and 4, 5, 6 or 8 +indices for 3D pattern (only 3d elements are allowed). The 2D pattern must contain at least one element and at least one key-point. All key-points must lay on boundaries. -An example of a simple smp file and a preview of a pattern described -in this file: - -\image html image94.gif +The 3D pattern must contain at least one element. + +An example of a simple 2D pattern smp file: + +\code +!!! SALOME 2D mesh pattern file +!!! +!!! Nb of points: +9 + 200 0 !- 0 + 100 0 !- 1 + 0 0 !- 2 + 0 -100 !- 3 + 0 -200 !- 4 + 100 -200 !- 5 + 200 -200 !- 6 + 200 -100 !- 7 + 100 -100 !- 8 +!!! Indices of 4 key-points + 2 0 4 6 +!!! Indices of points of 6 elements + 0 1 8 + 8 5 6 7 + 2 3 8 + 8 3 4 5 + 8 7 0 + 8 1 2 +\endcode + +The image below provides a preview of above described pattern: + +\image html pattern2d.png + +An example of a simple 3D pattern smp file: + +\code +!!! SALOME 3D mesh pattern file +!!! +!!! Nb of points: +9 + 0 0 0 !- 0 + 1 0 0 !- 1 + 0 1 0 !- 2 + 1 1 0 !- 3 + 0 0 1 !- 4 + 1 0 1 !- 5 + 0 1 1 !- 6 + 1 1 1 !- 7 + 0.5 0.5 0.5 !- 8 +!!! Indices of points of 6 elements: + 0 1 5 4 8 + 7 5 1 3 8 + 3 2 6 7 8 + 2 0 4 6 8 + 0 2 3 1 8 + 4 5 7 6 8 +\endcode

                Application of pattern mapping

                @@ -50,86 +103,89 @@ The following dialog box shall appear: \image html patternmapping1.png +
                2D Pattern Mapping dialog box
                + \image html patternmapping2.png +
                3D Pattern Mapping dialog box
                + To apply a pattern to a geometrical object, you should specify: -
                  -
                • a face having the number of vertices equal to the number of -key-points in the pattern; the number of key-points on internal -boundaries of a pattern must also be equal to the number of vertices -on internal boundaries of a face;
                • -
                • a vertex to which the first key-point should be mapped;
                • -
                • reverse or not the order of key-points. (The order of vertices of -a face is counterclockwise looking from outside).
                • -
                + +-# For 2D pattern + - A face having the number of vertices equal to the number of + key-points in the pattern; the number of key-points on internal + boundaries of a pattern must also be equal to the number of vertices + on internal boundaries of a face; + - A vertex to which the first key-point should be mapped; + - Reverse or not the order of key-points. (The order of vertices of + a face is counterclockwise looking from outside). +-# For 3D pattern + - 3D block (Solid) object; + - Two vertices that specify the order of nodes in the resulting + mesh. Then you either load a .smp pattern file previously created manually by clicking on the "Load pattern" button, or click on the \b -New button for automatic generation. -\n For an automatic generation you just specify a geometrical face -having a mesh built on it. Mesh nodes lying on face vertices become -key-points. Additionally, you may choose the way of getting nodes -coordinates by projecting nodes on the face instead of using +New button for automatic generation of the pattern. + +For an automatic generation you just specify a geometrical face (for +2D) or solid (for 3d) having a mesh built on it. Mesh nodes lying on +face vertices become key-points of 2D pattern. Additionally, for 2D +pattern you may choose the way of getting nodes coordinates by +projecting nodes on the face instead of using "positions on face" generated by mesher (if there is any). Faces having a seam edge can't be used for automatic pattern creation. When creating a pattern from an existing mesh, there are two possible cases: -
                  -
                1. A sub-mesh on face is selected. A pattern is created from the 2d -elements bound to a face by mesher. Node coordinates are either + +- A sub-mesh on face/solid is selected. A pattern is created from the 2d/3d +elements bound to a face/solid by mesher. For 2D pattern, node coordinates are either "positions on face" computed by mesher, or coordinates got by node -projection on a geometrical surface, according to your choice.
                2. -
                3. A mesh where the main shape is a face, is selected. A pattern is -created from all the 2d elements in a mesh. If all mesh elements are -build by mesher, the user can select the way of getting nodes -coordinates, else all nodes are projected on a face surface.
                4. -
                +projection on a geometrical surface, according to the user choice. For +3D pattern, nodes coordinates correspond to the nodes computed by mesher. +- A mesh where the main shape is a face/solid, is selected. A pattern is +created from all the 2d/3d elements in a mesh. In addition, for 2D +pattern, if all mesh elements are build by mesher, the user can select +the way of getting nodes coordinates, else all nodes are projected on +a face surface. \image html a-patterntype.png +
                2D Pattern Creation dialog box
                + \image html a-patterntype1.png +
                3D Pattern Creation dialog box
                +

                Mapping algorithm

                -The mapping algorithm is as follows: -
                  -
                1. Key-points are set in the order that they are encountered when -walking along a pattern boundary so that elements are on the left. The -first key-point is preserved. -
                2. - -
                3. Find geometrical vertices corresponding to key-points by vertices -order in a face boundary; here, "Reverse order of key-points" flag is -taken into account. - -\image html image95.gif -
                4. - -
                5. Boundary nodes of a pattern are mapped onto edges of a face: a -node located between certain key-points on a pattern boundary is -mapped on a geometrical edge limited by corresponding geometrical -vertices. Node position on an edge reflects its distance from two -key-points. - -\image html image96.gif -
                6. - -
                7. Coordinates of a non-boundary node in a parametric space of a face -are defined as following. In a parametric space of a pattern, a node -lays at the intersection of two iso-lines, each of which intersects a -pattern boundary at least at two points. Knowing mapped positions of -boundary nodes, we find where isoline-boundary intersection points are -mapped to, and hence we can find mapped isolines direction and then, -two node positions on two mapped isolines. The eventual mapped -position of a node is found as an average of positions on mapped -isolines. - -\image html image97.gif -
                8. -
                - -
                See Also a sample TUI Script of a +The mapping algorithm for 2D case is as follows: + +- Key-points are set in the order that they are encountered when + walking along a pattern boundary so that elements are on the left. The + first key-point is preserved. +- Find geometrical vertices corresponding to key-points by vertices + order in a face boundary; here, "Reverse order of key-points" flag is + taken into account. \image html image95.gif +- Boundary nodes of a pattern are mapped onto edges of a face: a + node located between certain key-points on a pattern boundary is + mapped on a geometrical edge limited by corresponding geometrical + vertices. Node position on an edge reflects its distance from two + key-points. \image html image96.gif +- Coordinates of a non-boundary node in a parametric space of a face + are defined as following. In a parametric space of a pattern, a node + lays at the intersection of two iso-lines, each of which intersects a + pattern boundary at least at two points. Knowing mapped positions of + boundary nodes, we find where isoline-boundary intersection points are + mapped to, and hence we can find mapped isolines direction and then, + two node positions on two mapped isolines. The eventual mapped + position of a node is found as an average of positions on mapped + isolines. \image html image97.gif + +For 3D case the algorithm is similar. + +See Also a sample TUI Script of a \ref tui_pattern_mapping "Pattern Mapping" operation. */ diff --git a/doc/salome/gui/SMESH/input/point_marker.doc b/doc/salome/gui/SMESH/input/point_marker.doc index c298893ef..40c2b932b 100644 --- a/doc/salome/gui/SMESH/input/point_marker.doc +++ b/doc/salome/gui/SMESH/input/point_marker.doc @@ -9,7 +9,7 @@ shapes or by loading a custom texture from an external file. - Standard point markers The Mesh module provides a set of predefined point marker shapes -which can be used to display points in 3D viewer. +which can be used to display points in the 3D viewer. Each standard point marker has two attributes: type (defines shape form) and scale factor (defines shape size). @@ -23,9 +23,9 @@ form) and scale factor (defines shape size). It is also possible to load a point marker shape from an external file. This file should provide a description of the point texture as a set -of lines; each line is represented as sequence of "0" and "1" symbols, +of lines; each line is represented as a sequence of "0" and "1" symbols, where "1" symbol means an opaque pixel and "0" symbol means a -transparent pixel. The width of the texture correspond to the length +transparent pixel. The width of the texture corresponds to the length of the longest line in the file, expanded to the nearest byte-aligned value. The height of the texture is equal to the number of non-empty lines in the file. Note that missing symbols are replaced by "0". diff --git a/doc/salome/gui/SMESH/input/scale.doc b/doc/salome/gui/SMESH/input/scale.doc index 5b10fb5a5..b833903b6 100644 --- a/doc/salome/gui/SMESH/input/scale.doc +++ b/doc/salome/gui/SMESH/input/scale.doc @@ -69,17 +69,17 @@ name in the adjacent box); Example of using: -1. Create quandrangle mesh 3x3 on simple planar face (200x200) +1. Create quandrangle mesh 3x3 on a simple planar face (200x200) \image html scaleinit01.png -and union 3 face (along axis Z) to group "gr_faces" +and union 3 faces (along axis Z) to group "gr_faces" \image html scaleinit02.png -2. Perform scale operation for whole mesh with creation of new mesh: +2. Perform scale operation for the whole mesh and create a new mesh: \image html scale03.png @@ -89,7 +89,7 @@ result after operation: -3. Perform scale operation for whole mesh with copy of elements: +3. Perform scale operation for the whole mesh and copy elements: \image html scale04.png @@ -99,7 +99,7 @@ result after operation: -4. Perform scale operation for group of faces with copy of elements: +4. Perform scale operation for a group of faces and copy elements: \image html scale06.png @@ -109,7 +109,7 @@ result after operation: -5. Perform scale operation for two edges with moving of elements: +5. Perform scale operation for two edges and move elements: \image html scale07.png @@ -119,7 +119,7 @@ result after operation: -6. Perform scale operation for one face with moving of elements: +6. Perform scale operation for one face and move elements: \image html scale09.png diff --git a/doc/salome/gui/SMESH/input/split_to_tetra.doc b/doc/salome/gui/SMESH/input/split_to_tetra.doc index 57efb37eb..4817a3f2f 100644 --- a/doc/salome/gui/SMESH/input/split_to_tetra.doc +++ b/doc/salome/gui/SMESH/input/split_to_tetra.doc @@ -23,7 +23,7 @@ The following dialog box will appear:
              • The main list contains the list of volumes. You can click on a volume in the 3D viewer and it will be highlighted (lock Shift keyboard button to select several volumes). Click \b Add button and -the ID of this volume will be added to the list. To remove a +the ID of this volume will be added to the list. To remove the selected element or elements from the list click \b Remove button. Sort list button allows to sort the list of IDs. \b Filter button allows to apply a definite filter to the selection of volumes. @@ -40,12 +40,12 @@ volumes of the currently displayed mesh or submesh.
              • Into 5 tetrahedra and Into 6 tetrahedra allows to specify the number of tetrahedra a hexahedron will be split into. If the specified method does not allow to get a conform mesh, a generic solution is applied: an additional node -is created at gravity center of a hexahedron, serving an apex of tetrahedra, all quadrangle sides of the hexahedron are split into two triangles each serving a base of a new tetrahedron.
              • +is created at the gravity center of a hexahedron, serving an apex of tetrahedra, all quadrangle sides of the hexahedron are split into two triangles each serving a base of a new tetrahedron.
            • -
            • Select from set of fields allows to choose a submesh or an +
            • Select from a set of fields allows to choose a submesh or an existing group whose elements will be automatically added to the list.
            diff --git a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc index 80944666e..1aa91d9d5 100644 --- a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc +++ b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc @@ -536,7 +536,8 @@ radial_Quad_algo = mesh.Quadrangle(algo=RADIAL_QUAD) # In this case it uses "Default Nb of Segments" preferences parameter to discretize edges mesh.Compute() -# The Radial Quadrange uses global or local 1d hypotheses if no its own hypotheses assigned. +# The Radial Quadrange uses global or local 1d hypotheses if it does +# not have its own hypotheses. # Define global hypotheses to discretize radial edges and a local one for circular edge global_Nb_Segments = mesh.Segment().NumberOfSegments(5) local_Nb_Segments = mesh.Segment(circle).NumberOfSegments(10) diff --git a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc index 66b6361fa..2e8f75291 100644 --- a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc @@ -22,6 +22,26 @@ if new_id == 0: print "KO node addition." else: print "New Node has been added with ID ", new_id \endcode +
            +\anchor tui_add_0DElement +

            Add 0D Element

            + +\code +import SMESH_mechanic + +mesh = SMESH_mechanic.mesh + +# add node +node_id = mesh.AddNode(50, 10, 0) + +# add 0D Element +new_id = mesh.Add0DElement(node_id) + +print "" +if new_id == 0: print "KO node addition." +else: print "New 0D Element has been added with ID ", new_id +\endcode +
            \anchor tui_add_edge

            Add Edge

            @@ -768,7 +788,6 @@ mesh.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5) \code import geompy - import smesh # define the geometry @@ -802,17 +821,100 @@ algo2D.MaxElementArea(240) isDone = Mesh_2.Compute() if not isDone: print 'Mesh Mesh_2 : computation failed' -# create a pattern +# create a 2d pattern pattern = smesh.GetPattern() isDone = pattern.LoadFromFace(Mesh_2.GetMesh(), Face_2, 0) if (isDone != 1): print 'LoadFromFace :', pattern.GetErrorCode() # apply the pattern to a face of the first mesh -pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), [17], 0, 0) - +facesToSplit = Mesh_1.GetElementsByType(smesh.SMESH.FACE) +print "Splitting %d rectangular face(s) to %d triangles..."%(len(facesToSplit), 2*len(facesToSplit)) +pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), facesToSplit, 0, 0) isDone = pattern.MakeMesh(Mesh_1.GetMesh(), 0, 0) if (isDone != 1): print 'MakeMesh :', pattern.GetErrorCode() + +# create quadrangle mesh +Mesh_3 = smesh.Mesh(Box_1) +Mesh_3.Segment().NumberOfSegments(1) +Mesh_3.Quadrangle() +Mesh_3.Hexahedron() +isDone = Mesh_3.Compute() +if not isDone: print 'Mesh Mesh_3 : computation failed' + +# create a 3d pattern (hexahedrons) +pattern_hexa = smesh.GetPattern() + +smp_hexa = """!!! Nb of points: +15 + 0 0 0 !- 0 + 1 0 0 !- 1 + 0 1 0 !- 2 + 1 1 0 !- 3 + 0 0 1 !- 4 + 1 0 1 !- 5 + 0 1 1 !- 6 + 1 1 1 !- 7 + 0.5 0 0.5 !- 8 + 0.5 0 1 !- 9 + 0.5 0.5 0.5 !- 10 + 0.5 0.5 1 !- 11 + 1 0 0.5 !- 12 + 1 0.5 0.5 !- 13 + 1 0.5 1 !- 14 + !!! Indices of points of 4 elements: + 8 12 5 9 10 13 14 11 + 0 8 9 4 2 10 11 6 + 2 10 11 6 3 13 14 7 + 0 1 12 8 2 3 13 10""" + +pattern_hexa.LoadFromFile(smp_hexa) + +# apply the pattern to a mesh +volsToSplit = Mesh_3.GetElementsByType(smesh.SMESH.VOLUME) +print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 4*len(volsToSplit)) +pattern_hexa.ApplyToHexahedrons(Mesh_3.GetMesh(), volsToSplit,0,3) +isDone = pattern_hexa.MakeMesh(Mesh_3.GetMesh(), True, True) +if (isDone != 1): print 'MakeMesh :', pattern_hexa.GetErrorCode() + +# create one more quadrangle mesh +Mesh_4 = smesh.Mesh(Box_1) +Mesh_4.Segment().NumberOfSegments(1) +Mesh_4.Quadrangle() +Mesh_4.Hexahedron() +isDone = Mesh_4.Compute() +if not isDone: print 'Mesh Mesh_4 : computation failed' + +# create another 3d pattern (pyramids) +pattern_pyra = smesh.GetPattern() + +smp_pyra = """!!! Nb of points: +9 + 0 0 0 !- 0 + 1 0 0 !- 1 + 0 1 0 !- 2 + 1 1 0 !- 3 + 0 0 1 !- 4 + 1 0 1 !- 5 + 0 1 1 !- 6 + 1 1 1 !- 7 + 0.5 0.5 0.5 !- 8 + !!! Indices of points of 6 elements: + 0 1 5 4 8 + 7 5 1 3 8 + 3 2 6 7 8 + 2 0 4 6 8 + 0 2 3 1 8 + 4 5 7 6 8""" + +pattern_pyra.LoadFromFile(smp_pyra) + +# apply the pattern to a face mesh +volsToSplit = Mesh_4.GetElementsByType(smesh.SMESH.VOLUME) +print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 6*len(volsToSplit)) +pattern_pyra.ApplyToHexahedrons(Mesh_4.GetMesh(), volsToSplit,1,0) +isDone = pattern_pyra.MakeMesh(Mesh_4.GetMesh(), True, True) +if (isDone != 1): print 'MakeMesh :', pattern_pyra.GetErrorCode() \endcode
            diff --git a/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc b/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc index 1658e58c5..c55b2a492 100644 --- a/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc @@ -62,16 +62,16 @@ Nb_Segments_1.SetDistrType( 0 ) Quadrangle_2D = Mesh1.Quadrangle() isDone = Mesh1.Compute() -#Perform scale opration for whole mesh with creation of new mesh +#Perform scale opration for the whole mesh and creation of a new mesh newMesh = Mesh1.ScaleMakeMesh(Mesh1,SMESH.PointStruct(100,100,200),[0.5,0.3,0.7],True,"ScaledMesh") -#Perform scale operation for whole mesh with copy of elements +#Perform scale operation for the whole mesh and copy elements Mesh1.Scale(Mesh1,SMESH.PointStruct(200,100,100),[0.5,0.5,0.5],True,True) -#Perform scale opration for two edges with moving of elements +#Perform scale opration for two edges and move elements Mesh1.Scale([1,2],SMESH.PointStruct(-100,100,100),[0.8,1.0,0.7],False) -#Perform scale opration for one face with moving of elements +#Perform scale opration for one face and move elements Mesh1.Scale([21],SMESH.PointStruct(0,200,200),[0.7,0.7,0.7],False) \endcode diff --git a/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc b/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc index 207c4dda5..17f4c5f7f 100644 --- a/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc +++ b/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc @@ -37,9 +37,9 @@ Faces, Edges or both.
          • 2D Quadratic - allows to select between the representation of quadratic edges as broken lines or as arcs
          • Orientation of faces - shows vectors of orientation of -faces of the selected mesh. Vector is shown for each 2D mesh element -and for each free face of 3D mesh element. Vector direction is calculated by -the first three nodes of face as a cross product of vectors n1-n2 and n1-n3.
          • +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 "Colors / Size" - allows to select color and size of meshes.
          • \subpage transparency_page "Transparency" - allows to change the diff --git a/resources/Makefile.am b/resources/Makefile.am index ca671b982..97f2c3b6f 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -80,6 +80,7 @@ dist_salomeres_DATA = \ mesh_tree_algo_hexa.png \ mesh_tree_algo_mefisto.png \ mesh_tree_algo.png \ + mesh_tree_algo_0D.png \ mesh_tree_algo_quad.png \ mesh_tree_algo_regular.png \ mesh_tree_algo_tetra.png \ @@ -149,6 +150,9 @@ dist_salomeres_DATA = \ 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 \ diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index 173cbd077..e4ddfa738 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -99,7 +99,7 @@ - + diff --git a/resources/mesh_tree_algo_0D.png b/resources/mesh_tree_algo_0D.png new file mode 100644 index 000000000..5725a17d4 Binary files /dev/null and b/resources/mesh_tree_algo_0D.png differ diff --git a/resources/mesh_tree_algo_existing_2D.png b/resources/mesh_tree_algo_existing_2D.png new file mode 100644 index 000000000..db0de789a Binary files /dev/null and b/resources/mesh_tree_algo_existing_2D.png differ diff --git a/resources/mesh_tree_algo_prism.png b/resources/mesh_tree_algo_prism.png new file mode 100644 index 000000000..0025d48b8 Binary files /dev/null and b/resources/mesh_tree_algo_prism.png differ diff --git a/resources/mesh_tree_algo_radial_quadrangle_1D2D.png b/resources/mesh_tree_algo_radial_quadrangle_1D2D.png new file mode 100644 index 000000000..234ed3055 Binary files /dev/null and b/resources/mesh_tree_algo_radial_quadrangle_1D2D.png differ diff --git a/src/SMDS/SMDS_Downward.cxx b/src/SMDS/SMDS_Downward.cxx index 561b10b20..f3fbd0efc 100644 --- a/src/SMDS/SMDS_Downward.cxx +++ b/src/SMDS/SMDS_Downward.cxx @@ -322,8 +322,8 @@ int SMDS_Down1D::computeVtkCells(int *pts, std::vector& vtkIds) // --- find all the cells the points belong to, and how many of the points belong to a given cell - int cellIds[100]; - int cellCnt[100]; + int cellIds[1000]; + int cellCnt[1000]; int cnt = 0; for (int i = 0; i < _nbDownCells; i++) { @@ -347,7 +347,7 @@ int SMDS_Down1D::computeVtkCells(int *pts, std::vector& vtkIds) { cellIds[cnt] = vtkCellId; cellCnt[cnt] = 1; - // TODO ASSERT(cnt<100); + // TODO ASSERT(cnt<1000); cnt++; } } @@ -531,8 +531,8 @@ int SMDS_Down2D::computeVolumeIdsFromNodesFace(int* pts, int npts, int* ids) // --- find all the cells the points belong to, and how many of the points belong to a given cell - int cellIds[100]; - int cellCnt[100]; + int cellIds[1000]; + int cellCnt[1000]; int cnt = 0; for (int i = 0; i < npts; i++) { @@ -557,7 +557,7 @@ int SMDS_Down2D::computeVolumeIdsFromNodesFace(int* pts, int npts, int* ids) { cellIds[cnt] = vtkCellId; cellCnt[cnt] = 1; - // TODO ASSERT(cnt<100); + // TODO ASSERT(cnt<1000); cnt++; } } diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index 4713a19a8..35690ac53 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.cxx +++ b/src/SMDS/SMDS_UnstructuredGrid.cxx @@ -538,8 +538,8 @@ void SMDS_UnstructuredGrid::BuildDownwardConnectivity() downEdge->setNodes(connEdgeId, vtkEdgeId); vector vtkIds; int nbVtkCells = downEdge->computeVtkCells(connEdgeId, vtkIds); - int downFaces[100]; - unsigned char downTypes[100]; + int downFaces[1000]; + unsigned char downTypes[1000]; int nbDownFaces = downEdge->computeFaces(connEdgeId, &vtkIds[0], nbVtkCells, downFaces, downTypes); for (int n = 0; n < nbDownFaces; n++) { @@ -591,8 +591,8 @@ void SMDS_UnstructuredGrid::BuildDownwardConnectivity() SMDS_Down1D* downEdge = static_cast (_downArray[vtkEdgeType]); int nbVtkCells = downEdge->computeVtkCells(pts, vtkIds); //CHRONOSTOP(41);CHRONO(42); - int downFaces[100]; - unsigned char downTypes[100]; + int downFaces[1000]; + unsigned char downTypes[1000]; int nbDownFaces = downEdge->computeFaces(pts, &vtkIds[0], nbVtkCells, downFaces, downTypes); //CHRONOSTOP(42); diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index b8a52e175..2a52ec831 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -9057,7 +9057,7 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d) ReplaceElemInGroups(volume, NewVolume, meshDS); } } - if ( !theForce3d ) { + if ( !theForce3d && !getenv("NO_FixQuadraticElements")) { aHelper.SetSubShape(0); // apply to the whole mesh aHelper.FixQuadraticElements(); } diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 12314b5cb..33e7ceb70 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -601,14 +601,13 @@ double SMESH_MesherHelper::GetNodeU(const TopoDS_Edge& E, bool* check) { double param = 0; - const SMDS_PositionPtr Pos = n->GetPosition(); - if ( Pos->GetTypeOfPosition()==SMDS_TOP_EDGE ) + const SMDS_PositionPtr pos = n->GetPosition(); + if ( pos->GetTypeOfPosition()==SMDS_TOP_EDGE ) { - const SMDS_EdgePosition* epos = - static_cast(n->GetPosition()); + const SMDS_EdgePosition* epos = static_cast( pos ); param = epos->GetUParameter(); } - else if( Pos->GetTypeOfPosition() == SMDS_TOP_VERTEX ) + else if( pos->GetTypeOfPosition() == SMDS_TOP_VERTEX ) { if ( inEdgeNode && TopExp::FirstVertex( E ).IsSame( TopExp::LastVertex( E ))) // issue 0020128 { @@ -620,13 +619,21 @@ double SMESH_MesherHelper::GetNodeU(const TopoDS_Edge& E, else { SMESHDS_Mesh * meshDS = GetMeshDS(); - int vertexID = n->GetPosition()->GetShapeId(); + int vertexID = pos->GetShapeId(); const TopoDS_Vertex& V = TopoDS::Vertex(meshDS->IndexToShape(vertexID)); param = BRep_Tool::Parameter( V, E ); } } if ( check ) - *check = CheckNodeU( E, n, param, BRep_Tool::Tolerance( E )); + { + double tol = BRep_Tool::Tolerance( E ); + double f,l; BRep_Tool::Range( E, f,l ); + bool force = ( param < f-tol || param > l+tol ); + if ( !force && pos->GetTypeOfPosition()==SMDS_TOP_EDGE ) + force = ( GetMeshDS()->ShapeToIndex( E ) != pos->GetShapeId() ); + + *check = CheckNodeU( E, n, param, tol, force ); + } return param; } @@ -680,6 +687,20 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E, { ((SMESH_MesherHelper*) this)->myOkNodePosShapes.insert( n->GetPosition()->GetShapeId() ); } + if (( u < f-tol || u > l+tol ) && force ) + { + // node is on vertex but is set on periodic but trimmed edge (issue 0020890) + try + { + // do not use IsPeriodic() as Geom_TrimmedCurve::IsPeriodic () returns false + double period = curve->Period(); + u = ( u < f ) ? u + period : u - period; + } + catch (Standard_Failure& exc) + { + return false; + } + } } } return true; diff --git a/src/SMESH/SMESH_Pattern.cxx b/src/SMESH/SMESH_Pattern.cxx index d6aee34df..5e311bf9d 100644 --- a/src/SMESH/SMESH_Pattern.cxx +++ b/src/SMESH/SMESH_Pattern.cxx @@ -73,6 +73,7 @@ #include "SMESH_MesherHelper.hxx" #include "SMESH_subMesh.hxx" +#include #include "utilities.h" using namespace std; @@ -210,6 +211,8 @@ bool SMESH_Pattern::Load (const char* theFileContents) { MESSAGE("Load( file ) "); + Kernel_Utils::Localizer loc; + // file structure: // ! This is a comment @@ -353,6 +356,9 @@ bool SMESH_Pattern::Load (const char* theFileContents) bool SMESH_Pattern::Save (ostream& theFile) { MESSAGE(" ::Save(file) " ); + + Kernel_Utils::Localizer loc; + if ( !IsLoaded() ) { MESSAGE(" Pattern not loaded "); return setErrorCode( ERR_SAVE_NOT_LOADED ); diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 9064a3a1a..cfaff2ec4 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1484,6 +1484,22 @@ SalomeApp_Study* SMESHGUI::activeStudy() return NULL; } +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::Modified( bool theIsUpdateActions ) +{ + if( SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication() ) ) { + if( SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ) ) { + appStudy->Modified(); + if( theIsUpdateActions ) + app->updateActions(); + } + } +} + //============================================================================= /*! * @@ -3856,8 +3872,8 @@ void SMESHGUI::createPreferences() // Set property for precision value for spinboxes for ( ii = 0; ii < nbQuantities; ii++ ){ - setPreferenceProperty( precs[ii], "min", -10 ); - setPreferenceProperty( precs[ii], "max", 10 ); + setPreferenceProperty( precs[ii], "min", -14 ); + setPreferenceProperty( precs[ii], "max", 14 ); setPreferenceProperty( precs[ii], "precision", 2 ); } @@ -4880,5 +4896,7 @@ int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString */ void SMESHGUI::onHypothesisEdit( int result ) { + if( result == 1 ) + SMESHGUI::Modified(); updateObjBrowser( true ); } diff --git a/src/SMESHGUI/SMESHGUI.h b/src/SMESHGUI/SMESHGUI.h index 503740c61..0099a20bd 100644 --- a/src/SMESHGUI/SMESHGUI.h +++ b/src/SMESHGUI/SMESHGUI.h @@ -79,6 +79,8 @@ public : static bool automaticUpdate(); + static void Modified( bool = true ); + virtual LightApp_Displayer* displayer(); virtual QString engineIOR() const; virtual void initialize( CAM_Application* ); diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx index 03ade25cb..a5d12e559 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx @@ -447,6 +447,7 @@ void SMESHGUI_AddMeshElementDlg::Init() connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument())); /* to close dialog if study frame change */ connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), SLOT(ClickOnCancel())); if (Reverse) connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int))); @@ -570,6 +571,8 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply() myEditCurrentArgument->setText(""); myBusy = false; + + SMESHGUI::Modified(); } } diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx index 601006b70..d190c35e3 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx @@ -666,6 +666,7 @@ void SMESHGUI_AddQuadraticElementDlg::Init() connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog())); connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), SLOT(ClickOnCancel())); // set selection mode SMESH::SetPointRepresentation(true); @@ -806,6 +807,8 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply() SetEditCorners(); updateButtons(); + + SMESHGUI::Modified(); } //================================================================================= diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx index fe9e5317e..bc6c1daf5 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx @@ -331,6 +331,8 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply() SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor); }// end IPAL21468 + SMESHGUI::Modified(); + return true; } return false; diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx index f5ed5ea15..5b8777753 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx @@ -27,6 +27,7 @@ // #include "SMESHGUI_ConvToQuadOp.h" +#include "SMESHGUI.h" #include "SMESHGUI_ConvToQuadDlg.h" #include "SMESHGUI_Utils.h" @@ -234,6 +235,7 @@ bool SMESHGUI_ConvToQuadOp::onApply() } if( aResult ) { + SMESHGUI::Modified(); update( UF_ObjBrowser | UF_Model | UF_Viewer ); selectionDone(); } diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx index 1501f0825..864537e84 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx @@ -574,6 +574,8 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply() } //ConstructorsClicked( GetConstructorId() ); busy = false; + + SMESHGUI::Modified(); } } diff --git a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx index 95906a3f9..63ce53b12 100644 --- a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx @@ -219,6 +219,7 @@ bool SMESHGUI_DeleteGroupDlg::onApply() myListGrp.clear(); mySelectionMgr->clearSelected(); SMESH::UpdateView(); + SMESHGUI::Modified(); mySMESHGUI->updateObjBrowser(true); myBlockSelection = false; diff --git a/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx index 5405ec451..64559a58a 100644 --- a/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx @@ -672,6 +672,7 @@ bool SMESHGUI_EditMeshDlg::ClickOnApply() } SMESH::UpdateView(); + SMESHGUI::Modified(); return true; } diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index b2ca95017..7b9997de3 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -167,6 +167,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod ElementsLineEdit = new QLineEdit(GroupArguments); ElementsLineEdit->setValidator(myIdValidator); + ElementsLineEdit->setMaxLength(-1); myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); @@ -671,6 +672,8 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() if ( myMeshActor ) SMESH::Update( myMeshActor->getIO(), myMeshActor->GetVisibility() ); + SMESHGUI::Modified(); + if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) mySMESHGUI->updateObjBrowser(true); // new groups may appear //SMESH::UpdateView(); diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index 89ebc7f55..b402a0dfe 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -165,6 +165,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); + LineEditElements->setMaxLength(-1); myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); @@ -572,6 +573,8 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply() mySelectionMgr->clearSelected(); mySelectedObject = SMESH::SMESH_IDSource::_nil(); SelectionIntoArgument(); + + SMESHGUI::Modified(); } return true; } diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index 711d9a220..f9b4af034 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -2517,31 +2517,18 @@ void SMESHGUI_FilterDlg::setIdsToWg (QWidget* theWg, const QList& theIds) if (theWg == 0) return; + QStringList aStrList; + foreach(int id, theIds) + aStrList << QString::number(id); + if (theWg->inherits("QListWidget")) { - QListWidget* aListBox = qobject_cast( theWg ); - aListBox->clear(); - - QStringList aStrList; - QList::const_iterator anIter; - for (anIter = theIds.begin(); anIter != theIds.end(); ++anIter) - aStrList.append(QString("%1").arg(*anIter)); - - aListBox->addItems(aStrList); + qobject_cast(theWg)->clear(); + qobject_cast(theWg)->addItems(aStrList); } else if (theWg->inherits("QLineEdit")) { - QLineEdit* aLineEdit = qobject_cast( theWg ); - QString aStr; - QList::const_iterator anIter; - - for (anIter = theIds.begin(); anIter != theIds.end(); ++ anIter) - aStr += QString("%1 ").arg(*anIter); - - if (!aStr.isEmpty()) - aStr.remove(aStr.length() - 1, 1); - - aLineEdit->setText(aStr); + qobject_cast( theWg )->setText(aStrList.join(" ")); } } @@ -2987,14 +2974,12 @@ void SMESHGUI_FilterDlg::onSelectionDone() } } - int aCriterionType = myTable->GetCriterionType(aRow); - if (aList.Extent() != 1 || - !myTable->CurrentCell(aRow, aCol) || - aCriterionType != SMESH::FT_BelongToGeom && - aCriterionType != SMESH::FT_BelongToPlane && - aCriterionType != SMESH::FT_BelongToCylinder && - aCriterionType != SMESH::FT_BelongToGenSurface && - aCriterionType != SMESH::FT_LyingOnGeom) + QList types; + types << SMESH::FT_BelongToGeom << SMESH::FT_BelongToPlane + << SMESH::FT_BelongToCylinder << SMESH::FT_BelongToGenSurface + << SMESH::FT_LyingOnGeom; + if (aList.Extent() != 1 || !myTable->CurrentCell(aRow, aCol) || + !types.contains(myTable->GetCriterionType(aRow))) return; Handle(SALOME_InteractiveObject) anIO = aList.First(); diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index 351c4bc1f..28461ee4f 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -852,6 +852,7 @@ bool SMESHGUI_GroupDlg::onApply() } } + SMESHGUI::Modified(); mySMESHGUI->updateObjBrowser(true); SMESH::UpdateView(); // asv: fix of BUG PAL5515 mySelectionMgr->clearSelected(); @@ -957,6 +958,7 @@ bool SMESHGUI_GroupDlg::onApply() } } + SMESHGUI::Modified(); mySMESHGUI->updateObjBrowser(true); mySelectionMgr->clearSelected(); return true; diff --git a/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx index f5b003709..9fefa98da 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx @@ -27,6 +27,7 @@ #include "SMESHGUI_GroupOnShapeDlg.h" #include "SMESH_TypeFilter.hxx" +#include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_GEOMGenUtils.h" @@ -347,6 +348,8 @@ bool SMESHGUI_GroupOnShapeOp::onApply() group = mesh->CreateGroupFromGEOM( elemType, name.toLatin1().data(), geom ); } } + SMESHGUI::Modified(); + update( UF_ObjBrowser | UF_Model ); init(); diff --git a/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx index 15d772347..39941b26a 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx @@ -604,6 +604,7 @@ bool SMESHGUI_UnionGroupsDlg::onApply() if ( aRes ) { + SMESHGUI::Modified(); getSMESHGUI()->updateObjBrowser(true); reset(); return true; @@ -706,6 +707,7 @@ bool SMESHGUI_IntersectGroupsDlg::onApply() if ( aRes ) { + SMESHGUI::Modified(); getSMESHGUI()->updateObjBrowser(true); reset(); return true; @@ -872,6 +874,7 @@ bool SMESHGUI_CutGroupsDlg::onApply() if ( aRes ) { + SMESHGUI::Modified(); getSMESHGUI()->updateObjBrowser(true); reset(); return true; @@ -1023,6 +1026,7 @@ bool SMESHGUI_DimGroupDlg::onApply() if ( aRes ) { + SMESHGUI::Modified(); getSMESHGUI()->updateObjBrowser(true); reset(); return true; diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index 6f7237c9f..b6e28773a 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -122,6 +122,7 @@ void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent ); connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) ); connect( this, SIGNAL( finished( int ) ), obj, slot.toLatin1().constData() ); + connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), Dlg, SLOT( reject() )); myDlg = Dlg; QFrame* fr = buildFrame(); diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index e8d9204f8..005e6a873 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -414,6 +414,7 @@ namespace SMESH if (aHypSObject) { if (!aHypName.isEmpty()) SMESH::SetName(aHypSObject, aHypName); + SMESHGUI::Modified(); SMESHGUI::GetSMESHGUI()->updateObjBrowser(); return aHypothesis._retn(); } diff --git a/src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.cxx b/src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.cxx index fb404641f..ffbc3b80d 100644 --- a/src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.cxx +++ b/src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.cxx @@ -233,6 +233,7 @@ void SMESHGUI_Make2DFrom3DOp::startOperation() myDlg->SetMeshInfo( aNewInfo ); myDlg->show(); /*exec();*/ commit(); + SMESHGUI::Modified(); } //================================================================================ diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx index 0792b596c..ee35301f0 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx @@ -424,6 +424,7 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() aList.Append(myMeshActor->getIO()); selectionMgr()->setSelectedObjects(aList,false); SMESH::UpdateView(); + SMESHGUI::Modified(); } } catch (const SALOME::SALOME_Exception& S_ex) { diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 1739b419c..4ceb159ee 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -150,7 +150,10 @@ bool SMESHGUI_MeshOp::onApply() else if ( !myToCreate ) aResult = editMeshOrSubMesh( aMess ); if ( aResult ) + { + SMESHGUI::Modified(); update( UF_ObjBrowser | UF_Model ); + } } catch ( const SALOME::SALOME_Exception& S_ex ) { diff --git a/src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx index 494d4eabf..511191c13 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx @@ -138,6 +138,9 @@ bool SMESHGUI_MeshOrderOp::onApply() SUIT_OverrideCursor aWaitCursor; bool res = myMgr ? myMgr->SetMeshOrder() : false; + if( res ) + SMESHGUI::Modified(); + delete myMgr; myMgr = 0; diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index f08d017d9..2f3a7a235 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -510,6 +510,7 @@ bool SMESHGUI_MeshPatternDlg::onApply() } mySelectionMgr->clearSelected(); SMESH::UpdateView(); + SMESHGUI::Modified(); mySMESHGUI->updateObjBrowser(true); diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx index f4c26bb9f..ac5438382 100644 --- a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx @@ -356,6 +356,7 @@ bool SMESHGUI_MoveNodesDlg::onApply() aList.Append(myMeshActor->getIO()); mySelectionMgr->setSelectedObjects(aList,false); SMESH::UpdateView(); + SMESHGUI::Modified(); reset(); } diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx index 98b047400..341ffb284 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx @@ -1052,6 +1052,7 @@ bool SMESHGUI_MultiEditDlg::onApply() mySelector->ClearIndex(); mySelectionMgr->setSelectedObjects( sel ); SMESH::UpdateView(); + SMESHGUI::Modified(); } myListBox->clear(); diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx index d12100ca2..84abe5242 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx @@ -379,6 +379,7 @@ void SMESHGUI_NodesDlg::Init() connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( DeactivateActiveDialog() ) ); /* to close dialog if study frame change */ connect( mySMESHGUI, SIGNAL( SignalStudyFrameChanged() ), SLOT( ClickOnCancel() ) ); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnCancel())); // set selection mode SMESH::SetPointRepresentation( true ); @@ -526,6 +527,9 @@ bool SMESHGUI_NodesDlg::ClickOnApply() } } } + + SMESHGUI::Modified(); + return true; } diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx index 85311c6b7..7d03f2779 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx @@ -33,8 +33,12 @@ // SALOME GUI includes #include +#include +#include +#include #include #include +#include #include // Qt includes @@ -45,6 +49,7 @@ #include #include #include +#include #define SPACING 6 #define MARGIN 11 @@ -186,10 +191,14 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons ); buttonCancel->setAutoDefault( true ); + QPushButton* buttonHelp = new QPushButton( tr( "&Help" ), GroupButtons ); + buttonHelp->setAutoDefault( true ); + GroupButtonsLayout->addWidget( buttonOk ); GroupButtonsLayout->addSpacing( 10 ); GroupButtonsLayout->addStretch(); GroupButtonsLayout->addWidget( buttonCancel ); + GroupButtonsLayout->addWidget( buttonHelp ); // ------------------------------- topLayout->addWidget( ButtonGroup1 ); @@ -200,9 +209,12 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul // ------------------------------- mySMESHGUI->SetActiveDialogBox( this ); + myHelpFileName = "colors_size_page.html"; + /* signals and slots connections */ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) ); connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); @@ -239,6 +251,30 @@ void SMESHGUI_Preferences_ColorDlg::ClickOnCancel() reject(); } +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::ClickOnHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); + else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); + } +} + //================================================================================= // function : DeactivateActiveDialog() // purpose : @@ -447,3 +483,19 @@ int SMESHGUI_Preferences_ColorDlg::getCustomMarkerID() const { return MarkerWidget->getCustomMarkerID(); } + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } +} diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h index dc26a9384..aaaa499a6 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h +++ b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h @@ -71,10 +71,12 @@ public: protected: void closeEvent( QCloseEvent* ); + void keyPressEvent( QKeyEvent* ); private slots: void ClickOnOk(); void ClickOnCancel(); + void ClickOnHelp(); void DeactivateActiveDialog(); void ActivateThisDialog(); @@ -93,6 +95,8 @@ private: QtxColorButton* btnOrientationColor; SMESHGUI_SpinBox* SpinBox_Orientation_Scale; QCheckBox* CheckBox_Orientation_3DVectors; + + QString myHelpFileName; }; #endif // SMESHGUI_PREFERENCES_COLORDLG_H diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx index c6ff898f3..a007feb0f 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx @@ -123,6 +123,7 @@ SMESHGUI_RemoveElementsDlg SelectButtonC1A1->setIcon(image1); LineEditC1A1 = new QLineEdit(GroupC1); LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this)); + LineEditC1A1->setMaxLength(-1); QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 ); connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); @@ -232,7 +233,7 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply() bool aResult = false; try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.inout()); + aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.in()); } catch (const SALOME::SALOME_Exception& S_ex) { SalomeApp_Tools::QtCatchCorbaException(S_ex); myEditCurrentArgument->clear(); @@ -244,6 +245,7 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply() myEditCurrentArgument->clear(); mySelector->ClearIndex(); SMESH::UpdateView(); + SMESHGUI::Modified(); } } } @@ -310,9 +312,6 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText) myNbOkElements = 0; - buttonOk->setEnabled(false); - buttonApply->setEnabled(false); - // hilight entered elements if(myActor){ if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){ @@ -334,12 +333,8 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText) } } - if (myNbOkElements) { - buttonOk->setEnabled(true); - buttonApply->setEnabled(true); - } - myBusy = false; + updateButtons(); } //================================================================================= @@ -348,56 +343,52 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText) //================================================================================= void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument() { - if (myBusy) return; + if (myBusy) return; // busy + if (myFilterDlg && myFilterDlg->isVisible()) return; // filter digl active + if (!GroupButtons->isEnabled()) return; // inactive // clear - myNbOkElements = false; + myNbOkElements = 0; myActor = 0; myBusy = true; myEditCurrentArgument->setText(""); myBusy = false; - if (!GroupButtons->isEnabled()) // inactive - return; - - buttonOk->setEnabled(false); - buttonApply->setEnabled(false); - // get selected mesh SALOME_ListIO aList; mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); int nbSel = aList.Extent(); - if (nbSel != 1) - return; - - Handle(SALOME_InteractiveObject) anIO = aList.First(); - myMesh = SMESH::GetMeshByIO(anIO); - if (myMesh->_is_nil()) - return; - - myActor = SMESH::FindActorByEntry(anIO->getEntry()); - if (!myActor) - return; - - // get selected nodes - QString aString = ""; - int nbElems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aString); - if(nbElems < 1) - return; - myBusy = true; - myEditCurrentArgument->setText(aString); - myBusy = false; - - // OK - - myNbOkElements = nbElems; - - buttonOk->setEnabled(true); - buttonApply->setEnabled(true); + if (nbSel == 1) { + + Handle(SALOME_InteractiveObject) anIO = aList.First(); + myMesh = SMESH::GetMeshByIO(anIO); + + if (!myMesh->_is_nil()) { + + myActor = SMESH::FindActorByEntry(anIO->getEntry()); + if (myActor) { + + // get selected nodes + QString aString = ""; + int nbElems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aString); + if (nbElems > 0) { + myBusy = true; + myEditCurrentArgument->setText(aString); + myBusy = false; + + // OK + + myNbOkElements = nbElems; + } // if (nbElems > 0) + } // if (myActor) + } // if (!myMesh->_is_nil()) + } // if (nbSel == 1) { + + updateButtons(); } //================================================================================= @@ -523,3 +514,13 @@ void SMESHGUI_RemoveElementsDlg::setFilters() myFilterDlg->show(); } + +//================================================================================= +// function : updateButtons +// purpose : enable / disable control buttons +//================================================================================= +void SMESHGUI_RemoveElementsDlg::updateButtons() +{ + buttonOk->setEnabled(myNbOkElements > 0); + buttonApply->setEnabled(myNbOkElements > 0); +} diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h index 246c78a47..9a372bb27 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h @@ -107,6 +107,7 @@ private slots: void ActivateThisDialog(); void onTextChange( const QString& ); void setFilters(); + void updateButtons(); }; #endif // SMESHGUI_REMOVEELEMENTSDLG_H diff --git a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx index fc6c78a30..58fd31fb3 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx @@ -123,6 +123,7 @@ SMESHGUI_RemoveNodesDlg SelectButtonC1A1->setIcon(image1); LineEditC1A1 = new QLineEdit(GroupC1); LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this)); + LineEditC1A1->setMaxLength(-1); QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 ); connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); @@ -234,7 +235,7 @@ void SMESHGUI_RemoveNodesDlg::ClickOnApply() bool aResult = false; try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - aResult = aMeshEditor->RemoveNodes(anArrayOfIdeces.inout()); + aResult = aMeshEditor->RemoveNodes(anArrayOfIdeces.in()); } catch (const SALOME::SALOME_Exception& S_ex) { SalomeApp_Tools::QtCatchCorbaException(S_ex); myEditCurrentArgument->clear(); @@ -246,6 +247,7 @@ void SMESHGUI_RemoveNodesDlg::ClickOnApply() myEditCurrentArgument->clear(); mySelector->ClearIndex(); SMESH::UpdateView(); + SMESHGUI::Modified(); } SMESH::SetPointRepresentation(true); @@ -316,9 +318,6 @@ void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText) myNbOkNodes = 0; - buttonOk->setEnabled(false); - buttonApply->setEnabled(false); - // hilight entered nodes if(myActor){ if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){ @@ -340,12 +339,8 @@ void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText) } } - if (myNbOkNodes) { - buttonOk->setEnabled(true); - buttonApply->setEnabled(true); - } - myBusy = false; + updateButtons(); } //================================================================================= @@ -354,56 +349,51 @@ void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText) //================================================================================= void SMESHGUI_RemoveNodesDlg::SelectionIntoArgument() { - if (myBusy) return; - + if (myBusy) return; // busy + if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active + if (!GroupButtons->isEnabled()) return; // inactive + // clear - myNbOkNodes = false; + myNbOkNodes = 0; myActor = 0; myBusy = true; myEditCurrentArgument->setText(""); myBusy = false; - if (!GroupButtons->isEnabled()) // inactive - return; - - buttonOk->setEnabled(false); - buttonApply->setEnabled(false); - // get selected mesh SALOME_ListIO aList; mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); int nbSel = aList.Extent(); - if (nbSel != 1) - return; - - Handle(SALOME_InteractiveObject) anIO = aList.First(); - myMesh = SMESH::GetMeshByIO(anIO); - if (myMesh->_is_nil()) - return; - - myActor = SMESH::FindActorByEntry(anIO->getEntry()); - if (!myActor) - return; - - // get selected nodes - - QString aString = ""; - int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,anIO,aString); - if(nbNodes < 1) - return; - myBusy = true; - myEditCurrentArgument->setText(aString); - myBusy = false; - - // OK - - myNbOkNodes = true; - - buttonOk->setEnabled(true); - buttonApply->setEnabled(true); + if (nbSel == 1) { + + Handle(SALOME_InteractiveObject) anIO = aList.First(); + myMesh = SMESH::GetMeshByIO(anIO); + + if (!myMesh->_is_nil()) { + + myActor = SMESH::FindActorByEntry(anIO->getEntry()); + if (myActor) { + + // get selected nodes + QString aString = ""; + int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,anIO,aString); + if (nbNodes > 0) { + myBusy = true; + myEditCurrentArgument->setText(aString); + myBusy = false; + + // OK + + myNbOkNodes = nbNodes; + } // if (nbNodes > 0) + } // if (myActor) + } // if (!myMesh->_is_nil()) + } // if (nbSel == 1) + + updateButtons(); } //================================================================================= @@ -530,3 +520,13 @@ void SMESHGUI_RemoveNodesDlg::setFilters() myFilterDlg->show(); } + +//================================================================================= +// function : updateButtons +// purpose : enable / disable control buttons +//================================================================================= +void SMESHGUI_RemoveNodesDlg::updateButtons() +{ + buttonOk->setEnabled(myNbOkNodes > 0); + buttonApply->setEnabled(myNbOkNodes > 0); +} diff --git a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h index 866757ef5..2ce8f9e7e 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h @@ -107,6 +107,7 @@ private slots: void ActivateThisDialog(); void onTextChange( const QString& ); void setFilters(); + void updateButtons(); }; #endif // SMESHGUI_REMOVENODESDLG_H diff --git a/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx b/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx index 5ebfe5062..67a1a4220 100644 --- a/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx @@ -243,6 +243,7 @@ void SMESHGUI_RenumberingDlg::ClickOnApply() //mySelectionMgr->clearSelected(); SMESH::UpdateView(); + SMESHGUI::Modified(); } } diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index f6edc503f..d292d2996 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -146,6 +146,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); + LineEditElements->setMaxLength(-1); myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); @@ -557,6 +558,8 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply() ConstructorsClicked(GetConstructorId()); mySelectedObject = SMESH::SMESH_IDSource::_nil(); SelectionIntoArgument(); + + SMESHGUI::Modified(); } return true; diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx index f2855bb7a..1dc48b0b3 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx @@ -134,6 +134,7 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) SelectElementsButton->setIcon(image1); LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); + LineEditElements->setMaxLength(-1); myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); @@ -456,6 +457,8 @@ bool SMESHGUI_RotationDlg::ClickOnApply() Init(false); mySelectedObject = SMESH::SMESH_IDSource::_nil(); SelectionIntoArgument(); + + SMESHGUI::Modified(); } return true; diff --git a/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx b/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx index 97976bf04..b9a5c1a0b 100644 --- a/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx @@ -154,6 +154,7 @@ SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule ) SelectElementsButton->setIcon(image2); LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); + LineEditElements->setMaxLength(-1); myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); @@ -526,6 +527,8 @@ bool SMESHGUI_ScaleDlg::ClickOnApply() ConstructorsClicked(GetConstructorId()); mySelectedObject = SMESH::SMESH_IDSource::_nil(); SelectionIntoArgument(); + + SMESHGUI::Modified(); } return true; diff --git a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx index cd63b5e12..cc8fbf136 100644 --- a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx @@ -533,6 +533,8 @@ bool SMESHGUI_SewingDlg::ClickOnApply() Init(); ConstructorsClicked(GetConstructorId()); + + SMESHGUI::Modified(); } } diff --git a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx index bb73bcbd5..d005010e4 100755 --- a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx @@ -514,6 +514,7 @@ bool SMESHGUI_SingleEditDlg::onApply() mySelectionMgr->setSelectedObjects(aList, false); onSelectionDone(); SMESH::UpdateView(); + SMESHGUI::Modified(); } return aResult; diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx index 3b83752eb..be2178dbb 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx @@ -138,6 +138,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); + LineEditElements->setMaxLength(-1); myElemFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); connect(myElemFilterBtn, SIGNAL(clicked()), this, SLOT(setElemFilters())); @@ -152,6 +153,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) LineEditNodes = new QLineEdit(GroupArguments); LineEditNodes->setValidator(myIdValidator); + LineEditNodes->setMaxLength(-1); QPushButton* filterNodeBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); connect(filterNodeBtn, SIGNAL(clicked()), this, SLOT(setNodeFilters())); @@ -395,6 +397,7 @@ bool SMESHGUI_SmoothingDlg::ClickOnApply() } SMESH::UpdateView(); + SMESHGUI::Modified(); Init(); mySelectedObject = SMESH::SMESH_IDSource::_nil(); diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx index 6fec286e3..2a3562e3d 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx @@ -145,6 +145,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule ) SelectElementsButton->setIcon(image3); LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); + LineEditElements->setMaxLength(-1); myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); @@ -546,6 +547,8 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply() ConstructorsClicked(GetConstructorId()); mySelectedObject = SMESH::SMESH_IDSource::_nil(); SelectionIntoArgument(); + + SMESHGUI::Modified(); } return true; } diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx index 6b2e2398d..fac987991 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx @@ -157,6 +157,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule ) SelectElementsButton->setIcon(image2); LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); + LineEditElements->setMaxLength(-1); myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); @@ -530,6 +531,8 @@ bool SMESHGUI_TranslationDlg::ClickOnApply() ConstructorsClicked(GetConstructorId()); mySelectedObject = SMESH::SMESH_IDSource::_nil(); SelectionIntoArgument(); + + SMESHGUI::Modified(); } return true; diff --git a/src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx b/src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx index 5c78a9d13..027919627 100755 --- a/src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx @@ -130,6 +130,7 @@ SMESHGUI_WhatIsDlg::SMESHGUI_WhatIsDlg( SMESHGUI* theModule ) LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(new SMESHGUI_IdValidator(this)); + LineEditElements->setMaxLength(-1); GroupArgumentsLayout->addWidget(LineEditElements, 0, 1); // information text browser diff --git a/src/SMESH_SWIG/ex06_hole1boolean.py b/src/SMESH_SWIG/ex06_hole1boolean.py index 3c5054590..2a2784e91 100644 --- a/src/SMESH_SWIG/ex06_hole1boolean.py +++ b/src/SMESH_SWIG/ex06_hole1boolean.py @@ -109,7 +109,7 @@ c_l.append(baseHexa4) c_cpd = MakeCompound(c_l) c_glu = MakeGlueFaces(c_cpd, 1.e-5) -piece = RemoveExtraEdges(c_glu) +piece = RemoveExtraEdges(c_glu, doUnionFaces=True) # Add in study # ------------ diff --git a/src/SMESH_SWIG/ex07_hole1partition.py b/src/SMESH_SWIG/ex07_hole1partition.py index 6ef4f6c3d..50f8d07a8 100644 --- a/src/SMESH_SWIG/ex07_hole1partition.py +++ b/src/SMESH_SWIG/ex07_hole1partition.py @@ -72,7 +72,7 @@ p_tools.append(MakePlane(p_centre, MakeVectorDXDYDZ(-g_largeur, 0, g_longueur), p_part = MakePartition([c_piece], p_tools, [], [], ShapeType["SOLID"]) -p_blocs = RemoveExtraEdges(p_part) +p_blocs = RemoveExtraEdges(p_part, doUnionFaces=True) piece = MakeGlueFaces(p_blocs, 1.e-5) # Add in study diff --git a/src/SMESH_SWIG/ex11_grid3partition.py b/src/SMESH_SWIG/ex11_grid3partition.py index 6b2407af9..3e5f6712b 100644 --- a/src/SMESH_SWIG/ex11_grid3partition.py +++ b/src/SMESH_SWIG/ex11_grid3partition.py @@ -85,7 +85,7 @@ p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ(-1, 0, 1), g_trim)) p_part = MakePartition([e_blo1, e_blo2, e_blo3], p_tools, [], [], ShapeType["SOLID"]) -p_element = RemoveExtraEdges(p_part) +p_element = RemoveExtraEdges(p_part, doUnionFaces=True) # Grid and glue # ------------- diff --git a/src/SMESH_SWIG/ex13_hole1partial.py b/src/SMESH_SWIG/ex13_hole1partial.py index c11080657..24ae387f5 100644 --- a/src/SMESH_SWIG/ex13_hole1partial.py +++ b/src/SMESH_SWIG/ex13_hole1partial.py @@ -206,7 +206,7 @@ blocks.append(full_parts) piece_cpd = MakeCompound(blocks) -piece_ok = RemoveExtraEdges(piece_cpd) +piece_ok = RemoveExtraEdges(piece_cpd, doUnionFaces=True) piece = MakeGlueFaces(piece_ok, 1.e-3) diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index 4cde48b12..5e9233005 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -1197,6 +1197,8 @@ class Mesh: if not s: continue mainSO = s.FindObjectIOR(mainIOR) if not mainSO: continue + if err.subShapeID == 1: + shapeText = ' on "%s"' % mainSO.GetName() subIt = s.NewChildIterator(mainSO) while subIt.More(): subSO = subIt.Value() diff --git a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx index d55c17513..24a1e3fa9 100644 --- a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx @@ -205,7 +205,7 @@ public: //** Access to member fields **// private: - bool error(std::string& text, int code = COMPERR_ALGO_FAILED) + bool error(const std::string& text, int code = COMPERR_ALGO_FAILED) { myError = SMESH_ComputeError::New( code, text ); return false; } bool error(const SMESH_ComputeErrorPtr& err) @@ -987,6 +987,13 @@ bool _QuadFaceGrid::LoadGrid( SMESH_Mesh& mesh ) if ( !myGrid.empty() ) return true; + SMESHDS_SubMesh* faceSubMesh = mesh.GetSubMesh( myFace )->GetSubMeshDS(); + // check that all faces are quadrangular + SMDS_ElemIteratorPtr fIt = faceSubMesh->GetElements(); + while ( fIt->more() ) + if ( fIt->next()->NbNodes() % 4 > 0 ) + return error("Non-quadrangular mesh faces are not allowed on sides of a composite block"); + myIndexer._xSize = 1 + mySides.GetSide( Q_BOTTOM )->GetNbSegments( mesh ); myIndexer._ySize = 1 + mySides.GetSide( Q_LEFT )->GetNbSegments( mesh ); @@ -997,8 +1004,6 @@ bool _QuadFaceGrid::LoadGrid( SMESH_Mesh& mesh ) // store the rest nodes row by row - SMESHDS_SubMesh* faceSubMesh = mesh.GetSubMesh( myFace )->GetSubMeshDS(); - SMDS_MeshNode dummy(0,0,0); const SMDS_MeshElement* firstQuad = &dummy;// most left face above the last row of found nodes diff --git a/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx b/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx index 28b628c5c..6e8448e0a 100644 --- a/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx +++ b/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx @@ -51,7 +51,7 @@ namespace { enum EBoxSides //!< sides of the block { - B_BOTTOM=0, B_RIGHT, B_TOP, B_LEFT, B_FRONT, B_BACK, B_UNDEFINED + B_BOTTOM=0, B_RIGHT, B_TOP, B_LEFT, B_FRONT, B_BACK, NB_BLOCK_SIDES }; const char* SBoxSides[] = //!< names of block sides { @@ -59,7 +59,7 @@ namespace }; enum EQuadEdge //!< edges of quadrangle side { - Q_BOTTOM, Q_RIGHT, Q_TOP, Q_LEFT, Q_UNDEFINED + Q_BOTTOM = 0, Q_RIGHT, Q_TOP, Q_LEFT, NB_QUAD_SIDES }; @@ -84,9 +84,42 @@ namespace return true; } + //================================================================================ + /*! + * \brief Description of node used to detect corner nodes + */ + struct _NodeDescriptor + { + int nbInverseFaces, nbNodesInInverseFaces; + + _NodeDescriptor(const SMDS_MeshNode* n): nbInverseFaces(0), nbNodesInInverseFaces(0) + { + if ( n ) + { + set nodes; + SMDS_ElemIteratorPtr fIt = n->GetInverseElementIterator(SMDSAbs_Face ); + while ( fIt->more() ) + { + const SMDS_MeshElement* face = fIt->next(); + nodes.insert( face->begin_nodes(), face->end_nodes() ); + nbInverseFaces++; + } + nbNodesInInverseFaces = nodes.size(); + } + } + bool operator==(const _NodeDescriptor& other) const + { + return + nbInverseFaces == other.nbInverseFaces && + nbNodesInInverseFaces == other.nbNodesInInverseFaces; + } + }; + //================================================================================ /*! * \brief return true if a node is at block corner + * + * This check is valid for simple cases only */ //================================================================================ @@ -103,7 +136,7 @@ namespace bool isQuadrangle(const SMDS_MeshElement* e) { - return ( e && e->NbNodes() == ( e->IsQuadratic() ? 8 : 4 )); + return ( e && e->NbCornerNodes() == 4 ); } //================================================================================ @@ -189,15 +222,15 @@ namespace int _nbBlocksExpected; int _nbBlocksFound; -#ifdef _DEBUG_ -#define _grid_access_(args) _grid.at( args ) +#ifdef _DEBUG_ // want to get SIGSEGV in case of invalid index +#define _grid_access_(pobj, i) pobj->_grid[ ((i) < pobj->_grid.size()) ? i : int(1e100)] #else -#define _grid_access_(args) _grid[ args ] +#define _grid_access_(pobj, i) pobj->_grid[ i ] #endif //!< Return node at XY - const SMDS_MeshNode* getNode(int x, int y) const { return _grid_access_( _index( x, y )); } + const SMDS_MeshNode* getNode(int x, int y) const { return _grid_access_(this, _index( x,y ));} //!< Set node at XY - void setNode(int x, int y, const SMDS_MeshNode* n) { _grid_access_( _index( x, y )) = n; } + void setNode(int x, int y, const SMDS_MeshNode* n) { _grid_access_(this, _index( x,y )) = n; } //!< Return an edge SMESH_OrientedLink getEdge(EQuadEdge edge) const { @@ -242,7 +275,7 @@ namespace //!< return coordinates by XY gp_XYZ xyz(int x, int y) const { - return SMESH_MeshEditor::TNodeXYZ( _side->_grid_access_( _index( x, y )) ); + return SMESH_MeshEditor::TNodeXYZ( _grid_access_(_side, _index( x, y )) ); } //!< safely return a node by XY const SMDS_MeshNode* node(int x, int y) const @@ -259,7 +292,7 @@ namespace //!< Return a corner node const SMDS_MeshNode* cornerNode(bool isXMax, bool isYMax) const { - return _side->_grid_access_( _index.corner( isXMax, isYMax )); + return _grid_access_(_side, _index.corner( isXMax, isYMax )); } //!< return its size in nodes int getHoriSize() const { return _index.xSize(); } @@ -276,14 +309,29 @@ namespace */ struct _Block { - _OrientedBlockSide _side[6]; // 6 sides of a sub-block + _OrientedBlockSide _side[6]; // 6 sides of a sub-block + set _corners; const _OrientedBlockSide& getSide(int i) const { return _side[i]; } + bool setSide( int i, const _OrientedBlockSide& s) + { + if (( _side[i] = s )) + { + _corners.insert( s.cornerNode(0,0)); + _corners.insert( s.cornerNode(1,0)); + _corners.insert( s.cornerNode(0,1)); + _corners.insert( s.cornerNode(1,1)); + } + return s; + } + void clear() { for (int i=0;i<6;++i) _side[i]=0; _corners.clear(); } bool hasSide( const _OrientedBlockSide& s) const { if ( s ) for (int i=0;i<6;++i) if ( _side[i] && _side[i]._side == s._side ) return true; return false; } + int nbSides() const { int n=0; for (int i=0;i<6;++i) if ( _side[i] ) ++n; return n; } + bool isValid() const; }; //================================================================================ /*! @@ -300,7 +348,9 @@ namespace const SMESH_Comment& error() const { return _error; } private: - bool fillSide( _BlockSide& side, const SMDS_MeshElement* cornerQuad); + bool fillSide( _BlockSide& side, + const SMDS_MeshElement* cornerQuad, + const SMDS_MeshNode* cornerNode); bool fillRowsUntilCorner(const SMDS_MeshElement* quad, const SMDS_MeshNode* n1, const SMDS_MeshNode* n2, @@ -309,16 +359,14 @@ namespace bool alongN1N2 ); _OrientedBlockSide findBlockSide( EBoxSides startBlockSide, EQuadEdge sharedSideEdge1, - EQuadEdge sharedSideEdge2); + EQuadEdge sharedSideEdge2, + bool withGeometricAnalysis); //!< update own data and data of the side bound to block void setSideBoundToBlock( _BlockSide& side ) { - side._nbBlocksFound++; - if ( side.isBound() ) - { - for ( int e = 0; e < int(Q_UNDEFINED); ++e ) + if ( side._nbBlocksFound++, side.isBound() ) + for ( int e = 0; e < int(NB_QUAD_SIDES); ++e ) _edge2sides[ side.getEdge( (EQuadEdge) e ) ].erase( &side ); - } } //!< store reason of error int error(const SMESH_Comment& reason) { _error = reason; return 0; } @@ -383,7 +431,7 @@ namespace _allSides.push_back( _BlockSide() ); _BlockSide& side = _allSides.back(); - if ( !fillSide( side, face ) ) + if ( !fillSide( side, face, *corner ) ) { if ( !_error.empty() ) return false; @@ -394,13 +442,10 @@ namespace for ( int isYMax = 0; isYMax < 2; ++isYMax ) { const SMDS_MeshNode* nCorner = side.getCornerNode(isXMax,isYMax ); - if ( !isCornerNode( nCorner )) - return BAD_MESH_ERR; - //_corner2sides[ nCorner ].insert( &side ); corners.push_back( nCorner ); cornerFaces.insert( side.getCornerFace( nCorner )); } - for ( int e = 0; e < int(Q_UNDEFINED); ++e ) + for ( int e = 0; e < int(NB_QUAD_SIDES); ++e ) _edge2sides[ side.getEdge( (EQuadEdge) e ) ].insert( &side ); nbFacesOnSides += side.getNbFaces(); @@ -425,23 +470,33 @@ namespace return BAD_MESH_ERR; if ( _allSides.back()._grid.empty() ) _allSides.pop_back(); + _DUMP_("Nb detected sides "<< _allSides.size()); // --------------------------- // Organize sides into blocks // --------------------------- - // analyse sharing of sides by blocks - int nbBlockSides = 0; // nb of block sides taking into account their sharing - list < _BlockSide >::iterator sideIt = _allSides.begin(); - for ( ; sideIt != _allSides.end(); ++sideIt ) + // analyse sharing of sides by blocks and sort sides by nb of adjacent sides + int nbBlockSides = 0; // total nb of block sides taking into account their sharing + multimap sortedSides; { - _BlockSide& side = *sideIt; - bool isSharedSide = true; - for ( int e = 0; e < int(Q_UNDEFINED) && isSharedSide; ++e ) - isSharedSide = _edge2sides[ side.getEdge( (EQuadEdge) e ) ].size() > 2; - side._nbBlocksFound = 0; - side._nbBlocksExpected = isSharedSide ? 2 : 1; - nbBlockSides += side._nbBlocksExpected; + list < _BlockSide >::iterator sideIt = _allSides.begin(); + for ( ; sideIt != _allSides.end(); ++sideIt ) + { + _BlockSide& side = *sideIt; + bool isSharedSide = true; + int nbAdjacent = 0; + for ( int e = 0; e < int(NB_QUAD_SIDES) && isSharedSide; ++e ) + { + int nbAdj = _edge2sides[ side.getEdge( (EQuadEdge) e ) ].size(); + nbAdjacent += nbAdj; + isSharedSide = ( nbAdj > 2 ); + } + side._nbBlocksFound = 0; + side._nbBlocksExpected = isSharedSide ? 2 : 1; + nbBlockSides += side._nbBlocksExpected; + sortedSides.insert( make_pair( nbAdjacent, & side )); + } } // find sides of each block @@ -449,9 +504,9 @@ namespace while ( nbBlockSides >= 6 ) { // get any side not bound to all blocks it belongs to - sideIt = _allSides.begin(); - while ( sideIt != _allSides.end() && sideIt->isBound()) - ++sideIt; + multimap::iterator i_side = sortedSides.begin(); + while ( i_side != sortedSides.end() && i_side->second->isBound()) + ++i_side; // start searching for block sides from the got side bool ok = true; @@ -459,37 +514,40 @@ namespace _blocks.resize( _blocks.size() + 1 ); _Block& block = _blocks.back(); - block._side[B_FRONT] = &(*sideIt); - setSideBoundToBlock( *sideIt ); + block.setSide( B_FRONT, i_side->second ); + setSideBoundToBlock( *i_side->second ); nbBlockSides--; - - // edges of neighbour sides of B_FRONT corresponding to front's edges - EQuadEdge edgeOfFront[4] = { Q_BOTTOM, Q_RIGHT, Q_TOP, Q_LEFT }; - EQuadEdge edgeToFind [4] = { Q_BOTTOM, Q_LEFT, Q_BOTTOM, Q_LEFT }; - for ( int i = Q_BOTTOM; ok && i <= Q_LEFT; ++i ) - ok = ( block._side[i] = findBlockSide( B_FRONT, edgeOfFront[i], edgeToFind[i])); - if ( ok ) - ok = ( block._side[B_BACK] = findBlockSide( B_TOP, Q_TOP, Q_TOP )); + // edges of adjacent sides of B_FRONT corresponding to front's edges + EQuadEdge edgeOfFront[4] = { Q_BOTTOM, Q_RIGHT, Q_TOP, Q_LEFT }; + EQuadEdge edgeOfAdj [4] = { Q_BOTTOM, Q_LEFT, Q_BOTTOM, Q_LEFT }; + // first find all sides detectable w/o advanced analysis, + // then repeat the search, which then may pass without advanced analysis + for ( int advAnalys = 0; advAnalys < 2; ++advAnalys ) + { + for ( int i = 0; (ok || !advAnalys) && i < NB_QUAD_SIDES; ++i ) + if ( !block._side[i] ) // try to find 4 sides adjacent to front side + ok = block.setSide( i, findBlockSide( B_FRONT, edgeOfFront[i],edgeOfAdj[i],advAnalys)); + if ( ok || !advAnalys) + if ( !block._side[B_BACK] && block._side[B_TOP] ) // try to find back side by top one + ok = block.setSide( B_BACK, findBlockSide( B_TOP, Q_TOP, Q_TOP, advAnalys )); + if ( !advAnalys ) ok = true; + } + ok = block.isValid(); if ( ok ) { // check if just found block is same as one of previously found bool isSame = false; for ( int i = 1; i < _blocks.size() && !isSame; ++i ) - { - _Block& prevBlock = _blocks[i-1]; - isSame = true; - for ( int j = 0; j < 6 && isSame; ++j ) - isSame = prevBlock.hasSide( block._side[ j ]); - } + isSame = ( block._corners == _blocks[i-1]._corners ); ok = !isSame; } // count the found sides - _DUMP_(endl); - for (int i = 0; i < B_UNDEFINED; ++i ) + _DUMP_(endl << "** Block " << _blocks.size() << " valid: " << block.isValid()); + for (int i = 0; i < NB_BLOCK_SIDES; ++i ) { - _DUMP_("** Block side "<< SBoxSides[i] <<" "<< block._side[ i ]._side); + _DUMP_("\tSide "<< SBoxSides[i] <<" "<< block._side[ i ]._side); if ( block._side[ i ] ) { if ( ok && i != B_FRONT) @@ -497,22 +555,24 @@ namespace setSideBoundToBlock( *block._side[ i ]._side ); nbBlockSides--; } - _DUMP_("Corner 0,0 "<< block._side[ i ].cornerNode(0,0)); - _DUMP_("Corner 1,0 "<< block._side[ i ].cornerNode(1,0)); - _DUMP_("Corner 1,1 "<< block._side[ i ].cornerNode(1,1)); - _DUMP_("Corner 0,1 "<< block._side[ i ].cornerNode(0,1)); + _DUMP_("\t corners "<< + block._side[ i ].cornerNode(0,0)->GetID() << ", " << + block._side[ i ].cornerNode(1,0)->GetID() << ", " << + block._side[ i ].cornerNode(1,1)->GetID() << ", " << + block._side[ i ].cornerNode(0,1)->GetID() << ", "<GetNode(i))) - nCorner = firstQuad->GetNode(i); - if ( !nCorner ) return false; - // get a node on block edge int iCorner = firstQuad->GetNodeIndex( nCorner ); const SMDS_MeshNode* nOnEdge = firstQuad->GetNode( (iCorner+1) % 4); @@ -611,7 +666,14 @@ namespace } } - return true; + // check side validity + bool ok = + side.getCornerFace( side.getCornerNode( 0, 0 )) && + side.getCornerFace( side.getCornerNode( 1, 0 )) && + side.getCornerFace( side.getCornerNode( 0, 1 )) && + side.getCornerFace( side.getCornerNode( 1, 1 )); + + return ok; } //================================================================================ @@ -622,7 +684,8 @@ namespace _OrientedBlockSide _Skin::findBlockSide( EBoxSides startBlockSide, EQuadEdge sharedSideEdge1, - EQuadEdge sharedSideEdge2) + EQuadEdge sharedSideEdge2, + bool withGeometricAnalysis) { _Block& block = _blocks.back(); _OrientedBlockSide& side1 = block._side[ startBlockSide ]; @@ -637,67 +700,93 @@ namespace set< _BlockSide* > sidesOnEdge = _edge2sides[ edge ]; // copy a set // exclude loaded sides of block from sidesOnEdge - int nbLoadedSides = 0; - for (int i = 0; i < B_UNDEFINED; ++i ) - { + for (int i = 0; i < NB_BLOCK_SIDES; ++i ) if ( block._side[ i ] ) - { - nbLoadedSides++; sidesOnEdge.erase( block._side[ i ]._side ); - } - } + int nbSidesOnEdge = sidesOnEdge.size(); _DUMP_("nbSidesOnEdge "<< nbSidesOnEdge << " " << n1->GetID() << "-" << n2->GetID() ); if ( nbSidesOnEdge == 0 ) return 0; _BlockSide* foundSide = 0; - if ( nbSidesOnEdge == 1 /*|| nbSidesOnEdge == 2 && nbLoadedSides == 1 */) + if ( nbSidesOnEdge == 1 ) { foundSide = *sidesOnEdge.begin(); } else { - // Select one of found sides most close to startBlockSide - - // gravity center of already loaded block sides - gp_XYZ gc(0,0,0); - for (int i = 0; i < B_UNDEFINED; ++i ) - if ( block._side[ i ] ) - gc += block._side[ i ]._side->getGC(); - gc /= nbLoadedSides; - - gp_XYZ p1 ( n1->X(),n1->Y(),n1->Z()), p2 (n2->X(),n2->Y(),n2->Z()); - gp_Vec p1p2( p1, p2 ); - - const SMDS_MeshElement* face1 = side1->getCornerFace( n1 ); - gp_XYZ p1Op = SMESH_MeshEditor::TNodeXYZ( oppositeNode( face1, face1->GetNodeIndex(n1))); - gp_Vec side1Dir( p1, p1Op ); - gp_Ax2 pln( p1, p1p2, side1Dir ); // plane with normal p1p2 and X dir side1Dir - _DUMP_(" Select adjacent for "<< side1._side << " - side dir (" - << side1Dir.X() << ", " << side1Dir.Y() << ", " << side1Dir.Z() << ")" ); - - map < double , _BlockSide* > angleOfSide; set< _BlockSide* >::iterator sideIt = sidesOnEdge.begin(); - for (; sideIt != sidesOnEdge.end(); ++sideIt ) + int nbLoadedSides = block.nbSides(); + if ( nbLoadedSides > 1 ) { - _BlockSide* sideI = *sideIt; - const SMDS_MeshElement* faceI = sideI->getCornerFace( n1 ); - gp_XYZ p1Op = SMESH_MeshEditor::TNodeXYZ( oppositeNode( faceI, faceI->GetNodeIndex(n1))); - gp_Vec sideIDir( p1, p1Op ); - // compute angle of (sideIDir projection to pln) and (X dir of pln) - gp_Vec2d sideIDirProj( sideIDir * pln.XDirection(), sideIDir * pln.YDirection()); - double angle = sideIDirProj.Angle( gp::DX2d() ); - if ( angle < 0 ) angle += 2 * PI; - angleOfSide.insert( make_pair( angle, sideI )); - _DUMP_(" "<< sideI << " - side dir (" - << sideIDir.X() << ", " << sideIDir.Y() << ", " << sideIDir.Z() << ")" - << " angle " << angle); + // Find the side having more than 2 corners common with already loaded sides + for (; !foundSide && sideIt != sidesOnEdge.end(); ++sideIt ) + { + _BlockSide* sideI = *sideIt; + int nbCommonCorners = + block._corners.count( sideI->getCornerNode(0,0)) + + block._corners.count( sideI->getCornerNode(1,0)) + + block._corners.count( sideI->getCornerNode(0,1)) + + block._corners.count( sideI->getCornerNode(1,1)); + if ( nbCommonCorners > 2 ) + foundSide = sideI; + } + } + + if ( !foundSide ) + { + if ( !withGeometricAnalysis ) return 0; + + // Select one of found sides most close to startBlockSide + + gp_XYZ p1 ( n1->X(),n1->Y(),n1->Z()), p2 (n2->X(),n2->Y(),n2->Z()); + gp_Vec p1p2( p1, p2 ); + + const SMDS_MeshElement* face1 = side1->getCornerFace( n1 ); + gp_XYZ p1Op = SMESH_MeshEditor::TNodeXYZ( oppositeNode( face1, face1->GetNodeIndex(n1))); + gp_Vec side1Dir( p1, p1Op ); + gp_Ax2 pln( p1, p1p2, side1Dir ); // plane with normal p1p2 and X dir side1Dir + _DUMP_(" Select adjacent for "<< side1._side << " - side dir (" + << side1Dir.X() << ", " << side1Dir.Y() << ", " << side1Dir.Z() << ")" ); + + map < double , _BlockSide* > angleOfSide; + for (sideIt = sidesOnEdge.begin(); sideIt != sidesOnEdge.end(); ++sideIt ) + { + _BlockSide* sideI = *sideIt; + const SMDS_MeshElement* faceI = sideI->getCornerFace( n1 ); + gp_XYZ p1Op = SMESH_MeshEditor::TNodeXYZ( oppositeNode( faceI, faceI->GetNodeIndex(n1))); + gp_Vec sideIDir( p1, p1Op ); + // compute angle of (sideIDir projection to pln) and (X dir of pln) + gp_Vec2d sideIDirProj( sideIDir * pln.XDirection(), sideIDir * pln.YDirection()); + double angle = sideIDirProj.Angle( gp::DX2d() ); + if ( angle < 0 ) angle += 2 * PI; // angle [0-2*PI] + angleOfSide.insert( make_pair( angle, sideI )); + _DUMP_(" "<< sideI << " - side dir (" + << sideIDir.X() << ", " << sideIDir.Y() << ", " << sideIDir.Z() << ")" + << " angle " << angle); + } + if ( nbLoadedSides == 1 ) + { + double angF = angleOfSide.begin()->first, angL = angleOfSide.rbegin()->first; + if ( angF > PI ) angF = 2*PI - angF; + if ( angL > PI ) angL = 2*PI - angL; + foundSide = angF < angL ? angleOfSide.begin()->second : angleOfSide.rbegin()->second; + } + else + { + gp_XYZ gc(0,0,0); // gravity center of already loaded block sides + for (int i = 0; i < NB_BLOCK_SIDES; ++i ) + if ( block._side[ i ] ) + gc += block._side[ i ]._side->getGC(); + gc /= nbLoadedSides; + + gp_Vec gcDir( p1, gc ); + gp_Vec2d gcDirProj( gcDir * pln.XDirection(), gcDir * pln.YDirection()); + double gcAngle = gcDirProj.Angle( gp::DX2d() ); + foundSide = gcAngle < 0 ? angleOfSide.rbegin()->second : angleOfSide.begin()->second; + } } - gp_Vec gcDir( p1, gc ); - gp_Vec2d gcDirProj( gcDir * pln.XDirection(), gcDir * pln.YDirection()); - double gcAngle = gcDirProj.Angle( gp::DX2d() ); - foundSide = gcAngle < 0 ? angleOfSide.rbegin()->second : angleOfSide.begin()->second; _DUMP_(" selected "<< foundSide ); } @@ -759,9 +848,14 @@ namespace row2.push_back( n1 = oppositeNode( quad, i1 )); } + _NodeDescriptor nDesc( row1[1] ); + if ( nDesc == _NodeDescriptor( row1[0] )) + return true; // row of 2 nodes + // Find the rest nodes TIDSortedElemSet emptySet, avoidSet; - while ( !isCornerNode( n2 )) + //while ( !isCornerNode( n2 )) + while ( nDesc == _NodeDescriptor( n2 )) { avoidSet.clear(); avoidSet.insert( quad ); quad = SMESH_MeshEditor::FindFaceInSet( n1, n2, emptySet, avoidSet, &i1, &i2 ); @@ -804,7 +898,31 @@ namespace return SMDS_Mesh::FindFace(n1, n2, n3, n4 ); } -} + //================================================================================ + /*! + * \brief Checks own validity + */ + //================================================================================ + + bool _Block::isValid() const + { + bool ok = ( nbSides() == 6 ); + + // check only corners depending on side selection + EBoxSides adjacent[4] = { B_BOTTOM, B_RIGHT, B_TOP, B_LEFT }; + EQuadEdge edgeAdj [4] = { Q_TOP, Q_RIGHT, Q_TOP, Q_RIGHT }; + EQuadEdge edgeBack[4] = { Q_BOTTOM, Q_RIGHT, Q_TOP, Q_LEFT }; + + for ( int i=0; ok && i < NB_QUAD_SIDES; ++i ) + { + SMESH_OrientedLink eBack = _side[ B_BACK ].edge( edgeBack[i] ); + SMESH_OrientedLink eAdja = _side[ adjacent[i] ].edge( edgeAdj[i] ); + ok = ( eBack == eAdja ); + } + return ok; + } + +} // namespace //======================================================================= //function : StdMeshers_HexaFromSkin_3D diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index 5e2031c23..1c0cf5e5b 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -1483,6 +1483,9 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, const vector& uv_et = quad->side[2]->GetUVPtStruct(true,1 ); const vector& uv_el = quad->side[3]->GetUVPtStruct(false,0); + if ( uv_eb.size() != nb || uv_er.size() != nr || uv_et.size() != nt || uv_el.size() != nl ) + return error( COMPERR_BAD_INPUT_MESH ); + // arrays for normalized params //cout<<"Dump B:"< #endif +#include +#include #include @@ -262,6 +264,15 @@ void StdMeshersGUI_DistrPreview::update() showError(); return; } +#ifdef WIN32 + if ( std::fabs(y[i]) >= HUGE_VAL) + y[i] = HUGE_VAL/100.; +#else + if ( isinf(y[i])) + y[i] = std::numeric_limits::max()/100.; +#endif +// if ( y[i] > 1e3 ) +// y[i] = 1e3; if( i==0 || y[i]max_y ) diff --git a/src/StdMeshersGUI/StdMeshers_images.ts b/src/StdMeshersGUI/StdMeshers_images.ts index fa4ca5767..da9130846 100644 --- a/src/StdMeshersGUI/StdMeshers_images.ts +++ b/src/StdMeshersGUI/StdMeshers_images.ts @@ -105,6 +105,14 @@ ICON_SMESH_TREE_ALGO_CompositeSegment_1D mesh_tree_algo_regular.png + + ICON_SMESH_TREE_ALGO_UseExisting_2D + mesh_tree_algo_existing_2D.png + + + ICON_SMESH_TREE_ALGO_UseExisting_1D + mesh_tree_algo_regular.png + ICON_SMESH_TREE_ALGO_Hexa_3D mesh_tree_algo_hexa.png @@ -129,6 +137,14 @@ ICON_SMESH_TREE_ALGO_Quadrangle_2D mesh_tree_algo_quad.png + + ICON_SMESH_TREE_ALGO_RadialQuadrangle_1D2D + mesh_tree_algo_radial_quadrangle_1D2D.png + + + ICON_SMESH_TREE_ALGO_Prism_3D + mesh_tree_algo_prism.png + ICON_SMESH_TREE_ALGO_RadialPrism_3D mesh_tree_algo_radial_prism.png @@ -139,7 +155,7 @@ ICON_SMESH_TREE_ALGO_SegmentAroundVertex_0D - mesh_tree_algo_regular.png + mesh_tree_algo_0D.png ICON_SMESH_TREE_HYPO_Arithmetic1D