From: eap Date: Fri, 11 Mar 2016 13:32:07 +0000 (+0300) Subject: 53103: Mesh visualization performance problem X-Git-Tag: V7_8_0a2~4^2~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a1a6d5ddc111fa237d1164fda37ff823a3fac764;p=modules%2Fsmesh.git 53103: Mesh visualization performance problem Optimize visualization and mesh loading. + fix docs --- diff --git a/doc/salome/examples/3dmesh.py b/doc/salome/examples/3dmesh.py index 67a707533..57a1440e0 100644 --- a/doc/salome/examples/3dmesh.py +++ b/doc/salome/examples/3dmesh.py @@ -2,17 +2,16 @@ import salome salome.salome_init() -import GEOM from salome.geom import geomBuilder geompy = geomBuilder.New(salome.myStudy) -import SMESH, SALOMEDS +import SMESH from salome.smesh import smeshBuilder smesh = smeshBuilder.New(salome.myStudy) ### # Geometry: an assembly of a box, a cylinder and a truncated cone -# meshed with tetrahedral +# to be meshed with tetrahedra ### # Define values @@ -44,14 +43,14 @@ piece = geompy.MakeFuse(box_cyl, cone) geompy.addToStudy(piece, name) # Create a group of faces -group = geompy.CreateGroup(piece, geompy.ShapeType["FACE"]) +faces_group = geompy.CreateGroup(piece, geompy.ShapeType["FACE"]) group_name = name + "_grp" -geompy.addToStudy(group, group_name) -group.SetName(group_name) +geompy.addToStudy(faces_group, group_name) +faces_group.SetName(group_name) # Add faces to the group faces = geompy.SubShapeAllIDs(piece, geompy.ShapeType["FACE"]) -geompy.UnionIDs(group, faces) +geompy.UnionIDs(faces_group, faces) ### # Create a mesh @@ -60,20 +59,20 @@ geompy.UnionIDs(group, faces) # Define a mesh on a geometry tetra = smesh.Mesh(piece, name) -# Define 1D hypothesis +# Define 1D algorithm and hypothesis algo1d = tetra.Segment() algo1d.LocalLength(10) -# Define 2D hypothesis +# Define 2D algorithm and hypothesis algo2d = tetra.Triangle() algo2d.LengthFromEdges() -# Define 3D hypothesis +# Define 3D algorithm and hypothesis algo3d = tetra.Tetrahedron() algo3d.MaxElementVolume(100) # Compute the mesh tetra.Compute() -# Create a groupe of faces -tetra.Group(group) +# Create a mesh group of all triangles generated on geom faces present in faces_group +group = tetra.Group(faces_group) diff --git a/doc/salome/examples/grouping_elements_ex01.py b/doc/salome/examples/grouping_elements_ex01.py index 013332766..9181e43df 100644 --- a/doc/salome/examples/grouping_elements_ex01.py +++ b/doc/salome/examples/grouping_elements_ex01.py @@ -19,4 +19,62 @@ aGroup1 = mesh.MakeGroupByIds("Area > 100", SMESH.FACE, anIds) aGroup2 = mesh.CreateEmptyGroup(SMESH.NODE, "all nodes") aGroup2.AddFrom(mesh.mesh) + +# ==================================== +# Various methods of the Group object +# ==================================== + +aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "aGroup") + +# set/get group name +aGroup.SetName( "new name" ) +print "name", aGroup.GetName() + +# get group type (type of entities in the group, SMESH.NODE in our case) +print "type", aGroup.GetType() + +# get number of entities (nodes in our case) in the group +print "size", aGroup.Size() + +# check of emptiness +print "is empty", aGroup.IsEmpty() + +# check of presence of an entity in the group +aGroup.Add([1,2]) # method specific to the standalone group +print "contains node 2", aGroup.Contains(2) + +# get an entity by index +print "1st node", aGroup.GetID(1) + +# get all entities +print "all", aGroup.GetIDs() + +# get number of nodes (actual for groups of elements) +print "nb nodes", aGroup.GetNumberOfNodes() + +# get underlying nodes (actual for groups of elements) +print "nodes", aGroup.GetNodeIDs() + +# set/get color +import SALOMEDS +aGroup.SetColor( SALOMEDS.Color(1.,1.,0.)); +print "color", aGroup.GetColor() + +# ---------------------------------------------------------------------------- +# methods specific to the standalone group and not present in GroupOnGeometry +# and GroupOnFilter +# ---------------------------------------------------------------------------- + +# clear the group's contents +aGroup.Clear() + +# add contents of other object (group, sub-mesh, filter) +aGroup.AddFrom( aGroup2 ) + +# removes entities +aGroup.Remove( [2,3,4] ) + + + + salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/prism_3d_algo.py b/doc/salome/examples/prism_3d_algo.py index 7be0a29d3..e51822561 100644 --- a/doc/salome/examples/prism_3d_algo.py +++ b/doc/salome/examples/prism_3d_algo.py @@ -1,4 +1,4 @@ -# Use 3D extrusion meshing algorithm +# Usage of 3D Extrusion meshing algorithm import salome salome.salome_init() @@ -58,7 +58,7 @@ mesh = smesh.Mesh( prisms ) # assign Global hypotheses -# 1D algorithm and hypothesis for vertical division +# 1D algorithm and hypothesis for division along the pipe mesh.Segment().NumberOfSegments(15) # Extrusion 3D algo diff --git a/doc/salome/gui/SMESH/CMakeLists.txt b/doc/salome/gui/SMESH/CMakeLists.txt index 47c517cff..a221bbfe8 100644 --- a/doc/salome/gui/SMESH/CMakeLists.txt +++ b/doc/salome/gui/SMESH/CMakeLists.txt @@ -30,8 +30,8 @@ SET(kernel_file "${KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py") SALOME_ACCUMULATE_ENVIRONMENT(SMESH_MeshersList NOCHECK ${DOC_SMESH_MeshersList}) -SET(_cmd_options ${smesh_file} -d -o tmp1/smeshBuilder.py StdMeshers) -SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${PYTHON_EXECUTABLE}" "${_cmd_options}") +SET(_cmd_options ${smesh_file} -o tmp1/smeshBuilder.py StdMeshers) +SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${PYTHON_EXECUTABLE}" "${_cmd_options}") ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp1 COMMAND ${CMAKE_COMMAND} -E make_directory tmp2 diff --git a/doc/salome/gui/SMESH/input/smeshpy_interface.doc b/doc/salome/gui/SMESH/input/smeshpy_interface.doc index df7e15967..92bd2f41d 100644 --- a/doc/salome/gui/SMESH/input/smeshpy_interface.doc +++ b/doc/salome/gui/SMESH/input/smeshpy_interface.doc @@ -7,49 +7,66 @@ be used for easy mesh creation and edition. Documentation for SALOME %Mesh module Python API is available in two forms: - Structured documentation, where all methods and -classes are grouped by their functionality, like it is done in the GUI documentation +classes are grouped by their functionality. - Linear documentation grouped only by classes, declared in the \ref smeshBuilder and \ref StdMeshersBuilder Python packages. -\n With SALOME 7.2, the Python interface for %Mesh has been slightly modified to offer new functionality, +\n With SALOME 7.2, the Python interface for %Mesh has been slightly modified to offer new functionality. \n You may have to modify your scripts generated with SALOME 6 or older versions. -\n Please see \ref smesh_migration_page - -The SMESH python package contains helper functions to manipulate mesh elements and -interact with these elements. - -Note that these functions either encapsulate the python programming interface of SMESH core -(the CORBA or SWIG interface for example) or extend existing utilities as the smesh.py module. - -The functions are distributed in the python package \b salome.smesh. - -\note -The main package \b salome contains other sub-packages that are distributed with the other -SALOME modules. For example, the KERNEL module provides the python package \b salome.kernel -and GEOM the package \b salome.geom. +\n Please see \ref smesh_migration_page. Class \ref smeshBuilder.smeshBuilder "smeshBuilder" provides an interface to create and handle meshes. It can be used to create an empty mesh or to import mesh from the data file. -Class \ref smeshstudytools.SMeshStudyTools "SMeshStudyTools" provides several methods to manipulate mesh objects in Salome study. - As soon as mesh is created, it is possible to manage it via its own methods, described in class \ref smeshBuilder.Mesh "Mesh" documentation. -Class \ref smeshBuilder.Mesh "Mesh" allows assigning algorithms to a mesh. -Please note that some algorithms, included in the standard SALOME -distribution are always available. Python package \ref StdMeshersBuilder "StdMeshersBuilder" -provides an interface for standard meshing algorithms included into -the SALOME %Mesh module distribution, like: -- REGULAR (1D) -- COMPOSITE (1D) -- MEFISTO (2D) -- Quadrangle (2D) -- Hexa(3D) -- etc ... +Class \ref smeshstudytools.SMeshStudyTools "SMeshStudyTools" provides several methods to manipulate mesh objects in Salome study. -To add meshing hypotheses, it is possible to use the functions provided by the -algorithms interfaces. +A usual workflow to generate a mesh on geometry is following: +
    +
  1. Create an instance of \ref smeshBuilder.smeshBuilder "smeshBuilder": +
    +      from salome.smesh import smeshBuilder
    +      smesh = smeshBuilder.New( salome.myStudy )
    +    
  2. +
  3. Create a \ref smeshBuilder.Mesh "mesh" object: +
    +      mesh = \ref smeshBuilder.smeshBuilder.Mesh "smesh.Mesh( geometry )" 
    +    
  4. +
  5. Create and assign \ref basic_meshing_algos_page "algorithms" by + calling corresponding methods of the mesh. If a sub-shape is + provided as an argument, a \ref constructing_submeshes_page "sub-mesh" + is implicitly created on this sub-shape: +
    +      regular1D = \ref smeshBuilder.Mesh.Segment "mesh.Segment"()
    +      mefisto   = \ref smeshBuilder.Mesh.Triangle "mesh.Triangle"( smeshBuilder.MEFISTO )
    +      # use other triangle algorithm on a face -- a sub-mesh appears in the mesh
    +      netgen    = \ref smeshBuilder.Mesh.Triangle "mesh.Triangle"( smeshBuilder.NETGEN_1D2D, face )
    +    
  6. +
  7. Create and assign \ref about_hypo_page "hypotheses" by calling + corresponding methods of algorithms: +
    +      segLen10 = \ref StdMeshersBuilder.StdMeshersBuilder_Segment.LocalLength "regular1D.LocalLength"( 10. )
    +      maxArea  = \ref StdMeshersBuilder.StdMeshersBuilder_Segment.LocalLength "mefisto.MaxElementArea"( 100. )
    +      netgen.SetMaxSize( 20. )
    +      netgen.SetFineness( smeshBuilder.VeryCoarse )
    +    
    +
  8. +
  9. \ref compute_anchor "Compute" the mesh (generate mesh nodes and elements): +
    +      \ref Mesh.Compute "mesh.Compute"()
    +    
    +
  10. +
