merge from V5_1_3rc5

This commit is contained in:
prascle 2009-12-07 16:20:46 +00:00
parent fe3703789b
commit 8bc3c946fb
297 changed files with 11989 additions and 9173 deletions

View File

@ -44,15 +44,25 @@ AC_ARG_WITH(qwt_inc,
AC_MSG_RESULT("select $withval as path to QWT includes")
])
libqwt_name=qwt
if test -z $QWTHOME; then
AC_MSG_RESULT(QWTHOME not defined)
AC_MSG_NOTICE(Trying native Qwt...)
exist_ok=no
if test "x$exist_ok" = "xno"; then
for d in /usr/local /usr ; do
AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/libqwt.so,exist_ok=yes,exist_ok=no)
for d in /usr /usr/local ; do
for extension in qwt-qt4 qwt; do
AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/lib${extension}.so,exist_ok=yes,exist_ok=no)
if test "x$exist_ok" = "xyes"; then
QWTHOME=$d
AC_MSG_RESULT(libqwt.so detected in $d/lib)
AC_MSG_RESULT(lib${extension}.so detected in $d/lib)
libqwt_name=${extension}
dnl break, libqwt-qt4.so is choosen before libqwt.so since it is surely the Qt4 version.
break
fi
done
if test "x$exist_ok" = "xyes"; then
break
fi
done
fi
@ -69,7 +79,10 @@ if test -z $QWTHOME; then
fi
if test "x$exist_ok" = "xyes"; then
if test -z $QWT_INCDIR; then
QWT_INCDIR=$QWTHOME"/include/qwt"
QWT_INCDIR=$QWTHOME"/include/qwt-qt4"
if test ! -f $QWT_INCDIR/qwt.h ; then
QWT_INCDIR=/usr/include/qwt
fi
if test ! -f $QWT_INCDIR/qwt.h ; then
QWT_INCDIR=$QWTHOME"/include"
fi
@ -84,6 +97,7 @@ if test -z $QWTHOME; then
qwt_ok=no
fi
else
AC_MSG_NOTICE(Trying Qwt from $QWTHOME ...)
if test -z $QWT_INCDIR; then
QWT_INCDIR="$QWTHOME/include"
fi
@ -119,9 +133,9 @@ else
LIBS_old=$LIBS
LIBS="$LIBS $QT_LIBS"
if test "x$QWTHOME" = "x/usr" ; then
LIBS="$LIBS -lqwt"
LIBS="$LIBS -l${libqwt_name}"
else
LIBS="$LIBS -L$QWTHOME/lib -lqwt"
LIBS="$LIBS -L$QWTHOME/lib -l${libqwt_name}"
fi
CXXFLAGS_old=$CXXFLAGS
@ -148,9 +162,9 @@ else
else
AC_MSG_RESULT(yes)
if test "x$QWTHOME" = "x/usr" ; then
QWT_LIBS=" -lqwt"
QWT_LIBS=" -l${libqwt_name}"
else
QWT_LIBS="-L$QWTHOME/lib -lqwt"
QWT_LIBS="-L$QWTHOME/lib -l${libqwt_name}"
fi
fi

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,

View File

@ -26,7 +26,7 @@
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Created from configure.in.base
#
AC_INIT([Salome2 Project SMESH module], [5.1.2], [webmaster.salome@opencascade.com], [SalomeSMESH])
AC_INIT([Salome2 Project SMESH module], [5.1.3], [webmaster.salome@opencascade.com], [SalomeSMESH])
AC_CONFIG_AUX_DIR(adm_local/unix/config_files)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
@ -87,7 +87,7 @@ dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + pour les librairie
echo
echo ---------------------------------------------
echo Coniguring production
echo Configuring production
echo ---------------------------------------------
echo
AC_ENABLE_DEBUG(yes)

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -199,31 +199,27 @@ minimum and maximum value of this parameter.
\anchor fixed_points_1d_anchor
<h2>Fixed points 1D hypothesis</h2>
<b>Fixed points 1D</b> hypothesis allows to split edges into segments
using set of fixed points given by normalized parameters on edge and
set of numbers of segments for splitting each sub-segment between
fixed points. Optionally it is possible to set flag
<b>Same Nb. Segments for all intervals</b> and
only one value for mentioned number of segments.
The direction of the splitting is defined by the orientation of the
underlying geometrical edge. <b>"Reverse Edges"</b> list box allows to
specify the edges for which the splitting should be made in the
direction opposing to their orientation. This list box is enabled only
if the geometry object is selected for the meshing. In this case the
user can select edges to be reversed either directly picking them in
the 3D viewer or by selecting the edges or groups of edges in the
Object browser.
Using of this hypothesis for quadrangle face where main mesh is
created using <b>Quadrangle(Mapping)</b> and <b>NumberOfSegments</b>
hypothesises. Creation hypothesis <b>FixedPoint_1D</b> for submesh on
one edge:
<b>Fixed points 1D</b> hypothesis allows splitting edges through a
set of points parameterized on the edge (from 1 to 0) and a number of segments for each
interval limited by the points.
\image html hypo_fixedpnt_dlg.png
Resulting 2D mesh:
It is possible to check in <b>Same Nb. Segments for all intervals</b>
option and to define one value for all intervals.
\image html mesh_fixedpnt.png
The splitting direction is defined by the orientation of the
underlying geometrical edge. <b>"Reverse Edges"</b> list box allows to
specify the edges for which the splitting should be made in the
direction opposite to their orientation. This list box is enabled only
if the geometrical object is selected for meshing. In this case it is
possible to select the edges to be reversed either directly picking them in
the 3D viewer or selecting the edges or groups of edges in the
Object browser.
\image html mesh_fixedpnt.png "Example of a submesh on the edge built using Fixed points 1D hypothesis"
<b>See Also</b> a sample TUI Script of a
\ref tui_fixed_points "Defining Fixed Points" hypothesis operation.
*/

View File

@ -23,6 +23,8 @@ which will compose the mesh of these 2D faces.
\image html a-maxelarea.png
\n
\image html max_el_area.png "In this example, Max. element area is very small compared to the 1D hypothesis"
<b>See Also</b> a sample TUI Script of a
@ -52,6 +54,18 @@ used as a degenerated edge.
\image html hypo_quad_params_res.png "The resulting mesh"
This hypothesis can be also used to mesh a segment of a circular face.
Please, consider that there is a limitation on the selectiion of the degenerated
vertex for the faces built with the angle > 180 degrees (see the picture).
\image html hypo_quad_params_2.png "3/4 of a circular face"
In this case, selection of a wrong vertex for the <b>Quadrangle parameters</b>
hypothesis will generate a wrong mesh. The picture below
shows the good (left) and the bad (right) results of meshing.
\image html hypo_quad_params_res_2.png "The resulting meshes"
<br>
\anchor quadrangle_preference_anchor
<h2>Quadrangle Preference</h2>

View File

@ -28,6 +28,7 @@ them, you operate numerical values):
<ul>
<li>\ref max_element_area_anchor "Max Element Area"</li>
<li>\ref length_from_edges_anchor "Length from Edges"</li>
<li>\ref hypo_quad_params_anchor "Quadrangle Parameters"</li>
<li>\ref quadrangle_preference_anchor "Quadrangle Preference"</li>
<li>\ref triangle_preference_anchor "Triangle Preference"</li>
</ul>

View File

@ -26,6 +26,7 @@ entities including:
<ul>
<li>\b Node &mdash; 0D object of a mesh presented by a point with coordinates (x, y, z).</li>
<li>\b 0D element &mdash; element of a mesh defined by one node.</li>
<li>\b Edge &mdash; 1D element of a mesh defined by two nodes.</li>
<li>\b Face &mdash; 2D element of a mesh defined by three or four edges (closed contour).</li>
<li>\b Volume &mdash; 3D element of a mesh defined by several faces.</li>

View File

@ -47,7 +47,7 @@ tetrahedral (pyramidal) elements.</li>
\image html image126.gif "Example of a hexahedral 3D mesh"
</ul>
\Note that BLSURF and GHS3D are commercial meshers and require a
\note BLSURF and GHS3D are commercial meshers and require a
license to be used within the Mesh module.
There is also a number of more specific algorithms:
@ -56,8 +56,7 @@ There is also a number of more specific algorithms:
<li>\subpage radial_prism_algo_page "for meshing geometrical objects with cavities"</li>
<li>\subpage segments_around_vertex_algo_page "for defining the local size of elements around a certain node"</li>
<li>\subpage prism_3d_algo_page "for meshing prismatic shapes"</li>
<li>\subpage radial_quadrangle_1D2D_algo_page "for meshing special 2d
faces (circles and part of circles)"</li>
<li>\subpage radial_quadrangle_1D2D_algo_page "for meshing special 2d faces (circles and part of circles)"</li>
</ul>
\ref constructing_meshes_page "Constructing meshes" page describes in

View File

@ -5,6 +5,8 @@
\n BLSURF Parameters hypothesis works only with <b>BLSURF</b> 2d
algorithm. This algorithm is a commercial software.
<h1>General parameters</h1>
\image html blsurf_parameters.png
<ul>
@ -53,6 +55,8 @@ two adjacent edges. </li>
edges are not respected and all geometrical faces are meshed as one
hyper-face.</li>
<h1>Advanced parameters</h1>
\image html blsurf_parameters_advanced.png
<li><b>Topology</b> - allows creation of a conform mesh on a shell of
@ -83,12 +87,12 @@ the diagonal of the bounding box of the geometrical object to mesh.
<ul>
<li><b>topo_eps1</b> (real) - is the tolerance level inside a CAD
patch. By default is equal to <i>diag</i> × 10-4. This tolerance is used to
patch. By default is equal to <i>diag</i> <EFBFBD> 10-4. This tolerance is used to
identify nodes to merge within one geometrical face when \b Topology
option is to pre-process. Default is <i>diag</i>/10.0.</li>
<li><b>topo_eps2</b> (real) - is the tolerance level between two CAD
patches. By default is equal to <i>diag</i> × 10-4. This tolerance is used to
patches. By default is equal to <i>diag</i> <EFBFBD> 10-4. This tolerance is used to
identify nodes to merge over different geometrical faces when
\b Topology option is to pre-process. Default is <i>diag</i>/10.0.</li>
@ -199,24 +203,37 @@ String variables:
<li> import_option </li>
</ul>
<h1>Custom size map</h1>
\image html blsurf_parameters_sizemap.png
It is possible to define user sizes on faces, edges or verteces.
User sizes can be defined on faces, edges or vertices.
<ul>
<li>Those faces, edges and verteces must be sub-shapes (from explode command) of the meshed geometry object.</li>
<li>Groups are currently not handled.</li>
<li>Multi-selection is possible.</li>
<li>The sizes are constant values.</li>
<li>The faces, edges and vertices can belong to the meshed geometrical
object or to its sub-shapes (created using <b>Explode</b> command).</li>
<li>Groups of faces, edges and vertices are also handled.</li>
<li>It is possible to attribute the same size to several geometries using multi-selection.</li>
<li>The sizes are constant values or python functions.</li>
<li>In case of a python function, the following rules must be respected:
<ul>
<li>The name of the function is f.</li>
<li>If geometry is a face or a group of faces, the function is f(u,v).</li>
<li>If geometry is an edge or a group of edges, the function is f(t).</li>
<li>If geometry is a vertex or a group of vertices, the function is f().</li>
<li>The function must return a double.</li>
</ul></li>
</ul>
<br><b>See Also</b> a sample TUI Script of the \ref tui_blsurf "creation of a BLSurf hypothesis", including size map.
\anchor blsurf_sizemap_computation
<h2>Computation of the physical size</h2>
Here is the detail on the calculation of the size (from BLSurf documentation).
\n
The size is obtained by querying sizemap functions associated to the input CAD object for surfaces, curves and points.
Each function can either return a value h (which is then trimmed between the two bounds hphymin and hphymax), or "no answer" (by not assigning a value to h), thus providing great flexibility in the specification of the sizes. The computation depends whether point P is internal to a surface, internal to a curve, or at the end of several curves:
The physical size is obtained by querying sizemap functions associated to the input CAD object for surfaces, curves and points.
Each function can either return a value h (which is then trimmed
between the two bounds hphymin and hphymax), or "no answer" (by not
assigning a value to h), thus providing great flexibility in the
specification of the sizes. The computation depends on whether point P is internal to a surface, internal to a curve, or at the end of several curves:
<ul>
<li> If point P is internal to a surface, the CAD surface size function is queried. If no answer is returned, one interpolates with the values at the vertices of the discretized interface curves.</li>
<li> If point P is internal to a curve, the CAD curve size function is queried first. If no answer is returned, the surface size function is queried for every adjacent surface and the mean value of the returned values is computed. If no answer is returned, sizes h1 and h2 at both ends of the curve are considered (see next item) and the interpolated value is computed.</li>
@ -225,7 +242,23 @@ Each function can either return a value h (which is then trimmed between the two
In order to compute the mean of several values, the arithmetic mean is used by default, but this can be modified by the parameter \ref blsurf_hmean_flag "hmean flag". In the same way, in order to interpolate two values, a linear interpolation is used by default, but this can be modified by \ref blsurf_hinterpol_flag "hinterpol flag".
\n
<h1>Custom enforced vertices</h1>
\image html blsurf_parameters_enforced_vertices.png
It is possible to define some enforced vertices to BLSurf algorithm
without creating any vertices by CAD algorithms.
<ul>
<li>The enforced vertex is the projection of a point defined by its
(x,y,z) coordinates on the selected face.</li>
<li>It is possible to define several enforced vertices on a face or a group of faces.</li>
<li>If the projected point is on the boundary or outside of the face, it will be ignored.</li>
</ul>
<br><b>See Also</b> a sample TUI Script of the \ref tui_blsurf "creation of a BLSurf hypothesis", including enforced vertices.
<h1>Limitations</h1>
Currently BLSURF plugin has the following limitations.
<ul>
<li>The created mesh will contain inverted elements if it is based on a shape,

View File

@ -47,4 +47,6 @@ for this operation.</li>
\image html image160.gif "Example of a compound of two meshed cubes"
<b>See Also</b> a sample
\ref tui_building_compound "TUI Example of building compounds."
*/

View File

@ -126,7 +126,7 @@ visualizing the geometrical entity that causes it.
\image html failed_computation.png "Example of the invalid input mesh"
\Note Mesh Computation Information box does not appear if you set
\note Mesh Computation Information box does not appear if you set
"Mesh computation/Show a computation result notification" preference
to the "Never" value. This option gives the possibility to control mesh
computation reporting. There are the following possibilities: always

View File

@ -37,4 +37,6 @@ The following dialog box will appear:
<li>Click the \b Apply or \b OK button.</li>
</ol>
<br><b>See Also</b> a sample TUI Script of a \ref tui_quadratic "Convert to/from quadratic" operation.
*/

View File

@ -2,7 +2,7 @@
\page editing_groups_page Editing groups
\n <em>To edit an existing group of elements:</em>
<em>To edit an existing group of elements:</em>
<ol>
<li>Select your group in the Object Browser and in the \b Mesh menu click
the <b>Edit Group</b> item or <em>"Edit Group"</em> button in the toolbar.</li>
@ -17,11 +17,12 @@ The following dialog box will appear:
In this dialog box you can modify the name of your group and add or
remove the elements forming it. For more information see
\ref creating_groups_page "Creating Groups" page.
<li>Click the \b Apply or <b>Apply and Close</b> button to confirm modification of the
group.</li>
</ol>
\n <em>To convert an existing group on geometry into standalone group
<em>To convert an existing group on geometry into standalone group
of elements and modify:</em>
<ol>
<li>Select your group on geometry in the Object Browser and in the \b Mesh menu click
@ -31,11 +32,12 @@ the <b>Edit Group as Standalone</b> item.</li>
<center><em>"Edit Group as Standalone" button</em></center>
The group on geometry will be converted into standalone group and can
be modified as group of elements
be modified as group of elements.
<li>Click the \b Apply or <b>Apply and Close</b> button to confirm modification of the
group.</li>
</ol>
<br><b>See Also</b> a sample TUI Script of an
\ref tui_edit_group "Edit Group" operation.
\sa A sample TUI Script of an \ref tui_edit_group "Edit Group" operation.
*/

View File

@ -2,16 +2,17 @@
\page free_faces_page Free faces
\n This mesh quality control highlights the faces connected to
This mesh quality control highlights the faces connected to
less than two mesh volume elements. The free faces are shown with a
color different from the color of shared faces.
\image html free_faces.png
<center>In this picture some volume mesh elements have been removed, as
In this picture some volume mesh elements have been removed, as
a result some faces became connected only to one
volume. i.e. became free.
<br><b>See Also</b> a sample TUI Script of a
\ref tui_free_faces "Free Faces quality control" operation.
\sa A sample TUI Script of a \ref tui_free_faces "Free Faces quality control"
operation.
*/

View File

@ -2,14 +2,15 @@
\page free_nodes_page Free nodes
\n This mesh quality control highlights the nodes which are not connected
This mesh quality control highlights the nodes which are not connected
to any mesh element.
\image html free_nodes.png
<center>In this picture some nodes are not connected to any mesh
In this picture some nodes are not connected to any mesh
element after deleting some elements and adding several isolated nodes.
<br><b>See Also</b> a sample TUI Script of a
\ref tui_free_nodes "Free Nodes quality control" operation.
\sa A sample TUI Script of a \ref tui_free_nodes "Free Nodes quality control"
operation.
*/

View File

@ -5,6 +5,8 @@
\n GHS3D Parameters hypothesis works only with <b>Tetrahedron (GHS3D)</b>
algorithm. This algorithm is a commercial software.
<h1>General parameters</h1>
\image html ghs3d_parameters_basic.png
<ul>
@ -21,6 +23,8 @@ optimization level: none, light, medium or strong. Higher level of
optimisation provides better mesh, but can be time-consuming.
</li>
<h1>Advanced parameters</h1>
\image html ghs3d_parameters_advanced.png
<li><b>Maximum memory size</b> - launches ghs3d software with
@ -52,6 +56,20 @@ together with the characteristics of the final mesh.
<li><b>To create new nodes</b> - if this option is checked off, ghs3d
tries to create tetrahedrons using only the nodes of the 2D mesh.</li>
<li><b>To remove the initial central point</b> TetMesh-GHS3D adds an internal point
at the gravity centre of the bounding box to speed up and to simplify
the meshing process. However, it is possible to refrain from creating
this point by using the command line option -no initial central point. This can be
particularly useful to generate a volume mesh without internal points at all and in some rare cases
at the boundary regeneration phase when it is impossible to proceed
with the standard options
(for example, when one dimension of the domain is more than 20 times greater than the other two).
Use this option if the boundary regeneration has failed with the standard parameters and before using
the recovery version (command line option -C).
Note: when using this option, the speed of the meshing process may
decrease, and the quality may change.
Note: the boundary regeneration may fail with this option, in some rare cases.</li>
<li><b>To use boundary recovery version</b> - enables using a
boundary recovery module which tries to
create volume meshes starting from very poor quality surface meshes
@ -61,9 +79,38 @@ resulting volume mesh will however most likely have a very poor
quality (poor aspect ratio of elements, tetrahedra with a very small
positive volume).</li>
<li><b>Option as text</b> - allows input of any text as command line
for ghs3d. This allows the input of advanced options in a free from. </li>
<li><b>To use FEM correction</b> - Applies finite-element correction by
replacing overconstrained elements where it is possible. At first the process
slices the overconstrained edges and at second the overconstrained
facets. This ensures that there are no edges with two boundary
vertices and that there are no facets with three boundary vertices. TetMesh-GHS3D gives the initial
and final overconstrained edges and facets. It also gives the facets
which have three edges on the boundary.
Note: when using this option, the speed of the meshing process may
decrease, quality may change, and the smallest volume may be smaller.
By default, the FEM correction is not used.</li>
<li><b>Option as text</b> - allows to input in the command line any text
for ghs3d, for example, advanced options. </li>
</ul>
<h1>Enforced vertices</h1>
\image html ghs3d_enforced_vertices.png
GHS3D algorithm can locally make the mesh finer. It is possible to define enforced vertices in the volume where the mesh will be detailed.
A node will be created at the enforced vertex coordinates. There is no need to create a vertex in CAD.
An enforced vertex is defined by:
<ul>
<li>The (x,y,z) cartesian coordinates</li>
<li>A constant physical size</li>
</ul>
<br><b>See Also</b> a sample TUI Script of the \ref tui_ghs3d "creation of a Ghs3D hypothesis", including enforced vertices.
*/

View File

@ -12,19 +12,15 @@ dialog.</li>
<li> by creating a group of elements of the selected type from all
such elements of the chosen geometrical object - <b>Group on
geometry</b> tab of \ref creating_groups_page "Create group" dialog.</li>
<li> by creating a group including all types of elements from an
existing geometrical object - using \subpage create_groups_from_geometry_page "Create Groups from Geometry" dialog.</li>
<li> by creating several groups of elements (nodes,
edges, faces and volumes) from the chosen submesh - using <b>Mesh -> Construct
Group</b> Menu item. In this case groups of elements are created
automatically.</li>
<li> by creating groups of entities from existing groups of superior
dimensions - using \subpage group_of_underlying_elements_page "Create Group of Underlying Elements"
dialog.</li>
</ul>
@ -32,12 +28,12 @@ The created groups can be later:
<ul>
<li>\subpage editing_groups_page "Edited"</li>
<li>\subpage using_operations_on_groups_page "Subjected to Boolean operations", or</li>
<li>\subpage using_operations_on_groups_page "Subjected to Boolean operations"</li>
<li>\subpage deleting_groups_page "Deleted"</li>
</ul>
An important tool, providing filters for creation of \b Standalone
groups is \subpage selection_filter_library_page</li>.
groups is \subpage selection_filter_library_page.
*/

View File

@ -0,0 +1,22 @@
/*!
\page make_2dmesh_from_3d_page Generate the skin elements (2D) of a mesh having 3D elements
\n This functionality allows to generate 2D mesh elements as a skin
on the existing 3D mesh elements.
<em>To generate 2D mesh:</em>
<ol>
<li>From the Modification menu choose "Create 2D mesh from 3D"
item, or choose from the popup menu.
\image html 2d_from_3d_menu.png
The algorithm detects boundary volume faces without connections to
other volumes and creates 2D mesh elements on face nodes. If the mesh
already contains 2D elements on the detected nodes, new elements are not
created. The the resulting dialog shows mesh information statistics
about the newly created 2D mesh elements.
</ol>
*/

View File

@ -44,11 +44,6 @@ The following information will be displayed:
\image html advanced_mesh_infos.png
In case you get Mesh Infos via a \ref tui_viewing_mesh_infos "TUI script",
the information is displayed in Python Console.
\image html b-mesh_infos.png
<br>
\anchor mesh_element_info_anchor
<h2>Mesh Element Info</h2>
@ -61,4 +56,7 @@ the Viewer.
\image html eleminfo2.png
In case you get Mesh Infos via a TUI script the information is displayed in Python Console.
<b>See the</b> \ref tui_viewing_mesh_infos "TUI Example",
*/

View File

@ -45,6 +45,8 @@ of the selected node or edge.</li>
<li>Apply \subpage pattern_mapping_page "pattern mapping".</li>
<li>\subpage convert_to_from_quadratic_mesh_page "Convert regular mesh to quadratic",
or vice versa.</li>
<li>\subpage make_2dmesh_from_3d_page "Create 2D mesh from 3D".</li>
</ul>
\note It is possible to use the variables defined in the SALOME \b NoteBook

View File

@ -2,7 +2,7 @@
\page netgen_2d_3d_hypo_page Netgen 2D and 3D hypotheses
\n <b>Netgen 2D</b> and <b>Netgen 3D</b> hypotheses work only with <b>Netgen 1D-2D</b> and
<b>Netgen 2D</b> and <b>Netgen 3D</b> hypotheses work only with <b>Netgen 1D-2D</b> and
<b>Netgen 1D-2D-3D</b> algorithms. These algorithms do not require
definition of lower-level hypotheses and algorithms (2D and 1D for
meshing 3D objects and 1D for meshing 2D objects). They prove to be
@ -11,68 +11,64 @@ of the meshed object.
\image html netgen2d.png
<ul>
<li><b>Name</b> - allows to define the name for the algorithm (Netgen
2D (or 3D) Parameters by default).</li>
<li><b>Max Size</b> - maximum linear dimensions for mesh cells.</li>
<li><b>Second Order</b> - if this box is checked in, the algorithm will
- <b>Name</b> - allows to define the name for the algorithm (Netgen
2D (or 3D) Parameters by default).
- <b>Max Size</b> - maximum linear dimensions for mesh cells.
- <b>Second Order</b> - if this box is checked in, the algorithm will
create second order nodes on the mesh, which actually will become
\ref adding_quadratic_elements_page "Quadratic".</li>
<li><b>Fineness</b> - ranging from Very Coarse to Very Fine allows to set the
\ref adding_quadratic_elements_page "Quadratic".
- <b>Fineness</b> - ranging from Very Coarse to Very Fine allows to set the
level of meshing detalization using the three parameters below. You
can select Custom to define them manually.</li>
<li><b>Growth rate</b> - allows to define how much the linear dimensions of
two adjacent cells can differ (i.e. 0.3 means 30%).</li>
<li><b>Nb. Segs per Edge</b> and <b>Nb Segs per Radius</b> - allows to define the
can select Custom to define them manually.
- <b>Growth rate</b> - allows to define how much the linear dimensions of
two adjacent cells can differ (i.e. 0.3 means 30%).
- <b>Nb. Segs per Edge</b> and <b>Nb Segs per Radius</b> - allows to define the
minimum number of mesh segments in which edges and radiuses will be
split.</li>
<li><b>Allow Quadrangles</b> - allows to use quadrangle elements in a
split.
- <b>Allow Quadrangles</b> - allows to use quadrangle elements in a
triangle 2D mesh. This checkbox is not present in Netgen 3D parameters
because currently building a tetrahedral mesh with quadrangle faces is
not possible.</li>
<li><b>Optimize</b> - if this box is checked in, the algorithm will try to
create regular (possessing even sides) elements.</li>
</ul>
not possible.
- <b>Optimize</b> - if this box is checked in, the algorithm will try to
create regular (possessing even sides) elements.
\image html netgen3d_simple.png
<b>Netgen 2D simple parameters</b> and <b>Netgen 3D simple parameters</b> allow defining the size of elements for each dimension. <br>
<b>Netgen 2D simple parameters</b> and <b>Netgen 3D simple
parameters</b> allow defining the size of elements for each
dimension.
\b 1D group allows defining the size of 1D elements in either of two ways:
<ul>
<li><b>Number of Segments</b> has the same sense as \ref
- <b>Number of Segments</b> has the same sense as \ref
number_of_segments_anchor "Number of segments" hypothesis with
equidistant distribution.</li>
<li><b>Average Length</b> has the same sense as \ref
average_length_anchor "Average Length" hypothesis.</li>
</ul>
equidistant distribution.
- <b>Average Length</b> has the same sense as \ref
average_length_anchor "Average Length" hypothesis.
\b 2D group allows defining the size of 2D elements
<ul>
<li><b>Length from edges</b> if checked in, acts like \ref
length_from_edges_anchor "Length from Edges" hypothesis, else </li>
<li><b>Max. Element Area</b> defines the maximum element area like \ref
max_element_area_anchor "Max Element Area" hypothesis. </li>
</ul>
- <b>Length from edges</b> if checked in, acts like \ref
length_from_edges_anchor "Length from Edges" hypothesis, else
- <b>Max. Element Area</b> defines the maximum element area like \ref
max_element_area_anchor "Max Element Area" hypothesis.
\b 3D groups allows defining the size of 3D elements.
<ul>
<li><b>Length from faces</b> if checked in, the area of sides of
volumic elements will be equal to an average area of 2D elements, else </li>
<li><b>Max. Element Volume</b> defines the maximum element volume like
- <b>Length from faces</b> if checked in, the area of sides of
volumic elements will be equal to an average area of 2D elements, else
- <b>Max. Element Volume</b> defines the maximum element volume like
\ref max_element_volume_hypo_page "Max Element Volume"
hypothesis.</li>
<ul>
hypothesis.
\n Note that Netgen algorithm does not strictly follow the input
parameters. The actual mesh can be more or less dense than required. There are several factors in it:
<ol>
<li> NETGEN does not actually use "NbOfSegments" parameter for discretization of
edge. This parameter is used only to define the local element size (size at the given point), so local sizes of adjacent edges influence each other. </li>
<li> NETGEN additionally restricts the element size according to edge curvature.</li>
<li> The local size of edges influences the size of close triangles.</li>
<li> The order of elements and their size in the 1D mesh generated by
\note Netgen algorithm does not strictly follow the input
parameters. The actual mesh can be more or less dense than
required. There are several factors in it:
- NETGEN does not actually use "NbOfSegments" parameter for discretization of
edge. This parameter is used only to define the local element size
(size at the given point), so local sizes of adjacent edges influence
each other.
- NETGEN additionally restricts the element size according to edge curvature.
- The local size of edges influences the size of close triangles.
- The order of elements and their size in the 1D mesh generated by
NETGEN differ from those in the 1D mesh generated by Regular_1D
algorithm, resulting in different 2D and 3D meshes.</li>
</ol>
algorithm, resulting in different 2D and 3D meshes.
*/

View File

@ -4,9 +4,9 @@
3D extrusion algorithm can be used for meshing prisms, i.e. <b>3D Shapes</b>
defined by two opposing faces having the same number of vertices and
edges and meshed using the \ref projection_algos_page "2D Projection"
algorithm. These two faces should be connected by quadrangle "side"
faces.
edges and meshed using, for example, the \ref projection_algos_page
"2D Projection" algorithm. These two faces should be connected by
quadrangle "side" faces.
The opposing faces can be meshed with either quadrangles or triangles,
while the side faces should be meshed with quadrangles only.
@ -17,4 +17,8 @@ As you can see, the <b>3D extrusion</b> algorithm permits to build and to
have in the same 3D mesh such elements as hexahedrons, prisms and
polyhedrons.
\note This algorithm works correctly only if the opposing faces have
the same (or similar) meshing topography. Otherwise, 3D extrusion
algorithm can fail to build mesh volumes.
*/

View File

@ -2,27 +2,21 @@
\page radial_quadrangle_1D2D_algo_page Radial Quadrangle 1D2D
\n This algorithm applies to the meshing of a 2D shapes.
Required conditions: Face must be a full circle or part of circle
(i.e. number of edges <= 3 and one of them must be a circle curve).
The resulting mesh consists of triangles (near center point) and
\n This algorithm applies to the meshing of 2D shapes under the
following conditions: the face must be a full circle or a part of circle
(i.e. the number of edges is less or equal to 3 and one of them is a circle curve).
The resulting mesh consists of triangles (near the center point) and
quadrangles.
This algorithm also requires the information concerning the number and
distribution of mesh layers alond a radius of circle. Distribution of
layers can be set with any of 1D Hypotheses.
Creation hypothesis:
This algorithm requires the hypothesis indicating the number
of mesh layers along the radius. The distribution of layers can be set with any 1D Hypothesis.
\image html hypo_radquad_dlg.png
Resulting 3D mesh for the cylinder with <b>RadialQuadrangle_1D2D</b>
hypothesis for top and bottom faces:
\image html mesh_radquad_01.png "Radial Quadrangle 2D mesh on the top and the bottom faces of a cylinder"
\image html mesh_radquad_01.png
\image html mesh_radquad_02.png "Radial Quadrangle 2D mesh on a part of circle"
Resulting 2D mesh for the part of circle:
\image html mesh_radquad_02.png
\sa A sample \ref tui_radial_quadrangle "TUI Script".
*/

View File

@ -2,129 +2,140 @@
\page smeshpy_interface_page Python interface
\n Python package smesh defines several classes, destined for easy and
Python package smesh defines several classes, destined for easy and
clear mesh creation and edition.
\n Documentation for smesh package is available in two forms:
Documentation for smesh package is available in two forms:
\n The <a href="smeshpy_doc/modules.html"> structured
documentation for smesh package</a>, where all methods and
classes are grouped by their functionality, like it is done in the GUI documentation
\n and the \ref smeshDC "linear documentation for smesh package"
grouped only by classes, declared in the smesh.py file.
The <a href="smeshpy_doc/modules.html"> structured
documentation for smesh package</a>, where all methods and
classes are grouped by their functionality, like it is done in the GUI documentation
and the \ref smeshDC "linear documentation for smesh package"
grouped only by classes, declared in the smesh.py file.
\n The main page of the \ref smeshDC "linear documentation for smesh package"
contains a list of data structures and a list of
functions, provided by the package smesh.py. The first item in
the list of data structures (\ref smeshDC::smeshDC "class smesh")
also represents documentation for the methods of the package smesh.py itself.
The main page of the \ref smeshDC "linear documentation for smesh package"
contains a list of data structures and a list of
functions, provided by the package smesh.py. The first item in
the list of data structures (\ref smeshDC::smeshDC "class smesh")
also represents documentation for the methods of the package smesh.py itself.
\n The package smesh.py provides an interface to create and handle
meshes. Use it to create an empty mesh or to import it from the data file.
The package smesh.py provides an interface to create and handle
meshes. Use it to create an empty mesh or to import it from the data file.
\n Once a mesh has been created, it is possible to manage it via its own
methods, described at \ref smeshDC::Mesh "class Mesh" documentation
(it is also accessible by the second item "class Mesh" in the list of data structures).
Once a mesh has been created, it is possible to manage it via its own
methods, described at \ref smeshDC::Mesh "class Mesh" documentation
(it is also accessible by the second item "class Mesh" in the list of data structures).
\n Class Mesh allows assigning algorithms to a mesh.
\n Please note, that some algorithms,
included in the standard Salome installation are always available:
- REGULAR(1D), COMPOSITE(1D), MEFISTO(2D), Quadrangle(2D), Hexa(3D), etc.
Class \b Mesh allows assigning algorithms to a mesh.
Please note, that some algorithms, included in the standard SALOME
distribution are always available:
- REGULAR (1D)
- COMPOSITE (1D)
- MEFISTO (2D)
- Quadrangle (2D)
- Hexa(3D)
- etc...
\n There are also some algorithms, which can be installed optionally,
\n some of them are based on open-source meshers:
- NETGEN(1D-2D,2D,1D-2D-3D,3D),
There are also some algorithms, which can be installed optionally,
some of them are based on open-source meshers:
- NETGEN (1D-2D, 2D, 1D-2D-3D, 3D)
\n others are based on commercial meshers:
- GHS3D(3D), BLSURF(2D).
... and others are based on commercial meshers:
- GHS3D (3D)
- BLSURF (2D)
\n To add hypotheses, use the interfaces, provided by the assigned
To add hypotheses, use the interfaces, provided by the assigned
algorithms.
\n Below you can see an example of usage of the package smesh for 3d mesh generation.
Below you can see an example of usage of the package smesh for 3d mesh generation.
\anchor example_3d_mesh
<h2>Example of 3d mesh generation with NETGEN:</h2>
\n from geompy import *
\n import smesh
\code
from geompy import *
import smesh
<b># Geometry</b>
\n <b># an assembly of a box, a cylinder and a truncated cone meshed with tetrahedral</b>.
###
# Geometry: an assembly of a box, a cylinder and a truncated cone
# meshed with tetrahedral
###
<b># Define values</b>
\n name = "ex21_lamp"
\n cote = 60
\n section = 20
\n size = 200
\n radius_1 = 80
\n radius_2 = 40
\n height = 100
# Define values
name = "ex21_lamp"
cote = 60
section = 20
size = 200
radius_1 = 80
radius_2 = 40
height = 100
<b># Build a box</b>
\n box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
# Build a box
box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
<b># Build a cylinder</b>
\n pt1 = MakeVertex(0, 0, cote/3)
\n di1 = MakeVectorDXDYDZ(0, 0, 1)
\n cyl = MakeCylinder(pt1, di1, section, size)
# Build a cylinder
pt1 = MakeVertex(0, 0, cote/3)
di1 = MakeVectorDXDYDZ(0, 0, 1)
cyl = MakeCylinder(pt1, di1, section, size)
<b># Build a truncated cone</b>
\n pt2 = MakeVertex(0, 0, size)
\n cone = MakeCone(pt2, di1, radius_1, radius_2, height)
# Build a truncated cone
pt2 = MakeVertex(0, 0, size)
cone = MakeCone(pt2, di1, radius_1, radius_2, height)
<b># Fuse </b>
\n box_cyl = MakeFuse(box, cyl)
\n piece = MakeFuse(box_cyl, cone)
# Fuse
box_cyl = MakeFuse(box, cyl)
piece = MakeFuse(box_cyl, cone)
<b># Add in study</b>
\n addToStudy(piece, name)
# Add to the study
addToStudy(piece, name)
<b># Create a group of faces</b>
\n group = CreateGroup(piece, ShapeType["FACE"])
\n group_name = name + "_grp"
\n addToStudy(group, group_name)
\n group.SetName(group_name)
# Create a group of faces
group = CreateGroup(piece, ShapeType["FACE"])
group_name = name + "_grp"
addToStudy(group, group_name)
group.SetName(group_name)
<b># Add faces in the group</b>
\n faces = SubShapeAllIDs(piece, ShapeType["FACE"])
\n UnionIDs(group, faces)
# Add faces to the group
faces = SubShapeAllIDs(piece, ShapeType["FACE"])
UnionIDs(group, faces)
<b># Create a mesh</b>
###
# Create a mesh
###
<b># Define a mesh on a geometry</b>
\n tetra = smesh.Mesh(piece, name)
# Define a mesh on a geometry
tetra = smesh.Mesh(piece, name)
<b># Define 1D hypothesis</b>
\n algo1d = tetra.Segment()
\n algo1d.LocalLength(10)
# Define 1D hypothesis
algo1d = tetra.Segment()
algo1d.LocalLength(10)
<b># Define 2D hypothesis</b>
\n algo2d = tetra.Triangle()
\n algo2d.LengthFromEdges()
# Define 2D hypothesis
algo2d = tetra.Triangle()
algo2d.LengthFromEdges()
<b># Define 3D hypothesis</b>
\n algo3d = tetra.Tetrahedron(smesh.NETGEN)
\n algo3d.MaxElementVolume(100)
# Define 3D hypothesis
algo3d = tetra.Tetrahedron(smesh.NETGEN)
algo3d.MaxElementVolume(100)
<b># Compute the mesh</b>
\n tetra.Compute()
# Compute the mesh
tetra.Compute()
<b># Create a groupe of faces</b>
\n tetra.Group(group)
# Create a groupe of faces
tetra.Group(group)
\n Examples of Python scripts for all Mesh operations are available by
\endcode
Examples of Python scripts for all Mesh operations are available by
the following links:
<ul>
<li>\subpage tui_creating_meshes_page</li>
<li>\subpage tui_viewing_meshes_page</li>
<li>\subpage tui_defining_hypotheses_page</li>
<li>\subpage tui_quality_controls_page</li>
<li>\subpage tui_grouping_elements_page</li>
<li>\subpage tui_modifying_meshes_page</li>
<li>\subpage tui_transforming_meshes_page</li>
<li>\subpage tui_notebook_smesh_page</li>
</ul>
- \subpage tui_creating_meshes_page
- \subpage tui_viewing_meshes_page
- \subpage tui_defining_hypotheses_page
- \subpage tui_quality_controls_page
- \subpage tui_grouping_elements_page
- \subpage tui_modifying_meshes_page
- \subpage tui_transforming_meshes_page
- \subpage tui_notebook_smesh_page
*/

View File

@ -64,13 +64,9 @@ name in the adjacent box);</li>
</ul>
</li>
<li>Click \b Apply or <b> Apply and Close</b> button to confirm the
operation.</li>
<li>Click \b Apply or <b> Apply and Close</b> button to confirm the operation.</li>
</ol>
<br><b>See Also</b> a sample TUI Script of a
\ref tui_translation "Translation" operation.
<br><b>See Also</b> a sample TUI Script of a \ref tui_translation "Translation" operation.
*/

