Merge from V5_1_3_BR branch (07/12/09)

This commit is contained in:
vsr 2009-12-08 13:11:42 +00:00
parent 2ed875d56d
commit 2daa321efa
112 changed files with 4058 additions and 3229 deletions

View File

@ -47,16 +47,18 @@ AC_ARG_WITH(qwt_inc,
libqwt_name=qwt libqwt_name=qwt
if test -z $QWTHOME; then if test -z $QWTHOME; then
AC_MSG_RESULT(QWTHOME not defined) AC_MSG_RESULT(QWTHOME not defined)
AC_MSG_NOTICE(Trying native Qwt...)
exist_ok=no exist_ok=no
if test "x$exist_ok" = "xno"; then if test "x$exist_ok" = "xno"; then
for d in /usr /usr/local ; do for d in /usr /usr/local ; do
for extension in qwt qwt-qt4; 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) AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/lib${extension}.so,exist_ok=yes,exist_ok=no)
if test "x$exist_ok" = "xyes"; then if test "x$exist_ok" = "xyes"; then
QWTHOME=$d QWTHOME=$d
AC_MSG_RESULT(lib${extension}.so detected in $d/lib) AC_MSG_RESULT(lib${extension}.so detected in $d/lib)
libqwt_name=${extension} libqwt_name=${extension}
dnl No break here, libqwt-qt4.so is choosen even if libqwt.so is present: if 2 are present, in most of cases, libqwt.so is Qt3 version. dnl break, libqwt-qt4.so is choosen before libqwt.so since it is surely the Qt4 version.
break
fi fi
done done
if test "x$exist_ok" = "xyes"; then if test "x$exist_ok" = "xyes"; then
@ -77,21 +79,22 @@ if test -z $QWTHOME; then
fi fi
if test "x$exist_ok" = "xyes"; then if test "x$exist_ok" = "xyes"; then
if test -z $QWT_INCDIR; 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 if test ! -f $QWT_INCDIR/qwt.h ; then
QWT_INCDIR=$QWTHOME"/include" QWT_INCDIR=$QWTHOME"/include"
fi fi
if test ! -f $QWT_INCDIR/qwt.h ; then if test ! -f $QWT_INCDIR/qwt.h ; then
QWT_INCDIR=/usr/lib/qt4/include/qwt QWT_INCDIR=/usr/lib/qt4/include/qwt
fi fi
if test ! -f $QWT_INCDIR/qwt.h ; then
QWT_INCDIR=/usr/include/qwt-qt4
fi
fi fi
else else
qwt_ok=no qwt_ok=no
fi fi
else else
AC_MSG_NOTICE(Trying Qwt from $QWTHOME ...)
if test -z $QWT_INCDIR; then if test -z $QWT_INCDIR; then
QWT_INCDIR="$QWTHOME/include" QWT_INCDIR="$QWTHOME/include"
fi fi

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

View File

@ -23,6 +23,8 @@ which will compose the mesh of these 2D faces.
\image html a-maxelarea.png \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" \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 <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" \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> <br>
\anchor quadrangle_preference_anchor \anchor quadrangle_preference_anchor
<h2>Quadrangle Preference</h2> <h2>Quadrangle Preference</h2>

View File

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

View File

@ -47,7 +47,7 @@ tetrahedral (pyramidal) elements.</li>
\image html image126.gif "Example of a hexahedral 3D mesh" \image html image126.gif "Example of a hexahedral 3D mesh"
</ul> </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. license to be used within the Mesh module.
There is also a number of more specific algorithms: There is also a number of more specific algorithms:

View File

@ -207,22 +207,33 @@ String variables:
\image html blsurf_parameters_sizemap.png \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> <ul>
<li>Those faces, edges and verteces must be sub-shapes (from explode command) of the meshed geometry object.</li> <li>The faces, edges and vertices can belong to the meshed geometrical
<li>Groups of faces, edges and verteces are also handled.</li> object or to its sub-shapes (created using <b>Explode</b> command).</li>
<li>Multi-selection is possible.</li> <li>Groups of faces, edges and vertices are also handled.</li>
<li>The sizes are constant values.</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> </ul>
<br><b>See Also</b> a sample TUI Script of the \ref tui_blsurf "creation of a BLSurf hypothesis", including size map. <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 \anchor blsurf_sizemap_computation
<h2>Computation of the physical size</h2> <h2>Computation of the physical size</h2>
Here is the detail on the calculation of the size (from BLSurf documentation).
\n \n
The size is obtained by querying sizemap functions associated to the input CAD object for surfaces, curves and points. 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 whether point P is internal to a surface, internal to a curve, or at the end of several curves: 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> <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 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> <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>
@ -235,12 +246,13 @@ In order to compute the mean of several values, the arithmetic mean is used by d
\image html blsurf_parameters_enforced_vertices.png \image html blsurf_parameters_enforced_vertices.png
It is possible to define some enforced vertices to BLSurf algorithm without any vertex creation into the CAD. It is possible to define some enforced vertices to BLSurf algorithm
without creating any vertices by CAD algorithms.
<ul> <ul>
<li>Enforced vertices are the projection of a given point defines by its (x,y,z) coordinates on the concerned face.</li> <li>The enforced vertex is the projection of a point defined by its
<li>It is possible to define several enforced vertices on 1 face.</li> (x,y,z) coordinates on the selected face.</li>
<li>Group of faces are also handled.</li> <li>It is possible to define several enforced vertices on a face or a group of faces.</li>
<li>If the projection point is on the boundary or outside the face, then it will be ignored.</li> <li>If the projected point is on the boundary or outside of the face, it will be ignored.</li>
</ul> </ul>
<br><b>See Also</b> a sample TUI Script of the \ref tui_blsurf "creation of a BLSurf hypothesis", including enforced vertices. <br><b>See Also</b> a sample TUI Script of the \ref tui_blsurf "creation of a BLSurf hypothesis", including enforced vertices.

View File

@ -47,4 +47,6 @@ for this operation.</li>
\image html image160.gif "Example of a compound of two meshed cubes" \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" \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 "Mesh computation/Show a computation result notification" preference
to the "Never" value. This option gives the possibility to control mesh to the "Never" value. This option gives the possibility to control mesh
computation reporting. There are the following possibilities: always 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> <li>Click the \b Apply or \b OK button.</li>
</ol> </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 \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> <ol>
<li>Select your group in the Object Browser and in the \b Mesh menu click <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> 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 In this dialog box you can modify the name of your group and add or
remove the elements forming it. For more information see remove the elements forming it. For more information see
\ref creating_groups_page "Creating Groups" page. \ref creating_groups_page "Creating Groups" page.
<li>Click the \b Apply or <b>Apply and Close</b> button to confirm modification of the <li>Click the \b Apply or <b>Apply and Close</b> button to confirm modification of the
group.</li> group.</li>
</ol> </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> of elements and modify:</em>
<ol> <ol>
<li>Select your group on geometry in the Object Browser and in the \b Mesh menu click <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> <center><em>"Edit Group as Standalone" button</em></center>
The group on geometry will be converted into standalone group and can 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 <li>Click the \b Apply or <b>Apply and Close</b> button to confirm modification of the
group.</li> group.</li>
</ol>
<br><b>See Also</b> a sample TUI Script of an \sa A sample TUI Script of an \ref tui_edit_group "Edit Group" operation.
\ref tui_edit_group "Edit Group" operation.
*/ */

View File

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

View File

@ -2,14 +2,15 @@
\page free_nodes_page Free nodes \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. to any mesh element.
\image html free_nodes.png \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. element after deleting some elements and adding several isolated nodes.
<br><b>See Also</b> a sample TUI Script of a \sa A sample TUI Script of a \ref tui_free_nodes "Free Nodes quality control"
\ref tui_free_nodes "Free Nodes quality control" operation. operation.
*/ */

View File

@ -56,16 +56,18 @@ together with the characteristics of the final mesh.
<li><b>To create new nodes</b> - if this option is checked off, ghs3d <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> tries to create tetrahedrons using only the nodes of the 2D mesh.</li>
<li><b>To remove initial central point</b> - TetMesh-GHS3D adds an internal point <li><b>To remove the initial central point</b> TetMesh-GHS3D adds an internal point
at the centre of gravity of the bounding box in order to speed up and to simplify at the gravity centre of the bounding box to speed up and to simplify
the meshing process. It is however possible for TetMesh-GHS3D to refrain from creating 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 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, particularly useful to generate a volume mesh without internal points at all and in some rare cases
to help the boundary regeneration phase when it failed with the standard options (for example when at the boundary regeneration phase when it is impossible to proceed
one dimension of the domain is large compared to the other two, with a ratio of 20 or more). with the standard options
Use this option when the boundary regeneration failed with the standard parameters and before using (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). the recovery version (command line option -C).
Note: when using this option, the speed of the meshing process may decrease, and quality may change. 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> 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 <li><b>To use boundary recovery version</b> - enables using a
@ -78,18 +80,18 @@ quality (poor aspect ratio of elements, tetrahedra with a very small
positive volume).</li> positive volume).</li>
<li><b>To use FEM correction</b> - Applies finite-element correction by <li><b>To use FEM correction</b> - Applies finite-element correction by
replacing overconstrained elements where it is possible. The process is replacing overconstrained elements where it is possible. At first the process
first slicing the overconstrained edges and second the overconstrained slices the overconstrained edges and at second the overconstrained
facets. This ensures that no edges have two boundary vertices and that facets. This ensures that there are no edges with two boundary
no facets have three boundary vertices. TetMesh-GHS3D gives the initial 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 and final overconstrained edges and facets. It also gives the facets
which have three edges on the boundary. which have three edges on the boundary.
Note: when using this option, the speed of the meshing process may Note: when using this option, the speed of the meshing process may
decrease, quality may change, and the smallest volume may be smaller. decrease, quality may change, and the smallest volume may be smaller.
The default is no correction.</li> By default, the FEM correction is not used.</li>
<li><b>Option as text</b> - allows input of any text as command line <li><b>Option as text</b> - allows to input in the command line any text
for ghs3d. This allows the input of advanced options in a free from. </li> for ghs3d, for example, advanced options. </li>
</ul> </ul>
@ -98,9 +100,9 @@ for ghs3d. This allows the input of advanced options in a free from. </li>
\image html ghs3d_enforced_vertices.png \image html ghs3d_enforced_vertices.png
GHS3D algorithm can locally raffine the mesh. It is possible to define enforced vertices in the volume where the mesh will be raffined. 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 the CAD. 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: An enforced vertex is defined by:
<ul> <ul>

View File

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

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

View File

@ -44,11 +44,6 @@ The following information will be displayed:
\image html advanced_mesh_infos.png \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> <br>
\anchor mesh_element_info_anchor \anchor mesh_element_info_anchor
<h2>Mesh Element Info</h2> <h2>Mesh Element Info</h2>
@ -61,4 +56,7 @@ the Viewer.
\image html eleminfo2.png \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

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

View File

@ -4,9 +4,9 @@
3D extrusion algorithm can be used for meshing prisms, i.e. <b>3D Shapes</b> 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 defined by two opposing faces having the same number of vertices and
edges and meshed using the \ref projection_algos_page "2D Projection" edges and meshed using, for example, the \ref projection_algos_page
algorithm. These two faces should be connected by quadrangle "side" "2D Projection" algorithm. These two faces should be connected by
faces. quadrangle "side" faces.
The opposing faces can be meshed with either quadrangles or triangles, The opposing faces can be meshed with either quadrangles or triangles,
while the side faces should be meshed with quadrangles only. 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 have in the same 3D mesh such elements as hexahedrons, prisms and
polyhedrons. 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 \page radial_quadrangle_1D2D_algo_page Radial Quadrangle 1D2D
\n This algorithm applies to the meshing of a 2D shapes. \n This algorithm applies to the meshing of 2D shapes under the
Required conditions: Face must be a full circle or part of circle following conditions: the face must be a full circle or a part of circle
(i.e. number of edges <= 3 and one of them must be a circle curve). (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 center point) and The resulting mesh consists of triangles (near the center point) and
quadrangles. quadrangles.
This algorithm also requires the information concerning the number and This algorithm requires the hypothesis indicating the number
distribution of mesh layers alond a radius of circle. Distribution of of mesh layers along the radius. The distribution of layers can be set with any 1D Hypothesis.
layers can be set with any of 1D Hypotheses.
Creation hypothesis:
\image html hypo_radquad_dlg.png \image html hypo_radquad_dlg.png
Resulting 3D mesh for the cylinder with <b>RadialQuadrangle_1D2D</b> \image html mesh_radquad_01.png "Radial Quadrangle 2D mesh on the top and the bottom faces of a cylinder"
hypothesis for top and bottom faces:
\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: \sa A sample \ref tui_radial_quadrangle "TUI Script".
\image html mesh_radquad_02.png
*/ */

View File

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

View File

@ -64,13 +64,9 @@ name in the adjacent box);</li>
</ul> </ul>
</li> </li>
<li>Click \b Apply or <b> Apply and Close</b> button to confirm the <li>Click \b Apply or <b> Apply and Close</b> button to confirm the operation.</li>
operation.</li>
</ol> </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 \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. which is an example of good python script style for Mesh module.
<br> <br>

View File

@ -468,9 +468,83 @@ src_mesh.TranslateObject( src_mesh, MakeDirStruct( 210, 0, 0 ), Copy=False)
\endcode \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: \n Other meshing algorithms:
<ul> <ul>
<li>\subpage tui_defining_blsurf_hypotheses_page</li> <li>\subpage tui_defining_blsurf_hypotheses_page</li>
<li>\subpage tui_defining_ghs3d_hypotheses_page</li>
</ul> </ul>
*/ */

View File

@ -318,10 +318,10 @@ salome.sg.updateObjBrowser(1)
\endcode \endcode
\image html dimgroup_tui1.png \image html dimgroup_tui1.png
<center>Source groups of faces<\center> <center>Source groups of faces</center>
\image html dimgroup_tui2.png \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() if (isDone != 1): print 'MakeMesh :', pattern.GetErrorCode()
\endcode \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 \code
import geompy import geompy
import smesh import smesh
import SMESH
# create a box # create a box
box = geompy.MakeBox(0., 0., 0., 20., 20., 20.) box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)
geompy.addToStudy(box, "box") 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 # create a mesh
tetra = smesh.Mesh(box, "MeshBox") tetra = smesh.Mesh(box, "MeshBox")
@ -26,10 +28,22 @@ algo2D.MaxElementArea(10.)
algo3D = tetra.Tetrahedron(smesh.NETGEN) algo3D = tetra.Tetrahedron(smesh.NETGEN)
algo3D.MaxElementVolume(900.) 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 # compute the mesh
tetra.Compute() 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 "Information about mesh:"
print "Number of nodes : ", tetra.NbNodes() print "Number of nodes : ", tetra.NbNodes()
print "Number of edges : ", tetra.NbEdges() print "Number of edges : ", tetra.NbEdges()
@ -43,5 +57,30 @@ print " hexahedrons : ", tetra.NbHexas()
print " prisms : ", tetra.NbPrisms() print " prisms : ", tetra.NbPrisms()
print " pyramids : ", tetra.NbPyramids() print " pyramids : ", tetra.NbPyramids()
print " polyhedrons : ", tetra.NbPolyhedrons() 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 \endcode
*/ */

View File

@ -38,7 +38,7 @@ meshes.</li>
<li>\subpage transparency_page "Transparency" - allows to change the <li>\subpage transparency_page "Transparency" - allows to change the
transparency of mesh elements.</li> transparency of mesh elements.</li>
<li>\subpage clipping_page "Clipping" - allows to create cross-sections of the selected objects.</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> presents various information about meshes.</li>
<li><b>Hide</b> - allows to hide the selected mesh from the viewer.</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> <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 enum log_command
{ {
ADD_NODE, ADD_NODE,
ADD_ELEM0D,
ADD_EDGE, ADD_EDGE,
ADD_TRIANGLE, ADD_TRIANGLE,
ADD_QUADRANGLE, ADD_QUADRANGLE,
@ -69,7 +68,8 @@ module SMESH
ADD_QUADTETRAHEDRON, ADD_QUADTETRAHEDRON,
ADD_QUADPYRAMID, ADD_QUADPYRAMID,
ADD_QUADPENTAHEDRON, ADD_QUADPENTAHEDRON,
ADD_QUADHEXAHEDRON ADD_QUADHEXAHEDRON,
ADD_ELEM0D
}; };
struct log_block struct log_block

View File