+ +An easiest way to start with Python scripting is to do something in +GUI and then to get a corresponding Python script via + File > Dump Study menu item. Don't forget that you can get +all methods of any object in hand (e.g. a mesh group or a hypothesis) +by calling \a dir() Python built-in function. + +All methods of the Mesh Group can be found in \ref tui_create_standalone_group sample script. An example below demonstrates usage of the Python API for 3d mesh generation. @@ -61,19 +78,19 @@ Examples of Python scripts for Mesh operations are available by the following links: - \subpage tui_creating_meshes_page -- \subpage tui_cartesian_algo -- \subpage tui_use_existing_faces -- \subpage tui_viewing_meshes_page - \subpage tui_defining_hypotheses_page -- \subpage tui_quality_controls_page -- \subpage tui_filters_page - \subpage tui_grouping_elements_page +- \subpage tui_filters_page - \subpage tui_modifying_meshes_page - \subpage tui_transforming_meshes_page -- \subpage tui_notebook_smesh_page +- \subpage tui_viewing_meshes_page +- \subpage tui_quality_controls_page - \subpage tui_measurements_page -- \subpage tui_generate_flat_elements_page - \subpage tui_work_on_objects_from_gui +- \subpage tui_notebook_smesh_page +- \subpage tui_cartesian_algo +- \subpage tui_use_existing_faces - \subpage tui_prism_3d_algo +- \subpage tui_generate_flat_elements_page */ diff --git a/doc/salome/gui/SMESH/input/tui_creating_meshes.doc b/doc/salome/gui/SMESH/input/tui_creating_meshes.doc index 984616457..79b98b49d 100644 --- a/doc/salome/gui/SMESH/input/tui_creating_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_creating_meshes.doc @@ -2,54 +2,50 @@ \page tui_creating_meshes_page Creating Meshes +\tableofcontents + \n First of all see \ref example_3d_mesh "Example of 3d mesh generation", which is an example of good python script style for Mesh module.
-