View File

@ -2,7 +2,7 @@
\page tui_creating_meshes_page Creating Meshes
\n First of all see \ref introduction_to_mesh_python_page "Example of 3d mesh generation",
\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>

View File

@ -19,6 +19,11 @@ Face_1 = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0]
Edge_1 = geompy.SubShapeAllSorted(box, geompy.ShapeType["EDGE"])[0]
Vertex_1 = geompy.SubShapeAllSorted(box, geompy.ShapeType["VERTEX"])[0]
# /!\ Geom object with sizemaps on them must be published in study
geompy.addToStudyInFather(box,Face_1, "Face_1")
geompy.addToStudyInFather(box,Edge_1, "Edge_1")
geompy.addToStudyInFather(box,Vertex_1, "Vertex_1")
# create a mesh on the box
blsurfMesh = smesh.Mesh(box,"box: BLSurf mesh")
@ -43,6 +48,39 @@ BLSURF_Parameters.SetSizeMap(Vertex_1, 'def f(): return 2' )
# compute the mesh
blsurfMesh.Compute()
# Add enforced vertex for Face_1 on (50, 50, 50)
# The projection coordinates will be (50, 50, 0)
BLSURF_Parameters.SetEnforcedVertex(Face_1, 50, 50, 50)
# Add another enforced vertex on (150, 150, 150)
BLSURF_Parameters.SetEnforcedVertex(Face_1, 150, 150, 150)
# Retrieve and print the list of enforced vertices defines on Face_1
enfList = BLSURF_Parameters.GetEnforcedVertices(Face_1)
print "List of enforced vertices for Face_1: "
print enfList
# compute the mesh
blsurfMesh.Compute()
# Remove an enforced vertex and print the list
BLSURF_Parameters.UnsetEnforcedVertex(Face_1, 50, 50, 50)
enfList = BLSURF_Parameters.GetEnforcedVertices(Face_1)
print "List of enforced vertices for Face_1: "
print enfList
# compute the mesh
blsurfMesh.Compute()
# Remove all enforced vertices defined on Face_1
BLSURF_Parameters.UnsetEnforcedVertices(Face_1)
# compute the mesh
blsurfMesh.Compute()
# End of script
\endcode
*/

View File

@ -0,0 +1,45 @@
/*!
\page tui_defining_ghs3d_hypotheses_page Defining Hypotheses for Ghs3D Algorithm
\anchor tui_ghs3d
<h2>Construction of Mesh using Ghs3D algorithm</h2>
\code
import geompy
import smesh
import BLSURFPlugin
import GHS3DPlugin
# create a box
box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
geompy.addToStudy(box, "box")
# create a mesh on the box
ghs3dMesh = smesh.Mesh(box,"box: Ghs3D and BLSurf mesh")
# create a BLSurf algorithm for faces
BLSURF = ghs3dMesh.Triangle(algo=smesh.BLSURF)
# create a Ghs3D algorithm for volume
GHS3D = ghs3dMesh.Tetrahedron(algo=smesh.GHS3D)
# get Ghs3D algorithm hypothesis
GHS3D_Parameters = GHS3D.Parameters()
# define an enforced vertex at (50,50,100) with a physical size of 2
GHS3D_Parameters.SetEnforcedVertex( 50, 50, 100, 2 )
# define an enforced vertex at (150,150,100) with a physical size of 5
GHS3D_Parameters.SetEnforcedVertex( 150, 150, 100, 5 )
# compute the mesh
ghs3dMesh.Compute()
# End of script
\endcode
\image html ghs3d_enforced_vertices_screenshot.png
*/

View File

@ -468,9 +468,83 @@ src_mesh.TranslateObject( src_mesh, MakeDirStruct( 210, 0, 0 ), Copy=False)
\endcode
<br>
\anchor tui_fixed_points
<h2>1D Mesh with Fixed Points example</h2>
\code
import salome
import geompy
import smesh
import StdMeshers
# Create face and explode it on edges
face = geompy.MakeFaceHW(100, 100, 1)
edges = geompy.SubShapeAllSorted(face, geompy.ShapeType["EDGE"])
geompy.addToStudy( face, "Face" )
# get the first edge from exploded result
edge1 = geompy.GetSubShapeID(face, edges[0])
# Define Mesh on previously created face
Mesh_1 = smesh.Mesh(face)
# Create Fixed Point 1D hypothesis and define parameters.
# Note: values greater than 1.0 and less than 0.0 are not taken into account;
# duplicated values are removed. Also, if not specified explicitly, values 0.0 and 1.0
# add added automatically.
# The number of segments should correspond to the number of points (NbSeg = NbPnt-1);
# extra values of segments splitting parameter are not taken into account,
# while missing values are considered to be equal to 1.
Fixed_points_1D_1 = smesh.CreateHypothesis('FixedPoints1D')
Fixed_points_1D_1.SetPoints( [ 1.1, 0.9, 0.5, 0.0, 0.5, -0.3 ] )
Fixed_points_1D_1.SetNbSegments( [ 3, 1, 2 ] )
Fixed_points_1D_1.SetReversedEdges( [edge1] )
# Add hypothesis to mesh and define 2D parameters
Mesh_1.AddHypothesis(Fixed_points_1D_1)
Regular_1D = Mesh_1.Segment()
Quadrangle_2D = Mesh_1.Quadrangle()
# Compute mesh
Mesh_1.Compute()
\endcode
\anchor tui_radial_quadrangle
<h2> Radial Quadrangle 1D2D example </h2>
\code
import salome
import geompy
import smesh
import StdMeshers
# Create face from the wire and add to study
WirePath = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WW", [0, 0, 0, 1, 0, 0, 0, 0, 1])
Face = geompy.MakeFace(WirePath,1)
geompy.addToStudy(Face,"Face")
# Define geometry for mesh, and 1D parameters
mesh = smesh.Mesh(Face)
Wire_discretisation = mesh.Segment()
Nb_Segments = Wire_discretisation.NumberOfSegments(5)
Nb_Segments.SetDistrType( 0 )
# Define 2D parameters and Radial Quadrange hypothesis
Number_of_Layers = smesh.CreateHypothesis('NumberOfLayers2D')
Number_of_Layers.SetNumberOfLayers( 4 )
mesh.AddHypothesis(Number_of_Layers)
RadialQuadrangle_1D2D = smesh.CreateHypothesis('RadialQuadrangle_1D2D')
mesh.AddHypothesis(RadialQuadrangle_1D2D)
mesh.Compute()
\endcode
\n Other meshing algorithms:
<ul>
<li>\subpage tui_defining_blsurf_hypotheses_page</li>
<li>\subpage tui_defining_ghs3d_hypotheses_page</li>
</ul>
*/

View File

@ -1,4 +1,4 @@
/*!
/*!
\page tui_grouping_elements_page Grouping Elements
@ -318,10 +318,10 @@ salome.sg.updateObjBrowser(1)
\endcode
\image html dimgroup_tui1.png
<center>Source groups of faces<\center>
<center>Source groups of faces</center>
\image html dimgroup_tui2.png
<center>Result groups of edges and nodes<\center>
<center>Result groups of edges and nodes</center>

View File

@ -815,4 +815,48 @@ isDone = pattern.MakeMesh(Mesh_1.GetMesh(), 0, 0)
if (isDone != 1): print 'MakeMesh :', pattern.GetErrorCode()
\endcode
<br>
\anchor tui_quadratic
<h2>Convert mesh to/from quadratic</h2>
\code
import geompy
import smesh
# create sphere of radius 100
Sphere = geompy.MakeSphereR( 100 )
geompy.addToStudy( Sphere, "Sphere" )
# create simple trihedral mesh
Mesh = smesh.Mesh(Sphere)
Regular_1D = Mesh.Segment()
Nb_Segments = Regular_1D.NumberOfSegments(5)
MEFISTO_2D = Mesh.Triangle()
Tetrahedron_Netgen = Mesh.Tetrahedron(algo=smesh.NETGEN)
# compute mesh
isDone = Mesh.Compute()
# convert to quadratic
# theForce3d = 1; this results in the medium node lying at the
# middle of the line segments connecting start and end node of a mesh
# element
Mesh.ConvertToQuadratic( theForce3d=1 )
# revert back to the non-quadratic mesh
Mesh.ConvertFromQuadratic()
# convert to quadratic
# theForce3d = 0; this results in the medium node lying at the
# geometrical edge from which the mesh element is built
Mesh.ConvertToQuadratic( theForce3d=0 )
\endcode
*/

View File

@ -9,10 +9,12 @@
\code
import geompy
import smesh
import SMESH
# create a box
box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)
geompy.addToStudy(box, "box")
[Face_1,Face_2,Face_3,Face_4,Face_5,Face_5] = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
# create a mesh
tetra = smesh.Mesh(box, "MeshBox")
@ -26,10 +28,22 @@ algo2D.MaxElementArea(10.)
algo3D = tetra.Tetrahedron(smesh.NETGEN)
algo3D.MaxElementVolume(900.)
# Creation of SubMesh
Regular_1D_1_1 = tetra.Segment(geom=Face_1)
Nb_Segments_1 = Regular_1D_1_1.NumberOfSegments(5)
Nb_Segments_1.SetDistrType( 0 )
Quadrangle_2D = tetra.Quadrangle(geom=Face_1)
isDone = tetra.Compute()
submesh = Regular_1D_1_1.GetSubMesh()
# compute the mesh
tetra.Compute()
# print information about the mesh
# Creation of group
group = tetra.CreateEmptyGroup( SMESH.FACE, 'Group' )
nbAdd = group.Add( [ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76 ] )
# Print information about the mesh
print "Information about mesh:"
print "Number of nodes : ", tetra.NbNodes()
print "Number of edges : ", tetra.NbEdges()
@ -43,5 +57,30 @@ print " hexahedrons : ", tetra.NbHexas()
print " prisms : ", tetra.NbPrisms()
print " pyramids : ", tetra.NbPyramids()
print " polyhedrons : ", tetra.NbPolyhedrons()
# Get Information About Mesh by GetMeshInfo
print "\nInformation about mesh by GetMeshInfo:"
info = smesh.GetMeshInfo(tetra)
keys = info.keys(); keys.sort()
for i in keys:
print " %s : %d" % ( i, info[i] )
pass
# Get Information About Group by GetMeshInfo
print "\nInformation about group by GetMeshInfo:"
info = smesh.GetMeshInfo(group)
keys = info.keys(); keys.sort()
for i in keys:
print " %s : %d" % ( i, info[i] )
pass
# Get Information About SubMesh by GetMeshInfo
print "\nInformation about Submesh by GetMeshInfo:"
info = smesh.GetMeshInfo(submesh)
keys = info.keys(); keys.sort()
for i in keys:
print " %s : %d" % ( i, info[i] )
pass
\endcode
*/

