Merge from V6_main (04/10/2012)

This commit is contained in:
vsr 2012-10-08 11:56:59 +00:00
parent e4f02cdb38
commit f5016d85b7
173 changed files with 8676 additions and 3172 deletions

View File

@ -553,6 +553,7 @@ AC_OUTPUT([ \
src/DriverMED/Makefile \ src/DriverMED/Makefile \
src/DriverSTL/Makefile \ src/DriverSTL/Makefile \
src/DriverUNV/Makefile \ src/DriverUNV/Makefile \
src/DriverGMF/Makefile \
src/DriverCGNS/Makefile \ src/DriverCGNS/Makefile \
src/MEFISTO2/Makefile \ src/MEFISTO2/Makefile \
src/OBJECT/Makefile \ src/OBJECT/Makefile \

View File

@ -26,25 +26,26 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
EXTRA_DIST += images input static/footer.html static/doxygen.css EXTRA_DIST += images input static/footer.html static/doxygen.css
dist_salomescript_PYTHON = collect_mesh_methods.py
guidocdir = $(docdir)/gui/SMESH guidocdir = $(docdir)/gui/SMESH
guidoc_DATA = images/head.png guidoc_DATA = images/head.png
DOC_PYTHONPATH=$(prefix)/bin/salome:$(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)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages
DOC_SMESH_MeshersList=StdMeshers
usr_docs: doxyfile_py doxyfile # to have smesh.py in the documentation instead of smeshDC.py
echo "===========================================" ; \ # we create dummy smesh.py from the smeshDC.py
echo "Replacing smeshDC by smesh" ; \ smesh.py: ../../../../src/SMESH_SWIG/smeshDC.py
echo "===========================================" ; \ @awk '/^class Mesh:/ { mesh_found=1 } // { if (mesh_found) {print $$0; next} } /^ +(def|#)/ { match( $$0, /^ +/); print substr( $$0, 1+RLENGTH ); next } /^class smeshDC/ { next } //' \
awk '/^class Mesh:/ { mesh_found=1 } // { if (mesh_found) {print $$0; next} } /^ +(def|#)/ { match( $$0, /^ +/); print substr( $$0, 1+RLENGTH ); next } /^class smeshDC/ { next } //' \ $< > $@
$(top_srcdir)/src/SMESH_SWIG/smeshDC.py > ./smesh.py ; \
echo "===========================================" ; \ tmp/smesh.py: $(top_srcdir)/src/SMESH_SWIG/StdMeshersDC.py $(srcdir)/collect_mesh_methods.py
echo "Generating Python interface documentation"; \ @mkdir -p tmp && PYTHONPATH=$(DOC_PYTHONPATH):${PYTHONPATH} SMESH_MeshersList=$(DOC_SMESH_MeshersList) $(PYTHON) $(srcdir)/collect_mesh_methods.py -o $@ StdMeshers
echo "===========================================" ; \
$(DOXYGEN) doxyfile_py ; \ usr_docs: doxyfile_py doxyfile smesh.py tmp/smesh.py
echo "===========================================" ; \ @$(DOXYGEN) doxyfile_py ; \
echo "Generating GUI documentation" ; \ $(DOXYGEN) doxyfile
echo "===========================================" ; \
$(DOXYGEN) doxyfile ; \
rm -f ./smesh.py
docs: usr_docs docs: usr_docs

View File

@ -0,0 +1,118 @@
#!/usr/bin/env python
#################################################################################
#
# File: collect_mesh_methods.py
# Author: Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com)
#
#################################################################################
#
# Extraction of the meshing algorithm classes
# dynamically added by the plug-in to the Mesh
# class.
#
# This script is intended for internal usage - only
# for generatation of the extra developer documentation for
# the meshing plug-in(s).
#
# Usage:
# collect_mesh_methods.py <plugin_name>
# where
# <plugin_name> is a name of the plug-in module
#
# Notes:
# - the script is supposed to be run in correct environment
# i.e. PYTHONPATH, SMESH_MeshersList and other important
# variables are set properly; otherwise the script will fail.
#
################################################################################
import sys
def main(plugin, dummymeshhelp = True, output_file = "smesh.py"):
plugin_module = plugin + "DC"
try:
mod = __import__(plugin_module)
methods = {}
for attr in dir( mod ):
if attr.startswith( '_' ): continue
algo = getattr( mod, attr )
if type( algo ).__name__ == 'classobj' and hasattr( algo, "meshMethod" ):
method = getattr( algo, "meshMethod" )
if method not in methods: methods[ method ] = []
methods[ method ].append( algo )
pass
pass
if methods:
output = []
if dummymeshhelp:
output.append( "## @package smesh" )
output.append( "# Documentation of the methods dynamically added by the " + plugin + " meshing plug-in to the Mesh class." )
output.append( "" )
pass
output.append( "## This class allows defining and managing a mesh." )
output.append( "#" )
if dummymeshhelp:
# Add dummy Mesh help
# This is supposed to be done when generating documentation for meshing plug-ins
output.append( "# @note The documentation below does not provide complete description of class @b %Mesh" )
output.append( "# from @b %smesh.py package. This documentation provides only information about" )
output.append( "# the methods dynamically added to the %Mesh class by the " + plugin + " plugin" )
output.append( "# For more details on the %Mesh class, please refer to the SALOME %Mesh module" )
output.append( "# documentation." )
pass
else:
# Extend documentation for Mesh class with information about dynamically added methods.
# This is supposed to be done only when building documentation for SMESH module
output.append( "# @note Some methods are dynamically added to the @b %Mesh class in runtime by meshing " )
output.append( "# plug-in modules. If you fail to find help on some methods in the documentation of SMESH module, " )
output.append( "# try to look into the documentation for the meshing plug-ins." )
pass
output.append( "class Mesh:" )
for method in methods:
docHelper = ""
for algo in methods[ method ]:
if hasattr( algo, "docHelper" ): docHelper = getattr( algo, "docHelper" )
if docHelper: break
pass
if not docHelper: docHelper = "Creates new algorithm."
output.append( " ## %s" % docHelper )
output.append( " #" )
output.append( " # This method is dynamically added to %Mesh class by the meshing plug-in(s). " )
output.append( " #" )
output.append( " # If the optional @a geom_shape parameter is not set, this algorithm is global (applied to whole mesh)." )
output.append( " # Otherwise, this algorithm defines a submesh based on @a geom_shape subshape." )
output.append( " # @param algo_type type of algorithm to be created; allowed values are specified by classes implemented by plug-in (see below)" )
output.append( " # @param geom_shape if defined, the subshape to be meshed (GEOM_Object)" )
output.append( " # @return An instance of Mesh_Algorithm sub-class according to the specified @a algo_type, see " )
output.append( " # %s" % ", ".join( [ "%s.%s" % ( plugin_module, algo.__name__ ) for algo in methods[ method ] ] ) )
output.append( " def %s(algo_type, geom_shape=0):" % method )
output.append( " pass" )
pass
f = open(output_file, "w")
for line in output: f.write( line + "\n" )
f.close()
pass
pass
except Exception, e:
print e
pass
pass
if __name__ == "__main__":
import optparse
parser = optparse.OptionParser(usage="%prog [options] plugin")
h = "Output file (smesh.py by default)"
parser.add_option("-o", "--output", dest="output",
action="store", default=None, metavar="file",
help=h)
h = "If this option is True, dummy help for Mesh class is added. "
h += "This option should be False (default) when building documentation for SMESH module "
h += "and True when building documentation for meshing plug-ins."
parser.add_option("-d", "--dummy-mesh-help", dest="dummymeshhelp",
action="store_true", default=False,
help=h)
(options, args) = parser.parse_args()
if len( args ) < 1: sys.exit("Plugin name is not specified")
main( args[0], options.dummymeshhelp, options.output )
pass

View File

@ -99,7 +99,10 @@ EXAMPLE_RECURSIVE = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
#Input related options #Input related options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
INPUT = smesh.py @top_srcdir@/src/SMESH_SWIG/StdMeshersDC.py INPUT = smesh.py \
@top_srcdir@/src/SMESH_SWIG/smesh_algorithm.py \
@top_srcdir@/src/SMESH_SWIG/StdMeshersDC.py \
tmp/smesh.py
FILE_PATTERNS = FILE_PATTERNS =
IMAGE_PATH = @srcdir@/images IMAGE_PATH = @srcdir@/images
RECURSIVE = NO RECURSIVE = NO
@ -132,24 +135,24 @@ GENERATE_RTF = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO CLASS_DIAGRAMS = NO
HIDE_UNDOC_RELATIONS = NO HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = NO HAVE_DOT = YES
CLASS_GRAPH = NO CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO COLLABORATION_GRAPH = NO
GROUP_GRAPHS = NO GROUP_GRAPHS = NO
UML_LOOK = NO UML_LOOK = NO
TEMPLATE_RELATIONS = NO TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = NO INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = NO INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = NO GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = NO DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = jpg DOT_IMAGE_FORMAT = png
DOT_FONTNAME = Arial DOT_FONTNAME = Arial
DOT_PATH = DOT_PATH =
DOTFILE_DIRS = DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1200 MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 0 MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = NO GENERATE_LEGEND = NO

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -5,14 +5,16 @@
\n \b MESH represents a discretization of a geometrical CAD model into \n \b MESH represents a discretization of a geometrical CAD model into
a set of entities with a simple topology. a set of entities with a simple topology.
Meshes are stored in DAT, MED, UNV, STL, CGNS and SAUVE formats and can be Meshes are stored in DAT, MED, UNV, STL, CGNS, GMF and SAUVE formats and can be
\subpage importing_exporting_meshes_page "imported from and exported to" \subpage importing_exporting_meshes_page "imported from and exported to"
the file in these formats. the file in these formats.
It is possible to \subpage constructing_meshes_page "construct meshes" It is possible to \subpage constructing_meshes_page "construct meshes"
on the basis of geometrical shapes produced in the GEOM module. on the basis of geometrical shapes produced in the GEOM module.
It is also possible to \subpage constructing_submeshes_page "mesh on a part of the geometrical object", It is also possible to \subpage constructing_submeshes_page "construct
for example, a face, with different meshing parameters than the whole mesh. mesh on a part of the geometrical object", for example, a face, with
different meshing parameters than the whole mesh.
Several created meshes can be \subpage building_compounds_page "combined into another mesh". Several created meshes can be \subpage building_compounds_page "combined into another mesh".

View File

@ -4,34 +4,48 @@
\image html colors_size.png \image html colors_size.png
Using this dialog you can define the following set of mesh visualization Using this dialog you can customize different properties of the mesh visualization
parameters: parameters.
<ul>
<li><b>Elements</b></li> The GUI elements in the "Properties" dialog box are grouped according
<ul> to the entity types of mesh data. If some data entities are not
<li><b>Surface color</b> - surface color of elements (seen in Shading mode).</li> present in the mesh object, the corresponding GUI elements are not
<li><b>Back surface color</b> - interior surface color of elements. Use slider to select this color shown.
generated on base of the <b>Surface color</b> by changing its brightness and saturation.</li>
<li><b>Outline color</b> - color of element borders.</li> - \b Nodes:
<li><b>Wireframe color</b> - color of element borders in wireframe mode.</li> - \b Color - color of nodes.
<li><b>0D slements</b> - color of 0D elements.</li> - \b Type and \b Scale - these options allow changing of the nodes
<li><b>Size of 0D slements</b> - size of 0D elements.</li> representation (see \subpage point_marker_page "Point Marker" page
<li><b>Line width</b> - width of lines (edges and borders of elements).</li> for more details).
<li><b>Shrink coef.</b> - relative space of elements compared to gaps between - <b>Edges / wireframe</b>:
them in shrink mode.</li> - \b Color - color of element borders in wireframe mode.
</ul> - \b Width - width of lines (edges and borders of elements
<li><b>Nodes</b></li> in wireframe mode).
<ul> - \b Faces:
<li><b>Color</b> - color of nodes.</li> - \b Front - surface color of face elements (seen in shading mode).
<li><b>Marker</b> - group of options allowing to change the representation of - \b Back - backside surface color of face elements. Use slider to
points (see \subpage point_marker_page "Point Marker" page).</li> select this color generated on base of the \b Face color by
</ul> changing its brightness and saturation.
<li><b>Orientation of faces</b></li> - \b Volumes:
<ul> - \b Normal - surface color of normal volume elements (seen in shading mode).
<li><b>Color</b> - color of orientation vertors.</li> - \b Reversed - surface color of volume elements. Use slider to
<li><b>Scale</b> - size of orientation vectors.</li> select this color generated on base of the \b Normal color by
<li><b>3D vectors</b> - allows to choose between 2D planar and 3D vectors.</li> changing its brightness and saturation.
</ul> - \b Outlines:
</ul> - \b Color - color of element borders in shading mode.
- \b Width - width of outlines (borders of elements
in shading mode).
- <b>0D elements</b>:
- \b Color - color of 0D elements.
- \b Size - size of 0D elements.
- \b Balls:
- \b Color - color of discrete ball elements.
- \b Size - size of discrete ball elements.
- <b>Orientation vectors</b>:
- \b Color - color of orientation vectors.
- \b Scale - size of orientation vectors.
- <b>3D vectors</b> - allows to choose between 2D planar and 3D vectors.
- <b>Shrink coef.</b> - relative space of elements compared to gaps between
them in shrink mode.
*/ */

View File

@ -34,6 +34,27 @@ written in Python.
\subpage about_hypo_page "hypotheses" which will be used at computation of \subpage about_hypo_page "hypotheses" which will be used at computation of
this mesh. this mesh.
"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
that affect 3D geometrical objects (solids).
\note
- 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,
\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
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).
For example, you need to mesh a 3D object. 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 for your mesh in the \b Name box, by default,
@ -284,6 +305,11 @@ 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 switch the mesh to Wireframe visualization mode or to switch off
visualization of faces and volumes (if any). 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
bad Mesh</b> button</em>
<br><br>
\anchor use_existing_anchor \anchor use_existing_anchor
<h2>"Use existing edges" and "Use existing faces" algorithms</h2> <h2>"Use existing edges" and "Use existing faces" algorithms</h2>

View File

@ -36,12 +36,15 @@ at computation of this sub-mesh</li>
From the \b Mesh menu select <b>Create Sub-mesh</b> or click <em>"Create From the \b Mesh menu select <b>Create Sub-mesh</b> or click <em>"Create
Sum-mesh"</em> button in the toolbar. Sum-mesh"</em> button in the toolbar.
\image html image33.gif <center>
<center><em>"Create Sub-mesh" button</em></center> \image html image33.gif
<em>"Create Sub-mesh" button</em>
</center>
\par \par
The following dialog box will appear: The following dialog box will appear:
\par
\image html createmesh-inv2.png \image html createmesh-inv2.png
\par \par
@ -50,6 +53,33 @@ Geometry (e.g. a face if the parent mesh has been built on box) of the
sub-mesh. You can define algorithms and hypotheses in the same way as sub-mesh. You can define algorithms and hypotheses in the same way as
in \ref constructing_meshes_page "Create mesh" menu. in \ref constructing_meshes_page "Create mesh" menu.
\par
If the parent mesh is already computed, then you can define
\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
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
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.
\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.
\par \par
In the Object Browser the structure of the new sub-mesh will be In the Object Browser the structure of the new sub-mesh will be
displayed as follows: displayed as follows:

View File

@ -8,7 +8,7 @@ corners.
<em>To cut quadrangles:</em> <em>To cut quadrangles:</em>
<ol> <ol>
<li>Display a mesh or a submesh in the 3D viewer.</li> <li>Display a mesh or a sub-mesh in the 3D viewer.</li>
<li>In the \b Modification menu select the <b>Cutting of quadrangles</b> item or <li>In the \b Modification menu select the <b>Cutting of quadrangles</b> item or
click <em>"Cutting of quadrangles"</em> button in the toolbar. click <em>"Cutting of quadrangles"</em> button in the toolbar.
@ -29,7 +29,7 @@ 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 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> 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> radio button allows to modify the orientation of all
quadrangles of the currently displayed mesh or submesh.</li> quadrangles of the currently displayed mesh or sub-mesh.</li>
<li>\b Preview - provides a preview of cutting in the viewer.</li> <li>\b Preview - provides a preview of cutting in the viewer.</li>
</ul> </ul>
@ -39,12 +39,11 @@ quadrangles of the currently displayed mesh or submesh.</li>
<li><b>Use diagonal 1-3</b> and <b>Use diagonal 2-4</b> allows to <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 specify the opposite corners which will be connected by the cutting
edge.</li> edge.</li>
<li><b>Use numeric factor</b> - allows to apply the operation only to <li><b>Use numeric factor</b> - allows to chose a quality criterion
those objects which meet the chosen criterion (from the list of optimization of which will be used to select the cutting edge.</li>
Quality Controls, i.e. Skew, Warping, Minimum Angle, etc.)</li>
</ul> </ul>
</li> </li>
<li><b>Select from</b> - allows to choose a submesh or an existing <li><b>Select from</b> - allows to choose a sub-mesh or an existing
group whose quadrangle elements will be automatically added to the group whose quadrangle elements will be automatically added to the
list.</li> list.</li>
</ul> </ul>
@ -60,4 +59,4 @@ list.</li>
<br><b>See Also</b> a sample TUI Script of a <br><b>See Also</b> a sample TUI Script of a
\ref tui_cutting_quadrangles "Cutting Quadrangles" operation. \ref tui_cutting_quadrangles "Cutting Quadrangles" operation.
*/ */

View File

@ -3,15 +3,15 @@
\page importing_exporting_meshes_page Importing and exporting meshes \page importing_exporting_meshes_page Importing and exporting meshes
\n In MESH there is a functionality allowing importation/exportation \n In MESH there is a functionality allowing importation/exportation
of meshes from/to \b MED, \b UNV (I-DEAS 10), \b DAT (Nastran), \b STL of meshes from/to \b MED, \b UNV (I-DEAS 10), \b DAT (simple ascii format), \b STL,
and \b CGNS format files. You can also export a group as a whole mesh. \b GMF and \b CGNS format files. You can also export a group as a whole mesh.
<em>To import a mesh:</em> <em>To import a mesh:</em>
<ol> <ol>
<li>From the \b File menu choose the \b Import item, from its sub-menu <li>From the \b File menu choose the \b Import item, from its sub-menu
select the corresponding format (MED, UNV, DAT, STL and CGNS) of the file containing select the corresponding format (MED, UNV, STL, GMF and CGNS) of the file containing
your mesh.</li> your mesh.</li>
<li>In the standard <b>Search File</b> dialog box find the file for <li>In the standard <b>Search File</b> dialog box find the file for
importation. It is possible to select multiple files to be imported all at once. </li> importation. It is possible to select multiple files to be imported all at once. </li>
@ -26,7 +26,7 @@ importation. It is possible to select multiple files to be imported all at once.
<ol> <ol>
<li>Select the object you wish to export.</li> <li>Select the object you wish to export.</li>
<li>From the \b File menu choose the \b Export item, from its sub-menu <li>From the \b File menu choose the \b Export item, from its sub-menu
select the format (MED, UNV, DAT, STL and CGNS) of the file which will select the format (MED, UNV, DAT, STL, GMF and CGNS) of the file which will
contain your exported mesh.</li> contain your exported mesh.</li>
<li>In the standard <b>Search File</b> select a location for the <li>In the standard <b>Search File</b> select a location for the
exported file and enter its name.</li> exported file and enter its name.</li>

View File

@ -33,14 +33,14 @@ lines in the file. Note that missing symbols are replaced by "0".
Here is a texture file sample: Here is a texture file sample:
<pre> <pre>
00111100
00111100
11111111 11111111
10000001
10011001
10111101
10111101
10011001
10000001
11111111 11111111
11111111
11111111
00111100
00111100
</pre> </pre>
\image html point_marker_widget2.png \image html point_marker_widget2.png

View File

@ -2,44 +2,37 @@
\page smeshpy_interface_page Python interface \page smeshpy_interface_page Python interface
Python package smesh defines several classes, destined for easy and Python API for SALOME %Mesh module defines several classes that can
clear mesh creation and edition. be used for easy mesh creation and edition.
Documentation for smesh package is available in two forms: Documentation for SALOME %Mesh module Python API is available in two forms:
- <a href="smeshpy_doc/modules.html">Structured documentation</a>, where all methods and
The <a href="smeshpy_doc/modules.html"> structured
documentation for smesh package</a>, where all methods and
classes are grouped by their functionality, like it is done in the GUI documentation classes are grouped by their functionality, like it is done in the GUI documentation
and the \ref smeshDC "linear documentation for smesh package" - <a href="smeshpy_doc/namespaces.html">Linear documentation</a> grouped only by classes, declared
grouped only by classes, declared in the smesh.py file. in the \ref smesh and StdMeshersDC Python packages.
The main page of the \ref smeshDC "linear documentation for smesh package" Python package \ref smesh provides an interface to create and handle
contains a list of data structures and a list of meshes. It can be used to create an empty mesh or to import mesh from the data file.
functions, provided by the package smesh.py. The first item in
the list of data structures (\ref smeshDC::smeshDC "class smesh")
also represents documentation for the methods of the package smesh.py itself.
The package smesh.py provides an interface to create and handle As soon as mesh is created, it is possible to manage it via its own
meshes. Use it to create an empty mesh or to import it from the data file. methods, described in \ref smesh.Mesh "class Mesh" documentation.
Once a mesh has been created, it is possible to manage it via its own Class \ref smesh.Mesh "Mesh" allows assigning algorithms to a mesh.
methods, described at \ref smeshDC::Mesh "class Mesh" documentation Please note that some algorithms, included in the standard SALOME
(it is also accessible by the second item "class Mesh" in the list of data structures). distribution are always available. Python package \ref StdMeshersDC
provides an interface for standard meshing algorithms included into
Class \b Mesh allows assigning algorithms to a mesh. the SALOME %Mesh module distribution, like:
Please note, that some algorithms, included in the standard SALOME
distribution are always available:
- REGULAR (1D) - REGULAR (1D)
- COMPOSITE (1D) - COMPOSITE (1D)
- MEFISTO (2D) - MEFISTO (2D)
- Quadrangle (2D) - Quadrangle (2D)
- Hexa(3D) - Hexa(3D)
- etc... - etc ...
To add hypotheses, use the interfaces, provided by the assigned To add meshing hypotheses, it is possible to use the functions provided by the
algorithms. algorithms interfaces.
Below you can see an example of usage of the package smesh for 3d mesh generation. An example below demonstrates usage of the Python API for 3d mesh generation.
\anchor example_3d_mesh \anchor example_3d_mesh
<h2>Example of 3d mesh generation:</h2> <h2>Example of 3d mesh generation:</h2>
@ -118,7 +111,7 @@ tetra.Group(group)
\endcode \endcode
Examples of Python scripts for all Mesh operations are available by Examples of Python scripts for Mesh operations are available by
the following links: the following links:
- \subpage tui_creating_meshes_page - \subpage tui_creating_meshes_page

View File

@ -25,7 +25,7 @@ print "nb tetrahedra",mesh.NbTetras()
print "nb polyhedra",mesh.NbPolyhedrons() print "nb polyhedra",mesh.NbPolyhedrons()
print print
# define the grid by sitting constant spacing # define the grid by setting constant spacing
cartHyp = cartAlgo.SetGrid( "10","10","10", 1000000) cartHyp = cartAlgo.SetGrid( "10","10","10", 1000000)
mesh.Compute() mesh.Compute()
@ -34,9 +34,9 @@ print "nb tetrahedra",mesh.NbTetras()
print "nb polyhedra",mesh.NbPolyhedrons() print "nb polyhedra",mesh.NbPolyhedrons()
# define the grid by sitting different spacing in 2 sub-ranges of geometry # define the grid by setting different spacing in 2 sub-ranges of geometry
spaceFuns = ["5","10+10*t"] spaceFuns = ["5","10+10*t"]
cartAlgo.SetGrid( [spaceFuns, [0.5]], [spaceFuns, [0.5]], [spaceFuns, [0.25]], 2 ) cartAlgo.SetGrid( [spaceFuns, [0.5]], [spaceFuns, [0.5]], [spaceFuns, [0.25]], 10 )
mesh.Compute() mesh.Compute()
print "nb hexahedra",mesh.NbHexas() print "nb hexahedra",mesh.NbHexas()

View File

@ -2,11 +2,48 @@
\page tui_defining_hypotheses_page Defining Hypotheses and Algorithms \page tui_defining_hypotheses_page Defining Hypotheses and Algorithms
This page provides example codes of \ref tui_defining_meshing_algos
"defining algorithms" and hypotheses.
<ul>
<li>Wire discretisation 1D algorithm
<ul>
<li>\ref tui_1d_arithmetic "Arithmetic 1D" hypothesis</li>
<li>\ref tui_deflection_1d "Deflection 1D and Number of Segments" hypotheses</li>
<li>\ref tui_start_and_end_length "Start and End Length" hypotheses</li>
<li>\ref tui_average_length "Local Length"</li>
<li>\ref tui_propagation "Propagation" additional hypothesis </li>
<li>\ref tui_fixed_points "Fixed Points 1D" hypothesis</li>
</ul>
</li>
<li>Triangle (Mefisto) 2D algorithm
<ul>
<li>\ref tui_max_element_area "Max Element Area" hypothesis </li>
<li>\ref tui_length_from_edges "Length from Edges"
hypothesis </li>
</ul>
</li>
<li>Tetrahedron (Netgen) 3D algorithm
<ul>
<li> \ref tui_max_element_volume "Max. Element Volume"hypothesis </li>
<li> \ref tui_viscous_layers "Viscous layers"</li>
</ul>
</li>
<li>\ref tui_projection "Projection Algorithms"</li>
<li>\ref tui_radial_quadrangle "Radial Quadrangle 1D2D" algorithm</li>
<li>Quadrangle (Mapping) 2D algorithm
<ul>
<li> \ref tui_quadrangle_parameters "Quadrangle Parameters" hypothesis </li>
</ul>
</li>
<li>\ref tui_import "Use Existing Elements" algorithm</li>
</ul>
<br>
<h2>Defining 1D Hypotheses</h2> <h2>Defining 1D Hypotheses</h2>
<br> <br>
\anchor tui_1d_arithmetic \anchor tui_1d_arithmetic
<h3>1D Arithmetic</h3> <h3>Arithmetic 1D</h3>
\code \code
import geompy import geompy
@ -457,6 +494,40 @@ src_mesh.TranslateObject( src_mesh, MakeDirStruct( 210, 0, 0 ), Copy=False)
\endcode \endcode
<h3>Projection 1D2D</h3>
\code
# Project triangles from one meshed face to another mesh on the same box
from smesh import *
# Prepare geometry
# Create a box
box = geompy.MakeBoxDXDYDZ(100, 100, 100)
# Get geom faces to mesh with triangles in the 1ts and 2nd meshes
faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
# 2 adjacent faces of the box
Face_1 = faces[2]
Face_2 = faces[0]
geompy.addToStudy( box, 'box' )
geompy.addToStudyInFather( box, Face_1, 'Face_1' )
geompy.addToStudyInFather( box, Face_2, 'Face_2' )
# Make the source mesh with Netgem2D
src_mesh = Mesh(Face_1, "Source mesh")
src_mesh.Segment().NumberOfSegments(15)
src_mesh.Triangle()
src_mesh.Compute()
# Mesh the target mesh using the algoritm Projection1D2D
tgt_mesh = smesh.Mesh(Face_2, "Target mesh")
tgt_mesh.Projection1D2D().SourceFace(Face_1,src_mesh)
tgt_mesh.Compute()
\endcode
<br> <br>
\anchor tui_fixed_points \anchor tui_fixed_points

View File

@ -98,23 +98,23 @@ critaria = [ \
] ]
filt = GetFilterFromCriteria( critaria ) filt = GetFilterFromCriteria( critaria )
filtGroup = mesh.GroupOnFilter( FACE, "group on filter", filt ) filtGroup = mesh.GroupOnFilter( FACE, "group on filter", filt )
print "Group on filter conatains %s elemens" % filtGroup.Size() print "Group on filter contains %s elemens" % filtGroup.Size()
# group on filter is updated if the mesh is modified # group on filter is updated if the mesh is modified
hyp1D.SetStartLength( 2.5 ) hyp1D.SetStartLength( 2.5 )
hyp1D.SetEndLength( 2.5 ) hyp1D.SetEndLength( 2.5 )
mesh.Compute() mesh.Compute()
print "After mesh change, group on filter conatains %s elemens" % filtGroup.Size() print "After mesh change, group on filter contains %s elemens" % filtGroup.Size()
# set a new filter defining the group # set a new filter defining the group
filt2 = GetFilter( FACE, FT_RangeOfIds, "1-50" ) filt2 = GetFilter( FACE, FT_RangeOfIds, "1-50" )
filtGroup.SetFilter( filt2 ) filtGroup.SetFilter( filt2 )
print "With a new filter, group on filter conatains %s elemens" % filtGroup.Size() print "With a new filter, group on filter contains %s elemens" % filtGroup.Size()
# group is updated at modification of the filter # group is updated at modification of the filter
filt2.SetCriteria( [ GetCriterion( FACE, FT_RangeOfIds, "1-70" )]) filt2.SetCriteria( [ GetCriterion( FACE, FT_RangeOfIds, "1-70" )])
filtIDs3 = filtGroup.GetIDs() filtIDs3 = filtGroup.GetIDs()
print "After filter modification, group on filter conatains %s elemens" % filtGroup.Size() print "After filter modification, group on filter contains %s elemens" % filtGroup.Size()
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)
\endcode \endcode

View File

@ -164,8 +164,8 @@ mesh.RemoveElements(anIds)
aBorders = mesh.GetFreeBorders() aBorders = mesh.GetFreeBorders()
# create groups # create groups
aGroupF = mesh.CreateGroup(SMESH.FACE, "Faces with free edges") aGroupF = mesh.CreateEmptyGroup(smesh.FACE, "Faces with free edges")
aGroupN = mesh.CreateGroup(SMESH.NODE, "Nodes on free edges") aGroupN = mesh.CreateEmptyGroup(smesh.NODE, "Nodes on free edges")
# fill groups with elements, corresponding to the criterion # fill groups with elements, corresponding to the criterion
print "" print ""

View File

@ -7,7 +7,7 @@ once many triangles if they have adjacent edges.
<em>To union several triangles:</em> <em>To union several triangles:</em>
<ol> <ol>
<li>Display a mesh or a submesh in the 3D viewer.</li> <li>Display a mesh or a sub-mesh in the 3D viewer.</li>
<li>In the \b Modification menu select the <b>Union of triangles</b> <li>In the \b Modification menu select the <b>Union of triangles</b>
item or click <em>"Union of triangles"</em> button in the toolbar. item or click <em>"Union of triangles"</em> button in the toolbar.
@ -27,11 +27,10 @@ elements from the list click the \b Remove button. The \b Sort button allows
to sort the list of IDs. The <b>Set filter</b> button allows to apply a to sort the list of IDs. The <b>Set filter</b> button allows to apply a
definite filter to selection of triangles.</li> definite filter to selection of triangles.</li>
<li><b>Apply to all</b> radio button allows to modify connectivity and <li><b>Apply to all</b> radio button allows to modify connectivity and
type of all triangles of the currently displayed mesh or submesh.</li> type of all triangles of the currently displayed mesh or sub-mesh.</li>
<li>\b Criterion menu allows to apply the operation only to those <li>\b Criterion menu allows to chose a quality criterion
object which meet the chosen criterion (from the list of Quality optimization of which will be used to select triangles to unite.</li>
Controls, i.e. Skew, Warping, Minimum Angle, etc.)</li> <li><b>Select from</b> set of fields allows to choose a sub-mesh or an
<li><b>Select from</b> set of fields allows to choose a submesh or an
existing group whose triangle elements will be automatically added to existing group whose triangle elements will be automatically added to
the list.</li> the list.</li>
</ul> </ul>

View File

