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(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
QWTHOME=$d
AC_MSG_RESULT(libqwt.so detected in $d/lib)
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.
<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.
The direction of the splitting is defined by the orientation of the
\image html hypo_fixedpnt_dlg.png
It is possible to check in <b>Same Nb. Segments for all intervals</b>
option and to define one value for all intervals.
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 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
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.
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:
\image html mesh_fixedpnt.png "Example of a submesh on the edge built using Fixed points 1D hypothesis"
\image html hypo_fixedpnt_dlg.png
Resulting 2D mesh:
\image html mesh_fixedpnt.png
<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,9 +45,11 @@ 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
to specify the numerical parameters used for modification of any object.
*/
*/

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,13 +318,13 @@ 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,
@ -684,6 +696,49 @@ module SMESH
* not creared - returns empty list
*/
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
@ -695,9 +750,9 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodeGroups()
*/
boolean DoubleNodes( in long_array theElems,
in long_array theNodesNot,
in long_array theAffectedElems );
boolean DoubleNodeElem( in long_array theElems,
in long_array theNodesNot,
in long_array theAffectedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
@ -710,9 +765,9 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
*/
boolean DoubleNodesInRegion( in long_array theElems,
in long_array theNodesNot,
in GEOM::GEOM_Object theShape );
boolean DoubleNodeElemInRegion( in long_array theElems,
in long_array theNodesNot,
in GEOM::GEOM_Object theShape );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
@ -724,9 +779,9 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodes(), DoubleNodeGroups()
*/
boolean DoubleNodeGroup( in SMESH_GroupBase theElems,
in SMESH_GroupBase theNodesNot,
in SMESH_GroupBase theAffectedElems );
boolean DoubleNodeElemGroup( in SMESH_GroupBase theElems,
in SMESH_GroupBase theNodesNot,
in SMESH_GroupBase theAffectedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
@ -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,9 +808,9 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodes()
*/
boolean DoubleNodeGroups( in ListOfGroups theElems,
in ListOfGroups theNodesNot,
in ListOfGroups theAffectedElems );
boolean DoubleNodeElemGroups( in ListOfGroups theElems,
in ListOfGroups theNodesNot,
in ListOfGroups theAffectedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
@ -768,9 +823,16 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
*/
boolean DoubleNodeGroupsInRegion( in ListOfGroups theElems,
in ListOfGroups theNodesNot,
in GEOM::GEOM_Object theShape );
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

@ -149,21 +149,21 @@ namespace{
// SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
// if ( anIter != 0 ) {
// while( anIter->more() ) {
// const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
// if ( aNode == 0 )
// return 0;
// SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
// while( anElemIter->more() ) {
// const SMDS_MeshElement* anElem = anElemIter->next();
// if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
// int anId = anElem->GetID();
// const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
// if ( aNode == 0 )
// return 0;
// SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
// while( anElemIter->more() ) {
// const SMDS_MeshElement* anElem = anElemIter->next();
// if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
// int anId = anElem->GetID();
// if ( anIter->more() ) // i.e. first node
// aMap.Add( anId );
// else if ( aMap.Contains( anId ) )
// aResult++;
// }
// }
// if ( anIter->more() ) // i.e. first node
// aMap.Add( anId );
// else if ( aMap.Contains( anId ) )
// aResult++;
// }
// }
// }
// }
@ -476,9 +476,9 @@ namespace{
inline double getArea(double theHalfPerim, double theTria[3]){
return sqrt(theHalfPerim*
(theHalfPerim-theTria[0])*
(theHalfPerim-theTria[1])*
(theHalfPerim-theTria[2]));
(theHalfPerim-theTria[0])*
(theHalfPerim-theTria[1])*
(theHalfPerim-theTria[2]));
}
inline double getVolume(double theLen[6]){
@ -1036,160 +1036,160 @@ double Length2D::GetValue( long theElementId)
case SMDSAbs_Node:
case SMDSAbs_Edge:
if (len == 2){
aVal = getDistance( P( 1 ), P( 2 ) );
aVal = getDistance( P( 1 ), P( 2 ) );
break;
}
else if (len == 3){ // quadratic edge
aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 ));
aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 ));
break;
}
case SMDSAbs_Face:
if (len == 3){ // triangles
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
aVal = Max(L1,Max(L2,L3));
break;
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
aVal = Max(L1,Max(L2,L3));
break;
}
else if (len == 4){ // quadrangles
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 1 ));
aVal = Max(Max(L1,L2),Max(L3,L4));
break;
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 1 ));
aVal = Max(Max(L1,L2),Max(L3,L4));
break;
}
if (len == 6){ // quadratic triangles
double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 ));
aVal = Max(L1,Max(L2,L3));
double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 ));
aVal = Max(L1,Max(L2,L3));
//cout<<"L1="<<L1<<" L2="<<L2<<"L3="<<L3<<" aVal="<<aVal<<endl;
break;
break;
}
else if (len == 8){ // quadratic quadrangles
double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 7 ));
double L4 = getDistance(P( 7 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
aVal = Max(Max(L1,L2),Max(L3,L4));
break;
double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 7 ));
double L4 = getDistance(P( 7 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
aVal = Max(Max(L1,L2),Max(L3,L4));
break;
}
case SMDSAbs_Volume:
if (len == 4){ // tetraidrs
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
double L4 = getDistance(P( 1 ),P( 4 ));
double L5 = getDistance(P( 2 ),P( 4 ));
double L6 = getDistance(P( 3 ),P( 4 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
break;
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
double L4 = getDistance(P( 1 ),P( 4 ));
double L5 = getDistance(P( 2 ),P( 4 ));
double L6 = getDistance(P( 3 ),P( 4 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
break;
}
else if (len == 5){ // piramids
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 1 ));
double L5 = getDistance(P( 1 ),P( 5 ));
double L6 = getDistance(P( 2 ),P( 5 ));
double L7 = getDistance(P( 3 ),P( 5 ));
double L8 = getDistance(P( 4 ),P( 5 ));
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 1 ));
double L5 = getDistance(P( 1 ),P( 5 ));
double L6 = getDistance(P( 2 ),P( 5 ));
double L7 = getDistance(P( 3 ),P( 5 ));
double L8 = getDistance(P( 4 ),P( 5 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(L7,L8));
break;
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(L7,L8));
break;
}
else if (len == 6){ // pentaidres
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 5 ));
double L5 = getDistance(P( 5 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 4 ));
double L7 = getDistance(P( 1 ),P( 4 ));
double L8 = getDistance(P( 2 ),P( 5 ));
double L9 = getDistance(P( 3 ),P( 6 ));
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 5 ));
double L5 = getDistance(P( 5 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 4 ));
double L7 = getDistance(P( 1 ),P( 4 ));
double L8 = getDistance(P( 2 ),P( 5 ));
double L9 = getDistance(P( 3 ),P( 6 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),L9));
break;
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),L9));
break;
}
else if (len == 8){ // hexaider
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 1 ));
double L5 = getDistance(P( 5 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 7 ));
double L7 = getDistance(P( 7 ),P( 8 ));
double L8 = getDistance(P( 8 ),P( 5 ));
double L9 = getDistance(P( 1 ),P( 5 ));
double L10= getDistance(P( 2 ),P( 6 ));
double L11= getDistance(P( 3 ),P( 7 ));
double L12= getDistance(P( 4 ),P( 8 ));
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 1 ));
double L5 = getDistance(P( 5 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 7 ));
double L7 = getDistance(P( 7 ),P( 8 ));
double L8 = getDistance(P( 8 ),P( 5 ));
double L9 = getDistance(P( 1 ),P( 5 ));
double L10= getDistance(P( 2 ),P( 6 ));
double L11= getDistance(P( 3 ),P( 7 ));
double L12= getDistance(P( 4 ),P( 8 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
aVal = Max(aVal,Max(L11,L12));
break;
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
aVal = Max(aVal,Max(L11,L12));
break;
}
if (len == 10){ // quadratic tetraidrs
double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
break;
double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
break;
}
else if (len == 13){ // quadratic piramids
double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(L7,L8));
break;
double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(L7,L8));
break;
}
else if (len == 15){ // quadratic pentaidres
double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),L9));
break;
double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),L9));
break;
}
else if (len == 20){ // quadratic hexaider
double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
aVal = Max(aVal,Max(L11,L12));
break;
double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
aVal = Max(aVal,Max(L11,L12));
break;
}
@ -1467,12 +1467,12 @@ void MultiConnection2D::GetValues(MValues& theValues){
Value aValue(aNodeId[1],aNodeId[2]);
MValues::iterator aItr = theValues.find(aValue);
if (aItr != theValues.end()){
aItr->second += 1;
//aNbConnects = nb;
aItr->second += 1;
//aNbConnects = nb;
}
else {
theValues[aValue] = 1;
//aNbConnects = 1;
theValues[aValue] = 1;
//aNbConnects = 1;
}
//cout << "NodeIds: "<<aNodeId[1]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
aNodeId[1] = aNodeId[2];
@ -1651,8 +1651,8 @@ bool FreeEdges::Border::operator<(const FreeEdges::Border& x) const{
}
inline void UpdateBorders(const FreeEdges::Border& theBorder,
FreeEdges::TBorders& theRegistry,
FreeEdges::TBorders& theContainer)
FreeEdges::TBorders& theRegistry,
FreeEdges::TBorders& theContainer)
{
if(theRegistry.find(theBorder) == theRegistry.end()){
theRegistry.insert(theBorder);
@ -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;
@ -2412,15 +2414,15 @@ void Filter::SetPredicate( PredicatePtr thePredicate )
template<class TElement, class TIterator, class TPredicate>
inline void FillSequence(const TIterator& theIterator,
TPredicate& thePredicate,
Filter::TIdSequence& theSequence)
TPredicate& thePredicate,
Filter::TIdSequence& theSequence)
{
if ( theIterator ) {
while( theIterator->more() ) {
TElement anElem = theIterator->next();
long anId = anElem->GetID();
if ( thePredicate->IsSatisfy( anId ) )
theSequence.push_back( anId );
theSequence.push_back( anId );
}
}
}
@ -2428,8 +2430,8 @@ inline void FillSequence(const TIterator& theIterator,
void
Filter::
GetElementsId( const SMDS_Mesh* theMesh,
PredicatePtr thePredicate,
TIdSequence& theSequence )
PredicatePtr thePredicate,
TIdSequence& theSequence )
{
theSequence.clear();
@ -2462,7 +2464,7 @@ GetElementsId( const SMDS_Mesh* theMesh,
void
Filter::GetElementsId( const SMDS_Mesh* theMesh,
Filter::TIdSequence& theSequence )
Filter::TIdSequence& theSequence )
{
GetElementsId(theMesh,myPredicate,theSequence);
}
@ -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;
};
/*
@ -122,9 +132,9 @@ namespace SMESH{
void SetPrecision( const long thePrecision );
bool GetPoints(const int theId,
TSequenceOfXYZ& theRes) const;
TSequenceOfXYZ& theRes) const;
static bool GetPoints(const SMDS_MeshElement* theElem,
TSequenceOfXYZ& theRes);
TSequenceOfXYZ& theRes);
protected:
const SMDS_Mesh* myMesh;
const SMDS_MeshElement* myCurrElement;
@ -253,10 +263,10 @@ namespace SMESH{
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
struct Value{
double myLength;
long myPntId[2];
Value(double theLength, long thePntId1, long thePntId2);
bool operator<(const Value& x) const;
double myLength;
long myPntId[2];
Value(double theLength, long thePntId1, long thePntId2);
bool operator<(const Value& x) const;
};
typedef std::set<Value> TValues;
void GetValues(TValues& theValues);
@ -286,9 +296,9 @@ namespace SMESH{
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
struct Value{
long myPntId[2];
Value(long thePntId1, long thePntId2);
bool operator<(const Value& x) const;
long myPntId[2];
Value(long thePntId1, long thePntId2);
bool operator<(const Value& x) const;
};
typedef std::map<Value,int> MValues;
@ -354,10 +364,10 @@ namespace SMESH{
static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
typedef long TElemId;
struct Border{
TElemId myElemId;
TElemId myPntId[2];
Border(long theElemId, long thePntId1, long thePntId2);
bool operator<(const Border& x) const;
TElemId myElemId;
TElemId myPntId[2];
Border(long theElemId, long thePntId1, long thePntId2);
bool operator<(const Border& x) const;
};
typedef std::set<Border> TBorders;
void GetBoreders(TBorders& theBorders);
@ -787,13 +797,13 @@ namespace SMESH{
virtual
void
GetElementsId( const SMDS_Mesh* theMesh,
TIdSequence& theSequence );
TIdSequence& theSequence );
static
void
GetElementsId( const SMDS_Mesh* theMesh,
PredicatePtr thePredicate,
TIdSequence& theSequence );
PredicatePtr thePredicate,
TIdSequence& theSequence );
protected:
PredicatePtr myPredicate;

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

@ -28,7 +28,7 @@
#include "DriverMED_Family.h"
#include "MED_Factory.hxx"
#include <sstream>
#include <sstream>
using namespace std;
@ -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
@ -139,11 +146,11 @@ DriverMED_Family
DriverMED_FamilyPtrList
DriverMED_Family
::MakeFamilies(const SMESHDS_SubMeshPtrMap& theSubMeshes,
const SMESHDS_GroupBasePtrList& theGroups,
const bool doGroupOfNodes,
const bool doGroupOfEdges,
const bool doGroupOfFaces,
const bool doGroupOfVolumes)
const SMESHDS_GroupBasePtrList& theGroups,
const bool doGroupOfNodes,
const bool doGroupOfEdges,
const bool doGroupOfFaces,
const bool doGroupOfVolumes)
{
DriverMED_FamilyPtrList aFamilies;
@ -189,7 +196,7 @@ DriverMED_Family
aFamilies.erase(aCurrIter);
}
if (aFam2->IsEmpty())
break;
break;
}
}
// The rest elements of family
@ -218,7 +225,7 @@ DriverMED_Family
aFam1->Split(aFam2, aCommon);
if (!aCommon->IsEmpty())
{
aCommon->SetGroupAttributVal(0);
aCommon->SetGroupAttributVal(0);
aFamilies.push_back(aCommon);
}
if (aFam1->IsEmpty())
@ -226,7 +233,7 @@ DriverMED_Family
aFamilies.erase(aCurrIter);
}
if (aFam2->IsEmpty())
break;
break;
}
}
// The rest elements of group
@ -310,7 +317,7 @@ DriverMED_Family
//=============================================================================
MED::PFamilyInfo
DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
const MED::PMeshInfo& theMeshInfo) const
const MED::PMeshInfo& theMeshInfo) const
{
ostringstream aStr;
aStr << "FAM_" << myId;
@ -332,20 +339,20 @@ DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
MED::PFamilyInfo anInfo;
if(myId == 0 || myGroupAttributVal == 0){
anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
aValue,
myId,
myGroupNames);
aValue,
myId,
myGroupNames);
}else{
MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description,
MED::TIntVector anAttrIds (1, myId); // Id=0,
MED::TIntVector anAttrVals (1, myGroupAttributVal);
anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
aValue,
myId,
myGroupNames,
anAttrDescs,
anAttrIds,
anAttrVals);
aValue,
myId,
myGroupNames,
anAttrDescs,
anAttrIds,
anAttrVals);
}
// cout << endl;
@ -413,7 +420,7 @@ void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup)
DriverMED_FamilyPtrList
DriverMED_Family
::SplitByType (SMESHDS_SubMesh* theSubMesh,
const int theId)
const int theId)
{
DriverMED_FamilyPtrList aFamilies;
DriverMED_FamilyPtr aNodesFamily (new DriverMED_Family);

View File

@ -68,16 +68,16 @@ class MESHDRIVERMED_EXPORT DriverMED_Family
static
DriverMED_FamilyPtrList
MakeFamilies (const SMESHDS_SubMeshPtrMap& theSubMeshes,
const SMESHDS_GroupBasePtrList& theGroups,
const bool doGroupOfNodes,
const bool doGroupOfEdges,
const bool doGroupOfFaces,
const bool doGroupOfVolumes);
const SMESHDS_GroupBasePtrList& theGroups,
const bool doGroupOfNodes,
const bool doGroupOfEdges,
const bool doGroupOfFaces,
const bool doGroupOfVolumes);
//! Create TFamilyInfo for this family
MED::PFamilyInfo
GetFamilyInfo (const MED::PWrapper& theWrapper,
const MED::PMeshInfo& theMeshInfo) const;
const MED::PMeshInfo& theMeshInfo) const;
//! Returns elements of this family
const ElementsSet& GetElements () const;
@ -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;
@ -113,7 +114,7 @@ class MESHDRIVERMED_EXPORT DriverMED_Family
static
DriverMED_FamilyPtrList
SplitByType(SMESHDS_SubMesh* theSubMesh,
const int theId);
const int theId);
/*! Remove from <Elements> elements, common with <by>,
@ -121,7 +122,7 @@ class MESHDRIVERMED_EXPORT DriverMED_Family
Create family <common> from common elements, with combined groups list.
*/
void Split (DriverMED_FamilyPtr by,
DriverMED_FamilyPtr common);
DriverMED_FamilyPtr common);
//! Check, if this family has empty list of elements
bool IsEmpty () 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);
}
@ -79,88 +80,88 @@ DriverMED_R_SMESHDS_Mesh
aResult = DRS_EMPTY;
if(TInt aNbMeshes = aMed->GetNbMeshes()){
for(int iMesh = 0; iMesh < aNbMeshes; iMesh++){
// Reading the MED mesh
//---------------------
PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
// Reading the MED 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 {
aMeshName = myMeshName;
}
if(MYDEBUG) MESSAGE("Perform - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
if(aMeshName != aMeshInfo->GetName()) continue;
if(MYDEBUG) MESSAGE("Perform - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
if(aMeshName != aMeshInfo->GetName()) continue;
aResult = DRS_OK;
//TInt aMeshDim = aMeshInfo->GetDim();
//TInt aMeshDim = aMeshInfo->GetDim();
// Reading MED families to the temporary structure
//------------------------------------------------
TErr anErr;
TInt aNbFams = aMed->GetNbFamilies(aMeshInfo);
//------------------------------------------------
TErr anErr;
TInt aNbFams = aMed->GetNbFamilies(aMeshInfo);
if(MYDEBUG) MESSAGE("Read " << aNbFams << " families");
for (TInt iFam = 0; iFam < aNbFams; iFam++) {
PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo,iFam+1,&anErr);
if(anErr >= 0){
TInt aFamId = aFamilyInfo->GetId();
if(MYDEBUG) MESSAGE("Family " << aFamId << " :");
PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo,iFam+1,&anErr);
if(anErr >= 0){
TInt aFamId = aFamilyInfo->GetId();
if(MYDEBUG) MESSAGE("Family " << aFamId << " :");
DriverMED_FamilyPtr aFamily (new DriverMED_Family);
TInt aNbGrp = aFamilyInfo->GetNbGroup();
if(MYDEBUG) MESSAGE("belong to " << aNbGrp << " groups");
bool isAttrOk = false;
if(aFamilyInfo->GetNbAttr() == aNbGrp)
isAttrOk = true;
bool isAttrOk = false;
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);
}
TInt anAttrVal = aFamilyInfo->GetAttrVal(iGr);
aFamily->SetGroupAttributVal(anAttrVal);
}
if(MYDEBUG) MESSAGE(aGroupName);
aFamily->AddGroupName(aGroupName);
}
aFamily->SetId( aFamId );
myFamilies[aFamId] = aFamily;
}
}
}
if (aMeshInfo->GetType() == MED::eSTRUCTURE){
/*bool aRes = */buildMeshGrille(aMed,aMeshInfo);
continue;
}
if (aMeshInfo->GetType() == MED::eSTRUCTURE){
/*bool aRes = */buildMeshGrille(aMed,aMeshInfo);
continue;
}
// Reading MED nodes to the corresponding SMDS structure
//------------------------------------------------------
//------------------------------------------------------
PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
if (!aNodeInfo) {
if (!aNodeInfo) {
aResult = DRS_FAIL;
continue;
continue;
}
PCoordHelper aCoordHelper = GetCoordHelper(aNodeInfo);
PCoordHelper aCoordHelper = GetCoordHelper(aNodeInfo);
EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
TInt aNbElems = aNodeInfo->GetNbElem();
if(MYDEBUG) MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum);
EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
TInt aNbElems = aNodeInfo->GetNbElem();
if(MYDEBUG) MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum);
DriverMED_FamilyPtr aFamily;
for(TInt iElem = 0; iElem < aNbElems; iElem++){
TCCoordSlice aCoordSlice = aNodeInfo->GetCoordSlice(iElem);
TCCoordSlice aCoordSlice = aNodeInfo->GetCoordSlice(iElem);
double aCoords[3] = {0.0, 0.0, 0.0};
for(TInt iDim = 0; iDim < 3; iDim++)
aCoords[iDim] = aCoordHelper->GetCoord(aCoordSlice,iDim);
const SMDS_MeshNode* aNode;
if(anIsNodeNum) {
aNode = myMesh->AddNodeWithID
aNode = myMesh->AddNodeWithID
(aCoords[0],aCoords[1],aCoords[2],aNodeInfo->GetElemNum(iElem));
} else {
aNode = myMesh->AddNode
aNode = myMesh->AddNode
(aCoords[0],aCoords[1],aCoords[2]);
}
//cout<<aNode->GetID()<<": "<<aNode->X()<<", "<<aNode->Y()<<", "<<aNode->Z()<<endl;
@ -174,44 +175,44 @@ DriverMED_R_SMESHDS_Mesh
}
}
// Reading pre information about all MED cells
//--------------------------------------------
typedef MED::TVector<int> TNodeIds;
// Reading pre information about all MED cells
//--------------------------------------------
typedef MED::TVector<int> TNodeIds;
bool takeNumbers = true; // initially we trust the numbers from file
MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
const EEntiteMaillage& anEntity = anEntityIter->first;
if(anEntity == eNOEUD) continue;
// Reading MED cells to the corresponding SMDS structure
//------------------------------------------------------
const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
const EGeometrieElement& aGeom = aGeom2SizeIter->first;
MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
const EEntiteMaillage& anEntity = anEntityIter->first;
if(anEntity == eNOEUD) continue;
// Reading MED cells to the corresponding SMDS structure
//------------------------------------------------------
const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
const EGeometrieElement& aGeom = aGeom2SizeIter->first;
switch(aGeom) {
// case ePOINT1: ## PAL16410
// break;
case ePOLYGONE: {
switch(aGeom) {
// case ePOINT1: ## PAL16410
// break;
case ePOLYGONE: {
PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom);
EBooleen anIsElemNum = takeNumbers ? aPolygoneInfo->IsElemNum() : eFAUX;
TInt aNbElem = aPolygoneInfo->GetNbElem();
for(TInt iElem = 0; iElem < aNbElem; iElem++){
MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
TNodeIds aNodeIds(aNbConn);
TInt aNbElem = aPolygoneInfo->GetNbElem();
for(TInt iElem = 0; iElem < aNbElem; iElem++){
MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
TNodeIds aNodeIds(aNbConn);
#ifdef _EDF_NODE_IDS_
if(anIsNodeNum)
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodeIds[iConn] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1);
else
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodeIds[iConn] = aConnSlice[iConn];
if(anIsNodeNum)
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodeIds[iConn] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1);
else
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodeIds[iConn] = aConnSlice[iConn];
#else
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodeIds[iConn] = aConnSlice[iConn];
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodeIds[iConn] = aConnSlice[iConn];
#endif
bool isRenum = false;
SMDS_MeshElement* anElement = NULL;
@ -221,12 +222,12 @@ DriverMED_R_SMESHDS_Mesh
try{
#endif
if(anIsElemNum){
TInt anElemId = aPolygoneInfo->GetElemNum(iElem);
TInt anElemId = aPolygoneInfo->GetElemNum(iElem);
anElement = myMesh->AddPolygonalFaceWithID(aNodeIds,anElemId);
}
}
if(!anElement){
std::vector<const SMDS_MeshNode*> aNodes(aNbConn);
for(TInt iConn = 0; iConn < aNbConn; iConn++)
vector<const SMDS_MeshNode*> aNodes(aNbConn);
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodes[iConn] = FindNode(myMesh,aNodeIds[iConn]);
anElement = myMesh->AddPolygonalFace(aNodes);
isRenum = anIsElemNum;
@ -256,107 +257,107 @@ DriverMED_R_SMESHDS_Mesh
}
}
break;
}
case ePOLYEDRE: {
}
case ePOLYEDRE: {
PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,anEntity,aGeom);
EBooleen anIsElemNum = takeNumbers ? aPolyedreInfo->IsElemNum() : eFAUX;
TInt aNbElem = aPolyedreInfo->GetNbElem();
for(TInt iElem = 0; iElem < aNbElem; iElem++){
MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
TInt aNbFaces = aConnSliceArr.size();
TInt aNbElem = aPolyedreInfo->GetNbElem();
for(TInt iElem = 0; iElem < aNbElem; iElem++){
MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
TInt aNbFaces = aConnSliceArr.size();
typedef MED::TVector<int> TQuantities;
TQuantities aQuantities(aNbFaces);
TInt aNbNodes = aPolyedreInfo->GetNbNodes(iElem);
TNodeIds aNodeIds(aNbNodes);
for(TInt iFace = 0, iNode = 0; iFace < aNbFaces; iFace++){
MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
TInt aNbConn = aConnSlice.size();
TQuantities aQuantities(aNbFaces);
TInt aNbNodes = aPolyedreInfo->GetNbNodes(iElem);
TNodeIds aNodeIds(aNbNodes);
for(TInt iFace = 0, iNode = 0; iFace < aNbFaces; iFace++){
MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
TInt aNbConn = aConnSlice.size();
aQuantities[iFace] = aNbConn;
#ifdef _EDF_NODE_IDS_
if(anIsNodeNum)
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodeIds[iNode++] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1);
else
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodeIds[iNode++] = aConnSlice[iConn];
if(anIsNodeNum)
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodeIds[iNode++] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1);
else
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodeIds[iNode++] = aConnSlice[iConn];
#else
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodeIds[iNode++] = aConnSlice[iConn];
#endif
}
for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodeIds[iNode++] = aConnSlice[iConn];
#endif
}
bool isRenum = false;
SMDS_MeshElement* anElement = NULL;
TInt aFamNum = aPolyedreInfo->GetFamNum(iElem);
bool isRenum = false;
SMDS_MeshElement* anElement = NULL;
TInt aFamNum = aPolyedreInfo->GetFamNum(iElem);
#ifndef _DEXCEPT_
try{
try{
#endif
if(anIsElemNum){
TInt anElemId = aPolyedreInfo->GetElemNum(iElem);
anElement = myMesh->AddPolyhedralVolumeWithID(aNodeIds,aQuantities,anElemId);
}
if(!anElement){
std::vector<const SMDS_MeshNode*> aNodes(aNbNodes);
for(TInt iConn = 0; iConn < aNbNodes; iConn++)
aNodes[iConn] = FindNode(myMesh,aNodeIds[iConn]);
anElement = myMesh->AddPolyhedralVolume(aNodes,aQuantities);
isRenum = anIsElemNum;
}
if(anIsElemNum){
TInt anElemId = aPolyedreInfo->GetElemNum(iElem);
anElement = myMesh->AddPolyhedralVolumeWithID(aNodeIds,aQuantities,anElemId);
}
if(!anElement){
vector<const SMDS_MeshNode*> aNodes(aNbNodes);
for(TInt iConn = 0; iConn < aNbNodes; iConn++)
aNodes[iConn] = FindNode(myMesh,aNodeIds[iConn]);
anElement = myMesh->AddPolyhedralVolume(aNodes,aQuantities);
isRenum = anIsElemNum;
}
#ifndef _DEXCEPT_
}catch(const std::exception& exc){
aResult = DRS_FAIL;
}catch(...){
aResult = DRS_FAIL;
}
#endif
if(!anElement){
aResult = DRS_WARN_SKIP_ELEM;
}else{
if(isRenum){
anIsElemNum = eFAUX;
takeNumbers = false;
if (aResult < DRS_WARN_RENUMBER)
aResult = DRS_WARN_RENUMBER;
}
if ( checkFamilyID ( aFamily, aFamNum )) {
// Save reference to this element from its family
aFamily->AddElement(anElement);
aFamily->SetType(anElement->GetType());
}
}
}
}catch(const std::exception& exc){
aResult = DRS_FAIL;
}catch(...){
aResult = DRS_FAIL;
}
#endif
if(!anElement){
aResult = DRS_WARN_SKIP_ELEM;
}else{
if(isRenum){
anIsElemNum = eFAUX;
takeNumbers = false;
if (aResult < DRS_WARN_RENUMBER)
aResult = DRS_WARN_RENUMBER;
}
if ( checkFamilyID ( aFamily, aFamNum )) {
// Save reference to this element from its family
aFamily->AddElement(anElement);
aFamily->SetType(anElement->GetType());
}
}
}
break;
}
default: {
default: {
PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX;
TInt aNbElems = aCellInfo->GetNbElem();
if(MYDEBUG) MESSAGE("Perform - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum);
if(MYDEBUG) MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems);
TInt aNbNodes = -1;
switch(aGeom){
case eSEG2: aNbNodes = 2; break;
case eSEG3: aNbNodes = 3; break;
case eTRIA3: aNbNodes = 3; break;
case eTRIA6: aNbNodes = 6; break;
case eQUAD4: aNbNodes = 4; break;
case eQUAD8: aNbNodes = 8; break;
case eTETRA4: aNbNodes = 4; break;
case eTETRA10: aNbNodes = 10; break;
case ePYRA5: aNbNodes = 5; break;
case ePYRA13: aNbNodes = 13; break;
case ePENTA6: aNbNodes = 6; break;
case ePENTA15: aNbNodes = 15; break;
case eHEXA8: aNbNodes = 8; break;
case eHEXA20: aNbNodes = 20; break;
case ePOINT1: aNbNodes = 1; break;
default:;
}
vector<TInt> aNodeIds(aNbNodes);
for(int iElem = 0; iElem < aNbElems; iElem++){
TInt aNbNodes = -1;
switch(aGeom){
case eSEG2: aNbNodes = 2; break;
case eSEG3: aNbNodes = 3; break;
case eTRIA3: aNbNodes = 3; break;
case eTRIA6: aNbNodes = 6; break;
case eQUAD4: aNbNodes = 4; break;
case eQUAD8: aNbNodes = 8; break;
case eTETRA4: aNbNodes = 4; break;
case eTETRA10: aNbNodes = 10; break;
case ePYRA5: aNbNodes = 5; break;
case ePYRA13: aNbNodes = 13; break;
case ePENTA6: aNbNodes = 6; break;
case ePENTA15: aNbNodes = 15; break;
case eHEXA8: aNbNodes = 8; break;
case eHEXA20: aNbNodes = 20; break;
case ePOINT1: aNbNodes = 1; break;
default:;
}
std::vector<TInt> aNodeIds(aNbNodes);
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);
@ -747,10 +748,10 @@ std::list<std::string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
if (TInt aNbMeshes = aMed->GetNbMeshes()) {
for (int iMesh = 0; iMesh < aNbMeshes; iMesh++) {
// Reading the MED mesh
//---------------------
PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
aMeshNames.push_back(aMeshInfo->GetName());
// Reading the MED mesh
//---------------------
PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
aMeshNames.push_back(aMeshInfo->GetName());
}
}
}catch(const std::exception& exc){
@ -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;
theGroup->SMDSGroup().Add(element);
int aGroupAttrVal = aFamily->GetGroupAttributVal();
if( aGroupAttrVal != 0)
theGroup->SetColorGroup(aGroupAttrVal);
const SMDS_MeshElement * element = *anElemsIter;
if ( element->GetType() == theGroup->GetType() ) // Issue 0020576
theGroup->SMDSGroup().Add(element);
}
if ( element )
theGroup->SetType( theGroup->SMDSGroup().GetType() );
int aGroupAttrVal = aFamily->GetGroupAttributVal();
if( aGroupAttrVal != 0)
theGroup->SetColorGroup(aGroupAttrVal);
// 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;
@ -924,7 +927,7 @@ bool DriverMED_R_SMESHDS_Mesh::checkFamilyID(DriverMED_FamilyPtr & aFamily, int
* \return TRUE, if successfully. Else FALSE
*/
bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
const MED::PMeshInfo& theMeshInfo)
const MED::PMeshInfo& theMeshInfo)
{
bool res = true;
@ -944,10 +947,10 @@ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
if((aGrilleInfo->myFamNumNode).size() > 0){
TInt aFamNum = aGrilleInfo->GetFamNumNode(iNode);
if ( checkFamilyID ( aFamily, aFamNum ))
{
aFamily->AddElement(aNode);
aFamily->SetType(SMDSAbs_Node);
}
{
aFamily->AddElement(aNode);
aFamily->SetType(SMDSAbs_Node);
}
}
}
@ -959,38 +962,38 @@ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
switch(aGrilleInfo->GetGeom()){
case MED::eSEG2:
if(aNodeIds.size() != 2){
res = false;
EXCEPTION(std::runtime_error,"buildMeshGrille Error. Incorrect size of ids 2!="<<aNodeIds.size());
res = false;
EXCEPTION(runtime_error,"buildMeshGrille Error. Incorrect size of ids 2!="<<aNodeIds.size());
}
anElement = myMesh->AddEdgeWithID(aNodeIds[0],
aNodeIds[1],
iCell);
aNodeIds[1],
iCell);
break;
case MED::eQUAD4:
if(aNodeIds.size() != 4){
res = false;
EXCEPTION(std::runtime_error,"buildMeshGrille Error. Incorrect size of ids 4!="<<aNodeIds.size());
res = false;
EXCEPTION(runtime_error,"buildMeshGrille Error. Incorrect size of ids 4!="<<aNodeIds.size());
}
anElement = myMesh->AddFaceWithID(aNodeIds[0],
aNodeIds[2],
aNodeIds[3],
aNodeIds[1],
iCell);
aNodeIds[2],
aNodeIds[3],
aNodeIds[1],
iCell);
break;
case MED::eHEXA8:
if(aNodeIds.size() != 8){
res = false;
EXCEPTION(std::runtime_error,"buildMeshGrille Error. Incorrect size of ids 8!="<<aNodeIds.size());
res = false;
EXCEPTION(runtime_error,"buildMeshGrille Error. Incorrect size of ids 8!="<<aNodeIds.size());
}
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
aNodeIds[2],
aNodeIds[3],
aNodeIds[1],
aNodeIds[4],
aNodeIds[6],
aNodeIds[7],
aNodeIds[5],
iCell);
aNodeIds[2],
aNodeIds[3],
aNodeIds[1],
aNodeIds[4],
aNodeIds[6],
aNodeIds[7],
aNodeIds[5],
iCell);
break;
default:
break;
@ -999,8 +1002,8 @@ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
if((aGrilleInfo->myFamNum).size() > 0){
TInt aFamNum = aGrilleInfo->GetFamNum(iCell);
if ( checkFamilyID ( aFamily, aFamNum )){
aFamily->AddElement(anElement);
aFamily->SetType(anElement->GetType());
aFamily->AddElement(anElement);
aFamily->SetType(anElement->GetType());
}
}
}