View File

@ -38,7 +38,7 @@ meshes.</li>
<li>\subpage transparency_page "Transparency" - allows to change the
transparency of mesh elements.</li>
<li>\subpage clipping_page "Clipping" - allows to create cross-sections of the selected objects.</li>
<li>\ref about_quality_controls_page "Controls" - graphically
<li>\ref quality_page "Controls" - graphically
presents various information about meshes.</li>
<li><b>Hide</b> - allows to hide the selected mesh from the viewer.</li>
<li><b>Show Only</b> -allows to display only the selected mesh, hiding all other from the viewer.</li>

View File

@ -46,7 +46,6 @@ module SMESH
enum log_command
{
ADD_NODE,
ADD_ELEM0D,
ADD_EDGE,
ADD_TRIANGLE,
ADD_QUADRANGLE,
@ -69,7 +68,8 @@ module SMESH
ADD_QUADTETRAHEDRON,
ADD_QUADPYRAMID,
ADD_QUADPENTAHEDRON,
ADD_QUADHEXAHEDRON
ADD_QUADHEXAHEDRON,
ADD_ELEM0D
};
struct log_block

View File

@ -614,6 +614,18 @@ module SMESH
*/
long MoveClosestNodeToPoint(in double x, in double y, in double z, in long nodeID);
/*!
* Return ID of node closest to a given point
*/
long FindNodeClosestTo(in double x, in double y, in double z);
/*!
* Return elements of given type where the given point is IN or ON.
*
* 'ALL' type means elements of any type excluding nodes and 0D elements
*/
long_array FindElementsByPoint(in double x, in double y, in double z, in ElementType type);
enum Sew_Error {
SEW_OK,
SEW_BORDER1_NOT_FOUND,
@ -685,6 +697,49 @@ module SMESH
*/
long_array GetLastCreatedElems();
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \param theNodes - identifiers of nodes to be doubled
* \param theModifiedElems - identifiers of elements to be updated by the new (doubled)
* nodes. If list of element identifiers is empty then nodes are doubled but
* they not assigned to elements
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNode(), DoubleNodeGroup(), DoubleNodeGroups()
*/
boolean DoubleNodes( in long_array theNodes, in long_array theModifiedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* This method provided for convenience works as DoubleNodes() described above.
* \param theNodeId - identifier of node to be doubled.
* \param theModifiedElems - identifiers of elements to be updated.
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodes(), DoubleNodeGroup(), DoubleNodeGroups()
*/
boolean DoubleNode( in long theNodeId, in long_array theModifiedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* This method provided for convenience works as DoubleNodes() described above.
* \param theNodes - group of nodes to be doubled.
* \param theModifiedElems - group of elements to be updated.
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNode(), DoubleNodes(), DoubleNodeGroups()
*/
boolean DoubleNodeGroup( in SMESH_GroupBase theNodes,
in SMESH_GroupBase theModifiedElems );
/*!
\brief Creates a hole in a mesh by doubling the nodes of some particular elements
This method provided for convenience works as DoubleNodes() described above.
\param theNodes - list of groups of nodes to be doubled
\param theModifiedElems - list of groups of elements to be updated.
\return TRUE if operation has been completed successfully, FALSE otherwise
\sa DoubleNode(), DoubleNodeGroup(), DoubleNodes()
*/
boolean DoubleNodeGroups( in ListOfGroups theNodes,
in ListOfGroups theModifiedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \param theElems - the list of elements (edges or faces) to be replicated
@ -695,7 +750,7 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodeGroups()
*/
boolean DoubleNodes( in long_array theElems,
boolean DoubleNodeElem( in long_array theElems,
in long_array theNodesNot,
in long_array theAffectedElems );
@ -710,7 +765,7 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
*/
boolean DoubleNodesInRegion( in long_array theElems,
boolean DoubleNodeElemInRegion( in long_array theElems,
in long_array theNodesNot,
in GEOM::GEOM_Object theShape );
@ -724,7 +779,7 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodes(), DoubleNodeGroups()
*/
boolean DoubleNodeGroup( in SMESH_GroupBase theElems,
boolean DoubleNodeElemGroup( in SMESH_GroupBase theElems,
in SMESH_GroupBase theNodesNot,
in SMESH_GroupBase theAffectedElems );
@ -739,7 +794,7 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
*/
boolean DoubleNodeGroupInRegion( in SMESH_GroupBase theElems,
boolean DoubleNodeElemGroupInRegion( in SMESH_GroupBase theElems,
in SMESH_GroupBase theNodesNot,
in GEOM::GEOM_Object theShape );
@ -753,7 +808,7 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodes()
*/
boolean DoubleNodeGroups( in ListOfGroups theElems,
boolean DoubleNodeElemGroups( in ListOfGroups theElems,
in ListOfGroups theNodesNot,
in ListOfGroups theAffectedElems );
@ -768,10 +823,17 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
*/
boolean DoubleNodeGroupsInRegion( in ListOfGroups theElems,
boolean DoubleNodeElemGroupsInRegion( in ListOfGroups theElems,
in ListOfGroups theNodesNot,
in GEOM::GEOM_Object theShape );
/*!
* \brief Generated skin mesh (containing 2D cells) from 3D mesh
* The created 2D mesh elements based on nodes of free faces of boundary volumes
* \return TRUE if operation has been completed successfully, FALSE otherwise
*/
boolean Make2DMeshFrom3D();
};
};

View File

@ -165,6 +165,7 @@ dist_salomeres_DATA = \
mesh_tree_mesh_partial.png \
mesh_extractGroup.png \
mesh_precompute.png \
mesh_2d_from_3d.png \
mesh_free_faces.png
# VSR: little trick to avoid putting if SMESHCatalog.xml to the distribution archive

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

View File

@ -1938,8 +1938,10 @@ bool ElemGeomType::IsSatisfy( long theId )
{
if (!myMesh) return false;
const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
if ( !anElem )
return false;
const SMDSAbs_ElementType anElemType = anElem->GetType();
if ( !anElem || (myType != SMDSAbs_All && anElemType != myType) )
if ( myType != SMDSAbs_All && anElemType != myType )
return false;
const int aNbNode = anElem->NbNodes();
bool isOk = false;
@ -3254,31 +3256,54 @@ void ElementsOnShape::process (const SMDS_MeshElement* theElemPtr)
TSequenceOfXYZ::TSequenceOfXYZ()
{}
TSequenceOfXYZ::TSequenceOfXYZ(size_type n) : std::vector<gp_XYZ>(n)
TSequenceOfXYZ::TSequenceOfXYZ(size_type n) : myArray(n)
{}
TSequenceOfXYZ::TSequenceOfXYZ(size_type n, const value_type& t) : std::vector<gp_XYZ>(n,t)
TSequenceOfXYZ::TSequenceOfXYZ(size_type n, const gp_XYZ& t) : myArray(n,t)
{}
TSequenceOfXYZ::TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ) : std::vector<gp_XYZ>(theSequenceOfXYZ)
TSequenceOfXYZ::TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ) : myArray(theSequenceOfXYZ.myArray)
{}
template <class InputIterator>
TSequenceOfXYZ::TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd): std::vector<gp_XYZ>(theBegin,theEnd)
TSequenceOfXYZ::TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd): myArray(theBegin,theEnd)
{}
TSequenceOfXYZ::~TSequenceOfXYZ()
{}
TSequenceOfXYZ& TSequenceOfXYZ::operator=(const TSequenceOfXYZ& theSequenceOfXYZ)
{
std::vector<gp_XYZ>::operator=(theSequenceOfXYZ);
myArray = theSequenceOfXYZ.myArray;
return *this;
}
std::vector<gp_XYZ>::reference TSequenceOfXYZ::operator()(size_type n)
gp_XYZ& TSequenceOfXYZ::operator()(size_type n)
{
return std::vector<gp_XYZ>::operator[](n-1);
return myArray[n-1];
}
std::vector<gp_XYZ>::const_reference TSequenceOfXYZ::operator()(size_type n) const
const gp_XYZ& TSequenceOfXYZ::operator()(size_type n) const
{
return std::vector<gp_XYZ>::operator[](n-1);
return myArray[n-1];
}
void TSequenceOfXYZ::clear()
{
myArray.clear();
}
void TSequenceOfXYZ::reserve(size_type n)
{
myArray.reserve(n);
}
void TSequenceOfXYZ::push_back(const gp_XYZ& v)
{
myArray.push_back(v);
}
TSequenceOfXYZ::size_type TSequenceOfXYZ::size() const
{
return myArray.size();
}

View File

@ -68,30 +68,40 @@ class gp_Pnt;
namespace SMESH{
namespace Controls{
class SMESHCONTROLS_EXPORT TSequenceOfXYZ: public std::vector<gp_XYZ>
class SMESHCONTROLS_EXPORT TSequenceOfXYZ
{
typedef std::vector<gp_XYZ>::size_type size_type;
public:
TSequenceOfXYZ();
TSequenceOfXYZ(size_type n);
TSequenceOfXYZ(size_type n, const value_type& t);
TSequenceOfXYZ(size_type n, const gp_XYZ& t);
TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ);
template <class InputIterator>
TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd);
~TSequenceOfXYZ();
TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ);
reference operator()(size_type n);
gp_XYZ& operator()(size_type n);
const_reference operator()(size_type n) const;
const gp_XYZ& operator()(size_type n) const;
void clear();
void reserve(size_type n);
void push_back(const gp_XYZ& v);
size_type size() const;
private:
reference operator[](size_type n);
const_reference operator[](size_type n) const;
std::vector<gp_XYZ> myArray;
};
/*

View File

@ -26,10 +26,13 @@
#include "utilities.h"
#include <Basics_Utils.hxx>
using namespace std;
Driver_Mesh::Status DriverDAT_R_SMDS_Mesh::Perform()
{
Kernel_Utils::Localizer loc;
Status aResult = DRS_OK;
int i, j;

View File

@ -27,10 +27,13 @@
#include "utilities.h"
#include <Basics_Utils.hxx>
using namespace std;
Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
{
Kernel_Utils::Localizer loc;
Status aResult = DRS_OK;
int nbNodes, nbCells;

View File

@ -66,6 +66,7 @@ libMeshDriverDAT_la_CPPFLAGS = \
libMeshDriverDAT_la_LDFLAGS = \
../Driver/libMeshDriver.la \
$(KERNEL_LDFLAGS) -lSALOMEBasics \
$(CAS_KERNEL)
DAT_Test_CPPFLAGS = \

View File

@ -83,7 +83,7 @@ void
DriverMED_Family
::SetType(const SMDSAbs_ElementType theType)
{
myType = theType;
myTypes.insert( myType = theType );
}
SMDSAbs_ElementType
@ -93,6 +93,13 @@ DriverMED_Family
return myType;
}
const std::set< SMDSAbs_ElementType >&
DriverMED_Family
::GetTypes() const
{
return myTypes;
}
bool
DriverMED_Family
::MemberOf(std::string theGroupName) const

View File

@ -99,6 +99,7 @@ class MESHDRIVERMED_EXPORT DriverMED_Family
void SetType(const SMDSAbs_ElementType theType);
SMDSAbs_ElementType GetType();
const std::set< SMDSAbs_ElementType >& GetTypes() const;
bool MemberOf(std::string theGroupName) const;
@ -133,6 +134,7 @@ class MESHDRIVERMED_EXPORT DriverMED_Family
ElementsSet myElements;
MED::TStringSet myGroupNames;
int myGroupAttributVal;
std::set<SMDSAbs_ElementType> myTypes; // Issue 0020576
};
#endif

View File

@ -48,10 +48,11 @@ static int MYDEBUG = 0;
#define _EDF_NODE_IDS_
using namespace MED;
using namespace std;
void
DriverMED_R_SMESHDS_Mesh
::SetMeshName(std::string theMeshName)
::SetMeshName(string theMeshName)
{
myMeshName = theMeshName;
}
@ -60,7 +61,7 @@ static const SMDS_MeshNode*
FindNode(const SMDS_Mesh* theMesh, TInt theId){
const SMDS_MeshNode* aNode = theMesh->FindNode(theId);
if(aNode) return aNode;
EXCEPTION(std::runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
EXCEPTION(runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
}
@ -83,9 +84,9 @@ DriverMED_R_SMESHDS_Mesh
//---------------------
PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
std::string aMeshName;
string aMeshName;
if (myMeshId != -1) {
std::ostringstream aMeshNameStr;
ostringstream aMeshNameStr;
aMeshNameStr<<myMeshId;
aMeshName = aMeshNameStr.str();
} else {
@ -116,7 +117,7 @@ DriverMED_R_SMESHDS_Mesh
if(aFamilyInfo->GetNbAttr() == aNbGrp)
isAttrOk = true;
for (TInt iGr = 0; iGr < aNbGrp; iGr++) {
std::string aGroupName = aFamilyInfo->GetGroupName(iGr);
string aGroupName = aFamilyInfo->GetGroupName(iGr);
if(isAttrOk){
TInt anAttrVal = aFamilyInfo->GetAttrVal(iGr);
aFamily->SetGroupAttributVal(anAttrVal);
@ -225,7 +226,7 @@ DriverMED_R_SMESHDS_Mesh
anElement = myMesh->AddPolygonalFaceWithID(aNodeIds,anElemId);
}
if(!anElement){
std::vector<const SMDS_MeshNode*> aNodes(aNbConn);
vector<const SMDS_MeshNode*> aNodes(aNbConn);
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodes[iConn] = FindNode(myMesh,aNodeIds[iConn]);
anElement = myMesh->AddPolygonalFace(aNodes);
@ -298,7 +299,7 @@ DriverMED_R_SMESHDS_Mesh
anElement = myMesh->AddPolyhedralVolumeWithID(aNodeIds,aQuantities,anElemId);
}
if(!anElement){
std::vector<const SMDS_MeshNode*> aNodes(aNbNodes);
vector<const SMDS_MeshNode*> aNodes(aNbNodes);
for(TInt iConn = 0; iConn < aNbNodes; iConn++)
aNodes[iConn] = FindNode(myMesh,aNodeIds[iConn]);
anElement = myMesh->AddPolyhedralVolume(aNodes,aQuantities);
@ -336,7 +337,6 @@ DriverMED_R_SMESHDS_Mesh
if(MYDEBUG) MESSAGE("Perform - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum);
if(MYDEBUG) MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems);
for(int iElem = 0; iElem < aNbElems; iElem++){
TInt aNbNodes = -1;
switch(aGeom){
case eSEG2: aNbNodes = 2; break;
@ -356,7 +356,8 @@ DriverMED_R_SMESHDS_Mesh
case ePOINT1: aNbNodes = 1; break;
default:;
}
std::vector<TInt> aNodeIds(aNbNodes);
vector<TInt> aNodeIds(aNbNodes);
for(int iElem = 0; iElem < aNbElems; iElem++){
bool anIsValidConnect = false;
TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
#ifndef _DEXCEPT_
@ -736,9 +737,9 @@ DriverMED_R_SMESHDS_Mesh
return aResult;
}
std::list<std::string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
list<string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
{
std::list<std::string> aMeshNames;
list<string> aMeshNames;
try {
if(MYDEBUG) MESSAGE("GetMeshNames - myFile : " << myFile);
@ -764,26 +765,28 @@ std::list<std::string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
return aMeshNames;
}
std::list<TNameAndType> DriverMED_R_SMESHDS_Mesh::GetGroupNamesAndTypes()
list<TNameAndType> DriverMED_R_SMESHDS_Mesh::GetGroupNamesAndTypes()
{
std::list<TNameAndType> aResult;
std::set<TNameAndType> aResGroupNames;
list<TNameAndType> aResult;
set<TNameAndType> aResGroupNames;
std::map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
for (; aFamsIter != myFamilies.end(); aFamsIter++)
{
DriverMED_FamilyPtr aFamily = (*aFamsIter).second;
const MED::TStringSet& aGroupNames = aFamily->GetGroupNames();
std::set<std::string>::const_iterator aGrNamesIter = aGroupNames.begin();
set<string>::const_iterator aGrNamesIter = aGroupNames.begin();
for (; aGrNamesIter != aGroupNames.end(); aGrNamesIter++)
{
TNameAndType aNameAndType = make_pair( *aGrNamesIter, aFamily->GetType() );
// Check, if this is a Group or SubMesh name
//if (aName.substr(0, 5) == string("Group")) {
const set< SMDSAbs_ElementType >& types = aFamily->GetTypes();
set< SMDSAbs_ElementType >::const_iterator type = types.begin();
for ( ; type != types.end(); ++type )
{
TNameAndType aNameAndType = make_pair( *aGrNamesIter, *type );
if ( aResGroupNames.insert( aNameAndType ).second ) {
aResult.push_back( aNameAndType );
}
// }
}
}
}
@ -792,28 +795,28 @@ std::list<TNameAndType> DriverMED_R_SMESHDS_Mesh::GetGroupNamesAndTypes()
void DriverMED_R_SMESHDS_Mesh::GetGroup(SMESHDS_Group* theGroup)
{
std::string aGroupName (theGroup->GetStoreName());
string aGroupName (theGroup->GetStoreName());
if(MYDEBUG) MESSAGE("Get Group " << aGroupName);
std::map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
for (; aFamsIter != myFamilies.end(); aFamsIter++)
{
DriverMED_FamilyPtr aFamily = (*aFamsIter).second;
if (aFamily->GetType() == theGroup->GetType() && aFamily->MemberOf(aGroupName))
if (aFamily->GetTypes().count( theGroup->GetType() ) && aFamily->MemberOf(aGroupName))
{
const std::set<const SMDS_MeshElement *>& anElements = aFamily->GetElements();
std::set<const SMDS_MeshElement *>::const_iterator anElemsIter = anElements.begin();
const SMDS_MeshElement * element = 0;
const set<const SMDS_MeshElement *>& anElements = aFamily->GetElements();
set<const SMDS_MeshElement *>::const_iterator anElemsIter = anElements.begin();
for (; anElemsIter != anElements.end(); anElemsIter++)
{
element = *anElemsIter;
const SMDS_MeshElement * element = *anElemsIter;
if ( element->GetType() == theGroup->GetType() ) // Issue 0020576
theGroup->SMDSGroup().Add(element);
}
int aGroupAttrVal = aFamily->GetGroupAttributVal();
if( aGroupAttrVal != 0)
theGroup->SetColorGroup(aGroupAttrVal);
}
if ( element )
theGroup->SetType( theGroup->SMDSGroup().GetType() );
// if ( element ) -- Issue 0020576
// theGroup->SetType( theGroup->SMDSGroup().GetType() );
}
}
}
@ -823,15 +826,15 @@ void DriverMED_R_SMESHDS_Mesh::GetSubMesh (SMESHDS_SubMesh* theSubMesh,
{
char submeshGrpName[ 30 ];
sprintf( submeshGrpName, "SubMesh %d", theId );
std::string aName (submeshGrpName);
std::map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
string aName (submeshGrpName);
map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
for (; aFamsIter != myFamilies.end(); aFamsIter++)
{
DriverMED_FamilyPtr aFamily = (*aFamsIter).second;
if (aFamily->MemberOf(aName))
{
const std::set<const SMDS_MeshElement *>& anElements = aFamily->GetElements();
std::set<const SMDS_MeshElement *>::const_iterator anElemsIter = anElements.begin();
const set<const SMDS_MeshElement *>& anElements = aFamily->GetElements();
set<const SMDS_MeshElement *>::const_iterator anElemsIter = anElements.begin();
if (aFamily->GetType() == SMDSAbs_Node)
{
for (; anElemsIter != anElements.end(); anElemsIter++)
@ -853,21 +856,21 @@ void DriverMED_R_SMESHDS_Mesh::GetSubMesh (SMESHDS_SubMesh* theSubMesh,
void DriverMED_R_SMESHDS_Mesh::CreateAllSubMeshes ()
{
std::map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
for (; aFamsIter != myFamilies.end(); aFamsIter++)
{
DriverMED_FamilyPtr aFamily = (*aFamsIter).second;
MED::TStringSet aGroupNames = aFamily->GetGroupNames();
std::set<std::string>::iterator aGrNamesIter = aGroupNames.begin();
set<string>::iterator aGrNamesIter = aGroupNames.begin();
for (; aGrNamesIter != aGroupNames.end(); aGrNamesIter++)
{
std::string aName = *aGrNamesIter;
string aName = *aGrNamesIter;
// Check, if this is a Group or SubMesh name
if (aName.substr(0, 7) == std::string("SubMesh"))
if (aName.substr(0, 7) == string("SubMesh"))
{
int Id = atoi(std::string(aName).substr(7).c_str());
std::set<const SMDS_MeshElement *> anElements = aFamily->GetElements();
std::set<const SMDS_MeshElement *>::iterator anElemsIter = anElements.begin();
int Id = atoi(string(aName).substr(7).c_str());
set<const SMDS_MeshElement *> anElements = aFamily->GetElements();
set<const SMDS_MeshElement *>::iterator anElemsIter = anElements.begin();
if (aFamily->GetType() == SMDSAbs_Node)
{
for (; anElemsIter != anElements.end(); anElemsIter++)
@ -909,7 +912,7 @@ void DriverMED_R_SMESHDS_Mesh::CreateAllSubMeshes ()
bool DriverMED_R_SMESHDS_Mesh::checkFamilyID(DriverMED_FamilyPtr & aFamily, int anID) const
{
if ( !aFamily || aFamily->GetId() != anID ) {
std::map<int, DriverMED_FamilyPtr>::const_iterator i_fam = myFamilies.find(anID);
map<int, DriverMED_FamilyPtr>::const_iterator i_fam = myFamilies.find(anID);
if ( i_fam == myFamilies.end() )
return false;
aFamily = i_fam->second;
@ -960,7 +963,7 @@ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
case MED::eSEG2:
if(aNodeIds.size() != 2){
res = false;
EXCEPTION(std::runtime_error,"buildMeshGrille Error. Incorrect size of ids 2!="<<aNodeIds.size());
EXCEPTION(runtime_error,"buildMeshGrille Error. Incorrect size of ids 2!="<<aNodeIds.size());
}
anElement = myMesh->AddEdgeWithID(aNodeIds[0],
aNodeIds[1],
@ -969,7 +972,7 @@ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
case MED::eQUAD4:
if(aNodeIds.size() != 4){
res = false;
EXCEPTION(std::runtime_error,"buildMeshGrille Error. Incorrect size of ids 4!="<<aNodeIds.size());
EXCEPTION(runtime_error,"buildMeshGrille Error. Incorrect size of ids 4!="<<aNodeIds.size());
}
anElement = myMesh->AddFaceWithID(aNodeIds[0],
aNodeIds[2],
@ -980,7 +983,7 @@ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
case MED::eHEXA8:
if(aNodeIds.size() != 8){
res = false;
EXCEPTION(std::runtime_error,"buildMeshGrille Error. Incorrect size of ids 8!="<<aNodeIds.size());
EXCEPTION(runtime_error,"buildMeshGrille Error. Incorrect size of ids 8!="<<aNodeIds.size());
}
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
aNodeIds[2],

View File

@ -30,6 +30,8 @@
#include "UNV2417_Structure.hxx"
#include "UNV_Utilities.hxx"
#include <Basics_Utils.hxx>
using namespace std;
@ -49,6 +51,7 @@ DriverUNV_R_SMDS_Mesh::~DriverUNV_R_SMDS_Mesh()
Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
{
Kernel_Utils::Localizer loc;
Status aResult = DRS_OK;
std::ifstream in_stream(myFile.c_str());
try{

View File

@ -36,6 +36,8 @@
#include "UNV2417_Structure.hxx"
#include "UNV_Utilities.hxx"
#include <Basics_Utils.hxx>
using namespace std;
using namespace UNV;
@ -57,6 +59,7 @@ namespace{
Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
{
Kernel_Utils::Localizer loc;
Status aResult = DRS_OK;
std::ofstream out_stream(myFile.c_str());
try{

View File

@ -79,6 +79,7 @@ libMeshDriverUNV_la_CPPFLAGS = \
libMeshDriverUNV_la_LDFLAGS = \
../Driver/libMeshDriver.la \
$(KERNEL_LDFLAGS) -lSALOMEBasics \
$(CAS_KERNEL)
UNV_Test_CPPFLAGS = \

View File

@ -36,7 +36,10 @@ extern "C"
MEFISTO2D_EXPORT
R
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
areteideale()//( R3 xyz, R3 direction )
{
@ -52,8 +55,11 @@ static double cpunew, cpuold=0;
void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
tempscpu_( double & tempsec )
//Retourne le temps CPU utilise en secondes
{
@ -64,8 +70,11 @@ tempscpu_( double & tempsec )
void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
deltacpu_( R & dtcpu )
//Retourne le temps CPU utilise en secondes depuis le precedent appel
{
@ -744,7 +753,10 @@ void aptrte( Z nutysu, R aretmx,
}
void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
qualitetrte( R3 *mnpxyd,
Z & mosoar, Z & mxsoar, Z *mnsoar,

View File

@ -156,7 +156,10 @@ MEFISTO2D_EXPORT
extern "C" { void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
qualitetrte( R3 *mnpxyd,
Z & mosoar, Z & mxsoar, Z *mnsoar,
@ -193,7 +196,10 @@ extern "C" { void
extern "C" { void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
tempscpu( double & tempsec );
}
@ -202,7 +208,10 @@ extern "C" { void
extern "C" { void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
deltacpu( R & dtcpu );
}
@ -212,7 +221,10 @@ extern "C" { void
//initialiser le tableau mnsoar pour le hachage des aretes
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
insoar( Z & mxsomm, Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar );
}
@ -220,14 +232,20 @@ extern "C" {void
//mettre a zero les nb entiers de tab
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
azeroi( Z & nb, Z * tab );
}
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
fasoar( Z & ns1, Z & ns2, Z & nt1, Z & nt2, Z & nolign,
Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar, Z * mnarst,
@ -279,7 +297,10 @@ extern "C" {void
//initialisation du tableau letree et ajout dans letree des sommets 1 a nbsomm
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
teajte( Z & mxsomm, Z & nbsomm, R3 * mnpxyd, R3 * comxmi,
R & aretmx, Z & mxtree, Z * letree,
@ -288,7 +309,10 @@ extern "C" {void
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
tehote( Z & nutysu, Z & nbarpi, Z & mxsomm, Z & nbsomm, R3 * mnpxyd,
R3 * comxmi, R & aretmx,
@ -300,7 +324,10 @@ extern "C" {void
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
tetrte( R3 * comxmi, R & aretmx, Z & nbarpi, Z & mxsomm, R3 * mnpxyd,
Z & mxqueu, Z * mnqueu, Z * mntree,
@ -313,7 +340,10 @@ extern "C" {void
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
aisoar( Z & mosoar, Z & mxsoar, Z * mnsoar, Z & na );
}
@ -321,7 +351,10 @@ extern "C" {void
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
tedela( R3 * mnpxyd, Z * mnarst,
Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar, Z & na,
@ -332,7 +365,10 @@ extern "C" {void
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
terefr( Z & nbarpi, R3 * mnpxyd,
Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar,
@ -346,7 +382,10 @@ extern "C" {void
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
tesuex( Z & nblf, Z * nulftr,
Z & ndtri0, Z & nbsomm, R3 * mnpxyd, Z * mnslig,
@ -358,7 +397,10 @@ extern "C" {void
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
teamqt( Z & nutysu, R & aretmx, R & airemx,
Z * mnarst, Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar,
@ -377,7 +419,10 @@ extern "C" {void
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
nusotr( Z & nt, Z & mosoar, Z * mnsoar, Z & moartr, Z * mnartr,Z * nosotr );
}
@ -385,7 +430,10 @@ extern "C" {void
extern "C" {void
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
qutr2d( R3 & p1, R3 & p2, R3 & p3, R & qualite );
}
@ -393,7 +441,10 @@ extern "C" {void
extern "C" { R
#ifdef WIN32
#ifdef F2C_BUILD
#else
__stdcall
#endif
#endif
surtd2( R3 & p1, R3 & p2, R3 & p3 );
}

View File

@ -36,7 +36,6 @@ salomeinclude_HEADERS = \
SMESH_DeviceActor.h \
SMESH_PreviewActorsCollection.h \
SMESH_ExtractGeometry.h \
SMESH_ActorUtils.h \
SMESH_FaceOrientationFilter.h
# Libraries targets
@ -77,5 +76,6 @@ libSMESHObject_la_LDFLAGS = \
../SMDS/libSMDS.la \
../Controls/libSMESHControls.la \
$(GUI_LDFLAGS) -lSalomeApp -lSalomeObject -lSVTK -lVTKViewer -lqtx -lsuit \
$(GEOM_LDFLAGS) -lGEOMObject \
$(CAS_KERNEL) \
$(VTK_LIBS) $(QT_MT_LIBS)

View File

@ -72,6 +72,11 @@
#include <vtkImplicitBoolean.h>
#include <vtkImplicitFunctionCollection.h>
#include <vtkConfigure.h>
#if !defined(VTK_XVERSION)
#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
#endif
#include "utilities.h"
#ifdef _DEBUG_
@ -399,7 +404,11 @@ SMESH_ActorDef::SMESH_ActorDef()
myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
#if (VTK_XVERSION >= 0x050200)
myPtsLabeledDataMapper->SetLabelFormat("%d");
#else
myPtsLabeledDataMapper->SetLabelFormat("%g");
#endif
myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
@ -440,7 +449,11 @@ SMESH_ActorDef::SMESH_ActorDef()
myClsLabeledDataMapper = vtkLabeledDataMapper::New();
myClsLabeledDataMapper->SetInput(myClsSelectVisiblePoints->GetOutput());
#if (VTK_XVERSION >= 0x050200)
myClsLabeledDataMapper->SetLabelFormat("%d");
#else
myClsLabeledDataMapper->SetLabelFormat("%g");
#endif
myClsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aClsTextProp = vtkTextProperty::New();
@ -593,7 +606,7 @@ void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
vtkIntArray *anArray = vtkIntArray::New();
anArray->SetNumberOfValues( aNbElem );
for ( int anId = 0; anId < aNbElem; anId++ )
for ( vtkIdType anId = 0; anId < aNbElem; anId++ )
{
int aSMDSId = myVisualObj->GetNodeObjId( anId );
anArray->SetValue( anId, aSMDSId );
@ -1034,8 +1047,8 @@ bool SMESH_ActorDef::IsInfinitive(){
vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
aDataSet->Update();
myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
aDataSet->GetNumberOfCells() == 1 &&
aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX;
( aDataSet->GetNumberOfCells() == 1 &&
aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX );
return SALOME_Actor::IsInfinitive();
}
@ -1250,7 +1263,11 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
VTKViewer_ExtractUnstructuredGrid* aHightFilter = myHighlitableActor->GetExtractUnstructuredGrid();
aHightFilter->ClearRegisteredCellsWithType();
aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
// The following row has been commented (initially added in 1.28.2.3.1 revision)
// Reason: seems to be unnecessary, this filter should always have default (ePassAll) mode of changing
// In addition, it leads to exception (see bug IPAL21372)
//aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
if (myEntityMode & e0DElements) {
if (MYDEBUG) MESSAGE("0D ELEMENTS");

View File

@ -546,7 +546,6 @@ SMESH_DeviceActor
aDataSet->Delete();
}else if(FreeNodes* aFreeNodes = dynamic_cast<FreeNodes*>(theFunctor.get())){
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
vtkIdType aNbNodes = myVisualObj->GetNbEntities(SMDSAbs_Node);
for( vtkIdType i = 0; i < aNbNodes; i++ ){
vtkIdType anObjId = myVisualObj->GetNodeObjId(i);

View File

@ -520,6 +520,19 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
return true;
}
//=================================================================================
// function : IsValid
// purpose : Return true if there are some entities
//=================================================================================
bool SMESH_VisualObjDef::IsValid() const
{
return GetNbEntities(SMDSAbs_Node) > 0 ||
GetNbEntities(SMDSAbs_0DElement) > 0 ||
GetNbEntities(SMDSAbs_Edge) > 0 ||
GetNbEntities(SMDSAbs_Face) > 0 ||
GetNbEntities(SMDSAbs_Volume) > 0 ;
}
/*
Class : SMESH_MeshObj
Description : Class for visualisation of mesh
@ -678,7 +691,7 @@ void SMESH_MeshObj::UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor
//=================================================================================
bool SMESH_MeshObj::IsNodePrs() const
{
return myClient->NbEdges() == 0 &&myClient->NbFaces() == 0 && myClient->NbVolumes() == 0 ;
return myClient->Nb0DElements() == 0 && myClient->NbEdges() == 0 && myClient->NbFaces() == 0 && myClient->NbVolumes() == 0 ;
}

View File

@ -65,6 +65,7 @@ public:
const int theEdgeNum,
int& theNodeId1,
int& theNodeId2 ) const = 0;
virtual bool IsValid() const = 0;
virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;

View File

@ -69,6 +69,8 @@ public:
virtual bool IsNodePrs() const = 0;
virtual SMDS_Mesh* GetMesh() const = 0;
virtual bool IsValid() const;
virtual bool GetEdgeNodes( const int theElemId,
const int theEdgeNum,
int& theNodeId1,

View File

@ -368,6 +368,8 @@ static int QuadHexa_nbN [] = { 8, 8, 8, 8, 8, 8 };
// ========================================================
// to perform some calculations without linkage to CASCADE
// ========================================================
namespace
{
struct XYZ {
double x;
double y;
@ -376,25 +378,26 @@ struct XYZ {
XYZ( double X, double Y, double Z ) { x = X; y = Y; z = Z; }
XYZ( const XYZ& other ) { x = other.x; y = other.y; z = other.z; }
XYZ( const SMDS_MeshNode* n ) { x = n->X(); y = n->Y(); z = n->Z(); }
XYZ operator-( const XYZ& other );
XYZ Crossed( const XYZ& other );
double Dot( const XYZ& other );
double Magnitude();
inline XYZ operator-( const XYZ& other );
inline XYZ Crossed( const XYZ& other );
inline double Dot( const XYZ& other );
inline double Magnitude();
};
XYZ XYZ::operator-( const XYZ& Right ) {
inline XYZ XYZ::operator-( const XYZ& Right ) {
return XYZ(x - Right.x, y - Right.y, z - Right.z);
}
XYZ XYZ::Crossed( const XYZ& Right ) {
inline XYZ XYZ::Crossed( const XYZ& Right ) {
return XYZ (y * Right.z - z * Right.y,
z * Right.x - x * Right.z,
x * Right.y - y * Right.x);
}
double XYZ::Dot( const XYZ& Other ) {
inline double XYZ::Dot( const XYZ& Other ) {
return(x * Other.x + y * Other.y + z * Other.z);
}
double XYZ::Magnitude() {
inline double XYZ::Magnitude() {
return sqrt (x * x + y * y + z * z);
}
}
//=======================================================================
//function : SMDS_VolumeTool
@ -837,6 +840,32 @@ bool SMDS_VolumeTool::GetBaryCenter(double & X, double & Y, double & Z) const
return true;
}
//================================================================================
/*!
* \brief Classify a point
* \param tol - thickness of faces
*/
//================================================================================
bool SMDS_VolumeTool::IsOut(double X, double Y, double Z, double tol)
{
// LIMITATION: for convex volumes only
XYZ p( X,Y,Z );
for ( int iF = 0; iF < myNbFaces; ++iF )
{
XYZ faceNormal;
if ( !GetFaceNormal( iF, faceNormal.x, faceNormal.y, faceNormal.z ))
continue;
if ( !IsFaceExternal( iF ))
faceNormal = XYZ() - faceNormal; // reverse
XYZ face2p( p - XYZ( myFaceNodes[0] ));
if ( face2p.Dot( faceNormal ) > tol )
return true;
}
return false;
}
//=======================================================================
//function : SetExternalNormal
//purpose : Node order will be so that faces normals are external

View File

@ -93,6 +93,8 @@ class SMDS_EXPORT SMDS_VolumeTool
bool GetBaryCenter (double & X, double & Y, double & Z) const;
bool IsOut(double X, double Y, double Z, double tol);
// Classify a point
// -----------------------
// info on node connection

View File

@ -996,7 +996,8 @@ int SMESH_Block::GetOrderedEdges (const TopoDS_Face& theFace,
for ( iE = 0; wExp.More(); wExp.Next(), iE++ )
{
TopoDS_Edge edge = wExp.Current();
edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() ));
// commented for issue 0020557, other related ones: 0020526, PAL19080
// edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() ));
theEdges.push_back( edge );
}
theNbVertexInWires.push_back( iE );

View File

@ -271,6 +271,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
// apply the algos that do not require descretized boundaries
// ----------------------------------------------------------
for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt )
{
sm = *subIt;
if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
{
const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType();
@ -282,7 +284,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
if ( aShapesId )
aShapesId->insert( sm->GetId() );
}
}
// -----------------------------------------------
// mesh the rest subshapes starting from vertices
// -----------------------------------------------
@ -410,7 +412,9 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
// ----------------------------------------------------------
// apply the algos that do not require descretized boundaries
// ----------------------------------------------------------
for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt ) {
for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt )
{
sm = *subIt;
sm->Evaluate(aResMap);
if ( aShapesId )
aShapesId->insert( sm->GetId() );
@ -437,7 +441,7 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
const SMESH_Algo* aGlobIgnoAlgo,
const SMESH_Algo* aLocIgnoAlgo,
bool & checkConform,
map<int, SMESH_subMesh*>& aCheckedMap,
set<SMESH_subMesh*>& aCheckedMap,
list< SMESH_Gen::TAlgoStateError > & theErrors)
{
ASSERT( aSubMesh );
@ -492,19 +496,15 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
}
// sub-algos will be hidden by a local <algo>
const map<int, SMESH_subMesh*>& smMap = aSubMesh->DependsOn();
map<int, SMESH_subMesh*>::const_reverse_iterator revItSub;
SMESH_subMeshIteratorPtr revItSub =
aSubMesh->getDependsOnIterator( /*includeSelf=*/false, /*complexShapeFirst=*/true);
bool checkConform2 = false;
for ( revItSub = smMap.rbegin(); revItSub != smMap.rend(); revItSub++)
while ( revItSub->more() )
{
checkConformIgnoredAlgos (aMesh, (*revItSub).second, aGlobIgnoAlgo,
SMESH_subMesh* sm = revItSub->next();
checkConformIgnoredAlgos (aMesh, sm, aGlobIgnoAlgo,
algo, checkConform2, aCheckedMap, theErrors);
int key = (*revItSub).first;
SMESH_subMesh* sm = (*revItSub).second;
if ( aCheckedMap.find( key ) == aCheckedMap.end() )
{
aCheckedMap[ key ] = sm;
}
aCheckedMap.insert( sm );
}
}
}
@ -525,7 +525,7 @@ static bool checkMissing(SMESH_Gen* aGen,
const int aTopAlgoDim,
bool* globalChecked,
const bool checkNoAlgo,
map<int, SMESH_subMesh*>& aCheckedMap,
set<SMESH_subMesh*>& aCheckedMap,
list< SMESH_Gen::TAlgoStateError > & theErrors)
{
if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
@ -598,15 +598,13 @@ static bool checkMissing(SMESH_Gen* aGen,
if (!algo->NeedDescretBoundary() || isTopLocalAlgo)
{
bool checkNoAlgo2 = ( algo->NeedDescretBoundary() );
const map<int, SMESH_subMesh*>& subMeshes = aSubMesh->DependsOn();
map<int, SMESH_subMesh*>::const_iterator itsub;
for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
SMESH_subMeshIteratorPtr itsub = aSubMesh->getDependsOnIterator( /*includeSelf=*/false,
/*complexShapeFirst=*/false);
while ( itsub->more() )
{
// sub-meshes should not be checked further more
int key = (*itsub).first;
SMESH_subMesh* sm = (*itsub).second;
if ( aCheckedMap.find( key ) == aCheckedMap.end() )
aCheckedMap[ key ] = sm;
SMESH_subMesh* sm = itsub->next();
aCheckedMap.insert( sm );
if (isTopLocalAlgo)
{
@ -700,39 +698,25 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
}
}
const map<int, SMESH_subMesh*>& smMap = sm->DependsOn();
map<int, SMESH_subMesh*>::const_reverse_iterator revItSub = smMap.rbegin();
map<int, SMESH_subMesh*> aCheckedMap;
set<SMESH_subMesh*> aCheckedSubs;
bool checkConform = ( !theMesh.IsNotConformAllowed() );
int aKey = 1;
SMESH_subMesh* smToCheck = sm;
// loop on theShape and its sub-shapes
while ( smToCheck )
SMESH_subMeshIteratorPtr revItSub = sm->getDependsOnIterator( /*includeSelf=*/true,
/*complexShapeFirst=*/true);
while ( revItSub->more() )
{
SMESH_subMesh* smToCheck = revItSub->next();
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
break;
if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked
if (!checkConformIgnoredAlgos (theMesh, smToCheck, aGlobIgnoAlgo,
0, checkConform, aCheckedMap, theErrors))
0, checkConform, aCheckedSubs, theErrors))
ret = false;
if ( smToCheck->GetAlgoState() != SMESH_subMesh::NO_ALGO )
hasAlgo = true;
// next subMesh
if (revItSub != smMap.rend())
{
aKey = (*revItSub).first;
smToCheck = (*revItSub).second;
revItSub++;
}
else
{
smToCheck = 0;
}
}
// ----------------------------------------------------------------
@ -752,36 +736,26 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
break;
}
}
aCheckedMap.clear();
smToCheck = sm;
revItSub = smMap.rbegin();
bool checkNoAlgo = theMesh.HasShapeToMesh() ? bool( aTopAlgoDim ) : false;
bool globalChecked[] = { false, false, false, false };
// loop on theShape and its sub-shapes
while ( smToCheck )
aCheckedSubs.clear();
revItSub = sm->getDependsOnIterator( /*includeSelf=*/true, /*complexShapeFirst=*/true);
while ( revItSub->more() )
{
SMESH_subMesh* smToCheck = revItSub->next();
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
break;
if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked
if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim,
globalChecked, checkNoAlgo, aCheckedMap, theErrors))
globalChecked, checkNoAlgo, aCheckedSubs, theErrors))
{
ret = false;
if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO )
checkNoAlgo = false;
}
// next subMesh
if (revItSub != smMap.rend())
{
aKey = (*revItSub).first;
smToCheck = (*revItSub).second;
revItSub++;
}
else
smToCheck = 0;
}
if ( !hasAlgo ) {

View File

@ -61,7 +61,7 @@ typedef std::set<int> TSetOfInt;
class SMESH_EXPORT SMESH_Gen
{
public:
public:
SMESH_Gen();
~SMESH_Gen();
@ -138,16 +138,6 @@ class SMESH_EXPORT SMESH_Gen
SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0);
static bool IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh);
// inherited methods from SALOMEDS::Driver
// void Save(int studyId, const char *aUrlOfFile);
// void Load(int studyId, const char *aUrlOfFile);
// void Close(int studyId);
// const char *ComponentDataType();
// const char *IORToLocalPersistentID(const char *IORString, bool & IsAFile);
// const char *LocalPersistentIDToIOR(const char *aLocalPersistentID);
int GetANewId();
std::map < int, SMESH_Algo * >_mapAlgo;
@ -156,7 +146,7 @@ class SMESH_EXPORT SMESH_Gen
std::map < int, SMESH_2D_Algo * >_map2D_Algo;
std::map < int, SMESH_3D_Algo * >_map3D_Algo;
private:
private:
int _localId; // unique Id of created objects, within SMESH_Gen entity
std::map < int, StudyContextStruct * >_mapStudyContext;