@ -101,7 +101,8 @@ module SMESH
COMPERR_ALGO_FAILED , // computation failed COMPERR_ALGO_FAILED , // computation failed
COMPERR_BAD_SHAPE , // bad geometry COMPERR_BAD_SHAPE , // bad geometry
COMPERR_WARNING , // algo reports error but sub-mesh is computed anyway COMPERR_WARNING , // algo reports error but sub-mesh is computed anyway
COMPERR_CANCELED // compute canceled COMPERR_CANCELED , // compute canceled
COMPERR_NO_MESH_ON_SHAPE // no mesh elements assigned to sub-mesh
}; };
struct ComputeError struct ComputeError
{ {
@ -237,6 +238,13 @@ module SMESH
out SMESH::DriverMED_ReadStatus theStatus ) out SMESH::DriverMED_ReadStatus theStatus )
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*!
* Create Mesh object importing data from given GMF file
*/
SMESH_Mesh CreateMeshesFromGMF( in string theFileName,
out SMESH::ComputeError theError)
raises ( SALOME::SALOME_Exception );
/*! /*!
* Create a mesh by copying a part of another mesh * Create a mesh by copying a part of another mesh
* \param meshPart - a part of mesh to copy * \param meshPart - a part of mesh to copy

View File

@ -80,29 +80,29 @@ module SMESH
* \param theParameters is a string containing the notebook variables separated by ":" symbol, * \param theParameters is a string containing the notebook variables separated by ":" symbol,
* used for Hypothesis creation * used for Hypothesis creation
*/ */
void SetParameters (in string theParameters); // void SetParameters (in string theParameters);
/*! // /*!
* Return list of notebook variables used for Hypothesis creation separated by ":" symbol // * Return list of notebook variables used for Hypothesis creation separated by ":" symbol
*/ // */
string GetParameters(); // string GetParameters();
/*! // /*!
* Return list of last notebook variables used for Hypothesis creation. // * Return list of last notebook variables used for Hypothesis creation.
*/ // */
ListOfParameters GetLastParameters(); // ListOfParameters GetLastParameters();
/*! // /*!
* Set list of parameters // * Set list of parameters
* \param theParameters is a string containing the last notebook variables separated by ":" symbol, // * \param theParameters is a string containing the last notebook variables separated by ":" symbol,
* used for Hypothesis creation // * used for Hypothesis creation
*/ // */
void SetLastParameters(in string theParameters); // void SetLastParameters(in string theParameters);
/*! // /*!
* Clear parameters list // * Clear parameters list
*/ // */
void ClearParameters(); // void ClearParameters();
/*! /*!
* Verify whether hypothesis supports given entity type * Verify whether hypothesis supports given entity type

View File

@ -652,7 +652,7 @@ module SMESH
string GetVersionString(in MED_VERSION version, in short nbDigits); string GetVersionString(in MED_VERSION version, in short nbDigits);
/*! /*!
* Export Mesh to DAT, UNV and STL Formats * Export Mesh to different Formats
* (UNV supported version is I-DEAS 10) * (UNV supported version is I-DEAS 10)
*/ */
void ExportDAT( in string file ) raises (SALOME::SALOME_Exception); void ExportDAT( in string file ) raises (SALOME::SALOME_Exception);
@ -662,6 +662,8 @@ module SMESH
void ExportCGNS( in SMESH_IDSource meshPart, void ExportCGNS( in SMESH_IDSource meshPart,
in string file, in string file,
in boolean overwrite ) raises (SALOME::SALOME_Exception); in boolean overwrite ) raises (SALOME::SALOME_Exception);
void ExportGMF( in SMESH_IDSource meshPart,
in string file ) raises (SALOME::SALOME_Exception);
void ExportPartToDAT( in SMESH_IDSource meshPart, void ExportPartToDAT( in SMESH_IDSource meshPart,
in string file ) raises (SALOME::SALOME_Exception); in string file ) raises (SALOME::SALOME_Exception);
void ExportPartToUNV( in SMESH_IDSource meshPart, void ExportPartToUNV( in SMESH_IDSource meshPart,

View File

@ -25,6 +25,7 @@
#define _SMESH_MESHEDITOR_IDL_ #define _SMESH_MESHEDITOR_IDL_
#include "SMESH_Mesh.idl" #include "SMESH_Mesh.idl"
#include "SMESH_Gen.idl"
module SMESH module SMESH
{ {
@ -34,8 +35,34 @@ module SMESH
* This interface makes modifications on the Mesh - removing elements and nodes etc. * This interface makes modifications on the Mesh - removing elements and nodes etc.
*/ */
interface NumericalFunctor; interface NumericalFunctor;
interface SMESH_MeshEditor interface SMESH_MeshEditor
{ {
/*!
* Return data of mesh edition preview which is computed provided
* that the editor was obtained trough SMESH_Mesh::GetMeshEditPreviewer()
*/
MeshPreviewStruct GetPreviewData();
/*!
* If during last operation of MeshEditor some nodes were
* created this method returns list of their IDs, if new nodes
* not created - returns empty list
*/
long_array GetLastCreatedNodes();
/*!
* If during last operation of MeshEditor some elements were
* created this method returns list of their IDs, if new elements
* not created - returns empty list
*/
long_array GetLastCreatedElems();
/*!
* \brief Returns description of an error/warning occured during the last operation
*/
ComputeError GetLastError();
/*! /*!
* \brief Wrap a sequence of ids in a SMESH_IDSource * \brief Wrap a sequence of ids in a SMESH_IDSource
* \param IDsOfElements list of mesh elements identifiers * \param IDsOfElements list of mesh elements identifiers
@ -802,26 +829,6 @@ module SMESH
*/ */
boolean ChangeElemNodes(in long ide, in long_array newIDs); boolean ChangeElemNodes(in long ide, in long_array newIDs);
/*!
* Return data of mesh edition preview which is computed provided
* that the editor was obtained trough SMESH_Mesh::GetMeshEditPreviewer()
*/
MeshPreviewStruct GetPreviewData();
/*!
* If during last operation of MeshEditor some nodes were
* created this method returns list of it's IDs, if new nodes
* not creared - returns empty list
*/
long_array GetLastCreatedNodes();
/*!
* If during last operation of MeshEditor some elements were
* created this method returns list of it's IDs, if new elements
* not creared - returns empty list
*/
long_array GetLastCreatedElems();
/*! /*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \param theNodes - identifiers of nodes to be doubled * \param theNodes - identifiers of nodes to be doubled
@ -1038,6 +1045,21 @@ module SMESH
in ListOfGroups theNodesNot, in ListOfGroups theNodesNot,
in GEOM::GEOM_Object theShape ); in GEOM::GEOM_Object theShape );
/*!
* \brief Identify the elements that will be affected by node duplication (actual duplication is not performed).
* This method is the first step of DoubleNodeElemGroupsInRegion.
* \param theElems - list of groups of elements (edges or faces) to be replicated
* \param theNodesNot - list of groups of nodes not to replicated
* \param theShape - shape to detect affected elements (element which geometric center
* located on or inside shape).
* The replicated nodes should be associated to affected elements.
* \return groups of affected elements
* \sa DoubleNodeElemGroupsInRegion()
*/
ListOfGroups AffectedElemGroupsInRegion( in ListOfGroups theElems,
in ListOfGroups theNodesNot,
in GEOM::GEOM_Object theShape );
/*! /*!
* \brief Generates skin mesh (containing 2D cells) from 3D mesh * \brief Generates skin mesh (containing 2D cells) from 3D mesh
* The created 2D mesh elements based on nodes of free faces of boundary volumes * The created 2D mesh elements based on nodes of free faces of boundary volumes
@ -1117,6 +1139,18 @@ module SMESH
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
*/ */
boolean CreateFlatElementsOnFacesGroups( in ListOfGroups theGroupsOfFaces ); boolean CreateFlatElementsOnFacesGroups( in ListOfGroups theGroupsOfFaces );
/*!
* \brief identify all the elements around a geom shape, get the faces delimiting the hole
* Build groups of volume to remove, groups of faces to replace on the skin of the object,
* groups of faces to remove insidethe object, (idem edges).
* Build ordered list of nodes at the border of each group of faces to replace (to be used to build a geom subshape)
*/
void CreateHoleSkin(in double radius,
in GEOM::GEOM_Object theShape,
in string groupName,
in double_array theNodesCoords,
out array_of_long_array GroupsOfNodes) raises (SALOME::SALOME_Exception);
}; };
}; };

View File

@ -28,12 +28,14 @@
<parameter name="icon" value="ModuleMesh.png"/> <parameter name="icon" value="ModuleMesh.png"/>
<parameter name="version" value="@VERSION@"/> <parameter name="version" value="@VERSION@"/>
<!-- Other module preferences --> <!-- Other module preferences -->
<parameter name="default_grp_color" value="255, 170, 0"/>
<parameter name="node_color" value="255, 0, 0"/> <parameter name="node_color" value="255, 0, 0"/>
<parameter name="fill_color" value="0, 170, 255|-100"/> <parameter name="fill_color" value="0, 170, 255|-100"/>
<parameter name="volume_color" value="255, 0, 170|-100"/>
<parameter name="wireframe_color" value="0, 170, 255"/> <parameter name="wireframe_color" value="0, 170, 255"/>
<parameter name="outline_color" value="0, 70, 0"/> <parameter name="outline_color" value="0, 70, 0"/>
<parameter name="elem0d_color" value="0, 255, 0"/> <parameter name="elem0d_color" value="0, 255, 0"/>
<parameter name="ball_elem_color" value="100, 255, 0"/> <parameter name="ball_elem_color" value="0, 85, 255"/>
<parameter name="highlight_color" value="0, 255, 255"/> <parameter name="highlight_color" value="0, 255, 255"/>
<parameter name="group_name_color" value="255, 255, 255"/> <parameter name="group_name_color" value="255, 255, 255"/>
<parameter name="type_of_marker" value="1" /> <parameter name="type_of_marker" value="1" />
@ -41,6 +43,7 @@
<parameter name="elem0d_size" value="5" /> <parameter name="elem0d_size" value="5" />
<parameter name="ball_elem_size" value="10" /> <parameter name="ball_elem_size" value="10" />
<parameter name="element_width" value="1" /> <parameter name="element_width" value="1" />
<parameter name="outline_width" value="1" />
<parameter name="shrink_coeff" value="75"/> <parameter name="shrink_coeff" value="75"/>
<parameter name="orientation_color" value="255, 255, 255"/> <parameter name="orientation_color" value="255, 255, 255"/>
<parameter name="orientation_scale" value="0.1"/> <parameter name="orientation_scale" value="0.1"/>

View File

@ -55,7 +55,7 @@
dim="1"/> dim="1"/>
<hypothesis type="FixedPoints1D" <hypothesis type="FixedPoints1D"
label-id="Fixed points 1D" label-id="Fixed Points 1D"
icon-id="mesh_hypo_length.png" icon-id="mesh_hypo_length.png"
dim="1"/> dim="1"/>
@ -75,18 +75,18 @@
dim="1"/> dim="1"/>
<hypothesis type="Propagation" <hypothesis type="Propagation"
label-id="Propagation of 1D Hyp. on opposite edges" label-id="Propagation of 1D Hyp. on Opposite Edges"
icon-id="mesh_hypo_length.png" icon-id="mesh_hypo_length.png"
dim="1" dim="1"
auxiliary="true"/> auxiliary="true"/>
<hypothesis type="AutomaticLength" <hypothesis type="AutomaticLength"
label-id="Automatic length" label-id="Automatic Length"
icon-id="mesh_hypo_length.png" icon-id="mesh_hypo_length.png"
dim="1"/> dim="1"/>
<hypothesis type="LengthFromEdges" <hypothesis type="LengthFromEdges"
label-id="Length From Edges (2D Hyp. for Triangulator)" label-id="Length From Edges"
icon-id="mesh_hypo_length.png" icon-id="mesh_hypo_length.png"
dim="2"/> dim="2"/>
@ -184,14 +184,14 @@
<algorithms> <algorithms>
<algorithm type="SegmentAroundVertex_0D" <algorithm type="SegmentAroundVertex_0D"
label-id="Segments around vertex" label-id="Segments around Vertex"
icon-id="mesh_algo_regular.png" icon-id="mesh_algo_regular.png"
hypos="SegmentLengthAroundVertex" hypos="SegmentLengthAroundVertex"
output="VERTEX" output="VERTEX"
dim="0"/> dim="0"/>
<algorithm type="Regular_1D" <algorithm type="Regular_1D"
label-id="Wire discretisation" label-id="Wire Discretisation"
icon-id="mesh_algo_regular.png" icon-id="mesh_algo_regular.png"
hypos="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D" hypos="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
opt-hypos="Propagation,QuadraticMesh" opt-hypos="Propagation,QuadraticMesh"
@ -213,7 +213,7 @@
</algorithm> </algorithm>
<algorithm type="CompositeSegment_1D" <algorithm type="CompositeSegment_1D"
label-id="Composite side discretisation" label-id="Composite Side Discretisation"
icon-id="mesh_algo_regular.png" icon-id="mesh_algo_regular.png"
hypos="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D" hypos="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
opt-hypos="Propagation,QuadraticMesh" opt-hypos="Propagation,QuadraticMesh"
@ -304,7 +304,7 @@
dim="2"> dim="2">
<python-wrap> <python-wrap>
<algo>Projection_2D=Projection2D()</algo> <algo>Projection_2D=Projection2D()</algo>
<hypo>ProjectionSource2D=SourceFace(SetSourceFace(),SetSourceMesh(),SetVertexAssociation(1),SetVertexAssociation(2),SetVertexAssociation(3),SetVertexAssociation(4))</hypo> <hypo>ProjectionSource2D=SourceFace(SetSourceFace(),SetSourceMesh(),SetVertexAssociation(1),SetVertexAssociation(3),SetVertexAssociation(2),SetVertexAssociation(4))</hypo>
</python-wrap> </python-wrap>
</algorithm> </algorithm>
@ -329,12 +329,12 @@
dim="3"> dim="3">
<python-wrap> <python-wrap>
<algo>Projection_3D=Projection3D()</algo> <algo>Projection_3D=Projection3D()</algo>
<hypo>ProjectionSource3D=SourceShape3D(SetSource3DShape(),SetSourceMesh(),SetVertexAssociation(1),SetVertexAssociation(2),SetVertexAssociation(3),SetVertexAssociation(4))</hypo> <hypo>ProjectionSource3D=SourceShape3D(SetSource3DShape(),SetSourceMesh(),SetVertexAssociation(1),SetVertexAssociation(3),SetVertexAssociation(2),SetVertexAssociation(4))</hypo>
</python-wrap> </python-wrap>
</algorithm> </algorithm>
<algorithm type="Import_1D" <algorithm type="Import_1D"
label-id="Use existing 1D elements" label-id="Use Existing 1D Elements"
icon-id="mesh_algo_regular.png" icon-id="mesh_algo_regular.png"
hypos="ImportSource1D" hypos="ImportSource1D"
output="EDGE" output="EDGE"
@ -346,7 +346,7 @@
</algorithm> </algorithm>
<algorithm type="Import_1D2D" <algorithm type="Import_1D2D"
label-id="Use existing 2D elements" label-id="Use Existing 2D Elements"
icon-id="mesh_algo_quad.png" icon-id="mesh_algo_quad.png"
hypos="ImportSource2D" hypos="ImportSource2D"
output="QUAD,TRIA" output="QUAD,TRIA"
@ -359,7 +359,7 @@
</algorithm> </algorithm>
<algorithm type="Prism_3D" <algorithm type="Prism_3D"
label-id="3D extrusion" label-id="3D Extrusion"
icon-id="mesh_algo_hexa.png" icon-id="mesh_algo_hexa.png"
input="QUAD,TRIA" input="QUAD,TRIA"
dim="3"> dim="3">
@ -381,7 +381,7 @@
</algorithm> </algorithm>
<algorithm type="UseExisting_1D" <algorithm type="UseExisting_1D"
label-id="Use existing edges" label-id="Use Existing Edges"
icon-id="mesh_algo_regular.png" icon-id="mesh_algo_regular.png"
input="VERTEX" input="VERTEX"
output="EDGE" output="EDGE"
@ -392,7 +392,7 @@
</algorithm> </algorithm>
<algorithm type="UseExisting_2D" <algorithm type="UseExisting_2D"
label-id="Use existing faces" label-id="Use Existing Faces"
icon-id="mesh_algo_quad.png" icon-id="mesh_algo_quad.png"
input="EDGE" input="EDGE"
output="QUAD,TRIA" output="QUAD,TRIA"
@ -403,7 +403,7 @@
</algorithm> </algorithm>
<algorithm type="RadialQuadrangle_1D2D" <algorithm type="RadialQuadrangle_1D2D"
label-id="Radial quadrangle 1D2D" label-id="Radial Quadrangle 1D2D"
icon-id="mesh_algo_quad.png" icon-id="mesh_algo_quad.png"
hypos="NumberOfLayers2D, LayerDistribution2D" hypos="NumberOfLayers2D, LayerDistribution2D"
input="EDGE" input="EDGE"

View File

@ -2737,30 +2737,37 @@ void CoplanarFaces::SetMesh( const SMDS_Mesh* theMesh )
return; return;
const double radianTol = myToler * M_PI / 180.; const double radianTol = myToler * M_PI / 180.;
typedef SMDS_StdIterator< const SMDS_MeshElement*, SMDS_ElemIteratorPtr > TFaceIt; std::set< SMESH_TLink > checkedLinks;
std::set<const SMDS_MeshElement*> checkedFaces, checkedNodes;
std::list<const SMDS_MeshElement*> faceQueue( 1, face ); std::list< pair< const SMDS_MeshElement*, gp_Vec > > faceQueue;
faceQueue.push_back( make_pair( face, myNorm ));
while ( !faceQueue.empty() ) while ( !faceQueue.empty() )
{ {
face = faceQueue.front(); face = faceQueue.front().first;
if ( checkedFaces.insert( face ).second ) myNorm = faceQueue.front().second;
faceQueue.pop_front();
for ( int i = 0, nbN = face->NbCornerNodes(); i < nbN; ++i )
{ {
gp_Vec norm = getNormale( static_cast<const SMDS_MeshFace*>(face), &normOK ); const SMDS_MeshNode* n1 = face->GetNode( i );
if (!normOK || myNorm.Angle( norm ) <= radianTol) const SMDS_MeshNode* n2 = face->GetNode(( i+1 )%nbN);
if ( !checkedLinks.insert( SMESH_TLink( n1, n2 )).second )
continue;
SMDS_ElemIteratorPtr fIt = n1->GetInverseElementIterator(SMDSAbs_Face);
while ( fIt->more() )
{ {
myCoplanarIDs.insert( face->GetID() ); const SMDS_MeshElement* f = fIt->next();
std::set<const SMDS_MeshElement*> neighborFaces; if ( f->GetNodeIndex( n2 ) > -1 )
for ( int i = 0; i < face->NbCornerNodes(); ++i )
{ {
const SMDS_MeshNode* n = face->GetNode( i ); gp_Vec norm = getNormale( static_cast<const SMDS_MeshFace*>(f), &normOK );
if ( checkedNodes.insert( n ).second ) if (!normOK || myNorm.Angle( norm ) <= radianTol)
neighborFaces.insert( TFaceIt( n->GetInverseElementIterator(SMDSAbs_Face)), {
TFaceIt()); myCoplanarIDs.insert( f->GetID() );
faceQueue.push_back( make_pair( f, norm ));
}
} }
faceQueue.insert( faceQueue.end(), neighborFaces.begin(), neighborFaces.end() );
} }
} }
faceQueue.pop_front();
} }
} }
} }
@ -2770,7 +2777,7 @@ bool CoplanarFaces::IsSatisfy( long theElementId )
} }
/* /*
*Class : RangeOfIds *Class : RangeOfIds
*Description : Predicate for Range of Ids. *Description : Predicate for Range of Ids.
* Range may be specified with two ways. * Range may be specified with two ways.
* 1. Using AddToRange method * 1. Using AddToRange method

View File

@ -26,13 +26,16 @@
// //
#include "Driver_Mesh.h" #include "Driver_Mesh.h"
#include "SMESH_Comment.hxx"
#include <utilities.h> #include <utilities.h>
using namespace std; using namespace std;
Driver_Mesh::Driver_Mesh(): Driver_Mesh::Driver_Mesh():
myFile(""), myFile(""),
myMeshId(-1) myMeshId(-1),
myStatus( DRS_OK )
{} {}
@ -78,5 +81,23 @@ Driver_Mesh::Status Driver_Mesh::addMessage(const std::string& msg,
#ifdef _DEBUG_ #ifdef _DEBUG_
cout << msg << endl; cout << msg << endl;
#endif #endif
return isFatal ? DRS_FAIL : DRS_WARN_SKIP_ELEM; return ( myStatus = isFatal ? DRS_FAIL : DRS_WARN_SKIP_ELEM );
}
//================================================================================
/*!
* \brief Return a structure containing description of errors
*/
//================================================================================
SMESH_ComputeErrorPtr Driver_Mesh::GetError()
{
SMESH_Comment msg;
for ( size_t i = 0; i < myErrorMessages.size(); ++i )
{
msg << myErrorMessages[i];
if ( i+1 < myErrorMessages.size() )
msg << "\n";
}
return SMESH_ComputeError::New( myStatus == DRS_OK ? int(COMPERR_OK) : int(myStatus), msg );
} }

View File

@ -27,6 +27,8 @@
#ifndef _INCLUDE_DRIVER_MESH #ifndef _INCLUDE_DRIVER_MESH
#define _INCLUDE_DRIVER_MESH #define _INCLUDE_DRIVER_MESH
#include "SMESH_ComputeError.hxx"
#include <string> #include <string>
#include <vector> #include <vector>
@ -55,19 +57,26 @@ class MESHDRIVER_EXPORT Driver_Mesh
DRS_FAIL // general failure (exception etc.) DRS_FAIL // general failure (exception etc.)
}; };
virtual Status Perform() = 0; void SetMeshId(int theMeshId);
void SetMeshId(int theMeshId); void SetFile(const std::string& theFileName);
void SetFile(const std::string& theFileName); virtual void SetMeshName(const std::string& theMeshName);
virtual void SetMeshName(const std::string& theMeshName);
virtual std::string GetMeshName() const; virtual std::string GetMeshName() const;
virtual void SetOption(const std::string& optionName,
const std::string& optionValue) {}
virtual Status Perform() = 0;
virtual SMESH_ComputeErrorPtr GetError();
protected: protected:
std::string myFile; std::string myFile;
std::string myMeshName; std::string myMeshName;
int myMeshId; int myMeshId;
Status addMessage(const std::string& msg, const bool isFatal=false); Status addMessage(const std::string& msg, const bool isFatal=false);
std::vector< std::string > myErrorMessages; std::vector< std::string > myErrorMessages;
Status myStatus;
}; };
#endif #endif

View File

@ -44,8 +44,10 @@ dist_libMeshDriver_la_SOURCES = \
# additionnal information to compil and link file # additionnal information to compil and link file
libMeshDriver_la_CPPFLAGS = \ libMeshDriver_la_CPPFLAGS = \
$(BOOST_CPPFLAGS) \
$(CAS_CPPFLAGS) \ $(CAS_CPPFLAGS) \
$(KERNEL_CXXFLAGS) \ $(KERNEL_CXXFLAGS) \
-I$(srcdir)/../SMESHUtils \
-I$(srcdir)/../SMESHDS -I$(srcdir)/../SMESHDS
libMeshDriver_la_LDFLAGS = \ libMeshDriver_la_LDFLAGS = \

View File

@ -139,7 +139,7 @@ namespace
} }
{ {
static int ids[] = { 0,3,2,1,4,7,6,5,11,10,9,8,12,15,14,13,19,18,17,16, static int ids[] = { 0,3,2,1,4,7,6,5,11,10,9,8,12,15,14,13,19,18,17,16,
20, 24,23,22,21, 25}; 20, 24,23,22,21, 25, 26};
interlaces[SMDSEntity_TriQuad_Hexa] = ids; interlaces[SMDSEntity_TriQuad_Hexa] = ids;
cgTypes [SMDSEntity_TriQuad_Hexa] = CGNS_ENUMV( HEXA_27 ); cgTypes [SMDSEntity_TriQuad_Hexa] = CGNS_ENUMV( HEXA_27 );
} }

View File

@ -52,6 +52,7 @@ libMeshDriverDAT_la_CPPFLAGS = \
$(BOOST_CPPFLAGS) \ $(BOOST_CPPFLAGS) \
-I$(srcdir)/../Driver \ -I$(srcdir)/../Driver \
-I$(srcdir)/../SMDS \ -I$(srcdir)/../SMDS \
-I$(srcdir)/../SMESHUtils \
-I$(srcdir)/../SMESHDS -I$(srcdir)/../SMESHDS
libMeshDriverDAT_la_LDFLAGS = \ libMeshDriverDAT_la_LDFLAGS = \

View File

@ -0,0 +1,357 @@
// 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, Read 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_Read.cxx
// Created : Mon Sep 17 17:03:02 2012
// Author : Edward AGAPOV (eap)
#include "DriverGMF_Read.hxx"
#include "DriverGMF_Write.hxx"
#include "SMESHDS_Group.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESH_Comment.hxx"
extern "C"
{
#include "libmesh5.h"
}
#include <stdarg.h>
// --------------------------------------------------------------------------------
// Closing GMF mesh at destruction
DriverGMF_MeshCloser::~DriverGMF_MeshCloser()
{
if ( _gmfMeshID )
GmfCloseMesh( _gmfMeshID );
}
// --------------------------------------------------------------------------------
DriverGMF_Read::DriverGMF_Read():
Driver_SMESHDS_Mesh()
{
}
// --------------------------------------------------------------------------------
DriverGMF_Read::~DriverGMF_Read()
{
}
//================================================================================
/*!
* \brief Read a GMF file
*/
//================================================================================
Driver_Mesh::Status DriverGMF_Read::Perform()
{
Status status = DRS_OK;
int dim, version;
// open the file
int meshID = GmfOpenMesh( myFile.c_str(), GmfRead, &version, &dim );
if ( !meshID )
return addMessage( SMESH_Comment("Can't open for reading ") << myFile, /*fatal=*/true );
DriverGMF_MeshCloser aMeshCloser( meshID ); // An object closing GMF mesh at destruction
// Read nodes
int nbNodes = GmfStatKwd(meshID, GmfVertices);
if ( nbNodes < 1 )
return addMessage( "No nodes in the mesh", /*fatal=*/true );
GmfGotoKwd(meshID, GmfVertices);
int ref;
const int nodeIDShift = myMesh->GetMeshInfo().NbNodes();
if ( version != GmfFloat )
{
double x, y, z;
for ( int i = 1; i <= nbNodes; ++i )
{
GmfGetLin(meshID, GmfVertices, &x, &y, &z, &ref);
myMesh->AddNodeWithID( x,y,z, nodeIDShift + i);
}
}
else
{
float x, y, z;
for ( int i = 1; i <= nbNodes; ++i )
{
GmfGetLin(meshID, GmfVertices, &x, &y, &z, &ref);
myMesh->AddNodeWithID( x,y,z, nodeIDShift + i);
}
}
// Read elements
int iN[28];
/* Read edges */
const int edgeIDShift = myMesh->GetMeshInfo().NbElements();
if ( int nbEdges = GmfStatKwd(meshID, GmfEdges))
{
GmfGotoKwd(meshID, GmfEdges);
for ( int i = 1; i <= nbEdges; ++i )
{
GmfGetLin(meshID, GmfEdges, &iN[0], &iN[1], &ref);
if ( !myMesh->AddEdgeWithID( iN[0], iN[1], edgeIDShift + i ))
status = storeBadNodeIds( "GmfEdges",i, 2, iN[0], iN[1] );
}
}
/* Read quadratic edges */
const int edge2IDShift = myMesh->GetMeshInfo().NbElements();
if ( int nbEdges = GmfStatKwd(meshID, GmfEdgesP2))
{
GmfGotoKwd(meshID, GmfEdgesP2);
for ( int i = 1; i <= nbEdges; ++i )
{
GmfGetLin(meshID, GmfEdgesP2, &iN[0], &iN[1], &iN[2], &ref);
if ( !myMesh->AddEdgeWithID( iN[0], iN[1], iN[2], edge2IDShift + i ))
status = storeBadNodeIds( "GmfEdgesP2",i, 3, iN[0], iN[1], iN[2] );
}
}
/* Read triangles */
const int triaIDShift = myMesh->GetMeshInfo().NbElements();
if ( int nbTria = GmfStatKwd(meshID, GmfTriangles))
{
GmfGotoKwd(meshID, GmfTriangles);
for ( int i = 1; i <= nbTria; ++i )
{
GmfGetLin(meshID, GmfTriangles, &iN[0], &iN[1], &iN[2], &ref);
if ( !myMesh->AddFaceWithID( iN[0], iN[1], iN[2], triaIDShift + i ))
status = storeBadNodeIds( "GmfTriangles",i, 3, iN[0], iN[1], iN[2] );
}
}
/* Read quadratic triangles */
const int tria2IDShift = myMesh->GetMeshInfo().NbElements();
if ( int nbTria = GmfStatKwd(meshID, GmfTrianglesP2))
{
GmfGotoKwd(meshID, GmfTrianglesP2);
for ( int i = 1; i <= nbTria; ++i )
{
GmfGetLin(meshID, GmfTrianglesP2,
&iN[0], &iN[1], &iN[2], &iN[3], &iN[4], &iN[5], &ref);
if ( !myMesh->AddFaceWithID( iN[0],iN[1],iN[2],iN[3],iN[4],iN[5],
tria2IDShift + i ))
status = storeBadNodeIds( "GmfTrianglesP2",i, 6, iN[0],iN[1],iN[2],iN[3],iN[4],iN[5] );
}
}
/* Read quadrangles */
const int quadIDShift = myMesh->GetMeshInfo().NbElements();
if ( int nbQuad = GmfStatKwd(meshID, GmfQuadrilaterals))
{
GmfGotoKwd(meshID, GmfQuadrilaterals);
for ( int i = 1; i <= nbQuad; ++i )
{
GmfGetLin(meshID, GmfQuadrilaterals, &iN[0], &iN[1], &iN[2], &iN[3], &ref);
if ( !myMesh->AddFaceWithID( iN[0], iN[1], iN[2], iN[3], quadIDShift + i ))
status = storeBadNodeIds( "GmfQuadrilaterals",i, 4, iN[0], iN[1],iN[2], iN[3] );
}
}
/* Read bi-quadratic quadrangles */
const int quad2IDShift = myMesh->GetMeshInfo().NbElements();
if ( int nbQuad = GmfStatKwd(meshID, GmfQuadrilateralsQ2))
{
GmfGotoKwd(meshID, GmfQuadrilateralsQ2);
for ( int i = 1; i <= nbQuad; ++i )
{
GmfGetLin(meshID, GmfQuadrilateralsQ2,
&iN[0], &iN[1], &iN[2], &iN[3], &iN[4], &iN[5], &iN[6], &iN[7], &iN[8], &ref);
if ( !myMesh->AddFaceWithID( iN[0],iN[1],iN[2],iN[3],iN[4],iN[5],iN[6],iN[7],iN[8],
quad2IDShift + i ))
status = storeBadNodeIds( "GmfQuadrilateralsQ2",i,
9, iN[0],iN[1],iN[2],iN[3],iN[4],iN[5],iN[6],iN[7],iN[8] );
}
}
/* Read terahedra */
const int tetIDShift = myMesh->GetMeshInfo().NbElements();
if ( int nbTet = GmfStatKwd(meshID, GmfTetrahedra))
{
GmfGotoKwd(meshID, GmfTetrahedra);
for ( int i = 1; i <= nbTet; ++i )
{
GmfGetLin(meshID, GmfTetrahedra, &iN[0], &iN[1], &iN[2], &iN[3], &ref);
if ( !myMesh->AddVolumeWithID( iN[0], iN[2], iN[1], iN[3], tetIDShift + i ))
status = storeBadNodeIds( "GmfTetrahedra",i, 4, iN[0], iN[1],iN[2], iN[3] );
}
}
/* Read quadratic terahedra */
const int tet2IDShift = myMesh->GetMeshInfo().NbElements();
if ( int nbTet = GmfStatKwd(meshID, GmfTetrahedraP2))
{
GmfGotoKwd(meshID, GmfTetrahedraP2);
for ( int i = 1; i <= nbTet; ++i )
{
GmfGetLin(meshID, GmfTetrahedraP2, &iN[0], &iN[1], &iN[2],
&iN[3], &iN[4], &iN[5], &iN[6], &iN[7], &iN[8], &iN[9], &ref);
if ( !myMesh->AddVolumeWithID( iN[0],iN[2],iN[1],iN[3],
iN[6],iN[5],iN[4],
iN[7],iN[9],iN[8], tet2IDShift + i ))
status = storeBadNodeIds( "GmfTetrahedraP2",i, 10, iN[0],iN[1],iN[2],iN[3],
iN[4],iN[5],iN[6],iN[7],iN[8],iN[9] );
}
}
/* Read pyramids */
const int pyrIDShift = myMesh->GetMeshInfo().NbElements();
if ( int nbPyr = GmfStatKwd(meshID, GmfPyramids))
{
GmfGotoKwd(meshID, GmfPyramids);
for ( int i = 1; i <= nbPyr; ++i )
{
GmfGetLin(meshID, GmfPyramids, &iN[0], &iN[1], &iN[2], &iN[3], &iN[4], &ref);
if ( !myMesh->AddVolumeWithID( iN[0], iN[2], iN[1], iN[3], iN[4], pyrIDShift + i ))
status = storeBadNodeIds( "GmfPyramids",i, 5, iN[0], iN[1],iN[2], iN[3], iN[4] );
}
}
/* Read hexahedra */
const int hexIDShift = myMesh->GetMeshInfo().NbElements();
if ( int nbHex = GmfStatKwd(meshID, GmfHexahedra))
{
GmfGotoKwd(meshID, GmfHexahedra);
for ( int i = 1; i <= nbHex; ++i )
{
GmfGetLin(meshID, GmfHexahedra,
&iN[0], &iN[1], &iN[2], &iN[3], &iN[4], &iN[5], &iN[6], &iN[7], &ref);
if ( !myMesh->AddVolumeWithID( iN[0], iN[3], iN[2], iN[1], iN[4], iN[7], iN[6], iN[5],
hexIDShift + i))
status = storeBadNodeIds( "GmfHexahedra",i,
8, iN[0], iN[1],iN[2], iN[3], iN[4], iN[7], iN[6], iN[5] );
}
}
/* Read tri-quadratic hexahedra */
const int hex2IDShift = myMesh->GetMeshInfo().NbElements();
if ( int nbHex = GmfStatKwd(meshID, GmfHexahedraQ2))
{
GmfGotoKwd(meshID, GmfHexahedraQ2);
for ( int i = 1; i <= nbHex; ++i )
{
GmfGetLin(meshID, GmfHexahedraQ2, &iN[0], &iN[1], &iN[2], &iN[3], &iN[4], &iN[5],
&iN[6], &iN[7], &iN[8],&iN[9],&iN[10],&iN[11],&iN[12],&iN[13],&iN[14],
&iN[15],&iN[16],&iN[17],&iN[18],&iN[19],&iN[20],&iN[21],&iN[22],&iN[23],
&iN[24],&iN[25],&iN[26], &ref);
if ( !myMesh->AddVolumeWithID( iN[0],iN[3],iN[2],iN[1],iN[4],iN[7],iN[6],iN[5],iN[11],iN[10],
iN[9],iN[8],iN[12],iN[15],iN[14], iN[13],iN[19],iN[18],iN[17],
iN[16],iN[20],iN[24],iN[23],iN[22],iN[21], iN[25],iN[26],
hex2IDShift + i ))
status = storeBadNodeIds( "GmfHexahedraQ2",i, 27,
iN[0],iN[3],iN[2],iN[1],iN[4], iN[7],iN[6],iN[5],iN[11],iN[10],
iN[9],iN[8],iN[12],iN[15],iN[14], iN[13],iN[19],iN[18],iN[17],
iN[16],iN[20],iN[24],iN[23],iN[22],iN[21], iN[25],iN[26]);
}
}
/* Read prism */
const int prismIDShift = myMesh->GetMeshInfo().NbElements();
if ( int nbPrism = GmfStatKwd(meshID, GmfPrisms))
{
GmfGotoKwd(meshID, GmfPrisms);
for ( int i = 1; i <= nbPrism; ++i )
{
GmfGetLin(meshID, GmfPrisms,
&iN[0], &iN[1], &iN[2], &iN[3], &iN[4], &iN[5], &ref);
if ( !myMesh->AddVolumeWithID( iN[0], iN[2], iN[1], iN[3], iN[5], iN[4], prismIDShift + i))
status = storeBadNodeIds( "GmfPrisms",i,
6, iN[0], iN[1],iN[2], iN[3], iN[4], iN[5] );
}
}
// Read required entities into groups
// get ids of existing groups
std::set< int > groupIDs;
const std::set<SMESHDS_GroupBase*>& groups = myMesh->GetGroups();
std::set<SMESHDS_GroupBase*>::const_iterator grIter = groups.begin();
for ( ; grIter != groups.end(); ++grIter )
groupIDs.insert( (*grIter)->GetID() );
if ( groupIDs.empty() ) groupIDs.insert( 0 );
const int kes[4][3] = { { GmfRequiredVertices, SMDSAbs_Node, nodeIDShift },
{ GmfRequiredEdges, SMDSAbs_Edge, edgeIDShift },
{ GmfRequiredTriangles, SMDSAbs_Face, triaIDShift },
{ GmfRequiredQuadrilaterals,SMDSAbs_Face, quadIDShift }};
const char* names[4] = { "_required_Vertices" ,
"_required_Edges" ,
"_required_Triangles" ,
"_required_Quadrilaterals" };
for ( int i = 0; i < 4; ++i )
{
int gmfKwd = kes[i][0];
SMDSAbs_ElementType entity = (SMDSAbs_ElementType) kes[i][1];
int shift = kes[i][2];
if ( int nb = GmfStatKwd(meshID, gmfKwd))
{
const int newID = *groupIDs.rbegin() + 1;
groupIDs.insert( newID );
SMESHDS_Group* group = new SMESHDS_Group( newID, myMesh, entity );
group->SetStoreName( names[i] );
myMesh->AddGroup( group );
GmfGotoKwd(meshID, gmfKwd);
for ( int i = 0; i < nb; ++i )
{
GmfGetLin(meshID, gmfKwd, &iN[0] );
group->Add( shift + iN[0] );
}
}
}
return status;
}
//================================================================================
/*!
* \brief Store a message about invalid IDs of nodes
*/
//================================================================================
Driver_Mesh::Status DriverGMF_Read::storeBadNodeIds(const char* gmfKwd, int elemNb, int nb, ...)
{
if ( myStatus != DRS_OK )
return myStatus;
SMESH_Comment msg;
va_list VarArg;
va_start(VarArg, nb);
for ( int i = 0; i < nb; ++i )
{
int id = va_arg(VarArg, int );
if ( !myMesh->FindNode( id ))
msg << " " << id;
}
va_end(VarArg);
if ( !msg.empty() )
{
std::string nbStr;
const char* nbNames[] = { "1-st ", "2-nd ", "3-d " };
if ( elemNb < 3 ) nbStr = nbNames[ elemNb-1 ];
else nbStr = SMESH_Comment(elemNb) << "-th ";
return addMessage
( SMESH_Comment("Wrong node IDs of ")<< nbStr << gmfKwd << ":" << msg,
/*fatal=*/false );
}
return DRS_OK;
}

View File

@ -14,32 +14,44 @@
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, Read to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : DriverGMF_Read.hxx
// Created : Mon Sep 17 15:36:47 2012
// Author : Edward AGAPOV (eap)
// SMESH SMESH : implementaion of SMESH idl descriptions
// File : SMESH_3D_Algo.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#ifndef _SMESH_3D_ALGO_HXX_
#define _SMESH_3D_ALGO_HXX_
#include "SMESH_SMESH.hxx" #ifndef __DriverGMF_Read_HXX__
#define __DriverGMF_Read_HXX__
#include "SMESH_Algo.hxx" #include "SMESH_DriverGMF.hxx"
class SMESH_EXPORT SMESH_3D_Algo: #include "Driver_SMESHDS_Mesh.h"
public SMESH_Algo
#include <vector>
#include <string>
/*!
* \brief Driver reading a mesh from the GMF file. The mesh to read is selected by
* an index (counted form 0) set via SetMeshId()
*/
class MESHDriverGMF_EXPORT DriverGMF_Read : public Driver_SMESHDS_Mesh
{ {
public: public:
SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen);
virtual ~SMESH_3D_Algo(); DriverGMF_Read();
~DriverGMF_Read();
virtual Status Perform();
private:
Status storeBadNodeIds(const char* gmfKwd, int elemNb, int nb, ...);
}; };
#endif #endif

View File

