Merge from V6_4_BR 05/12/2011

This commit is contained in:
vsr 2011-12-05 11:03:04 +00:00
parent ef8432633e
commit 493747e8ea
177 changed files with 9750 additions and 3589 deletions

View File

@ -48,6 +48,8 @@ salomeinclude_DATA = SMESH_version.h
EXTRA_DIST += \
build_configure \
clean_configure \
build_cmake \
build_cmake.bat \
LICENCE
dist-hook:

View File

@ -39,6 +39,12 @@ salomescriptdir = $(bindir)
salomepythondir = $(pythondir)/salome
salomepyexecdir = $(pyexecdir)/salome
# Root directory of the python packages of SMESH
smeshpypkgdir = $(salomepythondir)/salome/smesh
# Directory for installing SALOME plugins files
salomepluginsdir = $(prefix)/share/salome/plugins/@MODULE_NAME@
# Directory for installing idl files
salomeidldir = $(prefix)/idl/salome

View File

@ -24,7 +24,7 @@
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Created from configure.in.base
#
AC_INIT([Salome2 Project SMESH module], [6.3.1], [webmaster.salome@opencascade.com], [SalomeSMESH])
AC_INIT([Salome2 Project SMESH module], [6.4.0], [webmaster.salome@opencascade.com], [SalomeSMESH])
AC_CONFIG_AUX_DIR(adm_local/unix/config_files)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
@ -302,6 +302,22 @@ if test "${gui_ok}" = "yes"; then
CHECK_QT
echo
echo ---------------------------------------------
echo testing sip
echo ---------------------------------------------
echo
CHECK_SIP
echo
echo ---------------------------------------------
echo testing pyqt
echo ---------------------------------------------
echo
CHECK_PYQT
echo
echo ---------------------------------------------
echo Testing qwt
@ -366,6 +382,14 @@ echo ---------------------------------------------
echo
CHECK_SPHINX
echo
echo ---------------------------------------------
echo testing libxm
echo ---------------------------------------------
echo
dnl Check the libxml that will be required to use the SALOME launcher
CHECK_LIBXML
echo
echo ---------------------------------------------
echo Testing Kernel
@ -520,6 +544,25 @@ AC_OUTPUT([ \
src/SMESH_PY/Makefile \
src/Tools/Makefile \
src/Tools/MeshCut/Makefile \
src/Tools/padder/Makefile \
src/Tools/padder/meshjob/Makefile \
src/Tools/padder/meshjob/idl/Makefile \
src/Tools/padder/meshjob/impl/Makefile \
src/Tools/padder/spadderpy/Makefile \
src/Tools/padder/spadderpy/padder.cfg \
src/Tools/padder/spadderpy/gui/Makefile \
src/Tools/padder/spadderpy/plugin/Makefile \
src/Tools/padder/spadderpy/plugin/envPlugins.sh \
src/Tools/padder/resources/Makefile \
src/Tools/padder/resources/appligen/Makefile \
src/Tools/padder/resources/appligen/appligen.sh \
src/Tools/padder/resources/appligen/config_appli.xml \
src/Tools/padder/resources/padderexe/Makefile \
src/Tools/padder/resources/padderexe/envPadder.sh \
src/Tools/padder/unittests/Makefile \
src/Tools/padder/unittests/autotest.sh \
src/Tools/padder/doc/Makefile \
src/Tools/padder/doc/doxyfile \
resources/Makefile \
resources/SMESHCatalog.xml \
resources/SalomeApp.xml \

View File

@ -25,6 +25,7 @@
# source path
#
SUBDIRS = salome docutils
#SUBDIRS = salome
usr_docs:
(cd salome && $(MAKE) $(AM_MAKEFLAGS) usr_docs)

View File

@ -184,7 +184,7 @@ latex_documents = [
# The name of an image file (relative to this directory) to place at the top of
# the title page.
latex_logo = '../salome/tui/images/head.png'
latex_logo = '@srcdir@/../salome/tui/images/head.png'
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.

View File

@ -38,10 +38,10 @@ WARNINGS = YES
#---------------------------------------------------------------------------
#Input related options
#---------------------------------------------------------------------------
INPUT = @srcdir@/input
INPUT = @srcdir@/input @top_srcdir@/src/Tools/padder/doc/input
FILE_PATTERNS = *.doc
EXCLUDE =
IMAGE_PATH = @srcdir@/images
IMAGE_PATH = @srcdir@/images @top_srcdir@/src/Tools/padder/doc/images
EXAMPLE_PATH = @top_srcdir@/src/SMESH_SWIG
#---------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -23,10 +23,8 @@ shape of a mesh.</li>
<ul>
<li>Triangle meshing algorithms (Mefisto, Netgen 1D-2D and BLSUFR ) - Faces
are split into triangular elements.</li>
<li>Quadrangle meshing algorithm (Mapping) - Faces are split into
<li>Quadrangle meshing algorithm (Mapping) - quadrilateral Faces are split into
quadrangular elements.</li>
<li>Radial quadrangle 1D2D algorithm - Faces (circles or part of circles)
are split into triangular and quadrangle elements.</li>
</ul>
\image html image123.gif "Example of a triangular 2D mesh"
@ -36,10 +34,14 @@ are split into triangular and quadrangle elements.</li>
<li>For meshing of 3D entities (<b>volume objects</b>):</li>
<ul>
<li>Hexahedron meshing algorithm (i,j,k) - Volumes are split into
<li>Hexahedron meshing algorithm (i,j,k) - 6-sided Volumes are split into
hexahedral (cubic) elements.</li>
<li>Tetrahedron (Netgen and GHS3D) meshing algorithms - Volumes are split into
tetrahedral (pyramidal) elements.</li>
<li>\subpage cartesian_algo_page</li>
internal parts of Volumes are split into hexahedral elements forming a
Cartesian grid; polyhedra and other types of elements are generated
where the geometrical boundary intersects Cartesian cells.</li>
</ul>
\image html image125.gif "Example of a tetrahedral 3D mesh"

View File

@ -96,8 +96,8 @@ not sewed faces.
<li>"PreCAD" is an auxiliary CAD pre-processing module which has
two main goals:
<ul>
<li> Complete missing or inadequate CAD-description.</li>
<li>Perform topology reconstruction and specific geometry
<li> Complete missing or inadequate CAD descriptions.</li>
<li> Perform topology reconstruction and specific geometry
enhancement for mesh generation.</li>
</ul>
This module requires a specific licence.
@ -105,15 +105,15 @@ not sewed faces.
The following PreCAD options are the most significant and important ones:
<ul>
<li><b>Merge Edges</b> - allows PreCAD to optimize the geometry by merging some
edges. Default is 0.</li>
edges. This option is 0 by default.</li>
<li><b>Remove nano edges</b> - allows PreCAD to optimize the geometry by removing
the nano edges whenever possible. Default is 0.</li>
the nano edges whenever possible. This option is 0 by default.</li>
<li><b>Nano edge length</b> - gives the length below which an edge is considered as nano
for the topology processing. See also the \b remove_nano_edges option. If unset, PreCAD
default value is \f$\mathrm{diag} \times 10^{-5}\f$.</li>
<li><b>Discard input topology</b> - computes the CAD topology from scratch,
without considering the toplogical information contained in the original CAD
(Useful for iges files). Default is 0.</li>
(Useful for iges files). This option is 0 by default.</li>
</ul>
</li>
</ul>
@ -208,29 +208,34 @@ files. Default is 1.</li>
The following PreCAD options are commonly usable.
<ul>
<li>\b closed_geometry (int) - describes whether the working geometry
should be closed or not. When activated, this option helps PreCAD to treat
the most dirtiest geometries. Default is 0.</li>
should be closed or not. When activated, this option helps PreCAD to process
the dirtiest geometries. By default this option is 0.</li>
<li>\b debug (int) - If debug = 1 PreCAD will be very verbose and will output
some intermediate files in the working directory. Default is 0.</li>
<li>\b eps_nano_relative (real) - Same as \b eps_nano but given in relatively to
the diagonal of the box bounding the geometry. Default is \f$10^{-5}\f$.</li>
some intermediate files in the working directory. By default this
option is 0.</li>
<li>\b eps_nano_relative (real) - the same as \b eps_nano, but relatively to
the diagonal of the box bounding the geometry. By default this option is \f$10^{-5}\f$.</li>
<li>\b eps_sewing (real) - tolerance of the assembly. It rarely requires to be tuned.
Default is \f$\mathrm{diag} \times 5 \cdot 10^{-4}\f$.</li>
<li>\b eps_sewing_relative (real) - Same as \b eps_nano but given in relatively to
the diagonal of the box bounding the geometry. Default is \f$5 \cdot 10^{-4}\f$.</li>
By default this option is \f$\mathrm{diag} \times 5 \cdot 10^{-4}\f$.</li>
<li>\b eps_sewing_relative (real) - the same as \b eps_nano but relatively to
the diagonal of the box bounding the geometry. By default this option is \f$5 \cdot 10^{-4}\f$.</li>
<li>\b manifold_geometry (int) - describes whether the working geometry should be manifold or not.
When activated, this option helps PreCAD to treat the most dirtiest geometries. Default is 0.</li>
<li>\b create_tag_collision (int) - creates some new tags from original ones in case
of collision (entity merge or association for example). Default is 0.</li>
<li>\b periodic_tolerance (real) - defines the maximum distance error accepted between
two sets of periodic entities. Default is \f$\mathrm{diag} \times 10^{-5}\f$.</li>
<li>\b periodic_tolerance_relative (real) - Same as \b periodic_tolerance but in relative
unit. Default is \f$10^{-5}\f$.</li>
<li>\b periodic_split_tolerance (real) - This periodicity processing related option defines
When activated, this option helps PreCAD to process the dirtiest
geometries. By default this option is 0.</li>
<li>\b create_tag_collision (int) - creates new tags from original ones in case
of collision (entity merge or association for example). By default
this option is 0.</li>
<li>\b periodic_tolerance (real) - defines the maximum distance error accepted between
two sets of periodic entities. By default this option is \f$\mathrm{diag} \times 10^{-5}\f$.</li>
<li>\b periodic_tolerance_relative (real) - the same as \b
periodic_tolerance but in a relative unit. Bu default this option is \f$10^{-5}\f$.</li>
<li>\b periodic_split_tolerance (real) - This periodicity processing related option defines
the minimum distance between a CAD point and an imprinted point. It allows to indirectly
control the number of points and small edges created. Default is \f$\mathrm{diag} \times 10^{-4}\f$.</li>
<li>\b periodic_split_tolerance_relative (real - Same as \b periodic_split_tolerance but in
relative unit. Default is \f$10^{-4}\f$.</li>
control the number of created points and small edges. By default this
option is \f$\mathrm{diag} \times 10^{-4}\f$.</li>
<li>\b periodic_split_tolerance_relative (real - the same as \b
periodic_split_tolerance but in a relative unit. By default this
option is \f$10^{-4}\f$.</li>
</ul>
\n

View File

@ -0,0 +1,75 @@
/*!
\page cartesian_algo_page Body Fitting 3D meshing algorithm
Body Fitting algorithm generates hexahedrons of a Cartesian grid in
the internal part of geometry and polyhedra and other types of
elements at the intersection of Cartesian cells with the geometrical
boundary.
\image html cartesian3D_sphere.png "A shpere meshed by Body Fitting algorithm"
The meshing algorithm is as follows.
<ol>
<li> Lines of a Cartesian structured grid defined by
\ref cartesian_hyp_anchor "Body Fitting Parameters" hypothesis are
intersected with the geometry boundary, thus nodes lying on the
boundary are found. This step also allows finding out for each node of
the Cartesian grid if it is inside or outside the geometry. </li>
<li> For each cell of the grid, check how many of its nodes are outside
of the geometry boundary. Depending on a result of this check
<ul>
<li> skip a cell, if all its nodes are outside </li>
<li> skip a cell, if it is too small according to <b> Size
Threshold </b> paremeter</li>
<li> add a hexahedron in the mesh, if all nodes are inside </li>
<li> add a polyhedron or another cell type in the mesh, if some
nodes are inside and some outside. </li>
</ul>
</li>
</ol>
To apply this algorithm when you define your mesh, select <b>Body
Fitting</b> in the list of 3D algorithms and click <em> "Add
Hypothesis" </em> button and <em>"Body Fitting Parameters"</em>" menu
item. Dialog of <b>Body Fitting Parameters
hypothesis</b> will appear.
<br>
\anchor cartesian_hyp_anchor
<h2>Body Fitting Parameters hypothesis</h2>
\image html cartesian3D_hyp.png "Body Fitting Parameters hypothesis dialog"
This dialog allows to define
<ul>
<li>\b Name of the algorithm </li>
<li> Minimal size of a cell truncated by the geometry boundary. If the
size of a truncated grid cell is \b Threshold times less than a
initial cell size, then a mesh element is not created. </li>
<li> Cartesian structured grid. Each grid axis is defined
individually. <b> Definition mode </b> chooses a way of grid
definition: <ul>
<li> You can specify the \b Coordinates of grid nodes. \b Insert button
inserts a node at distance \b Step (negative or positive) from a
selected node. \b Delete button removes a selected node. Double
click on a coordinate in the list enables its edition. A grid
defined by \b Coordinates should enclose the geometry, else the
algorithm will fail. </li>
<li> You can define the \b Spacing of a grid as an algebraic formular
<em>f(t)</em> where \a t is a position along a grid axiz
normalized at [0.0,1.0]. The whole range of geometry can be
divided into sub-ranges with their own spacing formulars to apply;
\a t varies between 0.0 and 1.0 within each sub-range. \b Insert button
divides a selected range into two ones. \b Delete button adds the
selected sub-range to the previous one. Double click on a range in
the list enables edition of its right boundary. Double click on a
function in the list enables its edition.
</li> </ul>
</li>
</ul>
<br>
<b>See Also</b> a sample TUI Script of a
\ref tui_cartesian_algo "Usage of Body Fitting algorithm".
*/

View File

@ -9,15 +9,20 @@ To start, click on the \em New button.
\image html a-clipping2.png
Now you can define the parameters of your cross-section: list of
<b>meshes, sub-meshes and groups</b> the cross-section will be applied to
(<b>Select all</b> button allows to select and deselect all available
objects at once), \b Orientation (X-Y, X-Z or Y-Z); \b Distance between the
opposite extremities of the boundary box of selected objects, if it is set
to 0.5 the boundary box is split in two halves; and \b Rotation (in angle
degrees) <b>around X</b> (Y to Z) and <b>around Y</b> (X to Z).
If the <b>Show preview</b> button is on, you can see the clipping plane
in the <b>3D Viewer</b>.
Now you can define the parameters of cross-section:
<ul>
<li> List of <b>meshes, sub-meshes and groups</b> to which the cross-section will be applied.
/n <b>Select all</b> button allows to select and deselect all available
objects at once).</li>
<li> \b Orientation (X-Y, X-Z or Y-Z).</li>
<li> \b Distance between the opposite extremities of the boundary box
of selected objects, if it is set
to 0.5 the boundary box is split in two halves. </li>
<li> \b Rotation (in angle
degrees) <b>around X</b> (Y to Z) and <b>around Y</b> (X to Z).</li>
<li>If the <b>Show preview</b> button is on, you can see the clipping plane
in the <b>3D Viewer</b>.</li>
</ul>
\image html image79.jpg "The plane and the cut object"

View File

@ -9,11 +9,11 @@ parameters:
<ul>
<li><b>Elements</b></li>
<ul>
<li><b>Surface color</b> - color of surface of elements (seen in Shading mode).</li>
<li><b>Back surface color</b> - color of interior surface of elements. Use slider to select this color. This color
generated on base of the <b>Surface color</b> by changing it's brightness and saturation.</li>
<li><b>Outline color</b> - color of borders of elements.</li>
<li><b>Wireframe color</b> - color of borders of elements in wireframe mode.</li>
<li><b>Surface color</b> - surface color of elements (seen in Shading mode).</li>
<li><b>Back surface color</b> - interior surface color of elements. Use slider to select this color
generated on base of the <b>Surface color</b> by changing its brightness and saturation.</li>
<li><b>Outline color</b> - color of element borders.</li>
<li><b>Wireframe color</b> - color of element borders in wireframe mode.</li>
<li><b>0D slements</b> - color of 0D elements.</li>
<li><b>Size of 0D slements</b> - size of 0D elements.</li>
<li><b>Width</b> - width of lines (edges and borders of elements).</li>

View File

@ -2,10 +2,10 @@
\page creating_groups_page Creating groups
\n In MESH you can create groups of elements of a certain type whose
contents is defined in different ways. To create a group, in the \b
\n In MESH you can create a group of elements of a certain type. The
contents of the group can be defined in different ways. To create a group, in the \b
Mesh menu select <b>Create Group</b> item (also available in the
contextual menu of the mesh).<br>
context menu of the mesh).<br>
To create a group of any type you should define the following:
<ul>
<li><b>Mesh</b> - the mesh whose elements will form your
@ -36,18 +36,18 @@ the following ways:
<ul>
<li>By adding all entities of the chosen type existing in the
mesh. For this, turn on the <b>Select All</b> check box. In this mode
all controls, which allow selecting the entities in other ways are
all controls, which allow selecting the entities in other ways, are
disabled.</li>
<li>By applying the Filter. The <b>Set filter</b> button allows to
define the filter for selection of the elements for your group. See more
about filters on the
\ref selection_filter_library_page "Selection filter library" page.<br>
If the <b>Enable manual edition</b> check box is turned off, the defined
filter defines contents of the group. In this mode, the filter is
applied to all elements of the mesh. If none entity satisfies the
filter, the \b Apply button is disabled.<br>
If the <b>Enable manual edition</b> check box is turned off, the
filter entirely defines the group contents. In this mode, the filter is
applied to all elements of the mesh. If there are no entities
corresponding to the filter, the \b Apply button is disabled.<br>
If the <b>Enable manual edition</b> check box is turned on, the defined
filter can be used to for selection of entities composing the group.</li>
filter can be used to for selection of entities for the group.</li>
<li>By choosing entities manually with the mouse in the 3D Viewer. For
this, turn on the <b>Enable manual edition</b> check box. You can
click on an element in the 3D viewer and it will be highlighted. After
@ -56,11 +56,11 @@ the following ways:
<li>By adding entities from either a submesh or an existing
group. For this, turn on the <b>Enable manual edition</b> check
box. <b>Select from</b> set of fields allows to select a submesh or
a group of an appropriate type.</li>
a group of the appropriate type.</li>
</ul>
In the <b>manual edition</b> mode you can
<ul>
<li>click the \b Remove button to remove selected elements from the list</li>
<li>click the \b Remove button to remove the selected elements from the list</li>
<li>click the <b>Sort List</b> button to sort the list of IDs of
mesh elements.</li>
</ul>
@ -104,7 +104,7 @@ operation.
To create a group on geometry check <b>Group on geometry</b> in the \b
Group \b type field. The group on geometry contains the elements
of a certain type generated on the selected geometrical object. Group
contents is dynamically updated if the mesh is modified.<br>
contents are dynamically updated if the mesh is modified.<br>
To define a group, select in the Objet Browser or in the 3D viewer a
geometrical object from which the elements will be taken. After
confirmation of the operation a new group of mesh elements will be
@ -121,12 +121,11 @@ created.
operation.
\anchor group_on_filter <br><h2>"Group on Filter"</h2>
To create a group on filter check <b>Group on filter</b> in the <b>
Group type</b> field. The group on filter contains the elements
of a certain type satisfying the defined filter. Group contents is
of a certain type satisfying the defined filter. Group contents are
dynamically updated if the mesh is modified.<br> To define a group,
click the <b>Set filter</b> button and define criteria of the
filter in the opened dialog. After confirmation of the operation a

View File

@ -15,7 +15,7 @@ The following dialog box will appear:
\image html editgroup.png
In this dialog box you can modify the name and the color of your group
despite of it's type. You can add or remove the elements forming the
despite of its type. You can add or remove the elements forming a
<em>standalone group</em>. You can change criteria of the filter of
the <em>group on filter</em>. For more information see
\ref creating_groups_page "Creating Groups" page.
@ -35,8 +35,8 @@ Standalone</b> item.</li>
\image html image74.gif
<center><em>"Edit Group as Standalone" button</em></center>
The selected group will be converted into a standalone group and can
it's contents can be modified.
The selected group will be converted into a standalone group and
its contents can be modified.
<li>Click the \b Apply or <b>Apply and Close</b> button to confirm modification of the
group.</li>

View File

@ -122,7 +122,8 @@ for ghs3d, for example, advanced options. </li>
\anchor ghs3d_enforced_vertices
<h1>Enforced vertices</h1>
\note This feature is currently only available on meshes with no geometry attached. Such meshes can be obtained by
\note This feature is currently available only on meshes with no
geometry attached. Such meshes can be obtained by
<ul>
<li>Copying an existing mesh</li>
<li>Importing a mesh from file</li>
@ -131,7 +132,8 @@ for ghs3d, for example, advanced options. </li>
\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.
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.
An enforced vertex is defined by:
@ -142,14 +144,16 @@ An enforced vertex is defined by:
<li>or from (x,y,z) cartesian coordinates</li>
</ul>
<li>A constant physical size</li>
<li>If a group name is given, the created node will be added to the group. If the group does not exist, it is created.</li>
<li>If a group name is given, the created node will be added to the
group. If the group does not exist, it is created.</li>
</ul>
\ref ghs3d_top "Back to top"
\anchor ghs3d_enforced_meshes
<h1>Enforced Meshes</h1>
\note This feature is currently only available on meshes with no geometry attached. Such meshes can be obtained by
\note This feature is currently only available on meshes with no
geometry attached. Such meshes can be obtained by
<ul>
<li>Copying an existing mesh</li>
<li>Importing a mesh from file</li>
@ -158,8 +162,9 @@ An enforced vertex is defined by:
\image html ghs3d_enforced_meshes.png
GHS3D algorithm can be forced by other meshes, sub-meshes or groups. The constraint elements should be contained
entirely into the solid meshed.
GHS3D algorithm can be forced by other meshes, sub-meshes or
groups. The constraint elements should be contained
entirely into the solid mesh.
<ul>
<li>The constraint element types are:
<ul>
@ -167,8 +172,10 @@ entirely into the solid meshed.
<li>EDGE</li>
<li>FACE</li>
</ul></li>
<li>If a size is given, the meshe will be refined around the enforced elements given the size</li>
<li>If a group name is given, the enforced elements will be added to the group. If the group does not exist, it is created.</li>
<li>If a size is given, the mesh will be refined around the enforced
elements given the size</li>
<li>If a group name is given, the enforced elements will be added to
the group. If the group does not exist, it is created.</li>
</ul>
<br><b>See Also</b> a sample TUI Script of the \ref tui_ghs3d "creation of a Ghs3D hypothesis", including enforced vertices.

View File

@ -6,39 +6,33 @@ In Mesh module it is possible to create groups of mesh elements:
nodes, edges, faces or volumes. One group contains elements of only
one type. The following ways of creation are possible:
<ul>
<li> by selecting the elements using filters and/or
directly on the presentation in the VTK viewer, and/or by using
elements of other mesh objects - <b>Standalone group</b> tab of
\ref standalone_group "Create group" dialog.</li>
<li> by creating a group of elements generated on the chosen
geometrical object - <b>Group on geometry</b> tab of \ref
creating_groups_page "Create group" dialog and \ref
create_groups_from_geometry_page "Create Groups from Geometry"
dialog.</li>
<li> by creating a group of elements satisfying to certain critaria -
<b>Group on filter</b> tab of \ref creating_groups_page
"Create group" dialog.</li>
<li> by creating groups of nodes and elements from the chosen submesh
- by selecting the elements using filters and/or directly on the
presentation in the VTK viewer, and/or by using elements of other
mesh objects - \ref standalone_group "Standalone group"
tab of \ref creating_groups_page "Create group" dialog.
- by creating a group of elements generated on the chosen geometrical
object - \ref group_on_geom "Group on geometry" tab of
\subpage creating_groups_page "Create group" dialog and
\subpage create_groups_from_geometry_page "Create Groups from Geometry"
dialog.
- by creating a group of elements satisfying to certain criteria -
\ref group_on_filter "Group on filter" tab of
\subpage creating_groups_page "Create group" dialog.
- by creating groups of nodes and elements from the chosen submesh
(type of elements depends on dimension of submesh geometry) -
using <b>Mesh -> Construct Group</b> menu item (available in contextual
menu as well).</li>
<li> by creating groups of entities from existing groups of superior
using <b>Mesh -> Construct Group</b> menu item (available in context
menu as well).
- 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>
"Create Group of Underlying Elements" dialog.
The created groups can be later:
<ul>
<li>\subpage editing_groups_page "Edited"</li>
<li>\subpage using_operations_on_groups_page "Subjected to Boolean operations"</li>
<li>\subpage deleting_groups_page "Deleted"</li>
</ul>
- \subpage editing_groups_page "Edited"
- \subpage using_operations_on_groups_page "Subjected to Boolean operations"
- \subpage deleting_groups_page "Deleted"
An important tool, providing filters for creation of \b Standalone
groups is \ref selection_filter_library_page.
*/

View File

@ -7,7 +7,7 @@ elements of a higher dimension.
<em>To generate border elements:</em>
<ol>
<li>Select a mesh or groups in the Object Browser or in the 3D Viewer</li>
<li>Select a mesh or group in the Object Browser or in the 3D Viewer</li>
<li>From the Modification menu choose "Create boundary elements"
item, or click "Create boundary elements" button in the toolbar

View File

@ -2,9 +2,8 @@
\page max_element_length_2d_page Element Diameter 2D
\n This quality control criterion consists of calculation of length of
the edges and diagonals combining the meshing elements (triangles and quadrangles)
of your mesh.
\n This quality control criterion consists in calculation of the length of
edges and diagonals combining 2D mesh elements (triangles and quadrangles).
<em>To apply the Element Diameter 2D quality criterion to your mesh:</em>
<ol>

View File

@ -2,10 +2,9 @@
\page max_element_length_3d_page Element Diameter 3D
\n This quality control criterion consists of calculation of length of
the edges and diagonals combining the 3D meshing elements
(tetrahedrons, pyramids, pentahendrons, hexahedrons and polyhedrons)
of your mesh.
\n This quality control criterion consists in calculation of the length of
edges and diagonals combining 3D mesh elements
(tetrahedrons, pyramids, pentahendrons, hexahedrons and polyhedrons).
<em>To apply the Element Diameter 3D quality criterion to your mesh:</em>
<ol>

View File

@ -2,19 +2,19 @@
\page measurements_page Measurements
Mesh module provides possibility to perform different measurements
Mesh module provides the possibility to perform different measurements
of the selected mesh data.
All the measurement operations are available via \b Measurements
top-level menu. An access to the measurements operations is
implemented via single dialog box, where each operation is represented
All measurement operations are available via \b Measurements
top-level menu. Access to the measurements operations is
implemented via a single dialog box, where each operation is represented
as a separate tab page.
\section min_distance_anchor Minimum Distance
This operation allows measuring a distance between two objects.
This operation allows measuring the distance between two objects.
Currently only node-to-node and node-to-origin operations are
available, but this operation will be extended in future to support
available, but this operation will be extended in the future to support
other mesh objects - elements, meshes, sub-meshes and groups.
To start <b>Minimum Distance</b> operation, select <b>Minimum Distance</b>
@ -22,9 +22,9 @@ item from \b Measurements menu.
\image html min_distance.png
In the dialog box choose the first target and second target mode by
switching the corresponding radio buttons, then select the objects
between which the distance is to be calculated (or enter directly IDs
In the dialog box choose the first target and the second target mode by
switching the corresponding radio buttons, then select the objects the distance
between which is to be calculated (or input their IDs directly
in case of nodes/elements) and press \em Compute button.
The following types of targets are supported:
@ -35,7 +35,7 @@ version);
- \em Origin: origin of the global co-ordinate system.
The result will
be shown in the bottom area of the dialog box. In addition, the simple
be shown in the bottom area of the dialog box. In addition, a simple
preview will be shown in the 3D viewer.
\image html min_distance_preview.png
@ -50,17 +50,16 @@ item from \b Measurements menu.
\image html bnd_box.png
In the dialog box choose desired type of the object by switching the
corresponding radio button, select the desired object(s) and press
\em Compute button.
In the dialog box choose the required type of the object by switching the
corresponding radio button, select the object(s) and press \em Compute button.
The following types of input are available:
- \em Objects: select one or more mesh, sub-mesh, group objects;
- \em Nodes: select set of mesh nodes;
- \em Elements: select set of mesh elements.
- \em Objects: select one or several mesh, sub-mesh or group objects;
- \em Nodes: select a set of mesh nodes;
- \em Elements: select a set of mesh elements.
The result of calculation will be shown in the bottom area of the
dialog box. In addition, the simple preview will be shown in the 3D
dialog box. In addition, a simple preview will be shown in the 3D
viewer.
\image html bnd_box_preview.png

View File

@ -2,7 +2,7 @@
\page mesh_infos_page Mesh Information
The user can obtain an information about the selected mesh object
The user can obtain information about the selected mesh object
(mesh, sub-mesh or group) using <b>Mesh Information</b> dialog box.
To view the <b>Mesh Information</b>, select your mesh, sub-mesh or
@ -14,12 +14,12 @@ in the toolbar.
<center><em>"Mesh Information" button</em></center>
The <b>Mesh Information</b> dialog box provides three tab pages:
- <b>\ref advanced_mesh_infos_anchor "Base Info"</b> - to show base information about selected mesh
object
- <b>\ref mesh_element_info_anchor "Element Info"</b> - to show detail information about selected mesh
node or element.
- <b>\ref advanced_mesh_infos_anchor "Base Info"</b> - to show base
information about the selected mesh object
- <b>\ref mesh_element_info_anchor "Element Info"</b> - to show
detailed information about the selected mesh node or element.
- <b>\ref mesh_addition_info_anchor "Additional Info"</b> - to show additional information available
for selected mesh, sub-mesh or group object.
for the selected mesh, sub-mesh or group object.
\anchor advanced_mesh_infos_anchor
<h2>Base Information</h2>
@ -56,7 +56,7 @@ The <b>Additional Info</b> tab page of the dialog box provides an
additional information on the selected object: mesh, sub-mesh or
group.
For mesh object, the following information is shown:
For a mesh object, the following information is shown:
- Name
- Type: based on geomerty, imported, standalone
- Shape (if mesh is based on geometry)
@ -68,7 +68,7 @@ For mesh object, the following information is shown:
<center><em>"Additional Info" page, mesh information</em></center>
<br>
For sub-mesh object, the following information is shown:
For a sub-mesh object, the following information is shown:
- Name
- Parent mesh
- Shape
@ -77,7 +77,7 @@ For sub-mesh object, the following information is shown:
<center><em>"Additional Info" page, sub-mesh information</em></center>
<br>
For group object, the following information is shown:
For a group object, the following information is shown:
- Name
- Parent mesh
- Type: standalone, group on geometry, group on filter
@ -90,12 +90,12 @@ For group object, the following information is shown:
<center><em>"Additional Info" page, group information</em></center>
<br>
\note For the performance reasons, number of underlying nodes is
\note For the performance reasons, the number of underlying nodes is
computed only by demand. For this, the user should press the "Compute"
button (see picture). Also, number of underlying nodes is
button (see picture). Also, the number of underlying nodes is
automatically calculated if the size of the group does not exceed
limit set via the preferences - "Mesh information" group,
"Automatic nodes compute limit" item (zero value means no limit).
the "Automatic nodes compute limit" set via the "Mesh information"
preferences (zero value means no limit).
In case you get <b>Mesh Information</b> via a TUI script, the information is
displayed in the Python Console.

View File

@ -2,9 +2,11 @@
\page over_constrained_faces_page Over-constrained faces
\n This mesh quality control highlights faces sharing only one of its borders with other faces. In other words the faces having all there nodes on the external border of the mesh are highlighted.
\n This mesh quality control highlights faces sharing only one border
with other faces. In other words, the faces having all thier nodes on
the external border of the mesh are highlighted.
\note The highlighted faces are actually over constrained only if, at the computation time,
\note The highlighted faces are actually over-constrained only if, at the computation time,
the boundary conditions on the borders where the nodes are located are all Dirichlet boundary conditions.
\image html over_constrained_faces.png

View File

@ -2,10 +2,10 @@
\page over_constrained_volumes_page Over-constrained volumes
\n This mesh quality control highlights volumes sharing only one of its borders with other volumes.
In other words the volumes having all there nodes on the external border of the mesh are highlighted.
\n This mesh quality control highlights volumes sharing only one border with other volumes.
In other words, the volumes having all their nodes on the external border of the mesh are highlighted.
\note The highlighted volumes are actually over constrained only if, at the computation time,
\note The highlighted volumes are actually over-constrained only if, at the computation time,
the boundary conditions on the borders where the nodes are located are all Dirichlet boundary conditions.
\image html over_constrained_volumes.png

View File

@ -26,7 +26,7 @@ the created \b Edge.
<br>
For a group of edges, <b>Source</b> and <b>Target</b> vertices should be
shared by one edge of the group. If <b>Source</b> and <b>Target</b>
vertices are specified, the elements of the group must be ajacent.
vertices are specified, the elements of the group must be adjacent.
The source and target groups must contain equal number of edges
and they must form topologically equal structures.
@ -56,13 +56,12 @@ For groups of face, they must contain equal number of faces
and they must form topologically equal structures.
\n <b>Projection 1D-2D</b> algorithm differs from <b>Projection 2D</b>
algorithm in one point, namely it generates mesh segments on edges of
algorithm in one aspect: it generates mesh segments on edges of
the face according to the projected 2D elements; thus it does not
require that edges to be meshed by any other 1D algorithm; moreover it
require the edges to be meshed by any other 1D algorithm; moreover it
does not allow to mesh edges of the face using another algorithm via
definition of sub-meshes.
\n <b>Projection 3D</b> algorithm allows to define the mesh of a shape by
the projection of another already meshed shape. This algorithm works
only if all faces and edges of the target shape have been meshed as 1D-2D

View File

@ -180,7 +180,7 @@ normal to the neighboring face and the normal to the selected face is less then
angular tolerance (defined in degrees). Selection continues among all neighbor faces of already
selected ones.<br>
</li><li>
<b>Element Diameter 2D</b> selects triangles and quadrangles combining of the edges and
<b>Element Diameter 2D</b> selects triangles and quadrangles composed of the edges and
diagonals with a value of length, which is more, less or equal
(within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>. See also a
\ref max_element_length_2d_page "Element Diameter 2D quality control".
@ -197,7 +197,7 @@ Additional criteria to select mesh <b>Volumes</b> are the following:
\ref volume_page "Volume quality control"), which is more, less or equal (within a given
<b>Tolerance</b>) to the predefined <b>Threshold Value</b>.
</li><li>
<b>Element Diameter 3D</b> selects 3D mesh elements combining of the edges and
<b>Element Diameter 3D</b> selects 3D mesh elements composed of the edges and
diagonals with a value of length, which is more, less or equal
(within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>. See also a
\ref max_element_length_3d_page "Element Diameter 3D quality control".

View File

@ -130,6 +130,7 @@ Examples of Python scripts for all Mesh operations are available by
the following links:
- \subpage tui_creating_meshes_page
- \subpage tui_cartesian_algo
- \subpage tui_viewing_meshes_page
- \subpage tui_defining_hypotheses_page
- \subpage tui_quality_controls_page

View File

@ -0,0 +1,49 @@
/*!
\page tui_cartesian_algo Usage of Body Fitting algorithm
\code
from smesh import *
SetCurrentStudy(salome.myStudy)
# create a sphere
sphere = geompy.MakeSphereR( 50 )
geompy.addToStudy( sphere, "sphere" )
# create a mesh and assign a "Body Fitting" algo
mesh = Mesh( sphere )
cartAlgo = mesh.BodyFitted()
# define a cartesian grid using Coordinates
coords = range(-100,100,10)
cartHyp = cartAlgo.SetGrid( coords,coords,coords, 1000000)
# compute the mesh
mesh.Compute()
print "nb hexahedra",mesh.NbHexas()
print "nb tetrahedra",mesh.NbTetras()
print "nb polyhedra",mesh.NbPolyhedrons()
print
# define the grid by sitting constant spacing
cartHyp = cartAlgo.SetGrid( "10","10","10", 1000000)
mesh.Compute()
print "nb hexahedra",mesh.NbHexas()
print "nb tetrahedra",mesh.NbTetras()
print "nb polyhedra",mesh.NbPolyhedrons()
# define the grid by sitting different spacing in 2 sub-ranges of geometry
spaceFuns = ["5","10+10*t"]
cartAlgo.SetGrid( [spaceFuns, [0.5]], [spaceFuns, [0.5]], [spaceFuns, [0.25]], 2 )
mesh.Compute()
print "nb hexahedra",mesh.NbHexas()
print "nb tetrahedra",mesh.NbTetras()
print "nb polyhedra",mesh.NbPolyhedrons()
print
\endcode
*/

View File

@ -3,9 +3,9 @@
\page import_algos_page Use Existing Elements Algorithms
\n <em>Use Existing Elements </em>algorithms allow to define the mesh of a geometrical
object by the importing suitably located mesh elements from another
mesh. The mesh elements to import from the other mesh are to be contained in
groups. If several groups are used to mesh one geometry, validity of
object by importing suitably located mesh elements from another
mesh. The mesh elements to import from the other mesh should be contained in
groups. If several groups are used to mesh the same geometry, validity of
nodal connectivity of result mesh must be assured by connectivity of
the source mesh; no geometrical checks are performed to merge
different nodes at same locations.
@ -32,9 +32,9 @@ In this dialog box you can define
<ul>
<li>The \b Name of the algorithm. </li>
<li>The <b>Groups of Edges</b> to import 1D elements from.
<li>The <b>To copy mesh</b> checkbox is to import not only the edges of
the selected <b>Groups of Edges</b> but to copy the whole source
mesh. In this case <b>To copy groups</b>, if checked, forces creating
<li><b>To copy mesh</b> checkbox allows to import not only the edges of
the selected <b>Groups of Edges</b>, but the whole source
mesh. In this case <b>To copy groups</b> checkbox allows to create
the same groups as in the imported source mesh.</li>
</ul>
@ -52,10 +52,10 @@ The following dialog box will appear:
In this dialog box you can define
<ul>
<li>The \b Name of the algorithm. </li>
<li>The <b>Groups of Faces</b> to import 2D elements from.
<li>The <b>To copy mesh</b> checkbox is to import not only the faces of
the selected <b>Groups of Faces</b> but to copy the whole source
mesh. In this case <b>To copy groups</b>, if checked, forces creating
<li>The <b>Groups of Edges</b> to import 1D elements from.
<li><b>To copy mesh</b> checkbox allows to import not only the edges of
the selected <b>Groups of Edges</b>, but the whole source
mesh. In this case <b>To copy groups</b> checkbox allows to create
the same groups as in the imported source mesh.</li>
</ul>

View File

@ -23,7 +23,7 @@
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
EXTRA_DIST += images static/doxygen.css static/footer.html
EXTRA_DIST += input images static/doxygen.css static/footer.html
tuidocdir = $(docdir)/tui/SMESH
tuidoc_DATA = images/head.png images/smeshscreen.png

View File

@ -1,13 +0,0 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
<title>Main Page</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head>
<body>
&nbsp;
</body>
</html>

View File

@ -1031,7 +1031,8 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise
*/
boolean DoubleNodesOnGroupBoundaries( in ListOfGroups theDomains,
in boolean createJointElems );
in boolean createJointElems )
raises (SALOME::SALOME_Exception);
/*!
* \brief Double nodes on some external faces and create flat elements.

View File

@ -51,3 +51,6 @@ libMEFISTO2D_la_LDFLAGS = \
#libMEFISTO2D_la_LDFLAGS += -lg2c
#endif
OBSOLETE_FILES = areteideale.f
EXTRA_DIST += $(OBSOLETE_FILES)

View File

@ -35,7 +35,9 @@ salomeinclude_HEADERS = \
SMESH_PreviewActorsCollection.h \
SMESH_ExtractGeometry.h \
SMESH_FaceOrientationFilter.h \
SMESH_ScalarBarActor.h
SMESH_ScalarBarActor.h \
SMESH_NodeLabelActor.h \
SMESH_CellLabelActor.h
# Libraries targets
@ -48,7 +50,9 @@ dist_libSMESHObject_la_SOURCES = \
SMESH_ExtractGeometry.cxx \
SMESH_ActorUtils.cxx \
SMESH_FaceOrientationFilter.cxx \
SMESH_ScalarBarActor.cxx
SMESH_ScalarBarActor.cxx \
SMESH_NodeLabelActor.cxx \
SMESH_CellLabelActor.cxx
libSMESHObject_la_CPPFLAGS = \
$(QT_INCLUDES) \

View File

@ -28,11 +28,12 @@
#include "SMESH_ActorDef.h"
#include "SMESH_ActorUtils.h"
#include "SMESH_DeviceActor.h"
#include "SMESH_NodeLabelActor.h"
#include "SMESH_CellLabelActor.h"
#include "SMESH_ObjectDef.h"
#include "SMESH_ControlsDef.hxx"
#include "SMDS_UnstructuredGrid.hxx"
#include "SMESH_ScalarBarActor.h"
#include "VTKViewer_CellCenters.h"
#include "VTKViewer_ExtractUnstructuredGrid.h"
#include "VTKViewer_FramedTextActor.h"
#include "SALOME_InteractiveObject.hxx"
@ -67,10 +68,7 @@
#include <vtkActor2D.h>
#include <vtkProperty2D.h>
#include <vtkPolyData.h>
#include <vtkMaskPoints.h>
#include <vtkTextProperty.h>
#include <vtkLabeledDataMapper.h>
#include <vtkSelectVisiblePoints.h>
#include <vtkLookupTable.h>
@ -122,6 +120,7 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
SMESH_ActorDef::SMESH_ActorDef()
{
if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
myBaseActor = SMESH_DeviceActor::New();
myTimeStamp = vtkTimeStamp::New();
@ -158,7 +157,8 @@ SMESH_ActorDef::SMESH_ActorDef()
bfc = Qtx::mainColorToSecondary(ffc, delta);
myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
my2DActor = SMESH_DeviceActor::New();
my2DActor = SMESH_CellLabelActor::New();
my2DActor->SetStoreGemetryMapping(true);
my2DActor->SetUserMatrix(aMatrix);
my2DActor->PickableOff();
my2DActor->SetProperty(mySurfaceProp);
@ -193,7 +193,8 @@ SMESH_ActorDef::SMESH_ActorDef()
aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
my3DActor = SMESH_DeviceActor::New();
my3DActor = SMESH_CellLabelActor::New();
my3DActor->SetStoreGemetryMapping(true);
my3DActor->SetUserMatrix(aMatrix);
my3DActor->PickableOff();
my3DActor->SetProperty(mySurfaceProp);
@ -246,7 +247,8 @@ SMESH_ActorDef::SMESH_ActorDef()
myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myEdgeProp->SetLineWidth(aLineWidth);
my1DActor = SMESH_DeviceActor::New();
my1DActor = SMESH_CellLabelActor::New();
my1DActor->SetStoreGemetryMapping(true);
my1DActor->SetUserMatrix(aMatrix);
my1DActor->PickableOff();
my1DActor->SetHighlited(true);
@ -291,9 +293,9 @@ SMESH_ActorDef::SMESH_ActorDef()
my0DProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
my0DProp->SetPointSize(aElem0DSize);
my0DActor = SMESH_DeviceActor::New();
my0DActor = SMESH_CellLabelActor::New();
my0DActor->SetUserMatrix(aMatrix);
my0DActor->SetStoreClippingMapping(true);
my0DActor->SetStoreGemetryMapping(true);
my0DActor->PickableOff();
my0DActor->SetVisibility(false);
my0DActor->SetProperty(my0DProp);
@ -331,7 +333,7 @@ SMESH_ActorDef::SMESH_ActorDef()
SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) );
myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myNodeActor = SMESH_DeviceActor::New();
myNodeActor = SMESH_NodeLabelActor::New();
myNodeActor->SetUserMatrix(aMatrix);
myNodeActor->SetStoreClippingMapping(true);
myNodeActor->PickableOff();
@ -363,11 +365,9 @@ SMESH_ActorDef::SMESH_ActorDef()
//Definition of Pickable and Highlitable engines
//----------------------------------------------
myBaseActor = SMESH_DeviceActor::New();
myBaseActor->SetUserMatrix(aMatrix);
myBaseActor->SetStoreGemetryMapping(true);
myBaseActor->GetProperty()->SetOpacity(0.0);
myPickableActor = myBaseActor;
myHighlightProp = vtkProperty::New();
@ -430,92 +430,12 @@ SMESH_ActorDef::SMESH_ActorDef()
if( !mgr )
return;
//Definition of points numbering pipeline
//---------------------------------------
myPointsNumDataSet = vtkUnstructuredGrid::New();
myPtsMaskPoints = vtkMaskPoints::New();
myPtsMaskPoints->SetInput(myPointsNumDataSet);
myPtsMaskPoints->SetOnRatio(1);
myPtsSelectVisiblePoints = vtkSelectVisiblePoints::New();
myPtsSelectVisiblePoints->SetInput(myPtsMaskPoints->GetOutput());
myPtsSelectVisiblePoints->SelectInvisibleOff();
myPtsSelectVisiblePoints->SetTolerance(0.1);
myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
#if (VTK_XVERSION < 0x050200)
myPtsLabeledDataMapper->SetLabelFormat("%g");
#endif
myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
aPtsTextProp->SetFontFamilyToTimes();
static int aPointsFontSize = 10;
aPtsTextProp->SetFontSize(aPointsFontSize);
aPtsTextProp->SetBold(1);
aPtsTextProp->SetItalic(0);
aPtsTextProp->SetShadow(0);
myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
aPtsTextProp->Delete();
myEntityMode = eAllEntity;
myIsPointsLabeled = false;
myPointLabels = vtkActor2D::New();
myPointLabels->SetMapper(myPtsLabeledDataMapper);
myPointLabels->GetProperty()->SetColor(1,1,1);
myPointLabels->SetVisibility(myIsPointsLabeled);
//Definition of cells numbering pipeline
//---------------------------------------
myCellsNumDataSet = vtkUnstructuredGrid::New();
myCellCenters = VTKViewer_CellCenters::New();
myCellCenters->SetInput(myCellsNumDataSet);
myClsMaskPoints = vtkMaskPoints::New();
myClsMaskPoints->SetInput(myCellCenters->GetOutput());
myClsMaskPoints->SetOnRatio(1);
myClsSelectVisiblePoints = vtkSelectVisiblePoints::New();
myClsSelectVisiblePoints->SetInput(myClsMaskPoints->GetOutput());
myClsSelectVisiblePoints->SelectInvisibleOff();
myClsSelectVisiblePoints->SetTolerance(0.1);
myClsLabeledDataMapper = vtkLabeledDataMapper::New();
myClsLabeledDataMapper->SetInput(myClsSelectVisiblePoints->GetOutput());
#if (VTK_XVERSION < 0x050200)
myClsLabeledDataMapper->SetLabelFormat("%g");
#endif
myClsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aClsTextProp = vtkTextProperty::New();
aClsTextProp->SetFontFamilyToTimes();
static int aCellsFontSize = 12;
aClsTextProp->SetFontSize(aCellsFontSize);
aClsTextProp->SetBold(1);
aClsTextProp->SetItalic(0);
aClsTextProp->SetShadow(0);
myClsLabeledDataMapper->SetLabelTextProperty(aClsTextProp);
aClsTextProp->Delete();
myIsCellsLabeled = false;
myCellsLabels = vtkActor2D::New();
myCellsLabels->SetMapper(myClsLabeledDataMapper);
myCellsLabels->GetProperty()->SetColor(0,1,0);
myCellsLabels->SetVisibility(myIsCellsLabeled);
// Clipping planes
myImplicitBoolean = vtkImplicitBoolean::New();
myImplicitBoolean->SetOperationTypeToIntersection();
//Quadratic 2D elements representation
//-----------------------------------------------------------------------------
int aQuadratic2DMode = mgr->integerValue( "SMESH", "quadratic_mode", 0);
@ -597,49 +517,8 @@ SMESH_ActorDef::~SMESH_ActorDef()
myBaseActor->Delete();
myNodeExtActor->Delete();
myHighlitableActor->Delete();
//Deleting of points numbering pipeline
//---------------------------------------
myPointsNumDataSet->Delete();
// commented: porting to vtk 5.0
// myPtsLabeledDataMapper->RemoveAllInputs();
myPtsLabeledDataMapper->Delete();
// commented: porting to vtk 5.0
// myPtsSelectVisiblePoints->UnRegisterAllOutputs();
myPtsSelectVisiblePoints->Delete();
// commented: porting to vtk 5.0
// myPtsMaskPoints->UnRegisterAllOutputs();
myPtsMaskPoints->Delete();
myPointLabels->Delete();
//Deleting of cells numbering pipeline
//---------------------------------------
myCellsNumDataSet->Delete();
myClsLabeledDataMapper->RemoveAllInputs();
myClsLabeledDataMapper->Delete();
// commented: porting to vtk 5.0
// myClsSelectVisiblePoints->UnRegisterAllOutputs();
myClsSelectVisiblePoints->Delete();
// commented: porting to vtk 5.0
// myClsMaskPoints->UnRegisterAllOutputs();
myClsMaskPoints->Delete();
// commented: porting to vtk 5.0
// myCellCenters->UnRegisterAllOutputs();
myCellCenters->Delete();
myCellsLabels->Delete();
myImplicitBoolean->Delete();
myTimeStamp->Delete();
@ -648,61 +527,50 @@ SMESH_ActorDef::~SMESH_ActorDef()
void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
{
vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
if ( myIsPointsLabeled )
{
myPointsNumDataSet->ShallowCopy(aGrid);
vtkDataSet *aDataSet = myPointsNumDataSet;
int aNbElem = aDataSet->GetNumberOfPoints();
vtkIntArray *anArray = vtkIntArray::New();
anArray->SetNumberOfValues( aNbElem );
for ( vtkIdType anId = 0; anId < aNbElem; anId++ )
{
int aSMDSId = myVisualObj->GetNodeObjId( anId );
anArray->SetValue( anId, aSMDSId );
}
aDataSet->GetPointData()->SetScalars( anArray );
anArray->Delete();
myPtsMaskPoints->SetInput( aDataSet );
myPointLabels->SetVisibility( GetVisibility() );
}
else
{
myPointLabels->SetVisibility( false );
}
if(myNodeActor) {
myNodeActor->SetPointsLabeled(theIsPointsLabeled);
SetRepresentation(GetRepresentation());
myTimeStamp->Modified();
}
}
bool SMESH_ActorDef::GetPointsLabeled() {
return myNodeActor && myNodeActor->GetPointsLabeled();
}
void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
{
if(my3DActor)
my3DActor->SetCellsLabeled(theIsCellsLabeled);
if(my2DActor)
my2DActor->SetCellsLabeled(theIsCellsLabeled);
if(my1DActor)
my1DActor->SetCellsLabeled(theIsCellsLabeled);
if(my0DActor)
my0DActor->SetCellsLabeled(theIsCellsLabeled);
myTimeStamp->Modified();
}
void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
{
vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
if(myIsCellsLabeled){
myCellsNumDataSet->ShallowCopy(aGrid);
vtkDataSet *aDataSet = myCellsNumDataSet;
int aNbElem = aDataSet->GetNumberOfCells();
vtkIntArray *anArray = vtkIntArray::New();
anArray->SetNumberOfValues(aNbElem);
for(int anId = 0; anId < aNbElem; anId++){
int aSMDSId = myVisualObj->GetElemObjId(anId);
anArray->SetValue(anId,aSMDSId);
}
aDataSet->GetCellData()->SetScalars(anArray);
myCellCenters->SetInput(aDataSet);
myCellsLabels->SetVisibility(GetVisibility());
}else{
myCellsLabels->SetVisibility(false);
}
myTimeStamp->Modified();
bool SMESH_ActorDef::GetCellsLabeled() {
bool result = false;
if(my3DActor)
result = result || my3DActor->GetCellsLabeled();
if(my2DActor)
result = result || my2DActor->GetCellsLabeled();
if(my1DActor)
result = result || my1DActor->GetCellsLabeled();
if(my0DActor)
result = result || my0DActor->GetCellsLabeled();
return result;
}
@ -993,32 +861,23 @@ SetControlMode(eControl theMode,
void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
theRenderer->AddActor(myNodeActor);
theRenderer->AddActor(myBaseActor);
theRenderer->AddActor(myNodeExtActor);
theRenderer->AddActor(my1DExtActor);
my3DActor->AddToRender(theRenderer);
my3DExtActor->AddToRender(theRenderer);
my2DActor->AddToRender(theRenderer);
my2DExtActor->AddToRender(theRenderer);
theRenderer->AddActor(my1DActor);
theRenderer->AddActor(my1DExtActor);
theRenderer->AddActor(my0DActor);
myNodeActor->AddToRender(theRenderer);
my1DActor->AddToRender(theRenderer);
my0DActor->AddToRender(theRenderer);
//theRenderer->AddActor(my0DExtActor);
theRenderer->AddActor(myHighlitableActor);
theRenderer->AddActor2D(myScalarBarActor);
myPtsSelectVisiblePoints->SetRenderer(theRenderer);
myClsSelectVisiblePoints->SetRenderer(theRenderer);
theRenderer->AddActor2D(myPointLabels);
theRenderer->AddActor2D(myCellsLabels);
// the superclass' method should be called at the end
// (in particular, for correct work of selection)
SALOME_Actor::AddToRender(theRenderer);
@ -1027,27 +886,25 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
SALOME_Actor::RemoveFromRender(theRenderer);
theRenderer->RemoveActor(myNodeActor);
theRenderer->RemoveActor(myBaseActor);
theRenderer->RemoveActor(myNodeExtActor);
theRenderer->RemoveActor(myHighlitableActor);
theRenderer->RemoveActor(my0DActor);
//theRenderer->RemoveActor(my0DExtActor);
theRenderer->RemoveActor(my1DActor);
theRenderer->RemoveActor(my1DExtActor);
my2DActor->RemoveFromRender(theRenderer);
my2DExtActor->RemoveFromRender(theRenderer);
my3DActor->RemoveFromRender(theRenderer);
my3DExtActor->RemoveFromRender(theRenderer);
myNodeActor->RemoveFromRender(theRenderer);
my0DActor->RemoveFromRender(theRenderer);
my1DActor->RemoveFromRender(theRenderer);
theRenderer->RemoveActor(myScalarBarActor);
theRenderer->RemoveActor(myPointLabels);
theRenderer->RemoveActor(myCellsLabels);
}
@ -1306,8 +1163,6 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
my3DExtActor->VisibilityOff();
myScalarBarActor->VisibilityOff();
myPointLabels->VisibilityOff();
myCellsLabels->VisibilityOff();
if(GetVisibility()){
if(theIsUpdateRepersentation)
@ -1362,13 +1217,21 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
my3DActor->VisibilityOn();
}
if(myIsPointsLabeled){
myPointLabels->VisibilityOn();
if(myNodeActor->GetPointsLabeled()){
myNodeActor->VisibilityOn();
}
if(myIsCellsLabeled)
myCellsLabels->VisibilityOn();
if(my0DActor)
my0DActor->UpdateLabels();
if(my1DActor)
my1DActor->UpdateLabels();
if(my2DActor)
my2DActor->UpdateLabels();
if(my3DActor)
my3DActor->UpdateLabels();
}
#ifndef DISABLE_PLOT2DVIEWER
else
@ -1622,7 +1485,7 @@ void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){
}
bool SMESH_ActorDef::GetPointRepresentation(){
return myIsPointsVisible || myIsPointsLabeled;
return myIsPointsVisible || myNodeActor->GetPointsLabeled();
}
@ -1729,12 +1592,22 @@ void SMESH_ActorDef::Update(){
if (anObjTime > aTime)
SetControlMode(GetControlMode(),false);
}
if(myIsPointsLabeled){
SetPointsLabeled(myIsPointsLabeled);
}
if(myIsCellsLabeled){
SetCellsLabeled(myIsCellsLabeled);
}
if(myNodeActor)
myNodeActor->UpdateLabels();
if(my0DActor)
my0DActor->UpdateLabels();
if(my1DActor)
my1DActor->UpdateLabels();
if(my2DActor)
my2DActor->UpdateLabels();
if(my3DActor)
my3DActor->UpdateLabels();
if(myIsFacesOriented){
SetFacesOriented(myIsFacesOriented);
}
@ -1929,6 +1802,7 @@ SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane)
myCippingPlaneCont.push_back(thePlane);
if(!IsImplicitFunctionUsed())
SetImplicitFunctionUsed(true);
myNodeActor->UpdateLabels();
}
return myCippingPlaneCont.size();
}
@ -1941,6 +1815,7 @@ RemoveAllClippingPlanes()
myImplicitBoolean->GetFunction()->Modified(); // VTK bug
myCippingPlaneCont.clear();
SetImplicitFunctionUsed(false);
myNodeActor->UpdateLabels();
}
vtkIdType

View File

@ -61,17 +61,14 @@ class vtkMergeFilter;
class vtkPolyData;
class vtkMapper;
class vtkActor2D;
class vtkMaskPoints;
class vtkLabeledDataMapper;
class vtkSelectVisiblePoints;
class vtkLookupTable;
class vtkPlane;
class vtkImplicitBoolean;
class vtkTimeStamp;
class VTKViewer_CellCenters;
class SMESH_DeviceActor;
class SMESH_NodeLabelActor;
class SMESH_CellLabelActor;
class SMESH_ScalarBarActor;
#ifndef DISABLE_PLOT2DVIEWER
@ -167,10 +164,10 @@ class SMESH_ActorDef : public SMESH_Actor
virtual void UnShrink();
virtual void SetPointsLabeled(bool theIsPointsLabeled);
virtual bool GetPointsLabeled(){ return myIsPointsLabeled;}
virtual bool GetPointsLabeled();
virtual void SetCellsLabeled(bool theIsCellsLabeled);
virtual bool GetCellsLabeled(){ return myIsCellsLabeled;}
virtual bool GetCellsLabeled();
virtual void SetFacesOriented(bool theIsFacesOriented);
virtual bool GetFacesOriented();
@ -232,7 +229,7 @@ class SMESH_ActorDef : public SMESH_Actor
vtkProperty* myNodeProp;
SMESH_DeviceActor* myBaseActor;
SMESH_DeviceActor* myNodeActor;
SMESH_NodeLabelActor* myNodeActor;
SMESH_DeviceActor* myPickableActor;
vtkProperty* myHighlightProp;
@ -244,9 +241,9 @@ class SMESH_ActorDef : public SMESH_Actor
eControl myControlMode;
SMESH::Controls::FunctorPtr myFunctor;
vtkProperty* my2DExtProp;
SMESH_DeviceActor* my2DActor;
SMESH_CellLabelActor* my2DActor;
SMESH_DeviceActor* my2DExtActor;
SMESH_DeviceActor* my3DActor;
SMESH_CellLabelActor* my3DActor;
SMESH_DeviceActor* my3DExtActor;
SMESH_DeviceActor* myControlActor;
@ -254,12 +251,12 @@ class SMESH_ActorDef : public SMESH_Actor
SMESH_DeviceActor* myNodeExtActor;
vtkProperty* my1DProp;
SMESH_DeviceActor* my1DActor;
SMESH_CellLabelActor* my1DActor;
vtkProperty* my1DExtProp;
SMESH_DeviceActor* my1DExtActor;
vtkProperty* my0DProp;
SMESH_DeviceActor* my0DActor;
SMESH_CellLabelActor* my0DActor;
vtkProperty* my0DExtProp;
SMESH_DeviceActor* my0DExtActor;
@ -270,21 +267,6 @@ class SMESH_ActorDef : public SMESH_Actor
bool myIsShrinkable;
bool myIsShrunk;
bool myIsPointsLabeled;
vtkUnstructuredGrid* myPointsNumDataSet;
vtkActor2D *myPointLabels;
vtkMaskPoints* myPtsMaskPoints;
vtkLabeledDataMapper* myPtsLabeledDataMapper;
vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
bool myIsCellsLabeled;
vtkUnstructuredGrid* myCellsNumDataSet;
vtkActor2D *myCellsLabels;
vtkMaskPoints* myClsMaskPoints;
VTKViewer_CellCenters* myCellCenters;
vtkLabeledDataMapper* myClsLabeledDataMapper;
vtkSelectVisiblePoints* myClsSelectVisiblePoints;
vtkImplicitBoolean* myImplicitBoolean;
typedef TVTKSmartPtr<vtkPlane> TPlanePtr;
typedef std::vector<TPlanePtr> TCippingPlaneCont;

View File

@ -0,0 +1,185 @@
// Copyright (C) 2007-2011 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 : SMESH_CellLabelActor.cxx
// Author : Roman NIKOLAEV
// Module : SMESH
//
#include "SMESH_CellLabelActor.h"
#include <VTKViewer_TransformFilter.h>
#include <VTKViewer_CellCenters.h>
#include <vtkObjectFactory.h>
#include <vtkCallbackCommand.h>
#include <vtkMaskPoints.h>
#include <vtkSelectVisiblePoints.h>
#include <vtkLabeledDataMapper.h>
#include <vtkActor2D.h>
#include <vtkTextProperty.h>
#include <vtkPointData.h>
#include <vtkProperty2D.h>
#include <vtkRenderer.h>
#include <vtkPolyData.h>
#include <vtkCellData.h>
vtkStandardNewMacro(SMESH_CellLabelActor);
/*!
Constructor.
*/
SMESH_CellLabelActor::SMESH_CellLabelActor() {
//Definition of cells numbering pipeline
//---------------------------------------
myCellsNumDataSet = vtkPolyData::New();
myCellCenters = VTKViewer_CellCenters::New();
myCellCenters->SetInput(myCellsNumDataSet);
myClsMaskPoints = vtkMaskPoints::New();
myClsMaskPoints->SetInput(myCellCenters->GetOutput());
myClsMaskPoints->SetOnRatio(1);
myClsSelectVisiblePoints = vtkSelectVisiblePoints::New();
myClsSelectVisiblePoints->SetInput(myClsMaskPoints->GetOutput());
myClsSelectVisiblePoints->SelectInvisibleOff();
myClsSelectVisiblePoints->SetTolerance(0.1);
myClsLabeledDataMapper = vtkLabeledDataMapper::New();
myClsLabeledDataMapper->SetInput(myClsSelectVisiblePoints->GetOutput());
myClsLabeledDataMapper->SetLabelFormat("%d");
myClsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aClsTextProp = vtkTextProperty::New();
aClsTextProp->SetFontFamilyToTimes();
static int aCellsFontSize = 12;
aClsTextProp->SetFontSize(aCellsFontSize);
aClsTextProp->SetBold(1);
aClsTextProp->SetItalic(0);
aClsTextProp->SetShadow(0);
myClsLabeledDataMapper->SetLabelTextProperty(aClsTextProp);
aClsTextProp->Delete();
myIsCellsLabeled = false;
myCellsLabels = vtkActor2D::New();
myCellsLabels->SetMapper(myClsLabeledDataMapper);
myCellsLabels->GetProperty()->SetColor(0,1,0);
myCellsLabels->SetVisibility(myIsCellsLabeled);
vtkCallbackCommand* callBackCommand = vtkCallbackCommand::New();
callBackCommand->SetClientData(this);
callBackCommand->SetCallback(SMESH_CellLabelActor::ProcessEvents);
myTransformFilter->AddObserver("VTKViewer_TransformFilter::TransformationFinished",
callBackCommand);
callBackCommand->Delete();
}
/*!
Destructor.
*/
SMESH_CellLabelActor::~SMESH_CellLabelActor() {
//Deleting of cells numbering pipeline
//---------------------------------------
myCellsNumDataSet->Delete();
myClsLabeledDataMapper->RemoveAllInputs();
myClsLabeledDataMapper->Delete();
// commented: porting to vtk 5.0
// myClsSelectVisiblePoints->UnRegisterAllOutputs();
myClsSelectVisiblePoints->Delete();
// commented: porting to vtk 5.0
// myClsMaskPoints->UnRegisterAllOutputs();
myClsMaskPoints->Delete();
// commented: porting to vtk 5.0
// myCellCenters->UnRegisterAllOutputs();
myCellCenters->Delete();
myCellsLabels->Delete();
}
void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled) {
myTransformFilter->Update();
vtkPolyData* aGrid = vtkPolyData::SafeDownCast(myTransformFilter->GetOutput());
if(!aGrid)
return;
myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
if(myIsCellsLabeled){
myCellsNumDataSet->ShallowCopy(aGrid);
vtkDataSet *aDataSet = myCellsNumDataSet;
int aNbElem = aDataSet->GetNumberOfCells();
vtkIntArray *anArray = vtkIntArray::New();
anArray->SetNumberOfValues(aNbElem);
for(int anId = 0; anId < aNbElem; anId++){
int aSMDSId = GetElemObjId(anId);
anArray->SetValue(anId,aSMDSId);
}
aDataSet->GetCellData()->SetScalars(anArray);
myCellCenters->SetInput(aDataSet);
myCellsLabels->SetVisibility(GetVisibility());
}else{
myCellsLabels->SetVisibility(false);
}
}
void SMESH_CellLabelActor::SetVisibility(int theMode)
{
SMESH_DeviceActor::SetVisibility(theMode);
myCellsLabels->VisibilityOff();
if(myIsCellsLabeled && theMode)
myCellsLabels->VisibilityOn();
}
void SMESH_CellLabelActor::AddToRender(vtkRenderer* theRenderer)
{
SMESH_DeviceActor::AddToRender(theRenderer);
myClsSelectVisiblePoints->SetRenderer(theRenderer);
theRenderer->AddActor2D(myCellsLabels);
}
void SMESH_CellLabelActor::RemoveFromRender(vtkRenderer* theRenderer)
{
theRenderer->RemoveActor(myCellsLabels);
SMESH_DeviceActor::RemoveFromRender(theRenderer);
}
void SMESH_CellLabelActor::UpdateLabels() {
if(myIsCellsLabeled)
SetCellsLabeled(myIsCellsLabeled);
}
void SMESH_CellLabelActor::ProcessEvents(vtkObject* vtkNotUsed(theObject),
unsigned long theEvent,
void* theClientData,
void* vtkNotUsed(theCallData)) {
SMESH_CellLabelActor* self = reinterpret_cast<SMESH_CellLabelActor*>(theClientData);
if(self)
self->UpdateLabels();
}

View File

@ -0,0 +1,82 @@
// Copyright (C) 2007-2011 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 : SMESH_CellLabelActor.h
// Author : Roman NIKOLAEV
// Module : SMESH
//
#ifndef SMESH_CELL_LABEL_ACTOR_H
#define SMESH_CELL_LABEL_ACTOR_H
#include "SMESH_DeviceActor.h"
class vtkSelectVisiblePoints;
class vtkLabeledDataMapper;
class vtkActor2D;
class vtkMaskPoints;
class vtkPolyData;
class VTKViewer_CellCenters;
class SMESHOBJECT_EXPORT SMESH_CellLabelActor : public SMESH_DeviceActor {
public:
static SMESH_CellLabelActor* New();
static void ProcessEvents(vtkObject* theObject,
unsigned long theEvent,
void* theClientData,
void* theCallData);
vtkTypeMacro(SMESH_CellLabelActor, SMESH_DeviceActor);
virtual void SetCellsLabeled(bool theIsCellsLabeled);
virtual bool GetCellsLabeled(){ return myIsCellsLabeled;}
virtual void SetVisibility(int theMode);
virtual void AddToRender(vtkRenderer* theRenderer);
virtual void RemoveFromRender(vtkRenderer* theRenderer);
void UpdateLabels();
protected:
SMESH_CellLabelActor();
~SMESH_CellLabelActor();
bool myIsCellsLabeled;
vtkPolyData* myCellsNumDataSet;
vtkActor2D *myCellsLabels;
vtkMaskPoints* myClsMaskPoints;
VTKViewer_CellCenters* myCellCenters;
vtkLabeledDataMapper* myClsLabeledDataMapper;
vtkSelectVisiblePoints* myClsSelectVisiblePoints;
SMESH_DeviceActor* myBaseActor; //Pointer to the base actor
protected:
// Not implemented.
SMESH_CellLabelActor(const SMESH_CellLabelActor&);
void operator=(const SMESH_CellLabelActor&);
};
#endif //SMESH_NODE_LABEL_ACTOR_H

View File

@ -626,7 +626,7 @@ void
SMESH_DeviceActor
::SetFacesOriented(bool theIsFacesOriented)
{
if ( vtkDataSet* aDataSet = myPassFilter[ 1 ]->GetOutput() )
if ( vtkDataSet* aDataSet = myTransformFilter->GetOutput() )
{
myIsFacesOriented = theIsFacesOriented;
if( theIsFacesOriented )

View File

@ -239,6 +239,11 @@ int SMESH_ExtractGeometry::RequestData(
if ( npts >= numCellPts || (this->ExtractBoundaryCells && npts > 0) )
{
if(cell->GetCellType() == VTK_POLYHEDRON) {
newCellPts->Reset();
vtkUnstructuredGrid::SafeDownCast(input)->GetFaceStream( cellId ,newCellPts );
vtkUnstructuredGrid::ConvertFaceStreamPointIds(newCellPts, pointMap);
}
newCellId = output->InsertNextCell(cell->GetCellType(),newCellPts);
myElemVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);

View File

@ -0,0 +1,187 @@
// Copyright (C) 2007-2011 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 : SMESH_NodeLabelActor.cxx
// Author : Roman NIKOLAEV
// Module : SMESH
//
#include "SMESH_NodeLabelActor.h"
#include <VTKViewer_TransformFilter.h>
#include <vtkObjectFactory.h>
#include <vtkCallbackCommand.h>
#include <vtkMaskPoints.h>
#include <vtkSelectVisiblePoints.h>
#include <vtkLabeledDataMapper.h>
#include <vtkActor2D.h>
#include <vtkTextProperty.h>
#include <vtkPointData.h>
#include <vtkProperty2D.h>
#include <vtkRenderer.h>
#include <vtkPolyData.h>
vtkStandardNewMacro(SMESH_NodeLabelActor);
/*!
Constructor.
*/
SMESH_NodeLabelActor::SMESH_NodeLabelActor() {
//Definition of points numbering pipeline
//---------------------------------------
myPointsNumDataSet = vtkPolyData::New();
myPtsMaskPoints = vtkMaskPoints::New();
myPtsMaskPoints->SetInput(myPointsNumDataSet);
myPtsMaskPoints->SetOnRatio(1);
myPtsSelectVisiblePoints = vtkSelectVisiblePoints::New();
myPtsSelectVisiblePoints->SetInput(myPtsMaskPoints->GetOutput());
myPtsSelectVisiblePoints->SelectInvisibleOff();
myPtsSelectVisiblePoints->SetTolerance(0.1);
myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
myPtsLabeledDataMapper->SetLabelFormat("%d");
myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
aPtsTextProp->SetFontFamilyToTimes();
static int aPointsFontSize = 10;
aPtsTextProp->SetFontSize(aPointsFontSize);
aPtsTextProp->SetBold(1);
aPtsTextProp->SetItalic(0);
aPtsTextProp->SetShadow(0);
myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
aPtsTextProp->Delete();
myIsPointsLabeled = false;
myPointLabels = vtkActor2D::New();
myPointLabels->SetMapper(myPtsLabeledDataMapper);
myPointLabels->GetProperty()->SetColor(1,1,1);
myPointLabels->SetVisibility(myIsPointsLabeled);
vtkCallbackCommand* callBackCommand = vtkCallbackCommand::New();
callBackCommand->SetClientData(this);
callBackCommand->SetCallback(SMESH_NodeLabelActor::ProcessEvents);
myTransformFilter->AddObserver("VTKViewer_TransformFilter::TransformationFinished",
callBackCommand);
callBackCommand->Delete();
}
/*!
Destructor
*/
SMESH_NodeLabelActor::~SMESH_NodeLabelActor() {
//Deleting of points numbering pipeline
//---------------------------------------
myPointsNumDataSet->Delete();
// commented: porting to vtk 5.0
// myPtsLabeledDataMapper->RemoveAllInputs();
myPtsLabeledDataMapper->Delete();
// commented: porting to vtk 5.0
// myPtsSelectVisiblePoints->UnRegisterAllOutputs();
myPtsSelectVisiblePoints->Delete();
// commented: porting to vtk 5.0
// myPtsMaskPoints->UnRegisterAllOutputs();
myPtsMaskPoints->Delete();
myPointLabels->Delete();
}
void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled) {
myTransformFilter->Update();
vtkDataSet* aGrid = vtkPolyData::SafeDownCast(myTransformFilter->GetOutput());
if(!aGrid)
return;
myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
if ( myIsPointsLabeled )
{
myPointsNumDataSet->ShallowCopy(aGrid);
vtkDataSet *aDataSet = myPointsNumDataSet;
int aNbElem = aDataSet->GetNumberOfPoints();
vtkIntArray *anArray = vtkIntArray::New();
anArray->SetNumberOfValues( aNbElem );
for ( vtkIdType anId = 0; anId < aNbElem; anId++ )
{
int aSMDSId = GetNodeObjId( anId );
anArray->SetValue( anId, aSMDSId );
}
aDataSet->GetPointData()->SetScalars( anArray );
myPtsMaskPoints->SetInput( aDataSet );
myPointLabels->SetVisibility( GetVisibility() );
anArray->Delete();
}
else
{
myPointLabels->SetVisibility( false );
}
}
void SMESH_NodeLabelActor::SetVisibility(int theMode)
{
SMESH_DeviceActor::SetVisibility(theMode);
myPointLabels->VisibilityOff();
if(myIsPointsLabeled && theMode)
myPointLabels->VisibilityOn();
}
void SMESH_NodeLabelActor::AddToRender(vtkRenderer* theRenderer)
{
SMESH_DeviceActor::AddToRender(theRenderer);
myPtsSelectVisiblePoints->SetRenderer(theRenderer);
theRenderer->AddActor2D(myPointLabels);
}
void SMESH_NodeLabelActor::RemoveFromRender(vtkRenderer* theRenderer)
{
theRenderer->RemoveActor(myPointLabels);
SMESH_DeviceActor::RemoveFromRender(theRenderer);
}
void SMESH_NodeLabelActor::UpdateLabels() {
if(myIsPointsLabeled)
SetPointsLabeled(myIsPointsLabeled);
}
void SMESH_NodeLabelActor::ProcessEvents(vtkObject* vtkNotUsed(theObject),
unsigned long theEvent,
void* theClientData,
void* vtkNotUsed(theCallData)) {
SMESH_NodeLabelActor* self = reinterpret_cast<SMESH_NodeLabelActor*>(theClientData);
if(self)
self->UpdateLabels();
}

View File

@ -0,0 +1,78 @@
// Copyright (C) 2007-2011 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 : SMESH_NodeLabelActor.h
// Author : Roman NIKOLAEV
// Module : SMESH
//
#ifndef SMESH_NODE_LABEL_ACTOR_H
#define SMESH_NODE_LABEL_ACTOR_H
#include "SMESH_DeviceActor.h"
class vtkSelectVisiblePoints;
class vtkLabeledDataMapper;
class vtkActor2D;
class vtkMaskPoints;
class vtkPolyData;
class SMESHOBJECT_EXPORT SMESH_NodeLabelActor : public SMESH_DeviceActor {
public:
static SMESH_NodeLabelActor* New();
static void ProcessEvents(vtkObject* theObject,
unsigned long theEvent,
void* theClientData,
void* theCallData);
vtkTypeMacro(SMESH_NodeLabelActor, SMESH_DeviceActor);
virtual void SetPointsLabeled(bool theIsPointsLabeled);
virtual bool GetPointsLabeled(){ return myIsPointsLabeled;}
virtual void SetVisibility(int theMode);
virtual void AddToRender(vtkRenderer* theRenderer);
virtual void RemoveFromRender(vtkRenderer* theRenderer);
void UpdateLabels();
protected:
SMESH_NodeLabelActor();
~SMESH_NodeLabelActor();
bool myIsPointsLabeled;
vtkPolyData* myPointsNumDataSet;
vtkActor2D *myPointLabels;
vtkMaskPoints* myPtsMaskPoints;
vtkLabeledDataMapper* myPtsLabeledDataMapper;
vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
protected:
// Not implemented.
SMESH_NodeLabelActor(const SMESH_NodeLabelActor&);
void operator=(const SMESH_NodeLabelActor&);
};
#endif //SMESH_NODE_LABEL_ACTOR_H

View File

@ -368,9 +368,25 @@ void SMESH_VisualObjDef::buildElemPrs()
{
const TEntityList& aList = anEnts[ aTypes[ i ] ];
TEntityList::const_iterator anIter;
for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
for ( anIter = aList.begin(); anIter != aList.end(); ++anIter ) {
if((*anIter)->GetEntityType() != SMDSEntity_Polyhedra &&
(*anIter)->GetEntityType() != SMDSEntity_Quad_Polyhedra) {
aCellsSize += (*anIter)->NbNodes() + 1;
}
// Special case for the VTK_POLYHEDRON:
// itsinput cellArray is of special format.
// [nCellFaces, nFace0Pts, i, j, k, nFace1Pts, i, j, k, ...]
else {
if( const SMDS_VtkVolume* ph = dynamic_cast<const SMDS_VtkVolume*>(*anIter) ) {
int nbFaces = ph->NbFaces();
aCellsSize += (1 + ph->NbFaces());
for( int i = 1; i <= nbFaces; i++ ) {
aCellsSize += ph->NbFaceNodes(i);
}
}
}
}
}
}
vtkIdType aNbCells = nbEnts[ SMDSAbs_0DElement ] + nbEnts[ SMDSAbs_Edge ] +
@ -402,8 +418,8 @@ void SMESH_VisualObjDef::buildElemPrs()
for ( int i = 0; i <= 3; i++ ) // iterate through 0d elements, edges, faces and volumes
{
if ( nbEnts[ aTypes[ i ] ] > 0 )
{
if ( nbEnts[ aTypes[ i ] ] > 0 ) {
const SMDSAbs_ElementType& aType = aTypes[ i ];
const TEntityList& aList = anEnts[ aType ];
TEntityList::const_iterator anIter;
@ -421,20 +437,26 @@ void SMESH_VisualObjDef::buildElemPrs()
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
switch (aType) {
case SMDSAbs_Volume:{
case SMDSAbs_Volume: {
aConnect.clear();
std::vector<int> aConnectivities;
// Convertions connectivities from SMDS to VTK
if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
if ( const SMDS_VtkVolume* ph =
dynamic_cast<const SMDS_VtkVolume*> (anElem))
{
aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect);
anIdList->SetNumberOfIds( aNbNodes );
if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
anIdList->Reset();
if ( const SMDS_VtkVolume* ph = dynamic_cast<const SMDS_VtkVolume*>(anElem) ) {
int nbFaces = ph->NbFaces();
anIdList->InsertNextId(nbFaces);
for( int i = 1; i <= nbFaces; i++ ) {
anIdList->InsertNextId(ph->NbFaceNodes(i));
for(int j = 1; j <= ph->NbFaceNodes(i); j++) {
const SMDS_MeshNode* n = ph->GetFaceNode(i,j);
if(n) {
anIdList->InsertNextId(mySMDS2VTKNodes[n->GetID()]);
}
}
}
}
for (int k = 0; k < aNbNodes; k++)
aConnectivities.push_back(k);
} else if (aNbNodes == 4) {
static int anIds[] = {0,2,1,3};
@ -479,6 +501,7 @@ void SMESH_VisualObjDef::buildElemPrs()
else {
}
if (!(anElem->IsPoly() && aNbNodes > 3)) {
if ( aConnect.empty() )
GetConnect(aNodesIter,aConnect);
@ -486,6 +509,7 @@ void SMESH_VisualObjDef::buildElemPrs()
for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
}
}
break;
}
default:
@ -495,6 +519,7 @@ void SMESH_VisualObjDef::buildElemPrs()
}
}
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) );
@ -570,7 +595,12 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid()
{
//MESSAGE("SMESH_VisualObjDef::GetUnstructuredGrid " << myGrid);
if ( !myLocalGrid && !GetMesh()->isCompacted() )
{
GetMesh()->compactMesh();
vtkUnstructuredGrid *theGrid = GetMesh()->getGrid();
myGrid->ShallowCopy(theGrid);
}
return myGrid;
}

View File

@ -1,230 +0,0 @@
/*=========================================================================
Program: ParaView
Module: $RCSfile$
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "SMESH_vtkPVUpdateSuppressor.h"
#include "vtkAlgorithmOutput.h"
#include "vtkCollection.h"
#include "vtkCommand.h"
#include "vtkCompositeDataPipeline.h"
#include "vtkDataObject.h"
#include "vtkDemandDrivenPipeline.h"
#include "vtkInformation.h"
#include "vtkInformationDoubleVectorKey.h"
#include "vtkInformationExecutivePortKey.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkPolyData.h"
//#include "vtkProcessModule.h"
#include "vtkSmartPointer.h"
#include "vtkUnstructuredGrid.h"
//#include "vtkUpdateSuppressorPipeline.h"
#include <vtkstd/map>
#ifdef MYDEBUG
# define vtkMyDebug(x)\
cout << x;
#else
# define vtkMyDebug(x)
#endif
vtkCxxRevisionMacro(vtkPVUpdateSuppressor, "$Revision$")
;
vtkStandardNewMacro(vtkPVUpdateSuppressor)
;
//----------------------------------------------------------------------------
vtkPVUpdateSuppressor::vtkPVUpdateSuppressor()
{
this->UpdatePiece = 0;
this->UpdateNumberOfPieces = 1;
this->UpdateTime = 0.0;
this->UpdateTimeInitialized = false;
this->Enabled = 1;
// vtkProcessModule* pm = vtkProcessModule::GetProcessModule();
//
// if (pm)
// {
// this->UpdateNumberOfPieces = pm->GetNumberOfLocalPartitions();
// this->UpdatePiece = pm->GetPartitionId();
// }
}
//----------------------------------------------------------------------------
vtkPVUpdateSuppressor::~vtkPVUpdateSuppressor()
{
}
//----------------------------------------------------------------------------
void vtkPVUpdateSuppressor::SetUpdateTime(double utime)
{
this->UpdateTimeInitialized = true;
if (this->UpdateTime != utime)
{
this->Modified();
this->UpdateTime = utime;
}
}
//----------------------------------------------------------------------------
void vtkPVUpdateSuppressor::SetEnabled(int enable)
{
if (this->Enabled == enable)
{
return;
}
this->Enabled = enable;
this->Modified();
// vtkUpdateSuppressorPipeline* executive =
// vtkUpdateSuppressorPipeline::SafeDownCast(this->GetExecutive());
// if (executive)
// {
// executive->SetEnabled(enable);
// }
}
//----------------------------------------------------------------------------
void vtkPVUpdateSuppressor::ForceUpdate()
{
// Make sure that output type matches input type
this->UpdateInformation();
vtkDataObject *input = this->GetInput();
if (input == 0)
{
vtkErrorMacro("No valid input.");
return;
}
vtkDataObject *output = this->GetOutput();
// int fixme; // I do not like this hack. How can we get rid of it?
// Assume the input is the collection filter.
// Client needs to modify the collection filter because it is not
// connected to a pipeline.
vtkAlgorithm *source = input->GetProducerPort()->GetProducer();
if (source && (source->IsA("vtkMPIMoveData")
|| source->IsA("vtkCollectPolyData") || source->IsA("vtkM2NDuplicate")
|| source->IsA("vtkM2NCollect")
|| source->IsA("vtkOrderedCompositeDistributor")
|| source->IsA("vtkClientServerMoveData")))
{
source->Modified();
}
vtkInformation* info = input->GetPipelineInformation();
vtkStreamingDemandDrivenPipeline
* sddp =
vtkStreamingDemandDrivenPipeline::SafeDownCast(
vtkExecutive::PRODUCER()->GetExecutive(
info));
if (sddp)
{
sddp->SetUpdateExtent(info, this->UpdatePiece,
this->UpdateNumberOfPieces, 0);
}
else
{
input->SetUpdatePiece(this->UpdatePiece);
input->SetUpdateNumberOfPieces(this->UpdateNumberOfPieces);
input->SetUpdateGhostLevel(0);
} vtkMyDebug("ForceUpdate ");
if (this->UpdateTimeInitialized)
{
info->Set(vtkCompositeDataPipeline::UPDATE_TIME_STEPS(),
&this->UpdateTime, 1);
vtkMyDebug(this->UpdateTime);
} vtkMyDebug(endl);
input->Update();
// Input may have changed, we obtain the pointer again.
input = this->GetInput();
output->ShallowCopy(input);
this->PipelineUpdateTime.Modified();
}
//----------------------------------------------------------------------------
vtkExecutive* vtkPVUpdateSuppressor::CreateDefaultExecutive()
{
vtkUpdateSuppressorPipeline* executive = vtkUpdateSuppressorPipeline::New();
executive->SetEnabled(this->Enabled);
return executive;
}
//----------------------------------------------------------------------------
int vtkPVUpdateSuppressor::RequestDataObject(
vtkInformation* vtkNotUsed(reqInfo),
vtkInformationVector** inputVector,
vtkInformationVector* outputVector)
{
vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
if (!inInfo)
{
return 0;
}
vtkDataObject *input = inInfo->Get(vtkDataObject::DATA_OBJECT());
if (input)
{
// for each output
for (int i = 0; i < this->GetNumberOfOutputPorts(); ++i)
{
vtkInformation* outInfo = outputVector->GetInformationObject(i);
vtkDataObject *output = outInfo->Get(vtkDataObject::DATA_OBJECT());
if (!output || !output->IsA(input->GetClassName()))
{
vtkDataObject* newOutput = input->NewInstance();
newOutput->SetPipelineInformation(outInfo);
newOutput->Delete();
this->GetOutputPortInformation(i)->Set(
vtkDataObject::DATA_EXTENT_TYPE(),
newOutput->GetExtentType());
}
}
return 1;
}
return 0;
}
//----------------------------------------------------------------------------
int vtkPVUpdateSuppressor::RequestData(vtkInformation* vtkNotUsed(reqInfo),
vtkInformationVector** inputVector,
vtkInformationVector* outputVector)
{
// RequestData is only called by its executive when
// (Enabled==off) and thus acting as a passthrough filter
vtkInformation *outInfo = outputVector->GetInformationObject(0);
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
vtkDataObject *input = inInfo->Get(vtkDataObject::DATA_OBJECT());
vtkDataObject *output = outInfo->Get(vtkDataObject::DATA_OBJECT());
output->ShallowCopy(input);
return 1;
}
//----------------------------------------------------------------------------
void vtkPVUpdateSuppressor::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "UpdatePiece: " << this->UpdatePiece << endl;
os << indent << "UpdateNumberOfPieces: " << this->UpdateNumberOfPieces
<< endl;
os << indent << "Enabled: " << this->Enabled << endl;
os << indent << "UpdateTime: " << this->UpdateTime << endl;
}

View File

@ -1,98 +0,0 @@
/*=========================================================================
Program: ParaView
Module: $RCSfile$
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkPVUpdateSuppressor - prevents propagation of update
// .SECTION Description
// vtkPVUpdateSuppressor now uses the vtkProcessModule singleton to set up the
// default values for UpdateNumberOfPieces and UpdatePiece, so we no longer have
// to set the default values (in most cases).
// .SECTION See Also
// vtkPVCacheKeeper vtkUpdateSuppressorPipeline
#ifndef __vtkPVUpdateSuppressor_h
#define __vtkPVUpdateSuppressor_h
#include "vtkDataObjectAlgorithm.h"
class VTK_EXPORT vtkPVUpdateSuppressor: public vtkDataObjectAlgorithm
{
public:
vtkTypeRevisionMacro(vtkPVUpdateSuppressor,vtkDataObjectAlgorithm)
;
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Construct with user-specified implicit function.
static vtkPVUpdateSuppressor *New();
// Description:
// Force update on the input.
virtual void ForceUpdate();
// Description:
// Set number of pieces and piece on the data.
// This causes the filter to ingore the request from the output.
// It is here because the user may not have celled update on the output
// before calling force update (it is an easy fix).
vtkSetMacro(UpdatePiece, int)
;
vtkGetMacro(UpdatePiece, int)
;
vtkSetMacro(UpdateNumberOfPieces, int)
;
vtkGetMacro(UpdateNumberOfPieces, int)
;
// Description:
// Get/Set if the update suppressor is enabled. If the update suppressor
// is not enabled, it won't supress any updates. Enabled by default.
void SetEnabled(int);
vtkGetMacro(Enabled, int)
;
// Description:
// Get/Set the update time that is sent up the pipeline.
void SetUpdateTime(double utime);
vtkGetMacro(UpdateTime, double)
;
protected:
vtkPVUpdateSuppressor();
~vtkPVUpdateSuppressor();
int RequestDataObject(vtkInformation* request,
vtkInformationVector **inputVector,
vtkInformationVector *outputVector);
int RequestData(vtkInformation* request, vtkInformationVector **inputVector,
vtkInformationVector *outputVector);
int UpdatePiece;
int UpdateNumberOfPieces;
double UpdateTime;
bool UpdateTimeInitialized;
int Enabled;
vtkTimeStamp PipelineUpdateTime;
// Create a default executive.
virtual vtkExecutive* CreateDefaultExecutive();
private:
vtkPVUpdateSuppressor(const vtkPVUpdateSuppressor&); // Not implemented.
void operator=(const vtkPVUpdateSuppressor&); // Not implemented.
};
#endif

View File

@ -95,21 +95,27 @@ void SMDS_VtkVolume::initPoly(std::vector<vtkIdType> nodeIds, std::vector<int> n
{
int nf = nbNodesPerFace[i];
ptIds.push_back(nf);
double a[3];
double b[3];
double c[3];
grid->GetPoints()->GetPoint(nodeIds[k], a);
grid->GetPoints()->GetPoint(nodeIds[k + 1], b);
grid->GetPoints()->GetPoint(nodeIds[k + 2], c);
bool isFaceForward = this->isForward(a, b, c, center);
// EAP: a right approach is:
// - either the user should care of order of nodes or
// - the user should use a service method arranging nodes if he
// don't want or can't to do it by him-self
// The method below works OK only with planar faces
//
// double a[3];
// double b[3];
// double c[3];
// grid->GetPoints()->GetPoint(nodeIds[k], a);
// grid->GetPoints()->GetPoint(nodeIds[k + 1], b);
// grid->GetPoints()->GetPoint(nodeIds[k + 2], c);
// bool isFaceForward = this->isForward(a, b, c, center);
//MESSAGE("isFaceForward " << i << " " << isFaceForward);
vtkIdType *facePts = &nodeIds[k];
if (isFaceForward)
//if (isFaceForward)
for (int n = 0; n < nf; n++)
ptIds.push_back(facePts[n]);
else
for (int n = nf - 1; n >= 0; n--)
ptIds.push_back(facePts[n]);
// else
// for (int n = nf - 1; n >= 0; n--)
// ptIds.push_back(facePts[n]);
k += nf;
}
myVtkID = grid->InsertNextLinkedCell(VTK_POLYHEDRON, nbFaces, &ptIds[0]);

View File

@ -438,7 +438,7 @@ bool SMESH_Algo::GetSortedNodesOnEdge(const SMESHDS_Mesh* theM
return false;
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
theNodes.insert( make_pair( epos->GetUParameter(), node ));
theNodes.insert( theNodes.end(), make_pair( epos->GetUParameter(), node ));
//MESSAGE("U " << epos->GetUParameter() << " ID " << node->GetID());
++nbNodes;
}

View File

@ -128,6 +128,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
const bool includeSelf = true;
const bool complexShapeFirst = true;
const int globalAlgoDim = 100;
SMESH_subMeshIteratorPtr smIt;
@ -214,20 +215,31 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
if ( algo->SupportSubmeshes() )
{
// reload sub-meshes from shDim2sm into smWithAlgoSupportingSubmeshes
// so that more local algos to go first
if ( prevShapeDim != aShapeDim )
{
prevShapeDim = aShapeDim;
for ( shDim2smIt = shDim2sm.rbegin(); shDim2smIt != shDim2sm.rend(); ++shDim2smIt )
if ( shDim2smIt->first == globalAlgoDim )
smWithAlgoSupportingSubmeshes.push_back( shDim2smIt->second );
else
smWithAlgoSupportingSubmeshes.push_front( shDim2smIt->second );
shDim2sm.clear();
}
// add smToCompute to shDim2sm map
if ( algoShape.IsSame( aMesh.GetShapeToMesh() ))
{
aShapeDim = globalAlgoDim; // to compute last
}
else
{
aShapeDim = GetShapeDim( algoShape );
if ( algoShape.ShapeType() == TopAbs_COMPOUND )
{
TopoDS_Iterator it( algoShape );
aShapeDim += GetShapeDim( it.Value() );
}
}
shDim2sm.insert( make_pair( aShapeDim, smToCompute ));
}
else
@ -248,6 +260,9 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
}
// reload sub-meshes from shDim2sm into smWithAlgoSupportingSubmeshes
for ( shDim2smIt = shDim2sm.rbegin(); shDim2smIt != shDim2sm.rend(); ++shDim2smIt )
if ( shDim2smIt->first == globalAlgoDim )
smWithAlgoSupportingSubmeshes.push_back( shDim2smIt->second );
else
smWithAlgoSupportingSubmeshes.push_front( shDim2smIt->second );
// ------------------------------------------------------------
@ -289,7 +304,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape ));
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh.GetShapeToMesh() ));
if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) {
SMESH_Hypothesis::Hypothesis_Status status;
@ -501,7 +516,7 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape ));
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh.GetShapeToMesh() ));
if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) {
SMESH_Hypothesis::Hypothesis_Status status;

View File

@ -129,6 +129,9 @@ bool SMESH_HypoFilter::IsAssignedToPredicate::IsOk(const SMESH_Hypothesis* aHyp,
bool SMESH_HypoFilter::IsMoreLocalThanPredicate::IsOk(const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& aShape) const
{
if ( aShape.IsSame( _shapeToMesh ))
return false; // aHyp is global
if ( SMESH_MesherHelper::IsSubShape( aShape, /*mainShape=*/_shape ))
return true;
@ -293,9 +296,10 @@ SMESH_HypoPredicate* SMESH_HypoFilter::IsApplicableTo(const TopoDS_Shape& theSha
//purpose :
//=======================================================================
SMESH_HypoPredicate* SMESH_HypoFilter::IsMoreLocalThan(const TopoDS_Shape& theShape)
SMESH_HypoPredicate* SMESH_HypoFilter::IsMoreLocalThan(const TopoDS_Shape& theShape,
const TopoDS_Shape& theShapeToMesh)
{
return new IsMoreLocalThanPredicate( theShape );
return new IsMoreLocalThanPredicate( theShape, theShapeToMesh);
}
//=======================================================================

View File

@ -72,7 +72,8 @@ class SMESH_EXPORT SMESH_HypoFilter: public SMESH_HypoPredicate
static SMESH_HypoPredicate* IsAssignedTo(const TopoDS_Shape& theShape);
static SMESH_HypoPredicate* Is(const SMESH_Hypothesis* theHypo);
static SMESH_HypoPredicate* IsGlobal(const TopoDS_Shape& theMainShape);
static SMESH_HypoPredicate* IsMoreLocalThan(const TopoDS_Shape& theShape);
static SMESH_HypoPredicate* IsMoreLocalThan(const TopoDS_Shape& theShape,
const TopoDS_Shape& theShapeToMesh);
static SMESH_HypoPredicate* HasName(const std::string & theName);
static SMESH_HypoPredicate* HasDim(const int theDim);
static SMESH_HypoPredicate* HasType(const int theHypType);
@ -169,8 +170,10 @@ class SMESH_EXPORT SMESH_HypoFilter: public SMESH_HypoPredicate
};
struct IsMoreLocalThanPredicate : public SMESH_HypoPredicate {
TopoDS_Shape _shape;
IsMoreLocalThanPredicate( const TopoDS_Shape& shape ):_shape(shape){}
TopoDS_Shape _shape, _shapeToMesh;
IsMoreLocalThanPredicate( const TopoDS_Shape& shape,
const TopoDS_Shape& shapeToMesh )
:_shape(shape),_shapeToMesh(shapeToMesh){}
bool IsOk(const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& aShape) const;
};

View File

@ -1754,6 +1754,9 @@ SMESH_Group* SMESH_Mesh::ConvertToStandalone ( int theGroupID )
while ( anItr->more() )
aNewGrpDS->Add( (anItr->next())->GetID() );
// set color
aNewGrpDS->SetColor( anOldGrpDS->GetColor() );
// remove old group
delete anOldGrp;

View File

@ -90,7 +90,7 @@
#include <gp_XY.hxx>
#include <gp_XYZ.hxx>
#include <math.h>
#include <cmath>
#include <map>
#include <set>

View File

@ -895,7 +895,8 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
//=======================================================================
//function : GetMediumPos
//purpose : Return index and type of the shape to set a medium node on
//purpose : Return index and type of the shape (EDGE or FACE only) to
// set a medium node on
//=======================================================================
std::pair<int, TopAbs_ShapeEnum> SMESH_MesherHelper::GetMediumPos(const SMDS_MeshNode* n1,
@ -910,42 +911,40 @@ std::pair<int, TopAbs_ShapeEnum> SMESH_MesherHelper::GetMediumPos(const SMDS_Mes
shapeType = myShape.ShapeType();
shapeID = myShapeID;
}
else
else if ( n1->getshapeId() == n2->getshapeId() )
{
const SMDS_PositionPtr Pos1 = n1->GetPosition();
const SMDS_PositionPtr Pos2 = n2->GetPosition();
if( Pos1->GetTypeOfPosition()==SMDS_TOP_FACE )
{
shapeType = TopAbs_FACE;
shapeID = n1->getshapeId();
}
else if( Pos2->GetTypeOfPosition()==SMDS_TOP_FACE )
{
shapeType = TopAbs_FACE;
shapeID = n2->getshapeId();
}
else if (Pos1->GetTypeOfPosition()==SMDS_TOP_3DSPACE ||
Pos2->GetTypeOfPosition()==SMDS_TOP_3DSPACE )
{
}
else if ( Pos1->GetTypeOfPosition()==SMDS_TOP_EDGE &&
Pos2->GetTypeOfPosition()==SMDS_TOP_EDGE )
{
if ( n1->getshapeId() == n2->getshapeId() )
{
shapeType = TopAbs_EDGE;
shapeID = n1->getshapeId();
shape = GetSubShapeByNode( n1, GetMeshDS() );
}
else
{
const SMDS_TypeOfPosition Pos1 = n1->GetPosition()->GetTypeOfPosition();
const SMDS_TypeOfPosition Pos2 = n2->GetPosition()->GetTypeOfPosition();
if ( Pos1 == SMDS_TOP_3DSPACE || Pos2 == SMDS_TOP_3DSPACE )
{
}
else if ( Pos1 == SMDS_TOP_FACE || Pos2 == SMDS_TOP_FACE )
{
if ( Pos1 != SMDS_TOP_FACE || Pos2 != SMDS_TOP_FACE )
{
if ( Pos1 != SMDS_TOP_FACE ) std::swap( n1,n2 );
TopoDS_Shape F = GetSubShapeByNode( n1, GetMeshDS() );
TopoDS_Shape S = GetSubShapeByNode( n2, GetMeshDS() );
if ( IsSubShape( S, F ))
{
shapeType = TopAbs_FACE;
shapeID = n1->getshapeId();
}
}
}
else if ( Pos1 == SMDS_TOP_EDGE && Pos2 == SMDS_TOP_EDGE )
{
TopoDS_Shape E1 = GetSubShapeByNode( n1, GetMeshDS() );
TopoDS_Shape E2 = GetSubShapeByNode( n2, GetMeshDS() );
shape = GetCommonAncestor( E1, E2, *myMesh, TopAbs_FACE );
}
}
else if ( Pos1->GetTypeOfPosition()==SMDS_TOP_VERTEX &&
Pos2->GetTypeOfPosition()==SMDS_TOP_VERTEX )
else if ( Pos1 == SMDS_TOP_VERTEX && Pos2 == SMDS_TOP_VERTEX )
{
TopoDS_Shape V1 = GetSubShapeByNode( n1, GetMeshDS() );
TopoDS_Shape V2 = GetSubShapeByNode( n2, GetMeshDS() );
@ -954,7 +953,7 @@ std::pair<int, TopAbs_ShapeEnum> SMESH_MesherHelper::GetMediumPos(const SMDS_Mes
}
else // VERTEX and EDGE
{
if ( Pos1->GetTypeOfPosition()!=SMDS_TOP_VERTEX ) std::swap( n1,n2 );
if ( Pos1 != SMDS_TOP_VERTEX ) std::swap( n1,n2 );
TopoDS_Shape V = GetSubShapeByNode( n1, GetMeshDS() );
TopoDS_Shape E = GetSubShapeByNode( n2, GetMeshDS() );
if ( IsSubShape( V, E ))
@ -963,8 +962,10 @@ std::pair<int, TopAbs_ShapeEnum> SMESH_MesherHelper::GetMediumPos(const SMDS_Mes
shape = GetCommonAncestor( V, E, *myMesh, TopAbs_FACE );
}
}
if ( !shape.IsNull() )
{
if ( shapeID < 1 )
shapeID = GetMeshDS()->ShapeToIndex( shape );
shapeType = shape.ShapeType();
}
@ -999,9 +1000,6 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1,
// get type of shape for the new medium node
int faceID = -1, edgeID = -1;
const SMDS_PositionPtr Pos1 = n1->GetPosition();
const SMDS_PositionPtr Pos2 = n2->GetPosition();
TopoDS_Edge E; double u [2];
TopoDS_Face F; gp_XY uv[2];
bool uvOK[2] = { false, false };
@ -1017,9 +1015,10 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1,
}
else if ( pos.second == TopAbs_EDGE )
{
if ( Pos1->GetTypeOfPosition()==SMDS_TOP_EDGE &&
Pos2->GetTypeOfPosition()==SMDS_TOP_EDGE &&
n1->getshapeId() != n2->getshapeId() ) // issue 0021006
if ( n1->GetPosition()->GetTypeOfPosition()==SMDS_TOP_EDGE &&
n2->GetPosition()->GetTypeOfPosition()==SMDS_TOP_EDGE &&
n1->getshapeId() != n2->getshapeId() )
// issue 0021006
return getMediumNodeOnComposedWire(n1,n2,force3d);
E = TopoDS::Edge(meshDS->IndexToShape( edgeID = pos.first ));

View File

@ -461,7 +461,7 @@ public:
const SMDS_MeshNode* n2,
const bool force3d);
/*!
* \brief Return index and type of the shape to set a medium node on
* \brief Return index and type of the shape (EDGE or FACE only) to set a medium node on
*/
std::pair<int, TopAbs_ShapeEnum> GetMediumPos(const SMDS_MeshNode* n1,
const SMDS_MeshNode* n2);

View File

@ -2073,10 +2073,16 @@ void SMESH_subMesh::NotifyListenersOnEvent( const int event,
{
map< EventListener*, EventListenerData* >::iterator l_d = myEventListeners.begin();
for ( ; l_d != myEventListeners.end(); ++l_d )
if ( (*l_d).first->myBusySM.insert( this ).second )
{
l_d->first->ProcessEvent( event, eventType, this, l_d->second, hyp );
l_d->first->myBusySM.erase( this );
std::pair< EventListener*, EventListenerData* > li_da = *l_d; /* copy to enable removal
of a listener from
myEventListeners by
its ProcessEvent() */
if ( li_da.first->myBusySM.insert( this ).second )
{
li_da.first->ProcessEvent( event, eventType, this, li_da.second, hyp );
li_da.first->myBusySM.erase( this );
}
}
}

View File

@ -23,6 +23,9 @@
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
#include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
#ifdef HAVE_FINITE
#undef HAVE_FINITE // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined
#endif
#include "Python.h"
// SMESH includes
#include "SMESHGUI.h"
@ -49,7 +52,6 @@
#include "SMESHGUI_Hypotheses.h"
#include "SMESHGUI_Make2DFrom3DOp.h"
#include "SMESHGUI_MakeNodeAtPointDlg.h"
//#include "SMESHGUI_MeshInfosDlg.h"
#include "SMESHGUI_Measurements.h"
#include "SMESHGUI_MeshInfo.h"
#include "SMESHGUI_MeshOp.h"
@ -68,12 +70,10 @@
#include "SMESHGUI_SewingDlg.h"
#include "SMESHGUI_SingleEditDlg.h"
#include "SMESHGUI_SmoothingDlg.h"
//#include "SMESHGUI_StandardMeshInfosDlg.h"
#include "SMESHGUI_SymmetryDlg.h"
#include "SMESHGUI_TranslationDlg.h"
#include "SMESHGUI_ScaleDlg.h"
#include "SMESHGUI_TransparencyDlg.h"
//#include "SMESHGUI_WhatIsDlg.h"
#include "SMESHGUI_DuplicateNodesDlg.h"
#include "SMESHGUI_CopyMeshDlg.h"
@ -2736,38 +2736,6 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}
break;
}
/*
case 902: // STANDARD MESH INFOS
{
EmitSignalDeactivateDialog();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if( aSel )
aSel->selectedObjects( selected );
if ( selected.Extent() > 1 ) { // a dlg for each IO
SALOME_ListIO IOs;
SALOME_ListIteratorOfListIO It (selected);
for ( ; It.More(); It.Next() ) {
IOs.Clear();
IOs.Append( It.Value() );
aSel->setSelectedObjects( IOs );
( new SMESHGUI_StandardMeshInfosDlg( this ) )->show();
}
// restore selection
aSel->setSelectedObjects( selected );
}
else
( new SMESHGUI_StandardMeshInfosDlg( this ) )->show();
break;
}
case 903: // WHAT IS
{
EmitSignalDeactivateDialog();
( new SMESHGUI_WhatIsDlg( this ) )->show();
break;
}
*/
case 904: // FIND ELEM
{

View File

@ -243,7 +243,8 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
int nbNodes )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myBusy ( false )
{
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
@ -371,6 +372,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups );
ComboBox_GroupName = new QComboBox( GroupGroups );
ComboBox_GroupName->setEditable( true );
ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert );
GroupGroupsLayout->addWidget( TextLabel_GroupName );
GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
@ -496,7 +498,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
idx = i;
}
if ( idx > 0 ) {
if ( idx > 0 && idx < myGroups.count() ) {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
if ( !aGeomGroup->_is_nil() ) {
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),

View File

@ -359,8 +359,6 @@ static int LastPentahedronIds[] = {1,2,0,4,5,3,3,4,5};
static int FirstHexahedronIds[] = {0,1,2,3,4,5,6,7,0,1,2,3};
static int LastHexahedronIds[] = {1,2,3,0,5,6,7,4,4,5,6,7};
/*!
\class BusyLocker
\brief Simple 'busy state' flag locker.
@ -419,7 +417,8 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myType( theType ),
myBusy( false )
myBusy( false ),
myIsEditCorners( false )
{
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
@ -518,6 +517,7 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM
TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups );
ComboBox_GroupName = new QComboBox( GroupGroups );
ComboBox_GroupName->setEditable( true );
ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert );
GroupGroupsLayout->addWidget( TextLabel_GroupName );
GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
@ -733,7 +733,7 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply()
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
idx = i;
}
if ( idx > 0 ) {
if ( idx > 0 && idx < myGroups.count() ) {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
if ( !aGeomGroup->_is_nil() ) {
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),

View File

@ -259,6 +259,7 @@ SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI
TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups );
ComboBox_GroupName = new QComboBox( GroupGroups );
ComboBox_GroupName->setEditable( true );
ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert );
GroupGroupsLayout->addWidget( TextLabel_GroupName );
GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
@ -462,7 +463,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply()
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
idx = i;
}
if ( idx > 0 ) {
if ( idx > 0 && idx < myGroups.count() ) {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
if ( !aGeomGroup->_is_nil() ) {
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),

View File

@ -1,324 +0,0 @@
// Copyright (C) 2007-2011 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_MeshInfosDlg.cxx
// Author : Nicolas BARBEROU
// SMESH includes
//
#include "SMESHGUI_MeshInfosDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_MeshInfosBox.h"
// SALOME GUI includes
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_OverrideCursor.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_Application.h>
#include <SALOME_ListIO.hxx>
// SALOME KERNEL includes
#include <SALOMEDSClient_Study.hxx>
// Qt includes
#include <QGroupBox>
#include <QLabel>
#include <QFrame>
#include <QStackedWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QPushButton>
#include <QKeyEvent>
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Group)
#define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
#define SPACING 6
#define MARGIN 11
//=================================================================================
// function : SMESHGUI_MeshInfosDlg()
// purpose : Constructor
//=================================================================================
SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule):
QDialog(SMESH::GetDesktop(theModule)),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
mySMESHGUI(theModule)
{
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
setWindowTitle(tr("SMESH_MESHINFO_TITLE"));
setSizeGripEnabled(true);
myStartSelection = true;
myIsActiveWindow = true;
QVBoxLayout* aTopLayout = new QVBoxLayout(this);
aTopLayout->setSpacing(SPACING); aTopLayout->setMargin(MARGIN);
// select button & label
QPixmap image0(SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH",tr("ICON_SELECT")));
mySelectBtn = new QPushButton(this);
mySelectBtn->setIcon(image0);
mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
mySelectLab = new QLabel(this);
mySelectLab->setAlignment(Qt::AlignCenter);
QFont fnt = mySelectLab->font(); fnt.setBold(true);
mySelectLab->setFont(fnt);
QHBoxLayout* aSelectLayout = new QHBoxLayout;
aSelectLayout->setMargin(0); aSelectLayout->setSpacing(0);
aSelectLayout->addWidget(mySelectBtn);
aSelectLayout->addWidget(mySelectLab);
// top widget stack
myWGStack = new QStackedWidget(this);
// no valid selection
QWidget* myBadWidget = new QWidget(myWGStack);
QVBoxLayout* aBadLayout = new QVBoxLayout(myBadWidget);
QLabel* myBadLab = new QLabel(tr("SMESH_BAD_SELECTION"), myBadWidget);
myBadLab->setAlignment(Qt::AlignCenter);
myBadLab->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
aBadLayout->addWidget(myBadLab);
myWGStack->addWidget(myBadWidget);
// mesh
myMeshWidget = new QWidget(myWGStack);
QGridLayout* aMeshLayout = new QGridLayout(myMeshWidget);
aMeshLayout->setSpacing(SPACING); aMeshLayout->setMargin(0);
myWGStack->addWidget(myMeshWidget);
// --> name
QLabel* myMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myMeshWidget);
myMeshName = new QLabel(myMeshWidget);
myMeshName->setMinimumWidth(100);
QFrame* line1 = new QFrame(myMeshWidget);
line1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
myMeshInfoBox = new SMESHGUI_MeshInfosBox(true, myMeshWidget);
aMeshLayout->addWidget(myMeshNameLab, 0, 0);
aMeshLayout->addWidget(myMeshName, 0, 1);
aMeshLayout->addWidget(line1, 1, 0, 1, 2);
aMeshLayout->addWidget(myMeshInfoBox, 2, 0, 1, 2);
aMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 3, 0);
// buttons
myButtonsGroup = new QGroupBox(this);
QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup);
myButtonsGroupLayout->setSpacing(SPACING); myButtonsGroupLayout->setMargin(MARGIN);
// buttons --> OK and Help buttons
myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), myButtonsGroup);
myOkBtn->setAutoDefault(true);
myOkBtn->setDefault(true);
myOkBtn->setFocus();
myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP" ), myButtonsGroup);
myHelpBtn->setAutoDefault(true);
myButtonsGroupLayout->addWidget(myOkBtn);
myButtonsGroupLayout->addSpacing(10);
myButtonsGroupLayout->addStretch();
myButtonsGroupLayout->addWidget(myHelpBtn);
aTopLayout->addLayout(aSelectLayout);
aTopLayout->addWidget(myWGStack);
aTopLayout->addWidget(myButtonsGroup);
mySMESHGUI->SetActiveDialogBox(this);
// connect signals
connect(myOkBtn, SIGNAL(clicked()), this, SLOT(close()));
connect( myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
connect(mySelectBtn, SIGNAL(clicked()), this, SLOT(onStartSelection()));
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
// init dialog with current selection
onSelectionChanged();
myHelpFileName = "mesh_infos_page.html#advanced_mesh_infos_anchor";
}
//=================================================================================
// function : ~SMESHGUI_MeshInfosDlg()
// purpose : Destructor
//=================================================================================
SMESHGUI_MeshInfosDlg::~SMESHGUI_MeshInfosDlg()
{
}
//=================================================================================
// function : DumpMeshInfos()
// purpose :
//=================================================================================
void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
{
SUIT_OverrideCursor wc;
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList);
int nbSel = aList.Extent();
if (nbSel == 1) {
myStartSelection = false;
mySelectLab->setText("");
Handle(SALOME_InteractiveObject) IObject = aList.First();
_PTR(SObject) aSO = SMESH::GetActiveStudyDocument()->FindObjectID(IObject->getEntry());
if (aSO) {
//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::long_array_var aMeshInfo = anIDSource->GetMeshInfo();
myMeshInfoBox->SetMeshInfo( aMeshInfo );
return;
}
}
}
}
myWGStack->setCurrentIndex(0);
setWindowTitle(tr("SMESH_MESHINFO_TITLE"));
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void SMESHGUI_MeshInfosDlg::onSelectionChanged()
{
if (myStartSelection)
DumpMeshInfos();
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void SMESHGUI_MeshInfosDlg::closeEvent(QCloseEvent* e)
{
mySMESHGUI->ResetState();
QDialog::closeEvent(e);
}
//=================================================================================
// function : windowActivationChange()
// purpose : called when window is activated/deactivated
//=================================================================================
void SMESHGUI_MeshInfosDlg::windowActivationChange(bool oldActive)
{
QDialog::windowActivationChange(oldActive);
if (isActiveWindow() && myIsActiveWindow != isActiveWindow())
ActivateThisDialog();
myIsActiveWindow = isActiveWindow();
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void SMESHGUI_MeshInfosDlg::DeactivateActiveDialog()
{
disconnect(mySelectionMgr, 0, this, 0);
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void SMESHGUI_MeshInfosDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate any active dialog */
mySMESHGUI->EmitSignalDeactivateDialog();
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
}
//=================================================================================
// function : onStartSelection()
// purpose : starts selection
//=================================================================================
void SMESHGUI_MeshInfosDlg::onStartSelection()
{
myStartSelection = true;
onSelectionChanged();
myStartSelection = true;
mySelectLab->setText(tr("INF_SELECT_OBJECT"));
}
//=================================================================================
// function : onHelp()
// purpose :
//=================================================================================
void SMESHGUI_MeshInfosDlg::onHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
QString platform;
#ifdef WIN32
platform = "winapplication";
#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));
}
}
//=================================================================================
// function : keyPressEvent()
// purpose :
//=================================================================================
void SMESHGUI_MeshInfosDlg::keyPressEvent( QKeyEvent* e )
{
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
if ( e->key() == Qt::Key_F1 ) {
e->accept();
onHelp();
}
}

