AC_MSG_RESULT("select $withval as path to QWT includes")
])
+libqwt_name=qwt
if test -z $QWTHOME; then
AC_MSG_RESULT(QWTHOME not defined)
+ AC_MSG_NOTICE(Trying native Qwt...)
exist_ok=no
if test "x$exist_ok" = "xno"; then
- for d in /usr/local /usr ; do
- AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/libqwt.so,exist_ok=yes,exist_ok=no)
+ for d in /usr /usr/local ; do
+ for extension in qwt-qt4 qwt; do
+ AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/lib${extension}.so,exist_ok=yes,exist_ok=no)
+ if test "x$exist_ok" = "xyes"; then
+ QWTHOME=$d
+ AC_MSG_RESULT(lib${extension}.so detected in $d/lib)
+ libqwt_name=${extension}
+ dnl break, libqwt-qt4.so is choosen before libqwt.so since it is surely the Qt4 version.
+ break
+ fi
+ done
if test "x$exist_ok" = "xyes"; then
- QWTHOME=$d
- AC_MSG_RESULT(libqwt.so detected in $d/lib)
+ break
fi
done
fi
fi
if test "x$exist_ok" = "xyes"; then
if test -z $QWT_INCDIR; then
- QWT_INCDIR=$QWTHOME"/include/qwt"
+ QWT_INCDIR=$QWTHOME"/include/qwt-qt4"
+ if test ! -f $QWT_INCDIR/qwt.h ; then
+ QWT_INCDIR=/usr/include/qwt
+ fi
if test ! -f $QWT_INCDIR/qwt.h ; then
QWT_INCDIR=$QWTHOME"/include"
fi
qwt_ok=no
fi
else
+ AC_MSG_NOTICE(Trying Qwt from $QWTHOME ...)
if test -z $QWT_INCDIR; then
QWT_INCDIR="$QWTHOME/include"
fi
LIBS_old=$LIBS
LIBS="$LIBS $QT_LIBS"
if test "x$QWTHOME" = "x/usr" ; then
- LIBS="$LIBS -lqwt"
+ LIBS="$LIBS -l${libqwt_name}"
else
- LIBS="$LIBS -L$QWTHOME/lib -lqwt"
+ LIBS="$LIBS -L$QWTHOME/lib -l${libqwt_name}"
fi
CXXFLAGS_old=$CXXFLAGS
else
AC_MSG_RESULT(yes)
if test "x$QWTHOME" = "x/usr" ; then
- QWT_LIBS=" -lqwt"
+ QWT_LIBS=" -l${libqwt_name}"
else
- QWT_LIBS="-L$QWTHOME/lib -lqwt"
+ QWT_LIBS="-L$QWTHOME/lib -l${libqwt_name}"
fi
fi
#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Created from configure.in.base
#
-AC_INIT([Salome2 Project SMESH module], [5.1.2], [webmaster.salome@opencascade.com], [SalomeSMESH])
+AC_INIT([Salome2 Project SMESH module], [5.1.3], [webmaster.salome@opencascade.com], [SalomeSMESH])
AC_CONFIG_AUX_DIR(adm_local/unix/config_files)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
echo
echo ---------------------------------------------
-echo Coniguring production
+echo Configuring production
echo ---------------------------------------------
echo
AC_ENABLE_DEBUG(yes)
\anchor fixed_points_1d_anchor
<h2>Fixed points 1D hypothesis</h2>
-<b>Fixed points 1D</b> hypothesis allows to split edges into segments
-using set of fixed points given by normalized parameters on edge and
-set of numbers of segments for splitting each sub-segment between
-fixed points. Optionally it is possible to set flag
-<b>Same Nb. Segments for all intervals</b> and
-only one value for mentioned number of segments.
-
-The direction of the splitting is defined by the orientation of the
+<b>Fixed points 1D</b> hypothesis allows splitting edges through a
+set of points parameterized on the edge (from 1 to 0) and a number of segments for each
+interval limited by the points.
+
+\image html hypo_fixedpnt_dlg.png
+
+It is possible to check in <b>Same Nb. Segments for all intervals</b>
+option and to define one value for all intervals.
+
+The splitting direction is defined by the orientation of the
underlying geometrical edge. <b>"Reverse Edges"</b> list box allows to
specify the edges for which the splitting should be made in the
-direction opposing to their orientation. This list box is enabled only
-if the geometry object is selected for the meshing. In this case the
-user can select edges to be reversed either directly picking them in
-the 3D viewer or by selecting the edges or groups of edges in the
+direction opposite to their orientation. This list box is enabled only
+if the geometrical object is selected for meshing. In this case it is
+possible to select the edges to be reversed either directly picking them in
+the 3D viewer or selecting the edges or groups of edges in the
Object browser.
-Using of this hypothesis for quadrangle face where main mesh is
-created using <b>Quadrangle(Mapping)</b> and <b>NumberOfSegments</b>
-hypothesises. Creation hypothesis <b>FixedPoint_1D</b> for submesh on
-one edge:
+\image html mesh_fixedpnt.png "Example of a submesh on the edge built using Fixed points 1D hypothesis"
-\image html hypo_fixedpnt_dlg.png
-
-Resulting 2D mesh:
-
-\image html mesh_fixedpnt.png
+<b>See Also</b> a sample TUI Script of a
+\ref tui_fixed_points "Defining Fixed Points" hypothesis operation.
*/
\image html a-maxelarea.png
+\n
+
\image html max_el_area.png "In this example, Max. element area is very small compared to the 1D hypothesis"
<b>See Also</b> a sample TUI Script of a
\image html hypo_quad_params_res.png "The resulting mesh"
+This hypothesis can be also used to mesh a segment of a circular face.
+Please, consider that there is a limitation on the selectiion of the degenerated
+vertex for the faces built with the angle > 180 degrees (see the picture).
+
+\image html hypo_quad_params_2.png "3/4 of a circular face"
+
+In this case, selection of a wrong vertex for the <b>Quadrangle parameters</b>
+hypothesis will generate a wrong mesh. The picture below
+shows the good (left) and the bad (right) results of meshing.
+
+\image html hypo_quad_params_res_2.png "The resulting meshes"
+
<br>
\anchor quadrangle_preference_anchor
<h2>Quadrangle Preference</h2>
<ul>
<li>\ref max_element_area_anchor "Max Element Area"</li>
<li>\ref length_from_edges_anchor "Length from Edges"</li>
+<li>\ref hypo_quad_params_anchor "Quadrangle Parameters"</li>
<li>\ref quadrangle_preference_anchor "Quadrangle Preference"</li>
<li>\ref triangle_preference_anchor "Triangle Preference"</li>
</ul>
<ul>
<li>\b Node — 0D object of a mesh presented by a point with coordinates (x, y, z).</li>
+<li>\b 0D element — element of a mesh defined by one node.</li>
<li>\b Edge — 1D element of a mesh defined by two nodes.</li>
<li>\b Face — 2D element of a mesh defined by three or four edges (closed contour).</li>
<li>\b Volume — 3D element of a mesh defined by several faces.</li>
\image html image126.gif "Example of a hexahedral 3D mesh"
</ul>
-\Note that BLSURF and GHS3D are commercial meshers and require a
+\note BLSURF and GHS3D are commercial meshers and require a
license to be used within the Mesh module.
There is also a number of more specific algorithms:
<li>\subpage radial_prism_algo_page "for meshing geometrical objects with cavities"</li>
<li>\subpage segments_around_vertex_algo_page "for defining the local size of elements around a certain node"</li>
<li>\subpage prism_3d_algo_page "for meshing prismatic shapes"</li>
-<li>\subpage radial_quadrangle_1D2D_algo_page "for meshing special 2d
-faces (circles and part of circles)"</li>
+<li>\subpage radial_quadrangle_1D2D_algo_page "for meshing special 2d faces (circles and part of circles)"</li>
</ul>
\ref constructing_meshes_page "Constructing meshes" page describes in
\n BLSURF Parameters hypothesis works only with <b>BLSURF</b> 2d
algorithm. This algorithm is a commercial software.
+<h1>General parameters</h1>
+
\image html blsurf_parameters.png
<ul>
edges are not respected and all geometrical faces are meshed as one
hyper-face.</li>
+<h1>Advanced parameters</h1>
+
\image html blsurf_parameters_advanced.png
<li><b>Topology</b> - allows creation of a conform mesh on a shell of
<ul>
<li><b>topo_eps1</b> (real) - is the tolerance level inside a CAD
-patch. By default is equal to <i>diag</i> × 10-4. This tolerance is used to
+patch. By default is equal to <i>diag</i> � 10-4. This tolerance is used to
identify nodes to merge within one geometrical face when \b Topology
option is to pre-process. Default is <i>diag</i>/10.0.</li>
<li><b>topo_eps2</b> (real) - is the tolerance level between two CAD
-patches. By default is equal to <i>diag</i> × 10-4. This tolerance is used to
+patches. By default is equal to <i>diag</i> � 10-4. This tolerance is used to
identify nodes to merge over different geometrical faces when
\b Topology option is to pre-process. Default is <i>diag</i>/10.0.</li>
<li> import_option </li>
</ul>
+<h1>Custom size map</h1>
+
\image html blsurf_parameters_sizemap.png
-It is possible to define user sizes on faces, edges or verteces.
+User sizes can be defined on faces, edges or vertices.
<ul>
-<li>Those faces, edges and verteces must be sub-shapes (from explode command) of the meshed geometry object.</li>
-<li>Groups are currently not handled.</li>
-<li>Multi-selection is possible.</li>
-<li>The sizes are constant values.</li>
+<li>The faces, edges and vertices can belong to the meshed geometrical
+object or to its sub-shapes (created using <b>Explode</b> command).</li>
+<li>Groups of faces, edges and vertices are also handled.</li>
+<li>It is possible to attribute the same size to several geometries using multi-selection.</li>
+<li>The sizes are constant values or python functions.</li>
+<li>In case of a python function, the following rules must be respected:
+<ul>
+<li>The name of the function is f.</li>
+<li>If geometry is a face or a group of faces, the function is f(u,v).</li>
+<li>If geometry is an edge or a group of edges, the function is f(t).</li>
+<li>If geometry is a vertex or a group of vertices, the function is f().</li>
+<li>The function must return a double.</li>
+</ul></li>
</ul>
<br><b>See Also</b> a sample TUI Script of the \ref tui_blsurf "creation of a BLSurf hypothesis", including size map.
\anchor blsurf_sizemap_computation
<h2>Computation of the physical size</h2>
-Here is the detail on the calculation of the size (from BLSurf documentation).
\n
-The size is obtained by querying sizemap functions associated to the input CAD object for surfaces, curves and points.
-Each function can either return a value h (which is then trimmed between the two bounds hphymin and hphymax), or "no answer" (by not assigning a value to h), thus providing great flexibility in the specification of the sizes. The computation depends whether point P is internal to a surface, internal to a curve, or at the end of several curves:
+The physical size is obtained by querying sizemap functions associated to the input CAD object for surfaces, curves and points.
+Each function can either return a value h (which is then trimmed
+between the two bounds hphymin and hphymax), or "no answer" (by not
+assigning a value to h), thus providing great flexibility in the
+specification of the sizes. The computation depends on whether point P is internal to a surface, internal to a curve, or at the end of several curves:
<ul>
<li> If point P is internal to a surface, the CAD surface size function is queried. If no answer is returned, one interpolates with the values at the vertices of the discretized interface curves.</li>
<li> If point P is internal to a curve, the CAD curve size function is queried first. If no answer is returned, the surface size function is queried for every adjacent surface and the mean value of the returned values is computed. If no answer is returned, sizes h1 and h2 at both ends of the curve are considered (see next item) and the interpolated value is computed.</li>
In order to compute the mean of several values, the arithmetic mean is used by default, but this can be modified by the parameter \ref blsurf_hmean_flag "hmean flag". In the same way, in order to interpolate two values, a linear interpolation is used by default, but this can be modified by \ref blsurf_hinterpol_flag "hinterpol flag".
-\n
+<h1>Custom enforced vertices</h1>
+
+\image html blsurf_parameters_enforced_vertices.png
+
+It is possible to define some enforced vertices to BLSurf algorithm
+without creating any vertices by CAD algorithms.
+<ul>
+<li>The enforced vertex is the projection of a point defined by its
+(x,y,z) coordinates on the selected face.</li>
+<li>It is possible to define several enforced vertices on a face or a group of faces.</li>
+<li>If the projected point is on the boundary or outside of the face, it will be ignored.</li>
+</ul>
+
+<br><b>See Also</b> a sample TUI Script of the \ref tui_blsurf "creation of a BLSurf hypothesis", including enforced vertices.
+
+<h1>Limitations</h1>
+
Currently BLSURF plugin has the following limitations.
<ul>
<li>The created mesh will contain inverted elements if it is based on a shape,
\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."
*/
\image html failed_computation.png "Example of the invalid input mesh"
-\Note Mesh Computation Information box does not appear if you set
+\note Mesh Computation Information box does not appear if you set
"Mesh computation/Show a computation result notification" preference
to the "Never" value. This option gives the possibility to control mesh
computation reporting. There are the following possibilities: always
<li>Click the \b Apply or \b OK button.</li>
</ol>
-*/
\ No newline at end of file
+<br><b>See Also</b> a sample TUI Script of a \ref tui_quadratic "Convert to/from quadratic" operation.
+
+*/
\page editing_groups_page Editing groups
-\n <em>To edit an existing group of elements:</em>
+<em>To edit an existing group of elements:</em>
<ol>
<li>Select your group in the Object Browser and in the \b Mesh menu click
the <b>Edit Group</b> item or <em>"Edit Group"</em> button in the toolbar.</li>
In this dialog box you can modify the name of your group and add or
remove the elements forming it. For more information see
\ref creating_groups_page "Creating Groups" page.
+
<li>Click the \b Apply or <b>Apply and Close</b> button to confirm modification of the
group.</li>
</ol>
-\n <em>To convert an existing group on geometry into standalone group
+<em>To convert an existing group on geometry into standalone group
of elements and modify:</em>
<ol>
<li>Select your group on geometry in the Object Browser and in the \b Mesh menu click
<center><em>"Edit Group as Standalone" button</em></center>
The group on geometry will be converted into standalone group and can
-be modified as group of elements
+be modified as group of elements.
+
<li>Click the \b Apply or <b>Apply and Close</b> button to confirm modification of the
group.</li>
+</ol>
-<br><b>See Also</b> a sample TUI Script of an
-\ref tui_edit_group "Edit Group" operation.
+\sa A sample TUI Script of an \ref tui_edit_group "Edit Group" operation.
*/
\page free_faces_page Free faces
-\n This mesh quality control highlights the faces connected to
+This mesh quality control highlights the faces connected to
less than two mesh volume elements. The free faces are shown with a
color different from the color of shared faces.
\image html free_faces.png
-<center>In this picture some volume mesh elements have been removed, as
+
+In this picture some volume mesh elements have been removed, as
a result some faces became connected only to one
volume. i.e. became free.
-<br><b>See Also</b> a sample TUI Script of a
-\ref tui_free_faces "Free Faces quality control" operation.
+\sa A sample TUI Script of a \ref tui_free_faces "Free Faces quality control"
+operation.
*/
\page free_nodes_page Free nodes
-\n This mesh quality control highlights the nodes which are not connected
+This mesh quality control highlights the nodes which are not connected
to any mesh element.
\image html free_nodes.png
-<center>In this picture some nodes are not connected to any mesh
+
+In this picture some nodes are not connected to any mesh
element after deleting some elements and adding several isolated nodes.
-<br><b>See Also</b> a sample TUI Script of a
-\ref tui_free_nodes "Free Nodes quality control" operation.
+\sa A sample TUI Script of a \ref tui_free_nodes "Free Nodes quality control"
+operation.
*/
\n GHS3D Parameters hypothesis works only with <b>Tetrahedron (GHS3D)</b>
algorithm. This algorithm is a commercial software.
+<h1>General parameters</h1>
+
\image html ghs3d_parameters_basic.png
<ul>
optimisation provides better mesh, but can be time-consuming.
</li>
+<h1>Advanced parameters</h1>
+
\image html ghs3d_parameters_advanced.png
<li><b>Maximum memory size</b> - launches ghs3d software with
<li><b>To create new nodes</b> - if this option is checked off, ghs3d
tries to create tetrahedrons using only the nodes of the 2D mesh.</li>
+<li><b>To remove the initial central point</b> TetMesh-GHS3D adds an internal point
+at the gravity centre of the bounding box to speed up and to simplify
+the meshing process. However, it is possible to refrain from creating
+this point by using the command line option -no initial central point. This can be
+particularly useful to generate a volume mesh without internal points at all and in some rare cases
+at the boundary regeneration phase when it is impossible to proceed
+with the standard options
+(for example, when one dimension of the domain is more than 20 times greater than the other two).
+Use this option if the boundary regeneration has failed with the standard parameters and before using
+the recovery version (command line option -C).
+Note: when using this option, the speed of the meshing process may
+decrease, and the quality may change.
+Note: the boundary regeneration may fail with this option, in some rare cases.</li>
+
<li><b>To use boundary recovery version</b> - enables using a
boundary recovery module which tries to
create volume meshes starting from very poor quality surface meshes
quality (poor aspect ratio of elements, tetrahedra with a very small
positive volume).</li>
-<li><b>Option as text</b> - allows input of any text as command line
-for ghs3d. This allows the input of advanced options in a free from. </li>
+<li><b>To use FEM correction</b> - Applies finite-element correction by
+replacing overconstrained elements where it is possible. At first the process
+slices the overconstrained edges and at second the overconstrained
+facets. This ensures that there are no edges with two boundary
+vertices and that there are no facets with three boundary vertices. TetMesh-GHS3D gives the initial
+and final overconstrained edges and facets. It also gives the facets
+which have three edges on the boundary.
+Note: when using this option, the speed of the meshing process may
+decrease, quality may change, and the smallest volume may be smaller.
+By default, the FEM correction is not used.</li>
+
+<li><b>Option as text</b> - allows to input in the command line any text
+for ghs3d, for example, advanced options. </li>
+
+</ul>
+
+<h1>Enforced vertices</h1>
+
+\image html ghs3d_enforced_vertices.png
+
+GHS3D algorithm can locally make the mesh finer. It is possible to define enforced vertices in the volume where the mesh will be detailed.
+
+A node will be created at the enforced vertex coordinates. There is no need to create a vertex in CAD.
+
+An enforced vertex is defined by:
+<ul>
+<li>The (x,y,z) cartesian coordinates</li>
+<li>A constant physical size</li>
</ul>
-*/
\ No newline at end of file
+<br><b>See Also</b> a sample TUI Script of the \ref tui_ghs3d "creation of a Ghs3D hypothesis", including enforced vertices.
+
+
+*/
<li> by creating a group of elements of the selected type from all
such elements of the chosen geometrical object - <b>Group on
geometry</b> tab of \ref creating_groups_page "Create group" dialog.</li>
-
<li> by creating a group including all types of elements from an
existing geometrical object - using \subpage create_groups_from_geometry_page "Create Groups from Geometry" dialog.</li>
-
<li> by creating several groups of elements (nodes,
edges, faces and volumes) from the chosen submesh - using <b>Mesh -> Construct
Group</b> Menu item. In this case groups of elements are created
automatically.</li>
-
<li> by creating groups of entities from existing groups of superior
dimensions - using \subpage group_of_underlying_elements_page "Create Group of Underlying Elements"
dialog.</li>
-
</ul>
<ul>
<li>\subpage editing_groups_page "Edited"</li>
-<li>\subpage using_operations_on_groups_page "Subjected to Boolean operations", or</li>
+<li>\subpage using_operations_on_groups_page "Subjected to Boolean operations"</li>
<li>\subpage deleting_groups_page "Deleted"</li>
</ul>
An important tool, providing filters for creation of \b Standalone
-groups is \subpage selection_filter_library_page</li>.
+groups is \subpage selection_filter_library_page.
*/
--- /dev/null
+/*!
+
+\page make_2dmesh_from_3d_page Generate the skin elements (2D) of a mesh having 3D elements
+
+\n This functionality allows to generate 2D mesh elements as a skin
+on the existing 3D mesh elements.
+
+<em>To generate 2D mesh:</em>
+<ol>
+<li>From the Modification menu choose "Create 2D mesh from 3D"
+item, or choose from the popup menu.
+
+\image html 2d_from_3d_menu.png
+
+The algorithm detects boundary volume faces without connections to
+other volumes and creates 2D mesh elements on face nodes. If the mesh
+already contains 2D elements on the detected nodes, new elements are not
+created. The the resulting dialog shows mesh information statistics
+about the newly created 2D mesh elements.
+</ol>
+
+*/
\image html advanced_mesh_infos.png
-In case you get Mesh Infos via a \ref tui_viewing_mesh_infos "TUI script",
-the information is displayed in Python Console.
-
-\image html b-mesh_infos.png
-
<br>
\anchor mesh_element_info_anchor
<h2>Mesh Element Info</h2>
\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",
+
*/
\ No newline at end of file
<li>Apply \subpage pattern_mapping_page "pattern mapping".</li>
<li>\subpage convert_to_from_quadratic_mesh_page "Convert regular mesh to quadratic",
or vice versa.</li>
+<li>\subpage make_2dmesh_from_3d_page "Create 2D mesh from 3D".</li>
+
</ul>
\note It is possible to use the variables defined in the SALOME \b NoteBook
to specify the numerical parameters used for modification of any object.
-*/
\ No newline at end of file
+*/
\page netgen_2d_3d_hypo_page Netgen 2D and 3D hypotheses
-\n <b>Netgen 2D</b> and <b>Netgen 3D</b> hypotheses work only with <b>Netgen 1D-2D</b> and
+<b>Netgen 2D</b> and <b>Netgen 3D</b> hypotheses work only with <b>Netgen 1D-2D</b> and
<b>Netgen 1D-2D-3D</b> algorithms. These algorithms do not require
definition of lower-level hypotheses and algorithms (2D and 1D for
meshing 3D objects and 1D for meshing 2D objects). They prove to be
\image html netgen2d.png
-<ul>
-<li><b>Name</b> - allows to define the name for the algorithm (Netgen
-2D (or 3D) Parameters by default).</li>
-<li><b>Max Size</b> - maximum linear dimensions for mesh cells.</li>
-<li><b>Second Order</b> - if this box is checked in, the algorithm will
+- <b>Name</b> - allows to define the name for the algorithm (Netgen
+2D (or 3D) Parameters by default).
+- <b>Max Size</b> - maximum linear dimensions for mesh cells.
+- <b>Second Order</b> - if this box is checked in, the algorithm will
create second order nodes on the mesh, which actually will become
-\ref adding_quadratic_elements_page "Quadratic".</li>
-<li><b>Fineness</b> - ranging from Very Coarse to Very Fine allows to set the
+\ref adding_quadratic_elements_page "Quadratic".
+- <b>Fineness</b> - ranging from Very Coarse to Very Fine allows to set the
level of meshing detalization using the three parameters below. You
-can select Custom to define them manually.</li>
-<li><b>Growth rate</b> - allows to define how much the linear dimensions of
-two adjacent cells can differ (i.e. 0.3 means 30%).</li>
-<li><b>Nb. Segs per Edge</b> and <b>Nb Segs per Radius</b> - allows to define the
+can select Custom to define them manually.
+- <b>Growth rate</b> - allows to define how much the linear dimensions of
+two adjacent cells can differ (i.e. 0.3 means 30%).
+- <b>Nb. Segs per Edge</b> and <b>Nb Segs per Radius</b> - allows to define the
minimum number of mesh segments in which edges and radiuses will be
-split.</li>
-<li><b>Allow Quadrangles</b> - allows to use quadrangle elements in a
+split.
+- <b>Allow Quadrangles</b> - allows to use quadrangle elements in a
triangle 2D mesh. This checkbox is not present in Netgen 3D parameters
because currently building a tetrahedral mesh with quadrangle faces is
-not possible.</li>
-<li><b>Optimize</b> - if this box is checked in, the algorithm will try to
-create regular (possessing even sides) elements.</li>
-</ul>
+not possible.
+- <b>Optimize</b> - if this box is checked in, the algorithm will try to
+create regular (possessing even sides) elements.
\image html netgen3d_simple.png
-<b>Netgen 2D simple parameters</b> and <b>Netgen 3D simple parameters</b> allow defining the size of elements for each dimension. <br>
+<b>Netgen 2D simple parameters</b> and <b>Netgen 3D simple
+parameters</b> allow defining the size of elements for each
+dimension.
\b 1D group allows defining the size of 1D elements in either of two ways:
-<ul>
-<li><b>Number of Segments</b> has the same sense as \ref
+- <b>Number of Segments</b> has the same sense as \ref
number_of_segments_anchor "Number of segments" hypothesis with
-equidistant distribution.</li>
-<li><b>Average Length</b> has the same sense as \ref
-average_length_anchor "Average Length" hypothesis.</li>
-</ul>
+equidistant distribution.
+- <b>Average Length</b> has the same sense as \ref
+average_length_anchor "Average Length" hypothesis.
\b 2D group allows defining the size of 2D elements
-<ul>
-<li><b>Length from edges</b> if checked in, acts like \ref
-length_from_edges_anchor "Length from Edges" hypothesis, else </li>
-<li><b>Max. Element Area</b> defines the maximum element area like \ref
-max_element_area_anchor "Max Element Area" hypothesis. </li>
-</ul>
+- <b>Length from edges</b> if checked in, acts like \ref
+length_from_edges_anchor "Length from Edges" hypothesis, else
+- <b>Max. Element Area</b> defines the maximum element area like \ref
+max_element_area_anchor "Max Element Area" hypothesis.
\b 3D groups allows defining the size of 3D elements.
-<ul>
-<li><b>Length from faces</b> if checked in, the area of sides of
-volumic elements will be equal to an average area of 2D elements, else </li>
-<li><b>Max. Element Volume</b> defines the maximum element volume like
+- <b>Length from faces</b> if checked in, the area of sides of
+volumic elements will be equal to an average area of 2D elements, else
+- <b>Max. Element Volume</b> defines the maximum element volume like
\ref max_element_volume_hypo_page "Max Element Volume"
-hypothesis.</li>
-<ul>
+hypothesis.
-\n Note that Netgen algorithm does not strictly follow the input
-parameters. The actual mesh can be more or less dense than required. There are several factors in it:
-<ol>
-<li> NETGEN does not actually use "NbOfSegments" parameter for discretization of
-edge. This parameter is used only to define the local element size (size at the given point), so local sizes of adjacent edges influence each other. </li>
-<li> NETGEN additionally restricts the element size according to edge curvature.</li>
-<li> The local size of edges influences the size of close triangles.</li>
-<li> The order of elements and their size in the 1D mesh generated by
+\note Netgen algorithm does not strictly follow the input
+parameters. The actual mesh can be more or less dense than
+required. There are several factors in it:
+- NETGEN does not actually use "NbOfSegments" parameter for discretization of
+edge. This parameter is used only to define the local element size
+(size at the given point), so local sizes of adjacent edges influence
+each other.
+- NETGEN additionally restricts the element size according to edge curvature.
+- The local size of edges influences the size of close triangles.
+- The order of elements and their size in the 1D mesh generated by
NETGEN differ from those in the 1D mesh generated by Regular_1D
-algorithm, resulting in different 2D and 3D meshes.</li>
-</ol>
-*/
\ No newline at end of file
+algorithm, resulting in different 2D and 3D meshes.
+
+*/
3D extrusion algorithm can be used for meshing prisms, i.e. <b>3D Shapes</b>
defined by two opposing faces having the same number of vertices and
-edges and meshed using the \ref projection_algos_page "2D Projection"
-algorithm. These two faces should be connected by quadrangle "side"
-faces.
+edges and meshed using, for example, the \ref projection_algos_page
+"2D Projection" algorithm. These two faces should be connected by
+quadrangle "side" faces.
The opposing faces can be meshed with either quadrangles or triangles,
while the side faces should be meshed with quadrangles only.
have in the same 3D mesh such elements as hexahedrons, prisms and
polyhedrons.
-*/
\ No newline at end of file
+\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.
+
+*/
\page radial_quadrangle_1D2D_algo_page Radial Quadrangle 1D2D
-\n This algorithm applies to the meshing of a 2D shapes.
-Required conditions: Face must be a full circle or part of circle
-(i.e. number of edges <= 3 and one of them must be a circle curve).
-The resulting mesh consists of triangles (near center point) and
+\n This algorithm applies to the meshing of 2D shapes under the
+following conditions: the face must be a full circle or a part of circle
+(i.e. the number of edges is less or equal to 3 and one of them is a circle curve).
+The resulting mesh consists of triangles (near the center point) and
quadrangles.
-This algorithm also requires the information concerning the number and
-distribution of mesh layers alond a radius of circle. Distribution of
-layers can be set with any of 1D Hypotheses.
-
-Creation hypothesis:
+This algorithm requires the hypothesis indicating the number
+of mesh layers along the radius. The distribution of layers can be set with any 1D Hypothesis.
\image html hypo_radquad_dlg.png
-Resulting 3D mesh for the cylinder with <b>RadialQuadrangle_1D2D</b>
-hypothesis for top and bottom faces:
-
-\image html mesh_radquad_01.png
+\image html mesh_radquad_01.png "Radial Quadrangle 2D mesh on the top and the bottom faces of a cylinder"
-Resulting 2D mesh for the part of circle:
+\image html mesh_radquad_02.png "Radial Quadrangle 2D mesh on a part of circle"
-\image html mesh_radquad_02.png
+\sa A sample \ref tui_radial_quadrangle "TUI Script".
*/
\page smeshpy_interface_page Python interface
-\n Python package smesh defines several classes, destined for easy and
+Python package smesh defines several classes, destined for easy and
clear mesh creation and edition.
-\n Documentation for smesh package is available in two forms:
-
-\n The <a href="smeshpy_doc/modules.html"> structured
- documentation for smesh package</a>, where all methods and
- classes are grouped by their functionality, like it is done in the GUI documentation
-\n and the \ref smeshDC "linear documentation for smesh package"
- grouped only by classes, declared in the smesh.py file.
-
-\n The main page of the \ref smeshDC "linear documentation for smesh package"
- contains a list of data structures and a list of
- functions, provided by the package smesh.py. The first item in
- the list of data structures (\ref smeshDC::smeshDC "class smesh")
- also represents documentation for the methods of the package smesh.py itself.
-
-\n The package smesh.py provides an interface to create and handle
- meshes. Use it to create an empty mesh or to import it from the data file.
-
-\n Once a mesh has been created, it is possible to manage it via its own
- methods, described at \ref smeshDC::Mesh "class Mesh" documentation
- (it is also accessible by the second item "class Mesh" in the list of data structures).
-
-\n Class Mesh allows assigning algorithms to a mesh.
-\n Please note, that some algorithms,
- included in the standard Salome installation are always available:
- - REGULAR(1D), COMPOSITE(1D), MEFISTO(2D), Quadrangle(2D), Hexa(3D), etc.
-
-\n There are also some algorithms, which can be installed optionally,
-\n some of them are based on open-source meshers:
- - NETGEN(1D-2D,2D,1D-2D-3D,3D),
-
-\n others are based on commercial meshers:
- - GHS3D(3D), BLSURF(2D).
-
-\n To add hypotheses, use the interfaces, provided by the assigned
+Documentation for smesh package is available in two forms:
+
+The <a href="smeshpy_doc/modules.html"> structured
+documentation for smesh package</a>, where all methods and
+classes are grouped by their functionality, like it is done in the GUI documentation
+and the \ref smeshDC "linear documentation for smesh package"
+grouped only by classes, declared in the smesh.py file.
+
+The main page of the \ref smeshDC "linear documentation for smesh package"
+contains a list of data structures and a list of
+functions, provided by the package smesh.py. The first item in
+the list of data structures (\ref smeshDC::smeshDC "class smesh")
+also represents documentation for the methods of the package smesh.py itself.
+
+The 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.
+
+Once a mesh has been created, it is possible to manage it via its own
+methods, described at \ref smeshDC::Mesh "class Mesh" documentation
+(it is also accessible by the second item "class Mesh" in the list of data structures).
+
+Class \b Mesh allows assigning algorithms to a mesh.
+Please note, that some algorithms, included in the standard SALOME
+distribution are always available:
+- REGULAR (1D)
+- COMPOSITE (1D)
+- MEFISTO (2D)
+- Quadrangle (2D)
+- Hexa(3D)
+- etc...
+
+There are also some algorithms, which can be installed optionally,
+some of them are based on open-source meshers:
+- NETGEN (1D-2D, 2D, 1D-2D-3D, 3D)
+
+... and others are based on commercial meshers:
+- GHS3D (3D)
+- BLSURF (2D)
+
+To add hypotheses, use the interfaces, provided by the assigned
algorithms.
-\n Below you can see an example of usage of the package smesh for 3d mesh generation.
+Below you can see an example of usage of the package smesh for 3d mesh generation.
+\anchor example_3d_mesh
<h2>Example of 3d mesh generation with NETGEN:</h2>
-\n from geompy import *
-\n import smesh
+\code
+from geompy import *
+import smesh
-<b># Geometry</b>
-\n <b># an assembly of a box, a cylinder and a truncated cone meshed with tetrahedral</b>.
+###
+# Geometry: an assembly of a box, a cylinder and a truncated cone
+# meshed with tetrahedral
+###
-<b># Define values</b>
-\n name = "ex21_lamp"
-\n cote = 60
-\n section = 20
-\n size = 200
-\n radius_1 = 80
-\n radius_2 = 40
-\n height = 100
+# Define values
+name = "ex21_lamp"
+cote = 60
+section = 20
+size = 200
+radius_1 = 80
+radius_2 = 40
+height = 100
-<b># Build a box</b>
-\n box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
+# Build a box
+box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
-<b># Build a cylinder</b>
-\n pt1 = MakeVertex(0, 0, cote/3)
-\n di1 = MakeVectorDXDYDZ(0, 0, 1)
-\n cyl = MakeCylinder(pt1, di1, section, size)
+# Build a cylinder
+pt1 = MakeVertex(0, 0, cote/3)
+di1 = MakeVectorDXDYDZ(0, 0, 1)
+cyl = MakeCylinder(pt1, di1, section, size)
-<b># Build a truncated cone</b>
-\n pt2 = MakeVertex(0, 0, size)
-\n cone = MakeCone(pt2, di1, radius_1, radius_2, height)
+# Build a truncated cone
+pt2 = MakeVertex(0, 0, size)
+cone = MakeCone(pt2, di1, radius_1, radius_2, height)
-<b># Fuse </b>
-\n box_cyl = MakeFuse(box, cyl)
-\n piece = MakeFuse(box_cyl, cone)
+# Fuse
+box_cyl = MakeFuse(box, cyl)
+piece = MakeFuse(box_cyl, cone)
-<b># Add in study</b>
-\n addToStudy(piece, name)
+# Add to the study
+addToStudy(piece, name)
-<b># Create a group of faces</b>
-\n group = CreateGroup(piece, ShapeType["FACE"])
-\n group_name = name + "_grp"
-\n addToStudy(group, group_name)
-\n group.SetName(group_name)
+# Create a group of faces
+group = CreateGroup(piece, ShapeType["FACE"])
+group_name = name + "_grp"
+addToStudy(group, group_name)
+group.SetName(group_name)
-<b># Add faces in the group</b>
-\n faces = SubShapeAllIDs(piece, ShapeType["FACE"])
-\n UnionIDs(group, faces)
+# Add faces to the group
+faces = SubShapeAllIDs(piece, ShapeType["FACE"])
+UnionIDs(group, faces)
-<b># Create a mesh</b>
+###
+# Create a mesh
+###
-<b># Define a mesh on a geometry</b>
-\n tetra = smesh.Mesh(piece, name)
+# Define a mesh on a geometry
+tetra = smesh.Mesh(piece, name)
-<b># Define 1D hypothesis</b>
-\n algo1d = tetra.Segment()
-\n algo1d.LocalLength(10)
+# Define 1D hypothesis
+algo1d = tetra.Segment()
+algo1d.LocalLength(10)
-<b># Define 2D hypothesis</b>
-\n algo2d = tetra.Triangle()
-\n algo2d.LengthFromEdges()
+# Define 2D hypothesis
+algo2d = tetra.Triangle()
+algo2d.LengthFromEdges()
-<b># Define 3D hypothesis</b>
-\n algo3d = tetra.Tetrahedron(smesh.NETGEN)
-\n algo3d.MaxElementVolume(100)
+# Define 3D hypothesis
+algo3d = tetra.Tetrahedron(smesh.NETGEN)
+algo3d.MaxElementVolume(100)
-<b># Compute the mesh</b>
-\n tetra.Compute()
+# Compute the mesh
+tetra.Compute()
-<b># Create a groupe of faces</b>
-\n tetra.Group(group)
+# Create a groupe of faces
+tetra.Group(group)
-\n Examples of Python scripts for all Mesh operations are available by
-the following links:
+\endcode
-<ul>
-<li>\subpage tui_creating_meshes_page</li>
-<li>\subpage tui_viewing_meshes_page</li>
-<li>\subpage tui_defining_hypotheses_page</li>
-<li>\subpage tui_quality_controls_page</li>
-<li>\subpage tui_grouping_elements_page</li>
-<li>\subpage tui_modifying_meshes_page</li>
-<li>\subpage tui_transforming_meshes_page</li>
-<li>\subpage tui_notebook_smesh_page</li>
-</ul>
+Examples of Python scripts for all Mesh operations are available by
+the following links:
+- \subpage tui_creating_meshes_page
+- \subpage tui_viewing_meshes_page
+- \subpage tui_defining_hypotheses_page
+- \subpage tui_quality_controls_page
+- \subpage tui_grouping_elements_page
+- \subpage tui_modifying_meshes_page
+- \subpage tui_transforming_meshes_page
+- \subpage tui_notebook_smesh_page
*/
</ul>
</li>
-<li>Click \b Apply or <b> Apply and Close</b> button to confirm the
-operation.</li>
-
+<li>Click \b Apply or <b> Apply and Close</b> button to confirm the operation.</li>
</ol>
-
-<br><b>See Also</b> a sample TUI Script of a
-\ref tui_translation "Translation" operation.
+<br><b>See Also</b> a sample TUI Script of a \ref tui_translation "Translation" operation.
*/
\page tui_creating_meshes_page Creating Meshes
-\n First of all see \ref introduction_to_mesh_python_page "Example of 3d mesh generation",
+\n First of all see \ref example_3d_mesh "Example of 3d mesh generation",
which is an example of good python script style for Mesh module.
<br>
Edge_1 = geompy.SubShapeAllSorted(box, geompy.ShapeType["EDGE"])[0]
Vertex_1 = geompy.SubShapeAllSorted(box, geompy.ShapeType["VERTEX"])[0]
+# /!\ Geom object with sizemaps on them must be published in study
+geompy.addToStudyInFather(box,Face_1, "Face_1")
+geompy.addToStudyInFather(box,Edge_1, "Edge_1")
+geompy.addToStudyInFather(box,Vertex_1, "Vertex_1")
+
# create a mesh on the box
blsurfMesh = smesh.Mesh(box,"box: BLSurf mesh")
# compute the mesh
blsurfMesh.Compute()
+
+# Add enforced vertex for Face_1 on (50, 50, 50)
+# The projection coordinates will be (50, 50, 0)
+BLSURF_Parameters.SetEnforcedVertex(Face_1, 50, 50, 50)
+
+# Add another enforced vertex on (150, 150, 150)
+BLSURF_Parameters.SetEnforcedVertex(Face_1, 150, 150, 150)
+
+# Retrieve and print the list of enforced vertices defines on Face_1
+enfList = BLSURF_Parameters.GetEnforcedVertices(Face_1)
+print "List of enforced vertices for Face_1: "
+print enfList
+
+# compute the mesh
+blsurfMesh.Compute()
+
+# Remove an enforced vertex and print the list
+BLSURF_Parameters.UnsetEnforcedVertex(Face_1, 50, 50, 50)
+enfList = BLSURF_Parameters.GetEnforcedVertices(Face_1)
+print "List of enforced vertices for Face_1: "
+print enfList
+
+# compute the mesh
+blsurfMesh.Compute()
+
+# Remove all enforced vertices defined on Face_1
+BLSURF_Parameters.UnsetEnforcedVertices(Face_1)
+
+# compute the mesh
+blsurfMesh.Compute()
+
+# End of script
+
\endcode
*/
\ No newline at end of file
--- /dev/null
+/*!
+
+\page tui_defining_ghs3d_hypotheses_page Defining Hypotheses for Ghs3D Algorithm
+
+\anchor tui_ghs3d
+<h2>Construction of Mesh using Ghs3D algorithm</h2>
+
+\code
+import geompy
+import smesh
+import BLSURFPlugin
+import GHS3DPlugin
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
+geompy.addToStudy(box, "box")
+
+# create a mesh on the box
+ghs3dMesh = smesh.Mesh(box,"box: Ghs3D and BLSurf mesh")
+
+# create a BLSurf algorithm for faces
+BLSURF = ghs3dMesh.Triangle(algo=smesh.BLSURF)
+
+# create a Ghs3D algorithm for volume
+GHS3D = ghs3dMesh.Tetrahedron(algo=smesh.GHS3D)
+
+# get Ghs3D algorithm hypothesis
+GHS3D_Parameters = GHS3D.Parameters()
+
+# define an enforced vertex at (50,50,100) with a physical size of 2
+GHS3D_Parameters.SetEnforcedVertex( 50, 50, 100, 2 )
+
+# define an enforced vertex at (150,150,100) with a physical size of 5
+GHS3D_Parameters.SetEnforcedVertex( 150, 150, 100, 5 )
+
+# compute the mesh
+ghs3dMesh.Compute()
+
+# End of script
+
+\endcode
+
+\image html ghs3d_enforced_vertices_screenshot.png
+
+*/
\ No newline at end of file
\endcode
+<br>
+
+\anchor tui_fixed_points
+
+<h2>1D Mesh with Fixed Points example</h2>
+
+\code
+import salome
+import geompy
+import smesh
+import StdMeshers
+
+# Create face and explode it on edges
+face = geompy.MakeFaceHW(100, 100, 1)
+edges = geompy.SubShapeAllSorted(face, geompy.ShapeType["EDGE"])
+geompy.addToStudy( face, "Face" )
+
+# get the first edge from exploded result
+edge1 = geompy.GetSubShapeID(face, edges[0])
+
+# Define Mesh on previously created face
+Mesh_1 = smesh.Mesh(face)
+
+# Create Fixed Point 1D hypothesis and define parameters.
+# Note: values greater than 1.0 and less than 0.0 are not taken into account;
+# duplicated values are removed. Also, if not specified explicitly, values 0.0 and 1.0
+# add added automatically.
+# The number of segments should correspond to the number of points (NbSeg = NbPnt-1);
+# extra values of segments splitting parameter are not taken into account,
+# while missing values are considered to be equal to 1.
+Fixed_points_1D_1 = smesh.CreateHypothesis('FixedPoints1D')
+Fixed_points_1D_1.SetPoints( [ 1.1, 0.9, 0.5, 0.0, 0.5, -0.3 ] )
+Fixed_points_1D_1.SetNbSegments( [ 3, 1, 2 ] )
+Fixed_points_1D_1.SetReversedEdges( [edge1] )
+
+# Add hypothesis to mesh and define 2D parameters
+Mesh_1.AddHypothesis(Fixed_points_1D_1)
+Regular_1D = Mesh_1.Segment()
+Quadrangle_2D = Mesh_1.Quadrangle()
+# Compute mesh
+Mesh_1.Compute()
+\endcode
+
+\anchor tui_radial_quadrangle
+<h2> Radial Quadrangle 1D2D example </h2>
+\code
+import salome
+import geompy
+import smesh
+import StdMeshers
+
+# Create face from the wire and add to study
+WirePath = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WW", [0, 0, 0, 1, 0, 0, 0, 0, 1])
+Face = geompy.MakeFace(WirePath,1)
+geompy.addToStudy(Face,"Face")
+
+# Define geometry for mesh, and 1D parameters
+mesh = smesh.Mesh(Face)
+Wire_discretisation = mesh.Segment()
+Nb_Segments = Wire_discretisation.NumberOfSegments(5)
+Nb_Segments.SetDistrType( 0 )
+
+# Define 2D parameters and Radial Quadrange hypothesis
+Number_of_Layers = smesh.CreateHypothesis('NumberOfLayers2D')
+Number_of_Layers.SetNumberOfLayers( 4 )
+mesh.AddHypothesis(Number_of_Layers)
+RadialQuadrangle_1D2D = smesh.CreateHypothesis('RadialQuadrangle_1D2D')
+mesh.AddHypothesis(RadialQuadrangle_1D2D)
+
+mesh.Compute()
+\endcode
+
+
\n Other meshing algorithms:
<ul>
<li>\subpage tui_defining_blsurf_hypotheses_page</li>
+<li>\subpage tui_defining_ghs3d_hypotheses_page</li>
</ul>
*/
-/*!
+ /*!
\page tui_grouping_elements_page Grouping Elements
\endcode
\image html dimgroup_tui1.png
-<center>Source groups of faces<\center>
+<center>Source groups of faces</center>
\image html dimgroup_tui2.png
-<center>Result groups of edges and nodes<\center>
+<center>Result groups of edges and nodes</center>
-*/
\ No newline at end of file
+*/
if (isDone != 1): print 'MakeMesh :', pattern.GetErrorCode()
\endcode
-*/
\ No newline at end of file
+<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
+
+*/
\code
import geompy
import smesh
+import SMESH
# create a box
box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)
geompy.addToStudy(box, "box")
+[Face_1,Face_2,Face_3,Face_4,Face_5,Face_5] = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
# create a mesh
tetra = smesh.Mesh(box, "MeshBox")
algo3D = tetra.Tetrahedron(smesh.NETGEN)
algo3D.MaxElementVolume(900.)
+# Creation of SubMesh
+Regular_1D_1_1 = tetra.Segment(geom=Face_1)
+Nb_Segments_1 = Regular_1D_1_1.NumberOfSegments(5)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = tetra.Quadrangle(geom=Face_1)
+isDone = tetra.Compute()
+submesh = Regular_1D_1_1.GetSubMesh()
+
# compute the mesh
tetra.Compute()
-# print information about the mesh
+# Creation of group
+group = tetra.CreateEmptyGroup( SMESH.FACE, 'Group' )
+nbAdd = group.Add( [ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76 ] )
+
+# Print information about the mesh
print "Information about mesh:"
print "Number of nodes : ", tetra.NbNodes()
print "Number of edges : ", tetra.NbEdges()
print " prisms : ", tetra.NbPrisms()
print " pyramids : ", tetra.NbPyramids()
print " polyhedrons : ", tetra.NbPolyhedrons()
+
+# Get Information About Mesh by GetMeshInfo
+print "\nInformation about mesh by GetMeshInfo:"
+info = smesh.GetMeshInfo(tetra)
+keys = info.keys(); keys.sort()
+for i in keys:
+ print " %s : %d" % ( i, info[i] )
+ pass
+
+# Get Information About Group by GetMeshInfo
+print "\nInformation about group by GetMeshInfo:"
+info = smesh.GetMeshInfo(group)
+keys = info.keys(); keys.sort()
+for i in keys:
+ print " %s : %d" % ( i, info[i] )
+ pass
+
+# Get Information About SubMesh by GetMeshInfo
+print "\nInformation about Submesh by GetMeshInfo:"
+info = smesh.GetMeshInfo(submesh)
+keys = info.keys(); keys.sort()
+for i in keys:
+ print " %s : %d" % ( i, info[i] )
+ pass
\endcode
-*/
\ No newline at end of file
+
+*/
<li>\subpage transparency_page "Transparency" - allows to change the
transparency of mesh elements.</li>
<li>\subpage clipping_page "Clipping" - allows to create cross-sections of the selected objects.</li>
-<li>\ref about_quality_controls_page "Controls" - graphically
+<li>\ref quality_page "Controls" - graphically
presents various information about meshes.</li>
<li><b>Hide</b> - allows to hide the selected mesh from the viewer.</li>
<li><b>Show Only</b> -allows to display only the selected mesh, hiding all other from the viewer.</li>
enum log_command
{
ADD_NODE,
- ADD_ELEM0D,
ADD_EDGE,
ADD_TRIANGLE,
ADD_QUADRANGLE,
ADD_QUADTETRAHEDRON,
ADD_QUADPYRAMID,
ADD_QUADPENTAHEDRON,
- ADD_QUADHEXAHEDRON
+ ADD_QUADHEXAHEDRON,
+ ADD_ELEM0D
};
struct log_block
*/
long MoveClosestNodeToPoint(in double x, in double y, in double z, in long nodeID);
+ /*!
+ * Return ID of node closest to a given point
+ */
+ long FindNodeClosestTo(in double x, in double y, in double z);
+
+ /*!
+ * Return elements of given type where the given point is IN or ON.
+ *
+ * 'ALL' type means elements of any type excluding nodes and 0D elements
+ */
+ long_array FindElementsByPoint(in double x, in double y, in double z, in ElementType type);
+
enum Sew_Error {
SEW_OK,
SEW_BORDER1_NOT_FOUND,
* not creared - returns empty list
*/
long_array GetLastCreatedElems();
+
+ /*!
+ * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+ * \param theNodes - identifiers of nodes to be doubled
+ * \param theModifiedElems - identifiers of elements to be updated by the new (doubled)
+ * nodes. If list of element identifiers is empty then nodes are doubled but
+ * they not assigned to elements
+ * \return TRUE if operation has been completed successfully, FALSE otherwise
+ * \sa DoubleNode(), DoubleNodeGroup(), DoubleNodeGroups()
+ */
+ boolean DoubleNodes( in long_array theNodes, in long_array theModifiedElems );
+
+ /*!
+ * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+ * This method provided for convenience works as DoubleNodes() described above.
+ * \param theNodeId - identifier of node to be doubled.
+ * \param theModifiedElems - identifiers of elements to be updated.
+ * \return TRUE if operation has been completed successfully, FALSE otherwise
+ * \sa DoubleNodes(), DoubleNodeGroup(), DoubleNodeGroups()
+ */
+ boolean DoubleNode( in long theNodeId, in long_array theModifiedElems );
+
+ /*!
+ * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+ * This method provided for convenience works as DoubleNodes() described above.
+ * \param theNodes - group of nodes to be doubled.
+ * \param theModifiedElems - group of elements to be updated.
+ * \return TRUE if operation has been completed successfully, FALSE otherwise
+ * \sa DoubleNode(), DoubleNodes(), DoubleNodeGroups()
+ */
+ boolean DoubleNodeGroup( in SMESH_GroupBase theNodes,
+ in SMESH_GroupBase theModifiedElems );
+
+ /*!
+ \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+ This method provided for convenience works as DoubleNodes() described above.
+ \param theNodes - list of groups of nodes to be doubled
+ \param theModifiedElems - list of groups of elements to be updated.
+ \return TRUE if operation has been completed successfully, FALSE otherwise
+ \sa DoubleNode(), DoubleNodeGroup(), DoubleNodes()
+ */
+ boolean DoubleNodeGroups( in ListOfGroups theNodes,
+ in ListOfGroups theModifiedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodeGroups()
*/
- boolean DoubleNodes( in long_array theElems,
- in long_array theNodesNot,
- in long_array theAffectedElems );
+ boolean DoubleNodeElem( in long_array theElems,
+ in long_array theNodesNot,
+ in long_array theAffectedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
*/
- boolean DoubleNodesInRegion( in long_array theElems,
- in long_array theNodesNot,
- in GEOM::GEOM_Object theShape );
+ boolean DoubleNodeElemInRegion( in long_array theElems,
+ in long_array theNodesNot,
+ in GEOM::GEOM_Object theShape );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodes(), DoubleNodeGroups()
*/
- boolean DoubleNodeGroup( in SMESH_GroupBase theElems,
- in SMESH_GroupBase theNodesNot,
- in SMESH_GroupBase theAffectedElems );
+ boolean DoubleNodeElemGroup( in SMESH_GroupBase theElems,
+ in SMESH_GroupBase theNodesNot,
+ in SMESH_GroupBase theAffectedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
*/
- boolean DoubleNodeGroupInRegion( in SMESH_GroupBase theElems,
+ boolean DoubleNodeElemGroupInRegion( in SMESH_GroupBase theElems,
in SMESH_GroupBase theNodesNot,
in GEOM::GEOM_Object theShape );
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodes()
*/
- boolean DoubleNodeGroups( in ListOfGroups theElems,
- in ListOfGroups theNodesNot,
- in ListOfGroups theAffectedElems );
+ boolean DoubleNodeElemGroups( in ListOfGroups theElems,
+ in ListOfGroups theNodesNot,
+ in ListOfGroups theAffectedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
*/
- boolean DoubleNodeGroupsInRegion( in ListOfGroups theElems,
- in ListOfGroups theNodesNot,
- in GEOM::GEOM_Object theShape );
+ boolean DoubleNodeElemGroupsInRegion( in ListOfGroups theElems,
+ in ListOfGroups theNodesNot,
+ in GEOM::GEOM_Object theShape );
+
+ /*!
+ * \brief Generated skin mesh (containing 2D cells) from 3D mesh
+ * The created 2D mesh elements based on nodes of free faces of boundary volumes
+ * \return TRUE if operation has been completed successfully, FALSE otherwise
+ */
+ boolean Make2DMeshFrom3D();
};
};
mesh_tree_mesh_partial.png \
mesh_extractGroup.png \
mesh_precompute.png \
+ mesh_2d_from_3d.png \
mesh_free_faces.png
# VSR: little trick to avoid putting if SMESHCatalog.xml to the distribution archive
// SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
// if ( anIter != 0 ) {
// while( anIter->more() ) {
-// const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
-// if ( aNode == 0 )
-// return 0;
-// SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
-// while( anElemIter->more() ) {
-// const SMDS_MeshElement* anElem = anElemIter->next();
-// if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
-// int anId = anElem->GetID();
-
-// if ( anIter->more() ) // i.e. first node
-// aMap.Add( anId );
-// else if ( aMap.Contains( anId ) )
-// aResult++;
-// }
-// }
+// const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+// if ( aNode == 0 )
+// return 0;
+// SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
+// while( anElemIter->more() ) {
+// const SMDS_MeshElement* anElem = anElemIter->next();
+// if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
+// int anId = anElem->GetID();
+
+// if ( anIter->more() ) // i.e. first node
+// aMap.Add( anId );
+// else if ( aMap.Contains( anId ) )
+// aResult++;
+// }
+// }
// }
// }
inline double getArea(double theHalfPerim, double theTria[3]){
return sqrt(theHalfPerim*
- (theHalfPerim-theTria[0])*
- (theHalfPerim-theTria[1])*
- (theHalfPerim-theTria[2]));
+ (theHalfPerim-theTria[0])*
+ (theHalfPerim-theTria[1])*
+ (theHalfPerim-theTria[2]));
}
inline double getVolume(double theLen[6]){
case SMDSAbs_Node:
case SMDSAbs_Edge:
if (len == 2){
- aVal = getDistance( P( 1 ), P( 2 ) );
+ aVal = getDistance( P( 1 ), P( 2 ) );
break;
}
else if (len == 3){ // quadratic edge
- aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 ));
+ aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 ));
break;
}
case SMDSAbs_Face:
if (len == 3){ // triangles
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 1 ));
- aVal = Max(L1,Max(L2,L3));
- break;
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 1 ));
+ aVal = Max(L1,Max(L2,L3));
+ break;
}
else if (len == 4){ // quadrangles
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 1 ));
- aVal = Max(Max(L1,L2),Max(L3,L4));
- break;
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 1 ));
+ aVal = Max(Max(L1,L2),Max(L3,L4));
+ break;
}
if (len == 6){ // quadratic triangles
- double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
- double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
- double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 ));
- aVal = Max(L1,Max(L2,L3));
+ double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
+ double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
+ double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 ));
+ aVal = Max(L1,Max(L2,L3));
//cout<<"L1="<<L1<<" L2="<<L2<<"L3="<<L3<<" aVal="<<aVal<<endl;
- break;
+ break;
}
else if (len == 8){ // quadratic quadrangles
- double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
- double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
- double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 7 ));
- double L4 = getDistance(P( 7 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
- aVal = Max(Max(L1,L2),Max(L3,L4));
- break;
+ double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
+ double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
+ double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 7 ));
+ double L4 = getDistance(P( 7 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
+ aVal = Max(Max(L1,L2),Max(L3,L4));
+ break;
}
case SMDSAbs_Volume:
if (len == 4){ // tetraidrs
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 1 ));
- double L4 = getDistance(P( 1 ),P( 4 ));
- double L5 = getDistance(P( 2 ),P( 4 ));
- double L6 = getDistance(P( 3 ),P( 4 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- break;
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 1 ));
+ double L4 = getDistance(P( 1 ),P( 4 ));
+ double L5 = getDistance(P( 2 ),P( 4 ));
+ double L6 = getDistance(P( 3 ),P( 4 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ break;
}
else if (len == 5){ // piramids
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 1 ));
- double L4 = getDistance(P( 4 ),P( 1 ));
- double L5 = getDistance(P( 1 ),P( 5 ));
- double L6 = getDistance(P( 2 ),P( 5 ));
- double L7 = getDistance(P( 3 ),P( 5 ));
- double L8 = getDistance(P( 4 ),P( 5 ));
-
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- aVal = Max(aVal,Max(L7,L8));
- break;
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 1 ));
+ double L4 = getDistance(P( 4 ),P( 1 ));
+ double L5 = getDistance(P( 1 ),P( 5 ));
+ double L6 = getDistance(P( 2 ),P( 5 ));
+ double L7 = getDistance(P( 3 ),P( 5 ));
+ double L8 = getDistance(P( 4 ),P( 5 ));
+
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ aVal = Max(aVal,Max(L7,L8));
+ break;
}
else if (len == 6){ // pentaidres
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 1 ));
- double L4 = getDistance(P( 4 ),P( 5 ));
- double L5 = getDistance(P( 5 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 4 ));
- double L7 = getDistance(P( 1 ),P( 4 ));
- double L8 = getDistance(P( 2 ),P( 5 ));
- double L9 = getDistance(P( 3 ),P( 6 ));
-
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- aVal = Max(aVal,Max(Max(L7,L8),L9));
- break;
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 1 ));
+ double L4 = getDistance(P( 4 ),P( 5 ));
+ double L5 = getDistance(P( 5 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 4 ));
+ double L7 = getDistance(P( 1 ),P( 4 ));
+ double L8 = getDistance(P( 2 ),P( 5 ));
+ double L9 = getDistance(P( 3 ),P( 6 ));
+
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ aVal = Max(aVal,Max(Max(L7,L8),L9));
+ break;
}
else if (len == 8){ // hexaider
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 1 ));
- double L5 = getDistance(P( 5 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 7 ));
- double L7 = getDistance(P( 7 ),P( 8 ));
- double L8 = getDistance(P( 8 ),P( 5 ));
- double L9 = getDistance(P( 1 ),P( 5 ));
- double L10= getDistance(P( 2 ),P( 6 ));
- double L11= getDistance(P( 3 ),P( 7 ));
- double L12= getDistance(P( 4 ),P( 8 ));
-
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
- aVal = Max(aVal,Max(L11,L12));
- break;
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 1 ));
+ double L5 = getDistance(P( 5 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 7 ));
+ double L7 = getDistance(P( 7 ),P( 8 ));
+ double L8 = getDistance(P( 8 ),P( 5 ));
+ double L9 = getDistance(P( 1 ),P( 5 ));
+ double L10= getDistance(P( 2 ),P( 6 ));
+ double L11= getDistance(P( 3 ),P( 7 ));
+ double L12= getDistance(P( 4 ),P( 8 ));
+
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
+ aVal = Max(aVal,Max(L11,L12));
+ break;
}
if (len == 10){ // quadratic tetraidrs
- double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
- double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
- double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
- double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- break;
+ double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
+ double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
+ double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
+ double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ break;
}
else if (len == 13){ // quadratic piramids
- double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
- double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
- double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
- double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
- double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
- double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- aVal = Max(aVal,Max(L7,L8));
- break;
+ double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
+ double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
+ double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
+ double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
+ double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
+ double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ aVal = Max(aVal,Max(L7,L8));
+ break;
}
else if (len == 15){ // quadratic pentaidres
- double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
- double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
- double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
- double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
- double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
- double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- aVal = Max(aVal,Max(Max(L7,L8),L9));
- break;
+ double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
+ double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
+ double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
+ double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
+ double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
+ double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ aVal = Max(aVal,Max(Max(L7,L8),L9));
+ break;
}
else if (len == 20){ // quadratic hexaider
- double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
- double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
- double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
- double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
- double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
- double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
- double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
- double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
- aVal = Max(aVal,Max(L11,L12));
- break;
+ double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
+ double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
+ double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
+ double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
+ double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
+ double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
+ double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
+ double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
+ aVal = Max(aVal,Max(L11,L12));
+ break;
}
Value aValue(aNodeId[1],aNodeId[2]);
MValues::iterator aItr = theValues.find(aValue);
if (aItr != theValues.end()){
- aItr->second += 1;
- //aNbConnects = nb;
+ aItr->second += 1;
+ //aNbConnects = nb;
}
else {
- theValues[aValue] = 1;
- //aNbConnects = 1;
+ theValues[aValue] = 1;
+ //aNbConnects = 1;
}
//cout << "NodeIds: "<<aNodeId[1]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
aNodeId[1] = aNodeId[2];
}
inline void UpdateBorders(const FreeEdges::Border& theBorder,
- FreeEdges::TBorders& theRegistry,
- FreeEdges::TBorders& theContainer)
+ FreeEdges::TBorders& theRegistry,
+ FreeEdges::TBorders& theContainer)
{
if(theRegistry.find(theBorder) == theRegistry.end()){
theRegistry.insert(theBorder);
{
if (!myMesh) return false;
const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
+ if ( !anElem )
+ return false;
const SMDSAbs_ElementType anElemType = anElem->GetType();
- if ( !anElem || (myType != SMDSAbs_All && anElemType != myType) )
+ if ( myType != SMDSAbs_All && anElemType != myType )
return false;
const int aNbNode = anElem->NbNodes();
bool isOk = false;
template<class TElement, class TIterator, class TPredicate>
inline void FillSequence(const TIterator& theIterator,
- TPredicate& thePredicate,
- Filter::TIdSequence& theSequence)
+ TPredicate& thePredicate,
+ Filter::TIdSequence& theSequence)
{
if ( theIterator ) {
while( theIterator->more() ) {
TElement anElem = theIterator->next();
long anId = anElem->GetID();
if ( thePredicate->IsSatisfy( anId ) )
- theSequence.push_back( anId );
+ theSequence.push_back( anId );
}
}
}
void
Filter::
GetElementsId( const SMDS_Mesh* theMesh,
- PredicatePtr thePredicate,
- TIdSequence& theSequence )
+ PredicatePtr thePredicate,
+ TIdSequence& theSequence )
{
theSequence.clear();
void
Filter::GetElementsId( const SMDS_Mesh* theMesh,
- Filter::TIdSequence& theSequence )
+ Filter::TIdSequence& theSequence )
{
GetElementsId(theMesh,myPredicate,theSequence);
}
TSequenceOfXYZ::TSequenceOfXYZ()
{}
-TSequenceOfXYZ::TSequenceOfXYZ(size_type n) : std::vector<gp_XYZ>(n)
+TSequenceOfXYZ::TSequenceOfXYZ(size_type n) : myArray(n)
{}
-TSequenceOfXYZ::TSequenceOfXYZ(size_type n, const value_type& t) : std::vector<gp_XYZ>(n,t)
+TSequenceOfXYZ::TSequenceOfXYZ(size_type n, const gp_XYZ& t) : myArray(n,t)
{}
-TSequenceOfXYZ::TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ) : std::vector<gp_XYZ>(theSequenceOfXYZ)
+TSequenceOfXYZ::TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ) : myArray(theSequenceOfXYZ.myArray)
{}
template <class InputIterator>
-TSequenceOfXYZ::TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd): std::vector<gp_XYZ>(theBegin,theEnd)
+TSequenceOfXYZ::TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd): myArray(theBegin,theEnd)
+{}
+
+TSequenceOfXYZ::~TSequenceOfXYZ()
{}
TSequenceOfXYZ& TSequenceOfXYZ::operator=(const TSequenceOfXYZ& theSequenceOfXYZ)
{
- std::vector<gp_XYZ>::operator=(theSequenceOfXYZ);
+ myArray = theSequenceOfXYZ.myArray;
return *this;
}
-std::vector<gp_XYZ>::reference TSequenceOfXYZ::operator()(size_type n)
+gp_XYZ& TSequenceOfXYZ::operator()(size_type n)
+{
+ return myArray[n-1];
+}
+
+const gp_XYZ& TSequenceOfXYZ::operator()(size_type n) const
+{
+ return myArray[n-1];
+}
+
+void TSequenceOfXYZ::clear()
+{
+ myArray.clear();
+}
+
+void TSequenceOfXYZ::reserve(size_type n)
+{
+ myArray.reserve(n);
+}
+
+void TSequenceOfXYZ::push_back(const gp_XYZ& v)
{
- return std::vector<gp_XYZ>::operator[](n-1);
+ myArray.push_back(v);
}
-std::vector<gp_XYZ>::const_reference TSequenceOfXYZ::operator()(size_type n) const
+TSequenceOfXYZ::size_type TSequenceOfXYZ::size() const
{
- return std::vector<gp_XYZ>::operator[](n-1);
+ return myArray.size();
}
namespace SMESH{
namespace Controls{
- class SMESHCONTROLS_EXPORT TSequenceOfXYZ: public std::vector<gp_XYZ>
+ class SMESHCONTROLS_EXPORT TSequenceOfXYZ
{
+ typedef std::vector<gp_XYZ>::size_type size_type;
+
public:
TSequenceOfXYZ();
TSequenceOfXYZ(size_type n);
- TSequenceOfXYZ(size_type n, const value_type& t);
+ TSequenceOfXYZ(size_type n, const gp_XYZ& t);
TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ);
template <class InputIterator>
TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd);
+ ~TSequenceOfXYZ();
+
TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ);
- reference operator()(size_type n);
+ gp_XYZ& operator()(size_type n);
- const_reference operator()(size_type n) const;
+ const gp_XYZ& operator()(size_type n) const;
- private:
- reference operator[](size_type n);
+ void clear();
+
+ void reserve(size_type n);
- const_reference operator[](size_type n) const;
+ void push_back(const gp_XYZ& v);
+
+ size_type size() const;
+
+ private:
+ std::vector<gp_XYZ> myArray;
};
/*
void SetPrecision( const long thePrecision );
bool GetPoints(const int theId,
- TSequenceOfXYZ& theRes) const;
+ TSequenceOfXYZ& theRes) const;
static bool GetPoints(const SMDS_MeshElement* theElem,
- TSequenceOfXYZ& theRes);
+ TSequenceOfXYZ& theRes);
protected:
const SMDS_Mesh* myMesh;
const SMDS_MeshElement* myCurrElement;
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
struct Value{
- double myLength;
- long myPntId[2];
- Value(double theLength, long thePntId1, long thePntId2);
- bool operator<(const Value& x) const;
+ double myLength;
+ long myPntId[2];
+ Value(double theLength, long thePntId1, long thePntId2);
+ bool operator<(const Value& x) const;
};
typedef std::set<Value> TValues;
void GetValues(TValues& theValues);
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
struct Value{
- long myPntId[2];
- Value(long thePntId1, long thePntId2);
- bool operator<(const Value& x) const;
+ long myPntId[2];
+ Value(long thePntId1, long thePntId2);
+ bool operator<(const Value& x) const;
};
typedef std::map<Value,int> MValues;
static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
typedef long TElemId;
struct Border{
- TElemId myElemId;
- TElemId myPntId[2];
- Border(long theElemId, long thePntId1, long thePntId2);
- bool operator<(const Border& x) const;
+ TElemId myElemId;
+ TElemId myPntId[2];
+ Border(long theElemId, long thePntId1, long thePntId2);
+ bool operator<(const Border& x) const;
};
typedef std::set<Border> TBorders;
void GetBoreders(TBorders& theBorders);
virtual
void
GetElementsId( const SMDS_Mesh* theMesh,
- TIdSequence& theSequence );
+ TIdSequence& theSequence );
static
void
GetElementsId( const SMDS_Mesh* theMesh,
- PredicatePtr thePredicate,
- TIdSequence& theSequence );
+ PredicatePtr thePredicate,
+ TIdSequence& theSequence );
protected:
PredicatePtr myPredicate;
#include "utilities.h"
+#include <Basics_Utils.hxx>
+
using namespace std;
Driver_Mesh::Status DriverDAT_R_SMDS_Mesh::Perform()
{
+ Kernel_Utils::Localizer loc;
Status aResult = DRS_OK;
int i, j;
#include "utilities.h"
+#include <Basics_Utils.hxx>
+
using namespace std;
Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
{
+ Kernel_Utils::Localizer loc;
Status aResult = DRS_OK;
int nbNodes, nbCells;
libMeshDriverDAT_la_LDFLAGS = \
../Driver/libMeshDriver.la \
+ $(KERNEL_LDFLAGS) -lSALOMEBasics \
$(CAS_KERNEL)
DAT_Test_CPPFLAGS = \
#include "DriverMED_Family.h"
#include "MED_Factory.hxx"
-#include <sstream>
+#include <sstream>
using namespace std;
DriverMED_Family
::SetType(const SMDSAbs_ElementType theType)
{
- myType = theType;
+ myTypes.insert( myType = theType );
}
SMDSAbs_ElementType
return myType;
}
+const std::set< SMDSAbs_ElementType >&
+DriverMED_Family
+::GetTypes() const
+{
+ return myTypes;
+}
+
bool
DriverMED_Family
::MemberOf(std::string theGroupName) const
DriverMED_FamilyPtrList
DriverMED_Family
::MakeFamilies(const SMESHDS_SubMeshPtrMap& theSubMeshes,
- const SMESHDS_GroupBasePtrList& theGroups,
- const bool doGroupOfNodes,
- const bool doGroupOfEdges,
- const bool doGroupOfFaces,
- const bool doGroupOfVolumes)
+ const SMESHDS_GroupBasePtrList& theGroups,
+ const bool doGroupOfNodes,
+ const bool doGroupOfEdges,
+ const bool doGroupOfFaces,
+ const bool doGroupOfVolumes)
{
DriverMED_FamilyPtrList aFamilies;
aFamilies.erase(aCurrIter);
}
if (aFam2->IsEmpty())
- break;
+ break;
}
}
// The rest elements of family
aFam1->Split(aFam2, aCommon);
if (!aCommon->IsEmpty())
{
- aCommon->SetGroupAttributVal(0);
+ aCommon->SetGroupAttributVal(0);
aFamilies.push_back(aCommon);
}
if (aFam1->IsEmpty())
aFamilies.erase(aCurrIter);
}
if (aFam2->IsEmpty())
- break;
+ break;
}
}
// The rest elements of group
//=============================================================================
MED::PFamilyInfo
DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
- const MED::PMeshInfo& theMeshInfo) const
+ const MED::PMeshInfo& theMeshInfo) const
{
ostringstream aStr;
aStr << "FAM_" << myId;
MED::PFamilyInfo anInfo;
if(myId == 0 || myGroupAttributVal == 0){
anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
- aValue,
- myId,
- myGroupNames);
+ aValue,
+ myId,
+ myGroupNames);
}else{
MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description,
MED::TIntVector anAttrIds (1, myId); // Id=0,
MED::TIntVector anAttrVals (1, myGroupAttributVal);
anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
- aValue,
- myId,
- myGroupNames,
- anAttrDescs,
- anAttrIds,
- anAttrVals);
+ aValue,
+ myId,
+ myGroupNames,
+ anAttrDescs,
+ anAttrIds,
+ anAttrVals);
}
// cout << endl;
DriverMED_FamilyPtrList
DriverMED_Family
::SplitByType (SMESHDS_SubMesh* theSubMesh,
- const int theId)
+ const int theId)
{
DriverMED_FamilyPtrList aFamilies;
DriverMED_FamilyPtr aNodesFamily (new DriverMED_Family);
static
DriverMED_FamilyPtrList
MakeFamilies (const SMESHDS_SubMeshPtrMap& theSubMeshes,
- const SMESHDS_GroupBasePtrList& theGroups,
- const bool doGroupOfNodes,
- const bool doGroupOfEdges,
- const bool doGroupOfFaces,
- const bool doGroupOfVolumes);
+ const SMESHDS_GroupBasePtrList& theGroups,
+ const bool doGroupOfNodes,
+ const bool doGroupOfEdges,
+ const bool doGroupOfFaces,
+ const bool doGroupOfVolumes);
//! Create TFamilyInfo for this family
MED::PFamilyInfo
GetFamilyInfo (const MED::PWrapper& theWrapper,
- const MED::PMeshInfo& theMeshInfo) const;
+ const MED::PMeshInfo& theMeshInfo) const;
//! Returns elements of this family
const ElementsSet& GetElements () const;
void SetType(const SMDSAbs_ElementType theType);
SMDSAbs_ElementType GetType();
+ const std::set< SMDSAbs_ElementType >& GetTypes() const;
bool MemberOf(std::string theGroupName) const;
static
DriverMED_FamilyPtrList
SplitByType(SMESHDS_SubMesh* theSubMesh,
- const int theId);
+ const int theId);
/*! Remove from <Elements> elements, common with <by>,
Create family <common> from common elements, with combined groups list.
*/
void Split (DriverMED_FamilyPtr by,
- DriverMED_FamilyPtr common);
+ DriverMED_FamilyPtr common);
//! Check, if this family has empty list of elements
bool IsEmpty () const;
ElementsSet myElements;
MED::TStringSet myGroupNames;
int myGroupAttributVal;
+ std::set<SMDSAbs_ElementType> myTypes; // Issue 0020576
};
#endif
#define _EDF_NODE_IDS_
using namespace MED;
+using namespace std;
void
DriverMED_R_SMESHDS_Mesh
-::SetMeshName(std::string theMeshName)
+::SetMeshName(string theMeshName)
{
myMeshName = theMeshName;
}
FindNode(const SMDS_Mesh* theMesh, TInt theId){
const SMDS_MeshNode* aNode = theMesh->FindNode(theId);
if(aNode) return aNode;
- EXCEPTION(std::runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
+ EXCEPTION(runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
}
aResult = DRS_EMPTY;
if(TInt aNbMeshes = aMed->GetNbMeshes()){
for(int iMesh = 0; iMesh < aNbMeshes; iMesh++){
- // Reading the MED mesh
- //---------------------
- PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
+ // Reading the MED mesh
+ //---------------------
+ PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
- std::string aMeshName;
+ string aMeshName;
if (myMeshId != -1) {
- std::ostringstream aMeshNameStr;
+ ostringstream aMeshNameStr;
aMeshNameStr<<myMeshId;
aMeshName = aMeshNameStr.str();
} else {
aMeshName = myMeshName;
}
- if(MYDEBUG) MESSAGE("Perform - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
- if(aMeshName != aMeshInfo->GetName()) continue;
+ if(MYDEBUG) MESSAGE("Perform - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
+ if(aMeshName != aMeshInfo->GetName()) continue;
aResult = DRS_OK;
- //TInt aMeshDim = aMeshInfo->GetDim();
-
+ //TInt aMeshDim = aMeshInfo->GetDim();
+
// Reading MED families to the temporary structure
- //------------------------------------------------
- TErr anErr;
- TInt aNbFams = aMed->GetNbFamilies(aMeshInfo);
+ //------------------------------------------------
+ TErr anErr;
+ TInt aNbFams = aMed->GetNbFamilies(aMeshInfo);
if(MYDEBUG) MESSAGE("Read " << aNbFams << " families");
for (TInt iFam = 0; iFam < aNbFams; iFam++) {
- PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo,iFam+1,&anErr);
- if(anErr >= 0){
- TInt aFamId = aFamilyInfo->GetId();
- if(MYDEBUG) MESSAGE("Family " << aFamId << " :");
-
+ PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo,iFam+1,&anErr);
+ if(anErr >= 0){
+ TInt aFamId = aFamilyInfo->GetId();
+ if(MYDEBUG) MESSAGE("Family " << aFamId << " :");
+
DriverMED_FamilyPtr aFamily (new DriverMED_Family);
-
+
TInt aNbGrp = aFamilyInfo->GetNbGroup();
if(MYDEBUG) MESSAGE("belong to " << aNbGrp << " groups");
- bool isAttrOk = false;
- if(aFamilyInfo->GetNbAttr() == aNbGrp)
- isAttrOk = true;
+ bool isAttrOk = false;
+ if(aFamilyInfo->GetNbAttr() == aNbGrp)
+ isAttrOk = true;
for (TInt iGr = 0; iGr < aNbGrp; iGr++) {
- std::string aGroupName = aFamilyInfo->GetGroupName(iGr);
+ string aGroupName = aFamilyInfo->GetGroupName(iGr);
if(isAttrOk){
- TInt anAttrVal = aFamilyInfo->GetAttrVal(iGr);
- aFamily->SetGroupAttributVal(anAttrVal);
- }
-
+ TInt anAttrVal = aFamilyInfo->GetAttrVal(iGr);
+ aFamily->SetGroupAttributVal(anAttrVal);
+ }
+
if(MYDEBUG) MESSAGE(aGroupName);
aFamily->AddGroupName(aGroupName);
-
+
}
aFamily->SetId( aFamId );
myFamilies[aFamId] = aFamily;
- }
+ }
}
- if (aMeshInfo->GetType() == MED::eSTRUCTURE){
- /*bool aRes = */buildMeshGrille(aMed,aMeshInfo);
- continue;
- }
+ if (aMeshInfo->GetType() == MED::eSTRUCTURE){
+ /*bool aRes = */buildMeshGrille(aMed,aMeshInfo);
+ continue;
+ }
// Reading MED nodes to the corresponding SMDS structure
- //------------------------------------------------------
+ //------------------------------------------------------
PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
- if (!aNodeInfo) {
+ if (!aNodeInfo) {
aResult = DRS_FAIL;
- continue;
+ continue;
}
- PCoordHelper aCoordHelper = GetCoordHelper(aNodeInfo);
+ PCoordHelper aCoordHelper = GetCoordHelper(aNodeInfo);
- EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
- TInt aNbElems = aNodeInfo->GetNbElem();
- if(MYDEBUG) MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum);
+ EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
+ TInt aNbElems = aNodeInfo->GetNbElem();
+ if(MYDEBUG) MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum);
DriverMED_FamilyPtr aFamily;
for(TInt iElem = 0; iElem < aNbElems; iElem++){
- TCCoordSlice aCoordSlice = aNodeInfo->GetCoordSlice(iElem);
+ TCCoordSlice aCoordSlice = aNodeInfo->GetCoordSlice(iElem);
double aCoords[3] = {0.0, 0.0, 0.0};
for(TInt iDim = 0; iDim < 3; iDim++)
aCoords[iDim] = aCoordHelper->GetCoord(aCoordSlice,iDim);
const SMDS_MeshNode* aNode;
if(anIsNodeNum) {
- aNode = myMesh->AddNodeWithID
+ aNode = myMesh->AddNodeWithID
(aCoords[0],aCoords[1],aCoords[2],aNodeInfo->GetElemNum(iElem));
} else {
- aNode = myMesh->AddNode
+ aNode = myMesh->AddNode
(aCoords[0],aCoords[1],aCoords[2]);
}
//cout<<aNode->GetID()<<": "<<aNode->X()<<", "<<aNode->Y()<<", "<<aNode->Z()<<endl;
}
}
- // Reading pre information about all MED cells
- //--------------------------------------------
- typedef MED::TVector<int> TNodeIds;
+ // Reading pre information about all MED cells
+ //--------------------------------------------
+ typedef MED::TVector<int> TNodeIds;
bool takeNumbers = true; // initially we trust the numbers from file
- MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
- MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
- for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
- const EEntiteMaillage& anEntity = anEntityIter->first;
- if(anEntity == eNOEUD) continue;
- // Reading MED cells to the corresponding SMDS structure
- //------------------------------------------------------
- const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
- MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
- for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
- const EGeometrieElement& aGeom = aGeom2SizeIter->first;
-
- switch(aGeom) {
-// case ePOINT1: ## PAL16410
-// break;
- case ePOLYGONE: {
+ MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+ MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
+ for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
+ const EEntiteMaillage& anEntity = anEntityIter->first;
+ if(anEntity == eNOEUD) continue;
+ // Reading MED cells to the corresponding SMDS structure
+ //------------------------------------------------------
+ const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
+ MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
+ for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
+ const EGeometrieElement& aGeom = aGeom2SizeIter->first;
+
+ switch(aGeom) {
+// case ePOINT1: ## PAL16410
+// break;
+ case ePOLYGONE: {
PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom);
EBooleen anIsElemNum = takeNumbers ? aPolygoneInfo->IsElemNum() : eFAUX;
-
- TInt aNbElem = aPolygoneInfo->GetNbElem();
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
- TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
- TNodeIds aNodeIds(aNbConn);
+
+ TInt aNbElem = aPolygoneInfo->GetNbElem();
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
+ TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
+ TNodeIds aNodeIds(aNbConn);
#ifdef _EDF_NODE_IDS_
- if(anIsNodeNum)
- for(TInt iConn = 0; iConn < aNbConn; iConn++)
- aNodeIds[iConn] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1);
- else
- for(TInt iConn = 0; iConn < aNbConn; iConn++)
- aNodeIds[iConn] = aConnSlice[iConn];
+ if(anIsNodeNum)
+ for(TInt iConn = 0; iConn < aNbConn; iConn++)
+ aNodeIds[iConn] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1);
+ else
+ for(TInt iConn = 0; iConn < aNbConn; iConn++)
+ aNodeIds[iConn] = aConnSlice[iConn];
#else
- for(TInt iConn = 0; iConn < aNbConn; iConn++)
- aNodeIds[iConn] = aConnSlice[iConn];
+ for(TInt iConn = 0; iConn < aNbConn; iConn++)
+ aNodeIds[iConn] = aConnSlice[iConn];
#endif
bool isRenum = false;
SMDS_MeshElement* anElement = NULL;
try{
#endif
if(anIsElemNum){
- TInt anElemId = aPolygoneInfo->GetElemNum(iElem);
+ TInt anElemId = aPolygoneInfo->GetElemNum(iElem);
anElement = myMesh->AddPolygonalFaceWithID(aNodeIds,anElemId);
- }
+ }
if(!anElement){
- std::vector<const SMDS_MeshNode*> aNodes(aNbConn);
- for(TInt iConn = 0; iConn < aNbConn; iConn++)
+ vector<const SMDS_MeshNode*> aNodes(aNbConn);
+ for(TInt iConn = 0; iConn < aNbConn; iConn++)
aNodes[iConn] = FindNode(myMesh,aNodeIds[iConn]);
anElement = myMesh->AddPolygonalFace(aNodes);
isRenum = anIsElemNum;
}
}
break;
- }
- case ePOLYEDRE: {
+ }
+ case ePOLYEDRE: {
PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,anEntity,aGeom);
EBooleen anIsElemNum = takeNumbers ? aPolyedreInfo->IsElemNum() : eFAUX;
- TInt aNbElem = aPolyedreInfo->GetNbElem();
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
- TInt aNbFaces = aConnSliceArr.size();
+ TInt aNbElem = aPolyedreInfo->GetNbElem();
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
+ TInt aNbFaces = aConnSliceArr.size();
typedef MED::TVector<int> TQuantities;
- TQuantities aQuantities(aNbFaces);
- TInt aNbNodes = aPolyedreInfo->GetNbNodes(iElem);
- TNodeIds aNodeIds(aNbNodes);
- for(TInt iFace = 0, iNode = 0; iFace < aNbFaces; iFace++){
- MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
- TInt aNbConn = aConnSlice.size();
+ TQuantities aQuantities(aNbFaces);
+ TInt aNbNodes = aPolyedreInfo->GetNbNodes(iElem);
+ TNodeIds aNodeIds(aNbNodes);
+ for(TInt iFace = 0, iNode = 0; iFace < aNbFaces; iFace++){
+ MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
+ TInt aNbConn = aConnSlice.size();
aQuantities[iFace] = aNbConn;
#ifdef _EDF_NODE_IDS_
- if(anIsNodeNum)
- for(TInt iConn = 0; iConn < aNbConn; iConn++)
- aNodeIds[iNode++] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1);
- else
- for(TInt iConn = 0; iConn < aNbConn; iConn++)
- aNodeIds[iNode++] = aConnSlice[iConn];
+ if(anIsNodeNum)
+ for(TInt iConn = 0; iConn < aNbConn; iConn++)
+ aNodeIds[iNode++] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1);
+ else
+ for(TInt iConn = 0; iConn < aNbConn; iConn++)
+ aNodeIds[iNode++] = aConnSlice[iConn];
#else
- for(TInt iConn = 0; iConn < aNbConn; iConn++)
- aNodeIds[iNode++] = aConnSlice[iConn];
-#endif
- }
-
- bool isRenum = false;
- SMDS_MeshElement* anElement = NULL;
- TInt aFamNum = aPolyedreInfo->GetFamNum(iElem);
-
+ for(TInt iConn = 0; iConn < aNbConn; iConn++)
+ aNodeIds[iNode++] = aConnSlice[iConn];
+#endif
+ }
+
+ bool isRenum = false;
+ SMDS_MeshElement* anElement = NULL;
+ TInt aFamNum = aPolyedreInfo->GetFamNum(iElem);
+
#ifndef _DEXCEPT_
- try{
+ try{
#endif
- if(anIsElemNum){
- TInt anElemId = aPolyedreInfo->GetElemNum(iElem);
- anElement = myMesh->AddPolyhedralVolumeWithID(aNodeIds,aQuantities,anElemId);
- }
- if(!anElement){
- std::vector<const SMDS_MeshNode*> aNodes(aNbNodes);
- for(TInt iConn = 0; iConn < aNbNodes; iConn++)
- aNodes[iConn] = FindNode(myMesh,aNodeIds[iConn]);
- anElement = myMesh->AddPolyhedralVolume(aNodes,aQuantities);
- isRenum = anIsElemNum;
- }
+ if(anIsElemNum){
+ TInt anElemId = aPolyedreInfo->GetElemNum(iElem);
+ anElement = myMesh->AddPolyhedralVolumeWithID(aNodeIds,aQuantities,anElemId);
+ }
+ if(!anElement){
+ vector<const SMDS_MeshNode*> aNodes(aNbNodes);
+ for(TInt iConn = 0; iConn < aNbNodes; iConn++)
+ aNodes[iConn] = FindNode(myMesh,aNodeIds[iConn]);
+ anElement = myMesh->AddPolyhedralVolume(aNodes,aQuantities);
+ isRenum = anIsElemNum;
+ }
#ifndef _DEXCEPT_
- }catch(const std::exception& exc){
- aResult = DRS_FAIL;
- }catch(...){
- aResult = DRS_FAIL;
- }
-#endif
- if(!anElement){
- aResult = DRS_WARN_SKIP_ELEM;
- }else{
- if(isRenum){
- anIsElemNum = eFAUX;
- takeNumbers = false;
- if (aResult < DRS_WARN_RENUMBER)
- aResult = DRS_WARN_RENUMBER;
- }
- if ( checkFamilyID ( aFamily, aFamNum )) {
- // Save reference to this element from its family
- aFamily->AddElement(anElement);
- aFamily->SetType(anElement->GetType());
- }
- }
- }
+ }catch(const std::exception& exc){
+ aResult = DRS_FAIL;
+ }catch(...){
+ aResult = DRS_FAIL;
+ }
+#endif
+ if(!anElement){
+ aResult = DRS_WARN_SKIP_ELEM;
+ }else{
+ if(isRenum){
+ anIsElemNum = eFAUX;
+ takeNumbers = false;
+ if (aResult < DRS_WARN_RENUMBER)
+ aResult = DRS_WARN_RENUMBER;
+ }
+ if ( checkFamilyID ( aFamily, aFamNum )) {
+ // Save reference to this element from its family
+ aFamily->AddElement(anElement);
+ aFamily->SetType(anElement->GetType());
+ }
+ }
+ }
break;
}
- default: {
+ default: {
PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX;
TInt aNbElems = aCellInfo->GetNbElem();
if(MYDEBUG) MESSAGE("Perform - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum);
if(MYDEBUG) MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems);
+ TInt aNbNodes = -1;
+ switch(aGeom){
+ case eSEG2: aNbNodes = 2; break;
+ case eSEG3: aNbNodes = 3; break;
+ case eTRIA3: aNbNodes = 3; break;
+ case eTRIA6: aNbNodes = 6; break;
+ case eQUAD4: aNbNodes = 4; break;
+ case eQUAD8: aNbNodes = 8; break;
+ case eTETRA4: aNbNodes = 4; break;
+ case eTETRA10: aNbNodes = 10; break;
+ case ePYRA5: aNbNodes = 5; break;
+ case ePYRA13: aNbNodes = 13; break;
+ case ePENTA6: aNbNodes = 6; break;
+ case ePENTA15: aNbNodes = 15; break;
+ case eHEXA8: aNbNodes = 8; break;
+ case eHEXA20: aNbNodes = 20; break;
+ case ePOINT1: aNbNodes = 1; break;
+ default:;
+ }
+ vector<TInt> aNodeIds(aNbNodes);
for(int iElem = 0; iElem < aNbElems; iElem++){
- TInt aNbNodes = -1;
- switch(aGeom){
- case eSEG2: aNbNodes = 2; break;
- case eSEG3: aNbNodes = 3; break;
- case eTRIA3: aNbNodes = 3; break;
- case eTRIA6: aNbNodes = 6; break;
- case eQUAD4: aNbNodes = 4; break;
- case eQUAD8: aNbNodes = 8; break;
- case eTETRA4: aNbNodes = 4; break;
- case eTETRA10: aNbNodes = 10; break;
- case ePYRA5: aNbNodes = 5; break;
- case ePYRA13: aNbNodes = 13; break;
- case ePENTA6: aNbNodes = 6; break;
- case ePENTA15: aNbNodes = 15; break;
- case eHEXA8: aNbNodes = 8; break;
- case eHEXA20: aNbNodes = 20; break;
- case ePOINT1: aNbNodes = 1; break;
- default:;
- }
- std::vector<TInt> aNodeIds(aNbNodes);
bool anIsValidConnect = false;
TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
#ifndef _DEXCEPT_
return aResult;
}
-std::list<std::string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
+list<string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
{
- std::list<std::string> aMeshNames;
+ list<string> aMeshNames;
try {
if(MYDEBUG) MESSAGE("GetMeshNames - myFile : " << myFile);
if (TInt aNbMeshes = aMed->GetNbMeshes()) {
for (int iMesh = 0; iMesh < aNbMeshes; iMesh++) {
- // Reading the MED mesh
- //---------------------
- PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
- aMeshNames.push_back(aMeshInfo->GetName());
+ // Reading the MED mesh
+ //---------------------
+ PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
+ aMeshNames.push_back(aMeshInfo->GetName());
}
}
}catch(const std::exception& exc){
return aMeshNames;
}
-std::list<TNameAndType> DriverMED_R_SMESHDS_Mesh::GetGroupNamesAndTypes()
+list<TNameAndType> DriverMED_R_SMESHDS_Mesh::GetGroupNamesAndTypes()
{
- std::list<TNameAndType> aResult;
- std::set<TNameAndType> aResGroupNames;
+ list<TNameAndType> aResult;
+ set<TNameAndType> aResGroupNames;
- std::map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
+ map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
for (; aFamsIter != myFamilies.end(); aFamsIter++)
{
DriverMED_FamilyPtr aFamily = (*aFamsIter).second;
const MED::TStringSet& aGroupNames = aFamily->GetGroupNames();
- std::set<std::string>::const_iterator aGrNamesIter = aGroupNames.begin();
+ set<string>::const_iterator aGrNamesIter = aGroupNames.begin();
for (; aGrNamesIter != aGroupNames.end(); aGrNamesIter++)
{
- TNameAndType aNameAndType = make_pair( *aGrNamesIter, aFamily->GetType() );
- // Check, if this is a Group or SubMesh name
-//if (aName.substr(0, 5) == string("Group")) {
+ const set< SMDSAbs_ElementType >& types = aFamily->GetTypes();
+ set< SMDSAbs_ElementType >::const_iterator type = types.begin();
+ for ( ; type != types.end(); ++type )
+ {
+ TNameAndType aNameAndType = make_pair( *aGrNamesIter, *type );
if ( aResGroupNames.insert( aNameAndType ).second ) {
aResult.push_back( aNameAndType );
}
-// }
+ }
}
}
void DriverMED_R_SMESHDS_Mesh::GetGroup(SMESHDS_Group* theGroup)
{
- std::string aGroupName (theGroup->GetStoreName());
+ string aGroupName (theGroup->GetStoreName());
if(MYDEBUG) MESSAGE("Get Group " << aGroupName);
- std::map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
+ map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
for (; aFamsIter != myFamilies.end(); aFamsIter++)
{
DriverMED_FamilyPtr aFamily = (*aFamsIter).second;
- if (aFamily->GetType() == theGroup->GetType() && aFamily->MemberOf(aGroupName))
+ if (aFamily->GetTypes().count( theGroup->GetType() ) && aFamily->MemberOf(aGroupName))
{
- const std::set<const SMDS_MeshElement *>& anElements = aFamily->GetElements();
- std::set<const SMDS_MeshElement *>::const_iterator anElemsIter = anElements.begin();
- const SMDS_MeshElement * element = 0;
+ const set<const SMDS_MeshElement *>& anElements = aFamily->GetElements();
+ set<const SMDS_MeshElement *>::const_iterator anElemsIter = anElements.begin();
for (; anElemsIter != anElements.end(); anElemsIter++)
{
- element = *anElemsIter;
- theGroup->SMDSGroup().Add(element);
- int aGroupAttrVal = aFamily->GetGroupAttributVal();
- if( aGroupAttrVal != 0)
- theGroup->SetColorGroup(aGroupAttrVal);
+ const SMDS_MeshElement * element = *anElemsIter;
+ if ( element->GetType() == theGroup->GetType() ) // Issue 0020576
+ theGroup->SMDSGroup().Add(element);
}
- if ( element )
- theGroup->SetType( theGroup->SMDSGroup().GetType() );
+ int aGroupAttrVal = aFamily->GetGroupAttributVal();
+ if( aGroupAttrVal != 0)
+ theGroup->SetColorGroup(aGroupAttrVal);
+// if ( element ) -- Issue 0020576
+// theGroup->SetType( theGroup->SMDSGroup().GetType() );
}
}
}
{
char submeshGrpName[ 30 ];
sprintf( submeshGrpName, "SubMesh %d", theId );
- std::string aName (submeshGrpName);
- std::map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
+ string aName (submeshGrpName);
+ map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
for (; aFamsIter != myFamilies.end(); aFamsIter++)
{
DriverMED_FamilyPtr aFamily = (*aFamsIter).second;
if (aFamily->MemberOf(aName))
{
- const std::set<const SMDS_MeshElement *>& anElements = aFamily->GetElements();
- std::set<const SMDS_MeshElement *>::const_iterator anElemsIter = anElements.begin();
+ const set<const SMDS_MeshElement *>& anElements = aFamily->GetElements();
+ set<const SMDS_MeshElement *>::const_iterator anElemsIter = anElements.begin();
if (aFamily->GetType() == SMDSAbs_Node)
{
for (; anElemsIter != anElements.end(); anElemsIter++)
void DriverMED_R_SMESHDS_Mesh::CreateAllSubMeshes ()
{
- std::map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
+ map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
for (; aFamsIter != myFamilies.end(); aFamsIter++)
{
DriverMED_FamilyPtr aFamily = (*aFamsIter).second;
MED::TStringSet aGroupNames = aFamily->GetGroupNames();
- std::set<std::string>::iterator aGrNamesIter = aGroupNames.begin();
+ set<string>::iterator aGrNamesIter = aGroupNames.begin();
for (; aGrNamesIter != aGroupNames.end(); aGrNamesIter++)
{
- std::string aName = *aGrNamesIter;
+ string aName = *aGrNamesIter;
// Check, if this is a Group or SubMesh name
- if (aName.substr(0, 7) == std::string("SubMesh"))
+ if (aName.substr(0, 7) == string("SubMesh"))
{
- int Id = atoi(std::string(aName).substr(7).c_str());
- std::set<const SMDS_MeshElement *> anElements = aFamily->GetElements();
- std::set<const SMDS_MeshElement *>::iterator anElemsIter = anElements.begin();
+ int Id = atoi(string(aName).substr(7).c_str());
+ set<const SMDS_MeshElement *> anElements = aFamily->GetElements();
+ set<const SMDS_MeshElement *>::iterator anElemsIter = anElements.begin();
if (aFamily->GetType() == SMDSAbs_Node)
{
for (; anElemsIter != anElements.end(); anElemsIter++)
bool DriverMED_R_SMESHDS_Mesh::checkFamilyID(DriverMED_FamilyPtr & aFamily, int anID) const
{
if ( !aFamily || aFamily->GetId() != anID ) {
- std::map<int, DriverMED_FamilyPtr>::const_iterator i_fam = myFamilies.find(anID);
+ map<int, DriverMED_FamilyPtr>::const_iterator i_fam = myFamilies.find(anID);
if ( i_fam == myFamilies.end() )
return false;
aFamily = i_fam->second;
* \return TRUE, if successfully. Else FALSE
*/
bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
- const MED::PMeshInfo& theMeshInfo)
+ const MED::PMeshInfo& theMeshInfo)
{
bool res = true;
if((aGrilleInfo->myFamNumNode).size() > 0){
TInt aFamNum = aGrilleInfo->GetFamNumNode(iNode);
if ( checkFamilyID ( aFamily, aFamNum ))
- {
- aFamily->AddElement(aNode);
- aFamily->SetType(SMDSAbs_Node);
- }
+ {
+ aFamily->AddElement(aNode);
+ aFamily->SetType(SMDSAbs_Node);
+ }
}
}
switch(aGrilleInfo->GetGeom()){
case MED::eSEG2:
if(aNodeIds.size() != 2){
- res = false;
- EXCEPTION(std::runtime_error,"buildMeshGrille Error. Incorrect size of ids 2!="<<aNodeIds.size());
+ res = false;
+ EXCEPTION(runtime_error,"buildMeshGrille Error. Incorrect size of ids 2!="<<aNodeIds.size());
}
anElement = myMesh->AddEdgeWithID(aNodeIds[0],
- aNodeIds[1],
- iCell);
+ aNodeIds[1],
+ iCell);
break;
case MED::eQUAD4:
if(aNodeIds.size() != 4){
- res = false;
- EXCEPTION(std::runtime_error,"buildMeshGrille Error. Incorrect size of ids 4!="<<aNodeIds.size());
+ res = false;
+ EXCEPTION(runtime_error,"buildMeshGrille Error. Incorrect size of ids 4!="<<aNodeIds.size());
}
anElement = myMesh->AddFaceWithID(aNodeIds[0],
- aNodeIds[2],
- aNodeIds[3],
- aNodeIds[1],
- iCell);
+ aNodeIds[2],
+ aNodeIds[3],
+ aNodeIds[1],
+ iCell);
break;
case MED::eHEXA8:
if(aNodeIds.size() != 8){
- res = false;
- EXCEPTION(std::runtime_error,"buildMeshGrille Error. Incorrect size of ids 8!="<<aNodeIds.size());
+ res = false;
+ EXCEPTION(runtime_error,"buildMeshGrille Error. Incorrect size of ids 8!="<<aNodeIds.size());
}
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
- aNodeIds[2],
- aNodeIds[3],
- aNodeIds[1],
- aNodeIds[4],
- aNodeIds[6],
- aNodeIds[7],
- aNodeIds[5],
- iCell);
+ aNodeIds[2],
+ aNodeIds[3],
+ aNodeIds[1],
+ aNodeIds[4],
+ aNodeIds[6],
+ aNodeIds[7],
+ aNodeIds[5],
+ iCell);
break;
default:
break;
if((aGrilleInfo->myFamNum).size() > 0){
TInt aFamNum = aGrilleInfo->GetFamNum(iCell);
if ( checkFamilyID ( aFamily, aFamNum )){
- aFamily->AddElement(anElement);
- aFamily->SetType(anElement->GetType());
+ aFamily->AddElement(anElement);
+ aFamily->SetType(anElement->GetType());
}
}
}
bool checkFamilyID(DriverMED_FamilyPtr & aFamily, int anID) const;
bool buildMeshGrille(const MED::PWrapper& theWrapper,
- const MED::PMeshInfo& theMeshInfo);
+ const MED::PMeshInfo& theMeshInfo);
private:
std::string myMeshName;
{}
void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName,
- MED::EVersion theId)
+ MED::EVersion theId)
{
myMed = CrWrapper(theFileName,theId);
Driver_SMESHDS_Mesh::SetFile(theFileName);
TUnit* myUnit;
public:
TCoordHelper(const SMDS_NodeIteratorPtr& theNodeIter,
- TGetCoord* theGetCoord,
- TName* theName,
- TUnit* theUnit = aUnit):
+ TGetCoord* theGetCoord,
+ TName* theName,
+ TUnit* theUnit = aUnit):
myNodeIter(theNodeIter),
myGetCoord(theGetCoord),
myName(theName),
virtual ~TCoordHelper(){}
bool Next(){
return myNodeIter->more() &&
- (myCurrentNode = myNodeIter->next());
+ (myCurrentNode = myNodeIter->next());
}
const SMDS_MeshNode* GetNode(){
return myCurrentNode;
bool anIsYDimension = false;
bool anIsZDimension = false;
{
- SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
- double aBounds[6];
- if(aNodesIter->more()){
- const SMDS_MeshNode* aNode = aNodesIter->next();
- aBounds[0] = aBounds[1] = aNode->X();
- aBounds[2] = aBounds[3] = aNode->Y();
- aBounds[4] = aBounds[5] = aNode->Z();
- }
- while(aNodesIter->more()){
- const SMDS_MeshNode* aNode = aNodesIter->next();
- aBounds[0] = min(aBounds[0],aNode->X());
- aBounds[1] = max(aBounds[1],aNode->X());
-
- aBounds[2] = min(aBounds[2],aNode->Y());
- aBounds[3] = max(aBounds[3],aNode->Y());
-
- aBounds[4] = min(aBounds[4],aNode->Z());
- aBounds[5] = max(aBounds[5],aNode->Z());
- }
-
- double EPS = 1.0E-7;
- anIsXDimension = (aBounds[1] - aBounds[0]) + abs(aBounds[1]) + abs(aBounds[0]) > EPS;
- anIsYDimension = (aBounds[3] - aBounds[2]) + abs(aBounds[3]) + abs(aBounds[2]) > EPS;
- anIsZDimension = (aBounds[5] - aBounds[4]) + abs(aBounds[5]) + abs(aBounds[4]) > EPS;
- aMeshDimension = anIsXDimension + anIsYDimension + anIsZDimension;
- if(!aMeshDimension)
- aMeshDimension = 3;
+ SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
+ double aBounds[6];
+ if(aNodesIter->more()){
+ const SMDS_MeshNode* aNode = aNodesIter->next();
+ aBounds[0] = aBounds[1] = aNode->X();
+ aBounds[2] = aBounds[3] = aNode->Y();
+ aBounds[4] = aBounds[5] = aNode->Z();
+ }
+ while(aNodesIter->more()){
+ const SMDS_MeshNode* aNode = aNodesIter->next();
+ aBounds[0] = min(aBounds[0],aNode->X());
+ aBounds[1] = max(aBounds[1],aNode->X());
+
+ aBounds[2] = min(aBounds[2],aNode->Y());
+ aBounds[3] = max(aBounds[3],aNode->Y());
+
+ aBounds[4] = min(aBounds[4],aNode->Z());
+ aBounds[5] = max(aBounds[5],aNode->Z());
+ }
+
+ double EPS = 1.0E-7;
+ anIsXDimension = (aBounds[1] - aBounds[0]) + abs(aBounds[1]) + abs(aBounds[0]) > EPS;
+ anIsYDimension = (aBounds[3] - aBounds[2]) + abs(aBounds[3]) + abs(aBounds[2]) > EPS;
+ anIsZDimension = (aBounds[5] - aBounds[4]) + abs(aBounds[5]) + abs(aBounds[4]) > EPS;
+ aMeshDimension = anIsXDimension + anIsYDimension + anIsZDimension;
+ if(!aMeshDimension)
+ aMeshDimension = 3;
// PAL16857(SMESH not conform to the MED convention):
if ( aMeshDimension == 2 && anIsZDimension ) // 2D only if mesh is in XOY plane
aMeshDimension = 3;
SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
switch(aMeshDimension){
case 3:
- aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXYZGetCoord,aXYZName));
- break;
+ aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXYZGetCoord,aXYZName));
+ break;
case 2:
- if(anIsXDimension && anIsYDimension)
- aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXYGetCoord,aXYName));
- if(anIsYDimension && anIsZDimension)
- aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aYZGetCoord,aYZName));
- if(anIsXDimension && anIsZDimension)
- aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXZGetCoord,aXZName));
- break;
+ if(anIsXDimension && anIsYDimension)
+ aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXYGetCoord,aXYName));
+ if(anIsYDimension && anIsZDimension)
+ aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aYZGetCoord,aYZName));
+ if(anIsXDimension && anIsZDimension)
+ aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXZGetCoord,aXZName));
+ break;
case 1:
- if(anIsXDimension)
- aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXGetCoord,aXName));
- if(anIsYDimension)
- aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aYGetCoord,aYName));
- if(anIsZDimension)
- aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aZGetCoord,aZName));
- break;
+ if(anIsXDimension)
+ aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXGetCoord,aXName));
+ if(anIsYDimension)
+ aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aYGetCoord,aYName));
+ if(anIsZDimension)
+ aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aZGetCoord,aZName));
+ break;
}
}
// coordinates
TCoordSlice aTCoordSlice = aNodeInfo->GetCoordSlice( iNode );
for(TInt iCoord = 0; iCoord < aMeshDimension; iCoord++){
- aTCoordSlice[iCoord] = aCoordHelperPtr->GetCoord(iCoord);
+ aTCoordSlice[iCoord] = aCoordHelperPtr->GetCoord(iCoord);
}
// node number
int aNodeID = aCoordHelperPtr->GetID();
#include "UNV2417_Structure.hxx"
#include "UNV_Utilities.hxx"
+#include <Basics_Utils.hxx>
+
using namespace std;
Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
{
+ Kernel_Utils::Localizer loc;
Status aResult = DRS_OK;
std::ifstream in_stream(myFile.c_str());
try{
#include "UNV2417_Structure.hxx"
#include "UNV_Utilities.hxx"
+#include <Basics_Utils.hxx>
+
using namespace std;
using namespace UNV;
Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
{
+ Kernel_Utils::Localizer loc;
Status aResult = DRS_OK;
std::ofstream out_stream(myFile.c_str());
try{
libMeshDriverUNV_la_LDFLAGS = \
../Driver/libMeshDriver.la \
+ $(KERNEL_LDFLAGS) -lSALOMEBasics \
$(CAS_KERNEL)
UNV_Test_CPPFLAGS = \
MEFISTO2D_EXPORT
R
#ifdef WIN32
+ #ifdef F2C_BUILD
+ #else
__stdcall
+ #endif
#endif
areteideale()//( R3 xyz, R3 direction )
{
void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
#endif
+#endif
tempscpu_( double & tempsec )
//Retourne le temps CPU utilise en secondes
{
void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
#endif
+#endif
deltacpu_( R & dtcpu )
//Retourne le temps CPU utilise en secondes depuis le precedent appel
{
}
void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
qualitetrte( R3 *mnpxyd,
Z & mosoar, Z & mxsoar, Z *mnsoar,
extern "C" { void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
qualitetrte( R3 *mnpxyd,
Z & mosoar, Z & mxsoar, Z *mnsoar,
extern "C" { void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
tempscpu( double & tempsec );
}
extern "C" { void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
deltacpu( R & dtcpu );
}
//initialiser le tableau mnsoar pour le hachage des aretes
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
insoar( Z & mxsomm, Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar );
}
//mettre a zero les nb entiers de tab
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
azeroi( Z & nb, Z * tab );
}
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
fasoar( Z & ns1, Z & ns2, Z & nt1, Z & nt2, Z & nolign,
Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar, Z * mnarst,
//initialisation du tableau letree et ajout dans letree des sommets 1 a nbsomm
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
teajte( Z & mxsomm, Z & nbsomm, R3 * mnpxyd, R3 * comxmi,
R & aretmx, Z & mxtree, Z * letree,
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
tehote( Z & nutysu, Z & nbarpi, Z & mxsomm, Z & nbsomm, R3 * mnpxyd,
R3 * comxmi, R & aretmx,
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
tetrte( R3 * comxmi, R & aretmx, Z & nbarpi, Z & mxsomm, R3 * mnpxyd,
Z & mxqueu, Z * mnqueu, Z * mntree,
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
aisoar( Z & mosoar, Z & mxsoar, Z * mnsoar, Z & na );
}
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
tedela( R3 * mnpxyd, Z * mnarst,
Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar, Z & na,
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
terefr( Z & nbarpi, R3 * mnpxyd,
Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar,
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
tesuex( Z & nblf, Z * nulftr,
Z & ndtri0, Z & nbsomm, R3 * mnpxyd, Z * mnslig,
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
teamqt( Z & nutysu, R & aretmx, R & airemx,
Z * mnarst, Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar,
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
nusotr( Z & nt, Z & mosoar, Z * mnsoar, Z & moartr, Z * mnartr,Z * nosotr );
}
extern "C" {void
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
qutr2d( R3 & p1, R3 & p2, R3 & p3, R & qualite );
}
extern "C" { R
#ifdef WIN32
+#ifdef F2C_BUILD
+#else
__stdcall
+#endif
#endif
surtd2( R3 & p1, R3 & p2, R3 & p3 );
}
SMESH_DeviceActor.h \
SMESH_PreviewActorsCollection.h \
SMESH_ExtractGeometry.h \
- SMESH_ActorUtils.h \
SMESH_FaceOrientationFilter.h
# Libraries targets
../SMDS/libSMDS.la \
../Controls/libSMESHControls.la \
$(GUI_LDFLAGS) -lSalomeApp -lSalomeObject -lSVTK -lVTKViewer -lqtx -lsuit \
+ $(GEOM_LDFLAGS) -lGEOMObject \
$(CAS_KERNEL) \
$(VTK_LIBS) $(QT_MT_LIBS)
#include <vtkImplicitBoolean.h>
#include <vtkImplicitFunctionCollection.h>
+#include <vtkConfigure.h>
+#if !defined(VTK_XVERSION)
+#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
+#endif
+
#include "utilities.h"
#ifdef _DEBUG_
SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
- const char* theEntry,
- const char* theName,
- int theIsClear)
+ const char* theEntry,
+ const char* theName,
+ int theIsClear)
{
SMESH_ActorDef* anActor = SMESH_ActorDef::New();
if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
+#if (VTK_XVERSION >= 0x050200)
+ myPtsLabeledDataMapper->SetLabelFormat("%d");
+#else
myPtsLabeledDataMapper->SetLabelFormat("%g");
+#endif
myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
myClsLabeledDataMapper = vtkLabeledDataMapper::New();
myClsLabeledDataMapper->SetInput(myClsSelectVisiblePoints->GetOutput());
+#if (VTK_XVERSION >= 0x050200)
+ myClsLabeledDataMapper->SetLabelFormat("%d");
+#else
myClsLabeledDataMapper->SetLabelFormat("%g");
+#endif
myClsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aClsTextProp = vtkTextProperty::New();
vtkIntArray *anArray = vtkIntArray::New();
anArray->SetNumberOfValues( aNbElem );
- for ( int anId = 0; anId < aNbElem; anId++ )
+ for ( vtkIdType anId = 0; anId < aNbElem; anId++ )
{
int aSMDSId = myVisualObj->GetNodeObjId( anId );
anArray->SetValue( anId, aSMDSId );
void
SMESH_ActorDef::
SetControlMode(eControl theMode,
- bool theCheckEntityMode)
+ bool theCheckEntityMode)
{
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
if( !mgr )
myControlMode = theMode;
switch(myControlMode){
case eFreeNodes:
- myNodeExtActor->SetExtControlMode(aFunctor);
- break;
+ myNodeExtActor->SetExtControlMode(aFunctor);
+ break;
case eFreeEdges:
case eFreeBorders:
- my1DExtActor->SetExtControlMode(aFunctor);
- break;
+ my1DExtActor->SetExtControlMode(aFunctor);
+ break;
case eFreeFaces:
- my2DExtActor->SetExtControlMode(aFunctor);
- break;
+ my2DExtActor->SetExtControlMode(aFunctor);
+ break;
case eLength2D:
case eMultiConnection2D:
- my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable);
- break;
+ my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable);
+ break;
default:
- myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
+ myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
}
}
if(theCheckEntityMode){
if(myControlActor == my1DActor)
- SetEntityMode(eEdges);
+ SetEntityMode(eEdges);
else if(myControlActor == my2DActor){
- switch(myControlMode){
- case eLength2D:
- case eFreeEdges:
- case eFreeFaces:
- case eMultiConnection2D:
- //SetEntityMode(eEdges);
- SetEntityMode(eFaces);
- break;
- default:
- SetEntityMode(eFaces);
- }
+ switch(myControlMode){
+ case eLength2D:
+ case eFreeEdges:
+ case eFreeFaces:
+ case eMultiConnection2D:
+ //SetEntityMode(eEdges);
+ SetEntityMode(eFaces);
+ break;
+ default:
+ SetEntityMode(eFaces);
+ }
}else if(myControlActor == my3DActor)
- SetEntityMode(eVolumes);
+ SetEntityMode(eVolumes);
}
}else if(theCheckEntityMode){
bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
- const char* theEntry,
- const char* theName,
- int theIsClear)
+ const char* theEntry,
+ const char* theName,
+ int theIsClear)
{
Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
setIO(anIO);
vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
aDataSet->Update();
myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
- aDataSet->GetNumberOfCells() == 1 &&
- aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX;
+ ( aDataSet->GetNumberOfCells() == 1 &&
+ aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX );
return SALOME_Actor::IsInfinitive();
}
if(myControlMode != eNone){
switch(myControlMode){
case eFreeNodes:
- myNodeExtActor->VisibilityOn();
- break;
+ myNodeExtActor->VisibilityOn();
+ break;
case eFreeEdges:
case eFreeBorders:
- my1DExtActor->VisibilityOn();
- break;
+ my1DExtActor->VisibilityOn();
+ break;
case eFreeFaces:
- my2DExtActor->VisibilityOn();
- break;
+ my2DExtActor->VisibilityOn();
+ break;
case eLength2D:
case eMultiConnection2D:
- my1DExtActor->VisibilityOn();
+ my1DExtActor->VisibilityOn();
default:
- if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
- myScalarBarActor->VisibilityOn();
+ if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
+ myScalarBarActor->VisibilityOn();
}
}
VTKViewer_ExtractUnstructuredGrid* aHightFilter = myHighlitableActor->GetExtractUnstructuredGrid();
aHightFilter->ClearRegisteredCellsWithType();
- aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+
+ // The following row has been commented (initially added in 1.28.2.3.1 revision)
+ // Reason: seems to be unnecessary, this filter should always have default (ePassAll) mode of changing
+ // In addition, it leads to exception (see bug IPAL21372)
+ //aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
if (myEntityMode & e0DElements) {
if (MYDEBUG) MESSAGE("0D ELEMENTS");
myHighlitableActor->SetHighlited(anIsVisible);
myHighlitableActor->SetVisibility(anIsVisible);
myHighlitableActor->GetExtractUnstructuredGrid()->
- SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
+ SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
}else if(myRepresentation == ePoint || GetPointRepresentation()){
myHighlitableActor->SetHighlited(anIsVisible);
myHighlitableActor->GetExtractUnstructuredGrid()->
- SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
+ SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
myHighlitableActor->SetVisibility(anIsVisible);
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
}
mySurfaceProp->SetColor(r,g,b);
if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
if( aGroupObj->GetElementType() == SMDSAbs_Face ||
- aGroupObj->GetElementType() == SMDSAbs_Volume )
+ aGroupObj->GetElementType() == SMDSAbs_Volume )
myNameActor->SetBackgroundColor(r,g,b);
Modified();
}
static void ComputeBoundsParam(vtkDataSet* theDataSet,
- vtkFloatingPointType theDirection[3], vtkFloatingPointType theMinPnt[3],
- vtkFloatingPointType& theMaxBoundPrj, vtkFloatingPointType& theMinBoundPrj)
+ vtkFloatingPointType theDirection[3], vtkFloatingPointType theMinPnt[3],
+ vtkFloatingPointType& theMaxBoundPrj, vtkFloatingPointType& theMinBoundPrj)
{
vtkFloatingPointType aBounds[6];
theDataSet->GetBounds(aBounds);
}
vtkFloatingPointType aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]},
- {aBounds[1],aBounds[2],aBounds[4]},
- {aBounds[0],aBounds[3],aBounds[4]},
- {aBounds[1],aBounds[3],aBounds[4]},
- {aBounds[0],aBounds[2],aBounds[5]},
- {aBounds[1],aBounds[2],aBounds[5]},
- {aBounds[0],aBounds[3],aBounds[5]},
- {aBounds[1],aBounds[3],aBounds[5]}};
+ {aBounds[1],aBounds[2],aBounds[4]},
+ {aBounds[0],aBounds[3],aBounds[4]},
+ {aBounds[1],aBounds[3],aBounds[4]},
+ {aBounds[0],aBounds[2],aBounds[5]},
+ {aBounds[1],aBounds[2],aBounds[5]},
+ {aBounds[0],aBounds[3],aBounds[5]},
+ {aBounds[1],aBounds[3],aBounds[5]}};
int aMaxId = 0, aMinId = aMaxId;
theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]);
static void DistanceToPosition(vtkDataSet* theDataSet,
- vtkFloatingPointType theDirection[3], vtkFloatingPointType theDist, vtkFloatingPointType thePos[3])
+ vtkFloatingPointType theDirection[3], vtkFloatingPointType theDist, vtkFloatingPointType thePos[3])
{
vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
static void PositionToDistance(vtkDataSet* theDataSet,
- vtkFloatingPointType theDirection[3], vtkFloatingPointType thePos[3], vtkFloatingPointType& theDist)
+ vtkFloatingPointType theDirection[3], vtkFloatingPointType thePos[3], vtkFloatingPointType& theDist)
{
vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
public:
vtkTypeMacro(SMESH_Actor,SALOME_Actor);
static SMESH_Actor* New(TVisualObjPtr theVisualObj,
- const char* theEntry,
- const char* theName,
- int theIsClear);
+ const char* theEntry,
+ const char* theName,
+ int theIsClear);
virtual void SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
virtual void GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes,
eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio,
- eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D};
+ eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D};
virtual void SetControlMode(eControl theMode) = 0;
virtual eControl GetControlMode() = 0;
~SMESH_ActorDef();
bool Init(TVisualObjPtr theVisualObj,
- const char* theEntry,
- const char* theName,
- int theIsClear);
+ const char* theEntry,
+ const char* theName,
+ int theIsClear);
void SetIsShrunkable(bool theShrunkable);
void UpdateHighlight();
vtkFloatingPointType
GetFloat( const QString& theValue,
- vtkFloatingPointType theDefault )
+ vtkFloatingPointType theDefault )
{
int pos = theValue.indexOf( ":" );
vtkFloatingPointType val = theDefault;
QString name = theValue.right( theValue.length()-pos-1 ),
sect = theValue.left( pos );
if( !name.isEmpty() && !sect.isEmpty() )
- val = GetFloat( name, sect, theDefault );
+ val = GetFloat( name, sect, theDefault );
}
return val;
}
vtkFloatingPointType
GetFloat( const QString& theValue,
- const QString& theSection,
- vtkFloatingPointType theDefault )
+ const QString& theSection,
+ vtkFloatingPointType theDefault )
{
vtkFloatingPointType val = theDefault;
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
void
WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid,
- const char* theFileName)
+ const char* theFileName)
{
vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
aWriter->SetFileName(theFileName);
QColor
GetColor( const QString& theSect,
- const QString& theName,
- const QColor& def )
+ const QString& theName,
+ const QColor& def )
{
QColor c = def;
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
void
GetColor( const QString& theSect,
- const QString& theName,
- int& r,
- int& g,
- int& b,
- const QColor& def )
+ const QString& theName,
+ int& r,
+ int& g,
+ int& b,
+ const QColor& def )
{
QColor c = def;
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
void
GetColor( const QString& theSect,
- const QString& theName,
- vtkFloatingPointType& r,
- vtkFloatingPointType& g,
- vtkFloatingPointType& b,
- const QColor& def )
+ const QString& theName,
+ vtkFloatingPointType& r,
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b,
+ const QColor& def )
{
int ir( 0 ), ig( 0 ), ib( 0 );
GetColor( theSect, theName, ir, ig, ib, def );
SMESHOBJECT_EXPORT
vtkFloatingPointType
GetFloat( const QString& theValue,
- vtkFloatingPointType theDefault = 0 );
+ vtkFloatingPointType theDefault = 0 );
SMESHOBJECT_EXPORT
vtkFloatingPointType
GetFloat( const QString& theName,
- const QString& theSection,
- vtkFloatingPointType theDefault = 0 );
+ const QString& theSection,
+ vtkFloatingPointType theDefault = 0 );
SMESHOBJECT_EXPORT
QColor
GetColor( const QString& theSect,
- const QString& theName,
- const QColor& = QColor() );
+ const QString& theName,
+ const QColor& = QColor() );
SMESHOBJECT_EXPORT
void
GetColor( const QString& theSect,
- const QString& theName,
- int&,
- int&,
- int&,
- const QColor& = QColor() );
+ const QString& theName,
+ int&,
+ int&,
+ int&,
+ const QColor& = QColor() );
SMESHOBJECT_EXPORT
void
GetColor( const QString& theSect,
- const QString& theName,
- vtkFloatingPointType&,
- vtkFloatingPointType&,
- vtkFloatingPointType&,
- const QColor& = QColor() );
+ const QString& theName,
+ vtkFloatingPointType&,
+ vtkFloatingPointType&,
+ vtkFloatingPointType&,
+ const QColor& = QColor() );
SMESHOBJECT_EXPORT
void
WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid,
- const char* theFileName);
+ const char* theFileName);
}
myMapper = vtkPolyDataMapper::New();
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
- myPolygonOffsetUnits);
+ myPolygonOffsetUnits);
myMapper->UseLookupTableScalarRangeOn();
myMapper->SetColorModeToMapScalars();
void
SMESH_DeviceActor
::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
- vtkScalarBarActor* theScalarBarActor,
- vtkLookupTable* theLookupTable)
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable)
{
bool anIsInitialized = theFunctor;
if(anIsInitialized){
using namespace SMESH::Controls;
if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get())){
for(vtkIdType i = 0; i < aNbCells; i++){
- vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
- vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
- double aValue = aNumericalFunctor->GetValue(anObjId);
- aScalars->SetValue(i,aValue);
+ vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
+ vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
+ double aValue = aNumericalFunctor->GetValue(anObjId);
+ aScalars->SetValue(i,aValue);
}
}else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get())){
for(vtkIdType i = 0; i < aNbCells; i++){
- vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
- vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
- bool aValue = aPredicate->IsSatisfy(anObjId);
- aScalars->SetValue(i,aValue);
+ vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
+ vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
+ bool aValue = aPredicate->IsSatisfy(anObjId);
+ aScalars->SetValue(i,aValue);
}
}
aDataSet->GetCellData()->SetScalars(aScalars);
aScalars->Delete();
-
+
theLookupTable->SetRange(aScalars->GetRange());
theLookupTable->SetNumberOfTableValues(theScalarBarActor->GetMaximumNumberOfColors());
theLookupTable->Build();
void
SMESH_DeviceActor
::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
- vtkScalarBarActor* theScalarBarActor,
- vtkLookupTable* theLookupTable)
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable)
{
bool anIsInitialized = theFunctor;
myExtractUnstructuredGrid->ClearRegisteredCells();
Length2D::TValues::const_iterator anIter = aValues.begin();
for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
- const Length2D::Value& aValue = *anIter;
- int aNode[2] = {
- myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
- myVisualObj->GetNodeVTKId(aValue.myPntId[1])
- };
- if(aNode[0] >= 0 && aNode[1] >= 0){
- anIdList->SetId( 0, aNode[0] );
- anIdList->SetId( 1, aNode[1] );
- aConnectivity->InsertNextCell( anIdList );
- aCellTypesArray->InsertNextValue( VTK_LINE );
- aScalars->SetValue(aVtkId,aValue.myLength);
- }
+ const Length2D::Value& aValue = *anIter;
+ int aNode[2] = {
+ myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
+ myVisualObj->GetNodeVTKId(aValue.myPntId[1])
+ };
+ if(aNode[0] >= 0 && aNode[1] >= 0){
+ anIdList->SetId( 0, aNode[0] );
+ anIdList->SetId( 1, aNode[1] );
+ aConnectivity->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_LINE );
+ aScalars->SetValue(aVtkId,aValue.myLength);
+ }
}
VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
aConnectivity->InitTraversal();
for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
- aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+ aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
SetUnstructuredGrid(aDataSet);
MultiConnection2D::MValues::const_iterator anIter = aValues.begin();
for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
- const MultiConnection2D::Value& aValue = (*anIter).first;
- int aNode[2] = {
- myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
- myVisualObj->GetNodeVTKId(aValue.myPntId[1])
- };
- if(aNode[0] >= 0 && aNode[1] >= 0){
- anIdList->SetId( 0, aNode[0] );
- anIdList->SetId( 1, aNode[1] );
- aConnectivity->InsertNextCell( anIdList );
- aCellTypesArray->InsertNextValue( VTK_LINE );
- aScalars->SetValue(aVtkId,(*anIter).second);
- }
+ const MultiConnection2D::Value& aValue = (*anIter).first;
+ int aNode[2] = {
+ myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
+ myVisualObj->GetNodeVTKId(aValue.myPntId[1])
+ };
+ if(aNode[0] >= 0 && aNode[1] >= 0){
+ anIdList->SetId( 0, aNode[0] );
+ anIdList->SetId( 1, aNode[1] );
+ aConnectivity->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_LINE );
+ aScalars->SetValue(aVtkId,(*anIter).second);
+ }
}
VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
aConnectivity->InitTraversal();
for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
- aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+ aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
SetUnstructuredGrid(aDataSet);
for( vtkIdType i = 0; i < aNbCells; i++ ){
vtkIdType anObjId = myVisualObj->GetElemObjId(i);
if(aFreePredicate->IsSatisfy(anObjId))
- myExtractUnstructuredGrid->RegisterCell(i);
+ myExtractUnstructuredGrid->RegisterCell(i);
}
if(!myExtractUnstructuredGrid->IsCellsRegistered())
myExtractUnstructuredGrid->RegisterCell(-1);
for(; anIter != aBorders.end(); anIter++){
const FreeEdges::Border& aBorder = *anIter;
int aNode[2] = {
- myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
- myVisualObj->GetNodeVTKId(aBorder.myPntId[1])
+ myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
+ myVisualObj->GetNodeVTKId(aBorder.myPntId[1])
};
//cout<<"aNode = "<<aBorder.myPntId[0]<<"; "<<aBorder.myPntId[1]<<endl;
if(aNode[0] >= 0 && aNode[1] >= 0){
- anIdList->SetId( 0, aNode[0] );
- anIdList->SetId( 1, aNode[1] );
- aConnectivity->InsertNextCell( anIdList );
- aCellTypesArray->InsertNextValue( VTK_LINE );
+ anIdList->SetId( 0, aNode[0] );
+ anIdList->SetId( 1, aNode[1] );
+ aConnectivity->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_LINE );
}
}
aDataSet->Delete();
}else if(FreeNodes* aFreeNodes = dynamic_cast<FreeNodes*>(theFunctor.get())){
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
- vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
vtkIdType aNbNodes = myVisualObj->GetNbEntities(SMDSAbs_Node);
for( vtkIdType i = 0; i < aNbNodes; i++ ){
vtkIdType anObjId = myVisualObj->GetNodeObjId(i);
if(aFreeNodes->IsSatisfy(anObjId))
- myExtractUnstructuredGrid->RegisterCell(i);
+ myExtractUnstructuredGrid->RegisterCell(i);
}
if(!myExtractUnstructuredGrid->IsCellsRegistered())
myExtractUnstructuredGrid->RegisterCell(-1);
void
SMESH_DeviceActor
::SetPolygonOffsetParameters(vtkFloatingPointType factor,
- vtkFloatingPointType units)
+ vtkFloatingPointType units)
{
myPolygonOffsetFactor = factor;
myPolygonOffsetUnits = units;
vtkUnstructuredGrid* GetUnstructuredGrid();
void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
- vtkScalarBarActor* theScalarBarActor,
- vtkLookupTable* theLookupTable);
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
- vtkScalarBarActor* theScalarBarActor,
- vtkLookupTable* theLookupTable);
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
bool IsHighlited() { return myIsHighlited;}
void
SetPolygonOffsetParameters(vtkFloatingPointType factor,
- vtkFloatingPointType units);
+ vtkFloatingPointType units);
void
GetPolygonOffsetParameters(vtkFloatingPointType& factor,
- vtkFloatingPointType& units)
+ vtkFloatingPointType& units)
{
factor = myPolygonOffsetFactor;
units = myPolygonOffsetUnits;
{
newId = newPts->InsertNextPoint(x);
pointMap[ptId] = newId;
- myNodeVTK2ObjIds.push_back(ptId);
+ myNodeVTK2ObjIds.push_back(ptId);
outputPD->CopyData(pd,ptId,newId);
}
}
{
newId = newPts->InsertNextPoint(x);
pointMap[ptId] = newId;
- myNodeVTK2ObjIds.push_back(ptId);
+ myNodeVTK2ObjIds.push_back(ptId);
outputPD->CopyData(pd,ptId,newId);
}
}
x = input->GetPoint(ptId);
newId = newPts->InsertNextPoint(x);
pointMap[ptId] = newId;
- myNodeVTK2ObjIds.push_back(ptId);
+ myNodeVTK2ObjIds.push_back(ptId);
outputPD->CopyData(pd,ptId,newId);
}
newCellPts->InsertId(i,pointMap[ptId]);
double* aBounds = theFace->GetBounds();
theSize = pow( pow( aBounds[1] - aBounds[0], 2 ) +
- pow( aBounds[3] - aBounds[2], 2 ) +
- pow( aBounds[5] - aBounds[4], 2 ), 0.5 );
+ pow( aBounds[3] - aBounds[2], 2 ) +
+ pow( aBounds[5] - aBounds[4], 2 ), 0.5 );
}
/*!
input->GetCellNeighbors( aCellId, aFace->PointIds, aNeighborIds );
if( aNeighborIds->GetNumberOfIds() > 0 )
- continue;
+ continue;
double aSize, aNormal[3];
GetFaceParams( aFace, aNormal, aSize );
#include <vtkUnstructuredGrid.h>
#include <memory>
-#include <sstream>
+#include <sstream>
#include <stdexcept>
#include <set>
// purpose : Get type of VTK cell
//=================================================================================
static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
- const bool thePoly,
+ const bool thePoly,
const int theNbNodes )
{
switch( theType )
typedef std::vector<const SMDS_MeshElement*> TConnect;
int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter,
- TConnect& theConnect)
+ TConnect& theConnect)
{
theConnect.clear();
for(; theNodesIter->more();)
inline
void SetId(vtkIdList *theIdList,
- const SMESH_VisualObjDef::TMapOfIds& theSMDS2VTKNodes,
- const TConnect& theConnect,
- int thePosition,
- int theId)
+ const SMESH_VisualObjDef::TMapOfIds& theSMDS2VTKNodes,
+ const TConnect& theConnect,
+ int thePosition,
+ int theId)
{
theIdList->SetId(thePosition,theSMDS2VTKNodes.find(theConnect[theId]->GetID())->second);
}
myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
- switch (aType) {
- case SMDSAbs_Volume:{
+ switch (aType) {
+ case SMDSAbs_Volume:{
aConnect.clear();
- std::vector<int> aConnectivities;
- // Convertions connectivities from SMDS to VTK
- if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
+ std::vector<int> aConnectivities;
+ // Convertions connectivities from SMDS to VTK
+ if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
if ( const SMDS_PolyhedralVolumeOfNodes* ph =
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem))
aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect);
anIdList->SetNumberOfIds( aNbNodes );
}
- for (int k = 0; k < aNbNodes; k++)
- aConnectivities.push_back(k);
+ for (int k = 0; k < aNbNodes; k++)
+ aConnectivities.push_back(k);
} else if (aNbNodes == 4) {
- static int anIds[] = {0,2,1,3};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ static int anIds[] = {0,2,1,3};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- } else if (aNbNodes == 5) {
- static int anIds[] = {0,3,2,1,4};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ } else if (aNbNodes == 5) {
+ static int anIds[] = {0,3,2,1,4};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- } else if (aNbNodes == 6) {
- static int anIds[] = {0,1,2,3,4,5};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ } else if (aNbNodes == 6) {
+ static int anIds[] = {0,1,2,3,4,5};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- }
+ }
else if (aNbNodes == 8) {
- static int anIds[] = {0,3,2,1,4,7,6,5};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ static int anIds[] = {0,3,2,1,4,7,6,5};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- }
+ }
else if (aNbNodes == 10) {
- static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- }
+ static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ }
else if (aNbNodes == 13) {
- static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- }
+ static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ }
else if (aNbNodes == 15) {
//static int anIds[] = {0,2,1,3,5,4,8,7,6,11,10,9,12,14,13};
static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- //for (int k = 0; k < aNbNodes; k++) {
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ //for (int k = 0; k < aNbNodes; k++) {
// int nn = aConnectivities[k];
// const SMDS_MeshNode* N = static_cast<const SMDS_MeshNode*> (aConnect[nn]);
// cout<<"k="<<k<<" N("<<N->X()<<","<<N->Y()<<","<<N->Z()<<")"<<endl;
//}
- }
+ }
else if (aNbNodes == 20) {
- static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- }
+ static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ }
else {
}
if ( aConnect.empty() )
GetConnect(aNodesIter,aConnect);
- if (aConnectivities.size() > 0) {
- for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
- SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
- }
- break;
- }
- default:
- for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
- const SMDS_MeshElement* aNode = aNodesIter->next();
- anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
- }
- }
+ if (aConnectivities.size() > 0) {
+ for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
+ SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
+ }
+ break;
+ }
+ default:
+ for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
+ const SMDS_MeshElement* aNode = aNodesIter->next();
+ anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
+ }
+ }
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) );
// purpose : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 )
//=================================================================================
bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
- const int theEdgeNum,
- int& theNodeId1,
- int& theNodeId2 ) const
+ const int theEdgeNum,
+ int& theNodeId1,
+ int& theNodeId2 ) const
{
const SMDS_Mesh* aMesh = GetMesh();
if ( aMesh == 0 )
return true;
}
+//=================================================================================
+// function : IsValid
+// purpose : Return true if there are some entities
+//=================================================================================
+bool SMESH_VisualObjDef::IsValid() const
+{
+ return GetNbEntities(SMDSAbs_Node) > 0 ||
+ GetNbEntities(SMDSAbs_0DElement) > 0 ||
+ GetNbEntities(SMDSAbs_Edge) > 0 ||
+ GetNbEntities(SMDSAbs_Face) > 0 ||
+ GetNbEntities(SMDSAbs_Volume) > 0 ;
+}
+
/*
Class : SMESH_MeshObj
Description : Class for visualisation of mesh
//=================================================================================
bool SMESH_MeshObj::IsNodePrs() const
{
- return myClient->NbEdges() == 0 &&myClient->NbFaces() == 0 && myClient->NbVolumes() == 0 ;
+ return myClient->Nb0DElements() == 0 && myClient->NbEdges() == 0 && myClient->NbFaces() == 0 && myClient->NbVolumes() == 0 ;
}
case SMDSAbs_Volume:
{
SMESH::long_array_var anIds =
- mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
+ mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
return anIds->length();
}
default:
else
{
SMESH::long_array_var anIds =
- mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
+ mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
return getPointers( theType, anIds, aMesh, theResList );
}
}
virtual SMDS_Mesh* GetMesh() const = 0;
virtual bool GetEdgeNodes( const int theElemId,
- const int theEdgeNum,
- int& theNodeId1,
- int& theNodeId2 ) const = 0;
+ const int theEdgeNum,
+ int& theNodeId1,
+ int& theNodeId2 ) const = 0;
+ virtual bool IsValid() const = 0;
virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
virtual bool IsNodePrs() const = 0;
virtual SMDS_Mesh* GetMesh() const = 0;
+ virtual bool IsValid() const;
+
virtual bool GetEdgeNodes( const int theElemId,
const int theEdgeNum,
int& theNodeId1,
actor->SetShape(shape,0,0);
//Color Properties
- /*
- vtkProperty* aProp = vtkProperty::New();
- vtkProperty* aHLProp = vtkProperty::New();
- vtkProperty* aPHLProp = vtkProperty::New();
-
- aProp->SetColor( 255, 0, 0);
- actor->SetProperty(aProp);
-
- aHLProp->SetColor( 255, 255, 255);
- actor->SetHighlightProperty(aHLProp);
-
- aPHLProp->SetColor( 155, 155, 155);
- aPHLProp->SetLineWidth ( 3 );
- aPHLProp->SetOpacity ( 0.75 );
- actor->SetPreHighlightProperty(aPHLProp);
-
- aProp->Delete();
- aHLProp->Delete();
- aPHLProp->Delete();
+ /*
+ vtkProperty* aProp = vtkProperty::New();
+ vtkProperty* aHLProp = vtkProperty::New();
+ vtkProperty* aPHLProp = vtkProperty::New();
+
+ aProp->SetColor( 255, 0, 0);
+ actor->SetProperty(aProp);
+
+ aHLProp->SetColor( 255, 255, 255);
+ actor->SetHighlightProperty(aHLProp);
+
+ aPHLProp->SetColor( 155, 155, 155);
+ aPHLProp->SetLineWidth ( 3 );
+ aPHLProp->SetOpacity ( 0.75 );
+ actor->SetPreHighlightProperty(aPHLProp);
+
+ aProp->Delete();
+ aHLProp->Delete();
+ aPHLProp->Delete();
*/
return actor;
//=======================================================================
SMDS_EdgePosition::SMDS_EdgePosition(const int aEdgeId,
- const double aUParam):SMDS_Position(aEdgeId), myUParameter(aUParam)
+ const double aUParam):SMDS_Position(aEdgeId), myUParameter(aUParam)
{
}
const double *SMDS_EdgePosition::Coords() const
{
- static double origin[]={0,0,0};
- MESSAGE("SMDS_EdgePosition::Coords not implemented");
- return origin;
+ static double origin[]={0,0,0};
+ MESSAGE("SMDS_EdgePosition::Coords not implemented");
+ return origin;
}
/**
*/
SMDS_TypeOfPosition SMDS_EdgePosition::GetTypeOfPosition() const
{
- return SMDS_TOP_EDGE;
+ return SMDS_TOP_EDGE;
}
void SMDS_EdgePosition::SetUParameter(double aUparam)
{
- myUParameter = aUparam;
+ myUParameter = aUparam;
}
//=======================================================================
double SMDS_EdgePosition::GetUParameter() const
{
- return myUParameter;
+ return myUParameter;
}
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- int ID);
+ const SMDS_MeshNode * n2,
+ int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2);
+ const SMDS_MeshNode * n2);
// 2d order edge with 3 nodes: n12 - node between n1 and n2
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n12,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n12,
+ int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12);
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3);
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshEdge * e1,
const SMDS_MeshEdge * e2,
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3,
int n12,int n23,int n31, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n31,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n31,
+ int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n31);
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n31);
// 2d order quadrangle
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
int n12,int n23,int n34,int n41, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n41,
+ int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41);
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n41);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int n7, int n8, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshFace * f1,
const SMDS_MeshFace * f2,
int n12,int n23,int n31,
int n14,int n24,int n34, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n31,
- const SMDS_MeshNode * n14,
- const SMDS_MeshNode * n24,
- const SMDS_MeshNode * n34,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n31,
+ const SMDS_MeshNode * n14,
+ const SMDS_MeshNode * n24,
+ const SMDS_MeshNode * n34,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
int n15,int n25,int n35,int n45,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41,
- const SMDS_MeshNode * n15,
- const SMDS_MeshNode * n25,
- const SMDS_MeshNode * n35,
- const SMDS_MeshNode * n45,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n41,
+ const SMDS_MeshNode * n15,
+ const SMDS_MeshNode * n25,
+ const SMDS_MeshNode * n35,
+ const SMDS_MeshNode * n45,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
int n14,int n25,int n36,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n31,
- const SMDS_MeshNode * n45,
- const SMDS_MeshNode * n56,
- const SMDS_MeshNode * n64,
- const SMDS_MeshNode * n14,
- const SMDS_MeshNode * n25,
- const SMDS_MeshNode * n36,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n31,
+ const SMDS_MeshNode * n45,
+ const SMDS_MeshNode * n56,
+ const SMDS_MeshNode * n64,
+ const SMDS_MeshNode * n14,
+ const SMDS_MeshNode * n25,
+ const SMDS_MeshNode * n36,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
int n15,int n26,int n37,int n48,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8,
- const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41,
- const SMDS_MeshNode * n56,
- const SMDS_MeshNode * n67,
- const SMDS_MeshNode * n78,
- const SMDS_MeshNode * n85,
- const SMDS_MeshNode * n15,
- const SMDS_MeshNode * n26,
- const SMDS_MeshNode * n37,
- const SMDS_MeshNode * n48,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n41,
+ const SMDS_MeshNode * n56,
+ const SMDS_MeshNode * n67,
+ const SMDS_MeshNode * n78,
+ const SMDS_MeshNode * n85,
+ const SMDS_MeshNode * n15,
+ const SMDS_MeshNode * n26,
+ const SMDS_MeshNode * n37,
+ const SMDS_MeshNode * n48,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
SMDS_Mesh(SMDS_Mesh * parent);
SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1,
- const SMDS_MeshNode * node2,
- const SMDS_MeshNode * node3);
+ const SMDS_MeshNode * node2,
+ const SMDS_MeshNode * node3);
SMDS_MeshFace * createQuadrangle(const SMDS_MeshNode * node1,
- const SMDS_MeshNode * node2,
- const SMDS_MeshNode * node3,
- const SMDS_MeshNode * node4,
+ const SMDS_MeshNode * node2,
+ const SMDS_MeshNode * node3,
+ const SMDS_MeshNode * node4,
int ID);
// SMDS_Mesh0DElement* Find0DElementOrCreate(const SMDS_MeshNode * n);
SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2);
+ const SMDS_MeshNode * n2);
SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
- const SMDS_MeshNode *n2,
- const SMDS_MeshNode *n3);
+ const SMDS_MeshNode *n2,
+ const SMDS_MeshNode *n3);
SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
- const SMDS_MeshNode *n2,
- const SMDS_MeshNode *n3,
- const SMDS_MeshNode *n4);
+ const SMDS_MeshNode *n2,
+ const SMDS_MeshNode *n3,
+ const SMDS_MeshNode *n4);
bool registerElement(int ID, SMDS_MeshElement * element);
void addChildrenWithNodes(std::set<const SMDS_MeshElement*>& setOfChildren,
- const SMDS_MeshElement * element,
- std::set<const SMDS_MeshElement*>& nodes);
+ const SMDS_MeshElement * element,
+ std::set<const SMDS_MeshElement*>& nodes);
inline void adjustmyCellsCapacity(int ID)
{
/// 5,1 and 7,3 are an edges.
///////////////////////////////////////////////////////////////////////////////
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
- const SMDS_MeshNode * node1,
- const SMDS_MeshNode * node2,
- const SMDS_MeshNode * node3,
- const SMDS_MeshNode * node4,
- const SMDS_MeshNode * node5,
- const SMDS_MeshNode * node6,
- const SMDS_MeshNode * node7,
- const SMDS_MeshNode * node8)
+ const SMDS_MeshNode * node1,
+ const SMDS_MeshNode * node2,
+ const SMDS_MeshNode * node3,
+ const SMDS_MeshNode * node4,
+ const SMDS_MeshNode * node5,
+ const SMDS_MeshNode * node6,
+ const SMDS_MeshNode * node7,
+ const SMDS_MeshNode * node8)
{
- myNbNodes = 8;
- myNodes = new const SMDS_MeshNode* [myNbNodes];
- myNodes[0]=node1;
- myNodes[1]=node2;
- myNodes[2]=node3;
- myNodes[3]=node4;
- myNodes[4]=node5;
- myNodes[5]=node6;
- myNodes[6]=node7;
- myNodes[7]=node8;
+ myNbNodes = 8;
+ myNodes = new const SMDS_MeshNode* [myNbNodes];
+ myNodes[0]=node1;
+ myNodes[1]=node2;
+ myNodes[2]=node3;
+ myNodes[3]=node4;
+ myNodes[4]=node5;
+ myNodes[5]=node6;
+ myNodes[6]=node7;
+ myNodes[7]=node8;
}
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
- const SMDS_MeshNode * node1,
- const SMDS_MeshNode * node2,
- const SMDS_MeshNode * node3,
- const SMDS_MeshNode * node4)
+ const SMDS_MeshNode * node1,
+ const SMDS_MeshNode * node2,
+ const SMDS_MeshNode * node3,
+ const SMDS_MeshNode * node4)
{
- myNbNodes = 4;
- myNodes = new const SMDS_MeshNode* [myNbNodes];
- myNodes[0]=node1;
- myNodes[1]=node2;
- myNodes[2]=node3;
- myNodes[3]=node4;
+ myNbNodes = 4;
+ myNodes = new const SMDS_MeshNode* [myNbNodes];
+ myNodes[0]=node1;
+ myNodes[1]=node2;
+ myNodes[2]=node3;
+ myNodes[3]=node4;
}
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
- const SMDS_MeshNode * node1,
- const SMDS_MeshNode * node2,
- const SMDS_MeshNode * node3,
- const SMDS_MeshNode * node4,
- const SMDS_MeshNode * node5)
+ const SMDS_MeshNode * node1,
+ const SMDS_MeshNode * node2,
+ const SMDS_MeshNode * node3,
+ const SMDS_MeshNode * node4,
+ const SMDS_MeshNode * node5)
{
- myNbNodes = 5;
- myNodes = new const SMDS_MeshNode* [myNbNodes];
- myNodes[0]=node1;
- myNodes[1]=node2;
- myNodes[2]=node3;
- myNodes[3]=node4;
- myNodes[4]=node5;
+ myNbNodes = 5;
+ myNodes = new const SMDS_MeshNode* [myNbNodes];
+ myNodes[0]=node1;
+ myNodes[1]=node2;
+ myNodes[2]=node3;
+ myNodes[3]=node4;
+ myNodes[4]=node5;
}
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
- const SMDS_MeshNode * node1,
- const SMDS_MeshNode * node2,
- const SMDS_MeshNode * node3,
- const SMDS_MeshNode * node4,
- const SMDS_MeshNode * node5,
- const SMDS_MeshNode * node6)
+ const SMDS_MeshNode * node1,
+ const SMDS_MeshNode * node2,
+ const SMDS_MeshNode * node3,
+ const SMDS_MeshNode * node4,
+ const SMDS_MeshNode * node5,
+ const SMDS_MeshNode * node6)
{
- myNbNodes = 6;
- myNodes = new const SMDS_MeshNode* [myNbNodes];
- myNodes[0]=node1;
- myNodes[1]=node2;
- myNodes[2]=node3;
- myNodes[3]=node4;
- myNodes[4]=node5;
- myNodes[5]=node6;
+ myNbNodes = 6;
+ myNodes = new const SMDS_MeshNode* [myNbNodes];
+ myNodes[0]=node1;
+ myNodes[1]=node2;
+ myNodes[2]=node3;
+ myNodes[3]=node4;
+ myNodes[4]=node5;
+ myNodes[5]=node6;
}
bool SMDS_VolumeOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
void SMDS_VolumeOfNodes::Print(ostream & OS) const
{
- OS << "volume <" << GetID() << "> : ";
- int i;
- for (i = 0; i < NbNodes()-1; ++i) OS << myNodes[i] << ",";
- OS << myNodes[NbNodes()-1]<< ") " << endl;
+ OS << "volume <" << GetID() << "> : ";
+ int i;
+ for (i = 0; i < NbNodes()-1; ++i) OS << myNodes[i] << ",";
+ OS << myNodes[NbNodes()-1]<< ") " << endl;
}
int SMDS_VolumeOfNodes::NbFaces() const
{
- switch(NbNodes())
- {
- case 4: return 4;
- case 5: return 5;
- case 6: return 5;
- case 8: return 6;
- default: MESSAGE("invalid number of nodes");
- }
+ switch(NbNodes())
+ {
+ case 4: return 4;
+ case 5: return 5;
+ case 6: return 5;
+ case 8: return 6;
+ default: MESSAGE("invalid number of nodes");
+ }
return 0;
}
int SMDS_VolumeOfNodes::NbNodes() const
{
- return myNbNodes;
+ return myNbNodes;
}
int SMDS_VolumeOfNodes::NbEdges() const
{
- switch(NbNodes())
- {
- case 4: return 6;
- case 5: return 8;
- case 6: return 9;
- case 8: return 12;
- default: MESSAGE("invalid number of nodes");
- }
+ switch(NbNodes())
+ {
+ case 4: return 6;
+ case 5: return 8;
+ case 6: return 9;
+ case 8: return 12;
+ default: MESSAGE("invalid number of nodes");
+ }
return 0;
}
SMDSAbs_ElementType SMDS_VolumeOfNodes::GetType() const
{
- return SMDSAbs_Volume;
+ return SMDSAbs_Volume;
}
/*!
// ========================================================
// to perform some calculations without linkage to CASCADE
// ========================================================
+namespace
+{
struct XYZ {
double x;
double y;
XYZ( double X, double Y, double Z ) { x = X; y = Y; z = Z; }
XYZ( const XYZ& other ) { x = other.x; y = other.y; z = other.z; }
XYZ( const SMDS_MeshNode* n ) { x = n->X(); y = n->Y(); z = n->Z(); }
- XYZ operator-( const XYZ& other );
- XYZ Crossed( const XYZ& other );
- double Dot( const XYZ& other );
- double Magnitude();
+ inline XYZ operator-( const XYZ& other );
+ inline XYZ Crossed( const XYZ& other );
+ inline double Dot( const XYZ& other );
+ inline double Magnitude();
};
-XYZ XYZ::operator-( const XYZ& Right ) {
+inline XYZ XYZ::operator-( const XYZ& Right ) {
return XYZ(x - Right.x, y - Right.y, z - Right.z);
}
-XYZ XYZ::Crossed( const XYZ& Right ) {
+inline XYZ XYZ::Crossed( const XYZ& Right ) {
return XYZ (y * Right.z - z * Right.y,
z * Right.x - x * Right.z,
x * Right.y - y * Right.x);
}
-double XYZ::Dot( const XYZ& Other ) {
+inline double XYZ::Dot( const XYZ& Other ) {
return(x * Other.x + y * Other.y + z * Other.z);
}
-double XYZ::Magnitude() {
+inline double XYZ::Magnitude() {
return sqrt (x * x + y * y + z * z);
}
+}
//=======================================================================
//function : SMDS_VolumeTool
return true;
}
+//================================================================================
+/*!
+ * \brief Classify a point
+ * \param tol - thickness of faces
+ */
+//================================================================================
+
+bool SMDS_VolumeTool::IsOut(double X, double Y, double Z, double tol)
+{
+ // LIMITATION: for convex volumes only
+ XYZ p( X,Y,Z );
+ for ( int iF = 0; iF < myNbFaces; ++iF )
+ {
+ XYZ faceNormal;
+ if ( !GetFaceNormal( iF, faceNormal.x, faceNormal.y, faceNormal.z ))
+ continue;
+ if ( !IsFaceExternal( iF ))
+ faceNormal = XYZ() - faceNormal; // reverse
+
+ XYZ face2p( p - XYZ( myFaceNodes[0] ));
+ if ( face2p.Dot( faceNormal ) > tol )
+ return true;
+ }
+ return false;
+}
+
//=======================================================================
//function : SetExternalNormal
//purpose : Node order will be so that faces normals are external
bool GetBaryCenter (double & X, double & Y, double & Z) const;
+ bool IsOut(double X, double Y, double Z, double tol);
+ // Classify a point
// -----------------------
// info on node connection
for ( iE = 0; wExp.More(); wExp.Next(), iE++ )
{
TopoDS_Edge edge = wExp.Current();
- edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() ));
+ // commented for issue 0020557, other related ones: 0020526, PAL19080
+ // edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() ));
theEdges.push_back( edge );
}
theNbVertexInWires.push_back( iE );
SMESH_Gen::SMESH_Gen()
{
- MESSAGE("SMESH_Gen::SMESH_Gen");
- _localId = 0;
- _hypId = 0;
+ MESSAGE("SMESH_Gen::SMESH_Gen");
+ _localId = 0;
+ _hypId = 0;
_segmentation = 10;
SMDS_Mesh::_meshList.clear();
MESSAGE(SMDS_Mesh::_meshList.size());
SMESH_Gen::~SMESH_Gen()
{
- MESSAGE("SMESH_Gen::~SMESH_Gen");
+ MESSAGE("SMESH_Gen::~SMESH_Gen");
}
//=============================================================================
//=============================================================================
/*SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId)
- throw(SALOME_Exception)
+ throw(SALOME_Exception)
{
- MESSAGE("CreateHypothesis("<<anHyp<<","<<studyId<<")");
- // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
+ MESSAGE("CreateHypothesis("<<anHyp<<","<<studyId<<")");
+ // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
- StudyContextStruct *myStudyContext = GetStudyContext(studyId);
+ StudyContextStruct *myStudyContext = GetStudyContext(studyId);
- // create a new hypothesis object, store its ref. in studyContext
+ // create a new hypothesis object, store its ref. in studyContext
- SMESH_Hypothesis *myHypothesis = _hypothesisFactory.Create(anHyp, studyId);
- int hypId = myHypothesis->GetID();
- myStudyContext->mapHypothesis[hypId] = myHypothesis;
- SCRUTE(studyId);
- SCRUTE(hypId);
+ SMESH_Hypothesis *myHypothesis = _hypothesisFactory.Create(anHyp, studyId);
+ int hypId = myHypothesis->GetID();
+ myStudyContext->mapHypothesis[hypId] = myHypothesis;
+ SCRUTE(studyId);
+ SCRUTE(hypId);
- // store hypothesis in SMESHDS document
+ // store hypothesis in SMESHDS document
- myStudyContext->myDocument->AddHypothesis(myHypothesis);
- return myHypothesis;
+ myStudyContext->myDocument->AddHypothesis(myHypothesis);
+ return myHypothesis;
}*/
//=============================================================================
// create a new SMESH_mesh object
SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++,
- theStudyId,
- this,
- theIsEmbeddedMode,
- aStudyContext->myDocument);
+ theStudyId,
+ this,
+ theIsEmbeddedMode,
+ aStudyContext->myDocument);
aStudyContext->mapMesh[_localId] = aMesh;
return aMesh;
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool anUpward,
- const ::MeshDimension aDim,
- TSetOfInt* aShapesId)
+ const ::MeshDimension aDim,
+ TSetOfInt* aShapesId)
{
MESSAGE("SMESH_Gen::Compute");
MEMOSTAT;
// clear compute state to not show previous compute errors
// if preview invoked less dimension less than previous
smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
- continue;
+ continue;
}
if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
ret = false;
else if ( aShapesId )
- aShapesId->insert( smToCompute->GetId() );
+ aShapesId->insert( smToCompute->GetId() );
}
return ret;
}
// check for preview dimension limitations
if ( aShapesId && aShapeDim > (int)aDim )
- continue;
+ continue;
SMESH_Algo* algo = GetAlgo( aMesh, aSubShape );
if ( algo && !algo->NeedDescretBoundary() )
if ( algo->SupportSubmeshes() )
smWithAlgoSupportingSubmeshes.push_back( smToCompute );
else
- {
+ {
smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
- if ( aShapesId )
- aShapesId->insert( smToCompute->GetId() );
- }
+ if ( aShapesId )
+ aShapesId->insert( smToCompute->GetId() );
+ }
}
}
// ------------------------------------------------------------
SMESH_subMesh* smToCompute = smIt->next();
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
- const int aShapeDim = GetShapeDim( aSubShape );
+ const int aShapeDim = GetShapeDim( aSubShape );
//if ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue;
- if ( aShapeDim < 1 ) continue;
+ if ( aShapeDim < 1 ) continue;
- // check for preview dimension limitations
- if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
- continue;
-
+ // check for preview dimension limitations
+ if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
+ continue;
+
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
// apply the algos that do not require descretized boundaries
// ----------------------------------------------------------
for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt )
+ {
+ sm = *subIt;
if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
{
- const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType();
- // check for preview dimension limitations
- if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
- continue;
+ const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType();
+ // check for preview dimension limitations
+ if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
+ continue;
sm->ComputeStateEngine( SMESH_subMesh::COMPUTE );
- if ( aShapesId )
- aShapesId->insert( sm->GetId() );
+ if ( aShapesId )
+ aShapesId->insert( sm->GetId() );
}
-
+ }
// -----------------------------------------------
// mesh the rest subshapes starting from vertices
// -----------------------------------------------
bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap,
- const bool anUpward,
- TSetOfInt* aShapesId)
+ const bool anUpward,
+ TSetOfInt* aShapesId)
{
MESSAGE("SMESH_Gen::Evaluate");
//if ( !aMesh.HasShapeToMesh() && aShType == TopAbs_VERTEX )
// continue;
if ( !aMesh.HasShapeToMesh() ) {
- if( aShType == TopAbs_VERTEX || aShType == TopAbs_WIRE ||
- aShType == TopAbs_SHELL )
- continue;
+ if( aShType == TopAbs_VERTEX || aShType == TopAbs_WIRE ||
+ aShType == TopAbs_SHELL )
+ continue;
}
smToCompute->Evaluate(aResMap);
if( aShapesId )
- aShapesId->insert( smToCompute->GetId() );
+ aShapesId->insert( smToCompute->GetId() );
}
return ret;
}
if ( algo && !algo->NeedDescretBoundary() ) {
if ( algo->SupportSubmeshes() ) {
smWithAlgoSupportingSubmeshes.push_back( smToCompute );
- }
+ }
else {
smToCompute->Evaluate(aResMap);
- if ( aShapesId )
- aShapesId->insert( smToCompute->GetId() );
- }
+ if ( aShapesId )
+ aShapesId->insert( smToCompute->GetId() );
+ }
}
}
// ------------------------------------------------------------
SMESH_subMesh* smToCompute = smIt->next();
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
- const int aShapeDim = GetShapeDim( aSubShape );
- if ( aShapeDim < 1 ) continue;
+ const int aShapeDim = GetShapeDim( aSubShape );
+ if ( aShapeDim < 1 ) continue;
- //const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType();
+ //const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType();
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter
// ----------------------------------------------------------
// apply the algos that do not require descretized boundaries
// ----------------------------------------------------------
- for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt ) {
+ for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt )
+ {
+ sm = *subIt;
sm->Evaluate(aResMap);
if ( aShapesId )
- aShapesId->insert( sm->GetId() );
+ aShapesId->insert( sm->GetId() );
}
// -----------------------------------------------
const SMESH_Algo* aGlobIgnoAlgo,
const SMESH_Algo* aLocIgnoAlgo,
bool & checkConform,
- map<int, SMESH_subMesh*>& aCheckedMap,
+ set<SMESH_subMesh*>& aCheckedMap,
list< SMESH_Gen::TAlgoStateError > & theErrors)
{
ASSERT( aSubMesh );
}
// sub-algos will be hidden by a local <algo>
- const map<int, SMESH_subMesh*>& smMap = aSubMesh->DependsOn();
- map<int, SMESH_subMesh*>::const_reverse_iterator revItSub;
+ SMESH_subMeshIteratorPtr revItSub =
+ aSubMesh->getDependsOnIterator( /*includeSelf=*/false, /*complexShapeFirst=*/true);
bool checkConform2 = false;
- for ( revItSub = smMap.rbegin(); revItSub != smMap.rend(); revItSub++)
+ while ( revItSub->more() )
{
- checkConformIgnoredAlgos (aMesh, (*revItSub).second, aGlobIgnoAlgo,
+ SMESH_subMesh* sm = revItSub->next();
+ checkConformIgnoredAlgos (aMesh, sm, aGlobIgnoAlgo,
algo, checkConform2, aCheckedMap, theErrors);
- int key = (*revItSub).first;
- SMESH_subMesh* sm = (*revItSub).second;
- if ( aCheckedMap.find( key ) == aCheckedMap.end() )
- {
- aCheckedMap[ key ] = sm;
- }
+ aCheckedMap.insert( sm );
}
}
}
const int aTopAlgoDim,
bool* globalChecked,
const bool checkNoAlgo,
- map<int, SMESH_subMesh*>& aCheckedMap,
+ set<SMESH_subMesh*>& aCheckedMap,
list< SMESH_Gen::TAlgoStateError > & theErrors)
{
if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
if (!algo->NeedDescretBoundary() || isTopLocalAlgo)
{
bool checkNoAlgo2 = ( algo->NeedDescretBoundary() );
- const map<int, SMESH_subMesh*>& subMeshes = aSubMesh->DependsOn();
- map<int, SMESH_subMesh*>::const_iterator itsub;
- for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
+ SMESH_subMeshIteratorPtr itsub = aSubMesh->getDependsOnIterator( /*includeSelf=*/false,
+ /*complexShapeFirst=*/false);
+ while ( itsub->more() )
{
// sub-meshes should not be checked further more
- int key = (*itsub).first;
- SMESH_subMesh* sm = (*itsub).second;
- if ( aCheckedMap.find( key ) == aCheckedMap.end() )
- aCheckedMap[ key ] = sm;
+ SMESH_subMesh* sm = itsub->next();
+ aCheckedMap.insert( sm );
if (isTopLocalAlgo)
{
}
}
- const map<int, SMESH_subMesh*>& smMap = sm->DependsOn();
- map<int, SMESH_subMesh*>::const_reverse_iterator revItSub = smMap.rbegin();
- map<int, SMESH_subMesh*> aCheckedMap;
+ set<SMESH_subMesh*> aCheckedSubs;
bool checkConform = ( !theMesh.IsNotConformAllowed() );
- int aKey = 1;
- SMESH_subMesh* smToCheck = sm;
// loop on theShape and its sub-shapes
- while ( smToCheck )
+ SMESH_subMeshIteratorPtr revItSub = sm->getDependsOnIterator( /*includeSelf=*/true,
+ /*complexShapeFirst=*/true);
+ while ( revItSub->more() )
{
+ SMESH_subMesh* smToCheck = revItSub->next();
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
break;
- if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
+ if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked
if (!checkConformIgnoredAlgos (theMesh, smToCheck, aGlobIgnoAlgo,
- 0, checkConform, aCheckedMap, theErrors))
+ 0, checkConform, aCheckedSubs, theErrors))
ret = false;
if ( smToCheck->GetAlgoState() != SMESH_subMesh::NO_ALGO )
hasAlgo = true;
-
- // next subMesh
- if (revItSub != smMap.rend())
- {
- aKey = (*revItSub).first;
- smToCheck = (*revItSub).second;
- revItSub++;
- }
- else
- {
- smToCheck = 0;
- }
-
}
// ----------------------------------------------------------------
break;
}
}
- aCheckedMap.clear();
- smToCheck = sm;
- revItSub = smMap.rbegin();
bool checkNoAlgo = theMesh.HasShapeToMesh() ? bool( aTopAlgoDim ) : false;
bool globalChecked[] = { false, false, false, false };
// loop on theShape and its sub-shapes
- while ( smToCheck )
+ aCheckedSubs.clear();
+ revItSub = sm->getDependsOnIterator( /*includeSelf=*/true, /*complexShapeFirst=*/true);
+ while ( revItSub->more() )
{
+ SMESH_subMesh* smToCheck = revItSub->next();
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
break;
- if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
+ if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked
if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim,
- globalChecked, checkNoAlgo, aCheckedMap, theErrors))
+ globalChecked, checkNoAlgo, aCheckedSubs, theErrors))
{
ret = false;
if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO )
checkNoAlgo = false;
}
-
- // next subMesh
- if (revItSub != smMap.rend())
- {
- aKey = (*revItSub).first;
- smToCheck = (*revItSub).second;
- revItSub++;
- }
- else
- smToCheck = 0;
}
if ( !hasAlgo ) {
StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId)
{
- // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
-
- if (_mapStudyContext.find(studyId) == _mapStudyContext.end())
- {
- _mapStudyContext[studyId] = new StudyContextStruct;
- _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId);
- }
- StudyContextStruct *myStudyContext = _mapStudyContext[studyId];
+ // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
+
+ if (_mapStudyContext.find(studyId) == _mapStudyContext.end())
+ {
+ _mapStudyContext[studyId] = new StudyContextStruct;
+ _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId);
+ }
+ StudyContextStruct *myStudyContext = _mapStudyContext[studyId];
// ASSERT(_mapStudyContext.find(studyId) != _mapStudyContext.end());
- return myStudyContext;
+ return myStudyContext;
}
// //=============================================================================
int SMESH_Gen::GetANewId()
{
- //MESSAGE("SMESH_Gen::GetANewId");
- return _hypId++;
+ //MESSAGE("SMESH_Gen::GetANewId");
+ return _hypId++;
}
class SMESH_EXPORT SMESH_Gen
{
- public:
+public:
SMESH_Gen();
~SMESH_Gen();
bool Compute(::SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool anUpward=false,
- const ::MeshDimension aDim=::MeshDim_3D,
- TSetOfInt* aShapesId=0);
+ const ::MeshDimension aDim=::MeshDim_3D,
+ TSetOfInt* aShapesId=0);
/*!
* \brief evaluates size of prospective mesh on a shape
* \retval bool - is a success
*/
bool Evaluate(::SMESH_Mesh & aMesh,
- const TopoDS_Shape & aShape,
- MapShapeNbElems& aResMap,
+ const TopoDS_Shape & aShape,
+ MapShapeNbElems& aResMap,
const bool anUpward=false,
TSetOfInt* aShapesId=0);
*/
void SetDefaultNbSegments(int nb) { _nbSegments = nb; }
int GetDefaultNbSegments() const { return _nbSegments; }
-
+
struct TAlgoStateError
{
TAlgoStateErrorName _name;
SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0);
static bool IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh);
- // inherited methods from SALOMEDS::Driver
-
-// void Save(int studyId, const char *aUrlOfFile);
-// void Load(int studyId, const char *aUrlOfFile);
-// void Close(int studyId);
-// const char *ComponentDataType();
-
-// const char *IORToLocalPersistentID(const char *IORString, bool & IsAFile);
-// const char *LocalPersistentIDToIOR(const char *aLocalPersistentID);
-
int GetANewId();
std::map < int, SMESH_Algo * >_mapAlgo;
std::map < int, SMESH_2D_Algo * >_map2D_Algo;
std::map < int, SMESH_3D_Algo * >_map3D_Algo;
- private:
+private:
- int _localId; // unique Id of created objects, within SMESH_Gen entity
+ int _localId; // unique Id of created objects, within SMESH_Gen entity
std::map < int, StudyContextStruct * >_mapStudyContext;
// hypotheses managing
//=============================================================================
SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
- int studyId,
- SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId)
+ int studyId,
+ SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId)
{
//MESSAGE("SMESH_Hypothesis::SMESH_Hypothesis");
_gen = gen;
//=============================================================================
SMESH_Mesh::SMESH_Mesh(int theLocalId,
- int theStudyId,
- SMESH_Gen* theGen,
- bool theIsEmbeddedMode,
- SMESHDS_Document* theDocument):
+ int theStudyId,
+ SMESH_Gen* theGen,
+ bool theIsEmbeddedMode,
+ SMESHDS_Document* theDocument):
_groupId( 0 ), _nbSubShapes( 0 )
{
MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)");
if ( SMESH_subMesh *sm = GetSubMeshContaining( theShapeId ) )
{
SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true,
- /*complexShapeFirst=*/false);
+ /*complexShapeFirst=*/false);
while ( smIt->more() )
{
sm = smIt->next();
TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType();
if ( shapeType == TopAbs_VERTEX || shapeType < TopAbs_SOLID )
- // all other shapes depends on vertices so they are already cleaned
- sm->ComputeStateEngine( SMESH_subMesh::CLEAN );
+ // all other shapes depends on vertices so they are already cleaned
+ sm->ComputeStateEngine( SMESH_subMesh::CLEAN );
// to recompute even if failed
sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
}
SMESH_Group* aSMESHGroup = AddGroup( aSubGroup->GetType(), aName.c_str(), aId );
if ( aSMESHGroup ) {
- if(MYDEBUG) MESSAGE("UNVToMesh - group added: "<<aName);
- SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( aSMESHGroup->GetGroupDS() );
- if ( aGroupDS ) {
- aGroupDS->SetStoreName(aName.c_str());
- aSubGroup->InitIterator();
- const SMDS_MeshElement* aElement = 0;
- while (aSubGroup->More()) {
- aElement = aSubGroup->Next();
- if (aElement) {
- aGroupDS->SMDSGroup().Add(aElement);
- }
- }
- if (aElement)
- aGroupDS->SetType(aElement->GetType());
- }
+ if(MYDEBUG) MESSAGE("UNVToMesh - group added: "<<aName);
+ SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( aSMESHGroup->GetGroupDS() );
+ if ( aGroupDS ) {
+ aGroupDS->SetStoreName(aName.c_str());
+ aSubGroup->InitIterator();
+ const SMDS_MeshElement* aElement = 0;
+ while (aSubGroup->More()) {
+ aElement = aSubGroup->Next();
+ if (aElement) {
+ aGroupDS->SMDSGroup().Add(aElement);
+ }
+ }
+ if (aElement)
+ aGroupDS->SetType(aElement->GetType());
+ }
}
}
}
}
void SMESH_Mesh::ExportMED(const char *file,
- const char* theMeshName,
- bool theAutoGroups,
- int theVersion)
+ const char* theMeshName,
+ bool theAutoGroups,
+ int theVersion)
throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
SMESH_Group* SMESH_Mesh::AddGroup (const SMDSAbs_ElementType theType,
const char* theName,
- int& theId,
+ int& theId,
const TopoDS_Shape& theShape)
{
if (_mapGroup.find(_groupId) != _mapGroup.end())
{
public:
SMESH_Mesh(int theLocalId,
- int theStudyId,
- SMESH_Gen* theGen,
- bool theIsEmbeddedMode,
- SMESHDS_Document* theDocument);
+ int theStudyId,
+ SMESH_Gen* theGen,
+ bool theIsEmbeddedMode,
+ SMESHDS_Document* theDocument);
virtual ~SMESH_Mesh();
* \brief Return True if anHyp is used to mesh aSubShape
*/
bool IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
- const SMESH_subMesh * aSubMesh);
+ const SMESH_subMesh * aSubMesh);
/*!
* \brief check if a hypothesis alowing notconform mesh is present
*/
bool HasDuplicatedGroupNamesMED();
void ExportMED(const char *file,
- const char* theMeshName = NULL,
- bool theAutoGroups = true,
- int theVersion = 0)
+ const char* theMeshName = NULL,
+ bool theAutoGroups = true,
+ int theVersion = 0)
throw(SALOME_Exception);
void ExportDAT(const char *file) throw(SALOME_Exception);
int NbGroup() const { return _mapGroup.size(); }
SMESH_Group* AddGroup (const SMDSAbs_ElementType theType,
- const char* theName,
- int& theId,
+ const char* theName,
+ int& theId,
const TopoDS_Shape& theShape=TopoDS_Shape());
typedef boost::shared_ptr< SMDS_Iterator<SMESH_Group*> > GroupIteratorPtr;
#include <map>
#include <set>
+#include <numeric>
+#include <limits>
#define cast2Node(elem) static_cast<const SMDS_MeshNode*>( elem )
//typedef TNodeOfNodeVecMap::iterator TNodeOfNodeVecMapItr;
//typedef map<const SMDS_MeshElement*, vector<TNodeOfNodeVecMapItr> > TElemOfVecOfMapNodesMap;
-struct TNodeXYZ : public gp_XYZ {
+//=======================================================================
+/*!
+ * \brief SMDS_MeshNode -> gp_XYZ convertor
+ */
+//=======================================================================
+
+struct TNodeXYZ : public gp_XYZ
+{
TNodeXYZ( const SMDS_MeshNode* n ):gp_XYZ( n->X(), n->Y(), n->Z() ) {}
+ double Distance( const SMDS_MeshNode* n )
+ {
+ return gp_Vec( *this, TNodeXYZ( n )).Magnitude();
+ }
+ double SquareDistance( const SMDS_MeshNode* n )
+ {
+ return gp_Vec( *this, TNodeXYZ( n )).SquareMagnitude();
+ }
};
//=======================================================================
return;
}
- issimple[iNode] = (listNewNodes.size()==nbSteps);
+ issimple[iNode] = (listNewNodes.size()==nbSteps); // is node medium
itNN[ iNode ] = listNewNodes.begin();
prevNod[ iNode ] = node;
nextNod[ iNode ] = listNewNodes.front();
- if( !issimple[iNode] ) {
+ if( !elem->IsQuadratic() || !issimple[iNode] ) {
if ( prevNod[ iNode ] != nextNod [ iNode ])
iNotSameNode = iNode;
else {
//cout<<" nbSame = "<<nbSame<<endl;
if ( nbSame == nbNodes || nbSame > 2) {
- //MESSAGE( " Too many same nodes of element " << elem->GetID() );
- INFOS( " Too many same nodes of element " << elem->GetID() );
+ MESSAGE( " Too many same nodes of element " << elem->GetID() );
+ //INFOS( " Too many same nodes of element " << elem->GetID() );
return;
}
return newGroupIDs;
}
-//=======================================================================
-//function : FindCoincidentNodes
-//purpose : Return list of group of nodes close to each other within theTolerance
-// Search among theNodes or in the whole mesh if theNodes is empty using
-// an Octree algorithm
-//=======================================================================
+//================================================================================
+/*!
+ * \brief Return list of group of nodes close to each other within theTolerance
+ * Search among theNodes or in the whole mesh if theNodes is empty using
+ * an Octree algorithm
+ */
+//================================================================================
void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes,
const double theTolerance,
}
else
nodes=theNodes;
- SMESH_OctreeNode::FindCoincidentNodes ( nodes, &theGroupsOfNodes, theTolerance);
+ SMESH_OctreeNode::FindCoincidentNodes ( nodes, &theGroupsOfNodes, theTolerance);
}
+
//=======================================================================
/*!
* \brief Implementation of search for the node closest to point
struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
{
+ //---------------------------------------------------------------------
/*!
* \brief Constructor
*/
SMESH_NodeSearcherImpl( const SMESHDS_Mesh* theMesh )
{
+ myMesh = ( SMESHDS_Mesh* ) theMesh;
+
set<const SMDS_MeshNode*> nodes;
if ( theMesh ) {
SMDS_NodeIteratorPtr nIt = theMesh->nodesIterator();
nodes.insert( nodes.end(), nIt->next() );
}
myOctreeNode = new SMESH_OctreeNode(nodes) ;
+
+ // get max size of a leaf box
+ SMESH_OctreeNode* tree = myOctreeNode;
+ while ( !tree->isLeaf() )
+ {
+ SMESH_OctreeNodeIteratorPtr cIt = tree->GetChildrenIterator();
+ if ( cIt->more() )
+ tree = cIt->next();
+ }
+ myHalfLeafSize = tree->maxSize() / 2.;
}
+
+ //---------------------------------------------------------------------
+ /*!
+ * \brief Move node and update myOctreeNode accordingly
+ */
+ void MoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt )
+ {
+ myOctreeNode->UpdateByMoveNode( node, toPnt );
+ myMesh->MoveNode( node, toPnt.X(), toPnt.Y(), toPnt.Z() );
+ }
+
+ //---------------------------------------------------------------------
/*!
* \brief Do it's job
*/
const SMDS_MeshNode* FindClosestTo( const gp_Pnt& thePnt )
{
SMDS_MeshNode tgtNode( thePnt.X(), thePnt.Y(), thePnt.Z() );
+ map<double, const SMDS_MeshNode*> dist2Nodes;
+ myOctreeNode->NodesAround( &tgtNode, dist2Nodes, myHalfLeafSize );
+ if ( !dist2Nodes.empty() )
+ return dist2Nodes.begin()->second;
list<const SMDS_MeshNode*> nodes;
- //const double precision = 1e-6;
- //myOctreeNode->NodesAround( &tgtNode, &nodes, precision );
+ //myOctreeNode->NodesAround( &tgtNode, &nodes, myHalfLeafSize );
double minSqDist = DBL_MAX;
- Bnd_B3d box;
if ( nodes.empty() ) // get all nodes of OctreeNode's closest to thePnt
{
// sort leafs by their distance from thePnt
list< SMESH_OctreeNode* > treeList;
list< SMESH_OctreeNode* >::iterator trIt;
treeList.push_back( myOctreeNode );
+
+ SMDS_MeshNode pointNode( thePnt.X(), thePnt.Y(), thePnt.Z() );
for ( trIt = treeList.begin(); trIt != treeList.end(); ++trIt)
{
SMESH_OctreeNode* tree = *trIt;
- if ( !tree->isLeaf() ) { // put children to the queue
+ if ( !tree->isLeaf() ) // put children to the queue
+ {
+ if ( !tree->isInside( &pointNode, myHalfLeafSize )) continue;
SMESH_OctreeNodeIteratorPtr cIt = tree->GetChildrenIterator();
while ( cIt->more() )
treeList.push_back( cIt->next() );
}
- else if ( tree->NbNodes() ) { // put tree to treeMap
- tree->getBox( box );
+ else if ( tree->NbNodes() ) // put a tree to the treeMap
+ {
+ const Bnd_B3d& box = tree->getBox();
double sqDist = thePnt.SquareDistance( 0.5 * ( box.CornerMin() + box.CornerMax() ));
pair<TDistTreeMap::iterator,bool> it_in = treeMap.insert( make_pair( sqDist, tree ));
if ( !it_in.second ) // not unique distance to box center
- treeMap.insert( it_in.first, make_pair( sqDist - 1e-13*treeMap.size(), tree ));
+ treeMap.insert( it_in.first, make_pair( sqDist + 1e-13*treeMap.size(), tree ));
}
}
// find distance after which there is no sense to check tree's
TDistTreeMap::iterator sqDist_tree = treeMap.begin();
if ( treeMap.size() > 5 ) {
SMESH_OctreeNode* closestTree = sqDist_tree->second;
- closestTree->getBox( box );
+ const Bnd_B3d& box = closestTree->getBox();
double limit = sqrt( sqDist_tree->first ) + sqrt ( box.SquareExtent() );
sqLimit = limit * limit;
}
}
return closestNode;
}
+
+ //---------------------------------------------------------------------
/*!
* \brief Destructor
*/
~SMESH_NodeSearcherImpl() { delete myOctreeNode; }
+
+ //---------------------------------------------------------------------
+ /*!
+ * \brief Return the node tree
+ */
+ const SMESH_OctreeNode* getTree() const { return myOctreeNode; }
+
private:
SMESH_OctreeNode* myOctreeNode;
+ SMESHDS_Mesh* myMesh;
+ double myHalfLeafSize; // max size of a leaf box
};
//=======================================================================
return new SMESH_NodeSearcherImpl( GetMeshDS() );
}
+// ========================================================================
+namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
+{
+ const int MaxNbElemsInLeaf = 10; // maximal number of elements in a leaf of tree
+ const int MaxLevel = 7; // maximal tree height -> nb terminal boxes: 8^7 = 2097152
+ const double NodeRadius = 1e-9; // to enlarge bnd box of element
+
+ //=======================================================================
+ /*!
+ * \brief Octal tree of bounding boxes of elements
+ */
+ //=======================================================================
+
+ class ElementBndBoxTree : public SMESH_Octree
+ {
+ public:
+
+ ElementBndBoxTree(const SMDS_Mesh& mesh, SMDSAbs_ElementType elemType);
+ void getElementsNearPoint( const gp_Pnt& point, TIDSortedElemSet& foundElems);
+ ~ElementBndBoxTree();
+
+ protected:
+ ElementBndBoxTree() {}
+ SMESH_Octree* allocateOctreeChild() const { return new ElementBndBoxTree; }
+ void buildChildrenData();
+ Bnd_B3d* buildRootBox();
+ private:
+ //!< Bounding box of element
+ struct ElementBox : public Bnd_B3d
+ {
+ const SMDS_MeshElement* _element;
+ int _refCount; // an ElementBox can be included in several tree branches
+ ElementBox(const SMDS_MeshElement* elem);
+ };
+ vector< ElementBox* > _elements;
+ };
+
+ //================================================================================
+ /*!
+ * \brief ElementBndBoxTree creation
+ */
+ //================================================================================
+
+ ElementBndBoxTree::ElementBndBoxTree(const SMDS_Mesh& mesh, SMDSAbs_ElementType elemType)
+ :SMESH_Octree( new SMESH_Octree::Limit( MaxLevel, /*minSize=*/0. ))
+ {
+ int nbElems = mesh.GetMeshInfo().NbElements( elemType );
+ _elements.reserve( nbElems );
+
+ SMDS_ElemIteratorPtr elemIt = mesh.elementsIterator( elemType );
+ while ( elemIt->more() )
+ _elements.push_back( new ElementBox( elemIt->next() ));
+
+ if ( _elements.size() > MaxNbElemsInLeaf )
+ compute();
+ else
+ myIsLeaf = true;
+ }
+
+ //================================================================================
+ /*!
+ * \brief Destructor
+ */
+ //================================================================================
+
+ ElementBndBoxTree::~ElementBndBoxTree()
+ {
+ for ( int i = 0; i < _elements.size(); ++i )
+ if ( --_elements[i]->_refCount <= 0 )
+ delete _elements[i];
+ }
+
+ //================================================================================
+ /*!
+ * \brief Return the maximal box
+ */
+ //================================================================================
+
+ Bnd_B3d* ElementBndBoxTree::buildRootBox()
+ {
+ Bnd_B3d* box = new Bnd_B3d;
+ for ( int i = 0; i < _elements.size(); ++i )
+ box->Add( *_elements[i] );
+ return box;
+ }
+
+ //================================================================================
+ /*!
+ * \brief Redistrubute element boxes among children
+ */
+ //================================================================================
+
+ void ElementBndBoxTree::buildChildrenData()
+ {
+ for ( int i = 0; i < _elements.size(); ++i )
+ {
+ for (int j = 0; j < 8; j++)
+ {
+ if ( !_elements[i]->IsOut( myChildren[j]->getBox() ))
+ {
+ _elements[i]->_refCount++;
+ ((ElementBndBoxTree*)myChildren[j])->_elements.push_back( _elements[i]);
+ }
+ }
+ _elements[i]->_refCount--;
+ }
+ _elements.clear();
+
+ for (int j = 0; j < 8; j++)
+ {
+ ElementBndBoxTree* child = static_cast<ElementBndBoxTree*>( myChildren[j]);
+ if ( child->_elements.size() <= MaxNbElemsInLeaf )
+ child->myIsLeaf = true;
+
+ if ( child->_elements.capacity() - child->_elements.size() > 1000 )
+ child->_elements.resize( child->_elements.size() ); // compact
+ }
+ }
+
+ //================================================================================
+ /*!
+ * \brief Return elements which can include the point
+ */
+ //================================================================================
+
+ void ElementBndBoxTree::getElementsNearPoint( const gp_Pnt& point,
+ TIDSortedElemSet& foundElems)
+ {
+ if ( level() && getBox().IsOut( point.XYZ() ))
+ return;
+
+ if ( isLeaf() )
+ {
+ for ( int i = 0; i < _elements.size(); ++i )
+ if ( !_elements[i]->IsOut( point.XYZ() ))
+ foundElems.insert( _elements[i]->_element );
+ }
+ else
+ {
+ for (int i = 0; i < 8; i++)
+ ((ElementBndBoxTree*) myChildren[i])->getElementsNearPoint( point, foundElems );
+ }
+ }
+
+ //================================================================================
+ /*!
+ * \brief Construct the element box
+ */
+ //================================================================================
+
+ ElementBndBoxTree::ElementBox::ElementBox(const SMDS_MeshElement* elem)
+ {
+ _element = elem;
+ _refCount = 1;
+ SMDS_ElemIteratorPtr nIt = elem->nodesIterator();
+ while ( nIt->more() )
+ Add( TNodeXYZ( cast2Node( nIt->next() )));
+ Enlarge( NodeRadius );
+ }
+
+} // namespace
+
+//=======================================================================
+/*!
+ * \brief Implementation of search for the elements by point
+ */
+//=======================================================================
+
+struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher
+{
+ SMESHDS_Mesh* _mesh;
+ ElementBndBoxTree* _ebbTree;
+ SMESH_NodeSearcherImpl* _nodeSearcher;
+ SMDSAbs_ElementType _elementType;
+
+ SMESH_ElementSearcherImpl( SMESHDS_Mesh& mesh ): _mesh(&mesh),_ebbTree(0),_nodeSearcher(0) {}
+ ~SMESH_ElementSearcherImpl()
+ {
+ if ( _ebbTree ) delete _ebbTree; _ebbTree = 0;
+ if ( _nodeSearcher ) delete _nodeSearcher; _nodeSearcher = 0;
+ }
+
+ /*!
+ * \brief Return elements of given type where the given point is IN or ON.
+ *
+ * 'ALL' type means elements of any type excluding nodes and 0D elements
+ */
+ void FindElementsByPoint(const gp_Pnt& point,
+ SMDSAbs_ElementType type,
+ vector< const SMDS_MeshElement* >& foundElements)
+ {
+ foundElements.clear();
+
+ const SMDS_MeshInfo& meshInfo = _mesh->GetMeshInfo();
+
+ // -----------------
+ // define tolerance
+ // -----------------
+ double tolerance = 0;
+ if ( _nodeSearcher && meshInfo.NbNodes() > 1 )
+ {
+ double boxSize = _nodeSearcher->getTree()->maxSize();
+ tolerance = 1e-8 * boxSize/* / meshInfo.NbNodes()*/;
+ }
+ else if ( _ebbTree && meshInfo.NbElements() > 0 )
+ {
+ double boxSize = _ebbTree->maxSize();
+ tolerance = 1e-8 * boxSize/* / meshInfo.NbElements()*/;
+ }
+ if ( tolerance == 0 )
+ {
+ // define tolerance by size of a most complex element
+ int complexType = SMDSAbs_Volume;
+ while ( complexType > SMDSAbs_All &&
+ meshInfo.NbElements( SMDSAbs_ElementType( complexType )) < 1 )
+ --complexType;
+ if ( complexType == SMDSAbs_All ) return; // empty mesh
+
+ double elemSize;
+ if ( complexType == int( SMDSAbs_Node ))
+ {
+ SMDS_NodeIteratorPtr nodeIt = _mesh->nodesIterator();
+ elemSize = 1;
+ if ( meshInfo.NbNodes() > 2 )
+ elemSize = TNodeXYZ( nodeIt->next() ).Distance( nodeIt->next() );
+ }
+ else
+ {
+ const SMDS_MeshElement* elem =
+ _mesh->elementsIterator( SMDSAbs_ElementType( complexType ))->next();
+ SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
+ TNodeXYZ n1( cast2Node( nodeIt->next() ));
+ while ( nodeIt->more() )
+ {
+ double dist = n1.Distance( cast2Node( nodeIt->next() ));
+ elemSize = max( dist, elemSize );
+ }
+ }
+ tolerance = 1e-6 * elemSize;
+ }
+
+ // =================================================================================
+ if ( type == SMDSAbs_Node || type == SMDSAbs_0DElement )
+ {
+ if ( !_nodeSearcher )
+ _nodeSearcher = new SMESH_NodeSearcherImpl( _mesh );
+
+ const SMDS_MeshNode* closeNode = _nodeSearcher->FindClosestTo( point );
+ if ( !closeNode ) return;
+
+ if ( point.Distance( TNodeXYZ( closeNode )) > tolerance )
+ return; // to far from any node
+
+ if ( type == SMDSAbs_Node )
+ {
+ foundElements.push_back( closeNode );
+ }
+ else
+ {
+ SMDS_ElemIteratorPtr elemIt = closeNode->GetInverseElementIterator( SMDSAbs_0DElement );
+ while ( elemIt->more() )
+ foundElements.push_back( elemIt->next() );
+ }
+ }
+ // =================================================================================
+ else // elements more complex than 0D
+ {
+ if ( !_ebbTree || _elementType != type )
+ {
+ if ( _ebbTree ) delete _ebbTree;
+ _ebbTree = new ElementBndBoxTree( *_mesh, _elementType = type );
+ }
+ TIDSortedElemSet suspectElems;
+ _ebbTree->getElementsNearPoint( point, suspectElems );
+ TIDSortedElemSet::iterator elem = suspectElems.begin();
+ for ( ; elem != suspectElems.end(); ++elem )
+ if ( !SMESH_MeshEditor::isOut( *elem, point, tolerance ))
+ foundElements.push_back( *elem );
+ }
+ }
+}; // struct SMESH_ElementSearcherImpl
+
+//=======================================================================
+/*!
+ * \brief Return SMESH_ElementSearcher
+ */
+//=======================================================================
+
+SMESH_ElementSearcher* SMESH_MeshEditor::GetElementSearcher()
+{
+ return new SMESH_ElementSearcherImpl( *GetMeshDS() );
+}
+
+//=======================================================================
+/*!
+ * \brief Return true if the point is IN or ON of the element
+ */
+//=======================================================================
+
+bool SMESH_MeshEditor::isOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol )
+{
+ if ( element->GetType() == SMDSAbs_Volume)
+ {
+ return SMDS_VolumeTool( element ).IsOut( point.X(), point.Y(), point.Z(), tol );
+ }
+
+ // get ordered nodes
+
+ vector< gp_XYZ > xyz;
+
+ SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
+ if ( element->IsQuadratic() )
+ if (const SMDS_QuadraticFaceOfNodes* f=dynamic_cast<const SMDS_QuadraticFaceOfNodes*>(element))
+ nodeIt = f->interlacedNodesElemIterator();
+ else if (const SMDS_QuadraticEdge* e =dynamic_cast<const SMDS_QuadraticEdge*>(element))
+ nodeIt = e->interlacedNodesElemIterator();
+
+ while ( nodeIt->more() )
+ xyz.push_back( TNodeXYZ( cast2Node( nodeIt->next() )));
+
+ if ( element->GetType() == SMDSAbs_Face ) // --------------------------------------------------
+ {
+ // gravity center
+ gp_XYZ gc(0,0,0);
+ gc = accumulate( xyz.begin(), xyz.end(), gc );
+ gc /= element->NbNodes();
+
+ // compute face normal using gc
+ gp_Vec normal(0,0,0);
+ xyz.push_back( xyz.front() );
+ for ( int i = 0; i < element->NbNodes(); ++i )
+ {
+ gp_Vec edge( xyz[i], xyz[i+1]);
+ gp_Vec n2gc( xyz[i], gc );
+ normal += edge ^ n2gc;
+ }
+ double faceDoubleArea = normal.Magnitude();
+ if ( faceDoubleArea <= numeric_limits<double>::min() )
+ return true; // invalid face
+ normal /= faceDoubleArea;
+
+ // check if the point lays on face plane
+ gp_Vec n2p( xyz[0], point );
+ if ( fabs( n2p * normal ) > tol )
+ return true; // not on face plane
+
+ // check if point is out of face boundary
+ int i, out = false;
+ for ( i = 0; !out && i < element->NbNodes(); ++i )
+ {
+ gp_Vec edge( xyz[i], xyz[i+1]);
+ gp_Vec n2p ( xyz[i], point );
+ gp_Vec cross = edge ^ n2p;
+ out = ( cross * normal < -tol );
+ }
+ if ( out && element->IsPoly() )
+ {
+ // define point position by the closest edge
+ double minDist = numeric_limits<double>::max();
+ int iMinDist;
+ for ( i = 0; i < element->NbNodes(); ++i )
+ {
+ gp_Vec edge( xyz[i], xyz[i+1]);
+ gp_Vec n1p ( xyz[i], point);
+ double dist = ( edge ^ n1p ).Magnitude() / edge.Magnitude();
+ if ( dist < minDist )
+ iMinDist = i;
+ }
+ gp_Vec edge( xyz[iMinDist], xyz[iMinDist+1]);
+ gp_Vec n2p ( xyz[iMinDist], point );
+ gp_Vec cross = edge ^ n2p;
+ out = ( cross * normal < -tol );
+ }
+ return out;
+ }
+ if ( element->GetType() == SMDSAbs_Edge ) // --------------------------------------------------
+ {
+ for ( int i = 1; i < element->NbNodes(); ++i )
+ {
+ gp_Vec edge( xyz[i-1], xyz[i]);
+ gp_Vec n1p ( xyz[i-1], point);
+ double dist = ( edge ^ n1p ).Magnitude() / edge.Magnitude();
+ if ( dist > tol )
+ return true;
+ gp_Vec n2p( xyz[i], point );
+ if ( fabs( edge.Magnitude() - n1p.Magnitude() - n2p.Magnitude()) > tol )
+ return true;
+ }
+ return false;
+ }
+ // Node or 0D element -------------------------------------------------------------------------
+ {
+ gp_Vec n2p ( xyz[0], point );
+ return n2p.Magnitude() <= tol;
+ }
+ return true;
+}
+
//=======================================================================
//function : SimplifyFace
//purpose :
//vector<const SMDS_MeshNode*> nodes;
const SMDS_MeshNode *nIgnore = theFirstNode, *nStart = theSecondNode;
- set < const SMDS_MeshElement* > foundElems;
+ TIDSortedElemSet foundElems;
bool needTheLast = ( theLastNode != 0 );
while ( nStart != theLastNode ) {
case 4:
NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d);
break;
+ case 5:
+ NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], id, theForce3d);
+ break;
case 6:
NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], aNds[5], id, theForce3d);
break;
SMESH_subMesh* sm = smIt->next();
if ( SMESHDS_SubMesh *smDS = sm->GetSubMeshDS() ) {
aHelper.SetSubShape( sm->GetSubShape() );
- if ( !theForce3d) aHelper.SetCheckNodePosition(true);
nbCheckedElems += convertElemToQuadratic(smDS, aHelper, theForce3d);
}
}
NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
aNds[3], id, theForce3d );
break;
+ case 5:
+ NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
+ aNds[3], aNds[4], id, theForce3d);
+ break;
case 6:
NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
aNds[3], aNds[4], aNds[5], id, theForce3d);
theNodeNodeMap[ aCurrNode ] = aNewNode;
myLastCreatedNodes.Append( aNewNode );
}
- isDuplicate |= (aCurrNode == aNewNode);
+ isDuplicate |= (aCurrNode != aNewNode);
newNodes[ ind++ ] = aNewNode;
}
if ( !isDuplicate )
return (aState == TopAbs_IN || aState == TopAbs_ON );
}
+/*!
+ \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+ \param theNodes - identifiers of nodes to be doubled
+ \param theModifiedElems - identifiers of elements to be updated by the new (doubled)
+ nodes. If list of element identifiers is empty then nodes are doubled but
+ they not assigned to elements
+ \return TRUE if operation has been completed successfully, FALSE otherwise
+*/
+bool SMESH_MeshEditor::DoubleNodes( const std::list< int >& theListOfNodes,
+ const std::list< int >& theListOfModifiedElems )
+{
+ myLastCreatedElems.Clear();
+ myLastCreatedNodes.Clear();
+
+ if ( theListOfNodes.size() == 0 )
+ return false;
+
+ SMESHDS_Mesh* aMeshDS = GetMeshDS();
+ if ( !aMeshDS )
+ return false;
+
+ // iterate through nodes and duplicate them
+
+ std::map< const SMDS_MeshNode*, const SMDS_MeshNode* > anOldNodeToNewNode;
+
+ std::list< int >::const_iterator aNodeIter;
+ for ( aNodeIter = theListOfNodes.begin(); aNodeIter != theListOfNodes.end(); ++aNodeIter )
+ {
+ int aCurr = *aNodeIter;
+ SMDS_MeshNode* aNode = (SMDS_MeshNode*)aMeshDS->FindNode( aCurr );
+ if ( !aNode )
+ continue;
+
+ // duplicate node
+
+ const SMDS_MeshNode* aNewNode = aMeshDS->AddNode( aNode->X(), aNode->Y(), aNode->Z() );
+ if ( aNewNode )
+ {
+ anOldNodeToNewNode[ aNode ] = aNewNode;
+ myLastCreatedNodes.Append( aNewNode );
+ }
+ }
+
+ // Create map of new nodes for modified elements
+
+ std::map< SMDS_MeshElement*, vector<const SMDS_MeshNode*> > anElemToNodes;
+
+ std::list< int >::const_iterator anElemIter;
+ for ( anElemIter = theListOfModifiedElems.begin();
+ anElemIter != theListOfModifiedElems.end(); ++anElemIter )
+ {
+ int aCurr = *anElemIter;
+ SMDS_MeshElement* anElem = (SMDS_MeshElement*)aMeshDS->FindElement( aCurr );
+ if ( !anElem )
+ continue;
+
+ vector<const SMDS_MeshNode*> aNodeArr( anElem->NbNodes() );
+
+ SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
+ int ind = 0;
+ while ( anIter->more() )
+ {
+ SMDS_MeshNode* aCurrNode = (SMDS_MeshNode*)anIter->next();
+ if ( aCurr && anOldNodeToNewNode.find( aCurrNode ) != anOldNodeToNewNode.end() )
+ {
+ const SMDS_MeshNode* aNewNode = anOldNodeToNewNode[ aCurrNode ];
+ aNodeArr[ ind++ ] = aNewNode;
+ }
+ else
+ aNodeArr[ ind++ ] = aCurrNode;
+ }
+ anElemToNodes[ anElem ] = aNodeArr;
+ }
+
+ // Change nodes of elements
+
+ std::map< SMDS_MeshElement*, vector<const SMDS_MeshNode*> >::iterator
+ anElemToNodesIter = anElemToNodes.begin();
+ for ( ; anElemToNodesIter != anElemToNodes.end(); ++anElemToNodesIter )
+ {
+ const SMDS_MeshElement* anElem = anElemToNodesIter->first;
+ vector<const SMDS_MeshNode*> aNodeArr = anElemToNodesIter->second;
+ if ( anElem )
+ aMeshDS->ChangeElementNodes( anElem, &aNodeArr[ 0 ], anElem->NbNodes() );
+ }
+
+ return true;
+}
+
/*!
\brief Creates a hole in a mesh by doubling the nodes of some particular elements
\param theElems - group of of elements (edges or faces) to be replicated
const TIDSortedElemSet& theNodesNot,
const TopoDS_Shape& theShape )
{
- SMESHDS_Mesh* aMesh = GetMeshDS();
- if (!aMesh)
- return false;
if ( theShape.IsNull() )
return false;
}
return DoubleNodes( theElems, theNodesNot, anAffected );
}
+
+/*!
+ * \brief Generated skin mesh (containing 2D cells) from 3D mesh
+ * The created 2D mesh elements based on nodes of free faces of boundary volumes
+ * \return TRUE if operation has been completed successfully, FALSE otherwise
+ */
+
+bool SMESH_MeshEditor::Make2DMeshFrom3D()
+{
+ // iterates on volume elements and detect all free faces on them
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+ if (!aMesh)
+ return false;
+ bool res = false;
+ SMDS_VolumeIteratorPtr vIt = aMesh->volumesIterator();
+ while(vIt->more())
+ {
+ const SMDS_MeshVolume* volume = vIt->next();
+ SMDS_VolumeTool vTool( volume );
+ const bool isPoly = volume->IsPoly();
+ const bool isQuad = volume->IsQuadratic();
+ for ( int iface = 0, n = vTool.NbFaces(); iface < n; iface++ )
+ {
+ if (!vTool.IsFreeFace(iface))
+ continue;
+ vector<const SMDS_MeshNode *> nodes;
+ int nbFaceNodes = vTool.NbFaceNodes(iface);
+ const SMDS_MeshNode** faceNodes = vTool.GetFaceNodes(iface);
+ if (vTool.IsFaceExternal(iface))
+ {
+ int inode = 0;
+ for ( ; inode < nbFaceNodes; inode += isQuad ? 2 : 1)
+ nodes.push_back(faceNodes[inode]);
+ if (isQuad)
+ for ( inode = 1; inode < nbFaceNodes; inode += 2)
+ nodes.push_back(faceNodes[inode]);
+ }
+ else
+ {
+ int inode = nbFaceNodes-1;
+ for ( ; inode >=0; inode -= isQuad ? 2 : 1)
+ nodes.push_back(faceNodes[inode]);
+ if (isQuad)
+ for ( inode = nbFaceNodes-2; inode >=0; inode -= 2)
+ nodes.push_back(faceNodes[inode]);
+ }
+
+ // add new face based on volume nodes
+ if (aMesh->FindFace( nodes ) )
+ continue; // face already exsist
+ myLastCreatedElems.Append( AddElement(nodes, SMDSAbs_Face, isPoly && iface == 1) );
+ res = true;
+ }
+ }
+ return res;
+}
std::list<const SMDS_MeshElement*> > TElemOfElemListMap;
typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
- //!< Set of elements sorted by ID, to be used to assure predictability of edition
+//!< Set of elements sorted by ID, to be used to assure predictability of edition
typedef std::set< const SMDS_MeshElement*, TIDCompare > TIDSortedElemSet;
typedef pair< const SMDS_MeshNode*, const SMDS_MeshNode* > NLink;
+//=======================================================================
+/*!
+ * \brief Searcher for the node closest to point
+ */
+//=======================================================================
+struct SMESH_NodeSearcher
+{
+ virtual const SMDS_MeshNode* FindClosestTo( const gp_Pnt& pnt ) = 0;
+ virtual void MoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt ) = 0;
+};
+
+//=======================================================================
+/*!
+ * \brief Return elements of given type where the given point is IN or ON.
+ *
+ * 'ALL' type means elements of any type excluding nodes and 0D elements
+ */
+//=======================================================================
+
+struct SMESH_ElementSearcher
+{
+ virtual void FindElementsByPoint(const gp_Pnt& point,
+ SMDSAbs_ElementType type,
+ std::vector< const SMDS_MeshElement* >& foundElems)=0;
+};
+
//=======================================================================
/*!
* \brief A sorted pair of nodes
const SMDS_MeshNode* node2() const { return second; }
};
-// ============================================================
-/*!
- * \brief Searcher for the node closest to point
- */
-// ============================================================
-
-struct SMESH_NodeSearcher
-{
- virtual const SMDS_MeshNode* FindClosestTo( const gp_Pnt& pnt ) = 0;
-};
-
-
//=======================================================================
/*!
* auxiliary class
SMESH_Mesh* theTargetMesh=0);
// Move or copy theElements applying theTrsf to their nodes
+
typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
void FindCoincidentNodes (std::set<const SMDS_MeshNode*> & theNodes,
*/
SMESH_NodeSearcher* GetNodeSearcher();
+ /*!
+ * \brief Return SMESH_ElementSearcher
+ */
+ SMESH_ElementSearcher* GetElementSearcher();
+ /*!
+ * \brief Return true if the point is IN or ON of the element
+ */
+ static bool isOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol );
+
+
int SimplifyFace (const std::vector<const SMDS_MeshNode *> faceNodes,
std::vector<const SMDS_MeshNode *>& poly_nodes,
std::vector<int>& quantities) const;
typedef std::list< std::list< int > > TListOfListOfElementsID;
void FindEqualElements(std::set<const SMDS_MeshElement*> & theElements,
- TListOfListOfElementsID & theGroupsOfElementsID);
+ TListOfListOfElementsID & theGroupsOfElementsID);
// Return list of group of elements build on the same nodes.
// Search among theElements or in the whole mesh if theElements is empty.
const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; }
const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; }
+
+ bool DoubleNodes( const std::list< int >& theListOfNodes,
+ const std::list< int >& theListOfModifiedElems );
bool DoubleNodes( const TIDSortedElemSet& theElems,
const TIDSortedElemSet& theNodesNot,
bool DoubleNodesInRegion( const TIDSortedElemSet& theElems,
const TIDSortedElemSet& theNodesNot,
const TopoDS_Shape& theShape );
-
+
+ /*!
+ * \brief Generated skin mesh (containing 2D cells) from 3D mesh
+ * The created 2D mesh elements based on nodes of free faces of boundary volumes
+ * \return TRUE if operation has been completed successfully, FALSE otherwise
+ */
+ bool Make2DMeshFrom3D();
+
private:
/*!
* auxilary for ExtrusionAlongTrack
*/
Extrusion_Error MakeEdgePathPoints(std::list<double>& aPrms,
- const TopoDS_Edge& aTrackEdge,
- bool FirstIsStart,
- list<SMESH_MeshEditor_PathPoint>& LPP);
+ const TopoDS_Edge& aTrackEdge,
+ bool FirstIsStart,
+ list<SMESH_MeshEditor_PathPoint>& LPP);
Extrusion_Error MakeExtrElements(TIDSortedElemSet& theElements,
- list<SMESH_MeshEditor_PathPoint>& fullList,
- const bool theHasAngles,
- list<double>& theAngles,
- const bool theLinearVariation,
- const bool theHasRefPoint,
- const gp_Pnt& theRefPoint,
- const bool theMakeGroups);
+ list<SMESH_MeshEditor_PathPoint>& fullList,
+ const bool theHasAngles,
+ list<double>& theAngles,
+ const bool theLinearVariation,
+ const bool theHasRefPoint,
+ const gp_Pnt& theRefPoint,
+ const bool theMakeGroups);
void LinearAngleVariation(const int NbSteps,
- list<double>& theAngles);
+ list<double>& theAngles);
bool doubleNodes( SMESHDS_Mesh* theMeshDS,
const TIDSortedElemSet& theElems,
const TIDSortedElemSet& theNodesNot,
std::map< const SMDS_MeshNode*,
- const SMDS_MeshNode* >& theNodeNodeMap,
+ const SMDS_MeshNode* >& theNodeNodeMap,
const bool theIsDoubleElem );
private:
//================================================================================
SMESH_MesherHelper::SMESH_MesherHelper(SMESH_Mesh& theMesh)
- : myMesh(&theMesh), myShapeID(0), myCreateQuadratic(false), myCheckNodePos(false)
+ : myMesh(&theMesh), myShapeID(0), myCreateQuadratic(false)
{
mySetElemOnShape = ( ! myMesh->HasShapeToMesh() );
}
* \param F - the face
* \param n - the node
* \param n2 - a node of element being created located inside a face
+ * \param check - optional flag returing false if found UV are invalid
* \retval gp_XY - resulting UV
- *
- * Auxilary function called form GetMediumNode()
*/
//=======================================================================
{
gp_Pnt2d uv( 1e100, 1e100 );
const SMDS_PositionPtr Pos = n->GetPosition();
+ bool uvOK = false;
if(Pos->GetTypeOfPosition()==SMDS_TOP_FACE)
{
// node has position on face
const SMDS_FacePosition* fpos =
static_cast<const SMDS_FacePosition*>(n->GetPosition().get());
uv.SetCoord(fpos->GetUParameter(),fpos->GetVParameter());
- if ( check && *check )
- {
- // check that uv is correct
- TopLoc_Location loc;
- Handle(Geom_Surface) surface = BRep_Tool::Surface( F,loc );
- double tol = 2 * BRep_Tool::Tolerance( F );
- gp_Pnt nodePnt = XYZ( n );
- if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() );
- if ( nodePnt.Distance( surface->Value( uv.X(), uv.Y() )) > tol ) {
- // uv incorrect, project the node to surface
- GeomAPI_ProjectPointOnSurf projector( nodePnt, surface, tol );
- if ( !projector.IsDone() || projector.NbPoints() < 1 ) {
- MESSAGE( "SMESH_MesherHelper::GetNodeUV() failed to project" )
- return uv.XY();
- }
- Quantity_Parameter U,V;
- projector.LowerDistanceParameters(U,V);
- if ( nodePnt.Distance( surface->Value( U, V )) > tol )
- MESSAGE( "SMESH_MesherHelper::GetNodeUV(), invalid projection" );
- uv.SetCoord( U,V );
- }
- else if ( uv.XY().Modulus() > numeric_limits<double>::min() ) {
- *check = false; // parameters are OK, do not check further more
- }
- }
+ uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), BRep_Tool::Tolerance( F ));
}
else if(Pos->GetTypeOfPosition()==SMDS_TOP_EDGE)
{
static_cast<const SMDS_EdgePosition*>(n->GetPosition().get());
int edgeID = Pos->GetShapeId();
TopoDS_Edge E = TopoDS::Edge(GetMeshDS()->IndexToShape(edgeID));
- double f, l;
+ double f, l, u = epos->GetUParameter();
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
- uv = C2d->Value( epos->GetUParameter() );
+ if ( f < u && u < l )
+ uv = C2d->Value( u );
+ else
+ uv.SetCoord(0.,0.);
+ uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), BRep_Tool::Tolerance( E ));
+
// for a node on a seam edge select one of UVs on 2 pcurves
if ( n2 && IsSeamShape( edgeID ) )
+ {
uv = GetUVOnSeam( uv, GetNodeUV( F, n2, 0 ));
-
- // adjust uv to period
- TopLoc_Location loc;
- Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
- Standard_Boolean isUPeriodic = S->IsUPeriodic();
- Standard_Boolean isVPeriodic = S->IsVPeriodic();
- if ( isUPeriodic || isVPeriodic ) {
- Standard_Real UF,UL,VF,VL;
- S->Bounds(UF,UL,VF,VL);
- if(isUPeriodic)
- uv.SetX( uv.X() + ShapeAnalysis::AdjustToPeriod(uv.X(),UF,UL));
- if(isVPeriodic)
- uv.SetY( uv.Y() + ShapeAnalysis::AdjustToPeriod(uv.Y(),VF,VL));
+ }
+ else
+ { // adjust uv to period
+ TopLoc_Location loc;
+ Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
+ Standard_Boolean isUPeriodic = S->IsUPeriodic();
+ Standard_Boolean isVPeriodic = S->IsVPeriodic();
+ if ( isUPeriodic || isVPeriodic ) {
+ Standard_Real UF,UL,VF,VL;
+ S->Bounds(UF,UL,VF,VL);
+ if(isUPeriodic)
+ uv.SetX( uv.X() + ShapeAnalysis::AdjustToPeriod(uv.X(),UF,UL));
+ if(isVPeriodic)
+ uv.SetY( uv.Y() + ShapeAnalysis::AdjustToPeriod(uv.Y(),VF,VL));
+ }
}
}
else if(Pos->GetTypeOfPosition()==SMDS_TOP_VERTEX)
{
if ( int vertexID = n->GetPosition()->GetShapeId() ) {
- bool ok = true;
const TopoDS_Vertex& V = TopoDS::Vertex(GetMeshDS()->IndexToShape(vertexID));
try {
uv = BRep_Tool::Parameters( V, F );
+ uvOK = true;
}
catch (Standard_Failure& exc) {
- ok = false;
}
- if ( !ok ) {
- for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !ok && vert.More(); vert.Next() )
- ok = ( V == vert.Current() );
- if ( !ok ) {
+ if ( !uvOK ) {
+ for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !uvOK && vert.More(); vert.Next() )
+ uvOK = ( V == vert.Current() );
+ if ( !uvOK ) {
#ifdef _DEBUG_
MESSAGE ( "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID
<< " not in face " << GetMeshDS()->ShapeToIndex( F ) );
// get UV of a vertex closest to the node
double dist = 1e100;
gp_Pnt pn = XYZ( n );
- for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !ok && vert.More(); vert.Next() ) {
+ for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !uvOK && vert.More(); vert.Next() ) {
TopoDS_Vertex curV = TopoDS::Vertex( vert.Current() );
gp_Pnt p = BRep_Tool::Pnt( curV );
double curDist = p.SquareDistance( pn );
if ( curDist < dist ) {
dist = curDist;
uv = BRep_Tool::Parameters( curV, F );
- if ( dist < DBL_MIN ) break;
+ uvOK = ( dist < DBL_MIN );
}
}
}
uv = GetUVOnSeam( uv, GetNodeUV( F, n2, 0 ));
}
}
+
+ if ( check )
+ *check = uvOK;
+
return uv.XY();
}
+//=======================================================================
+/*!
+ * \brief Check and fix node UV on a face
+ * \retval bool - false if UV is bad and could not be fixed
+ */
+//=======================================================================
+
+bool SMESH_MesherHelper::CheckNodeUV(const TopoDS_Face& F,
+ const SMDS_MeshNode* n,
+ gp_XY& uv,
+ const double tol) const
+{
+ if ( !myOkNodePosShapes.count( n->GetPosition()->GetShapeId() ))
+ {
+ // check that uv is correct
+ TopLoc_Location loc;
+ Handle(Geom_Surface) surface = BRep_Tool::Surface( F,loc );
+ gp_Pnt nodePnt = XYZ( n );
+ if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() );
+ if ( nodePnt.Distance( surface->Value( uv.X(), uv.Y() )) > tol )
+ {
+ // uv incorrect, project the node to surface
+ GeomAPI_ProjectPointOnSurf projector( nodePnt, surface, tol );
+ if ( !projector.IsDone() || projector.NbPoints() < 1 )
+ {
+ MESSAGE( "SMESH_MesherHelper::CheckNodeUV() failed to project" );
+ return false;
+ }
+ Quantity_Parameter U,V;
+ projector.LowerDistanceParameters(U,V);
+ if ( nodePnt.Distance( surface->Value( U, V )) > tol )
+ {
+ MESSAGE( "SMESH_MesherHelper::CheckNodeUV(), invalid projection" );
+ return false;
+ }
+ uv.SetCoord( U,V );
+ }
+ else if ( uv.Modulus() > numeric_limits<double>::min() )
+ {
+ ((SMESH_MesherHelper*) this)->myOkNodePosShapes.insert( n->GetPosition()->GetShapeId() );
+ }
+ }
+ return true;
+}
+
//=======================================================================
/*!
* \brief Return middle UV taking in account surface period
F = TopoDS::Face(myShape);
faceID = myShapeID;
}
+ bool uvOK1, uvOK2;
+ gp_XY p1 = GetNodeUV(F,n1,n2, &uvOK1);
+ gp_XY p2 = GetNodeUV(F,n2,n1, &uvOK2);
- gp_XY p1 = GetNodeUV(F,n1,n2, &myCheckNodePos);
- gp_XY p2 = GetNodeUV(F,n2,n1, &myCheckNodePos);
-
- if ( IsDegenShape( Pos1->GetShapeId() ))
- p1.SetCoord( myParIndex, p2.Coord( myParIndex ));
- else if ( IsDegenShape( Pos2->GetShapeId() ))
- p2.SetCoord( myParIndex, p1.Coord( myParIndex ));
-
- TopLoc_Location loc;
- Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
- gp_XY uv = GetMiddleUV( S, p1, p2 );
- gp_Pnt P = S->Value( uv.X(), uv.Y() ).Transformed(loc);
- n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
- meshDS->SetNodeOnFace(n12, faceID, uv.X(), uv.Y());
- myTLinkNodeMap.insert(make_pair(link,n12));
- return n12;
+ if ( uvOK1 && uvOK2 )
+ {
+ if ( IsDegenShape( Pos1->GetShapeId() ))
+ p1.SetCoord( myParIndex, p2.Coord( myParIndex ));
+ else if ( IsDegenShape( Pos2->GetShapeId() ))
+ p2.SetCoord( myParIndex, p1.Coord( myParIndex ));
+
+ TopLoc_Location loc;
+ Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
+ gp_XY uv = GetMiddleUV( S, p1, p2 );
+ gp_Pnt P = S->Value( uv.X(), uv.Y() ).Transformed(loc);
+ n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
+ meshDS->SetNodeOnFace(n12, faceID, uv.X(), uv.Y());
+ myTLinkNodeMap.insert(make_pair(link,n12));
+ return n12;
+ }
}
if (edgeID>0 || shapeType == TopAbs_EDGE) {
edgeID = myShapeID;
}
- double p1 = GetNodeU(E,n1, &myCheckNodePos);
- double p2 = GetNodeU(E,n2, &myCheckNodePos);
+ double p1 = GetNodeU(E,n1);
+ double p2 = GetNodeU(E,n2);
double f,l;
Handle(Geom_Curve) C = BRep_Tool::Curve(E, f, l);
const SMDS_MeshNode* n2,
const SMDS_MeshNode* n3,
const int id,
- const bool force3d)
+ const bool force3d)
{
SMESHDS_Mesh * meshDS = GetMeshDS();
SMDS_MeshFace* elem = 0;
const SMDS_MeshNode* n3,
const SMDS_MeshNode* n4,
const int id,
- const bool force3d)
+ const bool force3d)
{
SMESHDS_Mesh * meshDS = GetMeshDS();
SMDS_MeshFace* elem = 0;
const SMDS_MeshNode* n5,
const SMDS_MeshNode* n6,
const int id,
- const bool force3d)
+ const bool force3d)
{
SMESHDS_Mesh * meshDS = GetMeshDS();
SMDS_MeshVolume* elem = 0;
const SMDS_MeshNode* n3,
const SMDS_MeshNode* n4,
const int id,
- const bool force3d)
+ const bool force3d)
{
SMESHDS_Mesh * meshDS = GetMeshDS();
SMDS_MeshVolume* elem = 0;
const SMDS_MeshNode* n4,
const SMDS_MeshNode* n5,
const int id,
- const bool force3d)
+ const bool force3d)
{
SMDS_MeshVolume* elem = 0;
if(!myCreateQuadratic) {
const SMDS_MeshNode* n7,
const SMDS_MeshNode* n8,
const int id,
- const bool force3d)
+ const bool force3d)
{
SMESHDS_Mesh * meshDS = GetMeshDS();
SMDS_MeshVolume* elem = 0;
*/
void SetElementsOnShape(bool toSet) { mySetElemOnShape = toSet; }
- /*!
- * \brief Enable/disable checking of node parameters on shapes while adding elements.
- * In case of incorrect parameters mudium node place is computed as the middle
- * of two nodes. Default is false.
- * NOTE that this flag is reset to "not to check" if check with non-default partameter
- * is successful
- */
- void SetCheckNodePosition(bool toCheck) { myCheckNodePos = toCheck; }
-
/*!
* \brief Set shape to make elements on without calling IsQuadraticSubMesh()
*/
const SMDS_MeshNode* n2,
const SMDS_MeshNode* n3,
const int id=0,
- const bool force3d = false);
+ const bool force3d = false);
/*!
* Creates quadratic or linear quadrangle
*/
const SMDS_MeshNode* n3,
const SMDS_MeshNode* n4,
const int id = 0,
- const bool force3d = false);
+ const bool force3d = false);
/*!
* Creates quadratic or linear tetraahedron
*/
const SMDS_MeshNode* n3,
const SMDS_MeshNode* n4,
const int id = 0,
- const bool force3d = true);
+ const bool force3d = true);
/*!
* Creates quadratic or linear pyramid
*/
const SMDS_MeshNode* n4,
const SMDS_MeshNode* n5,
const int id = 0,
- const bool force3d = true);
+ const bool force3d = true);
/*!
* Creates quadratic or linear pentahedron
*/
const SMDS_MeshNode* n5,
const SMDS_MeshNode* n6,
const int id = 0,
- const bool force3d = true);
+ const bool force3d = true);
/*!
* Creates quadratic or linear hexahedron
*/
const SMDS_MeshNode* n7,
const SMDS_MeshNode* n8,
const int id = 0,
- bool force3d = true);
+ bool force3d = true);
/*!
* \brief Return U of the given node on the edge
*/
const SMDS_MeshNode* n,
const SMDS_MeshNode* inFaceNode=0,
bool* check=0) const;
+ /*!
+ * \brief Check and fix node UV on a face
+ * \retval bool - false if UV is bad and could not be fixed
+ */
+ bool CheckNodeUV(const TopoDS_Face& F,
+ const SMDS_MeshNode* n,
+ gp_XY& uv,
+ const double tol) const;
/*!
* \brief Return middle UV taking in account surface period
*/
// to create quadratic elements
bool myCreateQuadratic;
bool mySetElemOnShape;
- bool myCheckNodePos;
+ std::set< int > myOkNodePosShapes;
};
//===========================================================================
/*!
- * \brief SMESH_Octree Constructor
- * \param maxLevel - The level max the octree can reach (If <0 unlimited)
+ * Constructor. limit must be provided at tree root construction.
+ * limit will be deleted by SMESH_Octree.
*/
//===========================================================================
-SMESH_Octree::SMESH_Octree (const int maxLevel, const double minBoxSize):
- myChildren(NULL),
- myFather(NULL),
- myLevel(0),
- myMaxLevel(maxLevel),
- myMinBoxSize(minBoxSize),
- myIsLeaf(-1)
+
+SMESH_Octree::SMESH_Octree (SMESH_Octree::Limit* limit):
+ myChildren(NULL),
+ myFather(NULL),
+ myIsLeaf( false ),
+ myLimit( limit ),
+ myLevel(0),
+ myBox(NULL)
+{
+}
+
+//================================================================================
+/*!
+ * \brief Compute the Octree
+ */
+//================================================================================
+
+void SMESH_Octree::compute()
{
- myBox = new Bnd_B3d();
+ if ( myLevel==0 )
+ {
+ myBox = buildRootBox();
+ if ( myLimit->myMinBoxSize > 0. && maxSize() <= myLimit->myMinBoxSize )
+ myIsLeaf = true;
+ else
+ buildChildren();
+ }
}
//======================================
* \brief SMESH_Octree Destructor
*/
//======================================
+
SMESH_Octree::~SMESH_Octree ()
{
if(myChildren != NULL)
{
- if(!myIsLeaf)
+ if(!isLeaf())
{
for(int i = 0; i<8; i++)
delete myChildren[i];
delete[] myChildren;
+ myChildren = 0;
}
}
- delete myBox;
-}
-
-//===========================================================================
-/*!
- * \brief Set the bounding box of the Octree
- * \param box - 3d Bounding Box of the Octree
- */
-//===========================================================================
-void SMESH_Octree::setBox(const Bnd_B3d* box)
-{
-// delete myBox;
-// myBox=new Bnd_B3d(*box);
- *myBox = *box;
-}
-
-//===========================================================================
-/*!
- * \brief Set box to the 3d Bounding Box of the Octree
- * \param box - Set box to the 3d Bounding Box of the Octree
- */
-//===========================================================================
-void SMESH_Octree::getBox(Bnd_B3d& box)
-{
-// if(box != NULL)
-// delete box;
-// box = new Bnd_B3d (*myBox);
- box = *myBox;
-}
-
-//===========================================================================
-/*!
- * \brief Set the max level of the Octree
- * \param maxLevel - The level max the octree can reach (If <0 unlimited)
- */
-//===========================================================================
-void SMESH_Octree::setMaxLevel(const int maxLevel)
-{myMaxLevel = maxLevel;}
-
-
-//===========================================================================
-/*!
- * \brief Compute the bigger dimension of the box
- * \param box - 3d Box
- * \retval double - bigger dimension of the box
- */
-//===========================================================================
-double SMESH_Octree::maxSize(const Bnd_B3d* box)
-{
- if(box ==NULL)
- return 0;
- gp_XYZ min = box->CornerMin();
- gp_XYZ max = box->CornerMax();
- gp_XYZ Size = (max - min);
- double returnVal = (Size.X()>Size.Y())?Size.X():Size.Y();
- return (returnVal>Size.Z())?returnVal:Size.Z();
-}
-
-//=============================
-/*!
- * \brief Compute the Octree
- */
-//=============================
-void SMESH_Octree::Compute()
-{
- // As soon as the Octree is a Leaf, I stop building his children
- if(!isLeaf())
- buildChildren();
+ if ( myBox )
+ delete myBox;
+ myBox = 0;
+ if ( level() == 0 )
+ delete myLimit;
+ myLimit = 0;
}
//=================================================================
* \brief Build the 8 children boxes and call buildChildrenData()
*/
//=================================================================
+
void SMESH_Octree::buildChildren()
{
+ if ( isLeaf() ) return;
+
myChildren = new SMESH_Octree*[8];
gp_XYZ min = myBox->CornerMin();
gp_XYZ childHsize = HSize/2.;
Standard_Real XminChild, YminChild, ZminChild;
- Bnd_B3d* box;
gp_XYZ minChild;
for (int i = 0; i < 8; i++)
{
ZminChild = (i<4)?min.Z():mid.Z();
minChild.SetCoord(XminChild, YminChild, ZminChild);
- box = new Bnd_B3d(minChild+childHsize,childHsize);
// The child is of the same type than its father (For instance, a SMESH_OctreeNode)
// We allocate the memory we need for the child
myChildren[i] = allocateOctreeChild();
// and we assign to him its box.
- myChildren[i]->setBox(box);
- delete box;
+ myChildren[i]->myFather = this;
+ myChildren[i]->myLimit = myLimit;
+ myChildren[i]->myLevel = myLevel + 1;
+ myChildren[i]->myBox = new Bnd_B3d(minChild+childHsize,childHsize);
+ if ( myLimit->myMinBoxSize > 0. && myChildren[i]->maxSize() <= myLimit->myMinBoxSize )
+ myChildren[i]->myIsLeaf = true;
}
- // After building the 8 boxes, we put the data into the children..
+ // After building the 8 boxes, we put the data into the children.
buildChildrenData();
//After we pass to the next level of the Octree
- for (int i = 0; i < 8; i++)
- myChildren[i]->Compute();
+ for (int i = 0; i<8; i++)
+ myChildren[i]->buildChildren();
+}
+
+//================================================================================
+/*!
+ * \brief Tell if Octree is a leaf or not
+ * An inheriting class can influence it via myIsLeaf protected field
+ */
+//================================================================================
+
+bool SMESH_Octree::isLeaf() const
+{
+ return myIsLeaf || ((myLimit->myMaxLevel > 0) ? (level() >= myLimit->myMaxLevel) : false );
+}
+
+//===========================================================================
+/*!
+ * \brief Compute the bigger dimension of my box
+ */
+//===========================================================================
+
+double SMESH_Octree::maxSize() const
+{
+ if ( myBox )
+ {
+ gp_XYZ min = myBox->CornerMin();
+ gp_XYZ max = myBox->CornerMax();
+ gp_XYZ Size = (max - min);
+ double returnVal = (Size.X()>Size.Y())?Size.X():Size.Y();
+ return (returnVal>Size.Z())?returnVal:Size.Z();
+ }
+ return 0.;
}
class SMESH_Octree {
public:
- // Constructor
- SMESH_Octree (const int maxLevel = -1, const double minBoxSize = 0.);
- // Destructor
- virtual ~SMESH_Octree ();
-
- // Tell if Octree is a leaf or not (has to be implemented in inherited classes)
- virtual const bool isLeaf() = 0;
+ // Data limiting the tree height
+ struct Limit {
+ // MaxLevel of the Octree
+ int myMaxLevel;
+ // Minimal size of the Box
+ double myMinBoxSize;
- // Compute the Octree
- void Compute();
+ // Default:
+ // maxLevel-> 8^8 = 16777216 terminal trees
+ // minSize -> box size not checked
+ Limit(int maxLevel=8, double minSize=0.):myMaxLevel(maxLevel),myMinBoxSize(minSize) {}
+ virtual ~Limit() {} // it can be inherited
+ };
- // Set the maximal level of the Octree
- void setMaxLevel(const int maxLevel);
+ // Constructor. limit must be provided at tree root construction.
+ // limit will be deleted by SMESH_Octree
+ SMESH_Octree (Limit* limit=0);
- // Set the minimal size of the Box
- void setMinBoxSize(const double minBoxSize){myMinBoxSize = minBoxSize;};
-
- // Set the bounding box of the Octree
- void setBox(const Bnd_B3d* box);
+ // Destructor
+ virtual ~SMESH_Octree ();
- // Set box to the 3d Bounding Box of the Octree
- void getBox(Bnd_B3d & box);
+ // Compute the Octree. Must be called by constructor of inheriting class
+ void compute();
- // Compute the bigger dimension of the box
- static double maxSize(const Bnd_B3d* box);
+ // Tell if Octree is a leaf or not.
+ // An inheriting class can influence it via myIsLeaf protected field
+ bool isLeaf() const;
// Return its level
int level() const { return myLevel; }
+ // Get box to the 3d Bounding Box of the Octree
+ const Bnd_B3d& getBox() const { return *myBox; }
+
+ // Compute the bigger dimension of my box
+ double maxSize() const;
+
+ // Return index of a child the given point is in
+ inline int getChildIndex(double x, double y, double z, const gp_XYZ& boxMiddle)const;
+
protected:
- // Constructor for children (has to be implemented in inherited classes)
- virtual SMESH_Octree* allocateOctreeChild() = 0;
+ // Return box of the whole tree
+ virtual Bnd_B3d* buildRootBox() = 0;
- // Build the 8 children boxes
- void buildChildren();
+ // Constructor for children
+ virtual SMESH_Octree* allocateOctreeChild() const = 0;
- // Build the data in the 8 children (has to be implemented in inherited classes)
- virtual void buildChildrenData() = 0;
+ // Build the data in the 8 children
+ virtual void buildChildrenData() = 0;
// members
- // Box of the Octree
- Bnd_B3d* myBox;
-
// Array of 8 Octree children
SMESH_Octree** myChildren;
// Point the father, set to NULL for the level 0
SMESH_Octree* myFather;
+ // Tell us if the Octree is a leaf or not
+ bool myIsLeaf;
+
+ // Tree limit
+ const Limit* myLimit;
+
+private:
+ // Build the 8 children boxes recursively
+ void buildChildren();
+
// Level of the Octree
int myLevel;
- // MaxLevel of the Octree
- int myMaxLevel;
+ Bnd_B3d* myBox;
+};
- // Minimal size of the Box
- double myMinBoxSize;
+//================================================================================
+/*!
+ * \brief Return index of a child the given point is in
+ */
+//================================================================================
- // Tell us if the Octree is a leaf or not (-1 if not initialized)
- int myIsLeaf;
-};
+inline int SMESH_Octree::getChildIndex(double x, double y, double z, const gp_XYZ& mid) const
+{
+ return (x > mid.X()) + ( y > mid.Y())*2 + (z > mid.Z())*4;
+}
#endif
//================================================================
SMESH_OctreeNode::SMESH_OctreeNode (const set<const SMDS_MeshNode*> & theNodes, const int maxLevel,
const int maxNbNodes , const double minBoxSize )
- :SMESH_Octree(maxLevel,minBoxSize),
+ :SMESH_Octree( new SMESH_Octree::Limit( maxLevel,minBoxSize)),
myMaxNbNodes(maxNbNodes),
myNodes(theNodes)
{
- // We need to compute the first bounding box via a special method
- computeBoxForFather();
- myNbNodes = myNodes.size();
- myIsLeaf = ((myLevel == myMaxLevel) ||
- (myNbNodes <= myMaxNbNodes) ||
- (maxSize(myBox) <= myMinBoxSize));
- // All the children (Boxes and Data) are computed in Compute()
- Compute();
+ compute();
+}
+
+//================================================================================
+/*!
+ * \brief Constructor used to allocate a child
+ */
+//================================================================================
+
+SMESH_OctreeNode::SMESH_OctreeNode (int maxNbNodes):
+ SMESH_Octree(), myMaxNbNodes(maxNbNodes)
+{
}
//==================================================================================
* \brief Construct an empty SMESH_OctreeNode used by SMESH_Octree::buildChildren()
*/
//==================================================================================
-SMESH_Octree* SMESH_OctreeNode::allocateOctreeChild()
+
+SMESH_Octree* SMESH_OctreeNode::allocateOctreeChild() const
{
- SMESH_OctreeNode * theOctree = new SMESH_OctreeNode();
- theOctree->myFather = this;
- theOctree->myLevel = myLevel + 1;
- theOctree->myMaxLevel = myMaxLevel;
- theOctree->myMaxNbNodes = myMaxNbNodes;
- theOctree->myMinBoxSize = myMinBoxSize;
- theOctree->myNbNodes = 0;
- return theOctree;
+ return new SMESH_OctreeNode(myMaxNbNodes);
}
//======================================
* We take the max/min coord of the nodes
*/
//======================================
-void SMESH_OctreeNode::computeBoxForFather()
+
+Bnd_B3d* SMESH_OctreeNode::buildRootBox()
{
+ Bnd_B3d* box = new Bnd_B3d;
set<const SMDS_MeshNode*>::iterator it = myNodes.begin();
for (; it != myNodes.end(); it++) {
const SMDS_MeshNode* n1 = *it;
gp_XYZ p1( n1->X(), n1->Y(), n1->Z() );
- myBox->Add(p1);
+ box->Add(p1);
}
-}
+ if ( myNodes.size() <= myMaxNbNodes )
+ myIsLeaf = true;
-//====================================================================================
-/*!
- * \brief Tell if Octree is a leaf or not (has to be implemented in inherited classes)
- * \retval - True if the Octree is a leaf
- */
-//====================================================================================
-const bool SMESH_OctreeNode::isLeaf()
-{
- return myIsLeaf;
+ return box;
}
//====================================================================================
* \retval bool - True if Node is in the box within precision
*/
//====================================================================================
+
const bool SMESH_OctreeNode::isInside (const SMDS_MeshNode * Node, const double precision)
{
- double X = Node->X();
- double Y = Node->Y();
- double Z = Node->Z();
- bool Out = 1 ;
+ gp_XYZ p (Node->X(),Node->Y(),Node->Z());
if (precision <= 0.)
- return !(myBox->IsOut(gp_XYZ(X,Y,Z)));
- Bnd_B3d BoxWithPrecision;
- getBox(BoxWithPrecision);
+ return !(getBox().IsOut(p));
+ Bnd_B3d BoxWithPrecision = getBox();
BoxWithPrecision.Enlarge(precision);
- Out = BoxWithPrecision.IsOut(gp_XYZ(X,Y,Z));
- return !(Out);
+ return ! BoxWithPrecision.IsOut(p);
}
//================================================
//================================================
void SMESH_OctreeNode::buildChildrenData()
{
- gp_XYZ min = myBox->CornerMin();
- gp_XYZ max = myBox->CornerMax();
+ gp_XYZ min = getBox().CornerMin();
+ gp_XYZ max = getBox().CornerMax();
gp_XYZ mid = (min + max)/2.;
set<const SMDS_MeshNode*>::iterator it = myNodes.begin();
- int ChildBoxNum;
while (it != myNodes.end())
{
const SMDS_MeshNode* n1 = *it;
- ChildBoxNum = (n1->X() > mid.X()) + (n1->Y() > mid.Y())*2 + (n1->Z() > mid.Z())*4;
+ int ChildBoxNum = getChildIndex( n1->X(), n1->Y(), n1->Z(), mid );
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[ChildBoxNum]);
myChild->myNodes.insert(myChild->myNodes.end(),n1);
myNodes.erase( it );
for (int i = 0; i < 8; i++)
{
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[i]);
- myChild->myNbNodes = (myChild->myNodes).size();
- myChild->myIsLeaf = ((myChild->myLevel == myMaxLevel) ||
- (myChild->myNbNodes <= myMaxNbNodes) ||
- (maxSize(myChild->myBox) <= myMinBoxSize));
+ if ( myChild->myNodes.size() <= myMaxNbNodes )
+ myChild->myIsLeaf = true;
}
}
{
if (isInside(Node,precision))
{
- if (myIsLeaf)
+ if (isLeaf())
{
Result->insert(Result->end(), myNodes.begin(), myNodes.end());
}
}
}
+//================================================================================
+/*!
+ * \brief Return in dist2Nodes nodes mapped to their square distance from Node
+ * \param node - node to find nodes closest to
+ * \param dist2Nodes - map of found nodes and their distances
+ * \param precision - radius of a sphere to check nodes inside
+ * \retval bool - true if an exact overlapping found
+ */
+//================================================================================
+
+bool SMESH_OctreeNode::NodesAround(const SMDS_MeshNode * node,
+ map<double, const SMDS_MeshNode*>& dist2Nodes,
+ double precision)
+{
+ if ( !dist2Nodes.empty() )
+ precision = min ( precision, sqrt( dist2Nodes.begin()->first ));
+ else if ( precision == 0. )
+ precision = maxSize() / 2;
+
+ if (isInside(node,precision))
+ {
+ if (!isLeaf())
+ {
+ // first check a child containing node
+ gp_XYZ mid = (getBox().CornerMin() + getBox().CornerMax()) / 2.;
+ int nodeChild = getChildIndex( node->X(), node->Y(), node->Z(), mid );
+ if ( ((SMESH_OctreeNode*) myChildren[nodeChild])->NodesAround(node, dist2Nodes, precision))
+ return true;
+
+ for (int i = 0; i < 8; i++)
+ if ( i != nodeChild )
+ if (((SMESH_OctreeNode*) myChildren[i])->NodesAround(node, dist2Nodes, precision))
+ return true;
+ }
+ else if ( NbNodes() > 0 )
+ {
+ double minDist = precision * precision;
+ gp_Pnt p1 ( node->X(), node->Y(), node->Z() );
+ set<const SMDS_MeshNode*>::iterator nIt = myNodes.begin();
+ for ( ; nIt != myNodes.end(); ++nIt )
+ {
+ gp_Pnt p2 ( (*nIt)->X(), (*nIt)->Y(), (*nIt)->Z() );
+ double dist2 = p1.SquareDistance( p2 );
+ if ( dist2 < minDist )
+ dist2Nodes.insert( make_pair( minDist = dist2, *nIt ));
+ }
+// if ( dist2Nodes.size() > 1 ) // leave only closest node in dist2Nodes
+// dist2Nodes.erase( ++dist2Nodes.begin(), dist2Nodes.end());
+
+ return ( sqrt( minDist) <= precision * 1e-12 );
+ }
+ }
+ return false;
+}
+
//=============================
/*!
* \brief Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance
* \param maxNbNodes - maximum Nodes in a Leaf of the SMESH_OctreeNode constructed, default value is 5
*/
//=============================
-void SMESH_OctreeNode::FindCoincidentNodes (set<const SMDS_MeshNode*> theSetOfNodes,
+void SMESH_OctreeNode::FindCoincidentNodes (set<const SMDS_MeshNode*>& theSetOfNodes,
list< list< const SMDS_MeshNode*> >* theGroupsOfNodes,
const double theTolerance,
const int maxLevel,
const int maxNbNodes)
{
- SMESH_OctreeNode* theOctreeNode = new SMESH_OctreeNode(theSetOfNodes, maxLevel, maxNbNodes, theTolerance);
- theOctreeNode->FindCoincidentNodes (&theSetOfNodes, theTolerance, theGroupsOfNodes);
- delete theOctreeNode;
+ SMESH_OctreeNode theOctreeNode(theSetOfNodes, maxLevel, maxNbNodes, theTolerance);
+ theOctreeNode.FindCoincidentNodes (&theSetOfNodes, theTolerance, theGroupsOfNodes);
}
//=============================
if (isInsideBool)
{
// I'm only looking in the leaves, since all the nodes are stored there.
- if (myIsLeaf)
+ if (isLeaf())
{
gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
}
}
+//================================================================================
+/*!
+ * \brief Update data according to node movement
+ */
+//================================================================================
+
+void SMESH_OctreeNode::UpdateByMoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt )
+{
+ if ( isLeaf() )
+ {
+ set<const SMDS_MeshNode*>::iterator pNode = myNodes.find( node );
+ bool nodeInMe = ( pNode != myNodes.end() );
+
+ SMDS_MeshNode pointNode( toPnt.X(), toPnt.Y(), toPnt.Z() );
+ bool pointInMe = isInside( &pointNode, 1e-10 );
+
+ if ( pointInMe != nodeInMe )
+ {
+ if ( pointInMe )
+ myNodes.insert( node );
+ else
+ myNodes.erase( node );
+ }
+ }
+ else if ( myChildren )
+ {
+ gp_XYZ mid = (getBox().CornerMin() + getBox().CornerMax()) / 2.;
+ int nodeChild = getChildIndex( node->X(), node->Y(), node->Z(), mid );
+ int pointChild = getChildIndex( toPnt.X(), toPnt.Y(), toPnt.Z(), mid );
+ if ( nodeChild != pointChild )
+ {
+ ((SMESH_OctreeNode*) myChildren[ nodeChild ])->UpdateByMoveNode( node, toPnt );
+ ((SMESH_OctreeNode*) myChildren[ pointChild ])->UpdateByMoveNode( node, toPnt );
+ }
+ }
+}
+
//================================================================================
/*!
* \brief Return iterator over children
{
return SMESH_OctreeNodeIteratorPtr
( new SMDS_SetIterator< SMESH_OctreeNode*, SMESH_Octree** >
- ( myChildren, ( isLeaf() ? myChildren : &myChildren[ 8 ] )));
+ ( myChildren, (( isLeaf() || !myChildren ) ? myChildren : &myChildren[ 8 ] )));
}
//================================================================================
{
return SMDS_NodeIteratorPtr
( new SMDS_SetIterator< SMDS_pNode, set< SMDS_pNode >::const_iterator >
- ( myNodes.begin(), myNodes.end() ));
+ ( myNodes.begin(), myNodes.size() ? myNodes.end() : myNodes.begin()));
}
#include <list>
#include <set>
+#include <map>
#include "SMDS_ElemIterator.hxx"
typedef SMDS_Iterator<SMESH_OctreeNode*> SMESH_OctreeNodeIterator;
typedef boost::shared_ptr<SMESH_OctreeNodeIterator> SMESH_OctreeNodeIteratorPtr;
-class SMESH_OctreeNode : public SMESH_Octree{
+class SMESH_OctreeNode : public SMESH_Octree {
public:
//=============================
virtual ~SMESH_OctreeNode () {};
- // Tells us if SMESH_OctreeNode is a leaf or not (-1 = not initialiazed)
- virtual const bool isLeaf();
-
// Tells us if Node is inside the current box with the precision "precision"
virtual const bool isInside(const SMDS_MeshNode * Node, const double precision = 0.);
std::list<const SMDS_MeshNode*>* Result,
const double precision = 0.);
+ // Return in dist2Nodes nodes mapped to their square distance from Node
+ bool NodesAround(const SMDS_MeshNode * Node,
+ std::map<double, const SMDS_MeshNode*>& dist2Nodes,
+ double precision);
+
// Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance
// Search for all the nodes in nodes
void FindCoincidentNodes ( std::set<const SMDS_MeshNode*>* nodes,
// Static method that return in theGroupsOfNodes a list of group of nodes close to each other within
// theTolerance search for all the nodes in nodes
- static void FindCoincidentNodes ( std::set<const SMDS_MeshNode*> nodes,
+ static void FindCoincidentNodes ( std::set<const SMDS_MeshNode*>& nodes,
std::list< std::list< const SMDS_MeshNode*> >* theGroupsOfNodes,
- const double theTolerance = 0.00001, const int maxLevel = -1,
+ const double theTolerance = 0.00001,
+ const int maxLevel = -1,
const int maxNbNodes = 5);
+ /*!
+ * \brief Update data according to node movement
+ */
+ void UpdateByMoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt );
/*!
* \brief Return iterator over children
*/
/*!
* \brief Return nb nodes in a tree
*/
- int NbNodes() const { return myNbNodes; }
+ int NbNodes() const { return myNodes.size(); }
protected:
-//=============================
-/*!
- * \brief Empty constructor
- */
-//=============================
- SMESH_OctreeNode (){};
+ SMESH_OctreeNode (int maxNbNodes );
+
+ // Compute the bounding box of the whole set of nodes myNodes
+ virtual Bnd_B3d* buildRootBox();
// Shares the father's data with each of his child
virtual void buildChildrenData();
- // Compute the bounding box of the whole set of nodes myNodes (only used for OctreeNode level 0)
- void computeBoxForFather();
-
// Construct an empty SMESH_OctreeNode used by SMESH_Octree::buildChildren()
- virtual SMESH_Octree* allocateOctreeChild();
+ virtual SMESH_Octree* allocateOctreeChild() const;
// Return in result a list of nodes closed to Node and remove it from SetOfNodes
void FindCoincidentNodes( const SMDS_MeshNode * Node,
const double precision);
// The max number of nodes a leaf box can contain
- int myMaxNbNodes;
+ int myMaxNbNodes;
// The set of nodes inside the box of the Octree (Empty if Octree is not a leaf)
std::set<const SMDS_MeshNode*> myNodes;
- // The number of nodes I have inside the box
- int myNbNodes;
};
#endif
SMESHDS_Mesh * meshDS,
const TopoDS_Shape & aSubShape)
{
- _subShape = aSubShape;
- _subMeshDS = meshDS->MeshElements(_subShape); // may be null ...
- _father = father;
- _Id = Id;
- _dependenceAnalysed = _alwaysComputed = false;
-
- if (_subShape.ShapeType() == TopAbs_VERTEX)
- {
- _algoState = HYP_OK;
- _computeState = READY_TO_COMPUTE;
- }
- else
- {
+ _subShape = aSubShape;
+ _subMeshDS = meshDS->MeshElements(_subShape); // may be null ...
+ _father = father;
+ _Id = Id;
+ _dependenceAnalysed = _alwaysComputed = false;
+
+ if (_subShape.ShapeType() == TopAbs_VERTEX)
+ {
+ _algoState = HYP_OK;
+ _computeState = READY_TO_COMPUTE;
+ }
+ else
+ {
_algoState = NO_ALGO;
_computeState = NOT_READY;
- }
+ }
}
//=============================================================================
}
case TopAbs_COMPSOLID:
{
- //MESSAGE("compsolid");
+ //MESSAGE("compsolid");
for (TopExp_Explorer exp(_subShape, TopAbs_SOLID); exp.More();
exp.Next())
{
for (TopExp_Explorer exp(_subShape, TopAbs_VERTEX); exp.More();
exp.Next())
{
- InsertDependence(exp.Current());
+ InsertDependence(exp.Current());
}
break;
}
const TopoDS_Shape & SMESH_subMesh::GetSubShape() const
{
- //MESSAGE("SMESH_subMesh::GetSubShape");
- return _subShape;
+ //MESSAGE("SMESH_subMesh::GetSubShape");
+ return _subShape;
}
break;
}
case REMOVE_FATHER_ALGO: {
+ // IPAL21346. Edges not removed when Netgen 1d-2d is removed from a SOLID.
+ // CLEAN was not called at event REMOVE_ALGO because the algo is not applicable to SOLID.
+ algo = dynamic_cast<SMESH_Algo*> (anHyp);
+ if (!algo->NeedDescretBoundary())
+ needFullClean = true;
+
algo = gen->GetAlgo((*_father), _subShape);
if (algo == NULL) // no more applying algo on father
{
void SMESH_subMesh::DumpAlgoState(bool isMain)
{
- int dim = SMESH_Gen::GetShapeDim(_subShape);
+ int dim = SMESH_Gen::GetShapeDim(_subShape);
// if (dim < 1) return;
- if (isMain)
- {
- const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
-
- map < int, SMESH_subMesh * >::const_iterator itsub;
- for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
- {
- SMESH_subMesh *sm = (*itsub).second;
- sm->DumpAlgoState(false);
- }
- }
- int type = _subShape.ShapeType();
- MESSAGE("dim = " << dim << " type of shape " << type);
- switch (_algoState)
- {
- case NO_ALGO:
- MESSAGE(" AlgoState = NO_ALGO");
- break;
- case MISSING_HYP:
- MESSAGE(" AlgoState = MISSING_HYP");
- break;
- case HYP_OK:
- MESSAGE(" AlgoState = HYP_OK");
- break;
- }
- switch (_computeState)
- {
- case NOT_READY:
- MESSAGE(" ComputeState = NOT_READY");
- break;
- case READY_TO_COMPUTE:
- MESSAGE(" ComputeState = READY_TO_COMPUTE");
- break;
- case COMPUTE_OK:
- MESSAGE(" ComputeState = COMPUTE_OK");
- break;
- case FAILED_TO_COMPUTE:
- MESSAGE(" ComputeState = FAILED_TO_COMPUTE");
- break;
- }
+ if (isMain)
+ {
+ const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
+
+ map < int, SMESH_subMesh * >::const_iterator itsub;
+ for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
+ {
+ SMESH_subMesh *sm = (*itsub).second;
+ sm->DumpAlgoState(false);
+ }
+ }
+ int type = _subShape.ShapeType();
+ MESSAGE("dim = " << dim << " type of shape " << type);
+ switch (_algoState)
+ {
+ case NO_ALGO:
+ MESSAGE(" AlgoState = NO_ALGO");
+ break;
+ case MISSING_HYP:
+ MESSAGE(" AlgoState = MISSING_HYP");
+ break;
+ case HYP_OK:
+ MESSAGE(" AlgoState = HYP_OK");
+ break;
+ }
+ switch (_computeState)
+ {
+ case NOT_READY:
+ MESSAGE(" ComputeState = NOT_READY");
+ break;
+ case READY_TO_COMPUTE:
+ MESSAGE(" ComputeState = READY_TO_COMPUTE");
+ break;
+ case COMPUTE_OK:
+ MESSAGE(" ComputeState = COMPUTE_OK");
+ break;
+ case FAILED_TO_COMPUTE:
+ MESSAGE(" ComputeState = FAILED_TO_COMPUTE");
+ break;
+ }
}
//================================================================================
if ( _algoState == HYP_OK )
_computeState = READY_TO_COMPUTE;
break;
- case COMPUTE: // nothing to do
+ case COMPUTE: // nothing to do
break;
case CLEAN:
CleanDependants();
RemoveSubMeshElementsAndNodes();
break;
- case SUBMESH_COMPUTED: // nothing to do
+ case SUBMESH_COMPUTED: // nothing to do
break;
case SUBMESH_RESTORED:
ComputeSubMeshStateEngine( SUBMESH_RESTORED );
{
public:
SMESH_subMesh(int Id, SMESH_Mesh * father, SMESHDS_Mesh * meshDS,
- const TopoDS_Shape & aSubShape);
+ const TopoDS_Shape & aSubShape);
virtual ~ SMESH_subMesh();
int GetId() const;
enum SMESHDS_CommandType {
SMESHDS_AddNode,
- SMESHDS_Add0DElement,
SMESHDS_AddEdge,
SMESHDS_AddTriangle,
SMESHDS_AddQuadrangle,
SMESHDS_AddQuadTetrahedron,
SMESHDS_AddQuadPyramid,
SMESHDS_AddQuadPentahedron,
- SMESHDS_AddQuadHexahedron
+ SMESHDS_AddQuadHexahedron,
+ // special type for 0D elements
+ SMESHDS_Add0DElement
};
}
SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- int ID)
+ const SMDS_MeshNode * n2,
+ int ID)
{
return AddEdgeWithID(n1->GetID(),
- n2->GetID(),
- ID);
+ n2->GetID(),
+ ID);
}
SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2)
+ const SMDS_MeshNode * n2)
{
SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2);
if(anElem) myScript->AddEdge(anElem->GetID(),
- n1->GetID(),
- n2->GetID());
+ n1->GetID(),
+ n2->GetID());
return anElem;
}
}
SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- int ID)
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ int ID)
{
return AddFaceWithID(n1->GetID(),
- n2->GetID(),
- n3->GetID(),
- ID);
+ n2->GetID(),
+ n3->GetID(),
+ ID);
}
SMDS_MeshFace* SMESHDS_Mesh::AddFace( const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3)
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3);
if(anElem) myScript->AddFace(anElem->GetID(),
- n1->GetID(),
- n2->GetID(),
- n3->GetID());
+ n1->GetID(),
+ n2->GetID(),
+ n3->GetID());
return anElem;
}
}
SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- int ID)
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ int ID)
{
return AddFaceWithID(n1->GetID(),
- n2->GetID(),
- n3->GetID(),
- n4->GetID(),
- ID);
+ n2->GetID(),
+ n3->GetID(),
+ n4->GetID(),
+ ID);
}
SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4)
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3, n4);
if(anElem) myScript->AddFace(anElem->GetID(),
- n1->GetID(),
- n2->GetID(),
- n3->GetID(),
- n4->GetID());
+ n1->GetID(),
+ n2->GetID(),
+ n3->GetID(),
+ n4->GetID());
return anElem;
}
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- int ID)
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ int ID)
{
return AddVolumeWithID(n1->GetID(),
- n2->GetID(),
- n3->GetID(),
- n4->GetID(),
- ID);
+ n2->GetID(),
+ n3->GetID(),
+ n4->GetID(),
+ ID);
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4)
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4);
if(anElem) myScript->AddVolume(anElem->GetID(),
- n1->GetID(),
- n2->GetID(),
- n3->GetID(),
- n4->GetID());
+ n1->GetID(),
+ n2->GetID(),
+ n3->GetID(),
+ n4->GetID());
return anElem;
}
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- int ID)
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ int ID)
{
return AddVolumeWithID(n1->GetID(),
- n2->GetID(),
- n3->GetID(),
- n4->GetID(),
- n5->GetID(),
- ID);
+ n2->GetID(),
+ n3->GetID(),
+ n4->GetID(),
+ n5->GetID(),
+ ID);
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5)
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5);
if(anElem) myScript->AddVolume(anElem->GetID(),
- n1->GetID(),
- n2->GetID(),
- n3->GetID(),
- n4->GetID(),
- n5->GetID());
+ n1->GetID(),
+ n2->GetID(),
+ n3->GetID(),
+ n4->GetID(),
+ n5->GetID());
return anElem;
}
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- int ID)
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ int ID)
{
return AddVolumeWithID(n1->GetID(),
- n2->GetID(),
- n3->GetID(),
- n4->GetID(),
- n5->GetID(),
- n6->GetID(),
- ID);
+ n2->GetID(),
+ n3->GetID(),
+ n4->GetID(),
+ n5->GetID(),
+ n6->GetID(),
+ ID);
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6)
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6);
if(anElem) myScript->AddVolume(anElem->GetID(),
- n1->GetID(),
- n2->GetID(),
- n3->GetID(),
- n4->GetID(),
- n5->GetID(),
- n6->GetID());
+ n1->GetID(),
+ n2->GetID(),
+ n3->GetID(),
+ n4->GetID(),
+ n5->GetID(),
+ n6->GetID());
return anElem;
}
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8,
- int ID)
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8,
+ int ID)
{
return AddVolumeWithID(n1->GetID(),
- n2->GetID(),
- n3->GetID(),
- n4->GetID(),
- n5->GetID(),
- n6->GetID(),
- n7->GetID(),
- n8->GetID(),
- ID);
+ n2->GetID(),
+ n3->GetID(),
+ n4->GetID(),
+ n5->GetID(),
+ n6->GetID(),
+ n7->GetID(),
+ n8->GetID(),
+ ID);
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8)
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6, n7, n8);
if(anElem) myScript->AddVolume(anElem->GetID(),
- n1->GetID(),
- n2->GetID(),
- n3->GetID(),
- n4->GetID(),
- n5->GetID(),
- n6->GetID(),
- n7->GetID(),
- n8->GetID());
+ n1->GetID(),
+ n2->GetID(),
+ n3->GetID(),
+ n4->GetID(),
+ n5->GetID(),
+ n6->GetID(),
+ n7->GetID(),
+ n8->GetID());
return anElem;
}
//=======================================================================
TopoDS_Shape SMESHDS_Mesh::ShapeToMesh() const
{
- return myShape;
+ return myShape;
}
//=======================================================================
//=======================================================================
SMESHDS_Script* SMESHDS_Mesh::GetScript()
{
- return myScript;
+ return myScript;
}
//=======================================================================
//=======================================================================
void SMESHDS_Mesh::ClearScript()
{
- myScript->Clear();
+ myScript->Clear();
}
//=======================================================================
//=======================================================================
bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S)
{
- if (myShape.IsNull()) MESSAGE("myShape is NULL");
- int Index = myIndexToShape.FindIndex(S);
- return myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end();
+ if (myShape.IsNull()) MESSAGE("myShape is NULL");
+ int Index = myIndexToShape.FindIndex(S);
+ return myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end();
}
//=======================================================================
//=======================================================================
const TopoDS_Shape& SMESHDS_Mesh::IndexToShape(int ShapeIndex) const
{
- return myIndexToShape.FindKey(ShapeIndex);
+ return myIndexToShape.FindKey(ShapeIndex);
}
//=======================================================================
{
SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2,n12);
if(anElem) myScript->AddEdge(anElem->GetID(),
- n1->GetID(),
- n2->GetID(),
+ n1->GetID(),
+ n2->GetID(),
n12->GetID());
return anElem;
}
int ID)
{
return AddEdgeWithID(n1->GetID(),
- n2->GetID(),
+ n2->GetID(),
n12->GetID(),
- ID);
+ ID);
}
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n12,n23,n31);
if(anElem) myScript->AddFace(anElem->GetID(),
- n1->GetID(), n2->GetID(), n3->GetID(),
+ n1->GetID(), n2->GetID(), n3->GetID(),
n12->GetID(), n23->GetID(), n31->GetID());
return anElem;
}
{
return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(),
n12->GetID(), n23->GetID(), n31->GetID(),
- ID);
+ ID);
}
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n4,n12,n23,n34,n41);
if(anElem) myScript->AddFace(anElem->GetID(),
- n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
+ n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID());
return anElem;
}
{
return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
- ID);
+ ID);
}
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n12,n23,n31,n14,n24,n34);
if(anElem) myScript->AddVolume(anElem->GetID(),
- n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
- n12->GetID(), n23->GetID(), n31->GetID(),
+ n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
+ n12->GetID(), n23->GetID(), n31->GetID(),
n14->GetID(), n24->GetID(), n34->GetID());
return anElem;
}
if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n12,n23,n31,n14,n24,n34);
return anElem;
}
-
+
//=======================================================================
//function : AddVolumeWithID
//purpose : 2d order tetrahedron of 10 nodes
n15,n25,n35,n45);
return anElem;
}
-
+
//=======================================================================
//function : AddVolumeWithID
//purpose : 2d order pyramid of 13 nodes
n45,n56,n64,n14,n25,n36);
return anElem;
}
-
+
//=======================================================================
//function : AddVolumeWithID
//purpose : 2d order Pentahedron with 15 nodes
n56,n67,n78,n85,n15,n26,n37,n48);
return anElem;
}
-
+
//=======================================================================
//function : AddVolumeWithID
//purpose : 2d order Hexahedrons with 20 nodes
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- int ID);
+ const SMDS_MeshNode * n2,
+ int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2);
+ const SMDS_MeshNode * n2);
// 2d order edge with 3 nodes: n12 - node between n1 and n2
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n12,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n12,
+ int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12);
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3);
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4);
// 2d order triangle of 6 nodes
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3,
int n12,int n23,int n31, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n31,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n31,
+ int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n31);
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n31);
// 2d order quadrangle
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
int n12,int n23,int n34,int n41, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n41,
+ int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41);
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n41);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8);
// 2d order tetrahedron of 10 nodes
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n12,int n23,int n31,
int n14,int n24,int n34, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n31,
- const SMDS_MeshNode * n14,
- const SMDS_MeshNode * n24,
- const SMDS_MeshNode * n34,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n31,
+ const SMDS_MeshNode * n14,
+ const SMDS_MeshNode * n24,
+ const SMDS_MeshNode * n34,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
int n15,int n25,int n35,int n45,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41,
- const SMDS_MeshNode * n15,
- const SMDS_MeshNode * n25,
- const SMDS_MeshNode * n35,
- const SMDS_MeshNode * n45,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n41,
+ const SMDS_MeshNode * n15,
+ const SMDS_MeshNode * n25,
+ const SMDS_MeshNode * n35,
+ const SMDS_MeshNode * n45,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
int n14,int n25,int n36,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n31,
- const SMDS_MeshNode * n45,
- const SMDS_MeshNode * n56,
- const SMDS_MeshNode * n64,
- const SMDS_MeshNode * n14,
- const SMDS_MeshNode * n25,
- const SMDS_MeshNode * n36,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n31,
+ const SMDS_MeshNode * n45,
+ const SMDS_MeshNode * n56,
+ const SMDS_MeshNode * n64,
+ const SMDS_MeshNode * n14,
+ const SMDS_MeshNode * n25,
+ const SMDS_MeshNode * n36,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
int n15,int n26,int n37,int n48,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8,
- const SMDS_MeshNode * n12,
- const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41,
- const SMDS_MeshNode * n56,
- const SMDS_MeshNode * n67,
- const SMDS_MeshNode * n78,
- const SMDS_MeshNode * n85,
- const SMDS_MeshNode * n15,
- const SMDS_MeshNode * n26,
- const SMDS_MeshNode * n37,
- const SMDS_MeshNode * n48,
- int ID);
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n41,
+ const SMDS_MeshNode * n56,
+ const SMDS_MeshNode * n67,
+ const SMDS_MeshNode * n78,
+ const SMDS_MeshNode * n85,
+ const SMDS_MeshNode * n15,
+ const SMDS_MeshNode * n26,
+ const SMDS_MeshNode * n37,
+ const SMDS_MeshNode * n48,
+ int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
- const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
void SetNodeOnVertex(SMDS_MeshNode * aNode, const TopoDS_Vertex & S);
void UnSetNodeOnShape(const SMDS_MeshNode * aNode);
void SetMeshElementOnShape(const SMDS_MeshElement * anElt,
- const TopoDS_Shape & S);
+ const TopoDS_Shape & S);
void UnSetMeshElementOnShape(const SMDS_MeshElement * anElt,
- const TopoDS_Shape & S);
+ const TopoDS_Shape & S);
bool HasMeshElements(const TopoDS_Shape & S);
SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S) const;
SMESHDS_SubMesh * MeshElements(const int Index);
SMESHGUI_MeshEditPreview.h \
SMESHGUI_IdValidator.h \
SMESHGUI_MeshInfosBox.h \
+ SMESHGUI_Make2DFrom3DOp.h \
SMESH_SMESHGUI.hxx
# Libraries targets
SMESHGUI_MeshEditPreview.cxx \
SMESHGUI_GroupOnShapeDlg.cxx \
SMESHGUI_FileInfoDlg.cxx \
- SMESHGUI_MeshInfosBox.cxx
+ SMESHGUI_MeshInfosBox.cxx \
+ SMESHGUI_Make2DFrom3DOp.cxx
MOC_FILES = \
SMESHGUI_moc.cxx \
SMESHGUI_MakeNodeAtPointDlg_moc.cxx \
SMESHGUI_GroupOnShapeDlg_moc.cxx \
SMESHGUI_FileInfoDlg_moc.cxx \
- SMESHGUI_MeshInfosBox_moc.cxx
+ SMESHGUI_MeshInfosBox_moc.cxx \
+ SMESHGUI_Make2DFrom3DOp_moc.cxx
nodist_libSMESH_la_SOURCES= \
$(MOC_FILES)
#include "SMESHGUI_BuildCompoundDlg.h"
#include "SMESHGUI_ComputeDlg.h"
#include "SMESHGUI_FileInfoDlg.h"
+#include "SMESHGUI_Make2DFrom3DOp.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_MeshUtils.h"
#include CORBA_CLIENT_HEADER(SMESH_MeshEditor)
// Qt includes
-// #define INCLUDE_MENUITEM_DEF // VSR commented ????????
+// #define INCLUDE_MENUITEM_DEF // VSR commented ????????
#include <QMenu>
// BOOST includes
// Declarations
//=============================================================
void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh,
- int theCommandID);
+ int theCommandID);
void ExportMeshToFile(int theCommandID);
// Definitions
//=============================================================
void ImportMeshesFromFile( SMESH::SMESH_Gen_ptr theComponentMesh,
- int theCommandID )
+ int theCommandID )
{
QStringList filter;
std::string myExtension;
anInitialPath = QDir::currentPath();
QStringList filenames = SUIT_FileDlg::getOpenFileNames( SMESHGUI::desktop(),
- anInitialPath,
- filter,
- QObject::tr( "SMESH_IMPORT_MESH" ) );
+ anInitialPath,
+ filter,
+ QObject::tr( "SMESH_IMPORT_MESH" ) );
if ( filenames.count() > 0 ) {
SUIT_OverrideCursor wc;
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
QStringList errors;
bool isEmpty = false;
for ( QStringList::ConstIterator it = filenames.begin(); it != filenames.end(); ++it ) {
- QString filename = *it;
- SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
- try {
- switch ( theCommandID ) {
- case 111:
- {
- // DAT format (currently unsupported)
- errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
- arg( QObject::tr( "SMESH_ERR_NOT_SUPPORTED_FORMAT" ) ) );
- break;
- }
- case 112:
- {
- // UNV format
- aMeshes->length( 1 );
- aMeshes[0] = theComponentMesh->CreateMeshesFromUNV( filename.toLatin1().constData() );
- if ( aMeshes[0]->_is_nil() )
- errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
- arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
- break;
- }
- case 113:
- {
- // MED format
- SMESH::DriverMED_ReadStatus res;
- aMeshes = theComponentMesh->CreateMeshesFromMED( filename.toLatin1().constData(), res );
- if ( res != SMESH::DRS_OK ) {
- errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
- arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) );
- }
- break;
- }
- }
- }
- catch ( const SALOME::SALOME_Exception& S_ex ) {
- errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
- arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
- }
-
- for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) {
- _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
- if ( aMeshSO ) {
- _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
- _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
- aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
- if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
- SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
- }
- else {
- isEmpty = true;
- }
- }
+ QString filename = *it;
+ SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
+ try {
+ switch ( theCommandID ) {
+ case 111:
+ {
+ // DAT format (currently unsupported)
+ errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
+ arg( QObject::tr( "SMESH_ERR_NOT_SUPPORTED_FORMAT" ) ) );
+ break;
+ }
+ case 112:
+ {
+ // UNV format
+ aMeshes->length( 1 );
+ aMeshes[0] = theComponentMesh->CreateMeshesFromUNV( filename.toLatin1().constData() );
+ if ( aMeshes[0]->_is_nil() )
+ errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
+ arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
+ break;
+ }
+ case 113:
+ {
+ // MED format
+ SMESH::DriverMED_ReadStatus res;
+ aMeshes = theComponentMesh->CreateMeshesFromMED( filename.toLatin1().constData(), res );
+ if ( res != SMESH::DRS_OK ) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
+ arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) );
+ }
+ break;
+ }
+ }
+ }
+ catch ( const SALOME::SALOME_Exception& S_ex ) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
+ arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
+ }
+
+ for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) {
+ _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
+ if ( aMeshSO ) {
+ _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+ _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
+ aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
+ if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
+ SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
+ }
+ else {
+ isEmpty = true;
+ }
+ }
}
// update Object browser
// show Error message box if there were errors
if ( errors.count() > 0 ) {
- SUIT_MessageBox::critical( SMESHGUI::desktop(),
- QObject::tr( "SMESH_ERROR" ),
- QObject::tr( "SMESH_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
+ SUIT_MessageBox::critical( SMESHGUI::desktop(),
+ QObject::tr( "SMESH_ERROR" ),
+ QObject::tr( "SMESH_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
}
// show warning message box, if some imported mesh is empty
if ( isEmpty ) {
- SUIT_MessageBox::warning( SMESHGUI::desktop(),
- QObject::tr( "SMESH_WRN_WARNING" ),
- QObject::tr( "SMESH_DRS_SOME_EMPTY" ) );
+ SUIT_MessageBox::warning( SMESHGUI::desktop(),
+ QObject::tr( "SMESH_WRN_WARNING" ),
+ QObject::tr( "SMESH_DRS_SOME_EMPTY" ) );
}
}
}
}
inline void InverseEntityMode(unsigned int& theOutputMode,
- unsigned int theMode)
+ unsigned int theMode)
{
bool anIsNotPresent = ~theOutputMode & theMode;
if(anIsNotPresent)
if(selected.Extent() >= 1){
SALOME_ListIteratorOfListIO It( selected );
for( ; It.More(); It.Next()){
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- if(IObject->hasEntry()){
- if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
- unsigned int aMode = anActor->GetEntityMode();
- switch(theCommandID){
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ if(IObject->hasEntry()){
+ if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
+ unsigned int aMode = anActor->GetEntityMode();
+ switch(theCommandID){
case 216:
InverseEntityMode(aMode,SMESH_Actor::e0DElements);
break;
- case 217:
- InverseEntityMode(aMode,SMESH_Actor::eEdges);
- break;
- case 218:
- InverseEntityMode(aMode,SMESH_Actor::eFaces);
- break;
- case 219:
- InverseEntityMode(aMode,SMESH_Actor::eVolumes);
- break;
- case 220:
- aMode = SMESH_Actor::eAllEntity;
- break;
- }
- if(aMode)
- anActor->SetEntityMode(aMode);
- }
- }
+ case 217:
+ InverseEntityMode(aMode,SMESH_Actor::eEdges);
+ break;
+ case 218:
+ InverseEntityMode(aMode,SMESH_Actor::eFaces);
+ break;
+ case 219:
+ InverseEntityMode(aMode,SMESH_Actor::eVolumes);
+ break;
+ case 220:
+ aMode = SMESH_Actor::eAllEntity;
+ break;
+ }
+ if(aMode)
+ anActor->SetEntityMode(aMode);
+ }
+ }
}
}
}
_PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject);
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aGroupSObject->GetID().c_str()))
{
- if( aGroupObject->GetType() == SMESH::NODE )
- anActor->SetNodeColor( aColor.R, aColor.G, aColor.B );
- else if( aGroupObject->GetType() == SMESH::EDGE )
- anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B );
- else
- anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
+ if( aGroupObject->GetType() == SMESH::NODE )
+ anActor->SetNodeColor( aColor.R, aColor.G, aColor.B );
+ else if( aGroupObject->GetType() == SMESH::EDGE )
+ anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B );
+ else
+ anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
}
}
Handle(SALOME_InteractiveObject) anIObject = selected.First();
SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
if ( !aMesh->_is_nil() ) {
- aMesh->SetAutoColor( false );
+ aMesh->SetAutoColor( false );
}
}
}
if(selected.Extent() >= 1){
switch(theCommandID){
case 1134:{
- SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
- (new SMESHGUI_ClippingDlg( SMESHGUI::GetSMESHGUI() ))->show();
- return;
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+ (new SMESHGUI_ClippingDlg( SMESHGUI::GetSMESHGUI() ))->show();
+ return;
}
case 1133:{
- SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
- (new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI() ))->show();
- return;
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+ (new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI() ))->show();
+ return;
}}
SALOME_ListIteratorOfListIO It( selected );
for( ; It.More(); It.Next()){
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- if(IObject->hasEntry()){
- if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
- switch(theCommandID){
- case 211:
- anActor->SetRepresentation(SMESH_Actor::eEdge);
- break;
- case 212:
- anActor->SetRepresentation(SMESH_Actor::eSurface);
- break;
- case 213:
- if(anActor->IsShrunk())
- anActor->UnShrink();
- else
- anActor->SetShrink();
- break;
- case 215:
- anActor->SetRepresentation(SMESH_Actor::ePoint);
- break;
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ if(IObject->hasEntry()){
+ if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
+ switch(theCommandID){
+ case 211:
+ anActor->SetRepresentation(SMESH_Actor::eEdge);
+ break;
+ case 212:
+ anActor->SetRepresentation(SMESH_Actor::eSurface);
+ break;
+ case 213:
+ if(anActor->IsShrunk())
+ anActor->UnShrink();
+ else
+ anActor->SetShrink();
+ break;
+ case 215:
+ anActor->SetRepresentation(SMESH_Actor::ePoint);
+ break;
case 231:
if(anActor->GetQuadratic2DRepresentation() != SMESH_Actor::eLines)
anActor->SetQuadratic2DRepresentation(SMESH_Actor::eLines);
if(anActor->GetQuadratic2DRepresentation() != SMESH_Actor::eArcs)
anActor->SetQuadratic2DRepresentation(SMESH_Actor::eArcs);
break;
- case 1132:{
- vtkFloatingPointType color[3];
- anActor->GetSufaceColor(color[0], color[1], color[2]);
- int c0 = int (color[0] * 255);
- int c1 = int (color[1] * 255);
- int c2 = int (color[2] * 255);
- QColor c(c0, c1, c2);
-
- vtkFloatingPointType edgecolor[3];
- anActor->GetEdgeColor(edgecolor[0], edgecolor[1], edgecolor[2]);
- c0 = int (edgecolor[0] * 255);
- c1 = int (edgecolor[1] * 255);
- c2 = int (edgecolor[2] * 255);
- QColor e(c0, c1, c2);
-
- vtkFloatingPointType backfacecolor[3];
- anActor->GetBackSufaceColor(backfacecolor[0], backfacecolor[1], backfacecolor[2]);
- c0 = int (backfacecolor[0] * 255);
- c1 = int (backfacecolor[1] * 255);
- c2 = int (backfacecolor[2] * 255);
- QColor b(c0, c1, c2);
-
- vtkFloatingPointType nodecolor[3];
- anActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]);
- c0 = int (nodecolor[0] * 255);
- c1 = int (nodecolor[1] * 255);
- c2 = int (nodecolor[2] * 255);
- QColor n(c0, c1, c2);
-
- int Edgewidth = (int)anActor->GetLineWidth();
- if(Edgewidth == 0)
- Edgewidth = 1;
- int intValue = int(anActor->GetNodeSize());
- vtkFloatingPointType Shrink = anActor->GetShrinkFactor();
-
- SMESHGUI_Preferences_ColorDlg *aDlg =
- new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI() );
- aDlg->SetColor(1, c);
- aDlg->SetColor(2, e);
- aDlg->SetColor(3, n);
- aDlg->SetColor(4, b);
- aDlg->SetIntValue(1, Edgewidth);
- aDlg->SetIntValue(2, intValue);
- aDlg->SetIntValue(3, int(Shrink*100.));
- if(aDlg->exec()){
- QColor color = aDlg->GetColor(1);
- QColor edgecolor = aDlg->GetColor(2);
- QColor nodecolor = aDlg->GetColor(3);
- QColor backfacecolor = aDlg->GetColor(4);
- /* actor color and backface color */
- anActor->SetSufaceColor(vtkFloatingPointType (color.red()) / 255.,
- vtkFloatingPointType (color.green()) / 255.,
- vtkFloatingPointType (color.blue()) / 255.);
- anActor->SetBackSufaceColor(vtkFloatingPointType (backfacecolor.red()) / 255.,
- vtkFloatingPointType (backfacecolor.green()) / 255.,
- vtkFloatingPointType (backfacecolor.blue()) / 255.);
-
- /* edge color */
- anActor->SetEdgeColor(vtkFloatingPointType (edgecolor.red()) / 255.,
- vtkFloatingPointType (edgecolor.green()) / 255.,
- vtkFloatingPointType (edgecolor.blue()) / 255.);
-
- /* Shrink factor and size edges */
- anActor->SetShrinkFactor(aDlg->GetIntValue(3) / 100.);
- anActor->SetLineWidth(aDlg->GetIntValue(1));
-
- /* Nodes color and size */
- anActor->SetNodeColor(vtkFloatingPointType (nodecolor.red()) / 255.,
- vtkFloatingPointType (nodecolor.green()) / 255.,
- vtkFloatingPointType (nodecolor.blue()) / 255.);
- anActor->SetNodeSize(aDlg->GetIntValue(2));
-
- SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
- if( !aGroupObject->_is_nil() )
- {
- SMESH::ElementType anElementType = aGroupObject->GetType();
- QColor aColor;
- switch( anElementType )
- {
- case SMESH::NODE: aColor = nodecolor; break;
- case SMESH::EDGE: aColor = edgecolor; break;
- default: aColor = color; break;
- }
-
- SALOMEDS::Color aGroupColor;
- aGroupColor.R = (float)aColor.red() / 255.0;
- aGroupColor.G = (float)aColor.green() / 255.0;
- aGroupColor.B = (float)aColor.blue() / 255.0;
- aGroupObject->SetColor( aGroupColor );
- }
-
- delete aDlg;
- }
- break;
- }}
- }
- }
+ case 1132:{
+ vtkFloatingPointType color[3];
+ anActor->GetSufaceColor(color[0], color[1], color[2]);
+ int c0 = int (color[0] * 255);
+ int c1 = int (color[1] * 255);
+ int c2 = int (color[2] * 255);
+ QColor c(c0, c1, c2);
+
+ vtkFloatingPointType edgecolor[3];
+ anActor->GetEdgeColor(edgecolor[0], edgecolor[1], edgecolor[2]);
+ c0 = int (edgecolor[0] * 255);
+ c1 = int (edgecolor[1] * 255);
+ c2 = int (edgecolor[2] * 255);
+ QColor e(c0, c1, c2);
+
+ vtkFloatingPointType backfacecolor[3];
+ anActor->GetBackSufaceColor(backfacecolor[0], backfacecolor[1], backfacecolor[2]);
+ c0 = int (backfacecolor[0] * 255);
+ c1 = int (backfacecolor[1] * 255);
+ c2 = int (backfacecolor[2] * 255);
+ QColor b(c0, c1, c2);
+
+ vtkFloatingPointType nodecolor[3];
+ anActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]);
+ c0 = int (nodecolor[0] * 255);
+ c1 = int (nodecolor[1] * 255);
+ c2 = int (nodecolor[2] * 255);
+ QColor n(c0, c1, c2);
+
+ int Edgewidth = (int)anActor->GetLineWidth();
+ if(Edgewidth == 0)
+ Edgewidth = 1;
+ int intValue = int(anActor->GetNodeSize());
+ vtkFloatingPointType Shrink = anActor->GetShrinkFactor();
+
+ SMESHGUI_Preferences_ColorDlg *aDlg =
+ new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI() );
+ aDlg->SetColor(1, c);
+ aDlg->SetColor(2, e);
+ aDlg->SetColor(3, n);
+ aDlg->SetColor(4, b);
+ aDlg->SetIntValue(1, Edgewidth);
+ aDlg->SetIntValue(2, intValue);
+ aDlg->SetIntValue(3, int(Shrink*100.));
+ if(aDlg->exec()){
+ QColor color = aDlg->GetColor(1);
+ QColor edgecolor = aDlg->GetColor(2);
+ QColor nodecolor = aDlg->GetColor(3);
+ QColor backfacecolor = aDlg->GetColor(4);
+ /* actor color and backface color */
+ anActor->SetSufaceColor(vtkFloatingPointType (color.red()) / 255.,
+ vtkFloatingPointType (color.green()) / 255.,
+ vtkFloatingPointType (color.blue()) / 255.);
+ anActor->SetBackSufaceColor(vtkFloatingPointType (backfacecolor.red()) / 255.,
+ vtkFloatingPointType (backfacecolor.green()) / 255.,
+ vtkFloatingPointType (backfacecolor.blue()) / 255.);
+
+ /* edge color */
+ anActor->SetEdgeColor(vtkFloatingPointType (edgecolor.red()) / 255.,
+ vtkFloatingPointType (edgecolor.green()) / 255.,
+ vtkFloatingPointType (edgecolor.blue()) / 255.);
+
+ /* Shrink factor and size edges */
+ anActor->SetShrinkFactor(aDlg->GetIntValue(3) / 100.);
+ anActor->SetLineWidth(aDlg->GetIntValue(1));
+
+ /* Nodes color and size */
+ anActor->SetNodeColor(vtkFloatingPointType (nodecolor.red()) / 255.,
+ vtkFloatingPointType (nodecolor.green()) / 255.,
+ vtkFloatingPointType (nodecolor.blue()) / 255.);
+ anActor->SetNodeSize(aDlg->GetIntValue(2));
+
+ SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
+ if( !aGroupObject->_is_nil() )
+ {
+ SMESH::ElementType anElementType = aGroupObject->GetType();
+ QColor aColor;
+ switch( anElementType )
+ {
+ case SMESH::NODE: aColor = nodecolor; break;
+ case SMESH::EDGE: aColor = edgecolor; break;
+ default: aColor = color; break;
+ }
+
+ SALOMEDS::Color aGroupColor;
+ aGroupColor.R = (float)aColor.red() / 255.0;
+ aGroupColor.G = (float)aColor.green() / 255.0;
+ aGroupColor.B = (float)aColor.blue() / 255.0;
+ aGroupObject->SetColor( aGroupColor );
+ }
+
+ delete aDlg;
+ }
+ break;
+ }}
+ }
+ }
}
SMESH::RepaintCurrentView();
}
if( !selected.IsEmpty() ){
Handle(SALOME_InteractiveObject) anIO = selected.First();
if(!anIO.IsNull()){
- QString aTitle;
- SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
- if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())){
- switch ( theCommandID ){
- case 6001:
- aTitle = QObject::tr( "LENGTH_EDGES" );
- aControl = SMESH_Actor::eLength;
- break;
- case 6018:
- aTitle = QObject::tr( "LENGTH2D_EDGES" );
- aControl = SMESH_Actor::eLength2D;
- break;
- case 6002:
- aTitle = QObject::tr( "FREE_EDGES" );
- aControl = SMESH_Actor::eFreeEdges;
- break;
- case 6003:
- aTitle = QObject::tr( "FREE_BORDERS" );
- aControl = SMESH_Actor::eFreeBorders;
- break;
- case 6004:
- aTitle = QObject::tr( "MULTI_BORDERS" );
- aControl = SMESH_Actor::eMultiConnection;
- break;
- case 6005:
- aTitle = QObject::tr( "FREE_NODES" );
- aControl = SMESH_Actor::eFreeNodes;
- break;
- case 6019:
- aTitle = QObject::tr( "MULTI2D_BORDERS" );
- aControl = SMESH_Actor::eMultiConnection2D;
- break;
- case 6011:
- aTitle = QObject::tr( "AREA_ELEMENTS" );
- aControl = SMESH_Actor::eArea;
- break;
- case 6012:
- aTitle = QObject::tr( "TAPER_ELEMENTS" );
- aControl = SMESH_Actor::eTaper;
- break;
- case 6013:
- aTitle = QObject::tr( "ASPECTRATIO_ELEMENTS" );
- aControl = SMESH_Actor::eAspectRatio;
- break;
- case 6017:
- aTitle = QObject::tr( "ASPECTRATIO_3D_ELEMENTS" );
- aControl = SMESH_Actor::eAspectRatio3D;
- break;
- case 6014:
- aTitle = QObject::tr( "MINIMUMANGLE_ELEMENTS" );
- aControl = SMESH_Actor::eMinimumAngle;
- break;
- case 6015:
- aTitle = QObject::tr( "WARP_ELEMENTS" );
- aControl = SMESH_Actor::eWarping;
- break;
- case 6016:
- aTitle = QObject::tr( "SKEW_ELEMENTS" );
- aControl = SMESH_Actor::eSkew;
- break;
- case 6009:
- aTitle = QObject::tr( "SMESH_VOLUME" );
- aControl = SMESH_Actor::eVolume3D;
- break;
- case 6021:
- aTitle = QObject::tr( "FREE_FACES" );
- aControl = SMESH_Actor::eFreeFaces;
- break;
- }
- anActor->SetControlMode(aControl);
- anActor->GetScalarBarActor()->SetTitle(aTitle.toLatin1().data());
- SMESH::RepaintCurrentView();
- }
+ QString aTitle;
+ SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
+ if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())){
+ switch ( theCommandID ){
+ case 6001:
+ aTitle = QObject::tr( "LENGTH_EDGES" );
+ aControl = SMESH_Actor::eLength;
+ break;
+ case 6018:
+ aTitle = QObject::tr( "LENGTH2D_EDGES" );
+ aControl = SMESH_Actor::eLength2D;
+ break;
+ case 6002:
+ aTitle = QObject::tr( "FREE_EDGES" );
+ aControl = SMESH_Actor::eFreeEdges;
+ break;
+ case 6003:
+ aTitle = QObject::tr( "FREE_BORDERS" );
+ aControl = SMESH_Actor::eFreeBorders;
+ break;
+ case 6004:
+ aTitle = QObject::tr( "MULTI_BORDERS" );
+ aControl = SMESH_Actor::eMultiConnection;
+ break;
+ case 6005:
+ aTitle = QObject::tr( "FREE_NODES" );
+ aControl = SMESH_Actor::eFreeNodes;
+ break;
+ case 6019:
+ aTitle = QObject::tr( "MULTI2D_BORDERS" );
+ aControl = SMESH_Actor::eMultiConnection2D;
+ break;
+ case 6011:
+ aTitle = QObject::tr( "AREA_ELEMENTS" );
+ aControl = SMESH_Actor::eArea;
+ break;
+ case 6012:
+ aTitle = QObject::tr( "TAPER_ELEMENTS" );
+ aControl = SMESH_Actor::eTaper;
+ break;
+ case 6013:
+ aTitle = QObject::tr( "ASPECTRATIO_ELEMENTS" );
+ aControl = SMESH_Actor::eAspectRatio;
+ break;
+ case 6017:
+ aTitle = QObject::tr( "ASPECTRATIO_3D_ELEMENTS" );
+ aControl = SMESH_Actor::eAspectRatio3D;
+ break;
+ case 6014:
+ aTitle = QObject::tr( "MINIMUMANGLE_ELEMENTS" );
+ aControl = SMESH_Actor::eMinimumAngle;
+ break;
+ case 6015:
+ aTitle = QObject::tr( "WARP_ELEMENTS" );
+ aControl = SMESH_Actor::eWarping;
+ break;
+ case 6016:
+ aTitle = QObject::tr( "SKEW_ELEMENTS" );
+ aControl = SMESH_Actor::eSkew;
+ break;
+ case 6009:
+ aTitle = QObject::tr( "SMESH_VOLUME" );
+ aControl = SMESH_Actor::eVolume3D;
+ break;
+ case 6021:
+ aTitle = QObject::tr( "FREE_FACES" );
+ aControl = SMESH_Actor::eFreeFaces;
+ break;
+ }
+ anActor->SetControlMode(aControl);
+ anActor->GetScalarBarActor()->SetTitle(aTitle.toLatin1().data());
+ SMESH::RepaintCurrentView();
+ }
}
}
}
bool CheckOIType(const Handle(SALOME_InteractiveObject) & theIO,
- MeshObjectType theType,
- const QString theInTypeName,
- QString & theOutTypeName)
+ MeshObjectType theType,
+ const QString theInTypeName,
+ QString & theOutTypeName)
{
SMESH_TypeFilter aTypeFilter( theType );
QString entry;
_PTR(SComponent) aSComp = aSObj->GetFatherComponent();
CORBA::String_var anID = aSComp->GetID().c_str();
if (!strcmp(anID.in(),theIO->getEntry()))
- return "Component";
+ return "Component";
}
QString aTypeName;
if (
- CheckOIType ( theIO, HYPOTHESIS, "Hypothesis", aTypeName ) ||
- CheckOIType ( theIO, ALGORITHM, "Algorithm", aTypeName ) ||
- CheckOIType ( theIO, MESH, "Mesh", aTypeName ) ||
- CheckOIType ( theIO, SUBMESH, "SubMesh", aTypeName ) ||
- CheckOIType ( theIO, GROUP, "Group", aTypeName )
- )
+ CheckOIType ( theIO, HYPOTHESIS, "Hypothesis", aTypeName ) ||
+ CheckOIType ( theIO, ALGORITHM, "Algorithm", aTypeName ) ||
+ CheckOIType ( theIO, MESH, "Mesh", aTypeName ) ||
+ CheckOIType ( theIO, SUBMESH, "SubMesh", aTypeName ) ||
+ CheckOIType ( theIO, GROUP, "Group", aTypeName )
+ )
return aTypeName;
return "NoType";
SALOME_ListIteratorOfListIO It(selected);
for ( ; It.More(); It.Next())
{
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- QString Type = CheckTypeObject(IObject);
- if (Type.compare(RefType) != 0)
- return "Heterogeneous Selection";
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ QString Type = CheckTypeObject(IObject);
+ if (Type.compare(RefType) != 0)
+ return "Heterogeneous Selection";
}
return RefType;
QString cur = anIO->getComponentDataType();
_PTR(SObject) aSO = aStudy->FindObjectID(anIO->getEntry());
if (aSO) {
- // check if object is reference
- _PTR(SObject) aRefSObj;
- aNameList.append("\n - ");
- if ( aSO->ReferencedObject( aRefSObj ) ) {
- QString aRefName = QString::fromStdString ( aRefSObj->GetName() );
- aNameList.append( aRefName );
- cur = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() );
- }
- else
- aNameList.append(anIO->getName());
- objectCount++;
+ // check if object is reference
+ _PTR(SObject) aRefSObj;
+ aNameList.append("\n - ");
+ if ( aSO->ReferencedObject( aRefSObj ) ) {
+ QString aRefName = QString::fromStdString ( aRefSObj->GetName() );
+ aNameList.append( aRefName );
+ cur = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() );
+ }
+ else
+ aNameList.append(anIO->getName());
+ objectCount++;
}
if( aParentComponent.isNull() )
if ( aParentComponent != SMESHGUI::GetSMESHGUI()->name() ) {
SUIT_MessageBox::warning( SMESHGUI::desktop(),
- QObject::tr("ERR_ERROR"),
- QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg( SMESHGUI::GetSMESHGUI()->moduleName() ) );
+ QObject::tr("ERR_ERROR"),
+ QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg( SMESHGUI::GetSMESHGUI()->moduleName() ) );
return;
}
// VSR 17/11/04: check if all objects selected belong to SMESH component <-- finish
if (SUIT_MessageBox::warning
- (SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_REALLY_DELETE").arg( objectCount ).arg( aNameList ),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No,
- SUIT_MessageBox::Yes) != SUIT_MessageBox::Yes)
+ (SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_REALLY_DELETE").arg( objectCount ).arg( aNameList ),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No,
+ SUIT_MessageBox::Yes) != SUIT_MessageBox::Yes)
return;
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
for( ; It.More(); It.Next()){ // loop on selected IO's
Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()) {
- _PTR(SObject) aSO = aStudy->FindObjectID(IObject->getEntry());
-
- // disable removal of "SMESH" component object
- if(aSO->FindAttribute(anAttr, "AttributeIOR")){
- anIOR = anAttr;
- if ( engineIOR() == anIOR->Value().c_str() )
- continue;
- }
- //Check the referenced object
- _PTR(SObject) aRefSObject;
- if ( aSO && aSO->ReferencedObject( aRefSObject ) )
- aSO = aRefSObject; // Delete main Object instead of reference
+ _PTR(SObject) aSO = aStudy->FindObjectID(IObject->getEntry());
+
+ // disable removal of "SMESH" component object
+ if(aSO->FindAttribute(anAttr, "AttributeIOR")){
+ anIOR = anAttr;
+ if ( engineIOR() == anIOR->Value().c_str() )
+ continue;
+ }
+ //Check the referenced object
+ _PTR(SObject) aRefSObject;
+ if ( aSO && aSO->ReferencedObject( aRefSObject ) )
+ aSO = aRefSObject; // Delete main Object instead of reference
// put the whole hierarchy of sub-objects of the selected SO into a list and
// then treat them all starting from the deepest objects (at list back)
std::string anEntry = SO->GetID();
/** Erase graphical object **/
- if(SO->FindAttribute(anAttr, "AttributeIOR")){
- QVector<SUIT_ViewWindow*> aViews = vm->getViews();
- for(int i = 0; i < nbSf; i++){
- SUIT_ViewWindow *sf = aViews[i];
- if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
- SMESH::RemoveActor(sf,anActor);
- }
- }
- }
+ if(SO->FindAttribute(anAttr, "AttributeIOR")){
+ QVector<SUIT_ViewWindow*> aViews = vm->getViews();
+ for(int i = 0; i < nbSf; i++){
+ SUIT_ViewWindow *sf = aViews[i];
+ if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
+ SMESH::RemoveActor(sf,anActor);
+ }
+ }
+ }
/** Remove an object from data structures **/
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( SO ));
//op->finish();
}
}
- } /* listSO back loop */
+ } /* listSO back loop */
} /* IObject->hasEntry() */
} /* more/next */
aStudyBuilder->CommitCommand();
{
_PTR(Study) aStudy = study->studyDS();
if ( aStudy )
- GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
+ GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
}
}
emit SignalCloseAllDialogs();
}
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+void SMESHGUI::EmitSignalVisibilityChanged()
+{
+ emit SignalVisibilityChanged();
+}
+
//=============================================================================
/*!
*
return NULL;
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-char* SMESHGUI::JoinObjectParameters(const QStringList& theParametersList)
-{
- return theParametersList.join(":").toLatin1().data();
-}
-
//=============================================================================
/*!
*
static bool checkLock(_PTR(Study) theStudy) {
if (isStudyLocked(theStudy)) {
SUIT_MessageBox::warning( SMESHGUI::desktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED") );
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED") );
return true;
}
return false;
//QAction* act = action( theCommandID );
- switch (theCommandID) {
- case 33: // DELETE
+ switch (theCommandID) {
+ case 33: // DELETE
if(checkLock(aStudy)) break;
OnEditDelete();
break;
- case 113: // IMPORT
+ case 113: // IMPORT
case 112:
case 111:
{
break;
}
- case 122: // EXPORT MED
+ case 122: // EXPORT MED
case 121:
case 123:
case 124:
break;
}
- case 200: // SCALAR BAR
+ case 200: // SCALAR BAR
{
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
aSel->selectedObjects( selected );
if( selected.Extent() ) {
- Handle(SALOME_InteractiveObject) anIO = selected.First();
- if( anIO->hasEntry() ) {
- if( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) {
- anActor->SetControlMode( SMESH_Actor::eNone );
- }
- }
+ Handle(SALOME_InteractiveObject) anIO = selected.First();
+ if( anIO->hasEntry() ) {
+ if( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) {
+ anActor->SetControlMode( SMESH_Actor::eNone );
+ }
+ }
}
break;
}
SALOME_ListIteratorOfListIO it(selected);
for( ; it.More(); it.Next()) {
Handle(SALOME_InteractiveObject) anIObject = it.Value();
- if(anIObject->hasEntry()) {
- if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
- anActor->SetFacesOriented( !anActor->GetFacesOriented() );
- }
- }
+ if(anIObject->hasEntry()) {
+ if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
+ anActor->SetFacesOriented( !anActor->GetFacesOriented() );
+ }
+ }
}
break;
}
- case 214: // UPDATE
+ case 214: // UPDATE
{
if(checkLock(aStudy)) break;
try {
break;
}
- case 300: // ERASE
- case 301: // DISPLAY
- case 302: // DISPLAY ONLY
+ case 300: // ERASE
+ case 301: // DISPLAY
+ case 302: // DISPLAY ONLY
{
SMESH::EDisplaing anAction;
switch (theCommandID) {
- case 300: anAction = SMESH::eErase; break;
- case 301: anAction = SMESH::eDisplay; break;
- case 302: anAction = SMESH::eDisplayOnly; break;
+ case 300: anAction = SMESH::eErase; break;
+ case 301: anAction = SMESH::eDisplay; break;
+ case 302: anAction = SMESH::eDisplayOnly; break;
}
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
aSel->selectedObjects( sel_objects );
if( theCommandID==302 )
- startOperation( myEraseAll );
+ startOperation( myEraseAll );
extractContainers( sel_objects, to_process );
for ( ; It.More(); It.Next()) {
Handle(SALOME_InteractiveObject) IOS = It.Value();
if (IOS->hasEntry()) {
- if (!SMESH::UpdateView(anAction, IOS->getEntry()))
+ if (!SMESH::UpdateView(anAction, IOS->getEntry())) {
+ SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged();
break; // PAL16774 (Crash after display of many groups)
+ }
if (anAction == SMESH::eDisplayOnly)
anAction = SMESH::eDisplay;
}
}
// PAL13338 + PAL15161 -->
- if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy))
+ if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy)) {
SMESH::UpdateView();
+ SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged();
+ }
// PAL13338 + PAL15161 <--
}
catch (...) { // PAL16774 (Crash after display of many groups)
}
if (anAction == SMESH::eErase) {
- SALOME_ListIO l1;
- aSel->setSelectedObjects( l1 );
+ SALOME_ListIO l1;
+ aSel->setSelectedObjects( l1 );
}
else
- aSel->setSelectedObjects( to_process );
-
+ aSel->setSelectedObjects( to_process );
+
break;
}
- case 4000: // NODES
+ case 4000: // NODES
{
if(checkLock(aStudy)) break;
if ( vtkwnd ) {
- EmitSignalDeactivateDialog();
+ EmitSignalDeactivateDialog();
- ( new SMESHGUI_NodesDlg( this ) )->show();
+ ( new SMESHGUI_NodesDlg( this ) )->show();
}
else {
- SUIT_MessageBox::warning(desktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(desktop(),
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
break;
}
- case 406: // MOVE NODE
+ case 406: // MOVE NODE
{
if ( !vtkwnd )
{
SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
- tr( "NOT_A_VTK_VIEWER" ) );
+ tr( "NOT_A_VTK_VIEWER" ) );
break;
}
break;
}
- case 701: // COMPUTE MESH
- case 711: // PRECOMPUTE MESH
- case 712: // EVALUATE MESH
+ case 701: // COMPUTE MESH
+ case 711: // PRECOMPUTE MESH
+ case 712: // EVALUATE MESH
{
if (checkLock(aStudy)) break;
startOperation( theCommandID );
if ( !vtkwnd )
{
SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
- tr( "NOT_A_VTK_VIEWER" ) );
+ tr( "NOT_A_VTK_VIEWER" ) );
break;
}
if ( !vtkwnd )
{
SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
- tr( "NOT_A_VTK_VIEWER" ) );
+ tr( "NOT_A_VTK_VIEWER" ) );
break;
}
{
if(checkLock(aStudy)) break;
if( vtkwnd ) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_SmoothingDlg( this ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_SmoothingDlg( this ) )->show();
}
else {
- SUIT_MessageBox::warning(desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
{
if (checkLock(aStudy)) break;
if (vtkwnd) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_ExtrusionDlg ( this ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_ExtrusionDlg ( this ) )->show();
} else {
- SUIT_MessageBox::warning(desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
{
if(checkLock(aStudy)) break;
if( vtkwnd ) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_RevolutionDlg( this ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_RevolutionDlg( this ) )->show();
}
else {
- SUIT_MessageBox::warning(desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
( new SMESHGUI_MeshPatternDlg( this ) )->show();
}
else {
- SUIT_MessageBox::warning(desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
{
if (checkLock(aStudy)) break;
if (vtkwnd) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_ExtrusionAlongPathDlg( this ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_ExtrusionAlongPathDlg( this ) )->show();
} else {
- SUIT_MessageBox::warning(desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
startOperation( 417 );
/* if (checkLock(aStudy)) break;
if (vtkwnd) {
- EmitSignalDeactivateDialog();
- new SMESHGUI_ConvToQuadDlg();
+ EmitSignalDeactivateDialog();
+ new SMESHGUI_ConvToQuadDlg();
} else {
- SUIT_MessageBox::warning(desktop(),
+ SUIT_MessageBox::warning(desktop(),
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
- }*/
+ }*/
+ break;
+ }
+ case 418: // create 2D mesh from 3D
+ {
+ startOperation( 418 );
break;
}
case 806: // CREATE GEO GROUP
if ( !vtkwnd )
{
SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
- tr( "NOT_A_VTK_VIEWER" ) );
+ tr( "NOT_A_VTK_VIEWER" ) );
break;
}
int nbSel = selected.Extent();
if (nbSel == 1) {
- // check if mesh is selected
+ // check if mesh is selected
aMesh = SMESH::GetMeshByIO( selected.First() );
}
SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aMesh);
if ( !vtkwnd )
{
SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
- tr( "NOT_A_VTK_VIEWER" ) );
+ tr( "NOT_A_VTK_VIEWER" ) );
break;
}
int nbSel = selected.Extent();
if (nbSel == 1) {
- // check if submesh is selected
- Handle(SALOME_InteractiveObject) IObject = selected.First();
- if (IObject->hasEntry()) {
- _PTR(SObject) aSObj = aStudy->FindObjectID(IObject->getEntry());
- if( aSObj ) {
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( aSObj ) );
- if (!aSubMesh->_is_nil()) {
- try {
- SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
- // get submesh elements list by types
- SMESH::long_array_var aNodes = aSubMesh->GetElementsByType(SMESH::NODE);
- SMESH::long_array_var aEdges = aSubMesh->GetElementsByType(SMESH::EDGE);
- SMESH::long_array_var aFaces = aSubMesh->GetElementsByType(SMESH::FACE);
- SMESH::long_array_var aVolumes = aSubMesh->GetElementsByType(SMESH::VOLUME);
- // create group for each type o elements
- QString aName = IObject->getName();
- if (aNodes->length() > 0) {
- SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::NODE, aName + "_Nodes");
- aGroup->Add(aNodes.inout());
- }
- if (aEdges->length() > 0) {
- SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::EDGE, aName + "_Edges");
- aGroup->Add(aEdges.inout());
- }
- if (aFaces->length() > 0) {
- SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::FACE, aName + "_Faces");
- aGroup->Add(aFaces.inout());
- }
- if (aVolumes->length() > 0) {
- SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::VOLUME, aName + "_Volumes");
- aGroup->Add(aVolumes.inout());
- }
- updateObjBrowser();
-
- }
+ // check if submesh is selected
+ Handle(SALOME_InteractiveObject) IObject = selected.First();
+ if (IObject->hasEntry()) {
+ _PTR(SObject) aSObj = aStudy->FindObjectID(IObject->getEntry());
+ if( aSObj ) {
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( aSObj ) );
+ if (!aSubMesh->_is_nil()) {
+ try {
+ SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
+ // get submesh elements list by types
+ SMESH::long_array_var aNodes = aSubMesh->GetElementsByType(SMESH::NODE);
+ SMESH::long_array_var aEdges = aSubMesh->GetElementsByType(SMESH::EDGE);
+ SMESH::long_array_var aFaces = aSubMesh->GetElementsByType(SMESH::FACE);
+ SMESH::long_array_var aVolumes = aSubMesh->GetElementsByType(SMESH::VOLUME);
+ // create group for each type o elements
+ QString aName = IObject->getName();
+ if (aNodes->length() > 0) {
+ SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::NODE, aName + "_Nodes");
+ aGroup->Add(aNodes.inout());
+ }
+ if (aEdges->length() > 0) {
+ SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::EDGE, aName + "_Edges");
+ aGroup->Add(aEdges.inout());
+ }
+ if (aFaces->length() > 0) {
+ SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::FACE, aName + "_Faces");
+ aGroup->Add(aFaces.inout());
+ }
+ if (aVolumes->length() > 0) {
+ SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::VOLUME, aName + "_Volumes");
+ aGroup->Add(aVolumes.inout());
+ }
+ updateObjBrowser();
+
+ }
catch(const SALOME::SALOME_Exception & S_ex){
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- }
- }
- }
- }
+ SalomeApp_Tools::QtCatchCorbaException(S_ex);
+ }
+ }
+ }
+ }
}
else if(nbSel==0) {
SUIT_MessageBox::warning(desktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_NO_AVAILABLE_DATA"));
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_NO_AVAILABLE_DATA"));
}
break;
}
if ( !vtkwnd )
{
SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
- tr( "NOT_A_VTK_VIEWER" ) );
+ tr( "NOT_A_VTK_VIEWER" ) );
break;
}
SMESH::SMESH_GroupBase_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(It.Value());
if (!aGroup->_is_nil()) {
- nbSelectedGroups++;
+ nbSelectedGroups++;
SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aGroup);
aDlg->show();
- }
+ }
}
if (nbSelectedGroups == 0)
- {
- SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, SMESH::SMESH_GroupBase::_nil());
- aDlg->show();
- }
+ {
+ SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, SMESH::SMESH_GroupBase::_nil());
+ aDlg->show();
+ }
break;
}
{
if(checkLock(aStudy)) break;
if (myState == 800) {
- SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
- if (aDlg) aDlg->onAdd();
+ SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
+ if (aDlg) aDlg->onAdd();
}
break;
}
{
if(checkLock(aStudy)) break;
if (myState == 800) {
- SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
- if (aDlg) aDlg->onRemove();
+ SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
+ if (aDlg) aDlg->onRemove();
}
break;
}
if ( !vtkwnd )
{
SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
- tr( "NOT_A_VTK_VIEWER" ) );
+ tr( "NOT_A_VTK_VIEWER" ) );
break;
}
if (!aGroup->_is_nil()) {
SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aGroup, true );
aDlg->show();
- }
+ }
}
break;
}
if ( !vtkwnd )
{
SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
- tr( "NOT_A_VTK_VIEWER" ) );
+ tr( "NOT_A_VTK_VIEWER" ) );
break;
}
if ( !vtkwnd )
{
SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
- tr( "NOT_A_VTK_VIEWER" ) );
+ tr( "NOT_A_VTK_VIEWER" ) );
break;
}
break;
}
- case 900: // MESH INFOS
+ case 900: // MESH INFOS
{
EmitSignalDeactivateDialog();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO IOs;
SALOME_ListIteratorOfListIO It (selected);
for ( ; It.More(); It.Next() ) {
- IOs.Clear(); IOs.Append( It.Value() );
- aSel->setSelectedObjects( IOs );
+ IOs.Clear(); IOs.Append( It.Value() );
+ aSel->setSelectedObjects( IOs );
( new SMESHGUI_MeshInfosDlg( this ) )->show();
}
// restore selection
break;
}
- case 902: // STANDARD MESH INFOS
+ case 902: // STANDARD MESH INFOS
{
EmitSignalDeactivateDialog();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO IOs;
SALOME_ListIteratorOfListIO It (selected);
for ( ; It.More(); It.Next() ) {
- IOs.Clear();
- IOs.Append( It.Value() );
- aSel->setSelectedObjects( IOs );
+ IOs.Clear();
+ IOs.Append( It.Value() );
+ aSel->setSelectedObjects( IOs );
( new SMESHGUI_StandardMeshInfosDlg( this ) )->show();
}
// restore selection
- aSel->setSelectedObjects( selected );
+ aSel->setSelectedObjects( selected );
}
else
( new SMESHGUI_StandardMeshInfosDlg( this ) )->show();
break;
}
- case 903: // WHAT IS
+ case 903: // WHAT IS
{
EmitSignalDeactivateDialog();
( new SMESHGUI_WhatIsDlg( this ) )->show();
break;
}
- case 1100: // EDIT HYPOTHESIS
+ case 1100: // EDIT HYPOTHESIS
{
if(checkLock(aStudy)) break;
if (nbSel == 1) {
Handle(SALOME_InteractiveObject) anIObject = selected.First();
- SMESH::SMESH_Hypothesis_var aHypothesis = SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(anIObject);
+ SMESH::SMESH_Hypothesis_var aHypothesis = SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(anIObject);
/* Look for all mesh objects that have this hypothesis affected in order to flag as ModifiedMesh */
/* At end below '...->updateObjBrowser(true)' will change icon of mesh objects */
break;
}
- case 1101: // RENAME
+ case 1101: // RENAME
{
if ( checkLock( aStudy ) )
break;
{
SMESHGUI::GetSMESHGen()->SetName(obj->GetIOR().c_str(), newName.toLatin1().data());
- // update name of group object and its actor
- SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
- if( !aGroupObject->_is_nil() )
- {
- aGroupObject->SetName( newName.toLatin1().data() );
- if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( IObject->getEntry() ) )
- anActor->setName( newName.toLatin1().data() );
- }
+ // update name of group object and its actor
+ SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
+ if( !aGroupObject->_is_nil() )
+ {
+ aGroupObject->SetName( newName.toLatin1().data() );
+ if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( IObject->getEntry() ) )
+ anActor->setName( newName.toLatin1().data() );
+ }
updateObjBrowser();
}
if (!isAny) {
SUIT_MessageBox::warning(desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_WRN_NO_APPROPRIATE_SELECTION"));
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_WRN_NO_APPROPRIATE_SELECTION"));
}
break;
}
- case 1102: // REMOVE HYPOTHESIS / ALGORITHMS
+ case 1102: // REMOVE HYPOTHESIS / ALGORITHMS
{
if(checkLock(aStudy)) break;
SUIT_OverrideCursor wc;
SALOME_ListIteratorOfListIO It(selected);
for (int i = 0; It.More(); It.Next(), i++) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
}
SALOME_ListIO l1;
aSel->setSelectedObjects( l1 );
break;
}
- case 4009: // ELEM0D
- case 4010: // GEOM::EDGE
- case 4021: // TRIANGLE
- case 4022: // QUAD
- case 4023: // POLYGON
- case 4031: // TETRA
- case 4032: // HEXA
+ case 4009: // ELEM0D
+ case 4010: // GEOM::EDGE
+ case 4021: // TRIANGLE
+ case 4022: // QUAD
+ case 4023: // POLYGON
+ case 4031: // TETRA
+ case 4032: // HEXA
{
if(checkLock(aStudy)) break;
if ( vtkwnd ) {
- EmitSignalDeactivateDialog();
+ EmitSignalDeactivateDialog();
SMDSAbs_ElementType type = SMDSAbs_Edge;
int nbNodes = 2;
switch (theCommandID) {
type = SMDSAbs_Face; nbNodes = 4; break;
case 4031: // TETRA
type = SMDSAbs_Volume; nbNodes = 4; break;
- case 4023: // POLYGON
- type = SMDSAbs_Face; nbNodes = 5; break; // 5 - identificator for POLYGON
+ case 4023: // POLYGON
+ type = SMDSAbs_Face; nbNodes = 5; break; // 5 - identificator for POLYGON
case 4032: // HEXA
type = SMDSAbs_Volume; nbNodes = 8; break;
- case 4033: // POLYHEDRE
- type = SMDSAbs_Volume; nbNodes = 9; break; // 9 - identificator for POLYHEDRE
+ case 4033: // POLYHEDRE
+ type = SMDSAbs_Volume; nbNodes = 9; break; // 9 - identificator for POLYHEDRE
default:;
}
- ( new SMESHGUI_AddMeshElementDlg( this, type, nbNodes ) )->show();
+ ( new SMESHGUI_AddMeshElementDlg( this, type, nbNodes ) )->show();
}
else {
- SUIT_MessageBox::warning(desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
- case 4033: // POLYHEDRON
+ case 4033: // POLYHEDRON
{
if(checkLock(aStudy)) break;
if ( vtkwnd ) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_CreatePolyhedralVolumeDlg( this ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_CreatePolyhedralVolumeDlg( this ) )->show();
}
else {
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
{
if(checkLock(aStudy)) break;
if ( vtkwnd ) {
- EmitSignalDeactivateDialog();
- int type;
-
- switch (theCommandID) {
- case 4034:
- type = QUAD_EDGE; break;
- case 4035:
- type = QUAD_TRIANGLE; break;
- case 4036:
- type = QUAD_QUADRANGLE; break;
- case 4037:
- type = QUAD_TETRAHEDRON; break;
- case 4038:
- type = QUAD_PYRAMID; break;
- case 4039:
- type = QUAD_PENTAHEDRON; break;
- case 4040:
- type = QUAD_HEXAHEDRON;
- break;
- default:;
- }
- ( new SMESHGUI_AddQuadraticElementDlg( this, type ) )->show();
+ EmitSignalDeactivateDialog();
+ int type;
+
+ switch (theCommandID) {
+ case 4034:
+ type = QUAD_EDGE; break;
+ case 4035:
+ type = QUAD_TRIANGLE; break;
+ case 4036:
+ type = QUAD_QUADRANGLE; break;
+ case 4037:
+ type = QUAD_TETRAHEDRON; break;
+ case 4038:
+ type = QUAD_PYRAMID; break;
+ case 4039:
+ type = QUAD_PENTAHEDRON; break;
+ case 4040:
+ type = QUAD_HEXAHEDRON;
+ break;
+ default:;
+ }
+ ( new SMESHGUI_AddQuadraticElementDlg( this, type ) )->show();
}
else {
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
- case 4041: // REMOVES NODES
+ case 4041: // REMOVES NODES
{
if(checkLock(aStudy)) break;
if ( vtkwnd ) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_RemoveNodesDlg( this ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_RemoveNodesDlg( this ) )->show();
}
else {
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
- case 4042: // REMOVES ELEMENTS
+ case 4042: // REMOVES ELEMENTS
{
if(checkLock(aStudy)) break;
if( vtkwnd ) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_RemoveElementsDlg( this ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_RemoveElementsDlg( this ) )->show();
}
else
- {
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
- }
+ {
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ }
break;
}
case 4043: { // CLEAR_MESH
}
}
catch (const SALOME::SALOME_Exception& S_ex){
- wc.suspend();
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- wc.resume();
+ wc.suspend();
+ SalomeApp_Tools::QtCatchCorbaException(S_ex);
+ wc.resume();
}
}
SMESH::UpdateView();
updateObjBrowser();
break;
}
- case 4051: // RENUMBERING NODES
+ case 4051: // RENUMBERING NODES
{
if(checkLock(aStudy)) break;
if( vtkwnd ) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_RenumberingDlg( this, 0 ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_RenumberingDlg( this, 0 ) )->show();
}
else
- {
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
- }
+ {
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ }
break;
}
- case 4052: // RENUMBERING ELEMENTS
+ case 4052: // RENUMBERING ELEMENTS
{
if(checkLock(aStudy)) break;
if ( vtkwnd ) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_RenumberingDlg( this, 1 ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_RenumberingDlg( this, 1 ) )->show();
}
else
- {
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
- }
+ {
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ }
break;
}
case 4061: // TRANSLATION
{
if(checkLock(aStudy)) break;
if ( vtkwnd ) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_TranslationDlg( this ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_TranslationDlg( this ) )->show();
}
else {
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
{
if(checkLock(aStudy)) break;
if( vtkwnd ) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_RotationDlg( this ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_RotationDlg( this ) )->show();
}
else {
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
{
if(checkLock(aStudy)) break;
if(vtkwnd) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_SymmetryDlg( this ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_SymmetryDlg( this ) )->show();
}
else {
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
{
if(checkLock(aStudy)) break;
if(vtkwnd) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_SewingDlg( this ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_SewingDlg( this ) )->show();
}
else {
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
{
if(checkLock(aStudy)) break;
if(vtkwnd) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_EditMeshDlg( this, 0 ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_EditMeshDlg( this, 0 ) )->show();
}
else {
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
{
if (checkLock(aStudy)) break;
if (vtkwnd) {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_EditMeshDlg( this, 1 ) )->show();
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_EditMeshDlg( this, 1 ) )->show();
} else {
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
}
break;
}
}
break;
- case 6017: // CONTROLS
+ case 6017: // CONTROLS
case 6016:
case 6015:
case 6014:
SALOME_ListIO selected; mgr->selectedObjects( selected );
if ( selected.Extent() == 1 && selected.First()->hasEntry() ) {
- _PTR(SObject) SO = aStudy->FindObjectID( selected.First()->getEntry() );
- if ( SO ) {
- CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
- SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aObject );
- if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
- ::Control( theCommandID );
- break;
- }
- }
+ _PTR(SObject) SO = aStudy->FindObjectID( selected.First()->getEntry() );
+ if ( SO ) {
+ CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
+ SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aObject );
+ if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
+ ::Control( theCommandID );
+ break;
+ }
+ }
}
SUIT_MessageBox::warning(desktop(),
- tr( "SMESH_WRN_WARNING" ),
- tr( "SMESH_BAD_SELECTION" ) );
+ tr( "SMESH_WRN_WARNING" ),
+ tr( "SMESH_BAD_SELECTION" ) );
break;
}
else {
SUIT_MessageBox::warning(desktop(),
- tr( "SMESH_WRN_WARNING" ),
- tr( "NOT_A_VTK_VIEWER" ) );
+ tr( "SMESH_WRN_WARNING" ),
+ tr( "NOT_A_VTK_VIEWER" ) );
}
break;
case 9010:
SALOME_ListIteratorOfListIO it(selected);
for( ; it.More(); it.Next()) {
Handle(SALOME_InteractiveObject) anIObject = it.Value();
- if(anIObject->hasEntry()) {
- if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
- anActor->SetPointsLabeled( !anActor->GetPointsLabeled() );
- }
- }
+ if(anIObject->hasEntry()) {
+ if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
+ anActor->SetPointsLabeled( !anActor->GetPointsLabeled() );
+ }
+ }
}
break;
}
LightApp_SelectionMgr* mgr = selectionMgr();
SALOME_ListIO selected; mgr->selectedObjects( selected );
- if (selected.Extent() == 1) {
- Handle(SALOME_InteractiveObject) anIObject = selected.First();
- if(anIObject->hasEntry())
- if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
- anActor->SetCellsLabeled( !anActor->GetCellsLabeled() );
- }
+ if (selected.Extent() == 1) {
+ Handle(SALOME_InteractiveObject) anIObject = selected.First();
+ if(anIObject->hasEntry())
+ if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
+ anActor->SetCellsLabeled( !anActor->GetCellsLabeled() );
+ }
}
break;
}
const QString& clients,
const QString& types,
const QString& theRule,
- const int pId )
+ const int pId )
{
int parentId = pId;
if( pId!=-1 )
createSMESHAction( 415, "MAP", "ICON_MAP" );
createSMESHAction( 416, "EXTRUSION_ALONG", "ICON_EXTRUSION_ALONG" );
createSMESHAction( 417, "CONV_TO_QUAD", "ICON_CONV_TO_QUAD" );
+ createSMESHAction( 418, "2D_FROM_3D", "ICON_2D_FROM_3D" );
createSMESHAction( 200, "RESET" );
createSMESHAction( 201, "SCALAR_BAR_PROP" );
createSMESHAction( 211, "WIRE", "ICON_WIRE", 0, true );
createMenu( 414, modifyId, -1 );
createMenu( 415, modifyId, -1 );
createMenu( 417, modifyId, -1 );
+ createMenu( 418, modifyId, -1 );
createMenu( 214, viewId, -1 );
createTool( 414, modifyTb );
createTool( 415, modifyTb );
createTool( 417, modifyTb );
+ createTool( 418, modifyTb );
createTool( 214, dispModeTb );
myRules.clear();
QString OB = "'ObjectBrowser'",
- View = "'" + SVTK_Viewer::Type() + "'",
- pat = "'%1'",
- mesh = pat.arg( SMESHGUI_Selection::typeName( MESH ) ),
- group = pat.arg( SMESHGUI_Selection::typeName( GROUP ) ),
- hypo = pat.arg( SMESHGUI_Selection::typeName( HYPOTHESIS ) ),
- algo = pat.arg( SMESHGUI_Selection::typeName( ALGORITHM ) ),
- elems = QString( "'%1' '%2' '%3' '%4' '%5' '%6'" ).
+ View = "'" + SVTK_Viewer::Type() + "'",
+ pat = "'%1'",
+ mesh = pat.arg( SMESHGUI_Selection::typeName( MESH ) ),
+ group = pat.arg( SMESHGUI_Selection::typeName( GROUP ) ),
+ hypo = pat.arg( SMESHGUI_Selection::typeName( HYPOTHESIS ) ),
+ algo = pat.arg( SMESHGUI_Selection::typeName( ALGORITHM ) ),
+ elems = QString( "'%1' '%2' '%3' '%4' '%5' '%6'" ).
arg( SMESHGUI_Selection::typeName( SUBMESH_VERTEX ) ).
- arg( SMESHGUI_Selection::typeName( SUBMESH_EDGE ) ).
- arg( SMESHGUI_Selection::typeName( SUBMESH_FACE ) ).
- arg( SMESHGUI_Selection::typeName( SUBMESH_SOLID ) ).
- arg( SMESHGUI_Selection::typeName( SUBMESH_COMPOUND ) ).
- arg( SMESHGUI_Selection::typeName( SUBMESH ) ),
+ arg( SMESHGUI_Selection::typeName( SUBMESH_EDGE ) ).
+ arg( SMESHGUI_Selection::typeName( SUBMESH_FACE ) ).
+ arg( SMESHGUI_Selection::typeName( SUBMESH_SOLID ) ).
+ arg( SMESHGUI_Selection::typeName( SUBMESH_COMPOUND ) ).
+ arg( SMESHGUI_Selection::typeName( SUBMESH ) ),
subMesh = elems,
- mesh_group = mesh + " " + subMesh + " " + group,
- hyp_alg = hypo + " " + algo;
+ mesh_group = mesh + " " + subMesh + " " + group,
+ hyp_alg = hypo + " " + algo;
// popup for object browser
+ QString
+ isInvisible("not( isVisible )"),
+ isEmpty("numberOfNodes = 0"),
+ isNotEmpty("numberOfNodes <> 0"),
+
+ // has nodes, edges, etc in VISIBLE! actor
+ hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"),
+ hasElems("(count( elemTypes ) > 0)"),
+ hasDifferentElems("(count( elemTypes ) > 1)"),
+ hasElems0d("({'Elem0d'} in elemTypes)"),
+ hasEdges("({'Edge'} in elemTypes)"),
+ hasFaces("({'Face'} in elemTypes)"),
+ hasVolumes("({'Volume'} in elemTypes)");
createPopupItem( 150, OB, mesh, "&& selcount=1 && isImported" ); // FILE INFORMATION
createPopupItem( 703, OB, mesh, "&& isComputable"); // CREATE_SUBMESH
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 4043, OB, mesh ); // CLEAR_MESH
popupMgr()->insert( separator(), -1, 0 );
+ createPopupItem( 417, OB, mesh/*, "&& " + hasElems*/); // convert to quadratic
+ createPopupItem( 418, OB, mesh/*, "&& " + hasVolumes*/); // create 2D mesh on 3D
+ popupMgr()->insert( separator(), -1, 0 );
QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc );
popupMgr()->insert( separator(), -1, 0 );
int anId;
- QString
- isInvisible("not( isVisible )"),
- isEmpty("numberOfNodes = 0"),
- isNotEmpty("numberOfNodes <> 0"),
-
- // has nodes, edges, etc in VISIBLE! actor
- hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"),
- hasElems("(count( elemTypes ) > 0)"),
- hasDifferentElems("(count( elemTypes ) > 1)"),
- hasElems0d("({'Elem0d'} in elemTypes)"),
- hasEdges("({'Edge'} in elemTypes)"),
- hasFaces("({'Face'} in elemTypes)"),
- hasVolumes("({'Volume'} in elemTypes)");
-
QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" );
QString aType = QString( "%1type in {%2}" ).arg( lc );
aType = aType.arg( mesh_group );
popupMgr()->insert( separator(), -1, -1 );
connect( application(), SIGNAL( viewManagerActivated( SUIT_ViewManager* ) ),
- this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
+ this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
}
//================================================================================
if ( obj ) {
QString aName = QString( obj->GetName().c_str() );
while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup
- aName.remove( (aName.length() - 1), 1 );
+ aName.remove( (aName.length() - 1), 1 );
title = aName;
}
}
if( name=="selection_object_color" || name=="selection_element_color" ||
name=="selection_width" || name=="highlight_color" || name=="highlight_width" ||
name=="selection_precision_node" || name=="selection_precision_element" ||
- name=="selection_precision_object")
+ name=="selection_precision_object")
SMESH::UpdateSelectionProp( this );
else if (name == QString("scalar_bar_vertical_x") || name == QString("scalar_bar_vertical_width")){
sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_x", sbX1);
sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_width", sbW);
if(sbX1+sbW > aTol){
- aWarning = "Origin and Size Vertical: X+Width > 1\n";
- sbX1=0.01;
- sbW=0.08;
- aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1);
- aResourceMgr->setValue("SMESH", "scalar_bar_vertical_width", sbW);
+ aWarning = "Origin and Size Vertical: X+Width > 1\n";
+ sbX1=0.01;
+ sbW=0.08;
+ aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1);
+ aResourceMgr->setValue("SMESH", "scalar_bar_vertical_width", sbW);
}
}
else if(name == QString("scalar_bar_vertical_y") || name == QString("scalar_bar_vertical_height")){
sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_y", sbY1);
sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_height",sbH);
if(sbY1+sbH > aTol){
- aWarning = "Origin and Size Vertical: Y+Height > 1\n";
- aResourceMgr->setValue("SMESH", "scalar_bar_vertical_y", sbY1);
- aResourceMgr->setValue("SMESH", "scalar_bar_vertical_height",sbH);
+ aWarning = "Origin and Size Vertical: Y+Height > 1\n";
+ aResourceMgr->setValue("SMESH", "scalar_bar_vertical_y", sbY1);
+ aResourceMgr->setValue("SMESH", "scalar_bar_vertical_height",sbH);
}
}
else if(name == QString("scalar_bar_horizontal_x") || name == QString("scalar_bar_horizontal_width")){
sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_x", sbX1);
sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_width", sbW);
if(sbX1+sbW > aTol){
- aWarning = "Origin and Size Horizontal: X+Width > 1\n";
- sbX1=0.1;
- sbW=0.08;
- aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_x", sbX1);
- aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_width", sbW);
+ aWarning = "Origin and Size Horizontal: X+Width > 1\n";
+ sbX1=0.1;
+ sbW=0.08;
+ aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_x", sbX1);
+ aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_width", sbW);
}
}
else if(name == QString("scalar_bar_horizontal_y") || name == QString("scalar_bar_horizontal_height")){
sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_y", sbY1);
sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_height",sbH);
if(sbY1+sbH > aTol){
- aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
- sbY1=0.01;
- sbH=0.08;
- aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_y", sbY1);
- aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH);
+ aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
+ sbY1=0.01;
+ sbH=0.08;
+ aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_y", sbY1);
+ aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH);
}
}
else if ( name == "segmentation" ) {
if(aWarning.size() != 0){
aWarning += "The default values are applied instead.";
SUIT_MessageBox::warning(SMESHGUI::desktop(),
- QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"),
- QObject::tr(aWarning.c_str()));
+ QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"),
+ QObject::tr(aWarning.c_str()));
}
}
}
case 417: //convert to quadratic
op = new SMESHGUI_ConvToQuadOp();
break;
+ case 418: // create 2D mesh as boundary on 3D
+ op = new SMESHGUI_Make2DFrom3DOp();
+ break;
case 4067: // make mesh pass through point
op = new SMESHGUI_MakeNodeAtPointOp();
break;
{
aTolerance /= 2;
if( aTolerance < 1 )
- break;
+ break;
}
//cout << "Iteration N" << anIterations << " (tolerance=" << aTolerance << ")"<< endl;
//cout << h << " ";
if( abs( h - aHue ) < aTolerance )
{
- ok = false;
- //cout << "break (diff = " << abs( h - aHue ) << ")";
- break;
+ ok = false;
+ //cout << "break (diff = " << abs( h - aHue ) << ")";
+ break;
}
}
//cout << endl;
QVector<SUIT_ViewWindow*> views = vman->getViews();
for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++)
{
- if (SVTK_ViewWindow* vtkView = dynamic_cast<SVTK_ViewWindow*>(views[i]))
+ if (SVTK_ViewWindow* vtkView = dynamic_cast<SVTK_ViewWindow*>(views[i]))
{
- VTK::ActorCollectionCopy aCopy(vtkView->getRenderer()->GetActors());
- vtkActorCollection* allActors = aCopy.GetActors();
- allActors->InitTraversal();
- while (vtkActor* actor = allActors->GetNextActor())
+ VTK::ActorCollectionCopy aCopy(vtkView->getRenderer()->GetActors());
+ vtkActorCollection* allActors = aCopy.GetActors();
+ allActors->InitTraversal();
+ while (vtkActor* actor = allActors->GetNextActor())
{
- if (actor->GetVisibility()) // store only visible actors
+ if (actor->GetVisibility()) // store only visible actors
{
SMESH_Actor* aSmeshActor = 0;
if (actor->IsA("SMESH_Actor"))
aSmeshActor = SMESH_Actor::SafeDownCast(actor);
- if (aSmeshActor && aSmeshActor->hasIO())
+ if (aSmeshActor && aSmeshActor->hasIO())
{
Handle(SALOME_InteractiveObject) io = aSmeshActor->getIO();
if (io->hasEntry())
ip->setParameter(entry, param + QString::number(ipl+1).toLatin1().data(), planeValue);
}
} // if (io->hasEntry())
- } // SMESH_Actor && hasIO
- } // isVisible
- } // while.. actors traversal
- } // if (vtkView)
+ } // SMESH_Actor && hasIO
+ } // isVisible
+ } // while.. actors traversal
+ } // if (vtkView)
} // for (views)
vtkViewers++;
} // if (SVTK view model)
bool ok;
int viewIndex = viewIndexStr.toUInt(&ok);
if (!ok) // bad conversion of view index to integer
- continue;
+ continue;
// viewers
if (viewerTypStr == SVTK_Viewer::Type())
// access later when restoring other parameters
SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
vtkRenderer* Renderer = vtkView->getRenderer();
- VTK::ActorCollectionCopy aCopy(Renderer->GetActors());
+ VTK::ActorCollectionCopy aCopy(Renderer->GetActors());
vtkActorCollection* theActors = aCopy.GetActors();
theActors->InitTraversal();
bool isFound = false;
}
}
} // if (paramNameStr == "Visibility")
- else
+ else
{
// the rest properties "work" with SMESH_Actor
- if (aSmeshActor)
+ if (aSmeshActor)
{
QString val ((*valuesIt).c_str());
}
}
} // if (aSmeshActor)
- } // other parameters than Visibility
+ } // other parameters than Visibility
}
} // for names/parameters iterator
} // for entries iterator
static SUIT_ResourceMgr* resourceMgr();
static SUIT_Desktop* desktop();
static SalomeApp_Study* activeStudy();
- static char* JoinObjectParameters(const QStringList& theParametersList);
bool isActiveStudyLocked();
void EmitSignalDeactivateDialog();
void EmitSignalStudyFrameChanged();
void EmitSignalCloseAllDialogs();
+ void EmitSignalVisibilityChanged();
virtual void contextMenuPopup( const QString&, QMenu*, QString& );
virtual void createPreferences();
void SignalDeactivateActiveDialog();
void SignalStudyFrameChanged();
void SignalCloseAllDialogs();
+ void SignalVisibilityChanged();
protected:
void createSMESHAction( const int,
vtkIdList *anIds = vtkIdList::New();
if(aConn)
- for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
- anIds->InsertId(i,theIds[aConn[i]]);
+ for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
+ anIds->InsertId(i,theIds[aConn[i]]);
else
- for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
- anIds->InsertId(i,theIds[i]);
+ for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
+ anIds->InsertId(i,theIds[i]);
myGrid->InsertNextCell(theType,anIds);
anIds->Delete();
~TElementSimulation()
{
if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
- myVTKViewWindow->RemoveActor(myPreviewActor);
- myVTKViewWindow->RemoveActor(myFaceOrientation);
+ myVTKViewWindow->RemoveActor(myPreviewActor);
+ myVTKViewWindow->RemoveActor(myFaceOrientation);
}
myPreviewActor->Delete();
myFaceOrientation->Delete();
//=================================================================================
SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
SMDSAbs_ElementType ElementType,
- int nbNodes )
+ int nbNodes )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
aMeshEditor->AddEdge(anArrayOfIndices.inout()); break;
case SMDSAbs_Face: {
if(myIsPoly)
- aMeshEditor->AddPolygonalFace(anArrayOfIndices.inout());
+ aMeshEditor->AddPolygonalFace(anArrayOfIndices.inout());
else
- aMeshEditor->AddFace(anArrayOfIndices.inout());
+ aMeshEditor->AddFace(anArrayOfIndices.inout());
break;
}
case SMDSAbs_Volume:
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
bool allOk = true;
for (int i = 0; i < aListId.count(); i++) {
if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
- {
- newIndices.Add( n->GetID() );
- myNbOkNodes++;
- }
+ {
+ newIndices.Add( n->GetID() );
+ myNbOkNodes++;
+ }
else
- allOk = false;
+ allOk = false;
}
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
if (myIsPoly)
{
- if ( !allOk || myElementType != SMDSAbs_Face || aListId.count() < 3 )
- myNbOkNodes = 0;
- else
- myNbOkNodes = aListId.count();
+ if ( !allOk || myElementType != SMDSAbs_Face || aListId.count() < 3 )
+ myNbOkNodes = 0;
+ else
+ myNbOkNodes = aListId.count();
}
}
void SetPosition (SMESH_Actor* theActor,
const int theType,
TVTKIds& theIds,
- const int theMode,
+ const int theMode,
const bool theReverse)
{
vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
~TElementSimulation()
{
if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
- myVTKViewWindow->RemoveActor(myPreviewActor);
- myVTKViewWindow->RemoveActor(myFaceOrientation);
+ myVTKViewWindow->RemoveActor(myPreviewActor);
+ myVTKViewWindow->RemoveActor(myFaceOrientation);
}
myPreviewActor->Delete();
myFaceOrientation->Delete();
// purpose : constructor
//=================================================================================
SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theModule,
- const int theType )
+ const int theType )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
for (int i = 0; i < aListId.count(); i++) {
if ( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
{
- newIndices.Add( n->GetID() );
+ newIndices.Add( n->GetID() );
}
else
{
- allOk = false;
- break;
+ allOk = false;
+ break;
}
}
else
{
for ( int row = 0; row < myNbCorners; row++ )
- anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(row, 0)->text().toInt() ) );
+ anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(row, 0)->text().toInt() ) );
for ( int row = 0; row < myTable->rowCount(); row++ )
{
- anID = myTable->item(row, 1)->text().toInt(&ok);
- if (!ok) {
- anID = myTable->item(row, 0)->text().toInt();
- aDisplayMode = VTK_WIREFRAME;
- }
- anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) );
+ anID = myTable->item(row, 1)->text().toInt(&ok);
+ if (!ok) {
+ anID = myTable->item(row, 0)->text().toInt();
+ aDisplayMode = VTK_WIREFRAME;
+ }
+ anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) );
}
}
// clear table
for ( int row = 0; row < myTable->rowCount(); row++ )
for ( int col = 0; col < myTable->columnCount(); col++ )
- if ( QTableWidgetItem* aTWI = myTable->item(row, col) ) aTWI->setText("");
+ if ( QTableWidgetItem* aTWI = myTable->item(row, col) ) aTWI->setText("");
myTable->setEnabled( false );
}
if (!isValid())
return false;
+ SMESH::SMESH_Mesh_var aCompoundMesh;
+
if (!myMesh->_is_nil()) {
QStringList aParameters;
aParameters << (CheckBoxMerge->isChecked() ? SpinBoxTol->text() : QString(" "));
- try {
+ try {
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
// concatenate meshes
- SMESH::SMESH_Mesh_var aCompoundMesh;
if(CheckBoxCommon->isChecked())
- aCompoundMesh = aSMESHGen->ConcatenateWithGroups(myMeshArray,
- !(ComboBoxUnion->currentIndex()),
- CheckBoxMerge->isChecked(),
- SpinBoxTol->GetValue());
+ aCompoundMesh = aSMESHGen->ConcatenateWithGroups(myMeshArray,
+ !(ComboBoxUnion->currentIndex()),
+ CheckBoxMerge->isChecked(),
+ SpinBoxTol->GetValue());
else
- aCompoundMesh = aSMESHGen->Concatenate(myMeshArray,
- !(ComboBoxUnion->currentIndex()),
- CheckBoxMerge->isChecked(),
- SpinBoxTol->GetValue());
+ aCompoundMesh = aSMESHGen->Concatenate(myMeshArray,
+ !(ComboBoxUnion->currentIndex()),
+ CheckBoxMerge->isChecked(),
+ SpinBoxTol->GetValue());
- aCompoundMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
+ aCompoundMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() );
mySMESHGUI->updateObjBrowser();
LineEditName->setText(GetDefaultName(tr("COMPOUND_MESH")));
- //mySelectionMgr->clearSelected();
- SMESH::UpdateView();
+ // IPAL21468 Compound is hidden after creation.
+ if ( SMESHGUI::automaticUpdate() ) {
+ mySelectionMgr->clearSelected();
+ SMESH::UpdateView();
+
+ _PTR(SObject) aSO = SMESH::FindSObject(aCompoundMesh.in());
+ if ( SMESH_Actor* anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str()) )
+ SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
+ }// end IPAL21468
+
return true;
}
return false;
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- "application")).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ "application")).
+ arg(myHelpFileName));
}
}
class OrientedPlane: public vtkPlane
{
- SVTK_ViewWindow* myViewWindow;
+ QPointer<SVTK_ViewWindow> myViewWindow;
vtkDataSetMapper* myMapper;
}
~OrientedPlane(){
- myViewWindow->RemoveActor(myActor);
+ if (myViewWindow)
+ myViewWindow->RemoveActor(myActor);
myActor->Delete();
myMapper->RemoveAllInputs();
vtkFloatingPointType aDel = aDataSet->GetLength()/2.0;
vtkFloatingPointType aDelta[2][3] = {{aDir[0][0]*aDel, aDir[0][1]*aDel, aDir[0][2]*aDel},
- {aDir[1][0]*aDel, aDir[1][1]*aDel, aDir[1][2]*aDel}};
+ {aDir[1][0]*aDel, aDir[1][1]*aDel, aDir[1][2]*aDel}};
vtkFloatingPointType aParam, aPnt0[3], aPnt1[3], aPnt2[3];
vtkFloatingPointType aPnt01[3] = {aPnt[0] - aDelta[0][0] - aDelta[1][0],
- aPnt[1] - aDelta[0][1] - aDelta[1][1],
- aPnt[2] - aDelta[0][2] - aDelta[1][2]};
+ aPnt[1] - aDelta[0][1] - aDelta[1][1],
+ aPnt[2] - aDelta[0][2] - aDelta[1][2]};
vtkFloatingPointType aPnt02[3] = {aPnt01[0] + aNormal[0],
- aPnt01[1] + aNormal[1],
- aPnt01[2] + aNormal[2]};
+ aPnt01[1] + aNormal[1],
+ aPnt01[2] + aNormal[2]};
vtkPlane::IntersectWithLine(aPnt01,aPnt02,aNormal,anOrigin,aParam,aPnt0);
vtkFloatingPointType aPnt11[3] = {aPnt[0] - aDelta[0][0] + aDelta[1][0],
- aPnt[1] - aDelta[0][1] + aDelta[1][1],
- aPnt[2] - aDelta[0][2] + aDelta[1][2]};
+ aPnt[1] - aDelta[0][1] + aDelta[1][1],
+ aPnt[2] - aDelta[0][2] + aDelta[1][2]};
vtkFloatingPointType aPnt12[3] = {aPnt11[0] + aNormal[0],
- aPnt11[1] + aNormal[1],
- aPnt11[2] + aNormal[2]};
+ aPnt11[1] + aNormal[1],
+ aPnt11[2] + aNormal[2]};
vtkPlane::IntersectWithLine(aPnt11,aPnt12,aNormal,anOrigin,aParam,aPnt1);
vtkFloatingPointType aPnt21[3] = {aPnt[0] + aDelta[0][0] - aDelta[1][0],
- aPnt[1] + aDelta[0][1] - aDelta[1][1],
- aPnt[2] + aDelta[0][2] - aDelta[1][2]};
+ aPnt[1] + aDelta[0][1] - aDelta[1][1],
+ aPnt[2] + aDelta[0][2] - aDelta[1][2]};
vtkFloatingPointType aPnt22[3] = {aPnt21[0] + aNormal[0],
- aPnt21[1] + aNormal[1],
- aPnt21[2] + aNormal[2]};
+ aPnt21[1] + aNormal[1],
+ aPnt21[2] + aNormal[2]};
vtkPlane::IntersectWithLine(aPnt21,aPnt22,aNormal,anOrigin,aParam,aPnt2);
vtkPlaneSource* aPlaneSource = aPlane->myPlaneSource;
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
- QString platform;
+ QString platform;
#ifdef WIN32
- platform = "winapplication";
+ platform = "winapplication";
#else
- platform = "application";
+ platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
Handle(SALOME_InteractiveObject) IOS = aList.First();
myActor = SMESH::FindActorByEntry(IOS->getEntry());
if (myActor) {
- std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
- myPlanes.clear();
-
- vtkIdType anId = 0, anEnd = myActor->GetNumberOfClippingPlanes();
- for ( ; anId < anEnd; anId++) {
- if (vtkImplicitFunction* aFunction = myActor->GetClippingPlane(anId)) {
- if(OrientedPlane* aPlane = OrientedPlane::SafeDownCast(aFunction)){
- OrientedPlane* anOrientedPlane = OrientedPlane::New(aViewWindow);
- SMESH::TVTKPlane aTVTKPlane(anOrientedPlane);
- anOrientedPlane->Delete();
- aTVTKPlane->ShallowCopy(aPlane);
- myPlanes.push_back(aTVTKPlane);
- }
- }
- }
-
- std::for_each(myPlanes.begin(),myPlanes.end(),
- TSetVisiblity(PreviewCheckBox->isChecked()));
+ std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
+ myPlanes.clear();
+
+ vtkIdType anId = 0, anEnd = myActor->GetNumberOfClippingPlanes();
+ for ( ; anId < anEnd; anId++) {
+ if (vtkImplicitFunction* aFunction = myActor->GetClippingPlane(anId)) {
+ if(OrientedPlane* aPlane = OrientedPlane::SafeDownCast(aFunction)){
+ OrientedPlane* anOrientedPlane = OrientedPlane::New(aViewWindow);
+ SMESH::TVTKPlane aTVTKPlane(anOrientedPlane);
+ anOrientedPlane->Delete();
+ aTVTKPlane->ShallowCopy(aPlane);
+ myPlanes.push_back(aTVTKPlane);
+ }
+ }
+ }
+
+ std::for_each(myPlanes.begin(),myPlanes.end(),
+ TSetVisiblity(PreviewCheckBox->isChecked()));
}
}
SMESH::RenderViewWindow(aViewWindow);
vtkFloatingPointType aDel = aDataSet->GetLength()/2.0;
vtkFloatingPointType aDelta[2][3] = {{aDir[0][0]*aDel, aDir[0][1]*aDel, aDir[0][2]*aDel},
- {aDir[1][0]*aDel, aDir[1][1]*aDel, aDir[1][2]*aDel}};
+ {aDir[1][0]*aDel, aDir[1][1]*aDel, aDir[1][2]*aDel}};
vtkFloatingPointType aParam, aPnt0[3], aPnt1[3], aPnt2[3];
vtkFloatingPointType aPnt01[3] = {aPnt[0] - aDelta[0][0] - aDelta[1][0],
- aPnt[1] - aDelta[0][1] - aDelta[1][1],
- aPnt[2] - aDelta[0][2] - aDelta[1][2]};
+ aPnt[1] - aDelta[0][1] - aDelta[1][1],
+ aPnt[2] - aDelta[0][2] - aDelta[1][2]};
vtkFloatingPointType aPnt02[3] = {aPnt01[0] + aNormal[0],
- aPnt01[1] + aNormal[1],
- aPnt01[2] + aNormal[2]};
+ aPnt01[1] + aNormal[1],
+ aPnt01[2] + aNormal[2]};
vtkPlane::IntersectWithLine(aPnt01,aPnt02,aNormal,anOrigin,aParam,aPnt0);
vtkFloatingPointType aPnt11[3] = {aPnt[0] - aDelta[0][0] + aDelta[1][0],
- aPnt[1] - aDelta[0][1] + aDelta[1][1],
- aPnt[2] - aDelta[0][2] + aDelta[1][2]};
+ aPnt[1] - aDelta[0][1] + aDelta[1][1],
+ aPnt[2] - aDelta[0][2] + aDelta[1][2]};
vtkFloatingPointType aPnt12[3] = {aPnt11[0] + aNormal[0],
- aPnt11[1] + aNormal[1],
- aPnt11[2] + aNormal[2]};
+ aPnt11[1] + aNormal[1],
+ aPnt11[2] + aNormal[2]};
vtkPlane::IntersectWithLine(aPnt11,aPnt12,aNormal,anOrigin,aParam,aPnt1);
vtkFloatingPointType aPnt21[3] = {aPnt[0] + aDelta[0][0] - aDelta[1][0],
- aPnt[1] + aDelta[0][1] - aDelta[1][1],
- aPnt[2] + aDelta[0][2] - aDelta[1][2]};
+ aPnt[1] + aDelta[0][1] - aDelta[1][1],
+ aPnt[2] + aDelta[0][2] - aDelta[1][2]};
vtkFloatingPointType aPnt22[3] = {aPnt21[0] + aNormal[0],
- aPnt21[1] + aNormal[1],
- aPnt21[2] + aNormal[2]};
+ aPnt21[1] + aNormal[1],
+ aPnt21[2] + aNormal[2]};
vtkPlane::IntersectWithLine(aPnt21,aPnt22,aNormal,anOrigin,aParam,aPnt2);
vtkPlaneSource* aPlaneSource = aPlane->myPlaneSource;
// used in SMESHGUI::restoreVisualParameters() to avoid
// declaration of OrientedPlane outside of SMESHGUI_ClippingDlg.cxx
static void AddPlane (SMESH_Actor* theActor,
- SVTK_ViewWindow* theViewWindow,
- SMESH::Orientation theOrientation,
- double theDistance,
- vtkFloatingPointType theAngle[2]);
+ SVTK_ViewWindow* theViewWindow,
+ SMESH::Orientation theOrientation,
+ double theDistance,
+ vtkFloatingPointType theAngle[2]);
static void GetPlaneParam (SMESH_Actor* theActor,
- int thePlaneIndex,
- SMESH::Orientation& theOrientation,
- double& theDistance,
- vtkFloatingPointType* theAngle);
+ int thePlaneIndex,
+ SMESH::Orientation& theOrientation,
+ double& theDistance,
+ vtkFloatingPointType* theAngle);
protected:
void keyPressEvent( QKeyEvent* );
int nbSel = selected.Extent();
if (nbSel != 1) {
SUIT_MessageBox::warning(desktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_NO_AVAILABLE_DATA"));
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_NO_AVAILABLE_DATA"));
onCancel();
return;
}
myMesh = SMESH::GetMeshByIO(myIObject);
if (myMesh->_is_nil()) {
SUIT_MessageBox::warning(desktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_NO_AVAILABLE_DATA"));
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_NO_AVAILABLE_DATA"));
onCancel();
return;
}
LightApp_SelectionMgr *Sel = selectionMgr();
if ( Sel )
{
- SALOME_ListIO selected;
- selected.Append( myIObject );
- Sel->setSelectedObjects( selected );
+ SALOME_ListIO selected;
+ selected.Append( myIObject );
+ Sel->setSelectedObjects( selected );
}
}
}
}
void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack,
- const bool theNoCompError,
- SMESH::compute_error_array_var& theCompErrors,
- const bool theNoHypoError,
- const QString& theHypErrors )
+ const bool theNoCompError,
+ SMESH::compute_error_array_var& theCompErrors,
+ const bool theNoHypoError,
+ const QString& theHypErrors )
{
bool hasShape = myMesh->HasShapeToMesh();
SMESHGUI_ComputeDlg* aCompDlg = computeDlg();
{
SMESH::ComputeError & err = theCompErrors[ row ];
- QString text = err.algoName.in();
- if ( !tbl->item( row, COL_ALGO ) ) tbl->setItem( row, COL_ALGO, new QTableWidgetItem( text ) );
- else tbl->item( row, COL_ALGO )->setText( text );
+ QString text = err.algoName.in();
+ if ( !tbl->item( row, COL_ALGO ) ) tbl->setItem( row, COL_ALGO, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_ALGO )->setText( text );
- text = SMESH::errorText( err.code, err.comment.in() );
- if ( !tbl->item( row, COL_ERROR ) ) tbl->setItem( row, COL_ERROR, new QTableWidgetItem( text ) );
- else tbl->item( row, COL_ERROR )->setText( text );
+ text = SMESH::errorText( err.code, err.comment.in() );
+ if ( !tbl->item( row, COL_ERROR ) ) tbl->setItem( row, COL_ERROR, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_ERROR )->setText( text );
- text = QString("%1").arg( err.subShapeID );
- if ( !tbl->item( row, COL_SHAPEID ) ) tbl->setItem( row, COL_SHAPEID, new QTableWidgetItem( text ) );
- else tbl->item( row, COL_SHAPEID )->setText( text );
+ text = QString("%1").arg( err.subShapeID );
+ if ( !tbl->item( row, COL_SHAPEID ) ) tbl->setItem( row, COL_SHAPEID, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_SHAPEID )->setText( text );
text = hasShape ? SMESH::shapeText( err.subShapeID, myMainShape ) : QString("");
- if ( !tbl->item( row, COL_SHAPE ) ) tbl->setItem( row, COL_SHAPE, new QTableWidgetItem( text ) );
- else tbl->item( row, COL_SHAPE )->setText( text );
+ if ( !tbl->item( row, COL_SHAPE ) ) tbl->setItem( row, COL_SHAPE, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_SHAPE )->setText( text );
text = ( !hasShape || SMESH::getSubShapeSO( err.subShapeID, myMainShape )) ? "PUBLISHED" : "";
- if ( !tbl->item( row, COL_PUBLISHED ) ) tbl->setItem( row, COL_PUBLISHED, new QTableWidgetItem( text ) );
- else tbl->item( row, COL_PUBLISHED )->setText( text ); // if text=="", "PUBLISH" button enabled
+ if ( !tbl->item( row, COL_PUBLISHED ) ) tbl->setItem( row, COL_PUBLISHED, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_PUBLISHED )->setText( text ); // if text=="", "PUBLISH" button enabled
text = err.hasBadMesh ? "hasBadMesh" : "";
- if ( !tbl->item( row, COL_BAD_MESH ) ) tbl->setItem( row, COL_BAD_MESH, new QTableWidgetItem( text ) );
- else tbl->item( row, COL_BAD_MESH )->setText( text );
+ if ( !tbl->item( row, COL_BAD_MESH ) ) tbl->setItem( row, COL_BAD_MESH, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_BAD_MESH )->setText( text );
if ( err.hasBadMesh ) hasBadMesh = true;
//tbl->item( row, COL_ERROR )->setWordWrap( true ); // VSR: TODO ???
void SMESHGUI_ComputeOp::startOperation()
{
SMESHGUI_BaseComputeOp::startOperation();
+ if (myMesh->_is_nil())
+ return;
computeMesh();
}
}
SMESHGUI_BaseComputeOp::startOperation();
+ if (myMesh->_is_nil())
+ return;
// disconnect slot from preview dialog to have Apply from results of compute operation only
disconnect( myDlg, SIGNAL( dlgOk() ), this, SLOT( onOk() ) );
default: break;
}
if ( !algo->_is_nil() )
- theModeMap[ dim ] = 0;
+ theModeMap[ dim ] = 0;
}
}
}
myPreviewDisplayer->SetData( previewRes );
// append shape indeces with computed mesh entities
for ( int i = 0, n = aShapesId->length(); i < n; i++ )
- myMapShapeId[ aShapesId[ i ] ] = 0;
+ myMapShapeId[ aShapesId[ i ] ] = 0;
}
else
myPreviewDisplayer->SetVisibility(false);
{
SMESHGUI_BaseComputeOp::evaluateDlg();
SMESHGUI_BaseComputeOp::startOperation();
+ if (myMesh->_is_nil())
+ return;
evaluateMesh();
}
//================================================================================
/*!
- * \brief evaluaateMesh()
+ * \brief evaluateMesh()
*/
//================================================================================
SMESH::long_array_var aRes;
_PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
+ if ( !aMeshSObj ) // IPAL21340
+ return;
+
bool hasShape = myMesh->HasShapeToMesh();
bool shapeOK = myMainShape->_is_nil() ? !hasShape : hasShape;
- if ( shapeOK && aMeshSObj )
+ if ( shapeOK )
{
myCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() );
SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen();
// SHOW RESULTS
if ( isShowResultDlg )
showEvaluateResult( aRes, memoryLack, noCompError, aCompErrors,
- noHypoError, aHypErrors);
+ noHypoError, aHypErrors);
}
void SMESHGUI_BaseComputeOp::showEvaluateResult(const SMESH::long_array& theRes,
- const bool theMemoryLack,
- const bool theNoCompError,
- SMESH::compute_error_array_var& theCompErrors,
- const bool theNoHypoError,
- const QString& theHypErrors)
+ const bool theMemoryLack,
+ const bool theNoCompError,
+ SMESH::compute_error_array_var& theCompErrors,
+ const bool theNoHypoError,
+ const QString& theHypErrors)
{
bool hasShape = myMesh->HasShapeToMesh();
SMESHGUI_ComputeDlg* aCompDlg = evaluateDlg();
{
SMESH::ComputeError & err = theCompErrors[ row ];
- QString text = err.algoName.in();
- if ( !tbl->item( row, COL_ALGO ) ) tbl->setItem( row, COL_ALGO, new QTableWidgetItem( text ) );
- else tbl->item( row, COL_ALGO )->setText( text );
+ QString text = err.algoName.in();
+ if ( !tbl->item( row, COL_ALGO ) ) tbl->setItem( row, COL_ALGO, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_ALGO )->setText( text );
- text = SMESH::errorText( err.code, err.comment.in() );
- if ( !tbl->item( row, COL_ERROR ) ) tbl->setItem( row, COL_ERROR, new QTableWidgetItem( text ) );
- else tbl->item( row, COL_ERROR )->setText( text );
+ text = SMESH::errorText( err.code, err.comment.in() );
+ if ( !tbl->item( row, COL_ERROR ) ) tbl->setItem( row, COL_ERROR, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_ERROR )->setText( text );
- text = QString("%1").arg( err.subShapeID );
- if ( !tbl->item( row, COL_SHAPEID ) ) tbl->setItem( row, COL_SHAPEID, new QTableWidgetItem( text ) );
- else tbl->item( row, COL_SHAPEID )->setText( text );
+ text = QString("%1").arg( err.subShapeID );
+ if ( !tbl->item( row, COL_SHAPEID ) ) tbl->setItem( row, COL_SHAPEID, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_SHAPEID )->setText( text );
text = hasShape ? SMESH::shapeText( err.subShapeID, myMainShape ) : QString("");
- if ( !tbl->item( row, COL_SHAPE ) ) tbl->setItem( row, COL_SHAPE, new QTableWidgetItem( text ) );
- else tbl->item( row, COL_SHAPE )->setText( text );
+ if ( !tbl->item( row, COL_SHAPE ) ) tbl->setItem( row, COL_SHAPE, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_SHAPE )->setText( text );
text = ( !hasShape || SMESH::getSubShapeSO( err.subShapeID, myMainShape )) ? "PUBLISHED" : "";
- if ( !tbl->item( row, COL_PUBLISHED ) ) tbl->setItem( row, COL_PUBLISHED, new QTableWidgetItem( text ) );
- else tbl->item( row, COL_PUBLISHED )->setText( text ); // if text=="", "PUBLISH" button enabled
+ if ( !tbl->item( row, COL_PUBLISHED ) ) tbl->setItem( row, COL_PUBLISHED, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_PUBLISHED )->setText( text ); // if text=="", "PUBLISH" button enabled
text = err.hasBadMesh ? "hasBadMesh" : "";
- if ( !tbl->item( row, COL_BAD_MESH ) ) tbl->setItem( row, COL_BAD_MESH, new QTableWidgetItem( text ) );
- else tbl->item( row, COL_BAD_MESH )->setText( text );
+ if ( !tbl->item( row, COL_BAD_MESH ) ) tbl->setItem( row, COL_BAD_MESH, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_BAD_MESH )->setText( text );
if ( err.hasBadMesh ) hasBadMesh = true;
//tbl->item( row, COL_ERROR )->setWordWrap( true ); // VSR: TODO ???
SMESHGUI_ComputeDlg* computeDlg() const;
void computeMesh();
void showComputeResult( const bool,
- const bool,
- SMESH::compute_error_array_var&,
- const bool,
- const QString& );
+ const bool,
+ SMESH::compute_error_array_var&,
+ const bool,
+ const QString& );
SMESHGUI_ComputeDlg* evaluateDlg() const;
void evaluateMesh();
void showEvaluateResult(const SMESH::long_array& theRes,
- const bool,
- const bool,
- SMESH::compute_error_array_var&,
- const bool,
- const QString&);
+ const bool,
+ const bool,
+ SMESH::compute_error_array_var&,
+ const bool,
+ const QString&);
protected slots:
virtual bool onApply();
#include <SMESH_TypeFilter.hxx>
// SALOME GUI includes
-#include <SalomeApp_Tools.h>
-#include <SUIT_MessageBox.h>
#include <LightApp_UpdateFlags.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_OverrideCursor.h>
+#include <SalomeApp_Tools.h>
// IDL includes
#include <SALOMEconfig.h>
//================================================================================
bool SMESHGUI_ConvToQuadOp::onApply()
{
+ SUIT_OverrideCursor aWaitCursor;
QString aMess;
{
dlg()->show();
SUIT_MessageBox::warning( myDlg,
- tr( "SMESH_WRN_WARNING" ), tr("MESH_IS_NOT_SELECTED") );
+ tr( "SMESH_WRN_WARNING" ), tr("MESH_IS_NOT_SELECTED") );
return false;
}
if( CORBA::is_nil(mesh) )
{
SUIT_MessageBox::warning( myDlg,
- tr( "SMESH_WRN_WARNING" ), tr("REF_IS_NULL") );
+ tr( "SMESH_WRN_WARNING" ), tr("REF_IS_NULL") );
return false;
}
{
bool aParam = true;
if( myDlg->IsEnabledCheck() )
- aParam = myDlg->IsMediumNdsOnGeom();
+ aParam = myDlg->IsMediumNdsOnGeom();
aEditor->ConvertToQuadratic( aParam );
aResult = true;
// Connect signals and slots
connect( myTypeGrp, SIGNAL( buttonClicked( int ) ),
- this, SLOT( onTypeChanged( int ) ) );
+ this, SLOT( onTypeChanged( int ) ) );
connect( myProjectChk, SIGNAL( toggled( bool ) ),
- this, SLOT( onProject( bool ) ) );
+ this, SLOT( onProject( bool ) ) );
connect( aSelBtn, SIGNAL( clicked() ),
- this, SLOT( onSelBtnClicked() ) );
+ this, SLOT( onSelBtnClicked() ) );
return aMainGrp;
}
// selection and SMESHGUI
connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ),
- this, SLOT( onSelectionDone() ) );
+ this, SLOT( onSelectionDone() ) );
connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ),
- this, SLOT( onDeactivate() ) );
+ this, SLOT( onDeactivate() ) );
connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ),
- this, SLOT( onClose() ) );
+ this, SLOT( onClose() ) );
mySwitch2d->setEnabled( theType == Type_2d );
mySwitch3d->setEnabled( theType == Type_3d );
{
if ( myGeomObj->_is_nil() ) {
SUIT_MessageBox::information( this,
- tr( "SMESH_INSUFFICIENT_DATA" ),
- tr( "SMESHGUI_INVALID_PARAMETERS" ) );
+ tr( "SMESH_INSUFFICIENT_DATA" ),
+ tr( "SMESHGUI_INVALID_PARAMETERS" ) );
return false;
}
return true;
if ( aWritten != aLen ) {
SUIT_MessageBox::information( this,
- tr( "SMESH_ERROR" ),
- tr( "ERROR_OF_SAVING" ) );
+ tr( "SMESH_ERROR" ),
+ tr( "ERROR_OF_SAVING" ) );
}
else {
//SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
- aViewWindow->SetSelectionMode( ActorSelection );
+ aViewWindow->SetSelectionMode( ActorSelection );
disconnect( mySelectionMgr, 0, this, 0 );
disconnect( mySMESHGUI, 0, this, 0 );
mySMESHGUI->ResetState();
else {
//SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
- aViewWindow->SetSelectionMode( ActorSelection );
+ aViewWindow->SetSelectionMode( ActorSelection );
disconnect( mySelectionMgr, 0, this, 0 );
disconnect( mySMESHGUI, 0, this, 0 );
mySMESHGUI->ResetState();
platform = "application";
#endif
SUIT_MessageBox::warning( this,
- tr( "WRN_WARNING" ),
- tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
- arg( app->resourceMgr()->stringValue( "ExternalBrowser",
- platform ) ).
- arg( myHelpFileName ) );
+ tr( "WRN_WARNING" ),
+ tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
+ arg( app->resourceMgr()->stringValue( "ExternalBrowser",
+ platform ) ).
+ arg( myHelpFileName ) );
}
}
if ( myType == Type_2d ) {
mySelectionMgr->installFilter( new SMESH_NumberFilter( "SMESH",
- TopAbs_SHAPE,
- -1,
- TopAbs_FACE ) );
+ TopAbs_SHAPE,
+ -1,
+ TopAbs_FACE ) );
}
else {
TColStd_MapOfInteger aTypes;
aTypes.Add( TopAbs_SHELL );
aTypes.Add( TopAbs_SOLID );
mySelectionMgr->installFilter( new SMESH_NumberFilter( "SMESH",
- TopAbs_FACE,
- 6,
- aTypes,
- GEOM::GEOM_Object::_nil(),
- true ) );
+ TopAbs_FACE,
+ 6,
+ aTypes,
+ GEOM::GEOM_Object::_nil(),
+ true ) );
}
}
typedef std::vector<vtkIdType> TVTKIds;
void SetPosition(SMESH_Actor* theActor,
- vtkIdType theType,
- const TVTKIds& theIds,
- bool theReset=true)
+ vtkIdType theType,
+ const TVTKIds& theIds,
+ bool theReset=true)
{
vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
myGrid->SetPoints(aGrid->GetPoints());
vtkIdList *anIds = vtkIdList::New();
for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
- anIds->InsertId(i,theIds[i]);
+ anIds->InsertId(i,theIds[i]);
myGrid->InsertNextCell(theType,anIds);
if(theIds.size()!=0){
- myGrid->InsertNextCell(theType,anIds);
- myGrid->Modified();
+ myGrid->InsertNextCell(theType,anIds);
+ myGrid->Modified();
}
-
+
anIds->Delete();
SetVisibility(true);
~TPolySimulation(){
if( myViewWindow )
- myViewWindow->RemoveActor(myPreviewActor);
+ myViewWindow->RemoveActor(myPreviewActor);
myPreviewActor->Delete();
{
case 0 :
{
- if ( myActor ){
+ if ( myActor ){
myActor->SetPointRepresentation(true);
- }
+ }
else
SMESH::SetPointRepresentation(true);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(NodeSelection);
-
- AddButton->setEnabled(false);
- RemoveButton->setEnabled(false);
- TextLabelIds->setText( tr( "SMESH_ID_NODES" ) );
- myFacesByNodesLabel->show();
- myFacesByNodes->clear();
- myFacesByNodes->show();
- AddButton->show();
- RemoveButton->show();
- Preview->show();
- break;
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(NodeSelection);
+
+ AddButton->setEnabled(false);
+ RemoveButton->setEnabled(false);
+ TextLabelIds->setText( tr( "SMESH_ID_NODES" ) );
+ myFacesByNodesLabel->show();
+ myFacesByNodes->clear();
+ myFacesByNodes->show();
+ AddButton->show();
+ RemoveButton->show();
+ Preview->show();
+ break;
}
case 1 :
{
- if( myActor ){
- myActor->SetPointRepresentation(false);
- } else {
- SMESH::SetPointRepresentation(false);
- }
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
-
- TextLabelIds->setText( tr( "SMESH_ID_FACES" ) );
- myFacesByNodesLabel->hide();
- myFacesByNodes->hide();
- AddButton->hide();
- RemoveButton->hide();
- Preview->show();
- break;
+ if( myActor ){
+ myActor->SetPointRepresentation(false);
+ } else {
+ SMESH::SetPointRepresentation(false);
+ }
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
+
+ TextLabelIds->setText( tr( "SMESH_ID_FACES" ) );
+ myFacesByNodesLabel->hide();
+ myFacesByNodes->hide();
+ AddButton->hide();
+ RemoveButton->hide();
+ Preview->show();
+ break;
}
}
if(checkEditLine(false) == -1) {return;}
busy = true;
if (GetConstructorId() == 0)
- {
- SMESH::long_array_var anIdsOfNodes = new SMESH::long_array;
- SMESH::long_array_var aQuantities = new SMESH::long_array;
-
- aQuantities->length( myFacesByNodes->count() );
-
- TColStd_ListOfInteger aNodesIds;
-
- int aNbQuantities = 0;
- for (int i = 0; i < myFacesByNodes->count(); i++ ) {
- QStringList anIds = myFacesByNodes->item(i)->text().split( " ", QString::SkipEmptyParts );
- for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it)
- aNodesIds.Append( (*it).toInt() );
-
- aQuantities[aNbQuantities++] = anIds.count();
- }
-
- anIdsOfNodes->length(aNodesIds.Extent());
-
- int aNbIdsOfNodes = 0;
- TColStd_ListIteratorOfListOfInteger It;
- It.Initialize(aNodesIds);
- for( ;It.More();It.Next())
- anIdsOfNodes[aNbIdsOfNodes++] = It.Value();
-
- try{
- SUIT_OverrideCursor aWaitCursor;
- SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
- aMeshEditor->AddPolyhedralVolume(anIdsOfNodes, aQuantities);
- }catch(SALOME::SALOME_Exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.details.text);
- }catch(std::exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was cought !!!");
- }
- }
+ {
+ SMESH::long_array_var anIdsOfNodes = new SMESH::long_array;
+ SMESH::long_array_var aQuantities = new SMESH::long_array;
+
+ aQuantities->length( myFacesByNodes->count() );
+
+ TColStd_ListOfInteger aNodesIds;
+
+ int aNbQuantities = 0;
+ for (int i = 0; i < myFacesByNodes->count(); i++ ) {
+ QStringList anIds = myFacesByNodes->item(i)->text().split( " ", QString::SkipEmptyParts );
+ for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it)
+ aNodesIds.Append( (*it).toInt() );
+
+ aQuantities[aNbQuantities++] = anIds.count();
+ }
+
+ anIdsOfNodes->length(aNodesIds.Extent());
+
+ int aNbIdsOfNodes = 0;
+ TColStd_ListIteratorOfListOfInteger It;
+ It.Initialize(aNodesIds);
+ for( ;It.More();It.Next())
+ anIdsOfNodes[aNbIdsOfNodes++] = It.Value();
+
+ try{
+ SUIT_OverrideCursor aWaitCursor;
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ aMeshEditor->AddPolyhedralVolume(anIdsOfNodes, aQuantities);
+ }catch(SALOME::SALOME_Exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.details.text);
+ }catch(std::exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was cought !!!");
+ }
+ }
else if (GetConstructorId() == 1)
- {
- SMESH::long_array_var anIdsOfFaces = new SMESH::long_array;
-
- QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
- anIdsOfFaces->length(aListId.count());
- for ( int i = 0; i < aListId.count(); i++ )
- anIdsOfFaces[i] = aListId[i].toInt();
-
- try{
- SUIT_OverrideCursor aWaitCursor;
- SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
- aMeshEditor->AddPolyhedralVolumeByFaces(anIdsOfFaces);
- }catch(SALOME::SALOME_Exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.details.text);
- }catch(std::exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was cought !!!");
- }
- }
+ {
+ SMESH::long_array_var anIdsOfFaces = new SMESH::long_array;
+
+ QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
+ anIdsOfFaces->length(aListId.count());
+ for ( int i = 0; i < aListId.count(); i++ )
+ anIdsOfFaces[i] = aListId[i].toInt();
+
+ try{
+ SUIT_OverrideCursor aWaitCursor;
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ aMeshEditor->AddPolyhedralVolumeByFaces(anIdsOfFaces);
+ }catch(SALOME::SALOME_Exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.details.text);
+ }catch(std::exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was cought !!!");
+ }
+ }
//SALOME_ListIO aList;
//mySelectionMgr->setSelectedObjects( aList );
SMESH::UpdateView();
if( myActor ){
- unsigned int anEntityMode = myActor->GetEntityMode();
- myActor->SetEntityMode(SMESH_Actor::eVolumes | anEntityMode);
+ unsigned int anEntityMode = myActor->GetEntityMode();
+ myActor->SetEntityMode(SMESH_Actor::eVolumes | anEntityMode);
}
//ConstructorsClicked( GetConstructorId() );
busy = false;
ClickOnCancel();
}
-
+
//=================================================================================
// function : ClickOnCancel()
// purpose :
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
if (GetConstructorId() == 0)
{
if ( aMesh ) {
- TColStd_MapOfInteger newIndices;
+ TColStd_MapOfInteger newIndices;
- QStringList aListId = theNewText.split( " ", QString::SkipEmptyParts );
- for ( int i = 0; i < aListId.count(); i++ ) {
- const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
- if ( n ) {
- newIndices.Add(n->GetID());
- myNbOkElements++;
- }
- }
+ QStringList aListId = theNewText.split( " ", QString::SkipEmptyParts );
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
+ if ( n ) {
+ newIndices.Add(n->GetID());
+ myNbOkElements++;
+ }
+ }
- mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
+ mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( myActor->getIO(), true, true );
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->highlight( myActor->getIO(), true, true );
- if ( myNbOkElements>0 && aListId.count()>=3)
- AddButton->setEnabled(true);
- else
- AddButton->setEnabled(false);
+ if ( myNbOkElements>0 && aListId.count()>=3)
+ AddButton->setEnabled(true);
+ else
+ AddButton->setEnabled(false);
- displaySimulation();
+ displaySimulation();
}
} else if (GetConstructorId() == 1)
{
- myNbOkElements = 0;
- buttonOk->setEnabled( false );
- buttonApply->setEnabled( false );
+ myNbOkElements = 0;
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
- // check entered ids of faces and hilight them
- QStringList aListId;
- if ( aMesh ) {
- TColStd_MapOfInteger newIndices;
+ // check entered ids of faces and hilight them
+ QStringList aListId;
+ if ( aMesh ) {
+ TColStd_MapOfInteger newIndices;
- aListId = theNewText.split( " ", QString::SkipEmptyParts );
-
- for ( int i = 0; i < aListId.count(); i++ ) {
- const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
- if ( e ) {
- newIndices.Add(e->GetID());
- myNbOkElements++;
- }
- }
-
- mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( myActor->getIO(), true, true );
+ aListId = theNewText.split( " ", QString::SkipEmptyParts );
+
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
+ if ( e ) {
+ newIndices.Add(e->GetID());
+ myNbOkElements++;
+ }
+ }
+
+ mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->highlight( myActor->getIO(), true, true );
- if ( myNbOkElements ) {
- if (aListId.count()>1){
- buttonOk->setEnabled( true );
- buttonApply->setEnabled( true );
- }
- else{
- buttonOk->setEnabled( false );
- buttonApply->setEnabled( false );
- }
- if(aListId.count()>1)
- displaySimulation();
- }
- }
+ if ( myNbOkElements ) {
+ if (aListId.count()>1){
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+ else{
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+ }
+ if(aListId.count()>1)
+ displaySimulation();
+ }
+ }
}
busy = false;
}
case 0:{ // nodes
const SMDS_MeshNode * aNode = aMesh->FindNode( aListId[ i ].toInt() );
if( !aNode ){
- SUIT_MessageBox::warning(this,
- tr("SMESH_POLYEDRE_CREATE_ERROR"),
- tr("The incorrect indices of nodes!"));
-
- myEditCurrentArgument->clear();
- myEditCurrentArgument->setText( aString );
- return -1;
+ SUIT_MessageBox::warning(this,
+ tr("SMESH_POLYEDRE_CREATE_ERROR"),
+ tr("The incorrect indices of nodes!"));
+
+ myEditCurrentArgument->clear();
+ myEditCurrentArgument->setText( aString );
+ return -1;
}
break;
bool aElemIsOK = true;
const SMDS_MeshElement * aElem = aMesh->FindElement( aListId[ i ].toInt() );
if (!aElem)
- {
- aElemIsOK = false;
- }
+ {
+ aElemIsOK = false;
+ }
else
- {
- SMDSAbs_ElementType aType = aMesh->GetElementType( aElem->GetID(),true );
- if (aType != SMDSAbs_Face){
- aElemIsOK = false;
- }
- }
+ {
+ SMDSAbs_ElementType aType = aMesh->GetElementType( aElem->GetID(),true );
+ if (aType != SMDSAbs_Face){
+ aElemIsOK = false;
+ }
+ }
if (!aElemIsOK){
- SUIT_MessageBox::warning(this,
- tr("SMESH_POLYEDRE_CREATE_ERROR"),
- tr("The incorrect indices of faces!"));
-
- myEditCurrentArgument->clear();
- myEditCurrentArgument->setText( aString );
- return -1;
+ SUIT_MessageBox::warning(this,
+ tr("SMESH_POLYEDRE_CREATE_ERROR"),
+ tr("The incorrect indices of faces!"));
+
+ myEditCurrentArgument->clear();
+ myEditCurrentArgument->setText( aString );
+ return -1;
}
break;
}
vtkIdType aType = VTK_CONVEX_POINT_SET;
SMDS_Mesh* aMesh = 0;
if ( myActor ){
- aMesh = myActor->GetObject()->GetMesh();
+ aMesh = myActor->GetObject()->GetMesh();
}
if (GetConstructorId() == 0 && aMesh){
- if (!AddButton->isEnabled()){
- mySimulation->ResetGrid(true);
- for (int i = 0; i < myFacesByNodes->count(); i++) {
- QStringList anIds = myFacesByNodes->item(i)->text().split( " ", QString::SkipEmptyParts );
- SMESH::TPolySimulation::TVTKIds aVTKIds_faces;
- for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it){
- const SMDS_MeshNode* aNode = aMesh->FindNode( (*it).toInt() );
- if (!aNode) continue;
- vtkIdType aId = myActor->GetObject()->GetNodeVTKId( (*it).toInt() );
- aVTKIds.push_back(aId);
- aVTKIds_faces.push_back(aId);
- }
- if(!Preview->isChecked()){
- aType = VTK_POLYGON;
- mySimulation->SetPosition(myActor, aType, aVTKIds_faces,false);
- }
- }
- if(myFacesByNodes->count() == 0){
- mySimulation->SetVisibility(false);
- } else {
- mySimulation->SetVisibility(true);
- }
- if(Preview->isChecked()){
- mySimulation->SetPosition(myActor, aType, aVTKIds);
- }
- } else {
- // add ids from edit line
- QStringList anEditIds = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
- for ( int i = 0; i < anEditIds.count(); i++ )
- aVTKIds.push_back( myActor->GetObject()->GetNodeVTKId( anEditIds[ i ].toInt() ));
- aType = VTK_POLYGON;
- mySimulation->SetPosition(myActor, aType, aVTKIds);
- }
+ if (!AddButton->isEnabled()){
+ mySimulation->ResetGrid(true);
+ for (int i = 0; i < myFacesByNodes->count(); i++) {
+ QStringList anIds = myFacesByNodes->item(i)->text().split( " ", QString::SkipEmptyParts );
+ SMESH::TPolySimulation::TVTKIds aVTKIds_faces;
+ for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it){
+ const SMDS_MeshNode* aNode = aMesh->FindNode( (*it).toInt() );
+ if (!aNode) continue;
+ vtkIdType aId = myActor->GetObject()->GetNodeVTKId( (*it).toInt() );
+ aVTKIds.push_back(aId);
+ aVTKIds_faces.push_back(aId);
+ }
+ if(!Preview->isChecked()){
+ aType = VTK_POLYGON;
+ mySimulation->SetPosition(myActor, aType, aVTKIds_faces,false);
+ }
+ }
+ if(myFacesByNodes->count() == 0){
+ mySimulation->SetVisibility(false);
+ } else {
+ mySimulation->SetVisibility(true);
+ }
+ if(Preview->isChecked()){
+ mySimulation->SetPosition(myActor, aType, aVTKIds);
+ }
+ } else {
+ // add ids from edit line
+ QStringList anEditIds = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
+ for ( int i = 0; i < anEditIds.count(); i++ )
+ aVTKIds.push_back( myActor->GetObject()->GetNodeVTKId( anEditIds[ i ].toInt() ));
+ aType = VTK_POLYGON;
+ mySimulation->SetPosition(myActor, aType, aVTKIds);
+ }
}else if(GetConstructorId() == 1 && aMesh){
- QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
- for ( int i = 0; i < aListId.count(); i++ )
- {
- const SMDS_MeshElement * anElem = aMesh->FindElement( aListId[ i ].toInt() );
- if ( !anElem ) continue;
- SMDSAbs_ElementType aFaceType = aMesh->GetElementType( anElem->GetID(),true );
- if (aFaceType != SMDSAbs_Face) continue;
-
- SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
- SMESH::TPolySimulation::TVTKIds aVTKIds_faces;
- while( anIter->more() )
- if ( const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next() ){
- vtkIdType aId = myActor->GetObject()->GetNodeVTKId( aNode->GetID() );
- aVTKIds.push_back(aId);
- aVTKIds_faces.push_back(aId);
- }
- if(!Preview->isChecked()){
- aType = VTK_POLYGON;
- mySimulation->SetPosition(myActor, aType, aVTKIds_faces);
- }
- }
- if(Preview->isChecked())
- mySimulation->SetPosition(myActor, aType, aVTKIds);
+ QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
+ for ( int i = 0; i < aListId.count(); i++ )
+ {
+ const SMDS_MeshElement * anElem = aMesh->FindElement( aListId[ i ].toInt() );
+ if ( !anElem ) continue;
+ SMDSAbs_ElementType aFaceType = aMesh->GetElementType( anElem->GetID(),true );
+ if (aFaceType != SMDSAbs_Face) continue;
+
+ SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
+ SMESH::TPolySimulation::TVTKIds aVTKIds_faces;
+ while( anIter->more() )
+ if ( const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next() ){
+ vtkIdType aId = myActor->GetObject()->GetNodeVTKId( aNode->GetID() );
+ aVTKIds.push_back(aId);
+ aVTKIds_faces.push_back(aId);
+ }
+ if(!Preview->isChecked()){
+ aType = VTK_POLYGON;
+ mySimulation->SetPosition(myActor, aType, aVTKIds_faces);
+ }
+ }
+ if(Preview->isChecked())
+ mySimulation->SetPosition(myActor, aType, aVTKIds);
}
SMESH::UpdateView();
}
{
if (myListBox->count() == 0) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("NO_SELECTED_GROUPS"));
+ tr("NO_SELECTED_GROUPS"));
return false;
}
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
Q_OBJECT
public:
- SMESHGUI_Dialog( QWidget* = 0, const bool = false, const bool = false,
- const int = OK | Close | Apply | Help );
+ SMESHGUI_Dialog( QWidget* = 0, const bool modal = false, const bool allowResize = false,
+ const int = OK | Close | Apply | Help );
virtual ~SMESHGUI_Dialog();
virtual void show();
SUIT_ViewWindow* wnd = vtk_viewer->getViewManager()->getActiveView();
SMESH_Actor* anActor = SMESH::FindActorByEntry( wnd, entry.toLatin1().data() );
if( !anActor )
- anActor = SMESH::CreateActor( study()->studyDS(), entry.toLatin1().data(), true );
+ anActor = SMESH::CreateActor( study()->studyDS(), entry.toLatin1().data(), true );
if( anActor )
{
- SMESH::DisplayActor( wnd, anActor );
+ SMESH::DisplayActor( wnd, anActor );
prs = LightApp_Displayer::buildPresentation( entry.toLatin1().data(), aViewFrame );
}
if( prs )
- UpdatePrs( prs );
+ UpdatePrs( prs );
else if( anActor )
- SMESH::RemoveActor( vtk_viewer->getViewManager()->getActiveView(), anActor );
+ SMESH::RemoveActor( vtk_viewer->getViewManager()->getActiveView(), anActor );
}
}
}
void SetPointsData ( SMDS_Mesh* theMesh,
- TColStd_MapOfInteger & theNodesIdMap )
+ TColStd_MapOfInteger & theNodesIdMap )
{
vtkPoints* aPoints = vtkPoints::New();
aPoints->SetNumberOfPoints(theNodesIdMap.Extent());
TColStd_MapIteratorOfMapOfInteger idIter( theNodesIdMap );
for( int i = 0; idIter.More(); idIter.Next(), i++ ) {
- const SMDS_MeshNode* aNode = theMesh->FindNode(idIter.Key());
- aPoints->SetPoint( i, aNode->X(), aNode->Y(), aNode->Z() );
- myIDs.push_back(idIter.Key());
+ const SMDS_MeshNode* aNode = theMesh->FindNode(idIter.Key());
+ aPoints->SetPoint( i, aNode->X(), aNode->Y(), aNode->Z() );
+ myIDs.push_back(idIter.Key());
}
myIdGrid->SetPoints(aPoints);
}
void SetElemsData( TColStd_MapOfInteger & theElemsIdMap,
- std::list<gp_XYZ> & aGrCentersXYZ )
+ std::list<gp_XYZ> & aGrCentersXYZ )
{
vtkPoints* aPoints = vtkPoints::New();
aPoints->SetNumberOfPoints(theElemsIdMap.Extent());
TColStd_MapIteratorOfMapOfInteger idIter( theElemsIdMap );
for( ; idIter.More(); idIter.Next() ) {
- myIDs.push_back(idIter.Key());
+ myIDs.push_back(idIter.Key());
}
gp_XYZ aXYZ;
std::list<gp_XYZ>::iterator coordIt = aGrCentersXYZ.begin();
for( int i = 0; coordIt != aGrCentersXYZ.end(); coordIt++, i++ ) {
- aXYZ = *coordIt;
- aPoints->SetPoint( i, aXYZ.X(), aXYZ.Y(), aXYZ.Z() );
+ aXYZ = *coordIt;
+ aPoints->SetPoint( i, aXYZ.X(), aXYZ.Y(), aXYZ.Z() );
}
myIdGrid->SetPoints(aPoints);
aPoints->Delete();
myIsPointsLabeled = theIsPointsLabeled && myIdGrid->GetNumberOfPoints();
if ( myIsPointsLabeled ) {
- myPointsNumDataSet->ShallowCopy(myIdGrid);
- vtkDataSet *aDataSet = myPointsNumDataSet;
- int aNbElem = myIDs.size();
- vtkIntArray *anArray = vtkIntArray::New();
- anArray->SetNumberOfValues( aNbElem );
- for ( int i = 0; i < aNbElem; i++ )
- anArray->SetValue( i, myIDs[i] );
- aDataSet->GetPointData()->SetScalars( anArray );
- anArray->Delete();
- myPtsMaskPoints->SetInput( aDataSet );
- myPointLabels->SetVisibility( theIsActorVisible );
+ myPointsNumDataSet->ShallowCopy(myIdGrid);
+ vtkDataSet *aDataSet = myPointsNumDataSet;
+ int aNbElem = myIDs.size();
+ vtkIntArray *anArray = vtkIntArray::New();
+ anArray->SetNumberOfValues( aNbElem );
+ for ( int i = 0; i < aNbElem; i++ )
+ anArray->SetValue( i, myIDs[i] );
+ aDataSet->GetPointData()->SetScalars( anArray );
+ anArray->Delete();
+ myPtsMaskPoints->SetInput( aDataSet );
+ myPointLabels->SetVisibility( theIsActorVisible );
}
else {
- myPointLabels->SetVisibility( false );
+ myPointLabels->SetVisibility( false );
}
}
//myPtsSelectVisiblePoints->UnRegisterAllOutputs(); //vtk 5.0 porting
myPtsSelectVisiblePoints->Delete();
- //myPtsMaskPoints->UnRegisterAllOutputs(); //vtk 5.0 porting
+ //myPtsMaskPoints->UnRegisterAllOutputs(); //vtk 5.0 porting
myPtsMaskPoints->Delete();
myPointLabels->Delete();
static const char * IconFirst[] = {
"18 10 2 1",
-" g None",
-". g #000000",
+" g None",
+". g #000000",
" . . ",
" .. .. .. ",
" .. ... ... ",
// purpose :
//=================================================================================
SMESHGUI_EditMeshDlg::SMESHGUI_EditMeshDlg (SMESHGUI* theModule,
- int theAction)
+ int theAction)
: QDialog(SMESH::GetDesktop(theModule)),
mySMESHGUI(theModule),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
/***************************************************************/
GroupConstructors = new QGroupBox(myAction == 1 ?
- tr("SMESH_MERGE_ELEMENTS") :
- tr("SMESH_MERGE_NODES"),
- this);
+ tr("SMESH_MERGE_ELEMENTS") :
+ tr("SMESH_MERGE_NODES"),
+ this);
QButtonGroup* ButtonGroup = new QButtonGroup(this);
QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors);
/***************************************************************/
// Controls for coincident elements detecting
GroupCoincident = new QGroupBox(myAction == 1 ?
- tr("COINCIDENT_ELEMENTS") :
- tr("COINCIDENT_NODES"),
- this);
+ tr("COINCIDENT_ELEMENTS") :
+ tr("COINCIDENT_NODES"),
+ this);
QGridLayout* GroupCoincidentLayout = new QGridLayout(GroupCoincident);
GroupCoincidentLayout->setSpacing(SPACING);
// purpose :
//=================================================================================
void SMESHGUI_EditMeshDlg::FindGravityCenter(TColStd_MapOfInteger & theElemsIdMap,
- std::list< gp_XYZ > & theGrCentersXYZ)
+ std::list< gp_XYZ > & theGrCentersXYZ)
{
if (!myActor)
return;
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
switch (myAction) {
case 0 :
if(!mySubMeshOrGroup->_is_nil())
- aMeshEditor->FindCoincidentNodesOnPart(mySubMeshOrGroup, SpinBoxTolerance->GetValue(), aGroupsArray);
+ aMeshEditor->FindCoincidentNodesOnPart(mySubMeshOrGroup, SpinBoxTolerance->GetValue(), aGroupsArray);
else
- aMeshEditor->FindCoincidentNodes(SpinBoxTolerance->GetValue(), aGroupsArray);
+ aMeshEditor->FindCoincidentNodes(SpinBoxTolerance->GetValue(), aGroupsArray);
break;
case 1 :
if(!mySubMeshOrGroup->_is_nil())
- aMeshEditor->FindEqualElements(mySubMeshOrGroup, aGroupsArray);
+ aMeshEditor->FindEqualElements(mySubMeshOrGroup, aGroupsArray);
else
- aMeshEditor->FindEqualElements(myMesh, aGroupsArray);
+ aMeshEditor->FindEqualElements(myMesh, aGroupsArray);
break;
}
QStringList anIDs;
for (int j = 0; j < aGroup.length(); j++)
- anIDs.append(QString::number(aGroup[j]));
+ anIDs.append(QString::number(aGroup[j]));
ListCoincident->addItem(anIDs.join(" "));
}
if (myAction == 0) {
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(NodeSelection);
+ aViewWindow->SetSelectionMode(NodeSelection);
}
else
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(CellSelection);
+ aViewWindow->SetSelectionMode(CellSelection);
}
}
void onEditGroup();
void FindGravityCenter( TColStd_MapOfInteger&,
- std::list<gp_XYZ>& );
+ std::list<gp_XYZ>& );
// add the centers of gravity of ElemsIdMap elements to the GrCentersXYZ list
private:
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
connect(ElementsLineEdit, SIGNAL(textChanged(const QString&)),
- SLOT(onTextChange(const QString&)));
+ SLOT(onTextChange(const QString&)));
connect(StartPointLineEdit, SIGNAL(textChanged(const QString&)),
- SLOT(onTextChange(const QString&)));
+ SLOT(onTextChange(const QString&)));
connect(MeshCheck, SIGNAL(toggled(bool)), SLOT(onSelectMesh()));
SMESH::SetPointRepresentation(false);
if (MeshCheck->isChecked()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(ActorSelection);
+ aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(myElementsFilter);
} else {
if (type == 0)
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
- }
+ {
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(EdgeSelection);
+ }
if (type == 1)
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- }
+ {
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
+ }
}
}
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
bool bOk;
int j = 0;
for (int i = 0; i < aListElementsId.count(); i++) {
- long ind = aListElementsId[ i ].toLong(&bOk);
- if (bOk) {
- const SMDS_MeshElement* e = aMesh->FindElement(ind);
- if (e) {
- bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge ||
- Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
- if (typeMatch)
- anElementsId[ j++ ] = ind;
- }
- }
+ long ind = aListElementsId[ i ].toLong(&bOk);
+ if (bOk) {
+ const SMDS_MeshElement* e = aMesh->FindElement(ind);
+ if (e) {
+ bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge ||
+ Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
+ if (typeMatch)
+ anElementsId[ j++ ] = ind;
+ }
+ }
}
anElementsId->length(j);
}
/*
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
if( MeshCheck->isChecked() ) {
- if( GetConstructorId() == 0 )
- SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionAlongPathObject1DMakeGroups(myIDSource, myPathMesh,
- myPathShape, aNodeStart,
- AnglesGrp->isChecked(), anAngles,
- BasePointGrp->isChecked(), aBasePoint, retVal);
- else
- SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionAlongPathObject2DMakeGroups(myIDSource, myPathMesh,
- myPathShape, aNodeStart,
- AnglesGrp->isChecked(), anAngles,
- BasePointGrp->isChecked(), aBasePoint, retVal);
+ if( GetConstructorId() == 0 )
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionAlongPathObject1DMakeGroups(myIDSource, myPathMesh,
+ myPathShape, aNodeStart,
+ AnglesGrp->isChecked(), anAngles,
+ BasePointGrp->isChecked(), aBasePoint, retVal);
+ else
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionAlongPathObject2DMakeGroups(myIDSource, myPathMesh,
+ myPathShape, aNodeStart,
+ AnglesGrp->isChecked(), anAngles,
+ BasePointGrp->isChecked(), aBasePoint, retVal);
}
else
- SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh,
- myPathShape, aNodeStart,
- AnglesGrp->isChecked(), anAngles,
- BasePointGrp->isChecked(), aBasePoint, retVal);
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh,
+ myPathShape, aNodeStart,
+ AnglesGrp->isChecked(), anAngles,
+ BasePointGrp->isChecked(), aBasePoint, retVal);
}
else {
if( MeshCheck->isChecked() ) {
- if( GetConstructorId() == 0 )
- retVal = aMeshEditor->ExtrusionAlongPathObject1D(myIDSource, myPathMesh,
- myPathShape, aNodeStart,
- AnglesGrp->isChecked(), anAngles,
- BasePointGrp->isChecked(), aBasePoint);
- else
- retVal = aMeshEditor->ExtrusionAlongPathObject2D(myIDSource, myPathMesh,
- myPathShape, aNodeStart,
- AnglesGrp->isChecked(), anAngles,
- BasePointGrp->isChecked(), aBasePoint);
+ if( GetConstructorId() == 0 )
+ retVal = aMeshEditor->ExtrusionAlongPathObject1D(myIDSource, myPathMesh,
+ myPathShape, aNodeStart,
+ AnglesGrp->isChecked(), anAngles,
+ BasePointGrp->isChecked(), aBasePoint);
+ else
+ retVal = aMeshEditor->ExtrusionAlongPathObject2D(myIDSource, myPathMesh,
+ myPathShape, aNodeStart,
+ AnglesGrp->isChecked(), anAngles,
+ BasePointGrp->isChecked(), aBasePoint);
}
else
- retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh,
- myPathShape, aNodeStart,
- AnglesGrp->isChecked(), anAngles,
- BasePointGrp->isChecked(), aBasePoint);
+ retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh,
+ myPathShape, aNodeStart,
+ AnglesGrp->isChecked(), anAngles,
+ BasePointGrp->isChecked(), aBasePoint);
}
*/
ElemType = SMESH::EDGE;
if( !MeshCheck->isChecked() ) {
SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionAlongPathX(anElementsId, myPath, aNodeStart, AnglesGrp->isChecked(),
- anAngles, LinearAnglesCheck->isChecked(),
- BasePointGrp->isChecked(), aBasePoint,
- NeedGroups, ElemType, retVal);
+ aMeshEditor->ExtrusionAlongPathX(anElementsId, myPath, aNodeStart, AnglesGrp->isChecked(),
+ anAngles, LinearAnglesCheck->isChecked(),
+ BasePointGrp->isChecked(), aBasePoint,
+ NeedGroups, ElemType, retVal);
}
else {
SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionAlongPathObjX(myIDSource, myPath, aNodeStart, AnglesGrp->isChecked(),
- anAngles, LinearAnglesCheck->isChecked(),
- BasePointGrp->isChecked(), aBasePoint,
- NeedGroups, ElemType, retVal);
+ aMeshEditor->ExtrusionAlongPathObjX(myIDSource, myPath, aNodeStart, AnglesGrp->isChecked(),
+ anAngles, LinearAnglesCheck->isChecked(),
+ BasePointGrp->isChecked(), aBasePoint,
+ NeedGroups, ElemType, retVal);
}
if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK )
- myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
//wc.stop();
wc.suspend();
switch (retVal) {
case SMESH::SMESH_MeshEditor::EXTR_NO_ELEMENTS:
SUIT_MessageBox::warning(this,
- tr("SMESH_ERROR"),
- tr("NO_ELEMENTS_SELECTED"));
+ tr("SMESH_ERROR"),
+ tr("NO_ELEMENTS_SELECTED"));
return false; break;
case SMESH::SMESH_MeshEditor::EXTR_PATH_NOT_EDGE:
SUIT_MessageBox::warning(this,
- tr("SMESH_ERROR"),
- tr("SELECTED_PATH_IS_NOT_EDGE"));
+ tr("SMESH_ERROR"),
+ tr("SELECTED_PATH_IS_NOT_EDGE"));
return false; break;
case SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE:
SUIT_MessageBox::warning(this,
- tr("SMESH_ERROR"),
- tr("BAD_SHAPE_TYPE"));
+ tr("SMESH_ERROR"),
+ tr("BAD_SHAPE_TYPE"));
return false; break;
case SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE:
SUIT_MessageBox::warning(this,
- tr("SMESH_ERROR"),
- tr("EXTR_BAD_STARTING_NODE"));
+ tr("SMESH_ERROR"),
+ tr("EXTR_BAD_STARTING_NODE"));
return false; break;
case SMESH::SMESH_MeshEditor::EXTR_BAD_ANGLES_NUMBER:
SUIT_MessageBox::warning(this,
- tr("SMESH_ERROR"),
- tr("WRONG_ANGLES_NUMBER"));
+ tr("SMESH_ERROR"),
+ tr("WRONG_ANGLES_NUMBER"));
return false; break;
case SMESH::SMESH_MeshEditor::EXTR_CANT_GET_TANGENT:
SUIT_MessageBox::warning(this,
- tr("SMESH_ERROR"),
- tr("CANT_GET_TANGENT"));
+ tr("SMESH_ERROR"),
+ tr("CANT_GET_TANGENT"));
return false; break;
case SMESH::SMESH_MeshEditor::EXTR_OK:
break;
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
const Handle(SALOME_InteractiveObject)& anIO = myMeshActor->getIO();
TColStd_MapOfInteger newIndices;
for (int i = 0; i < aListId.count(); i++) {
- long ind = aListId[ i ].toLong(&bOk);
- if (bOk) {
- const SMDS_MeshElement* e = aMesh->FindElement(ind);
- if (e) {
- // check also type of element
- bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge ||
- Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
- if (typeMatch)
- newIndices.Add(e->GetID());
- }
- }
+ long ind = aListId[ i ].toLong(&bOk);
+ if (bOk) {
+ const SMDS_MeshElement* e = aMesh->FindElement(ind);
+ if (e) {
+ // check also type of element
+ bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge ||
+ Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
+ if (typeMatch)
+ newIndices.Add(e->GetID());
+ }
+ }
}
mySelector->AddOrRemoveIndex(anIO, newIndices, false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( anIO, true, true );
+ aViewWindow->highlight( anIO, true, true );
}
}
else if (send == StartPointLineEdit &&
SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPath);
SMDS_Mesh* aMesh = 0;
if (aPathActor)
- aMesh = aPathActor->GetObject()->GetMesh();
+ aMesh = aPathActor->GetObject()->GetMesh();
if (aMesh) {
- //mySelectionMgr->clearSelected();
- //mySelectionMgr->AddIObject(aPathActor->getIO());
+ //mySelectionMgr->clearSelected();
+ //mySelectionMgr->AddIObject(aPathActor->getIO());
SALOME_ListIO aList;
aList.Append(aPathActor->getIO());
mySelectionMgr->setSelectedObjects(aList, false);
- bool bOk;
- long ind = theNewText.toLong(&bOk);
- if (bOk) {
- const SMDS_MeshNode* n = aMesh->FindNode(ind);
- if (n) {
- //if (!mySelectionMgr->IsIndexSelected(aPathActor->getIO(), n->GetID())) {
+ bool bOk;
+ long ind = theNewText.toLong(&bOk);
+ if (bOk) {
+ const SMDS_MeshNode* n = aMesh->FindNode(ind);
+ if (n) {
+ //if (!mySelectionMgr->IsIndexSelected(aPathActor->getIO(), n->GetID())) {
TColStd_MapOfInteger newIndices;
- newIndices.Add(n->GetID());
- mySelector->AddOrRemoveIndex( aPathActor->getIO(), newIndices, false );
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( aPathActor->getIO(), true, true );
- }
- }
+ newIndices.Add(n->GetID());
+ mySelector->AddOrRemoveIndex( aPathActor->getIO(), newIndices, false );
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->highlight( aPathActor->getIO(), true, true );
+ }
+ }
}
}
}
TopoDS_Vertex aVertex;
if (!aGeomObj->_is_nil()) {
if (aGeomObj->IsShape() && GEOMBase::GetShape(aGeomObj, aVertex) && !aVertex.IsNull()) {
- gp_Pnt aPnt = BRep_Tool::Pnt(aVertex);
- XSpin->SetValue(aPnt.X());
- YSpin->SetValue(aPnt.Y());
- ZSpin->SetValue(aPnt.Z());
+ gp_Pnt aPnt = BRep_Tool::Pnt(aVertex);
+ XSpin->SetValue(aPnt.X());
+ YSpin->SetValue(aPnt.Y());
+ ZSpin->SetValue(aPnt.Z());
}
return;
}
SMESH::SetPointRepresentation(false);
if (MeshCheck->isChecked()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(ActorSelection);
+ aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(myElementsFilter);
} else {
if (Elements1dRB->isChecked())
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
- }
+ {
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(EdgeSelection);
+ }
else if (Elements2dRB->isChecked())
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- }
+ {
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
+ }
}
} else if (button == SelectPathMeshButton) {
myEditCurrentArgument = PathMeshLineEdit;
if (!myPath->_is_nil()) {
SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPath);
if (aPathActor) {
- SMESH::SetPointRepresentation(true);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(NodeSelection);
- SMESH::SetPickable(aPathActor);
+ SMESH::SetPointRepresentation(true);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(NodeSelection);
+ SMESH::SetPickable(aPathActor);
}
}
}
QKeyEvent* ke = (QKeyEvent*)event;
if (object == AnglesList) {
if (ke->key() == Qt::Key_Delete)
- OnAngleRemoved();
+ OnAngleRemoved();
}
}
else if (event->type() == QEvent::FocusIn) {
if (object == ElementsLineEdit) {
if (myEditCurrentArgument != ElementsLineEdit)
- SetEditCurrentArgument(SelectElementsButton);
+ SetEditCurrentArgument(SelectElementsButton);
}
else if (object == StartPointLineEdit) {
if (myEditCurrentArgument != StartPointLineEdit)
- SetEditCurrentArgument(SelectStartPointButton);
+ SetEditCurrentArgument(SelectStartPointButton);
}
else if (object == XSpin->editor() || object == YSpin->editor() || object == ZSpin->editor()) {
if (myEditCurrentArgument != XSpin)
- SetEditCurrentArgument(SelectBasePointButton);
+ SetEditCurrentArgument(SelectBasePointButton);
}
}
return QDialog::eventFilter(object, event);
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
+ tr("SMESH_ERROR"),
+ tr("NO_MESH_SELECTED"));
return;
}
if ( !myFilterDlg )
enableLinear = false;
anItem->text().toDouble(&enableLinear);
if( !enableLinear )
- break;
+ break;
}
}
if( !enableLinear )
{
GroupArguments->setTitle(tr("EXTRUSION_1D"));
if (!CheckBoxMesh->isChecked())
- {
- LineEditElements->clear();
- myIDs.clear();
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
- }
+ {
+ LineEditElements->clear();
+ myIDs.clear();
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(EdgeSelection);
+ }
break;
}
case 1:
{
GroupArguments->setTitle(tr("EXTRUSION_2D"));
if (!CheckBoxMesh->isChecked())
- {
- LineEditElements->clear();
- myIDs.clear();
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- }
+ {
+ LineEditElements->clear();
+ myIDs.clear();
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
+ }
break;
}
}
aParameters << SpinBox_Dz->text();
} else if ( RadioButton4->isChecked() ) {
gp_XYZ aNormale(SpinBox_Vx->GetValue(),
- SpinBox_Vy->GetValue(),
- SpinBox_Vz->GetValue());
+ SpinBox_Vy->GetValue(),
+ SpinBox_Vz->GetValue());
aNormale /= aNormale.Modulus();
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
if( CheckBoxMesh->isChecked() ) {
- if( GetConstructorId() == 0 )
- SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionSweepObject1DMakeGroups(mySelectedObject, aVector, aNbSteps);
- else
- SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionSweepObject2DMakeGroups(mySelectedObject, aVector, aNbSteps);
- }
- else
- SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
+ if( GetConstructorId() == 0 )
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionSweepObject1DMakeGroups(mySelectedObject, aVector, aNbSteps);
+ else
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionSweepObject2DMakeGroups(mySelectedObject, aVector, aNbSteps);
+ }
+ else
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
}
else {
- if( CheckBoxMesh->isChecked() ) {
- if( GetConstructorId() == 0 )
- aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps);
- else
- aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps);
- }
- else
- aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
+ if( CheckBoxMesh->isChecked() ) {
+ if( GetConstructorId() == 0 )
+ aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps);
+ else
+ aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps);
+ }
+ else
+ aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
}
- myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
} catch (...) {
}
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
myElementsId->length( myNbOkElements = newIndices.Extent() );
mySelector->AddOrRemoveIndex(myIO, newIndices, false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( myIO, true, true );
+ aViewWindow->highlight( myIO, true, true );
}
}
aNbElements = aMapIndex.Extent();
if (aNbElements < 1)
- return;
+ return;
myElementsId = new SMESH::long_array;
myElementsId->length( aNbElements );
myEditCurrentArgument = (QWidget*)LineEditElements;
if (CheckBoxMesh->isChecked()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(ActorSelection);
+ aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
} else {
int aConstructorId = GetConstructorId();
if (aConstructorId == 0)
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
- }
+ {
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(EdgeSelection);
+ }
else if (aConstructorId == 1)
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- }
+ {
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
+ }
}
}
else if (send == SelectVectorButton){
int aConstructorId = GetConstructorId();
if (aConstructorId == 0)
{
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(EdgeSelection);
}
else if (aConstructorId == 1)
{
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
}
LineEditElements->setReadOnly(false);
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
+ tr("SMESH_ERROR"),
+ tr("NO_MESH_SELECTED"));
return;
}
if ( !myFilterDlg )
if (aWg->isEnabled() && aWg->validator()->validate(aText, p) != QValidator::Acceptable) {
if (theMsg)
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("SMESHGUI_INVALID_PARAMETERS"));
+ tr("SMESHGUI_INVALID_PARAMETERS"));
return false;
}
}
~ComboDelegate();
QWidget* createEditor( QWidget*, const QStyleOptionViewItem&,
- const QModelIndex& ) const;
+ const QModelIndex& ) const;
void setEditorData( QWidget*, const QModelIndex& ) const;
void setModelData( QWidget*, QAbstractItemModel*, const QModelIndex& ) const;
void updateEditorGeometry( QWidget*, const QStyleOptionViewItem&,
- const QModelIndex& ) const;
+ const QModelIndex& ) const;
private:
QTableWidget* myTable;
};
}
QWidget* SMESHGUI_FilterTable::ComboDelegate::createEditor( QWidget* parent,
- const QStyleOptionViewItem& option,
- const QModelIndex& index ) const
+ const QStyleOptionViewItem& option,
+ const QModelIndex& index ) const
{
QStringList l = index.data( Qt::UserRole ).toStringList();
if ( !l.isEmpty() ) {
}
void SMESHGUI_FilterTable::ComboDelegate::setEditorData( QWidget* editor,
- const QModelIndex& index ) const
+ const QModelIndex& index ) const
{
QString value = index.model()->data( index, Qt::DisplayRole ).toString();
QComboBox* cb = dynamic_cast<QComboBox*>( editor );
}
void SMESHGUI_FilterTable::ComboDelegate::setModelData( QWidget* editor,
- QAbstractItemModel* model,
- const QModelIndex& index) const
+ QAbstractItemModel* model,
+ const QModelIndex& index) const
{
QComboBox* cb = dynamic_cast<QComboBox*>( editor );
if ( cb ) model->setData( index, cb->currentText(), Qt::DisplayRole );
}
void SMESHGUI_FilterTable::ComboDelegate::updateEditorGeometry( QWidget* editor,
- const QStyleOptionViewItem& option,
- const QModelIndex& index ) const
+ const QStyleOptionViewItem& option,
+ const QModelIndex& index ) const
{
editor->setGeometry( option.rect );
}
void SMESHGUI_FilterTable::Table::setReadOnly( bool on )
{
setEditTriggers( on ?
- QAbstractItemView::NoEditTriggers :
- QAbstractItemView::AllEditTriggers );
+ QAbstractItemView::NoEditTriggers :
+ QAbstractItemView::AllEditTriggers );
}
bool SMESHGUI_FilterTable::Table::isReadOnly() const
theCriterion.Threshold = (double)((ComboItem*)aTable->item(theRow, 2))->value();
else if ( aCriterionType != SMESH::FT_RangeOfIds &&
aCriterionType != SMESH::FT_BelongToGeom &&
- aCriterionType != SMESH::FT_BelongToPlane &&
- aCriterionType != SMESH::FT_BelongToCylinder &&
- aCriterionType != SMESH::FT_BelongToGenSurface &&
- aCriterionType != SMESH::FT_LyingOnGeom)
+ aCriterionType != SMESH::FT_BelongToPlane &&
+ aCriterionType != SMESH::FT_BelongToCylinder &&
+ aCriterionType != SMESH::FT_BelongToGenSurface &&
+ aCriterionType != SMESH::FT_LyingOnGeom)
{
theCriterion.Compare = ((ComboItem*)aTable->item(theRow, 1))->value();
theCriterion.Threshold = aTable->item(theRow, 2)->text().toDouble();
aText.toDouble(&isOk);
aTable->item( row, 2 )->setText(isOk ? aText : QString(""));
if (!aTable->isEditable(row, 1))
- aTable->setEditable(true, row, 1);
+ aTable->setEditable(true, row, 1);
if (!aTable->isEditable(row, 2))
- aTable->setEditable(true, row, 2);
+ aTable->setEditable(true, row, 2);
}
}
}
static int aLenCr = qAbs( aMaxLenCr -
- aMetrics.width(tr("CRITERION"))) / aMetrics.width(' ') + 5;
+ aMetrics.width(tr("CRITERION"))) / aMetrics.width(' ') + 5;
QString aCrStr;
aCrStr.fill(' ', aLenCr);
aTable->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
connect(aTable, SIGNAL(cellChanged(int, int)),
- this, SLOT(onCriterionChanged(int, int)));
+ this, SLOT(onCriterionChanged(int, int)));
connect(aTable, SIGNAL(currentCellChanged(int, int, int, int)),
- this, SLOT(onCurrentChanged(int, int)));
+ this, SLOT(onCurrentChanged(int, int)));
return aTable;
}
Table* aTable = anIter.value();
for (int i = 0, n = aTable->rowCount(); i < n; i++)
for (int j = 0, m = aTable->columnCount(); j < m; j++)
- {
- QTableWidgetItem* anItem = aTable->item(i, j);
- if ( dynamic_cast<SMESHGUI_FilterTable::CheckItem*>( anItem ) ) {
- Qt::ItemFlags f = anItem->flags();
- if (!isEditable) f = f & ~Qt::ItemIsUserCheckable;
- else f = f | Qt::ItemIsUserCheckable;
- anItem->setFlags( f );
- }
- }
+ {
+ QTableWidgetItem* anItem = aTable->item(i, j);
+ if ( dynamic_cast<SMESHGUI_FilterTable::CheckItem*>( anItem ) ) {
+ Qt::ItemFlags f = anItem->flags();
+ if (!isEditable) f = f & ~Qt::ItemIsUserCheckable;
+ else f = f | Qt::ItemIsUserCheckable;
+ anItem->setFlags( f );
+ }
+ }
//end of IPAL19974
if (isEditable)
// Purpose : Get text and internal value from cell of ID value
//=======================================================================
bool SMESHGUI_FilterTable::GetID( const int theRow,
- QString& theText,
- const int theEntityType )
+ QString& theText,
+ const int theEntityType )
{
Table* aTable = myTables[ theEntityType == -1 ? GetType() : theEntityType ];
QTableWidgetItem* anItem = aTable->item( theRow, 5 );
mySetInViewer->setChecked(true);
mySourceGrp->button(myApplyToState.contains(theTypes.first()) ?
- myApplyToState[ theTypes.first() ] :
- Selection)->setChecked(true);
+ myApplyToState[ theTypes.first() ] :
+ Selection)->setChecked(true);
}
//=======================================================================
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
SMESH::GetActiveStudyDocument()->FindObjectByName(aName.toLatin1().constData(), "GEOM");
if (aList.size() == 0) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("BAD_SHAPE_NAME").arg(aName));
+ tr("BAD_SHAPE_NAME").arg(aName));
return false;
}
aFace.IsNull() ||
aFace.ShapeType() != TopAbs_FACE) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("SHAPE_IS_NOT_A_FACE").arg(aName));
+ tr("SHAPE_IS_NOT_A_FACE").arg(aName));
return false;
}
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aFace));
if (aSurf.IsNull()) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("SHAPE_IS_NOT_A_FACE").arg(aName));
+ tr("SHAPE_IS_NOT_A_FACE").arg(aName));
return false;
}
if (aType == SMESH::FT_BelongToPlane && !aSurf->IsKind(STANDARD_TYPE(Geom_Plane))) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("SHAPE_IS_NOT_A_PLANE").arg(aName));
+ tr("SHAPE_IS_NOT_A_PLANE").arg(aName));
return false;
}
if (aType == SMESH::FT_BelongToCylinder && !aSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("SHAPE_IS_NOT_A_CYLINDER").arg(aName));
+ tr("SHAPE_IS_NOT_A_CYLINDER").arg(aName));
return false;
}
}
//=======================================================================
void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_var theMesh)
{
- myMesh = theMesh;
+ if ( !theMesh->_is_nil() ) {
+ myMesh = theMesh;
+ if ( !myFilter[ myTable->GetType() ]->_is_nil() && !myFilter[ myTable->GetType() ]->GetPredicate()->_is_nil() ) {
+ SMESH::Predicate_ptr aPred = myFilter[ myTable->GetType() ]->GetPredicate();
+ aPred->SetMesh(myMesh);
+ }
+ }
const bool isEnable = !(myMesh->_is_nil());
myButtons[BTN_OK]->setEnabled(isEnable);
myButtons[BTN_Apply]->setEnabled(isEnable);
const int = -1 );
void SetID( const int,
- const QString&,
- const int = -1 );
+ const QString&,
+ const int = -1 );
bool GetID( const int,
- QString&,
- const int = -1 );
+ QString&,
+ const int = -1 );
void Update();
connect(myOpenBtn, SIGNAL(clicked()), this, SLOT(onBrowse()));
connect(myListBox, SIGNAL(itemSelectionChanged()),
- this, SLOT(onFilterChanged()));
+ this, SLOT(onFilterChanged()));
connect(myAddBtn, SIGNAL(clicked()), this, SLOT(onAddBtnPressed()));
connect(myDeleteBtn, SIGNAL(clicked()), this, SLOT(onDeleteBtnPressed()));
if (myLibrary->_is_nil()) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
- tr("LIBRARY_IS_NOT_LOADED"));
+ tr("LIBRARY_IS_NOT_LOADED"));
return false;
}
} else if (myMode == EDIT || myMode == ADD_TO) {
SMESH::Filter_var aFilter = createFilter();
if (!myListBox->selectedItems().empty() &&
- !myLibrary->Replace(myCurrFilterName.toLatin1().constData(),
- myName->text().toLatin1().constData(),
- aFilter.in())) {
+ !myLibrary->Replace(myCurrFilterName.toLatin1().constData(),
+ myName->text().toLatin1().constData(),
+ aFilter.in())) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
- tr("ERROR_OF_EDITING"));
+ tr("ERROR_OF_EDITING"));
aResult = false;
}
else
delete aFileName;
} else if (myMode != COPY_FROM) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
- tr("ERROR_OF_SAVING"));
+ tr("ERROR_OF_SAVING"));
} else {
}
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
if (myLibrary->_is_nil()) {
if (myMode == COPY_FROM) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
- tr("ERROR_LOAD"));
+ tr("ERROR_LOAD"));
return;
} else {
myLibrary = aFilterMgr->CreateLibrary();
if (aCurrName.isEmpty()) {
if (theMess)
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("EMPTY_FILTER_NAME"));
+ tr("EMPTY_FILTER_NAME"));
return false;
}
if (aNames[ f ] == aCurrName && aNames[ f ] != myCurrFilterName) {
if (theMess)
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("ERROR_FILTER_NAME"));
+ tr("ERROR_FILTER_NAME"));
return false;
}
}
if (!isWritable) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
- tr("NO_PERMISSION"));
+ tr("NO_PERMISSION"));
return false;
}
SMESH::Filter_var aFilter = createFilter();
myLibrary->Replace(myCurrFilterName.toLatin1().constData(),
- myName->text().toLatin1().constData(),
- aFilter);
+ myName->text().toLatin1().constData(),
+ aFilter);
}
// Fill table with filter parameters
SMESH::Filter_var aFilter = createFilter();
myLibrary->Replace(myCurrFilterName.toLatin1().constData(),
- myName->text().toLatin1().constData(),
- aFilter);
+ myName->text().toLatin1().constData(),
+ aFilter);
}
myTable->Clear(myTable->GetType());
{
if (myLibrary->_is_nil()) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
- tr("LIBRARY_IS_NOT_LOADED"));
+ tr("LIBRARY_IS_NOT_LOADED"));
return;
}
if (!aResult) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
- tr("ERROR_OF_ADDING"));
+ tr("ERROR_OF_ADDING"));
}
updateList();
if (theName != aName)
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WARNING"),
- tr("ASSIGN_NEW_NAME").arg(theName).arg(aName));
+ tr("ASSIGN_NEW_NAME").arg(theName).arg(aName));
}
//=======================================================================
{
if (myLibrary->_is_nil()) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
- tr("LIBRARY_IS_NOT_LOADED"));
+ tr("LIBRARY_IS_NOT_LOADED"));
return;
}
if (anIndex == -1 || !myLibrary->Delete(myCurrFilterName.toLatin1().constData())) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
- tr("ERROR_OF_DELETING"));
+ tr("ERROR_OF_DELETING"));
} else {
myCurrFilterName = "";
myCurrFilter = -1;
{
SMESH::Filter_var aFilter = createFilter(myTable->GetType());
myLibrary->Replace(myCurrFilterName.toLatin1().constData(),
- myName->text().toLatin1().constData(),
- aFilter);
+ myName->text().toLatin1().constData(),
+ aFilter);
}
}
}
SMESH::SMESH_subMesh_var aSubmesh =
SObjectToInterface<SMESH::SMESH_subMesh>( theMeshOrSubmesh );
if ( !aSubmesh->_is_nil() )
- return aSubmesh->GetSubShape();
+ return aSubmesh->GetSubShape();
}
}
return GEOM::GEOM_Object::_nil();
SALOMEDS_SObject* aRefSO = _CAST(SObject,aRefSOClient);
aMeshShape = GEOM::GEOM_Object::_narrow(aRefSO->GetObject());
} else {
- SALOMEDS_SObject* aSO = _CAST(SObject,aSObject);
+ SALOMEDS_SObject* aSO = _CAST(SObject,aSObject);
aMeshShape = GEOM::GEOM_Object::_narrow(aSO->GetObject());
}
// purpose :
//=================================================================================
SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
- SMESH::SMESH_Mesh_ptr theMesh )
+ SMESH::SMESH_Mesh_ptr theMesh )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
myIsBusy( false ),
- myNameChanged( false ),
- myActor( 0 )
+ myNameChanged( false )
{
initDialog( true );
if ( !theMesh->_is_nil() )
// purpose :
//=================================================================================
SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
- SMESH::SMESH_GroupBase_ptr theGroup,
+ SMESH::SMESH_GroupBase_ptr theGroup,
const bool theIsConvert )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
QLabel* aColorLab = new QLabel(tr( "SMESH_CHECK_COLOR" ), aColorBox );
myColorBtn = new QtxColorButton(aColorBox);
myColorBtn->setSizePolicy( QSizePolicy::MinimumExpanding,
- myColorBtn->sizePolicy().verticalPolicy() );
+ myColorBtn->sizePolicy().verticalPolicy() );
aColorBoxLayout->addWidget(aColorLab);
aColorBoxLayout->addWidget(myColorBtn);
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onClose()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
+ connect(mySMESHGUI, SIGNAL(SignalVisibilityChanged()), this, SLOT(onVisibilityChanged()));
rb1->setChecked(true); // VSR !!!
onGrpTypeChanged(0); // VSR!!!
// actor of theGroup, if it is visible, else try
// any visible actor of group or submesh of myMesh
// commented, because an attempt to set selection on not displayed cells leads to error
- //SetAppropriateActor();
- myActor = SMESH::FindActorByObject(myMesh);
- if ( !myActor )
- myActor = SMESH::FindActorByObject(theGroup);
- SMESH::SetPickable(myActor);
+ SetAppropriateActor();
+
+ /* SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
+ if ( !anActor )
+ anActor = SMESH::FindActorByObject(theGroup);
+ SMESH::SetPickable(anActor);*/
int grpType = (!myGroup->_is_nil() ? 0 : (theIsConvert ? 0 : 1));
myGrpTypeGroup->button(grpType)->setChecked(true);
if (mySelectionMode != theMode) {
// [PAL10408] mySelectionMgr->clearSelected();
mySelectionMgr->clearFilters();
- if (myActor)
- myActor->SetPointRepresentation(false);
+ if (myActorsList.count() > 0) {
+ QListIterator<SMESH_Actor*> it( myActorsList );
+ while ( it.hasNext() )
+ it.next()->SetPointRepresentation(false);
+ }
else
SMESH::SetPointRepresentation(false);
if (theMode < 4) {
switch (theMode) {
case 0:
- if (myActor)
- myActor->SetPointRepresentation(true);
- else
- SMESH::SetPointRepresentation(true);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(NodeSelection);
- break;
+ if (myActorsList.count() > 0) {
+ QListIterator<SMESH_Actor*> it( myActorsList );
+ while ( it.hasNext() )
+ it.next()->SetPointRepresentation(true);
+ }
+ else
+ SMESH::SetPointRepresentation(true);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(NodeSelection);
+ break;
case 1:
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
- break;
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(EdgeSelection);
+ break;
case 2:
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- break;
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
+ break;
default:
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(VolumeSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(VolumeSelection);
}
} else {
if (theMode == 4)
- mySelectionMgr->installFilter(mySubMeshFilter);
+ mySelectionMgr->installFilter(mySubMeshFilter);
else if (theMode == 5)
- mySelectionMgr->installFilter(myGroupFilter);
+ mySelectionMgr->installFilter(myGroupFilter);
else if (theMode == 6)
- mySelectionMgr->installFilter(myMeshFilter);
+ mySelectionMgr->installFilter(myMeshFilter);
else if (theMode == 7)
- mySelectionMgr->installFilter(myGeomFilter);
+ mySelectionMgr->installFilter(myGeomFilter);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(ActorSelection);
+ aViewWindow->SetSelectionMode(ActorSelection);
}
mySelectionMode = theMode;
}
if (myMesh->_is_nil())
return false;
myGroup = myMesh->ConvertToStandalone( myGroupOnGeom );
- // nullify pointer, because object become dead
+ // nullify pointer, because object become dead
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
}
}
int i, k = myElements->count();
anIdList->length(k);
for (i = 0; i < k; i++) {
- anIdList[i] = myElements->item(i)->text().toInt();
+ anIdList[i] = myElements->item(i)->text().toInt();
}
myGroup = SMESH::AddGroup(myMesh, aType, myName->text());
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup);
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) {
- anActor->setName(myName->text().toLatin1().data());
- switch ( myTypeId ) {
- case 0: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
- case 1: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
- case 2:
- case 3: anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B ); break;
- }
+ anActor->setName(myName->text().toLatin1().data());
+ switch ( myTypeId ) {
+ case 0: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
+ case 1: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
+ case 2:
+ case 3: anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B ); break;
+ }
}
QList<int> aAddList;
int i, total = myElements->count();
for (i = 0; i < total; i++) {
- int anId = myElements->item(i)->text().toInt();
- int idx = myIdList.indexOf(anId);
- if ( idx == -1 )
- aAddList.append(anId);
- else
- myIdList.removeAt(idx);
+ int anId = myElements->item(i)->text().toInt();
+ int idx = myIdList.indexOf(anId);
+ if ( idx == -1 )
+ aAddList.append(anId);
+ else
+ myIdList.removeAt(idx);
}
if (!aAddList.empty()) {
- SMESH::long_array_var anIdList = new SMESH::long_array;
- int added = aAddList.count();
- anIdList->length(added);
- for (i = 0; i < added; i++)
- anIdList[i] = aAddList[i];
- myGroup->Add(anIdList.inout());
+ SMESH::long_array_var anIdList = new SMESH::long_array;
+ int added = aAddList.count();
+ anIdList->length(added);
+ for (i = 0; i < added; i++)
+ anIdList[i] = aAddList[i];
+ myGroup->Add(anIdList.inout());
}
if (!myIdList.empty()) {
- SMESH::long_array_var anIdList = new SMESH::long_array;
- int removed = myIdList.count();
- anIdList->length(removed);
- for (i = 0; i < removed; i++)
- anIdList[i] = myIdList[i];
- myGroup->Remove(anIdList.inout());
+ SMESH::long_array_var anIdList = new SMESH::long_array;
+ int removed = myIdList.count();
+ anIdList->length(removed);
+ for (i = 0; i < removed; i++)
+ anIdList[i] = myIdList[i];
+ myGroup->Remove(anIdList.inout());
}
/* init for next operation */
myIdList.clear();
for (i = 0; i < total; i++) {
- myIdList.append(myElements->item(i)->text().toInt());
+ myIdList.append(myElements->item(i)->text().toInt());
}
}
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
GEOM::GEOM_IGroupOperations_var aGroupOp =
- SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+ SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
if (myGeomObjects->length() == 1) {
- myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
- myName->text().toLatin1().data(),
- myGeomObjects[0]);
+ myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
+ myName->text().toLatin1().data(),
+ myGeomObjects[0]);
}
else {
SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
aNewGeomGroupName += myName->text();
SALOMEDS::SObject_var aNewGroupSO =
geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar,
- aNewGeomGroupName.toLatin1().data(), aMeshShape);
+ aNewGeomGroupName.toLatin1().data(), aMeshShape);
}
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
- myName->text().toLatin1().data(),
- aGroupVar);
+ myName->text().toLatin1().data(),
+ aGroupVar);
}
SALOMEDS::Color aColor = getGroupColor();
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroupOnGeom);
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) {
- anActor->setName(myName->text().toLatin1().data());
- switch ( myTypeId ) {
- case 0: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
- case 1: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
- case 2:
- case 3: anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B ); break;
- }
+ anActor->setName(myName->text().toLatin1().data());
+ switch ( myTypeId ) {
+ case 0: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
+ case 1: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
+ case 2:
+ case 3: anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B ); break;
+ }
}
}
//=================================================================================
void SMESHGUI_GroupDlg::onListSelectionChanged()
{
- // MESSAGE( "SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor);
- if( myIsBusy || !myActor) return;
- myIsBusy = true;
+ //MESSAGE( "SMESHGUI_GroupDlg::onListSelectionChanged(); myActorsList.count() = " << myActorsList.count());
+ if( myIsBusy || myActorsList.count() == 0 ) return;
+ myIsBusy = true;
if (myCurrentLineEdit == 0) {
mySelectionMgr->clearSelected();
QList<QListWidgetItem*> selItems = myElements->selectedItems();
QListWidgetItem* anItem;
foreach(anItem, selItems) aIndexes.Add(anItem->text().toInt());
- mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, false);
+ mySelector->AddOrRemoveIndex(myActorsList.first()->getIO(), aIndexes, false);
SALOME_ListIO aList;
- aList.Append(myActor->getIO());
+ aList.Append(myActorsList.first()->getIO());
mySelectionMgr->setSelectedObjects(aList,false);
}
myIsBusy = false;
myGeomObjects->length(0);
if (myGeomGroupBtn->isChecked())
- myGeomGroupBtn->setChecked(false);
+ myGeomGroupBtn->setChecked(false);
if (!myCreate)
myName->setText( "" );
Handle(SALOME_InteractiveObject) IO = aList.First();
if (myCreate) {
- restoreShowEntityMode();
- myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
+ restoreShowEntityMode();
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
setShowEntityMode();
updateGeomPopup();
if (myMesh->_is_nil())
- {
+ {
updateButtons();
- myIsBusy = false;
- return;
- }
+ myIsBusy = false;
+ return;
+ }
+
+ if ( myFilterDlg && !myMesh->_is_nil()){
+ myFilterDlg->SetMesh( myMesh );
+ }
myGroup = SMESH::SMESH_Group::_nil();
// NPAL19389: create a group with a selection in another group
else {
SMESH::SMESH_GroupBase_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
if (aGroup->_is_nil())
- {
- myIsBusy = false;
+ {
+ myIsBusy = false;
return;
- }
+ }
myIsBusy = false;
- myCurrentLineEdit = 0;
- myGroup = SMESH::SMESH_Group::_nil();
- myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
+ myGroup = SMESH::SMESH_Group::_nil();
+ myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
init(aGroup);
myIsBusy = true;
if (myGrpTypeId == 0)
{
- if (myTypeId == -1)
- onTypeChanged(0);
- else
- {
- myElements->clear();
- setSelectionMode(myTypeId);
- }
+ if (myTypeId == -1)
+ onTypeChanged(0);
+ else
+ {
+ myElements->clear();
+ setSelectionMode(myTypeId);
+ }
}
myIsBusy = false;
if (aNbSel == 0 || !aMeshSO)
{
- myGeomObjects->length(0);
- updateButtons();
- myIsBusy = false;
- return;
+ myGeomObjects->length(0);
+ updateButtons();
+ myIsBusy = false;
+ return;
}
myGeomObjects->length(aNbSel);
myGeomObjects->length(i);
if ( i == 0 )
- {
- myIsBusy = false;
- return;
- }
+ {
+ myIsBusy = false;
+ return;
+ }
aNbSel = i;
}
}
else // !myCurrentLineEdit: local selection of nodes or elements
{
- if (aNbSel == 1 && myActor && myActor->hasIO())
+ if (aNbSel == 1 && myActorsList.count() > 0 )
{
-#ifdef ENABLE_SWITCH_ACTOR_DURING_ELEMENTS_SELECTION
// NPAL19389: create a group with a selection in another group
// Switch myActor to the newly selected one, if the last
// is visible and belongs to group or submesh of myMesh
- Handle(SALOME_InteractiveObject) curIO = myActor->getIO();
+ /* Handle(SALOME_InteractiveObject) curIO = myActor->getIO();
Handle(SALOME_InteractiveObject) selIO = aList.First();
if (curIO->hasEntry() && selIO->hasEntry()) {
const char* selEntry = selIO->getEntry();
}
}
}
- }
+ }*/
// NPAL19389 END
-#endif // ENABLE_SWITCH_ACTOR_DURING_ELEMENTS_SELECTION
QString aListStr = "";
int aNbItems = 0;
if (myTypeId == 0) {
- aNbItems = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
+ QListIterator<SMESH_Actor*> it( myActorsList );
+ while ( it.hasNext() ) {
+ QString tmpStr;
+ aNbItems += SMESH::GetNameOfSelectedNodes(mySelector, it.next()->getIO(), tmpStr);
+ aListStr += tmpStr;
+ }
} else {
- aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr);
+ QListIterator<SMESH_Actor*> it( myActorsList );
+ while ( it.hasNext() ) {
+ QString tmpStr;
+ aNbItems += SMESH::GetNameOfSelectedElements(mySelector, it.next()->getIO(), tmpStr);
+ aListStr += tmpStr;
+ }
}
if (aNbItems > 0) {
- QListWidgetItem* anItem;
- QList<QListWidgetItem*> listItemsToSel;
- QStringList anElements = aListStr.split( " ", QString::SkipEmptyParts);
- for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
- QList<QListWidgetItem*> found = myElements->findItems(*it, Qt::MatchExactly);
- foreach(anItem, found)
- if (!anItem->isSelected())
- listItemsToSel.push_back(anItem);
- }
- bool blocked = myElements->signalsBlocked();
- myElements->blockSignals(true);
- foreach(anItem, listItemsToSel) anItem->setSelected(true);
- myElements->blockSignals(blocked);
- onListSelectionChanged();
- listItemsToSel.clear();
+ QListWidgetItem* anItem;
+ QList<QListWidgetItem*> listItemsToSel;
+ QStringList anElements = aListStr.split( " ", QString::SkipEmptyParts);
+ for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
+ QList<QListWidgetItem*> found = myElements->findItems(*it, Qt::MatchExactly);
+ foreach(anItem, found)
+ if (!anItem->isSelected())
+ listItemsToSel.push_back(anItem);
+ }
+ bool blocked = myElements->signalsBlocked();
+ myElements->blockSignals(true);
+ foreach(anItem, listItemsToSel) anItem->setSelected(true);
+ myElements->blockSignals(blocked);
+ onListSelectionChanged();
+ listItemsToSel.clear();
}
}
}
-
- if (!myActor) {
- if (!myGroup->_is_nil())
- myActor = SMESH::FindActorByObject(myGroup);
- else if(!myGroupOnGeom->_is_nil())
- myActor = SMESH::FindActorByObject(myGroupOnGeom);
- else
- myActor = SMESH::FindActorByObject(myMesh);
+
+ if (myActorsList.count() == 0) {
+ if (!myGroup->_is_nil()) {
+ SMESH_Actor* anActor = SMESH::FindActorByObject(myGroup);
+ if ( anActor )
+ myActorsList.append( anActor );
+ }
+ else if(!myGroupOnGeom->_is_nil()) {
+ SMESH_Actor* anActor = SMESH::FindActorByObject(myGroupOnGeom);
+ if ( anActor )
+ myActorsList.append( anActor );
+ }
+ else {
+ SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
+ if ( anActor )
+ myActorsList.append( anActor );
+ }
}
// somehow, if we display the mesh, while selecting from another actor,
// the mesh becomes pickable, and there is no way to select any element
- if (myActor)
- SMESH::SetPickable(myActor);
+ if (myActorsList.count() > 0) {
+ QListIterator<SMESH_Actor*> it( myActorsList );
+ while ( it.hasNext() ) {
+ SMESH_Actor* anActor = it.next();
+ if ( IsActorVisible(anActor) )
+ anActor->SetPickable(true);
+ }
+ }
myIsBusy = false;
}
QPushButton* send = (QPushButton*)sender();
myCurrentLineEdit = 0;
if (send == myMeshGroupBtn) {
- myCurrentLineEdit = myMeshGroupLine;
+ disconnect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
+ mySelectionMgr->clearSelected();
if (myCreate)
setSelectionMode(6);
else
setSelectionMode(5);
+ connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
+ myCurrentLineEdit = myMeshGroupLine;
onObjectSelectionChanged();
}
else if (send == mySubMeshBtn) {
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
+ tr("SMESH_ERROR"),
+ tr("NO_MESH_SELECTED"));
return;
}
int aNbSel = aList.Extent();
- if (aNbSel == 0 || !myActor || myMesh->_is_nil()) return;
+ if (aNbSel == 0 || myActorsList.count() == 0 || myMesh->_is_nil()) return;
myIsBusy = true;
QString aListStr = "";
int aNbItems = 0;
if (myTypeId == 0) {
- aNbItems = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
+ QListIterator<SMESH_Actor*> it( myActorsList );
+ while ( it.hasNext() ) {
+ QString tmpStr;
+ aNbItems += SMESH::GetNameOfSelectedNodes(mySelector, it.next()->getIO(), tmpStr);
+ aListStr += tmpStr;
+ }
}
else {
- aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr);
+ QListIterator<SMESH_Actor*> it( myActorsList );
+ while ( it.hasNext() ) {
+ QString tmpStr;
+ aNbItems += SMESH::GetNameOfSelectedElements(mySelector, it.next()->getIO(), tmpStr);
+ aListStr += tmpStr;
+ }
}
if (aNbItems > 0) {
QStringList anElements = aListStr.split( " ", QString::SkipEmptyParts);
for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
- QList<QListWidgetItem*> found = myElements->findItems(*it, Qt::MatchExactly);
- if (found.count() == 0) {
- anItem = new QListWidgetItem(*it);
- myElements->addItem(anItem);
- if (!anItem->isSelected())
- listItemsToSel.push_back(anItem);
- }
- else {
- foreach(anItem, found)
- if (!anItem->isSelected())
- listItemsToSel.push_back(anItem);
- }
+ QList<QListWidgetItem*> found = myElements->findItems(*it, Qt::MatchExactly);
+ if (found.count() == 0) {
+ anItem = new QListWidgetItem(*it);
+ myElements->addItem(anItem);
+ if (!anItem->isSelected())
+ listItemsToSel.push_back(anItem);
+ }
+ else {
+ foreach(anItem, found)
+ if (!anItem->isSelected())
+ listItemsToSel.push_back(anItem);
+ }
}
bool blocked = myElements->signalsBlocked();
myElements->blockSignals(true);
SMESH::SMESH_subMesh_var aSubMesh =
SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
if (!aSubMesh->_is_nil()) {
- // check if mesh is the same
- if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
+ // check if mesh is the same
+ if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
try {
SMESH::long_array_var anElements = aSubMesh->GetElementsByType(aType);
int k = anElements->length();
if (found.count() == 0) {
anItem = new QListWidgetItem(aText);
myElements->addItem(anItem);
- if (!anItem->isSelected())
- listItemsToSel.push_back(anItem);
+ if (!anItem->isSelected())
+ listItemsToSel.push_back(anItem);
+ }
+ else {
+ foreach(anItem, found)
+ if (!anItem->isSelected())
+ listItemsToSel.push_back(anItem);
}
- else {
- foreach(anItem, found)
- if (!anItem->isSelected())
- listItemsToSel.push_back(anItem);
- }
}
- bool blocked = myElements->signalsBlocked();
- myElements->blockSignals(true);
- foreach(anItem, listItemsToSel) anItem->setSelected(true);
- myElements->blockSignals(blocked);
- onListSelectionChanged();
- listItemsToSel.clear();
+ bool blocked = myElements->signalsBlocked();
+ myElements->blockSignals(true);
+ foreach(anItem, listItemsToSel) anItem->setSelected(true);
+ myElements->blockSignals(blocked);
+ onListSelectionChanged();
+ listItemsToSel.clear();
}
catch (const SALOME::SALOME_Exception& ex) {
SalomeApp_Tools::QtCatchCorbaException(ex);
SMESH::SMESH_GroupBase_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIt.Value());
if (!aGroup->_is_nil()) {
- // check if mesh is the same
- if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
- SMESH::long_array_var anElements = aGroup->GetListOfID();
- int k = anElements->length();
- for (int i = 0; i < k; i++) {
- QString aText = QString::number(anElements[i]);
- QList<QListWidgetItem*> found = myElements->findItems(aText, Qt::MatchExactly);
- if (found.count() == 0) {
- anItem = new QListWidgetItem(aText);
- myElements->addItem(anItem);
- if (!anItem->isSelected())
- listItemsToSel.push_back(anItem);
- }
- else {
- foreach(anItem, found)
- if (!anItem->isSelected())
- listItemsToSel.push_back(anItem);
- }
- }
- bool blocked = myElements->signalsBlocked();
- myElements->blockSignals(true);
- foreach(anItem, listItemsToSel) anItem->setSelected(true);
- myElements->blockSignals(blocked);
- onListSelectionChanged();
- listItemsToSel.clear();
- }
+ // check if mesh is the same
+ if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
+ SMESH::long_array_var anElements = aGroup->GetListOfID();
+ int k = anElements->length();
+ for (int i = 0; i < k; i++) {
+ QString aText = QString::number(anElements[i]);
+ QList<QListWidgetItem*> found = myElements->findItems(aText, Qt::MatchExactly);
+ if (found.count() == 0) {
+ anItem = new QListWidgetItem(aText);
+ myElements->addItem(anItem);
+ if (!anItem->isSelected())
+ listItemsToSel.push_back(anItem);
+ }
+ else {
+ foreach(anItem, found)
+ if (!anItem->isSelected())
+ listItemsToSel.push_back(anItem);
+ }
+ }
+ bool blocked = myElements->signalsBlocked();
+ myElements->blockSignals(true);
+ foreach(anItem, listItemsToSel) anItem->setSelected(true);
+ myElements->blockSignals(blocked);
+ onListSelectionChanged();
+ listItemsToSel.clear();
+ }
}
}
mySelectGroup->setChecked(false);
int k = anElements->length();
for (int i = 0; i < k; i++) {
- QString aText = QString::number(anElements[i]);
- QList<QListWidgetItem*> found = myElements->findItems(aText, Qt::MatchExactly);
- if (found.count() == 0) {
- anItem = new QListWidgetItem(aText);
- myElements->addItem(anItem);
- if (!anItem->isSelected())
- listItemsToSel.push_back(anItem);
- }
- else {
- foreach(anItem, found)
- if (!anItem->isSelected())
- listItemsToSel.push_back(anItem);
- }
+ QString aText = QString::number(anElements[i]);
+ QList<QListWidgetItem*> found = myElements->findItems(aText, Qt::MatchExactly);
+ if (found.count() == 0) {
+ anItem = new QListWidgetItem(aText);
+ myElements->addItem(anItem);
+ if (!anItem->isSelected())
+ listItemsToSel.push_back(anItem);
+ }
+ else {
+ foreach(anItem, found)
+ if (!anItem->isSelected())
+ listItemsToSel.push_back(anItem);
+ }
}
bool blocked = myElements->signalsBlocked();
myElements->blockSignals(true);
SALOME_ListIteratorOfListIO anIt (aList);
for ( ; anIt.More(); anIt.Next()) {
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
- if (!aSubMesh->_is_nil()) {
- // check if mesh is the same
- if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
- if (aType == SMESH::NODE) {
- try {
- SMESH::long_array_var anElements = aSubMesh->GetNodesId();
- int k = anElements->length();
- for (int i = 0; i < k; i++) {
- QList<QListWidgetItem*> found =
- myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly);
- QListWidgetItem* anItem;
- foreach(anItem, found) delete anItem;
- }
- }
- catch (const SALOME::SALOME_Exception& ex) {
- SalomeApp_Tools::QtCatchCorbaException(ex);
- }
- }
- else {
- try {
- SMESH::long_array_var anElements = aSubMesh->GetElementsId();
- int k = anElements->length();
- for (int i = 0; i < k; i++) {
- QList<QListWidgetItem*> found =
- myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly);
- QListWidgetItem* anItem;
- foreach(anItem, found) delete anItem;
- }
- }
- catch (const SALOME::SALOME_Exception& ex) {
- SalomeApp_Tools::QtCatchCorbaException(ex);
- }
- }
- }
- }
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
+ if (!aSubMesh->_is_nil()) {
+ // check if mesh is the same
+ if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
+ if (aType == SMESH::NODE) {
+ try {
+ SMESH::long_array_var anElements = aSubMesh->GetNodesId();
+ int k = anElements->length();
+ for (int i = 0; i < k; i++) {
+ QList<QListWidgetItem*> found =
+ myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly);
+ QListWidgetItem* anItem;
+ foreach(anItem, found) delete anItem;
+ }
+ }
+ catch (const SALOME::SALOME_Exception& ex) {
+ SalomeApp_Tools::QtCatchCorbaException(ex);
+ }
+ }
+ else {
+ try {
+ SMESH::long_array_var anElements = aSubMesh->GetElementsId();
+ int k = anElements->length();
+ for (int i = 0; i < k; i++) {
+ QList<QListWidgetItem*> found =
+ myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly);
+ QListWidgetItem* anItem;
+ foreach(anItem, found) delete anItem;
+ }
+ }
+ catch (const SALOME::SALOME_Exception& ex) {
+ SalomeApp_Tools::QtCatchCorbaException(ex);
+ }
+ }
+ }
+ }
}
}
else if (myCurrentLineEdit == myGroupLine) {
SALOME_ListIteratorOfListIO anIt (aList);
for ( ; anIt.More(); anIt.Next()) {
- SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
- if (aRes && !aGroup->_is_nil()) {
- // check if mesh is the same
- if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
- SMESH::long_array_var anElements = aGroup->GetListOfID();
- int k = anElements->length();
- for (int i = 0; i < k; i++) {
- QList<QListWidgetItem*> found =
- myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly);
- QListWidgetItem* anItem;
- foreach(anItem, found) delete anItem;
- }
- }
- }
+ SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
+ if (aRes && !aGroup->_is_nil()) {
+ // check if mesh is the same
+ if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
+ SMESH::long_array_var anElements = aGroup->GetListOfID();
+ int k = anElements->length();
+ for (int i = 0; i < k; i++) {
+ QList<QListWidgetItem*> found =
+ myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly);
+ QListWidgetItem* anItem;
+ foreach(anItem, found) delete anItem;
+ }
+ }
+ }
}
}
}
int id = myElements->item(i)->text().toInt();
anArray[i] = id;
if (myElements->item(i)->isSelected())
- aSelected.append(id);
+ aSelected.append(id);
}
// sort & update list
std::sort(anArray.begin(), anArray.end());
anItem = new QListWidgetItem(QString::number(anArray[i]));
myElements->addItem(anItem);
if (aSelected.contains(anArray[i]))
- listItemsToSel.push_back(anItem);
+ listItemsToSel.push_back(anItem);
}
bool blocked = myElements->signalsBlocked();
myElements->blockSignals(true);
onClose();
}
+//=================================================================================
+// function : onVisibilityChanged()
+// purpose :
+//=================================================================================
+void SMESHGUI_GroupDlg::onVisibilityChanged()
+{
+ SetAppropriateActor();
+}
+
//=================================================================================
// function : SMESHGUI_GroupDlg::onClose
// purpose : SLOT called when "Close" button pressed. Close dialog
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr( "WRN_WARNING" ),
- tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
- arg(app->resourceMgr()->stringValue( "ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
+ arg(app->resourceMgr()->stringValue( "ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
myCurrentLineEdit = myGeomGroupLine;
QAction* a = myGeomPopup->exec( QCursor::pos() );
if (!a || myActions[a] == DIRECT_GEOM_INDEX)
- setSelectionMode(7);
+ setSelectionMode(7);
}
else if (!isBtnOn)
{
{
mySelectionMode = -1;
if ( !myShapeByMeshOp ) {
- myShapeByMeshOp = new SMESHGUI_ShapeByMeshOp(true);
- connect(myShapeByMeshOp, SIGNAL(committed(SUIT_Operation*)),
- SLOT(onPublishShapeByMeshDlg(SUIT_Operation*)));
- connect(myShapeByMeshOp, SIGNAL(aborted(SUIT_Operation*)),
- SLOT(onCloseShapeByMeshDlg(SUIT_Operation*)));
+ myShapeByMeshOp = new SMESHGUI_ShapeByMeshOp(true);
+ connect(myShapeByMeshOp, SIGNAL(committed(SUIT_Operation*)),
+ SLOT(onPublishShapeByMeshDlg(SUIT_Operation*)));
+ connect(myShapeByMeshOp, SIGNAL(aborted(SUIT_Operation*)),
+ SLOT(onCloseShapeByMeshDlg(SUIT_Operation*)));
}
// set mesh object to SMESHGUI_ShapeByMeshOp and start it
if ( !myMesh->_is_nil() ) {
- myIsBusy = true;
+ myIsBusy = true;
hide(); // stop processing selection
- myIsBusy = false;
+ myIsBusy = false;
myShapeByMeshOp->setModule( mySMESHGUI );
myShapeByMeshOp->setStudy( 0 ); // it's really necessary
myShapeByMeshOp->SetMesh( myMesh );
QString ID = aGeomVar->GetStudyEntry();
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
if ( _PTR(SObject) aGeomSO = aStudy->FindObjectID( ID.toLatin1().data() )) {
- SALOME_ListIO anIOList;
- Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
- ( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() );
- anIOList.Append( anIO );
- mySelectionMgr->setSelectedObjects( anIOList, false );
- onObjectSelectionChanged();
+ SALOME_ListIO anIOList;
+ Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
+ ( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() );
+ anIOList.Append( anIO );
+ mySelectionMgr->setSelectedObjects( anIOList, false );
+ onObjectSelectionChanged();
}
}
}
void SMESHGUI_GroupDlg::setGroupColor( const SALOMEDS::Color& theColor )
{
QColor aQColor( (int)( theColor.R * 255.0 ),
- (int)( theColor.G * 255.0 ),
- (int)( theColor.B * 255.0 ) );
+ (int)( theColor.G * 255.0 ),
+ (int)( theColor.B * 255.0 ) );
setGroupQColor( aQColor );
}
SALOMEDS::Color aColor = SMESHGUI::getUniqueColor( aReservedColors );
aQColor.setRgb( (int)( aColor.R * 255.0 ),
- (int)( aColor.G * 255.0 ),
- (int)( aColor.B * 255.0 ) );
+ (int)( aColor.G * 255.0 ),
+ (int)( aColor.B * 255.0 ) );
}
bool SMESHGUI_GroupDlg::SetAppropriateActor()
{
bool isActor = false;
+ myActorsList.clear();
if (myMesh->_is_nil()) return false;
SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
- // try mesh actor
- myActor = SMESH::FindActorByObject(myMesh);
- if (myActor && myActor->hasIO())
- {
- isActor = true;
- if (aViewWindow && !aViewWindow->isVisible(myActor->getIO()))
- isActor = false;
- }
-
- // try current group actor
- if (!isActor) {
- if (!myGroup->_is_nil()) {
- myActor = SMESH::FindActorByObject(myGroup);
- if (myActor && myActor->hasIO())
- {
- isActor = true;
- if (aViewWindow && !aViewWindow->isVisible(myActor->getIO()))
- isActor = false;
+ if (myGeomGroupBtn->isChecked()) { // try current group on geometry actor
+ if (!isActor) {
+ if (!myGroupOnGeom->_is_nil()) {
+ SMESH_Actor* anActor = SMESH::FindActorByObject(myGroupOnGeom);
+ if (anActor && anActor->hasIO())
+ {
+ isActor = true;
+ if (aViewWindow && !aViewWindow->isVisible(anActor->getIO()))
+ isActor = false;
+ else
+ myActorsList.append(anActor);
+ }
}
}
- }
-
- // try current group on geometry actor
- if (!isActor) {
- if (!myGroupOnGeom->_is_nil()) {
- myActor = SMESH::FindActorByObject(myGroupOnGeom);
- if (myActor && myActor->hasIO())
+ } else {
+ // try mesh actor
+ SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
+ if (anActor && anActor->hasIO())
{
isActor = true;
- if (aViewWindow && !aViewWindow->isVisible(myActor->getIO()))
+ if (aViewWindow && !aViewWindow->isVisible(anActor->getIO()))
isActor = false;
+ else
+ myActorsList.append(anActor);
}
- }
- }
-
- // try any visible actor of group or submesh of current mesh
- if (!isActor && aViewWindow) {
- // mesh entry
- _PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
- if (aSObject) {
- CORBA::String_var meshEntry = aSObject->GetID().c_str();
- int len = strlen(meshEntry);
-
- // iterate on all actors in current view window, search for
- // any visible actor, that belongs to group or submesh of current mesh
- VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors());
- vtkActorCollection *aCollection = aCopy.GetActors();
- int nbItems = aCollection->GetNumberOfItems();
- for (int i=0; i<nbItems && !isActor; i++)
- {
- SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(aCollection->GetItemAsObject(i));
- if (anActor && anActor->hasIO()) {
- Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
- if (aViewWindow->isVisible(anIO)) {
- if (anIO->hasEntry() && strncmp(anIO->getEntry(), meshEntry, len) == 0) {
- myActor = anActor;
- isActor = true;
+
+ // try any visible actor of group or submesh of current mesh
+ if (aViewWindow) {
+ // mesh entry
+ _PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
+ if (aSObject) {
+ CORBA::String_var meshEntry = aSObject->GetID().c_str();
+ int len = strlen(meshEntry);
+
+ // iterate on all actors in current view window, search for
+ // any visible actor, that belongs to group or submesh of current mesh
+ VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors());
+ vtkActorCollection *aCollection = aCopy.GetActors();
+ int nbItems = aCollection->GetNumberOfItems();
+ for (int i=0; i<nbItems && !isActor; i++)
+ {
+ SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(aCollection->GetItemAsObject(i));
+ if (anActor && anActor->hasIO()) {
+ Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
+ if (aViewWindow->isVisible(anIO)) {
+ if (anIO->hasEntry() && strncmp(anIO->getEntry(), meshEntry, len) == 0)
+ myActorsList.append(anActor);
+ }
}
}
- }
}
}
}
-
- if (isActor)
- SMESH::SetPickable(myActor);
-
- return isActor;
+
+ if (myActorsList.count() > 0) {
+ QListIterator<SMESH_Actor*> it( myActorsList );
+ while ( it.hasNext() ) {
+ SMESH_Actor* anActor = it.next();
+ if ( IsActorVisible(anActor) )
+ anActor->SetPickable(true);
+ }
+ }
+
+ return ( isActor || (myActorsList.count() > 0) );
}
-
+
//=======================================================================
//function : setShowEntityMode
//purpose : make shown only entity corresponding to my type
}
myStoredShownEntity = 0;
}
+
+//=======================================================================
+//function : IsActorVisible
+//purpose : return visibility of the actor
+//=======================================================================
+bool SMESHGUI_GroupDlg::IsActorVisible( SMESH_Actor* theActor )
+{
+ SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
+ if (theActor && aViewWindow)
+ return aViewWindow->isVisible(theActor->getIO());
+ return false;
+}
public:
SMESHGUI_GroupDlg( SMESHGUI*,
- SMESH::SMESH_Mesh_ptr = SMESH::SMESH_Mesh::_nil() );
+ SMESH::SMESH_Mesh_ptr = SMESH::SMESH_Mesh::_nil() );
SMESHGUI_GroupDlg( SMESHGUI*,
- SMESH::SMESH_GroupBase_ptr,
+ SMESH::SMESH_GroupBase_ptr,
const bool theIsConvert = false );
~SMESHGUI_GroupDlg();
bool onApply();
void onHelp();
void onDeactivate();
+ void onVisibilityChanged();
void onListSelectionChanged();
void onObjectSelectionChanged();
bool SetAppropriateActor();
void setShowEntityMode();
void restoreShowEntityMode();
+
+ bool IsActorVisible( SMESH_Actor* );
void setGroupColor( const SALOMEDS::Color& );
SALOMEDS::Color getGroupColor() const;
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
- SMESH_Actor* myActor; /* Current mesh actor */
int myGrpTypeId; /* Current group type id : standalone or group on geometry */
int myTypeId; /* Current type id = radio button id */
int myStoredShownEntity; /* Store ShowEntity mode of myMesh */
SMESHGUI_ShapeByMeshOp* myShapeByMeshOp;
SMESH::SMESH_Mesh_var myMesh;
+ QList<SMESH_Actor*> myActorsList;
SMESH::SMESH_Group_var myGroup;
SMESH::SMESH_GroupOnGeom_var myGroupOnGeom;
QList<int> myIdList;
QLabel* aColorLab = new QLabel(tr( "SMESH_CHECK_COLOR" ), aColorBox );
myColorBtn = new QtxColorButton(aColorBox);
myColorBtn->setSizePolicy( QSizePolicy::MinimumExpanding,
- myColorBtn->sizePolicy().verticalPolicy() );
+ myColorBtn->sizePolicy().verticalPolicy() );
aColorBoxLayout->addWidget(aColorLab);
aColorBoxLayout->addWidget(myColorBtn);
if ( theListGrp.isEmpty() )
{
SUIT_MessageBox::information( this, tr("SMESH_INSUFFICIENT_DATA"),
- tr("INCORRECT_ARGUMENTS") );
+ tr("INCORRECT_ARGUMENTS") );
return false;
}
if ( aMeshId == -1 )
{
SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"),
- tr("DIFF_MESHES"));
+ tr("DIFF_MESHES"));
return false;
}
if ( aGrpType == -1 )
{
SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"),
- tr("DIFF_TYPES"));
+ tr("DIFF_TYPES"));
return false;
}
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
else
{
SUIT_MessageBox::critical(this, tr("SMESH_ERROR"),
- tr("SMESH_OPERATION_FAILED"));
+ tr("SMESH_OPERATION_FAILED"));
return false;
}
}
else
{
SUIT_MessageBox::critical(this, tr("SMESH_ERROR"),
- tr("SMESH_OPERATION_FAILED"));
+ tr("SMESH_OPERATION_FAILED"));
return false;
}
}
else
{
SUIT_MessageBox::critical(this, tr("SMESH_ERROR"),
- tr("SMESH_OPERATION_FAILED"));
+ tr("SMESH_OPERATION_FAILED"));
return false;
}
}
else
{
SUIT_MessageBox::critical(this, tr("SMESH_ERROR"),
- tr("SMESH_OPERATION_FAILED"));
+ tr("SMESH_OPERATION_FAILED"));
return false;
}
}
namespace SMESH
{
SMESH::SMESH_Group_var AddGroup( SMESH::SMESH_Mesh_ptr theMesh,
- SMESH::ElementType theType,
- const QString& theGroupName )
+ SMESH::ElementType theType,
+ const QString& theGroupName )
{
SMESH::SMESH_Group_var aGroup;
try {
if ( !theMesh->_is_nil() )
- aGroup = theMesh->CreateGroup( theType, theGroupName.toLatin1().data() );
+ aGroup = theMesh->CreateGroup( theType, theGroupName.toLatin1().data() );
}
catch( const SALOME::SALOME_Exception& S_ex ) {
SalomeApp_Tools::QtCatchCorbaException( S_ex );
{
SMESHGUI_EXPORT
SMESH::SMESH_Group_var AddGroup( SMESH::SMESH_Mesh_ptr,
- SMESH::ElementType,
- const QString& );
+ SMESH::ElementType,
+ const QString& );
}
#endif // SMESHGUI_GROUPUTILS_H
}
void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
- const QString& theHypName,
+ const QString& theHypName,
QWidget* parent, QObject* obj, const QString& slot )
{
MESSAGE( "Creation of hypothesis with initial params" );
}
void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
- const QString& theHypName,
- QWidget* theParent, QObject* obj, const QString& slot )
+ const QString& theHypName,
+ QWidget* theParent, QObject* obj, const QString& slot )
{
MESSAGE( "Creation of hypothesis" );
}
void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHypothesis,
- const QString& theHypName,
- QWidget* theParent, QObject* obj, const QString& slot )
+ const QString& theHypName,
+ QWidget* theParent, QObject* obj, const QString& slot )
{
if( CORBA::is_nil( theHypothesis ) )
return;
}
void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h,
- const QString& theHypName,
- QWidget* theParent,
+ const QString& theHypName,
+ QWidget* theParent,
QObject* obj, const QString& slot )
{
myHypName = theHypName;
case QVariant::Int:
{
SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
- sb->setObjectName( (*anIt).myName );
+ sb->setObjectName( (*anIt).myName );
attuneStdWidget( sb, i );
sb->setValue( (*anIt).myValue.toInt() );
connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
case QVariant::Double:
{
SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
- sb->setObjectName( (*anIt).myName );
+ sb->setObjectName( (*anIt).myName );
attuneStdWidget( sb, i );
sb->setValue( (*anIt).myValue.toDouble() );
connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
if( listSOmesh.size() > 0 )
for( int i = 0; i < listSOmesh.size(); i++ )
{
- _PTR(SObject) submSO = listSOmesh[i];
- SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
- if( !aSubMesh->_is_nil() )
- aMesh = aSubMesh->GetFather();
- _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
- SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
+ _PTR(SObject) submSO = listSOmesh[i];
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
+ if( !aSubMesh->_is_nil() )
+ aMesh = aSubMesh->GetFather();
+ _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
+ SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
}
}
SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
myHypo = SMESH::SMESH_Hypothesis::_nil();
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
- myDlg->close(); myDlg = 0;
- //delete myDlg; myDlg = 0;
+
+ disconnect( myDlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
+ myDlg->close();
+ //delete myDlg;
+ myDlg = 0;
emit finished( result );
}
aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
else if ( aHypType == "Arithmetic1D")
aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
- else if ( aHypType == "FixedPointsc1D")
+ else if ( aHypType == "FixedPoints1D")
aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
else if ( aHypType == "MaxElementArea")
aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
aHelpFileName = "projection_algos_page.html";
else if ( aHypType == "NumberOfLayers")
aHelpFileName = "radial_prism_algo_page.html";
+ else if ( aHypType == "NumberOfLayers2D")
+ aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
else if ( aHypType == "LayerDistribution")
aHelpFileName = "radial_prism_algo_page.html";
+ else if ( aHypType == "LayerDistribution2D")
+ aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
else if ( aHypType == "SegmentLengthAroundVertex")
aHelpFileName = "segments_around_vertex_algo_page.html";
-
+ else if ( aHypType == "QuadrangleParams")
+ aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
return aHelpFileName;
}
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
}
HypothesisData::HypothesisData( const QString& theTypeName,
- const QString& thePluginName,
- const QString& theServerLibName,
- const QString& theClientLibName,
- const QString& theLabel,
- const QString& theIconId,
- const QList<int>& theDim,
- const bool theIsAux,
- const QStringList& theNeededHypos,
- const QStringList& theOptionalHypos,
- const QStringList& theInputTypes,
- const QStringList& theOutputTypes,
- const bool theIsNeedGeometry,
+ const QString& thePluginName,
+ const QString& theServerLibName,
+ const QString& theClientLibName,
+ const QString& theLabel,
+ const QString& theIconId,
+ const QList<int>& theDim,
+ const bool theIsAux,
+ const QStringList& theNeededHypos,
+ const QStringList& theOptionalHypos,
+ const QStringList& theInputTypes,
+ const QStringList& theOutputTypes,
+ const bool theIsNeedGeometry,
const bool supportSub)
: TypeName( theTypeName ),
PluginName( thePluginName ),
}
HypothesesSet::HypothesesSet( const QString& theSetName,
- const QStringList& theHypoList,
- const QStringList& theAlgoList )
+ const QStringList& theHypoList,
+ const QStringList& theAlgoList )
: myHypoSetName( theSetName ),
myHypoList( theHypoList ),
myAlgoList( theAlgoList ),
virtual ~SMESHGUI_GenericHypothesisCreator();
void create( SMESH::SMESH_Hypothesis_ptr,
- const QString&, QWidget*, QObject*, const QString& );
+ const QString&, QWidget*, QObject*, const QString& );
void create( bool, const QString&, QWidget*, QObject*, const QString& );
void edit( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*, QObject*, const QString& );
void setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
QString getShapeEntry() const { return myShapeEntry; }
void setShapeEntry( const QString& theEntry );
+ QString getMainShapeEntry() const { return myMainShapeEntry; }
+ void setMainShapeEntry( const QString& theEntry ) { myMainShapeEntry = theEntry; }
+
signals:
void finished( int );
static QString stdParamValues( const ListOfStdParams& );
virtual void attuneStdWidget( QWidget*, const int ) const;
virtual QWidget* getCustomWidget( const StdParam&,
- QWidget*, const int ) const;
+ QWidget*, const int ) const;
virtual bool getParamFromCustomWidget( StdParam&, QWidget* ) const;
virtual void valueChanged( QWidget* );
virtual QString caption() const;
bool myIsCreate;
QtxDialog* myDlg;
QString myShapeEntry;
+ QString myMainShapeEntry;
};
class SMESHGUI_HypothesisDlg : public QtxDialog
const QList<int>&, const bool,
const QStringList&, const QStringList&,
const QStringList&, const QStringList&,
- const bool=true, const bool supportSub=false );
+ const bool=true, const bool supportSub=false );
QString TypeName; //!< hypothesis type name
QString PluginName; //!< plugin name
QList<HypothesesSet*> myListOfHypothesesSets;
void processHypothesisStatus(const int theHypStatus,
- SMESH::SMESH_Hypothesis_ptr theHyp,
- const bool theIsAddition)
+ SMESH::SMESH_Hypothesis_ptr theHyp,
+ const bool theIsAddition)
{
if (theHypStatus > SMESH::HYP_OK) {
// get Hyp name
QString aHypName ("NULL Hypothesis");
if (!CORBA::is_nil(theHyp)) {
- _PTR(SObject) Shyp = SMESH::FindSObject(theHyp);
- if (Shyp)
- // name in study
- aHypName = Shyp->GetName().c_str();
- else
- // label in xml file
- aHypName = GetHypothesisData(theHyp->GetName())->Label;
+ _PTR(SObject) Shyp = SMESH::FindSObject(theHyp);
+ if (Shyp)
+ // name in study
+ aHypName = Shyp->GetName().c_str();
+ else
+ // label in xml file
+ aHypName = GetHypothesisData(theHyp->GetName())->Label;
}
// message
bool isFatal = (theHypStatus >= SMESH::HYP_UNKNOWN_FATAL);
QString aMsg;
if (theIsAddition)
- aMsg = (isFatal ? "SMESH_CANT_ADD_HYP" : "SMESH_ADD_HYP_WRN");
+ aMsg = (isFatal ? "SMESH_CANT_ADD_HYP" : "SMESH_ADD_HYP_WRN");
else
- aMsg = (isFatal ? "SMESH_CANT_RM_HYP" : "SMESH_RM_HYP_WRN");
+ aMsg = (isFatal ? "SMESH_CANT_RM_HYP" : "SMESH_RM_HYP_WRN");
aMsg = QObject::tr(aMsg.toLatin1().data()).arg(aHypName) +
- QObject::tr(QString("SMESH_HYP_%1").arg(theHypStatus).toLatin1().data());
+ QObject::tr(QString("SMESH_HYP_%1").arg(theHypStatus).toLatin1().data());
if ( theHypStatus == SMESH::HYP_HIDDEN_ALGO ) // PAL18501
aMsg = aMsg.arg( GetHypothesisData(theHyp->GetName())->Dim[0] );
SUIT_MessageBox::warning(SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- aMsg);
+ QObject::tr("SMESH_WRN_WARNING"),
+ aMsg);
}
}
QString HypsXml;
char* cenv = getenv("SMESH_MeshersList");
if (cenv)
- HypsXml.sprintf("%s", cenv);
+ HypsXml.sprintf("%s", cenv);
QStringList HypsXmlList = HypsXml.split(":", QString::SkipEmptyParts);
if (HypsXmlList.count() == 0) {
- SUIT_MessageBox::critical(SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("MESHERS_FILE_NO_VARIABLE"));
- return;
+ SUIT_MessageBox::critical(SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("MESHERS_FILE_NO_VARIABLE"));
+ return;
}
// loop on files in HypsXml
QString aNoAccessFiles;
for (int i = 0; i < HypsXmlList.count(); i++) {
- QString HypsXml = HypsXmlList[ i ];
+ QString HypsXml = HypsXmlList[ i ];
- // Find full path to the resource XML file
- QString xmlFile = resMgr->path("resources", "SMESH", HypsXml + ".xml");
+ // Find full path to the resource XML file
+ QString xmlFile = resMgr->path("resources", "SMESH", HypsXml + ".xml");
if ( xmlFile.isEmpty() ) // try PLUGIN resources
xmlFile = resMgr->path("resources", HypsXml, HypsXml + ".xml");
- QFile file (xmlFile);
- if (file.exists() && file.open(QIODevice::ReadOnly)) {
- file.close();
-
- SMESHGUI_XmlHandler* aXmlHandler = new SMESHGUI_XmlHandler();
- ASSERT(aXmlHandler);
-
- QXmlInputSource source (&file);
- QXmlSimpleReader reader;
- reader.setContentHandler(aXmlHandler);
- reader.setErrorHandler(aXmlHandler);
- bool ok = reader.parse(source);
- file.close();
- if (ok) {
- myHypothesesMap.unite( aXmlHandler->myHypothesesMap );
+ QFile file (xmlFile);
+ if (file.exists() && file.open(QIODevice::ReadOnly)) {
+ file.close();
+
+ SMESHGUI_XmlHandler* aXmlHandler = new SMESHGUI_XmlHandler();
+ ASSERT(aXmlHandler);
+
+ QXmlInputSource source (&file);
+ QXmlSimpleReader reader;
+ reader.setContentHandler(aXmlHandler);
+ reader.setErrorHandler(aXmlHandler);
+ bool ok = reader.parse(source);
+ file.close();
+ if (ok) {
+ myHypothesesMap.unite( aXmlHandler->myHypothesesMap );
myAlgorithmsMap.unite( aXmlHandler->myAlgorithmsMap );
- QList<HypothesesSet*>::iterator it, pos = myListOfHypothesesSets.begin();
- for ( it = aXmlHandler->myListOfHypothesesSets.begin();
- it != aXmlHandler->myListOfHypothesesSets.end();
- ++it ) {
- myListOfHypothesesSets.insert( pos, *it );
- }
- }
- else {
- SUIT_MessageBox::critical(SMESHGUI::desktop(),
- QObject::tr("INF_PARSE_ERROR"),
- QObject::tr(aXmlHandler->errorProtocol().toLatin1().data()));
- }
+ QList<HypothesesSet*>::iterator it, pos = myListOfHypothesesSets.begin();
+ for ( it = aXmlHandler->myListOfHypothesesSets.begin();
+ it != aXmlHandler->myListOfHypothesesSets.end();
+ ++it ) {
+ myListOfHypothesesSets.insert( pos, *it );
+ }
+ }
+ else {
+ SUIT_MessageBox::critical(SMESHGUI::desktop(),
+ QObject::tr("INF_PARSE_ERROR"),
+ QObject::tr(aXmlHandler->errorProtocol().toLatin1().data()));
+ }
delete aXmlHandler;
- }
- else {
- if (aNoAccessFiles.isEmpty())
- aNoAccessFiles = xmlFile;
- else
- aNoAccessFiles += ", " + xmlFile;
- }
+ }
+ else {
+ if (aNoAccessFiles.isEmpty())
+ aNoAccessFiles = xmlFile;
+ else
+ aNoAccessFiles += ", " + xmlFile;
+ }
} // end loop
if (!aNoAccessFiles.isEmpty()) {
- QString aMess = QObject::tr("MESHERS_FILE_CANT_OPEN") + " " + aNoAccessFiles + "\n";
- aMess += QObject::tr("MESHERS_FILE_CHECK_VARIABLE");
- wc.suspend();
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- aMess);
- wc.resume();
+ QString aMess = QObject::tr("MESHERS_FILE_CANT_OPEN") + " " + aNoAccessFiles + "\n";
+ aMess += QObject::tr("MESHERS_FILE_CHECK_VARIABLE");
+ wc.suspend();
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ aMess);
+ wc.resume();
}
}
}
for ( anIter = pMap.begin(); anIter != pMap.end(); anIter++ ) {
HypothesisData* aData = anIter.value();
if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux) {
- if (checkGeometry) {
- if (aData->IsNeedGeometry == isNeedGeometry)
- aHypList.append(anIter.key());
- }
- else {
- aHypList.append(anIter.key());
- }
+ if (checkGeometry) {
+ if (aData->IsNeedGeometry == isNeedGeometry)
+ aHypList.append(anIter.key());
+ }
+ else {
+ aHypList.append(anIter.key());
+ }
}
}
return aHypList;
QList<HypothesesSet*>::iterator hypoSet;
for ( hypoSet = myListOfHypothesesSets.begin();
- hypoSet != myListOfHypothesesSets.end();
- ++hypoSet ) {
+ hypoSet != myListOfHypothesesSets.end();
+ ++hypoSet ) {
HypothesesSet* aSet = *hypoSet;
if ( aSet && aSet->count( true ) ) {
- aSetNameList.append( aSet->name() );
+ aSetNameList.append( aSet->name() );
}
}
{
QList<HypothesesSet*>::iterator hypoSet;
for ( hypoSet = myListOfHypothesesSets.begin();
- hypoSet != myListOfHypothesesSets.end();
- ++hypoSet ) {
+ hypoSet != myListOfHypothesesSets.end();
+ ++hypoSet ) {
HypothesesSet* aSet = *hypoSet;
if ( aSet && aSet->name() == theSetName )
- return aSet;
+ return aSet;
}
return 0;
}
// 3. Load Client Plugin Library
try {
- // load plugin library
- if(MYDEBUG) MESSAGE("Loading client meshers plugin library ...");
- LibHandle libHandle = LoadLib( aClientLibName.toLatin1().data() );
- if (!libHandle) {
- // report any error, if occured
- if ( MYDEBUG ) {
+ // load plugin library
+ if(MYDEBUG) MESSAGE("Loading client meshers plugin library ...");
+ LibHandle libHandle = LoadLib( aClientLibName.toLatin1().data() );
+ if (!libHandle) {
+ // report any error, if occured
+ if ( MYDEBUG ) {
#ifdef WIN32
- const char* anError = "Can't load client meshers plugin library";
+ const char* anError = "Can't load client meshers plugin library";
#else
- const char* anError = dlerror();
+ const char* anError = dlerror();
#endif
- MESSAGE(anError);
- }
- }
- else {
- // get method, returning hypothesis creator
- if(MYDEBUG) MESSAGE("Find GetHypothesisCreator() method ...");
- typedef SMESHGUI_GenericHypothesisCreator* (*GetHypothesisCreator) \
- ( const QString& );
- GetHypothesisCreator procHandle =
- (GetHypothesisCreator)GetProc(libHandle, "GetHypothesisCreator");
- if (!procHandle) {
- if(MYDEBUG) MESSAGE("bad hypothesis client plugin library");
- UnLoadLib(libHandle);
- }
- else {
- // get hypothesis creator
- if(MYDEBUG) MESSAGE("Get Hypothesis Creator for " << aHypType.toLatin1().data());
- aCreator = procHandle( aHypType );
- if (!aCreator) {
- if(MYDEBUG) MESSAGE("no such a hypothesis in this plugin");
- }
- else {
- // map hypothesis creator to a hypothesis name
+ MESSAGE(anError);
+ }
+ }
+ else {
+ // get method, returning hypothesis creator
+ if(MYDEBUG) MESSAGE("Find GetHypothesisCreator() method ...");
+ typedef SMESHGUI_GenericHypothesisCreator* (*GetHypothesisCreator) \
+ ( const QString& );
+ GetHypothesisCreator procHandle =
+ (GetHypothesisCreator)GetProc(libHandle, "GetHypothesisCreator");
+ if (!procHandle) {
+ if(MYDEBUG) MESSAGE("bad hypothesis client plugin library");
+ UnLoadLib(libHandle);
+ }
+ else {
+ // get hypothesis creator
+ if(MYDEBUG) MESSAGE("Get Hypothesis Creator for " << aHypType.toLatin1().data());
+ aCreator = procHandle( aHypType );
+ if (!aCreator) {
+ if(MYDEBUG) MESSAGE("no such a hypothesis in this plugin");
+ }
+ else {
+ // map hypothesis creator to a hypothesis name
// BUG 0020378
- //myHypCreatorMap[aHypType] = aCreator;
- }
- }
- }
+ //myHypCreatorMap[aHypType] = aCreator;
+ }
+ }
+ }
}
catch (const SALOME::SALOME_Exception& S_ex) {
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
+ SalomeApp_Tools::QtCatchCorbaException(S_ex);
}
}
SMESH::SMESH_Hypothesis_ptr CreateHypothesis(const QString& aHypType,
- const QString& aHypName,
- const bool isAlgo)
+ const QString& aHypName,
+ const bool isAlgo)
{
if(MYDEBUG) MESSAGE("Create " << aHypType.toLatin1().data() <<
- " with name " << aHypName.toLatin1().data());
+ " with name " << aHypName.toLatin1().data());
HypothesisData* aHypData = GetHypothesisData(aHypType);
QString aServLib = aHypData->ServerLibName;
try {
SMESH::SMESH_Hypothesis_var aHypothesis;
aHypothesis = SMESHGUI::GetSMESHGen()->CreateHypothesis(aHypType.toLatin1().data(),
- aServLib.toLatin1().data());
+ aServLib.toLatin1().data());
if (!aHypothesis->_is_nil()) {
- _PTR(SObject) aHypSObject = SMESH::FindSObject(aHypothesis.in());
- if (aHypSObject) {
- if (!aHypName.isEmpty())
- SMESH::SetName(aHypSObject, aHypName);
- SMESHGUI::GetSMESHGUI()->updateObjBrowser();
- return aHypothesis._retn();
- }
+ _PTR(SObject) aHypSObject = SMESH::FindSObject(aHypothesis.in());
+ if (aHypSObject) {
+ if (!aHypName.isEmpty())
+ SMESH::SetName(aHypSObject, aHypName);
+ SMESHGUI::GetSMESHGUI()->updateObjBrowser();
+ return aHypothesis._retn();
+ }
}
} catch (const SALOME::SALOME_Exception & S_ex) {
SalomeApp_Tools::QtCatchCorbaException(S_ex);
_PTR(SObject) SM = SMESH::FindSObject(aMesh);
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(SM);
try {
- res = aMesh->AddHypothesis(aShapeObject, aHyp);
- if (res < SMESH::HYP_UNKNOWN_FATAL) {
- _PTR(SObject) aSH = SMESH::FindSObject(aHyp);
- if (SM && aSH) {
- SMESH::ModifiedMesh(SM, false, aMesh->NbNodes()==0);
- }
- }
- if (res > SMESH::HYP_OK) {
- wc.suspend();
- processHypothesisStatus(res, aHyp, true);
- wc.resume();
- }
+ res = aMesh->AddHypothesis(aShapeObject, aHyp);
+ if (res < SMESH::HYP_UNKNOWN_FATAL) {
+ _PTR(SObject) aSH = SMESH::FindSObject(aHyp);
+ if (SM && aSH) {
+ SMESH::ModifiedMesh(SM, false, aMesh->NbNodes()==0);
+ }
+ }
+ if (res > SMESH::HYP_OK) {
+ wc.suspend();
+ processHypothesisStatus(res, aHyp, true);
+ wc.resume();
+ }
}
catch(const SALOME::SALOME_Exception& S_ex) {
- wc.suspend();
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- res = SMESH::HYP_UNKNOWN_FATAL;
+ wc.suspend();
+ SalomeApp_Tools::QtCatchCorbaException(S_ex);
+ res = SMESH::HYP_UNKNOWN_FATAL;
}
}
return res < SMESH::HYP_UNKNOWN_FATAL;
if (!aSubMesh->_is_nil() && ! aHyp->_is_nil()) {
try {
- SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
- _PTR(SObject) SsubM = SMESH::FindSObject(aSubMesh);
- GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(SsubM);
- if (!aMesh->_is_nil() && SsubM && !aShapeObject->_is_nil()) {
- res = aMesh->AddHypothesis(aShapeObject, aHyp);
- if (res < SMESH::HYP_UNKNOWN_FATAL) {
+ SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
+ _PTR(SObject) SsubM = SMESH::FindSObject(aSubMesh);
+ GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(SsubM);
+ if (!aMesh->_is_nil() && SsubM && !aShapeObject->_is_nil()) {
+ res = aMesh->AddHypothesis(aShapeObject, aHyp);
+ if (res < SMESH::HYP_UNKNOWN_FATAL) {
_PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
if (meshSO)
SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
- }
- if (res > SMESH::HYP_OK) {
- wc.suspend();
- processHypothesisStatus(res, aHyp, true);
- wc.resume();
- }
- }
- else {
- SCRUTE(aHyp->_is_nil());
- SCRUTE(aMesh->_is_nil());
- SCRUTE(!SsubM);
- SCRUTE(aShapeObject->_is_nil());
- }
+ }
+ if (res > SMESH::HYP_OK) {
+ wc.suspend();
+ processHypothesisStatus(res, aHyp, true);
+ wc.resume();
+ }
+ }
+ else {
+ SCRUTE(aHyp->_is_nil());
+ SCRUTE(aMesh->_is_nil());
+ SCRUTE(!SsubM);
+ SCRUTE(aShapeObject->_is_nil());
+ }
}
catch(const SALOME::SALOME_Exception& S_ex) {
- wc.suspend();
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- res = SMESH::HYP_UNKNOWN_FATAL;
+ wc.suspend();
+ SalomeApp_Tools::QtCatchCorbaException(S_ex);
+ res = SMESH::HYP_UNKNOWN_FATAL;
}
}
else {
_PTR(Study) aStudy = GetActiveStudyDocument();
_PTR(SObject) aHypObj = aStudy->FindObjectID( IObject->getEntry() );
if( aHypObj )
- {
- _PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh( aHypObj );
- _PTR(SObject) aRealHypo;
- if( aHypObj->ReferencedObject( aRealHypo ) )
- {
- SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aRealHypo ) );
- RemoveHypothesisOrAlgorithmOnMesh( MorSM, hypo );
- }
- else
- {
- SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aHypObj ) );
- SObjectList meshList = GetMeshesUsingAlgoOrHypothesis( hypo );
- for( int i = 0; i < meshList.size(); i++ )
- RemoveHypothesisOrAlgorithmOnMesh( meshList[ i ], hypo );
- }
- }
+ {
+ _PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh( aHypObj );
+ _PTR(SObject) aRealHypo;
+ if( aHypObj->ReferencedObject( aRealHypo ) )
+ {
+ SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aRealHypo ) );
+ RemoveHypothesisOrAlgorithmOnMesh( MorSM, hypo );
+ }
+ else
+ {
+ SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aHypObj ) );
+ SObjectList meshList = GetMeshesUsingAlgoOrHypothesis( hypo );
+ for( int i = 0; i < meshList.size(); i++ )
+ RemoveHypothesisOrAlgorithmOnMesh( meshList[ i ], hypo );
+ }
+ }
}
catch(const SALOME::SALOME_Exception& S_ex)
{
- wc.suspend();
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- res = SMESH::HYP_UNKNOWN_FATAL;
+ wc.suspend();
+ SalomeApp_Tools::QtCatchCorbaException(S_ex);
+ res = SMESH::HYP_UNKNOWN_FATAL;
}
return res < SMESH::HYP_UNKNOWN_FATAL;
}
}
else if(!aMesh->HasShapeToMesh()){
res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
- if (res < SMESH::HYP_UNKNOWN_FATAL) {
+ if (res < SMESH::HYP_UNKNOWN_FATAL) {
_PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
if (meshSO)
SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
}
}
} catch(const SALOME::SALOME_Exception& S_ex) {
- wc.suspend();
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- res = SMESH::HYP_UNKNOWN_FATAL;
+ wc.suspend();
+ SalomeApp_Tools::QtCatchCorbaException(S_ex);
+ res = SMESH::HYP_UNKNOWN_FATAL;
}
}
return res < SMESH::HYP_UNKNOWN_FATAL;
if (!AlgoOrHyp->_is_nil()) {
_PTR(SObject) SO_Hypothesis = SMESH::FindSObject(AlgoOrHyp);
if (SO_Hypothesis) {
- SObjectList listSO =
- SMESHGUI::activeStudy()->studyDS()->FindDependances(SO_Hypothesis);
-
- if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency number ="<<listSO.size());
- for (unsigned int i = 0; i < listSO.size(); i++) {
- _PTR(SObject) SO = listSO[i];
- if (SO) {
- _PTR(SObject) aFather = SO->GetFather();
- if (aFather) {
- _PTR(SObject) SOfatherFather = aFather->GetFather();
- if (SOfatherFather) {
- if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency added to list");
- index++;
- listSOmesh.resize(index);
- listSOmesh[index - 1] = SOfatherFather;
- }
- }
- }
- }
+ SObjectList listSO =
+ SMESHGUI::activeStudy()->studyDS()->FindDependances(SO_Hypothesis);
+
+ if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency number ="<<listSO.size());
+ for (unsigned int i = 0; i < listSO.size(); i++) {
+ _PTR(SObject) SO = listSO[i];
+ if (SO) {
+ _PTR(SObject) aFather = SO->GetFather();
+ if (aFather) {
+ _PTR(SObject) SOfatherFather = aFather->GetFather();
+ if (SOfatherFather) {
+ if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency added to list");
+ index++;
+ listSOmesh.resize(index);
+ listSOmesh[index - 1] = SOfatherFather;
+ }
+ }
+ }
+ }
}
}
if (MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): completed");
QStringList GetAvailableHypotheses( const bool,
const int = -1,
const bool = false,
- const bool = true);
+ const bool = true);
SMESHGUI_EXPORT
QStringList GetHypothesesSets();
SMESHGUI_EXPORT
bool IsAvailableHypothesis( const HypothesisData*,
- const QString&,
- bool& );
+ const QString&,
+ bool& );
SMESHGUI_EXPORT
bool IsCompatibleAlgorithm( const HypothesisData*,
- const HypothesisData* );
+ const HypothesisData* );
SMESHGUI_EXPORT
SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& );
SMESHGUI_EXPORT
bool RemoveHypothesisOrAlgorithmOnMesh( _PTR(SObject),
- SMESH::SMESH_Hypothesis_ptr );
+ SMESH::SMESH_Hypothesis_ptr );
typedef std::vector<_PTR(SObject)> SObjectList;
SObjectList GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr );
// truncate extra ids
int ind = 0, nbId = 0;
while ( ind < input.length() ) {
- if ( input.at( ind ) != ' ' ) {
- if ( ++nbId > myMaxNbId ) {
- input.truncate( ind );
- break;
- }
- ind = input.indexOf( ' ', ind );
- if ( ind < 0 ) break;
- }
- ind++;
+ if ( input.at( ind ) != ' ' ) {
+ if ( ++nbId > myMaxNbId ) {
+ input.truncate( ind );
+ break;
+ }
+ ind = input.indexOf( ' ', ind );
+ if ( ind < 0 ) break;
+ }
+ ind++;
}
}
if ( pos > input.length() )
--- /dev/null
+// Copyright (C) 2007-2009 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SMESHGUI_Make2DFrom3DOp.cxx
+// Author : Open CASCADE S.A.S.
+// SMESH includes
+//
+#include "SMESHGUI_Make2DFrom3DOp.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_MeshInfosBox.h"
+
+// SALOME GUI includes
+#include <LightApp_SelectionMgr.h>
+
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_OverrideCursor.h>
+
+#include <SALOME_ListIO.hxx>
+
+// SALOME KERNEL includes
+#include <SALOMEDS_SObject.hxx>
+#include <SALOMEDSClient_SObject.hxx>
+
+// Qt includes
+// IDL includes
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Gen)
+#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
+
+#include <QFrame>
+#include <QLabel>
+#include <QPixmap>
+#include <QGroupBox>
+#include <QPushButton>
+#include <QVBoxLayout>
+
+// MESH includes
+#include "SMDSAbs_ElementType.hxx"
+#include "SMDSAbs_ElementType.hxx"
+
+
+#define SPACING 6
+#define MARGIN 11
+
+// =========================================================================================
+/*!
+ * \brief Dialog to show creted mesh statistic
+ */
+//=======================================================================
+
+SMESHGUI_Make2DFrom3DDlg::SMESHGUI_Make2DFrom3DDlg( QWidget* parent )
+ : SMESHGUI_Dialog( parent, false, true, Close/* | Help*/ )
+{
+ setWindowTitle( tr("CAPTION") );
+ QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame());
+ aDlgLay->setMargin( 0 );
+ aDlgLay->setSpacing( SPACING );
+ QFrame* aMainFrame = createMainFrame(mainFrame());
+ aDlgLay->addWidget(aMainFrame);
+ aDlgLay->setStretchFactor(aMainFrame, 1);
+}
+
+// =========================================================================================
+/*!
+ * \brief Dialog destructor
+ */
+//=======================================================================
+
+SMESHGUI_Make2DFrom3DDlg::~SMESHGUI_Make2DFrom3DDlg()
+{
+}
+
+//=======================================================================
+// function : createMainFrame()
+// purpose : Create frame containing dialog's fields
+//=======================================================================
+
+QFrame* SMESHGUI_Make2DFrom3DDlg::createMainFrame (QWidget* theParent)
+{
+ QFrame* aFrame = new QFrame(theParent);
+
+ SUIT_ResourceMgr* rm = resourceMgr();
+ QPixmap iconCompute (rm->loadPixmap("SMESH", tr("ICON_2D_FROM_3D")));
+
+ // Mesh name
+ QGroupBox* nameBox = new QGroupBox(tr("SMESH_MESHINFO_NAME"), aFrame );
+ QHBoxLayout* nameBoxLayout = new QHBoxLayout(nameBox);
+ nameBoxLayout->setMargin(MARGIN); nameBoxLayout->setSpacing(SPACING);
+ myMeshName = new QLabel(nameBox);
+ nameBoxLayout->addWidget(myMeshName);
+
+ // Mesh Info
+
+ myFullInfo = new SMESHGUI_MeshInfosBox(true, aFrame);
+
+ // add all widgets to aFrame
+ QVBoxLayout* aLay = new QVBoxLayout(aFrame);
+ aLay->setMargin( 0 );
+ aLay->setSpacing( 0 );
+ aLay->addWidget( nameBox );
+ aLay->addWidget( myFullInfo );
+
+ ((QPushButton*) button( OK ))->setDefault( true );
+ return aFrame;
+}
+
+//================================================================================
+/*!
+ * \brief set name of the mesh
+*/
+//================================================================================
+
+void SMESHGUI_Make2DFrom3DDlg::SetMeshName(const QString& theName)
+{
+ myMeshName->setText( theName );
+}
+
+//================================================================================
+/*!
+ * \brief set mesh info
+*/
+//================================================================================
+
+void SMESHGUI_Make2DFrom3DDlg::SetMeshInfo(const SMESH::long_array& theInfo)
+{
+ myFullInfo->SetMeshInfo( theInfo );
+}
+
+//================================================================================
+/*!
+ * \brief Constructor
+*/
+//================================================================================
+
+SMESHGUI_Make2DFrom3DOp::SMESHGUI_Make2DFrom3DOp()
+ : SMESHGUI_Operation()
+{
+ myDlg = new SMESHGUI_Make2DFrom3DDlg(desktop());
+}
+
+//================================================================================
+/*!
+ * \brief Desctructor
+*/
+//================================================================================
+
+SMESHGUI_Make2DFrom3DOp::~SMESHGUI_Make2DFrom3DOp()
+{
+}
+
+//================================================================================
+/*!
+ * \brief perform it's intention action: compute 2D mesh on 3D
+ */
+//================================================================================
+
+void SMESHGUI_Make2DFrom3DOp::startOperation()
+{
+ myMesh = SMESH::SMESH_Mesh::_nil();
+
+ // check selection
+ LightApp_SelectionMgr *Sel = selectionMgr();
+ SALOME_ListIO selected; Sel->selectedObjects( selected );
+
+ int nbSel = selected.Extent();
+ if (nbSel != 1) {
+ SUIT_MessageBox::warning(desktop(),
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_NO_AVAILABLE_DATA"));
+ onCancel();
+ return;
+ }
+
+ Handle(SALOME_InteractiveObject) anIO = selected.First();
+ myMesh = SMESH::GetMeshByIO(anIO);
+ if (myMesh->_is_nil()) {
+ SUIT_MessageBox::warning(desktop(),
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_NO_AVAILABLE_DATA"));
+ onCancel();
+ return;
+ }
+
+ SMESHGUI_Operation::startOperation();
+
+
+ // backup mesh info before 2D mesh computation
+ SMESH::long_array_var anOldInfo = myMesh->GetMeshInfo();
+
+
+ if (!compute2DMesh()) {
+ SUIT_MessageBox::warning(desktop(),
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_COMPUTE_FAILED"));
+ onCancel();
+ return;
+ }
+ // get new mesh statistic
+ SMESH::long_array_var aNewInfo = myMesh->GetMeshInfo();
+ // get difference in mesh statistic from old to new
+ for ( int i = SMDSEntity_Node; i < SMDSEntity_Last; i++ )
+ aNewInfo[i] -= anOldInfo[i];
+
+ // update presentation
+ SMESH::Update(anIO, SMESH::eDisplay);
+
+ // show computated result
+ _PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
+ if ( aMeshSObj )
+ myDlg->SetMeshName( aMeshSObj->GetName().c_str() );
+ myDlg->SetMeshInfo( aNewInfo );
+ myDlg->show(); /*exec();*/
+ commit();
+}
+
+//================================================================================
+/*!
+ * \brief compute 2D mesh on initial 3D
+ */
+//================================================================================
+
+bool SMESHGUI_Make2DFrom3DOp::compute2DMesh()
+{
+ SUIT_OverrideCursor wc;
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ return aMeshEditor->Make2DMeshFrom3D();
+}
--- /dev/null
+// Copyright (C) 2007-2009 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// SMESH SMESHGUI : GUI for SMESH component
+// File : SMESHGUI_Make2DFrom3D.h
+// Author : Open CASCADE S.A.S.
+//
+#ifndef SMESHGUI_Make2DFrom3DOp_H
+#define SMESHGUI_Make2DFrom3DOp_H
+
+// SMESH includes
+#include "SMESH_SMESHGUI.hxx"
+
+#include "SMESHGUI_Dialog.h"
+#include "SMESHGUI_Operation.h"
+
+// IDL includes
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+class QFrame;
+class SMESHGUI_MeshInfosBox;
+
+/*!
+ * \brief Dialog to show result mesh statistic
+ */
+
+class SMESHGUI_Make2DFrom3DDlg : public SMESHGUI_Dialog
+{
+ Q_OBJECT
+
+ public:
+ SMESHGUI_Make2DFrom3DDlg( QWidget* );
+ virtual ~SMESHGUI_Make2DFrom3DDlg();
+
+ void SetMeshName(const QString& theName);
+ void SetMeshInfo(const SMESH::long_array& theInfo);
+
+ private:
+ QFrame* createMainFrame( QWidget* );
+
+ private:
+ QLabel* myMeshName;
+ SMESHGUI_MeshInfosBox* myFullInfo;
+};
+
+
+/*!
+ * \brief Operation to compute 2D mesh on 3D
+ */
+
+class SMESHGUI_Make2DFrom3DOp : public SMESHGUI_Operation
+{
+ public:
+ SMESHGUI_Make2DFrom3DOp();
+ virtual ~SMESHGUI_Make2DFrom3DOp();
+
+ protected:
+ virtual void startOperation();
+
+ private:
+ bool compute2DMesh();
+
+ private:
+ SMESH::SMESH_Mesh_var myMesh;
+ QPointer<SMESHGUI_Make2DFrom3DDlg> myDlg;
+};
+
+#endif // SMESHGUI_Make2DFrom3DOp_H
connect(myAutoSearchChkBox, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
myMoveRBtn->setChecked(true);
- myIdBtn->setDown(true);
+ myIdBtn->setChecked(true);
myAutoSearchChkBox->setChecked(true);
return aFrame;
if ( aSender == myCoordBtn ) // button to set coord by node selection
{
if ( myIdBtn->isEnabled() )
- myIdBtn->setDown( !on );
+ myIdBtn->setChecked( !on );
}
else if ( aSender == myIdBtn ) // button to select a node to move
{
- myCoordBtn->setDown( !on );
+ myCoordBtn->setChecked( !on );
}
else if ( aSender == myMoveRBtn ) // move node method
{
else if ( aSender == myCreateRBtn ) // create node method
{
myNodeToMoveGrp->setEnabled( false );
- myCoordBtn->setDown( true );
+ myCoordBtn->setChecked( true );
}
}
if ( aSender == myAutoSearchChkBox ) // automatic node search
if ( on ) {
myId->setText("");
myId->setReadOnly ( true );
- myIdBtn->setDown( false );
+ myIdBtn->setChecked( false );
myIdBtn->setEnabled( false );
- myCoordBtn->setDown( true );
+ myCoordBtn->setChecked( true );
}
else {
myId->setReadOnly ( false );
if ( !myMeshActor ) {
SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
- tr("INVALID_MESH") );
+ tr("INVALID_MESH") );
dlg()->show();
return false;
}
if ( !isValid( msg ) ) { // node id is invalid
if( !msg.isEmpty() )
SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
- tr("INVALID_ID") );
+ tr("INVALID_ID") );
dlg()->show();
return false;
}
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
if (aMesh->_is_nil()) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
- tr("SMESHG_NO_MESH") );
+ tr("SMESHG_NO_MESH") );
return true;
}
SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
return true;
int aResult = 0;
- if ( myDlg->myCreateRBtn->isDown() )
+ if ( myDlg->myCreateRBtn->isChecked() )
{
aResult = aMeshEditor->AddNode(myDlg->myX->GetValue(),
myDlg->myY->GetValue(),
aParameters << myDlg->myX->text();
aParameters << myDlg->myY->text();
aParameters << myDlg->myZ->text();
- aMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
+ aMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
myDlg->myId->setText("");
{
bool ok = true;
if ( myMeshActor &&
- myDlg->myMoveRBtn->isDown() &&
+ myDlg->myMoveRBtn->isChecked() &&
!myDlg->myAutoSearchChkBox->isChecked() )
{
ok = false;
SMESH_Actor* aMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
if (!aMeshActor) { // coord by geom
- if ( myDlg->myCoordBtn->isDown() ) {
+ if ( myDlg->myCoordBtn->isChecked() ) {
GEOM::GEOM_Object_var geom = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
if ( !geom->_is_nil() ) {
TopoDS_Vertex aShape;
if (SMDS_Mesh* aMesh = aMeshActor->GetObject()->GetMesh()) {
if (const SMDS_MeshNode* aNode = aMesh->FindNode(aString.toInt())) {
myNoPreview = true;
- if ( myDlg->myCoordBtn->isDown() ) { // set coord
+ if ( myDlg->myCoordBtn->isChecked() ) { // set coord
myDlg->myX->SetValue(aNode->X());
myDlg->myY->SetValue(aNode->Y());
myDlg->myZ->SetValue(aNode->Z());
myNoPreview = false;
redisplayPreview();
}
- else if ( myDlg->myIdBtn->isDown() &&
+ else if ( myDlg->myIdBtn->isChecked() &&
myDlg->myIdBtn->isEnabled() ) { // set node to move
myDlg->myId->setText(aString);
myNoPreview = false;
SMESH::MeshPreviewStruct_var aMeshPreviewStruct;
bool moveShown = false;
- if ( myDlg->myMoveRBtn->isDown() && // Move method
+ if ( myDlg->myMoveRBtn->isChecked() && // Move method
myMeshActor)
{
const bool autoSearch = myDlg->myAutoSearchChkBox->isChecked();
myHypoSetButton->setText( tr( "HYPOTHESES_SETS" ) );
myHypoSetButton->setEnabled( false );
myHypoSetButton->setSizePolicy( QSizePolicy::MinimumExpanding,
- myHypoSetButton->sizePolicy().verticalPolicy() );
+ myHypoSetButton->sizePolicy().verticalPolicy() );
// Fill layout
QGridLayout* aLay = new QGridLayout( mainFrame() );
myGeomPopup->addAction( tr("DIRECT_GEOM_SELECTION") )->setData( DIRECT_GEOM_INDEX );
myGeomPopup->addAction( tr("GEOM_BY_MESH_ELEM_SELECTION") )->setData( GEOM_BY_MESH_INDEX );
connect( myGeomPopup, SIGNAL( triggered( QAction* ) ), SLOT( onGeomPopup( QAction* ) ) );
- connect( selBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) ));
+ connect( selBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) ));
}
}
else {
disconnect( selBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) ));
if ( myGeomPopup ) {
- delete myGeomPopup;
- myGeomPopup = 0;
+ delete myGeomPopup;
+ myGeomPopup = 0;
}
}
}
// =========================================================================================
SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent)
- : QGroupBox( tr("SMESH_MESHINFO_TITLE"), theParent ), myFull( full )
+: QGroupBox( tr("SMESH_MESHINFO_TITLE"), theParent ), myFull( full ),
+ myNbNode(0), my0DElem(0), myNbEdge(0), myNbLinEdge(0), myNbQuadEdge(0),
+ myNbTrai(0), myNbLinTrai(0), myNbQuadTrai(0), myNbQuad(0), myNbLinQuad(0),
+ myNbQuadQuad(0), myNbFace(0), myNbLinFace(0), myNbQuadFace(0), myNbPolyg(0),
+ myNbHexa(0), myNbLinHexa(0), myNbQuadHexa(0), myNbTetra(0), myNbLinTetra(0),
+ myNbQuadTetra(0), myNbPyra(0), myNbLinPyra(0), myNbQuadPyra(0), myNbPrism(0),
+ myNbLinPrism(0), myNbQuadPrism(0), myNbVolum(0), myNbLinVolum(0), myNbQuadVolum(0),
+ myNbPolyh(0)
{
QGridLayout* l = new QGridLayout(this);
l->setMargin( MARGIN );
myNbNode = new QLabel( this );
l->addWidget( myNbNode, row, 1 );
+ // 0D elements
+ row = l->rowCount(); // retrieve current row count
+ // --
+ lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_0DELEMS")), this );
+ l->addWidget( lab, row, 0 );
+ // --
+ my0DElem = new QLabel( this );
+ l->addWidget( my0DElem, row, 1 );
+
+ addSeparator(this); // add separator
+
// edges
row = l->rowCount(); // retrieve current row count
// --
// edges
myNbEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Edge] +
- theInfo[SMDSEntity_Quad_Edge] ));
+ theInfo[SMDSEntity_Quad_Edge] ));
myNbLinEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Edge] ));
myNbQuadEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Edge] ));
// faces
myNbFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] +
- theInfo[SMDSEntity_Quad_Triangle] +
- theInfo[SMDSEntity_Quadrangle] +
- theInfo[SMDSEntity_Quad_Quadrangle] +
- theInfo[SMDSEntity_Polygon] ));
+ theInfo[SMDSEntity_Quad_Triangle] +
+ theInfo[SMDSEntity_Quadrangle] +
+ theInfo[SMDSEntity_Quad_Quadrangle] +
+ theInfo[SMDSEntity_Polygon] ));
myNbLinFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] +
- theInfo[SMDSEntity_Quadrangle] +
- theInfo[SMDSEntity_Polygon] ));
+ theInfo[SMDSEntity_Quadrangle] +
+ theInfo[SMDSEntity_Polygon] ));
myNbQuadFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] +
- theInfo[SMDSEntity_Quad_Quadrangle] ));
+ theInfo[SMDSEntity_Quad_Quadrangle] ));
// volumes
myNbVolum ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] +
- theInfo[SMDSEntity_Quad_Tetra] +
- theInfo[SMDSEntity_Pyramid] +
- theInfo[SMDSEntity_Quad_Pyramid] +
- theInfo[SMDSEntity_Hexa] +
- theInfo[SMDSEntity_Quad_Hexa] +
- theInfo[SMDSEntity_Penta] +
- theInfo[SMDSEntity_Quad_Penta] +
- theInfo[SMDSEntity_Polyhedra] ));
+ theInfo[SMDSEntity_Quad_Tetra] +
+ theInfo[SMDSEntity_Pyramid] +
+ theInfo[SMDSEntity_Quad_Pyramid] +
+ theInfo[SMDSEntity_Hexa] +
+ theInfo[SMDSEntity_Quad_Hexa] +
+ theInfo[SMDSEntity_Penta] +
+ theInfo[SMDSEntity_Quad_Penta] +
+ theInfo[SMDSEntity_Polyhedra] ));
myNbLinVolum ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] +
- theInfo[SMDSEntity_Pyramid] +
- theInfo[SMDSEntity_Hexa] +
- theInfo[SMDSEntity_Penta] +
- theInfo[SMDSEntity_Polyhedra] ));
+ theInfo[SMDSEntity_Pyramid] +
+ theInfo[SMDSEntity_Hexa] +
+ theInfo[SMDSEntity_Penta] +
+ theInfo[SMDSEntity_Polyhedra] ));
myNbQuadVolum->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Tetra] +
- theInfo[SMDSEntity_Quad_Pyramid] +
- theInfo[SMDSEntity_Quad_Hexa] +
- theInfo[SMDSEntity_Quad_Penta] ));
+ theInfo[SMDSEntity_Quad_Pyramid] +
+ theInfo[SMDSEntity_Quad_Hexa] +
+ theInfo[SMDSEntity_Quad_Penta] ));
if ( myFull )
{
// triangles
myNbTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] +
- theInfo[SMDSEntity_Quad_Triangle] ));
+ theInfo[SMDSEntity_Quad_Triangle] ));
myNbLinTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] ));
myNbQuadTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] ));
// quadrangles
myNbQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quadrangle] +
- theInfo[SMDSEntity_Quad_Quadrangle] ));
+ theInfo[SMDSEntity_Quad_Quadrangle] ));
myNbLinQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quadrangle] ));
myNbQuadQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Quadrangle] ));
// poligones
// tetras
myNbTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] +
- theInfo[SMDSEntity_Quad_Tetra] ));
+ theInfo[SMDSEntity_Quad_Tetra] ));
myNbLinTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] ));
myNbQuadTetra->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Tetra] ));
// hexas
myNbHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Hexa] +
- theInfo[SMDSEntity_Quad_Hexa] ));
+ theInfo[SMDSEntity_Quad_Hexa] ));
myNbLinHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Hexa] ));
myNbQuadHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Hexa] ));
// pyras
myNbPyra ->setText( QString("%1").arg( theInfo[SMDSEntity_Pyramid] +
- theInfo[SMDSEntity_Quad_Pyramid] ));
+ theInfo[SMDSEntity_Quad_Pyramid] ));
myNbLinPyra ->setText( QString("%1").arg( theInfo[SMDSEntity_Pyramid] ));
myNbQuadPyra ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Pyramid] ));
// prisms
myNbPrism ->setText( QString("%1").arg( theInfo[SMDSEntity_Penta] +
- theInfo[SMDSEntity_Quad_Penta] ));
+ theInfo[SMDSEntity_Quad_Penta] ));
myNbLinPrism ->setText( QString("%1").arg( theInfo[SMDSEntity_Penta] ));
myNbQuadPrism->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Penta] ));
// polyedres
//CORBA::Object_var anObject = aSO->GetObject();
CORBA::Object_var anObject = SMESH::SObjectToObject(aSO);
if (!CORBA::is_nil(anObject)) {
- SMESH::SMESH_IDSource_var anIDSource = SMESH::SMESH_IDSource::_narrow(anObject);
- if (!anIDSource->_is_nil()) {
- myWGStack->setCurrentWidget(myMeshWidget);
- setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]");
- myMeshName->setText(aSO->GetName().c_str());
+ SMESH::SMESH_IDSource_var anIDSource = SMESH::SMESH_IDSource::_narrow(anObject);
+ if (!anIDSource->_is_nil()) {
+ myWGStack->setCurrentWidget(myMeshWidget);
+ setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]");
+ myMeshName->setText(aSO->GetName().c_str());
- SMESH::long_array_var aMeshInfo = anIDSource->GetMeshInfo();
- myMeshInfoBox->SetMeshInfo( aMeshInfo );
+ SMESH::long_array_var aMeshInfo = anIDSource->GetMeshInfo();
+ myMeshInfoBox->SetMeshInfo( aMeshInfo );
- return;
- }
+ return;
+ }
}
}
}
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
myToCreate( theToCreate ),
myIsMesh( theIsMesh ),
myDlg( 0 ),
- myShapeByMeshOp( 0 )
+ myShapeByMeshOp( 0 ),
+ myHypoSet( 0 )
{
if ( GeometryGUI::GetGeomGen()->_is_nil() )// check that GEOM_Gen exists
GeometryGUI::InitGeomGen();
SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( pSubmesh );
bool editSubmesh = ( !sm->_is_nil() &&
SUIT_MessageBox::question( myDlg, tr( "SMESH_WARNING" ),
- tr( "EDIT_SUBMESH_QUESTION"),
- SUIT_MessageBox::Yes |
- SUIT_MessageBox::No,
- SUIT_MessageBox::No )
- == SUIT_MessageBox::Yes );
+ tr( "EDIT_SUBMESH_QUESTION"),
+ SUIT_MessageBox::Yes |
+ SUIT_MessageBox::No,
+ SUIT_MessageBox::No )
+ == SUIT_MessageBox::Yes );
if ( editSubmesh )
{
selectionMgr()->clearFilters();
removeCustomFilters(); // Issue 0020170
// Get Entry of the Geom object
+ QString aGeomEntry = "";
+ QString aMeshEntry = "";
QString anObjEntry = "";
- anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
- if ( anObjEntry == "" ) {
- anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
- if ( anObjEntry != "" ) {
- _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
- GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
- anObjEntry = ( aGeomVar->_is_nil() ) ? "" : anObjEntry = aGeomVar->GetStudyEntry();
- }
+ aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
+ aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
+ anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
+
+ if ( aMeshEntry != "" ) { // Get Geom object from Mesh
+ _PTR(SObject) pObj = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
+ GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
+ aMeshEntry = ( aGeomVar->_is_nil() ) ? "" : aMeshEntry = aGeomVar->GetStudyEntry();
+ }
+
+ if ( aMeshEntry == "" && aGeomEntry == "" ) {
+ _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+ GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
+ if ( !aGeomVar->_is_nil() )
+ aGeomEntry = aGeomVar->GetStudyEntry();
}
- aCreator->setShapeEntry( anObjEntry );
+ if ( anObjEntry != "" && aGeomEntry != "" && aMeshEntry == "" ) { // take geometry from submesh
+ _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+ if ( pObj ) {
+ // if current object is sub-mesh
+ SMESH::SMESH_subMesh_var aSubMeshVar =
+ SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
+ if ( !aSubMeshVar->_is_nil() ) {
+ SMESH::SMESH_Mesh_var aMeshVar = aSubMeshVar->GetFather();
+ if ( !aMeshVar->_is_nil() ) {
+ _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar );
+ GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
+ if ( !aGeomVar->_is_nil() )
+ aMeshEntry = aGeomVar->GetStudyEntry();
+ }
+ }
+ }
+ }
+
+ aCreator->setShapeEntry( aGeomEntry );
+ if ( aMeshEntry != "" )
+ aCreator->setMainShapeEntry( aMeshEntry );
myDlg->setEnabled( false );
aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
dialog = true;
aCreator->setInitParamsHypothesis( initParamHyp );
// Get Entry of the Geom object
+ QString aGeomEntry = "";
+ QString aMeshEntry = "";
QString anObjEntry = "";
- anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
- if ( anObjEntry == "" ) {
- anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
- if ( anObjEntry != "" ) {
- _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
- GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
- anObjEntry = aGeomVar->GetStudyEntry();
+ aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
+ aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
+ anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
+
+ if ( aMeshEntry != "" ) { // Get Geom object from Mesh
+ _PTR(SObject) pObj = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
+ GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
+ aMeshEntry = ( aGeomVar->_is_nil() ) ? "" : aMeshEntry = aGeomVar->GetStudyEntry();
+ }
+
+ if ( aMeshEntry == "" && aGeomEntry == "" ) {
+ _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+ GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
+ if ( !aGeomVar->_is_nil() )
+ aGeomEntry = aGeomVar->GetStudyEntry();
+ }
+
+ if ( anObjEntry != "" && aGeomEntry != "" && aMeshEntry == "" ) { // take geometry from submesh
+ _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+ if ( pObj ) {
+ // if current object is sub-mesh
+ SMESH::SMESH_subMesh_var aSubMeshVar =
+ SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
+ if ( !aSubMeshVar->_is_nil() ) {
+ SMESH::SMESH_Mesh_var aMeshVar = aSubMeshVar->GetFather();
+ if ( !aMeshVar->_is_nil() ) {
+ _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar );
+ GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
+ if ( !aGeomVar->_is_nil() )
+ aMeshEntry = aGeomVar->GetStudyEntry();
+ }
+ }
}
}
- aCreator->setShapeEntry( anObjEntry );
+ aCreator->setShapeEntry( aGeomEntry );
+ if ( aMeshEntry != "" )
+ aCreator->setMainShapeEntry( aMeshEntry );
removeCustomFilters(); // Issue 0020170
myDlg->setEnabled( false );
aCreator->edit( aHyp.in(), aHypItem.second, dlg(), this, SLOT( onHypoEdited( int ) ) );
CORBA::String_var curHypType = curHyp->GetName();
if ( !algoDeselectedByUser &&
myObjHyps[ dim ][ type ].count() > 0 &&
- curHypType == myObjHyps[ dim ][ type ].first().first->GetName())
+ !strcmp( curHypType, myObjHyps[ dim ][ type ].first().first->GetName()) )
{
HypothesisData* hypData = SMESH::GetHypothesisData( curHyp->GetName() );
for (int i = 0; i < myAvailableHypData[ dim ][ Algo ].count(); ++i) {
aNewGeomGroupName += aName;
SALOMEDS::SObject_var aNewGroupSO =
geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGeomVar,
- aNewGeomGroupName.toLatin1().data(), mainGeom);
+ aNewGeomGroupName.toLatin1().data(), mainGeom);
}
}
}
{
SMESH::SMESH_Hypothesis_var aHypVar = (*anIter).first;
CORBA::String_var aName = aHypVar->GetName();
- if ( !aHypVar->_is_nil() && aHypName == aName )
+ if ( !aHypVar->_is_nil() && !strcmp(aHypName.toLatin1().data(), aName) )
{
anAlgoVar = aHypVar;
break;
{
SMESH::SMESH_Hypothesis_var aHypVar = (*anIter).first;
CORBA::String_var aName = aHypVar->GetName();
- if ( !aHypVar->_is_nil() && aHypName == aName )
+ if ( !aHypVar->_is_nil() && !strcmp(aHypName.toLatin1().data(), aName) )
{
anAlgoVar = aHypVar;
break;
const int ); // access to myAvailableHypData
void createHypothesis( const int, const int,
- const QString& );
+ const QString& );
bool createMesh( QString& );
bool createSubMesh( QString& );
ok = myNode2->isValid( msg, theMess ) && ok;
if( !ok ) {
if( theMess ) {
- QString str( tr( "SMESH_INCORRECT_INPUT" ) );
- if ( !msg.isEmpty() )
- str += "\n" + msg;
- SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
+ QString str( tr( "SMESH_INCORRECT_INPUT" ) );
+ if ( !msg.isEmpty() )
+ str += "\n" + msg;
+ SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
}
return false;
}
{
if (theMess)
SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"),
- tr("SMESHGUI_INVALID_PARAMETERS"));
+ tr("SMESHGUI_INVALID_PARAMETERS"));
return false;
}
if ( myName->text().isEmpty() ) {
if (theMess)
SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"),
- tr("SMESHGUI_INVALID_PARAMETERS"));
+ tr("SMESHGUI_INVALID_PARAMETERS"));
return false;
}
varIds->length(ids.count());
int i = 0;
for (QList<int>::iterator it = ids.begin(); it != ids.end(); ++it)
- varIds[i++] = *it;
+ varIds[i++] = *it;
myType == Type_2d
- ? myPattern->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked())
- : myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true));
+ ? myPattern->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked())
+ : myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true));
QStringList aParameters;
aParameters << myNode1->text();
if(myType == Type_3d )
- aParameters << myNode2->text();
- myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
+ aParameters << myNode2->text();
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
} else { // Applying a pattern to geometrical object
if (myType == Type_2d)
//mySelectionMgr->clearSelected();
bool autoUpdate = SMESHGUI::automaticUpdate();
if (!isRefine() && autoUpdate) {
- _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());
- SMESH_Actor* anActor = SMESH::FindActorByEntry(aSO->GetID().c_str());
- if (!anActor) {
- anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str());
- if (anActor) {
- SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
- SMESH::FitAll();
- }
- }
+ _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());
+ SMESH_Actor* anActor = SMESH::FindActorByEntry(aSO->GetID().c_str());
+ if (!anActor) {
+ anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str());
+ if (anActor) {
+ SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
+ SMESH::FitAll();
+ }
+ }
}
mySelectionMgr->clearSelected();
SMESH::UpdateView();
return true;
} else {
SUIT_MessageBox::information(this, tr("SMESH_ERROR"),
- tr("SMESH_OPERATION_FAILED"));
+ tr("SMESH_OPERATION_FAILED"));
return false;
}
} catch (const SALOME::SALOME_Exception& S_ex) {
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
- QString platform;
+ QString platform;
#ifdef WIN32
- platform = "winapplication";
+ platform = "winapplication";
#else
- platform = "application";
+ platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
if (aList.Extent() != 1)
- return;
+ return;
// Retrieve mesh from selection
Handle(SALOME_InteractiveObject) anIO = aList.First();
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
if (aList.Extent() != 1)
- return;
+ return;
QString anIds;
if (!SMESH::GetNameOfSelectedElements(mySelector, aList.First(), anIds))
- anIds = "";
+ anIds = "";
myBusy = true;
mySelEdit[ Ids ]->setText(anIds);
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
if (aList.Extent() != 1)
- return;
+ return;
// Get geom object from selection
Handle(SALOME_InteractiveObject) anIO = aList.First();
QFile aFile(fName);
if (!aFile.open(QIODevice::ReadOnly)) {
SUIT_MessageBox::information(this, tr("SMESH_ERROR"),
- tr("ERROR_OF_OPENING"));
+ tr("ERROR_OF_OPENING"));
return;
}
QByteArray aDataArray = aFile.readAll();
if (aDataArray.isEmpty()) {
SUIT_MessageBox::information(this, tr("SMESH_ERROR"),
- tr("ERROR_OF_READING"));
+ tr("ERROR_OF_READING"));
return;
}
if (!CORBA::is_nil(myPattern)/* && getIds(ids)*/) {
SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
if (keyPoints->length()) {
- myNode1->setEnabled(true);
- myNode2->setEnabled(true);
- myNode1->setRange(1, keyPoints->length());
- myNode2->setRange(1, keyPoints->length());
- return;
+ myNode1->setEnabled(true);
+ myNode2->setEnabled(true);
+ myNode1->setRange(1, keyPoints->length());
+ myNode2->setRange(1, keyPoints->length());
+ return;
}
}
if (myType == Type_2d)
{
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
}
else
{
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(CellSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(CellSelection);
}
}
else {
} catch (const SALOME::SALOME_Exception& S_ex) {
SalomeApp_Tools::QtCatchCorbaException(S_ex);
SUIT_MessageBox::information(this, tr("SMESH_ERROR"),
- tr("ERROR_OF_LOADING") );
+ tr("ERROR_OF_LOADING") );
return false;
}
}
varIds->length(ids.count());
int i = 0;
for (QList<int>::iterator it = ids.begin(); it != ids.end(); ++it)
- varIds[i++] = *it;
+ varIds[i++] = *it;
pnts = myType == Type_2d
- ? myPattern->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked())
- : myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true));
+ ? myPattern->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked())
+ : myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true));
} else {
pnts = myType == Type_2d
- ? myPattern->ApplyToFace (myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked())
+ ? myPattern->ApplyToFace (myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked())
: myPattern->ApplyTo3DBlock(myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ]);
}
for (int i = 0; i < aListId.count(); i++) {
const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
if (e && e->GetType() == (myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume))
- newIndices.Add(e->GetID());
+ newIndices.Add(e->GetID());
}
mySelector->AddOrRemoveIndex( anActor->getIO(), newIndices, false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
if(!CORBA::is_nil(anObj)){
SMESH_Mesh_var aMesh = SMESH_Mesh::_narrow(anObj);
if(!CORBA::is_nil(aMesh))
- return aMesh;
+ return aMesh;
SMESH_GroupBase_var aGroup = SMESH_GroupBase::_narrow(anObj);
if(!CORBA::is_nil(aGroup))
- return aGroup->GetMesh();
+ return aGroup->GetMesh();
SMESH_subMesh_var aSubMesh = SMESH_subMesh::_narrow(anObj);
if(!CORBA::is_nil(aSubMesh))
- return aSubMesh->GetFather();
+ return aSubMesh->GetFather();
}
return SMESH_Mesh::_nil();
}
QString name = baseName;
while ( !aStudy->FindObjectByName( name.toLatin1().data(), "SMESH" ).empty() ) {
int nb = 0;
- QStringList names = name.split("_", QString::KeepEmptyParts);
- if ( names.count() > 0 ) {
- bool ok;
- int index = names.last().toInt( &ok );
- if ( ok ) {
- nb = index;
- names.removeLast();
- }
- }
- names.append( QString::number( nb+1 ) );
- name = names.join( "_" );
+ QStringList names = name.split("_", QString::KeepEmptyParts);
+ if ( names.count() > 0 ) {
+ bool ok;
+ int index = names.last().toInt( &ok );
+ if ( ok ) {
+ nb = index;
+ names.removeLast();
+ }
+ }
+ names.append( QString::number( nb+1 ) );
+ name = names.join( "_" );
}
return name;
}
if (myId->text().isEmpty()) {
if (theMess)
SUIT_MessageBox::information(this, tr("SMESH_WARNING"),
- tr("NODE_ID_IS_NOT_DEFINED"));
+ tr("NODE_ID_IS_NOT_DEFINED"));
return false;
}
if( theMess ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
- str += "\n" + msg;
+ str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
}
return false;
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
if (aMesh->_is_nil()) {
SUIT_MessageBox::information(this, tr("SMESH_ERROR"),
- tr("SMESHG_NO_MESH"));
+ tr("SMESHG_NO_MESH"));
return false;
}
aParameters << myX->text();
aParameters << myY->text();
aParameters << myZ->text();
- aMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
+ aMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
} catch (...) {
}
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
- QString platform;
+ QString platform;
#ifdef WIN32
- platform = "winapplication";
+ platform = "winapplication";
#else
- platform = "application";
+ platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
myBusy = false;
if(const SMDS_MeshElement *anElem = aMesh->FindElement(theNewText.toInt())) {
- TColStd_MapOfInteger aListInd;
- aListInd.Add(anElem->GetID());
- mySelector->AddOrRemoveIndex(anIO,aListInd, false);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight(anIO,true,true);
-
- onSelectionDone();
+ TColStd_MapOfInteger aListInd;
+ aListInd.Add(anElem->GetID());
+ mySelector->AddOrRemoveIndex(anIO,aListInd, false);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->highlight(anIO,true,true);
+
+ onSelectionDone();
}
}
}
//=======================================================================
SMESHGUI_MultiEditDlg
::SMESHGUI_MultiEditDlg(SMESHGUI* theModule,
- const int theMode,
- const bool the3d2d):
+ const int theMode,
+ const bool the3d2d):
QDialog(SMESH::GetDesktop(theModule)),
mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
myToAllChk = new QCheckBox(tr("TO_ALL"), mySelGrp);
mySelGrpLayout->addWidget(myToAllChk, mySelGrpLayout->rowCount(), 0,
- 1, mySelGrpLayout->columnCount());
+ 1, mySelGrpLayout->columnCount());
// Split/Join criterion group
myCriterionGrp = new QGroupBox(tr("SPLIT_JOIN_CRITERION"), aMainGrp);
// skl 07.02.2006
SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
if( myFilterType == SMESH::TriaFilter ||
- myFilterType == SMESH::QuadFilter ||
- myFilterType == SMESH::FaceFilter ) {
- SMDS_FaceIteratorPtr it = aMesh->facesIterator();
- while(it->more()) {
- const SMDS_MeshFace* f = it->next();
- if(myFilterType == SMESH::FaceFilter) {
- myIds.Add(f->GetID());
- }
- else if( myFilterType==SMESH::TriaFilter &&
- ( f->NbNodes()==3 || f->NbNodes()==6 ) ) {
- myIds.Add(f->GetID());
- }
- else if( myFilterType==SMESH::QuadFilter &&
- ( f->NbNodes()==4 || f->NbNodes()==8 ) ) {
- myIds.Add(f->GetID());
- }
- }
+ myFilterType == SMESH::QuadFilter ||
+ myFilterType == SMESH::FaceFilter ) {
+ SMDS_FaceIteratorPtr it = aMesh->facesIterator();
+ while(it->more()) {
+ const SMDS_MeshFace* f = it->next();
+ if(myFilterType == SMESH::FaceFilter) {
+ myIds.Add(f->GetID());
+ }
+ else if( myFilterType==SMESH::TriaFilter &&
+ ( f->NbNodes()==3 || f->NbNodes()==6 ) ) {
+ myIds.Add(f->GetID());
+ }
+ else if( myFilterType==SMESH::QuadFilter &&
+ ( f->NbNodes()==4 || f->NbNodes()==8 ) ) {
+ myIds.Add(f->GetID());
+ }
+ }
}
else if(myFilterType == SMESH::VolumeFilter) {
- SMDS_VolumeIteratorPtr it = aMesh->volumesIterator();
- while(it->more()) {
- const SMDS_MeshVolume* f = it->next();
- myIds.Add(f->GetID());
- }
+ SMDS_VolumeIteratorPtr it = aMesh->volumesIterator();
+ while(it->more()) {
+ const SMDS_MeshVolume* f = it->next();
+ myIds.Add(f->GetID());
+ }
}
/* commented by skl 07.02.2006
TVisualObjPtr aVisualObj = anActor->GetObject();
for (int i = 0, n = aGrid->GetNumberOfCells(); i < n; i++) {
vtkCell* aCell = aGrid->GetCell(i);
if (aCell != 0) {
- vtkTriangle* aTri = vtkTriangle::SafeDownCast(aCell);
- vtkQuad* aQua = vtkQuad::SafeDownCast(aCell);
- vtkPolygon* aPG = vtkPolygon::SafeDownCast(aCell);
+ vtkTriangle* aTri = vtkTriangle::SafeDownCast(aCell);
+ vtkQuad* aQua = vtkQuad::SafeDownCast(aCell);
+ vtkPolygon* aPG = vtkPolygon::SafeDownCast(aCell);
- vtkCell3D* a3d = vtkCell3D::SafeDownCast(aCell);
- vtkConvexPointSet* aPH = vtkConvexPointSet::SafeDownCast(aCell);
+ vtkCell3D* a3d = vtkCell3D::SafeDownCast(aCell);
+ vtkConvexPointSet* aPH = vtkConvexPointSet::SafeDownCast(aCell);
- if (aTri && myFilterType == SMESHGUI_TriaFilter ||
+ if (aTri && myFilterType == SMESHGUI_TriaFilter ||
aQua && myFilterType == SMESHGUI_QuadFilter ||
(aTri || aQua || aPG) && myFilterType == SMESHGUI_FaceFilter ||
(a3d || aPH) && myFilterType == SMESHGUI_VolumeFilter) {
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
if (aNbItems > 0) {
QStringList anElements = aListStr.split(" ", QString::SkipEmptyParts);
for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
- QList<QListWidgetItem*> items = myListBox->findItems(*it, Qt::MatchExactly);
- QListWidgetItem* anItem;
- foreach(anItem, items)
- anItem->setSelected(true);
+ QList<QListWidgetItem*> items = myListBox->findItems(*it, Qt::MatchExactly);
+ QListWidgetItem* anItem;
+ foreach(anItem, items)
+ anItem->setSelected(true);
}
}
myMesh = SMESH::GetMeshByIO(anIO);
if( theMess ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
- str += "\n" + msg;
+ str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
}
return false;
if( ok ) {
QStringList aParameters;
aParameters << myMaxAngleSpin->text();
- myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
}
return ok;
}
void setSelectionMode();
virtual bool isIdValid( const int ) const;
virtual bool process( SMESH::SMESH_MeshEditor_ptr,
- const SMESH::long_array& ) = 0;
+ const SMESH::long_array& ) = 0;
int entityType();
protected:
_PTR(SObject) aSobj = SMESH::FindSObject( theMesh );
SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
aMeshEditor->AddNode( x, y, z );
- theMesh->SetParameters( SMESHGUI::JoinObjectParameters(theParameters) );
+ theMesh->SetParameters( theParameters.join(":").toLatin1().constData() );
_PTR(Study) aStudy = GetActiveStudyDocument();
CORBA::Long anId = aStudy->StudyId();
if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj( anId, aSobj->GetID().c_str() ) ) {
- aVisualObj->Update( true );
+ aVisualObj->Update( true );
}
}
catch ( SALOME::SALOME_Exception& exc ) {
mySimulation = new SMESH::TNodeSimulation( SMESH::GetViewWindow( mySMESHGUI ) );
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH",
- tr( "ICON_DLG_NODE" ) ) );
+ tr( "ICON_DLG_NODE" ) ) );
QVBoxLayout* SMESHGUI_NodesDlgLayout = new QVBoxLayout( this );
SMESHGUI_NodesDlgLayout->setSpacing( SPACING );
if ( myMesh->_is_nil() ) {
SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ),
- tr( "MESH_IS_NOT_SELECTED" ) );
+ tr( "MESH_IS_NOT_SELECTED" ) );
return false;
}
LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
if ( app )
app->onHelpContextModule( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) :
- QString( "" ), myHelpFileName );
+ QString( "" ), myHelpFileName );
else {
QString platform;
#ifdef WIN32
platform = "application";
#endif
SUIT_MessageBox::warning( this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg( app->resourceMgr()->stringValue( "ExternalBrowser",
- platform ) ).
- arg( myHelpFileName ) );
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg( app->resourceMgr()->stringValue( "ExternalBrowser",
+ platform ) ).
+ arg( myHelpFileName ) );
}
}
if ( myMesh->_is_nil() ) return;
QString aText;
if ( SMESH::GetNameOfSelectedNodes( mySelector, anIO, aText ) == 1 ) {
- if ( SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh.in() ) ) {
- if ( SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh() ) {
- if ( const SMDS_MeshNode* aNode = aMesh->FindNode( aText.toInt() ) ) {
- SpinBox_X->SetValue( aNode->X() );
- SpinBox_Y->SetValue( aNode->Y() );
- SpinBox_Z->SetValue( aNode->Z() );
+ if ( SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh.in() ) ) {
+ if ( SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh() ) {
+ if ( const SMDS_MeshNode* aNode = aMesh->FindNode( aText.toInt() ) ) {
+ SpinBox_X->SetValue( aNode->X() );
+ SpinBox_Y->SetValue( aNode->Y() );
+ SpinBox_Z->SetValue( aNode->Z() );
}
- }
- }
+ }
+ }
}
mySimulation->SetPosition( SpinBox_X->GetValue(),
- SpinBox_Y->GetValue(),
- SpinBox_Z->GetValue() );
+ SpinBox_Y->GetValue(),
+ SpinBox_Z->GetValue() );
}
}
}
else if ( getSMESHGUI() == 0 )
{
SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
- tr( "NO_MODULE" ) );
+ tr( "NO_MODULE" ) );
return false;
}
else if ( isStudyLocked() )
platform = "application";
#endif
SUIT_MessageBox::warning( desktop(), tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName) );
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName) );
}
}
{
if ( theMess )
SUIT_MessageBox::warning( SMESHGUI::desktop(), tr( "WRN_WARNING" ),
- tr( "WRN_STUDY_LOCKED" ) );
+ tr( "WRN_STUDY_LOCKED" ) );
return true;
}
}
return theOtherOp && theOtherOp->inherits( "SMESHGUI_Operation" ) &&
( !anOps.contains( theOtherOp->metaObject()->className() ) ||
- anOps.contains( metaObject()->className() ) );
+ anOps.contains( metaObject()->className() ) );
return true;
}
QPoint aQPnt = mapCoords( aPoint.x, aPoint.y );
painter.drawPie( aQPnt.x() - Radius, aQPnt.y() - Radius,
- Radius * 2, Radius * 2, 0, 360 * 16 );
+ Radius * 2, Radius * 2, 0, 360 * 16 );
painter.drawText( aQPnt.x() + Shift, aQPnt.y() - Shift,
- QString::number( i+1 ) );
+ QString::number( i+1 ) );
}
// Draw lines
~SMESHGUI_PatternWidget();
void SetPoints( const PointVector&,
- const QVector<int>&,
- const ConnectivityVector& );
+ const QVector<int>&,
+ const ConnectivityVector& );
private:
PointVector myPoints;
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ),
- this, SLOT( DeactivateActiveDialog() ) );
+ this, SLOT( DeactivateActiveDialog() ) );
/* to close dialog if study change */
connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ),
- this, SLOT( ClickOnCancel() ) );
+ this, SLOT( ClickOnCancel() ) );
}
//=================================================================================
SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
QColor titleColor = mgr->colorValue("SMESH", "scalar_bar_title_color",
- QColor(255, 255, 255));
+ QColor(255, 255, 255));
myTitleColorBtn->setColor(titleColor);
myTitleFontCombo->setCurrentIndex(0);
if (mgr->hasValue("SMESH", "scalar_bar_title_font")) {
myTitleItalicCheck->setChecked( f.italic() );
myTitleShadowCheck->setChecked( f.overline() );
}
-
+
QColor labelColor = mgr->colorValue("SMESH", "scalar_bar_label_color",
- QColor(255, 255, 255));
+ QColor(255, 255, 255));
myLabelsColorBtn->setColor(labelColor);
myLabelsFontCombo->setCurrentIndex(0);
if (mgr->hasValue("SMESH", "scalar_bar_label_font")) {
QString name = isHoriz ? "scalar_bar_horizontal_%1" : "scalar_bar_vertical_%1";
myIniX = mgr->doubleValue("SMESH", name.arg( "x" ),
- myHorizRadioBtn->isChecked() ? DEF_HOR_X : DEF_VER_X);
+ myHorizRadioBtn->isChecked() ? DEF_HOR_X : DEF_VER_X);
myIniY = mgr->doubleValue("SMESH", name.arg( "y" ),
- myHorizRadioBtn->isChecked() ? DEF_HOR_Y : DEF_VER_Y);
+ myHorizRadioBtn->isChecked() ? DEF_HOR_Y : DEF_VER_Y);
myIniW = mgr->doubleValue("SMESH", name.arg( "width" ),
- myHorizRadioBtn->isChecked() ? DEF_HOR_W : DEF_VER_W);
+ myHorizRadioBtn->isChecked() ? DEF_HOR_W : DEF_VER_W);
myIniH = mgr->doubleValue("SMESH", name.arg( "height" ),
- myHorizRadioBtn->isChecked() ? DEF_HOR_H : DEF_VER_H);
+ myHorizRadioBtn->isChecked() ? DEF_HOR_H : DEF_VER_H);
setOriginAndSize(myIniX, myIniY, myIniW, myIniH);
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
if( anIO->hasEntry() ) {
SMESH_Actor* anActor = SMESH::FindActorByEntry(anIO->getEntry());
if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) {
- myActor = anActor;
- vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
-
- if ( myScalarBarActor->GetLookupTable() ) {
- vtkFloatingPointType *range = myScalarBarActor->GetLookupTable()->GetRange();
- myMinEdit->setText( QString::number( range[0],'g',12 ) );
- myMaxEdit->setText( QString::number( range[1],'g',12 ) );
- }
-
- vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty();
- vtkFloatingPointType aTColor[3];
- aTitleTextPrp->GetColor( aTColor );
- myTitleColorBtn->setColor( QColor( (int)( aTColor[0]*255 ), (int)( aTColor[1]*255 ), (int)( aTColor[2]*255 ) ) );
- myTitleFontCombo->setCurrentIndex( aTitleTextPrp->GetFontFamily() );
- myTitleBoldCheck->setChecked( aTitleTextPrp->GetBold() );
- myTitleItalicCheck->setChecked( aTitleTextPrp->GetItalic() );
- myTitleShadowCheck->setChecked( aTitleTextPrp->GetShadow() );
-
- vtkTextProperty* aLabelsTextPrp = myScalarBarActor->GetLabelTextProperty();
- vtkFloatingPointType aLColor[3];
- aLabelsTextPrp->GetColor( aLColor );
- myLabelsColorBtn->setColor( QColor( (int)( aLColor[0]*255 ), (int)( aLColor[1]*255 ), (int)( aLColor[2]*255 ) ) );
- myLabelsFontCombo->setCurrentIndex( aLabelsTextPrp->GetFontFamily() );
- myLabelsBoldCheck->setChecked( aLabelsTextPrp->GetBold() );
- myLabelsItalicCheck->setChecked( aLabelsTextPrp->GetItalic() );
- myLabelsShadowCheck->setChecked( aLabelsTextPrp->GetShadow() );
-
- myLabelsSpin->setValue( myScalarBarActor->GetNumberOfLabels() );
- myColorsSpin->setValue( myScalarBarActor->GetMaximumNumberOfColors() );
-
- if ( myScalarBarActor->GetOrientation() == VTK_ORIENT_VERTICAL )
- myVertRadioBtn->setChecked( true );
- else
- myHorizRadioBtn->setChecked( true );
- myIniOrientation = myVertRadioBtn->isChecked();
-
- myIniX = myScalarBarActor->GetPosition()[0];
- myIniY = myScalarBarActor->GetPosition()[1];
- myIniW = myScalarBarActor->GetWidth();
- myIniH = myScalarBarActor->GetHeight();
- setOriginAndSize( myIniX, myIniY, myIniW, myIniH );
-
- myRangeGrp->setEnabled( true );
- myFontGrp->setEnabled( true );
- myLabColorGrp->setEnabled( true );
- myOrientationGrp->setEnabled( true );
- myOriginDimGrp->setEnabled( true );
- myOkBtn->setEnabled( true );
- myApplyBtn->setEnabled( true );
- return;
+ myActor = anActor;
+ vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
+
+ if ( myScalarBarActor->GetLookupTable() ) {
+ vtkFloatingPointType *range = myScalarBarActor->GetLookupTable()->GetRange();
+ myMinEdit->setText( QString::number( range[0],'g',12 ) );
+ myMaxEdit->setText( QString::number( range[1],'g',12 ) );
+ }
+
+ vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty();
+ vtkFloatingPointType aTColor[3];
+ aTitleTextPrp->GetColor( aTColor );
+ myTitleColorBtn->setColor( QColor( (int)( aTColor[0]*255 ), (int)( aTColor[1]*255 ), (int)( aTColor[2]*255 ) ) );
+ myTitleFontCombo->setCurrentIndex( aTitleTextPrp->GetFontFamily() );
+ myTitleBoldCheck->setChecked( aTitleTextPrp->GetBold() );
+ myTitleItalicCheck->setChecked( aTitleTextPrp->GetItalic() );
+ myTitleShadowCheck->setChecked( aTitleTextPrp->GetShadow() );
+
+ vtkTextProperty* aLabelsTextPrp = myScalarBarActor->GetLabelTextProperty();
+ vtkFloatingPointType aLColor[3];
+ aLabelsTextPrp->GetColor( aLColor );
+ myLabelsColorBtn->setColor( QColor( (int)( aLColor[0]*255 ), (int)( aLColor[1]*255 ), (int)( aLColor[2]*255 ) ) );
+ myLabelsFontCombo->setCurrentIndex( aLabelsTextPrp->GetFontFamily() );
+ myLabelsBoldCheck->setChecked( aLabelsTextPrp->GetBold() );
+ myLabelsItalicCheck->setChecked( aLabelsTextPrp->GetItalic() );
+ myLabelsShadowCheck->setChecked( aLabelsTextPrp->GetShadow() );
+
+ myLabelsSpin->setValue( myScalarBarActor->GetNumberOfLabels() );
+ myColorsSpin->setValue( myScalarBarActor->GetMaximumNumberOfColors() );
+
+ if ( myScalarBarActor->GetOrientation() == VTK_ORIENT_VERTICAL )
+ myVertRadioBtn->setChecked( true );
+ else
+ myHorizRadioBtn->setChecked( true );
+ myIniOrientation = myVertRadioBtn->isChecked();
+
+ myIniX = myScalarBarActor->GetPosition()[0];
+ myIniY = myScalarBarActor->GetPosition()[1];
+ myIniW = myScalarBarActor->GetWidth();
+ myIniH = myScalarBarActor->GetHeight();
+ setOriginAndSize( myIniX, myIniY, myIniW, myIniH );
+
+ myRangeGrp->setEnabled( true );
+ myFontGrp->setEnabled( true );
+ myLabColorGrp->setEnabled( true );
+ myOrientationGrp->setEnabled( true );
+ myOriginDimGrp->setEnabled( true );
+ myOkBtn->setEnabled( true );
+ myApplyBtn->setEnabled( true );
+ return;
}
}
}
*/
//=================================================================================================
void SMESHGUI_Preferences_ScalarBarDlg::setOriginAndSize( const double x,
- const double y,
- const double w,
- const double h )
+ const double y,
+ const double w,
+ const double h )
{
blockSignals( true );
myXSpin->setValue( x );
setOriginAndSize( myIniX, myIniY, myIniW, myIniH );
else
setOriginAndSize( aOrientation ? DEF_VER_X : DEF_HOR_X,
- aOrientation ? DEF_VER_Y : DEF_HOR_Y,
- aOrientation ? DEF_VER_W : DEF_HOR_W,
- aOrientation ? DEF_VER_H : DEF_HOR_H );
+ aOrientation ? DEF_VER_Y : DEF_HOR_Y,
+ aOrientation ? DEF_VER_W : DEF_HOR_W,
+ aOrientation ? DEF_VER_H : DEF_HOR_H );
}
//=================================================================================================
void closeEvent( QCloseEvent* );
void setOriginAndSize( const double,
- const double,
- const double,
- const double );
+ const double,
+ const double,
+ const double );
void initScalarBarFromResources();
protected slots:
/* to close dialog if study change */
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
connect(myEditCurrentArgument, SIGNAL(textChanged(const QString&)),
- SLOT(onTextChange(const QString&)));
+ SLOT(onTextChange(const QString&)));
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(CellSelection);
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++) {
- if(const SMDS_MeshElement *anElem = aMesh->FindElement(aListId[i].toInt())) {
- newIndices.Add(anElem->GetID());
- myNbOkElements++;
- }
+ if(const SMDS_MeshElement *anElem = aMesh->FindElement(aListId[i].toInt())) {
+ newIndices.Add(anElem->GetID());
+ myNbOkElements++;
+ }
}
mySelector->AddOrRemoveIndex(anIO,newIndices,false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight(anIO,true,true);
+ aViewWindow->highlight(anIO,true,true);
}
}
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
- LineEditC1A1->setFocus();
- myEditCurrentArgument = LineEditC1A1;
+ LineEditC1A1->setFocus();
+ myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument();
break;
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
+ tr("SMESH_ERROR"),
+ tr("NO_MESH_SELECTED"));
return;
}
if ( !myFilterDlg )
/* to close dialog if study change */
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
connect(myEditCurrentArgument, SIGNAL(textChanged(const QString&)),
- SLOT(onTextChange(const QString&)));
+ SLOT(onTextChange(const QString&)));
SMESH::SetPointRepresentation(true);
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++) {
- if (const SMDS_MeshNode *aNode = aMesh->FindNode(aListId[i].toInt())) {
- newIndices.Add(aNode->GetID());
- myNbOkNodes++;
- }
+ if (const SMDS_MeshNode *aNode = aMesh->FindNode(aListId[i].toInt())) {
+ newIndices.Add(aNode->GetID());
+ myNbOkNodes++;
+ }
}
mySelector->AddOrRemoveIndex(anIO,newIndices,false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight(anIO,true,true);
+ aViewWindow->highlight(anIO,true,true);
}
}
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
- LineEditC1A1->setFocus();
- myEditCurrentArgument = LineEditC1A1;
+ LineEditC1A1->setFocus();
+ myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument();
break;
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
+ tr("SMESH_ERROR"),
+ tr("NO_MESH_SELECTED"));
return;
}
if ( !myFilterDlg )
setModal(false);
setAttribute(Qt::WA_DeleteOnClose, true);
setWindowTitle(unit == 0 ?
- tr("SMESH_RENUMBERING_NODES_TITLE") :
- tr("SMESH_RENUMBERING_ELEMENTS_TITLE"));
+ tr("SMESH_RENUMBERING_NODES_TITLE") :
+ tr("SMESH_RENUMBERING_ELEMENTS_TITLE"));
setSizeGripEnabled(true);
SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( mySMESHGUI );
QPixmap image0(resMgr->loadPixmap("SMESH", unit == 0 ?
- tr("ICON_DLG_RENUMBERING_NODES") :
- tr("ICON_DLG_RENUMBERING_ELEMENTS")));
+ tr("ICON_DLG_RENUMBERING_NODES") :
+ tr("ICON_DLG_RENUMBERING_ELEMENTS")));
QPixmap image1(resMgr->loadPixmap("SMESH",tr("ICON_SELECT")));
QVBoxLayout* SMESHGUI_RenumberingDlgLayout = new QVBoxLayout(this);
/***************************************************************/
GroupConstructors = new QGroupBox(unit == 0 ?
- tr("SMESH_NODES") :
- tr("SMESH_ELEMENTS"),
- this);
+ tr("SMESH_NODES") :
+ tr("SMESH_ELEMENTS"),
+ this);
myHelpFileName = unit == 0 ?
"renumbering_nodes_and_elements_page.html#renumbering_nodes_anchor" :
"renumbering_nodes_and_elements_page.html#renumbering_elements_anchor";
bool isUnitsLabeled = false;
if (myUnit == 0 && anActor) {
- isUnitsLabeled = anActor->GetPointsLabeled();
- if (isUnitsLabeled) anActor->SetPointsLabeled(false);
+ isUnitsLabeled = anActor->GetPointsLabeled();
+ if (isUnitsLabeled) anActor->SetPointsLabeled(false);
}
else if (myUnit == 1 && anActor) {
- isUnitsLabeled = anActor->GetCellsLabeled();
- if (isUnitsLabeled) anActor->SetCellsLabeled(false);
+ isUnitsLabeled = anActor->GetCellsLabeled();
+ if (isUnitsLabeled) anActor->SetCellsLabeled(false);
}
SUIT_OverrideCursor aWaitCursor;
if (myUnit == 0) {
- aMeshEditor->RenumberNodes();
- if (isUnitsLabeled && anActor) anActor->SetPointsLabeled(true);
+ aMeshEditor->RenumberNodes();
+ if (isUnitsLabeled && anActor) anActor->SetPointsLabeled(true);
}
else if (myUnit == 1) {
- aMeshEditor->RenumberElements();
- if (isUnitsLabeled && anActor) anActor->SetCellsLabeled(true);
+ aMeshEditor->RenumberElements();
+ if (isUnitsLabeled && anActor) anActor->SetCellsLabeled(true);
}
}
catch(...) {
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
Handle(SALOME_InteractiveObject) IO = aList.First();
myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
if (myMesh->_is_nil())
- aString = "";
+ aString = "";
}
}
{
case 0: /* default constructor */
{
- if(send == SelectButton) {
- LineEditMesh->setFocus();
- myEditCurrentArgument = LineEditMesh;
- }
- SelectionIntoArgument();
- break;
+ if(send == SelectButton) {
+ LineEditMesh->setFocus();
+ myEditCurrentArgument = LineEditMesh;
+ }
+ SelectionIntoArgument();
+ break;
}
}
}
myIDs.clear();
myNbOkElements = 0;
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(aSelMode);
+ aViewWindow->SetSelectionMode(aSelMode);
}
myEditCurrentArgument = (QWidget*)LineEditElements;
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
if( CheckBoxMesh->isChecked() ) {
- if( GetConstructorId() == 0 )
- SMESH::ListOfGroups_var groups =
- aMeshEditor->RotationSweepObject1DMakeGroups(mySelectedObject, anAxis,
- anAngle, aNbSteps, aTolerance);
- else
- SMESH::ListOfGroups_var groups =
- aMeshEditor->RotationSweepObject2DMakeGroups(mySelectedObject, anAxis,
- anAngle, aNbSteps, aTolerance);
- }
- else
- SMESH::ListOfGroups_var groups =
- aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
- anAngle, aNbSteps, aTolerance);
+ if( GetConstructorId() == 0 )
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->RotationSweepObject1DMakeGroups(mySelectedObject, anAxis,
+ anAngle, aNbSteps, aTolerance);
+ else
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->RotationSweepObject2DMakeGroups(mySelectedObject, anAxis,
+ anAngle, aNbSteps, aTolerance);
+ }
+ else
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
+ anAngle, aNbSteps, aTolerance);
}
else {
if( CheckBoxMesh->isChecked() ) {
- if( GetConstructorId() == 0 )
- aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
- else
- aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
- }
- else
- aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
+ if( GetConstructorId() == 0 )
+ aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
+ else
+ aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
+ }
+ else
+ aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
}
- myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
} catch (...) {
}
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++) {
- const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
- if (e)
- newIndices.Add(e->GetID());
- myNbOkElements++;
+ const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+ if (e)
+ newIndices.Add(e->GetID());
+ myNbOkElements++;
}
mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( myActor->getIO(), true, true );
+ aViewWindow->highlight( myActor->getIO(), true, true );
myElementsId = theNewText;
}
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
myElementsId = aString;
if (aNbUnits < 1)
- return;
+ return;
}
myNbOkElements = true;
} else {
SMESH::SetPointRepresentation(false);
if (CheckBoxMesh->isChecked()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(ActorSelection);
+ aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
} else {
int aConstructorId = GetConstructorId();
if (aConstructorId == 0)
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
- }
+ {
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(EdgeSelection);
+ }
else if (aConstructorId == 1)
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- }
+ {
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
+ }
}
} else if (send == SelectPointButton) {
myEditCurrentArgument = (QWidget*)SpinBox_X;
int aConstructorId = GetConstructorId();
if (aConstructorId == 0)
{
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(EdgeSelection);
}
else if (aConstructorId == 1)
{
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
}
LineEditElements->setReadOnly(false);
bool SMESHGUI_RevolutionDlg::IsAxisOk()
{
return (SpinBox_DX->GetValue() != 0 ||
- SpinBox_DY->GetValue() != 0 ||
- SpinBox_DZ->GetValue() != 0);
+ SpinBox_DY->GetValue() != 0 ||
+ SpinBox_DZ->GetValue() != 0);
}
//=================================================================================
anElementsId->length(aListElementsId.count());
for (int i = 0; i < aListElementsId.count(); i++)
- anElementsId[i] = aListElementsId[i].toInt();
+ anElementsId[i] = aListElementsId[i].toInt();
SMESH::AxisStruct anAxis;
double aTolerance = SpinBox_Tolerance->GetValue();
if (GroupAngle->checkedId() == 1)
- anAngle = anAngle/aNbSteps;
+ anAngle = anAngle/aNbSteps;
try {
- SUIT_OverrideCursor aWaitCursor;
- SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
+ SUIT_OverrideCursor aWaitCursor;
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
if( CheckBoxMesh->isChecked() ) {
- if( GetConstructorId() == 0 )
- aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis,
- anAngle, aNbSteps, aTolerance);
- else
- aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis,
- anAngle, aNbSteps, aTolerance);
- }
- else
- aMeshEditor->RotationSweep(anElementsId.inout(),
- anAxis,
- anAngle,
- aNbSteps,
- aTolerance);
- SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
- mySimulation->SetData(aMeshPreviewStruct._retn());
+ if( GetConstructorId() == 0 )
+ aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis,
+ anAngle, aNbSteps, aTolerance);
+ else
+ aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis,
+ anAngle, aNbSteps, aTolerance);
+ }
+ else
+ aMeshEditor->RotationSweep(anElementsId.inout(),
+ anAxis,
+ anAngle,
+ aNbSteps,
+ aTolerance);
+ SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
+ mySimulation->SetData(aMeshPreviewStruct._retn());
} catch (...) {}
}
else
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
+ tr("SMESH_ERROR"),
+ tr("NO_MESH_SELECTED"));
return;
}
if ( !myFilterDlg )
aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, false);
else
aMeshEditor->Rotate(anElementsId, anAxis, anAngle, false);
- if( !myMesh->_is_nil())
- myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
+ if( !myMesh->_is_nil())
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
case COPY_ELEMS_BUTTON:
if ( makeGroups ) {
else
aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
}
- if( !myMesh->_is_nil())
- myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
+ if( !myMesh->_is_nil())
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
case MAKE_MESH_BUTTON:
SMESH::SMESH_Mesh_var mesh;
else
mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
LineEditNewMesh->text().toLatin1().data());
- if( !mesh->_is_nil())
- mesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
+ if( !mesh->_is_nil())
+ mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
}
} catch (...) {
}
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++) {
- const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
- if (e)
- newIndices.Add(e->GetID());
- myNbOkElements++;
+ const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+ if (e)
+ newIndices.Add(e->GetID());
+ myNbOkElements++;
}
mySelector->AddOrRemoveIndex( anIO, newIndices, false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( anIO, true, true );
+ aViewWindow->highlight( anIO, true, true );
myElementsId = theNewText;
}
myEditCurrentArgument = (QWidget*)LineEditElements;
SMESH::SetPointRepresentation(false);
if (CheckBoxMesh->isChecked()) {
- if ( aViewWindow )
- aViewWindow->SetSelectionMode(ActorSelection);
+ if ( aViewWindow )
+ aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
} else {
- if ( aViewWindow )
- aViewWindow->SetSelectionMode( CellSelection );
- }
+ if ( aViewWindow )
+ aViewWindow->SetSelectionMode( CellSelection );
+ }
} else if (send == SelectPointButton) {
myEditCurrentArgument = (QWidget*)SpinBox_X;
SMESH::SetPointRepresentation(true);
- if ( aViewWindow )
- aViewWindow->SetSelectionMode( NodeSelection );
+ if ( aViewWindow )
+ aViewWindow->SetSelectionMode( NodeSelection );
} else if (send == SelectVectorButton) {
myEditCurrentArgument = (QWidget*)SpinBox_DX;
SMESH::SetPointRepresentation(true);
- if ( aViewWindow )
- aViewWindow->SetSelectionMode( NodeSelection );
+ if ( aViewWindow )
+ aViewWindow->SetSelectionMode( NodeSelection );
}
break;
}
bool SMESHGUI_RotationDlg::IsAxisOk()
{
return (SpinBox_DX->GetValue() != 0 ||
- SpinBox_DY->GetValue() != 0 ||
- SpinBox_DZ->GetValue() != 0);
+ SpinBox_DY->GetValue() != 0 ||
+ SpinBox_DZ->GetValue() != 0);
}
//=================================================================================
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
+ tr("SMESH_ERROR"),
+ tr("NO_MESH_SELECTED"));
return;
}
if ( !myFilterDlg )
SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(io); // m,sm,gr->m
if ( !mesh->_is_nil() ) {*/
_PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
- //FindSObject( mesh );
+ //FindSObject( mesh );
if ( so ) {
CORBA::Object_var obj = SMESH::SObjectToObject(so, SMESH::GetActiveStudyDocument());
if(!CORBA::is_nil(obj)){
SMESH_Actor* actor = SMESH::FindActorByEntry( ent.toLatin1().data() );
if ( actor && actor->hasIO() ) {
if(SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView())
- return QVariant( aViewWindow->isVisible( actor->getIO() ) );
+ return QVariant( aViewWindow->isVisible( actor->getIO() ) );
}
}
return QVariant( false );
SalomeApp_Study* _study = dynamic_cast<SalomeApp_Study*>( study() );
if( _study )
{
- _PTR(SObject) obj = _study->studyDS()->FindObjectID( anIt.Value()->getEntry() );
- if( obj )
- names.append( obj->GetName().c_str() );
+ _PTR(SObject) obj = _study->studyDS()->FindObjectID( anIt.Value()->getEntry() );
+ if( obj )
+ names.append( obj->GetName().c_str() );
}
}
}
//! Hilight object in VTK viewer
void highlight( const Handle( SALOME_InteractiveObject )&,
- const bool, const bool = true );
+ const bool, const bool = true );
//! Select some nodes or elements in VTK
void addOrRemoveIndex( const Handle( SALOME_InteractiveObject )&,
- const TColStd_MapOfInteger&, const bool );
+ const TColStd_MapOfInteger&, const bool isModeShift);
SVTK_ViewWindow* viewWindow() const;
SVTK_Selector* selector() const;
//! Get names, types and ids of selected objects
virtual void selected( QStringList&,
- SMESHGUI_Dialog::TypesList&, QStringList& ) const;
+ SMESHGUI_Dialog::TypesList&, QStringList& ) const;
//! Find type by id
virtual int typeById( const QString&, const EntityType ) const;
LineEdit5->setEnabled(false);
if (!CheckBoxPolygons->isVisible())
- CheckBoxPolygons->show();
+ CheckBoxPolygons->show();
if (!CheckBoxPolyedrs->isVisible())
- CheckBoxPolyedrs->show();
+ CheckBoxPolyedrs->show();
myOk5 = true;
SMESH::SetPointRepresentation(false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(CellSelection);
+ aViewWindow->SetSelectionMode(CellSelection);
break;
}
}
LineEdit4->text().toLong(),
LineEdit5->text().toLong(),
LineEdit6->text().toLong(),
- toCreatePolygons,
- toCreatePolyedrs);
+ toCreatePolygons,
+ toCreatePolyedrs);
else if (aConstructorId == 1)
anError = aMeshEditor->SewConformFreeBorders(LineEdit1->text().toLong(),
LineEdit2->text().toLong(),
LineEdit3->text().toLong(),
LineEdit4->text().toLong(),
LineEdit6->text().toLong(),
- toCreatePolygons,
- toCreatePolyedrs);
+ toCreatePolygons,
+ toCreatePolyedrs);
else if (aConstructorId == 3) {
QStringList aListElementsId1 = LineEdit1->text().split(" ", QString::SkipEmptyParts);
QStringList aListElementsId2 = LineEdit4->text().split(" ", QString::SkipEmptyParts);
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(NodeSelection);
+ aViewWindow->SetSelectionMode(NodeSelection);
const SMDS_MeshNode * n = aMesh->FindNode(theNewText.toInt());
if (n) {
- newIndices.Add(n->GetID());
- mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( myActor->getIO(), true, true );
-
+ newIndices.Add(n->GetID());
+ mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->highlight( myActor->getIO(), true, true );
+
if (send == LineEdit1)
myOk1 = true;
else if (send == LineEdit2)
SMESH::SetPointRepresentation(false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(CellSelection);
+ aViewWindow->SetSelectionMode(CellSelection);
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++) {
const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
if (e)
- newIndices.Add(e->GetID());
-
+ newIndices.Add(e->GetID());
+
if (!isEvenOneExists)
isEvenOneExists = true;
}
mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( myActor->getIO(), true, true );
+ aViewWindow->highlight( myActor->getIO(), true, true );
if (isEvenOneExists) {
if (send == LineEdit1)
QLabel* anIdLabel = new QLabel( tr("ELEMENT_ID"), aMainGrp );
myElementId = new QLineEdit( aMainGrp );
myElementId->setValidator( new SMESHGUI_IdValidator( theParent,
- !myIsMultipleAllowed ? 1 : 0 ) ); // 0 for any number of entities
+ !myIsMultipleAllowed ? 1 : 0 ) ); // 0 for any number of entities
// shape name
QLabel* aNameLabel = new QLabel( tr("GEOMETRY_NAME"), aMainGrp );
int shapeDim = 0; // max dim with several shapes
//if ( /*mySelectionMgr*/ selectionMgr()->isOk(anIObj) ) // check that the mesh has a valid shape
{
- _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());
- GEOM::GEOM_Object_var mainShape = SMESH::GetGeom(aSO);
- if ( !mainShape->_is_nil() )
- {
- TopoDS_Shape aShape;
- if ( GEOMBase::GetShape(mainShape, aShape))
- {
- TopAbs_ShapeEnum types[4] = { TopAbs_EDGE, TopAbs_FACE, TopAbs_SHELL, TopAbs_SOLID };
- for ( int dim = 4; dim > 0; --dim ) {
- TopAbs_ShapeEnum type = types[ dim - 1 ];
- TopAbs_ShapeEnum avoid = ( type == TopAbs_SHELL ) ? TopAbs_SOLID : TopAbs_SHAPE;
- TopExp_Explorer exp( aShape, type, avoid );
- for ( ; nbShapes[ type ] < 2 && exp.More(); exp.Next() )
- ++nbShapes[ type ];
- if ( nbShapes[ type ] > 1 ) {
- shapeDim = dim;
- break;
- }
- }
- }
- }
+ _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());
+ GEOM::GEOM_Object_var mainShape = SMESH::GetGeom(aSO);
+ if ( !mainShape->_is_nil() )
+ {
+ TopoDS_Shape aShape;
+ if ( GEOMBase::GetShape(mainShape, aShape))
+ {
+ TopAbs_ShapeEnum types[4] = { TopAbs_EDGE, TopAbs_FACE, TopAbs_SHELL, TopAbs_SOLID };
+ for ( int dim = 4; dim > 0; --dim ) {
+ TopAbs_ShapeEnum type = types[ dim - 1 ];
+ TopAbs_ShapeEnum avoid = ( type == TopAbs_SHELL ) ? TopAbs_SOLID : TopAbs_SHAPE;
+ TopExp_Explorer exp( aShape, type, avoid );
+ for ( ; nbShapes[ type ] < 2 && exp.More(); exp.Next() )
+ ++nbShapes[ type ];
+ if ( nbShapes[ type ] > 1 ) {
+ shapeDim = dim;
+ break;
+ }
+ }
+ }
+ }
}
if (shapeDim > 0)
- {
- if ( nbShapes[ TopAbs_SHELL ] + nbShapes[ TopAbs_SOLID ] > 1 )
- shapeDim = 3;
- hasElement[ EDGE ] = shapeDim > 0 && myMesh->NbEdges();
- hasElement[ FACE ] = shapeDim > 1 && myMesh->NbFaces();
- hasElement[ VOLUME ] = shapeDim > 2 && myMesh->NbVolumes();
- }
+ {
+ if ( nbShapes[ TopAbs_SHELL ] + nbShapes[ TopAbs_SOLID ] > 1 )
+ shapeDim = 3;
+ hasElement[ EDGE ] = shapeDim > 0 && myMesh->NbEdges();
+ hasElement[ FACE ] = shapeDim > 1 && myMesh->NbFaces();
+ hasElement[ VOLUME ] = shapeDim > 2 && myMesh->NbVolumes();
+ }
myHasSolids = nbShapes[ TopAbs_SOLID ];
}
QStringList aListId = myDlg->myElementId->text().split( " ", QString::SkipEmptyParts);
if (aListId.count() == 1)
{
- int elemID = (aListId.first()).toInt();
- myGeomObj = GEOM::GEOM_Object::_duplicate(
- SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement
- ( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().constData()) );
+ int elemID = (aListId.first()).toInt();
+ myGeomObj = GEOM::GEOM_Object::_duplicate(
+ SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement
+ ( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().constData()) );
}
else
{
- GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-
- if (geomGen->_is_nil() || !aStudy)
- return;
-
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- geomGen->GetIShapesOperations(aStudy->StudyId());
- if (aShapesOp->_is_nil() )
- return;
-
- TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
-
- std::map<double, GEOM::GEOM_Object_var> aGeomObjectsMap;
- GEOM::GEOM_Object_var aGeomObject;
-
- GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
-
- for ( int i = 0; i < aListId.count(); i++ )
- {
- aGeomObject =
- SMESHGUI::GetSMESHGen()->FindGeometryByMeshElement(myMesh.in(), aListId[i].toInt());
-
- if (aGeomObject->_is_nil()) continue;
-
- double anId = aShapesOp->GetSubShapeIndex(aMeshShape, aGeomObject);
- if (aShapesOp->IsDone() && aGeomObjectsMap.find(anId) == aGeomObjectsMap.end())
- {
- aGeomObjectsMap[anId] = aGeomObject;
-
- TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aGeomObject->GetShapeType();
- if (i == 0)
- aGroupType = aSubShapeType;
- else if (aSubShapeType != aGroupType)
- aGroupType = TopAbs_SHAPE;
- }
- }
-
- int aNumberOfGO = aGeomObjectsMap.size();
- if (aNumberOfGO == 1)
- myGeomObj = (*aGeomObjectsMap.begin()).second;
- else if (aNumberOfGO > 1)
- {
- GEOM::GEOM_IGroupOperations_var aGroupOp =
- geomGen->GetIGroupOperations(aStudy->StudyId());
- if(aGroupOp->_is_nil())
- return;
-
- GEOM::ListOfGO_var aGeomObjects = new GEOM::ListOfGO();
- aGeomObjects->length( aNumberOfGO );
-
- int i = 0;
- std::map<double, GEOM::GEOM_Object_var>::iterator anIter;
- for (anIter = aGeomObjectsMap.begin(); anIter!=aGeomObjectsMap.end(); anIter++)
- aGeomObjects[i++] = (*anIter).second;
-
- //create geometry group
- myGeomObj = aGroupOp->CreateGroup(aMeshShape, aGroupType);
- aGroupOp->UnionList(myGeomObj, aGeomObjects);
-
- if (!aGroupOp->IsDone())
- return;
- }
-
- // publish the GEOM object in study
- QString aNewGeomGroupName ( myDlg->myGeomName->text() );
-
- SALOMEDS::SObject_var aNewGroupSO =
- geomGen->AddInStudy(SMESHGUI::GetSMESHGen()->GetCurrentStudy(), myGeomObj,
- aNewGeomGroupName.toLatin1().data(), aMeshShape);
+ GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
+ _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+
+ if (geomGen->_is_nil() || !aStudy)
+ return;
+
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ geomGen->GetIShapesOperations(aStudy->StudyId());
+ if (aShapesOp->_is_nil() )
+ return;
+
+ TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
+
+ std::map<double, GEOM::GEOM_Object_var> aGeomObjectsMap;
+ GEOM::GEOM_Object_var aGeomObject;
+
+ GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
+
+ for ( int i = 0; i < aListId.count(); i++ )
+ {
+ aGeomObject =
+ SMESHGUI::GetSMESHGen()->FindGeometryByMeshElement(myMesh.in(), aListId[i].toInt());
+
+ if (aGeomObject->_is_nil()) continue;
+
+ double anId = aShapesOp->GetSubShapeIndex(aMeshShape, aGeomObject);
+ if (aShapesOp->IsDone() && aGeomObjectsMap.find(anId) == aGeomObjectsMap.end())
+ {
+ aGeomObjectsMap[anId] = aGeomObject;
+
+ TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aGeomObject->GetShapeType();
+ if (i == 0)
+ aGroupType = aSubShapeType;
+ else if (aSubShapeType != aGroupType)
+ aGroupType = TopAbs_SHAPE;
+ }
+ }
+
+ int aNumberOfGO = aGeomObjectsMap.size();
+ if (aNumberOfGO == 1)
+ myGeomObj = (*aGeomObjectsMap.begin()).second;
+ else if (aNumberOfGO > 1)
+ {
+ GEOM::GEOM_IGroupOperations_var aGroupOp =
+ geomGen->GetIGroupOperations(aStudy->StudyId());
+ if(aGroupOp->_is_nil())
+ return;
+
+ GEOM::ListOfGO_var aGeomObjects = new GEOM::ListOfGO();
+ aGeomObjects->length( aNumberOfGO );
+
+ int i = 0;
+ std::map<double, GEOM::GEOM_Object_var>::iterator anIter;
+ for (anIter = aGeomObjectsMap.begin(); anIter!=aGeomObjectsMap.end(); anIter++)
+ aGeomObjects[i++] = (*anIter).second;
+
+ //create geometry group
+ myGeomObj = aGroupOp->CreateGroup(aMeshShape, aGroupType);
+ aGroupOp->UnionList(myGeomObj, aGeomObjects);
+
+ if (!aGroupOp->IsDone())
+ return;
+ }
+
+ // publish the GEOM object in study
+ QString aNewGeomGroupName ( myDlg->myGeomName->text() );
+
+ SALOMEDS::SObject_var aNewGroupSO =
+ geomGen->AddInStudy(SMESHGUI::GetSMESHGen()->GetCurrentStudy(), myGeomObj,
+ aNewGeomGroupName.toLatin1().data(), aMeshShape);
}
}
catch (const SALOME::SALOME_Exception& S_ex) {
aList.First(), aString);
if (nbElems > 0) {
if (!myIsMultipleAllowed && nbElems != 1 )
- return;
+ return;
setElementID( aString );
myDlg->setButtonEnabled( true, QtxDialog::OK );
}
{
if ( SMDS_Mesh* aMesh = actor->GetObject()->GetMesh() )
{
- SMDSAbs_ElementType type = SMDSAbs_Edge;
- switch ( myDlg->myElemTypeGroup->checkedId() ) {
- case EDGE : type = SMDSAbs_Edge; break;
- case FACE : type = SMDSAbs_Face; break;
- case VOLUME: type = SMDSAbs_Volume; break;
- default: return;
- }
- TColStd_MapOfInteger newIndices;
- QStringList aListId = theNewText.split( " ", QString::SkipEmptyParts);
- for ( int i = 0; i < aListId.count(); i++ ) {
- if ( const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() ))
- if ( e->GetType() == type )
- newIndices.Add( e->GetID() );
- }
-
- if ( !newIndices.IsEmpty() )
- {
- if (!myIsMultipleAllowed && newIndices.Extent() != 1)
- return;
- if ( SVTK_Selector* s = selector() ) {
- s->AddOrRemoveIndex( actor->getIO(), newIndices, false );
- viewWindow()->highlight( actor->getIO(), true, true );
- myDlg->setButtonEnabled( true, QtxDialog::OK );
- }
- }
+ SMDSAbs_ElementType type = SMDSAbs_Edge;
+ switch ( myDlg->myElemTypeGroup->checkedId() ) {
+ case EDGE : type = SMDSAbs_Edge; break;
+ case FACE : type = SMDSAbs_Face; break;
+ case VOLUME: type = SMDSAbs_Volume; break;
+ default: return;
+ }
+ TColStd_MapOfInteger newIndices;
+ QStringList aListId = theNewText.split( " ", QString::SkipEmptyParts);
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ if ( const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() ))
+ if ( e->GetType() == type )
+ newIndices.Add( e->GetID() );
+ }
+
+ if ( !newIndices.IsEmpty() )
+ {
+ if (!myIsMultipleAllowed && newIndices.Extent() != 1)
+ return;
+ if ( SVTK_Selector* s = selector() ) {
+ s->AddOrRemoveIndex( actor->getIO(), newIndices, false );
+ viewWindow()->highlight( actor->getIO(), true, true );
+ myDlg->setButtonEnabled( true, QtxDialog::OK );
+ }
+ }
}
}
}
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
int id1, id2;
if ( !getNodeIds(myEdge->text(), id1, id2) )
- return;
+ return;
const SMDS_MeshNode* aNode1 = aMesh->FindNode( id1 );
const SMDS_MeshNode* aNode2 = aMesh->FindNode( id2 );
if ( !aNode1 || !aNode2 || aNode1 == aNode2 )
- return;
+ return;
// find a triangle and an edge index
const SMDS_MeshElement* tria1;
if ( findTriangles(aNode1,aNode2,tria1,tria2) )
{
- newIndices.Add(tria1->GetID());
-
- const SMDS_MeshNode* a3Nodes[3];
- SMDS_ElemIteratorPtr it;
- int edgeInd = 2, i;
- for (i = 0, it = tria1->nodesIterator(); it->more(); i++) {
- a3Nodes[ i ] = static_cast<const SMDS_MeshNode*>(it->next());
- if (i > 0 && ( a3Nodes[ i ] == aNode1 && a3Nodes[ i - 1] == aNode2 ||
- a3Nodes[ i ] == aNode2 && a3Nodes[ i - 1] == aNode1 ) ) {
- edgeInd = i - 1;
- break;
- }
- }
- newIndices.Add(-edgeInd-1);
-
- myOkBtn->setEnabled(true);
- myApplyBtn->setEnabled(true);
+ newIndices.Add(tria1->GetID());
+
+ const SMDS_MeshNode* a3Nodes[3];
+ SMDS_ElemIteratorPtr it;
+ int edgeInd = 2, i;
+ for (i = 0, it = tria1->nodesIterator(); it->more(); i++) {
+ a3Nodes[ i ] = static_cast<const SMDS_MeshNode*>(it->next());
+ if (i > 0 && ( a3Nodes[ i ] == aNode1 && a3Nodes[ i - 1] == aNode2 ||
+ a3Nodes[ i ] == aNode2 && a3Nodes[ i - 1] == aNode1 ) ) {
+ edgeInd = i - 1;
+ break;
+ }
+ }
+ newIndices.Add(-edgeInd-1);
+
+ myOkBtn->setEnabled(true);
+ myApplyBtn->setEnabled(true);
}
mySelector->AddOrRemoveIndex(anIO,newIndices, false);
SMESH::GetViewWindow(mySMESHGUI)->highlight( anIO, true, true );
{
const SMDS_MeshElement* tria[2];
if( SMESH::GetEdgeNodes( mySelector, aVisualObj, anId1, anId2 ) >= 1 &&
- findTriangles( aMesh->FindNode( anId1 ), aMesh->FindNode( anId2 ), tria[0],tria[1] ) )
+ findTriangles( aMesh->FindNode( anId1 ), aMesh->FindNode( anId2 ), tria[0],tria[1] ) )
{
- QString aText = QString("%1-%2").arg(anId1).arg(anId2);
- myEdge->setText(aText);
-
- myOkBtn->setEnabled(true);
- myApplyBtn->setEnabled(true);
+ QString aText = QString("%1-%2").arg(anId1).arg(anId2);
+ myEdge->setText(aText);
+
+ myOkBtn->setEnabled(true);
+ myApplyBtn->setEnabled(true);
}
else
{
- myEdge->clear();
+ myEdge->clear();
}
}
}
if (aMesh->_is_nil()) {
SUIT_MessageBox::information(SMESH::GetDesktop(mySMESHGUI),
- tr("SMESH_ERROR"),
- tr("SMESHG_NO_MESH"));
+ tr("SMESH_ERROR"),
+ tr("SMESHG_NO_MESH"));
return false;
}
if ( CheckBoxParametric->isChecked() ) {
if(CheckBoxMesh->isChecked())
- aResult = aMeshEditor->SmoothParametricObject(mySelectedObject, aNodesId.inout(),
- anIterationLimit, aMaxAspectRatio, aMethod);
- else
- aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(),
- anIterationLimit, aMaxAspectRatio, aMethod);
+ aResult = aMeshEditor->SmoothParametricObject(mySelectedObject, aNodesId.inout(),
+ anIterationLimit, aMaxAspectRatio, aMethod);
+ else
+ aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(),
+ anIterationLimit, aMaxAspectRatio, aMethod);
}
else {
if(CheckBoxMesh->isChecked())
- aResult = aMeshEditor->SmoothObject(mySelectedObject, aNodesId.inout(),
- anIterationLimit, aMaxAspectRatio, aMethod);
- else
- aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(),
- anIterationLimit, aMaxAspectRatio, aMethod);
+ aResult = aMeshEditor->SmoothObject(mySelectedObject, aNodesId.inout(),
+ anIterationLimit, aMaxAspectRatio, aMethod);
+ else
+ aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(),
+ anIterationLimit, aMaxAspectRatio, aMethod);
}
- myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
} catch (...) {
}
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO();
TColStd_MapOfInteger newIndices;
for (int i = 0; i < aListId.count(); i++) {
- const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
- if (e)
- newIndices.Add(e->GetID());
- myNbOkElements++;
+ const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+ if (e)
+ newIndices.Add(e->GetID());
+ myNbOkElements++;
}
mySelector->AddOrRemoveIndex(anIO, newIndices, false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( anIO, true, true );
+ aViewWindow->highlight( anIO, true, true );
myElementsId = theNewText;
} else if (send == LineEditNodes) {
TColStd_MapOfInteger newIndices;
for (int i = 0; i < aListId.count(); i++) {
- const SMDS_MeshNode * n = aMesh->FindNode(aListId[ i ].toInt());
- if (n)
- newIndices.Add(n->GetID());
- myNbOkNodes++;
+ const SMDS_MeshNode * n = aMesh->FindNode(aListId[ i ].toInt());
+ if (n)
+ newIndices.Add(n->GetID());
+ myNbOkNodes++;
}
mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( myActor->getIO(), true, true );
+ aViewWindow->highlight( myActor->getIO(), true, true );
}
}
myEditCurrentArgument = LineEditElements;
SMESH::SetPointRepresentation(false);
if (CheckBoxMesh->isChecked()) {
- // mySelectionMgr->setSelectionModes(ActorSelection);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(ActorSelection);
- mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+ // mySelectionMgr->setSelectionModes(ActorSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(ActorSelection);
+ mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
} else {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- }
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
+ }
} else if (send == SelectNodesButton) {
- LineEditNodes->clear();
+ LineEditNodes->clear();
myEditCurrentArgument = LineEditNodes;
SMESH::SetPointRepresentation(true);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
- aViewWindow->SetSelectionMode(NodeSelection);
- }
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
+ aViewWindow->SetSelectionMode(NodeSelection);
+ }
}
myEditCurrentArgument->setFocus();
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
+ tr("SMESH_ERROR"),
+ tr("NO_MESH_SELECTED"));
return;
}
if ( !myFilterDlg )
// purpose :
//=================================================================================
void SMESHGUI_SpinBox::RangeStepAndValidator( double min,
- double max,
- double step,
- unsigned short precision )
+ double max,
+ double step,
+ unsigned short precision )
{
setPrecision(precision*(-1)); // PAL8769. Minus is for using 'g' double->string conversion specifier,
// see QtxDoubleSpinBox::mapValueToText( double v )
~SMESHGUI_SpinBox();
void RangeStepAndValidator( double = -1000000.0,
- double = +1000000.0,
- double = 100.0,
- unsigned short = 3 );
+ double = +1000000.0,
+ double = 100.0,
+ unsigned short = 3 );
void SetValue( double );
double GetValue() const;
QString GetString() const;
int aDimension = 0;
double aNbDimElements = 0;
if (aNbVolumes > 0) {
- aNbDimElements = aNbVolumes;
- aDimension = 3;
+ aNbDimElements = aNbVolumes;
+ aDimension = 3;
}
else if(aNbFaces > 0) {
- aNbDimElements = aNbFaces;
- aDimension = 2;
+ aNbDimElements = aNbFaces;
+ aDimension = 2;
}
else if(aNbEdges > 0) {
- aNbDimElements = aNbEdges;
- aDimension = 1;
+ aNbDimElements = aNbEdges;
+ aDimension = 1;
}
else if(aNbNodes > 0) {
- aNbDimElements = aNbNodes;
- aDimension = 0;
+ aNbDimElements = aNbNodes;
+ aDimension = 0;
}
// information about the mesh
aMeshSO->FindSubObject(SMESH::Tag_NodeGroups, anObj);
if (anObj) {
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
- if (it->More()) {
+ if (it->More()) {
anInfo.append(QString("Groups:<br><br>"));
hasGroup = true;
}
- for ( ; it->More(); it->Next()) {
+ for ( ; it->More(); it->Next()) {
_PTR(SObject) subObj = it->Value();
CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
- if (!aGroup->_is_nil()) {
+ SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
+ if (!aGroup->_is_nil()) {
anInfo.append(QString("- <b>%1</b><br>").arg(aGroup->GetName()));
anInfo.append(QString("%1<br>").arg("on nodes"));
anInfo.append(QString("%1<br>").arg(aGroup->Size()));
anInfo.append(QString("<br>"));
}
}
- }
+ }
}
// info about groups on edges
anInfo.append(QString("Groups:<br><br>"));
hasGroup = true;
}
- for ( ; it->More(); it->Next()) {
+ for ( ; it->More(); it->Next()) {
_PTR(SObject) subObj = it->Value();
CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
- if (!aGroup->_is_nil()) {
+ SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
+ if (!aGroup->_is_nil()) {
anInfo.append(QString("- <b>%1</b><br>").arg(aGroup->GetName()));
anInfo.append(QString("%1<br>").arg("on edges"));
anInfo.append(QString("%1<br>").arg(aGroup->Size()));
anInfo.append(QString("<br>"));
}
}
- }
+ }
}
// info about groups on faces
aMeshSO->FindSubObject(SMESH::Tag_FaceGroups, anObj);
if (anObj) {
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
- if (!hasGroup && it->More()) {
+ if (!hasGroup && it->More()) {
anInfo.append(QString("Groups:<br><br>"));
hasGroup = true;
}
- for ( ; it->More(); it->Next()) {
+ for ( ; it->More(); it->Next()) {
_PTR(SObject) subObj = it->Value();
CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
- if (!aGroup->_is_nil()) {
+ SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
+ if (!aGroup->_is_nil()) {
anInfo.append(QString("- <b>%1</b><br>").arg(aGroup->GetName()));
anInfo.append(QString("%1<br>").arg("on faces"));
anInfo.append(QString("%1<br>").arg(aGroup->Size()));
anInfo.append(QString("<br>"));
}
}
- }
+ }
}
// info about groups on volumes
aMeshSO->FindSubObject(SMESH::Tag_VolumeGroups, anObj);
if (anObj) {
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
- if (!hasGroup && it->More())
+ if (!hasGroup && it->More())
anInfo.append(QString("Groups:<br>"));
- for ( ; it->More(); it->Next()) {
+ for ( ; it->More(); it->Next()) {
_PTR(SObject) subObj = it->Value();
CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
- if (!aGroup->_is_nil()) {
+ SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
+ if (!aGroup->_is_nil()) {
anInfo.append(QString("- <b>%1</b><br>").arg(aGroup->GetName()));
anInfo.append(QString("%1<br>").arg("on volumes"));
anInfo.append(QString("%1<br>").arg(aGroup->Size()));
anInfo.append(QString("<br>"));
}
}
- }
+ }
}
myInfo->setText(anInfo);
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
SMESH::SetPointRepresentation(false);
if (!CheckBoxMesh->isChecked())
{
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(CellSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(CellSelection);
}
}
else
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false );
- if( !myMesh->_is_nil())
- myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
+ if( !myMesh->_is_nil())
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
}
case COPY_ELEMS_BUTTON: {
else
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, true);
}
- if( !myMesh->_is_nil())
- myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
+ if( !myMesh->_is_nil())
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
}
case MAKE_MESH_BUTTON: {
else
mesh = aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups,
LineEditNewMesh->text().toLatin1().data());
- if( !mesh->_is_nil())
- mesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
+ if( !mesh->_is_nil())
+ mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
}
}
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
if (send == LineEditElements) {
for (int i = 0; i < aListId.count(); i++) {
- const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
- if (e)
- newIndices.Add(e->GetID());
- myNbOkElements++;
+ const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+ if (e)
+ newIndices.Add(e->GetID());
+ myNbOkElements++;
}
mySelector->AddOrRemoveIndex( anIO, newIndices, false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( anIO, true, true );
+ aViewWindow->highlight( anIO, true, true );
myElementsId = theNewText;
}
SMESH::SetPointRepresentation(false);
if (CheckBoxMesh->isChecked()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(ActorSelection);
+ aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
} else {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(CellSelection);
+ aViewWindow->SetSelectionMode(CellSelection);
}
} else if (send == SelectPointButton) {
myEditCurrentArgument = (QWidget*)SpinBox_X;
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
+ tr("SMESH_ERROR"),
+ tr("NO_MESH_SELECTED"));
return;
}
if ( !myFilterDlg )
SMESH::SetPointRepresentation(false);
if (!CheckBoxMesh->isChecked())
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode( CellSelection );
+ aViewWindow->SetSelectionMode( CellSelection );
}
myEditCurrentArgument = (QWidget*)LineEditElements;
aMeshEditor->TranslateObject(mySelectedObject, aVector, false);
else
aMeshEditor->Translate(anElementsId, aVector, false);
- if( !myMesh->_is_nil())
- myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
+ if( !myMesh->_is_nil())
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
case COPY_ELEMS_BUTTON:
if ( makeGroups ) {
else
aMeshEditor->Translate(anElementsId, aVector, true);
}
- if( !myMesh->_is_nil())
- myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
+ if( !myMesh->_is_nil())
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
case MAKE_MESH_BUTTON:
SMESH::SMESH_Mesh_var mesh;
else
mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
LineEditNewMesh->text().toLatin1().data());
- if( !mesh->_is_nil())
- mesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
+ if( !mesh->_is_nil())
+ mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
}
} catch (...) {
}
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
if (send == LineEditElements) {
for (int i = 0; i < aListId.count(); i++) {
- const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
- if (e)
- newIndices.Add(e->GetID());
- myNbOkElements++;
+ const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
+ if (e)
+ newIndices.Add(e->GetID());
+ myNbOkElements++;
}
}
SMESH::SetPointRepresentation(false);
if (CheckBoxMesh->isChecked()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode( ActorSelection );
+ aViewWindow->SetSelectionMode( ActorSelection );
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
} else {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode( CellSelection );
+ aViewWindow->SetSelectionMode( CellSelection );
}
} else if (send == SelectButton1) {
myEditCurrentArgument = (QWidget*)SpinBox1_1;
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
+ tr("SMESH_ERROR"),
+ tr("NO_MESH_SELECTED"));
return;
}
if ( !myFilterDlg )
LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
if ( app )
app->onHelpContextModule( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) :
- QString( "" ), myHelpFileName );
+ QString( "" ), myHelpFileName );
else {
QString platform;
#ifdef WIN32
platform = "application";
#endif
SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ),
- tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
- arg( app->resourceMgr()->stringValue( "ExternalBrowser",
- platform ) ).
- arg( myHelpFileName ) );
+ tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
+ arg( app->resourceMgr()->stringValue( "ExternalBrowser",
+ platform ) ).
+ arg( myHelpFileName ) );
}
}
Handle(SALOME_InteractiveObject) IOS = It.Value();
SMESH_Actor* anActor = SMESH::FindActorByEntry( IOS->getEntry() );
if ( anActor )
- anActor->SetOpacity( opacity );
+ anActor->SetOpacity( opacity );
}
myViewWindow->Repaint();
}
if ( aList.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) FirstIOS = aList.First();
if ( !FirstIOS.IsNull() ) {
- SMESH_Actor* anActor = SMESH::FindActorByEntry( FirstIOS->getEntry() );
- if ( anActor )
- opacity = int( anActor->GetOpacity() * 100. + 0.5 );
+ SMESH_Actor* anActor = SMESH::FindActorByEntry( FirstIOS->getEntry() );
+ if ( anActor )
+ opacity = int( anActor->GetOpacity() * 100. + 0.5 );
}
}
else if ( aList.Extent() > 1 ) {
SALOME_ListIteratorOfListIO It( aList );
int setOp = -1;
for ( ; It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject) IO = It.Value();
- if ( !IO.IsNull() ) {
- SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
- if ( anActor ) {
- int op = int( anActor->GetOpacity() * 100. + 0.5 );
- if ( setOp < 0 )
- setOp = op;
- else if ( setOp != op ) {
- setOp = 100;
- break;
- }
- }
- }
+ Handle(SALOME_InteractiveObject) IO = It.Value();
+ if ( !IO.IsNull() ) {
+ SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
+ if ( anActor ) {
+ int op = int( anActor->GetOpacity() * 100. + 0.5 );
+ if ( setOp < 0 )
+ setOp = op;
+ else if ( setOp != op ) {
+ setOp = 100;
+ break;
+ }
+ }
+ }
}
if ( setOp >= 0 )
- opacity = setOp;
+ opacity = setOp;
}
else {
}
if(theOwner){
const Handle(SALOME_InteractiveObject)& anIO = theOwner->IO();
if(!anIO.IsNull()){
- if(anIO->hasEntry()){
- _PTR(Study) aStudy = GetActiveStudyDocument();
- _PTR(SObject) aSObj = aStudy->FindObjectID(anIO->getEntry());
- anObj = SObjectToObject(aSObj,aStudy);
- }
+ if(anIO->hasEntry()){
+ _PTR(Study) aStudy = GetActiveStudyDocument();
+ _PTR(SObject) aSObj = aStudy->FindObjectID(anIO->getEntry());
+ anObj = SObjectToObject(aSObj,aStudy);
+ }
}
}
return anObj;
(SUIT_Session::session()->activeApplication());
if (app && !CORBA::is_nil(theObject)) {
if(_PTR(Study) aStudy = GetActiveStudyDocument()){
- CORBA::String_var anIOR = app->orb()->object_to_string(theObject);
- if (strcmp(anIOR.in(), "") != 0)
- return aStudy->FindObjectIOR(anIOR.in());
+ CORBA::String_var anIOR = app->orb()->object_to_string(theObject);
+ if (strcmp(anIOR.in(), "") != 0)
+ return aStudy->FindObjectIOR(anIOR.in());
}
}
return _PTR(SObject)();
if (theSObject) {
_PTR(GenericAttribute) anAttr;
if (theSObject->FindAttribute(anAttr, "AttributeIOR")) {
- _PTR(AttributeIOR) anIOR = anAttr;
- CORBA::String_var aVal = anIOR->Value().c_str();
- return app->orb()->string_to_object(aVal);
+ _PTR(AttributeIOR) anIOR = anAttr;
+ CORBA::String_var aVal = anIOR->Value().c_str();
+ return app->orb()->string_to_object(aVal);
}
}
return CORBA::Object::_nil();
{
if (!theIO.IsNull()) {
if (theIO->hasEntry()) {
- _PTR(Study) aStudy = GetActiveStudyDocument();
- _PTR(SObject) anObj = aStudy->FindObjectID(theIO->getEntry());
- return SObjectToObject(anObj,aStudy);
+ _PTR(Study) aStudy = GetActiveStudyDocument();
+ _PTR(SObject) anObj = aStudy->FindObjectID(theIO->getEntry());
+ return SObjectToObject(anObj,aStudy);
}
}
return CORBA::Object::_nil();
for (int i = 1; anIter->More(); anIter->Next(), i++) {
_PTR(SObject) aSObj = anIter->Value();
if (i >= 4) {
- _PTR(ChildIterator) anIter1 = aStudy->NewChildIterator(aSObj);
- for ( ; anIter1->More(); anIter1->Next()) {
- _PTR(SObject) aSObj1 = anIter1->Value();
- anAttr = aBuilder->FindOrCreateAttribute(aSObj1, "AttributePixMap");
- aPixmap = anAttr;
+ _PTR(ChildIterator) anIter1 = aStudy->NewChildIterator(aSObj);
+ for ( ; anIter1->More(); anIter1->Next()) {
+ _PTR(SObject) aSObj1 = anIter1->Value();
+ anAttr = aBuilder->FindOrCreateAttribute(aSObj1, "AttributePixMap");
+ aPixmap = anAttr;
if (theIsNotModif) {
aPixmap->SetPixMap("ICON_SMESH_TREE_MESH");
} else if ( isEmptyMesh ) {
} else {
aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_PARTIAL");
}
- }
+ }
}
}
}
}
else {
SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
- QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- "application")).
- arg(theHelpFileName));
+ QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ "application")).
+ arg(theHelpFileName));
}
}
{
CORBA::Object_var anObj = DataOwnerToObject(theDataOwner);
if(!CORBA::is_nil(anObj))
- return TInterface::_narrow(anObj);
+ return TInterface::_narrow(anObj);
return TInterface::_nil();
}
SMESHGUI_EXPORT
CORBA::Object_var SObjectToObject( _PTR(SObject),
- _PTR(Study) );
+ _PTR(Study) );
SMESHGUI_EXPORT
CORBA::Object_var SObjectToObject( _PTR(SObject) );
{
CORBA::Object_var anObj = SObjectToObject(theSObject);
if(!CORBA::is_nil(anObj))
- return TInterface::_narrow(anObj);
+ return TInterface::_narrow(anObj);
return TInterface::_nil();
}
{
CORBA::Object_var anObj = IObjectToObject(theIO);
if(!CORBA::is_nil(anObj))
- return TInterface::_narrow(anObj);
+ return TInterface::_narrow(anObj);
return TInterface::_nil();
}
{
CORBA::Object_var anObj = IORToObject( theIOR );
if ( !CORBA::is_nil( anObj ) )
- return TInterface::_narrow( anObj );
+ return TInterface::_narrow( anObj );
return TInterface::_nil();
}
for ( int iV = 0; iV < views.count(); ++iV ) {
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) {
vtkRenderer *aRenderer = vtkWnd->getRenderer();
- VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
+ VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
vtkActorCollection *actors = aCopy.GetActors();
for (int i = 0; i < actors->GetNumberOfItems(); ++i ) {
// size of actors changes inside the loop
for ( int iV = 0; iV < views.count(); ++iV ) {
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) {
vtkRenderer *aRenderer = vtkWnd->getRenderer();
- VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
+ VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
vtkActorCollection *actors = aCopy.GetActors();
for (int i = 0; i < actors->GetNumberOfItems(); ++i ) {
// size of actors changes inside the loop
// char* buf = new char[100*1024];
// delete [] buf;
SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_VISU_PROBLEM"));
+ QObject::tr("SMESH_VISU_PROBLEM"));
} catch (...) {
// no more memory at all: last resort
MESSAGE_BEGIN ( "SMESHGUI_VTKUtils::OnVisuException(), exception even at showing a message!!!" <<
- std::endl << "Try to remove all visual data..." );
+ std::endl << "Try to remove all visual data..." );
if (theVISU_MemoryReserve) {
delete theVISU_MemoryReserve;
theVISU_MemoryReserve = 0;
}
RemoveAllObjectsWithActors();
SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_VISU_PROBLEM_CLEAR"));
+ QObject::tr("SMESH_VISU_PROBLEM_CLEAR"));
MESSAGE_END ( "...done" );
}
}
#endif
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
if(anIter != VISUAL_OBJ_CONT.end()){
- aVisualObj = anIter->second;
+ aVisualObj = anIter->second;
}else{
SalomeApp_Application* app =
dynamic_cast<SalomeApp_Application*>( SMESHGUI::activeStudy()->application() );
- _PTR(Study) aStudy = SMESHGUI::activeStudy()->studyDS();
- _PTR(SObject) aSObj = aStudy->FindObjectID(theEntry);
- if(aSObj){
- _PTR(GenericAttribute) anAttr;
- if(aSObj->FindAttribute(anAttr,"AttributeIOR")){
- _PTR(AttributeIOR) anIOR = anAttr;
- CORBA::String_var aVal = anIOR->Value().c_str();
- CORBA::Object_var anObj = app->orb()->string_to_object( aVal.in() );
- if(!CORBA::is_nil(anObj)){
- //Try narrow to SMESH_Mesh interface
- SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
- if(!aMesh->_is_nil()){
- aVisualObj.reset(new SMESH_MeshObj(aMesh));
- TVisualObjCont::value_type aValue(aKey,aVisualObj);
- VISUAL_OBJ_CONT.insert(aValue);
- }
- //Try narrow to SMESH_Group interface
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObj);
- if(!aGroup->_is_nil()){
- _PTR(SObject) aFatherSObj = aSObj->GetFather();
- if(!aFatherSObj) return aVisualObj;
- aFatherSObj = aFatherSObj->GetFather();
- if(!aFatherSObj) return aVisualObj;
- CORBA::String_var anEntry = aFatherSObj->GetID().c_str();
- TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
- if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
- aVisualObj.reset(new SMESH_GroupObj(aGroup,aMeshObj));
- TVisualObjCont::value_type aValue(aKey,aVisualObj);
- VISUAL_OBJ_CONT.insert(aValue);
- }
- }
- //Try narrow to SMESH_subMesh interface
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj);
- if(!aSubMesh->_is_nil()){
- _PTR(SObject) aFatherSObj = aSObj->GetFather();
- if(!aFatherSObj) return aVisualObj;
- aFatherSObj = aFatherSObj->GetFather();
- if(!aFatherSObj) return aVisualObj;
- CORBA::String_var anEntry = aFatherSObj->GetID().c_str();
- TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
- if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
- aVisualObj.reset(new SMESH_subMeshObj(aSubMesh,aMeshObj));
- TVisualObjCont::value_type aValue(aKey,aVisualObj);
- VISUAL_OBJ_CONT.insert(aValue);
- }
- }
- }
- }
- }
+ _PTR(Study) aStudy = SMESHGUI::activeStudy()->studyDS();
+ _PTR(SObject) aSObj = aStudy->FindObjectID(theEntry);
+ if(aSObj){
+ _PTR(GenericAttribute) anAttr;
+ if(aSObj->FindAttribute(anAttr,"AttributeIOR")){
+ _PTR(AttributeIOR) anIOR = anAttr;
+ CORBA::String_var aVal = anIOR->Value().c_str();
+ CORBA::Object_var anObj = app->orb()->string_to_object( aVal.in() );
+ if(!CORBA::is_nil(anObj)){
+ //Try narrow to SMESH_Mesh interface
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
+ if(!aMesh->_is_nil()){
+ aVisualObj.reset(new SMESH_MeshObj(aMesh));
+ TVisualObjCont::value_type aValue(aKey,aVisualObj);
+ VISUAL_OBJ_CONT.insert(aValue);
+ }
+ //Try narrow to SMESH_Group interface
+ SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObj);
+ if(!aGroup->_is_nil()){
+ _PTR(SObject) aFatherSObj = aSObj->GetFather();
+ if(!aFatherSObj) return aVisualObj;
+ aFatherSObj = aFatherSObj->GetFather();
+ if(!aFatherSObj) return aVisualObj;
+ CORBA::String_var anEntry = aFatherSObj->GetID().c_str();
+ TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
+ if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
+ aVisualObj.reset(new SMESH_GroupObj(aGroup,aMeshObj));
+ TVisualObjCont::value_type aValue(aKey,aVisualObj);
+ VISUAL_OBJ_CONT.insert(aValue);
+ }
+ }
+ //Try narrow to SMESH_subMesh interface
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj);
+ if(!aSubMesh->_is_nil()){
+ _PTR(SObject) aFatherSObj = aSObj->GetFather();
+ if(!aFatherSObj) return aVisualObj;
+ aFatherSObj = aFatherSObj->GetFather();
+ if(!aFatherSObj) return aVisualObj;
+ CORBA::String_var anEntry = aFatherSObj->GetID().c_str();
+ TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
+ if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
+ aVisualObj.reset(new SMESH_subMeshObj(aSubMesh,aMeshObj));
+ TVisualObjCont::value_type aValue(aKey,aVisualObj);
+ VISUAL_OBJ_CONT.insert(aValue);
+ }
+ }
+ }
+ }
+ }
}
}catch(...){
INFOS("GetMeshObj - There is no SMESH_Mesh object for the SALOMEDS::Strudy and Entry!!!");
if ( usedMB * 10 > freeMB )
// even dont try to show
SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_NO_MESH_VISUALIZATION"));
+ QObject::tr("SMESH_NO_MESH_VISUALIZATION"));
else
// there is a chance to succeed
continu = SUIT_MessageBox::warning
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_CONTINUE_MESH_VISUALIZATION"),
SUIT_MessageBox::Yes | SUIT_MessageBox::No,
- SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes;
+ SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes;
if ( !continu ) {
// remove the corresponding actors from all views
RemoveVisualObjectWithActors( theEntry );
if (anApp) {
if (SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow()))
- return aView;
+ return aView;
SUIT_ViewManager* aViewManager =
anApp->getViewManager(SVTK_Viewer::Type(), createIfNotFound);
SMESH_Actor* FindActorByEntry(SUIT_ViewWindow *theWindow,
- const char* theEntry)
+ const char* theEntry)
{
if(SVTK_ViewWindow* aViewWindow = GetVtkViewWindow(theWindow)){
vtkRenderer *aRenderer = aViewWindow->getRenderer();
vtkActorCollection *aCollection = aCopy.GetActors();
aCollection->InitTraversal();
while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
- if(anActor->hasIO()){
- Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
- if(anIO->hasEntry() && strcmp(anIO->getEntry(),theEntry) == 0){
- return anActor;
- }
- }
- }
+ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
+ if(anActor->hasIO()){
+ Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
+ if(anIO->hasEntry() && strcmp(anIO->getEntry(),theEntry) == 0){
+ return anActor;
+ }
+ }
+ }
}
}
return NULL;
CORBA::String_var anIOR = app->orb()->object_to_string( theObject );
_PTR(SObject) aSObject = aStudy->FindObjectIOR(anIOR.in());
if(aSObject){
- CORBA::String_var anEntry = aSObject->GetID().c_str();
- return FindActorByEntry(anEntry.in());
+ CORBA::String_var anEntry = aSObject->GetID().c_str();
+ return FindActorByEntry(anEntry.in());
}
}
return NULL;
SMESH_Actor* CreateActor(_PTR(Study) theStudy,
- const char* theEntry,
- int theIsClear)
+ const char* theEntry,
+ int theIsClear)
{
SMESH_Actor *anActor = NULL;
CORBA::Long anId = theStudy->StudyId();
if(TVisualObjPtr aVisualObj = GetVisualObj(anId,theEntry)){
_PTR(SObject) aSObj = theStudy->FindObjectID(theEntry);
if(aSObj){
- _PTR(GenericAttribute) anAttr;
- if(aSObj->FindAttribute(anAttr,"AttributeName")){
- _PTR(AttributeName) aName = anAttr;
- std::string aNameVal = aName->Value();
- anActor = SMESH_Actor::New(aVisualObj,theEntry,aNameVal.c_str(),theIsClear);
- }
-
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( aSObj ));
- if(!CORBA::is_nil(aGroup))
- {
- SALOMEDS::Color aColor = aGroup->GetColor();
- if( !( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 ) )
- {
- int r = 0, g = 0, b = 0;
- SMESH::GetColor( "SMESH", "fill_color", r, g, b, QColor( 0, 170, 255 ) );
- aColor.R = (float)r / 255.0;
- aColor.G = (float)g / 255.0;
- aColor.B = (float)b / 255.0;
- aGroup->SetColor( aColor );
- }
- if( aGroup->GetType() == SMESH::NODE )
- anActor->SetNodeColor( aColor.R, aColor.G, aColor.B );
- else if( aGroup->GetType() == SMESH::EDGE )
- anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B );
- else
- anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
- }
+ _PTR(GenericAttribute) anAttr;
+ if(aSObj->FindAttribute(anAttr,"AttributeName")){
+ _PTR(AttributeName) aName = anAttr;
+ std::string aNameVal = aName->Value();
+ anActor = SMESH_Actor::New(aVisualObj,theEntry,aNameVal.c_str(),theIsClear);
+ }
+
+ SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( aSObj ));
+ if(!CORBA::is_nil(aGroup))
+ {
+ SALOMEDS::Color aColor = aGroup->GetColor();
+ if( !( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 ) )
+ {
+ int r = 0, g = 0, b = 0;
+ SMESH::GetColor( "SMESH", "fill_color", r, g, b, QColor( 0, 170, 255 ) );
+ aColor.R = (float)r / 255.0;
+ aColor.G = (float)g / 255.0;
+ aColor.B = (float)b / 255.0;
+ aGroup->SetColor( aColor );
+ }
+ if( aGroup->GetType() == SMESH::NODE )
+ anActor->SetNodeColor( aColor.R, aColor.G, aColor.B );
+ else if( aGroup->GetType() == SMESH::EDGE )
+ anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B );
+ else
+ anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
+ }
}
}
return anActor;
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
vtkWnd->RemoveActor(theActor);
if(theActor->hasIO()){
- Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
- if(anIO->hasEntry()){
- std::string anEntry = anIO->getEntry();
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( vtkWnd->getViewManager()->study() );
- int aStudyId = aStudy->id();
- TVisualObjCont::key_type aKey(aStudyId,anEntry);
- VISUAL_OBJ_CONT.erase(aKey);
- }
+ Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
+ if(anIO->hasEntry()){
+ std::string anEntry = anIO->getEntry();
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( vtkWnd->getViewManager()->study() );
+ int aStudyId = aStudy->id();
+ TVisualObjCont::key_type aKey(aStudyId,anEntry);
+ VISUAL_OBJ_CONT.erase(aKey);
+ }
}
theActor->Delete();
vtkWnd->Repaint();
vtkActorCollection *aCollection = aCopy.GetActors();
aCollection->InitTraversal();
while(vtkActor *anAct = aCollection->GetNextActor())
- if(dynamic_cast<SMESH_Actor*>(anAct))
+ if(dynamic_cast<SMESH_Actor*>(anAct))
return false;
}
return true;
switch (theAction) {
case eDisplayAll: {
- while (vtkActor *anAct = aCollection->GetNextActor()) {
- if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
- anActor->SetVisibility(true);
- }
- }
- break;
+ while (vtkActor *anAct = aCollection->GetNextActor()) {
+ if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
+ anActor->SetVisibility(true);
+ }
+ }
+ break;
}
case eDisplayOnly:
case eEraseAll: {
- while (vtkActor *anAct = aCollection->GetNextActor()) {
- if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
- anActor->SetVisibility(false);
- }
- }
+ while (vtkActor *anAct = aCollection->GetNextActor()) {
+ if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
+ anActor->SetVisibility(false);
+ }
+ }
}
default: {
- if (SMESH_Actor *anActor = FindActorByEntry(theWnd,theEntry)) {
- switch (theAction) {
- case eDisplay:
- case eDisplayOnly:
- anActor->SetVisibility(true);
- if (theAction == eDisplayOnly) aRenderer->ResetCameraClippingRange();
- break;
- case eErase:
- anActor->SetVisibility(false);
- break;
- }
- } else {
- switch (theAction) {
- case eDisplay:
- case eDisplayOnly:
+ if (SMESH_Actor *anActor = FindActorByEntry(theWnd,theEntry)) {
+ switch (theAction) {
+ case eDisplay:
+ case eDisplayOnly:
+ anActor->SetVisibility(true);
+ if (theAction == eDisplayOnly) aRenderer->ResetCameraClippingRange();
+ break;
+ case eErase:
+ anActor->SetVisibility(false);
+ break;
+ }
+ } else {
+ switch (theAction) {
+ case eDisplay:
+ case eDisplayOnly:
{
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(theWnd->getViewManager()->study());
_PTR(Study) aDocument = aStudy->studyDS();
// Pass non-visual objects (hypotheses, etc.), return true in this case
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))) {
bool needFitAll = noSmeshActors(theWnd); // fit for the first object only
}
break;
}
- }
- }
+ }
+ }
}
}
}
SALOME_ListIO selected; mgr->selectedObjects( selected );
if( selected.Extent() == 0){
- vtkRenderer* aRenderer = aWnd->getRenderer();
- VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
- vtkActorCollection *aCollection = aCopy.GetActors();
- aCollection->InitTraversal();
- while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
- if(anActor->hasIO())
- if (!Update(anActor->getIO(),anActor->GetVisibility()))
+ vtkRenderer* aRenderer = aWnd->getRenderer();
+ VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
+ vtkActorCollection *aCollection = aCopy.GetActors();
+ aCollection->InitTraversal();
+ while(vtkActor *anAct = aCollection->GetNextActor()){
+ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
+ if(anActor->hasIO())
+ if (!Update(anActor->getIO(),anActor->GetVisibility()))
break; // avoid multiple warinings if visu failed
- }
- }
+ }
+ }
}else{
- SALOME_ListIteratorOfListIO anIter( selected );
- for( ; anIter.More(); anIter.Next()){
- Handle(SALOME_InteractiveObject) anIO = anIter.Value();
- if ( !Update(anIO,true) )
+ SALOME_ListIteratorOfListIO anIter( selected );
+ for( ; anIter.More(); anIter.Next()){
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if ( !Update(anIO,true) )
break; // avoid multiple warinings if visu failed
- }
+ }
}
RepaintCurrentView();
}
QColor aHiColor = mgr->colorValue( "SMESH", "selection_object_color", Qt::white ),
aSelColor = mgr->colorValue( "SMESH", "selection_element_color", Qt::yellow ),
- aPreColor = mgr->colorValue( "SMESH", "highlight_color", Qt::cyan );
+ aPreColor = mgr->colorValue( "SMESH", "highlight_color", Qt::cyan );
int SW = mgr->integerValue( "SMESH", "selection_width", 5 ),
PW = mgr->integerValue( "SMESH", "highlight_width", 5 );
double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ),
SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 ),
- SP3 = mgr->doubleValue( "SMESH", "selection_precision_object", 0.025 );
+ SP3 = mgr->doubleValue( "SMESH", "selection_precision_object", 0.025 );
for ( int i=0, n=views.count(); i<n; i++ ){
// update VTK viewer properties
if(SVTK_ViewWindow* aVtkView = GetVtkViewWindow( views[i] )){
- // mesh element selection
- aVtkView->SetSelectionProp(aSelColor.red()/255.,
- aSelColor.green()/255.,
- aSelColor.blue()/255.,
- SW );
- // tolerances
- aVtkView->SetSelectionTolerance(SP1, SP2, SP3);
-
- // pre-selection
- aVtkView->SetPreselectionProp(aPreColor.red()/255.,
- aPreColor.green()/255.,
- aPreColor.blue()/255.,
- PW);
- // update actors
- vtkRenderer* aRenderer = aVtkView->getRenderer();
- VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
- vtkActorCollection *aCollection = aCopy.GetActors();
- aCollection->InitTraversal();
- while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
- anActor->SetHighlightColor(aHiColor.red()/255.,
- aHiColor.green()/255.,
- aHiColor.blue()/255.);
- anActor->SetPreHighlightColor(aPreColor.red()/255.,
- aPreColor.green()/255.,
- aPreColor.blue()/255.);
- }
- }
+ // mesh element selection
+ aVtkView->SetSelectionProp(aSelColor.red()/255.,
+ aSelColor.green()/255.,
+ aSelColor.blue()/255.,
+ SW );
+ // tolerances
+ aVtkView->SetSelectionTolerance(SP1, SP2, SP3);
+
+ // pre-selection
+ aVtkView->SetPreselectionProp(aPreColor.red()/255.,
+ aPreColor.green()/255.,
+ aPreColor.blue()/255.,
+ PW);
+ // update actors
+ vtkRenderer* aRenderer = aVtkView->getRenderer();
+ VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
+ vtkActorCollection *aCollection = aCopy.GetActors();
+ aCollection->InitTraversal();
+ while(vtkActor *anAct = aCollection->GetNextActor()){
+ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
+ anActor->SetHighlightColor(aHiColor.red()/255.,
+ aHiColor.green()/255.,
+ aHiColor.blue()/255.);
+ anActor->SetPreHighlightColor(aPreColor.red()/255.,
+ aPreColor.green()/255.,
+ aPreColor.blue()/255.);
+ }
+ }
}
}
}
}
void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
- SVTK_Selector* theSelector)
+ SVTK_Selector* theSelector)
{
if (theSelector)
theSelector->SetFilter(theFilter);
}
bool IsValid(SALOME_Actor* theActor, int theCellId,
- SVTK_Selector* theSelector)
+ SVTK_Selector* theSelector)
{
return theSelector->IsValid(theActor,theCellId);
}
vtkActorCollection *aCollection = aCopy.GetActors();
aCollection->InitTraversal();
while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
- if(anActor->GetVisibility()){
- anActor->SetPointRepresentation(theIsVisible);
- }
- }
+ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
+ if(anActor->GetVisibility()){
+ anActor->SetPointRepresentation(theIsVisible);
+ }
+ }
}
RepaintCurrentView();
}
vtkActorCollection *aCollection = aCopy.GetActors();
aCollection->InitTraversal();
while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SALOME_Actor *anActor = dynamic_cast<SALOME_Actor*>(anAct)){
- if(anActor->GetVisibility()){
- anActor->SetPickable(anIsAllPickable);
- }
- }
+ if(SALOME_Actor *anActor = dynamic_cast<SALOME_Actor*>(anAct)){
+ if(anActor->GetVisibility()){
+ anActor->SetPickable(anIsAllPickable);
+ }
+ }
}
if(theActor)
- theActor->SetPickable(!anIsAllPickable);
+ theActor->SetPickable(!anIsAllPickable);
RepaintCurrentView();
}
}
//----------------------------------------------------------------------------
int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
- const Handle(SALOME_InteractiveObject)& theIO,
- QString& theName)
+ const Handle(SALOME_InteractiveObject)& theIO,
+ QString& theName)
{
theName = "";
TColStd_IndexedMapOfInteger aMapIndex;
}
int GetNameOfSelectedElements(SVTK_Selector* theSelector,
- const Handle(SALOME_InteractiveObject)& theIO,
- QString& theName)
+ const Handle(SALOME_InteractiveObject)& theIO,
+ QString& theName)
{
theName = "";
TColStd_IndexedMapOfInteger aMapIndex;
int GetEdgeNodes(SVTK_Selector* theSelector,
- const TVisualObjPtr& theVisualObject,
- int& theId1,
- int& theId2)
+ const TVisualObjPtr& theVisualObject,
+ int& theId1,
+ int& theId2)
{
const SALOME_ListIO& selected = theSelector->StoredIObjects();
for ( int i = 1; i <= aMapIndex.Extent(); i++ ) {
int aVal = aMapIndex( i );
if ( aVal > 0 )
- anObjId = aVal;
+ anObjId = aVal;
else
- anEdgeNum = abs( aVal ) - 1;
+ anEdgeNum = abs( aVal ) - 1;
}
if ( anObjId == -1 || anEdgeNum == -1 )
//----------------------------------------------------------------------------
int GetNameOfSelectedNodes(LightApp_SelectionMgr *theMgr,
- const Handle(SALOME_InteractiveObject)& theIO,
- QString& theName)
+ const Handle(SALOME_InteractiveObject)& theIO,
+ QString& theName)
{
theName = "";
if(theIO->hasEntry()){
if(FindActorByEntry(theIO->getEntry())){
- TColStd_IndexedMapOfInteger aMapIndex;
- theMgr->GetIndexes(theIO,aMapIndex);
- for(int i = 1; i <= aMapIndex.Extent(); i++){
- theName += QString(" %1").arg(aMapIndex(i));
- }
- return aMapIndex.Extent();
+ TColStd_IndexedMapOfInteger aMapIndex;
+ theMgr->GetIndexes(theIO,aMapIndex);
+ for(int i = 1; i <= aMapIndex.Extent(); i++){
+ theName += QString(" %1").arg(aMapIndex(i));
+ }
+ return aMapIndex.Extent();
}
}
return -1;
int GetNameOfSelectedElements(LightApp_SelectionMgr *theMgr,
- const Handle(SALOME_InteractiveObject)& theIO,
- QString& theName)
+ const Handle(SALOME_InteractiveObject)& theIO,
+ QString& theName)
{
theName = "";
if(theIO->hasEntry()){
if(FindActorByEntry(theIO->getEntry())){
- TColStd_IndexedMapOfInteger aMapIndex;
- theMgr->GetIndexes(theIO,aMapIndex);
- typedef std::set<int> TIdContainer;
- TIdContainer anIdContainer;
- for( int i = 1; i <= aMapIndex.Extent(); i++)
- anIdContainer.insert(aMapIndex(i));
- TIdContainer::const_iterator anIter = anIdContainer.begin();
- for( ; anIter != anIdContainer.end(); anIter++){
- theName += QString(" %1").arg(*anIter);
- }
- return aMapIndex.Extent();
+ TColStd_IndexedMapOfInteger aMapIndex;
+ theMgr->GetIndexes(theIO,aMapIndex);
+ typedef std::set<int> TIdContainer;
+ TIdContainer anIdContainer;
+ for( int i = 1; i <= aMapIndex.Extent(); i++)
+ anIdContainer.insert(aMapIndex(i));
+ TIdContainer::const_iterator anIter = anIdContainer.begin();
+ for( ; anIter != anIdContainer.end(); anIter++){
+ theName += QString(" %1").arg(*anIter);
+ }
+ return aMapIndex.Extent();
}
}
return -1;
}
int GetSelected(LightApp_SelectionMgr* theMgr,
- TColStd_IndexedMapOfInteger& theMap,
- const bool theIsElement)
+ TColStd_IndexedMapOfInteger& theMap,
+ const bool theIsElement)
{
theMap.Clear();
SALOME_ListIO selected; theMgr->selectedObjects( selected );
{
Handle(SALOME_InteractiveObject) anIO = selected.First();
if ( anIO->hasEntry() ) {
- theMgr->GetIndexes( anIO, theMap );
+ theMgr->GetIndexes( anIO, theMap );
}
}
return theMap.Extent();
for ( int i = 1; i <= aMapIndex.Extent(); i++ ) {
int aVal = aMapIndex( i );
if ( aVal > 0 )
- anObjId = aVal;
+ anObjId = aVal;
else
- anEdgeNum = abs( aVal );
+ anEdgeNum = abs( aVal );
}
if ( anObjId == -1 || anEdgeNum == -1 )
//----------------------------------------------------------------------------
SMESHGUI_EXPORT
SVTK_ViewWindow* GetViewWindow( const SalomeApp_Module* = 0,
- bool = false );
+ bool = false );
SMESHGUI_EXPORT
SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager*, SUIT_ViewWindow* );
SMESHGUI_EXPORT
SMESHGUI_EXPORT
bool UpdateView( SUIT_ViewWindow*, EDisplaing, const char* = "" );
-SMESHGUI_EXPORT
+SMESHGUI_EXPORT
bool UpdateView( EDisplaing, const char* = "" );
SMESHGUI_EXPORT
//----------------------------------------------------------------------------
SMESHGUI_EXPORT
int GetNameOfSelectedNodes( SVTK_Selector*,
- const Handle(SALOME_InteractiveObject)&,
- QString& );
+ const Handle(SALOME_InteractiveObject)&,
+ QString& );
SMESHGUI_EXPORT
int GetNameOfSelectedElements( SVTK_Selector*,
- const Handle(SALOME_InteractiveObject)&,
- QString& );
+ const Handle(SALOME_InteractiveObject)&,
+ QString& );
SMESHGUI_EXPORT
int GetEdgeNodes( SVTK_Selector*, const TVisualObjPtr&, int&, int& );
//----------------------------------------------------------------------------
SMESHGUI_EXPORT
int GetNameOfSelectedNodes( LightApp_SelectionMgr*,
- const Handle(SALOME_InteractiveObject)&,
- QString& );
+ const Handle(SALOME_InteractiveObject)&,
+ QString& );
SMESHGUI_EXPORT
int GetNameOfSelectedNodes( LightApp_SelectionMgr*, QString& );
SMESHGUI_EXPORT
int GetNameOfSelectedElements( LightApp_SelectionMgr*,
- const Handle(SALOME_InteractiveObject)&,
- QString& );
+ const Handle(SALOME_InteractiveObject)&,
+ QString& );
SMESHGUI_EXPORT
int GetNameOfSelectedElements( LightApp_SelectionMgr*, QString& );
SMESHGUI_EXPORT
int GetSelected( LightApp_SelectionMgr*, TColStd_IndexedMapOfInteger&,
- const bool = true );
+ const bool = true );
SMESHGUI_EXPORT
int GetEdgeNodes( LightApp_SelectionMgr*, int&, int& );
{
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode( NodeSelection );
+ aViewWindow->SetSelectionMode( NodeSelection );
break;
}
case 1:
{
SMESH::SetPointRepresentation(false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode( CellSelection );
+ aViewWindow->SetSelectionMode( CellSelection );
break;
}
}
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- "application")).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ "application")).
+ arg(myHelpFileName));
}
}
for (int i = 0; i < aListId.count(); i++) {
const SMDS_MeshElement * e = RadioButtonNodes->isChecked()?
- aMesh->FindNode(aListId[ i ].toInt()):
- aMesh->FindElement(aListId[ i ].toInt());
+ aMesh->FindNode(aListId[ i ].toInt()):
+ aMesh->FindElement(aListId[ i ].toInt());
if (e)
- newIndices.Add(e->GetID());
+ newIndices.Add(e->GetID());
}
mySelector->AddOrRemoveIndex( anIO, newIndices, false );
anInfo+=tr("SMESH_FACE")+"<br>";
anInfo+="<b>" + tr("SMESH_MESHINFO_TYPE")+":</b> ";
if(!ef->IsPoly())
- anInfo+=(ef->IsQuadratic()?tr("SMESH_MESHINFO_ORDER2"):tr("SMESH_MESHINFO_ORDER1"))+" ";
+ anInfo+=(ef->IsQuadratic()?tr("SMESH_MESHINFO_ORDER2"):tr("SMESH_MESHINFO_ORDER1"))+" ";
switch(ef->NbNodes()) {
case 3:
case 6:
- {
- anInfo+=tr("SMESH_TRIANGLE");
- break;
- }
+ {
+ anInfo+=tr("SMESH_TRIANGLE");
+ break;
+ }
case 4:
case 8:
- {
- anInfo+=tr("SMESH_QUADRANGLE");
- break;
- }
+ {
+ anInfo+=tr("SMESH_QUADRANGLE");
+ break;
+ }
default:
- break;
+ break;
}
anInfo+="<br>";
} else if(e->GetType() == SMDSAbs_Volume) {
const SMDS_MeshVolume *ev = (SMDS_MeshVolume*) e;
SMDS_VolumeTool vt(ev);
if(vt.GetVolumeType() != SMDS_VolumeTool::POLYHEDA)
- anInfo+=(ev->IsQuadratic()?tr("SMESH_MESHINFO_ORDER2"):tr("SMESH_MESHINFO_ORDER1"))+" ";
+ anInfo+=(ev->IsQuadratic()?tr("SMESH_MESHINFO_ORDER2"):tr("SMESH_MESHINFO_ORDER1"))+" ";
switch(vt.GetVolumeType()) {
case SMDS_VolumeTool::TETRA:
case SMDS_VolumeTool::QUAD_TETRA:
- {
- anInfo+=tr("SMESH_TETRAS");
- break;
- }
+ {
+ anInfo+=tr("SMESH_TETRAS");
+ break;
+ }
case SMDS_VolumeTool::PYRAM:
case SMDS_VolumeTool::QUAD_PYRAM:
- {
- anInfo+=tr("SMESH_PYRAMID");
- break;
- }
+ {
+ anInfo+=tr("SMESH_PYRAMID");
+ break;
+ }
case SMDS_VolumeTool::PENTA:
case SMDS_VolumeTool::QUAD_PENTA:
- {
- anInfo+=tr("SMESH_PRISM");
- break;
- }
+ {
+ anInfo+=tr("SMESH_PRISM");
+ break;
+ }
case SMDS_VolumeTool::HEXA:
case SMDS_VolumeTool::QUAD_HEXA:
- {
- anInfo+=tr("SMESH_HEXAS");
- break;
- }
+ {
+ anInfo+=tr("SMESH_HEXAS");
+ break;
+ }
case SMDS_VolumeTool::POLYHEDA:
- {
- anInfo+=tr("SMESH_POLYEDRON");
- break;
- }
+ {
+ anInfo+=tr("SMESH_POLYEDRON");
+ break;
+ }
default:
- break;
+ break;
}
anInfo+="<br>";
}
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
anXYZ.Add( gp_XYZ( node->X(), node->Y(), node->Z() ) );
if(e->GetType() != SMDSAbs_Node)
- aNodesInfo+=QString("<b>Node %1:</b><br>Id=%2, X=%3, Y=%4, Z=%5<br>").arg(nbNodes+1).arg(node->GetID()).arg(node->X()).arg(node->Y()).arg(node->Z());
+ aNodesInfo+=QString("<b>Node %1:</b><br>Id=%2, X=%3, Y=%4, Z=%5<br>").arg(nbNodes+1).arg(node->GetID()).arg(node->X()).arg(node->Y()).arg(node->Z());
// Calculate Connectivity
SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
if (it) {
- aNodesInfo+="<b>" + tr("CONNECTED_ELEMENTS") + ":</b>";
- while (it->more()) {
- const SMDS_MeshElement* elem = it->next();
- aNodesInfo+=QString(" %1").arg(elem->GetID());
- }
- if ( (nbNodes+1) != e->NbNodes())
- aNodesInfo+=QString("<br><br>");
+ aNodesInfo+="<b>" + tr("CONNECTED_ELEMENTS") + ":</b>";
+ while (it->more()) {
+ const SMDS_MeshElement* elem = it->next();
+ aNodesInfo+=QString(" %1").arg(elem->GetID());
+ }
+ if ( (nbNodes+1) != e->NbNodes())
+ aNodesInfo+=QString("<br><br>");
}
}
if(e->GetType() != SMDSAbs_Node)
{
MESSAGE("Loading Resources " << aResName.toLatin1().data());
SUIT_ResourceMgr* resMgr = SMESHGUI::resourceMgr();
- QString lang = resMgr->stringValue( resMgr->langSection(), "language", "en" );
+ QString lang = resMgr->stringValue( resMgr->langSection(), "language", "en" );
resMgr->loadTranslator( "resources", QString( "%1_msg_%2.qm" ).arg( aResName, lang ) );
resMgr->loadTranslator( "resources", QString( "%1_images.qm" ).arg( aResName, lang ) );
}
{
QString aHypos = isHypo ? atts.value("hypos") : atts.value("algos");
aHypos = aHypos.remove( ' ' );
- aHypoSet->set( !isHypo, aHypos.split( ',', QString::SkipEmptyParts ) );
+ aHypoSet->set( !isHypo, aHypos.split( ',', QString::SkipEmptyParts ) );
}
}
}
bool startDocument();
bool startElement( const QString&, const QString&,
- const QString&, const QXmlAttributes& );
+ const QString&, const QXmlAttributes& );
bool endElement( const QString&, const QString&, const QString& );
bool characters( const QString& );
<source>ICON_UNDERLYING_ELEMS</source>
<translation>mesh_extractGroup.png</translation>
</message>
+ <message>
+ <source>ICON_2D_FROM_3D</source>
+ <translation>mesh_2d_from_3d.png</translation>
+ </message>
</context>
</TS>
<source>MEN_CONV_TO_QUAD</source>
<translation>Convert to/from quadratic</translation>
</message>
+ <message>
+ <source>MEN_2D_FROM_3D</source>
+ <translation>Create 2D mesh from 3D</translation>
+ </message>
<message>
<source>MEN_CREATE_GROUP</source>
<translation>Create Group</translation>
<source>MEN_EXPORT_MED</source>
<translation>Export to MED File</translation>
</message>
+ <message>
+ <source>MEN_EXPORT_SAUV</source>
+ <translation>Export to SAUV (ASCII) file</translation>
+ </message>
<message>
<source>MEN_EXPORT_STL</source>
<translation>Export to STL File</translation>
<source>MEN_MED</source>
<translation>MED file</translation>
</message>
+ <message>
+ <source>MEN_SAUV</source>
+ <translation>SAUV (ASCII) file</translation>
+ </message>
<message>
<source>MEN_MERGE</source>
<translation>Merge Nodes</translation>
<source>STB_CONV_TO_QUAD</source>
<translation>Convert to/from quadratic</translation>
</message>
+ <message>
+ <source>STB_2D_FROM_3D</source>
+ <translation>Create 2D mesh from 3D</translation>
+ </message>
<message>
<source>STB_CREATE_GROUP</source>
<translation>Create Group</translation>
<source>STB_EXPORT_MED</source>
<translation>Export to MED file</translation>
</message>
+ <message>
+ <source>STB_EXPORT_SAUV</source>
+ <translation>Export to SAUV (ASCII) file</translation>
+ </message>
<message>
<source>STB_EXPORT_STL</source>
<translation>Export to STL file</translation>
<source>STB_MED</source>
<translation>Import MED file</translation>
</message>
+ <message>
+ <source>STB_SAUV</source>
+ <translation>Import SAUV (ASCII) file</translation>
+ </message>
<message>
<source>STB_MERGE</source>
<translation>Merge nodes</translation>
<source>TOP_CONV_TO_QUAD</source>
<translation>Convert to/from quadratic</translation>
</message>
+ <message>
+ <source>TOP_2D_FROM_3D</source>
+ <translation>Create 2D mesh from 3D</translation>
+ </message>
<message>
<source>TOP_CREATE_GROUP</source>
<translation>Create Group</translation>
<source>TOP_EXPORT_MED</source>
<translation>Export to MED file</translation>
</message>
+ <message>
+ <source>TOP_EXPORT_SAUV</source>
+ <translation>Export to SAUV (ASCII) file</translation>
+ </message>
<message>
<source>TOP_EXPORT_STL</source>
<translation>Export to STL file</translation>
<source>TOP_MED</source>
<translation>Import MED file</translation>
</message>
+ <message>
+ <source>TOP_SAUV</source>
+ <translation>Import SAUV (ASCII) file</translation>
+ </message>
<message>
<source>TOP_MERGE</source>
<translation>Merge nodes</translation>
<translation>No valid mesh object selected</translation>
</message>
</context>
+ <context>
+ <name>SMESHGUI_Make2DFrom3DDlg</name>
+ <message>
+ <source>CAPTION</source>
+ <translation>Create 2D mesh from 3D</translation>
+ </message>
+ </context>
<context>
<name>SMESHGUI_CreatePatternDlg</name>
<message>
TCollection_AsciiString
SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript,
Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
- Resource_DataMapOfAsciiStringAsciiString& theObjectNames)
+ Resource_DataMapOfAsciiStringAsciiString& theObjectNames)
{
theGen = new _pyGen( theEntry2AccessorMethod, theObjectNames );
//================================================================================
_pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
- Resource_DataMapOfAsciiStringAsciiString& theObjectNames)
+ Resource_DataMapOfAsciiStringAsciiString& theObjectNames)
: _pyObject( new _pyCommand( TPythonDump::SMESHGenName(), 0 )),
myID2AccessorMethod( theEntry2AccessorMethod ),
myObjectNames( theObjectNames )
if ( !hyp->IsNull() &&
(*hyp)->IsAlgo() &&
theHypothesis->CanBeCreatedBy( (*hyp)->GetAlgoType() ) &&
- (*hyp)->GetGeom() == theGeom &&
+ (*hyp)->GetGeom() == theGeom &&
(*hyp)->GetMesh() == theMesh )
return *hyp;
return 0;
//================================================================================
void _pyGen::setNeighbourCommand( Handle(_pyCommand)& theCmd,
- Handle(_pyCommand)& theOtherCmd,
- const bool theIsAfter )
+ Handle(_pyCommand)& theOtherCmd,
+ const bool theIsAfter )
{
list< Handle(_pyCommand) >::iterator pos;
pos = find( myCommands.begin(), myCommands.end(), theCmd );
while ( myObjectNames.IsBound( aNewID ) );
myObjectNames.Bind( aNewID, myObjectNames.IsBound( theID )
- ? (myObjectNames.Find( theID ) + _pyID( "_" ) + _pyID( index-1 ))
- : _pyID( "A" ) + aNewID );
+ ? (myObjectNames.Find( theID ) + _pyID( "_" ) + _pyID( index-1 ))
+ : _pyID( "A" ) + aNewID );
return aNewID;
}
if ( algo->IsWrapped() ) {
_pyID localAlgoID = theGen->GenerateNewID( algoID );
TCollection_AsciiString aNewCmdStr = localAlgoID +
- TCollection_AsciiString( " = " ) + theGen->GetID() +
- TCollection_AsciiString( ".CreateHypothesis( \"" ) + algo->GetAlgoType() +
- TCollection_AsciiString( "\" )" );
+ TCollection_AsciiString( " = " ) + theGen->GetID() +
+ TCollection_AsciiString( ".CreateHypothesis( \"" ) + algo->GetAlgoType() +
+ TCollection_AsciiString( "\" )" );
Handle(_pyCommand) newCmd = theGen->AddCommand( aNewCmdStr );
Handle(_pyAlgorithm) newAlgo = Handle(_pyAlgorithm)::DownCast(theGen->FindHyp( localAlgoID ));
if ( !newAlgo.IsNull() ) {
- newAlgo->Assign( algo, this->GetID() );
- newAlgo->SetCreationCmd( newCmd );
- algo = newAlgo;
- // set algorithm creation
- theGen->SetCommandBefore( newCmd, addCmd );
+ newAlgo->Assign( algo, this->GetID() );
+ newAlgo->SetCreationCmd( newCmd );
+ algo = newAlgo;
+ // set algorithm creation
+ theGen->SetCommandBefore( newCmd, addCmd );
}
else
- newCmd->Clear();
+ newCmd->Clear();
}
_pyID geom = addCmd->GetArg( 1 );
bool isLocalAlgo = ( geom != GetGeom() );
addCmd->SetArg( addCmd->GetNbArgs() + 1,
TCollection_AsciiString( "geom=" ) + geom );
// sm = mesh.GetSubMesh(geom, name) --> sm = ALGO.GetSubMesh()
- list < Handle(_pySubMesh) >::iterator smIt;
+ list < Handle(_pySubMesh) >::iterator smIt;
for ( smIt = mySubmeshes.begin(); smIt != mySubmeshes.end(); ++smIt ) {
- Handle(_pySubMesh) subMesh = *smIt;
+ Handle(_pySubMesh) subMesh = *smIt;
Handle(_pyCommand) subCmd = subMesh->GetCreationCmd();
if ( geom == subCmd->GetArg( 1 )) {
subCmd->SetObject( algo->GetID() );
subCmd->RemoveArgs();
- subMesh->SetCreator( algo );
+ subMesh->SetCreator( algo );
}
}
}
}
else if ( hypType == "QuadranglePreference" ) {
hyp->SetConvMethodAndType( "QuadranglePreference", "Quadrangle_2D");
- hyp->SetConvMethodAndType( "QuadranglePreference", "NETGEN_2D_ONLY");
+ hyp->SetConvMethodAndType( "SetQuadAllowed", "NETGEN_2D_ONLY");
}
else if ( hypType == "TrianglePreference" ) {
hyp->SetConvMethodAndType( "TrianglePreference", "Quadrangle_2D");
- }
+ }
// BLSURF ----------
else if ( hypType == "BLSURF" ) {
algo->SetConvMethodAndType( "Triangle", hypType.ToCString());
//================================================================================
void _pyHypothesis::Assign( const Handle(_pyHypothesis)& theOther,
- const _pyID& theMesh )
+ const _pyID& theMesh )
{
myIsWrapped = false;
myMesh = theMesh;
int nb1 = 0; // number of ' character at the left of =
int nb2 = 0; // number of " character at the left of =
for ( int i = 1; i < begPos-1; i++ ) {
- if ( myString.Value( i )=='\'' )
- nb1 += 1;
- else if ( myString.Value( i )=='"' )
- nb2 += 1;
+ if ( myString.Value( i )=='\'' )
+ nb1 += 1;
+ else if ( myString.Value( i )=='"' )
+ nb2 += 1;
}
// if number of ' or " is not divisible by 2,
// then get an object at the start of the command
if ( nb1 % 2 != 0 || nb2 % 2 != 0 )
- begPos = 1;
+ begPos = 1;
}
myObj = GetWord( myString, begPos, true );
// check if object is complex,
while ( begPos != EMPTY ) {
begPos += prevLen;
if( myString.Value( begPos ) == '(' )
- nbNestings++;
+ nbNestings++;
// check if we are looking at the closing parenthesis
while ( begPos <= Length() && isspace( myString.Value( begPos )))
++begPos;
if ( begPos > Length() )
break;
if ( myString.Value( begPos ) == ')' ) {
- nbNestings--;
- if( nbNestings == 0 )
- break;
+ nbNestings--;
+ if( nbNestings == 0 )
+ break;
}
myArgs.Append( GetWord( myString, begPos, true, true ));
SetBegPos( ARG1_IND + i, begPos );
void Process( const Handle(_pyCommand)& theCommand);
void Flush();
virtual void Assign( const Handle(_pyHypothesis)& theOther,
- const _pyID& theMesh );
+ const _pyID& theMesh );
DEFINE_STANDARD_RTTI (_pyHypothesis)
};
TCollection_AsciiString aCollection(Standard_CString(aString.c_str()));
SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
if(!aStudy->_is_nil() && !aCollection.IsEmpty()){
- aSMESHGen->AddToPythonScript(aStudy->StudyId(),aCollection);
- if(MYDEBUG) MESSAGE(aString);
+ aSMESHGen->AddToPythonScript(aStudy->StudyId(),aCollection);
+ if(MYDEBUG) MESSAGE(aString);
}
}
}
operator<<(CORBA::Object_ptr theArg)
{
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
+ SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
if(!aSObject->_is_nil()) {
- myStream << aSObject->GetID();
+ CORBA::String_var id = aSObject->GetID();
+ myStream << id;
} else if ( !CORBA::is_nil(theArg)) {
if ( aSMESHGen->CanPublishInStudy( theArg )) // not published SMESH object
myStream << "smeshObj_" << size_t(theArg);
// Add trace of API methods calls and replace study entries by names
TCollection_AsciiString aScript =
+ "# -*- coding: iso-8859-1 -*-\n"
"### This file is generated by SALOME automatically by dump python functionality of SMESH component\n\n";
aScript += DumpPython_impl(aStudy, aMap, aMapNames,
isPublished, isValidScript, aSavedTrace);
isFound = Standard_False;
while((j < aLen) && ( isdigit(c) || c == ':' )) { //Check if it is an entry
- c = (int)arr[j++];
- if(c == ':') isFound = Standard_True;
+ c = (int)arr[j++];
+ if(c == ':') isFound = Standard_True;
}
if (isFound) {
}
// 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";
if ( importGeom )
{
if( !CORBA::is_nil(aGroup) )
{
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();
anUpdatedScript += SMESH_Comment("\n\t")
pd << "aCriterion = SMESH.Filter.Criterion(" << aCriterion << "," << aCompare
<< "," << aThreshold << ",'" << aThresholdStr;
if (aThresholdID && strlen(aThresholdID))
- //pd << "',salome.ObjectToID(" << aThresholdID
+ //pd << "',salome.ObjectToID(" << aThresholdID
pd << "','" << aThresholdID
- << "'," << aUnary << "," << aBinary << "," << aTolerance
- << "," << aTypeOfElem << "," << aPrecision << ")";
+ << "'," << aUnary << "," << aBinary << "," << aTolerance
+ << "," << aTypeOfElem << "," << aPrecision << ")";
else
- pd << "',''," << aUnary << "," << aBinary << "," << aTolerance
- << "," << aTypeOfElem << "," << aPrecision << ")";
+ pd << "',''," << aUnary << "," << aBinary << "," << aTolerance
+ << "," << aTypeOfElem << "," << aPrecision << ")";
}
SMESH::Predicate_ptr aPredicate = SMESH::Predicate::_nil();
{
SMESH::LyingOnGeom_ptr tmpPred = aFilterMgr->CreateLyingOnGeom();
tmpPred->SetElementType( aTypeOfElem );
- tmpPred->SetShape( aThresholdID, aThresholdStr );
+ tmpPred->SetShape( aThresholdID, aThresholdStr );
tmpPred->SetTolerance( aTolerance );
aPredicate = tmpPred;
}
double GetTolerance();
virtual bool Contains( const SMESHDS_Mesh* theMeshDS,
- const TopoDS_Shape& theShape,
- const SMDS_MeshElement* theElem,
- TopAbs_ShapeEnum theFindShapeEnum,
- TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE );
+ const TopoDS_Shape& theShape,
+ const SMDS_MeshElement* theElem,
+ TopAbs_ShapeEnum theFindShapeEnum,
+ TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE );
private:
virtual void init();
Description : An abstact class for all functors
*/
class SMESH_I_EXPORT Functor_i: public virtual POA_SMESH::Functor,
- public virtual SALOME::GenericObj_i
+ public virtual SALOME::GenericObj_i
{
public:
void SetMesh( SMESH_Mesh_ptr theMesh );
Description : Base class for numerical functors
*/
class SMESH_I_EXPORT NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor,
- public virtual Functor_i
+ public virtual Functor_i
{
public:
CORBA::Double GetValue( CORBA::Long theElementId );
Description : Functor for calculation of minimum angle
*/
class SMESH_I_EXPORT MinimumAngle_i: public virtual POA_SMESH::MinimumAngle,
- public virtual NumericalFunctor_i
+ public virtual NumericalFunctor_i
{
public:
MinimumAngle_i();
Description : Functor for calculating aspect ratio
*/
class SMESH_I_EXPORT AspectRatio_i: public virtual POA_SMESH::AspectRatio,
- public virtual NumericalFunctor_i
+ public virtual NumericalFunctor_i
{
public:
AspectRatio_i();
Description : Functor for calculating aspect ratio for 3D
*/
class SMESH_I_EXPORT AspectRatio3D_i: public virtual POA_SMESH::AspectRatio3D,
- public virtual NumericalFunctor_i
+ public virtual NumericalFunctor_i
{
public:
AspectRatio3D_i();
Description : Functor for calculating warping
*/
class SMESH_I_EXPORT Warping_i: public virtual POA_SMESH::Warping,
- public virtual NumericalFunctor_i
+ public virtual NumericalFunctor_i
{
public:
Warping_i();
Description : Functor for calculating taper
*/
class SMESH_I_EXPORT Taper_i: public virtual POA_SMESH::Taper,
- public virtual NumericalFunctor_i
+ public virtual NumericalFunctor_i
{
public:
Taper_i();
Description : Functor for calculating skew in degrees
*/
class SMESH_I_EXPORT Skew_i: public virtual POA_SMESH::Skew,
- public virtual NumericalFunctor_i
+ public virtual NumericalFunctor_i
{
public:
Skew_i();
Description : Functor for calculating area
*/
class SMESH_I_EXPORT Area_i: public virtual POA_SMESH::Area,
- public virtual NumericalFunctor_i
+ public virtual NumericalFunctor_i
{
public:
Area_i();
Description : Functor for calculating length of edge
*/
class SMESH_I_EXPORT Length_i: public virtual POA_SMESH::Length,
- public virtual NumericalFunctor_i
+ public virtual NumericalFunctor_i
{
public:
Length_i();
Description : Functor for calculating length of edge
*/
class SMESH_I_EXPORT Length2D_i: public virtual POA_SMESH::Length2D,
- public virtual NumericalFunctor_i
+ public virtual NumericalFunctor_i
{
public:
Length2D_i();
Description : Functor for calculating number of faces conneted to the edge
*/
class SMESH_I_EXPORT MultiConnection_i: public virtual POA_SMESH::MultiConnection,
- public virtual NumericalFunctor_i
+ public virtual NumericalFunctor_i
{
public:
MultiConnection_i();
Description : Functor for calculating number of faces conneted to the edge
*/
class SMESH_I_EXPORT MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D,
- public virtual NumericalFunctor_i
+ public virtual NumericalFunctor_i
{
public:
MultiConnection2D_i();
Description : Base class for all predicates
*/
class SMESH_I_EXPORT Predicate_i: public virtual POA_SMESH::Predicate,
- public virtual Functor_i
+ public virtual Functor_i
{
public:
CORBA::Boolean IsSatisfy( CORBA::Long theElementId );
the point of view of MED convention
*/
class SMESH_I_EXPORT BadOrientedVolume_i: public virtual POA_SMESH::BadOrientedVolume,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
BadOrientedVolume_i();
Description : Predicate for selection on geometrical support
*/
class SMESH_I_EXPORT BelongToGeom_i: public virtual POA_SMESH::BelongToGeom,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
BelongToGeom_i();
Description : Verify whether mesh element lie in pointed Geom planar object
*/
class SMESH_I_EXPORT BelongToSurface_i: public virtual POA_SMESH::BelongToSurface,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
BelongToSurface_i( const Handle(Standard_Type)& );
Description : Verify whether mesh element lie in pointed Geom planar object
*/
class SMESH_I_EXPORT BelongToPlane_i: public virtual POA_SMESH::BelongToPlane,
- public virtual BelongToSurface_i
+ public virtual BelongToSurface_i
{
public:
BelongToPlane_i();
Description : Verify whether mesh element lie in pointed Geom cylindrical object
*/
class SMESH_I_EXPORT BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder,
- public virtual BelongToSurface_i
+ public virtual BelongToSurface_i
{
public:
BelongToCylinder_i();
Description : Predicate for selection on geometrical support(lying or partially lying)
*/
class SMESH_I_EXPORT LyingOnGeom_i: public virtual POA_SMESH::LyingOnGeom,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
LyingOnGeom_i();
Description : Predicate for free borders
*/
class SMESH_I_EXPORT FreeBorders_i: public virtual POA_SMESH::FreeBorders,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
FreeBorders_i();
Description : Predicate for free edges
*/
class SMESH_I_EXPORT FreeEdges_i: public virtual POA_SMESH::FreeEdges,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
FreeEdges_i();
Description : Predicate for free faces
*/
class SMESH_I_EXPORT FreeFaces_i: public virtual POA_SMESH::FreeFaces,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
FreeFaces_i();
Description : Predicate for free nodes
*/
class SMESH_I_EXPORT FreeNodes_i: public virtual POA_SMESH::FreeNodes,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
FreeNodes_i();
Description : Predicate for Range of Ids
*/
class SMESH_I_EXPORT RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
RangeOfIds_i();
Description : Verify whether a mesh element is linear
*/
class SMESH_I_EXPORT LinearOrQuadratic_i: public virtual POA_SMESH::LinearOrQuadratic,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
LinearOrQuadratic_i();
Description : Functor for check color of group to whic mesh element belongs to
*/
class SMESH_I_EXPORT GroupColor_i: public virtual POA_SMESH::GroupColor,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
GroupColor_i();
Description : Functor for check element geometry type
*/
class SMESH_I_EXPORT ElemGeomType_i: public virtual POA_SMESH::ElemGeomType,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
ElemGeomType_i();
Description : Base class for comparators
*/
class SMESH_I_EXPORT Comparator_i: public virtual POA_SMESH::Comparator,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
virtual ~Comparator_i();
Description : Comparator "<"
*/
class SMESH_I_EXPORT LessThan_i: public virtual POA_SMESH::LessThan,
- public virtual Comparator_i
+ public virtual Comparator_i
{
public:
LessThan_i();
Description : Comparator ">"
*/
class SMESH_I_EXPORT MoreThan_i: public virtual POA_SMESH::MoreThan,
- public virtual Comparator_i
+ public virtual Comparator_i
{
public:
MoreThan_i();
Description : Comparator "="
*/
class SMESH_I_EXPORT EqualTo_i: public virtual POA_SMESH::EqualTo,
- public virtual Comparator_i
+ public virtual Comparator_i
{
public:
EqualTo_i();
Description : Logical NOT predicate
*/
class SMESH_I_EXPORT LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
LogicalNOT_i();
Description : Base class for binary logical predicate
*/
class SMESH_I_EXPORT LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
- public virtual Predicate_i
+ public virtual Predicate_i
{
public:
virtual ~LogicalBinary_i();
Description : Logical AND
*/
class SMESH_I_EXPORT LogicalAND_i: public virtual POA_SMESH::LogicalAND,
- public virtual LogicalBinary_i
+ public virtual LogicalBinary_i
{
public:
LogicalAND_i();
Description : Logical OR
*/
class SMESH_I_EXPORT LogicalOR_i: public virtual POA_SMESH::LogicalOR,
- public virtual LogicalBinary_i
+ public virtual LogicalBinary_i
{
public:
LogicalOR_i();
FILTER
*/
class SMESH_I_EXPORT Filter_i: public virtual POA_SMESH::Filter,
- public virtual SALOME::GenericObj_i
+ public virtual SALOME::GenericObj_i
{
public:
Filter_i();
static
void
GetElementsId( Predicate_i*,
- const SMDS_Mesh*,
- Controls::Filter::TIdSequence& );
+ const SMDS_Mesh*,
+ Controls::Filter::TIdSequence& );
static
void
GetElementsId( Predicate_i*,
- SMESH_Mesh_ptr,
- Controls::Filter::TIdSequence& );
+ SMESH_Mesh_ptr,
+ Controls::Filter::TIdSequence& );
virtual
long_array*
FILTER LIBRARY
*/
class SMESH_I_EXPORT FilterLibrary_i: public virtual POA_SMESH::FilterLibrary,
- public virtual SALOME::GenericObj_i
+ public virtual SALOME::GenericObj_i
{
public:
FilterLibrary_i( const char* theFileName );
CORBA::Boolean AddEmpty( const char* theFilterName, ElementType theType );
CORBA::Boolean Delete ( const char* theFilterName );
CORBA::Boolean Replace ( const char* theFilterName,
- const char* theNewName,
- Filter_ptr theFilter );
+ const char* theNewName,
+ Filter_ptr theFilter );
CORBA::Boolean Save();
CORBA::Boolean SaveAs( const char* aFileName );
*/
class SMESH_I_EXPORT FilterManager_i: public virtual POA_SMESH::FilterManager,
- public virtual SALOME::GenericObj_i
+ public virtual SALOME::GenericObj_i
{
public:
FilterManager_i();
if ( !theSObject->_is_nil() ) {
try {
if( theSObject->FindAttribute( anAttr, "AttributeIOR" ) ) {
- SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr );
- CORBA::String_var aValue = anIOR->Value();
- if( strcmp( aValue, "" ) != 0 )
- anObj = GetORB()->string_to_object( aValue );
- }
+ SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr );
+ CORBA::String_var aValue = anIOR->Value();
+ if( strcmp( aValue, "" ) != 0 )
+ anObj = GetORB()->string_to_object( aValue );
+ }
}
catch( ... ) {
INFOS( "SObjectToObject - Unknown exception was caught!!!" );
//=============================================================================
SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId* contId,
- const char* instanceName,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId* contId,
+ const char* instanceName,
const char* interfaceName )
: Engines_Component_i( orb, poa, contId, instanceName, interfaceName )
{
SALOMEDS::SComponent_var me = SALOMEDS::SComponent::_narrow
( myCurrentStudy->FindComponent( ComponentDataType() ) );
if ( !me->_is_nil() ) {
- SALOMEDS::ChildIterator_var anIter = myCurrentStudy->NewChildIterator( me );
- for ( ; anIter->More(); anIter->Next() ) {
- SALOMEDS::SObject_var so = anIter->Value();
- CORBA::Object_var ior = SObjectToObject( so );
- if ( SMESH_Mesh_i* mesh = SMESH::DownCast<SMESH_Mesh_i*>( ior ))
- mesh->CheckGeomGroupModif();
- }
+ SALOMEDS::ChildIterator_var anIter = myCurrentStudy->NewChildIterator( me );
+ for ( ; anIter->More(); anIter->Next() ) {
+ SALOMEDS::SObject_var so = anIter->Value();
+ CORBA::Object_var ior = SObjectToObject( so );
+ if ( SMESH_Mesh_i* mesh = SMESH::DownCast<SMESH_Mesh_i*>( ior ))
+ mesh->CheckGeomGroupModif();
+ }
}
}
}
SMESH_Mesh_i* meshServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( mesh ).in() );
ASSERT( meshServant );
SMESH::DriverMED_ReadStatus status1 =
- meshServant->ImportMEDFile( theFileName, (*it).c_str() );
+ meshServant->ImportMEDFile( theFileName, (*it).c_str() );
if (status1 > theStatus)
- theStatus = status1;
+ theStatus = status1;
aResult[i++] = SMESH::SMESH_Mesh::_duplicate( mesh );
}
//=============================================================================
SMESH::long_array* SMESH_Gen_i::GetSubShapesId( GEOM::GEOM_Object_ptr theMainShapeObject,
- const SMESH::object_array& theListOfSubShapeObject )
+ const SMESH::object_array& theListOfSubShapeObject )
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
TopExp::MapShapes(myMainShape,myIndexToShape);
for ( int i = 0; i < theListOfSubShapeObject.length(); i++ )
- {
- GEOM::GEOM_Object_var aShapeObject
- = GEOM::GEOM_Object::_narrow(theListOfSubShapeObject[i]);
- if ( CORBA::is_nil( aShapeObject ) )
- THROW_SALOME_CORBA_EXCEPTION ("bad shape object reference", \
- SALOME::BAD_PARAM );
-
- TopoDS_Shape locShape = GeomObjectToShape(aShapeObject);
- for (TopExp_Explorer exp(locShape,TopAbs_FACE); exp.More(); exp.Next())
- {
- const TopoDS_Face& F = TopoDS::Face(exp.Current());
- setId.insert(myIndexToShape.FindIndex(F));
- if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(F));
- }
- for (TopExp_Explorer exp(locShape,TopAbs_EDGE); exp.More(); exp.Next())
- {
- const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
- setId.insert(myIndexToShape.FindIndex(E));
- if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(E));
- }
- for (TopExp_Explorer exp(locShape,TopAbs_VERTEX); exp.More(); exp.Next())
- {
- const TopoDS_Vertex& V = TopoDS::Vertex(exp.Current());
- setId.insert(myIndexToShape.FindIndex(V));
- if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(V));
- }
- }
+ {
+ GEOM::GEOM_Object_var aShapeObject
+ = GEOM::GEOM_Object::_narrow(theListOfSubShapeObject[i]);
+ if ( CORBA::is_nil( aShapeObject ) )
+ THROW_SALOME_CORBA_EXCEPTION ("bad shape object reference", \
+ SALOME::BAD_PARAM );
+
+ TopoDS_Shape locShape = GeomObjectToShape(aShapeObject);
+ for (TopExp_Explorer exp(locShape,TopAbs_FACE); exp.More(); exp.Next())
+ {
+ const TopoDS_Face& F = TopoDS::Face(exp.Current());
+ setId.insert(myIndexToShape.FindIndex(F));
+ if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(F));
+ }
+ for (TopExp_Explorer exp(locShape,TopAbs_EDGE); exp.More(); exp.Next())
+ {
+ const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
+ setId.insert(myIndexToShape.FindIndex(E));
+ if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(E));
+ }
+ for (TopExp_Explorer exp(locShape,TopAbs_VERTEX); exp.More(); exp.Next())
+ {
+ const TopoDS_Vertex& V = TopoDS::Vertex(exp.Current());
+ setId.insert(myIndexToShape.FindIndex(V));
+ if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(V));
+ }
+ }
shapesId->length(setId.size());
set<int>::iterator iind;
int i=0;
for (iind = setId.begin(); iind != setId.end(); iind++)
- {
- if(MYDEBUG) SCRUTE((*iind));
- shapesId[i] = (*iind);
- if(MYDEBUG) SCRUTE(shapesId[i]);
- i++;
- }
+ {
+ if(MYDEBUG) SCRUTE((*iind));
+ shapesId[i] = (*iind);
+ if(MYDEBUG) SCRUTE(shapesId[i]);
+ i++;
+ }
}
catch (SALOME_Exception& S_ex)
{
//=============================================================================
SMESH::MeshPreviewStruct* SMESH_Gen_i::Precompute( SMESH::SMESH_Mesh_ptr theMesh,
- GEOM::GEOM_Object_ptr theShapeObject,
- SMESH::Dimension theDimension,
- SMESH::long_array& theShapesId)
+ GEOM::GEOM_Object_ptr theShapeObject,
+ SMESH::Dimension theDimension,
+ SMESH::long_array& theShapesId)
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
if(theMesh->HasShapeToMesh())
myLocShape = GeomObjectToShape( theShapeObject );
else
- return result._retn();;
+ return result._retn();;
// call implementation compute
::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
::MeshDimension aDim = (MeshDimension)theDimension;
if ( myGen.Compute( myLocMesh, myLocShape, false, aDim, &shapeIds ) )
{
- int nbShapeId = shapeIds.size();
- theShapesId.length( nbShapeId );
- // iterates on shapes and collect mesh entities into mesh preview
- TSetOfInt::const_iterator idIt = shapeIds.begin();
- TSetOfInt::const_iterator idEnd = shapeIds.end();
- std::map< int, int > mapOfShIdNb;
- std::set< SMESH_TLink > setOfEdge;
- std::list< SMDSAbs_ElementType > listOfElemType;
- typedef map<const SMDS_MeshElement*, int > TNode2LocalIDMap;
- typedef TNode2LocalIDMap::iterator TNodeLocalID;
- TNode2LocalIDMap mapNode2LocalID;
- list< TNodeLocalID > connectivity;
- int i, nbConnNodes = 0;
- std::set< const SMESH_subMesh* > setOfVSubMesh;
- // iterates on shapes
- for ( ; idIt != idEnd; idIt++ )
- {
- if ( mapOfShIdNb.find( *idIt ) != mapOfShIdNb.end() )
- continue;
- SMESH_subMesh* sm = myLocMesh.GetSubMeshContaining(*idIt);
- if ( !sm || !sm->IsMeshComputed() )
- continue;
-
- const TopoDS_Shape& aSh = sm->GetSubShape();
- const int shDim = myGen.GetShapeDim( aSh );
- if ( shDim < 1 || shDim > theDimension )
- continue;
-
- mapOfShIdNb[ *idIt ] = 0;
- theShapesId[ mapOfShIdNb.size() - 1 ] = *idIt;
-
- SMESHDS_SubMesh* smDS = sm->GetSubMeshDS();
- if ( !smDS ) continue;
-
- if ( theDimension == SMESH::DIM_2D )
- {
- SMDS_ElemIteratorPtr faceIt = smDS->GetElements();
- while ( faceIt->more() )
- {
- const SMDS_MeshElement* face = faceIt->next();
- int aNbNode = face->NbNodes();
- if ( aNbNode > 4 )
- aNbNode /= 2; // do not take into account additional middle nodes
-
- SMDS_MeshNode* node1 = (SMDS_MeshNode*)face->GetNode( 0 );
- for ( int nIndx = 0; nIndx < aNbNode; nIndx++ )
- {
- SMDS_MeshNode* node2 = (SMDS_MeshNode*)face->GetNode( nIndx+1 < aNbNode ? nIndx+1 : 0 );
- if ( setOfEdge.insert( SMESH_TLink ( node1, node2 ) ).second )
- {
- listOfElemType.push_back( SMDSAbs_Edge );
- connectivity.push_back
- ( mapNode2LocalID.insert( make_pair( node1, ++nbConnNodes)).first );
- connectivity.push_back
- ( mapNode2LocalID.insert( make_pair( node2, ++nbConnNodes)).first );
- }
- node1 = node2;
- }
- }
- }
- else if ( theDimension == SMESH::DIM_1D )
- {
- SMDS_NodeIteratorPtr nodeIt = smDS->GetNodes();
- while ( nodeIt->more() )
- {
- listOfElemType.push_back( SMDSAbs_Node );
- connectivity.push_back
- ( mapNode2LocalID.insert( make_pair( nodeIt->next(), ++nbConnNodes)).first );
- }
- // add corner nodes by first vertex from edge
- SMESH_subMeshIteratorPtr edgeSmIt =
- sm->getDependsOnIterator(/*includeSelf*/false,
- /*complexShapeFirst*/false);
- while ( edgeSmIt->more() )
- {
- SMESH_subMesh* vertexSM = edgeSmIt->next();
- // check that vertex is not already treated
- if ( !setOfVSubMesh.insert( vertexSM ).second )
- continue;
- if ( vertexSM->GetSubShape().ShapeType() != TopAbs_VERTEX )
- continue;
-
- const SMESHDS_SubMesh* vertexSmDS = vertexSM->GetSubMeshDS();
- SMDS_NodeIteratorPtr nodeIt = vertexSmDS->GetNodes();
- while ( nodeIt->more() )
- {
- listOfElemType.push_back( SMDSAbs_Node );
- connectivity.push_back
- ( mapNode2LocalID.insert( make_pair( nodeIt->next(), ++nbConnNodes)).first );
- }
- }
- }
- }
-
- // fill node coords and assign local ids to the nodes
- int nbNodes = mapNode2LocalID.size();
- result->nodesXYZ.length( nbNodes );
- TNodeLocalID node2ID = mapNode2LocalID.begin();
- for ( i = 0; i < nbNodes; ++i, ++node2ID ) {
- node2ID->second = i;
- const SMDS_MeshNode* node = (const SMDS_MeshNode*) node2ID->first;
- result->nodesXYZ[i].x = node->X();
- result->nodesXYZ[i].y = node->Y();
- result->nodesXYZ[i].z = node->Z();
- }
- // fill connectivity
- result->elementConnectivities.length( nbConnNodes );
- list< TNodeLocalID >::iterator connIt = connectivity.begin();
- for ( i = 0; i < nbConnNodes; ++i, ++connIt ) {
- result->elementConnectivities[i] = (*connIt)->second;
- }
-
- // fill element types
- result->elementTypes.length( listOfElemType.size() );
- std::list< SMDSAbs_ElementType >::const_iterator typeIt = listOfElemType.begin();
- std::list< SMDSAbs_ElementType >::const_iterator typeEnd = listOfElemType.end();
- for ( i = 0; typeIt != typeEnd; ++i, ++typeIt )
+ int nbShapeId = shapeIds.size();
+ theShapesId.length( nbShapeId );
+ // iterates on shapes and collect mesh entities into mesh preview
+ TSetOfInt::const_iterator idIt = shapeIds.begin();
+ TSetOfInt::const_iterator idEnd = shapeIds.end();
+ std::map< int, int > mapOfShIdNb;
+ std::set< SMESH_TLink > setOfEdge;
+ std::list< SMDSAbs_ElementType > listOfElemType;
+ typedef map<const SMDS_MeshElement*, int > TNode2LocalIDMap;
+ typedef TNode2LocalIDMap::iterator TNodeLocalID;
+ TNode2LocalIDMap mapNode2LocalID;
+ list< TNodeLocalID > connectivity;
+ int i, nbConnNodes = 0;
+ std::set< const SMESH_subMesh* > setOfVSubMesh;
+ // iterates on shapes
+ for ( ; idIt != idEnd; idIt++ )
{
- SMDSAbs_ElementType elemType = *typeIt;
- result->elementTypes[i].SMDS_ElementType = (SMESH::ElementType)elemType;
- result->elementTypes[i].isPoly = false;
- result->elementTypes[i].nbNodesInElement = elemType == SMDSAbs_Edge ? 2 : 1;
- }
-
- // correct number of shapes
- theShapesId.length( mapOfShIdNb.size() );
+ if ( mapOfShIdNb.find( *idIt ) != mapOfShIdNb.end() )
+ continue;
+ SMESH_subMesh* sm = myLocMesh.GetSubMeshContaining(*idIt);
+ if ( !sm || !sm->IsMeshComputed() )
+ continue;
+
+ const TopoDS_Shape& aSh = sm->GetSubShape();
+ const int shDim = myGen.GetShapeDim( aSh );
+ if ( shDim < 1 || shDim > theDimension )
+ continue;
+
+ mapOfShIdNb[ *idIt ] = 0;
+ theShapesId[ mapOfShIdNb.size() - 1 ] = *idIt;
+
+ SMESHDS_SubMesh* smDS = sm->GetSubMeshDS();
+ if ( !smDS ) continue;
+
+ if ( theDimension == SMESH::DIM_2D )
+ {
+ SMDS_ElemIteratorPtr faceIt = smDS->GetElements();
+ while ( faceIt->more() )
+ {
+ const SMDS_MeshElement* face = faceIt->next();
+ int aNbNode = face->NbNodes();
+ if ( aNbNode > 4 )
+ aNbNode /= 2; // do not take into account additional middle nodes
+
+ SMDS_MeshNode* node1 = (SMDS_MeshNode*)face->GetNode( 0 );
+ for ( int nIndx = 0; nIndx < aNbNode; nIndx++ )
+ {
+ SMDS_MeshNode* node2 = (SMDS_MeshNode*)face->GetNode( nIndx+1 < aNbNode ? nIndx+1 : 0 );
+ if ( setOfEdge.insert( SMESH_TLink ( node1, node2 ) ).second )
+ {
+ listOfElemType.push_back( SMDSAbs_Edge );
+ connectivity.push_back
+ ( mapNode2LocalID.insert( make_pair( node1, ++nbConnNodes)).first );
+ connectivity.push_back
+ ( mapNode2LocalID.insert( make_pair( node2, ++nbConnNodes)).first );
+ }
+ node1 = node2;
+ }
+ }
+ }
+ else if ( theDimension == SMESH::DIM_1D )
+ {
+ SMDS_NodeIteratorPtr nodeIt = smDS->GetNodes();
+ while ( nodeIt->more() )
+ {
+ listOfElemType.push_back( SMDSAbs_Node );
+ connectivity.push_back
+ ( mapNode2LocalID.insert( make_pair( nodeIt->next(), ++nbConnNodes)).first );
+ }
+ // add corner nodes by first vertex from edge
+ SMESH_subMeshIteratorPtr edgeSmIt =
+ sm->getDependsOnIterator(/*includeSelf*/false,
+ /*complexShapeFirst*/false);
+ while ( edgeSmIt->more() )
+ {
+ SMESH_subMesh* vertexSM = edgeSmIt->next();
+ // check that vertex is not already treated
+ if ( !setOfVSubMesh.insert( vertexSM ).second )
+ continue;
+ if ( vertexSM->GetSubShape().ShapeType() != TopAbs_VERTEX )
+ continue;
+
+ const SMESHDS_SubMesh* vertexSmDS = vertexSM->GetSubMeshDS();
+ SMDS_NodeIteratorPtr nodeIt = vertexSmDS->GetNodes();
+ while ( nodeIt->more() )
+ {
+ listOfElemType.push_back( SMDSAbs_Node );
+ connectivity.push_back
+ ( mapNode2LocalID.insert( make_pair( nodeIt->next(), ++nbConnNodes)).first );
+ }
+ }
+ }
+ }
+
+ // fill node coords and assign local ids to the nodes
+ int nbNodes = mapNode2LocalID.size();
+ result->nodesXYZ.length( nbNodes );
+ TNodeLocalID node2ID = mapNode2LocalID.begin();
+ for ( i = 0; i < nbNodes; ++i, ++node2ID ) {
+ node2ID->second = i;
+ const SMDS_MeshNode* node = (const SMDS_MeshNode*) node2ID->first;
+ result->nodesXYZ[i].x = node->X();
+ result->nodesXYZ[i].y = node->Y();
+ result->nodesXYZ[i].z = node->Z();
+ }
+ // fill connectivity
+ result->elementConnectivities.length( nbConnNodes );
+ list< TNodeLocalID >::iterator connIt = connectivity.begin();
+ for ( i = 0; i < nbConnNodes; ++i, ++connIt ) {
+ result->elementConnectivities[i] = (*connIt)->second;
+ }
+
+ // fill element types
+ result->elementTypes.length( listOfElemType.size() );
+ std::list< SMDSAbs_ElementType >::const_iterator typeIt = listOfElemType.begin();
+ std::list< SMDSAbs_ElementType >::const_iterator typeEnd = listOfElemType.end();
+ for ( i = 0; typeIt != typeEnd; ++i, ++typeIt )
+ {
+ SMDSAbs_ElementType elemType = *typeIt;
+ result->elementTypes[i].SMDS_ElementType = (SMESH::ElementType)elemType;
+ result->elementTypes[i].isPoly = false;
+ result->elementTypes[i].nbNodesInElement = elemType == SMDSAbs_Edge ? 2 : 1;
+ }
+
+ // correct number of shapes
+ theShapesId.length( mapOfShIdNb.size() );
}
}
}
//=============================================================================
SMESH::long_array* SMESH_Gen_i::Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
- GEOM::GEOM_Object_ptr theShapeObject)
+ GEOM::GEOM_Object_ptr theShapeObject)
// SMESH::long_array& theNbElems)
throw ( SALOME::SALOME_Exception )
{
/*CORBA::Boolean ret =*/ myGen.Evaluate( myLocMesh, myLocShape, aResMap);
MapShapeNbElemsItr anIt = aResMap.begin();
for(; anIt!=aResMap.end(); anIt++) {
- const vector<int>& aVec = (*anIt).second;
- for(i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++) {
- nbels[i] += aVec[i];
- }
+ const vector<int>& aVec = (*anIt).second;
+ for(i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++) {
+ nbels[i] += aVec[i];
+ }
}
#ifdef _DEBUG_
cout<<endl;
}
if ( !geom->_is_nil() ) {
GeomObjectToShape( geom ); // let geom client remember the found shape
- return geom._retn();
+ return geom._retn();
}
}
}
//================================================================================
SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshesArray,
- CORBA::Boolean theUniteIdenticalGroups,
- CORBA::Boolean theMergeNodesAndElements,
- CORBA::Double theMergeTolerance)
+ CORBA::Boolean theUniteIdenticalGroups,
+ CORBA::Boolean theMergeNodesAndElements,
+ CORBA::Double theMergeTolerance)
throw ( SALOME::SALOME_Exception )
{
return ConcatenateCommon(theMeshesArray,
- theUniteIdenticalGroups,
- theMergeNodesAndElements,
- theMergeTolerance,
- false);
+ theUniteIdenticalGroups,
+ theMergeNodesAndElements,
+ theMergeTolerance,
+ false);
}
//================================================================================
SMESH::SMESH_Mesh_ptr
SMESH_Gen_i::ConcatenateWithGroups(const SMESH::mesh_array& theMeshesArray,
- CORBA::Boolean theUniteIdenticalGroups,
+ CORBA::Boolean theUniteIdenticalGroups,
CORBA::Boolean theMergeNodesAndElements,
CORBA::Double theMergeTolerance)
throw ( SALOME::SALOME_Exception )
theUniteIdenticalGroups,
theMergeNodesAndElements,
theMergeTolerance,
- true);
+ true);
}
//================================================================================
SMESH::SMESH_Mesh_ptr
SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
- CORBA::Boolean theUniteIdenticalGroups,
+ CORBA::Boolean theUniteIdenticalGroups,
CORBA::Boolean theMergeNodesAndElements,
CORBA::Double theMergeTolerance,
- CORBA::Boolean theCommonGroups)
+ CORBA::Boolean theCommonGroups)
throw ( SALOME::SALOME_Exception )
{
typedef map<int, int> TIDsMap;
typedef map< pair<string, SMESH::ElementType>, TListOfNewGroups > TGroupsMap;
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
SMESH::SMESH_Mesh_var aNewMesh = CreateEmptyMesh();
// loop on meshes
for ( int i = 0; i < theMeshesArray.length(); i++) {
- SMESH::SMESH_Mesh_var anInitMesh = theMeshesArray[i];
- if ( !anInitMesh->_is_nil() ) {
- SMESH_Mesh_i* anInitImpl = dynamic_cast<SMESH_Mesh_i*>( GetServant( anInitMesh ).in() );
- if ( anInitImpl ) {
- ::SMESH_Mesh& aInitLocMesh = anInitImpl->GetImpl();
- SMESHDS_Mesh* anInitMeshDS = aInitLocMesh.GetMeshDS();
-
- TIDsMap nodesMap;
- TIDsMap elemsMap;
-
- // loop on elements of mesh
- SMDS_ElemIteratorPtr itElems = anInitMeshDS->elementsIterator();
- const SMDS_MeshElement* anElem = 0;
- const SMDS_MeshElement* aNewElem = 0;
- int anElemNbNodes = 0;
-
- int anNbNodes = 0;
- int anNbEdges = 0;
- int anNbFaces = 0;
- int anNbVolumes = 0;
-
- SMESH::long_array_var anIDsNodes = new SMESH::long_array();
- SMESH::long_array_var anIDsEdges = new SMESH::long_array();
- SMESH::long_array_var anIDsFaces = new SMESH::long_array();
- SMESH::long_array_var anIDsVolumes = new SMESH::long_array();
-
- if( theCommonGroups ) {
- anIDsNodes->length( anInitMeshDS->NbNodes() );
- anIDsEdges->length( anInitMeshDS->NbEdges() );
- anIDsFaces->length( anInitMeshDS->NbFaces() );
- anIDsVolumes->length( anInitMeshDS->NbVolumes() );
- }
-
- for ( int j = 0; itElems->more(); j++) {
- anElem = itElems->next();
- SMDSAbs_ElementType anElemType = anElem->GetType();
- anElemNbNodes = anElem->NbNodes();
- std::vector<const SMDS_MeshNode*> aNodesArray (anElemNbNodes);
-
- // loop on nodes of element
- const SMDS_MeshNode* aNode = 0;
- const SMDS_MeshNode* aNewNode = 0;
- SMDS_ElemIteratorPtr itNodes = anElem->nodesIterator();
-
- for ( int k = 0; itNodes->more(); k++) {
- aNode = static_cast<const SMDS_MeshNode*>(itNodes->next());
- if ( nodesMap.find(aNode->GetID()) == nodesMap.end() ) {
- aNewNode = aNewMeshDS->AddNode(aNode->X(), aNode->Y(), aNode->Z());
- nodesMap.insert( make_pair(aNode->GetID(), aNewNode->GetID()) );
- if( theCommonGroups )
- anIDsNodes[anNbNodes++] = aNewNode->GetID();
- }
- else
- aNewNode = aNewMeshDS->FindNode( nodesMap.find(aNode->GetID())->second );
- aNodesArray[k] = aNewNode;
- }//nodes loop
-
- // creates a corresponding element on existent nodes in new mesh
- if ( anElem->IsPoly() && anElemType == SMDSAbs_Volume )
- {
- const SMDS_PolyhedralVolumeOfNodes* aVolume =
- dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem);
- if ( aVolume ) {
- aNewElem = aNewMeshDS->AddPolyhedralVolume(aNodesArray,
- aVolume->GetQuanities());
- elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
- if( theCommonGroups )
- anIDsVolumes[anNbVolumes++] = aNewElem->GetID();
- }
- }
- else {
-
- aNewElem = aNewEditor.AddElement(aNodesArray,
- anElemType,
- anElem->IsPoly());
- elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
- if( theCommonGroups ) {
- if( anElemType == SMDSAbs_Edge )
- anIDsEdges[anNbEdges++] = aNewElem->GetID();
- else if( anElemType == SMDSAbs_Face )
- anIDsFaces[anNbFaces++] = aNewElem->GetID();
- else if( anElemType == SMDSAbs_Volume )
- anIDsVolumes[anNbVolumes++] = aNewElem->GetID();
- }
- }
- }//elems loop
-
- aListOfGroups = anInitImpl->GetGroups();
- SMESH::SMESH_GroupBase_ptr aGroup;
-
- // loop on groups of mesh
- SMESH::long_array_var anInitIDs = new SMESH::long_array();
- SMESH::long_array_var anNewIDs = new SMESH::long_array();
- SMESH::SMESH_Group_var aNewGroup;
-
- SMESH::ElementType aGroupType;
- CORBA::String_var aGroupName;
- if ( theCommonGroups ) {
- for(aGroupType=SMESH::NODE;aGroupType<=SMESH::VOLUME;aGroupType=(SMESH::ElementType)(aGroupType+1)) {
- string str = "Gr";
- SALOMEDS::SObject_var aMeshSObj = ObjectToSObject( myCurrentStudy, anInitMesh );
- if(aMeshSObj)
- str += aMeshSObj->GetName();
- str += "_";
-
- int anLen = 0;
-
- switch(aGroupType) {
- case SMESH::NODE:
- str += "Nodes";
- anIDsNodes->length(anNbNodes);
- anLen = anNbNodes;
- break;
- case SMESH::EDGE:
- str += "Edges";
- anIDsEdges->length(anNbEdges);
- anLen = anNbEdges;
- break;
- case SMESH::FACE:
- str += "Faces";
- anIDsFaces->length(anNbFaces);
- anLen = anNbFaces;
- break;
- case SMESH::VOLUME:
- str += "Volumes";
- anIDsVolumes->length(anNbVolumes);
- anLen = anNbVolumes;
- break;
- default:
- break;
- }
-
- if(anLen) {
- aGroupName = str.c_str();
-
- // add a new group in the mesh
- aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName);
-
- switch(aGroupType) {
- case SMESH::NODE:
- aNewGroup->Add( anIDsNodes );
- break;
- case SMESH::EDGE:
- aNewGroup->Add( anIDsEdges );
- break;
- case SMESH::FACE:
- aNewGroup->Add( anIDsFaces );
- break;
- case SMESH::VOLUME:
- aNewGroup->Add( anIDsVolumes );
- break;
- default:
- break;
- }
-
- aListOfNewGroups.clear();
- aListOfNewGroups.push_back(aNewGroup);
- aGroupsMap.insert(make_pair( make_pair(aGroupName, aGroupType), aListOfNewGroups ));
- }
- }
- }
-
- // check that current group name and type don't have identical ones in union mesh
- for (int i = 0; i < aListOfGroups->length(); i++) {
- aGroup = aListOfGroups[i];
- aListOfNewGroups.clear();
- aGroupType = aGroup->GetType();
- aGroupName = aGroup->GetName();
-
- TGroupsMap::iterator anIter = aGroupsMap.find(make_pair(aGroupName, aGroupType));
-
- // convert a list of IDs
- anInitIDs = aGroup->GetListOfID();
- anNewIDs->length(anInitIDs->length());
- if ( aGroupType == SMESH::NODE )
- for (int j = 0; j < anInitIDs->length(); j++) {
- anNewIDs[j] = nodesMap.find(anInitIDs[j])->second;
- }
- else
- for (int j = 0; j < anInitIDs->length(); j++) {
- anNewIDs[j] = elemsMap.find(anInitIDs[j])->second;
- }
-
- // check that current group name and type don't have identical ones in union mesh
- if ( anIter == aGroupsMap.end() ) {
- // add a new group in the mesh
- aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName);
- // add elements into new group
- aNewGroup->Add( anNewIDs );
-
- aListOfNewGroups.push_back(aNewGroup);
- aGroupsMap.insert(make_pair( make_pair(aGroupName, aGroupType), aListOfNewGroups ));
- }
-
- else if ( theUniteIdenticalGroups ) {
- // unite identical groups
- TListOfNewGroups& aNewGroups = anIter->second;
- aNewGroups.front()->Add( anNewIDs );
- }
-
- else {
- // rename identical groups
- aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName);
- aNewGroup->Add( anNewIDs );
-
- TListOfNewGroups& aNewGroups = anIter->second;
- string aNewGroupName;
- if (aNewGroups.size() == 1) {
- aNewGroupName = string(aGroupName) + "_1";
- aNewGroups.front()->SetName(aNewGroupName.c_str());
- }
- char aGroupNum[128];
- sprintf(aGroupNum, "%u", aNewGroups.size()+1);
- aNewGroupName = string(aGroupName) + "_" + string(aGroupNum);
- aNewGroup->SetName(aNewGroupName.c_str());
- aNewGroups.push_back(aNewGroup);
- }
- }//groups loop
- }
- }
+ SMESH::SMESH_Mesh_var anInitMesh = theMeshesArray[i];
+ if ( !anInitMesh->_is_nil() ) {
+ SMESH_Mesh_i* anInitImpl = dynamic_cast<SMESH_Mesh_i*>( GetServant( anInitMesh ).in() );
+ if ( anInitImpl ) {
+ ::SMESH_Mesh& aInitLocMesh = anInitImpl->GetImpl();
+ SMESHDS_Mesh* anInitMeshDS = aInitLocMesh.GetMeshDS();
+
+ TIDsMap nodesMap;
+ TIDsMap elemsMap;
+
+ // loop on elements of mesh
+ SMDS_ElemIteratorPtr itElems = anInitMeshDS->elementsIterator();
+ const SMDS_MeshElement* anElem = 0;
+ const SMDS_MeshElement* aNewElem = 0;
+ int anElemNbNodes = 0;
+
+ int anNbNodes = 0;
+ int anNbEdges = 0;
+ int anNbFaces = 0;
+ int anNbVolumes = 0;
+
+ SMESH::long_array_var anIDsNodes = new SMESH::long_array();
+ SMESH::long_array_var anIDsEdges = new SMESH::long_array();
+ SMESH::long_array_var anIDsFaces = new SMESH::long_array();
+ SMESH::long_array_var anIDsVolumes = new SMESH::long_array();
+
+ if( theCommonGroups ) {
+ anIDsNodes->length( anInitMeshDS->NbNodes() );
+ anIDsEdges->length( anInitMeshDS->NbEdges() );
+ anIDsFaces->length( anInitMeshDS->NbFaces() );
+ anIDsVolumes->length( anInitMeshDS->NbVolumes() );
+ }
+
+ for ( int j = 0; itElems->more(); j++) {
+ anElem = itElems->next();
+ SMDSAbs_ElementType anElemType = anElem->GetType();
+ anElemNbNodes = anElem->NbNodes();
+ std::vector<const SMDS_MeshNode*> aNodesArray (anElemNbNodes);
+
+ // loop on nodes of element
+ const SMDS_MeshNode* aNode = 0;
+ const SMDS_MeshNode* aNewNode = 0;
+ SMDS_ElemIteratorPtr itNodes = anElem->nodesIterator();
+
+ for ( int k = 0; itNodes->more(); k++) {
+ aNode = static_cast<const SMDS_MeshNode*>(itNodes->next());
+ if ( nodesMap.find(aNode->GetID()) == nodesMap.end() ) {
+ aNewNode = aNewMeshDS->AddNode(aNode->X(), aNode->Y(), aNode->Z());
+ nodesMap.insert( make_pair(aNode->GetID(), aNewNode->GetID()) );
+ if( theCommonGroups )
+ anIDsNodes[anNbNodes++] = aNewNode->GetID();
+ }
+ else
+ aNewNode = aNewMeshDS->FindNode( nodesMap.find(aNode->GetID())->second );
+ aNodesArray[k] = aNewNode;
+ }//nodes loop
+
+ // creates a corresponding element on existent nodes in new mesh
+ if ( anElem->IsPoly() && anElemType == SMDSAbs_Volume )
+ {
+ const SMDS_PolyhedralVolumeOfNodes* aVolume =
+ dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem);
+ if ( aVolume ) {
+ aNewElem = aNewMeshDS->AddPolyhedralVolume(aNodesArray,
+ aVolume->GetQuanities());
+ elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
+ if( theCommonGroups )
+ anIDsVolumes[anNbVolumes++] = aNewElem->GetID();
+ }
+ }
+ else {
+
+ aNewElem = aNewEditor.AddElement(aNodesArray,
+ anElemType,
+ anElem->IsPoly());
+ elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
+ if( theCommonGroups ) {
+ if( anElemType == SMDSAbs_Edge )
+ anIDsEdges[anNbEdges++] = aNewElem->GetID();
+ else if( anElemType == SMDSAbs_Face )
+ anIDsFaces[anNbFaces++] = aNewElem->GetID();
+ else if( anElemType == SMDSAbs_Volume )
+ anIDsVolumes[anNbVolumes++] = aNewElem->GetID();
+ }
+ }
+ }//elems loop
+
+ aListOfGroups = anInitImpl->GetGroups();
+ SMESH::SMESH_GroupBase_ptr aGroup;
+
+ // loop on groups of mesh
+ SMESH::long_array_var anInitIDs = new SMESH::long_array();
+ SMESH::long_array_var anNewIDs = new SMESH::long_array();
+ SMESH::SMESH_Group_var aNewGroup;
+
+ SMESH::ElementType aGroupType;
+ CORBA::String_var aGroupName;
+ if ( theCommonGroups ) {
+ for(aGroupType=SMESH::NODE;aGroupType<=SMESH::VOLUME;aGroupType=(SMESH::ElementType)(aGroupType+1)) {
+ string str = "Gr";
+ SALOMEDS::SObject_var aMeshSObj = ObjectToSObject( myCurrentStudy, anInitMesh );
+ if(aMeshSObj)
+ str += aMeshSObj->GetName();
+ str += "_";
+
+ int anLen = 0;
+
+ switch(aGroupType) {
+ case SMESH::NODE:
+ str += "Nodes";
+ anIDsNodes->length(anNbNodes);
+ anLen = anNbNodes;
+ break;
+ case SMESH::EDGE:
+ str += "Edges";
+ anIDsEdges->length(anNbEdges);
+ anLen = anNbEdges;
+ break;
+ case SMESH::FACE:
+ str += "Faces";
+ anIDsFaces->length(anNbFaces);
+ anLen = anNbFaces;
+ break;
+ case SMESH::VOLUME:
+ str += "Volumes";
+ anIDsVolumes->length(anNbVolumes);
+ anLen = anNbVolumes;
+ break;
+ default:
+ break;
+ }
+
+ if(anLen) {
+ aGroupName = str.c_str();
+
+ // add a new group in the mesh
+ aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName);
+
+ switch(aGroupType) {
+ case SMESH::NODE:
+ aNewGroup->Add( anIDsNodes );
+ break;
+ case SMESH::EDGE:
+ aNewGroup->Add( anIDsEdges );
+ break;
+ case SMESH::FACE:
+ aNewGroup->Add( anIDsFaces );
+ break;
+ case SMESH::VOLUME:
+ aNewGroup->Add( anIDsVolumes );
+ break;
+ default:
+ break;
+ }
+
+ aListOfNewGroups.clear();
+ aListOfNewGroups.push_back(aNewGroup);
+ aGroupsMap.insert(make_pair( make_pair(aGroupName, aGroupType), aListOfNewGroups ));
+ }
+ }
+ }
+
+ // check that current group name and type don't have identical ones in union mesh
+ for (int i = 0; i < aListOfGroups->length(); i++) {
+ aGroup = aListOfGroups[i];
+ aListOfNewGroups.clear();
+ aGroupType = aGroup->GetType();
+ aGroupName = aGroup->GetName();
+
+ TGroupsMap::iterator anIter = aGroupsMap.find(make_pair(aGroupName, aGroupType));
+
+ // convert a list of IDs
+ anInitIDs = aGroup->GetListOfID();
+ anNewIDs->length(anInitIDs->length());
+ if ( aGroupType == SMESH::NODE )
+ for (int j = 0; j < anInitIDs->length(); j++) {
+ anNewIDs[j] = nodesMap.find(anInitIDs[j])->second;
+ }
+ else
+ for (int j = 0; j < anInitIDs->length(); j++) {
+ anNewIDs[j] = elemsMap.find(anInitIDs[j])->second;
+ }
+
+ // check that current group name and type don't have identical ones in union mesh
+ if ( anIter == aGroupsMap.end() ) {
+ // add a new group in the mesh
+ aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName);
+ // add elements into new group
+ aNewGroup->Add( anNewIDs );
+
+ aListOfNewGroups.push_back(aNewGroup);
+ aGroupsMap.insert(make_pair( make_pair(aGroupName, aGroupType), aListOfNewGroups ));
+ }
+
+ else if ( theUniteIdenticalGroups ) {
+ // unite identical groups
+ TListOfNewGroups& aNewGroups = anIter->second;
+ aNewGroups.front()->Add( anNewIDs );
+ }
+
+ else {
+ // rename identical groups
+ aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName);
+ aNewGroup->Add( anNewIDs );
+
+ TListOfNewGroups& aNewGroups = anIter->second;
+ string aNewGroupName;
+ if (aNewGroups.size() == 1) {
+ aNewGroupName = string(aGroupName) + "_1";
+ aNewGroups.front()->SetName(aNewGroupName.c_str());
+ }
+ char aGroupNum[128];
+ sprintf(aGroupNum, "%u", aNewGroups.size()+1);
+ aNewGroupName = string(aGroupName) + "_" + string(aGroupNum);
+ aNewGroup->SetName(aNewGroupName.c_str());
+ aNewGroups.push_back(aNewGroup);
+ }
+ }//groups loop
+ }
+ }
}//meshes loop
if (theMergeNodesAndElements) {
- // merge nodes
- set<const SMDS_MeshNode*> aMeshNodes; // no input nodes
- SMESH_MeshEditor::TListOfListOfNodes aGroupsOfNodes;
- aNewEditor.FindCoincidentNodes( aMeshNodes, theMergeTolerance, aGroupsOfNodes );
- aNewEditor.MergeNodes( aGroupsOfNodes );
- // merge elements
- aNewEditor.MergeEqualElements();
+ // merge nodes
+ set<const SMDS_MeshNode*> aMeshNodes; // no input nodes
+ SMESH_MeshEditor::TListOfListOfNodes aGroupsOfNodes;
+ aNewEditor.FindCoincidentNodes( aMeshNodes, theMergeTolerance, aGroupsOfNodes );
+ aNewEditor.MergeNodes( aGroupsOfNodes );
+ // merge elements
+ aNewEditor.MergeEqualElements();
}
}
}
}
aPythonDump << "], ";
aPythonDump << theUniteIdenticalGroups << ", "
- << theMergeNodesAndElements << ", "
+ << theMergeNodesAndElements << ", "
<< 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();
}
aDataset->WriteOnDisk( ( char* )( strHasData.c_str() ) );
aDataset->CloseOnDisk();
- // ouv : NPAL12872
+ // ouv : NPAL12872
// for each mesh open the HDF group basing on its auto color parameter
- char meshAutoColorName[ 30 ];
- sprintf( meshAutoColorName, "AutoColorMesh %d", id );
- int anAutoColor[1];
- anAutoColor[0] = myImpl->GetAutoColor();
- aSize[ 0 ] = 1;
- aDataset = new HDFdataset( meshAutoColorName, aTopGroup, HDF_INT32, aSize, 1 );
- aDataset->CreateOnDisk();
- aDataset->WriteOnDisk( anAutoColor );
- aDataset->CloseOnDisk();
+ char meshAutoColorName[ 30 ];
+ sprintf( meshAutoColorName, "AutoColorMesh %d", id );
+ int anAutoColor[1];
+ anAutoColor[0] = myImpl->GetAutoColor();
+ aSize[ 0 ] = 1;
+ aDataset = new HDFdataset( meshAutoColorName, aTopGroup, HDF_INT32, aSize, 1 );
+ aDataset->CreateOnDisk();
+ aDataset->WriteOnDisk( anAutoColor );
+ aDataset->CloseOnDisk();
// write reference on a shape if exists
SALOMEDS::SObject_var myRef;
//if ( shapeRefFound )
//myWriter.AddAllSubMeshes();
- // groups root sub-branch
- SALOMEDS::SObject_var myGroupsBranch;
- for ( int i = GetNodeGroupsTag(); i <= GetVolumeGroupsTag(); i++ ) {
- found = gotBranch->FindSubObject( i, myGroupsBranch );
- if ( found ) {
- char name_group[ 30 ];
- if ( i == GetNodeGroupsTag() )
- strcpy( name_group, "Groups of Nodes" );
- else if ( i == GetEdgeGroupsTag() )
- strcpy( name_group, "Groups of Edges" );
- else if ( i == GetFaceGroupsTag() )
- strcpy( name_group, "Groups of Faces" );
- else if ( i == GetVolumeGroupsTag() )
- strcpy( name_group, "Groups of Volumes" );
-
- aGroup = new HDFgroup( name_group, aTopGroup );
- aGroup->CreateOnDisk();
-
- SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( myGroupsBranch );
- for ( ; it->More(); it->Next() ) {
- SALOMEDS::SObject_var mySObject = it->Value();
- CORBA::Object_var aSubObject = SObjectToObject( mySObject );
- if ( !CORBA::is_nil( aSubObject ) ) {
- SMESH_GroupBase_i* myGroupImpl =
- dynamic_cast<SMESH_GroupBase_i*>( GetServant( aSubObject ).in() );
- if ( !myGroupImpl )
- continue;
-
- CORBA::String_var objStr = GetORB()->object_to_string( aSubObject );
- int anId = myStudyContext->findId( string( objStr.in() ) );
-
- // For each group, create a dataset named "Group <group_persistent_id>"
- // and store the group's user name into it
- char grpName[ 30 ];
- sprintf( grpName, "Group %d", anId );
- char* aUserName = myGroupImpl->GetName();
- aSize[ 0 ] = strlen( aUserName ) + 1;
-
- aDataset = new HDFdataset( grpName, aGroup, HDF_STRING, aSize, 1 );
- aDataset->CreateOnDisk();
- aDataset->WriteOnDisk( aUserName );
- aDataset->CloseOnDisk();
-
- // ouv : NPAL12872
- // For each group, create a dataset named "Group <group_persistent_id> Color"
- // and store the group's color into it
- char grpColorName[ 30 ];
- sprintf( grpColorName, "ColorGroup %d", anId );
- SALOMEDS::Color aColor = myGroupImpl->GetColor();
- double anRGB[3];
- anRGB[ 0 ] = aColor.R;
- anRGB[ 1 ] = aColor.G;
- anRGB[ 2 ] = aColor.B;
- aSize[ 0 ] = 3;
- aDataset = new HDFdataset( grpColorName, aGroup, HDF_FLOAT64, aSize, 1 );
- aDataset->CreateOnDisk();
- aDataset->WriteOnDisk( anRGB );
- aDataset->CloseOnDisk();
-
- // Store the group contents into MED file
- if ( myLocMesh.GetGroup( myGroupImpl->GetLocalID() ) ) {
-
- if(MYDEBUG) MESSAGE( "VSR - SMESH_Gen_i::Save(): saving group with StoreName = "
- << grpName << " to MED file" );
- SMESHDS_GroupBase* aGrpBaseDS =
- myLocMesh.GetGroup( myGroupImpl->GetLocalID() )->GetGroupDS();
- aGrpBaseDS->SetStoreName( grpName );
-
- // Pass SMESHDS_Group to MED writer
- SMESHDS_Group* aGrpDS = dynamic_cast<SMESHDS_Group*>( aGrpBaseDS );
- if ( aGrpDS )
- myWriter.AddGroup( aGrpDS );
-
- // write reference on a shape if exists
- SMESHDS_GroupOnGeom* aGeomGrp =
- dynamic_cast<SMESHDS_GroupOnGeom*>( aGrpBaseDS );
- if ( aGeomGrp ) {
- SALOMEDS::SObject_var mySubRef, myShape;
- if (mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef ) &&
- mySubRef->ReferencedObject( myShape ) &&
- !CORBA::is_nil( myShape->GetObject() ))
- {
- string myRefOnObject = myShape->GetID();
- if ( myRefOnObject.length() > 0 ) {
- char aRefName[ 30 ];
- sprintf( aRefName, "Ref on shape %d", anId);
- aSize[ 0 ] = myRefOnObject.length() + 1;
- aDataset = new HDFdataset(aRefName, aGroup, HDF_STRING, aSize, 1);
- aDataset->CreateOnDisk();
- aDataset->WriteOnDisk( ( char* )( myRefOnObject.c_str() ) );
- aDataset->CloseOnDisk();
- }
- }
- else // shape ref is invalid:
- {
- // save a group on geometry as ordinary group
- myWriter.AddGroup( aGeomGrp );
- }
- }
- }
- }
- }
- aGroup->CloseOnDisk();
- }
- } // loop on groups
-
- if ( strcmp( strHasData.c_str(), "1" ) == 0 )
- {
- // Flush current mesh information into MED file
- myWriter.Perform();
-
- // maybe a shape was deleted in the study
- if ( !shapeRefFound && !mySMESHDSMesh->ShapeToMesh().IsNull() && hasShape) {
- TopoDS_Shape nullShape;
- myLocMesh.ShapeToMesh( nullShape ); // remove shape referring data
- }
-
- if ( !mySMESHDSMesh->SubMeshes().empty() )
- {
- // Store submeshes
- // ----------------
- aGroup = new HDFgroup( "Submeshes", aTopGroup );
- aGroup->CreateOnDisk();
-
- // each element belongs to one or none submesh,
- // so for each node/element, we store a submesh ID
-
- // Make maps of submesh IDs of elements sorted by element IDs
- typedef int TElemID;
- typedef int TSubMID;
- map< TElemID, TSubMID > eId2smId, nId2smId;
- map< TElemID, TSubMID >::iterator hint; // insertion to map is done before hint
- const map<int,SMESHDS_SubMesh*>& aSubMeshes = mySMESHDSMesh->SubMeshes();
- map<int,SMESHDS_SubMesh*>::const_iterator itSubM ( aSubMeshes.begin() );
- SMDS_NodeIteratorPtr itNode;
- SMDS_ElemIteratorPtr itElem;
- for ( itSubM = aSubMeshes.begin(); itSubM != aSubMeshes.end() ; itSubM++ )
- {
- TSubMID aSubMeID = itSubM->first;
- SMESHDS_SubMesh* aSubMesh = itSubM->second;
- if ( aSubMesh->IsComplexSubmesh() )
- continue; // submesh containing other submeshs
- // nodes
- hint = nId2smId.begin(); // optimize insertion basing on increasing order of elem Ids in submesh
- for ( itNode = aSubMesh->GetNodes(); itNode->more(); ++hint)
- hint = nId2smId.insert( hint, make_pair( itNode->next()->GetID(), aSubMeID ));
+ // groups root sub-branch
+ SALOMEDS::SObject_var myGroupsBranch;
+ for ( int i = GetNodeGroupsTag(); i <= GetVolumeGroupsTag(); i++ ) {
+ found = gotBranch->FindSubObject( i, myGroupsBranch );
+ if ( found ) {
+ char name_group[ 30 ];
+ if ( i == GetNodeGroupsTag() )
+ strcpy( name_group, "Groups of Nodes" );
+ else if ( i == GetEdgeGroupsTag() )
+ strcpy( name_group, "Groups of Edges" );
+ else if ( i == GetFaceGroupsTag() )
+ strcpy( name_group, "Groups of Faces" );
+ else if ( i == GetVolumeGroupsTag() )
+ strcpy( name_group, "Groups of Volumes" );
+
+ aGroup = new HDFgroup( name_group, aTopGroup );
+ aGroup->CreateOnDisk();
+
+ SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( myGroupsBranch );
+ for ( ; it->More(); it->Next() ) {
+ SALOMEDS::SObject_var mySObject = it->Value();
+ CORBA::Object_var aSubObject = SObjectToObject( mySObject );
+ if ( !CORBA::is_nil( aSubObject ) ) {
+ SMESH_GroupBase_i* myGroupImpl =
+ dynamic_cast<SMESH_GroupBase_i*>( GetServant( aSubObject ).in() );
+ if ( !myGroupImpl )
+ continue;
+
+ CORBA::String_var objStr = GetORB()->object_to_string( aSubObject );
+ int anId = myStudyContext->findId( string( objStr.in() ) );
+
+ // For each group, create a dataset named "Group <group_persistent_id>"
+ // and store the group's user name into it
+ char grpName[ 30 ];
+ sprintf( grpName, "Group %d", anId );
+ char* aUserName = myGroupImpl->GetName();
+ aSize[ 0 ] = strlen( aUserName ) + 1;
+
+ aDataset = new HDFdataset( grpName, aGroup, HDF_STRING, aSize, 1 );
+ aDataset->CreateOnDisk();
+ aDataset->WriteOnDisk( aUserName );
+ aDataset->CloseOnDisk();
+
+ // ouv : NPAL12872
+ // For each group, create a dataset named "Group <group_persistent_id> Color"
+ // and store the group's color into it
+ char grpColorName[ 30 ];
+ sprintf( grpColorName, "ColorGroup %d", anId );
+ SALOMEDS::Color aColor = myGroupImpl->GetColor();
+ double anRGB[3];
+ anRGB[ 0 ] = aColor.R;
+ anRGB[ 1 ] = aColor.G;
+ anRGB[ 2 ] = aColor.B;
+ aSize[ 0 ] = 3;
+ aDataset = new HDFdataset( grpColorName, aGroup, HDF_FLOAT64, aSize, 1 );
+ aDataset->CreateOnDisk();
+ aDataset->WriteOnDisk( anRGB );
+ aDataset->CloseOnDisk();
+
+ // Store the group contents into MED file
+ if ( myLocMesh.GetGroup( myGroupImpl->GetLocalID() ) ) {
+
+ if(MYDEBUG) MESSAGE( "VSR - SMESH_Gen_i::Save(): saving group with StoreName = "
+ << grpName << " to MED file" );
+ SMESHDS_GroupBase* aGrpBaseDS =
+ myLocMesh.GetGroup( myGroupImpl->GetLocalID() )->GetGroupDS();
+ aGrpBaseDS->SetStoreName( grpName );
+
+ // Pass SMESHDS_Group to MED writer
+ SMESHDS_Group* aGrpDS = dynamic_cast<SMESHDS_Group*>( aGrpBaseDS );
+ if ( aGrpDS )
+ myWriter.AddGroup( aGrpDS );
+
+ // write reference on a shape if exists
+ SMESHDS_GroupOnGeom* aGeomGrp =
+ dynamic_cast<SMESHDS_GroupOnGeom*>( aGrpBaseDS );
+ if ( aGeomGrp ) {
+ SALOMEDS::SObject_var mySubRef, myShape;
+ if (mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef ) &&
+ mySubRef->ReferencedObject( myShape ) &&
+ !CORBA::is_nil( myShape->GetObject() ))
+ {
+ string myRefOnObject = myShape->GetID();
+ if ( myRefOnObject.length() > 0 ) {
+ char aRefName[ 30 ];
+ sprintf( aRefName, "Ref on shape %d", anId);
+ aSize[ 0 ] = myRefOnObject.length() + 1;
+ aDataset = new HDFdataset(aRefName, aGroup, HDF_STRING, aSize, 1);
+ aDataset->CreateOnDisk();
+ aDataset->WriteOnDisk( ( char* )( myRefOnObject.c_str() ) );
+ aDataset->CloseOnDisk();
+ }
+ }
+ else // shape ref is invalid:
+ {
+ // save a group on geometry as ordinary group
+ myWriter.AddGroup( aGeomGrp );
+ }
+ }
+ }
+ }
+ }
+ aGroup->CloseOnDisk();
+ }
+ } // loop on groups
+
+ if ( strcmp( strHasData.c_str(), "1" ) == 0 )
+ {
+ // Flush current mesh information into MED file
+ myWriter.Perform();
+
+ // maybe a shape was deleted in the study
+ if ( !shapeRefFound && !mySMESHDSMesh->ShapeToMesh().IsNull() && hasShape) {
+ TopoDS_Shape nullShape;
+ myLocMesh.ShapeToMesh( nullShape ); // remove shape referring data
+ }
+
+ if ( !mySMESHDSMesh->SubMeshes().empty() )
+ {
+ // Store submeshes
+ // ----------------
+ aGroup = new HDFgroup( "Submeshes", aTopGroup );
+ aGroup->CreateOnDisk();
+
+ // each element belongs to one or none submesh,
+ // so for each node/element, we store a submesh ID
+
+ // Make maps of submesh IDs of elements sorted by element IDs
+ typedef int TElemID;
+ typedef int TSubMID;
+ map< TElemID, TSubMID > eId2smId, nId2smId;
+ map< TElemID, TSubMID >::iterator hint; // insertion to map is done before hint
+ const map<int,SMESHDS_SubMesh*>& aSubMeshes = mySMESHDSMesh->SubMeshes();
+ map<int,SMESHDS_SubMesh*>::const_iterator itSubM ( aSubMeshes.begin() );
+ SMDS_NodeIteratorPtr itNode;
+ SMDS_ElemIteratorPtr itElem;
+ for ( itSubM = aSubMeshes.begin(); itSubM != aSubMeshes.end() ; itSubM++ )
+ {
+ TSubMID aSubMeID = itSubM->first;
+ SMESHDS_SubMesh* aSubMesh = itSubM->second;
+ if ( aSubMesh->IsComplexSubmesh() )
+ continue; // submesh containing other submeshs
+ // nodes
+ hint = nId2smId.begin(); // optimize insertion basing on increasing order of elem Ids in submesh
+ for ( itNode = aSubMesh->GetNodes(); itNode->more(); ++hint)
+ hint = nId2smId.insert( hint, make_pair( itNode->next()->GetID(), aSubMeID ));
// elements
- hint = eId2smId.begin();
- for ( itElem = aSubMesh->GetElements(); itElem->more(); ++hint)
- hint = eId2smId.insert( hint, make_pair( itElem->next()->GetID(), aSubMeID ));
- }
-
- // Care of elements that are not on submeshes
- if ( mySMESHDSMesh->NbNodes() != nId2smId.size() ) {
- for ( itNode = mySMESHDSMesh->nodesIterator(); itNode->more(); )
- /* --- stl_map.h says : */
- /* A %map relies on unique keys and thus a %pair is only inserted if its */
- /* first element (the key) is not already present in the %map. */
- nId2smId.insert( make_pair( itNode->next()->GetID(), 0 ));
- }
- int nbElems = mySMESHDSMesh->NbEdges() + mySMESHDSMesh->NbFaces() + mySMESHDSMesh->NbVolumes();
- if ( nbElems != eId2smId.size() ) {
- for ( itElem = mySMESHDSMesh->elementsIterator(); itElem->more(); )
- eId2smId.insert( make_pair( itElem->next()->GetID(), 0 ));
- }
-
- // Store submesh IDs
- for ( int isNode = 0; isNode < 2; ++isNode )
- {
- map< TElemID, TSubMID >& id2smId = isNode ? nId2smId : eId2smId;
- if ( id2smId.empty() ) continue;
- map< TElemID, TSubMID >::const_iterator id_smId = id2smId.begin();
- // make and fill array of submesh IDs
- int* smIDs = new int [ id2smId.size() ];
- for ( int i = 0; id_smId != id2smId.end(); ++id_smId, ++i )
- smIDs[ i ] = id_smId->second;
- // write HDF group
- aSize[ 0 ] = id2smId.size();
- string aDSName( isNode ? "Node Submeshes" : "Element Submeshes");
- aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_INT32, aSize, 1 );
- aDataset->CreateOnDisk();
- aDataset->WriteOnDisk( smIDs );
- aDataset->CloseOnDisk();
- //
- delete smIDs;
- }
+ hint = eId2smId.begin();
+ for ( itElem = aSubMesh->GetElements(); itElem->more(); ++hint)
+ hint = eId2smId.insert( hint, make_pair( itElem->next()->GetID(), aSubMeID ));
+ }
+
+ // Care of elements that are not on submeshes
+ if ( mySMESHDSMesh->NbNodes() != nId2smId.size() ) {
+ for ( itNode = mySMESHDSMesh->nodesIterator(); itNode->more(); )
+ /* --- stl_map.h says : */
+ /* A %map relies on unique keys and thus a %pair is only inserted if its */
+ /* first element (the key) is not already present in the %map. */
+ nId2smId.insert( make_pair( itNode->next()->GetID(), 0 ));
+ }
+ int nbElems = mySMESHDSMesh->NbEdges() + mySMESHDSMesh->NbFaces() + mySMESHDSMesh->NbVolumes();
+ if ( nbElems != eId2smId.size() ) {
+ for ( itElem = mySMESHDSMesh->elementsIterator(); itElem->more(); )
+ eId2smId.insert( make_pair( itElem->next()->GetID(), 0 ));
+ }
+
+ // Store submesh IDs
+ for ( int isNode = 0; isNode < 2; ++isNode )
+ {
+ map< TElemID, TSubMID >& id2smId = isNode ? nId2smId : eId2smId;
+ if ( id2smId.empty() ) continue;
+ map< TElemID, TSubMID >::const_iterator id_smId = id2smId.begin();
+ // make and fill array of submesh IDs
+ int* smIDs = new int [ id2smId.size() ];
+ for ( int i = 0; id_smId != id2smId.end(); ++id_smId, ++i )
+ smIDs[ i ] = id_smId->second;
+ // write HDF group
+ aSize[ 0 ] = id2smId.size();
+ string aDSName( isNode ? "Node Submeshes" : "Element Submeshes");
+ aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_INT32, aSize, 1 );
+ aDataset->CreateOnDisk();
+ aDataset->WriteOnDisk( smIDs );
+ aDataset->CloseOnDisk();
+ //
+ delete smIDs;
+ }
+
+ // Store node positions on sub-shapes (SMDS_Position):
+ // ----------------------------------------------------
+
+ aGroup = new HDFgroup( "Node Positions", aTopGroup );
+ aGroup->CreateOnDisk();
+
+ // in aGroup, create 5 datasets to contain:
+ // "Nodes on Edges" - ID of node on edge
+ // "Edge positions" - U parameter on node on edge
+ // "Nodes on Faces" - ID of node on face
+ // "Face U positions" - U parameter of node on face
+ // "Face V positions" - V parameter of node on face
- // Store node positions on sub-shapes (SMDS_Position):
- // ----------------------------------------------------
-
- aGroup = new HDFgroup( "Node Positions", aTopGroup );
- aGroup->CreateOnDisk();
-
- // in aGroup, create 5 datasets to contain:
- // "Nodes on Edges" - ID of node on edge
- // "Edge positions" - U parameter on node on edge
- // "Nodes on Faces" - ID of node on face
- // "Face U positions" - U parameter of node on face
- // "Face V positions" - V parameter of node on face
-
- // Find out nb of nodes on edges and faces
- // Collect corresponing sub-meshes
- int nbEdgeNodes = 0, nbFaceNodes = 0;
- list<SMESHDS_SubMesh*> aEdgeSM, aFaceSM;
- // loop on SMESHDS_SubMesh'es
- for ( itSubM = aSubMeshes.begin(); itSubM != aSubMeshes.end() ; itSubM++ )
- {
- SMESHDS_SubMesh* aSubMesh = (*itSubM).second;
- if ( aSubMesh->IsComplexSubmesh() )
- continue; // submesh containing other submeshs
- int nbNodes = aSubMesh->NbNodes();
- if ( nbNodes == 0 ) continue;
-
- int aShapeID = (*itSubM).first;
- int aShapeType = mySMESHDSMesh->IndexToShape( aShapeID ).ShapeType();
- // write only SMDS_FacePosition and SMDS_EdgePosition
- switch ( aShapeType ) {
- case TopAbs_FACE:
- nbFaceNodes += nbNodes;
- aFaceSM.push_back( aSubMesh );
- break;
- case TopAbs_EDGE:
- nbEdgeNodes += nbNodes;
- aEdgeSM.push_back( aSubMesh );
- break;
- default:
- continue;
- }
- }
- // Treat positions on edges or faces
- for ( int onFace = 0; onFace < 2; onFace++ )
- {
- // Create arrays to store in datasets
- int iNode = 0, nbNodes = ( onFace ? nbFaceNodes : nbEdgeNodes );
- if (!nbNodes) continue;
- int* aNodeIDs = new int [ nbNodes ];
- double* aUPos = new double [ nbNodes ];
- double* aVPos = ( onFace ? new double[ nbNodes ] : 0 );
-
- // Fill arrays
- // loop on sub-meshes
- list<SMESHDS_SubMesh*> * pListSM = ( onFace ? &aFaceSM : &aEdgeSM );
- list<SMESHDS_SubMesh*>::iterator itSM = pListSM->begin();
- for ( ; itSM != pListSM->end(); itSM++ )
- {
- SMESHDS_SubMesh* aSubMesh = (*itSM);
-
- SMDS_NodeIteratorPtr itNode = aSubMesh->GetNodes();
- // loop on nodes in aSubMesh
- while ( itNode->more() )
- {
- //node ID
- const SMDS_MeshNode* node = itNode->next();
- aNodeIDs [ iNode ] = node->GetID();
-
- // Position
- const SMDS_PositionPtr pos = node->GetPosition();
- if ( onFace ) { // on FACE
- const SMDS_FacePosition* fPos =
- dynamic_cast<const SMDS_FacePosition*>( pos.get() );
- if ( fPos ) {
- aUPos[ iNode ] = fPos->GetUParameter();
- aVPos[ iNode ] = fPos->GetVParameter();
- iNode++;
- }
- else
- nbNodes--;
- }
- else { // on EDGE
- const SMDS_EdgePosition* ePos =
- dynamic_cast<const SMDS_EdgePosition*>( pos.get() );
- if ( ePos ) {
- aUPos[ iNode ] = ePos->GetUParameter();
- iNode++;
- }
- else
- nbNodes--;
- }
- } // loop on nodes in aSubMesh
- } // loop on sub-meshes
-
- // Write datasets
- if ( nbNodes )
- {
- aSize[ 0 ] = nbNodes;
- // IDS
- string aDSName( onFace ? "Nodes on Faces" : "Nodes on Edges");
- aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_INT32, aSize, 1 );
- aDataset->CreateOnDisk();
- aDataset->WriteOnDisk( aNodeIDs );
- aDataset->CloseOnDisk();
-
- // U Positions
- aDSName = ( onFace ? "Face U positions" : "Edge positions");
- aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_FLOAT64, aSize, 1);
- aDataset->CreateOnDisk();
- aDataset->WriteOnDisk( aUPos );
- aDataset->CloseOnDisk();
- // V Positions
- if ( onFace ) {
- aDataset = new HDFdataset( "Face V positions", aGroup, HDF_FLOAT64, aSize, 1);
- aDataset->CreateOnDisk();
- aDataset->WriteOnDisk( aVPos );
- aDataset->CloseOnDisk();
- }
- }
- delete [] aNodeIDs;
- delete [] aUPos;
- if ( aVPos ) delete [] aVPos;
-
- } // treat positions on edges or faces
-
- // close "Node Positions" group
- aGroup->CloseOnDisk();
-
- } // if ( there are submeshes in SMESHDS_Mesh )
- } // if ( hasData )
-
- // close mesh HDF group
- aTopGroup->CloseOnDisk();
- }
- }
+ // Find out nb of nodes on edges and faces
+ // Collect corresponing sub-meshes
+ int nbEdgeNodes = 0, nbFaceNodes = 0;
+ list<SMESHDS_SubMesh*> aEdgeSM, aFaceSM;
+ // loop on SMESHDS_SubMesh'es
+ for ( itSubM = aSubMeshes.begin(); itSubM != aSubMeshes.end() ; itSubM++ )
+ {
+ SMESHDS_SubMesh* aSubMesh = (*itSubM).second;
+ if ( aSubMesh->IsComplexSubmesh() )
+ continue; // submesh containing other submeshs
+ int nbNodes = aSubMesh->NbNodes();
+ if ( nbNodes == 0 ) continue;
+
+ int aShapeID = (*itSubM).first;
+ int aShapeType = mySMESHDSMesh->IndexToShape( aShapeID ).ShapeType();
+ // write only SMDS_FacePosition and SMDS_EdgePosition
+ switch ( aShapeType ) {
+ case TopAbs_FACE:
+ nbFaceNodes += nbNodes;
+ aFaceSM.push_back( aSubMesh );
+ break;
+ case TopAbs_EDGE:
+ nbEdgeNodes += nbNodes;
+ aEdgeSM.push_back( aSubMesh );
+ break;
+ default:
+ continue;
+ }
+ }
+ // Treat positions on edges or faces
+ for ( int onFace = 0; onFace < 2; onFace++ )
+ {
+ // Create arrays to store in datasets
+ int iNode = 0, nbNodes = ( onFace ? nbFaceNodes : nbEdgeNodes );
+ if (!nbNodes) continue;
+ int* aNodeIDs = new int [ nbNodes ];
+ double* aUPos = new double [ nbNodes ];
+ double* aVPos = ( onFace ? new double[ nbNodes ] : 0 );
+
+ // Fill arrays
+ // loop on sub-meshes
+ list<SMESHDS_SubMesh*> * pListSM = ( onFace ? &aFaceSM : &aEdgeSM );
+ list<SMESHDS_SubMesh*>::iterator itSM = pListSM->begin();
+ for ( ; itSM != pListSM->end(); itSM++ )
+ {
+ SMESHDS_SubMesh* aSubMesh = (*itSM);
+
+ SMDS_NodeIteratorPtr itNode = aSubMesh->GetNodes();
+ // loop on nodes in aSubMesh
+ while ( itNode->more() )
+ {
+ //node ID
+ const SMDS_MeshNode* node = itNode->next();
+ aNodeIDs [ iNode ] = node->GetID();
+
+ // Position
+ const SMDS_PositionPtr pos = node->GetPosition();
+ if ( onFace ) { // on FACE
+ const SMDS_FacePosition* fPos =
+ dynamic_cast<const SMDS_FacePosition*>( pos.get() );
+ if ( fPos ) {
+ aUPos[ iNode ] = fPos->GetUParameter();
+ aVPos[ iNode ] = fPos->GetVParameter();
+ iNode++;
+ }
+ else
+ nbNodes--;
+ }
+ else { // on EDGE
+ const SMDS_EdgePosition* ePos =
+ dynamic_cast<const SMDS_EdgePosition*>( pos.get() );
+ if ( ePos ) {
+ aUPos[ iNode ] = ePos->GetUParameter();
+ iNode++;
+ }
+ else
+ nbNodes--;
+ }
+ } // loop on nodes in aSubMesh
+ } // loop on sub-meshes
+
+ // Write datasets
+ if ( nbNodes )
+ {
+ aSize[ 0 ] = nbNodes;
+ // IDS
+ string aDSName( onFace ? "Nodes on Faces" : "Nodes on Edges");
+ aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_INT32, aSize, 1 );
+ aDataset->CreateOnDisk();
+ aDataset->WriteOnDisk( aNodeIDs );
+ aDataset->CloseOnDisk();
+
+ // U Positions
+ aDSName = ( onFace ? "Face U positions" : "Edge positions");
+ aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_FLOAT64, aSize, 1);
+ aDataset->CreateOnDisk();
+ aDataset->WriteOnDisk( aUPos );
+ aDataset->CloseOnDisk();
+ // V Positions
+ if ( onFace ) {
+ aDataset = new HDFdataset( "Face V positions", aGroup, HDF_FLOAT64, aSize, 1);
+ aDataset->CreateOnDisk();
+ aDataset->WriteOnDisk( aVPos );
+ aDataset->CloseOnDisk();
+ }
+ }
+ delete [] aNodeIDs;
+ delete [] aUPos;
+ if ( aVPos ) delete [] aVPos;
+
+ } // treat positions on edges or faces
+
+ // close "Node Positions" group
+ aGroup->CloseOnDisk();
+
+ } // if ( there are submeshes in SMESHDS_Mesh )
+ } // if ( hasData )
+
+ // close mesh HDF group
+ aTopGroup->CloseOnDisk();
+ }
+ }
}
}
}
//=============================================================================
SALOMEDS::TMPFile* SMESH_Gen_i::SaveASCII( SALOMEDS::SComponent_ptr theComponent,
- const char* theURL,
- bool isMultiFile ) {
+ const char* theURL,
+ bool isMultiFile ) {
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::SaveASCII" );
SALOMEDS::TMPFile_var aStreamFile = Save( theComponent, theURL, isMultiFile );
return aStreamFile._retn();
//=============================================================================
bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
- const SALOMEDS::TMPFile& theStream,
- const char* theURL,
- bool isMultiFile )
+ const SALOMEDS::TMPFile& theStream,
+ const char* theURL,
+ bool isMultiFile )
{
INFOS( "SMESH_Gen_i::Load" );
// Convert the stream into sequence of files to process
SALOMEDS::ListOfFileNames_var aFileSeq = SALOMEDS_Tool::PutStreamToFiles( theStream,
tmpDir.ToCString(),
- isMultiFile );
+ isMultiFile );
TCollection_AsciiString aStudyName( "" );
if ( isMultiFile )
aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ).c_str() );
// get number of hypotheses
int aNbObjects = aTopGroup->nInternalObjects();
for ( int j = 0; j < aNbObjects; j++ ) {
- // try to identify hypothesis
- char hypGrpName[ HDF_NAME_MAX_LEN+1 ];
+ // try to identify hypothesis
+ char hypGrpName[ HDF_NAME_MAX_LEN+1 ];
aTopGroup->InternalObjectIndentify( j, hypGrpName );
- if ( string( hypGrpName ).substr( 0, 10 ) == string( "Hypothesis" ) ) {
- // open hypothesis group
- aGroup = new HDFgroup( hypGrpName, aTopGroup );
- aGroup->OpenOnDisk();
-
- // --> get hypothesis id
- int id = atoi( string( hypGrpName ).substr( 10 ).c_str() );
- string hypname;
- string libname;
- string hypdata;
-
- // get number of datasets
- int aNbSubObjects = aGroup->nInternalObjects();
- for ( int k = 0; k < aNbSubObjects; k++ ) {
- // identify dataset
- char name_of_subgroup[ HDF_NAME_MAX_LEN+1 ];
- aGroup->InternalObjectIndentify( k, name_of_subgroup );
- // --> get hypothesis name
- if ( strcmp( name_of_subgroup, "Name" ) == 0 ) {
- aDataset = new HDFdataset( name_of_subgroup, aGroup );
- aDataset->OpenOnDisk();
- size = aDataset->GetSize();
- char* hypname_str = new char[ size ];
- aDataset->ReadFromDisk( hypname_str );
- hypname = string( hypname_str );
- delete [] hypname_str;
- aDataset->CloseOnDisk();
- }
- // --> get hypothesis plugin library name
- if ( strcmp( name_of_subgroup, "LibName" ) == 0 ) {
- aDataset = new HDFdataset( name_of_subgroup, aGroup );
- aDataset->OpenOnDisk();
- size = aDataset->GetSize();
- char* libname_str = new char[ size ];
- aDataset->ReadFromDisk( libname_str );
- if(MYDEBUG) SCRUTE( libname_str );
- libname = string( libname_str );
- delete [] libname_str;
- aDataset->CloseOnDisk();
- }
- // --> get hypothesis data
- if ( strcmp( name_of_subgroup, "Data" ) == 0 ) {
- aDataset = new HDFdataset( name_of_subgroup, aGroup );
- aDataset->OpenOnDisk();
- size = aDataset->GetSize();
- char* hypdata_str = new char[ size ];
- aDataset->ReadFromDisk( hypdata_str );
- hypdata = string( hypdata_str );
- delete [] hypdata_str;
- aDataset->CloseOnDisk();
- }
- }
- // close hypothesis HDF group
- aGroup->CloseOnDisk();
-
- // --> restore hypothesis from data
- if ( id > 0 && !hypname.empty()/* && !hypdata.empty()*/ ) { // VSR : persistent data can be empty
- if(MYDEBUG) MESSAGE("VSR - load hypothesis : id = " << id <<
+ if ( string( hypGrpName ).substr( 0, 10 ) == string( "Hypothesis" ) ) {
+ // open hypothesis group
+ aGroup = new HDFgroup( hypGrpName, aTopGroup );
+ aGroup->OpenOnDisk();
+
+ // --> get hypothesis id
+ int id = atoi( string( hypGrpName ).substr( 10 ).c_str() );
+ string hypname;
+ string libname;
+ string hypdata;
+
+ // get number of datasets
+ int aNbSubObjects = aGroup->nInternalObjects();
+ for ( int k = 0; k < aNbSubObjects; k++ ) {
+ // identify dataset
+ char name_of_subgroup[ HDF_NAME_MAX_LEN+1 ];
+ aGroup->InternalObjectIndentify( k, name_of_subgroup );
+ // --> get hypothesis name
+ if ( strcmp( name_of_subgroup, "Name" ) == 0 ) {
+ aDataset = new HDFdataset( name_of_subgroup, aGroup );
+ aDataset->OpenOnDisk();
+ size = aDataset->GetSize();
+ char* hypname_str = new char[ size ];
+ aDataset->ReadFromDisk( hypname_str );
+ hypname = string( hypname_str );
+ delete [] hypname_str;
+ aDataset->CloseOnDisk();
+ }
+ // --> get hypothesis plugin library name
+ if ( strcmp( name_of_subgroup, "LibName" ) == 0 ) {
+ aDataset = new HDFdataset( name_of_subgroup, aGroup );
+ aDataset->OpenOnDisk();
+ size = aDataset->GetSize();
+ char* libname_str = new char[ size ];
+ aDataset->ReadFromDisk( libname_str );
+ if(MYDEBUG) SCRUTE( libname_str );
+ libname = string( libname_str );
+ delete [] libname_str;
+ aDataset->CloseOnDisk();
+ }
+ // --> get hypothesis data
+ if ( strcmp( name_of_subgroup, "Data" ) == 0 ) {
+ aDataset = new HDFdataset( name_of_subgroup, aGroup );
+ aDataset->OpenOnDisk();
+ size = aDataset->GetSize();
+ char* hypdata_str = new char[ size ];
+ aDataset->ReadFromDisk( hypdata_str );
+ hypdata = string( hypdata_str );
+ delete [] hypdata_str;
+ aDataset->CloseOnDisk();
+ }
+ }
+ // close hypothesis HDF group
+ aGroup->CloseOnDisk();
+
+ // --> restore hypothesis from data
+ if ( id > 0 && !hypname.empty()/* && !hypdata.empty()*/ ) { // VSR : persistent data can be empty
+ if(MYDEBUG) MESSAGE("VSR - load hypothesis : id = " << id <<
", name = " << hypname.c_str() << ", persistent string = " << hypdata.c_str());
SMESH::SMESH_Hypothesis_var myHyp;
- try { // protect persistence mechanism against exceptions
- myHyp = this->createHypothesis( hypname.c_str(), libname.c_str() );
- }
- catch (...) {
- INFOS( "Exception during hypothesis creation" );
- }
+ try { // protect persistence mechanism against exceptions
+ myHyp = this->createHypothesis( hypname.c_str(), libname.c_str() );
+ }
+ catch (...) {
+ INFOS( "Exception during hypothesis creation" );
+ }
- SMESH_Hypothesis_i* myImpl = dynamic_cast<SMESH_Hypothesis_i*>( GetServant( myHyp ).in() );
- if ( myImpl ) {
- // myImpl->LoadFrom( hypdata.c_str() );
+ SMESH_Hypothesis_i* myImpl = dynamic_cast<SMESH_Hypothesis_i*>( GetServant( myHyp ).in() );
+ if ( myImpl ) {
+ // myImpl->LoadFrom( hypdata.c_str() );
hypDataList.push_back( make_pair( myImpl, hypdata ));
- string iorString = GetORB()->object_to_string( myHyp );
- int newId = myStudyContext->findId( iorString );
- myStudyContext->mapOldToNew( id, newId );
- }
- else
- if(MYDEBUG) MESSAGE( "VSR - SMESH_Gen::Load - can't get servant" );
+ string iorString = GetORB()->object_to_string( myHyp );
+ int newId = myStudyContext->findId( iorString );
+ myStudyContext->mapOldToNew( id, newId );
+ }
+ else
+ if(MYDEBUG) MESSAGE( "VSR - SMESH_Gen::Load - can't get servant" );
}
}
}
// get number of algorithms
int aNbObjects = aTopGroup->nInternalObjects();
for ( int j = 0; j < aNbObjects; j++ ) {
- // try to identify algorithm
- char hypGrpName[ HDF_NAME_MAX_LEN+1 ];
+ // try to identify algorithm
+ char hypGrpName[ HDF_NAME_MAX_LEN+1 ];
aTopGroup->InternalObjectIndentify( j, hypGrpName );
- if ( string( hypGrpName ).substr( 0, 9 ) == string( "Algorithm" ) ) {
- // open algorithm group
- aGroup = new HDFgroup( hypGrpName, aTopGroup );
- aGroup->OpenOnDisk();
-
- // --> get algorithm id
- int id = atoi( string( hypGrpName ).substr( 9 ).c_str() );
- string hypname;
- string libname;
- string hypdata;
-
- // get number of datasets
- int aNbSubObjects = aGroup->nInternalObjects();
- for ( int k = 0; k < aNbSubObjects; k++ ) {
- // identify dataset
- char name_of_subgroup[ HDF_NAME_MAX_LEN+1 ];
- aGroup->InternalObjectIndentify( k, name_of_subgroup );
- // --> get algorithm name
- if ( strcmp( name_of_subgroup, "Name" ) == 0 ) {
- aDataset = new HDFdataset( name_of_subgroup, aGroup );
- aDataset->OpenOnDisk();
- size = aDataset->GetSize();
- char* hypname_str = new char[ size ];
- aDataset->ReadFromDisk( hypname_str );
- hypname = string( hypname_str );
- delete [] hypname_str;
- aDataset->CloseOnDisk();
- }
- // --> get algorithm plugin library name
- if ( strcmp( name_of_subgroup, "LibName" ) == 0 ) {
- aDataset = new HDFdataset( name_of_subgroup, aGroup );
- aDataset->OpenOnDisk();
- size = aDataset->GetSize();
- char* libname_str = new char[ size ];
- aDataset->ReadFromDisk( libname_str );
- if(MYDEBUG) SCRUTE( libname_str );
- libname = string( libname_str );
- delete [] libname_str;
- aDataset->CloseOnDisk();
- }
- // --> get algorithm data
- if ( strcmp( name_of_subgroup, "Data" ) == 0 ) {
- aDataset = new HDFdataset( name_of_subgroup, aGroup );
- aDataset->OpenOnDisk();
- size = aDataset->GetSize();
- char* hypdata_str = new char[ size ];
- aDataset->ReadFromDisk( hypdata_str );
- if(MYDEBUG) SCRUTE( hypdata_str );
- hypdata = string( hypdata_str );
- delete [] hypdata_str;
- aDataset->CloseOnDisk();
- }
- }
- // close algorithm HDF group
- aGroup->CloseOnDisk();
-
- // --> restore algorithm from data
- if ( id > 0 && !hypname.empty()/* && !hypdata.empty()*/ ) { // VSR : persistent data can be empty
- if(MYDEBUG) MESSAGE("VSR - load algo : id = " << id <<
+ if ( string( hypGrpName ).substr( 0, 9 ) == string( "Algorithm" ) ) {
+ // open algorithm group
+ aGroup = new HDFgroup( hypGrpName, aTopGroup );
+ aGroup->OpenOnDisk();
+
+ // --> get algorithm id
+ int id = atoi( string( hypGrpName ).substr( 9 ).c_str() );
+ string hypname;
+ string libname;
+ string hypdata;
+
+ // get number of datasets
+ int aNbSubObjects = aGroup->nInternalObjects();
+ for ( int k = 0; k < aNbSubObjects; k++ ) {
+ // identify dataset
+ char name_of_subgroup[ HDF_NAME_MAX_LEN+1 ];
+ aGroup->InternalObjectIndentify( k, name_of_subgroup );
+ // --> get algorithm name
+ if ( strcmp( name_of_subgroup, "Name" ) == 0 ) {
+ aDataset = new HDFdataset( name_of_subgroup, aGroup );
+ aDataset->OpenOnDisk();
+ size = aDataset->GetSize();
+ char* hypname_str = new char[ size ];
+ aDataset->ReadFromDisk( hypname_str );
+ hypname = string( hypname_str );
+ delete [] hypname_str;
+ aDataset->CloseOnDisk();
+ }
+ // --> get algorithm plugin library name
+ if ( strcmp( name_of_subgroup, "LibName" ) == 0 ) {
+ aDataset = new HDFdataset( name_of_subgroup, aGroup );
+ aDataset->OpenOnDisk();
+ size = aDataset->GetSize();
+ char* libname_str = new char[ size ];
+ aDataset->ReadFromDisk( libname_str );
+ if(MYDEBUG) SCRUTE( libname_str );
+ libname = string( libname_str );
+ delete [] libname_str;
+ aDataset->CloseOnDisk();
+ }
+ // --> get algorithm data
+ if ( strcmp( name_of_subgroup, "Data" ) == 0 ) {
+ aDataset = new HDFdataset( name_of_subgroup, aGroup );
+ aDataset->OpenOnDisk();
+ size = aDataset->GetSize();
+ char* hypdata_str = new char[ size ];
+ aDataset->ReadFromDisk( hypdata_str );
+ if(MYDEBUG) SCRUTE( hypdata_str );
+ hypdata = string( hypdata_str );
+ delete [] hypdata_str;
+ aDataset->CloseOnDisk();
+ }
+ }
+ // close algorithm HDF group
+ aGroup->CloseOnDisk();
+
+ // --> restore algorithm from data
+ if ( id > 0 && !hypname.empty()/* && !hypdata.empty()*/ ) { // VSR : persistent data can be empty
+ if(MYDEBUG) MESSAGE("VSR - load algo : id = " << id <<
", name = " << hypname.c_str() << ", persistent string = " << hypdata.c_str());
SMESH::SMESH_Hypothesis_var myHyp;
- try { // protect persistence mechanism against exceptions
- myHyp = this->createHypothesis( hypname.c_str(), libname.c_str() );
- }
- catch (...) {
- INFOS( "Exception during hypothesis creation" );
- }
+ try { // protect persistence mechanism against exceptions
+ myHyp = this->createHypothesis( hypname.c_str(), libname.c_str() );
+ }
+ catch (...) {
+ INFOS( "Exception during hypothesis creation" );
+ }
- SMESH_Hypothesis_i* myImpl = dynamic_cast<SMESH_Hypothesis_i*>( GetServant( myHyp ).in() );
- if ( myImpl ) {
- //myImpl->LoadFrom( hypdata.c_str() );
+ SMESH_Hypothesis_i* myImpl = dynamic_cast<SMESH_Hypothesis_i*>( GetServant( myHyp ).in() );
+ if ( myImpl ) {
+ //myImpl->LoadFrom( hypdata.c_str() );
hypDataList.push_back( make_pair( myImpl, hypdata ));
- string iorString = GetORB()->object_to_string( myHyp );
- int newId = myStudyContext->findId( iorString );
- myStudyContext->mapOldToNew( id, newId );
- }
- else
- if(MYDEBUG) MESSAGE( "VSR - SMESH_Gen::Load - can't get servant" );
+ string iorString = GetORB()->object_to_string( myHyp );
+ int newId = myStudyContext->findId( iorString );
+ myStudyContext->mapOldToNew( id, newId );
+ }
+ else
+ if(MYDEBUG) MESSAGE( "VSR - SMESH_Gen::Load - can't get servant" );
}
}
}
aFile->InternalObjectIndentify( i, meshName );
if ( string( meshName ).substr( 0, 4 ) == string( "Mesh" ) ) {
- // --> get mesh id
- int id = atoi( string( meshName ).substr( 4 ).c_str() );
- if ( id <= 0 )
- continue;
-
- // open mesh HDF group
- aTopGroup = new HDFgroup( meshName, aFile );
- aTopGroup->OpenOnDisk();
-
- // get number of child HDF objects
- int aNbObjects = aTopGroup->nInternalObjects();
- if ( aNbObjects > 0 ) {
- // create mesh
- if(MYDEBUG) MESSAGE( "VSR - load mesh : id = " << id );
- SMESH::SMESH_Mesh_var myNewMesh = this->createMesh();
- SMESH_Mesh_i* myNewMeshImpl = dynamic_cast<SMESH_Mesh_i*>( GetServant( myNewMesh ).in() );
+ // --> get mesh id
+ int id = atoi( string( meshName ).substr( 4 ).c_str() );
+ if ( id <= 0 )
+ continue;
+
+ // open mesh HDF group
+ aTopGroup = new HDFgroup( meshName, aFile );
+ aTopGroup->OpenOnDisk();
+
+ // get number of child HDF objects
+ int aNbObjects = aTopGroup->nInternalObjects();
+ if ( aNbObjects > 0 ) {
+ // create mesh
+ if(MYDEBUG) MESSAGE( "VSR - load mesh : id = " << id );
+ SMESH::SMESH_Mesh_var myNewMesh = this->createMesh();
+ SMESH_Mesh_i* myNewMeshImpl = dynamic_cast<SMESH_Mesh_i*>( GetServant( myNewMesh ).in() );
if ( !myNewMeshImpl )
- continue;
+ continue;
meshGroupList.push_back( make_pair( myNewMeshImpl, aTopGroup ));
- string iorString = GetORB()->object_to_string( myNewMesh );
- int newId = myStudyContext->findId( iorString );
- myStudyContext->mapOldToNew( id, newId );
-
- // ouv : NPAL12872
- // try to read and set auto color flag
- char aMeshAutoColorName[ 30 ];
- sprintf( aMeshAutoColorName, "AutoColorMesh %d", id);
- if( aTopGroup->ExistInternalObject( aMeshAutoColorName ) )
- {
- aDataset = new HDFdataset( aMeshAutoColorName, aTopGroup );
- aDataset->OpenOnDisk();
- size = aDataset->GetSize();
- int* anAutoColor = new int[ size ];
- aDataset->ReadFromDisk( anAutoColor );
- aDataset->CloseOnDisk();
- myNewMeshImpl->SetAutoColor( (bool)anAutoColor[0] );
- }
+ string iorString = GetORB()->object_to_string( myNewMesh );
+ int newId = myStudyContext->findId( iorString );
+ myStudyContext->mapOldToNew( id, newId );
+
+ // ouv : NPAL12872
+ // try to read and set auto color flag
+ char aMeshAutoColorName[ 30 ];
+ sprintf( aMeshAutoColorName, "AutoColorMesh %d", id);
+ if( aTopGroup->ExistInternalObject( aMeshAutoColorName ) )
+ {
+ aDataset = new HDFdataset( aMeshAutoColorName, aTopGroup );
+ aDataset->OpenOnDisk();
+ size = aDataset->GetSize();
+ int* anAutoColor = new int[ size ];
+ aDataset->ReadFromDisk( anAutoColor );
+ aDataset->CloseOnDisk();
+ myNewMeshImpl->SetAutoColor( (bool)anAutoColor[0] );
+ }
// try to read and set reference to shape
GEOM::GEOM_Object_var aShapeObject;
SMESHDS_GroupBase* aGroupBaseDS = aLocalGroup->GetGroupDS();
aGroupBaseDS->SetStoreName( name_dataset );
- // ouv : NPAL12872
- // Read color of the group
+ // ouv : NPAL12872
+ // Read color of the group
char aGroupColorName[ 30 ];
sprintf( aGroupColorName, "ColorGroup %d", subid);
if ( aGroup->ExistInternalObject( aGroupColorName ) )
- {
- aDataset = new HDFdataset( aGroupColorName, aGroup );
- aDataset->OpenOnDisk();
- size = aDataset->GetSize();
- double* anRGB = new double[ size ];
- aDataset->ReadFromDisk( anRGB );
- aDataset->CloseOnDisk();
- Quantity_Color aColor( anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB );
- aGroupBaseDS->SetColor( aColor );
- }
+ {
+ aDataset = new HDFdataset( aGroupColorName, aGroup );
+ aDataset->OpenOnDisk();
+ size = aDataset->GetSize();
+ double* anRGB = new double[ size ];
+ aDataset->ReadFromDisk( anRGB );
+ aDataset->CloseOnDisk();
+ Quantity_Color aColor( anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB );
+ aGroupBaseDS->SetColor( aColor );
+ }
// Fill group with contents from MED file
SMESHDS_Group* aGrp = dynamic_cast<SMESHDS_Group*>( aGroupBaseDS );
//=============================================================================
bool SMESH_Gen_i::LoadASCII( SALOMEDS::SComponent_ptr theComponent,
- const SALOMEDS::TMPFile& theStream,
- const char* theURL,
- bool isMultiFile ) {
+ const SALOMEDS::TMPFile& theStream,
+ const char* theURL,
+ bool isMultiFile ) {
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::LoadASCII" );
return Load( theComponent, theStream, theURL, isMultiFile );
// context->myDocument = 0;
// }
+ myCurrentStudy = SALOMEDS::Study::_nil();
return;
}
//=============================================================================
char* SMESH_Gen_i::IORToLocalPersistentID( SALOMEDS::SObject_ptr /*theSObject*/,
- const char* IORString,
- CORBA::Boolean /*isMultiFile*/,
- CORBA::Boolean /*isASCII*/ )
+ const char* IORString,
+ CORBA::Boolean /*isMultiFile*/,
+ CORBA::Boolean /*isASCII*/ )
{
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::IORToLocalPersistentID" );
StudyContext* myStudyContext = GetCurrentStudyContext();
//=============================================================================
char* SMESH_Gen_i::LocalPersistentIDToIOR( SALOMEDS::SObject_ptr /*theSObject*/,
- const char* aLocalPersistentID,
- CORBA::Boolean /*isMultiFile*/,
- CORBA::Boolean /*isASCII*/ )
+ const char* aLocalPersistentID,
+ CORBA::Boolean /*isMultiFile*/,
+ CORBA::Boolean /*isASCII*/ )
{
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::LocalPersistentIDToIOR(): id = " << aLocalPersistentID );
StudyContext* myStudyContext = GetCurrentStudyContext();
}
}
+int SMESH_Gen_i::GetCurrentStudyID()
+{
+ return myCurrentStudy->_is_nil() || myCurrentStudy->_non_existent() ? -1 : myCurrentStudy->StudyId();
+}
+
//=============================================================================
/*!
* SMESHEngine_factory
extern "C"
{ SMESH_I_EXPORT
PortableServer::ObjectId* SMESHEngine_factory( CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId* contId,
- const char* instanceName,
- const char* interfaceName )
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId* contId,
+ const char* instanceName,
+ const char* interfaceName )
{
if(MYDEBUG) MESSAGE( "PortableServer::ObjectId* SMESHEngine_factory()" );
if(MYDEBUG) SCRUTE(interfaceName);
// *****************************************
// Set a new Mesh object name
void SetName(const char* theIOR,
- const char* theName);
+ const char* theName);
//GEOM::GEOM_Gen_ptr SetGeomEngine( const char* containerLoc );
void SetGeomEngine( GEOM::GEOM_Gen_ptr geomcompo );
* Return mesh preview structure
*/
SMESH::MeshPreviewStruct* Precompute( SMESH::SMESH_Mesh_ptr theMesh,
- GEOM::GEOM_Object_ptr theSubObject,
- SMESH::Dimension theDimension,
- SMESH::long_array& theShapesId )
+ GEOM::GEOM_Object_ptr theSubObject,
+ SMESH::Dimension theDimension,
+ SMESH::long_array& theShapesId )
throw ( SALOME::SALOME_Exception );
// Returns errors of hypotheses definintion
// Return geometrical object the given element is built on. Don't publish it in study.
GEOM::GEOM_Object_ptr FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
- CORBA::Long theElementID)
+ CORBA::Long theElementID)
throw ( SALOME::SALOME_Exception );
// Concatenate the given meshes into one mesh
SMESH::SMESH_Mesh_ptr ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
- CORBA::Boolean theUniteIdenticalGroups,
- CORBA::Boolean theMergeNodesAndElements,
- CORBA::Double theMergeTolerance,
- CORBA::Boolean theCommonGroups)
+ CORBA::Boolean theUniteIdenticalGroups,
+ CORBA::Boolean theMergeNodesAndElements,
+ CORBA::Double theMergeTolerance,
+ CORBA::Boolean theCommonGroups)
throw ( SALOME::SALOME_Exception );
// Concatenate the given meshes into one mesh
SMESH::SMESH_Mesh_ptr Concatenate(const SMESH::mesh_array& theMeshesArray,
- CORBA::Boolean theUniteIdenticalGroups,
- CORBA::Boolean theMergeNodesAndElements,
- CORBA::Double theMergeTolerance)
+ CORBA::Boolean theUniteIdenticalGroups,
+ CORBA::Boolean theMergeNodesAndElements,
+ CORBA::Double theMergeTolerance)
throw ( SALOME::SALOME_Exception );
// Concatenate the given meshes into one mesh
// Create the groups of all elements from initial meshes
SMESH::SMESH_Mesh_ptr ConcatenateWithGroups(const SMESH::mesh_array& theMeshesArray,
- CORBA::Boolean theUniteIdenticalGroups,
- CORBA::Boolean theMergeNodesAndElements,
- CORBA::Double theMergeTolerance)
+ CORBA::Boolean theUniteIdenticalGroups,
+ CORBA::Boolean theMergeNodesAndElements,
+ CORBA::Double theMergeTolerance)
throw ( SALOME::SALOME_Exception );
// ****************************************************
// Save SMESH data
SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent,
- const char* theURL,
- bool isMultiFile );
+ const char* theURL,
+ bool isMultiFile );
// Load SMESH data
bool Load( SALOMEDS::SComponent_ptr theComponent,
- const SALOMEDS::TMPFile& theStream,
- const char* theURL,
- bool isMultiFile );
+ const SALOMEDS::TMPFile& theStream,
+ const char* theURL,
+ bool isMultiFile );
// Save SMESH data in ASCII format
SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr theComponent,
- const char* theURL,
- bool isMultiFile );
+ const char* theURL,
+ bool isMultiFile );
// Load SMESH data in ASCII format
bool LoadASCII( SALOMEDS::SComponent_ptr theComponent,
- const SALOMEDS::TMPFile& theStream,
- const char* theURL,
- bool isMultiFile );
+ const SALOMEDS::TMPFile& theStream,
+ const char* theURL,
+ bool isMultiFile );
// Create filter manager
SMESH::FilterManager_ptr CreateFilterManager();
// Transform data from transient form to persistent
char* IORToLocalPersistentID( SALOMEDS::SObject_ptr theSObject,
- const char* IORString,
- CORBA::Boolean isMultiFile,
- CORBA::Boolean isASCII );
+ const char* IORString,
+ CORBA::Boolean isMultiFile,
+ CORBA::Boolean isASCII );
// Transform data from persistent form to transient
char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr theSObject,
- const char* aLocalPersistentID,
- CORBA::Boolean isMultiFile,
- CORBA::Boolean isASCII );
+ const char* aLocalPersistentID,
+ CORBA::Boolean isMultiFile,
+ CORBA::Boolean isASCII );
// Returns true if object can be published in the study
bool CanPublishInStudy( CORBA::Object_ptr theIOR );
// Publish object in the study
SALOMEDS::SObject_ptr PublishInStudy( SALOMEDS::Study_ptr theStudy,
- SALOMEDS::SObject_ptr theSObject,
- CORBA::Object_ptr theObject,
- const char* theName )
+ SALOMEDS::SObject_ptr theSObject,
+ CORBA::Object_ptr theObject,
+ const char* theName )
throw ( SALOME::SALOME_Exception );
// Copy-paste methods - returns true if object can be copied to the clipboard
CORBA::Boolean CanPaste( const char* theComponentName, CORBA::Long theObjectID ) { return false; }
// Copy-paste methods - paste object from the clipboard
SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile& theStream,
- CORBA::Long theObjectID,
- SALOMEDS::SObject_ptr theObject ) {
+ CORBA::Long theObjectID,
+ SALOMEDS::SObject_ptr theObject ) {
SALOMEDS::SObject_var aResultSO;
return aResultSO._retn();
}
// ============
virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
- CORBA::Boolean isPublished,
- CORBA::Boolean& isValidScript);
+ CORBA::Boolean isPublished,
+ CORBA::Boolean& isValidScript);
void AddToPythonScript (int theStudyID, const TCollection_AsciiString& theString);
SMESH::SMESH_Mesh_ptr theMesh,
SMESH::SMESH_subMesh_ptr theSubMesh,
GEOM::GEOM_Object_ptr theShapeObject,
- const char* theName = 0);
+ const char* theName = 0);
SALOMEDS::SObject_ptr PublishGroup (SALOMEDS::Study_ptr theStudy,
SMESH::SMESH_Mesh_ptr theMesh,
SMESH::SMESH_GroupBase_ptr theGroup,
}
// Get current study ID
- int GetCurrentStudyID()
- { return myCurrentStudy->_is_nil() ? -1 : myCurrentStudy->StudyId(); }
+ int GetCurrentStudyID();
/*!
* \brief Find SObject for an algo
GEOM_Client* aClient = GetShapeReader();
TCollection_AsciiString IOR;
if ( aClient && aClient->Find( theShape, IOR ))
- aShapeObj = GEOM::GEOM_Object::_narrow
- ( GetORB()->string_to_object( IOR.ToCString() ) );
+ {
+ CORBA::Object_var obj = GetORB()->string_to_object( IOR.ToCString() );
+ aShapeObj = GEOM::GEOM_Object::_narrow ( obj );
+ }
}
return aShapeObj._retn();
}
}
if ( thePixMap ) {
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" );
- SALOMEDS::AttributePixMap::_narrow( anAttr )->SetPixMap( thePixMap );
+ SALOMEDS::AttributePixMap_var pm = SALOMEDS::AttributePixMap::_narrow( anAttr );
+ pm->SetPixMap( thePixMap );
}
if ( !theSelectable ) {
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeSelectable" );
//=============================================================================
SALOMEDS::SObject_ptr SMESH_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
- SALOMEDS::SObject_ptr theSObject,
- CORBA::Object_ptr theIOR,
- const char* theName)
+ SALOMEDS::SObject_ptr theSObject,
+ CORBA::Object_ptr theIOR,
+ const char* theName)
throw (SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
if ( !aStudy->_is_nil() ) {
SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( theSObject );
for ( ; anIter->More(); anIter->Next() ) {
- long nTag = anIter->Value()->Tag();
- if ( nTag > aTag )
- aTag = nTag;
+ long nTag = anIter->Value()->Tag();
+ if ( nTag > aTag )
+ aTag = nTag;
}
}
}
// Publish global hypotheses
- SMESH::ListOfHypothesis * hypList = theMesh->GetHypothesisList( aShapeObject );
- if ( hypList )
- for ( int i = 0; i < hypList->length(); i++ ) {
- SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( (*hypList)[ i ]);
- PublishHypothesis( theStudy, aHyp );
- AddHypothesisToShape( theStudy, theMesh, aShapeObject, aHyp );
- }
+ SMESH::ListOfHypothesis_var hypList = theMesh->GetHypothesisList( aShapeObject );
+ for ( int i = 0; i < hypList->length(); i++ ) {
+ SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( hypList[ i ]);
+ PublishHypothesis( theStudy, aHyp );
+ AddHypothesisToShape( theStudy, theMesh, aShapeObject, aHyp );
+ }
}
// Publish submeshes
SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject);
if(aSObj->_is_nil())
return;
-
+
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-
+
SALOMEDS::GenericAttribute_var aFindAttr;
bool hasAttr = aSObj->FindAttribute(aFindAttr, "AttributeString");
if(VARIABLE_DEBUG)
anAttr = aStudyBuilder->FindOrCreateAttribute( aSObj, "AttributeString");
SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr);
+ CORBA::String_var oldparVar = aStringAttr->Value();
+ CORBA::String_var inpparVar = ParseParameters(theParameters);
TCollection_AsciiString aNewParams;
- TCollection_AsciiString aOldParameters(aStringAttr->Value());
- TCollection_AsciiString anInputParams(ParseParameters(theParameters));
-
+ TCollection_AsciiString aOldParameters(oldparVar.inout());
+ TCollection_AsciiString anInputParams(inpparVar.inout());
if(!hasAttr)
aNewParams = anInputParams;
else
aNewParams = aOldParameters+"|"+anInputParams;
if(VARIABLE_DEBUG)
- {
- cout<<"Input Parameters : "<<anInputParams<<endl;
- cout<<"Old Parameters : "<<aOldParameters<<endl;
- cout<<"New Parameters : "<<aNewParams<<endl;
- }
-
-
+ {
+ cout<<"Input Parameters : "<<anInputParams<<endl;
+ cout<<"Old Parameters : "<<aOldParameters<<endl;
+ cout<<"New Parameters : "<<aNewParams<<endl;
+ }
+
aStringAttr->SetValue( aNewParams.ToCString() );
}
//=======================================================================
char* SMESH_Gen_i::ParseParameters(const char* theParameters)
{
- const char* aParameters = CORBA::string_dup(theParameters);
+ //const char* aParameters = theParameters;
+// const char* aParameters = CORBA::string_dup(theParameters);
TCollection_AsciiString anInputParams;
- SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
+ SALOMEDS::Study_var aStudy = GetCurrentStudy();
if( !aStudy->_is_nil() ) {
- SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
- for(int j=0;j<aSections->length();j++) {
- SALOMEDS::ListOfStrings aVars= aSections[j];
- for(int i=0;i<aVars.length();i++ ) {
- anInputParams += aStudy->IsVariable(aVars[i].in()) ?
- TCollection_AsciiString(aVars[i].in()) : TCollection_AsciiString("");
- if(i != aVars.length()-1)
- anInputParams+=":";
+// SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(theParameters);
+// for(int j=0;j<aSections->length();j++) {
+// SALOMEDS::ListOfStrings aVars= aSections[j];
+// for(int i=0;i<aVars.length();i++ ) {
+// anInputParams += aStudy->IsVariable(aVars[i].in()) ?
+// TCollection_AsciiString(aVars[i].in()) : TCollection_AsciiString("");
+// if(i != aVars.length()-1)
+// anInputParams+=":";
+// }
+// if(j!=aSections->length()-1)
+// anInputParams+="|";
+// }
+ TCollection_AsciiString paramStr( theParameters );
+ static TCollection_AsciiString separators(":|");
+ int beg = 0, end;
+ char sep, *pParams = (char*)paramStr.ToCString();
+ while ( beg < paramStr.Length() )
+ {
+ end = beg-1;
+ while ( ++end < paramStr.Length() )
+ if ( pParams[end] == ':' || pParams[end] == '|')
+ break;
+ if ( end < paramStr.Length())
+ {
+ sep = pParams[end];
+ pParams[end] = '\0';
}
- if(j!=aSections->length()-1)
- anInputParams+="|";
+ if ( aStudy->IsVariable( pParams+beg ))
+ anInputParams += pParams+beg;
+ if ( end < paramStr.Length() )
+ anInputParams += sep;
+ else
+ break;
+ beg = end + 1;
}
}
return CORBA::string_dup(anInputParams.ToCString());
CORBA::Long
ChangeByPredicate( SMESH::Predicate_i* thePredicate,
- SMESHDS_GroupBase* theGroupBase,
- TFunChangeGroup theFun)
+ SMESHDS_GroupBase* theGroupBase,
+ TFunChangeGroup theFun)
{
CORBA::Long aNb = 0;
if(SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>(theGroupBase)){
CORBA::Long i = 0, iEnd = aSequence.size();
for(; i < iEnd; i++)
if((aGroupDS->*theFun)(aSequence[i]))
- aNb++;
+ aNb++;
return aNb;
}
return aNb;
*/
//=============================================================================
SMESH_MEDFamily_i::SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm,
- string name, string description, SALOME_MED::medEntityMesh entity):
+ string name, string description, SALOME_MED::medEntityMesh entity):
SMESH_MEDSupport_i( sm, name, description, entity ),
_subMesh_i(sm),
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
+ SALOME::INTERNAL_ERROR);
return _identifier;
}
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
+ SALOME::INTERNAL_ERROR);
return _numberOfAttribute;
}
//=============================================================================
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
+ SALOME::INTERNAL_ERROR);
if (_numberOfAttribute == 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
- ,SALOME::BAD_PARAM);
+ ,SALOME::BAD_PARAM);
};
SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
+ SALOME::INTERNAL_ERROR);
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
- ,SALOME::BAD_PARAM);
+ ,SALOME::BAD_PARAM);
if (_numberOfAttribute == 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
- ,SALOME::BAD_PARAM);
+ ,SALOME::BAD_PARAM);
};
ASSERT (i <= _numberOfAttribute);
return _attributeIdentifier[i];
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
+ SALOME::INTERNAL_ERROR);
if (_numberOfAttribute == 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
- ,SALOME::BAD_PARAM);
+ ,SALOME::BAD_PARAM);
};
SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
+ SALOME::INTERNAL_ERROR);
if (_numberOfAttribute == 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
- ,SALOME::BAD_PARAM);
+ ,SALOME::BAD_PARAM);
}
ASSERT (i <= _numberOfAttribute);
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
+ SALOME::INTERNAL_ERROR);
if (_numberOfAttribute == 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
- ,SALOME::BAD_PARAM);
+ ,SALOME::BAD_PARAM);
}
SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
for (int i=0;i<_numberOfAttribute;i++)
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
+ SALOME::INTERNAL_ERROR);
if (_numberOfAttribute == 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
- ,SALOME::BAD_PARAM);
+ ,SALOME::BAD_PARAM);
}
ASSERT (i <= _numberOfAttribute);
return CORBA::string_dup(_attributeDescription[i].c_str());
// Constructors and associated internal methods
SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm,
- std::string name, std::string description, SALOME_MED::medEntityMesh entity );
+ std::string name, std::string description, SALOME_MED::medEntityMesh entity );
SMESH_MEDFamily_i(const SMESH_MEDFamily_i & f);
// IDL Methods
// Module : SMESH
//
#include "SMESH_MEDMesh_i.hxx"
+#include "SMESH_Gen_i.hxx"
#include "SMESH_Mesh_i.hxx"
#include "SMESHDS_Mesh.hxx"
// PN Est-ce un const ?
SMESH_MEDMesh_i::SMESH_MEDMesh_i()
{
- BEGIN_OF("Default Constructor SMESH_MEDMesh_i");
- END_OF("Default Constructor SMESH_MEDMesh_i");
+ BEGIN_OF("Default Constructor SMESH_MEDMesh_i");
+ END_OF("Default Constructor SMESH_MEDMesh_i");
}
//=============================================================================
*/
//=============================================================================
SMESH_MEDMesh_i::SMESH_MEDMesh_i(::SMESH_Mesh_i * m_i):_meshId(""),
- _compte(false),
- _creeFamily(false),
- _famIdent(0),
- _indexElts(0),
- _indexEnts(0)
+ _compte(false),
+ _creeFamily(false),
+ _famIdent(0),
+ _indexElts(0),
+ _indexEnts(0)
{
- BEGIN_OF("Constructor SMESH_MEDMesh_i");
+ BEGIN_OF("Constructor SMESH_MEDMesh_i");
- _mesh_i = m_i;
- _meshDS = _mesh_i->GetImpl().GetMeshDS();
+ _mesh_i = m_i;
+ _meshDS = _mesh_i->GetImpl().GetMeshDS();
- END_OF("Constructor SMESH_MEDMesh_i");
+ END_OF("Constructor SMESH_MEDMesh_i");
}
//=============================================================================
//=============================================================================
char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception)
{
- if (_meshDS == NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
-
- try
- {
- // A COMPLETER PAR LE NOM DU MAILLAGE
- //return CORBA::string_dup(_mesh_i->getName().c_str());
- return CORBA::string_dup("toto");
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au nom");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
- SALOME::INTERNAL_ERROR);
- }
+ if (_meshDS == NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+
+ try
+ {
+ SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen();
+ 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");
+
+ CORBA::String_var name = meshSO->GetName();
+ return CORBA::string_dup( name.in() );
+ }
+ catch(...)
+ {
+ MESSAGE("Exception en accedant au nom");
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
+ SALOME::INTERNAL_ERROR);
+ }
+ return 0;
}
//=============================================================================
//=============================================================================
CORBA::Long SMESH_MEDMesh_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
{
- MESSAGE("Non Implemente");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ MESSAGE("Non Implemente");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
}
//=============================================================================
//=============================================================================
CORBA::Long SMESH_MEDMesh_i::getSpaceDimension()throw(SALOME::SALOME_Exception)
{
- // PN : Il semblerait que la dimension soit fixee a 3
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- return 3;
+ // PN : Il semblerait que la dimension soit fixee a 3
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ return 3;
}
//=============================================================================
//=============================================================================
CORBA::Long SMESH_MEDMesh_i::getMeshDimension()throw(SALOME::SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- // PN : Il semblerait que la dimension soit fixee a 3
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- return 3;
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ // PN : Il semblerait que la dimension soit fixee a 3
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ return 3;
}
//=============================================================================
/*!
//=============================================================================
CORBA::Boolean
SMESH_MEDMesh_i::existConnectivity(SALOME_MED::medConnectivity connectivityType,
- SALOME_MED::medEntityMesh entity)
+ SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception)
{
MESSAGE("!!!!!! IMPLEMENTED BUT ONLY PARTIALLY !!!!!!");
//=============================================================================
char *SMESH_MEDMesh_i::getCoordinatesSystem() throw(SALOME::SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- // PN : En dur. Non encore prevu
- try
- {
- string systcoo = "CARTESIEN";
- return CORBA::string_dup(systcoo.c_str());
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au maillage");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
- SALOME::INTERNAL_ERROR);
- }
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ // PN : En dur. Non encore prevu
+ try
+ {
+ string systcoo = "CARTESIEN";
+ return CORBA::string_dup(systcoo.c_str());
+ }
+ catch(...)
+ {
+ MESSAGE("Exception en accedant au maillage");
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
+ SALOME::INTERNAL_ERROR);
+ }
}
//=============================================================================
* CORBA: Accessor for Coordinates
*/
//=============================================================================
-SALOME_MED::double_array * SMESH_MEDMesh_i::getCoordinates(
- SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception)
+SALOME_MED::double_array * SMESH_MEDMesh_i::getCoordinates
+(SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- SALOME_MED::double_array_var myseq = new SALOME_MED::double_array;
- try
- {
- // PN : En dur
- int spaceDimension = 3;
- int nbNodes = _meshDS->NbNodes();
- SCRUTE(nbNodes);
- myseq->length(nbNodes * spaceDimension);
- int i = 0;
-
- SMDS_NodeIteratorPtr itNodes=_meshDS->nodesIterator();
- while(itNodes->more())
- {
- const SMDS_MeshNode* node = itNodes->next();
-
- if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE)
- {
- myseq[i * 3] = node->X();
- myseq[i * 3 + 1] = node->Y();
- myseq[i * 3 + 2] = node->Z();
- SCRUTE(myseq[i * 3]);
- SCRUTE(myseq[i * 3 + 1]);
- SCRUTE(myseq[i * 3 + 2]);
- }
- else
- {
- ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE);
- myseq[i] = node->X();
- myseq[i + nbNodes] = node->Y();
- myseq[i + (nbNodes * 2)] = node->Z();
- SCRUTE(myseq[i]);
- SCRUTE(myseq[i + nbNodes]);
- SCRUTE(myseq[i + (nbNodes * 2)]);
- }
- i++;
- }
- }
- catch(...)
- {
- MESSAGE("Exception en accedant aux coordonnees");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
- SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::double_array_var myseq = new SALOME_MED::double_array;
+ try
+ {
+ // PN : En dur
+ int spaceDimension = 3;
+ int nbNodes = _meshDS->NbNodes();
+ SCRUTE(nbNodes);
+ myseq->length(nbNodes * spaceDimension);
+ int i = 0;
+
+ SMDS_NodeIteratorPtr itNodes=_meshDS->nodesIterator();
+ while(itNodes->more())
+ {
+ const SMDS_MeshNode* node = itNodes->next();
+
+ if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE)
+ {
+ myseq[i * 3] = node->X();
+ myseq[i * 3 + 1] = node->Y();
+ myseq[i * 3 + 2] = node->Z();
+ SCRUTE(myseq[i * 3]);
+ SCRUTE(myseq[i * 3 + 1]);
+ SCRUTE(myseq[i * 3 + 2]);
+ }
+ else
+ {
+ ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE);
+ myseq[i] = node->X();
+ myseq[i + nbNodes] = node->Y();
+ myseq[i + (nbNodes * 2)] = node->Z();
+ SCRUTE(myseq[i]);
+ SCRUTE(myseq[i + nbNodes]);
+ SCRUTE(myseq[i + (nbNodes * 2)]);
+ }
+ i++;
+ }
+ }
+ catch(...)
+ {
+ MESSAGE("Exception en accedant aux coordonnees");
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
+ SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
}
//=============================================================================
*/
//=============================================================================
SALOME_MED::string_array *
- SMESH_MEDMesh_i::getCoordinatesNames()throw(SALOME::SALOME_Exception)
+SMESH_MEDMesh_i::getCoordinatesNames()throw(SALOME::SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
- try
- {
- // PN : en dur
- int spaceDimension = 3;
- myseq->length(spaceDimension);
- myseq[0] = CORBA::string_dup("x");
- myseq[1] = CORBA::string_dup("y");
- myseq[2] = CORBA::string_dup("z");
- }
- catch(...)
- {
- MESSAGE("Exception en accedant aux noms des coordonnees");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
- SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
+ try
+ {
+ // PN : en dur
+ int spaceDimension = 3;
+ myseq->length(spaceDimension);
+ myseq[0] = CORBA::string_dup("x");
+ myseq[1] = CORBA::string_dup("y");
+ myseq[2] = CORBA::string_dup("z");
+ }
+ catch(...)
+ {
+ MESSAGE("Exception en accedant aux noms des coordonnees");
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
+ SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
}
*/
//=============================================================================
SALOME_MED::string_array *
- SMESH_MEDMesh_i::getCoordinatesUnits()throw(SALOME::SALOME_Exception)
+SMESH_MEDMesh_i::getCoordinatesUnits()throw(SALOME::SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
- try
- {
- // PN : en dur
- int spaceDimension = 3;
- myseq->length(spaceDimension);
- myseq[0] = CORBA::string_dup("m");
- myseq[1] = CORBA::string_dup("m");
- myseq[2] = CORBA::string_dup("m");
- }
- catch(...)
- {
- MESSAGE("Exception en accedant aux unites des coordonnees");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
- SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
+ try
+ {
+ // PN : en dur
+ int spaceDimension = 3;
+ myseq->length(spaceDimension);
+ myseq[0] = CORBA::string_dup("m");
+ myseq[1] = CORBA::string_dup("m");
+ myseq[2] = CORBA::string_dup("m");
+ }
+ catch(...)
+ {
+ MESSAGE("Exception en accedant aux unites des coordonnees");
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
+ SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
}
//=============================================================================
//=============================================================================
CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes()throw(SALOME::SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- try
- {
- return _meshDS->NbNodes();
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au nombre de noeuds");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
- SALOME::INTERNAL_ERROR);
- }
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _meshDS->NbNodes();
+ }
+ catch(...)
+ {
+ MESSAGE("Exception en accedant au nombre de noeuds");
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
+ SALOME::INTERNAL_ERROR);
+ }
}
//=============================================================================
*/
//=============================================================================
CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity)
-throw(SALOME::SALOME_Exception)
+ throw(SALOME::SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- try
- {
- if (!_compte)
- calculeNbElts();
- int retour = 0;
- if (_mapNbTypes.find(entity) != _mapNbTypes.end())
- retour = _mapNbTypes[entity];
- return retour;
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au nombre de Types");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
- SALOME::INTERNAL_ERROR);
- }
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ if (!_compte)
+ calculeNbElts();
+ int retour = 0;
+ if (_mapNbTypes.find(entity) != _mapNbTypes.end())
+ retour = _mapNbTypes[entity];
+ return retour;
+ }
+ catch(...)
+ {
+ MESSAGE("Exception en accedant au nombre de Types");
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
+ SALOME::INTERNAL_ERROR);
+ }
}
//=============================================================================
/*!
* CORBA: Accessor for existing geometry element types
- * Not implemented for MED_ALL_ENTITIES
+ * Not implemented for MED_ALL_ENTITIES
*/
//=============================================================================
SALOME_MED::medGeometryElement_array *
- SMESH_MEDMesh_i::getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
- SALOME_Exception)
+SMESH_MEDMesh_i::getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
+ SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- if (entity == SALOME_MED::MED_ALL_ENTITIES)
- THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",
- SALOME::BAD_PARAM);
- if (!_compte)
- calculeNbElts();
- SALOME_MED::medGeometryElement_array_var myseq =
- new SALOME_MED::medGeometryElement_array;
- try
- {
- if (_mapNbTypes.find(entity) == _mapNbTypes.end())
- THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
- SALOME::BAD_PARAM);
- int nbTypes = _mapNbTypes[entity];
-
- myseq->length(nbTypes);
-
- if (_mapIndToVectTypes.find(entity) == _mapIndToVectTypes.end())
- THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
- SALOME::INTERNAL_ERROR);
-
- int index = _mapIndToVectTypes[entity];
- ASSERT(_TypesId[index].size() != 0);
- int i = 0;
- vector < SALOME_MED::medGeometryElement >::iterator it;
- for (it = _TypesId[index].begin(); it != _TypesId[index].end(); it++)
- {
- myseq[i++] = *it;
- };
- }
- catch(...)
- {
- MESSAGE("Exception en accedant aux differents types");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
- SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ if (entity == SALOME_MED::MED_ALL_ENTITIES)
+ THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",
+ SALOME::BAD_PARAM);
+ if (!_compte)
+ calculeNbElts();
+ SALOME_MED::medGeometryElement_array_var myseq =
+ new SALOME_MED::medGeometryElement_array;
+ try
+ {
+ if (_mapNbTypes.find(entity) == _mapNbTypes.end())
+ THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
+ SALOME::BAD_PARAM);
+ int nbTypes = _mapNbTypes[entity];
+
+ myseq->length(nbTypes);
+
+ if (_mapIndToVectTypes.find(entity) == _mapIndToVectTypes.end())
+ THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
+ SALOME::INTERNAL_ERROR);
+
+ int index = _mapIndToVectTypes[entity];
+ ASSERT(_TypesId[index].size() != 0);
+ int i = 0;
+ vector < SALOME_MED::medGeometryElement >::iterator it;
+ for (it = _TypesId[index].begin(); it != _TypesId[index].end(); it++)
+ {
+ myseq[i++] = *it;
+ };
+ }
+ catch(...)
+ {
+ MESSAGE("Exception en accedant aux differents types");
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
+ SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
}
//=============================================================================
/*!
* CORBA: Returns number of elements of type medGeometryElement
- * Not implemented for MED_ALL_ELEMENTS
- * implemented for MED_ALL_ENTITIES
+ * Not implemented for MED_ALL_ELEMENTS
+ * implemented for MED_ALL_ENTITIES
*
* Dans cette implementation, il n est pas prevu de tenir compte du entity
* qui ne doit pas pouvoir avoir deux valeurs differentes pour un geomElement
*/
//=============================================================================
CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::
- medEntityMesh entity,
- SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
+ medEntityMesh entity,
+ SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- if (geomElement == SALOME_MED::MED_ALL_ELEMENTS)
- THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS",
- SALOME::BAD_PARAM);
- if (!_compte)
- calculeNbElts();
-
- try
- {
- int retour = 0;
- if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
- {
- int index = _mapIndToSeqElts[geomElement];
-
- retour = _seq_elemId[index]->length();
- }
- return retour;
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au nombre d élements");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
- SALOME::INTERNAL_ERROR);
- }
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ if (geomElement == SALOME_MED::MED_ALL_ELEMENTS)
+ THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS",
+ SALOME::BAD_PARAM);
+ if (!_compte)
+ calculeNbElts();
+
+ try
+ {
+ int retour = 0;
+ if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
+ {
+ int index = _mapIndToSeqElts[geomElement];
+
+ retour = _seq_elemId[index]->length();
+ }
+ return retour;
+ }
+ catch(...)
+ {
+ MESSAGE("Exception en accedant au nombre d élements");
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
+ SALOME::INTERNAL_ERROR);
+ }
}
//=============================================================================
//=============================================================================
SALOME_MED::long_array *
SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
- SALOME_MED::medConnectivity mode,
- SALOME_MED::medEntityMesh entity,
- SALOME_MED::medGeometryElement geomElement)
+ SALOME_MED::medConnectivity mode,
+ SALOME_MED::medEntityMesh entity,
+ SALOME_MED::medGeometryElement geomElement)
throw(SALOME::SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- if (mode != SALOME_MED::MED_NODAL)
- THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
- if (typeSwitch == SALOME_MED::MED_NO_INTERLACE)
- THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented", SALOME::BAD_PARAM);
- if (!_compte)
- calculeNbElts();
-
- // Faut-il renvoyer un pointeur vide ???
- if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
- THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh",
- SALOME::BAD_PARAM);
-
- int index = _mapIndToSeqElts[geomElement];
-
- return _seq_elemId[index]._retn();
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ if (mode != SALOME_MED::MED_NODAL)
+ THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
+ if (typeSwitch == SALOME_MED::MED_NO_INTERLACE)
+ THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented", SALOME::BAD_PARAM);
+ if (!_compte)
+ calculeNbElts();
+
+ // Faut-il renvoyer un pointeur vide ???
+ if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
+ THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh",
+ SALOME::BAD_PARAM);
+
+ int index = _mapIndToSeqElts[geomElement];
+
+ return _seq_elemId[index]._retn();
}
//=============================================================================
//=============================================================================
SALOME_MED::long_array *
SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
- SALOME_MED::medEntityMesh entity)
+ SALOME_MED::medEntityMesh entity)
throw(SALOME::SALOME_Exception)
{
- MESSAGE("Pas Implemente dans SMESH");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
- return 0;
+ MESSAGE("Pas Implemente dans SMESH");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ return 0;
}
//=============================================================================
//=============================================================================
CORBA::Long
SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
- SALOME_MED::medEntityMesh entity,
- SALOME_MED::medGeometryElement type,
- const SALOME_MED::long_array & connectivity)
+ SALOME_MED::medEntityMesh entity,
+ SALOME_MED::medGeometryElement type,
+ const SALOME_MED::long_array & connectivity)
throw(SALOME::SALOME_Exception)
{
- const char *LOC = "getElementNumber ";
- MESSAGE(LOC << "Pas Implemente dans SMESH");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
- return -1;
+ const char *LOC = "getElementNumber ";
+ MESSAGE(LOC << "Pas Implemente dans SMESH");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ return -1;
}
//=============================================================================
*/
//=============================================================================
SALOME_MED::long_array *
- SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::
- medConnectivity mode) throw(SALOME::SALOME_Exception)
+SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::
+ medConnectivity mode) throw(SALOME::SALOME_Exception)
{
- MESSAGE("Pas Implemente dans SMESH");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
- return 0;
+ MESSAGE("Pas Implemente dans SMESH");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ return 0;
}
//=============================================================================
*/
//=============================================================================
SALOME_MED::long_array *
- SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::
- medConnectivity mode) throw(SALOME::SALOME_Exception)
+SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::
+ medConnectivity mode) throw(SALOME::SALOME_Exception)
{
- MESSAGE("Pas Implemente dans SMESH");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
- return 0;
+ MESSAGE("Pas Implemente dans SMESH");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ return 0;
}
//=============================================================================
*/
//=============================================================================
CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::
- medEntityMesh entity) throw(SALOME::SALOME_Exception)
+ medEntityMesh entity) throw(SALOME::SALOME_Exception)
{
- if (_creeFamily == false)
- createFamilies();
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- return _families.size();
+ if (_creeFamily == false)
+ createFamilies();
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ return _families.size();
}
//=============================================================================
*/
//=============================================================================
CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
-throw(SALOME::SALOME_Exception)
+ throw(SALOME::SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- MESSAGE(" Pas d implementation des groupes dans SMESH");
- return 0;
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ MESSAGE(" Pas d implementation des groupes dans SMESH");
+ return 0;
}
//=============================================================================
*/
//=============================================================================
SALOME_MED::Family_array *
- SMESH_MEDMesh_i::getFamilies(SALOME_MED::
- medEntityMesh entity) throw(SALOME::SALOME_Exception)
+SMESH_MEDMesh_i::getFamilies(SALOME_MED::
+ medEntityMesh entity) throw(SALOME::SALOME_Exception)
{
- if (_creeFamily == false)
- createFamilies();
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
- int nbfam = _families.size();
- myseq->length(nbfam);
- int i = 0;
- vector < SALOME_MED::FAMILY_ptr >::iterator it;
- for (it = _families.begin(); it != _families.end(); it++)
- {
- myseq[i++] = *it;
- };
- return myseq._retn();
+ if (_creeFamily == false)
+ createFamilies();
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
+ int nbfam = _families.size();
+ myseq->length(nbfam);
+ int i = 0;
+ vector < SALOME_MED::FAMILY_ptr >::iterator it;
+ for (it = _families.begin(); it != _families.end(); it++)
+ {
+ myseq[i++] = *it;
+ };
+ return myseq._retn();
}
//=============================================================================
*/
//=============================================================================
SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::
- medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
+ medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
{
- if (_creeFamily == false)
- createFamilies();
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
-
- SCRUTE(_families[i]->getName());
- MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i];
+ if (_creeFamily == false)
+ createFamilies();
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+
+ SCRUTE(_families[i]->getName());
+ MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i];
}
//=============================================================================
*/
//=============================================================================
SALOME_MED::Group_array *
- SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME::
- SALOME_Exception)
+SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME::
+ SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- MESSAGE(" Pas d implementation des groupes dans SMESH");
- THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ MESSAGE(" Pas d implementation des groupes dans SMESH");
+ THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
}
//=============================================================================
*/
//=============================================================================
SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::
- medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
+ medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
{
- if (_mesh_i == 0)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- MESSAGE(" Pas d implementation des groupes dans SMESH");
- THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
+ if (_mesh_i == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ MESSAGE(" Pas d implementation des groupes dans SMESH");
+ THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
}
//=============================================================================
/*!
*/
//=============================================================================
SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::
- SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
+ SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
{
- MESSAGE("Pas Implemente dans SMESH");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
- return 0;
+ MESSAGE("Pas Implemente dans SMESH");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ return 0;
}
//=============================================================================
*/
//=============================================================================
SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::
- SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
+ SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
{
- MESSAGE("Pas Implemente dans SMESH");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
- return 0;
+ MESSAGE("Pas Implemente dans SMESH");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ return 0;
}
//=============================================================================
*/
//=============================================================================
SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::
- SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
+ SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
{
- MESSAGE("Pas Implemente dans SMESH");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
- return 0;
+ MESSAGE("Pas Implemente dans SMESH");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ return 0;
}
//=============================================================================
*/
//=============================================================================
SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::
- SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
+ SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
{
- MESSAGE("Pas Implemente dans SMESH");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
- return 0;
+ MESSAGE("Pas Implemente dans SMESH");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ return 0;
}
//=============================================================================
*/
//=============================================================================
SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::
- SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
+ SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
{
- MESSAGE("Pas Implemente dans SMESH");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
- return 0;
+ MESSAGE("Pas Implemente dans SMESH");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ return 0;
}
//=============================================================================
*/
//=============================================================================
SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::
- SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
+ SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
{
- MESSAGE("Non Implemente");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
- return 0;
+ MESSAGE("Non Implemente");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ return 0;
}
//=============================================================================
*/
//=============================================================================
void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
- SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception)
+ SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception)
{
- BEGIN_OF("MED_Mesh_i::addInStudy");
- if (_meshId != "")
- {
- MESSAGE("Mesh already in Study");
- THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study",
- SALOME::BAD_PARAM);
- };
-
- /*
- * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
- *
- * // Create SComponent labelled 'MED' if it doesn't already exit
- * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
- * if ( CORBA::is_nil(medfather) )
- * {
- * MESSAGE("Add Component MED");
- * medfather = myBuilder->NewComponent("MED");
- * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED");
- * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
- * myBuilder->FindOrCreateAttribute(medfather, "AttributeName"));
- * aName->SetValue("MED");
- *
- * myBuilder->DefineComponentInstance(medfather,myIor);
- *
- * } ;
- *
- * MESSAGE("Add a mesh Object under MED");
- * myBuilder->NewCommand();
- * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
- *
- * ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- * ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- * CORBA::ORB_var &orb = init(0,0);
- * CORBA::String_var iorStr = orb->object_to_string(myIor);
- * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.in());
- * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow(
- * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"));
- * aIOR->SetValue(iorStr.c_str());
- *
- * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str());
- * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
- * myBuilder->FindOrCreateAttribute(newObj, "AttributeName"));
- * aName->SetValue(_mesh_i->getName().c_str());
- *
- * _meshId = newObj->GetID();
- * myBuilder->CommitCommand();
- *
- */
- END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
+ BEGIN_OF("MED_Mesh_i::addInStudy");
+ if (_meshId != "")
+ {
+ MESSAGE("Mesh already in Study");
+ THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study",
+ SALOME::BAD_PARAM);
+ };
+
+ /*
+ * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
+ *
+ * // Create SComponent labelled 'MED' if it doesn't already exit
+ * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
+ * if ( CORBA::is_nil(medfather) )
+ * {
+ * MESSAGE("Add Component MED");
+ * medfather = myBuilder->NewComponent("MED");
+ * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED");
+ * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
+ * myBuilder->FindOrCreateAttribute(medfather, "AttributeName"));
+ * aName->SetValue("MED");
+ *
+ * myBuilder->DefineComponentInstance(medfather,myIor);
+ *
+ * } ;
+ *
+ * MESSAGE("Add a mesh Object under MED");
+ * myBuilder->NewCommand();
+ * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
+ *
+ * ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ * ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ * CORBA::ORB_var &orb = init(0,0);
+ * CORBA::String_var iorStr = orb->object_to_string(myIor);
+ * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.in());
+ * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow(
+ * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"));
+ * aIOR->SetValue(iorStr.c_str());
+ *
+ * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str());
+ * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
+ * myBuilder->FindOrCreateAttribute(newObj, "AttributeName"));
+ * aName->SetValue(_mesh_i->getName().c_str());
+ *
+ * _meshId = newObj->GetID();
+ * myBuilder->CommitCommand();
+ *
+ */
+ END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
}
//=============================================================================
*/
//=============================================================================
void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName)
-throw(SALOME::SALOME_Exception)
+ throw(SALOME::SALOME_Exception)
{
- MESSAGE("Non Implemente");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ MESSAGE("Non Implemente");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
}
//=============================================================================
//=============================================================================
void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception)
{
- MESSAGE("Non Implemente");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ MESSAGE("Non Implemente");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
}
//=============================================================================
//=============================================================================
void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception)
{
- MESSAGE("Non Implemente");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ MESSAGE("Non Implemente");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
}
//=============================================================================
*/
//=============================================================================
CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType,
- const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception)
+ const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception)
{
- MESSAGE("Non Implemente");
- THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
- return 0;
+ MESSAGE("Non Implemente");
+ THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+ return 0;
}
//=============================================================================
//=============================================================================
void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
{
- if (!_compte)
- {
- _compte = true;
-
- _mapNbTypes[SALOME_MED::MED_NODE] = 1;
- // On compte les aretes MED_SEG2 ou MED_SEG3
- // On range les elements dans les vecteurs correspondants
-
- _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++;
- _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++;
- _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++;
-
- int trouveSeg2 = 0;
- int trouveSeg3 = 0;
- SALOME_MED::medGeometryElement medElement;
-
- SMDS_EdgeIteratorPtr itEdges=_meshDS->edgesIterator();
- while(itEdges->more())
- {
- const SMDS_MeshEdge* elem = itEdges->next();
- int nb_of_nodes = elem->NbNodes();
-
- switch (nb_of_nodes)
- {
- case 2:
- {
- medElement = SALOME_MED::MED_SEG2;
- if (trouveSeg2 == 0)
- {
- trouveSeg2 = 1;
- _TypesId[SALOME_MED::MED_EDGE].
- push_back(SALOME_MED::MED_SEG2);
- }
- break;
- }
- case 3:
- {
- medElement = SALOME_MED::MED_SEG3;
- if (trouveSeg3 == 0)
- {
- trouveSeg3 = 1;
- _TypesId[SALOME_MED::MED_EDGE].
- push_back(SALOME_MED::MED_SEG3);
- }
- break;
- }
- }
- int index = _mapIndToSeqElts[medElement];
- SCRUTE(index);
- // Traitement de l arete
-
- int longueur = _seq_elemId[index]->length();
- _seq_elemId[index]->length(longueur + nb_of_nodes);
-
- SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
-
- for(int k=0; itn->more(); k++)
- _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
- }
-
- _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3;
-
- // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6
- // On range les elements dans les vecteurs correspondants
- int trouveTria3 = 0;
- int trouveTria6 = 0;
- int trouveQuad4 = 0;
-
- _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++;
- _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++;
- _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++;
- _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++;
-
- SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator();
- while(itFaces->more())
- {
- const SMDS_MeshFace * elem = itFaces->next();
- int nb_of_nodes = elem->NbNodes();
-
- switch (nb_of_nodes)
- {
- case 3:
- {
- medElement = SALOME_MED::MED_TRIA3;
- if (trouveTria3 == 0)
- {
- trouveTria3 = 1;
- _TypesId[SALOME_MED::MED_FACE].
- push_back(SALOME_MED::MED_TRIA3);
- }
- break;
- }
- case 4:
- {
- medElement = SALOME_MED::MED_QUAD4;
- if (trouveQuad4 == 0)
- {
- trouveQuad4 = 1;
- _TypesId[SALOME_MED::MED_FACE].
- push_back(SALOME_MED::MED_QUAD4);
- }
- break;
- }
- case 6:
- {
- medElement = SALOME_MED::MED_TRIA6;
- if (trouveTria6 == 0)
- {
- trouveTria6 = 1;
- _TypesId[SALOME_MED::MED_FACE].
- push_back(SALOME_MED::MED_TRIA6);
- }
- break;
- }
- }
- int index = _mapIndToSeqElts[medElement];
- SCRUTE(index);
-
- // Traitement de la face
- // Attention La numérotation des noeuds Med commence a 1
-
- int longueur = _seq_elemId[index]->length();
- _seq_elemId[index]->length(longueur + nb_of_nodes);
-
- SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
-
- for(int k=0; itn->more(); k++)
- _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
- } //itFaces
-
- _mapNbTypes[SALOME_MED::MED_FACE] =
- trouveTria3 + trouveTria6 + trouveQuad4;
-
- _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++;
- _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++;
- int index = _mapIndToSeqElts[medElement];
-
- int trouveHexa8 = 0;
-
- SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator();
- while(itVolumes->more())
- {
- const SMDS_MeshVolume * elem = itVolumes->next();
-
- int nb_of_nodes = elem->NbNodes();
- medElement = SALOME_MED::MED_HEXA8;
- ASSERT(nb_of_nodes == 8);
-
- if (trouveHexa8 == 0)
- {
- trouveHexa8 = 1;
- _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
- };
- // Traitement de la maille
- int longueur = _seq_elemId[index]->length();
- _seq_elemId[index]->length(longueur + nb_of_nodes);
-
- SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
- for(int k=0; itn->more(); k++)
- _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
- }
-
- _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8;
- _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
- =
- trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 +
- trouveSeg3;
- }// fin du _compte
+ if (!_compte)
+ {
+ _compte = true;
+
+ _mapNbTypes[SALOME_MED::MED_NODE] = 1;
+ // On compte les aretes MED_SEG2 ou MED_SEG3
+ // On range les elements dans les vecteurs correspondants
+
+ _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++;
+ _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++;
+ _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++;
+
+ int trouveSeg2 = 0;
+ int trouveSeg3 = 0;
+ SALOME_MED::medGeometryElement medElement;
+
+ SMDS_EdgeIteratorPtr itEdges=_meshDS->edgesIterator();
+ while(itEdges->more())
+ {
+ const SMDS_MeshEdge* elem = itEdges->next();
+ int nb_of_nodes = elem->NbNodes();
+
+ switch (nb_of_nodes)
+ {
+ case 2:
+ {
+ medElement = SALOME_MED::MED_SEG2;
+ if (trouveSeg2 == 0)
+ {
+ trouveSeg2 = 1;
+ _TypesId[SALOME_MED::MED_EDGE].
+ push_back(SALOME_MED::MED_SEG2);
+ }
+ break;
+ }
+ case 3:
+ {
+ medElement = SALOME_MED::MED_SEG3;
+ if (trouveSeg3 == 0)
+ {
+ trouveSeg3 = 1;
+ _TypesId[SALOME_MED::MED_EDGE].
+ push_back(SALOME_MED::MED_SEG3);
+ }
+ break;
+ }
+ }
+ int index = _mapIndToSeqElts[medElement];
+ SCRUTE(index);
+ // Traitement de l arete
+
+ int longueur = _seq_elemId[index]->length();
+ _seq_elemId[index]->length(longueur + nb_of_nodes);
+
+ SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
+
+ for(int k=0; itn->more(); k++)
+ _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
+ }
+
+ _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3;
+
+ // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6
+ // On range les elements dans les vecteurs correspondants
+ int trouveTria3 = 0;
+ int trouveTria6 = 0;
+ int trouveQuad4 = 0;
+
+ _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++;
+ _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++;
+ _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++;
+ _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++;
+
+ SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator();
+ while(itFaces->more())
+ {
+ const SMDS_MeshFace * elem = itFaces->next();
+ int nb_of_nodes = elem->NbNodes();
+
+ switch (nb_of_nodes)
+ {
+ case 3:
+ {
+ medElement = SALOME_MED::MED_TRIA3;
+ if (trouveTria3 == 0)
+ {
+ trouveTria3 = 1;
+ _TypesId[SALOME_MED::MED_FACE].
+ push_back(SALOME_MED::MED_TRIA3);
+ }
+ break;
+ }
+ case 4:
+ {
+ medElement = SALOME_MED::MED_QUAD4;
+ if (trouveQuad4 == 0)
+ {
+ trouveQuad4 = 1;
+ _TypesId[SALOME_MED::MED_FACE].
+ push_back(SALOME_MED::MED_QUAD4);
+ }
+ break;
+ }
+ case 6:
+ {
+ medElement = SALOME_MED::MED_TRIA6;
+ if (trouveTria6 == 0)
+ {
+ trouveTria6 = 1;
+ _TypesId[SALOME_MED::MED_FACE].
+ push_back(SALOME_MED::MED_TRIA6);
+ }
+ break;
+ }
+ }
+ int index = _mapIndToSeqElts[medElement];
+ SCRUTE(index);
+
+ // Traitement de la face
+ // Attention La numérotation des noeuds Med commence a 1
+
+ int longueur = _seq_elemId[index]->length();
+ _seq_elemId[index]->length(longueur + nb_of_nodes);
+
+ SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
+
+ for(int k=0; itn->more(); k++)
+ _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
+ } //itFaces
+
+ _mapNbTypes[SALOME_MED::MED_FACE] =
+ trouveTria3 + trouveTria6 + trouveQuad4;
+
+ _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++;
+ _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++;
+ int index = _mapIndToSeqElts[medElement];
+
+ int trouveHexa8 = 0;
+
+ SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator();
+ while(itVolumes->more())
+ {
+ const SMDS_MeshVolume * elem = itVolumes->next();
+
+ int nb_of_nodes = elem->NbNodes();
+ medElement = SALOME_MED::MED_HEXA8;
+ ASSERT(nb_of_nodes == 8);
+
+ if (trouveHexa8 == 0)
+ {
+ trouveHexa8 = 1;
+ _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
+ };
+ // Traitement de la maille
+ int longueur = _seq_elemId[index]->length();
+ _seq_elemId[index]->length(longueur + nb_of_nodes);
+
+ SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
+ for(int k=0; itn->more(); k++)
+ _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
+ }
+
+ _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8;
+ _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
+ =
+ trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 +
+ trouveSeg3;
+ }// fin du _compte
};
//=============================================================================
void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- string famDes = ("Je ne sais pas");
- string famName0 = "Famille_";
- string famName;
- char numero[10];
-
- if (_creeFamily == false)
- {
- _creeFamily = true;
- //SMESH_subMesh_i *subMeshServant;
-
- map < int, SMESH_subMesh_i * >::iterator it;
- for (it = _mesh_i->_mapSubMesh_i.begin();
- it != _mesh_i->_mapSubMesh_i.end(); it++)
- {
- SMESH_subMesh_i *submesh_i = (*it).second;
- int famIdent = (*it).first;
-
- ASSERT(famIdent < 999999999);
- sprintf(numero, "%d\n", famIdent);
- famName = famName0 + numero;
-
- SMESH_MEDFamily_i *famservant =
- new SMESH_MEDFamily_i(famIdent, submesh_i,
- famName, famDes, SALOME_MED::MED_NODE);
+ string famDes = ("Je ne sais pas");
+ string famName0 = "Famille_";
+ string famName;
+ char numero[10];
+
+ if (_creeFamily == false)
+ {
+ _creeFamily = true;
+ //SMESH_subMesh_i *subMeshServant;
+
+ map < int, SMESH_subMesh_i * >::iterator it;
+ for (it = _mesh_i->_mapSubMesh_i.begin();
+ it != _mesh_i->_mapSubMesh_i.end(); it++)
+ {
+ SMESH_subMesh_i *submesh_i = (*it).second;
+ int famIdent = (*it).first;
+
+ ASSERT(famIdent < 999999999);
+ sprintf(numero, "%d\n", famIdent);
+ famName = famName0 + numero;
+
+ SMESH_MEDFamily_i *famservant =
+ new SMESH_MEDFamily_i(famIdent, submesh_i,
+ famName, famDes, SALOME_MED::MED_NODE);
#ifdef WNT
SALOME_MED::FAMILY_ptr famille = SALOME_MED::FAMILY::_nil();
POA_SALOME_MED::FAMILY* servantbase = dynamic_cast<POA_SALOME_MED::FAMILY*>(famservant);
if ( servantbase )
famille = SALOME_MED::FAMILY::_narrow( servantbase->_this() );
#else
- SALOME_MED::FAMILY_ptr famille =
+ SALOME_MED::FAMILY_ptr famille =
SALOME_MED::FAMILY::_narrow( famservant->POA_SALOME_MED::FAMILY::_this() );
#endif
- _families.push_back(famille);
- }
- }
+ _families.push_back(famille);
+ }
+ }
};
//=============================================================================
/*!
//=============================================================================
SALOME_MED::medGeometryElement
SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
- CORBA::Long number)
+ CORBA::Long number)
throw (SALOME::SALOME_Exception)
{
MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
void release() {}
SALOME::SenderDouble_ptr getSenderForCoordinates(SALOME_MED::medModeSwitch) {return SALOME::SenderDouble::_nil();}
SALOME::SenderInt_ptr getSenderForConnectivity(SALOME_MED::medModeSwitch,
- SALOME_MED::medConnectivity,
- SALOME_MED::medEntityMesh,
- SALOME_MED::medGeometryElement)
+ SALOME_MED::medConnectivity,
+ SALOME_MED::medEntityMesh,
+ SALOME_MED::medGeometryElement)
{
return SALOME::SenderInt::_nil();
}
CORBA::Boolean
existConnectivity(SALOME_MED::medConnectivity connectivityType,
- SALOME_MED::medEntityMesh entity)
+ SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception);
char *getCoordinatesSystem() throw(SALOME::SALOME_Exception);
SALOME_MED::medGeometryElement_array *
getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
- SALOME_Exception);
+ SALOME_Exception);
SALOME_MED::medGeometryElement
getElementType(SALOME_MED::medEntityMesh entity,
- CORBA::Long number)
+ CORBA::Long number)
throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfElements(SALOME_MED::medEntityMesh entity,
- SALOME_MED::medGeometryElement geomElement)
+ SALOME_MED::medGeometryElement geomElement)
throw(SALOME::SALOME_Exception);
SALOME_MED::long_array *
getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
- SALOME_MED::medConnectivity mode,
- SALOME_MED::medEntityMesh entity,
- SALOME_MED::medGeometryElement geomElement)
+ SALOME_MED::medConnectivity mode,
+ SALOME_MED::medEntityMesh entity,
+ SALOME_MED::medGeometryElement geomElement)
throw(SALOME::SALOME_Exception);
SALOME_MED::long_array *
getConnectivityIndex(SALOME_MED::medConnectivity mode,
- SALOME_MED::medEntityMesh entity)
+ SALOME_MED::medEntityMesh entity)
throw(SALOME::SALOME_Exception);
SALOME_MED::long_array*
throw (SALOME::SALOME_Exception);
CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode,
- SALOME_MED::medEntityMesh entity,
- SALOME_MED::medGeometryElement type,
- const SALOME_MED::long_array & connectivity)
+ SALOME_MED::medEntityMesh entity,
+ SALOME_MED::medGeometryElement type,
+ const SALOME_MED::long_array & connectivity)
throw(SALOME::SALOME_Exception);
SALOME_MED::long_array *
throw(SALOME::SALOME_Exception);
SALOME_MED::FAMILY_ptr getFamily(SALOME_MED::medEntityMesh entity,
- CORBA::Long i)
+ CORBA::Long i)
throw(SALOME::SALOME_Exception);
SALOME_MED::Group_array * getGroups(SALOME_MED::medEntityMesh entity)
throw(SALOME::SALOME_Exception);
SALOME_MED::GROUP_ptr getGroup(SALOME_MED::medEntityMesh entity,
- CORBA::Long i)
+ CORBA::Long i)
throw(SALOME::SALOME_Exception);
SALOME_MED::SUPPORT_ptr
// Others
void addInStudy(SALOMEDS::Study_ptr myStudy,
- SALOME_MED::MESH_ptr myIor)
+ SALOME_MED::MESH_ptr myIor)
throw(SALOME::SALOME_Exception);
CORBA::Long addDriver(SALOME_MED::medDriverTypes driverType,
- const char *fileName, const char *meshName)
+ const char *fileName, const char *meshName)
throw(SALOME::SALOME_Exception);
void rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception);
void read(CORBA::Long i) throw(SALOME::SALOME_Exception);
//=============================================================================
SMESH_MEDSupport_i::SMESH_MEDSupport_i()
{
- BEGIN_OF("Default Constructor SMESH_MEDSupport_i");
- END_OF("Default Constructor SMESH_MEDSupport_i");
+ BEGIN_OF("Default Constructor SMESH_MEDSupport_i");
+ END_OF("Default Constructor SMESH_MEDSupport_i");
}
//=============================================================================
*/
//=============================================================================
SMESH_MEDSupport_i::SMESH_MEDSupport_i(SMESH_subMesh_i * sm, string name,
- string description, SALOME_MED::medEntityMesh entity)
- :_subMesh_i(sm), _name(name), _description(description), _entity(entity),
- _seqNumber(false), _seqLength(0)
+ string description, SALOME_MED::medEntityMesh entity)
+ :_subMesh_i(sm), _name(name), _description(description), _entity(entity),
+ _seqNumber(false), _seqLength(0)
{
- BEGIN_OF("Constructor SMESH_MEDSupport_i");
-
- _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
-
- int subMeshId = _subMesh_i->GetId();
-
- MESSAGE(" subMeshId " << subMeshId)
-
- if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) !=
- _subMesh_i->_mesh_i->_mapSubMesh.end())
- {
- ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
- _subMeshDS = subMesh->GetSubMeshDS();
- }
-
- if (_entity == SALOME_MED::MED_NODE)
- {
- _numberOfGeometricType = 1;
- _geometricType = new SALOME_MED::medGeometryElement[1];
- _geometricType[0] = SALOME_MED::MED_NONE;
- }
- else
- {
- MESSAGE("Pas implemente dans cette version");
- THROW_SALOME_CORBA_EXCEPTION
- ("Seules les familles de noeuds sont implementees ",
- SALOME::BAD_PARAM);
- }
-
- END_OF("Constructor SMESH_MEDSupport_i");
+ BEGIN_OF("Constructor SMESH_MEDSupport_i");
+
+ _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
+
+ int subMeshId = _subMesh_i->GetId();
+
+ MESSAGE(" subMeshId " << subMeshId)
+
+ if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) !=
+ _subMesh_i->_mesh_i->_mapSubMesh.end())
+ {
+ ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
+ _subMeshDS = subMesh->GetSubMeshDS();
+ }
+
+ if (_entity == SALOME_MED::MED_NODE)
+ {
+ _numberOfGeometricType = 1;
+ _geometricType = new SALOME_MED::medGeometryElement[1];
+ _geometricType[0] = SALOME_MED::MED_NONE;
+ }
+ else
+ {
+ MESSAGE("Pas implemente dans cette version");
+ THROW_SALOME_CORBA_EXCEPTION
+ ("Seules les familles de noeuds sont implementees ",
+ SALOME::BAD_PARAM);
+ }
+
+ END_OF("Constructor SMESH_MEDSupport_i");
}
//=============================================================================
_name(s._name), _description(s._description), _entity(s._entity),
_seqNumber(false), _seqLength(0)
{
- BEGIN_OF("Constructor SMESH_MEDSupport_i");
+ BEGIN_OF("Constructor SMESH_MEDSupport_i");
- _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
+ _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
- int subMeshId = _subMesh_i->GetId();
- if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) !=
- _subMesh_i->_mesh_i->_mapSubMesh.end())
- {
- ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
- _subMeshDS = subMesh->GetSubMeshDS();
- }
+ int subMeshId = _subMesh_i->GetId();
+ if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) !=
+ _subMesh_i->_mesh_i->_mapSubMesh.end())
+ {
+ ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
+ _subMeshDS = subMesh->GetSubMeshDS();
+ }
- END_OF("Constructor SMESH_MEDSupport_i");
+ END_OF("Constructor SMESH_MEDSupport_i");
}
//=============================================================================
CORBA::Long SMESH_MEDSupport_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
{
- if (_subMeshDS == NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support",
- SALOME::INTERNAL_ERROR);
- MESSAGE("Not implemented for SMESH_i");
- THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", SALOME::BAD_PARAM);
+ if (_subMeshDS == NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
+ SALOME::INTERNAL_ERROR);
+ MESSAGE("Not implemented for SMESH_i");
+ THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", SALOME::BAD_PARAM);
}
char *SMESH_MEDSupport_i::getName() throw(SALOME::SALOME_Exception)
{
- if (_subMeshDS==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support",
- SALOME::INTERNAL_ERROR);
- return CORBA::string_dup(_name.c_str());
+ if (_subMeshDS==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
+ SALOME::INTERNAL_ERROR);
+ return CORBA::string_dup(_name.c_str());
}
char *SMESH_MEDSupport_i::getDescription() throw(SALOME::SALOME_Exception)
{
- if (_subMeshDS==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support",
- SALOME::INTERNAL_ERROR);
- return CORBA::string_dup(_description.c_str());
+ if (_subMeshDS==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
+ SALOME::INTERNAL_ERROR);
+ return CORBA::string_dup(_description.c_str());
}
//=============================================================================
//=============================================================================
SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh()throw(SALOME::
- SALOME_Exception)
+ SALOME_Exception)
{
- if (_subMeshDS==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support",
- SALOME::INTERNAL_ERROR);
+ if (_subMeshDS==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
+ SALOME::INTERNAL_ERROR);
- return _subMesh_i->_mesh_i->GetMEDMesh();
+ return _subMesh_i->_mesh_i->GetMEDMesh();
}
//=============================================================================
//=============================================================================
CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements()throw(SALOME::
- SALOME_Exception)
+ SALOME_Exception)
{
- if (_subMeshDS==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support",
- SALOME::INTERNAL_ERROR);
- if (_seqNumber == false)
- {
- if (_entity != SALOME_MED::MED_NONE)
- {
- _seqLength = _subMeshDS->NbNodes();
- _seqNumber = true;
- }
- else
- {
- MESSAGE("Only Node Families are implemented ");
- THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ",
- SALOME::BAD_PARAM);
- }
- }
- try
- {
- _isOnAllElements = (_seqLength == _meshDS->NbNodes());
- }
- catch(...)
- {
- MESSAGE("unable to acces related Mesh");
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
- SALOME::INTERNAL_ERROR);
- };
- return _isOnAllElements;
+ if (_subMeshDS==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
+ SALOME::INTERNAL_ERROR);
+ if (_seqNumber == false)
+ {
+ if (_entity != SALOME_MED::MED_NONE)
+ {
+ _seqLength = _subMeshDS->NbNodes();
+ _seqNumber = true;
+ }
+ else
+ {
+ MESSAGE("Only Node Families are implemented ");
+ THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ",
+ SALOME::BAD_PARAM);
+ }
+ }
+ try
+ {
+ _isOnAllElements = (_seqLength == _meshDS->NbNodes());
+ }
+ catch(...)
+ {
+ MESSAGE("unable to acces related Mesh");
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
+ SALOME::INTERNAL_ERROR);
+ };
+ return _isOnAllElements;
}
//=============================================================================
//=============================================================================
SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity()throw(SALOME::
- SALOME_Exception)
+ SALOME_Exception)
{
- if (_subMeshDS==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support",
- SALOME::INTERNAL_ERROR);
- return _entity;
+ if (_subMeshDS==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
+ SALOME::INTERNAL_ERROR);
+ return _entity;
}
//=============================================================================
//=============================================================================
SALOME_MED::medGeometryElement_array *
- SMESH_MEDSupport_i::getTypes()throw(SALOME::SALOME_Exception)
+ SMESH_MEDSupport_i::getTypes()throw(SALOME::SALOME_Exception)
{
- if (_subMeshDS==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support",
- SALOME::INTERNAL_ERROR);
- SALOME_MED::medGeometryElement_array_var myseq =
- new SALOME_MED::medGeometryElement_array;
- try
- {
- int mySeqLength = _numberOfGeometricType;
- myseq->length(mySeqLength);
- for (int i = 0; i < mySeqLength; i++)
- {
- myseq[i] = _geometricType[i];
- }
- }
- catch(...)
- {
- MESSAGE("Exception lors de la recherche des differents types");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types",
- SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
+ if (_subMeshDS==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::medGeometryElement_array_var myseq =
+ new SALOME_MED::medGeometryElement_array;
+ try
+ {
+ int mySeqLength = _numberOfGeometricType;
+ myseq->length(mySeqLength);
+ for (int i = 0; i < mySeqLength; i++)
+ {
+ myseq[i] = _geometricType[i];
+ }
+ }
+ catch(...)
+ {
+ MESSAGE("Exception lors de la recherche des differents types");
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types",
+ SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
}
//=============================================================================
*/
//=============================================================================
CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED::
- medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
+ medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
{
- if (_subMeshDS==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support",
- SALOME::INTERNAL_ERROR);
- return _numberOfGeometricType;
+ if (_subMeshDS==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
+ SALOME::INTERNAL_ERROR);
+ return _numberOfGeometricType;
}
//=============================================================================
SALOME_MED::long_array * SMESH_MEDSupport_i::getNumber(
- SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
+ SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- if (_subMeshDS==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support",
- SALOME::INTERNAL_ERROR);
+ if (_subMeshDS==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
+ SALOME::INTERNAL_ERROR);
- // A changer s'il ne s agit plus seulement de famille de noeuds
- if (geomElement != SALOME_MED::MED_NONE)
- THROW_SALOME_CORBA_EXCEPTION("Not implemented", SALOME::BAD_PARAM);
+ // A changer s'il ne s agit plus seulement de famille de noeuds
+ if (geomElement != SALOME_MED::MED_NONE)
+ THROW_SALOME_CORBA_EXCEPTION("Not implemented", SALOME::BAD_PARAM);
- SALOME_MED::long_array_var myseq = new SALOME_MED::long_array;
+ SALOME_MED::long_array_var myseq = new SALOME_MED::long_array;
- int i = 0;
- myseq->length(_subMeshDS->NbNodes());
+ int i = 0;
+ myseq->length(_subMeshDS->NbNodes());
- SMDS_NodeIteratorPtr it = _subMeshDS->GetNodes();
- while(it->more())
- {
- myseq[i] = it->next()->GetID();
- i++;
- };
+ SMDS_NodeIteratorPtr it = _subMeshDS->GetNodes();
+ while(it->more())
+ {
+ myseq[i] = it->next()->GetID();
+ i++;
+ };
- SCRUTE(myseq->length());
- MESSAGE("End of SMESH_MEDSupport_i::getNumber");
- return myseq._retn();
+ SCRUTE(myseq->length());
+ MESSAGE("End of SMESH_MEDSupport_i::getNumber");
+ return myseq._retn();
}
//=============================================================================
SALOME_MED::long_array * SMESH_MEDSupport_i::getNumberFromFile(
- SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
+ SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
{
return getNumber(geomElement);
}
//=============================================================================
SALOME_MED::long_array *
- SMESH_MEDSupport_i::getNumberIndex()throw(SALOME::SALOME_Exception)
+ SMESH_MEDSupport_i::getNumberIndex()throw(SALOME::SALOME_Exception)
{
- MESSAGE("Not implemented for SMESH_i");
- THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
- return NULL;
+ MESSAGE("Not implemented for SMESH_i");
+ THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
+ return NULL;
}
//=============================================================================
/*!
//=============================================================================
CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoint(SALOME_MED::
- medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
+ medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
{
- MESSAGE("Not implemented for SMESH_i");
- return 0;
+ MESSAGE("Not implemented for SMESH_i");
+ return 0;
}
//=============================================================================
/*!
class SMESH_subMesh_i;
class SMESH_I_EXPORT SMESH_MEDSupport_i:
- public virtual POA_SALOME_MED::SUPPORT, public virtual SALOME::GenericObj_i
+ public virtual POA_SALOME_MED::SUPPORT, public virtual SALOME::GenericObj_i
{
public:
// Constructors and associated internal methods
- SMESH_MEDSupport_i(SMESH_subMesh_i * sm,
- std::string name, std::string description, SALOME_MED::medEntityMesh entity);
- SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s);
+ SMESH_MEDSupport_i(SMESH_subMesh_i * sm,
+ std::string name, std::string description, SALOME_MED::medEntityMesh entity);
+ SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s);
// IDL Methods
- char *getName() throw(SALOME::SALOME_Exception);
- char *getDescription() throw(SALOME::SALOME_Exception);
- SALOME_MED::MESH_ptr getMesh() throw(SALOME::SALOME_Exception);
- CORBA::Boolean isOnAllElements() throw(SALOME::SALOME_Exception);
- SALOME_MED::medEntityMesh getEntity() throw(SALOME::SALOME_Exception);
+ char *getName() throw(SALOME::SALOME_Exception);
+ char *getDescription() throw(SALOME::SALOME_Exception);
+ SALOME_MED::MESH_ptr getMesh() throw(SALOME::SALOME_Exception);
+ CORBA::Boolean isOnAllElements() throw(SALOME::SALOME_Exception);
+ SALOME_MED::medEntityMesh getEntity() throw(SALOME::SALOME_Exception);
CORBA::Long
- getNumberOfElements(SALOME_MED::medGeometryElement geomElement)
- throw(SALOME::SALOME_Exception);
+ getNumberOfElements(SALOME_MED::medGeometryElement geomElement)
+ throw(SALOME::SALOME_Exception);
CORBA::Long getNumberOfTypes() throw (SALOME::SALOME_Exception);
- SALOME_MED::long_array *
- getNumber(SALOME_MED::medGeometryElement geomElement)
- throw(SALOME::SALOME_Exception);
+ SALOME_MED::long_array *
+ getNumber(SALOME_MED::medGeometryElement geomElement)
+ throw(SALOME::SALOME_Exception);
/*!
* Same function as getNumber.
*/
- SALOME_MED::long_array *
- getNumberFromFile(SALOME_MED::medGeometryElement geomElement)
- throw(SALOME::SALOME_Exception);
+ SALOME_MED::long_array *
+ getNumberFromFile(SALOME_MED::medGeometryElement geomElement)
+ throw(SALOME::SALOME_Exception);
- SALOME_MED::long_array * getNumberIndex()
- throw(SALOME::SALOME_Exception);
+ SALOME_MED::long_array * getNumberIndex()
+ throw(SALOME::SALOME_Exception);
CORBA::Long
- getNumberOfGaussPoint(SALOME_MED::medGeometryElement geomElement)
- throw(SALOME::SALOME_Exception);
+ getNumberOfGaussPoint(SALOME_MED::medGeometryElement geomElement)
+ throw(SALOME::SALOME_Exception);
SALOME_MED::long_array* getNumbersOfGaussPoint()
- throw (SALOME::SALOME_Exception);
+ throw (SALOME::SALOME_Exception);
- SALOME_MED::medGeometryElement_array *getTypes()
- throw(SALOME::SALOME_Exception);
+ SALOME_MED::medGeometryElement_array *getTypes()
+ throw(SALOME::SALOME_Exception);
void getBoundaryElements() throw (SALOME::SALOME_Exception);
- CORBA::Long getCorbaIndex() throw(SALOME::SALOME_Exception);
+ CORBA::Long getCorbaIndex() throw(SALOME::SALOME_Exception);
SALOME_MED::SUPPORT::supportInfos * getSupportGlobal()
- throw (SALOME::SALOME_Exception);
+ throw (SALOME::SALOME_Exception);
- void createSeq() throw(SALOME::SALOME_Exception);
+ void createSeq() throw(SALOME::SALOME_Exception);
public: //public field
- const SMESHDS_SubMesh * _subMeshDS;
- ::SMESH_subMesh_i * _subMesh_i;
+ const SMESHDS_SubMesh * _subMeshDS;
+ ::SMESH_subMesh_i * _subMesh_i;
- SMESHDS_Mesh * _meshDS;
- std::string _name;
+ SMESHDS_Mesh * _meshDS;
+ std::string _name;
std::string _description;
- bool _isOnAllElements;
- bool _seqNumber;
- int _seqLength;
+ bool _isOnAllElements;
+ bool _seqNumber;
+ int _seqLength;
- SALOME_MED::medEntityMesh _entity;
- SALOME_MED::medGeometryElement * _geometricType;
- int _numberOfGeometricType;
+ SALOME_MED::medEntityMesh _entity;
+ SALOME_MED::medGeometryElement * _geometricType;
+ int _numberOfGeometricType;
protected:
- SMESH_MEDSupport_i();
- ~SMESH_MEDSupport_i();
+ SMESH_MEDSupport_i();
+ ~SMESH_MEDSupport_i();
};
#endif /* _MED_MEDSUPPORT_I_HXX_ */
}
};// struct TPreviewMesh
- static SMESH_NodeSearcher * myNodeSearcher = 0;
+ static SMESH_NodeSearcher * theNodeSearcher = 0;
+ static SMESH_ElementSearcher * theElementSearcher = 0;
//=============================================================================
/*!
- * \brief Deleter of myNodeSearcher at any compute event occured
+ * \brief Deleter of theNodeSearcher at any compute event occured
*/
//=============================================================================
- struct TNodeSearcherDeleter : public SMESH_subMeshEventListener
+ struct TSearchersDeleter : public SMESH_subMeshEventListener
{
SMESH_Mesh* myMesh;
//!< Constructor
- TNodeSearcherDeleter(): SMESH_subMeshEventListener( false ), // won't be deleted by submesh
- myMesh(0) {}
- //!< Delete myNodeSearcher
+ TSearchersDeleter(): SMESH_subMeshEventListener( false ), // won't be deleted by submesh
+ myMesh(0) {}
+ //!< Delete theNodeSearcher
static void Delete()
{
- if ( myNodeSearcher ) { delete myNodeSearcher; myNodeSearcher = 0; }
+ if ( theNodeSearcher ) delete theNodeSearcher; theNodeSearcher = 0;
+ if ( theElementSearcher ) delete theElementSearcher; theElementSearcher = 0;
}
typedef map < int, SMESH_subMesh * > TDependsOnMap;
//!< The meshod called by submesh: do my main job
Unset( sm->GetFather() );
}
}
- //!< set self on all submeshes and delete myNodeSearcher if other mesh is set
+ //!< set self on all submeshes and delete theNodeSearcher if other mesh is set
void Set(SMESH_Mesh* mesh)
{
- if ( myMesh && myMesh != mesh ) {
- Delete();
- Unset( myMesh );
- }
- myMesh = mesh;
- if ( SMESH_subMesh* myMainSubMesh = mesh->GetSubMeshContaining(1) ) {
- const TDependsOnMap & subMeshes = myMainSubMesh->DependsOn();
- TDependsOnMap::const_iterator sm;
- for (sm = subMeshes.begin(); sm != subMeshes.end(); sm++)
- sm->second->SetEventListener( this, 0, sm->second );
+ if ( myMesh != mesh )
+ {
+ if ( myMesh ) {
+ Delete();
+ Unset( myMesh );
+ }
+ myMesh = mesh;
+ if ( SMESH_subMesh* myMainSubMesh = mesh->GetSubMeshContaining(1) ) {
+ const TDependsOnMap & subMeshes = myMainSubMesh->DependsOn();
+ TDependsOnMap::const_iterator sm;
+ for (sm = subMeshes.begin(); sm != subMeshes.end(); sm++)
+ sm->second->SetEventListener( this, 0, sm->second );
+ }
}
}
//!< delete self from all submeshes
}
myMesh = 0;
}
- };
+
+ } theSearchersDeleter;
TCollection_AsciiString mirrorTypeName( SMESH::SMESH_MeshEditor::MirrorType theMirrorType )
{
*/
//================================================================================
-void SMESH_MeshEditor_i::initData()
+void SMESH_MeshEditor_i::initData(bool deleteSearchers)
{
if ( myPreviewMode ) {
myPreviewData = new SMESH::MeshPreviewStruct();
else {
myLastCreatedElems = new SMESH::long_array();
myLastCreatedNodes = new SMESH::long_array();
- TNodeSearcherDeleter::Delete();
+ if ( deleteSearchers )
+ TSearchersDeleter::Delete();
}
}
//=============================================================================
CORBA::Boolean
- SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array & IDsOfElements)
+SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array & IDsOfElements)
{
initData();
elem = GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3],
nodes[4], nodes[5], nodes[6], nodes[7]);
}
+ else if (NbNodes > 2) {
+ elem = GetMeshDS()->AddPolygonalFace(nodes);
+ }
// Update Python script
TPythonDump() << "faceID = " << this << ".AddFace( " << IDsOfNodes << " )";
* AddPolygonalFace
*/
//=============================================================================
-CORBA::Long SMESH_MeshEditor_i::AddPolygonalFace
- (const SMESH::long_array & IDsOfNodes)
+CORBA::Long SMESH_MeshEditor_i::AddPolygonalFace (const SMESH::long_array & IDsOfNodes)
{
initData();
nodes[i] = GetMeshDS()->FindNode(IDsOfNodes[i]);
const SMDS_MeshElement* elem = GetMeshDS()->AddPolygonalFace(nodes);
-
+
// Update Python script
TPythonDump() <<"faceID = "<<this<<".AddPolygonalFace( "<<IDsOfNodes<<" )";
#ifdef _DEBUG_
* AddPolyhedralVolume
*/
//=============================================================================
-CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolume
- (const SMESH::long_array & IDsOfNodes,
- const SMESH::long_array & Quantities)
+CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolume (const SMESH::long_array & IDsOfNodes,
+ const SMESH::long_array & Quantities)
{
initData();
* AddPolyhedralVolumeByFaces
*/
//=============================================================================
-CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolumeByFaces
- (const SMESH::long_array & IdsOfFaces)
+CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolumeByFaces (const SMESH::long_array & IdsOfFaces)
{
initData();
if ( isOut ) {
#ifdef _DEBUG_
MESSAGE ( "FACE " << FaceID << " (" << u << "," << v << ") out of "
- << " u( " << surf.FirstUParameter()
- << "," << surf.LastUParameter()
- << ") v( " << surf.FirstVParameter()
- << "," << surf.LastVParameter() << ")" );
+ << " u( " << surf.FirstUParameter()
+ << "," << surf.LastUParameter()
+ << ") v( " << surf.FirstVParameter()
+ << "," << surf.LastVParameter() << ")" );
#endif
THROW_SALOME_CORBA_EXCEPTION("Invalid UV", SALOME::BAD_PARAM);
}
mesh->SetMeshElementOnShape( elem, ShapeID );
}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long NodeID,
- CORBA::Double x,
- CORBA::Double y,
- CORBA::Double z)
-{
- initData();
-
- const SMDS_MeshNode * node = GetMeshDS()->FindNode( NodeID );
- if ( !node )
- return false;
-
- GetMeshDS()->MoveNode(node, x, y, z);
-
- // Update Python script
- TPythonDump() << "isDone = " << this << ".MoveNode( "
- << NodeID << ", " << x << ", " << y << ", " << z << " )";
-
- return true;
-}
-
//=============================================================================
/*!
*
//================================================================================
/*!
* \brief function for conversion long_array to TIDSortedElemSet
- * \param IDs - array of IDs
- * \param aMesh - mesh
- * \param aMap - collection to fill
- * \param aType - element type
+ * \param IDs - array of IDs
+ * \param aMesh - mesh
+ * \param aMap - collection to fill
+ * \param aType - element type
*/
//================================================================================
CORBA::Long ind = IDs[i];
const SMDS_MeshElement * elem =
(aType == SMDSAbs_Node ? aMesh->FindNode(ind)
- : aMesh->FindElement(ind));
+ : aMesh->FindElement(ind));
if ( elem && ( aType == SMDSAbs_All || elem->GetType() == aType ))
aMap.insert( elem );
}
//=======================================================================
CORBA::Boolean
- SMESH_MeshEditor_i::Smooth(const SMESH::long_array & IDsOfElements,
- const SMESH::long_array & IDsOfFixedNodes,
- CORBA::Long MaxNbOfIterations,
- CORBA::Double MaxAspectRatio,
- SMESH::SMESH_MeshEditor::Smooth_Method Method)
+SMESH_MeshEditor_i::Smooth(const SMESH::long_array & IDsOfElements,
+ const SMESH::long_array & IDsOfFixedNodes,
+ CORBA::Long MaxNbOfIterations,
+ CORBA::Double MaxAspectRatio,
+ SMESH::SMESH_MeshEditor::Smooth_Method Method)
{
return smooth( IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations,
- MaxAspectRatio, Method, false );
+ MaxAspectRatio, Method, false );
}
//=======================================================================
CORBA::Boolean
- SMESH_MeshEditor_i::SmoothParametric(const SMESH::long_array & IDsOfElements,
- const SMESH::long_array & IDsOfFixedNodes,
- CORBA::Long MaxNbOfIterations,
- CORBA::Double MaxAspectRatio,
- SMESH::SMESH_MeshEditor::Smooth_Method Method)
+SMESH_MeshEditor_i::SmoothParametric(const SMESH::long_array & IDsOfElements,
+ const SMESH::long_array & IDsOfFixedNodes,
+ CORBA::Long MaxNbOfIterations,
+ CORBA::Double MaxAspectRatio,
+ SMESH::SMESH_MeshEditor::Smooth_Method Method)
{
return smooth( IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations,
- MaxAspectRatio, Method, true );
+ MaxAspectRatio, Method, true );
}
//=======================================================================
CORBA::Boolean
- SMESH_MeshEditor_i::SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::long_array & IDsOfFixedNodes,
- CORBA::Long MaxNbOfIterations,
- CORBA::Double MaxAspectRatio,
- SMESH::SMESH_MeshEditor::Smooth_Method Method)
+SMESH_MeshEditor_i::SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::long_array & IDsOfFixedNodes,
+ CORBA::Long MaxNbOfIterations,
+ CORBA::Double MaxAspectRatio,
+ SMESH::SMESH_MeshEditor::Smooth_Method Method)
{
return smoothObject (theObject, IDsOfFixedNodes, MaxNbOfIterations,
MaxAspectRatio, Method, false);
//=======================================================================
CORBA::Boolean
- SMESH_MeshEditor_i::SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::long_array & IDsOfFixedNodes,
- CORBA::Long MaxNbOfIterations,
- CORBA::Double MaxAspectRatio,
- SMESH::SMESH_MeshEditor::Smooth_Method Method)
+SMESH_MeshEditor_i::SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::long_array & IDsOfFixedNodes,
+ CORBA::Long MaxNbOfIterations,
+ CORBA::Double MaxAspectRatio,
+ SMESH::SMESH_MeshEditor::Smooth_Method Method)
{
return smoothObject (theObject, IDsOfFixedNodes, MaxNbOfIterations,
MaxAspectRatio, Method, true);
//=============================================================================
CORBA::Boolean
- SMESH_MeshEditor_i::smooth(const SMESH::long_array & IDsOfElements,
- const SMESH::long_array & IDsOfFixedNodes,
- CORBA::Long MaxNbOfIterations,
- CORBA::Double MaxAspectRatio,
- SMESH::SMESH_MeshEditor::Smooth_Method Method,
- bool IsParametric)
+SMESH_MeshEditor_i::smooth(const SMESH::long_array & IDsOfElements,
+ const SMESH::long_array & IDsOfFixedNodes,
+ CORBA::Long MaxNbOfIterations,
+ CORBA::Double MaxAspectRatio,
+ SMESH::SMESH_MeshEditor::Smooth_Method Method,
+ bool IsParametric)
{
initData();
}
//=======================================================================
- /*!
- * \brief Return groups by their IDs
- */
+/*!
+ * \brief Return groups by their IDs
+ */
//=======================================================================
SMESH::ListOfGroups* SMESH_MeshEditor_i::getGroups(const std::list<int>* groupIDs)
CORBA::Long theNbOfSteps,
CORBA::Double theTolerance,
const bool theMakeGroups,
- const SMDSAbs_ElementType theElementType)
+ const SMDSAbs_ElementType theElementType)
{
initData();
::SMESH_MeshEditor anEditor( mesh );
::SMESH_MeshEditor::PGroupIDs groupIds =
- anEditor.RotationSweep (*workElements, Ax1, theAngleInRadians,
- theNbOfSteps, theTolerance, theMakeGroups, makeWalls);
+ anEditor.RotationSweep (*workElements, Ax1, theAngleInRadians,
+ theNbOfSteps, theTolerance, theMakeGroups, makeWalls);
storeResult(anEditor);
return theMakeGroups ? getGroups(groupIds.get()) : 0;
//=======================================================================
void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
{
if ( !myPreviewMode ) {
TPythonDump() << this << ".RotationSweepObject( "
//=======================================================================
void SMESH_MeshEditor_i::RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
{
if ( !myPreviewMode ) {
TPythonDump() << this << ".RotationSweepObject1D( "
theNbOfSteps,
theTolerance,
false,
- SMDSAbs_Edge);
+ SMDSAbs_Edge);
}
//=======================================================================
//=======================================================================
void SMESH_MeshEditor_i::RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
{
if ( !myPreviewMode ) {
TPythonDump() << this << ".RotationSweepObject2D( "
theNbOfSteps,
theTolerance,
false,
- SMDSAbs_Face);
+ SMDSAbs_Face);
}
//=======================================================================
DumpGroupsList(aPythonDump,aGroups);
aPythonDump<< this << ".RotationSweepObjectMakeGroups( "
<< theObject << ", "
- << theAxis << ", "
+ << theAxis << ", "
<< theAngleInRadians << ", "
<< theNbOfSteps << ", "
<< theTolerance << " )";
SMESH::ListOfGroups*
SMESH_MeshEditor_i::RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct& theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
theNbOfSteps,
theTolerance,
true,
- SMDSAbs_Edge);
+ SMDSAbs_Edge);
if ( !myPreviewMode ) {
TPythonDump aPythonDump;
DumpGroupsList(aPythonDump,aGroups);
aPythonDump<< this << ".RotationSweepObject1DMakeGroups( "
<< theObject << ", "
- << theAxis << ", "
+ << theAxis << ", "
<< theAngleInRadians << ", "
<< theNbOfSteps << ", "
<< theTolerance << " )";
SMESH::ListOfGroups*
SMESH_MeshEditor_i::RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct& theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
theNbOfSteps,
theTolerance,
true,
- SMDSAbs_Face);
+ SMDSAbs_Face);
if ( !myPreviewMode ) {
TPythonDump aPythonDump;
DumpGroupsList(aPythonDump,aGroups);
aPythonDump<< this << ".RotationSweepObject2DMakeGroups( "
<< theObject << ", "
- << theAxis << ", "
+ << theAxis << ", "
<< theAngleInRadians << ", "
<< theNbOfSteps << ", "
<< theTolerance << " )";
//=======================================================================
void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps)
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps)
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false );
CORBA::Long theNbOfSteps)
{
SMESH::ListOfGroups* aGroups = extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, true );
-
+
if ( !myPreviewMode ) {
TPythonDump aPythonDump;
DumpGroupsList(aPythonDump,aGroups);
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true );
-
+
if ( !myPreviewMode ) {
TPythonDump aPythonDump;
DumpGroupsList(aPythonDump,aGroups);
TPythonDump aPythonDump;
DumpGroupsList(aPythonDump,aGroups);
aPythonDump << this << ".ExtrusionSweepObject1DMakeGroups( "
- << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
+ << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
}
return aGroups;
}
TPythonDump aPythonDump;
DumpGroupsList(aPythonDump,aGroups);
aPythonDump << this << ".ExtrusionSweepObject2DMakeGroups( "
- << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
+ << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
}
return aGroups;
}
//=======================================================================
void SMESH_MeshEditor_i::AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps,
- CORBA::Long theExtrFlags,
- CORBA::Double theSewTolerance)
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps,
+ CORBA::Long theExtrFlags,
+ CORBA::Double theSewTolerance)
{
if ( !myPreviewMode ) {
TPythonDump() << "stepVector = " << theStepVector;
CORBA::Double theSewTolerance)
{
SMESH::ListOfGroups * aGroups = advancedExtrusion( theIDsOfElements,
- theStepVector,
- theNbOfSteps,
- theExtrFlags,
- theSewTolerance,
- true);
-
+ theStepVector,
+ theNbOfSteps,
+ theExtrFlags,
+ theSewTolerance,
+ true);
+
if ( !myPreviewMode ) {
TPythonDump() << "stepVector = " << theStepVector;
TPythonDump aPythonDump;
static SMESH::SMESH_MeshEditor::Extrusion_Error convExtrError( const::SMESH_MeshEditor::Extrusion_Error e )
{
switch ( e ) {
- RETCASE( EXTR_OK );
- RETCASE( EXTR_NO_ELEMENTS );
- RETCASE( EXTR_PATH_NOT_EDGE );
- RETCASE( EXTR_BAD_PATH_SHAPE );
- RETCASE( EXTR_BAD_STARTING_NODE );
- RETCASE( EXTR_BAD_ANGLES_NUMBER );
- RETCASE( EXTR_CANT_GET_TANGENT );
+ RETCASE( EXTR_OK );
+ RETCASE( EXTR_NO_ELEMENTS );
+ RETCASE( EXTR_PATH_NOT_EDGE );
+ RETCASE( EXTR_BAD_PATH_SHAPE );
+ RETCASE( EXTR_BAD_STARTING_NODE );
+ RETCASE( EXTR_BAD_ANGLES_NUMBER );
+ RETCASE( EXTR_CANT_GET_TANGENT );
}
return SMESH::SMESH_MeshEditor::EXTR_OK;
}
const SMESH::PointStruct & theRefPoint,
const bool theMakeGroups,
SMESH::SMESH_MeshEditor::Extrusion_Error & theError,
- const SMDSAbs_ElementType theElementType)
+ const SMDSAbs_ElementType theElementType)
{
initData();
SMESH::ListOfGroups*
SMESH_MeshEditor_i::extrusionAlongPathX(const SMESH::long_array & IDsOfElements,
- SMESH::SMESH_IDSource_ptr Path,
- CORBA::Long NodeStart,
- CORBA::Boolean HasAngles,
- const SMESH::double_array& Angles,
- CORBA::Boolean LinearVariation,
- CORBA::Boolean HasRefPoint,
- const SMESH::PointStruct& RefPoint,
- const bool MakeGroups,
- const SMDSAbs_ElementType ElementType,
- SMESH::SMESH_MeshEditor::Extrusion_Error & Error)
+ SMESH::SMESH_IDSource_ptr Path,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array& Angles,
+ CORBA::Boolean LinearVariation,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct& RefPoint,
+ const bool MakeGroups,
+ const SMDSAbs_ElementType ElementType,
+ SMESH::SMESH_MeshEditor::Extrusion_Error & Error)
{
SMESH::ListOfGroups* EmptyGr = new SMESH::ListOfGroups;
return EmptyGr;
}
error = anEditor.ExtrusionAlongTrack( elements, &(aMeshImp->GetImpl()), aNodeStart,
- HasAngles, angles, LinearVariation,
- HasRefPoint, refPnt, MakeGroups );
+ HasAngles, angles, LinearVariation,
+ HasRefPoint, refPnt, MakeGroups );
}
else {
SMESH_subMesh_i* aSubMeshImp = SMESH::DownCast<SMESH_subMesh_i*>( Path );
SMESH::SMESH_Mesh_ptr aPathMesh = aSubMeshImp->GetFather();
aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( aPathMesh );
SMDS_MeshNode* aNodeStart =
- (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(NodeStart);
+ (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(NodeStart);
if ( !aNodeStart ) {
- Error = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
- return EmptyGr;
+ Error = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
+ return EmptyGr;
}
SMESH_subMesh* aSubMesh =
- aMeshImp->GetImpl().GetSubMeshContaining(aSubMeshImp->GetId());
+ aMeshImp->GetImpl().GetSubMeshContaining(aSubMeshImp->GetId());
error = anEditor.ExtrusionAlongTrack( elements, aSubMesh, aNodeStart,
- HasAngles, angles, LinearVariation,
- HasRefPoint, refPnt, MakeGroups );
+ HasAngles, angles, LinearVariation,
+ HasRefPoint, refPnt, MakeGroups );
}
else {
SMESH_Group_i* aGroupImp = SMESH::DownCast<SMESH_Group_i*>( Path );
if(aGroupImp) {
- // path as group of 1D elements
+ // path as group of 1D elements
}
else {
- // invalid path
- Error = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
- return EmptyGr;
+ // invalid path
+ Error = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
+ return EmptyGr;
}
}
}
//=======================================================================
SMESH::SMESH_MeshEditor::Extrusion_Error
- SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array & theIDsOfElements,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array & theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct & theRefPoint)
+SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array & theIDsOfElements,
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array & theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct & theRefPoint)
{
if ( !myPreviewMode ) {
TPythonDump() << "error = " << this << ".ExtrusionAlongPath( "
SMESH::SMESH_MeshEditor::Extrusion_Error
SMESH_MeshEditor_i::ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array & theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct & theRefPoint)
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array & theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct & theRefPoint)
{
if ( !myPreviewMode ) {
TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject1D( "
theRefPoint,
false,
anError,
- SMDSAbs_Edge);
+ SMDSAbs_Edge);
return anError;
}
SMESH::SMESH_MeshEditor::Extrusion_Error
SMESH_MeshEditor_i::ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array & theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct & theRefPoint)
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array & theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct & theRefPoint)
{
if ( !myPreviewMode ) {
TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject2D( "
theRefPoint,
false,
anError,
- SMDSAbs_Face);
+ SMDSAbs_Face);
return anError;
}
const SMESH::PointStruct& theRefPoint,
SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
{
- SMESH::ListOfGroups * aGroups = extrusionAlongPath( theIDsOfElements,
- thePathMesh,
- thePathShape,
- theNodeStart,
- theHasAngles,
- theAngles,
- theHasRefPoint,
- theRefPoint,
- true,
- Error);
+ SMESH::ListOfGroups * aGroups = extrusionAlongPath( theIDsOfElements,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ true,
+ Error);
if ( !myPreviewMode ) {
bool isDumpGroups = aGroups && aGroups->length() > 0;
TPythonDump aPythonDump;
aPythonDump << ", error)";
else
aPythonDump <<"error";
-
+
aPythonDump<<" = "<< this << ".ExtrusionAlongPathMakeGroups( "
<< theIDsOfElements << ", "
<< thePathMesh << ", "
theRefPoint,
true,
Error);
-
+
if ( !myPreviewMode ) {
bool isDumpGroups = aGroups && aGroups->length() > 0;
TPythonDump aPythonDump;
<< theNodeStart << ", "
<< theHasAngles << ", "
<< theAngles << ", "
- << theHasRefPoint << ", "
- << "SMESH.PointStruct( "
- << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
}
return aGroups;
}
SMESH::ListOfGroups* SMESH_MeshEditor_i::
ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array& theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct& theRefPoint,
- SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array& theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct& theRefPoint,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
theRefPoint,
true,
Error,
- SMDSAbs_Edge);
-
+ SMDSAbs_Edge);
+
if ( !myPreviewMode ) {
bool isDumpGroups = aGroups && aGroups->length() > 0;
TPythonDump aPythonDump;
<< theNodeStart << ", "
<< theHasAngles << ", "
<< theAngles << ", "
- << theHasRefPoint << ", "
- << "SMESH.PointStruct( "
- << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
}
return aGroups;
}
SMESH::ListOfGroups* SMESH_MeshEditor_i::
ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array& theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct& theRefPoint,
- SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array& theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct& theRefPoint,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
theRefPoint,
true,
Error,
- SMDSAbs_Face);
-
+ SMDSAbs_Face);
+
if ( !myPreviewMode ) {
bool isDumpGroups = aGroups && aGroups->length() > 0;
TPythonDump aPythonDump;
<< theNodeStart << ", "
<< theHasAngles << ", "
<< theAngles << ", "
- << theHasRefPoint << ", "
- << "SMESH.PointStruct( "
- << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
}
return aGroups;
}
//=======================================================================
SMESH::ListOfGroups* SMESH_MeshEditor_i::
ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object,
- SMESH::SMESH_IDSource_ptr Path,
- CORBA::Long NodeStart,
- CORBA::Boolean HasAngles,
- const SMESH::double_array& Angles,
- CORBA::Boolean LinearVariation,
- CORBA::Boolean HasRefPoint,
- const SMESH::PointStruct& RefPoint,
- CORBA::Boolean MakeGroups,
- SMESH::ElementType ElemType,
- SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
+ SMESH::SMESH_IDSource_ptr Path,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array& Angles,
+ CORBA::Boolean LinearVariation,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct& RefPoint,
+ CORBA::Boolean MakeGroups,
+ SMESH::ElementType ElemType,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
{
SMESH::long_array_var anElementsId = Object->GetIDs();
SMESH::ListOfGroups * aGroups = extrusionAlongPathX(anElementsId,
- Path,
- NodeStart,
- HasAngles,
- Angles,
- LinearVariation,
- HasRefPoint,
- RefPoint,
- MakeGroups,
- (SMDSAbs_ElementType)ElemType,
- Error);
-
+ Path,
+ NodeStart,
+ HasAngles,
+ Angles,
+ LinearVariation,
+ HasRefPoint,
+ RefPoint,
+ MakeGroups,
+ (SMDSAbs_ElementType)ElemType,
+ Error);
+
if ( !myPreviewMode ) {
bool isDumpGroups = aGroups && aGroups->length() > 0;
TPythonDump aPythonDump;
<< NodeStart << ", "
<< HasAngles << ", "
<< Angles << ", "
- << LinearVariation << ", "
- << HasRefPoint << ", "
- << "SMESH.PointStruct( "
- << ( HasRefPoint ? RefPoint.x : 0 ) << ", "
- << ( HasRefPoint ? RefPoint.y : 0 ) << ", "
- << ( HasRefPoint ? RefPoint.z : 0 ) << " ), "
- << ElemType << " )";
+ << LinearVariation << ", "
+ << HasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( HasRefPoint ? RefPoint.x : 0 ) << ", "
+ << ( HasRefPoint ? RefPoint.y : 0 ) << ", "
+ << ( HasRefPoint ? RefPoint.z : 0 ) << " ), "
+ << MakeGroups << ", "
+ << ElemType << " )";
}
return aGroups;
}
//=======================================================================
SMESH::ListOfGroups* SMESH_MeshEditor_i::
ExtrusionAlongPathX(const SMESH::long_array& IDsOfElements,
- SMESH::SMESH_IDSource_ptr Path,
- CORBA::Long NodeStart,
- CORBA::Boolean HasAngles,
- const SMESH::double_array& Angles,
- CORBA::Boolean LinearVariation,
- CORBA::Boolean HasRefPoint,
- const SMESH::PointStruct& RefPoint,
- CORBA::Boolean MakeGroups,
- SMESH::ElementType ElemType,
- SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
+ SMESH::SMESH_IDSource_ptr Path,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array& Angles,
+ CORBA::Boolean LinearVariation,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct& RefPoint,
+ CORBA::Boolean MakeGroups,
+ SMESH::ElementType ElemType,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
{
SMESH::ListOfGroups * aGroups = extrusionAlongPathX(IDsOfElements,
- Path,
- NodeStart,
- HasAngles,
- Angles,
- LinearVariation,
- HasRefPoint,
- RefPoint,
- MakeGroups,
- (SMDSAbs_ElementType)ElemType,
- Error);
-
+ Path,
+ NodeStart,
+ HasAngles,
+ Angles,
+ LinearVariation,
+ HasRefPoint,
+ RefPoint,
+ MakeGroups,
+ (SMDSAbs_ElementType)ElemType,
+ Error);
+
if ( !myPreviewMode ) {
bool isDumpGroups = aGroups && aGroups->length() > 0;
TPythonDump aPythonDump;
<< NodeStart << ", "
<< HasAngles << ", "
<< Angles << ", "
- << LinearVariation << ", "
- << HasRefPoint << ", "
- << "SMESH.PointStruct( "
- << ( HasRefPoint ? RefPoint.x : 0 ) << ", "
- << ( HasRefPoint ? RefPoint.y : 0 ) << ", "
- << ( HasRefPoint ? RefPoint.z : 0 ) << " ), "
- << ElemType << " )";
+ << LinearVariation << ", "
+ << HasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( HasRefPoint ? RefPoint.x : 0 ) << ", "
+ << ( HasRefPoint ? RefPoint.y : 0 ) << ", "
+ << ( HasRefPoint ? RefPoint.z : 0 ) << " ), "
+ << ElemType << " )";
}
return aGroups;
}
/*!
* \brief Compute rotation angles for ExtrusionAlongPath as linear variation
* of given angles along path steps
- * \param PathMesh mesh containing a 1D sub-mesh on the edge, along
- * which proceeds the extrusion
- * \param PathShape is shape(edge); as the mesh can be complex, the edge
- * is used to define the sub-mesh for the path
+ * \param PathMesh mesh containing a 1D sub-mesh on the edge, along
+ * which proceeds the extrusion
+ * \param PathShape is shape(edge); as the mesh can be complex, the edge
+ * is used to define the sub-mesh for the path
*/
//================================================================================
int iP = int( angPrevFloor );
double angPrevCeil = ceil(angPrev);
angle = ( angPrevCeil - angPrev ) * theAngles[ iP ];
-
+
int iC = int( angCurFloor );
if ( iC < nbAngles )
angle += ( angCur - angCurFloor ) * theAngles[ iC ];
//=======================================================================
void SMESH_MeshEditor_i::MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & theAxis,
- SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
- CORBA::Boolean theCopy)
+ const SMESH::AxisStruct & theAxis,
+ SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
+ CORBA::Boolean theCopy)
{
if ( !myPreviewMode ) {
TPythonDump() << this << ".MirrorObject( "
SMESH::SMESH_Mesh_var mesh;
{ // open new scope to dump "MakeMesh" command
// and then "GetGroups" using SMESH_Mesh::GetGroups()
-
+
TPythonDump pydump; // to prevent dump at mesh creation
mesh = makeMesh( theMeshName );
false, theCopyGroups, & mesh_i->GetImpl());
mesh_i->CreateGroupServants();
}
-
+
if ( !myPreviewMode ) {
pydump << mesh << " = " << this << ".MirrorMakeMesh( "
<< theIDsOfElements << ", "
//dump "GetGroups"
if(!myPreviewMode && mesh_i)
mesh_i->GetGroups();
-
+
return mesh._retn();
}
SMESH::SMESH_Mesh_var mesh;
{ // open new scope to dump "MakeMesh" command
// and then "GetGroups" using SMESH_Mesh::GetGroups()
-
+
TPythonDump pydump; // to prevent dump at mesh creation
mesh = makeMesh( theMeshName );
//dump "GetGroups"
if(!myPreviewMode && mesh_i)
mesh_i->GetGroups();
-
+
return mesh._retn();
}
//=======================================================================
void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct & theVector,
- CORBA::Boolean theCopy)
+ const SMESH::DirStruct & theVector,
+ CORBA::Boolean theCopy)
{
if ( !myPreviewMode ) {
TPythonDump() << this << ".TranslateObject( "
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
SMESH::ListOfGroups * aGroups = translate(anElementsId, theVector, true, true);
-
+
if ( !myPreviewMode ) {
TPythonDump aPythonDump;
{
SMESH_Mesh_i* mesh_i;
SMESH::SMESH_Mesh_var mesh;
-
+
{ // open new scope to dump "MakeMesh" command
// and then "GetGroups" using SMESH_Mesh::GetGroups()
TPythonDump pydump; // to prevent dump at mesh creation
-
+
mesh = makeMesh( theMeshName );
mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
-
+
if ( mesh_i ) {
translate(theIDsOfElements, theVector,
false, theCopyGroups, & mesh_i->GetImpl());
mesh_i->CreateGroupServants();
}
-
+
if ( !myPreviewMode ) {
pydump << mesh << " = " << this << ".TranslateMakeMesh( "
<< theIDsOfElements << ", "
<< theMeshName << "' )";
}
}
-
+
//dump "GetGroups"
if(!myPreviewMode && mesh_i)
mesh_i->GetGroups();
-
+
return mesh._retn();
}
SMESH::SMESH_Mesh_var mesh;
{ // open new scope to dump "MakeMesh" command
// and then "GetGroups" using SMESH_Mesh::GetGroups()
-
+
TPythonDump pydump; // to prevent dump at mesh creation
mesh = makeMesh( theMeshName );
mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
-
+
if ( mesh_i ) {
SMESH::long_array_var anElementsId = theObject->GetIDs();
translate(anElementsId, theVector,
<< theMeshName << "' )";
}
}
-
+
//dump "GetGroups"
if(!myPreviewMode && mesh_i)
mesh_i->GetGroups();
-
+
return mesh._retn();
}
//=======================================================================
void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & theAxis,
- CORBA::Double theAngle,
- CORBA::Boolean theCopy)
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngle,
+ CORBA::Boolean theCopy)
{
if ( !myPreviewMode ) {
TPythonDump() << this << ".RotateObject( "
DumpGroupsList(aPythonDump,aGroups);
aPythonDump << this << ".RotateMakeGroups( "
<< theIDsOfElements << ", "
- << theAxis << ", "
+ << theAxis << ", "
<< theAngle << " )";
}
return aGroups;
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
SMESH::ListOfGroups * aGroups = rotate(anElementsId,theAxis,theAngle,true,true);
-
+
if ( !myPreviewMode ) {
TPythonDump aPythonDump;
DumpGroupsList(aPythonDump,aGroups);
aPythonDump << this << ".RotateObjectMakeGroups( "
- << theObject << ", "
- << theAxis << ", "
- << theAngle << " )";
+ << theObject << ", "
+ << theAxis << ", "
+ << theAngle << " )";
}
return aGroups;
}
{ // open new scope to dump "MakeMesh" command
// and then "GetGroups" using SMESH_Mesh::GetGroups()
-
+
TPythonDump pydump; // to prevent dump at mesh creation
mesh = makeMesh( theMeshName );
mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
-
+
if ( mesh_i ) {
rotate(theIDsOfElements, theAxis, theAngleInRadians,
false, theCopyGroups, & mesh_i->GetImpl());
<< theMeshName << "' )";
}
}
-
+
//dump "GetGroups"
if(!myPreviewMode && mesh_i)
mesh_i->GetGroups();
-
+
return mesh._retn();
}
{
SMESH::SMESH_Mesh_var mesh;
SMESH_Mesh_i* mesh_i;
-
+
{// open new scope to dump "MakeMesh" command
// and then "GetGroups" using SMESH_Mesh::GetGroups()
-
+
TPythonDump pydump; // to prevent dump at mesh creation
mesh = makeMesh( theMeshName );
mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
-
+
if (mesh_i ) {
SMESH::long_array_var anElementsId = theObject->GetIDs();
rotate(anElementsId, theAxis, theAngleInRadians,
<< theMeshName << "' )";
}
}
-
+
//dump "GetGroups"
if(!myPreviewMode && mesh_i)
mesh_i->GetGroups();
-
+
return mesh._retn();
}
set<const SMDS_MeshNode*> nodes;
if ( !CORBA::is_nil(SMESH::SMESH_GroupBase::_narrow(theObject)) &&
- SMESH::SMESH_GroupBase::_narrow(theObject)->GetType() == SMESH::NODE) {
+ SMESH::SMESH_GroupBase::_narrow(theObject)->GetType() == SMESH::NODE) {
for(int i = 0; i < aElementsId->length(); i++) {
CORBA::Long ind = aElementsId[i];
const SMDS_MeshNode * elem = aMesh->FindNode(ind);
}
}
}
-
-
+
+
::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
::SMESH_MeshEditor anEditor( myMesh );
if(!nodes.empty())
anEditor.FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes );
-
+
GroupsOfNodes = new SMESH::array_of_long_array;
GroupsOfNodes->length( aListOfListOfNodes.size() );
::SMESH_MeshEditor::TListOfListOfNodes::iterator llIt = aListOfListOfNodes.begin();
//purpose :
//=======================================================================
void SMESH_MeshEditor_i::FindEqualElements(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::array_of_long_array_out GroupsOfElementsID)
+ SMESH::array_of_long_array_out GroupsOfElementsID)
{
initData();
if ( !(!CORBA::is_nil(SMESH::SMESH_GroupBase::_narrow(theObject)) &&
- SMESH::SMESH_GroupBase::_narrow(theObject)->GetType() == SMESH::NODE) ) {
+ SMESH::SMESH_GroupBase::_narrow(theObject)->GetType() == SMESH::NODE) ) {
typedef list<int> TListOfIDs;
set<const SMDS_MeshElement*> elems;
SMESH::long_array_var aElementsId = theObject->GetIDs();
CORBA::Long anID = aElementsId[i];
const SMDS_MeshElement * elem = aMesh->FindElement(anID);
if (elem) {
- elems.insert(elem);
+ elems.insert(elem);
}
}
aGroup.length( listOfIDs.size() );
TListOfIDs::iterator idIt = listOfIDs.begin();
for (int k = 0; idIt != listOfIDs.end(); ++idIt, ++k ) {
- aGroup[ k ] = *idIt;
+ aGroup[ k ] = *idIt;
}
}
- TPythonDump() << "equal_elements = " << this << ".FindEqualElements( "
- <<theObject<<" )";
+ TPythonDump() << "equal_elements = " << this << ".FindEqualElements( "
+ <<theObject<<" )";
}
}
TPythonDump() << this << ".MergeEqualElements()";
}
+//=============================================================================
+/*!
+ * Move the node to a given point
+ */
+//=============================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long NodeID,
+ CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z)
+{
+ initData(/*deleteSearchers=*/false);
+
+ const SMDS_MeshNode * node = GetMeshDS()->FindNode( NodeID );
+ if ( !node )
+ return false;
+
+ if ( theNodeSearcher )
+ theSearchersDeleter.Set( myMesh ); // remove theNodeSearcher if mesh is other
+
+ if ( theNodeSearcher ) // move node and update theNodeSearcher data accordingly
+ theNodeSearcher->MoveNode(node, gp_Pnt( x,y,z ));
+ else
+ GetMeshDS()->MoveNode(node, x, y, z);
+
+ // Update Python script
+ TPythonDump() << "isDone = " << this << ".MoveNode( "
+ << NodeID << ", " << x << ", " << y << ", " << z << " )";
+
+ return true;
+}
+
+//================================================================================
+/*!
+ * \brief Return ID of node closest to a given point
+ */
+//================================================================================
+
+CORBA::Long SMESH_MeshEditor_i::FindNodeClosestTo(CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z)
+{
+ theSearchersDeleter.Set( myMesh ); // remove theNodeSearcher if mesh is other
+
+ if ( !theNodeSearcher ) {
+ ::SMESH_MeshEditor anEditor( myMesh );
+ theNodeSearcher = anEditor.GetNodeSearcher();
+ }
+ gp_Pnt p( x,y,z );
+ if ( const SMDS_MeshNode* node = theNodeSearcher->FindClosestTo( p ))
+ return node->GetID();
+
+ return 0;
+}
+
//================================================================================
/*!
* \brief If the given ID is a valid node ID (nodeID > 0), just move this node, else
CORBA::Double z,
CORBA::Long theNodeID)
{
- // We keep myNodeSearcher until any mesh modification:
- // 1) initData() deletes myNodeSearcher at any edition,
- // 2) TNodeSearcherDeleter - at any mesh compute event and mesh change
+ // We keep theNodeSearcher until any mesh modification:
+ // 1) initData() deletes theNodeSearcher at any edition,
+ // 2) TSearchersDeleter - at any mesh compute event and mesh change
- initData();
+ initData(/*deleteSearchers=*/false);
+
+ theSearchersDeleter.Set( myMesh ); // remove theNodeSearcher if mesh is other
int nodeID = theNodeID;
const SMDS_MeshNode* node = GetMeshDS()->FindNode( nodeID );
- if ( !node )
+ if ( !node ) // preview moving node
{
- static TNodeSearcherDeleter deleter;
- deleter.Set( myMesh );
- if ( !myNodeSearcher ) {
+ if ( !theNodeSearcher ) {
::SMESH_MeshEditor anEditor( myMesh );
- myNodeSearcher = anEditor.GetNodeSearcher();
+ theNodeSearcher = anEditor.GetNodeSearcher();
}
gp_Pnt p( x,y,z );
- node = myNodeSearcher->FindClosestTo( p );
+ node = theNodeSearcher->FindClosestTo( p );
}
if ( node ) {
nodeID = node->GetID();
::SMESH_MeshEditor anEditor( & tmpMesh );
storeResult( anEditor );
}
+ else if ( theNodeSearcher ) // move node and update theNodeSearcher data accordingly
+ {
+ theNodeSearcher->MoveNode(node, gp_Pnt( x,y,z ));
+ }
else
{
GetMeshDS()->MoveNode(node, x, y, z);
return nodeID;
}
+//=======================================================================
+/*!
+ * Return elements of given type where the given point is IN or ON.
+ *
+ * 'ALL' type means elements of any type excluding nodes
+ */
+//=======================================================================
+
+SMESH::long_array* SMESH_MeshEditor_i::FindElementsByPoint(CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z,
+ SMESH::ElementType type)
+{
+ SMESH::long_array_var res = new SMESH::long_array;
+ vector< const SMDS_MeshElement* > foundElems;
+
+ theSearchersDeleter.Set( myMesh );
+ if ( !theElementSearcher ) {
+ ::SMESH_MeshEditor anEditor( myMesh );
+ theElementSearcher = anEditor.GetElementSearcher();
+ }
+ theElementSearcher->FindElementsByPoint( gp_Pnt( x,y,z ),
+ SMDSAbs_ElementType( type ),
+ foundElems);
+ res->length( foundElems.size() );
+ for ( int i = 0; i < foundElems.size(); ++i )
+ res[i] = foundElems[i]->GetID();
+
+ if ( !myPreviewMode ) // call from tui
+ TPythonDump() << res << " = " << this << ".FindElementsByPoint( "
+ << x << ", "
+ << y << ", "
+ << z << ", "
+ << type << " )";
+
+ return res._retn();
+}
+
//=======================================================================
//function : convError
//purpose :
static SMESH::SMESH_MeshEditor::Sew_Error convError( const::SMESH_MeshEditor::Sew_Error e )
{
switch ( e ) {
- RETCASE( SEW_OK );
- RETCASE( SEW_BORDER1_NOT_FOUND );
- RETCASE( SEW_BORDER2_NOT_FOUND );
- RETCASE( SEW_BOTH_BORDERS_NOT_FOUND );
- RETCASE( SEW_BAD_SIDE_NODES );
- RETCASE( SEW_VOLUMES_TO_SPLIT );
- RETCASE( SEW_DIFF_NB_OF_ELEMENTS );
- RETCASE( SEW_TOPO_DIFF_SETS_OF_ELEMENTS );
- RETCASE( SEW_BAD_SIDE1_NODES );
- RETCASE( SEW_BAD_SIDE2_NODES );
+ RETCASE( SEW_OK );
+ RETCASE( SEW_BORDER1_NOT_FOUND );
+ RETCASE( SEW_BORDER2_NOT_FOUND );
+ RETCASE( SEW_BOTH_BORDERS_NOT_FOUND );
+ RETCASE( SEW_BAD_SIDE_NODES );
+ RETCASE( SEW_VOLUMES_TO_SPLIT );
+ RETCASE( SEW_DIFF_NB_OF_ELEMENTS );
+ RETCASE( SEW_TOPO_DIFF_SETS_OF_ELEMENTS );
+ RETCASE( SEW_BAD_SIDE1_NODES );
+ RETCASE( SEW_BAD_SIDE2_NODES );
}
return SMESH::SMESH_MeshEditor::SEW_OK;
}
//=======================================================================
SMESH::SMESH_MeshEditor::Sew_Error
- SMESH_MeshEditor_i::SewFreeBorders(CORBA::Long FirstNodeID1,
- CORBA::Long SecondNodeID1,
- CORBA::Long LastNodeID1,
- CORBA::Long FirstNodeID2,
- CORBA::Long SecondNodeID2,
- CORBA::Long LastNodeID2,
- CORBA::Boolean CreatePolygons,
- CORBA::Boolean CreatePolyedrs)
+SMESH_MeshEditor_i::SewFreeBorders(CORBA::Long FirstNodeID1,
+ CORBA::Long SecondNodeID1,
+ CORBA::Long LastNodeID1,
+ CORBA::Long FirstNodeID2,
+ CORBA::Long SecondNodeID2,
+ CORBA::Long LastNodeID2,
+ CORBA::Boolean CreatePolygons,
+ CORBA::Boolean CreatePolyedrs)
{
initData();
//================================================================================
/*!
* \brief Set new nodes for given element
- * \param ide - element id
- * \param newIDs - new node ids
- * \retval CORBA::Boolean - true if result is OK
+ * \param ide - element id
+ * \param newIDs - new node ids
+ * \retval CORBA::Boolean - true if result is OK
*/
//================================================================================
return GetMeshDS()->ChangeElementNodes( elem, & aNodes[0], nbn1+1 );
}
-
+
//================================================================================
/*!
* \brief Update myLastCreated* or myPreviewData
- * \param anEditor - it contains last modification results
+ * \param anEditor - it contains last modification results
*/
//================================================================================
/*if (aMeshElem->GetType() == SMDSAbs_Volume) {
aType = SMDSAbs_Node;
isPoly = false;
- }
- else*/ {
+ }
+ else*/ {
aType = aMeshElem->GetType();
isPoly = aMeshElem->IsPoly();
}
myPreviewData->elementConnectivities.length(aNodesConnectivity.size());
for( int i = 0; aConnIter != aNodesConnectivity.end(); aConnIter++, i++ )
myPreviewData->elementConnectivities[i] = *aConnIter;
-
+
return;
}
//================================================================================
/*!
* \brief Returns list of it's IDs of created nodes
- * \retval SMESH::long_array* - list of node ID
+ * \retval SMESH::long_array* - list of node ID
*/
//================================================================================
//================================================================================
/*!
* \brief Returns list of it's IDs of created elements
- * \retval SMESH::long_array* - list of elements' ID
+ * \retval SMESH::long_array* - list of elements' ID
*/
//================================================================================
}
}
+//================================================================================
+/*!
+ \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
\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 theAffectedElems - the list of elements (cells and edges) to which the
- replicated nodes should be associated to.
+ replicated nodes should be associated to.
\return TRUE if operation has been completed successfully, FALSE otherwise
\sa DoubleNodeGroup(), DoubleNodeGroups()
*/
//================================================================================
-CORBA::Boolean SMESH_MeshEditor_i::DoubleNodes( const SMESH::long_array& theElems,
- const SMESH::long_array& theNodesNot,
- const SMESH::long_array& theAffectedElems )
-
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElem( const SMESH::long_array& theElems,
+ const SMESH::long_array& theNodesNot,
+ const SMESH::long_array& theAffectedElems )
+
{
initData();
storeResult( aMeshEditor) ;
+ // Update Python script
+ TPythonDump() << "isDone = " << this << ".DoubleNodes( " << theElems << ", "
+ << theNodesNot << ", " << theAffectedElems << " )";
return aResult;
}
/*!
\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
- 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 theShape - shape to detect affected elements (element which geometric center
- located on or inside shape).
- The replicated nodes should be associated to affected elements.
+ located on or inside shape).
+ The replicated nodes should be associated to affected elements.
\return TRUE if operation has been completed successfully, FALSE otherwise
\sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
*/
//================================================================================
-CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesInRegion
- ( const SMESH::long_array& theElems,
- const SMESH::long_array& theNodesNot,
- GEOM::GEOM_Object_ptr theShape )
-
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemInRegion
+( const SMESH::long_array& theElems,
+ const SMESH::long_array& theNodesNot,
+ GEOM::GEOM_Object_ptr theShape )
+
{
initData();
storeResult( aMeshEditor) ;
+ // Update Python script
+ TPythonDump() << "isDone = " << this << ".DoubleNodesInRegion( " << theElems << ", "
+ << theNodesNot << ", " << theShape << " )";
return aResult;
}
\param theElems - group of of elements (edges or faces) to be replicated
\param theNodesNot - group of nodes not to replicated
\param theAffectedElems - group of elements to which the replicated nodes
- should be associated to.
+ should be associated to.
\return TRUE if operation has been completed successfully, FALSE otherwise
\sa DoubleNodes(), DoubleNodeGroups()
*/
SMESHDS_Mesh* theMeshDS,
TIDSortedElemSet& theElemSet,
const SMDSAbs_ElementType theType)
-
+
{
if ( CORBA::is_nil( theGrp ) )
return;
arrayToSet( anIDs, theMeshDS, theElemSet, theType);
}
-CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup(
- SMESH::SMESH_GroupBase_ptr theElems,
- SMESH::SMESH_GroupBase_ptr theNodesNot,
- SMESH::SMESH_GroupBase_ptr theAffectedElems )
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroup(
+ SMESH::SMESH_GroupBase_ptr theElems,
+ SMESH::SMESH_GroupBase_ptr theNodesNot,
+ SMESH::SMESH_GroupBase_ptr theAffectedElems )
{
if ( CORBA::is_nil( theElems ) && theElems->GetType() == SMESH::NODE )
return false;
-
+
initData();
::SMESH_MeshEditor aMeshEditor( myMesh );
storeResult( aMeshEditor) ;
+ // Update Python script
+ TPythonDump() << "isDone = " << this << ".DoubleNodeGroup( " << theElems << ", "
+ << theNodesNot << ", " << theAffectedElems << " )";
return aResult;
}
\param theElems - group of of elements (edges or faces) to be replicated
\param theNodesNot - group of nodes not to replicated
\param theShape - shape to detect affected elements (element which geometric center
- located on or inside shape).
- The replicated nodes should be associated to affected elements.
+ located on or inside shape).
+ The replicated nodes should be associated to affected elements.
\return TRUE if operation has been completed successfully, FALSE otherwise
\sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
*/
//================================================================================
-CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroupInRegion(
- SMESH::SMESH_GroupBase_ptr theElems,
- SMESH::SMESH_GroupBase_ptr theNodesNot,
- GEOM::GEOM_Object_ptr theShape )
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroupInRegion(
+ SMESH::SMESH_GroupBase_ptr theElems,
+ SMESH::SMESH_GroupBase_ptr theNodesNot,
+ GEOM::GEOM_Object_ptr theShape )
{
if ( CORBA::is_nil( theElems ) && theElems->GetType() == SMESH::NODE )
return false;
-
+
initData();
::SMESH_MeshEditor aMeshEditor( myMesh );
storeResult( aMeshEditor) ;
+ // Update Python script
+ TPythonDump() << "isDone = " << this << ".DoubleNodeGroupInRegion( " << theElems << ", "
+ << theNodesNot << ", " << theShape << " )";
return aResult;
}
\param theElems - list of groups of elements (edges or faces) to be replicated
\param theNodesNot - list of groups of nodes not to replicated
\param theAffectedElems - group of elements to which the replicated nodes
- should be associated to.
+ should be associated to.
\return TRUE if operation has been completed successfully, FALSE otherwise
\sa DoubleNodeGroup(), DoubleNodes()
*/
{
SMESH::SMESH_GroupBase_var aGrp = theGrpList[ i ];
if ( !CORBA::is_nil( aGrp ) && (theIsNodeGrp ? aGrp->GetType() == SMESH::NODE
- : aGrp->GetType() != SMESH::NODE ) )
+ : aGrp->GetType() != SMESH::NODE ) )
{
SMESH::long_array_var anIDs = aGrp->GetIDs();
arrayToSet( anIDs, theMeshDS, theElemSet, theIsNodeGrp ? SMDSAbs_Node : SMDSAbs_All );
}
}
-CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups(
- const SMESH::ListOfGroups& theElems,
- const SMESH::ListOfGroups& theNodesNot,
- const SMESH::ListOfGroups& theAffectedElems )
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroups(
+ const SMESH::ListOfGroups& theElems,
+ const SMESH::ListOfGroups& theNodesNot,
+ const SMESH::ListOfGroups& theAffectedElems )
{
initData();
storeResult( aMeshEditor) ;
+ // Update Python script
+ TPythonDump() << "isDone = " << this << ".DoubleNodeGroups( " << &theElems << ", "
+ << &theNodesNot << ", " << &theAffectedElems << " )";
return aResult;
}
\param theElems - list of groups of elements (edges or faces) to be replicated
\param theNodesNot - list of groups of nodes not to replicated
\param theShape - shape to detect affected elements (element which geometric center
- located on or inside shape).
- The replicated nodes should be associated to affected elements.
+ located on or inside shape).
+ The replicated nodes should be associated to affected elements.
\return TRUE if operation has been completed successfully, FALSE otherwise
\sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
*/
//================================================================================
-CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroupsInRegion(
- const SMESH::ListOfGroups& theElems,
- const SMESH::ListOfGroups& theNodesNot,
- GEOM::GEOM_Object_ptr theShape )
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroupsInRegion(
+ const SMESH::ListOfGroups& theElems,
+ const SMESH::ListOfGroups& theNodesNot,
+ GEOM::GEOM_Object_ptr theShape )
{
initData();
storeResult( aMeshEditor) ;
+ // Update Python script
+ TPythonDump() << "isDone = " << this << ".DoubleNodeGroupsInRegion( " << &theElems << ", "
+ << &theNodesNot << ", " << theShape << " )";
+ return aResult;
+}
+
+//================================================================================
+/*!
+ \brief Generated skin mesh (containing 2D cells) from 3D mesh
+ The created 2D mesh elements based on nodes of free faces of boundary volumes
+ \return TRUE if operation has been completed successfully, FALSE otherwise
+*/
+//================================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::Make2DMeshFrom3D()
+{
+ initData();
+
+ ::SMESH_MeshEditor aMeshEditor( myMesh );
+ bool aResult = aMeshEditor.Make2DMeshFrom3D();
+ storeResult( aMeshEditor) ;
+
+ TPythonDump() << "isDone = " << this << ".Make2DMeshFrom3D()";
return aResult;
}
CORBA::Double MaxAspectRatio,
SMESH::SMESH_MeshEditor::Smooth_Method Method);
CORBA::Boolean SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::long_array & IDsOfFixedNodes,
- CORBA::Long MaxNbOfIterations,
- CORBA::Double MaxAspectRatio,
- SMESH::SMESH_MeshEditor::Smooth_Method Method);
+ const SMESH::long_array & IDsOfFixedNodes,
+ CORBA::Long MaxNbOfIterations,
+ CORBA::Double MaxAspectRatio,
+ SMESH::SMESH_MeshEditor::Smooth_Method Method);
CORBA::Boolean SmoothParametric(const SMESH::long_array & IDsOfElements,
const SMESH::long_array & IDsOfFixedNodes,
CORBA::Long MaxNbOfIterations,
SMESH::SMESH_MeshEditor::Smooth_Method Method,
bool IsParametric);
CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::long_array & IDsOfFixedNodes,
- CORBA::Long MaxNbOfIterations,
- CORBA::Double MaxAspectRatio,
- SMESH::SMESH_MeshEditor::Smooth_Method Method,
+ const SMESH::long_array & IDsOfFixedNodes,
+ CORBA::Long MaxNbOfIterations,
+ CORBA::Double MaxAspectRatio,
+ SMESH::SMESH_MeshEditor::Smooth_Method Method,
bool IsParametric);
CORBA::Long NbOfSteps,
CORBA::Double Tolerance);
void RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & Axis,
- CORBA::Double AngleInRadians,
- CORBA::Long NbOfSteps,
- CORBA::Double Tolerance);
+ const SMESH::AxisStruct & Axis,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance);
void RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & Axis,
- CORBA::Double AngleInRadians,
- CORBA::Long NbOfSteps,
- CORBA::Double Tolerance);
+ const SMESH::AxisStruct & Axis,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance);
void RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & Axis,
- CORBA::Double AngleInRadians,
- CORBA::Long NbOfSteps,
- CORBA::Double Tolerance);
+ const SMESH::AxisStruct & Axis,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance);
void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
const SMESH::DirStruct & StepVector,
CORBA::Long NbOfSteps);
void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct & StepVector,
- CORBA::Long NbOfSteps);
+ const SMESH::DirStruct & StepVector,
+ CORBA::Long NbOfSteps);
void ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
const SMESH::DirStruct & StepVector,
CORBA::Long NbOfSteps);
const SMESH::DirStruct & StepVector,
CORBA::Long NbOfSteps);
void AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps,
- CORBA::Long theExtrFlags,
- CORBA::Double theSewTolerance);
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps,
+ CORBA::Long theExtrFlags,
+ CORBA::Double theSewTolerance);
SMESH::SMESH_MeshEditor::Extrusion_Error
- ExtrusionAlongPath(const SMESH::long_array & IDsOfElements,
- SMESH::SMESH_Mesh_ptr PathMesh,
- GEOM::GEOM_Object_ptr PathShape,
- CORBA::Long NodeStart,
- CORBA::Boolean HasAngles,
- const SMESH::double_array & Angles,
- CORBA::Boolean HasRefPoint,
- const SMESH::PointStruct & RefPoint);
+ ExtrusionAlongPath(const SMESH::long_array & IDsOfElements,
+ SMESH::SMESH_Mesh_ptr PathMesh,
+ GEOM::GEOM_Object_ptr PathShape,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array & Angles,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct & RefPoint);
SMESH::SMESH_MeshEditor::Extrusion_Error
- ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
+ ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
+ SMESH::SMESH_Mesh_ptr PathMesh,
+ GEOM::GEOM_Object_ptr PathShape,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array & Angles,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct & RefPoint);
+ SMESH::SMESH_MeshEditor::Extrusion_Error
+ ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr theObject,
SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
CORBA::Long NodeStart,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct & RefPoint);
SMESH::SMESH_MeshEditor::Extrusion_Error
- ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::SMESH_Mesh_ptr PathMesh,
- GEOM::GEOM_Object_ptr PathShape,
- CORBA::Long NodeStart,
- CORBA::Boolean HasAngles,
- const SMESH::double_array & Angles,
- CORBA::Boolean HasRefPoint,
- const SMESH::PointStruct & RefPoint);
- SMESH::SMESH_MeshEditor::Extrusion_Error
- ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::SMESH_Mesh_ptr PathMesh,
- GEOM::GEOM_Object_ptr PathShape,
- CORBA::Long NodeStart,
- CORBA::Boolean HasAngles,
- const SMESH::double_array & Angles,
- CORBA::Boolean HasRefPoint,
- const SMESH::PointStruct & RefPoint);
+ ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr theObject,
+ SMESH::SMESH_Mesh_ptr PathMesh,
+ GEOM::GEOM_Object_ptr PathShape,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array & Angles,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct & RefPoint);
SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
SMESH::SMESH_MeshEditor::MirrorType MirrorType,
CORBA::Boolean Copy);
void MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & Axis,
- SMESH::SMESH_MeshEditor::MirrorType MirrorType,
- CORBA::Boolean Copy);
+ const SMESH::AxisStruct & Axis,
+ SMESH::SMESH_MeshEditor::MirrorType MirrorType,
+ CORBA::Boolean Copy);
void Translate(const SMESH::long_array & IDsOfElements,
const SMESH::DirStruct & Vector,
CORBA::Boolean Copy);
void TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct & Vector,
- CORBA::Boolean Copy);
+ const SMESH::DirStruct & Vector,
+ CORBA::Boolean Copy);
void Rotate(const SMESH::long_array & IDsOfElements,
const SMESH::AxisStruct & Axis,
CORBA::Double Angle,
CORBA::Boolean Copy);
void RotateObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & Axis,
- CORBA::Double Angle,
- CORBA::Boolean Copy);
+ const SMESH::AxisStruct & Axis,
+ CORBA::Double Angle,
+ CORBA::Boolean Copy);
SMESH::ListOfGroups* RotationSweepMakeGroups(const SMESH::long_array& IDsOfElements,
const SMESH::AxisStruct& Axix,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance);
SMESH::ListOfGroups* RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
- const SMESH::AxisStruct& Axix,
- CORBA::Double AngleInRadians,
- CORBA::Long NbOfSteps,
- CORBA::Double Tolerance);
+ const SMESH::AxisStruct& Axix,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance);
SMESH::ListOfGroups* RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
- const SMESH::AxisStruct& Axix,
- CORBA::Double AngleInRadians,
- CORBA::Long NbOfSteps,
- CORBA::Double Tolerance);
+ const SMESH::AxisStruct& Axix,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance);
SMESH::ListOfGroups* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
const SMESH::DirStruct& StepVector,
CORBA::Long NbOfSteps);
const SMESH::PointStruct& RefPoint,
SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
SMESH::ListOfGroups* ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
- SMESH::SMESH_Mesh_ptr PathMesh,
- GEOM::GEOM_Object_ptr PathShape,
- CORBA::Long NodeStart,
- CORBA::Boolean HasAngles,
- const SMESH::double_array& Angles,
- CORBA::Boolean HasRefPoint,
- const SMESH::PointStruct& RefPoint,
- SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
+ SMESH::SMESH_Mesh_ptr PathMesh,
+ GEOM::GEOM_Object_ptr PathShape,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array& Angles,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct& RefPoint,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
SMESH::ListOfGroups* ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
- SMESH::SMESH_Mesh_ptr PathMesh,
- GEOM::GEOM_Object_ptr PathShape,
- CORBA::Long NodeStart,
- CORBA::Boolean HasAngles,
- const SMESH::double_array& Angles,
- CORBA::Boolean HasRefPoint,
- const SMESH::PointStruct& RefPoint,
- SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
+ SMESH::SMESH_Mesh_ptr PathMesh,
+ GEOM::GEOM_Object_ptr PathShape,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array& Angles,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct& RefPoint,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
// skl 04.06.2009
SMESH::ListOfGroups* ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object,
- SMESH::SMESH_IDSource_ptr Path,
- CORBA::Long NodeStart,
- CORBA::Boolean HasAngles,
- const SMESH::double_array& Angles,
- CORBA::Boolean LinearVariation,
- CORBA::Boolean HasRefPoint,
- const SMESH::PointStruct& RefPoint,
- CORBA::Boolean MakeGroups,
- SMESH::ElementType ElemType,
- SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
+ SMESH::SMESH_IDSource_ptr Path,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array& Angles,
+ CORBA::Boolean LinearVariation,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct& RefPoint,
+ CORBA::Boolean MakeGroups,
+ SMESH::ElementType ElemType,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
SMESH::ListOfGroups* ExtrusionAlongPathX(const SMESH::long_array& IDsOfElements,
- SMESH::SMESH_IDSource_ptr Path,
- CORBA::Long NodeStart,
- CORBA::Boolean HasAngles,
- const SMESH::double_array& Angles,
- CORBA::Boolean LinearVariation,
- CORBA::Boolean HasRefPoint,
- const SMESH::PointStruct& RefPoint,
- CORBA::Boolean MakeGroups,
- SMESH::ElementType ElemType,
- SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
+ SMESH::SMESH_IDSource_ptr Path,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array& Angles,
+ CORBA::Boolean LinearVariation,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct& RefPoint,
+ CORBA::Boolean MakeGroups,
+ SMESH::ElementType ElemType,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
const SMESH::AxisStruct& Mirror,
CORBA::Double y,
CORBA::Double z,
CORBA::Long nodeID);
-
+ /*!
+ * \brief Return ID of node closest to a given point
+ */
+ CORBA::Long FindNodeClosestTo(CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z);
+ /*!
+ * Return elements of given type where the given point is IN or ON.
+ *
+ * 'ALL' type means elements of any type excluding nodes
+ */
+ SMESH::long_array* FindElementsByPoint(CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z,
+ SMESH::ElementType type);
SMESH::SMESH_MeshEditor::Sew_Error
* element - returns false
*/
CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs);
-
+
/*!
* Return data of mesh edition preview
*/
/*!
* \brief Return edited mesh ID
- * \retval int - mesh ID
+ * \retval int - mesh ID
*/
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
* replicated nodes should be associated to.
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodeGroups()
- */
- CORBA::Boolean DoubleNodes( const SMESH::long_array& theElems,
- const SMESH::long_array& theNodesNot,
- const SMESH::long_array& theAffectedElems );
+ */
+ CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems,
+ const SMESH::long_array& theNodesNot,
+ const SMESH::long_array& theAffectedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
*/
- CORBA::Boolean DoubleNodesInRegion( const SMESH::long_array& theElems,
- const SMESH::long_array& theNodesNot,
- GEOM::GEOM_Object_ptr theShape );
+ CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems,
+ const SMESH::long_array& theNodesNot,
+ GEOM::GEOM_Object_ptr theShape );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodes(), DoubleNodeGroups()
*/
- CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theElems,
- SMESH::SMESH_GroupBase_ptr theNodesNot,
- SMESH::SMESH_GroupBase_ptr theAffectedElems );
-
+ CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
+ SMESH::SMESH_GroupBase_ptr theNodesNot,
+ SMESH::SMESH_GroupBase_ptr theAffectedElems );
+
/*!
* \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
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
*/
- CORBA::Boolean DoubleNodeGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
- SMESH::SMESH_GroupBase_ptr theNodesNot,
- GEOM::GEOM_Object_ptr theShape );
+ CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
+ SMESH::SMESH_GroupBase_ptr theNodesNot,
+ GEOM::GEOM_Object_ptr theShape );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodes()
*/
- CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theElems,
- const SMESH::ListOfGroups& theNodesNot,
- const SMESH::ListOfGroups& theAffectedElems );
+ CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
+ const SMESH::ListOfGroups& theNodesNot,
+ const SMESH::ListOfGroups& theAffectedElems );
/*!
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
*/
- CORBA::Boolean DoubleNodeGroupsInRegion( const SMESH::ListOfGroups& theElems,
- const SMESH::ListOfGroups& theNodesNot,
- GEOM::GEOM_Object_ptr theShape );
+ CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
+ const SMESH::ListOfGroups& theNodesNot,
+ GEOM::GEOM_Object_ptr theShape );
+
+ /*!
+ * \brief Generated skin mesh (containing 2D cells) from 3D mesh
+ * The created 2D mesh elements based on nodes of free faces of boundary volumes
+ * \return TRUE if operation has been completed successfully, FALSE otherwise
+ */
+ CORBA::Boolean Make2DMeshFrom3D();
private: //!< private methods
/*!
* \brief Update myLastCreated* or myPreviewData
- * \param anEditor - it contains edition results
+ * \param anEditor - it contains edition results
*/
void storeResult(::SMESH_MeshEditor& anEditor);
/*!
* \brief Clear myLastCreated* or myPreviewData
*/
- void initData();
+ void initData(bool deleteSearchers=true);
/*!
* \brief Return groups by their IDs
CORBA::Long NbOfSteps,
CORBA::Double Tolerance,
const bool MakeGroups,
- const SMDSAbs_ElementType ElementType=SMDSAbs_All);
+ const SMDSAbs_ElementType ElementType=SMDSAbs_All);
SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
const SMESH::DirStruct & StepVector,
CORBA::Long NbOfSteps,
const SMESH::PointStruct & RefPoint,
const bool MakeGroups,
SMESH::SMESH_MeshEditor::Extrusion_Error & Error,
- const SMDSAbs_ElementType ElementType=SMDSAbs_All);
+ const SMDSAbs_ElementType ElementType=SMDSAbs_All);
SMESH::ListOfGroups* extrusionAlongPathX(const SMESH::long_array & IDsOfElements,
- SMESH::SMESH_IDSource_ptr Path,
- CORBA::Long NodeStart,
- CORBA::Boolean HasAngles,
- const SMESH::double_array& Angles,
- CORBA::Boolean LinearVariation,
- CORBA::Boolean HasRefPoint,
- const SMESH::PointStruct& RefPoint,
- const bool MakeGroups,
- const SMDSAbs_ElementType ElementType,
- SMESH::SMESH_MeshEditor::Extrusion_Error & theError);
+ SMESH::SMESH_IDSource_ptr Path,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array& Angles,
+ CORBA::Boolean LinearVariation,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct& RefPoint,
+ const bool MakeGroups,
+ const SMDSAbs_ElementType ElementType,
+ SMESH::SMESH_MeshEditor::Extrusion_Error & theError);
SMESH::ListOfGroups* mirror(const SMESH::long_array & IDsOfElements,
const SMESH::AxisStruct & Axis,
SMESH::SMESH_MeshEditor::MirrorType MirrorType,
::SMESH_Mesh* TargetMesh=0);
SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
-
+
void DumpGroupsList(SMESH::TPythonDump & theDumpPython,
const SMESH::ListOfGroups * theGroupList);
//=============================================================================
SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
- SMESH_Gen_i* gen_i,
- CORBA::Long studyId )
+ SMESH_Gen_i* gen_i,
+ CORBA::Long studyId )
: SALOME::GenericObj_i( thePOA )
{
MESSAGE("SMESH_Mesh_i");
*/
//=============================================================================
-SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
- SMESH::SMESH_Hypothesis_ptr anHyp)
+SMESH_Hypothesis::Hypothesis_Status
+SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
+ SMESH::SMESH_Hypothesis_ptr anHyp)
{
- if(MYDEBUG) MESSAGE("removeHypothesis()");
- // **** proposer liste de subShape (selection multiple)
+ if(MYDEBUG) MESSAGE("removeHypothesis()");
+ // **** proposer liste de subShape (selection multiple)
- if (CORBA::is_nil(aSubShapeObject) && HasShapeToMesh())
- THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
- SALOME::BAD_PARAM);
+ if (CORBA::is_nil(aSubShapeObject) && HasShapeToMesh())
+ THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", SALOME::BAD_PARAM);
- SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp);
- if (CORBA::is_nil(myHyp))
- THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference",
- SALOME::BAD_PARAM);
+ SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp);
+ if (CORBA::is_nil(myHyp))
+ THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", SALOME::BAD_PARAM);
- SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK;
- try
- {
- TopoDS_Shape myLocSubShape;
- //use PseudoShape in case if mesh has no shape
- if(HasShapeToMesh())
- myLocSubShape = _gen_i->GeomObjectToShape( aSubShapeObject);
- else
- myLocSubShape = _impl->GetShapeToMesh();
-
- int hypId = myHyp->GetId();
- status = _impl->RemoveHypothesis(myLocSubShape, hypId);
- if ( !SMESH_Hypothesis::IsStatusFatal(status) )
- _mapHypo.erase( hypId );
- }
- catch(SALOME_Exception & S_ex)
- {
- THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
- }
- return status;
+ SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK;
+ try
+ {
+ TopoDS_Shape myLocSubShape;
+ //use PseudoShape in case if mesh has no shape
+ if(HasShapeToMesh())
+ myLocSubShape = _gen_i->GeomObjectToShape( aSubShapeObject);
+ else
+ myLocSubShape = _impl->GetShapeToMesh();
+
+ int hypId = myHyp->GetId();
+ status = _impl->RemoveHypothesis(myLocSubShape, hypId);
+// if ( !SMESH_Hypothesis::IsStatusFatal(status) ) EAP: hyp can be used on many subshapes
+// _mapHypo.erase( hypId );
+ }
+ catch(SALOME_Exception & S_ex)
+ {
+ THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
+ }
+ return status;
}
//=============================================================================
//=============================================================================
SMESH::ListOfHypothesis *
- SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Object_ptr aSubShapeObject)
+ SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Object_ptr aSubShapeObject)
throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
if (MYDEBUG) MESSAGE("GetHypothesisList");
if (_impl->HasShapeToMesh() && CORBA::is_nil(aSubShapeObject))
- THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
- SALOME::BAD_PARAM);
+ THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", SALOME::BAD_PARAM);
SMESH::ListOfHypothesis_var aList = new SMESH::ListOfHypothesis();
for ( list<const SMESHDS_Hypothesis*>::const_iterator anIt = aLocalList.begin(); i < n && anIt != aLocalList.end(); anIt++ ) {
SMESHDS_Hypothesis* aHyp = (SMESHDS_Hypothesis*)(*anIt);
if ( _mapHypo.find( aHyp->GetID() ) != _mapHypo.end() )
- aList[i++] = SMESH::SMESH_Hypothesis::_narrow( _mapHypo[aHyp->GetID()] );
+ aList[i++] = SMESH::SMESH_Hypothesis::_narrow( _mapHypo[aHyp->GetID()] );
}
aList->length( i );
*/
//=============================================================================
SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetSubMesh(GEOM::GEOM_Object_ptr aSubShapeObject,
- const char* theName )
+ const char* theName )
throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
MESSAGE("SMESH_Mesh_i::GetSubMesh");
if (CORBA::is_nil(aSubShapeObject))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
- SALOME::BAD_PARAM);
+ SALOME::BAD_PARAM);
SMESH::SMESH_subMesh_var subMesh;
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(_this());
long aTag = SMESH_Gen_i::GetRefOnShapeTag();
SALOMEDS::SObject_var anObj, 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 );
GEOM::GEOM_Object_ptr theSubShapeObject )
{
MESSAGE("SMESH_Mesh_i::removeSubMesh()");
- if ( theSubMesh->_is_nil() || theSubShapeObject->_is_nil() )
+ if ( theSubMesh->_is_nil() /*|| theSubShapeObject->_is_nil()*/ )
return;
- try {
- SMESH::ListOfHypothesis_var aHypList = GetHypothesisList( theSubShapeObject );
- for ( int i = 0, n = aHypList->length(); i < n; i++ ) {
- removeHypothesis( theSubShapeObject, aHypList[i] );
+ 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());
+ }
}
}
- catch( const SALOME::SALOME_Exception& ) {
- INFOS("SMESH_Mesh_i::removeSubMesh(): exception caught!");
+ else
+ {
+ try {
+ SMESH::ListOfHypothesis_var aHypList = GetHypothesisList( theSubShapeObject );
+ for ( int i = 0, n = aHypList->length(); i < n; i++ ) {
+ removeHypothesis( theSubShapeObject, aHypList[i] );
+ }
+ }
+ catch( const SALOME::SALOME_Exception& ) {
+ INFOS("SMESH_Mesh_i::removeSubMesh(): exception caught!");
+ }
+ removeGeomGroupData( theSubShapeObject );
}
- removeGeomGroupData( theSubShapeObject );
-
int subMeshId = theSubMesh->GetId();
_mapSubMesh.erase(subMeshId);
aLog[indexLog].coords.length(rnum);
aLog[indexLog].indexes.length(inum);
for(int i = 0; i < rnum; i++){
- aLog[indexLog].coords[i] = *ir;
- //MESSAGE(" "<<i<<" "<<ir.Value());
- ir++;
+ aLog[indexLog].coords[i] = *ir;
+ //MESSAGE(" "<<i<<" "<<ir.Value());
+ ir++;
}
for(int i = 0; i < inum; i++){
- aLog[indexLog].indexes[i] = *ii;
- //MESSAGE(" "<<i<<" "<<ii.Value());
- ii++;
+ aLog[indexLog].indexes[i] = *ii;
+ //MESSAGE(" "<<i<<" "<<ii.Value());
+ ii++;
}
indexLog++;
its++;
void SMESH_Mesh_i::ClearLog() throw(SALOME::SALOME_Exception)
{
if(MYDEBUG) MESSAGE("SMESH_Mesh_i::ClearLog");
- // ****
+ _impl->ClearLog();
}
//=============================================================================
}
void SMESH_Mesh_i::ExportToMED (const char* file,
- CORBA::Boolean auto_groups,
- SMESH::MED_VERSION theVersion)
+ CORBA::Boolean auto_groups,
+ SMESH::MED_VERSION theVersion)
throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
aMeshName = aMeshSO->GetName();
// asv : 27.10.04 : fix of 6903: check for StudyLocked before adding attributes
if ( !aStudy->GetProperties()->IsLocked() )
- {
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOMEDS::AttributeExternalFileDef_var aFileName;
- anAttr=aStudyBuilder->FindOrCreateAttribute(aMeshSO, "AttributeExternalFileDef");
- aFileName = SALOMEDS::AttributeExternalFileDef::_narrow(anAttr);
- ASSERT(!aFileName->_is_nil());
+ {
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ SALOMEDS::AttributeExternalFileDef_var aFileName;
+ anAttr=aStudyBuilder->FindOrCreateAttribute(aMeshSO, "AttributeExternalFileDef");
+ aFileName = SALOMEDS::AttributeExternalFileDef::_narrow(anAttr);
+ ASSERT(!aFileName->_is_nil());
aFileName->SetValue(file);
SALOMEDS::AttributeFileType_var aFileType;
anAttr=aStudyBuilder->FindOrCreateAttribute(aMeshSO, "AttributeFileType");
aFileType = SALOMEDS::AttributeFileType::_narrow(anAttr);
ASSERT(!aFileType->_is_nil());
aFileType->SetValue("FICHIERMED");
- }
+ }
}
}
// Update Python script
}
void SMESH_Mesh_i::ExportMED (const char* file,
- CORBA::Boolean auto_groups)
+ CORBA::Boolean auto_groups)
throw(SALOME::SALOME_Exception)
{
ExportToMED(file,auto_groups,SMESH::MED_V2_1);
CORBA::Long SMESH_Mesh_i::NbElements()throw (SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- return NbEdges() + NbFaces() + NbVolumes();
+ return Nb0DElements() + NbEdges() + NbFaces() + NbVolumes();
}
//=============================================================================
public:
SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
SMESH_Gen_i* myGen_i,
- CORBA::Long studyId );
+ CORBA::Long studyId );
virtual ~SMESH_Mesh_i();
TMeshEditorMap::const_iterator meIt = myMeshEditors.find(aObject);
if(meIt != myMeshEditors.end()) {
TCollection_AsciiString aMesh = (*meIt).second;
- it = _objectMap.find(aMesh);
+ it = _objectMap.find(aMesh);
}
}
if(it == _objectMap.end()) { // additional check for pattern mapping
if(aMethod.IsEqual("ApplyToMeshFaces") ||
- aMethod.IsEqual("ApplyToHexahedrons"))
- it = _objectMap.find(aCmd->GetArg(1));
+ aMethod.IsEqual("ApplyToHexahedrons"))
+ it = _objectMap.find(aCmd->GetArg(1));
}
if(it != _objectMap.end()) {
if(MYDEBUG)
- cout << "Found object : " << (*it).first << endl;
+ cout << "Found object : " << (*it).first << endl;
ObjectStates *aStates = (*it).second;
// Case for LocalLength hypothesis
if(aStates->GetObjectType().IsEqual("LocalLength") && aStates->GetCurrectState().size() >= 2) {
}
else if(aStates->GetObjectType().IsEqual("Mesh")) {
- TState aCurrentState = aStates->GetCurrectState();
+ TState aCurrentState = aStates->GetCurrectState();
int aCurrentStateSize = aCurrentState.size();
- if(aMethod.IsEqual("Translate") ||
+ if(aMethod.IsEqual("Translate") ||
aMethod.IsEqual("TranslateMakeGroups") ||
aMethod.IsEqual("TranslateMakeMesh") ||
aMethod.IsEqual("TranslateObject") ||
}
}
if(anArgIndex > 0) {
- if(aCurrentStateSize == 3) { // translation by dx, dy, dz
- for(int j = 0; j < aCurrentStateSize; j++) {
- if(!aCurrentState.at(j).IsEmpty()) {
- isVariableFound = true;
- aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
- }
- }
- }
- else if(aCurrentStateSize == 6) { // translation by x1, x2, y1, y2, z1, z2
- // TODO: limitation until operations on the variables will be introduced
- /*
- isVariableFound = true;
- for(int j = 0; j < 3; j++) {
- TCollection_AsciiString anArg = aCmd->GetArg(anArgIndex+j);
- TCollection_AsciiString aValue1 = aCurrentState.at(2*j), aValue2 = aCurrentState.at(2*j+1);
- bool aV1 = !aValue1.IsEmpty();
- bool aV2 = !aValue2.IsEmpty();
- double aValue, aCurrentValue = anArg.IsRealValue() ? anArg.RealValue() : 0;
- if(aV1 && !aV2) {
- if(!GetReal(aValue1, aValue))
- aValue = 0;
- aValue2 = TCollection_AsciiString( aValue + aCurrentValue );
- }
- else if(!aV1 && aV2) {
- if(!GetReal(aValue2, aValue))
- aValue = 0;
- aValue1 = TCollection_AsciiString( aValue - aCurrentValue );
- }
- else if(!aV1 && !aV2) {
- aValue1 = TCollection_AsciiString( 0 );
- aValue2 = TCollection_AsciiString( aCurrentValue );
- }
- aCmd->SetArg(anArgIndex+j, aValue1 + ", " + aValue2 );
- }
- */
- }
+ if(aCurrentStateSize == 3) { // translation by dx, dy, dz
+ for(int j = 0; j < aCurrentStateSize; j++) {
+ if(!aCurrentState.at(j).IsEmpty()) {
+ isVariableFound = true;
+ aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
+ }
+ }
+ }
+ else if(aCurrentStateSize == 6) { // translation by x1, x2, y1, y2, z1, z2
+ // TODO: limitation until operations on the variables will be introduced
+ /*
+ isVariableFound = true;
+ for(int j = 0; j < 3; j++) {
+ TCollection_AsciiString anArg = aCmd->GetArg(anArgIndex+j);
+ TCollection_AsciiString aValue1 = aCurrentState.at(2*j), aValue2 = aCurrentState.at(2*j+1);
+ bool aV1 = !aValue1.IsEmpty();
+ bool aV2 = !aValue2.IsEmpty();
+ double aValue, aCurrentValue = anArg.IsRealValue() ? anArg.RealValue() : 0;
+ if(aV1 && !aV2) {
+ if(!GetReal(aValue1, aValue))
+ aValue = 0;
+ aValue2 = TCollection_AsciiString( aValue + aCurrentValue );
+ }
+ else if(!aV1 && aV2) {
+ if(!GetReal(aValue2, aValue))
+ aValue = 0;
+ aValue1 = TCollection_AsciiString( aValue - aCurrentValue );
+ }
+ else if(!aV1 && !aV2) {
+ aValue1 = TCollection_AsciiString( 0 );
+ aValue2 = TCollection_AsciiString( aCurrentValue );
+ }
+ aCmd->SetArg(anArgIndex+j, aValue1 + ", " + aValue2 );
+ }
+ */
+ }
}
if(isVariableFound) {
TCollection_AsciiString aDim;
- if(aCurrentStateSize == 6)
- aDim = "6";
+ if(aCurrentStateSize == 6)
+ aDim = "6";
aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr"+aDim);
aCmd->SetArg(anArgIndex - 2, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".DirStructStr");
}
aStates->IncrementState();
}
- else if(aMethod.IsEqual("Rotate") ||
- aMethod.IsEqual("RotateMakeGroups") ||
- aMethod.IsEqual("RotateMakeMesh") ||
+ else if(aMethod.IsEqual("Rotate") ||
+ aMethod.IsEqual("RotateMakeGroups") ||
+ aMethod.IsEqual("RotateMakeMesh") ||
aMethod.IsEqual("RotateObject") ||
aMethod.IsEqual("RotateObjectMakeGroups") ||
aMethod.IsEqual("RotateObjectMakeMesh") ||
- aMethod.IsEqual("RotationSweep") ||
- aMethod.IsEqual("RotationSweepObject") ||
- aMethod.IsEqual("RotationSweepObject1D") ||
- aMethod.IsEqual("RotationSweepObject2D") ||
- aMethod.IsEqual("RotationSweepMakeGroups") ||
- aMethod.IsEqual("RotationSweepObjectMakeGroups") ||
- aMethod.IsEqual("RotationSweepObject1DMakeGroups") ||
- aMethod.IsEqual("RotationSweepObject2DMakeGroups") ||
- aMethod.IsEqual("Mirror") ||
- aMethod.IsEqual("MirrorMakeMesh") ||
+ aMethod.IsEqual("RotationSweep") ||
+ aMethod.IsEqual("RotationSweepObject") ||
+ aMethod.IsEqual("RotationSweepObject1D") ||
+ aMethod.IsEqual("RotationSweepObject2D") ||
+ aMethod.IsEqual("RotationSweepMakeGroups") ||
+ aMethod.IsEqual("RotationSweepObjectMakeGroups") ||
+ aMethod.IsEqual("RotationSweepObject1DMakeGroups") ||
+ aMethod.IsEqual("RotationSweepObject2DMakeGroups") ||
+ aMethod.IsEqual("Mirror") ||
+ aMethod.IsEqual("MirrorMakeMesh") ||
aMethod.IsEqual("MirrorMakeGroups") ||
aMethod.IsEqual("MirrorObject") ||
aMethod.IsEqual("MirrorObjectMakeMesh") ||
aMethod.IsEqual("MirrorObjectMakeGroups")) {
- bool isSubstitute = false;
- int anArgIndex = 0;
- for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
- if(aCmd->GetArg(i).IsEqual("SMESH.AxisStruct")) {
- anArgIndex = i+1;
- break;
- }
- }
- if(anArgIndex > 0) {
- for(int j = 0; j < aCurrentStateSize; j++) {
- if(!aCurrentState.at(j).IsEmpty()) {
- if(j < 6) // 0-5 - axis struct, 6 - angle (rotation & sweep), 7-8 - nbSteps and tolerance (sweep)
- isSubstitute = true;
- aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
- }
- }
- }
- if(isSubstitute)
- aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".AxisStructStr");
- aStates->IncrementState();
- }
- else if(aMethod.IsEqual("AddNode") ||
- aMethod.IsEqual("MoveClosestNodeToPoint")) {
- for(int j = 0; j < aCurrentStateSize; j++) {
- if(!aCurrentState.at(j).IsEmpty())
- aCmd->SetArg(j+1, aCurrentState.at(j));
- }
- aStates->IncrementState();
- }
- else if(aMethod.IsEqual("MoveNode")) {
- for(int j = 0; j < aCurrentStateSize; j++) {
- if(!aCurrentState.at(j).IsEmpty())
- aCmd->SetArg(j+2, aCurrentState.at(j));
- }
- aStates->IncrementState();
- }
- else if(aMethod.IsEqual("ExtrusionSweep") ||
- aMethod.IsEqual("ExtrusionSweepObject") ||
- aMethod.IsEqual("ExtrusionSweepObject1D") ||
- aMethod.IsEqual("ExtrusionSweepObject2D") ||
- aMethod.IsEqual("ExtrusionSweepMakeGroups") ||
- aMethod.IsEqual("ExtrusionSweepObjectMakeGroups") ||
- aMethod.IsEqual("ExtrusionSweepObject1DMakeGroups") ||
- aMethod.IsEqual("ExtrusionSweepObject2DMakeGroups")) {
- bool isSubstitute = false;
- int anArgIndex = 0;
- for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
- if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) {
- anArgIndex = i+1;
- break;
- }
- }
- if(anArgIndex > 0) {
- for(int j = 0; j < aCurrentStateSize; j++) {
- if(!aCurrentState.at(j).IsEmpty()) {
- if(j < 3) // 0-2 - dir struct, 3 - number of steps
- isSubstitute = true;
- aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
- }
- }
- }
- if(isSubstitute) {
+ bool isSubstitute = false;
+ int anArgIndex = 0;
+ for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
+ if(aCmd->GetArg(i).IsEqual("SMESH.AxisStruct")) {
+ anArgIndex = i+1;
+ break;
+ }
+ }
+ if(anArgIndex > 0) {
+ for(int j = 0; j < aCurrentStateSize; j++) {
+ if(!aCurrentState.at(j).IsEmpty()) {
+ if(j < 6) // 0-5 - axis struct, 6 - angle (rotation & sweep), 7-8 - nbSteps and tolerance (sweep)
+ isSubstitute = true;
+ aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
+ }
+ }
+ }
+ if(isSubstitute)
+ aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".AxisStructStr");
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("AddNode") ||
+ aMethod.IsEqual("MoveClosestNodeToPoint")) {
+ for(int j = 0; j < aCurrentStateSize; j++) {
+ if(!aCurrentState.at(j).IsEmpty())
+ aCmd->SetArg(j+1, aCurrentState.at(j));
+ }
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("MoveNode")) {
+ for(int j = 0; j < aCurrentStateSize; j++) {
+ if(!aCurrentState.at(j).IsEmpty())
+ aCmd->SetArg(j+2, aCurrentState.at(j));
+ }
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("ExtrusionSweep") ||
+ aMethod.IsEqual("ExtrusionSweepObject") ||
+ aMethod.IsEqual("ExtrusionSweepObject1D") ||
+ aMethod.IsEqual("ExtrusionSweepObject2D") ||
+ aMethod.IsEqual("ExtrusionSweepMakeGroups") ||
+ aMethod.IsEqual("ExtrusionSweepObjectMakeGroups") ||
+ aMethod.IsEqual("ExtrusionSweepObject1DMakeGroups") ||
+ aMethod.IsEqual("ExtrusionSweepObject2DMakeGroups")) {
+ bool isSubstitute = false;
+ int anArgIndex = 0;
+ for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
+ if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) {
+ anArgIndex = i+1;
+ break;
+ }
+ }
+ if(anArgIndex > 0) {
+ for(int j = 0; j < aCurrentStateSize; j++) {
+ if(!aCurrentState.at(j).IsEmpty()) {
+ if(j < 3) // 0-2 - dir struct, 3 - number of steps
+ isSubstitute = true;
+ aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
+ }
+ }
+ }
+ if(isSubstitute) {
aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr");
aCmd->SetArg(anArgIndex - 2, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".DirStructStr");
- }
- aStates->IncrementState();
- }
- else if(aMethod.IsEqual("ExtrusionAlongPath") ||
- aMethod.IsEqual("ExtrusionAlongPathObject") ||
- aMethod.IsEqual("ExtrusionAlongPathObject1D") ||
- aMethod.IsEqual("ExtrusionAlongPathObject2D") ||
- aMethod.IsEqual("ExtrusionAlongPathMakeGroups") ||
- aMethod.IsEqual("ExtrusionAlongPathObjectMakeGroups") ||
- aMethod.IsEqual("ExtrusionAlongPathObject1DMakeGroups") ||
- aMethod.IsEqual("ExtrusionAlongPathObject2DMakeGroups") ||
- /* workaround for a bug in the command parsing algorithm */
- aCmd->GetString().Search("ExtrusionAlongPathMakeGroups") != -1 ||
- aCmd->GetString().Search("ExtrusionAlongPathObjectMakeGroups") != -1 ||
- aCmd->GetString().Search("ExtrusionAlongPathObject1DMakeGroups") != -1 ||
- aCmd->GetString().Search("ExtrusionAlongPathObject2DMakeGroups") != -1 ) {
- int aNbAngles = aCurrentStateSize-3; // State looks like "Angle1:...:AngleN:X:Y:Z"
- bool isSubstitute = false;
- int anArgIndex = 0;
- for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
- if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) {
- anArgIndex = i-1-aNbAngles;
- break;
- }
- }
- if(anArgIndex > 0) {
- int j = 0;
- for(; j < aNbAngles; j++) {
- if(!aCurrentState.at(j).IsEmpty()) {
- aCmd->SetArg(anArgIndex+j-1, aCurrentState.at(j));
- }
- }
- for(; j < aNbAngles+3; j++) {
- if(!aCurrentState.at(j).IsEmpty()) {
- isSubstitute = true;
- aCmd->SetArg(anArgIndex+j+2, aCurrentState.at(j));
- }
- }
- }
- if(isSubstitute)
- aCmd->SetArg(anArgIndex + aNbAngles + 1,
- TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr");
- aStates->IncrementState();
- }
- else if(aMethod.IsEqual("TriToQuad") ||
- aMethod.IsEqual("Concatenate") ||
- aMethod.IsEqual("ConcatenateWithGroups")) {
- if(aCurrentStateSize && !aCurrentState.at(0).IsEmpty())
- aCmd->SetArg(aCmd->GetNbArgs(), aCurrentState.at(0));
- aStates->IncrementState();
- }
- else if(aMethod.IsEqual("Smooth") ||
- aMethod.IsEqual("SmoothObject") ||
- aMethod.IsEqual("SmoothParametric") ||
- aMethod.IsEqual("SmoothParametricObject")) {
- int anArgIndex = aCmd->GetNbArgs() - 2;
- for(int j = 0; j < aCurrentStateSize; j++) {
- if(!aCurrentState.at(j).IsEmpty())
- aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
- }
- aStates->IncrementState();
- }
- else if(aMethod.IsEqual("ApplyToMeshFaces") ||
- aMethod.IsEqual("ApplyToHexahedrons")) {
- int anArgIndex = aCmd->GetNbArgs()-1;
- for(int j = 0; j < aCurrentStateSize; j++)
- if(!aCurrentState.at(j).IsEmpty())
- aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
- aStates->IncrementState();
- }
+ }
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("ExtrusionAlongPath") ||
+ aMethod.IsEqual("ExtrusionAlongPathObject") ||
+ aMethod.IsEqual("ExtrusionAlongPathObject1D") ||
+ aMethod.IsEqual("ExtrusionAlongPathObject2D") ||
+ aMethod.IsEqual("ExtrusionAlongPathMakeGroups") ||
+ aMethod.IsEqual("ExtrusionAlongPathObjectMakeGroups") ||
+ aMethod.IsEqual("ExtrusionAlongPathObject1DMakeGroups") ||
+ aMethod.IsEqual("ExtrusionAlongPathObject2DMakeGroups") ||
+ /* workaround for a bug in the command parsing algorithm */
+ aCmd->GetString().Search("ExtrusionAlongPathMakeGroups") != -1 ||
+ aCmd->GetString().Search("ExtrusionAlongPathObjectMakeGroups") != -1 ||
+ aCmd->GetString().Search("ExtrusionAlongPathObject1DMakeGroups") != -1 ||
+ aCmd->GetString().Search("ExtrusionAlongPathObject2DMakeGroups") != -1 ) {
+ int aNbAngles = aCurrentStateSize-3; // State looks like "Angle1:...:AngleN:X:Y:Z"
+ bool isSubstitute = false;
+ int anArgIndex = 0;
+ for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
+ if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) {
+ anArgIndex = i-1-aNbAngles;
+ break;
+ }
+ }
+ if(anArgIndex > 0) {
+ int j = 0;
+ for(; j < aNbAngles; j++) {
+ if(!aCurrentState.at(j).IsEmpty()) {
+ aCmd->SetArg(anArgIndex+j-1, aCurrentState.at(j));
+ }
+ }
+ for(; j < aNbAngles+3; j++) {
+ if(!aCurrentState.at(j).IsEmpty()) {
+ isSubstitute = true;
+ aCmd->SetArg(anArgIndex+j+2, aCurrentState.at(j));
+ }
+ }
+ }
+ if(isSubstitute)
+ aCmd->SetArg(anArgIndex + aNbAngles + 1,
+ TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr");
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("TriToQuad") ||
+ aMethod.IsEqual("Concatenate") ||
+ aMethod.IsEqual("ConcatenateWithGroups")) {
+ if(aCurrentStateSize && !aCurrentState.at(0).IsEmpty())
+ aCmd->SetArg(aCmd->GetNbArgs(), aCurrentState.at(0));
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("Smooth") ||
+ aMethod.IsEqual("SmoothObject") ||
+ aMethod.IsEqual("SmoothParametric") ||
+ aMethod.IsEqual("SmoothParametricObject")) {
+ int anArgIndex = aCmd->GetNbArgs() - 2;
+ for(int j = 0; j < aCurrentStateSize; j++) {
+ if(!aCurrentState.at(j).IsEmpty())
+ aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
+ }
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("ApplyToMeshFaces") ||
+ aMethod.IsEqual("ApplyToHexahedrons")) {
+ int anArgIndex = aCmd->GetNbArgs()-1;
+ for(int j = 0; j < aCurrentStateSize; j++)
+ if(!aCurrentState.at(j).IsEmpty())
+ aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
+ aStates->IncrementState();
+ }
}
}
else {
if(MYDEBUG)
- cout << "Object not found" << endl;
+ cout << "Object not found" << endl;
}
if(MYDEBUG) {
cout<<"Command after: "<< aCmd->GetString()<<endl;
if ( aCommand->GetMethod() == "GetMeshEditor" ) { // MeshEditor creation
myMeshEditors.insert( make_pair( aCommand->GetResultValue(),
- aCommand->GetObject() ) );
+ aCommand->GetObject() ) );
}
}
return false;
// Update Python script
- TPythonDump() << "isDone = pattern.LoadFromFace( " << theMesh << ", "
+ TPythonDump() << "isDone = pattern.LoadFromFace( " << theMesh << ".GetMesh(), "
<< theFace << ", " << theProject << " )";
addErrorCode( "LoadFromFace" );
return false;
// Update Python script
- TPythonDump() << "isDone = pattern.LoadFrom3DBlock( " << theMesh << ", " << theBlock << " )";
+ TPythonDump() << "isDone = pattern.LoadFrom3DBlock( " << theMesh << ".GetMesh(), " << theBlock << " )";
addErrorCode( "LoadFrom3DBlock" );
return myPattern.Load( aMesh, TopoDS::Shell( exp.Current() ));
}
// Update Python script
- TPythonDump() << "pattern.ApplyToMeshFaces( " << theMesh << ", "
+ TPythonDump() << "pattern.ApplyToMeshFaces( " << theMesh << ".GetMesh(), "
<< theFacesIDs << ", "
<< theNodeIndexOnKeyPoint1 << ", " << theReverse << " )";
}
// Update Python script
- TPythonDump() << "pattern.ApplyToHexahedrons( " << theMesh << ", "
+ TPythonDump() << "pattern.ApplyToHexahedrons( " << theMesh << ".GetMesh(), "
<< theVolumesIDs << ", "
<< theNode000Index << ", " << theNode001Index << " )";
return false;
// Update Python script
- TPythonDump() << "isDone = pattern.MakeMesh( " << theMesh << ", "
+ TPythonDump() << "isDone = pattern.MakeMesh( " << theMesh << ".GetMesh(), "
<< CreatePolygons << ", " << CreatePolyedrs << " )";
addErrorCode( "MakeMesh" );
static TCollection_AsciiString
ConvertScript(const TCollection_AsciiString& theScript,
Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
- Resource_DataMapOfAsciiStringAsciiString& theObjectNames);
+ Resource_DataMapOfAsciiStringAsciiString& theObjectNames);
/*!
* \brief Return the name of the python file wrapping IDL API
//=============================================================================
SMESH_subMesh_i::SMESH_subMesh_i( PortableServer::POA_ptr thePOA,
- SMESH_Gen_i* gen_i,
- SMESH_Mesh_i* mesh_i,
- int localId )
+ SMESH_Gen_i* gen_i,
+ SMESH_Mesh_i* mesh_i,
+ int localId )
: SALOME::GenericObj_i( thePOA )
{
MESSAGE("SMESH_subMesh_i::SMESH_subMesh_i");
TopoDS_Shape S = _mesh_i->_mapSubMesh[ _localId ]->GetSubShape();
if ( !S.IsNull() ) {
aShapeObj = _gen_i->ShapeToGeomObject( S );
- //mzn: N7PAL16232, N7PAL16233
- //In some cases it's possible that GEOM_Client contains the shape same to S, but
- //with another orientation.
- if (aShapeObj->_is_nil())
- aShapeObj = _gen_i->ShapeToGeomObject( S.Reversed() );
+ //mzn: N7PAL16232, N7PAL16233
+ //In some cases it's possible that GEOM_Client contains the shape same to S, but
+ //with another orientation.
+ if (aShapeObj->_is_nil())
+ aShapeObj = _gen_i->ShapeToGeomObject( S.Reversed() );
}
}
}
SMESH_subMesh_i();
SMESH_subMesh_i( PortableServer::POA_ptr thePOA,
SMESH_Gen_i* gen_i,
- SMESH_Mesh_i* mesh_i,
- int localId );
+ SMESH_Mesh_i* mesh_i,
+ int localId );
~SMESH_subMesh_i();
CORBA::Long GetNumberOfElements()
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
i2 = a.indexes[ii]
ii = ii+1
i3 = a.indexes[ii]
- #ii = ii+1
+ ii = ii+1
print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3)
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-\r
-import sys\r
-import salome\r
-import geompy\r
-import math\r
-import SALOMEDS\r
-import SMESH\r
-import smesh\r
-\r
-salome.salome_init()\r
-aStudyId = salome.myStudy._get_StudyId()\r
-\r
-geompy.init_geom(salome.myStudy)\r
-global Face_1\r
-Face_1 = geompy.MakeFaceHW(100, 100, 1)\r
-geompy.addToStudy( Face_1, "Face_1" )\r
-\r
-#smesh.smesh.SetCurrentStudy(aStudyId)\r
-import StdMeshers\r
-pattern = smesh.GetPattern()\r
-Mesh_1 = smesh.Mesh(Face_1)\r
-Regular_1D = Mesh_1.Segment()\r
-Nb_Segments_1 = Regular_1D.NumberOfSegments(10)\r
-Nb_Segments_1.SetDistrType( 0 )\r
-Quadrangle_2D = Mesh_1.Quadrangle()\r
-isDone = Mesh_1.Compute()\r
-\r
-# groups creation\r
-\r
-aListOfElems = [ 52, 53, 54, 55, 56, 57,\r
- 62, 63, 64, 65, 66, 67,\r
- 72, 73, 74, 75, 76, 77,\r
- 82, 83, 84, 85, 86, 87 ]\r
- \r
-aRedGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Red" )\r
-aRedGroup.Add( aListOfElems );\r
-aRedGroup.SetColor( SALOMEDS.Color( 1, 0, 0 ) )\r
-\r
-aListOfElems = [ 55, 56, 57, 58, 59,\r
- 65, 66, 67, 68, 69,\r
- 75, 76, 77, 78, 79,\r
- 85, 86, 87, 88, 89,\r
- 95, 96, 97, 98, 99,\r
- 105, 106, 107, 108, 109,\r
- 115, 116, 117, 118, 119,\r
- 125, 126, 127, 128, 129 ]\r
- \r
-aGreenGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Green" )\r
-aGreenGroup.Add( aListOfElems );\r
-aGreenGroup.SetColor( SALOMEDS.Color( 0, 1, 0 ) )\r
-\r
-aListOfElems = [ 63, 64, 65, 66, 67, 68, \r
- 73, 74, 75, 76, 77, 78,\r
- 83, 84, 85, 86, 87, 88, \r
- 93, 94, 95, 96, 97, 98, \r
- 103, 104, 105, 106, 107, 108, \r
- 113, 114, 115, 116, 117, 118 ]\r
- \r
-aBlueGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Blue" )\r
-aBlueGroup.Add( aListOfElems );\r
-aBlueGroup.SetColor( SALOMEDS.Color( 0, 0, 1 ) )\r
-\r
-# UnionListOfGroups()\r
-aUnGrp = Mesh_1.UnionListOfGroups([aRedGroup, aGreenGroup, aBlueGroup], "UnionGrp" )\r
-\r
-# IntersectListOfGroups()\r
-aIntGrp=Mesh_1.IntersectListOfGroups([aRedGroup, aGreenGroup, aBlueGroup], "IntGrp" )\r
-\r
-# CutListOfGroups()\r
-aCutGrp=Mesh_1.CutListOfGroups([aRedGroup],[aGreenGroup,aBlueGroup],"CutGrp")\r
-\r
-salome.sg.updateObjBrowser( 1 )\r
-\r
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+import geompy
+import math
+import SALOMEDS
+import SMESH
+import smesh
+
+salome.salome_init()
+aStudyId = salome.myStudy._get_StudyId()
+
+geompy.init_geom(salome.myStudy)
+global Face_1
+Face_1 = geompy.MakeFaceHW(100, 100, 1)
+geompy.addToStudy( Face_1, "Face_1" )
+
+#smesh.smesh.SetCurrentStudy(aStudyId)
+import StdMeshers
+pattern = smesh.GetPattern()
+Mesh_1 = smesh.Mesh(Face_1)
+Regular_1D = Mesh_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = Mesh_1.Quadrangle()
+isDone = Mesh_1.Compute()
+
+# groups creation
+
+aListOfElems = [ 52, 53, 54, 55, 56, 57,
+ 62, 63, 64, 65, 66, 67,
+ 72, 73, 74, 75, 76, 77,
+ 82, 83, 84, 85, 86, 87 ]
+
+aRedGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Red" )
+aRedGroup.Add( aListOfElems );
+aRedGroup.SetColor( SALOMEDS.Color( 1, 0, 0 ) )
+
+aListOfElems = [ 55, 56, 57, 58, 59,
+ 65, 66, 67, 68, 69,
+ 75, 76, 77, 78, 79,
+ 85, 86, 87, 88, 89,
+ 95, 96, 97, 98, 99,
+ 105, 106, 107, 108, 109,
+ 115, 116, 117, 118, 119,
+ 125, 126, 127, 128, 129 ]
+
+aGreenGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Green" )
+aGreenGroup.Add( aListOfElems );
+aGreenGroup.SetColor( SALOMEDS.Color( 0, 1, 0 ) )
+
+aListOfElems = [ 63, 64, 65, 66, 67, 68,
+ 73, 74, 75, 76, 77, 78,
+ 83, 84, 85, 86, 87, 88,
+ 93, 94, 95, 96, 97, 98,
+ 103, 104, 105, 106, 107, 108,
+ 113, 114, 115, 116, 117, 118 ]
+
+aBlueGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Blue" )
+aBlueGroup.Add( aListOfElems );
+aBlueGroup.SetColor( SALOMEDS.Color( 0, 0, 1 ) )
+
+# UnionListOfGroups()
+aUnGrp = Mesh_1.UnionListOfGroups([aRedGroup, aGreenGroup, aBlueGroup], "UnionGrp" )
+
+# IntersectListOfGroups()
+aIntGrp=Mesh_1.IntersectListOfGroups([aRedGroup, aGreenGroup, aBlueGroup], "IntGrp" )
+
+# CutListOfGroups()
+aCutGrp=Mesh_1.CutListOfGroups([aRedGroup],[aGreenGroup,aBlueGroup],"CutGrp")
+
+salome.sg.updateObjBrowser( 1 )
+
+# -*- coding: iso-8859-1 -*-
# CEA/LGLS 2008, Christian Van Wambeke (CEA/LGLS), Francis KLOSS (OCC)
# ====================================================================
-import sys\r
-import salome\r
-import geompy\r
-import math\r
-import SALOMEDS\r
-import SMESH\r
-import smesh\r
-\r
-salome.salome_init()\r
-aStudyId = salome.myStudy._get_StudyId()\r
-\r
-geompy.init_geom(salome.myStudy)\r
-\r
-geompy.init_geom(salome.myStudy)\r
-global Box_1\r
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)\r
-geompy.addToStudy( Box_1, "Box_1" )\r
-\r
-#smesh.smesh.SetCurrentStudy(theStudy)\r
-import StdMeshers\r
-Mesh_1 = smesh.Mesh(Box_1)\r
-Regular_1D = Mesh_1.Segment()\r
-Nb_Segments_1 = Regular_1D.NumberOfSegments(10)\r
-Nb_Segments_1.SetDistrType( 0 )\r
-Quadrangle_2D = Mesh_1.Quadrangle()\r
-Hexa_3D = Mesh_1.Hexahedron()\r
-isDone = Mesh_1.Compute()\r
-\r
-### CreateDimGroup()\r
-\r
-aListOf3d_1=range(721,821)\r
-\r
-aGrp3D_1=Mesh_1.GetMesh().CreateGroup( smesh.VOLUME, "Src 3D 1" )\r
-aGrp3D_1.Add( aListOf3d_1 )\r
-\r
-aListOf3d_2=range(821, 921)\r
-aGrp3D_2=Mesh_1.GetMesh().CreateGroup( smesh.VOLUME, "Src 3D 2" )\r
-aGrp3D_2.Add( aListOf3d_2 )\r
-\r
-aGrp2D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.FACE, "Faces" )\r
-\r
-aGrp1D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.EDGE, "Edges" )\r
-\r
-aGrp0D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.NODE, "Nodes" )\r
-\r
-salome.sg.updateObjBrowser( 1 )\r
-\r
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+import geompy
+import math
+import SALOMEDS
+import SMESH
+import smesh
+
+salome.salome_init()
+aStudyId = salome.myStudy._get_StudyId()
+
+geompy.init_geom(salome.myStudy)
+
+geompy.init_geom(salome.myStudy)
+global Box_1
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+geompy.addToStudy( Box_1, "Box_1" )
+
+#smesh.smesh.SetCurrentStudy(theStudy)
+import StdMeshers
+Mesh_1 = smesh.Mesh(Box_1)
+Regular_1D = Mesh_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = Mesh_1.Quadrangle()
+Hexa_3D = Mesh_1.Hexahedron()
+isDone = Mesh_1.Compute()
+
+### CreateDimGroup()
+
+aListOf3d_1=range(721,821)
+
+aGrp3D_1=Mesh_1.GetMesh().CreateGroup( smesh.VOLUME, "Src 3D 1" )
+aGrp3D_1.Add( aListOf3d_1 )
+
+aListOf3d_2=range(821, 921)
+aGrp3D_2=Mesh_1.GetMesh().CreateGroup( smesh.VOLUME, "Src 3D 2" )
+aGrp3D_2.Add( aListOf3d_2 )
+
+aGrp2D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.FACE, "Faces" )
+
+aGrp1D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.EDGE, "Edges" )
+
+aGrp0D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.NODE, "Nodes" )
+
+salome.sg.updateObjBrowser( 1 )
+
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
noNETGENPlugin = 1
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
## @{
Custom = 5
# Optimization level of GHS3D
+# V3.1
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
FromCAD, PreProcess, PreProcessPlus = 0,1,2
print hypName, "was not assigned to",geomName,":", reason
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
## @}
# @return an instance of Mesh class.
# @ingroup l2_construct
def Mesh(self, obj=0, name=0):
- return Mesh(self,self.geompyD,obj,name)
+ if isinstance(obj,str):
+ obj,name = name,obj
+ return Mesh(self,self.geompyD,obj,name)
## Returns a long value from enumeration
# Should be used for SMESH.FunctorType enumeration
print "Error: given parameter is not numerucal functor type."
## Creates hypothesis
- # @param
- # @param
+ # @param theHType mesh hypothesis type (string)
+ # @param theLibName mesh plug-in library name
# @return created hypothesis instance
def CreateHypothesis(self, theHType, theLibName="libStdMeshersEngine.so"):
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
#Registering the new proxy for SMESH_Gen
omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshDC)
# Exports the mesh in a file in MED format and chooses the \a version of MED format
# @param f the file name
# @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
def ExportToMED(self, f, version, opt=0):
self.mesh.ExportToMED(f, opt, version)
elif tgeo == "SHELL":
typ = VOLUME
elif tgeo == "COMPOUND":
- if len( self.geompyD.GetObjectIDs( grp )) == 0:
- print "Mesh.Group: empty geometric group", GetName( grp )
- return 0
- tgeo = self.geompyD.GetType(grp)
- if tgeo == geompyDC.ShapeType["VERTEX"]:
- typ = NODE
- elif tgeo == geompyDC.ShapeType["EDGE"]:
- typ = EDGE
- elif tgeo == geompyDC.ShapeType["FACE"]:
- typ = FACE
- elif tgeo == geompyDC.ShapeType["SOLID"]:
- typ = VOLUME
-
+ try: # it raises on a compound of compounds
+ if len( self.geompyD.GetObjectIDs( grp )) == 0:
+ print "Mesh.Group: empty geometric group", GetName( grp )
+ return 0
+ pass
+ except:
+ pass
+ if grp.GetType() == 37: # GEOMImpl_Types.hxx: #define GEOM_GROUP 37
+ # group
+ tgeo = self.geompyD.GetType(grp)
+ if tgeo == geompyDC.ShapeType["VERTEX"]:
+ typ = NODE
+ elif tgeo == geompyDC.ShapeType["EDGE"]:
+ typ = EDGE
+ elif tgeo == geompyDC.ShapeType["FACE"]:
+ typ = FACE
+ elif tgeo == geompyDC.ShapeType["SOLID"]:
+ 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:
print "Mesh.Group: bad first argument: expected a group, a vertex, an edge, a face or a solid"
return 0
# @ingroup l1_meshinfo
def GetMeshInfo(self, obj = None):
if not obj: obj = self.mesh
- 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
+ return self.smeshpyD.GetMeshInfo(obj)
## Returns the number of nodes in the mesh
# @return an integer value
# @param x the X coordinate of a point
# @param y the Y 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
# @ingroup l2_modif_throughp
def MoveClosestNodeToPoint(self, x, y, z, NodeID):
# @return the ID of a node
# @ingroup l2_modif_throughp
def FindNodeClosestTo(self, x, y, z):
- preview = self.mesh.GetMeshEditPreviewer()
- return preview.MoveClosestNodeToPoint(x, y, z, -1)
+ #preview = self.mesh.GetMeshEditPreviewer()
+ #return preview.MoveClosestNodeToPoint(x, y, z, -1)
+ return self.editor.FindNodeClosestTo(x, y, z)
+
+ ## Finds the elements where a point lays IN or ON
+ # @param x the X coordinate of a point
+ # @param y the Y coordinate of a point
+ # @param z the Z coordinate of a point
+ # @param elementType type of elements to find (SMESH.ALL type
+ # means elements of any type excluding nodes and 0D elements)
+ # @return list of IDs of found elements
+ # @ingroup l2_modif_throughp
+ def FindElementsByPoint(self, x, y, z, elementType = SMESH.ALL):
+ return self.editor.FindElementsByPoint(x, y, z, elementType)
+
## Finds the node closest to a point and moves it to a point location
# @param x the X coordinate of a point
def ConvertFromQuadratic(self):
return self.editor.ConvertFromQuadratic()
+ ## Creates 2D mesh as skin on boundary faces of a 3D mesh
+ # @return TRUE if operation has been completed successfully, FALSE otherwise
+ # @ingroup l2_modif_edit
+ def Make2DMeshFrom3D(self):
+ return self.editor. Make2DMeshFrom3D()
+
## Renumber mesh nodes
# @ingroup l2_modif_renumber
def RenumberNodes(self):
HasRefPoint, RefPoint, MakeGroups, ElemType)
else:
if isinstance(Base,Mesh):
- return self.editor.ExtrusionAlongPathObjX(Base.GetMesh(), Path, NodeStart,
+ return self.editor.ExtrusionAlongPathObjX(Base, Path, NodeStart,
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups, ElemType)
else:
# @return a list of groups of equal elements
# @ingroup l2_modif_trsf
def FindEqualElements (self, MeshOrSubMeshOrGroup):
+ if ( isinstance( MeshOrSubMeshOrGroup, Mesh )):
+ MeshOrSubMeshOrGroup = MeshOrSubMeshOrGroup.GetMesh()
return self.editor.FindEqualElements(MeshOrSubMeshOrGroup)
## Merges elements in each given group.
# @ingroup l1_auxiliary
def GetLastCreatedElems(self):
return self.editor.GetLastCreatedElems()
+
+ ## 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
# replicated nodes should be associated to.
# @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit
- def DoubleNodes(self, theElems, theNodesNot, theAffectedElems):
- return self.editor.DoubleNodes(theElems, theNodesNot, theAffectedElems)
+ def DoubleNodeElem(self, theElems, theNodesNot, theAffectedElems):
+ return self.editor.DoubleNodeElem(theElems, theNodesNot, theAffectedElems)
## 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
# The replicated nodes should be associated to affected elements.
# @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit
- def DoubleNodesInRegion(self, theElems, theNodesNot, theShape):
- return self.editor.DoubleNodesInRegion(theElems, theNodesNot, theShape)
+ def DoubleNodeElemInRegion(self, theElems, theNodesNot, theShape):
+ return self.editor.DoubleNodeElemInRegion(theElems, theNodesNot, theShape)
## 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 theAffectedElems - group of elements to which the replicated nodes
# should be associated to.
# @ingroup l2_modif_edit
- def DoubleNodeGroup(self, theElems, theNodesNot, theAffectedElems):
- return self.editor.DoubleNodeGroup(theElems, theNodesNot, theAffectedElems)
+ def DoubleNodeElemGroup(self, theElems, theNodesNot, theAffectedElems):
+ return self.editor.DoubleNodeElemGroup(theElems, theNodesNot, theAffectedElems)
## Creates a hole in a mesh by doubling the nodes of some particular elements
# This method provided for convenience works as DoubleNodes() described above.
# located on or inside shape).
# The replicated nodes should be associated to affected elements.
# @ingroup l2_modif_edit
- def DoubleNodeGroupInRegion(self, theElems, theNodesNot, theShape):
- return self.editor.DoubleNodeGroup(theElems, theNodesNot, theShape)
+ def DoubleNodeElemGroupInRegion(self, theElems, theNodesNot, theShape):
+ return self.editor.DoubleNodeElemGroup(theElems, theNodesNot, theShape)
## Creates a hole in a mesh by doubling the nodes of some particular elements
# This method provided for convenience works as DoubleNodes() described above.
# should be associated to.
# @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit
- def DoubleNodeGroups(self, theElems, theNodesNot, theAffectedElems):
- return self.editor.DoubleNodeGroups(theElems, theNodesNot, theAffectedElems)
+ def DoubleNodeElemGroups(self, theElems, theNodesNot, theAffectedElems):
+ return self.editor.DoubleNodeElemGroups(theElems, theNodesNot, theAffectedElems)
## Creates a hole in a mesh by doubling the nodes of some particular elements
# This method provided for convenience works as DoubleNodes() described above.
# The replicated nodes should be associated to affected elements.
# @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit
- def DoubleNodeGroupsInRegion(self, theElems, theNodesNot, theShape):
- return self.editor.DoubleNodeGroupsInRegion(theElems, theNodesNot, theShape)
+ def DoubleNodeElemGroupsInRegion(self, theElems, theNodesNot, theShape):
+ return self.editor.DoubleNodeElemGroupsInRegion(theElems, theNodesNot, theShape)
## The mother class to define algorithm, it is not recommended to use it directly.
#
self.Create(mesh, geom, "MEFISTO_2D")
pass
elif algoType == BLSURF:
- import BLSURFPlugin
+ CheckPlugin(BLSURF)
self.Create(mesh, geom, "BLSURF", "libBLSURFEngine.so")
#self.SetPhysicalMesh() - PAL19680
elif algoType == NETGEN:
- if noNETGENPlugin:
- print "Warning: NETGENPlugin module unavailable"
- pass
+ CheckPlugin(NETGEN)
self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
pass
elif algoType == NETGEN_2D:
- if noNETGENPlugin:
- print "Warning: NETGENPlugin module unavailable"
- pass
+ CheckPlugin(NETGEN)
self.Create(mesh, geom, "NETGEN_2D_ONLY", "libNETGENEngine.so")
pass
# @ingroup l3_hypos_blsurf
def SetPhySize(self, theVal):
# Parameter of BLSURF algo
+ self.SetPhysicalMesh(1) #Custom - else why to set the size?
self.Parameters().SetPhySize(theVal)
## Sets lower boundary of mesh element size (PhySize).
Mesh_Algorithm.__init__(self)
if algoType == NETGEN:
+ CheckPlugin(NETGEN)
self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
pass
elif algoType == FULL_NETGEN:
- if noNETGENPlugin:
- print "Warning: NETGENPlugin module has not been imported."
+ CheckPlugin(NETGEN)
self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
pass
elif algoType == GHS3D:
- import GHS3DPlugin
+ CheckPlugin(GHS3D)
self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
pass
elif algoType == GHS3DPRL:
- import GHS3DPRLPlugin
+ CheckPlugin(GHS3DPRL)
self.Create(mesh, geom, "GHS3DPRL_3D" , "libGHS3DPRLEngine.so")
pass
self.Parameters().SetToMeshHoles(toMesh)
## Set Optimization level:
- # None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization.
- # Default is Medium_Optimization
+ # None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization,
+ # Strong_Optimization.
+ # Default is Standard_Optimization
# @ingroup l3_hypos_ghs3dh
def SetOptimizationLevel(self, level):
# Parameter of GHS3D
pass
elif algoType == Hexotic:
- import HexoticPlugin
+ CheckPlugin(Hexotic)
self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so")
pass
def __init__(self, mesh, is3D, geom=0):
Mesh_Algorithm.__init__(self)
- if noNETGENPlugin:
- print "Warning: NETGENPlugin module has not been imported."
+ CheckPlugin(NETGEN)
self.is3D = is3D
if is3D:
class MaxElementVolume(StdMeshers._objref_StdMeshers_MaxElementVolume):
## 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):
volume ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_MaxElementVolume.GetLastParameters(self),1,1,volume)
StdMeshers._objref_StdMeshers_MaxElementVolume.SetParameters(self,parameters)
#Registering the new proxy for NumberOfSegments
omniORB.registerObjref(StdMeshers._objref_StdMeshers_NumberOfSegments._NP_RepositoryId, NumberOfSegments)
+if not noNETGENPlugin:
+ #Wrapper class for NETGENPlugin_Hypothesis hypothesis
+ class NETGENPlugin_Hypothesis(NETGENPlugin._objref_NETGENPlugin_Hypothesis):
+
+ ## Set Max Size parameter value
+ # @param maxsize numerical value or name of variable from notebook
+ def SetMaxSize(self, maxsize):
+ lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self)
+ maxsize, parameters = ParseParameters(lastParameters,4,1,maxsize)
+ NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters)
+ NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetMaxSize(self,maxsize)
+
+ ## Set Growth Rate parameter value
+ # @param value numerical value or name of variable from notebook
+ def SetGrowthRate(self, value):
+ lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self)
+ value, parameters = ParseParameters(lastParameters,4,2,value)
+ NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters)
+ NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetGrowthRate(self,value)
+
+ ## Set Number of Segments per Edge parameter value
+ # @param value numerical value or name of variable from notebook
+ def SetNbSegPerEdge(self, value):
+ lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self)
+ value, parameters = ParseParameters(lastParameters,4,3,value)
+ NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters)
+ NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetNbSegPerEdge(self,value)
+
+ ## Set Number of Segments per Radius parameter value
+ # @param value numerical value or name of variable from notebook
+ def SetNbSegPerRadius(self, value):
+ lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self)
+ value, parameters = ParseParameters(lastParameters,4,4,value)
+ NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters)
+ NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetNbSegPerRadius(self,value)
+
+ #Registering the new proxy for NETGENPlugin_Hypothesis
+ omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_Hypothesis._NP_RepositoryId, NETGENPlugin_Hypothesis)
+
+
+ #Wrapper class for NETGENPlugin_Hypothesis_2D hypothesis
+ class NETGENPlugin_Hypothesis_2D(NETGENPlugin_Hypothesis,NETGENPlugin._objref_NETGENPlugin_Hypothesis_2D):
+ pass
-#Wrapper class for NETGENPlugin_Hypothesis hypothesis
-class NETGENPlugin_Hypothesis(NETGENPlugin._objref_NETGENPlugin_Hypothesis):
-
- ## Set Max Size parameter value
- # @param maxsize numerical value or name of variable from notebook
- def SetMaxSize(self, maxsize):
- lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self)
- maxsize, parameters = ParseParameters(lastParameters,4,1,maxsize)
- NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters)
- NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetMaxSize(self,maxsize)
-
- ## Set Growth Rate parameter value
- # @param value numerical value or name of variable from notebook
- def SetGrowthRate(self, value):
- lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self)
- value, parameters = ParseParameters(lastParameters,4,2,value)
- NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters)
- NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetGrowthRate(self,value)
-
- ## Set Number of Segments per Edge parameter value
- # @param value numerical value or name of variable from notebook
- def SetNbSegPerEdge(self, value):
- lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self)
- value, parameters = ParseParameters(lastParameters,4,3,value)
- NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters)
- NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetNbSegPerEdge(self,value)
-
- ## Set Number of Segments per Radius parameter value
- # @param value numerical value or name of variable from notebook
- def SetNbSegPerRadius(self, value):
- lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self)
- value, parameters = ParseParameters(lastParameters,4,4,value)
- NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters)
- NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetNbSegPerRadius(self,value)
-
-#Registering the new proxy for NETGENPlugin_Hypothesis
-omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_Hypothesis._NP_RepositoryId, NETGENPlugin_Hypothesis)
-
-
-#Wrapper class for NETGENPlugin_Hypothesis_2D hypothesis
-class NETGENPlugin_Hypothesis_2D(NETGENPlugin_Hypothesis,NETGENPlugin._objref_NETGENPlugin_Hypothesis_2D):
- pass
-
-#Registering the new proxy for NETGENPlugin_Hypothesis_2D
-omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_Hypothesis_2D._NP_RepositoryId, NETGENPlugin_Hypothesis_2D)
-
-#Wrapper class for NETGENPlugin_SimpleHypothesis_2D hypothesis
-class NETGEN_SimpleParameters_2D(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D):
-
- ## Set Number of Segments parameter value
- # @param nbSeg numerical value or name of variable from notebook
- def SetNumberOfSegments(self, nbSeg):
- lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self)
- nbSeg, parameters = ParseParameters(lastParameters,2,1,nbSeg)
- NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters)
- NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetNumberOfSegments(self, nbSeg)
-
- ## Set Local Length parameter value
- # @param length numerical value or name of variable from notebook
- def SetLocalLength(self, length):
- lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self)
- length, parameters = ParseParameters(lastParameters,2,1,length)
- NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters)
- NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetLocalLength(self, length)
-
- ## Set Max Element Area parameter value
- # @param area numerical value or name of variable from notebook
- def SetMaxElementArea(self, area):
- lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self)
- area, parameters = ParseParameters(lastParameters,2,2,area)
- NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters)
- NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetMaxElementArea(self, area)
-
- def LengthFromEdges(self):
- lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self)
- value = 0;
- value, parameters = ParseParameters(lastParameters,2,2,value)
- NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters)
- NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.LengthFromEdges(self)
-
-#Registering the new proxy for NETGEN_SimpleParameters_2D
-omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D._NP_RepositoryId, NETGEN_SimpleParameters_2D)
-
-
-#Wrapper class for NETGENPlugin_SimpleHypothesis_3D hypothesis
-class NETGEN_SimpleParameters_3D(NETGEN_SimpleParameters_2D,NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D):
- ## Set Max Element Volume parameter value
- # @param volume numerical value or name of variable from notebook
- def SetMaxElementVolume(self, volume):
- lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.GetLastParameters(self)
- volume, parameters = ParseParameters(lastParameters,3,3,volume)
- NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetParameters(self,parameters)
- NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetMaxElementVolume(self, volume)
-
- def LengthFromFaces(self):
- lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.GetLastParameters(self)
- value = 0;
- value, parameters = ParseParameters(lastParameters,3,3,value)
- NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetParameters(self,parameters)
- NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.LengthFromFaces(self)
-
-#Registering the new proxy for NETGEN_SimpleParameters_3D
-omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D._NP_RepositoryId, NETGEN_SimpleParameters_3D)
+ #Registering the new proxy for NETGENPlugin_Hypothesis_2D
+ omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_Hypothesis_2D._NP_RepositoryId, NETGENPlugin_Hypothesis_2D)
+
+ #Wrapper class for NETGENPlugin_SimpleHypothesis_2D hypothesis
+ class NETGEN_SimpleParameters_2D(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D):
+
+ ## Set Number of Segments parameter value
+ # @param nbSeg numerical value or name of variable from notebook
+ def SetNumberOfSegments(self, nbSeg):
+ lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self)
+ nbSeg, parameters = ParseParameters(lastParameters,2,1,nbSeg)
+ NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters)
+ NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetNumberOfSegments(self, nbSeg)
+
+ ## Set Local Length parameter value
+ # @param length numerical value or name of variable from notebook
+ def SetLocalLength(self, length):
+ lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self)
+ length, parameters = ParseParameters(lastParameters,2,1,length)
+ NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters)
+ NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetLocalLength(self, length)
+
+ ## Set Max Element Area parameter value
+ # @param area numerical value or name of variable from notebook
+ def SetMaxElementArea(self, area):
+ lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self)
+ area, parameters = ParseParameters(lastParameters,2,2,area)
+ NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters)
+ NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetMaxElementArea(self, area)
+
+ def LengthFromEdges(self):
+ lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self)
+ value = 0;
+ value, parameters = ParseParameters(lastParameters,2,2,value)
+ NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters)
+ NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.LengthFromEdges(self)
+
+ #Registering the new proxy for NETGEN_SimpleParameters_2D
+ omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D._NP_RepositoryId, NETGEN_SimpleParameters_2D)
+
+
+ #Wrapper class for NETGENPlugin_SimpleHypothesis_3D hypothesis
+ class NETGEN_SimpleParameters_3D(NETGEN_SimpleParameters_2D,NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D):
+ ## Set Max Element Volume parameter value
+ # @param volume numerical value or name of variable from notebook
+ def SetMaxElementVolume(self, volume):
+ lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.GetLastParameters(self)
+ volume, parameters = ParseParameters(lastParameters,3,3,volume)
+ NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetParameters(self,parameters)
+ NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetMaxElementVolume(self, volume)
+
+ def LengthFromFaces(self):
+ lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.GetLastParameters(self)
+ value = 0;
+ value, parameters = ParseParameters(lastParameters,3,3,value)
+ NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetParameters(self,parameters)
+ NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.LengthFromFaces(self)
+
+ #Registering the new proxy for 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):
:SMESH_3D_Algo(hypId, studyId, gen)
{
_name = "CompositeHexa_3D";
- _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type
+ _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type
}
//================================================================================
//purpose : auxilary for Evaluate
//=======================================================================
int GetNb2d(_QuadFaceGrid* QFG, SMESH_Mesh& theMesh,
- MapShapeNbElems& aResMap)
+ MapShapeNbElems& aResMap)
{
int nb2d = 0;
_QuadFaceGrid::TChildIterator aCI = QFG->GetChildren();
//================================================================================
bool StdMeshers_CompositeHexa_3D::Evaluate(SMESH_Mesh& theMesh,
- const TopoDS_Shape& theShape,
- MapShapeNbElems& aResMap)
+ const TopoDS_Shape& theShape,
+ MapShapeNbElems& aResMap)
{
SMESH_MesherHelper aTool(theMesh);
bool _quadraticMesh = aTool.IsQuadraticSubMesh(theShape);
int nb0 = 0;
SMESH_subMesh *sm = theMesh.GetSubMesh(exp.Current());
if( sm ) {
- MapShapeNbElemsItr anIt = aResMap.find(sm);
- if( anIt == aResMap.end() ) continue;
- std::vector<int> aVec = (*anIt).second;
- nb0 = aVec[SMDSEntity_Node];
+ MapShapeNbElemsItr anIt = aResMap.find(sm);
+ if( anIt == aResMap.end() ) continue;
+ std::vector<int> aVec = (*anIt).second;
+ nb0 = aVec[SMDSEntity_Node];
}
int j = 1;
for(; j<=BndEdges.Length(); j++) {
- if( BndEdges.Value(j) == exp.Current() ) {
- // internal edge => remove it
- BndEdges.Remove(j);
- nb0d_in += nb0;
- break;
- }
+ if( BndEdges.Value(j) == exp.Current() ) {
+ // internal edge => remove it
+ BndEdges.Remove(j);
+ nb0d_in += nb0;
+ break;
+ }
}
if( j > BndEdges.Length() ) {
- BndEdges.Append(exp.Current());
+ BndEdges.Append(exp.Current());
}
//if( BndEdges.Contains(exp.Current()) ) {
//BndEdges.Remove( exp.Current() );
//================================================================================
StdMeshers_FaceSide::StdMeshers_FaceSide(const SMDS_MeshNode* theNode,
- const gp_Pnt2d thePnt2d,
- const StdMeshers_FaceSide* theSide)
+ const gp_Pnt2d thePnt2d,
+ const StdMeshers_FaceSide* theSide)
{
myC2d.resize(1);
myLength = 0;
return TSideVector(0);
}
}
- // find out side orientation, which is important if there are several wires (PAL19080)
- 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() );
- }
-
+ const bool isForward = true;
StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh,
isForward, theIgnoreMediumNodes);
wires[ iW ] = StdMeshers_FaceSidePtr( wire );
* \brief Wrap for vertex using data from other FaceSide
*/
StdMeshers_FaceSide(const SMDS_MeshNode* theNode,
- const gp_Pnt2d thePnt2d,
+ const gp_Pnt2d thePnt2d,
const StdMeshers_FaceSide* theSide);
/*!
* \brief Return wires of a face as StdMeshers_FaceSide's
using namespace std;
static SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh &,
- const TopoDS_Shape &);
+ const TopoDS_Shape &);
static bool EvaluatePentahedralMesh(SMESH_Mesh &, const TopoDS_Shape &,
- MapShapeNbElems &);
+ MapShapeNbElems &);
//=============================================================================
/*!
{
MESSAGE("StdMeshers_Hexa_3D::StdMeshers_Hexa_3D");
_name = "Hexa_3D";
- _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type
+ _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type
}
//=============================================================================
try {
aQuads[i] = quadAlgo->CheckAnd2Dcompute(aMesh, aFace, _quadraticMesh);
if(!aQuads[i]) {
- return error( quadAlgo->GetComputeError());
+ return error( quadAlgo->GetComputeError());
}
}
catch(SALOME_Exception & S_ex) {
int _indX1 = GetFaceIndex(aMesh, aShape, meshFaces,
aCube.V100, aCube.V101, aCube.V110, aCube.V111);
- // IPAL21120: SIGSEGV on Meshing attached Compound with Automatic Hexadralization
+ // IPAL21120: SIGSEGV on Meshing attached Compound with Automatic Hexadralization
if ( _indY1 < 1 || _indZ0 < 1 || _indZ1 < 1 || _indX0 < 1 || _indX1 < 1 )
return error(COMPERR_BAD_SHAPE);
// 1.7 - get convertion coefs from face 2D normalized to 3D normalized
- Conv2DStruct cx0; // for face X=0
- Conv2DStruct cx1; // for face X=1
+ Conv2DStruct cx0; // for face X=0
+ Conv2DStruct cx1; // for face X=1
Conv2DStruct cy0;
Conv2DStruct cy1;
Conv2DStruct cz0;
const TopoDS_Face & F = TopoDS::Face(meshFaces[_indX0]->GetSubShape());
faceQuadStruct *quad = aCube.quad_X0;
- int i = 0; // j = x/face , k = y/face
+ int i = 0; // j = x/face , k = y/face
int nbdown = quad->side[0]->NbPoints();
int nbright = quad->side[1]->NbPoints();
SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
-
+
while(itf->more()) {
const SMDS_MeshNode * node = itf->next();
if(aTool.IsMedium(node))
for (int i1 = 0; i1 < nbdown; i1++)
for (int j1 = 0; j1 < nbright; j1++) {
int ij1 = j1 * nbdown + i1;
- int j = cx0.ia * i1 + cx0.ib * j1 + cx0.ic; // j = x/face
- int k = cx0.ja * i1 + cx0.jb * j1 + cx0.jc; // k = y/face
+ int j = cx0.ia * i1 + cx0.ib * j1 + cx0.ic; // j = x/face
+ int k = cx0.ja * i1 + cx0.jb * j1 + cx0.jc; // k = y/face
int ijk = k * nbx * nby + j * nbx + i;
//MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
np[ijk].node = quad->uv_grid[ij1].node;
SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
faceQuadStruct *quad = aCube.quad_X1;
- int i = nbx - 1; // j = x/face , k = y/face
+ int i = nbx - 1; // j = x/face , k = y/face
int nbdown = quad->side[0]->NbPoints();
int nbright = quad->side[1]->NbPoints();
for (int i1 = 0; i1 < nbdown; i1++)
for (int j1 = 0; j1 < nbright; j1++) {
int ij1 = j1 * nbdown + i1;
- int j = cx1.ia * i1 + cx1.ib * j1 + cx1.ic; // j = x/face
- int k = cx1.ja * i1 + cx1.jb * j1 + cx1.jc; // k = y/face
+ int j = cx1.ia * i1 + cx1.ib * j1 + cx1.ic; // j = x/face
+ int k = cx1.ja * i1 + cx1.jb * j1 + cx1.jc; // k = y/face
int ijk = k * nbx * nby + j * nbx + i;
//MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
np[ijk].node = quad->uv_grid[ij1].node;
SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
faceQuadStruct *quad = aCube.quad_Y0;
- int j = 0; // i = x/face , k = y/face
+ int j = 0; // i = x/face , k = y/face
int nbdown = quad->side[0]->NbPoints();
int nbright = quad->side[1]->NbPoints();
for (int i1 = 0; i1 < nbdown; i1++)
for (int j1 = 0; j1 < nbright; j1++) {
int ij1 = j1 * nbdown + i1;
- int i = cy0.ia * i1 + cy0.ib * j1 + cy0.ic; // i = x/face
- int k = cy0.ja * i1 + cy0.jb * j1 + cy0.jc; // k = y/face
+ int i = cy0.ia * i1 + cy0.ib * j1 + cy0.ic; // i = x/face
+ int k = cy0.ja * i1 + cy0.jb * j1 + cy0.jc; // k = y/face
int ijk = k * nbx * nby + j * nbx + i;
//MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
np[ijk].node = quad->uv_grid[ij1].node;
SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
faceQuadStruct *quad = aCube.quad_Y1;
- int j = nby - 1; // i = x/face , k = y/face
+ int j = nby - 1; // i = x/face , k = y/face
int nbdown = quad->side[0]->NbPoints();
int nbright = quad->side[1]->NbPoints();
for (int i1 = 0; i1 < nbdown; i1++)
for (int j1 = 0; j1 < nbright; j1++) {
int ij1 = j1 * nbdown + i1;
- int i = cy1.ia * i1 + cy1.ib * j1 + cy1.ic; // i = x/face
- int k = cy1.ja * i1 + cy1.jb * j1 + cy1.jc; // k = y/face
+ int i = cy1.ia * i1 + cy1.ib * j1 + cy1.ic; // i = x/face
+ int k = cy1.ja * i1 + cy1.jb * j1 + cy1.jc; // k = y/face
int ijk = k * nbx * nby + j * nbx + i;
//MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
np[ijk].node = quad->uv_grid[ij1].node;
SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
faceQuadStruct *quad = aCube.quad_Z0;
- int k = 0; // i = x/face , j = y/face
+ int k = 0; // i = x/face , j = y/face
int nbdown = quad->side[0]->NbPoints();
int nbright = quad->side[1]->NbPoints();
for (int i1 = 0; i1 < nbdown; i1++)
for (int j1 = 0; j1 < nbright; j1++) {
int ij1 = j1 * nbdown + i1;
- int i = cz0.ia * i1 + cz0.ib * j1 + cz0.ic; // i = x/face
- int j = cz0.ja * i1 + cz0.jb * j1 + cz0.jc; // j = y/face
+ int i = cz0.ia * i1 + cz0.ib * j1 + cz0.ic; // i = x/face
+ int j = cz0.ja * i1 + cz0.jb * j1 + cz0.jc; // j = y/face
int ijk = k * nbx * nby + j * nbx + i;
//MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
np[ijk].node = quad->uv_grid[ij1].node;
SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
faceQuadStruct *quad = aCube.quad_Z1;
- int k = nbz - 1; // i = x/face , j = y/face
+ int k = nbz - 1; // i = x/face , j = y/face
int nbdown = quad->side[0]->NbPoints();
int nbright = quad->side[1]->NbPoints();
for (int i1 = 0; i1 < nbdown; i1++)
for (int j1 = 0; j1 < nbright; j1++) {
int ij1 = j1 * nbdown + i1;
- int i = cz1.ia * i1 + cz1.ib * j1 + cz1.ic; // i = x/face
- int j = cz1.ja * i1 + cz1.jb * j1 + cz1.jc; // j = y/face
+ int i = cz1.ia * i1 + cz1.ib * j1 + cz1.ic; // i = x/face
+ int j = cz1.ja * i1 + cz1.jb * j1 + cz1.jc; // j = y/face
int ijk = k * nbx * nby + j * nbx + i;
//MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
np[ijk].node = quad->uv_grid[ij1].node;
GetPoint(p1yz, nbx - 1, j, k, nbx, nby, nbz, np, meshDS);
int ijk = k * nbx * nby + j * nbx + i;
- double x = double (i) / double (nbx - 1); // *** seulement
- double y = double (j) / double (nby - 1); // *** maillage
- double z = double (k) / double (nbz - 1); // *** regulier
+ double x = double (i) / double (nbx - 1); // *** seulement
+ double y = double (j) / double (nby - 1); // *** maillage
+ double z = double (k) / double (nbz - 1); // *** regulier
Pt3 X;
for (int i = 0; i < 3; i++) {
//=============================================================================
bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh,
- const TopoDS_Shape & aShape,
- MapShapeNbElems& aResMap)
+ const TopoDS_Shape & aShape,
+ MapShapeNbElems& aResMap)
{
vector < SMESH_subMesh * >meshFaces;
TopTools_SequenceOfShape aFaces;
std::vector<int> aVec = (*anIt).second;
int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
if( nbtri == 0 )
- isAllQuad = true;
+ isAllQuad = true;
}
if ( ! isAllQuad ) {
return EvaluatePentahedralMesh(aMesh, aShape, aResMap);
std::vector<int> aVec = (*anIt).second;
nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
if(IsFirst) {
- IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
- IsFirst = false;
+ IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
+ IsFirst = false;
}
}
}
bool IsOpposite = true;
for(TopExp_Explorer exp(aFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) {
if( Edges1.Contains(exp.Current()) ) {
- IsOpposite = false;
- break;
+ IsOpposite = false;
+ break;
}
}
if(IsOpposite) {
void StdMeshers_Hexa_3D::GetPoint(Pt3 p, int i, int j, int k, int nbx, int nby, int nbz,
Point3DStruct * np, const SMESHDS_Mesh * meshDS)
{
- int ijk = k * nbx * nby + j * nbx + i;
- const SMDS_MeshNode * node = np[ijk].node;
- p[0] = node->X();
- p[1] = node->Y();
- p[2] = node->Z();
- //MESSAGE(" "<<i<<" "<<j<<" "<<k<<" "<<p[0]<<" "<<p[1]<<" "<<p[2]);
+ int ijk = k * nbx * nby + j * nbx + i;
+ const SMDS_MeshNode * node = np[ijk].node;
+ p[0] = node->X();
+ p[1] = node->Y();
+ p[2] = node->Z();
+ //MESSAGE(" "<<i<<" "<<j<<" "<<k<<" "<<p[0]<<" "<<p[1]<<" "<<p[2]);
}
//=============================================================================
//=============================================================================
int StdMeshers_Hexa_3D::GetFaceIndex(SMESH_Mesh & aMesh,
- const TopoDS_Shape & aShape,
- const vector < SMESH_subMesh * >&meshFaces,
- const TopoDS_Vertex & V0,
- const TopoDS_Vertex & V1,
- const TopoDS_Vertex & V2, const TopoDS_Vertex & V3)
+ const TopoDS_Shape & aShape,
+ const vector < SMESH_subMesh * >&meshFaces,
+ const TopoDS_Vertex & V0,
+ const TopoDS_Vertex & V1,
+ const TopoDS_Vertex & V2, const TopoDS_Vertex & V3)
{
- //MESSAGE("StdMeshers_Hexa_3D::GetFaceIndex");
- int faceIndex = -1;
- for (int i = 1; i < 6; i++)
- {
- const TopoDS_Shape & aFace = meshFaces[i]->GetSubShape();
- //const TopoDS_Face& F = TopoDS::Face(aFace);
- TopTools_IndexedMapOfShape M;
- TopExp::MapShapes(aFace, TopAbs_VERTEX, M);
- bool verticesInShape = false;
- if (M.Contains(V0))
- if (M.Contains(V1))
- if (M.Contains(V2))
- if (M.Contains(V3))
- verticesInShape = true;
- if (verticesInShape)
- {
- faceIndex = i;
- break;
- }
- }
- //IPAL21120 ASSERT(faceIndex > 0);
- //SCRUTE(faceIndex);
- return faceIndex;
+ //MESSAGE("StdMeshers_Hexa_3D::GetFaceIndex");
+ int faceIndex = -1;
+ for (int i = 1; i < 6; i++)
+ {
+ const TopoDS_Shape & aFace = meshFaces[i]->GetSubShape();
+ //const TopoDS_Face& F = TopoDS::Face(aFace);
+ TopTools_IndexedMapOfShape M;
+ TopExp::MapShapes(aFace, TopAbs_VERTEX, M);
+ bool verticesInShape = false;
+ if (M.Contains(V0))
+ if (M.Contains(V1))
+ if (M.Contains(V2))
+ if (M.Contains(V3))
+ verticesInShape = true;
+ if (verticesInShape)
+ {
+ faceIndex = i;
+ break;
+ }
+ }
+ //IPAL21120 ASSERT(faceIndex > 0);
+ //SCRUTE(faceIndex);
+ return faceIndex;
}
//=============================================================================
//=============================================================================
TopoDS_Edge
- StdMeshers_Hexa_3D::EdgeNotInFace(SMESH_Mesh & aMesh,
- const TopoDS_Shape & aShape,
- const TopoDS_Face & aFace,
- const TopoDS_Vertex & aVertex,
- const TopTools_IndexedDataMapOfShapeListOfShape & MS)
+ StdMeshers_Hexa_3D::EdgeNotInFace(SMESH_Mesh & aMesh,
+ const TopoDS_Shape & aShape,
+ const TopoDS_Face & aFace,
+ const TopoDS_Vertex & aVertex,
+ const TopTools_IndexedDataMapOfShapeListOfShape & MS)
{
- //MESSAGE("StdMeshers_Hexa_3D::EdgeNotInFace");
- TopTools_IndexedDataMapOfShapeListOfShape MF;
- TopExp::MapShapesAndAncestors(aFace, TopAbs_VERTEX, TopAbs_EDGE, MF);
- const TopTools_ListOfShape & ancestorsInSolid = MS.FindFromKey(aVertex);
- const TopTools_ListOfShape & ancestorsInFace = MF.FindFromKey(aVertex);
-// SCRUTE(ancestorsInSolid.Extent());
-// SCRUTE(ancestorsInFace.Extent());
- ASSERT(ancestorsInSolid.Extent() == 6); // 6 (edges doublees)
- ASSERT(ancestorsInFace.Extent() == 2);
-
- TopoDS_Edge E;
- E.Nullify();
- TopTools_ListIteratorOfListOfShape its(ancestorsInSolid);
- for (; its.More(); its.Next())
- {
- TopoDS_Shape ancestor = its.Value();
- TopTools_ListIteratorOfListOfShape itf(ancestorsInFace);
- bool isInFace = false;
- for (; itf.More(); itf.Next())
- {
- TopoDS_Shape ancestorInFace = itf.Value();
- if (ancestorInFace.IsSame(ancestor))
- {
- isInFace = true;
- break;
- }
- }
- if (!isInFace)
- {
- E = TopoDS::Edge(ancestor);
- break;
- }
- }
- return E;
+ //MESSAGE("StdMeshers_Hexa_3D::EdgeNotInFace");
+ TopTools_IndexedDataMapOfShapeListOfShape MF;
+ TopExp::MapShapesAndAncestors(aFace, TopAbs_VERTEX, TopAbs_EDGE, MF);
+ const TopTools_ListOfShape & ancestorsInSolid = MS.FindFromKey(aVertex);
+ const TopTools_ListOfShape & ancestorsInFace = MF.FindFromKey(aVertex);
+// SCRUTE(ancestorsInSolid.Extent());
+// SCRUTE(ancestorsInFace.Extent());
+ ASSERT(ancestorsInSolid.Extent() == 6); // 6 (edges doublees)
+ ASSERT(ancestorsInFace.Extent() == 2);
+
+ TopoDS_Edge E;
+ E.Nullify();
+ TopTools_ListIteratorOfListOfShape its(ancestorsInSolid);
+ for (; its.More(); its.Next())
+ {
+ TopoDS_Shape ancestor = its.Value();
+ TopTools_ListIteratorOfListOfShape itf(ancestorsInFace);
+ bool isInFace = false;
+ for (; itf.More(); itf.Next())
+ {
+ TopoDS_Shape ancestorInFace = itf.Value();
+ if (ancestorInFace.IsSame(ancestor))
+ {
+ isInFace = true;
+ break;
+ }
+ }
+ if (!isInFace)
+ {
+ E = TopoDS::Edge(ancestor);
+ break;
+ }
+ }
+ return E;
}
//=============================================================================
//=============================================================================
void StdMeshers_Hexa_3D::GetConv2DCoefs(const faceQuadStruct & quad,
- const TopoDS_Shape & aShape,
- const TopoDS_Vertex & V0,
- const TopoDS_Vertex & V1,
- const TopoDS_Vertex & V2, const TopoDS_Vertex & V3, Conv2DStruct & conv)
+ const TopoDS_Shape & aShape,
+ const TopoDS_Vertex & V0,
+ const TopoDS_Vertex & V1,
+ const TopoDS_Vertex & V2, const TopoDS_Vertex & V3, Conv2DStruct & conv)
{
-// MESSAGE("StdMeshers_Hexa_3D::GetConv2DCoefs");
-// const TopoDS_Face & F = TopoDS::Face(aShape);
-// TopoDS_Edge E = quad.edge[0];
-// double f, l;
-// Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
-// TopoDS_Vertex VFirst, VLast;
-// TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
-// bool isForward = (((l - f) * (quad.last[0] - quad.first[0])) > 0);
+// MESSAGE("StdMeshers_Hexa_3D::GetConv2DCoefs");
+// const TopoDS_Face & F = TopoDS::Face(aShape);
+// TopoDS_Edge E = quad.edge[0];
+// double f, l;
+// Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+// TopoDS_Vertex VFirst, VLast;
+// TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
+// bool isForward = (((l - f) * (quad.last[0] - quad.first[0])) > 0);
TopoDS_Vertex VA, VB;
-// if (isForward)
-// {
-// VA = VFirst;
-// VB = VLast;
-// }
-// else
-// {
-// VA = VLast;
-// VB = VFirst;
-// }
+// if (isForward)
+// {
+// VA = VFirst;
+// VB = VLast;
+// }
+// else
+// {
+// VA = VLast;
+// VB = VFirst;
+// }
VA = quad.side[0]->FirstVertex();
VB = quad.side[0]->LastVertex();
- int a1, b1, c1, a2, b2, c2;
- if (VA.IsSame(V0))
- if (VB.IsSame(V1))
- {
- a1 = 1;
- b1 = 0;
- c1 = 0; // x
- a2 = 0;
- b2 = 1;
- c2 = 0; // y
- }
- else
- {
- ASSERT(VB.IsSame(V3));
- a1 = 0;
- b1 = 1;
- c1 = 0; // y
- a2 = 1;
- b2 = 0;
- c2 = 0; // x
- }
- if (VA.IsSame(V1))
- if (VB.IsSame(V2))
- {
- a1 = 0;
- b1 = -1;
- c1 = 1; // 1-y
- a2 = 1;
- b2 = 0;
- c2 = 0; // x
- }
- else
- {
- ASSERT(VB.IsSame(V0));
- a1 = -1;
- b1 = 0;
- c1 = 1; // 1-x
- a2 = 0;
- b2 = 1;
- c2 = 0; // y
- }
- if (VA.IsSame(V2))
- if (VB.IsSame(V3))
- {
- a1 = -1;
- b1 = 0;
- c1 = 1; // 1-x
- a2 = 0;
- b2 = -1;
- c2 = 1; // 1-y
- }
- else
- {
- ASSERT(VB.IsSame(V1));
- a1 = 0;
- b1 = -1;
- c1 = 1; // 1-y
- a2 = -1;
- b2 = 0;
- c2 = 1; // 1-x
- }
- if (VA.IsSame(V3))
- if (VB.IsSame(V0))
- {
- a1 = 0;
- b1 = 1;
- c1 = 0; // y
- a2 = -1;
- b2 = 0;
- c2 = 1; // 1-x
- }
- else
- {
- ASSERT(VB.IsSame(V2));
- a1 = 1;
- b1 = 0;
- c1 = 0; // x
- a2 = 0;
- b2 = -1;
- c2 = 1; // 1-y
- }
-// MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y");
-// MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y");
- conv.a1 = a1;
- conv.b1 = b1;
- conv.c1 = c1;
- conv.a2 = a2;
- conv.b2 = b2;
- conv.c2 = c2;
-
- int nbdown = quad.side[0]->NbPoints();
- int nbright = quad.side[1]->NbPoints();
- conv.ia = int (a1);
- conv.ib = int (b1);
- conv.ic =
- int (c1 * a1 * a1) * (nbdown - 1) + int (c1 * b1 * b1) * (nbright - 1);
- conv.ja = int (a2);
- conv.jb = int (b2);
- conv.jc =
- int (c2 * a2 * a2) * (nbdown - 1) + int (c2 * b2 * b2) * (nbright - 1);
-// MESSAGE("I " << conv.ia << " " << conv.ib << " " << conv.ic);
-// MESSAGE("J " << conv.ja << " " << conv.jb << " " << conv.jc);
+ int a1, b1, c1, a2, b2, c2;
+ if (VA.IsSame(V0))
+ if (VB.IsSame(V1))
+ {
+ a1 = 1;
+ b1 = 0;
+ c1 = 0; // x
+ a2 = 0;
+ b2 = 1;
+ c2 = 0; // y
+ }
+ else
+ {
+ ASSERT(VB.IsSame(V3));
+ a1 = 0;
+ b1 = 1;
+ c1 = 0; // y
+ a2 = 1;
+ b2 = 0;
+ c2 = 0; // x
+ }
+ if (VA.IsSame(V1))
+ if (VB.IsSame(V2))
+ {
+ a1 = 0;
+ b1 = -1;
+ c1 = 1; // 1-y
+ a2 = 1;
+ b2 = 0;
+ c2 = 0; // x
+ }
+ else
+ {
+ ASSERT(VB.IsSame(V0));
+ a1 = -1;
+ b1 = 0;
+ c1 = 1; // 1-x
+ a2 = 0;
+ b2 = 1;
+ c2 = 0; // y
+ }
+ if (VA.IsSame(V2))
+ if (VB.IsSame(V3))
+ {
+ a1 = -1;
+ b1 = 0;
+ c1 = 1; // 1-x
+ a2 = 0;
+ b2 = -1;
+ c2 = 1; // 1-y
+ }
+ else
+ {
+ ASSERT(VB.IsSame(V1));
+ a1 = 0;
+ b1 = -1;
+ c1 = 1; // 1-y
+ a2 = -1;
+ b2 = 0;
+ c2 = 1; // 1-x
+ }
+ if (VA.IsSame(V3))
+ if (VB.IsSame(V0))
+ {
+ a1 = 0;
+ b1 = 1;
+ c1 = 0; // y
+ a2 = -1;
+ b2 = 0;
+ c2 = 1; // 1-x
+ }
+ else
+ {
+ ASSERT(VB.IsSame(V2));
+ a1 = 1;
+ b1 = 0;
+ c1 = 0; // x
+ a2 = 0;
+ b2 = -1;
+ c2 = 1; // 1-y
+ }
+// MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y");
+// MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y");
+ conv.a1 = a1;
+ conv.b1 = b1;
+ conv.c1 = c1;
+ conv.a2 = a2;
+ conv.b2 = b2;
+ conv.c2 = c2;
+
+ int nbdown = quad.side[0]->NbPoints();
+ int nbright = quad.side[1]->NbPoints();
+ conv.ia = int (a1);
+ conv.ib = int (b1);
+ conv.ic =
+ int (c1 * a1 * a1) * (nbdown - 1) + int (c1 * b1 * b1) * (nbright - 1);
+ conv.ja = int (a2);
+ conv.jb = int (b2);
+ conv.jc =
+ int (c2 * a2 * a2) * (nbdown - 1) + int (c2 * b2 * b2) * (nbright - 1);
+// MESSAGE("I " << conv.ia << " " << conv.ib << " " << conv.ic);
+// MESSAGE("J " << conv.ja << " " << conv.jb << " " << conv.jc);
}
//================================================================================
//=======================================================================
bool EvaluatePentahedralMesh(SMESH_Mesh & aMesh,
- const TopoDS_Shape & aShape,
- MapShapeNbElems& aResMap)
+ const TopoDS_Shape & aShape,
+ MapShapeNbElems& aResMap)
{
StdMeshers_Penta_3D anAlgo;
bool bOK = anAlgo.Evaluate(aMesh, aShape, aResMap);
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_Surface.hxx>
+#include <Precision.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
TopoDS_Face F = TopoDS::Face(aShape.Oriented(TopAbs_FORWARD));
double aLen = 0.0;
- double NbSeg = 0;
+ int NbSeg = 0;
bool IsQuadratic = false;
bool IsFirst = true;
TopExp_Explorer exp(F,TopAbs_EDGE);
P1 = P2;
}
}
+ if(NbSeg<1) {
+ std::vector<int> aResVec(SMDSEntity_Last);
+ for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+ SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+ aResMap.insert(std::make_pair(sm,aResVec));
+ SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+ smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,
+ "Submesh can not be evaluated",this));
+ return false;
+ }
aLen = aLen/NbSeg; // middle length
- _edgeLength = DBL_MAX;
+ _edgeLength = Precision::Infinite();
double tmpLength = Min( _edgeLength, aLen );
GProp_GProps G;
BRepGProp::SurfaceProperties(aShape,G);
double anArea = G.Mass();
- int nbFaces = (int) ( anArea/(tmpLength*tmpLength*sqrt(3.)/4) );
+ int nbFaces = Precision::IsInfinite( tmpLength ) ? 0 :
+ (int)( anArea/(tmpLength*tmpLength*sqrt(3.)/4) );
int nbNodes = (int) ( nbFaces*3 - (NbSeg-1)*2 ) / 6;
std::vector<int> aVec(SMDSEntity_Last);
#include <Standard_ErrorHandler.hxx>
#endif
+#include <Basics_Utils.hxx>
+
using namespace std;
const double PRECISION = 1e-7;
#ifdef NO_CAS_CATCH
OCC_CATCH_SIGNALS;
#endif
- val = pow( 10.0, val );
+ val = pow( 10.0, val );
} catch(Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- throw SALOME_Exception( LOCALIZED( "invalid value"));
- return;
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ throw SALOME_Exception( LOCALIZED( "invalid value"));
+ return;
}
}
else if( _convMode==1 && val<0.0 )
if( !name.IsNull() )
{
if( name->GetName()!="t" )
- res = false;
+ res = false;
}
else
res = isCorrectArg( sub );
*/
//================================================================================
bool process( const TCollection_AsciiString& str, int convMode,
- bool& syntax, bool& args,
- bool& non_neg, bool& non_zero,
- bool& singulars, double& sing_point )
+ bool& syntax, bool& args,
+ bool& non_neg, bool& non_zero,
+ bool& singulars, double& sing_point )
{
+ Kernel_Utils::Localizer loc;
+
bool parsed_ok = true;
Handle( ExprIntrp_GenExp ) myExpr;
try {
double t = double(i)/double(max), val;
if( !f.value( t, val ) )
{
- sing_point = t;
- singulars = true;
- break;
+ sing_point = t;
+ singulars = true;
+ break;
}
if( val<0 )
{
- non_neg = false;
- break;
+ non_neg = false;
+ break;
}
if( val>PRECISION )
- non_zero = true;
+ non_zero = true;
}
}
+
return res && non_neg && non_zero && ( !singulars );
}
//=============================================================================
StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId,
- SMESH_Gen* gen)
+ SMESH_Gen* gen)
: SMESH_2D_Algo(hypId, studyId, gen)
{
MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D");
theHyp = hyps.front();
if(strcmp("QuadrangleParams", theHyp->GetName()) == 0) {
const StdMeshers_QuadrangleParams* theHyp1 =
- (const StdMeshers_QuadrangleParams*)theHyp;
+ (const StdMeshers_QuadrangleParams*)theHyp;
myTriaVertexID = theHyp1->GetTriaVertex();
myQuadranglePreference= false;
myTrianglePreference= false;
theHyp = hyps.front();
if(strcmp("QuadrangleParams", theHyp->GetName()) == 0) {
const StdMeshers_QuadrangleParams* theHyp1 =
- (const StdMeshers_QuadrangleParams*)theHyp;
+ (const StdMeshers_QuadrangleParams*)theHyp;
myTriaVertexID = theHyp1->GetTriaVertex();
theHyp = hyps.back();
if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) {
- myQuadranglePreference= true;
- myTrianglePreference= false;
+ myQuadranglePreference= true;
+ myTrianglePreference= false;
}
else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){
- myQuadranglePreference= false;
- myTrianglePreference= true;
+ myQuadranglePreference= false;
+ myTrianglePreference= true;
}
}
else {
if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) {
- myQuadranglePreference= true;
- myTrianglePreference= false;
+ myQuadranglePreference= true;
+ myTrianglePreference= false;
}
else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){
- myQuadranglePreference= false;
- myTrianglePreference= true;
+ myQuadranglePreference= false;
+ myTrianglePreference= true;
}
const StdMeshers_QuadrangleParams* theHyp2 =
- (const StdMeshers_QuadrangleParams*)hyps.back();
+ (const StdMeshers_QuadrangleParams*)hyps.back();
myTriaVertexID = theHyp2->GetTriaVertex();
}
}
d = quad->uv_grid[(j + 1) * nbhoriz + i].node;
SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
if(face) {
- meshDS->SetMeshElementOnShape(face, geomFaceID);
+ meshDS->SetMeshElementOnShape(face, geomFaceID);
}
}
}
bool StdMeshers_Quadrangle_2D::Evaluate(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
- MapShapeNbElems& aResMap)
+ MapShapeNbElems& aResMap)
{
aMesh.GetSubMesh(aShape);
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID));
if(!V.IsNull()) {
- TopoDS_Edge E1,E2,E3;
- for(; edgeIt != edges.end(); ++edgeIt) {
- TopoDS_Edge E = TopoDS::Edge(*edgeIt);
- TopoDS_Vertex VF, VL;
- TopExp::Vertices(E, VF, VL, true);
- if( VF.IsSame(V) )
- E1 = E;
- else if( VL.IsSame(V) )
- E3 = E;
- else
- E2 = E;
- }
- quad->side.reserve(4);
- quad->side.push_back( new StdMeshers_FaceSide(F, E1, &aMesh, true, ignoreMediumNodes));
- quad->side.push_back( new StdMeshers_FaceSide(F, E2, &aMesh, true, ignoreMediumNodes));
- quad->side.push_back( new StdMeshers_FaceSide(F, E3, &aMesh, false, ignoreMediumNodes));
- std::vector<UVPtStruct> UVPSleft = quad->side[0]->GetUVPtStruct(true,0);
- std::vector<UVPtStruct> UVPStop = quad->side[1]->GetUVPtStruct(false,1);
- std::vector<UVPtStruct> UVPSright = quad->side[2]->GetUVPtStruct(true,1);
- const SMDS_MeshNode* aNode = UVPSleft[0].node;
- gp_Pnt2d aPnt2d( UVPSleft[0].u, UVPSleft[0].v );
- StdMeshers_FaceSide* VertFS =
- new StdMeshers_FaceSide(aNode, aPnt2d, quad->side[1]);
- quad->side.push_back(VertFS);
- return quad;
+ TopoDS_Edge E1,E2,E3;
+ for(; edgeIt != edges.end(); ++edgeIt) {
+ TopoDS_Edge E = TopoDS::Edge(*edgeIt);
+ TopoDS_Vertex VF, VL;
+ TopExp::Vertices(E, VF, VL, true);
+ if( VF.IsSame(V) )
+ E1 = E;
+ else if( VL.IsSame(V) )
+ E3 = E;
+ else
+ E2 = E;
+ }
+ quad->side.reserve(4);
+ quad->side.push_back( new StdMeshers_FaceSide(F, E1, &aMesh, true, ignoreMediumNodes));
+ quad->side.push_back( new StdMeshers_FaceSide(F, E2, &aMesh, true, ignoreMediumNodes));
+ quad->side.push_back( new StdMeshers_FaceSide(F, E3, &aMesh, false, ignoreMediumNodes));
+ std::vector<UVPtStruct> UVPSleft = quad->side[0]->GetUVPtStruct(true,0);
+ std::vector<UVPtStruct> UVPStop = quad->side[1]->GetUVPtStruct(false,1);
+ std::vector<UVPtStruct> UVPSright = quad->side[2]->GetUVPtStruct(true,1);
+ const SMDS_MeshNode* aNode = UVPSleft[0].node;
+ gp_Pnt2d aPnt2d( UVPSleft[0].u, UVPSleft[0].v );
+ StdMeshers_FaceSide* VertFS =
+ new StdMeshers_FaceSide(aNode, aPnt2d, quad->side[1]);
+ quad->side.push_back(VertFS);
+ return quad;
}
}
return 0;
//=============================================================================
bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
- const TopoDS_Shape & aShape,
- MapShapeNbElems& aResMap,
- std::vector<int>& aNbNodes,
- bool& IsQuadratic)
+ const TopoDS_Shape & aShape,
+ MapShapeNbElems& aResMap,
+ std::vector<int>& aNbNodes,
+ bool& IsQuadratic)
{
const TopoDS_Face & F = TopoDS::Face(aShape);
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID));
if(!V.IsNull()) {
- TopoDS_Edge E1,E2,E3;
- for(; edgeIt != edges.end(); ++edgeIt) {
- TopoDS_Edge E = TopoDS::Edge(*edgeIt);
- TopoDS_Vertex VF, VL;
- TopExp::Vertices(E, VF, VL, true);
- if( VF.IsSame(V) )
- E1 = E;
- else if( VL.IsSame(V) )
- E3 = E;
- else
- E2 = E;
- }
- SMESH_subMesh * sm = aMesh.GetSubMesh(E1);
- MapShapeNbElemsItr anIt = aResMap.find(sm);
- if(anIt==aResMap.end()) return false;
- std::vector<int> aVec = (*anIt).second;
- if(IsQuadratic)
- aNbNodes[0] = (aVec[SMDSEntity_Node]-1)/2 + 2;
- else
- aNbNodes[0] = aVec[SMDSEntity_Node] + 2;
- sm = aMesh.GetSubMesh(E2);
- anIt = aResMap.find(sm);
- if(anIt==aResMap.end()) return false;
- aVec = (*anIt).second;
- if(IsQuadratic)
- aNbNodes[1] = (aVec[SMDSEntity_Node]-1)/2 + 2;
- else
- aNbNodes[1] = aVec[SMDSEntity_Node] + 2;
- sm = aMesh.GetSubMesh(E3);
- anIt = aResMap.find(sm);
- if(anIt==aResMap.end()) return false;
- aVec = (*anIt).second;
- if(IsQuadratic)
- aNbNodes[2] = (aVec[SMDSEntity_Node]-1)/2 + 2;
- else
- aNbNodes[2] = aVec[SMDSEntity_Node] + 2;
- aNbNodes[3] = aNbNodes[1];
- aNbNodes.resize(5);
- nbSides = 4;
+ TopoDS_Edge E1,E2,E3;
+ for(; edgeIt != edges.end(); ++edgeIt) {
+ TopoDS_Edge E = TopoDS::Edge(*edgeIt);
+ TopoDS_Vertex VF, VL;
+ TopExp::Vertices(E, VF, VL, true);
+ if( VF.IsSame(V) )
+ E1 = E;
+ else if( VL.IsSame(V) )
+ E3 = E;
+ else
+ E2 = E;
+ }
+ SMESH_subMesh * sm = aMesh.GetSubMesh(E1);
+ MapShapeNbElemsItr anIt = aResMap.find(sm);
+ if(anIt==aResMap.end()) return false;
+ std::vector<int> aVec = (*anIt).second;
+ if(IsQuadratic)
+ aNbNodes[0] = (aVec[SMDSEntity_Node]-1)/2 + 2;
+ else
+ aNbNodes[0] = aVec[SMDSEntity_Node] + 2;
+ sm = aMesh.GetSubMesh(E2);
+ anIt = aResMap.find(sm);
+ if(anIt==aResMap.end()) return false;
+ aVec = (*anIt).second;
+ if(IsQuadratic)
+ aNbNodes[1] = (aVec[SMDSEntity_Node]-1)/2 + 2;
+ else
+ aNbNodes[1] = aVec[SMDSEntity_Node] + 2;
+ sm = aMesh.GetSubMesh(E3);
+ anIt = aResMap.find(sm);
+ if(anIt==aResMap.end()) return false;
+ aVec = (*anIt).second;
+ if(IsQuadratic)
+ aNbNodes[2] = (aVec[SMDSEntity_Node]-1)/2 + 2;
+ else
+ aNbNodes[2] = aVec[SMDSEntity_Node] + 2;
+ aNbNodes[3] = aNbNodes[1];
+ aNbNodes.resize(5);
+ nbSides = 4;
}
}
}
SMESH_subMesh * sm = aMesh.GetSubMesh( *edgeIt );
MapShapeNbElemsItr anIt = aResMap.find(sm);
if(anIt==aResMap.end()) {
- return false;
+ return false;
}
std::vector<int> aVec = (*anIt).second;
if(IsQuadratic)
- aNbNodes[nbSides] = (aVec[SMDSEntity_Node]-1)/2 + 2;
+ aNbNodes[nbSides] = (aVec[SMDSEntity_Node]-1)/2 + 2;
else
- aNbNodes[nbSides] = aVec[SMDSEntity_Node] + 2;
+ aNbNodes[nbSides] = aVec[SMDSEntity_Node] + 2;
nbSides++;
}
}
list<TopoDS_Edge>::iterator ite = sideEdges.begin();
aNbNodes[nbSides] = 1;
for(; ite!=sideEdges.end(); ite++) {
- SMESH_subMesh * sm = aMesh.GetSubMesh( *ite );
- MapShapeNbElemsItr anIt = aResMap.find(sm);
- if(anIt==aResMap.end()) {
- return false;
- }
- std::vector<int> aVec = (*anIt).second;
- if(IsQuadratic)
- aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1;
- else
- aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1;
+ SMESH_subMesh * sm = aMesh.GetSubMesh( *ite );
+ MapShapeNbElemsItr anIt = aResMap.find(sm);
+ if(anIt==aResMap.end()) {
+ return false;
+ }
+ std::vector<int> aVec = (*anIt).second;
+ if(IsQuadratic)
+ aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1;
+ else
+ aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1;
}
++nbSides;
}
sideEdges.splice( sideEdges.begin(), edges, --edges.end());
}
}
- list<TopoDS_Edge>::iterator ite = sideEdges.begin();
- aNbNodes[nbSides] = 1;
- for(; ite!=sideEdges.end(); ite++) {
- SMESH_subMesh * sm = aMesh.GetSubMesh( *ite );
- MapShapeNbElemsItr anIt = aResMap.find(sm);
- if(anIt==aResMap.end()) {
- return false;
- }
- std::vector<int> aVec = (*anIt).second;
- if(IsQuadratic)
- aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1;
- else
- aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1;
- }
+ list<TopoDS_Edge>::iterator ite = sideEdges.begin();
+ aNbNodes[nbSides] = 1;
+ for(; ite!=sideEdges.end(); ite++) {
+ SMESH_subMesh * sm = aMesh.GetSubMesh( *ite );
+ MapShapeNbElemsItr anIt = aResMap.find(sm);
+ if(anIt==aResMap.end()) {
+ return false;
+ }
+ std::vector<int> aVec = (*anIt).second;
+ if(IsQuadratic)
+ aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1;
+ else
+ aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1;
+ }
++nbSides;
}
}
for (int j = 0; j < nbvertic; j++) {
int ij = j * nbhoriz + i;
// --- droite i cste : x = x0 + y(x1-x0)
- double x0 = uv_e0[i].normParam; // bas - sud
- double x1 = uv_e2[i].normParam; // haut - nord
+ double x0 = uv_e0[i].normParam; // bas - sud
+ double x1 = uv_e2[i].normParam; // haut - nord
// --- droite j cste : y = y0 + x(y1-y0)
- double y0 = uv_e3[j].normParam; // gauche-ouest
- double y1 = uv_e1[j].normParam; // droite - est
+ double y0 = uv_e3[j].normParam; // gauche-ouest
+ double y1 = uv_e1[j].normParam; // droite - est
// --- intersection : x=x0+(y0+x(y1-y0))(x1-x0)
double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0));
double y = y0 + x * (y1 - y0);
int nbf=0;
for(j=1; j<nnn-1; j++) {
for(i=1; i<nb; i++) {
- nbf++;
+ nbf++;
if(WisF) {
SMDS_MeshFace* F =
myTool->AddFace(NodesBRD.Value(i,j), NodesBRD.Value(i+1,j),
// create faces
for(j=1; j<=drl+addv; j++) {
for(i=1; i<nb; i++) {
- nbf++;
+ nbf++;
if(WisF) {
SMDS_MeshFace* F =
myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
NodesLast.SetValue(nnn,1,NodesC.Value(nb,i));
}
for(i=1; i<nt; i++) {
- nbf++;
+ nbf++;
if(WisF) {
SMDS_MeshFace* F =
myTool->AddFace(NodesLast.Value(i,1), NodesLast.Value(i+1,1),
bool StdMeshers_Quadrangle_2D::EvaluateQuadPref(SMESH_Mesh & aMesh,
const TopoDS_Shape& aShape,
std::vector<int>& aNbNodes,
- MapShapeNbElems& aResMap,
- bool IsQuadratic)
+ MapShapeNbElems& aResMap,
+ bool IsQuadratic)
{
// Auxilary key in order to keep old variant
// of meshing after implementation new variant
#include <BRepAdaptor_Curve.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
-//#include <BRepTools.hxx>
#include <BRep_Tool.hxx>
-#include <TopExp_Explorer.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 <GeomAPI_ProjectPointOnSurf.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Line.hxx>
+#include <Geom_TrimmedCurve.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
-#include <GeomAPI_ProjectPointOnSurf.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
using namespace std;
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
//purpose :
//=======================================================================
-bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
+bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
{
TopExp_Explorer exp;
myHelper = new SMESH_MesherHelper( aMesh );
myHelper->IsQuadraticSubMesh( aShape );
+ // to delete helper at exit from Compute()
+ auto_ptr<SMESH_MesherHelper> helperDeleter( myHelper );
myLayerPositions.clear();
- TopoDS_Edge E1,E2,E3;
- Handle(Geom_Curve) C1,C2,C3;
- double f1,l1,f2,l2,f3,l3;
- 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)
+ TopoDS_Edge CircEdge, LinEdge1, LinEdge2;
+ int nbe = analyseFace( aShape, CircEdge, LinEdge1, LinEdge2 );
+ if( nbe>3 || nbe < 1 || CircEdge.IsNull() )
return error(COMPERR_BAD_SHAPE);
-
+
gp_Pnt P0,P1;
// points for rotation
TColgp_SequenceOfPnt Points;
TColStd_SequenceOfReal Angles;
// Nodes1 and Nodes2 - nodes along radiuses
// CNodes - nodes on circle edge
- std::vector< const SMDS_MeshNode* > Nodes1, Nodes2, CNodes;
+ vector< const SMDS_MeshNode* > Nodes1, Nodes2, CNodes;
SMDS_MeshNode * NC;
// parameters edge nodes on face
- TColgp_SequenceOfPnt2d Pnts2d1, Pnts2d2;
+ TColgp_SequenceOfPnt2d Pnts2d1;
gp_Pnt2d PC;
int faceID = meshDS->ShapeToIndex(aShape);
TopoDS_Face F = TopoDS::Face(aShape);
Handle(Geom_Surface) S = BRep_Tool::Surface(F);
- //cout<<"RadialQuadrangle_1D2D::Compute nbe = "<<nbe<<endl;
- 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;
+ if(nbe==1)
+ {
+ Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge ));
- bool ok = _gen->Compute( aMesh, CircEdge, false, MeshDim_1D );
+ bool ok = _gen->Compute( aMesh, CircEdge );
+ if( !ok ) return false;
+ map< double, const SMDS_MeshNode* > theNodes;
+ ok = GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes);
if( !ok ) return false;
- std::map< double, const SMDS_MeshNode* > theNodes;
- GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes);
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;
- itn++;
- for(; itn != theNodes.end(); itn++ ) {
- CNodes.push_back( (*itn).second );
- double ang = (*itn).first - fang;
- if( ang>PI ) ang = ang - 2*PI;
- if( ang<-PI ) ang = ang + 2*PI;
- Angles.Append( ang );
+ if ( itn != theNodes.end() ) {
+ itn++;
+ for(; itn != theNodes.end(); itn++ ) {
+ CNodes.push_back( (*itn).second );
+ double ang = (*itn).first - fang;
+ if( ang>PI ) ang = ang - 2*PI;
+ if( ang<-PI ) ang = ang + 2*PI;
+ Angles.Append( ang );
+ }
}
P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() );
P0 = aCirc->Location();
double V = PC.Y() + aVec2d.Y()*myLayerPositions[i];
meshDS->SetNodeOnFace( node, faceID, U, V );
Pnts2d1.Append(gp_Pnt2d(U,V));
- Pnts2d2.Append(gp_Pnt2d(U,V));
}
Nodes1[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
// a segment of line
- Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1);
- while( !tc.IsNull() ) {
- 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);
- }
+ double fp, lp;
+ Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge, &fp, &lp ));
if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) {
// not half of circle
return error(COMPERR_BAD_SHAPE);
}
+ Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 ));
if( aLine.IsNull() ) {
// other curve not line
return error(COMPERR_BAD_SHAPE);
}
- SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1);
- if( sm1 ) {
- SMESHDS_SubMesh* sdssm1 = sm1->GetSubMeshDS();
- if( sdssm1 ) {
- if( sm1->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 linEdgeComputed = false;
+ if( SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1) ) {
+ if( !sm1->IsEmpty() )
+ if( isEdgeCompitaballyMeshed( LinEdge1, aMesh.GetSubMesh(F) ))
+ linEdgeComputed = true;
+ else
+ return error("Invalid set of hypotheses");
}
- bool ok = _gen->Compute( aMesh, CircEdge, false, MeshDim_1D );
+ bool ok = _gen->Compute( aMesh, CircEdge );
if( !ok ) return false;
- std::map< double, const SMDS_MeshNode* > theNodes;
+ map< double, const SMDS_MeshNode* > theNodes;
GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes);
CNodes.clear();
- std::map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin();
- const SMDS_MeshNode* NF = (*itn).second;
- CNodes.push_back( (*itn).second );
+ map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin();
double fang = (*itn).first;
itn++;
- const SMDS_MeshNode* NL;
- int nbn = 1;
for(; itn != theNodes.end(); itn++ ) {
- nbn++;
- if( nbn == theNodes.size() )
- NL = (*itn).second;
CNodes.push_back( (*itn).second );
double ang = (*itn).first - fang;
if( ang>PI ) ang = ang - 2*PI;
if( ang<-PI ) ang = ang + 2*PI;
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() );
gp_Pnt P2( NL->X(), NL->Y(), NL->Z() );
P0 = aCirc->Location();
myLayerPositions.clear();
computeLayerPositions(P0,P1);
- gp_Vec aVec(P0,P1);
- int edgeID = meshDS->ShapeToIndex(LinEdge1);
- // check orientation
- Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp);
- gp_Pnt Ptmp;
- Crv->D0(fp,Ptmp);
- bool ori = true;
- if( P1.Distance(Ptmp) > Precision::Confusion() )
- ori = false;
- // get UV points for edge
- gp_Pnt2d PF,PL;
- BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL );
- PC = gp_Pnt2d( (PF.X()+PL.X())/2, (PF.Y()+PL.Y())/2 );
- gp_Vec2d V2d;
- if(ori) V2d = gp_Vec2d(PC,PF);
- else V2d = gp_Vec2d(PC,PL);
- // add nodes on edge
- double cp = (fp+lp)/2;
- double dp2 = (lp-fp)/2;
- NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z());
- meshDS->SetNodeOnEdge(NC, edgeID, cp);
- Nodes1.resize( myLayerPositions.size()+1 );
- Nodes2.resize( myLayerPositions.size()+1 );
- int i = 0;
- for(; i<myLayerPositions.size(); i++) {
- gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
- P0.Y() + aVec.Y()*myLayerPositions[i],
- P0.Z() + aVec.Z()*myLayerPositions[i] );
- Points.Append(P);
- SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
- Nodes1[i] = node;
- double param;
- if(ori)
- param = fp + dp2*(1-myLayerPositions[i]);
- else
- param = cp + dp2*myLayerPositions[i];
- meshDS->SetNodeOnEdge(node, edgeID, param);
- P = gp_Pnt( P0.X() - aVec.X()*myLayerPositions[i],
- P0.Y() - aVec.Y()*myLayerPositions[i],
- P0.Z() - aVec.Z()*myLayerPositions[i] );
- node = meshDS->AddNode(P.X(), P.Y(), P.Z());
- Nodes2[i] = node;
- if(!ori)
- param = fp + dp2*(1-myLayerPositions[i]);
- else
- param = cp + dp2*myLayerPositions[i];
- meshDS->SetNodeOnEdge(node, edgeID, param);
- // parameters on face
- gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i],
- PC.Y() + V2d.Y()*myLayerPositions[i] );
- Pnts2d1.Append(P2d);
- P2d = gp_Pnt2d( PC.X() - V2d.X()*myLayerPositions[i],
- PC.Y() - V2d.Y()*myLayerPositions[i] );
- Pnts2d2.Append(P2d);
+ 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() );
}
- Nodes1[ myLayerPositions.size() ] = NF;
- Nodes2[ myLayerPositions.size() ] = NL;
- // create 1D elements on edge
- std::vector< const SMDS_MeshNode* > tmpNodes;
- tmpNodes.resize(2*Nodes1.size()+1);
- for(i=0; i<Nodes2.size(); i++)
- tmpNodes[Nodes2.size()-i-1] = Nodes2[i];
- tmpNodes[Nodes2.size()] = NC;
- for(i=0; i<Nodes1.size(); i++)
- tmpNodes[Nodes2.size()+1+i] = Nodes1[i];
- for(i=1; i<tmpNodes.size(); i++) {
- SMDS_MeshEdge* ME = myHelper->AddEdge( tmpNodes[i-1], tmpNodes[i] );
- if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
+ else
+ {
+ gp_Vec aVec(P0,P1);
+ int edgeID = meshDS->ShapeToIndex(LinEdge1);
+ // check orientation
+ Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp);
+ gp_Pnt Ptmp;
+ Crv->D0(fp,Ptmp);
+ bool ori = true;
+ if( P1.Distance(Ptmp) > Precision::Confusion() )
+ ori = false;
+ // get UV points for edge
+ gp_Pnt2d PF,PL;
+ BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL );
+ PC = gp_Pnt2d( (PF.X()+PL.X())/2, (PF.Y()+PL.Y())/2 );
+ gp_Vec2d V2d;
+ if(ori) V2d = gp_Vec2d(PC,PF);
+ else V2d = gp_Vec2d(PC,PL);
+ // add nodes on edge
+ double cp = (fp+lp)/2;
+ double dp2 = (lp-fp)/2;
+ NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z());
+ meshDS->SetNodeOnEdge(NC, edgeID, cp);
+ Nodes1.resize( myLayerPositions.size()+1 );
+ Nodes2.resize( myLayerPositions.size()+1 );
+ int i = 0;
+ for(; i<myLayerPositions.size(); i++) {
+ gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
+ P0.Y() + aVec.Y()*myLayerPositions[i],
+ P0.Z() + aVec.Z()*myLayerPositions[i] );
+ Points.Append(P);
+ SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+ Nodes1[i] = node;
+ double param;
+ if(ori)
+ param = fp + dp2*(1-myLayerPositions[i]);
+ else
+ param = cp + dp2*myLayerPositions[i];
+ meshDS->SetNodeOnEdge(node, edgeID, param);
+ P = gp_Pnt( P0.X() - aVec.X()*myLayerPositions[i],
+ P0.Y() - aVec.Y()*myLayerPositions[i],
+ P0.Z() - aVec.Z()*myLayerPositions[i] );
+ node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+ Nodes2[i] = node;
+ if(!ori)
+ param = fp + dp2*(1-myLayerPositions[i]);
+ else
+ param = cp + dp2*myLayerPositions[i];
+ meshDS->SetNodeOnEdge(node, edgeID, param);
+ // parameters on face
+ gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i],
+ PC.Y() + V2d.Y()*myLayerPositions[i] );
+ Pnts2d1.Append(P2d);
+ }
+ Nodes1[ myLayerPositions.size() ] = NF;
+ Nodes2[ myLayerPositions.size() ] = NL;
+ // create 1D elements on edge
+ vector< const SMDS_MeshNode* > tmpNodes;
+ tmpNodes.resize(2*Nodes1.size()+1);
+ for(i=0; i<Nodes2.size(); i++)
+ tmpNodes[Nodes2.size()-i-1] = Nodes2[i];
+ tmpNodes[Nodes2.size()] = NC;
+ for(i=0; i<Nodes1.size(); i++)
+ tmpNodes[Nodes2.size()+1+i] = Nodes1[i];
+ for(i=1; i<tmpNodes.size(); i++) {
+ SMDS_MeshEdge* ME = myHelper->AddEdge( tmpNodes[i-1], tmpNodes[i] );
+ 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
// segments of line
- Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1);
- while( !tc.IsNull() ) {
- 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);
- }
- 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);
- }
+ double fp, lp;
+ Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge ));
+ Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 ));
+ Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast( getCurve( LinEdge2 ));
if( aLine1.IsNull() || aLine2.IsNull() ) {
// other curve not line
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;
- std::map< double, const SMDS_MeshNode* > theNodes;
+ map< double, const SMDS_MeshNode* > theNodes;
GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes);
+ const SMDS_MeshNode* NF = theNodes.begin()->second;
+ const SMDS_MeshNode* NL = theNodes.rbegin()->second;
CNodes.clear();
- std::map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin();
- const SMDS_MeshNode* NF = (*itn).second;
- CNodes.push_back( (*itn).second );
+ CNodes.push_back( NF );
+ map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin();
double fang = (*itn).first;
itn++;
- const SMDS_MeshNode* NL;
- int nbn = 1;
for(; itn != theNodes.end(); itn++ ) {
- nbn++;
- if( nbn == theNodes.size() )
- NL = (*itn).second;
CNodes.push_back( (*itn).second );
double ang = (*itn).first - fang;
if( ang>PI ) ang = ang - 2*PI;
myLayerPositions.clear();
computeLayerPositions(P0,P1);
+ Nodes1.resize( myLayerPositions.size()+1 );
+ Nodes2.resize( myLayerPositions.size()+1 );
+
exp.Init( LinEdge1, TopAbs_VERTEX );
TopoDS_Vertex V1 = TopoDS::Vertex( exp.Current() );
exp.Next();
gp_Pnt PE1 = BRep_Tool::Pnt(V1);
gp_Pnt PE2 = BRep_Tool::Pnt(V2);
if( ( P1.Distance(PE1) > Precision::Confusion() ) &&
- ( P1.Distance(PE2) > Precision::Confusion() ) ) {
- TopoDS_Edge E = LinEdge1;
- LinEdge1 = LinEdge2;
- LinEdge2 = E;
+ ( P1.Distance(PE2) > Precision::Confusion() ) )
+ {
+ std::swap( LinEdge1, LinEdge2 );
+ std::swap( linEdge1Computed, linEdge2Computed );
}
- TopoDS_Vertex VC;
+ TopoDS_Vertex VC = V2;
if( ( P1.Distance(PE1) > Precision::Confusion() ) &&
- ( P2.Distance(PE1) > Precision::Confusion() ) ) {
+ ( P2.Distance(PE1) > Precision::Confusion() ) )
VC = V1;
- }
- else VC = V2;
int vertID = meshDS->ShapeToIndex(VC);
+
// LinEdge1
- int edgeID = meshDS->ShapeToIndex(LinEdge1);
- gp_Vec aVec(P0,P1);
- // check orientation
- Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp);
- gp_Pnt Ptmp;
- Crv->D0(fp,Ptmp);
- bool ori = false;
- if( P1.Distance(Ptmp) > Precision::Confusion() )
- ori = true;
- // get UV points for edge
- gp_Pnt2d PF,PL;
- BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL );
- gp_Vec2d V2d;
- if(ori) {
- V2d = gp_Vec2d(PF,PL);
- PC = PF;
- }
- else {
- V2d = gp_Vec2d(PL,PF);
- PC = PL;
- }
- NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z());
- meshDS->SetNodeOnVertex(NC, vertID);
- double dp = lp-fp;
- Nodes1.resize( myLayerPositions.size()+1 );
- int i = 0;
- for(; i<myLayerPositions.size(); i++) {
- gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
- P0.Y() + aVec.Y()*myLayerPositions[i],
- P0.Z() + aVec.Z()*myLayerPositions[i] );
- Points.Append(P);
- SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
- Nodes1[i] = node;
- double param;
- if(!ori)
- param = fp + dp*(1-myLayerPositions[i]);
- else
- param = fp + dp*myLayerPositions[i];
- meshDS->SetNodeOnEdge(node, edgeID, param);
- // parameters on face
- gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i],
- PC.Y() + V2d.Y()*myLayerPositions[i] );
- Pnts2d1.Append(P2d);
+ 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]));
+ }
}
- Nodes1[ myLayerPositions.size() ] = NF;
- // create 1D elements on edge
- SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes1[0] );
- if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
- for(i=1; i<Nodes1.size(); i++) {
- SMDS_MeshEdge* ME = myHelper->AddEdge( Nodes1[i-1], Nodes1[i] );
+ else
+ {
+ int edgeID = meshDS->ShapeToIndex(LinEdge1);
+ gp_Vec aVec(P0,P1);
+ // check orientation
+ Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp);
+ gp_Pnt Ptmp = Crv->Value(fp);
+ bool ori = false;
+ if( P1.Distance(Ptmp) > Precision::Confusion() )
+ ori = true;
+ // get UV points for edge
+ gp_Pnt2d PF,PL;
+ BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL );
+ gp_Vec2d V2d;
+ if(ori) {
+ V2d = gp_Vec2d(PF,PL);
+ PC = PF;
+ }
+ else {
+ V2d = gp_Vec2d(PL,PF);
+ PC = PL;
+ }
+ NC = const_cast<SMDS_MeshNode*>( VertexNode( VC, meshDS ));
+ if ( !NC )
+ {
+ NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z());
+ meshDS->SetNodeOnVertex(NC, vertID);
+ }
+ double dp = lp-fp;
+ int i = 0;
+ for(; i<myLayerPositions.size(); i++) {
+ gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
+ P0.Y() + aVec.Y()*myLayerPositions[i],
+ P0.Z() + aVec.Z()*myLayerPositions[i] );
+ Points.Append(P);
+ SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+ Nodes1[i] = node;
+ double param;
+ if(!ori)
+ param = fp + dp*(1-myLayerPositions[i]);
+ else
+ param = fp + dp*myLayerPositions[i];
+ meshDS->SetNodeOnEdge(node, edgeID, param);
+ // parameters on face
+ gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i],
+ PC.Y() + V2d.Y()*myLayerPositions[i] );
+ Pnts2d1.Append(P2d);
+ }
+ Nodes1[ myLayerPositions.size() ] = NF;
+ // create 1D elements on edge
+ SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes1[0] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
+ for(i=1; i<Nodes1.size(); i++) {
+ ME = myHelper->AddEdge( Nodes1[i-1], Nodes1[i] );
+ if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
+ }
+ if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL )
+ Nodes2 = Nodes1;
}
+ markLinEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F ));
+
// LinEdge2
- edgeID = meshDS->ShapeToIndex(LinEdge1);
- aVec = gp_Vec(P0,P2);
- // check orientation
- Crv = BRep_Tool::Curve(LinEdge2,fp,lp);
- Crv->D0(fp,Ptmp);
- ori = false;
- if( P2.Distance(Ptmp) > Precision::Confusion() )
- ori = true;
- // get UV points for edge
- BRep_Tool::UVPoints( LinEdge2, TopoDS::Face(aShape), PF, PL );
- if(ori) {
- V2d = gp_Vec2d(PF,PL);
- PC = PF;
- }
- else {
- V2d = gp_Vec2d(PL,PF);
- PC = PL;
- }
- dp = lp-fp;
- Nodes2.resize( myLayerPositions.size()+1 );
- for(i=0; i<myLayerPositions.size(); i++) {
- gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
- P0.Y() + aVec.Y()*myLayerPositions[i],
- P0.Z() + aVec.Z()*myLayerPositions[i] );
- SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
- Nodes2[i] = node;
- double param;
- if(!ori)
- param = fp + dp*(1-myLayerPositions[i]);
- else
- param = fp + dp*myLayerPositions[i];
- meshDS->SetNodeOnEdge(node, edgeID, param);
- // parameters on face
- gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i],
- PC.Y() + V2d.Y()*myLayerPositions[i] );
- Pnts2d2.Append(P2d);
+ if ( linEdge2Computed )
+ {
+ 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;
}
- Nodes2[ myLayerPositions.size() ] = NL;
- // create 1D elements on edge
- ME = myHelper->AddEdge( NC, Nodes2[0] );
- if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
- for(i=1; i<Nodes2.size(); i++) {
- SMDS_MeshEdge* ME = myHelper->AddEdge( Nodes2[i-1], Nodes2[i] );
+ else
+ {
+ int edgeID = meshDS->ShapeToIndex(LinEdge2);
+ gp_Vec aVec = gp_Vec(P0,P2);
+ // check orientation
+ Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge2,fp,lp);
+ gp_Pnt Ptmp = Crv->Value(fp);
+ bool ori = false;
+ if( P2.Distance(Ptmp) > Precision::Confusion() )
+ ori = true;
+ // get UV points for edge
+ gp_Pnt2d PF,PL;
+ BRep_Tool::UVPoints( LinEdge2, TopoDS::Face(aShape), PF, PL );
+ gp_Vec2d V2d;
+ if(ori) {
+ V2d = gp_Vec2d(PF,PL);
+ PC = PF;
+ }
+ else {
+ V2d = gp_Vec2d(PL,PF);
+ PC = PL;
+ }
+ double dp = lp-fp;
+ for(int i=0; i<myLayerPositions.size(); i++) {
+ gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
+ P0.Y() + aVec.Y()*myLayerPositions[i],
+ P0.Z() + aVec.Z()*myLayerPositions[i] );
+ SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+ Nodes2[i] = node;
+ double param;
+ if(!ori)
+ param = fp + dp*(1-myLayerPositions[i]);
+ else
+ param = fp + dp*myLayerPositions[i];
+ meshDS->SetNodeOnEdge(node, edgeID, param);
+ // parameters on face
+ gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i],
+ PC.Y() + V2d.Y()*myLayerPositions[i] );
+ }
+ Nodes2[ myLayerPositions.size() ] = NL;
+ // create 1D elements on edge
+ SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes2[0] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
+ for(int i=1; i<Nodes2.size(); i++) {
+ ME = myHelper->AddEdge( Nodes2[i-1], Nodes2[i] );
+ 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
// find axis of rotation
gp_Pnt P2 = gp_Pnt( CNodes[1]->X(), CNodes[1]->Y(), CNodes[1]->Z() );
//cout<<"Angles.Length() = "<<Angles.Length()<<" Points.Length() = "<<Points.Length()<<endl;
//cout<<"Nodes1.size() = "<<Nodes1.size()<<" Pnts2d1.Length() = "<<Pnts2d1.Length()<<endl;
for(; i<Angles.Length(); i++) {
- std::vector< const SMDS_MeshNode* > tmpNodes;
+ vector< const SMDS_MeshNode* > tmpNodes;
tmpNodes.reserve(Nodes1.size());
gp_Trsf aTrsf;
gp_Ax1 theAxis(P0,gp_Dir(Axis));
tmpNodes[Points.Length()] = CNodes[i];
// quad
for(j=0; j<Nodes1.size()-1; j++) {
- SMDS_MeshFace* MF = myHelper->AddFace( tmpNodes[j], Nodes1[j],
- Nodes1[j+1], tmpNodes[j+1] );
+ SMDS_MeshFace* MF;
+ if(IsForward)
+ MF = myHelper->AddFace( tmpNodes[j], Nodes1[j],
+ Nodes1[j+1], tmpNodes[j+1] );
+ else
+ MF = myHelper->AddFace( tmpNodes[j], tmpNodes[j+1],
+ Nodes1[j+1], Nodes1[j] );
if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
}
// tria
- SMDS_MeshFace* MF = myHelper->AddFace( NC, Nodes1[0], tmpNodes[0] );
+ SMDS_MeshFace* MF;
+ if(IsForward)
+ MF = myHelper->AddFace( NC, Nodes1[0], tmpNodes[0] );
+ else
+ MF = myHelper->AddFace( NC, tmpNodes[0], Nodes1[0] );
if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
for(j=0; j<Nodes1.size(); j++) {
Nodes1[j] = tmpNodes[j];
// create last faces
// quad
for(i=0; i<Nodes1.size()-1; i++) {
- SMDS_MeshFace* MF = myHelper->AddFace( Nodes2[i], Nodes1[i],
- Nodes1[i+1], Nodes2[i+1] );
+ SMDS_MeshFace* MF;
+ if(IsForward)
+ MF = myHelper->AddFace( Nodes2[i], Nodes1[i],
+ Nodes1[i+1], Nodes2[i+1] );
+ else
+ MF = myHelper->AddFace( Nodes2[i], Nodes2[i+1],
+ Nodes1[i+1], Nodes1[i] );
if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
}
// tria
- SMDS_MeshFace* MF = myHelper->AddFace( NC, Nodes1[0], Nodes2[0] );
+ SMDS_MeshFace* MF;
+ if(IsForward)
+ MF = myHelper->AddFace( NC, Nodes1[0], Nodes2[0] );
+ else
+ MF = myHelper->AddFace( NC, Nodes2[0], Nodes1[0] );
if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
-
- // to delete helper at exit from Compute()
- std::auto_ptr<SMESH_MesherHelper> helperDeleter( myHelper );
-
return true;
}
if(ok) {
SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge);
MapShapeNbElemsItr anIt = aResMap.find(sm);
- std::vector<int> aVec = (*anIt).second;
+ vector<int> aVec = (*anIt).second;
isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge];
if(isQuadratic) {
// main nodes
if(ok) {
SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge);
MapShapeNbElemsItr anIt = aResMap.find(sm);
- std::vector<int> aVec = (*anIt).second;
+ vector<int> aVec = (*anIt).second;
isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge];
if(isQuadratic) {
// main nodes
nb2d_tria = aVec[SMDSEntity_Node] + 1;
nb2d_quad = nb2d_tria * myLayerPositions.size();
// 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;
if(isQuadratic) {
aResVec[SMDSEntity_Node] = 4*myLayerPositions.size() + 3;
aResVec[SMDSEntity_Edge] = 2*myLayerPositions.size() + 2;
}
sm = aMesh.GetSubMesh(LinEdge1);
- aResMap.insert(std::make_pair(sm,aResVec));
+ aResMap.insert(make_pair(sm,aResVec));
}
}
else { // nbe==3
if(ok) {
SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge);
MapShapeNbElemsItr anIt = aResMap.find(sm);
- std::vector<int> aVec = (*anIt).second;
+ vector<int> aVec = (*anIt).second;
isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge];
if(isQuadratic) {
// main nodes
nb2d_tria = aVec[SMDSEntity_Node] + 1;
nb2d_quad = nb2d_tria * myLayerPositions.size();
// 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;
if(isQuadratic) {
aResVec[SMDSEntity_Node] = 2*myLayerPositions.size() + 1;
aResVec[SMDSEntity_Edge] = myLayerPositions.size() + 1;
}
sm = aMesh.GetSubMesh(LinEdge1);
- aResMap.insert(std::make_pair(sm,aResVec));
+ aResMap.insert(make_pair(sm,aResVec));
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;
SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
aResVec[SMDSEntity_Triangle] = nb2d_tria;
aResVec[SMDSEntity_Quadrangle] = nb2d_quad;
}
- aResMap.insert(std::make_pair(sm,aResVec));
+ aResMap.insert(make_pair(sm,aResVec));
return true;
}
// invalid case
- aResMap.insert(std::make_pair(sm,aResVec));
+ aResMap.insert(make_pair(sm,aResVec));
SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,
"Submesh can not be evaluated",this));
virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
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:
bool computeLayerPositions(const gp_Pnt& pIn,
#include <TopoDS_Edge.hxx>
#include <string>
+#include <limits>
using namespace std;
double an = _value[ END_LENGTH_IND ];
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 Un = theReverse ? f : l;
if ( _hypType == NONE )
return false;
- SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
+ //SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
const TopoDS_Edge & EE = TopoDS::Edge(theShape);
TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
../SMESHGUI/libSMESH.la \
../OBJECT/libSMESHObject.la \
$(GUI_LDFLAGS) -lSalomeApp \
- $(CAS_LDPATH) -lTKernel -lTKBO -lTKAdvTools \
- $(QWT_LIBS)
+ $(CAS_LDPATH) -lTKernel -lTKBO -lTKAdvTools
# resources files
nodist_salomeres_DATA= \
# include <algorithm>
#endif
+#include <Basics_Utils.hxx>
+
StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::StdMeshers_NumberOfSegments_ptr h )
: QwtPlot( p ),
myPoints( 50 ),
myIsDone( true ),
myNbSeg( 1 )
{
+ Kernel_Utils::Localizer loc;
myHypo = StdMeshers::StdMeshers_NumberOfSegments::_duplicate( h );
myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" );
myDensity = new QwtPlotCurve( QString() );
void StdMeshersGUI_DistrPreview::update()
{
+ Kernel_Utils::Localizer loc;
SMESH::double_array graph, distr;
if( isTableFunc() )
{
bool StdMeshersGUI_DistrPreview::init( const QString& str )
{
+ Kernel_Utils::Localizer loc;
bool parsed_ok = true;
try {
#ifdef NO_CAS_CATCH
//
#include "StdMeshersGUI_FixedPointsParamWdg.h"
+#include <QtxIntSpinBox.h>
+#include <QtxDoubleSpinBox.h>
+
// Qt includes
#include <QPushButton>
#include <QIntValidator>
#include <QTreeWidgetItem>
#include <QCheckBox>
#include <QLineEdit>
-#include <QDoubleSpinBox>
#include <QItemDelegate>
#include <QKeyEvent>
#define MARGIN 0
#define SAME_TEXT "-/-"
+#define TOLERANCE 1e-7
+#define EQUAL_DBL(a,b) (fabs(a-b)<TOLERANCE)
+#define LT_DBL(a,b) ((a<b)&&!EQUAL_DBL(a,b))
+#define GT_DBL(a,b) ((a>b)&&!EQUAL_DBL(a,b))
+
/*
- * function : Tree Widget Item Delegate
+ * class : Tree Widget Item Delegate
* purpose : Custom item delegate
*/
{
QWidget* w = 0;
if ( (index.column() == 1 ) ) {
- QSpinBox* sb = new QSpinBox( parent );
+ QtxIntSpinBox* sb = new QtxIntSpinBox( parent );
sb->setFrame( false );
sb->setRange( 1, 999);
w = sb;
QAbstractItemModel* model,
const QModelIndex& index ) const
{
- model->setData( index, qobject_cast<QSpinBox*>( editor )->value(), Qt::EditRole );
- model->setData( index, qobject_cast<QSpinBox*>( editor )->value(), Qt::UserRole );
+ model->setData( index, qobject_cast<QtxIntSpinBox*>( editor )->value(), Qt::EditRole );
+ model->setData( index, qobject_cast<QtxIntSpinBox*>( editor )->value(), Qt::UserRole );
}
//================================================================================
myListWidget = new QListWidget( this );
myTreeWidget = new QTreeWidget( this );
- mySpinBox = new QDoubleSpinBox( this );
+ mySpinBox = new QtxDoubleSpinBox( this );
myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this );
myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this );
mySameValues = new QCheckBox( tr("SMESH_SAME_NB_SEGMENTS"), this);
mySpinBox->setRange( 0, 1 );
mySpinBox->setSingleStep( 0.1 );
-
- connect( myAddButton, SIGNAL(clicked()), SLOT(onAdd()));
- connect( myRemoveButton, SIGNAL(clicked()), SLOT(onRemove()));
- connect( mySameValues, SIGNAL(stateChanged(int)), SLOT(onCheckBoxChanged()));
+ mySpinBox->setDecimals( 4 );
+ mySpinBox->setPrecision( 4 );
+ myListWidget->setMinimumWidth( 70 );
+
+ connect( myAddButton, SIGNAL( clicked() ), SLOT( onAdd() ) );
+ connect( myRemoveButton, SIGNAL( clicked() ), SLOT( onRemove() ) );
+ connect( mySameValues, SIGNAL( stateChanged( int ) ), SLOT( onCheckBoxChanged() ) );
+ connect( mySpinBox, SIGNAL( valueChanged( double ) ), SLOT( updateState() ) );
+ connect( myListWidget, SIGNAL( itemSelectionChanged() ), SLOT( updateState() ) );
myListWidget->installEventFilter( this );
clear();
myTreeWidget->addTopLevelItem( newTreeItem( 0, 1 ) );
mySpinBox->setValue( 0. );
onCheckBoxChanged();
+ updateState();
}
//=================================================================================
//=================================================================================
void StdMeshersGUI_FixedPointsParamWdg::addPoint( double v)
{
- if ( v > 0 && v < 1) {
+ if ( GT_DBL(v, 0.0) && LT_DBL(v, 1.0)) {
bool toInsert = true;
int idx = myTreeWidget->topLevelItemCount()-1;
for ( int i = 0 ; i < myListWidget->count(); i++ ) {
double lv = point( i );
- if ( lv == v ) { toInsert = false; break; }
- else if ( lv > v ) {
+ if ( EQUAL_DBL(lv, v) ) { toInsert = false; break; }
+ else if ( GT_DBL(lv, v) ) {
idx = i; break;
}
}
onCheckBoxChanged();
}
}
+ updateState();
}
//=================================================================================
idx > myListWidget->count()-1 ? 1 : point( idx ) ) );
}
onCheckBoxChanged();
+ updateState();
}
double StdMeshersGUI_FixedPointsParamWdg::point( int idx ) const
}
}
+//=================================================================================
+// function : updateState()
+// purpose : Update widgets state
+//=================================================================================
+void StdMeshersGUI_FixedPointsParamWdg::updateState()
+{
+ double v = mySpinBox->value();
+ myAddButton->setEnabled( GT_DBL(v, 0.0) && LT_DBL(v, 1.0) );
+ myRemoveButton->setEnabled( myListWidget->selectedItems().count() > 0 );
+}
+
//=================================================================================
// function : GetListOfPoints
// purpose : Called to get the list of Edges IDs
anArray->length( size );
for (int i = 0; i < size; i++) {
anArray[i] = point(i);
- // printf ("Point %f \n", anArray[i]);
}
return anArray;
}
clear();
for ( int i = 0; i < thePoints->length(); i++ ) {
addPoint( thePoints[ i ] );
- // printf ("Add Point %f \n", thePoints[ i ]);
}
}
anArray->length( size );
for (int i = 0; i < size; i++) {
anArray[i] = nbSegments( i );
- // printf ("Segments %d \n", anArray[i] );
}
return anArray;
}
mySameValues->setChecked(true);
for ( int i = 0; i < theSegments->length(); i++ ) {
setNbSegments( i, theSegments[i] );
- // printf ("\nadd Segment = %d\n", theSegments[i]);
}
}
#include <QStringList>
class SMESHGUI;
+class QtxDoubleSpinBox;
class QPushButton;
class QLineEdit;
class QCheckBox;
-class QDoubleSpinBox;
class QListWidget;
class QListWidgetItem;
class QTreeWidget;
void onAdd();
void onRemove();
void onCheckBoxChanged();
+ void updateState();
private:
void clear();
private:
QListWidget* myListWidget;
QTreeWidget* myTreeWidget;
- QDoubleSpinBox* mySpinBox;
+ QtxDoubleSpinBox* mySpinBox;
QPushButton* myAddButton;
QPushButton* myRemoveButton;
QCheckBox* mySameValues;
row++;
// 8) reverce edge parameters
- myReversedEdgesBox = new QGroupBox(tr( "SMESH_REVERCE_EDGES" ), fr);
+ myReversedEdgesBox = new QGroupBox(tr( "SMESH_REVERSED_EDGES" ), fr);
QHBoxLayout* edgeLay = new QHBoxLayout( myReversedEdgesBox );
myDirectionWidget = new StdMeshersGUI_SubShapeSelectorWdg();
- QString anEntry = getShapeEntry();
- if ( anEntry == "" )
- anEntry = h->GetObjectEntry();
- myDirectionWidget->SetMainShapeEntry( anEntry );
+ QString aGeomEntry = getShapeEntry();
+ QString aMainEntry = getMainShapeEntry();
+ if ( aGeomEntry == "" )
+ aGeomEntry = h->GetObjectEntry();
+ myDirectionWidget->SetGeomShapeEntry( aGeomEntry );
+ myDirectionWidget->SetMainShapeEntry( aMainEntry );
myDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
edgeLay->addWidget( myDirectionWidget );
//the function will be checked with old conversion mode, so that it may occurs
//unexpected errors for user
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
}
catch(const SALOME::SALOME_Exception& ex)
{
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
ok = ( w && w->IsOk() );
}
+ else if ( hypType() == "QuadrangleParams" )
+ {
+ StdMeshersGUI_SubShapeSelectorWdg* w =
+ widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
+ ok = ( w->GetListSize() > 0 );
+ }
return ok;
}
StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetPrecision( params[1].myValue.toDouble() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
}
else if( hypType()=="MaxLength" )
{
StdMeshers::StdMeshers_MaxLength::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetUsePreestimatedLength( widget< QCheckBox >( 1 )->isChecked() );
if ( !h->HavePreestimatedLength() && !h->_is_equivalent( initParamsHypothesis() )) {
StdMeshers::StdMeshers_MaxLength_var hInit =
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
}
else if( hypType()=="Arithmetic1D" )
{
widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
h->SetStartLength( params[0].myValue.toDouble() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetEndLength( params[1].myValue.toDouble() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
if (w) {
h->SetReversedEdges( w->GetListOfIDs() );
- const char * entry = w->GetMainShapeEntry();
- h->SetObjectEntry( entry );
+ h->SetObjectEntry( w->GetMainShapeEntry() );
}
}
else if( hypType()=="FixedPoints1D" )
widget< StdMeshersGUI_SubShapeSelectorWdg >( 1 );
if (w1) {
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetPoints( w1->GetListOfPoints() );
h->SetNbSegments( w1->GetListOfSegments() );
}
if (w2) {
h->SetReversedEdges( w2->GetListOfIDs() );
- const char * entry = w2->GetMainShapeEntry();
- h->SetObjectEntry( entry );
+ h->SetObjectEntry( w2->GetMainShapeEntry() );
}
}
else if( hypType()=="MaxElementArea" )
{
StdMeshers::StdMeshers_MaxElementArea_var h =
StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetMaxElementArea( params[0].myValue.toDouble() );
}
else if( hypType()=="MaxElementVolume" )
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() );
h->SetMaxElementVolume( params[0].myValue.toDouble() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
}
else if( hypType()=="StartEndLength" )
{
widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
h->SetStartLength( params[0].myValue.toDouble() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetEndLength( params[1].myValue.toDouble() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
if (w) {
h->SetReversedEdges( w->GetListOfIDs() );
h->SetObjectEntry( w->GetMainShapeEntry() );
{
StdMeshers::StdMeshers_Deflection1D_var h =
StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetDeflection( params[0].myValue.toDouble() );
}
else if( hypType()=="AutomaticLength" )
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() );
h->SetNumberOfLayers( params[0].myValue.toInt() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
}
else if( hypType()=="LayerDistribution" )
{
StdMeshers::StdMeshers_NumberOfLayers2D::_narrow( hypothesis() );
h->SetNumberOfLayers( params[0].myValue.toInt() );
- h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
}
else if( hypType()=="LayerDistribution2D" )
{
StdMeshersGUI_SubShapeSelectorWdg* w =
widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
if (w) {
- if( w->GetListOfIDs()->length()>0 ) {
- h->SetTriaVertex( w->GetListOfIDs()[0] );
+ if( w->GetListSize() > 0 ) {
+ h->SetTriaVertex( w->GetListOfIDs()[0] ); // getlist must be called once
+ const char * entry = w->GetMainShapeEntry();
+ h->SetObjectEntry( entry );
}
- const char * entry = w->GetMainShapeEntry();
- h->SetObjectEntry( entry );
}
}
}
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
new StdMeshersGUI_SubShapeSelectorWdg();
- QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
- if ( anEntry == "" )
- anEntry = h->GetObjectEntry();
- aDirectionWidget->SetMainShapeEntry( anEntry );
+ QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+ QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+ if ( aGeomEntry == "" )
+ aGeomEntry = h->GetObjectEntry();
+
+ aDirectionWidget->SetGeomShapeEntry( aGeomEntry );
+ aDirectionWidget->SetMainShapeEntry( aMainEntry );
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
aDirectionWidget->showPreview( true );
customWidgets()->append ( aDirectionWidget );
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
new StdMeshersGUI_SubShapeSelectorWdg();
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+ QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
if ( anEntry == "" )
anEntry = h->GetObjectEntry();
- aDirectionWidget->SetMainShapeEntry( anEntry );
+ aDirectionWidget->SetGeomShapeEntry( anEntry );
+ aDirectionWidget->SetMainShapeEntry( aMainEntry );
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
aDirectionWidget->showPreview( true );
customWidgets()->append ( aDirectionWidget );
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
new StdMeshersGUI_SubShapeSelectorWdg();
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+ QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
if ( anEntry == "" )
anEntry = h->GetObjectEntry();
- aDirectionWidget->SetMainShapeEntry( anEntry );
+ aDirectionWidget->SetGeomShapeEntry( anEntry );
+ aDirectionWidget->SetMainShapeEntry( aMainEntry );
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
- aDirectionWidget->SetMainShapeEntry( h->GetObjectEntry() );
aDirectionWidget->showPreview( true );
customWidgets()->append ( aDirectionWidget );
}
aLastVarsList.append(QString(aParameters[i].in()));
if(!aLastVarsList.isEmpty())
- h->GetLayerDistribution()->SetLastParameters(SMESHGUI::JoinObjectParameters(aLastVarsList));
+ h->GetLayerDistribution()->SetLastParameters(aLastVarsList.join(":").toLatin1().constData());
customWidgets()->append
( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
aLastVarsList.append(QString(aParameters[i].in()));
if(!aLastVarsList.isEmpty())
- h->GetLayerDistribution()->SetLastParameters(SMESHGUI::JoinObjectParameters(aLastVarsList));
+ h->GetLayerDistribution()->SetLastParameters(aLastVarsList.join(":").toLatin1().constData());
customWidgets()->append
( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
aDirectionWidget->SetMaxSize(1);
aDirectionWidget->SetSubShType(TopAbs_VERTEX);
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+ QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
if ( anEntry == "" )
anEntry = h->GetObjectEntry();
- aDirectionWidget->SetMainShapeEntry( anEntry );
+ aDirectionWidget->SetGeomShapeEntry( anEntry );
+ aDirectionWidget->SetMainShapeEntry( aMainEntry );
SMESH::long_array_var aVec = new SMESH::long_array;
int vertID = h->GetTriaVertex();
if(vertID>0) {
types.insert( "ProjectionSource3D", "PROJECTION_SOURCE_3D" );
types.insert( "NumberOfLayers", "NUMBER_OF_LAYERS" );
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( "SegmentLengthAroundVertex", "SEGMENT_LENGTH_AROUND_VERTEX" );
types.insert( "MaxLength", "MAX_LENGTH" );
// Author : Open CASCADE S.A.S. (dmv)
// SMESH includes
//
+
#include "StdMeshersGUI_SubShapeSelectorWdg.h"
// SMESH Includes
StdMeshersGUI_SubShapeSelectorWdg
::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ):
QWidget( parent ),
- myPreviewActor( 0 )
+ myPreviewActor( 0 ),
+ myMaxSize( 0 )
{
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
setLayout( edgesLayout );
setMinimumWidth( 300 );
- myMaxSize = 1000;
mySubShType = TopAbs_EDGE;
init();
void StdMeshersGUI_SubShapeSelectorWdg::init()
{
myParamValue = "";
+ myIsNotCorrected = true; // to dont call the GetCorrectedValue method twice
myListOfIDs.clear();
mySelectedIDs.clear();
return;
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 ) {
QString anID = QString(" %1").arg( mySelectedIDs.at(i) );
}
}
onListSelectionChanged();
-
myListWidget->blockSignals( false );
-
- if( myListOfIDs.size() >= myMaxSize )
- myAddButton->setEnabled( false );
+ myAddButton->setEnabled( myListOfIDs.size() < myMaxSize );
}
//=================================================================================
// function : setGeomShape
// purpose : Called to set geometry
//================================================================================
-void StdMeshersGUI_SubShapeSelectorWdg::SetMainShapeEntry( const QString& theEntry )
+void StdMeshersGUI_SubShapeSelectorWdg::SetGeomShapeEntry( const QString& theEntry )
{
if ( theEntry != "") {
myParamValue = theEntry;
myEntry = theEntry;
- myMainShape = GetTopoDSByEntry( theEntry );
+ myGeomShape = GetTopoDSByEntry( theEntry );
updateState();
+ myIsNotCorrected = true;
}
}
void StdMeshersGUI_SubShapeSelectorWdg::updateState()
{
bool state = false;
- if ( !myMainShape.IsNull() )
+ if ( !myGeomShape.IsNull() )
state = true;
myListWidget->setEnabled( state );
if (state) {
myPreviewActor = new SMESH_PreviewActorsCollection();
myPreviewActor->SetSelector( mySelector );
- //myPreviewActor->Init( myMainShape, TopAbs_EDGE, myEntry );
- myPreviewActor->Init( myMainShape, mySubShType, myEntry );
+ myPreviewActor->Init( myGeomShape, mySubShType, myEntry );
myPreviewActor->SetShown( false );
myIsShown = false;
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
SMESH::long_array_var StdMeshersGUI_SubShapeSelectorWdg::GetListOfIDs()
{
SMESH::long_array_var anArray = new SMESH::long_array;
+
+ if ( myMainEntry != "" && myIsNotCorrected )
+ myListOfIDs = GetCorrectedListOfIDs( true );
+
int size = myListOfIDs.size();
anArray->length( size );
if ( size ) {
int size = theIds->length();
for ( int i = 0; i < size; i++ )
mySelectedIDs.append( theIds[ i ] );
+
+ mySelectedIDs = GetCorrectedListOfIDs( false );
onAdd();
}
+//=================================================================================
+// function : SetMainShapeEntry
+// purpose : Called to set the Main Object Entry
+//=================================================================================
+void StdMeshersGUI_SubShapeSelectorWdg::SetMainShapeEntry( const QString& theEntry )
+{
+ myMainEntry = theEntry;
+ myMainShape = GetTopoDSByEntry( theEntry );
+ myIsNotCorrected = true;
+}
+
+//=================================================================================
+// function : GetMainShapeEntry
+// purpose : Called to get the Main Object Entry
+//=================================================================================
+const char* StdMeshersGUI_SubShapeSelectorWdg::GetMainShapeEntry()
+{
+ if ( myMainEntry == "")
+ return myEntry.toLatin1().data();
+
+ return myMainEntry.toLatin1().data();
+}
+
+//=================================================================================
+// function : GetCorrectedListOfIds
+// purpose : Called to convert the list of IDs from subshape IDs to main shape IDs
+//=================================================================================
+QList<int> StdMeshersGUI_SubShapeSelectorWdg::GetCorrectedListOfIDs( bool fromSubshapeToMainshape )
+{
+ if ( ( myMainShape.IsNull() || myGeomShape.IsNull() ) && fromSubshapeToMainshape )
+ return myListOfIDs;
+ else if ( ( myMainShape.IsNull() || myGeomShape.IsNull() ) && !fromSubshapeToMainshape )
+ return mySelectedIDs;
+
+ QList<int> aList;
+ TopTools_IndexedMapOfShape aGeomMap;
+ TopTools_IndexedMapOfShape aMainMap;
+ TopExp::MapShapes(myGeomShape, aGeomMap);
+ TopExp::MapShapes(myMainShape, aMainMap);
+
+ if ( fromSubshapeToMainshape ) { // convert indexes from subshape to mainshape
+ int size = myListOfIDs.size();
+ for (int i = 0; i < size; i++) {
+ TopoDS_Shape aSubShape = aGeomMap.FindKey( myListOfIDs.at(i) );
+ int index = aMainMap.FindIndex( aSubShape );
+ aList.append( index );
+ }
+ myIsNotCorrected = false;
+ } else { // convert indexes from main shape to subshape
+ int size = mySelectedIDs.size();
+ for (int i = 0; i < size; i++) {
+ TopoDS_Shape aSubShape = aMainMap.FindKey( mySelectedIDs.at(i) );
+ int index = aGeomMap.FindIndex( aSubShape );
+ aList.append( index );
+ }
+ }
+
+ return aList;
+}
SMESH::long_array_var GetListOfIDs();
void SetListOfIDs( SMESH::long_array_var );
+ void SetGeomShapeEntry( const QString& theEntry );
+ const char* GetGeomShapeEntry() { return myEntry.toLatin1().data();}
+
void SetMainShapeEntry( const QString& theEntry );
- const char* GetMainShapeEntry() { return myEntry.toLatin1().data();}
+ const char* GetMainShapeEntry();
+ TopoDS_Shape GetGeomShape() { return myGeomShape; }
TopoDS_Shape GetMainShape() { return myMainShape; }
+ QList<int> GetCorrectedListOfIDs( bool fromSubshapeToMainshape = true );
+
static GEOM::GEOM_Object_var GetGeomObjectByEntry( const QString& );
static TopoDS_Shape GetTopoDSByEntry( const QString& );
void showPreview ( bool );
+ int GetListSize() { return myListOfIDs.size(); }
+
void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; }
void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; }
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
SVTK_Selector* mySelector;
SMESH::SMESH_Mesh_var myMesh;
+ TopoDS_Shape myGeomShape;
TopoDS_Shape myMainShape;
QString myEntry;
+ QString myMainEntry;
vtkRenderer* myRenderer;
QListWidget* myListWidget;
QString myParamValue;
bool myIsShown;
+ bool myIsNotCorrected;
// for manage possible size of myListOfIDs
int myMaxSize;
<source>ICON_DLG_NUMBER_OF_LAYERS</source>
<translation>mesh_hypo_layer_distribution.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_NUMBER_OF_LAYERS_2D</source>
+ <translation>mesh_hypo_layer_distribution.png</translation>
+ </message>
<message>
<source>ICON_DLG_PROJECTION_SOURCE_1D</source>
<translation>mesh_hypo_source_edge.png</translation>
<source>SMESH_NUMBER_OF_LAYERS_HYPOTHESIS</source>
<translation>Radial Prism Parameter</translation>
</message>
+ <message>
+ <source>SMESH_NUMBER_OF_LAYERS_2D_HYPOTHESIS</source>
+ <translation>Radial Quadrangle Parameter</translation>
+ </message>
<message>
<source>SMESH_NUMBER_OF_LAYERS_TITLE</source>
<translation>Hypothesis Construction</translation>
</message>
+ <message>
+ <source>SMESH_NUMBER_OF_LAYERS_2D_TITLE</source>
+ <translation>Hypothesis Construction</translation>
+ </message>
<message>
<source>SMESH_PROJECTION_SOURCE_1D_HYPOTHESIS</source>
<translation>Projection Source 1D</translation>