@ -0,0 +1,317 @@
// 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_Write.cxx
// Created : Mon Sep 17 17:03:02 2012
// Author : Edward AGAPOV (eap)
#include "DriverGMF_Write.hxx"
#include "SMESHDS_GroupBase.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESH_Comment.hxx"
extern "C"
{
#include "libmesh5.h"
}
#include <vector>
#define BEGIN_ELEM_WRITE( SMDSEntity, GmfKwd, elem ) \
elemIt = myMesh->elementEntityIterator( SMDSEntity ); \
if ( elemIt->more() ) \
{ \
GmfSetKwd(meshID, GmfKwd, myMesh->GetMeshInfo().NbEntities( SMDSEntity )); \
for ( int gmfID = 1; elemIt->more(); ++gmfID ) \
{ \
const SMDS_MeshElement* elem = elemIt->next(); \
GmfSetLin(meshID, GmfKwd,
#define END_ELEM_WRITE( elem ) \
elem->getshapeId() ); \
}} \
#define END_ELEM_WRITE_ADD_TO_MAP( elem, e2id ) \
elem->getshapeId() ); \
e2id.insert( e2id.end(), make_pair( elem, gmfID )); \
}} \
DriverGMF_Write::DriverGMF_Write():
Driver_SMESHDS_Mesh()
{
}
DriverGMF_Write::~DriverGMF_Write()
{
}
Driver_Mesh::Status DriverGMF_Write::Perform()
{
const int dim = 3, version = 3;
int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim );
if ( !meshID )
return addMessage( SMESH_Comment("Can't open for writing ") << myFile, /*fatal=*/true );
DriverGMF_MeshCloser aMeshCloser( meshID ); // An object closing GMF mesh at destruction
// nodes
std::map< const SMDS_MeshNode* , int > node2IdMap;
int iN = 0, nbNodes = myMesh->NbNodes();
GmfSetKwd( meshID, GmfVertices, nbNodes );
double xyz[3];
SMDS_NodeIteratorPtr nodeIt = myMesh->nodesIterator();
while ( nodeIt->more() )
{
const SMDS_MeshNode* n = nodeIt->next();
n->GetXYZ( xyz );
GmfSetLin( meshID, GmfVertices, xyz[0], xyz[1], xyz[2], n->getshapeId() );
node2IdMap.insert( node2IdMap.end(), make_pair( n, ++iN ));
}
if ( iN != nbNodes )
return addMessage("Wrong nb of nodes returned by nodesIterator", /*fatal=*/true);
SMDS_ElemIteratorPtr elemIt;
typedef std::map< const SMDS_MeshElement*, size_t, TIDCompare > TElem2IDMap;
// edges
TElem2IDMap edge2IDMap;
BEGIN_ELEM_WRITE( SMDSEntity_Edge, GmfEdges, edge )
node2IdMap[ edge->GetNode( 0 )],
node2IdMap[ edge->GetNode( 1 )],
END_ELEM_WRITE_ADD_TO_MAP( edge, edge2IDMap );
// quadratic edges
BEGIN_ELEM_WRITE( SMDSEntity_Quad_Edge, GmfEdgesP2, edge )
node2IdMap[ edge->GetNode( 0 )],
node2IdMap[ edge->GetNode( 1 )],
node2IdMap[ edge->GetNode( 2 )],
END_ELEM_WRITE( edge );
// triangles
TElem2IDMap tria2IDMap;
BEGIN_ELEM_WRITE( SMDSEntity_Triangle, GmfTriangles, tria )
node2IdMap[ tria->GetNode( 0 )],
node2IdMap[ tria->GetNode( 1 )],
node2IdMap[ tria->GetNode( 2 )],
END_ELEM_WRITE_ADD_TO_MAP( tria, tria2IDMap );
// quadratic triangles
BEGIN_ELEM_WRITE( SMDSEntity_Quad_Triangle, GmfTrianglesP2, tria )
node2IdMap[ tria->GetNode( 0 )],
node2IdMap[ tria->GetNode( 1 )],
node2IdMap[ tria->GetNode( 2 )],
node2IdMap[ tria->GetNode( 3 )],
node2IdMap[ tria->GetNode( 4 )],
node2IdMap[ tria->GetNode( 5 )],
END_ELEM_WRITE( tria );
// quadrangles
TElem2IDMap quad2IDMap;
BEGIN_ELEM_WRITE( SMDSEntity_Quadrangle, GmfQuadrilaterals, quad )
node2IdMap[ quad->GetNode( 0 )],
node2IdMap[ quad->GetNode( 1 )],
node2IdMap[ quad->GetNode( 2 )],
node2IdMap[ quad->GetNode( 3 )],
END_ELEM_WRITE_ADD_TO_MAP( quad, quad2IDMap );
// bi-quadratic quadrangles
BEGIN_ELEM_WRITE( SMDSEntity_BiQuad_Quadrangle, GmfQuadrilateralsQ2, quad )
node2IdMap[ quad->GetNode( 0 )],
node2IdMap[ quad->GetNode( 3 )],
node2IdMap[ quad->GetNode( 2 )],
node2IdMap[ quad->GetNode( 1 )],
node2IdMap[ quad->GetNode( 7 )],
node2IdMap[ quad->GetNode( 6 )],
node2IdMap[ quad->GetNode( 5 )],
node2IdMap[ quad->GetNode( 4 )],
node2IdMap[ quad->GetNode( 8 )],
END_ELEM_WRITE( quad );
// terahedra
BEGIN_ELEM_WRITE( SMDSEntity_Tetra, GmfTetrahedra, tetra )
node2IdMap[ tetra->GetNode( 0 )],
node2IdMap[ tetra->GetNode( 2 )],
node2IdMap[ tetra->GetNode( 1 )],
node2IdMap[ tetra->GetNode( 3 )],
END_ELEM_WRITE( tetra );
// quadratic terahedra
BEGIN_ELEM_WRITE( SMDSEntity_Quad_Tetra, GmfTetrahedraP2, tetra )
node2IdMap[ tetra->GetNode( 0 )],
node2IdMap[ tetra->GetNode( 2 )],
node2IdMap[ tetra->GetNode( 1 )],
node2IdMap[ tetra->GetNode( 3 )],
node2IdMap[ tetra->GetNode( 6 )],
node2IdMap[ tetra->GetNode( 5 )],
node2IdMap[ tetra->GetNode( 4 )],
node2IdMap[ tetra->GetNode( 7 )],
node2IdMap[ tetra->GetNode( 9 )],
node2IdMap[ tetra->GetNode( 8 )],
END_ELEM_WRITE( tetra );
// pyramids
BEGIN_ELEM_WRITE( SMDSEntity_Pyramid, GmfPyramids, pyra )
node2IdMap[ pyra->GetNode( 0 )],
node2IdMap[ pyra->GetNode( 2 )],
node2IdMap[ pyra->GetNode( 1 )],
node2IdMap[ pyra->GetNode( 3 )],
node2IdMap[ pyra->GetNode( 4 )],
END_ELEM_WRITE( pyra );
// hexahedra
BEGIN_ELEM_WRITE( SMDSEntity_Hexa, GmfHexahedra, hexa )
node2IdMap[ hexa->GetNode( 0 )],
node2IdMap[ hexa->GetNode( 3 )],
node2IdMap[ hexa->GetNode( 2 )],
node2IdMap[ hexa->GetNode( 1 )],
node2IdMap[ hexa->GetNode( 4 )],
node2IdMap[ hexa->GetNode( 7 )],
node2IdMap[ hexa->GetNode( 6 )],
node2IdMap[ hexa->GetNode( 5 )],
END_ELEM_WRITE( hexa );
// tri-quadratic hexahedra
BEGIN_ELEM_WRITE( SMDSEntity_TriQuad_Hexa, GmfHexahedraQ2, hexa )
node2IdMap[ hexa->GetNode( 0 )],
node2IdMap[ hexa->GetNode( 3 )],
node2IdMap[ hexa->GetNode( 2 )],
node2IdMap[ hexa->GetNode( 1 )],
node2IdMap[ hexa->GetNode( 4 )],
node2IdMap[ hexa->GetNode( 7 )],
node2IdMap[ hexa->GetNode( 6 )],
node2IdMap[ hexa->GetNode( 5 )],
node2IdMap[ hexa->GetNode( 11 )],
node2IdMap[ hexa->GetNode( 10 )],
node2IdMap[ hexa->GetNode( 9 )],
node2IdMap[ hexa->GetNode( 8 )],
node2IdMap[ hexa->GetNode( 12 )],
node2IdMap[ hexa->GetNode( 15 )],
node2IdMap[ hexa->GetNode( 14 )],
node2IdMap[ hexa->GetNode( 13 )],
node2IdMap[ hexa->GetNode( 19 )],
node2IdMap[ hexa->GetNode( 18 )],
node2IdMap[ hexa->GetNode( 17 )],
node2IdMap[ hexa->GetNode( 16 )],
node2IdMap[ hexa->GetNode( 20 )],
node2IdMap[ hexa->GetNode( 24 )],
node2IdMap[ hexa->GetNode( 23 )],
node2IdMap[ hexa->GetNode( 22 )],
node2IdMap[ hexa->GetNode( 21 )],
node2IdMap[ hexa->GetNode( 25 )],
node2IdMap[ hexa->GetNode( 26 )],
END_ELEM_WRITE( hexa );
// prism
BEGIN_ELEM_WRITE( SMDSEntity_Penta, GmfPrisms, prism )
node2IdMap[ prism->GetNode( 0 )],
node2IdMap[ prism->GetNode( 2 )],
node2IdMap[ prism->GetNode( 1 )],
node2IdMap[ prism->GetNode( 3 )],
node2IdMap[ prism->GetNode( 5 )],
node2IdMap[ prism->GetNode( 4 )],
END_ELEM_WRITE( prism );
// required entities
SMESH_Comment badGroups;
const std::set<SMESHDS_GroupBase*>& groupSet = myMesh->GetGroups();
std::set<SMESHDS_GroupBase*>::const_iterator grIt = groupSet.begin();
for ( ; grIt != groupSet.end(); ++grIt )
{
const SMESHDS_GroupBase* group = *grIt;
std::string groupName = group->GetStoreName();
std::string::size_type pos = groupName.find( "_required_" );
if ( pos == std::string::npos ) continue;
int gmfKwd;
SMDSAbs_EntityType smdsEntity;
std::string entity = groupName.substr( pos + strlen("_required_"));
if ( entity == "Vertices" ) {
gmfKwd = GmfRequiredVertices;
smdsEntity = SMDSEntity_Node;
}
else if ( entity == "Edges" ) {
gmfKwd = GmfRequiredEdges;
smdsEntity = SMDSEntity_Edge;
}
else if ( entity == "Triangles" ) {
gmfKwd = GmfRequiredTriangles;
smdsEntity = SMDSEntity_Triangle;
}
else if ( entity == "Quadrilaterals" ) {
gmfKwd = GmfRequiredQuadrilaterals;
smdsEntity = SMDSEntity_Quadrangle;
}
else {
addMessage( SMESH_Comment("Invalig gmf entity name: ") << entity, /*fatal=*/false );
continue;
}
// check elem type in the group
int nbOkElems = 0;
SMDS_ElemIteratorPtr elemIt = group->GetElements();
while ( elemIt->more() )
nbOkElems += ( elemIt->next()->GetEntityType() == smdsEntity );
if ( nbOkElems != group->Extent() && nbOkElems == 0 )
{
badGroups << " " << groupName;
continue;
}
// choose a TElem2IDMap
TElem2IDMap* elem2IDMap = 0;
if ( smdsEntity == SMDSEntity_Quadrangle && nbOkElems != myMesh->NbFaces() )
elem2IDMap = & quad2IDMap;
else if ( smdsEntity == SMDSEntity_Triangle && nbOkElems != myMesh->NbFaces() )
elem2IDMap = & tria2IDMap;
else if ( smdsEntity == SMDSEntity_Edge && nbOkElems != myMesh->NbEdges() )
elem2IDMap = & edge2IDMap;
// write the group
GmfSetKwd( meshID, gmfKwd, nbOkElems );
elemIt = group->GetElements();
if ( elem2IDMap )
for ( ; elemIt->more(); )
{
const SMDS_MeshElement* elem = elemIt->next();
if ( elem->GetEntityType() == smdsEntity )
GmfSetLin( meshID, gmfKwd, (*elem2IDMap)[ elem ] );
}
else
for ( int gmfID = 1; elemIt->more(); ++gmfID)
{
const SMDS_MeshElement* elem = elemIt->next();
if ( elem->GetEntityType() == smdsEntity )
GmfSetLin( meshID, gmfKwd, gmfID );
}
} // loop on groups
if ( !badGroups.empty() )
addMessage( SMESH_Comment("Groups of elements of inappropriate geometry:")
<< badGroups, /*fatal=*/false );
return DRS_OK;
}

View File

@ -19,32 +19,41 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : DriverGMF_Write.hxx
// Created : Mon Sep 17 15:36:47 2012
// Author : Edward AGAPOV (eap)
// SMESH SMESH : implementaion of SMESH idl descriptions
// File : SMESH_2D_Algo.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#ifndef _SMESH_2D_ALGO_HXX_
#define _SMESH_2D_ALGO_HXX_
#include "SMESH_SMESH.hxx" #ifndef __DriverGMF_Write_HXX__
#define __DriverGMF_Write_HXX__
#include "SMESH_Algo.hxx" #include "SMESH_DriverGMF.hxx"
#include "SMESH_subMesh.hxx"
#include "TopoDS_Wire.hxx"
class SMESH_EXPORT SMESH_2D_Algo: #include "Driver_SMESHDS_Mesh.h"
public SMESH_Algo #include "SMDSAbs_ElementType.hxx"
/*!
* \brief Driver Writing a mesh into a GMF file.
*/
class MESHDriverGMF_EXPORT DriverGMF_Write : public Driver_SMESHDS_Mesh
{ {
public: public:
SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen);
virtual ~SMESH_2D_Algo();
int NumberOfWires(const TopoDS_Shape& S); DriverGMF_Write();
int NumberOfPoints(SMESH_Mesh& aMesh,const TopoDS_Wire& W); ~DriverGMF_Write();
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();
};
#endif #endif

50
src/DriverGMF/Makefile.am Normal file
View File

@ -0,0 +1,50 @@
# Copyright (C) 2007-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 $(top_srcdir)/adm_local/unix/make_common_starter.am
# header files
salomeinclude_HEADERS = \
DriverGMF_Read.hxx \
DriverGMF_Write.hxx \
SMESH_DriverGMF.hxx \
libmesh5.h
# Libraries targets
lib_LTLIBRARIES = libMeshDriverGMF.la
dist_libMeshDriverGMF_la_SOURCES = \
DriverGMF_Read.cxx \
DriverGMF_Write.cxx \
libmesh5.c
# additionnal information to compil and link file
libMeshDriverGMF_la_CPPFLAGS = \
$(KERNEL_CXXFLAGS) \
$(CAS_CPPFLAGS) \
$(VTK_INCLUDES) \
$(BOOST_CPPFLAGS) \
-I$(srcdir)/../Driver \
-I$(srcdir)/../SMESHUtils \
-I$(srcdir)/../SMDS \
-I$(srcdir)/../SMESHDS
libMeshDriverGMF_la_LDFLAGS = \
$(BOOST_LIBS) \
../Driver/libMeshDriver.la \
../SMESHUtils/libSMESHUtils.la

View File

@ -20,23 +20,21 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// SMESH SMESH : implementaion of SMESH idl descriptions // File : SMESH_DriverGMF.hxx
// File : SMESH_0D_Algo.hxx // Author : Alexander A. BORODIN
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_0D_ALGO_HXX_ #ifndef _SMESH_DriverGMF_HXX_
#define _SMESH_0D_ALGO_HXX_ #define _SMESH_DriverGMF_HXX_
#include "SMESH_SMESH.hxx" #ifdef WNT
#if defined MESHDriverGMF_EXPORTS || defined MeshDriverGMF_EXPORTS
#include "SMESH_Algo.hxx" #define MESHDriverGMF_EXPORT __declspec( dllexport )
#else
class SMESH_EXPORT SMESH_0D_Algo: public SMESH_Algo #define MESHDriverGMF_EXPORT __declspec( dllimport )
{ #endif
public: #else
SMESH_0D_Algo(int hypId, int studyId, SMESH_Gen* gen); #define MESHDriverGMF_EXPORT
virtual ~SMESH_0D_Algo(); #endif
};
#endif #endif

1346
src/DriverGMF/libmesh5.c Normal file

File diff suppressed because it is too large Load Diff

155
src/DriverGMF/libmesh5.h Normal file
View File

@ -0,0 +1,155 @@
/*----------------------------------------------------------*/
/* */
/* LIBMESH V 5.46 */
/* */
/*----------------------------------------------------------*/
/* */
/* Description: handle .meshb file format I/O */
/* Author: Loic MARECHAL */
/* Creation date: feb 16 2007 */
/* Last modification: dec 09 2011 */
/* */
/*----------------------------------------------------------*/
/*----------------------------------------------------------*/
/* Defines */
/*----------------------------------------------------------*/
#include "SMESH_DriverGMF.hxx"
#define GmfStrSiz 1024
#define GmfMaxTyp 1000
#define GmfMaxKwd 80
#define GmfMshVer 1
#define GmfRead 1
#define GmfWrite 2
#define GmfSca 1
#define GmfVec 2
#define GmfSymMat 3
#define GmfMat 4
#define GmfFloat 1
#define GmfDouble 2
enum GmfKwdCod
{
GmfReserved1, \
GmfVersionFormatted, \
GmfReserved2, \
GmfDimension, \
GmfVertices, \
GmfEdges, \
GmfTriangles, \
GmfQuadrilaterals, \
GmfTetrahedra, \
GmfPrisms, \
GmfHexahedra, \
GmfIterationsAll, \
GmfTimesAll, \
GmfCorners, \
GmfRidges, \
GmfRequiredVertices, \
GmfRequiredEdges, \
GmfRequiredTriangles, \
GmfRequiredQuadrilaterals, \
GmfTangentAtEdgeVertices, \
GmfNormalAtVertices, \
GmfNormalAtTriangleVertices, \
GmfNormalAtQuadrilateralVertices, \
GmfAngleOfCornerBound, \
GmfTrianglesP2, \
GmfEdgesP2, \
GmfSolAtPyramids, \
GmfQuadrilateralsQ2, \
GmfISolAtPyramids, \
GmfSubDomainFromGeom, \
GmfTetrahedraP2, \
GmfFault_NearTri, \
GmfFault_Inter, \
GmfHexahedraQ2, \
GmfExtraVerticesAtEdges, \
GmfExtraVerticesAtTriangles, \
GmfExtraVerticesAtQuadrilaterals, \
GmfExtraVerticesAtTetrahedra, \
GmfExtraVerticesAtPrisms, \
GmfExtraVerticesAtHexahedra, \
GmfVerticesOnGeometricVertices, \
GmfVerticesOnGeometricEdges, \
GmfVerticesOnGeometricTriangles, \
GmfVerticesOnGeometricQuadrilaterals, \
GmfEdgesOnGeometricEdges, \
GmfFault_FreeEdge, \
GmfPolyhedra, \
GmfPolygons, \
GmfFault_Overlap, \
GmfPyramids, \
GmfBoundingBox, \
GmfBody, \
GmfPrivateTable, \
GmfFault_BadShape, \
GmfEnd, \
GmfTrianglesOnGeometricTriangles, \
GmfTrianglesOnGeometricQuadrilaterals, \
GmfQuadrilateralsOnGeometricTriangles, \
GmfQuadrilateralsOnGeometricQuadrilaterals, \
GmfTangents, \
GmfNormals, \
GmfTangentAtVertices, \
GmfSolAtVertices, \
GmfSolAtEdges, \
GmfSolAtTriangles, \
GmfSolAtQuadrilaterals, \
GmfSolAtTetrahedra, \
GmfSolAtPrisms, \
GmfSolAtHexahedra, \
GmfDSolAtVertices, \
GmfISolAtVertices, \
GmfISolAtEdges, \
GmfISolAtTriangles, \
GmfISolAtQuadrilaterals, \
GmfISolAtTetrahedra, \
GmfISolAtPrisms, \
GmfISolAtHexahedra, \
GmfIterations, \
GmfTime, \
GmfFault_SmallTri, \
GmfCoarseHexahedra
};
/*----------------------------------------------------------*/
/* External procedures */
/*----------------------------------------------------------*/
MESHDriverGMF_EXPORT extern int GmfOpenMesh(const char *, int, ...);
MESHDriverGMF_EXPORT extern int GmfCloseMesh(int);
MESHDriverGMF_EXPORT extern int GmfStatKwd(int, int, ...);
MESHDriverGMF_EXPORT extern int GmfGotoKwd(int, int);
MESHDriverGMF_EXPORT extern int GmfSetKwd(int, int, ...);
MESHDriverGMF_EXPORT extern void GmfGetLin(int, int, ...);
MESHDriverGMF_EXPORT extern void GmfSetLin(int, int, ...);
/*----------------------------------------------------------*/
/* Fortran 77 API */
/*----------------------------------------------------------*/
#if defined(F77_NO_UNDER_SCORE)
#define call(x) x
#else
#define call(x) x ## _
#endif
/*----------------------------------------------------------*/
/* Transmesh private API */
/*----------------------------------------------------------*/
#ifdef TRANSMESH
MESHDriverGMF_EXPORT extern char *GmfKwdFmt[ GmfMaxKwd + 1 ][4];
MESHDriverGMF_EXPORT extern int GmfCpyLin(int, int, int);
#endif

View File

@ -205,7 +205,7 @@ DriverMED_R_SMESHDS_Mesh
aNodeIds.resize( aNbBalls ); aNodeIds.resize( aNbBalls );
for(TInt iBall = 0; iBall < aNbBalls && anIsNodeNum; iBall++) for(TInt iBall = 0; iBall < aNbBalls && anIsNodeNum; iBall++)
{ {
aNodeIds[iBall] = aNodeInfo->GetElemNum(iBall); aNodeIds[iBall] = aNodeInfo->GetElemNum( (*aBallInfo->myConn)[ iBall ]-1 );
anIsNodeNum = myMesh->FindNode( aNodeIds[iBall] ) ? eVRAI : eFAUX; anIsNodeNum = myMesh->FindNode( aNodeIds[iBall] ) ? eVRAI : eFAUX;
} }
} }

View File

@ -411,7 +411,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
if (myDoGroupOfFaces && nbFaces) myFacesDefaultFamilyId = REST_FACES_FAMILY; if (myDoGroupOfFaces && nbFaces) myFacesDefaultFamilyId = REST_FACES_FAMILY;
if (myDoGroupOfVolumes && nbVolumes) myVolumesDefaultFamilyId = REST_VOLUMES_FAMILY; if (myDoGroupOfVolumes && nbVolumes) myVolumesDefaultFamilyId = REST_VOLUMES_FAMILY;
if (myDoGroupOf0DElems && nb0DElements) my0DElementsDefaultFamilyId = REST_0DELEM_FAMILY; if (myDoGroupOf0DElems && nb0DElements) my0DElementsDefaultFamilyId = REST_0DELEM_FAMILY;
if (myDoGroupOfVolumes && nbVolumes) myBallsDefaultFamilyId = REST_BALL_FAMILY; if (myDoGroupOfBalls && nbBalls) myBallsDefaultFamilyId = REST_BALL_FAMILY;
MESSAGE("Perform - aFamilyInfo"); MESSAGE("Perform - aFamilyInfo");
//cout << " DriverMED_Family::MakeFamilies() " << endl; //cout << " DriverMED_Family::MakeFamilies() " << endl;

View File

@ -55,6 +55,7 @@ libMeshDriverMED_la_CPPFLAGS = \
$(BOOST_CPPFLAGS) \ $(BOOST_CPPFLAGS) \
-I$(srcdir)/../Driver \ -I$(srcdir)/../Driver \
-I$(srcdir)/../SMDS \ -I$(srcdir)/../SMDS \
-I$(srcdir)/../SMESHUtils \
-I$(srcdir)/../SMESHDS -I$(srcdir)/../SMESHDS
libMeshDriverMED_la_LDFLAGS = \ libMeshDriverMED_la_LDFLAGS = \

View File

@ -67,6 +67,7 @@ libMeshDriverUNV_la_CPPFLAGS = \
$(BOOST_CPPFLAGS) \ $(BOOST_CPPFLAGS) \
-I$(srcdir)/../Driver \ -I$(srcdir)/../Driver \
-I$(srcdir)/../SMDS \ -I$(srcdir)/../SMDS \
-I$(srcdir)/../SMESHUtils \
-I$(srcdir)/../SMESHDS -I$(srcdir)/../SMESHDS
libMeshDriverUNV_la_LDFLAGS = \ libMeshDriverUNV_la_LDFLAGS = \

View File

@ -62,7 +62,7 @@ void UNV164::Write(std::ofstream& out_stream)
EXCEPTION(runtime_error,"ERROR: Output file not good."); EXCEPTION(runtime_error,"ERROR: Output file not good.");
out_stream<<" -1" << endl; out_stream<<" -1" << endl;
out_stream<<" "<<_label_dataset << endl; out_stream<<" "<<_label_dataset << endl;
out_stream<<" 1 SI: Meter (newton) 2" << endl; out_stream<<" 1 SI: Meter (newton) 2" << endl;
out_stream<<" 1.0000000000000000E+0 1.0000000000000000E+0 1.0000000000000000E+0" << endl; out_stream<<" 1.0000000000000000E+0 1.0000000000000000E+0 1.0000000000000000E+0" << endl;

View File

@ -21,7 +21,6 @@
# Author : Patrick GOLDBRONN (CEA) # Author : Patrick GOLDBRONN (CEA)
# Modified by : Alexander BORODIN (OCN) - autotools usage # Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : SMESH # Module : SMESH
# $Header$
# #
include $(top_srcdir)/adm_local/unix/make_common_starter.am include $(top_srcdir)/adm_local/unix/make_common_starter.am
@ -39,6 +38,7 @@ SUBDIRS = \
DriverDAT \ DriverDAT \
DriverUNV \ DriverUNV \
DriverSTL \ DriverSTL \
DriverGMF \
$(DriverCGNS_SUDIR) \ $(DriverCGNS_SUDIR) \
SMESH \ SMESH \
SMESH_I \ SMESH_I \
@ -61,5 +61,6 @@ if SMESH_ENABLE_GUI
endif endif
DIST_SUBDIRS = SMDS SMESHDS Controls Driver DriverMED DriverDAT DriverUNV DriverSTL DriverCGNS \ DIST_SUBDIRS = SMDS SMESHDS Controls Driver DriverMED DriverDAT DriverUNV DriverSTL DriverCGNS \
DriverGMF \
SMESHUtils SMESH SMESH_I SMESHClient SMESH_SWIG MEFISTO2 StdMeshers StdMeshers_I OBJECT \ SMESHUtils SMESH SMESH_I SMESHClient SMESH_SWIG MEFISTO2 StdMeshers StdMeshers_I OBJECT \
SMESHFiltersSelection SMESHGUI PluginUtils SMESH_SWIG_WITHIHM StdMeshersGUI SMESH_PY Tools SMESHFiltersSelection SMESHGUI PluginUtils SMESH_SWIG_WITHIHM StdMeshersGUI SMESH_PY Tools

View File

@ -37,7 +37,9 @@ salomeinclude_HEADERS = \
SMESH_FaceOrientationFilter.h \ SMESH_FaceOrientationFilter.h \
SMESH_ScalarBarActor.h \ SMESH_ScalarBarActor.h \
SMESH_NodeLabelActor.h \ SMESH_NodeLabelActor.h \
SMESH_CellLabelActor.h SMESH_CellLabelActor.h \
SMESH_SVTKActor.h
# Libraries targets # Libraries targets
@ -52,7 +54,8 @@ dist_libSMESHObject_la_SOURCES = \
SMESH_FaceOrientationFilter.cxx \ SMESH_FaceOrientationFilter.cxx \
SMESH_ScalarBarActor.cxx \ SMESH_ScalarBarActor.cxx \
SMESH_NodeLabelActor.cxx \ SMESH_NodeLabelActor.cxx \
SMESH_CellLabelActor.cxx SMESH_CellLabelActor.cxx \
SMESH_SVTKActor.cxx
libSMESHObject_la_CPPFLAGS = \ libSMESHObject_la_CPPFLAGS = \
$(QT_INCLUDES) \ $(QT_INCLUDES) \

View File

@ -37,6 +37,7 @@
#include "VTKViewer_ExtractUnstructuredGrid.h" #include "VTKViewer_ExtractUnstructuredGrid.h"
#include "VTKViewer_FramedTextActor.h" #include "VTKViewer_FramedTextActor.h"
#include "SALOME_InteractiveObject.hxx" #include "SALOME_InteractiveObject.hxx"
#include "SMESH_SVTKActor.h"
#include "SUIT_Session.h" #include "SUIT_Session.h"
#include "SUIT_ResourceMgr.h" #include "SUIT_ResourceMgr.h"
@ -127,6 +128,12 @@ SMESH_ActorDef::SMESH_ActorDef()
myIsPointsVisible = false; myIsPointsVisible = false;
myIsEntityModeCache = false; myIsEntityModeCache = false;
myHighlightActor = SMESH_SVTKActor::New();
myHighlightActor->Initialize();
myPreHighlightActor = SMESH_SVTKActor::New();
myPreHighlightActor->Initialize();
myIsShrinkable = false; myIsShrinkable = false;
myIsShrunk = false; myIsShrunk = false;
@ -141,6 +148,7 @@ SMESH_ActorDef::SMESH_ActorDef()
vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5); vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
vtkFloatingPointType aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10); vtkFloatingPointType aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10);
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1); vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
vtkFloatingPointType aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1);
vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New(); vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
VTKViewer_ExtractUnstructuredGrid* aFilter = NULL; VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
@ -159,6 +167,15 @@ SMESH_ActorDef::SMESH_ActorDef()
bfc = Qtx::mainColorToSecondary(ffc, delta); bfc = Qtx::mainColorToSecondary(ffc, delta);
myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. ); myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
myNormalVProp = vtkProperty::New();
SMESH::GetColor( "SMESH", "volume_color", ffc, delta, "255,0,170|-100" );
myNormalVProp->SetColor( ffc.redF(), ffc.greenF(), ffc.blueF() );
myDeltaVBrightness = delta;
myReversedVProp = vtkProperty::New();
bfc = Qtx::mainColorToSecondary(ffc, delta);
myReversedVProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
my2DActor = SMESH_CellLabelActor::New(); my2DActor = SMESH_CellLabelActor::New();
my2DActor->SetStoreGemetryMapping(true); my2DActor->SetStoreGemetryMapping(true);
my2DActor->SetUserMatrix(aMatrix); my2DActor->SetUserMatrix(aMatrix);
@ -201,8 +218,8 @@ SMESH_ActorDef::SMESH_ActorDef()
my3DActor->SetStoreGemetryMapping(true); my3DActor->SetStoreGemetryMapping(true);
my3DActor->SetUserMatrix(aMatrix); my3DActor->SetUserMatrix(aMatrix);
my3DActor->PickableOff(); my3DActor->PickableOff();
my3DActor->SetProperty(mySurfaceProp); my3DActor->SetProperty(myNormalVProp);
my3DActor->SetBackfaceProperty(myBackSurfaceProp); my3DActor->SetBackfaceProperty(myReversedVProp);
my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface); my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
my3DActor->SetCoincident3DAllowed(true); my3DActor->SetCoincident3DAllowed(true);
aFilter = my3DActor->GetExtractUnstructuredGrid(); aFilter = my3DActor->GetExtractUnstructuredGrid();
@ -224,11 +241,19 @@ SMESH_ActorDef::SMESH_ActorDef()
aFilter->RegisterCellsWithType(VTK_POLYHEDRON); aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
//#endif //#endif
my3DExtProp = vtkProperty::New();
my3DExtProp->DeepCopy(myNormalVProp);
SMESH::GetColor( "SMESH", "volume_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 170 ) );
anRGB[0] = 1 - anRGB[0];
anRGB[1] = 1 - anRGB[1];
anRGB[2] = 1 - anRGB[2];
my3DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
my3DExtActor = SMESH_DeviceActor::New(); my3DExtActor = SMESH_DeviceActor::New();
my3DExtActor->SetUserMatrix(aMatrix); my3DExtActor->SetUserMatrix(aMatrix);
my3DExtActor->PickableOff(); my3DExtActor->PickableOff();
my3DExtActor->SetProperty(my2DExtProp); my3DExtActor->SetProperty(my3DExtProp);
my3DExtActor->SetBackfaceProperty(my2DExtProp); my3DExtActor->SetBackfaceProperty(my3DExtProp);
my3DExtActor->SetRepresentation(SMESH_DeviceActor::eSurface); my3DExtActor->SetRepresentation(SMESH_DeviceActor::eSurface);
my3DExtActor->SetCoincident3DAllowed(true); my3DExtActor->SetCoincident3DAllowed(true);
aFilter = my3DExtActor->GetExtractUnstructuredGrid(); aFilter = my3DExtActor->GetExtractUnstructuredGrid();
@ -318,7 +343,7 @@ SMESH_ActorDef::SMESH_ActorDef()
//Definition 0D device of the actor (ball elements) //Definition 0D device of the actor (ball elements)
//----------------------------------------------- //-----------------------------------------------
myBallProp = vtkProperty::New(); myBallProp = vtkProperty::New();
SMESH::GetColor( "SMESH", "ball_elem_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) ); SMESH::GetColor( "SMESH", "ball_elem_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 85, 255 ) );
myBallProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myBallProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myBallProp->SetPointSize(aBallElemSize); myBallProp->SetPointSize(aBallElemSize);
@ -330,9 +355,7 @@ SMESH_ActorDef::SMESH_ActorDef()
myBallActor->SetProperty(myBallProp); myBallActor->SetProperty(myBallProp);
myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface); myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
aFilter = myBallActor->GetExtractUnstructuredGrid(); aFilter = myBallActor->GetExtractUnstructuredGrid();
//aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
aFilter->RegisterCellsWithType(VTK_VERTEX);
aFilter->RegisterCellsWithType(VTK_POLY_VERTEX); aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
//my0DExtProp = vtkProperty::New(); //my0DExtProp = vtkProperty::New();
@ -410,14 +433,18 @@ SMESH_ActorDef::SMESH_ActorDef()
myHighlightProp->SetLineWidth(aLineWidth); myHighlightProp->SetLineWidth(aLineWidth);
myHighlightProp->SetRepresentation(1); myHighlightProp->SetRepresentation(1);
myBallHighlightProp = vtkProperty::New();
myBallHighlightProp->DeepCopy(myHighlightProp);
myBallHighlightProp->SetPointSize(aBallElemSize);
myOutLineProp = vtkProperty::New(); myOutLineProp = vtkProperty::New();
myOutLineProp->SetAmbient(1.0); myOutLineProp->SetAmbient(1.0);
myOutLineProp->SetDiffuse(0.0); myOutLineProp->SetDiffuse(0.0);
myOutLineProp->SetSpecular(0.0); myOutLineProp->SetSpecular(0.0);
SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 70, 0 ) ); SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 70, 0 ) );
myOutLineProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myOutLineProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myOutLineProp->SetPointSize(aElem0DSize); // ?? myOutLineProp->SetLineWidth(aOutlineWidth);
myOutLineProp->SetLineWidth(aLineWidth);
myOutLineProp->SetRepresentation(1); myOutLineProp->SetRepresentation(1);
myPreselectProp = vtkProperty::New(); myPreselectProp = vtkProperty::New();
@ -430,6 +457,10 @@ SMESH_ActorDef::SMESH_ActorDef()
myPreselectProp->SetLineWidth(aLineWidth); myPreselectProp->SetLineWidth(aLineWidth);
myPreselectProp->SetRepresentation(1); myPreselectProp->SetRepresentation(1);
myBallPreselectProp = vtkProperty::New();
myBallPreselectProp->DeepCopy(myPreselectProp);
myBallPreselectProp->SetPointSize(aBallElemSize);
myHighlitableActor = SMESH_DeviceActor::New(); myHighlitableActor = SMESH_DeviceActor::New();
myHighlitableActor->SetUserMatrix(aMatrix); myHighlitableActor->SetUserMatrix(aMatrix);
myHighlitableActor->PickableOff(); myHighlitableActor->PickableOff();
@ -490,7 +521,7 @@ SMESH_ActorDef::SMESH_ActorDef()
my2DActor->SetQuadraticArcAngle(aQuadraticAngle); my2DActor->SetQuadraticArcAngle(aQuadraticAngle);
// Set colors of the name actor // Set colors of the name actor
SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) ); SMESH::GetColor( "SMESH", "default_grp_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]); myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]);
SMESH::GetColor( "SMESH", "group_name_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) ); SMESH::GetColor( "SMESH", "group_name_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
myNameActor->SetForegroundColor(anRGB[0], anRGB[1], anRGB[2]); myNameActor->SetForegroundColor(anRGB[0], anRGB[1], anRGB[2]);
@ -499,6 +530,8 @@ SMESH_ActorDef::SMESH_ActorDef()
my2dHistogram = 0; my2dHistogram = 0;
#endif #endif
SetBallSize(aBallElemSize);
Set0DSize(aElem0DSize);
} }
@ -518,6 +551,8 @@ SMESH_ActorDef::~SMESH_ActorDef()
mySurfaceProp->Delete(); mySurfaceProp->Delete();
myBackSurfaceProp->Delete(); myBackSurfaceProp->Delete();
myNormalVProp->Delete();
myReversedVProp->Delete();
myOutLineProp->Delete(); myOutLineProp->Delete();
myEdgeProp->Delete(); myEdgeProp->Delete();
@ -544,6 +579,7 @@ SMESH_ActorDef::~SMESH_ActorDef()
my2DExtProp->Delete(); my2DExtProp->Delete();
my2DExtActor->Delete(); my2DExtActor->Delete();
my3DActor->Delete(); my3DActor->Delete();
my3DExtProp->Delete();
my3DExtActor->Delete(); my3DExtActor->Delete();
myNodeActor->Delete(); myNodeActor->Delete();
@ -555,6 +591,9 @@ SMESH_ActorDef::~SMESH_ActorDef()
myImplicitBoolean->Delete(); myImplicitBoolean->Delete();
myTimeStamp->Delete(); myTimeStamp->Delete();
myBallHighlightProp->Delete();
myBallPreselectProp->Delete();
} }
void SMESH_ActorDef::Delete() void SMESH_ActorDef::Delete()
@ -639,15 +678,15 @@ bool SMESH_ActorDef::GetFacesOriented()
return myIsFacesOriented; return myIsFacesOriented;
} }
void SMESH_ActorDef::SetFacesOrientationColor(vtkFloatingPointType theColor[3]) void SMESH_ActorDef::SetFacesOrientationColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b)
{ {
my2DActor->SetFacesOrientationColor( theColor ); my2DActor->SetFacesOrientationColor( r, g, b );
my3DActor->SetFacesOrientationColor( theColor ); my3DActor->SetFacesOrientationColor( r, g, b );
} }
void SMESH_ActorDef::GetFacesOrientationColor(vtkFloatingPointType theColor[3]) void SMESH_ActorDef::GetFacesOrientationColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b)
{ {
my3DActor->GetFacesOrientationColor( theColor ); my3DActor->GetFacesOrientationColor( r, g, b );
} }
void SMESH_ActorDef::SetFacesOrientationScale(vtkFloatingPointType theScale) void SMESH_ActorDef::SetFacesOrientationScale(vtkFloatingPointType theScale)
@ -957,6 +996,9 @@ SetControlMode(eControl theMode,
void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
//myHighlightActor->AddToRender(theRenderer);
theRenderer->AddActor(myBaseActor); theRenderer->AddActor(myBaseActor);
theRenderer->AddActor(myNodeExtActor); theRenderer->AddActor(myNodeExtActor);
theRenderer->AddActor(my1DExtActor); theRenderer->AddActor(my1DExtActor);
@ -1053,6 +1095,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
my2DActor->GetPolygonOffsetParameters(aFactor,aUnits); my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75); my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
my2DExtActor->SetPolygonOffsetParameters(aFactor,aUnits*0.5); my2DExtActor->SetPolygonOffsetParameters(aFactor,aUnits*0.5);
my3DActor->SetPolygonOffsetParameters(2*aFactor,aUnits);
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
if( !mgr ) if( !mgr )
@ -1307,10 +1350,10 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
myNodeActor->VisibilityOn(); myNodeActor->VisibilityOn();
} }
if(myEntityMode & e0DElements){ if(myEntityMode & e0DElements && GetRepresentation() != ePoint ){
my0DActor->VisibilityOn(); my0DActor->VisibilityOn();
} }
if(myEntityMode & eBallElem){ if(myEntityMode & eBallElem && GetRepresentation() != ePoint ){
myBallActor->VisibilityOn(); myBallActor->VisibilityOn();
} }
@ -1492,6 +1535,8 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge); int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face); int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume); int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
int aNb0Ds = myVisualObj->GetNbEntities(SMDSAbs_0DElement);
int aNbBalls = myVisualObj->GetNbEntities(SMDSAbs_Ball);
if (theMode < 0) { if (theMode < 0) {
myRepresentation = eSurface; myRepresentation = eSurface;
@ -1503,10 +1548,10 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
} else { } else {
switch (theMode) { switch (theMode) {
case eEdge: case eEdge:
if (!aNbFaces && !aNbVolumes && !aNbEdges) return; if (!aNbFaces && !aNbVolumes && !aNbEdges && !aNb0Ds && !aNbBalls) return;
break; break;
case eSurface: case eSurface:
if (!aNbFaces && !aNbVolumes) return; if (!aNbFaces && !aNbVolumes && !aNb0Ds && !aNbBalls) return;
break; break;
} }
myRepresentation = theMode; myRepresentation = theMode;
@ -1528,6 +1573,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
myNodeActor->SetVisibility(false); myNodeActor->SetVisibility(false);
myNodeExtActor->SetVisibility(false); myNodeExtActor->SetVisibility(false);
vtkProperty *aProp = NULL, *aBackProp = NULL; vtkProperty *aProp = NULL, *aBackProp = NULL;
vtkProperty *aPropVN = NULL, *aPropVR = NULL;
SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1); SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
SMESH_Actor::EQuadratic2DRepresentation aQuadraticMode = GetQuadratic2DRepresentation(); SMESH_Actor::EQuadratic2DRepresentation aQuadraticMode = GetQuadratic2DRepresentation();
switch (myRepresentation) { switch (myRepresentation) {
@ -1535,16 +1581,18 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
myPickableActor = myNodeActor; myPickableActor = myNodeActor;
myNodeActor->SetVisibility(true); myNodeActor->SetVisibility(true);
aQuadraticMode = SMESH_Actor::eLines; aQuadraticMode = SMESH_Actor::eLines;
aProp = aBackProp = myNodeProp; aProp = aBackProp = aPropVN = aPropVR = myNodeProp;
aReperesent = SMESH_DeviceActor::ePoint; aReperesent = SMESH_DeviceActor::ePoint;
break; break;
case eEdge: case eEdge:
aProp = aBackProp = myEdgeProp; aProp = aBackProp = aPropVN = aPropVR = myEdgeProp;
aReperesent = SMESH_DeviceActor::eInsideframe; aReperesent = SMESH_DeviceActor::eInsideframe;
break; break;
case eSurface: case eSurface:
aProp = mySurfaceProp; aProp = mySurfaceProp;
aBackProp = myBackSurfaceProp; aBackProp = myBackSurfaceProp;
aPropVN = myNormalVProp;
aPropVR = myReversedVProp;
aReperesent = SMESH_DeviceActor::eSurface; aReperesent = SMESH_DeviceActor::eSurface;
break; break;
} }
@ -1560,8 +1608,8 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
my2DExtActor->SetRepresentation(aReperesent); my2DExtActor->SetRepresentation(aReperesent);
my3DActor->SetProperty(aProp); my3DActor->SetProperty(aPropVN);
my3DActor->SetBackfaceProperty(aBackProp); my3DActor->SetBackfaceProperty(aPropVR);
my3DActor->SetRepresentation(aReperesent); my3DActor->SetRepresentation(aReperesent);
//my0DExtActor->SetVisibility(false); //my0DExtActor->SetVisibility(false);
@ -1633,9 +1681,12 @@ void SMESH_ActorDef::UpdateHighlight(){
{ {
if(myIsHighlighted) { if(myIsHighlighted) {
myHighlitableActor->SetProperty(myHighlightProp); myHighlitableActor->SetProperty(myHighlightProp);
myBallActor->SetProperty(myBallHighlightProp);
}else if(myIsPreselected){ }else if(myIsPreselected){
myHighlitableActor->SetProperty(myPreselectProp); myHighlitableActor->SetProperty(myPreselectProp);
myBallActor->SetProperty(myBallPreselectProp);
} else if(anIsVisible){ } else if(anIsVisible){
myBallActor->SetProperty(myBallProp);
(myRepresentation == eSurface) ? (myRepresentation == eSurface) ?
myHighlitableActor->SetProperty(myOutLineProp) : myHighlitableActor->SetProperty(myEdgeProp); myHighlitableActor->SetProperty(myOutLineProp) : myHighlitableActor->SetProperty(myEdgeProp);
} }
@ -1777,10 +1828,15 @@ static void GetColor(vtkProperty *theProperty, vtkFloatingPointType& r,vtkFloati
void SMESH_ActorDef::SetOpacity(vtkFloatingPointType theValue){ void SMESH_ActorDef::SetOpacity(vtkFloatingPointType theValue){
mySurfaceProp->SetOpacity(theValue); mySurfaceProp->SetOpacity(theValue);
myBackSurfaceProp->SetOpacity(theValue); myBackSurfaceProp->SetOpacity(theValue);
myNormalVProp->SetOpacity(theValue);
myReversedVProp->SetOpacity(theValue);
myEdgeProp->SetOpacity(theValue); myEdgeProp->SetOpacity(theValue);
myOutLineProp->SetOpacity(theValue);
myNodeProp->SetOpacity(theValue); myNodeProp->SetOpacity(theValue);
my1DProp->SetOpacity(theValue); my1DProp->SetOpacity(theValue);
my0DProp->SetOpacity(theValue);
myBallProp->SetOpacity(theValue);
} }
@ -1791,9 +1847,9 @@ vtkFloatingPointType SMESH_ActorDef::GetOpacity(){
void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta){ void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta){
mySurfaceProp->SetColor(r,g,b); mySurfaceProp->SetColor(r,g,b);
my2DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) ) if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
if( aGroupObj->GetElementType() == SMDSAbs_Face || if( aGroupObj->GetElementType() == SMDSAbs_Face )
aGroupObj->GetElementType() == SMDSAbs_Volume )
myNameActor->SetBackgroundColor(r,g,b); myNameActor->SetBackgroundColor(r,g,b);
myDeltaBrightness = delta; myDeltaBrightness = delta;
@ -1804,10 +1860,27 @@ void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType
void SMESH_ActorDef::GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta){ void SMESH_ActorDef::GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta){
::GetColor(mySurfaceProp,r,g,b); ::GetColor(mySurfaceProp,r,g,b);
my2DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
delta = myDeltaBrightness; delta = myDeltaBrightness;
} }
void SMESH_ActorDef::SetVolumeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta){
myNormalVProp->SetColor(r,g,b);
my3DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
if( aGroupObj->GetElementType() == SMDSAbs_Volume )
myNameActor->SetBackgroundColor(r,g,b);
myDeltaVBrightness = delta;
QColor bfc = Qtx::mainColorToSecondary(QColor(int(r*255),int(g*255),int(b*255)), delta);
myReversedVProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
Modified();
}
void SMESH_ActorDef::GetVolumeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta){
::GetColor(myNormalVProp,r,g,b);
delta = myDeltaVBrightness;
}
void SMESH_ActorDef::SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ void SMESH_ActorDef::SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
myEdgeProp->SetColor(r,g,b); myEdgeProp->SetColor(r,g,b);
my1DProp->SetColor(r,g,b); my1DProp->SetColor(r,g,b);
@ -1871,6 +1944,7 @@ void SMESH_ActorDef::GetBallColor(vtkFloatingPointType& r,vtkFloatingPointType&
void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
myHighlightProp->SetColor(r,g,b); myHighlightProp->SetColor(r,g,b);
myBallHighlightProp->SetColor(r,g,b);
Modified(); Modified();
} }
@ -1880,6 +1954,7 @@ void SMESH_ActorDef::GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointT
void SMESH_ActorDef::SetPreHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ void SMESH_ActorDef::SetPreHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
myPreselectProp->SetColor(r,g,b); myPreselectProp->SetColor(r,g,b);
myBallPreselectProp->SetColor(r,g,b);
Modified(); Modified();
} }
@ -1899,15 +1974,36 @@ void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){
my1DProp->SetLineWidth(theVal + aLineWidthInc); my1DProp->SetLineWidth(theVal + aLineWidthInc);
my1DExtProp->SetLineWidth(theVal + aLineWidthInc); my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
my2DExtProp->SetLineWidth(theVal + aLineWidthInc); my2DExtProp->SetLineWidth(theVal + aLineWidthInc);
my3DExtProp->SetLineWidth(theVal + aLineWidthInc);
myOutLineProp->SetLineWidth(theVal); myOutLineProp->SetLineWidth(theVal);
myHighlightProp->SetLineWidth(theVal); myHighlightProp->SetLineWidth(theVal);
myPreselectProp->SetLineWidth(theVal); myPreselectProp->SetLineWidth(theVal);
Modified(); Modified();
} }
vtkFloatingPointType SMESH_ActorDef::GetOutlineWidth()
{
return myOutLineProp->GetLineWidth();
}
void SMESH_ActorDef::SetOutlineWidth(vtkFloatingPointType theVal)
{
myOutLineProp->SetLineWidth(theVal);
Modified();
}
void SMESH_ActorDef::Set0DSize(vtkFloatingPointType theVal){ void SMESH_ActorDef::Set0DSize(vtkFloatingPointType theVal){
my0DProp->SetPointSize(theVal); my0DProp->SetPointSize(theVal);
myHighlightProp->SetPointSize(theVal);
myPreselectProp->SetPointSize(theVal);
if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
aCustom->Set0DSize(theVal);
}
if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) {
aCustom->Set0DSize(theVal);
}
Modified(); Modified();
} }
@ -1917,6 +2013,15 @@ vtkFloatingPointType SMESH_ActorDef::Get0DSize(){
void SMESH_ActorDef::SetBallSize(vtkFloatingPointType theVal){ void SMESH_ActorDef::SetBallSize(vtkFloatingPointType theVal){
myBallProp->SetPointSize(theVal); myBallProp->SetPointSize(theVal);
myBallHighlightProp->SetPointSize(theVal);
myBallPreselectProp->SetPointSize(theVal);
if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
aCustom->SetBallSize(theVal);
}
if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) {
aCustom->SetBallSize(theVal);
}
Modified(); Modified();
} }