Construction of a Mesh

+\section construction_of_a_mesh Construction of a mesh \tui_script{creating_meshes_ex01.py}
-\anchor tui_construction_submesh -

Construction of a Submesh

+\section tui_construction_submesh Construction of a sub-mesh \tui_script{creating_meshes_ex02.py}
-

Change priority of submeshes in Mesh

+\section change_priority_of_submeshes_in_mesh Change priority of sub-meshes in mesh \tui_script{creating_meshes_ex03.py}
-\anchor tui_editing_while_meshing -

Intermediate edition while meshing

+\section tui_editing_while_meshing Intermediate edition while meshing \tui_script{a3DmeshOnModified2Dmesh.py}
-\anchor tui_editing_mesh -

Editing a mesh

+\section tui_editing_mesh Editing a mesh \tui_script{creating_meshes_ex04.py}
-\anchor tui_export_mesh -

Export of a Mesh

+\section tui_export_mesh Export of a Mesh \tui_script{creating_meshes_ex05.py}
-

How to mesh a cylinder with hexahedrons?

+\section how_to_mesh_a_cylinder_with_hexahedrons How to mesh a cylinder with hexahedrons? Here you can see an example of python script, creating a hexahedral -mesh on a cylinder. And a picture below the source code of the script, -demonstrating the resulting mesh. +mesh on a cylinder. A picture below the source code of the script +demonstrates the resulting mesh. \tui_script{creating_meshes_ex06.py} \image html mesh_cylinder_hexa.png
-\anchor tui_building_compound -

Building a compound of meshes

+\section tui_building_compound Building a compound of meshes \tui_script{creating_meshes_ex07.py}
-\anchor tui_copy_mesh -

Mesh Copying

+\section tui_copy_mesh Mesh Copying \tui_script{creating_meshes_ex08.py} */ diff --git a/doc/salome/gui/SMESH/input/tui_grouping_elements.doc b/doc/salome/gui/SMESH/input/tui_grouping_elements.doc index a264f2542..535c47640 100644 --- a/doc/salome/gui/SMESH/input/tui_grouping_elements.doc +++ b/doc/salome/gui/SMESH/input/tui_grouping_elements.doc @@ -2,27 +2,24 @@ \page tui_grouping_elements_page Grouping Elements +\tableofcontents +
-\anchor tui_create_standalone_group -

Create a Standalone Group

+\section tui_create_standalone_group Create a Standalone Group \tui_script{grouping_elements_ex01.py} \image html create_group.png
-\anchor tui_create_group_on_geometry -

Create a Group on Geometry