@ -697,6 +697,49 @@ module SMESH
*/ */
long_array GetLastCreatedElems(); 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 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \param theElems - the list of elements (edges or faces) to be replicated * \param theElems - the list of elements (edges or faces) to be replicated
@ -707,7 +750,7 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodeGroups() * \sa DoubleNodeGroup(), DoubleNodeGroups()
*/ */
boolean DoubleNodes( in long_array theElems, boolean DoubleNodeElem( in long_array theElems,
in long_array theNodesNot, in long_array theNodesNot,
in long_array theAffectedElems ); in long_array theAffectedElems );
@ -722,7 +765,7 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion() * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
*/ */
boolean DoubleNodesInRegion( in long_array theElems, boolean DoubleNodeElemInRegion( in long_array theElems,
in long_array theNodesNot, in long_array theNodesNot,
in GEOM::GEOM_Object theShape ); in GEOM::GEOM_Object theShape );
@ -736,7 +779,7 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodes(), DoubleNodeGroups() * \sa DoubleNodes(), DoubleNodeGroups()
*/ */
boolean DoubleNodeGroup( in SMESH_GroupBase theElems, boolean DoubleNodeElemGroup( in SMESH_GroupBase theElems,
in SMESH_GroupBase theNodesNot, in SMESH_GroupBase theNodesNot,
in SMESH_GroupBase theAffectedElems ); in SMESH_GroupBase theAffectedElems );
@ -751,7 +794,7 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion() * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
*/ */
boolean DoubleNodeGroupInRegion( in SMESH_GroupBase theElems, boolean DoubleNodeElemGroupInRegion( in SMESH_GroupBase theElems,
in SMESH_GroupBase theNodesNot, in SMESH_GroupBase theNodesNot,
in GEOM::GEOM_Object theShape ); in GEOM::GEOM_Object theShape );
@ -765,7 +808,7 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodes() * \sa DoubleNodeGroup(), DoubleNodes()
*/ */
boolean DoubleNodeGroups( in ListOfGroups theElems, boolean DoubleNodeElemGroups( in ListOfGroups theElems,
in ListOfGroups theNodesNot, in ListOfGroups theNodesNot,
in ListOfGroups theAffectedElems ); in ListOfGroups theAffectedElems );
@ -780,7 +823,7 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion() * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
*/ */
boolean DoubleNodeGroupsInRegion( in ListOfGroups theElems, boolean DoubleNodeElemGroupsInRegion( in ListOfGroups theElems,
in ListOfGroups theNodesNot, in ListOfGroups theNodesNot,
in GEOM::GEOM_Object theShape ); in GEOM::GEOM_Object theShape );

View File

@ -1938,8 +1938,10 @@ bool ElemGeomType::IsSatisfy( long theId )
{ {
if (!myMesh) return false; if (!myMesh) return false;
const SMDS_MeshElement* anElem = myMesh->FindElement( theId ); const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
if ( !anElem )
return false;
const SMDSAbs_ElementType anElemType = anElem->GetType(); const SMDSAbs_ElementType anElemType = anElem->GetType();
if ( !anElem || (myType != SMDSAbs_All && anElemType != myType) ) if ( myType != SMDSAbs_All && anElemType != myType )
return false; return false;
const int aNbNode = anElem->NbNodes(); const int aNbNode = anElem->NbNodes();
bool isOk = false; bool isOk = false;

View File

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

View File

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

View File

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

View File

@ -23,7 +23,6 @@
// File : DriverMED_Family.cxx // File : DriverMED_Family.cxx
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "DriverMED_Family.h" #include "DriverMED_Family.h"
#include "MED_Factory.hxx" #include "MED_Factory.hxx"
@ -83,7 +82,7 @@ void
DriverMED_Family DriverMED_Family
::SetType(const SMDSAbs_ElementType theType) ::SetType(const SMDSAbs_ElementType theType)
{ {
myType = theType; myTypes.insert( myType = theType );
} }
SMDSAbs_ElementType SMDSAbs_ElementType
@ -93,6 +92,13 @@ DriverMED_Family
return myType; return myType;
} }
const std::set< SMDSAbs_ElementType >&
DriverMED_Family
::GetTypes() const
{
return myTypes;
}
bool bool
DriverMED_Family DriverMED_Family
::MemberOf(std::string theGroupName) const ::MemberOf(std::string theGroupName) const

View File

@ -23,7 +23,6 @@
// File : DriverMED_Family.hxx // File : DriverMED_Family.hxx
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _INCLUDE_DRIVERMED_FAMILY #ifndef _INCLUDE_DRIVERMED_FAMILY
#define _INCLUDE_DRIVERMED_FAMILY #define _INCLUDE_DRIVERMED_FAMILY
@ -99,6 +98,7 @@ class MESHDRIVERMED_EXPORT DriverMED_Family
void SetType(const SMDSAbs_ElementType theType); void SetType(const SMDSAbs_ElementType theType);
SMDSAbs_ElementType GetType(); SMDSAbs_ElementType GetType();
const std::set< SMDSAbs_ElementType >& GetTypes() const;
bool MemberOf(std::string theGroupName) const; bool MemberOf(std::string theGroupName) const;
@ -133,6 +133,7 @@ class MESHDRIVERMED_EXPORT DriverMED_Family
ElementsSet myElements; ElementsSet myElements;
MED::TStringSet myGroupNames; MED::TStringSet myGroupNames;
int myGroupAttributVal; int myGroupAttributVal;
std::set<SMDSAbs_ElementType> myTypes; // Issue 0020576
}; };
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

@ -72,6 +72,11 @@
#include <vtkImplicitBoolean.h> #include <vtkImplicitBoolean.h>
#include <vtkImplicitFunctionCollection.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" #include "utilities.h"
#ifdef _DEBUG_ #ifdef _DEBUG_
@ -399,7 +404,11 @@ SMESH_ActorDef::SMESH_ActorDef()
myPtsLabeledDataMapper = vtkLabeledDataMapper::New(); myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput()); myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
#if (VTK_XVERSION >= 0x050200)
myPtsLabeledDataMapper->SetLabelFormat("%d");
#else
myPtsLabeledDataMapper->SetLabelFormat("%g"); myPtsLabeledDataMapper->SetLabelFormat("%g");
#endif
myPtsLabeledDataMapper->SetLabelModeToLabelScalars(); myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aPtsTextProp = vtkTextProperty::New(); vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
@ -440,7 +449,11 @@ SMESH_ActorDef::SMESH_ActorDef()
myClsLabeledDataMapper = vtkLabeledDataMapper::New(); myClsLabeledDataMapper = vtkLabeledDataMapper::New();
myClsLabeledDataMapper->SetInput(myClsSelectVisiblePoints->GetOutput()); myClsLabeledDataMapper->SetInput(myClsSelectVisiblePoints->GetOutput());
#if (VTK_XVERSION >= 0x050200)
myClsLabeledDataMapper->SetLabelFormat("%d");
#else
myClsLabeledDataMapper->SetLabelFormat("%g"); myClsLabeledDataMapper->SetLabelFormat("%g");
#endif
myClsLabeledDataMapper->SetLabelModeToLabelScalars(); myClsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aClsTextProp = vtkTextProperty::New(); vtkTextProperty* aClsTextProp = vtkTextProperty::New();
@ -593,7 +606,7 @@ void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
vtkIntArray *anArray = vtkIntArray::New(); vtkIntArray *anArray = vtkIntArray::New();
anArray->SetNumberOfValues( aNbElem ); anArray->SetNumberOfValues( aNbElem );
for ( int anId = 0; anId < aNbElem; anId++ ) for ( vtkIdType anId = 0; anId < aNbElem; anId++ )
{ {
int aSMDSId = myVisualObj->GetNodeObjId( anId ); int aSMDSId = myVisualObj->GetNodeObjId( anId );
anArray->SetValue( anId, aSMDSId ); anArray->SetValue( anId, aSMDSId );
@ -1034,8 +1047,8 @@ bool SMESH_ActorDef::IsInfinitive(){
vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid(); vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
aDataSet->Update(); aDataSet->Update();
myIsInfinite = aDataSet->GetNumberOfCells() == 0 || myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
aDataSet->GetNumberOfCells() == 1 && ( aDataSet->GetNumberOfCells() == 1 &&
aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX; aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX );
return SALOME_Actor::IsInfinitive(); return SALOME_Actor::IsInfinitive();
} }

View File

@ -520,6 +520,19 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
return true; 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 Class : SMESH_MeshObj
Description : Class for visualisation of mesh Description : Class for visualisation of mesh

View File

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

View File

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

View File

@ -996,7 +996,8 @@ int SMESH_Block::GetOrderedEdges (const TopoDS_Face& theFace,
for ( iE = 0; wExp.More(); wExp.Next(), iE++ ) for ( iE = 0; wExp.More(); wExp.Next(), iE++ )
{ {
TopoDS_Edge edge = wExp.Current(); 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 ); theEdges.push_back( edge );
} }
theNbVertexInWires.push_back( iE ); theNbVertexInWires.push_back( iE );

View File

@ -434,7 +434,7 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
const SMESH_Algo* aGlobIgnoAlgo, const SMESH_Algo* aGlobIgnoAlgo,
const SMESH_Algo* aLocIgnoAlgo, const SMESH_Algo* aLocIgnoAlgo,
bool & checkConform, bool & checkConform,
map<int, SMESH_subMesh*>& aCheckedMap, set<SMESH_subMesh*>& aCheckedMap,
list< SMESH_Gen::TAlgoStateError > & theErrors) list< SMESH_Gen::TAlgoStateError > & theErrors)
{ {
ASSERT( aSubMesh ); ASSERT( aSubMesh );
@ -489,19 +489,15 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
} }
// sub-algos will be hidden by a local <algo> // sub-algos will be hidden by a local <algo>
const map<int, SMESH_subMesh*>& smMap = aSubMesh->DependsOn(); SMESH_subMeshIteratorPtr revItSub =
map<int, SMESH_subMesh*>::const_reverse_iterator revItSub; aSubMesh->getDependsOnIterator( /*includeSelf=*/false, /*complexShapeFirst=*/true);
bool checkConform2 = false; 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); algo, checkConform2, aCheckedMap, theErrors);
int key = (*revItSub).first; aCheckedMap.insert( sm );
SMESH_subMesh* sm = (*revItSub).second;
if ( aCheckedMap.find( key ) == aCheckedMap.end() )
{
aCheckedMap[ key ] = sm;
}
} }
} }
} }
@ -522,7 +518,7 @@ static bool checkMissing(SMESH_Gen* aGen,
const int aTopAlgoDim, const int aTopAlgoDim,
bool* globalChecked, bool* globalChecked,
const bool checkNoAlgo, const bool checkNoAlgo,
map<int, SMESH_subMesh*>& aCheckedMap, set<SMESH_subMesh*>& aCheckedMap,
list< SMESH_Gen::TAlgoStateError > & theErrors) list< SMESH_Gen::TAlgoStateError > & theErrors)
{ {
if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX) if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
@ -595,15 +591,13 @@ static bool checkMissing(SMESH_Gen* aGen,
if (!algo->NeedDescretBoundary() || isTopLocalAlgo) if (!algo->NeedDescretBoundary() || isTopLocalAlgo)
{ {
bool checkNoAlgo2 = ( algo->NeedDescretBoundary() ); bool checkNoAlgo2 = ( algo->NeedDescretBoundary() );
const map<int, SMESH_subMesh*>& subMeshes = aSubMesh->DependsOn(); SMESH_subMeshIteratorPtr itsub = aSubMesh->getDependsOnIterator( /*includeSelf=*/false,
map<int, SMESH_subMesh*>::const_iterator itsub; /*complexShapeFirst=*/false);
for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) while ( itsub->more() )
{ {
// sub-meshes should not be checked further more // sub-meshes should not be checked further more
int key = (*itsub).first; SMESH_subMesh* sm = itsub->next();
SMESH_subMesh* sm = (*itsub).second; aCheckedMap.insert( sm );
if ( aCheckedMap.find( key ) == aCheckedMap.end() )
aCheckedMap[ key ] = sm;
if (isTopLocalAlgo) if (isTopLocalAlgo)
{ {
@ -697,39 +691,25 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
} }
} }
const map<int, SMESH_subMesh*>& smMap = sm->DependsOn(); set<SMESH_subMesh*> aCheckedSubs;
map<int, SMESH_subMesh*>::const_reverse_iterator revItSub = smMap.rbegin();
map<int, SMESH_subMesh*> aCheckedMap;
bool checkConform = ( !theMesh.IsNotConformAllowed() ); bool checkConform = ( !theMesh.IsNotConformAllowed() );
int aKey = 1;
SMESH_subMesh* smToCheck = sm;
// loop on theShape and its sub-shapes // 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) if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
break; break;
if ( aCheckedMap.find( aKey ) == aCheckedMap.end() ) if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked
if (!checkConformIgnoredAlgos (theMesh, smToCheck, aGlobIgnoAlgo, if (!checkConformIgnoredAlgos (theMesh, smToCheck, aGlobIgnoAlgo,
0, checkConform, aCheckedMap, theErrors)) 0, checkConform, aCheckedSubs, theErrors))
ret = false; ret = false;
if ( smToCheck->GetAlgoState() != SMESH_subMesh::NO_ALGO ) if ( smToCheck->GetAlgoState() != SMESH_subMesh::NO_ALGO )
hasAlgo = true; hasAlgo = true;
// next subMesh
if (revItSub != smMap.rend())
{
aKey = (*revItSub).first;
smToCheck = (*revItSub).second;
revItSub++;
}
else
{
smToCheck = 0;
}
} }
// ---------------------------------------------------------------- // ----------------------------------------------------------------
@ -749,36 +729,26 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
break; break;
} }
} }
aCheckedMap.clear();
smToCheck = sm;
revItSub = smMap.rbegin();
bool checkNoAlgo = theMesh.HasShapeToMesh() ? bool( aTopAlgoDim ) : false; bool checkNoAlgo = theMesh.HasShapeToMesh() ? bool( aTopAlgoDim ) : false;
bool globalChecked[] = { false, false, false, false }; bool globalChecked[] = { false, false, false, false };
// loop on theShape and its sub-shapes // 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) if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
break; break;
if ( aCheckedMap.find( aKey ) == aCheckedMap.end() ) if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked
if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim, if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim,
globalChecked, checkNoAlgo, aCheckedMap, theErrors)) globalChecked, checkNoAlgo, aCheckedSubs, theErrors))
{ {
ret = false; ret = false;
if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO ) if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO )
checkNoAlgo = false; checkNoAlgo = false;
} }
// next subMesh
if (revItSub != smMap.rend())
{
aKey = (*revItSub).first;
smToCheck = (*revItSub).second;
revItSub++;
}
else
smToCheck = 0;
} }
if ( !hasAlgo ) { if ( !hasAlgo ) {

View File

@ -138,16 +138,6 @@ class SMESH_EXPORT SMESH_Gen
SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0); SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0);
static bool IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh); 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(); int GetANewId();
std::map < int, SMESH_Algo * >_mapAlgo; std::map < int, SMESH_Algo * >_mapAlgo;

View File

@ -2805,12 +2805,12 @@ void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem,
return; return;
} }
issimple[iNode] = (listNewNodes.size()==nbSteps); issimple[iNode] = (listNewNodes.size()==nbSteps); // is node medium
itNN[ iNode ] = listNewNodes.begin(); itNN[ iNode ] = listNewNodes.begin();
prevNod[ iNode ] = node; prevNod[ iNode ] = node;
nextNod[ iNode ] = listNewNodes.front(); nextNod[ iNode ] = listNewNodes.front();
if( !issimple[iNode] ) { if( !elem->IsQuadratic() || !issimple[iNode] ) {
if ( prevNod[ iNode ] != nextNod [ iNode ]) if ( prevNod[ iNode ] != nextNod [ iNode ])
iNotSameNode = iNode; iNotSameNode = iNode;
else { else {
@ -2823,8 +2823,8 @@ void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem,
//cout<<" nbSame = "<<nbSame<<endl; //cout<<" nbSame = "<<nbSame<<endl;
if ( nbSame == nbNodes || nbSame > 2) { if ( nbSame == nbNodes || nbSame > 2) {
//MESSAGE( " 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() ); //INFOS( " Too many same nodes of element " << elem->GetID() );
return; return;
} }
@ -7695,6 +7695,9 @@ int SMESH_MeshEditor::convertElemToQuadratic(SMESHDS_SubMesh * theSm,
case 4: case 4:
NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d); NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d);
break; break;
case 5:
NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], id, theForce3d);
break;
case 6: case 6:
NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], aNds[5], id, theForce3d); NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], aNds[5], id, theForce3d);
break; break;
@ -7819,6 +7822,10 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d)
NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
aNds[3], id, theForce3d ); aNds[3], id, theForce3d );
break; break;
case 5:
NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
aNds[3], aNds[4], id, theForce3d);
break;
case 6: case 6:
NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
aNds[3], aNds[4], aNds[5], id, theForce3d); aNds[3], aNds[4], aNds[5], id, theForce3d);
@ -8774,7 +8781,7 @@ bool SMESH_MeshEditor::doubleNodes( SMESHDS_Mesh* theMeshDS,
theNodeNodeMap[ aCurrNode ] = aNewNode; theNodeNodeMap[ aCurrNode ] = aNewNode;
myLastCreatedNodes.Append( aNewNode ); myLastCreatedNodes.Append( aNewNode );
} }
isDuplicate |= (aCurrNode == aNewNode); isDuplicate |= (aCurrNode != aNewNode);
newNodes[ ind++ ] = aNewNode; newNodes[ ind++ ] = aNewNode;
} }
if ( !isDuplicate ) if ( !isDuplicate )
@ -8812,6 +8819,95 @@ static bool isInside(const SMDS_MeshElement* theElem,
return (aState == TopAbs_IN || aState == TopAbs_ON ); 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 \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 \param theElems - group of of elements (edges or faces) to be replicated

View File

@ -602,6 +602,9 @@ public:
const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; } const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; }
bool DoubleNodes( const std::list< int >& theListOfNodes,
const std::list< int >& theListOfModifiedElems );
bool DoubleNodes( const TIDSortedElemSet& theElems, bool DoubleNodes( const TIDSortedElemSet& theElems,
const TIDSortedElemSet& theNodesNot, const TIDSortedElemSet& theNodesNot,
const TIDSortedElemSet& theAffectedElems ); const TIDSortedElemSet& theAffectedElems );