View File

@ -62,7 +62,7 @@ class MESHDRIVERMED_EXPORT DriverMED_R_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
bool checkFamilyID(DriverMED_FamilyPtr & aFamily, int anID) const;
bool buildMeshGrille(const MED::PWrapper& theWrapper,
const MED::PMeshInfo& theMeshInfo);
const MED::PMeshInfo& theMeshInfo);
private:
std::string myMeshName;

View File

@ -54,7 +54,7 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
{}
void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName,
MED::EVersion theId)
MED::EVersion theId)
{
myMed = CrWrapper(theFileName,theId);
Driver_SMESHDS_Mesh::SetFile(theFileName);
@ -189,9 +189,9 @@ namespace{
TUnit* myUnit;
public:
TCoordHelper(const SMDS_NodeIteratorPtr& theNodeIter,
TGetCoord* theGetCoord,
TName* theName,
TUnit* theUnit = aUnit):
TGetCoord* theGetCoord,
TName* theName,
TUnit* theUnit = aUnit):
myNodeIter(theNodeIter),
myGetCoord(theGetCoord),
myName(theName),
@ -200,7 +200,7 @@ namespace{
virtual ~TCoordHelper(){}
bool Next(){
return myNodeIter->more() &&
(myCurrentNode = myNodeIter->next());
(myCurrentNode = myNodeIter->next());
}
const SMDS_MeshNode* GetNode(){
return myCurrentNode;
@ -352,33 +352,33 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
bool anIsYDimension = false;
bool anIsZDimension = false;
{
SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
double aBounds[6];
if(aNodesIter->more()){
const SMDS_MeshNode* aNode = aNodesIter->next();
aBounds[0] = aBounds[1] = aNode->X();
aBounds[2] = aBounds[3] = aNode->Y();
aBounds[4] = aBounds[5] = aNode->Z();
}
while(aNodesIter->more()){
const SMDS_MeshNode* aNode = aNodesIter->next();
aBounds[0] = min(aBounds[0],aNode->X());
aBounds[1] = max(aBounds[1],aNode->X());
aBounds[2] = min(aBounds[2],aNode->Y());
aBounds[3] = max(aBounds[3],aNode->Y());
aBounds[4] = min(aBounds[4],aNode->Z());
aBounds[5] = max(aBounds[5],aNode->Z());
}
SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
double aBounds[6];
if(aNodesIter->more()){
const SMDS_MeshNode* aNode = aNodesIter->next();
aBounds[0] = aBounds[1] = aNode->X();
aBounds[2] = aBounds[3] = aNode->Y();
aBounds[4] = aBounds[5] = aNode->Z();
}
while(aNodesIter->more()){
const SMDS_MeshNode* aNode = aNodesIter->next();
aBounds[0] = min(aBounds[0],aNode->X());
aBounds[1] = max(aBounds[1],aNode->X());
aBounds[2] = min(aBounds[2],aNode->Y());
aBounds[3] = max(aBounds[3],aNode->Y());
aBounds[4] = min(aBounds[4],aNode->Z());
aBounds[5] = max(aBounds[5],aNode->Z());
}
double EPS = 1.0E-7;
anIsXDimension = (aBounds[1] - aBounds[0]) + abs(aBounds[1]) + abs(aBounds[0]) > EPS;
anIsYDimension = (aBounds[3] - aBounds[2]) + abs(aBounds[3]) + abs(aBounds[2]) > EPS;
anIsZDimension = (aBounds[5] - aBounds[4]) + abs(aBounds[5]) + abs(aBounds[4]) > EPS;
aMeshDimension = anIsXDimension + anIsYDimension + anIsZDimension;
if(!aMeshDimension)
aMeshDimension = 3;
double EPS = 1.0E-7;
anIsXDimension = (aBounds[1] - aBounds[0]) + abs(aBounds[1]) + abs(aBounds[0]) > EPS;
anIsYDimension = (aBounds[3] - aBounds[2]) + abs(aBounds[3]) + abs(aBounds[2]) > EPS;
anIsZDimension = (aBounds[5] - aBounds[4]) + abs(aBounds[5]) + abs(aBounds[4]) > EPS;
aMeshDimension = anIsXDimension + anIsYDimension + anIsZDimension;
if(!aMeshDimension)
aMeshDimension = 3;
// PAL16857(SMESH not conform to the MED convention):
if ( aMeshDimension == 2 && anIsZDimension ) // 2D only if mesh is in XOY plane
aMeshDimension = 3;
@ -395,24 +395,24 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
switch(aMeshDimension){
case 3:
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXYZGetCoord,aXYZName));
break;
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXYZGetCoord,aXYZName));
break;
case 2:
if(anIsXDimension && anIsYDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXYGetCoord,aXYName));
if(anIsYDimension && anIsZDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aYZGetCoord,aYZName));
if(anIsXDimension && anIsZDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXZGetCoord,aXZName));
break;
if(anIsXDimension && anIsYDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXYGetCoord,aXYName));
if(anIsYDimension && anIsZDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aYZGetCoord,aYZName));
if(anIsXDimension && anIsZDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXZGetCoord,aXZName));
break;
case 1:
if(anIsXDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXGetCoord,aXName));
if(anIsYDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aYGetCoord,aYName));
if(anIsZDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aZGetCoord,aZName));
break;
if(anIsXDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXGetCoord,aXName));
if(anIsYDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aYGetCoord,aYName));
if(anIsZDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aZGetCoord,aZName));
break;
}
}
@ -495,7 +495,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
// coordinates
TCoordSlice aTCoordSlice = aNodeInfo->GetCoordSlice( iNode );
for(TInt iCoord = 0; iCoord < aMeshDimension; iCoord++){
aTCoordSlice[iCoord] = aCoordHelperPtr->GetCoord(iCoord);
aTCoordSlice[iCoord] = aCoordHelperPtr->GetCoord(iCoord);
}
// node number
int aNodeID = aCoordHelperPtr->GetID();

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_
@ -90,9 +95,9 @@ SMESH_ActorDef* SMESH_ActorDef::New(){
SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
const char* theEntry,
const char* theName,
int theIsClear)
const char* theEntry,
const char* theName,
int theIsClear)
{
SMESH_ActorDef* anActor = SMESH_ActorDef::New();
if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
@ -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 );
@ -664,7 +677,7 @@ SetControlMode(eControl theMode)
void
SMESH_ActorDef::
SetControlMode(eControl theMode,
bool theCheckEntityMode)
bool theCheckEntityMode)
{
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
if( !mgr )
@ -796,41 +809,41 @@ SetControlMode(eControl theMode,
myControlMode = theMode;
switch(myControlMode){
case eFreeNodes:
myNodeExtActor->SetExtControlMode(aFunctor);
break;
myNodeExtActor->SetExtControlMode(aFunctor);
break;
case eFreeEdges:
case eFreeBorders:
my1DExtActor->SetExtControlMode(aFunctor);
break;
my1DExtActor->SetExtControlMode(aFunctor);
break;
case eFreeFaces:
my2DExtActor->SetExtControlMode(aFunctor);
break;
my2DExtActor->SetExtControlMode(aFunctor);
break;
case eLength2D:
case eMultiConnection2D:
my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable);
break;
my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable);
break;
default:
myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
}
}
if(theCheckEntityMode){
if(myControlActor == my1DActor)
SetEntityMode(eEdges);
SetEntityMode(eEdges);
else if(myControlActor == my2DActor){
switch(myControlMode){
case eLength2D:
case eFreeEdges:
case eFreeFaces:
case eMultiConnection2D:
//SetEntityMode(eEdges);
SetEntityMode(eFaces);
break;
default:
SetEntityMode(eFaces);
}
switch(myControlMode){
case eLength2D:
case eFreeEdges:
case eFreeFaces:
case eMultiConnection2D:
//SetEntityMode(eEdges);
SetEntityMode(eFaces);
break;
default:
SetEntityMode(eFaces);
}
}else if(myControlActor == my3DActor)
SetEntityMode(eVolumes);
SetEntityMode(eVolumes);
}
}else if(theCheckEntityMode){
@ -900,9 +913,9 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
const char* theEntry,
const char* theName,
int theIsClear)
const char* theEntry,
const char* theName,
int theIsClear)
{
Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
setIO(anIO);
@ -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();
}
@ -1149,21 +1162,21 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
if(myControlMode != eNone){
switch(myControlMode){
case eFreeNodes:
myNodeExtActor->VisibilityOn();
break;
myNodeExtActor->VisibilityOn();
break;
case eFreeEdges:
case eFreeBorders:
my1DExtActor->VisibilityOn();
break;
my1DExtActor->VisibilityOn();
break;
case eFreeFaces:
my2DExtActor->VisibilityOn();
break;
my2DExtActor->VisibilityOn();
break;
case eLength2D:
case eMultiConnection2D:
my1DExtActor->VisibilityOn();
my1DExtActor->VisibilityOn();
default:
if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
myScalarBarActor->VisibilityOn();
if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
myScalarBarActor->VisibilityOn();
}
}
@ -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");
@ -1458,12 +1475,12 @@ void SMESH_ActorDef::UpdateHighlight(){
myHighlitableActor->SetHighlited(anIsVisible);
myHighlitableActor->SetVisibility(anIsVisible);
myHighlitableActor->GetExtractUnstructuredGrid()->
SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
}else if(myRepresentation == ePoint || GetPointRepresentation()){
myHighlitableActor->SetHighlited(anIsVisible);
myHighlitableActor->GetExtractUnstructuredGrid()->
SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
myHighlitableActor->SetVisibility(anIsVisible);
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
}
@ -1581,7 +1598,7 @@ void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType
mySurfaceProp->SetColor(r,g,b);
if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
if( aGroupObj->GetElementType() == SMDSAbs_Face ||
aGroupObj->GetElementType() == SMDSAbs_Volume )
aGroupObj->GetElementType() == SMDSAbs_Volume )
myNameActor->SetBackgroundColor(r,g,b);
Modified();
}
@ -1754,8 +1771,8 @@ GetClippingPlane(vtkIdType theID)
static void ComputeBoundsParam(vtkDataSet* theDataSet,
vtkFloatingPointType theDirection[3], vtkFloatingPointType theMinPnt[3],
vtkFloatingPointType& theMaxBoundPrj, vtkFloatingPointType& theMinBoundPrj)
vtkFloatingPointType theDirection[3], vtkFloatingPointType theMinPnt[3],
vtkFloatingPointType& theMaxBoundPrj, vtkFloatingPointType& theMinBoundPrj)
{
vtkFloatingPointType aBounds[6];
theDataSet->GetBounds(aBounds);
@ -1769,13 +1786,13 @@ static void ComputeBoundsParam(vtkDataSet* theDataSet,
}
vtkFloatingPointType aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]},
{aBounds[1],aBounds[2],aBounds[4]},
{aBounds[0],aBounds[3],aBounds[4]},
{aBounds[1],aBounds[3],aBounds[4]},
{aBounds[0],aBounds[2],aBounds[5]},
{aBounds[1],aBounds[2],aBounds[5]},
{aBounds[0],aBounds[3],aBounds[5]},
{aBounds[1],aBounds[3],aBounds[5]}};
{aBounds[1],aBounds[2],aBounds[4]},
{aBounds[0],aBounds[3],aBounds[4]},
{aBounds[1],aBounds[3],aBounds[4]},
{aBounds[0],aBounds[2],aBounds[5]},
{aBounds[1],aBounds[2],aBounds[5]},
{aBounds[0],aBounds[3],aBounds[5]},
{aBounds[1],aBounds[3],aBounds[5]}};
int aMaxId = 0, aMinId = aMaxId;
theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]);
@ -1799,7 +1816,7 @@ static void ComputeBoundsParam(vtkDataSet* theDataSet,
static void DistanceToPosition(vtkDataSet* theDataSet,
vtkFloatingPointType theDirection[3], vtkFloatingPointType theDist, vtkFloatingPointType thePos[3])
vtkFloatingPointType theDirection[3], vtkFloatingPointType theDist, vtkFloatingPointType thePos[3])
{
vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
@ -1811,7 +1828,7 @@ static void DistanceToPosition(vtkDataSet* theDataSet,
static void PositionToDistance(vtkDataSet* theDataSet,
vtkFloatingPointType theDirection[3], vtkFloatingPointType thePos[3], vtkFloatingPointType& theDist)
vtkFloatingPointType theDirection[3], vtkFloatingPointType thePos[3], vtkFloatingPointType& theDist)
{
vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);

View File

@ -44,9 +44,9 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
public:
vtkTypeMacro(SMESH_Actor,SALOME_Actor);
static SMESH_Actor* New(TVisualObjPtr theVisualObj,
const char* theEntry,
const char* theName,
int theIsClear);
const char* theEntry,
const char* theName,
int theIsClear);
virtual void SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
virtual void GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
@ -102,7 +102,7 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes,
eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio,
eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D};
eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D};
virtual void SetControlMode(eControl theMode) = 0;
virtual eControl GetControlMode() = 0;