+\section tui_create_group_on_geometry Create a Group on Geometry \tui_script{grouping_elements_ex02.py}
-\anchor tui_create_group_on_filter - -

Create a Group on Filter

+\section tui_create_group_on_filter Create a Group on Filter \tui_script{grouping_elements_ex03.py}
-\anchor tui_edit_group -

Edit a Group

+\section tui_edit_group Edit a Group \tui_script{grouping_elements_ex04.py} \image html editing_groups1.png @@ -30,8 +27,7 @@ \image html editing_groups2.png
-\anchor tui_union_of_groups -

Union of groups

+\section tui_union_of_groups Union of groups \tui_script{grouping_elements_ex05.py} \image html union_groups1.png @@ -41,8 +37,7 @@ \image html union_groups3.png
-\anchor tui_intersection_of_groups -

Intersection of groups

+\section tui_intersection_of_groups Intersection of groups \tui_script{grouping_elements_ex06.py} \image html intersect_groups1.png @@ -52,8 +47,7 @@ \image html intersect_groups3.png
-\anchor tui_cut_of_groups -

Cut of groups

+\section tui_cut_of_groups Cut of groups \tui_script{grouping_elements_ex07.py} \image html cut_groups1.png @@ -63,8 +57,7 @@ \image html cut_groups3.png
-\anchor tui_create_dim_group -

Creating groups of entities from existing groups of superior dimensions

+\section tui_create_dim_group Creating groups of entities from existing groups of superior dimensions \tui_script{grouping_elements_ex08.py} \image html dimgroup_tui1.png diff --git a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc index 107306547..7d0352286 100644 --- a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc @@ -2,9 +2,10 @@ \page tui_modifying_meshes_page Modifying Meshes +\tableofcontents +
-\anchor tui_adding_nodes_and_elements -

Adding Nodes and Elements

+\section tui_adding_nodes_and_elements Adding Nodes and Elements
\anchor tui_add_node @@ -57,8 +58,7 @@ \tui_script{modifying_meshes_ex10.py}
-\anchor tui_removing_nodes_and_elements -

Removing Nodes and Elements

+\section tui_removing_nodes_and_elements Removing Nodes and Elements
\anchor tui_removing_nodes @@ -76,73 +76,59 @@ \tui_script{modifying_meshes_ex13.py}
-\anchor tui_renumbering_nodes_and_elements -

Renumbering Nodes and Elements

+\section tui_renumbering_nodes_and_elements Renumbering Nodes and Elements \tui_script{modifying_meshes_ex14.py}
-\anchor tui_moving_nodes -

Moving Nodes

+\section tui_moving_nodes Moving Nodes \tui_script{modifying_meshes_ex15.py}
-\anchor tui_diagonal_inversion -

Diagonal Inversion

+\section tui_diagonal_inversion Diagonal Inversion \tui_script{modifying_meshes_ex16.py}
-\anchor tui_uniting_two_triangles -

Uniting two Triangles

+\section tui_uniting_two_triangles Uniting two Triangles \tui_script{modifying_meshes_ex17.py}
-\anchor tui_uniting_set_of_triangles -

Uniting a Set of Triangles

+\section tui_uniting_set_of_triangles Uniting a Set of Triangles \tui_script{modifying_meshes_ex18.py}
-\anchor tui_orientation -

Orientation

+\section tui_orientation Orientation \tui_script{modifying_meshes_ex19.py}
-\anchor tui_cutting_quadrangles -

Cutting Quadrangles

+\section tui_cutting_quadrangles Cutting Quadrangles \tui_script{modifying_meshes_ex20.py}
-\anchor tui_smoothing -

Smoothing

+\section tui_smoothing Smoothing \tui_script{modifying_meshes_ex21.py}
-\anchor tui_extrusion -

Extrusion

+\section tui_extrusion Extrusion \tui_script{modifying_meshes_ex22.py}
-\anchor tui_extrusion_along_path -

Extrusion along a Path

+\section tui_extrusion_along_path Extrusion along a Path \tui_script{modifying_meshes_ex23.py}
-\anchor tui_revolution -

Revolution

+\section tui_revolution Revolution \tui_script{modifying_meshes_ex24.py}
-\anchor tui_pattern_mapping -

Pattern Mapping

+\section tui_pattern_mapping Pattern Mapping \tui_script{modifying_meshes_ex25.py}
-\anchor tui_quadratic -

Convert mesh to/from quadratic

+\section tui_quadratic Convert mesh to/from quadratic \tui_script{modifying_meshes_ex26.py}
-\anchor tui_split_biquad -

Split bi-quadratic into linear

+\section tui_split_biquad Split bi-quadratic into linear \tui_script{split_biquad.py} */ diff --git a/doc/salome/gui/SMESH/input/tui_quality_controls.doc b/doc/salome/gui/SMESH/input/tui_quality_controls.doc index be849962c..1434c9b07 100644 --- a/doc/salome/gui/SMESH/input/tui_quality_controls.doc +++ b/doc/salome/gui/SMESH/input/tui_quality_controls.doc @@ -2,6 +2,8 @@ \page tui_quality_controls_page Quality Controls +\tableofcontents + \section tui_free_borders Free Borders \tui_script{quality_controls_ex01.py} diff --git a/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc b/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc index 86ce3dca0..9837176b6 100644 --- a/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc @@ -2,73 +2,58 @@ \page tui_transforming_meshes_page Transforming Meshes -