View File

@ -1,88 +0,0 @@
// Copyright (C) 2007-2011 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_MeshInfosDlg.h
// Author : Nicolas BARBEROU
//
#ifndef SMESHGUI_MESHINFOSDLG_H
#define SMESHGUI_MESHINFOSDLG_H
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
// Qt includes
#include <QDialog>
class QGroupBox;
class QLabel;
class QPushButton;
class QStackedWidget;
class LightApp_SelectionMgr;
class SMESHGUI;
class SMESHGUI_MeshInfosBox;
class SMESHGUI_EXPORT SMESHGUI_MeshInfosDlg : public QDialog
{
Q_OBJECT
public:
SMESHGUI_MeshInfosDlg( SMESHGUI* );
~SMESHGUI_MeshInfosDlg();
protected:
void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* );
void windowActivationChange( bool );
void DumpMeshInfos();
private slots:
void onSelectionChanged();
void DeactivateActiveDialog();
void ActivateThisDialog();
void onStartSelection();
void onHelp();
private:
SMESHGUI* mySMESHGUI;
LightApp_SelectionMgr* mySelectionMgr;
bool myStartSelection;
bool myIsActiveWindow;
QPushButton* mySelectBtn;
QLabel* mySelectLab;
QStackedWidget* myWGStack;
QWidget* myMeshWidget;
QLabel* myMeshName;
SMESHGUI_MeshInfosBox* myMeshInfoBox;
QGroupBox* myButtonsGroup;
QPushButton* myOkBtn;
QPushButton* myHelpBtn;
QString myHelpFileName;
};
#endif // SMESHGUI_MESHINFOSDLG_H