View File

@ -272,9 +272,9 @@ class SMESH_ActorDef : public SMESH_Actor
~SMESH_ActorDef();
bool Init(TVisualObjPtr theVisualObj,
const char* theEntry,
const char* theName,
int theIsClear);
const char* theEntry,
const char* theName,
int theIsClear);
void SetIsShrunkable(bool theShrunkable);
void UpdateHighlight();

View File

@ -41,7 +41,7 @@ namespace SMESH
vtkFloatingPointType
GetFloat( const QString& theValue,
vtkFloatingPointType theDefault )
vtkFloatingPointType theDefault )
{
int pos = theValue.indexOf( ":" );
vtkFloatingPointType val = theDefault;
@ -50,15 +50,15 @@ namespace SMESH
QString name = theValue.right( theValue.length()-pos-1 ),
sect = theValue.left( pos );
if( !name.isEmpty() && !sect.isEmpty() )
val = GetFloat( name, sect, theDefault );
val = GetFloat( name, sect, theDefault );
}
return val;
}
vtkFloatingPointType
GetFloat( const QString& theValue,
const QString& theSection,
vtkFloatingPointType theDefault )
const QString& theSection,
vtkFloatingPointType theDefault )
{
vtkFloatingPointType val = theDefault;
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
@ -70,7 +70,7 @@ namespace SMESH
void
WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid,
const char* theFileName)
const char* theFileName)
{
vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
aWriter->SetFileName(theFileName);
@ -83,8 +83,8 @@ namespace SMESH
QColor
GetColor( const QString& theSect,
const QString& theName,
const QColor& def )
const QString& theName,
const QColor& def )
{
QColor c = def;
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
@ -95,11 +95,11 @@ namespace SMESH
void
GetColor( const QString& theSect,
const QString& theName,
int& r,
int& g,
int& b,
const QColor& def )
const QString& theName,
int& r,
int& g,
int& b,
const QColor& def )
{
QColor c = def;
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
@ -111,11 +111,11 @@ namespace SMESH
void
GetColor( const QString& theSect,
const QString& theName,
vtkFloatingPointType& r,
vtkFloatingPointType& g,
vtkFloatingPointType& b,
const QColor& def )
const QString& theName,
vtkFloatingPointType& r,
vtkFloatingPointType& g,
vtkFloatingPointType& b,
const QColor& def )
{
int ir( 0 ), ig( 0 ), ib( 0 );
GetColor( theSect, theName, ir, ig, ib, def );

View File

@ -33,42 +33,42 @@ namespace SMESH
SMESHOBJECT_EXPORT
vtkFloatingPointType
GetFloat( const QString& theValue,
vtkFloatingPointType theDefault = 0 );
vtkFloatingPointType theDefault = 0 );
SMESHOBJECT_EXPORT
vtkFloatingPointType
GetFloat( const QString& theName,
const QString& theSection,
vtkFloatingPointType theDefault = 0 );
const QString& theSection,
vtkFloatingPointType theDefault = 0 );
SMESHOBJECT_EXPORT
QColor
GetColor( const QString& theSect,
const QString& theName,
const QColor& = QColor() );
const QString& theName,
const QColor& = QColor() );
SMESHOBJECT_EXPORT
void
GetColor( const QString& theSect,
const QString& theName,
int&,
int&,
int&,
const QColor& = QColor() );
const QString& theName,
int&,
int&,
int&,
const QColor& = QColor() );
SMESHOBJECT_EXPORT
void
GetColor( const QString& theSect,
const QString& theName,
vtkFloatingPointType&,
vtkFloatingPointType&,
vtkFloatingPointType&,
const QColor& = QColor() );
const QString& theName,
vtkFloatingPointType&,
vtkFloatingPointType&,
vtkFloatingPointType&,
const QColor& = QColor() );
SMESHOBJECT_EXPORT
void
WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid,
const char* theFileName);
const char* theFileName);
}