View File

@ -356,9 +356,12 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
static_cast<const SMDS_EdgePosition*>(n->GetPosition().get()); static_cast<const SMDS_EdgePosition*>(n->GetPosition().get());
int edgeID = Pos->GetShapeId(); int edgeID = Pos->GetShapeId();
TopoDS_Edge E = TopoDS::Edge(GetMeshDS()->IndexToShape(edgeID)); 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); 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 )); uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), BRep_Tool::Tolerance( E ));
// for a node on a seam edge select one of UVs on 2 pcurves // for a node on a seam edge select one of UVs on 2 pcurves

View File

@ -23,7 +23,6 @@
// File : SMESH_subMesh.hxx // File : SMESH_subMesh.hxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_SUBMESH_HXX_ #ifndef _SMESH_SUBMESH_HXX_
#define _SMESH_SUBMESH_HXX_ #define _SMESH_SUBMESH_HXX_

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1062,6 +1062,10 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
myIsBusy = false; myIsBusy = false;
return; return;
} }
if ( myFilterDlg && !myMesh->_is_nil()){
myFilterDlg->SetMesh( myMesh );
}
myGroup = SMESH::SMESH_Group::_nil(); myGroup = SMESH::SMESH_Group::_nil();
// NPAL19389: create a group with a selection in another group // NPAL19389: create a group with a selection in another group
@ -1087,7 +1091,6 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
return; return;
} }
myIsBusy = false; myIsBusy = false;
myCurrentLineEdit = 0;
myGroup = SMESH::SMESH_Group::_nil(); myGroup = SMESH::SMESH_Group::_nil();
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
@ -1417,11 +1420,14 @@ void SMESHGUI_GroupDlg::setCurrentSelection()
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
myCurrentLineEdit = 0; myCurrentLineEdit = 0;
if (send == myMeshGroupBtn) { if (send == myMeshGroupBtn) {
myCurrentLineEdit = myMeshGroupLine; disconnect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
mySelectionMgr->clearSelected();
if (myCreate) if (myCreate)
setSelectionMode(6); setSelectionMode(6);
else else
setSelectionMode(5); setSelectionMode(5);
connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
myCurrentLineEdit = myMeshGroupLine;
onObjectSelectionChanged(); onObjectSelectionChanged();
} }
else if (send == mySubMeshBtn) { else if (send == mySubMeshBtn) {

View File

@ -533,14 +533,15 @@ QString SMESHGUI_GenericHypothesisCreator::helpPage() const
else if ( aHypType == "NumberOfLayers") else if ( aHypType == "NumberOfLayers")
aHelpFileName = "radial_prism_algo_page.html"; aHelpFileName = "radial_prism_algo_page.html";
else if ( aHypType == "NumberOfLayers2D") else if ( aHypType == "NumberOfLayers2D")
aHelpFileName = "radial_prism_algo_page.html"; aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
else if ( aHypType == "LayerDistribution") else if ( aHypType == "LayerDistribution")
aHelpFileName = "radial_prism_algo_page.html"; aHelpFileName = "radial_prism_algo_page.html";
else if ( aHypType == "LayerDistribution2D") else if ( aHypType == "LayerDistribution2D")
aHelpFileName = "radial_prism_algo_page.html"; aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
else if ( aHypType == "SegmentLengthAroundVertex") else if ( aHypType == "SegmentLengthAroundVertex")
aHelpFileName = "segments_around_vertex_algo_page.html"; aHelpFileName = "segments_around_vertex_algo_page.html";
else if ( aHypType == "QuadrangleParams")
aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
return aHelpFileName; return aHelpFileName;
} }

View File

@ -712,7 +712,8 @@ namespace SMESH
_PTR(Study) aDocument = aStudy->studyDS(); _PTR(Study) aDocument = aStudy->studyDS();
// Pass non-visual objects (hypotheses, etc.), return true in this case // Pass non-visual objects (hypotheses, etc.), return true in this case
CORBA::Long anId = aDocument->StudyId(); CORBA::Long anId = aDocument->StudyId();
if (TVisualObjPtr aVisualObj = GetVisualObj(anId,theEntry)) TVisualObjPtr aVisualObj;
if ( (aVisualObj = GetVisualObj(anId,theEntry)) && aVisualObj->IsValid())
{ {
if ((anActor = CreateActor(aDocument,theEntry,true))) { if ((anActor = CreateActor(aDocument,theEntry,true))) {
bool needFitAll = noSmeshActors(theWnd); // fit for the first object only bool needFitAll = noSmeshActors(theWnd); // fit for the first object only

View File

@ -1271,7 +1271,7 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
} }
else if ( hypType == "QuadranglePreference" ) { else if ( hypType == "QuadranglePreference" ) {
hyp->SetConvMethodAndType( "QuadranglePreference", "Quadrangle_2D"); hyp->SetConvMethodAndType( "QuadranglePreference", "Quadrangle_2D");
hyp->SetConvMethodAndType( "QuadranglePreference", "NETGEN_2D_ONLY"); hyp->SetConvMethodAndType( "SetQuadAllowed", "NETGEN_2D_ONLY");
} }
else if ( hypType == "TrianglePreference" ) { else if ( hypType == "TrianglePreference" ) {
hyp->SetConvMethodAndType( "TrianglePreference", "Quadrangle_2D"); hyp->SetConvMethodAndType( "TrianglePreference", "Quadrangle_2D");

View File

@ -786,7 +786,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
} }
// set initial part of aSript // set initial part of aSript
TCollection_AsciiString initPart = "import salome, SMESH\n"; TCollection_AsciiString initPart = "import salome, SMESH, SALOMEDS\n";
initPart += helper + "import " + aSmeshpy + "\n\n"; initPart += helper + "import " + aSmeshpy + "\n\n";
if ( importGeom ) if ( importGeom )
{ {
@ -821,7 +821,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
if( !CORBA::is_nil(aGroup) ) if( !CORBA::is_nil(aGroup) )
{ {
SALOMEDS::Color aColor = aGroup->GetColor(); SALOMEDS::Color aColor = aGroup->GetColor();
if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 ) if ( aColor.R >= 0 || aColor.G >= 0 || aColor.B >= 0 )
{ {
CORBA::String_var anEntry = aSObj->GetID(); CORBA::String_var anEntry = aSObj->GetID();
anUpdatedScript += SMESH_Comment("\n\t") anUpdatedScript += SMESH_Comment("\n\t")

View File

@ -1879,7 +1879,8 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
typedef map< pair<string, SMESH::ElementType>, TListOfNewGroups > TGroupsMap; typedef map< pair<string, SMESH::ElementType>, TListOfNewGroups > TGroupsMap;
typedef std::set<SMESHDS_GroupBase*> TGroups; typedef std::set<SMESHDS_GroupBase*> TGroups;
TPythonDump aPythonDump; // prevent dump of called methods TPythonDump* pPythonDump = new TPythonDump;
TPythonDump& aPythonDump = *pPythonDump; // prevent dump of called methods
// create mesh // create mesh
SMESH::SMESH_Mesh_var aNewMesh = CreateEmptyMesh(); SMESH::SMESH_Mesh_var aNewMesh = CreateEmptyMesh();
@ -2147,6 +2148,24 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
<< theMergeNodesAndElements << ", " << theMergeNodesAndElements << ", "
<< theMergeTolerance << ")"; << theMergeTolerance << ")";
delete pPythonDump; // enable python dump from GetGroups()
// 0020577: EDF 1164 SMESH: Bad dump of concatenate with create common groups
if ( !aNewMesh->_is_nil() )
{
SMESH::ListOfGroups_var groups = aNewMesh->GetGroups();
}
// IPAL21468 Change icon of compound because it need not be computed.
SALOMEDS::SObject_var aMeshSObj = ObjectToSObject( myCurrentStudy, aNewMesh );
if( !aMeshSObj->_is_nil() ) {
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::StudyBuilder_var aBuilder = myCurrentStudy->NewBuilder();
anAttr = aBuilder->FindOrCreateAttribute( aMeshSObj,"AttributePixMap" );
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap("ICON_SMESH_TREE_MESH");
}
return aNewMesh._retn(); return aNewMesh._retn();
} }

View File

@ -24,6 +24,7 @@
// Module : SMESH // Module : SMESH
// //
#include "SMESH_MEDMesh_i.hxx" #include "SMESH_MEDMesh_i.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESH_Mesh_i.hxx" #include "SMESH_Mesh_i.hxx"
#include "SMESHDS_Mesh.hxx" #include "SMESHDS_Mesh.hxx"
@ -115,9 +116,14 @@ char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception)
try try
{ {
// A COMPLETER PAR LE NOM DU MAILLAGE SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen();
//return CORBA::string_dup(_mesh_i->getName().c_str()); SALOMEDS::Study_var study = gen->GetCurrentStudy();
SALOMEDS::SObject_var meshSO = gen->ObjectToSObject( study, _mesh_i->_this());
if ( meshSO->_is_nil() )
return CORBA::string_dup("toto"); return CORBA::string_dup("toto");
CORBA::String_var name = meshSO->GetName();
return CORBA::string_dup( name.in() );
} }
catch(...) catch(...)
{ {
@ -125,6 +131,7 @@ char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception)
THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
SALOME::INTERNAL_ERROR); SALOME::INTERNAL_ERROR);
} }
return 0;
} }
//============================================================================= //=============================================================================
@ -240,8 +247,8 @@ char *SMESH_MEDMesh_i::getCoordinatesSystem() throw(SALOME::SALOME_Exception)
* CORBA: Accessor for Coordinates * CORBA: Accessor for Coordinates
*/ */
//============================================================================= //=============================================================================
SALOME_MED::double_array * SMESH_MEDMesh_i::getCoordinates( SALOME_MED::double_array * SMESH_MEDMesh_i::getCoordinates
SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception) (SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception)
{ {
if (_mesh_i == 0) if (_mesh_i == 0)
THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",

View File

@ -2568,6 +2568,7 @@ ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object,
<< ( HasRefPoint ? RefPoint.x : 0 ) << ", " << ( HasRefPoint ? RefPoint.x : 0 ) << ", "
<< ( HasRefPoint ? RefPoint.y : 0 ) << ", " << ( HasRefPoint ? RefPoint.y : 0 ) << ", "
<< ( HasRefPoint ? RefPoint.z : 0 ) << " ), " << ( HasRefPoint ? RefPoint.z : 0 ) << " ), "
<< MakeGroups << ", "
<< ElemType << " )"; << ElemType << " )";
} }
return aGroups; return aGroups;
@ -4213,6 +4214,142 @@ void SMESH_MeshEditor_i::DumpGroupsList(TPythonDump & theDumpPytho
} }
} }
//================================================================================
/*!
\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()
*/
//================================================================================
CORBA::Boolean SMESH_MeshEditor_i::DoubleNodes( const SMESH::long_array& theNodes,
const SMESH::long_array& theModifiedElems )
{
initData();
::SMESH_MeshEditor aMeshEditor( myMesh );
list< int > aListOfNodes;
int i, n;
for ( i = 0, n = theNodes.length(); i < n; i++ )
aListOfNodes.push_back( theNodes[ i ] );
list< int > aListOfElems;
for ( i = 0, n = theModifiedElems.length(); i < n; i++ )
aListOfElems.push_back( theModifiedElems[ i ] );
bool aResult = aMeshEditor.DoubleNodes( aListOfNodes, aListOfElems );
storeResult( aMeshEditor) ;
return aResult;
}
//================================================================================
/*!
\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()
*/
//================================================================================
CORBA::Boolean SMESH_MeshEditor_i::DoubleNode( CORBA::Long theNodeId,
const SMESH::long_array& theModifiedElems )
{
SMESH::long_array_var aNodes = new SMESH::long_array;
aNodes->length( 1 );
aNodes[ 0 ] = theNodeId;
return DoubleNodes( aNodes, 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()
*/
//================================================================================
CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup(
SMESH::SMESH_GroupBase_ptr theNodes,
SMESH::SMESH_GroupBase_ptr theModifiedElems )
{
if ( CORBA::is_nil( theNodes ) && theNodes->GetType() != SMESH::NODE )
return false;
SMESH::long_array_var aNodes = theNodes->GetListOfID();
SMESH::long_array_var aModifiedElems;
if ( !CORBA::is_nil( theModifiedElems ) )
aModifiedElems = theModifiedElems->GetListOfID();
else
{
aModifiedElems = new SMESH::long_array;
aModifiedElems->length( 0 );
}
return DoubleNodes( aNodes, aModifiedElems );
}
//================================================================================
/*!
\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()
*/
//================================================================================
CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups(
const SMESH::ListOfGroups& theNodes,
const SMESH::ListOfGroups& theModifiedElems )
{
initData();
::SMESH_MeshEditor aMeshEditor( myMesh );
std::list< int > aNodes;
int i, n, j, m;
for ( i = 0, n = theNodes.length(); i < n; i++ )
{
SMESH::SMESH_GroupBase_var aGrp = theNodes[ i ];
if ( !CORBA::is_nil( aGrp ) && aGrp->GetType() == SMESH::NODE )
{
SMESH::long_array_var aCurr = aGrp->GetListOfID();
for ( j = 0, m = aCurr->length(); j < m; j++ )
aNodes.push_back( aCurr[ j ] );
}
}
std::list< int > anElems;
for ( i = 0, n = theModifiedElems.length(); i < n; i++ )
{
SMESH::SMESH_GroupBase_var aGrp = theModifiedElems[ i ];
if ( !CORBA::is_nil( aGrp ) && aGrp->GetType() != SMESH::NODE )
{
SMESH::long_array_var aCurr = aGrp->GetListOfID();
for ( j = 0, m = aCurr->length(); j < m; j++ )
anElems.push_back( aCurr[ j ] );
}
}
bool aResult = aMeshEditor.DoubleNodes( aNodes, anElems );
storeResult( aMeshEditor) ;
return aResult;
}
//================================================================================ //================================================================================
/*! /*!
\brief Creates a hole in a mesh by doubling the nodes of some particular elements \brief Creates a hole in a mesh by doubling the nodes of some particular elements
@ -4226,7 +4363,7 @@ void SMESH_MeshEditor_i::DumpGroupsList(TPythonDump & theDumpPytho
*/ */
//================================================================================ //================================================================================
CORBA::Boolean SMESH_MeshEditor_i::DoubleNodes( const SMESH::long_array& theElems, CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElem( const SMESH::long_array& theElems,
const SMESH::long_array& theNodesNot, const SMESH::long_array& theNodesNot,
const SMESH::long_array& theAffectedElems ) const SMESH::long_array& theAffectedElems )
@ -4265,7 +4402,7 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodes( const SMESH::long_array& theElem
*/ */
//================================================================================ //================================================================================
CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesInRegion CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemInRegion
( const SMESH::long_array& theElems, ( const SMESH::long_array& theElems,
const SMESH::long_array& theNodesNot, const SMESH::long_array& theNodesNot,
GEOM::GEOM_Object_ptr theShape ) GEOM::GEOM_Object_ptr theShape )
@ -4315,7 +4452,7 @@ static void groupToSet(SMESH::SMESH_GroupBase_ptr theGrp,
arrayToSet( anIDs, theMeshDS, theElemSet, theType); arrayToSet( anIDs, theMeshDS, theElemSet, theType);
} }
CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup( CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroup(
SMESH::SMESH_GroupBase_ptr theElems, SMESH::SMESH_GroupBase_ptr theElems,
SMESH::SMESH_GroupBase_ptr theNodesNot, SMESH::SMESH_GroupBase_ptr theNodesNot,
SMESH::SMESH_GroupBase_ptr theAffectedElems ) SMESH::SMESH_GroupBase_ptr theAffectedElems )
@ -4357,7 +4494,7 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup(
*/ */
//================================================================================ //================================================================================
CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroupInRegion( CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroupInRegion(
SMESH::SMESH_GroupBase_ptr theElems, SMESH::SMESH_GroupBase_ptr theElems,
SMESH::SMESH_GroupBase_ptr theNodesNot, SMESH::SMESH_GroupBase_ptr theNodesNot,
GEOM::GEOM_Object_ptr theShape ) GEOM::GEOM_Object_ptr theShape )
@ -4416,7 +4553,7 @@ static void listOfGroupToSet(const SMESH::ListOfGroups& theGrpList,
} }
} }
CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups( CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroups(
const SMESH::ListOfGroups& theElems, const SMESH::ListOfGroups& theElems,
const SMESH::ListOfGroups& theNodesNot, const SMESH::ListOfGroups& theNodesNot,
const SMESH::ListOfGroups& theAffectedElems ) const SMESH::ListOfGroups& theAffectedElems )
@ -4455,7 +4592,7 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups(
*/ */
//================================================================================ //================================================================================
CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroupsInRegion( CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroupsInRegion(
const SMESH::ListOfGroups& theElems, const SMESH::ListOfGroups& theElems,
const SMESH::ListOfGroups& theNodesNot, const SMESH::ListOfGroups& theNodesNot,
GEOM::GEOM_Object_ptr theShape ) GEOM::GEOM_Object_ptr theShape )

View File

@ -514,6 +514,17 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
*/ */
int GetMeshId() const { return myMesh->GetId(); } int GetMeshId() const { return myMesh->GetId(); }
CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes,
const SMESH::long_array& theModifiedElems );
CORBA::Boolean DoubleNode( CORBA::Long theNodeId,
const SMESH::long_array& theModifiedElems );
CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes,
SMESH::SMESH_GroupBase_ptr theModifiedElems );
CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
const SMESH::ListOfGroups& theModifiedElems);
/*! /*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
@ -525,7 +536,7 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodeGroups() * \sa DoubleNodeGroup(), DoubleNodeGroups()
*/ */
CORBA::Boolean DoubleNodes( const SMESH::long_array& theElems, CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems,
const SMESH::long_array& theNodesNot, const SMESH::long_array& theNodesNot,
const SMESH::long_array& theAffectedElems ); const SMESH::long_array& theAffectedElems );
@ -540,7 +551,7 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion() * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
*/ */
CORBA::Boolean DoubleNodesInRegion( const SMESH::long_array& theElems, CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems,
const SMESH::long_array& theNodesNot, const SMESH::long_array& theNodesNot,
GEOM::GEOM_Object_ptr theShape ); GEOM::GEOM_Object_ptr theShape );
@ -553,7 +564,7 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodes(), DoubleNodeGroups() * \sa DoubleNodes(), DoubleNodeGroups()
*/ */
CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theElems, CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
SMESH::SMESH_GroupBase_ptr theNodesNot, SMESH::SMESH_GroupBase_ptr theNodesNot,
SMESH::SMESH_GroupBase_ptr theAffectedElems ); SMESH::SMESH_GroupBase_ptr theAffectedElems );
@ -567,7 +578,7 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion() * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
*/ */
CORBA::Boolean DoubleNodeGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems, CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
SMESH::SMESH_GroupBase_ptr theNodesNot, SMESH::SMESH_GroupBase_ptr theNodesNot,
GEOM::GEOM_Object_ptr theShape ); GEOM::GEOM_Object_ptr theShape );
@ -581,7 +592,7 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodes() * \sa DoubleNodeGroup(), DoubleNodes()
*/ */
CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theElems, CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
const SMESH::ListOfGroups& theNodesNot, const SMESH::ListOfGroups& theNodesNot,
const SMESH::ListOfGroups& theAffectedElems ); const SMESH::ListOfGroups& theAffectedElems );
@ -597,7 +608,7 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion() * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
*/ */
CORBA::Boolean DoubleNodeGroupsInRegion( const SMESH::ListOfGroups& theElems, CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
const SMESH::ListOfGroups& theNodesNot, const SMESH::ListOfGroups& theNodesNot,
GEOM::GEOM_Object_ptr theShape ); GEOM::GEOM_Object_ptr theShape );