View File

@ -78,6 +78,8 @@
#include <map>
#include <set>
#include <numeric>
#include <limits>
#define cast2Node(elem) static_cast<const SMDS_MeshNode*>( elem )
@ -90,8 +92,23 @@ typedef map<const SMDS_MeshElement*, list<const SMDS_MeshElement*> > TElemOfElem
//typedef TNodeOfNodeVecMap::iterator TNodeOfNodeVecMapItr;
//typedef map<const SMDS_MeshElement*, vector<TNodeOfNodeVecMapItr> > TElemOfVecOfMapNodesMap;
struct TNodeXYZ : public gp_XYZ {
//=======================================================================
/*!
* \brief SMDS_MeshNode -> gp_XYZ convertor
*/
//=======================================================================
struct TNodeXYZ : public gp_XYZ
{
TNodeXYZ( const SMDS_MeshNode* n ):gp_XYZ( n->X(), n->Y(), n->Z() ) {}
double Distance( const SMDS_MeshNode* n )
{
return gp_Vec( *this, TNodeXYZ( n )).Magnitude();
}
double SquareDistance( const SMDS_MeshNode* n )
{
return gp_Vec( *this, TNodeXYZ( n )).SquareMagnitude();
}
};
//=======================================================================
@ -2788,12 +2805,12 @@ void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem,
return;
}
issimple[iNode] = (listNewNodes.size()==nbSteps);
issimple[iNode] = (listNewNodes.size()==nbSteps); // is node medium
itNN[ iNode ] = listNewNodes.begin();
prevNod[ iNode ] = node;
nextNod[ iNode ] = listNewNodes.front();
if( !issimple[iNode] ) {
if( !elem->IsQuadratic() || !issimple[iNode] ) {
if ( prevNod[ iNode ] != nextNod [ iNode ])
iNotSameNode = iNode;
else {
@ -2806,8 +2823,8 @@ void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem,
//cout<<" nbSame = "<<nbSame<<endl;
if ( nbSame == nbNodes || nbSame > 2) {
//MESSAGE( " Too many same nodes of element " << elem->GetID() );
INFOS( " Too many same nodes of element " << elem->GetID() );
MESSAGE( " Too many same nodes of element " << elem->GetID() );
//INFOS( " Too many same nodes of element " << elem->GetID() );
return;
}
@ -5066,12 +5083,13 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens,
return newGroupIDs;
}
//=======================================================================
//function : FindCoincidentNodes
//purpose : Return list of group of nodes close to each other within theTolerance
// Search among theNodes or in the whole mesh if theNodes is empty using
// an Octree algorithm
//=======================================================================
//================================================================================
/*!
* \brief Return list of group of nodes close to each other within theTolerance
* Search among theNodes or in the whole mesh if theNodes is empty using
* an Octree algorithm
*/
//================================================================================
void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes,
const double theTolerance,
@ -5089,10 +5107,11 @@ void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes
}
else
nodes=theNodes;
SMESH_OctreeNode::FindCoincidentNodes ( nodes, &theGroupsOfNodes, theTolerance);
SMESH_OctreeNode::FindCoincidentNodes ( nodes, &theGroupsOfNodes, theTolerance);
}
//=======================================================================
/*!
* \brief Implementation of search for the node closest to point
@ -5101,11 +5120,14 @@ void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes
struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
{
//---------------------------------------------------------------------
/*!
* \brief Constructor
*/
SMESH_NodeSearcherImpl( const SMESHDS_Mesh* theMesh )
{
myMesh = ( SMESHDS_Mesh* ) theMesh;
set<const SMDS_MeshNode*> nodes;
if ( theMesh ) {
SMDS_NodeIteratorPtr nIt = theMesh->nodesIterator();
@ -5113,19 +5135,43 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
nodes.insert( nodes.end(), nIt->next() );
}
myOctreeNode = new SMESH_OctreeNode(nodes) ;
// get max size of a leaf box
SMESH_OctreeNode* tree = myOctreeNode;
while ( !tree->isLeaf() )
{
SMESH_OctreeNodeIteratorPtr cIt = tree->GetChildrenIterator();
if ( cIt->more() )
tree = cIt->next();
}
myHalfLeafSize = tree->maxSize() / 2.;
}
//---------------------------------------------------------------------
/*!
* \brief Move node and update myOctreeNode accordingly
*/
void MoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt )
{
myOctreeNode->UpdateByMoveNode( node, toPnt );
myMesh->MoveNode( node, toPnt.X(), toPnt.Y(), toPnt.Z() );
}
//---------------------------------------------------------------------
/*!
* \brief Do it's job
*/
const SMDS_MeshNode* FindClosestTo( const gp_Pnt& thePnt )
{
SMDS_MeshNode tgtNode( thePnt.X(), thePnt.Y(), thePnt.Z() );
map<double, const SMDS_MeshNode*> dist2Nodes;
myOctreeNode->NodesAround( &tgtNode, dist2Nodes, myHalfLeafSize );
if ( !dist2Nodes.empty() )
return dist2Nodes.begin()->second;
list<const SMDS_MeshNode*> nodes;
//const double precision = 1e-6;
//myOctreeNode->NodesAround( &tgtNode, &nodes, precision );
//myOctreeNode->NodesAround( &tgtNode, &nodes, myHalfLeafSize );
double minSqDist = DBL_MAX;
Bnd_B3d box;
if ( nodes.empty() ) // get all nodes of OctreeNode's closest to thePnt
{
// sort leafs by their distance from thePnt
@ -5134,20 +5180,25 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
list< SMESH_OctreeNode* > treeList;
list< SMESH_OctreeNode* >::iterator trIt;
treeList.push_back( myOctreeNode );
SMDS_MeshNode pointNode( thePnt.X(), thePnt.Y(), thePnt.Z() );
for ( trIt = treeList.begin(); trIt != treeList.end(); ++trIt)
{
SMESH_OctreeNode* tree = *trIt;
if ( !tree->isLeaf() ) { // put children to the queue
if ( !tree->isLeaf() ) // put children to the queue
{
if ( !tree->isInside( &pointNode, myHalfLeafSize )) continue;
SMESH_OctreeNodeIteratorPtr cIt = tree->GetChildrenIterator();
while ( cIt->more() )
treeList.push_back( cIt->next() );
}
else if ( tree->NbNodes() ) { // put tree to treeMap
tree->getBox( box );
else if ( tree->NbNodes() ) // put a tree to the treeMap
{
const Bnd_B3d& box = tree->getBox();
double sqDist = thePnt.SquareDistance( 0.5 * ( box.CornerMin() + box.CornerMax() ));
pair<TDistTreeMap::iterator,bool> it_in = treeMap.insert( make_pair( sqDist, tree ));
if ( !it_in.second ) // not unique distance to box center
treeMap.insert( it_in.first, make_pair( sqDist - 1e-13*treeMap.size(), tree ));
treeMap.insert( it_in.first, make_pair( sqDist + 1e-13*treeMap.size(), tree ));
}
}
// find distance after which there is no sense to check tree's
@ -5155,7 +5206,7 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
TDistTreeMap::iterator sqDist_tree = treeMap.begin();
if ( treeMap.size() > 5 ) {
SMESH_OctreeNode* closestTree = sqDist_tree->second;
closestTree->getBox( box );
const Bnd_B3d& box = closestTree->getBox();
double limit = sqrt( sqDist_tree->first ) + sqrt ( box.SquareExtent() );
sqLimit = limit * limit;
}
@ -5180,12 +5231,23 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
}
return closestNode;
}
//---------------------------------------------------------------------
/*!
* \brief Destructor
*/
~SMESH_NodeSearcherImpl() { delete myOctreeNode; }
//---------------------------------------------------------------------
/*!
* \brief Return the node tree
*/
const SMESH_OctreeNode* getTree() const { return myOctreeNode; }
private:
SMESH_OctreeNode* myOctreeNode;
SMESHDS_Mesh* myMesh;
double myHalfLeafSize; // max size of a leaf box
};
//=======================================================================
@ -5199,6 +5261,404 @@ SMESH_NodeSearcher* SMESH_MeshEditor::GetNodeSearcher()
return new SMESH_NodeSearcherImpl( GetMeshDS() );
}
// ========================================================================
namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
{
const int MaxNbElemsInLeaf = 10; // maximal number of elements in a leaf of tree
const int MaxLevel = 7; // maximal tree height -> nb terminal boxes: 8^7 = 2097152
const double NodeRadius = 1e-9; // to enlarge bnd box of element
//=======================================================================
/*!
* \brief Octal tree of bounding boxes of elements
*/
//=======================================================================
class ElementBndBoxTree : public SMESH_Octree
{
public:
ElementBndBoxTree(const SMDS_Mesh& mesh, SMDSAbs_ElementType elemType);
void getElementsNearPoint( const gp_Pnt& point, TIDSortedElemSet& foundElems);
~ElementBndBoxTree();
protected:
ElementBndBoxTree() {}
SMESH_Octree* allocateOctreeChild() const { return new ElementBndBoxTree; }
void buildChildrenData();
Bnd_B3d* buildRootBox();
private:
//!< Bounding box of element
struct ElementBox : public Bnd_B3d
{
const SMDS_MeshElement* _element;
int _refCount; // an ElementBox can be included in several tree branches
ElementBox(const SMDS_MeshElement* elem);
};
vector< ElementBox* > _elements;
};
//================================================================================
/*!
* \brief ElementBndBoxTree creation
*/
//================================================================================
ElementBndBoxTree::ElementBndBoxTree(const SMDS_Mesh& mesh, SMDSAbs_ElementType elemType)
:SMESH_Octree( new SMESH_Octree::Limit( MaxLevel, /*minSize=*/0. ))
{
int nbElems = mesh.GetMeshInfo().NbElements( elemType );
_elements.reserve( nbElems );
SMDS_ElemIteratorPtr elemIt = mesh.elementsIterator( elemType );
while ( elemIt->more() )
_elements.push_back( new ElementBox( elemIt->next() ));
if ( _elements.size() > MaxNbElemsInLeaf )
compute();
else
myIsLeaf = true;
}
//================================================================================
/*!
* \brief Destructor
*/
//================================================================================
ElementBndBoxTree::~ElementBndBoxTree()
{
for ( int i = 0; i < _elements.size(); ++i )
if ( --_elements[i]->_refCount <= 0 )
delete _elements[i];
}
//================================================================================
/*!
* \brief Return the maximal box
*/
//================================================================================
Bnd_B3d* ElementBndBoxTree::buildRootBox()
{
Bnd_B3d* box = new Bnd_B3d;
for ( int i = 0; i < _elements.size(); ++i )
box->Add( *_elements[i] );
return box;
}
//================================================================================
/*!
* \brief Redistrubute element boxes among children
*/
//================================================================================
void ElementBndBoxTree::buildChildrenData()
{
for ( int i = 0; i < _elements.size(); ++i )
{
for (int j = 0; j < 8; j++)
{
if ( !_elements[i]->IsOut( myChildren[j]->getBox() ))
{
_elements[i]->_refCount++;
((ElementBndBoxTree*)myChildren[j])->_elements.push_back( _elements[i]);
}
}
_elements[i]->_refCount--;
}
_elements.clear();
for (int j = 0; j < 8; j++)
{
ElementBndBoxTree* child = static_cast<ElementBndBoxTree*>( myChildren[j]);
if ( child->_elements.size() <= MaxNbElemsInLeaf )
child->myIsLeaf = true;
if ( child->_elements.capacity() - child->_elements.size() > 1000 )
child->_elements.resize( child->_elements.size() ); // compact
}
}
//================================================================================
/*!
* \brief Return elements which can include the point
*/
//================================================================================
void ElementBndBoxTree::getElementsNearPoint( const gp_Pnt& point,
TIDSortedElemSet& foundElems)
{
if ( level() && getBox().IsOut( point.XYZ() ))
return;
if ( isLeaf() )
{
for ( int i = 0; i < _elements.size(); ++i )
if ( !_elements[i]->IsOut( point.XYZ() ))
foundElems.insert( _elements[i]->_element );
}
else
{
for (int i = 0; i < 8; i++)
((ElementBndBoxTree*) myChildren[i])->getElementsNearPoint( point, foundElems );
}
}
//================================================================================
/*!
* \brief Construct the element box
*/
//================================================================================
ElementBndBoxTree::ElementBox::ElementBox(const SMDS_MeshElement* elem)
{
_element = elem;
_refCount = 1;
SMDS_ElemIteratorPtr nIt = elem->nodesIterator();
while ( nIt->more() )
Add( TNodeXYZ( cast2Node( nIt->next() )));
Enlarge( NodeRadius );
}
} // namespace
//=======================================================================
/*!
* \brief Implementation of search for the elements by point
*/
//=======================================================================
struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher
{
SMESHDS_Mesh* _mesh;
ElementBndBoxTree* _ebbTree;
SMESH_NodeSearcherImpl* _nodeSearcher;
SMDSAbs_ElementType _elementType;
SMESH_ElementSearcherImpl( SMESHDS_Mesh& mesh ): _mesh(&mesh),_ebbTree(0),_nodeSearcher(0) {}
~SMESH_ElementSearcherImpl()
{
if ( _ebbTree ) delete _ebbTree; _ebbTree = 0;
if ( _nodeSearcher ) delete _nodeSearcher; _nodeSearcher = 0;
}
/*!
* \brief Return elements of given type where the given point is IN or ON.
*
* 'ALL' type means elements of any type excluding nodes and 0D elements
*/
void FindElementsByPoint(const gp_Pnt& point,
SMDSAbs_ElementType type,
vector< const SMDS_MeshElement* >& foundElements)
{
foundElements.clear();
const SMDS_MeshInfo& meshInfo = _mesh->GetMeshInfo();
// -----------------
// define tolerance
// -----------------
double tolerance = 0;
if ( _nodeSearcher && meshInfo.NbNodes() > 1 )
{
double boxSize = _nodeSearcher->getTree()->maxSize();
tolerance = 1e-8 * boxSize/* / meshInfo.NbNodes()*/;
}
else if ( _ebbTree && meshInfo.NbElements() > 0 )
{
double boxSize = _ebbTree->maxSize();
tolerance = 1e-8 * boxSize/* / meshInfo.NbElements()*/;
}
if ( tolerance == 0 )
{
// define tolerance by size of a most complex element
int complexType = SMDSAbs_Volume;
while ( complexType > SMDSAbs_All &&
meshInfo.NbElements( SMDSAbs_ElementType( complexType )) < 1 )
--complexType;
if ( complexType == SMDSAbs_All ) return; // empty mesh
double elemSize;
if ( complexType == int( SMDSAbs_Node ))
{
SMDS_NodeIteratorPtr nodeIt = _mesh->nodesIterator();
elemSize = 1;
if ( meshInfo.NbNodes() > 2 )
elemSize = TNodeXYZ( nodeIt->next() ).Distance( nodeIt->next() );
}
else
{
const SMDS_MeshElement* elem =
_mesh->elementsIterator( SMDSAbs_ElementType( complexType ))->next();
SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
TNodeXYZ n1( cast2Node( nodeIt->next() ));
while ( nodeIt->more() )
{
double dist = n1.Distance( cast2Node( nodeIt->next() ));
elemSize = max( dist, elemSize );
}
}
tolerance = 1e-6 * elemSize;
}
// =================================================================================
if ( type == SMDSAbs_Node || type == SMDSAbs_0DElement )
{
if ( !_nodeSearcher )
_nodeSearcher = new SMESH_NodeSearcherImpl( _mesh );
const SMDS_MeshNode* closeNode = _nodeSearcher->FindClosestTo( point );
if ( !closeNode ) return;
if ( point.Distance( TNodeXYZ( closeNode )) > tolerance )
return; // to far from any node
if ( type == SMDSAbs_Node )
{
foundElements.push_back( closeNode );
}
else
{
SMDS_ElemIteratorPtr elemIt = closeNode->GetInverseElementIterator( SMDSAbs_0DElement );
while ( elemIt->more() )
foundElements.push_back( elemIt->next() );
}
}
// =================================================================================
else // elements more complex than 0D
{
if ( !_ebbTree || _elementType != type )
{
if ( _ebbTree ) delete _ebbTree;
_ebbTree = new ElementBndBoxTree( *_mesh, _elementType = type );
}
TIDSortedElemSet suspectElems;
_ebbTree->getElementsNearPoint( point, suspectElems );
TIDSortedElemSet::iterator elem = suspectElems.begin();
for ( ; elem != suspectElems.end(); ++elem )
if ( !SMESH_MeshEditor::isOut( *elem, point, tolerance ))
foundElements.push_back( *elem );
}
}
}; // struct SMESH_ElementSearcherImpl
//=======================================================================
/*!
* \brief Return SMESH_ElementSearcher
*/
//=======================================================================
SMESH_ElementSearcher* SMESH_MeshEditor::GetElementSearcher()
{
return new SMESH_ElementSearcherImpl( *GetMeshDS() );
}
//=======================================================================
/*!
* \brief Return true if the point is IN or ON of the element
*/
//=======================================================================
bool SMESH_MeshEditor::isOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol )
{
if ( element->GetType() == SMDSAbs_Volume)
{
return SMDS_VolumeTool( element ).IsOut( point.X(), point.Y(), point.Z(), tol );
}
// get ordered nodes
vector< gp_XYZ > xyz;
SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
if ( element->IsQuadratic() )
if (const SMDS_QuadraticFaceOfNodes* f=dynamic_cast<const SMDS_QuadraticFaceOfNodes*>(element))
nodeIt = f->interlacedNodesElemIterator();
else if (const SMDS_QuadraticEdge* e =dynamic_cast<const SMDS_QuadraticEdge*>(element))
nodeIt = e->interlacedNodesElemIterator();
while ( nodeIt->more() )
xyz.push_back( TNodeXYZ( cast2Node( nodeIt->next() )));
if ( element->GetType() == SMDSAbs_Face ) // --------------------------------------------------
{
// gravity center
gp_XYZ gc(0,0,0);
gc = accumulate( xyz.begin(), xyz.end(), gc );
gc /= element->NbNodes();
// compute face normal using gc
gp_Vec normal(0,0,0);
xyz.push_back( xyz.front() );
for ( int i = 0; i < element->NbNodes(); ++i )
{
gp_Vec edge( xyz[i], xyz[i+1]);
gp_Vec n2gc( xyz[i], gc );
normal += edge ^ n2gc;
}
double faceDoubleArea = normal.Magnitude();
if ( faceDoubleArea <= numeric_limits<double>::min() )
return true; // invalid face
normal /= faceDoubleArea;
// check if the point lays on face plane
gp_Vec n2p( xyz[0], point );
if ( fabs( n2p * normal ) > tol )
return true; // not on face plane
// check if point is out of face boundary
int i, out = false;
for ( i = 0; !out && i < element->NbNodes(); ++i )
{
gp_Vec edge( xyz[i], xyz[i+1]);
gp_Vec n2p ( xyz[i], point );
gp_Vec cross = edge ^ n2p;
out = ( cross * normal < -tol );
}
if ( out && element->IsPoly() )
{
// define point position by the closest edge
double minDist = numeric_limits<double>::max();
int iMinDist;
for ( i = 0; i < element->NbNodes(); ++i )
{
gp_Vec edge( xyz[i], xyz[i+1]);
gp_Vec n1p ( xyz[i], point);
double dist = ( edge ^ n1p ).Magnitude() / edge.Magnitude();
if ( dist < minDist )
iMinDist = i;
}
gp_Vec edge( xyz[iMinDist], xyz[iMinDist+1]);
gp_Vec n2p ( xyz[iMinDist], point );
gp_Vec cross = edge ^ n2p;
out = ( cross * normal < -tol );
}
return out;
}
if ( element->GetType() == SMDSAbs_Edge ) // --------------------------------------------------
{
for ( int i = 1; i < element->NbNodes(); ++i )
{
gp_Vec edge( xyz[i-1], xyz[i]);
gp_Vec n1p ( xyz[i-1], point);
double dist = ( edge ^ n1p ).Magnitude() / edge.Magnitude();
if ( dist > tol )
return true;
gp_Vec n2p( xyz[i], point );
if ( fabs( edge.Magnitude() - n1p.Magnitude() - n2p.Magnitude()) > tol )
return true;
}
return false;
}
// Node or 0D element -------------------------------------------------------------------------
{
gp_Vec n2p ( xyz[0], point );
return n2p.Magnitude() <= tol;
}
return true;
}
//=======================================================================
//function : SimplifyFace
//purpose :
@ -6107,7 +6567,7 @@ bool SMESH_MeshEditor::FindFreeBorder (const SMDS_MeshNode* theFirst
//vector<const SMDS_MeshNode*> nodes;
const SMDS_MeshNode *nIgnore = theFirstNode, *nStart = theSecondNode;
set < const SMDS_MeshElement* > foundElems;
TIDSortedElemSet foundElems;
bool needTheLast = ( theLastNode != 0 );
while ( nStart != theLastNode ) {
@ -7185,6 +7645,9 @@ int SMESH_MeshEditor::convertElemToQuadratic(SMESHDS_SubMesh * theSm,
case 4:
NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d);
break;
case 5:
NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], id, theForce3d);
break;
case 6:
NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], aNds[5], id, theForce3d);
break;
@ -7229,7 +7692,6 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d)
SMESH_subMesh* sm = smIt->next();
if ( SMESHDS_SubMesh *smDS = sm->GetSubMeshDS() ) {
aHelper.SetSubShape( sm->GetSubShape() );
if ( !theForce3d) aHelper.SetCheckNodePosition(true);
nbCheckedElems += convertElemToQuadratic(smDS, aHelper, theForce3d);
}
}
@ -7310,6 +7772,10 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d)
NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
aNds[3], id, theForce3d );
break;
case 5:
NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
aNds[3], aNds[4], id, theForce3d);
break;
case 6:
NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
aNds[3], aNds[4], aNds[5], id, theForce3d);
@ -8265,7 +8731,7 @@ bool SMESH_MeshEditor::doubleNodes( SMESHDS_Mesh* theMeshDS,
theNodeNodeMap[ aCurrNode ] = aNewNode;
myLastCreatedNodes.Append( aNewNode );
}
isDuplicate |= (aCurrNode == aNewNode);
isDuplicate |= (aCurrNode != aNewNode);
newNodes[ ind++ ] = aNewNode;
}
if ( !isDuplicate )
@ -8303,6 +8769,95 @@ static bool isInside(const SMDS_MeshElement* theElem,
return (aState == TopAbs_IN || aState == TopAbs_ON );
}
/*!
\brief Creates a hole in a mesh by doubling the nodes of some particular elements
\param theNodes - identifiers of nodes to be doubled
\param theModifiedElems - identifiers of elements to be updated by the new (doubled)
nodes. If list of element identifiers is empty then nodes are doubled but
they not assigned to elements
\return TRUE if operation has been completed successfully, FALSE otherwise
*/
bool SMESH_MeshEditor::DoubleNodes( const std::list< int >& theListOfNodes,
const std::list< int >& theListOfModifiedElems )
{
myLastCreatedElems.Clear();
myLastCreatedNodes.Clear();
if ( theListOfNodes.size() == 0 )
return false;
SMESHDS_Mesh* aMeshDS = GetMeshDS();
if ( !aMeshDS )
return false;
// iterate through nodes and duplicate them
std::map< const SMDS_MeshNode*, const SMDS_MeshNode* > anOldNodeToNewNode;
std::list< int >::const_iterator aNodeIter;
for ( aNodeIter = theListOfNodes.begin(); aNodeIter != theListOfNodes.end(); ++aNodeIter )
{
int aCurr = *aNodeIter;
SMDS_MeshNode* aNode = (SMDS_MeshNode*)aMeshDS->FindNode( aCurr );
if ( !aNode )
continue;
// duplicate node
const SMDS_MeshNode* aNewNode = aMeshDS->AddNode( aNode->X(), aNode->Y(), aNode->Z() );
if ( aNewNode )
{
anOldNodeToNewNode[ aNode ] = aNewNode;
myLastCreatedNodes.Append( aNewNode );
}
}
// Create map of new nodes for modified elements
std::map< SMDS_MeshElement*, vector<const SMDS_MeshNode*> > anElemToNodes;
std::list< int >::const_iterator anElemIter;
for ( anElemIter = theListOfModifiedElems.begin();
anElemIter != theListOfModifiedElems.end(); ++anElemIter )
{
int aCurr = *anElemIter;
SMDS_MeshElement* anElem = (SMDS_MeshElement*)aMeshDS->FindElement( aCurr );
if ( !anElem )
continue;
vector<const SMDS_MeshNode*> aNodeArr( anElem->NbNodes() );
SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
int ind = 0;
while ( anIter->more() )
{
SMDS_MeshNode* aCurrNode = (SMDS_MeshNode*)anIter->next();
if ( aCurr && anOldNodeToNewNode.find( aCurrNode ) != anOldNodeToNewNode.end() )
{
const SMDS_MeshNode* aNewNode = anOldNodeToNewNode[ aCurrNode ];
aNodeArr[ ind++ ] = aNewNode;
}
else
aNodeArr[ ind++ ] = aCurrNode;
}
anElemToNodes[ anElem ] = aNodeArr;
}
// Change nodes of elements
std::map< SMDS_MeshElement*, vector<const SMDS_MeshNode*> >::iterator
anElemToNodesIter = anElemToNodes.begin();
for ( ; anElemToNodesIter != anElemToNodes.end(); ++anElemToNodesIter )
{
const SMDS_MeshElement* anElem = anElemToNodesIter->first;
vector<const SMDS_MeshNode*> aNodeArr = anElemToNodesIter->second;
if ( anElem )
aMeshDS->ChangeElementNodes( anElem, &aNodeArr[ 0 ], anElem->NbNodes() );
}
return true;
}
/*!
\brief Creates a hole in a mesh by doubling the nodes of some particular elements
\param theElems - group of of elements (edges or faces) to be replicated
@ -8317,9 +8872,6 @@ bool SMESH_MeshEditor::DoubleNodesInRegion( const TIDSortedElemSet& theElems,
const TIDSortedElemSet& theNodesNot,
const TopoDS_Shape& theShape )
{
SMESHDS_Mesh* aMesh = GetMeshDS();
if (!aMesh)
return false;
if ( theShape.IsNull() )
return false;
@ -8354,3 +8906,59 @@ bool SMESH_MeshEditor::DoubleNodesInRegion( const TIDSortedElemSet& theElems,
}
return DoubleNodes( theElems, theNodesNot, anAffected );
}
/*!
* \brief Generated skin mesh (containing 2D cells) from 3D mesh
* The created 2D mesh elements based on nodes of free faces of boundary volumes
* \return TRUE if operation has been completed successfully, FALSE otherwise
*/
bool SMESH_MeshEditor::Make2DMeshFrom3D()
{
// iterates on volume elements and detect all free faces on them
SMESHDS_Mesh* aMesh = GetMeshDS();
if (!aMesh)
return false;
bool res = false;
SMDS_VolumeIteratorPtr vIt = aMesh->volumesIterator();
while(vIt->more())
{
const SMDS_MeshVolume* volume = vIt->next();
SMDS_VolumeTool vTool( volume );
const bool isPoly = volume->IsPoly();
const bool isQuad = volume->IsQuadratic();
for ( int iface = 0, n = vTool.NbFaces(); iface < n; iface++ )
{
if (!vTool.IsFreeFace(iface))
continue;
vector<const SMDS_MeshNode *> nodes;
int nbFaceNodes = vTool.NbFaceNodes(iface);
const SMDS_MeshNode** faceNodes = vTool.GetFaceNodes(iface);
if (vTool.IsFaceExternal(iface))
{
int inode = 0;
for ( ; inode < nbFaceNodes; inode += isQuad ? 2 : 1)
nodes.push_back(faceNodes[inode]);
if (isQuad)
for ( inode = 1; inode < nbFaceNodes; inode += 2)
nodes.push_back(faceNodes[inode]);
}
else
{
int inode = nbFaceNodes-1;
for ( ; inode >=0; inode -= isQuad ? 2 : 1)
nodes.push_back(faceNodes[inode]);
if (isQuad)
for ( inode = nbFaceNodes-2; inode >=0; inode -= 2)
nodes.push_back(faceNodes[inode]);
}
// add new face based on volume nodes
if (aMesh->FindFace( nodes ) )
continue; // face already exsist
myLastCreatedElems.Append( AddElement(nodes, SMDSAbs_Face, isPoly && iface == 1) );
res = true;
}
}
return res;
}