View File

@ -64,6 +64,9 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
virtual void SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta ) = 0; virtual void SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta ) = 0;
virtual void GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta ) = 0; virtual void GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta ) = 0;
virtual void SetVolumeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta ) = 0;
virtual void GetVolumeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta) = 0;
virtual void SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0; virtual void SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
virtual void GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0; virtual void GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
@ -88,6 +91,9 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
virtual vtkFloatingPointType GetLineWidth() = 0; virtual vtkFloatingPointType GetLineWidth() = 0;
virtual void SetLineWidth(vtkFloatingPointType theVal) = 0; virtual void SetLineWidth(vtkFloatingPointType theVal) = 0;
virtual vtkFloatingPointType GetOutlineWidth() = 0;
virtual void SetOutlineWidth(vtkFloatingPointType theVal) = 0;
virtual void Set0DSize(vtkFloatingPointType size) = 0; virtual void Set0DSize(vtkFloatingPointType size) = 0;
virtual vtkFloatingPointType Get0DSize() = 0; virtual vtkFloatingPointType Get0DSize() = 0;
@ -122,8 +128,8 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
virtual void SetFacesOriented(bool theIsFacesOriented) = 0; virtual void SetFacesOriented(bool theIsFacesOriented) = 0;
virtual bool GetFacesOriented() = 0; virtual bool GetFacesOriented() = 0;
virtual void SetFacesOrientationColor(vtkFloatingPointType theColor[3]) = 0; virtual void SetFacesOrientationColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
virtual void GetFacesOrientationColor(vtkFloatingPointType theColor[3]) = 0; virtual void GetFacesOrientationColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
virtual void SetFacesOrientationScale(vtkFloatingPointType theScale) = 0; virtual void SetFacesOrientationScale(vtkFloatingPointType theScale) = 0;
virtual vtkFloatingPointType GetFacesOrientationScale() = 0; virtual vtkFloatingPointType GetFacesOrientationScale() = 0;

View File

@ -106,6 +106,9 @@ class SMESH_ActorDef : public SMESH_Actor
virtual void SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta ); virtual void SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta );
virtual void GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta); virtual void GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta);
virtual void SetVolumeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta );
virtual void GetVolumeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta);
virtual void SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b); virtual void SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
virtual void GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b); virtual void GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
@ -131,6 +134,9 @@ class SMESH_ActorDef : public SMESH_Actor
virtual vtkFloatingPointType GetLineWidth(); virtual vtkFloatingPointType GetLineWidth();
virtual void SetLineWidth(vtkFloatingPointType theVal); virtual void SetLineWidth(vtkFloatingPointType theVal);
virtual vtkFloatingPointType GetOutlineWidth();
virtual void SetOutlineWidth(vtkFloatingPointType theVal);
virtual void Set0DSize(vtkFloatingPointType size); virtual void Set0DSize(vtkFloatingPointType size);
virtual vtkFloatingPointType Get0DSize(); virtual vtkFloatingPointType Get0DSize();
@ -180,8 +186,8 @@ class SMESH_ActorDef : public SMESH_Actor
virtual void SetFacesOriented(bool theIsFacesOriented); virtual void SetFacesOriented(bool theIsFacesOriented);
virtual bool GetFacesOriented(); virtual bool GetFacesOriented();
virtual void SetFacesOrientationColor(vtkFloatingPointType theColor[3]); virtual void SetFacesOrientationColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
virtual void GetFacesOrientationColor(vtkFloatingPointType theColor[3]); virtual void GetFacesOrientationColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
virtual void SetFacesOrientationScale(vtkFloatingPointType theScale); virtual void SetFacesOrientationScale(vtkFloatingPointType theScale);
virtual vtkFloatingPointType GetFacesOrientationScale(); virtual vtkFloatingPointType GetFacesOrientationScale();
@ -233,6 +239,8 @@ class SMESH_ActorDef : public SMESH_Actor
vtkProperty* mySurfaceProp; vtkProperty* mySurfaceProp;
vtkProperty* myBackSurfaceProp; vtkProperty* myBackSurfaceProp;
vtkProperty* myNormalVProp;
vtkProperty* myReversedVProp;
vtkProperty* myEdgeProp; vtkProperty* myEdgeProp;
vtkProperty* myNodeProp; vtkProperty* myNodeProp;
@ -243,12 +251,16 @@ class SMESH_ActorDef : public SMESH_Actor
vtkProperty* myHighlightProp; vtkProperty* myHighlightProp;
vtkProperty* myOutLineProp; vtkProperty* myOutLineProp;
vtkProperty* myPreselectProp; vtkProperty* myPreselectProp;
vtkProperty* myBallHighlightProp;
vtkProperty* myBallPreselectProp;
SMESH_DeviceActor* myHighlitableActor; SMESH_DeviceActor* myHighlitableActor;
eControl myControlMode; eControl myControlMode;
SMESH::Controls::FunctorPtr myFunctor; SMESH::Controls::FunctorPtr myFunctor;
vtkProperty* my2DExtProp; vtkProperty* my2DExtProp;
vtkProperty* my3DExtProp;
SMESH_CellLabelActor* my2DActor; SMESH_CellLabelActor* my2DActor;
SMESH_DeviceActor* my2DExtActor; SMESH_DeviceActor* my2DExtActor;
SMESH_CellLabelActor* my3DActor; SMESH_CellLabelActor* my3DActor;
@ -292,6 +304,7 @@ class SMESH_ActorDef : public SMESH_Actor
bool myIsFacesOriented; bool myIsFacesOriented;
int myDeltaBrightness; int myDeltaBrightness;
int myDeltaVBrightness;
VTK::MarkerTexture myMarkerTexture; VTK::MarkerTexture myMarkerTexture;

View File

@ -642,16 +642,16 @@ SMESH_DeviceActor
void void
SMESH_DeviceActor SMESH_DeviceActor
::SetFacesOrientationColor(vtkFloatingPointType theColor[3]) ::SetFacesOrientationColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b)
{ {
myFaceOrientation->GetProperty()->SetColor( theColor ); myFaceOrientation->GetProperty()->SetColor( r, g, b );
} }
void void
SMESH_DeviceActor SMESH_DeviceActor
::GetFacesOrientationColor(vtkFloatingPointType theColor[3]) ::GetFacesOrientationColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b)
{ {
myFaceOrientation->GetProperty()->GetColor( theColor ); myFaceOrientation->GetProperty()->GetColor( r, g, b );
} }
void void

View File

@ -79,8 +79,8 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
virtual void SetFacesOriented(bool theIsFacesOriented); virtual void SetFacesOriented(bool theIsFacesOriented);
virtual bool GetFacesOriented() { return myIsFacesOriented; } virtual bool GetFacesOriented() { return myIsFacesOriented; }
virtual void SetFacesOrientationColor(vtkFloatingPointType theColor[3]); virtual void SetFacesOrientationColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
virtual void GetFacesOrientationColor(vtkFloatingPointType theColor[3]); virtual void GetFacesOrientationColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
virtual void SetFacesOrientationScale(vtkFloatingPointType theScale); virtual void SetFacesOrientationScale(vtkFloatingPointType theScale);
virtual vtkFloatingPointType GetFacesOrientationScale(); virtual vtkFloatingPointType GetFacesOrientationScale();

View File

@ -82,14 +82,14 @@ static int MYDEBUGWITHFILES = 0;
// purpose : Get type of VTK cell // purpose : Get type of VTK cell
//================================================================================= //=================================================================================
static inline vtkIdType getCellType( const SMDSAbs_ElementType theType, static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
const bool thePoly, const bool thePoly,
const int theNbNodes ) const int theNbNodes )
{ {
switch( theType ) switch( theType )
{ {
case SMDSAbs_0DElement: return VTK_VERTEX; case SMDSAbs_0DElement: return VTK_VERTEX;
case SMDSAbs_Ball: return VTK_POLY_VERTEX; case SMDSAbs_Ball: return VTK_POLY_VERTEX;
case SMDSAbs_Edge: case SMDSAbs_Edge:
if( theNbNodes == 2 ) return VTK_LINE; if( theNbNodes == 2 ) return VTK_LINE;
@ -345,16 +345,21 @@ void SMESH_VisualObjDef::buildElemPrs()
// Calculate cells size // Calculate cells size
static SMDSAbs_ElementType aTypes[ 5 ] = const int nbTypes = 5;
{ SMDSAbs_Ball, SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume }; static SMDSAbs_ElementType aTypes[ nbTypes ] =
{ SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume, SMDSAbs_Ball, SMDSAbs_0DElement };
// get entity data // get entity data
map<SMDSAbs_ElementType,int> nbEnts; map<SMDSAbs_ElementType,int> nbEnts;
map<SMDSAbs_ElementType,TEntityList> anEnts; map<SMDSAbs_ElementType,TEntityList> anEnts;
for ( int i = 0; i <= 3; i++ ) vtkIdType aNbCells = 0;
nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] );
for ( int i = 0; i < nbTypes; i++ )
{
nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] );
aNbCells += nbEnts[ aTypes [ i ]];
}
// PAL16631: without swap, bad_alloc is not thrown but hung up and crash instead, // PAL16631: without swap, bad_alloc is not thrown but hung up and crash instead,
// so check remaining memory size for safety // so check remaining memory size for safety
SMDS_Mesh::CheckMemory(); // PAL16631 SMDS_Mesh::CheckMemory(); // PAL16631
@ -362,7 +367,7 @@ void SMESH_VisualObjDef::buildElemPrs()
vtkIdType aCellsSize = 2 * nbEnts[ SMDSAbs_0DElement ] + 3 * nbEnts[ SMDSAbs_Edge ]; vtkIdType aCellsSize = 2 * nbEnts[ SMDSAbs_0DElement ] + 3 * nbEnts[ SMDSAbs_Edge ];
aCellsSize += 2 * nbEnts[ SMDSAbs_Ball ]; aCellsSize += 2 * nbEnts[ SMDSAbs_Ball ];
for ( int i = 2; i <= 3; i++ ) // iterate through faces and volumes for ( int i = 1; i <= 2; i++ ) // iterate through faces and volumes
{ {
if ( nbEnts[ aTypes[ i ] ] ) if ( nbEnts[ aTypes[ i ] ] )
{ {
@ -388,11 +393,6 @@ void SMESH_VisualObjDef::buildElemPrs()
} }
} }
} }
vtkIdType aNbCells =
nbEnts[ SMDSAbs_0DElement ] + nbEnts[ SMDSAbs_Ball ] + nbEnts[ SMDSAbs_Edge ] +
nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
if ( MYDEBUG ) if ( MYDEBUG )
MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize ); MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
@ -417,7 +417,7 @@ void SMESH_VisualObjDef::buildElemPrs()
SMDS_Mesh::CheckMemory(); // PAL16631 SMDS_Mesh::CheckMemory(); // PAL16631
for ( int i = 0; i <= 3; i++ ) // iterate through 0d elements, edges, faces and volumes for ( int i = 0; i < nbTypes; i++ ) // iterate through all types of elements
{ {
if ( nbEnts[ aTypes[ i ] ] > 0 ) { if ( nbEnts[ aTypes[ i ] ] > 0 ) {

View File

@ -0,0 +1,184 @@
// 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 OBJECT : interactive object for SMESH visualization
// File : SMESH_SVTKActor.cxx
// Author : Roman NIKOLAEV
// Module : SMESH
//
#include "SMESH_SVTKActor.h"
#include <SVTK_Utils.h>
#include <SALOME_Actor.h>
#include <SVTK_DeviceActor.h>
#include <vtkPoints.h>
#include <vtkRenderer.h>
#include <vtkObjectFactory.h>
#include <vtkUnstructuredGrid.h>
#include <vtkCell.h>
#include <vtkDataSetMapper.h>
vtkStandardNewMacro(SMESH_SVTKActor);
/*!
Constructor
*/
SMESH_SVTKActor::SMESH_SVTKActor():
my0DGrid(vtkUnstructuredGrid::New()),
myBallGrid(vtkUnstructuredGrid::New())
{
my0DActor = SVTK_DeviceActor::New();
myBallActor = SVTK_DeviceActor::New();
myBallActor->SetResolveCoincidentTopology(false);
myBallActor->SetCoincident3DAllowed(true);
myBallActor->PickableOff();
my0DActor->SetResolveCoincidentTopology(false);
my0DActor->SetCoincident3DAllowed(true);
my0DActor->PickableOff();
my0DGrid->Allocate();
myBallGrid->Allocate();
}
/*!
Constructor
*/
SMESH_SVTKActor::~SMESH_SVTKActor() {
my0DActor->Delete();
myBallActor->Delete();
my0DGrid->Delete();
myBallGrid->Delete();
}
/*!
Publishes the actor in all its internal devices
*/
void SMESH_SVTKActor::AddToRender(vtkRenderer* theRenderer) {
Superclass::AddToRender(theRenderer);
float a0D = my0DActor->GetProperty()->GetPointSize();
float aBall = myBallActor->GetProperty()->GetPointSize();
my0DActor->GetProperty()->DeepCopy(GetProperty());
myBallActor->GetProperty()->DeepCopy(GetProperty());
my0DActor->GetProperty()->SetPointSize(a0D);
myBallActor->GetProperty()->SetPointSize(aBall);
theRenderer->AddActor(my0DActor);
theRenderer->AddActor(myBallActor);
}
/*!
Removes the actor from all its internal devices
*/
void
SMESH_SVTKActor
::RemoveFromRender(vtkRenderer* theRenderer)
{
Superclass::RemoveFromRender(theRenderer);
theRenderer->RemoveActor( myBallActor );
theRenderer->RemoveActor( my0DActor );
}
void
SMESH_SVTKActor
::MapCells(SALOME_Actor* theMapActor,
const TColStd_IndexedMapOfInteger& theMapIndex)
{
myUnstructuredGrid->Initialize();
myUnstructuredGrid->Allocate();
my0DGrid->Initialize();
my0DGrid->Allocate();
myBallGrid->Initialize();
myBallGrid->Allocate();
vtkDataSet *aSourceDataSet = theMapActor->GetInput();
SVTK::CopyPoints( GetSource(), aSourceDataSet );
SVTK::CopyPoints( myBallGrid, aSourceDataSet );
SVTK::CopyPoints( my0DGrid, aSourceDataSet );
int aNbOfParts = theMapIndex.Extent();
for(int ind = 1; ind <= aNbOfParts; ind++){
int aPartId = theMapIndex( ind );
if(vtkCell* aCell = theMapActor->GetElemCell(aPartId))
{
#if VTK_XVERSION > 50700
if (aCell->GetCellType() != VTK_POLYHEDRON)
#endif
if(aCell->GetCellType() == VTK_VERTEX ) {
my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
} else if(aCell->GetCellType() == VTK_POLY_VERTEX ) {
myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
} else {
myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
}
#if VTK_XVERSION > 50700
else
{
vtkPolyhedron *polyhedron = dynamic_cast<vtkPolyhedron*>(aCell);
if (!polyhedron)
throw SALOME_Exception(LOCALIZED ("not a polyhedron"));
vtkIdType *pts = polyhedron->GetFaces();
myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),pts[0], pts+1);
}
#endif
}
UnShrink();
if(theMapActor->IsShrunk()){
SetShrinkFactor(theMapActor->GetShrinkFactor());
SetShrink();
}
myMapIndex = theMapIndex;
}
}
void
SMESH_SVTKActor
::Initialize()
{
Superclass::Initialize();
my0DActor->SetInput(my0DGrid);
myBallActor->SetInput(myBallGrid);
}
void SMESH_SVTKActor::SetVisibility( int theVisibility ) {
Superclass::SetVisibility( theVisibility );
my0DActor->SetVisibility( theVisibility );
myBallActor->SetVisibility( theVisibility );
}
void SMESH_SVTKActor::Set0DSize(float theSize) {
my0DActor->GetProperty()->SetPointSize(theSize);
}
void SMESH_SVTKActor::SetBallSize(float theSize) {
myBallActor->GetProperty()->SetPointSize(theSize);
}

View File

@ -0,0 +1,82 @@
// 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 OBJECT : interactive object for SMESH visualization
// File : SMESH_SVTKActor.h
// Author : Roman NIKOLAEV
// Module : SMESH
//
#ifndef SMESH_SVTKACTOR_H
#define SMESH_SVTKACTOR_H
#include "SMESH_Object.h"
#include <SVTK_Actor.h>
class SVTK_Actor;
class vtkUnstructureGrid;
class vtkDataSetMapper;
class SMESHOBJECT_EXPORT SMESH_SVTKActor : public SVTK_Actor {
public:
static SMESH_SVTKActor* New();
vtkTypeMacro(SMESH_SVTKActor, SVTK_Actor);
void SetBallSize(float theSize);
void Set0DSize(float theSize);
//! To publish the actor an all its internal devices
virtual
void
AddToRender(vtkRenderer* theRendere);
virtual void SetVisibility( int theVisibility );
//! Initialiaze the instance completely
virtual void
Initialize();
//! Allow to recostruct selected cells from source SALOME_Actor and map of subindexes
virtual void
MapCells(SALOME_Actor* theMapActor,
const TColStd_IndexedMapOfInteger& theMapIndex);
//! To remove the actor an all its internal devices
virtual
void
RemoveFromRender(vtkRenderer* theRendere);
protected:
SVTK_DeviceActor* my0DActor;
SVTK_DeviceActor* myBallActor;
vtkUnstructuredGrid* my0DGrid;
vtkUnstructuredGrid* myBallGrid;
SMESH_SVTKActor();
virtual ~SMESH_SVTKActor();
};
#endif

View File

@ -42,7 +42,7 @@ typedef struct
int nbElems; int nbElems;
} ListElemByNodesType; // TODO resize for polyhedrons } ListElemByNodesType; // TODO resize for polyhedrons
class DownIdType class SMDS_EXPORT DownIdType
{ {
public: public:
DownIdType(int a, unsigned char b) : DownIdType(int a, unsigned char b) :
@ -64,7 +64,7 @@ struct DownIdCompare
} }
}; };
class SMDS_Downward class SMDS_EXPORT SMDS_Downward
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
friend class SMDS_Down2D; friend class SMDS_Down2D;
@ -109,7 +109,7 @@ protected:
static std::vector<int> _cellDimension; //!< conversion table: type --> dimension static std::vector<int> _cellDimension; //!< conversion table: type --> dimension
}; };
class SMDS_Down1D: public SMDS_Downward class SMDS_EXPORT SMDS_Down1D: public SMDS_Downward
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -140,7 +140,7 @@ protected:
std::vector<int> _upCellIndex; //!< compacted storage after connectivity calculation std::vector<int> _upCellIndex; //!< compacted storage after connectivity calculation
}; };
class SMDS_Down2D: public SMDS_Downward class SMDS_EXPORT SMDS_Down2D: public SMDS_Downward
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
friend class SMDS_Down1D; friend class SMDS_Down1D;
@ -171,7 +171,7 @@ protected:
int _nbNodes; //!< number of nodes in a face int _nbNodes; //!< number of nodes in a face
}; };
class SMDS_Down3D: public SMDS_Downward class SMDS_EXPORT SMDS_Down3D: public SMDS_Downward
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -188,7 +188,7 @@ protected:
int FindFaceByNodes(int cellId, ElemByNodesType& faceByNodes); int FindFaceByNodes(int cellId, ElemByNodesType& faceByNodes);
}; };
class SMDS_DownEdge: public SMDS_Down1D class SMDS_EXPORT SMDS_DownEdge: public SMDS_Down1D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -197,7 +197,7 @@ protected:
~SMDS_DownEdge(); ~SMDS_DownEdge();
}; };
class SMDS_DownQuadEdge: public SMDS_Down1D class SMDS_EXPORT SMDS_DownQuadEdge: public SMDS_Down1D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -206,7 +206,7 @@ protected:
~SMDS_DownQuadEdge(); ~SMDS_DownQuadEdge();
}; };
class SMDS_DownTriangle: public SMDS_Down2D class SMDS_EXPORT SMDS_DownTriangle: public SMDS_Down2D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -217,7 +217,7 @@ protected:
virtual void addDownCell(int cellId, int lowCellId, unsigned char aType); //!< Id's are downward connectivity id's virtual void addDownCell(int cellId, int lowCellId, unsigned char aType); //!< Id's are downward connectivity id's
}; };
class SMDS_DownQuadTriangle: public SMDS_Down2D class SMDS_EXPORT SMDS_DownQuadTriangle: public SMDS_Down2D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -228,7 +228,7 @@ protected:
virtual void addDownCell(int cellId, int lowCellId, unsigned char aType); //!< Id's are downward connectivity id's virtual void addDownCell(int cellId, int lowCellId, unsigned char aType); //!< Id's are downward connectivity id's
}; };
class SMDS_DownQuadrangle: public SMDS_Down2D class SMDS_EXPORT SMDS_DownQuadrangle: public SMDS_Down2D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -239,7 +239,7 @@ protected:
virtual void addDownCell(int cellId, int lowCellId, unsigned char aType); //!< Id's are downward connectivity id's virtual void addDownCell(int cellId, int lowCellId, unsigned char aType); //!< Id's are downward connectivity id's
}; };
class SMDS_DownQuadQuadrangle: public SMDS_Down2D class SMDS_EXPORT SMDS_DownQuadQuadrangle: public SMDS_Down2D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -266,7 +266,7 @@ protected:
//protected: //protected:
//}; //};
class SMDS_DownTetra: public SMDS_Down3D class SMDS_EXPORT SMDS_DownTetra: public SMDS_Down3D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -278,7 +278,7 @@ protected:
virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes); virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes);
}; };
class SMDS_DownQuadTetra: public SMDS_Down3D class SMDS_EXPORT SMDS_DownQuadTetra: public SMDS_Down3D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -290,7 +290,7 @@ protected:
virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes); virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes);
}; };
class SMDS_DownPyramid: public SMDS_Down3D class SMDS_EXPORT SMDS_DownPyramid: public SMDS_Down3D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -302,7 +302,7 @@ protected:
virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes); virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes);
}; };
class SMDS_DownQuadPyramid: public SMDS_Down3D class SMDS_EXPORT SMDS_DownQuadPyramid: public SMDS_Down3D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -314,7 +314,7 @@ protected:
virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes); virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes);
}; };
class SMDS_DownPenta: public SMDS_Down3D class SMDS_EXPORT SMDS_DownPenta: public SMDS_Down3D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -326,7 +326,7 @@ protected:
virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes); virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes);
}; };
class SMDS_DownQuadPenta: public SMDS_Down3D class SMDS_EXPORT SMDS_DownQuadPenta: public SMDS_Down3D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -338,7 +338,7 @@ protected:
virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes); virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes);
}; };
class SMDS_DownHexa: public SMDS_Down3D class SMDS_EXPORT SMDS_DownHexa: public SMDS_Down3D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:
@ -350,7 +350,7 @@ protected:
virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes); virtual void computeFacesWithNodes(int cellId, ListElemByNodesType& facesWithNodes);
}; };
class SMDS_DownQuadHexa: public SMDS_Down3D class SMDS_EXPORT SMDS_DownQuadHexa: public SMDS_Down3D
{ {
friend class SMDS_UnstructuredGrid; friend class SMDS_UnstructuredGrid;
public: public:

View File

@ -45,7 +45,7 @@ public:
double X() const; // ! NOT thread safe methods ! double X() const; // ! NOT thread safe methods !
double Y() const; double Y() const;
double Z() const; double Z() const;
void GetXYZ(double xyx[3]) const; // thread safe getting coords void GetXYZ(double xyz[3]) const; // thread safe getting coords
SMDS_ElemIteratorPtr GetInverseElementIterator(SMDSAbs_ElementType type=SMDSAbs_All) const; SMDS_ElemIteratorPtr GetInverseElementIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
int NbInverseElements(SMDSAbs_ElementType type=SMDSAbs_All) const; int NbInverseElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
const SMDS_PositionPtr& GetPosition() const; const SMDS_PositionPtr& GetPosition() const;

View File

@ -763,7 +763,7 @@ void SMDS_UnstructuredGrid::BuildDownwardConnectivity(bool withEdges)
* @param vtkId the vtk id of the cell * @param vtkId the vtk id of the cell
* @return number of neighbors * @return number of neighbors
*/ */
int SMDS_UnstructuredGrid::GetNeighbors(int* neighborsVtkIds, int* downIds, unsigned char* downTypes, int vtkId) int SMDS_UnstructuredGrid::GetNeighbors(int* neighborsVtkIds, int* downIds, unsigned char* downTypes, int vtkId, bool getSkin)
{ {
int vtkType = this->GetCellType(vtkId); int vtkType = this->GetCellType(vtkId);
int cellDim = SMDS_Downward::getCellDimension(vtkType); int cellDim = SMDS_Downward::getCellDimension(vtkType);
@ -798,9 +798,27 @@ int SMDS_UnstructuredGrid::GetNeighbors(int* neighborsVtkIds, int* downIds, unsi
downIds[nb] = downId; downIds[nb] = downId;
downTypes[nb] = cellType; downTypes[nb] = cellType;
nb++; nb++;
if (nb >= NBMAXNEIGHBORS)
{
INFOS("SMDS_UnstructuredGrid::GetNeighbors problem: NBMAXNEIGHBORS=" <<NBMAXNEIGHBORS << " not enough");
return nb;
}
}
if (getSkin)
{
if (cellDim == 3 && nbUp == 1) // this face is on the skin of the volume
{
neighborsVtkIds[nb] = _downArray[cellType]->getVtkCellId(downId); // OK if skin present
downIds[nb] = downId;
downTypes[nb] = cellType;
nb++;
if (nb >= NBMAXNEIGHBORS)
{
INFOS("SMDS_UnstructuredGrid::GetNeighbors problem: NBMAXNEIGHBORS=" <<NBMAXNEIGHBORS << " not enough");
return nb;
}
}
} }
if (nb >= NBMAXNEIGHBORS)
assert(0);
} }
return nb; return nb;
} }

View File

@ -83,7 +83,7 @@ public:
void setCellIdToDownId(int vtkCellId, int downId); void setCellIdToDownId(int vtkCellId, int downId);
void CleanDownwardConnectivity(); void CleanDownwardConnectivity();
void BuildDownwardConnectivity(bool withEdges); void BuildDownwardConnectivity(bool withEdges);
int GetNeighbors(int* neighborsVtkIds, int* downIds, unsigned char* downTypes, int vtkId); int GetNeighbors(int* neighborsVtkIds, int* downIds, unsigned char* downTypes, int vtkId, bool getSkin=false);
int GetParentVolumes(int* volVtkIds, int vtkId); int GetParentVolumes(int* volVtkIds, int vtkId);
int GetParentVolumes(int* volVtkIds, int downId, unsigned char downType); int GetParentVolumes(int* volVtkIds, int downId, unsigned char downType);
void GetNodeIds(std::set<int>& nodeSet, int downId, unsigned char downType); void GetNodeIds(std::set<int>& nodeSet, int downId, unsigned char downType);

View File

@ -1452,6 +1452,45 @@ double SMDS_VolumeTool::MinLinearSize2() const
return minSize; return minSize;
} }
//================================================================================
/*!
* \brief Return maximal square distance between connected corner nodes
*/
//================================================================================
double SMDS_VolumeTool::MaxLinearSize2() const
{
double maxSize = -1e+100;
int iQ = myVolume->IsQuadratic() ? 2 : 1;
// store current face data
int curFace = myCurFace, nbN = myFaceNbNodes;
int* ind = myFaceNodeIndices;
myFaceNodeIndices = NULL;
const SMDS_MeshNode** nodes = myFaceNodes;
myFaceNodes = NULL;
// it seems that compute distance twice is faster than organization of a sole computing
myCurFace = -1;
for ( int iF = 0; iF < myNbFaces; ++iF )
{
setFace( iF );
for ( int iN = 0; iN < myFaceNbNodes; iN += iQ )
{
XYZ n1( myFaceNodes[ iN ]);
XYZ n2( myFaceNodes[(iN + iQ) % myFaceNbNodes]);
maxSize = std::max( maxSize, (n1 - n2).SquareMagnitude());
}
}
// restore current face data
myCurFace = curFace;
myFaceNbNodes = nbN;
myFaceNodeIndices = ind;
delete [] myFaceNodes; myFaceNodes = nodes;
return maxSize;
}
//================================================================================ //================================================================================
/*! /*!
* \brief check that only one volume is build on the face nodes * \brief check that only one volume is build on the face nodes

View File

@ -128,6 +128,9 @@ class SMDS_EXPORT SMDS_VolumeTool
double MinLinearSize2() const; double MinLinearSize2() const;
// Return minimal square distance between connected corner nodes // Return minimal square distance between connected corner nodes
double MaxLinearSize2() const;
// Return maximal square distance between connected corner nodes
// ------------- // -------------
// info on faces // info on faces
// ------------- // -------------

View File

@ -34,10 +34,6 @@ salomeinclude_HEADERS = \
SMESH_Hypothesis.hxx \ SMESH_Hypothesis.hxx \
SMESH_HypoFilter.hxx \ SMESH_HypoFilter.hxx \
SMESH_Algo.hxx \ SMESH_Algo.hxx \
SMESH_0D_Algo.hxx \
SMESH_1D_Algo.hxx \
SMESH_2D_Algo.hxx \
SMESH_3D_Algo.hxx \
SMESH_Group.hxx \ SMESH_Group.hxx \
SMESH_MeshEditor.hxx \ SMESH_MeshEditor.hxx \
SMESH_Pattern.hxx \ SMESH_Pattern.hxx \
@ -56,10 +52,6 @@ dist_libSMESHimpl_la_SOURCES = \
SMESH_subMesh.cxx \ SMESH_subMesh.cxx \
SMESH_Hypothesis.cxx \ SMESH_Hypothesis.cxx \
SMESH_Algo.cxx \ SMESH_Algo.cxx \
SMESH_0D_Algo.cxx \
SMESH_1D_Algo.cxx \
SMESH_2D_Algo.cxx \
SMESH_3D_Algo.cxx \
SMESH_Group.cxx \ SMESH_Group.cxx \
SMESH_MeshEditor.cxx \ SMESH_MeshEditor.cxx \
SMESH_Pattern.cxx \ SMESH_Pattern.cxx \
@ -83,6 +75,7 @@ libSMESHimpl_la_CPPFLAGS = \
-I$(srcdir)/../DriverUNV \ -I$(srcdir)/../DriverUNV \
-I$(srcdir)/../DriverSTL \ -I$(srcdir)/../DriverSTL \
-I$(srcdir)/../DriverCGNS \ -I$(srcdir)/../DriverCGNS \
-I$(srcdir)/../DriverGMF \
-I$(srcdir)/../SMDS \ -I$(srcdir)/../SMDS \
-I$(srcdir)/../SMESHDS \ -I$(srcdir)/../SMESHDS \
-I$(srcdir)/../SMESHUtils -I$(srcdir)/../SMESHUtils
@ -98,8 +91,9 @@ libSMESHimpl_la_LDFLAGS = \
../DriverSTL/libMeshDriverSTL.la \ ../DriverSTL/libMeshDriverSTL.la \
../DriverMED/libMeshDriverMED.la \ ../DriverMED/libMeshDriverMED.la \
../DriverUNV/libMeshDriverUNV.la \ ../DriverUNV/libMeshDriverUNV.la \
../DriverGMF/libMeshDriverGMF.la \
$(DriverCGNS_LIB) \ $(DriverCGNS_LIB) \
../SMESHUtils/libSMESHUtils.la \ ../SMESHUtils/libSMESHUtils.la \
$(BOOST_LIB_THREAD) \ $(BOOST_LIB_THREAD) \
$(GEOM_LDFLAGS) -lNMTTools \ $(GEOM_LDFLAGS) -lNMTTools \
$(CAS_LDPATH) -lTKShHealing -lTKPrim -lTKG2d $(CAS_LDPATH) -lTKShHealing -lTKPrim -lTKG2d -lTKCDF

View File

@ -1,53 +0,0 @@
// 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 SMESH : implementaion of SMESH idl descriptions
// File : SMESH_0D_Algo.cxx
// Module : SMESH
// $Header$
//
#include "SMESH_0D_Algo.hxx"
#include "SMESH_Gen.hxx"
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_0D_Algo::SMESH_0D_Algo(int hypId, int studyId, SMESH_Gen* gen)
: SMESH_Algo(hypId, studyId, gen)
{
_type = ALGO_0D;
gen->_map0D_Algo[hypId] = this;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_0D_Algo::~SMESH_0D_Algo()
{
}

View File

@ -1,58 +0,0 @@
// 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 SMESH : implementaion of SMESH idl descriptions
// File : SMESH_1D_Algo.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#include "SMESH_1D_Algo.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_subMesh.hxx"
using namespace std;
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_1D_Algo::SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen)
: SMESH_Algo(hypId, studyId, gen)
{
// _compatibleHypothesis.push_back("hypothese_1D_bidon");
_type = ALGO_1D;
gen->_map1D_Algo[hypId] = this;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_1D_Algo::~SMESH_1D_Algo()
{
}

View File

@ -1,44 +0,0 @@
// 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 SMESH : implementaion of SMESH idl descriptions
// File : SMESH_1D_Algo.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#ifndef _SMESH_1D_ALGO_HXX_
#define _SMESH_1D_ALGO_HXX_
#include "SMESH_SMESH.hxx"
#include "SMESH_Algo.hxx"
class SMESH_EXPORT SMESH_1D_Algo:
public SMESH_Algo
{
public:
SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen);
virtual ~SMESH_1D_Algo();
};
#endif

View File

@ -1,97 +0,0 @@
// 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 SMESH : implementaion of SMESH idl descriptions
// File : SMESH_2D_Algo.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#include "SMESH_2D_Algo.hxx"
#include "SMESH_Gen.hxx"
#include "utilities.h"
#include <TopExp_Explorer.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
using namespace std;
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_2D_Algo::SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen)
: SMESH_Algo(hypId, studyId, gen)
{
// _compatibleHypothesis.push_back("hypothese_2D_bidon");
_type = ALGO_2D;
gen->_map2D_Algo[hypId] = this;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_2D_Algo::~SMESH_2D_Algo()
{
}
//=============================================================================
/*!
*
*/
//=============================================================================
int SMESH_2D_Algo::NumberOfWires(const TopoDS_Shape& S)
{
int i = 0;
for (TopExp_Explorer exp(S,TopAbs_WIRE); exp.More(); exp.Next())
i++;
return i;
}
//=============================================================================
/*!
*
*/
//=============================================================================
int SMESH_2D_Algo::NumberOfPoints(SMESH_Mesh& aMesh, const TopoDS_Wire& W)
{
int nbPoints = 0;
for (TopExp_Explorer exp(W,TopAbs_EDGE); exp.More(); exp.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
if(_quadraticMesh)
nb = nb/2;
nbPoints += nb + 1; // internal points plus 1 vertex of 2 (last point ?)
}
return nbPoints;
}