View File

@ -522,20 +522,19 @@ SMESH::Hypothesis_Status SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Object_ptr aS
*/ */
//============================================================================= //=============================================================================
SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject, SMESH_Hypothesis::Hypothesis_Status
SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
SMESH::SMESH_Hypothesis_ptr anHyp) SMESH::SMESH_Hypothesis_ptr anHyp)
{ {
if(MYDEBUG) MESSAGE("removeHypothesis()"); if(MYDEBUG) MESSAGE("removeHypothesis()");
// **** proposer liste de subShape (selection multiple) // **** proposer liste de subShape (selection multiple)
if (CORBA::is_nil(aSubShapeObject) && HasShapeToMesh()) if (CORBA::is_nil(aSubShapeObject) && HasShapeToMesh())
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", SALOME::BAD_PARAM);
SALOME::BAD_PARAM);
SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp); SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp);
if (CORBA::is_nil(myHyp)) if (CORBA::is_nil(myHyp))
THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", SALOME::BAD_PARAM);
SALOME::BAD_PARAM);
SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK; SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK;
try try
@ -549,8 +548,8 @@ SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Ob
int hypId = myHyp->GetId(); int hypId = myHyp->GetId();
status = _impl->RemoveHypothesis(myLocSubShape, hypId); status = _impl->RemoveHypothesis(myLocSubShape, hypId);
if ( !SMESH_Hypothesis::IsStatusFatal(status) ) // if ( !SMESH_Hypothesis::IsStatusFatal(status) ) EAP: hyp can be used on many subshapes
_mapHypo.erase( hypId ); // _mapHypo.erase( hypId );
} }
catch(SALOME_Exception & S_ex) catch(SALOME_Exception & S_ex)
{ {
@ -572,8 +571,7 @@ throw(SALOME::SALOME_Exception)
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
if (MYDEBUG) MESSAGE("GetHypothesisList"); if (MYDEBUG) MESSAGE("GetHypothesisList");
if (_impl->HasShapeToMesh() && CORBA::is_nil(aSubShapeObject)) if (_impl->HasShapeToMesh() && CORBA::is_nil(aSubShapeObject))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", SALOME::BAD_PARAM);
SALOME::BAD_PARAM);
SMESH::ListOfHypothesis_var aList = new SMESH::ListOfHypothesis(); SMESH::ListOfHypothesis_var aList = new SMESH::ListOfHypothesis();
@ -669,6 +667,9 @@ void SMESH_Mesh_i::RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
if ( anSO->FindSubObject( aTag, anObj ) && anObj->ReferencedObject( aRef ) ) if ( anSO->FindSubObject( aTag, anObj ) && anObj->ReferencedObject( aRef ) )
aSubShapeObject = GEOM::GEOM_Object::_narrow( aRef->GetObject() ); aSubShapeObject = GEOM::GEOM_Object::_narrow( aRef->GetObject() );
// if ( aSubShapeObject->_is_nil() ) // not published shape (IPAL13617)
// aSubShapeObject = theSubMesh->GetSubShape();
aStudy->NewBuilder()->RemoveObjectWithChildren( anSO ); aStudy->NewBuilder()->RemoveObjectWithChildren( anSO );
// Update Python script // Update Python script
@ -1976,9 +1977,26 @@ void SMESH_Mesh_i::removeSubMesh (SMESH::SMESH_subMesh_ptr theSubMesh,
GEOM::GEOM_Object_ptr theSubShapeObject ) GEOM::GEOM_Object_ptr theSubShapeObject )
{ {
MESSAGE("SMESH_Mesh_i::removeSubMesh()"); MESSAGE("SMESH_Mesh_i::removeSubMesh()");
if ( theSubMesh->_is_nil() || theSubShapeObject->_is_nil() ) if ( theSubMesh->_is_nil() /*|| theSubShapeObject->_is_nil()*/ )
return; return;
if ( theSubShapeObject->_is_nil() ) // not published shape (IPAL13617)
{
CORBA::Long shapeId = theSubMesh->GetId();
if ( _mapSubMesh.find( shapeId ) != _mapSubMesh.end())
{
TopoDS_Shape S = _mapSubMesh[ shapeId ]->GetSubShape();
if ( !S.IsNull() )
{
list<const SMESHDS_Hypothesis*> hyps = _impl->GetHypothesisList( S );
list<const SMESHDS_Hypothesis*>::const_iterator hyp = hyps.begin();
for ( ; hyp != hyps.end(); ++hyp )
_impl->RemoveHypothesis(S, (*hyp)->GetID());
}
}
}
else
{
try { try {
SMESH::ListOfHypothesis_var aHypList = GetHypothesisList( theSubShapeObject ); SMESH::ListOfHypothesis_var aHypList = GetHypothesisList( theSubShapeObject );
for ( int i = 0, n = aHypList->length(); i < n; i++ ) { for ( int i = 0, n = aHypList->length(); i < n; i++ ) {
@ -1989,7 +2007,7 @@ void SMESH_Mesh_i::removeSubMesh (SMESH::SMESH_subMesh_ptr theSubMesh,
INFOS("SMESH_Mesh_i::removeSubMesh(): exception caught!"); INFOS("SMESH_Mesh_i::removeSubMesh(): exception caught!");
} }
removeGeomGroupData( theSubShapeObject ); removeGeomGroupData( theSubShapeObject );
}
int subMeshId = theSubMesh->GetId(); int subMeshId = theSubMesh->GetId();
_mapSubMesh.erase(subMeshId); _mapSubMesh.erase(subMeshId);
@ -2127,7 +2145,7 @@ throw(SALOME::SALOME_Exception)
void SMESH_Mesh_i::ClearLog() throw(SALOME::SALOME_Exception) void SMESH_Mesh_i::ClearLog() throw(SALOME::SALOME_Exception)
{ {
if(MYDEBUG) MESSAGE("SMESH_Mesh_i::ClearLog"); if(MYDEBUG) MESSAGE("SMESH_Mesh_i::ClearLog");
// **** _impl->ClearLog();
} }
//============================================================================= //=============================================================================

View File

@ -149,7 +149,7 @@ CORBA::Boolean SMESH_Pattern_i::LoadFromFace(SMESH::SMESH_Mesh_ptr theMesh,
return false; return false;
// Update Python script // Update Python script
TPythonDump() << "isDone = pattern.LoadFromFace( " << theMesh << ", " TPythonDump() << "isDone = pattern.LoadFromFace( " << theMesh << ".GetMesh(), "
<< theFace << ", " << theProject << " )"; << theFace << ", " << theProject << " )";
addErrorCode( "LoadFromFace" ); addErrorCode( "LoadFromFace" );
@ -180,7 +180,7 @@ CORBA::Boolean SMESH_Pattern_i::LoadFrom3DBlock(SMESH::SMESH_Mesh_ptr theMesh,
return false; return false;
// Update Python script // Update Python script
TPythonDump() << "isDone = pattern.LoadFrom3DBlock( " << theMesh << ", " << theBlock << " )"; TPythonDump() << "isDone = pattern.LoadFrom3DBlock( " << theMesh << ".GetMesh(), " << theBlock << " )";
addErrorCode( "LoadFrom3DBlock" ); addErrorCode( "LoadFrom3DBlock" );
return myPattern.Load( aMesh, TopoDS::Shell( exp.Current() )); return myPattern.Load( aMesh, TopoDS::Shell( exp.Current() ));
@ -316,7 +316,7 @@ SMESH::point_array*
} }
// Update Python script // Update Python script
TPythonDump() << "pattern.ApplyToMeshFaces( " << theMesh << ", " TPythonDump() << "pattern.ApplyToMeshFaces( " << theMesh << ".GetMesh(), "
<< theFacesIDs << ", " << theFacesIDs << ", "
<< theNodeIndexOnKeyPoint1 << ", " << theReverse << " )"; << theNodeIndexOnKeyPoint1 << ", " << theReverse << " )";
@ -361,7 +361,7 @@ SMESH::point_array*
} }
// Update Python script // Update Python script
TPythonDump() << "pattern.ApplyToHexahedrons( " << theMesh << ", " TPythonDump() << "pattern.ApplyToHexahedrons( " << theMesh << ".GetMesh(), "
<< theVolumesIDs << ", " << theVolumesIDs << ", "
<< theNode000Index << ", " << theNode001Index << " )"; << theNode000Index << ", " << theNode001Index << " )";
@ -382,7 +382,7 @@ CORBA::Boolean SMESH_Pattern_i::MakeMesh (SMESH::SMESH_Mesh_ptr theMesh,
return false; return false;
// Update Python script // Update Python script
TPythonDump() << "isDone = pattern.MakeMesh( " << theMesh << ", " TPythonDump() << "isDone = pattern.MakeMesh( " << theMesh << ".GetMesh(), "
<< CreatePolygons << ", " << CreatePolyedrs << " )"; << CreatePolygons << ", " << CreatePolyedrs << " )";
addErrorCode( "MakeMesh" ); addErrorCode( "MakeMesh" );

View File

@ -130,5 +130,5 @@ for a in log:
i2 = a.indexes[ii] i2 = a.indexes[ii]
ii = ii+1 ii = ii+1
i3 = a.indexes[ii] i3 = a.indexes[ii]
#ii = ii+1 ii = ii+1
print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3) print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3)

View File

@ -108,6 +108,38 @@ except ImportError:
noNETGENPlugin = 1 noNETGENPlugin = 1
pass pass
# import GHS3DPlugin module if possible
noGHS3DPlugin = 0
try:
import GHS3DPlugin
except ImportError:
noGHS3DPlugin = 1
pass
# import GHS3DPRLPlugin module if possible
noGHS3DPRLPlugin = 0
try:
import GHS3DPRLPlugin
except ImportError:
noGHS3DPRLPlugin = 1
pass
# import HexoticPlugin module if possible
noHexoticPlugin = 0
try:
import HexoticPlugin
except ImportError:
noHexoticPlugin = 1
pass
# import BLSURFPlugin module if possible
noBLSURFPlugin = 0
try:
import BLSURFPlugin
except ImportError:
noBLSURFPlugin = 1
pass
## @addtogroup l1_auxiliary ## @addtogroup l1_auxiliary
## @{ ## @{
@ -149,7 +181,10 @@ VeryFine = 4
Custom = 5 Custom = 5
# Optimization level of GHS3D # Optimization level of GHS3D
# V3.1
None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization = 0,1,2,3 None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization = 0,1,2,3
# V4.1 (partialy redefines V3.1). Issue 0020574
None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization, Strong_Optimization = 0,1,2,3,4
# Topology treatment way of BLSURF # Topology treatment way of BLSURF
FromCAD, PreProcess, PreProcessPlus = 0,1,2 FromCAD, PreProcess, PreProcessPlus = 0,1,2
@ -403,6 +438,25 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo):
print hypName, "was not assigned to",geomName,":", reason print hypName, "was not assigned to",geomName,":", reason
pass pass
## Check meshing plugin availability
def CheckPlugin(plugin):
if plugin == NETGEN and noNETGENPlugin:
print "Warning: NETGENPlugin module unavailable"
return False
elif plugin == GHS3D and noGHS3DPlugin:
print "Warning: GHS3DPlugin module unavailable"
return False
elif plugin == GHS3DPRL and noGHS3DPRLPlugin:
print "Warning: GHS3DPRLPlugin module unavailable"
return False
elif plugin == Hexotic and noHexoticPlugin:
print "Warning: HexoticPlugin module unavailable"
return False
elif plugin == BLSURF and noBLSURFPlugin:
print "Warning: BLSURFPlugin module unavailable"
return False
return True
# end of l1_auxiliary # end of l1_auxiliary
## @} ## @}
@ -756,12 +810,26 @@ class smeshDC(SMESH._objref_SMESH_Gen):
print "Error: given parameter is not numerucal functor type." print "Error: given parameter is not numerucal functor type."
## Creates hypothesis ## Creates hypothesis
# @param # @param theHType mesh hypothesis type (string)
# @param # @param theLibName mesh plug-in library name
# @return created hypothesis instance # @return created hypothesis instance
def CreateHypothesis(self, theHType, theLibName="libStdMeshersEngine.so"): def CreateHypothesis(self, theHType, theLibName="libStdMeshersEngine.so"):
return SMESH._objref_SMESH_Gen.CreateHypothesis(self, theHType, theLibName ) return SMESH._objref_SMESH_Gen.CreateHypothesis(self, theHType, theLibName )
## Gets the mesh stattistic
# @return dictionary type element - count of elements
# @ingroup l1_meshinfo
def GetMeshInfo(self, obj):
if isinstance( obj, Mesh ):
obj = obj.GetMesh()
d = {}
if hasattr(obj, "_narrow") and obj._narrow(SMESH.SMESH_IDSource):
values = obj.GetMeshInfo()
for i in range(SMESH.Entity_Last._v):
if i < len(values): d[SMESH.EntityType._item(i)]=values[i]
pass
return d
import omniORB import omniORB
#Registering the new proxy for SMESH_Gen #Registering the new proxy for SMESH_Gen
omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshDC) omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshDC)
@ -1252,6 +1320,8 @@ class Mesh:
# Exports the mesh in a file in MED format and chooses the \a version of MED format # Exports the mesh in a file in MED format and chooses the \a version of MED format
# @param f the file name # @param f the file name
# @param version values are SMESH.MED_V2_1, SMESH.MED_V2_2 # @param version values are SMESH.MED_V2_1, SMESH.MED_V2_2
# @param opt boolean parameter for creating/not creating
# the groups Group_On_All_Nodes, Group_On_All_Faces, ...
# @ingroup l2_impexp # @ingroup l2_impexp
def ExportToMED(self, f, version, opt=0): def ExportToMED(self, f, version, opt=0):
self.mesh.ExportToMED(f, opt, version) self.mesh.ExportToMED(f, opt, version)
@ -1323,9 +1393,15 @@ class Mesh:
elif tgeo == "SHELL": elif tgeo == "SHELL":
typ = VOLUME typ = VOLUME
elif tgeo == "COMPOUND": elif tgeo == "COMPOUND":
try: # it raises on a compound of compounds
if len( self.geompyD.GetObjectIDs( grp )) == 0: if len( self.geompyD.GetObjectIDs( grp )) == 0:
print "Mesh.Group: empty geometric group", GetName( grp ) print "Mesh.Group: empty geometric group", GetName( grp )
return 0 return 0
pass
except:
pass
if grp.GetType() == 37: # GEOMImpl_Types.hxx: #define GEOM_GROUP 37
# group
tgeo = self.geompyD.GetType(grp) tgeo = self.geompyD.GetType(grp)
if tgeo == geompyDC.ShapeType["VERTEX"]: if tgeo == geompyDC.ShapeType["VERTEX"]:
typ = NODE typ = NODE
@ -1335,7 +1411,19 @@ class Mesh:
typ = FACE typ = FACE
elif tgeo == geompyDC.ShapeType["SOLID"]: elif tgeo == geompyDC.ShapeType["SOLID"]:
typ = VOLUME typ = VOLUME
pass
pass
else:
# just a compound
for elemType, shapeType in [[VOLUME,"SOLID"],[FACE,"FACE"],
[EDGE,"EDGE"],[NODE,"VERTEX"]]:
if self.geompyD.SubShapeAll(grp,geompyDC.ShapeType[shapeType]):
typ = elemType
break
pass
pass
pass
pass
if typ == None: if typ == None:
print "Mesh.Group: bad first argument: expected a group, a vertex, an edge, a face or a solid" print "Mesh.Group: bad first argument: expected a group, a vertex, an edge, a face or a solid"
return 0 return 0
@ -1596,13 +1684,7 @@ class Mesh:
# @ingroup l1_meshinfo # @ingroup l1_meshinfo
def GetMeshInfo(self, obj = None): def GetMeshInfo(self, obj = None):
if not obj: obj = self.mesh if not obj: obj = self.mesh
d = {} return self.smeshpyD.GetMeshInfo(obj)
if hasattr(obj, "_narrow") and obj._narrow(SMESH.SMESH_IDSource):
values = obj.GetMeshInfo()
for i in range(SMESH.Entity_Last._v):
if i < len(values): d[SMESH.EntityType._item(i)]=values[i]
pass
return d
## Returns the number of nodes in the mesh ## Returns the number of nodes in the mesh
# @return an integer value # @return an integer value
@ -2128,6 +2210,8 @@ class Mesh:
# @param x the X coordinate of a point # @param x the X coordinate of a point
# @param y the Y coordinate of a point # @param y the Y coordinate of a point
# @param z the Z coordinate of a point # @param z the Z coordinate of a point
# @param NodeID if specified (>0), the node with this ID is moved,
# otherwise, the node closest to point (@a x,@a y,@a z) is moved
# @return the ID of a node # @return the ID of a node
# @ingroup l2_modif_throughp # @ingroup l2_modif_throughp
def MoveClosestNodeToPoint(self, x, y, z, NodeID): def MoveClosestNodeToPoint(self, x, y, z, NodeID):
@ -2814,7 +2898,7 @@ class Mesh:
HasRefPoint, RefPoint, MakeGroups, ElemType) HasRefPoint, RefPoint, MakeGroups, ElemType)
else: else:
if isinstance(Base,Mesh): if isinstance(Base,Mesh):
return self.editor.ExtrusionAlongPathObjX(Base.GetMesh(), Path, NodeStart, return self.editor.ExtrusionAlongPathObjX(Base, Path, NodeStart,
HasAngles, Angles, LinearVariation, HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups, ElemType) HasRefPoint, RefPoint, MakeGroups, ElemType)
else: else:
@ -3275,6 +3359,8 @@ class Mesh:
# @return a list of groups of equal elements # @return a list of groups of equal elements
# @ingroup l2_modif_trsf # @ingroup l2_modif_trsf
def FindEqualElements (self, MeshOrSubMeshOrGroup): def FindEqualElements (self, MeshOrSubMeshOrGroup):
if ( isinstance( MeshOrSubMeshOrGroup, Mesh )):
MeshOrSubMeshOrGroup = MeshOrSubMeshOrGroup.GetMesh()
return self.editor.FindEqualElements(MeshOrSubMeshOrGroup) return self.editor.FindEqualElements(MeshOrSubMeshOrGroup)
## Merges elements in each given group. ## Merges elements in each given group.
@ -3354,6 +3440,43 @@ class Mesh:
return self.editor.GetLastCreatedElems() return self.editor.GetLastCreatedElems()
## Creates a hole in a mesh by doubling the nodes of some particular elements ## 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
# @ingroup l2_modif_edit
def DoubleNodes(self, theNodes, theModifiedElems):
return self.editor.DoubleNodes(theNodes, theModifiedElems)
## 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 identifiers of node to be doubled
# @param theModifiedElems identifiers of elements to be updated
# @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit
def DoubleNode(self, theNodeId, theModifiedElems):
return self.editor.DoubleNode(theNodeId, theModifiedElems)
## 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
# @ingroup l2_modif_edit
def DoubleNodeGroup(self, theNodes, theModifiedElems):
return self.editor.DoubleNodeGroup(theNodes, theModifiedElems)
## 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
# @ingroup l2_modif_edit
def DoubleNodeGroups(self, theNodes, theModifiedElems):
return self.editor.DoubleNodeGroups(theNodes, theModifiedElems)
## Creates a hole in a mesh by doubling the nodes of some particular elements
# @param theElems - the list of elements (edges or faces) to be replicated # @param theElems - the list of elements (edges or faces) to be replicated
# The nodes for duplication could be found from these elements # The nodes for duplication could be found from these elements
# @param theNodesNot - list of nodes to NOT replicate # @param theNodesNot - list of nodes to NOT replicate
@ -3361,8 +3484,8 @@ class Mesh:
# replicated nodes should be associated to. # replicated nodes should be associated to.
# @return TRUE if operation has been completed successfully, FALSE otherwise # @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit # @ingroup l2_modif_edit
def DoubleNodes(self, theElems, theNodesNot, theAffectedElems): def DoubleNodeElem(self, theElems, theNodesNot, theAffectedElems):
return self.editor.DoubleNodes(theElems, theNodesNot, theAffectedElems) return self.editor.DoubleNodeElem(theElems, theNodesNot, theAffectedElems)
## Creates a hole in a mesh by doubling the nodes of some particular elements ## Creates a hole in a mesh by doubling the nodes of some particular elements
# @param theElems - the list of elements (edges or faces) to be replicated # @param theElems - the list of elements (edges or faces) to be replicated
@ -3373,8 +3496,8 @@ class Mesh:
# The replicated nodes should be associated to affected elements. # The replicated nodes should be associated to affected elements.
# @return TRUE if operation has been completed successfully, FALSE otherwise # @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit # @ingroup l2_modif_edit
def DoubleNodesInRegion(self, theElems, theNodesNot, theShape): def DoubleNodeElemInRegion(self, theElems, theNodesNot, theShape):
return self.editor.DoubleNodesInRegion(theElems, theNodesNot, theShape) return self.editor.DoubleNodeElemInRegion(theElems, theNodesNot, theShape)
## Creates a hole in a mesh by doubling the nodes of some particular elements ## Creates a hole in a mesh by doubling the nodes of some particular elements
# This method provided for convenience works as DoubleNodes() described above. # This method provided for convenience works as DoubleNodes() described above.
@ -3383,8 +3506,8 @@ class Mesh:
# @param theAffectedElems - group of elements to which the replicated nodes # @param theAffectedElems - group of elements to which the replicated nodes
# should be associated to. # should be associated to.
# @ingroup l2_modif_edit # @ingroup l2_modif_edit
def DoubleNodeGroup(self, theElems, theNodesNot, theAffectedElems): def DoubleNodeElemGroup(self, theElems, theNodesNot, theAffectedElems):
return self.editor.DoubleNodeGroup(theElems, theNodesNot, theAffectedElems) return self.editor.DoubleNodeElemGroup(theElems, theNodesNot, theAffectedElems)
## Creates a hole in a mesh by doubling the nodes of some particular elements ## Creates a hole in a mesh by doubling the nodes of some particular elements
# This method provided for convenience works as DoubleNodes() described above. # This method provided for convenience works as DoubleNodes() described above.
@ -3394,8 +3517,8 @@ class Mesh:
# located on or inside shape). # located on or inside shape).
# The replicated nodes should be associated to affected elements. # The replicated nodes should be associated to affected elements.
# @ingroup l2_modif_edit # @ingroup l2_modif_edit
def DoubleNodeGroupInRegion(self, theElems, theNodesNot, theShape): def DoubleNodeElemGroupInRegion(self, theElems, theNodesNot, theShape):
return self.editor.DoubleNodeGroup(theElems, theNodesNot, theShape) return self.editor.DoubleNodeElemGroup(theElems, theNodesNot, theShape)
## Creates a hole in a mesh by doubling the nodes of some particular elements ## Creates a hole in a mesh by doubling the nodes of some particular elements
# This method provided for convenience works as DoubleNodes() described above. # This method provided for convenience works as DoubleNodes() described above.
@ -3405,8 +3528,8 @@ class Mesh:
# should be associated to. # should be associated to.
# @return TRUE if operation has been completed successfully, FALSE otherwise # @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit # @ingroup l2_modif_edit
def DoubleNodeGroups(self, theElems, theNodesNot, theAffectedElems): def DoubleNodeElemGroups(self, theElems, theNodesNot, theAffectedElems):
return self.editor.DoubleNodeGroups(theElems, theNodesNot, theAffectedElems) return self.editor.DoubleNodeElemGroups(theElems, theNodesNot, theAffectedElems)
## Creates a hole in a mesh by doubling the nodes of some particular elements ## Creates a hole in a mesh by doubling the nodes of some particular elements
# This method provided for convenience works as DoubleNodes() described above. # This method provided for convenience works as DoubleNodes() described above.
@ -3417,8 +3540,8 @@ class Mesh:
# The replicated nodes should be associated to affected elements. # The replicated nodes should be associated to affected elements.
# @return TRUE if operation has been completed successfully, FALSE otherwise # @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit # @ingroup l2_modif_edit
def DoubleNodeGroupsInRegion(self, theElems, theNodesNot, theShape): def DoubleNodeElemGroupsInRegion(self, theElems, theNodesNot, theShape):
return self.editor.DoubleNodeGroupsInRegion(theElems, theNodesNot, theShape) return self.editor.DoubleNodeElemGroupsInRegion(theElems, theNodesNot, theShape)
## The mother class to define algorithm, it is not recommended to use it directly. ## The mother class to define algorithm, it is not recommended to use it directly.
# #
@ -3996,19 +4119,15 @@ class Mesh_Triangle(Mesh_Algorithm):
self.Create(mesh, geom, "MEFISTO_2D") self.Create(mesh, geom, "MEFISTO_2D")
pass pass
elif algoType == BLSURF: elif algoType == BLSURF:
import BLSURFPlugin CheckPlugin(BLSURF)
self.Create(mesh, geom, "BLSURF", "libBLSURFEngine.so") self.Create(mesh, geom, "BLSURF", "libBLSURFEngine.so")
#self.SetPhysicalMesh() - PAL19680 #self.SetPhysicalMesh() - PAL19680
elif algoType == NETGEN: elif algoType == NETGEN:
if noNETGENPlugin: CheckPlugin(NETGEN)
print "Warning: NETGENPlugin module unavailable"
pass
self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so") self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
pass pass
elif algoType == NETGEN_2D: elif algoType == NETGEN_2D:
if noNETGENPlugin: CheckPlugin(NETGEN)
print "Warning: NETGENPlugin module unavailable"
pass
self.Create(mesh, geom, "NETGEN_2D_ONLY", "libNETGENEngine.so") self.Create(mesh, geom, "NETGEN_2D_ONLY", "libNETGENEngine.so")
pass pass
@ -4057,6 +4176,7 @@ class Mesh_Triangle(Mesh_Algorithm):
# @ingroup l3_hypos_blsurf # @ingroup l3_hypos_blsurf
def SetPhySize(self, theVal): def SetPhySize(self, theVal):
# Parameter of BLSURF algo # Parameter of BLSURF algo
self.SetPhysicalMesh(1) #Custom - else why to set the size?
self.Parameters().SetPhySize(theVal) self.Parameters().SetPhySize(theVal)
## Sets lower boundary of mesh element size (PhySize). ## Sets lower boundary of mesh element size (PhySize).
@ -4311,22 +4431,22 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
Mesh_Algorithm.__init__(self) Mesh_Algorithm.__init__(self)
if algoType == NETGEN: if algoType == NETGEN:
CheckPlugin(NETGEN)
self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so") self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
pass pass
elif algoType == FULL_NETGEN: elif algoType == FULL_NETGEN:
if noNETGENPlugin: CheckPlugin(NETGEN)
print "Warning: NETGENPlugin module has not been imported."
self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so") self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
pass pass
elif algoType == GHS3D: elif algoType == GHS3D:
import GHS3DPlugin CheckPlugin(GHS3D)
self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so") self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
pass pass
elif algoType == GHS3DPRL: elif algoType == GHS3DPRL:
import GHS3DPRLPlugin CheckPlugin(GHS3DPRL)
self.Create(mesh, geom, "GHS3DPRL_3D" , "libGHS3DPRLEngine.so") self.Create(mesh, geom, "GHS3DPRL_3D" , "libGHS3DPRLEngine.so")
pass pass
@ -4464,8 +4584,9 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
self.Parameters().SetToMeshHoles(toMesh) self.Parameters().SetToMeshHoles(toMesh)
## Set Optimization level: ## Set Optimization level:
# None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization. # None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization,
# Default is Medium_Optimization # Strong_Optimization.
# Default is Standard_Optimization
# @ingroup l3_hypos_ghs3dh # @ingroup l3_hypos_ghs3dh
def SetOptimizationLevel(self, level): def SetOptimizationLevel(self, level):
# Parameter of GHS3D # Parameter of GHS3D
@ -4562,7 +4683,7 @@ class Mesh_Hexahedron(Mesh_Algorithm):
pass pass
elif algoType == Hexotic: elif algoType == Hexotic:
import HexoticPlugin CheckPlugin(Hexotic)
self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so") self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so")
pass pass
@ -4595,8 +4716,7 @@ class Mesh_Netgen(Mesh_Algorithm):
def __init__(self, mesh, is3D, geom=0): def __init__(self, mesh, is3D, geom=0):
Mesh_Algorithm.__init__(self) Mesh_Algorithm.__init__(self)
if noNETGENPlugin: CheckPlugin(NETGEN)
print "Warning: NETGENPlugin module has not been imported."
self.is3D = is3D self.is3D = is3D
if is3D: if is3D:
@ -5115,7 +5235,7 @@ omniORB.registerObjref(StdMeshers._objref_StdMeshers_MaxElementArea._NP_Reposito
class MaxElementVolume(StdMeshers._objref_StdMeshers_MaxElementVolume): class MaxElementVolume(StdMeshers._objref_StdMeshers_MaxElementVolume):
## Set Max Element Volume parameter value ## Set Max Element Volume parameter value
# @param area numerical value or name of variable from notebook # @param volume numerical value or name of variable from notebook
def SetMaxElementVolume(self, volume): def SetMaxElementVolume(self, volume):
volume ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_MaxElementVolume.GetLastParameters(self),1,1,volume) volume ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_MaxElementVolume.GetLastParameters(self),1,1,volume)
StdMeshers._objref_StdMeshers_MaxElementVolume.SetParameters(self,parameters) StdMeshers._objref_StdMeshers_MaxElementVolume.SetParameters(self,parameters)
@ -5159,7 +5279,7 @@ class NumberOfSegments(StdMeshers._objref_StdMeshers_NumberOfSegments):
#Registering the new proxy for NumberOfSegments #Registering the new proxy for NumberOfSegments
omniORB.registerObjref(StdMeshers._objref_StdMeshers_NumberOfSegments._NP_RepositoryId, NumberOfSegments) omniORB.registerObjref(StdMeshers._objref_StdMeshers_NumberOfSegments._NP_RepositoryId, NumberOfSegments)
if not noNETGENPlugin:
#Wrapper class for NETGENPlugin_Hypothesis hypothesis #Wrapper class for NETGENPlugin_Hypothesis hypothesis
class NETGENPlugin_Hypothesis(NETGENPlugin._objref_NETGENPlugin_Hypothesis): class NETGENPlugin_Hypothesis(NETGENPlugin._objref_NETGENPlugin_Hypothesis):
@ -5264,6 +5384,8 @@ class NETGEN_SimpleParameters_3D(NETGEN_SimpleParameters_2D,NETGENPlugin._objref
#Registering the new proxy for NETGEN_SimpleParameters_3D #Registering the new proxy for NETGEN_SimpleParameters_3D
omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D._NP_RepositoryId, NETGEN_SimpleParameters_3D) omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D._NP_RepositoryId, NETGEN_SimpleParameters_3D)
pass # if not noNETGENPlugin:
class Pattern(SMESH._objref_SMESH_Pattern): class Pattern(SMESH._objref_SMESH_Pattern):
def ApplyToMeshFaces(self, theMesh, theFacesIDs, theNodeIndexOnKeyPoint1, theReverse): def ApplyToMeshFaces(self, theMesh, theFacesIDs, theNodeIndexOnKeyPoint1, theReverse):