Transforming Meshes

+\tableofcontents
-\anchor tui_translation -

Translation

+\section tui_translation Translation \tui_script{transforming_meshes_ex01.py}
-\anchor tui_rotation -

Rotation

+\section tui_rotation Rotation \tui_script{transforming_meshes_ex02.py}
-\anchor tui_scale -

Scale

+\section tui_scale Scale \tui_script{transforming_meshes_ex03.py}
-\anchor tui_symmetry -

Symmetry

+\section tui_symmetry Symmetry \tui_script{transforming_meshes_ex04.py}
-\anchor tui_merging_nodes -

Merging Nodes

+\section tui_merging_nodes Merging Nodes \tui_script{transforming_meshes_ex05.py}
-\anchor tui_merging_elements -

Merging Elements

+\section tui_merging_elements Merging Elements \tui_script{transforming_meshes_ex06.py} -

Sewing Meshes

-
-\anchor tui_sew_meshes_border_to_side -

Sew Meshes Border to Side

+\section tui_sew_meshes_border_to_side Sew Meshes Border to Side \tui_script{transforming_meshes_ex07.py}
-\anchor tui_sew_conform_free_borders -

Sew Conform Free Borders

+\section tui_sew_conform_free_borders Sew Conform Free Borders \tui_script{transforming_meshes_ex08.py}
-\anchor tui_sew_free_borders -

Sew Free Borders

+\section tui_sew_free_borders Sew Free Borders \tui_script{transforming_meshes_ex09.py}
-\anchor tui_sew_side_elements -

Sew Side Elements

+\section tui_sew_side_elements Sew Side Elements \tui_script{transforming_meshes_ex10.py}
-\anchor tui_duplicate_nodes -

Duplicate nodes or/and elements

+\section tui_duplicate_nodes Duplicate nodes or/and elements \tui_script{transforming_meshes_ex11.py}
-\anchor tui_make_2dmesh_from_3d -

Create boundary elements

+\section tui_make_2dmesh_from_3d Create boundary elements \tui_script{transforming_meshes_ex12.py}
-\anchor tui_reorient_faces -

Reorient faces