View File

@ -1,60 +0,0 @@
// 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 SMESH : implementaion of SMESH idl descriptions
// File : SMESH_3D_Algo.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#include "SMESH_3D_Algo.hxx"
#include "SMESH_Gen.hxx"
#include "utilities.h"
using namespace std;
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_3D_Algo::SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen)
: SMESH_Algo(hypId, studyId, gen)
{
// _compatibleHypothesis.push_back("hypothese_3D_bidon");
_type = ALGO_3D;
gen->_map3D_Algo[hypId] = this;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_3D_Algo::~SMESH_3D_Algo()
{
}

View File

@ -39,6 +39,7 @@
#include "SMESH_HypoFilter.hxx" #include "SMESH_HypoFilter.hxx"
#include "SMESH_Mesh.hxx" #include "SMESH_Mesh.hxx"
#include "SMESH_TypeDefs.hxx" #include "SMESH_TypeDefs.hxx"
#include "SMESH_subMesh.hxx"
#include <Basics_OCCTVersion.hxx> #include <Basics_OCCTVersion.hxx>
@ -49,6 +50,7 @@
#include <GeomAdaptor_Curve.hxx> #include <GeomAdaptor_Curve.hxx>
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
#include <TopExp.hxx> #include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx> #include <TopLoc_Location.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
@ -56,6 +58,7 @@
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx> #include <gp_Pnt2d.hxx>
#include <gp_Vec.hxx> #include <gp_Vec.hxx>
@ -96,6 +99,41 @@ SMESH_Algo::~SMESH_Algo()
{ {
} }
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_0D_Algo::SMESH_0D_Algo(int hypId, int studyId, SMESH_Gen* gen)
: SMESH_Algo(hypId, studyId, gen)
{
_shapeType = (1 << TopAbs_VERTEX);
_type = ALGO_0D;
gen->_map0D_Algo[hypId] = this;
}
SMESH_1D_Algo::SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen)
: SMESH_Algo(hypId, studyId, gen)
{
_shapeType = (1 << TopAbs_EDGE);
_type = ALGO_1D;
gen->_map1D_Algo[hypId] = this;
}
SMESH_2D_Algo::SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen)
: SMESH_Algo(hypId, studyId, gen)
{
_shapeType = (1 << TopAbs_FACE);
_type = ALGO_2D;
gen->_map2D_Algo[hypId] = this;
}
SMESH_3D_Algo::SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen)
: SMESH_Algo(hypId, studyId, gen)
{
_shapeType = (1 << TopAbs_SOLID);
_type = ALGO_3D;
gen->_map3D_Algo[hypId] = this;
}
//============================================================================= //=============================================================================
/*! /*!
* Usually an algoritm has nothing to save * Usually an algoritm has nothing to save
@ -309,7 +347,14 @@ bool SMESH_Algo::IsReversedSubMesh (const TopoDS_Face& theFace,
// face normal at node position // face normal at node position
TopLoc_Location loc; TopLoc_Location loc;
Handle(Geom_Surface) surf = BRep_Tool::Surface( theFace, loc ); Handle(Geom_Surface) surf = BRep_Tool::Surface( theFace, loc );
if ( surf.IsNull() || surf->Continuity() < GeomAbs_C1 ) return isReversed; // if ( surf.IsNull() || surf->Continuity() < GeomAbs_C1 )
// some surfaces not detected as GeomAbs_C1 are nevertheless correct for meshing
if ( surf.IsNull() || surf->Continuity() < GeomAbs_C0 )
{
if (!surf.IsNull())
MESSAGE("surf->Continuity() < GeomAbs_C1 " << (surf->Continuity() < GeomAbs_C1));
return isReversed;
}
gp_Vec d1u, d1v; gp_Vec d1u, d1v;
surf->D1( u, v, nPnt[0], d1u, d1v ); surf->D1( u, v, nPnt[0], d1u, d1v );
gp_Vec Nf = (d1u ^ d1v).Transformed( loc ); gp_Vec Nf = (d1u ^ d1v).Transformed( loc );
@ -777,3 +822,38 @@ void SMESH_Algo::addBadInputElement(const SMDS_MeshElement* elem)
if ( elem ) if ( elem )
_badInputElements.push_back( elem ); _badInputElements.push_back( elem );
} }
//=============================================================================
/*!
*
*/
//=============================================================================
int SMESH_Algo::NumberOfWires(const TopoDS_Shape& S)
{
int i = 0;
for (TopExp_Explorer exp(S,TopAbs_WIRE); exp.More(); exp.Next())
i++;
return i;
}
//=============================================================================
/*!
*
*/
//=============================================================================
int SMESH_Algo::NumberOfPoints(SMESH_Mesh& aMesh, const TopoDS_Wire& W)
{
int nbPoints = 0;
for (TopExp_Explorer exp(W,TopAbs_EDGE); exp.More(); exp.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
if(_quadraticMesh)
nb = nb/2;
nbPoints += nb + 1; // internal points plus 1 vertex of 2 (last point ?)
}
return nbPoints;
}

View File

@ -47,6 +47,7 @@ class SMESH_Gen;
class SMESH_Mesh; class SMESH_Mesh;
class SMESH_HypoFilter; class SMESH_HypoFilter;
class TopoDS_Vertex; class TopoDS_Vertex;
class TopoDS_Wire;
class TopoDS_Face; class TopoDS_Face;
class TopoDS_Shape; class TopoDS_Shape;
class SMESHDS_Mesh; class SMESHDS_Mesh;
@ -301,6 +302,9 @@ public:
*/ */
static bool FaceNormal(const SMDS_MeshElement* F, gp_XYZ& normal, bool normalized=true); static bool FaceNormal(const SMDS_MeshElement* F, gp_XYZ& normal, bool normalized=true);
static int NumberOfWires(const TopoDS_Shape& S);
int NumberOfPoints(SMESH_Mesh& aMesh,const TopoDS_Wire& W);
/*! /*!
* \brief Return continuity of two edges * \brief Return continuity of two edges
* \param E1 - the 1st edge * \param E1 - the 1st edge
@ -373,8 +377,8 @@ protected:
bool _requireShape; // work with GetDim()-1 mesh bound to geom only. Default TRUE bool _requireShape; // work with GetDim()-1 mesh bound to geom only. Default TRUE
bool _supportSubmeshes; // if !_requireDiscreteBoundary. Default FALSE bool _supportSubmeshes; // if !_requireDiscreteBoundary. Default FALSE
// quadratic mesh creation required, // indicates if quadratic mesh creation is required,
// is usually set trough SMESH_MesherHelper::IsQuadraticSubMesh() // is usually set like this: _quadraticMesh = SMESH_MesherHelper::IsQuadraticSubMesh(shape)
bool _quadraticMesh; bool _quadraticMesh;
int _error; //!< SMESH_ComputeErrorName or anything algo specific int _error; //!< SMESH_ComputeErrorName or anything algo specific
@ -384,4 +388,28 @@ protected:
volatile bool _computeCanceled; //!< is set to True while computing to stop it volatile bool _computeCanceled; //!< is set to True while computing to stop it
}; };
class SMESH_EXPORT SMESH_0D_Algo: public SMESH_Algo
{
public:
SMESH_0D_Algo(int hypId, int studyId, SMESH_Gen* gen);
};
class SMESH_EXPORT SMESH_1D_Algo: public SMESH_Algo
{
public:
SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen);
};
class SMESH_EXPORT SMESH_2D_Algo: public SMESH_Algo
{
public:
SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen);
};
class SMESH_EXPORT SMESH_3D_Algo: public SMESH_Algo
{
public:
SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen);
};
#endif #endif

View File

@ -43,9 +43,14 @@
#include "Utils_ExceptHandlers.hxx" #include "Utils_ExceptHandlers.hxx"
#include <TopoDS_Iterator.hxx> #include <TopoDS_Iterator.hxx>
#include <LDOMParser.hxx>
#include "memoire.h" #include "memoire.h"
#ifdef WNT
#include <windows.h>
#endif
using namespace std; using namespace std;
//============================================================================= //=============================================================================
@ -374,7 +379,9 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
{ {
SMESH_MesherHelper aHelper( aMesh ); SMESH_MesherHelper aHelper( aMesh );
if ( aHelper.IsQuadraticMesh() != SMESH_MesherHelper::LINEAR ) if ( aHelper.IsQuadraticMesh() != SMESH_MesherHelper::LINEAR )
aHelper.FixQuadraticElements(); {
aHelper.FixQuadraticElements( sm->GetComputeError() );
}
} }
return ret; return ret;
} }
@ -645,7 +652,8 @@ static bool checkMissing(SMESH_Gen* aGen,
set<SMESH_subMesh*>& aCheckedMap, set<SMESH_subMesh*>& aCheckedMap,
list< SMESH_Gen::TAlgoStateError > & theErrors) list< SMESH_Gen::TAlgoStateError > & theErrors)
{ {
if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX) if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX ||
aCheckedMap.count( aSubMesh ))
return true; return true;
//MESSAGE("=====checkMissing"); //MESSAGE("=====checkMissing");
@ -701,8 +709,15 @@ static bool checkMissing(SMESH_Gen* aGen,
break; break;
} }
case SMESH_subMesh::HYP_OK: case SMESH_subMesh::HYP_OK:
algo = aGen->GetAlgo( aMesh, aSubMesh->GetSubShape() ); algo = aSubMesh->GetAlgo();
ret = true; ret = true;
if (!algo->NeedDiscreteBoundary())
{
SMESH_subMeshIteratorPtr itsub = aSubMesh->getDependsOnIterator( /*includeSelf=*/false,
/*complexShapeFirst=*/false);
while ( itsub->more() )
aCheckedMap.insert( itsub->next() );
}
break; break;
default: ASSERT(0); default: ASSERT(0);
} }
@ -721,7 +736,6 @@ static bool checkMissing(SMESH_Gen* aGen,
{ {
// sub-meshes should not be checked further more // sub-meshes should not be checked further more
SMESH_subMesh* sm = itsub->next(); SMESH_subMesh* sm = itsub->next();
aCheckedMap.insert( sm );
if (isTopLocalAlgo) if (isTopLocalAlgo)
{ {
@ -735,6 +749,7 @@ static bool checkMissing(SMESH_Gen* aGen,
checkNoAlgo2 = false; checkNoAlgo2 = false;
} }
} }
aCheckedMap.insert( sm );
} }
} }
return ret; return ret;
@ -768,9 +783,9 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
bool ret = true; bool ret = true;
bool hasAlgo = false; bool hasAlgo = false;
SMESH_subMesh* sm = theMesh.GetSubMesh(theShape); SMESH_subMesh* sm = theMesh.GetSubMesh(theShape);
const SMESHDS_Mesh* meshDS = theMesh.GetMeshDS(); const SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
TopoDS_Shape mainShape = meshDS->ShapeToMesh(); TopoDS_Shape mainShape = meshDS->ShapeToMesh();
// ----------------- // -----------------
// get global algos // get global algos
@ -896,6 +911,177 @@ bool SMESH_Gen::IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& a
return aMesh.GetHypothesis( aMesh.GetMeshDS()->ShapeToMesh(), filter, false ); return aMesh.GetHypothesis( aMesh.GetMeshDS()->ShapeToMesh(), filter, false );
} }
//================================================================================
/*!
* \brief Return paths to xml files of plugins
*/
//================================================================================
std::vector< std::string > SMESH_Gen::GetPluginXMLPaths()
{
// Get paths to xml files of plugins
vector< string > xmlPaths;
string sep;
if ( const char* meshersList = getenv("SMESH_MeshersList") )
{
string meshers = meshersList, plugin;
string::size_type from = 0, pos;
while ( from < meshers.size() )
{
// cut off plugin name
pos = meshers.find( ':', from );
if ( pos != string::npos )
plugin = meshers.substr( from, pos-from );
else
plugin = meshers.substr( from ), pos = meshers.size();
from = pos + 1;
// get PLUGIN_ROOT_DIR path
string rootDirVar, pluginSubDir = plugin;
if ( plugin == "StdMeshers" )
rootDirVar = "SMESH", pluginSubDir = "smesh";
else
for ( pos = 0; pos < plugin.size(); ++pos )
rootDirVar += toupper( plugin[pos] );
rootDirVar += "_ROOT_DIR";
const char* rootDir = getenv( rootDirVar.c_str() );
if ( !rootDir || strlen(rootDir) == 0 )
{
rootDirVar = plugin + "_ROOT_DIR"; // HexoticPLUGIN_ROOT_DIR
rootDir = getenv( rootDirVar.c_str() );
if ( !rootDir || strlen(rootDir) == 0 ) continue;
}
// get a separator from rootDir
for ( pos = strlen( rootDir )-1; pos >= 0 && sep.empty(); --pos )
if ( rootDir[pos] == '/' || rootDir[pos] == '\\' )
{
sep = rootDir[pos];
break;
}
#ifdef WNT
if (sep.empty() ) sep = "\\";
#else
if (sep.empty() ) sep = "/";
#endif
// get a path to resource file
string xmlPath = rootDir;
if ( xmlPath[ xmlPath.size()-1 ] != sep[0] )
xmlPath += sep;
xmlPath += "share" + sep + "salome" + sep + "resources" + sep;
for ( pos = 0; pos < pluginSubDir.size(); ++pos )
xmlPath += tolower( pluginSubDir[pos] );
xmlPath += sep + plugin + ".xml";
bool fileOK;
#ifdef WNT
fileOK = (GetFileAttributes(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES);
#else
fileOK = (access(xmlPath.c_str(), F_OK) == 0);
#endif
if ( fileOK )
xmlPaths.push_back( xmlPath );
}
}
return xmlPaths;
}
//=======================================================================
namespace // Access to type of input and output of an algorithm
//=======================================================================
{
struct AlgoData
{
int _dim;
set<SMDSAbs_GeometryType> _inElemTypes; // acceptable types of input mesh element
set<SMDSAbs_GeometryType> _outElemTypes; // produced types of mesh elements
bool IsCompatible( const AlgoData& algo2 ) const
{
if ( _dim > algo2._dim ) return algo2.IsCompatible( *this );
// algo2 is of highter dimension
if ( _outElemTypes.empty() || algo2._inElemTypes.empty() )
return false;
bool compatible = true;
set<SMDSAbs_GeometryType>::const_iterator myOutType = _outElemTypes.begin();
for ( ; myOutType != _outElemTypes.end() && compatible; ++myOutType )
compatible = algo2._inElemTypes.count( *myOutType );
return compatible;
}
};
//================================================================================
/*!
* \brief Return AlgoData of the algorithm
*/
//================================================================================
const AlgoData& getAlgoData( const SMESH_Algo* algo )
{
static map< string, AlgoData > theDataByName;
if ( theDataByName.empty() )
{
// Read Plugin.xml files
vector< string > xmlPaths = SMESH_Gen::GetPluginXMLPaths();
LDOMParser xmlParser;
for ( size_t iXML = 0; iXML < xmlPaths.size(); ++iXML )
{
bool error = xmlParser.parse( xmlPaths[iXML].c_str() );
if ( error )
{
TCollection_AsciiString data;
INFOS( xmlParser.GetError(data) );
continue;
}
// <algorithm type="Regular_1D"
// ...
// input="EDGE"
// output="QUAD,TRIA">
//
LDOM_Document xmlDoc = xmlParser.getDocument();
LDOM_NodeList algoNodeList = xmlDoc.getElementsByTagName( "algorithm" );
for ( int i = 0; i < algoNodeList.getLength(); ++i )
{
LDOM_Node algoNode = algoNodeList.item( i );
LDOM_Element& algoElem = (LDOM_Element&) algoNode;
TCollection_AsciiString algoType = algoElem.getAttribute("type");
TCollection_AsciiString input = algoElem.getAttribute("input");
TCollection_AsciiString output = algoElem.getAttribute("output");
TCollection_AsciiString dim = algoElem.getAttribute("dim");
if ( algoType.IsEmpty() ) continue;
AlgoData & data = theDataByName[ algoType.ToCString() ];
data._dim = dim.IntegerValue();
for ( int isInput = 0; isInput < 2; ++isInput )
{
TCollection_AsciiString& typeStr = isInput ? input : output;
set<SMDSAbs_GeometryType>& typeSet = isInput ? data._inElemTypes : data._outElemTypes;
int beg = 1, end;
while ( beg <= typeStr.Length() )
{
while ( beg < typeStr.Length() && !isalpha( typeStr.Value( beg ) ))
++beg;
end = beg;
while ( end < typeStr.Length() && isalpha( typeStr.Value( end + 1 ) ))
++end;
if ( end > beg )
{
TCollection_AsciiString typeName = typeStr.SubString( beg, end );
if ( typeName == "EDGE" ) typeSet.insert( SMDSGeom_EDGE );
else if ( typeName == "TRIA" ) typeSet.insert( SMDSGeom_TRIANGLE );
else if ( typeName == "QUAD" ) typeSet.insert( SMDSGeom_QUADRANGLE );
}
beg = end + 1;
}
}
}
}
}
return theDataByName[ algo->GetName() ];
}
}
//============================================================================= //=============================================================================
/*! /*!
* Finds algo to mesh a shape. Optionally returns a shape the found algo is bound to * Finds algo to mesh a shape. Optionally returns a shape the found algo is bound to
@ -909,7 +1095,63 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh,
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() ); SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter.And( filter.IsApplicableTo( aShape )); filter.And( filter.IsApplicableTo( aShape ));
return (SMESH_Algo*) aMesh.GetHypothesis( aShape, filter, true, assignedTo ); TopoDS_Shape assignedToShape;
SMESH_Algo* algo =
(SMESH_Algo*) aMesh.GetHypothesis( aShape, filter, true, &assignedToShape );
if ( algo &&
aShape.ShapeType() == TopAbs_FACE &&
!aShape.IsSame( assignedToShape ) &&
SMESH_MesherHelper::NbAncestors( aShape, aMesh, TopAbs_SOLID ) > 1 )
{
// Issue 0021559. If there is another 2D algo with different types of output
// elements that can be used to mesh aShape, and 3D algos on adjacent SOLIDs
// have different types of input elements, we choose a most appropriate 2D algo.
// try to find a concurrent 2D algo
filter.AndNot( filter.Is( algo ));
TopoDS_Shape assignedToShape2;
SMESH_Algo* algo2 =
(SMESH_Algo*) aMesh.GetHypothesis( aShape, filter, true, &assignedToShape2 );
if ( algo2 && // algo found
!assignedToShape2.IsSame( aMesh.GetShapeToMesh() ) && // algo is local
( SMESH_MesherHelper::GetGroupType( assignedToShape2 ) == // algo of the same level
SMESH_MesherHelper::GetGroupType( assignedToShape )) &&
aMesh.IsOrderOK( aMesh.GetSubMesh( assignedToShape2 ), // no forced order
aMesh.GetSubMesh( assignedToShape )))
{
// get algos on the adjacent SOLIDs
filter.Init( filter.IsAlgo() ).And( filter.HasDim( 3 ));
vector< SMESH_Algo* > algos3D;
PShapeIteratorPtr solidIt = SMESH_MesherHelper::GetAncestors( aShape, aMesh,
TopAbs_SOLID );
while ( const TopoDS_Shape* solid = solidIt->next() )
if ( SMESH_Algo* algo3D = (SMESH_Algo*) aMesh.GetHypothesis( *solid, filter, true ))
{
algos3D.push_back( algo3D );
filter.AndNot( filter.HasName( algo3D->GetName() ));
}
// check compatibility of algos
if ( algos3D.size() > 1 )
{
const AlgoData& algoData = getAlgoData( algo );
const AlgoData& algoData2 = getAlgoData( algo2 );
const AlgoData& algoData3d0 = getAlgoData( algos3D[0] );
const AlgoData& algoData3d1 = getAlgoData( algos3D[1] );
if (( algoData2.IsCompatible( algoData3d0 ) &&
algoData2.IsCompatible( algoData3d1 ))
&&
!(algoData.IsCompatible( algoData3d0 ) &&
algoData.IsCompatible( algoData3d1 )))
algo = algo2;
}
}
}
if ( assignedTo && algo )
* assignedTo = assignedToShape;
return algo;
} }
//============================================================================= //=============================================================================

View File

@ -35,10 +35,6 @@
#include "SMESH_Hypothesis.hxx" #include "SMESH_Hypothesis.hxx"
#include "SMESH_ComputeError.hxx" #include "SMESH_ComputeError.hxx"
#include "SMESH_Algo.hxx" #include "SMESH_Algo.hxx"
#include "SMESH_0D_Algo.hxx"
#include "SMESH_1D_Algo.hxx"
#include "SMESH_2D_Algo.hxx"
#include "SMESH_3D_Algo.hxx"
#include "SMESH_Mesh.hxx" #include "SMESH_Mesh.hxx"
#include "chrono.hxx" #include "chrono.hxx"
@ -47,6 +43,8 @@
#include <map> #include <map>
#include <list> #include <list>
#include <vector>
#include <string>
class SMESHDS_Document; class SMESHDS_Document;
@ -144,9 +142,13 @@ public:
static int GetShapeDim(const TopAbs_ShapeEnum & aShapeType); static int GetShapeDim(const TopAbs_ShapeEnum & aShapeType);
static int GetShapeDim(const TopoDS_Shape & aShape) static int GetShapeDim(const TopoDS_Shape & aShape)
{ return GetShapeDim( aShape.ShapeType() ); } { return GetShapeDim( aShape.ShapeType() ); }
SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0); SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0);
static bool IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh); static bool IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh);
static std::vector< std::string > GetPluginXMLPaths();
int GetANewId(); int GetANewId();
std::map < int, SMESH_Algo * >_mapAlgo; std::map < int, SMESH_Algo * >_mapAlgo;

View File

@ -24,7 +24,6 @@
// File : SMESH_Group.cxx // File : SMESH_Group.cxx
// Author : Michael Sazonov (OCC) // Author : Michael Sazonov (OCC)
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "SMESH_Group.hxx" #include "SMESH_Group.hxx"
#include "SMESH_Mesh.hxx" #include "SMESH_Mesh.hxx"
@ -60,6 +59,7 @@ SMESH_Group::SMESH_Group (int theID,
myGroupDS = new SMESHDS_Group (theID, myGroupDS = new SMESHDS_Group (theID,
const_cast<SMESH_Mesh*>(theMesh)->GetMeshDS(), const_cast<SMESH_Mesh*>(theMesh)->GetMeshDS(),
theType); theType);
myGroupDS->SetStoreName( theName );
} }
//================================================================================ //================================================================================
@ -76,7 +76,7 @@ SMESH_Group::SMESH_Group (SMESHDS_GroupBase* groupDS): myGroupDS( groupDS )
//============================================================================= //=============================================================================
/*! /*!
* * Destructor deletes myGroupDS
*/ */
//============================================================================= //=============================================================================
@ -84,3 +84,15 @@ SMESH_Group::~SMESH_Group ()
{ {
delete myGroupDS; myGroupDS=0; delete myGroupDS; myGroupDS=0;
} }
//================================================================================
/*!
* \brief Sets a new name
*/
//================================================================================
void SMESH_Group::SetName (const char* theName)
{
myName = theName;
myGroupDS->SetStoreName( theName );
}

View File

@ -52,7 +52,7 @@ class SMESH_EXPORT SMESH_Group
SMESH_Group (SMESHDS_GroupBase* groupDS); SMESH_Group (SMESHDS_GroupBase* groupDS);
~SMESH_Group (); ~SMESH_Group ();
void SetName (const char* theName) { myName = theName; } void SetName (const char* theName);
const char* GetName () const { return myName.c_str(); } const char* GetName () const { return myName.c_str(); }

View File

@ -43,7 +43,6 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
int studyId, int studyId,
SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId) SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId)
{ {
//MESSAGE("SMESH_Hypothesis::SMESH_Hypothesis");
_gen = gen; _gen = gen;
_studyId = studyId; _studyId = studyId;
StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId); StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
@ -51,9 +50,8 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
_type = PARAM_ALGO; _type = PARAM_ALGO;
_shapeType = 0; // to be set by algo with TopAbs_Enum _shapeType = 0; // to be set by algo with TopAbs_Enum
_param_algo_dim = -1; // to be set by algo parameter _param_algo_dim = -1; // to be set by algo parameter
_parameters = string(); //_parameters = string();
_lastParameters = string(); //_lastParameters = string();
_libName = string();
} }
//============================================================================= //=============================================================================
@ -65,6 +63,8 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
SMESH_Hypothesis::~SMESH_Hypothesis() SMESH_Hypothesis::~SMESH_Hypothesis()
{ {
MESSAGE("SMESH_Hypothesis::~SMESH_Hypothesis"); MESSAGE("SMESH_Hypothesis::~SMESH_Hypothesis");
StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
myStudyContext->mapHypothesis[_hypId] = 0;
} }
//============================================================================= //=============================================================================
@ -177,53 +177,53 @@ SMESH_Mesh* SMESH_Hypothesis::GetMeshByPersistentID(int id)
* *
*/ */
//============================================================================= //=============================================================================
void SMESH_Hypothesis::SetParameters(const char *theParameters) // void SMESH_Hypothesis::SetParameters(const char *theParameters)
{ // {
string aNewParameters(theParameters); // string aNewParameters(theParameters);
if(aNewParameters.size()==0 && _parameters.size()==0) // if(aNewParameters.size()==0 && _parameters.size()==0)
aNewParameters = " "; // aNewParameters = " ";
if(_parameters.size()>0) // if(_parameters.size()>0)
_parameters +="|"; // _parameters +="|";
_parameters +=aNewParameters; // _parameters +=aNewParameters;
SetLastParameters(theParameters); // SetLastParameters(theParameters);
} // }
//============================================================================= // //=============================================================================
/*! // /*!
* // *
*/ // */
//============================================================================= // //=============================================================================
void SMESH_Hypothesis::ClearParameters() // void SMESH_Hypothesis::ClearParameters()
{ // {
_parameters = string(); // _parameters = string();
} // }
//============================================================================= // //=============================================================================
/*! // /*!
* // *
*/ // */
//============================================================================= // //=============================================================================
char* SMESH_Hypothesis::GetParameters() const // char* SMESH_Hypothesis::GetParameters() const
{ // {
return (char*)_parameters.c_str(); // return (char*)_parameters.c_str();
} // }
//============================================================================= // //=============================================================================
/*! // /*!
* // *
*/ // */
//============================================================================= // //=============================================================================
char* SMESH_Hypothesis::GetLastParameters() const // char* SMESH_Hypothesis::GetLastParameters() const
{ // {
return (char*)_lastParameters.c_str(); // return (char*)_lastParameters.c_str();
} // }
//============================================================================= // //=============================================================================
/*! // /*!
* // *
*/ // */
//============================================================================= // //=============================================================================
void SMESH_Hypothesis::SetLastParameters(const char* theParameters) // void SMESH_Hypothesis::SetLastParameters(const char* theParameters)
{ // {
_lastParameters = string(theParameters); // _lastParameters = string(theParameters);
} // }

View File

@ -51,7 +51,7 @@ public:
{ {
HYP_OK = 0, HYP_OK = 0,
HYP_MISSING, // algo misses a hypothesis HYP_MISSING, // algo misses a hypothesis
HYP_CONCURENT, // several applicable hypotheses HYP_CONCURENT, // several applicable hypotheses assigned to father shapes
HYP_BAD_PARAMETER,// hypothesis has a bad parameter value HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements
HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements
@ -59,7 +59,7 @@ public:
// for Add/RemoveHypothesis operations // for Add/RemoveHypothesis operations
HYP_INCOMPATIBLE, // hypothesis does not fit algo HYP_INCOMPATIBLE, // hypothesis does not fit algo
HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
HYP_ALREADY_EXIST,// such hypothesis already exist HYP_ALREADY_EXIST,// several applicable hypothesis of same priority assigned
HYP_BAD_DIM, // bad dimension HYP_BAD_DIM, // bad dimension
HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its sub-shape, nor a group HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its sub-shape, nor a group
HYP_BAD_GEOMETRY, // shape geometry mismatches algorithm's expectation HYP_BAD_GEOMETRY, // shape geometry mismatches algorithm's expectation
@ -77,12 +77,12 @@ public:
virtual const char* GetLibName() const; virtual const char* GetLibName() const;
void SetLibName(const char* theLibName); void SetLibName(const char* theLibName);
void SetParameters(const char *theParameters); //void SetParameters(const char *theParameters);
char* GetParameters() const; //char* GetParameters() const;
void SetLastParameters(const char* theParameters); // void SetLastParameters(const char* theParameters);
char* GetLastParameters() const; // char* GetLastParameters() const;
void ClearParameters(); // void ClearParameters();
/*! /*!
* \brief Initialize my parameter values by the mesh built on the geometry * \brief Initialize my parameter values by the mesh built on the geometry
@ -122,14 +122,14 @@ public:
protected: protected:
SMESH_Gen* _gen; SMESH_Gen* _gen;
int _studyId; int _studyId;
int _shapeType; int _shapeType;
int _param_algo_dim; // to be set at descendant hypothesis constructor int _param_algo_dim; // to be set at descendant hypothesis constructor
private: private:
std::string _libName; std::string _libName; // name of library of plug-in Engine
std::string _parameters; //std::string _parameters;
std::string _lastParameters; //std::string _lastParameters;
}; };
#endif #endif

View File

@ -40,14 +40,15 @@
#include "utilities.h" #include "utilities.h"
#include "DriverMED_W_SMESHDS_Mesh.h"
#include "DriverDAT_W_SMDS_Mesh.h" #include "DriverDAT_W_SMDS_Mesh.h"
#include "DriverUNV_W_SMDS_Mesh.h" #include "DriverGMF_Read.hxx"
#include "DriverSTL_W_SMDS_Mesh.h" #include "DriverGMF_Write.hxx"
#include "DriverMED_R_SMESHDS_Mesh.h" #include "DriverMED_R_SMESHDS_Mesh.h"
#include "DriverUNV_R_SMDS_Mesh.h" #include "DriverMED_W_SMESHDS_Mesh.h"
#include "DriverSTL_R_SMDS_Mesh.h" #include "DriverSTL_R_SMDS_Mesh.h"
#include "DriverSTL_W_SMDS_Mesh.h"
#include "DriverUNV_R_SMDS_Mesh.h"
#include "DriverUNV_W_SMDS_Mesh.h"
#ifdef WITH_CGNS #ifdef WITH_CGNS
#include "DriverCGNS_Read.hxx" #include "DriverCGNS_Read.hxx"
#include "DriverCGNS_Write.hxx" #include "DriverCGNS_Write.hxx"
@ -538,6 +539,26 @@ int SMESH_Mesh::CGNSToMesh(const char* theFileName,
return res; return res;
} }
//================================================================================
/*!
* \brief Fill its data by reading a GMF file
*/
//================================================================================
SMESH_ComputeErrorPtr SMESH_Mesh::GMFToMesh(const char* theFileName)
{
DriverGMF_Read myReader;
myReader.SetMesh(_myMeshDS);
myReader.SetFile(theFileName);
myReader.Perform();
//theMeshName = myReader.GetMeshName();
// create groups
SynchronizeGroups();
return myReader.GetError();
}
//============================================================================= //=============================================================================
/*! /*!
* *
@ -1391,6 +1412,21 @@ void SMESH_Mesh::ExportCGNS(const char * file,
throw SALOME_Exception("Export failed"); throw SALOME_Exception("Export failed");
} }
//================================================================================
/*!
* \brief Export the mesh to a GMF file
*/
//================================================================================
void SMESH_Mesh::ExportGMF(const char * file,
const SMESHDS_Mesh* meshDS)
{
DriverGMF_Write myWriter;
myWriter.SetFile( file );
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
myWriter.Perform();
}
//================================================================================ //================================================================================
/*! /*!
* \brief Return number of nodes in the mesh * \brief Return number of nodes in the mesh
@ -1651,6 +1687,35 @@ SMESH_Group* SMESH_Mesh::AddGroup (const SMDSAbs_ElementType theType,
return aGroup; return aGroup;
} }
//================================================================================
/*!
* \brief Creates a group based on an existing SMESHDS group. Group ID should be unique
*/
//================================================================================
SMESH_Group* SMESH_Mesh::AddGroup (SMESHDS_GroupBase* groupDS) throw(SALOME_Exception)
{
if ( !groupDS )
throw SALOME_Exception(LOCALIZED ("SMESH_Mesh::AddGroup(): NULL SMESHDS_GroupBase"));
map <int, SMESH_Group*>::iterator i_g = _mapGroup.find( groupDS->GetID() );
if ( i_g != _mapGroup.end() && i_g->second )
{
if ( i_g->second->GetGroupDS() == groupDS )
return i_g->second;
else
throw SALOME_Exception(LOCALIZED ("SMESH_Mesh::AddGroup() wrong ID of SMESHDS_GroupBase"));
}
SMESH_Group* aGroup = new SMESH_Group (groupDS);
_mapGroup[ groupDS->GetID() ] = aGroup;
GetMeshDS()->AddGroup( aGroup->GetGroupDS() );
_groupId = 1 + _mapGroup.rbegin()->first;
return aGroup;
}
//================================================================================ //================================================================================
/*! /*!
* \brief Creates SMESH_Groups for not wrapped SMESHDS_Groups * \brief Creates SMESH_Groups for not wrapped SMESHDS_Groups
@ -1955,6 +2020,13 @@ void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape)
(TopAbs_ShapeEnum) ancType, (TopAbs_ShapeEnum) ancType,
_mapAncestors ); _mapAncestors );
} }
// visit COMPOUNDs inside a COMPOUND that are not reachable by TopExp_Explorer
if ( theShape.ShapeType() == TopAbs_COMPOUND )
{
for ( TopoDS_Iterator sIt(theShape); sIt.More(); sIt.Next() )
if ( sIt.Value().ShapeType() == TopAbs_COMPOUND )
fillAncestorsMap( sIt.Value() );
}
} }
//============================================================================= //=============================================================================
@ -1977,9 +2049,9 @@ bool SMESH_Mesh::SortByMeshOrder(list<SMESH_subMesh*>& theListToSort) const
typedef list<SMESH_subMesh*>::iterator TPosInList; typedef list<SMESH_subMesh*>::iterator TPosInList;
map< int, TPosInList > sortedPos; map< int, TPosInList > sortedPos;
TPosInList smBeg = theListToSort.begin(), smEnd = theListToSort.end(); TPosInList smBeg = theListToSort.begin(), smEnd = theListToSort.end();
TListOfListOfInt::const_iterator listIddIt = _mySubMeshOrder.begin(); TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin();
for( ; listIddIt != _mySubMeshOrder.end(); listIddIt++) { for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++) {
const TListOfInt& listOfId = *listIddIt; const TListOfInt& listOfId = *listIdsIt;
TListOfInt::const_iterator idIt = listOfId.begin(); TListOfInt::const_iterator idIt = listOfId.begin();
for ( ; idIt != listOfId.end(); idIt++ ) { for ( ; idIt != listOfId.end(); idIt++ ) {
if ( SMESH_subMesh * sm = GetSubMeshContaining( *idIt )) { if ( SMESH_subMesh * sm = GetSubMeshContaining( *idIt )) {
@ -2006,6 +2078,30 @@ bool SMESH_Mesh::SortByMeshOrder(list<SMESH_subMesh*>& theListToSort) const
return res; return res;
} }
//================================================================================
/*!
* \brief Return true if given order of sub-meshes is OK
*/
//================================================================================
bool SMESH_Mesh::IsOrderOK( const SMESH_subMesh* smBefore,
const SMESH_subMesh* smAfter ) const
{
TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin();
TListOfInt::const_iterator idBef, idAft;
for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++)
{
const TListOfInt& listOfId = *listIdsIt;
idBef = std::find( listOfId.begin(), listOfId.end(), smBefore->GetId() );
if ( idBef != listOfId.end() )
idAft = std::find( listOfId.begin(), listOfId.end(), smAfter->GetId() );
if ( idAft != listOfId.end () )
return ( std::distance( listOfId.begin(), idBef ) <
std::distance( listOfId.begin(), idAft ) );
}
return true; // no order imposed to given submeshes
}
//============================================================================= //=============================================================================
/*! /*!
* \brief sort submeshes according to stored mesh order * \brief sort submeshes according to stored mesh order
@ -2014,8 +2110,8 @@ bool SMESH_Mesh::SortByMeshOrder(list<SMESH_subMesh*>& theListToSort) const
*/ */
//============================================================================= //=============================================================================
list<SMESH_subMesh*> SMESH_Mesh::getAncestorsSubMeshes list<SMESH_subMesh*>
(const TopoDS_Shape& theSubShape) const SMESH_Mesh::getAncestorsSubMeshes (const TopoDS_Shape& theSubShape) const
{ {
list<SMESH_subMesh*> listOfSubMesh; list<SMESH_subMesh*> listOfSubMesh;
TopTools_ListIteratorOfListOfShape it( GetAncestors( theSubShape )); TopTools_ListIteratorOfListOfShape it( GetAncestors( theSubShape ));

View File

@ -29,12 +29,12 @@
#include "SMESH_SMESH.hxx" #include "SMESH_SMESH.hxx"
#include "SMESH_Hypothesis.hxx"
#include "SMESH_Controls.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_Command.hxx"
#include "SMDSAbs_ElementType.hxx" #include "SMDSAbs_ElementType.hxx"
#include "SMESHDS_Command.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESH_ComputeError.hxx"
#include "SMESH_Controls.hxx"
#include "SMESH_Hypothesis.hxx"
#include "Utils_SALOME_Exception.hxx" #include "Utils_SALOME_Exception.hxx"
@ -44,6 +44,7 @@
#include <map> #include <map>
#include <list> #include <list>
#ifdef WNT #ifdef WNT
#pragma warning(disable:4251) // Warning DLL Interface ... #pragma warning(disable:4251) // Warning DLL Interface ...
#pragma warning(disable:4290) // Warning Exception ... #pragma warning(disable:4290) // Warning Exception ...
@ -121,6 +122,8 @@ public:
int CGNSToMesh(const char* theFileName, const int theMeshIndex, std::string& theMeshName); int CGNSToMesh(const char* theFileName, const int theMeshIndex, std::string& theMeshName);
SMESH_ComputeErrorPtr GMFToMesh(const char* theFileName);
SMESH_Hypothesis::Hypothesis_Status SMESH_Hypothesis::Hypothesis_Status
AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId) AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
throw(SALOME_Exception); throw(SALOME_Exception);
@ -240,6 +243,8 @@ public:
const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception); const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception);
void ExportCGNS(const char * file, void ExportCGNS(const char * file,
const SMESHDS_Mesh* mesh); const SMESHDS_Mesh* mesh);
void ExportGMF(const char * file,
const SMESHDS_Mesh* mesh);
void ExportSAUV(const char *file, void ExportSAUV(const char *file,
const char* theMeshName = NULL, const char* theMeshName = NULL,
bool theAutoGroups = true) throw(SALOME_Exception); bool theAutoGroups = true) throw(SALOME_Exception);
@ -287,7 +292,9 @@ public:
int& theId, int& theId,
const TopoDS_Shape& theShape=TopoDS_Shape(), const TopoDS_Shape& theShape=TopoDS_Shape(),
const SMESH_PredicatePtr& thePredicate=SMESH_PredicatePtr()); const SMESH_PredicatePtr& thePredicate=SMESH_PredicatePtr());
SMESH_Group* AddGroup (SMESHDS_GroupBase* groupDS) throw(SALOME_Exception);
typedef boost::shared_ptr< SMDS_Iterator<SMESH_Group*> > GroupIteratorPtr; typedef boost::shared_ptr< SMDS_Iterator<SMESH_Group*> > GroupIteratorPtr;
GroupIteratorPtr GetGroups() const; GroupIteratorPtr GetGroups() const;
@ -317,15 +324,13 @@ public:
void SetMeshOrder(const TListOfListOfInt& theOrder ); void SetMeshOrder(const TListOfListOfInt& theOrder );
const TListOfListOfInt& GetMeshOrder() const; const TListOfListOfInt& GetMeshOrder() const;
/*! // sort submeshes according to stored mesh order
* \brief sort submeshes according to stored mesh order
* \param theListToSort in out list to be sorted
* \return FALSE if nothing sorted
*/
bool SortByMeshOrder(std::list<SMESH_subMesh*>& theListToSort) const; bool SortByMeshOrder(std::list<SMESH_subMesh*>& theListToSort) const;
// // return true if given order of sub-meshes is OK
bool IsOrderOK( const SMESH_subMesh* smBefore,
const SMESH_subMesh* smAfter ) const;
ostream& Dump(ostream & save); ostream& Dump(ostream & save);
private: private:

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,7 @@
#include "SMESH_Controls.hxx" #include "SMESH_Controls.hxx"
#include "SMESH_Mesh.hxx" #include "SMESH_Mesh.hxx"
#include "SMESH_TypeDefs.hxx" #include "SMESH_TypeDefs.hxx"
#include "SMESH_ComputeError.hxx"
#include <utilities.h> #include <utilities.h>
@ -110,6 +111,14 @@ public:
SMESH_MeshEditor( SMESH_Mesh* theMesh ); SMESH_MeshEditor( SMESH_Mesh* theMesh );
SMESH_Mesh * GetMesh() { return myMesh; }
SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; }
const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; }
SMESH_ComputeErrorPtr & GetError() { return myError; }
/*! /*!
* \brief Add element * \brief Add element
*/ */
@ -561,14 +570,6 @@ public:
// Return an index of the shape theElem is on // Return an index of the shape theElem is on
// or zero if a shape not found // or zero if a shape not found
SMESH_Mesh * GetMesh() { return myMesh; }
SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; }
const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; }
bool DoubleNodes( const std::list< int >& theListOfNodes, bool DoubleNodes( const std::list< int >& theListOfNodes,
const std::list< int >& theListOfModifiedElems ); const std::list< int >& theListOfModifiedElems );
@ -576,6 +577,11 @@ public:
const TIDSortedElemSet& theNodesNot, const TIDSortedElemSet& theNodesNot,
const TIDSortedElemSet& theAffectedElems ); const TIDSortedElemSet& theAffectedElems );
bool AffectedElemGroupsInRegion( const TIDSortedElemSet& theElems,
const TIDSortedElemSet& theNodesNot,
const TopoDS_Shape& theShape,
TIDSortedElemSet& theAffectedElems);
bool DoubleNodesInRegion( const TIDSortedElemSet& theElems, bool DoubleNodesInRegion( const TIDSortedElemSet& theElems,
const TIDSortedElemSet& theNodesNot, const TIDSortedElemSet& theNodesNot,
const TopoDS_Shape& theShape ); const TopoDS_Shape& theShape );
@ -587,6 +593,13 @@ public:
bool CreateFlatElementsOnFacesGroups( const std::vector<TIDSortedElemSet>& theElems ); bool CreateFlatElementsOnFacesGroups( const std::vector<TIDSortedElemSet>& theElems );
void CreateHoleSkin(double radius,
const TopoDS_Shape& theShape,
SMESH_NodeSearcher* theNodeSearcher,
const char* groupName,
std::vector<double>& nodesCoords,
std::vector<std::vector<int> >& listOfListOfNodes);
/*! /*!
* \brief Generated skin mesh (containing 2D cells) from 3D mesh * \brief Generated skin mesh (containing 2D cells) from 3D mesh
* The created 2D mesh elements based on nodes of free faces of boundary volumes * The created 2D mesh elements based on nodes of free faces of boundary volumes
@ -709,18 +722,13 @@ public:
private: private:
SMESH_Mesh * myMesh; SMESH_Mesh * myMesh;
/*! // Nodes and elements created during last operation
* Sequence for keeping nodes created during last operation SMESH_SequenceOfElemPtr myLastCreatedNodes, myLastCreatedElems;
*/
SMESH_SequenceOfElemPtr myLastCreatedNodes;
/*!
* Sequence for keeping elements created during last operation
*/
SMESH_SequenceOfElemPtr myLastCreatedElems;
// Description of error/warning occured during last operation
SMESH_ComputeErrorPtr myError;
}; };
#endif #endif