View File

@ -541,15 +541,7 @@ TSideVector StdMeshers_FaceSide::GetFaceWires(const TopoDS_Face& theFace,
return TSideVector(0); return TSideVector(0);
} }
} }
// find out side orientation, which is important if there are several wires (PAL19080) const bool isForward = true;
bool isForward = true;
if ( nbWires > 1 ) {
TopExp_Explorer e( theFace, TopAbs_EDGE );
while ( ! e.Current().IsSame( wireEdges.back() ))
e.Next();
isForward = ( e.Current().Orientation() == wireEdges.back().Orientation() );
}
StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh, StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh,
isForward, theIgnoreMediumNodes); isForward, theIgnoreMediumNodes);
wires[ iW ] = StdMeshers_FaceSidePtr( wire ); wires[ iW ] = StdMeshers_FaceSidePtr( wire );

View File

@ -49,6 +49,8 @@
#include <Standard_ErrorHandler.hxx> #include <Standard_ErrorHandler.hxx>
#endif #endif
#include <Basics_Utils.hxx>
using namespace std; using namespace std;
const double PRECISION = 1e-7; const double PRECISION = 1e-7;
@ -321,6 +323,8 @@ bool process( const TCollection_AsciiString& str, int convMode,
bool& non_neg, bool& non_zero, bool& non_neg, bool& non_zero,
bool& singulars, double& sing_point ) bool& singulars, double& sing_point )
{ {
Kernel_Utils::Localizer loc;
bool parsed_ok = true; bool parsed_ok = true;
Handle( ExprIntrp_GenExp ) myExpr; Handle( ExprIntrp_GenExp ) myExpr;
try { try {
@ -372,6 +376,7 @@ bool process( const TCollection_AsciiString& str, int convMode,
non_zero = true; non_zero = true;
} }
} }
return res && non_neg && non_zero && ( !singulars ); return res && non_neg && non_zero && ( !singulars );
} }