View File

@ -1,662 +0,0 @@
// Copyright (C) 2007-2011 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_MoveNodesDlg.cxx
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_MoveNodesDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include <SMESH_Actor.h>
#include <SMDS_Mesh.hxx>
// SALOME GUI includes
#include <LightApp_SelectionMgr.h>
#include <LightApp_Application.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
#include <VTKViewer_CellLocationsArray.h>
// OCCT includes
#include <TColStd_MapOfInteger.hxx>
// VTK includes
#include <vtkIdList.h>
#include <vtkCellArray.h>
#include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
#include <vtkProperty.h>
// Qt includes
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QRadioButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QKeyEvent>
#include <QButtonGroup>
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
#define SPACING 6
#define MARGIN 11
//=================================================================================
// name : SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg
// Purpose :
//=================================================================================
SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg(SMESHGUI* theModule):
QDialog(SMESH::GetDesktop(theModule)),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
mySMESHGUI(theModule)
{
myPreviewActor = 0;
myBusy = false;
setModal(false);
setWindowTitle(tr("CAPTION"));
QVBoxLayout* aDlgLay = new QVBoxLayout(this);
aDlgLay->setSpacing(SPACING);
aDlgLay->setMargin(MARGIN);
QWidget* aMainFrame = createMainFrame (this);
QWidget* aBtnFrame = createButtonFrame(this);
aDlgLay->addWidget(aMainFrame);
aDlgLay->addWidget(aBtnFrame);
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
myHelpFileName = "moving_nodes_page.html";
Init();
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::createButtonFrame
// Purpose : Create frame containing buttons
//=======================================================================
QWidget* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent)
{
QFrame* aFrame = new QFrame(theParent);
aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame);
myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame);
QHBoxLayout* aLay = new QHBoxLayout(aFrame);
aLay->setSpacing(SPACING);
aLay->setMargin(MARGIN);
aLay->addWidget(myOkBtn);
aLay->addSpacing(10);
aLay->addWidget(myApplyBtn);
aLay->addSpacing(10);
aLay->addStretch();
aLay->addWidget(myCloseBtn);
aLay->addWidget(myHelpBtn);
connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp()));
return aFrame;
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::createMainFrame
// Purpose : Create frame containing dialog's input fields
//=======================================================================
QWidget* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent)
{
QWidget* aFrame = new QWidget(theParent);
QPixmap iconMoveNode (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE")));
QPixmap iconSelect (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
//------------------------------------------------------------
QGroupBox* aPixGrp = new QGroupBox(tr("MESH_NODE"), aFrame);
QButtonGroup* aBtnGrp = new QButtonGroup(this);
QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp);
aPixGrpLayout->setSpacing(SPACING);
aPixGrpLayout->setMargin(MARGIN);
QRadioButton* aRBut = new QRadioButton(aPixGrp);
aRBut->setIcon(iconMoveNode);
aRBut->setChecked(true);
aPixGrpLayout->addWidget(aRBut);
aBtnGrp->addButton(aRBut, 0);
//------------------------------------------------------------
QGroupBox* anIdGrp = new QGroupBox(tr("SMESH_MOVE"), aFrame);
QHBoxLayout* anIdGrpLayout = new QHBoxLayout(anIdGrp);
anIdGrpLayout->setSpacing(SPACING);
anIdGrpLayout->setMargin(MARGIN);
QLabel* idLabl = new QLabel(tr("NODE_ID"), anIdGrp);
QPushButton* idBtn = new QPushButton(anIdGrp);
idBtn->setIcon(iconSelect);
myId = new QLineEdit(anIdGrp);
myId->setValidator(new SMESHGUI_IdValidator(this, 1));
anIdGrpLayout->addWidget(idLabl);
anIdGrpLayout->addWidget(idBtn);
anIdGrpLayout->addWidget(myId);
//------------------------------------------------------------
QGroupBox* aCoordGrp = new QGroupBox(tr("SMESH_COORDINATES"), aFrame);
QHBoxLayout* aCoordGrpLayout = new QHBoxLayout(aCoordGrp);
aCoordGrpLayout->setSpacing(SPACING);
aCoordGrpLayout->setMargin(MARGIN);
QLabel* aXLabel = new QLabel(tr("SMESH_X"), aCoordGrp);
myX = new SMESHGUI_SpinBox(aCoordGrp);
QLabel* aYLabel = new QLabel(tr("SMESH_Y"), aCoordGrp);
myY = new SMESHGUI_SpinBox(aCoordGrp);
QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp);
myZ = new SMESHGUI_SpinBox(aCoordGrp);
aCoordGrpLayout->addWidget(aXLabel);
aCoordGrpLayout->addWidget(myX);
aCoordGrpLayout->addWidget(aYLabel);
aCoordGrpLayout->addWidget(myY);
aCoordGrpLayout->addWidget(aZLabel);
aCoordGrpLayout->addWidget(myZ);
//------------------------------------------------------------
myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, "length_precision");
myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, "length_precision");
myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, "length_precision");
//------------------------------------------------------------
QVBoxLayout* aLay = new QVBoxLayout(aFrame);
aLay->setMargin(0);
aLay->setMargin(SPACING);
aLay->addWidget(aPixGrp);
aLay->addWidget(anIdGrp);
aLay->addWidget(aCoordGrp);
//------------------------------------------------------------
// connect signale and slots
connect(myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
connect(myY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
connect(myZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
connect(myId, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
return aFrame;
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg
// Purpose :
//=======================================================================
SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg()
{
erasePreview();
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::Init
// Purpose : Init dialog fields
//=======================================================================
void SMESHGUI_MoveNodesDlg::Init()
{
myPreviewActor = 0;
myMeshActor = 0;
myBusy = false;
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
// selection and SMESHGUI
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
reset();
setEnabled(true);
// set selection mode
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(NodeSelection);
onSelectionDone();
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::isValid
// Purpose : Verify validity of entry information
//=======================================================================
bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess)
{
if (myId->text().isEmpty()) {
if (theMess)
SUIT_MessageBox::information(this, tr("SMESH_WARNING"),
tr("NODE_ID_IS_NOT_DEFINED"));
return false;
}
QString msg;
bool ok = true;
ok = myX->isValid( msg, theMess ) && ok;
ok = myY->isValid( msg, theMess ) && ok;
ok = myZ->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 );
}
return false;
}
return true;
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::reset
// Purpose : Reset the dialog state
//=======================================================================
void SMESHGUI_MoveNodesDlg::reset()
{
myId->clear();
myX->SetValue(0);
myY->SetValue(0);
myZ->SetValue(0);
redisplayPreview();
updateButtons();
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::onApply
// Purpose : SLOT called when "Apply" button pressed.
//=======================================================================
bool SMESHGUI_MoveNodesDlg::onApply()
{
if (mySMESHGUI->isActiveStudyLocked())
return false;
if (!isValid(true))
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"));
return false;
}
SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
if (aMeshEditor->_is_nil())
return false;
int anId = myId->text().toInt();
bool aResult = false;
try {
aResult = aMeshEditor->MoveNode(anId, myX->GetValue(), myY->GetValue(), myZ->GetValue());
QStringList aParameters;
aParameters << myX->text();
aParameters << myY->text();
aParameters << myZ->text();
aMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
} catch (...) {
}
if (aResult) {
SALOME_ListIO aList;
aList.Append(myMeshActor->getIO());
mySelectionMgr->setSelectedObjects(aList,false);
SMESH::UpdateView();
SMESHGUI::Modified();
reset();
}
return aResult;
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::onOk
// Purpose : SLOT called when "Ok" button pressed.
//=======================================================================
void SMESHGUI_MoveNodesDlg::onOk()
{
if (onApply())
onClose();
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::onClose
// Purpose : SLOT called when "Close" button pressed. Close dialog
//=======================================================================
void SMESHGUI_MoveNodesDlg::onClose()
{
//mySelectionMgr->clearSelected();
SMESH::SetPointRepresentation(false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0);
disconnect(mySMESHGUI, 0, this, 0);
erasePreview();
mySMESHGUI->ResetState();
reject();
}
//=================================================================================
// function : onHelp()
// purpose :
//=================================================================================
void SMESHGUI_MoveNodesDlg::onHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
QString platform;
#ifdef WIN32
platform = "winapplication";
#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));
}
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::onTextChange
// Purpose :
//=======================================================================
void SMESHGUI_MoveNodesDlg::onTextChange (const QString& theNewText)
{
if (myBusy) return;
myOkBtn->setEnabled(false);
myApplyBtn->setEnabled(false);
erasePreview();
// select entered node
if(myMeshActor){
if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()){
myBusy = true;
Handle(SALOME_InteractiveObject) anIO = myMeshActor->getIO();
SALOME_ListIO aList;
aList.Append(anIO);
mySelectionMgr->setSelectedObjects(aList,false);
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();
}
}
}
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::onSelectionDone
// Purpose : SLOT called when selection changed
//=======================================================================
void SMESHGUI_MoveNodesDlg::onSelectionDone()
{
if (myBusy) return;
myMeshActor = 0;
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
if (aList.Extent() == 1) {
Handle(SALOME_InteractiveObject) anIO = aList.First();
myMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
if(myMeshActor){
QString aText;
if (SMESH::GetNameOfSelectedNodes(mySelector,anIO,aText) == 1) {
if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()) {
if(const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) {
myBusy = true;
myId->setText(aText);
myX->SetValue(aNode->X());
myY->SetValue(aNode->Y());
myZ->SetValue(aNode->Z());
myBusy = false;
erasePreview(); // avoid overlapping of a selection and a preview
updateButtons();
return;
}
}
}
}
}
reset();
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::onDeactivate
// Purpose : SLOT called when dialog must be deativated
//=======================================================================
void SMESHGUI_MoveNodesDlg::onDeactivate()
{
setEnabled(false);
erasePreview();
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::enterEvent
// Purpose : Event filter
//=======================================================================
void SMESHGUI_MoveNodesDlg::enterEvent (QEvent*)
{
if (!isEnabled()) {
mySMESHGUI->EmitSignalDeactivateDialog();
// set selection mode
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(NodeSelection);
redisplayPreview();
setEnabled(true);
}
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::closeEvent
// Purpose :
//=======================================================================
void SMESHGUI_MoveNodesDlg::closeEvent (QCloseEvent*)
{
onClose();
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->Repaint();
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::hideEvent
// Purpose : may be caused by ESC key
//=======================================================================
void SMESHGUI_MoveNodesDlg::hideEvent (QHideEvent*)
{
if (!isMinimized())
onClose();
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::updateButtons
// Purpose : Update buttons state
//=======================================================================
void SMESHGUI_MoveNodesDlg::updateButtons()
{
bool isEnabled = isValid(false);
myOkBtn->setEnabled(isEnabled);
myApplyBtn->setEnabled(isEnabled);
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::erasePreview
// Purpose : Erase preview
//=======================================================================
void SMESHGUI_MoveNodesDlg::erasePreview()
{
if (myPreviewActor == 0)
return;
SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
if (aViewWindow)
aViewWindow->RemoveActor(myPreviewActor);
myPreviewActor->Delete();
myPreviewActor = 0;
if (aViewWindow)
aViewWindow->Repaint();
}
//=======================================================================
// name : SMESHGUI_MoveNodesDlg::redisplayPreview
// Purpose : Redisplay preview
//=======================================================================
void SMESHGUI_MoveNodesDlg::redisplayPreview()
{
if (myBusy)
return;
if (myPreviewActor != 0)
erasePreview();
if (!isValid(false))
return;
vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
vtkPoints* aPoints = vtkPoints::New();
aPoints->SetNumberOfPoints(1);
aPoints->SetPoint(0, myX->GetValue(), myY->GetValue(), myZ->GetValue());
// Create cells
vtkIdList *anIdList = vtkIdList::New();
anIdList->SetNumberOfIds(1);
vtkCellArray *aCells = vtkCellArray::New();
aCells->Allocate(2, 0);
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
aCellTypesArray->SetNumberOfComponents(1);
aCellTypesArray->Allocate(1);
anIdList->SetId(0, 0);
aCells->InsertNextCell(anIdList);
aCellTypesArray->InsertNextValue(VTK_VERTEX);
anIdList->Delete();
VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
aCellLocationsArray->SetNumberOfComponents(1);
aCellLocationsArray->SetNumberOfTuples(1);
aCells->InitTraversal();
vtkIdType npts;
aCellLocationsArray->SetValue(0, aCells->GetTraversalLocation(npts));
aGrid->SetPoints(aPoints);
aPoints->Delete();
aGrid->SetCells(aCellTypesArray,aCellLocationsArray,aCells);
aCellLocationsArray->Delete();
aCellTypesArray->Delete();
aCells->Delete();
// Create and display actor
vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
aMapper->SetInput(aGrid);
aGrid->Delete();
myPreviewActor = SALOME_Actor::New();
myPreviewActor->PickableOff();
myPreviewActor->SetMapper(aMapper);
aMapper->Delete();
vtkProperty* aProp = vtkProperty::New();
aProp->SetRepresentationToWireframe();
aProp->SetColor(250, 0, 250);
aProp->SetPointSize(5);
myPreviewActor->SetProperty(aProp);
aProp->Delete();
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
{
aViewWindow->AddActor(myPreviewActor);
aViewWindow->Repaint();
}
}
//=================================================================================
// function : keyPressEvent()
// purpose :
//=================================================================================
void SMESHGUI_MoveNodesDlg::keyPressEvent( QKeyEvent* e )
{
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
if ( e->key() == Qt::Key_F1 ) {
e->accept();
onHelp();
}
}

View File

@ -1,106 +0,0 @@
// Copyright (C) 2007-2011 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_MoveNodesDlg.h
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
//
#ifndef SMESHGUI_MOVENODESDLG_H
#define SMESHGUI_MOVENODESDLG_H
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
// Qt includes
#include <QDialog>
class QLineEdit;
class QPushButton;
class SMESHGUI;
class SMESH_Actor;
class SMESHGUI_SpinBox;
class SALOME_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
//=================================================================================
// class : SMESHGUI_MoveNodesDlg
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_MoveNodesDlg : public QDialog
{
Q_OBJECT
public:
SMESHGUI_MoveNodesDlg( SMESHGUI* );
virtual ~SMESHGUI_MoveNodesDlg();
void Init();
private slots:
void onOk();
bool onApply();
void onClose();
void onHelp();
void onDeactivate();
void onSelectionDone();
void redisplayPreview();
void onTextChange( const QString& );
private:
void closeEvent( QCloseEvent* );
void enterEvent( QEvent* );
void hideEvent( QHideEvent* );
void keyPressEvent( QKeyEvent* );
void erasePreview();
QWidget* createButtonFrame( QWidget* );
QWidget* createMainFrame ( QWidget* );
bool isValid( const bool );
void reset();
void updateButtons();
private:
QPushButton* myOkBtn;
QPushButton* myApplyBtn;
QPushButton* myCloseBtn;
QPushButton* myHelpBtn;
QLineEdit* myId;
SMESHGUI_SpinBox* myX;
SMESHGUI_SpinBox* myY;
SMESHGUI_SpinBox* myZ;
LightApp_SelectionMgr* mySelectionMgr;
SVTK_Selector* mySelector;
SMESHGUI* mySMESHGUI;
SALOME_Actor* myPreviewActor;
SMESH_Actor* myMeshActor;
bool myBusy;
QString myHelpFileName;
};
#endif // SMESHGUI_MOVENODESDLG_H

View File

@ -297,6 +297,7 @@ SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ):
TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups );
ComboBox_GroupName = new QComboBox( GroupGroups );
ComboBox_GroupName->setEditable( true );
ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert );
GroupGroupsLayout->addWidget( TextLabel_GroupName );
GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
@ -456,7 +457,7 @@ bool SMESHGUI_NodesDlg::ClickOnApply()
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
idx = i;
}
if ( idx > 0 ) {
if ( idx > 0 && idx < myGroups.count() ) {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
if ( !aGeomGroup->_is_nil() ) {
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),

View File

@ -1,473 +0,0 @@
// Copyright (C) 2007-2011 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_StandardMeshInfosDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_StandardMeshInfosDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_MeshUtils.h"
#include <SMESH_TypeFilter.hxx>
// SALOME KERNEL includes
#include <SALOMEDSClient_Study.hxx>
#include <SALOMEDSClient_SObject.hxx>
// SALOME GUI includes
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_OverrideCursor.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SALOME_ListIO.hxx>
// Qt includes
#include <QGroupBox>
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLineEdit>
#include <QTextBrowser>
#include <QPushButton>
#include <QKeyEvent>
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Group)
#define SPACING 6
#define MARGIN 11
//=================================================================================
/*!
* SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg
*
* Constructor
*/
//=================================================================================
SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
setModal(false);
setAttribute(Qt::WA_DeleteOnClose, true);
setWindowTitle(tr("SMESH_STANDARD_MESHINFO_TITLE"));
setSizeGripEnabled(true);
myStartSelection = true;
myIsActiveWindow = true;
// dialog layout
QVBoxLayout* aDlgLayout = new QVBoxLayout(this);
aDlgLayout->setSpacing(SPACING);
aDlgLayout->setMargin(MARGIN);
// mesh group box
myMeshGroup = new QGroupBox(tr("SMESH_MESH"), this);
QHBoxLayout* myMeshGroupLayout = new QHBoxLayout(myMeshGroup);
myMeshGroupLayout->setSpacing(SPACING);
myMeshGroupLayout->setMargin(MARGIN);
// select button, label and line edit with mesh name
myNameLab = new QLabel(tr("SMESH_NAME"), myMeshGroup);
myMeshGroupLayout->addWidget(myNameLab);
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_SELECT")));
mySelectBtn = new QPushButton(myMeshGroup);
mySelectBtn->setIcon(image0);
myMeshGroupLayout->addWidget(mySelectBtn);
myMeshLine = new QLineEdit(myMeshGroup);
myMeshGroupLayout->addWidget(myMeshLine);
aDlgLayout->addWidget(myMeshGroup);
// information group box
myInfoGroup = new QGroupBox(tr("SMESH_INFORMATION"), this);
QVBoxLayout* myInfoGroupLayout = new QVBoxLayout(myInfoGroup);
myInfoGroupLayout->setSpacing(SPACING);
myInfoGroupLayout->setMargin(MARGIN);
// information text browser
myInfo = new QTextBrowser(myInfoGroup);
myInfo->setMinimumSize(200, 150);
myInfoGroupLayout->addWidget(myInfo);
aDlgLayout->addWidget(myInfoGroup);
// buttons group
myButtonsGroup = new QGroupBox(this);
QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup);
myButtonsGroupLayout->setSpacing(SPACING);
myButtonsGroupLayout->setMargin(MARGIN);
// buttons --> OK and Help buttons
myOkBtn = new QPushButton(tr("SMESH_BUT_OK"), myButtonsGroup);
myOkBtn->setAutoDefault(true); myOkBtn->setDefault(true);
myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), myButtonsGroup);
myHelpBtn->setAutoDefault(true);
myButtonsGroupLayout->addWidget(myOkBtn);
myButtonsGroupLayout->addSpacing(10);
myButtonsGroupLayout->addStretch();
myButtonsGroupLayout->addWidget(myHelpBtn);
aDlgLayout->addWidget(myButtonsGroup);
mySMESHGUI->SetActiveDialogBox(this);
// connect signals
connect( myOkBtn, SIGNAL(clicked()), this, SLOT(close()));
connect( myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
connect( mySelectBtn, SIGNAL(clicked()), this, SLOT(onStartSelection()));
connect( mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
connect( mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect( mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
// init dialog with current selection
myMeshFilter = new SMESH_TypeFilter (MESH);
mySelectionMgr->installFilter(myMeshFilter);
onSelectionChanged();
myHelpFileName = "mesh_infos_page.html#standard_mesh_infos_anchor";
}
//=================================================================================
/*!
* SMESHGUI_StandardMeshInfosDlg::~SMESHGUI_StandardMeshInfosDlg
*
* Destructor
*/
//=================================================================================
SMESHGUI_StandardMeshInfosDlg::~SMESHGUI_StandardMeshInfosDlg()
{
}
//=================================================================================
/*!
* SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos
*/
//=================================================================================
void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
{
SUIT_OverrideCursor wc;
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList);
int nbSel = aList.Extent();
myInfo->clear();
if (nbSel == 1) {
myStartSelection = false;
myMeshLine->setText("");
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(aList.First());
if (!aMesh->_is_nil()) {
QString aName, anInfo;
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
myMeshLine->setText(aName);
int aNbNodes = (int)aMesh->NbNodes();
int aNbEdges = (int)aMesh->NbEdges();
int aNbFaces = (int)aMesh->NbFaces();
int aNbVolumes = (int)aMesh->NbVolumes();
int aDimension = 0;
double aNbDimElements = 0;
if (aNbVolumes > 0) {
aNbDimElements = aNbVolumes;
aDimension = 3;
}
else if(aNbFaces > 0) {
aNbDimElements = aNbFaces;
aDimension = 2;
}
else if(aNbEdges > 0) {
aNbDimElements = aNbEdges;
aDimension = 1;
}
else if(aNbNodes > 0) {
aNbDimElements = aNbNodes;
aDimension = 0;
}
// information about the mesh
anInfo.append(QString("Nb of element of dimension %1:<b> %2</b><br>").arg(aDimension).arg(aNbDimElements));
anInfo.append(QString("Nb of nodes: <b>%1</b><br><br>").arg(aNbNodes));
// information about the groups of the mesh
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
_PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh);
_PTR(SObject) anObj;
bool hasGroup = false;
// info about groups on nodes
aMeshSO->FindSubObject(SMESH::Tag_NodeGroups, anObj);
if (anObj) {
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
if (it->More()) {
anInfo.append(QString("Groups:<br><br>"));
hasGroup = true;
}
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()) {
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()));
// check if the group based on geometry
SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
if (!aGroupOnGeom->_is_nil()) {
GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
QString aShapeName = "<unknown>";
_PTR(SObject) aGeomObj, aRef;
if (subObj->FindSubObject(1, aGeomObj) && aGeomObj->ReferencedObject(aRef))
aShapeName = aRef->GetName().c_str();
anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
} else {
anInfo.append(QString("<br>"));
}
}
}
}
// info about groups on edges
anObj.reset();
aMeshSO->FindSubObject(SMESH::Tag_EdgeGroups, anObj);
if (anObj) {
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
if (!hasGroup && it->More()) {
anInfo.append(QString("Groups:<br><br>"));
hasGroup = true;
}
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()) {
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()));
// check if the group based on geometry
SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
if (!aGroupOnGeom->_is_nil()) {
GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
QString aShapeName = "<unknown>";
_PTR(SObject) aGeomObj, aRef;
if (subObj->FindSubObject(1, aGeomObj) && aGeomObj->ReferencedObject(aRef))
aShapeName = aRef->GetName().c_str();
anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
} else {
anInfo.append(QString("<br>"));
}
}
}
}
// info about groups on faces
anObj.reset();
aMeshSO->FindSubObject(SMESH::Tag_FaceGroups, anObj);
if (anObj) {
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
if (!hasGroup && it->More()) {
anInfo.append(QString("Groups:<br><br>"));
hasGroup = true;
}
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()) {
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()));
// check if the group based on geometry
SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
if (!aGroupOnGeom->_is_nil()) {
GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
QString aShapeName = "<unknown>";
_PTR(SObject) aGeomObj, aRef;
if (subObj->FindSubObject(1, aGeomObj) && aGeomObj->ReferencedObject(aRef))
aShapeName = aRef->GetName().c_str();
anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
} else {
anInfo.append(QString("<br>"));
}
}
}
}
// info about groups on volumes
anObj.reset();
aMeshSO->FindSubObject(SMESH::Tag_VolumeGroups, anObj);
if (anObj) {
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
if (!hasGroup && it->More())
anInfo.append(QString("Groups:<br>"));
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()) {
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()));
// check if the group based on geometry
SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
if (!aGroupOnGeom->_is_nil()) {
GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
QString aShapeName = "<unknown>";
_PTR(SObject) aGeomObj, aRef;
if (subObj->FindSubObject(1, aGeomObj) && aGeomObj->ReferencedObject(aRef))
aShapeName = aRef->GetName().c_str();
anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
} else {
anInfo.append(QString("<br>"));
}
}
}
}
myInfo->setText(anInfo);
return;
}
}
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void SMESHGUI_StandardMeshInfosDlg::onSelectionChanged()
{
if (myStartSelection)
DumpMeshInfos();
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void SMESHGUI_StandardMeshInfosDlg::closeEvent (QCloseEvent* e)
{
mySelectionMgr->clearFilters();
mySMESHGUI->ResetState();
QDialog::closeEvent(e);
}
//=================================================================================
// function : windowActivationChange()
// purpose : called when window is activated/deactivated
//=================================================================================
void SMESHGUI_StandardMeshInfosDlg::windowActivationChange (bool oldActive)
{
QDialog::windowActivationChange(oldActive);
if (isActiveWindow() && myIsActiveWindow != isActiveWindow())
ActivateThisDialog();
myIsActiveWindow = isActiveWindow();
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void SMESHGUI_StandardMeshInfosDlg::DeactivateActiveDialog()
{
disconnect(mySelectionMgr, 0, this, 0);
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void SMESHGUI_StandardMeshInfosDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate any active dialog */
mySMESHGUI->EmitSignalDeactivateDialog();
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
}
//=================================================================================
// function : onStartSelection()
// purpose : starts selection
//=================================================================================
void SMESHGUI_StandardMeshInfosDlg::onStartSelection()
{
myStartSelection = true;
mySelectionMgr->installFilter(myMeshFilter);
myMeshLine->setText(tr("Select a mesh"));
onSelectionChanged();
myStartSelection = true;
}
//=================================================================================
// function : onHelp()
// purpose :
//=================================================================================
void SMESHGUI_StandardMeshInfosDlg::onHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
QString platform;
#ifdef WIN32
platform = "winapplication";
#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));
}
}
//=================================================================================
// function : keyPressEvent()
// purpose :
//=================================================================================
void SMESHGUI_StandardMeshInfosDlg::keyPressEvent( QKeyEvent* e )
{
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
if ( e->key() == Qt::Key_F1 ) {
e->accept();
onHelp();
}
}