View File

@ -91,7 +91,7 @@ SMESH_DeviceActor
myMapper = vtkPolyDataMapper::New();
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
myPolygonOffsetUnits);
myPolygonOffsetUnits);
myMapper->UseLookupTableScalarRangeOn();
myMapper->SetColorModeToMapScalars();
@ -281,8 +281,8 @@ SMESH_DeviceActor
void
SMESH_DeviceActor
::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable)
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable)
{
bool anIsInitialized = theFunctor;
if(anIsInitialized){
@ -304,23 +304,23 @@ SMESH_DeviceActor
using namespace SMESH::Controls;
if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get())){
for(vtkIdType i = 0; i < aNbCells; i++){
vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
double aValue = aNumericalFunctor->GetValue(anObjId);
aScalars->SetValue(i,aValue);
vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
double aValue = aNumericalFunctor->GetValue(anObjId);
aScalars->SetValue(i,aValue);
}
}else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get())){
for(vtkIdType i = 0; i < aNbCells; i++){
vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
bool aValue = aPredicate->IsSatisfy(anObjId);
aScalars->SetValue(i,aValue);
vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
bool aValue = aPredicate->IsSatisfy(anObjId);
aScalars->SetValue(i,aValue);
}
}
aDataSet->GetCellData()->SetScalars(aScalars);
aScalars->Delete();
theLookupTable->SetRange(aScalars->GetRange());
theLookupTable->SetNumberOfTableValues(theScalarBarActor->GetMaximumNumberOfColors());
theLookupTable->Build();
@ -335,8 +335,8 @@ SMESH_DeviceActor
void
SMESH_DeviceActor
::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable)
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable)
{
bool anIsInitialized = theFunctor;
myExtractUnstructuredGrid->ClearRegisteredCells();
@ -374,18 +374,18 @@ SMESH_DeviceActor
Length2D::TValues::const_iterator anIter = aValues.begin();
for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
const Length2D::Value& aValue = *anIter;
int aNode[2] = {
myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
myVisualObj->GetNodeVTKId(aValue.myPntId[1])
};
if(aNode[0] >= 0 && aNode[1] >= 0){
anIdList->SetId( 0, aNode[0] );
anIdList->SetId( 1, aNode[1] );
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
aScalars->SetValue(aVtkId,aValue.myLength);
}
const Length2D::Value& aValue = *anIter;
int aNode[2] = {
myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
myVisualObj->GetNodeVTKId(aValue.myPntId[1])
};
if(aNode[0] >= 0 && aNode[1] >= 0){
anIdList->SetId( 0, aNode[0] );
anIdList->SetId( 1, aNode[1] );
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
aScalars->SetValue(aVtkId,aValue.myLength);
}
}
VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
@ -394,7 +394,7 @@ SMESH_DeviceActor
aConnectivity->InitTraversal();
for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
SetUnstructuredGrid(aDataSet);
@ -434,18 +434,18 @@ SMESH_DeviceActor
MultiConnection2D::MValues::const_iterator anIter = aValues.begin();
for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
const MultiConnection2D::Value& aValue = (*anIter).first;
int aNode[2] = {
myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
myVisualObj->GetNodeVTKId(aValue.myPntId[1])
};
if(aNode[0] >= 0 && aNode[1] >= 0){
anIdList->SetId( 0, aNode[0] );
anIdList->SetId( 1, aNode[1] );
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
aScalars->SetValue(aVtkId,(*anIter).second);
}
const MultiConnection2D::Value& aValue = (*anIter).first;
int aNode[2] = {
myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
myVisualObj->GetNodeVTKId(aValue.myPntId[1])
};
if(aNode[0] >= 0 && aNode[1] >= 0){
anIdList->SetId( 0, aNode[0] );
anIdList->SetId( 1, aNode[1] );
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
aScalars->SetValue(aVtkId,(*anIter).second);
}
}
VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
@ -454,7 +454,7 @@ SMESH_DeviceActor
aConnectivity->InitTraversal();
for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
SetUnstructuredGrid(aDataSet);
@ -492,7 +492,7 @@ SMESH_DeviceActor
for( vtkIdType i = 0; i < aNbCells; i++ ){
vtkIdType anObjId = myVisualObj->GetElemObjId(i);
if(aFreePredicate->IsSatisfy(anObjId))
myExtractUnstructuredGrid->RegisterCell(i);
myExtractUnstructuredGrid->RegisterCell(i);
}
if(!myExtractUnstructuredGrid->IsCellsRegistered())
myExtractUnstructuredGrid->RegisterCell(-1);
@ -520,15 +520,15 @@ SMESH_DeviceActor
for(; anIter != aBorders.end(); anIter++){
const FreeEdges::Border& aBorder = *anIter;
int aNode[2] = {
myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
myVisualObj->GetNodeVTKId(aBorder.myPntId[1])
myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
myVisualObj->GetNodeVTKId(aBorder.myPntId[1])
};
//cout<<"aNode = "<<aBorder.myPntId[0]<<"; "<<aBorder.myPntId[1]<<endl;
if(aNode[0] >= 0 && aNode[1] >= 0){
anIdList->SetId( 0, aNode[0] );
anIdList->SetId( 1, aNode[1] );
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
anIdList->SetId( 0, aNode[0] );
anIdList->SetId( 1, aNode[1] );
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
}
}
@ -546,12 +546,11 @@ 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);
if(aFreeNodes->IsSatisfy(anObjId))
myExtractUnstructuredGrid->RegisterCell(i);
myExtractUnstructuredGrid->RegisterCell(i);
}
if(!myExtractUnstructuredGrid->IsCellsRegistered())
myExtractUnstructuredGrid->RegisterCell(-1);
@ -828,7 +827,7 @@ SMESH_DeviceActor
void
SMESH_DeviceActor
::SetPolygonOffsetParameters(vtkFloatingPointType factor,
vtkFloatingPointType units)
vtkFloatingPointType units)
{
myPolygonOffsetFactor = factor;
myPolygonOffsetUnits = units;

View File

@ -109,11 +109,11 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
vtkUnstructuredGrid* GetUnstructuredGrid();
void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable);
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable);
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
bool IsHighlited() { return myIsHighlited;}
@ -161,11 +161,11 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
void
SetPolygonOffsetParameters(vtkFloatingPointType factor,
vtkFloatingPointType units);
vtkFloatingPointType units);
void
GetPolygonOffsetParameters(vtkFloatingPointType& factor,
vtkFloatingPointType& units)
vtkFloatingPointType& units)
{
factor = myPolygonOffsetFactor;
units = myPolygonOffsetUnits;

View File

@ -152,7 +152,7 @@ int SMESH_ExtractGeometry::RequestData(
{
newId = newPts->InsertNextPoint(x);
pointMap[ptId] = newId;
myNodeVTK2ObjIds.push_back(ptId);
myNodeVTK2ObjIds.push_back(ptId);
outputPD->CopyData(pd,ptId,newId);
}
}
@ -175,7 +175,7 @@ int SMESH_ExtractGeometry::RequestData(
{
newId = newPts->InsertNextPoint(x);
pointMap[ptId] = newId;
myNodeVTK2ObjIds.push_back(ptId);
myNodeVTK2ObjIds.push_back(ptId);
outputPD->CopyData(pd,ptId,newId);
}
}
@ -228,7 +228,7 @@ int SMESH_ExtractGeometry::RequestData(
x = input->GetPoint(ptId);
newId = newPts->InsertNextPoint(x);
pointMap[ptId] = newId;
myNodeVTK2ObjIds.push_back(ptId);
myNodeVTK2ObjIds.push_back(ptId);
outputPD->CopyData(pd,ptId,newId);
}
newCellPts->InsertId(i,pointMap[ptId]);

View File

@ -209,8 +209,8 @@ void GetFaceParams( vtkCell* theFace, double theNormal[3], double& theSize )
double* aBounds = theFace->GetBounds();
theSize = pow( pow( aBounds[1] - aBounds[0], 2 ) +
pow( aBounds[3] - aBounds[2], 2 ) +
pow( aBounds[5] - aBounds[4], 2 ), 0.5 );
pow( aBounds[3] - aBounds[2], 2 ) +
pow( aBounds[5] - aBounds[4], 2 ), 0.5 );
}
/*!
@ -268,7 +268,7 @@ int SMESH_FaceOrientationFilter::RequestData(
input->GetCellNeighbors( aCellId, aFace->PointIds, aNeighborIds );
if( aNeighborIds->GetNumberOfIds() > 0 )
continue;
continue;
double aSize, aNormal[3];
GetFaceParams( aFace, aNormal, aSize );

View File

@ -46,7 +46,7 @@
#include <vtkUnstructuredGrid.h>
#include <memory>
#include <sstream>
#include <sstream>
#include <stdexcept>
#include <set>
@ -81,7 +81,7 @@ static int MYDEBUGWITHFILES = 0;
// purpose : Get type of VTK cell
//=================================================================================
static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
const bool thePoly,
const bool thePoly,
const int theNbNodes )
{
switch( theType )
@ -263,7 +263,7 @@ namespace{
typedef std::vector<const SMDS_MeshElement*> TConnect;
int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter,
TConnect& theConnect)
TConnect& theConnect)
{
theConnect.clear();
for(; theNodesIter->more();)
@ -273,10 +273,10 @@ namespace{
inline
void SetId(vtkIdList *theIdList,
const SMESH_VisualObjDef::TMapOfIds& theSMDS2VTKNodes,
const TConnect& theConnect,
int thePosition,
int theId)
const SMESH_VisualObjDef::TMapOfIds& theSMDS2VTKNodes,
const TConnect& theConnect,
int thePosition,
int theId)
{
theIdList->SetId(thePosition,theSMDS2VTKNodes.find(theConnect[theId]->GetID())->second);
}
@ -372,12 +372,12 @@ void SMESH_VisualObjDef::buildElemPrs()
myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
switch (aType) {
case SMDSAbs_Volume:{
switch (aType) {
case SMDSAbs_Volume:{
aConnect.clear();
std::vector<int> aConnectivities;
// Convertions connectivities from SMDS to VTK
if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
std::vector<int> aConnectivities;
// Convertions connectivities from SMDS to VTK
if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
if ( const SMDS_PolyhedralVolumeOfNodes* ph =
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem))
@ -385,67 +385,67 @@ void SMESH_VisualObjDef::buildElemPrs()
aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect);
anIdList->SetNumberOfIds( aNbNodes );
}
for (int k = 0; k < aNbNodes; k++)
aConnectivities.push_back(k);
for (int k = 0; k < aNbNodes; k++)
aConnectivities.push_back(k);
} else if (aNbNodes == 4) {
static int anIds[] = {0,2,1,3};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
static int anIds[] = {0,2,1,3};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
} else if (aNbNodes == 5) {
static int anIds[] = {0,3,2,1,4};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
} else if (aNbNodes == 5) {
static int anIds[] = {0,3,2,1,4};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
} else if (aNbNodes == 6) {
static int anIds[] = {0,1,2,3,4,5};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
} else if (aNbNodes == 6) {
static int anIds[] = {0,1,2,3,4,5};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
}
}
else if (aNbNodes == 8) {
static int anIds[] = {0,3,2,1,4,7,6,5};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
static int anIds[] = {0,3,2,1,4,7,6,5};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
}
}
else if (aNbNodes == 10) {
static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
}
static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
}
else if (aNbNodes == 13) {
static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
}
static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
}
else if (aNbNodes == 15) {
//static int anIds[] = {0,2,1,3,5,4,8,7,6,11,10,9,12,14,13};
static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
//for (int k = 0; k < aNbNodes; k++) {
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
//for (int k = 0; k < aNbNodes; k++) {
// int nn = aConnectivities[k];
// const SMDS_MeshNode* N = static_cast<const SMDS_MeshNode*> (aConnect[nn]);
// cout<<"k="<<k<<" N("<<N->X()<<","<<N->Y()<<","<<N->Z()<<")"<<endl;
//}
}
}
else if (aNbNodes == 20) {
static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
}
static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
}
else {
}
if ( aConnect.empty() )
GetConnect(aNodesIter,aConnect);
if (aConnectivities.size() > 0) {
for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
}
break;
}
default:
for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
const SMDS_MeshElement* aNode = aNodesIter->next();
anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
}
}
if (aConnectivities.size() > 0) {
for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
}
break;
}
default:
for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
const SMDS_MeshElement* aNode = aNodesIter->next();
anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
}
}
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) );
@ -483,9 +483,9 @@ void SMESH_VisualObjDef::buildElemPrs()
// purpose : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 )
//=================================================================================
bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
const int theEdgeNum,
int& theNodeId1,
int& theNodeId2 ) const
const int theEdgeNum,
int& theNodeId1,
int& theNodeId2 ) const
{
const SMDS_Mesh* aMesh = GetMesh();
if ( aMesh == 0 )
@ -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 ;
}
@ -905,7 +918,7 @@ int SMESH_subMeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const
case SMDSAbs_Volume:
{
SMESH::long_array_var anIds =
mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
return anIds->length();
}
default:
@ -942,7 +955,7 @@ int SMESH_subMeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityLis
else
{
SMESH::long_array_var anIds =
mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
return getPointers( theType, anIds, aMesh, theResList );
}
}

View File

@ -62,9 +62,10 @@ public:
virtual SMDS_Mesh* GetMesh() const = 0;
virtual bool GetEdgeNodes( const int theElemId,
const int theEdgeNum,
int& theNodeId1,
int& theNodeId2 ) const = 0;
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

@ -137,25 +137,25 @@ GEOM_Actor* SMESH_PreviewActorsCollection::createActor(const TopoDS_Shape& shape
actor->SetShape(shape,0,0);
//Color Properties
/*
vtkProperty* aProp = vtkProperty::New();
vtkProperty* aHLProp = vtkProperty::New();
vtkProperty* aPHLProp = vtkProperty::New();
aProp->SetColor( 255, 0, 0);
actor->SetProperty(aProp);
/*
vtkProperty* aProp = vtkProperty::New();
vtkProperty* aHLProp = vtkProperty::New();
vtkProperty* aPHLProp = vtkProperty::New();
aProp->SetColor( 255, 0, 0);
actor->SetProperty(aProp);
aHLProp->SetColor( 255, 255, 255);
actor->SetHighlightProperty(aHLProp);
aHLProp->SetColor( 255, 255, 255);
actor->SetHighlightProperty(aHLProp);
aPHLProp->SetColor( 155, 155, 155);
aPHLProp->SetLineWidth ( 3 );
aPHLProp->SetOpacity ( 0.75 );
actor->SetPreHighlightProperty(aPHLProp);
aPHLProp->SetColor( 155, 155, 155);
aPHLProp->SetLineWidth ( 3 );
aPHLProp->SetOpacity ( 0.75 );
actor->SetPreHighlightProperty(aPHLProp);
aProp->Delete();
aHLProp->Delete();
aPHLProp->Delete();
aProp->Delete();
aHLProp->Delete();
aPHLProp->Delete();
*/
return actor;