View File

@ -55,12 +55,38 @@ typedef std::map<const SMDS_MeshElement*,
std::list<const SMDS_MeshElement*> > TElemOfElemListMap;
typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
//!< Set of elements sorted by ID, to be used to assure predictability of edition
//!< Set of elements sorted by ID, to be used to assure predictability of edition
typedef std::set< const SMDS_MeshElement*, TIDCompare > TIDSortedElemSet;
typedef pair< const SMDS_MeshNode*, const SMDS_MeshNode* > NLink;
//=======================================================================
/*!
* \brief Searcher for the node closest to point
*/
//=======================================================================
struct SMESH_NodeSearcher
{
virtual const SMDS_MeshNode* FindClosestTo( const gp_Pnt& pnt ) = 0;
virtual void MoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt ) = 0;
};
//=======================================================================
/*!
* \brief Return elements of given type where the given point is IN or ON.
*
* 'ALL' type means elements of any type excluding nodes and 0D elements
*/
//=======================================================================
struct SMESH_ElementSearcher
{
virtual void FindElementsByPoint(const gp_Pnt& point,
SMDSAbs_ElementType type,
std::vector< const SMDS_MeshElement* >& foundElems)=0;
};
//=======================================================================
/*!
* \brief A sorted pair of nodes
@ -77,18 +103,6 @@ struct SMESH_TLink: public NLink
const SMDS_MeshNode* node2() const { return second; }
};
// ============================================================
/*!
* \brief Searcher for the node closest to point
*/
// ============================================================
struct SMESH_NodeSearcher
{
virtual const SMDS_MeshNode* FindClosestTo( const gp_Pnt& pnt ) = 0;
};
//=======================================================================
/*!
* auxiliary class
@ -365,6 +379,7 @@ public:
SMESH_Mesh* theTargetMesh=0);
// Move or copy theElements applying theTrsf to their nodes
typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
void FindCoincidentNodes (std::set<const SMDS_MeshNode*> & theNodes,
@ -378,6 +393,16 @@ public:
*/
SMESH_NodeSearcher* GetNodeSearcher();
/*!
* \brief Return SMESH_ElementSearcher
*/
SMESH_ElementSearcher* GetElementSearcher();
/*!
* \brief Return true if the point is IN or ON of the element
*/
static bool isOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol );
int SimplifyFace (const std::vector<const SMDS_MeshNode *> faceNodes,
std::vector<const SMDS_MeshNode *>& poly_nodes,
std::vector<int>& quantities) const;
@ -577,6 +602,9 @@ public:
const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; }
bool DoubleNodes( const std::list< int >& theListOfNodes,
const std::list< int >& theListOfModifiedElems );
bool DoubleNodes( const TIDSortedElemSet& theElems,
const TIDSortedElemSet& theNodesNot,
const TIDSortedElemSet& theAffectedElems );
@ -585,6 +613,13 @@ public:
const TIDSortedElemSet& theNodesNot,
const TopoDS_Shape& theShape );
/*!
* \brief Generated skin mesh (containing 2D cells) from 3D mesh
* The created 2D mesh elements based on nodes of free faces of boundary volumes
* \return TRUE if operation has been completed successfully, FALSE otherwise
*/
bool Make2DMeshFrom3D();
private:
/*!

View File

@ -71,7 +71,7 @@ namespace {
//================================================================================
SMESH_MesherHelper::SMESH_MesherHelper(SMESH_Mesh& theMesh)
: myMesh(&theMesh), myShapeID(0), myCreateQuadratic(false), myCheckNodePos(false)
: myMesh(&theMesh), myShapeID(0), myCreateQuadratic(false)
{
mySetElemOnShape = ( ! myMesh->HasShapeToMesh() );
}
@ -326,9 +326,8 @@ gp_Pnt2d SMESH_MesherHelper::GetUVOnSeam( const gp_Pnt2d& uv1, const gp_Pnt2d& u
* \param F - the face
* \param n - the node
* \param n2 - a node of element being created located inside a face
* \param check - optional flag returing false if found UV are invalid
* \retval gp_XY - resulting UV
*
* Auxilary function called form GetMediumNode()
*/
//=======================================================================
@ -339,37 +338,14 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
{
gp_Pnt2d uv( 1e100, 1e100 );
const SMDS_PositionPtr Pos = n->GetPosition();
bool uvOK = false;
if(Pos->GetTypeOfPosition()==SMDS_TOP_FACE)
{
// node has position on face
const SMDS_FacePosition* fpos =
static_cast<const SMDS_FacePosition*>(n->GetPosition().get());
uv.SetCoord(fpos->GetUParameter(),fpos->GetVParameter());
if ( check && *check )
{
// check that uv is correct
TopLoc_Location loc;
Handle(Geom_Surface) surface = BRep_Tool::Surface( F,loc );
double tol = 2 * BRep_Tool::Tolerance( F );
gp_Pnt nodePnt = XYZ( n );
if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() );
if ( nodePnt.Distance( surface->Value( uv.X(), uv.Y() )) > tol ) {
// uv incorrect, project the node to surface
GeomAPI_ProjectPointOnSurf projector( nodePnt, surface, tol );
if ( !projector.IsDone() || projector.NbPoints() < 1 ) {
MESSAGE( "SMESH_MesherHelper::GetNodeUV() failed to project" )
return uv.XY();
}
Quantity_Parameter U,V;
projector.LowerDistanceParameters(U,V);
if ( nodePnt.Distance( surface->Value( U, V )) > tol )
MESSAGE( "SMESH_MesherHelper::GetNodeUV(), invalid projection" );
uv.SetCoord( U,V );
}
else if ( uv.XY().Modulus() > numeric_limits<double>::min() ) {
*check = false; // parameters are OK, do not check further more
}
}
uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), BRep_Tool::Tolerance( F ));
}
else if(Pos->GetTypeOfPosition()==SMDS_TOP_EDGE)
{
@ -380,14 +356,21 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
static_cast<const SMDS_EdgePosition*>(n->GetPosition().get());
int edgeID = Pos->GetShapeId();
TopoDS_Edge E = TopoDS::Edge(GetMeshDS()->IndexToShape(edgeID));
double f, l;
double f, l, u = epos->GetUParameter();
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
uv = C2d->Value( epos->GetUParameter() );
if ( f < u && u < l )
uv = C2d->Value( u );
else
uv.SetCoord(0.,0.);
uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), BRep_Tool::Tolerance( E ));
// for a node on a seam edge select one of UVs on 2 pcurves
if ( n2 && IsSeamShape( edgeID ) )
{
uv = GetUVOnSeam( uv, GetNodeUV( F, n2, 0 ));
// adjust uv to period
}
else
{ // adjust uv to period
TopLoc_Location loc;
Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
Standard_Boolean isUPeriodic = S->IsUPeriodic();
@ -401,21 +384,21 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
uv.SetY( uv.Y() + ShapeAnalysis::AdjustToPeriod(uv.Y(),VF,VL));
}
}
}
else if(Pos->GetTypeOfPosition()==SMDS_TOP_VERTEX)
{
if ( int vertexID = n->GetPosition()->GetShapeId() ) {
bool ok = true;
const TopoDS_Vertex& V = TopoDS::Vertex(GetMeshDS()->IndexToShape(vertexID));
try {
uv = BRep_Tool::Parameters( V, F );
uvOK = true;
}
catch (Standard_Failure& exc) {
ok = false;
}
if ( !ok ) {
for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !ok && vert.More(); vert.Next() )
ok = ( V == vert.Current() );
if ( !ok ) {
if ( !uvOK ) {
for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !uvOK && vert.More(); vert.Next() )
uvOK = ( V == vert.Current() );
if ( !uvOK ) {
#ifdef _DEBUG_
MESSAGE ( "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID
<< " not in face " << GetMeshDS()->ShapeToIndex( F ) );
@ -423,14 +406,14 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
// get UV of a vertex closest to the node
double dist = 1e100;
gp_Pnt pn = XYZ( n );
for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !ok && vert.More(); vert.Next() ) {
for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !uvOK && vert.More(); vert.Next() ) {
TopoDS_Vertex curV = TopoDS::Vertex( vert.Current() );
gp_Pnt p = BRep_Tool::Pnt( curV );
double curDist = p.SquareDistance( pn );
if ( curDist < dist ) {
dist = curDist;
uv = BRep_Tool::Parameters( curV, F );
if ( dist < DBL_MIN ) break;
uvOK = ( dist < DBL_MIN );
}
}
}
@ -454,9 +437,58 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
uv = GetUVOnSeam( uv, GetNodeUV( F, n2, 0 ));
}
}
if ( check )
*check = uvOK;
return uv.XY();
}
//=======================================================================
/*!
* \brief Check and fix node UV on a face
* \retval bool - false if UV is bad and could not be fixed
*/
//=======================================================================
bool SMESH_MesherHelper::CheckNodeUV(const TopoDS_Face& F,
const SMDS_MeshNode* n,
gp_XY& uv,
const double tol) const
{
if ( !myOkNodePosShapes.count( n->GetPosition()->GetShapeId() ))
{
// check that uv is correct
TopLoc_Location loc;
Handle(Geom_Surface) surface = BRep_Tool::Surface( F,loc );
gp_Pnt nodePnt = XYZ( n );
if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() );
if ( nodePnt.Distance( surface->Value( uv.X(), uv.Y() )) > tol )
{
// uv incorrect, project the node to surface
GeomAPI_ProjectPointOnSurf projector( nodePnt, surface, tol );
if ( !projector.IsDone() || projector.NbPoints() < 1 )
{
MESSAGE( "SMESH_MesherHelper::CheckNodeUV() failed to project" );
return false;
}
Quantity_Parameter U,V;
projector.LowerDistanceParameters(U,V);
if ( nodePnt.Distance( surface->Value( U, V )) > tol )
{
MESSAGE( "SMESH_MesherHelper::CheckNodeUV(), invalid projection" );
return false;
}
uv.SetCoord( U,V );
}
else if ( uv.Modulus() > numeric_limits<double>::min() )
{
((SMESH_MesherHelper*) this)->myOkNodePosShapes.insert( n->GetPosition()->GetShapeId() );
}
}
return true;
}
//=======================================================================
/*!
* \brief Return middle UV taking in account surface period
@ -583,10 +615,12 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1,
F = TopoDS::Face(myShape);
faceID = myShapeID;
}
bool uvOK1, uvOK2;
gp_XY p1 = GetNodeUV(F,n1,n2, &uvOK1);
gp_XY p2 = GetNodeUV(F,n2,n1, &uvOK2);
gp_XY p1 = GetNodeUV(F,n1,n2, &myCheckNodePos);
gp_XY p2 = GetNodeUV(F,n2,n1, &myCheckNodePos);
if ( uvOK1 && uvOK2 )
{
if ( IsDegenShape( Pos1->GetShapeId() ))
p1.SetCoord( myParIndex, p2.Coord( myParIndex ));
else if ( IsDegenShape( Pos2->GetShapeId() ))
@ -601,6 +635,7 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1,
myTLinkNodeMap.insert(make_pair(link,n12));
return n12;
}
}
if (edgeID>0 || shapeType == TopAbs_EDGE) {
TopoDS_Edge E;
@ -611,8 +646,8 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1,
edgeID = myShapeID;
}
double p1 = GetNodeU(E,n1, &myCheckNodePos);
double p2 = GetNodeU(E,n2, &myCheckNodePos);
double p1 = GetNodeU(E,n1);
double p2 = GetNodeU(E,n2);
double f,l;
Handle(Geom_Curve) C = BRep_Tool::Curve(E, f, l);

View File

@ -151,15 +151,6 @@ public:
*/
void SetElementsOnShape(bool toSet) { mySetElemOnShape = toSet; }
/*!
* \brief Enable/disable checking of node parameters on shapes while adding elements.
* In case of incorrect parameters mudium node place is computed as the middle
* of two nodes. Default is false.
* NOTE that this flag is reset to "not to check" if check with non-default partameter
* is successful
*/
void SetCheckNodePosition(bool toCheck) { myCheckNodePos = toCheck; }
/*!
* \brief Set shape to make elements on without calling IsQuadraticSubMesh()
*/
@ -260,6 +251,14 @@ public:
const SMDS_MeshNode* n,
const SMDS_MeshNode* inFaceNode=0,
bool* check=0) const;
/*!
* \brief Check and fix node UV on a face
* \retval bool - false if UV is bad and could not be fixed
*/
bool CheckNodeUV(const TopoDS_Face& F,
const SMDS_MeshNode* n,
gp_XY& uv,
const double tol) const;
/*!
* \brief Return middle UV taking in account surface period
*/
@ -393,7 +392,7 @@ protected:
// to create quadratic elements
bool myCreateQuadratic;
bool mySetElemOnShape;
bool myCheckNodePos;
std::set< int > myOkNodePosShapes;
};