View File

@ -1,90 +0,0 @@
// Copyright (C) 2007-2011 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_StandardMeshInfosDlg.h
// Author : Michael ZORIN, Open CASCADE S.A.S.
//
#ifndef SMESHGUI_STANDARDMESHINFOSDLG_H
#define SMESHGUI_STANDARDMESHINFOSDLG_H
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
// Qt includes
#include <QDialog>
class QGroupBox;
class QLabel;
class QPushButton;
class QLineEdit;
class QTextBrowser;
class SMESHGUI;
class LightApp_SelectionMgr;
class SUIT_SelectionFilter;
class SMESHGUI_EXPORT SMESHGUI_StandardMeshInfosDlg : public QDialog
{
Q_OBJECT
public:
SMESHGUI_StandardMeshInfosDlg( SMESHGUI* );
~SMESHGUI_StandardMeshInfosDlg();
protected:
void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* );
void windowActivationChange( bool );
void DumpMeshInfos();
private slots:
void onSelectionChanged();
void DeactivateActiveDialog();
void ActivateThisDialog();
void onStartSelection();
void onHelp();
private:
SMESHGUI* mySMESHGUI;
LightApp_SelectionMgr* mySelectionMgr;
bool myStartSelection;
bool myIsActiveWindow;
SUIT_SelectionFilter* myMeshFilter;
QLabel* myNameLab;
QPushButton* mySelectBtn;
QLineEdit* myMeshLine;
QTextBrowser* myInfo;
QGroupBox* myMeshGroup;
QGroupBox* myInfoGroup;
QGroupBox* myButtonsGroup;
QPushButton* myOkBtn;
QPushButton* myHelpBtn;
QString myHelpFileName;
};
#endif // SMESHGUI_STANDARDMESHINFOSDLG_H