View File

@ -45,23 +45,15 @@
#include <BRepAdaptor_Curve.hxx> #include <BRepAdaptor_Curve.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx> #include <BRepBuilderAPI_MakeEdge.hxx>
//#include <BRepTools.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <TopExp_Explorer.hxx> #include <GeomAPI_ProjectPointOnSurf.hxx>
#include <TopoDS.hxx>
//#include <TopoDS_Shell.hxx>
//#include <TopoDS_Solid.hxx>
//#include <TopTools_MapOfShape.hxx>
//#include <gp.hxx>
//#include <gp_Pnt.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_Circle.hxx> #include <Geom_Circle.hxx>
#include <Geom_Line.hxx> #include <Geom_Line.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <TColgp_SequenceOfPnt.hxx> #include <TColgp_SequenceOfPnt.hxx>
#include <TColgp_SequenceOfPnt2d.hxx> #include <TColgp_SequenceOfPnt2d.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx> #include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
using namespace std; using namespace std;
@ -148,6 +140,160 @@ bool StdMeshers_RadialQuadrangle_1D2D::CheckHypothesis
return true; return true;
} }
namespace
{
// ------------------------------------------------------------------------------
/*!
* \brief Listener used to mark edges meshed by StdMeshers_RadialQuadrangle_1D2D
*/
class TLinEdgeMarker : public SMESH_subMeshEventListener
{
TLinEdgeMarker(): SMESH_subMeshEventListener(/*isDeletable=*/false) {}
public:
static SMESH_subMeshEventListener* getListener()
{
static TLinEdgeMarker theEdgeMarker;
return &theEdgeMarker;
}
};
// ------------------------------------------------------------------------------
/*!
* \brief Mark an edge as computed by StdMeshers_RadialQuadrangle_1D2D
*/
void markLinEdgeAsComputedByMe(const TopoDS_Edge& edge, SMESH_subMesh* faceSubMesh)
{
if ( SMESH_subMesh* edgeSM = faceSubMesh->GetFather()->GetSubMeshContaining( edge ))
{
if ( !edgeSM->GetEventListenerData( TLinEdgeMarker::getListener() ))
faceSubMesh->SetEventListener( TLinEdgeMarker::getListener(),
SMESH_subMeshEventListenerData::MakeData(faceSubMesh),
edgeSM);
}
}
// ------------------------------------------------------------------------------
/*!
* \brief Return true if a radial edge was meshed with StdMeshers_RadialQuadrangle_1D2D with
* the same radial distribution
*/
bool isEdgeCompitaballyMeshed(const TopoDS_Edge& edge, SMESH_subMesh* faceSubMesh)
{
if ( SMESH_subMesh* edgeSM = faceSubMesh->GetFather()->GetSubMeshContaining( edge ))
{
if ( SMESH_subMeshEventListenerData* otherFaceData =
edgeSM->GetEventListenerData( TLinEdgeMarker::getListener() ))
{
// compare hypothesis aplied to two disk faces sharing radial edges
SMESH_Mesh& mesh = *faceSubMesh->GetFather();
SMESH_Algo* radialQuadAlgo = mesh.GetGen()->GetAlgo(mesh, faceSubMesh->GetSubShape() );
SMESH_subMesh* otherFaceSubMesh = otherFaceData->mySubMeshes.front();
const list <const SMESHDS_Hypothesis *> & hyps1 =
radialQuadAlgo->GetUsedHypothesis( mesh, faceSubMesh->GetSubShape());
const list <const SMESHDS_Hypothesis *> & hyps2 =
radialQuadAlgo->GetUsedHypothesis( mesh, otherFaceSubMesh->GetSubShape());
if( hyps1.empty() && hyps2.empty() )
return true; // defaul hyps
if ( hyps1.size() != hyps2.size() ||
strcmp( hyps1.front()->GetName(), hyps2.front()->GetName() ))
return false;
ostringstream hypDump1, hypDump2;
list <const SMESHDS_Hypothesis*>::const_iterator hyp1 = hyps1.begin();
for ( ; hyp1 != hyps1.end(); ++hyp1 )
const_cast<SMESHDS_Hypothesis*>(*hyp1)->SaveTo( hypDump1 );
list <const SMESHDS_Hypothesis*>::const_iterator hyp2 = hyps2.begin();
for ( ; hyp2 != hyps2.end(); ++hyp2 )
const_cast<SMESHDS_Hypothesis*>(*hyp2)->SaveTo( hypDump2 );
return hypDump1.str() == hypDump2.str();
}
}
return false;
}
//================================================================================
/*!
* \brief Return base curve of the edge and extremum parameters
*/
//================================================================================
Handle(Geom_Curve) getCurve(const TopoDS_Edge& edge, double* f=0, double* l=0)
{
Handle(Geom_Curve) C;
if ( !edge.IsNull() )
{
double first = 0., last = 0.;
C = BRep_Tool::Curve(edge, first, last);
if ( !C.IsNull() )
{
Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C);
while( !tc.IsNull() ) {
C = tc->BasisCurve();
tc = Handle(Geom_TrimmedCurve)::DownCast(C);
}
if ( f ) *f = first;
if ( l ) *l = last;
}
}
return C;
}
//================================================================================
/*!
* \brief Return edges of the face
* \retval int - nb of edges
*/
//================================================================================
int analyseFace(const TopoDS_Shape& face,
TopoDS_Edge& CircEdge,
TopoDS_Edge& LinEdge1,
TopoDS_Edge& LinEdge2)
{
CircEdge.Nullify(); LinEdge1.Nullify(); LinEdge2.Nullify();
int nbe = 0;
for ( TopExp_Explorer exp( face, TopAbs_EDGE ); exp.More(); exp.Next(), ++nbe )
{
const TopoDS_Edge& E = TopoDS::Edge( exp.Current() );
double f,l;
Handle(Geom_Curve) C = getCurve(E,&f,&l);
if ( !C.IsNull() )
{
if ( C->IsKind( STANDARD_TYPE(Geom_Circle)))
{
if ( CircEdge.IsNull() )
CircEdge = E;
else
return 0;
}
else if ( LinEdge1.IsNull() )
LinEdge1 = E;
else
LinEdge2 = E;
}
}
return nbe;
}
}
//=======================================================================
/*!
* \brief Allow algo to do something after persistent restoration
* \param subMesh - restored submesh
*
* call markLinEdgeAsComputedByMe()
*/
//=======================================================================
void StdMeshers_RadialQuadrangle_1D2D::SubmeshRestored(SMESH_subMesh* faceSubMesh)
{
if ( !faceSubMesh->IsEmpty() )
{
TopoDS_Edge CircEdge, LinEdge1, LinEdge2;
analyseFace( faceSubMesh->GetSubShape(), CircEdge, LinEdge1, LinEdge2 );
if ( !LinEdge1.IsNull() ) markLinEdgeAsComputedByMe( LinEdge1, faceSubMesh );
if ( !LinEdge2.IsNull() ) markLinEdgeAsComputedByMe( LinEdge2, faceSubMesh );
}
}
//======================================================================= //=======================================================================
//function : Compute //function : Compute
@ -162,31 +308,14 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
myHelper = new SMESH_MesherHelper( aMesh ); myHelper = new SMESH_MesherHelper( aMesh );
myHelper->IsQuadraticSubMesh( aShape ); myHelper->IsQuadraticSubMesh( aShape );
// to delete helper at exit from Compute()
auto_ptr<SMESH_MesherHelper> helperDeleter( myHelper );
myLayerPositions.clear(); myLayerPositions.clear();
TopoDS_Edge E1,E2,E3; TopoDS_Edge CircEdge, LinEdge1, LinEdge2;
Handle(Geom_Curve) C1,C2,C3; int nbe = analyseFace( aShape, CircEdge, LinEdge1, LinEdge2 );
double f1,l1,f2,l2,f3,l3; if( nbe>3 || nbe < 1 || CircEdge.IsNull() )
int nbe = 0;
for ( exp.Init( aShape, TopAbs_EDGE ); exp.More(); exp.Next() ) {
nbe++;
TopoDS_Edge E = TopoDS::Edge( exp.Current() );
if(nbe==1) {
E1 = E;
C1 = BRep_Tool::Curve(E,f1,l1);
}
else if(nbe==2) {
E2 = E;
C2 = BRep_Tool::Curve(E,f2,l2);
}
else if(nbe==3) {
E3 = E;
C3 = BRep_Tool::Curve(E,f3,l3);
}
}
if(nbe>3)
return error(COMPERR_BAD_SHAPE); return error(COMPERR_BAD_SHAPE);
gp_Pnt P0,P1; gp_Pnt P0,P1;
@ -196,36 +325,28 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
TColStd_SequenceOfReal Angles; TColStd_SequenceOfReal Angles;
// Nodes1 and Nodes2 - nodes along radiuses // Nodes1 and Nodes2 - nodes along radiuses
// CNodes - nodes on circle edge // CNodes - nodes on circle edge
std::vector< const SMDS_MeshNode* > Nodes1, Nodes2, CNodes; vector< const SMDS_MeshNode* > Nodes1, Nodes2, CNodes;
SMDS_MeshNode * NC; SMDS_MeshNode * NC;
// parameters edge nodes on face // parameters edge nodes on face
TColgp_SequenceOfPnt2d Pnts2d1, Pnts2d2; TColgp_SequenceOfPnt2d Pnts2d1;
gp_Pnt2d PC; gp_Pnt2d PC;
int faceID = meshDS->ShapeToIndex(aShape); int faceID = meshDS->ShapeToIndex(aShape);
TopoDS_Face F = TopoDS::Face(aShape); TopoDS_Face F = TopoDS::Face(aShape);
Handle(Geom_Surface) S = BRep_Tool::Surface(F); Handle(Geom_Surface) S = BRep_Tool::Surface(F);
// orientation if(nbe==1)
bool IsForward = F.Orientation()==TopAbs_FORWARD; {
Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge ));
//cout<<"RadialQuadrangle_1D2D::Compute nbe = "<<nbe<<endl; bool ok = _gen->Compute( aMesh, CircEdge );
TopoDS_Edge CircEdge, LinEdge1, LinEdge2;
if(nbe==1) {
// C1 must be a circle
Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1);
if( aCirc.IsNull() )
return error(COMPERR_BAD_SHAPE);
CircEdge = E1;
bool ok = _gen->Compute( aMesh, CircEdge, false, MeshDim_1D );
if( !ok ) return false; if( !ok ) return false;
std::map< double, const SMDS_MeshNode* > theNodes; map< double, const SMDS_MeshNode* > theNodes;
ok = GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); ok = GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes);
if( !ok ) return false; if( !ok ) return false;
CNodes.clear(); CNodes.clear();
std::map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin();
const SMDS_MeshNode* NF = (*itn).second; const SMDS_MeshNode* NF = (*itn).second;
CNodes.push_back( (*itn).second ); CNodes.push_back( (*itn).second );
double fang = (*itn).first; double fang = (*itn).first;
@ -273,88 +394,53 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
double V = PC.Y() + aVec2d.Y()*myLayerPositions[i]; double V = PC.Y() + aVec2d.Y()*myLayerPositions[i];
meshDS->SetNodeOnFace( node, faceID, U, V ); meshDS->SetNodeOnFace( node, faceID, U, V );
Pnts2d1.Append(gp_Pnt2d(U,V)); Pnts2d1.Append(gp_Pnt2d(U,V));
Pnts2d2.Append(gp_Pnt2d(U,V));
} }
Nodes1[Nodes1.size()-1] = NF; Nodes1[Nodes1.size()-1] = NF;
Nodes2[Nodes1.size()-1] = NF; Nodes2[Nodes1.size()-1] = NF;
} }
else if(nbe==2) { else if(nbe==2 && LinEdge1.Orientation() != TopAbs_INTERNAL )
{
// one curve must be a half of circle and other curve must be // one curve must be a half of circle and other curve must be
// a segment of line // a segment of line
Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1); double fp, lp;
while( !tc.IsNull() ) { Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge, &fp, &lp ));
C1 = tc->BasisCurve();
tc = Handle(Geom_TrimmedCurve)::DownCast(C1);
}
tc = Handle(Geom_TrimmedCurve)::DownCast(C2);
while( !tc.IsNull() ) {
C2 = tc->BasisCurve();
tc = Handle(Geom_TrimmedCurve)::DownCast(C2);
}
Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1);
Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(C2);
CircEdge = E1;
LinEdge1 = E2;
double fp = f1;
double lp = l1;
if( aCirc.IsNull() ) {
aCirc = Handle(Geom_Circle)::DownCast(C2);
CircEdge = E2;
LinEdge1 = E1;
fp = f2;
lp = l2;
aLine = Handle(Geom_Line)::DownCast(C3);
}
if( aCirc.IsNull() ) {
// not circle
return error(COMPERR_BAD_SHAPE);
}
if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) { if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) {
// not half of circle // not half of circle
return error(COMPERR_BAD_SHAPE); return error(COMPERR_BAD_SHAPE);
} }
Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 ));
if( aLine.IsNull() ) { if( aLine.IsNull() ) {
// other curve not line // other curve not line
return error(COMPERR_BAD_SHAPE); return error(COMPERR_BAD_SHAPE);
} }
SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1); bool linEdgeComputed = false;
if( sm1 ) { if( SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1) ) {
SMESHDS_SubMesh* sdssm1 = sm1->GetSubMeshDS(); if( !sm1->IsEmpty() )
if( sdssm1 ) { if( isEdgeCompitaballyMeshed( LinEdge1, aMesh.GetSubMesh(F) ))
if( sm1->GetSubMeshDS()->NbNodes()>0 ) { linEdgeComputed = true;
SMESH_subMesh* sm = aMesh.GetSubMesh(F); else
SMESH_ComputeErrorPtr& smError = sm->GetComputeError(); return error("Invalid set of hypotheses");
smError.reset(new SMESH_ComputeError(COMPERR_ALGO_FAILED,
"Invalid set of hypothesises",this));
return false;
}
}
} }
bool ok = _gen->Compute( aMesh, CircEdge, false, MeshDim_1D ); bool ok = _gen->Compute( aMesh, CircEdge );
if( !ok ) return false; if( !ok ) return false;
std::map< double, const SMDS_MeshNode* > theNodes; map< double, const SMDS_MeshNode* > theNodes;
GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes);
CNodes.clear(); CNodes.clear();
std::map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin();
const SMDS_MeshNode* NF = (*itn).second;
CNodes.push_back( (*itn).second );
double fang = (*itn).first; double fang = (*itn).first;
itn++; itn++;
const SMDS_MeshNode* NL;
int nbn = 1;
for(; itn != theNodes.end(); itn++ ) { for(; itn != theNodes.end(); itn++ ) {
nbn++;
if( nbn == theNodes.size() )
NL = (*itn).second;
CNodes.push_back( (*itn).second ); CNodes.push_back( (*itn).second );
double ang = (*itn).first - fang; double ang = (*itn).first - fang;
if( ang>PI ) ang = ang - 2*PI; if( ang>PI ) ang = ang - 2*PI;
if( ang<-PI ) ang = ang + 2*PI; if( ang<-PI ) ang = ang + 2*PI;
Angles.Append( ang ); Angles.Append( ang );
} }
const SMDS_MeshNode* NF = theNodes.begin()->second;
const SMDS_MeshNode* NL = theNodes.rbegin()->second;
CNodes.push_back( NF );
P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() ); P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() );
gp_Pnt P2( NL->X(), NL->Y(), NL->Z() ); gp_Pnt P2( NL->X(), NL->Y(), NL->Z() );
P0 = aCirc->Location(); P0 = aCirc->Location();
@ -362,6 +448,29 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
myLayerPositions.clear(); myLayerPositions.clear();
computeLayerPositions(P0,P1); computeLayerPositions(P0,P1);
if ( linEdgeComputed )
{
if (!GetSortedNodesOnEdge(aMesh.GetMeshDS(),LinEdge1,true,theNodes))
return error("Invalid mesh on a straight edge");
vector< const SMDS_MeshNode* > *pNodes1 = &Nodes1, *pNodes2 = &Nodes2;
bool nodesFromP0ToP1 = ( theNodes.rbegin()->second == NF );
if ( !nodesFromP0ToP1 ) std::swap( pNodes1, pNodes2 );
map< double, const SMDS_MeshNode* >::reverse_iterator ritn = theNodes.rbegin();
itn = theNodes.begin();
for ( int i = Nodes1.size()-1; i > -1; ++itn, ++ritn, --i )
{
(*pNodes1)[i] = ritn->second;
(*pNodes2)[i] = itn->second;
Points.Append( gpXYZ( Nodes1[i]));
Pnts2d1.Append( myHelper->GetNodeUV( F, Nodes1[i]));
}
NC = const_cast<SMDS_MeshNode*>( itn->second );
Points.Remove( Nodes1.size() );
}
else
{
gp_Vec aVec(P0,P1); gp_Vec aVec(P0,P1);
int edgeID = meshDS->ShapeToIndex(LinEdge1); int edgeID = meshDS->ShapeToIndex(LinEdge1);
// check orientation // check orientation
@ -413,14 +522,11 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i],
PC.Y() + V2d.Y()*myLayerPositions[i] ); PC.Y() + V2d.Y()*myLayerPositions[i] );
Pnts2d1.Append(P2d); Pnts2d1.Append(P2d);
P2d = gp_Pnt2d( PC.X() - V2d.X()*myLayerPositions[i],
PC.Y() - V2d.Y()*myLayerPositions[i] );
Pnts2d2.Append(P2d);
} }
Nodes1[ myLayerPositions.size() ] = NF; Nodes1[ myLayerPositions.size() ] = NF;
Nodes2[ myLayerPositions.size() ] = NL; Nodes2[ myLayerPositions.size() ] = NL;
// create 1D elements on edge // create 1D elements on edge
std::vector< const SMDS_MeshNode* > tmpNodes; vector< const SMDS_MeshNode* > tmpNodes;
tmpNodes.resize(2*Nodes1.size()+1); tmpNodes.resize(2*Nodes1.size()+1);
for(i=0; i<Nodes2.size(); i++) for(i=0; i<Nodes2.size(); i++)
tmpNodes[Nodes2.size()-i-1] = Nodes2[i]; tmpNodes[Nodes2.size()-i-1] = Nodes2[i];
@ -431,95 +537,54 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
SMDS_MeshEdge* ME = myHelper->AddEdge( tmpNodes[i-1], tmpNodes[i] ); SMDS_MeshEdge* ME = myHelper->AddEdge( tmpNodes[i-1], tmpNodes[i] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
} }
markLinEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F ));
} }
else { // nbe==3 }
else // nbe==3 or ( nbe==2 && linEdge is INTERNAL )
{
if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL )
LinEdge2 = LinEdge1;
// one curve must be a part of circle and other curves must be // one curve must be a part of circle and other curves must be
// segments of line // segments of line
Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1); double fp, lp;
while( !tc.IsNull() ) { Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge ));
C1 = tc->BasisCurve(); Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 ));
tc = Handle(Geom_TrimmedCurve)::DownCast(C1); Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast( getCurve( LinEdge2 ));
}
tc = Handle(Geom_TrimmedCurve)::DownCast(C2);
while( !tc.IsNull() ) {
C2 = tc->BasisCurve();
tc = Handle(Geom_TrimmedCurve)::DownCast(C2);
}
tc = Handle(Geom_TrimmedCurve)::DownCast(C3);
while( !tc.IsNull() ) {
C3 = tc->BasisCurve();
tc = Handle(Geom_TrimmedCurve)::DownCast(C3);
}
Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1);
Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast(C2);
Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast(C3);
CircEdge = E1;
LinEdge1 = E2;
LinEdge2 = E3;
double fp = f1;
double lp = l1;
if( aCirc.IsNull() ) {
aCirc = Handle(Geom_Circle)::DownCast(C2);
CircEdge = E2;
LinEdge1 = E3;
LinEdge2 = E1;
fp = f2;
lp = l2;
aLine1 = Handle(Geom_Line)::DownCast(C3);
aLine2 = Handle(Geom_Line)::DownCast(C1);
if( aCirc.IsNull() ) {
aCirc = Handle(Geom_Circle)::DownCast(C3);
CircEdge = E3;
LinEdge1 = E1;
LinEdge2 = E2;
fp = f3;
lp = l3;
aLine1 = Handle(Geom_Line)::DownCast(C1);
aLine2 = Handle(Geom_Line)::DownCast(C2);
}
}
if( aCirc.IsNull() ) {
// not circle
return error(COMPERR_BAD_SHAPE);
}
if( aLine1.IsNull() || aLine2.IsNull() ) { if( aLine1.IsNull() || aLine2.IsNull() ) {
// other curve not line // other curve not line
return error(COMPERR_BAD_SHAPE); return error(COMPERR_BAD_SHAPE);
} }
SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1);
SMESH_subMesh* sm2 = aMesh.GetSubMesh(LinEdge2);
if( sm1 && sm2 ) {
SMESHDS_SubMesh* sdssm1 = sm1->GetSubMeshDS();
SMESHDS_SubMesh* sdssm2 = sm2->GetSubMeshDS();
if( sdssm1 && sdssm2 ) {
if( sm1->GetSubMeshDS()->NbNodes()>0 || sm2->GetSubMeshDS()->NbNodes()>0 ) {
SMESH_subMesh* sm = aMesh.GetSubMesh(F);
SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
smError.reset(new SMESH_ComputeError(COMPERR_ALGO_FAILED,
"Invalid set of hypothesises",this));
return false;
}
}
}
bool ok = _gen->Compute( aMesh, CircEdge, false, MeshDim_1D ); bool linEdge1Computed = false;
if ( SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1))
if( !sm1->IsEmpty() )
if( isEdgeCompitaballyMeshed( LinEdge1, aMesh.GetSubMesh(F) ))
linEdge1Computed = true;
else
return error("Invalid set of hypotheses");
bool linEdge2Computed = false;
if ( SMESH_subMesh* sm2 = aMesh.GetSubMesh(LinEdge2))
if( !sm2->IsEmpty() )
if( isEdgeCompitaballyMeshed( LinEdge2, aMesh.GetSubMesh(F) ))
linEdge2Computed = true;
else
return error("Invalid set of hypotheses");
bool ok = _gen->Compute( aMesh, CircEdge );
if( !ok ) return false; if( !ok ) return false;
std::map< double, const SMDS_MeshNode* > theNodes; map< double, const SMDS_MeshNode* > theNodes;
GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes);
const SMDS_MeshNode* NF = theNodes.begin()->second;
const SMDS_MeshNode* NL = theNodes.rbegin()->second;
CNodes.clear(); CNodes.clear();
std::map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); CNodes.push_back( NF );
const SMDS_MeshNode* NF = (*itn).second; map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin();
CNodes.push_back( (*itn).second );
double fang = (*itn).first; double fang = (*itn).first;
itn++; itn++;
const SMDS_MeshNode* NL;
int nbn = 1;
for(; itn != theNodes.end(); itn++ ) { for(; itn != theNodes.end(); itn++ ) {
nbn++;
if( nbn == theNodes.size() )
NL = (*itn).second;
CNodes.push_back( (*itn).second ); CNodes.push_back( (*itn).second );
double ang = (*itn).first - fang; double ang = (*itn).first - fang;
if( ang>PI ) ang = ang - 2*PI; if( ang>PI ) ang = ang - 2*PI;
@ -533,6 +598,9 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
myLayerPositions.clear(); myLayerPositions.clear();
computeLayerPositions(P0,P1); computeLayerPositions(P0,P1);
Nodes1.resize( myLayerPositions.size()+1 );
Nodes2.resize( myLayerPositions.size()+1 );
exp.Init( LinEdge1, TopAbs_VERTEX ); exp.Init( LinEdge1, TopAbs_VERTEX );
TopoDS_Vertex V1 = TopoDS::Vertex( exp.Current() ); TopoDS_Vertex V1 = TopoDS::Vertex( exp.Current() );
exp.Next(); exp.Next();
@ -540,25 +608,47 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
gp_Pnt PE1 = BRep_Tool::Pnt(V1); gp_Pnt PE1 = BRep_Tool::Pnt(V1);
gp_Pnt PE2 = BRep_Tool::Pnt(V2); gp_Pnt PE2 = BRep_Tool::Pnt(V2);
if( ( P1.Distance(PE1) > Precision::Confusion() ) && if( ( P1.Distance(PE1) > Precision::Confusion() ) &&
( P1.Distance(PE2) > Precision::Confusion() ) ) { ( P1.Distance(PE2) > Precision::Confusion() ) )
TopoDS_Edge E = LinEdge1; {
LinEdge1 = LinEdge2; std::swap( LinEdge1, LinEdge2 );
LinEdge2 = E; std::swap( linEdge1Computed, linEdge2Computed );
} }
TopoDS_Vertex VC; TopoDS_Vertex VC = V2;
if( ( P1.Distance(PE1) > Precision::Confusion() ) && if( ( P1.Distance(PE1) > Precision::Confusion() ) &&
( P2.Distance(PE1) > Precision::Confusion() ) ) { ( P2.Distance(PE1) > Precision::Confusion() ) )
VC = V1; VC = V1;
}
else VC = V2;
int vertID = meshDS->ShapeToIndex(VC); int vertID = meshDS->ShapeToIndex(VC);
// LinEdge1 // LinEdge1
if ( linEdge1Computed )
{
if (!GetSortedNodesOnEdge(aMesh.GetMeshDS(),LinEdge1,true,theNodes))
return error("Invalid mesh on a straight edge");
bool nodesFromP0ToP1 = ( theNodes.rbegin()->second == NF );
NC = const_cast<SMDS_MeshNode*>
( nodesFromP0ToP1 ? theNodes.begin()->second : theNodes.rbegin()->second );
int i = 0, ir = Nodes1.size()-1;
int * pi = nodesFromP0ToP1 ? &i : &ir;
itn = theNodes.begin();
if ( nodesFromP0ToP1 ) ++itn;
for ( ; i < Nodes1.size(); ++i, --ir, ++itn )
{
Nodes1[*pi] = itn->second;
}
for ( i = 0; i < Nodes1.size()-1; ++i )
{
Points.Append( gpXYZ( Nodes1[i]));
Pnts2d1.Append( myHelper->GetNodeUV( F, Nodes1[i]));
}
}
else
{
int edgeID = meshDS->ShapeToIndex(LinEdge1); int edgeID = meshDS->ShapeToIndex(LinEdge1);
gp_Vec aVec(P0,P1); gp_Vec aVec(P0,P1);
// check orientation // check orientation
Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp); Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp);
gp_Pnt Ptmp; gp_Pnt Ptmp = Crv->Value(fp);
Crv->D0(fp,Ptmp);
bool ori = false; bool ori = false;
if( P1.Distance(Ptmp) > Precision::Confusion() ) if( P1.Distance(Ptmp) > Precision::Confusion() )
ori = true; ori = true;
@ -574,10 +664,13 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
V2d = gp_Vec2d(PL,PF); V2d = gp_Vec2d(PL,PF);
PC = PL; PC = PL;
} }
NC = const_cast<SMDS_MeshNode*>( VertexNode( VC, meshDS ));
if ( !NC )
{
NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z()); NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z());
meshDS->SetNodeOnVertex(NC, vertID); meshDS->SetNodeOnVertex(NC, vertID);
}
double dp = lp-fp; double dp = lp-fp;
Nodes1.resize( myLayerPositions.size()+1 );
int i = 0; int i = 0;
for(; i<myLayerPositions.size(); i++) { for(; i<myLayerPositions.size(); i++) {
gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i], gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
@ -602,20 +695,42 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes1[0] ); SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes1[0] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
for(i=1; i<Nodes1.size(); i++) { for(i=1; i<Nodes1.size(); i++) {
SMDS_MeshEdge* ME = myHelper->AddEdge( Nodes1[i-1], Nodes1[i] ); ME = myHelper->AddEdge( Nodes1[i-1], Nodes1[i] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
} }
if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL )
Nodes2 = Nodes1;
}
markLinEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F ));
// LinEdge2 // LinEdge2
edgeID = meshDS->ShapeToIndex(LinEdge2); if ( linEdge2Computed )
aVec = gp_Vec(P0,P2); {
if (!GetSortedNodesOnEdge(aMesh.GetMeshDS(),LinEdge2,true,theNodes))
return error("Invalid mesh on a straight edge");
bool nodesFromP0ToP2 = ( theNodes.rbegin()->second == NL );
int i = 0, ir = Nodes1.size()-1;
int * pi = nodesFromP0ToP2 ? &i : &ir;
itn = theNodes.begin();
if ( nodesFromP0ToP2 ) ++itn;
for ( ; i < Nodes2.size(); ++i, --ir, ++itn )
Nodes2[*pi] = itn->second;
}
else
{
int edgeID = meshDS->ShapeToIndex(LinEdge2);
gp_Vec aVec = gp_Vec(P0,P2);
// check orientation // check orientation
Crv = BRep_Tool::Curve(LinEdge2,fp,lp); Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge2,fp,lp);
Crv->D0(fp,Ptmp); gp_Pnt Ptmp = Crv->Value(fp);
ori = false; bool ori = false;
if( P2.Distance(Ptmp) > Precision::Confusion() ) if( P2.Distance(Ptmp) > Precision::Confusion() )
ori = true; ori = true;
// get UV points for edge // get UV points for edge
gp_Pnt2d PF,PL;
BRep_Tool::UVPoints( LinEdge2, TopoDS::Face(aShape), PF, PL ); BRep_Tool::UVPoints( LinEdge2, TopoDS::Face(aShape), PF, PL );
gp_Vec2d V2d;
if(ori) { if(ori) {
V2d = gp_Vec2d(PF,PL); V2d = gp_Vec2d(PF,PL);
PC = PF; PC = PF;
@ -624,9 +739,8 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
V2d = gp_Vec2d(PL,PF); V2d = gp_Vec2d(PL,PF);
PC = PL; PC = PL;
} }
dp = lp-fp; double dp = lp-fp;
Nodes2.resize( myLayerPositions.size()+1 ); for(int i=0; i<myLayerPositions.size(); i++) {
for(i=0; i<myLayerPositions.size(); i++) {
gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i], gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
P0.Y() + aVec.Y()*myLayerPositions[i], P0.Y() + aVec.Y()*myLayerPositions[i],
P0.Z() + aVec.Z()*myLayerPositions[i] ); P0.Z() + aVec.Z()*myLayerPositions[i] );
@ -641,17 +755,21 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
// parameters on face // parameters on face
gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i],
PC.Y() + V2d.Y()*myLayerPositions[i] ); PC.Y() + V2d.Y()*myLayerPositions[i] );
Pnts2d2.Append(P2d);
} }
Nodes2[ myLayerPositions.size() ] = NL; Nodes2[ myLayerPositions.size() ] = NL;
// create 1D elements on edge // create 1D elements on edge
ME = myHelper->AddEdge( NC, Nodes2[0] ); SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes2[0] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
for(i=1; i<Nodes2.size(); i++) { for(int i=1; i<Nodes2.size(); i++) {
SMDS_MeshEdge* ME = myHelper->AddEdge( Nodes2[i-1], Nodes2[i] ); ME = myHelper->AddEdge( Nodes2[i-1], Nodes2[i] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
} }
} }
markLinEdgeAsComputedByMe( LinEdge2, aMesh.GetSubMesh( F ));
}
// orientation
bool IsForward = ( CircEdge.Orientation()==TopAbs_FORWARD );
// create nodes and mesh elements on face // create nodes and mesh elements on face
// find axis of rotation // find axis of rotation
@ -664,7 +782,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
//cout<<"Angles.Length() = "<<Angles.Length()<<" Points.Length() = "<<Points.Length()<<endl; //cout<<"Angles.Length() = "<<Angles.Length()<<" Points.Length() = "<<Points.Length()<<endl;
//cout<<"Nodes1.size() = "<<Nodes1.size()<<" Pnts2d1.Length() = "<<Pnts2d1.Length()<<endl; //cout<<"Nodes1.size() = "<<Nodes1.size()<<" Pnts2d1.Length() = "<<Pnts2d1.Length()<<endl;
for(; i<Angles.Length(); i++) { for(; i<Angles.Length(); i++) {
std::vector< const SMDS_MeshNode* > tmpNodes; vector< const SMDS_MeshNode* > tmpNodes;
tmpNodes.reserve(Nodes1.size()); tmpNodes.reserve(Nodes1.size());
gp_Trsf aTrsf; gp_Trsf aTrsf;
gp_Ax1 theAxis(P0,gp_Dir(Axis)); gp_Ax1 theAxis(P0,gp_Dir(Axis));
@ -729,10 +847,6 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
MF = myHelper->AddFace( NC, Nodes2[0], Nodes1[0] ); MF = myHelper->AddFace( NC, Nodes2[0], Nodes1[0] );
if(MF) meshDS->SetMeshElementOnShape(MF, faceID); if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
// to delete helper at exit from Compute()
std::auto_ptr<SMESH_MesherHelper> helperDeleter( myHelper );
return true; return true;
} }
@ -895,7 +1009,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh,
if(ok) { if(ok) {
SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge); SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge);
MapShapeNbElemsItr anIt = aResMap.find(sm); MapShapeNbElemsItr anIt = aResMap.find(sm);
std::vector<int> aVec = (*anIt).second; vector<int> aVec = (*anIt).second;
isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge];
if(isQuadratic) { if(isQuadratic) {
// main nodes // main nodes
@ -956,7 +1070,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh,
if(ok) { if(ok) {
SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge); SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge);
MapShapeNbElemsItr anIt = aResMap.find(sm); MapShapeNbElemsItr anIt = aResMap.find(sm);
std::vector<int> aVec = (*anIt).second; vector<int> aVec = (*anIt).second;
isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge];
if(isQuadratic) { if(isQuadratic) {
// main nodes // main nodes
@ -972,7 +1086,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh,
nb2d_tria = aVec[SMDSEntity_Node] + 1; nb2d_tria = aVec[SMDSEntity_Node] + 1;
nb2d_quad = nb2d_tria * myLayerPositions.size(); nb2d_quad = nb2d_tria * myLayerPositions.size();
// add evaluation for edges // add evaluation for edges
std::vector<int> aResVec(SMDSEntity_Last); vector<int> aResVec(SMDSEntity_Last);
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0; for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
if(isQuadratic) { if(isQuadratic) {
aResVec[SMDSEntity_Node] = 4*myLayerPositions.size() + 3; aResVec[SMDSEntity_Node] = 4*myLayerPositions.size() + 3;
@ -983,7 +1097,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh,
aResVec[SMDSEntity_Edge] = 2*myLayerPositions.size() + 2; aResVec[SMDSEntity_Edge] = 2*myLayerPositions.size() + 2;
} }
sm = aMesh.GetSubMesh(LinEdge1); sm = aMesh.GetSubMesh(LinEdge1);
aResMap.insert(std::make_pair(sm,aResVec)); aResMap.insert(make_pair(sm,aResVec));
} }
} }
else { // nbe==3 else { // nbe==3
@ -1049,7 +1163,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh,
if(ok) { if(ok) {
SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge); SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge);
MapShapeNbElemsItr anIt = aResMap.find(sm); MapShapeNbElemsItr anIt = aResMap.find(sm);
std::vector<int> aVec = (*anIt).second; vector<int> aVec = (*anIt).second;
isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge];
if(isQuadratic) { if(isQuadratic) {
// main nodes // main nodes
@ -1065,7 +1179,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh,
nb2d_tria = aVec[SMDSEntity_Node] + 1; nb2d_tria = aVec[SMDSEntity_Node] + 1;
nb2d_quad = nb2d_tria * myLayerPositions.size(); nb2d_quad = nb2d_tria * myLayerPositions.size();
// add evaluation for edges // add evaluation for edges
std::vector<int> aResVec(SMDSEntity_Last); vector<int> aResVec(SMDSEntity_Last);
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0; for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
if(isQuadratic) { if(isQuadratic) {
aResVec[SMDSEntity_Node] = 2*myLayerPositions.size() + 1; aResVec[SMDSEntity_Node] = 2*myLayerPositions.size() + 1;
@ -1076,13 +1190,13 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh,
aResVec[SMDSEntity_Edge] = myLayerPositions.size() + 1; aResVec[SMDSEntity_Edge] = myLayerPositions.size() + 1;
} }
sm = aMesh.GetSubMesh(LinEdge1); sm = aMesh.GetSubMesh(LinEdge1);
aResMap.insert(std::make_pair(sm,aResVec)); aResMap.insert(make_pair(sm,aResVec));
sm = aMesh.GetSubMesh(LinEdge2); sm = aMesh.GetSubMesh(LinEdge2);
aResMap.insert(std::make_pair(sm,aResVec)); aResMap.insert(make_pair(sm,aResVec));
} }
} }
std::vector<int> aResVec(SMDSEntity_Last); vector<int> aResVec(SMDSEntity_Last);
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0; for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
SMESH_subMesh * sm = aMesh.GetSubMesh(aShape); SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
@ -1097,12 +1211,12 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh,
aResVec[SMDSEntity_Triangle] = nb2d_tria; aResVec[SMDSEntity_Triangle] = nb2d_tria;
aResVec[SMDSEntity_Quadrangle] = nb2d_quad; aResVec[SMDSEntity_Quadrangle] = nb2d_quad;
} }
aResMap.insert(std::make_pair(sm,aResVec)); aResMap.insert(make_pair(sm,aResVec));
return true; return true;
} }
// invalid case // invalid case
aResMap.insert(std::make_pair(sm,aResVec)); aResMap.insert(make_pair(sm,aResVec));
SMESH_ComputeErrorPtr& smError = sm->GetComputeError(); SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED, smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,
"Submesh can not be evaluated",this)); "Submesh can not be evaluated",this));