View File

@ -30,19 +30,37 @@
//===========================================================================
/*!
* \brief SMESH_Octree Constructor
* \param maxLevel - The level max the octree can reach (If <0 unlimited)
* Constructor. limit must be provided at tree root construction.
* limit will be deleted by SMESH_Octree.
*/
//===========================================================================
SMESH_Octree::SMESH_Octree (const int maxLevel, const double minBoxSize):
SMESH_Octree::SMESH_Octree (SMESH_Octree::Limit* limit):
myChildren(NULL),
myFather(NULL),
myIsLeaf( false ),
myLimit( limit ),
myLevel(0),
myMaxLevel(maxLevel),
myMinBoxSize(minBoxSize),
myIsLeaf(-1)
myBox(NULL)
{
myBox = new Bnd_B3d();
}
//================================================================================
/*!
* \brief Compute the Octree
*/
//================================================================================
void SMESH_Octree::compute()
{
if ( myLevel==0 )
{
myBox = buildRootBox();
if ( myLimit->myMinBoxSize > 0. && maxSize() <= myLimit->myMinBoxSize )
myIsLeaf = true;
else
buildChildren();
}
}
//======================================
@ -50,85 +68,25 @@ SMESH_Octree::SMESH_Octree (const int maxLevel, const double minBoxSize):
* \brief SMESH_Octree Destructor
*/
//======================================
SMESH_Octree::~SMESH_Octree ()
{
if(myChildren != NULL)
{
if(!myIsLeaf)
if(!isLeaf())
{
for(int i = 0; i<8; i++)
delete myChildren[i];
delete[] myChildren;
myChildren = 0;
}
}
if ( myBox )
delete myBox;
}
//===========================================================================
/*!
* \brief Set the bounding box of the Octree
* \param box - 3d Bounding Box of the Octree
*/
//===========================================================================
void SMESH_Octree::setBox(const Bnd_B3d* box)
{
// delete myBox;
// myBox=new Bnd_B3d(*box);
*myBox = *box;
}
//===========================================================================
/*!
* \brief Set box to the 3d Bounding Box of the Octree
* \param box - Set box to the 3d Bounding Box of the Octree
*/
//===========================================================================
void SMESH_Octree::getBox(Bnd_B3d& box)
{
// if(box != NULL)
// delete box;
// box = new Bnd_B3d (*myBox);
box = *myBox;
}
//===========================================================================
/*!
* \brief Set the max level of the Octree
* \param maxLevel - The level max the octree can reach (If <0 unlimited)
*/
//===========================================================================
void SMESH_Octree::setMaxLevel(const int maxLevel)
{myMaxLevel = maxLevel;}
//===========================================================================
/*!
* \brief Compute the bigger dimension of the box
* \param box - 3d Box
* \retval double - bigger dimension of the box
*/
//===========================================================================
double SMESH_Octree::maxSize(const Bnd_B3d* box)
{
if(box ==NULL)
return 0;
gp_XYZ min = box->CornerMin();
gp_XYZ max = box->CornerMax();
gp_XYZ Size = (max - min);
double returnVal = (Size.X()>Size.Y())?Size.X():Size.Y();
return (returnVal>Size.Z())?returnVal:Size.Z();
}
//=============================
/*!
* \brief Compute the Octree
*/
//=============================
void SMESH_Octree::Compute()
{
// As soon as the Octree is a Leaf, I stop building his children
if(!isLeaf())
buildChildren();
myBox = 0;
if ( level() == 0 )
delete myLimit;
myLimit = 0;
}
//=================================================================
@ -136,8 +94,11 @@ void SMESH_Octree::Compute()
* \brief Build the 8 children boxes and call buildChildrenData()
*/
//=================================================================
void SMESH_Octree::buildChildren()
{
if ( isLeaf() ) return;
myChildren = new SMESH_Octree*[8];
gp_XYZ min = myBox->CornerMin();
@ -147,7 +108,6 @@ void SMESH_Octree::buildChildren()
gp_XYZ childHsize = HSize/2.;
Standard_Real XminChild, YminChild, ZminChild;
Bnd_B3d* box;
gp_XYZ minChild;
for (int i = 0; i < 8; i++)
{
@ -166,19 +126,53 @@ void SMESH_Octree::buildChildren()
ZminChild = (i<4)?min.Z():mid.Z();
minChild.SetCoord(XminChild, YminChild, ZminChild);
box = new Bnd_B3d(minChild+childHsize,childHsize);
// The child is of the same type than its father (For instance, a SMESH_OctreeNode)
// We allocate the memory we need for the child
myChildren[i] = allocateOctreeChild();
// and we assign to him its box.
myChildren[i]->setBox(box);
delete box;
myChildren[i]->myFather = this;
myChildren[i]->myLimit = myLimit;
myChildren[i]->myLevel = myLevel + 1;
myChildren[i]->myBox = new Bnd_B3d(minChild+childHsize,childHsize);
if ( myLimit->myMinBoxSize > 0. && myChildren[i]->maxSize() <= myLimit->myMinBoxSize )
myChildren[i]->myIsLeaf = true;
}
// After building the 8 boxes, we put the data into the children..
// After building the 8 boxes, we put the data into the children.
buildChildrenData();
//After we pass to the next level of the Octree
for (int i = 0; i < 8; i++)
myChildren[i]->Compute();
for (int i = 0; i<8; i++)
myChildren[i]->buildChildren();
}
//================================================================================
/*!
* \brief Tell if Octree is a leaf or not
* An inheriting class can influence it via myIsLeaf protected field
*/
//================================================================================
bool SMESH_Octree::isLeaf() const
{
return myIsLeaf || ((myLimit->myMaxLevel > 0) ? (level() >= myLimit->myMaxLevel) : false );
}
//===========================================================================
/*!
* \brief Compute the bigger dimension of my box
*/
//===========================================================================
double SMESH_Octree::maxSize() const
{
if ( myBox )
{
gp_XYZ min = myBox->CornerMin();
gp_XYZ max = myBox->CornerMax();
gp_XYZ Size = (max - min);
double returnVal = (Size.X()>Size.Y())?Size.X():Size.Y();
return (returnVal>Size.Z())?returnVal:Size.Z();
}
return 0.;
}

View File

@ -34,68 +34,90 @@
class SMESH_Octree {
public:
// Constructor
SMESH_Octree (const int maxLevel = -1, const double minBoxSize = 0.);
// Data limiting the tree height
struct Limit {
// MaxLevel of the Octree
int myMaxLevel;
// Minimal size of the Box
double myMinBoxSize;
// Default:
// maxLevel-> 8^8 = 16777216 terminal trees
// minSize -> box size not checked
Limit(int maxLevel=8, double minSize=0.):myMaxLevel(maxLevel),myMinBoxSize(minSize) {}
virtual ~Limit() {} // it can be inherited
};
// Constructor. limit must be provided at tree root construction.
// limit will be deleted by SMESH_Octree
SMESH_Octree (Limit* limit=0);
// Destructor
virtual ~SMESH_Octree ();
// Tell if Octree is a leaf or not (has to be implemented in inherited classes)
virtual const bool isLeaf() = 0;
// Compute the Octree. Must be called by constructor of inheriting class
void compute();
// Compute the Octree
void Compute();
// Set the maximal level of the Octree
void setMaxLevel(const int maxLevel);
// Set the minimal size of the Box
void setMinBoxSize(const double minBoxSize){myMinBoxSize = minBoxSize;};
// Set the bounding box of the Octree
void setBox(const Bnd_B3d* box);
// Set box to the 3d Bounding Box of the Octree
void getBox(Bnd_B3d & box);
// Compute the bigger dimension of the box
static double maxSize(const Bnd_B3d* box);
// Tell if Octree is a leaf or not.
// An inheriting class can influence it via myIsLeaf protected field
bool isLeaf() const;
// Return its level
int level() const { return myLevel; }
// Get box to the 3d Bounding Box of the Octree
const Bnd_B3d& getBox() const { return *myBox; }
// Compute the bigger dimension of my box
double maxSize() const;
// Return index of a child the given point is in
inline int getChildIndex(double x, double y, double z, const gp_XYZ& boxMiddle)const;
protected:
// Constructor for children (has to be implemented in inherited classes)
virtual SMESH_Octree* allocateOctreeChild() = 0;
// Return box of the whole tree
virtual Bnd_B3d* buildRootBox() = 0;
// Build the 8 children boxes
void buildChildren();
// Constructor for children
virtual SMESH_Octree* allocateOctreeChild() const = 0;
// Build the data in the 8 children (has to be implemented in inherited classes)
// Build the data in the 8 children
virtual void buildChildrenData() = 0;
// members
// Box of the Octree
Bnd_B3d* myBox;
// Array of 8 Octree children
SMESH_Octree** myChildren;
// Point the father, set to NULL for the level 0
SMESH_Octree* myFather;
// Tell us if the Octree is a leaf or not
bool myIsLeaf;
// Tree limit
const Limit* myLimit;
private:
// Build the 8 children boxes recursively
void buildChildren();
// Level of the Octree
int myLevel;
// MaxLevel of the Octree
int myMaxLevel;
// Minimal size of the Box
double myMinBoxSize;
// Tell us if the Octree is a leaf or not (-1 if not initialized)
int myIsLeaf;
Bnd_B3d* myBox;
};
//================================================================================
/*!
* \brief Return index of a child the given point is in
*/
//================================================================================
inline int SMESH_Octree::getChildIndex(double x, double y, double z, const gp_XYZ& mid) const
{
return (x > mid.X()) + ( y > mid.Y())*2 + (z > mid.Z())*4;
}
#endif

View File