View File

@ -1,637 +0,0 @@
// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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_WhatIsDlg.cxx
// Author : Vladimir TURIN, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_WhatIsDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESH_Actor.h"
#include "SMESH_TypeFilter.hxx"
#include "SMESH_LogicalFilter.hxx"
#include "SMDS_Mesh.hxx"
#include "SMDS_VolumeTool.hxx"
// SALOME GUI includes
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SVTK_ViewModel.h>
#include <SVTK_Selection.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
// OCCT includes
#include <TColStd_MapOfInteger.hxx>
#include <gp_XYZ.hxx>
// Qt includes
#include <QButtonGroup>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QRadioButton>
#include <QTextBrowser>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QKeyEvent>
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Group)
#define SPACING 6
#define MARGIN 11
//=================================================================================
// class : SMESHGUI_WhatIsDlg()
// purpose :
//=================================================================================
SMESHGUI_WhatIsDlg::SMESHGUI_WhatIsDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
setWindowTitle(tr("SMESH_WHAT_IS_TITLE"));
setSizeGripEnabled(true);
QVBoxLayout* SMESHGUI_WhatIsDlgLayout = new QVBoxLayout(this);
SMESHGUI_WhatIsDlgLayout->setSpacing(SPACING);
SMESHGUI_WhatIsDlgLayout->setMargin(MARGIN);
/***************************************************************/
GroupMesh = new QGroupBox(this);
QHBoxLayout* GroupMeshLayout = new QHBoxLayout(GroupMesh);
GroupMeshLayout->setSpacing(SPACING);
GroupMeshLayout->setMargin(MARGIN);
MeshLabel = new QLabel(tr("SMESH_NAME"), GroupMesh);
GroupMeshLayout->addWidget(MeshLabel);
MeshName = new QLineEdit(GroupMesh);
MeshName->setReadOnly(true);
GroupMeshLayout->addWidget(MeshName);
/***************************************************************/
GroupSelections = new QGroupBox(tr("ENTITY_TYPE"), this);
QButtonGroup* GroupSel = new QButtonGroup(this);
QHBoxLayout* GroupSelectionsLayout = new QHBoxLayout(GroupSelections);
GroupSelectionsLayout->setSpacing(SPACING);
GroupSelectionsLayout->setMargin(MARGIN);
RadioButtonNodes = new QRadioButton(tr("SMESH_NODES"), GroupSelections);
GroupSelectionsLayout->addWidget(RadioButtonNodes);
GroupSel->addButton(RadioButtonNodes, 0);
RadioButtonElements = new QRadioButton(tr("SMESH_ELEMENTS"), GroupSelections);
GroupSelectionsLayout->addWidget(RadioButtonElements);
GroupSel->addButton(RadioButtonElements, 1);
/***************************************************************/
GroupArguments = new QGroupBox(tr("SMESH_INFORMATION"), this);
QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
GroupArgumentsLayout->setSpacing(SPACING);
GroupArgumentsLayout->setMargin(MARGIN);
// Controls for elements selection
TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
LineEditElements = new QLineEdit(GroupArguments);
LineEditElements->setValidator(new SMESHGUI_IdValidator(this));
LineEditElements->setMaxLength(-1);
GroupArgumentsLayout->addWidget(LineEditElements, 0, 1);
// information text browser
Info = new QTextBrowser(GroupArguments);
Info->setMinimumSize(300, 200);
GroupArgumentsLayout->addWidget(Info, 1, 0, 1, 2);
/***************************************************************/
GroupButtons = new QGroupBox(this);
QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
buttonHelp->setAutoDefault(true);
GroupButtonsLayout->addWidget(buttonOk);
GroupButtonsLayout->addSpacing(10);
GroupButtonsLayout->addStretch();
GroupButtonsLayout->addWidget(buttonHelp);
SMESHGUI_WhatIsDlgLayout->addWidget(GroupMesh);
SMESHGUI_WhatIsDlgLayout->addWidget(GroupSelections);
SMESHGUI_WhatIsDlgLayout->addWidget(GroupArguments);
SMESHGUI_WhatIsDlgLayout->addWidget(GroupButtons);
RadioButtonNodes->setChecked(true);
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
// Costruction of the logical filter
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
QList<SUIT_SelectionFilter*> aListOfFilters;
if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
myMeshOrSubMeshOrGroupFilter =
new SMESH_LogicalFilter(aListOfFilters, SMESH_LogicalFilter::LO_OR);
myHelpFileName = "mesh_infos_page.html#mesh_element_info_anchor";
Init();
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
connect(GroupSel, SIGNAL(buttonClicked(int)), SLOT(SelectionsClicked(int)));
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* to close dialog if study change */
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
SelectionsClicked(0);
SelectionIntoArgument();
}
//=================================================================================
// function : ~SMESHGUI_WhatIsDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
SMESHGUI_WhatIsDlg::~SMESHGUI_WhatIsDlg()
{
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void SMESHGUI_WhatIsDlg::Init (bool ResetControls)
{
myBusy = false;
LineEditElements->clear();
myActor = 0;
myMesh = SMESH::SMESH_Mesh::_nil();
if (ResetControls) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode( CellSelection );
onTextChange(LineEditElements->text());
SelectionIntoArgument();
}
}
//=================================================================================
// function : SelectionsClicked()
// purpose : Radio button management
//=================================================================================
void SMESHGUI_WhatIsDlg::SelectionsClicked (int selectionId)
{
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
switch (selectionId) {
case 0:
{
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode( NodeSelection );
break;
}
case 1:
{
SMESH::SetPointRepresentation(false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode( CellSelection );
break;
}
}
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
SelectionIntoArgument();
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void SMESHGUI_WhatIsDlg::ClickOnOk()
{
if (mySMESHGUI->isActiveStudyLocked())
return;
SMESH::UpdateView();
Init(false);
SelectionIntoArgument();
ClickOnCancel();
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void SMESHGUI_WhatIsDlg::ClickOnCancel()
{
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
SMESH::SetPointRepresentation(false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode( ActorSelection );
mySMESHGUI->ResetState();
reject();
}
//=================================================================================
// function : ClickOnHelp()
// purpose :
//=================================================================================
void SMESHGUI_WhatIsDlg::ClickOnHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
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));
}
}
//=======================================================================
// function : onTextChange()
// purpose :
//=======================================================================
void SMESHGUI_WhatIsDlg::onTextChange (const QString& theNewText)
{
if (myBusy) return;
myBusy = true;
// hilight entered elements
SMDS_Mesh* aMesh = 0;
if (myActor)
aMesh = myActor->GetObject()->GetMesh();
if (aMesh) {
Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
TColStd_MapOfInteger newIndices;
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++) {
const SMDS_MeshElement * e = RadioButtonNodes->isChecked()?
aMesh->FindNode(aListId[ i ].toInt()):
aMesh->FindElement(aListId[ i ].toInt());
if (e)
newIndices.Add(e->GetID());
}
mySelector->AddOrRemoveIndex( anIO, newIndices, false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight( anIO, true, true );
}
SelectionIntoArgument();
myBusy = false;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void SMESHGUI_WhatIsDlg::SelectionIntoArgument()
{
int curBusy = myBusy;
// clear
myActor = 0;
QString aString = "";
myBusy = true;
if(!curBusy)
LineEditElements->setText(aString);
MeshName->setText(aString);
GroupMesh->setTitle(tr(""));
Info->clear();
myBusy = curBusy;
if (!GroupButtons->isEnabled()) // inactive
return;
// get selected mesh
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
int nbSel = aList.Extent();
if (nbSel < 1)
return;
Handle(SALOME_InteractiveObject) IO = aList.First();
myMesh = SMESH::GetMeshByIO(IO);
if (myMesh->_is_nil())
return;
if (nbSel != 1) {
//check if all selected objects belongs to one mesh
SALOME_ListIteratorOfListIO io( aList );
for (io.Next(); io.More(); io.Next() ) {
SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(io.Value());
if (!mesh->_is_nil() && !mesh->_is_equivalent( myMesh ))
return;
}
// select IO with any element selected (for case of selection by rectangle)
IO.Nullify();
for (io.Initialize(aList); io.More() && IO.IsNull(); io.Next() )
if ( mySelector->HasIndex( io.Value() ))
IO = io.Value();
if ( IO.IsNull() ) return;
// unhilight others
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
for (io.Initialize(aList); io.More(); io.Next() )
if ( !IO->isSame( io.Value() ))
aViewWindow->highlight( io.Value(), false, true );
}
}
myActor = SMESH::FindActorByObject(myMesh);
if (!myActor)
myActor = SMESH::FindActorByEntry(IO->getEntry());
if (!myActor)
return;
QString aName = IO->getName();
// cut off wite spaces from tail, else meaningful head is not visible
int size = aName.length();
while (size && aName.at(size-1).isSpace() )
--size;
if ( size != aName.length() )
aName.truncate( size );
MeshName->setText(aName); // can be something like "2 objects"
if(!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) {
GroupMesh->setTitle(tr("SMESH_MESH"));
} else if(!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) {
GroupMesh->setTitle(tr("SMESH_SUBMESH"));
} else if(!SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO)->_is_nil()) {
GroupMesh->setTitle(tr("SMESH_GROUP"));
}
int aNbUnits = 0;
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
if (aNbUnits < 1)
return;
const SMDS_MeshElement * e = RadioButtonNodes->isChecked()?
myActor->GetObject()->GetMesh()->FindNode(aString.toInt()):
myActor->GetObject()->GetMesh()->FindElement(aString.toInt());
if (e) {
QString anInfo;
anInfo="<b>" + tr("ENTITY_TYPE") + ":</b> ";
if(e->GetType() == SMDSAbs_Node) {
anInfo+=tr("MESH_NODE")+"<br>";
//const SMDS_MeshNode *en = (SMDS_MeshNode*) e; // VSR: not used!
} else if (e->GetType() == SMDSAbs_0DElement) {
anInfo+=tr("SMESH_ELEM0D")+"<br>";
} else if(e->GetType() == SMDSAbs_Edge) {
anInfo+=tr("SMESH_EDGE")+"<br>";
anInfo+="<b>" + tr("SMESH_MESHINFO_TYPE")+":</b> ";
const SMDS_MeshEdge *ee = (SMDS_MeshEdge*) e;
anInfo+=(ee->IsQuadratic()?tr("SMESH_MESHINFO_ORDER2"):tr("SMESH_MESHINFO_ORDER1"))+"<br>";
} else if(e->GetType() == SMDSAbs_Face) {
const SMDS_MeshFace *ef = (SMDS_MeshFace*) e;
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"))+" ";
switch(ef->NbNodes()) {
case 3:
case 6:
{
anInfo+=tr("SMESH_TRIANGLE");
break;
}
case 4:
case 8:
{
anInfo+=tr("SMESH_QUADRANGLE");
break;
}
default:
break;
}
anInfo+="<br>";
} else if(e->GetType() == SMDSAbs_Volume) {
anInfo+=tr("SMESH_VOLUME")+"<br>";
anInfo+="<b>" + tr("SMESH_MESHINFO_TYPE")+":</b> ";
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"))+" ";
switch(vt.GetVolumeType()) {
case SMDS_VolumeTool::TETRA:
case SMDS_VolumeTool::QUAD_TETRA:
{
anInfo+=tr("SMESH_TETRAS");
break;
}
case SMDS_VolumeTool::PYRAM:
case SMDS_VolumeTool::QUAD_PYRAM:
{
anInfo+=tr("SMESH_PYRAMID");
break;
}
case SMDS_VolumeTool::PENTA:
case SMDS_VolumeTool::QUAD_PENTA:
{
anInfo+=tr("SMESH_PRISM");
break;
}
case SMDS_VolumeTool::HEXA:
case SMDS_VolumeTool::QUAD_HEXA:
{
anInfo+=tr("SMESH_HEXAS");
break;
}
case SMDS_VolumeTool::POLYHEDA:
{
anInfo+=tr("SMESH_POLYEDRON");
break;
}
default:
break;
}
anInfo+="<br>";
}
gp_XYZ anXYZ(0.,0.,0.);
SMDS_ElemIteratorPtr nodeIt = e->nodesIterator();
int nbNodes = 0;
QString aNodesInfo="";
for( ; nodeIt->more(); nbNodes++) {
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());
// 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>");
}
}
if(e->GetType() != SMDSAbs_Node)
anInfo+="<b>" + tr("GRAVITY_CENTER") + ":</b><br>";
anXYZ.Divide(e->NbNodes());
anInfo+=QString("X=%1, Y=%2, Z=%3").arg(anXYZ.X()).arg(anXYZ.Y()).arg(anXYZ.Z());
if(e->GetType() != SMDSAbs_Node)
anInfo+="<br>";
if (aNodesInfo!="")
anInfo+= "<br>" + aNodesInfo;
Info->setText(anInfo);
}
if(!curBusy) {
myBusy = true;
LineEditElements->setText(aString);
myBusy = false;
}
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void SMESHGUI_WhatIsDlg::DeactivateActiveDialog()
{
if (GroupArguments->isEnabled()) {
GroupSelections->setEnabled(false);
GroupMesh->setEnabled(false);
GroupArguments->setEnabled(false);
GroupButtons->setEnabled(false);
mySMESHGUI->ResetState();
mySMESHGUI->SetActiveDialogBox(0);
}
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void SMESHGUI_WhatIsDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
mySMESHGUI->EmitSignalDeactivateDialog();
GroupArguments->setEnabled(true);
GroupButtons->setEnabled(true);
GroupSelections->setEnabled(true);
GroupMesh->setEnabled(true);
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
if ( SMESH::GetViewWindow( mySMESHGUI ))
SelectionsClicked(RadioButtonNodes->isChecked()?0:1);
SelectionIntoArgument();
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void SMESHGUI_WhatIsDlg::enterEvent (QEvent*)
{
if (!GroupArguments->isEnabled())
ActivateThisDialog();
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void SMESHGUI_WhatIsDlg::closeEvent (QCloseEvent*)
{
/* same than click on cancel button */
ClickOnCancel();
}
//=======================================================================
//function : hideEvent
//purpose : caused by ESC key
//=======================================================================
void SMESHGUI_WhatIsDlg::hideEvent (QHideEvent*)
{
if (!isMinimized())
ClickOnCancel();
}
//=================================================================================
// function : keyPressEvent()
// purpose :
//=================================================================================
void SMESHGUI_WhatIsDlg::keyPressEvent( QKeyEvent* e )
{
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
if ( e->key() == Qt::Key_F1 ) {
e->accept();
ClickOnHelp();
}
}

View File

@ -1,103 +0,0 @@
// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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_WhatIsDlg.h
// Author : Vladimir TURIN, Open CASCADE S.A.S.
//
#ifndef SMESHGUI_WHATISDLG_H
#define SMESHGUI_WHATISDLG_H
// Qt includes
#include <QDialog>
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class QTextBrowser;
class SMESHGUI;
class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
class SMESH_LogicalFilter;
//=================================================================================
// class : SMESHGUI_WhatIsDlg
// purpose :
//=================================================================================
class SMESHGUI_WhatIsDlg : public QDialog
{
Q_OBJECT
public:
SMESHGUI_WhatIsDlg( SMESHGUI* );
~SMESHGUI_WhatIsDlg();
private:
void Init( bool = true );
void closeEvent( QCloseEvent* );
void enterEvent( QEvent* ); /* mouse enter the QWidget */
void hideEvent( QHideEvent* ); /* ESC key */
void keyPressEvent( QKeyEvent* );
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
SVTK_Selector* mySelector;
bool myBusy;
SMESH::SMESH_Mesh_var myMesh;
SMESH_Actor* myActor;
SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter;
QGroupBox* GroupSelections;
QRadioButton* RadioButtonNodes;
QRadioButton* RadioButtonElements;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonHelp;
QGroupBox* GroupArguments;
QGroupBox* GroupMesh;
QLabel* TextLabelElements;
QLineEdit* LineEditElements;
QLabel* MeshLabel;
QLineEdit* MeshName;
QTextBrowser* Info;
QString myHelpFileName;
private slots:
void SelectionsClicked( int );
void ClickOnOk();
void ClickOnCancel();
void ClickOnHelp();
void SelectionIntoArgument();
void DeactivateActiveDialog();
void ActivateThisDialog();
void onTextChange( const QString& );
};
#endif // SMESHGUI_WHATISDLG_H

View File

@ -3556,10 +3556,6 @@ Please, create VTK viewer and try again</translation>
<source>PREF_WIREFRAME</source>
<translation>Wireframe color</translation>
</message>
<message>
<source>PREF_GROUP_SELECTION</source>
<translation>Selection</translation>
</message>
<message>
<source>PREF_SELECTION</source>
<translation>Selection color</translation>
@ -5488,21 +5484,6 @@ It is impossible to read point coordinates from file</translation>
<translation>Union of two triangles</translation>
</message>
</context>
<context>
<name>SMESHGUI_WhatIsDlg</name>
<message>
<source>ENTITY_TYPE</source>
<translation>Element type</translation>
</message>
<message>
<source>GRAVITY_CENTER</source>
<translation>Gravity center</translation>
</message>
<message>
<source>CONNECTED_ELEMENTS</source>
<translation>Connected With Elements</translation>
</message>
</context>
<context>
<name>SMESHGUI_FileInfoDlg</name>
<message>

View File

@ -3556,10 +3556,6 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
<source>PREF_WIREFRAME</source>
<translation>Couleur de contour</translation>
</message>
<message>
<source>PREF_GROUP_SELECTION</source>
<translation>Sélection</translation>
</message>
<message>
<source>PREF_SELECTION</source>
<translation>Couleur de sélection</translation>
@ -5488,21 +5484,6 @@ Il y a trop peu de points dans le fichier </translation>
<translation>Union de deux triangles</translation>
</message>
</context>
<context>
<name>SMESHGUI_WhatIsDlg</name>
<message>
<source>ENTITY_TYPE</source>
<translation>Type d&apos;élément </translation>
</message>
<message>
<source>GRAVITY_CENTER</source>
<translation>Centre de Gravité</translation>
</message>
<message>
<source>CONNECTED_ELEMENTS</source>
<translation>Connecté avec d&apos;Eléments </translation>
</message>
</context>
<context>
<name>SMESHGUI_FileInfoDlg</name>
<message>

View File

@ -384,6 +384,17 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
aCommand->SetArg( 2, Type );
aCommand->SetArg( 3, Compare );
if ( Type == "SMESH.FT_ElemGeomType" && Threshold.IsIntegerValue() )
{
// set SMESH.GeometryType instead of a numerical Threshold
const char* types[SMESH::Geom_POLYHEDRA+1] = {
"Geom_POINT", "Geom_EDGE", "Geom_TRIANGLE", "Geom_QUADRANGLE", "Geom_POLYGON",
"Geom_TETRA", "Geom_PYRAMID", "Geom_HEXA", "Geom_PENTA", "Geom_POLYHEDRA"
};
int iGeom = Threshold.IntegerValue();
if ( -1 < iGeom && iGeom < SMESH::Geom_POLYHEDRA+1 )
Threshold = SMESH + types[ iGeom ];
}
if ( ThresholdStr.Length() != 2 ) // not '' or ""
aCommand->SetArg( 4, ThresholdStr );
else if ( ThresholdID.Length() != 2 )
@ -980,6 +991,14 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
else if ( method == "CreateGroupFromFilter" ) // --> GroupOnFilter()
{
theCommand->SetMethod( "GroupOnFilter" );
Handle(_pyGroup) group = new _pyGroup( theCommand );
theGen->AddObject( group );
// GroupOnFilter(typ, name, aFilter0x4743dc0 -> aFilter_1)
_pyID filterID = theCommand->GetArg(3);
Handle(_pyObject) filter = theGen->FindObject( filterID );
if ( !filter.IsNull() && filter->IsKind(STANDARD_TYPE(_pyFilter)))
filter->Process( theCommand );
}
// ----------------------------------------------------------------------
else if ( method == "GetIdsFromFilter" )
@ -1278,7 +1297,8 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
"SewBorderToSide","SewSideElements","ChangeElemNodes","GetLastCreatedNodes",
"GetLastCreatedElems",
"MirrorMakeMesh","MirrorObjectMakeMesh","TranslateMakeMesh",
"TranslateObjectMakeMesh","RotateMakeMesh","RotateObjectMakeMesh","MakeBoundaryMesh"
"TranslateObjectMakeMesh","RotateMakeMesh","RotateObjectMakeMesh","MakeBoundaryMesh",
"MakeBoundaryElements"
,"" }; // <- mark of the end
sameMethods.Insert( names );
}
@ -1649,6 +1669,16 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
hyp = new _pyLayerDistributionHypo( theCreationCmd, "Get3DHypothesis" );
hyp->SetConvMethodAndType( "LayerDistribution", "RadialPrism_3D");
}
// Cartesian 3D ---------
else if ( hypType == "Cartesian_3D" ) {
algo->SetConvMethodAndType( "BodyFitted", hypType.ToCString());
}
else if ( hypType == "CartesianParameters3D" ) {
hyp = new _pyComplexParamHypo( theCreationCmd );
hyp->SetConvMethodAndType( "SetGrid", "Cartesian_3D");
for ( int iArg = 0; iArg < 4; ++iArg )
hyp->myArgs.Append("[]");
}
return algo->IsValid() ? algo : hyp;
}
@ -1825,6 +1855,38 @@ void _pyHypothesis::Assign( const Handle(_pyHypothesis)& theOther,
void _pyComplexParamHypo::Process( const Handle(_pyCommand)& theCommand)
{
if ( GetAlgoType() == "Cartesian_3D" )
{
// CartesianParameters3D hyp
if ( theCommand->GetMethod() == "SetSizeThreshold" )
{
myArgs( 4 ) = theCommand->GetArg( 1 );
myArgCommands.push_back( theCommand );
return;
}
if ( theCommand->GetMethod() == "SetGrid" ||
theCommand->GetMethod() == "SetGridSpacing" )
{
TCollection_AsciiString axis = theCommand->GetArg( theCommand->GetNbArgs() );
int iArg = 1 + ( axis.Value(1) - '0' );
if ( theCommand->GetMethod() == "SetGrid" )
{
myArgs( iArg ) = theCommand->GetArg( 1 );
}
else
{
myArgs( iArg ) = "[ ";
myArgs( iArg ) += theCommand->GetArg( 1 );
myArgs( iArg ) += ", ";
myArgs( iArg ) += theCommand->GetArg( 2 );
myArgs( iArg ) += "]";
}
myArgCommands.push_back( theCommand );
return;
}
}
if( theCommand->GetMethod() == "SetLength" )
{
// NOW it becomes OBSOLETE
@ -2772,6 +2834,14 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand)
// set new name of a filter
filter->Process( makeGroupCmd );
}
else if ( theCommand->GetMethod() == "SetFilter" )
{
// set new name of a filter
_pyID filterID = theCommand->GetArg(1);
Handle(_pyObject) filter = theGen->FindObject( filterID );
if ( !filter.IsNull() )
filter->Process( theCommand );
}
}
//================================================================================

