53103: Mesh visualization performance problem

Optimize visualization and mesh loading.

+ fix docs
This commit is contained in:
eap 2016-03-11 16:32:07 +03:00
parent 0224364ee2
commit a1a6d5ddc1
22 changed files with 265 additions and 231 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -7,49 +7,66 @@ be used for easy mesh creation and edition.
Documentation for SALOME %Mesh module Python API is available in two forms:
- <a href="smeshpy_doc/modules.html">Structured documentation</a>, where all methods and
classes are grouped by their functionality, like it is done in the GUI documentation
classes are grouped by their functionality.
- <a href="smeshpy_doc/namespaces.html">Linear documentation</a> 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:
<ol>
<li>Create an instance of \ref smeshBuilder.smeshBuilder "smeshBuilder":
<pre>
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New( salome.myStudy )
</pre></li>
<li>Create a \ref smeshBuilder.Mesh "mesh" object:
<pre>
mesh = \ref smeshBuilder.smeshBuilder.Mesh "smesh.Mesh( geometry )"
</pre></li>
<li> 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:
<pre>
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 )
</pre></li>
<li> Create and assign \ref about_hypo_page "hypotheses" by calling
corresponding methods of algorithms:
<pre>
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 )
</pre>
</li>
<li> \ref compute_anchor "Compute" the mesh (generate mesh nodes and elements):
<pre>
\ref Mesh.Compute "mesh.Compute"()
</pre>
</li>
</ol>
An easiest way to start with Python scripting is to do something in
GUI and then to get a corresponding Python script via
<b> File > Dump Study </b> 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
*/

View File

@ -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.
<br>
<h2>Construction of a Mesh</h2>
\section construction_of_a_mesh Construction of a mesh
\tui_script{creating_meshes_ex01.py}
<br>
\anchor tui_construction_submesh
<h2>Construction of a Submesh</h2>
\section tui_construction_submesh Construction of a sub-mesh
\tui_script{creating_meshes_ex02.py}
<br>
<h2>Change priority of submeshes in Mesh</h2>
\section change_priority_of_submeshes_in_mesh Change priority of sub-meshes in mesh
\tui_script{creating_meshes_ex03.py}
<br>
\anchor tui_editing_while_meshing
<h2>Intermediate edition while meshing</h2>
\section tui_editing_while_meshing Intermediate edition while meshing
\tui_script{a3DmeshOnModified2Dmesh.py}
<br>
\anchor tui_editing_mesh
<h2>Editing a mesh</h2>
\section tui_editing_mesh Editing a mesh
\tui_script{creating_meshes_ex04.py}
<br>
\anchor tui_export_mesh
<h2>Export of a Mesh</h2>
\section tui_export_mesh Export of a Mesh
\tui_script{creating_meshes_ex05.py}
<br>
<h2>How to mesh a cylinder with hexahedrons?</h2>
\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
<br>
\anchor tui_building_compound
<h2>Building a compound of meshes</h2>
\section tui_building_compound Building a compound of meshes
\tui_script{creating_meshes_ex07.py}
<br>
\anchor tui_copy_mesh
<h2>Mesh Copying</h2>
\section tui_copy_mesh Mesh Copying
\tui_script{creating_meshes_ex08.py}
*/

View File

@ -2,27 +2,24 @@
\page tui_grouping_elements_page Grouping Elements
\tableofcontents
<br>
\anchor tui_create_standalone_group
<h2>Create a Standalone Group</h2>
\section tui_create_standalone_group Create a Standalone Group
\tui_script{grouping_elements_ex01.py}
\image html create_group.png
<br>
\anchor tui_create_group_on_geometry
<h2>Create a Group on Geometry</h2>
\section tui_create_group_on_geometry Create a Group on Geometry
\tui_script{grouping_elements_ex02.py}
<br>
\anchor tui_create_group_on_filter
<h2>Create a Group on Filter</h2>
\section tui_create_group_on_filter Create a Group on Filter
\tui_script{grouping_elements_ex03.py}
<br>
\anchor tui_edit_group
<h2>Edit a Group</h2>
\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
<br>
\anchor tui_union_of_groups
<h2>Union of groups</h2>
\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
<br>
\anchor tui_intersection_of_groups
<h2>Intersection of groups</h2>
\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
<br>
\anchor tui_cut_of_groups
<h2>Cut of groups</h2>
\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
<br>
\anchor tui_create_dim_group
<h2>Creating groups of entities from existing groups of superior dimensions</h2>
\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

View File