@ -46,18 +46,22 @@ using namespace std;
//================================================================
SMESH_OctreeNode::SMESH_OctreeNode (const set<const SMDS_MeshNode*> & theNodes, const int maxLevel,
const int maxNbNodes , const double minBoxSize )
:SMESH_Octree(maxLevel,minBoxSize),
:SMESH_Octree( new SMESH_Octree::Limit( maxLevel,minBoxSize)),
myMaxNbNodes(maxNbNodes),
myNodes(theNodes)
{
// We need to compute the first bounding box via a special method
computeBoxForFather();
myNbNodes = myNodes.size();
myIsLeaf = ((myLevel == myMaxLevel) ||
(myNbNodes <= myMaxNbNodes) ||
(maxSize(myBox) <= myMinBoxSize));
// All the children (Boxes and Data) are computed in Compute()
Compute();
compute();
}
//================================================================================
/*!
* \brief Constructor used to allocate a child
*/
//================================================================================
SMESH_OctreeNode::SMESH_OctreeNode (int maxNbNodes):
SMESH_Octree(), myMaxNbNodes(maxNbNodes)
{
}
//==================================================================================
@ -65,16 +69,10 @@ SMESH_OctreeNode::SMESH_OctreeNode (const set<const SMDS_MeshNode*> & theNodes,
* \brief Construct an empty SMESH_OctreeNode used by SMESH_Octree::buildChildren()
*/
//==================================================================================
SMESH_Octree* SMESH_OctreeNode::allocateOctreeChild()
SMESH_Octree* SMESH_OctreeNode::allocateOctreeChild() const
{
SMESH_OctreeNode * theOctree = new SMESH_OctreeNode();
theOctree->myFather = this;
theOctree->myLevel = myLevel + 1;
theOctree->myMaxLevel = myMaxLevel;
theOctree->myMaxNbNodes = myMaxNbNodes;
theOctree->myMinBoxSize = myMinBoxSize;
theOctree->myNbNodes = 0;
return theOctree;
return new SMESH_OctreeNode(myMaxNbNodes);
}
//======================================
@ -84,25 +82,20 @@ SMESH_Octree* SMESH_OctreeNode::allocateOctreeChild()
* We take the max/min coord of the nodes
*/
//======================================
void SMESH_OctreeNode::computeBoxForFather()
Bnd_B3d* SMESH_OctreeNode::buildRootBox()
{
Bnd_B3d* box = new Bnd_B3d;
set<const SMDS_MeshNode*>::iterator it = myNodes.begin();
for (; it != myNodes.end(); it++) {
const SMDS_MeshNode* n1 = *it;
gp_XYZ p1( n1->X(), n1->Y(), n1->Z() );
myBox->Add(p1);
box->Add(p1);
}
}
if ( myNodes.size() <= myMaxNbNodes )
myIsLeaf = true;
//====================================================================================
/*!
* \brief Tell if Octree is a leaf or not (has to be implemented in inherited classes)
* \retval - True if the Octree is a leaf
*/
//====================================================================================
const bool SMESH_OctreeNode::isLeaf()
{
return myIsLeaf;
return box;
}
//====================================================================================
@ -113,19 +106,15 @@ const bool SMESH_OctreeNode::isLeaf()
* \retval bool - True if Node is in the box within precision
*/
//====================================================================================
const bool SMESH_OctreeNode::isInside (const SMDS_MeshNode * Node, const double precision)
{
double X = Node->X();
double Y = Node->Y();
double Z = Node->Z();
bool Out = 1 ;
gp_XYZ p (Node->X(),Node->Y(),Node->Z());
if (precision <= 0.)
return !(myBox->IsOut(gp_XYZ(X,Y,Z)));
Bnd_B3d BoxWithPrecision;
getBox(BoxWithPrecision);
return !(getBox().IsOut(p));
Bnd_B3d BoxWithPrecision = getBox();
BoxWithPrecision.Enlarge(precision);
Out = BoxWithPrecision.IsOut(gp_XYZ(X,Y,Z));
return !(Out);
return ! BoxWithPrecision.IsOut(p);
}
//================================================
@ -136,16 +125,15 @@ const bool SMESH_OctreeNode::isInside (const SMDS_MeshNode * Node, const double
//================================================
void SMESH_OctreeNode::buildChildrenData()
{
gp_XYZ min = myBox->CornerMin();
gp_XYZ max = myBox->CornerMax();
gp_XYZ min = getBox().CornerMin();
gp_XYZ max = getBox().CornerMax();
gp_XYZ mid = (min + max)/2.;
set<const SMDS_MeshNode*>::iterator it = myNodes.begin();
int ChildBoxNum;
while (it != myNodes.end())
{
const SMDS_MeshNode* n1 = *it;
ChildBoxNum = (n1->X() > mid.X()) + (n1->Y() > mid.Y())*2 + (n1->Z() > mid.Z())*4;
int ChildBoxNum = getChildIndex( n1->X(), n1->Y(), n1->Z(), mid );
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[ChildBoxNum]);
myChild->myNodes.insert(myChild->myNodes.end(),n1);
myNodes.erase( it );
@ -154,10 +142,8 @@ void SMESH_OctreeNode::buildChildrenData()
for (int i = 0; i < 8; i++)
{
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[i]);
myChild->myNbNodes = (myChild->myNodes).size();
myChild->myIsLeaf = ((myChild->myLevel == myMaxLevel) ||
(myChild->myNbNodes <= myMaxNbNodes) ||
(maxSize(myChild->myBox) <= myMinBoxSize));
if ( myChild->myNodes.size() <= myMaxNbNodes )
myChild->myIsLeaf = true;
}
}
@ -175,7 +161,7 @@ void SMESH_OctreeNode::NodesAround (const SMDS_MeshNode * Node,
{
if (isInside(Node,precision))
{
if (myIsLeaf)
if (isLeaf())
{
Result->insert(Result->end(), myNodes.begin(), myNodes.end());
}
@ -190,6 +176,61 @@ void SMESH_OctreeNode::NodesAround (const SMDS_MeshNode * Node,
}
}
//================================================================================
/*!
* \brief Return in dist2Nodes nodes mapped to their square distance from Node
* \param node - node to find nodes closest to
* \param dist2Nodes - map of found nodes and their distances
* \param precision - radius of a sphere to check nodes inside
* \retval bool - true if an exact overlapping found
*/
//================================================================================
bool SMESH_OctreeNode::NodesAround(const SMDS_MeshNode * node,
map<double, const SMDS_MeshNode*>& dist2Nodes,
double precision)
{
if ( !dist2Nodes.empty() )
precision = min ( precision, sqrt( dist2Nodes.begin()->first ));
else if ( precision == 0. )
precision = maxSize() / 2;
if (isInside(node,precision))
{
if (!isLeaf())
{
// first check a child containing node
gp_XYZ mid = (getBox().CornerMin() + getBox().CornerMax()) / 2.;
int nodeChild = getChildIndex( node->X(), node->Y(), node->Z(), mid );
if ( ((SMESH_OctreeNode*) myChildren[nodeChild])->NodesAround(node, dist2Nodes, precision))
return true;
for (int i = 0; i < 8; i++)
if ( i != nodeChild )
if (((SMESH_OctreeNode*) myChildren[i])->NodesAround(node, dist2Nodes, precision))
return true;
}
else if ( NbNodes() > 0 )
{
double minDist = precision * precision;
gp_Pnt p1 ( node->X(), node->Y(), node->Z() );
set<const SMDS_MeshNode*>::iterator nIt = myNodes.begin();
for ( ; nIt != myNodes.end(); ++nIt )
{
gp_Pnt p2 ( (*nIt)->X(), (*nIt)->Y(), (*nIt)->Z() );
double dist2 = p1.SquareDistance( p2 );
if ( dist2 < minDist )
dist2Nodes.insert( make_pair( minDist = dist2, *nIt ));
}
// if ( dist2Nodes.size() > 1 ) // leave only closest node in dist2Nodes
// dist2Nodes.erase( ++dist2Nodes.begin(), dist2Nodes.end());
return ( sqrt( minDist) <= precision * 1e-12 );
}
}
return false;
}
//=============================
/*!
* \brief Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance
@ -202,15 +243,14 @@ void SMESH_OctreeNode::NodesAround (const SMDS_MeshNode * Node,
* \param maxNbNodes - maximum Nodes in a Leaf of the SMESH_OctreeNode constructed, default value is 5
*/
//=============================
void SMESH_OctreeNode::FindCoincidentNodes (set<const SMDS_MeshNode*> theSetOfNodes,
void SMESH_OctreeNode::FindCoincidentNodes (set<const SMDS_MeshNode*>& theSetOfNodes,
list< list< const SMDS_MeshNode*> >* theGroupsOfNodes,
const double theTolerance,
const int maxLevel,
const int maxNbNodes)
{
SMESH_OctreeNode* theOctreeNode = new SMESH_OctreeNode(theSetOfNodes, maxLevel, maxNbNodes, theTolerance);
theOctreeNode->FindCoincidentNodes (&theSetOfNodes, theTolerance, theGroupsOfNodes);
delete theOctreeNode;
SMESH_OctreeNode theOctreeNode(theSetOfNodes, maxLevel, maxNbNodes, theTolerance);
theOctreeNode.FindCoincidentNodes (&theSetOfNodes, theTolerance, theGroupsOfNodes);
}
//=============================
@ -285,7 +325,7 @@ void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
if (isInsideBool)
{
// I'm only looking in the leaves, since all the nodes are stored there.
if (myIsLeaf)
if (isLeaf())
{
gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
@ -333,6 +373,43 @@ void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
}
}
//================================================================================
/*!
* \brief Update data according to node movement
*/
//================================================================================
void SMESH_OctreeNode::UpdateByMoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt )
{
if ( isLeaf() )
{
set<const SMDS_MeshNode*>::iterator pNode = myNodes.find( node );
bool nodeInMe = ( pNode != myNodes.end() );
SMDS_MeshNode pointNode( toPnt.X(), toPnt.Y(), toPnt.Z() );
bool pointInMe = isInside( &pointNode, 1e-10 );
if ( pointInMe != nodeInMe )
{
if ( pointInMe )
myNodes.insert( node );
else
myNodes.erase( node );
}
}
else if ( myChildren )
{
gp_XYZ mid = (getBox().CornerMin() + getBox().CornerMax()) / 2.;
int nodeChild = getChildIndex( node->X(), node->Y(), node->Z(), mid );
int pointChild = getChildIndex( toPnt.X(), toPnt.Y(), toPnt.Z(), mid );
if ( nodeChild != pointChild )
{
((SMESH_OctreeNode*) myChildren[ nodeChild ])->UpdateByMoveNode( node, toPnt );
((SMESH_OctreeNode*) myChildren[ pointChild ])->UpdateByMoveNode( node, toPnt );
}
}
}
//================================================================================
/*!
* \brief Return iterator over children
@ -342,7 +419,7 @@ SMESH_OctreeNodeIteratorPtr SMESH_OctreeNode::GetChildrenIterator()
{
return SMESH_OctreeNodeIteratorPtr
( new SMDS_SetIterator< SMESH_OctreeNode*, SMESH_Octree** >
( myChildren, ( isLeaf() ? myChildren : &myChildren[ 8 ] )));
( myChildren, (( isLeaf() || !myChildren ) ? myChildren : &myChildren[ 8 ] )));
}
//================================================================================
@ -354,5 +431,5 @@ SMDS_NodeIteratorPtr SMESH_OctreeNode::GetNodeIterator()
{
return SMDS_NodeIteratorPtr
( new SMDS_SetIterator< SMDS_pNode, set< SMDS_pNode >::const_iterator >
( myNodes.begin(), myNodes.end() ));
( myNodes.begin(), myNodes.size() ? myNodes.end() : myNodes.begin()));
}

View File

@ -34,6 +34,7 @@
#include <list>
#include <set>
#include <map>
#include "SMDS_ElemIterator.hxx"
@ -44,7 +45,7 @@ class SMESH_OctreeNode;
typedef SMDS_Iterator<SMESH_OctreeNode*> SMESH_OctreeNodeIterator;
typedef boost::shared_ptr<SMESH_OctreeNodeIterator> SMESH_OctreeNodeIteratorPtr;
class SMESH_OctreeNode : public SMESH_Octree{
class SMESH_OctreeNode : public SMESH_Octree {
public:
@ -59,9 +60,6 @@ public:
//=============================
virtual ~SMESH_OctreeNode () {};
// Tells us if SMESH_OctreeNode is a leaf or not (-1 = not initialiazed)
virtual const bool isLeaf();
// Tells us if Node is inside the current box with the precision "precision"
virtual const bool isInside(const SMDS_MeshNode * Node, const double precision = 0.);
@ -70,6 +68,11 @@ public:
std::list<const SMDS_MeshNode*>* Result,
const double precision = 0.);
// Return in dist2Nodes nodes mapped to their square distance from Node
bool NodesAround(const SMDS_MeshNode * Node,
std::map<double, const SMDS_MeshNode*>& dist2Nodes,
double precision);
// Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance
// Search for all the nodes in nodes
void FindCoincidentNodes ( std::set<const SMDS_MeshNode*>* nodes,
@ -78,10 +81,15 @@ public:
// Static method that return in theGroupsOfNodes a list of group of nodes close to each other within
// theTolerance search for all the nodes in nodes
static void FindCoincidentNodes ( std::set<const SMDS_MeshNode*> nodes,
static void FindCoincidentNodes ( std::set<const SMDS_MeshNode*>& nodes,
std::list< std::list< const SMDS_MeshNode*> >* theGroupsOfNodes,
const double theTolerance = 0.00001, const int maxLevel = -1,
const double theTolerance = 0.00001,
const int maxLevel = -1,
const int maxNbNodes = 5);
/*!
* \brief Update data according to node movement
*/
void UpdateByMoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt );
/*!
* \brief Return iterator over children
*/
@ -93,25 +101,20 @@ public:
/*!
* \brief Return nb nodes in a tree
*/
int NbNodes() const { return myNbNodes; }
int NbNodes() const { return myNodes.size(); }
protected:
//=============================
/*!
* \brief Empty constructor
*/
//=============================
SMESH_OctreeNode (){};
SMESH_OctreeNode (int maxNbNodes );
// Compute the bounding box of the whole set of nodes myNodes
virtual Bnd_B3d* buildRootBox();
// Shares the father's data with each of his child
virtual void buildChildrenData();
// Compute the bounding box of the whole set of nodes myNodes (only used for OctreeNode level 0)
void computeBoxForFather();
// Construct an empty SMESH_OctreeNode used by SMESH_Octree::buildChildren()
virtual SMESH_Octree* allocateOctreeChild();
virtual SMESH_Octree* allocateOctreeChild() const;
// Return in result a list of nodes closed to Node and remove it from SetOfNodes
void FindCoincidentNodes( const SMDS_MeshNode * Node,
@ -125,8 +128,6 @@ protected:
// The set of nodes inside the box of the Octree (Empty if Octree is not a leaf)
std::set<const SMDS_MeshNode*> myNodes;
// The number of nodes I have inside the box
int myNbNodes;
};
#endif

View File

@ -947,6 +947,12 @@ SMESH_Hypothesis::Hypothesis_Status
break;
}
case REMOVE_FATHER_ALGO: {
// IPAL21346. Edges not removed when Netgen 1d-2d is removed from a SOLID.
// CLEAN was not called at event REMOVE_ALGO because the algo is not applicable to SOLID.
algo = dynamic_cast<SMESH_Algo*> (anHyp);
if (!algo->NeedDescretBoundary())
needFullClean = true;
algo = gen->GetAlgo((*_father), _subShape);
if (algo == NULL) // no more applying algo on father
{

View File

@ -30,7 +30,6 @@
enum SMESHDS_CommandType {
SMESHDS_AddNode,
SMESHDS_Add0DElement,
SMESHDS_AddEdge,
SMESHDS_AddTriangle,
SMESHDS_AddQuadrangle,
@ -54,7 +53,9 @@ enum SMESHDS_CommandType {
SMESHDS_AddQuadTetrahedron,
SMESHDS_AddQuadPyramid,
SMESHDS_AddQuadPentahedron,
SMESHDS_AddQuadHexahedron
SMESHDS_AddQuadHexahedron,
// special type for 0D elements
SMESHDS_Add0DElement
};

View File

@ -91,6 +91,7 @@ salomeinclude_HEADERS = \
SMESHGUI_MeshEditPreview.h \
SMESHGUI_IdValidator.h \
SMESHGUI_MeshInfosBox.h \
SMESHGUI_Make2DFrom3DOp.h \
SMESH_SMESHGUI.hxx
# Libraries targets
@ -159,7 +160,8 @@ dist_libSMESH_la_SOURCES = \
SMESHGUI_MeshEditPreview.cxx \
SMESHGUI_GroupOnShapeDlg.cxx \
SMESHGUI_FileInfoDlg.cxx \
SMESHGUI_MeshInfosBox.cxx
SMESHGUI_MeshInfosBox.cxx \
SMESHGUI_Make2DFrom3DOp.cxx
MOC_FILES = \
SMESHGUI_moc.cxx \
@ -212,7 +214,8 @@ MOC_FILES = \
SMESHGUI_MakeNodeAtPointDlg_moc.cxx \
SMESHGUI_GroupOnShapeDlg_moc.cxx \
SMESHGUI_FileInfoDlg_moc.cxx \
SMESHGUI_MeshInfosBox_moc.cxx
SMESHGUI_MeshInfosBox_moc.cxx \
SMESHGUI_Make2DFrom3DOp_moc.cxx
nodist_libSMESH_la_SOURCES= \
$(MOC_FILES)

View File

@ -67,6 +67,7 @@
#include "SMESHGUI_BuildCompoundDlg.h"
#include "SMESHGUI_ComputeDlg.h"
#include "SMESHGUI_FileInfoDlg.h"
#include "SMESHGUI_Make2DFrom3DOp.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_MeshUtils.h"
@ -1244,6 +1245,16 @@ void SMESHGUI::EmitSignalCloseAllDialogs()
emit SignalCloseAllDialogs();
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESHGUI::EmitSignalVisibilityChanged()
{
emit SignalVisibilityChanged();
}
//=============================================================================
/*!
*
@ -1293,16 +1304,6 @@ SalomeApp_Study* SMESHGUI::activeStudy()
return NULL;
}
//=============================================================================
/*!
*
*/
//=============================================================================
char* SMESHGUI::JoinObjectParameters(const QStringList& theParametersList)
{
return theParametersList.join(":").toLatin1().data();
}
//=============================================================================
/*!
*
@ -1550,8 +1551,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
for ( ; It.More(); It.Next()) {
Handle(SALOME_InteractiveObject) IOS = It.Value();
if (IOS->hasEntry()) {
if (!SMESH::UpdateView(anAction, IOS->getEntry()))
if (!SMESH::UpdateView(anAction, IOS->getEntry())) {
SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged();
break; // PAL16774 (Crash after display of many groups)
}
if (anAction == SMESH::eDisplayOnly)
anAction = SMESH::eDisplay;
}
@ -1559,8 +1562,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}
// PAL13338 + PAL15161 -->
if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy))
if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy)) {
SMESH::UpdateView();
SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged();
}
// PAL13338 + PAL15161 <--
}
catch (...) { // PAL16774 (Crash after display of many groups)
@ -1773,6 +1778,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}*/
break;
}
case 418: // create 2D mesh from 3D
{
startOperation( 418 );
break;
}
case 806: // CREATE GEO GROUP
{
startOperation( 806 );
@ -2768,6 +2778,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 415, "MAP", "ICON_MAP" );
createSMESHAction( 416, "EXTRUSION_ALONG", "ICON_EXTRUSION_ALONG" );
createSMESHAction( 417, "CONV_TO_QUAD", "ICON_CONV_TO_QUAD" );
createSMESHAction( 418, "2D_FROM_3D", "ICON_2D_FROM_3D" );
createSMESHAction( 200, "RESET" );
createSMESHAction( 201, "SCALAR_BAR_PROP" );
createSMESHAction( 211, "WIRE", "ICON_WIRE", 0, true );
@ -2937,6 +2948,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 414, modifyId, -1 );
createMenu( 415, modifyId, -1 );
createMenu( 417, modifyId, -1 );
createMenu( 418, modifyId, -1 );
createMenu( 214, viewId, -1 );
@ -3033,6 +3045,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( 414, modifyTb );
createTool( 415, modifyTb );
createTool( 417, modifyTb );
createTool( 418, modifyTb );
createTool( 214, dispModeTb );
@ -3059,6 +3072,19 @@ void SMESHGUI::initialize( CAM_Application* app )
hyp_alg = hypo + " " + algo;
// popup for object browser
QString
isInvisible("not( isVisible )"),
isEmpty("numberOfNodes = 0"),
isNotEmpty("numberOfNodes <> 0"),
// has nodes, edges, etc in VISIBLE! actor
hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"),
hasElems("(count( elemTypes ) > 0)"),
hasDifferentElems("(count( elemTypes ) > 1)"),
hasElems0d("({'Elem0d'} in elemTypes)"),
hasEdges("({'Edge'} in elemTypes)"),
hasFaces("({'Face'} in elemTypes)"),
hasVolumes("({'Volume'} in elemTypes)");
createPopupItem( 150, OB, mesh, "&& selcount=1 && isImported" ); // FILE INFORMATION
createPopupItem( 703, OB, mesh, "&& isComputable"); // CREATE_SUBMESH
@ -3087,6 +3113,9 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 4043, OB, mesh ); // CLEAR_MESH
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 417, OB, mesh/*, "&& " + hasElems*/); // convert to quadratic
createPopupItem( 418, OB, mesh/*, "&& " + hasVolumes*/); // create 2D mesh on 3D
popupMgr()->insert( separator(), -1, 0 );
QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc );
@ -3114,20 +3143,6 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert( separator(), -1, 0 );
int anId;
QString
isInvisible("not( isVisible )"),
isEmpty("numberOfNodes = 0"),
isNotEmpty("numberOfNodes <> 0"),
// has nodes, edges, etc in VISIBLE! actor
hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"),
hasElems("(count( elemTypes ) > 0)"),
hasDifferentElems("(count( elemTypes ) > 1)"),
hasElems0d("({'Elem0d'} in elemTypes)"),
hasEdges("({'Edge'} in elemTypes)"),
hasFaces("({'Face'} in elemTypes)"),
hasVolumes("({'Volume'} in elemTypes)");
QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" );
QString aType = QString( "%1type in {%2}" ).arg( lc );
aType = aType.arg( mesh_group );
@ -3900,6 +3915,9 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const
case 417: //convert to quadratic
op = new SMESHGUI_ConvToQuadOp();
break;
case 418: // create 2D mesh as boundary on 3D
op = new SMESHGUI_Make2DFrom3DOp();
break;
case 4067: // make mesh pass through point
op = new SMESHGUI_MakeNodeAtPointOp();
break;

View File

@ -70,7 +70,6 @@ public :
static SUIT_ResourceMgr* resourceMgr();
static SUIT_Desktop* desktop();
static SalomeApp_Study* activeStudy();
static char* JoinObjectParameters(const QStringList& theParametersList);
bool isActiveStudyLocked();
@ -104,6 +103,7 @@ public :
void EmitSignalDeactivateDialog();
void EmitSignalStudyFrameChanged();
void EmitSignalCloseAllDialogs();
void EmitSignalVisibilityChanged();
virtual void contextMenuPopup( const QString&, QMenu*, QString& );
virtual void createPreferences();
@ -132,6 +132,7 @@ signals:
void SignalDeactivateActiveDialog();
void SignalStudyFrameChanged();
void SignalCloseAllDialogs();
void SignalVisibilityChanged();
protected:
void createSMESHAction( const int,

View File

@ -289,6 +289,8 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
if (!isValid())
return false;
SMESH::SMESH_Mesh_var aCompoundMesh;
if (!myMesh->_is_nil()) {
QStringList aParameters;
aParameters << (CheckBoxMerge->isChecked() ? SpinBoxTol->text() : QString(" "));
@ -297,7 +299,6 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
// concatenate meshes
SMESH::SMESH_Mesh_var aCompoundMesh;
if(CheckBoxCommon->isChecked())
aCompoundMesh = aSMESHGen->ConcatenateWithGroups(myMeshArray,
!(ComboBoxUnion->currentIndex()),
@ -309,7 +310,7 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
CheckBoxMerge->isChecked(),
SpinBoxTol->GetValue());
aCompoundMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
aCompoundMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() );
mySMESHGUI->updateObjBrowser();
@ -319,8 +320,16 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
LineEditName->setText(GetDefaultName(tr("COMPOUND_MESH")));
//mySelectionMgr->clearSelected();
// IPAL21468 Compound is hidden after creation.
if ( SMESHGUI::automaticUpdate() ) {
mySelectionMgr->clearSelected();
SMESH::UpdateView();
_PTR(SObject) aSO = SMESH::FindSObject(aCompoundMesh.in());
if ( SMESH_Actor* anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str()) )
SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
}// end IPAL21468
return true;
}
return false;

View File

@ -72,7 +72,7 @@
class OrientedPlane: public vtkPlane
{
SVTK_ViewWindow* myViewWindow;
QPointer<SVTK_ViewWindow> myViewWindow;
vtkDataSetMapper* myMapper;
@ -168,6 +168,7 @@ protected:
}
~OrientedPlane(){
if (myViewWindow)
myViewWindow->RemoveActor(myActor);
myActor->Delete();

View File

@ -1166,6 +1166,8 @@ SMESHGUI_ComputeOp::~SMESHGUI_ComputeOp()
void SMESHGUI_ComputeOp::startOperation()
{
SMESHGUI_BaseComputeOp::startOperation();
if (myMesh->_is_nil())
return;
computeMesh();
}
@ -1268,6 +1270,8 @@ void SMESHGUI_PrecomputeOp::startOperation()
}
SMESHGUI_BaseComputeOp::startOperation();
if (myMesh->_is_nil())
return;
// disconnect slot from preview dialog to have Apply from results of compute operation only
disconnect( myDlg, SIGNAL( dlgOk() ), this, SLOT( onOk() ) );
@ -1647,6 +1651,8 @@ void SMESHGUI_EvaluateOp::startOperation()
{
SMESHGUI_BaseComputeOp::evaluateDlg();
SMESHGUI_BaseComputeOp::startOperation();
if (myMesh->_is_nil())
return;
evaluateMesh();
}
@ -1664,7 +1670,7 @@ LightApp_Dialog* SMESHGUI_EvaluateOp::dlg() const
//================================================================================
/*!
* \brief evaluaateMesh()
* \brief evaluateMesh()
*/
//================================================================================
@ -1681,9 +1687,12 @@ void SMESHGUI_BaseComputeOp::evaluateMesh()
SMESH::long_array_var aRes;
_PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
if ( !aMeshSObj ) // IPAL21340
return;
bool hasShape = myMesh->HasShapeToMesh();
bool shapeOK = myMainShape->_is_nil() ? !hasShape : hasShape;
if ( shapeOK && aMeshSObj )
if ( shapeOK )
{
myCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() );
SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen();

View File

@ -32,9 +32,10 @@
#include <SMESH_TypeFilter.hxx>
// SALOME GUI includes
#include <SalomeApp_Tools.h>
#include <SUIT_MessageBox.h>
#include <LightApp_UpdateFlags.h>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
#include <SalomeApp_Tools.h>
// IDL includes
#include <SALOMEconfig.h>
@ -176,6 +177,7 @@ SUIT_SelectionFilter* SMESHGUI_ConvToQuadOp::createFilter( const int theId ) con
//================================================================================
bool SMESHGUI_ConvToQuadOp::onApply()
{
SUIT_OverrideCursor aWaitCursor;
QString aMess;

View File

@ -44,7 +44,7 @@ class SMESHGUI_EXPORT SMESHGUI_Dialog : public LightApp_Dialog
Q_OBJECT
public:
SMESHGUI_Dialog( QWidget* = 0, const bool = false, const bool = false,
SMESHGUI_Dialog( QWidget* = 0, const bool modal = false, const bool allowResize = false,
const int = OK | Close | Apply | Help );
virtual ~SMESHGUI_Dialog();

View File

@ -621,7 +621,7 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK )
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
//wc.stop();
wc.suspend();

View File

@ -558,7 +558,7 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
}
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
} catch (...) {
}

View File