View File

@ -467,7 +467,7 @@ DEFINE_STANDARD_HANDLE (_pyGroup, _pyObject);
// -------------------------------------------------------------------------------------
/*!
* \brief A filter
* \brief A filter sets a human readable name to self
*/
// -------------------------------------------------------------------------------------
class _pyFilter: public _pyObject

View File

@ -708,20 +708,28 @@ namespace {
const TCollection_AsciiString allowedChars =
"qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_";
bool isValidName = true;
int p=1; // replace not allowed chars with underscore
int nbUnderscore = 0;
int p=1; // replace not allowed chars by underscore
while (p <= aName.Length() &&
(p = aName.FirstLocationNotInSet(allowedChars, p, aName.Length())))
{
if ( p == 1 || p == aName.Length() || aName.Value(p-1) == '_')
aName.Remove( p, 1 ); // remove double _ and from the start and the end
else
aName.SetValue(p, '_');
aName.SetValue(p, '_'), nbUnderscore++;
isValidName = false;
}
if ( aName.IsIntegerValue() ) { // aName must not start with a digit
aName.Insert( 1, 'a' );
isValidName = false;
}
// shorten names like CartesianParameters3D_400_400_400_1000000_1
if ( aName.Length() > 20 && nbUnderscore > 2 )
{
p = aName.Location( "_", 20, aName.Length());
if ( p > 1 )
aName.Trunc( p-1 );
}
return isValidName;
}
}

View File