View File

@ -53,6 +53,13 @@ public:
virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap); MapShapeNbElems& aResMap);
/*!
* \brief Allow algo to do something after persistent restoration
* \param subMesh - restored submesh
*
* This method is called only if a submesh has HYP_OK algo_state.
*/
virtual void SubmeshRestored(SMESH_subMesh* subMesh);
protected: protected:

View File

@ -63,6 +63,7 @@
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <string> #include <string>
#include <limits>
using namespace std; using namespace std;
@ -757,7 +758,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
double an = _value[ END_LENGTH_IND ]; double an = _value[ END_LENGTH_IND ];
double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 ); double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 );
int n = int( 1 + ( an - a1 ) / q ); int n = int(fabs(q) > numeric_limits<double>::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 ));
double U1 = theReverse ? l : f; double U1 = theReverse ? l : f;
double Un = theReverse ? f : l; double Un = theReverse ? f : l;
@ -1032,7 +1033,7 @@ bool StdMeshers_Regular_1D::Evaluate(SMESH_Mesh & theMesh,
if ( _hypType == NONE ) if ( _hypType == NONE )
return false; return false;
SMESHDS_Mesh * meshDS = theMesh.GetMeshDS(); //SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
const TopoDS_Edge & EE = TopoDS::Edge(theShape); const TopoDS_Edge & EE = TopoDS::Edge(theShape);
TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD)); TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));