@ -2,9 +2,10 @@
\page tui_modifying_meshes_page Modifying Meshes
\tableofcontents
<br>
\anchor tui_adding_nodes_and_elements
<h2>Adding Nodes and Elements</h2>
\section tui_adding_nodes_and_elements Adding Nodes and Elements
<br>
\anchor tui_add_node
@ -57,8 +58,7 @@
\tui_script{modifying_meshes_ex10.py}
<br>
\anchor tui_removing_nodes_and_elements
<h2>Removing Nodes and Elements</h2>
\section tui_removing_nodes_and_elements Removing Nodes and Elements
<br>
\anchor tui_removing_nodes
@ -76,73 +76,59 @@
\tui_script{modifying_meshes_ex13.py}
<br>
\anchor tui_renumbering_nodes_and_elements
<h2>Renumbering Nodes and Elements</h2>
\section tui_renumbering_nodes_and_elements Renumbering Nodes and Elements
\tui_script{modifying_meshes_ex14.py}
<br>
\anchor tui_moving_nodes
<h2>Moving Nodes</h2>
\section tui_moving_nodes Moving Nodes
\tui_script{modifying_meshes_ex15.py}
<br>
\anchor tui_diagonal_inversion
<h2>Diagonal Inversion</h2>
\section tui_diagonal_inversion Diagonal Inversion
\tui_script{modifying_meshes_ex16.py}
<br>
\anchor tui_uniting_two_triangles
<h2>Uniting two Triangles</h2>
\section tui_uniting_two_triangles Uniting two Triangles
\tui_script{modifying_meshes_ex17.py}
<br>
\anchor tui_uniting_set_of_triangles
<h2>Uniting a Set of Triangles</h2>
\section tui_uniting_set_of_triangles Uniting a Set of Triangles
\tui_script{modifying_meshes_ex18.py}
<br>
\anchor tui_orientation
<h2>Orientation</h2>
\section tui_orientation Orientation
\tui_script{modifying_meshes_ex19.py}
<br>
\anchor tui_cutting_quadrangles
<h2>Cutting Quadrangles</h2>
\section tui_cutting_quadrangles Cutting Quadrangles
\tui_script{modifying_meshes_ex20.py}
<br>
\anchor tui_smoothing
<h2>Smoothing</h2>
\section tui_smoothing Smoothing
\tui_script{modifying_meshes_ex21.py}
<br>
\anchor tui_extrusion
<h2>Extrusion</h2>
\section tui_extrusion Extrusion
\tui_script{modifying_meshes_ex22.py}
<br>
\anchor tui_extrusion_along_path
<h2>Extrusion along a Path</h2>
\section tui_extrusion_along_path Extrusion along a Path
\tui_script{modifying_meshes_ex23.py}
<br>
\anchor tui_revolution
<h2>Revolution</h2>
\section tui_revolution Revolution
\tui_script{modifying_meshes_ex24.py}
<br>
\anchor tui_pattern_mapping
<h2>Pattern Mapping</h2>
\section tui_pattern_mapping Pattern Mapping
\tui_script{modifying_meshes_ex25.py}
<br>
\anchor tui_quadratic
<h2>Convert mesh to/from quadratic</h2>
\section tui_quadratic Convert mesh to/from quadratic
\tui_script{modifying_meshes_ex26.py}
<br>
\anchor tui_split_biquad
<h2>Split bi-quadratic into linear</h2>
\section tui_split_biquad Split bi-quadratic into linear
\tui_script{split_biquad.py}
*/

View File

@ -2,6 +2,8 @@
\page tui_quality_controls_page Quality Controls
\tableofcontents
\section tui_free_borders Free Borders
\tui_script{quality_controls_ex01.py}

View File