@ -297,7 +297,7 @@ SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_ptr orb,
SALOME::Session_var session = SALOME::Session::_narrow( obj ) ;
if ( !session->_is_nil() )
{
CORBA::String_var s_host = session->getHostname();
CORBA::String_var str_host = session->getHostname();
CORBA::Long s_pid = session->getPID();
string my_host = Kernel_Utils::GetHostname();
#ifdef WNT
@ -305,7 +305,7 @@ SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_ptr orb,
#else
long my_pid = (long) getpid();
#endif
SetEmbeddedMode( s_pid == my_pid && my_host == s_host.in() );
SetEmbeddedMode( s_pid == my_pid && my_host == str_host.in() );
}
}
}

View File

@ -582,9 +582,13 @@ void SMESH_GroupBase_i::SetColor(const SALOMEDS::Color& color)
if (aGroupDS)
{
Quantity_Color aQColor( color.R, color.G, color.B, Quantity_TOC_RGB );
Quantity_Color oldColor = aGroupDS->GetColor();
if ( oldColor != aQColor )
{
aGroupDS->SetColor(aQColor);
TPythonDump()<<_this()<<".SetColor( SALOMEDS.Color( "<<color.R<<", "<<color.G<<", "<<color.B<<" ))";
}
}
}
//=============================================================================

View File

@ -5673,6 +5673,7 @@ CORBA::Boolean SMESH_MeshEditor_i::Make2DMeshFrom3D()
CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains,
CORBA::Boolean createJointElems )
throw (SALOME::SALOME_Exception)
{
initData();
@ -5686,8 +5687,10 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::Li
for ( int i = 0, n = theDomains.length(); i < n; i++ )
{
SMESH::SMESH_GroupBase_var aGrp = theDomains[ i ];
if ( !CORBA::is_nil( aGrp ) && ( aGrp->GetType() != SMESH::NODE ) )
if ( !CORBA::is_nil( aGrp ) /*&& ( aGrp->GetType() != SMESH::NODE )*/ )
{
if ( aGrp->GetType() != SMESH::VOLUME )
THROW_SALOME_CORBA_EXCEPTION("Not a volume group", SALOME::BAD_PARAM);
TIDSortedElemSet domain;
domain.clear();
domains.push_back(domain);

View File

@ -713,7 +713,8 @@ public:
* @return TRUE if operation has been completed successfully, FALSE otherwise
*/
CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains,
CORBA::Boolean createJointElems );
CORBA::Boolean createJointElems )
throw (SALOME::SALOME_Exception);
/*!
* \brief Double nodes on some external faces and create flat elements.
* Flat elements are mainly used by some types of mechanic calculations.

View File

@ -2595,7 +2595,7 @@ void SMESH_Mesh_i::ExportToMEDX (const char* file,
throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
string aMeshName = PrepareMeshNameAndGroups(file, true);
string aMeshName = PrepareMeshNameAndGroups(file, overwrite);
TPythonDump() << _this() << ".ExportToMEDX( r'"
<< file << "', " << auto_groups << ", " << theVersion << ", " << overwrite << " )";

View File

@ -19,7 +19,7 @@
include $(top_srcdir)/adm_local/unix/make_common_starter.am
salomepypkgdir = $(salomepythondir)/salome/smesh
salomepypkgdir = $(smeshpypkgdir)
salomepypkg_PYTHON = \
__init__.py \
smeshstudytools.py

View File

@ -1712,6 +1712,23 @@ class Mesh:
TreatHypoStatus( status, hyp_name, geom_name, isAlgo )
return status
## Return True if an algorithm of hypothesis is assigned to a given shape
# @param hyp a hypothesis to check
# @param geom a subhape of mesh geometry
# @return True of False
# @ingroup l2_hypotheses
def IsUsedHypothesis(self, hyp, geom):
if not hyp or not geom:
return False
if isinstance( hyp, Mesh_Algorithm ):
hyp = hyp.GetAlgorithm()
pass
hyps = self.GetHypothesisList(geom)
for h in hyps:
if h.GetId() == hyp.GetId():
return True
return False
## Unassigns a hypothesis
# @param hyp a hypothesis to unassign
# @param geom a subshape of mesh geometry
@ -4589,9 +4606,14 @@ class Mesh_Algorithm:
if isinstance( arg, geompyDC.GEOM._objref_GEOM_Object ):
argStr = arg.GetStudyEntry()
if not argStr: argStr = "GEOM_Obj_%s", arg.GetEntry()
if len( argStr ) > 10:
argStr = argStr[:7]+"..."
if argStr[0] == '[': argStr += ']'
a = a + s + argStr
s = ","
pass
if len(a) > 50:
a = a[:47]+"..."
self.mesh.smeshpyD.SetName(hypo, hyp + a)
pass
geomName=""
@ -4638,7 +4660,7 @@ class Mesh_Algorithm:
## Transform a list of ether edges or tuples (edge 1st_vertex_of_edge)
# into a list acceptable to SetReversedEdges() of some 1D hypotheses
# @ingroupl3_hypos_1dhyps
# @ingroup l3_hypos_1dhyps
def ReversedEdgeIndices(self, reverseList):
resList = []
geompy = self.mesh.geompyD
@ -5180,7 +5202,7 @@ class Mesh_Triangle(Mesh_Algorithm):
## Sets topology usage way.
# @param way defines how mesh conformity is assured <ul>
# <li>FromCAD - mesh conformity is assured by conformity of a shape</li>
# <li>PreProcess or PreProcessPlus - by pre-processing a CAD model</li></ul>
# <li>PreProcess or PreProcessPlus - by pre-processing a CAD model</li>
# <li>PreCAD - by pre-processing with PreCAD a CAD model</li></ul>
# @ingroup l3_hypos_blsurf
def SetTopology(self, way):
@ -6524,52 +6546,48 @@ class Mesh_Cartesian_3D(Mesh_Algorithm):
def __init__(self, mesh, geom=0):
self.Create(mesh, geom, "Cartesian_3D")
self.hyp = None
return
## Defines "Body Fitting parameters" hypothesis
# @param xCoords coordinates of grid nodes along the X asix
# @param yCoords coordinates of grid nodes along the Y asix
# @param zCoords coordinates of grid nodes along the Z asix
# @param sizeThreshold size (> 1.0) defines a minimal size of a polyhedron so that
# @param xGridDef is definition of the grid along the X asix.
# It can be in either of two following forms:
# - Explicit coordinates of nodes, e.g. [-1.5, 0.0, 3.1] or range( -100,200,10)
# - Functions f(t) defining grid spacing at each point on grid axis. If there are
# several functions, they must be accompanied by relative coordinates of
# points dividing the whole shape into ranges where the functions apply; points
# coodrinates should vary within (0.0, 1.0) range. Parameter \a t of the spacing
# function f(t) varies from 0.0 to 1.0 witin a shape range.
# Examples:
# - "10.5" - defines a grid with a constant spacing
# - [["1", "1+10*t", "11"] [0.1, 0.6]] - defines different spacing in 3 ranges.
# @param yGridDef defines the grid along the Y asix the same way as \a xGridDef does
# @param zGridDef defines the grid along the Z asix the same way as \a xGridDef does
# @param sizeThreshold (> 1.0) defines a minimal size of a polyhedron so that
# a polyhedron of size less than hexSize/sizeThreshold is not created
# @param UseExisting if ==true - searches for the existing hypothesis created with
# the same parameters, else (default) - creates a new one
def SetGrid(self, xCoords, yCoords, zCoords, sizeThreshold, UseExisting=False):
hyp = self.Hypothesis("CartesianParameters3D", [xCoords, yCoords, zCoords, sizeThreshold],
def SetGrid(self, xGridDef, yGridDef, zGridDef, sizeThreshold=4.0, UseExisting=False):
if not self.hyp:
self.hyp = self.Hypothesis("CartesianParameters3D",
[xGridDef, yGridDef, zGridDef, sizeThreshold],
UseExisting=UseExisting, CompareMethod=self._compareHyp)
hyp.SetGrid(xCoords, 0 )
hyp.SetGrid(yCoords, 1 )
hyp.SetGrid(zCoords, 2 )
hyp.SetSizeThreshold( sizeThreshold )
return hyp
if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ):
self.mesh.AddHypothesis( self.hyp, self.geom )
## Defines "Body Fitting parameters" hypothesis
# @param xSpaceFuns functions f(t) defining spacing value at given point on X axis.
# Parameter t of \axSpaceFuns is a position [0.,1.] withing bounding box of
# the shape to mesh or withing an interval defined by internal points
# @param ySpaceFuns functions f(t) defining spacing value at given point on Y axis.
# @param zSpaceFuns functions f(t) defining spacing value at given point on Z axis.
# @param xInternalPoints points (0.,1.) dividing a grid into parts along X direction.
# Number of \axInternalPoints must be one less than number of \axSpaceFuns
# @param yInternalPoints points (0.,1.) dividing a grid into parts along Y direction.
# @param zInternalPoints points (0.,1.) dividing a grid into parts along Z direction.
# @param sizeThreshold size (> 1.0) defines a minimal size of a polyhedron so that
# a polyhedron of size less than hexSize/sizeThreshold is not created
# @param UseExisting if ==true - searches for the existing hypothesis created with
# the same parameters, else (default) - creates a new one
def SetSpacing(self,
xSpaceFuns, ySpaceFuns, zSpaceFuns,
xInternalPoints, yInternalPoints, zInternalPoints,
sizeThreshold, UseExisting=False):
hyp = self.Hypothesis("CartesianParameters3D",
[xSpaceFuns, ySpaceFuns, zSpaceFuns, \
xInternalPoints, yInternalPoints, zInternalPoints],
UseExisting=UseExisting, CompareMethod=self._compareHyp)
hyp.SetGridSpacing(xSpaceFuns, xInternalPoints, 0)
hyp.SetGridSpacing(ySpaceFuns, yInternalPoints, 1)
hyp.SetGridSpacing(zSpaceFuns, zInternalPoints, 2)
hyp.SetSizeThreshold( sizeThreshold )
return hyp
for axis, gridDef in enumerate( [xGridDef, yGridDef, zGridDef]):
if not gridDef: raise ValueError, "Empty grid definition"
if isinstance( gridDef, str ):
self.hyp.SetGridSpacing( [gridDef], [], axis )
elif isinstance( gridDef[0], str ):
self.hyp.SetGridSpacing( gridDef, [], axis )
elif isinstance( gridDef[0], int ) or \
isinstance( gridDef[0], float ):
self.hyp.SetGrid(gridDef, axis )
else:
self.hyp.SetGridSpacing( gridDef[0], gridDef[1], axis )
self.hyp.SetSizeThreshold( sizeThreshold )
return self.hyp
def _compareHyp(self,hyp,args):
# not implemented yet

View File

@ -315,7 +315,7 @@ namespace
bool IsCorner() const { return _node; }
};
// --------------------------------------------------------------------------------
struct _Link // link connection two _Node's
struct _Link // link connecting two _Node's
{
_Node* _nodes[2];
vector< _Node> _intNodes; // _Node's at GridLine intersections

View File

@ -261,13 +261,26 @@ namespace
*/
//================================================================================
bool beginsAtSide( const _FaceGrid& sideGrid1, const _FaceGrid& sideGrid2 )
bool beginsAtSide( const _FaceGrid& sideGrid1,
const _FaceGrid& sideGrid2,
SMESH_ProxyMesh::Ptr proxymesh )
{
const SMDS_MeshNode* n00 = (sideGrid1._u2nodesMap.begin()->second)[0];
const TNodeColumn& col0 = sideGrid2._u2nodesMap.begin()->second;
const TNodeColumn& col1 = sideGrid2._u2nodesMap.rbegin()->second;
return ( n00 == col0.front() || n00 == col0.back() ||
n00 == col1.front() || n00 == col1.back() );
const SMDS_MeshNode* n00 = col0.front();
const SMDS_MeshNode* n01 = col0.back();
const SMDS_MeshNode* n10 = col1.front();
const SMDS_MeshNode* n11 = col1.back();
const SMDS_MeshNode* n = (sideGrid1._u2nodesMap.begin()->second)[0];
if ( proxymesh )
{
n00 = proxymesh->GetProxyNode( n00 );
n10 = proxymesh->GetProxyNode( n10 );
n01 = proxymesh->GetProxyNode( n01 );
n11 = proxymesh->GetProxyNode( n11 );
n = proxymesh->GetProxyNode( n );
}
return ( n == n00 || n == n01 || n == n10 || n == n11 );
}
}
@ -433,12 +446,12 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
// Orient loaded grids of cube sides along axis of the unitary cube coord system
bool isReverse[6];
isReverse[B_BOTTOM] = beginsAtSide( aCubeSide[B_BOTTOM], aCubeSide[B_RIGHT ] );
isReverse[B_TOP ] = beginsAtSide( aCubeSide[B_TOP ], aCubeSide[B_RIGHT ] );
isReverse[B_FRONT ] = beginsAtSide( aCubeSide[B_FRONT ], aCubeSide[B_RIGHT ] );
isReverse[B_BACK ] = beginsAtSide( aCubeSide[B_BACK ], aCubeSide[B_RIGHT ] );
isReverse[B_LEFT ] = beginsAtSide( aCubeSide[B_LEFT ], aCubeSide[B_BACK ] );
isReverse[B_RIGHT ] = beginsAtSide( aCubeSide[B_RIGHT ], aCubeSide[B_BACK ] );
isReverse[B_BOTTOM] = beginsAtSide( aCubeSide[B_BOTTOM], aCubeSide[B_RIGHT ], proxymesh );
isReverse[B_TOP ] = beginsAtSide( aCubeSide[B_TOP ], aCubeSide[B_RIGHT ], proxymesh );
isReverse[B_FRONT ] = beginsAtSide( aCubeSide[B_FRONT ], aCubeSide[B_RIGHT ], proxymesh );
isReverse[B_BACK ] = beginsAtSide( aCubeSide[B_BACK ], aCubeSide[B_RIGHT ], proxymesh );
isReverse[B_LEFT ] = beginsAtSide( aCubeSide[B_LEFT ], aCubeSide[B_BACK ], proxymesh );
isReverse[B_RIGHT ] = beginsAtSide( aCubeSide[B_RIGHT ], aCubeSide[B_BACK ], proxymesh );
for ( int i = 0; i < 6; ++i )
{
aCubeSide[i]._columns.resize( aCubeSide[i]._u2nodesMap.size() );

View File

@ -26,7 +26,7 @@
//
#include "StdMeshers_ImportSource.hxx"
#include "SMESHDS_GroupBase.hxx"
#include "SMESHDS_GroupOnGeom.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESH_Algo.hxx"
#include "SMESH_Gen.hxx"
@ -258,6 +258,51 @@ std::vector<SMESH_Mesh*> StdMeshers_ImportSource1D::GetSourceMeshes() const
return meshes;
}
//================================================================================
/*!
* \brief Return submeshes whose events affect the target mesh
*/
//================================================================================
std::vector<SMESH_subMesh*>
StdMeshers_ImportSource1D::GetSourceSubMeshes(const SMESH_Mesh* srcMesh) const
{
if ( !srcMesh->HasShapeToMesh() )
return vector<SMESH_subMesh*>(1, srcMesh->GetSubMeshContaining(1));
set<int> shapeIDs;
const vector<SMESH_Group*>& groups = GetGroups();
const SMESHDS_Mesh * srcMeshDS = srcMesh->GetMeshDS();
for ( size_t i = 0; i < groups.size(); ++i )
{
SMESHDS_GroupBase * grDS = groups[i]->GetGroupDS();
if ( grDS->GetMesh() != srcMeshDS )
continue;
if ( SMESHDS_GroupOnGeom* gog = dynamic_cast<SMESHDS_GroupOnGeom*>( grDS ))
{
shapeIDs.insert( srcMeshDS->ShapeToIndex( gog->GetShape() ));
}
else
{
SMDS_ElemIteratorPtr elIt = grDS->GetElements();
while ( elIt->more() )
shapeIDs.insert( elIt->next()->getshapeId() );
}
}
if ( !shapeIDs.empty() && *shapeIDs.begin() < 1 )
{
shapeIDs.erase( shapeIDs.begin() );
shapeIDs.insert( 1 );
}
vector<SMESH_subMesh*> smVec( shapeIDs.size());
set<int>::iterator sID = shapeIDs.begin();
for ( int i = 0; sID != shapeIDs.end(); ++sID, ++i )
smVec[i] = srcMesh->GetSubMeshContaining( *sID );
return smVec;
}
//=============================================================================
/*!
* Save _toCopyMesh and _toCopyGroups to a stream

View File

@ -37,6 +37,7 @@
class SMESH_Group;
class SMESHDS_Mesh;
class SMESH_subMesh;
//==============================================================================
/*!
@ -69,6 +70,7 @@ class STDMESHERS_EXPORT StdMeshers_ImportSource1D : public SMESH_Hypothesis
const SMESHDS_Mesh& tgtMesh);
std::vector<SMESH_Mesh*> GetSourceMeshes() const;
std::vector<SMESH_subMesh*> GetSourceSubMeshes(const SMESH_Mesh* srcMesh) const;
private:

View File

@ -303,14 +303,16 @@ namespace // INTERNAL STUFF
// set listener to hear events of the submesh computed by "Import" algo
importSub->SetEventListener( get(), new _ListenerData(srcHyp), importSub );
// set a listener to hear events of the source mesh
// set listeners to hear events of the source mesh
SMESH_subMesh* smToNotify = importSub;
SMESH_subMesh* smToListen = srcMesh->GetSubMeshContaining(1);
vector<SMESH_subMesh*> smToListen = srcHyp->GetSourceSubMeshes( srcMesh );
for ( size_t i = 0; i < smToListen.size(); ++i )
{
SMESH_subMeshEventListenerData* data = new _ListenerData(srcHyp, LISTEN_SRC_MESH);
data->mySubMeshes.push_back( smToNotify );
importSub->SetEventListener( get(), data, smToListen );
// remeber the submesh importSub and its sub-submeshes
importSub->SetEventListener( get(), data, smToListen[i] );
}
// remember the submesh importSub and its sub-submeshes
_ImportData* iData = _Listener::getImportData( srcMesh, importSub->GetFather());
iData->trackHypParams( importSub, srcHyp );
iData->addComputed( importSub );
@ -370,11 +372,11 @@ namespace // INTERNAL STUFF
// clear the rest submeshes
if ( !d->_computedSubM.empty() )
{
set< SMESH_subMesh*, _SubLess> subs;
subs.swap( d->_computedSubM ); // avoid recursion via events
while ( !subs.empty() )
d->_computedSubM.clear();
set< SMESH_subMesh*, _SubLess>::iterator sub = d->_subM.begin();
for ( ; sub != d->_subM.end(); ++sub )
{
SMESH_subMesh* subM = *subs.begin(); subs.erase( subs.begin() );
SMESH_subMesh* subM = *sub;
_ListenerData* hypData = (_ListenerData*) subM->GetEventListenerData( get() );
if ( hypData )
d->removeGroups( sm, hypData->_srcHyp );

View File

@ -1689,16 +1689,17 @@ bool StdMeshers_PrismAsBlock::GetLayersTransformation(vector<gp_Trsf> & trsf) co
for ( int iE = 0; iE < nbEdgesInWires.front(); ++iE, ++edgeIt )
{
if ( BRep_Tool::Degenerated( *edgeIt )) continue;
const TParam2ColumnMap& u2colMap =
const TParam2ColumnMap* u2colMap =
GetParam2ColumnMap( myHelper->GetMeshDS()->ShapeToIndex( *edgeIt ), isReverse );
if ( !u2colMap ) return false;
isReverse = ( edgeIt->Orientation() == TopAbs_REVERSED );
double f = u2colMap.begin()->first, l = u2colMap.rbegin()->first;
double f = u2colMap->begin()->first, l = u2colMap->rbegin()->first;
if ( isReverse ) swap ( f, l );
const int nbCol = 5;
for ( int i = 0; i < nbCol; ++i )
{
double u = f + i/double(nbCol) * ( l - f );
const TNodeColumn* col = & getColumn( & u2colMap, u )->second;
const TNodeColumn* col = & getColumn( u2colMap, u )->second;
if ( columns.empty() || col != columns.back() )
columns.push_back( col );
}

View File

@ -148,15 +148,18 @@ public:
* \brief Return TParam2ColumnMap for a base edge
* \param baseEdgeID - base edge SMESHDS Index
* \param isReverse - columns in-block orientation
* \retval const TParam2ColumnMap& - map
* \retval const TParam2ColumnMap* - map
*/
const TParam2ColumnMap& GetParam2ColumnMap(const int baseEdgeID,
const TParam2ColumnMap* GetParam2ColumnMap(const int baseEdgeID,
bool & isReverse) const
{
std::pair< TParam2ColumnMap*, bool > col_frw =
myShapeIndex2ColumnMap.find( baseEdgeID )->second;
std::map< int, std::pair< TParam2ColumnMap*, bool > >::const_iterator i_mo =
myShapeIndex2ColumnMap.find( baseEdgeID );
if ( i_mo == myShapeIndex2ColumnMap.end() ) return 0;
const std::pair< TParam2ColumnMap*, bool >& col_frw = i_mo->second;
isReverse = !col_frw.second;
return * col_frw.first;
return col_frw.first;
}
/*!

View File

@ -691,7 +691,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
list<double>::iterator u = theParams.begin(), uEnd = theParams.end();
for ( ; u != uEnd; ++u )
{
GCPnts_AbscissaPoint Discret( theC3d, (*u) * lenFactor, f );
GCPnts_AbscissaPoint Discret( theC3d, ((*u)-f) * lenFactor, f );
if ( Discret.IsDone() )
*u = Discret.Parameter();
}

View File

@ -32,16 +32,18 @@
#include "SMESHDS_Hypothesis.hxx"
#include "SMESH_Algo.hxx"
#include "SMESH_ComputeError.hxx"
#include "SMESH_ControlsDef.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_Group.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_ProxyMesh.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_subMeshEventListener.hxx"
#include "SMESH_ProxyMesh.hxx"
#include "utilities.h"
#include <BRepAdaptor_Curve2d.hxx>
#include <BRep_Tool.hxx>
#include <Bnd_B2d.hxx>
#include <Bnd_B3d.hxx>
@ -56,6 +58,8 @@
#include <Geom_Line.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Precision.hxx>
#include <Standard_ErrorHandler.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
@ -67,7 +71,6 @@
#include <gp_Ax1.hxx>
#include <gp_Vec.hxx>
#include <gp_XY.hxx>
#include <gp_XYZ.hxx>
#include <list>
#include <string>
@ -225,16 +228,21 @@ namespace VISCOUS
return determinant > 1e-100;
}
bool IsForward(const gp_XY& tgtUV,
const SMDS_MeshNode* smoothedNode,
const TopoDS_Face& face,
SMESH_MesherHelper& helper,
const double refSign) const
{
gp_XY prevUV = helper.GetNodeUV( face, _nPrev );
gp_XY nextUV = helper.GetNodeUV( face, _nNext );
gp_XY prevUV = helper.GetNodeUV( face, _nPrev, smoothedNode );
gp_XY nextUV = helper.GetNodeUV( face, _nNext, smoothedNode );
gp_Vec2d v1( tgtUV, prevUV ), v2( tgtUV, nextUV );
double d = v1 ^ v2;
return d*refSign > 1e-100;
}
bool IsNeighbour(const _Simplex& other) const
{
return _nPrev == other._nNext || _nNext == other._nPrev;
}
};
//--------------------------------------------------------------------------------
/*!
@ -411,6 +419,7 @@ namespace VISCOUS
Handle(Geom_Surface)& surface,
SMESH_MesherHelper& helper,
const double refSign,
bool isCentroidal,
bool set3D);
};
//--------------------------------------------------------------------------------
@ -444,7 +453,8 @@ namespace VISCOUS
_SolidData& data);
void getSimplices( const SMDS_MeshNode* node, vector<_Simplex>& simplices,
const set<TGeomID>& ingnoreShapes,
const _SolidData* dataToCheckOri = 0);
const _SolidData* dataToCheckOri = 0,
const bool toSort = false);
bool sortEdges( _SolidData& data,
vector< vector<_LayerEdge*> >& edgesByGeom);
void limitStepSize( _SolidData& data,
@ -465,6 +475,7 @@ namespace VISCOUS
bool prepareEdgeToShrink( _LayerEdge& edge, const TopoDS_Face& F,
SMESH_MesherHelper& helper,
const SMESHDS_SubMesh* faceSubMesh );
void fixBadFaces(const TopoDS_Face& F, SMESH_MesherHelper& helper);
bool addBoundaryElements();
bool error( const string& text, int solidID=-1 );
@ -726,6 +737,67 @@ namespace
}
return dir;
}
//================================================================================
/*!
* \brief Returns true if a FACE is bound by a concave EDGE
*/
//================================================================================
bool isConcave( const TopoDS_Face& F, SMESH_MesherHelper& helper )
{
gp_Vec2d drv1, drv2;
gp_Pnt2d p;
TopExp_Explorer eExp( F.Oriented( TopAbs_FORWARD ), TopAbs_EDGE );
for ( ; eExp.More(); eExp.Next() )
{
const TopoDS_Edge& E = TopoDS::Edge( eExp.Current() );
if ( BRep_Tool::Degenerated( E )) continue;
// check if 2D curve is concave
BRepAdaptor_Curve2d curve( E, F );
const int nbIntervals = curve.NbIntervals( GeomAbs_C2 );
TColStd_Array1OfReal intervals(1, nbIntervals + 1 );
curve.Intervals( intervals, GeomAbs_C2 );
bool isConvex = true;
for ( int i = 1; i <= nbIntervals && isConvex; ++i )
{
double u1 = intervals( i );
double u2 = intervals( i+1 );
curve.D2( 0.5*( u1+u2 ), p, drv1, drv2 );
double cross = drv2 ^ drv1;
if ( E.Orientation() == TopAbs_REVERSED )
cross = -cross;
isConvex = ( cross < 1e-9 );
}
// check if concavity is strong enough to care about it
//const double maxAngle = 5 * Standard_PI180;
if ( !isConvex )
{
//cout << "Concave FACE " << helper.GetMeshDS()->ShapeToIndex( F ) << endl;
return true;
// map< double, const SMDS_MeshNode* > u2nodes;
// if ( !SMESH_Algo::GetSortedNodesOnEdge( helper.GetMeshDS(), E,
// /*ignoreMedium=*/true, u2nodes))
// continue;
// map< double, const SMDS_MeshNode* >::iterator u2n = u2nodes.begin();
// gp_Pnt2d uvPrev = helper.GetNodeUV( F, u2n->second );
// double uPrev = u2n->first;
// for ( ++u2n; u2n != u2nodes.end(); ++u2n )
// {
// gp_Pnt2d uv = helper.GetNodeUV( F, u2n->second );
// gp_Vec2d segmentDir( uvPrev, uv );
// curve.D1( uPrev, p, drv1 );
// try {
// if ( fabs( segmentDir.Angle( drv1 )) > maxAngle )
// return true;
// }
// catch ( ... ) {}
// uvPrev = uv;
// uPrev = u2n->first;
// }
}
}
return false;
}
//--------------------------------------------------------------------------------
// DEBUG. Dump intermediate node positions into a python script
#ifdef __myDEBUG
@ -737,31 +809,38 @@ namespace
py = new ofstream(fname);
*py << "from smesh import *" << endl
<< "meshSO = GetCurrentStudy().FindObjectID('0:1:2:3')" << endl
<< "mesh = Mesh( meshSO.GetObject()._narrow( SMESH.SMESH_Mesh ))"<<endl;
<< "mesh = Mesh( meshSO.GetObject() )"<<endl;
}
~PyDump() {
*py << "mesh.MakeGroup('Prisms of viscous layers',VOLUME,FT_ElemGeomType,'=',Geom_PENTA)"
<<endl; delete py; py=0;
void Finish() {
if (py)
*py << "mesh.MakeGroup('Viscous Prisms',VOLUME,FT_ElemGeomType,'=',Geom_PENTA)"<<endl;
delete py; py=0;
}
~PyDump() { Finish(); }
};
#define dumpFunction(f) { _dumpFunction(f, __LINE__);}
#define dumpMove(n) { _dumpMove(n, __LINE__);}
#define dumpCmd(txt) { _dumpCmd(txt, __LINE__);}
void _dumpFunction(const string& fun, int ln)
{ *py<< "def "<<fun<<"(): # "<< ln <<endl; cout<<fun<<"()"<<endl;}
{ if (py) *py<< "def "<<fun<<"(): # "<< ln <<endl; cout<<fun<<"()"<<endl;}
void _dumpMove(const SMDS_MeshNode* n, int ln)
{ *py<< " mesh.MoveNode( "<<n->GetID()<< ", "<< n->X()
{ if (py) *py<< " mesh.MoveNode( "<<n->GetID()<< ", "<< n->X()
<< ", "<<n->Y()<<", "<< n->Z()<< ")\t\t # "<< ln <<endl; }
void _dumpCmd(const string& txt, int ln)
{ *py<< " "<<txt<<" # "<< ln <<endl; }
{ if (py) *py<< " "<<txt<<" # "<< ln <<endl; }
void dumpFunctionEnd()
{ *py<< " return"<< endl; }
{ if (py) *py<< " return"<< endl; }
void dumpChangeNodes( const SMDS_MeshElement* f )
{ if (py) { *py<< " mesh.ChangeElemNodes( " << f->GetID()<<", [";
for ( int i=1; i < f->NbNodes(); ++i ) *py << f->GetNode(i-1)->GetID()<<", ";
*py << f->GetNode( f->NbNodes()-1 )->GetID() << " ])"<< endl; }}
#else
struct PyDump { PyDump() {} };
void dumpFunction(const string& fun ){}
void dumpFunctionEnd() {}
void dumpMove(const SMDS_MeshNode* n ){}
void dumpCmd(const string& txt){}
struct PyDump { void Finish() {} };
#define dumpFunction(f) f
#define dumpMove(n)
#define dumpCmd(txt)
#define dumpFunctionEnd()
#define dumpChangeNodes(f)
#endif
}
@ -905,6 +984,7 @@ SMESH_ComputeErrorPtr _ViscousBuilder::Compute(SMESH_Mesh& theMesh,
addBoundaryElements();
makeGroupOfLE(); // debug
debugDump.Finish();
return _error;
}
@ -1067,11 +1147,16 @@ bool _ViscousBuilder::findFacesWithLayers()
TopoDS_Vertex VV[2];
TopExp::Vertices( TopoDS::Edge( getMeshDS()->IndexToShape( edgeID )),VV[0],VV[1]);
if ( noShrinkVertices.Contains( VV[0] ) || noShrinkVertices.Contains( VV[1] ))
{
_sdVec[i]._noShrinkFaces.insert( getMeshDS()->ShapeToIndex( e2f->second ));
_sdVec[i]._shrinkShape2Shape.erase( e2f++ );
}
else
{
e2f++;
}
}
}
// Find the SHAPE along which to inflate _LayerEdge based on VERTEX
@ -1104,7 +1189,25 @@ bool _ViscousBuilder::findFacesWithLayers()
{
case 1:
{
_sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, facesWOL[0] )); break;
helper.SetSubShape( facesWOL[0] );
if ( helper.IsRealSeam( vInd )) // inflate along a seam edge?
{
TopoDS_Shape seamEdge;
PShapeIteratorPtr eIt = helper.GetAncestors(vertex, *_mesh, TopAbs_EDGE);
while ( eIt->more() && seamEdge.IsNull() )
{
const TopoDS_Shape* e = eIt->next();
if ( helper.IsRealSeam( *e ) )
seamEdge = *e;
}
if ( !seamEdge.IsNull() )
{
_sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, seamEdge ));
break;
}
}
_sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, facesWOL[0] ));
break;
}
case 2:
{
@ -1817,14 +1920,14 @@ void _LayerEdge::SetCosin( double cosin )
void _ViscousBuilder::getSimplices( const SMDS_MeshNode* node,
vector<_Simplex>& simplices,
const set<TGeomID>& ingnoreShapes,
const _SolidData* dataToCheckOri)
const _SolidData* dataToCheckOri,
const bool toSort)
{
SMESH_MeshEditor editor( _mesh );
SMDS_ElemIteratorPtr fIt = node->GetInverseElementIterator(SMDSAbs_Face);
while ( fIt->more() )
{
const SMDS_MeshElement* f = fIt->next();
const TGeomID shapeInd = editor.FindShape( f );
const TGeomID shapeInd = f->getshapeId();
if ( ingnoreShapes.count( shapeInd )) continue;
const int nbNodes = f->NbCornerNodes();
int srcInd = f->GetNodeIndex( node );
@ -1834,7 +1937,25 @@ void _ViscousBuilder::getSimplices( const SMDS_MeshNode* node,
std::swap( nPrev, nNext );
simplices.push_back( _Simplex( nPrev, nNext ));
}
simplices.resize( simplices.size() );
if ( toSort )
{
vector<_Simplex> sortedSimplices( simplices.size() );
sortedSimplices[0] = simplices[0];
int nbFound = 0;
for ( size_t i = 1; i < simplices.size(); ++i )
{
for ( size_t j = 1; j < simplices.size(); ++j )
if ( sortedSimplices[i-1]._nNext == simplices[j]._nPrev )
{
sortedSimplices[i] = simplices[j];
nbFound++;
break;
}
}
if ( nbFound == simplices.size() - 1 )
simplices.swap( sortedSimplices );
}
}
//================================================================================
@ -2053,10 +2174,12 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data,
TGeomID sInd = data._edges[ iBeg ]->_nodes[0]->getshapeId();
if ( data._edges[ iBeg ]->IsOnEdge() )
{ // try a simple solution on an analytic EDGE
if ( !smoothAnalyticEdge( data, iBeg, iEnd, surface, F, helper ))
{
dumpFunction(SMESH_Comment("smooth")<<data._index << "_Ed"<<sInd <<"_InfStep"<<nbSteps);
// try a simple solution on an analytic EDGE
if ( !smoothAnalyticEdge( data, iBeg, iEnd, surface, F, helper ))
{
// smooth on EDGE's
int step = 0;
do {
@ -2069,9 +2192,8 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data,
}
while ( moved && step++ < 5 );
//cout << " NB STEPS: " << step << endl;
dumpFunctionEnd();
}
dumpFunctionEnd();
}
else
{
@ -2327,21 +2449,35 @@ bool _ViscousBuilder::smoothAnalyticEdge( _SolidData& data,
data._edges[i]->_pos.back() = newPos;
SMDS_MeshNode* tgtNode = const_cast<SMDS_MeshNode*>( data._edges[i]->_nodes.back() );
tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() );
dumpMove( tgtNode );
}
}
else
{
gp_XY uv0 = helper.GetNodeUV( F, data._edges[iFrom]->_2neibors->_nodes[0]);
gp_XY uv1 = helper.GetNodeUV( F, data._edges[iTo-1]->_2neibors->_nodes[1]);
if ( data._edges[iFrom]->_2neibors->_nodes[0] ==
data._edges[iTo-1]->_2neibors->_nodes[1] ) // closed edge
{
int iPeriodic = helper.GetPeriodicIndex();
if ( iPeriodic == 1 || iPeriodic == 2 )
{
uv1.SetCoord( iPeriodic, helper.GetOtherParam( uv1.Coord( iPeriodic )));
if ( uv0.Coord( iPeriodic ) > uv1.Coord( iPeriodic ))
std::swap( uv0, uv1 );
}
}
const gp_XY rangeUV = uv1 - uv0;
for ( int i = iFrom; i < iTo; ++i )
{
double r = len[i-iFrom] / len.back();
gp_XY newUV = uv0 * ( 1. - r ) + uv1 * r;
gp_XY newUV = uv0 + r * rangeUV;
data._edges[i]->_pos.back().SetCoord( newUV.X(), newUV.Y(), 0 );
gp_Pnt newPos = surface->Value( newUV.X(), newUV.Y() );
SMDS_MeshNode* tgtNode = const_cast<SMDS_MeshNode*>( data._edges[i]->_nodes.back() );
tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() );
dumpMove( tgtNode );
SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( tgtNode->GetPosition() );
pos->SetUParameter( newUV.X() );
@ -2388,6 +2524,7 @@ bool _ViscousBuilder::smoothAnalyticEdge( _SolidData& data,
gp_Pnt newPos = surface->Value( newUV.X(), newUV.Y() );
SMDS_MeshNode* tgtNode = const_cast<SMDS_MeshNode*>( data._edges[i]->_nodes.back() );
tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() );
dumpMove( tgtNode );
SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( tgtNode->GetPosition() );
pos->SetUParameter( newUV.X() );
@ -3329,7 +3466,6 @@ bool _ViscousBuilder::shrink()
_SolidData& data = *f2sd->second;
TNode2Edge& n2eMap = data._n2eMap;
const TopoDS_Face& F = TopoDS::Face( getMeshDS()->IndexToShape( f2sd->first ));
const bool reverse = ( data._reversedFaceIds.count( f2sd->first ));
Handle(Geom_Surface) surface = BRep_Tool::Surface(F);
@ -3357,12 +3493,15 @@ bool _ViscousBuilder::shrink()
// Find out face orientation
double refSign = 1;
const set<TGeomID> ignoreShapes;
bool isOkUV;
if ( !smoothNodes.empty() )
{
gp_XY uv = helper.GetNodeUV( F, smoothNodes[0] );
vector<_Simplex> simplices;
getSimplices( smoothNodes[0], simplices, ignoreShapes );
if ( simplices[0].IsForward(uv, F, helper,refSign) != (!reverse))
helper.GetNodeUV( F, simplices[0]._nPrev, 0, &isOkUV ); // fix UV of silpmex nodes
helper.GetNodeUV( F, simplices[0]._nNext, 0, &isOkUV );
gp_XY uv = helper.GetNodeUV( F, smoothNodes[0], 0, &isOkUV );
if ( !simplices[0].IsForward(uv, smoothNodes[0], F, helper,refSign) )
refSign = -1;
}
@ -3410,8 +3549,10 @@ bool _ViscousBuilder::shrink()
}
}
// find out if a FACE is concave
const bool isConcaveFace = isConcave( F, helper );
// Create _SmoothNode's on face F
bool isOkUV;
vector< _SmoothNode > nodesToSmooth( smoothNodes.size() );
{
dumpFunction(SMESH_Comment("beforeShrinkFace")<<f2sd->first); // debug
@ -3420,7 +3561,7 @@ bool _ViscousBuilder::shrink()
const SMDS_MeshNode* n = smoothNodes[i];
nodesToSmooth[ i ]._node = n;
// src nodes must be replaced by tgt nodes to have tgt nodes in _simplices
getSimplices( n, nodesToSmooth[ i ]._simplices, ignoreShapes );
getSimplices( n, nodesToSmooth[ i ]._simplices, ignoreShapes, NULL, isConcaveFace );
// fix up incorrect uv of nodes on the FACE
helper.GetNodeUV( F, n, 0, &isOkUV);
dumpMove( n );
@ -3465,8 +3606,6 @@ bool _ViscousBuilder::shrink()
shrinked |= lEdges[i]->SetNewLength2d( surface,F,helper );
}
dumpFunctionEnd();
if ( !shrinked )
break;
// Move nodes on EDGE's
set< _Shrinker1D* >::iterator shr = eShri1D.begin();
@ -3487,7 +3626,8 @@ bool _ViscousBuilder::shrink()
moved = false;
for ( unsigned i = 0; i < nodesToSmooth.size(); ++i )
{
moved |= nodesToSmooth[i].Smooth( badNb,surface,helper,refSign,/*set3D=*/false );
moved |= nodesToSmooth[i].Smooth( badNb,surface,helper,refSign,
/*isCentroidal=*/isConcaveFace,/*set3D=*/false );
}
if ( badNb < oldBadNb )
nbNoImpSteps = 0;
@ -3517,17 +3657,20 @@ bool _ViscousBuilder::shrink()
highQuality = ( *nbNodesSet.begin() == 4 );
}
}
for ( int st = highQuality ? 8 : 3; st; --st )
if ( !highQuality && isConcaveFace )
fixBadFaces( F, helper ); // fix narrow faces by swaping diagonals
for ( int st = highQuality ? 10 : 3; st; --st )
{
dumpFunction(SMESH_Comment("shrinkFace")<<f2sd->first<<"_st"<<++smooStep); // debug
for ( unsigned i = 0; i < nodesToSmooth.size(); ++i )
nodesToSmooth[i].Smooth( badNb,surface,helper,refSign,/*set3D=*/st==1 );
nodesToSmooth[i].Smooth( badNb,surface,helper,refSign,
/*isCentroidal=*/isConcaveFace,/*set3D=*/st==1 );
dumpFunctionEnd();
}
// Set an event listener to clear FACE sub-mesh together with SOLID sub-mesh
_SrinkShapeListener::ToClearSubMeshWithSolid( sm, data._solid );
}// loop on FACES to srink mesh on
} // loop on FACES to srink mesh on
// Replace source nodes by target nodes in shrinked mesh edges
@ -3713,6 +3856,124 @@ bool _ViscousBuilder::prepareEdgeToShrink( _LayerEdge& edge,
// return true;
}
//================================================================================
/*!
* \brief Try to fix triangles with high aspect ratio by swaping diagonals
*/
//================================================================================
void _ViscousBuilder::fixBadFaces(const TopoDS_Face& F, SMESH_MesherHelper& helper)
{
SMESH::Controls::AspectRatio qualifier;
SMESH::Controls::TSequenceOfXYZ points(3), points1(3), points2(3);
const double maxAspectRatio = 4.;
// find bad triangles
vector< const SMDS_MeshElement* > badTrias;
vector< double > badAspects;
SMESHDS_SubMesh* sm = helper.GetMeshDS()->MeshElements( F );
SMDS_ElemIteratorPtr fIt = sm->GetElements();
while ( fIt->more() )
{
const SMDS_MeshElement * f = fIt->next();
if ( f->NbCornerNodes() != 3 ) continue;
for ( int iP = 0; iP < 3; ++iP ) points(iP+1) = SMESH_TNodeXYZ( f->GetNode(iP));
double aspect = qualifier.GetValue( points );
if ( aspect > maxAspectRatio )
{
badTrias.push_back( f );
badAspects.push_back( aspect );
}
}
if ( badTrias.empty() )
return;
// find couples of faces to swap diagonal
typedef pair < const SMDS_MeshElement* , const SMDS_MeshElement* > T2Trias;
vector< T2Trias > triaCouples;
TIDSortedElemSet involvedFaces, emptySet;
for ( size_t iTia = 0; iTia < badTrias.size(); ++iTia )
{
T2Trias trias [3];
double aspRatio [3];
int i1, i2, i3;
involvedFaces.insert( badTrias[iTia] );
for ( int iP = 0; iP < 3; ++iP )
points(iP+1) = SMESH_TNodeXYZ( badTrias[iTia]->GetNode(iP));
// find triangles adjacent to badTrias[iTia] with better aspect ratio after diag-swaping
int bestCouple = -1;
for ( int iSide = 0; iSide < 3; ++iSide )
{
const SMDS_MeshNode* n1 = badTrias[iTia]->GetNode( iSide );
const SMDS_MeshNode* n2 = badTrias[iTia]->GetNode(( iSide+1 ) % 3 );
trias [iSide].first = badTrias[iTia];
trias [iSide].second = SMESH_MeshEditor::FindFaceInSet( n1, n2, emptySet, involvedFaces,
& i1, & i2 );
if ( ! trias[iSide].second || trias[iSide].second->NbCornerNodes() != 3 )
continue;
// aspect ratio of an adjacent tria
for ( int iP = 0; iP < 3; ++iP )
points2(iP+1) = SMESH_TNodeXYZ( trias[iSide].second->GetNode(iP));
double aspectInit = qualifier.GetValue( points2 );
// arrange nodes as after diag-swaping
if ( helper.WrapIndex( i1+1, 3 ) == i2 )
i3 = helper.WrapIndex( i1-1, 3 );
else
i3 = helper.WrapIndex( i1+1, 3 );
points1 = points;
points1( 1+ iSide ) = points2( 1+ i3 );
points2( 1+ i2 ) = points1( 1+ ( iSide+2 ) % 3 );
// aspect ratio after diag-swaping
aspRatio[ iSide ] = qualifier.GetValue( points1 ) + qualifier.GetValue( points2 );
if ( aspRatio[ iSide ] > aspectInit + badAspects[ iTia ] )
continue;
if ( bestCouple < 0 || aspRatio[ bestCouple ] > aspRatio[ iSide ] )
bestCouple = iSide;
}
if ( bestCouple >= 0 )
{
triaCouples.push_back( trias[bestCouple] );
involvedFaces.insert ( trias[bestCouple].second );
}
else
{
involvedFaces.erase( badTrias[iTia] );
}
}
if ( triaCouples.empty() )
return;
// swap diagonals
SMESH_MeshEditor editor( helper.GetMesh() );
dumpFunction(SMESH_Comment("beforeSwapDiagonals_F")<<helper.GetSubShapeID());
for ( size_t i = 0; i < triaCouples.size(); ++i )
{
dumpChangeNodes( triaCouples[i].first );
dumpChangeNodes( triaCouples[i].second );
editor.InverseDiag( triaCouples[i].first, triaCouples[i].second );
}
dumpFunctionEnd();
// just for debug dump resulting triangles
dumpFunction(SMESH_Comment("swapDiagonals_F")<<helper.GetSubShapeID());
for ( size_t i = 0; i < triaCouples.size(); ++i )
{
dumpChangeNodes( triaCouples[i].first );
dumpChangeNodes( triaCouples[i].second );
}
}
//================================================================================
/*!
* \brief Move target node to it's final position on the FACE during shrinking
@ -3806,7 +4067,7 @@ bool _LayerEdge::SetNewLength2d( Handle(Geom_Surface)& surface,
//================================================================================
/*!
* \brief Perform laplacian smooth on the FACE
* \brief Perform smooth on the FACE
* \retval bool - true if the node has been moved
*/
//================================================================================
@ -3815,28 +4076,72 @@ bool _SmoothNode::Smooth(int& badNb,
Handle(Geom_Surface)& surface,
SMESH_MesherHelper& helper,
const double refSign,
bool isCentroidal,
bool set3D)
{
const TopoDS_Face& face = TopoDS::Face( helper.GetSubShape() );
// get uv of surrounding nodes
vector<gp_XY> uv( _simplices.size() );
for ( size_t i = 0; i < _simplices.size(); ++i )
uv[i] = helper.GetNodeUV( face, _simplices[i]._nPrev, _node );
// compute new UV for the node
gp_XY newPos (0,0);
for ( unsigned i = 0; i < _simplices.size(); ++i )
newPos += helper.GetNodeUV( face, _simplices[i]._nPrev );
if ( isCentroidal && _simplices.size() > 3 )
{
// average centers of diagonals wieghted with their reciprocal lengths
if ( _simplices.size() == 4 )
{
double w1 = 1. / ( uv[2]-uv[0] ).SquareModulus();
double w2 = 1. / ( uv[3]-uv[1] ).SquareModulus();
newPos = ( w1 * ( uv[2]+uv[0] ) + w2 * ( uv[3]+uv[1] )) / ( w1+w2 ) / 2;
}
else
{
double sumWeight = 0;
int nb = _simplices.size() == 4 ? 2 : _simplices.size();
for ( int i = 0; i < nb; ++i )
{
int iFrom = i + 2;
int iTo = i + _simplices.size() - 1;
for ( int j = iFrom; j < iTo; ++j )
{
int i2 = SMESH_MesherHelper::WrapIndex( j, _simplices.size() );
double w = 1. / ( uv[i]-uv[i2] ).SquareModulus();
sumWeight += w;
newPos += w * ( uv[i]+uv[i2] );
}
}
newPos /= 2 * sumWeight;
}
}
else
{
// Laplacian smooth
isCentroidal = false;
for ( size_t i = 0; i < _simplices.size(); ++i )
newPos += uv[i];
newPos /= _simplices.size();
}
// count quality metrics (orientation) of triangles around the node
int nbOkBefore = 0;
gp_XY tgtUV = helper.GetNodeUV( face, _node );
for ( unsigned i = 0; i < _simplices.size(); ++i )
nbOkBefore += _simplices[i].IsForward( tgtUV, face, helper, refSign );
nbOkBefore += _simplices[i].IsForward( tgtUV, _node, face, helper, refSign );
int nbOkAfter = 0;
for ( unsigned i = 0; i < _simplices.size(); ++i )
nbOkAfter += _simplices[i].IsForward( newPos, face, helper, refSign );
nbOkAfter += _simplices[i].IsForward( newPos, _node, face, helper, refSign );
if ( nbOkAfter < nbOkBefore )
{
// if ( isCentroidal )
// return Smooth( badNb, surface, helper, refSign, !isCentroidal, set3D );
badNb += _simplices.size() - nbOkBefore;
return false;
}
SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( _node->GetPosition() );
pos->SetUParameter( newPos.X() );

View File

@ -688,3 +688,7 @@ QString StdMeshersGUI_CartesianParamCreator::storeParams() const
return "";
}
QString StdMeshersGUI_CartesianParamCreator::helpPage() const
{
return "cartesian_algo_page.html#cartesian_hyp_anchor";
}