View File

@ -26,13 +26,17 @@
// //
#include "SMESH_MesherHelper.hxx" #include "SMESH_MesherHelper.hxx"
#include "SMDS_FacePosition.hxx"
#include "SMDS_EdgePosition.hxx" #include "SMDS_EdgePosition.hxx"
#include "SMDS_FaceOfNodes.hxx"
#include "SMDS_FacePosition.hxx"
#include "SMDS_IteratorOnIterators.hxx"
#include "SMDS_VolumeTool.hxx" #include "SMDS_VolumeTool.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_ProxyMesh.hxx" #include "SMESH_ProxyMesh.hxx"
#include "SMESH_subMesh.hxx"
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx> #include <BRepAdaptor_Surface.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepTools.hxx> #include <BRepTools.hxx>
#include <BRepTools_WireExplorer.hxx> #include <BRepTools_WireExplorer.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
@ -403,7 +407,7 @@ void SMESH_MesherHelper::AddTLinks(const SMDS_MeshVolume* volume)
{ {
int iN1 = iNodes[i++]; int iN1 = iNodes[i++];
int iN12 = iNodes[i++]; int iN12 = iNodes[i++];
int iN2 = iNodes[i++]; int iN2 = iNodes[i];
if ( iN1 > iN2 ) std::swap( iN1, iN2 ); if ( iN1 > iN2 ) std::swap( iN1, iN2 );
int linkID = iN1 * vTool.NbNodes() + iN2; int linkID = iN1 * vTool.NbNodes() + iN2;
pair< set<int>::iterator, bool > it_isNew = addedLinks.insert( linkID ); pair< set<int>::iterator, bool > it_isNew = addedLinks.insert( linkID );
@ -1675,6 +1679,24 @@ SMESH_MesherHelper::AddPolyhedralVolume (const std::vector<const SMDS_MeshNode*>
return elem; return elem;
} }
namespace
{
//================================================================================
/*!
* \brief Check if a node belongs to any face of sub-mesh
*/
//================================================================================
bool isNodeInSubMesh( const SMDS_MeshNode* n, const SMESHDS_SubMesh* sm )
{
SMDS_ElemIteratorPtr fIt = n->GetInverseElementIterator( SMDSAbs_Face );
while ( fIt->more() )
if ( sm->Contains( fIt->next() ))
return true;
return false;
}
}
//======================================================================= //=======================================================================
//function : LoadNodeColumns //function : LoadNodeColumns
//purpose : Load nodes bound to face into a map of node columns //purpose : Load nodes bound to face into a map of node columns
@ -1746,13 +1768,36 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2
SMESH_Algo::GetSortedNodesOnEdge( theMesh, *edge,/*noMedium=*/true, sortedBaseNodes); SMESH_Algo::GetSortedNodesOnEdge( theMesh, *edge,/*noMedium=*/true, sortedBaseNodes);
if ( sortedBaseNodes.empty() ) continue; if ( sortedBaseNodes.empty() ) continue;
map< double, const SMDS_MeshNode*>::iterator u_n = sortedBaseNodes.begin();
if ( theProxyMesh ) // from sortedBaseNodes remove nodes not shared by faces of faceSubMesh
{
const SMDS_MeshNode* n1 = sortedBaseNodes.begin()->second;
const SMDS_MeshNode* n2 = sortedBaseNodes.rbegin()->second;
bool allNodesAreProxy = ( n1 != theProxyMesh->GetProxyNode( n1 ) &&
n2 != theProxyMesh->GetProxyNode( n2 ));
if ( allNodesAreProxy )
for ( u_n = sortedBaseNodes.begin(); u_n != sortedBaseNodes.end(); u_n++ )
u_n->second = theProxyMesh->GetProxyNode( u_n->second );
if ( u_n = sortedBaseNodes.begin(), !isNodeInSubMesh( u_n->second, faceSubMesh ))
{
while ( ++u_n != sortedBaseNodes.end() && !isNodeInSubMesh( u_n->second, faceSubMesh ));
sortedBaseNodes.erase( sortedBaseNodes.begin(), u_n );
}
else if ( u_n = --sortedBaseNodes.end(), !isNodeInSubMesh( u_n->second, faceSubMesh ))
{
while ( u_n != sortedBaseNodes.begin() && !isNodeInSubMesh( (--u_n)->second, faceSubMesh ));
sortedBaseNodes.erase( ++u_n, sortedBaseNodes.end() );
}
if ( sortedBaseNodes.empty() ) continue;
}
double f, l; double f, l;
BRep_Tool::Range( *edge, f, l ); BRep_Tool::Range( *edge, f, l );
if ( edge->Orientation() == TopAbs_REVERSED ) std::swap( f, l ); if ( edge->Orientation() == TopAbs_REVERSED ) std::swap( f, l );
const double coeff = 1. / ( l - f ) * length[iE] / fullLen; const double coeff = 1. / ( l - f ) * length[iE] / fullLen;
const double prevPar = theParam2ColumnMap.empty() ? 0 : theParam2ColumnMap.rbegin()->first; const double prevPar = theParam2ColumnMap.empty() ? 0 : theParam2ColumnMap.rbegin()->first;
map< double, const SMDS_MeshNode*>::iterator u_n = sortedBaseNodes.begin(); for ( u_n = sortedBaseNodes.begin(); u_n != sortedBaseNodes.end(); u_n++ )
for ( ; u_n != sortedBaseNodes.end(); u_n++ )
{ {
double par = prevPar + coeff * ( u_n->first - f ); double par = prevPar + coeff * ( u_n->first - f );
TParam2ColumnMap::iterator u2nn = TParam2ColumnMap::iterator u2nn =
@ -1760,21 +1805,16 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2
u2nn->second.push_back( u_n->second ); u2nn->second.push_back( u_n->second );
} }
} }
TParam2ColumnMap::iterator par_nVec_2, par_nVec_1 = theParam2ColumnMap.begin(); if ( theParam2ColumnMap.empty() )
if ( theProxyMesh ) return false;
{
for ( ; par_nVec_1 != theParam2ColumnMap.end(); ++par_nVec_1 )
{
const SMDS_MeshNode* & n = par_nVec_1->second[0];
n = theProxyMesh->GetProxyNode( n );
}
}
int nbRows = 1 + faceSubMesh->NbElements() / ( theParam2ColumnMap.size()-1 ); int nbRows = 1 + faceSubMesh->NbElements() / ( theParam2ColumnMap.size()-1 );
// fill theParam2ColumnMap column by column by passing from nodes on // fill theParam2ColumnMap column by column by passing from nodes on
// theBaseEdge up via mesh faces on theFace // theBaseEdge up via mesh faces on theFace
TParam2ColumnMap::iterator par_nVec_1, par_nVec_2;
par_nVec_2 = theParam2ColumnMap.begin(); par_nVec_2 = theParam2ColumnMap.begin();
par_nVec_1 = par_nVec_2++; par_nVec_1 = par_nVec_2++;
TIDSortedElemSet emptySet, avoidSet; TIDSortedElemSet emptySet, avoidSet;
@ -1947,6 +1987,30 @@ TopoDS_Vertex SMESH_MesherHelper::IthVertex( const bool is2nd,
return ( vIt.More() ? TopoDS::Vertex(vIt.Value()) : TopoDS_Vertex() ); return ( vIt.More() ? TopoDS::Vertex(vIt.Value()) : TopoDS_Vertex() );
} }
//================================================================================
/*!
* \brief Return type of shape contained in a group
* \param group - a shape of type TopAbs_COMPOUND
* \param avoidCompound - not to return TopAbs_COMPOUND
*/
//================================================================================
TopAbs_ShapeEnum SMESH_MesherHelper::GetGroupType(const TopoDS_Shape& group,
const bool avoidCompound)
{
if ( !group.IsNull() )
{
if ( group.ShapeType() != TopAbs_COMPOUND )
return group.ShapeType();
// iterate on a compound
TopoDS_Iterator it( group );
if ( it.More() )
return avoidCompound ? GetGroupType( it.Value() ) : it.Value().ShapeType();
}
return TopAbs_SHAPE;
}
//======================================================================= //=======================================================================
//function : IsQuadraticMesh //function : IsQuadraticMesh
//purpose : Check mesh without geometry for: if all elements on this shape are quadratic, //purpose : Check mesh without geometry for: if all elements on this shape are quadratic,
@ -1961,6 +2025,8 @@ SMESH_MesherHelper:: MType SMESH_MesherHelper::IsQuadraticMesh()
int NbFacesAndEdges=0; int NbFacesAndEdges=0;
//All faces and edges //All faces and edges
NbAllEdgsAndFaces = myMesh->NbEdges() + myMesh->NbFaces(); NbAllEdgsAndFaces = myMesh->NbEdges() + myMesh->NbFaces();
if ( NbAllEdgsAndFaces == 0 )
return SMESH_MesherHelper::LINEAR;
//Quadratic faces and edges //Quadratic faces and edges
NbQuadFacesAndEdgs = myMesh->NbEdges(ORDER_QUADRATIC) + myMesh->NbFaces(ORDER_QUADRATIC); NbQuadFacesAndEdgs = myMesh->NbEdges(ORDER_QUADRATIC) + myMesh->NbFaces(ORDER_QUADRATIC);
@ -3021,18 +3087,349 @@ namespace { // Structures used by FixQuadraticElements()
return _OK; return _OK;
} }
//================================================================================
/*!
* \brief Place medium nodes at the link middle for elements whose corner nodes
* are out of geometrical boundary to prevent distorting elements.
* Issue 0020982, note 0013990
*/
//================================================================================
void force3DOutOfBoundary( SMESH_MesherHelper& theHelper,
SMESH_ComputeErrorPtr& theError)
{
SMESHDS_Mesh* meshDS = theHelper.GetMeshDS();
TopoDS_Shape shape = theHelper.GetSubShape().Oriented( TopAbs_FORWARD );
if ( shape.IsNull() ) return;
if ( !theError ) theError = SMESH_ComputeError::New();
gp_XYZ faceNorm;
if ( shape.ShapeType() == TopAbs_FACE ) // 2D
{
if ( theHelper.GetMesh()->NbTriangles( ORDER_QUADRATIC ) < 1 ) return;
SMESHDS_SubMesh* faceSM = meshDS->MeshElements( shape );
if ( !faceSM ) return;
const TopoDS_Face& face = TopoDS::Face( shape );
Handle(Geom_Surface) surface = BRep_Tool::Surface( face );
TopExp_Explorer edgeIt( face, TopAbs_EDGE );
for ( ; edgeIt.More(); edgeIt.Next() ) // loop on EDGEs of a FACE
{
// check if the EDGE needs checking
const TopoDS_Edge& edge = TopoDS::Edge( edgeIt.Current() );
if ( BRep_Tool::Degenerated( edge ) )
continue;
if ( theHelper.IsRealSeam( edge ) &&
edge.Orientation() == TopAbs_REVERSED )
continue;
SMESHDS_SubMesh* edgeSM = meshDS->MeshElements( edge );
if ( !edgeSM ) continue;
double f,l;
Handle(Geom2d_Curve) pcurve = BRep_Tool::CurveOnSurface( edge, face, f, l );
BRepAdaptor_Curve curve3D( edge );
switch ( curve3D.GetType() ) {
case GeomAbs_Line: continue;
case GeomAbs_Circle:
case GeomAbs_Ellipse:
case GeomAbs_Hyperbola:
case GeomAbs_Parabola:
try
{
gp_Vec D1, D2, Du1, Dv1; gp_Pnt p;
curve3D.D2( 0.5 * ( f + l ), p, D1, D2 );
gp_Pnt2d uv = pcurve->Value( 0.5 * ( f + l ) );
surface->D1( uv.X(), uv.Y(), p, Du1, Dv1 );
gp_Vec fNorm = Du1 ^ Dv1;
if ( fNorm.IsParallel( D2, M_PI * 25./180. ))
continue; // face is normal to the curve3D
gp_Vec curvNorm = fNorm ^ D1;
if ( edge.Orientation() == TopAbs_REVERSED ) curvNorm.Reverse();
if ( curvNorm * D2 > 0 )
continue; // convex edge
}
catch ( Standard_Failure )
{
continue;
}
}
// get nodes shared by faces that may be distorted
SMDS_NodeIteratorPtr nodeIt;
if ( edgeSM->NbNodes() > 0 ) {
nodeIt = edgeSM->GetNodes();
}
else {
SMESHDS_SubMesh* vertexSM = meshDS->MeshElements( theHelper.IthVertex( 0, edge ));
if ( !vertexSM )
vertexSM = meshDS->MeshElements( theHelper.IthVertex( 1, edge ));
if ( !vertexSM ) continue;
nodeIt = vertexSM->GetNodes();
}
// find suspicious faces
TIDSortedElemSet checkedFaces;
vector< const SMDS_MeshNode* > nOnEdge( 2 );
const SMDS_MeshNode* nOnFace;
while ( nodeIt->more() )
{
const SMDS_MeshNode* n = nodeIt->next();
SMDS_ElemIteratorPtr faceIt = n->GetInverseElementIterator( SMDSAbs_Face );
while ( faceIt->more() )
{
const SMDS_MeshElement* f = faceIt->next();
if ( !faceSM->Contains( f ) ||
f->NbNodes() != 6 || // check quadratic triangles only
!checkedFaces.insert( f ).second )
continue;
// get nodes on EDGE and on FACE of a suspicious face
nOnEdge.clear(); nOnFace = 0;
SMDS_MeshElement::iterator triNode = f->begin_nodes();
for ( int nbN = 0; nbN < 3; ++triNode, ++nbN )
{
n = *triNode;
if ( n->GetPosition()->GetDim() == 2 )
nOnFace = n;
else
nOnEdge.push_back( n );
}
// check if nOnFace is inside the FACE
if ( nOnFace && nOnEdge.size() == 2 )
{
theHelper.AddTLinks( static_cast< const SMDS_MeshFace* > ( f ));
if ( !SMESH_Algo::FaceNormal( f, faceNorm, /*normalized=*/false ))
continue;
gp_XYZ edgeDir = SMESH_TNodeXYZ( nOnEdge[0] ) - SMESH_TNodeXYZ( nOnEdge[1] );
gp_XYZ edgeNorm = faceNorm ^ edgeDir;
n = theHelper.GetMediumNode( nOnEdge[0], nOnEdge[1], true );
gp_XYZ pN0 = SMESH_TNodeXYZ( nOnEdge[0] );
gp_XYZ pMedium = SMESH_TNodeXYZ( n ); // on-edge node location
gp_XYZ pFaceN = SMESH_TNodeXYZ( nOnFace ); // on-face node location
double hMedium = edgeNorm * gp_Vec( pN0, pMedium ).XYZ();
double hFace = edgeNorm * gp_Vec( pN0, pFaceN ).XYZ();
if ( Abs( hMedium ) > Abs( hFace * 0.6 ))
{
// nOnFace is out of FACE, move a medium on-edge node to the middle
gp_XYZ pMid3D = 0.5 * ( pN0 + SMESH_TNodeXYZ( nOnEdge[1] ));
meshDS->MoveNode( n, pMid3D.X(), pMid3D.Y(), pMid3D.Z() );
MSG( "move OUT of face " << n );
theError->myBadElements.push_back( f );
}
}
}
}
}
if ( !theError->myBadElements.empty() )
theError->myName = EDITERR_NO_MEDIUM_ON_GEOM;
return;
} // 2D ==============================================================================
if ( shape.ShapeType() == TopAbs_SOLID ) // 3D
{
if ( theHelper.GetMesh()->NbTetras ( ORDER_QUADRATIC ) < 1 &&
theHelper.GetMesh()->NbPyramids( ORDER_QUADRATIC ) < 1 ) return;
SMESHDS_SubMesh* solidSM = meshDS->MeshElements( shape );
if ( !solidSM ) return;
// check if the SOLID is bound by concave FACEs
vector< TopoDS_Face > concaveFaces;
TopExp_Explorer faceIt( shape, TopAbs_FACE );
for ( ; faceIt.More(); faceIt.Next() ) // loop on FACEs of a SOLID
{
const TopoDS_Face& face = TopoDS::Face( faceIt.Current() );
if ( !meshDS->MeshElements( face )) continue;
BRepAdaptor_Surface surface( face );
switch ( surface.GetType() ) {
case GeomAbs_Plane: continue;
case GeomAbs_Cylinder:
case GeomAbs_Cone:
case GeomAbs_Sphere:
try
{
double u = 0.5 * ( surface.FirstUParameter() + surface.LastUParameter() );
double v = 0.5 * ( surface.FirstVParameter() + surface.LastVParameter() );
gp_Vec Du1, Dv1, Du2, Dv2, Duv2; gp_Pnt p;
surface.D2( u,v, p, Du1, Dv1, Du2, Dv2, Duv2 );
gp_Vec fNorm = Du1 ^ Dv1;
if ( face.Orientation() == TopAbs_REVERSED ) fNorm.Reverse();
bool concaveU = ( fNorm * Du2 > 1e-100 );
bool concaveV = ( fNorm * Dv2 > 1e-100 );
if ( concaveU || concaveV )
concaveFaces.push_back( face );
}
catch ( Standard_Failure )
{
concaveFaces.push_back( face );
}
}
}
if ( concaveFaces.empty() )
return;
// fix 2D mesh on the SOLID
for ( faceIt.ReInit(); faceIt.More(); faceIt.Next() ) // loop on FACEs of a SOLID
{
SMESH_MesherHelper faceHelper( *theHelper.GetMesh() );
faceHelper.SetSubShape( faceIt.Current() );
force3DOutOfBoundary( faceHelper, theError );
}
// get an iterator over faces on concaveFaces
vector< SMDS_ElemIteratorPtr > faceIterVec( concaveFaces.size() );
for ( size_t i = 0; i < concaveFaces.size(); ++i )
faceIterVec[i] = meshDS->MeshElements( concaveFaces[i] )->GetElements();
typedef SMDS_IteratorOnIterators
< const SMDS_MeshElement*, vector< SMDS_ElemIteratorPtr > > TIterOnIter;
SMDS_ElemIteratorPtr faceIter( new TIterOnIter( faceIterVec ));
// a seacher to check if a volume is close to a concave face
std::auto_ptr< SMESH_ElementSearcher > faceSearcher
( SMESH_MeshEditor( theHelper.GetMesh() ).GetElementSearcher( faceIter ));
// classifier
//BRepClass3d_SolidClassifier solidClassifier( shape );
TIDSortedElemSet checkedVols, movedNodes;
for ( faceIt.ReInit(); faceIt.More(); faceIt.Next() ) // loop on FACEs of a SOLID
{
const TopoDS_Shape& face = faceIt.Current();
SMESHDS_SubMesh* faceSM = meshDS->MeshElements( face );
if ( !faceSM ) continue;
// get nodes shared by volumes (tet and pyra) on the FACE that may be distorted
SMDS_NodeIteratorPtr nodeIt;
if ( faceSM->NbNodes() > 0 ) {
nodeIt = faceSM->GetNodes();
}
else {
TopExp_Explorer vertex( face, TopAbs_VERTEX );
SMESHDS_SubMesh* vertexSM = meshDS->MeshElements( vertex.Current() );
if ( !vertexSM ) continue;
nodeIt = vertexSM->GetNodes();
}
// find suspicious volumes adjacent to the FACE
vector< const SMDS_MeshNode* > nOnFace( 4 );
const SMDS_MeshNode* nInSolid;
//vector< const SMDS_MeshElement* > intersectedFaces;
while ( nodeIt->more() )
{
const SMDS_MeshNode* n = nodeIt->next();
SMDS_ElemIteratorPtr volIt = n->GetInverseElementIterator( SMDSAbs_Volume );
while ( volIt->more() )
{
const SMDS_MeshElement* vol = volIt->next();
int nbN = vol->NbCornerNodes();
if ( ( nbN != 4 && nbN != 5 ) ||
!solidSM->Contains( vol ) ||
!checkedVols.insert( vol ).second )
continue;
// get nodes on FACE and in SOLID of a suspicious volume
nOnFace.clear(); nInSolid = 0;
SMDS_MeshElement::iterator volNode = vol->begin_nodes();
for ( int nb = nbN; nb > 0; ++volNode, --nb )
{
n = *volNode;
if ( n->GetPosition()->GetDim() == 3 )
nInSolid = n;
else
nOnFace.push_back( n );
}
if ( !nInSolid || nOnFace.size() != nbN - 1 )
continue;
// get size of the vol
SMESH_TNodeXYZ pInSolid( nInSolid ), pOnFace0( nOnFace[0] );
double volLength = pInSolid.SquareDistance( nOnFace[0] );
for ( size_t i = 1; i < nOnFace.size(); ++i )
{
volLength = Max( volLength, pOnFace0.SquareDistance( nOnFace[i] ));
}
// check if vol is close to concaveFaces
const SMDS_MeshElement* closeFace =
faceSearcher->FindClosestTo( pInSolid, SMDSAbs_Face );
if ( !closeFace ||
pInSolid.SquareDistance( closeFace->GetNode(0) ) > 4 * volLength )
continue;
// check if vol is distorted, i.e. a medium node is much closer
// to nInSolid than the link middle
bool isDistorted = false;
SMDS_FaceOfNodes onFaceTria( nOnFace[0], nOnFace[1], nOnFace[2] );
if ( !SMESH_Algo::FaceNormal( &onFaceTria, faceNorm, /*normalized=*/false ))
continue;
theHelper.AddTLinks( static_cast< const SMDS_MeshVolume* > ( vol ));
vector< pair< SMESH_TLink, const SMDS_MeshNode* > > links;
for ( size_t i = 0; i < nOnFace.size(); ++i ) // loop on links between nOnFace
for ( size_t j = i+1; j < nOnFace.size(); ++j )
{
SMESH_TLink link( nOnFace[i], nOnFace[j] );
TLinkNodeMap::const_iterator linkIt =
theHelper.GetTLinkNodeMap().find( link );
if ( linkIt != theHelper.GetTLinkNodeMap().end() )
{
links.push_back( make_pair( linkIt->first, linkIt->second ));
if ( !isDistorted ) {
// compare projections of nInSolid and nMedium to face normal
gp_Pnt pMedium = SMESH_TNodeXYZ( linkIt->second );
double hMedium = faceNorm * gp_Vec( pOnFace0, pMedium ).XYZ();
double hVol = faceNorm * gp_Vec( pOnFace0, pInSolid ).XYZ();
isDistorted = ( Abs( hMedium ) > Abs( hVol * 0.5 ));
}
}
}
// move medium nodes to link middle
if ( isDistorted )
{
for ( size_t i = 0; i < links.size(); ++i )
{
const SMDS_MeshNode* nMedium = links[i].second;
if ( movedNodes.insert( nMedium ).second )
{
gp_Pnt pMid3D = 0.5 * ( SMESH_TNodeXYZ( links[i].first.node1() ) +
SMESH_TNodeXYZ( links[i].first.node2() ));
meshDS->MoveNode( nMedium, pMid3D.X(), pMid3D.Y(), pMid3D.Z() );
MSG( "move OUT of solid " << nMedium );
}
}
theError->myBadElements.push_back( vol );
}
} // loop on volumes sharing a node on FACE
} // loop on nodes on FACE
} // loop on FACEs of a SOLID
if ( !theError->myBadElements.empty() )
theError->myName = EDITERR_NO_MEDIUM_ON_GEOM;
} // 3D case
}
} //namespace } //namespace
//======================================================================= //=======================================================================
/*! /*!
* \brief Move medium nodes of faces and volumes to fix distorted elements * \brief Move medium nodes of faces and volumes to fix distorted elements
* \param error - container of fixed distorted elements
* \param volumeOnly - to fix nodes on faces or not, if the shape is solid * \param volumeOnly - to fix nodes on faces or not, if the shape is solid
* *
* Issue 0020307: EDF 992 SMESH : Linea/Quadratic with Medium Node on Geometry * Issue 0020307: EDF 992 SMESH : Linea/Quadratic with Medium Node on Geometry
*/ */
//======================================================================= //=======================================================================
void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly) void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& error,
bool volumeOnly)
{ {
// setenv NO_FixQuadraticElements to know if FixQuadraticElements() is guilty of bad conversion // setenv NO_FixQuadraticElements to know if FixQuadraticElements() is guilty of bad conversion
if ( getenv("NO_FixQuadraticElements") ) if ( getenv("NO_FixQuadraticElements") )
@ -3065,7 +3462,7 @@ void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly)
#endif #endif
SMESH_MesherHelper h(*myMesh); SMESH_MesherHelper h(*myMesh);
h.SetSubShape( s.Current() ); h.SetSubShape( s.Current() );
h.FixQuadraticElements(false); h.FixQuadraticElements( error, false );
} }
} }
// fix nodes on geom faces // fix nodes on geom faces
@ -3076,10 +3473,13 @@ void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly)
MSG("FIX FACE " << nbfaces-- << " #" << GetMeshDS()->ShapeToIndex(fIt.Key())); MSG("FIX FACE " << nbfaces-- << " #" << GetMeshDS()->ShapeToIndex(fIt.Key()));
SMESH_MesherHelper h(*myMesh); SMESH_MesherHelper h(*myMesh);
h.SetSubShape( fIt.Key() ); h.SetSubShape( fIt.Key() );
h.FixQuadraticElements(true); h.FixQuadraticElements( error, true);
h.ToFixNodeParameters(true); h.ToFixNodeParameters(true);
} }
//perf_print_all_meters(1); //perf_print_all_meters(1);
if ( error && error->myName == EDITERR_NO_MEDIUM_ON_GEOM )
error->myComment = "during conversion to quadratic, "
"some medium nodes were not placed on geometry to avoid distorting elements";
return; return;
} }
@ -3118,6 +3518,11 @@ void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly)
TIDSortedNodeSet apexOfPyramid; TIDSortedNodeSet apexOfPyramid;
const int apexIndex = 4; const int apexIndex = 4;
// 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 );
if ( elemType == SMDSAbs_Volume ) if ( elemType == SMDSAbs_Volume )
{ {
while ( elemIt->more() ) // loop on volumes while ( elemIt->more() ) // loop on volumes
@ -3392,109 +3797,73 @@ void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly)
} // loop on chains of links } // loop on chains of links
} // loop on 2 directions of propagation from quadrangle } // loop on 2 directions of propagation from quadrangle
} // loop on faces } // loop on faces
} } // fix faces and/or volumes
// 4. Move nodes // 4. Move nodes
// ------------- // -------------
// vector<const SMDS_MeshElement*> vols( 100 );
// vector<double> volSize( 100 );
// int nbVols;
// bool ok;
for ( pLink = links.begin(); pLink != links.end(); ++pLink ) { for ( pLink = links.begin(); pLink != links.end(); ++pLink ) {
if ( pLink->IsMoved() ) { if ( pLink->IsMoved() ) {
gp_Pnt p = pLink->MiddlePnt() + pLink->Move(); gp_Pnt p = pLink->MiddlePnt() + pLink->Move();
GetMeshDS()->MoveNode( pLink->_mediumNode, p.X(), p.Y(), p.Z()); GetMeshDS()->MoveNode( pLink->_mediumNode, p.X(), p.Y(), p.Z());
//
// gp_Pnt pNew = pLink->MiddlePnt() + pLink->Move();
// if ( pLink->MediumPos() != SMDS_TOP_3DSPACE )
// {
// // avoid making distorted volumes near boundary
// SMDS_ElemIteratorPtr volIt =
// (*pLink)._mediumNode->GetInverseElementIterator( SMDSAbs_Volume );
// for ( nbVols = 0; volIt->more() && volTool.Set( volIt->next() ); ++nbVols )
// {
// vols [ nbVols ] = volTool.Element();
// volSize[ nbVols ] = volTool.GetSize();
// }
// gp_Pnt pOld = pLink->MediumPnt();
// const_cast<SMDS_MeshNode*>( pLink->_mediumNode )->setXYZ( pNew.X(), pNew.Y(), pNew.Z() );
// ok = true;
// while ( nbVols-- && ok )
// {
// volTool.Set( vols[ nbVols ]);
// ok = ( volSize[ nbVols ] * volTool.GetSize() > 1e-20 );
// }
// if ( !ok )
// {
// const_cast<SMDS_MeshNode*>( pLink->_mediumNode )->setXYZ( pOld.X(), pOld.Y(), pOld.Z() );
// MSG( "Do NOT move \t" << pLink->_mediumNode->GetID()
// << " because of distortion of volume " << vols[ nbVols+1 ]->GetID());
// continue;
// }
// }
// GetMeshDS()->MoveNode( pLink->_mediumNode, pNew.X(), pNew.Y(), pNew.Z() );
} }
} }
//return; // Issue 0020982
// Move the apex of pyramid together with the most curved link.
// TIDSortedNodeSet::iterator apexIt = apexOfPyramid.begin();
// for ( ; apexIt != apexOfPyramid.end(); ++apexIt )
// {
// SMESH_TNodeXYZ apex = *apexIt;
// issue 0020982 // gp_Vec maxMove( 0,0,0 );
// Move the apex of pyramid together with the most curved link // double maxMoveSize2 = 0;
TIDSortedNodeSet::iterator apexIt = apexOfPyramid.begin(); // // shift of node index to get medium nodes between the base nodes
for ( ; apexIt != apexOfPyramid.end(); ++apexIt ) // const int base2MediumShift = 5;
{
SMESH_TNodeXYZ apex = *apexIt;
gp_Vec maxMove( 0,0,0 ); // // find maximal movement of medium node
double maxMoveSize2 = 0; // SMDS_ElemIteratorPtr volIt = apex._node->GetInverseElementIterator( SMDSAbs_Volume );
// vector< const SMDS_MeshElement* > pyramids;
// while ( volIt->more() )
// {
// const SMDS_MeshElement* pyram = volIt->next();
// if ( pyram->GetEntityType() != SMDSEntity_Quad_Pyramid ) continue;
// pyramids.push_back( pyram );
// shift of node index to get medium nodes between the base nodes // for ( int iBase = 0; iBase < apexIndex; ++iBase )
const int base2MediumShift = 5; // {
// SMESH_TNodeXYZ medium = pyram->GetNode( iBase + base2MediumShift );
// if ( medium._node->GetPosition()->GetTypeOfPosition() != SMDS_TOP_3DSPACE )
// {
// SMESH_TNodeXYZ n1 = pyram->GetNode( iBase );
// SMESH_TNodeXYZ n2 = pyram->GetNode( ( iBase+1 ) % 4 );
// gp_Pnt middle = 0.5 * ( n1 + n2 );
// gp_Vec move( middle, medium );
// double moveSize2 = move.SquareMagnitude();
// if ( moveSize2 > maxMoveSize2 )
// maxMove = move, maxMoveSize2 = moveSize2;
// }
// }
// }
// find maximal movement of medium node // // move the apex
SMDS_ElemIteratorPtr volIt = apex._node->GetInverseElementIterator( SMDSAbs_Volume ); // if ( maxMoveSize2 > 1e-20 )
vector< const SMDS_MeshElement* > pyramids; // {
while ( volIt->more() ) // apex += maxMove.XYZ();
{ // GetMeshDS()->MoveNode( apex._node, apex.X(), apex.Y(), apex.Z());
const SMDS_MeshElement* pyram = volIt->next();
if ( pyram->GetEntityType() != SMDSEntity_Quad_Pyramid ) continue;
pyramids.push_back( pyram );
for ( int iBase = 0; iBase < apexIndex; ++iBase ) // // move medium nodes neighboring the apex to the middle
{ // const int base2MediumShift_2 = 9;
SMESH_TNodeXYZ medium = pyram->GetNode( iBase + base2MediumShift ); // for ( unsigned i = 0; i < pyramids.size(); ++i )
if ( medium._node->GetPosition()->GetTypeOfPosition() != SMDS_TOP_3DSPACE ) // for ( int iBase = 0; iBase < apexIndex; ++iBase )
{ // {
SMESH_TNodeXYZ n1 = pyram->GetNode( iBase ); // SMESH_TNodeXYZ base = pyramids[i]->GetNode( iBase );
SMESH_TNodeXYZ n2 = pyram->GetNode( ( iBase+1 ) % 4 ); // const SMDS_MeshNode* medium = pyramids[i]->GetNode( iBase + base2MediumShift_2 );
gp_Pnt middle = 0.5 * ( n1 + n2 ); // gp_XYZ middle = 0.5 * ( apex + base );
gp_Vec move( middle, medium ); // GetMeshDS()->MoveNode( medium, middle.X(), middle.Y(), middle.Z());
double moveSize2 = move.SquareMagnitude(); // }
if ( moveSize2 > maxMoveSize2 ) // }
maxMove = move, maxMoveSize2 = moveSize2; // }
}
}
}
// move the apex
if ( maxMoveSize2 > 1e-20 )
{
apex += maxMove.XYZ();
GetMeshDS()->MoveNode( apex._node, apex.X(), apex.Y(), apex.Z());
// move medium nodes neighboring the apex to the middle
const int base2MediumShift_2 = 9;
for ( unsigned i = 0; i < pyramids.size(); ++i )
for ( int iBase = 0; iBase < apexIndex; ++iBase )
{
SMESH_TNodeXYZ base = pyramids[i]->GetNode( iBase );
const SMDS_MeshNode* medium = pyramids[i]->GetNode( iBase + base2MediumShift_2 );
gp_XYZ middle = 0.5 * ( apex + base );
GetMeshDS()->MoveNode( medium, middle.X(), middle.Y(), middle.Z());
}
}
}
} }