@ -2632,7 +2632,13 @@ void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg,
//=======================================================================
void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_var theMesh)
{
if ( !theMesh->_is_nil() ) {
myMesh = theMesh;
if ( !myFilter[ myTable->GetType() ]->_is_nil() && !myFilter[ myTable->GetType() ]->GetPredicate()->_is_nil() ) {
SMESH::Predicate_ptr aPred = myFilter[ myTable->GetType() ]->GetPredicate();
aPred->SetMesh(myMesh);
}
}
const bool isEnable = !(myMesh->_is_nil());
myButtons[BTN_OK]->setEnabled(isEnable);
myButtons[BTN_Apply]->setEnabled(isEnable);

View File

@ -109,8 +109,7 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
myIsBusy( false ),
myNameChanged( false ),
myActor( 0 )
myNameChanged( false )
{
initDialog( true );
if ( !theMesh->_is_nil() )
@ -413,6 +412,7 @@ void SMESHGUI_GroupDlg::initDialog( bool create)
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onClose()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
connect(mySMESHGUI, SIGNAL(SignalVisibilityChanged()), this, SLOT(onVisibilityChanged()));
rb1->setChecked(true); // VSR !!!
onGrpTypeChanged(0); // VSR!!!
@ -552,11 +552,12 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
// actor of theGroup, if it is visible, else try
// any visible actor of group or submesh of myMesh
// commented, because an attempt to set selection on not displayed cells leads to error
//SetAppropriateActor();
myActor = SMESH::FindActorByObject(myMesh);
if ( !myActor )
myActor = SMESH::FindActorByObject(theGroup);
SMESH::SetPickable(myActor);
SetAppropriateActor();
/* SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
if ( !anActor )
anActor = SMESH::FindActorByObject(theGroup);
SMESH::SetPickable(anActor);*/
int grpType = (!myGroup->_is_nil() ? 0 : (theIsConvert ? 0 : 1));
myGrpTypeGroup->button(grpType)->setChecked(true);
@ -685,15 +686,21 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
if (mySelectionMode != theMode) {
// [PAL10408] mySelectionMgr->clearSelected();
mySelectionMgr->clearFilters();
if (myActor)
myActor->SetPointRepresentation(false);
if (myActorsList.count() > 0) {
QListIterator<SMESH_Actor*> it( myActorsList );
while ( it.hasNext() )
it.next()->SetPointRepresentation(false);
}
else
SMESH::SetPointRepresentation(false);
if (theMode < 4) {
switch (theMode) {
case 0:
if (myActor)
myActor->SetPointRepresentation(true);
if (myActorsList.count() > 0) {
QListIterator<SMESH_Actor*> it( myActorsList );
while ( it.hasNext() )
it.next()->SetPointRepresentation(true);
}
else
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
@ -972,8 +979,8 @@ void SMESHGUI_GroupDlg::onOK()
//=================================================================================
void SMESHGUI_GroupDlg::onListSelectionChanged()
{
// MESSAGE( "SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor);
if( myIsBusy || !myActor) return;
//MESSAGE( "SMESHGUI_GroupDlg::onListSelectionChanged(); myActorsList.count() = " << myActorsList.count());
if( myIsBusy || myActorsList.count() == 0 ) return;
myIsBusy = true;
if (myCurrentLineEdit == 0) {
@ -982,9 +989,9 @@ void SMESHGUI_GroupDlg::onListSelectionChanged()
QList<QListWidgetItem*> selItems = myElements->selectedItems();
QListWidgetItem* anItem;
foreach(anItem, selItems) aIndexes.Add(anItem->text().toInt());
mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, false);
mySelector->AddOrRemoveIndex(myActorsList.first()->getIO(), aIndexes, false);
SALOME_ListIO aList;
aList.Append(myActor->getIO());
aList.Append(myActorsList.first()->getIO());
mySelectionMgr->setSelectedObjects(aList,false);
}
myIsBusy = false;
@ -1055,6 +1062,10 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
myIsBusy = false;
return;
}
if ( myFilterDlg && !myMesh->_is_nil()){
myFilterDlg->SetMesh( myMesh );
}
myGroup = SMESH::SMESH_Group::_nil();
// NPAL19389: create a group with a selection in another group
@ -1080,7 +1091,6 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
return;
}
myIsBusy = false;
myCurrentLineEdit = 0;
myGroup = SMESH::SMESH_Group::_nil();
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
@ -1218,13 +1228,12 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
}
else // !myCurrentLineEdit: local selection of nodes or elements
{
if (aNbSel == 1 && myActor && myActor->hasIO())
if (aNbSel == 1 && myActorsList.count() > 0 )
{
#ifdef ENABLE_SWITCH_ACTOR_DURING_ELEMENTS_SELECTION
// NPAL19389: create a group with a selection in another group
// Switch myActor to the newly selected one, if the last
// is visible and belongs to group or submesh of myMesh
Handle(SALOME_InteractiveObject) curIO = myActor->getIO();
/* Handle(SALOME_InteractiveObject) curIO = myActor->getIO();
Handle(SALOME_InteractiveObject) selIO = aList.First();
if (curIO->hasEntry() && selIO->hasEntry()) {
const char* selEntry = selIO->getEntry();
@ -1251,16 +1260,25 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
}
}
}
}
}*/
// NPAL19389 END
#endif // ENABLE_SWITCH_ACTOR_DURING_ELEMENTS_SELECTION
QString aListStr = "";
int aNbItems = 0;
if (myTypeId == 0) {
aNbItems = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
QListIterator<SMESH_Actor*> it( myActorsList );
while ( it.hasNext() ) {
QString tmpStr;
aNbItems += SMESH::GetNameOfSelectedNodes(mySelector, it.next()->getIO(), tmpStr);
aListStr += tmpStr;
}
} else {
aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr);
QListIterator<SMESH_Actor*> it( myActorsList );
while ( it.hasNext() ) {
QString tmpStr;
aNbItems += SMESH::GetNameOfSelectedElements(mySelector, it.next()->getIO(), tmpStr);
aListStr += tmpStr;
}
}
if (aNbItems > 0) {
QListWidgetItem* anItem;
@ -1282,19 +1300,34 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
}
}
if (!myActor) {
if (!myGroup->_is_nil())
myActor = SMESH::FindActorByObject(myGroup);
else if(!myGroupOnGeom->_is_nil())
myActor = SMESH::FindActorByObject(myGroupOnGeom);
else
myActor = SMESH::FindActorByObject(myMesh);
if (myActorsList.count() == 0) {
if (!myGroup->_is_nil()) {
SMESH_Actor* anActor = SMESH::FindActorByObject(myGroup);
if ( anActor )
myActorsList.append( anActor );
}
else if(!myGroupOnGeom->_is_nil()) {
SMESH_Actor* anActor = SMESH::FindActorByObject(myGroupOnGeom);
if ( anActor )
myActorsList.append( anActor );
}
else {
SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
if ( anActor )
myActorsList.append( anActor );
}
}
// somehow, if we display the mesh, while selecting from another actor,
// the mesh becomes pickable, and there is no way to select any element
if (myActor)
SMESH::SetPickable(myActor);
if (myActorsList.count() > 0) {
QListIterator<SMESH_Actor*> it( myActorsList );
while ( it.hasNext() ) {
SMESH_Actor* anActor = it.next();
if ( IsActorVisible(anActor) )
anActor->SetPickable(true);
}
}
myIsBusy = false;
}
@ -1387,11 +1420,14 @@ void SMESHGUI_GroupDlg::setCurrentSelection()
QPushButton* send = (QPushButton*)sender();
myCurrentLineEdit = 0;
if (send == myMeshGroupBtn) {
myCurrentLineEdit = myMeshGroupLine;
disconnect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
mySelectionMgr->clearSelected();
if (myCreate)
setSelectionMode(6);
else
setSelectionMode(5);
connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
myCurrentLineEdit = myMeshGroupLine;
onObjectSelectionChanged();
}
else if (send == mySubMeshBtn) {
@ -1469,7 +1505,7 @@ void SMESHGUI_GroupDlg::onAdd()
int aNbSel = aList.Extent();
if (aNbSel == 0 || !myActor || myMesh->_is_nil()) return;
if (aNbSel == 0 || myActorsList.count() == 0 || myMesh->_is_nil()) return;
myIsBusy = true;
@ -1503,10 +1539,20 @@ void SMESHGUI_GroupDlg::onAdd()
QString aListStr = "";
int aNbItems = 0;
if (myTypeId == 0) {
aNbItems = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
QListIterator<SMESH_Actor*> it( myActorsList );
while ( it.hasNext() ) {
QString tmpStr;
aNbItems += SMESH::GetNameOfSelectedNodes(mySelector, it.next()->getIO(), tmpStr);
aListStr += tmpStr;
}
}
else {
aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr);
QListIterator<SMESH_Actor*> it( myActorsList );
while ( it.hasNext() ) {
QString tmpStr;
aNbItems += SMESH::GetNameOfSelectedElements(mySelector, it.next()->getIO(), tmpStr);
aListStr += tmpStr;
}
}
if (aNbItems > 0) {
QStringList anElements = aListStr.split( " ", QString::SkipEmptyParts);
@ -1836,6 +1882,15 @@ void SMESHGUI_GroupDlg::closeEvent (QCloseEvent*)
onClose();
}
//=================================================================================
// function : onVisibilityChanged()
// purpose :
//=================================================================================
void SMESHGUI_GroupDlg::onVisibilityChanged()
{
SetAppropriateActor();
}
//=================================================================================
// function : SMESHGUI_GroupDlg::onClose
// purpose : SLOT called when "Close" button pressed. Close dialog
@ -2158,48 +2213,40 @@ void SMESHGUI_GroupDlg::setDefaultGroupColor()
bool SMESHGUI_GroupDlg::SetAppropriateActor()
{
bool isActor = false;
myActorsList.clear();
if (myMesh->_is_nil()) return false;
SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
// try mesh actor
myActor = SMESH::FindActorByObject(myMesh);
if (myActor && myActor->hasIO())
{
isActor = true;
if (aViewWindow && !aViewWindow->isVisible(myActor->getIO()))
isActor = false;
}
// try current group actor
if (!isActor) {
if (!myGroup->_is_nil()) {
myActor = SMESH::FindActorByObject(myGroup);
if (myActor && myActor->hasIO())
{
isActor = true;
if (aViewWindow && !aViewWindow->isVisible(myActor->getIO()))
isActor = false;
}
}
}
// try current group on geometry actor
if (myGeomGroupBtn->isChecked()) { // try current group on geometry actor
if (!isActor) {
if (!myGroupOnGeom->_is_nil()) {
myActor = SMESH::FindActorByObject(myGroupOnGeom);
if (myActor && myActor->hasIO())
SMESH_Actor* anActor = SMESH::FindActorByObject(myGroupOnGeom);
if (anActor && anActor->hasIO())
{
isActor = true;
if (aViewWindow && !aViewWindow->isVisible(myActor->getIO()))
if (aViewWindow && !aViewWindow->isVisible(anActor->getIO()))
isActor = false;
else
myActorsList.append(anActor);
}
}
}
} else {
// try mesh actor
SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
if (anActor && anActor->hasIO())
{
isActor = true;
if (aViewWindow && !aViewWindow->isVisible(anActor->getIO()))
isActor = false;
else
myActorsList.append(anActor);
}
// try any visible actor of group or submesh of current mesh
if (!isActor && aViewWindow) {
if (aViewWindow) {
// mesh entry
_PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
if (aSObject) {
@ -2217,9 +2264,8 @@ bool SMESHGUI_GroupDlg::SetAppropriateActor()
if (anActor && anActor->hasIO()) {
Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
if (aViewWindow->isVisible(anIO)) {
if (anIO->hasEntry() && strncmp(anIO->getEntry(), meshEntry, len) == 0) {
myActor = anActor;
isActor = true;
if (anIO->hasEntry() && strncmp(anIO->getEntry(), meshEntry, len) == 0)
myActorsList.append(anActor);
}
}
}
@ -2227,10 +2273,16 @@ bool SMESHGUI_GroupDlg::SetAppropriateActor()
}
}
if (isActor)
SMESH::SetPickable(myActor);
if (myActorsList.count() > 0) {
QListIterator<SMESH_Actor*> it( myActorsList );
while ( it.hasNext() ) {
SMESH_Actor* anActor = it.next();
if ( IsActorVisible(anActor) )
anActor->SetPickable(true);
}
}
return isActor;
return ( isActor || (myActorsList.count() > 0) );
}
//=======================================================================
@ -2266,3 +2318,15 @@ void SMESHGUI_GroupDlg::restoreShowEntityMode()
}
myStoredShownEntity = 0;
}
//=======================================================================
//function : IsActorVisible
//purpose : return visibility of the actor
//=======================================================================
bool SMESHGUI_GroupDlg::IsActorVisible( SMESH_Actor* theActor )
{
SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
if (theActor && aViewWindow)
return aViewWindow->isVisible(theActor->getIO());
return false;
}

View File

@ -90,6 +90,7 @@ private slots:
bool onApply();
void onHelp();
void onDeactivate();
void onVisibilityChanged();
void onListSelectionChanged();
void onObjectSelectionChanged();
@ -127,6 +128,8 @@ private:
void setShowEntityMode();
void restoreShowEntityMode();
bool IsActorVisible( SMESH_Actor* );
void setGroupColor( const SALOMEDS::Color& );
SALOMEDS::Color getGroupColor() const;
@ -137,7 +140,6 @@ private:
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
SMESH_Actor* myActor; /* Current mesh actor */
int myGrpTypeId; /* Current group type id : standalone or group on geometry */
int myTypeId; /* Current type id = radio button id */
int myStoredShownEntity; /* Store ShowEntity mode of myMesh */
@ -180,6 +182,7 @@ private:
SMESHGUI_ShapeByMeshOp* myShapeByMeshOp;
SMESH::SMESH_Mesh_var myMesh;
QList<SMESH_Actor*> myActorsList;
SMESH::SMESH_Group_var myGroup;
SMESH::SMESH_GroupOnGeom_var myGroupOnGeom;
QList<int> myIdList;

View File

@ -287,8 +287,11 @@ void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
myHypo = SMESH::SMESH_Hypothesis::_nil();
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
myDlg->close(); myDlg = 0;
//delete myDlg; myDlg = 0;
disconnect( myDlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
myDlg->close();
//delete myDlg;
myDlg = 0;
emit finished( result );
}
@ -507,7 +510,7 @@ QString SMESHGUI_GenericHypothesisCreator::helpPage() const
aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
else if ( aHypType == "Arithmetic1D")
aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
else if ( aHypType == "FixedPointsc1D")
else if ( aHypType == "FixedPoints1D")
aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
else if ( aHypType == "MaxElementArea")
aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
@ -529,11 +532,16 @@ QString SMESHGUI_GenericHypothesisCreator::helpPage() const
aHelpFileName = "projection_algos_page.html";
else if ( aHypType == "NumberOfLayers")
aHelpFileName = "radial_prism_algo_page.html";
else if ( aHypType == "NumberOfLayers2D")
aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
else if ( aHypType == "LayerDistribution")
aHelpFileName = "radial_prism_algo_page.html";
else if ( aHypType == "LayerDistribution2D")
aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
else if ( aHypType == "SegmentLengthAroundVertex")
aHelpFileName = "segments_around_vertex_algo_page.html";
else if ( aHypType == "QuadrangleParams")
aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
return aHelpFileName;
}

View File

@ -68,6 +68,9 @@ public:
QString getShapeEntry() const { return myShapeEntry; }
void setShapeEntry( const QString& theEntry );
QString getMainShapeEntry() const { return myMainShapeEntry; }
void setMainShapeEntry( const QString& theEntry ) { myMainShapeEntry = theEntry; }
signals:
void finished( int );
@ -126,6 +129,7 @@ private:
bool myIsCreate;
QtxDialog* myDlg;
QString myShapeEntry;
QString myMainShapeEntry;
};
class SMESHGUI_HypothesisDlg : public QtxDialog

View File

@ -0,0 +1,251 @@
// Copyright (C) 2007-2009 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESHGUI_Make2DFrom3DOp.cxx
// Author : Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_Make2DFrom3DOp.h"
#include "SMESHGUI.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_MeshInfosBox.h"
// SALOME GUI includes
#include <LightApp_SelectionMgr.h>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_OverrideCursor.h>
#include <SALOME_ListIO.hxx>
// SALOME KERNEL includes
#include <SALOMEDS_SObject.hxx>
#include <SALOMEDSClient_SObject.hxx>
// Qt includes
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Gen)
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
#include <QFrame>
#include <QLabel>
#include <QPixmap>
#include <QGroupBox>
#include <QPushButton>
#include <QVBoxLayout>
// MESH includes
#include "SMDSAbs_ElementType.hxx"
#include "SMDSAbs_ElementType.hxx"
#define SPACING 6
#define MARGIN 11
// =========================================================================================
/*!
* \brief Dialog to show creted mesh statistic
*/
//=======================================================================
SMESHGUI_Make2DFrom3DDlg::SMESHGUI_Make2DFrom3DDlg( QWidget* parent )
: SMESHGUI_Dialog( parent, false, true, Close/* | Help*/ )
{
setWindowTitle( tr("CAPTION") );
QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame());
aDlgLay->setMargin( 0 );
aDlgLay->setSpacing( SPACING );
QFrame* aMainFrame = createMainFrame(mainFrame());
aDlgLay->addWidget(aMainFrame);
aDlgLay->setStretchFactor(aMainFrame, 1);
}
// =========================================================================================
/*!
* \brief Dialog destructor
*/
//=======================================================================
SMESHGUI_Make2DFrom3DDlg::~SMESHGUI_Make2DFrom3DDlg()
{
}
//=======================================================================
// function : createMainFrame()
// purpose : Create frame containing dialog's fields
//=======================================================================
QFrame* SMESHGUI_Make2DFrom3DDlg::createMainFrame (QWidget* theParent)
{
QFrame* aFrame = new QFrame(theParent);
SUIT_ResourceMgr* rm = resourceMgr();
QPixmap iconCompute (rm->loadPixmap("SMESH", tr("ICON_2D_FROM_3D")));
// Mesh name
QGroupBox* nameBox = new QGroupBox(tr("SMESH_MESHINFO_NAME"), aFrame );
QHBoxLayout* nameBoxLayout = new QHBoxLayout(nameBox);
nameBoxLayout->setMargin(MARGIN); nameBoxLayout->setSpacing(SPACING);
myMeshName = new QLabel(nameBox);
nameBoxLayout->addWidget(myMeshName);
// Mesh Info
myFullInfo = new SMESHGUI_MeshInfosBox(true, aFrame);
// add all widgets to aFrame
QVBoxLayout* aLay = new QVBoxLayout(aFrame);
aLay->setMargin( 0 );
aLay->setSpacing( 0 );
aLay->addWidget( nameBox );
aLay->addWidget( myFullInfo );
((QPushButton*) button( OK ))->setDefault( true );
return aFrame;
}
//================================================================================
/*!
* \brief set name of the mesh
*/
//================================================================================
void SMESHGUI_Make2DFrom3DDlg::SetMeshName(const QString& theName)
{
myMeshName->setText( theName );
}
//================================================================================
/*!
* \brief set mesh info
*/
//================================================================================
void SMESHGUI_Make2DFrom3DDlg::SetMeshInfo(const SMESH::long_array& theInfo)
{
myFullInfo->SetMeshInfo( theInfo );
}
//================================================================================
/*!
* \brief Constructor
*/
//================================================================================
SMESHGUI_Make2DFrom3DOp::SMESHGUI_Make2DFrom3DOp()
: SMESHGUI_Operation()
{
myDlg = new SMESHGUI_Make2DFrom3DDlg(desktop());
}
//================================================================================
/*!
* \brief Desctructor
*/
//================================================================================
SMESHGUI_Make2DFrom3DOp::~SMESHGUI_Make2DFrom3DOp()
{
}
//================================================================================
/*!
* \brief perform it's intention action: compute 2D mesh on 3D
*/
//================================================================================
void SMESHGUI_Make2DFrom3DOp::startOperation()
{
myMesh = SMESH::SMESH_Mesh::_nil();
// check selection
LightApp_SelectionMgr *Sel = selectionMgr();
SALOME_ListIO selected; Sel->selectedObjects( selected );
int nbSel = selected.Extent();
if (nbSel != 1) {
SUIT_MessageBox::warning(desktop(),
tr("SMESH_WRN_WARNING"),
tr("SMESH_WRN_NO_AVAILABLE_DATA"));
onCancel();
return;
}
Handle(SALOME_InteractiveObject) anIO = selected.First();
myMesh = SMESH::GetMeshByIO(anIO);
if (myMesh->_is_nil()) {
SUIT_MessageBox::warning(desktop(),
tr("SMESH_WRN_WARNING"),
tr("SMESH_WRN_NO_AVAILABLE_DATA"));
onCancel();
return;
}
SMESHGUI_Operation::startOperation();
// backup mesh info before 2D mesh computation
SMESH::long_array_var anOldInfo = myMesh->GetMeshInfo();
if (!compute2DMesh()) {
SUIT_MessageBox::warning(desktop(),
tr("SMESH_WRN_WARNING"),
tr("SMESH_WRN_COMPUTE_FAILED"));
onCancel();
return;
}
// get new mesh statistic
SMESH::long_array_var aNewInfo = myMesh->GetMeshInfo();
// get difference in mesh statistic from old to new
for ( int i = SMDSEntity_Node; i < SMDSEntity_Last; i++ )
aNewInfo[i] -= anOldInfo[i];
// update presentation
SMESH::Update(anIO, SMESH::eDisplay);
// show computated result
_PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
if ( aMeshSObj )
myDlg->SetMeshName( aMeshSObj->GetName().c_str() );
myDlg->SetMeshInfo( aNewInfo );
myDlg->show(); /*exec();*/
commit();
}
//================================================================================
/*!
* \brief compute 2D mesh on initial 3D
*/
//================================================================================
bool SMESHGUI_Make2DFrom3DOp::compute2DMesh()
{
SUIT_OverrideCursor wc;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
return aMeshEditor->Make2DMeshFrom3D();
}

View File

@ -0,0 +1,87 @@
// Copyright (C) 2007-2009 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_Make2DFrom3D.h
// Author : Open CASCADE S.A.S.
//
#ifndef SMESHGUI_Make2DFrom3DOp_H
#define SMESHGUI_Make2DFrom3DOp_H
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Dialog.h"
#include "SMESHGUI_Operation.h"
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
class QFrame;
class SMESHGUI_MeshInfosBox;
/*!
* \brief Dialog to show result mesh statistic
*/
class SMESHGUI_Make2DFrom3DDlg : public SMESHGUI_Dialog
{
Q_OBJECT
public:
SMESHGUI_Make2DFrom3DDlg( QWidget* );
virtual ~SMESHGUI_Make2DFrom3DDlg();
void SetMeshName(const QString& theName);
void SetMeshInfo(const SMESH::long_array& theInfo);
private:
QFrame* createMainFrame( QWidget* );
private:
QLabel* myMeshName;
SMESHGUI_MeshInfosBox* myFullInfo;
};
/*!
* \brief Operation to compute 2D mesh on 3D
*/
class SMESHGUI_Make2DFrom3DOp : public SMESHGUI_Operation
{
public:
SMESHGUI_Make2DFrom3DOp();
virtual ~SMESHGUI_Make2DFrom3DOp();
protected:
virtual void startOperation();
private:
bool compute2DMesh();
private:
SMESH::SMESH_Mesh_var myMesh;
QPointer<SMESHGUI_Make2DFrom3DDlg> myDlg;
};
#endif // SMESHGUI_Make2DFrom3DOp_H

View File

@ -208,7 +208,7 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent)
connect(myAutoSearchChkBox, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
myMoveRBtn->setChecked(true);
myIdBtn->setDown(true);
myIdBtn->setChecked(true);
myAutoSearchChkBox->setChecked(true);
return aFrame;
@ -228,11 +228,11 @@ void SMESHGUI_MakeNodeAtPointDlg::ButtonToggled (bool on)
if ( aSender == myCoordBtn ) // button to set coord by node selection
{
if ( myIdBtn->isEnabled() )
myIdBtn->setDown( !on );
myIdBtn->setChecked( !on );
}
else if ( aSender == myIdBtn ) // button to select a node to move
{
myCoordBtn->setDown( !on );
myCoordBtn->setChecked( !on );
}
else if ( aSender == myMoveRBtn ) // move node method
{
@ -241,7 +241,7 @@ void SMESHGUI_MakeNodeAtPointDlg::ButtonToggled (bool on)
else if ( aSender == myCreateRBtn ) // create node method
{
myNodeToMoveGrp->setEnabled( false );
myCoordBtn->setDown( true );
myCoordBtn->setChecked( true );
}
}
if ( aSender == myAutoSearchChkBox ) // automatic node search
@ -249,9 +249,9 @@ void SMESHGUI_MakeNodeAtPointDlg::ButtonToggled (bool on)
if ( on ) {
myId->setText("");
myId->setReadOnly ( true );
myIdBtn->setDown( false );
myIdBtn->setChecked( false );
myIdBtn->setEnabled( false );
myCoordBtn->setDown( true );
myCoordBtn->setChecked( true );
}
else {
myId->setReadOnly ( false );
@ -394,7 +394,7 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
return true;
int aResult = 0;
if ( myDlg->myCreateRBtn->isDown() )
if ( myDlg->myCreateRBtn->isChecked() )
{
aResult = aMeshEditor->AddNode(myDlg->myX->GetValue(),
myDlg->myY->GetValue(),
@ -414,7 +414,7 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
aParameters << myDlg->myX->text();
aParameters << myDlg->myY->text();
aParameters << myDlg->myZ->text();
aMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
aMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
myDlg->myId->setText("");
@ -444,7 +444,7 @@ bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg )
{
bool ok = true;
if ( myMeshActor &&
myDlg->myMoveRBtn->isDown() &&
myDlg->myMoveRBtn->isChecked() &&
!myDlg->myAutoSearchChkBox->isChecked() )
{
ok = false;
@ -482,7 +482,7 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone()
SMESH_Actor* aMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
if (!aMeshActor) { // coord by geom
if ( myDlg->myCoordBtn->isDown() ) {
if ( myDlg->myCoordBtn->isChecked() ) {
GEOM::GEOM_Object_var geom = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
if ( !geom->_is_nil() ) {
TopoDS_Vertex aShape;
@ -510,14 +510,14 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone()
if (SMDS_Mesh* aMesh = aMeshActor->GetObject()->GetMesh()) {
if (const SMDS_MeshNode* aNode = aMesh->FindNode(aString.toInt())) {
myNoPreview = true;
if ( myDlg->myCoordBtn->isDown() ) { // set coord
if ( myDlg->myCoordBtn->isChecked() ) { // set coord
myDlg->myX->SetValue(aNode->X());
myDlg->myY->SetValue(aNode->Y());
myDlg->myZ->SetValue(aNode->Z());
myNoPreview = false;
redisplayPreview();
}
else if ( myDlg->myIdBtn->isDown() &&
else if ( myDlg->myIdBtn->isChecked() &&
myDlg->myIdBtn->isEnabled() ) { // set node to move
myDlg->myId->setText(aString);
myNoPreview = false;
@ -545,7 +545,7 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
SMESH::MeshPreviewStruct_var aMeshPreviewStruct;
bool moveShown = false;
if ( myDlg->myMoveRBtn->isDown() && // Move method
if ( myDlg->myMoveRBtn->isChecked() && // Move method
myMeshActor)
{
const bool autoSearch = myDlg->myAutoSearchChkBox->isChecked();

Some files were not shown because too many files have changed in this diff Show More