+\section tui_reorient_faces Reorient faces \tui_script{transforming_meshes_ex13.py} */ diff --git a/doc/salome/gui/SMESH/input/tui_work_on_objects_from_gui.doc b/doc/salome/gui/SMESH/input/tui_work_on_objects_from_gui.doc index abc51d95b..569d821a9 100644 --- a/doc/salome/gui/SMESH/input/tui_work_on_objects_from_gui.doc +++ b/doc/salome/gui/SMESH/input/tui_work_on_objects_from_gui.doc @@ -6,7 +6,7 @@ It is sometimes useful to work alternatively in the GUI of SALOME and in the Pyt \code myMesh_ref = salome.IDToObject("ID") -// were ID is the number that appears in the object browser in the Entry column +// were ID is the string looking like "0:1:2:3" that appears in the object browser in the Entry column // ( If hidden show it by right clicking and checking the checkbox Entry) myMesh = smesh.Mesh(myMesh_ref) \endcode diff --git a/idl/SMESH_Group.idl b/idl/SMESH_Group.idl index 4941f14df..bdc3d6312 100644 --- a/idl/SMESH_Group.idl +++ b/idl/SMESH_Group.idl @@ -74,7 +74,7 @@ module SMESH boolean Contains( in long elem_id ); /*! - * Returns ID of an element at position + * Returns ID of an element at position counted from 1 */ long GetID( in long elem_index ); diff --git a/src/DriverMED/DriverMED_Family.cxx b/src/DriverMED/DriverMED_Family.cxx index d682304fe..4b7ac91c4 100644 --- a/src/DriverMED/DriverMED_Family.cxx +++ b/src/DriverMED/DriverMED_Family.cxx @@ -69,7 +69,7 @@ void DriverMED_Family ::AddElement(const SMDS_MeshElement* theElement) { - myElements.insert(theElement); + myElements.insert( myElements.end(), theElement ); } void @@ -414,7 +414,7 @@ void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup) SMDS_ElemIteratorPtr elemIt = theGroup->GetElements(); while (elemIt->more()) { - myElements.insert(elemIt->next()); + myElements.insert( myElements.end(), elemIt->next() ); } // Type diff --git a/src/DriverMED/DriverMED_Family.h b/src/DriverMED/DriverMED_Family.h index c83534cf9..28d05a568 100644 --- a/src/DriverMED/DriverMED_Family.h +++ b/src/DriverMED/DriverMED_Family.h @@ -49,10 +49,10 @@ #define REST_BALL_FAMILY -5 #define FIRST_ELEM_FAMILY -6 -typedef std::list DriverMED_FamilyPtrList; -typedef std::map SMESHDS_SubMeshPtrMap; -typedef std::list SMESHDS_GroupBasePtrList; -typedef std::set ElementsSet; +typedef std::list DriverMED_FamilyPtrList; +typedef std::map SMESHDS_SubMeshPtrMap; +typedef std::list SMESHDS_GroupBasePtrList; +typedef std::set ElementsSet; class MESHDRIVERMED_EXPORT DriverMED_Family { diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx index 58f9c0ca0..c773d9925 100644 --- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx @@ -976,8 +976,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform() } if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies )) { // Save reference to this element from its family - myFamilies[aFamNum]->AddElement(anElement); - myFamilies[aFamNum]->SetType(anElement->GetType()); + aFamily->AddElement(anElement); + aFamily->SetType(anElement->GetType()); } } } // loop on aNbElems @@ -1081,8 +1081,8 @@ void DriverMED_R_SMESHDS_Mesh::GetGroup(SMESHDS_Group* theGroup) DriverMED_FamilyPtr aFamily = (*aFamsIter).second; if (aFamily->GetTypes().count( theGroup->GetType() ) && aFamily->MemberOf(aGroupName)) { - const set& anElements = aFamily->GetElements(); - set::const_iterator anElemsIter = anElements.begin(); + const ElementsSet& anElements = aFamily->GetElements(); + ElementsSet::const_iterator anElemsIter = anElements.begin(); for (; anElemsIter != anElements.end(); anElemsIter++) { const SMDS_MeshElement * element = *anElemsIter; @@ -1110,8 +1110,8 @@ void DriverMED_R_SMESHDS_Mesh::GetSubMesh (SMESHDS_SubMesh* theSubMesh, DriverMED_FamilyPtr aFamily = (*aFamsIter).second; if (aFamily->MemberOf(aName)) { - const set& anElements = aFamily->GetElements(); - set::const_iterator anElemsIter = anElements.begin(); + const ElementsSet& anElements = aFamily->GetElements(); + ElementsSet::const_iterator anElemsIter = anElements.begin(); if (aFamily->GetType() == SMDSAbs_Node) { for (; anElemsIter != anElements.end(); anElemsIter++) @@ -1146,14 +1146,13 @@ void DriverMED_R_SMESHDS_Mesh::CreateAllSubMeshes () if (aName.substr(0, 7) == string("SubMesh")) { int Id = atoi(string(aName).substr(7).c_str()); - set anElements = aFamily->GetElements(); - set::iterator anElemsIter = anElements.begin(); + const ElementsSet& anElements = aFamily->GetElements(); + ElementsSet::const_iterator anElemsIter = anElements.begin(); if (aFamily->GetType() == SMDSAbs_Node) { for (; anElemsIter != anElements.end(); anElemsIter++) { - SMDS_MeshNode* node = const_cast - ( static_cast( *anElemsIter )); + const SMDS_MeshNode* node = static_cast( *anElemsIter ); // find out a shape type TopoDS_Shape aShape = myMesh->IndexToShape( Id ); int aShapeType = ( aShape.IsNull() ? -1 : aShape.ShapeType() ); diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx index cee3e1b09..638f4ad5c 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx @@ -254,7 +254,6 @@ namespace const SMDSAbs_ElementType anElemType) { anElemFamMap.Clear(); - //anElemFamMap.clear(); list::iterator aFamsIter = aFamilies.begin(); while ( aFamsIter != aFamilies.end() ) { @@ -263,12 +262,11 @@ namespace } else { int aFamId = (*aFamsIter)->GetId(); - const set& anElems = (*aFamsIter)->GetElements(); - set::const_iterator anElemsIter = anElems.begin(); + const ElementsSet& anElems = (*aFamsIter)->GetElements(); + ElementsSet::const_iterator anElemsIter = anElems.begin(); for (; anElemsIter != anElems.end(); anElemsIter++) { anElemFamMap.Bind( (Standard_Address)*anElemsIter, aFamId ); - //anElemFamMap[*anElemsIter] = aFamId; } // remove a family from the list aFamilies.erase( aFamsIter++ ); @@ -288,9 +286,7 @@ namespace { if ( anElemFamMap.IsBound( (Standard_Address) anElement )) return anElemFamMap( (Standard_Address) anElement ); -// TElemFamilyMap::iterator elem_famNum = anElemFamMap.find( anElement ); -// if ( elem_famNum != anElemFamMap.end() ) -// return elem_famNum->second; + return aDefaultFamilyId; } diff --git a/src/OBJECT/SMESH_Object.cxx b/src/OBJECT/SMESH_Object.cxx index 44d70da65..cbb913fe1 100644 --- a/src/OBJECT/SMESH_Object.cxx +++ b/src/OBJECT/SMESH_Object.cxx @@ -232,8 +232,8 @@ void SMESH_VisualObjDef::createPoints( vtkPoints* thePoints ) { thePoints->SetPoint( nbPoints, aNode->X(), aNode->Y(), aNode->Z() ); int anId = aNode->GetID(); - mySMDS2VTKNodes.insert( TMapOfIds::value_type( anId, nbPoints ) ); - myVTK2SMDSNodes.insert( TMapOfIds::value_type( nbPoints, anId ) ); + mySMDS2VTKNodes.insert( mySMDS2VTKNodes.end(), std::make_pair( anId, nbPoints )); + myVTK2SMDSNodes.insert( myVTK2SMDSNodes.end(), std::make_pair( nbPoints, anId )); nbPoints++; } } @@ -251,48 +251,48 @@ void SMESH_VisualObjDef::buildPrs(bool buildGrid) MESSAGE("----------------------------------------------------------SMESH_VisualObjDef::buildPrs " << buildGrid); if (buildGrid) { - myLocalGrid = true; - try - { - mySMDS2VTKNodes.clear(); - myVTK2SMDSNodes.clear(); - mySMDS2VTKElems.clear(); - myVTK2SMDSElems.clear(); - - if ( IsNodePrs() ) - buildNodePrs(); - else - buildElemPrs(); - } - catch(...) - { - mySMDS2VTKNodes.clear(); - myVTK2SMDSNodes.clear(); - mySMDS2VTKElems.clear(); - myVTK2SMDSElems.clear(); - - myGrid->SetPoints( 0 ); - myGrid->SetCells( 0, 0, 0, 0, 0 ); - throw; - } + myLocalGrid = true; + try + { + mySMDS2VTKNodes.clear(); + myVTK2SMDSNodes.clear(); + mySMDS2VTKElems.clear(); + myVTK2SMDSElems.clear(); + + if ( IsNodePrs() ) + buildNodePrs(); + else + buildElemPrs(); + } + catch(...) + { + mySMDS2VTKNodes.clear(); + myVTK2SMDSNodes.clear(); + mySMDS2VTKElems.clear(); + myVTK2SMDSElems.clear(); + + myGrid->SetPoints( 0 ); + myGrid->SetCells( 0, 0, 0, 0, 0 ); + throw; + } } else { - myLocalGrid = false; - if (!GetMesh()->isCompacted()) - { - MESSAGE("*** buildPrs ==> compactMesh!"); - GetMesh()->compactMesh(); - } - vtkUnstructuredGrid *theGrid = GetMesh()->getGrid(); - updateEntitiesFlags(); - myGrid->ShallowCopy(theGrid); - //MESSAGE(myGrid->GetReferenceCount()); - //MESSAGE( "Update - myGrid->GetNumberOfCells() = "<GetNumberOfCells() ); - //MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<GetNumberOfPoints() ); - if( MYDEBUGWITHFILES ) { - SMESH::WriteUnstructuredGrid( myGrid,"myPrs.vtu" ); - } + myLocalGrid = false; + if (!GetMesh()->isCompacted()) + { + MESSAGE("*** buildPrs ==> compactMesh!"); + GetMesh()->compactMesh(); + } + vtkUnstructuredGrid *theGrid = GetMesh()->getGrid(); + updateEntitiesFlags(); + myGrid->ShallowCopy(theGrid); + //MESSAGE(myGrid->GetReferenceCount()); + //MESSAGE( "Update - myGrid->GetNumberOfCells() = "<GetNumberOfCells() ); + //MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<GetNumberOfPoints() ); + if( MYDEBUGWITHFILES ) { + SMESH::WriteUnstructuredGrid( myGrid,"myPrs.vtu" ); + } } } @@ -454,8 +454,8 @@ void SMESH_VisualObjDef::buildElemPrs() int anId = anElem->GetID(); - mySMDS2VTKElems.insert( TMapOfIds::value_type( anId, iElem ) ); - myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) ); + mySMDS2VTKElems.insert( mySMDS2VTKElems.end(), std::make_pair( anId, iElem )); + myVTK2SMDSElems.insert( myVTK2SMDSElems.end(), std::make_pair( iElem, anId )); SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator(); { @@ -986,7 +986,7 @@ static int getNodesFromElems( SMESH::long_array_var& theElemIds, // function : getPointers // purpose : Get std::list from list of IDs //================================================================================= -static int getPointers( const SMDSAbs_ElementType theRequestType, +static int getPointers( const SMDSAbs_ElementType theRequestType, SMESH::long_array_var& theElemIds, const SMDS_Mesh* theMesh, std::list& theResList ) diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index 072fcdac7..ba7d59f37 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -2275,7 +2275,7 @@ void SMESHDS_Mesh::compactMesh() int newSmdsId = 0; for (int i = 0; i < myCellsSize; i++) { - if (myCells[i]) + if ( myCells[i] ) { newSmdsId++; // SMDS id start to 1 assert(newSmdsId <= newCellSize); diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx index f16d08d87..f71de0320 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx @@ -2320,6 +2320,7 @@ GrpComputor::GrpComputor( SMESH::SMESH_GroupBase_ptr grp, void GrpComputor::compute() { if ( !CORBA::is_nil( myGroup ) && myItem ) { + SUIT_OverrideCursor wc; QTreeWidgetItem* item = myItem; myItem = 0; int nb = myToComputeSize ? myGroup->Size() : myGroup->GetNumberOfNodes(); diff --git a/src/SMESH_I/SMESH_PreMeshInfo.cxx b/src/SMESH_I/SMESH_PreMeshInfo.cxx index 0621ed9f1..eb4181170 100644 --- a/src/SMESH_I/SMESH_PreMeshInfo.cxx +++ b/src/SMESH_I/SMESH_PreMeshInfo.cxx @@ -920,7 +920,7 @@ void SMESH_PreMeshInfo::readSubMeshes(DriverMED_R_SMESHDS_Mesh* reader) const #endif nbElems = elemSet.size(); } - // add elements to submeshes + // add elements to sub-meshes TIDSortedElemSet::iterator iE = elemSet.begin(); for ( size_t i = 0; i < nbElems; ++i, ++iE ) { diff --git a/src/SMESH_SWIG/StdMeshersBuilder.py b/src/SMESH_SWIG/StdMeshersBuilder.py index 6dd91e288..204e461b1 100644 --- a/src/SMESH_SWIG/StdMeshersBuilder.py +++ b/src/SMESH_SWIG/StdMeshersBuilder.py @@ -1100,7 +1100,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): pass # end of StdMeshersBuilder_Prism3D class -## Defines a Prism 3D algorithm +## Defines Radial Prism 3D algorithm # # It is created by calling smeshBuilder.Mesh.Prism(geom=0) # diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index cfd4117f1..6e39264b1 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -32,7 +32,6 @@ ## @{ ## @defgroup l3_algos_basic Basic meshing algorithms ## @defgroup l3_algos_proj Projection Algorithms -## @defgroup l3_algos_radialp Radial Prism ## @defgroup l3_algos_segmarv Segments around Vertex ## @defgroup l3_algos_3dextr 3D extrusion meshing algorithm @@ -70,10 +69,9 @@ ## @defgroup l2_modif_trsf Transforming meshes (Translation, Rotation, Symmetry, Sewing, Merging) ## @defgroup l2_modif_movenode Moving nodes ## @defgroup l2_modif_throughp Mesh through point -## @defgroup l2_modif_invdiag Diagonal inversion of elements ## @defgroup l2_modif_unitetri Uniting triangles -## @defgroup l2_modif_changori Changing orientation of elements ## @defgroup l2_modif_cutquadr Cutting elements +## @defgroup l2_modif_changori Changing orientation of elements ## @defgroup l2_modif_smooth Smoothing ## @defgroup l2_modif_extrurev Extrusion and Revolution ## @defgroup l2_modif_patterns Pattern mapping @@ -310,9 +308,9 @@ engine = None doLcc = False created = False -## This class allows to create, load or manipulate meshes -# It has a set of methods to create load or copy meshes, to combine several meshes. -# It also has methods to get infos on meshes. +## This class allows to create, load or manipulate meshes. +# It has a set of methods to create, load or copy meshes, to combine several meshes, etc. +# It also has methods to get infos and measure meshes. class smeshBuilder(object, SMESH._objref_SMESH_Gen): # MirrorType enumeration @@ -614,6 +612,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): # @param allGroups forces creation of groups corresponding to every input mesh # @param name name of a new mesh # @return an instance of Mesh class + # @ingroup l2_compounds def Concatenate( self, meshes, uniteIdenticalGroups, mergeNodesAndElements = False, mergeTolerance = 1e-5, allGroups = False, name = ""): @@ -1162,7 +1161,7 @@ omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshBuilder) # import salome # salome.salome_init() # from salome.smesh import smeshBuilder -# smesh = smeshBuilder.New(theStudy) +# smesh = smeshBuilder.New(salome.myStudy) # \endcode # @param study SALOME study, generally obtained by salome.myStudy. # @param instance CORBA proxy of SMESH Engine. If None, the default Engine is used. @@ -1177,7 +1176,7 @@ def New( study, instance=None): import salome salome.salome_init() from salome.smesh import smeshBuilder - smesh = smeshBuilder.New(theStudy) + smesh = smeshBuilder.New(salome.myStudy) Parameters: study SALOME study, generally obtained by salome.myStudy. @@ -2153,7 +2152,7 @@ class Mesh: ## # Create a standalone group of entities basing on nodes of other groups. - # \param groups - list of groups, sub-meshes or filters, of any type. + # \param groups - list of reference groups, sub-meshes or filters, of any type. # \param elemType - a type of elements to include to the new group; either of # (SMESH.NODE, SMESH.EDGE, SMESH.FACE, SMESH.VOLUME). # \param name - a name of the new group. @@ -2165,7 +2164,10 @@ class Mesh: # - SMESH.AT_LEAST_ONE - include if one or more node is common, # - SMEHS.MAJORITY - include if half of nodes or more are common. # \param underlyingOnly - if \c True (default), an element is included to the - # new group provided that it is based on nodes of one element of \a groups. + # new group provided that it is based on nodes of an element of \a groups; + # in this case the reference \a groups are supposed to be of higher dimension + # than \a elemType, which can be useful for example to get all faces lying on + # volumes of the reference \a groups. # @return an instance of SMESH_Group # @ingroup l2_grps_operon def CreateDimGroup(self, groups, elemType, name, @@ -2176,7 +2178,7 @@ class Mesh: ## Convert group on geom into standalone group - # @ingroup l2_grps_delete + # @ingroup l2_grps_edit def ConvertToStandalone(self, group): return self.mesh.ConvertToStandalone(group) @@ -3073,7 +3075,7 @@ class Mesh: # @param NodeID1 the ID of the first node # @param NodeID2 the ID of the second node # @return false if proper faces were not found - # @ingroup l2_modif_invdiag + # @ingroup l2_modif_cutquadr def InverseDiag(self, NodeID1, NodeID2): return self.editor.InverseDiag(NodeID1, NodeID2)