Merge from V6_main 13/12/2012

This commit is contained in:
vsr 2012-12-13 11:41:29 +00:00
parent e6fb82fec1
commit 1067ffa6e7
239 changed files with 10508 additions and 6958 deletions

View File

@ -574,6 +574,7 @@ AC_OUTPUT([ \
src/SMESH_PY/Makefile \
src/Tools/Makefile \
src/Tools/MeshCut/Makefile \
src/Tools/YamsPlug/Makefile \
src/Tools/padder/Makefile \
src/Tools/padder/meshjob/Makefile \
src/Tools/padder/meshjob/idl/Makefile \
@ -587,8 +588,7 @@ AC_OUTPUT([ \
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/resources/testdata/Makefile \
src/Tools/padder/unittests/Makefile \
src/Tools/padder/unittests/autotest.sh \
src/Tools/padder/doc/Makefile \

View File

@ -0,0 +1,78 @@
# Copyright (C) 2012 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
#
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake)
SET(top_builddir ${CMAKE_BINARY_DIR})
SET(top_srcdir ${CMAKE_SOURCE_DIR})
SET(srcdir ${CMAKE_CURRENT_SOURCE_DIR})
SET(builddir ${CMAKE_CURRENT_BINARY_DIR})
SET(datadir ${CMAKE_INSTALL_PREFIX}/share)
SET(docdir ${datadir}/doc/salome)
SET(guidocdir ${docdir}/gui/SMESH)
SALOME_CONFIGURE_FILE(doxyfile.in doxyfile)
SALOME_CONFIGURE_FILE(doxyfile_py.in doxyfile_py)
SALOME_CONFIGURE_FILE(static/header.html.in ${builddir}/static/header.html)
SALOME_CONFIGURE_FILE(static/header_py.html.in ${builddir}/static/header_py.html)
SALOME_INSTALL_SCRIPTS(collect_mesh_methods.py bin/salome)
SET(DOC_SMESH_MeshersList StdMeshers)
SET(f1 "${srcdir}/collect_mesh_methods.py")
SET(f "$ENV{KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py")
IF(WINDOWS)
STRING(REPLACE "/" "\\" f ${f})
STRING(REPLACE "/" "\\" f1 ${f1})
STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${OMNIORB_ROOT_USER}/lib/x86_win32\;%PYTHONPATH%
@SET PYTHONPATH=${OMNIORB_ROOT_USER}/lib/python\;%PYTHONPATH%
@SET PATH=${OMNIORB_ROOT_USER}/lib/x86_win32\;%PATH%
@SET PATH=$ENV{KERNEL_ROOT_DIR}/lib/salome\;%PATH%
@SET PYTHONPATH=$ENV{KERNEL_ROOT_DIR}/bin/salome\;%PYTHONPATH%
@SET PYTHONPATH=$ENV{KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
@SET PYTHONPATH=$ENV{MED_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
@SET PYTHONPATH=$ENV{MED_ROOT_DIR}/bin/salome\;%PYTHONPATH%
@SET PYTHONPATH=$ENV{GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
@SET PYTHONPATH=$ENV{GEOM_ROOT_DIR}/bin/salome\;%PYTHONPATH%
@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome\;%PYTHONPATH%
@SET SMESH_MeshersList=${DOC_SMESH_MeshersList}
")
SET(EXT "bat")
SET(CALL_STR "call")
ELSE(WINDOWS)
SET(DOC_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/bin/salome:${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome:${MED_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${GEOM_ROOT_DIR}/bin/salome:${GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${KERNEL_ROOT_DIR}/bin/salome:${KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${OMNIORB_ROOT_USER}/lib/python${PYTHON_VERSION}/site-packages:${OMNIORB_ROOT_USER}/lib64/python${PYTHON_VERSION}/site-packages")
SET(SCR "export PYTHONPATH=${DOC_PYTHONPATH}:${PYTHONPATH}
export SMESH_MeshersList=${DOC_SMESH_MeshersList}
")
SET(EXT "sh")
SET(CALL_STR ".")
ENDIF(WINDOWS)
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} "${SCR}")
ADD_CUSTOM_TARGET(usr_docs ${PYTHON_EXECUTABLE} ${f} smesh.py ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smeshDC.py smesh
COMMAND mkdir tmp && ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} && ${PYTHON_EXECUTABLE} ${f1} -o tmp/smesh.py StdMeshers
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
COMMAND ${PYTHON_EXECUTABLE} -c "import os, shutil; os.remove(r'''smesh.py'''); shutil.rmtree(r'''tmp''')"
COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/SMESH''', True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/SMESH''', ignore=shutil.ignore_patterns('tmp_env.*', '*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*')); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/head.png''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/SMESH''')"
VERBATIM
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -18,11 +18,11 @@ different meshing parameters than the whole mesh.
Several created meshes can be \subpage building_compounds_page "combined into another mesh".
The whole mesh or it's part can be \subpage copy_mesh_page "copied" into another mesh.
The whole mesh or its part can be \subpage copy_mesh_page "copied" into another mesh.
Meshing parameters of meshes and sub-meshes can be
\subpage editing_meshes_page "edited", then only a path of mesh
depending on changed parameters will be re-computed.
\subpage editing_meshes_page "edited", then only the mesh part
depending on the changed parameters will be re-computed.
Meshes can be edited using the MESH functions destined for
\ref modifying_meshes_page "modification" of generated meshes.

View File

@ -7,6 +7,7 @@
<ul>
<li>\ref adding_nodes_anchor "Nodes"</li>
<li>\ref adding_0delems_anchor "0D Elements"</li>
<li>\ref adding_0delems_on_all_nodes_anchor "0D elements on Element Nodes"</li>
<li>\ref adding_balls_anchor "Ball Elements"</li>
<li>\ref adding_edges_anchor "Edges"</li>
<li>\ref adding_triangles_anchor "Triangles"</li>
@ -23,19 +24,19 @@
<li>Select your mesh in the Object Browser or in the 3D viewer.</li>
<li>From the \b Modification menu choose the \b Add item, the
following associated submenu will appear:</li>
following associated sub-menu will appear:</li>
\image html image146.png
From this submenu select the type of element which you would like to add to your mesh.
From this sub-menu select the type of element which you would like to add to your mesh.
\note All dialogs for new node or element adding to the mesh (except for
the dialog for 0D elements) provide the possibility to automatically add
a node or element to the specified group or to create the anew using
\note All dialogs for new node or element adding to the mesh provide
the possibility to automatically add
a node or element to the specified group or to create it anew using
<b>Add to group</b> box, that allows choosing an existing group for
the created node or element or giving the name to a new group. By
default, the <b>Add to group</b> check box is switched off. If the user
swiches this check box on, the combo box listing all currently
switches this check box on, the combo box listing all currently
existing groups of the corresponding type becomes available. By
default, no group is selected. In this case, when the user presses
<b>Apply</b> or <b>Apply & Close</b> button, the warning message box
@ -71,21 +72,50 @@ created:
\image html add0delement.png
In this dialog box specify the node which will form your 0d element by
selecting it in the 3D viewer and click the \b Apply or
<b>Apply and Close</b> button. Your 0D element will be created:
In this dialog box specify nodes which will form your 0D elements by
selecting them in the 3D viewer and click the \b Apply or
<b>Apply and Close</b> button. Your 0D elements will be created:
\image html add_0delement.png
\anchor adding_0delems_on_all_nodes_anchor
<h2>Making 0D elements on Element Nodes</h2>
There is another way to create 0D elements. It is possible to create
0D elements on all nodes of the selected mesh, sub-mesh, or a group of elements or nodes.
\image html dlg_0D_on_all_nodes.png
In this dialog
<ul>
<li> The radio-buttons allow choosing the type of object to create 0D elements on.
<ul>
<li><b> Mesh, sub-mesh, group </b> - this button allows selecting
a mesh, a sub-mesh or a group to create 0D elements on the nodes of its
elements. The name of the selected object is shown in the dialog. </li>
<li><b> Elements </b> - this button allows selecting elements in the
VTK viewer or typing their IDs in the dialog.</li>
<li><b> Nodes </b> - this button allows selecting nodes to create
0D elements on in the VTK viewer or typing their IDs in the dialog.</li>
</ul></li>
<li><b> Set Filter </b> button allows selecting elements or nodes
by filtering mesh elements or nodes with different criteria
(see \ref filtering_elements "Filter usage").</li>
<li> Switching on <b>Add to group</b> check-box allows specifying the
name of the group to which all created or found 0D elements will be added. You can either select an existing group from
a drop-down list, or enter the name of the group to be created.</li>
</ul>
\anchor adding_balls_anchor
<h2>Adding ball elements</h2>
\image html addball.png
In this dialog box specify the node which will form your ball element
either by selecting it in the 3D viewer or by manual entering its ID,
specify a ball diameter and click the \b Apply or <b>Apply and
Close</b> button. Your ball element will be created:
In this dialog box specify the nodes, which will form your ball elements,
either by selecting them in the 3D viewer or by manually entering their IDs,
specify the ball diameter and click the \b Apply or <b>Apply and
Close</b> button.
\image html add_ball.png

View File

@ -20,8 +20,8 @@ adjacent elements).
<h2>Quadratic Mesh</h2>
Quadratic Mesh hypothesis allows to build a quadratic mesh (whose
edges are not straight but broken lines and can be defined by three
points: first, middle and last) instead of an ordinary one.
edges are not straight but curved lines and can be defined by three
points: first, middle and last instead of an ordinary two).
\anchor propagation_anchor
<h2>Propagation of 1D Hypothesis on opposite edges</h2>
@ -47,27 +47,34 @@ hypothesis, this hypothesis has one restriction on its work: the total quantity
segments on all four sides of the face must be even (divisible by 2).
\anchor viscous_layers_anchor
<h2>Viscous Layers</h2>
<b>Viscous Layers</b> additional hypothesis can be used together with
some 3D algorithms, Hexahedron(i,j,k) for example. This
hypothesis allows creation of layers of highly stretched prisms near
mesh boundary, which is beneficial for high quality viscous
computations. The prisms constructed on the quadrangular mesh faces are
actually the hexahedrons.
<h2>Viscous Layers and Viscous Layers 2D</h2>
<b>Viscous Layers</b> and <b>Viscous Layers 2D </b> additional
hypotheses can be used together with some 3D algorithms, for example,
Hexahedron(i,j,k) or 2D algorithms, for example, Triangle
(MEFISTO), correspondingly. These hypotheses allow creation of layers
of highly stretched elements, prisms in 3D and quadrilaterals in 2D,
near mesh boundary, which is beneficial for high quality viscous
computations.
\image html viscous_layers_hyp.png
<ul>
<li><b>Name</b> - allows to define the name of the hypothesis.</li>
<li><b>Total thicknes</b> - gives the total thickness of prism layers.</li>
<li><b>Number of layers</b> - defines the number of prism layers.</li>
<li><b>Stretch factor</b> - defines the growth factor of prism height
<li><b>Total thickness</b> - gives the total thickness of element layers.</li>
<li><b>Number of layers</b> - defines the number of element layers.</li>
<li><b>Stretch factor</b> - defines the growth factor of element height
from the mesh boundary inwards.</li>
<li><b>Faces without layers</b> - defines geometrical faces on which
prism layers should not be constructed. By default the prism layers
are not constructed on geometrical faces shared by solids.</li>
<li><b>Faces (Edges) without layers</b> - defines geometrical faces
(or edges in 2D) on which element layers should not be
constructed. By default the element layers are not constructed on
geometrical faces shared by solids (and edges shared by faces in 2D).
\note A mesh shown in the 3D Viewer can prevent selection of faces
and edges, in this case just hide the mesh. To avoid a long wait when a
geometry with many faces (or edges) is displayed, the number of faces
(edges) shown at a time is limited by the value of "Sub-shapes
preview chunk size" preference (in Preferences/Mesh/General tab).
</li>
</ul>
\image html viscous_layers_mesh.png A group containing viscous layer prisms.

View File

@ -64,7 +64,7 @@ There is also a number of more specific algorithms:
</ul>
\ref use_existing_anchor "Use existing edges" and
\ref use_existing_anchor "Use existing faces" algorithms can be
used to create an 1D or a 2D mesh in a python script.
used to create a 1D or a 2D mesh in a python script.
\ref constructing_meshes_page "Constructing meshes" page describes in
detail how to apply meshing algorithms.

View File

@ -14,7 +14,7 @@ shown.
- \b Nodes:
- \b Color - color of nodes.
- \b Type and \b Scale - these options allow changing of the nodes
- \b Type and \b Scale - these options allow changing the nodes
representation (see \subpage point_marker_page "Point Marker" page
for more details).
- <b>Edges / wireframe</b>:
@ -23,13 +23,13 @@ shown.
in wireframe mode).
- \b Faces:
- \b Front - surface color of face elements (seen in shading mode).
- \b Back - backside surface color of face elements. Use slider to
select this color generated on base of the \b Face color by
- \b Back - backside surface color of face elements. Use the slider to
select this color generated on the base of the \b Face color by
changing its brightness and saturation.
- \b Volumes:
- \b Normal - surface color of normal volume elements (seen in shading mode).
- \b Reversed - surface color of volume elements. Use slider to
select this color generated on base of the \b Normal color by
- \b Reversed - surface color of volume elements. Use the slider to
select this color generated on the base of the \b Normal color by
changing its brightness and saturation.
- \b Outlines:
- \b Color - color of element borders in shading mode.

View File

@ -37,42 +37,42 @@ written in Python.
"Create mesh" dialog box contains several tab pages titled \b 3D,
\b 2D, \b 1D and \b 0D. The title of each page reflects the
dimension of the CAD model (geometry) the algorithms listed on
this page affect to. For example, \b 3D page lists algorithms
this page affect. For example, \b 3D page lists the algorithms
that affect 3D geometrical objects (solids).
\note
- Some page(s) can be disabled - if the source geometrical
- Some page(s) can be disabled if the source geometrical
object does not include shapes (sub-shapes) of the corresponding
dimension(s). For example, if input object is a geometrical face,
dimension(s). For example, if the input object is a geometrical face,
\b 3D page is disabled.
- Some algorithms affect on geometry of several dimensions,
i.e. "1D-2D" or "1D-2D-3D". If such algorithm is selected by the
user, dialog box pages related to the corresponding lower level
- Some algorithms affect the geometry of several dimensions,
i.e. "1D-2D" or "1D-2D-3D". If such an algorithm is selected by the
user, the dialog box pages related to the corresponding lower level
dimensions are disabled.
- \b 0D page does not refer to the 0D elements, but to 0D
geometry (vertices). Mesh module does not provide algorithms that
produce 0D elements. Currently \b 0D page provides only one
algorithm "Segments around vertex" that allows specyfing required
size of mesh edges about some selected vertex(vertices).
algorithm "Segments around vertex" that allows specyfying the required
size of mesh edges about the selected vertex (or vertices).
For example, you need to mesh a 3D object.
First, type the name for your mesh in the \b Name box, by default,
First, type the name of your mesh in the \b Name box, by default,
it is "Mesh_1". Then select the geometrical object you wish to
mesh in the Object Browser and click "Select" button near \b Geometry
field (if name of the object not yet appeared in \b Geometry field).
field (if the name of the object has not yet appeared in \b Geometry field).
\image html image120.png
<em>"Select" button</em>
Now you can define 3D Algorithm and 3D Hypotheses, which will be
applied to solids of your geometrical object. Click the <em>"Add
applied to the solids of your geometrical object. Click the <em>"Add
Hypothesis"</em> button to add a hypothesis.
\image html image121.png
<em>"Add Hypothesis" button</em>
Click the <em>"Edit Hypothesis"</em> button to change values for the
Click the <em>"Edit Hypothesis"</em> button to change the values for the
current hypothesis.
\image html image122.png
@ -86,14 +86,14 @@ written in Python.
will be used to mesh faces and edges of your geometry. (Note
that any object has edges, even if their existence is not
apparent, for example, a sphere has 4 edges). Note that the
choice of hypotheses and of an algorithm of lower dimension depends on
the algorithm.
choice of hypotheses and lower dimension algorithms depends on
the higher dimension algorithm.
Some algorithms generate mesh of several dimensions while others, of
only one dimension. In the latter case there must be one Algorithm and zero or several
Some algorithms generate mesh of several dimensions, while others
produce mesh of only one dimension. In the latter case there must be one Algorithm and zero or several
Hypotheses for each dimension of your object, otherwise you will
not get any mesh at all. Of course, if you wish to mesh a face,
which is a 2D object, you don't need to define 3D Algorithm and
which is a 2D object, you do not need to define a 3D Algorithm and
Hypotheses.
In the <b>Object Browser</b> the structure of the new mesh will be
@ -122,7 +122,7 @@ written in Python.
tags).
\image html hypo_sets.png
List of sets of hypotheses: <em>[custom]</em>
List of sets of hypotheses. Tag <em>[custom]</em> is
automatically added to the sets defined by the user
</li>
</ol>
@ -164,7 +164,7 @@ Select <b>1D mesh</b> or <b>2D mesh</b> preview mode in the Preview dialog.
<b>Compute</b> button computes the whole mesh.
When the Preview dialog is closed, the question about the storage of temporarily
created mesh elements appers:
created mesh elements appears:
\image html preview_tmp_data.png
@ -185,7 +185,7 @@ Choose "Change submesh priority" from the Mesh menu or a pop-up
menu. The opened dialog shows a list of submeshes in the order of
their priority.
There is an example of submesh order modifications of the Mesh created on a Box
There is an example of submesh order modifications taking a Mesh created on a Box
shape. The main Mesh object:
<ul>
<li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=20</li>
@ -195,22 +195,22 @@ shape. The main Mesh object:
The first submesh object <b>Submesh_1</b> created on <b>Face_1</b> is:
<ul>
<li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=4</li>
<li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>MaxElementArea</b>=1200</li>
<li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis <b>MaxElementArea</b>=1200</li>
</ul>
The second submesh object <b>Submesh_2</b> created on <b>Face_2</b> is:
<ul>
<li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=8</li>
<li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>MaxElementArea</b>=1200</li>
<li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis <b>MaxElementArea</b>=1200</li>
</ul>
And the last submesh object <b>Submesh_3</b> created on <b>Face_3</b> is:
<ul>
<li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=12</li>
<li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>MaxElementArea</b>=1200</li>
<li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis <b>MaxElementArea</b>=1200</li>
</ul>
The sub-meshes become concurrent if they share sub-shapes that can be
meshed with different algorithms (or different hypothesises). In the
meshed with different algorithms (or different hypotheses). In the
example, we have three submeshes with concurrent algorithms, because
they have different hypotheses.
@ -289,21 +289,21 @@ visualizing in magenta the geometrical entity that causes it.
"Mesh computation/Show a computation result notification" preference
to the "Never" value. This option gives the possibility to control mesh
computation reporting. There are the following possibilities: always
show information box, only if an error occurs or never.
show the information box, show only if an error occurs or never.
By default, the information box is always shown after mesh computation operation.
<b>Publish Sub-shape</b> button publishes the sub-shape, whose meshing
failed, in GEOM component as a child of the mesh geometry, which
has failed, in GEOM component as a child of the mesh geometry, which
allows analyzing the problem geometry and creating a submesh on it in
order to locally tune hypotheses.
order to locally tune the hypotheses.
If a cause of failure is an invalid input mesh and the algorithm has
provided information on what mesh entities are bad <b>Show bad Mesh</b>
button appears in the dialog. Clicked, it shows bad mesh entities in
If the failure is caused by an invalid input mesh and the algorithm has
found which mesh entities are bad, <b>Show bad Mesh</b>
button appears in the dialog. Clicked, it shows the bad mesh entities in
the Viewer in magenta. Sometimes the shown mesh entities are too small
or/and hidden by other mesh elements, to see them it can be helpful to
switch the mesh to Wireframe visualization mode or to switch off
visualization of faces and volumes (if any).
or/and hidden by other mesh elements. They can be seen after
switching the mesh to Wireframe visualization mode or switching off
the visualization of faces and volumes (if any).
\image html show_bad_mesh.png
<em>Too close nodes causing meshing failure are shown in magenta using <b>Show
@ -313,22 +313,22 @@ visualization of faces and volumes (if any).
\anchor use_existing_anchor
<h2>"Use existing edges" and "Use existing faces" algorithms</h2>
It is possible to create an 1D or a 2D mesh in a python script
It is possible to create a 1D or a 2D mesh in a python script
(using <em>AddNode, AddEdge</em> and <em>AddFace</em> commands) and
then use such sub-meshes in the construction of a 2D or a 3D mesh. For
this, there exist two algorithms: <b>Use existing edges</b> and <b>Use
existing faces</b>. Scenario of their usage is following. For
example, you want to use standard algorithms to generate 1D and 3D
existing faces</b>.
For example, you want to use standard algorithms to generate 1D and 3D
meshes and to create 2D mesh by your python code. Then you
<ul>
<li> create a mesh object, assign an 1D algorithm,</li>
<li> invoke \b Compute command, which computes an 1D mesh,</li>
<li> create a mesh object, assign a 1D algorithm,</li>
<li> invoke \b Compute command, which computes a 1D mesh,</li>
<li> assign <b>Use existing faces</b> and a 3D algorithm,</li>
<li> run your python code, which creates a 2D mesh,</li>
<li> invoke \b Compute command, which computes a 3D mesh.</li>
</ul>
Consider trying a sample script demonstrating usage of
Consider trying a sample script demonstrating the usage of
\ref tui_use_existing_faces "Use existing faces" algorithm for
construction of a 2D mesh using Python commands.

View File

@ -18,7 +18,9 @@ while the box is a 3D object. <br>
will be used. This means that an edge shared by two faces each having
its own different sub-mesh, will be meshed using algorithms and
hypotheses of any of the two, chosen randomly. This indeterminacy can
be fixed by defining \ref submesh_order_anchor "Sub-mesh priority".
be fixed by defining \ref submesh_order_anchor "Sub-mesh priority". The
default sub-meshes priority is such that multi-dimensional algorithms
are processed first.
<br>
\n Construction of a sub-mesh consists of:
@ -54,30 +56,32 @@ sub-mesh. You can define algorithms and hypotheses in the same way as
in \ref constructing_meshes_page "Create mesh" menu.
\par
If the parent mesh is already computed, then you can define
If the parent mesh is already computed, then you can define the
\b Geometry by picking mesh elements computed on a sub-shape of interest
in the 3D Viewer, i.e. you don't have to extract this sub-shape
previously in Geometry module. To start element selection, press \a
in the 3D Viewer, i.e. you do not have to extract this sub-shape
in Geometry module beforehand. To start element selection, press \a
Selection button to the right of \b Geometry label. If this button is
already down, then click it to release and then click it again. The
following pop-up menu to choose a way of geometry definition will
following pop-up menu allowing to choose a way of geometry definition will
appear.
\par
\image html choose_geom_selection_way.png
\par
There the first item enables selecting the sub-shape in the Object
Browser, the second one makes appear the following dialog.
<b>Direct geometry selection</b> enables selecting the sub-shape in the Object
Browser.
<b>Find geometry by mesh element selection</b> activates the following dialog.
\par
\image html find_geom_by_mesh_elem.png
\par
In this dialog, <b> Element Type </b> defines kind of element to pick in the
Viewer. Instead of picking an element in the Viewer, you can type its
ID in <b> Element ID</b> field. <b> Geometry name </b> allow you
define a name of the sub-shape with which it will be published in the Study.
Viewer.
Instead of picking an element in the Viewer, you can type its
ID in <b> Element ID</b> field.
<b> Geometry name </b> field allows defining a name of the sub-shape.
\par

View File

@ -15,6 +15,8 @@ viewer.</li>
elements which will form your group:</li>
<ul>
<li><b>Nodes</b></li>
<li><b>0D Element</b></li>
<li><b>Ball</b></li>
<li><b>Edges</b></li>
<li><b>Faces</b></li>
<li><b>Volumes</b></li>

View File

@ -28,7 +28,7 @@ the ID of this quadrangle will be added to the list. To remove a
selected element or elements from the list click \b Remove button. <b>Sort
list</b> button allows to sort the list of IDs. \b Filter button allows to
apply a definite filter to the selection of quadrangles.</li>
<li><b>Apply to all</b> radio button allows to modify the orientation of all
<li><b>Apply to all</b> check box allows to modify the orientation of all
quadrangles of the currently displayed mesh or sub-mesh.</li>
<li>\b Preview - provides a preview of cutting in the viewer.</li>
</ul>
@ -39,8 +39,19 @@ quadrangles of the currently displayed mesh or sub-mesh.</li>
<li><b>Use diagonal 1-3</b> and <b>Use diagonal 2-4</b> allows to
specify the opposite corners which will be connected by the cutting
edge.</li>
<li><b>Use numeric factor</b> - allows to chose a quality criterion
optimization of which will be used to select the cutting edge.</li>
<li><b>Use numeric functor</b> - allows to choose a quality criterion
which will be optimized at the outcome of the operation.
<ul>
<li><b>Minimum diagonal</b> - cuts by the shortest edge.</li>
<li><b>Aspect Ratio</b> - cuts by the edge splitting the quadrangle
into triangles with optimal \ref aspect_ratio_page "Aspect Ratio". The reference value is 1.</li>
<li><b>Minimum Angle</b> - cuts by the edge splitting the quadrangle
into triangles with optimal \ref minimum_angle_page "Minimum Angle". The reference value is 60 degrees.</li>
<li><b>Skew</b> - cuts by the edge splitting the quadrangle
into triangles with optimal \ref skew_page "Skew". The reference value
is 0.0 degrees.</li>
</ul>
</li>
</ul>
</li>
<li><b>Select from</b> - allows to choose a sub-mesh or an existing

View File

@ -3,18 +3,27 @@
\page extrusion_page Extrusion
\n Extrusion is used to build mesh elements of plus one
dimension than the input ones. Any line or planar element can be
extruded. Line elements will extrude into quadrilateral plane elements.
Triangular and Quadrilateral plane elements extrude into Pentahedron
and Hexahedron solids respectively.
dimension than the input ones. Any node, segment or 2D element can be
extruded. Each type of elements has a corresponding type of extruded elements:
<table>
<tr><td><b>Extruded element</b></td><td><b> Result elements </b></td></tr>
<tr><td>Node </td><td> Segments </td></tr>
<tr><td>Segment </td><td> Quadrilaterals </td></tr>
<tr><td>Triangle </td><td> Pentahedrons </td></tr>
<tr><td>Quadrilateral </td><td> Hexahedrons </td></tr>
<tr><td>Polygon </td><td> Polyhedrons </td></tr>
<tr><td>Hexagonal polygon </td><td> Hexagonal prism </td></tr>
</table>
<em>To use extrusion:</em>
<ol>
<li>From the \b Modification menu choose the \b Extrusion item or click
<em>"Extrusion"</em> button in the toolbar.
<center>
\image html image91.png
<center><em>"Extrusion" button</em></center>
<em>"Extrusion" button</em>
</center>
The following dialog common for line and planar elements will appear:
@ -26,32 +35,36 @@ The following dialog common for line and planar elements will appear:
<li>In this dialog:
<ul>
<li>select the type of elements which will be extruded (0D, 1D or 2D),</li>
<li>specify the IDs of the elements which will be extruded:
<ul>
<li><b>Select the whole mesh, submesh or group</b> activating this
checkbox; or</li>
<li>choose mesh elements with the mouse in the 3D Viewer. It is
possible to select a whole area with a mouse frame; or</li>
<li>input the element IDs directly in <b>ID Elements</b> field. The selected elements will be highlighted in the
viewer; or</li>
<li>apply Filters. <b>Set filter</b> button allows to apply a filter to the selection of elements. See more
about filters in the \ref selection_filter_library_page "Selection filter library" page.</li>
</ul>
</li>
<li>If the <b>Extrude to Distance</b> radio button is selected</li>
<ul>
<li>specify the distance at which the elements will be extruded,</li>
</ul>
<li>If the <b>Extrude Along Vector</b> radio button is selected</li>
<ul>
<li>specify the coordinates of the vector along which the elements will be extruded, or select the face (the normal to the face will define the vector)</li>
<li>specify the distance of extrusion along the vector,</li>
</ul>
<li>specify the number of steps;</li>
<li>activate <b>Generate Groups</b> checkbox if it is necessary to copy the groups of
elements of the source mesh to the newly created one. </li>
</li>
<li>Select the type of elements which will be extruded (0D, 1D or 2D).</li>
<li>Specify the IDs of the elements which will be extruded by one
following means:
<ul>
<li><b>Select the whole mesh, submesh or group</b> activating this
checkbox.</li>
<li>Choose mesh elements with the mouse in the 3D Viewer. It is
possible to select a whole area with a mouse frame.</li>
<li>Input the element IDs directly in <b>ID Elements</b>
field. The selected elements will be highlighted in the viewer.</li>
<li>Apply Filters. <b>Set filter</b> button allows to apply a
filter to the selection of elements. See more about filters in
the \ref filtering_elements "Selection filters" page.</li>
</ul>
</li>
<li>If the <b>Extrude to Distance</b> radio button is selected</li>
<ul>
<li>specify the distance at which the elements will be extruded.</li>
</ul>
<li>If the <b>Extrude Along Vector</b> radio button is selected</li>
<ul>
<li>specify the coordinates of the vector along which the elements
will be extruded, or select the face (the normal to the face will
define the vector),</li>
<li>specify the distance of extrusion along the vector.</li>
</ul>
<li>Specify the number of steps.</li>
<li>If you activate <b>Generate Groups</b> check-box, the created
elements contained in groups will be included into new groups named
by pattern "<old group name>_extruded". </li>
</ul>
<li>Click \b Apply or <b> Apply and Close</b> button to confirm the operation.</li>

View File

@ -4,7 +4,7 @@
\n In MESH there is a functionality allowing importation/exportation
of meshes from/to \b MED, \b UNV (I-DEAS 10), \b DAT (simple ascii format), \b STL,
\b GMF and \b CGNS format files. You can also export a group as a whole mesh.
\b GMF (internal format of DISTENE products, namely BLSurf, GHS3D and Hexotic algorithms) and \b CGNS format files. You can also export a group as a whole mesh.
<em>To import a mesh:</em>

View File

@ -98,6 +98,12 @@ number of segments on each edge</li>
<li><b>Area precision</b> - allows to adjust input precision of mesh element area.</li>
<li><b>Volume precision</b> - allows to adjust input precision of mesh element volume.</li>
</ul>
<li><b>Preview</b></li>
<ul>
<li><b>Sub-shapes preview chunk size</b> - allows to limit the number
of preview sub-shapes shown in the hypotheses creation dialog boxes,
for example "Reverse Edges" parameter of \ref number_of_segments_anchor "Number of segments" hypothesis.
</ul>
<li><b>Python Dump</b></li>
<ul>
<li><b>Historical python dump</b> checkbox allows switching between

View File

@ -122,9 +122,16 @@ button in the toolbar. You can also right-click on the mesh in the
Object Browser and select Clear Mesh Data in the pop-up menu.</li>
</ol>
<center>
\image html mesh_clear.png
<center><em>"Clear Mesh Data" button</em></center>
<em>"Clear Mesh Data" button</em></center>
\note This command works in a different way in different situations: <ul>
<li> if the mesh is computed on a geometry, then "Clear Mesh Data" removes
all elements and nodes.</li>
<li> if the mesh is not based on a geometry (imported, compound, created from
scratch etc), then "Clear Mesh Data" removes only the elements and
nodes computed by algorithms. If no such elements or nodes have been created, can remove nothing.</li></ul>
<br><b>See Also</b> a sample TUI Script of a
\ref tui_removing_nodes_and_elements "Removing Nodes and Elements" operation.

View File

@ -3,17 +3,17 @@
\page reorient_faces_page Reorient faces by vector
\n This operation allows changing orientation of a set of neighboring
faces. The desired orientation is defined by a vector. Since direction
faces. The desired orientation is defined by a vector. Since the direction
of face normals in the set can be even opposite, it is necessary to
specify a control face whose normal will be compared with the vector. This
face can be specified either explicitly or can be found by closeness to
face can be either specified explicitly or found by proximity to
a given point.
Orientation of a face is changed by reverting the order of its nodes.
<em>To change orientation of faces:</em>
<ol>
<li>In the \b Modification menu select the <b>Reorient faces by
<li>In the \b Modification menu select <b>Reorient faces by
vector</b> item or click <em>Reorient faces by
vector</em> button in the toolbar.
@ -31,24 +31,19 @@ The following dialog box will appear:
<li>In this dialog
<ul>
<li>Specify a way of selection of the control face: by point or
explicitely.</li>
<li>Select an \b Object containing faces to reorient, either in the Object
Browser or in the 3D Viewer; it can be either <ul>
<li>group of faces,</li>
<li>sub-mesh of faces or</li>
<li>mesh.</li>
</ul></li>
<li>Specify either coordinates of a \b Point by which the control face
will be found or the control \b Face it-self. You can easy specify the \b
Point by either picking a node in the 3D Viewer or by selecting a vertex
in the Object Browser. The \b Face can be either picked by mouse in
the 3D Viewer or its ID can be entered by typing.</li>
<li>Set up a \b Direction to be compared with the normal of the
control face. You can either pick a node in the 3D Viewer then a \b Direction
from the coordinate system origin to the selected node will be set,
or you can pick two nodes (holding Shift button) then a \b Direction
from the first to the second node will be set.</li>
<li>Specify the way of selection of the control face: by point or
explicitly.</li>
<li>Select the \b Object (mesh, sub-mesh or a group of faces) containing faces to reorient in the Object Browser or in the 3D Viewer.</li>
<li>Specify the coordinates of the \b Point by which the control face
will be found or of the control \b Face itself. You can easy specify the \b
Point by either picking a node in the 3D Viewer or selecting a vertex
in the Object Browser. It is possible to pick the \b Face by mouse in
the 3D Viewer or enter its ID.</li>
<li>Set up the \b Direction vector to be compared with the normal of the
control face. If you pick a node in the 3D Viewer then the \b Direction
vector will go from the coordinate system origin to the selected node.
If you pick two nodes (holding Shift button) then the \b Direction vector
will go from the first to the second node.</li>
</ul>
</li>

View File

@ -15,7 +15,14 @@ load an existing filter library.
the current study. You can \b Add or \b Delete filters.
\n In <b>Filter name</b> box you can specify the name for your
filter. By default it is prefixed with the corresponding entity type.
\n Each filter can be applicable to \b Nodes, \b Edges, \b Faces or \b
\anchor filtering_elements
When we use filters during a group creation or another operation (by
clicking <b>Set Filters</b> button in the corresponding dialog), the
menu for setting filters looks a bit differently (see the image below).
Each filter can be applicable to \b Nodes, \b Edges, \b Faces or \b
Volumes. You can combine many criteria in one filter, but they all
must be of the same <b>Entity type</b>.
\n The \b Add button creates a new criterion at the end of the list of
@ -30,21 +37,18 @@ sense of a criterion using \b Unary operator Not and you should
specify logical relations between criteria using \b Binary operators
Or and And.
\n Some criteria should have the additional parameter of \b Tolerance.
When we create a group using filters (for this click
<b>Set Filters</b> button in the <b>Create Group</b> dialog), the menu
for setting filters looks a bit differently (see below). Switching
on <b>Insert filter in viewer</b> checkbox limits selection of elements
in the Viewer using your current filter.
<br>
Switching on <b>Insert filter in viewer</b> checkbox limits
selection of elements in the Viewer to the current filter.
<br>
In the \b Source field you choose if the filter will be applied to
the whole \b Mesh, the <b>Initial Selection</b> or the <b>Current
Group</b>. If \b Mesh is chosen, the elements satisfying the filter
will be selected in the 3D Viewer. If <b> Initial Selection</b> is
chosen, the filter will be applied to the selected elements and the
elements rejected by the filter will be deseleced. If <b>Current
elements rejected by the filter will be deselected. If <b>Current
Group</b> is chosen, the filter will be applied to the list of
elements in the <em>Greate Croup</em> dialog and the elements rejected
elements in the current dialog and the elements rejected
by the filter will be removed from the list.
<br>
<b>Copy from...</b> button gives you a possibility to load an
@ -68,7 +72,7 @@ shape the algorithm works slower.
</li><li>
<b>Lying on Geom</b> selects entities whose at least one node
lies on the shape defined by the <b>Threshold Value</b>.
If the hreshold shape is a sub-shape of the main shape of the mesh the
If the threshold shape is a sub-shape of the main shape of the mesh the
algorithm works faster, if this is any other
shape, the algorithm works slower.
</li><li>
@ -167,7 +171,7 @@ The following criteria allow selecting mesh <b>Faces</b>:
one element of mesh only. See also a
\ref free_edges_page "Free Edges quality control".
</li><li>
<b>Free faces</b> selects 2D mesh elements wich belong to less than two volumes.
<b>Free faces</b> selects 2D mesh elements, which belong to less than two volumes.
</li><li>
<b>Double faces</b> selects 2D mesh elements basing on the same set of nodes.
See also \ref filter_double_elements "Double Elements quality control".

View File

@ -116,6 +116,7 @@ the following links:
- \subpage tui_creating_meshes_page
- \subpage tui_cartesian_algo
- \subpage tui_use_existing_faces
- \subpage tui_viewing_meshes_page
- \subpage tui_defining_hypotheses_page
- \subpage tui_quality_controls_page

View File

@ -11,9 +11,9 @@
<h3>Add Node</h3>
\code
import SMESH_mechanic
import smesh
mesh = SMESH_mechanic.mesh
mesh = smesh.Mesh()
# add node
new_id = mesh.AddNode(50, 10, 0)
@ -27,9 +27,9 @@ else: print "New Node has been added with ID ", new_id
<h3>Add 0D Element</h3>
\code
import SMESH_mechanic
import smesh
mesh = SMESH_mechanic.mesh
mesh = smesh.Mesh()
# add node
node_id = mesh.AddNode(50, 10, 0)
@ -42,6 +42,54 @@ if new_id == 0: print "KO node addition."
else: print "New 0D Element has been added with ID ", new_id
\endcode
<br>
\anchor tui_add_0DElement_on_all_nodes
<h3>Add 0D Element on Element Nodes</h3>
\code
import smesh, SMESH, geompy
# create a geometry
box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0]
# make 3D mesh
mesh = smesh.Mesh( box )
mesh.AutomaticHexahedralization(0)
# create 0D elements on all nodes of the mesh
res = mesh.Add0DElementsToAllNodes( mesh )
# find 0D elements on all nodes of the mesh, all found nodes are added to a new group
groupName = "0Dmesh"
res = mesh.Add0DElementsToAllNodes( mesh, groupName )
mesh.RemoveGroupWithContents( res ) # remove all found 0D elements
# create 0D elements on all nodes of a sub-mesh, with group creation
groupName = "0Dsubmesh"
submesh = mesh.GetSubMesh( face, "faceSM")
res = mesh.Add0DElementsToAllNodes( submesh, groupName )
# create 0D elements on all nodes of a group
group = mesh.Group( face, "faceGroup" )
res = mesh.Add0DElementsToAllNodes( group )
# remove all 0D elements
mesh.RemoveElements( mesh.GetIdsFromFilter( smesh.GetFilter( SMESH.ELEM0D,
SMESH.FT_ElemGeomType,
"=",SMESH.Geom_POINT )))
# create 0D elements on all nodes of some elements
res = mesh.Add0DElementsToAllNodes( mesh.GetElementsId() )
mesh.RemoveElements( mesh.GetElementsByType( SMESH.ELEM0D ))
# create 0D elements on some nodes
nodes = range(1,10)
res = mesh.Add0DElementsToAllNodes( mesh.GetIDSource( nodes, SMESH.NODE ))
\endcode
<br>
\anchor tui_add_edge
<h3>Add Edge</h3>

View File

@ -1,6 +1,6 @@
/*!
\page tui_use_existing_faces Use existing faces
\page tui_use_existing_faces Use existing faces algorithm
This sample demonstrates how to use <b>Use existing faces</b> algorithm,
which is actulally just a stub allowing to use your own 2D algoritm

View File

@ -28,8 +28,8 @@ to sort the list of IDs. The <b>Set filter</b> button allows to apply a
definite filter to selection of triangles.</li>
<li><b>Apply to all</b> radio button allows to modify connectivity and
type of all triangles of the currently displayed mesh or sub-mesh.</li>
<li>\b Criterion menu allows to chose a quality criterion
optimization of which will be used to select triangles to unite.</li>
<li>\b Criterion menu allows to choose a quality criterion,
which will be optimized to select triangles to unite.</li>
<li><b>Select from</b> set of fields allows to choose a sub-mesh or an
existing group whose triangle elements will be automatically added to
the list.</li>

View File

@ -861,6 +861,39 @@ module StdMeshers
double GetStretchFactor();
};
/*!
* interface of "Viscous Layers 2D" hypothesis.
* This hypothesis specifies parameters of layers of quadrilaterals to build
* near mesh boundary. This hypothesis can be used by several 2D algorithms:
* Mefisto, Quadrangle (mapping), NETGEN, BLSURF
*/
interface StdMeshers_ViscousLayers2D : SMESH::SMESH_Hypothesis
{
/*!
* Set edges to exclude from treatment
*/
void SetIgnoreEdges(in SMESH::long_array edgeIDs) raises (SALOME::SALOME_Exception);
SMESH::long_array GetIgnoreEdges();
/*!
* Set total thickness of layers of prisms
*/
void SetTotalThickness(in double thickness) raises (SALOME::SALOME_Exception);
double GetTotalThickness();
/*!
* Set number of layers of prisms
*/
void SetNumberLayers(in short nb) raises (SALOME::SALOME_Exception);
short GetNumberLayers();
/*!
* Set factor (>1.0) of growth of layer thickness towards inside of mesh
*/
void SetStretchFactor(in double factor) raises (SALOME::SALOME_Exception);
double GetStretchFactor();
};
/*!
* interface of "Body fitting Parameters" hypothesis.
* This hypothesis specifies

View File

@ -240,8 +240,11 @@ module SMESH
/*!
* Create Mesh object importing data from given GMF file
* \param theFileName - a name of file to import
* \param theMakeRequiredGroups - if true, groups of required entities will be created
*/
SMESH_Mesh CreateMeshesFromGMF( in string theFileName,
in boolean theMakeRequiredGroups,
out SMESH::ComputeError theError)
raises ( SALOME::SALOME_Exception );

View File

@ -663,7 +663,8 @@ module SMESH
in string file,
in boolean overwrite ) raises (SALOME::SALOME_Exception);
void ExportGMF( in SMESH_IDSource meshPart,
in string file ) raises (SALOME::SALOME_Exception);
in string file,
in boolean withRequiredGroups) raises (SALOME::SALOME_Exception);
void ExportPartToDAT( in SMESH_IDSource meshPart,
in string file ) raises (SALOME::SALOME_Exception);
void ExportPartToUNV( in SMESH_IDSource meshPart,

View File

@ -151,7 +151,6 @@ module SMESH
*/
long AddPolyhedralVolume (in long_array IdsOfNodes,
in long_array Quantities);
/*!
* Create volume of many faces, giving IDs of existing faces.
* \param IdsOfFaces List of face IDs for volume creation.
@ -160,6 +159,19 @@ module SMESH
*/
long AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
/*!
* Create 0D elements on all nodes of the given object except those
* nodes on which a 0D element already exists.
* \param theObject object on whose nodes 0D elements will be created.
* \param theGroupName optional name of a group to add 0D elements created
* and/or found on nodes of \a theObject.
* \return an object (a new group or a temporary SMESH_IDSource) holding
* ids of new and/or found 0D elements.
*/
SMESH_IDSource Create0DElementsOnAllNodes(in SMESH_IDSource theObject,
in string theGroupName)
raises (SALOME::SALOME_Exception);
/*!
* \brief Bind a node to a vertex
* \param NodeID - node ID

View File

@ -113,6 +113,8 @@ dist_salomeres_DATA = \
mesh_update.png \
mesh_vertex_n.png \
mesh_vertex.png \
mesh_0D_elem.png \
mesh_0D_on_all_nodes.png \
mesh_volume_3d.png \
bare_border_volume.png \
bare_border_face.png \

View File

@ -34,170 +34,176 @@
gui-lib="StdMeshersGUI">
<hypotheses>
<hypothesis type="SegmentLengthAroundVertex"
label-id="Length Near Vertex"
icon-id="mesh_hypo_length.png"
dim="0"/>
<hypothesis type ="SegmentLengthAroundVertex"
label-id ="Length Near Vertex"
icon-id ="mesh_hypo_length.png"
dim ="0"/>
<hypothesis type="LocalLength"
label-id="Local Length"
icon-id="mesh_hypo_length.png"
dim="1"/>
<hypothesis type ="LocalLength"
label-id ="Local Length"
icon-id ="mesh_hypo_length.png"
dim ="1"/>
<hypothesis type="MaxLength"
label-id="Max Size"
icon-id="mesh_hypo_length.png"
dim="1"/>
<hypothesis type ="MaxLength"
label-id ="Max Size"
icon-id ="mesh_hypo_length.png"
dim ="1"/>
<hypothesis type="Arithmetic1D"
label-id="Arithmetic 1D"
icon-id="mesh_hypo_length.png"
dim="1"/>
<hypothesis type ="Arithmetic1D"
label-id ="Arithmetic 1D"
icon-id ="mesh_hypo_length.png"
dim ="1"/>
<hypothesis type="FixedPoints1D"
label-id="Fixed Points 1D"
icon-id="mesh_hypo_length.png"
dim="1"/>
<hypothesis type ="FixedPoints1D"
label-id ="Fixed Points 1D"
icon-id ="mesh_hypo_length.png"
dim ="1"/>
<hypothesis type="StartEndLength"
label-id="Start and End Length"
icon-id="mesh_hypo_length.png"
dim="1"/>
<hypothesis type ="StartEndLength"
label-id ="Start and End Length"
icon-id ="mesh_hypo_length.png"
dim ="1"/>
<hypothesis type="NumberOfSegments"
label-id="Nb. Segments"
icon-id="mesh_hypo_segment.png"
dim="1"/>
<hypothesis type ="NumberOfSegments"
label-id ="Nb. Segments"
icon-id ="mesh_hypo_segment.png"
dim ="1"/>
<hypothesis type="Deflection1D"
label-id="Deflection 1D"
icon-id="mesh_hypo_length.png"
dim="1"/>
<hypothesis type ="Deflection1D"
label-id ="Deflection 1D"
icon-id ="mesh_hypo_length.png"
dim ="1"/>
<hypothesis type="Propagation"
label-id="Propagation of 1D Hyp. on Opposite Edges"
icon-id="mesh_hypo_length.png"
dim="1"
<hypothesis type ="Propagation"
label-id ="Propagation of 1D Hyp. on Opposite Edges"
icon-id ="mesh_hypo_length.png"
dim ="1"
auxiliary="true"/>
<hypothesis type="AutomaticLength"
label-id="Automatic Length"
icon-id="mesh_hypo_length.png"
dim="1"/>
<hypothesis type ="AutomaticLength"
label-id ="Automatic Length"
icon-id ="mesh_hypo_length.png"
dim ="1"/>
<hypothesis type="LengthFromEdges"
label-id="Length From Edges"
icon-id="mesh_hypo_length.png"
dim="2"/>
<hypothesis type ="LengthFromEdges"
label-id ="Length From Edges"
icon-id ="mesh_hypo_length.png"
dim ="2"/>
<hypothesis type="QuadranglePreference"
label-id="Quadrangle Preference"
icon-id="mesh_algo_quad.png"
<hypothesis type ="QuadranglePreference"
label-id ="Quadrangle Preference"
icon-id ="mesh_algo_quad.png"
auxiliary="true"
dim="2"/>
dim ="2"/>
<hypothesis type="QuadraticMesh"
label-id="Quadratic Mesh"
icon-id="mesh_algo_quad.png"
dim="1"
<hypothesis type ="QuadraticMesh"
label-id ="Quadratic Mesh"
icon-id ="mesh_algo_quad.png"
dim ="1"
auxiliary="true"/>
<hypothesis type="MaxElementArea"
label-id="Max. Element Area"
icon-id="mesh_hypo_area.png"
dim="2"/>
<hypothesis type ="MaxElementArea"
label-id ="Max. Element Area"
icon-id ="mesh_hypo_area.png"
dim ="2"/>
<hypothesis type="NotConformAllowed"
label-id="Not Conform Mesh Allowed"
icon-id="mesh_hypo_length.png"
dim="1,2,3"
<hypothesis type ="NotConformAllowed"
label-id ="Not Conform Mesh Allowed"
icon-id ="mesh_hypo_length.png"
dim ="1,2,3"
auxiliary="true"/>
<hypothesis type="MaxElementVolume"
label-id="Max. Element Volume"
icon-id="mesh_hypo_volume.png"
dim="3"/>
<hypothesis type ="MaxElementVolume"
label-id ="Max. Element Volume"
icon-id ="mesh_hypo_volume.png"
dim ="3"/>
<hypothesis type="ProjectionSource3D"
label-id="Source Shape 3D"
icon-id="mesh_hypo_volume.png"
dim="3"/>
<hypothesis type ="ProjectionSource3D"
label-id ="Source Shape 3D"
icon-id ="mesh_hypo_volume.png"
dim ="3"/>
<hypothesis type="ProjectionSource2D"
label-id="Source Face"
icon-id="mesh_hypo_area.png"
dim="2"/>
<hypothesis type ="ProjectionSource2D"
label-id ="Source Face"
icon-id ="mesh_hypo_area.png"
dim ="2"/>
<hypothesis type="ProjectionSource1D"
label-id="Source Edge"
icon-id="mesh_hypo_length.png"
dim="1"/>
<hypothesis type ="ProjectionSource1D"
label-id ="Source Edge"
icon-id ="mesh_hypo_length.png"
dim ="1"/>
<hypothesis type="ImportSource2D"
label-id="Source Faces"
icon-id="mesh_hypo_area.png"
dim="2"/>
<hypothesis type ="ImportSource2D"
label-id ="Source Faces"
icon-id ="mesh_hypo_area.png"
dim ="2"/>
<hypothesis type="ImportSource1D"
label-id="Source Edges"
icon-id="mesh_hypo_length.png"
dim="1"/>
<hypothesis type ="ImportSource1D"
label-id ="Source Edges"
icon-id ="mesh_hypo_length.png"
dim ="1"/>
<hypothesis type="NumberOfLayers"
label-id="Number of Layers"
icon-id="mesh_hypo_length.png"
dim="3"/>
<hypothesis type ="NumberOfLayers"
label-id ="Number of Layers"
icon-id ="mesh_hypo_length.png"
dim ="3"/>
<hypothesis type="LayerDistribution"
label-id="Distribution of Layers"
icon-id="mesh_hypo_length.png"
dim="3"/>
<hypothesis type ="LayerDistribution"
label-id ="Distribution of Layers"
icon-id ="mesh_hypo_length.png"
dim ="3"/>
<hypothesis type="ViscousLayers"
label-id="Viscous Layers"
icon-id="mesh_algo_quad.png"
<hypothesis type ="ViscousLayers2D"
label-id ="Viscous Layers 2D"
icon-id ="mesh_algo_quad.png"
auxiliary="true"
dim="3"/>
dim ="2"/>
<hypothesis type="NumberOfLayers2D"
label-id="Number of Layers"
icon-id="mesh_hypo_length.png"
dim="2"/>
<hypothesis type ="ViscousLayers"
label-id ="Viscous Layers"
icon-id ="mesh_algo_quad.png"
auxiliary="true"
dim ="3"/>
<hypothesis type="LayerDistribution2D"
label-id="Distribution of Layers"
icon-id="mesh_hypo_length.png"
dim="2"/>
<hypothesis type ="NumberOfLayers2D"
label-id ="Number of Layers"
icon-id ="mesh_hypo_length.png"
dim ="2"/>
<hypothesis type="QuadrangleParams"
label-id="Quadrangle Parameters"
icon-id="mesh_hypo_length.png"
dim="2"/>
<hypothesis type ="LayerDistribution2D"
label-id ="Distribution of Layers"
icon-id ="mesh_hypo_length.png"
dim ="2"/>
<hypothesis type="CartesianParameters3D"
label-id="Body Fitting Parameters"
icon-id="mesh_hypo_length.png"
dim="3"/>
<hypothesis type ="QuadrangleParams"
label-id ="Quadrangle Parameters"
icon-id ="mesh_hypo_length.png"
dim ="2"/>
<hypothesis type ="CartesianParameters3D"
label-id ="Body Fitting Parameters"
icon-id ="mesh_hypo_length.png"
dim ="3"/>
</hypotheses>
<algorithms>
<algorithm type="SegmentAroundVertex_0D"
label-id="Segments around Vertex"
icon-id="mesh_algo_regular.png"
hypos="SegmentLengthAroundVertex"
output="VERTEX"
dim="0"/>
<algorithm type ="SegmentAroundVertex_0D"
label-id ="Segments around Vertex"
icon-id ="mesh_algo_regular.png"
hypos ="SegmentLengthAroundVertex"
output ="VERTEX"
dim ="0"/>
<algorithm type="Regular_1D"
label-id="Wire Discretisation"
icon-id="mesh_algo_regular.png"
hypos="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
<algorithm type ="Regular_1D"
label-id ="Wire Discretisation"
icon-id ="mesh_algo_regular.png"
hypos ="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
opt-hypos="Propagation,QuadraticMesh"
input="VERTEX"
output="EDGE"
dim="1">
input ="VERTEX"
output ="EDGE"
dim ="1">
<python-wrap>
<algo>Regular_1D=Segment()</algo>
<hypo>LocalLength=LocalLength(SetLength(1),,SetPrecision(1))</hypo>
@ -212,14 +218,14 @@
</python-wrap>
</algorithm>
<algorithm type="CompositeSegment_1D"
label-id="Composite Side Discretisation"
icon-id="mesh_algo_regular.png"
hypos="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
<algorithm type ="CompositeSegment_1D"
label-id ="Composite Side Discretisation"
icon-id ="mesh_algo_regular.png"
hypos ="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
opt-hypos="Propagation,QuadraticMesh"
input="VERTEX"
output="EDGE"
dim="1">
input ="VERTEX"
output ="EDGE"
dim ="1">
<python-wrap>
<algo>CompositeSegment_1D=Segment(algo=smesh.COMPOSITE)</algo>
<hypo>LocalLength=LocalLength(SetLength(), ,SetPrecision())</hypo>
@ -243,184 +249,187 @@
</python-wrap>
</algorithm>
<algorithm type="MEFISTO_2D"
label-id="Triangle (Mefisto)"
icon-id="mesh_algo_mefisto.png"
hypos="LengthFromEdges,MaxElementArea"
input="EDGE"
output="TRIA"
dim="2">
<algorithm type ="MEFISTO_2D"
label-id ="Triangle (Mefisto)"
icon-id ="mesh_algo_mefisto.png"
hypos ="LengthFromEdges,MaxElementArea"
opt-hypos ="ViscousLayers2D"
input ="EDGE"
output ="TRIA"
dim ="2">
<python-wrap>
<algo>MEFISTO_2D=Triangle(algo=smesh.MEFISTO)</algo>
<hypo>LengthFromEdges=LengthFromEdges()</hypo>
<hypo>MaxElementArea=MaxElementArea(SetMaxElementArea())</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
</python-wrap>
</algorithm>
<algorithm type="Quadrangle_2D"
label-id="Quadrangle (Mapping)"
icon-id="mesh_algo_quad.png"
hypos="QuadrangleParams"
input="EDGE"
output="QUAD"
dim="2">
<algorithm type ="Quadrangle_2D"
label-id ="Quadrangle (Mapping)"
icon-id ="mesh_algo_quad.png"
hypos ="QuadrangleParams"
opt-hypos="ViscousLayers2D"
input ="EDGE"
output ="QUAD"
dim ="2">
<python-wrap>
<algo>Quadrangle_2D=Quadrangle(algo=smesh.QUADRANGLE)</algo>
<hypo>QuadrangleParams=QuadrangleParameters(SetQuadType(),SetTriaVertex())</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
</python-wrap>
</algorithm>
<algorithm type="Hexa_3D"
label-id="Hexahedron (i,j,k)"
icon-id="mesh_algo_hexa.png"
input="QUAD"
<algorithm type ="Hexa_3D"
label-id ="Hexahedron (i,j,k)"
icon-id ="mesh_algo_hexa.png"
input ="QUAD"
need-geom="false"
opt-hypos="ViscousLayers"
dim="3">
dim ="3">
<python-wrap>
<algo>Hexa_3D=Hexahedron(algo=smesh.Hexa)</algo>
<hypo>ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreFaces())</hypo>
</python-wrap>
</algorithm>
<algorithm type="Projection_1D"
<algorithm type ="Projection_1D"
label-id="Projection 1D"
icon-id="mesh_algo_regular.png"
hypos="ProjectionSource1D"
output="EDGE"
dim="1">
icon-id ="mesh_algo_regular.png"
hypos ="ProjectionSource1D"
output ="EDGE"
dim ="1">
<python-wrap>
<algo>Projection_1D=Projection1D()</algo>
<hypo>ProjectionSource1D=SourceEdge(SetSourceEdge(),SetSourceMesh(),SetVertexAssociation(1),SetVertexAssociation(2))</hypo>
</python-wrap>
</algorithm>
<algorithm type="Projection_2D"
<algorithm type ="Projection_2D"
label-id="Projection 2D"
icon-id="mesh_algo_quad.png"
input="EDGE"
hypos="ProjectionSource2D"
output="QUAD,TRIA"
dim="2">
icon-id ="mesh_algo_quad.png"
input ="EDGE"
hypos ="ProjectionSource2D"
output ="QUAD,TRIA"
dim ="2">
<python-wrap>
<algo>Projection_2D=Projection2D()</algo>
<hypo>ProjectionSource2D=SourceFace(SetSourceFace(),SetSourceMesh(),SetVertexAssociation(1),SetVertexAssociation(3),SetVertexAssociation(2),SetVertexAssociation(4))</hypo>
</python-wrap>
</algorithm>
<algorithm type="Projection_1D2D"
<algorithm type ="Projection_1D2D"
label-id="Projection 1D-2D"
icon-id="mesh_algo_quad.png"
input=""
hypos="ProjectionSource2D"
output="QUAD,TRIA"
dim="2">
icon-id ="mesh_algo_quad.png"
hypos ="ProjectionSource2D"
output ="QUAD,TRIA"
dim ="2">
<python-wrap>
<algo>Projection_1D2D=Projection1D2D()</algo>
<hypo>ProjectionSource2D=SourceFace(SetSourceFace(),SetSourceMesh(),SetVertexAssociation(1),SetVertexAssociation(2),SetVertexAssociation(3),SetVertexAssociation(4))</hypo>
</python-wrap>
</algorithm>
<algorithm type="Projection_3D"
<algorithm type ="Projection_3D"
label-id="Projection 3D"
icon-id="mesh_algo_hexa.png"
hypos="ProjectionSource3D"
input="QUAD,TRIA"
dim="3">
icon-id ="mesh_algo_hexa.png"
hypos ="ProjectionSource3D"
input ="QUAD,TRIA"
dim ="3">
<python-wrap>
<algo>Projection_3D=Projection3D()</algo>
<hypo>ProjectionSource3D=SourceShape3D(SetSource3DShape(),SetSourceMesh(),SetVertexAssociation(1),SetVertexAssociation(3),SetVertexAssociation(2),SetVertexAssociation(4))</hypo>
</python-wrap>
</algorithm>
<algorithm type="Import_1D"
<algorithm type ="Import_1D"
label-id="Use Existing 1D Elements"
icon-id="mesh_algo_regular.png"
hypos="ImportSource1D"
output="EDGE"
dim="1">
icon-id ="mesh_algo_regular.png"
hypos ="ImportSource1D"
output ="EDGE"
dim ="1">
<python-wrap>
<algo>Import_1D=UseExisting1DElements()</algo>
<hypo>ImportSource1D=SourceEdges(SetSourceEdges(),SetCopySourceMesh(1),SetCopySourceMesh(2))</hypo>
</python-wrap>
</algorithm>
<algorithm type="Import_1D2D"
label-id="Use Existing 2D Elements"
icon-id="mesh_algo_quad.png"
hypos="ImportSource2D"
output="QUAD,TRIA"
<algorithm type ="Import_1D2D"
label-id ="Use Existing 2D Elements"
icon-id ="mesh_algo_quad.png"
hypos ="ImportSource2D"
output ="QUAD,TRIA"
support-submeshes="false"
dim="2">
dim ="2">
<python-wrap>
<algo>Import_1D2D=UseExisting2DElements()</algo>
<hypo>ImportSource2D=SourceFaces(SetSourceFaces(),SetCopySourceMesh(1),SetCopySourceMesh(2))</hypo>
</python-wrap>
</algorithm>
<algorithm type="Prism_3D"
<algorithm type ="Prism_3D"
label-id="3D Extrusion"
icon-id="mesh_algo_hexa.png"
input="QUAD,TRIA"
dim="3">
icon-id ="mesh_algo_hexa.png"
input ="QUAD,TRIA"
dim ="3">
<python-wrap>
<algo>Prism_3D=Prism()</algo>
</python-wrap>
</algorithm>
<algorithm type="RadialPrism_3D"
<algorithm type ="RadialPrism_3D"
label-id="Radial Prism 3D"
icon-id="mesh_algo_hexa.png"
hypos="NumberOfLayers, LayerDistribution"
input="QUAD,TRIA"
dim="3">
icon-id ="mesh_algo_hexa.png"
hypos ="NumberOfLayers, LayerDistribution"
input ="QUAD,TRIA"
dim ="3">
<python-wrap>
<algo>RadialPrism_3D=Prism('RadialPrism_3D')</algo>
<hypo>NumberOfLayers=NumberOfLayers(SetNumberOfLayers())</hypo>
</python-wrap>
</algorithm>
<algorithm type="UseExisting_1D"
<algorithm type ="UseExisting_1D"
label-id="Use Existing Edges"
icon-id="mesh_algo_regular.png"
input="VERTEX"
output="EDGE"
dim="1">
icon-id ="mesh_algo_regular.png"
input ="VERTEX"
output ="EDGE"
dim ="1">
<python-wrap>
<algo>UseExisting_1D=UseExistingSegments()</algo>
</python-wrap>
</algorithm>
<algorithm type="UseExisting_2D"
<algorithm type ="UseExisting_2D"
label-id="Use Existing Faces"
icon-id="mesh_algo_quad.png"
input="EDGE"
output="QUAD,TRIA"
dim="2">
icon-id ="mesh_algo_quad.png"
input ="EDGE"
output ="QUAD,TRIA"
dim ="2">
<python-wrap>
<algo>UseExisting_2D=UseExistingFaces()</algo>
</python-wrap>
</algorithm>
<algorithm type="RadialQuadrangle_1D2D"
<algorithm type ="RadialQuadrangle_1D2D"
label-id="Radial Quadrangle 1D2D"
icon-id="mesh_algo_quad.png"
hypos="NumberOfLayers2D, LayerDistribution2D"
input="EDGE"
output="QUAD,TRIA"
dim="2">
icon-id ="mesh_algo_quad.png"
hypos ="NumberOfLayers2D, LayerDistribution2D"
input ="EDGE"
output ="QUAD,TRIA"
dim ="2">
<python-wrap>
<algo>RadialQuadrangle_1D2D=Quadrangle(algo=smesh.RADIAL_QUAD)</algo>
<hypo>NumberOfLayers2D=NumberOfLayers(SetNumberOfLayers())</hypo>
</python-wrap>
</algorithm>
<algorithm type="Cartesian_3D"
label-id="Body Fitting"
icon-id="mesh_algo_hexa.png"
hypos="CartesianParameters3D"
<algorithm type ="Cartesian_3D"
label-id ="Body Fitting"
icon-id ="mesh_algo_hexa.png"
hypos ="CartesianParameters3D"
support-submeshes="false"
dim="3">
dim ="3">
<python-wrap>
<algo>Cartesian_3D=BodyFitted()</algo>
</python-wrap>

BIN
resources/mesh_0D_elem.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

View File

@ -70,7 +70,10 @@
AUXILIARY METHODS
*/
namespace{
namespace {
const double theEps = 1e-100;
const double theInf = 1e+100;
inline gp_XYZ gpXYZ(const SMDS_MeshNode* aNode )
{
@ -231,7 +234,11 @@ bool NumericalFunctor::GetPoints(const int theId,
if ( myMesh == 0 )
return false;
return GetPoints( myMesh->FindElement( theId ), theRes );
const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
if ( !anElem || anElem->GetType() != this->GetType() )
return false;
return GetPoints( anElem, theRes );
}
bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
@ -239,7 +246,7 @@ bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
{
theRes.clear();
if ( anElem == 0)
if ( anElem == 0 )
return false;
theRes.reserve( anElem->NbNodes() );
@ -424,28 +431,22 @@ SMDSAbs_ElementType Volume::GetType() const
return SMDSAbs_Volume;
}
//=======================================================================
/*
Class : MaxElementLength2D
Description : Functor calculating maximum length of 2D element
*/
double MaxElementLength2D::GetValue( long theElementId )
double MaxElementLength2D::GetValue( const TSequenceOfXYZ& P )
{
TSequenceOfXYZ P;
if( GetPoints( theElementId, P ) ) {
if(P.size() == 0)
return 0.;
double aVal = 0;
const SMDS_MeshElement* aElem = myMesh->FindElement( theElementId );
SMDSAbs_ElementType aType = aElem->GetType();
int len = P.size();
switch( aType ) {
case SMDSAbs_Face:
if( len == 3 ) { // triangles
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
aVal = Max(L1,Max(L2,L3));
break;
}
else if( len == 4 ) { // quadrangles
double L1 = getDistance(P( 1 ),P( 2 ));
@ -455,14 +456,12 @@ double MaxElementLength2D::GetValue( long theElementId )
double D1 = getDistance(P( 1 ),P( 3 ));
double D2 = getDistance(P( 2 ),P( 4 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(D1,D2));
break;
}
else if( len == 6 ) { // quadratic triangles
double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 ));
aVal = Max(L1,Max(L2,L3));
break;
}
else if( len == 8 || len == 9 ) { // quadratic quadrangles
double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
@ -472,8 +471,6 @@ double MaxElementLength2D::GetValue( long theElementId )
double D1 = getDistance(P( 1 ),P( 5 ));
double D2 = getDistance(P( 3 ),P( 7 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(D1,D2));
break;
}
}
if( myPrecision >= 0 )
@ -482,8 +479,12 @@ double MaxElementLength2D::GetValue( long theElementId )
aVal = floor( aVal * prec + 0.5 ) / prec;
}
return aVal;
}
return 0.;
}
double MaxElementLength2D::GetValue( long theElementId )
{
TSequenceOfXYZ P;
return GetPoints( theElementId, P ) ? GetValue(P) : 0.0;
}
double MaxElementLength2D::GetBadRate( double Value, int /*nbNodes*/ ) const
@ -496,6 +497,7 @@ SMDSAbs_ElementType MaxElementLength2D::GetType() const
return SMDSAbs_Face;
}
//=======================================================================
/*
Class : MaxElementLength3D
Description : Functor calculating maximum length of 3D element
@ -670,7 +672,7 @@ SMDSAbs_ElementType MaxElementLength3D::GetType() const
return SMDSAbs_Volume;
}
//=======================================================================
/*
Class : MinimumAngle
Description : Functor for calculation of minimum angle
@ -761,8 +763,8 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P )
double maxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) );
double half_perimeter = ( aLen[0] + aLen[1] + aLen[2] ) / 2.;
double anArea = getArea( P( 1 ), P( 2 ), P( 3 ) );
if ( anArea <= Precision::Confusion() )
return 0.;
if ( anArea <= theEps )
return theInf;
return alfa * maxLen * half_perimeter / anArea;
}
else if ( nbNodes == 6 ) { // quadratic triangles
@ -781,8 +783,8 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P )
double maxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) );
double half_perimeter = ( aLen[0] + aLen[1] + aLen[2] ) / 2.;
double anArea = getArea( P(1), P(3), P(5) );
if ( anArea <= Precision::Confusion() )
return 0.;
if ( anArea <= theEps )
return theInf;
return alfa * maxLen * half_perimeter / anArea;
}
else if( nbNodes == 4 ) { // quadrangle
@ -825,8 +827,8 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P )
double C2 = Min( anArea[ 0 ],
Min( anArea[ 1 ],
Min( anArea[ 2 ], anArea[ 3 ] ) ) );
if ( C2 <= Precision::Confusion() )
return 0.;
if ( C2 <= theEps )
return theInf;
return alpha * L * C1 / C2;
}
else if( nbNodes == 8 || nbNodes == 9 ) { // nbNodes==8 - quadratic quadrangle
@ -869,8 +871,8 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P )
double C2 = Min( anArea[ 0 ],
Min( anArea[ 1 ],
Min( anArea[ 2 ], anArea[ 3 ] ) ) );
if ( C2 <= Precision::Confusion() )
return 0.;
if ( C2 <= theEps )
return theInf;
return alpha * L * C1 / C2;
}
return 0;
@ -1288,8 +1290,8 @@ double Warping::ComputeA( const gp_XYZ& thePnt1,
double aLen1 = gp_Pnt( thePnt1 ).Distance( gp_Pnt( thePnt2 ) );
double aLen2 = gp_Pnt( thePnt2 ).Distance( gp_Pnt( thePnt3 ) );
double L = Min( aLen1, aLen2 ) * 0.5;
if ( L < Precision::Confusion())
return 0.;
if ( L < theEps )
return theInf;
gp_XYZ GI = ( thePnt2 + thePnt1 ) / 2. - theG;
gp_XYZ GJ = ( thePnt3 + thePnt2 ) / 2. - theG;
@ -1334,8 +1336,8 @@ double Taper::GetValue( const TSequenceOfXYZ& P )
double J4 = getArea( P( 3 ), P( 4 ), P( 1 ) ) / 2.;
double JA = 0.25 * ( J1 + J2 + J3 + J4 );
if ( JA <= Precision::Confusion() )
return 0.;
if ( JA <= theEps )
return theInf;
double T1 = fabs( ( J1 - JA ) / JA );
double T2 = fabs( ( J2 - JA ) / JA );
@ -1401,8 +1403,8 @@ double Skew::GetValue( const TSequenceOfXYZ& P )
? 0. : fabs( PI2 - v1.Angle( v2 ) );
//BUG SWP12743
if ( A < Precision::Angular() )
return 0.;
if ( A < theEps )
return theInf;
return A * 180. / M_PI;
}
@ -2645,43 +2647,7 @@ bool ElemGeomType::IsSatisfy( long theId )
const SMDSAbs_ElementType anElemType = anElem->GetType();
if ( myType != SMDSAbs_All && anElemType != myType )
return false;
const int aNbNode = anElem->NbNodes();
bool isOk = false;
switch( anElemType )
{
case SMDSAbs_Node:
isOk = (myGeomType == SMDSGeom_POINT);
break;
case SMDSAbs_Edge:
isOk = (myGeomType == SMDSGeom_EDGE);
break;
case SMDSAbs_Face:
if ( myGeomType == SMDSGeom_TRIANGLE )
isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? aNbNode == 6 : aNbNode == 3));
else if ( myGeomType == SMDSGeom_QUADRANGLE )
isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? ( aNbNode == 8 || aNbNode == 9 ) : aNbNode == 4));
else if ( myGeomType == SMDSGeom_POLYGON )
isOk = anElem->IsPoly();
break;
case SMDSAbs_Volume:
if ( myGeomType == SMDSGeom_TETRA )
isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? aNbNode == 10 : aNbNode == 4));
else if ( myGeomType == SMDSGeom_PYRAMID )
isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? aNbNode == 13 : aNbNode == 5));
else if ( myGeomType == SMDSGeom_PENTA )
isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? aNbNode == 15 : aNbNode == 6));
else if ( myGeomType == SMDSGeom_HEXA )
isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? ( aNbNode == 20 || aNbNode == 27 ): aNbNode == 8));
else if ( myGeomType == SMDSGeom_HEXAGONAL_PRISM )
isOk = (anElem->GetEntityType() == SMDSEntity_Hexagonal_Prism );
else if ( myGeomType == SMDSGeom_POLYHEDRA )
isOk = anElem->IsPoly();
break;
default: break;
}
bool isOk = ( anElem->GetGeomType() == myGeomType );
return isOk;
}
@ -3565,7 +3531,6 @@ void ManifoldPart::getFacesByLink( const ManifoldPart::Link& theLink,
ElementsOnSurface::ElementsOnSurface()
{
myMesh = 0;
myIds.Clear();
myType = SMDSAbs_All;
mySurf.Nullify();
@ -3575,14 +3540,12 @@ ElementsOnSurface::ElementsOnSurface()
ElementsOnSurface::~ElementsOnSurface()
{
myMesh = 0;
}
void ElementsOnSurface::SetMesh( const SMDS_Mesh* theMesh )
{
if ( myMesh == theMesh )
return;
myMesh = theMesh;
myMeshModifTracer.SetMesh( theMesh );
if ( myMeshModifTracer.IsMeshModified())
process();
}
@ -3638,32 +3601,14 @@ void ElementsOnSurface::process()
if ( mySurf.IsNull() )
return;
if ( myMesh == 0 )
if ( !myMeshModifTracer.GetMesh() )
return;
if ( myType == SMDSAbs_Face || myType == SMDSAbs_All )
{
myIds.ReSize( myMesh->NbFaces() );
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
for(; anIter->more(); )
process( anIter->next() );
}
myIds.ReSize( myMeshModifTracer.GetMesh()->GetMeshInfo().NbElements( myType ));
if ( myType == SMDSAbs_Edge || myType == SMDSAbs_All )
{
myIds.ReSize( myIds.Extent() + myMesh->NbEdges() );
SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
SMDS_ElemIteratorPtr anIter = myMeshModifTracer.GetMesh()->elementsIterator( myType );
for(; anIter->more(); )
process( anIter->next() );
}
if ( myType == SMDSAbs_Node )
{
myIds.ReSize( myMesh->NbNodes() );
SMDS_NodeIteratorPtr anIter = myMesh->nodesIterator();
for(; anIter->more(); )
process( anIter->next() );
}
}
void ElementsOnSurface::process( const SMDS_MeshElement* theElemPtr )
@ -3782,26 +3727,7 @@ void ElementsOnShape::SetShape (const TopoDS_Shape& theShape,
if ( !myMesh ) return;
switch (myType)
{
case SMDSAbs_All:
myIds.ReSize(myMesh->NbEdges() + myMesh->NbFaces() + myMesh->NbVolumes());
break;
case SMDSAbs_Node:
myIds.ReSize(myMesh->NbNodes());
break;
case SMDSAbs_Edge:
myIds.ReSize(myMesh->NbEdges());
break;
case SMDSAbs_Face:
myIds.ReSize(myMesh->NbFaces());
break;
case SMDSAbs_Volume:
myIds.ReSize(myMesh->NbVolumes());
break;
default:
break;
}
myIds.ReSize( myMeshModifTracer.GetMesh()->GetMeshInfo().NbElements( myType ));
myShapesMap.Clear();
addShape(myShape);

View File

@ -162,6 +162,7 @@ namespace SMESH{
class SMESHCONTROLS_EXPORT MaxElementLength2D: public virtual NumericalFunctor{
public:
virtual double GetValue( long theElementId );
virtual double GetValue( const TSequenceOfXYZ& P );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
@ -783,7 +784,7 @@ namespace SMESH{
bool isOnSurface( const SMDS_MeshNode* theNode );
private:
const SMDS_Mesh* myMesh;
TMeshModifTracer myMeshModifTracer;
TColStd_MapOfInteger myIds;
SMDSAbs_ElementType myType;
//Handle(Geom_Surface) mySurf;

View File

@ -0,0 +1,66 @@
// Copyright (C) 2007-2012 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 : DriverGMF.hxx
// Created : Thu Nov 15 16:45:58 2012
// Author : Edward AGAPOV (eap)
#include "DriverGMF.hxx"
#include <boost/filesystem.hpp>
extern "C"
{
#include "libmesh5.h"
}
namespace DriverGMF
{
//================================================================================
/*!
* \brief Closes GMF mesh at destruction
*/
//================================================================================
MeshCloser::~MeshCloser()
{
if ( _gmfMeshID )
GmfCloseMesh( _gmfMeshID );
}
//================================================================================
/*!
* \brief Checks GMF file extension
*/
//================================================================================
bool isExtensionCorrect( const std::string& fileName )
{
std::string ext = boost::filesystem::extension(fileName);
switch ( ext.size() ) {
case 5: return ( ext == ".mesh" || ext == ".solb" );
case 6: return ( ext == ".meshb" );
case 4: return ( ext == ".sol" );
}
return false;
}
}

View File

@ -0,0 +1,46 @@
// Copyright (C) 2007-2012 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 : DriverGMF.hxx
// Created : Thu Nov 15 16:45:58 2012
// Author : Edward AGAPOV (eap)
#ifndef __DriverGMF_HXX__
#define __DriverGMF_HXX__
#include <string>
namespace DriverGMF
{
/*!
* \brief An object closing GMF mesh at destruction
*/
struct MeshCloser
{
int _gmfMeshID;
MeshCloser( const int gmfMeshID ): _gmfMeshID(gmfMeshID) {}
~MeshCloser();
};
bool isExtensionCorrect( const std::string& fileName );
}
#endif

View File

@ -24,12 +24,14 @@
// Author : Edward AGAPOV (eap)
#include "DriverGMF_Read.hxx"
#include "DriverGMF_Write.hxx"
#include "DriverGMF.hxx"
#include "SMESHDS_Group.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESH_Comment.hxx"
#include <Basics_Utils.hxx>
extern "C"
{
#include "libmesh5.h"
@ -37,16 +39,10 @@ extern "C"
#include <stdarg.h>
// --------------------------------------------------------------------------------
// Closing GMF mesh at destruction
DriverGMF_MeshCloser::~DriverGMF_MeshCloser()
{
if ( _gmfMeshID )
GmfCloseMesh( _gmfMeshID );
}
// --------------------------------------------------------------------------------
DriverGMF_Read::DriverGMF_Read():
Driver_SMESHDS_Mesh()
Driver_SMESHDS_Mesh(),
_makeRequiredGroups( true )
{
}
// --------------------------------------------------------------------------------
@ -62,6 +58,8 @@ DriverGMF_Read::~DriverGMF_Read()
Driver_Mesh::Status DriverGMF_Read::Perform()
{
Kernel_Utils::Localizer loc;
Status status = DRS_OK;
int dim, version;
@ -69,9 +67,13 @@ Driver_Mesh::Status DriverGMF_Read::Perform()
// open the file
int meshID = GmfOpenMesh( myFile.c_str(), GmfRead, &version, &dim );
if ( !meshID )
{
if ( DriverGMF::isExtensionCorrect( myFile ))
return addMessage( SMESH_Comment("Can't open for reading ") << myFile, /*fatal=*/true );
DriverGMF_MeshCloser aMeshCloser( meshID ); // An object closing GMF mesh at destruction
else
return addMessage( SMESH_Comment("Not '.mesh' or '.meshb' extension of file ") << myFile, /*fatal=*/true );
}
DriverGMF::MeshCloser aMeshCloser( meshID ); // An object closing GMF mesh at destruction
// Read nodes
@ -277,6 +279,8 @@ Driver_Mesh::Status DriverGMF_Read::Perform()
// Read required entities into groups
if ( _makeRequiredGroups )
{
// get ids of existing groups
std::set< int > groupIDs;
const std::set<SMESHDS_GroupBase*>& groups = myMesh->GetGroups();
@ -314,6 +318,7 @@ Driver_Mesh::Status DriverGMF_Read::Perform()
}
}
}
}
return status;
}

View File

@ -45,12 +45,19 @@ public:
DriverGMF_Read();
~DriverGMF_Read();
void SetMakeRequiredGroups( bool theMakeRequiredGroups )
{
_makeRequiredGroups = theMakeRequiredGroups;
}
virtual Status Perform();
private:
Status storeBadNodeIds(const char* gmfKwd, int elemNb, int nb, ...);
bool _makeRequiredGroups;
};

View File

@ -24,11 +24,14 @@
// Author : Edward AGAPOV (eap)
#include "DriverGMF_Write.hxx"
#include "DriverGMF.hxx"
#include "SMESHDS_GroupBase.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESH_Comment.hxx"
#include <Basics_Utils.hxx>
extern "C"
{
#include "libmesh5.h"
@ -57,7 +60,7 @@ extern "C"
DriverGMF_Write::DriverGMF_Write():
Driver_SMESHDS_Mesh()
Driver_SMESHDS_Mesh(), _exportRequiredGroups( true )
{
}
DriverGMF_Write::~DriverGMF_Write()
@ -66,13 +69,20 @@ DriverGMF_Write::~DriverGMF_Write()
Driver_Mesh::Status DriverGMF_Write::Perform()
{
const int dim = 3, version = 3;
Kernel_Utils::Localizer loc;
const int dim = 3, version = sizeof(long) == 4 ? 2 : 3;
int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim );
if ( !meshID )
{
if ( DriverGMF::isExtensionCorrect( myFile ))
return addMessage( SMESH_Comment("Can't open for writing ") << myFile, /*fatal=*/true );
else
return addMessage( SMESH_Comment("Not '.mesh' or '.meshb' extension of file ") << myFile, /*fatal=*/true );
}
DriverGMF_MeshCloser aMeshCloser( meshID ); // An object closing GMF mesh at destruction
DriverGMF::MeshCloser aMeshCloser( meshID ); // An object closing GMF mesh at destruction
// nodes
std::map< const SMDS_MeshNode* , int > node2IdMap;
@ -233,6 +243,8 @@ Driver_Mesh::Status DriverGMF_Write::Perform()
END_ELEM_WRITE( prism );
if ( _exportRequiredGroups )
{
// required entities
SMESH_Comment badGroups;
const std::set<SMESHDS_GroupBase*>& groupSet = myMesh->GetGroups();
@ -312,6 +324,7 @@ Driver_Mesh::Status DriverGMF_Write::Perform()
if ( !badGroups.empty() )
addMessage( SMESH_Comment("Groups of elements of inappropriate geometry:")
<< badGroups, /*fatal=*/false );
}
return DRS_OK;
}

View File

@ -42,18 +42,16 @@ public:
DriverGMF_Write();
~DriverGMF_Write();
void SetExportRequiredGroups( bool toExport )
{
_exportRequiredGroups = toExport;
}
virtual Status Perform();
};
/*!
* \brief An object closing GMF mesh at destruction
*/
struct DriverGMF_MeshCloser
{
int _gmfMeshID;
DriverGMF_MeshCloser( const int gmfMeshID ): _gmfMeshID(gmfMeshID) {}
~DriverGMF_MeshCloser();
};
private:
bool _exportRequiredGroups;
};
#endif

View File

@ -23,6 +23,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
salomeinclude_HEADERS = \
DriverGMF_Read.hxx \
DriverGMF_Write.hxx \
DriverGMF.hxx \
SMESH_DriverGMF.hxx \
libmesh5.h
@ -31,6 +32,7 @@ lib_LTLIBRARIES = libMeshDriverGMF.la
dist_libMeshDriverGMF_la_SOURCES = \
DriverGMF_Read.cxx \
DriverGMF_Write.cxx \
DriverGMF.cxx \
libmesh5.c
# additionnal information to compil and link file
@ -38,13 +40,14 @@ libMeshDriverGMF_la_CPPFLAGS = \
$(KERNEL_CXXFLAGS) \
$(CAS_CPPFLAGS) \
$(VTK_INCLUDES) \
$(BOOST_CPPFLAGS) \
$(BOOST_CPPFLAGS) -DBOOST_SYSTEM_NO_DEPRECATED \
-I$(srcdir)/../Driver \
-I$(srcdir)/../SMESHUtils \
-I$(srcdir)/../SMDS \
-I$(srcdir)/../SMESHDS
libMeshDriverGMF_la_LDFLAGS = \
$(BOOST_LIBS) \
$(BOOST_LIBS) -lboost_filesystem \
../Driver/libMeshDriver.la \
../SMESHUtils/libSMESHUtils.la
../SMESHUtils/libSMESHUtils.la \
$(KERNEL_LDFLAGS) -lSALOMEBasics

View File

@ -50,7 +50,9 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
myDoGroupOfNodes (false),
myDoGroupOfEdges (false),
myDoGroupOfFaces (false),
myDoGroupOfVolumes (false)
myDoGroupOfVolumes (false),
myDoGroupOf0DElems(false),
myDoGroupOfBalls(false)
{}
void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName,

View File

@ -22,6 +22,8 @@
#include <stdio.h>
#include <gp_Pnt.hxx>
#include <Basics_Utils.hxx>
//=======================================================================
//function : HashCode
//purpose :
@ -104,6 +106,8 @@ void DriverSTL_R_SMDS_Mesh::SetIsCreateFaces( const bool theIsCreate )
Driver_Mesh::Status DriverSTL_R_SMDS_Mesh::Perform()
{
Kernel_Utils::Localizer loc;
Status aResult = DRS_OK;
TCollection_AsciiString aFileName( (char *)myFile.c_str() );

View File

@ -35,12 +35,11 @@
#include "SMESH_TypeDefs.hxx"
#include <OSD_File.hxx>
//#include <OSD_FromWhere.hxx>
#include <OSD_Path.hxx>
#include <OSD_Protection.hxx>
//#include <OSD_SingleProtection.hxx>
#include <TCollection_AsciiString.hxx>
#include <gp_XYZ.hxx>
#include <Basics_Utils.hxx>
#include "utilities.h"
@ -59,6 +58,8 @@ void DriverSTL_W_SMDS_Mesh::SetIsAscii( const bool theIsAscii )
Driver_Mesh::Status DriverSTL_W_SMDS_Mesh::Perform()
{
Kernel_Utils::Localizer loc;
Status aResult = DRS_OK;
if ( !myMesh ) {

View File

@ -60,6 +60,7 @@ libMeshDriverSTL_la_CPPFLAGS = \
libMeshDriverSTL_la_LDFLAGS = \
../Driver/libMeshDriver.la \
../SMDS/libSMDS.la \
$(KERNEL_LDFLAGS) -lSALOMEBasics \
$(CAS_LDPATH) -lTKernel -lTKSTL -lTKTopAlgo -lTKMesh
STL_Test_CPPFLAGS = \

View File

@ -77,7 +77,7 @@ bool SMESH_PreviewActorsCollection::Init( const TopoDS_Shape& theShape,
myMapOfShapes.Clear();
myIndices.clear();
myCurrentChunk = 0;
myChunkSize = mgr->integerValue( "SMESH", "preview_actor_chunk_size", 100 );
myChunkSize = qMax(1, mgr->integerValue( "SMESH", "preview_actor_chunk_size", 100 ) );
if ( theShape.IsNull() )
return false;

View File

@ -22,8 +22,8 @@
// Author : Edward AGAPOV (eap)
// Executable to find out a lower RAM limit (MB), i.e. at what size of freeRAM
// reported by sysinfo, no more memory can be allocated.
// This is not done inside a function of SALOME because allocated memory is not returned
// to the system. (PAL16631)
// This is not done inside a function of SALOME because allocated memory is not always
// returned to the system. (PAL16631)
//
#ifndef WIN32
#include <sys/sysinfo.h>

View File

@ -155,7 +155,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
// check for preview dimension limitations
if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
{
// clear compute state to not show previous compute errors
// clear compute state not to show previous compute errors
// if preview invoked less dimension less than previous
smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
continue;
@ -355,23 +355,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
MEMOSTAT;
SMESHDS_Mesh *myMesh = aMesh.GetMeshDS();
myMesh->adjustStructure();
MESSAGE("*** compactMesh after compute");
myMesh->compactMesh();
//myMesh->adjustStructure();
list<int> listind = myMesh->SubMeshIndices();
list<int>::iterator it = listind.begin();
int total = 0;
for(; it != listind.end(); ++it)
{
::SMESHDS_SubMesh *subMesh = myMesh->MeshElements(*it);
total += subMesh->getSize();
}
MESSAGE("total elements and nodes in submesh sets:" << total);
MESSAGE("Number of node objects " << SMDS_MeshNode::nbNodes);
MESSAGE("Number of cell objects " << SMDS_MeshCell::nbCells);
//myMesh->dumpGrid();
//aMesh.GetMeshDS()->Modified();
// fix quadratic mesh by bending iternal links near concave boundary
if ( aShape.IsSame( aMesh.GetShapeToMesh() ) &&
@ -589,6 +574,8 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
if ( aLocIgnoAlgo ) // algo is hidden by a local algo of upper dim
{
theErrors.push_back( SMESH_Gen::TAlgoStateError() );
theErrors.back().Set( SMESH_Hypothesis::HYP_HIDDEN_ALGO, algo, false );
INFOS( "Local <" << algo->GetName() << "> is hidden by local <"
<< aLocIgnoAlgo->GetName() << ">");
}
@ -598,9 +585,12 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
int dim = algo->GetDim();
int aMaxGlobIgnoDim = ( aGlobIgnoAlgo ? aGlobIgnoAlgo->GetDim() : -1 );
if ( dim < aMaxGlobIgnoDim )
if ( dim < aMaxGlobIgnoDim &&
( isGlobal || !aGlobIgnoAlgo->SupportSubmeshes() ))
{
// algo is hidden by a global algo
theErrors.push_back( SMESH_Gen::TAlgoStateError() );
theErrors.back().Set( SMESH_Hypothesis::HYP_HIDDEN_ALGO, algo, true );
INFOS( ( isGlobal ? "Global" : "Local" )
<< " <" << algo->GetName() << "> is hidden by global <"
<< aGlobIgnoAlgo->GetName() << ">");
@ -680,7 +670,7 @@ static bool checkMissing(SMESH_Gen* aGen,
}
case SMESH_subMesh::MISSING_HYP: {
// notify if an algo missing hyp is attached to aSubMesh
algo = aGen->GetAlgo( aMesh, aSubMesh->GetSubShape() );
algo = aSubMesh->GetAlgo();
ASSERT( algo );
bool IsGlobalHypothesis = aGen->IsGlobalHypothesis( algo, aMesh );
if (!IsGlobalHypothesis || !globalChecked[ algo->GetDim() ])
@ -731,7 +721,7 @@ static bool checkMissing(SMESH_Gen* aGen,
{
bool checkNoAlgo2 = ( algo->NeedDiscreteBoundary() );
SMESH_subMeshIteratorPtr itsub = aSubMesh->getDependsOnIterator( /*includeSelf=*/false,
/*complexShapeFirst=*/false);
/*complexShapeFirst=*/true);
while ( itsub->more() )
{
// sub-meshes should not be checked further more
@ -823,7 +813,8 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
for (dim = 3; dim > 0; dim--)
{
if (aGlobAlgoArr[ dim ] &&
!aGlobAlgoArr[ dim ]->NeedDiscreteBoundary())
!aGlobAlgoArr[ dim ]->NeedDiscreteBoundary() /*&&
!aGlobAlgoArr[ dim ]->SupportSubmeshes()*/ )
{
aGlobIgnoAlgo = aGlobAlgoArr[ dim ];
break;
@ -880,7 +871,6 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
break;
if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked
if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim,
globalChecked, checkNoAlgo, aCheckedSubs, theErrors))
{

View File

@ -24,7 +24,6 @@
// File : SMESH_Hypothesis.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#include "SMESH_Hypothesis.hxx"
#include "SMESH_Gen.hxx"
@ -50,8 +49,6 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
_type = PARAM_ALGO;
_shapeType = 0; // to be set by algo with TopAbs_Enum
_param_algo_dim = -1; // to be set by algo parameter
//_parameters = string();
//_lastParameters = string();
}
//=============================================================================
@ -171,59 +168,3 @@ SMESH_Mesh* SMESH_Hypothesis::GetMeshByPersistentID(int id)
}
return 0;
}
//=============================================================================
/*!
*
*/
//=============================================================================
// void SMESH_Hypothesis::SetParameters(const char *theParameters)
// {
// string aNewParameters(theParameters);
// if(aNewParameters.size()==0 && _parameters.size()==0)
// aNewParameters = " ";
// if(_parameters.size()>0)
// _parameters +="|";
// _parameters +=aNewParameters;
// SetLastParameters(theParameters);
// }
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
// void SMESH_Hypothesis::ClearParameters()
// {
// _parameters = string();
// }
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
// char* SMESH_Hypothesis::GetParameters() const
// {
// return (char*)_parameters.c_str();
// }
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
// char* SMESH_Hypothesis::GetLastParameters() const
// {
// return (char*)_lastParameters.c_str();
// }
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
// void SMESH_Hypothesis::SetLastParameters(const char* theParameters)
// {
// _lastParameters = string(theParameters);
// }

View File

@ -347,6 +347,8 @@ void SMESH_Mesh::Load()
void SMESH_Mesh::Clear()
{
if ( HasShapeToMesh() ) // remove all nodes and elements
{
// clear mesh data
_myMeshDS->ClearMesh();
@ -358,6 +360,20 @@ void SMESH_Mesh::Clear()
sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); // for event listeners (issue 0020918)
sm->ComputeSubMeshStateEngine( SMESH_subMesh::CLEAN );
}
}
else // remove only nodes/elements computed by algorithms
{
if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) )
{
SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true,
/*complexShapeFirst=*/true);
while ( smIt->more() )
{
sm = smIt->next();
sm->ComputeStateEngine( SMESH_subMesh::CLEAN );
}
}
}
_isModified = false;
}
@ -545,11 +561,13 @@ int SMESH_Mesh::CGNSToMesh(const char* theFileName,
*/
//================================================================================
SMESH_ComputeErrorPtr SMESH_Mesh::GMFToMesh(const char* theFileName)
SMESH_ComputeErrorPtr SMESH_Mesh::GMFToMesh(const char* theFileName,
bool theMakeRequiredGroups)
{
DriverGMF_Read myReader;
myReader.SetMesh(_myMeshDS);
myReader.SetFile(theFileName);
myReader.SetMakeRequiredGroups( theMakeRequiredGroups );
myReader.Perform();
//theMeshName = myReader.GetMeshName();
@ -1419,11 +1437,14 @@ void SMESH_Mesh::ExportCGNS(const char * file,
//================================================================================
void SMESH_Mesh::ExportGMF(const char * file,
const SMESHDS_Mesh* meshDS)
const SMESHDS_Mesh* meshDS,
bool withRequiredGroups)
{
DriverGMF_Write myWriter;
myWriter.SetFile( file );
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
myWriter.SetExportRequiredGroups( withRequiredGroups );
myWriter.Perform();
}
@ -1999,7 +2020,9 @@ void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape)
{
// a geom group is added. Insert it into lists of ancestors before
// the first ancestor more complex than group members
int memberType = TopoDS_Iterator( theShape ).Value().ShapeType();
TopoDS_Iterator subIt( theShape );
if ( !subIt.More() ) return;
int memberType = subIt.Value().ShapeType();
for ( desType = TopAbs_VERTEX; desType >= memberType; desType-- )
for (TopExp_Explorer des( theShape, TopAbs_ShapeEnum( desType )); des.More(); des.Next())
{

View File

@ -122,7 +122,8 @@ public:
int CGNSToMesh(const char* theFileName, const int theMeshIndex, std::string& theMeshName);
SMESH_ComputeErrorPtr GMFToMesh(const char* theFileName);
SMESH_ComputeErrorPtr GMFToMesh(const char* theFileName,
bool theMakeRequiredGroups = true );
SMESH_Hypothesis::Hypothesis_Status
AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
@ -244,7 +245,8 @@ public:
void ExportCGNS(const char * file,
const SMESHDS_Mesh* mesh);
void ExportGMF(const char * file,
const SMESHDS_Mesh* mesh);
const SMESHDS_Mesh* mesh,
bool withRequiredGroups = true );
void ExportSAUV(const char *file,
const char* theMeshName = NULL,
bool theAutoGroups = true) throw(SALOME_Exception);

View File

@ -120,6 +120,19 @@ SMESH_MeshEditor::SMESH_MeshEditor( SMESH_Mesh* theMesh )
{
}
//================================================================================
/*!
* \brief Clears myLastCreatedNodes and myLastCreatedElems
*/
//================================================================================
void SMESH_MeshEditor::CrearLastCreated()
{
myLastCreatedNodes.Clear();
myLastCreatedElems.Clear();
}
//=======================================================================
/*!
* \brief Add element
@ -389,6 +402,44 @@ int SMESH_MeshEditor::Remove (const list< int >& theIDs,
return removed;
}
//================================================================================
/*!
* \brief Create 0D elements on all nodes of the given object except those
* nodes on which a 0D element already exists.
* \param elements - Elements on whose nodes to create 0D elements; if empty,
* the all mesh is treated
* \param all0DElems - returns all 0D elements found or created on nodes of \a elements
*/
//================================================================================
void SMESH_MeshEditor::Create0DElementsOnAllNodes( const TIDSortedElemSet& elements,
TIDSortedElemSet& all0DElems )
{
typedef SMDS_SetIterator<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator> TSetIterator;
SMDS_ElemIteratorPtr elemIt;
if ( elements.empty() )
elemIt = GetMeshDS()->elementsIterator( SMDSAbs_Node );
else
elemIt = SMDS_ElemIteratorPtr( new TSetIterator( elements.begin(), elements.end() ));
while ( elemIt->more() )
{
const SMDS_MeshElement* e = elemIt->next();
SMDS_ElemIteratorPtr nodeIt = e->nodesIterator();
while ( nodeIt->more() )
{
const SMDS_MeshNode* n = cast2Node( nodeIt->next() );
SMDS_ElemIteratorPtr it0D = n->GetInverseElementIterator( SMDSAbs_0DElement );
if ( it0D->more() )
all0DElems.insert( it0D->next() );
else {
myLastCreatedElems.Append( GetMeshDS()->Add0DElement( n ));
all0DElems.insert( myLastCreatedElems.Last() );
}
}
}
}
//=======================================================================
//function : FindShape
//purpose : Return an index of the shape theElem is on
@ -1065,7 +1116,7 @@ bool SMESH_MeshEditor::Reorient (const SMDS_MeshElement * theElem)
* \brief Reorient faces.
* \param theFaces - the faces to reorient. If empty the whole mesh is meant
* \param theDirection - desired direction of normal of \a theFace
* \param theFace - one of \a theFaces that sould be orientated according to
* \param theFace - one of \a theFaces that sould be oriented according to
* \a theDirection and whose orientation defines orientation of other faces
* \return number of reoriented faces.
*/
@ -1093,7 +1144,7 @@ int SMESH_MeshEditor::Reorient2D (TIDSortedElemSet & theFaces,
// Orient other faces
set< const SMDS_MeshElement* > startFaces;
set< const SMDS_MeshElement* > startFaces, visitedFaces;
TIDSortedElemSet avoidSet;
set< SMESH_TLink > checkedLinks;
pair< set< SMESH_TLink >::iterator, bool > linkIt_isNew;
@ -1102,16 +1153,26 @@ int SMESH_MeshEditor::Reorient2D (TIDSortedElemSet & theFaces,
theFaces.erase( theFace );
startFaces.insert( theFace );
int nodeInd1, nodeInd2;
const SMDS_MeshElement* otherFace;
vector< const SMDS_MeshElement* > facesNearLink;
vector< std::pair< int, int > > nodeIndsOfFace;
set< const SMDS_MeshElement* >::iterator startFace = startFaces.begin();
while ( startFace != startFaces.end() )
while ( !startFaces.empty() )
{
startFace = startFaces.begin();
theFace = *startFace;
const int nbNodes = theFace->NbCornerNodes();
startFaces.erase( startFace );
if ( !visitedFaces.insert( theFace ).second )
continue;
avoidSet.clear();
avoidSet.insert(theFace);
NLink link( theFace->GetNode( 0 ), 0 );
const int nbNodes = theFace->NbCornerNodes();
for ( int i = 0; i < nbNodes; ++i ) // loop on links of theFace
{
link.second = theFace->GetNode(( i+1 ) % nbNodes );
@ -1120,33 +1181,61 @@ int SMESH_MeshEditor::Reorient2D (TIDSortedElemSet & theFaces,
{
// link has already been checked and won't be encountered more
// if the group (theFaces) is manifold
checkedLinks.erase( linkIt_isNew.first );
//checkedLinks.erase( linkIt_isNew.first );
}
else
{
int nodeInd1, nodeInd2;
const SMDS_MeshElement* otherFace = FindFaceInSet( link.first, link.second,
theFaces, avoidSet,
& nodeInd1, & nodeInd2);
facesNearLink.clear();
nodeIndsOfFace.clear();
while (( otherFace = FindFaceInSet( link.first, link.second,
theFaces, avoidSet, &nodeInd1, &nodeInd2 )))
if ( otherFace != theFace)
{
facesNearLink.push_back( otherFace );
nodeIndsOfFace.push_back( make_pair( nodeInd1, nodeInd2 ));
avoidSet.insert( otherFace );
}
if ( facesNearLink.size() > 1 )
{
// NON-MANIFOLD mesh shell !
// select a face most co-directed with theFace,
// other faces won't be visited this time
gp_XYZ NF, NOF;
SMESH_Algo::FaceNormal( theFace, NF, /*normalized=*/false );
double proj, maxProj = -1;
for ( size_t i = 0; i < facesNearLink.size(); ++i ) {
SMESH_Algo::FaceNormal( facesNearLink[i], NOF, /*normalized=*/false );
if (( proj = Abs( NF * NOF )) > maxProj ) {
maxProj = proj;
otherFace = facesNearLink[i];
nodeInd1 = nodeIndsOfFace[i].first;
nodeInd2 = nodeIndsOfFace[i].second;
}
}
// not to visit rejected faces
for ( size_t i = 0; i < facesNearLink.size(); ++i )
if ( facesNearLink[i] != otherFace && theFaces.size() > 1 )
visitedFaces.insert( facesNearLink[i] );
}
else if ( facesNearLink.size() == 1 )
{
otherFace = facesNearLink[0];
nodeInd1 = nodeIndsOfFace.back().first;
nodeInd2 = nodeIndsOfFace.back().second;
}
if ( otherFace && otherFace != theFace)
{
// link must be reversed in otherFace if orientation ot otherFace
// link must be reverse in otherFace if orientation ot otherFace
// is same as that of theFace
if ( abs(nodeInd2-nodeInd1) == 1 ? nodeInd2 > nodeInd1 : nodeInd1 > nodeInd2 )
{
// cout << "Reorient " << otherFace->GetID() << " near theFace=" <<theFace->GetID()
// << " \tlink( " << link.first->GetID() << " " << link.second->GetID() << endl;
nbReori += Reorient( otherFace );
}
startFaces.insert( otherFace );
if ( theFaces.size() > 1 ) // leave 1 face to prevent finding not selected faces
theFaces.erase( otherFace );
}
}
std::swap( link.first, link.second );
std::swap( link.first, link.second ); // reverse the link
}
startFaces.erase( startFace );
startFace = startFaces.begin();
}
return nbReori;
}
@ -1216,7 +1305,8 @@ bool SMESH_MeshEditor::QuadToTri (TIDSortedElemSet & theElems,
if( !elem->IsQuadratic() ) {
// split liner quadrangle
// for MaxElementLength2D functor we return minimum diagonal for splitting,
// because aBadRate1=2*len(diagonal 1-3); aBadRate2=2*len(diagonal 2-4)
if ( aBadRate1 <= aBadRate2 ) {
// tr1 + tr2 is better
newElem1 = aMesh->AddFace( aNodes[2], aNodes[3], aNodes[0] );
@ -1350,7 +1440,8 @@ int SMESH_MeshEditor::BestSplit (const SMDS_MeshElement* theQuad,
SMDS_FaceOfNodes tr3 ( aNodes[1], aNodes[2], aNodes[3] );
SMDS_FaceOfNodes tr4 ( aNodes[3], aNodes[0], aNodes[1] );
aBadRate2 = getBadRate( &tr3, theCrit ) + getBadRate( &tr4, theCrit );
// for MaxElementLength2D functor we return minimum diagonal for splitting,
// because aBadRate1=2*len(diagonal 1-3); aBadRate2=2*len(diagonal 2-4)
if (aBadRate1 <= aBadRate2) // tr1 + tr2 is better
return 1; // diagonal 1-3
@ -3062,7 +3153,7 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems,
SMDS_FaceIteratorPtr fIt = aMesh->facesIterator();
while ( fIt->more() ) {
const SMDS_MeshElement* face = fIt->next();
theElems.insert( face );
theElems.insert( theElems.end(), face );
}
}
// get all face ids theElems are on
@ -5082,10 +5173,16 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
if ( BRep_Tool::Degenerated( aTrackEdge ) )
return EXTR_BAD_PATH_SHAPE;
TopExp::Vertices( aTrackEdge, aV1, aV2 );
const SMDS_MeshNode* aN1 = 0;
const SMDS_MeshNode* aN2 = 0;
if ( theTrack->GetSubMesh( aV1 ) && theTrack->GetSubMesh( aV1 )->GetSubMeshDS() ) {
aItN = theTrack->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes();
const SMDS_MeshNode* aN1 = aItN->next();
aN1 = aItN->next();
}
if ( theTrack->GetSubMesh( aV2 ) && theTrack->GetSubMesh( aV2 )->GetSubMeshDS() ) {
aItN = theTrack->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes();
const SMDS_MeshNode* aN2 = aItN->next();
aN2 = aItN->next();
}
// starting node must be aN1 or aN2
if ( !( aN1 == theN1 || aN2 == theN1 ) )
return EXTR_BAD_STARTING_NODE;
@ -5115,7 +5212,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
}
}
list< list<SMESH_MeshEditor_PathPoint> > LLPPs;
int startNid = theN1->GetID();
TopoDS_Vertex aVprev;
TColStd_MapOfInteger UsedNums;
int NbEdges = Edges.Length();
int i = 1;
@ -5129,12 +5226,32 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
SMESH_subMesh* locTrack = *itLSM;
SMESHDS_SubMesh* locMeshDS = locTrack->GetSubMeshDS();
TopExp::Vertices( aTrackEdge, aV1, aV2 );
bool aN1isOK = false, aN2isOK = false;
if ( aVprev.IsNull() ) {
// if previous vertex is not yet defined, it means that we in the beginning of wire
// and we have to find initial vertex corresponding to starting node theN1
const SMDS_MeshNode* aN1 = 0;
const SMDS_MeshNode* aN2 = 0;
if ( locTrack->GetFather()->GetSubMesh(aV1) && locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS() ) {
aItN = locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS()->GetNodes();
const SMDS_MeshNode* aN1 = aItN->next();
aN1 = aItN->next();
}
if ( locTrack->GetFather()->GetSubMesh(aV2) && locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS() ) {
aItN = locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS()->GetNodes();
const SMDS_MeshNode* aN2 = aItN->next();
aN2 = aItN->next();
}
// starting node must be aN1 or aN2
if ( !( aN1->GetID() == startNid || aN2->GetID() == startNid ) ) continue;
aN1isOK = ( aN1 && aN1 == theN1 );
aN2isOK = ( aN2 && aN2 == theN1 );
}
else {
// we have specified ending vertex of the previous edge on the previous iteration
// and we have just to check that it corresponds to any vertex in current segment
aN1isOK = aVprev.IsSame( aV1 );
aN2isOK = aVprev.IsSame( aV2 );
}
if ( !aN1isOK && !aN2isOK ) continue;
// 2. Collect parameters on the track edge
aPrms.clear();
aItN = locMeshDS->GetNodes();
@ -5147,12 +5264,12 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
}
list<SMESH_MeshEditor_PathPoint> LPP;
//Extrusion_Error err =
MakeEdgePathPoints(aPrms, aTrackEdge,(aN1->GetID()==startNid), LPP);
MakeEdgePathPoints(aPrms, aTrackEdge, aN1isOK, LPP);
LLPPs.push_back(LPP);
UsedNums.Add(k);
// update startN for search following egde
if( aN1->GetID() == startNid ) startNid = aN2->GetID();
else startNid = aN1->GetID();
if ( aN1isOK ) aVprev = aV2;
else aVprev = aV1;
break;
}
}
@ -5171,8 +5288,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
SMESH_MeshEditor_PathPoint PP2 = currList.front();
gp_Dir D1 = PP1.Tangent();
gp_Dir D2 = PP2.Tangent();
gp_Dir Dnew( gp_Vec( (D1.X()+D2.X())/2, (D1.Y()+D2.Y())/2,
(D1.Z()+D2.Z())/2 ) );
gp_Dir Dnew( ( D1.XYZ() + D2.XYZ() ) / 2 );
PP1.SetTangent(Dnew);
fullList.push_back(PP1);
itPP++;
@ -6103,7 +6219,7 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
}
else if ( tree->NbNodes() ) // put a tree to the treeMap
{
const Bnd_B3d& box = tree->getBox();
const Bnd_B3d& box = *tree->getBox();
double sqDist = thePnt.SquareDistance( 0.5 * ( box.CornerMin() + box.CornerMax() ));
pair<TDistTreeMap::iterator,bool> it_in = treeMap.insert( make_pair( sqDist, tree ));
if ( !it_in.second ) // not unique distance to box center
@ -6115,7 +6231,7 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
TDistTreeMap::iterator sqDist_tree = treeMap.begin();
if ( treeMap.size() > 5 ) {
SMESH_OctreeNode* closestTree = sqDist_tree->second;
const Bnd_B3d& box = closestTree->getBox();
const Bnd_B3d& box = *closestTree->getBox();
double limit = sqrt( sqDist_tree->first ) + sqrt ( box.SquareExtent() );
sqLimit = limit * limit;
}
@ -6200,7 +6316,7 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
protected:
ElementBndBoxTree():_size(0) {}
SMESH_Octree* allocateOctreeChild() const { return new ElementBndBoxTree; }
SMESH_Octree* newChild() const { return new ElementBndBoxTree; }
void buildChildrenData();
Bnd_B3d* buildRootBox();
private:
@ -6222,7 +6338,7 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
//================================================================================
ElementBndBoxTree::ElementBndBoxTree(const SMDS_Mesh& mesh, SMDSAbs_ElementType elemType, SMDS_ElemIteratorPtr theElemIt, double tolerance)
:SMESH_Octree( new SMESH_Octree::Limit( MaxLevel, /*minSize=*/0. ))
:SMESH_Octree( new SMESH_TreeLimit( MaxLevel, /*minSize=*/0. ))
{
int nbElems = mesh.GetMeshInfo().NbElements( elemType );
_elements.reserve( nbElems );
@ -6273,7 +6389,7 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
{
for (int j = 0; j < 8; j++)
{
if ( !_elements[i]->IsOut( myChildren[j]->getBox() ))
if ( !_elements[i]->IsOut( *myChildren[j]->getBox() ))
{
_elements[i]->_refCount++;
((ElementBndBoxTree*)myChildren[j])->_elements.push_back( _elements[i]);
@ -6304,7 +6420,7 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
void ElementBndBoxTree::getElementsNearPoint( const gp_Pnt& point,
TIDSortedElemSet& foundElems)
{
if ( getBox().IsOut( point.XYZ() ))
if ( getBox()->IsOut( point.XYZ() ))
return;
if ( isLeaf() )
@ -6329,7 +6445,7 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
void ElementBndBoxTree::getElementsNearLine( const gp_Ax1& line,
TIDSortedElemSet& foundElems)
{
if ( getBox().IsOut( line ))
if ( getBox()->IsOut( line ))
return;
if ( isLeaf() )
@ -6355,7 +6471,7 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
const double radius,
TIDSortedElemSet& foundElems)
{
if ( getBox().IsOut( center, radius ))
if ( getBox()->IsOut( center, radius ))
return;
if ( isLeaf() )
@ -6737,10 +6853,10 @@ SMESH_ElementSearcherImpl::FindClosestTo( const gp_Pnt& point,
if ( suspectElems.empty() && _ebbTree->maxSize() > 0 )
{
gp_Pnt boxCenter = 0.5 * ( _ebbTree->getBox().CornerMin() +
_ebbTree->getBox().CornerMax() );
gp_Pnt boxCenter = 0.5 * ( _ebbTree->getBox()->CornerMin() +
_ebbTree->getBox()->CornerMax() );
double radius;
if ( _ebbTree->getBox().IsOut( point.XYZ() ))
if ( _ebbTree->getBox()->IsOut( point.XYZ() ))
radius = point.Distance( boxCenter ) - 0.5 * _ebbTree->maxSize();
else
radius = _ebbTree->maxSize() / pow( 2., _ebbTree->getHeight()) / 2;
@ -8156,32 +8272,29 @@ private:
//purpose : Return list of group of elements built on the same nodes.
// Search among theElements or in the whole mesh if theElements is empty
//=======================================================================
void SMESH_MeshEditor::FindEqualElements(set<const SMDS_MeshElement*> & theElements,
void SMESH_MeshEditor::FindEqualElements(TIDSortedElemSet & theElements,
TListOfListOfElementsID & theGroupsOfElementsID)
{
myLastCreatedElems.Clear();
myLastCreatedNodes.Clear();
typedef set<const SMDS_MeshElement*> TElemsSet;
typedef map< SortableElement, int > TMapOfNodeSet;
typedef list<int> TGroupOfElems;
TElemsSet elems;
if ( theElements.empty() )
{ // get all elements in the mesh
SMDS_ElemIteratorPtr eIt = GetMeshDS()->elementsIterator();
while ( eIt->more() )
elems.insert( elems.end(), eIt->next());
theElements.insert( theElements.end(), eIt->next());
}
else
elems = theElements;
vector< TGroupOfElems > arrayOfGroups;
TGroupOfElems groupOfElems;
TMapOfNodeSet mapOfNodeSet;
TElemsSet::iterator elemIt = elems.begin();
for ( int i = 0, j=0; elemIt != elems.end(); ++elemIt, ++j ) {
TIDSortedElemSet::iterator elemIt = theElements.begin();
for ( int i = 0, j=0; elemIt != theElements.end(); ++elemIt, ++j ) {
const SMDS_MeshElement* curElem = *elemIt;
SortableElement SE(curElem);
int ind = -1;
@ -8254,7 +8367,7 @@ void SMESH_MeshEditor::MergeElements(TListOfListOfElementsID & theGroupsOfElemen
void SMESH_MeshEditor::MergeEqualElements()
{
set<const SMDS_MeshElement*> aMeshElements; /* empty input -
TIDSortedElemSet aMeshElements; /* empty input ==
to merge equal elements in the whole mesh */
TListOfListOfElementsID aGroupsOfElementsID;
FindEqualElements(aMeshElements, aGroupsOfElementsID);
@ -11779,8 +11892,11 @@ void SMESH_MeshEditor::CreateHoleSkin(double radius,
groupDS = group->GetGroupDS();
if ( !groupDS || groupDS->IsEmpty() ) continue;
std::string grpName = group->GetName();
//MESSAGE("grpName=" << grpName);
if (grpName == groupName)
break;
else
groupDS = 0;
}
bool isNodeGroup = false;
@ -11794,6 +11910,7 @@ void SMESH_MeshEditor::CreateHoleSkin(double radius,
if (nodesCoords.size() > 0)
isNodeCoords = true; // a list o nodes given by their coordinates
//MESSAGE("---" << isNodeGroup << " " << isNodeCoords);
// --- define groups to build

View File

@ -116,6 +116,7 @@ public:
const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; }
const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; }
void CrearLastCreated();
SMESH_ComputeErrorPtr & GetError() { return myError; }
@ -139,6 +140,12 @@ public:
// Remove a node or an element.
// Modify a compute state of sub-meshes which become empty
void Create0DElementsOnAllNodes( const TIDSortedElemSet& elements,
TIDSortedElemSet& all0DElems);
// Create 0D elements on all nodes of the given object except those
// nodes on which a 0D element already exists. \a all0DElems returns
// all 0D elements found or created on nodes of \a elements
bool InverseDiag (const SMDS_MeshElement * theTria1,
const SMDS_MeshElement * theTria2 );
// Replace two neighbour triangles with ones built on the same 4 nodes
@ -350,15 +357,6 @@ public:
SMESH_Mesh* theTargetMesh=0);
// Move or copy theElements applying theTrsf to their nodes
typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
void FindCoincidentNodes (TIDSortedNodeSet & theNodes,
const double theTolerance,
TListOfListOfNodes & theGroupsOfNodes);
// Return list of group of nodes close to each other within theTolerance.
// Search among theNodes or in the whole mesh if theNodes is empty.
/*!
* \brief Return SMESH_NodeSearcher. The caller is responsible for deleteing it
*/
@ -369,6 +367,33 @@ public:
*/
SMESH_ElementSearcher* GetElementSearcher();
SMESH_ElementSearcher* GetElementSearcher( SMDS_ElemIteratorPtr elemIt );
typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
void FindCoincidentNodes (TIDSortedNodeSet & theNodes,
const double theTolerance,
TListOfListOfNodes & theGroupsOfNodes);
// Return list of group of nodes close to each other within theTolerance.
// Search among theNodes or in the whole mesh if theNodes is empty.
void MergeNodes (TListOfListOfNodes & theNodeGroups);
// In each group, the cdr of nodes are substituted by the first one
// in all elements.
typedef std::list< std::list< int > > TListOfListOfElementsID;
void FindEqualElements(TIDSortedElemSet & theElements,
TListOfListOfElementsID & theGroupsOfElementsID);
// Return list of group of elements build on the same nodes.
// Search among theElements or in the whole mesh if theElements is empty.
void MergeElements(TListOfListOfElementsID & theGroupsOfElementsID);
// In each group remove all but first of elements.
void MergeEqualElements();
// Remove all but one of elements built on the same nodes.
// Return nb of successfully merged groups.
/*!
* \brief Return true if the point is IN or ON of the element
*/
@ -382,24 +407,6 @@ public:
// Split face, defined by <faceNodes>, into several faces by repeating nodes.
// Is used by MergeNodes()
void MergeNodes (TListOfListOfNodes & theNodeGroups);
// In each group, the cdr of nodes are substituted by the first one
// in all elements.
typedef std::list< std::list< int > > TListOfListOfElementsID;
void FindEqualElements(std::set<const SMDS_MeshElement*> & theElements,
TListOfListOfElementsID & theGroupsOfElementsID);
// Return list of group of elements build on the same nodes.
// Search among theElements or in the whole mesh if theElements is empty.
void MergeElements(TListOfListOfElementsID & theGroupsOfElementsID);
// In each group remove all but first of elements.
void MergeEqualElements();
// Remove all but one of elements built on the same nodes.
// Return nb of successfully merged groups.
static bool CheckFreeBorderNodes(const SMDS_MeshNode* theNode1,
const SMDS_MeshNode* theNode2,
const SMDS_MeshNode* theNode3 = 0);

View File

@ -283,6 +283,18 @@ void SMESH_MesherHelper::SetSubShape(const TopoDS_Shape& aSh)
myDegenShapeIds.insert( meshDS->ShapeToIndex( v.Current() ));
}
}
if ( !myDegenShapeIds.empty() && !myParIndex ) {
if ( surface->IsUPeriodic() || surface->IsUClosed() ) {
myParIndex |= U_periodic;
myPar1[0] = surf.FirstUParameter();
myPar2[0] = surf.LastUParameter();
}
else if ( surface->IsVPeriodic() || surface->IsVClosed() ) {
myParIndex |= V_periodic;
myPar1[1] = surf.FirstVParameter();
myPar2[1] = surf.LastVParameter();
}
}
}
}
}
@ -329,7 +341,7 @@ bool SMESH_MesherHelper::IsMedium(const SMDS_MeshNode* node,
TopoDS_Shape SMESH_MesherHelper::GetSubShapeByNode(const SMDS_MeshNode* node,
const SMESHDS_Mesh* meshDS)
{
int shapeID = node->getshapeId();
int shapeID = node ? node->getshapeId() : 0;
if ( 0 < shapeID && shapeID <= meshDS->MaxShapeIndex() )
return meshDS->IndexToShape( shapeID );
else
@ -3428,7 +3440,7 @@ namespace { // Structures used by FixQuadraticElements()
*/
//=======================================================================
void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& error,
void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
bool volumeOnly)
{
// setenv NO_FixQuadraticElements to know if FixQuadraticElements() is guilty of bad conversion
@ -3462,7 +3474,8 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& error,
#endif
SMESH_MesherHelper h(*myMesh);
h.SetSubShape( s.Current() );
h.FixQuadraticElements( error, false );
h.ToFixNodeParameters(true);
h.FixQuadraticElements( compError, false );
}
}
// fix nodes on geom faces
@ -3473,12 +3486,12 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& error,
MSG("FIX FACE " << nbfaces-- << " #" << GetMeshDS()->ShapeToIndex(fIt.Key()));
SMESH_MesherHelper h(*myMesh);
h.SetSubShape( fIt.Key() );
h.FixQuadraticElements( error, true);
h.ToFixNodeParameters(true);
h.FixQuadraticElements( compError, true);
}
//perf_print_all_meters(1);
if ( error && error->myName == EDITERR_NO_MEDIUM_ON_GEOM )
error->myComment = "during conversion to quadratic, "
if ( compError && compError->myName == EDITERR_NO_MEDIUM_ON_GEOM )
compError->myComment = "during conversion to quadratic, "
"some medium nodes were not placed on geometry to avoid distorting elements";
return;
}
@ -3521,7 +3534,7 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& error,
// Issue 0020982
// Move medium nodes to the link middle for elements whose corner nodes
// are out of geometrical boundary to fix distorted elements.
force3DOutOfBoundary( *this, error );
force3DOutOfBoundary( *this, compError );
if ( elemType == SMDSAbs_Volume )
{
@ -3595,7 +3608,9 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& error,
QLink link( face->GetNode(iN), face->GetNode((iN+1)%nbN), face->GetNode(iN+nbN) );
pLink = links.insert( link ).first;
faceLinks[ iN ] = & *pLink;
if ( !isCurved )
if ( !isCurved &&
link.node1()->GetPosition()->GetTypeOfPosition() < 2 &&
link.node2()->GetPosition()->GetTypeOfPosition() < 2 )
isCurved = !link.IsStraight();
}
// store QFace

View File

@ -178,6 +178,21 @@ const SMDS_MeshNode* SMESH_ProxyMesh::GetProxyNode( const SMDS_MeshNode* node )
return proxy;
}
//================================================================================
/*!
* \brief Returns number of proxy sub-meshes
*/
//================================================================================
int SMESH_ProxyMesh::NbProxySubMeshes() const
{
int nb = 0;
for ( size_t i = 0; i < _subMeshes.size(); ++i )
nb += bool( _subMeshes[i] );
return nb;
}
namespace
{
//================================================================================
@ -329,7 +344,7 @@ SMESH_ProxyMesh::SubMesh* SMESH_ProxyMesh::getProxySubMesh(int index)
if ( int(_subMeshes.size()) <= index )
_subMeshes.resize( index+1, 0 );
if ( !_subMeshes[index] )
_subMeshes[index] = new SubMesh( index );
_subMeshes[index] = newSubmesh( index );
return _subMeshes[index];
}
@ -408,24 +423,24 @@ void SMESH_ProxyMesh::takeTmpElemsInMesh( SMESH_ProxyMesh* proxyMesh )
//================================================================================
/*!
* \brief Removes tmp faces from the _mesh
* \brief Removes tmp elements from the _mesh
*/
//================================================================================
void SMESH_ProxyMesh::removeTmpElement( const SMDS_MeshElement* face )
void SMESH_ProxyMesh::removeTmpElement( const SMDS_MeshElement* elem )
{
if ( face && face->GetID() > 0 )
if ( elem && elem->GetID() > 0 )
{
set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.find( face );
set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.find( elem );
if ( i != _elemsInMesh.end() )
{
GetMeshDS()->RemoveFreeElement( face, 0 );
GetMeshDS()->RemoveFreeElement( elem, 0 );
_elemsInMesh.erase( i );
}
}
else
{
delete face;
delete elem;
}
}
@ -435,9 +450,9 @@ void SMESH_ProxyMesh::removeTmpElement( const SMDS_MeshElement* face )
*/
//================================================================================
void SMESH_ProxyMesh::storeTmpElement( const SMDS_MeshElement* face )
void SMESH_ProxyMesh::storeTmpElement( const SMDS_MeshElement* elem )
{
_elemsInMesh.insert( face );
_elemsInMesh.insert( elem );
}
//================================================================================
@ -499,18 +514,20 @@ void SMESH_ProxyMesh::SubMesh::Clear()
//================================================================================
/*!
* \brief Return number of elements in a proxy submesh
* \brief Return number of elements in a proxy sub-mesh. The method is meaningful
* for a sub-mesh containing tmp faces.
*/
//================================================================================
int SMESH_ProxyMesh::SubMesh::NbElements() const
{
return _elements.size();
return _uvPtStructVec.empty() ? _elements.size() : _uvPtStructVec.size() - 1;
}
//================================================================================
/*!
* \brief Return elements of a proxy submesh
* \brief Return elements of a proxy sub-mesh. The method is meaningful
* for a sub-mesh containing tmp faces.
*/
//================================================================================
@ -520,6 +537,39 @@ SMDS_ElemIteratorPtr SMESH_ProxyMesh::SubMesh::GetElements() const
( new SMDS_ElementVectorIterator( _elements.begin(), _elements.end() ));
}
//================================================================================
/*!
* \brief Return number of nodes in a proxy sub-mesh. The method is meaningful
* for a sub-mesh containing nodes of 2D viscous layer.
*/
//================================================================================
int SMESH_ProxyMesh::SubMesh::NbNodes() const
{
return _uvPtStructVec.size();
}
//================================================================================
/*!
* \brief Return nodes of a proxy sub-mesh. The method is meaningful
* for a sub-mesh containing nodes of 2D viscous layer.
*/
//================================================================================
SMDS_NodeIteratorPtr SMESH_ProxyMesh::SubMesh::GetNodes() const
{
if ( !_uvPtStructVec.empty() )
return SMDS_NodeIteratorPtr ( new SMDS_SetIterator
< SMDS_pNode,
UVPtStructVec::const_iterator,
UVPtStruct::NodeAccessor >
( _uvPtStructVec.begin(), _uvPtStructVec.end() ));
return SMDS_NodeIteratorPtr
( new SMDS_SetIterator< SMDS_pNode, std::vector< SMDS_pElement >::const_iterator>
( _elements.begin(), _elements.end() ));
}
//================================================================================
/*!
* \brief Store an element

View File

@ -28,6 +28,7 @@
#include "SMDS_MeshElement.hxx"
#include "SMESHDS_SubMesh.hxx"
#include "SMESH_TypeDefs.hxx"
#include <TopoDS_Shape.hxx>
@ -40,7 +41,8 @@ class SMESHDS_Mesh;
class SMESH_Mesh;
/*!
* \brief Container of mesh faces substituting other faces in the input mesh of 3D algorithm
* \brief Container of xD mesh elements substituting other ones in the
* input mesh of an (x+1)D algorithm
*/
class SMESH_EXPORT SMESH_ProxyMesh
{
@ -54,32 +56,35 @@ public:
/*!
* \brief Proxy sub-mesh
*/
class SubMesh : public SMESHDS_SubMesh
class SMESH_EXPORT SubMesh : public SMESHDS_SubMesh
{
public:
const TN2NMap* GetNodeNodeMap() const { return _n2n; }
const SMDS_MeshNode* GetProxyNode( const SMDS_MeshNode* n ) const;
const UVPtStructVec& GetUVPtStructVec() const { return _uvPtStructVec; }
virtual void AddElement(const SMDS_MeshElement * e);
virtual int NbElements() const;
virtual int NbNodes() const;
virtual SMDS_ElemIteratorPtr GetElements() const;
virtual SMDS_NodeIteratorPtr GetNodes() const;
virtual void Clear();
virtual bool Contains(const SMDS_MeshElement * ME) const;
template< class ITERATOR >
void ChangeElements( ITERATOR it, ITERATOR end )
{
// change SubMesh contents without deleting tmp faces
// change SubMesh contents without deleting tmp elements
// for which the caller is responsible
_elements.clear();
while ( it != end ) _elements.push_back( *it++ );
_elements.assign( it, end );
}
SubMesh(int index=0):SMESHDS_SubMesh(0,index),_n2n(0) {}
~SubMesh() { Clear(); }
virtual ~SubMesh() { Clear(); }
private:
protected:
std::vector<const SMDS_MeshElement *> _elements;
TN2NMap* _n2n;
UVPtStructVec _uvPtStructVec; // for SubMesh of EDGE
friend class SMESH_ProxyMesh;
};
//--------------------------------------------------------------------------------
@ -90,16 +95,19 @@ public:
SMESH_ProxyMesh(const SMESH_Mesh& mesh) { _mesh = &mesh; }
virtual ~SMESH_ProxyMesh();
// Returns the submesh of a face; it can be a proxy sub-mesh
const SMESHDS_SubMesh* GetSubMesh(const TopoDS_Shape& face) const;
// Returns the submesh of a shape; it can be a proxy sub-mesh
const SMESHDS_SubMesh* GetSubMesh(const TopoDS_Shape& shape) const;
// Returns the proxy sub-mesh of a face; it can be NULL
const SubMesh* GetProxySubMesh(const TopoDS_Shape& face) const;
// Returns the proxy sub-mesh of a shape; it can be NULL
const SubMesh* GetProxySubMesh(const TopoDS_Shape& shape) const;
// Returns the proxy node of a node; the input node is returned if no proxy exists
const SMDS_MeshNode* GetProxyNode( const SMDS_MeshNode* node ) const;
// Returns iterator on all faces of the mesh taking into account substitutions
// Returns number of proxy sub-meshes
int NbProxySubMeshes() const;
// Returns iterator on all faces of the mesh taking into account substitutions.
// To be used in case of mesh without shape
SMDS_ElemIteratorPtr GetFaces() const;
@ -113,7 +121,7 @@ public:
const SMESH_Mesh* GetMesh() const { return _mesh; }
SMESH_Mesh* GetMesh() const { return const_cast<SMESH_Mesh*>( _mesh ); }
SMESHDS_Mesh* GetMeshDS() const;
@ -125,6 +133,8 @@ public:
int shapeIndex(const TopoDS_Shape& shape) const;
virtual SubMesh* newSubmesh(int index=0) const { return new SubMesh(index); }
// returns a proxy sub-mesh; zero index is for the case of mesh w/o shape
SubMesh* findProxySubMesh(int shapeIndex=0) const;
@ -140,11 +150,11 @@ public:
// move tmp elements residing the _mesh from other proxy mesh to this
void takeTmpElemsInMesh( SMESH_ProxyMesh* proxyMesh );
// removes tmp faces from the _mesh
void removeTmpElement( const SMDS_MeshElement* face );
// removes tmp element from the _mesh
void removeTmpElement( const SMDS_MeshElement* elem );
// stores tmp element residing the _mesh
void storeTmpElement( const SMDS_MeshElement* face );
void storeTmpElement( const SMDS_MeshElement* elem );
// store node-node correspondence
void setNode2Node(const SMDS_MeshNode* srcNode,

View File

@ -149,6 +149,17 @@ SMESHDS_SubMesh * SMESH_subMesh::GetSubMeshDS()
*/
//=============================================================================
const SMESHDS_SubMesh * SMESH_subMesh::GetSubMeshDS() const
{
return ((SMESH_subMesh*) this )->GetSubMeshDS();
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESHDS_SubMesh* SMESH_subMesh::CreateSubMeshDS()
{
if ( !GetSubMeshDS() ) {
@ -1122,7 +1133,7 @@ bool SMESH_subMesh::IsConform(const SMESH_Algo* theAlgo)
*/
//=============================================================================
void SMESH_subMesh::setAlgoState(int state)
void SMESH_subMesh::setAlgoState(algo_state state)
{
_algoState = state;
}
@ -1258,7 +1269,19 @@ static void cleanSubMesh( SMESH_subMesh * subMesh )
bool SMESH_subMesh::ComputeStateEngine(int event)
{
_computeError.reset();
switch ( event ) {
case MODIF_ALGO_STATE:
case COMPUTE:
//case COMPUTE_CANCELED:
case CLEAN:
//case SUBMESH_COMPUTED:
//case SUBMESH_RESTORED:
//case SUBMESH_LOADED:
//case MESH_ENTITY_REMOVED:
//case CHECK_COMPUTE_STATE:
_computeError.reset(); break;
default:;
}
//MESSAGE("SMESH_subMesh::ComputeStateEngine");
//SCRUTE(_computeState);
@ -2066,7 +2089,8 @@ void SMESH_subMesh::SetEventListener(EventListener* listener,
*/
//================================================================================
void SMESH_subMesh::setEventListener(EventListener* listener, EventListenerData* data)
void SMESH_subMesh::setEventListener(EventListener* listener,
EventListenerData* data)
{
map< EventListener*, EventListenerData* >::iterator l_d =
_eventListeners.find( listener );
@ -2077,7 +2101,20 @@ void SMESH_subMesh::setEventListener(EventListener* listener, EventListenerData*
l_d->second = data;
}
else
{
for ( l_d = _eventListeners.begin(); l_d != _eventListeners.end(); ++l_d )
if ( listener->GetName() == l_d->first->GetName() )
{
EventListenerData* curData = l_d->second;
if ( curData && curData != data && curData->IsDeletable() )
delete curData;
if ( l_d->first->IsDeletable() )
delete l_d->first;
_eventListeners.erase( l_d );
break;
}
_eventListeners.insert( make_pair( listener, data ));
}
}
//================================================================================
@ -2128,16 +2165,18 @@ void SMESH_subMesh::notifyListenersOnEvent( const int event,
SMESH_Hypothesis* hyp)
{
map< EventListener*, EventListenerData* >::iterator l_d = _eventListeners.begin();
for ( ; l_d != _eventListeners.end(); ++l_d )
for ( ; l_d != _eventListeners.end(); )
{
std::pair< EventListener*, EventListenerData* > li_da = *l_d; /* copy to enable removal
std::pair< EventListener*, EventListenerData* > li_da = *l_d++; /* copy to enable removal
of a listener from
_eventListeners by
its ProcessEvent() */
if ( li_da.first->myBusySM.insert( this ).second )
{
const size_t nbListenersBefore = _eventListeners.size();
li_da.first->ProcessEvent( event, eventType, this, li_da.second, hyp );
li_da.first->myBusySM.erase( this );
if ( nbListenersBefore == _eventListeners.size() )
li_da.first->myBusySM.erase( this ); // a listener hopefully not removed
}
}
}
@ -2164,6 +2203,9 @@ void SMESH_subMesh::DeleteEventListener(EventListener* listener)
delete l_d->second;
}
_eventListeners.erase( l_d );
if ( l_d->first && !l_d->first->IsDeletable() )
l_d->first->myBusySM.erase( this );
}
}

View File

@ -59,15 +59,18 @@ typedef boost::shared_ptr< SMDS_Iterator<SMESH_subMesh*> > SMESH_subMeshIterator
class SMESH_EXPORT SMESH_subMesh
{
public:
SMESH_subMesh(int Id, SMESH_Mesh * father, SMESHDS_Mesh * meshDS,
SMESH_subMesh(int Id,
SMESH_Mesh * father,
SMESHDS_Mesh * meshDS,
const TopoDS_Shape & aSubShape);
virtual ~ SMESH_subMesh();
int GetId() const;
int GetId() const; // == meshDS->ShapeToIndex( aSubShape )
SMESH_Mesh* GetFather() { return _father; }
SMESHDS_SubMesh * GetSubMeshDS();
const SMESHDS_SubMesh * GetSubMeshDS() const;
SMESHDS_SubMesh* CreateSubMeshDS();
// Explicit SMESHDS_SubMesh creation method, required for persistence mechanism
@ -206,8 +209,8 @@ public:
SMESH_Hypothesis::Hypothesis_Status
SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis * anHyp);
int GetAlgoState() const { return _algoState; }
int GetComputeState() const { return _computeState; };
algo_state GetAlgoState() const { return _algoState; }
compute_state GetComputeState() const { return _computeState; };
SMESH_ComputeErrorPtr& GetComputeError() { return _computeError; }
void DumpAlgoState(bool isMain);
@ -272,7 +275,7 @@ protected:
void updateSubMeshState(const compute_state theState);
void cleanDependants();
void cleanDependsOn();
void setAlgoState(int state);
void setAlgoState(algo_state state);
/*!
* \brief Return a shape containing all sub-shapes of the MainShape that can be
@ -311,8 +314,8 @@ protected:
std::map < int, SMESH_subMesh * >_mapDepend;
bool _dependenceAnalysed;
int _algoState;
int _computeState;
algo_state _algoState;
compute_state _computeState;
SMESH_ComputeErrorPtr _computeError;
// allow algo->Compute() if a subshape of lower dim is meshed but

View File

@ -823,7 +823,7 @@ static void removeFromContainers (map<int,SMESHDS_SubMesh*>& theSubMeshes,
// Element should belong to only one sub-mesh
if ( !theSubMeshes.empty() )
{
SMESHDS_Mesh* mesh = theSubMeshes.begin()->second->getParent();
SMESHDS_Mesh* mesh = theSubMeshes.begin()->second->GetParent();
list<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
if ( isNode ) {
for ( ; elIt != theElems.end(); ++elIt )

View File

@ -73,7 +73,8 @@ class SMESHDS_EXPORT SMESHDS_SubMesh
int getSize();
void compactList();
inline SMESHDS_Mesh *getParent() {return myParent; };
SMESHDS_Mesh *GetParent() { return myParent; }
int GetID() const { return myIndex; }
private:
SMESHDS_Mesh * myParent;

View File

@ -39,7 +39,8 @@
#define SMESHFILTERSSELECTION_EXPORT
#endif
enum MeshObjectType {
namespace SMESH{
enum MeshObjectType {
HYPOTHESIS,
ALGORITHM,
MESH,
@ -59,6 +60,6 @@ enum MeshObjectType {
GROUP_BALL,
COMPONENT,
IDSOURCE
};
};
#endif

View File

@ -30,7 +30,7 @@
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SMESH_Gen)
SMESH_TypeFilter::SMESH_TypeFilter (MeshObjectType theType)
SMESH_TypeFilter::SMESH_TypeFilter (SMESH::MeshObjectType theType)
{
myType = theType;
}
@ -88,7 +88,7 @@ bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const
switch (myType)
{
case HYPOTHESIS:
case SMESH::HYPOTHESIS:
{
if (aLevel == 2 && (objFather->Tag() == SMESH::Tag_HypothesisRoot))
// hypo definition
@ -101,7 +101,7 @@ bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const
Ok = true;
break;
}
case ALGORITHM:
case SMESH::ALGORITHM:
{
if (aLevel == 2 && (objFather->Tag() == SMESH::Tag_AlgorithmsRoot))
// algo definition
@ -114,13 +114,13 @@ bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const
Ok = true;
break;
}
case MESH:
case SMESH::MESH:
{
if (aLevel == 1 && (obj->Tag() >= SMESH::Tag_FirstMeshRoot))
Ok = true;
break;
}
case SUBMESH:
case SMESH::SUBMESH:
{
// see SMESH_Gen_i.cxx for tag numbers
if (aLevel == 3 && (objFather->Tag() >= SMESH::Tag_FirstSubMesh &&
@ -128,7 +128,7 @@ bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const
Ok = true;
break;
}
case MESHorSUBMESH:
case SMESH::MESHorSUBMESH:
{
if (aLevel == 1 && (obj->Tag() >= SMESH::Tag_FirstMeshRoot))
Ok = true; // mesh
@ -137,82 +137,82 @@ bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const
Ok = true;
break;
}
case SUBMESH_VERTEX: // Label "SubMeshes on vertexes"
case SMESH::SUBMESH_VERTEX: // Label "SubMeshes on vertexes"
{
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnVertex))
Ok = true;
break;
}
case SUBMESH_EDGE:
case SMESH::SUBMESH_EDGE:
{
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnEdge))
Ok = true;
break;
}
case SUBMESH_FACE:
case SMESH::SUBMESH_FACE:
{
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnFace))
Ok = true;
break;
}
case SUBMESH_SOLID:
case SMESH::SUBMESH_SOLID:
{
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnSolid))
Ok = true;
break;
}
case SUBMESH_COMPOUND:
case SMESH::SUBMESH_COMPOUND:
{
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnCompound))
Ok = true;
break;
}
case GROUP:
case SMESH::GROUP:
{
if (aLevel == 3 && (objFather->Tag() >= SMESH::Tag_FirstGroup))
Ok = true;
break;
}
case GROUP_NODE:
case SMESH::GROUP_NODE:
{
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_NodeGroups))
Ok = true;
break;
}
case GROUP_EDGE:
case SMESH::GROUP_EDGE:
{
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_EdgeGroups))
Ok = true;
break;
}
case GROUP_FACE:
case SMESH::GROUP_FACE:
{
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_FaceGroups))
Ok = true;
break;
}
case GROUP_VOLUME:
case SMESH::GROUP_VOLUME:
{
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_VolumeGroups))
Ok = true;
break;
}
case GROUP_0D:
case SMESH::GROUP_0D:
{
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_0DElementsGroups))
Ok = true;
break;
}
case GROUP_BALL:
case SMESH::GROUP_BALL:
{
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_BallElementsGroups))
Ok = true;
break;
}
case IDSOURCE:
case SMESH::IDSOURCE:
{
Ok = ( SMESH_TypeFilter(MESHorSUBMESH).isOk( theDataOwner ) ||
SMESH_TypeFilter(GROUP) .isOk( theDataOwner ));
Ok = ( SMESH_TypeFilter(SMESH::MESHorSUBMESH).isOk( theDataOwner ) ||
SMESH_TypeFilter(SMESH::GROUP) .isOk( theDataOwner ));
break;
}
}
@ -220,7 +220,7 @@ bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const
return Ok;
}
MeshObjectType SMESH_TypeFilter::type() const
SMESH::MeshObjectType SMESH_TypeFilter::type() const
{
return myType;
}

View File

@ -34,14 +34,14 @@ class SUIT_DataOwner;
class SMESHFILTERSSELECTION_EXPORT SMESH_TypeFilter : public SUIT_SelectionFilter
{
public:
SMESH_TypeFilter (MeshObjectType theType);
SMESH_TypeFilter (SMESH::MeshObjectType theType);
~SMESH_TypeFilter();
virtual bool isOk (const SUIT_DataOwner*) const;
MeshObjectType type() const;
SMESH::MeshObjectType type() const;
protected:
MeshObjectType myType;
SMESH::MeshObjectType myType;
};
#endif

View File

@ -97,6 +97,7 @@ salomeinclude_HEADERS = \
SMESHGUI_PreviewDlg.h \
SMESHGUI_ReorientFacesDlg.h \
SMESHGUI_PropertiesDlg.h \
SMESHGUI_Add0DElemsOnAllNodesDlg.h \
SMESH_SMESHGUI.hxx
# Libraries targets
@ -173,7 +174,8 @@ dist_libSMESH_la_SOURCES = \
SMESHGUI_FileValidator.cxx \
SMESHGUI_PreviewDlg.cxx \
SMESHGUI_ReorientFacesDlg.cxx \
SMESHGUI_PropertiesDlg.cxx
SMESHGUI_PropertiesDlg.cxx \
SMESHGUI_Add0DElemsOnAllNodesDlg.cxx
MOC_FILES = \
SMESHGUI_moc.cxx \
@ -233,7 +235,8 @@ MOC_FILES = \
SMESHGUI_MeshOrderOp_moc.cxx \
SMESHGUI_PreviewDlg_moc.cxx \
SMESHGUI_ReorientFacesDlg_moc.cxx \
SMESHGUI_PropertiesDlg_moc.cxx
SMESHGUI_PropertiesDlg_moc.cxx \
SMESHGUI_Add0DElemsOnAllNodesDlg_moc.cxx
nodist_libSMESH_la_SOURCES= \
$(MOC_FILES)

View File

@ -27,18 +27,21 @@
#undef HAVE_FINITE // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined
#endif
#include "Python.h"
// SMESH includes
#include "SMESHGUI.h"
#include "SMESHGUI_Add0DElemsOnAllNodesDlg.h"
#include "SMESHGUI_AddMeshElementDlg.h"
#include "SMESHGUI_AddQuadraticElementDlg.h"
#include "SMESHGUI_BuildCompoundDlg.h"
#include "SMESHGUI_ClippingDlg.h"
#include "SMESHGUI_ComputeDlg.h"
#include "SMESHGUI_ConvToQuadOp.h"
#include "SMESHGUI_CopyMeshDlg.h"
#include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
#include "SMESHGUI_DeleteGroupDlg.h"
#include "SMESHGUI_Displayer.h"
#include "SMESHGUI_MergeDlg.h"
#include "SMESHGUI_DuplicateNodesDlg.h"
#include "SMESHGUI_ExtrusionAlongPathDlg.h"
#include "SMESHGUI_ExtrusionDlg.h"
#include "SMESHGUI_FileInfoDlg.h"
@ -53,6 +56,7 @@
#include "SMESHGUI_Make2DFrom3DOp.h"
#include "SMESHGUI_MakeNodeAtPointDlg.h"
#include "SMESHGUI_Measurements.h"
#include "SMESHGUI_MergeDlg.h"
#include "SMESHGUI_MeshInfo.h"
#include "SMESHGUI_MeshOp.h"
#include "SMESHGUI_MeshOrderOp.h"
@ -64,61 +68,59 @@
#include "SMESHGUI_RemoveElementsDlg.h"
#include "SMESHGUI_RemoveNodesDlg.h"
#include "SMESHGUI_RenumberingDlg.h"
#include "SMESHGUI_ReorientFacesDlg.h"
#include "SMESHGUI_RevolutionDlg.h"
#include "SMESHGUI_RotationDlg.h"
#include "SMESHGUI_ScaleDlg.h"
#include "SMESHGUI_Selection.h"
#include "SMESHGUI_SewingDlg.h"
#include "SMESHGUI_SingleEditDlg.h"
#include "SMESHGUI_SmoothingDlg.h"
#include "SMESHGUI_SymmetryDlg.h"
#include "SMESHGUI_TranslationDlg.h"
#include "SMESHGUI_ScaleDlg.h"
#include "SMESHGUI_TransparencyDlg.h"
#include "SMESHGUI_DuplicateNodesDlg.h"
#include "SMESHGUI_CopyMeshDlg.h"
#include "SMESHGUI_ReorientFacesDlg.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_GroupUtils.h"
#include "SMESHGUI_FilterUtils.h"
#include "SMESHGUI_PatternUtils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_GroupUtils.h"
#include "SMESHGUI_HypothesesUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_PatternUtils.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include <SMESH_version.h>
#include <SMESH_Client.hxx>
#include <SMESH_Actor.h>
#include <SMESH_ScalarBarActor.h>
#include <SMESH_ActorUtils.h>
#include <SMESH_TypeFilter.hxx>
#include "SMESH_ControlsDef.hxx"
#include <SMESH_Actor.h>
#include <SMESH_ActorUtils.h>
#include <SMESH_Client.hxx>
#include <SMESH_ScalarBarActor.h>
#include <SMESH_TypeFilter.hxx>
// SALOME GUI includes
#include <SalomeApp_Tools.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_CheckFileDlg.h>
#include <SalomeApp_DataObject.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Tools.h>
#include <LightApp_DataOwner.h>
#include <LightApp_NameDlg.h>
#include <LightApp_Preferences.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_UpdateFlags.h>
#include <LightApp_NameDlg.h>
#include <SVTK_ViewWindow.h>
#include <SVTK_ViewModel.h>
#include <SVTK_ViewManager.h>
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <VTKViewer_Algorithm.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_FileDlg.h>
#include <SUIT_Desktop.h>
#include <SUIT_FileDlg.h>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <QtxPopupMgr.h>
@ -148,25 +150,28 @@
#include <boost/shared_ptr.hpp>
// VTK includes
#include <vtkCamera.h>
#include <vtkRenderer.h>
#include <vtkPlane.h>
#include <vtkCallbackCommand.h>
#include <vtkCamera.h>
#include <vtkLookupTable.h>
#include <vtkPlane.h>
#include <vtkRenderer.h>
// SALOME KERNEL includes
#include <SALOMEDS_Study.hxx>
#include <SALOMEDSClient_StudyBuilder.hxx>
#include <SALOMEDSClient_SComponent.hxx>
#include <SALOMEDSClient_ClientFactory.hxx>
#include <SALOMEDSClient_IParameters.hxx>
#include <SALOMEDSClient_SComponent.hxx>
#include <SALOMEDSClient_StudyBuilder.hxx>
#include <SALOMEDS_Study.hxx>
// OCCT includes
#include <Standard_ErrorHandler.hxx>
#include <NCollection_DataMap.hxx>
#include <Basics_Utils.hxx>
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
//Otherwise, it should be uncommented.
//Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//namespace{
@ -193,7 +198,7 @@
std::string myExtension;
if ( theCommandID == 113 ) {
filter.append( QObject::tr( "MED_FILES_FILTER" ) + " (*.med)" );
filter.append( QObject::tr( "MED_FILES_FILTER" ) + " (*.*med)" );
filter.append( QObject::tr( "ALL_FILES_FILTER" ) + " (*)" );
}
else if ( theCommandID == 112 ) {
@ -203,7 +208,7 @@
filter.append( QObject::tr( "DAT_FILES_FILTER" ) + " (*.dat)" );
}
else if ( theCommandID == 115 ) {
filter.append( QObject::tr( "STL_ASCII_FILES_FILTER" ) + " (*.stl)" );
filter.append( QObject::tr( "STL_FILES_FILTER" ) + " (*.stl)" );
}
else if ( theCommandID == 116 ) {
filter.append( QObject::tr( "CGNS_FILES_FILTER" ) + " (*.cgns)" );
@ -221,10 +226,28 @@
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
anInitialPath = QDir::currentPath();
QStringList filenames = SUIT_FileDlg::getOpenFileNames( SMESHGUI::desktop(),
QStringList filenames;
bool toCreateGroups = true;
// if ( theCommandID == 118 ) { // GMF
// SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
// ( SMESHGUI::desktop(), true, QObject::tr("SMESH_REQUIRED_GROUPS"), true, true );
// fd->setWindowTitle( QObject::tr( "SMESH_IMPORT_MESH" ) );
// fd->setNameFilters( filter );
// fd->SetChecked( true );
// if ( fd->exec() )
// filenames << fd->selectedFile();
// toCreateGroups = fd->IsChecked();
// delete fd;
// }
// else
{
filenames = SUIT_FileDlg::getOpenFileNames( SMESHGUI::desktop(),
anInitialPath,
filter,
QObject::tr( "SMESH_IMPORT_MESH" ) );
}
if ( filenames.count() > 0 ) {
SUIT_OverrideCursor wc;
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
@ -303,7 +326,9 @@
// GMF format
SMESH::ComputeError_var res;
aMeshes->length( 1 );
aMeshes[0] = theComponentMesh->CreateMeshesFromGMF( filename.toLatin1().constData(), res.out() );
aMeshes[0] = theComponentMesh->CreateMeshesFromGMF( filename.toLatin1().constData(),
toCreateGroups,
res.out() );
if ( res->code != SMESH::DRS_OK ) {
errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res->code ).toLatin1().data() ) ) );
@ -598,6 +623,32 @@
anInitialPath + QString("/") + aMeshName,
aFilter, aTitle, false);
}
// else if ( isGMF )// Export to GMF
// {
// SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
// ( SMESHGUI::desktop(), false, QObject::tr("SMESH_REQUIRED_GROUPS"), true, true );
// QStringList filters;
// filters << QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)"
// << QObject::tr( "GMF_BINARY_FILES_FILTER" ) + " (*.meshb)";
// fd->setWindowTitle( aTitle );
// fd->setNameFilters( filters );
// if ( !aMeshOrGroup->_is_equivalent( aMesh ))
// toCreateGroups = false;
// else
// toCreateGroups = ( aMesh->NbGroups() > 0 );
// fd->SetChecked( true );
// if ( !anInitialPath.isEmpty() )
// fd->setDirectory( anInitialPath );
// fd->selectFile(aMeshName);
// if ( fd->exec() )
// aFilename = fd->selectedFile();
// toCreateGroups = fd->IsChecked();
// delete fd;
// }
else if ( isCGNS )// Export to CGNS
{
SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
@ -843,7 +894,8 @@
}
else if ( isGMF )
{
aMesh->ExportGMF( aMeshOrGroup, aFilename.toLatin1().data() );
toCreateGroups = true;
aMesh->ExportGMF( aMeshOrGroup, aFilename.toLatin1().data(), toCreateGroups );
}
}
catch (const SALOME::SALOME_Exception& S_ex){
@ -1575,7 +1627,7 @@
bool CheckOIType(const Handle(SALOME_InteractiveObject) & theIO,
MeshObjectType theType,
SMESH::MeshObjectType theType,
const QString theInTypeName,
QString & theOutTypeName)
{
@ -1607,11 +1659,11 @@
QString aTypeName;
if (
CheckOIType ( theIO, HYPOTHESIS, "Hypothesis", aTypeName ) ||
CheckOIType ( theIO, ALGORITHM, "Algorithm", aTypeName ) ||
CheckOIType ( theIO, MESH, "Mesh", aTypeName ) ||
CheckOIType ( theIO, SUBMESH, "SubMesh", aTypeName ) ||
CheckOIType ( theIO, GROUP, "Group", aTypeName )
CheckOIType ( theIO, SMESH::HYPOTHESIS, "Hypothesis", aTypeName ) ||
CheckOIType ( theIO, SMESH::ALGORITHM, "Algorithm", aTypeName ) ||
CheckOIType ( theIO, SMESH::MESH, "Mesh", aTypeName ) ||
CheckOIType ( theIO, SMESH::SUBMESH, "SubMesh", aTypeName ) ||
CheckOIType ( theIO, SMESH::GROUP, "Group", aTypeName )
)
return aTypeName;
@ -3018,7 +3070,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if(checkLock(aStudy)) break;
if ( vtkwnd ) {
EmitSignalDeactivateDialog();
SMDSAbs_EntityType type;
SMDSAbs_EntityType type = SMDSEntity_Last;
switch (theCommandID) {
case 4034:
@ -3036,12 +3088,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case 4039:
type = SMDSEntity_Quad_Penta; break;
case 4040:
type = SMDSEntity_Quad_Hexa;
type = SMDSEntity_Quad_Hexa; break;
case 4140:
type = SMDSEntity_TriQuad_Hexa;
break;
default:;
type = SMDSEntity_TriQuad_Hexa; break;
default: break;
}
if ( type != SMDSEntity_Last )
( new SMESHGUI_AddQuadraticElementDlg( this, type ) )->show();
}
else {
@ -3293,6 +3345,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break;
}
case 4070: // 0D_ON_ALL_NODES
startOperation( 4070 );
break;
case 5105: // Library of selection filters
{
static QList<int> aTypes;
@ -3493,12 +3549,8 @@ void SMESHGUI::createPopupItem( const int id,
const QString& theRule,
const int pId )
{
int parentId = pId;
if( pId!=-1 )
parentId = popupMgr()->actionId( action( pId ) );
if( !popupMgr()->contains( popupMgr()->actionId( action( id ) ) ) )
popupMgr()->insert( action( id ), parentId, 0 );
popupMgr()->insert( action( id ), pId, 0 );
QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality();
QString dc = "selcount"; // VSR : insetad of QtxPopupSelection::defSelCountParam()
@ -3549,13 +3601,13 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 142, "CGNS");
createSMESHAction( 144, "SAUV");
createSMESHAction( 146, "GMF" );
createSMESHAction( 124, "EXPORT_DAT" );
createSMESHAction( 125, "EXPORT_MED" );
createSMESHAction( 126, "EXPORT_UNV" );
createSMESHAction( 141, "EXPORT_STL" );
createSMESHAction( 143, "EXPORT_CGNS");
createSMESHAction( 145, "EXPORT_SAUV");
createSMESHAction( 147, "EXPORT_GMF" );
createSMESHAction( 124, "DAT" );
createSMESHAction( 125, "MED" );
createSMESHAction( 126, "UNV" );
createSMESHAction( 141, "STL" );
createSMESHAction( 143, "CGNS");
createSMESHAction( 145, "SAUV");
createSMESHAction( 147, "GMF" );
createSMESHAction( 150, "FILE_INFO" );
createSMESHAction( 33, "DELETE", "ICON_DELETE", Qt::Key_Delete );
createSMESHAction( 5105, "SEL_FILTER_LIB" );
@ -3647,6 +3699,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 4067, "MESH_THROU_POINT","ICON_DLG_MOVE_NODE" );
createSMESHAction( 4068, "SCALE", "ICON_DLG_MESH_SCALE" );
createSMESHAction( 4069, "DUPLICATE_NODES", "ICON_SMESH_DUPLICATE_NODES" );
createSMESHAction( 4070, "0D_ON_ALL_NODES", "ICON_0D_ON_ALL_NODES" );
createSMESHAction( 407, "INV", "ICON_DLG_MESH_DIAGONAL" );
createSMESHAction( 408, "UNION2", "ICON_UNION2TRI" );
createSMESHAction( 409, "ORIENT", "ICON_DLG_MESH_ORIENTATION" );
@ -3809,6 +3862,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 4000, addId, -1 );
createMenu( 4009, addId, -1 );
createMenu( 4070, addId, -1 );
createMenu( 4008, addId, -1 );
createMenu( 4010, addId, -1 );
createMenu( 4021, addId, -1 );
@ -3934,6 +3988,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( 4000, addRemTb );
createTool( 4009, addRemTb );
createTool( 4070, addRemTb );
createTool( 4008, addRemTb );
createTool( 4010, addRemTb );
createTool( 4021, addRemTb );
@ -3999,17 +4054,17 @@ void SMESHGUI::initialize( CAM_Application* app )
QString OB = "'ObjectBrowser'",
View = "'" + SVTK_Viewer::Type() + "'",
pat = "'%1'",
mesh = pat.arg( SMESHGUI_Selection::typeName( MESH ) ),
group = pat.arg( SMESHGUI_Selection::typeName( GROUP ) ),
hypo = pat.arg( SMESHGUI_Selection::typeName( HYPOTHESIS ) ),
algo = pat.arg( SMESHGUI_Selection::typeName( ALGORITHM ) ),
mesh = pat.arg( SMESHGUI_Selection::typeName( SMESH::MESH ) ),
group = pat.arg( SMESHGUI_Selection::typeName( SMESH::GROUP ) ),
hypo = pat.arg( SMESHGUI_Selection::typeName( SMESH::HYPOTHESIS ) ),
algo = pat.arg( SMESHGUI_Selection::typeName( SMESH::ALGORITHM ) ),
elems = QString( "'%1' '%2' '%3' '%4' '%5' '%6'" ).
arg( SMESHGUI_Selection::typeName( SUBMESH_VERTEX ) ).
arg( SMESHGUI_Selection::typeName( SUBMESH_EDGE ) ).
arg( SMESHGUI_Selection::typeName( SUBMESH_FACE ) ).
arg( SMESHGUI_Selection::typeName( SUBMESH_SOLID ) ).
arg( SMESHGUI_Selection::typeName( SUBMESH_COMPOUND ) ).
arg( SMESHGUI_Selection::typeName( SUBMESH ) ),
arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_VERTEX ) ).
arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_EDGE ) ).
arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_FACE ) ).
arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_SOLID ) ).
arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_COMPOUND ) ).
arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH ) ),
subMesh = elems,
mesh_part = mesh + " " + subMesh + " " + group,
mesh_group = mesh + " " + group,
@ -4065,14 +4120,16 @@ void SMESHGUI::initialize( CAM_Application* app )
QString multiple_non_empty = QString( " && %1>0 && numberOfNodes>0" ).arg( dc );
QString only_one_2D = only_one_non_empty + " && dim>1";
createPopupItem( 125, OB, mesh_group, multiple_non_empty ); // EXPORT_MED
createPopupItem( 126, OB, mesh_group, only_one_non_empty ); // EXPORT_UNV
createPopupItem( 141, OB, mesh_group, only_one_2D ); // EXPORT_STL
int anId = popupMgr()->insert( tr( "MEN_EXPORT" ), -1, -1 ); // EXPORT submenu
createPopupItem( 125, OB, mesh_group, multiple_non_empty, anId ); // EXPORT_MED
createPopupItem( 126, OB, mesh_group, only_one_non_empty, anId ); // EXPORT_UNV
createPopupItem( 141, OB, mesh_group, only_one_2D, anId ); // EXPORT_STL
#ifdef WITH_CGNS
createPopupItem( 143, OB, mesh_group, multiple_non_empty ); // EXPORT_CGNS
createPopupItem( 143, OB, mesh_group, multiple_non_empty, anId ); // EXPORT_CGNS
#endif
createPopupItem( 145, OB, mesh_group, multiple_non_empty ); // EXPORT_SAUV
createPopupItem( 147, OB, mesh_group, multiple_non_empty ); // EXPORT_GMF
createPopupItem( 145, OB, mesh_group, multiple_non_empty, anId ); // EXPORT_SAUV
createPopupItem( 147, OB, mesh_group, multiple_non_empty, anId ); // EXPORT_GMF
createPopupItem( 124, OB, mesh_group, multiple_non_empty, anId ); // EXPORT_DAT
createPopupItem( 33, OB, mesh_part + " " + hyp_alg ); // DELETE
createPopupItem( 813, OB, group ); // DEL_GROUP with contents
popupMgr()->insert( separator(), -1, 0 );
@ -4092,7 +4149,6 @@ void SMESHGUI::initialize( CAM_Application* app )
createPopupItem( 1137, OB + " " + View, mesh, "&& isAutoColor" ); // DISABLE_AUTO_COLOR
popupMgr()->insert( separator(), -1, 0 );
int anId;
QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" );
QString aType = QString( "%1type in {%2}" ).arg( lc );
aType = aType.arg( mesh_part );
@ -4752,7 +4808,7 @@ void SMESHGUI::createPreferences()
int previewGroup = addPreference( tr( "SMESH_PREF_GROUP_PREVIEW" ), genTab );
setPreferenceProperty( previewGroup, "columns", 2 );
int chunkSize = addPreference( tr( "PREF_PREVIEW_CHUNK_SIZE" ), previewGroup, LightApp_Preferences::IntSpin, "SMESH", "preview_actor_chunk_size" );
setPreferenceProperty( chunkSize, "min", 0 );
setPreferenceProperty( chunkSize, "min", 1 );
setPreferenceProperty( chunkSize, "max", 1000 );
setPreferenceProperty( chunkSize, "step", 50 );
@ -5131,9 +5187,12 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const
case 904: // Find element
op = new SMESHGUI_FindElemByPointOp();
break;
case 4067: // make mesh pass through point
case 4067: // Make mesh pass through point
op = new SMESHGUI_MakeNodeAtPointOp();
break;
case 4070: // Create 0D elements on all nodes
op = new SMESHGUI_Add0DElemsOnAllNodesOp();
break;
default:
break;
}
@ -5215,9 +5274,9 @@ SALOMEDS::Color SMESHGUI::getUniqueColor( const QList<SALOMEDS::Color>& theReser
return aSColor;
}
const char gSeparator = '_'; // character used to separate parameter names
const char gDigitsSep = ':'; // character used to separate numeric parameter values (color = r:g:b)
const char gPathSep = '|'; // character used to separate paths
const char* gSeparator = "_"; // character used to separate parameter names
const char* gDigitsSep = ":"; // character used to separate numeric parameter values (color = r:g:b)
const char* gPathSep = "|"; // character used to separate paths
/*!
* \brief Store visual parameters
@ -5227,6 +5286,9 @@ const char gPathSep = '|'; // character used to separate paths
*/
void SMESHGUI::storeVisualParameters (int savePoint)
{
// localizing
Kernel_Utils::Localizer loc;
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
if (!appStudy || !appStudy->studyDS())
return;
@ -5370,6 +5432,8 @@ void SMESHGUI::storeVisualParameters (int savePoint)
bool isE = aMode & SMESH_Actor::eEdges;
bool isF = aMode & SMESH_Actor::eFaces;
bool isV = aMode & SMESH_Actor::eVolumes;
bool is0d = aMode & SMESH_Actor::e0DElements;
bool isB = aMode & SMESH_Actor::eBallElem;
QString modeStr ("e");
modeStr += gDigitsSep; modeStr += QString::number(isE);
@ -5377,53 +5441,92 @@ void SMESHGUI::storeVisualParameters (int savePoint)
modeStr += gDigitsSep; modeStr += QString::number(isF);
modeStr += gDigitsSep; modeStr += "v";
modeStr += gDigitsSep; modeStr += QString::number(isV);
modeStr += gDigitsSep; modeStr += "0d";
modeStr += gDigitsSep; modeStr += QString::number(is0d);
modeStr += gDigitsSep; modeStr += "b";
modeStr += gDigitsSep; modeStr += QString::number(isB);
param = vtkParam + "Entities";
ip->setParameter(entry, param, modeStr.toLatin1().data());
// Colors (surface:edge:)
// Colors
vtkFloatingPointType r, g, b;
int delta;
aSmeshActor->GetSufaceColor(r, g, b, delta);
QString colorStr ("surface");
colorStr += gDigitsSep; colorStr += QString::number(r);
colorStr += gDigitsSep; colorStr += QString::number(g);
colorStr += gDigitsSep; colorStr += QString::number(b);
QStringList colorStr;
colorStr << "surface";
colorStr << QString::number(r);
colorStr << QString::number(g);
colorStr << QString::number(b);
colorStr += gDigitsSep; colorStr += "backsurface";
colorStr += gDigitsSep; colorStr += QString::number(delta);
colorStr << "backsurface";
colorStr << QString::number(delta);
aSmeshActor->GetVolumeColor(r, g, b, delta);
colorStr << "volume";
colorStr << QString::number(r);
colorStr << QString::number(g);
colorStr << QString::number(b);
colorStr << QString::number(delta);
aSmeshActor->GetEdgeColor(r, g, b);
colorStr += gDigitsSep; colorStr += "edge";
colorStr += gDigitsSep; colorStr += QString::number(r);
colorStr += gDigitsSep; colorStr += QString::number(g);
colorStr += gDigitsSep; colorStr += QString::number(b);
colorStr << "edge";
colorStr << QString::number(r);
colorStr << QString::number(g);
colorStr << QString::number(b);
aSmeshActor->GetNodeColor(r, g, b);
colorStr += gDigitsSep; colorStr += "node";
colorStr += gDigitsSep; colorStr += QString::number(r);
colorStr += gDigitsSep; colorStr += QString::number(g);
colorStr += gDigitsSep; colorStr += QString::number(b);
colorStr << "node";
colorStr << QString::number(r);
colorStr << QString::number(g);
colorStr << QString::number(b);
aSmeshActor->GetOutlineColor(r, g, b);
colorStr += gDigitsSep; colorStr += "outline";
colorStr += gDigitsSep; colorStr += QString::number(r);
colorStr += gDigitsSep; colorStr += QString::number(g);
colorStr += gDigitsSep; colorStr += QString::number(b);
colorStr << "outline";
colorStr << QString::number(r);
colorStr << QString::number(g);
colorStr << QString::number(b);
aSmeshActor->Get0DColor(r, g, b);
colorStr << "elem0d";
colorStr << QString::number(r);
colorStr << QString::number(g);
colorStr << QString::number(b);
aSmeshActor->GetBallColor(r, g, b);
colorStr << "ball";
colorStr << QString::number(r);
colorStr << QString::number(g);
colorStr << QString::number(b);
aSmeshActor->GetFacesOrientationColor(r, g, b);
colorStr << "orientation";
colorStr << QString::number(r);
colorStr << QString::number(g);
colorStr << QString::number(b);
param = vtkParam + "Colors";
ip->setParameter(entry, param, colorStr.toLatin1().data());
ip->setParameter(entry, param, qPrintable(colorStr.join(gDigitsSep)));
// Sizes of lines and points
QString sizeStr ("line");
sizeStr += gDigitsSep; sizeStr += QString::number((int)aSmeshActor->GetLineWidth());
sizeStr += gDigitsSep; sizeStr += "shrink";
sizeStr += gDigitsSep; sizeStr += QString::number(aSmeshActor->GetShrinkFactor());
// Sizes
QStringList sizeStr;
sizeStr << "line";
sizeStr << QString::number((int)aSmeshActor->GetLineWidth());
sizeStr << "outline";
sizeStr << QString::number((int)aSmeshActor->GetOutlineWidth());
sizeStr << "elem0d";
sizeStr << QString::number((int)aSmeshActor->Get0DSize());
sizeStr << "ball";
sizeStr << QString::number((int)aSmeshActor->GetBallSize());
sizeStr << "shrink";
sizeStr << QString::number(aSmeshActor->GetShrinkFactor());
sizeStr << "orientation";
sizeStr << QString::number(aSmeshActor->GetFacesOrientationScale());
sizeStr << QString::number(aSmeshActor->GetFacesOrientation3DVectors());
param = vtkParam + "Sizes";
ip->setParameter(entry, param, sizeStr.toLatin1().data());
ip->setParameter(entry, param, qPrintable(sizeStr.join(gDigitsSep)));
// Point marker
QString markerStr;
@ -5509,6 +5612,9 @@ typedef std::map<int, TPlaneInfoList> TPlaneInfoMap;
*/
void SMESHGUI::restoreVisualParameters (int savePoint)
{
// localizing
Kernel_Utils::Localizer loc;
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
if (!appStudy || !appStudy->studyDS())
return;
@ -5745,95 +5851,279 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
// Displayed entities
else if (paramNameStr == "Entities") {
QStringList mode = val.split(gDigitsSep, QString::SkipEmptyParts);
if (mode.count() == 6) {
if (mode[0] != "e" || mode[2] != "f" || mode[4] != "v") {
MESSAGE("Invalid order of data in Entities, must be: "
"e:0/1:f:0/1:v:0/1");
}
else {
unsigned int aMode = aSmeshActor->GetEntityMode();
unsigned int aNewMode =
(int(SMESH_Actor::eEdges ) * mode[1].toInt()) |
(int(SMESH_Actor::eFaces ) * mode[3].toInt()) |
(int(SMESH_Actor::eVolumes) * mode[5].toInt());
if (aNewMode != aMode)
aSmeshActor->SetEntityMode(aNewMode);
int aEntityMode = SMESH_Actor::eAllEntity;
for ( int i = 0; i < mode.count(); i+=2 ) {
if ( i < mode.count()-1 ) {
QString type = mode[i];
bool val = mode[i+1].toInt();
if ( type == "e" && !val )
aEntityMode = aEntityMode & ~SMESH_Actor::eEdges;
else if ( type == "f" && !val )
aEntityMode = aEntityMode & ~SMESH_Actor::eFaces;
else if ( type == "v" && !val )
aEntityMode = aEntityMode & ~SMESH_Actor::eVolumes;
else if ( type == "0d" && !val )
aEntityMode = aEntityMode & ~SMESH_Actor::e0DElements;
else if ( type == "b" && !val )
aEntityMode = aEntityMode & ~SMESH_Actor::eBallElem;
}
}
aSmeshActor->SetEntityMode( aEntityMode );
}
// Colors
else if (paramNameStr == "Colors") {
QStringList colors = val.split(gDigitsSep, QString::SkipEmptyParts);
if (colors.count() == 16 || colors.count() == 18 ) {
if (colors[0] != "surface" || colors[4] != "backsurface" ||
(colors[8] != "edge" && colors[6] != "edge" ) || (colors[12] != "node" && colors[10] != "node") ||
(colors.count() == 18 && colors[14] != "outline")) {
MESSAGE("Invalid order of data in Colors, must be: "
"surface:r:g:b:backsurface:r:g:b:edge:r:g:b:node:r:g:b or surface:r:g:b:backsurface:delta:edge:r:g:b:node:r:g:b:outline:r:g:b");
QColor nodeColor;
QColor edgeColor;
QColor faceColor;
QColor volumeColor;
QColor elem0dColor;
QColor ballColor;
QColor outlineColor;
QColor orientationColor;
int deltaF;
int deltaV;
QColor c;
double r, g, b;
bool bOk;
// below lines are required to get default values for delta coefficients
// of backface color for faces and color of reversed volumes
SMESH::GetColor( "SMESH", "fill_color", c, deltaF, "0,170,255|-100" );
SMESH::GetColor( "SMESH", "volume_color", c, deltaV, "255,0,170|-100" );
for ( int i = 0; i < colors.count(); i++ ) {
QString type = colors[i];
if ( type == "surface" ) {
// face color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
faceColor.setRgbF( r, g, b );
i += 3;
}
else {
int delta = 0;
float er,eg,eb;
float nr,ng,nb;
vtkFloatingPointType otr,otg,otb;
//Old case backsurface color is independent
if( colors.count() == 16 ) {
QColor ffc;
SMESH::GetColor( "SMESH", "fill_color", ffc, delta, "0,170,255|-100" ) ;
er = colors[9].toFloat();
eg = colors[10].toFloat();
eb = colors[11].toFloat();
nr = colors[13].toFloat();
ng = colors[14].toFloat();
nb = colors[15].toFloat();
SMESH::GetColor("SMESH", "outline_color", otr, otg, otb, QColor( 0, 70, 0 ) );
} else {
//New case backsurface color depends on surface color
delta = colors[5].toInt();
er = colors[7].toFloat();
eg = colors[8].toFloat();
eb = colors[9].toFloat();
nr = colors[11].toFloat();
ng = colors[12].toFloat();
nb = colors[13].toFloat();
otr = colors[15].toFloat();
otg = colors[16].toFloat();
otb = colors[17].toFloat();
else if ( type == "backsurface" ) {
// backface color can be defined in several ways
// - in old versions, it is set as rgb triple r:g:b - this was is unsupported now
// - in latest versions, it is set as delta coefficient
bool rgbOk = false, deltaOk;
if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
int delta = colors[i+1].toInt( &deltaOk );
i++; // shift index
if ( i+1 < colors.count() ) // index is shifted to 1
g = colors[i+1].toDouble( &rgbOk );
if ( rgbOk ) i++; // shift index
if ( rgbOk && i+1 < colors.count() ) // index is shifted to 2
b = colors[i+1].toDouble( &rgbOk );
if ( rgbOk ) i++;
// - as currently there's no way to set directly backsurface color as it was before,
// we ignore old dump where r,g,b triple was set
// - also we check that delta parameter is set properly
if ( !rgbOk && deltaOk )
deltaF = delta;
}
aSmeshActor->SetSufaceColor(colors[1].toFloat(), colors[2].toFloat(), colors[3].toFloat(), delta);
aSmeshActor->SetEdgeColor(er,eg,eb);
aSmeshActor->SetNodeColor(nr,ng,nb);
aSmeshActor->SetOutlineColor(otr,otg,otb);
else if ( type == "volume" ) {
// volume color is set by 4 values r:g:b:delta, where
// - r,g,b - is a normal volume rgb color components
// - delta - is a reversed volume color delta coefficient
if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+4 >= colors.count() ) break; // format error
int delta = colors[i+4].toInt( &bOk );
if ( !bOk ) break; // format error
volumeColor.setRgbF( r, g, b );
deltaV = delta;
i += 4;
}
else if ( type == "edge" ) {
// edge color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
edgeColor.setRgbF( r, g, b );
i += 3;
}
else if ( type == "node" ) {
// node color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
nodeColor.setRgbF( r, g, b );
i += 3;
}
else if ( type == "elem0d" ) {
// 0d element color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
elem0dColor.setRgbF( r, g, b );
i += 3;
}
else if ( type == "ball" ) {
// ball color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
ballColor.setRgbF( r, g, b );
i += 3;
}
else if ( type == "outline" ) {
// outline color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
outlineColor.setRgbF( r, g, b );
i += 3;
}
else if ( type == "orientation" ) {
// orientation color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
orientationColor.setRgbF( r, g, b );
i += 3;
}
}
// node color
if ( nodeColor.isValid() )
aSmeshActor->SetNodeColor( nodeColor.redF(), nodeColor.greenF(), nodeColor.blueF() );
// edge color
if ( edgeColor.isValid() )
aSmeshActor->SetEdgeColor( edgeColor.redF(), edgeColor.greenF(), edgeColor.blueF() );
// face color
if ( faceColor.isValid() )
aSmeshActor->SetSufaceColor( faceColor.redF(), faceColor.greenF(), faceColor.blueF(), deltaF );
// volume color
if ( volumeColor.isValid() )
aSmeshActor->SetVolumeColor( volumeColor.redF(), volumeColor.greenF(), volumeColor.blueF(), deltaV );
else if ( faceColor.isValid() ) // backward compatibility (no separate color for volumes)
aSmeshActor->SetVolumeColor( faceColor.redF(), faceColor.greenF(), faceColor.blueF(), deltaF );
// 0d element color
if ( elem0dColor.isValid() )
aSmeshActor->Set0DColor( elem0dColor.redF(), elem0dColor.greenF(), elem0dColor.blueF() );
// ball color
if ( ballColor.isValid() )
aSmeshActor->SetBallColor( ballColor.redF(), ballColor.greenF(), ballColor.blueF() );
// outline color
if ( outlineColor.isValid() )
aSmeshActor->SetOutlineColor( outlineColor.redF(), outlineColor.greenF(), outlineColor.blueF() );
// orientation color
if ( orientationColor.isValid() )
aSmeshActor->SetFacesOrientationColor( orientationColor.redF(), orientationColor.greenF(), orientationColor.blueF() );
}
// Sizes of lines and points
// Sizes
else if (paramNameStr == "Sizes") {
QStringList sizes = val.split(gDigitsSep, QString::SkipEmptyParts);
if (sizes.count() == 4) {
if (sizes[0] != "line" || sizes[2] != "shrink") {
MESSAGE("Invalid order of data in Sizes, must be: "
"line:int:shrink:float");
bool bOk;
int lineWidth = -1;
int outlineWidth = -1;
int elem0dSize = -1;
int ballSize = -1;
double shrinkSize = -1;
double orientationSize = -1;
bool orientation3d = false;
for ( int i = 0; i < sizes.count(); i++ ) {
QString type = sizes[i];
if ( type == "line" ) {
// line (wireframe) width is given as single integer value
if ( i+1 >= sizes.count() ) break; // format error
int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error
lineWidth = v;
i++;
}
else {
aSmeshActor->SetLineWidth(sizes[1].toInt());
aSmeshActor->SetShrinkFactor(sizes[3].toFloat());
if ( type == "outline" ) {
// outline width is given as single integer value
if ( i+1 >= sizes.count() ) break; // format error
int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error
outlineWidth = v;
i++;
}
else if ( type == "elem0d" ) {
// 0d element size is given as single integer value
if ( i+1 >= sizes.count() ) break; // format error
int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error
elem0dSize = v;
i++;
}
else if ( type == "ball" ) {
// ball size is given as single integer value
if ( i+1 >= sizes.count() ) break; // format error
int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error
ballSize = v;
i++;
}
else if ( type == "shrink" ) {
// shrink factor is given as single floating point value
if ( i+1 >= sizes.count() ) break; // format error
double v = sizes[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
shrinkSize = v;
i++;
}
else if ( type == "orientation" ) {
// orientation vectors are specified by two values size:3d, where
// - size - is a floating point value specifying scale factor
// - 3d - is a boolean
if ( i+1 >= sizes.count() ) break; // format error
double v1 = sizes[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= sizes.count() ) break; // format error
int v2 = sizes[i+2].toInt( &bOk ); if ( !bOk ) break; // format error
orientationSize = v1;
orientation3d = (bool)v2;
i += 2;
}
}
else if (sizes.count() == 6) { // just to support old format
if (sizes[0] != "line" || sizes[2] != "node" || sizes[4] != "shrink") {
MESSAGE("Invalid order of data in Sizes, must be: "
"line:int:node:int:shrink:float");
}
else {
aSmeshActor->SetLineWidth(sizes[1].toInt());
//aSmeshActor->SetNodeSize(sizes[3].toInt()); // made obsolete
aSmeshActor->SetShrinkFactor(sizes[5].toFloat());
}
// line (wireframe) width
if ( lineWidth > 0 )
aSmeshActor->SetLineWidth( lineWidth );
// outline width
if ( outlineWidth > 0 )
aSmeshActor->SetOutlineWidth( outlineWidth );
else if ( lineWidth > 0 ) // backward compatibility (no separate width for outlines)
aSmeshActor->SetOutlineWidth( lineWidth );
// 0d element size
if ( elem0dSize > 0 )
aSmeshActor->Set0DSize( elem0dSize );
// ball size
if ( ballSize > 0 )
aSmeshActor->SetBallSize( ballSize );
// shrink factor
if ( shrinkSize > 0 )
aSmeshActor->SetShrinkFactor( shrinkSize );
// orientation vectors
if ( orientationSize > 0 ) {
aSmeshActor->SetFacesOrientationScale( orientationSize );
aSmeshActor->SetFacesOrientation3DVectors( orientation3d );
}
}
// Point marker
@ -6166,11 +6456,11 @@ bool SMESHGUI::renameAllowed( const QString& entry) const {
// check type to prevent renaming of inappropriate objects
int aType = SMESHGUI_Selection::type(qPrintable(entry), SMESH::GetActiveStudyDocument());
if (aType == MESH || aType == GROUP ||
aType == SUBMESH || aType == SUBMESH_COMPOUND ||
aType == SUBMESH_SOLID || aType == SUBMESH_FACE ||
aType == SUBMESH_EDGE || aType == SUBMESH_VERTEX ||
aType == HYPOTHESIS || aType == ALGORITHM)
if (aType == SMESH::MESH || aType == SMESH::GROUP ||
aType == SMESH::SUBMESH || aType == SMESH::SUBMESH_COMPOUND ||
aType == SMESH::SUBMESH_SOLID || aType == SMESH::SUBMESH_FACE ||
aType == SMESH::SUBMESH_EDGE || aType == SMESH::SUBMESH_VERTEX ||
aType == SMESH::HYPOTHESIS || aType == SMESH::ALGORITHM)
return true;
return false;
@ -6213,11 +6503,11 @@ bool SMESHGUI::renameObject( const QString& entry, const QString& name) {
aName = anAttr;
// check type to prevent renaming of inappropriate objects
int aType = SMESHGUI_Selection::type( qPrintable(entry), SMESH::GetActiveStudyDocument() );
if (aType == MESH || aType == GROUP ||
aType == SUBMESH || aType == SUBMESH_COMPOUND ||
aType == SUBMESH_SOLID || aType == SUBMESH_FACE ||
aType == SUBMESH_EDGE || aType == SUBMESH_VERTEX ||
aType == HYPOTHESIS || aType == ALGORITHM) {
if (aType == SMESH::MESH || aType == SMESH::GROUP ||
aType == SMESH::SUBMESH || aType == SMESH::SUBMESH_COMPOUND ||
aType == SMESH::SUBMESH_SOLID || aType == SMESH::SUBMESH_FACE ||
aType == SMESH::SUBMESH_EDGE || aType == SMESH::SUBMESH_VERTEX ||
aType == SMESH::HYPOTHESIS || aType == SMESH::ALGORITHM) {
if ( !name.isEmpty() ) {
SMESHGUI::GetSMESHGen()->SetName(obj->GetIOR().c_str(), qPrintable(name) );

View File

@ -0,0 +1,495 @@
// Copyright (C) 2007-2012 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_Add0DElemsOnAllNodesDlg.cxx
// Created : Fri Oct 19 15:51:24 2012
// Author : Edward AGAPOV (eap)
#include "SMESHGUI_Add0DElemsOnAllNodesDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_FilterDlg.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESH_LogicalFilter.hxx"
#include "SMESH_TypeFilter.hxx"
#include <LightApp_SelectionMgr.h>
#include <SALOME_ListIO.hxx>
#include <SUIT_MessageBox.h>
#include <SVTK_Selector.h>
#include <SalomeApp_Tools.h>
// Qt includes
#include <QButtonGroup>
#include <QCheckBox>
#include <QComboBox>
#include <QFrame>
#include <QGridLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QRadioButton>
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
#define SPACING 6
#define MARGIN 11
enum { SEL_OBJECT, SEL_ELEMENTS, SEL_NODES };
//================================================================================
/*!
* \brief Dialog Constructor
*/
//================================================================================
SMESHGUI_Add0DElemsOnAllNodesDlg::SMESHGUI_Add0DElemsOnAllNodesDlg()
: SMESHGUI_Dialog( 0, false, true ),
myIDValidator( this )
{
setWindowTitle( tr( "CAPTION" ) );
// Seletction type radio buttons
QGroupBox* selTypeGrBox = new QGroupBox( mainFrame() );
//
QRadioButton* objBtn = new QRadioButton( tr( "SMESH_SUBMESH_GROUP"),selTypeGrBox );
QRadioButton* elemBtn = new QRadioButton( tr( "SMESH_ELEMENTS" ),selTypeGrBox );
QRadioButton* nodeBtn = new QRadioButton( tr( "SMESH_NODES" ),selTypeGrBox );
//
QHBoxLayout* selTypeLay = new QHBoxLayout( selTypeGrBox );
selTypeLay->setMargin(MARGIN);
selTypeLay->setSpacing(SPACING);
selTypeLay->addWidget( objBtn );
selTypeLay->addWidget( elemBtn );
selTypeLay->addWidget( nodeBtn );
objBtn->setChecked(true);
//
mySelTypeBtnGrp = new QButtonGroup( mainFrame() );
mySelTypeBtnGrp->addButton( objBtn , SEL_OBJECT );
mySelTypeBtnGrp->addButton( elemBtn, SEL_ELEMENTS );
mySelTypeBtnGrp->addButton( nodeBtn, SEL_NODES );
// Label, Select Btn, LineEdit, Filter Btn
setObjectPixmap( "SMESH", tr( "ICON_SELECT" ) );
createObject( tr( "SMESH_NAME" ), mainFrame(), 0 );
myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), mainFrame() );
// List of groups
myGroupBox = new QGroupBox( tr( "SMESH_ADD_TO_GROUP" ), mainFrame() );
myGroupBox->setCheckable( true );
myGroupLabel = new QLabel( tr( "SMESH_GROUP" ), myGroupBox );
myGroupListCmBox = new QComboBox( myGroupBox );
myGroupListCmBox->setEditable( true );
myGroupListCmBox->setInsertPolicy( QComboBox::NoInsert );
QHBoxLayout* groupsLayout = new QHBoxLayout( myGroupBox );
groupsLayout->setSpacing(SPACING);
groupsLayout->setMargin(MARGIN);
groupsLayout->addWidget( myGroupLabel );
groupsLayout->addWidget( myGroupListCmBox, 1 );
// Main layout
QGridLayout* aLay = new QGridLayout( mainFrame() );
aLay->setMargin(MARGIN);
aLay->setSpacing(SPACING);
//
aLay->addWidget( selTypeGrBox, 0, 0, 1, 5 );
//
aLay->addWidget( objectWg( 0, Label ), 1, 0 );
aLay->addWidget( objectWg( 0, Btn ), 1, 1 );
aLay->addWidget( objectWg( 0, Control), 1, 2, 1, 2 );
aLay->addWidget( myFilterBtn, 1, 4 );
//
aLay->addWidget( myGroupBox, 2, 0, 1, 5 );
// Signals
connect( myGroupBox, SIGNAL( toggled( bool )), SLOT( onGroupChecked() ));
connect( mySelTypeBtnGrp, SIGNAL( buttonClicked(int) ), SLOT( onSelTypeChange(int)));
onSelTypeChange( SEL_OBJECT );
}
//================================================================================
/*!
* \brief SLOT to enable/disable groups
*/
//================================================================================
void SMESHGUI_Add0DElemsOnAllNodesDlg::onGroupChecked( bool on )
{
myGroupLabel->setEnabled( on );
myGroupListCmBox->setEnabled( on );
}
//================================================================================
/*!
* \brief SLOT to enable/disable groups
*/
//================================================================================
void SMESHGUI_Add0DElemsOnAllNodesDlg::onSelTypeChange( int selType )
{
setNameIndication( 0, selType == SEL_OBJECT ? OneName : ListOfNames );
setReadOnly ( 0, selType == SEL_OBJECT );
QLabel* label = qobject_cast< QLabel* >( objectWg(0, Label ));
switch( selType ) {
case SEL_OBJECT: label->setText( tr("SMESH_NAME")); break;
case SEL_ELEMENTS: label->setText( tr("ELEMENT_IDS")); break;
case SEL_NODES: label->setText( tr("NODE_IDS")); break;
default:;
}
QLineEdit* lineEdit = qobject_cast< QLineEdit* >( objectWg(0, Control ));
lineEdit->setText("");
lineEdit->setValidator( selType == SEL_OBJECT ? 0 : & myIDValidator );
myFilterBtn->setEnabled( selType != SEL_OBJECT );
emit selTypeChanged( selType );
}
//================================================================================
/*!
* \brief Return type of selected object: [SEL_OBJECT, SEL_ELEMENTS, SEL_NODES]
*/
//================================================================================
int SMESHGUI_Add0DElemsOnAllNodesDlg::getSelectionType() const
{
return mySelTypeBtnGrp->checkedId();
}
//================================================================================
/*!
* \brief Checks consistency of data
*/
//================================================================================
bool SMESHGUI_Add0DElemsOnAllNodesDlg::isValid()
{
if( myGroupBox->isChecked() && myGroupListCmBox->currentText().isEmpty() ) {
SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ), tr( "GROUP_NAME_IS_EMPTY" ) );
return false;
}
return true;
}
//================================================================================
/*!
* \brief Operation Constructor
*/
//================================================================================
SMESHGUI_Add0DElemsOnAllNodesOp::SMESHGUI_Add0DElemsOnAllNodesOp()
:SMESHGUI_SelectionOp(),
myDlg( new SMESHGUI_Add0DElemsOnAllNodesDlg ),
myFilterDlg( 0 )
{
myHelpFileName = "adding_nodes_and_elements_page.html#adding_0delems_on_all_nodes_anchor";
connect( myDlg, SIGNAL( selTypeChanged(int) ), SLOT( onSelTypeChange(int)));
connect( myDlg->myFilterBtn, SIGNAL( clicked()), SLOT( onSetFilter() ));
}
//================================================================================
/*!
* \brief Destructor
*/
//================================================================================
SMESHGUI_Add0DElemsOnAllNodesOp::~SMESHGUI_Add0DElemsOnAllNodesOp()
{
if ( myFilterDlg ) {
myFilterDlg->setParent( 0 );
delete myFilterDlg;
myFilterDlg = 0;
}
}
//================================================================================
/*!
* \brief Start
*/
//================================================================================
void SMESHGUI_Add0DElemsOnAllNodesOp::startOperation()
{
SMESHGUI_SelectionOp::startOperation();
myDlg->myGroupBox->setChecked( false );
myDlg->activateObject( 0 );
myDlg->show();
selectionDone();
}
//================================================================================
/*!
* \brief Treat changed selection
*/
//================================================================================
void SMESHGUI_Add0DElemsOnAllNodesOp::selectionDone()
{
if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dgl active
if (!myDlg->myGroupBox->isEnabled()) return; // inactive
myIO.Nullify();
myDlg->setObjectText( 0, "");
SALOME_ListIO aList;
selectionMgr()->selectedObjects( aList );
if ( aList.Extent() == 1 )
myIO = aList.First();
else
return;
QString ids;
switch ( myDlg->getSelectionType() ) {
case SEL_OBJECT:
SMESHGUI_SelectionOp::selectionDone();
break;
case SEL_ELEMENTS:
SMESH::GetNameOfSelectedElements( selector(), myIO, ids );
myDlg->setObjectText( 0, ids );
break;
case SEL_NODES:
SMESH::GetNameOfSelectedNodes( selector(), myIO, ids );
myDlg->setObjectText( 0, ids );
break;
default:;
}
// fill the list of existing groups
myDlg->myGroupListCmBox->clear();
myDlg->myGroupListCmBox->addItem( QString() );
if ( !myIO.IsNull() && myIO->hasEntry()) {
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
_PTR(SObject) meshSO = aStudy->FindObjectID( myIO->getEntry() );
_PTR(SObject) group0DRoot;
if ( meshSO->FindSubObject( SMESH::Tag_0DElementsGroups, group0DRoot ))
{
_PTR(ChildIterator) group0DIter = aStudy->NewChildIterator( group0DRoot );
for ( ; group0DIter->More(); group0DIter->Next() )
{
_PTR(SObject) groupSO = group0DIter->Value();
std::string groupName = groupSO->GetName();
if ( !groupName.empty() )
myDlg->myGroupListCmBox->addItem( groupName.c_str() );
}
}
}
}
//================================================================================
/*!
* \brief Return a filter of objects
*/
//================================================================================
SUIT_SelectionFilter* SMESHGUI_Add0DElemsOnAllNodesOp::createFilter( const int ) const
{
if ( myDlg->getSelectionType() == SEL_OBJECT )
{
// Create a filter of objects: any IDSource except the group of 0D elements
QList<SUIT_SelectionFilter*> filters;
filters.push_back( new SMESH_TypeFilter( SMESH::GROUP_0D ));
SMESH_LogicalFilter* not0DGroup = new SMESH_LogicalFilter( filters,
SMESH_LogicalFilter::LO_NOT,
/*takeOwnership=*/true);
filters[0] = not0DGroup;
filters.push_back( new SMESH_TypeFilter( SMESH::IDSOURCE ));
return new SMESH_LogicalFilter( filters,
SMESH_LogicalFilter::LO_AND,
/*takeOwnership=*/true);
}
return 0;
}
//================================================================================
/*!
* \brief Makes its main job
*/
//================================================================================
bool SMESHGUI_Add0DElemsOnAllNodesOp::onApply()
{
if ( !myDlg->isValid() )
return false;
// get a mesh
SMESH::SMESH_IDSource_var meshObject;
SMESH::SMESH_Mesh_var mesh;
if ( !myIO.IsNull() )
{
CORBA::Object_var obj = SMESH::IObjectToObject( myIO );
meshObject = SMESH::SMESH_IDSource::_narrow( obj );
if ( !meshObject->_is_nil() )
mesh = meshObject->GetMesh();
}
if ( mesh->_is_nil() )
{
SUIT_MessageBox::warning( myDlg, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_BAD_SELECTION" ) );
return false;
}
try {
SMESH::SMESH_MeshEditor_var editor = mesh->GetMeshEditor();
// make SMESH_IDSource holding IDs of selected elements
if ( myDlg->getSelectionType() != SEL_OBJECT )
{
QString elemIDs = myDlg->objectText( 0 );
QStringList idList = elemIDs.split( " ", QString::SkipEmptyParts );
if ( idList.count() == 0 )
{
SUIT_MessageBox::warning( myDlg, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_BAD_SELECTION" ) );
return false;
}
SMESH::long_array_var idArray = new SMESH::long_array;
idArray->length( idList.count() );
QStringList::iterator idIt = idList.begin();
for ( int i = 0; idIt != idList.end(); ++idIt, ++i )
idArray[i] = idIt->toLong();
SMESH::ElementType elemType =
myDlg->getSelectionType() == SEL_NODES ? SMESH::NODE : SMESH::ALL;
meshObject = editor->MakeIDSource( idArray, elemType );
}
// Create 0D elements
int prevNb0D = mesh->Nb0DElements();
QString groupName = myDlg->myGroupListCmBox->currentText();
SMESH::SMESH_IDSource_var newObj =
editor->Create0DElementsOnAllNodes( meshObject, groupName.toLatin1().data() );
int newNb0D = mesh->Nb0DElements() - prevNb0D;
SUIT_MessageBox::information( myDlg, tr( "SMESH_INFORMATION" ),
tr( "NB_NEW_0D" ).arg( newNb0D ),
SUIT_MessageBox::Ok, SUIT_MessageBox::Ok);
}
catch ( const SALOME::SALOME_Exception& S_ex ) {
SalomeApp_Tools::QtCatchCorbaException( S_ex );
return false;
}
catch (...) {
return false;
}
// clear selection
if ( myDlg->getSelectionType() == SEL_OBJECT )
{
SALOME_ListIO aList;
selectionMgr()->setSelectedObjects( aList, /*append=*/false );
}
else
{
selector()->ClearIndex();
}
selectionDone();
SMESH::UpdateView();
SMESHGUI::Modified();
if ( myDlg->myGroupBox->isChecked() )
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
return true;
}
//================================================================================
/*!
* \brief Sets selection mode
*/
//================================================================================
void SMESHGUI_Add0DElemsOnAllNodesOp::onSelTypeChange(int selType)
{
switch ( selType ) {
case SEL_OBJECT: setSelectionMode( ActorSelection ); break;
case SEL_ELEMENTS: setSelectionMode( CellSelection ); break;
case SEL_NODES: setSelectionMode( NodeSelection ); break;
}
if ( selType != SEL_OBJECT )
connect( myDlg, SIGNAL( objectChanged( int, const QStringList& )),
this, SLOT ( onTextChanged( int, const QStringList& )));
else
disconnect( myDlg, SIGNAL( objectChanged( int, const QStringList& )),
this, SLOT ( onTextChanged( int, const QStringList& )));
selectionDone();
}
//================================================================================
/*!
* \brief Install
*
*
*/
//================================================================================
void SMESHGUI_Add0DElemsOnAllNodesOp::onSetFilter()
{
SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO( myIO );
if ( mesh->_is_nil()) {
SUIT_MessageBox::critical( myDlg, tr("SMESH_ERROR"), tr("NO_MESH_SELECTED"));
return;
}
QList<int> types;
if ( myDlg->getSelectionType() == SEL_NODES ) {
types.push_back( SMESH::NODE );
}
else if ( myDlg->getSelectionType() == SEL_ELEMENTS ) {
types.push_back( SMESH::EDGE );
types.push_back( SMESH::FACE );
types.push_back( SMESH::VOLUME );
}
else
return;
if ( !myFilterDlg )
myFilterDlg = new SMESHGUI_FilterDlg( getSMESHGUI(), SMESH::ALL );
myFilterDlg->Init( types );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( mesh );
myFilterDlg->SetSourceWg( myDlg->objectWg( 0, LightApp_Dialog::Control ));
myFilterDlg->show();
}

View File

@ -0,0 +1,110 @@
// Copyright (C) 2007-2012 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
#ifndef SMESHGUI_ADD0DELEMSONALLNODESDLG_H
#define SMESHGUI_ADD0DELEMSONALLNODESDLG_H
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_SelectionOp.h"
#include "SMESHGUI_Dialog.h"
#include "SMESHGUI_IdValidator.h"
class SMESHGUI_FilterDlg;
class SMESHGUI_Add0DElemsOnAllNodesOp;
class QButtonGroup;
class QPushButton;
class QGroupBox;
class QLabel;
class QComboBox;
//---------------------------------------------------------------------------------
/*!
* \brief Dialog creating 0D elements on all nodes of given elements
*/
class SMESHGUI_EXPORT SMESHGUI_Add0DElemsOnAllNodesDlg : public SMESHGUI_Dialog
{
Q_OBJECT
public:
SMESHGUI_Add0DElemsOnAllNodesDlg();
int getSelectionType() const;
bool isValid();
signals:
void selTypeChanged( int selType );
private slots:
void onGroupChecked ( bool on );
void onSelTypeChange( int selType );
private:
friend class SMESHGUI_Add0DElemsOnAllNodesOp;
QButtonGroup* mySelTypeBtnGrp;
QPushButton* myFilterBtn;
QGroupBox* myGroupBox;
QLabel* myGroupLabel;
QComboBox* myGroupListCmBox;
SMESHGUI_IdValidator myIDValidator;
};
//---------------------------------------------------------------------------------
/*!
* \brief Operation creating 0D elements on all nodes of given elements
*/
class SMESHGUI_EXPORT SMESHGUI_Add0DElemsOnAllNodesOp : public SMESHGUI_SelectionOp
{
Q_OBJECT
public:
SMESHGUI_Add0DElemsOnAllNodesOp();
~SMESHGUI_Add0DElemsOnAllNodesOp();
virtual LightApp_Dialog* dlg() const { return myDlg; }
protected:
virtual void startOperation();
virtual void selectionDone();
virtual SUIT_SelectionFilter* createFilter( const int ) const;
protected slots:
virtual bool onApply();
void onSelTypeChange(int);
void onSetFilter();
private:
SMESHGUI_Add0DElemsOnAllNodesDlg* myDlg;
SMESHGUI_FilterDlg* myFilterDlg;
Handle(SALOME_InteractiveObject) myIO;
//SUIT_SelectionFilter* myObjectFilter;
};
#endif

View File

@ -343,7 +343,8 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theMo
SelectButtonC1A1 = new QPushButton(GroupC1);
SelectButtonC1A1->setIcon(image1);
LineEditC1A1 = new QLineEdit(GroupC1);
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, myIsPoly ? 1000 : myNbNodes));
LineEditC1A1->setValidator
(new SMESHGUI_IdValidator(this, ( myIsPoly || myNbNodes == 1 ) ? 1000 : myNbNodes));
Reverse = (myElementType == SMDSAbs_Face || myElementType == SMDSAbs_Volume ) ? new QCheckBox(tr("SMESH_REVERSE"), GroupC1) : 0;
@ -444,13 +445,13 @@ void SMESHGUI_AddMeshElementDlg::Init()
connect(buttonApply, SIGNAL(clicked()), SLOT(ClickOnApply()));
connect(buttonHelp, SIGNAL(clicked()), SLOT(ClickOnHelp()));
connect(SelectButtonC1A1, SIGNAL(clicked()), SLOT(SetEditCurrentArgument()));
connect(SelectButtonC1A1,SIGNAL(clicked()), SLOT(SetEditCurrentArgument()));
connect(LineEditC1A1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()),SLOT(DeactivateActiveDialog()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
/* to close dialog if study frame change */
connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), SLOT(ClickOnCancel()));
connect(mySMESHGUI, SIGNAL(SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnCancel()));
if (Reverse)
connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)));
@ -477,9 +478,9 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
if (myNbOkNodes && !mySMESHGUI->isActiveStudyLocked()) {
myBusy = true;
SMESH::long_array_var anArrayOfIndices = new SMESH::long_array;
anArrayOfIndices->length(myNbNodes);
QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts);
SMESH::long_array_var anArrayOfIndices = new SMESH::long_array;
anArrayOfIndices->length(aListId.count());
const std::vector<int>& revIndex = SMDS_MeshCell::reverseSmdsOrder( myGeomType );
if ( Reverse && Reverse->isChecked() && !revIndex.empty() )
for (int i = 0; i < aListId.count(); i++)
@ -515,28 +516,38 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
}
}
long anElemId = -1;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
SMESH::long_array_var anIdList = new SMESH::long_array;
anIdList->length( 1 );
anIdList[0] = -1;
switch (myElementType) {
case SMDSAbs_0DElement:
anElemId = aMeshEditor->Add0DElement(anArrayOfIndices[0]); break;
anIdList->length( anArrayOfIndices->length() );
for ( size_t i = 0; i < anArrayOfIndices->length(); ++i )
anIdList[i] = aMeshEditor->Add0DElement(anArrayOfIndices[i]);
break;
case SMDSAbs_Ball:
if ( myGeomType == SMDSEntity_Ball )
anElemId = aMeshEditor->AddBall(anArrayOfIndices[0],
DiameterSpinBox->GetValue()); break;
if ( myGeomType == SMDSEntity_Ball ) {
anIdList->length( anArrayOfIndices->length() );
for ( size_t i = 0; i < anArrayOfIndices->length(); ++i )
anIdList[i] = aMeshEditor->AddBall(anArrayOfIndices[i],
DiameterSpinBox->GetValue());
}
break;
case SMDSAbs_Edge:
anElemId = aMeshEditor->AddEdge(anArrayOfIndices.inout()); break;
anIdList[0] = aMeshEditor->AddEdge(anArrayOfIndices.inout()); break;
case SMDSAbs_Face:
if ( myIsPoly )
anElemId = aMeshEditor->AddPolygonalFace(anArrayOfIndices.inout());
anIdList[0] = aMeshEditor->AddPolygonalFace(anArrayOfIndices.inout());
else
anElemId = aMeshEditor->AddFace(anArrayOfIndices.inout());
anIdList[0] = aMeshEditor->AddFace(anArrayOfIndices.inout());
break;
default:
anElemId = aMeshEditor->AddVolume(anArrayOfIndices.inout()); break;
anIdList[0] = aMeshEditor->AddVolume(anArrayOfIndices.inout()); break;
}
if ( anElemId != -1 && addToGroup && !aGroupName.isEmpty() ) {
if ( anIdList[0] > 0 && addToGroup && !aGroupName.isEmpty() ) {
SMESH::SMESH_Group_var aGroupUsed;
if ( aGroup->_is_nil() ) {
// create new group
@ -559,13 +570,9 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
aGroupUsed = SMESH::SMESH_Group::_narrow( aGroup );
}
if ( !aGroupUsed->_is_nil() ) {
SMESH::long_array_var anIdList = new SMESH::long_array;
anIdList->length( 1 );
anIdList[0] = anElemId;
if ( !aGroupUsed->_is_nil() )
aGroupUsed->Add( anIdList.inout() );
}
}
SALOME_ListIO aList; aList.Append( myActor->getIO() );
mySelector->ClearIndex();
@ -676,7 +683,7 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight( myActor->getIO(), true, true );
myNbOkNodes = ( allOk && myNbNodes == aListId.count() );
myNbOkNodes = ( allOk && ( myNbNodes == aListId.count() || myNbNodes == 1 ));
if (myIsPoly)
{
@ -766,7 +773,7 @@ void SMESHGUI_AddMeshElementDlg::SelectionIntoArgument()
myBusy = false;
if (myIsPoly && myElementType == SMDSAbs_Face && nbNodes >= 3 ) {
myNbNodes = nbNodes;
} else if (myNbNodes != nbNodes) {
} else if (myNbNodes != nbNodes && myNbNodes != 1) {
return;
}

View File

@ -206,7 +206,7 @@ void SMESHGUI_BuildCompoundDlg::Init()
myMesh = SMESH::SMESH_Mesh::_nil();
myMeshFilter = new SMESH_TypeFilter (MESH);
myMeshFilter = new SMESH_TypeFilter (SMESH::MESH);
myMeshArray = new SMESH::mesh_array();

View File

@ -742,14 +742,8 @@ void SMESHGUI_ClippingDlg::updateActorItem( QListWidgetItem* theItem,
if( anItem->checkState() == Qt::Checked )
aNbChecked++;
Qt::CheckState aCheckState = Qt::Unchecked;
if( aNbChecked == aNbItems )
aCheckState = Qt::Checked;
else if( aNbChecked > 0 )
aCheckState = Qt::PartiallyChecked;
bool anIsBlocked = SelectAllCheckBox->blockSignals( true );
SelectAllCheckBox->setCheckState( aCheckState );
SelectAllCheckBox->setCheckState( aNbChecked == aNbItems ? Qt::Checked : Qt::Unchecked);
SelectAllCheckBox->blockSignals( anIsBlocked );
}

View File

@ -193,7 +193,7 @@ void SMESHGUI_ConvToQuadOp::selectionDone()
SUIT_SelectionFilter* SMESHGUI_ConvToQuadOp::createFilter( const int theId ) const
{
if ( theId == 0 )
return new SMESH_TypeFilter( MESHorSUBMESH );
return new SMESH_TypeFilter( SMESH::MESHorSUBMESH );
else
return 0;
}

View File

@ -219,7 +219,7 @@ SMESHGUI_CopyMeshDlg::SMESHGUI_CopyMeshDlg( SMESHGUI* theModule )
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
// Selection filter
myIdSourceFilter = new SMESH_TypeFilter( IDSOURCE );
myIdSourceFilter = new SMESH_TypeFilter( SMESH::IDSOURCE );
myHelpFileName = "copy_mesh_page.html";

View File

@ -176,7 +176,7 @@ void SMESHGUI_DeleteGroupDlg::Init ()
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
// set selection mode
mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
mySelectionMgr->installFilter(new SMESH_TypeFilter(SMESH::GROUP));
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
onSelectionDone();
@ -210,7 +210,7 @@ bool SMESHGUI_DeleteGroupDlg::onApply()
QList<SMESH::SMESH_GroupBase_var>::iterator anIter;
for (anIter = myListGrp.begin(); anIter != myListGrp.end(); ++anIter) {
SMESH::SMESH_Mesh_ptr aMesh = (*anIter)->GetMesh();
SMESH::SMESH_Mesh_var aMesh = (*anIter)->GetMesh();
if (!aMesh->_is_nil())
aMesh->RemoveGroupWithContents(*anIter);
}
@ -218,6 +218,12 @@ bool SMESHGUI_DeleteGroupDlg::onApply()
myListBox->clear();
myListGrp.clear();
mySelectionMgr->clearSelected();
/** Erase graphical objects **/
SALOME_ListIteratorOfListIO anIterIO (myListGrpIO);
for ( ; anIterIO.More(); anIterIO.Next())
SMESH::RemoveVisualObjectWithActors( anIterIO.Value()->getEntry(), /*fromAllViews=*/true );
SMESH::UpdateView();
SMESHGUI::Modified();
mySMESHGUI->updateObjBrowser(true);
@ -285,6 +291,7 @@ void SMESHGUI_DeleteGroupDlg::onSelectionDone()
return;
myListGrp.clear();
myListGrpIO.Clear();
QStringList aNames;
SALOME_ListIO aListIO;
@ -296,6 +303,7 @@ void SMESHGUI_DeleteGroupDlg::onSelectionDone()
if (!aGroup->_is_nil()) {
aNames.append(aGroup->GetName());
myListGrp.append(aGroup);
myListGrpIO.Append( anIter.Value() );
}
}
@ -323,7 +331,7 @@ void SMESHGUI_DeleteGroupDlg::enterEvent (QEvent*)
setEnabled(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
mySelectionMgr->installFilter(new SMESH_TypeFilter (SMESH::GROUP));
}
//=================================================================================

View File

@ -29,6 +29,8 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include <SALOME_ListIO.hxx>
// Qt includes
#include <QDialog>
@ -86,6 +88,7 @@ private:
SMESHGUI* mySMESHGUI;
LightApp_SelectionMgr* mySelectionMgr;
SALOME_ListIO myListGrpIO;
QList<SMESH::SMESH_GroupBase_var> myListGrp;
bool myBlockSelection;

View File

@ -46,9 +46,9 @@ SMESHGUI_Dialog::SMESHGUI_Dialog( QWidget* parent, const bool modal,
: LightApp_Dialog( parent == 0 ? desktop() : parent, "", modal, allowResize, flags )
{
int pr = prefix( "SMESH" );
typeName( pr + MESH ) = tr( "DLG_MESH" );
typeName( pr + HYPOTHESIS ) = tr( "DLG_HYPO" );
typeName( pr + ALGORITHM ) = tr( "DLG_ALGO" );
typeName( pr + SMESH::MESH ) = tr( "DLG_MESH" );
typeName( pr + SMESH::HYPOTHESIS ) = tr( "DLG_HYPO" );
typeName( pr + SMESH::ALGORITHM ) = tr( "DLG_ALGO" );
setButtonText(1, tr("SMESH_BUT_APPLY_AND_CLOSE")); //rename OK to Apply and Close
if ( flags & Close )
setButtonPosition( Right, Close );

View File

@ -249,7 +249,7 @@ void SMESHGUI_DuplicateNodesDlg::Init()
myGroups3.clear();
// Set selection mode
mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
mySelectionMgr->installFilter(new SMESH_TypeFilter(SMESH::GROUP));
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
@ -571,7 +571,7 @@ void SMESHGUI_DuplicateNodesDlg::enterEvent (QEvent*)
// Set selection mode
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
mySelectionMgr->installFilter(new SMESH_TypeFilter (SMESH::GROUP));
}
}

View File

@ -323,16 +323,16 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
mySMESHGUI->SetActiveDialogBox(this);
// Costruction of the logical filter for the elements: mesh/sub-mesh/group
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (SMESH::MESHorSUBMESH);
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (SMESH::GROUP);
QList<SUIT_SelectionFilter*> aListOfFilters;
if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
myElementsFilter = new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
//myPathMeshFilter = new SMESH_TypeFilter (MESH);
myPathMeshFilter = new SMESH_TypeFilter(MESHorSUBMESH);
//myPathMeshFilter = new SMESH_TypeFilter (SMESH::MESH);
myPathMeshFilter = new SMESH_TypeFilter(SMESH::MESHorSUBMESH);
myHelpFileName = "extrusion_along_path_page.html";
@ -978,8 +978,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(NodeSelection);
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter(MESHorSUBMESH);
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter(GROUP);
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter(SMESH::MESHorSUBMESH);
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter(SMESH::GROUP);
SMESH_NumberFilter* aVertexFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE,
-1, TopAbs_VERTEX);
QList<SUIT_SelectionFilter*> aListOfFilters;

View File

@ -91,6 +91,7 @@
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
: SMESHGUI_PreviewDlg( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myEditCurrentArgument(0),
myFilterDlg( 0 ),
mySelectedObject(SMESH::SMESH_IDSource::_nil())
{
@ -281,19 +282,19 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
// Costruction of the logical filter for the elements: mesh/sub-mesh/group
QList<SUIT_SelectionFilter*> aListOfFilters;
aListOfFilters.append(new SMESH_TypeFilter (MESH));
aListOfFilters.append(new SMESH_TypeFilter (SUBMESH_VERTEX));
aListOfFilters.append(new SMESH_TypeFilter (GROUP_NODE));
aListOfFilters.append(new SMESH_TypeFilter (SMESH::MESH));
aListOfFilters.append(new SMESH_TypeFilter (SMESH::SUBMESH_VERTEX));
aListOfFilters.append(new SMESH_TypeFilter (SMESH::GROUP_NODE));
myMeshOrSubMeshOrGroupFilter0D =
new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
aListOfFilters[0] = new SMESH_TypeFilter (MESH);
aListOfFilters[1] = new SMESH_TypeFilter (SUBMESH_EDGE);
aListOfFilters[2] = new SMESH_TypeFilter (GROUP_EDGE);
aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH);
aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_EDGE);
aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_EDGE);
myMeshOrSubMeshOrGroupFilter1D =
new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
aListOfFilters[0] = new SMESH_TypeFilter (MESH);
aListOfFilters[1] = new SMESH_TypeFilter (SUBMESH_FACE);
aListOfFilters[2] = new SMESH_TypeFilter (GROUP_FACE);
aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH);
aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_FACE);
aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_FACE);
myMeshOrSubMeshOrGroupFilter2D =
new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);

View File

@ -1002,6 +1002,17 @@ void SMESHGUI_FilterTable::Init (const QList<int>& theTypes)
myLibDlg = 0;
}
else
{
QList<int>::const_iterator typeIt = theTypes.begin();
for ( ; typeIt != theTypes.end(); ++typeIt ) {
if ( !myTables[ *typeIt ] ) {
Table* aTable = createTable(mySwitchTableGrp, *typeIt);
myTables[ *typeIt ] = aTable;
((QVBoxLayout*)mySwitchTableGrp->layout())->addWidget(myTables[ *typeIt ]);
}
}
}
// Hide buttons of entity types if necessary
const QMap<int, QString>& aSupportedTypes = getSupportedTypes();
@ -1743,6 +1754,7 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
aTable->blockSignals( isSignalsBlocked );
}
// set Compare and enable/desable Threshold
if ((aType == SMESH::NODE && (aCriterionType == SMESH::FT_FreeNodes ||
aCriterionType == SMESH::FT_EqualNodes )) ||
(aType == SMESH::EDGE && (aCriterionType == SMESH::FT_FreeBorders ||
@ -1970,6 +1982,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getSupportedTypes() const
if (aTypes.isEmpty())
{
aTypes[ SMESH::NODE ] = tr("NODES");
aTypes[ SMESH::ELEM0D ] = tr("ELEM0D");
aTypes[ SMESH::BALL ] = tr("BALLS");
aTypes[ SMESH::EDGE ] = tr("EDGES");
aTypes[ SMESH::FACE ] = tr("FACES");
@ -2106,6 +2119,20 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
}
return aCriteria;
}
else if (theType == SMESH::ELEM0D)
{
static QMap<int, QString> aCriteria;
if (aCriteria.isEmpty())
{
aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS");
aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM");
aCriteria[ SMESH::FT_BelongToPlane ] = tr("BELONG_TO_PLANE");
aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER");
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
}
return aCriteria;
}
else // SMESH::ALL
{
static QMap<int, QString> aCriteria;
@ -2673,6 +2700,8 @@ void SMESHGUI_FilterDlg::Init (const QList<int>& theTypes, const bool setInViewe
{
int aType = theTypes.first();
if (aType == SMESH::NODE ) setWindowTitle(tr("NODES_TLT"));
else if (aType == SMESH::ELEM0D) setWindowTitle(tr("ELEM0D_TLT"));
else if (aType == SMESH::BALL ) setWindowTitle(tr("BALL_TLT"));
else if (aType == SMESH::EDGE ) setWindowTitle(tr("EDGES_TLT"));
else if (aType == SMESH::FACE ) setWindowTitle(tr("FACES_TLT"));
else if (aType == SMESH::VOLUME) setWindowTitle(tr("VOLUMES_TLT"));
@ -2879,6 +2908,8 @@ Selection_Mode SMESHGUI_FilterDlg::getSelMode (const int theType) const
switch (theType)
{
case SMESH::NODE : return NodeSelection;
case SMESH::ELEM0D : return Elem0DSelection;
case SMESH::BALL : return BallSelection;
case SMESH::EDGE : return EdgeSelection;
case SMESH::FACE : return FaceSelection;
case SMESH::VOLUME : return VolumeSelection;

View File

@ -242,8 +242,8 @@ SMESHGUI_FindElemByPointOp::SMESHGUI_FindElemByPointOp()
myHelpFileName = "find_element_by_point_page.html";
QList<SUIT_SelectionFilter*> filters;
filters.append( new SMESH_TypeFilter( MESH ) );
filters.append( new SMESH_TypeFilter( GROUP ) );
filters.append( new SMESH_TypeFilter( SMESH::MESH ) );
filters.append( new SMESH_TypeFilter( SMESH::GROUP ) );
myFilter = new SMESH_LogicalFilter( filters, SMESH_LogicalFilter::LO_OR );
myPreview = new SMESH::MeshPreviewStruct();

View File

@ -103,15 +103,16 @@
enum grpSelectionMode {
grpNoSelection = -1,
grpNodeSelection = 0,
grpBallSelection = 1,
grpEdgeSelection = 2,
grpFaceSelection = 3,
grpVolumeSelection = 4,
grpSubMeshSelection = 5,
grpGroupSelection = 6,
grpMeshSelection = 7,
grpGeomSelection = 8,
grpAllSelection = 9,
grp0DSelection = 1,
grpBallSelection = 2,
grpEdgeSelection = 3,
grpFaceSelection = 4,
grpVolumeSelection = 5,
grpSubMeshSelection = 6,
grpGroupSelection = 7,
grpMeshSelection = 8,
grpGeomSelection = 9,
grpAllSelection = 10,
};
//=================================================================================
@ -214,6 +215,7 @@ void SMESHGUI_GroupDlg::initDialog( bool create)
QStringList types;
types.append( tr( "MESH_NODE" ) );
types.append( tr( "SMESH_ELEM0D" ) );
types.append( tr( "SMESH_BALL_ELEM" ) );
types.append( tr( "SMESH_EDGE" ) );
types.append( tr( "SMESH_FACE" ) );
@ -444,7 +446,7 @@ void SMESHGUI_GroupDlg::initDialog( bool create)
mySMESHGUI->SetState(800);
mySelectionMode = grpNoSelection;
myMeshFilter = new SMESH_TypeFilter(MESH);
myMeshFilter = new SMESH_TypeFilter(SMESH::MESH);
mySubMeshFilter = new SMESH_LogicalFilter(QList<SUIT_SelectionFilter*>(),
SMESH_LogicalFilter::LO_OR,
/*takeOwnership=*/true);
@ -521,6 +523,22 @@ QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation)
return aName;
}
void SMESHGUI_GroupDlg::setDefaultName() const
{
QString aResName;
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
int i=1;
QString aPrefix ="Group_";
_PTR(SObject) anObj;
do
{
aResName = aPrefix + QString::number( i++ );
anObj = aStudy->FindObject( aResName.toLatin1().data() );
}
while ( anObj );
myName->setText(aResName);
}
//=================================================================================
// function : Init()
// purpose :
@ -543,6 +561,8 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
SetAppropriateActor();
setDefaultGroupColor();
setDefaultName();
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
@ -583,11 +603,12 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
int aType = 0;
switch(theGroup->GetType()) {
case SMESH::NODE: aType = 0; break;
case SMESH::BALL: aType = 1; break;
case SMESH::EDGE: aType = 2; break;
case SMESH::FACE: aType = 3; break;
case SMESH::VOLUME: aType = 4; break;
case SMESH::NODE: aType = grpNodeSelection; break;
case SMESH::ELEM0D: aType = grp0DSelection; break;
case SMESH::BALL: aType = grpBallSelection; break;
case SMESH::EDGE: aType = grpEdgeSelection; break;
case SMESH::FACE: aType = grpFaceSelection; break;
case SMESH::VOLUME: aType = grpVolumeSelection; break;
}
myTypeGroup->button(aType)->setChecked(true);
@ -807,6 +828,9 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
case grpBallSelection:
if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : BallSelection);
break;
case grp0DSelection:
if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : Elem0DSelection);
break;
case grpFaceSelection:
if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : FaceSelection);
break;
@ -817,15 +841,15 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
SMESH_TypeFilter* f = 0;
switch (myTypeId) {
case grpNodeSelection: f = new SMESH_TypeFilter(SUBMESH); break;
case grpEdgeSelection: f = new SMESH_TypeFilter(SUBMESH_EDGE); break;
case grpFaceSelection: f = new SMESH_TypeFilter(SUBMESH_FACE); break;
case grpVolumeSelection: f = new SMESH_TypeFilter(SUBMESH_SOLID); break;
default: f = new SMESH_TypeFilter(SUBMESH);
case grpNodeSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH); break;
case grpEdgeSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH_EDGE); break;
case grpFaceSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH_FACE); break;
case grpVolumeSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH_SOLID); break;
default: f = new SMESH_TypeFilter(SMESH::SUBMESH);
}
QList<SUIT_SelectionFilter*> filtList;
filtList.append( f );
filtList.append( new SMESH_TypeFilter(SUBMESH_COMPOUND));
filtList.append( new SMESH_TypeFilter(SMESH::SUBMESH_COMPOUND));
mySubMeshFilter->setFilters( filtList );
mySelectionMgr->installFilter( mySubMeshFilter );
@ -837,12 +861,13 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
SMESH_TypeFilter* f = 0;
switch (myTypeId) {
case grpNodeSelection: f = new SMESH_TypeFilter(GROUP_NODE); break;
case grpBallSelection: f = new SMESH_TypeFilter(GROUP_BALL); break;
case grpEdgeSelection: f = new SMESH_TypeFilter(GROUP_EDGE); break;
case grpFaceSelection: f = new SMESH_TypeFilter(GROUP_FACE); break;
case grpVolumeSelection: f = new SMESH_TypeFilter(GROUP_VOLUME); break;
default: f = new SMESH_TypeFilter(GROUP);
case grpNodeSelection: f = new SMESH_TypeFilter(SMESH::GROUP_NODE); break;
case grp0DSelection: f = new SMESH_TypeFilter(SMESH::GROUP_0D); break;
case grpBallSelection: f = new SMESH_TypeFilter(SMESH::GROUP_BALL); break;
case grpEdgeSelection: f = new SMESH_TypeFilter(SMESH::GROUP_EDGE); break;
case grpFaceSelection: f = new SMESH_TypeFilter(SMESH::GROUP_FACE); break;
case grpVolumeSelection: f = new SMESH_TypeFilter(SMESH::GROUP_VOLUME); break;
default: f = new SMESH_TypeFilter(SMESH::GROUP);
}
QList<SUIT_SelectionFilter*> filtList;
filtList.append( f );
@ -884,6 +909,7 @@ bool SMESHGUI_GroupDlg::onApply()
SMESH::ElementType aType = SMESH::ALL;
switch (myTypeId) {
case grpNodeSelection: aType = SMESH::NODE; break;
case grp0DSelection: aType = SMESH::ELEM0D; break;
case grpBallSelection: aType = SMESH::BALL; break;
case grpEdgeSelection: aType = SMESH::EDGE; break;
case grpFaceSelection: aType = SMESH::FACE; break;
@ -1112,7 +1138,7 @@ bool SMESHGUI_GroupDlg::onApply()
SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" );
/* init for the next operation */
myName->setText( "" );
setDefaultName();
myElements->clear();
myGroup = SMESH::SMESH_Group::_nil();
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
@ -1130,6 +1156,7 @@ bool SMESHGUI_GroupDlg::onApply()
int delta;
switch ( myTypeId ) {
case grpNodeSelection: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
case grp0DSelection: anActor->Set0DColor ( aColor.R, aColor.G, aColor.B ); break;
case grpBallSelection: anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break;
case grpEdgeSelection: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
case grpVolumeSelection:
@ -1674,6 +1701,7 @@ void SMESHGUI_GroupDlg::setFilters()
switch ( myTypeId )
{
case grpNodeSelection: aType = SMESH::NODE; break;
case grp0DSelection: aType = SMESH::ELEM0D; break;
case grpBallSelection: aType = SMESH::BALL; break;
case grpEdgeSelection: aType = SMESH::EDGE; break;
case grpFaceSelection: aType = SMESH::FACE; break;
@ -1765,6 +1793,10 @@ void SMESHGUI_GroupDlg::onAdd()
aType = SMESH::BALL;
mySelector->SetSelectionMode(BallSelection);
break;
case grp0DSelection:
aType = SMESH::ELEM0D;
mySelector->SetSelectionMode(Elem0DSelection);
break;
case grpEdgeSelection:
aType = SMESH::EDGE;
mySelector->SetSelectionMode(EdgeSelection);
@ -2005,6 +2037,7 @@ void SMESHGUI_GroupDlg::onRemove()
SMESH::ElementType aType = SMESH::ALL;
switch(myTypeId) {
case grpNodeSelection: aType = SMESH::NODE; break;
case grp0DSelection: aType = SMESH::ELEM0D; break;
case grpBallSelection: aType = SMESH::BALL; break;
case grpEdgeSelection: aType = SMESH::EDGE; break;
case grpFaceSelection: aType = SMESH::FACE; break;
@ -2566,6 +2599,7 @@ void SMESHGUI_GroupDlg::setShowEntityMode()
myStoredShownEntity = actor->GetEntityMode();
switch ( myTypeId ) {
case grpNodeSelection: restoreShowEntityMode(); break;
case grp0DSelection: actor->SetEntityMode( SMESH_Actor::e0DElements ); break;
case grpBallSelection: actor->SetEntityMode( SMESH_Actor::eBallElem ); break;
case grpEdgeSelection: actor->SetEntityMode( SMESH_Actor::eEdges ); break;
case grpFaceSelection: actor->SetEntityMode( SMESH_Actor::eFaces ); break;

View File

@ -141,7 +141,7 @@ private:
void setGroupQColor( const QColor& );
QColor getGroupQColor() const;
void setDefaultName() const;
void setDefaultGroupColor();
void setIsApplyAndClose( const bool theFlag );

View File

@ -419,7 +419,7 @@ SUIT_SelectionFilter* SMESHGUI_GroupOnShapeOp::createFilter( const int theId ) c
if ( theId == _ELEM_GEOM || theId == _NODE_GEOM )
return new GEOM_SelectionFilter( (SalomeApp_Study*)study(), true );
else if ( theId == _MESH )
return new SMESH_TypeFilter( MESH );
return new SMESH_TypeFilter( SMESH::MESH );
else
return ( SUIT_SelectionFilter*) 0;
}

View File

@ -233,7 +233,7 @@ void SMESHGUI_GroupOpDlg::Init()
// set selection mode
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
mySelectionMgr->installFilter(new SMESH_TypeFilter (SMESH::GROUP));
}
/*!
@ -464,7 +464,7 @@ void SMESHGUI_GroupOpDlg::enterEvent(QEvent*)
setEnabled(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
mySelectionMgr->installFilter(new SMESH_TypeFilter (SMESH::GROUP));
}
/*!

View File

@ -572,6 +572,8 @@ QString SMESHGUI_GenericHypothesisCreator::helpPage() const
aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
else if ( aHypType == "ViscousLayers")
aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
else if ( aHypType == "ViscousLayers2D")
aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
aHelpFileName = "import_algos_page.html";
return aHelpFileName;

View File

@ -82,10 +82,13 @@ protected:
QVariant myValue;
bool isVariable;
QString myText;
StdParam(){
QByteArray myTextAsBytes;
StdParam() {
isVariable = false;
}
const char* text() const { return myText.toLatin1().constData(); }
const char* text() const {
((QByteArray&) myTextAsBytes) = myText.toLatin1(); return myTextAsBytes.constData();
}
};
typedef QList<StdParam> ListOfStdParams;

View File

@ -74,7 +74,7 @@
#endif
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYDEBUG = 1;
#else
static int MYDEBUG = 0;
#endif
@ -420,13 +420,13 @@ namespace SMESH
LibHandle libHandle = LoadLib( aClientLibName.toLatin1().data() );
if (!libHandle) {
// report any error, if occured
if ( MYDEBUG ) {
{
#ifdef WIN32
const char* anError = "Can't load client meshers plugin library";
#else
const char* anError = dlerror();
#endif
MESSAGE(anError);
INFOS(anError); // always display this kind of error !
}
}
else {

View File

@ -217,8 +217,8 @@ void SMESHGUI_Make2DFrom3DDlg::onGroupChecked()
SMESHGUI_Make2DFrom3DOp::SMESHGUI_Make2DFrom3DOp()
: SMESHGUI_SelectionOp(),
myMeshFilter(MESH),
myGroupFilter(GROUP)
myMeshFilter(SMESH::MESH),
myGroupFilter(SMESH::GROUP)
{
}

View File

@ -190,8 +190,8 @@ SMESHGUI_MinDistance::SMESHGUI_MinDistance( QWidget* parent )
connect( mySecondTgt, SIGNAL( textEdited( QString ) ), this, SLOT( secondEdited() ) );
QList<SUIT_SelectionFilter*> filters;
filters.append( new SMESH_TypeFilter( MESHorSUBMESH ) );
filters.append( new SMESH_TypeFilter( GROUP ) );
filters.append( new SMESH_TypeFilter( SMESH::MESHorSUBMESH ) );
filters.append( new SMESH_TypeFilter( SMESH::GROUP ) );
myFilter = new SMESH_LogicalFilter( filters, SMESH_LogicalFilter::LO_OR );
mySecondTgt->setEnabled( mySecond->checkedId() != OriginTgt );
@ -706,8 +706,8 @@ SMESHGUI_BoundingBox::SMESHGUI_BoundingBox( QWidget* parent )
connect( mySource, SIGNAL( textEdited( QString ) ), this, SLOT( sourceEdited() ) );
QList<SUIT_SelectionFilter*> filters;
filters.append( new SMESH_TypeFilter( MESHorSUBMESH ) );
filters.append( new SMESH_TypeFilter( GROUP ) );
filters.append( new SMESH_TypeFilter( SMESH::MESHorSUBMESH ) );
filters.append( new SMESH_TypeFilter( SMESH::GROUP ) );
myFilter = new SMESH_LogicalFilter( filters, SMESH_LogicalFilter::LO_OR );
clear();

View File

@ -1291,8 +1291,8 @@ void SMESHGUI_MergeDlg::onTypeChanged (int id)
SMESH::UpdateView();
// Costruction of the logical filter
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (SMESH::MESHorSUBMESH);
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (SMESH::GROUP);
QList<SUIT_SelectionFilter*> aListOfFilters;
if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);

View File

@ -34,6 +34,7 @@
#include "SMDS_BallElement.hxx"
#include "SMDS_EdgePosition.hxx"
#include "SMDS_FacePosition.hxx"
#include "SMESH_ControlsDef.hxx"
#include <LightApp_SelectionMgr.h>
#include <SUIT_OverrideCursor.h>
@ -886,6 +887,9 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
if ( actor() ) {
int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
int cprecision = -1;
if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ) )
cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 );
foreach ( long id, ids ) {
if ( !isElements() ) {
//
@ -934,6 +938,7 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
// show element info
//
const SMDS_MeshElement* e = actor()->GetObject()->GetMesh()->FindElement( id );
SMESH::Controls::NumericalFunctorPtr afunctor;
if ( !e ) return;
// element ID && type
@ -1040,6 +1045,84 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
myInfo->append( QString( "<b>%1</b>" ).arg( tr( "FREE_NODE" ) ).arg( id ) );
}
}
// separator
myInfo->append( "" );
//controls
myInfo->append( QString( "<b>%1:</b>" ).arg( tr( "MEN_CTRL" ) ) );
//Length
if ( e->GetType() == SMDSAbs_Edge ) {
afunctor.reset( new SMESH::Controls::Length() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "LENGTH_EDGES" ) ).arg( afunctor->GetValue( id ) ) );
}
if( e->GetType() == SMDSAbs_Face ) {
//Area
afunctor.reset( new SMESH::Controls::Area() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "AREA_ELEMENTS" ) ).arg( afunctor->GetValue( id ) ) );
//Taper
afunctor.reset( new SMESH::Controls::Taper() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MEN_TAPER" ) ).arg( afunctor->GetValue( id ) ) );
//AspectRatio2D
afunctor.reset( new SMESH::Controls::AspectRatio() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "ASPECTRATIO_ELEMENTS" ) ).arg( afunctor->GetValue( id ) ) );
//Minimum angle
afunctor.reset( new SMESH::Controls::MinimumAngle() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MINIMUMANGLE_ELEMENTS" ) ).arg( afunctor->GetValue( id ) ) );
//Wraping angle
afunctor.reset( new SMESH::Controls::Warping() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "STB_WARP" ) ).arg( afunctor->GetValue( id ) ) );
//Skew
afunctor.reset( new SMESH::Controls::Skew() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "TOP_SKEW" ) ).arg( afunctor->GetValue( id ) ) );
//ElemDiam2D
afunctor.reset( new SMESH::Controls::MaxElementLength2D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_2D" ) ).arg( afunctor->GetValue( id ) ) );
}
if( e->GetType() == SMDSAbs_Volume ) {
//AspectRatio3D
afunctor.reset( new SMESH::Controls::AspectRatio3D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "ASPECTRATIO_3D_ELEMENTS" ) ).arg( afunctor->GetValue( id ) ) );
//Volume
afunctor.reset( new SMESH::Controls::Volume() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MEN_VOLUME_3D" ) ).arg( afunctor->GetValue( id ) ) );
//ElementDiameter3D
afunctor.reset( new SMESH::Controls::Volume() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_3D" ) ).arg( afunctor->GetValue( id ) ) );
}
/*
if( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
// separator
myInfo->append( "" );
//shapeID
int shapeID = e->getshapeId();
if ( shapeID > 0 ) {
QString shapeType;
switch ( actor()->GetObject()->GetMesh()->FindElement( shapeID )->GetType() ) {
case SMDS_TOP_EDGE: shapeType = tr( "EDGE" ); break;
case SMDS_TOP_FACE: shapeType = tr( "FACE" ); break;
case SMDS_TOP_VERTEX: shapeType = tr( "VERTEX" ); break;
default: shapeType = tr( "SOLID" );
}
myInfo->append( QString( "<b>%1:</b> %2 #%3" ).arg( tr( "Position" ) ).arg( shapeType ).arg( shapeID ) );
}
}
*/
}
// separator
if ( ids.count() > 1 ) {
@ -1123,6 +1206,9 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
if ( actor() ) {
int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
int cprecision = -1;
if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ) )
cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 );
foreach ( long id, ids ) {
if ( !isElements() ) {
//
@ -1226,6 +1312,7 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
// show element info
//
const SMDS_MeshElement* e = actor()->GetObject()->GetMesh()->FindElement( id );
SMESH::Controls::NumericalFunctorPtr afunctor;
if ( !e ) return;
// element ID && type
@ -1373,6 +1460,105 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
}
}
}
//Controls
QTreeWidgetItem* cntrItem = createItem( elemItem, Bold );
cntrItem->setText( 0, tr( "MEN_CTRL" ) );
//Length
if( e->GetType()==SMDSAbs_Edge){
afunctor.reset( new SMESH::Controls::Length() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
QTreeWidgetItem* lenItem = createItem( cntrItem, Bold );
lenItem->setText( 0, tr( "LENGTH_EDGES" ) );
lenItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
}
if( e->GetType() == SMDSAbs_Face ) {
//Area
afunctor.reset( new SMESH::Controls::Area() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
QTreeWidgetItem* areaItem = createItem( cntrItem, Bold );
areaItem->setText( 0, tr( "AREA_ELEMENTS" ) );
areaItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue(id) ) );
//Taper
afunctor.reset( new SMESH::Controls::Taper() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
QTreeWidgetItem* taperlItem = createItem( cntrItem, Bold );
taperlItem->setText( 0, tr( "MEN_TAPER" ) );
taperlItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
//AspectRatio2D
afunctor.reset( new SMESH::Controls::AspectRatio() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
QTreeWidgetItem* ratlItem = createItem( cntrItem, Bold );
ratlItem->setText( 0, tr( "ASPECTRATIO_ELEMENTS" ));
ratlItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
//Minimum angle
afunctor.reset( new SMESH::Controls::MinimumAngle() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
QTreeWidgetItem* minanglItem = createItem( cntrItem, Bold );
minanglItem->setText( 0, tr( "MINIMUMANGLE_ELEMENTS" ) );
minanglItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
//Wraping angle
afunctor.reset( new SMESH::Controls::Warping() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
QTreeWidgetItem* warpItem = createItem( cntrItem, Bold );
warpItem->setText( 0, tr( "STB_WARP" ));
warpItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
//Skew
afunctor.reset( new SMESH::Controls::Skew() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
QTreeWidgetItem* skewItem = createItem( cntrItem, Bold );
skewItem->setText( 0, tr( "TOP_SKEW" ) );
skewItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
//ElemDiam2D
afunctor.reset( new SMESH::Controls::MaxElementLength2D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
QTreeWidgetItem* diamItem = createItem( cntrItem, Bold );
diamItem->setText( 0, tr( "MAX_ELEMENT_LENGTH_2D" ));
diamItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
}
if( e->GetType() == SMDSAbs_Volume ) {
//AspectRatio3D
afunctor.reset( new SMESH::Controls::AspectRatio3D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
QTreeWidgetItem* ratlItem3 = createItem( cntrItem, Bold );
ratlItem3->setText( 0, tr( "ASPECTRATIO_3D_ELEMENTS" ) );
ratlItem3->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
//Volume
afunctor.reset( new SMESH::Controls::Volume() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
QTreeWidgetItem* volItem = createItem( cntrItem, Bold );
volItem->setText( 0, tr( "MEN_VOLUME_3D" ) );
volItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
//ElementDiameter3D
afunctor.reset( new SMESH::Controls::MaxElementLength3D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
QTreeWidgetItem* diam3Item = createItem( cntrItem, Bold );
diam3Item->setText( 0, tr( "MAX_ELEMENT_LENGTH_3D" ) );
diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
}
/*
if( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
//shapeID
int shapeID = e->getshapeId();
if ( shapeID > 0 ) {
QTreeWidgetItem* shItem = createItem( elemItem, Bold );
QString shapeType;
switch ( actor()->GetObject()->GetMesh()->FindElement( shapeID )->GetType() ) {
case SMDS_TOP_EDGE: shapeType = tr( "EDGE" ); break;
case SMDS_TOP_FACE: shapeType = tr( "FACE" ); break;
case SMDS_TOP_VERTEX: shapeType = tr( "VERTEX" ); break;
default: shapeType = tr( "SOLID" );
}
shItem->setText( 0, tr( "Position" ) );
shItem->setText( 1, QString( "%1 #%2" ).arg(shapeType).arg( shapeID ) );
}
}
*/
}
}
}

View File

@ -297,9 +297,9 @@ SUIT_SelectionFilter* SMESHGUI_MeshOp::createFilter( const int theId ) const
return new GEOM_SelectionFilter( (SalomeApp_Study*)study(), true );
}
else if ( theId == SMESHGUI_MeshDlg::Obj && !myToCreate )
return new SMESH_TypeFilter( MESHorSUBMESH );
return new SMESH_TypeFilter( SMESH::MESHorSUBMESH );
else if ( theId == SMESHGUI_MeshDlg::Mesh )
return new SMESH_TypeFilter( MESH );
return new SMESH_TypeFilter( SMESH::MESH );
else
return 0;
}
@ -1965,10 +1965,9 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
//================================================================================
/*!
* \brief Reads parameters of edited mesh and assigns them to the dialog
* \brief Reads parameters of an edited mesh and assigns them to the dialog
*
* Reads parameters of edited mesh and assigns them to the dialog (called when
* mesh is edited only)
* Called when mesh is edited only.
*/
//================================================================================
void SMESHGUI_MeshOp::readMesh()
@ -2005,8 +2004,8 @@ void SMESHGUI_MeshOp::readMesh()
// Get hypotheses and algorithms assigned to the mesh/sub-mesh
QStringList anExisting;
const int aDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D;
for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
const int lastDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D;
for ( int dim = SMESH::DIM_3D; dim >= lastDim; --dim )
{
// get algorithm
existingHyps( dim, Algo, pObj, anExisting, myObjHyps[ dim ][ Algo ] );
@ -2030,7 +2029,7 @@ void SMESHGUI_MeshOp::readMesh()
// get hypotheses
bool hypWithoutAlgo = false;
for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
for ( int dim = SMESH::DIM_3D; dim >= lastDim; --dim )
{
for ( int hypType = MainHyp; hypType <= AddHyp; hypType++ )
{

View File

@ -225,7 +225,7 @@ QWidget* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool
myComboBoxFunctor->addItem(tr("ASPECTRATIO_ELEMENTS"));
myComboBoxFunctor->addItem(tr("MINIMUMANGLE_ELEMENTS"));
myComboBoxFunctor->addItem(tr("SKEW_ELEMENTS"));
myComboBoxFunctor->addItem(tr("AREA_ELEMENTS"));
//myComboBoxFunctor->addItem(tr("AREA_ELEMENTS"));
//myComboBoxFunctor->addItem(tr("LENGTH2D_EDGES")); // for existing elements only
//myComboBoxFunctor->addItem(tr("MULTI2D_BORDERS")); // for existing elements only
myComboBoxFunctor->setCurrentIndex(0);
@ -362,6 +362,8 @@ SMESH::NumericalFunctor_ptr SMESHGUI_MultiEditDlg::getNumericalFunctor()
aNF = aFilterMgr->CreateLength2D();
else if (myComboBoxFunctor->currentText() == tr("MULTI2D_BORDERS"))
aNF = aFilterMgr->CreateMultiConnection2D();
else if (myComboBoxFunctor->currentText() == tr("MIN_DIAG_ELEMENTS"))
aNF = aFilterMgr->CreateMaxElementLength2D();
else;
return aNF._retn();
@ -998,12 +1000,12 @@ void SMESHGUI_MultiEditDlg::setSelectionMode()
if (mySubmeshChk->isChecked()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(new SMESH_TypeFilter(SUBMESH));
mySelectionMgr->installFilter(new SMESH_TypeFilter(SMESH::SUBMESH));
}
else if (myGroupChk->isChecked()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
mySelectionMgr->installFilter(new SMESH_TypeFilter(SMESH::GROUP));
}
if (entityType()) {
@ -1154,6 +1156,7 @@ SMESHGUI_UnionOfTrianglesDlg
setWindowTitle(tr("CAPTION"));
myComboBoxFunctor->setEnabled(true);
myComboBoxFunctor->addItem(tr("AREA_ELEMENTS"));
myComboBoxFunctor->addItem(tr("WARP_ELEMENTS")); // for quadrangles only
myComboBoxFunctor->addItem(tr("TAPER_ELEMENTS")); // for quadrangles only
@ -1240,6 +1243,8 @@ SMESHGUI_CuttingOfQuadsDlg
myCriterionGrp->show();
myChoiceWidget->show();
myComboBoxFunctor->insertItem(0, tr("MIN_DIAG_ELEMENTS"));
myComboBoxFunctor->setCurrentIndex(0);
myComboBoxFunctor->setEnabled(false);
connect(myPreviewChk, SIGNAL(stateChanged(int)), this, SLOT(onPreviewChk()));

View File

@ -621,8 +621,8 @@ void SMESHGUI_PropertiesDlg::showControls( int elements, bool nodes )
// node controls are supposed to be shown if at least any element type is present
// or if there are only nodes
myNodeGrp->setVisible( nodes || elements & SMESH_Actor::eAllEntity );
// edge controls are shown only if there are edges
myEdgeGrp->setVisible( elements & SMESH_Actor::eEdges );
// edge/wireframe controls are needed for edges, faces and volumes
myEdgeGrp->setVisible( elements & ( SMESH_Actor::eEdges | SMESH_Actor::eFaces | SMESH_Actor::eVolumes ) );
// face controls are shown only if there are faces
myFaceGrp->setVisible( elements & SMESH_Actor::eFaces );
// volume controls are shown only if there are volumes

View File

@ -372,7 +372,7 @@ void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument()
myActor = SMESH::FindActorByEntry(anIO->getEntry());
if (myActor) {
// get selected nodes
// get selected elements
QString aString = "";
int nbElems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aString);
if (nbElems > 0) {

View File

@ -182,7 +182,7 @@ void SMESHGUI_RenumberingDlg::Init()
myMesh = SMESH::SMESH_Mesh::_nil();
myMeshFilter = new SMESH_TypeFilter (MESH);
myMeshFilter = new SMESH_TypeFilter (SMESH::MESH);
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));

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