View File

@ -164,6 +164,9 @@ public:
static TopoDS_Vertex IthVertex( const bool is2nd, TopoDS_Edge anEdge, const bool CumOri=true ); static TopoDS_Vertex IthVertex( const bool is2nd, TopoDS_Edge anEdge, const bool CumOri=true );
static TopAbs_ShapeEnum GetGroupType(const TopoDS_Shape& group,
const bool avoidCompound=false);
public: public:
// ---------- PUBLIC INSTANCE METHODS ---------- // ---------- PUBLIC INSTANCE METHODS ----------
@ -192,9 +195,10 @@ public:
/*! /*!
* \brief Move medium nodes of faces and volumes to fix distorted elements * \brief Move medium nodes of faces and volumes to fix distorted elements
* \param error - container of fixed distorted elements
* \param volumeOnly - fix nodes on geom faces or not if the shape is solid * \param volumeOnly - fix nodes on geom faces or not if the shape is solid
*/ */
void FixQuadraticElements(bool volumeOnly=true); void FixQuadraticElements(SMESH_ComputeErrorPtr& error, bool volumeOnly=true);
/*! /*!
* \brief To set created elements on the shape set by IsQuadraticSubMesh() * \brief To set created elements on the shape set by IsQuadraticSubMesh()

View File

@ -406,6 +406,10 @@ const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn()
{ {
insertDependence(exp.Current()); insertDependence(exp.Current());
} }
for (TopExp_Explorer exp(_subShape, TopAbs_VERTEX, TopAbs_EDGE); exp.More();exp.Next())
{
insertDependence(exp.Current());
}
break; break;
} }
case TopAbs_COMPSOLID: case TopAbs_COMPSOLID:
@ -1462,16 +1466,18 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
else else
ret = false; ret = false;
} }
// check if an error reported on any sub-shape
bool isComputeErrorSet = !checkComputeError( algo, ret, shape );
// check if anything was built
TopExp_Explorer subS(shape, _subShape.ShapeType()); TopExp_Explorer subS(shape, _subShape.ShapeType());
if (ret) // check if anything was built if (ret)
{ {
for (; ret && subS.More(); subS.Next()) for (; ret && subS.More(); subS.Next())
ret = _father->GetSubMesh( subS.Current() )->IsMeshComputed(); ret = _father->GetSubMesh( subS.Current() )->IsMeshComputed();
} }
bool isComputeErrorSet = !checkComputeError( algo, shape ); // Set _computeError
if (!ret && !isComputeErrorSet) if (!ret && !isComputeErrorSet)
{ {
// Set _computeError
for (subS.ReInit(); subS.More(); subS.Next()) for (subS.ReInit(); subS.More(); subS.Next())
{ {
SMESH_subMesh* sm = _father->GetSubMesh( subS.Current() ); SMESH_subMesh* sm = _father->GetSubMesh( subS.Current() );
@ -1723,7 +1729,9 @@ bool SMESH_subMesh::Evaluate(MapShapeNbElems& aResMap)
*/ */
//======================================================================= //=======================================================================
bool SMESH_subMesh::checkComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& theShape) bool SMESH_subMesh::checkComputeError(SMESH_Algo* theAlgo,
const bool theComputeOK,
const TopoDS_Shape& theShape)
{ {
bool noErrors = true; bool noErrors = true;
@ -1734,7 +1742,7 @@ bool SMESH_subMesh::checkComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& t
{ {
SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,false); SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,false);
while ( smIt->more() ) while ( smIt->more() )
if ( !smIt->next()->checkComputeError( theAlgo )) if ( !smIt->next()->checkComputeError( theAlgo, theComputeOK ))
noErrors = false; noErrors = false;
} }
@ -1746,7 +1754,7 @@ bool SMESH_subMesh::checkComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& t
for (TopoDS_Iterator subIt( theShape ); subIt.More(); subIt.Next()) { for (TopoDS_Iterator subIt( theShape ); subIt.More(); subIt.Next()) {
SMESH_subMesh* sm = _father->GetSubMesh( subIt.Value() ); SMESH_subMesh* sm = _father->GetSubMesh( subIt.Value() );
if ( sm != this ) { if ( sm != this ) {
if ( !sm->checkComputeError( theAlgo, sm->GetSubShape() )) if ( !sm->checkComputeError( theAlgo, theComputeOK, sm->GetSubShape() ))
noErrors = false; noErrors = false;
updateDependantsState( SUBMESH_COMPUTED ); // send event SUBMESH_COMPUTED updateDependantsState( SUBMESH_COMPUTED ); // send event SUBMESH_COMPUTED
} }
@ -1754,13 +1762,24 @@ bool SMESH_subMesh::checkComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& t
} }
} }
{ {
// Check my state
// Set my _computeState
if ( !_computeError || _computeError->IsOK() ) if ( !_computeError || _computeError->IsOK() )
{ {
// no error description is set to this sub-mesh, check if any mesh is computed // no error description is set to this sub-mesh, check if any mesh is computed
_computeState = IsMeshComputed() ? COMPUTE_OK : FAILED_TO_COMPUTE; _computeState = IsMeshComputed() ? COMPUTE_OK : FAILED_TO_COMPUTE;
if ( _computeState != COMPUTE_OK )
{
if ( _subShape.ShapeType() == TopAbs_EDGE &&
BRep_Tool::Degenerated( TopoDS::Edge( _subShape )) )
_computeState = COMPUTE_OK;
else if ( theComputeOK )
_computeError = SMESH_ComputeError::New(COMPERR_NO_MESH_ON_SHAPE,"",theAlgo);
}
} }
else
if ( _computeError && !_computeError->IsOK() )
{ {
if ( !_computeError->myAlgo ) if ( !_computeError->myAlgo )
_computeError->myAlgo = theAlgo; _computeError->myAlgo = theAlgo;
@ -2078,6 +2097,23 @@ EventListenerData* SMESH_subMesh::GetEventListenerData(EventListener* listener)
return 0; return 0;
} }
//================================================================================
/*!
* \brief Return an event listener data
* \param listenerName - the listener name
* \retval EventListenerData* - found data, maybe NULL
*/
//================================================================================
EventListenerData* SMESH_subMesh::GetEventListenerData(const string& listenerName) const
{
map< EventListener*, EventListenerData* >::const_iterator l_d = _eventListeners.begin();
for ( ; l_d != _eventListeners.end(); ++l_d )
if ( listenerName == l_d->first->GetName() )
return l_d->second;
return 0;
}
//================================================================================ //================================================================================
/*! /*!
* \brief Notify stored event listeners on the occured event * \brief Notify stored event listeners on the occured event
@ -2118,8 +2154,15 @@ void SMESH_subMesh::DeleteEventListener(EventListener* listener)
map< EventListener*, EventListenerData* >::iterator l_d = map< EventListener*, EventListenerData* >::iterator l_d =
_eventListeners.find( listener ); _eventListeners.find( listener );
if ( l_d != _eventListeners.end() ) { if ( l_d != _eventListeners.end() ) {
if ( l_d->first && l_d->first->IsDeletable() ) delete l_d->first; if ( l_d->first && l_d->first->IsDeletable() )
if ( l_d->second && l_d->second->IsDeletable() ) delete l_d->second; {
l_d->first->BeforeDelete( this, l_d->second );
delete l_d->first;
}
if ( l_d->second && l_d->second->IsDeletable() )
{
delete l_d->second;
}
_eventListeners.erase( l_d ); _eventListeners.erase( l_d );
} }
} }

View File

@ -138,6 +138,13 @@ class SMESH_EXPORT SMESH_subMesh
*/ */
EventListenerData* GetEventListenerData(EventListener* listener) const; EventListenerData* GetEventListenerData(EventListener* listener) const;
/*!
* \brief Return an event listener data
* \param listenerName - the listener name
* \retval EventListenerData* - found data, maybe NULL
*/
EventListenerData* GetEventListenerData(const std::string& listenerName) const;
/*! /*!
* \brief Unregister the listener and delete it and it's data * \brief Unregister the listener and delete it and it's data
* \param listener - the event listener to delete * \param listener - the event listener to delete
@ -278,7 +285,9 @@ protected:
* \brief Update compute_state by _computeError * \brief Update compute_state by _computeError
* \retval bool - false if there are errors * \retval bool - false if there are errors
*/ */
bool checkComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& theShape=TopoDS_Shape()); bool checkComputeError(SMESH_Algo* theAlgo,
const bool theComputeOK,
const TopoDS_Shape& theShape=TopoDS_Shape());
/*! /*!
* \brief Return a hypothesis attached to theShape. * \brief Return a hypothesis attached to theShape.

View File

@ -46,18 +46,18 @@ class SMESH_EXPORT SMESH_subMeshEventListener
{ {
bool myIsDeletable; //!< if true, it will be deleted by SMESH_subMesh bool myIsDeletable; //!< if true, it will be deleted by SMESH_subMesh
mutable std::set<SMESH_subMesh*> myBusySM; //!< to avoid infinite recursion via events mutable std::set<SMESH_subMesh*> myBusySM; //!< to avoid infinite recursion via events
const char* myName; //!< identifier
friend class SMESH_subMesh; friend class SMESH_subMesh;
#ifdef _DEBUG_
const char* myName; //!< identifier used for debug
#endif
public: public:
SMESH_subMeshEventListener(bool isDeletable, const char* name) :myIsDeletable(isDeletable) SMESH_subMeshEventListener(bool isDeletable, const char* name)
#ifdef _DEBUG_ :myIsDeletable(isDeletable), myName(name) {}
,myName(name) virtual ~SMESH_subMeshEventListener() {}
#endif bool IsDeletable() const { return myIsDeletable; }
const char* GetName() const { return myName; }
virtual void BeforeDelete(SMESH_subMesh* subMesh,
SMESH_subMeshEventListenerData* data)
{} {}
bool IsDeletable() const { return myIsDeletable; }
/*! /*!
* \brief Do something on a certain event * \brief Do something on a certain event
* \param event - algo_event or compute_event itself (of SMESH_subMesh) * \param event - algo_event or compute_event itself (of SMESH_subMesh)

View File

@ -57,6 +57,7 @@ libSMESHClient_la_CPPFLAGS = \
-I$(srcdir)/../SMDS \ -I$(srcdir)/../SMDS \
-I$(srcdir)/../SMESHDS \ -I$(srcdir)/../SMESHDS \
-I$(srcdir)/../SMESH \ -I$(srcdir)/../SMESH \
-I$(srcdir)/../SMESHUtils \
-I$(top_builddir)/idl -I$(top_builddir)/idl
libSMESHClient_la_LDFLAGS = \ libSMESHClient_la_LDFLAGS = \

View File

@ -38,27 +38,27 @@ class SMESHDS_EXPORT SMESHDS_Document
{ {
public: public:
SMESHDS_Document(int UserID); SMESHDS_Document(int UserID);
int NewMesh(bool theIsEmbeddedMode);
void RemoveMesh(int MeshID);
SMESHDS_Mesh * GetMesh(int MeshID);
void AddHypothesis(SMESHDS_Hypothesis * H);
void RemoveHypothesis(int HypID);
SMESHDS_Hypothesis * GetHypothesis(int HypID);
int NbMeshes();
int NbHypothesis();
void InitMeshesIterator();
SMESHDS_Mesh * NextMesh();
bool MoreMesh();
void InitHypothesisIterator();
SMESHDS_Hypothesis * NextHypothesis();
bool MoreHypothesis();
~SMESHDS_Document(); ~SMESHDS_Document();
int NewMesh(bool theIsEmbeddedMode);
void RemoveMesh(int MeshID);
SMESHDS_Mesh * GetMesh(int MeshID);
void AddHypothesis(SMESHDS_Hypothesis * H);
void RemoveHypothesis(int HypID);
SMESHDS_Hypothesis * GetHypothesis(int HypID);
int NbMeshes();
int NbHypothesis();
void InitMeshesIterator();
SMESHDS_Mesh * NextMesh();
bool MoreMesh();
void InitHypothesisIterator();
SMESHDS_Hypothesis * NextHypothesis();
bool MoreHypothesis();
private: private:
int myUserID; int myUserID;
std::map<int,SMESHDS_Mesh*> myMeshes; std::map<int,SMESHDS_Mesh*> myMeshes;
std::map<int,SMESHDS_Hypothesis*> myHypothesis; std::map<int,SMESHDS_Hypothesis*> myHypothesis;
std::map<int,SMESHDS_Mesh*>::iterator myMeshesIt; std::map<int,SMESHDS_Mesh*>::iterator myMeshesIt;
std::map<int,SMESHDS_Hypothesis*>::iterator myHypothesisIt; std::map<int,SMESHDS_Hypothesis*>::iterator myHypothesisIt;
}; };

View File

@ -24,7 +24,6 @@
// File : SMESHDS_Hypothesis.hxx // File : SMESHDS_Hypothesis.hxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESHDS_HYPOTHESIS_HXX_ #ifndef _SMESHDS_HYPOTHESIS_HXX_
#define _SMESHDS_HYPOTHESIS_HXX_ #define _SMESHDS_HYPOTHESIS_HXX_
@ -36,7 +35,7 @@
class SMESHDS_EXPORT SMESHDS_Hypothesis class SMESHDS_EXPORT SMESHDS_Hypothesis
{ {
public: public:
SMESHDS_Hypothesis(int hypId); SMESHDS_Hypothesis(int hypId);
virtual ~SMESHDS_Hypothesis(); virtual ~SMESHDS_Hypothesis();
@ -50,12 +49,12 @@ public:
virtual bool operator==(const SMESHDS_Hypothesis& other) const; virtual bool operator==(const SMESHDS_Hypothesis& other) const;
bool operator!=(const SMESHDS_Hypothesis& other) const { return !(*this==other); } bool operator!=(const SMESHDS_Hypothesis& other) const { return !(*this==other); }
enum hypothesis_type {PARAM_ALGO, ALGO_0D, ALGO_1D, ALGO_2D, ALGO_3D}; enum hypothesis_type { PARAM_ALGO, ALGO_0D, ALGO_1D, ALGO_2D, ALGO_3D };
protected: protected:
std::string _name; std::string _name; // identifier if hypothesis type
int _hypId; int _hypId; // ID unique within application session
int _type; int _type; // enum hypothesis_type
}; };
#endif #endif

View File

@ -49,7 +49,6 @@ salomeinclude_HEADERS = \
SMESHGUI_RemoveElementsDlg.h \ SMESHGUI_RemoveElementsDlg.h \
SMESHGUI_MeshInfo.h \ SMESHGUI_MeshInfo.h \
SMESHGUI_Measurements.h \ SMESHGUI_Measurements.h \
SMESHGUI_Preferences_ColorDlg.h \
SMESHGUI_Preferences_ScalarBarDlg.h \ SMESHGUI_Preferences_ScalarBarDlg.h \
SMESHGUI_AddMeshElementDlg.h \ SMESHGUI_AddMeshElementDlg.h \
SMESHGUI_XmlHandler.h \ SMESHGUI_XmlHandler.h \
@ -97,6 +96,7 @@ salomeinclude_HEADERS = \
SMESHGUI_CopyMeshDlg.h \ SMESHGUI_CopyMeshDlg.h \
SMESHGUI_PreviewDlg.h \ SMESHGUI_PreviewDlg.h \
SMESHGUI_ReorientFacesDlg.h \ SMESHGUI_ReorientFacesDlg.h \
SMESHGUI_PropertiesDlg.h \
SMESH_SMESHGUI.hxx SMESH_SMESHGUI.hxx
# Libraries targets # Libraries targets
@ -115,7 +115,6 @@ dist_libSMESH_la_SOURCES = \
SMESHGUI_RemoveElementsDlg.cxx \ SMESHGUI_RemoveElementsDlg.cxx \
SMESHGUI_MeshInfo.cxx \ SMESHGUI_MeshInfo.cxx \
SMESHGUI_Measurements.cxx \ SMESHGUI_Measurements.cxx \
SMESHGUI_Preferences_ColorDlg.cxx \
SMESHGUI_Preferences_ScalarBarDlg.cxx \ SMESHGUI_Preferences_ScalarBarDlg.cxx \
SMESHGUI_AddMeshElementDlg.cxx \ SMESHGUI_AddMeshElementDlg.cxx \
SMESHGUI_XmlHandler.cxx \ SMESHGUI_XmlHandler.cxx \
@ -173,7 +172,8 @@ dist_libSMESH_la_SOURCES = \
SMESHGUI_CopyMeshDlg.cxx \ SMESHGUI_CopyMeshDlg.cxx \
SMESHGUI_FileValidator.cxx \ SMESHGUI_FileValidator.cxx \
SMESHGUI_PreviewDlg.cxx \ SMESHGUI_PreviewDlg.cxx \
SMESHGUI_ReorientFacesDlg.cxx SMESHGUI_ReorientFacesDlg.cxx \
SMESHGUI_PropertiesDlg.cxx
MOC_FILES = \ MOC_FILES = \
SMESHGUI_moc.cxx \ SMESHGUI_moc.cxx \
@ -189,7 +189,6 @@ MOC_FILES = \
SMESHGUI_RemoveElementsDlg_moc.cxx \ SMESHGUI_RemoveElementsDlg_moc.cxx \
SMESHGUI_MeshInfo_moc.cxx \ SMESHGUI_MeshInfo_moc.cxx \
SMESHGUI_Measurements_moc.cxx \ SMESHGUI_Measurements_moc.cxx \
SMESHGUI_Preferences_ColorDlg_moc.cxx \
SMESHGUI_Preferences_ScalarBarDlg_moc.cxx \ SMESHGUI_Preferences_ScalarBarDlg_moc.cxx \
SMESHGUI_AddMeshElementDlg_moc.cxx \ SMESHGUI_AddMeshElementDlg_moc.cxx \
SMESHGUI_FilterDlg_moc.cxx \ SMESHGUI_FilterDlg_moc.cxx \
@ -233,7 +232,8 @@ MOC_FILES = \
SMESHGUI_CopyMeshDlg_moc.cxx \ SMESHGUI_CopyMeshDlg_moc.cxx \
SMESHGUI_MeshOrderOp_moc.cxx \ SMESHGUI_MeshOrderOp_moc.cxx \
SMESHGUI_PreviewDlg_moc.cxx \ SMESHGUI_PreviewDlg_moc.cxx \
SMESHGUI_ReorientFacesDlg_moc.cxx SMESHGUI_ReorientFacesDlg_moc.cxx \
SMESHGUI_PropertiesDlg_moc.cxx
nodist_libSMESH_la_SOURCES= \ nodist_libSMESH_la_SOURCES= \
$(MOC_FILES) $(MOC_FILES)

View File

@ -59,8 +59,8 @@
#include "SMESHGUI_MeshPatternDlg.h" #include "SMESHGUI_MeshPatternDlg.h"
#include "SMESHGUI_MultiEditDlg.h" #include "SMESHGUI_MultiEditDlg.h"
#include "SMESHGUI_NodesDlg.h" #include "SMESHGUI_NodesDlg.h"
#include "SMESHGUI_Preferences_ColorDlg.h"
#include "SMESHGUI_Preferences_ScalarBarDlg.h" #include "SMESHGUI_Preferences_ScalarBarDlg.h"
#include "SMESHGUI_PropertiesDlg.h"
#include "SMESHGUI_RemoveElementsDlg.h" #include "SMESHGUI_RemoveElementsDlg.h"
#include "SMESHGUI_RemoveNodesDlg.h" #include "SMESHGUI_RemoveNodesDlg.h"
#include "SMESHGUI_RenumberingDlg.h" #include "SMESHGUI_RenumberingDlg.h"
@ -212,6 +212,10 @@
filter.append( QObject::tr( "SAUV files (*.sauv*)" ) ); filter.append( QObject::tr( "SAUV files (*.sauv*)" ) );
filter.append( QObject::tr( "All files (*)" ) ); filter.append( QObject::tr( "All files (*)" ) );
} }
else if ( theCommandID == 118 ) {
filter.append( QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)" );
filter.append( QObject::tr( "GMF_BINARY_FILES_FILTER") + " (*.meshb)" );
}
QString anInitialPath = ""; QString anInitialPath = "";
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
@ -294,6 +298,22 @@
} }
break; break;
} }
case 118:
{
// GMF format
SMESH::ComputeError_var res;
aMeshes->length( 1 );
aMeshes[0] = theComponentMesh->CreateMeshesFromGMF( filename.toLatin1().constData(), 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() ) ) );
if ( strlen( res->comment.in() ) > 0 ) {
errors.back() += ": ";
errors.back() += res->comment.in();
}
}
break;
}
} }
} }
catch ( const SALOME::SALOME_Exception& S_ex ) { catch ( const SALOME::SALOME_Exception& S_ex ) {
@ -368,6 +388,7 @@
const bool isSTL = ( theCommandID == 140 || theCommandID == 141 ); const bool isSTL = ( theCommandID == 140 || theCommandID == 141 );
const bool isCGNS= ( theCommandID == 142 || theCommandID == 143 ); const bool isCGNS= ( theCommandID == 142 || theCommandID == 143 );
const bool isSAUV= ( theCommandID == 144 || theCommandID == 145 ); const bool isSAUV= ( theCommandID == 144 || theCommandID == 145 );
const bool isGMF = ( theCommandID == 146 || theCommandID == 147 );
// actually, the following condition can't be met (added for insurance) // actually, the following condition can't be met (added for insurance)
if( selected.Extent() == 0 || if( selected.Extent() == 0 ||
@ -416,10 +437,10 @@
aMeshIter = aMeshList.begin(); aMeshIter = aMeshList.begin();
SMESH::SMESH_IDSource_var aMeshOrGroup = (*aMeshIter).first; SMESH::SMESH_IDSource_var aMeshOrGroup = (*aMeshIter).first;
SMESH::SMESH_Mesh_var aMesh = aMeshOrGroup->GetMesh(); SMESH::SMESH_Mesh_var aMesh = aMeshOrGroup->GetMesh();
QString aMeshName = (*aMeshIter).second; QString aMeshName = (*aMeshIter).second;
if ( isMED || isCGNS || isSAUV ) if ( isMED || isCGNS || isSAUV ) // formats where group names must be unique
{ {
// check for equal group names within each mesh // check for equal group names within each mesh
for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) { for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) {
@ -495,6 +516,21 @@
notSupportedElemTypes.push_back( SMESH::Entity_Polygon ); notSupportedElemTypes.push_back( SMESH::Entity_Polygon );
notSupportedElemTypes.push_back( SMESH::Entity_Polyhedra ); notSupportedElemTypes.push_back( SMESH::Entity_Polyhedra );
} }
else if ( isGMF )
{
format = "GMF";
notSupportedElemTypes.push_back( SMESH::Entity_0D );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Quadrangle );
notSupportedElemTypes.push_back( SMESH::Entity_Polygon );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polygon );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Pyramid );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Hexa );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Penta );
notSupportedElemTypes.push_back( SMESH::Entity_Hexagonal_Prism );
notSupportedElemTypes.push_back( SMESH::Entity_Polyhedra );
notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polyhedra );
notSupportedElemTypes.push_back( SMESH::Entity_Ball );
}
if ( ! notSupportedElemTypes.empty() ) if ( ! notSupportedElemTypes.empty() )
{ {
SMESH::long_array_var nbElems = aMeshOrGroup->GetMeshInfo(); SMESH::long_array_var nbElems = aMeshOrGroup->GetMeshInfo();
@ -532,10 +568,10 @@
// Get parameters of export operation // Get parameters of export operation
QString aFilename; QString aFilename;
SMESH::MED_VERSION aFormat; SMESH::MED_VERSION aFormat;
// Init the parameters with the default values // Init the parameters with the default values
bool aIsASCII_STL = true; bool aIsASCII_STL = true;
bool toCreateGroups = false; bool toCreateGroups = false;
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
if ( resMgr ) if ( resMgr )
@ -547,12 +583,16 @@
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
anInitialPath = QDir::currentPath(); anInitialPath = QDir::currentPath();
if ( isUNV || isDAT ) // Get a file name to write in and additional otions
if ( isUNV || isDAT || isGMF ) // Export w/o options
{ {
if ( isUNV ) if ( isUNV )
aFilter = QObject::tr( "IDEAS_FILES_FILTER" ) + " (*.unv)"; aFilter = QObject::tr( "IDEAS_FILES_FILTER" ) + " (*.unv)";
else else if ( isDAT )
aFilter = QObject::tr( "DAT_FILES_FILTER" ) + " (*.dat)"; aFilter = QObject::tr( "DAT_FILES_FILTER" ) + " (*.dat)";
else if ( isGMF )
aFilter = QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)" +
";;" + QObject::tr( "GMF_BINARY_FILES_FILTER" ) + " (*.meshb)";
if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath(); if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(),
anInitialPath + QString("/") + aMeshName, anInitialPath + QString("/") + aMeshName,
@ -801,6 +841,10 @@
toOverwrite && aMeshIndex == 0 ); toOverwrite && aMeshIndex == 0 );
} }
} }
else if ( isGMF )
{
aMesh->ExportGMF( aMeshOrGroup, aFilename.toLatin1().data() );
}
} }
catch (const SALOME::SALOME_Exception& S_ex){ catch (const SALOME::SALOME_Exception& S_ex){
wc.suspend(); wc.suspend();
@ -895,6 +939,8 @@
SALOMEDS::Color aColor = aGroupObject->GetColor(); SALOMEDS::Color aColor = aGroupObject->GetColor();
_PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject); _PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject);
if (aGroupSObject) { if (aGroupSObject) {
QColor c;
int delta;
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aGroupSObject->GetID().c_str())) { if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aGroupSObject->GetID().c_str())) {
switch ( aGroupObject->GetType ()) { switch ( aGroupObject->GetType ()) {
case SMESH::NODE: case SMESH::NODE:
@ -905,9 +951,11 @@
anActor->Set0DColor( aColor.R, aColor.G, aColor.B ); break; anActor->Set0DColor( aColor.R, aColor.G, aColor.B ); break;
case SMESH::BALL: case SMESH::BALL:
anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break; anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break;
case SMESH::VOLUME:
SMESH::GetColor("SMESH", "volume_color", c, delta, "255,0,170|-100");
anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break;
case SMESH::FACE:
default: default:
QColor c;
int delta;
SMESH::GetColor("SMESH", "fill_color", c, delta, "0,170,255|-100"); SMESH::GetColor("SMESH", "fill_color", c, delta, "0,170,255|-100");
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta );
} }
@ -1158,250 +1206,224 @@
(new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI() ))->show(); (new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI() ))->show();
return; return;
} }
case 1132:{ case 1132: {
QColor c, e, b, n, c0D, cBall, o, outl, selection, preselection; vtkFloatingPointType color[3];
int delta; QColor faceColor, edgeColor, nodeColor, elem0dColor, ballColor;
int size0D = 0, ballSize = 0; QColor orientationColor, outlineColor, volumeColor;
int Edgewidth = 0; int deltaF = 0, deltaV = 0;
vtkFloatingPointType Shrink = 0.0; int elem0dSize = 1;
vtkFloatingPointType faces_orientation_scale = 0.0; int ballSize = 1;
bool faces_orientation_3dvectors = false; int edgeWidth = 1;
int outlineWidth = 1;
VTK::MarkerType aMarkerTypeCurrent = VTK::MT_NONE; vtkFloatingPointType shrinkCoef = 0.0;
VTK::MarkerScale aMarkerScaleCurrent = VTK::MS_NONE; vtkFloatingPointType orientationScale = 0.0;
int aMarkerTextureCurrent = 0; bool orientation3d = false;
VTK::MarkerType markerType = VTK::MT_NONE;
VTK::MarkerScale markerScale = VTK::MS_NONE;
int markerId = 0;
bool hasNodes = false;
int presentEntities = 0;
bool firstTime = true;
SALOME_ListIteratorOfListIO It( selected ); SALOME_ListIteratorOfListIO It( selected );
for( ; It.More(); It.Next()){ for ( ; It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value(); Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()){ if ( !IObject->hasEntry() ) continue;
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){ SMESH_Actor* anActor = SMESH::FindActorByEntry( IObject->getEntry() );
vtkFloatingPointType color[3]; if ( !anActor || !anActor->GetObject() ) continue;
anActor->GetSufaceColor(color[0], color[1], color[2],delta);
int c0 = int (color[0] * 255);
int c1 = int (color[1] * 255);
int c2 = int (color[2] * 255);
c.setRgb(c0, c1, c2);
vtkFloatingPointType edgecolor[3]; if ( firstTime ) {
anActor->GetEdgeColor(edgecolor[0], edgecolor[1], edgecolor[2]); // nodes: color, marker
c0 = int (edgecolor[0] * 255); anActor->GetNodeColor( color[0], color[1], color[2] );
c1 = int (edgecolor[1] * 255); nodeColor.setRgbF( color[0], color[1], color[2] );
c2 = int (edgecolor[2] * 255); markerType = anActor->GetMarkerType();
e.setRgb(c0, c1, c2); markerScale = anActor->GetMarkerScale();
markerId = anActor->GetMarkerTexture();
vtkFloatingPointType nodecolor[3]; // edges: color, width
anActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]); anActor->GetEdgeColor( color[0], color[1], color[2] );
c0 = int (nodecolor[0] * 255); edgeColor.setRgbF( color[0], color[1], color[2] );
c1 = int (nodecolor[1] * 255); edgeWidth = qMax( (int)anActor->GetLineWidth(), 1 ); // minimum allowed width is 1
c2 = int (nodecolor[2] * 255); // faces: front color, back color (delta)
n.setRgb(c0, c1, c2); anActor->GetSufaceColor( color[0], color[1], color[2], deltaF );
faceColor.setRgbF( color[0], color[1], color[2] );
vtkFloatingPointType color0D[3]; // faces: front color, back color (delta)
anActor->Get0DColor(color0D[0], color0D[1], color0D[2]); anActor->GetVolumeColor( color[0], color[1], color[2], deltaV );
c0 = int (color0D[0] * 255); volumeColor.setRgbF( color[0], color[1], color[2] );
c1 = int (color0D[1] * 255); // 0d elements: color, size
c2 = int (color0D[2] * 255); anActor->Get0DColor( color[0], color[1], color[2] );
c0D.setRgb(c0, c1, c2); elem0dColor.setRgbF( color[0], color[1], color[2] );
elem0dSize = qMax( (int)anActor->Get0DSize(), 1 ); // minimum allowed size is 1
vtkFloatingPointType ballcolor[3]; // balls: color, size
anActor->GetBallColor(ballcolor[0], ballcolor[1], ballcolor[2]); anActor->GetBallColor( color[0], color[1], color[2] );
c0 = int (ballcolor[0] * 255); ballColor.setRgbF( color[0], color[1], color[2] );
c1 = int (ballcolor[1] * 255); ballSize = qMax( (int)anActor->GetBallSize(), 1 ); // minimum allowed size is 1
c2 = int (ballcolor[2] * 255); // outlines: color
cBall.setRgb(c0, c1, c2); anActor->GetOutlineColor( color[0], color[1], color[2] );
outlineColor.setRgbF( color[0], color[1], color[2] );
vtkFloatingPointType outlineColor[3]; outlineWidth = qMax( (int)anActor->GetOutlineWidth(), 1 ); // minimum allowed width is 1
anActor->GetOutlineColor(outlineColor[0], outlineColor[1], outlineColor[2]); // orientation vectors: color, scale, 3d flag
c0 = int (outlineColor[0] * 255); anActor->GetFacesOrientationColor( color[0], color[1], color[2] );
c1 = int (outlineColor[1] * 255); orientationColor.setRgbF( color[0], color[1], color[2] );
c2 = int (outlineColor[2] * 255); orientationScale = anActor->GetFacesOrientationScale();
outl.setRgb(c0, c1, c2); orientation3d = anActor->GetFacesOrientation3DVectors();
// shrink factor
vtkFloatingPointType hColor[3]; shrinkCoef = anActor->GetShrinkFactor();
anActor->GetHighlightColor(hColor[0], hColor[1], hColor[2]);
c0 = int (hColor[0] * 255);
c1 = int (hColor[1] * 255);
c2 = int (hColor[2] * 255);
selection.setRgb(c0, c1, c2);
vtkFloatingPointType phColor[3];
anActor->GetPreHighlightColor(phColor[0], phColor[1], phColor[2]);
c0 = int (phColor[0] * 255);
c1 = int (phColor[1] * 255);
c2 = int (phColor[2] * 255);
preselection.setRgb(c0, c1, c2);
size0D = (int)anActor->Get0DSize();
if(size0D == 0)
size0D = 1;
ballSize = (int)anActor->GetBallSize();
if(ballSize == 0)
ballSize = 1;
Edgewidth = (int)anActor->GetLineWidth();
if(Edgewidth == 0)
Edgewidth = 1;
Shrink = anActor->GetShrinkFactor();
vtkFloatingPointType faces_orientation_color[3];
anActor->GetFacesOrientationColor(faces_orientation_color);
c0 = int (faces_orientation_color[0] * 255);
c1 = int (faces_orientation_color[1] * 255);
c2 = int (faces_orientation_color[2] * 255);
o.setRgb(c0, c1, c2);
faces_orientation_scale = anActor->GetFacesOrientationScale();
faces_orientation_3dvectors = anActor->GetFacesOrientation3DVectors();
aMarkerTypeCurrent = anActor->GetMarkerType();
aMarkerScaleCurrent = anActor->GetMarkerScale();
aMarkerTextureCurrent = anActor->GetMarkerTexture();
// even if there are multiple objects in the selection,
// we need only the first one to get values for the dialog
break;
}
} }
firstTime = false; // we only take properties from first object (for performance reasons)
if ( !hasNodes )
hasNodes = anActor->GetObject()->GetNbEntities( SMDSAbs_Node );
if ( !(presentEntities & SMESH_Actor::eEdges) && anActor->GetObject()->GetNbEntities( SMDSAbs_Edge ) )
presentEntities = presentEntities | SMESH_Actor::eEdges;
if ( !(presentEntities & SMESH_Actor::eFaces) && anActor->GetObject()->GetNbEntities( SMDSAbs_Face ) )
presentEntities = presentEntities | SMESH_Actor::eFaces;
if ( !(presentEntities & SMESH_Actor::eVolumes) && anActor->GetObject()->GetNbEntities( SMDSAbs_Volume ) )
presentEntities = presentEntities | SMESH_Actor::eVolumes;
if ( !(presentEntities & SMESH_Actor::e0DElements) && anActor->GetObject()->GetNbEntities( SMDSAbs_0DElement ) )
presentEntities = presentEntities | SMESH_Actor::e0DElements;
if ( !(presentEntities & SMESH_Actor::eBallElem) && anActor->GetObject()->GetNbEntities( SMDSAbs_Ball ) )
presentEntities = presentEntities | SMESH_Actor::eBallElem;
// as we know that all types of elements are present, we can exit the loop
if ( presentEntities == SMESH_Actor::eAllEntity )
break;
} }
SMESHGUI_Preferences_ColorDlg *aDlg = SMESHGUI_PropertiesDlg dlg( theMarkerMap[ aStudy->StudyId() ], SMESHGUI::desktop() );
new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI() ); // nodes: color, marker
aDlg->SetBooleanValue(1, faces_orientation_3dvectors); dlg.setNodeColor( nodeColor );
aDlg->SetColor(1, c); if( markerType != VTK::MT_USER )
aDlg->SetColor(2, e); dlg.setNodeMarker( markerType, markerScale );
aDlg->SetColor(3, n);
aDlg->SetColor(4, outl);
aDlg->SetColor(5, c0D);
aDlg->SetColor(6, cBall);
aDlg->SetColor(7, o);
aDlg->SetColor(8, selection);
aDlg->SetColor(9, preselection);
aDlg->SetDeltaBrightness(delta);
aDlg->SetDoubleValue(1, faces_orientation_scale);
aDlg->SetIntValue(1, Edgewidth);
aDlg->SetIntValue(2, int(Shrink*100.));
aDlg->SetIntValue(3, size0D);
aDlg->SetIntValue(4, ballSize);
aDlg->setCustomMarkerMap( theMarkerMap[ aStudy->StudyId() ] );
if( aMarkerTypeCurrent != VTK::MT_USER )
aDlg->setStandardMarker( aMarkerTypeCurrent, aMarkerScaleCurrent );
else else
aDlg->setCustomMarker( aMarkerTextureCurrent ); dlg.setNodeCustomMarker( markerId );
// edges: color, line width
dlg.setEdgeColor( edgeColor );
dlg.setEdgeWidth( edgeWidth );
// faces: front color, back color
dlg.setFaceColor( faceColor, deltaF );
// volumes: normal color, reversed color
dlg.setVolumeColor( volumeColor, deltaV );
// outlines: color, line width
dlg.setOutlineColor( outlineColor );
dlg.setOutlineWidth( outlineWidth );
// 0d elements: color, size
dlg.setElem0dColor( elem0dColor );
dlg.setElem0dSize( elem0dSize );
// balls: color, size
dlg.setBallColor( ballColor );
dlg.setBallSize( ballSize );
// orientation: color, scale, 3d flag
dlg.setOrientationColor( orientationColor );
dlg.setOrientationSize( int( orientationScale * 100. ) );
dlg.setOrientation3d( orientation3d );
// shrink: scale factor
dlg.setShrinkCoef( int( shrinkCoef * 100. ) );
// hide unused controls
dlg.showControls( presentEntities, hasNodes );
if ( dlg.exec() ) {
nodeColor = dlg.nodeColor();
markerType = dlg.nodeMarkerType();
markerScale = dlg.nodeMarkerScale();
markerId = dlg.nodeMarkerId();
edgeColor = dlg.edgeColor();
edgeWidth = dlg.edgeWidth();
faceColor = dlg.faceColor();
deltaF = dlg.faceColorDelta();
volumeColor = dlg.volumeColor();
deltaV = dlg.volumeColorDelta();
outlineColor = dlg.outlineColor();
outlineWidth = dlg.outlineWidth();
elem0dColor = dlg.elem0dColor();
elem0dSize = dlg.elem0dSize();
ballColor = dlg.ballColor();
ballSize = dlg.ballSize();
orientationColor = dlg.orientationColor();
orientationScale = dlg.orientationSize() / 100.;
orientation3d = dlg.orientation3d();
shrinkCoef = dlg.shrinkCoef() / 100.;
if(aDlg->exec()){ // store point markers map that might be changed by the user
QColor color = aDlg->GetColor(1); theMarkerMap[ aStudy->StudyId() ] = dlg.customMarkers();
QColor edgecolor = aDlg->GetColor(2);
QColor nodecolor = aDlg->GetColor(3);
QColor outlinecolor = aDlg->GetColor(4);
QColor color0D = aDlg->GetColor(5);
QColor ballcolor = aDlg->GetColor(6);
QColor faces_orientation_color = aDlg->GetColor(7);
QColor selectioncolor = aDlg->GetColor(8);
QColor preSelectioncolor = aDlg->GetColor(9);
int delta = aDlg->GetDeltaBrightness();
/* Point marker */
theMarkerMap[ aStudy->StudyId() ] = aDlg->getCustomMarkerMap();
// set properties from dialog box to the presentations
SALOME_ListIteratorOfListIO It( selected ); SALOME_ListIteratorOfListIO It( selected );
for( ; It.More(); It.Next()){ for ( ; It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value(); Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()){ if ( !IObject->hasEntry() ) continue;
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){ SMESH_Actor* anActor = SMESH::FindActorByEntry( IObject->getEntry() );
/* actor color and backface color */ if ( !anActor ) continue;
anActor->SetSufaceColor(vtkFloatingPointType (color.red()) / 255.,
vtkFloatingPointType (color.green()) / 255., // nodes: color, marker
vtkFloatingPointType (color.blue()) / 255., anActor->SetNodeColor( nodeColor.redF(), nodeColor.greenF(), nodeColor.blueF() );
delta); if ( markerType != VTK::MT_USER ) {
/* edge color */ anActor->SetMarkerStd( markerType, markerScale );
anActor->SetEdgeColor(vtkFloatingPointType (edgecolor.red()) / 255.,
vtkFloatingPointType (edgecolor.green()) / 255.,
vtkFloatingPointType (edgecolor.blue()) / 255.);
/* edge outline */
anActor->SetOutlineColor(vtkFloatingPointType (outlinecolor.red()) / 255.,
vtkFloatingPointType (outlinecolor.green()) / 255.,
vtkFloatingPointType (outlinecolor.blue()) / 255.);
/* selection */
anActor->SetHighlightColor(vtkFloatingPointType (selectioncolor.red()) / 255.,
vtkFloatingPointType (selectioncolor.green()) / 255.,
vtkFloatingPointType (selectioncolor.blue()) / 255.);
/* pre-selection */
anActor->SetPreHighlightColor(vtkFloatingPointType (preSelectioncolor.red()) / 255.,
vtkFloatingPointType (preSelectioncolor.green()) / 255.,
vtkFloatingPointType (preSelectioncolor.blue()) / 255.);
/* Shrink factor and size edges */
anActor->SetShrinkFactor(aDlg->GetIntValue(2) / 100.);
anActor->SetLineWidth(aDlg->GetIntValue(1));
/* Nodes color and size */
anActor->SetNodeColor(vtkFloatingPointType (nodecolor.red()) / 255.,
vtkFloatingPointType (nodecolor.green()) / 255.,
vtkFloatingPointType (nodecolor.blue()) / 255.);
/* 0D elements */
anActor->Set0DColor(vtkFloatingPointType (color0D.red()) / 255.,
vtkFloatingPointType (color0D.green()) / 255.,
vtkFloatingPointType (color0D.blue()) / 255.);
anActor->Set0DSize(aDlg->GetIntValue(3));
/* Ball elements */
anActor->SetBallColor(vtkFloatingPointType (ballcolor.red()) / 255.,
vtkFloatingPointType (ballcolor.green()) / 255.,
vtkFloatingPointType (ballcolor.blue()) / 255.);
anActor->SetBallSize(aDlg->GetIntValue(4));
/* Faces orientation */
vtkFloatingPointType c[3] = {vtkFloatingPointType(faces_orientation_color.redF()),
vtkFloatingPointType(faces_orientation_color.greenF()),
vtkFloatingPointType(faces_orientation_color.blueF())};
anActor->SetFacesOrientationColor(c);
anActor->SetFacesOrientationScale(aDlg->GetDoubleValue(1));
anActor->SetFacesOrientation3DVectors(aDlg->GetBooleanValue(1));
VTK::MarkerType aMarkerTypeNew = aDlg->getMarkerType();
VTK::MarkerScale aMarkerScaleNew = aDlg->getStandardMarkerScale();
int aMarkerTextureNew = aDlg->getCustomMarkerID();
if( aMarkerTypeNew != VTK::MT_USER )
anActor->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
else {
const VTK::MarkerMap& aMarkerMap = theMarkerMap[ aStudy->StudyId() ];
VTK::MarkerMap::const_iterator anIter = aMarkerMap.find( aMarkerTextureNew );
if( anIter != aMarkerMap.end() )
anActor->SetMarkerTexture( aMarkerTextureNew, anIter->second.second );
}
SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
if( !aGroupObject->_is_nil() )
{
SMESH::ElementType anElementType = aGroupObject->GetType();
QColor aColor;
switch( anElementType )
{
case SMESH::NODE: aColor = nodecolor; break;
case SMESH::EDGE: aColor = edgecolor; break;
default: aColor = color; break;
}
SALOMEDS::Color aGroupColor;
aGroupColor.R = (float)aColor.red() / 255.0;
aGroupColor.G = (float)aColor.green() / 255.0;
aGroupColor.B = (float)aColor.blue() / 255.0;
aGroupObject->SetColor( aGroupColor );
}
}
} }
} else {
const VTK::MarkerMap& markerMap = theMarkerMap[ aStudy->StudyId() ];
VTK::MarkerMap::const_iterator iter = markerMap.find( markerId );
if ( iter != markerMap.end() )
anActor->SetMarkerTexture( markerId, iter->second.second );
}
// volumes: normal color, reversed color (delta)
anActor->SetVolumeColor( volumeColor.redF(), volumeColor.greenF(), volumeColor.blueF(), deltaV );
// faces: front color, back color (delta)
anActor->SetSufaceColor( faceColor.redF(), faceColor.greenF(), faceColor.blueF(), deltaF );
// edges: color, width
anActor->SetEdgeColor( edgeColor.redF(), edgeColor.greenF(), edgeColor.blueF() );
anActor->SetLineWidth( edgeWidth );
// outlines: color
anActor->SetOutlineColor( outlineColor.redF(), outlineColor.greenF(), outlineColor.blueF() );
anActor->SetOutlineWidth( outlineWidth );
// 0D elements: color, size
anActor->Set0DColor( elem0dColor.redF(), elem0dColor.greenF(), elem0dColor.blueF() );
anActor->Set0DSize( elem0dSize );
// balls: color, size
anActor->SetBallColor( ballColor.redF(), ballColor.greenF(), ballColor.blueF() );
anActor->SetBallSize( ballSize );
// orientation: color, scale, 3d flag
anActor->SetFacesOrientationColor( orientationColor.redF(), orientationColor.greenF(), orientationColor.blueF() );
anActor->SetFacesOrientationScale( orientationScale );
anActor->SetFacesOrientation3DVectors( orientation3d );
// shrink factor
anActor->SetShrinkFactor( shrinkCoef );
// for groups, set also proper color
SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
if ( !aGroupObject->_is_nil() ) {
SMESH::ElementType anElementType = aGroupObject->GetType();
QColor aColor;
switch( anElementType ) {
case SMESH::NODE:
aColor = nodeColor; break;
case SMESH::EDGE:
aColor = edgeColor; break;
case SMESH::FACE:
aColor = faceColor; break;
case SMESH::VOLUME:
aColor = volumeColor; break;
case SMESH::ELEM0D:
aColor = elem0dColor; break;
case SMESH::BALL:
aColor = ballColor; break;
default: break;
}
if ( aColor.isValid() ) {
SALOMEDS::Color aGroupColor;
aGroupColor.R = aColor.redF();
aGroupColor.G = aColor.greenF();
aGroupColor.B = aColor.blueF();
aGroupObject->SetColor( aGroupColor );
}
} // if ( !aGroupObject->_is_nil() )
} // for ( ; It.More(); It.Next() )
SMESH::RepaintCurrentView(); SMESH::RepaintCurrentView();
} } // if ( dlg.exec() )
delete aDlg;
return; return;
} } // case 1132:
} } // switch(theCommandID)
SALOME_ListIteratorOfListIO It( selected ); SALOME_ListIteratorOfListIO It( selected );
for( ; It.More(); It.Next()){ for( ; It.More(); It.Next()){
Handle(SALOME_InteractiveObject) IObject = It.Value(); Handle(SALOME_InteractiveObject) IObject = It.Value();
@ -2160,6 +2182,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case 116: case 116:
case 115: case 115:
case 117: case 117:
case 118:
case 113: case 113:
case 112: case 112:
case 111: // IMPORT case 111: // IMPORT
@ -2200,6 +2223,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case 143: case 143:
case 144: case 144:
case 145: case 145:
case 146:
case 147:
{ {
::ExportMeshToFile(theCommandID); ::ExportMeshToFile(theCommandID);
break; break;
@ -3509,25 +3534,28 @@ void SMESHGUI::initialize( CAM_Application* app )
// ----- create actions -------------- // ----- create actions --------------
createSMESHAction( 111, "IMPORT_DAT", "", (Qt::CTRL+Qt::Key_B) ); //createSMESHAction( 111, "IMPORT_DAT", "", (Qt::CTRL+Qt::Key_B) );
createSMESHAction( 112, "IMPORT_UNV", "", (Qt::CTRL+Qt::Key_U) ); createSMESHAction( 112, "IMPORT_UNV", "", (Qt::CTRL+Qt::Key_U) );
createSMESHAction( 113, "IMPORT_MED", "", (Qt::CTRL+Qt::Key_M) ); createSMESHAction( 113, "IMPORT_MED", "", (Qt::CTRL+Qt::Key_M) );
createSMESHAction( 114, "NUM" ); createSMESHAction( 114, "NUM" );
createSMESHAction( 115, "IMPORT_STL" ); createSMESHAction( 115, "IMPORT_STL" );
createSMESHAction( 116, "IMPORT_CGNS" ); createSMESHAction( 116, "IMPORT_CGNS" );
createSMESHAction( 117, "IMPORT_SAUV" ); createSMESHAction( 117, "IMPORT_SAUV" );
createSMESHAction( 118, "IMPORT_GMF" );
createSMESHAction( 121, "DAT" ); createSMESHAction( 121, "DAT" );
createSMESHAction( 122, "MED" ); createSMESHAction( 122, "MED" );
createSMESHAction( 123, "UNV" ); createSMESHAction( 123, "UNV" );
createSMESHAction( 140, "STL" ); createSMESHAction( 140, "STL" );
createSMESHAction( 142, "CGNS" ); createSMESHAction( 142, "CGNS");
createSMESHAction( 144, "SAUV" ); createSMESHAction( 144, "SAUV");
createSMESHAction( 146, "GMF" );
createSMESHAction( 124, "EXPORT_DAT" ); createSMESHAction( 124, "EXPORT_DAT" );
createSMESHAction( 125, "EXPORT_MED" ); createSMESHAction( 125, "EXPORT_MED" );
createSMESHAction( 126, "EXPORT_UNV" ); createSMESHAction( 126, "EXPORT_UNV" );
createSMESHAction( 141, "EXPORT_STL" ); createSMESHAction( 141, "EXPORT_STL" );
createSMESHAction( 143, "EXPORT_CGNS" ); createSMESHAction( 143, "EXPORT_CGNS");
createSMESHAction( 145, "EXPORT_SAUV" ); createSMESHAction( 145, "EXPORT_SAUV");
createSMESHAction( 147, "EXPORT_GMF" );
createSMESHAction( 150, "FILE_INFO" ); createSMESHAction( 150, "FILE_INFO" );
createSMESHAction( 33, "DELETE", "ICON_DELETE", Qt::Key_Delete ); createSMESHAction( 33, "DELETE", "ICON_DELETE", Qt::Key_Delete );
createSMESHAction( 5105, "SEL_FILTER_LIB" ); createSMESHAction( 5105, "SEL_FILTER_LIB" );
@ -3699,7 +3727,7 @@ void SMESHGUI::initialize( CAM_Application* app )
renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ), renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ),
transfId = createMenu( tr( "MEN_TRANSF" ), modifyId, 405 ); transfId = createMenu( tr( "MEN_TRANSF" ), modifyId, 405 );
createMenu( 111, importId, -1 ); //createMenu( 111, importId, -1 );
createMenu( 112, importId, -1 ); createMenu( 112, importId, -1 );
createMenu( 113, importId, -1 ); createMenu( 113, importId, -1 );
createMenu( 115, importId, -1 ); createMenu( 115, importId, -1 );
@ -3707,6 +3735,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 116, importId, -1 ); createMenu( 116, importId, -1 );
#endif #endif
createMenu( 117, importId, -1 ); createMenu( 117, importId, -1 );
createMenu( 118, importId, -1 );
createMenu( 121, exportId, -1 ); createMenu( 121, exportId, -1 );
createMenu( 122, exportId, -1 ); createMenu( 122, exportId, -1 );
createMenu( 123, exportId, -1 ); createMenu( 123, exportId, -1 );
@ -3715,6 +3744,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 142, exportId, -1 ); // export to CGNS createMenu( 142, exportId, -1 ); // export to CGNS
#endif #endif
createMenu( 144, exportId, -1 ); // export to SAUV createMenu( 144, exportId, -1 ); // export to SAUV
createMenu( 146, exportId, -1 ); // export to GMF
createMenu( separator(), fileId, 10 ); createMenu( separator(), fileId, 10 );
createMenu( 33, editId, -1 ); createMenu( 33, editId, -1 );
@ -4042,6 +4072,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createPopupItem( 143, OB, mesh_group, multiple_non_empty ); // EXPORT_CGNS createPopupItem( 143, OB, mesh_group, multiple_non_empty ); // EXPORT_CGNS
#endif #endif
createPopupItem( 145, OB, mesh_group, multiple_non_empty ); // EXPORT_SAUV createPopupItem( 145, OB, mesh_group, multiple_non_empty ); // EXPORT_SAUV
createPopupItem( 147, OB, mesh_group, multiple_non_empty ); // EXPORT_GMF
createPopupItem( 33, OB, mesh_part + " " + hyp_alg ); // DELETE createPopupItem( 33, OB, mesh_part + " " + hyp_alg ); // DELETE
createPopupItem( 813, OB, group ); // DEL_GROUP with contents createPopupItem( 813, OB, group ); // DEL_GROUP with contents
popupMgr()->insert( separator(), -1, 0 ); popupMgr()->insert( separator(), -1, 0 );
@ -4407,7 +4438,7 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
// end of GEOM plugins loading // end of GEOM plugins loading
// Reset actions accelerator keys // Reset actions accelerator keys
action(111)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); // Import DAT //action(111)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); // Import DAT
action(112)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U)); // Import UNV action(112)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U)); // Import UNV
action(113)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); // Import MED action(113)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); // Import MED
@ -4442,7 +4473,7 @@ bool SMESHGUI::deactivateModule( SUIT_Study* study )
EmitSignalCloseAllDialogs(); EmitSignalCloseAllDialogs();
// Unset actions accelerator keys // Unset actions accelerator keys
action(111)->setShortcut(QKeySequence()); // Import DAT //action(111)->setShortcut(QKeySequence()); // Import DAT
action(112)->setShortcut(QKeySequence()); // Import UNV action(112)->setShortcut(QKeySequence()); // Import UNV
action(113)->setShortcut(QKeySequence()); // Import MED action(113)->setShortcut(QKeySequence()); // Import MED
@ -4761,20 +4792,23 @@ void SMESHGUI::createPreferences()
setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList ); setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
int elemGroup = addPreference( tr( "PREF_GROUP_ELEMENTS" ), meshTab ); int elemGroup = addPreference( tr( "PREF_GROUP_ELEMENTS" ), meshTab );
setPreferenceProperty( elemGroup, "columns", 2 ); //setPreferenceProperty( elemGroup, "columns", 2 );
int ColorId = addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::BiColor, "SMESH", "fill_color" ); int ColorId = addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::BiColor, "SMESH", "fill_color" );
setPreferenceProperty( ColorId, "text", tr("PREF_BACKFACE") );
ColorId = addPreference( tr( "PREF_VOLUME" ), elemGroup, LightApp_Preferences::BiColor, "SMESH", "volume_color" );
setPreferenceProperty( ColorId, "text", tr("PREF_REVERSEDVOLUME") );
addPreference( tr( "PREF_COLOR_0D" ), elemGroup, LightApp_Preferences::Color, "SMESH", "elem0d_color" ); addPreference( tr( "PREF_COLOR_0D" ), elemGroup, LightApp_Preferences::Color, "SMESH", "elem0d_color" );
addPreference( tr( "PREF_BALL_COLOR" ), elemGroup, LightApp_Preferences::Color, "SMESH", "ball_elem_color" ); addPreference( tr( "PREF_BALL_COLOR" ), elemGroup, LightApp_Preferences::Color, "SMESH", "ball_elem_color" );
addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" ); addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" );
addPreference( tr( "PREF_WIREFRAME" ), elemGroup, LightApp_Preferences::Color, "SMESH", "wireframe_color" ); addPreference( tr( "PREF_WIREFRAME" ), elemGroup, LightApp_Preferences::Color, "SMESH", "wireframe_color" );
setPreferenceProperty( ColorId, "text", tr("PREF_BACKFACE") );
int grpGroup = addPreference( tr( "PREF_GROUP_GROUPS" ), meshTab ); int grpGroup = addPreference( tr( "PREF_GROUP_GROUPS" ), meshTab );
setPreferenceProperty( grpGroup, "columns", 2 ); setPreferenceProperty( grpGroup, "columns", 2 );
addPreference( tr( "PREF_GRP_NAMES" ), grpGroup, LightApp_Preferences::Color, "SMESH", "group_name_color" ); addPreference( tr( "PREF_GRP_NAMES" ), grpGroup, LightApp_Preferences::Color, "SMESH", "group_name_color" );
addPreference( tr( "PREF_GRP_DEF_COLOR" ), grpGroup, LightApp_Preferences::Color, "SMESH", "default_grp_color" );
int size0d = addPreference(tr("PREF_SIZE_0D"), elemGroup, int size0d = addPreference(tr("PREF_SIZE_0D"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "elem0d_size"); LightApp_Preferences::IntSpin, "SMESH", "elem0d_size");
@ -4782,6 +4816,8 @@ void SMESHGUI::createPreferences()
LightApp_Preferences::IntSpin, "SMESH", "ball_elem_size"); LightApp_Preferences::IntSpin, "SMESH", "ball_elem_size");
int elemW = addPreference(tr("PREF_WIDTH"), elemGroup, int elemW = addPreference(tr("PREF_WIDTH"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "element_width"); LightApp_Preferences::IntSpin, "SMESH", "element_width");
int outW = addPreference(tr("PREF_OUTLINE_WIDTH"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "outline_width");
int shrink = addPreference(tr("PREF_SHRINK_COEFF"), elemGroup, int shrink = addPreference(tr("PREF_SHRINK_COEFF"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "shrink_coeff"); LightApp_Preferences::IntSpin, "SMESH", "shrink_coeff");
@ -4794,6 +4830,9 @@ void SMESHGUI::createPreferences()
setPreferenceProperty( elemW, "min", 1 ); setPreferenceProperty( elemW, "min", 1 );
setPreferenceProperty( elemW, "max", 5 ); setPreferenceProperty( elemW, "max", 5 );
setPreferenceProperty( outW, "min", 1 );
setPreferenceProperty( outW, "max", 5 );
setPreferenceProperty( shrink, "min", 0 ); setPreferenceProperty( shrink, "min", 0 );
setPreferenceProperty( shrink, "max", 100 ); setPreferenceProperty( shrink, "max", 100 );
@ -5169,9 +5208,9 @@ SALOMEDS::Color SMESHGUI::getUniqueColor( const QList<SALOMEDS::Color>& theReser
aColor.setHsv( aHue, 255, 255 ); aColor.setHsv( aHue, 255, 255 );
SALOMEDS::Color aSColor; SALOMEDS::Color aSColor;
aSColor.R = (double)aColor.red() / 255.0; aSColor.R = aColor.redF();
aSColor.G = (double)aColor.green() / 255.0; aSColor.G = aColor.greenF();
aSColor.B = (double)aColor.blue() / 255.0; aSColor.B = aColor.blueF();
return aSColor; return aSColor;
} }

View File

@ -498,12 +498,12 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
int idx = 0; int idx = 0;
if( addToGroup ) { if( addToGroup ) {
aGroupName = ComboBox_GroupName->currentText(); aGroupName = ComboBox_GroupName->currentText();
for ( int i = 1; i < ComboBox_GroupName->count(); i++ ) { for ( int i = 1; i <= ComboBox_GroupName->count(); i++ ) {
QString aName = ComboBox_GroupName->itemText( i ); QString aName = ComboBox_GroupName->itemText( i );
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) ) if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
idx = i; idx = i;
} }
if ( idx > 0 && idx < myGroups.count() ) { if ( idx > 0 && idx <= myGroups.count() ) {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] ); SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
if ( !aGeomGroup->_is_nil() ) { if ( !aGeomGroup->_is_nil() ) {
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),

View File

@ -711,12 +711,12 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply()
int idx = 0; int idx = 0;
if( addToGroup ) { if( addToGroup ) {
aGroupName = ComboBox_GroupName->currentText(); aGroupName = ComboBox_GroupName->currentText();
for ( int i = 1; i < ComboBox_GroupName->count(); i++ ) { for ( int i = 1; i <= ComboBox_GroupName->count(); i++ ) {
QString aName = ComboBox_GroupName->itemText( i ); QString aName = ComboBox_GroupName->itemText( i );
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) ) if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
idx = i; idx = i;
} }
if ( idx > 0 && idx < myGroups.count() ) { if ( idx > 0 && idx <= myGroups.count() ) {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] ); SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
if ( !aGeomGroup->_is_nil() ) { if ( !aGeomGroup->_is_nil() ) {
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),

View File

@ -370,7 +370,7 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule, SVTK_ViewWindow
ActorList = new QListWidget(GroupPlanes); ActorList = new QListWidget(GroupPlanes);
ActorList->setSelectionMode(QAbstractItemView::SingleSelection); ActorList->setSelectionMode(QAbstractItemView::SingleSelection);
SelectAllCheckBox = new QCheckBox(tr("SELECT_ALL"), GroupPlanes); SelectAllCheckBox = new QCheckBox(tr("SELECT_ALL"), GroupPlanes);
GroupPlanesLayout->addWidget(ComboBoxPlanes, 0, 0); GroupPlanesLayout->addWidget(ComboBoxPlanes, 0, 0);
@ -477,7 +477,7 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule, SVTK_ViewWindow
connect(SpinBoxRot1, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam())); connect(SpinBoxRot1, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
connect(SpinBoxRot2, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam())); connect(SpinBoxRot2, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
connect(PreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnPreviewToggle(bool))); connect(PreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnPreviewToggle(bool)));
connect(AutoApplyCheckBox, SIGNAL(toggled(bool)), this, SLOT(ClickOnApply())); connect(AutoApplyCheckBox, SIGNAL(toggled(bool)), this, SLOT(onAutoApply(bool)));
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@ -1063,7 +1063,9 @@ void SMESHGUI_ClippingDlg::initializePlaneData()
SMESHGUI_ClippingPlaneInfoList::const_iterator anIter2 = aClippingPlaneInfoList.begin(); SMESHGUI_ClippingPlaneInfoList::const_iterator anIter2 = aClippingPlaneInfoList.begin();
for( ; anIter2 != aClippingPlaneInfoList.end(); anIter2++ ) { for( ; anIter2 != aClippingPlaneInfoList.end(); anIter2++ ) {
const SMESH::ClippingPlaneInfo& aClippingPlaneInfo = *anIter2; const SMESH::ClippingPlaneInfo& aClippingPlaneInfo = *anIter2;
SMESH::TPlane aTPlane( aClippingPlaneInfo.Plane ); SMESH::OrientedPlane* anOrientedPlane = SMESH::OrientedPlane::New(myViewWindow);
anOrientedPlane->ShallowCopy(aClippingPlaneInfo.Plane);
SMESH::TPlane aTPlane( anOrientedPlane );
SMESH::TPlaneData aPlaneData( aTPlane, aClippingPlaneInfo.ActorList ); SMESH::TPlaneData aPlaneData( aTPlane, aClippingPlaneInfo.ActorList );
myPlanes.push_back( aPlaneData ); myPlanes.push_back( aPlaneData );
} }
@ -1170,3 +1172,8 @@ void SMESHGUI_ClippingDlg::dumpPlaneData() const
} }
printf( "----------------------------------\n" ); printf( "----------------------------------\n" );
} }
void SMESHGUI_ClippingDlg::onAutoApply(bool toggled)
{
if ( toggled ) ClickOnApply();
}