View File

@ -36,7 +36,7 @@ using namespace std;
//=======================================================================
SMDS_EdgePosition::SMDS_EdgePosition(const int aEdgeId,
const double aUParam):SMDS_Position(aEdgeId), myUParameter(aUParam)
const double aUParam):SMDS_Position(aEdgeId), myUParameter(aUParam)
{
}
@ -47,21 +47,21 @@ SMDS_EdgePosition::SMDS_EdgePosition(const int aEdgeId,
const double *SMDS_EdgePosition::Coords() const
{
static double origin[]={0,0,0};
MESSAGE("SMDS_EdgePosition::Coords not implemented");
return origin;
static double origin[]={0,0,0};
MESSAGE("SMDS_EdgePosition::Coords not implemented");
return origin;
}
/**
*/
SMDS_TypeOfPosition SMDS_EdgePosition::GetTypeOfPosition() const
{
return SMDS_TOP_EDGE;
return SMDS_TOP_EDGE;
}
void SMDS_EdgePosition::SetUParameter(double aUparam)
{
myUParameter = aUparam;
myUParameter = aUparam;
}
//=======================================================================
@ -71,5 +71,5 @@ void SMDS_EdgePosition::SetUParameter(double aUparam)
double SMDS_EdgePosition::GetUParameter() const
{
return myUParameter;
return myUParameter;
}

View File

@ -75,40 +75,40 @@ public:
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
int ID);
const SMDS_MeshNode * n2,
int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
const SMDS_MeshNode * n2);
// 2d order edge with 3 nodes: n12 - node between n1 and n2
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12,
int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12);
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3);
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshEdge * e1,
const SMDS_MeshEdge * e2,
@ -130,100 +130,100 @@ public:
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3,
int n12,int n23,int n31, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31);
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31);
// 2d order quadrangle
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
int n12,int n23,int n34,int n41, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41);
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int n7, int n8, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshFace * f1,
const SMDS_MeshFace * f2,
@ -263,20 +263,20 @@ public:
int n12,int n23,int n31,
int n14,int n24,int n34, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n24,
const SMDS_MeshNode * n34,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n24,
const SMDS_MeshNode * n34,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
@ -290,24 +290,24 @@ public:
int n15,int n25,int n35,int n45,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n35,
const SMDS_MeshNode * n45,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n35,
const SMDS_MeshNode * n45,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
@ -325,27 +325,27 @@ public:
int n14,int n25,int n36,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n64,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n36,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n64,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n36,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
@ -364,34 +364,34 @@ public:
int n15,int n26,int n37,int n48,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n67,
const SMDS_MeshNode * n78,
const SMDS_MeshNode * n85,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n26,
const SMDS_MeshNode * n37,
const SMDS_MeshNode * n48,
int ID);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n67,
const SMDS_MeshNode * n78,
const SMDS_MeshNode * n85,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n26,
const SMDS_MeshNode * n37,
const SMDS_MeshNode * n48,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
@ -559,29 +559,29 @@ private:
SMDS_Mesh(SMDS_Mesh * parent);
SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3);
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3);
SMDS_MeshFace * createQuadrangle(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4,
int ID);
// SMDS_Mesh0DElement* Find0DElementOrCreate(const SMDS_MeshNode * n);
SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
const SMDS_MeshNode * n2);
SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3);
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3);
SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3,
const SMDS_MeshNode *n4);
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3,
const SMDS_MeshNode *n4);
bool registerElement(int ID, SMDS_MeshElement * element);
void addChildrenWithNodes(std::set<const SMDS_MeshElement*>& setOfChildren,
const SMDS_MeshElement * element,
std::set<const SMDS_MeshElement*>& nodes);
const SMDS_MeshElement * element,
std::set<const SMDS_MeshElement*>& nodes);
inline void adjustmyCellsCapacity(int ID)
{

View File

@ -40,73 +40,73 @@ using namespace std;
/// 5,1 and 7,3 are an edges.
///////////////////////////////////////////////////////////////////////////////
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4,
const SMDS_MeshNode * node5,
const SMDS_MeshNode * node6,
const SMDS_MeshNode * node7,
const SMDS_MeshNode * node8)
const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4,
const SMDS_MeshNode * node5,
const SMDS_MeshNode * node6,
const SMDS_MeshNode * node7,
const SMDS_MeshNode * node8)
{
myNbNodes = 8;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
myNodes[3]=node4;
myNodes[4]=node5;
myNodes[5]=node6;
myNodes[6]=node7;
myNodes[7]=node8;
myNbNodes = 8;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
myNodes[3]=node4;
myNodes[4]=node5;
myNodes[5]=node6;
myNodes[6]=node7;
myNodes[7]=node8;
}
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4)
const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4)
{
myNbNodes = 4;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
myNodes[3]=node4;
myNbNodes = 4;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
myNodes[3]=node4;
}
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4,
const SMDS_MeshNode * node5)
const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4,
const SMDS_MeshNode * node5)
{
myNbNodes = 5;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
myNodes[3]=node4;
myNodes[4]=node5;
myNbNodes = 5;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
myNodes[3]=node4;
myNodes[4]=node5;
}
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4,
const SMDS_MeshNode * node5,
const SMDS_MeshNode * node6)
const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4,
const SMDS_MeshNode * node5,
const SMDS_MeshNode * node6)
{
myNbNodes = 6;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
myNodes[3]=node4;
myNodes[4]=node5;
myNodes[5]=node6;
myNbNodes = 6;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
myNodes[3]=node4;
myNodes[4]=node5;
myNodes[5]=node6;
}
bool SMDS_VolumeOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
@ -139,40 +139,40 @@ SMDS_VolumeOfNodes::~SMDS_VolumeOfNodes()
void SMDS_VolumeOfNodes::Print(ostream & OS) const
{
OS << "volume <" << GetID() << "> : ";
int i;
for (i = 0; i < NbNodes()-1; ++i) OS << myNodes[i] << ",";
OS << myNodes[NbNodes()-1]<< ") " << endl;
OS << "volume <" << GetID() << "> : ";
int i;
for (i = 0; i < NbNodes()-1; ++i) OS << myNodes[i] << ",";
OS << myNodes[NbNodes()-1]<< ") " << endl;
}
int SMDS_VolumeOfNodes::NbFaces() const
{
switch(NbNodes())
{
case 4: return 4;
case 5: return 5;
case 6: return 5;
case 8: return 6;
default: MESSAGE("invalid number of nodes");
}
switch(NbNodes())
{
case 4: return 4;
case 5: return 5;
case 6: return 5;
case 8: return 6;
default: MESSAGE("invalid number of nodes");
}
return 0;
}
int SMDS_VolumeOfNodes::NbNodes() const
{
return myNbNodes;
return myNbNodes;
}
int SMDS_VolumeOfNodes::NbEdges() const
{
switch(NbNodes())
{
case 4: return 6;
case 5: return 8;
case 6: return 9;
case 8: return 12;
default: MESSAGE("invalid number of nodes");
}
switch(NbNodes())
{
case 4: return 6;
case 5: return 8;
case 6: return 9;
case 8: return 12;
default: MESSAGE("invalid number of nodes");
}
return 0;
}
@ -234,7 +234,7 @@ SMDS_ElemIteratorPtr SMDS_VolumeOfNodes::elementsIterator(SMDSAbs_ElementType ty
SMDSAbs_ElementType SMDS_VolumeOfNodes::GetType() const
{
return SMDSAbs_Volume;
return SMDSAbs_Volume;
}
/*!

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

@ -53,9 +53,9 @@ using namespace std;
SMESH_Gen::SMESH_Gen()
{
MESSAGE("SMESH_Gen::SMESH_Gen");
_localId = 0;
_hypId = 0;
MESSAGE("SMESH_Gen::SMESH_Gen");
_localId = 0;
_hypId = 0;
_segmentation = 10;
SMDS_Mesh::_meshList.clear();
MESSAGE(SMDS_Mesh::_meshList.size());
@ -69,7 +69,7 @@ SMESH_Gen::SMESH_Gen()
SMESH_Gen::~SMESH_Gen()
{
MESSAGE("SMESH_Gen::~SMESH_Gen");
MESSAGE("SMESH_Gen::~SMESH_Gen");
}
//=============================================================================
@ -79,26 +79,26 @@ SMESH_Gen::~SMESH_Gen()
//=============================================================================
/*SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId)
throw(SALOME_Exception)
throw(SALOME_Exception)
{
MESSAGE("CreateHypothesis("<<anHyp<<","<<studyId<<")");
// Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
MESSAGE("CreateHypothesis("<<anHyp<<","<<studyId<<")");
// Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
StudyContextStruct *myStudyContext = GetStudyContext(studyId);
StudyContextStruct *myStudyContext = GetStudyContext(studyId);
// create a new hypothesis object, store its ref. in studyContext
// create a new hypothesis object, store its ref. in studyContext
SMESH_Hypothesis *myHypothesis = _hypothesisFactory.Create(anHyp, studyId);
int hypId = myHypothesis->GetID();
myStudyContext->mapHypothesis[hypId] = myHypothesis;
SCRUTE(studyId);
SCRUTE(hypId);
SMESH_Hypothesis *myHypothesis = _hypothesisFactory.Create(anHyp, studyId);
int hypId = myHypothesis->GetID();
myStudyContext->mapHypothesis[hypId] = myHypothesis;
SCRUTE(studyId);
SCRUTE(hypId);
// store hypothesis in SMESHDS document
// store hypothesis in SMESHDS document
myStudyContext->myDocument->AddHypothesis(myHypothesis);
return myHypothesis;
myStudyContext->myDocument->AddHypothesis(myHypothesis);
return myHypothesis;
}*/
//=============================================================================
@ -118,10 +118,10 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
// create a new SMESH_mesh object
SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++,
theStudyId,
this,
theIsEmbeddedMode,
aStudyContext->myDocument);
theStudyId,
this,
theIsEmbeddedMode,
aStudyContext->myDocument);
aStudyContext->mapMesh[_localId] = aMesh;
return aMesh;
@ -136,8 +136,8 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool anUpward,
const ::MeshDimension aDim,
TSetOfInt* aShapesId)
const ::MeshDimension aDim,
TSetOfInt* aShapesId)
{
MESSAGE("SMESH_Gen::Compute");
MEMOSTAT;
@ -172,7 +172,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
// clear compute state to not show previous compute errors
// if preview invoked less dimension less than previous
smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
continue;
continue;
}
if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
@ -182,7 +182,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
ret = false;
else if ( aShapesId )
aShapesId->insert( smToCompute->GetId() );
aShapesId->insert( smToCompute->GetId() );
}
return ret;
}
@ -207,7 +207,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
// check for preview dimension limitations
if ( aShapesId && aShapeDim > (int)aDim )
continue;
continue;
SMESH_Algo* algo = GetAlgo( aMesh, aSubShape );
if ( algo && !algo->NeedDescretBoundary() )
@ -215,11 +215,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
if ( algo->SupportSubmeshes() )
smWithAlgoSupportingSubmeshes.push_back( smToCompute );
else
{
{
smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
if ( aShapesId )
aShapesId->insert( smToCompute->GetId() );
}
if ( aShapesId )
aShapesId->insert( smToCompute->GetId() );
}
}
}
// ------------------------------------------------------------
@ -246,14 +246,14 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
SMESH_subMesh* smToCompute = smIt->next();
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
const int aShapeDim = GetShapeDim( aSubShape );
const int aShapeDim = GetShapeDim( aSubShape );
//if ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue;
if ( aShapeDim < 1 ) continue;
if ( aShapeDim < 1 ) continue;
// check for preview dimension limitations
if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
continue;
// check for preview dimension limitations
if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
continue;
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
@ -271,18 +271,20 @@ 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();
// check for preview dimension limitations
if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
continue;
const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType();
// check for preview dimension limitations
if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
continue;
sm->ComputeStateEngine( SMESH_subMesh::COMPUTE );
if ( aShapesId )
aShapesId->insert( sm->GetId() );
if ( aShapesId )
aShapesId->insert( sm->GetId() );
}
}
// -----------------------------------------------
// mesh the rest subshapes starting from vertices
// -----------------------------------------------
@ -304,8 +306,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap,
const bool anUpward,
TSetOfInt* aShapesId)
const bool anUpward,
TSetOfInt* aShapesId)
{
MESSAGE("SMESH_Gen::Evaluate");
@ -330,14 +332,14 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
//if ( !aMesh.HasShapeToMesh() && aShType == TopAbs_VERTEX )
// continue;
if ( !aMesh.HasShapeToMesh() ) {
if( aShType == TopAbs_VERTEX || aShType == TopAbs_WIRE ||
aShType == TopAbs_SHELL )
continue;
if( aShType == TopAbs_VERTEX || aShType == TopAbs_WIRE ||
aShType == TopAbs_SHELL )
continue;
}
smToCompute->Evaluate(aResMap);
if( aShapesId )
aShapesId->insert( smToCompute->GetId() );
aShapesId->insert( smToCompute->GetId() );
}
return ret;
}
@ -359,12 +361,12 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
if ( algo && !algo->NeedDescretBoundary() ) {
if ( algo->SupportSubmeshes() ) {
smWithAlgoSupportingSubmeshes.push_back( smToCompute );
}
}
else {
smToCompute->Evaluate(aResMap);
if ( aShapesId )
aShapesId->insert( smToCompute->GetId() );
}
if ( aShapesId )
aShapesId->insert( smToCompute->GetId() );
}
}
}
// ------------------------------------------------------------
@ -389,10 +391,10 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
SMESH_subMesh* smToCompute = smIt->next();
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
const int aShapeDim = GetShapeDim( aSubShape );
if ( aShapeDim < 1 ) continue;
const int aShapeDim = GetShapeDim( aSubShape );
if ( aShapeDim < 1 ) continue;
//const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType();
//const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType();
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter
@ -410,10 +412,12 @@ 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() );
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 ) {
@ -830,16 +804,16 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh,
StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId)
{
// Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
// Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
if (_mapStudyContext.find(studyId) == _mapStudyContext.end())
{
_mapStudyContext[studyId] = new StudyContextStruct;
_mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId);
}
StudyContextStruct *myStudyContext = _mapStudyContext[studyId];
if (_mapStudyContext.find(studyId) == _mapStudyContext.end())
{
_mapStudyContext[studyId] = new StudyContextStruct;
_mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId);
}
StudyContextStruct *myStudyContext = _mapStudyContext[studyId];
// ASSERT(_mapStudyContext.find(studyId) != _mapStudyContext.end());
return myStudyContext;
return myStudyContext;
}
// //=============================================================================
@ -904,6 +878,6 @@ int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType)
int SMESH_Gen::GetANewId()
{
//MESSAGE("SMESH_Gen::GetANewId");
return _hypId++;
//MESSAGE("SMESH_Gen::GetANewId");
return _hypId++;
}