@ -2,73 +2,58 @@
\page tui_transforming_meshes_page Transforming Meshes
<br><h2>Transforming Meshes</h2>
\tableofcontents
<br>
\anchor tui_translation
<h3>Translation</h3>
\section tui_translation Translation
\tui_script{transforming_meshes_ex01.py}
<br>
\anchor tui_rotation
<h3>Rotation</h3>
\section tui_rotation Rotation
\tui_script{transforming_meshes_ex02.py}
<br>
\anchor tui_scale
<h3>Scale</h3>
\section tui_scale Scale
\tui_script{transforming_meshes_ex03.py}
<br>
\anchor tui_symmetry
<h3>Symmetry</h3>
\section tui_symmetry Symmetry
\tui_script{transforming_meshes_ex04.py}
<br>
\anchor tui_merging_nodes
<h3>Merging Nodes</h3>
\section tui_merging_nodes Merging Nodes
\tui_script{transforming_meshes_ex05.py}
<br>
\anchor tui_merging_elements
<h3>Merging Elements</h3>
\section tui_merging_elements Merging Elements
\tui_script{transforming_meshes_ex06.py}
<br><h2>Sewing Meshes</h2>
<br>
\anchor tui_sew_meshes_border_to_side
<h3>Sew Meshes Border to Side</h3>
\section tui_sew_meshes_border_to_side Sew Meshes Border to Side
\tui_script{transforming_meshes_ex07.py}
<br>
\anchor tui_sew_conform_free_borders
<h3>Sew Conform Free Borders</h3>
\section tui_sew_conform_free_borders Sew Conform Free Borders
\tui_script{transforming_meshes_ex08.py}
<br>
\anchor tui_sew_free_borders
<h3>Sew Free Borders</h3>
\section tui_sew_free_borders Sew Free Borders
\tui_script{transforming_meshes_ex09.py}
<br>
\anchor tui_sew_side_elements
<h3>Sew Side Elements</h3>
\section tui_sew_side_elements Sew Side Elements
\tui_script{transforming_meshes_ex10.py}
<br>
\anchor tui_duplicate_nodes
<h3>Duplicate nodes or/and elements</h3>
\section tui_duplicate_nodes Duplicate nodes or/and elements
\tui_script{transforming_meshes_ex11.py}
<br>
\anchor tui_make_2dmesh_from_3d
<h3>Create boundary elements</h3>
\section tui_make_2dmesh_from_3d Create boundary elements
\tui_script{transforming_meshes_ex12.py}
<br>
\anchor tui_reorient_faces
<h3>Reorient faces</h3>
\section tui_reorient_faces Reorient faces
\tui_script{transforming_meshes_ex13.py}
*/

View File

@ -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

View File

@ -74,7 +74,7 @@ module SMESH
boolean Contains( in long elem_id );
/*!
* Returns ID of an element at position <elem_index>
* Returns ID of an element at position <elem_index> counted from 1
*/
long GetID( in long elem_index );

View File

@ -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

View File

@ -49,10 +49,10 @@
#define REST_BALL_FAMILY -5
#define FIRST_ELEM_FAMILY -6
typedef std::list<DriverMED_FamilyPtr > DriverMED_FamilyPtrList;
typedef std::map<int,SMESHDS_SubMesh* > SMESHDS_SubMeshPtrMap;
typedef std::list<SMESHDS_GroupBase* > SMESHDS_GroupBasePtrList;
typedef std::set<const SMDS_MeshElement* > ElementsSet;
typedef std::list<DriverMED_FamilyPtr > DriverMED_FamilyPtrList;
typedef std::map<int,SMESHDS_SubMesh* > SMESHDS_SubMeshPtrMap;
typedef std::list<SMESHDS_GroupBase* > SMESHDS_GroupBasePtrList;
typedef std::set<const SMDS_MeshElement*,TIDCompare > ElementsSet;
class MESHDRIVERMED_EXPORT DriverMED_Family
{

View File

@ -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<const SMDS_MeshElement *>& anElements = aFamily->GetElements();
set<const SMDS_MeshElement *>::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<const SMDS_MeshElement *>& anElements = aFamily->GetElements();
set<const SMDS_MeshElement *>::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<const SMDS_MeshElement *> anElements = aFamily->GetElements();
set<const SMDS_MeshElement *>::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<SMDS_MeshNode*>
( static_cast<const SMDS_MeshNode*>( *anElemsIter ));
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( *anElemsIter );
// find out a shape type
TopoDS_Shape aShape = myMesh->IndexToShape( Id );
int aShapeType = ( aShape.IsNull() ? -1 : aShape.ShapeType() );

View File

@ -254,7 +254,6 @@ namespace
const SMDSAbs_ElementType anElemType)
{
anElemFamMap.Clear();
//anElemFamMap.clear();
list<DriverMED_FamilyPtr>::iterator aFamsIter = aFamilies.begin();
while ( aFamsIter != aFamilies.end() )
{
@ -263,12 +262,11 @@ namespace
}
else {
int aFamId = (*aFamsIter)->GetId();
const set<const SMDS_MeshElement *>& anElems = (*aFamsIter)->GetElements();
set<const SMDS_MeshElement *>::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;
}

View File

@ -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();
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();
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;
}
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() = "<<myGrid->GetNumberOfCells() );
//MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<<myGrid->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() = "<<myGrid->GetNumberOfCells() );
//MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<<myGrid->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<const SMDS_MeshElement*> 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<const SMDS_MeshElement*>& theResList )

View File

@ -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);

View File

@ -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();

View File

@ -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 )
{

View File

@ -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)
#

View File

@ -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)