View File

@ -126,6 +126,7 @@ public:
virtual ~StdMeshersGUI_CartesianParamCreator();
virtual bool checkParams( QString& ) const;
virtual QString helpPage() const;
protected:
virtual QFrame* buildFrame();

View File

@ -165,7 +165,8 @@
</message>
<message>
<source>SMESH_FACES_WO_LAYERS</source>
<translation>Faces without layers</translation>
<translation>Faces without layers
(inlets and oulets)</translation>
</message>
<message>
<source>SMESH_MAX_LENGTH_TITLE</source>

View File

@ -139,6 +139,10 @@
<source>SMESH_MAX_LENGTH_HYPOTHESIS</source>
<translation>Longueur maximale</translation>
</message>
<message>
<source>SMESH_CARTESIAN_PARAMS_HYPOTHESIS</source>
<translation>Paramètres de Body Fitting</translation>
</message>
<message>
<source>SMESH_USE_PREESTIMATED_LENGTH</source>
<translation>Utiliser la longueur pré-estimée</translation>
@ -157,16 +161,21 @@
</message>
<message>
<source>SMESH_STRETCH_FACTOR</source>
<translation>Facteur d'échelle</translation>
<translation>Facteur d&apos;échelle</translation>
</message>
<message>
<source>SMESH_FACES_WO_LAYERS</source>
<translation>Faces sans couche limite</translation>
<translation>Faces sans couche limite
(entrées et sorties)</translation>
</message>
<message>
<source>SMESH_MAX_LENGTH_TITLE</source>
<translation>Construction de l&apos;hypothèse</translation>
</message>
<message>
<source>SMESH_CARTESIAN_PARAMS_TITLE</source>
<translation>Construction de l&apos;hypothèse</translation>
</message>
<message>
<source>SMESH_MAX_ELEMENT_AREA_HYPOTHESIS</source>
<translation>Aire maximale d&apos;une maille</translation>
@ -434,4 +443,42 @@
<translation>Editer</translation>
</message>
</context>
<context>
<name>StdMeshersGUI_CartesianParamCreator</name>
<message>
<source>THRESHOLD</source>
<translation>Seuil</translation>
</message>
<message>
<source>AXIS_X</source>
<translation>Axe X</translation>
</message>
<message>
<source>AXIS_Y</source>
<translation>Axe Y</translation>
</message>
<message>
<source>AXIS_Z</source>
<translation>Axe Z</translation>
</message>
</context>
<context>
<name>StdMeshersGUI::GridAxisTab</name>
<message>
<source>GRID_DEF_MODE</source>
<translation>Mode de définition</translation>
</message>
<message>
<source>SPACING</source>
<translation>Espacement</translation>
</message>
<message>
<source>INSERT</source>
<translation>Insérer</translation>
</message>
<message>
<source>COORD_STEP</source>
<translation>Pas</translation>
</message>
</context>
</TS>

View File

@ -25,6 +25,4 @@
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
SUBDIRS = MeshCut
DIST_SUBDIRS = MeshCut
SUBDIRS = MeshCut padder

View File

@ -45,11 +45,15 @@ MeshCut_LDFLAGS = $(MED2_LIBS) $(HDF5_LIBS)
UIPY_FILES = MeshCutDialog.py
BUILT_SOURCES = $(UIPY_FILES)
bin_SCRIPTS = $(UIPY_FILES) meshcut_plugin.py
clean-local:
rm -f $(UIPY_FILES)
EXTRA_DIST += MeshCutDialog.ui meshcut_plugin.py
if SMESH_ENABLE_GUI
dist_salomescript_SCRIPTS = meshcut_plugin.py
nodist_salomescript_SCRIPTS = $(UIPY_FILES)
endif
CLEANFILES = $(UIPY_FILES)
EXTRA_DIST += $(UIPY_FILES:%.py=%.ui)
%.py : %.ui
pyuic4 $< -o $@
$(PYUIC) $< -o $@

View File

@ -0,0 +1,3 @@
SUBDIRS = meshjob spadderpy unittests resources doc
EXTRA_DIST = README.txt

View File

@ -0,0 +1,38 @@
PADDER overview
---------------
PADDER is an algorithm that creates a set of particules called a "discrete mesh".
The particules are characterized by a location in space and a weight that can be considered
as the radius of a sphere whose center is the location of the particule.
Discrete meshes are typically used to modelize civil components in rapid dynamic
computation problems (seisms, chocs). These components consists in concrete parts
embedding steal bares for reinforcement. These parts are input to the algorithm
as standard finite elements meshes. The cells of theses meshes drive the location
and sizing of particules.
In the med representation, a discrete mesh is described as MED_BALL elements.
A MED_BALL element is defined by a location and a radius.
PADDER plugin
-------------
This directory provides SMESH with a SALOME plugin that can be used to define
and then run a PADDER execution. The inputs are the FE meshes that describe
the concrete parts and steal bares parts. The output is a discrete mesh
containing MED_BALL elements.
A graphical interface is used to drive the user for data input and computation
supervision (the algorithm may last more than an hour long), and finally the publication
of the resulting mesh (when succeed) in the SALOME study.
Technically speaking, the PADDER plugin consists in:
* a SALOME component MESHJOB that do the computation job (wrapper to the padder executable program)
* a graphical interface composed of two dialog windows
* a configuration mechanism (data file and read function), to define
the computation resource (a SALOME resource + the software configuration of the padder executable
program on this resource)
* an integration file (salomeplugin.py)

View File

@ -0,0 +1,39 @@
# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
# 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
#
# Author : Guillaume Boulant (EDF/R&D)
include $(top_srcdir)/adm_local/unix/make_common_starter.am
EXTRA_DIST += images input
#
# The simplest way to extend the documentation of SMESH with the
# documentation for PADDER is to add path to the padder documentation
# in the SMESH gui documentation (see the doxyfile).
#
# For test purpose, we let the user generate a local dosygen
# documentation including only the local pages
#
test_docs: doxyfile
echo "===========================================" ; \
echo "Generating PADDER documentation" ; \
echo "===========================================" ; \
$(DOXYGEN) doxyfile ;

View File

@ -0,0 +1,77 @@
# Copyright (C) 2007-2011 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
#
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "SALOME Mesh User's Guide"
OUTPUT_DIRECTORY = .
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
TAB_SIZE = 5
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
#---------------------------------------------------------------------------
#Input related options
#---------------------------------------------------------------------------
INPUT = @srcdir@/input
FILE_PATTERNS = *.doc
EXCLUDE =
IMAGE_PATH = @srcdir@/images
EXAMPLE_PATH = @top_srcdir@/src/SMESH_SWIG
#---------------------------------------------------------------------------
#HTML related options
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = .
HTML_HEADER = @top_builddir@/doc/salome/gui/SMESH/static/header.html
HTML_FOOTER = @top_srcdir@/doc/salome/gui/SMESH/static/footer.html
HTML_STYLESHEET = @top_srcdir@/doc/salome/gui/SMESH/static/doxygen.css
TOC_EXPAND = YES
DISABLE_INDEX = NO
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 300
#---------------------------------------------------------------------------
#SORT related options
#---------------------------------------------------------------------------
SORT_GROUP_NAMES = NO
#---------------------------------------------------------------------------
#LaTeX related option
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
EXTRA_PACKAGES = amsmath
#---------------------------------------------------------------------------
#RTF related options
#---------------------------------------------------------------------------
GENERATE_RTF = NO
SEARCHENGINE = YES

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

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