View File

@ -61,7 +61,7 @@ typedef std::set<int> TSetOfInt;
class SMESH_EXPORT SMESH_Gen
{
public:
public:
SMESH_Gen();
~SMESH_Gen();
@ -78,8 +78,8 @@ class SMESH_EXPORT SMESH_Gen
bool Compute(::SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool anUpward=false,
const ::MeshDimension aDim=::MeshDim_3D,
TSetOfInt* aShapesId=0);
const ::MeshDimension aDim=::MeshDim_3D,
TSetOfInt* aShapesId=0);
/*!
* \brief evaluates size of prospective mesh on a shape
@ -89,8 +89,8 @@ class SMESH_EXPORT SMESH_Gen
* \retval bool - is a success
*/
bool Evaluate(::SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap,
const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap,
const bool anUpward=false,
TSetOfInt* aShapesId=0);
@ -109,7 +109,7 @@ class SMESH_EXPORT SMESH_Gen
*/
void SetDefaultNbSegments(int nb) { _nbSegments = nb; }
int GetDefaultNbSegments() const { return _nbSegments; }
struct TAlgoStateError
{
TAlgoStateErrorName _name;
@ -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,9 +146,9 @@ 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
int _localId; // unique Id of created objects, within SMESH_Gen entity
std::map < int, StudyContextStruct * >_mapStudyContext;
// hypotheses managing

View File

@ -39,8 +39,8 @@ using namespace std;
//=============================================================================
SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
int studyId,
SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId)
int studyId,
SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId)
{
//MESSAGE("SMESH_Hypothesis::SMESH_Hypothesis");
_gen = gen;

View File

@ -81,10 +81,10 @@ typedef SMESH_HypoFilter THypType;
//=============================================================================
SMESH_Mesh::SMESH_Mesh(int theLocalId,
int theStudyId,
SMESH_Gen* theGen,
bool theIsEmbeddedMode,
SMESHDS_Document* theDocument):
int theStudyId,
SMESH_Gen* theGen,
bool theIsEmbeddedMode,
SMESHDS_Document* theDocument):
_groupId( 0 ), _nbSubShapes( 0 )
{
MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)");
@ -325,14 +325,14 @@ void SMESH_Mesh::ClearSubMesh(const int theShapeId)
if ( SMESH_subMesh *sm = GetSubMeshContaining( theShapeId ) )
{
SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true,
/*complexShapeFirst=*/false);
/*complexShapeFirst=*/false);
while ( smIt->more() )
{
sm = smIt->next();
TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType();
if ( shapeType == TopAbs_VERTEX || shapeType < TopAbs_SOLID )
// all other shapes depends on vertices so they are already cleaned
sm->ComputeStateEngine( SMESH_subMesh::CLEAN );
// all other shapes depends on vertices so they are already cleaned
sm->ComputeStateEngine( SMESH_subMesh::CLEAN );
// to recompute even if failed
sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
}
@ -373,21 +373,21 @@ int SMESH_Mesh::UNVToMesh(const char* theFileName)
SMESH_Group* aSMESHGroup = AddGroup( aSubGroup->GetType(), aName.c_str(), aId );
if ( aSMESHGroup ) {
if(MYDEBUG) MESSAGE("UNVToMesh - group added: "<<aName);
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( aSMESHGroup->GetGroupDS() );
if ( aGroupDS ) {
aGroupDS->SetStoreName(aName.c_str());
aSubGroup->InitIterator();
const SMDS_MeshElement* aElement = 0;
while (aSubGroup->More()) {
aElement = aSubGroup->Next();
if (aElement) {
aGroupDS->SMDSGroup().Add(aElement);
}
}
if (aElement)
aGroupDS->SetType(aElement->GetType());
}
if(MYDEBUG) MESSAGE("UNVToMesh - group added: "<<aName);
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( aSMESHGroup->GetGroupDS() );
if ( aGroupDS ) {
aGroupDS->SetStoreName(aName.c_str());
aSubGroup->InitIterator();
const SMDS_MeshElement* aElement = 0;
while (aSubGroup->More()) {
aElement = aSubGroup->Next();
if (aElement) {
aGroupDS->SMDSGroup().Add(aElement);
}
}
if (aElement)
aGroupDS->SetType(aElement->GetType());
}
}
}
}
@ -1086,9 +1086,9 @@ bool SMESH_Mesh::HasDuplicatedGroupNamesMED()
}
void SMESH_Mesh::ExportMED(const char *file,
const char* theMeshName,
bool theAutoGroups,
int theVersion)
const char* theMeshName,
bool theAutoGroups,
int theVersion)
throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
@ -1376,7 +1376,7 @@ bool SMESH_Mesh::IsMainShape(const TopoDS_Shape& theShape) const
SMESH_Group* SMESH_Mesh::AddGroup (const SMDSAbs_ElementType theType,
const char* theName,
int& theId,
int& theId,
const TopoDS_Shape& theShape)
{
if (_mapGroup.find(_groupId) != _mapGroup.end())

View File

@ -55,10 +55,10 @@ class SMESH_EXPORT SMESH_Mesh
{
public:
SMESH_Mesh(int theLocalId,
int theStudyId,
SMESH_Gen* theGen,
bool theIsEmbeddedMode,
SMESHDS_Document* theDocument);
int theStudyId,
SMESH_Gen* theGen,
bool theIsEmbeddedMode,
SMESHDS_Document* theDocument);
virtual ~SMESH_Mesh();
@ -162,7 +162,7 @@ public:
* \brief Return True if anHyp is used to mesh aSubShape
*/
bool IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
const SMESH_subMesh * aSubMesh);
const SMESH_subMesh * aSubMesh);
/*!
* \brief check if a hypothesis alowing notconform mesh is present
*/
@ -191,9 +191,9 @@ public:
bool HasDuplicatedGroupNamesMED();
void ExportMED(const char *file,
const char* theMeshName = NULL,
bool theAutoGroups = true,
int theVersion = 0)
const char* theMeshName = NULL,
bool theAutoGroups = true,
int theVersion = 0)
throw(SALOME_Exception);
void ExportDAT(const char *file) throw(SALOME_Exception);
@ -231,8 +231,8 @@ public:
int NbGroup() const { return _mapGroup.size(); }
SMESH_Group* AddGroup (const SMDSAbs_ElementType theType,
const char* theName,
int& theId,
const char* theName,
int& theId,
const TopoDS_Shape& theShape=TopoDS_Shape());
typedef boost::shared_ptr< SMDS_Iterator<SMESH_Group*> > GroupIteratorPtr;

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;
@ -391,7 +416,7 @@ public:
typedef std::list< std::list< int > > TListOfListOfElementsID;
void FindEqualElements(std::set<const SMDS_MeshElement*> & theElements,
TListOfListOfElementsID & theGroupsOfElementsID);
TListOfListOfElementsID & theGroupsOfElementsID);
// Return list of group of elements build on the same nodes.
// Search among theElements or in the whole mesh if theElements is empty.
@ -576,6 +601,9 @@ public:
const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; }
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,
@ -584,7 +612,14 @@ public:
bool DoubleNodesInRegion( const TIDSortedElemSet& theElems,
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:
/*!
@ -653,25 +688,25 @@ private:
* auxilary for ExtrusionAlongTrack
*/
Extrusion_Error MakeEdgePathPoints(std::list<double>& aPrms,
const TopoDS_Edge& aTrackEdge,
bool FirstIsStart,
list<SMESH_MeshEditor_PathPoint>& LPP);
const TopoDS_Edge& aTrackEdge,
bool FirstIsStart,
list<SMESH_MeshEditor_PathPoint>& LPP);
Extrusion_Error MakeExtrElements(TIDSortedElemSet& theElements,
list<SMESH_MeshEditor_PathPoint>& fullList,
const bool theHasAngles,
list<double>& theAngles,
const bool theLinearVariation,
const bool theHasRefPoint,
const gp_Pnt& theRefPoint,
const bool theMakeGroups);
list<SMESH_MeshEditor_PathPoint>& fullList,
const bool theHasAngles,
list<double>& theAngles,
const bool theLinearVariation,
const bool theHasRefPoint,
const gp_Pnt& theRefPoint,
const bool theMakeGroups);
void LinearAngleVariation(const int NbSteps,
list<double>& theAngles);
list<double>& theAngles);
bool doubleNodes( SMESHDS_Mesh* theMeshDS,
const TIDSortedElemSet& theElems,
const TIDSortedElemSet& theNodesNot,
std::map< const SMDS_MeshNode*,
const SMDS_MeshNode* >& theNodeNodeMap,
const SMDS_MeshNode* >& theNodeNodeMap,
const bool theIsDoubleElem );
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,42 +356,49 @@ 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
TopLoc_Location loc;
Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
Standard_Boolean isUPeriodic = S->IsUPeriodic();
Standard_Boolean isVPeriodic = S->IsVPeriodic();
if ( isUPeriodic || isVPeriodic ) {
Standard_Real UF,UL,VF,VL;
S->Bounds(UF,UL,VF,VL);
if(isUPeriodic)
uv.SetX( uv.X() + ShapeAnalysis::AdjustToPeriod(uv.X(),UF,UL));
if(isVPeriodic)
uv.SetY( uv.Y() + ShapeAnalysis::AdjustToPeriod(uv.Y(),VF,VL));
}
else
{ // adjust uv to period
TopLoc_Location loc;
Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
Standard_Boolean isUPeriodic = S->IsUPeriodic();
Standard_Boolean isVPeriodic = S->IsVPeriodic();
if ( isUPeriodic || isVPeriodic ) {
Standard_Real UF,UL,VF,VL;
S->Bounds(UF,UL,VF,VL);
if(isUPeriodic)
uv.SetX( uv.X() + ShapeAnalysis::AdjustToPeriod(uv.X(),UF,UL));
if(isVPeriodic)
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,23 +615,26 @@ 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() ))
p2.SetCoord( myParIndex, p1.Coord( myParIndex ));
if ( IsDegenShape( Pos1->GetShapeId() ))
p1.SetCoord( myParIndex, p2.Coord( myParIndex ));
else if ( IsDegenShape( Pos2->GetShapeId() ))
p2.SetCoord( myParIndex, p1.Coord( myParIndex ));
TopLoc_Location loc;
Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
gp_XY uv = GetMiddleUV( S, p1, p2 );
gp_Pnt P = S->Value( uv.X(), uv.Y() ).Transformed(loc);
n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(n12, faceID, uv.X(), uv.Y());
myTLinkNodeMap.insert(make_pair(link,n12));
return n12;
TopLoc_Location loc;
Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
gp_XY uv = GetMiddleUV( S, p1, p2 );
gp_Pnt P = S->Value( uv.X(), uv.Y() ).Transformed(loc);
n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(n12, faceID, uv.X(), uv.Y());
myTLinkNodeMap.insert(make_pair(link,n12));
return n12;
}
}
if (edgeID>0 || shapeType == TopAbs_EDGE) {
@ -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);
@ -723,7 +758,7 @@ SMDS_MeshFace* SMESH_MesherHelper::AddFace(const SMDS_MeshNode* n1,
const SMDS_MeshNode* n2,
const SMDS_MeshNode* n3,
const int id,
const bool force3d)
const bool force3d)
{
SMESHDS_Mesh * meshDS = GetMeshDS();
SMDS_MeshFace* elem = 0;
@ -764,7 +799,7 @@ SMDS_MeshFace* SMESH_MesherHelper::AddFace(const SMDS_MeshNode* n1,
const SMDS_MeshNode* n3,
const SMDS_MeshNode* n4,
const int id,
const bool force3d)
const bool force3d)
{
SMESHDS_Mesh * meshDS = GetMeshDS();
SMDS_MeshFace* elem = 0;
@ -824,7 +859,7 @@ SMDS_MeshVolume* SMESH_MesherHelper::AddVolume(const SMDS_MeshNode* n1,
const SMDS_MeshNode* n5,
const SMDS_MeshNode* n6,
const int id,
const bool force3d)
const bool force3d)
{
SMESHDS_Mesh * meshDS = GetMeshDS();
SMDS_MeshVolume* elem = 0;
@ -871,7 +906,7 @@ SMDS_MeshVolume* SMESH_MesherHelper::AddVolume(const SMDS_MeshNode* n1,
const SMDS_MeshNode* n3,
const SMDS_MeshNode* n4,
const int id,
const bool force3d)
const bool force3d)
{
SMESHDS_Mesh * meshDS = GetMeshDS();
SMDS_MeshVolume* elem = 0;
@ -913,7 +948,7 @@ SMDS_MeshVolume* SMESH_MesherHelper::AddVolume(const SMDS_MeshNode* n1,
const SMDS_MeshNode* n4,
const SMDS_MeshNode* n5,
const int id,
const bool force3d)
const bool force3d)
{
SMDS_MeshVolume* elem = 0;
if(!myCreateQuadratic) {
@ -964,7 +999,7 @@ SMDS_MeshVolume* SMESH_MesherHelper::AddVolume(const SMDS_MeshNode* n1,
const SMDS_MeshNode* n7,
const SMDS_MeshNode* n8,
const int id,
const bool force3d)
const bool force3d)
{
SMESHDS_Mesh * meshDS = GetMeshDS();
SMDS_MeshVolume* elem = 0;

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()
*/
@ -193,7 +184,7 @@ public:
const SMDS_MeshNode* n2,
const SMDS_MeshNode* n3,
const int id=0,
const bool force3d = false);
const bool force3d = false);
/*!
* Creates quadratic or linear quadrangle
*/
@ -202,7 +193,7 @@ public:
const SMDS_MeshNode* n3,
const SMDS_MeshNode* n4,
const int id = 0,
const bool force3d = false);
const bool force3d = false);
/*!
* Creates quadratic or linear tetraahedron
*/
@ -211,7 +202,7 @@ public:
const SMDS_MeshNode* n3,
const SMDS_MeshNode* n4,
const int id = 0,
const bool force3d = true);
const bool force3d = true);
/*!
* Creates quadratic or linear pyramid
*/
@ -221,7 +212,7 @@ public:
const SMDS_MeshNode* n4,
const SMDS_MeshNode* n5,
const int id = 0,
const bool force3d = true);
const bool force3d = true);
/*!
* Creates quadratic or linear pentahedron
*/
@ -232,7 +223,7 @@ public:
const SMDS_MeshNode* n5,
const SMDS_MeshNode* n6,
const int id = 0,
const bool force3d = true);
const bool force3d = true);
/*!
* Creates quadratic or linear hexahedron
*/
@ -245,7 +236,7 @@ public:
const SMDS_MeshNode* n7,
const SMDS_MeshNode* n8,
const int id = 0,
bool force3d = true);
bool force3d = true);
/*!
* \brief Return U of the given node on the edge
*/
@ -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):
myChildren(NULL),
myFather(NULL),
myLevel(0),
myMaxLevel(maxLevel),
myMinBoxSize(minBoxSize),
myIsLeaf(-1)
SMESH_Octree::SMESH_Octree (SMESH_Octree::Limit* limit):
myChildren(NULL),
myFather(NULL),
myIsLeaf( false ),
myLimit( limit ),
myLevel(0),
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;
}
}
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();
if ( myBox )
delete myBox;
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)
virtual void buildChildrenData() = 0;
// 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,
@ -120,13 +123,11 @@ protected:
const double precision);
// The max number of nodes a leaf box can contain
int myMaxNbNodes;
int myMaxNbNodes;
// 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