View File

@ -96,8 +96,7 @@ libStdMeshersGUI_la_LDFLAGS = \
../SMESHGUI/libSMESH.la \ ../SMESHGUI/libSMESH.la \
../OBJECT/libSMESHObject.la \ ../OBJECT/libSMESHObject.la \
$(GUI_LDFLAGS) -lSalomeApp \ $(GUI_LDFLAGS) -lSalomeApp \
$(CAS_LDPATH) -lTKernel -lTKBO -lTKAdvTools \ $(CAS_LDPATH) -lTKernel -lTKBO -lTKAdvTools
$(QWT_LIBS)
# resources files # resources files
nodist_salomeres_DATA= \ nodist_salomeres_DATA= \

View File

@ -50,6 +50,8 @@
# include <algorithm> # include <algorithm>
#endif #endif
#include <Basics_Utils.hxx>
StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::StdMeshers_NumberOfSegments_ptr h ) StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::StdMeshers_NumberOfSegments_ptr h )
: QwtPlot( p ), : QwtPlot( p ),
myPoints( 50 ), myPoints( 50 ),
@ -60,6 +62,7 @@ StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::
myIsDone( true ), myIsDone( true ),
myNbSeg( 1 ) myNbSeg( 1 )
{ {
Kernel_Utils::Localizer loc;
myHypo = StdMeshers::StdMeshers_NumberOfSegments::_duplicate( h ); myHypo = StdMeshers::StdMeshers_NumberOfSegments::_duplicate( h );
myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" ); myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" );
myDensity = new QwtPlotCurve( QString() ); myDensity = new QwtPlotCurve( QString() );
@ -200,6 +203,7 @@ bool StdMeshersGUI_DistrPreview::createTable( SMESH::double_array& func )
void StdMeshersGUI_DistrPreview::update() void StdMeshersGUI_DistrPreview::update()
{ {
Kernel_Utils::Localizer loc;
SMESH::double_array graph, distr; SMESH::double_array graph, distr;
if( isTableFunc() ) if( isTableFunc() )
{ {
@ -343,6 +347,7 @@ bool isCorrectArg( const Handle( Expr_GeneralExpression )& expr )
bool StdMeshersGUI_DistrPreview::init( const QString& str ) bool StdMeshersGUI_DistrPreview::init( const QString& str )
{ {
Kernel_Utils::Localizer loc;
bool parsed_ok = true; bool parsed_ok = true;
try { try {
#ifdef NO_CAS_CATCH #ifdef NO_CAS_CATCH

View File

@ -384,6 +384,12 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 ); widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
ok = ( w && w->IsOk() ); ok = ( w && w->IsOk() );
} }
else if ( hypType() == "QuadrangleParams" )
{
StdMeshersGUI_SubShapeSelectorWdg* w =
widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
ok = ( w->GetListSize() > 0 );
}
return ok; return ok;
} }
@ -604,14 +610,14 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
StdMeshersGUI_SubShapeSelectorWdg* w = StdMeshersGUI_SubShapeSelectorWdg* w =
widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 ); widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
if (w) { if (w) {
if( int id = w->GetListOfIDs()[0] ) { if( w->GetListSize() > 0 ) {
h->SetTriaVertex( id ); h->SetTriaVertex( w->GetListOfIDs()[0] ); // getlist must be called once
}
const char * entry = w->GetMainShapeEntry(); const char * entry = w->GetMainShapeEntry();
h->SetObjectEntry( entry ); h->SetObjectEntry( entry );
} }
} }
} }
}
return valueStr; return valueStr;
} }
@ -1122,7 +1128,7 @@ QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) cons
types.insert( "ProjectionSource3D", "PROJECTION_SOURCE_3D" ); types.insert( "ProjectionSource3D", "PROJECTION_SOURCE_3D" );
types.insert( "NumberOfLayers", "NUMBER_OF_LAYERS" ); types.insert( "NumberOfLayers", "NUMBER_OF_LAYERS" );
types.insert( "LayerDistribution", "LAYER_DISTRIBUTION" ); types.insert( "LayerDistribution", "LAYER_DISTRIBUTION" );
types.insert( "NumberOfLayers2D", "NUMBER_OF_LAYERS" ); types.insert( "NumberOfLayers2D", "NUMBER_OF_LAYERS_2D" );
types.insert( "LayerDistribution2D", "LAYER_DISTRIBUTION" ); types.insert( "LayerDistribution2D", "LAYER_DISTRIBUTION" );
types.insert( "SegmentLengthAroundVertex", "SEGMENT_LENGTH_AROUND_VERTEX" ); types.insert( "SegmentLengthAroundVertex", "SEGMENT_LENGTH_AROUND_VERTEX" );
types.insert( "MaxLength", "MAX_LENGTH" ); types.insert( "MaxLength", "MAX_LENGTH" );

View File

@ -82,7 +82,8 @@
StdMeshersGUI_SubShapeSelectorWdg StdMeshersGUI_SubShapeSelectorWdg
::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ): ::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ):
QWidget( parent ), QWidget( parent ),
myPreviewActor( 0 ) myPreviewActor( 0 ),
myMaxSize( 0 )
{ {
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) ); QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
@ -105,7 +106,6 @@ StdMeshersGUI_SubShapeSelectorWdg
setLayout( edgesLayout ); setLayout( edgesLayout );
setMinimumWidth( 300 ); setMinimumWidth( 300 );
myMaxSize = 1000;
mySubShType = TopAbs_EDGE; mySubShType = TopAbs_EDGE;
init(); init();
@ -270,7 +270,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::onAdd()
return; return;
myListWidget->blockSignals( true ); myListWidget->blockSignals( true );
for (int i = 0; i < mySelectedIDs.size(); i++) { for (int i = 0; i < mySelectedIDs.size() && (myMaxSize < 1 || myListOfIDs.size() < myMaxSize); i++) {
if ( myListOfIDs.indexOf( mySelectedIDs.at(i) ) == -1 ) { if ( myListOfIDs.indexOf( mySelectedIDs.at(i) ) == -1 ) {
QString anID = QString(" %1").arg( mySelectedIDs.at(i) ); QString anID = QString(" %1").arg( mySelectedIDs.at(i) );
@ -281,11 +281,8 @@ void StdMeshersGUI_SubShapeSelectorWdg::onAdd()
} }
} }
onListSelectionChanged(); onListSelectionChanged();
myListWidget->blockSignals( false ); myListWidget->blockSignals( false );
myAddButton->setEnabled( myListOfIDs.size() < myMaxSize );
if( myListOfIDs.size() >= myMaxSize )
myAddButton->setEnabled( false );
} }
//================================================================================= //=================================================================================

View File

@ -77,6 +77,8 @@ public:
void showPreview ( bool ); void showPreview ( bool );
int GetListSize() { return myListOfIDs.size(); }
void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; } void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; }
void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; } void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; }

View File

@ -73,6 +73,10 @@
<source>ICON_DLG_NUMBER_OF_LAYERS</source> <source>ICON_DLG_NUMBER_OF_LAYERS</source>
<translation>mesh_hypo_layer_distribution.png</translation> <translation>mesh_hypo_layer_distribution.png</translation>
</message> </message>
<message>
<source>ICON_DLG_NUMBER_OF_LAYERS_2D</source>
<translation>mesh_hypo_layer_distribution.png</translation>
</message>
<message> <message>
<source>ICON_DLG_PROJECTION_SOURCE_1D</source> <source>ICON_DLG_PROJECTION_SOURCE_1D</source>
<translation>mesh_hypo_source_edge.png</translation> <translation>mesh_hypo_source_edge.png</translation>

View File

@ -221,10 +221,18 @@
<source>SMESH_NUMBER_OF_LAYERS_HYPOTHESIS</source> <source>SMESH_NUMBER_OF_LAYERS_HYPOTHESIS</source>
<translation>Radial Prism Parameter</translation> <translation>Radial Prism Parameter</translation>
</message> </message>
<message>
<source>SMESH_NUMBER_OF_LAYERS_2D_HYPOTHESIS</source>
<translation>Radial Quadrangle Parameter</translation>
</message>
<message> <message>
<source>SMESH_NUMBER_OF_LAYERS_TITLE</source> <source>SMESH_NUMBER_OF_LAYERS_TITLE</source>
<translation>Hypothesis Construction</translation> <translation>Hypothesis Construction</translation>
</message> </message>
<message>
<source>SMESH_NUMBER_OF_LAYERS_2D_TITLE</source>
<translation>Hypothesis Construction</translation>
</message>
<message> <message>
<source>SMESH_PROJECTION_SOURCE_1D_HYPOTHESIS</source> <source>SMESH_PROJECTION_SOURCE_1D_HYPOTHESIS</source>
<translation>Projection Source 1D</translation> <translation>Projection Source 1D</translation>