View File

@ -201,6 +201,7 @@ public slots:
void onSelectOrientation( int ); void onSelectOrientation( int );
void SetCurrentPlaneParam(); void SetCurrentPlaneParam();
void OnPreviewToggle( bool ); void OnPreviewToggle( bool );
void onAutoApply(bool);
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel(); void ClickOnCancel();
void ClickOnApply(); void ClickOnApply();

View File

@ -337,15 +337,16 @@ namespace SMESH
{ {
QString text; QString text;
switch ( errCode ) { switch ( errCode ) {
CASE2TEXT( COMPERR_OK ); CASE2TEXT( COMPERR_OK );
CASE2TEXT( COMPERR_BAD_INPUT_MESH); CASE2TEXT( COMPERR_BAD_INPUT_MESH );
CASE2TEXT( COMPERR_STD_EXCEPTION ); CASE2TEXT( COMPERR_STD_EXCEPTION );
CASE2TEXT( COMPERR_OCC_EXCEPTION ); CASE2TEXT( COMPERR_OCC_EXCEPTION );
case SMESH::COMPERR_SLM_EXCEPTION: break; // avoid double "Salome exception" case SMESH::COMPERR_SLM_EXCEPTION: break; // avoid double "Salome exception"
CASE2TEXT( COMPERR_EXCEPTION ); CASE2TEXT( COMPERR_EXCEPTION );
CASE2TEXT( COMPERR_MEMORY_PB ); CASE2TEXT( COMPERR_MEMORY_PB );
CASE2TEXT( COMPERR_BAD_SHAPE ); CASE2TEXT( COMPERR_BAD_SHAPE );
CASE2TEXT( COMPERR_CANCELED ); CASE2TEXT( COMPERR_CANCELED );
CASE2TEXT( COMPERR_NO_MESH_ON_SHAPE );
case SMESH::COMPERR_ALGO_FAILED: case SMESH::COMPERR_ALGO_FAILED:
if ( strlen(comment) == 0 ) if ( strlen(comment) == 0 )
text = QObject::tr("COMPERR_ALGO_FAILED"); text = QObject::tr("COMPERR_ALGO_FAILED");
@ -550,6 +551,9 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent, bool ForEval)
myTable->hideColumn( COL_SHAPEID ); myTable->hideColumn( COL_SHAPEID );
myTable->hideColumn( COL_BAD_MESH ); myTable->hideColumn( COL_BAD_MESH );
myTable->horizontalHeader()->setResizeMode( COL_ERROR, QHeaderView::Interactive ); myTable->horizontalHeader()->setResizeMode( COL_ERROR, QHeaderView::Interactive );
myTable->setWordWrap( true );
myTable->horizontalHeader()->setStretchLastSection( true );
myTable->setMinimumWidth( 500 );
QStringList headers; QStringList headers;
headers << tr( "COL_ALGO_HEADER" ); headers << tr( "COL_ALGO_HEADER" );
@ -564,12 +568,12 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent, bool ForEval)
QGridLayout* grpLayout = new QGridLayout(myCompErrorGroup); QGridLayout* grpLayout = new QGridLayout(myCompErrorGroup);
grpLayout->setSpacing(SPACING); grpLayout->setSpacing(SPACING);
grpLayout->setMargin(MARGIN); grpLayout->setMargin(MARGIN);
grpLayout->addWidget( myWarningLabel, 0, 0 ); grpLayout->addWidget( myWarningLabel, 0, 0, 1, 4 );
grpLayout->addWidget( myTable, 1, 0, 4, 1 ); grpLayout->addWidget( myTable, 1, 0, 1, 4 );
grpLayout->addWidget( myShowBtn, 1, 1 ); grpLayout->addWidget( myShowBtn, 2, 0 );
grpLayout->addWidget( myPublishBtn, 2, 1 ); grpLayout->addWidget( myPublishBtn, 2, 1 );
grpLayout->addWidget( myBadMeshBtn, 3, 1 ); grpLayout->addWidget( myBadMeshBtn, 2, 2 );
grpLayout->setRowStretch( 4, 1 ); grpLayout->setColumnStretch( 3, 1 );
// Hypothesis definition errors // Hypothesis definition errors
@ -948,7 +952,8 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack,
{ {
bool onlyWarnings = !theNoCompError; // == valid mesh computed but there are errors reported bool onlyWarnings = !theNoCompError; // == valid mesh computed but there are errors reported
for ( int i = 0; i < theCompErrors->length() && onlyWarnings; ++i ) for ( int i = 0; i < theCompErrors->length() && onlyWarnings; ++i )
onlyWarnings = ( theCompErrors[ i ].code == SMESH::COMPERR_WARNING ); onlyWarnings = ( theCompErrors[ i ].code == SMESH::COMPERR_WARNING ||
theCompErrors[ i ].code == SMESH::COMPERR_NO_MESH_ON_SHAPE );
// full or brief mesh info // full or brief mesh info
SMESH::long_array_var aRes = myMesh->GetMeshInfo(); SMESH::long_array_var aRes = myMesh->GetMeshInfo();
@ -1035,6 +1040,7 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack,
} }
tbl->resizeColumnToContents( COL_ALGO ); tbl->resizeColumnToContents( COL_ALGO );
tbl->resizeColumnToContents( COL_SHAPE ); tbl->resizeColumnToContents( COL_SHAPE );
tbl->setWordWrap( true );
if ( hasBadMesh ) if ( hasBadMesh )
aCompDlg->myBadMeshBtn->show(); aCompDlg->myBadMeshBtn->show();
@ -1142,13 +1148,13 @@ void SMESHGUI_BaseComputeOp::onShowBadMesh()
SMESH::MeshPreviewStruct_var aMeshData = gen->GetBadInputElements(myMesh,curSub); SMESH::MeshPreviewStruct_var aMeshData = gen->GetBadInputElements(myMesh,curSub);
vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3); vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1); vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
// delete property !!!!!!!!!!
vtkProperty* prop = vtkProperty::New(); vtkProperty* prop = vtkProperty::New();
prop->SetLineWidth( aLineWidth * 3 ); prop->SetLineWidth( aLineWidth * 3 );
prop->SetPointSize( aPointSize * 3 ); prop->SetPointSize( aPointSize * 3 );
prop->SetColor( 250, 0, 250 ); prop->SetColor( 250, 0, 250 );
myBadMeshDisplayer->GetActor()->SetProperty( prop ); myBadMeshDisplayer->GetActor()->SetProperty( prop );
myBadMeshDisplayer->SetData( aMeshData._retn() ); myBadMeshDisplayer->SetData( aMeshData._retn() );
prop->Delete();
} }
} }
} }
@ -2084,6 +2090,7 @@ void SMESHGUI_BaseComputeOp::showEvaluateResult(const SMESH::long_array& theRes,
} }
tbl->resizeColumnToContents( COL_ALGO ); tbl->resizeColumnToContents( COL_ALGO );
tbl->resizeColumnToContents( COL_SHAPE ); tbl->resizeColumnToContents( COL_SHAPE );
tbl->setWordWrap( true );
if ( hasBadMesh ) if ( hasBadMesh )
aCompDlg->myBadMeshBtn->show(); aCompDlg->myBadMeshBtn->show();

View File

@ -29,21 +29,26 @@
#include "SMESHGUI.h" #include "SMESHGUI.h"
#include "SMESHGUI_ConvToQuadDlg.h" #include "SMESHGUI_ConvToQuadDlg.h"
#include "SMESHGUI_MeshEditPreview.h"
#include "SMESHGUI_Utils.h" #include "SMESHGUI_Utils.h"
#include "SMDSAbs_ElementType.hxx" #include "SMESH_ActorUtils.h"
#include "SMESH_TypeFilter.hxx" #include "SMESH_TypeFilter.hxx"
#include "SMDSAbs_ElementType.hxx"
// SALOME GUI includes // SALOME GUI includes
#include <LightApp_UpdateFlags.h> #include <LightApp_UpdateFlags.h>
#include <SUIT_MessageBox.h> #include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h> #include <SUIT_OverrideCursor.h>
#include <SalomeApp_Tools.h> #include <SalomeApp_Tools.h>
#include <SALOME_Actor.h>
// IDL includes // IDL includes
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_MeshEditor) #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
// VTK includes
#include <vtkProperty.h>
//================================================================================ //================================================================================
/*! /*!
* \brief Constructor * \brief Constructor
@ -53,7 +58,8 @@
//================================================================================ //================================================================================
SMESHGUI_ConvToQuadOp::SMESHGUI_ConvToQuadOp() SMESHGUI_ConvToQuadOp::SMESHGUI_ConvToQuadOp()
: SMESHGUI_SelectionOp(), : SMESHGUI_SelectionOp(),
myDlg( 0 ) myDlg( 0 ),
myBadElemsPreview(0)
{ {
} }
@ -64,8 +70,8 @@ SMESHGUI_ConvToQuadOp::SMESHGUI_ConvToQuadOp()
//================================================================================ //================================================================================
SMESHGUI_ConvToQuadOp::~SMESHGUI_ConvToQuadOp() SMESHGUI_ConvToQuadOp::~SMESHGUI_ConvToQuadOp()
{ {
if ( myDlg ) if ( myDlg ) delete myDlg;
delete myDlg; if ( myBadElemsPreview ) delete myBadElemsPreview;
} }
//================================================================================ //================================================================================
@ -237,14 +243,47 @@ bool SMESHGUI_ConvToQuadOp::onApply()
SMESH::SMESH_Mesh_var sourceMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pObj ); SMESH::SMESH_Mesh_var sourceMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pObj );
if( !myDlg->CurrentRB() ) if( !myDlg->CurrentRB() )
{ {
bool aParam = true; bool force3d = true;
if( myDlg->IsEnabledCheck() ) if( myDlg->IsEnabledCheck() )
aParam = myDlg->IsMediumNdsOnGeom(); force3d = myDlg->IsMediumNdsOnGeom();
if ( sourceMesh->_is_nil() ) if ( sourceMesh->_is_nil() )
aEditor->ConvertToQuadraticObject( aParam, idSource ); aEditor->ConvertToQuadraticObject( force3d, idSource );
else else
aEditor->ConvertToQuadratic( aParam ); aEditor->ConvertToQuadratic( force3d );
if ( !force3d )
{
SMESH::ComputeError_var error = aEditor->GetLastError();
if ( error->hasBadMesh )
{
if ( myBadElemsPreview ) delete myBadElemsPreview; // viewWindow may change
myBadElemsPreview = new SMESHGUI_MeshEditPreview( viewWindow() );
vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
vtkProperty* prop = vtkProperty::New();
prop->SetLineWidth( aLineWidth * 3 );
prop->SetPointSize( aPointSize * 3 );
prop->SetColor( 250, 0, 250 );
myBadElemsPreview->GetActor()->SetProperty( prop );
prop->Delete();
SMESH::MeshPreviewStruct_var previewData = aEditor->GetPreviewData();
myBadElemsPreview->SetData( & previewData.in() );
myBadElemsPreview->SetVisibility(true);
SUIT_MessageBox* mb = new SUIT_MessageBox(SUIT_MessageBox::Warning,
tr( "SMESH_WRN_WARNING" ),
tr("EDITERR_NO_MEDIUM_ON_GEOM"),
SUIT_MessageBox::Ok, myDlg);
mb->setWindowModality( Qt::NonModal );
mb->setAttribute( Qt::WA_DeleteOnClose );
mb->show();
connect ( mb, SIGNAL( finished(int) ), this, SLOT( onWarningWinFinished() ));
//connect ( mb, SIGNAL( rejected() ), this, SLOT( onWarningWinFinished() ));
}
}
} }
else else
{ {
@ -272,6 +311,18 @@ bool SMESHGUI_ConvToQuadOp::onApply()
return aResult; return aResult;
} }
//================================================================================
/*!
* \brief SLOT called when a warning window is closed
*/
//================================================================================
void SMESHGUI_ConvToQuadOp::onWarningWinFinished()
{
if ( myBadElemsPreview )
myBadElemsPreview->SetVisibility(false);
}
//================================================================================ //================================================================================
/*! ConsistMesh /*! ConsistMesh
* Determines, what elements this mesh contains. * Determines, what elements this mesh contains.

View File

@ -37,6 +37,7 @@
#include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Mesh)
class SMESHGUI_ConvToQuadDlg; class SMESHGUI_ConvToQuadDlg;
class SMESHGUI_MeshEditPreview;
class SMESHGUI_EXPORT SMESHGUI_ConvToQuadOp : public SMESHGUI_SelectionOp class SMESHGUI_EXPORT SMESHGUI_ConvToQuadOp : public SMESHGUI_SelectionOp
{ {
@ -60,9 +61,11 @@ protected:
protected slots: protected slots:
virtual bool onApply(); virtual bool onApply();
void ConnectRadioButtons( int ); void ConnectRadioButtons( int );
void onWarningWinFinished();
private: private:
SMESHGUI_ConvToQuadDlg* myDlg; SMESHGUI_ConvToQuadDlg* myDlg;
SMESHGUI_MeshEditPreview* myBadElemsPreview;
}; };
#endif // SMESHGUI_CONVTOQUADOP_H #endif // SMESHGUI_CONVTOQUADOP_H

View File

@ -458,12 +458,12 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply()
int idx = 0; int idx = 0;
if( addToGroup ) { if( addToGroup ) {
aGroupName = ComboBox_GroupName->currentText(); aGroupName = ComboBox_GroupName->currentText();
for ( int i = 1; i < ComboBox_GroupName->count(); i++ ) { for ( int i = 1; i <= ComboBox_GroupName->count(); i++ ) {
QString aName = ComboBox_GroupName->itemText( i ); QString aName = ComboBox_GroupName->itemText( i );
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) ) if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
idx = i; idx = i;
} }
if ( idx > 0 && idx < myGroups.count() ) { if ( idx > 0 && idx <= myGroups.count() ) {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] ); SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
if ( !aGeomGroup->_is_nil() ) { if ( !aGeomGroup->_is_nil() ) {
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),

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