@ -82,22 +82,22 @@ SMESH_subMesh::SMESH_subMesh(int Id,
SMESHDS_Mesh * meshDS,
const TopoDS_Shape & aSubShape)
{
_subShape = aSubShape;
_subMeshDS = meshDS->MeshElements(_subShape); // may be null ...
_father = father;
_Id = Id;
_dependenceAnalysed = _alwaysComputed = false;
_subShape = aSubShape;
_subMeshDS = meshDS->MeshElements(_subShape); // may be null ...
_father = father;
_Id = Id;
_dependenceAnalysed = _alwaysComputed = false;
if (_subShape.ShapeType() == TopAbs_VERTEX)
{
_algoState = HYP_OK;
_computeState = READY_TO_COMPUTE;
}
else
{
if (_subShape.ShapeType() == TopAbs_VERTEX)
{
_algoState = HYP_OK;
_computeState = READY_TO_COMPUTE;
}
else
{
_algoState = NO_ALGO;
_computeState = NOT_READY;
}
}
}
//=============================================================================
@ -392,7 +392,7 @@ const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn()
}
case TopAbs_COMPSOLID:
{
//MESSAGE("compsolid");
//MESSAGE("compsolid");
for (TopExp_Explorer exp(_subShape, TopAbs_SOLID); exp.More();
exp.Next())
{
@ -448,7 +448,7 @@ const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn()
for (TopExp_Explorer exp(_subShape, TopAbs_VERTEX); exp.More();
exp.Next())
{
InsertDependence(exp.Current());
InsertDependence(exp.Current());
}
break;
}
@ -495,8 +495,8 @@ void SMESH_subMesh::InsertDependence(const TopoDS_Shape aSubShape)
const TopoDS_Shape & SMESH_subMesh::GetSubShape() const
{
//MESSAGE("SMESH_subMesh::GetSubShape");
return _subShape;
//MESSAGE("SMESH_subMesh::GetSubShape");
return _subShape;
}
@ -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
{
@ -1142,48 +1148,48 @@ void SMESH_subMesh::CleanDependsOn()
void SMESH_subMesh::DumpAlgoState(bool isMain)
{
int dim = SMESH_Gen::GetShapeDim(_subShape);
int dim = SMESH_Gen::GetShapeDim(_subShape);
// if (dim < 1) return;
if (isMain)
{
const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
if (isMain)
{
const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
map < int, SMESH_subMesh * >::const_iterator itsub;
for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
{
SMESH_subMesh *sm = (*itsub).second;
sm->DumpAlgoState(false);
}
}
int type = _subShape.ShapeType();
MESSAGE("dim = " << dim << " type of shape " << type);
switch (_algoState)
{
case NO_ALGO:
MESSAGE(" AlgoState = NO_ALGO");
break;
case MISSING_HYP:
MESSAGE(" AlgoState = MISSING_HYP");
break;
case HYP_OK:
MESSAGE(" AlgoState = HYP_OK");
break;
}
switch (_computeState)
{
case NOT_READY:
MESSAGE(" ComputeState = NOT_READY");
break;
case READY_TO_COMPUTE:
MESSAGE(" ComputeState = READY_TO_COMPUTE");
break;
case COMPUTE_OK:
MESSAGE(" ComputeState = COMPUTE_OK");
break;
case FAILED_TO_COMPUTE:
MESSAGE(" ComputeState = FAILED_TO_COMPUTE");
break;
}
map < int, SMESH_subMesh * >::const_iterator itsub;
for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
{
SMESH_subMesh *sm = (*itsub).second;
sm->DumpAlgoState(false);
}
}
int type = _subShape.ShapeType();
MESSAGE("dim = " << dim << " type of shape " << type);
switch (_algoState)
{
case NO_ALGO:
MESSAGE(" AlgoState = NO_ALGO");
break;
case MISSING_HYP:
MESSAGE(" AlgoState = MISSING_HYP");
break;
case HYP_OK:
MESSAGE(" AlgoState = HYP_OK");
break;
}
switch (_computeState)
{
case NOT_READY:
MESSAGE(" ComputeState = NOT_READY");
break;
case READY_TO_COMPUTE:
MESSAGE(" ComputeState = READY_TO_COMPUTE");
break;
case COMPUTE_OK:
MESSAGE(" ComputeState = COMPUTE_OK");
break;
case FAILED_TO_COMPUTE:
MESSAGE(" ComputeState = FAILED_TO_COMPUTE");
break;
}
}
//================================================================================
@ -1278,13 +1284,13 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
if ( _algoState == HYP_OK )
_computeState = READY_TO_COMPUTE;
break;
case COMPUTE: // nothing to do
case COMPUTE: // nothing to do
break;
case CLEAN:
CleanDependants();
RemoveSubMeshElementsAndNodes();
break;
case SUBMESH_COMPUTED: // nothing to do
case SUBMESH_COMPUTED: // nothing to do
break;
case SUBMESH_RESTORED:
ComputeSubMeshStateEngine( SUBMESH_RESTORED );

View File

@ -61,7 +61,7 @@ class SMESH_EXPORT SMESH_subMesh
{
public:
SMESH_subMesh(int Id, SMESH_Mesh * father, SMESHDS_Mesh * meshDS,
const TopoDS_Shape & aSubShape);
const TopoDS_Shape & aSubShape);
virtual ~ SMESH_subMesh();
int GetId() const;

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

@ -284,21 +284,21 @@ SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(int n1, int n2, int ID)
}
SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
int ID)
const SMDS_MeshNode * n2,
int ID)
{
return AddEdgeWithID(n1->GetID(),
n2->GetID(),
ID);
n2->GetID(),
ID);
}
SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2)
const SMDS_MeshNode * n2)
{
SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2);
if(anElem) myScript->AddEdge(anElem->GetID(),
n1->GetID(),
n2->GetID());
n1->GetID(),
n2->GetID());
return anElem;
}
@ -314,25 +314,25 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int ID)
}
SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
int ID)
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
int ID)
{
return AddFaceWithID(n1->GetID(),
n2->GetID(),
n3->GetID(),
ID);
n2->GetID(),
n3->GetID(),
ID);
}
SMDS_MeshFace* SMESHDS_Mesh::AddFace( const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3)
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3);
if(anElem) myScript->AddFace(anElem->GetID(),
n1->GetID(),
n2->GetID(),
n3->GetID());
n1->GetID(),
n2->GetID(),
n3->GetID());
return anElem;
}
@ -348,29 +348,29 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4, int I
}
SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID)
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID)
{
return AddFaceWithID(n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
ID);
n2->GetID(),
n3->GetID(),
n4->GetID(),
ID);
}
SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4)
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3, n4);
if(anElem) myScript->AddFace(anElem->GetID(),
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID());
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID());
return anElem;
}
@ -386,29 +386,29 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, i
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID)
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID)
{
return AddVolumeWithID(n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
ID);
n2->GetID(),
n3->GetID(),
n4->GetID(),
ID);
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4)
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4);
if(anElem) myScript->AddVolume(anElem->GetID(),
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID());
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID());
return anElem;
}
@ -424,33 +424,33 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, i
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
int ID)
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
int ID)
{
return AddVolumeWithID(n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
ID);
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
ID);
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5)
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5);
if(anElem) myScript->AddVolume(anElem->GetID(),
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID());
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID());
return anElem;
}
@ -466,37 +466,37 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, i
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
int ID)
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
int ID)
{
return AddVolumeWithID(n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
n6->GetID(),
ID);
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
n6->GetID(),
ID);
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6)
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6);
if(anElem) myScript->AddVolume(anElem->GetID(),
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
n6->GetID());
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
n6->GetID());
return anElem;
}
@ -512,45 +512,45 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, i
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
int ID)
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
int ID)
{
return AddVolumeWithID(n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
n6->GetID(),
n7->GetID(),
n8->GetID(),
ID);
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
n6->GetID(),
n7->GetID(),
n8->GetID(),
ID);
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8)
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6, n7, n8);
if(anElem) myScript->AddVolume(anElem->GetID(),
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
n6->GetID(),
n7->GetID(),
n8->GetID());
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
n6->GetID(),
n7->GetID(),
n8->GetID());
return anElem;
}
@ -1059,7 +1059,7 @@ void SMESHDS_Mesh::UnSetMeshElementOnShape(const SMDS_MeshElement * elem,
//=======================================================================
TopoDS_Shape SMESHDS_Mesh::ShapeToMesh() const
{
return myShape;
return myShape;
}
//=======================================================================
@ -1143,7 +1143,7 @@ SMESHDS_Mesh::GetHypothesis(const TopoDS_Shape & S) const
//=======================================================================
SMESHDS_Script* SMESHDS_Mesh::GetScript()
{
return myScript;
return myScript;
}
//=======================================================================
@ -1152,7 +1152,7 @@ SMESHDS_Script* SMESHDS_Mesh::GetScript()
//=======================================================================
void SMESHDS_Mesh::ClearScript()
{
myScript->Clear();
myScript->Clear();
}
//=======================================================================
@ -1161,9 +1161,9 @@ void SMESHDS_Mesh::ClearScript()
//=======================================================================
bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S)
{
if (myShape.IsNull()) MESSAGE("myShape is NULL");
int Index = myIndexToShape.FindIndex(S);
return myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end();
if (myShape.IsNull()) MESSAGE("myShape is NULL");
int Index = myIndexToShape.FindIndex(S);
return myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end();
}
//=======================================================================
@ -1235,7 +1235,7 @@ int SMESHDS_Mesh::AddCompoundSubmesh(const TopoDS_Shape& S,
//=======================================================================
const TopoDS_Shape& SMESHDS_Mesh::IndexToShape(int ShapeIndex) const
{
return myIndexToShape.FindKey(ShapeIndex);
return myIndexToShape.FindKey(ShapeIndex);
}
//=======================================================================
@ -1351,8 +1351,8 @@ SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode* n1,
{
SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2,n12);
if(anElem) myScript->AddEdge(anElem->GetID(),
n1->GetID(),
n2->GetID(),
n1->GetID(),
n2->GetID(),
n12->GetID());
return anElem;
}
@ -1367,9 +1367,9 @@ SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
int ID)
{
return AddEdgeWithID(n1->GetID(),
n2->GetID(),
n2->GetID(),
n12->GetID(),
ID);
ID);
}
@ -1386,7 +1386,7 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n12,n23,n31);
if(anElem) myScript->AddFace(anElem->GetID(),
n1->GetID(), n2->GetID(), n3->GetID(),
n1->GetID(), n2->GetID(), n3->GetID(),
n12->GetID(), n23->GetID(), n31->GetID());
return anElem;
}
@ -1417,7 +1417,7 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
{
return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(),
n12->GetID(), n23->GetID(), n31->GetID(),
ID);
ID);
}
@ -1436,7 +1436,7 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n4,n12,n23,n34,n41);
if(anElem) myScript->AddFace(anElem->GetID(),
n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID());
return anElem;
}
@ -1469,7 +1469,7 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
{
return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
ID);
ID);
}
@ -1490,8 +1490,8 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n12,n23,n31,n14,n24,n34);
if(anElem) myScript->AddVolume(anElem->GetID(),
n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
n12->GetID(), n23->GetID(), n31->GetID(),
n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
n12->GetID(), n23->GetID(), n31->GetID(),
n14->GetID(), n24->GetID(), n34->GetID());
return anElem;
}
@ -1509,7 +1509,7 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4,
if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n12,n23,n31,n14,n24,n34);
return anElem;
}
//=======================================================================
//function : AddVolumeWithID
//purpose : 2d order tetrahedron of 10 nodes
@ -1575,7 +1575,7 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, i
n15,n25,n35,n45);
return anElem;
}
//=======================================================================
//function : AddVolumeWithID
//purpose : 2d order pyramid of 13 nodes
@ -1652,7 +1652,7 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3,
n45,n56,n64,n14,n25,n36);
return anElem;
}
//=======================================================================
//function : AddVolumeWithID
//purpose : 2d order Pentahedron with 15 nodes
@ -1740,7 +1740,7 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4,
n56,n67,n78,n85,n15,n26,n37,n48);
return anElem;
}
//=======================================================================
//function : AddVolumeWithID
//purpose : 2d order Hexahedrons with 20 nodes

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