Salome HOME
Merge with OCC_development_01 V2_2_0a1
authoradmin <salome-admin@opencascade.com>
Thu, 20 Jan 2005 06:25:54 +0000 (06:25 +0000)
committeradmin <salome-admin@opencascade.com>
Thu, 20 Jan 2005 06:25:54 +0000 (06:25 +0000)
120 files changed:
Makefile.in
adm_local/unix/make_commence.in
configure.in.base
doc/salome/tui/Makefile.in
doc/salome/tui/SMESH/doxyfile_py [new file with mode: 0755]
doc/salome/tui/SMESH/sources/myheader_py2.html [new file with mode: 0755]
doc/salome/tui/SMESH/sources/static/tree.js
idl/SMESH_Filter.idl
idl/SMESH_Mesh.idl
idl/SMESH_Pattern.idl
resources/SMESH_en.xml
resources/mesh_add.png [new file with mode: 0755]
resources/mesh_aspect_3d.png [new file with mode: 0644]
resources/mesh_extrusionpath.png [new file with mode: 0644]
resources/mesh_free_edges_2d.png [new file with mode: 0644]
resources/mesh_length_2d.png [new file with mode: 0644]
resources/mesh_multi_edges_2d.png [new file with mode: 0644]
resources/mesh_remove.png [new file with mode: 0755]
src/Controls/Makefile.in
src/Controls/SMESHControls.cxx
src/Controls/SMESH_Controls.cxx
src/Controls/SMESH_Controls.hxx
src/Controls/SMESH_ControlsDef.hxx [new file with mode: 0644]
src/DriverDAT/Makefile.in
src/DriverMED/DriverMED_Family.cxx
src/DriverMED/DriverMED_Family.h
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.h
src/DriverMED/Makefile.in
src/DriverUNV/Makefile.in
src/OBJECT/Makefile.in
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Actor.h
src/OBJECT/SMESH_ActorDef.h [new file with mode: 0644]
src/OBJECT/SMESH_ActorUtils.cxx
src/OBJECT/SMESH_ActorUtils.h
src/OBJECT/SMESH_DeviceActor.cxx
src/OBJECT/SMESH_DeviceActor.h
src/OBJECT/SMESH_Object.cxx
src/OBJECT/SMESH_Object.h
src/OBJECT/SMESH_ObjectDef.h [new file with mode: 0644]
src/SMDS/Makefile.in
src/SMDS/SMDS_ElemIterator.hxx [new file with mode: 0755]
src/SMDS/SMDS_FaceOfEdges.cxx
src/SMDS/SMDS_FaceOfEdges.hxx
src/SMDS/SMDS_FaceOfNodes.cxx
src/SMDS/SMDS_FaceOfNodes.hxx
src/SMDS/SMDS_IteratorOfElements.cxx
src/SMDS/SMDS_Mesh.cxx
src/SMDS/SMDS_Mesh.hxx
src/SMDS/SMDS_MeshEdge.cxx
src/SMDS/SMDS_MeshElement.cxx
src/SMDS/SMDS_MeshElement.hxx
src/SMDS/SMDS_MeshElementIDFactory.cxx
src/SMDS/SMDS_MeshElementIDFactory.hxx
src/SMDS/SMDS_MeshGroup.cxx
src/SMDS/SMDS_MeshGroup.hxx
src/SMDS/SMDS_MeshNode.cxx
src/SMDS/SMDS_MeshNode.hxx
src/SMDS/SMDS_VertexPosition.cxx
src/SMDS/SMDS_VolumeOfFaces.cxx
src/SMDS/SMDS_VolumeOfFaces.hxx
src/SMDS/SMDS_VolumeOfNodes.cxx
src/SMDS/SMDS_VolumeOfNodes.hxx
src/SMDS/SMDS_VolumeTool.cxx
src/SMDS/SMDS_VolumeTool.hxx
src/SMESH/Makefile.in
src/SMESH/SMESH_Block.cxx
src/SMESH/SMESH_Block.hxx
src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_Mesh.hxx
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH/SMESH_MeshEditor.hxx
src/SMESH/SMESH_Pattern.cxx
src/SMESH/SMESH_Pattern.hxx
src/SMESHDS/SMESHDS_Mesh.hxx
src/SMESHGUI/Makefile.in
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_ClippingDlg.cxx
src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx
src/SMESHGUI/SMESHGUI_FilterDlg.cxx
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx
src/SMESHGUI/SMESHGUI_MeshPatternDlg.h
src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx
src/SMESHGUI/SMESHGUI_NodesDlg.cxx
src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx
src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx
src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx
src/SMESHGUI/SMESHGUI_RotationDlg.cxx
src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx
src/SMESHGUI/SMESHGUI_SpinBox.h
src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx
src/SMESHGUI/SMESHGUI_TranslationDlg.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.h
src/SMESHGUI/SMESH_icons.po
src/SMESHGUI/SMESH_msg_en.po
src/SMESH_I/Makefile.in
src/SMESH_I/SMESH_Filter_i.cxx
src/SMESH_I/SMESH_Filter_i.hxx
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.hxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx
src/SMESH_I/SMESH_Pattern_i.cxx
src/SMESH_I/SMESH_Pattern_i.hxx
src/SMESH_I/SMESH_test.py [deleted file]
src/SMESH_SWIG/Makefile.in
src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py [new file with mode: 0644]
src/SMESH_SWIG/SMESH_test.py [new file with mode: 0644]
src/SMESH_SWIG/SMESH_test5.py
src/SMESH_SWIG/cyl2complementary.py
src/SMESH_SWIG/cyl2geometry.py
src/SMESH_SWIG/meshpy.py
src/StdMeshers/StdMeshers_Regular_1D.cxx
src/StdMeshersGUI/Makefile.in

index 7b95934eeb5e3adae0f97d1321a471a0a18158bd..dfbd2629a219fe073b359d930f3a4971f1398649 100644 (file)
@@ -27,6 +27,7 @@ mesh_algo_tetra.png \
 mesh_angle.png \
 mesh_area.png \
 mesh_aspect.png \
 mesh_angle.png \
 mesh_area.png \
 mesh_aspect.png \
+mesh_aspect_3d.png \
 mesh_compute.png \
 mesh_connectivity.png \
 mesh_diagonal.png \
 mesh_compute.png \
 mesh_connectivity.png \
 mesh_diagonal.png \
@@ -42,8 +43,11 @@ advanced_mesh_info.png \
 standard_mesh_info.png \
 mesh_init.png \
 mesh_length.png \
 standard_mesh_info.png \
 mesh_init.png \
 mesh_length.png \
+mesh_length_2d.png \
 mesh_free_edges.png \
 mesh_free_edges.png \
+mesh_free_edges_2d.png \
 mesh_multi_edges.png \
 mesh_multi_edges.png \
+mesh_multi_edges_2d.png \
 mesh_line_n.png \
 mesh_line.png \
 mesh_move_node.png \
 mesh_line_n.png \
 mesh_line.png \
 mesh_move_node.png \
@@ -95,6 +99,7 @@ mesh_smoothing.png \
 mesh_renumbering_nodes.png \
 mesh_renumbering_elements.png \
 mesh_extrusion.png \
 mesh_renumbering_nodes.png \
 mesh_renumbering_elements.png \
 mesh_extrusion.png \
+mesh_extrusionpath.png \
 mesh_revolution.png \
 ModuleMesh.png \
 mesh_unionGroups.png \
 mesh_revolution.png \
 ModuleMesh.png \
 mesh_unionGroups.png \
@@ -120,7 +125,9 @@ SMESHCatalog.xml \
 flight_solid.brep \
 mesh_pattern.png \
 pattern_sample_2d.png \
 flight_solid.brep \
 mesh_pattern.png \
 pattern_sample_2d.png \
-pattern_sample_3D.png
+pattern_sample_3D.png \
+mesh_add.png \
+mesh_remove.png
 
 BIN_SCRIPT= \
 VERSION
 
 BIN_SCRIPT= \
 VERSION
index 43b015ee64958847266e6636aea2dad166e4b017..1a315f806c518a3c79782c37f2fa45d3c56cc6a5 100644 (file)
@@ -97,12 +97,6 @@ HDF5_INCLUDES=@HDF5_INCLUDES@
 HDF5_LIBS=@HDF5_LIBS@
 HDF5_MT_LIBS=@HDF5_MT_LIBS@
 
 HDF5_LIBS=@HDF5_LIBS@
 HDF5_MT_LIBS=@HDF5_MT_LIBS@
 
-# MED2
-
-MED2_INCLUDES=@MED2_INCLUDES@
-MED2_LIBS=@MED2_LIBS@
-MED2_MT_LIBS=@MED2_MT_LIBS@
-
 # OpenCasCade
 
 OCC_INCLUDES=@CAS_CPPFLAGS@
 # OpenCasCade
 
 OCC_INCLUDES=@CAS_CPPFLAGS@
@@ -251,8 +245,8 @@ ac_cxx_mutable.m4                 check_mico.m4      libtool.m4             \
 ac_cxx_namespaces.m4              check_omniorb.m4   pyembed.m4                \
 ac_cxx_partial_specialization.m4  check_opengl.m4    python.m4         \
 ac_cxx_typename.m4                check_pthreads.m4  check_cas.m4      \
 ac_cxx_namespaces.m4              check_omniorb.m4   pyembed.m4                \
 ac_cxx_partial_specialization.m4  check_opengl.m4    python.m4         \
 ac_cxx_typename.m4                check_pthreads.m4  check_cas.m4      \
-ac_cc_warnings.m4                 check_qt.m4        check_med2.m4      \
-check_swig.m4                     check_boost.m4 
+ac_cc_warnings.m4                 check_qt.m4        check_boost.m4     \
+check_swig.m4                      
 
 $(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%)
        cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files
 
 $(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%)
        cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files
index 16b6b77fa798a9a63ee8293213b608c69337e4c3..38caec219a84d14d5bf393cd7a42627b3403fcc6 100644 (file)
@@ -233,14 +233,6 @@ echo
 
 CHECK_HDF5
 
 
 CHECK_HDF5
 
-echo
-echo ---------------------------------------------
-echo testing MED2
-echo ---------------------------------------------
-echo
-
-CHECK_MED2
-
 echo
 echo ---------------------------------------------
 echo Testing OpenCascade
 echo
 echo ---------------------------------------------
 echo Testing OpenCascade
@@ -288,7 +280,7 @@ echo ---------------------------------------------
 echo
 
 echo Configure
 echo
 
 echo Configure
-variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok"
+variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok"
 
 for var in $variables
 do
 
 for var in $variables
 do
index 8d8b65de9b1b0a9ad69ed6174fd5d8868b3f2191..fa7151e47352be23bb62f24a8e46dc1e781a1e5e 100644 (file)
@@ -16,13 +16,28 @@ doxygen=@DOXYGEN@
 
 @COMMENCE@
 
 
 @COMMENCE@
 
+PYTHON_SCRIPTS = \
+       meshpy.py
+
 docs:
        cp -fr $(srcdir)/SMESH ./INPUT; \
        cd INPUT; \
        sed 's|../../../share/salome|$(root_srcdir)|' ./doxyfile > ./doxyfile1; \
        mv -f doxyfile1 doxyfile; \
        $(doxygen) ./doxyfile; \
 docs:
        cp -fr $(srcdir)/SMESH ./INPUT; \
        cd INPUT; \
        sed 's|../../../share/salome|$(root_srcdir)|' ./doxyfile > ./doxyfile1; \
        mv -f doxyfile1 doxyfile; \
        $(doxygen) ./doxyfile; \
-       cd ..; \
+       mkdir py1; mkdir py2; \
+       cd ..
+       for file in $(PYTHON_SCRIPTS) dummy; do \
+         if [ $$file != "dummy" ]; then \
+           cp $(root_srcdir)/src/SMESH_SWIG/$$file INPUT/py1/; \
+         fi ; \
+       done
+       cd INPUT; \
+       python $(KERNEL_ROOT_DIR)/doc/salome/tui/KERNEL/pythfilter.py ./py1 ./py2; \
+       sed 's|list_py_files_to_process|$(PYTHON_SCRIPTS)|' ./doxyfile_py > py2/doxyfile_py; \
+       cd py2; \
+       $(doxygen) ./doxyfile_py; \
+       cd ../..; \
        cp -fr $(srcdir)/SMESH/sources/static/*.* ./SMESH/
        cp -fr $(srcdir)/SMESH/sources/ SMESH/
        cp -fr $(srcdir)/SMESH/HTML/ SMESH/
        cp -fr $(srcdir)/SMESH/sources/static/*.* ./SMESH/
        cp -fr $(srcdir)/SMESH/sources/ SMESH/
        cp -fr $(srcdir)/SMESH/HTML/ SMESH/
diff --git a/doc/salome/tui/SMESH/doxyfile_py b/doc/salome/tui/SMESH/doxyfile_py
new file mode 100755 (executable)
index 0000000..8569636
--- /dev/null
@@ -0,0 +1,200 @@
+# Doxyfile 1.3-rc1
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = "SALOME - SMESH - v.2.1.0"
+PROJECT_NUMBER         = id#1.1
+OUTPUT_DIRECTORY       = ../
+OUTPUT_LANGUAGE        = English
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+EXTRACT_LOCAL_CLASSES  = YES
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = NO
+ALWAYS_DETAILED_SEC    = YES
+INLINE_INHERITED_MEMB  = YES
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+SHORT_NAMES            = NO
+HIDE_SCOPE_NAMES       = NO
+VERBATIM_HEADERS       = YES
+SHOW_INCLUDE_FILES     = YES
+JAVADOC_AUTOBRIEF      = YES
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = NO
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 5
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ALIASES                = 
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 25
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = YES
+SHOW_USED_FILES        = NO
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = log.txt
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = list_py_files_to_process
+FILE_PATTERNS          = 
+RECURSIVE              = NO
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = ../sources/
+INPUT_FILTER           = 
+FILTER_SOURCE_FILES    = YES
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION    = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = ../SMESH/meshpy_doc
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = ../sources/myheader_py2.html
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = NO
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_SCHEMA             = 
+XML_DTD                = 
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = NO
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = NO
+HAVE_DOT               = YES
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = NO
+GRAPHICAL_HIERARCHY    = YES
+DOT_IMAGE_FORMAT       = jpg
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1200
+GENERATE_LEGEND        = NO
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
+CGI_NAME               = search.cgi
+CGI_URL                = 
+DOC_URL                = 
+DOC_ABSPATH            = 
+BIN_ABSPATH            = /usr/local/bin/
+EXT_DOC_PATHS          = 
diff --git a/doc/salome/tui/SMESH/sources/myheader_py2.html b/doc/salome/tui/SMESH/sources/myheader_py2.html
new file mode 100755 (executable)
index 0000000..372b224
--- /dev/null
@@ -0,0 +1,24 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+   <meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
+   <title>Main Page</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+&nbsp;
+<center><table WIDTH="96%" >
+<tr>
+<td><a href="http://www.opencascade.com"><img src="../sources/logocorp.gif" BORDER=0 height=46 width=122></a></td>
+
+
+<td>
+<div align=right><a href="http://www.opencascade.org/SALOME/"><img src="../sources/application.gif" BORDER=0 height=46 width=108></a></div>
+</td>
+</tr>
+</table></center>
+
+
+</body>
+</html>
index e1c95ec935ec3444361ed119e4939cf93d883ac7..b2a9953b2332bc66303d23f8b80dfd274fd7bf45 100755 (executable)
@@ -18,5 +18,12 @@ aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
 
 aux1 = insFld(foldersTree, gFld("IDL/Python mapping", ""))
          insDoc(aux1, gLnk("Mapping of SMESH IDL definitions to Python language", "", "page2.html"))
 
 aux1 = insFld(foldersTree, gFld("IDL/Python mapping", ""))
          insDoc(aux1, gLnk("Mapping of SMESH IDL definitions to Python language", "", "page2.html"))
+
+aux1 = insFld(foldersTree, gFld("Python Commands", "", "meshpy_doc/main.html"))
+         insDoc(aux1, gLnk("Package List", "", "meshpy_doc/namespaces.html"))
+         insDoc(aux1, gLnk("Data Structures", "", "meshpy_doc/annotated.html"))
+         insDoc(aux1, gLnk("Namespace Members", "", "meshpy_doc/namespacemembers.html"))
+         insDoc(aux1, gLnk("File List", "", "meshpy_doc/files.html"))
+
 aux1 = insFld(foldersTree, gFld("Adding meshers in SMESH", ""))
         insDoc(aux1, gLnk("Using Plugin mechanism in SMESH", "", "PluginMeshers.html"))
 aux1 = insFld(foldersTree, gFld("Adding meshers in SMESH", ""))
         insDoc(aux1, gLnk("Using Plugin mechanism in SMESH", "", "PluginMeshers.html"))
index d1f0c3d9f15a2a52fd1addb5cb3885718e62e7d5..c66a90ea05998d56f916ad456db1be5be90f8cca 100644 (file)
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
-// \r
-//  This library is free software; you can redistribute it and/or \r
-//  modify it under the terms of the GNU Lesser General Public \r
-//  License as published by the Free Software Foundation; either \r
-//  version 2.1 of the License. \r
-// \r
-//  This library is distributed in the hope that it will be useful, \r
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU \r
-//  Lesser General Public License for more details. \r
-// \r
-//  You should have received a copy of the GNU Lesser General Public \r
-//  License along with this library; if not, write to the Free Software \r
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA \r
-// \r
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
-//\r
-//\r
-//\r
-//  File   : SMESH_Filter.idl\r
-//  Author : Alexey Petrov, OCC\r
-\r
-#ifndef _SMESH_FILTER_IDL_\r
-#define _SMESH_FILTER_IDL_\r
-\r
-#include "SALOME_Exception.idl"\r
-#include "SALOME_GenericObj.idl"\r
-#include "SMESH_Mesh.idl"\r
-\r
-\r
-module GEOM\r
-{\r
-  interface GEOM_Object;\r
-};\r
-\r
-\r
-module SMESH\r
-{\r
-\r
-  /*!\r
-  * Enumeration of functor types\r
-  */\r
-  enum FunctorType\r
-  {\r
-    FT_AspectRatio,\r
-    FT_Warping,   \r
-    FT_MinimumAngle,\r
-    FT_Taper,       \r
-    FT_Skew,         \r
-    FT_Area,          \r
-    FT_FreeBorders,\r
-    FT_FreeEdges,\r
-    FT_MultiConnection,\r
-    FT_Length,\r
-    FT_BelongToGeom,\r
-    FT_BelongToPlane,\r
-    FT_BelongToCylinder,\r
-    FT_RangeOfIds,\r
-    FT_LessThan,\r
-    FT_MoreThan,\r
-    FT_EqualTo,\r
-    FT_LogicalNOT,\r
-    FT_LogicalAND,\r
-    FT_LogicalOR,\r
-    FT_Undefined\r
-  };\r
-\r
-  /*!\r
-  * Base interface for all functors ( i.e. numerical functors and predicates )\r
-  */\r
-  interface Functor: SALOME::GenericObj\r
-  {\r
-    void            SetMesh( in SMESH_Mesh theMesh );\r
-    FunctorType     GetFunctorType();\r
-    ElementType     GetElementType();\r
-  };\r
-\r
-\r
-\r
-  /*!\r
-  * Numerical functors are intended for calculating value by Id of mesh entity\r
-  */\r
-  interface NumericalFunctor: Functor\r
-  {\r
-    double GetValue( in long theElementId );\r
-\r
-    /*!\r
-    * Set precision for calculation. It is a position after point which is\r
-    * used to functor value after calculation.\r
-    */\r
-    void   SetPrecision( in long thePrecision );\r
-    long   GetPrecision();\r
-  };\r
-  interface MinimumAngle    : NumericalFunctor{};\r
-  interface AspectRatio     : NumericalFunctor{};\r
-  interface Warping         : NumericalFunctor{};\r
-  interface Taper           : NumericalFunctor{};\r
-  interface Skew            : NumericalFunctor{};\r
-  interface Area            : NumericalFunctor{};\r
-  interface Length          : NumericalFunctor{};\r
-  interface MultiConnection : NumericalFunctor{};\r
-\r
-  /*!\r
-  * Predicates are intended for verification of criteria,\r
-  *            must return bool value by mesh id\r
-  */\r
-  interface Predicate: Functor\r
-  {\r
-    boolean IsSatisfy( in long thEntityId );\r
-  };\r
-\r
-  /*!\r
-  * Logical functor (predicate) "Belong To Geometry".\r
-  * Verify whether mesh element or node belong to pointed Geom Object\r
-  */\r
-  interface BelongToGeom: Predicate\r
-  {\r
-    void SetGeom( in GEOM::GEOM_Object theGeom );\r
-    void SetElementType( in ElementType theType );\r
-\r
-    void   SetShapeName( in string theName );\r
-    string GetShapeName();    \r
-  };\r
-\r
-  /*!\r
-  * Logical functor (predicate) "Belong To Surface".\r
-  * Base interface for "belong to plane" and "belong to cylinder interfaces"\r
-  */\r
-  interface BelongToSurface: Predicate\r
-  {\r
-    void   SetTolerance( in double theToler );\r
-    double GetTolerance();\r
-    void   SetShapeName( in string theName, in ElementType theType );\r
-    string GetShapeName();\r
-  };\r
-\r
-\r
-  /*!\r
-  * Logical functor (predicate) "Belong To Plane".\r
-  * Verify whether mesh element lie in pointed Geom planar object\r
-  */\r
-  interface BelongToPlane: BelongToSurface\r
-  {\r
-    void   SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );\r
-  };\r
-\r
-  /*!\r
-  * Logical functor (predicate) "Belong To Culinder".\r
-  * Verify whether mesh element lie in pointed Geom cylindrical object\r
-  */\r
-  interface BelongToCylinder: BelongToSurface\r
-  {\r
-    void   SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );\r
-  };\r
-\r
-  /*!\r
-  * Logical functor (predicate) "Free borders".\r
-  * Verify whether 1D mesh element is free ( i.e. connected to one face only )\r
-  */\r
-  interface FreeBorders: Predicate{};\r
-\r
-  /*!\r
-  * Logical functor (predicate) "Free edges".\r
-  * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )\r
-  */\r
-  interface FreeEdges: Predicate\r
-\r
-  {\r
-    struct Border\r
-    {\r
-      long myElemId;\r
-      long myPnt1, myPnt2;\r
-    };\r
-    typedef sequence<Border> Borders;\r
-    Borders GetBorders();\r
-  };\r
-\r
-\r
-  /*!\r
-  * Abstract logical functor (predicate) "RangeOfIds".\r
-  * Verify whether an Entity Id belongs to defined sequence of id's\r
-  */\r
-  interface RangeOfIds: Predicate\r
-  {\r
-    void            SetRange( in long_array theIds );\r
-    boolean         SetRangeStr( in string theRange );\r
-    string          GetRangeStr();\r
-\r
-    void            SetElementType( in ElementType theType );\r
-  };\r
-\r
-  /*!\r
-  * Comparator. Predicate for compare value calculated\r
-  *             by numerical functor with threshold value\r
-  */\r
-  interface Comparator: Predicate\r
-  {\r
-    void    SetMargin( in double theValue );\r
-    void    SetNumFunctor( in NumericalFunctor theFunct );\r
-    double  GetMargin();\r
-  };\r
-  interface LessThan: Comparator{};\r
-  interface MoreThan: Comparator{};\r
-  interface EqualTo : Comparator\r
-  {\r
-    void    SetTolerance( in double theToler );\r
-    double  GetTolerance();\r
-  };\r
-\r
-  /*!\r
-  * Logical predicates are intended for compose predicates using boolean operations\r
-  */\r
-  interface Logical: Predicate{};\r
-\r
-  interface LogicalNOT: Logical\r
-  {\r
-    void SetPredicate(in Predicate thePredicate);\r
-  };\r
-\r
-  interface LogicalBinary: Logical\r
-{\r
-    void SetPredicate1( in Predicate thePredicate );\r
-    void SetPredicate2( in Predicate thePredicate );\r
-  };\r
-\r
-  interface LogicalAND: LogicalBinary{};\r
-  interface LogicalOR : LogicalBinary{};\r
-\r
-  /*!\r
-  *  Filter\r
-  */\r
-  interface Filter: SALOME::GenericObj\r
-  {\r
-    /*!\r
-    * Structure containing information about one criterion\r
-    *   Type          - FT_Taper, FT_Skew ...\r
-    *   Compare       - FT_LessThan, FT_MoreThan, FT_EqualTo\r
-    *   Threshold     - threshold value\r
-    *   UnaryOp       - unary logical operation: FT_LogicalNOT or FT_Undefined\r
-    *   BinaryOp      - binary logical operation FT_LogicalAND, FT_LogicalOR or\r
-    *                   (FT_Undefined must be for the last criterion)\r
-    *   ThresholdStr  - Threshold value defined as string. Used for:\r
-    *                   1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"\r
-    *                   2. BelongToGeom predicate for storing name of shape\r
-    *   Tolerance     - Tolerance is used for comparators (EqualTo comparision) and for\r
-    *                   "Belong to plane" and "Belong to cylinder" predicates\r
-    *   TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)\r
-    *   Precision     - Precision of numerical functors\r
-    */\r
-    struct Criterion\r
-    {\r
-      long        Type;\r
-      long        Compare;\r
-      double      Threshold;\r
-      string      ThresholdStr;\r
-      long        UnaryOp;\r
-      long        BinaryOp;\r
-      double      Tolerance;\r
-      ElementType TypeOfElement;\r
-      long        Precision;\r
-    };\r
-\r
-    typedef sequence<Criterion> Criteria;\r
-\r
-    void          SetPredicate( in Predicate thePredicate );\r
-    long_array    GetElementsId( in SMESH_Mesh theMesh );\r
-    ElementType   GetElementType();\r
-    Predicate     GetPredicate();\r
-\r
-    boolean       GetCriteria( out Criteria theCriteria );\r
-    boolean       SetCriteria( in Criteria theCriteria );\r
-  };\r
-\r
-\r
-  /*!\r
-  *  Interface for working with library of filters\r
-  */\r
-  interface FilterLibrary : SALOME::GenericObj\r
-  {\r
-    /*!\r
-    *  Copy filter from library by name (new filter is created)\r
-    */\r
-    Filter        Copy( in string theFilterName );\r
-\r
-    /*!\r
-    * Methods for editing library\r
-    */\r
-    boolean       Add     ( in string theFilterName, in Filter theFilter );\r
-    boolean       AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter\r
-    boolean       Delete  ( in string theFilterName );\r
-    boolean       Replace ( in string theFilterName, in string theNewName, in Filter theFilter );\r
-\r
-    /*!\r
-    *  Save library on disk\r
-    */\r
-    boolean       Save();\r
-    boolean       SaveAs( in string aFileName );\r
-\r
-    /*!\r
-    * Query methods\r
-    */\r
-    boolean       IsPresent( in string aFilterName );\r
-    long          NbFilters( in ElementType aType );\r
-    string_array  GetNames( in ElementType aType );\r
-    string_array  GetAllNames();\r
-    void          SetFileName( in string aFilterName );\r
-    string        GetFileName();\r
-  };\r
-\r
-\r
-  /*!\r
-  * Interface of Filter manager\r
-  */\r
-  interface FilterManager: SALOME::GenericObj\r
-  {\r
-    /*!\r
-    *  Create numerical functors\r
-    */\r
-    MinimumAngle      CreateMinimumAngle();\r
-    AspectRatio       CreateAspectRatio();\r
-    Warping           CreateWarping();\r
-    Taper             CreateTaper();\r
-    Skew              CreateSkew();\r
-    Area              CreateArea();\r
-    Length            CreateLength();\r
-    MultiConnection   CreateMultiConnection();\r
-\r
-    /*!\r
-    *  Create logical functors ( predicates )\r
-    */\r
-    BelongToGeom      CreateBelongToGeom();\r
-    BelongToPlane     CreateBelongToPlane();\r
-    BelongToCylinder  CreateBelongToCylinder();\r
-\r
-    FreeBorders       CreateFreeBorders();\r
-    FreeEdges         CreateFreeEdges();\r
-\r
-    RangeOfIds        CreateRangeOfIds();\r
-\r
-    /*!\r
-    *  Create comparators ( predicates )\r
-    */\r
-    LessThan          CreateLessThan();\r
-    MoreThan          CreateMoreThan();\r
-    EqualTo           CreateEqualTo();\r
-\r
-    /*!\r
-    *  Create boolean operations ( predicates )\r
-    */\r
-    LogicalNOT        CreateLogicalNOT();\r
-    LogicalAND        CreateLogicalAND();\r
-    LogicalOR         CreateLogicalOR();\r
-\r
-    /*!\r
-    *  Create filter\r
-    */\r
-    Filter            CreateFilter();\r
-\r
-    /*!\r
-    *  Load filter library. If libary does not exist it is created\r
-    */\r
-    FilterLibrary     LoadLibrary( in string aFileName );\r
-\r
-    /*!\r
-    *  Create new library\r
-    */\r
-    FilterLibrary     CreateLibrary();\r
-\r
-    /*!\r
-    *  Delete library\r
-    */\r
-    boolean           DeleteLibrary( in string aFileName );\r
-  };\r
-};\r
-\r
-\r
-#endif\r
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESH_Filter.idl
+//  Author : Alexey Petrov, OCC
+
+#ifndef _SMESH_FILTER_IDL_
+#define _SMESH_FILTER_IDL_
+
+#include "SALOME_Exception.idl"
+#include "SALOME_GenericObj.idl"
+#include "SMESH_Mesh.idl"
+
+
+module GEOM
+{
+  interface GEOM_Object;
+};
+
+
+module SMESH
+{
+
+  /*!
+  * Enumeration of functor types
+  */
+  enum FunctorType
+  {
+    FT_AspectRatio,
+    FT_AspectRatio3D,
+    FT_Warping,   
+    FT_MinimumAngle,
+    FT_Taper,       
+    FT_Skew,         
+    FT_Area,          
+    FT_FreeBorders,
+    FT_FreeEdges,
+    FT_MultiConnection,
+    FT_MultiConnection2D,
+    FT_Length,
+    FT_Length2D,
+    FT_BelongToGeom,
+    FT_BelongToPlane,
+    FT_BelongToCylinder,
+    FT_LyingOnGeom,
+    FT_RangeOfIds,
+    FT_LessThan,
+    FT_MoreThan,
+    FT_EqualTo,
+    FT_LogicalNOT,
+    FT_LogicalAND,
+    FT_LogicalOR,
+    FT_Undefined
+  };
+
+  /*!
+  * Base interface for all functors ( i.e. numerical functors and predicates )
+  */
+  interface Functor: SALOME::GenericObj
+  {
+    void            SetMesh( in SMESH_Mesh theMesh );
+    FunctorType     GetFunctorType();
+    ElementType     GetElementType();
+  };
+
+
+
+  /*!
+  * Numerical functors are intended for calculating value by Id of mesh entity
+  */
+  interface NumericalFunctor: Functor
+  {
+    double GetValue( in long theElementId );
+
+    /*!
+    * Set precision for calculation. It is a position after point which is
+    * used to functor value after calculation.
+    */
+    void   SetPrecision( in long thePrecision );
+    long   GetPrecision();
+  };
+  interface MinimumAngle    : NumericalFunctor{};
+  interface AspectRatio     : NumericalFunctor{};
+  interface AspectRatio3D   : NumericalFunctor{};
+  interface Warping         : NumericalFunctor{};
+  interface Taper           : NumericalFunctor{};
+  interface Skew            : NumericalFunctor{};
+  interface Area            : NumericalFunctor{};
+  interface Length          : NumericalFunctor{};
+  interface Length2D        : NumericalFunctor
+  {
+    struct Value
+    {
+      double myLength;
+      long myPnt1, myPnt2;
+    };
+    typedef sequence<Value> Values;
+    Values GetValues();
+  };
+  interface MultiConnection   : NumericalFunctor{};
+  interface MultiConnection2D : NumericalFunctor
+  {
+    struct Value
+    {
+      long myNbConnects;
+      long myPnt1, myPnt2;
+    };
+    
+    typedef sequence<Value> Values;
+    Values GetValues();
+  };
+
+  /*!
+  * Predicates are intended for verification of criteria,
+  *            must return bool value by mesh id
+  */
+  interface Predicate: Functor
+  {
+    boolean IsSatisfy( in long thEntityId );
+  };
+
+  /*!
+  * Logical functor (predicate) "Belong To Geometry".
+  * Verify whether mesh element or node belong to pointed Geom Object
+  */
+  interface BelongToGeom: Predicate
+  {
+    void SetGeom( in GEOM::GEOM_Object theGeom );
+    void SetElementType( in ElementType theType );
+
+    void   SetShapeName( in string theName );
+    string GetShapeName();    
+  };
+
+  /*!
+  * Logical functor (predicate) "Belong To Surface".
+  * Base interface for "belong to plane" and "belong to cylinder interfaces"
+  */
+  interface BelongToSurface: Predicate
+  {
+    void   SetTolerance( in double theToler );
+    double GetTolerance();
+    void   SetShapeName( in string theName, in ElementType theType );
+    string GetShapeName();
+  };
+
+
+  /*!
+  * Logical functor (predicate) "Belong To Plane".
+  * Verify whether mesh element lie in pointed Geom planar object
+  */
+  interface BelongToPlane: BelongToSurface
+  {
+    void   SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
+  };
+
+  /*!
+  * Logical functor (predicate) "Belong To Culinder".
+  * Verify whether mesh element lie in pointed Geom cylindrical object
+  */
+  interface BelongToCylinder: BelongToSurface
+  {
+    void   SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
+  };
+
+  /*!
+  * Logical functor (predicate) "Lying On Geometry".
+  * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
+  */
+  interface LyingOnGeom: Predicate
+  {
+    void SetGeom( in GEOM::GEOM_Object theGeom );
+    void SetElementType( in ElementType theType );
+
+    void   SetShapeName( in string theName );
+    string GetShapeName();    
+  };
+  /*!
+  * Logical functor (predicate) "Free borders".
+  * Verify whether 1D mesh element is free ( i.e. connected to one face only )
+  */
+  interface FreeBorders: Predicate{};
+
+  /*!
+  * Logical functor (predicate) "Free edges".
+  * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
+  */
+  interface FreeEdges: Predicate
+
+  {
+    struct Border
+    {
+      long myElemId;
+      long myPnt1, myPnt2;
+    };
+    typedef sequence<Border> Borders;
+    Borders GetBorders();
+  };
+
+
+  /*!
+  * Abstract logical functor (predicate) "RangeOfIds".
+  * Verify whether an Entity Id belongs to defined sequence of id's
+  */
+  interface RangeOfIds: Predicate
+  {
+    void            SetRange( in long_array theIds );
+    boolean         SetRangeStr( in string theRange );
+    string          GetRangeStr();
+
+    void            SetElementType( in ElementType theType );
+  };
+
+  /*!
+  * Comparator. Predicate for compare value calculated
+  *             by numerical functor with threshold value
+  */
+  interface Comparator: Predicate
+  {
+    void    SetMargin( in double theValue );
+    void    SetNumFunctor( in NumericalFunctor theFunct );
+    double  GetMargin();
+  };
+  interface LessThan: Comparator{};
+  interface MoreThan: Comparator{};
+  interface EqualTo : Comparator
+  {
+    void    SetTolerance( in double theToler );
+    double  GetTolerance();
+  };
+
+  /*!
+  * Logical predicates are intended for compose predicates using boolean operations
+  */
+  interface Logical: Predicate{};
+
+  interface LogicalNOT: Logical
+  {
+    void SetPredicate(in Predicate thePredicate);
+  };
+
+  interface LogicalBinary: Logical
+{
+    void SetPredicate1( in Predicate thePredicate );
+    void SetPredicate2( in Predicate thePredicate );
+  };
+
+  interface LogicalAND: LogicalBinary{};
+  interface LogicalOR : LogicalBinary{};
+
+  /*!
+  *  Filter
+  */
+  interface Filter: SALOME::GenericObj
+  {
+    /*!
+    * Structure containing information about one criterion
+    *   Type          - FT_Taper, FT_Skew ...
+    *   Compare       - FT_LessThan, FT_MoreThan, FT_EqualTo
+    *   Threshold     - threshold value
+    *   UnaryOp       - unary logical operation: FT_LogicalNOT or FT_Undefined
+    *   BinaryOp      - binary logical operation FT_LogicalAND, FT_LogicalOR or
+    *                   (FT_Undefined must be for the last criterion)
+    *   ThresholdStr  - Threshold value defined as string. Used for:
+    *                   1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"
+    *                   2. BelongToGeom predicate for storing name of shape
+    *   Tolerance     - Tolerance is used for comparators (EqualTo comparision) and for
+    *                   "Belong to plane" and "Belong to cylinder" predicates
+    *   TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
+    *   Precision     - Precision of numerical functors
+    */
+    struct Criterion
+    {
+      long        Type;
+      long        Compare;
+      double      Threshold;
+      string      ThresholdStr;
+      long        UnaryOp;
+      long        BinaryOp;
+      double      Tolerance;
+      ElementType TypeOfElement;
+      long        Precision;
+    };
+
+    typedef sequence<Criterion> Criteria;
+
+    void          SetPredicate( in Predicate thePredicate );
+    long_array    GetElementsId( in SMESH_Mesh theMesh );
+    ElementType   GetElementType();
+    Predicate     GetPredicate();
+
+    boolean       GetCriteria( out Criteria theCriteria );
+    boolean       SetCriteria( in Criteria theCriteria );
+  };
+
+
+  /*!
+  *  Interface for working with library of filters
+  */
+  interface FilterLibrary : SALOME::GenericObj
+  {
+    /*!
+    *  Copy filter from library by name (new filter is created)
+    */
+    Filter        Copy( in string theFilterName );
+
+    /*!
+    * Methods for editing library
+    */
+    boolean       Add     ( in string theFilterName, in Filter theFilter );
+    boolean       AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
+    boolean       Delete  ( in string theFilterName );
+    boolean       Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
+
+    /*!
+    *  Save library on disk
+    */
+    boolean       Save();
+    boolean       SaveAs( in string aFileName );
+
+    /*!
+    * Query methods
+    */
+    boolean       IsPresent( in string aFilterName );
+    long          NbFilters( in ElementType aType );
+    string_array  GetNames( in ElementType aType );
+    string_array  GetAllNames();
+    void          SetFileName( in string aFilterName );
+    string        GetFileName();
+  };
+
+
+  /*!
+  * Interface of Filter manager
+  */
+  interface FilterManager: SALOME::GenericObj
+  {
+    /*!
+    *  Create numerical functors
+    */
+    MinimumAngle      CreateMinimumAngle();
+    AspectRatio       CreateAspectRatio();
+    AspectRatio3D     CreateAspectRatio3D();
+    Warping           CreateWarping();
+    Taper             CreateTaper();
+    Skew              CreateSkew();
+    Area              CreateArea();
+    Length            CreateLength();
+    Length2D          CreateLength2D();
+    MultiConnection   CreateMultiConnection();
+    MultiConnection2D CreateMultiConnection2D();
+
+    /*!
+    *  Create logical functors ( predicates )
+    */
+    BelongToGeom      CreateBelongToGeom();
+    BelongToPlane     CreateBelongToPlane();
+    BelongToCylinder  CreateBelongToCylinder();
+
+    LyingOnGeom       CreateLyingOnGeom();
+
+    FreeBorders       CreateFreeBorders();
+    FreeEdges         CreateFreeEdges();
+
+    RangeOfIds        CreateRangeOfIds();
+
+    /*!
+    *  Create comparators ( predicates )
+    */
+    LessThan          CreateLessThan();
+    MoreThan          CreateMoreThan();
+    EqualTo           CreateEqualTo();
+
+    /*!
+    *  Create boolean operations ( predicates )
+    */
+    LogicalNOT        CreateLogicalNOT();
+    LogicalAND        CreateLogicalAND();
+    LogicalOR         CreateLogicalOR();
+
+    /*!
+    *  Create filter
+    */
+    Filter            CreateFilter();
+
+    /*!
+    *  Load filter library. If libary does not exist it is created
+    */
+    FilterLibrary     LoadLibrary( in string aFileName );
+
+    /*!
+    *  Create new library
+    */
+    FilterLibrary     CreateLibrary();
+
+    /*!
+    *  Delete library
+    */
+    boolean           DeleteLibrary( in string aFileName );
+  };
+};
+
+
+#endif
index d64d9389f269a7daab7e72e8e35a8a7ad4bd6842..77d9d186e0bd30374e2f5e7c3c958637e2db57b4 100644 (file)
@@ -132,6 +132,15 @@ module SMESH
     DRS_FAIL            // general failure (exception etc.)
   }; 
 
     DRS_FAIL            // general failure (exception etc.)
   }; 
 
+  /*!
+   * Enumeration for DriverMED (used by Perform() method)
+   */  
+  enum MED_VERSION // in the order of severity
+  {
+    MED_V2_1,
+    MED_V2_2
+  };
+
   typedef sequence<log_block> log_array;
 
 
   typedef sequence<log_block> log_array;
 
 
@@ -315,12 +324,18 @@ module SMESH
        raises (SALOME::SALOME_Exception);
 
     /*!
        raises (SALOME::SALOME_Exception);
 
     /*!
-     * Export Mesh with DAT and MED Formats
+     * Export Mesh to MED Formats
      */
      */
-    void ExportDAT( in string file )
+    void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
       raises (SALOME::SALOME_Exception);
     void ExportMED( in string file, in boolean auto_groups )
       raises (SALOME::SALOME_Exception);
       raises (SALOME::SALOME_Exception);
     void ExportMED( in string file, in boolean auto_groups )
       raises (SALOME::SALOME_Exception);
+
+    /*!
+     * Export Mesh to DAT, UNV and STL Formats
+     */
+    void ExportDAT( in string file )
+      raises (SALOME::SALOME_Exception);
     void ExportUNV( in string file )
       raises (SALOME::SALOME_Exception);
     void ExportSTL( in string file, in boolean isascii )
     void ExportUNV( in string file )
       raises (SALOME::SALOME_Exception);
     void ExportSTL( in string file, in boolean isascii )
@@ -335,6 +350,9 @@ module SMESH
     long NbNodes()
       raises (SALOME::SALOME_Exception);
 
     long NbNodes()
       raises (SALOME::SALOME_Exception);
 
+    long NbElements()
+      raises (SALOME::SALOME_Exception);
+
     long NbEdges()
       raises (SALOME::SALOME_Exception);
 
     long NbEdges()
       raises (SALOME::SALOME_Exception);
 
@@ -365,6 +383,15 @@ module SMESH
     long NbSubMesh()
       raises (SALOME::SALOME_Exception);
 
     long NbSubMesh()
       raises (SALOME::SALOME_Exception);
 
+    long_array GetElementsId()
+      raises (SALOME::SALOME_Exception);
+
+    long_array GetElementsByType( in ElementType theType )
+      raises (SALOME::SALOME_Exception);
+
+    long_array GetNodesId()
+      raises (SALOME::SALOME_Exception);
+
     string Dump();
   };
 
     string Dump();
   };
 
@@ -508,6 +535,24 @@ module SMESH
                              in DirStruct       StepVector,
                              in long            NbOfSteps);
 
                              in DirStruct       StepVector,
                              in long            NbOfSteps);
 
+    void ExtrusionAlongPath(in long_array        IDsOfElements,
+                           in SMESH_Mesh        PathMesh,
+                           in GEOM::GEOM_Object PathShape,
+                           in long              NodeStart,
+                           in boolean           HasAngles,
+                           in double_array      Angles,
+                           in boolean           HasRefPoint,
+                           in PointStruct       RefPoint);
+
+    void ExtrusionAlongPathObject(in SMESH_IDSource    theObject,
+                                 in SMESH_Mesh        PathMesh,
+                                 in GEOM::GEOM_Object PathShape,
+                                 in long              NodeStart,
+                                 in boolean           HasAngles,
+                                 in double_array      Angles,
+                                 in boolean           HasRefPoint,
+                                 in PointStruct       RefPoint);
+
     enum MirrorType { POINT, AXIS, PLANE };
 
     void Mirror (in long_array       IDsOfElements,
     enum MirrorType { POINT, AXIS, PLANE };
 
     void Mirror (in long_array       IDsOfElements,
index 1b626ad5e965fc44f97772d381347ddd9903e3eb..f02fe432680749dff4870da88419de3490281c08 100644 (file)
@@ -79,6 +79,28 @@ module SMESH
                                 in GEOM::GEOM_Object theVertex000,
                                 in GEOM::GEOM_Object theVertex001);
 
                                 in GEOM::GEOM_Object theVertex000,
                                 in GEOM::GEOM_Object theVertex001);
 
+    /*!
+     * Compute nodes coordinates applying
+     * the loaded pattern to mesh faces. The first key-point
+     * will be mapped into <theNodeIndexOnKeyPoint1>-th node of each face
+     */
+    point_array  ApplyToMeshFaces(in SMESH_Mesh theMesh,
+                                  in long_array theFacesIDs,
+                                  in long       theNodeIndexOnKeyPoint1,
+                                  in boolean    theReverse);
+
+    /*!
+     * Compute nodes coordinates applying
+     * the loaded pattern to hexahedrons. The (0,0,0) key-point
+     * will be mapped into <theNode000Index>-th node of each volume.
+     * The (0,0,1) key-point will be mapped into <theNode001Index>-th
+     * node of each volume.
+     */
+    point_array  ApplyToHexahedrons(in SMESH_Mesh theMesh,
+                                    in long_array theVolumesIDs,
+                                    in long       theNode000Index,
+                                    in long       theNode001Index);
+
     /*!
      * Create nodes and elements in <theMesh> using nodes
      * coordinates computed by either of Apply...() methods
     /*!
      * Create nodes and elements in <theMesh> using nodes
      * coordinates computed by either of Apply...() methods
index b574a7f2f72e702d16e3ee9981bd4855477fdad0..0bbbc4597578c079d0240d6c87b269bda6b491ac 100644 (file)
 
 <!-- ************************** Control  (menubar)  ************************************ -->
 <menu-item label-id="Controls" item-id="60" pos-id="5">
 
 <!-- ************************** Control  (menubar)  ************************************ -->
 <menu-item label-id="Controls" item-id="60" pos-id="5">
+       <popup-item item-id="6003" pos-id="" label-id="Free Borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6004" pos-id="" label-id="Borders at Multi-Connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <separator pos-id=""/>
+       <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6018" pos-id="" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6019" pos-id="" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6014" pos-id="" label-id="Minimum Angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6015" pos-id="" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>  
        <popup-item item-id="6015" pos-id="" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>  
+        <separator pos-id=""/>
+        <popup-item item-id="6017" pos-id="" label-id="Aspect Ratio 3D" icon-id="mesh_aspect_3d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
 </menu-item>
         
 <!-- ************************** Entity  (menubar)  ************************************ -->
 </menu-item>
         
 <!-- ************************** Entity  (menubar)  ************************************ -->
      <popup-item item-id="411" pos-id="" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      <popup-item item-id="412" pos-id="" label-id="Smoothing" icon-id="mesh_smoothing.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      <popup-item item-id="413" pos-id="" label-id="Extrusion" icon-id="mesh_extrusion.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      <popup-item item-id="411" pos-id="" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      <popup-item item-id="412" pos-id="" label-id="Smoothing" icon-id="mesh_smoothing.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      <popup-item item-id="413" pos-id="" label-id="Extrusion" icon-id="mesh_extrusion.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+     <popup-item item-id="416" pos-id="" label-id="Extrusion along a path" icon-id="mesh_extrusionpath.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      <popup-item item-id="414" pos-id="" label-id="Revolution" icon-id="mesh_revolution.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      <popup-item item-id="415" pos-id="" label-id="Pattern mapping" icon-id="mesh_pattern.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
 </menu-item>
      <popup-item item-id="414" pos-id="" label-id="Revolution" icon-id="mesh_revolution.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
      <popup-item item-id="415" pos-id="" label-id="Pattern mapping" icon-id="mesh_pattern.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
 </menu-item>
 <!-- ********************************* Settings  (menubar) ********************************* -->
 <menu-item label-id="Preferences" item-id="4" pos-id="">
    <submenu label-id="Mesh" item-id="100" pos-id="-1">
 <!-- ********************************* Settings  (menubar) ********************************* -->
 <menu-item label-id="Preferences" item-id="4" pos-id="">
    <submenu label-id="Mesh" item-id="100" pos-id="-1">
-    <submenu label-id="Display Mode" item-id="1000" pos-id="">
+   <submenu label-id="Display Mode" item-id="1000" pos-id="">
        <popup-item item-id="10001" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
        <popup-item item-id="10002" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id="" accel-id="" toggle-id="true" execute-action=""/>
        <popup-item item-id="10004" pos-id="" label-id="Nodes" icon-id="mesh_points.png" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
        <popup-item item-id="10001" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
        <popup-item item-id="10002" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id="" accel-id="" toggle-id="true" execute-action=""/>
        <popup-item item-id="10004" pos-id="" label-id="Nodes" icon-id="mesh_points.png" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
     <separator pos-id=""/>
     <popup-item item-id="1006" pos-id="" label-id="Selection" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
     <separator pos-id=""/>
     <separator pos-id=""/>
     <popup-item item-id="1006" pos-id="" label-id="Selection" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
     <separator pos-id=""/>
-    <popup-item item-id="1007" pos-id="" label-id="Quality controls" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+    <submenu label-id="Quality controls" item-id="1007" pos-id="">
+       <popup-item item-id="10070" pos-id="" label-id="Precision" icon-id="" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
+       <popup-item item-id="10071" pos-id="" label-id="Display Entity" icon-id="" tooltip-id="" accel-id="" toggle-id="true" execute-action=""/>
+    </submenu>
+    <endsubmenu /> 
    </submenu>
    <endsubmenu />
    <separator pos-id="-1"/>
    </submenu>
    <endsubmenu />
    <separator pos-id="-1"/>
        <popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    </submenu>
    <endsubmenu />
        <popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    </submenu>
    <endsubmenu />
+   <submenu label-id="Display Entity" item-id="1135" pos-id="">
+       <popup-item item-id="217" pos-id="" label-id="Edges" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="218" pos-id="" label-id="Faces" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="219" pos-id="" label-id="Volumes" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <separator pos-id=""/>
+       <popup-item item-id="220" pos-id="" label-id="All" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+   </submenu>
+   <endsubmenu />
    <popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <separator pos-id=""/>
    <submenu label-id="Control" item-id="2000" pos-id="">
    <popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <separator pos-id=""/>
    <submenu label-id="Control" item-id="2000" pos-id="">
-       <popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <separator pos-id=""/>
+       <popup-item item-id="6003" pos-id="" label-id="Free Borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6004" pos-id="" label-id="Borders at Multi-Connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <separator pos-id=""/>
+       <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6018" pos-id="" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6019" pos-id="" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6014" pos-id="" label-id="Minimum Angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6015" pos-id="" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>  
         <separator pos-id=""/>
        <popup-item item-id="6015" pos-id="" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>  
         <separator pos-id=""/>
-        <popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6017" pos-id="" label-id="Aspect Ratio 3D" icon-id="mesh_aspect_3d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <separator pos-id=""/>
         <popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    </submenu>
         <separator pos-id=""/>
         <popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    </submenu>
        <popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    </submenu>
    <endsubmenu />
        <popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    </submenu>
    <endsubmenu />
+   <submenu label-id="Display Entity" item-id="1135" pos-id="">
+       <popup-item item-id="217" pos-id="" label-id="Edges" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="218" pos-id="" label-id="Faces" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="219" pos-id="" label-id="Volumes" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <separator pos-id=""/>
+       <popup-item item-id="220" pos-id="" label-id="All" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+   </submenu>
+   <endsubmenu />
    <popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <separator pos-id=""/>
    <submenu label-id="Control" item-id="2000" pos-id="">
    <popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <separator pos-id=""/>
    <submenu label-id="Control" item-id="2000" pos-id="">
-       <popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <separator pos-id=""/>
+        <popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6003" pos-id="" label-id="Free Borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6004" pos-id="" label-id="Borders at Multi-Connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <separator pos-id=""/>
+       <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6018" pos-id="" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6019" pos-id="" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6014" pos-id="" label-id="Minimum Angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6015" pos-id="" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>  
         <separator pos-id=""/>
        <popup-item item-id="6015" pos-id="" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>  
         <separator pos-id=""/>
-        <popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6017" pos-id="" label-id="Aspect Ratio 3D" icon-id="mesh_aspect_3d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <separator pos-id=""/>
         <popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    </submenu>
         <separator pos-id=""/>
         <popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    </submenu>
        <popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    </submenu>
    <endsubmenu />
        <popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    </submenu>
    <endsubmenu />
+   <submenu label-id="Display Entity" item-id="1135" pos-id="">
+       <popup-item item-id="217" pos-id="" label-id="Edges" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="218" pos-id="" label-id="Faces" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="219" pos-id="" label-id="Volumes" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <separator pos-id=""/>
+       <popup-item item-id="220" pos-id="" label-id="All" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+   </submenu>
+   <endsubmenu />
    <popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <separator pos-id=""/>
    <submenu label-id="Control" item-id="2000" pos-id="">
    <popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    <separator pos-id=""/>
    <submenu label-id="Control" item-id="2000" pos-id="">
-       <popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <separator pos-id=""/>
+       <popup-item item-id="6003" pos-id="" label-id="Free Borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6004" pos-id="" label-id="Borders at Multi-Connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <separator pos-id=""/>
+       <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6018" pos-id="" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6019" pos-id="" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
-       <popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6014" pos-id="" label-id="Minimum Angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6015" pos-id="" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>  
         <separator pos-id=""/>
        <popup-item item-id="6015" pos-id="" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>  
         <separator pos-id=""/>
-        <popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+       <popup-item item-id="6017" pos-id="" label-id="Aspect Ratio 3D" icon-id="mesh_aspect_3d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <separator pos-id=""/>
         <popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    </submenu>
         <separator pos-id=""/>
         <popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
    </submenu>
 
 <toolbar label-id="Controls toolbar">
        <toolbutton-item item-id="6001" label-id="Length" icon-id="mesh_length.png" tooltip-id="Length" accel-id="" toggle-id="" execute-action=""/>
 
 <toolbar label-id="Controls toolbar">
        <toolbutton-item item-id="6001" label-id="Length" icon-id="mesh_length.png" tooltip-id="Length" accel-id="" toggle-id="" execute-action=""/>
-       <toolbutton-item item-id="6002" label-id="Free Edges" icon-id="mesh_free_edges.png" tooltip-id="Free edges" accel-id="" toggle-id="" execute-action=""/>
-       <toolbutton-item item-id="6003" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="Free borders" accel-id="" toggle-id="" execute-action=""/>
-        <toolbutton-item item-id="6004" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="Borders at multi-connection" accel-id="" toggle-id="" execute-action=""/>
+       <toolbutton-item item-id="6003" label-id="Free Borders" icon-id="mesh_free_edges.png" tooltip-id="Free borders" accel-id="" toggle-id="" execute-action=""/>
+        <toolbutton-item item-id="6004" label-id="Borders at Multi-Connection" icon-id="mesh_multi_edges.png" tooltip-id="Borders at multi-connection" accel-id="" toggle-id="" execute-action=""/>
+        <separatorTB/>
+       <toolbutton-item item-id="6002" label-id="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="Free edges" accel-id="" toggle-id="" execute-action=""/>
+       <toolbutton-item item-id="6018" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="Length2D" accel-id="" toggle-id="" execute-action=""/>
+        <toolbutton-item item-id="6019" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.png" tooltip-id="Multiconnection 2D" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6011" label-id="Area" icon-id="mesh_area.png" tooltip-id="Area" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6012" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="Taper" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6013" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="Aspect Ratio" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6011" label-id="Area" icon-id="mesh_area.png" tooltip-id="Area" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6012" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="Taper" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6013" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="Aspect Ratio" accel-id="" toggle-id="" execute-action=""/>
-       <toolbutton-item item-id="6014" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="Minimum angle" accel-id="" toggle-id="" execute-action=""/>
+        <toolbutton-item item-id="6014" label-id="Minimum Angle" icon-id="mesh_angle.png" tooltip-id="Minimum angle" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6015" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="Warping angle" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6016" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="Skew" accel-id="" toggle-id="" execute-action=""/>  
        <toolbutton-item item-id="6015" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="Warping angle" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6016" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="Skew" accel-id="" toggle-id="" execute-action=""/>  
+        <separatorTB/>
+        <toolbutton-item item-id="6017" label-id="Aspect Ratio 3D" icon-id="mesh_aspect_3d.png" tooltip-id="Aspect Ratio 3D" accel-id="" toggle-id="" execute-action=""/>
 </toolbar>
 
 <toolbar label-id="Add/Remove toolbar">
 </toolbar>
 
 <toolbar label-id="Add/Remove toolbar">
      <toolbutton-item item-id="411" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="Cutting of quadrangles" accel-id="" toggle-id="" execute-action=""/>
      <toolbutton-item item-id="412" label-id="Smoothing" icon-id="mesh_smoothing.png" tooltip-id="Smoothing" accel-id="" toggle-id="" execute-action=""/>
      <toolbutton-item item-id="413" label-id="Extrusion" icon-id="mesh_extrusion.png" tooltip-id="Extrusion along a line" accel-id="" toggle-id="" execute-action=""/> 
      <toolbutton-item item-id="411" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="Cutting of quadrangles" accel-id="" toggle-id="" execute-action=""/>
      <toolbutton-item item-id="412" label-id="Smoothing" icon-id="mesh_smoothing.png" tooltip-id="Smoothing" accel-id="" toggle-id="" execute-action=""/>
      <toolbutton-item item-id="413" label-id="Extrusion" icon-id="mesh_extrusion.png" tooltip-id="Extrusion along a line" accel-id="" toggle-id="" execute-action=""/> 
+     <toolbutton-item item-id="416" label-id="Extrusion along a path" icon-id="mesh_extrusionpath.png" tooltip-id="Extrusion along a path" accel-id="" toggle-id="" execute-action=""/> 
      <toolbutton-item item-id="414" label-id="Revolution" icon-id="mesh_revolution.png" tooltip-id="Revolution around an axis" accel-id="" toggle-id="" execute-action=""/>
      <toolbutton-item item-id="415" label-id="Pattern mapping" icon-id="mesh_pattern.png" tooltip-id="2D and 3D pattern mapping" accel-id="" toggle-id="" execute-action=""/>     
 </toolbar>
      <toolbutton-item item-id="414" label-id="Revolution" icon-id="mesh_revolution.png" tooltip-id="Revolution around an axis" accel-id="" toggle-id="" execute-action=""/>
      <toolbutton-item item-id="415" label-id="Pattern mapping" icon-id="mesh_pattern.png" tooltip-id="2D and 3D pattern mapping" accel-id="" toggle-id="" execute-action=""/>     
 </toolbar>
diff --git a/resources/mesh_add.png b/resources/mesh_add.png
new file mode 100755 (executable)
index 0000000..2dde69a
Binary files /dev/null and b/resources/mesh_add.png differ
diff --git a/resources/mesh_aspect_3d.png b/resources/mesh_aspect_3d.png
new file mode 100644 (file)
index 0000000..4792634
Binary files /dev/null and b/resources/mesh_aspect_3d.png differ
diff --git a/resources/mesh_extrusionpath.png b/resources/mesh_extrusionpath.png
new file mode 100644 (file)
index 0000000..47f0aa7
Binary files /dev/null and b/resources/mesh_extrusionpath.png differ
diff --git a/resources/mesh_free_edges_2d.png b/resources/mesh_free_edges_2d.png
new file mode 100644 (file)
index 0000000..cc6cdb8
Binary files /dev/null and b/resources/mesh_free_edges_2d.png differ
diff --git a/resources/mesh_length_2d.png b/resources/mesh_length_2d.png
new file mode 100644 (file)
index 0000000..0009dc0
Binary files /dev/null and b/resources/mesh_length_2d.png differ
diff --git a/resources/mesh_multi_edges_2d.png b/resources/mesh_multi_edges_2d.png
new file mode 100644 (file)
index 0000000..627ceeb
Binary files /dev/null and b/resources/mesh_multi_edges_2d.png differ
diff --git a/resources/mesh_remove.png b/resources/mesh_remove.png
new file mode 100755 (executable)
index 0000000..960f1ac
Binary files /dev/null and b/resources/mesh_remove.png differ
index 556958d66a3883a41e2e9ab8ee0d8be936872ae2..2a862b8347cfc85e235b18bcff0faeaeb102c6eb 100644 (file)
@@ -31,7 +31,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
 
 @COMMENCE@
 
 
 @COMMENCE@
 
-EXPORT_HEADERS = SMESH_Controls.hxx
+EXPORT_HEADERS = SMESH_Controls.hxx SMESH_ControlsDef.hxx
 
 
 # Libraries targets
 
 
 # Libraries targets
index 10ecd711a2e4f1fe40d9adab3077839f279d3aed..0c8d145a366e5fd29eaae0fe8e2209349d03deff 100644 (file)
@@ -17,7 +17,7 @@
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
-#include "SMESH_Controls.hxx"
+#include "SMESH_ControlsDef.hxx"
 
 int main(int argc, char** argv)
 {
 
 int main(int argc, char** argv)
 {
@@ -29,7 +29,9 @@ int main(int argc, char** argv)
   new Skew();
   new Area();
   new Length();
   new Skew();
   new Area();
   new Length();
+  //  new Length2D();
   new MultiConnection();
   new MultiConnection();
+  //  new MultiConnection2D();
   new FreeBorders();
   new LessThan();
   new MoreThan();
   new FreeBorders();
   new LessThan();
   new MoreThan();
index a0dd64e13ae626726bd21a96ff33e58a4c82cf7b..2bf885a7a29a0d1500bc03e04f0818c4e2eda230 100644 (file)
@@ -17,7 +17,7 @@
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 
-#include "SMESH_Controls.hxx"
+#include "SMESH_ControlsDef.hxx"
 
 #include <set>
 
 
 #include <set>
 
@@ -33,7 +33,6 @@
 #include <Geom_CylindricalSurface.hxx>
 #include <Precision.hxx>
 #include <TColgp_Array1OfXYZ.hxx>
 #include <Geom_CylindricalSurface.hxx>
 #include <Precision.hxx>
 #include <TColgp_Array1OfXYZ.hxx>
-#include <TColgp_SequenceOfXYZ.hxx>
 #include <TColStd_MapOfInteger.hxx>
 #include <TColStd_SequenceOfAsciiString.hxx>
 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
 #include <TColStd_MapOfInteger.hxx>
 #include <TColStd_SequenceOfAsciiString.hxx>
 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
 #include "SMDS_MeshNode.hxx"
 
 
 #include "SMDS_MeshNode.hxx"
 
 
-
 /*
                             AUXILIARY METHODS 
 */
 
 /*
                             AUXILIARY METHODS 
 */
 
-static inline double getAngle( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
-{
-  gp_Vec v1( P1 - P2 ), v2( P3 - P2 );
-
-  return v1.Magnitude() < gp::Resolution() ||
-         v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 );
-}
-
-static inline double getArea( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
-{
-  gp_Vec aVec1( P2 - P1 );
-  gp_Vec aVec2( P3 - P1 );
-  return ( aVec1 ^ aVec2 ).Magnitude() * 0.5;
-}
-
-static inline double getArea( const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3 )
-{
-  return getArea( P1.XYZ(), P2.XYZ(), P3.XYZ() );
-}
+namespace{
+  inline double getAngle( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
+  {
+    gp_Vec v1( P1 - P2 ), v2( P3 - P2 );
+    
+    return v1.Magnitude() < gp::Resolution() ||
+      v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 );
+  }
 
 
-static inline double getDistance( const gp_XYZ& P1, const gp_XYZ& P2 )
-{
-  double aDist = gp_Pnt( P1 ).Distance( gp_Pnt( P2 ) );
-  return aDist;
-}
+  inline double getArea( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
+  {
+    gp_Vec aVec1( P2 - P1 );
+    gp_Vec aVec2( P3 - P1 );
+    return ( aVec1 ^ aVec2 ).Magnitude() * 0.5;
+  }
 
 
-static int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
-{
-  if ( theMesh == 0 )
-    return 0;
+  inline double getArea( const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3 )
+  {
+    return getArea( P1.XYZ(), P2.XYZ(), P3.XYZ() );
+  }
 
 
-  const SMDS_MeshElement* anEdge = theMesh->FindElement( theId );
-  if ( anEdge == 0 || anEdge->GetType() != SMDSAbs_Edge || anEdge->NbNodes() != 2 )
-    return 0;
 
 
-  TColStd_MapOfInteger aMap;
 
 
-  int aResult = 0;
-  SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
-  if ( anIter != 0 )
+  inline double getDistance( const gp_XYZ& P1, const gp_XYZ& P2 )
   {
   {
-    while( anIter->more() )
-    {
-      const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
-      if ( aNode == 0 )
-        return 0;
-      SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
-      while( anElemIter->more() )
-      {
-        const SMDS_MeshElement* anElem = anElemIter->next();
-        if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge )
-        {
-          int anId = anElem->GetID();
+    double aDist = gp_Pnt( P1 ).Distance( gp_Pnt( P2 ) );
+    return aDist;
+  }
 
 
-          if ( anIter->more() )              // i.e. first node
-            aMap.Add( anId );
-          else if ( aMap.Contains( anId ) )
-            aResult++;
-        }
+  int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
+  {
+    if ( theMesh == 0 )
+      return 0;
+    
+    const SMDS_MeshElement* anEdge = theMesh->FindElement( theId );
+    if ( anEdge == 0 || anEdge->GetType() != SMDSAbs_Edge || anEdge->NbNodes() != 2 )
+      return 0;
+    
+    TColStd_MapOfInteger aMap;
+    
+    int aResult = 0;
+    SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
+    if ( anIter != 0 ) {
+      while( anIter->more() ) {
+       const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+       if ( aNode == 0 )
+         return 0;
+       SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
+       while( anElemIter->more() ) {
+         const SMDS_MeshElement* anElem = anElemIter->next();
+         if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
+           int anId = anElem->GetID();
+           
+           if ( anIter->more() )              // i.e. first node
+             aMap.Add( anId );
+           else if ( aMap.Contains( anId ) )
+             aResult++;
+         }
+       }
       }
     }
       }
     }
+    
+    return aResult;
   }
 
   }
 
-  return aResult;
 }
 
 
 }
 
 
+
 using namespace SMESH::Controls;
 
 /*
 using namespace SMESH::Controls;
 
 /*
@@ -141,10 +141,10 @@ void NumericalFunctor::SetMesh( SMDS_Mesh* theMesh )
   myMesh = theMesh;
 }
 
   myMesh = theMesh;
 }
 
-bool NumericalFunctor::GetPoints(const int             theId,
-                                 TColgp_SequenceOfXYZ& theRes ) const
+bool NumericalFunctor::GetPoints(const int theId,
+                                 TSequenceOfXYZ& theRes ) const
 {
 {
-  theRes.Clear();
+  theRes.clear();
 
   if ( myMesh == 0 )
     return false;
 
   if ( myMesh == 0 )
     return false;
@@ -153,9 +153,9 @@ bool NumericalFunctor::GetPoints(const int             theId,
 }
 
 bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
 }
 
 bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
-                                 TColgp_SequenceOfXYZ&   theRes )
+                                 TSequenceOfXYZ& theRes )
 {
 {
-  theRes.Clear();
+  theRes.clear();
 
   if ( anElem == 0)
     return false;
 
   if ( anElem == 0)
     return false;
@@ -167,8 +167,9 @@ bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
     while( anIter->more() )
     {
       const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
     while( anIter->more() )
     {
       const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
-      if ( aNode != 0 )
-        theRes.Append( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
+      if ( aNode != 0 ){
+        theRes.push_back( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
+      }
     }
   }
 
     }
   }
 
@@ -187,7 +188,7 @@ void  NumericalFunctor::SetPrecision( const long thePrecision )
 
 double NumericalFunctor::GetValue( long theId )
 {
 
 double NumericalFunctor::GetValue( long theId )
 {
-  TColgp_SequenceOfXYZ P;
+  TSequenceOfXYZ P;
   if ( GetPoints( theId, P ))
   {
     double aVal = GetValue( P );
   if ( GetPoints( theId, P ))
   {
     double aVal = GetValue( P );
@@ -196,7 +197,6 @@ double NumericalFunctor::GetValue( long theId )
       double prec = pow( 10., (double)( myPrecision ) );
       aVal = floor( aVal * prec + 0.5 ) / prec;
     }
       double prec = pow( 10., (double)( myPrecision ) );
       aVal = floor( aVal * prec + 0.5 ) / prec;
     }
-    
     return aVal;
   }
 
     return aVal;
   }
 
@@ -208,11 +208,11 @@ double NumericalFunctor::GetValue( long theId )
   Description : Functor for calculation of minimum angle
 */
 
   Description : Functor for calculation of minimum angle
 */
 
-double MinimumAngle::GetValue( const TColgp_SequenceOfXYZ& P )
+double MinimumAngle::GetValue( const TSequenceOfXYZ& P )
 {
   double aMin;
 
 {
   double aMin;
 
-  if ( P.Length() == 3 )
+  if ( P.size() == 3 )
   {
     double A0 = getAngle( P( 3 ), P( 1 ), P( 2 ) );
     double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
   {
     double A0 = getAngle( P( 3 ), P( 1 ), P( 2 ) );
     double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
@@ -220,7 +220,7 @@ double MinimumAngle::GetValue( const TColgp_SequenceOfXYZ& P )
 
     aMin = Min( A0, Min( A1, A2 ) );
   }
 
     aMin = Min( A0, Min( A1, A2 ) );
   }
-  else if ( P.Length() == 4 )
+  else if ( P.size() == 4 )
   {
     double A0 = getAngle( P( 4 ), P( 1 ), P( 2 ) );
     double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
   {
     double A0 = getAngle( P( 4 ), P( 1 ), P( 2 ) );
     double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
@@ -251,9 +251,9 @@ SMDSAbs_ElementType MinimumAngle::GetType() const
   Class       : AspectRatio
   Description : Functor for calculating aspect ratio
 */
   Class       : AspectRatio
   Description : Functor for calculating aspect ratio
 */
-double AspectRatio::GetValue( const TColgp_SequenceOfXYZ& P )
+double AspectRatio::GetValue( const TSequenceOfXYZ& P )
 {
 {
-  int nbNodes = P.Length();
+  int nbNodes = P.size();
 
   if ( nbNodes != 3 && nbNodes != 4 )
     return 0;
 
   if ( nbNodes != 3 && nbNodes != 4 )
     return 0;
@@ -306,65 +306,81 @@ SMDSAbs_ElementType AspectRatio::GetType() const
   Class       : AspectRatio3D
   Description : Functor for calculating aspect ratio
 */
   Class       : AspectRatio3D
   Description : Functor for calculating aspect ratio
 */
+namespace{
 
 
-static inline double getHalfPerimeter(double theTria[3]){
-  return (theTria[0] + theTria[1] + theTria[2])/2.0;
-}
+  inline double getHalfPerimeter(double theTria[3]){
+    return (theTria[0] + theTria[1] + theTria[2])/2.0;
+  }
 
 
-static inline double getArea(double theHalfPerim, double theTria[3]){
-  return sqrt(theHalfPerim*
-             (theHalfPerim-theTria[0])*
-             (theHalfPerim-theTria[1])*
-             (theHalfPerim-theTria[2]));
-}
+  inline double getArea(double theHalfPerim, double theTria[3]){
+    return sqrt(theHalfPerim*
+               (theHalfPerim-theTria[0])*
+               (theHalfPerim-theTria[1])*
+               (theHalfPerim-theTria[2]));
+  }
 
 
-static inline double getVolume(double theLen[6]){
-  double a2 = theLen[0]*theLen[0];
-  double b2 = theLen[1]*theLen[1];
-  double c2 = theLen[2]*theLen[2];
-  double d2 = theLen[3]*theLen[3];
-  double e2 = theLen[4]*theLen[4];
-  double f2 = theLen[5]*theLen[5];
-  double P = 4.0*a2*b2*d2;
-  double Q = a2*(b2+d2-e2)-b2*(a2+d2-f2)-d2*(a2+b2-c2);
-  double R = (b2+d2-e2)*(a2+d2-f2)*(a2+d2-f2);
-  return sqrt(P-Q+R)/12.0;
-}
+  inline double getVolume(double theLen[6]){
+    double a2 = theLen[0]*theLen[0];
+    double b2 = theLen[1]*theLen[1];
+    double c2 = theLen[2]*theLen[2];
+    double d2 = theLen[3]*theLen[3];
+    double e2 = theLen[4]*theLen[4];
+    double f2 = theLen[5]*theLen[5];
+    double P = 4.0*a2*b2*d2;
+    double Q = a2*(b2+d2-e2)-b2*(a2+d2-f2)-d2*(a2+b2-c2);
+    double R = (b2+d2-e2)*(a2+d2-f2)*(a2+d2-f2);
+    return sqrt(P-Q+R)/12.0;
+  }
 
 
-static inline double getHeight( const gp_Pnt& P1, const gp_Pnt& P2, 
-                               const gp_Pnt& P3, const gp_Pnt& P4)
-{
-  gp_Vec aVec1( P2.XYZ() - P1.XYZ() );
-  gp_Vec aVec2( P3.XYZ() - P1.XYZ() );
-  gp_Vec aNorm = aVec1 ^ aVec2;
-  aNorm /= aNorm.Magnitude();
-  gp_Vec aVec3( P4.XYZ() - P1.XYZ() );
-  double aDist = aVec1 * aVec2;
-  return fabs( aDist );
-}
+  inline double getVolume2(double theLen[6]){
+    double a2 = theLen[0]*theLen[0];
+    double b2 = theLen[1]*theLen[1];
+    double c2 = theLen[2]*theLen[2];
+    double d2 = theLen[3]*theLen[3];
+    double e2 = theLen[4]*theLen[4];
+    double f2 = theLen[5]*theLen[5];
+
+    double P = a2*e2*(b2+c2+d2+f2-a2-e2);
+    double Q = b2*f2*(a2+c2+d2+e2-b2-f2);
+    double R = c2*d2*(a2+b2+e2+f2-c2-d2);
+    double S = a2*b2*d2+b2*c2*e2+a2*c2*f2+d2*e2*f2;
+    
+    return sqrt(P+Q+R-S)/12.0;
+  }
+
+  inline double getVolume(const TSequenceOfXYZ& P){
+    gp_Vec aVec1( P( 2 ) - P( 1 ) );
+    gp_Vec aVec2( P( 3 ) - P( 1 ) );
+    gp_Vec aVec3( P( 4 ) - P( 1 ) );
+    gp_Vec anAreaVec( aVec1 ^ aVec2 );
+    return abs(aVec3 * anAreaVec) / 6.0;
+  }
+
+  inline double getMaxHeight(double theLen[6])
+  {
+    double aHeight = max(theLen[0],theLen[1]);
+    aHeight = max(aHeight,theLen[2]);
+    aHeight = max(aHeight,theLen[3]);
+    aHeight = max(aHeight,theLen[4]);
+    aHeight = max(aHeight,theLen[5]);
+    return aHeight;
+  }
 
 
-static inline double getMaxHeight( const TColgp_SequenceOfXYZ& P )
-{
-  double aHeight = getHeight(P(1),P(2),P(3),P(4));
-  aHeight = max(aHeight,getHeight(P(1),P(2),P(4),P(3)));
-  aHeight = max(aHeight,getHeight(P(1),P(3),P(4),P(2)));
-  aHeight = max(aHeight,getHeight(P(2),P(3),P(4),P(1)));
-  return aHeight;
 }
 
 }
 
-double AspectRatio3D::GetValue( const TColgp_SequenceOfXYZ& P )
+double AspectRatio3D::GetValue( const TSequenceOfXYZ& P )
 {
   double aQuality = 0.0;
 {
   double aQuality = 0.0;
-  int nbNodes = P.Length();
+  int nbNodes = P.size();
   switch(nbNodes){
   case 4:{
     double aLen[6] = {
   switch(nbNodes){
   case 4:{
     double aLen[6] = {
-      getDistance(P(1),P(2)), // a
-      getDistance(P(2),P(3)), // b
-      getDistance(P(3),P(1)), // c
-      getDistance(P(2),P(4)), // d
-      getDistance(P(3),P(4)), // e
-      getDistance(P(1),P(4))  // f
+      getDistance(P( 1 ),P( 2 )), // a
+      getDistance(P( 2 ),P( 3 )), // b
+      getDistance(P( 3 ),P( 1 )), // c
+      getDistance(P( 2 ),P( 4 )), // d
+      getDistance(P( 3 ),P( 4 )), // e
+      getDistance(P( 1 ),P( 4 ))  // f
     };
     double aTria[4][3] = {
       {aLen[0],aLen[1],aLen[2]}, // abc
     };
     double aTria[4][3] = {
       {aLen[0],aLen[1],aLen[2]}, // abc
@@ -372,15 +388,205 @@ double AspectRatio3D::GetValue( const TColgp_SequenceOfXYZ& P )
       {aLen[1],aLen[3],aLen[4]}, // bde
       {aLen[2],aLen[4],aLen[5]}  // cef
     };
       {aLen[1],aLen[3],aLen[4]}, // bde
       {aLen[2],aLen[4],aLen[5]}  // cef
     };
-    double aHalfPerim = getHalfPerimeter(aTria[0]);
-    double anArea = getArea(aHalfPerim,aTria[0]);
-    aHalfPerim = getHalfPerimeter(aTria[1]);
-    anArea += getArea(aHalfPerim,aTria[1]);
-    aHalfPerim = getHalfPerimeter(aTria[2]);
-    anArea += getArea(aHalfPerim,aTria[2]);
-    double aVolume = getVolume(aLen);
-    double aHeight = getMaxHeight(P);
-    aQuality = 1.0/3.0*aHeight*anArea/aVolume;
+    double aSumArea = 0.0;
+    double aHalfPerimeter = getHalfPerimeter(aTria[0]);
+    double anArea = getArea(aHalfPerimeter,aTria[0]);
+    aSumArea += anArea;
+    aHalfPerimeter = getHalfPerimeter(aTria[1]);
+    anArea = getArea(aHalfPerimeter,aTria[1]);
+    aSumArea += anArea;
+    aHalfPerimeter = getHalfPerimeter(aTria[2]);
+    anArea = getArea(aHalfPerimeter,aTria[2]);
+    aSumArea += anArea;
+    aHalfPerimeter = getHalfPerimeter(aTria[3]);
+    anArea = getArea(aHalfPerimeter,aTria[3]);
+    aSumArea += anArea;
+    double aVolume = getVolume(P);
+    //double aVolume = getVolume(aLen);
+    double aHeight = getMaxHeight(aLen);
+    static double aCoeff = sqrt(6.0)/36.0;
+    aQuality = aCoeff*aHeight*aSumArea/aVolume;
+    break;
+  }
+  case 5:{
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 3 ),P( 5 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 3 ),P( 4 ),P( 5 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 4 ),P( 5 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 2 ),P( 3 ),P( 4 ),P( 5 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    break;
+  }
+  case 6:{
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 4 ),P( 6 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 4 ),P( 3 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 6 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 3 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 2 ),P( 5 ),P( 4 ),P( 6 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 2 ),P( 5 ),P( 4 ),P( 3 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    break;
+  }
+  case 8:{
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 3 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 4 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 7 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 8 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 6 ),P( 3 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 6 ),P( 4 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 6 ),P( 7 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 6 ),P( 8 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 2 ),P( 6 ),P( 5 ),P( 3 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 2 ),P( 6 ),P( 5 ),P( 4 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 2 ),P( 6 ),P( 5 ),P( 7 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 2 ),P( 6 ),P( 5 ),P( 8 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 8 ),P( 1 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 8 ),P( 2 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 8 ),P( 5 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 8 ),P( 6 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 7 ),P( 1 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 7 ),P( 2 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 7 ),P( 5 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 7 ),P( 6 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 4 ),P( 8 ),P( 7 ),P( 1 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 4 ),P( 8 ),P( 7 ),P( 2 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 4 ),P( 8 ),P( 7 ),P( 5 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 4 ),P( 8 ),P( 7 ),P( 6 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 4 ),P( 8 ),P( 7 ),P( 2 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 4 ),P( 5 ),P( 8 ),P( 2 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 4 ),P( 5 ),P( 3 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 3 ),P( 6 ),P( 7 ),P( 1 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 2 ),P( 3 ),P( 6 ),P( 4 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 5 ),P( 6 ),P( 8 ),P( 3 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 7 ),P( 8 ),P( 6 ),P( 1 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 4 ),P( 7 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
+    {
+      gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 2 ),P( 5 )};
+      aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
+    }
     break;
   }
   }
     break;
   }
   }
@@ -405,9 +611,9 @@ SMDSAbs_ElementType AspectRatio3D::GetType() const
   Class       : Warping
   Description : Functor for calculating warping
 */
   Class       : Warping
   Description : Functor for calculating warping
 */
-double Warping::GetValue( const TColgp_SequenceOfXYZ& P )
+double Warping::GetValue( const TSequenceOfXYZ& P )
 {
 {
-  if ( P.Length() != 4 )
+  if ( P.size() != 4 )
     return 0;
 
   gp_XYZ G = ( P( 1 ) + P( 2 ) + P( 3 ) + P( 4 ) ) / 4;
     return 0;
 
   gp_XYZ G = ( P( 1 ) + P( 2 ) + P( 3 ) + P( 4 ) ) / 4;
@@ -462,9 +668,9 @@ SMDSAbs_ElementType Warping::GetType() const
   Class       : Taper
   Description : Functor for calculating taper
 */
   Class       : Taper
   Description : Functor for calculating taper
 */
-double Taper::GetValue( const TColgp_SequenceOfXYZ& P )
+double Taper::GetValue( const TSequenceOfXYZ& P )
 {
 {
-  if ( P.Length() != 4 )
+  if ( P.size() != 4 )
     return 0;
 
   // Compute taper
     return 0;
 
   // Compute taper
@@ -514,14 +720,14 @@ static inline double skewAngle( const gp_XYZ& p1, const gp_XYZ& p2, const gp_XYZ
   return v1.Magnitude() < gp::Resolution() || v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 );
 }
 
   return v1.Magnitude() < gp::Resolution() || v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 );
 }
 
-double Skew::GetValue( const TColgp_SequenceOfXYZ& P )
+double Skew::GetValue( const TSequenceOfXYZ& P )
 {
 {
-  if ( P.Length() != 3 && P.Length() != 4 )
+  if ( P.size() != 3 && P.size() != 4 )
     return 0;
 
   // Compute skew
   static double PI2 = PI / 2;
     return 0;
 
   // Compute skew
   static double PI2 = PI / 2;
-  if ( P.Length() == 3 )
+  if ( P.size() == 3 )
   {
     double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) );
     double A1 = fabs( PI2 - skewAngle( P( 1 ), P( 2 ), P( 3 ) ) );
   {
     double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) );
     double A1 = fabs( PI2 - skewAngle( P( 1 ), P( 2 ), P( 3 ) ) );
@@ -562,11 +768,11 @@ SMDSAbs_ElementType Skew::GetType() const
   Class       : Area
   Description : Functor for calculating area
 */
   Class       : Area
   Description : Functor for calculating area
 */
-double Area::GetValue( const TColgp_SequenceOfXYZ& P )
+double Area::GetValue( const TSequenceOfXYZ& P )
 {
 {
-  if ( P.Length() == 3 )
+  if ( P.size() == 3 )
     return getArea( P( 1 ), P( 2 ), P( 3 ) );
     return getArea( P( 1 ), P( 2 ), P( 3 ) );
-  else if ( P.Length() == 4 )
+  else if ( P.size() == 4 )
     return getArea( P( 1 ), P( 2 ), P( 3 ) ) + getArea( P( 1 ), P( 3 ), P( 4 ) );
   else
     return 0;
     return getArea( P( 1 ), P( 2 ), P( 3 ) ) + getArea( P( 1 ), P( 3 ), P( 4 ) );
   else
     return 0;
@@ -587,9 +793,9 @@ SMDSAbs_ElementType Area::GetType() const
   Class       : Length
   Description : Functor for calculating length off edge
 */
   Class       : Length
   Description : Functor for calculating length off edge
 */
-double Length::GetValue( const TColgp_SequenceOfXYZ& P )
+double Length::GetValue( const TSequenceOfXYZ& P )
 {
 {
-  return ( P.Length() == 2 ? getDistance( P( 1 ), P( 2 ) ) : 0 );
+  return ( P.size() == 2 ? getDistance( P( 1 ), P( 2 ) ) : 0 );
 }
 
 double Length::GetBadRate( double Value, int /*nbNodes*/ ) const
 }
 
 double Length::GetBadRate( double Value, int /*nbNodes*/ ) const
@@ -602,12 +808,198 @@ SMDSAbs_ElementType Length::GetType() const
   return SMDSAbs_Edge;
 }
 
   return SMDSAbs_Edge;
 }
 
+/*
+  Class       : Length2D
+  Description : Functor for calculating length of edge
+*/
+
+double Length2D::GetValue( long theElementId)
+{
+  TSequenceOfXYZ P;
+
+  if (GetPoints(theElementId,P)){
+    
+    double  aVal;// = GetValue( P );
+    const SMDS_MeshElement* aElem = myMesh->FindElement( theElementId );
+    SMDSAbs_ElementType aType = aElem->GetType();
+    
+    int len = P.size();
+    
+    switch (aType){
+    case SMDSAbs_All:
+    case SMDSAbs_Node: 
+    case SMDSAbs_Edge:
+      if (len == 2){
+       aVal = getDistance( P( 1 ), P( 2 ) );
+       break;
+      }
+    case SMDSAbs_Face:
+      if (len == 3){ // triangles
+       double L1 = getDistance(P( 1 ),P( 2 ));
+       double L2 = getDistance(P( 2 ),P( 3 ));
+       double L3 = getDistance(P( 3 ),P( 1 ));
+       aVal = Max(L1,Max(L2,L3));
+       break;
+      }
+      else if (len == 4){ // quadrangles
+       double L1 = getDistance(P( 1 ),P( 2 ));
+       double L2 = getDistance(P( 2 ),P( 3 ));
+       double L3 = getDistance(P( 3 ),P( 4 ));
+       double L4 = getDistance(P( 4 ),P( 1 ));
+       aVal = Max(Max(L1,L2),Max(L3,L4));
+       break;
+      }
+    case SMDSAbs_Volume:
+      if (len == 4){ // tetraidrs
+       double L1 = getDistance(P( 1 ),P( 2 ));
+       double L2 = getDistance(P( 2 ),P( 3 ));
+       double L3 = getDistance(P( 3 ),P( 1 ));
+       double L4 = getDistance(P( 1 ),P( 4 ));
+       double L5 = getDistance(P( 2 ),P( 4 ));
+       double L6 = getDistance(P( 3 ),P( 4 ));
+       aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+       break;
+      } 
+      else if (len == 5){ // piramids
+       double L1 = getDistance(P( 1 ),P( 2 ));
+       double L2 = getDistance(P( 2 ),P( 3 ));
+       double L3 = getDistance(P( 3 ),P( 1 ));
+       double L4 = getDistance(P( 4 ),P( 1 ));
+       double L5 = getDistance(P( 1 ),P( 5 ));
+       double L6 = getDistance(P( 2 ),P( 5 ));
+       double L7 = getDistance(P( 3 ),P( 5 ));
+       double L8 = getDistance(P( 4 ),P( 5 ));
+      
+       aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+       aVal = Max(aVal,Max(L7,L8));
+       break;
+      }
+      else if (len == 6){ // pentaidres
+       double L1 = getDistance(P( 1 ),P( 2 ));
+       double L2 = getDistance(P( 2 ),P( 3 ));
+       double L3 = getDistance(P( 3 ),P( 1 ));
+       double L4 = getDistance(P( 4 ),P( 5 ));
+       double L5 = getDistance(P( 5 ),P( 6 ));
+       double L6 = getDistance(P( 6 ),P( 4 ));
+       double L7 = getDistance(P( 1 ),P( 4 ));
+       double L8 = getDistance(P( 2 ),P( 5 ));
+       double L9 = getDistance(P( 3 ),P( 6 ));
+      
+       aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+       aVal = Max(aVal,Max(Max(L7,L8),L9));
+       break;
+      }
+      else if (len == 8){ // hexaider
+       double L1 = getDistance(P( 1 ),P( 2 ));
+       double L2 = getDistance(P( 2 ),P( 3 ));
+       double L3 = getDistance(P( 3 ),P( 4 ));
+       double L4 = getDistance(P( 4 ),P( 1 ));
+       double L5 = getDistance(P( 5 ),P( 6 ));
+       double L6 = getDistance(P( 6 ),P( 7 ));
+       double L7 = getDistance(P( 7 ),P( 8 ));
+       double L8 = getDistance(P( 8 ),P( 5 ));
+       double L9 = getDistance(P( 1 ),P( 5 ));
+       double L10= getDistance(P( 2 ),P( 6 ));
+       double L11= getDistance(P( 3 ),P( 7 ));
+       double L12= getDistance(P( 4 ),P( 8 ));
+      
+       aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+       aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
+       aVal = Max(aVal,Max(L11,L12));
+       break;
+       
+      }
+      
+    default: aVal=-1; 
+    }
+    
+    if (aVal <0){
+      return 0.;
+    }
+
+    if ( myPrecision >= 0 )
+    {
+      double prec = pow( 10., (double)( myPrecision ) );
+      aVal = floor( aVal * prec + 0.5 ) / prec;
+    }
+    
+    return aVal;
+
+  }
+  return 0.;
+}
+
+double Length2D::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+  return Value;
+}
+
+SMDSAbs_ElementType Length2D::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+Length2D::Value::Value(double theLength,long thePntId1, long thePntId2):
+  myLength(theLength)
+{
+  myPntId[0] = thePntId1;  myPntId[1] = thePntId2;
+  if(thePntId1 > thePntId2){
+    myPntId[1] = thePntId1;  myPntId[0] = thePntId2;
+  }
+}
+
+bool Length2D::Value::operator<(const Length2D::Value& x) const{
+  if(myPntId[0] < x.myPntId[0]) return true;
+  if(myPntId[0] == x.myPntId[0])
+    if(myPntId[1] < x.myPntId[1]) return true;
+  return false;
+}
+
+void Length2D::GetValues(TValues& theValues){
+  TValues aValues;
+  SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
+  for(; anIter->more(); ){
+    const SMDS_MeshFace* anElem = anIter->next();
+    SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
+    long aNodeId[2];
+    gp_Pnt P[3];
+    
+    double aLength;
+    const SMDS_MeshElement* aNode;
+    if(aNodesIter->more()){
+      aNode = aNodesIter->next();
+      const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
+      P[0] = P[1] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
+      aNodeId[0] = aNodeId[1] = aNode->GetID();
+      aLength = 0;
+    }  
+    for(; aNodesIter->more(); ){
+      aNode = aNodesIter->next();
+      const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
+      long anId = aNode->GetID();
+      
+      P[2] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
+
+      aLength = P[1].Distance(P[2]);
+      
+      Value aValue(aLength,aNodeId[1],anId);
+      aNodeId[1] = anId;
+      P[1] = P[2];
+      theValues.insert(aValue);
+    }
+    
+    aLength = P[0].Distance(P[1]);
+    
+    Value aValue(aLength,aNodeId[0],aNodeId[1]);
+    theValues.insert(aValue);
+  }
+}
 
 /*
   Class       : MultiConnection
   Description : Functor for calculating number of faces conneted to the edge
 */
 
 /*
   Class       : MultiConnection
   Description : Functor for calculating number of faces conneted to the edge
 */
-double MultiConnection::GetValue( const TColgp_SequenceOfXYZ& P )
+double MultiConnection::GetValue( const TSequenceOfXYZ& P )
 {
   return 0;
 }
 {
   return 0;
 }
@@ -626,6 +1018,148 @@ SMDSAbs_ElementType MultiConnection::GetType() const
   return SMDSAbs_Edge;
 }
 
   return SMDSAbs_Edge;
 }
 
+/*
+  Class       : MultiConnection2D
+  Description : Functor for calculating number of faces conneted to the edge
+*/
+double MultiConnection2D::GetValue( const TSequenceOfXYZ& P )
+{
+  return 0;
+}
+
+double MultiConnection2D::GetValue( long theElementId )
+{
+  TSequenceOfXYZ P;
+  int aResult = 0;
+  
+  if (GetPoints(theElementId,P)){
+    double  aVal;
+    const SMDS_MeshElement* anFaceElem = myMesh->FindElement( theElementId );
+    SMDSAbs_ElementType aType = anFaceElem->GetType();
+    
+    int len = P.size();
+    
+    TColStd_MapOfInteger aMap;
+    int aResult = 0;
+    
+    switch (aType){
+    case SMDSAbs_All:
+    case SMDSAbs_Node: 
+    case SMDSAbs_Edge:
+    case SMDSAbs_Face:
+      if (len == 3){ // triangles
+       int Nb[3] = {0,0,0};
+
+       int i=0;
+       SMDS_ElemIteratorPtr anIter = anFaceElem->nodesIterator();
+       if ( anIter != 0 ) {
+         while( anIter->more() ) {
+           const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+           if ( aNode == 0 ){
+             break;
+           }
+           SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
+           while( anElemIter->more() ) {
+             const SMDS_MeshElement* anElem = anElemIter->next();
+             if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
+               int anId = anElem->GetID();
+
+               if ( anIter->more() )              // i.e. first node
+                 aMap.Add( anId );
+               else if ( aMap.Contains( anId ) ){
+                 Nb[i]++;
+               }
+             }
+             else if ( anElem != 0 && anElem->GetType() == SMDSAbs_Edge ) i++;
+           }
+         }
+       }
+       
+       aResult = Max(Max(Nb[0],Nb[1]),Nb[2]);
+      }
+      break;
+    case SMDSAbs_Volume:
+    default: aResult=0;
+    }
+    
+  }
+  return aResult;//getNbMultiConnection( myMesh, theId );
+}
+
+double MultiConnection2D::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+  return Value;
+}
+
+SMDSAbs_ElementType MultiConnection2D::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+MultiConnection2D::Value::Value(long thePntId1, long thePntId2)
+{
+  myPntId[0] = thePntId1;  myPntId[1] = thePntId2;
+  if(thePntId1 > thePntId2){
+    myPntId[1] = thePntId1;  myPntId[0] = thePntId2;
+  }
+}
+
+bool MultiConnection2D::Value::operator<(const MultiConnection2D::Value& x) const{
+  if(myPntId[0] < x.myPntId[0]) return true;
+  if(myPntId[0] == x.myPntId[0])
+    if(myPntId[1] < x.myPntId[1]) return true;
+  return false;
+}
+
+void MultiConnection2D::GetValues(MValues& theValues){
+  SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
+  for(; anIter->more(); ){
+    const SMDS_MeshFace* anElem = anIter->next();
+    long anElemId = anElem->GetID();
+    SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
+    long aNodeId[3];
+
+    //int aNbConnects=0;
+    const SMDS_MeshNode* aNode0;
+    const SMDS_MeshNode* aNode1;
+    const SMDS_MeshNode* aNode2;
+    if(aNodesIter->more()){
+      aNode0 = (SMDS_MeshNode*) aNodesIter->next();
+      aNode1 = aNode0;
+      const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode1;
+      aNodeId[0] = aNodeId[1] = aNodes->GetID();
+    }
+    for(; aNodesIter->more(); ){
+      aNode2 = (SMDS_MeshNode*) aNodesIter->next();
+      long anId = aNode2->GetID();
+      aNodeId[2] = anId;
+      
+      Value aValue(aNodeId[1],aNodeId[2]);
+      MValues::iterator aItr = theValues.find(aValue);
+      if (aItr != theValues.end()){
+       aItr->second += 1;
+       //aNbConnects = nb;
+      } else {
+       theValues[aValue] = 1;
+       //aNbConnects = 1;
+      }
+      //cout << "NodeIds: "<<aNodeId[1]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
+      aNodeId[1] = aNodeId[2];
+      aNode1 = aNode2;
+    }
+    Value aValue(aNodeId[0],aNodeId[2]);
+    MValues::iterator aItr = theValues.find(aValue);
+    if (aItr != theValues.end()){
+      aItr->second += 1;
+      //aNbConnects = nb;
+    } else {
+      theValues[aValue] = 1;
+      //aNbConnects = 1;
+    }
+    //cout << "NodeIds: "<<aNodeId[0]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
+  }
+
+}
 
 /*
                             PREDICATES
 
 /*
                             PREDICATES
@@ -1426,7 +1960,6 @@ static gp_XYZ getNormale( const SMDS_MeshFace* theFace )
   gp_XYZ n;
   int aNbNode = theFace->NbNodes();
   TColgp_Array1OfXYZ anArrOfXYZ(1,4);
   gp_XYZ n;
   int aNbNode = theFace->NbNodes();
   TColgp_Array1OfXYZ anArrOfXYZ(1,4);
-  gp_XYZ p1, p2, p3, p4;
   SMDS_ElemIteratorPtr aNodeItr = theFace->nodesIterator();
   int i = 1;
   for ( ; aNodeItr->more() && i <= 4; i++ )
   SMDS_ElemIteratorPtr aNodeItr = theFace->nodesIterator();
   int i = 1;
   for ( ; aNodeItr->more() && i <= 4; i++ )
@@ -1612,7 +2145,7 @@ void ManifoldPart::getFacesByLink( const ManifoldPart::Link& theLink,
     SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
     if ( !aFace )
       continue;
     SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
     if ( !aFace )
       continue;
-    aSetOfFaces.insert( aFace );
+    aSetOfFaces.Add( aFace );
   }
   // take all faces that shared second node
   anItr = theLink.myNode2->facesIterator();
   }
   // take all faces that shared second node
   anItr = theLink.myNode2->facesIterator();
@@ -1620,7 +2153,7 @@ void ManifoldPart::getFacesByLink( const ManifoldPart::Link& theLink,
   for ( ; anItr->more(); )
   {
     SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
   for ( ; anItr->more(); )
   {
     SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
-    if ( aSetOfFaces.find( aFace ) != aSetOfFaces.end() )
+    if ( aSetOfFaces.Contains( aFace ) )
       theFaces.push_back( aFace );
   }
 }
       theFaces.push_back( aFace );
   }
 }
index 491e59b66d3cc215b7f25e55c2ff80453afb784b..fa4558db5bf7216c9f4e4bec04d1c594c913bfe0 100644 (file)
 #ifndef _SMESH_CONTROLS_HXX_
 #define _SMESH_CONTROLS_HXX_
 
 #ifndef _SMESH_CONTROLS_HXX_
 #define _SMESH_CONTROLS_HXX_
 
-#include <set>
-#include <map>
-#include <vector>
 #include <boost/shared_ptr.hpp>
 #include <boost/shared_ptr.hpp>
-#include "SMDSAbs_ElementType.hxx"
-#include "SMDS_MeshNode.hxx"
-#include <Geom_Surface.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <TColStd_MapOfInteger.hxx>
-#include <TCollection_AsciiString.hxx>
-
-class SMDS_Mesh;
-class SMESHDS_Mesh;
-class SMESHDS_SubMesh;
-class gp_Pnt;
-class gp_XYZ;
-class TColgp_SequenceOfXYZ;
-class TopoDS_Shape;
-class SMDS_MeshElement;
-class SMDS_MeshFace;
-class SMDS_MeshNode;
 
 namespace SMESH{
   namespace Controls{
 
 namespace SMESH{
   namespace Controls{
-    class Functor
-    {
-    public:
-      ~Functor(){}
-      virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
-      virtual SMDSAbs_ElementType GetType() const = 0;
-    };
+
+    class Functor;
     typedef boost::shared_ptr<Functor> FunctorPtr;
 
     typedef boost::shared_ptr<Functor> FunctorPtr;
 
-    class NumericalFunctor: public virtual Functor{
-    public:
-      NumericalFunctor();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
-      virtual double GetValue( long theElementId );
-      virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints ) = 0;
-      virtual SMDSAbs_ElementType GetType() const = 0;
-      virtual double GetBadRate( double Value, int nbNodes ) const = 0;
-      long  GetPrecision() const;
-      void  SetPrecision( const long thePrecision );
-      
-      bool GetPoints (const int             theId, 
-                      TColgp_SequenceOfXYZ& theRes ) const;
-      static bool GetPoints (const SMDS_MeshElement* theElem, 
-                             TColgp_SequenceOfXYZ&    theRes );
-    protected:
-      SMDS_Mesh* myMesh;
-      long       myPrecision;
-    };
+
+    class NumericalFunctor;
     typedef boost::shared_ptr<NumericalFunctor> NumericalFunctorPtr;
   
   
     typedef boost::shared_ptr<NumericalFunctor> NumericalFunctorPtr;
   
   
-    /*
-      Class       : SMESH_MinimumAngle
-      Description : Functor for calculation of minimum angle
-    */
-    class MinimumAngle: public virtual NumericalFunctor{
-    public:
-      virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
-      virtual double GetBadRate( double Value, int nbNodes ) const;
-      virtual SMDSAbs_ElementType GetType() const;
-    };
-  
-  
-    /*
-      Class       : AspectRatio
-      Description : Functor for calculating aspect ratio
-    */
-    class AspectRatio: public virtual NumericalFunctor{
-    public:
-      virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
-      virtual double GetBadRate( double Value, int nbNodes ) const;
-      virtual SMDSAbs_ElementType GetType() const;
-    };
-  
-  
-    /*
-      Class       : AspectRatio3D
-      Description : Functor for calculating aspect ratio of 3D elems.
-    */
-    class AspectRatio3D: public virtual NumericalFunctor{
-    public:
-      virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
-      virtual double GetBadRate( double Value, int nbNodes ) const;
-      virtual SMDSAbs_ElementType GetType() const;
-    };
-  
-  
-    /*
-      Class       : Warping
-      Description : Functor for calculating warping
-    */
-    class Warping: public virtual NumericalFunctor{
-    public:
-      virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
-      virtual double GetBadRate( double Value, int nbNodes ) const;
-      virtual SMDSAbs_ElementType GetType() const;
-      
-    private:
-      double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
-    };
-  
-  
-    /*
-      Class       : Taper
-      Description : Functor for calculating taper
-    */
-    class Taper: public virtual NumericalFunctor{
-    public:
-      virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
-      virtual double GetBadRate( double Value, int nbNodes ) const;
-      virtual SMDSAbs_ElementType GetType() const;
-    };
-    
-  
-    /*
-      Class       : Skew
-      Description : Functor for calculating skew in degrees
-    */
-    class Skew: public virtual NumericalFunctor{
-    public:
-      virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
-      virtual double GetBadRate( double Value, int nbNodes ) const;
-      virtual SMDSAbs_ElementType GetType() const;
-    };
-  
-    
-    /*
-      Class       : Area
-      Description : Functor for calculating area
-    */
-    class Area: public virtual NumericalFunctor{
-    public:
-      virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
-      virtual double GetBadRate( double Value, int nbNodes ) const;
-      virtual SMDSAbs_ElementType GetType() const;
-    };
-  
-  
-    /*
-      Class       : Length
-      Description : Functor for calculating length of edge
-    */
-    class Length: public virtual NumericalFunctor{
-    public:
-      virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
-      virtual double GetBadRate( double Value, int nbNodes ) const;
-      virtual SMDSAbs_ElementType GetType() const;
-    };
-  
-  
-    /*
-      Class       : MultiConnection
-      Description : Functor for calculating number of faces conneted to the edge
-    */
-    class MultiConnection: public virtual NumericalFunctor{
-    public:
-      virtual double GetValue( long theElementId );
-      virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
-      virtual double GetBadRate( double Value, int nbNodes ) const;
-      virtual SMDSAbs_ElementType GetType() const;
-    };
-    
-  
-    /*
-      PREDICATES
-    */
-    /*
-      Class       : Predicate
-      Description : Base class for all predicates
-    */
-    class Predicate: public virtual Functor{
-    public:
-      virtual bool IsSatisfy( long theElementId ) = 0;
-      virtual SMDSAbs_ElementType GetType() const = 0;
-    };
+    class Predicate;
     typedef boost::shared_ptr<Predicate> PredicatePtr;
     typedef boost::shared_ptr<Predicate> PredicatePtr;
-    
-  
-  
-    /*
-      Class       : FreeBorders
-      Description : Predicate for free borders
-    */
-    class FreeBorders: public virtual Predicate{
-    public:
-      FreeBorders();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
-      virtual bool IsSatisfy( long theElementId );
-      virtual SMDSAbs_ElementType GetType() const;
-            
-    protected:
-      SMDS_Mesh* myMesh;
-    };
-   
-
-    /*
-      Class       : FreeEdges
-      Description : Predicate for free Edges
-    */
-    class FreeEdges: public virtual Predicate{
-    public:
-      FreeEdges();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
-      virtual bool IsSatisfy( long theElementId );
-      virtual SMDSAbs_ElementType GetType() const;
-      static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId  );
-      typedef long TElemId;
-      struct Border{
-       TElemId myElemId;
-       TElemId myPntId[2];
-       Border(long theElemId, long thePntId1, long thePntId2);
-       bool operator<(const Border& x) const;
-      };
-      typedef std::set<Border> TBorders;
-      void GetBoreders(TBorders& theBorders);
-      
-    protected:
-      SMDS_Mesh* myMesh;
-    };
-    typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
-
 
 
-    /*
-      Class       : RangeOfIds
-      Description : Predicate for Range of Ids.
-                    Range may be specified with two ways.
-                    1. Using AddToRange method
-                    2. With SetRangeStr method. Parameter of this method is a string
-                       like as "1,2,3,50-60,63,67,70-"
-    */
-    class RangeOfIds: public virtual Predicate
-    {
-    public:
-                                    RangeOfIds();
-      virtual void                  SetMesh( SMDS_Mesh* theMesh );
-      virtual bool                  IsSatisfy( long theNodeId );
-      virtual SMDSAbs_ElementType   GetType() const;
-      virtual void                  SetType( SMDSAbs_ElementType theType );
-
-      bool                          AddToRange( long theEntityId );
-      void                          GetRangeStr( TCollection_AsciiString& );
-      bool                          SetRangeStr( const TCollection_AsciiString& );
-
-    protected:
-      SMDS_Mesh*                    myMesh;
-
-      TColStd_SequenceOfInteger     myMin;
-      TColStd_SequenceOfInteger     myMax;
-      TColStd_MapOfInteger          myIds;
-
-      SMDSAbs_ElementType           myType;
-    };
-    
-    typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
-   
-    
-    /*
-      Class       : Comparator
-      Description : Base class for comparators
-    */
-    class Comparator: public virtual Predicate{
-    public:
-      Comparator();
-      virtual ~Comparator();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
-      virtual void SetMargin(double theValue);
-      virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
-      virtual bool IsSatisfy( long theElementId ) = 0;
-      virtual SMDSAbs_ElementType GetType() const;
-      double  GetMargin();
-  
-    protected:
-      double myMargin;
-      NumericalFunctorPtr myFunctor;
-    };
-    typedef boost::shared_ptr<Comparator> ComparatorPtr;
-  
-  
-    /*
-      Class       : LessThan
-      Description : Comparator "<"
-    */
-    class LessThan: public virtual Comparator{
-    public:
-      virtual bool IsSatisfy( long theElementId );
-    };
-  
-  
-    /*
-      Class       : MoreThan
-      Description : Comparator ">"
-    */
-    class MoreThan: public virtual Comparator{
-    public:
-      virtual bool IsSatisfy( long theElementId );
-    };
-  
-  
-    /*
-      Class       : EqualTo
-      Description : Comparator "="
-    */
-    class EqualTo: public virtual Comparator{
-    public:
-      EqualTo();
-      virtual bool IsSatisfy( long theElementId );
-      virtual void SetTolerance( double theTol );
-      virtual double GetTolerance();
-  
-    private:
-      double myToler;
-    };
-    typedef boost::shared_ptr<EqualTo> EqualToPtr;
-  
-    
-    /*
-      Class       : LogicalNOT
-      Description : Logical NOT predicate
-    */
-    class LogicalNOT: public virtual Predicate{
-    public:
-      LogicalNOT();
-      virtual ~LogicalNOT();
-      virtual bool IsSatisfy( long theElementId );
-      virtual void SetMesh( SMDS_Mesh* theMesh );
-      virtual void SetPredicate(PredicatePtr thePred);
-      virtual SMDSAbs_ElementType GetType() const;
-  
-    private:
-      PredicatePtr myPredicate;
-    };
-    typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
-    
-  
-    /*
-      Class       : LogicalBinary
-      Description : Base class for binary logical predicate
-    */
-    class LogicalBinary: public virtual Predicate{
-    public:
-      LogicalBinary();
-      virtual ~LogicalBinary();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
-      virtual void SetPredicate1(PredicatePtr thePred);
-      virtual void SetPredicate2(PredicatePtr thePred);
-      virtual SMDSAbs_ElementType GetType() const;
-  
-    protected:
-      PredicatePtr myPredicate1;
-      PredicatePtr myPredicate2;
-    };
-    typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
-  
-  
-    /*
-      Class       : LogicalAND
-      Description : Logical AND
-    */
-    class LogicalAND: public virtual LogicalBinary{
-    public:
-      virtual bool IsSatisfy( long theElementId );
-    };
-  
-  
-    /*
-      Class       : LogicalOR
-      Description : Logical OR
-    */
-    class LogicalOR: public virtual LogicalBinary{
-    public:
-      virtual bool IsSatisfy( long theElementId );
-    };
-  
-  
-    /*
-      Class       : ManifoldPart
-      Description : Predicate for manifold part of mesh
-    */
-    class ManifoldPart: public virtual Predicate{
-    public:
-
-      /* internal class for algorithm uses */
-      class Link
-      {
-      public:
-        Link( SMDS_MeshNode* theNode1,
-              SMDS_MeshNode* theNode2 );
-        ~Link();
-        
-        bool IsEqual( const ManifoldPart::Link& theLink ) const;
-        bool operator<(const ManifoldPart::Link& x) const;
-        
-        SMDS_MeshNode* myNode1;
-        SMDS_MeshNode* myNode2;
-      };
-
-      bool IsEqual( const ManifoldPart::Link& theLink1,
-                    const ManifoldPart::Link& theLink2 );
-      
-      typedef std::set<ManifoldPart::Link>                TMapOfLink;
-      typedef std::vector<SMDS_MeshFace*>                 TVectorOfFacePtr;
-      typedef std::vector<ManifoldPart::Link>             TVectorOfLink;
-      typedef std::map<SMDS_MeshFace*,int>                TDataMapFacePtrInt;
-      typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
-      
-      ManifoldPart();
-      ~ManifoldPart();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
-      // inoke when all parameters already set
-      virtual bool IsSatisfy( long theElementId );
-      virtual      SMDSAbs_ElementType GetType() const;
-
-      void    SetAngleTolerance( const double theAngToler );
-      double  GetAngleTolerance() const;
-      void    SetIsOnlyManifold( const bool theIsOnly );
-      void    SetStartElem( const long  theStartElemId );
-
-    private:
-      bool    process();
-      bool    findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
-                             SMDS_MeshFace*            theStartFace,
-                             TMapOfLink&               theNonManifold,
-                             TColStd_MapOfInteger&     theResFaces );
-      bool    isInPlane( const SMDS_MeshFace* theFace1,
-                          const SMDS_MeshFace* theFace2 );
-      void    expandBoundary( TMapOfLink&            theMapOfBoundary,
-                              TVectorOfLink&         theSeqOfBoundary,
-                              TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
-                              TMapOfLink&            theNonManifold,
-                              SMDS_MeshFace*         theNextFace ) const;
-
-     void     getFacesByLink( const Link& theLink,
-                              TVectorOfFacePtr& theFaces ) const;
-
-    private:
-      SMDS_Mesh*            myMesh;
-      TColStd_MapOfInteger  myMapIds;
-      TColStd_MapOfInteger  myMapBadGeomIds;
-      TVectorOfFacePtr      myAllFacePtr;
-      TDataMapFacePtrInt    myAllFacePtrIntDMap;
-      double                myAngToler;
-      bool                  myIsOnlyManifold;
-      long                  myStartElemId;
-
-    };
-    typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
-                         
-
-    /*
-      Class       : ElementsOnSurface
-      Description : Predicate elements that lying on indicated surface
-                    (plane or cylinder)
-    */
-    class ElementsOnSurface : public virtual Predicate {
-    public:
-      ElementsOnSurface();
-      ~ElementsOnSurface();
-      virtual void SetMesh( SMDS_Mesh* theMesh );
-      virtual bool IsSatisfy( long theElementId );
-      virtual      SMDSAbs_ElementType GetType() const;
-
-      void    SetTolerance( const double theToler );
-      double  GetTolerance() const;
-      void    SetSurface( const TopoDS_Shape& theShape,
-                          const SMDSAbs_ElementType theType );
-
-    private:
-      void    process();
-      void    process( const SMDS_MeshElement* theElem  );
-      bool    isOnSurface( const SMDS_MeshNode* theNode ) const;
-
-    private:
-      SMDS_Mesh*            myMesh;
-      TColStd_MapOfInteger  myIds;
-      SMDSAbs_ElementType   myType;
-      Handle(Geom_Surface)  mySurf;
-      double                myToler;
-    };
-    
-    typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
-      
-
-    /*
-      FILTER
-    */
-    class Filter{
-    public:
-      Filter();
-      virtual ~Filter();
-      virtual void SetPredicate(PredicatePtr thePred);
-      typedef std::vector<long> TIdSequence;
-      virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
-  
-    protected:
-      PredicatePtr myPredicate;
-    };
-  };  
-};
+  }
+}
 
 
 #endif
 
 
 #endif
diff --git a/src/Controls/SMESH_ControlsDef.hxx b/src/Controls/SMESH_ControlsDef.hxx
new file mode 100644 (file)
index 0000000..50fb065
--- /dev/null
@@ -0,0 +1,612 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifndef _SMESH_CONTROLSDEF_HXX_
+#define _SMESH_CONTROLSDEF_HXX_
+
+#include <set>
+#include <map>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <gp_XYZ.hxx>
+#include <Geom_Surface.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TCollection_AsciiString.hxx>
+
+#include "SMDSAbs_ElementType.hxx"
+#include "SMDS_MeshNode.hxx"
+
+#include "SMESH_Controls.hxx"
+
+class SMDS_MeshElement;
+class SMDS_MeshFace;
+class SMDS_MeshNode;
+class SMDS_Mesh;
+
+class SMESHDS_Mesh;
+class SMESHDS_SubMesh;
+
+class gp_Pnt;
+class TopoDS_Shape;
+
+
+namespace SMESH{
+  namespace Controls{
+
+    class TSequenceOfXYZ: public std::vector<gp_XYZ>
+    {
+    public:
+      typedef std::vector<gp_XYZ> TSuperClass;
+      TSequenceOfXYZ()
+      {}
+
+      TSequenceOfXYZ(size_type n):
+       TSuperClass(n)
+      {}
+
+      TSequenceOfXYZ(size_type n, const value_type& t):
+       TSuperClass(n,t)
+      {}
+
+      TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ):
+       TSuperClass(theSequenceOfXYZ)
+      {}
+
+      template <class InputIterator>
+      TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd):
+       TSuperClass(theBegin,theEnd)
+      {}
+
+      TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ){
+       TSuperClass::operator=(theSequenceOfXYZ);
+       return *this;
+      }
+
+      reference operator()(size_type n){
+       return TSuperClass::operator[](n-1);
+      }
+
+      const_reference operator()(size_type n) const{
+       return TSuperClass::operator[](n-1);
+      }
+
+    private:
+      reference operator[](size_type n);
+
+      const_reference operator[](size_type n) const;
+    };
+
+    class Functor
+    {
+    public:
+      ~Functor(){}
+      virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
+      virtual SMDSAbs_ElementType GetType() const = 0;
+    };
+
+    class NumericalFunctor: public virtual Functor{
+    public:
+      NumericalFunctor();
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual double GetValue( long theElementId );
+      virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
+      virtual SMDSAbs_ElementType GetType() const = 0;
+      virtual double GetBadRate( double Value, int nbNodes ) const = 0;
+      long  GetPrecision() const;
+      void  SetPrecision( const long thePrecision );
+      
+      bool GetPoints(const int theId, 
+                    TSequenceOfXYZ& theRes) const;
+      static bool GetPoints(const SMDS_MeshElement* theElem, 
+                           TSequenceOfXYZ& theRes);
+    protected:
+      SMDS_Mesh* myMesh;
+      long       myPrecision;
+    };
+  
+  
+    /*
+      Class       : SMESH_MinimumAngle
+      Description : Functor for calculation of minimum angle
+    */
+    class MinimumAngle: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( const TSequenceOfXYZ& thePoints );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+  
+  
+    /*
+      Class       : AspectRatio
+      Description : Functor for calculating aspect ratio
+    */
+    class AspectRatio: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( const TSequenceOfXYZ& thePoints );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+  
+  
+    /*
+      Class       : AspectRatio3D
+      Description : Functor for calculating aspect ratio of 3D elems.
+    */
+    class AspectRatio3D: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( const TSequenceOfXYZ& thePoints );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+  
+  
+    /*
+      Class       : Warping
+      Description : Functor for calculating warping
+    */
+    class Warping: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( const TSequenceOfXYZ& thePoints );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+      
+    private:
+      double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
+    };
+  
+  
+    /*
+      Class       : Taper
+      Description : Functor for calculating taper
+    */
+    class Taper: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( const TSequenceOfXYZ& thePoints );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+    
+  
+    /*
+      Class       : Skew
+      Description : Functor for calculating skew in degrees
+    */
+    class Skew: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( const TSequenceOfXYZ& thePoints );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+  
+    
+    /*
+      Class       : Area
+      Description : Functor for calculating area
+    */
+    class Area: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( const TSequenceOfXYZ& thePoints );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+  
+  
+    /*
+      Class       : Length
+      Description : Functor for calculating length of edge
+    */
+    class Length: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( const TSequenceOfXYZ& thePoints );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+  
+    /*
+      Class       : Length2D
+      Description : Functor for calculating length of edge
+    */
+    class Length2D: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+      struct Value{
+       double myLength;
+       long myPntId[2];
+       Value(double theLength, long thePntId1, long thePntId2);
+       bool operator<(const Value& x) const;
+      };
+      typedef std::set<Value> TValues;
+      void GetValues(TValues& theValues);
+      
+    };
+    typedef boost::shared_ptr<Length2D> Length2DPtr;
+
+    /*
+      Class       : MultiConnection
+      Description : Functor for calculating number of faces conneted to the edge
+    */
+    class MultiConnection: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      virtual double GetValue( const TSequenceOfXYZ& thePoints );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+    
+    /*
+      Class       : MultiConnection2D
+      Description : Functor for calculating number of faces conneted to the edge
+    */
+    class MultiConnection2D: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      virtual double GetValue( const TSequenceOfXYZ& thePoints );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+      struct Value{
+       long myPntId[2];
+       Value(long thePntId1, long thePntId2);
+       bool operator<(const Value& x) const;
+      };
+      typedef std::map<Value,int> MValues;
+
+      void GetValues(MValues& theValues);
+    };
+    typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
+    /*
+      PREDICATES
+    */
+    /*
+      Class       : Predicate
+      Description : Base class for all predicates
+    */
+    class Predicate: public virtual Functor{
+    public:
+      virtual bool IsSatisfy( long theElementId ) = 0;
+      virtual SMDSAbs_ElementType GetType() const = 0;
+    };
+    
+  
+  
+    /*
+      Class       : FreeBorders
+      Description : Predicate for free borders
+    */
+    class FreeBorders: public virtual Predicate{
+    public:
+      FreeBorders();
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual bool IsSatisfy( long theElementId );
+      virtual SMDSAbs_ElementType GetType() const;
+            
+    protected:
+      SMDS_Mesh* myMesh;
+    };
+   
+
+    /*
+      Class       : FreeEdges
+      Description : Predicate for free Edges
+    */
+    class FreeEdges: public virtual Predicate{
+    public:
+      FreeEdges();
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual bool IsSatisfy( long theElementId );
+      virtual SMDSAbs_ElementType GetType() const;
+      static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId  );
+      typedef long TElemId;
+      struct Border{
+       TElemId myElemId;
+       TElemId myPntId[2];
+       Border(long theElemId, long thePntId1, long thePntId2);
+       bool operator<(const Border& x) const;
+      };
+      typedef std::set<Border> TBorders;
+      void GetBoreders(TBorders& theBorders);
+      
+    protected:
+      SMDS_Mesh* myMesh;
+    };
+    typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
+
+
+    /*
+      Class       : RangeOfIds
+      Description : Predicate for Range of Ids.
+                    Range may be specified with two ways.
+                    1. Using AddToRange method
+                    2. With SetRangeStr method. Parameter of this method is a string
+                       like as "1,2,3,50-60,63,67,70-"
+    */
+    class RangeOfIds: public virtual Predicate
+    {
+    public:
+                                    RangeOfIds();
+      virtual void                  SetMesh( SMDS_Mesh* theMesh );
+      virtual bool                  IsSatisfy( long theNodeId );
+      virtual SMDSAbs_ElementType   GetType() const;
+      virtual void                  SetType( SMDSAbs_ElementType theType );
+
+      bool                          AddToRange( long theEntityId );
+      void                          GetRangeStr( TCollection_AsciiString& );
+      bool                          SetRangeStr( const TCollection_AsciiString& );
+
+    protected:
+      SMDS_Mesh*                    myMesh;
+
+      TColStd_SequenceOfInteger     myMin;
+      TColStd_SequenceOfInteger     myMax;
+      TColStd_MapOfInteger          myIds;
+
+      SMDSAbs_ElementType           myType;
+    };
+    
+    typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
+   
+    
+    /*
+      Class       : Comparator
+      Description : Base class for comparators
+    */
+    class Comparator: public virtual Predicate{
+    public:
+      Comparator();
+      virtual ~Comparator();
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMargin(double theValue);
+      virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
+      virtual bool IsSatisfy( long theElementId ) = 0;
+      virtual SMDSAbs_ElementType GetType() const;
+      double  GetMargin();
+  
+    protected:
+      double myMargin;
+      NumericalFunctorPtr myFunctor;
+    };
+    typedef boost::shared_ptr<Comparator> ComparatorPtr;
+  
+  
+    /*
+      Class       : LessThan
+      Description : Comparator "<"
+    */
+    class LessThan: public virtual Comparator{
+    public:
+      virtual bool IsSatisfy( long theElementId );
+    };
+  
+  
+    /*
+      Class       : MoreThan
+      Description : Comparator ">"
+    */
+    class MoreThan: public virtual Comparator{
+    public:
+      virtual bool IsSatisfy( long theElementId );
+    };
+  
+  
+    /*
+      Class       : EqualTo
+      Description : Comparator "="
+    */
+    class EqualTo: public virtual Comparator{
+    public:
+      EqualTo();
+      virtual bool IsSatisfy( long theElementId );
+      virtual void SetTolerance( double theTol );
+      virtual double GetTolerance();
+  
+    private:
+      double myToler;
+    };
+    typedef boost::shared_ptr<EqualTo> EqualToPtr;
+  
+    
+    /*
+      Class       : LogicalNOT
+      Description : Logical NOT predicate
+    */
+    class LogicalNOT: public virtual Predicate{
+    public:
+      LogicalNOT();
+      virtual ~LogicalNOT();
+      virtual bool IsSatisfy( long theElementId );
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetPredicate(PredicatePtr thePred);
+      virtual SMDSAbs_ElementType GetType() const;
+  
+    private:
+      PredicatePtr myPredicate;
+    };
+    typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
+    
+  
+    /*
+      Class       : LogicalBinary
+      Description : Base class for binary logical predicate
+    */
+    class LogicalBinary: public virtual Predicate{
+    public:
+      LogicalBinary();
+      virtual ~LogicalBinary();
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetPredicate1(PredicatePtr thePred);
+      virtual void SetPredicate2(PredicatePtr thePred);
+      virtual SMDSAbs_ElementType GetType() const;
+  
+    protected:
+      PredicatePtr myPredicate1;
+      PredicatePtr myPredicate2;
+    };
+    typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
+  
+  
+    /*
+      Class       : LogicalAND
+      Description : Logical AND
+    */
+    class LogicalAND: public virtual LogicalBinary{
+    public:
+      virtual bool IsSatisfy( long theElementId );
+    };
+  
+  
+    /*
+      Class       : LogicalOR
+      Description : Logical OR
+    */
+    class LogicalOR: public virtual LogicalBinary{
+    public:
+      virtual bool IsSatisfy( long theElementId );
+    };
+  
+  
+    /*
+      Class       : ManifoldPart
+      Description : Predicate for manifold part of mesh
+    */
+    class ManifoldPart: public virtual Predicate{
+    public:
+
+      /* internal class for algorithm uses */
+      class Link
+      {
+      public:
+        Link( SMDS_MeshNode* theNode1,
+              SMDS_MeshNode* theNode2 );
+        ~Link();
+        
+        bool IsEqual( const ManifoldPart::Link& theLink ) const;
+        bool operator<(const ManifoldPart::Link& x) const;
+        
+        SMDS_MeshNode* myNode1;
+        SMDS_MeshNode* myNode2;
+      };
+
+      bool IsEqual( const ManifoldPart::Link& theLink1,
+                    const ManifoldPart::Link& theLink2 );
+      
+      typedef std::set<ManifoldPart::Link>                TMapOfLink;
+      typedef std::vector<SMDS_MeshFace*>                 TVectorOfFacePtr;
+      typedef std::vector<ManifoldPart::Link>             TVectorOfLink;
+      typedef std::map<SMDS_MeshFace*,int>                TDataMapFacePtrInt;
+      typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
+      
+      ManifoldPart();
+      ~ManifoldPart();
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      // inoke when all parameters already set
+      virtual bool IsSatisfy( long theElementId );
+      virtual      SMDSAbs_ElementType GetType() const;
+
+      void    SetAngleTolerance( const double theAngToler );
+      double  GetAngleTolerance() const;
+      void    SetIsOnlyManifold( const bool theIsOnly );
+      void    SetStartElem( const long  theStartElemId );
+
+    private:
+      bool    process();
+      bool    findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
+                             SMDS_MeshFace*            theStartFace,
+                             TMapOfLink&               theNonManifold,
+                             TColStd_MapOfInteger&     theResFaces );
+      bool    isInPlane( const SMDS_MeshFace* theFace1,
+                          const SMDS_MeshFace* theFace2 );
+      void    expandBoundary( TMapOfLink&            theMapOfBoundary,
+                              TVectorOfLink&         theSeqOfBoundary,
+                              TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
+                              TMapOfLink&            theNonManifold,
+                              SMDS_MeshFace*         theNextFace ) const;
+
+     void     getFacesByLink( const Link& theLink,
+                              TVectorOfFacePtr& theFaces ) const;
+
+    private:
+      SMDS_Mesh*            myMesh;
+      TColStd_MapOfInteger  myMapIds;
+      TColStd_MapOfInteger  myMapBadGeomIds;
+      TVectorOfFacePtr      myAllFacePtr;
+      TDataMapFacePtrInt    myAllFacePtrIntDMap;
+      double                myAngToler;
+      bool                  myIsOnlyManifold;
+      long                  myStartElemId;
+
+    };
+    typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
+                         
+
+    /*
+      Class       : ElementsOnSurface
+      Description : Predicate elements that lying on indicated surface
+                    (plane or cylinder)
+    */
+    class ElementsOnSurface : public virtual Predicate {
+    public:
+      ElementsOnSurface();
+      ~ElementsOnSurface();
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual bool IsSatisfy( long theElementId );
+      virtual      SMDSAbs_ElementType GetType() const;
+
+      void    SetTolerance( const double theToler );
+      double  GetTolerance() const;
+      void    SetSurface( const TopoDS_Shape& theShape,
+                          const SMDSAbs_ElementType theType );
+
+    private:
+      void    process();
+      void    process( const SMDS_MeshElement* theElem  );
+      bool    isOnSurface( const SMDS_MeshNode* theNode ) const;
+
+    private:
+      SMDS_Mesh*            myMesh;
+      TColStd_MapOfInteger  myIds;
+      SMDSAbs_ElementType   myType;
+      Handle(Geom_Surface)  mySurf;
+      double                myToler;
+    };
+    
+    typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
+      
+
+    /*
+      FILTER
+    */
+    class Filter{
+    public:
+      Filter();
+      virtual ~Filter();
+      virtual void SetPredicate(PredicatePtr thePred);
+      typedef std::vector<long> TIdSequence;
+      virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
+  
+    protected:
+      PredicatePtr myPredicate;
+    };
+  };  
+};
+
+
+#endif
index a5d1daf6119c5e5abe0649eec1bfb266a873b18e..23fcb3ae7944f90ae178bc494e34275dd73f7b0e 100644 (file)
@@ -49,9 +49,9 @@ LIB_CLIENT_IDL =
 LIB_SERVER_IDL =
 
 # additionnal information to compil and link file
 LIB_SERVER_IDL =
 
 # additionnal information to compil and link file
-CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
+CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(OCC_INCLUDES) $(BOOST_CPPFLAGS)
 CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
 CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS  += -lMeshDriver
+LDFLAGS  += -lMeshDriver $(OCC_KERNEL_LIBS)
 
 LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace
 
 
 LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace
 
index f40810c948fbbf35d8e9904e5c36c1ab42f11cae..778c282a57572d59dbaeb1ed438f3cdcb0a631cb 100644 (file)
@@ -26,6 +26,8 @@
 //  $Header$
 
 #include "DriverMED_Family.h"
 //  $Header$
 
 #include "DriverMED_Family.h"
+#include "MED_Factory.hxx"
+
 #include <sstream>     
 
 using namespace std;
 #include <sstream>     
 
 using namespace std;
@@ -204,8 +206,9 @@ list<DriverMED_FamilyPtr> DriverMED_Family::MakeFamilies
  *  Create TFamilyInfo for this family
  */
 //=============================================================================
  *  Create TFamilyInfo for this family
  */
 //=============================================================================
-MEDA::PFamilyInfo DriverMED_Family::GetFamilyInfo
-                  (const MEDA::PMeshInfo& theMeshInfo) const
+MED::PFamilyInfo 
+DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper, 
+                               const MED::PMeshInfo& theMeshInfo) const
 {
   string aValue;
   ostringstream aStr;
 {
   string aValue;
   ostringstream aStr;
@@ -215,11 +218,13 @@ MEDA::PFamilyInfo DriverMED_Family::GetFamilyInfo
   MED::TIntVector anAttrIds (1, myId);        // Id=0,
   MED::TIntVector anAttrVals (1, myId);       // Value=0
 
   MED::TIntVector anAttrIds (1, myId);        // Id=0,
   MED::TIntVector anAttrVals (1, myId);       // Value=0
 
-  MEDA::PFamilyInfo anInfo = MEDA::TWrapper::CrFamilyInfo(theMeshInfo,
-                                                          aValue,
-                                                          myId,
-                                                          myGroupNames,
-                                                          anAttrDescs,anAttrIds,anAttrVals);
+  MED::PFamilyInfo anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
+                                                    aValue,
+                                                    myId,
+                                                    myGroupNames,
+                                                    anAttrDescs,
+                                                    anAttrIds,
+                                                    anAttrVals);
 
 //  cout << endl;
 //  cout << "Groups: ";
 
 //  cout << endl;
 //  cout << "Groups: ";
index b5fc51f2e36a5155f6b024f4b964537e45315afa..944b9bc828e4b0b81f60ef18c5f8e1ffb37dd60a 100644 (file)
@@ -31,7 +31,7 @@
 #include "SMDS_Mesh.hxx"
 #include "SMESHDS_GroupBase.hxx"
 #include "SMESHDS_SubMesh.hxx"
 #include "SMDS_Mesh.hxx"
 #include "SMESHDS_GroupBase.hxx"
 #include "SMESHDS_SubMesh.hxx"
-#include "MEDA_Wrapper.hxx"
+#include "MED_Common.hxx"
 
 #include <boost/shared_ptr.hpp>
 #include <set>
 
 #include <boost/shared_ptr.hpp>
 #include <set>
@@ -63,7 +63,8 @@ class DriverMED_Family
   // from <theGroups> and other sub-meshes from <theSubMeshes>.
   // Resulting families have no common elements.
 
   // from <theGroups> and other sub-meshes from <theSubMeshes>.
   // Resulting families have no common elements.
 
-  MEDA::PFamilyInfo GetFamilyInfo (const MEDA::PMeshInfo& theMeshInfo) const;
+  MED::PFamilyInfo GetFamilyInfo (const MED::PWrapper& theWrapper, 
+                                 const MED::PMeshInfo& theMeshInfo) const;
   // Create TFamilyInfo for this family
 
   const std::set<const SMDS_MeshElement *>& GetElements () const { return myElements; }
   // Create TFamilyInfo for this family
 
   const std::set<const SMDS_MeshElement *>& GetElements () const { return myElements; }
index 513454316ef57da8f9328384f0d6a4469eae7aad..25e517cf44d0da1b53a5d92e550b3ec1bb8805ae 100644 (file)
 
 #include "SMESHDS_Group.hxx"
 
 
 #include "SMESHDS_Group.hxx"
 
-#include "MEDA_Wrapper.hxx"
+#include "MED_Factory.hxx"
 #include "MED_Utilities.hxx"
 
 #include <stdlib.h>
 
 #define _EDF_NODE_IDS_
 
 #include "MED_Utilities.hxx"
 
 #include <stdlib.h>
 
 #define _EDF_NODE_IDS_
 
+using namespace MED;
+
 void DriverMED_R_SMESHDS_Mesh::SetMeshName(string theMeshName)
 {
   myMeshName = theMeshName;
 }
 
 static const SMDS_MeshNode* 
 void DriverMED_R_SMESHDS_Mesh::SetMeshName(string theMeshName)
 {
   myMeshName = theMeshName;
 }
 
 static const SMDS_MeshNode* 
-FindNode(const SMDS_Mesh* theMesh, med_int theId){
+FindNode(const SMDS_Mesh* theMesh, TInt theId){
   const SMDS_MeshNode* aNode = theMesh->FindNode(theId);
   if(aNode) return aNode;
   EXCEPTION(runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
   const SMDS_MeshNode* aNode = theMesh->FindNode(theId);
   if(aNode) return aNode;
   EXCEPTION(runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
@@ -54,15 +56,15 @@ FindNode(const SMDS_Mesh* theMesh, med_int theId){
 
 
 enum ECoordName{eX, eY, eZ, eNone};
 
 
 enum ECoordName{eX, eY, eZ, eNone};
-typedef med_float (*TGetCoord)(MEDA::PNodeInfo&, med_int);
+typedef TFloat (*TGetCoord)(MED::PNodeInfo&, TInt);
 
 template<ECoordName TheCoordId>
 
 template<ECoordName TheCoordId>
-med_float GetCoord(MEDA::PNodeInfo& thePNodeInfo, med_int theElemId){
+TFloat GetCoord(MED::PNodeInfo& thePNodeInfo, TInt theElemId){
   return thePNodeInfo->GetNodeCoord(theElemId,TheCoordId);
 }
 
 template<>
   return thePNodeInfo->GetNodeCoord(theElemId,TheCoordId);
 }
 
 template<>
-med_float GetCoord<eNone>(MEDA::PNodeInfo& thePNodeInfo, med_int theElemId){
+TFloat GetCoord<eNone>(MED::PNodeInfo& thePNodeInfo, TInt theElemId){
   return 0.0;
 }
 
   return 0.0;
 }
 
@@ -113,16 +115,16 @@ static TGetCoord aZGetCoord[3] = {
 
 
 class TCoordHelper{
 
 
 class TCoordHelper{
-  MEDA::PNodeInfo myPNodeInfo;
+  MED::PNodeInfo myPNodeInfo;
   TGetCoord* myGetCoord;
 public:
   TGetCoord* myGetCoord;
 public:
-  TCoordHelper(const MEDA::PNodeInfo& thePNodeInfo,
+  TCoordHelper(const MED::PNodeInfo& thePNodeInfo,
               TGetCoord* theGetCoord):
     myPNodeInfo(thePNodeInfo),
     myGetCoord(theGetCoord)
   {}
   virtual ~TCoordHelper(){}
               TGetCoord* theGetCoord):
     myPNodeInfo(thePNodeInfo),
     myGetCoord(theGetCoord)
   {}
   virtual ~TCoordHelper(){}
-  med_float GetCoord(med_int theElemId, med_int theCoodId){
+  TFloat GetCoord(TInt theElemId, TInt theCoodId){
     return (*myGetCoord[theCoodId])(myPNodeInfo,theElemId);
   }
 };
     return (*myGetCoord[theCoodId])(myPNodeInfo,theElemId);
   }
 };
@@ -133,18 +135,16 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
 {
   Status aResult = DRS_FAIL;
   try{
 {
   Status aResult = DRS_FAIL;
   try{
-    using namespace MEDA;
-
     myFamilies.clear();
     MESSAGE("Perform - myFile : "<<myFile);
     myFamilies.clear();
     MESSAGE("Perform - myFile : "<<myFile);
-    TWrapper aMed(myFile);
+    PWrapper aMed = CrWrapper(myFile);
 
     aResult = DRS_EMPTY;
 
     aResult = DRS_EMPTY;
-    if(med_int aNbMeshes = aMed.GetNbMeshes()){
+    if(TInt aNbMeshes = aMed->GetNbMeshes()){
       for(int iMesh = 0; iMesh < aNbMeshes; iMesh++){
        // Reading the MED mesh
        //---------------------
       for(int iMesh = 0; iMesh < aNbMeshes; iMesh++){
        // Reading the MED mesh
        //---------------------
-       PMeshInfo aMeshInfo = aMed.GetMeshInfo(iMesh);
+       PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
         string aMeshName;
         if (myMeshId != -1) {
           ostringstream aMeshNameStr;
         string aMeshName;
         if (myMeshId != -1) {
           ostringstream aMeshNameStr;
@@ -156,22 +156,22 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
        MESSAGE("Perform - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
        if(aMeshName != aMeshInfo->GetName()) continue;
         aResult = DRS_OK;
        MESSAGE("Perform - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
        if(aMeshName != aMeshInfo->GetName()) continue;
         aResult = DRS_OK;
-       med_int aMeshDim = aMeshInfo->GetDim();
+       //TInt aMeshDim = aMeshInfo->GetDim();
        
         // Reading MED families to the temporary structure
        //------------------------------------------------
        
         // Reading MED families to the temporary structure
        //------------------------------------------------
-        med_int aNbFams = aMed.GetNbFamilies(aMeshInfo);
+        TInt aNbFams = aMed->GetNbFamilies(aMeshInfo);
         MESSAGE("Read " << aNbFams << " families");
         MESSAGE("Read " << aNbFams << " families");
-        for (med_int iFam = 0; iFam < aNbFams; iFam++) {
-          PFamilyInfo aFamilyInfo = aMed.GetFamilyInfo(aMeshInfo, iFam);
-          med_int aFamId = aFamilyInfo->GetId();
+        for (TInt iFam = 0; iFam < aNbFams; iFam++) {
+          PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo, iFam+1);
+          TInt aFamId = aFamilyInfo->GetId();
           MESSAGE("Family " << aFamId << " :");
 
             DriverMED_FamilyPtr aFamily (new DriverMED_Family);
 
           MESSAGE("Family " << aFamId << " :");
 
             DriverMED_FamilyPtr aFamily (new DriverMED_Family);
 
-            med_int aNbGrp = aFamilyInfo->GetNbGroup();
+            TInt aNbGrp = aFamilyInfo->GetNbGroup();
             MESSAGE("belong to " << aNbGrp << " groups");
             MESSAGE("belong to " << aNbGrp << " groups");
-            for (med_int iGr = 0; iGr < aNbGrp; iGr++) {
+            for (TInt iGr = 0; iGr < aNbGrp; iGr++) {
               string aGroupName = aFamilyInfo->GetGroupName(iGr);
               MESSAGE(aGroupName);
               aFamily->AddGroupName(aGroupName);
               string aGroupName = aFamilyInfo->GetGroupName(iGr);
               MESSAGE(aGroupName);
               aFamily->AddGroupName(aGroupName);
@@ -181,13 +181,13 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
 
         // Reading MED nodes to the corresponding SMDS structure
        //------------------------------------------------------
 
         // Reading MED nodes to the corresponding SMDS structure
        //------------------------------------------------------
-       PNodeInfo aNodeInfo = aMed.GetNodeInfo(aMeshInfo);
+       PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
 
        TCoordHelperPtr aCoordHelperPtr;
        {
 
        TCoordHelperPtr aCoordHelperPtr;
        {
-         med_int aMeshDimension = aMeshInfo->GetDim();
+         TInt aMeshDimension = aMeshInfo->GetDim();
          bool anIsDimPresent[3] = {false, false, false};
          bool anIsDimPresent[3] = {false, false, false};
-          for(med_int iDim = 0; iDim < aMeshDimension; iDim++){
+          for(TInt iDim = 0; iDim < aMeshDimension; iDim++){
            string aDimName = aNodeInfo->GetCoordName(iDim);
            if(aDimName == "x" || aDimName == "X")
              anIsDimPresent[eX] = true;
            string aDimName = aNodeInfo->GetCoordName(iDim);
            if(aDimName == "x" || aDimName == "X")
              anIsDimPresent[eX] = true;
@@ -219,12 +219,12 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
          }
        }
 
          }
        }
 
-       med_booleen anIsNodeNum = aNodeInfo->IsElemNum();
-       med_int aNbElems = aNodeInfo->GetNbElem();
+       EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
+       TInt aNbElems = aNodeInfo->GetNbElem();
        MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum);
        MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum);
-        for(med_int iElem = 0; iElem < aNbElems; iElem++){
+        for(TInt iElem = 0; iElem < aNbElems; iElem++){
           double aCoords[3] = {0.0, 0.0, 0.0};
           double aCoords[3] = {0.0, 0.0, 0.0};
-          for(med_int iDim = 0; iDim < 3; iDim++)
+          for(TInt iDim = 0; iDim < 3; iDim++)
             aCoords[iDim] = aCoordHelperPtr->GetCoord(iElem,iDim);
           const SMDS_MeshNode* aNode;
           if(anIsNodeNum) {
             aCoords[iDim] = aCoordHelperPtr->GetCoord(iElem,iDim);
           const SMDS_MeshNode* aNode;
           if(anIsNodeNum) {
@@ -237,7 +237,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
           //cout<<aNode->GetID()<<": "<<aNode->X()<<", "<<aNode->Y()<<", "<<aNode->Z()<<endl;
 
           // Save reference to this node from its family
           //cout<<aNode->GetID()<<": "<<aNode->X()<<", "<<aNode->Y()<<", "<<aNode->Z()<<endl;
 
           // Save reference to this node from its family
-          med_int aFamNum = aNodeInfo->GetFamNum(iElem);
+          TInt aFamNum = aNodeInfo->GetFamNum(iElem);
           if (myFamilies.find(aFamNum) != myFamilies.end())
           {
             myFamilies[aFamNum]->AddElement(aNode);
           if (myFamilies.find(aFamNum) != myFamilies.end())
           {
             myFamilies[aFamNum]->AddElement(aNode);
@@ -248,58 +248,58 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
        // Reading pre information about all MED cells
        //--------------------------------------------
         bool takeNumbers = true;  // initially we trust the numbers from file
        // Reading pre information about all MED cells
        //--------------------------------------------
         bool takeNumbers = true;  // initially we trust the numbers from file
-       MED::TEntityInfo aEntityInfo = aMed.GetEntityInfo(aMeshInfo);
+       MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
        MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
        for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
        MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
        for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
-         const med_entite_maillage& anEntity = anEntityIter->first;
-         if(anEntity == MED_NOEUD) continue;
+         const EEntiteMaillage& anEntity = anEntityIter->first;
+         if(anEntity == eNOEUD) continue;
          // Reading MED cells to the corresponding SMDS structure
          //------------------------------------------------------
          const MED::TGeom& aTGeom = anEntityIter->second;
          MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
          for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
          // Reading MED cells to the corresponding SMDS structure
          //------------------------------------------------------
          const MED::TGeom& aTGeom = anEntityIter->second;
          MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
          for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
-           const med_geometrie_element& aGeom = anTGeomIter->first;
-           if(aGeom == MED_POINT1) continue;
-           PCellInfo aCellInfo = aMed.GetCellInfo(aMeshInfo,anEntity,aGeom);
-           med_booleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : MED_FAUX;
-           med_int aNbElems = aCellInfo->GetNbElem();
+           const EGeometrieElement& aGeom = anTGeomIter->first;
+           if(aGeom == ePOINT1) continue;
+           PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
+           EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX;
+           TInt aNbElems = aCellInfo->GetNbElem();
            MESSAGE("Perform - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum);
            MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems);
 
            for(int iElem = 0; iElem < aNbElems; iElem++){
            MESSAGE("Perform - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum);
            MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems);
 
            for(int iElem = 0; iElem < aNbElems; iElem++){
-             med_int aNbNodes = -1;
+             TInt aNbNodes = -1;
              switch(aGeom){
              switch(aGeom){
-             case MED_SEG2:
-             case MED_SEG3:
+             case eSEG2:
+             case eSEG3:
                aNbNodes = 2;
                break;
                aNbNodes = 2;
                break;
-             case MED_TRIA3:
-             case MED_TRIA6:
+             case eTRIA3:
+             case eTRIA6:
                aNbNodes = 3;
                break;
                break;
                aNbNodes = 3;
                break;
                break;
-             case MED_QUAD4:
-             case MED_QUAD8:
+             case eQUAD4:
+             case eQUAD8:
                aNbNodes = 4;
                 break;
                aNbNodes = 4;
                 break;
-              case MED_TETRA4:
-             case MED_TETRA10:
+              case eTETRA4:
+             case eTETRA10:
                aNbNodes = 4;
                break;
                aNbNodes = 4;
                break;
-             case MED_PYRA5:
-             case MED_PYRA13:
+             case ePYRA5:
+             case ePYRA13:
                aNbNodes = 5;
                break;
                aNbNodes = 5;
                break;
-             case MED_PENTA6:
-             case MED_PENTA15:
+             case ePENTA6:
+             case ePENTA15:
                aNbNodes = 6;
                break;
                aNbNodes = 6;
                break;
-             case MED_HEXA8:
-             case MED_HEXA20:
+             case eHEXA8:
+             case eHEXA20:
                aNbNodes = 8;
                break;
              }
                aNbNodes = 8;
                break;
              }
-             vector<med_int> aNodeIds(aNbNodes);
+             vector<TInt> aNodeIds(aNbNodes);
 #ifdef _EDF_NODE_IDS_
              if(anIsNodeNum) {
                for(int i = 0; i < aNbNodes; i++){
 #ifdef _EDF_NODE_IDS_
              if(anIsNodeNum) {
                for(int i = 0; i < aNbNodes; i++){
@@ -318,11 +318,11 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
 
              bool isRenum = false;
              SMDS_MeshElement* anElement = NULL;
 
              bool isRenum = false;
              SMDS_MeshElement* anElement = NULL;
-             med_int aFamNum = aCellInfo->GetFamNum(iElem);
+             TInt aFamNum = aCellInfo->GetFamNum(iElem);
              try{
                switch(aGeom){
              try{
                switch(aGeom){
-               case MED_SEG2:
-               case MED_SEG3:
+               case eSEG2:
+               case eSEG3:
                  if(anIsElemNum)
                    anElement = myMesh->AddEdgeWithID(aNodeIds[0],
                                                      aNodeIds[1],
                  if(anIsElemNum)
                    anElement = myMesh->AddEdgeWithID(aNodeIds[0],
                                                      aNodeIds[1],
@@ -333,8 +333,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
                    isRenum = anIsElemNum;
                  }
                  break;
                    isRenum = anIsElemNum;
                  }
                  break;
-               case MED_TRIA3:
-               case MED_TRIA6:
+               case eTRIA3:
+               case eTRIA6:
                  aNbNodes = 3;
                  if(anIsElemNum)
                    anElement = myMesh->AddFaceWithID(aNodeIds[0],
                  aNbNodes = 3;
                  if(anIsElemNum)
                    anElement = myMesh->AddFaceWithID(aNodeIds[0],
@@ -348,8 +348,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
                    isRenum = anIsElemNum;
                  }
                  break;
                    isRenum = anIsElemNum;
                  }
                  break;
-               case MED_QUAD4:
-               case MED_QUAD8:
+               case eQUAD4:
+               case eQUAD8:
                  aNbNodes = 4;
                  // There is some differnce between SMDS and MED
                  if(anIsElemNum)
                  aNbNodes = 4;
                  // There is some differnce between SMDS and MED
                  if(anIsElemNum)
@@ -366,8 +366,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
                    isRenum = anIsElemNum;
                  }
                  break;
                    isRenum = anIsElemNum;
                  }
                  break;
-               case MED_TETRA4:
-               case MED_TETRA10:
+               case eTETRA4:
+               case eTETRA10:
                  aNbNodes = 4;
                  if(anIsElemNum)
                    anElement = myMesh->AddVolumeWithID(aNodeIds[0],
                  aNbNodes = 4;
                  if(anIsElemNum)
                    anElement = myMesh->AddVolumeWithID(aNodeIds[0],
@@ -383,8 +383,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
                    isRenum = anIsElemNum;
                  }
                  break;
                    isRenum = anIsElemNum;
                  }
                  break;
-               case MED_PYRA5:
-               case MED_PYRA13:
+               case ePYRA5:
+               case ePYRA13:
                  aNbNodes = 5;
                  // There is some differnce between SMDS and MED
                  if(anIsElemNum)
                  aNbNodes = 5;
                  // There is some differnce between SMDS and MED
                  if(anIsElemNum)
@@ -403,8 +403,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
                    isRenum = anIsElemNum;
                  }
                  break;
                    isRenum = anIsElemNum;
                  }
                  break;
-               case MED_PENTA6:
-               case MED_PENTA15:
+               case ePENTA6:
+               case ePENTA15:
                  aNbNodes = 6;
                  if(anIsElemNum)
                    anElement = myMesh->AddVolumeWithID(aNodeIds[0],
                  aNbNodes = 6;
                  if(anIsElemNum)
                    anElement = myMesh->AddVolumeWithID(aNodeIds[0],
@@ -424,8 +424,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
                    isRenum = anIsElemNum;
                  }
                  break;
                    isRenum = anIsElemNum;
                  }
                  break;
-               case MED_HEXA8:
-               case MED_HEXA20:
+               case eHEXA8:
+               case eHEXA20:
                  aNbNodes = 8;
                  if(anIsElemNum)
                    anElement = myMesh->AddVolumeWithID(aNodeIds[0],
                  aNbNodes = 8;
                  if(anIsElemNum)
                    anElement = myMesh->AddVolumeWithID(aNodeIds[0],
@@ -463,7 +463,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
               }
               else {
                 if (isRenum) {
               }
               else {
                 if (isRenum) {
-                  anIsElemNum = MED_FAUX;
+                  anIsElemNum = eFAUX;
                   takeNumbers = false;
                   if (aResult < DRS_WARN_RENUMBER)
                     aResult = DRS_WARN_RENUMBER;
                   takeNumbers = false;
                   if (aResult < DRS_WARN_RENUMBER)
                     aResult = DRS_WARN_RENUMBER;
@@ -496,17 +496,15 @@ list<string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
   list<string> aMeshNames;
 
   try {
   list<string> aMeshNames;
 
   try {
-    using namespace MEDA;
-
     MESSAGE("GetMeshNames - myFile : " << myFile);
     theStatus = DRS_OK;
     MESSAGE("GetMeshNames - myFile : " << myFile);
     theStatus = DRS_OK;
-    TWrapper aMed (myFile);
+    PWrapper aMed = CrWrapper(myFile);
 
 
-    if (med_int aNbMeshes = aMed.GetNbMeshes()) {
+    if (TInt aNbMeshes = aMed->GetNbMeshes()) {
       for (int iMesh = 0; iMesh < aNbMeshes; iMesh++) {
        // Reading the MED mesh
        //---------------------
       for (int iMesh = 0; iMesh < aNbMeshes; iMesh++) {
        // Reading the MED mesh
        //---------------------
-       PMeshInfo aMeshInfo = aMed.GetMeshInfo(iMesh);
+       PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
        aMeshNames.push_back(aMeshInfo->GetName());
       }
     }
        aMeshNames.push_back(aMeshInfo->GetName());
       }
     }
index 6bdfc09becde59b240b3e24ad81bbd11d9c74e5e..cf7d9a8195e30a8be642c467c2a3e7d04d29e89e 100644 (file)
 #include "SMDS_MeshNode.hxx"
 #include "utilities.h"
 
 #include "SMDS_MeshNode.hxx"
 #include "utilities.h"
 
-#include "MEDA_Wrapper.hxx"
+#include "MED_Factory.hxx"
 #include "MED_Utilities.hxx"
 
 #define _EDF_NODE_IDS_
 //#define _ELEMENTS_BY_DIM_
 
 using namespace std;
 #include "MED_Utilities.hxx"
 
 #define _EDF_NODE_IDS_
 //#define _ELEMENTS_BY_DIM_
 
 using namespace std;
+using namespace MED;
+
 
 DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
   myAllSubMeshes (false),
 
 DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
   myAllSubMeshes (false),
@@ -51,6 +53,17 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
   myDoGroupOfVolumes (false)
 {}
 
   myDoGroupOfVolumes (false)
 {}
 
+void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName, MED::EVersion theId)
+{
+  myMed = CrWrapper(theFileName,theId);
+  Driver_SMESHDS_Mesh::SetFile(theFileName);
+}
+
+void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName)
+{
+  return SetFile(theFileName,MED::eV2_1);
+}
+
 void DriverMED_W_SMESHDS_Mesh::SetMeshName(const std::string& theMeshName)
 {
   myMeshName = theMeshName;
 void DriverMED_W_SMESHDS_Mesh::SetMeshName(const std::string& theMeshName)
 {
   myMeshName = theMeshName;
@@ -91,95 +104,98 @@ void DriverMED_W_SMESHDS_Mesh::AddGroupOfVolumes()
   myDoGroupOfVolumes = true;
 }
 
   myDoGroupOfVolumes = true;
 }
 
-typedef double (SMDS_MeshNode::* TGetCoord)() const;
-typedef const char* TName;
-typedef const char* TUnit;
-
-static TUnit aUnit[3] = {"m","m","m"};
-
-static TGetCoord aXYZGetCoord[3] = {
-  &SMDS_MeshNode::X, 
-  &SMDS_MeshNode::Y, 
-  &SMDS_MeshNode::Z
-};
-static TName aXYZName[3] = {"x","y","z"};
-
-
-static TGetCoord aXYGetCoord[2] = {
-  &SMDS_MeshNode::X, 
-  &SMDS_MeshNode::Y
-};
-static TName aXYName[2] = {"x","y"};
-
-static TGetCoord aYZGetCoord[2] = {
-  &SMDS_MeshNode::Y, 
-  &SMDS_MeshNode::Z
-};
-static TName aYZName[2] = {"y","z"};
-
-static TGetCoord aXZGetCoord[2] = {
-  &SMDS_MeshNode::X, 
-  &SMDS_MeshNode::Z
-};
-static TName aXZName[2] = {"x","z"};
-
-
-static TGetCoord aXGetCoord[1] = {
-  &SMDS_MeshNode::X
-};
-static TName aXName[1] = {"x"};
-
-static TGetCoord aYGetCoord[1] = {
-  &SMDS_MeshNode::Y
-};
-static TName aYName[1] = {"y"};
-
-static TGetCoord aZGetCoord[1] = {
-  &SMDS_MeshNode::Z
-};
-static TName aZName[1] = {"z"};
-
-
-class TCoordHelper{
-  SMDS_NodeIteratorPtr myNodeIter;
-  const SMDS_MeshNode* myCurrentNode;
-  TGetCoord* myGetCoord;
-  TName* myName;
-  TUnit* myUnit;
-public:
-  TCoordHelper(const SMDS_NodeIteratorPtr& theNodeIter,
-              TGetCoord* theGetCoord,
-              TName* theName,
-              TUnit* theUnit = aUnit):
-    myNodeIter(theNodeIter),
-    myGetCoord(theGetCoord),
-    myName(theName),
-    myUnit(theUnit)
-  {}
-  virtual ~TCoordHelper(){}
-  bool Next(){ 
-    return myNodeIter->more() && 
-      (myCurrentNode = myNodeIter->next());
-  }
-  const SMDS_MeshNode* GetNode(){
-    return myCurrentNode;
-  }
-  MED::TIntVector::value_type GetID(){
-    return myCurrentNode->GetID();
-  }
-  MED::TFloatVector::value_type GetCoord(med_int theCoodId){
-    return (myCurrentNode->*myGetCoord[theCoodId])();
-  }
-  MED::TStringVector::value_type GetName(med_int theDimId){
-    return myName[theDimId];
-  }
-  MED::TStringVector::value_type GetUnit(med_int theDimId){
-    return myUnit[theDimId];
-  }
-};
-typedef boost::shared_ptr<TCoordHelper> TCoordHelperPtr;
-
+namespace{
+  typedef double (SMDS_MeshNode::* TGetCoord)() const;
+  typedef const char* TName;
+  typedef const char* TUnit;
+  
+  TUnit aUnit[3] = {"m","m","m"};
+
+  TGetCoord aXYZGetCoord[3] = {
+    &SMDS_MeshNode::X, 
+    &SMDS_MeshNode::Y, 
+    &SMDS_MeshNode::Z
+  };
+  TName aXYZName[3] = {"x","y","z"};
+  
+  
+  TGetCoord aXYGetCoord[2] = {
+    &SMDS_MeshNode::X, 
+    &SMDS_MeshNode::Y
+  };
+  TName aXYName[2] = {"x","y"};
+
+  TGetCoord aYZGetCoord[2] = {
+    &SMDS_MeshNode::Y, 
+    &SMDS_MeshNode::Z
+  };
+  TName aYZName[2] = {"y","z"};
+
+  TGetCoord aXZGetCoord[2] = {
+    &SMDS_MeshNode::X, 
+    &SMDS_MeshNode::Z
+  };
+  TName aXZName[2] = {"x","z"};
+
+
+  TGetCoord aXGetCoord[1] = {
+    &SMDS_MeshNode::X
+  };
+  TName aXName[1] = {"x"};
+
+  TGetCoord aYGetCoord[1] = {
+    &SMDS_MeshNode::Y
+  };
+  TName aYName[1] = {"y"};
+
+  TGetCoord aZGetCoord[1] = {
+    &SMDS_MeshNode::Z
+  };
+  TName aZName[1] = {"z"};
+
+
+  class TCoordHelper{
+    SMDS_NodeIteratorPtr myNodeIter;
+    const SMDS_MeshNode* myCurrentNode;
+    TGetCoord* myGetCoord;
+    TName* myName;
+    TUnit* myUnit;
+  public:
+    TCoordHelper(const SMDS_NodeIteratorPtr& theNodeIter,
+                TGetCoord* theGetCoord,
+                TName* theName,
+                TUnit* theUnit = aUnit):
+      myNodeIter(theNodeIter),
+      myGetCoord(theGetCoord),
+      myName(theName),
+      myUnit(theUnit)
+    {}
+    virtual ~TCoordHelper(){}
+    bool Next(){ 
+      return myNodeIter->more() && 
+       (myCurrentNode = myNodeIter->next());
+    }
+    const SMDS_MeshNode* GetNode(){
+      return myCurrentNode;
+    }
+    MED::TIntVector::value_type GetID(){
+      return myCurrentNode->GetID();
+    }
+    MED::TFloatVector::value_type GetCoord(TInt theCoodId){
+      return (myCurrentNode->*myGetCoord[theCoodId])();
+    }
+    MED::TStringVector::value_type GetName(TInt theDimId){
+      return myName[theDimId];
+    }
+    MED::TStringVector::value_type GetUnit(TInt theDimId){
+      return myUnit[theDimId];
+    }
+  };
+  typedef boost::shared_ptr<TCoordHelper> TCoordHelperPtr;
+  
+}
 
 
+  
 Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
 {
   Status aResult = DRS_OK;
 Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
 {
   Status aResult = DRS_OK;
@@ -188,11 +204,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     return DRS_FAIL;
   }
   try{
     return DRS_FAIL;
   }
   try{
-    using namespace MEDA;
-    using namespace boost;
-
     MESSAGE("Perform - myFile : "<<myFile);
     MESSAGE("Perform - myFile : "<<myFile);
-    TWrapper aMed(myFile);
 
     // Creating the MED mesh for corresponding SMDS structure
     //-------------------------------------------------------
 
     // Creating the MED mesh for corresponding SMDS structure
     //-------------------------------------------------------
@@ -206,7 +218,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     }
 
     // Mesh dimension definition
     }
 
     // Mesh dimension definition
-    med_int aMeshDimension;
+    TInt aMeshDimension;
     TCoordHelperPtr aCoordHelperPtr;
     {  
       bool anIsXDimension = false;
     TCoordHelperPtr aCoordHelperPtr;
     {  
       bool anIsXDimension = false;
@@ -237,7 +249,6 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
        anIsXDimension = (aBounds[1] - aBounds[0]) + abs(aBounds[1]) + abs(aBounds[0]) > EPS;
        anIsYDimension = (aBounds[3] - aBounds[2]) + abs(aBounds[3]) + abs(aBounds[2]) > EPS;
        anIsZDimension = (aBounds[5] - aBounds[4]) + abs(aBounds[5]) + abs(aBounds[4]) > EPS;
        anIsXDimension = (aBounds[1] - aBounds[0]) + abs(aBounds[1]) + abs(aBounds[0]) > EPS;
        anIsYDimension = (aBounds[3] - aBounds[2]) + abs(aBounds[3]) + abs(aBounds[2]) > EPS;
        anIsZDimension = (aBounds[5] - aBounds[4]) + abs(aBounds[5]) + abs(aBounds[4]) > EPS;
-
        aMeshDimension = anIsXDimension + anIsYDimension + anIsZDimension;
        if(!aMeshDimension)
          aMeshDimension = 3;
        aMeshDimension = anIsXDimension + anIsYDimension + anIsZDimension;
        if(!aMeshDimension)
          aMeshDimension = 3;
@@ -268,9 +279,9 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     }
 
     
     }
 
     
-    PMeshInfo aMeshInfo = TWrapper::CrMeshInfo(aMeshDimension,aMeshName);
+    PMeshInfo aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aMeshName);
     MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
     MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
-    aMed.SetMeshInfo(aMeshInfo);
+    myMed->SetMeshInfo(aMeshInfo);
 
     // Storing SMDS groups and sub-meshes
     //-----------------------------------
 
     // Storing SMDS groups and sub-meshes
     //-----------------------------------
@@ -303,8 +314,8 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
 
     for (; aFamsIter != aFamilies.end(); aFamsIter++)
     {
 
     for (; aFamsIter != aFamilies.end(); aFamsIter++)
     {
-      PFamilyInfo aFamilyInfo = (*aFamsIter)->GetFamilyInfo(aMeshInfo);
-      aMed.SetFamilyInfo(aFamilyInfo);
+      PFamilyInfo aFamilyInfo = (*aFamsIter)->GetFamilyInfo(myMed,aMeshInfo);
+      myMed->SetFamilyInfo(aFamilyInfo);
       int aFamId = (*aFamsIter)->GetId();
 
       const set<const SMDS_MeshElement *>& anElems = (*aFamsIter)->GetElements();
       int aFamId = (*aFamsIter)->GetId();
 
       const set<const SMDS_MeshElement *>& anElems = (*aFamsIter)->GetElements();
@@ -319,15 +330,15 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     // Storing SMDS nodes to the MED file for the MED mesh
     //----------------------------------------------------
 #ifdef _EDF_NODE_IDS_
     // Storing SMDS nodes to the MED file for the MED mesh
     //----------------------------------------------------
 #ifdef _EDF_NODE_IDS_
-    typedef map<med_int,med_int> TNodeIdMap;
+    typedef map<TInt,TInt> TNodeIdMap;
     TNodeIdMap aNodeIdMap;
 #endif
     TNodeIdMap aNodeIdMap;
 #endif
-    med_int aNbElems = myMesh->NbNodes();
+    TInt aNbElems = myMesh->NbNodes();
     MED::TIntVector anElemNums(aNbElems);
     MED::TIntVector aFamilyNums(aNbElems);
     MED::TFloatVector aCoordinates(aNbElems*aMeshDimension);
     MED::TIntVector anElemNums(aNbElems);
     MED::TIntVector aFamilyNums(aNbElems);
     MED::TFloatVector aCoordinates(aNbElems*aMeshDimension);
-    for(med_int iNode = 0, aStartId = 0; aCoordHelperPtr->Next(); iNode++, aStartId += aMeshDimension){
-      for(med_int iCoord = 0; iCoord < aMeshDimension; iCoord++){
+    for(TInt iNode = 0, aStartId = 0; aCoordHelperPtr->Next(); iNode++, aStartId += aMeshDimension){
+      for(TInt iCoord = 0; iCoord < aMeshDimension; iCoord++){
        aCoordinates[aStartId+iCoord] = aCoordHelperPtr->GetCoord(iCoord);
       }
       int aNodeID = aCoordHelperPtr->GetID();
        aCoordinates[aStartId+iCoord] = aCoordHelperPtr->GetCoord(iCoord);
       }
       int aNodeID = aCoordHelperPtr->GetID();
@@ -344,44 +355,44 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
 
     MED::TStringVector aCoordNames(aMeshDimension);
     MED::TStringVector aCoordUnits(aMeshDimension);
 
     MED::TStringVector aCoordNames(aMeshDimension);
     MED::TStringVector aCoordUnits(aMeshDimension);
-    for(med_int iCoord = 0; iCoord < aMeshDimension; iCoord++){
+    for(TInt iCoord = 0; iCoord < aMeshDimension; iCoord++){
       aCoordNames[iCoord] = aCoordHelperPtr->GetName(iCoord);
       aCoordUnits[iCoord] = aCoordHelperPtr->GetUnit(iCoord);
     }
 
       aCoordNames[iCoord] = aCoordHelperPtr->GetName(iCoord);
       aCoordUnits[iCoord] = aCoordHelperPtr->GetUnit(iCoord);
     }
 
-    const med_repere SMDS_COORDINATE_SYSTEM = MED_CART;
+    const ERepere SMDS_COORDINATE_SYSTEM = eCART;
 
 
-    PNodeInfo aNodeInfo = TWrapper::CrNodeInfo(aMeshInfo,
-                                              SMDS_COORDINATE_SYSTEM,
-                                              aCoordinates,
-                                              aCoordNames,
-                                              aCoordUnits,
-                                              aFamilyNums,
-                                              anElemNums);
+    PNodeInfo aNodeInfo = myMed->CrNodeInfo(aMeshInfo,
+                                           SMDS_COORDINATE_SYSTEM,
+                                           aCoordinates,
+                                           aCoordNames,
+                                           aCoordUnits,
+                                           aFamilyNums,
+                                           anElemNums);
     MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems);
     MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems);
-    aMed.SetNodeInfo(aNodeInfo);
+    myMed->SetNodeInfo(aNodeInfo);
 
 
     // Storing others SMDS elements to the MED file for the MED mesh
     //--------------------------------------------------------------
 
 
     // Storing others SMDS elements to the MED file for the MED mesh
     //--------------------------------------------------------------
-    med_entite_maillage SMDS_MED_ENTITY = MED_MAILLE;
-    const med_connectivite SMDS_MED_CONNECTIVITY = MED_NOD;
+    EEntiteMaillage SMDS_MED_ENTITY = eMAILLE;
+    const EConnectivite SMDS_MED_CONNECTIVITY = eNOD;
 
     // Storing SMDS Edges
 
     // Storing SMDS Edges
-    if(med_int aNbElems = myMesh->NbEdges()){
+    if(TInt aNbElems = myMesh->NbEdges()){
 #ifdef _ELEMENTS_BY_DIM_
 #ifdef _ELEMENTS_BY_DIM_
-      SMDS_MED_ENTITY = MED_ARETE;
+      SMDS_MED_ENTITY = eARETE;
 #endif
       SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
 #endif
       SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
-      med_int aNbConnectivity = MED::GetNbConn(SMDS_MED_ENTITY,MED_SEG2,aMeshDimension);
+      TInt aNbConnectivity = MED::GetNbConn(SMDS_MED_ENTITY,eSEG2,aMeshDimension);
       MED::TIntVector anElemNums(aNbElems);
       MED::TIntVector aFamilyNums(aNbElems);
       MED::TIntVector aConnectivity(aNbElems*aNbConnectivity);
 
       MED::TIntVector anElemNums(aNbElems);
       MED::TIntVector aFamilyNums(aNbElems);
       MED::TIntVector aConnectivity(aNbElems*aNbConnectivity);
 
-      for(med_int iElem = 0, iConn = 0; anIter->more(); iElem++, iConn+=aNbConnectivity){
+      for(TInt iElem = 0, iConn = 0; anIter->more(); iElem++, iConn+=aNbConnectivity){
        const SMDS_MeshEdge* anElem = anIter->next();
        SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
        const SMDS_MeshEdge* anElem = anIter->next();
        SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
-       for(med_int iNode = 0; iNode < aNbConnectivity && aNodesIter->more(); iNode++){
+       for(TInt iNode = 0; iNode < aNbConnectivity && aNodesIter->more(); iNode++){
          const SMDS_MeshElement* aNode = aNodesIter->next();
 #ifdef _EDF_NODE_IDS_
          aConnectivity[iConn+iNode] = aNodeIdMap[aNode->GetID()];
          const SMDS_MeshElement* aNode = aNodesIter->next();
 #ifdef _EDF_NODE_IDS_
          aConnectivity[iConn+iNode] = aNodeIdMap[aNode->GetID()];
@@ -397,23 +408,23 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
           aFamilyNums[iElem] = myEdgesDefaultFamilyId;
       }
       
           aFamilyNums[iElem] = myEdgesDefaultFamilyId;
       }
       
-      PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
-                                                SMDS_MED_ENTITY,
-                                                MED_SEG2,
-                                                SMDS_MED_CONNECTIVITY,
-                                                aConnectivity,
-                                                aFamilyNums,
-                                                anElemNums);
-      aMed.SetCellInfo(aCellInfo);
+      PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+                                             SMDS_MED_ENTITY,
+                                             eSEG2,
+                                             SMDS_MED_CONNECTIVITY,
+                                             aConnectivity,
+                                             aFamilyNums,
+                                             anElemNums);
+      myMed->SetCellInfo(aCellInfo);
     }
 
     // Storing SMDS Faces
     }
 
     // Storing SMDS Faces
-    if(med_int aNbElems = myMesh->NbFaces()){
+    if(TInt aNbElems = myMesh->NbFaces()){
       SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
 #ifdef _ELEMENTS_BY_DIM_
       SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
 #ifdef _ELEMENTS_BY_DIM_
-      SMDS_MED_ENTITY = MED_FACE;
+      SMDS_MED_ENTITY = eFACE;
 #endif
 #endif
-      med_int aNbTriaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_TRIA3,aMeshDimension);
+      TInt aNbTriaConn = MED::GetNbConn(SMDS_MED_ENTITY,eTRIA3,aMeshDimension);
       MED::TIntVector anTriaElemNums; 
       anTriaElemNums.reserve(aNbElems);
       MED::TIntVector aTriaFamilyNums;
       MED::TIntVector anTriaElemNums; 
       anTriaElemNums.reserve(aNbElems);
       MED::TIntVector aTriaFamilyNums;
@@ -421,7 +432,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       MED::TIntVector aTriaConn;
       aTriaConn.reserve(aNbElems*aNbTriaConn);
 
       MED::TIntVector aTriaConn;
       aTriaConn.reserve(aNbElems*aNbTriaConn);
 
-      med_int aNbQuadConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_QUAD4,aMeshDimension);
+      TInt aNbQuadConn = MED::GetNbConn(SMDS_MED_ENTITY,eQUAD4,aMeshDimension);
       MED::TIntVector aQuadElemNums;
       aQuadElemNums.reserve(aNbElems);
       MED::TIntVector aQuadFamilyNums;
       MED::TIntVector aQuadElemNums;
       aQuadElemNums.reserve(aNbElems);
       MED::TIntVector aQuadFamilyNums;
@@ -429,11 +440,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       MED::TIntVector aQuadConn;
       aQuadConn.reserve(aNbElems*aNbQuadConn);
 
       MED::TIntVector aQuadConn;
       aQuadConn.reserve(aNbElems*aNbQuadConn);
 
-      for(med_int iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
+      for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
        const SMDS_MeshFace* anElem = anIter->next();
        const SMDS_MeshFace* anElem = anIter->next();
-       med_int aNbNodes = anElem->NbNodes();
+       TInt aNbNodes = anElem->NbNodes();
        SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
        SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
-       med_int aNbConnectivity;
+       TInt aNbConnectivity;
        MED::TIntVector* anElemNums;
         MED::TIntVector* aFamilyNums;
        MED::TIntVector* aConnectivity;
        MED::TIntVector* anElemNums;
         MED::TIntVector* aFamilyNums;
        MED::TIntVector* aConnectivity;
@@ -452,12 +463,12 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
          break;
        }
        MED::TIntVector aVector(aNbNodes);
          break;
        }
        MED::TIntVector aVector(aNbNodes);
-       for(med_int iNode = 0; aNodesIter->more(); iNode++){
+       for(TInt iNode = 0; aNodesIter->more(); iNode++){
          const SMDS_MeshElement* aNode = aNodesIter->next();
          aVector[iNode] = aNode->GetID();
        }
 
          const SMDS_MeshElement* aNode = aNodesIter->next();
          aVector[iNode] = aNode->GetID();
        }
 
-       med_int aSize = aConnectivity->size();
+       TInt aSize = aConnectivity->size();
        aConnectivity->resize(aSize+aNbConnectivity);
        // There is some differnce between SMDS and MED in cells mapping
 #ifdef _EDF_NODE_IDS_
        aConnectivity->resize(aSize+aNbConnectivity);
        // There is some differnce between SMDS and MED in cells mapping
 #ifdef _EDF_NODE_IDS_
@@ -468,7 +479,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
          (*aConnectivity)[aSize+2] = aNodeIdMap[aVector[3]];  
          (*aConnectivity)[aSize+3] = aNodeIdMap[aVector[2]];  
        default:
          (*aConnectivity)[aSize+2] = aNodeIdMap[aVector[3]];  
          (*aConnectivity)[aSize+3] = aNodeIdMap[aVector[2]];  
        default:
-         for(med_int iNode = 0; iNode < aNbNodes; iNode++) 
+         for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
            (*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
        }
 #else
            (*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
        }
 #else
@@ -479,7 +490,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
          (*aConnectivity)[aSize+2] = aVector[3];  
          (*aConnectivity)[aSize+3] = aVector[2];  
        default:
          (*aConnectivity)[aSize+2] = aVector[3];  
          (*aConnectivity)[aSize+3] = aVector[2];  
        default:
-         for(med_int iNode = 0; iNode < aNbNodes; iNode++) 
+         for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
            (*aConnectivity)[aSize+iNode] = aVector[iNode];
        }
 #endif
            (*aConnectivity)[aSize+iNode] = aVector[iNode];
        }
 #endif
@@ -490,37 +501,37 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
         else
           aFamilyNums->push_back(myFacesDefaultFamilyId);
       }
         else
           aFamilyNums->push_back(myFacesDefaultFamilyId);
       }
-      if(med_int aNbElems = anTriaElemNums.size()){
-       PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
-                                                  SMDS_MED_ENTITY,
-                                                  MED_TRIA3,
-                                                  SMDS_MED_CONNECTIVITY,
-                                                  aTriaConn,
-                                                  aTriaFamilyNums,
-                                                  anTriaElemNums);
-       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_TRIA3<<"; aNbElems = "<<aNbElems);
-       aMed.SetCellInfo(aCellInfo);
+      if(TInt aNbElems = anTriaElemNums.size()){
+       PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+                                               SMDS_MED_ENTITY,
+                                               eTRIA3,
+                                               SMDS_MED_CONNECTIVITY,
+                                               aTriaConn,
+                                               aTriaFamilyNums,
+                                               anTriaElemNums);
+       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eTRIA3<<"; aNbElems = "<<aNbElems);
+       myMed->SetCellInfo(aCellInfo);
       }
       }
-      if(med_int aNbElems = aQuadElemNums.size()){
-       PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
-                                                  SMDS_MED_ENTITY,
-                                                  MED_QUAD4,
-                                                  SMDS_MED_CONNECTIVITY,
-                                                  aQuadConn,
-                                                  aQuadFamilyNums,
-                                                  aQuadElemNums);
-       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_QUAD4<<"; aNbElems = "<<aNbElems);
-       aMed.SetCellInfo(aCellInfo);
+      if(TInt aNbElems = aQuadElemNums.size()){
+       PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+                                               SMDS_MED_ENTITY,
+                                               eQUAD4,
+                                               SMDS_MED_CONNECTIVITY,
+                                               aQuadConn,
+                                               aQuadFamilyNums,
+                                               aQuadElemNums);
+       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eQUAD4<<"; aNbElems = "<<aNbElems);
+       myMed->SetCellInfo(aCellInfo);
       }
     }
 
     // Storing SMDS Volumes
       }
     }
 
     // Storing SMDS Volumes
-    if(med_int aNbElems = myMesh->NbVolumes()){
+    if(TInt aNbElems = myMesh->NbVolumes()){
       SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
 #ifdef _ELEMENTS_BY_DIM_
       SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
 #ifdef _ELEMENTS_BY_DIM_
-      SMDS_MED_ENTITY = MED_MAILLE;
+      SMDS_MED_ENTITY = eMAILLE;
 #endif
 #endif
-      med_int aNbTetraConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_TETRA4,aMeshDimension);
+      TInt aNbTetraConn = MED::GetNbConn(SMDS_MED_ENTITY,eTETRA4,aMeshDimension);
       MED::TIntVector anTetraElemNums; 
       anTetraElemNums.reserve(aNbElems);
       MED::TIntVector aTetraFamilyNums;
       MED::TIntVector anTetraElemNums; 
       anTetraElemNums.reserve(aNbElems);
       MED::TIntVector aTetraFamilyNums;
@@ -528,7 +539,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       MED::TIntVector aTetraConn;
       aTetraConn.reserve(aNbElems*aNbTetraConn);
 
       MED::TIntVector aTetraConn;
       aTetraConn.reserve(aNbElems*aNbTetraConn);
 
-      med_int aNbPyraConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_PYRA5,aMeshDimension);
+      TInt aNbPyraConn = MED::GetNbConn(SMDS_MED_ENTITY,ePYRA5,aMeshDimension);
       MED::TIntVector anPyraElemNums; 
       anPyraElemNums.reserve(aNbElems);
       MED::TIntVector aPyraFamilyNums;
       MED::TIntVector anPyraElemNums; 
       anPyraElemNums.reserve(aNbElems);
       MED::TIntVector aPyraFamilyNums;
@@ -536,7 +547,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       MED::TIntVector aPyraConn;
       aPyraConn.reserve(aNbElems*aNbPyraConn);
 
       MED::TIntVector aPyraConn;
       aPyraConn.reserve(aNbElems*aNbPyraConn);
 
-      med_int aNbPentaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_PENTA6,aMeshDimension);
+      TInt aNbPentaConn = MED::GetNbConn(SMDS_MED_ENTITY,ePENTA6,aMeshDimension);
       MED::TIntVector anPentaElemNums; 
       anPentaElemNums.reserve(aNbElems);
       MED::TIntVector aPentaFamilyNums;
       MED::TIntVector anPentaElemNums; 
       anPentaElemNums.reserve(aNbElems);
       MED::TIntVector aPentaFamilyNums;
@@ -544,7 +555,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       MED::TIntVector aPentaConn;
       aPentaConn.reserve(aNbElems*aNbPentaConn);
 
       MED::TIntVector aPentaConn;
       aPentaConn.reserve(aNbElems*aNbPentaConn);
 
-      med_int aNbHexaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_HEXA8,aMeshDimension);
+      TInt aNbHexaConn = MED::GetNbConn(SMDS_MED_ENTITY,eHEXA8,aMeshDimension);
       MED::TIntVector aHexaElemNums;
       aHexaElemNums.reserve(aNbElems);
       MED::TIntVector aHexaFamilyNums;
       MED::TIntVector aHexaElemNums;
       aHexaElemNums.reserve(aNbElems);
       MED::TIntVector aHexaFamilyNums;
@@ -552,11 +563,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       MED::TIntVector aHexaConn;
       aHexaConn.reserve(aNbElems*aNbHexaConn);
 
       MED::TIntVector aHexaConn;
       aHexaConn.reserve(aNbElems*aNbHexaConn);
 
-      for(med_int iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
+      for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
        const SMDS_MeshVolume* anElem = anIter->next();
        const SMDS_MeshVolume* anElem = anIter->next();
-       med_int aNbNodes = anElem->NbNodes();
+       TInt aNbNodes = anElem->NbNodes();
        SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
        SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
-       med_int aNbConnectivity;
+       TInt aNbConnectivity;
        MED::TIntVector* anElemNums;
        MED::TIntVector* aFamilyNums;
        MED::TIntVector* aConnectivity;
        MED::TIntVector* anElemNums;
        MED::TIntVector* aFamilyNums;
        MED::TIntVector* aConnectivity;
@@ -587,11 +598,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
        }
 
        MED::TIntVector aVector(aNbNodes);
        }
 
        MED::TIntVector aVector(aNbNodes);
-       for(med_int iNode = 0; aNodesIter->more(); iNode++){
+       for(TInt iNode = 0; aNodesIter->more(); iNode++){
          const SMDS_MeshElement* aNode = aNodesIter->next();
          aVector[iNode] = aNode->GetID();
        }
          const SMDS_MeshElement* aNode = aNodesIter->next();
          aVector[iNode] = aNode->GetID();
        }
-       med_int aSize = aConnectivity->size();
+       TInt aSize = aConnectivity->size();
        aConnectivity->resize(aSize+aNbConnectivity);
        // There is some difference between SMDS and MED in cells mapping
 #ifdef _EDF_NODE_IDS_
        aConnectivity->resize(aSize+aNbConnectivity);
        // There is some difference between SMDS and MED in cells mapping
 #ifdef _EDF_NODE_IDS_
@@ -603,7 +614,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
          (*aConnectivity)[aSize+3] = aNodeIdMap[aVector[1]];  
          (*aConnectivity)[aSize+4] = aNodeIdMap[aVector[4]];  
        default:
          (*aConnectivity)[aSize+3] = aNodeIdMap[aVector[1]];  
          (*aConnectivity)[aSize+4] = aNodeIdMap[aVector[4]];  
        default:
-         for(med_int iNode = 0; iNode < aNbNodes; iNode++) 
+         for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
            (*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
        }
 #else
            (*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
        }
 #else
@@ -615,7 +626,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
          (*aConnectivity)[aSize+3] = aVector[1];  
          (*aConnectivity)[aSize+4] = aVector[4];  
        default:
          (*aConnectivity)[aSize+3] = aVector[1];  
          (*aConnectivity)[aSize+4] = aVector[4];  
        default:
-         for(med_int iNode = 0; iNode < aNbNodes; iNode++) 
+         for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
            (*aConnectivity)[aSize+iNode] = aVector[iNode];
        }
 #endif
            (*aConnectivity)[aSize+iNode] = aVector[iNode];
        }
 #endif
@@ -627,49 +638,49 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
           aFamilyNums->push_back(myVolumesDefaultFamilyId);
       }
 
           aFamilyNums->push_back(myVolumesDefaultFamilyId);
       }
 
-      if(med_int aNbElems = anTetraElemNums.size()){
-       PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
-                                                  SMDS_MED_ENTITY,
-                                                  MED_TETRA4,
-                                                  SMDS_MED_CONNECTIVITY,
-                                                  aTetraConn,
-                                                  aTetraFamilyNums,
-                                                  anTetraElemNums);
-       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_TETRA4<<"; aNbElems = "<<aNbElems);
-       aMed.SetCellInfo(aCellInfo);
+      if(TInt aNbElems = anTetraElemNums.size()){
+       PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+                                               SMDS_MED_ENTITY,
+                                               eTETRA4,
+                                               SMDS_MED_CONNECTIVITY,
+                                               aTetraConn,
+                                               aTetraFamilyNums,
+                                               anTetraElemNums);
+       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eTETRA4<<"; aNbElems = "<<aNbElems);
+       myMed->SetCellInfo(aCellInfo);
       }
       }
-      if(med_int aNbElems = anPyraElemNums.size()){
-       PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
-                                                  SMDS_MED_ENTITY,
-                                                  MED_PYRA5,
-                                                  SMDS_MED_CONNECTIVITY,
-                                                  aPyraConn,
-                                                  aPyraFamilyNums,
-                                                  anPyraElemNums);
-       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_PYRA5<<"; aNbElems = "<<aNbElems);
-       aMed.SetCellInfo(aCellInfo);
+      if(TInt aNbElems = anPyraElemNums.size()){
+       PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+                                               SMDS_MED_ENTITY,
+                                               ePYRA5,
+                                               SMDS_MED_CONNECTIVITY,
+                                               aPyraConn,
+                                               aPyraFamilyNums,
+                                               anPyraElemNums);
+       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePYRA5<<"; aNbElems = "<<aNbElems);
+       myMed->SetCellInfo(aCellInfo);
       }
       }
-      if(med_int aNbElems = anPentaElemNums.size()){
-       PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
-                                                  SMDS_MED_ENTITY,
-                                                  MED_PENTA6,
-                                                  SMDS_MED_CONNECTIVITY,
-                                                  aPentaConn,
-                                                  aPentaFamilyNums,
-                                                  anPentaElemNums);
-       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_PENTA6<<"; aNbElems = "<<aNbElems);
-       aMed.SetCellInfo(aCellInfo);
+      if(TInt aNbElems = anPentaElemNums.size()){
+       PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+                                               SMDS_MED_ENTITY,
+                                               ePENTA6,
+                                               SMDS_MED_CONNECTIVITY,
+                                               aPentaConn,
+                                               aPentaFamilyNums,
+                                               anPentaElemNums);
+       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePENTA6<<"; aNbElems = "<<aNbElems);
+       myMed->SetCellInfo(aCellInfo);
       }
       }
-      if(med_int aNbElems = aHexaElemNums.size()){
-       PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
-                                                  SMDS_MED_ENTITY,
-                                                  MED_HEXA8,
-                                                  SMDS_MED_CONNECTIVITY,
-                                                  aHexaConn,
-                                                  aHexaFamilyNums,
-                                                  aHexaElemNums);
-       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_HEXA8<<"; aNbElems = "<<aNbElems);
-       aMed.SetCellInfo(aCellInfo);
+      if(TInt aNbElems = aHexaElemNums.size()){
+       PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+                                               SMDS_MED_ENTITY,
+                                               eHEXA8,
+                                               SMDS_MED_CONNECTIVITY,
+                                               aHexaConn,
+                                               aHexaFamilyNums,
+                                               aHexaElemNums);
+       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eHEXA8<<"; aNbElems = "<<aNbElems);
+       myMed->SetCellInfo(aCellInfo);
       }
     }
   }catch(const std::exception& exc){
       }
     }
   }catch(const std::exception& exc){
index 08c0ef3841dd79f8fb8819297cbd51c31a36a24c..1cc864944d9aa339aece4b8f77ac8ac931f9bd50 100644 (file)
@@ -28,6 +28,7 @@
 #define _INCLUDE_DRIVERMED_W_SMESHDS_MESH
 
 #include "Driver_SMESHDS_Mesh.h"
 #define _INCLUDE_DRIVERMED_W_SMESHDS_MESH
 
 #include "Driver_SMESHDS_Mesh.h"
+#include "MED_Factory.hxx"
 
 #include <string>
 #include <list>
 
 #include <string>
 #include <list>
@@ -43,6 +44,9 @@ class DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
 
   DriverMED_W_SMESHDS_Mesh();
 
 
   DriverMED_W_SMESHDS_Mesh();
 
+  virtual void SetFile(const std::string& theFileName);
+  void SetFile(const std::string& theFileName, MED::EVersion theId);
+
   /*! sets file name; only for usage with Add(), not Write()
    */
   void AddGroupOfNodes();
   /*! sets file name; only for usage with Add(), not Write()
    */
   void AddGroupOfNodes();
@@ -63,6 +67,7 @@ class DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
 
  private:
 
 
  private:
 
+  MED::PWrapper myMed;
   std::string myMeshName;
   std::list<SMESHDS_GroupBase*> myGroups;
   bool myAllSubMeshes;
   std::string myMeshName;
   std::list<SMESHDS_GroupBase*> myGroups;
   bool myAllSubMeshes;
index beca72c9274b4e118fbc84eae2acd3489e9a2993..19d97d9acdf3fa418da5a81d8eb109e0d143e3cd 100644 (file)
@@ -60,7 +60,7 @@ LIB_SERVER_IDL =
 
 # additionnal information to compil and link file
 CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
 
 # additionnal information to compil and link file
 CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
-CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
+CXXFLAGS += $(OCC_CXXFLAGS) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
 LDFLAGS  += -lMeshDriver -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper
 
 LDFLAGSFORBIN += -lMeshDriver -lSMDS -lSMESHDS -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper -lOpUtil -lSALOMELocalTrace
 LDFLAGS  += -lMeshDriver -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper
 
 LDFLAGSFORBIN += -lMeshDriver -lSMDS -lSMESHDS -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper -lOpUtil -lSALOMELocalTrace
index 8d6bac47e5d69a9c1603e3f9a2c7f495da7aeced..a0ab5b71430b6b6761cc23e93bb7f8485d9c9075 100644 (file)
@@ -61,9 +61,9 @@ LIB_CLIENT_IDL =
 LIB_SERVER_IDL =
 
 # additionnal information to compil and link file
 LIB_SERVER_IDL =
 
 # additionnal information to compil and link file
-CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
+CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(OCC_INCLUDES) $(BOOST_CPPFLAGS)
 CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
 CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS  += -lMeshDriver
+LDFLAGS  += -lMeshDriver $(OCC_KERNEL_LIBS)
 
 LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace
 
 
 LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace
 
index 46b6224af8520ab3eaaef61543288a2a7aadffc1..bc91acb4af0d4d32c5af5b6e338848adf173570f 100644 (file)
@@ -31,7 +31,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
 
 @COMMENCE@
 
 
 @COMMENCE@
 
-EXPORT_HEADERS = SMESH_Actor.h SMESH_Object.h SMESH_ActorUtils.h
+EXPORT_HEADERS = SMESH_Actor.h SMESH_Object.h SMESH_ObjectDef.h SMESH_ActorUtils.h
 
 
 # Libraries targets
 
 
 # Libraries targets
index 5d80d26fa2418db47018d602e5df36ef3354ffae..b3802aefbe1fbf558973965c8fca66bed0e5bb9e 100644 (file)
 //  $Header$
 
 
 //  $Header$
 
 
-#include "SMESH_Actor.h"
+#include "SMESH_ActorDef.h"
 #include "SMESH_ActorUtils.h"
 #include "SMESH_DeviceActor.h"
 #include "SMESH_ActorUtils.h"
 #include "SMESH_DeviceActor.h"
+#include "SMESH_ControlsDef.hxx"
 #include "SALOME_ExtractUnstructuredGrid.h"
 
 #include "QAD_Config.h"
 #include "SALOME_ExtractUnstructuredGrid.h"
 
 #include "QAD_Config.h"
-#include "utilities.h"
 #include <qstringlist.h>
 
 #include <vtkTimeStamp.h>
 #include <qstringlist.h>
 
 #include <vtkTimeStamp.h>
 #include <vtkPlane.h>
 #include <vtkImplicitBoolean.h>
 
 #include <vtkPlane.h>
 #include <vtkImplicitBoolean.h>
 
+#include "utilities.h"
+
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
 #else
 static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
 #endif
 
 static int aLineWidthInc = 2;
 static int aPointSizeInc = 2;
 
 
 #endif
 
 static int aLineWidthInc = 2;
 static int aPointSizeInc = 2;
 
 
-SMESH_Actor* SMESH_Actor::New(){
-  return new SMESH_Actor();
+SMESH_ActorDef* SMESH_ActorDef::New(){
+  return new SMESH_ActorDef();
 }
 
 
 }
 
 
@@ -91,7 +91,7 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
                              const char* theName,
                              int theIsClear)
 {
                              const char* theName,
                              int theIsClear)
 {
-  SMESH_Actor* anActor = SMESH_Actor::New();
+  SMESH_ActorDef* anActor = SMESH_ActorDef::New();
   if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
     anActor->Delete();
     anActor = NULL;
   if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
     anActor->Delete();
     anActor = NULL;
@@ -100,8 +100,8 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
 }
 
 
 }
 
 
-SMESH_Actor::SMESH_Actor(){
-  if(MYDEBUG) MESSAGE("SMESH_Actor");
+SMESH_ActorDef::SMESH_ActorDef(){
+  if(MYDEBUG) MESSAGE("SMESH_ActorDef");
 
   myTimeStamp = vtkTimeStamp::New();
 
 
   myTimeStamp = vtkTimeStamp::New();
 
@@ -284,8 +284,7 @@ SMESH_Actor::SMESH_Actor(){
   myName = "";
   myIO = NULL;
 
   myName = "";
   myIO = NULL;
 
-  myColorMode = eNone;
-  my1DColorMode = e1DNone;
+  myControlMode = eNone;
   myControlActor = my2DActor;
 
   //Definition of myScalarBarActor
   myControlActor = my2DActor;
 
   //Definition of myScalarBarActor
@@ -438,7 +437,9 @@ SMESH_Actor::SMESH_Actor(){
   aPtsTextProp->SetShadow(0);
   myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
   aPtsTextProp->Delete();
   aPtsTextProp->SetShadow(0);
   myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
   aPtsTextProp->Delete();
-    
+  
+  myEntityMode = eAllEntity;
+
   myIsPointsLabeled = false;
 
   myPointLabels = vtkActor2D::New();
   myIsPointsLabeled = false;
 
   myPointLabels = vtkActor2D::New();
@@ -491,8 +492,8 @@ SMESH_Actor::SMESH_Actor(){
 }
 
 
 }
 
 
-SMESH_Actor::~SMESH_Actor(){
-  if(MYDEBUG) MESSAGE("~SMESH_Actor");
+SMESH_ActorDef::~SMESH_ActorDef(){
+  if(MYDEBUG) MESSAGE("~SMESH_ActorDef");
 
   myScalarBarActor->Delete();
   myLookupTable->Delete();
 
   myScalarBarActor->Delete();
   myLookupTable->Delete();
@@ -562,7 +563,7 @@ SMESH_Actor::~SMESH_Actor(){
 }
 
 
 }
 
 
-void SMESH_Actor::SetPointsLabeled( bool theIsPointsLabeled )
+void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
 {
   vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
   myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
 {
   vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
   myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
@@ -597,7 +598,7 @@ void SMESH_Actor::SetPointsLabeled( bool theIsPointsLabeled )
 }
 
 
 }
 
 
-void SMESH_Actor::SetCellsLabeled(bool theIsCellsLabeled){
+void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled){
   vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
   myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
   if(myIsCellsLabeled){
   vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
   myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
   if(myIsCellsLabeled){
@@ -620,9 +621,8 @@ void SMESH_Actor::SetCellsLabeled(bool theIsCellsLabeled){
 }
 
 
 }
 
 
-void SMESH_Actor::SetControlMode(eControl theMode){
-  myColorMode = eNone;
-  my1DColorMode = e1DNone;
+void SMESH_ActorDef::SetControlMode(eControl theMode){
+  myControlMode = eNone;
 
   my1DActor->GetMapper()->SetScalarVisibility(false);
   my2DActor->GetMapper()->SetScalarVisibility(false);
 
   my1DActor->GetMapper()->SetScalarVisibility(false);
   my2DActor->GetMapper()->SetScalarVisibility(false);
@@ -634,7 +634,7 @@ void SMESH_Actor::SetControlMode(eControl theMode){
   if(anIsScalarVisible){
     SMESH::Controls::FunctorPtr aFunctor;
     switch(theMode){
   if(anIsScalarVisible){
     SMESH::Controls::FunctorPtr aFunctor;
     switch(theMode){
-    case eLengthEdges:
+    case eLength:
     {
       SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
       aControl->SetPrecision( myControlsPrecision );
     {
       SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
       aControl->SetPrecision( myControlsPrecision );
@@ -642,6 +642,12 @@ void SMESH_Actor::SetControlMode(eControl theMode){
       myControlActor = my1DActor;
       break;
     }
       myControlActor = my1DActor;
       break;
     }
+    case eLength2D:
+    {
+      aFunctor.reset(new SMESH::Controls::Length2D());
+      myControlActor = my2DActor;
+      break;
+    }
     case eFreeBorders:
       aFunctor.reset(new SMESH::Controls::FreeBorders());
       myControlActor = my1DActor;
     case eFreeBorders:
       aFunctor.reset(new SMESH::Controls::FreeBorders());
       myControlActor = my1DActor;
@@ -654,6 +660,10 @@ void SMESH_Actor::SetControlMode(eControl theMode){
       aFunctor.reset(new SMESH::Controls::MultiConnection());
       myControlActor = my1DActor;
       break;
       aFunctor.reset(new SMESH::Controls::MultiConnection());
       myControlActor = my1DActor;
       break;
+    case eMultiConnection2D:
+      aFunctor.reset(new SMESH::Controls::MultiConnection2D());
+      myControlActor = my2DActor;
+      break;
     case eArea:
     {
       SMESH::Controls::Area* aControl = new SMESH::Controls::Area();
     case eArea:
     {
       SMESH::Controls::Area* aControl = new SMESH::Controls::Area();
@@ -678,6 +688,14 @@ void SMESH_Actor::SetControlMode(eControl theMode){
       myControlActor = my2DActor;
       break;
     }
       myControlActor = my2DActor;
       break;
     }
+    case eAspectRatio3D:
+    {
+      SMESH::Controls::AspectRatio3D* aControl = new SMESH::Controls::AspectRatio3D();
+      aControl->SetPrecision( myControlsPrecision );
+      aFunctor.reset( aControl );
+      myControlActor = my3DActor;
+      break;
+    }
     case eMinimumAngle:
     {
       SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();
     case eMinimumAngle:
     {
       SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();
@@ -709,17 +727,36 @@ void SMESH_Actor::SetControlMode(eControl theMode){
     vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
     vtkIdType aNbCells = aGrid->GetNumberOfCells();
     if(aNbCells){
     vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
     vtkIdType aNbCells = aGrid->GetNumberOfCells();
     if(aNbCells){
-      myColorMode = theMode;
-      if(theMode == eFreeBorders || theMode == eFreeEdges){
-       my1DColorMode = e1DHighlited;
+      myControlMode = theMode;
+      switch(myControlMode){
+      case eFreeEdges:
+      case eFreeBorders:
        my1DExtActor->SetExtControlMode(aFunctor,myControlActor);
        my1DExtActor->SetExtControlMode(aFunctor,myControlActor);
-      }else{
-       if(myControlActor == my1DActor)
-         my1DColorMode = e1DColored;
+       break;
+      case eLength2D:
+       my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
+       break;
+      case eMultiConnection2D:
+       my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
+       break;
+      default:
        myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
       }
     }
        myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
       }
     }
+
+    if(QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true"){
+      if(myControlActor == my1DActor)
+       myEntityMode = eEdges;
+      else if(myControlActor == my2DActor)
+       myEntityMode = eFaces;
+      else if(myControlActor == my3DActor)
+       myEntityMode = eVolumes;
+    }
+
+  }else if(QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true"){
+    myEntityMode = eAllEntity;
   }
   }
+
   SetRepresentation(GetRepresentation());
 
   myTimeStamp->Modified();
   SetRepresentation(GetRepresentation());
 
   myTimeStamp->Modified();
@@ -727,7 +764,7 @@ void SMESH_Actor::SetControlMode(eControl theMode){
 }
 
 
 }
 
 
-void SMESH_Actor::AddToRender(vtkRenderer* theRenderer){
+void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
   SALOME_Actor::AddToRender(theRenderer);
 
   theRenderer->AddActor(myNodeActor);
   SALOME_Actor::AddToRender(theRenderer);
 
   theRenderer->AddActor(myNodeActor);
@@ -751,7 +788,7 @@ void SMESH_Actor::AddToRender(vtkRenderer* theRenderer){
   theRenderer->AddActor2D(myCellsLabels);
 }
 
   theRenderer->AddActor2D(myCellsLabels);
 }
 
-void SMESH_Actor::RemoveFromRender(vtkRenderer* theRenderer){
+void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
   SALOME_Actor::RemoveFromRender(theRenderer);
 
   theRenderer->RemoveActor(myNodeActor);
   SALOME_Actor::RemoveFromRender(theRenderer);
 
   theRenderer->RemoveActor(myNodeActor);
@@ -772,10 +809,10 @@ void SMESH_Actor::RemoveFromRender(vtkRenderer* theRenderer){
 }
 
 
 }
 
 
-bool SMESH_Actor::Init(TVisualObjPtr theVisualObj, 
-                      const char* theEntry, 
-                      const char* theName,
-                      int theIsClear)
+bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj, 
+                         const char* theEntry, 
+                         const char* theName,
+                         int theIsClear)
 {
   Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
   setIO(anIO);
 {
   Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
   setIO(anIO);
@@ -809,6 +846,8 @@ bool SMESH_Actor::Init(TVisualObjPtr theVisualObj,
   my3DActor->Init(myVisualObj,myImplicitBoolean);
   
   my1DActor->GetMapper()->SetLookupTable(myLookupTable);
   my3DActor->Init(myVisualObj,myImplicitBoolean);
   
   my1DActor->GetMapper()->SetLookupTable(myLookupTable);
+  my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
+
   my2DActor->GetMapper()->SetLookupTable(myLookupTable);
   my3DActor->GetMapper()->SetLookupTable(myLookupTable);
     
   my2DActor->GetMapper()->SetLookupTable(myLookupTable);
   my3DActor->GetMapper()->SetLookupTable(myLookupTable);
     
@@ -840,17 +879,17 @@ bool SMESH_Actor::Init(TVisualObjPtr theVisualObj,
 }
 
 
 }
 
 
-float* SMESH_Actor::GetBounds(){
+float* SMESH_ActorDef::GetBounds(){
   return myNodeActor->GetBounds();
 }
 
 
   return myNodeActor->GetBounds();
 }
 
 
-vtkDataSet* SMESH_Actor::GetInput(){
+vtkDataSet* SMESH_ActorDef::GetInput(){
   return GetUnstructuredGrid();
 }
 
 
   return GetUnstructuredGrid();
 }
 
 
-void SMESH_Actor::SetTransform(SALOME_Transform* theTransform){
+void SMESH_ActorDef::SetTransform(SALOME_Transform* theTransform){
   myNodeActor->SetTransform(theTransform);
   myBaseActor->SetTransform(theTransform);
 
   myNodeActor->SetTransform(theTransform);
   myBaseActor->SetTransform(theTransform);
 
@@ -867,27 +906,27 @@ void SMESH_Actor::SetTransform(SALOME_Transform* theTransform){
 }
 
 
 }
 
 
-void SMESH_Actor::SetMapper(vtkMapper* theMapper){
+void SMESH_ActorDef::SetMapper(vtkMapper* theMapper){
   vtkLODActor::SetMapper(theMapper);
 }
 
 
   vtkLODActor::SetMapper(theMapper);
 }
 
 
-void SMESH_Actor::ShallowCopy(vtkProp *prop){
+void SMESH_ActorDef::ShallowCopy(vtkProp *prop){
   SALOME_Actor::ShallowCopy(prop);
 }
 
 
   SALOME_Actor::ShallowCopy(prop);
 }
 
 
-vtkMapper* SMESH_Actor::GetMapper(){
+vtkMapper* SMESH_ActorDef::GetMapper(){
   return myPickableActor->GetMapper();
 }
 
 
   return myPickableActor->GetMapper();
 }
 
 
-vtkUnstructuredGrid* SMESH_Actor::GetUnstructuredGrid(){ 
+vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){ 
   return myVisualObj->GetUnstructuredGrid();
 }
 
 
   return myVisualObj->GetUnstructuredGrid();
 }
 
 
-bool SMESH_Actor::IsInfinitive(){
+bool SMESH_ActorDef::IsInfinitive(){
   vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
   aDataSet->Update();
   myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
   vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
   aDataSet->Update();
   myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
@@ -897,16 +936,16 @@ bool SMESH_Actor::IsInfinitive(){
 }
 
 
 }
 
 
-void SMESH_Actor::SetIsShrunkable(bool theShrunkable){
+void SMESH_ActorDef::SetIsShrunkable(bool theShrunkable){
   myIsShrinkable = theShrunkable;
   Modified();
 }
 
   myIsShrinkable = theShrunkable;
   Modified();
 }
 
-float SMESH_Actor::GetShrinkFactor(){
+float SMESH_ActorDef::GetShrinkFactor(){
   return myBaseActor->GetShrinkFactor();
 }
 
   return myBaseActor->GetShrinkFactor();
 }
 
-void SMESH_Actor::SetShrinkFactor(float theValue){
+void SMESH_ActorDef::SetShrinkFactor(float theValue){
   myBaseActor->SetShrinkFactor(theValue);
 
   my1DActor->SetShrinkFactor(theValue);
   myBaseActor->SetShrinkFactor(theValue);
 
   my1DActor->SetShrinkFactor(theValue);
@@ -918,7 +957,7 @@ void SMESH_Actor::SetShrinkFactor(float theValue){
   Modified();
 }
 
   Modified();
 }
 
-void SMESH_Actor::SetShrink(){
+void SMESH_ActorDef::SetShrink(){
   if(!myIsShrinkable) return;
 
   myBaseActor->SetShrink();
   if(!myIsShrinkable) return;
 
   myBaseActor->SetShrink();
@@ -933,7 +972,7 @@ void SMESH_Actor::SetShrink(){
   Modified();
 }
 
   Modified();
 }
 
-void SMESH_Actor::UnShrink(){
+void SMESH_ActorDef::UnShrink(){
   if(!myIsShrunk) return;
 
   myBaseActor->UnShrink();
   if(!myIsShrunk) return;
 
   myBaseActor->UnShrink();
@@ -949,74 +988,110 @@ void SMESH_Actor::UnShrink(){
 }
 
 
 }
 
 
-int SMESH_Actor::GetNodeObjId(int theVtkID){
+int SMESH_ActorDef::GetNodeObjId(int theVtkID){
   return myPickableActor->GetNodeObjId(theVtkID);
 }
 
   return myPickableActor->GetNodeObjId(theVtkID);
 }
 
-float* SMESH_Actor::GetNodeCoord(int theObjID){
+float* SMESH_ActorDef::GetNodeCoord(int theObjID){
   return myPickableActor->GetNodeCoord(theObjID);
 }
 
 
   return myPickableActor->GetNodeCoord(theObjID);
 }
 
 
-int SMESH_Actor::GetElemObjId(int theVtkID){
+int SMESH_ActorDef::GetElemObjId(int theVtkID){
   return myPickableActor->GetElemObjId(theVtkID);
 }
 
   return myPickableActor->GetElemObjId(theVtkID);
 }
 
-vtkCell* SMESH_Actor::GetElemCell(int theObjID){
+vtkCell* SMESH_ActorDef::GetElemCell(int theObjID){
   return myPickableActor->GetElemCell(theObjID);
 }
 
 
   return myPickableActor->GetElemCell(theObjID);
 }
 
 
-void SMESH_Actor::SetVisibility(int theMode){
+void SMESH_ActorDef::SetVisibility(int theMode){
   SetVisibility(theMode,true);
 }
 
 
   SetVisibility(theMode,true);
 }
 
 
-void SMESH_Actor::SetVisibility(int theMode, bool theIsUpdateRepersentation){
+void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
   SALOME_Actor::SetVisibility(theMode);
   SALOME_Actor::SetVisibility(theMode);
+
+  myNodeActor->VisibilityOff();
+  myBaseActor->VisibilityOff();
+  
+  my1DActor->VisibilityOff();
+  my1DExtActor->VisibilityOff();
+  
+  my2DActor->VisibilityOff();
+  my3DActor->VisibilityOff();
+  
+  myScalarBarActor->VisibilityOff();
+  myPointLabels->VisibilityOff();
+  myCellsLabels->VisibilityOff();
+  
   if(GetVisibility()){
     if(theIsUpdateRepersentation)
       SetRepresentation(GetRepresentation());
 
   if(GetVisibility()){
     if(theIsUpdateRepersentation)
       SetRepresentation(GetRepresentation());
 
-    if(myColorMode != eNone){
-      if(my1DColorMode == e1DHighlited)
+    if(myControlMode != eNone){
+      switch(myControlMode){
+      case eFreeEdges:
+      case eFreeBorders:
+       my1DExtActor->VisibilityOn();
+       break;
+      case eLength2D:
        my1DExtActor->VisibilityOn();
        my1DExtActor->VisibilityOn();
-      else if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
-       myScalarBarActor->VisibilityOn();
+      case eMultiConnection2D:
+       my1DExtActor->VisibilityOn();
+      default:
+       if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
+         myScalarBarActor->VisibilityOn();
+      }
     }
 
     if(myRepresentation != ePoint)
       myPickableActor->VisibilityOn();
 
     }
 
     if(myRepresentation != ePoint)
       myPickableActor->VisibilityOn();
 
-    my1DActor->VisibilityOn();
+    if(myEntityMode & eEdges)
+      my1DActor->VisibilityOn();
+    
+    if(myEntityMode & eFaces)
+      my2DActor->VisibilityOn();
+    
+    if(myEntityMode & eVolumes)
+      my3DActor->VisibilityOn();
+    
+    if(myIsPointsLabeled) 
+      myPointLabels->VisibilityOn();
 
 
-    my2DActor->VisibilityOn();
-    my3DActor->VisibilityOn();
+    if(myIsCellsLabeled) 
+      myCellsLabels->VisibilityOn();
+  }
 
 
-    if(myIsPointsLabeled) myPointLabels->VisibilityOn();
-    if(myIsCellsLabeled) myCellsLabels->VisibilityOn();
-  }else{
-    myNodeActor->VisibilityOff();
-    myBaseActor->VisibilityOff();
+  Modified();
+}
 
 
-    my1DActor->VisibilityOff();
-    my1DExtActor->VisibilityOff();
 
 
-    my2DActor->VisibilityOff();
-    my3DActor->VisibilityOff();
+void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
+  if(!myVisualObj->GetNbEntities(SMDSAbs_Edge))
+    theMode &= ~eEdges;
 
 
-    myScalarBarActor->VisibilityOff();
-    myPointLabels->VisibilityOff();
-    myCellsLabels->VisibilityOff();
-  }
-  Modified();
-}
+  if(!myVisualObj->GetNbEntities(SMDSAbs_Face))
+    theMode &= ~eFaces;
+
+  if(!myVisualObj->GetNbEntities(SMDSAbs_Volume))
+    theMode &= ~eVolumes;
 
 
+  if(!theMode)
+    return;
 
 
-void SMESH_Actor::SetRepresentation(int theMode){ 
-  int aNbEdges = myVisualObj->GetNbEntities(SMESH::EDGE);
-  int aNbFaces = myVisualObj->GetNbEntities(SMESH::FACE);
-  int aNbVolumes = myVisualObj->GetNbEntities(SMESH::VOLUME);
+  myEntityMode = theMode;
+
+  SetVisibility(GetVisibility(),false);
+}
+
+void SMESH_ActorDef::SetRepresentation(int theMode){ 
+  int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
+  int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
+  int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
   if(theMode < 0){
     myRepresentation = eSurface;
     if(!aNbFaces && !aNbVolumes && aNbEdges){
   if(theMode < 0){
     myRepresentation = eSurface;
     if(!aNbFaces && !aNbVolumes && aNbEdges){
@@ -1080,15 +1155,14 @@ void SMESH_Actor::SetRepresentation(int theMode){
   my3DActor->SetRepresentation(aReperesent);
 
   my1DExtActor->SetVisibility(false);
   my3DActor->SetRepresentation(aReperesent);
 
   my1DExtActor->SetVisibility(false);
-  switch(my1DColorMode){
-  case e1DColored: 
+
+  switch(myControlMode){
+  case eLength:
+  case eMultiConnection:
     aProp = aBackProp = my1DProp;
     if(myRepresentation != ePoint)
       aReperesent = SMESH_DeviceActor::eInsideframe;
     break;
     aProp = aBackProp = my1DProp;
     if(myRepresentation != ePoint)
       aReperesent = SMESH_DeviceActor::eInsideframe;
     break;
-  case e1DHighlited: 
-    my1DExtActor->SetVisibility(true);
-    break;
   }
   
   my1DActor->SetProperty(aProp);
   }
   
   my1DActor->SetProperty(aProp);
@@ -1111,17 +1185,17 @@ void SMESH_Actor::SetRepresentation(int theMode){
 }
 
 
 }
 
 
-void SMESH_Actor::SetPointRepresentation(bool theIsPointsVisible){
+void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){
   myIsPointsVisible = theIsPointsVisible;
   SetRepresentation(GetRepresentation());
 }
 
   myIsPointsVisible = theIsPointsVisible;
   SetRepresentation(GetRepresentation());
 }
 
-bool SMESH_Actor::GetPointRepresentation(){ 
+bool SMESH_ActorDef::GetPointRepresentation(){ 
   return myIsPointsVisible || myIsPointsLabeled;
 }
 
 
   return myIsPointsVisible || myIsPointsLabeled;
 }
 
 
-void SMESH_Actor::UpdateHighlight(){
+void SMESH_ActorDef::UpdateHighlight(){
   myHighlitableActor->SetVisibility(false);
   myHighlitableActor->SetHighlited(false);
 
   myHighlitableActor->SetVisibility(false);
   myHighlitableActor->SetHighlited(false);
 
@@ -1151,20 +1225,20 @@ void SMESH_Actor::UpdateHighlight(){
 }
 
 
 }
 
 
-void SMESH_Actor::highlight(bool theHighlight){
+void SMESH_ActorDef::highlight(bool theHighlight){
   myIsHighlighted = theHighlight;
   UpdateHighlight();
 }
 
 
   myIsHighlighted = theHighlight;
   UpdateHighlight();
 }
 
 
-void SMESH_Actor::SetPreSelected(bool thePreselect){ 
+void SMESH_ActorDef::SetPreSelected(bool thePreselect){ 
   myIsPreselected = thePreselect; 
   UpdateHighlight();
 }
 
 
 // From vtkFollower
   myIsPreselected = thePreselect; 
   UpdateHighlight();
 }
 
 
 // From vtkFollower
-int SMESH_Actor::RenderOpaqueGeometry(vtkViewport *vp)
+int SMESH_ActorDef::RenderOpaqueGeometry(vtkViewport *vp)
 {
   if (myPickableActor->GetIsOpaque())
     {
 {
   if (myPickableActor->GetIsOpaque())
     {
@@ -1176,7 +1250,7 @@ int SMESH_Actor::RenderOpaqueGeometry(vtkViewport *vp)
 }
 
 
 }
 
 
-int SMESH_Actor::RenderTranslucentGeometry(vtkViewport *vp)
+int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp)
 {
   if (!myPickableActor->GetIsOpaque())
     {
 {
   if (!myPickableActor->GetIsOpaque())
     {
@@ -1188,42 +1262,35 @@ int SMESH_Actor::RenderTranslucentGeometry(vtkViewport *vp)
 }
 
 
 }
 
 
-void SMESH_Actor::Render(vtkRenderer *ren){
-  unsigned long mTime = myTimeStamp->GetMTime();
+void SMESH_ActorDef::Render(vtkRenderer *ren){
+  unsigned long aTime = myTimeStamp->GetMTime();
   unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
   unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
-  if(anObjTime > mTime)
+  unsigned long aClippingTime = myImplicitBoolean->GetMTime();
+  if(anObjTime > aTime || aClippingTime > aTime)
     Update();
 }
 
 
     Update();
 }
 
 
-void SMESH_Actor::Update(){
-  SetVisibility(GetVisibility());
-  unsigned long int anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
-  unsigned long int aClippingTime = myImplicitBoolean->GetMTime();
-  unsigned long int aTime = myTimeStamp->GetMTime();
-  if(MYDEBUG) MESSAGE("SMESH_Actor::Update");
+void SMESH_ActorDef::Update(){
+  if(MYDEBUG) MESSAGE("SMESH_ActorDef::Update");
 
   if(GetControlMode() != eNone) {
 
   if(GetControlMode() != eNone) {
-    if(anObjTime > aTime || aClippingTime > aTime){
-      SetControlMode(GetControlMode());
-      SetVisibility(GetVisibility());
-    }
+    SetControlMode(GetControlMode());
   }
   if(myIsPointsLabeled){
   }
   if(myIsPointsLabeled){
-    if(anObjTime > aTime || aClippingTime > aTime)
-      SetPointsLabeled(myIsPointsLabeled);
+    SetPointsLabeled(myIsPointsLabeled);
   }
   if(myIsCellsLabeled){
   }
   if(myIsCellsLabeled){
-    if(anObjTime > aTime || aClippingTime > aTime)
-      SetCellsLabeled(myIsCellsLabeled);
+    SetCellsLabeled(myIsCellsLabeled);
   }
   }
-
+  SetVisibility(GetVisibility());
+  
   myTimeStamp->Modified();
   Modified();
 }
 
 
   myTimeStamp->Modified();
   Modified();
 }
 
 
-void SMESH_Actor::ReleaseGraphicsResources(vtkWindow *renWin){
+void SMESH_ActorDef::ReleaseGraphicsResources(vtkWindow *renWin){
   SALOME_Actor::ReleaseGraphicsResources(renWin);
 
   myPickableActor->ReleaseGraphicsResources(renWin);
   SALOME_Actor::ReleaseGraphicsResources(renWin);
 
   myPickableActor->ReleaseGraphicsResources(renWin);
@@ -1238,7 +1305,7 @@ static void GetColor(vtkProperty *theProperty, float& r,float& g,float& b){
 }
 
 
 }
 
 
-void SMESH_Actor::SetOpacity(float theValue){
+void SMESH_ActorDef::SetOpacity(float theValue){
   mySurfaceProp->SetOpacity(theValue);
   myBackSurfaceProp->SetOpacity(theValue);
   myEdgeProp->SetOpacity(theValue);
   mySurfaceProp->SetOpacity(theValue);
   myBackSurfaceProp->SetOpacity(theValue);
   myEdgeProp->SetOpacity(theValue);
@@ -1248,74 +1315,74 @@ void SMESH_Actor::SetOpacity(float theValue){
 }
 
 
 }
 
 
-float SMESH_Actor::GetOpacity(){
+float SMESH_ActorDef::GetOpacity(){
   return mySurfaceProp->GetOpacity();
 }
 
 
   return mySurfaceProp->GetOpacity();
 }
 
 
-void SMESH_Actor::SetSufaceColor(float r,float g,float b){
+void SMESH_ActorDef::SetSufaceColor(float r,float g,float b){
   mySurfaceProp->SetColor(r,g,b);
   Modified();
 }
 
   mySurfaceProp->SetColor(r,g,b);
   Modified();
 }
 
-void SMESH_Actor::GetSufaceColor(float& r,float& g,float& b){
+void SMESH_ActorDef::GetSufaceColor(float& r,float& g,float& b){
   ::GetColor(mySurfaceProp,r,g,b);
 }
 
   ::GetColor(mySurfaceProp,r,g,b);
 }
 
-void SMESH_Actor::SetBackSufaceColor(float r,float g,float b){
+void SMESH_ActorDef::SetBackSufaceColor(float r,float g,float b){
   myBackSurfaceProp->SetColor(r,g,b);
   Modified();
 }
 
   myBackSurfaceProp->SetColor(r,g,b);
   Modified();
 }
 
-void SMESH_Actor::GetBackSufaceColor(float& r,float& g,float& b){
+void SMESH_ActorDef::GetBackSufaceColor(float& r,float& g,float& b){
   ::GetColor(myBackSurfaceProp,r,g,b);
 }
 
   ::GetColor(myBackSurfaceProp,r,g,b);
 }
 
-void SMESH_Actor::SetEdgeColor(float r,float g,float b){
+void SMESH_ActorDef::SetEdgeColor(float r,float g,float b){
   myEdgeProp->SetColor(r,g,b);
   my1DProp->SetColor(r,g,b);
   my1DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
   Modified();
 }
 
   myEdgeProp->SetColor(r,g,b);
   my1DProp->SetColor(r,g,b);
   my1DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
   Modified();
 }
 
-void SMESH_Actor::GetEdgeColor(float& r,float& g,float& b){
+void SMESH_ActorDef::GetEdgeColor(float& r,float& g,float& b){
   ::GetColor(myEdgeProp,r,g,b);
 }
 
   ::GetColor(myEdgeProp,r,g,b);
 }
 
-void SMESH_Actor::SetNodeColor(float r,float g,float b){ 
+void SMESH_ActorDef::SetNodeColor(float r,float g,float b){ 
   myNodeProp->SetColor(r,g,b);
   Modified();
 }
 
   myNodeProp->SetColor(r,g,b);
   Modified();
 }
 
-void SMESH_Actor::GetNodeColor(float& r,float& g,float& b){ 
+void SMESH_ActorDef::GetNodeColor(float& r,float& g,float& b){ 
   ::GetColor(myNodeProp,r,g,b);
 }
 
   ::GetColor(myNodeProp,r,g,b);
 }
 
-void SMESH_Actor::SetHighlightColor(float r,float g,float b){ 
+void SMESH_ActorDef::SetHighlightColor(float r,float g,float b){ 
   myHighlightProp->SetColor(r,g,b);
   Modified();
 }
 
   myHighlightProp->SetColor(r,g,b);
   Modified();
 }
 
-void SMESH_Actor::GetHighlightColor(float& r,float& g,float& b){ 
+void SMESH_ActorDef::GetHighlightColor(float& r,float& g,float& b){ 
   ::GetColor(myHighlightProp,r,g,b);
 }
 
   ::GetColor(myHighlightProp,r,g,b);
 }
 
-void SMESH_Actor::SetPreHighlightColor(float r,float g,float b){ 
+void SMESH_ActorDef::SetPreHighlightColor(float r,float g,float b){ 
   myPreselectProp->SetColor(r,g,b);
   Modified();
 }
 
   myPreselectProp->SetColor(r,g,b);
   Modified();
 }
 
-void SMESH_Actor::GetPreHighlightColor(float& r,float& g,float& b){ 
+void SMESH_ActorDef::GetPreHighlightColor(float& r,float& g,float& b){ 
   ::GetColor(myPreselectProp,r,g,b);
 }
 
 
   ::GetColor(myPreselectProp,r,g,b);
 }
 
 
-float SMESH_Actor::GetLineWidth(){
+float SMESH_ActorDef::GetLineWidth(){
   return myEdgeProp->GetLineWidth();
 }
 
 
   return myEdgeProp->GetLineWidth();
 }
 
 
-void SMESH_Actor::SetLineWidth(float theVal){
+void SMESH_ActorDef::SetLineWidth(float theVal){
   myEdgeProp->SetLineWidth(theVal);
 
   my1DProp->SetLineWidth(theVal + aLineWidthInc);
   myEdgeProp->SetLineWidth(theVal);
 
   my1DProp->SetLineWidth(theVal + aLineWidthInc);
@@ -1325,7 +1392,7 @@ void SMESH_Actor::SetLineWidth(float theVal){
 }
 
 
 }
 
 
-void SMESH_Actor::SetNodeSize(float theVal){
+void SMESH_ActorDef::SetNodeSize(float theVal){
   myNodeProp->SetPointSize(theVal);
   myHighlightProp->SetPointSize(theVal);
   myPreselectProp->SetPointSize(theVal);
   myNodeProp->SetPointSize(theVal);
   myHighlightProp->SetPointSize(theVal);
   myPreselectProp->SetPointSize(theVal);
@@ -1336,17 +1403,17 @@ void SMESH_Actor::SetNodeSize(float theVal){
   Modified();
 }
 
   Modified();
 }
 
-float SMESH_Actor::GetNodeSize(){
+float SMESH_ActorDef::GetNodeSize(){
   return myNodeProp->GetPointSize();
 }
 
   return myNodeProp->GetPointSize();
 }
 
-int SMESH_Actor::GetObjDimension( const int theObjId )
+int SMESH_ActorDef::GetObjDimension( const int theObjId )
 {
   return myVisualObj->GetElemDimension( theObjId );
 }
 
 
 {
   return myVisualObj->GetElemDimension( theObjId );
 }
 
 
-vtkImplicitBoolean* SMESH_Actor::GetPlaneContainer(){
+vtkImplicitBoolean* SMESH_ActorDef::GetPlaneContainer(){
   return myImplicitBoolean;
 }
 
   return myImplicitBoolean;
 }
 
@@ -1418,17 +1485,16 @@ static void PositionToDistance(vtkDataSet* theDataSet,
 }
 
 
 }
 
 
-void SMESH_Actor::SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane)
+void SMESH_ActorDef::SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane)
 {
   thePlane->SetNormal(theDir);
   float anOrigin[3];
   ::DistanceToPosition(GetUnstructuredGrid(),theDir,theDist,anOrigin);
   thePlane->SetOrigin(anOrigin);
 {
   thePlane->SetNormal(theDir);
   float anOrigin[3];
   ::DistanceToPosition(GetUnstructuredGrid(),theDir,theDist,anOrigin);
   thePlane->SetOrigin(anOrigin);
-  Update();
 }
 
 
 }
 
 
-void SMESH_Actor::GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane)
+void SMESH_ActorDef::GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane)
 {
   thePlane->GetNormal(theDir);
 
 {
   thePlane->GetNormal(theDir);
 
index b2f68c394edc3eccbe2854d556ecf9e7faf946c0..ad041c275d339ef0fa794d1bcbb336bcfd6bb256 100644 (file)
 #include "SALOME_Actor.h"
 #include "SMESH_Object.h"
 
 #include "SALOME_Actor.h"
 #include "SMESH_Object.h"
 
-class vtkProperty;
-class vtkShrinkFilter;
-class vtkPolyDataMapper;
 class vtkUnstructuredGrid;
 class vtkUnstructuredGrid;
-class vtkMergeFilter;
-class vtkPolyData;
-
-class vtkMapper;
-class vtkActor2D;
-class vtkMaskPoints;
-class vtkCellCenters;
-class vtkLabeledDataMapper;
-class vtkSelectVisiblePoints;
 
 class vtkScalarBarActor;
 
 class vtkScalarBarActor;
-class vtkLookupTable;
 
 class vtkPlane;
 class vtkImplicitBoolean;
 
 
 class vtkPlane;
 class vtkImplicitBoolean;
 
-class vtkTimeStamp;
-
-class SMESH_DeviceActor;
-
-
-class SMESH_Actor : public SALOME_Actor{
-  friend class SMESH_VisualObj;
+class SMESH_Actor: public SALOME_Actor
+{
+  static SMESH_Actor* New() { return NULL;}
 
  public:
   vtkTypeMacro(SMESH_Actor,SALOME_Actor);
 
  public:
   vtkTypeMacro(SMESH_Actor,SALOME_Actor);
@@ -67,182 +50,66 @@ class SMESH_Actor : public SALOME_Actor{
                          const char* theName,
                          int theIsClear);
   
                          const char* theName,
                          int theIsClear);
   
-  virtual void ReleaseGraphicsResources(vtkWindow *renWin);
-  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
-  virtual int RenderTranslucentGeometry(vtkViewport *viewport);
-  virtual void Render(vtkRenderer *ren);
-
-  virtual void AddToRender(vtkRenderer* theRenderer); 
-  virtual void RemoveFromRender(vtkRenderer* theRenderer);
-
-  virtual bool hasHighlight() { return true; }  
-  virtual void highlight(bool theHighlight);  
-  virtual void SetPreSelected(bool thePreselect = false);
-
-  virtual bool IsInfinitive();  
-
-  virtual void SetOpacity(float theValue);
-  virtual float GetOpacity();
-
-  void SetSufaceColor(float r,float g,float b);
-  void GetSufaceColor(float& r,float& g,float& b);
-
-  void SetBackSufaceColor(float r,float g,float b);
-  void GetBackSufaceColor(float& r,float& g,float& b);
-
-  void SetEdgeColor(float r,float g,float b);
-  void GetEdgeColor(float& r,float& g,float& b);
+  virtual void SetSufaceColor(float r,float g,float b) = 0;
+  virtual void GetSufaceColor(float& r,float& g,float& b) = 0;
+  
+  virtual void SetBackSufaceColor(float r,float g,float b) = 0;
+  virtual void GetBackSufaceColor(float& r,float& g,float& b) = 0;
+  
+  virtual void SetEdgeColor(float r,float g,float b) = 0;
+  virtual void GetEdgeColor(float& r,float& g,float& b) = 0;
 
 
-  void SetNodeColor(float r,float g,float b);
-  void GetNodeColor(float& r,float& g,float& b);
+  virtual void SetNodeColor(float r,float g,float b) = 0;
+  virtual void GetNodeColor(float& r,float& g,float& b) = 0;
 
 
-  void SetHighlightColor(float r,float g,float b);
-  void GetHighlightColor(float& r,float& g,float& b);
+  virtual void SetHighlightColor(float r,float g,float b) = 0;
+  virtual void GetHighlightColor(float& r,float& g,float& b) = 0;
 
 
-  void SetPreHighlightColor(float r,float g,float b);
-  void GetPreHighlightColor(float& r,float& g,float& b);
+  virtual void SetPreHighlightColor(float r,float g,float b) = 0;
+  virtual void GetPreHighlightColor(float& r,float& g,float& b) = 0;
  
  
-  float GetLineWidth();
-  void SetLineWidth(float theVal);
-
-  void SetNodeSize(float size) ;
-  float GetNodeSize() ;
-
-  virtual int GetNodeObjId(int theVtkID);
-  virtual float* GetNodeCoord(int theObjID);
+  virtual float GetLineWidth() = 0;
+  virtual void SetLineWidth(float theVal) = 0;
 
 
-  virtual int GetElemObjId(int theVtkID);
-  virtual vtkCell* GetElemCell(int theObjID);
-
-  virtual int GetObjDimension( const int theObjId );
-
-  virtual void SetVisibility(int theMode);
-  void SetVisibility(int theMode, bool theIsUpdateRepersentation);
+  virtual void SetNodeSize(float size) = 0;
+  virtual float GetNodeSize() = 0;
 
   enum EReperesent { ePoint, eEdge, eSurface};
 
   enum EReperesent { ePoint, eEdge, eSurface};
-  virtual void SetRepresentation(int theMode);
-  void SetPointRepresentation(bool theIsPointsVisible);
-  bool GetPointRepresentation();
-
-  virtual float* GetBounds();
-  virtual void SetTransform(SALOME_Transform* theTransform); 
-
-  vtkUnstructuredGrid* GetUnstructuredGrid();
-  virtual vtkDataSet* GetInput();
-  virtual vtkMapper* GetMapper();
-
-  virtual float GetShrinkFactor();
-  virtual void  SetShrinkFactor(float value );
-
-  virtual bool IsShrunkable() { return myIsShrinkable;}
-  virtual bool IsShrunk() { return myIsShrunk;}
-  virtual void SetShrink(); 
-  virtual void UnShrink(); 
-
-  void SetPointsLabeled(bool theIsPointsLabeled);
-  bool GetPointsLabeled(){ return myIsPointsLabeled;}
-
-  void SetCellsLabeled(bool theIsCellsLabeled);
-  bool GetCellsLabeled(){ return myIsCellsLabeled;}
-
-  enum eControl{eNone, eLengthEdges, eFreeBorders, eFreeEdges, eMultiConnection, 
-               eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew};
-  void SetControlMode(eControl theMode);
-  eControl GetControlMode(){ return myColorMode;}
-
-  enum e1DControl{e1DNone, e1DColored, e1DHighlited};
-  e1DControl Get1DControlMode(){ return my1DColorMode;}
-
-  vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;}
-
-  void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
-  void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
-
-  vtkImplicitBoolean* GetPlaneContainer(); 
+  
+  enum EEntityMode { eEdges = 0x01, eFaces = 0x02, eVolumes = 0x04, eAllEntity = 0x07};
+  virtual void SetEntityMode(unsigned int theMode) = 0;
+  virtual unsigned int GetEntityMode() const = 0;
 
 
-  TVisualObjPtr GetObject() { return myVisualObj;}
+  virtual void SetPointRepresentation(bool theIsPointsVisible) = 0;
+  virtual bool GetPointRepresentation() = 0;
 
 
-  void SetControlsPrecision( const long p ) { myControlsPrecision = p; }
-  long GetControlsPrecision() const { return myControlsPrecision; }
+  virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
 
 
- protected:
-  TVisualObjPtr myVisualObj;
-  vtkTimeStamp* myTimeStamp;
+  virtual void SetShrinkFactor(float theValue) = 0;
 
 
-  vtkScalarBarActor* myScalarBarActor;
-  vtkLookupTable* myLookupTable;
+  virtual void SetPointsLabeled(bool theIsPointsLabeled) = 0;
+  virtual bool GetPointsLabeled() = 0;
 
 
-  vtkProperty* mySurfaceProp;
-  vtkProperty* myBackSurfaceProp;
-  vtkProperty* myEdgeProp;
-  vtkProperty* myNodeProp;
+  virtual void SetCellsLabeled(bool theIsCellsLabeled) = 0;
+  virtual bool GetCellsLabeled() = 0;
 
 
-  SMESH_DeviceActor* myBaseActor;
-  SMESH_DeviceActor* myNodeActor;
-  SMESH_DeviceActor* myPickableActor;
+  enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eMultiConnection, 
+               eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew,
+               eAspectRatio3D, eMultiConnection2D};
+  virtual void SetControlMode(eControl theMode) = 0;
+  virtual eControl GetControlMode() = 0;
 
 
-  vtkProperty* myHighlightProp;
-  vtkProperty* myPreselectProp;
-  SMESH_DeviceActor* myHighlitableActor;
-  SMESH_DeviceActor* myNodeHighlitableActor;
+  virtual vtkScalarBarActor* GetScalarBarActor() = 0;
 
 
-  eControl myColorMode;
-  SMESH_DeviceActor* my2DActor;
-  SMESH_DeviceActor* my3DActor;
-  SMESH_DeviceActor* myControlActor;
+  virtual void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane) = 0;
+  virtual void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane) = 0;
 
 
-  e1DControl my1DColorMode;
-  vtkProperty* my1DProp;
-  SMESH_DeviceActor* my1DActor;
-  vtkProperty* my1DExtProp;
-  SMESH_DeviceActor* my1DExtActor;
+  virtual vtkImplicitBoolean* GetPlaneContainer() = 0; 
 
 
-  bool myIsPointsVisible;
+  virtual TVisualObjPtr GetObject() = 0;
 
 
-  bool myIsShrinkable;
-  bool myIsShrunk;
-  
-  bool myIsPointsLabeled;
-  vtkUnstructuredGrid* myPointsNumDataSet;
-  vtkActor2D *myPointLabels;
-  vtkMaskPoints* myPtsMaskPoints;
-  vtkLabeledDataMapper* myPtsLabeledDataMapper;
-  vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
-
-  bool myIsCellsLabeled;
-  vtkUnstructuredGrid* myCellsNumDataSet;
-  vtkActor2D *myCellsLabels;
-  vtkMaskPoints* myClsMaskPoints;
-  vtkCellCenters* myCellCenters;
-  vtkLabeledDataMapper* myClsLabeledDataMapper;
-  vtkSelectVisiblePoints* myClsSelectVisiblePoints;
-
-  vtkImplicitBoolean* myImplicitBoolean;
-
-  long myControlsPrecision;
-
-  SMESH_Actor();
-  ~SMESH_Actor();
-
-  bool Init(TVisualObjPtr theVisualObj, 
-           const char* theEntry, 
-           const char* theName,
-           int theIsClear);
-
-  void SetIsShrunkable(bool theShrunkable);
-  void UpdateHighlight();
-  void Update();
-
- private:
-  // hide the two parameter Render() method from the user and the compiler.
-  virtual void Render(vtkRenderer *, vtkMapper *) {};
-  virtual void ShallowCopy(vtkProp *prop);
-  virtual void SetMapper(vtkMapper *);
-  static SMESH_Actor* New();
-
-  // Not implemented.
-  SMESH_Actor(const SMESH_Actor&);  
-  void operator=(const SMESH_Actor&);
+  virtual void SetControlsPrecision( const long ) = 0;
+  virtual long GetControlsPrecision() const = 0;
 };
 
 
 };
 
 
diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h
new file mode 100644 (file)
index 0000000..943fc5e
--- /dev/null
@@ -0,0 +1,244 @@
+//  SMESH OBJECT : interactive object for SMESH visualization
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESH_ActorDef.h
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+#ifndef SMESH_ACTORDEF_H
+#define SMESH_ACTORDEF_H
+
+#include "SMESH_Actor.h"
+#include "SMESH_Object.h"
+
+class vtkProperty;
+class vtkShrinkFilter;
+class vtkPolyDataMapper;
+class vtkUnstructuredGrid;
+class vtkMergeFilter;
+class vtkPolyData;
+
+class vtkMapper;
+class vtkActor2D;
+class vtkMaskPoints;
+class vtkCellCenters;
+class vtkLabeledDataMapper;
+class vtkSelectVisiblePoints;
+
+class vtkScalarBarActor;
+class vtkLookupTable;
+
+class vtkPlane;
+class vtkImplicitBoolean;
+
+class vtkTimeStamp;
+
+class SMESH_DeviceActor;
+
+
+class SMESH_ActorDef : public SMESH_Actor{
+  friend class SMESH_VisualObj;
+  friend class SMESH_Actor;
+
+ public:
+  vtkTypeMacro(SMESH_ActorDef,SMESH_Actor);
+  
+  virtual void ReleaseGraphicsResources(vtkWindow *renWin);
+  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
+  virtual int RenderTranslucentGeometry(vtkViewport *viewport);
+  virtual void Render(vtkRenderer *ren);
+
+  virtual void AddToRender(vtkRenderer* theRenderer); 
+  virtual void RemoveFromRender(vtkRenderer* theRenderer);
+
+  virtual bool hasHighlight() { return true; }  
+  virtual void highlight(bool theHighlight);  
+  virtual void SetPreSelected(bool thePreselect = false);
+
+  virtual bool IsInfinitive();  
+
+  virtual void SetOpacity(float theValue);
+  virtual float GetOpacity();
+
+  virtual void SetSufaceColor(float r,float g,float b);
+  virtual void GetSufaceColor(float& r,float& g,float& b);
+
+  virtual void SetBackSufaceColor(float r,float g,float b);
+  virtual void GetBackSufaceColor(float& r,float& g,float& b);
+
+  virtual void SetEdgeColor(float r,float g,float b);
+  virtual void GetEdgeColor(float& r,float& g,float& b);
+
+  virtual void SetNodeColor(float r,float g,float b);
+  virtual void GetNodeColor(float& r,float& g,float& b);
+
+  virtual void SetHighlightColor(float r,float g,float b);
+  virtual void GetHighlightColor(float& r,float& g,float& b);
+
+  virtual void SetPreHighlightColor(float r,float g,float b);
+  virtual void GetPreHighlightColor(float& r,float& g,float& b);
+  virtual float GetLineWidth();
+  virtual void SetLineWidth(float theVal);
+
+  virtual void SetNodeSize(float size) ;
+  virtual float GetNodeSize() ;
+
+  virtual int GetNodeObjId(int theVtkID);
+  virtual float* GetNodeCoord(int theObjID);
+
+  virtual int GetElemObjId(int theVtkID);
+  virtual vtkCell* GetElemCell(int theObjID);
+
+  virtual int GetObjDimension( const int theObjId );
+
+  virtual void SetVisibility(int theMode);
+  void SetVisibility(int theMode, bool theIsUpdateRepersentation);
+
+  virtual void SetRepresentation(int theMode);
+  
+  virtual unsigned int GetEntityMode() const { return myEntityMode;}
+  virtual void SetEntityMode(unsigned int theMode);
+
+  virtual void SetPointRepresentation(bool theIsPointsVisible);
+  virtual bool GetPointRepresentation();
+
+  virtual float* GetBounds();
+  virtual void SetTransform(SALOME_Transform* theTransform); 
+
+  virtual vtkUnstructuredGrid* GetUnstructuredGrid();
+  virtual vtkDataSet* GetInput();
+  virtual vtkMapper* GetMapper();
+
+  virtual float GetShrinkFactor();
+  virtual void SetShrinkFactor(float theValue);
+
+  virtual bool IsShrunkable() { return myIsShrinkable;}
+  virtual bool IsShrunk() { return myIsShrunk;}
+  virtual void SetShrink(); 
+  virtual void UnShrink(); 
+
+  virtual void SetPointsLabeled(bool theIsPointsLabeled);
+  virtual bool GetPointsLabeled(){ return myIsPointsLabeled;}
+
+  virtual void SetCellsLabeled(bool theIsCellsLabeled);
+  virtual bool GetCellsLabeled(){ return myIsCellsLabeled;}
+
+  virtual void SetControlMode(eControl theMode);
+  virtual eControl GetControlMode(){ return myControlMode;}
+
+  virtual vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;}
+
+  virtual void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
+  virtual void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
+
+  virtual vtkImplicitBoolean* GetPlaneContainer(); 
+
+  virtual TVisualObjPtr GetObject() { return myVisualObj;}
+
+  virtual void SetControlsPrecision( const long p ) { myControlsPrecision = p; }
+  virtual long GetControlsPrecision() const { return myControlsPrecision; }
+
+ protected:
+  TVisualObjPtr myVisualObj;
+  vtkTimeStamp* myTimeStamp;
+
+  vtkScalarBarActor* myScalarBarActor;
+  vtkLookupTable* myLookupTable;
+
+  vtkProperty* mySurfaceProp;
+  vtkProperty* myBackSurfaceProp;
+  vtkProperty* myEdgeProp;
+  vtkProperty* myNodeProp;
+
+  SMESH_DeviceActor* myBaseActor;
+  SMESH_DeviceActor* myNodeActor;
+  SMESH_DeviceActor* myPickableActor;
+
+  vtkProperty* myHighlightProp;
+  vtkProperty* myPreselectProp;
+  SMESH_DeviceActor* myHighlitableActor;
+  SMESH_DeviceActor* myNodeHighlitableActor;
+
+  eControl myControlMode;
+  SMESH_DeviceActor* my2DActor;
+  SMESH_DeviceActor* my3DActor;
+  SMESH_DeviceActor* myControlActor;
+
+  vtkProperty* my1DProp;
+  SMESH_DeviceActor* my1DActor;
+  vtkProperty* my1DExtProp;
+  SMESH_DeviceActor* my1DExtActor;
+
+  unsigned int myEntityMode;
+  bool myIsPointsVisible;
+
+  bool myIsShrinkable;
+  bool myIsShrunk;
+  
+  bool myIsPointsLabeled;
+  vtkUnstructuredGrid* myPointsNumDataSet;
+  vtkActor2D *myPointLabels;
+  vtkMaskPoints* myPtsMaskPoints;
+  vtkLabeledDataMapper* myPtsLabeledDataMapper;
+  vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
+
+  bool myIsCellsLabeled;
+  vtkUnstructuredGrid* myCellsNumDataSet;
+  vtkActor2D *myCellsLabels;
+  vtkMaskPoints* myClsMaskPoints;
+  vtkCellCenters* myCellCenters;
+  vtkLabeledDataMapper* myClsLabeledDataMapper;
+  vtkSelectVisiblePoints* myClsSelectVisiblePoints;
+
+  vtkImplicitBoolean* myImplicitBoolean;
+
+  long myControlsPrecision;
+
+  SMESH_ActorDef();
+  ~SMESH_ActorDef();
+
+  bool Init(TVisualObjPtr theVisualObj, 
+           const char* theEntry, 
+           const char* theName,
+           int theIsClear);
+
+  void SetIsShrunkable(bool theShrunkable);
+  void UpdateHighlight();
+  void Update();
+
+ private:
+  // hide the two parameter Render() method from the user and the compiler.
+  virtual void Render(vtkRenderer *, vtkMapper *) {};
+  virtual void ShallowCopy(vtkProp *prop);
+  virtual void SetMapper(vtkMapper *);
+  static SMESH_ActorDef* New();
+
+  // Not implemented.
+  SMESH_ActorDef(const SMESH_ActorDef&);  
+  void operator=(const SMESH_ActorDef&);
+};
+
+
+#endif //SMESH_ACTORDEF_H
index a5823c66f03ef69b34823b038bd0a72039e37131..fdaa86c251d9f09a99fa622439afb9f024c00a6a 100644 (file)
@@ -23,6 +23,9 @@
 #include "QAD_Config.h"
 #include "utilities.h"
 
 #include "QAD_Config.h"
 #include "utilities.h"
 
+#include <vtkUnstructuredGrid.h>
+#include <vtkUnstructuredGridWriter.h>
+
 #ifdef _DEBUG_
 static int MYDEBUG = 1;
 #else
 #ifdef _DEBUG_
 static int MYDEBUG = 1;
 #else
@@ -30,10 +33,22 @@ static int MYDEBUG = 0;
 #endif
 
 namespace SMESH{
 #endif
 
 namespace SMESH{
+
   float GetFloat(const QString& theValue, float theDefault){
     if(theValue.isEmpty()) return theDefault;
     QString aValue = QAD_CONFIG->getSetting(theValue);
     if(aValue.isEmpty()) return theDefault;
     return aValue.toFloat();
   }
   float GetFloat(const QString& theValue, float theDefault){
     if(theValue.isEmpty()) return theDefault;
     QString aValue = QAD_CONFIG->getSetting(theValue);
     if(aValue.isEmpty()) return theDefault;
     return aValue.toFloat();
   }
+
+  void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName){
+    vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
+    aWriter->SetFileName(theFileName);
+    aWriter->SetInput(theGrid);
+    if(theGrid->GetNumberOfCells()){
+      aWriter->Write();
+    }
+    aWriter->Delete();
+  }
+
 }
 }
index 4595495244e191733922426f2207bca901fc7208..b9a01e003fdb9e8250cdf8dabd776e3be6c7a30b 100644 (file)
 
 #include <qstring.h>
 
 
 #include <qstring.h>
 
+class vtkUnstructuredGrid;
 
 namespace SMESH{
 
 namespace SMESH{
+  
   float GetFloat(const QString& theValue, float theDefault = 0);
   float GetFloat(const QString& theValue, float theDefault = 0);
-}
 
 
+  void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName);
+
+}
 
 #endif
 
 #endif
index 79d20d81305011bed2749e846300d01dc4f6029a..16ead487f9ab8927d92b2ab06f8760ff1018caf6 100644 (file)
 //  File   : SMESH_Actor.cxx
 //  Author : Nicolas REJNERI
 //  Module : SMESH
 //  File   : SMESH_Actor.cxx
 //  Author : Nicolas REJNERI
 //  Module : SMESH
-//  $Header$
+//  $Header$Header$
 
 
 #include "SMESH_DeviceActor.h"
 #include "SMESH_ExtractGeometry.h"
 
 
 #include "SMESH_DeviceActor.h"
 #include "SMESH_ExtractGeometry.h"
+#include "SMESH_ControlsDef.hxx"
+#include "SMESH_ActorUtils.h"
 
 #include "SALOME_Transform.h"
 #include "SALOME_TransformFilter.h"
 #include "SALOME_PassThroughFilter.h"
 #include "SALOME_ExtractUnstructuredGrid.h"
 
 
 #include "SALOME_Transform.h"
 #include "SALOME_TransformFilter.h"
 #include "SALOME_PassThroughFilter.h"
 #include "SALOME_ExtractUnstructuredGrid.h"
 
-#include "utilities.h"
-
 // VTK Includes
 #include <vtkObjectFactory.h>
 #include <vtkShrinkFilter.h>
 // VTK Includes
 #include <vtkObjectFactory.h>
 #include <vtkShrinkFilter.h>
 
 #include <vtkImplicitBoolean.h>
 
 
 #include <vtkImplicitBoolean.h>
 
+#include "utilities.h"
+
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
 #else
 static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
 #endif
 
 using namespace std;
 #endif
 
 using namespace std;
@@ -166,7 +166,7 @@ void SMESH_DeviceActor::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid){
 
     myExtractUnstructuredGrid->SetInput(myExtractGeometry->GetOutput());
     myMergeFilter->SetGeometry(myExtractUnstructuredGrid->GetOutput());
 
     myExtractUnstructuredGrid->SetInput(myExtractGeometry->GetOutput());
     myMergeFilter->SetGeometry(myExtractUnstructuredGrid->GetOutput());
-
+    
     theGrid = static_cast<vtkUnstructuredGrid*>(myMergeFilter->GetOutput());
 
     int anId = 0;
     theGrid = static_cast<vtkUnstructuredGrid*>(myMergeFilter->GetOutput());
 
     int anId = 0;
@@ -261,6 +261,146 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
   theScalarBarActor->SetVisibility(anIsInitialized);
 }
 
   theScalarBarActor->SetVisibility(anIsInitialized);
 }
 
+void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
+                                         SMESH_DeviceActor* theDeviceActor,
+                                         vtkScalarBarActor* theScalarBarActor,
+                                         vtkLookupTable* theLookupTable)
+{
+  bool anIsInitialized = theFunctor;
+
+  using namespace SMESH::Controls;
+  if (anIsInitialized){
+    if (Length2D* aLength2D = dynamic_cast<Length2D*>(theFunctor.get())){
+      SMESH::Controls::Length2D::TValues aValues;
+
+      myVisualObj->UpdateFunctor(theFunctor);
+
+      aLength2D->GetValues(aValues);
+      vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
+      vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
+
+      aDataSet->SetPoints(aGrid->GetPoints());
+      
+      vtkIdType aNbCells = aValues.size();
+      
+      vtkDoubleArray *aScalars = vtkDoubleArray::New();
+      aScalars->SetNumberOfComponents(1);
+      aScalars->SetNumberOfTuples(aNbCells);
+
+      vtkIdType aCellsSize = 3*aNbCells;
+      vtkCellArray* aConnectivity = vtkCellArray::New();
+      aConnectivity->Allocate( aCellsSize, 0 );
+      
+      vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+      aCellTypesArray->SetNumberOfComponents( 1 );
+      aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
+      
+      vtkIdList *anIdList = vtkIdList::New();
+      anIdList->SetNumberOfIds(2);
+      
+      Length2D::TValues::const_iterator anIter = aValues.begin();
+      for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
+       const Length2D::Value& aValue = *anIter;
+       int aNode[2] = {
+         myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
+         myVisualObj->GetNodeVTKId(aValue.myPntId[1])
+       };
+       if(aNode[0] >= 0 && aNode[1] >= 0){
+         anIdList->SetId( 0, aNode[0] );
+         anIdList->SetId( 1, aNode[1] );
+         aConnectivity->InsertNextCell( anIdList );
+         aCellTypesArray->InsertNextValue( VTK_LINE );
+         aScalars->SetValue(aVtkId,aValue.myLength);
+       }
+      }
+      
+      vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+      aCellLocationsArray->SetNumberOfComponents( 1 );
+      aCellLocationsArray->SetNumberOfTuples( aNbCells );
+      
+      aConnectivity->InitTraversal();
+      for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
+       aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+      
+      aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
+      SetUnstructuredGrid(aDataSet);
+
+      aDataSet->GetCellData()->SetScalars(aScalars);
+      aScalars->Delete();
+      
+      theLookupTable->SetRange(aScalars->GetRange());
+      theLookupTable->Build();
+      
+      myMergeFilter->SetScalars(aDataSet);
+      aDataSet->Delete();
+    }
+    else if (MultiConnection2D* aMultiConnection2D = dynamic_cast<MultiConnection2D*>(theFunctor.get())){
+      SMESH::Controls::MultiConnection2D::MValues aValues;
+
+      myVisualObj->UpdateFunctor(theFunctor);
+
+      aMultiConnection2D->GetValues(aValues);
+      vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
+      vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
+      aDataSet->SetPoints(aGrid->GetPoints());
+      
+      vtkIdType aNbCells = aValues.size();
+      vtkDoubleArray *aScalars = vtkDoubleArray::New();
+      aScalars->SetNumberOfComponents(1);
+      aScalars->SetNumberOfTuples(aNbCells);
+
+      vtkIdType aCellsSize = 3*aNbCells;
+      vtkCellArray* aConnectivity = vtkCellArray::New();
+      aConnectivity->Allocate( aCellsSize, 0 );
+      
+      vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+      aCellTypesArray->SetNumberOfComponents( 1 );
+      aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
+      
+      vtkIdList *anIdList = vtkIdList::New();
+      anIdList->SetNumberOfIds(2);
+      
+      MultiConnection2D::MValues::const_iterator anIter = aValues.begin();
+      int i = 0;
+      for(vtkIdType aVtkId; anIter != aValues.end(); anIter++,i++){
+       const MultiConnection2D::Value& aValue = (*anIter).first;
+       int aNode[2] = {
+         myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
+         myVisualObj->GetNodeVTKId(aValue.myPntId[1])
+       };
+       if(aNode[0] >= 0 && aNode[1] >= 0){
+         anIdList->SetId( 0, aNode[0] );
+         anIdList->SetId( 1, aNode[1] );
+         aConnectivity->InsertNextCell( anIdList );
+         aCellTypesArray->InsertNextValue( VTK_LINE );
+         aScalars->SetValue(i,(*anIter).second);
+       }
+      }
+      
+      vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+      aCellLocationsArray->SetNumberOfComponents( 1 );
+      aCellLocationsArray->SetNumberOfTuples( aNbCells );
+      
+      aConnectivity->InitTraversal();
+      for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
+       aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+      
+      aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
+      SetUnstructuredGrid(aDataSet);
+
+      aDataSet->GetCellData()->SetScalars(aScalars);
+      aScalars->Delete();
+      
+      theLookupTable->SetRange(aScalars->GetRange());
+      theLookupTable->Build();
+      
+      myMergeFilter->SetScalars(aDataSet);
+      aDataSet->Delete();
+    }
+  }
+  GetMapper()->SetScalarVisibility(anIsInitialized);
+  theScalarBarActor->SetVisibility(anIsInitialized);
+}
 
 void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
                                          SMESH_DeviceActor* theDeviceActor)
 
 void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
                                          SMESH_DeviceActor* theDeviceActor)
@@ -304,7 +444,7 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
     anIdList->SetNumberOfIds(2);
     
     FreeEdges::TBorders::const_iterator anIter = aBorders.begin();
     anIdList->SetNumberOfIds(2);
     
     FreeEdges::TBorders::const_iterator anIter = aBorders.begin();
-    for(vtkIdType aVtkId; anIter != aBorders.end(); anIter++){
+    for(; anIter != aBorders.end(); anIter++){
       const FreeEdges::Border& aBorder = *anIter;
       int aNode[2] = {
        myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
       const FreeEdges::Border& aBorder = *anIter;
       int aNode[2] = {
        myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
@@ -331,10 +471,12 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
 
     SetUnstructuredGrid(aDataSet);
     aDataSet->Delete();
 
     SetUnstructuredGrid(aDataSet);
     aDataSet->Delete();
-  }    
+  }
 }
 
 
 }
 
 
+
+
 unsigned long int SMESH_DeviceActor::GetMTime(){
   unsigned long mTime = this->Superclass::GetMTime();
   mTime = max(mTime,myExtractGeometry->GetMTime());
 unsigned long int SMESH_DeviceActor::GetMTime(){
   unsigned long mTime = this->Superclass::GetMTime();
   mTime = max(mTime,myExtractGeometry->GetMTime());
index 5de228b0bc0bea72d4212192bf4e5d36e46cade6..90cd7894355db897a2153ce9d93d5b754c88e36f 100644 (file)
@@ -55,7 +55,7 @@ class SMESH_ExtractGeometry;
 
 
 class SMESH_DeviceActor: public vtkLODActor{
 
 
 class SMESH_DeviceActor: public vtkLODActor{
-  friend class SMESH_Actor;
+  friend class SMESH_ActorDef;
 
  public:
   vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
 
  public:
   vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
@@ -94,6 +94,10 @@ class SMESH_DeviceActor: public vtkLODActor{
   void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
                      vtkScalarBarActor* theScalarBarActor,
                      vtkLookupTable* theLookupTable);
   void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
                      vtkScalarBarActor* theScalarBarActor,
                      vtkLookupTable* theLookupTable);
+  void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
+                        SMESH_DeviceActor* theDeviceActor,
+                        vtkScalarBarActor* theScalarBarActor,
+                        vtkLookupTable* theLookupTable);
   void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
                         SMESH_DeviceActor* theDeviceActor);
 
   void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
                         SMESH_DeviceActor* theDeviceActor);
 
index 6621177cc32ed4f904eacaeaba8602d65d28dce2..4b43e56acade03d620d0d7120d01417f19b9733f 100644 (file)
 //  Author : Nicolas REJNERI
 //  Module : SMESH
 
 //  Author : Nicolas REJNERI
 //  Module : SMESH
 
-#include "SMESH_Object.h"
+#include "SMESH_ObjectDef.h"
+#include "SMESH_ActorUtils.h"
+
 #include "SMDS_Mesh.hxx"
 #include "SMDS_Mesh.hxx"
-#include "SALOME_ExtractUnstructuredGrid.h"
 #include "SMESH_Actor.h"
 #include "SMESH_Actor.h"
+#include "SMESH_ControlsDef.hxx"
+#include "SALOME_ExtractUnstructuredGrid.h"
 
 #include CORBA_SERVER_HEADER(SALOME_Exception)
 
 
 #include CORBA_SERVER_HEADER(SALOME_Exception)
 
@@ -39,8 +42,6 @@
 #include <vtkUnsignedCharArray.h>
 
 #include <vtkUnstructuredGrid.h>
 #include <vtkUnsignedCharArray.h>
 
 #include <vtkUnstructuredGrid.h>
-#include <vtkUnstructuredGridWriter.h>
-#include <vtkUnstructuredGridReader.h>
 
 #include <memory>
 #include <sstream>     
 
 #include <memory>
 #include <sstream>     
@@ -68,17 +69,6 @@ static int MYDEBUGWITHFILES = 0;
 #endif
 
 
 #endif
 
 
-void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName){
-  vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
-  aWriter->SetFileName(theFileName);
-  aWriter->SetInput(theGrid);
-  if(theGrid->GetNumberOfCells()){
-    aWriter->Write();
-  }
-  aWriter->Delete();
-}
-
-
 namespace{
 
   inline const SMDS_MeshNode* FindNode(const SMDS_Mesh* theMesh, int theId){
 namespace{
 
   inline const SMDS_MeshNode* FindNode(const SMDS_Mesh* theMesh, int theId){
@@ -117,7 +107,6 @@ namespace{
                             SMESH::log_array_var& theSeq,
                             CORBA::Long theId)
   {
                             SMESH::log_array_var& theSeq,
                             CORBA::Long theId)
   {
-    const SMESH::double_array& aCoords = theSeq[theId].coords;
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(3*aNbElems != anIndexes.length())
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(3*aNbElems != anIndexes.length())
@@ -136,7 +125,6 @@ namespace{
                             SMESH::log_array_var& theSeq,
                             CORBA::Long theId)
   {
                             SMESH::log_array_var& theSeq,
                             CORBA::Long theId)
   {
-    const SMESH::double_array& aCoords = theSeq[theId].coords;
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(4*aNbElems != anIndexes.length())
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(4*aNbElems != anIndexes.length())
@@ -156,7 +144,6 @@ namespace{
                             SMESH::log_array_var theSeq,
                             CORBA::Long theId)
   {
                             SMESH::log_array_var theSeq,
                             CORBA::Long theId)
   {
-    const SMESH::double_array& aCoords = theSeq[theId].coords;
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(5*aNbElems != anIndexes.length())
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(5*aNbElems != anIndexes.length())
@@ -177,7 +164,6 @@ namespace{
                              SMESH::log_array_var& theSeq,
                              CORBA::Long theId)
   {
                              SMESH::log_array_var& theSeq,
                              CORBA::Long theId)
   {
-    const SMESH::double_array& aCoords = theSeq[theId].coords;
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(5*aNbElems != anIndexes.length())
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(5*aNbElems != anIndexes.length())
@@ -198,7 +184,6 @@ namespace{
                                SMESH::log_array_var& theSeq,
                                CORBA::Long theId)
   {
                                SMESH::log_array_var& theSeq,
                                CORBA::Long theId)
   {
-    const SMESH::double_array& aCoords = theSeq[theId].coords;
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(6*aNbElems != anIndexes.length())
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(6*aNbElems != anIndexes.length())
@@ -220,7 +205,6 @@ namespace{
                              SMESH::log_array_var& theSeq,
                              CORBA::Long theId)
   {
                              SMESH::log_array_var& theSeq,
                              CORBA::Long theId)
   {
-    const SMESH::double_array& aCoords = theSeq[theId].coords;
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(7*aNbElems != anIndexes.length())
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(7*aNbElems != anIndexes.length())
@@ -243,7 +227,6 @@ namespace{
                             SMESH::log_array_var& theSeq,
                             CORBA::Long theId)
   {
                             SMESH::log_array_var& theSeq,
                             CORBA::Long theId)
   {
-    const SMESH::double_array& aCoords = theSeq[theId].coords;
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(9*aNbElems != anIndexes.length())
     const SMESH::long_array& anIndexes = theSeq[theId].indexes;
     CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
     if(9*aNbElems != anIndexes.length())
@@ -266,7 +249,7 @@ namespace{
 
 }
 /*
 
 }
 /*
-  Class       : SMESH_VisualObj
+  Class       : SMESH_VisualObjDef
   Description : Base class for all mesh objects to be visuilised
 */
 
   Description : Base class for all mesh objects to be visuilised
 */
 
@@ -274,36 +257,39 @@ namespace{
 // function : getCellType
 // purpose  : Get type of VTK cell
 //=================================================================================
 // function : getCellType
 // purpose  : Get type of VTK cell
 //=================================================================================
-static inline vtkIdType getCellType( const SMESH::ElementType theType,
+static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
                                      const int theNbNodes )
 {
   switch( theType )
   {
                                      const int theNbNodes )
 {
   switch( theType )
   {
-    case SMESH::EDGE: return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL;
-
-    case SMESH::FACE  : if      ( theNbNodes == 3 ) return VTK_TRIANGLE;
-                        else if ( theNbNodes == 4 ) return VTK_QUAD;
-                        else                        return VTK_EMPTY_CELL;
+    case SMDSAbs_Edge: 
+      return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL;
 
 
-    case SMESH::VOLUME: if      ( theNbNodes == 4 ) return VTK_TETRA;
-                        else if ( theNbNodes == 5 ) return VTK_PYRAMID;
-                        else if ( theNbNodes == 6 ) return VTK_WEDGE;
-                        else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
-                        else                        return VTK_EMPTY_CELL;
+    case SMDSAbs_Face  : 
+      if      ( theNbNodes == 3 ) return VTK_TRIANGLE;
+      else if ( theNbNodes == 4 ) return VTK_QUAD;
+      else                        return VTK_EMPTY_CELL;
+      
+    case SMDSAbs_Volume: 
+      if      ( theNbNodes == 4 ) return VTK_TETRA;
+      else if ( theNbNodes == 5 ) return VTK_PYRAMID;
+      else if ( theNbNodes == 6 ) return VTK_WEDGE;
+      else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
+      else                        return VTK_EMPTY_CELL;
 
     default: return VTK_EMPTY_CELL;
   }
 }
 
 //=================================================================================
 
     default: return VTK_EMPTY_CELL;
   }
 }
 
 //=================================================================================
-// functions : SMESH_VisualObj
+// functions : SMESH_VisualObjDef
 // purpose   : Constructor
 //=================================================================================
 // purpose   : Constructor
 //=================================================================================
-SMESH_VisualObj::SMESH_VisualObj()
+SMESH_VisualObjDef::SMESH_VisualObjDef()
 {
   myGrid = vtkUnstructuredGrid::New();
 }
 {
   myGrid = vtkUnstructuredGrid::New();
 }
-SMESH_VisualObj::~SMESH_VisualObj()
+SMESH_VisualObjDef::~SMESH_VisualObjDef()
 {
   if ( MYDEBUG )
     MESSAGE( "~SMESH_MeshObj - myGrid->GetReferenceCount() = " << myGrid->GetReferenceCount() );
 {
   if ( MYDEBUG )
     MESSAGE( "~SMESH_MeshObj - myGrid->GetReferenceCount() = " << myGrid->GetReferenceCount() );
@@ -314,37 +300,37 @@ SMESH_VisualObj::~SMESH_VisualObj()
 // functions : GetNodeObjId, GetNodeVTKId, GetElemObjId, GetElemVTKId
 // purpose   : Methods for retrieving VTK IDs by SMDS IDs and  vice versa
 //=================================================================================
 // functions : GetNodeObjId, GetNodeVTKId, GetElemObjId, GetElemVTKId
 // purpose   : Methods for retrieving VTK IDs by SMDS IDs and  vice versa
 //=================================================================================
-vtkIdType SMESH_VisualObj::GetNodeObjId( int theVTKID )
+vtkIdType SMESH_VisualObjDef::GetNodeObjId( int theVTKID )
 {
   return myVTK2SMDSNodes.find(theVTKID) == myVTK2SMDSNodes.end() ? -1 : myVTK2SMDSNodes[theVTKID];
 }
 
 {
   return myVTK2SMDSNodes.find(theVTKID) == myVTK2SMDSNodes.end() ? -1 : myVTK2SMDSNodes[theVTKID];
 }
 
-vtkIdType SMESH_VisualObj::GetNodeVTKId( int theObjID )
+vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID )
 {
   return mySMDS2VTKNodes.find(theObjID) == mySMDS2VTKNodes.end() ? -1 : mySMDS2VTKNodes[theObjID];
 }
 
 {
   return mySMDS2VTKNodes.find(theObjID) == mySMDS2VTKNodes.end() ? -1 : mySMDS2VTKNodes[theObjID];
 }
 
-vtkIdType SMESH_VisualObj::GetElemObjId( int theVTKID )
+vtkIdType SMESH_VisualObjDef::GetElemObjId( int theVTKID )
 {
   return myVTK2SMDSElems.find(theVTKID) == myVTK2SMDSElems.end() ? -1 : myVTK2SMDSElems[theVTKID];
 }
 
 {
   return myVTK2SMDSElems.find(theVTKID) == myVTK2SMDSElems.end() ? -1 : myVTK2SMDSElems[theVTKID];
 }
 
-vtkIdType SMESH_VisualObj::GetElemVTKId( int theObjID )
+vtkIdType SMESH_VisualObjDef::GetElemVTKId( int theObjID )
 {
   return mySMDS2VTKElems.find(theObjID) == mySMDS2VTKElems.end() ? -1 : mySMDS2VTKElems[theObjID];
 }
 
 //=================================================================================
 {
   return mySMDS2VTKElems.find(theObjID) == mySMDS2VTKElems.end() ? -1 : mySMDS2VTKElems[theObjID];
 }
 
 //=================================================================================
-// function : SMESH_VisualObj::createPoints
+// function : SMESH_VisualObjDef::createPoints
 // purpose  : Create points from nodes
 //=================================================================================
 // purpose  : Create points from nodes
 //=================================================================================
-void SMESH_VisualObj::createPoints( vtkPoints* thePoints )
+void SMESH_VisualObjDef::createPoints( vtkPoints* thePoints )
 {
   if ( thePoints == 0 )
     return;
 
   TEntityList aNodes;
 {
   if ( thePoints == 0 )
     return;
 
   TEntityList aNodes;
-  vtkIdType nbNodes = GetEntities( SMESH::NODE, aNodes );
+  vtkIdType nbNodes = GetEntities( SMDSAbs_Node, aNodes );
   thePoints->SetNumberOfPoints( nbNodes );
   
   int nbPoints = 0;
   thePoints->SetNumberOfPoints( nbNodes );
   
   int nbPoints = 0;
@@ -371,7 +357,7 @@ void SMESH_VisualObj::createPoints( vtkPoints* thePoints )
 // function : buildPrs
 // purpose  : create VTK cells( fill unstructured grid )
 //=================================================================================
 // function : buildPrs
 // purpose  : create VTK cells( fill unstructured grid )
 //=================================================================================
-void SMESH_VisualObj::buildPrs()
+void SMESH_VisualObjDef::buildPrs()
 {
   try
   {
 {
   try
   {
@@ -395,18 +381,17 @@ void SMESH_VisualObj::buildPrs()
   }
   
   if( MYDEBUG ) MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
   }
   
   if( MYDEBUG ) MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
-  if( MYDEBUGWITHFILES ) WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" );
+  if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" );
 }
 
 //=================================================================================
 // function : buildNodePrs
 // purpose  : create VTK cells for nodes
 //=================================================================================
 }
 
 //=================================================================================
 // function : buildNodePrs
 // purpose  : create VTK cells for nodes
 //=================================================================================
-void SMESH_VisualObj::buildNodePrs()
+void SMESH_VisualObjDef::buildNodePrs()
 {
   vtkPoints* aPoints = vtkPoints::New();
   createPoints( aPoints );
 {
   vtkPoints* aPoints = vtkPoints::New();
   createPoints( aPoints );
-  int nbPoints = aPoints->GetNumberOfPoints();
   myGrid->SetPoints( aPoints );
   aPoints->Delete();
 
   myGrid->SetPoints( aPoints );
   aPoints->Delete();
 
@@ -414,6 +399,7 @@ void SMESH_VisualObj::buildNodePrs()
 
   // Create cells
   /*
 
   // Create cells
   /*
+  int nbPoints = aPoints->GetNumberOfPoints();
   vtkIdList *anIdList = vtkIdList::New();
   anIdList->SetNumberOfIds( 1 );
 
   vtkIdList *anIdList = vtkIdList::New();
   anIdList->SetNumberOfIds( 1 );
 
@@ -452,7 +438,33 @@ void SMESH_VisualObj::buildNodePrs()
 // function : buildElemPrs
 // purpose  : Create VTK cells for elements
 //=================================================================================
 // function : buildElemPrs
 // purpose  : Create VTK cells for elements
 //=================================================================================
-void SMESH_VisualObj::buildElemPrs()
+
+namespace{
+  typedef std::vector<const SMDS_MeshElement*> TConnect;
+
+  int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter, 
+                TConnect& theConnect)
+  {
+    theConnect.clear();
+    for(; theNodesIter->more();)
+      theConnect.push_back(theNodesIter->next());
+    return theConnect.size();
+  }
+  
+  inline 
+  void SetId(vtkIdList *theIdList, 
+            const SMESH_VisualObjDef::TMapOfIds& theSMDS2VTKNodes, 
+            const TConnect& theConnect, 
+            int thePosition,
+            int theId)
+  {
+    theIdList->SetId(thePosition,theSMDS2VTKNodes.find(theConnect[theId]->GetID())->second);
+  }
+
+}
+
+
+void SMESH_VisualObjDef::buildElemPrs()
 {
   // Create points
   
 {
   // Create points
   
@@ -466,16 +478,16 @@ void SMESH_VisualObj::buildElemPrs()
 
   // Calculate cells size
 
 
   // Calculate cells size
 
-  static SMESH::ElementType aTypes[ 3 ] = { SMESH::EDGE, SMESH::FACE, SMESH::VOLUME };
+  static SMDSAbs_ElementType aTypes[ 3 ] = { SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume };
 
   // get entity data
 
   // get entity data
-  map< int, int >         nbEnts;
-  map< int, TEntityList > anEnts;
+  map<SMDSAbs_ElementType,int> nbEnts;
+  map<SMDSAbs_ElementType,TEntityList> anEnts;
 
   for ( int i = 0; i <= 2; i++ )
     nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] );
 
 
   for ( int i = 0; i <= 2; i++ )
     nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] );
 
-  vtkIdType aCellsSize =  3 * nbEnts[ SMESH::EDGE ];
+  vtkIdType aCellsSize =  3 * nbEnts[ SMDSAbs_Edge ];
 
   for ( int i = 1; i <= 2; i++ ) // iterate through faces and volumes
   {
 
   for ( int i = 1; i <= 2; i++ ) // iterate through faces and volumes
   {
@@ -488,7 +500,7 @@ void SMESH_VisualObj::buildElemPrs()
     }
   }
 
     }
   }
 
-  vtkIdType aNbCells = nbEnts[ SMESH::EDGE ] + nbEnts[ SMESH::FACE ] + nbEnts[ SMESH::VOLUME ];
+  vtkIdType aNbCells = nbEnts[ SMDSAbs_Edge ] + nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
   
   if ( MYDEBUG )
     MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
   
   if ( MYDEBUG )
     MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
@@ -504,12 +516,16 @@ void SMESH_VisualObj::buildElemPrs()
   
   vtkIdList *anIdList = vtkIdList::New();
   vtkIdType iElem = 0;
   
   vtkIdList *anIdList = vtkIdList::New();
   vtkIdType iElem = 0;
-  
+
+  TConnect aConnect;
+  aConnect.reserve(VTK_CELL_SIZE);
+
   for ( int i = 0; i <= 2; i++ ) // iterate through edges, faces and volumes
   {
     if( nbEnts[ aTypes[ i ] ] > 0 )
     {
   for ( int i = 0; i <= 2; i++ ) // iterate through edges, faces and volumes
   {
     if( nbEnts[ aTypes[ i ] ] > 0 )
     {
-      const TEntityList& aList = anEnts[ aTypes[ i ] ];
+      const SMDSAbs_ElementType& aType = aTypes[ i ];
+      const TEntityList& aList = anEnts[ aType ];
       TEntityList::const_iterator anIter;
       for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
       {
       TEntityList::const_iterator anIter;
       for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
       {
@@ -524,14 +540,48 @@ void SMESH_VisualObj::buildElemPrs()
         myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
 
         SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
         myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
 
         SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
-        for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ )
-        {
-          const SMDS_MeshElement* aNode = aNodesIter->next();
-          anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
-        }
+       switch(aType){
+       case SMDSAbs_Volume:{
+         int* aConnectivities = NULL;
+         GetConnect(aNodesIter,aConnect);
+         // Convertions connectivities from SMDS to VTK
+         switch(aNbNodes){
+         case 4:{
+           static int anIds[] = {0,2,1,3};
+           aConnectivities = anIds;
+           break;
+         }
+         case 5:{
+           static int anIds[] = {0,3,2,1,4};
+           aConnectivities = anIds;
+           break;
+         }
+         case 6:{
+           static int anIds[] = {0,1,2,3,4,5};
+           aConnectivities = anIds;
+           break;
+         }
+         case 8:{
+           static int anIds[] = {0,3,2,1,4,7,6,5};
+           aConnectivities = anIds;
+           break;
+         }}
+
+         if(aConnectivities)
+           for( vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++ )
+             SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
+         
+         break;
+       }
+       default:
+         for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
+           const SMDS_MeshElement* aNode = aNodesIter->next();
+           anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
+         }
+       }
 
         aConnectivity->InsertNextCell( anIdList );
 
         aConnectivity->InsertNextCell( anIdList );
-        aCellTypesArray->InsertNextValue( getCellType( aTypes[ i ], aNbNodes ) );
+        aCellTypesArray->InsertNextValue( getCellType( aType, aNbNodes ) );
 
         iElem++;
       }
 
         iElem++;
       }
@@ -560,10 +610,10 @@ void SMESH_VisualObj::buildElemPrs()
 // function : GetEdgeNodes
 // purpose  : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 )
 //=================================================================================
 // function : GetEdgeNodes
 // purpose  : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 )
 //=================================================================================
-bool SMESH_VisualObj::GetEdgeNodes( const int theElemId,
-                                    const int theEdgeNum,
-                                    int&      theNodeId1,
-                                    int&      theNodeId2 ) const
+bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
+                                      const int theEdgeNum,
+                                      int&      theNodeId1,
+                                      int&      theNodeId2 ) const
 {
   const SMDS_Mesh* aMesh = GetMesh();
   if ( aMesh == 0 )
 {
   const SMDS_Mesh* aMesh = GetMesh();
   if ( aMesh == 0 )
@@ -650,7 +700,6 @@ void SMESH_MeshObj::Update( int theIsClear )
       const SMESH::double_array& aCoords = aSeq[anId].coords;
       const SMESH::long_array& anIndexes = aSeq[anId].indexes;
       CORBA::Long anElemId = 0, aNbElems = aSeq[anId].number;
       const SMESH::double_array& aCoords = aSeq[anId].coords;
       const SMESH::long_array& anIndexes = aSeq[anId].indexes;
       CORBA::Long anElemId = 0, aNbElems = aSeq[anId].number;
-      SMDS_MeshElement* anElem = NULL;
       CORBA::Long aCommand = aSeq[anId].commandType;
       
       switch(aCommand)
       CORBA::Long aCommand = aSeq[anId].commandType;
       
       switch(aCommand)
@@ -760,26 +809,26 @@ int SMESH_MeshObj::GetElemDimension( const int theObjId )
 // function : GetEntities
 // purpose  : Get entities of specified type. Return number of entities
 //=================================================================================
 // function : GetEntities
 // purpose  : Get entities of specified type. Return number of entities
 //=================================================================================
-int SMESH_MeshObj::GetNbEntities( const SMESH::ElementType theType) const
+int SMESH_MeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const
 {
   switch ( theType )
   {
 {
   switch ( theType )
   {
-    case SMESH::NODE:
+    case SMDSAbs_Node:
     {
       return myMesh->NbNodes();
     }
     break;
     {
       return myMesh->NbNodes();
     }
     break;
-    case SMESH::EDGE:
+    case SMDSAbs_Edge:
     {
       return myMesh->NbEdges();
     }
     break;
     {
       return myMesh->NbEdges();
     }
     break;
-    case SMESH::FACE:
+    case SMDSAbs_Face:
     {
       return myMesh->NbFaces();
     }
     break;
     {
       return myMesh->NbFaces();
     }
     break;
-    case SMESH::VOLUME:
+    case SMDSAbs_Volume:
     {
       return myMesh->NbVolumes();
     }
     {
       return myMesh->NbVolumes();
     }
@@ -790,31 +839,31 @@ int SMESH_MeshObj::GetNbEntities( const SMESH::ElementType theType) const
   }
 }
 
   }
 }
 
-int SMESH_MeshObj::GetEntities( const SMESH::ElementType theType, TEntityList& theObjs ) const
+int SMESH_MeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theObjs ) const
 {
   theObjs.clear();
 
   switch ( theType )
   {
 {
   theObjs.clear();
 
   switch ( theType )
   {
-    case SMESH::NODE:
+    case SMDSAbs_Node:
     {
       SMDS_NodeIteratorPtr anIter = myMesh->nodesIterator();
       while ( anIter->more() ) theObjs.push_back( anIter->next() );
     }
     break;
     {
       SMDS_NodeIteratorPtr anIter = myMesh->nodesIterator();
       while ( anIter->more() ) theObjs.push_back( anIter->next() );
     }
     break;
-    case SMESH::EDGE:
+    case SMDSAbs_Edge:
     {
       SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
       while ( anIter->more() ) theObjs.push_back( anIter->next() );
     }
     break;
     {
       SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
       while ( anIter->more() ) theObjs.push_back( anIter->next() );
     }
     break;
-    case SMESH::FACE:
+    case SMDSAbs_Face:
     {
       SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
       while ( anIter->more() ) theObjs.push_back( anIter->next() );
     }
     break;
     {
       SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
       while ( anIter->more() ) theObjs.push_back( anIter->next() );
     }
     break;
-    case SMESH::VOLUME:
+    case SMDSAbs_Volume:
     {
       SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
       while ( anIter->more() ) theObjs.push_back( anIter->next() );
     {
       SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
       while ( anIter->more() ) theObjs.push_back( anIter->next() );
@@ -964,14 +1013,14 @@ static int getNodesFromElems( SMESH::long_array_var&              theElemIds,
 // function : getPointers
 // purpose  : Get std::list<const SMDS_MeshElement*> from list of IDs
 //=================================================================================
 // function : getPointers
 // purpose  : Get std::list<const SMDS_MeshElement*> from list of IDs
 //=================================================================================
-static int getPointers( const SMESH::ElementType            theRequestType,
+static int getPointers( const SMDSAbs_ElementType            theRequestType,
                         SMESH::long_array_var&              theElemIds,
                         const SMDS_Mesh*                    theMesh,
                         std::list<const SMDS_MeshElement*>& theResList )
 {
   for ( CORBA::Long i = 0, n = theElemIds->length(); i < n; i++ )
   {
                         SMESH::long_array_var&              theElemIds,
                         const SMDS_Mesh*                    theMesh,
                         std::list<const SMDS_MeshElement*>& theResList )
 {
   for ( CORBA::Long i = 0, n = theElemIds->length(); i < n; i++ )
   {
-    const SMDS_MeshElement* anElem = theRequestType == SMESH::NODE
+    const SMDS_MeshElement* anElem = theRequestType == SMDSAbs_Node
       ? theMesh->FindNode( theElemIds[ i ] ) : theMesh->FindElement( theElemIds[ i ] );
 
     if ( anElem != 0 )
       ? theMesh->FindNode( theElemIds[ i ] ) : theMesh->FindElement( theElemIds[ i ] );
 
     if ( anElem != 0 )
@@ -986,15 +1035,15 @@ static int getPointers( const SMESH::ElementType            theRequestType,
 // function : GetEntities
 // purpose  : Get entities of specified type. Return number of entities
 //=================================================================================
 // function : GetEntities
 // purpose  : Get entities of specified type. Return number of entities
 //=================================================================================
-int SMESH_GroupObj::GetNbEntities( const SMESH::ElementType theType) const
+int SMESH_GroupObj::GetNbEntities( const SMDSAbs_ElementType theType) const
 {
 {
-  if(myGroupServer->GetType() == theType){
+  if(SMDSAbs_ElementType(myGroupServer->GetType()) == theType){
     return myGroupServer->Size();
   }
   return 0;
 }
 
     return myGroupServer->Size();
   }
   return 0;
 }
 
-int SMESH_GroupObj::GetEntities( const SMESH::ElementType theType, TEntityList& theResList ) const
+int SMESH_GroupObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theResList ) const
 {
   theResList.clear();
   SMDS_Mesh* aMesh = myMeshObj->GetMesh();
 {
   theResList.clear();
   SMDS_Mesh* aMesh = myMeshObj->GetMesh();
@@ -1002,12 +1051,12 @@ int SMESH_GroupObj::GetEntities( const SMESH::ElementType theType, TEntityList&
   if ( myGroupServer->Size() == 0 || aMesh == 0 )
     return 0;
 
   if ( myGroupServer->Size() == 0 || aMesh == 0 )
     return 0;
 
-  SMESH::ElementType aGrpType = myGroupServer->GetType();
+  SMDSAbs_ElementType aGrpType = SMDSAbs_ElementType(myGroupServer->GetType());
   SMESH::long_array_var anIds = myGroupServer->GetListOfID();
 
   if ( aGrpType == theType )
     return getPointers( theType, anIds, aMesh, theResList );
   SMESH::long_array_var anIds = myGroupServer->GetListOfID();
 
   if ( aGrpType == theType )
     return getPointers( theType, anIds, aMesh, theResList );
-  else if ( theType == SMESH::NODE )
+  else if ( theType == SMDSAbs_Node )
     return getNodesFromElems( anIds, aMesh, theResList );
   else
     return 0;
     return getNodesFromElems( anIds, aMesh, theResList );
   else
     return 0;
@@ -1044,20 +1093,21 @@ SMESH_subMeshObj::~SMESH_subMeshObj()
 // function : GetEntities
 // purpose  : Get entities of specified type. Return number of entities
 //=================================================================================
 // function : GetEntities
 // purpose  : Get entities of specified type. Return number of entities
 //=================================================================================
-int SMESH_subMeshObj::GetNbEntities( const SMESH::ElementType theType) const
+int SMESH_subMeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const
 {
   switch ( theType )
   {
 {
   switch ( theType )
   {
-    case SMESH::NODE:
+    case SMDSAbs_Node:
     {
       return mySubMeshServer->GetNumberOfNodes( false );
     }
     break;
     {
       return mySubMeshServer->GetNumberOfNodes( false );
     }
     break;
-    case SMESH::EDGE:
-    case SMESH::FACE:
-    case SMESH::VOLUME:
+    case SMDSAbs_Edge:
+    case SMDSAbs_Face:
+    case SMDSAbs_Volume:
     {
     {
-      SMESH::long_array_var anIds = mySubMeshServer->GetElementsByType( theType );
+      SMESH::long_array_var anIds = 
+       mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
       return anIds->length();
     }
     default:
       return anIds->length();
     }
     default:
@@ -1066,7 +1116,7 @@ int SMESH_subMeshObj::GetNbEntities( const SMESH::ElementType theType) const
   }
 }
 
   }
 }
 
-int SMESH_subMeshObj::GetEntities( const SMESH::ElementType theType, TEntityList& theResList ) const
+int SMESH_subMeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theResList ) const
 {
   theResList.clear();
 
 {
   theResList.clear();
 
@@ -1078,22 +1128,23 @@ int SMESH_subMeshObj::GetEntities( const SMESH::ElementType theType, TEntityList
 
   if ( isNodal )
   {
 
   if ( isNodal )
   {
-    if ( theType == SMESH::NODE )
+    if ( theType == SMDSAbs_Node )
     {
       SMESH::long_array_var anIds = mySubMeshServer->GetNodesId();
     {
       SMESH::long_array_var anIds = mySubMeshServer->GetNodesId();
-      return getPointers( SMESH::NODE, anIds, aMesh, theResList );
+      return getPointers( SMDSAbs_Node, anIds, aMesh, theResList );
     }
   }
   else
   {
     }
   }
   else
   {
-    if ( theType == SMESH::NODE )
+    if ( theType == SMDSAbs_Node )
     {
       SMESH::long_array_var anIds = mySubMeshServer->GetElementsId();
       return getNodesFromElems( anIds, aMesh, theResList );
     }
     else
     {
     {
       SMESH::long_array_var anIds = mySubMeshServer->GetElementsId();
       return getNodesFromElems( anIds, aMesh, theResList );
     }
     else
     {
-      SMESH::long_array_var anIds = mySubMeshServer->GetElementsByType( theType );
+      SMESH::long_array_var anIds = 
+       mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
       return getPointers( theType, anIds, aMesh, theResList );
     }
   }
       return getPointers( theType, anIds, aMesh, theResList );
     }
   }
index b70ccae7c52fe3391950de1931867937cbc35afe..aea4f778e26e3d64952568e98d37e18bd0712c84 100644 (file)
 #ifndef SMESH_OBJECT_H
 #define SMESH_OBJECT_H
 
 #ifndef SMESH_OBJECT_H
 #define SMESH_OBJECT_H
 
-// IDL Headers
-#include "SALOMEconfig.h"
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-#include CORBA_SERVER_HEADER(SMESH_Group)
-
-#include <map>
-#include <list>
 #include <boost/shared_ptr.hpp>
 #include <vtkSystemIncludes.h>
 
 #include "SMESH_Controls.hxx"
 #include <boost/shared_ptr.hpp>
 #include <vtkSystemIncludes.h>
 
 #include "SMESH_Controls.hxx"
+#include "SMDSAbs_ElementType.hxx"
 
 
-class vtkUnstructuredGrid;
-class vtkPoints;
-class SALOME_ExtractUnstructuredGrid;
-
-class SMESH_Actor;
 class SMDS_Mesh;
 class SMDS_Mesh;
-class SMDS_MeshNode;
-class SMDS_MeshElement;
-
-class SMESH_VisualObj;
-typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
-
+class vtkUnstructuredGrid;
 
 /*
   Class       : SMESH_VisualObj
 
 /*
   Class       : SMESH_VisualObj
@@ -60,155 +44,27 @@ typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
 */
 class SMESH_VisualObj
 {
 */
 class SMESH_VisualObj
 {
-protected:
-
-  typedef std::list<const SMDS_MeshElement*>   TEntityList;
-  typedef std::map<vtkIdType,vtkIdType>  TMapOfIds;
-  
-public:
-                            SMESH_VisualObj();
-  virtual                   ~SMESH_VisualObj();
-  
-  virtual void              Update( int theIsClear = true ) = 0;
-  virtual void              UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
-  virtual int               GetElemDimension( const int theObjId ) = 0;
-
-  virtual int               GetNbEntities( const SMESH::ElementType) const = 0;
-  virtual int               GetEntities( const SMESH::ElementType, TEntityList& ) const = 0;
-  virtual bool              IsNodePrs() const = 0;
-  virtual SMDS_Mesh*        GetMesh() const = 0;
-
-  bool                      GetEdgeNodes( const int theElemId,
-                                          const int theEdgeNum,
-                                          int&      theNodeId1,
-                                          int&      theNodeId2 ) const;
-
-  vtkUnstructuredGrid*      GetUnstructuredGrid() { return myGrid; }
-  
-  vtkIdType                 GetNodeObjId( int theVTKID );
-  vtkIdType                 GetNodeVTKId( int theObjID );
-  vtkIdType                 GetElemObjId( int theVTKID );
-  vtkIdType                 GetElemVTKId( int theObjID );
-  
-protected:
-
-  void                      createPoints( vtkPoints* );
-  void                      buildPrs();
-  void                      buildNodePrs();
-  void                      buildElemPrs();
-  
-private:                                   
-
-  TMapOfIds                 mySMDS2VTKNodes;
-  TMapOfIds                 myVTK2SMDSNodes;
-  TMapOfIds                 mySMDS2VTKElems;
-  TMapOfIds                 myVTK2SMDSElems;
-
-  vtkUnstructuredGrid*      myGrid;
-};
-
-
-/*
-  Class       : SMESH_MeshObj
-  Description : Class for visualisation of mesh
-*/
-
-class SMESH_MeshObj: public SMESH_VisualObj
-{
-public:
-
-                            SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
-  virtual                   ~SMESH_MeshObj();
-  
-  virtual void              Update( int theIsClear = true );
-  
-  virtual int               GetNbEntities( const SMESH::ElementType) const;
-  virtual int               GetEntities( const SMESH::ElementType, TEntityList& ) const;
-  virtual bool              IsNodePrs() const;
-
-  virtual int               GetElemDimension( const int theObjId );
-
-  virtual void              UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
-  
-  SMESH::SMESH_Mesh_ptr     GetMeshServer() { return myMeshServer.in(); }
-  SMDS_Mesh*                GetMesh() const { return myMesh; }
-
-protected:
-
-  SMESH::SMESH_Mesh_var     myMeshServer;
-  SMDS_Mesh*                myMesh;
-};
-
-
-/*
-  Class       : SMESH_SubMeshObj
-  Description : Base class for visualisation of submeshes and groups
-*/
-
-class SMESH_SubMeshObj: public SMESH_VisualObj
-{
 public:
 public:
+  virtual void Update( int theIsClear = true ) = 0;
+  virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
+  virtual int GetElemDimension( const int theObjId ) = 0;
 
 
-                            SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
-  virtual                   ~SMESH_SubMeshObj();
+  virtual int GetNbEntities( const SMDSAbs_ElementType theType) const = 0;
+  virtual SMDS_Mesh* GetMesh() const = 0;
 
 
-  virtual void              Update( int theIsClear = true );
+  virtual bool GetEdgeNodes( const int theElemId,
+                            const int theEdgeNum,
+                            int&      theNodeId1,
+                            int&      theNodeId2 ) const = 0;
   
   
-  virtual void              UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
-  virtual int               GetElemDimension( const int theObjId );
-  virtual SMDS_Mesh*        GetMesh() const { return myMeshObj->GetMesh(); }
+  virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
   
   
-protected:
-
-  SMESH_MeshObj*            myMeshObj;
+  virtual vtkIdType GetNodeObjId( int theVTKID ) = 0;
+  virtual vtkIdType GetNodeVTKId( int theObjID ) = 0;
+  virtual vtkIdType GetElemObjId( int theVTKID ) = 0;
+  virtual vtkIdType GetElemVTKId( int theObjID ) = 0;
 };
 
 };
 
-
-/*
-  Class       : SMESH_GroupObj
-  Description : Class for visualisation of groups
-*/
-
-class SMESH_GroupObj: public SMESH_SubMeshObj
-{
-public:
-                            SMESH_GroupObj( SMESH::SMESH_GroupBase_ptr, SMESH_MeshObj* );
-  virtual                   ~SMESH_GroupObj();
-
-  virtual int               GetNbEntities( const SMESH::ElementType) const;
-  virtual int               GetEntities( const SMESH::ElementType, TEntityList& ) const;
-  virtual bool              IsNodePrs() const;
-
-private:
-
-  SMESH::SMESH_GroupBase_var    myGroupServer;
-};
-
-
-/*
-  Class       : SMESH_subMeshObj
-  Description : Class for visualisation of submeshes
-*/
-
-class SMESH_subMeshObj : public SMESH_SubMeshObj
-{
-public:
-
-                            SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr, 
-                                              SMESH_MeshObj* );
-  virtual                   ~SMESH_subMeshObj();
-
-  virtual int               GetNbEntities( const SMESH::ElementType) const;
-  virtual int               GetEntities( const SMESH::ElementType, TEntityList& ) const;
-  virtual bool              IsNodePrs() const;    
-  
-protected:
-
-  SMESH::SMESH_subMesh_var  mySubMeshServer;
-};
-
-
-extern void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName);
-
+typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
 
 #endif
 
 #endif
diff --git a/src/OBJECT/SMESH_ObjectDef.h b/src/OBJECT/SMESH_ObjectDef.h
new file mode 100644 (file)
index 0000000..14df168
--- /dev/null
@@ -0,0 +1,202 @@
+//  SMESH OBJECT : interactive object for SMESH visualization
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESH_Object.h
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+#ifndef SMESH_OBJECTDEF_H
+#define SMESH_OBJECTDEF_H
+
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
+#include <map>
+#include <list>
+
+#include "SMESH_Controls.hxx"
+#include "SMESH_Object.h"
+
+class vtkPoints;
+class SALOME_ExtractUnstructuredGrid;
+
+class SMESH_Actor;
+class SMDS_MeshNode;
+class SMDS_MeshElement;
+
+/*
+  Class       : SMESH_VisualObj
+  Description : Base class for all mesh objects to be visuilised
+*/
+class SMESH_VisualObjDef: public SMESH_VisualObj
+{
+public:
+  typedef std::list<const SMDS_MeshElement*>   TEntityList;
+  typedef std::map<vtkIdType,vtkIdType>  TMapOfIds;
+  
+                            SMESH_VisualObjDef();
+  virtual                   ~SMESH_VisualObjDef();
+  
+  virtual void              Update( int theIsClear = true ) = 0;
+  virtual void              UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
+  virtual int               GetElemDimension( const int theObjId ) = 0;
+
+  virtual int               GetNbEntities( const SMDSAbs_ElementType theType) const = 0;
+  virtual int               GetEntities( const SMDSAbs_ElementType, TEntityList& ) const = 0;
+  virtual bool              IsNodePrs() const = 0;
+  virtual SMDS_Mesh*        GetMesh() const = 0;
+
+  virtual bool              GetEdgeNodes( const int theElemId,
+                                          const int theEdgeNum,
+                                          int&      theNodeId1,
+                                          int&      theNodeId2 ) const;
+
+  virtual vtkUnstructuredGrid* GetUnstructuredGrid() { return myGrid; }
+  
+  virtual vtkIdType         GetNodeObjId( int theVTKID );
+  virtual vtkIdType         GetNodeVTKId( int theObjID );
+  virtual vtkIdType         GetElemObjId( int theVTKID );
+  virtual vtkIdType         GetElemVTKId( int theObjID );
+  
+protected:
+
+  void                      createPoints( vtkPoints* );
+  void                      buildPrs();
+  void                      buildNodePrs();
+  void                      buildElemPrs();
+  
+private:                                   
+
+  TMapOfIds                 mySMDS2VTKNodes;
+  TMapOfIds                 myVTK2SMDSNodes;
+  TMapOfIds                 mySMDS2VTKElems;
+  TMapOfIds                 myVTK2SMDSElems;
+
+  vtkUnstructuredGrid*      myGrid;
+};
+
+
+/*
+  Class       : SMESH_MeshObj
+  Description : Class for visualisation of mesh
+*/
+
+class SMESH_MeshObj: public SMESH_VisualObjDef
+{
+public:
+
+                            SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
+  virtual                   ~SMESH_MeshObj();
+  
+  virtual void              Update( int theIsClear = true );
+  
+  virtual int               GetNbEntities( const SMDSAbs_ElementType) const;
+  virtual int               GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
+  virtual bool              IsNodePrs() const;
+
+  virtual int               GetElemDimension( const int theObjId );
+
+  virtual void              UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
+  
+  SMESH::SMESH_Mesh_ptr     GetMeshServer() { return myMeshServer.in(); }
+  SMDS_Mesh*                GetMesh() const { return myMesh; }
+
+protected:
+
+  SMESH::SMESH_Mesh_var     myMeshServer;
+  SMDS_Mesh*                myMesh;
+};
+
+
+/*
+  Class       : SMESH_SubMeshObj
+  Description : Base class for visualisation of submeshes and groups
+*/
+
+class SMESH_SubMeshObj: public SMESH_VisualObjDef
+{
+public:
+
+                            SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
+  virtual                   ~SMESH_SubMeshObj();
+
+  virtual void              Update( int theIsClear = true );
+  
+  virtual void              UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
+  virtual int               GetElemDimension( const int theObjId );
+  virtual SMDS_Mesh*        GetMesh() const { return myMeshObj->GetMesh(); }
+  
+protected:
+
+  SMESH_MeshObj*            myMeshObj;
+};
+
+
+/*
+  Class       : SMESH_GroupObj
+  Description : Class for visualisation of groups
+*/
+
+class SMESH_GroupObj: public SMESH_SubMeshObj
+{
+public:
+                            SMESH_GroupObj( SMESH::SMESH_GroupBase_ptr, SMESH_MeshObj* );
+  virtual                   ~SMESH_GroupObj();
+
+  virtual int               GetNbEntities( const SMDSAbs_ElementType) const;
+  virtual int               GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
+  virtual bool              IsNodePrs() const;
+
+private:
+
+  SMESH::SMESH_GroupBase_var    myGroupServer;
+};
+
+
+/*
+  Class       : SMESH_subMeshObj
+  Description : Class for visualisation of submeshes
+*/
+
+class SMESH_subMeshObj : public SMESH_SubMeshObj
+{
+public:
+
+                            SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr, 
+                                              SMESH_MeshObj* );
+  virtual                   ~SMESH_subMeshObj();
+
+  virtual int               GetNbEntities( const SMDSAbs_ElementType) const;
+  virtual int               GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
+  virtual bool              IsNodePrs() const;    
+  
+protected:
+
+  SMESH::SMESH_subMesh_var  mySubMeshServer;
+};
+
+
+#endif
index 6ce749cf047a62ad2fcd9c56d9db49c2dca8aff8..d64abd6fe753a254ba54839f98d59ef05d8c88b4 100644 (file)
@@ -88,6 +88,7 @@ EXPORT_HEADERS= \
        SMDS_TypeOfPosition.hxx \
        SMDSAbs_ElementType.hxx \
        SMDS_EdgePosition.hxx \
        SMDS_TypeOfPosition.hxx \
        SMDSAbs_ElementType.hxx \
        SMDS_EdgePosition.hxx \
+       SMDS_ElemIterator.hxx \
        SMDS_FacePosition.hxx \
        SMDS_Mesh.hxx \
        SMDS_MeshEdge.hxx \
        SMDS_FacePosition.hxx \
        SMDS_Mesh.hxx \
        SMDS_MeshEdge.hxx \
@@ -125,9 +126,9 @@ EXPORT_HEADERS= \
 #SMDS_MeshNodeIDFactory.hxx
 
 # additionnal information to compil and link file
 #SMDS_MeshNodeIDFactory.hxx
 
 # additionnal information to compil and link file
-CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
+CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(OCC_INCLUDES) $(BOOST_CPPFLAGS)
 CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
 CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS  += -L${KERNEL_ROOT_DIR}/lib/salome
+LDFLAGS  += -L${KERNEL_ROOT_DIR}/lib/salome $(OCC_KERNEL_LIBS)
 
 
 # additional file to be cleaned
 
 
 # additional file to be cleaned
diff --git a/src/SMDS/SMDS_ElemIterator.hxx b/src/SMDS/SMDS_ElemIterator.hxx
new file mode 100755 (executable)
index 0000000..c8432af
--- /dev/null
@@ -0,0 +1,40 @@
+//  SMESH SMDS : implementaion of Salome mesh data structure
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMDS_MeshElement.hxx
+//  Module : SMESH
+// Created:   12.01.05 18:02:52
+// Author:    Michael Sazonov
+
+#ifndef SMDS_ElemIterator_HeaderFile
+#define SMDS_ElemIterator_HeaderFile
+
+#include "SMDS_Iterator.hxx"
+#include <boost/shared_ptr.hpp>
+
+class SMDS_MeshElement;
+
+typedef SMDS_Iterator<const SMDS_MeshElement *> SMDS_ElemIterator;
+typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshElement *> > SMDS_ElemIteratorPtr;
+
+#endif
index de9092f447c3d8e6de879f1e82e17452afa76b32..640c55d30194f44cd2835f4164abfaed5bc93a3b 100644 (file)
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
 #include "SMDS_FaceOfEdges.hxx"
 #include "SMDS_IteratorOfElements.hxx"
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_FaceOfEdges.hxx"
 #include "SMDS_IteratorOfElements.hxx"
 #include "SMDS_MeshNode.hxx"
@@ -32,7 +36,7 @@ using namespace std;
 
 int SMDS_FaceOfEdges::NbEdges() const
 {
 
 int SMDS_FaceOfEdges::NbEdges() const
 {
-       return myEdges.size();
+       return myNbEdges;
 }
 
 int SMDS_FaceOfEdges::NbFaces() const
 }
 
 int SMDS_FaceOfEdges::NbFaces() const
@@ -57,17 +61,23 @@ SMDSAbs_ElementType SMDS_FaceOfEdges::GetType() const
        return SMDSAbs_Face;
 }
 
        return SMDSAbs_Face;
 }
 
+//=======================================================================
+//function : elementsIterator
+//purpose  : 
+//=======================================================================
+
 class SMDS_FaceOfEdges_MyIterator:public SMDS_ElemIterator
 {
 class SMDS_FaceOfEdges_MyIterator:public SMDS_ElemIterator
 {
-  const vector<const SMDS_MeshEdge*>& mySet;
+  const SMDS_MeshEdge* const *mySet;
+  int myLength;
   int index;
  public:
   int index;
  public:
-  SMDS_FaceOfEdges_MyIterator(const vector<const SMDS_MeshEdge*>& s):
-    mySet(s),index(0) {}
+  SMDS_FaceOfEdges_MyIterator(const SMDS_MeshEdge* const *s, int l):
+    mySet(s),myLength(l),index(0) {}
 
   bool more()
   {
 
   bool more()
   {
-    return index<mySet.size();
+    return index<myLength;
   }
 
   const SMDS_MeshElement* next()
   }
 
   const SMDS_MeshElement* next()
@@ -76,30 +86,33 @@ class SMDS_FaceOfEdges_MyIterator:public SMDS_ElemIterator
     return mySet[index-1];
   }    
 };
     return mySet[index-1];
   }    
 };
-SMDS_ElemIteratorPtr SMDS_FaceOfEdges::
-       elementsIterator(SMDSAbs_ElementType type) const
+
+SMDS_ElemIteratorPtr SMDS_FaceOfEdges::elementsIterator
+                         (SMDSAbs_ElementType type) const
 {
 {
-       switch(type)
-       {
-       case SMDSAbs_Face:
-          return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
-       case SMDSAbs_Edge:
-          return SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges));
-       default:
-          return SMDS_ElemIteratorPtr
-            (new SMDS_IteratorOfElements
-             (this,type, SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges))));
-       }
+  switch(type)
+  {
+  case SMDSAbs_Face:
+    return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
+  case SMDSAbs_Edge:
+    return SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges,myNbEdges));
+  default:
+    return SMDS_ElemIteratorPtr
+      (new SMDS_IteratorOfElements
+       (this,type, SMDS_ElemIteratorPtr
+        (new SMDS_FaceOfEdges_MyIterator(myEdges,myNbEdges))));
+  }
 }
 
 SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
                                    const SMDS_MeshEdge* edge2,
                                    const SMDS_MeshEdge* edge3)
 {
 }
 
 SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
                                    const SMDS_MeshEdge* edge2,
                                    const SMDS_MeshEdge* edge3)
 {
-       myEdges.resize(3);
+       myNbEdges = 3;
        myEdges[0]=edge1;
        myEdges[1]=edge2;
        myEdges[2]=edge3;
        myEdges[0]=edge1;
        myEdges[1]=edge2;
        myEdges[2]=edge3;
+       myEdges[3]=0;
 }
 
 SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
 }
 
 SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
@@ -107,7 +120,7 @@ SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
                                    const SMDS_MeshEdge* edge3,
                                    const SMDS_MeshEdge* edge4)
 {
                                    const SMDS_MeshEdge* edge3,
                                    const SMDS_MeshEdge* edge4)
 {
-       myEdges.resize(4);
+       myNbEdges = 4;
        myEdges[0]=edge1;
        myEdges[1]=edge2;
        myEdges[2]=edge3;
        myEdges[0]=edge1;
        myEdges[1]=edge2;
        myEdges[2]=edge3;
index 6e8e7b8d620ffec449a973ae1047942c5e1bc2a5..cd8e5dd8f29ee2ca94343860f1ec1b3e86a9191a 100644 (file)
@@ -51,7 +51,8 @@ class SMDS_FaceOfEdges:public SMDS_MeshFace
                elementsIterator(SMDSAbs_ElementType type) const;
 
   private:
                elementsIterator(SMDSAbs_ElementType type) const;
 
   private:
-       std::vector<const SMDS_MeshEdge*> myEdges;
+       const SMDS_MeshEdge* myEdges[4];
+        int                  myNbEdges;
 
 };
 
 
 };
 
index 2ef48ca8a096e0cdd16ddecb0e561ab480ebaaf2..aa687082475c0633983a49b859093ecbd6b5bdca 100644 (file)
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
 #include "SMDS_FaceOfNodes.hxx"
 #include "SMDS_IteratorOfElements.hxx"
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_FaceOfNodes.hxx"
 #include "SMDS_IteratorOfElements.hxx"
 #include "SMDS_MeshNode.hxx"
@@ -43,8 +47,9 @@ int SMDS_FaceOfNodes::NbFaces() const
 
 int SMDS_FaceOfNodes::NbNodes() const
 {
 
 int SMDS_FaceOfNodes::NbNodes() const
 {
-       return myNodes.size();
+       return myNbNodes;
 }
 }
+
 //=======================================================================
 //function : Print
 //purpose  : 
 //=======================================================================
 //function : Print
 //purpose  : 
@@ -58,41 +63,49 @@ void SMDS_FaceOfNodes::Print(ostream & OS) const
        OS << myNodes[i] << ") " << endl;
 }
 
        OS << myNodes[i] << ") " << endl;
 }
 
+//=======================================================================
+//function : elementsIterator
+//purpose  : 
+//=======================================================================
+
 class SMDS_FaceOfNodes_MyIterator:public SMDS_ElemIterator
 {
 class SMDS_FaceOfNodes_MyIterator:public SMDS_ElemIterator
 {
-  const vector<const SMDS_MeshNode*>& mySet;
+  const SMDS_MeshNode* const *mySet;
+  int myLength;
   int index;
  public:
   int index;
  public:
-  SMDS_FaceOfNodes_MyIterator(const vector<const SMDS_MeshNode*>& s):
-    mySet(s),index(0) {}
+  SMDS_FaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l):
+    mySet(s),myLength(l),index(0) {}
 
   bool more()
   {
 
   bool more()
   {
-    return index<mySet.size();
+    return index<myLength;
   }
 
   const SMDS_MeshElement* next()
   {
     index++;
     return mySet[index-1];
   }
 
   const SMDS_MeshElement* next()
   {
     index++;
     return mySet[index-1];
-  }    
+  }
 };
 };
-SMDS_ElemIteratorPtr SMDS_FaceOfNodes::
-       elementsIterator(SMDSAbs_ElementType type) const
+
+SMDS_ElemIteratorPtr SMDS_FaceOfNodes::elementsIterator
+                         (SMDSAbs_ElementType type) const
 {
   switch(type)
   {
   case SMDSAbs_Face:
     return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
   case SMDSAbs_Node:
 {
   switch(type)
   {
   case SMDSAbs_Face:
     return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
   case SMDSAbs_Node:
-    return SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes));
+    return SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes,myNbNodes));
   case SMDSAbs_Edge:
     MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented");
     break;
   default:
     return SMDS_ElemIteratorPtr
       (new SMDS_IteratorOfElements
   case SMDSAbs_Edge:
     MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented");
     break;
   default:
     return SMDS_ElemIteratorPtr
       (new SMDS_IteratorOfElements
-       (this,type,SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes))));
+       (this,type,SMDS_ElemIteratorPtr
+        (new SMDS_FaceOfNodes_MyIterator(myNodes,myNbNodes))));
   }
   return SMDS_ElemIteratorPtr();
 }
   }
   return SMDS_ElemIteratorPtr();
 }
@@ -101,10 +114,11 @@ SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
                                    const SMDS_MeshNode* node2,
                                    const SMDS_MeshNode* node3)
 {
                                    const SMDS_MeshNode* node2,
                                    const SMDS_MeshNode* node3)
 {
-       myNodes.resize(3);
+       myNbNodes = 3;
        myNodes[0]=node1;
        myNodes[1]=node2;
        myNodes[2]=node3;
        myNodes[0]=node1;
        myNodes[1]=node2;
        myNodes[2]=node3;
+       myNodes[3]=0;
 }
 
 SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
 }
 
 SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
@@ -112,7 +126,7 @@ SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
                                    const SMDS_MeshNode* node3,
                                    const SMDS_MeshNode* node4)
 {
                                    const SMDS_MeshNode* node3,
                                    const SMDS_MeshNode* node4)
 {
-       myNodes.resize(4);
+       myNbNodes = 4;
        myNodes[0]=node1;
        myNodes[1]=node2;
        myNodes[2]=node3;
        myNodes[0]=node1;
        myNodes[1]=node2;
        myNodes[2]=node3;
@@ -121,20 +135,13 @@ SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
 bool SMDS_FaceOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
                                    const int            nbNodes)
 {
 bool SMDS_FaceOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
                                    const int            nbNodes)
 {
-  if (nbNodes == 3) {
-    myNodes.resize(3);
-    myNodes[0]=nodes[0];
-    myNodes[1]=nodes[1];
-    myNodes[2]=nodes[2];
-  }
-  else if ( nbNodes == 4) {
-    myNodes.resize(4);
-    myNodes[0]=nodes[0];
-    myNodes[1]=nodes[1];
-    myNodes[2]=nodes[2];
+  myNbNodes = nbNodes;
+  myNodes[0]=nodes[0];
+  myNodes[1]=nodes[1];
+  myNodes[2]=nodes[2];
+  if (nbNodes == 4)
     myNodes[3]=nodes[3];
     myNodes[3]=nodes[3];
-  }
-  else
+  else if (nbNodes != 3)
     return false;
 
   return true;
     return false;
 
   return true;
index 0203c1b105895b5cc4d71e4c5166bd07fe310920..290195107d4844fbd2be02cfd5770209232a703c 100644 (file)
@@ -49,7 +49,8 @@ class SMDS_FaceOfNodes:public SMDS_MeshFace
                elementsIterator(SMDSAbs_ElementType type) const;
 
   private:
                elementsIterator(SMDSAbs_ElementType type) const;
 
   private:
-       std::vector<const SMDS_MeshNode*> myNodes;
+       const SMDS_MeshNode* myNodes[4];
+        int                  myNbNodes;
 
 };
 
 
 };
 
index c18f24d25a837a44bdd34cafc0472119cf03d63a..472ae0d54058883c21e4c9545ec8343ef980d695 100644 (file)
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
 #include "SMDS_IteratorOfElements.hxx"
 
 bool SMDS_IteratorOfElements::subMore()
 {
 #include "SMDS_IteratorOfElements.hxx"
 
 bool SMDS_IteratorOfElements::subMore()
 {
-       if((t2Iterator==NULL)||(!t2Iterator->more()))
+       if((t2Iterator.get()==NULL)||(!t2Iterator->more()))
        {
                if(t1Iterator->more())
                {
        {
                if(t1Iterator->more())
                {
@@ -37,7 +41,7 @@ bool SMDS_IteratorOfElements::subMore()
 
 const SMDS_MeshElement * SMDS_IteratorOfElements::subNext()
 {
 
 const SMDS_MeshElement * SMDS_IteratorOfElements::subNext()
 {
-       if((t2Iterator==NULL)||(!t2Iterator->more()))
+       if((t2Iterator.get()==NULL)||(!t2Iterator->more()))
                if(t1Iterator->more())
                        t2Iterator=t1Iterator->next()->elementsIterator(myType);
        return t2Iterator->next();
                if(t1Iterator->more())
                        t2Iterator=t1Iterator->next()->elementsIterator(myType);
        return t2Iterator->next();
index c2724479742b2e4d39464771a4b83c99baaa4567..aeec4521f909d4aad0349f475cba71e36583eedd 100644 (file)
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
 #include "utilities.h"
 #include "SMDS_Mesh.hxx"
 #include "SMDS_VolumeOfNodes.hxx"
 #include "utilities.h"
 #include "SMDS_Mesh.hxx"
 #include "SMDS_VolumeOfNodes.hxx"
 #include "SMDS_FaceOfEdges.hxx"
 
 #include <algorithm>
 #include "SMDS_FaceOfEdges.hxx"
 
 #include <algorithm>
+#include <map>
 using namespace std;
 
 ///////////////////////////////////////////////////////////////////////////////
 /// Create a new mesh object
 ///////////////////////////////////////////////////////////////////////////////
 SMDS_Mesh::SMDS_Mesh()
 using namespace std;
 
 ///////////////////////////////////////////////////////////////////////////////
 /// Create a new mesh object
 ///////////////////////////////////////////////////////////////////////////////
 SMDS_Mesh::SMDS_Mesh()
-       :myNodeIDFactory(new SMDS_MeshElementIDFactory()),
+       :myParent(NULL),
+        myNodeIDFactory(new SMDS_MeshElementIDFactory()),
        myElementIDFactory(new SMDS_MeshElementIDFactory()),
        myHasConstructionEdges(false), myHasConstructionFaces(false),
        myHasInverseElements(true)
        myElementIDFactory(new SMDS_MeshElementIDFactory()),
        myHasConstructionEdges(false), myHasConstructionFaces(false),
        myHasInverseElements(true)
@@ -86,7 +92,7 @@ SMDS_MeshNode * SMDS_Mesh::AddNodeWithID(double x, double y, double z, int ID)
   const SMDS_MeshElement *node = myNodeIDFactory->MeshElement(ID);
   if(!node){
     SMDS_MeshNode * node=new SMDS_MeshNode(x, y, z);
   const SMDS_MeshElement *node = myNodeIDFactory->MeshElement(ID);
   if(!node){
     SMDS_MeshNode * node=new SMDS_MeshNode(x, y, z);
-    myNodes.insert(node);
+    myNodes.Add(node);
     myNodeIDFactory->BindID(ID,node);
     return node;
   }else
     myNodeIDFactory->BindID(ID,node);
     return node;
   }else
@@ -137,7 +143,7 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
     node2=const_cast<SMDS_MeshNode*>(n2);
     node1->AddInverseElement(edge);
     node2->AddInverseElement(edge);            
     node2=const_cast<SMDS_MeshNode*>(n2);
     node1->AddInverseElement(edge);
     node2->AddInverseElement(edge);            
-    myEdges.insert(edge);
+    myEdges.Add(edge);
     return edge;
   } 
   else {
     return edge;
   } 
   else {
@@ -266,7 +272,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshEdge * e1,
   if (!hasConstructionEdges())
     return NULL;
   SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3);
   if (!hasConstructionEdges())
     return NULL;
   SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3);
-  myFaces.insert(face);
+  myFaces.Add(face);
 
   if (!registerElement(ID, face)) {
     RemoveElement(face, false);
 
   if (!registerElement(ID, face)) {
     RemoveElement(face, false);
@@ -303,7 +309,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshEdge * e1,
   if (!hasConstructionEdges())
     return NULL;
   SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3,e4);
   if (!hasConstructionEdges())
     return NULL;
   SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3,e4);
-  myFaces.insert(face);
+  myFaces.Add(face);
 
   if (!registerElement(ID, face))
   {
 
   if (!registerElement(ID, face))
   {
@@ -370,7 +376,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
     SMDS_MeshFace * f3=FindFaceOrCreate(n1,n3,n4);
     SMDS_MeshFace * f4=FindFaceOrCreate(n2,n3,n4);
     volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4);
     SMDS_MeshFace * f3=FindFaceOrCreate(n1,n3,n4);
     SMDS_MeshFace * f4=FindFaceOrCreate(n2,n3,n4);
     volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4);
-    myVolumes.insert(volume);
+    myVolumes.Add(volume);
   }
   else if(hasConstructionEdges()) {
     MESSAGE("Error : Not implemented");
   }
   else if(hasConstructionEdges()) {
     MESSAGE("Error : Not implemented");
@@ -378,7 +384,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
   }
   else {
     volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4);
   }
   else {
     volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4);
-    myVolumes.insert(volume);
+    myVolumes.Add(volume);
   }
 
   if (!registerElement(ID, volume)) {
   }
 
   if (!registerElement(ID, volume)) {
@@ -452,7 +458,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
     SMDS_MeshFace * f3=FindFaceOrCreate(n2,n3,n5);
     SMDS_MeshFace * f4=FindFaceOrCreate(n3,n4,n5);
     volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4);
     SMDS_MeshFace * f3=FindFaceOrCreate(n2,n3,n5);
     SMDS_MeshFace * f4=FindFaceOrCreate(n3,n4,n5);
     volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4);
-    myVolumes.insert(volume);
+    myVolumes.Add(volume);
   }
   else if(hasConstructionEdges()) {
     MESSAGE("Error : Not implemented");
   }
   else if(hasConstructionEdges()) {
     MESSAGE("Error : Not implemented");
@@ -460,7 +466,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
   }
   else {
     volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5);
   }
   else {
     volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5);
-    myVolumes.insert(volume);
+    myVolumes.Add(volume);
   }
 
   if (!registerElement(ID, volume)) {
   }
 
   if (!registerElement(ID, volume)) {
@@ -539,7 +545,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
     SMDS_MeshFace * f4=FindFaceOrCreate(n2,n5,n6,n3);
     SMDS_MeshFace * f5=FindFaceOrCreate(n3,n6,n4,n1);
     volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5);
     SMDS_MeshFace * f4=FindFaceOrCreate(n2,n5,n6,n3);
     SMDS_MeshFace * f5=FindFaceOrCreate(n3,n6,n4,n1);
     volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5);
-    myVolumes.insert(volume);
+    myVolumes.Add(volume);
   }
   else if(hasConstructionEdges()) {
     MESSAGE("Error : Not implemented");
   }
   else if(hasConstructionEdges()) {
     MESSAGE("Error : Not implemented");
@@ -547,7 +553,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
   }
   else {
     volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5,n6);
   }
   else {
     volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5,n6);
-    myVolumes.insert(volume);
+    myVolumes.Add(volume);
   }
 
   if (!registerElement(ID, volume)) {
   }
 
   if (!registerElement(ID, volume)) {
@@ -638,7 +644,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
     SMDS_MeshFace * f5=FindFaceOrCreate(n2,n3,n7,n6);
     SMDS_MeshFace * f6=FindFaceOrCreate(n3,n4,n8,n7);
     volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6);
     SMDS_MeshFace * f5=FindFaceOrCreate(n2,n3,n7,n6);
     SMDS_MeshFace * f6=FindFaceOrCreate(n3,n4,n8,n7);
     volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6);
-    myVolumes.insert(volume);
+    myVolumes.Add(volume);
   }
   else if(hasConstructionEdges()) {
     MESSAGE("Error : Not implemented");
   }
   else if(hasConstructionEdges()) {
     MESSAGE("Error : Not implemented");
@@ -647,7 +653,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
   else {
 //    volume=new SMDS_HexahedronOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
     volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
   else {
 //    volume=new SMDS_HexahedronOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
     volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
-    myVolumes.insert(volume);
+    myVolumes.Add(volume);
   }
 
   if (!registerElement(ID, volume)) {
   }
 
   if (!registerElement(ID, volume)) {
@@ -687,7 +693,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1,
   if (!hasConstructionFaces())
     return NULL;
   SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4);
   if (!hasConstructionFaces())
     return NULL;
   SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4);
-  myVolumes.insert(volume);
+  myVolumes.Add(volume);
 
   if (!registerElement(ID, volume)) {
     RemoveElement(volume, false);
 
   if (!registerElement(ID, volume)) {
     RemoveElement(volume, false);
@@ -728,7 +734,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1,
   if (!hasConstructionFaces())
     return NULL;
   SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5);
   if (!hasConstructionFaces())
     return NULL;
   SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5);
-  myVolumes.insert(volume);
+  myVolumes.Add(volume);
 
   if (!registerElement(ID, volume)) {
     RemoveElement(volume, false);
 
   if (!registerElement(ID, volume)) {
     RemoveElement(volume, false);
@@ -771,7 +777,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1,
   if (!hasConstructionFaces())
     return NULL;
   SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6);
   if (!hasConstructionFaces())
     return NULL;
   SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6);
-  myVolumes.insert(volume);
+  myVolumes.Add(volume);
 
   if (!registerElement(ID, volume)) {
     RemoveElement(volume, false);
 
   if (!registerElement(ID, volume)) {
     RemoveElement(volume, false);
@@ -821,13 +827,13 @@ SMDS_MeshFace * SMDS_Mesh::createTriangle(const SMDS_MeshNode * node1,
                edge3=FindEdgeOrCreate(node3,node1);
 
                SMDS_MeshFace * face = new SMDS_FaceOfEdges(edge1,edge2,edge3);
                edge3=FindEdgeOrCreate(node3,node1);
 
                SMDS_MeshFace * face = new SMDS_FaceOfEdges(edge1,edge2,edge3);
-               myFaces.insert(face);
+               myFaces.Add(face);
                return face;
        }
        else
        {
                SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3);
                return face;
        }
        else
        {
                SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3);
-               myFaces.insert(face);
+               myFaces.Add(face);
                return face;
        }
 }
                return face;
        }
 }
@@ -850,13 +856,13 @@ SMDS_MeshFace * SMDS_Mesh::createQuadrangle(const SMDS_MeshNode * node1,
                edge4=FindEdgeOrCreate(node4,node1);
 
                SMDS_MeshFace * face = new SMDS_FaceOfEdges(edge1,edge2,edge3,edge4);
                edge4=FindEdgeOrCreate(node4,node1);
 
                SMDS_MeshFace * face = new SMDS_FaceOfEdges(edge1,edge2,edge3,edge4);
-               myFaces.insert(face);
+               myFaces.Add(face);
                return face;
        }
        else
        {
                SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3,node4);
                return face;
        }
        else
        {
                SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3,node4);
-               myFaces.insert(face);
+               myFaces.Add(face);
                return face;
        }
 }
                return face;
        }
 }
@@ -1051,7 +1057,7 @@ SMDS_MeshEdge* SMDS_Mesh::FindEdgeOrCreate(const SMDS_MeshNode * node1,
        if(toReturn==NULL)      
        {
           toReturn=new SMDS_MeshEdge(node1,node2);
        if(toReturn==NULL)      
        {
           toReturn=new SMDS_MeshEdge(node1,node2);
-          myEdges.insert(toReturn);
+          myEdges.Add(toReturn);
        } 
        return toReturn;
 }
        } 
        return toReturn;
 }
@@ -1289,7 +1295,7 @@ void SMDS_Mesh::DebugStats() const
 ///////////////////////////////////////////////////////////////////////////////
 int SMDS_Mesh::NbNodes() const
 {
 ///////////////////////////////////////////////////////////////////////////////
 int SMDS_Mesh::NbNodes() const
 {
-       return myNodes.size();
+       return myNodes.Size();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1297,7 +1303,7 @@ int SMDS_Mesh::NbNodes() const
 ///////////////////////////////////////////////////////////////////////////////
 int SMDS_Mesh::NbEdges() const
 {
 ///////////////////////////////////////////////////////////////////////////////
 int SMDS_Mesh::NbEdges() const
 {
-       return myEdges.size();
+       return myEdges.Size();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1305,7 +1311,7 @@ int SMDS_Mesh::NbEdges() const
 ///////////////////////////////////////////////////////////////////////////////
 int SMDS_Mesh::NbFaces() const
 {
 ///////////////////////////////////////////////////////////////////////////////
 int SMDS_Mesh::NbFaces() const
 {
-       return myFaces.size();
+       return myFaces.Size();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1313,7 +1319,7 @@ int SMDS_Mesh::NbFaces() const
 ///////////////////////////////////////////////////////////////////////////////
 int SMDS_Mesh::NbVolumes() const
 {
 ///////////////////////////////////////////////////////////////////////////////
 int SMDS_Mesh::NbVolumes() const
 {
-       return myVolumes.size();
+       return myVolumes.Size();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1332,45 +1338,49 @@ int SMDS_Mesh::NbSubMesh() const
 ///////////////////////////////////////////////////////////////////////////////
 SMDS_Mesh::~SMDS_Mesh()
 {
 ///////////////////////////////////////////////////////////////////////////////
 SMDS_Mesh::~SMDS_Mesh()
 {
-       if(myParent==NULL)
-       {
-               delete myNodeIDFactory;
-               delete myElementIDFactory;
-       }
+  list<SMDS_Mesh*>::iterator itc=myChildren.begin();
+  while(itc!=myChildren.end())
+  {
+    delete *itc;
+    itc++;
+  }
 
 
-       list<SMDS_Mesh*>::iterator itc=myChildren.begin();
-       while(itc!=myChildren.end())
-       {
-               delete *itc;
-               itc++;
-       }
-       
-       SMDS_NodeIteratorPtr itn=nodesIterator();
-       while(itn->more())
-       {
-               delete itn->next();
-       }
+  SetOfNodes::Iterator itn(myNodes);
+  for (; itn.More(); itn.Next())
+    delete itn.Value();
 
 
-       set<SMDS_MeshEdge*>::iterator ite=myEdges.begin();
-       while(ite!=myEdges.end())
-       {
-               delete *ite;
-               ite++;
-       }
+  SetOfEdges::Iterator ite(myEdges);
+  for (; ite.More(); ite.Next())
+  {
+    SMDS_MeshElement* elem = ite.Value();
+    if(myParent!=NULL)
+      myElementIDFactory->ReleaseID(elem->GetID());
+    delete elem;
+  }
 
 
-       set<SMDS_MeshFace*>::iterator itf=myFaces.begin();
-       while(itf!=myFaces.end())
-       {
-               delete *itf;
-               itf++;
-       }
+  SetOfFaces::Iterator itf(myFaces);
+  for (; itf.More(); itf.Next())
+  {
+    SMDS_MeshElement* elem = itf.Value();
+    if(myParent!=NULL)
+      myElementIDFactory->ReleaseID(elem->GetID());
+    delete elem;
+  }
 
 
-       set<SMDS_MeshVolume*>::iterator itv=myVolumes.begin();
-       while(itv!=myVolumes.end())
-       {
-               delete *itv;
-               itv++;
-       }
+  SetOfVolumes::Iterator itv(myVolumes);
+  for (; itv.More(); itv.Next())
+  {
+    SMDS_MeshElement* elem = itv.Value();
+    if(myParent!=NULL)
+      myElementIDFactory->ReleaseID(elem->GetID());
+    delete elem;
+  }
+
+  if(myParent==NULL)
+  {
+    delete myNodeIDFactory;
+    delete myElementIDFactory;
+  }
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1433,100 +1443,68 @@ void SMDS_Mesh::setInverseElements(bool b)
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-/// Return an iterator on nodes of the current mesh
+/// Return an iterator on nodes of the current mesh factory
 ///////////////////////////////////////////////////////////////////////////////
 class SMDS_Mesh_MyNodeIterator:public SMDS_NodeIterator
 {
 ///////////////////////////////////////////////////////////////////////////////
 class SMDS_Mesh_MyNodeIterator:public SMDS_NodeIterator
 {
-  const SMDS_IdElementMap&          myIdElemMap;
-  SMDS_IdElementMap::const_iterator myIterator;
+  SMDS_ElemIteratorPtr myIterator;
  public:
  public:
-  SMDS_Mesh_MyNodeIterator(const SMDS_IdElementMap& s):myIdElemMap(s)
-  {
-    myIterator=myIdElemMap.begin();
-  }
+  SMDS_Mesh_MyNodeIterator(const SMDS_ElemIteratorPtr& it):myIterator(it)
+  {}
 
   bool more()
   {
 
   bool more()
   {
-    return myIterator!=myIdElemMap.end();
+    return myIterator->more();
   }
 
   const SMDS_MeshNode* next()
   {
   }
 
   const SMDS_MeshNode* next()
   {
-    const SMDS_MeshElement* current=(*myIterator).second;
-    myIterator++;
-    return static_cast<const SMDS_MeshNode*>( current );
+    return static_cast<const SMDS_MeshNode*>(myIterator->next());
   }
 };
 
 SMDS_NodeIteratorPtr SMDS_Mesh::nodesIterator() const
 {
   return SMDS_NodeIteratorPtr
   }
 };
 
 SMDS_NodeIteratorPtr SMDS_Mesh::nodesIterator() const
 {
   return SMDS_NodeIteratorPtr
-    (new SMDS_Mesh_MyNodeIterator(myNodeIDFactory->GetIdElementMap()));
+    (new SMDS_Mesh_MyNodeIterator(myNodeIDFactory->elementsIterator()));
 }
 }
+
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
-/// Return an iterator on nodes of the current mesh
+/// Return an iterator on elements of the current mesh factory
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
-class SMDS_Mesh_MyElemIterator:public SMDS_ElemIterator
-{
-  const SMDS_IdElementMap&          myIdElemMap;
-  SMDS_IdElementMap::const_iterator myIterator;
- public:
-  SMDS_Mesh_MyElemIterator(const SMDS_IdElementMap& s):myIdElemMap(s)
-  {
-    myIterator=myIdElemMap.begin();
-  }
-
-  bool more()
-  {
-    return myIterator!=myIdElemMap.end();
-  }
-
-  const SMDS_MeshElement* next()
-  {
-    const SMDS_MeshElement* current=(*myIterator).second;
-    myIterator++;
-    return current;    
-  }
-};
-
 SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator() const
 {
 SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator() const
 {
-  return SMDS_ElemIteratorPtr
-    (new SMDS_Mesh_MyElemIterator(myElementIDFactory->GetIdElementMap()));
+  return myElementIDFactory->elementsIterator();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-///Return an iterator on volumes of the current mesh.
+///Return an iterator on edges of the current mesh.
 ///////////////////////////////////////////////////////////////////////////////
 class SMDS_Mesh_MyEdgeIterator:public SMDS_EdgeIterator
 {
   typedef SMDS_Mesh::SetOfEdges SetOfEdges;
 ///////////////////////////////////////////////////////////////////////////////
 class SMDS_Mesh_MyEdgeIterator:public SMDS_EdgeIterator
 {
   typedef SMDS_Mesh::SetOfEdges SetOfEdges;
-  const SetOfEdges& mySet;
-  const SMDS_MeshEdge * myEdge;
-  SetOfEdges::iterator myIterator;
+  SetOfEdges::Iterator myIterator;
  public:
  public:
-  SMDS_Mesh_MyEdgeIterator(const SetOfEdges& s):mySet(s)
-  {
-    myIterator=mySet.begin();
-  }
+  SMDS_Mesh_MyEdgeIterator(const SetOfEdges& s):myIterator(s)
+  {}
 
   bool more()
   {
 
   bool more()
   {
-    while((myIterator!=mySet.end()))
+    while(myIterator.More())
     {
     {
-      if((*myIterator)->GetID()!=-1)
+      if(myIterator.Value()->GetID()!=-1)
         return true;
         return true;
-      myIterator++;
+      myIterator.Next();
     }
     return false;
   }
 
   const SMDS_MeshEdge* next()
   {
     }
     return false;
   }
 
   const SMDS_MeshEdge* next()
   {
-    const SMDS_MeshEdge* current=*myIterator;
-    myIterator++;
-    return current;    
-  }    
+    const SMDS_MeshEdge* current = myIterator.Value();
+    myIterator.Next();
+    return current;
+  }
 };
 
 SMDS_EdgeIteratorPtr SMDS_Mesh::edgesIterator() const
 };
 
 SMDS_EdgeIteratorPtr SMDS_Mesh::edgesIterator() const
@@ -1535,37 +1513,33 @@ SMDS_EdgeIteratorPtr SMDS_Mesh::edgesIterator() const
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-///Return an iterator on faces of the current mesh. Once used this iterator
-///must be free by the caller
+///Return an iterator on faces of the current mesh.
 ///////////////////////////////////////////////////////////////////////////////
 class SMDS_Mesh_MyFaceIterator:public SMDS_FaceIterator
 {
   typedef SMDS_Mesh::SetOfFaces SetOfFaces;
 ///////////////////////////////////////////////////////////////////////////////
 class SMDS_Mesh_MyFaceIterator:public SMDS_FaceIterator
 {
   typedef SMDS_Mesh::SetOfFaces SetOfFaces;
-  const SetOfFaces& mySet;
-  SetOfFaces::iterator myIterator;
+  SetOfFaces::Iterator myIterator;
  public:
  public:
-  SMDS_Mesh_MyFaceIterator(const SetOfFaces& s):mySet(s)
-  {
-    myIterator=mySet.begin();
-  }
+  SMDS_Mesh_MyFaceIterator(const SetOfFaces& s):myIterator(s)
+  {}
 
   bool more()
   {
 
   bool more()
   {
-    while((myIterator!=mySet.end()))
+    while(myIterator.More())
     {
     {
-      if((*myIterator)->GetID()!=-1)
+      if(myIterator.Value()->GetID()!=-1)
         return true;
         return true;
-      myIterator++;
+      myIterator.Next();
     }
     return false;
   }
 
   const SMDS_MeshFace* next()
   {
     }
     return false;
   }
 
   const SMDS_MeshFace* next()
   {
-    const SMDS_MeshFace* current=*myIterator;
-    myIterator++;
-    return current;    
-  }    
+    const SMDS_MeshFace* current = myIterator.Value();
+    myIterator.Next();
+    return current;
+  }
 };
 
 SMDS_FaceIteratorPtr SMDS_Mesh::facesIterator() const
 };
 
 SMDS_FaceIteratorPtr SMDS_Mesh::facesIterator() const
@@ -1574,31 +1548,27 @@ SMDS_FaceIteratorPtr SMDS_Mesh::facesIterator() const
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-///Return an iterator on volumes of the current mesh. Once used this iterator
-///must be free by the caller
+///Return an iterator on volumes of the current mesh.
 ///////////////////////////////////////////////////////////////////////////////
 class SMDS_Mesh_MyVolumeIterator:public SMDS_VolumeIterator
 {
   typedef SMDS_Mesh::SetOfVolumes SetOfVolumes;
 ///////////////////////////////////////////////////////////////////////////////
 class SMDS_Mesh_MyVolumeIterator:public SMDS_VolumeIterator
 {
   typedef SMDS_Mesh::SetOfVolumes SetOfVolumes;
-  const SetOfVolumes& mySet;
-  SetOfVolumes::iterator myIterator;
+  SetOfVolumes::Iterator myIterator;
  public:
  public:
-  SMDS_Mesh_MyVolumeIterator(const SetOfVolumes& s):mySet(s)
-  {
-    myIterator=mySet.begin();
-  }
+  SMDS_Mesh_MyVolumeIterator(const SetOfVolumes& s):myIterator(s)
+  {}
 
   bool more()
   {
 
   bool more()
   {
-    return myIterator!=mySet.end();
+    return myIterator.More() != Standard_False;
   }
 
   const SMDS_MeshVolume* next()
   {
   }
 
   const SMDS_MeshVolume* next()
   {
-    const SMDS_MeshVolume* current=*myIterator;
-    myIterator++;
-    return current;    
-  }    
+    const SMDS_MeshVolume* current = myIterator.Value();
+    myIterator.Next();
+    return current;
+  }
 };
 
 SMDS_VolumeIteratorPtr SMDS_Mesh::volumesIterator() const
 };
 
 SMDS_VolumeIteratorPtr SMDS_Mesh::volumesIterator() const
@@ -1634,7 +1604,9 @@ static set<const SMDS_MeshElement*> * intersectionOfSets(
 static set<const SMDS_MeshElement*> * getFinitElements(const SMDS_MeshElement * element)
 {
        int numberOfSets=element->NbNodes();
 static set<const SMDS_MeshElement*> * getFinitElements(const SMDS_MeshElement * element)
 {
        int numberOfSets=element->NbNodes();
-       set<const SMDS_MeshElement*> initSet[numberOfSets];
+       auto_ptr<set<const SMDS_MeshElement*> > pInitSet
+         (new set<const SMDS_MeshElement*>[numberOfSets]);
+       set<const SMDS_MeshElement*> *initSet = &(*pInitSet);
 
        SMDS_ElemIteratorPtr itNodes=element->nodesIterator();
 
 
        SMDS_ElemIteratorPtr itNodes=element->nodesIterator();
 
@@ -1822,15 +1794,15 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement *        elem,
       MESSAGE("Internal Error: This should not happen");
       break;
     case SMDSAbs_Edge:
       MESSAGE("Internal Error: This should not happen");
       break;
     case SMDSAbs_Edge:
-      myEdges.erase(static_cast<SMDS_MeshEdge*>
+      myEdges.Remove(static_cast<SMDS_MeshEdge*>
                     (const_cast<SMDS_MeshElement*>(*it)));
       break;
     case SMDSAbs_Face:
                     (const_cast<SMDS_MeshElement*>(*it)));
       break;
     case SMDSAbs_Face:
-      myFaces.erase(static_cast<SMDS_MeshFace*>
+      myFaces.Remove(static_cast<SMDS_MeshFace*>
                     (const_cast<SMDS_MeshElement*>(*it)));
       break;
     case SMDSAbs_Volume:
                     (const_cast<SMDS_MeshElement*>(*it)));
       break;
     case SMDSAbs_Volume:
-      myVolumes.erase(static_cast<SMDS_MeshVolume*>
+      myVolumes.Remove(static_cast<SMDS_MeshVolume*>
                       (const_cast<SMDS_MeshElement*>(*it)));
       break;
     }
                       (const_cast<SMDS_MeshElement*>(*it)));
       break;
     }
@@ -1848,7 +1820,7 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement *        elem,
     while(it!=s2->end())
     {
       //MESSAGE( "SMDS: RM node " << (*it)->GetID() );
     while(it!=s2->end())
     {
       //MESSAGE( "SMDS: RM node " << (*it)->GetID() );
-      myNodes.erase(static_cast<SMDS_MeshNode*>
+      myNodes.Remove(static_cast<SMDS_MeshNode*>
                     (const_cast<SMDS_MeshElement*>(*it)));
       myNodeIDFactory->ReleaseID((*it)->GetID());
       removedNodes.push_back( (*it) );
                     (const_cast<SMDS_MeshElement*>(*it)));
       myNodeIDFactory->ReleaseID((*it)->GetID());
       removedNodes.push_back( (*it) );
@@ -1941,23 +1913,27 @@ void SMDS_Mesh::Renumber (const bool isNodes, const int  startID, const int  del
   SMDS_MeshElementIDFactory * idFactory =
     isNodes ? myNodeIDFactory : myElementIDFactory;
 
   SMDS_MeshElementIDFactory * idFactory =
     isNodes ? myNodeIDFactory : myElementIDFactory;
 
-  // get existing elements in the order of ID increasing and release their ids
-  list< SMDS_MeshElement * > elemList;
-  const SMDS_IdElementMap& idElemMap = idFactory->GetIdElementMap();
-  SMDS_IdElementMap::const_iterator idElemIt = idElemMap.begin();
-  while ( idElemIt != idElemMap.end() ) {
-    SMDS_MeshElement* elem = (*idElemIt).second;
-    int id = (*idElemIt).first;
-    idElemIt++;
-    elemList.push_back( elem );
+  // get existing elements in the order of ID increasing
+  map<int,SMDS_MeshElement*> elemMap;
+  SMDS_ElemIteratorPtr idElemIt = idFactory->elementsIterator();
+  while ( idElemIt->more() ) {
+    SMDS_MeshElement* elem = const_cast<SMDS_MeshElement*>(idElemIt->next());
+    int id = elem->GetID();
+    elemMap.insert(map<int,SMDS_MeshElement*>::value_type(id, elem));
+  }
+  // release their ids
+  map<int,SMDS_MeshElement*>::iterator elemIt = elemMap.begin();
+  for ( ; elemIt != elemMap.end(); elemIt++ )
+  {
+    int id = (*elemIt).first;
     idFactory->ReleaseID( id );
   }
   // set new IDs
   int ID = startID;
     idFactory->ReleaseID( id );
   }
   // set new IDs
   int ID = startID;
-  list< SMDS_MeshElement * >::iterator elemIt = elemList.begin();
-  for ( ; elemIt != elemList.end(); elemIt++ )
+  elemIt = elemMap.begin();
+  for ( ; elemIt != elemMap.end(); elemIt++ )
   {
   {
-    idFactory->BindID( ID, *elemIt );
+    idFactory->BindID( ID, (*elemIt).second );
     ID += deltaID;
   }
 }
     ID += deltaID;
   }
 }
index cdcc9166b011e593385bb5f59de16f2677ff4d28..1aa9dda929b099a928470653511f18faefdef086 100644 (file)
@@ -32,7 +32,8 @@
 #include "SMDS_MeshFace.hxx"
 #include "SMDS_MeshVolume.hxx"
 #include "SMDS_MeshElementIDFactory.hxx"
 #include "SMDS_MeshFace.hxx"
 #include "SMDS_MeshVolume.hxx"
 #include "SMDS_MeshElementIDFactory.hxx"
-#include "SMDS_Iterator.hxx"
+#include "SMDS_ElemIterator.hxx"
+#include <NCollection_Map.hxx>
 
 #include <boost/shared_ptr.hpp>
 #include <set>
 
 #include <boost/shared_ptr.hpp>
 #include <set>
@@ -268,10 +269,10 @@ public:
    */
   bool Contains (const SMDS_MeshElement* elem) const;
 
    */
   bool Contains (const SMDS_MeshElement* elem) const;
 
-  typedef std::set<SMDS_MeshNode *> SetOfNodes;
-  typedef std::set<SMDS_MeshEdge *> SetOfEdges;
-  typedef std::set<SMDS_MeshFace *> SetOfFaces;
-  typedef std::set<SMDS_MeshVolume *> SetOfVolumes;
+  typedef NCollection_Map<SMDS_MeshNode *> SetOfNodes;
+  typedef NCollection_Map<SMDS_MeshEdge *> SetOfEdges;
+  typedef NCollection_Map<SMDS_MeshFace *> SetOfFaces;
+  typedef NCollection_Map<SMDS_MeshVolume *> SetOfVolumes;
 
 private:
   SMDS_Mesh(SMDS_Mesh * parent);
 
 private:
   SMDS_Mesh(SMDS_Mesh * parent);
index 6407231478f0220392a79d1bd6ba904755f3e1ba..66c8ae3d5cf36edf2e0ff37545f40a6e4d2e4b43 100644 (file)
@@ -25,6 +25,9 @@
 //  Author : Jean-Michel BOULCOURT
 //  Module : SMESH
 
 //  Author : Jean-Michel BOULCOURT
 //  Module : SMESH
 
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
 
 #include "SMDS_MeshEdge.hxx"
 #include "SMDS_IteratorOfElements.hxx"
 
 #include "SMDS_MeshEdge.hxx"
 #include "SMDS_IteratorOfElements.hxx"
index bf4564f9004d95dcac8b1c41c71112193fa206e2..8d4d9b75dc2e0bb913603c73ac5a5fefb72f9887 100644 (file)
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_MeshEdge.hxx"
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_MeshEdge.hxx"
index 607ab3caf74b78204311c7bd1f40cebebd4f81cb..3d9d13afe40d2298918c7ccfb68d4d642f219a2b 100644 (file)
        
 #include "SMDSAbs_ElementType.hxx"
 #include "SMDS_MeshObject.hxx"
        
 #include "SMDSAbs_ElementType.hxx"
 #include "SMDS_MeshObject.hxx"
-#include "SMDS_Iterator.hxx"
+#include "SMDS_ElemIterator.hxx"
 #include "SMDS_MeshElementIDFactory.hxx"
 
 #include "SMDS_MeshElementIDFactory.hxx"
 
-#include <boost/shared_ptr.hpp>
 #include <vector>
 #include <iostream>
 
 class SMDS_MeshNode;
 class SMDS_MeshEdge;
 class SMDS_MeshFace;   
 #include <vector>
 #include <iostream>
 
 class SMDS_MeshNode;
 class SMDS_MeshEdge;
 class SMDS_MeshFace;   
-class SMDS_MeshElement;
-
-typedef SMDS_Iterator<const SMDS_MeshElement *> SMDS_ElemIterator;
-typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshElement *> > SMDS_ElemIteratorPtr;
 
 ///////////////////////////////////////////////////////////////////////////////
 /// Base class for elements
 
 ///////////////////////////////////////////////////////////////////////////////
 /// Base class for elements
index 456d16a15432aa802f3d47d1e3881880aacc2e5d..8fc09230bcb723997876679cd22bcffa8b939bb7 100644 (file)
@@ -25,6 +25,9 @@
 //  Author : Jean-Michel BOULCOURT
 //  Module : SMESH
 
 //  Author : Jean-Michel BOULCOURT
 //  Module : SMESH
 
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
 
 #include "SMDS_MeshElementIDFactory.hxx"
 #include "SMDS_MeshElement.hxx"
 
 #include "SMDS_MeshElementIDFactory.hxx"
 #include "SMDS_MeshElement.hxx"
@@ -35,7 +38,9 @@ using namespace std;
 //function : SMDS_MeshElementIDFactory
 //purpose  : 
 //=======================================================================
 //function : SMDS_MeshElementIDFactory
 //purpose  : 
 //=======================================================================
-SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():SMDS_MeshIDFactory()
+SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():
+  SMDS_MeshIDFactory(),
+  myMin(0), myMax(0)
 {
 }
 
 {
 }
 
@@ -45,10 +50,12 @@ SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():SMDS_MeshIDFactory()
 //=======================================================================
 bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
 {
 //=======================================================================
 bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
 {
-       bool bound=myIDElements.insert(
-               map<int, SMDS_MeshElement*>::value_type(ID,elem)).second;
-       if(bound) elem->myID=ID;
-       return bound;
+  if (myIDElements.IsBound(ID))
+    return false;
+  myIDElements.Bind(ID,elem);
+  elem->myID=ID;
+  updateMinMax (ID);
+  return true;
 }
 
 //=======================================================================
 }
 
 //=======================================================================
@@ -57,8 +64,9 @@ bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
 //=======================================================================
 SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
 {
 //=======================================================================
 SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
 {
-    map<int, SMDS_MeshElement*>::iterator it=myIDElements.find(ID);
-    if(it==myIDElements.end()) return NULL; else return (*it).second;
+  if (!myIDElements.IsBound(ID))
+    return NULL;
+  return myIDElements.Find(ID);
 }
 
 
 }
 
 
@@ -71,7 +79,7 @@ int SMDS_MeshElementIDFactory::GetFreeID()
   int ID;
   do {
     ID = SMDS_MeshIDFactory::GetFreeID();
   int ID;
   do {
     ID = SMDS_MeshIDFactory::GetFreeID();
-  } while (myIDElements.find(ID) != myIDElements.end());
+  } while (myIDElements.IsBound(ID));
   return ID;
 }
 
   return ID;
 }
 
@@ -81,8 +89,12 @@ int SMDS_MeshElementIDFactory::GetFreeID()
 //=======================================================================
 void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
 {
 //=======================================================================
 void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
 {
-  myIDElements.erase(ID);
+  myIDElements.UnBind(ID);
   SMDS_MeshIDFactory::ReleaseID(ID);
   SMDS_MeshIDFactory::ReleaseID(ID);
+  if (ID == myMax)
+    myMax = 0;
+  if (ID == myMin)
+    myMin = 0;
 }
 
 //=======================================================================
 }
 
 //=======================================================================
@@ -92,11 +104,9 @@ void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
 
 int SMDS_MeshElementIDFactory::GetMaxID() const
 {
 
 int SMDS_MeshElementIDFactory::GetMaxID() const
 {
-  map<int, SMDS_MeshElement*>::const_reverse_iterator it = myIDElements.rbegin();
-  if ( it !=  myIDElements.rend() )
-    return (*it).first;
-
-  return 0;
+  if (myMax == 0)
+    updateMinMax();
+  return myMax;
 }
 
 //=======================================================================
 }
 
 //=======================================================================
@@ -106,10 +116,54 @@ int SMDS_MeshElementIDFactory::GetMaxID() const
 
 int SMDS_MeshElementIDFactory::GetMinID() const
 {
 
 int SMDS_MeshElementIDFactory::GetMinID() const
 {
-  map<int, SMDS_MeshElement*>::const_iterator it = myIDElements.begin();
-  if ( it !=  myIDElements.end() )
-    return (*it).first;
+  if (myMin == 0)
+    updateMinMax();
+  return myMin;
+}
 
 
-  return 0;
+//=======================================================================
+//function : updateMinMax
+//purpose  : 
+//=======================================================================
+
+void SMDS_MeshElementIDFactory::updateMinMax() const
+{
+  myMin = IntegerLast();
+  myMax = 0;
+  SMDS_IdElementMap::Iterator it(myIDElements);
+  for (; it.More(); it.Next())
+    updateMinMax (it.Key());
+  if (myMin == IntegerLast())
+    myMin = 0;
 }
 
 }
 
+//=======================================================================
+//function : elementsIterator
+//purpose  : Return an iterator on elements of the factory
+//=======================================================================
+
+class SMDS_Fact_MyElemIterator:public SMDS_ElemIterator
+{
+  SMDS_IdElementMap::Iterator myIterator;
+ public:
+  SMDS_Fact_MyElemIterator(const SMDS_IdElementMap& s):myIterator(s)
+  {}
+
+  bool more()
+  {
+    return myIterator.More() != Standard_False;
+  }
+
+  const SMDS_MeshElement* next()
+  {
+    const SMDS_MeshElement* current = myIterator.Value();
+    myIterator.Next();
+    return current;
+  }
+};
+
+SMDS_ElemIteratorPtr SMDS_MeshElementIDFactory::elementsIterator() const
+{
+  return SMDS_ElemIteratorPtr
+    (new SMDS_Fact_MyElemIterator(myIDElements));
+}
index 932ad057cd715fc64e10ec9f9442ddbfdd889699..526bcb5a051e773eee12cfe94c3a563a264ce9b4 100644 (file)
 #define _SMDS_MeshElementIDFactory_HeaderFile
 
 #include "SMDS_MeshIDFactory.hxx"
 #define _SMDS_MeshElementIDFactory_HeaderFile
 
 #include "SMDS_MeshIDFactory.hxx"
+#include "SMDS_ElemIterator.hxx"
 
 
-#include <map>
+#include <NCollection_DataMap.hxx>
 
 class SMDS_MeshElement;
 
 
 class SMDS_MeshElement;
 
-typedef std::map<int, SMDS_MeshElement *> SMDS_IdElementMap;
+typedef NCollection_DataMap<int, SMDS_MeshElement *> SMDS_IdElementMap;
 
 class SMDS_MeshElementIDFactory:public SMDS_MeshIDFactory
 {
 
 class SMDS_MeshElementIDFactory:public SMDS_MeshIDFactory
 {
-  public:
-       SMDS_MeshElementIDFactory();
-       bool BindID(int ID, SMDS_MeshElement * elem);
-       SMDS_MeshElement * MeshElement(int ID);
-       virtual int GetFreeID();
-       virtual void ReleaseID(int ID);
-       int GetMaxID() const;
-       int GetMinID() const;
-        const SMDS_IdElementMap & GetIdElementMap() const { return myIDElements; }
-  private:
-       SMDS_IdElementMap myIDElements;
+public:
+  SMDS_MeshElementIDFactory();
+  bool BindID(int ID, SMDS_MeshElement * elem);
+  SMDS_MeshElement * MeshElement(int ID);
+  virtual int GetFreeID();
+  virtual void ReleaseID(int ID);
+  int GetMaxID() const;
+  int GetMinID() const;
+  SMDS_ElemIteratorPtr elementsIterator() const;
+private:
+  void updateMinMax() const;
+  void updateMinMax(int id) const
+  {
+    if (id > myMax) myMax = id;
+    if (id < myMin) myMin = id;
+  }
+
+  SMDS_IdElementMap myIDElements;
+  mutable int myMin, myMax;
 
 };
 
 
 };
 
index 6a255e152c357dee9c22e5a16254aec6169b0374..0acb246a8bfd32d8477fc6009e33f352ea766810 100644 (file)
 //  Author : Jean-Michel BOULCOURT
 //  Module : SMESH
 
 //  Author : Jean-Michel BOULCOURT
 //  Module : SMESH
 
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
 #include "SMDS_MeshGroup.hxx"
 #include "utilities.h"
 
 #include "SMDS_MeshGroup.hxx"
 #include "utilities.h"
 
index 69084c5b95771759860b8890f64baaedfcf96f9d..ef2264c12f695c5776cce27251c88a38df5eb993 100644 (file)
@@ -65,7 +65,7 @@ class SMDS_MeshGroup:public SMDS_MeshObject
        SMDS_MeshGroup(SMDS_MeshGroup* theParent,
                        const SMDSAbs_ElementType theType = SMDSAbs_All);
 
        SMDS_MeshGroup(SMDS_MeshGroup* theParent,
                        const SMDSAbs_ElementType theType = SMDSAbs_All);
 
-        typedef std::set<const SMDS_MeshElement *>::iterator TIterator;
+        typedef std::set<const SMDS_MeshElement *>::const_iterator TIterator;
        const SMDS_Mesh *                       myMesh;
        SMDSAbs_ElementType                     myType;
        std::set<const SMDS_MeshElement *>      myElements;
        const SMDS_Mesh *                       myMesh;
        SMDSAbs_ElementType                     myType;
        std::set<const SMDS_MeshElement *>      myElements;
index c672fe702e0d856e35453df8204b4036653246f7..06ab12173d871505c7ab482c4937e6796ea01b2c 100644 (file)
@@ -19,6 +19,9 @@
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
 
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_SpacePosition.hxx"
 
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_SpacePosition.hxx"
@@ -44,7 +47,14 @@ SMDS_MeshNode::SMDS_MeshNode(double x, double y, double z):
 
 void SMDS_MeshNode::RemoveInverseElement(const SMDS_MeshElement * parent)
 {
 
 void SMDS_MeshNode::RemoveInverseElement(const SMDS_MeshElement * parent)
 {
-       myInverseElements.erase(parent);
+  NCollection_List<const SMDS_MeshElement*>::Iterator it(myInverseElements);
+  while (it.More()) {
+    const SMDS_MeshElement* elem = it.Value();
+    if (elem == parent)
+      myInverseElements.Remove(it);
+    else
+      it.Next();
+  }
 }
 
 //=======================================================================
 }
 
 //=======================================================================
@@ -80,25 +90,22 @@ const SMDS_PositionPtr& SMDS_MeshNode::GetPosition() const
 
 class SMDS_MeshNode_MyInvIterator:public SMDS_ElemIterator
 {
 
 class SMDS_MeshNode_MyInvIterator:public SMDS_ElemIterator
 {
-  const set<const SMDS_MeshElement*>& mySet;
-  set<const SMDS_MeshElement*>::iterator myIterator;
+  NCollection_List<const SMDS_MeshElement*>::Iterator myIterator;
  public:
  public:
-  SMDS_MeshNode_MyInvIterator(const set<const SMDS_MeshElement*>& s):
-    mySet(s)
-  {
-    myIterator=mySet.begin();
-  }
+  SMDS_MeshNode_MyInvIterator(const NCollection_List<const SMDS_MeshElement*>& s):
+    myIterator(s)
+  {}
 
   bool more()
   {
 
   bool more()
   {
-    return myIterator!=mySet.end();
+    return myIterator.More() != Standard_False;
   }
 
   const SMDS_MeshElement* next()
   {
   }
 
   const SMDS_MeshElement* next()
   {
-    const SMDS_MeshElement* current=*myIterator;
-    myIterator++;
-    return current;    
+    const SMDS_MeshElement* current=myIterator.Value();
+    myIterator.Next();
+    return current;
   }    
 };
 
   }    
 };
 
@@ -112,39 +119,38 @@ SMDS_ElemIteratorPtr SMDS_MeshNode::
 // wanted type elements.
 class SMDS_MeshNode_MyIterator:public SMDS_ElemIterator
 {
 // wanted type elements.
 class SMDS_MeshNode_MyIterator:public SMDS_ElemIterator
 {
-  set<const SMDS_MeshElement*> mySet;
-  set<const SMDS_MeshElement*>::iterator myIterator;
+  NCollection_List<const SMDS_MeshElement*> mySet;
+  NCollection_List<const SMDS_MeshElement*>::Iterator myIterator;
  public:
   SMDS_MeshNode_MyIterator(SMDSAbs_ElementType type,
  public:
   SMDS_MeshNode_MyIterator(SMDSAbs_ElementType type,
-                           const set<const SMDS_MeshElement*>& s)
+                           const NCollection_List<const SMDS_MeshElement*>& s)
   {
     const SMDS_MeshElement * e;
     bool toInsert;
   {
     const SMDS_MeshElement * e;
     bool toInsert;
-    set<const SMDS_MeshElement*>::iterator it=s.begin();
-    while(it!=s.end())
+    NCollection_List<const SMDS_MeshElement*>::Iterator it(s);
+    for(; it.More(); it.Next())
     {
     {
-      e=*it;
+      e=it.Value();
       switch(type)
       {
       case SMDSAbs_Edge: toInsert=true; break;
       case SMDSAbs_Face: toInsert=(e->GetType()!=SMDSAbs_Edge); break;
       case SMDSAbs_Volume: toInsert=(e->GetType()==SMDSAbs_Volume); break;
       }
       switch(type)
       {
       case SMDSAbs_Edge: toInsert=true; break;
       case SMDSAbs_Face: toInsert=(e->GetType()!=SMDSAbs_Edge); break;
       case SMDSAbs_Volume: toInsert=(e->GetType()==SMDSAbs_Volume); break;
       }
-      if(toInsert) mySet.insert(e);
-      it++;
+      if(toInsert) mySet.Append(e);
     }
     }
-    myIterator=mySet.begin();
+    myIterator.Init(mySet);
   }
 
   bool more()
   {
   }
 
   bool more()
   {
-    return myIterator!=mySet.end();
+    return myIterator.More() != Standard_False;
   }
 
   const SMDS_MeshElement* next()
   {
   }
 
   const SMDS_MeshElement* next()
   {
-    const SMDS_MeshElement* current=*myIterator;
-    myIterator++;
+    const SMDS_MeshElement* current=myIterator.Value();
+    myIterator.Next();
     return current;
   }
 };
     return current;
   }
 };
@@ -199,7 +205,13 @@ SMDSAbs_ElementType SMDS_MeshNode::GetType() const
 //=======================================================================
 void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
 {
 //=======================================================================
 void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
 {
-       myInverseElements.insert(ME);
+  NCollection_List<const SMDS_MeshElement*>::Iterator it(myInverseElements);
+  for (; it.More(); it.Next()) {
+    const SMDS_MeshElement* elem = it.Value();
+    if (elem == ME)
+      return;
+  }
+  myInverseElements.Append(ME);
 }
 
 //=======================================================================
 }
 
 //=======================================================================
@@ -208,12 +220,12 @@ void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
 //=======================================================================
 void SMDS_MeshNode::ClearInverseElements()
 {
 //=======================================================================
 void SMDS_MeshNode::ClearInverseElements()
 {
-       myInverseElements.clear();
+  myInverseElements.Clear();
 }
 
 bool SMDS_MeshNode::emptyInverseElements()
 {
 }
 
 bool SMDS_MeshNode::emptyInverseElements()
 {
-       return myInverseElements.empty();
+  return myInverseElements.IsEmpty() != Standard_False;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 }
 
 ///////////////////////////////////////////////////////////////////////////////
index e4ecc1f5cc872d04e5453ea829f3edde9702dbf2..fec75242ed25207965628935ca18bcc208225170 100644 (file)
@@ -29,9 +29,7 @@
 
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_Position.hxx"
 
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_Position.hxx"
-
-#include <set>
-
+#include <NCollection_List.hxx>
 
 class SMDS_MeshNode:public SMDS_MeshElement
 {
 
 class SMDS_MeshNode:public SMDS_MeshElement
 {
@@ -61,7 +59,7 @@ class SMDS_MeshNode:public SMDS_MeshElement
   private:
        double myX, myY, myZ;
        SMDS_PositionPtr myPosition;
   private:
        double myX, myY, myZ;
        SMDS_PositionPtr myPosition;
-       std::set<const SMDS_MeshElement*> myInverseElements;
+       NCollection_List<const SMDS_MeshElement*> myInverseElements;
 };
 
 #endif
 };
 
 #endif
index 94b12438c0174769b7f5c1d9ab51fd8641952f5d..022f76ad364f416469d9207bdb7a21cd00ea20ac 100644 (file)
@@ -49,7 +49,7 @@ SMDS_VertexPosition:: SMDS_VertexPosition(const int aVertexId)
 const double *SMDS_VertexPosition::Coords() const
 {
        const static double origin[]={0,0,0};
 const double *SMDS_VertexPosition::Coords() const
 {
        const static double origin[]={0,0,0};
-       MESSAGE("SMDS_EdgePosition::Coords not implemented");
+       MESSAGE("SMDS_VertexPosition::Coords not implemented");
        return origin;
 }
 
        return origin;
 }
 
index a710a8ffeb61a9c3d19590fd4ac0bb032ed926e3..51e71f86c5596dd50d302f716fa5a00490c655d3 100644 (file)
 //  Author : Jean-Michel BOULCOURT
 //  Module : SMESH
 
 //  Author : Jean-Michel BOULCOURT
 //  Module : SMESH
 
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
 #include "SMDS_VolumeOfFaces.hxx"
 #include "SMDS_IteratorOfElements.hxx"
 
 #include "SMDS_VolumeOfFaces.hxx"
 #include "SMDS_IteratorOfElements.hxx"
 
@@ -39,27 +43,28 @@ void SMDS_VolumeOfFaces::Print(ostream & OS) const
 {
        OS << "volume <" << GetID() << "> : ";
        int i;
 {
        OS << "volume <" << GetID() << "> : ";
        int i;
-       for (i = 0; i < myFaces.size()-1; ++i) OS << myFaces[i] << ",";
+       for (i = 0; i < NbFaces()-1; ++i) OS << myFaces[i] << ",";
        OS << myFaces[i]<< ") " << endl;
 }
 
 
 int SMDS_VolumeOfFaces::NbFaces() const
 {
        OS << myFaces[i]<< ") " << endl;
 }
 
 
 int SMDS_VolumeOfFaces::NbFaces() const
 {
-       return myFaces.size();
+       return myNbFaces;
 }
 
 class SMDS_VolumeOfFaces_MyIterator:public SMDS_ElemIterator
 {
 }
 
 class SMDS_VolumeOfFaces_MyIterator:public SMDS_ElemIterator
 {
-  const vector<const SMDS_MeshFace*>& mySet;
+  const SMDS_MeshFace* const *mySet;
+  int myLength;
   int index;
  public:
   int index;
  public:
-  SMDS_VolumeOfFaces_MyIterator(const vector<const SMDS_MeshFace*>& s):
-    mySet(s),index(0) {}
+  SMDS_VolumeOfFaces_MyIterator(const SMDS_MeshFace* const *s, int l):
+    mySet(s),myLength(l),index(0) {}
 
   bool more()
   {
 
   bool more()
   {
-    return index<mySet.size();
+    return index<myLength;
   }
 
   const SMDS_MeshElement* next()
   }
 
   const SMDS_MeshElement* next()
@@ -77,11 +82,12 @@ SMDS_ElemIteratorPtr SMDS_VolumeOfFaces::
   case SMDSAbs_Volume:
     return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
   case SMDSAbs_Face:
   case SMDSAbs_Volume:
     return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
   case SMDSAbs_Face:
-    return SMDS_ElemIteratorPtr(new SMDS_VolumeOfFaces_MyIterator(myFaces));
+    return SMDS_ElemIteratorPtr(new SMDS_VolumeOfFaces_MyIterator(myFaces,myNbFaces));
   default:
     return SMDS_ElemIteratorPtr
       (new SMDS_IteratorOfElements
   default:
     return SMDS_ElemIteratorPtr
       (new SMDS_IteratorOfElements
-       (this,type,SMDS_ElemIteratorPtr(new SMDS_VolumeOfFaces_MyIterator(myFaces))));
+       (this,type,SMDS_ElemIteratorPtr
+        (new SMDS_VolumeOfFaces_MyIterator(myFaces,myNbFaces))));
   }
 }
 
   }
 }
 
@@ -90,11 +96,13 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
                                        const SMDS_MeshFace * face3,
                                        const SMDS_MeshFace * face4)
 {
                                        const SMDS_MeshFace * face3,
                                        const SMDS_MeshFace * face4)
 {
-       myFaces.resize(4);
+       myNbFaces = 4;
        myFaces[0]=face1;
        myFaces[1]=face2;
        myFaces[2]=face3;
        myFaces[3]=face4;
        myFaces[0]=face1;
        myFaces[1]=face2;
        myFaces[2]=face3;
        myFaces[3]=face4;
+       myFaces[4]=0;
+       myFaces[5]=0;
 }
 
 SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
 }
 
 SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
@@ -103,12 +111,13 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
                                        const SMDS_MeshFace * face4,
                                        const SMDS_MeshFace * face5)
 {
                                        const SMDS_MeshFace * face4,
                                        const SMDS_MeshFace * face5)
 {
-       myFaces.resize(5);
+       myNbFaces = 5;
        myFaces[0]=face1;
        myFaces[1]=face2;
        myFaces[2]=face3;
        myFaces[3]=face4;
        myFaces[4]=face5;
        myFaces[0]=face1;
        myFaces[1]=face2;
        myFaces[2]=face3;
        myFaces[3]=face4;
        myFaces[4]=face5;
+       myFaces[5]=0;
 }
 
 SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
 }
 
 SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
@@ -118,7 +127,7 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
                                        const SMDS_MeshFace * face5,
                                        const SMDS_MeshFace * face6)
 {
                                        const SMDS_MeshFace * face5,
                                        const SMDS_MeshFace * face6)
 {
-       myFaces.resize(6);
+       myNbFaces = 6;
        myFaces[0]=face1;
        myFaces[1]=face2;
        myFaces[2]=face3;
        myFaces[0]=face1;
        myFaces[1]=face2;
        myFaces[2]=face3;
index 4a78e366ed86fa4baedc7f4a26b90680d5194768..ae3b288819bac9e0bb5372219d528694baf992f0 100644 (file)
@@ -30,7 +30,6 @@
 #include "SMDS_MeshVolume.hxx"
 #include "SMDS_MeshFace.hxx"
 #include "SMDS_Iterator.hxx"
 #include "SMDS_MeshVolume.hxx"
 #include "SMDS_MeshFace.hxx"
 #include "SMDS_Iterator.hxx"
-#include <vector>
 #include <iostream>
 
 
 #include <iostream>
 
 
@@ -61,6 +60,7 @@ class SMDS_VolumeOfFaces:public SMDS_MeshVolume
   protected:
        SMDS_ElemIteratorPtr
                elementsIterator(SMDSAbs_ElementType type) const;
   protected:
        SMDS_ElemIteratorPtr
                elementsIterator(SMDSAbs_ElementType type) const;
-       std::vector<const SMDS_MeshFace *> myFaces;
+       const SMDS_MeshFace * myFaces[6];
+       int                   myNbFaces;
 };
 #endif
 };
 #endif
index 25c0bf567dee9412ea162930edff5233dbc6a181..cd893f484a87e45a70059e678810ce358bb25271 100644 (file)
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
 // 
 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
 #include "SMDS_VolumeOfNodes.hxx"
 #include "SMDS_MeshNode.hxx"
 #include "utilities.h"
 #include "SMDS_VolumeOfNodes.hxx"
 #include "SMDS_MeshNode.hxx"
 #include "utilities.h"
@@ -39,7 +43,8 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
                const SMDS_MeshNode * node7,
                const SMDS_MeshNode * node8)
 {
                const SMDS_MeshNode * node7,
                const SMDS_MeshNode * node8)
 {
-       myNodes.resize(8);
+       myNbNodes = 8;
+       myNodes = new const SMDS_MeshNode* [myNbNodes];
        myNodes[0]=node1;
        myNodes[1]=node2;
        myNodes[2]=node3;
        myNodes[0]=node1;
        myNodes[1]=node2;
        myNodes[2]=node3;
@@ -56,7 +61,8 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
                const SMDS_MeshNode * node3,
                const SMDS_MeshNode * node4)
 {
                const SMDS_MeshNode * node3,
                const SMDS_MeshNode * node4)
 {
-       myNodes.resize(4);
+       myNbNodes = 4;
+       myNodes = new const SMDS_MeshNode* [myNbNodes];
        myNodes[0]=node1;
        myNodes[1]=node2;
        myNodes[2]=node3;
        myNodes[0]=node1;
        myNodes[1]=node2;
        myNodes[2]=node3;
@@ -70,7 +76,8 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
                const SMDS_MeshNode * node4,
                const SMDS_MeshNode * node5)
 {
                const SMDS_MeshNode * node4,
                const SMDS_MeshNode * node5)
 {
-       myNodes.resize(5);
+       myNbNodes = 5;
+       myNodes = new const SMDS_MeshNode* [myNbNodes];
        myNodes[0]=node1;
        myNodes[1]=node2;
        myNodes[2]=node3;
        myNodes[0]=node1;
        myNodes[1]=node2;
        myNodes[2]=node3;
@@ -86,7 +93,8 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
                const SMDS_MeshNode * node5,
                const SMDS_MeshNode * node6)
 {
                const SMDS_MeshNode * node5,
                const SMDS_MeshNode * node6)
 {
-       myNodes.resize(6);
+       myNbNodes = 6;
+       myNodes = new const SMDS_MeshNode* [myNbNodes];
        myNodes[0]=node1;
        myNodes[1]=node2;
        myNodes[2]=node3;
        myNodes[0]=node1;
        myNodes[1]=node2;
        myNodes[2]=node3;
@@ -94,18 +102,30 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
        myNodes[4]=node5;
        myNodes[5]=node6;
 }
        myNodes[4]=node5;
        myNodes[5]=node6;
 }
+
 bool SMDS_VolumeOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
                                      const int            nbNodes)
 {
   if (nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
     return false;
 
 bool SMDS_VolumeOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
                                      const int            nbNodes)
 {
   if (nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
     return false;
 
-  myNodes.resize( nbNodes );
+  delete [] myNodes;
+  myNbNodes = nbNodes;
+  myNodes = new const SMDS_MeshNode* [myNbNodes];
   for ( int i = 0; i < nbNodes; i++ )
     myNodes[ i ] = nodes [ i ];
 
   return true;
 }
   for ( int i = 0; i < nbNodes; i++ )
     myNodes[ i ] = nodes [ i ];
 
   return true;
 }
+
+SMDS_VolumeOfNodes::~SMDS_VolumeOfNodes()
+{
+  if (myNodes != NULL) {
+    delete [] myNodes;
+    myNodes = NULL;
+  }
+}
+
 //=======================================================================
 //function : Print
 //purpose  : 
 //=======================================================================
 //function : Print
 //purpose  : 
@@ -134,7 +154,7 @@ int SMDS_VolumeOfNodes::NbFaces() const
 
 int SMDS_VolumeOfNodes::NbNodes() const
 {
 
 int SMDS_VolumeOfNodes::NbNodes() const
 {
-       return myNodes.size();
+       return myNbNodes;
 }
 
 int SMDS_VolumeOfNodes::NbEdges() const
 }
 
 int SMDS_VolumeOfNodes::NbEdges() const
@@ -152,15 +172,16 @@ int SMDS_VolumeOfNodes::NbEdges() const
 
 class SMDS_VolumeOfNodes_MyIterator:public SMDS_ElemIterator
 {
 
 class SMDS_VolumeOfNodes_MyIterator:public SMDS_ElemIterator
 {
-  const vector<const SMDS_MeshNode*>& mySet;
+  const SMDS_MeshNode* const* mySet;
+  int myLength;
   int index;
  public:
   int index;
  public:
-  SMDS_VolumeOfNodes_MyIterator(const vector<const SMDS_MeshNode*>& s):
-    mySet(s),index(0) {}
+  SMDS_VolumeOfNodes_MyIterator(const SMDS_MeshNode* const* s, int l):
+    mySet(s),myLength(l),index(0) {}
 
   bool more()
   {
 
   bool more()
   {
-    return index<mySet.size();
+    return index<myLength;
   }
 
   const SMDS_MeshElement* next()
   }
 
   const SMDS_MeshElement* next()
@@ -178,7 +199,7 @@ SMDS_ElemIteratorPtr SMDS_VolumeOfNodes::
   case SMDSAbs_Volume:
     return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
   case SMDSAbs_Node:
   case SMDSAbs_Volume:
     return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
   case SMDSAbs_Node:
-    return SMDS_ElemIteratorPtr(new SMDS_VolumeOfNodes_MyIterator(myNodes));
+    return SMDS_ElemIteratorPtr(new SMDS_VolumeOfNodes_MyIterator(myNodes,myNbNodes));
   default:
     MESSAGE("ERROR : Iterator not implemented");
     return SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL);
   default:
     MESSAGE("ERROR : Iterator not implemented");
     return SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL);
index b2a6c038ece7e2dd861aa761ff1e2469592e6bd9..bb553a03a003518bf96b42dd530591fc59f3ece9 100644 (file)
@@ -28,7 +28,6 @@
 #define _SMDS_VolumeOfNodes_HeaderFile
 
 #include "SMDS_MeshVolume.hxx"
 #define _SMDS_VolumeOfNodes_HeaderFile
 
 #include "SMDS_MeshVolume.hxx"
-#include <vector>
 
 
 class SMDS_VolumeOfNodes:public SMDS_MeshVolume
 
 
 class SMDS_VolumeOfNodes:public SMDS_MeshVolume
@@ -64,6 +63,7 @@ class SMDS_VolumeOfNodes:public SMDS_MeshVolume
                const SMDS_MeshNode * node8);
         bool ChangeNodes(const SMDS_MeshNode* nodes[],
                          const int            nbNodes);
                const SMDS_MeshNode * node8);
         bool ChangeNodes(const SMDS_MeshNode* nodes[],
                          const int            nbNodes);
+        ~SMDS_VolumeOfNodes();
 
        void Print(std::ostream & OS) const;
        int NbFaces() const;
 
        void Print(std::ostream & OS) const;
        int NbFaces() const;
@@ -73,6 +73,7 @@ class SMDS_VolumeOfNodes:public SMDS_MeshVolume
   protected:
        SMDS_ElemIteratorPtr
                elementsIterator(SMDSAbs_ElementType type) const;
   protected:
        SMDS_ElemIteratorPtr
                elementsIterator(SMDSAbs_ElementType type) const;
-       std::vector<const SMDS_MeshNode *> myNodes;
+       const SMDS_MeshNode** myNodes;
+       int                   myNbNodes;
 };
 #endif
 };
 #endif
index 7acb3f054e3a5958f06daf8ac300fc9e4a896594..034486801b7a0e4dbe02099a40681e535cd54c20 100644 (file)
@@ -3,6 +3,9 @@
 // Author    : Edward AGAPOV (eap)
 // Copyright : Open CASCADE
 
 // Author    : Edward AGAPOV (eap)
 // Copyright : Open CASCADE
 
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
 
 #include "SMDS_VolumeTool.hxx"
 
 
 #include "SMDS_VolumeTool.hxx"
 
 #include "SMDS_MeshNode.hxx"
 #include <map>
 #include <float.h>
 #include "SMDS_MeshNode.hxx"
 #include <map>
 #include <float.h>
+#include <math.h>
 
 using namespace std;
 
 
 using namespace std;
 
+// ======================================================
+// Node indices in faces depending on volume orientation
+// making most faces normals external
+// ======================================================
+
 /*
 //           N3
 //           +
 //          /|\
 //         / | \
 //        /  |  \
 /*
 //           N3
 //           +
 //          /|\
 //         / | \
 //        /  |  \
-//    N0 +---|---+ N2                TETRAHEDRON
+//    N0 +---|---+ N1                TETRAHEDRON
 //       \   |   /
 //        \  |  /
 //         \ | /
 //          \|/
 //           +
 //       \   |   /
 //        \  |  /
 //         \ | /
 //          \|/
 //           +
-//           N1
+//           N2
 */
 */
-static int Tetra_F [4][4] = { // FORWARD == REVERSED EXTERNAL
-  { 0, 1, 2, 0 },             // Bottom face has an internal normal, other - external
+static int Tetra_F [4][4] = { // FORWARD == EXTERNAL
+  { 0, 1, 2, 0 },              // All faces have external normals
+  { 0, 3, 1, 0 },
+  { 1, 3, 2, 1 },
+  { 0, 2, 3, 0 }}; 
+static int Tetra_R [4][4] = { // REVERSED
+  { 0, 1, 2, 0 },             // All faces but a bottom have external normals
   { 0, 1, 3, 0 },
   { 1, 2, 3, 1 },
   { 0, 1, 3, 0 },
   { 1, 2, 3, 1 },
-  { 0, 3, 2, 0 }}; 
-static int Tetra_R [4][4] = { // REVERSED == FORWARD EXTERNAL
-  { 0, 2, 1, 0 },              // All faces have  external normals
+  { 0, 3, 2, 0 }};
+static int Tetra_RE [4][4] = { // REVERSED -> FORWARD (EXTERNAL)
+  { 0, 2, 1, 0 },              // All faces have external normals
   { 0, 1, 3, 0 },
   { 1, 2, 3, 1 },
   { 0, 1, 3, 0 },
   { 1, 2, 3, 1 },
-  { 0, 3, 2, 0 }}; 
+  { 0, 3, 2, 0 }};
 static int Tetra_nbN [] = { 3, 3, 3, 3 };
 
 static int Tetra_nbN [] = { 3, 3, 3, 3 };
 
+//
+//     PYRAMID
+//
+static int Pyramid_F [5][5] = { // FORWARD == EXTERNAL
+  { 0, 1, 2, 3, 0 },            // All faces have external normals
+  { 0, 4, 1, 0, 4 },
+  { 1, 4, 2, 1, 4 },
+  { 2, 4, 3, 2, 4 },
+  { 3, 4, 0, 3, 4 }}; 
+static int Pyramid_R [5][5] = { // REVERSED
+  { 0, 1, 2, 3, 0 },            // All faces but a bottom have external normals
+  { 0, 1, 4, 0, 4 },
+  { 1, 2, 4, 1, 4 },
+  { 2, 3, 4, 2, 4 },
+  { 3, 0, 4, 3, 4 }}; 
+static int Pyramid_RE [5][5] = { // REVERSED -> FORWARD (EXTERNAL)
+  { 0, 3, 2, 1, 0 },             // All faces but a bottom have external normals
+  { 0, 1, 4, 0, 4 },
+  { 1, 2, 4, 1, 4 },
+  { 2, 3, 4, 2, 4 },
+  { 3, 0, 4, 3, 4 }}; 
+static int Pyramid_nbN [] = { 4, 3, 3, 3, 3 };
+
 /*   
 //            + N4
 //           /|\
 /*   
 //            + N4
 //           /|\
@@ -58,71 +95,71 @@ static int Penta_F [5][5] = { // FORWARD
   { 0, 1, 2, 0, 0 },          // Top face has an internal normal, other - external
   { 3, 4, 5, 3, 3 },          // 0 is bottom, 1 is top face
   { 0, 2, 5, 3, 0 },
   { 0, 1, 2, 0, 0 },          // Top face has an internal normal, other - external
   { 3, 4, 5, 3, 3 },          // 0 is bottom, 1 is top face
   { 0, 2, 5, 3, 0 },
-  { 1, 2, 5, 4, 1 },
-  { 1, 0, 3, 4, 1 }}; 
+  { 1, 4, 5, 2, 1 },
+  { 0, 3, 4, 1, 0 }}; 
 static int Penta_R [5][5] = { // REVERSED
 static int Penta_R [5][5] = { // REVERSED
-  { 0, 2, 1, 0, 0 },          // Bottom face has an internal normal, other - external
-  { 3, 5, 4, 3, 3 },          // 0 is bottom, 1 is top face
-  { 0, 2, 5, 3, 0 },
+  { 0, 1, 2, 0, 0 },          // Bottom face has an internal normal, other - external
+  { 3, 4, 5, 3, 3 },          // 0 is bottom, 1 is top face
+  { 0, 3, 5, 2, 0 },
   { 1, 2, 5, 4, 1 },
   { 1, 2, 5, 4, 1 },
-  { 1, 0, 3, 4, 1 }}; 
-static int Penta_FE [5][5] = { // EXTERNAL
+  { 0, 1, 4, 3, 0 }}; 
+static int Penta_FE [5][5] = { // FORWARD -> EXTERNAL
   { 0, 1, 2, 0, 0 },
   { 3, 5, 4, 3, 3 },
   { 0, 2, 5, 3, 0 },
   { 0, 1, 2, 0, 0 },
   { 3, 5, 4, 3, 3 },
   { 0, 2, 5, 3, 0 },
+  { 1, 4, 5, 2, 1 },
+  { 0, 3, 4, 1, 0 }}; 
+static int Penta_RE [5][5] = { // REVERSED -> EXTERNAL
+  { 0, 2, 1, 0, 0 },
+  { 3, 4, 5, 3, 3 },
+  { 0, 3, 5, 2, 0 },
   { 1, 2, 5, 4, 1 },
   { 1, 2, 5, 4, 1 },
-  { 1, 0, 3, 4, 1 }}; 
-static int Penta_RE [5][5] = { // REVERSED EXTERNAL
-  { 0, 0, 2, 1, 0 },
-  { 3, 3, 4, 5, 3 },
-  { 0, 2, 5, 3, 0 },
-  { 1, 2, 5, 4, 1 },
-  { 1, 0, 3, 4, 1 }}; 
+  { 0, 1, 4, 3, 0 }}; 
 static int Penta_nbN [] = { 3, 3, 4, 4, 4 };
 
 /*
 static int Penta_nbN [] = { 3, 3, 4, 4, 4 };
 
 /*
-//         N7+----------+N6
+//         N5+----------+N6
 //          /|         /|
 //         / |        / |
 //        /  |       /  |
 //          /|         /|
 //         / |        / |
 //        /  |       /  |
-//     N4+----------+N5 |
+//     N4+----------+N7 |
 //       |   |      |   |           HEXAHEDRON
 //       |   |      |   |
 //       |   |      |   |
 //       |   |      |   |           HEXAHEDRON
 //       |   |      |   |
 //       |   |      |   |
-//       | N3+------|---+N2
+//       | N1+------|---+N2
 //       |  /       |  /
 //       | /        | /
 //       |/         |/
 //       |  /       |  /
 //       | /        | /
 //       |/         |/
-//     N0+----------+N1
+//     N0+----------+N3
 */
 static int Hexa_F [6][5] = { // FORWARD
   { 0, 1, 2, 3, 0 },         // opposite faces are neighbouring,
 */
 static int Hexa_F [6][5] = { // FORWARD
   { 0, 1, 2, 3, 0 },         // opposite faces are neighbouring,
-  { 4, 5, 6, 7, 4 },         // even face normal is internal, odd - external
-  { 1, 0, 4, 5, 1 },         // same index nodes nodes of opposite faces are linked
+  { 4, 5, 6, 7, 4 },         // odd face(1,3,5) normal is internal, even(0,2,4) - external
+  { 1, 0, 4, 5, 1 },         // same index nodes of opposite faces are linked
   { 2, 3, 7, 6, 2 }, 
   { 0, 3, 7, 4, 0 }, 
   { 2, 3, 7, 6, 2 }, 
   { 0, 3, 7, 4, 0 }, 
-  { 1, 2, 6, 5, 1 }}; 
-static int Hexa_R [6][5] = { // REVERSED
-  { 0, 3, 2, 1, 0 },         // opposite faces are neighbouring,
-  { 4, 7, 6, 5, 4 },         // even face normal is external, odd - internal
-  { 1, 5, 4, 0, 1 },         // same index nodes nodes of opposite faces are linked
-  { 2, 6, 7, 3, 2 }, 
-  { 0, 4, 7, 3, 0 }, 
-  { 1, 5, 6, 2, 1 }}; 
-static int Hexa_FE [6][5] = { // EXTERNAL
-  { 0, 3, 2, 1, 0 },         // opposite faces are neighbouring,
-  { 4, 5, 6, 7, 4 },         // all face normals are external,
-  { 0, 1, 5, 4, 0 },         // links in opposite faces: 0-0, 1-3, 2-2, 3-1
-  { 3, 7, 6, 2, 3 }, 
-  { 1, 2, 6, 5, 1 }, 
-  { 0, 4, 7, 3, 0 }};
-static int Hexa_RE [6][5] = { // REVERSED EXTERNAL
-  { 0, 1, 2, 3, 0 },         // opposite faces are neighbouring,
-  { 4, 7, 6, 5, 4 },         // all face normals are external,
-  { 0, 1, 5, 4, 0 },         // links in opposite faces: 0-0, 1-3, 2-2, 3-1
+  { 1, 2, 6, 5, 1 }};
+// static int Hexa_R [6][5] = { // REVERSED
+//   { 0, 3, 2, 1, 0 },         // opposite faces are neighbouring,
+//   { 4, 7, 6, 5, 4 },         // odd face(1,3,5) normal is external, even(0,2,4) - internal
+//   { 1, 5, 4, 0, 1 },         // same index nodes of opposite faces are linked
+//   { 2, 6, 7, 3, 2 }, 
+//   { 0, 4, 7, 3, 0 }, 
+//   { 1, 5, 6, 2, 1 }};
+static int Hexa_FE [6][5] = { // FORWARD -> EXTERNAL
+  { 0, 1, 2, 3, 0 } ,         // opposite faces are neighbouring,
+  { 4, 7, 6, 5, 4 },          // all face normals are external,
+  { 0, 4, 5, 1, 0 },          // links in opposite faces: 0-0, 1-3, 2-2, 3-1
+  { 3, 2, 6, 7, 3 }, 
+  { 0, 3, 7, 4, 0 },
+  { 1, 5, 6, 2, 1 }};
+static int Hexa_RE [6][5] = { // REVERSED -> EXTERNAL
+  { 0, 3, 2, 1, 0 },          // opposite faces are neighbouring,
+  { 4, 5, 6, 7, 4 },          // all face normals are external,
+  { 0, 1, 5, 4, 0 },          // links in opposite faces: 0-0, 1-3, 2-2, 3-1
   { 3, 7, 6, 2, 3 }, 
   { 3, 7, 6, 2, 3 }, 
-  { 1, 2, 6, 5, 1 }, 
-  { 0, 4, 7, 3, 0 }};
+  { 0, 4, 7, 3, 0 },
+  { 1, 2, 6, 5, 1 }};
 static int Hexa_nbN [] = { 4, 4, 4, 4, 4, 4 };
 
 // ========================================================
 static int Hexa_nbN [] = { 4, 4, 4, 4, 4, 4 };
 
 // ========================================================
@@ -166,7 +203,6 @@ SMDS_VolumeTool::SMDS_VolumeTool ()
        myVolForward( true ),
        myNbFaces( 0 ),
        myVolumeNbNodes( 0 ),
        myVolForward( true ),
        myNbFaces( 0 ),
        myVolumeNbNodes( 0 ),
-       myForwardFaces( false ),
        myExternalFaces( false )
 {
 }
        myExternalFaces( false )
 {
 }
@@ -176,8 +212,7 @@ SMDS_VolumeTool::SMDS_VolumeTool ()
 //=======================================================================
 
 SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume)
 //=======================================================================
 
 SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume)
-     : myForwardFaces( false ),
-       myExternalFaces( false )
+     : myExternalFaces( false )
 {
   Set( theVolume );
 }
 {
   Set( theVolume );
 }
@@ -208,6 +243,7 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
     myVolumeNbNodes = theVolume->NbNodes();
     switch ( myVolumeNbNodes ) {
     case 4:
     myVolumeNbNodes = theVolume->NbNodes();
     switch ( myVolumeNbNodes ) {
     case 4:
+    case 5:
     case 6:
     case 8:
       {
     case 6:
     case 8:
       {
@@ -223,11 +259,13 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
       // nb nodes in each face
       if ( myVolumeNbNodes == 4 )
         myFaceNbNodes = Tetra_nbN;
       // nb nodes in each face
       if ( myVolumeNbNodes == 4 )
         myFaceNbNodes = Tetra_nbN;
+      else if ( myVolumeNbNodes == 5 )
+        myFaceNbNodes = Pyramid_nbN;
       else if ( myVolumeNbNodes == 6 )
         myFaceNbNodes = Penta_nbN;
       else
         myFaceNbNodes = Hexa_nbN;
       else if ( myVolumeNbNodes == 6 )
         myFaceNbNodes = Penta_nbN;
       else
         myFaceNbNodes = Hexa_nbN;
-      break;
+
       // define volume orientation
       XYZ botNormal;
       GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
       // define volume orientation
       XYZ botNormal;
       GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
@@ -236,9 +274,8 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
       XYZ upDir (topNode->X() - botNode->X(),
                  topNode->Y() - botNode->Y(),
                  topNode->Z() - botNode->Z() );
       XYZ upDir (topNode->X() - botNode->X(),
                  topNode->Y() - botNode->Y(),
                  topNode->Z() - botNode->Z() );
-      bool diffDir = ( botNormal.Dot( upDir ) < 0 );
-      myVolForward = ( myVolumeNbNodes == 6 ? diffDir : !diffDir );
-
+      myVolForward = ( botNormal.Dot( upDir ) < 0 );
+      break;
     }
     default: myVolume = 0;
     }
     }
     default: myVolume = 0;
     }
@@ -251,10 +288,10 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
 //purpose  : Return nodes vector of an inverse volume
 //=======================================================================
 
 //purpose  : Return nodes vector of an inverse volume
 //=======================================================================
 
-#define SWAP_NODES(nodes,i1,i2)                         \
-{                                                 \
+#define SWAP_NODES(nodes,i1,i2)           \
+{                                         \
   const SMDS_MeshNode* tmp = nodes[ i1 ]; \
   const SMDS_MeshNode* tmp = nodes[ i1 ]; \
-  nodes[ i1 ] = nodes[ i2 ];      \
+  nodes[ i1 ] = nodes[ i2 ];              \
   nodes[ i2 ] = tmp;                      \
 }
 void SMDS_VolumeTool::Inverse ()
   nodes[ i2 ] = tmp;                      \
 }
 void SMDS_VolumeTool::Inverse ()
@@ -269,6 +306,9 @@ void SMDS_VolumeTool::Inverse ()
   case 4:
     SWAP_NODES( myVolumeNodes, 1, 2 );
     break;
   case 4:
     SWAP_NODES( myVolumeNodes, 1, 2 );
     break;
+  case 5:
+    SWAP_NODES( myVolumeNodes, 1, 3 );
+    break;
   case 6:
     SWAP_NODES( myVolumeNodes, 1, 2 );
     SWAP_NODES( myVolumeNodes, 4, 5 );
   case 6:
     SWAP_NODES( myVolumeNodes, 1, 2 );
     SWAP_NODES( myVolumeNodes, 4, 5 );
@@ -314,16 +354,6 @@ bool SMDS_VolumeTool::GetBaryCenter(double & X, double & Y, double & Z) const
   return true;
 }
 
   return true;
 }
 
-//=======================================================================
-//function : SetForwardOrientation
-//purpose  : Node order will be as for forward orientation
-//=======================================================================
-
-void SMDS_VolumeTool::SetForwardOrientation ()
-{
-  myForwardFaces = true;
-}
-
 //=======================================================================
 //function : SetExternalNormal
 //purpose  : Node order will be so that faces normals are external
 //=======================================================================
 //function : SetExternalNormal
 //purpose  : Node order will be so that faces normals are external
@@ -332,6 +362,7 @@ void SMDS_VolumeTool::SetForwardOrientation ()
 void SMDS_VolumeTool::SetExternalNormal ()
 {
   myExternalFaces = true;
 void SMDS_VolumeTool::SetExternalNormal ()
 {
   myExternalFaces = true;
+  myCurFace = -1;
 }
 
 //=======================================================================
 }
 
 //=======================================================================
@@ -381,15 +412,15 @@ const int* SMDS_VolumeTool::GetFaceNodesIndices( int faceIndex )
 //purpose  : Return a set of face nodes.
 //=======================================================================
 
 //purpose  : Return a set of face nodes.
 //=======================================================================
 
-bool SMDS_VolumeTool::GetFaceNodes (int faceIndex,
-                                    std::set<const SMDS_MeshNode*>& theFaceNodes )
+bool SMDS_VolumeTool::GetFaceNodes (int                        faceIndex,
+                                    set<const SMDS_MeshNode*>& theFaceNodes )
 {
   if ( !setFace( faceIndex ))
     return false;
 
   theFaceNodes.clear();
   int iNode, nbNode = myFaceNbNodes[ faceIndex ];
 {
   if ( !setFace( faceIndex ))
     return false;
 
   theFaceNodes.clear();
   int iNode, nbNode = myFaceNbNodes[ faceIndex ];
-  for ( int iNode = 0; iNode < nbNode; iNode++ )
+  for ( iNode = 0; iNode < nbNode; iNode++ )
     theFaceNodes.insert( myFaceNodes[ iNode ]);
   
   return true;
     theFaceNodes.insert( myFaceNodes[ iNode ]);
   
   return true;
@@ -405,18 +436,18 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex )
   if ( myExternalFaces || !myVolume )
     return true;
 
   if ( myExternalFaces || !myVolume )
     return true;
 
-  bool reversed = ( !myForwardFaces && !myVolForward );
   switch ( myVolumeNbNodes ) {
   case 4:
   switch ( myVolumeNbNodes ) {
   case 4:
-    // only the bottom of a forward tetrahedron can be internal
-    return ( reversed || faceIndex != 0 );
+  case 5:
+    // only the bottom of a reversed tetrahedron can be internal
+    return ( myVolForward || faceIndex != 0 );
   case 6:
     // in a forward pentahedron, the top is internal, in a reversed one - bottom
   case 6:
     // in a forward pentahedron, the top is internal, in a reversed one - bottom
-    return ( reversed ? faceIndex != 0 : faceIndex != 1 );
+    return ( myVolForward ? faceIndex != 1 : faceIndex != 0 );
   case 8: {
   case 8: {
-    // in a forward hexahedron, odd face normal is external, else vice versa
+    // in a forward hexahedron, even face normal is external, odd - internal
     bool odd = faceIndex % 2;
     bool odd = faceIndex % 2;
-    return ( reversed ? !odd : odd );
+    return ( myVolForward ? !odd : odd );
   }
   default:;
   }
   }
   default:;
   }
@@ -540,6 +571,15 @@ bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
   switch ( myVolumeNbNodes ) {
   case 4:
     return true;
   switch ( myVolumeNbNodes ) {
   case 4:
     return true;
+  case 5:
+    if ( maxInd == 4 )
+      return true;
+    switch ( maxInd - minInd ) {
+    case 1:
+    case 3: return true;
+    default:;
+    }
+    break;
   case 6:
     switch ( maxInd - minInd ) {
     case 1: return minInd != 2;
   case 6:
     switch ( maxInd - minInd ) {
     case 1: return minInd != 2;
@@ -735,25 +775,25 @@ bool SMDS_VolumeTool::setFace( int faceIndex )
   switch ( myVolumeNbNodes ) {
   case 4:
     if ( myExternalFaces )
   switch ( myVolumeNbNodes ) {
   case 4:
     if ( myExternalFaces )
-      myFaceNodeIndices = myVolForward ? Tetra_R[ faceIndex ] : Tetra_F[ faceIndex ];
-    else if ( myForwardFaces )
+      myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_RE[ faceIndex ];
+    else
       myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_R[ faceIndex ];
       myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_R[ faceIndex ];
+    break;
+  case 5:
+    if ( myExternalFaces )
+      myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_RE[ faceIndex ];
     else
     else
-      myFaceNodeIndices = Tetra_F[ faceIndex ];
+      myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_R[ faceIndex ];
     break;
   case 6:
     if ( myExternalFaces )
       myFaceNodeIndices = myVolForward ? Penta_FE[ faceIndex ] : Penta_RE[ faceIndex ];
     break;
   case 6:
     if ( myExternalFaces )
       myFaceNodeIndices = myVolForward ? Penta_FE[ faceIndex ] : Penta_RE[ faceIndex ];
-    else if ( myForwardFaces )
-      myFaceNodeIndices = myVolForward ? Penta_F[ faceIndex ] : Penta_R[ faceIndex ];
     else
     else
-      myFaceNodeIndices = Penta_F[ faceIndex ];
+      myFaceNodeIndices = myVolForward ? Penta_F[ faceIndex ] : Penta_R[ faceIndex ];
     break;
   case 8:
     if ( myExternalFaces )
       myFaceNodeIndices = myVolForward ? Hexa_FE[ faceIndex ] : Hexa_RE[ faceIndex ];
     break;
   case 8:
     if ( myExternalFaces )
       myFaceNodeIndices = myVolForward ? Hexa_FE[ faceIndex ] : Hexa_RE[ faceIndex ];
-    else if ( myForwardFaces )
-      myFaceNodeIndices = myVolForward ? Hexa_F[ faceIndex ] : Hexa_R[ faceIndex ];
     else
       myFaceNodeIndices = Hexa_F[ faceIndex ];
     break;
     else
       myFaceNodeIndices = Hexa_F[ faceIndex ];
     break;
index 0c840a512c09371fcc83173b5d18dacee704559f..99e7dc1763800377f1cd6a851f6fcac4da59635b 100644 (file)
@@ -62,7 +62,7 @@ class SMDS_VolumeTool
 
   bool IsForward() const { return myVolForward; }
   // Check volume orientation. can be changed by Inverse().
 
   bool IsForward() const { return myVolForward; }
   // Check volume orientation. can be changed by Inverse().
-  // See node order of forward volumes at file bottom
+  // See node order of forward volumes at the file bottom
 
   void Inverse();
   // Change nodes order as if the volume changes its orientation:
 
   void Inverse();
   // Change nodes order as if the volume changes its orientation:
@@ -101,12 +101,8 @@ class SMDS_VolumeTool
   // info on faces
   // -------------
 
   // info on faces
   // -------------
 
-  void SetForwardOrientation ();
-  // Node order in faces will be as for forward orientation
-
   void SetExternalNormal ();
   // Node order in faces  will be so that faces normals are external.
   void SetExternalNormal ();
   // Node order in faces  will be so that faces normals are external.
-  // It overrides SetForwardOrientation()
 
   int NbFaces() const { return myNbFaces; }
   // Return number of faces of the volume. In the following
 
   int NbFaces() const { return myNbFaces; }
   // Return number of faces of the volume. In the following
@@ -135,8 +131,7 @@ class SMDS_VolumeTool
 
   bool IsFaceExternal( int faceIndex );
   // Check normal orientation of a face.
 
   bool IsFaceExternal( int faceIndex );
   // Check normal orientation of a face.
-  // SetForwardOrientation() and SetForwardOrientation() are taken
-  // into account.
+  // SetExternalNormal() is taken into account.
 
   bool IsFreeFace(  int faceIndex );
   // Check that all volumes built on the face nodes lays on one side
 
   bool IsFreeFace(  int faceIndex );
   // Check that all volumes built on the face nodes lays on one side
@@ -169,7 +164,6 @@ class SMDS_VolumeTool
   int                     myVolumeNbNodes;
   const SMDS_MeshNode*    myVolumeNodes[ 8 ];
 
   int                     myVolumeNbNodes;
   const SMDS_MeshNode*    myVolumeNodes[ 8 ];
 
-  bool                    myForwardFaces;
   bool                    myExternalFaces;
   int*                    myFaceNodeIndices;
   int*                    myFaceNbNodes;
   bool                    myExternalFaces;
   int*                    myFaceNodeIndices;
   int*                    myFaceNbNodes;
@@ -191,13 +185,13 @@ class SMDS_VolumeTool
 //          /|\
 //         / | \
 //        /  |  \
 //          /|\
 //         / | \
 //        /  |  \
-//    N0 +---|---+ N2                TETRAHEDRON
+//    N0 +---|---+ N1                TETRAHEDRON
 //       \   |   /
 //        \  |  /
 //         \ | /
 //          \|/
 //           +
 //       \   |   /
 //        \  |  /
 //         \ | /
 //          \|/
 //           +
-//           N1
+//           N2
 
 //            + N4
 //           /|\
 
 //            + N4
 //           /|\
@@ -213,18 +207,18 @@ class SMDS_VolumeTool
 //       |/       \|
 //    N0 +---------+ N2
 
 //       |/       \|
 //    N0 +---------+ N2
 
-//         N7+----------+N6
+//         N5+----------+N6
 //          /|         /|
 //         / |        / |
 //        /  |       /  |
 //          /|         /|
 //         / |        / |
 //        /  |       /  |
-//     N4+----------+N5 |
+//     N4+----------+N7 |
 //       |   |      |   |           HEXAHEDRON
 //       |   |      |   |
 //       |   |      |   |
 //       |   |      |   |           HEXAHEDRON
 //       |   |      |   |
 //       |   |      |   |
-//       | N3+------|---+N2
+//       | N1+------|---+N2
 //       |  /       |  /
 //       | /        | /
 //       |/         |/
 //       |  /       |  /
 //       | /        | /
 //       |/         |/
-//     N0+----------+N1
+//     N0+----------+N3
 //
 */
 //
 */
index 81c62ca98e59cf723a638bcb0f5c0a51a3406a0b..4189c810764286f729b5e4bccb700e95467612be 100644 (file)
@@ -74,9 +74,9 @@ BIN =
 BIN_SRC = 
 
 # additionnal information to compile and link file
 BIN_SRC = 
 
 # additionnal information to compile and link file
-CPPFLAGS+= $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
+CPPFLAGS+= $(OCC_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
            -I${GEOM_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
            -I${GEOM_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
-CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
+CXXFLAGS+= $(OCC_CXXFLAGS) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
            -I${GEOM_ROOT_DIR}/include/salome
 LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lNMTTools -lSMESHDS -lMeshDriverDAT -lMeshDriverSTL -lMeshDriverMED -lMeshDriverUNV
 
            -I${GEOM_ROOT_DIR}/include/salome
 LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lNMTTools -lSMESHDS -lMeshDriverDAT -lMeshDriverSTL -lMeshDriverMED -lMeshDriverUNV
 
index 6550a81ea3391ed5fc3ef15bb6cb28fbdef2679f..016805fd352932cf648f277e504521b8d1c68777 100644 (file)
@@ -40,6 +40,9 @@
 #include <gp_Vec.hxx>
 #include <math_FunctionSetRoot.hxx>
 
 #include <gp_Vec.hxx>
 #include <math_FunctionSetRoot.hxx>
 
+#include "SMDS_MeshNode.hxx"
+#include "SMDS_MeshVolume.hxx"
+#include "SMDS_VolumeTool.hxx"
 #include "utilities.h"
 
 #include <list>
 #include "utilities.h"
 
 #include <list>
@@ -56,6 +59,8 @@ using namespace std;
 double SMESH_Block::TEdge::GetU( const gp_XYZ& theParams ) const
 {
   double u = theParams.Coord( myCoordInd );
 double SMESH_Block::TEdge::GetU( const gp_XYZ& theParams ) const
 {
   double u = theParams.Coord( myCoordInd );
+  if ( myC3d.IsNull() ) // if mesh block
+    return u;
   return ( 1 - u ) * myFirst + u * myLast;
 }
 
   return ( 1 - u ) * myFirst + u * myLast;
 }
 
@@ -66,12 +71,46 @@ double SMESH_Block::TEdge::GetU( const gp_XYZ& theParams ) const
 
 gp_XYZ SMESH_Block::TEdge::Point( const gp_XYZ& theParams ) const
 {
 
 gp_XYZ SMESH_Block::TEdge::Point( const gp_XYZ& theParams ) const
 {
-  gp_XYZ p = myC3d->Value( GetU( theParams )).XYZ();
+  double u = GetU( theParams );
+
+  if ( myC3d.IsNull() ) // if mesh block
+    return myNodes[0] * ( 1 - u ) + myNodes[1] * u;
+
+  gp_XYZ p = myC3d->Value( u ).XYZ();
   if ( myTrsf.Form() != gp_Identity )
     myTrsf.Transforms( p );
   return p;
 }
 
   if ( myTrsf.Form() != gp_Identity )
     myTrsf.Transforms( p );
   return p;
 }
 
+//=======================================================================
+//function : SMESH_Block::TFace::GetCoefs
+//purpose  : return coefficients for addition of [0-3]-th edge and vertex
+//=======================================================================
+
+void SMESH_Block::TFace::GetCoefs(int           iE,
+                                  const gp_XYZ& theParams,
+                                  double&       Ecoef,
+                                  double&       Vcoef ) const
+{
+  double dU = theParams.Coord( GetUInd() );
+  double dV = theParams.Coord( GetVInd() );
+  switch ( iE ) {
+  case 0:
+    Ecoef = ( 1 - dV ); // u0
+    Vcoef = ( 1 - dU ) * ( 1 - dV ); break; // 00
+  case 1:
+    Ecoef = dV; // u1
+    Vcoef = dU * ( 1 - dV ); break; // 10
+  case 2:
+    Ecoef = ( 1 - dU ); // 0v
+    Vcoef = dU * dV  ; break; // 11
+  case 3:
+    Ecoef = dU  ; // 1v
+    Vcoef = ( 1 - dU ) * dV  ; break; // 01
+  default: ASSERT(0);
+  }
+}
+
 //=======================================================================
 //function : SMESH_Block::TFace::GetUV
 //purpose  : 
 //=======================================================================
 //function : SMESH_Block::TFace::GetUV
 //purpose  : 
@@ -80,26 +119,10 @@ gp_XYZ SMESH_Block::TEdge::Point( const gp_XYZ& theParams ) const
 gp_XY SMESH_Block::TFace::GetUV( const gp_XYZ& theParams ) const
 {
   gp_XY uv(0.,0.);
 gp_XY SMESH_Block::TFace::GetUV( const gp_XYZ& theParams ) const
 {
   gp_XY uv(0.,0.);
-  double dU = theParams.Coord( GetUInd() );
-  double dV = theParams.Coord( GetVInd() );
   for ( int iE = 0; iE < 4; iE++ ) // loop on 4 edges
   {
     double Ecoef = 0, Vcoef = 0;
   for ( int iE = 0; iE < 4; iE++ ) // loop on 4 edges
   {
     double Ecoef = 0, Vcoef = 0;
-    switch ( iE ) {
-    case 0:
-      Ecoef = ( 1 - dV ); // u0
-      Vcoef = ( 1 - dU ) * ( 1 - dV ); break; // 00
-    case 1:
-      Ecoef = dV; // u1
-      Vcoef = dU * ( 1 - dV ); break; // 10
-    case 2:
-      Ecoef = ( 1 - dU ); // 0v
-      Vcoef = dU * dV  ; break; // 11
-    case 3:
-      Ecoef = dU  ; // 1v
-      Vcoef = ( 1 - dU ) * dV  ; break; // 01
-    default:;
-    }
+    GetCoefs( iE, theParams, Ecoef, Vcoef );
     // edge addition
     double u = theParams.Coord( myCoordInd[ iE ] );
     u = ( 1 - u ) * myFirst[ iE ] + u * myLast[ iE ];
     // edge addition
     double u = theParams.Coord( myCoordInd[ iE ] );
     u = ( 1 - u ) * myFirst[ iE ] + u * myLast[ iE ];
@@ -117,10 +140,34 @@ gp_XY SMESH_Block::TFace::GetUV( const gp_XYZ& theParams ) const
 
 gp_XYZ SMESH_Block::TFace::Point( const gp_XYZ& theParams ) const
 {
 
 gp_XYZ SMESH_Block::TFace::Point( const gp_XYZ& theParams ) const
 {
-  gp_XY uv = GetUV( theParams );
-  gp_XYZ p = myS->Value( uv.X(), uv.Y() ).XYZ();
-  if ( myTrsf.Form() != gp_Identity )
-    myTrsf.Transforms( p );
+  gp_XYZ p(0.,0.,0.);
+  if ( myS.IsNull() ) // if mesh block
+  {
+    for ( int iE = 0; iE < 4; iE++ ) // loop on 4 edges
+    {
+      double Ecoef = 0, Vcoef = 0;
+      GetCoefs( iE, theParams, Ecoef, Vcoef );
+      // edge addition
+      double u = theParams.Coord( myCoordInd[ iE ] );
+      int i1 = 0, i2 = 1;
+      switch ( iE ) {
+      case 1: i1 = 3; i2 = 2; break;
+      case 2: i1 = 1; i2 = 2; break;
+      case 3: i1 = 0; i2 = 3; break;
+      }
+      p += Ecoef * ( myNodes[ i1 ] * ( 1 - u ) + myNodes[ i2 ] * u );
+      // corner addition
+      p -= Vcoef * myNodes[ iE ];
+    }
+    
+  }
+  else // shape block
+  {
+    gp_XY uv = GetUV( theParams );
+    p = myS->Value( uv.X(), uv.Y() ).XYZ();
+    if ( myTrsf.Form() != gp_Identity )
+      myTrsf.Transforms( p );
+  }
   return p;
 }
 
   return p;
 }
 
@@ -274,7 +321,7 @@ Standard_Boolean SMESH_Block::Values(const math_Vector& theXYZ,
     return true;
   }
 
     return true;
   }
 
-  if ( theFxyz(1) < myValues[0] )
+  if ( theFxyz(1) < myValues[0] ) // a better guess
   {
     // 3 partial derivatives
     gp_Vec drv[ 3 ];
   {
     // 3 partial derivatives
     gp_Vec drv[ 3 ];
@@ -620,6 +667,175 @@ static int getOrderedEdges (const TopoDS_Face&   theFace,
   return aWireList.size();
 }
 
   return aWireList.size();
 }
 
+//=======================================================================
+//function : LoadMeshBlock
+//purpose  : prepare to work with theVolume
+//=======================================================================
+
+#define gpXYZ(n) gp_XYZ(n->X(),n->Y(),n->Z())
+
+bool SMESH_Block::LoadMeshBlock(const SMDS_MeshVolume*        theVolume,
+                                const int                     theNode000Index,
+                                const int                     theNode001Index,
+                                vector<const SMDS_MeshNode*>& theOrderedNodes)
+{
+  MESSAGE(" ::LoadMeshBlock()");
+
+  myNbIterations = 0;
+  mySumDist = 0;
+  myGridComputed = false;
+
+  SMDS_VolumeTool vTool;
+  if (!vTool.Set( theVolume ) || vTool.NbNodes() != 8 ||
+      !vTool.IsLinked( theNode000Index, theNode001Index )) {
+    MESSAGE(" Bad arguments ");
+    return false;
+  }
+  vTool.SetExternalNormal();
+  // In terms of indices used for access to nodes and faces in SMDS_VolumeTool:
+  int V000, V100, V010, V110, V001, V101, V011, V111; // 8 vertices
+  int Fxy0, Fxy1; // bottom and top faces
+  // vertices of faces
+  vector<int> vFxy0, vFxy1;
+
+  V000 = theNode000Index;
+  V001 = theNode001Index;
+
+  // get faces sharing V000 and V001
+  list<int> fV000, fV001;
+  int i, iF, iE, iN;
+  for ( iF = 0; iF < vTool.NbFaces(); ++iF ) {
+    const int* nid = vTool.GetFaceNodesIndices( iF );
+    for ( iN = 0; iN < 4; ++iN )
+      if ( nid[ iN ] == V000 ) {
+        fV000.push_back( iF );
+      } else if ( nid[ iN ] == V001 ) {
+        fV001.push_back( iF );
+      }
+  }
+
+  // find the bottom (Fxy0), the top (Fxy1) faces
+  list<int>::iterator fIt1, fIt2, Fxy0Pos;
+  for ( fIt1 = fV000.begin(); fIt1 != fV000.end(); fIt1++) {
+    fIt2 = std::find( fV001.begin(), fV001.end(), *fIt1 );
+    if ( fIt2 != fV001.end() ) { // *fIt1 is in the both lists
+      fV001.erase( fIt2 ); // erase Fx0z or F0yz from fV001
+    } else { // *fIt1 is in fV000 only
+      Fxy0Pos = fIt1; // points to Fxy0
+    }
+  }
+  Fxy0 = *Fxy0Pos;
+  Fxy1 = fV001.front();
+  const SMDS_MeshNode** nn = vTool.GetNodes();
+
+  // find bottom veritices, their order is that a face normal is external
+  vFxy0.resize(4);
+  const int* nid = vTool.GetFaceNodesIndices( Fxy0 );
+  for ( i = 0; i < 4; ++i )
+    if ( nid[ i ] == V000 )
+      break;
+  for ( iN = 0; iN < 4; ++iN, ++i ) {
+    if ( i == 4 ) i = 0;
+    vFxy0[ iN ] = nid[ i ];
+  }
+  // find top veritices, their order is that a face normal is external
+  vFxy1.resize(4);
+  nid = vTool.GetFaceNodesIndices( Fxy1 );
+  for ( i = 0; i < 4; ++i )
+    if ( nid[ i ] == V001 )
+      break;
+  for ( iN = 0; iN < 4; ++iN, ++i ) {
+    if ( i == 4 ) i = 0;
+    vFxy1[ iN ] = nid[ i ];
+  }
+  // find indices of the rest veritices 
+  V100 = vFxy0[3];
+  V010 = vFxy0[1];
+  V110 = vFxy0[2];
+  V101 = vFxy1[1];
+  V011 = vFxy1[3];
+  V111 = vFxy1[2];
+
+  // set points coordinates
+  myPnt[ ID_V000 - 1 ] = gpXYZ( nn[ V000 ] );
+  myPnt[ ID_V100 - 1 ] = gpXYZ( nn[ V100 ] );
+  myPnt[ ID_V010 - 1 ] = gpXYZ( nn[ V010 ] );
+  myPnt[ ID_V110 - 1 ] = gpXYZ( nn[ V110 ] );
+  myPnt[ ID_V001 - 1 ] = gpXYZ( nn[ V001 ] );
+  myPnt[ ID_V101 - 1 ] = gpXYZ( nn[ V101 ] );
+  myPnt[ ID_V011 - 1 ] = gpXYZ( nn[ V011 ] );
+  myPnt[ ID_V111 - 1 ] = gpXYZ( nn[ V111 ] );
+
+  // fill theOrderedNodes
+  theOrderedNodes.resize( 8 );
+  theOrderedNodes[ 0 ] = nn[ V000 ];
+  theOrderedNodes[ 1 ] = nn[ V100 ];
+  theOrderedNodes[ 2 ] = nn[ V010 ];
+  theOrderedNodes[ 3 ] = nn[ V110 ];
+  theOrderedNodes[ 4 ] = nn[ V001 ];
+  theOrderedNodes[ 5 ] = nn[ V101 ];
+  theOrderedNodes[ 6 ] = nn[ V011 ];
+  theOrderedNodes[ 7 ] = nn[ V111 ];
+  
+  // fill edges
+  myEdge[ ID_Ex00 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V000 - 1 ];
+  myEdge[ ID_Ex00 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V100 - 1 ];
+
+  myEdge[ ID_Ex10 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V010 - 1 ];
+  myEdge[ ID_Ex10 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V110 - 1 ];
+
+  myEdge[ ID_Ex01 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V001 - 1 ];
+  myEdge[ ID_Ex01 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V101 - 1 ];
+
+  myEdge[ ID_Ex11 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V011 - 1 ];
+  myEdge[ ID_Ex11 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V111 - 1 ];
+
+  myEdge[ ID_E0y0 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V000 - 1 ];
+  myEdge[ ID_E0y0 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V010 - 1 ];
+
+  myEdge[ ID_E1y0 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V100 - 1 ];
+  myEdge[ ID_E1y0 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V110 - 1 ];
+
+  myEdge[ ID_E0y1 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V001 - 1 ];
+  myEdge[ ID_E0y1 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V011 - 1 ];
+
+  myEdge[ ID_E1y1 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V101 - 1 ];
+  myEdge[ ID_E1y1 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V111 - 1 ];
+
+  myEdge[ ID_E00z - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V000 - 1 ];
+  myEdge[ ID_E00z - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V001 - 1 ];
+
+  myEdge[ ID_E10z - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V100 - 1 ];
+  myEdge[ ID_E10z - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V101 - 1 ];
+
+  myEdge[ ID_E01z - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V010 - 1 ];
+  myEdge[ ID_E01z - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V011 - 1 ];
+
+  myEdge[ ID_E11z - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V110 - 1 ];
+  myEdge[ ID_E11z - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V111 - 1 ];
+
+  for ( iE = ID_Ex00; iE <= ID_E11z; ++iE )
+    myEdge[ iE - ID_Ex00 ].myCoordInd = GetCoordIndOnEdge( iE );
+
+  // fill faces corners
+  for ( iF = ID_Fxy0; iF < ID_Shell; ++iF )
+  {
+    TFace& tFace = myFace[ iF - ID_Fxy0 ];
+    vector< int > edgeIdVec(4, -1);
+    GetFaceEdgesIDs( iF, edgeIdVec );
+    tFace.myNodes[ 0 ] = myEdge[ edgeIdVec [ 0 ] - ID_Ex00 ].myNodes[ 1 ];
+    tFace.myNodes[ 1 ] = myEdge[ edgeIdVec [ 0 ] - ID_Ex00 ].myNodes[ 0 ];
+    tFace.myNodes[ 2 ] = myEdge[ edgeIdVec [ 1 ] - ID_Ex00 ].myNodes[ 0 ];
+    tFace.myNodes[ 3 ] = myEdge[ edgeIdVec [ 1 ] - ID_Ex00 ].myNodes[ 1 ];
+    tFace.myCoordInd[ 0 ] = GetCoordIndOnEdge( edgeIdVec[ 0 ] );
+    tFace.myCoordInd[ 1 ] = GetCoordIndOnEdge( edgeIdVec[ 1 ] );
+    tFace.myCoordInd[ 2 ] = GetCoordIndOnEdge( edgeIdVec[ 2 ] );
+    tFace.myCoordInd[ 3 ] = GetCoordIndOnEdge( edgeIdVec[ 3 ] );
+  }
+
+  return true;
+}
+
 //=======================================================================
 //function : LoadBlockShapes
 //purpose  : add sub-shapes of theBlock to theShapeIDMap so that they get
 //=======================================================================
 //function : LoadBlockShapes
 //purpose  : add sub-shapes of theBlock to theShapeIDMap so that they get
@@ -629,7 +845,6 @@ static int getOrderedEdges (const TopoDS_Face&   theFace,
 bool SMESH_Block::LoadBlockShapes(const TopoDS_Shell&         theShell,
                                   const TopoDS_Vertex&        theVertex000,
                                   const TopoDS_Vertex&        theVertex001,
 bool SMESH_Block::LoadBlockShapes(const TopoDS_Shell&         theShell,
                                   const TopoDS_Vertex&        theVertex000,
                                   const TopoDS_Vertex&        theVertex001,
-//                             TopTools_IndexedMapOfShape& theShapeIDMap
                                   TopTools_IndexedMapOfOrientedShape& theShapeIDMap )
 {
   MESSAGE(" ::LoadBlockShapes()");
                                   TopTools_IndexedMapOfOrientedShape& theShapeIDMap )
 {
   MESSAGE(" ::LoadBlockShapes()");
@@ -639,7 +854,7 @@ bool SMESH_Block::LoadBlockShapes(const TopoDS_Shell&         theShell,
   mySumDist = 0;
   myGridComputed = false;
 
   mySumDist = 0;
   myGridComputed = false;
 
-  // 6 vertices
+  // 8 vertices
   TopoDS_Shape V000, V100, V010, V110, V001, V101, V011, V111;
   // 12 edges
   TopoDS_Shape Ex00, Ex10, Ex01, Ex11;
   TopoDS_Shape V000, V100, V010, V110, V001, V101, V011, V111;
   // 12 edges
   TopoDS_Shape Ex00, Ex10, Ex01, Ex11;
@@ -976,6 +1191,7 @@ bool SMESH_Block::LoadBlockShapes(const TopoDS_Shell&         theShell,
 
 void SMESH_Block::GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec )
 {
 
 void SMESH_Block::GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec )
 {
+  edgeVec.resize( 4 );
   switch ( faceID ) {
   case ID_Fxy0:
     edgeVec[ 0 ] = ID_Ex00;
   switch ( faceID ) {
   case ID_Fxy0:
     edgeVec[ 0 ] = ID_Ex00;
@@ -1017,3 +1233,69 @@ void SMESH_Block::GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec )
     MESSAGE(" GetFaceEdgesIDs(), wrong face ID: " << faceID );
   }
 }
     MESSAGE(" GetFaceEdgesIDs(), wrong face ID: " << faceID );
   }
 }
+
+//=======================================================================
+//function : GetEdgeVertexIDs
+//purpose  : return vertex IDs of an edge
+//=======================================================================
+
+void SMESH_Block::GetEdgeVertexIDs (const int edgeID, vector< int >& vertexVec )
+{
+  vertexVec.resize( 2 );
+  switch ( edgeID ) {
+
+  case ID_Ex00:
+    vertexVec[ 0 ] = ID_V000;
+    vertexVec[ 1 ] = ID_V100;
+    break;
+  case ID_Ex10:
+    vertexVec[ 0 ] = ID_V010;
+    vertexVec[ 1 ] = ID_V110;
+    break;
+  case ID_Ex01:
+    vertexVec[ 0 ] = ID_V001;
+    vertexVec[ 1 ] = ID_V101;
+    break;
+  case ID_Ex11:
+    vertexVec[ 0 ] = ID_V011;
+    vertexVec[ 1 ] = ID_V111;
+    break;
+
+  case ID_E0y0:
+    vertexVec[ 0 ] = ID_V000;
+    vertexVec[ 1 ] = ID_V010;
+    break;
+  case ID_E1y0:
+    vertexVec[ 0 ] = ID_V100;
+    vertexVec[ 1 ] = ID_V110;
+    break;
+  case ID_E0y1:
+    vertexVec[ 0 ] = ID_V001;
+    vertexVec[ 1 ] = ID_V011;
+    break;
+  case ID_E1y1:
+    vertexVec[ 0 ] = ID_V101;
+    vertexVec[ 1 ] = ID_V111;
+    break;
+
+  case ID_E00z:
+    vertexVec[ 0 ] = ID_V000;
+    vertexVec[ 1 ] = ID_V001;
+    break;
+  case ID_E10z:
+    vertexVec[ 0 ] = ID_V100;
+    vertexVec[ 1 ] = ID_V101;
+    break;
+  case ID_E01z:
+    vertexVec[ 0 ] = ID_V010;
+    vertexVec[ 1 ] = ID_V011;
+    break;
+  case ID_E11z:
+    vertexVec[ 0 ] = ID_V110;
+    vertexVec[ 1 ] = ID_V111;
+    break;
+  default:
+    MESSAGE(" GetEdgeVertexIDs(), wrong edge ID: " << edgeID );
+  }
+}
+
index d937aeddd84700aa82f03db33dc619057b4f31bc..7ab38891a2ed1b53c143ea26ec5243c7728553bc 100644 (file)
@@ -44,6 +44,9 @@
 #include <ostream>
 #include <vector>
 
 #include <ostream>
 #include <vector>
 
+class SMDS_MeshVolume;
+class SMDS_MeshNode;
+
 // =========================================================
 // class calculating coordinates of 3D points by normalized
 // parameters inside the block and vice versa
 // =========================================================
 // class calculating coordinates of 3D points by normalized
 // parameters inside the block and vice versa
@@ -85,6 +88,13 @@ class SMESH_Block: public math_FunctionSetWithDerivatives
   // add sub-shapes of theBlock to theShapeIDMap so that they get
   // IDs acoording to enum TShapeID
 
   // add sub-shapes of theBlock to theShapeIDMap so that they get
   // IDs acoording to enum TShapeID
 
+  bool LoadMeshBlock(const SMDS_MeshVolume*        theVolume,
+                     const int                     theNode000Index,
+                     const int                     theNode001Index,
+                     vector<const SMDS_MeshNode*>& theOrderedNodes);
+  // prepare to work with theVolume and
+  // return nodes in the order of TShapeID enum
+
   static int GetShapeIDByParams ( const gp_XYZ& theParams );
   // define an id of the block sub-shape by point parameters
 
   static int GetShapeIDByParams ( const gp_XYZ& theParams );
   // define an id of the block sub-shape by point parameters
 
@@ -117,6 +127,9 @@ class SMESH_Block: public math_FunctionSetWithDerivatives
   static void GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec );
   // return edges IDs of a face in the order u0, u1, 0v, 1v
 
   static void GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec );
   // return edges IDs of a face in the order u0, u1, 0v, 1v
 
+  static void GetEdgeVertexIDs (const int edgeID, vector< int >& vertexVec );
+  // return vertex IDs of an edge
+
   static int GetCoordIndOnEdge (const int theEdgeID)
   { return (theEdgeID < ID_E0y0) ? 1 : (theEdgeID < ID_E00z) ? 2 : 3; }
   // return an index of a coordinate which varies along the edge
   static int GetCoordIndOnEdge (const int theEdgeID)
   { return (theEdgeID < ID_E0y0) ? 1 : (theEdgeID < ID_E00z) ? 2 : 3; }
   // return an index of a coordinate which varies along the edge
@@ -161,6 +174,8 @@ class SMESH_Block: public math_FunctionSetWithDerivatives
     gp_Trsf            myTrsf;
     double GetU( const gp_XYZ& theParams ) const;
     gp_XYZ Point( const gp_XYZ& theParams ) const;
     gp_Trsf            myTrsf;
     double GetU( const gp_XYZ& theParams ) const;
     gp_XYZ Point( const gp_XYZ& theParams ) const;
+    // if mesh volume
+    gp_XYZ             myNodes[2];
   };
 
   struct TFace {
   };
 
   struct TFace {
@@ -178,10 +193,13 @@ class SMESH_Block: public math_FunctionSetWithDerivatives
     gp_XYZ Point( const gp_XYZ& theParams ) const;
     int GetUInd() const { return myCoordInd[ 0 ]; }
     int GetVInd() const { return myCoordInd[ 2 ]; }
     gp_XYZ Point( const gp_XYZ& theParams ) const;
     int GetUInd() const { return myCoordInd[ 0 ]; }
     int GetVInd() const { return myCoordInd[ 2 ]; }
+    void GetCoefs( int i, const gp_XYZ& theParams, double& eCoef, double& vCoef ) const;
+    // if mesh volume
+    gp_XYZ               myNodes[4];
   };
 
   TopoDS_Shell myShell;
   };
 
   TopoDS_Shell myShell;
-  // geometry:
+  // geometry in the order as in TShapeID:
   // 8 vertices
   gp_XYZ myPnt[ 8 ];
   // 12 edges
   // 8 vertices
   gp_XYZ myPnt[ 8 ];
   // 12 edges
index 0c05113cf685d51b73c737d8a702e69d9d58edda..a778699e10f628fb0c94a713c00c363d193ecdee 100644 (file)
@@ -631,11 +631,15 @@ throw(SALOME_Exception)
  */
 //=============================================================================
 
  */
 //=============================================================================
 
-void SMESH_Mesh::ExportMED(const char *file, const char* theMeshName, bool theAutoGroups) throw(SALOME_Exception)
+void SMESH_Mesh::ExportMED(const char *file, 
+                          const char* theMeshName, 
+                          bool theAutoGroups,
+                          int theVersion) 
+  throw(SALOME_Exception)
 {
   Unexpect aCatch(SalomeException);
   DriverMED_W_SMESHDS_Mesh myWriter;
 {
   Unexpect aCatch(SalomeException);
   DriverMED_W_SMESHDS_Mesh myWriter;
-  myWriter.SetFile    ( file        );
+  myWriter.SetFile    ( file, MED::EVersion(theVersion) );
   myWriter.SetMesh    ( _myMeshDS   );
   if ( !theMeshName ) 
     myWriter.SetMeshId  ( _idDoc      );
   myWriter.SetMesh    ( _myMeshDS   );
   if ( !theMeshName ) 
     myWriter.SetMeshId  ( _idDoc      );
index 51f0853643a57695912677694c259b9518115cfe..0ddd8398bf47afb3dd9451f2a5edc524cbce3e40 100644 (file)
@@ -136,8 +136,13 @@ public:
   // return list of ancestors of theSubShape in the order
   // that lower dimention shapes come first.
   
   // return list of ancestors of theSubShape in the order
   // that lower dimention shapes come first.
   
+  void ExportMED(const char *file, 
+                const char* theMeshName = NULL, 
+                bool theAutoGroups = true, 
+                int theVersion = 0) 
+    throw(SALOME_Exception);
+
   void ExportDAT(const char *file) throw(SALOME_Exception);
   void ExportDAT(const char *file) throw(SALOME_Exception);
-  void ExportMED(const char *file, const char* theMeshName = NULL, bool theAutoGroups = true) throw(SALOME_Exception);
   void ExportUNV(const char *file) throw(SALOME_Exception);
   void ExportSTL(const char *file, const bool isascii) throw(SALOME_Exception);
   
   void ExportUNV(const char *file) throw(SALOME_Exception);
   void ExportSTL(const char *file, const bool isascii) throw(SALOME_Exception);
   
index 71a4d3c1136e7bb1d70a09471d8f6d99c137ee71..dc39a8e4de1e721e86d686bf3c20c0f002d518e2 100644 (file)
 
 #include "SMESH_MeshEditor.hxx"
 
 
 #include "SMESH_MeshEditor.hxx"
 
+#include "SMESH_ControlsDef.hxx"
+
 #include "SMDS_FaceOfNodes.hxx"
 #include "SMDS_VolumeTool.hxx"
 #include "SMESHDS_Group.hxx"
 #include "SMESHDS_Mesh.hxx"
 #include "SMESH_subMesh.hxx"
 #include "SMDS_FaceOfNodes.hxx"
 #include "SMDS_VolumeTool.hxx"
 #include "SMESHDS_Group.hxx"
 #include "SMESHDS_Mesh.hxx"
 #include "SMESH_subMesh.hxx"
+#include "SMESH_ControlsDef.hxx"
 
 #include "utilities.h"
 
 
 #include "utilities.h"
 
-#include <TColgp_SequenceOfXYZ.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <TopTools_ListOfShape.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <TopTools_ListOfShape.hxx>
+#include <gp_Dir.hxx>
 #include <gp_Vec.hxx>
 #include <gp_Ax1.hxx>
 #include <gp_Trsf.hxx>
 #include <gp_Lin.hxx>
 #include <gp_Vec.hxx>
 #include <gp_Ax1.hxx>
 #include <gp_Trsf.hxx>
 #include <gp_Lin.hxx>
+#include <gp_XYZ.hxx>
 #include <gp.hxx>
 #include <gp_Pln.hxx>
 #include <gp.hxx>
 #include <gp_Pln.hxx>
+#include <BRep_Tool.hxx>
+#include <SMDS_EdgePosition.hxx>
+#include <Geom_Curve.hxx>
+
 
 #include <map>
 
 
 #include <map>
 
+#include "utilities.h"
+
 using namespace std;
 using namespace std;
+using namespace SMESH::Controls;
 
 
-typedef map<const SMDS_MeshNode*, const SMDS_MeshNode*>           TNodeNodeMap;
-typedef map<const SMDS_MeshNode*, list<const SMDS_MeshNode*> >    TNodeOfNodeListMap;
-typedef map<const SMDS_MeshElement*, list<const SMDS_MeshNode*> > TElemOfNodeListMap;
+typedef map<const SMDS_MeshNode*, const SMDS_MeshNode*>              TNodeNodeMap;
+typedef map<const SMDS_MeshElement*, list<const SMDS_MeshNode*> >    TElemOfNodeListMap;
+typedef map<const SMDS_MeshElement*, list<const SMDS_MeshElement*> > TElemOfElemListMap;
+typedef map<const SMDS_MeshNode*, list<const SMDS_MeshNode*> >       TNodeOfNodeListMap;
+typedef TNodeOfNodeListMap::iterator                                 TNodeOfNodeListMapItr;
+typedef map<const SMDS_MeshElement*, vector<TNodeOfNodeListMapItr> > TElemOfVecOfNnlmiMap;
 
 //=======================================================================
 //function : SMESH_MeshEditor
 
 //=======================================================================
 //function : SMESH_MeshEditor
@@ -493,7 +507,7 @@ bool SMESH_MeshEditor::Reorient (const SMDS_MeshElement * theFace)
 static double getBadRate (const SMDS_MeshElement*               theElem,
                           SMESH::Controls::NumericalFunctorPtr& theCrit)
 {
 static double getBadRate (const SMDS_MeshElement*               theElem,
                           SMESH::Controls::NumericalFunctorPtr& theCrit)
 {
-  TColgp_SequenceOfXYZ P;
+  SMESH::Controls::TSequenceOfXYZ P;
   if ( !theElem || !theCrit->GetPoints( theElem, P ))
     return 1e100;
   return theCrit->GetBadRate( theCrit->GetValue( P ), theElem->NbNodes() );
   if ( !theElem || !theCrit->GetPoints( theElem, P ))
     return 1e100;
   return theCrit->GetBadRate( theCrit->GetValue( P ), theElem->NbNodes() );
@@ -568,13 +582,13 @@ bool SMESH_MeshEditor::QuadToTri (set<const SMDS_MeshElement*> &       theElems,
 }
 
 //=======================================================================
 }
 
 //=======================================================================
-//function : addToSameGroups
+//function : AddToSameGroups
 //purpose  : add elemToAdd to the groups the elemInGroups belongs to
 //=======================================================================
 
 //purpose  : add elemToAdd to the groups the elemInGroups belongs to
 //=======================================================================
 
-static void addToSameGroups (const SMDS_MeshElement* elemToAdd,
-                             const SMDS_MeshElement* elemInGroups,
-                             SMESHDS_Mesh *          aMesh)
+void SMESH_MeshEditor::AddToSameGroups (const SMDS_MeshElement* elemToAdd,
+                                        const SMDS_MeshElement* elemInGroups,
+                                        SMESHDS_Mesh *          aMesh)
 {
   const set<SMESHDS_GroupBase*>& groups = aMesh->GetGroups();
   set<SMESHDS_GroupBase*>::const_iterator grIt = groups.begin();
 {
   const set<SMESHDS_GroupBase*>& groups = aMesh->GetGroups();
   set<SMESHDS_GroupBase*>::const_iterator grIt = groups.begin();
@@ -630,7 +644,7 @@ bool SMESH_MeshEditor::QuadToTri (std::set<const SMDS_MeshElement*> & theElems,
     if ( aShapeId )
       aMesh->SetMeshElementOnShape( newElem, aShapeId );
 
     if ( aShapeId )
       aMesh->SetMeshElementOnShape( newElem, aShapeId );
 
-    addToSameGroups( newElem, elem, aMesh );
+    AddToSameGroups( newElem, elem, aMesh );
   }
 
   return true;
   }
 
   return true;
@@ -649,7 +663,7 @@ double getAngle(const SMDS_MeshElement * tr1,
   double angle = 2*PI; // bad angle
 
   // get normals
   double angle = 2*PI; // bad angle
 
   // get normals
-  TColgp_SequenceOfXYZ P1, P2;
+  SMESH::Controls::TSequenceOfXYZ P1, P2;
   if ( !SMESH::Controls::NumericalFunctor::GetPoints( tr1, P1 ) ||
        !SMESH::Controls::NumericalFunctor::GetPoints( tr2, P2 ))
     return angle;
   if ( !SMESH::Controls::NumericalFunctor::GetPoints( tr1, P1 ) ||
        !SMESH::Controls::NumericalFunctor::GetPoints( tr2, P2 ))
     return angle;
@@ -1315,13 +1329,13 @@ void centroidalSmooth(SMESHDS_Mesh *                       theMesh,
     nbElems++;
 
     gp_XYZ elemCenter(0.,0.,0.);
     nbElems++;
 
     gp_XYZ elemCenter(0.,0.,0.);
-    TColgp_SequenceOfXYZ aNodePoints;
+    SMESH::Controls::TSequenceOfXYZ aNodePoints;
     SMDS_ElemIteratorPtr itN = elem->nodesIterator();
     while ( itN->more() )
     {
       const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>( itN->next() );
       gp_XYZ aP( aNode->X(), aNode->Y(), aNode->Z() );
     SMDS_ElemIteratorPtr itN = elem->nodesIterator();
     while ( itN->more() )
     {
       const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>( itN->next() );
       gp_XYZ aP( aNode->X(), aNode->Y(), aNode->Z() );
-      aNodePoints.Append( aP );
+      aNodePoints.push_back( aP );
       elemCenter += aP;
     }
     double elemArea = anAreaFunc.GetValue( aNodePoints );
       elemCenter += aP;
     }
     double elemArea = anAreaFunc.GetValue( aNodePoints );
@@ -1453,7 +1467,7 @@ void SMESH_MeshEditor::Smooth (set<const SMDS_MeshElement*> & theElems,
       const SMDS_MeshElement* elem = (*itElem);
       if ( !elem || elem->GetType() != SMDSAbs_Face )
         continue;
       const SMDS_MeshElement* elem = (*itElem);
       if ( !elem || elem->GetType() != SMDSAbs_Face )
         continue;
-      TColgp_SequenceOfXYZ aPoints;
+      SMESH::Controls::TSequenceOfXYZ aPoints;
       if ( aQualityFunc.GetPoints( elem, aPoints )) {
         double aValue = aQualityFunc.GetValue( aPoints );
         if ( aValue > maxRatio )
       if ( aQualityFunc.GetPoints( elem, aPoints )) {
         double aValue = aQualityFunc.GetValue( aPoints );
         if ( aValue > maxRatio )
@@ -1472,7 +1486,9 @@ void SMESH_MeshEditor::Smooth (set<const SMDS_MeshElement*> & theElems,
 
 //=======================================================================
 //function : isReverse
 
 //=======================================================================
 //function : isReverse
-//purpose  : 
+//purpose  : Return true if normal of prevNodes is not co-directied with
+//           gp_Vec(prevNodes[iNotSame],nextNodes[iNotSame]).
+//           iNotSame is where prevNodes and nextNodes are different
 //=======================================================================
 
 static bool isReverse(const SMDS_MeshNode* prevNodes[],
 //=======================================================================
 
 static bool isReverse(const SMDS_MeshNode* prevNodes[],
@@ -1500,42 +1516,39 @@ static bool isReverse(const SMDS_MeshNode* prevNodes[],
 
 //=======================================================================
 //function : sweepElement
 
 //=======================================================================
 //function : sweepElement
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 //=======================================================================
 
-static void sweepElement(SMESHDS_Mesh*              aMesh,
-                         const SMDS_MeshElement*    elem,
-                         const TNodeOfNodeListMap&  mapNewNodes )
+static void sweepElement(SMESHDS_Mesh*                         aMesh,
+                         const SMDS_MeshElement*               elem,
+                         const vector<TNodeOfNodeListMapItr> & newNodesItVec,
+                         list<const SMDS_MeshElement*>&        newElems)
 {
   // Loop on elem nodes:
   // find new nodes and detect same nodes indices
 {
   // Loop on elem nodes:
   // find new nodes and detect same nodes indices
-  list<const SMDS_MeshNode*>::const_iterator itNN[ 4 ];
-  const SMDS_MeshNode* prevNod[ 4 ], *nextNod[ 4 ];
-  int nbSame = 0, iNotSameNode = 0, iSameNode = 0;
-
-  TNodeOfNodeListMap::const_iterator mapIt;
-  int iNode = 0;
-  SMDS_ElemIteratorPtr itN = elem->nodesIterator();
-  while ( itN->more() )
+  int nbNodes = elem->NbNodes();
+  list<const SMDS_MeshNode*>::const_iterator itNN[ nbNodes ];
+  const SMDS_MeshNode* prevNod[ nbNodes ], *nextNod[ nbNodes ];
+  int iNode, nbSame = 0, iNotSameNode = 0, iSameNode = 0;
+
+  for ( iNode = 0; iNode < nbNodes; iNode++ )
   {
   {
-    const SMDS_MeshNode* node =
-      static_cast<const SMDS_MeshNode*>( itN->next() );
-    mapIt = mapNewNodes.find( node );
-    if ( mapIt == mapNewNodes.end() )
-      return; // not duplicated node
+    TNodeOfNodeListMapItr nnIt = newNodesItVec[ iNode ];
+    const SMDS_MeshNode*                 node         = nnIt->first;
+    const list< const SMDS_MeshNode* > & listNewNodes = nnIt->second;
+    if ( listNewNodes.empty() )
+      return;
 
 
-    itNN[ iNode ] = (*mapIt).second.begin();
+    itNN[ iNode ] = listNewNodes.begin();
     prevNod[ iNode ] = node;
     prevNod[ iNode ] = node;
-    nextNod[ iNode ] = (*mapIt).second.front();
+    nextNod[ iNode ] = listNewNodes.front();
     if ( prevNod[ iNode ] != nextNod [ iNode ])
       iNotSameNode = iNode;
     else {
       iSameNode = iNode;
       nbSame++;
     }
     if ( prevNod[ iNode ] != nextNod [ iNode ])
       iNotSameNode = iNode;
     else {
       iSameNode = iNode;
       nbSame++;
     }
-    iNode++;
   }
   }
-  int nbNodes = iNode;
   if ( nbSame == nbNodes || nbSame > 2) {
     MESSAGE( " Too many same nodes of element " << elem->GetID() );
     return;
   if ( nbSame == nbNodes || nbSame > 2) {
     MESSAGE( " Too many same nodes of element " << elem->GetID() );
     return;
@@ -1550,8 +1563,8 @@ static void sweepElement(SMESHDS_Mesh*              aMesh,
 
   // check element orientation
   int i0 = 0, i2 = 2;
 
   // check element orientation
   int i0 = 0, i2 = 2;
-  if ( nbNodes > 2 && isReverse( prevNod, nextNod, nbNodes, iNotSameNode )) {
-//    MESSAGE("Reversed elem " << elem->GetID() );
+  if ( nbNodes > 2 && !isReverse( prevNod, nextNod, nbNodes, iNotSameNode )) {
+    //MESSAGE("Reversed elem " << elem );
     i0 = 2;
     i2 = 0;
     if ( nbSame > 0 ) {
     i0 = 2;
     i2 = 0;
     if ( nbSame > 0 ) {
@@ -1562,7 +1575,7 @@ static void sweepElement(SMESHDS_Mesh*              aMesh,
   }
 
   // make new elements
   }
 
   // make new elements
-  int iStep, nbSteps = (*mapIt).second.size();
+  int iStep, nbSteps = newNodesItVec[ 0 ]->second.size();
   for (iStep = 0; iStep < nbSteps; iStep++ )
   {
     // get next nodes
   for (iStep = 0; iStep < nbSteps; iStep++ )
   {
     // get next nodes
@@ -1570,69 +1583,76 @@ static void sweepElement(SMESHDS_Mesh*              aMesh,
       nextNod[ iNode ] = *itNN[ iNode ];
       itNN[ iNode ]++;
     }
       nextNod[ iNode ] = *itNN[ iNode ];
       itNN[ iNode ]++;
     }
+    SMDS_MeshElement* aNewElem = 0;
     switch ( nbNodes )
     {
     switch ( nbNodes )
     {
+    case 1: { // NODE
+      if ( nbSame == 0 )
+        aNewElem = aMesh->AddEdge( prevNod[ 0 ], nextNod[ 0 ] );
+      break;
+    }
     case 2: { // EDGE
 
       if ( nbSame == 0 )
     case 2: { // EDGE
 
       if ( nbSame == 0 )
-        aMesh->AddFace( prevNod[ 0 ], prevNod[ 1 ], nextNod[ 1 ], nextNod[ 0 ] );
+        aNewElem = aMesh->AddFace(prevNod[ 0 ], prevNod[ 1 ],
+                                  nextNod[ 1 ], nextNod[ 0 ] );
       else
       else
-        aMesh->AddFace( prevNod[ 0 ], prevNod[ 1 ], nextNod[ iNotSameNode ] );
+        aNewElem = aMesh->AddFace(prevNod[ 0 ], prevNod[ 1 ],
+                                  nextNod[ iNotSameNode ] );
       break;
     }
     case 3: { // TRIANGLE
 
       break;
     }
     case 3: { // TRIANGLE
 
-      if ( nbSame == 0 )       // --- 1 pentahedron
-      {
-        aMesh->AddVolume (prevNod[ i2 ], prevNod[ 1 ], prevNod[ i0 ],
-                          nextNod[ i2 ], nextNod[ 1 ], nextNod[ i0 ] );
-      }
-      else if ( nbSame == 1 )  // --- 2 tetrahedrons
-      {
-        aMesh->AddVolume (prevNod[ i0 ], prevNod[ 1 ], prevNod[ i2 ],
-                          nextNod[ iBeforeSame ]);
-        aMesh->AddVolume (nextNod[ i2 ], nextNod[ 1 ], nextNod[ i0 ],
-                          prevNod[ iAfterSame ]);
-      }
-      else // 2 same nodes:      --- 1 tetrahedron
-      {
-        aMesh->AddVolume (prevNod[ i0 ], prevNod[ 1 ], prevNod[ i2 ],
-                          nextNod[ iNotSameNode ]);
-      }
+      if ( nbSame == 0 )       // --- pentahedron
+        aNewElem = aMesh->AddVolume (prevNod[ i0 ], prevNod[ 1 ], prevNod[ i2 ],
+                                     nextNod[ i0 ], nextNod[ 1 ], nextNod[ i2 ] );
+
+      else if ( nbSame == 1 )  // --- pyramid
+        aNewElem = aMesh->AddVolume (prevNod[ iAfterSame ],  prevNod[ iBeforeSame ],
+                                     nextNod[ iBeforeSame ], nextNod[ iAfterSame ],
+                                     nextNod[ iSameNode ]);
+
+      else // 2 same nodes:      --- tetrahedron
+        aNewElem = aMesh->AddVolume (prevNod[ i0 ], prevNod[ 1 ], prevNod[ i2 ],
+                                     nextNod[ iNotSameNode ]);
       break;
     }
     case 4: { // QUADRANGLE
 
       break;
     }
     case 4: { // QUADRANGLE
 
-      if ( nbSame == 0 )       // --- 1 hexahedron
-      {
-        aMesh->AddVolume (prevNod[ i0 ], prevNod[ 1 ], prevNod[ i2 ], prevNod[ 3 ],
-                          nextNod[ i0 ], nextNod[ 1 ], nextNod[ i2 ], nextNod[ 3 ]);
-      }
-      else if ( nbSame == 1 )  // --- 2 tetrahedrons + 1 pentahedron
+      if ( nbSame == 0 )       // --- hexahedron
+        aNewElem = aMesh->AddVolume (prevNod[ i0 ], prevNod[ 1 ], prevNod[ i2 ], prevNod[ 3 ],
+                                     nextNod[ i0 ], nextNod[ 1 ], nextNod[ i2 ], nextNod[ 3 ]);
+
+      else if ( nbSame == 1 )  // --- pyramid + pentahedron
       {
       {
-        aMesh->AddVolume (prevNod[ iBeforeSame ], prevNod[ iSameNode ],
-                          prevNod[ iAfterSame ],  nextNod[ iBeforeSame ]);
-        aMesh->AddVolume (nextNod[ iAfterSame ],  nextNod[ iSameNode ],
-                          nextNod[ iBeforeSame ], prevNod[ iAfterSame ]);
-        aMesh->AddVolume (prevNod[ iBeforeSame ], prevNod[ iOpposSame ], prevNod[ iAfterSame ],
-                          nextNod[ iBeforeSame ], nextNod[ iOpposSame ], nextNod[ iAfterSame ] );
+        aNewElem = aMesh->AddVolume (prevNod[ iAfterSame ],  prevNod[ iBeforeSame ],
+                                     nextNod[ iBeforeSame ], nextNod[ iAfterSame ],
+                                     nextNod[ iSameNode ]);
+        newElems.push_back( aNewElem );
+        aNewElem = aMesh->AddVolume (prevNod[ iBeforeSame ], prevNod[ iOpposSame ],
+                                     prevNod[ iAfterSame ],  nextNod[ iBeforeSame ],
+                                     nextNod[ iOpposSame ],  nextNod[ iAfterSame ] );
       }
       }
-      else if ( nbSame == 2 )  // pentahedron
+      else if ( nbSame == 2 )  // pentahedron
       {
         if ( prevNod[ iBeforeSame ] == nextNod[ iBeforeSame ] )
           // iBeforeSame is same too
       {
         if ( prevNod[ iBeforeSame ] == nextNod[ iBeforeSame ] )
           // iBeforeSame is same too
-          aMesh->AddVolume (prevNod[ iOpposSame ], prevNod[ iBeforeSame ], nextNod[ iOpposSame ],
-                            prevNod[ iAfterSame ], prevNod[ iSameNode ],   nextNod[ iAfterSame ]);
+          aNewElem = aMesh->AddVolume (prevNod[ iOpposSame ], prevNod[ iBeforeSame ],
+                                       nextNod[ iOpposSame ], prevNod[ iAfterSame ],
+                                       prevNod[ iSameNode ],  nextNod[ iAfterSame ]);
         else
           // iAfterSame is same too
         else
           // iAfterSame is same too
-          aMesh->AddVolume (prevNod[ iBeforeSame ], prevNod[ iSameNode ],  nextNod[ iBeforeSame ],
-                            prevNod[ iOpposSame ],  prevNod[ iAfterSame ], nextNod[ iOpposSame ]);
+          aNewElem = aMesh->AddVolume (prevNod[ iBeforeSame ], prevNod[ iSameNode ],
+                                       nextNod[ iBeforeSame ], prevNod[ iOpposSame ],
+                                       prevNod[ iAfterSame ],  nextNod[ iOpposSame ]);
       }
       break;
     }
     default:
       return;
     }
       }
       break;
     }
     default:
       return;
     }
+    if ( aNewElem )
+      newElems.push_back( aNewElem );
 
     // set new prev nodes
     for ( iNode = 0; iNode < nbNodes; iNode++ )
 
     // set new prev nodes
     for ( iNode = 0; iNode < nbNodes; iNode++ )
@@ -1641,6 +1661,162 @@ static void sweepElement(SMESHDS_Mesh*              aMesh,
   } // for steps
 }
 
   } // for steps
 }
 
+//=======================================================================
+//function : makeWalls
+//purpose  : create 1D and 2D elements around swept elements
+//=======================================================================
+
+static void makeWalls (SMESHDS_Mesh*                 aMesh,
+                       TNodeOfNodeListMap &          mapNewNodes,
+                       TElemOfElemListMap &          newElemsMap,
+                       TElemOfVecOfNnlmiMap &        elemNewNodesMap,
+                       set<const SMDS_MeshElement*>& elemSet)
+{
+  ASSERT( newElemsMap.size() == elemNewNodesMap.size() );
+
+  // Find nodes belonging to only one initial element - sweep them to get edges.
+
+  TNodeOfNodeListMapItr nList = mapNewNodes.begin();
+  for ( ; nList != mapNewNodes.end(); nList++ )
+  {
+    const SMDS_MeshNode* node =
+      static_cast<const SMDS_MeshNode*>( nList->first );
+    SMDS_ElemIteratorPtr eIt = node->GetInverseElementIterator();
+    int nbInitElems = 0;
+    while ( eIt->more() && nbInitElems < 2 )
+      if ( elemSet.find( eIt->next() ) != elemSet.end() )
+        nbInitElems++;
+    if ( nbInitElems < 2 ) {
+      vector<TNodeOfNodeListMapItr> newNodesItVec( 1, nList );
+      list<const SMDS_MeshElement*> newEdges;
+      sweepElement( aMesh, node, newNodesItVec, newEdges );
+    }
+  }
+
+  // Make a ceiling for each element ie an equal element of last new nodes.
+  // Find free links of faces - make edges and sweep them into faces.
+  
+  TElemOfElemListMap::iterator   itElem      = newElemsMap.begin();
+  TElemOfVecOfNnlmiMap::iterator itElemNodes = elemNewNodesMap.begin();
+  for ( ; itElem != newElemsMap.end(); itElem++, itElemNodes++ )
+  {
+    const SMDS_MeshElement* elem = itElem->first;
+    vector<TNodeOfNodeListMapItr>& vecNewNodes = itElemNodes->second;
+
+    if ( elem->GetType() == SMDSAbs_Edge )
+    {
+      // create a ceiling edge
+      aMesh->AddEdge(vecNewNodes[ 0 ]->second.back(),
+                     vecNewNodes[ 1 ]->second.back() );
+    }
+    if ( elem->GetType() != SMDSAbs_Face )
+      continue;
+
+    bool hasFreeLinks = false;
+
+    set<const SMDS_MeshElement*> avoidSet;
+    avoidSet.insert( elem );
+
+    // loop on a face nodes
+    set<const SMDS_MeshNode*> aFaceLastNodes;
+    int iNode, nbNodes = vecNewNodes.size();
+    for ( iNode = 0; iNode < nbNodes; iNode++ )
+    {
+      aFaceLastNodes.insert( vecNewNodes[ iNode ]->second.back() );
+      // look for free links of a face
+      int iNext = ( iNode + 1 == nbNodes ) ? 0 : iNode + 1;
+      const SMDS_MeshNode* n1 = vecNewNodes[ iNode ]->first;
+      const SMDS_MeshNode* n2 = vecNewNodes[ iNext ]->first;
+      // check if a link is free
+      if ( ! SMESH_MeshEditor::FindFaceInSet ( n1, n2, elemSet, avoidSet ))
+      {
+        hasFreeLinks = true;
+        // make an edge and a ceiling for a new edge
+        if ( !aMesh->FindEdge( n1, n2 ))
+          aMesh->AddEdge( n1, n2 );
+        n1 = vecNewNodes[ iNode ]->second.back();
+        n2 = vecNewNodes[ iNext ]->second.back();
+        if ( !aMesh->FindEdge( n1, n2 ))
+          aMesh->AddEdge( n1, n2 );
+      }
+    }
+    // sweep free links into faces
+
+    if ( hasFreeLinks )
+    {
+      list<const SMDS_MeshElement*> & newVolumes = itElem->second;
+      int iStep, nbSteps = vecNewNodes[0]->second.size();
+      int iVol, volNb, nbVolumesByStep = newVolumes.size() / nbSteps;
+
+      set<const SMDS_MeshNode*> initNodeSet, faceNodeSet;
+      for ( iNode = 0; iNode < nbNodes; iNode++ )
+        initNodeSet.insert( vecNewNodes[ iNode ]->first );
+
+      for ( volNb = 0; volNb < nbVolumesByStep; volNb++ )
+      {
+        list<const SMDS_MeshElement*>::iterator v = newVolumes.begin();
+        iVol = 0;
+        while ( iVol++ < volNb ) v++;
+        // find indices of free faces of a volume
+        list< int > fInd;
+        SMDS_VolumeTool vTool( *v );
+        int iF, nbF = vTool.NbFaces();
+        for ( iF = 0; iF < nbF; iF ++ )
+          if (vTool.IsFreeFace( iF ) &&
+              vTool.GetFaceNodes( iF, faceNodeSet ) &&
+              initNodeSet != faceNodeSet) // except an initial face
+            fInd.push_back( iF );
+        if ( fInd.empty() )
+          continue;
+
+        // create faces for all steps
+        for ( iStep = 0; iStep < nbSteps; iStep++ )
+        {
+          vTool.Set( *v );
+          vTool.SetExternalNormal();
+          list< int >::iterator ind = fInd.begin();
+          for ( ; ind != fInd.end(); ind++ )
+          {
+            const SMDS_MeshNode** nodes = vTool.GetFaceNodes( *ind );
+            switch ( vTool.NbFaceNodes( *ind ) ) {
+            case 3:
+              aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ] ); break;
+            case 4:
+              aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ] ); break;
+            }
+          }
+          // go to the next volume
+          iVol = 0;
+          while ( iVol++ < nbVolumesByStep ) v++;
+        }
+      }
+    } // sweep free links into faces
+
+    // make a ceiling face with a normal external to a volume
+      
+    SMDS_VolumeTool lastVol( itElem->second.back() );
+    int iF = lastVol.GetFaceIndex( aFaceLastNodes );
+    if ( iF >= 0 )
+    {
+      lastVol.SetExternalNormal();
+      const SMDS_MeshNode** nodes = lastVol.GetFaceNodes( iF );
+      switch ( lastVol.NbFaceNodes( iF ) ) {
+      case 3:
+        if (!hasFreeLinks ||
+            !aMesh->FindFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ]))
+          aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ] );
+        break;
+      case 4:
+        if (!hasFreeLinks ||
+            !aMesh->FindFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ]))
+          aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ] );
+        break;
+      }
+    }
+
+  } // loop on swept elements
+}
+
 //=======================================================================
 //function : RotationSweep
 //purpose  : 
 //=======================================================================
 //function : RotationSweep
 //purpose  : 
@@ -1652,6 +1828,7 @@ void SMESH_MeshEditor::RotationSweep(set<const SMDS_MeshElement*> & theElems,
                                      const int                      theNbSteps,
                                      const double                   theTol)
 {
                                      const int                      theNbSteps,
                                      const double                   theTol)
 {
+  MESSAGE( "RotationSweep()");
   gp_Trsf aTrsf;
   aTrsf.SetRotation( theAxis, theAngle );
 
   gp_Trsf aTrsf;
   aTrsf.SetRotation( theAxis, theAngle );
 
@@ -1661,17 +1838,18 @@ void SMESH_MeshEditor::RotationSweep(set<const SMDS_MeshElement*> & theElems,
   SMESHDS_Mesh* aMesh = GetMeshDS();
 
   TNodeOfNodeListMap mapNewNodes;
   SMESHDS_Mesh* aMesh = GetMeshDS();
 
   TNodeOfNodeListMap mapNewNodes;
+  TElemOfVecOfNnlmiMap mapElemNewNodes;
+  TElemOfElemListMap newElemsMap;
 
   // loop on theElems
   set< const SMDS_MeshElement* >::iterator itElem;
   for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
   {
 
   // loop on theElems
   set< const SMDS_MeshElement* >::iterator itElem;
   for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
   {
-    // check element type
     const SMDS_MeshElement* elem = (*itElem);
     const SMDS_MeshElement* elem = (*itElem);
-    if ( !elem ||
-        (elem->GetType() != SMDSAbs_Face &&
-         elem->GetType() != SMDSAbs_Edge ))
+    if ( !elem )
       continue;
       continue;
+    vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ];
+    newNodesItVec.reserve( elem->NbNodes() );
 
     // loop on elem nodes
     SMDS_ElemIteratorPtr itN = elem->nodesIterator();
 
     // loop on elem nodes
     SMDS_ElemIteratorPtr itN = elem->nodesIterator();
@@ -1680,28 +1858,34 @@ void SMESH_MeshEditor::RotationSweep(set<const SMDS_MeshElement*> & theElems,
       // check if a node has been already sweeped
       const SMDS_MeshNode* node =
         static_cast<const SMDS_MeshNode*>( itN->next() );
       // check if a node has been already sweeped
       const SMDS_MeshNode* node =
         static_cast<const SMDS_MeshNode*>( itN->next() );
-      if (mapNewNodes.find( node ) != mapNewNodes.end() )
-        continue; 
-
-      list<const SMDS_MeshNode*>& listNewNodes = mapNewNodes[ node ];
-
-      // make new nodes
-      gp_XYZ aXYZ( node->X(), node->Y(), node->Z() );
-      double coord[3];
-      aXYZ.Coord( coord[0], coord[1], coord[2] );
-      bool isOnAxis = ( aLine.SquareDistance( aXYZ ) <= aSqTol );
-      const SMDS_MeshNode * newNode = node;
-      for ( int i = 0; i < theNbSteps; i++ ) {
-        if ( !isOnAxis ) {
-          aTrsf.Transforms( coord[0], coord[1], coord[2] );
-          newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
+      TNodeOfNodeListMapItr nIt = mapNewNodes.find( node );
+      if ( nIt == mapNewNodes.end() )
+      {
+        nIt = mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first;
+        list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
+
+        // make new nodes
+        gp_XYZ aXYZ( node->X(), node->Y(), node->Z() );
+        double coord[3];
+        aXYZ.Coord( coord[0], coord[1], coord[2] );
+        bool isOnAxis = ( aLine.SquareDistance( aXYZ ) <= aSqTol );
+        const SMDS_MeshNode * newNode = node;
+        for ( int i = 0; i < theNbSteps; i++ ) {
+          if ( !isOnAxis ) {
+            aTrsf.Transforms( coord[0], coord[1], coord[2] );
+            newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
+          }
+          listNewNodes.push_back( newNode );
         }
         }
-        listNewNodes.push_back( newNode );
       }
       }
+      newNodesItVec.push_back( nIt );
     }
     // make new elements
     }
     // make new elements
-    sweepElement( aMesh, elem, mapNewNodes );
+    sweepElement( aMesh, elem, newNodesItVec, newElemsMap[elem] );
   }
   }
+
+  makeWalls( aMesh, mapNewNodes, newElemsMap, mapElemNewNodes, theElems );
+
 }
 //=======================================================================
 //function : ExtrusionSweep
 }
 //=======================================================================
 //function : ExtrusionSweep
@@ -1718,6 +1902,8 @@ void SMESH_MeshEditor::ExtrusionSweep(set<const SMDS_MeshElement*> & theElems,
   SMESHDS_Mesh* aMesh = GetMeshDS();
 
   TNodeOfNodeListMap mapNewNodes;
   SMESHDS_Mesh* aMesh = GetMeshDS();
 
   TNodeOfNodeListMap mapNewNodes;
+  TElemOfVecOfNnlmiMap mapElemNewNodes;
+  TElemOfElemListMap newElemsMap;
 
   // loop on theElems
   set< const SMDS_MeshElement* >::iterator itElem;
 
   // loop on theElems
   set< const SMDS_MeshElement* >::iterator itElem;
@@ -1725,11 +1911,12 @@ void SMESH_MeshEditor::ExtrusionSweep(set<const SMDS_MeshElement*> & theElems,
   {
     // check element type
     const SMDS_MeshElement* elem = (*itElem);
   {
     // check element type
     const SMDS_MeshElement* elem = (*itElem);
-    if ( !elem ||
-        (elem->GetType() != SMDSAbs_Face &&
-         elem->GetType() != SMDSAbs_Edge))
+    if ( !elem )
       continue;
 
       continue;
 
+    vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ];
+    newNodesItVec.reserve( elem->NbNodes() );
+
     // loop on elem nodes
     SMDS_ElemIteratorPtr itN = elem->nodesIterator();
     while ( itN->more() ) {
     // loop on elem nodes
     SMDS_ElemIteratorPtr itN = elem->nodesIterator();
     while ( itN->more() ) {
@@ -1737,25 +1924,349 @@ void SMESH_MeshEditor::ExtrusionSweep(set<const SMDS_MeshElement*> & theElems,
       // check if a node has been already sweeped
       const SMDS_MeshNode* node =
         static_cast<const SMDS_MeshNode*>( itN->next() );
       // check if a node has been already sweeped
       const SMDS_MeshNode* node =
         static_cast<const SMDS_MeshNode*>( itN->next() );
-      if (mapNewNodes.find( node ) != mapNewNodes.end() )
-        continue; 
+      TNodeOfNodeListMap::iterator nIt = mapNewNodes.find( node );
+      if ( nIt == mapNewNodes.end() )
+      {
+        nIt = mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first;
+        list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
 
 
-      list<const SMDS_MeshNode*>& listNewNodes = mapNewNodes[ node ];
+        // make new nodes
+        double coord[] = { node->X(), node->Y(), node->Z() };
+        for ( int i = 0; i < theNbSteps; i++ ) {
+          aTrsf.Transforms( coord[0], coord[1], coord[2] );
+          const SMDS_MeshNode * newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
+          listNewNodes.push_back( newNode );
+        }
+      }
+      newNodesItVec.push_back( nIt );
+    }
+    // make new elements
+    sweepElement( aMesh, elem, newNodesItVec, newElemsMap[elem] );
+  }
 
 
-      // make new nodes
-      double coord[3];
-      coord[0] = node->X();
-      coord[1] = node->Y();
-      coord[2] = node->Z();
-      for ( int i = 0; i < theNbSteps; i++ ) {
-        aTrsf.Transforms( coord[0], coord[1], coord[2] );
-        const SMDS_MeshNode * newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
-        listNewNodes.push_back( newNode );
+  makeWalls( aMesh, mapNewNodes, newElemsMap, mapElemNewNodes, theElems );
+
+}
+
+class SMESH_MeshEditor_PathPoint {
+public:
+  SMESH_MeshEditor_PathPoint() {
+    myPnt.SetCoord(99., 99., 99.);
+    myTgt.SetCoord(1.,0.,0.);
+    myAngle=0.;
+    myPrm=0.;
+  }
+  void SetPnt(const gp_Pnt& aP3D){
+    myPnt=aP3D;
+  }
+  void SetTangent(const gp_Dir& aTgt){
+    myTgt=aTgt;
+  }
+  void SetAngle(const double& aBeta){
+    myAngle=aBeta;
+  }
+  void SetParameter(const double& aPrm){
+    myPrm=aPrm;
+  }
+  const gp_Pnt& Pnt()const{
+    return myPnt;
+  }
+  const gp_Dir& Tangent()const{
+    return myTgt;
+  }
+  double Angle()const{
+    return myAngle;
+  }
+  double Parameter()const{
+    return myPrm;
+  }
+
+protected:
+  gp_Pnt myPnt;
+  gp_Dir myTgt;
+  double myAngle;
+  double myPrm;
+};
+
+//=======================================================================
+//function : ExtrusionAlongTrack
+//purpose  : 
+//=======================================================================
+int SMESH_MeshEditor::ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & theElements,
+                                          SMESH_subMesh* theTrack,
+                                          const SMDS_MeshNode* theN1,
+                                          const bool theHasAngles,
+                                          std::list<double>& theAngles,
+                                          const bool theHasRefPoint,
+                                          const gp_Pnt& theRefPoint)
+{
+  MESSAGE("SMESH_MeshEditor::ExtrusionAlongTrack")
+  int j, iErr, aNbTP, aNbAngles, aNbE, aNb;
+  double aT1, aT2, aT, aAngle, aX, aY, aZ;
+  std::list<double> aPrms;
+  std::list<double>::iterator aItD;
+  std::set< const SMDS_MeshElement* >::iterator itElem;
+
+  Standard_Real aTx1, aTx2, aL2, aTolVec, aTolVec2;
+  gp_Pnt aP3D, aV0;
+  gp_Vec aVec;
+  gp_XYZ aGC;
+  Handle(Geom_Curve) aC3D;
+  TopoDS_Edge aTrackEdge;
+  TopoDS_Vertex aV1, aV2;
+
+  SMDS_ElemIteratorPtr aItE;
+  SMDS_NodeIteratorPtr aItN;
+  SMDSAbs_ElementType aTypeE;
+
+  TNodeOfNodeListMap mapNewNodes;
+  TElemOfVecOfNnlmiMap mapElemNewNodes;
+  TElemOfElemListMap newElemsMap;
+
+  aTolVec=1.e-7;
+  aTolVec2=aTolVec*aTolVec;
+  iErr=0;
+
+  // 1. Check data
+  aNbE=theElements.size();
+  if ( !aNbE ) {
+    iErr = 10; // nothing to do
+    return iErr;
+  }
+
+  // 1.1 Track Pattern
+  ASSERT( theTrack );
+
+  SMESHDS_SubMesh* pSubMeshDS=theTrack->GetSubMeshDS();
+
+  if ( !pSubMeshDS->Contains( theN1 ) ) {
+    iErr = 2; // No match found for start node
+    return iErr;
+  }
+
+  aItE = pSubMeshDS->GetElements();
+  while ( aItE->more() ) {
+    const SMDS_MeshElement* pE = aItE->next();
+    aTypeE = pE->GetType();
+    if ( aTypeE != SMDSAbs_Edge ) {
+      iErr = 3; // Pattern must contain links only
+      return iErr;
+    }
+  }
+
+  const TopoDS_Shape& aS = theTrack->GetSubShape();
+  if ( aS.ShapeType() != TopAbs_EDGE) {
+    iErr = 3; // Sub shape for the Pattern must be an Edge
+    return iErr;
+    aTrackEdge = TopoDS::Edge( aS );
+    if ( BRep_Tool::Degenerated( aTrackEdge ) ) {
+      iErr = 4; // the Edge must not be degenerated
+      return iErr;
+    }
+  }
+
+  TopExp::Vertices( aTrackEdge, aV1, aV2 );
+  aT1=BRep_Tool::Parameter( aV1, aTrackEdge );
+  aT2=BRep_Tool::Parameter( aV2, aTrackEdge );
+
+  aItN = myMesh->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes();
+  const SMDS_MeshNode* aN1 = aItN->next();
+
+  aItN = myMesh->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes();
+  const SMDS_MeshNode* aN2 = aItN->next();
+
+  if ( !( aN1 == theN1 || aN2 == theN1 ) ) {
+    iErr = 5; // starting node must be aN1 or aN2 
+    return iErr;
+  }
+
+  aNbTP = pSubMeshDS->NbNodes() + 2;
+
+  // 1.2. Angles
+  vector<double> aAngles( aNbTP );
+
+  if ( theHasAngles ) {
+    aNbAngles = theAngles.size();
+    if ( aNbTP != aNbAngles ) {
+      iErr = 6; // number of Angles does not match to the number of track points
+      return iErr;
+    }
+    aItD = theAngles.begin();
+    for ( j=0; aItD != aPrms.end(); ++aItD, ++j ) {
+      aAngle = *aItD;
+      aAngles[j] = aAngle;
+    }
+  }
+  else {
+    for ( j=0; j < aNbTP; ++j ) {
+      aAngles[j] = 0.;
+    }
+  }
+
+  // 2. Collect parameters on the track edge  
+  aPrms.push_back( aT1 );
+  aPrms.push_back( aT2 );
+
+  aItN = pSubMeshDS->GetNodes();
+  while ( aItN->more() ) {
+    const SMDS_MeshNode* pNode = aItN->next();
+    const SMDS_EdgePosition* pEPos =
+      static_cast<const SMDS_EdgePosition*>( pNode->GetPosition().get() );
+    aT = pEPos->GetUParameter();
+    aPrms.push_back( aT );
+  }
+
+  // sort parameters
+  aPrms.sort();
+  if ( aN1 == theN1 ) {
+    if ( aT1 > aT2 ) {
+      aPrms.reverse();
+    }
+  }
+  else {
+    if ( aT2 > aT1 ) {
+      aPrms.reverse();
+    }
+  }
+
+  // 3. Path Points
+  SMESH_MeshEditor_PathPoint aPP;
+  vector<SMESH_MeshEditor_PathPoint> aPPs( aNbTP );
+  //
+  aC3D = BRep_Tool::Curve( aTrackEdge, aTx1, aTx2 );
+  //
+  aItD = aPrms.begin();
+  for ( j=0; aItD != aPrms.end(); ++aItD, ++j ) {
+    aT = *aItD;
+    aC3D->D1( aT, aP3D, aVec );
+    aL2 = aVec.SquareMagnitude();
+    if ( aL2 < aTolVec2 ) {
+      iErr = 20; // can not obtain the tangent;
+      return iErr;
+    }
+    gp_Dir aTgt( aVec );
+    aAngle = aAngles[j];
+
+    aPP.SetPnt( aP3D );
+    aPP.SetTangent( aTgt );
+    aPP.SetAngle( aAngle );
+    aPP.SetParameter( aT );
+    aPPs[j]=aPP;
+  }
+
+  // 3. Center of rotation aV0
+  aV0 = theRefPoint;
+  if ( !theHasRefPoint ) {
+    aNb = 0;
+    aGC.SetCoord( 0.,0.,0. );
+
+    itElem = theElements.begin();
+    for ( ; itElem != theElements.end(); itElem++ ) {
+      const SMDS_MeshElement* elem = (*itElem);
+
+      SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+      while ( itN->more() ) {
+       const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( itN->next() );
+       aX = node->X();
+       aY = node->Y();
+       aZ = node->Z();
+
+       if ( mapNewNodes.find( node ) == mapNewNodes.end() ) {
+         list<const SMDS_MeshNode*> aLNx;
+         mapNewNodes[node] = aLNx;
+         //
+         gp_XYZ aXYZ( aX, aY, aZ );
+         aGC += aXYZ;
+         ++aNb;
+       }
       }
     }
       }
     }
+    aGC /= aNb;
+    aV0.SetXYZ( aGC );
+  } // if (!theHasRefPoint) {
+  mapNewNodes.clear();
+
+  // 4. Processing the elements
+  SMESHDS_Mesh* aMesh = GetMeshDS();
+
+  for ( itElem = theElements.begin(); itElem != theElements.end(); itElem++ ) {
+    // check element type
+    const SMDS_MeshElement* elem = (*itElem);
+    aTypeE = elem->GetType();
+    if ( !elem || ( aTypeE != SMDSAbs_Face && aTypeE != SMDSAbs_Edge ) )
+      continue;
+
+    vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ];
+    newNodesItVec.reserve( elem->NbNodes() );
+
+    // loop on elem nodes
+    SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+    while ( itN->more() ) {
+
+      // check if a node has been already processed
+      const SMDS_MeshNode* node = 
+       static_cast<const SMDS_MeshNode*>( itN->next() );
+      TNodeOfNodeListMap::iterator nIt = mapNewNodes.find( node );
+      if ( nIt == mapNewNodes.end() ) {
+        nIt = mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first;
+        list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
+       
+       // make new nodes
+       aX = node->X();  aY = node->Y(); aZ = node->Z();
+       
+       Standard_Real aAngle1x;
+       gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x;
+       gp_Ax1 anAx1;
+
+       aV0x = aV0;
+       aPN0.SetCoord(aX, aY, aZ);
+
+       const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0];
+       aP0x = aPP0.Pnt();
+
+       for ( j = 1; j < aNbTP; ++j ) {
+         const SMESH_MeshEditor_PathPoint& aPP1 = aPPs[j];
+         aP1x = aPP1.Pnt();
+         const gp_Dir& aDT1x = aPP1.Tangent();
+         aAngle1x = aPP1.Angle();
+         
+         gp_Trsf aTrsf, aTrsfRot; 
+         // Translation
+         gp_Vec aV01x( aP0x, aP1x );
+         aTrsf.SetTranslation( aV01x );
+         
+         // traslated point
+         aV1x = aV0x.Transformed( aTrsf );
+         aPN1 = aPN0.Transformed( aTrsf );
+         
+         if ( theHasAngles ) {
+           anAx1.SetLocation( aV1x );
+           anAx1.SetDirection( aDT1x );
+           aTrsfRot.SetRotation( anAx1, aAngle1x );
+           
+           aPN1 = aPN1.Transformed( aTrsfRot );
+         }
+
+         // make new node
+         aX = aPN1.X();
+         aY = aPN1.X();
+         aZ = aPN1.X();
+         const SMDS_MeshNode* newNode = aMesh->AddNode( aX, aY, aZ );
+         listNewNodes.push_back( newNode );
+         
+         aPN0 = aPN1;
+         aP0x = aP1x;
+         aV0x = aV1x;
+       }
+      }
+      newNodesItVec.push_back( nIt );
+    }
     // make new elements
     // make new elements
-    sweepElement( aMesh, elem, mapNewNodes );
+    sweepElement( aMesh, elem, newNodesItVec, newElemsMap[elem] );
   }
   }
+  
+  makeWalls( aMesh, mapNewNodes, newElemsMap, mapElemNewNodes, theElements );
+  return iErr;
 }
 
 //=======================================================================
 }
 
 //=======================================================================
@@ -1928,17 +2439,26 @@ void SMESH_MeshEditor::Transform (set<const SMDS_MeshElement*> & theElems,
 //=======================================================================
 //function : FindCoincidentNodes
 //purpose  : Return list of group of nodes close to each other within theTolerance
 //=======================================================================
 //function : FindCoincidentNodes
 //purpose  : Return list of group of nodes close to each other within theTolerance
+//           Search among theNodes or in the whole mesh if theNodes is empty.
 //=======================================================================
 
 //=======================================================================
 
-void SMESH_MeshEditor::FindCoincidentNodes (const double         theTolerance,
-                                            TListOfListOfNodes & theGroupsOfNodes)
+void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes,
+                                            const double                theTolerance,
+                                            TListOfListOfNodes &        theGroupsOfNodes)
 {
   double tol2 = theTolerance * theTolerance;
 
   list<const SMDS_MeshNode*> nodes;
 {
   double tol2 = theTolerance * theTolerance;
 
   list<const SMDS_MeshNode*> nodes;
-  SMDS_NodeIteratorPtr nIt = GetMeshDS()->nodesIterator();
-  while ( nIt->more() )
-    nodes.push_back( nIt->next() );
+  if ( theNodes.empty() )
+  { // get all nodes in the mesh
+    SMDS_NodeIteratorPtr nIt = GetMeshDS()->nodesIterator();
+    while ( nIt->more() )
+      nodes.push_back( nIt->next() );
+  }
+  else
+  {
+    nodes.insert( nodes.end(), theNodes.begin(), theNodes.end() );
+  }  
 
   list<const SMDS_MeshNode*>::iterator it2, it1 = nodes.begin();
   for ( ; it1 != nodes.end(); it1++ )
 
   list<const SMDS_MeshNode*>::iterator it2, it1 = nodes.begin();
   for ( ; it1 != nodes.end(); it1++ )
@@ -1995,7 +2515,7 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
       nodeNodeMap.insert( TNodeNodeMap::value_type( nToRemove, nToKeep ));
       if ( nToRemove != nToKeep ) {
         rmNodeIds.push_back( nToRemove->GetID() );
       nodeNodeMap.insert( TNodeNodeMap::value_type( nToRemove, nToKeep ));
       if ( nToRemove != nToKeep ) {
         rmNodeIds.push_back( nToRemove->GetID() );
-        addToSameGroups( nToKeep, nToRemove, aMesh );
+        AddToSameGroups( nToKeep, nToRemove, aMesh );
       }
 
       SMDS_ElemIteratorPtr invElemIt = nToRemove->GetInverseElementIterator();
       }
 
       SMDS_ElemIteratorPtr invElemIt = nToRemove->GetInverseElementIterator();
@@ -2343,41 +2863,63 @@ void SMESH_MeshEditor::MergeEqualElements()
   Remove( rmElemIds, false );
 }
 
   Remove( rmElemIds, false );
 }
 
+//=======================================================================
+//function : FindFaceInSet
+//purpose  : Return a face having linked nodes n1 and n2 and which is
+//           - not in avoidSet,
+//           - in elemSet provided that !elemSet.empty()
+//=======================================================================
+
+const SMDS_MeshElement*
+  SMESH_MeshEditor::FindFaceInSet(const SMDS_MeshNode*                n1,
+                                  const SMDS_MeshNode*                n2,
+                                  const set<const SMDS_MeshElement*>& elemSet,
+                                  const set<const SMDS_MeshElement*>& avoidSet)
+
+{
+  SMDS_ElemIteratorPtr invElemIt = n1->GetInverseElementIterator();
+  while ( invElemIt->more() ) { // loop on inverse elements of n1
+    const SMDS_MeshElement* elem = invElemIt->next();
+    if (elem->GetType() != SMDSAbs_Face ||
+        avoidSet.find( elem ) != avoidSet.end() )
+      continue;
+    if ( !elemSet.empty() && elemSet.find( elem ) == elemSet.end())
+      continue;
+    // get face nodes and find index of n1
+    int i1, nbN = elem->NbNodes(), iNode = 0;
+    const SMDS_MeshNode* faceNodes[ nbN ], *n;
+    SMDS_ElemIteratorPtr nIt = elem->nodesIterator();
+    while ( nIt->more() ) {
+      faceNodes[ iNode ] = static_cast<const SMDS_MeshNode*>( nIt->next() );
+      if ( faceNodes[ iNode++ ] == n1 )
+        i1 = iNode - 1;
+    }
+    // find a n2 linked to n1
+    for ( iNode = 0; iNode < 2; iNode++ ) {
+      if ( iNode ) // node before n1
+        n = faceNodes[ i1 == 0 ? nbN - 1 : i1 - 1 ];
+      else         // node after n1
+        n = faceNodes[ i1 + 1 == nbN ? 0 : i1 + 1 ];
+      if ( n == n2 )
+        return elem;
+    }
+  }
+  return 0;
+}
+
 //=======================================================================
 //function : findAdjacentFace
 //purpose  : 
 //=======================================================================
 //=======================================================================
 //function : findAdjacentFace
 //purpose  : 
 //=======================================================================
-#define CHECKIND(max,val) {if ( (val) >= (max) ) \
 
 static const SMDS_MeshElement* findAdjacentFace(const SMDS_MeshNode* n1,
                                                 const SMDS_MeshNode* n2,
                                                 const SMDS_MeshElement* elem)
 {
 
 static const SMDS_MeshElement* findAdjacentFace(const SMDS_MeshNode* n1,
                                                 const SMDS_MeshNode* n2,
                                                 const SMDS_MeshElement* elem)
 {
-  SMDS_ElemIteratorPtr invElemIt = n1->facesIterator();
-  while ( invElemIt->more() ) { // loop on inverse elements of n1
-    const SMDS_MeshElement* adjElem = invElemIt->next();
-    if ( elem != adjElem ) {
-      // get face nodes and find index of n1
-      int i1, nbN = adjElem->NbNodes(), iNode = 0;
-      const SMDS_MeshNode* faceNodes[ nbN ], *n;
-      SMDS_ElemIteratorPtr nIt = adjElem->nodesIterator();
-      while ( nIt->more() ) {
-        faceNodes[ iNode ] = static_cast<const SMDS_MeshNode*>( nIt->next() );
-        if ( faceNodes[ iNode++ ] == n1 )
-          i1 = iNode - 1;
-      }
-      // find a n2 linked to n1
-      for ( iNode = 0; iNode < 2; iNode++ ) {
-        if ( iNode ) // node before n1
-          n = faceNodes[ i1 == 0 ? nbN - 1 : i1 - 1 ];
-        else         // node after n1
-          n = faceNodes[ i1 + 1 == nbN ? 0 : i1 + 1 ];
-        if ( n == n2 )
-          return adjElem;
-      }
-    }
-  }
-  return 0;
+  set<const SMDS_MeshElement*> elemSet, avoidSet;
+  if ( elem )
+    avoidSet.insert ( elem );
+  SMESH_MeshEditor::FindFaceInSet( n1, n2, elemSet, avoidSet );
 }
   
 //=======================================================================
 }
   
 //=======================================================================
index 10b7f9fa991d41545f33e110743bd99b4744520b..3dc5173f695103f3191ffe410ebc7bab9e8692b9 100644 (file)
@@ -41,6 +41,7 @@ class SMDS_MeshFace;
 class SMDS_MeshNode;
 class gp_Ax1;
 class gp_Vec;
 class SMDS_MeshNode;
 class gp_Ax1;
 class gp_Vec;
+class gp_Pnt;
 
 class SMESH_MeshEditor {
  public:
 
 class SMESH_MeshEditor {
  public:
@@ -121,18 +122,28 @@ class SMESH_MeshEditor {
   // Generate new elements by extrusion of theElements 
   // by theStep by theNbSteps
 
   // Generate new elements by extrusion of theElements 
   // by theStep by theNbSteps
 
+  int ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & theElements,
+                          SMESH_subMesh*                      theTrackPattern,
+                          const SMDS_MeshNode*                theNodeStart,
+                          const bool                          theHasAngles,
+                          std::list<double>&                  theAngles,
+                          const bool                          theHasRefPoint,
+                          const gp_Pnt&                       theRefPoint);
+  // Generate new elements by extrusion of theElements along path given by theTrackPattern,
+  // theHasAngles are the rotation angles, base point can be given by theRefPoint
 
   void Transform (std::set<const SMDS_MeshElement*> & theElements,
                   const gp_Trsf&                      theTrsf,
                   const bool                          theCopy);
   // Move or copy theElements applying theTrsf to their nodes
 
 
   void Transform (std::set<const SMDS_MeshElement*> & theElements,
                   const gp_Trsf&                      theTrsf,
                   const bool                          theCopy);
   // Move or copy theElements applying theTrsf to their nodes
 
-
   typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
 
   typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
 
-  void FindCoincidentNodes (const double         theTolerance,
-                            TListOfListOfNodes & theGroupsOfNodes);
-  // Return list of group of nodes close to each other within theTolerance
+  void FindCoincidentNodes (std::set<const SMDS_MeshNode*> & theNodes,
+                            const double                     theTolerance,
+                            TListOfListOfNodes &             theGroupsOfNodes);
+  // Return list of group of nodes close to each other within theTolerance.
+  // Search among theNodes or in the whole mesh if theNodes is empty.
 
   void MergeNodes (TListOfListOfNodes & theNodeGroups);
   // In each group, the cdr of nodes are substituted by the first one
 
   void MergeNodes (TListOfListOfNodes & theNodeGroups);
   // In each group, the cdr of nodes are substituted by the first one
@@ -220,7 +231,20 @@ class SMESH_MeshEditor {
                              int               theNodeIds[] );
   // Set 8 nodes of a hexahedron in a good order.
   // Return success status
                              int               theNodeIds[] );
   // Set 8 nodes of a hexahedron in a good order.
   // Return success status
-  
+
+  static void AddToSameGroups (const SMDS_MeshElement* elemToAdd,
+                               const SMDS_MeshElement* elemInGroups,
+                               SMESHDS_Mesh *          aMesh);
+  // Add elemToAdd to the groups the elemInGroups belongs to
+
+  static const SMDS_MeshElement*
+    FindFaceInSet(const SMDS_MeshNode*                     n1,
+                  const SMDS_MeshNode*                     n2,
+                  const std::set<const SMDS_MeshElement*>& elemSet,
+                  const std::set<const SMDS_MeshElement*>& avoidSet);
+  // Return a face having linked nodes n1 and n2 and which is
+  // - not in avoidSet,
+  // - in elemSet provided that !elemSet.empty()
 
   int FindShape (const SMDS_MeshElement * theElem);
   // Return an index of the shape theElem is on
 
   int FindShape (const SMDS_MeshElement * theElem);
   // Return an index of the shape theElem is on
index 06595678e81a14811531a9e80b0877ad59138b10..86f1d52ab1688686683fce61988d215bd7a9e1f8 100644 (file)
 
 #include "SMESH_Pattern.hxx"
 
 
 #include "SMESH_Pattern.hxx"
 
-#include <Bnd_Box2d.hxx>
 #include <BRepTools.hxx>
 #include <BRepTools_WireExplorer.hxx>
 #include <BRep_Tool.hxx>
 #include <BRepTools.hxx>
 #include <BRepTools_WireExplorer.hxx>
 #include <BRep_Tool.hxx>
+#include <Bnd_Box.hxx>
+#include <Bnd_Box2d.hxx>
+#include <ElSLib.hxx>
+#include <Extrema_GenExtPS.hxx>
+#include <Extrema_POnSurf.hxx>
 #include <Geom2d_Curve.hxx>
 #include <Geom2d_Curve.hxx>
+#include <GeomAdaptor_Surface.hxx>
 #include <Geom_Curve.hxx>
 #include <Geom_Surface.hxx>
 #include <IntAna2d_AnaIntersection.hxx>
 #include <Geom_Curve.hxx>
 #include <Geom_Surface.hxx>
 #include <IntAna2d_AnaIntersection.hxx>
 #include <TopoDS_Shell.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Wire.hxx>
 #include <TopoDS_Shell.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Wire.hxx>
+#include <gp_Ax2.hxx>
 #include <gp_Lin2d.hxx>
 #include <gp_Pnt2d.hxx>
 #include <gp_Trsf.hxx>
 #include <gp_XY.hxx>
 #include <gp_XYZ.hxx>
 #include <gp_Lin2d.hxx>
 #include <gp_Pnt2d.hxx>
 #include <gp_Trsf.hxx>
 #include <gp_XY.hxx>
 #include <gp_XYZ.hxx>
-#include <Extrema_GenExtPS.hxx>
-#include <Extrema_POnSurf.hxx>
-#include <GeomAdaptor_Surface.hxx>
 
 #include "SMDS_EdgePosition.hxx"
 #include "SMDS_FacePosition.hxx"
 #include "SMDS_MeshElement.hxx"
 
 #include "SMDS_EdgePosition.hxx"
 #include "SMDS_FacePosition.hxx"
 #include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshFace.hxx"
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_MeshNode.hxx"
+#include "SMESHDS_Group.hxx"
 #include "SMESHDS_Mesh.hxx"
 #include "SMESHDS_SubMesh.hxx"
 #include "SMESHDS_Mesh.hxx"
 #include "SMESHDS_SubMesh.hxx"
-#include "SMESH_Mesh.hxx"
 #include "SMESH_Block.hxx"
 #include "SMESH_Block.hxx"
+#include "SMESH_Mesh.hxx"
+#include "SMESH_MeshEditor.hxx"
 #include "SMESH_subMesh.hxx"
 
 #include "utilities.h"
 #include "SMESH_subMesh.hxx"
 
 #include "utilities.h"
@@ -401,9 +407,6 @@ template<typename T> struct TSizeCmp {
 template<typename T> void sortBySize( list< list < T > > & theListOfList )
 {
   if ( theListOfList.size() > 2 ) {
 template<typename T> void sortBySize( list< list < T > > & theListOfList )
 {
   if ( theListOfList.size() > 2 ) {
-    // keep the car
-    //list < T > & aFront = theListOfList.front();
-    // sort the whole list
     TSizeCmp< T > SizeCmp;
     theListOfList.sort( SizeCmp );
   }
     TSizeCmp< T > SizeCmp;
     theListOfList.sort( SizeCmp );
   }
@@ -599,7 +602,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh*        theMesh,
         if ( nIdIt == nodePointIDMap.end() )
         {
           elemPoints.push_back( iPoint );
         if ( nIdIt == nodePointIDMap.end() )
         {
           elemPoints.push_back( iPoint );
-          nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint++ ));
+          nodePointIDMap.insert( make_pair( node, iPoint++ ));
         }
         else
           elemPoints.push_back( (*nIdIt).second );
         }
         else
           elemPoints.push_back( (*nIdIt).second );
@@ -684,7 +687,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh*        theMesh,
           myKeyPointIDs.push_back( iPoint );
           SMDS_NodeIteratorPtr nIt = vSubMesh->GetNodes();
           const SMDS_MeshNode* node = nIt->next();
           myKeyPointIDs.push_back( iPoint );
           SMDS_NodeIteratorPtr nIt = vSubMesh->GetNodes();
           const SMDS_MeshNode* node = nIt->next();
-          nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint ));
+          nodePointIDMap.insert( make_pair( node, iPoint ));
 
           TPoint* keyPoint = &myPoints[ iPoint++ ];
           vPoint.push_back( keyPoint );
 
           TPoint* keyPoint = &myPoints[ iPoint++ ];
           vPoint.push_back( keyPoint );
@@ -724,7 +727,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh*        theMesh,
           TPoint* p = & myPoints[ iPoint ];
           ePoints.push_back( p );
           const SMDS_MeshNode* node = isForward ? (*unIt).second : (*unRIt).second;
           TPoint* p = & myPoints[ iPoint ];
           ePoints.push_back( p );
           const SMDS_MeshNode* node = isForward ? (*unIt).second : (*unRIt).second;
-          nodePointIDMap.insert ( TNodePointIDMap::value_type( node, iPoint ));
+          nodePointIDMap.insert ( make_pair( node, iPoint ));
 
           if ( theProject )
             p->myInitUV = project( node, projector );
 
           if ( theProject )
             p->myInitUV = project( node, projector );
@@ -748,7 +751,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh*        theMesh,
           myKeyPointIDs.push_back( iPoint );
           SMDS_NodeIteratorPtr nIt = vSubMesh->GetNodes();
           const SMDS_MeshNode* node = nIt->next();
           myKeyPointIDs.push_back( iPoint );
           SMDS_NodeIteratorPtr nIt = vSubMesh->GetNodes();
           const SMDS_MeshNode* node = nIt->next();
-          nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint ));
+          nodePointIDMap.insert( make_pair( node, iPoint ));
 
           TPoint* keyPoint = &myPoints[ iPoint++ ];
           vPoint2.push_back( keyPoint );
 
           TPoint* keyPoint = &myPoints[ iPoint++ ];
           vPoint2.push_back( keyPoint );
@@ -793,7 +796,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh*        theMesh,
       {
         const SMDS_MeshNode* node = 
           static_cast<const SMDS_MeshNode*>( nIt->next() );
       {
         const SMDS_MeshNode* node = 
           static_cast<const SMDS_MeshNode*>( nIt->next() );
-        nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint ));
+        nodePointIDMap.insert( make_pair( node, iPoint ));
         TPoint* p = &myPoints[ iPoint++ ];
         fPoints.push_back( p );
         if ( theProject )
         TPoint* p = &myPoints[ iPoint++ ];
         fPoints.push_back( p );
         if ( theProject )
@@ -2244,7 +2247,6 @@ bool SMESH_Pattern::Apply (const TopoDS_Face&   theFace,
   }
   int nbVertices = myShapeIDMap.Extent();
 
   }
   int nbVertices = myShapeIDMap.Extent();
 
-  //int nbSeamShapes = 0; // count twice seam edge and its vertices 
   for ( elIt = eList.begin(); elIt != eList.end(); elIt++ )
     myShapeIDMap.Add( *elIt );
 
   for ( elIt = eList.begin(); elIt != eList.end(); elIt++ )
     myShapeIDMap.Add( *elIt );
 
@@ -2441,6 +2443,461 @@ bool SMESH_Pattern::Apply (const TopoDS_Face&   theFace,
   return setErrorCode( ERR_OK );
 }
 
   return setErrorCode( ERR_OK );
 }
 
+//=======================================================================
+//function : Apply
+//purpose  : Compute nodes coordinates applying
+//           the loaded pattern to <theFace>. The first key-point
+//           will be mapped into <theNodeIndexOnKeyPoint1>-th node
+//=======================================================================
+
+bool SMESH_Pattern::Apply (const SMDS_MeshFace* theFace,
+                           const int            theNodeIndexOnKeyPoint1,
+                           const bool           theReverse)
+{
+  MESSAGE(" ::Apply(MeshFace) " );
+
+  if ( !IsLoaded() ) {
+    MESSAGE( "Pattern not loaded" );
+    return setErrorCode( ERR_APPL_NOT_LOADED );
+  }
+
+  // check nb of nodes
+  if (theFace->NbNodes() != myNbKeyPntInBoundary.front() ) {
+    MESSAGE( myKeyPointIDs.size() << " != " << theFace->NbNodes() );
+    return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
+  }
+
+  // find points on edges, it fills myNbKeyPntInBoundary
+  if ( !findBoundaryPoints() )
+    return false;
+
+  // check that there are no holes in a pattern
+  if (myNbKeyPntInBoundary.size() > 1 ) {
+    return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
+  }
+
+  // Define the nodes order
+
+  list< const SMDS_MeshNode* > nodes;
+  list< const SMDS_MeshNode* >::iterator n = nodes.end();
+  SMDS_ElemIteratorPtr noIt = theFace->nodesIterator();
+  int iSub = 0;
+  while ( noIt->more() ) {
+    const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( noIt->next() );
+    nodes.push_back( node );
+    if ( iSub++ == theNodeIndexOnKeyPoint1 )
+      n = --nodes.end();
+  }
+  if ( n != nodes.end() ) {
+    if ( theReverse ) {
+      if ( n != --nodes.end() )
+        nodes.splice( nodes.begin(), nodes, ++n, nodes.end() );
+      nodes.reverse();
+    }
+    else if ( n != nodes.begin() )
+      nodes.splice( nodes.end(), nodes, nodes.begin(), n );
+  }
+  list< gp_XYZ > xyzList;
+  myOrderedNodes.resize( theFace->NbNodes() );
+  for ( iSub = 0, n = nodes.begin(); n != nodes.end(); ++n ) {
+    xyzList.push_back( gp_XYZ( (*n)->X(), (*n)->Y(), (*n)->Z() ));
+    myOrderedNodes[ iSub++] = *n;
+  }
+
+  // Define a face plane
+
+  list< gp_XYZ >::iterator xyzIt = xyzList.begin();
+  gp_Pnt P ( *xyzIt++ );
+  gp_Vec Vx( P, *xyzIt++ ), N;
+  do {
+    N = Vx ^ gp_Vec( P, *xyzIt++ );
+  } while ( N.SquareMagnitude() <= DBL_MIN && xyzIt != xyzList.end() );
+  if ( N.SquareMagnitude() <= DBL_MIN )
+    return setErrorCode( ERR_APPLF_BAD_FACE_GEOM );
+  gp_Ax2 pos( P, N, Vx );
+
+  // Compute UV of key-points on a plane
+  for ( xyzIt = xyzList.begin(), iSub = 1; xyzIt != xyzList.end(); xyzIt++, iSub++ )
+  {
+    gp_Vec vec ( pos.Location(), *xyzIt );
+    TPoint* p = getShapePoints( iSub ).front();
+    p->myUV.SetX( vec * pos.XDirection() );
+    p->myUV.SetY( vec * pos.YDirection() );
+    p->myXYZ = *xyzIt;
+  }
+
+  // points on edges to be used for UV computation of in-face points
+  list< list< TPoint* > > edgesPointsList;
+  edgesPointsList.push_back( list< TPoint* >() );
+  list< TPoint* > * edgesPoints = & edgesPointsList.back();
+  list< TPoint* >::iterator pIt;
+
+  // compute UV and XYZ of points on edges
+
+  for ( xyzIt = xyzList.begin(); xyzIt != xyzList.end(); iSub++ )
+  {
+    gp_XYZ& xyz1 = *xyzIt++;
+    gp_XYZ& xyz2 = ( xyzIt != xyzList.end() ) ? *xyzIt : xyzList.front();
+    
+    list< TPoint* > & ePoints = getShapePoints( iSub );
+    ePoints.back()->myInitU = 1.0;
+    list< TPoint* >::const_iterator pIt = ++ePoints.begin();
+    while ( *pIt != ePoints.back() )
+    {
+      TPoint* p = *pIt++;
+      p->myXYZ = xyz1 * ( 1 - p->myInitU ) + xyz2 * p->myInitU;
+      gp_Vec vec ( pos.Location(), p->myXYZ );
+      p->myUV.SetX( vec * pos.XDirection() );
+      p->myUV.SetY( vec * pos.YDirection() );
+    }
+    // collect on-edge points (excluding the last one)
+    edgesPoints->insert( edgesPoints->end(), ePoints.begin(), --ePoints.end());
+  }
+
+  // Compute UV and XYZ of in-face points
+
+  // try to use a simple algo to compute UV
+  list< TPoint* > & fPoints = getShapePoints( iSub );
+  bool isDeformed = false;
+  for ( pIt = fPoints.begin(); !isDeformed && pIt != fPoints.end(); pIt++ )
+    if ( !compUVByIsoIntersection( edgesPointsList, (*pIt)->myInitUV,
+                                  (*pIt)->myUV, isDeformed )) {
+      MESSAGE("cant Apply(face)");
+      return false;
+    }
+  // try to use a complex algo if it is a difficult case
+  if ( isDeformed && !compUVByElasticIsolines( edgesPointsList, fPoints ))
+  {
+    for ( ; pIt != fPoints.end(); pIt++ ) // continue with the simple algo
+      if ( !compUVByIsoIntersection( edgesPointsList, (*pIt)->myInitUV,
+                                    (*pIt)->myUV, isDeformed )) {
+        MESSAGE("cant Apply(face)");
+        return false;
+      }
+  }
+
+  for ( pIt = fPoints.begin(); pIt != fPoints.end(); pIt++ )
+  {
+    (*pIt)->myXYZ = ElSLib::PlaneValue( (*pIt)->myUV.X(), (*pIt)->myUV.Y(), pos );
+  }
+
+  myIsComputed = true;
+
+  return setErrorCode( ERR_OK );
+}
+
+//=======================================================================
+//function : undefinedXYZ
+//purpose  : 
+//=======================================================================
+
+static const gp_XYZ& undefinedXYZ()
+{
+  static gp_XYZ xyz( 1.e100, 0., 0. );
+  return xyz;
+}
+
+//=======================================================================
+//function : isDefined
+//purpose  : 
+//=======================================================================
+
+inline static bool isDefined(const gp_XYZ& theXYZ)
+{
+  return theXYZ.X() < 1.e100;
+}
+
+//=======================================================================
+//function : mergePoints
+//purpose  : Look for coincident points between myXYZs indexed with
+//           list<int> of each element of xyzIndGroups. Coincident indices
+//           are merged in myElemXYZIDs.
+//=======================================================================
+
+void SMESH_Pattern::mergePoints (map<TNodeSet, list<list<int> > >&  indGroups,
+                                 map< int, list< list< int >* > > & reverseConnectivity)
+{
+  map< TNodeSet, list< list< int > > >::iterator indListIt;
+  for ( indListIt = indGroups.begin(); indListIt != indGroups.end(); indListIt++ )
+  {
+    list<list< int > > groups = indListIt->second;
+    if ( groups.size() < 2 )
+      continue;
+
+//     const TNodeSet & nodes = indListIt->first;
+//     TNodeSet::const_iterator n = nodes.begin();
+//     for ( ; n != nodes.end(); n++ )
+//       cout << *n ;
+
+    // find tolerance
+    Bnd_Box box;
+    list< int >& indices = groups.front();
+    list< int >::iterator ind, ind1, ind2;
+    for ( ind = indices.begin(); ind != indices.end(); ind++ )
+      box.Add( gp_Pnt( myXYZ[ *ind ]));
+    double x, y, z, X, Y, Z;
+    box.Get( x, y, z, X, Y, Z );
+    gp_Pnt p( x, y, z ), P( X, Y, Z );
+    double tol2 = 1.e-4 * p.SquareDistance( P );
+
+    // compare points, replace indices
+
+    list< list< int > >::iterator grpIt1, grpIt2;
+    for ( grpIt1 = groups.begin(); grpIt1 != groups.end(); grpIt1++ )
+    {
+      list< int >& indices1 = *grpIt1;
+      grpIt2 = grpIt1;
+      for ( grpIt2++; grpIt2 != groups.end(); grpIt2++ )
+      {
+        list< int >& indices2 = *grpIt2;
+        for ( ind1 = indices1.begin(); ind1 != indices1.end(); ind1++ )
+        {
+          gp_XYZ& p1 = myXYZ[ *ind1 ];
+          ind2 = indices2.begin();
+          while ( ind2 != indices2.end() )
+          {
+            gp_XYZ& p2 = myXYZ[ *ind2 ];
+            //MESSAGE("COMP: " << *ind1 << " " << *ind2 << " X: " << p2.X() << " tol2: " << tol2);
+            if ( ( p1 - p2 ).SquareModulus() <= tol2 )
+            {
+              ASSERT( reverseConnectivity.find( *ind2 ) != reverseConnectivity.end() );
+              list< list< int >* > & elemXYZIDsList = reverseConnectivity[ *ind2 ];
+              list< list< int >* >::iterator elemXYZIDs = elemXYZIDsList.begin();
+              for ( ; elemXYZIDs != elemXYZIDsList.end(); elemXYZIDs++ )
+              {
+                ind = find( (*elemXYZIDs)->begin(), (*elemXYZIDs)->end(), *ind2 );
+                //MESSAGE( " Replace " << *ind << " with " << *ind1 );
+                myXYZ[ *ind ] = undefinedXYZ();
+                *ind = *ind1;
+              }
+              ind2 = indices2.erase( ind2 );
+            }
+            else
+              ind2++;
+          }
+        }
+      }
+    }
+  }
+}
+
+//=======================================================================
+//function : Apply
+//purpose  : Compute nodes coordinates applying
+//           the loaded pattern to <theFaces>. The first key-point
+//           will be mapped into <theNodeIndexOnKeyPoint1>-th node
+//=======================================================================
+
+bool SMESH_Pattern::Apply (std::set<const SMDS_MeshFace*> theFaces,
+                           const int                      theNodeIndexOnKeyPoint1,
+                           const bool                     theReverse)
+{
+  MESSAGE(" ::Apply(set<MeshFace>) " );
+
+  if ( !IsLoaded() ) {
+    MESSAGE( "Pattern not loaded" );
+    return setErrorCode( ERR_APPL_NOT_LOADED );
+  }
+
+  // find points on edges, it fills myNbKeyPntInBoundary
+  if ( !findBoundaryPoints() )
+    return false;
+
+  // check that there are no holes in a pattern
+  if (myNbKeyPntInBoundary.size() > 1 ) {
+    return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
+  }
+
+  myXYZ.clear();
+  myElemXYZIDs.clear();
+  myXYZIdToNodeMap.clear();
+  myElements.clear();
+
+  myXYZ.resize( myPoints.size() * theFaces.size(), undefinedXYZ() );
+  myElements.reserve( theFaces.size() );
+
+  // to find point index
+  map< TPoint*, int > pointIndex;
+  for ( int i = 0; i < myPoints.size(); i++ )
+    pointIndex.insert( make_pair( & myPoints[ i ], i ));
+
+  // to merge nodes on edges of the elements being refined
+  typedef set<const SMDS_MeshNode*> TLink;
+  map< TLink, list< list< int > > > linkPointIndListMap;
+  map< int, list< list< int >* > >  reverseConnectivity;
+
+  int ind1 = 0; // lowest point index for a face
+
+  // apply to each face in theFaces set
+  set<const SMDS_MeshFace*>::iterator face = theFaces.begin();
+  for ( ; face != theFaces.end(); ++face )
+  {
+    if ( !Apply( *face, theNodeIndexOnKeyPoint1, theReverse )) {
+      MESSAGE( "Failed on " << *face );
+      continue;
+    }
+    myElements.push_back( *face );
+
+    // store computed points belonging to elements
+    list< list< int > >::iterator ll = myElemPointIDs.begin();
+    for ( ; ll != myElemPointIDs.end(); ++ll )
+    {
+      myElemXYZIDs.push_back();
+      list< int >& xyzIds = myElemXYZIDs.back();
+      list< int >& pIds = *ll;
+      for ( list<int>::iterator id = pIds.begin(); id != pIds.end(); id++ ) {
+        int pIndex = *id + ind1;
+        xyzIds.push_back( pIndex );
+        myXYZ[ pIndex ] = myPoints[ *id ].myXYZ.XYZ();
+        reverseConnectivity[ pIndex ].push_back( & xyzIds );
+      }
+    }
+    // put points on links to linkPointIndListMap
+    int nbNodes = (*face)->NbNodes(), eID = nbNodes + 1;
+    for ( int i = 0; i < nbNodes; i++ )
+    {
+      const SMDS_MeshNode* n1 = myOrderedNodes[ i ];
+      const SMDS_MeshNode* n2 = myOrderedNodes[ i + 1 == nbNodes ? 0 : i + 1 ];
+      // make a link of node pointers
+      TLink link;
+      link.insert( n1 );
+      link.insert( n2 );
+      // add the link to the map
+      list< list< int > >& groups = linkPointIndListMap[ link ];
+      groups.push_back();
+      list< int >& indList = groups.back();
+      list< TPoint* > & linkPoints = getShapePoints( eID++ );
+      list< TPoint* >::iterator p = linkPoints.begin();
+      // map the first link point to n1
+      myXYZIdToNodeMap[ pointIndex[ *p ] + ind1 ] = n1;
+      // add points to the map excluding the end points
+      for ( p++; *p != linkPoints.back(); p++ )
+        indList.push_back( pointIndex[ *p ] + ind1 );
+    }
+    ind1 += myPoints.size();
+  }
+
+  mergePoints( linkPointIndListMap, reverseConnectivity );
+
+  return !myElemXYZIDs.empty();
+}
+
+//=======================================================================
+//function : Apply
+//purpose  : Compute nodes coordinates applying
+//           the loaded pattern to <theVolumes>. The (0,0,0) key-point
+//           will be mapped into <theNode000Index>-th node. The
+//           (0,0,1) key-point will be mapped into <theNode000Index>-th
+//           node.
+//=======================================================================
+
+bool SMESH_Pattern::Apply (std::set<const SMDS_MeshVolume*> theVolumes,
+                           const int                        theNode000Index,
+                           const int                        theNode001Index)
+{
+  MESSAGE(" ::Apply(set<MeshVolumes>) " );
+
+  if ( !IsLoaded() ) {
+    MESSAGE( "Pattern not loaded" );
+    return setErrorCode( ERR_APPL_NOT_LOADED );
+  }
+
+   // bind ID to points
+  if ( !findBoundaryPoints() )
+    return false;
+
+  // check that there are no holes in a pattern
+  if (myNbKeyPntInBoundary.size() > 1 ) {
+    return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
+  }
+
+  myXYZ.clear();
+  myElemXYZIDs.clear();
+  myXYZIdToNodeMap.clear();
+  myElements.clear();
+
+  myXYZ.resize( myPoints.size() * theVolumes.size(), undefinedXYZ() );
+  myElements.reserve( theVolumes.size() );
+
+  // to find point index
+  map< TPoint*, int > pointIndex;
+  for ( int i = 0; i < myPoints.size(); i++ )
+    pointIndex.insert( make_pair( & myPoints[ i ], i ));
+
+  // to merge nodes on edges and faces of the elements being refined
+  map< TNodeSet, list< list< int > > > subPointIndListMap;
+  map< int, list< list< int >* > >  reverseConnectivity;
+
+  int ind1 = 0; // lowest point index for an element
+
+  // apply to each element in theVolumes set
+  set<const SMDS_MeshVolume*>::iterator vol = theVolumes.begin();
+  for ( ; vol != theVolumes.end(); ++vol )
+  {
+    if ( !Apply( *vol, theNode000Index, theNode001Index )) {
+      MESSAGE( "Failed on " << *vol );
+      continue;
+    }
+    myElements.push_back( *vol );
+
+    // store computed points belonging to elements
+    list< list< int > >::iterator ll = myElemPointIDs.begin();
+    for ( ; ll != myElemPointIDs.end(); ++ll )
+    {
+      myElemXYZIDs.push_back();
+      list< int >& xyzIds = myElemXYZIDs.back();
+      list< int >& pIds = *ll;
+      for ( list<int>::iterator id = pIds.begin(); id != pIds.end(); id++ ) {
+        int pIndex = *id + ind1;
+        xyzIds.push_back( pIndex );
+        myXYZ[ pIndex ] = myPoints[ *id ].myXYZ.XYZ();
+        reverseConnectivity[ pIndex ].push_back( & xyzIds );
+      }
+    }
+    // put points on edges and faces to subPointIndListMap
+    for ( int Id = SMESH_Block::ID_V000; Id <= SMESH_Block::ID_F1yz; Id++ )
+    {
+      // make a set of sub-points
+      TNodeSet subNodes;
+      vector< int > subIDs;
+      if ( SMESH_Block::IsVertexID( Id )) {
+        // use nodes of refined volumes for merge
+      }
+      else if ( SMESH_Block::IsEdgeID( Id )) {
+        SMESH_Block::GetEdgeVertexIDs( Id, subIDs );
+        subNodes.insert( myOrderedNodes[ subIDs.front() - 1 ]);
+        subNodes.insert( myOrderedNodes[ subIDs.back() - 1 ]);
+      }
+      else {
+        SMESH_Block::GetFaceEdgesIDs( Id, subIDs );
+        int e1 = subIDs[ 0 ], e2 = subIDs[ 1 ];
+        SMESH_Block::GetEdgeVertexIDs( e1, subIDs );
+        subNodes.insert( myOrderedNodes[ subIDs.front() - 1 ]);
+        subNodes.insert( myOrderedNodes[ subIDs.back() - 1 ]);
+        SMESH_Block::GetEdgeVertexIDs( e2, subIDs );
+        subNodes.insert( myOrderedNodes[ subIDs.front() - 1 ]);
+        subNodes.insert( myOrderedNodes[ subIDs.back() - 1 ]);
+      }
+      list< list< int > >& groups = subPointIndListMap[ subNodes ];
+      groups.push_back();
+      list< int >& indList = groups.back();
+      // add points
+      list< TPoint* > & points = getShapePoints( Id );
+      list< TPoint* >::iterator p = points.begin();
+      if ( subNodes.empty() ) // vertex case
+        myXYZIdToNodeMap[ pointIndex[ *p ] + ind1 ] = myOrderedNodes[ Id - 1 ];
+      else
+        for ( ; p != points.end(); p++ )
+          indList.push_back( pointIndex[ *p ] + ind1 );
+    }
+    ind1 += myPoints.size();
+  }
+
+  mergePoints( subPointIndListMap, reverseConnectivity );
+
+  return !myElemXYZIDs.empty();
+}
+
 //=======================================================================
 //function : Load
 //purpose  : Create a pattern from the mesh built on <theBlock>
 //=======================================================================
 //function : Load
 //purpose  : Create a pattern from the mesh built on <theBlock>
@@ -2486,7 +2943,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh*         theMesh,
       // store a node and a point
     while ( nIt->more() ) {
       const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nIt->next() );
       // store a node and a point
     while ( nIt->more() ) {
       const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nIt->next() );
-      nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint ));
+      nodePointIDMap.insert( make_pair( node, iPoint ));
       if ( block.IsVertexID( shapeID ))
         myKeyPointIDs.push_back( iPoint );
       TPoint* p = & myPoints[ iPoint++ ];
       if ( block.IsVertexID( shapeID ))
         myKeyPointIDs.push_back( iPoint );
       TPoint* p = & myPoints[ iPoint++ ];
@@ -2620,6 +3077,56 @@ bool SMESH_Pattern::Apply (const TopoDS_Shell&  theBlock,
   return setErrorCode( ERR_OK );
 }
 
   return setErrorCode( ERR_OK );
 }
 
+//=======================================================================
+//function : Apply
+//purpose  : Compute nodes coordinates applying
+//           the loaded pattern to <theVolume>. The (0,0,0) key-point
+//           will be mapped into <theNode000Index>-th node. The
+//           (0,0,1) key-point will be mapped into <theNode000Index>-th
+//           node.
+//=======================================================================
+
+bool SMESH_Pattern::Apply (const SMDS_MeshVolume* theVolume,
+                           const int              theNode000Index,
+                           const int              theNode001Index)
+{
+  MESSAGE(" ::Apply(MeshVolume) " );
+
+  if (!findBoundaryPoints()) // bind ID to points
+    return false;
+
+  SMESH_Block block;  // bind ID to shape
+  if (!block.LoadMeshBlock( theVolume, theNode000Index, theNode001Index, myOrderedNodes ))
+    return setErrorCode( ERR_APPLV_BAD_SHAPE );
+  // compute XYZ of points on shapes
+
+  for ( int ID = SMESH_Block::ID_V000; ID <= SMESH_Block::ID_Shell; ID++ )
+  {
+    list< TPoint* > & shapePoints = getShapePoints( ID );
+    list< TPoint* >::iterator pIt = shapePoints.begin();
+
+    if ( block.IsVertexID( ID ))
+      for ( ; pIt != shapePoints.end(); pIt++ ) {
+        block.VertexPoint( ID, (*pIt)->myXYZ.ChangeCoord() );
+      }
+    else if ( block.IsEdgeID( ID ))
+      for ( ; pIt != shapePoints.end(); pIt++ ) {
+        block.EdgePoint( ID, (*pIt)->myInitXYZ, (*pIt)->myXYZ.ChangeCoord() );
+      }
+    else if ( block.IsFaceID( ID ))
+      for ( ; pIt != shapePoints.end(); pIt++ ) {
+        block.FacePoint( ID, (*pIt)->myInitXYZ, (*pIt)->myXYZ.ChangeCoord() );
+      }
+    else
+      for ( ; pIt != shapePoints.end(); pIt++ )
+        block.ShellPoint( (*pIt)->myInitXYZ, (*pIt)->myXYZ.ChangeCoord() );
+  } // loop on block sub-shapes
+
+  myIsComputed = true;
+
+  return setErrorCode( ERR_OK );
+}
+
 //=======================================================================
 //function : MakeMesh
 //purpose  : Create nodes and elements in <theMesh> using nodes
 //=======================================================================
 //function : MakeMesh
 //purpose  : Create nodes and elements in <theMesh> using nodes
@@ -2633,78 +3140,130 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
     return setErrorCode( ERR_MAKEM_NOT_COMPUTED );
 
   SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS();
     return setErrorCode( ERR_MAKEM_NOT_COMPUTED );
 
   SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS();
+  SMESH_MeshEditor editor( theMesh ); 
 
   // clear elements and nodes existing on myShape
 
   // clear elements and nodes existing on myShape
-  SMESH_subMesh * aSubMesh = theMesh->GetSubMeshContaining( myShape );
-  SMESHDS_SubMesh * aSubMeshDS = aMeshDS->MeshElements( myShape );
-  if ( aSubMesh )
-    aSubMesh->ComputeStateEngine( SMESH_subMesh::CLEAN );
-  else if ( aSubMeshDS )
+
+  if ( !myShape.IsNull() )
   {
   {
-    SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
-    while ( eIt->more() )
-      aMeshDS->RemoveElement( eIt->next() );
-    SMDS_NodeIteratorPtr nIt = aSubMeshDS->GetNodes();
-    while ( nIt->more() )
-      aMeshDS->RemoveNode( static_cast<const SMDS_MeshNode*>( nIt->next() ));
+    SMESH_subMesh * aSubMesh = theMesh->GetSubMeshContaining( myShape );
+    SMESHDS_SubMesh * aSubMeshDS = aMeshDS->MeshElements( myShape );
+    if ( aSubMesh )
+      aSubMesh->ComputeStateEngine( SMESH_subMesh::CLEAN );
+    else if ( aSubMeshDS )
+    {
+      SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
+      while ( eIt->more() )
+        aMeshDS->RemoveElement( eIt->next() );
+      SMDS_NodeIteratorPtr nIt = aSubMeshDS->GetNodes();
+      while ( nIt->more() )
+        aMeshDS->RemoveNode( static_cast<const SMDS_MeshNode*>( nIt->next() ));
+    }
   }
 
   }
 
+  bool onMeshElements = ( !myElements.empty() );
+
   // loop on sub-shapes of myShape: create nodes and build point-node map
   // loop on sub-shapes of myShape: create nodes and build point-node map
-  typedef map< TPoint*, const SMDS_MeshNode* > TPointNodeMap;
-  TPointNodeMap pointNodeMap;
-  map< int, list< TPoint* > >::iterator idPointIt = myShapeIDToPointsMap.begin();
-  for ( ; idPointIt != myShapeIDToPointsMap.end(); idPointIt++ )
+
+  vector< const SMDS_MeshNode* >       nodesVector;
+  map< TPoint*, const SMDS_MeshNode* > pointNodeMap;
+  if ( onMeshElements )
+  {
+    nodesVector.resize( myXYZ.size() );
+    for ( int i = 0; i < myXYZ.size(); ++i ) {
+      map< int, const SMDS_MeshNode*>::iterator idNode = myXYZIdToNodeMap.find( i );
+      if ( idNode != myXYZIdToNodeMap.end() )
+        nodesVector[ i ] = idNode->second;
+      else if ( isDefined( myXYZ[ i ] ))
+        nodesVector[ i ] = aMeshDS->AddNode (myXYZ[ i ].X(),
+                                             myXYZ[ i ].Y(),
+                                             myXYZ[ i ].Z());
+    }
+  }
+  else
   {
   {
-    const TopoDS_Shape & S = myShapeIDMap( (*idPointIt).first );
-    list< TPoint* > & points = (*idPointIt).second;
-    SMESHDS_SubMesh * subMeshDS = aMeshDS->MeshElements( S );
-    SMESH_subMesh * subMesh = theMesh->GetSubMeshContaining( myShape );
-    list< TPoint* >::iterator pIt = points.begin();
-    for ( ; pIt != points.end(); pIt++ )
+    map< int, list< TPoint* > >::iterator idPointIt = myShapeIDToPointsMap.begin();
+    for ( ; idPointIt != myShapeIDToPointsMap.end(); idPointIt++ )
     {
     {
-      TPoint* point = *pIt;
-      if ( pointNodeMap.find( point ) != pointNodeMap.end() )
-        continue;
-      SMDS_MeshNode* node = aMeshDS->AddNode (point->myXYZ.X(),
-                                              point->myXYZ.Y(),
-                                              point->myXYZ.Z());
-      pointNodeMap.insert( TPointNodeMap::value_type( point, node ));
-      if ( subMeshDS ) {
-        switch ( S.ShapeType() ) {
-        case TopAbs_VERTEX: {
-          aMeshDS->SetNodeOnVertex( node, TopoDS::Vertex( S ));
-          break;
-        }
-        case TopAbs_EDGE: {
-          aMeshDS->SetNodeOnEdge( node, TopoDS::Edge( S ));
-          SMDS_EdgePosition* epos =
-            dynamic_cast<SMDS_EdgePosition *>(node->GetPosition().get());
-          epos->SetUParameter( point->myU );
-          break;
-        }
-        case TopAbs_FACE: {
-          aMeshDS->SetNodeOnFace( node, TopoDS::Face( S ));
-          SMDS_FacePosition* pos =
-            dynamic_cast<SMDS_FacePosition *>(node->GetPosition().get());
-          pos->SetUParameter( point->myUV.X() );
-          pos->SetVParameter( point->myUV.Y() );
-          break;
-        }
-        default:
-          aMeshDS->SetNodeInVolume( node, TopoDS::Shell( S ));
+      TopoDS_Shape S;
+      SMESHDS_SubMesh * subMeshDS = 0;
+      if ( !myShapeIDMap.IsEmpty() ) {
+        S = myShapeIDMap( idPointIt->first );
+        subMeshDS = aMeshDS->MeshElements( S );
+      }
+      list< TPoint* > & points = idPointIt->second;
+      list< TPoint* >::iterator pIt = points.begin();
+      for ( ; pIt != points.end(); pIt++ )
+      {
+        TPoint* point = *pIt;
+        if ( pointNodeMap.find( point ) != pointNodeMap.end() )
+          continue;
+        SMDS_MeshNode* node = aMeshDS->AddNode (point->myXYZ.X(),
+                                                point->myXYZ.Y(),
+                                                point->myXYZ.Z());
+        pointNodeMap.insert( make_pair( point, node ));
+        if ( subMeshDS ) {
+          switch ( S.ShapeType() ) {
+          case TopAbs_VERTEX: {
+            aMeshDS->SetNodeOnVertex( node, TopoDS::Vertex( S ));
+            break;
+          }
+          case TopAbs_EDGE: {
+            aMeshDS->SetNodeOnEdge( node, TopoDS::Edge( S ));
+            SMDS_EdgePosition* epos =
+              dynamic_cast<SMDS_EdgePosition *>(node->GetPosition().get());
+            epos->SetUParameter( point->myU );
+            break;
+          }
+          case TopAbs_FACE: {
+            aMeshDS->SetNodeOnFace( node, TopoDS::Face( S ));
+            SMDS_FacePosition* pos =
+              dynamic_cast<SMDS_FacePosition *>(node->GetPosition().get());
+            pos->SetUParameter( point->myUV.X() );
+            pos->SetVParameter( point->myUV.Y() );
+            break;
+          }
+          default:
+            aMeshDS->SetNodeInVolume( node, TopoDS::Shell( S ));
+          }
         }
       }
     }
         }
       }
     }
-    // make that SMESH_subMesh::_computeState = COMPUTE_OK
-    // so that operations with hypotheses will erase the mesh
-    // being built
-    if ( subMesh )
-      subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
   }
   }
-
+  
   // create elements
   // create elements
-  list<list< int > >::iterator epIt = myElemPointIDs.begin();
-  for ( ; epIt != myElemPointIDs.end(); epIt++ )
+
+  // shapes and groups myElements are on
+  vector< int > shapeIDs;
+  vector< list< SMESHDS_Group* > > groups;
+  if ( onMeshElements )
+  {
+    shapeIDs.resize( myElements.size() );
+    groups.resize( myElements.size() );
+    const set<SMESHDS_GroupBase*>& allGroups = aMeshDS->GetGroups();
+    set<SMESHDS_GroupBase*>::const_iterator grIt;
+    for ( int i = 0; i < myElements.size(); i++ )
+    {
+      shapeIDs[ i ] = editor.FindShape( myElements[ i ] );
+      for ( grIt = allGroups.begin(); grIt != allGroups.end(); grIt++ ) {
+        SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>( *grIt );
+        if ( group && group->SMDSGroup().Contains( myElements[ i ] ))
+          groups[ i ].push_back( group );
+      }
+    }
+  }
+  int nbElems = myElemPointIDs.size(); // nb elements in a pattern
+
+  list<list< int > >::iterator epIt, epEnd;
+  if ( onMeshElements ) {
+    epIt  = myElemXYZIDs.begin();
+    epEnd = myElemXYZIDs.end();
+  }
+  else {
+    epIt  = myElemPointIDs.begin();
+    epEnd = myElemPointIDs.end();
+  }
+  for ( int iElem = 0; epIt != epEnd; epIt++, iElem++ )
   {
     list< int > & elemPoints = *epIt;
     // retrieve nodes
   {
     list< int > & elemPoints = *epIt;
     // retrieve nodes
@@ -2712,7 +3271,10 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
     list< int >::iterator iIt = elemPoints.begin();
     int nbNodes;
     for ( nbNodes = 0; iIt != elemPoints.end(); iIt++ ) {
     list< int >::iterator iIt = elemPoints.begin();
     int nbNodes;
     for ( nbNodes = 0; iIt != elemPoints.end(); iIt++ ) {
-      nodes[ nbNodes++ ] = pointNodeMap[ & myPoints[ *iIt ]];
+      if ( onMeshElements )
+        nodes[ nbNodes++ ] = nodesVector[ *iIt ];
+      else
+        nodes[ nbNodes++ ] = pointNodeMap[ & myPoints[ *iIt ]];
     }
     // add an element
     const SMDS_MeshElement* elem = 0;
     }
     // add an element
     const SMDS_MeshElement* elem = 0;
@@ -2722,7 +3284,8 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
         elem = aMeshDS->AddFace( nodes[0], nodes[1], nodes[2] ); break;
       case 4:
         elem = aMeshDS->AddFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break;
         elem = aMeshDS->AddFace( nodes[0], nodes[1], nodes[2] ); break;
       case 4:
         elem = aMeshDS->AddFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break;
-      default:;
+      default:
+        ASSERT( nbNodes < 8 );
       }
     }
     else {
       }
     }
     else {
@@ -2738,13 +3301,51 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
       case 8:
         elem = aMeshDS->AddVolume (nodes[0], nodes[1], nodes[2], nodes[3],
                                    nodes[4], nodes[5], nodes[6], nodes[7] ); break;
       case 8:
         elem = aMeshDS->AddVolume (nodes[0], nodes[1], nodes[2], nodes[3],
                                    nodes[4], nodes[5], nodes[6], nodes[7] ); break;
-      default:;
+      default:
+        ASSERT( nbNodes < 8 );
       }
     }
       }
     }
-    if ( elem )
+    // set element on a shape
+    if ( elem && onMeshElements )
+    {
+      int elemIndex = iElem / nbElems;
+      if ( shapeIDs[ elemIndex ] > 0 )
+        aMeshDS->SetMeshElementOnShape( elem, shapeIDs[ elemIndex ] );
+      // add elem in groups
+      list< SMESHDS_Group* >::iterator g = groups[ elemIndex ].begin();
+      for ( ; g != groups[ elemIndex ].end(); ++g )
+        (*g)->SMDSGroup().Add( elem );
+    }
+    if ( elem && !myShape.IsNull() )
       aMeshDS->SetMeshElementOnShape( elem, myShape );
   }
 
       aMeshDS->SetMeshElementOnShape( elem, myShape );
   }
 
+  // make that SMESH_subMesh::_computeState = COMPUTE_OK
+  // so that operations with hypotheses will erase the mesh being built
+
+  SMESH_subMesh * subMesh;
+  if ( !myShape.IsNull() ) {
+    subMesh = theMesh->GetSubMeshContaining( myShape );
+    if ( subMesh )
+      subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+  }
+  if ( onMeshElements ) {
+    list< int > elemIDs;
+    for ( int i = 0; i < myElements.size(); i++ )
+    {
+      int shapeID = shapeIDs[ i ];
+      if ( shapeID > 0 ) {
+        TopoDS_Shape S = aMeshDS->IndexToShape( shapeID );
+        subMesh = theMesh->GetSubMeshContaining( S );
+        if ( subMesh )
+          subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+      }
+      elemIDs.push_back( myElements[ i ]->GetID() );
+    }
+    // remove refined elements and their nodes
+    editor.Remove( elemIDs, false );
+  }
+
   return setErrorCode( ERR_OK );
 }
 
   return setErrorCode( ERR_OK );
 }
 
@@ -3026,6 +3627,7 @@ bool SMESH_Pattern::findBoundaryPoints()
       double edgeLength = 0;
       list< TPoint* >::iterator pIt = boundary->begin();
       getShapePoints( edgeID ).push_back( *pIt );
       double edgeLength = 0;
       list< TPoint* >::iterator pIt = boundary->begin();
       getShapePoints( edgeID ).push_back( *pIt );
+      getShapePoints( vertexID++ ).push_back( *pIt );
       for ( pIt++; pIt != boundary->end(); pIt++)
       {
         list< TPoint* > & edgePoints = getShapePoints( edgeID );
       for ( pIt++; pIt != boundary->end(); pIt++)
       {
         list< TPoint* > & edgePoints = getShapePoints( edgeID );
@@ -3050,10 +3652,11 @@ bool SMESH_Pattern::findBoundaryPoints()
           }
           // begin the next edge treatment
           edgeLength = 0;
           }
           // begin the next edge treatment
           edgeLength = 0;
-          getShapePoints( vertexID++ ).push_back( point );
           edgeID++;
           edgeID++;
-          if ( point != boundary->front() )
+          if ( point != boundary->front() ) { // not the first key-point again
             getShapePoints( edgeID ).push_back( point );
             getShapePoints( edgeID ).push_back( point );
+            getShapePoints( vertexID++ ).push_back( point );
+          }
         }
       }
     }
         }
       }
     }
@@ -3153,17 +3756,23 @@ bool SMESH_Pattern::setShapeToMesh(const TopoDS_Shape& theShape)
 //purpose  : Return nodes coordinates computed by Apply() method
 //=======================================================================
 
 //purpose  : Return nodes coordinates computed by Apply() method
 //=======================================================================
 
-bool SMESH_Pattern::GetMappedPoints ( list< const gp_XYZ * > & thePoints )
+bool SMESH_Pattern::GetMappedPoints ( list< const gp_XYZ * > & thePoints ) const
 {
   thePoints.clear();
   if ( !myIsComputed )
     return false;
 
 {
   thePoints.clear();
   if ( !myIsComputed )
     return false;
 
-  vector< TPoint >::iterator pVecIt = myPoints.begin();
-  for ( ; pVecIt != myPoints.end(); pVecIt++ )
-    thePoints.push_back( & (*pVecIt).myXYZ.XYZ() );
-
-  return ( thePoints.size() > 0 );
+  if ( myElements.empty() ) { // applied to shape
+    vector< TPoint >::const_iterator pVecIt = myPoints.begin();
+    for ( ; pVecIt != myPoints.end(); pVecIt++ )
+      thePoints.push_back( & (*pVecIt).myXYZ.XYZ() );
+  }
+  else { // applied to mesh elements
+    vector<gp_XYZ>::const_iterator xyz = myXYZ.begin();
+    for ( ; xyz != myXYZ.end(); ++xyz )
+      thePoints.push_back( & (*xyz) );
+  }
+  return !thePoints.empty();
 }
 
 
 }
 
 
index 9358fae472122de0bdfb69a72636297efdf952cc..0a54cfa711b7dc4e07225f590e6fc4244bb39535 100644 (file)
@@ -27,6 +27,7 @@
 #include <vector>
 #include <list>
 #include <map>
 #include <vector>
 #include <list>
 #include <map>
+#include <set>
 #include <iostream>
 
 #include <TopoDS_Shape.hxx>
 #include <iostream>
 
 #include <TopoDS_Shape.hxx>
 #include <gp_XY.hxx>
 #include <gp_Pnt.hxx>
 
 #include <gp_XY.hxx>
 #include <gp_Pnt.hxx>
 
+class SMDS_MeshElement;
+class SMDS_MeshFace;
+class SMDS_MeshVolume;
+class SMDS_MeshNode;
 class SMESH_Mesh;
 class TopoDS_Shell;
 class TopoDS_Vertex;
 class SMESH_Mesh;
 class TopoDS_Shell;
 class TopoDS_Vertex;
@@ -56,7 +61,7 @@ class SMESH_Pattern {
   // clear fields
 
   bool Load (const char* theFileContents);
   // clear fields
 
   bool Load (const char* theFileContents);
-  // Load a pattern from <theFile>
+  // Load a pattern from <theFileContents>
 
   bool Load (SMESH_Mesh*        theMesh,
              const TopoDS_Face& theFace,
 
   bool Load (SMESH_Mesh*        theMesh,
              const TopoDS_Face& theFace,
@@ -88,7 +93,39 @@ class SMESH_Pattern {
   // will be mapped into <theVertex000>. The
   // (0,0,1) key-point will be mapped into <theVertex001>.
 
   // will be mapped into <theVertex000>. The
   // (0,0,1) key-point will be mapped into <theVertex001>.
 
-  bool GetMappedPoints ( std::list<const gp_XYZ *> & thePoints );
+  bool Apply (const SMDS_MeshFace* theFace,
+              const int            theNodeIndexOnKeyPoint1,
+              const bool           theReverse);
+  // Compute nodes coordinates applying
+  // the loaded pattern to <theFace>. The first key-point
+  // will be mapped into <theNodeIndexOnKeyPoint1>-th node
+
+  bool Apply (std::set<const SMDS_MeshFace*> theFaces,
+              const int                      theNodeIndexOnKeyPoint1,
+              const bool                     theReverse);
+  // Compute nodes coordinates applying
+  // the loaded pattern to <theFaces>. The first key-point
+  // will be mapped into <theNodeIndexOnKeyPoint1>-th node
+
+  bool Apply (const SMDS_MeshVolume* theVolume,
+              const int              theNode000Index,
+              const int              theNode001Index);
+  // Compute nodes coordinates applying
+  // the loaded pattern to <theVolume>. The (0,0,0) key-point
+  // will be mapped into <theNode000Index>-th node. The
+  // (0,0,1) key-point will be mapped into <theNode000Index>-th
+  // node.
+
+  bool Apply (std::set<const SMDS_MeshVolume*> theVolumes,
+              const int                        theNode000Index,
+              const int                        theNode001Index);
+  // Compute nodes coordinates applying
+  // the loaded pattern to <theVolumes>. The (0,0,0) key-point
+  // will be mapped into <theNode000Index>-th node. The
+  // (0,0,1) key-point will be mapped into <theNode000Index>-th
+  // node.
+
+  bool GetMappedPoints ( std::list<const gp_XYZ *> & thePoints ) const;
   // Return nodes coordinates computed by Apply() method
 
   bool MakeMesh(SMESH_Mesh* theMesh);
   // Return nodes coordinates computed by Apply() method
 
   bool MakeMesh(SMESH_Mesh* theMesh);
@@ -131,6 +168,8 @@ class SMESH_Pattern {
     ERR_APPLF_INTERNAL_EEROR, // program error
     // Apply(volume)
     ERR_APPLV_BAD_SHAPE, // volume is not a brick of 6 faces
     ERR_APPLF_INTERNAL_EEROR, // program error
     // Apply(volume)
     ERR_APPLV_BAD_SHAPE, // volume is not a brick of 6 faces
+    // Apply(mesh_face)
+    ERR_APPLF_BAD_FACE_GEOM, // bad face geometry
     // MakeMesh
     ERR_MAKEM_NOT_COMPUTED // mapping failed
   };
     // MakeMesh
     ERR_MAKEM_NOT_COMPUTED // mapping failed
   };
@@ -152,7 +191,7 @@ class SMESH_Pattern {
   // GetPoints() and GetMappedPoints()
   
   const std::list< std::list< int > >& GetElementPointIDs () const
   // GetPoints() and GetMappedPoints()
   
   const std::list< std::list< int > >& GetElementPointIDs () const
-  { return myElemPointIDs; }
+  { return myElemXYZIDs.empty() ? myElemPointIDs : myElemXYZIDs; }
   // Return nodal connectivity of the elements of the pattern
 
   void DumpPoints() const;
   // Return nodal connectivity of the elements of the pattern
 
   void DumpPoints() const;
@@ -230,7 +269,14 @@ class SMESH_Pattern {
   // of boundaries; after sorting, edges in the wires are put
   // in a good order, point UVs on edges are computed and points
   // are appended to theEdgesPointsList
   // of boundaries; after sorting, edges in the wires are put
   // in a good order, point UVs on edges are computed and points
   // are appended to theEdgesPointsList
-  
+
+  typedef std::set<const SMDS_MeshNode*> TNodeSet;
+  void mergePoints (std::map<TNodeSet,std::list<std::list<int> > >&  xyzIndGroups,
+                    std::map< int, std::list< std::list< int >* > >& reverseConnectivity);
+  // Look for coincident points between myXYZs indexed with
+  // list<int> of each element of xyzIndGroups. Coincident indices
+  // are merged in myElemXYZIDs using reverseConnectivity.
+
  private:
   // fields
 
  private:
   // fields
 
@@ -245,12 +291,21 @@ class SMESH_Pattern {
 
   TopoDS_Shape                      myShape;
   // all functions assure that shapes are indexed so that first go
 
   TopoDS_Shape                      myShape;
   // all functions assure that shapes are indexed so that first go
-  // ordered vertices, then ordered edge, then faces and a shell
+  // ordered vertices, then ordered edge, then faces and maybe a shell
   TopTools_IndexedMapOfOrientedShape myShapeIDMap;
   //TopTools_IndexedMapOfShape        myShapeIDMap;
   std::map< int, list< TPoint* > >  myShapeIDToPointsMap;
 
   TopTools_IndexedMapOfOrientedShape myShapeIDMap;
   //TopTools_IndexedMapOfShape        myShapeIDMap;
   std::map< int, list< TPoint* > >  myShapeIDToPointsMap;
 
-  std::list< int >                  myNbKeyPntInBoundary; //for the 2d case
+  // for the 2d case:
+  // nb of key-points in each of pattern boundaries
+  std::list< int >                  myNbKeyPntInBoundary;
+
+  // to compute while applying to mesh elements, not to shapes
+  std::vector<gp_XYZ>               myXYZ;
+  std::list< std::list< int > >     myElemXYZIDs;
+  std::map< int, const SMDS_MeshNode*> myXYZIdToNodeMap; // map id to node of a refined element
+  std::vector<const SMDS_MeshElement*> myElements; // refined elements
+  std::vector<const SMDS_MeshNode*> myOrderedNodes;
 };
 
 
 };
 
 
index dece6ab48ed5d9be805c48278690ca59acbddc22..459d30848aa5c34c7d27f0c93419ba460ad45b6e 100644 (file)
@@ -42,6 +42,7 @@
 #include <TopoDS_Face.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Face.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Edge.hxx>
+#include <map>
 
 //Not portable see http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#5_4 to know more.
 #ifdef __GNUC__
 
 //Not portable see http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#5_4 to know more.
 #ifdef __GNUC__
@@ -178,12 +179,12 @@ public:
   bool HasMeshElements(const TopoDS_Shape & S);
   SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S);
   SMESHDS_SubMesh * MeshElements(const int Index);
   bool HasMeshElements(const TopoDS_Shape & S);
   SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S);
   SMESHDS_SubMesh * MeshElements(const int Index);
-  list<int> SubMeshIndices();
+  std::list<int> SubMeshIndices();
   const std::map<int,SMESHDS_SubMesh*>& SubMeshes()
   { return myShapeIndexToSubMesh; }
 
   bool HasHypothesis(const TopoDS_Shape & S);
   const std::map<int,SMESHDS_SubMesh*>& SubMeshes()
   { return myShapeIndexToSubMesh; }
 
   bool HasHypothesis(const TopoDS_Shape & S);
-  const list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
+  const std::list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
   SMESHDS_Script * GetScript();
   void ClearScript();
   int ShapeToIndex(const TopoDS_Shape & aShape);
   SMESHDS_Script * GetScript();
   void ClearScript();
   int ShapeToIndex(const TopoDS_Shape & aShape);
@@ -200,7 +201,7 @@ public:
   void AddGroup (SMESHDS_GroupBase* theGroup)      { myGroups.insert(theGroup); }
   void RemoveGroup (SMESHDS_GroupBase* theGroup)   { myGroups.erase(theGroup); }
   int GetNbGroups() const                      { return myGroups.size(); }
   void AddGroup (SMESHDS_GroupBase* theGroup)      { myGroups.insert(theGroup); }
   void RemoveGroup (SMESHDS_GroupBase* theGroup)   { myGroups.erase(theGroup); }
   int GetNbGroups() const                      { return myGroups.size(); }
-  const set<SMESHDS_GroupBase*>& GetGroups() const { return myGroups; }
+  const std::set<SMESHDS_GroupBase*>& GetGroups() const { return myGroups; }
 
   bool IsGroupOfSubShapes (const TopoDS_Shape& aSubShape) const;
 
 
   bool IsGroupOfSubShapes (const TopoDS_Shape& aSubShape) const;
 
@@ -219,8 +220,8 @@ private:
   int                        myMeshID;
   TopoDS_Shape               myShape;
   TopTools_IndexedMapOfShape myIndexToShape;
   int                        myMeshID;
   TopoDS_Shape               myShape;
   TopTools_IndexedMapOfShape myIndexToShape;
-  map<int,SMESHDS_SubMesh*>  myShapeIndexToSubMesh;
-  set<SMESHDS_GroupBase*>        myGroups;
+  std::map<int,SMESHDS_SubMesh*>  myShapeIndexToSubMesh;
+  std::set<SMESHDS_GroupBase*>    myGroups;
   SMESHDS_Script*            myScript;
 };
 
   SMESHDS_Script*            myScript;
 };
 
index e3a137822c7aa98b84a03602244a901fa61fc257..bc02829e315fb45d20b9e7671a0abe498de9e0b0 100644 (file)
@@ -88,6 +88,7 @@ LIB_SRC =     SMESHGUI.cxx \
                SMESHGUI_SmoothingDlg.cxx \
                SMESHGUI_RenumberingDlg.cxx \
                SMESHGUI_ExtrusionDlg.cxx \
                SMESHGUI_SmoothingDlg.cxx \
                SMESHGUI_RenumberingDlg.cxx \
                SMESHGUI_ExtrusionDlg.cxx \
+               SMESHGUI_ExtrusionAlongPathDlg.cxx \
                SMESHGUI_RevolutionDlg.cxx \
                SMESHGUI_RotationDlg.cxx \
                SMESHGUI_TranslationDlg.cxx \
                SMESHGUI_RevolutionDlg.cxx \
                SMESHGUI_RotationDlg.cxx \
                SMESHGUI_TranslationDlg.cxx \
@@ -138,6 +139,7 @@ LIB_MOC = \
                SMESHGUI_SmoothingDlg.h \
                SMESHGUI_RenumberingDlg.h \
                SMESHGUI_ExtrusionDlg.h \
                SMESHGUI_SmoothingDlg.h \
                SMESHGUI_RenumberingDlg.h \
                SMESHGUI_ExtrusionDlg.h \
+               SMESHGUI_ExtrusionAlongPathDlg.h \
                SMESHGUI_RevolutionDlg.h \
                SMESHGUI_RotationDlg.h \
                SMESHGUI_TranslationDlg.h \
                SMESHGUI_RevolutionDlg.h \
                SMESHGUI_RotationDlg.h \
                SMESHGUI_TranslationDlg.h \
@@ -169,7 +171,7 @@ LIB_SERVER_IDL =
 #BIN = SMESHBin
 
 CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
 #BIN = SMESHBin
 
 CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
-            $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
+            -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
             $(BOOST_CPPFLAGS)
 
 CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
             $(BOOST_CPPFLAGS)
 
 CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
index 78f27d2220f51ea785ffeafb7d4401388ad8f482..ca77a9b2c690b9b03b85f309342737b4458d9014 100644 (file)
@@ -53,6 +53,7 @@
 #include "SMESHGUI_SmoothingDlg.h"
 #include "SMESHGUI_RenumberingDlg.h"
 #include "SMESHGUI_ExtrusionDlg.h"
 #include "SMESHGUI_SmoothingDlg.h"
 #include "SMESHGUI_RenumberingDlg.h"
 #include "SMESHGUI_ExtrusionDlg.h"
+#include "SMESHGUI_ExtrusionAlongPathDlg.h"
 #include "SMESHGUI_RevolutionDlg.h"
 #include "SMESHGUI_TranslationDlg.h"
 #include "SMESHGUI_RotationDlg.h"
 #include "SMESHGUI_RevolutionDlg.h"
 #include "SMESHGUI_TranslationDlg.h"
 #include "SMESHGUI_RotationDlg.h"
@@ -140,7 +141,9 @@ namespace{
 
   void ExportMeshToFile(QAD_Desktop * parent, int theCommandID);
 
 
   void ExportMeshToFile(QAD_Desktop * parent, int theCommandID);
 
-  void SetViewMode(int theCommandID);
+  void SetDisplayMode(int theCommandID);
+
+  void SetDisplayEntity(int theCommandID);
 
   void Control( int theCommandID );
 
 
   void Control( int theCommandID );
 
@@ -153,15 +156,16 @@ namespace{
                            SMESH::SMESH_Gen_ptr theComponentMesh,
                            int theCommandID)
   {
                            SMESH::SMESH_Gen_ptr theComponentMesh,
                            int theCommandID)
   {
-    QString filter;
+    QStringList filter;
     string myExtension;
   
     if(theCommandID == 113){
     string myExtension;
   
     if(theCommandID == 113){
-      filter = QObject::tr("MED files (*.med)");
+      filter.append(QObject::tr("MED files (*.med)"));
+      filter.append(QObject::tr("All files (*)"));
     }else if (theCommandID == 112){
     }else if (theCommandID == 112){
-      filter = QObject::tr("IDEAS files (*.unv)");
+      filter.append(QObject::tr("IDEAS files (*.unv)"));
     }else if (theCommandID == 111){
     }else if (theCommandID == 111){
-      filter = QObject::tr("DAT files (*.dat)");
+      filter.append(QObject::tr("DAT files (*.dat)"));
     }
     QString filename = QAD_FileDlg::getFileName(parent,
                                                "",
     }
     QString filename = QAD_FileDlg::getFileName(parent,
                                                "",
@@ -237,9 +241,11 @@ namespace{
       SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
       if ( !aMesh->_is_nil() ) {
        QString aFilter, aTitle = QObject::tr("Export mesh");
       SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
       if ( !aMesh->_is_nil() ) {
        QString aFilter, aTitle = QObject::tr("Export mesh");
+       QMap<QString, SMESH::MED_VERSION> aFilterMap;
        switch ( theCommandID ) {
        case 122:
        switch ( theCommandID ) {
        case 122:
-         aFilter = QObject::tr("MED files (*.med)");
+         aFilterMap.insert( QObject::tr("MED 2.1 (*.med)"), SMESH::MED_V2_1 );
+         aFilterMap.insert( QObject::tr("MED 2.2 (*.med)"), SMESH::MED_V2_2 );
          break;
        case 121:
          aFilter = QObject::tr("DAT files (*.dat)");
          break;
        case 121:
          aFilter = QObject::tr("DAT files (*.dat)");
@@ -261,7 +267,25 @@ namespace{
          return;
        }}
        
          return;
        }}
        
-       QString aFilename = QAD_FileDlg::getFileName(parent, "", aFilter, aTitle, false);
+       QString aFilename;
+       SMESH::MED_VERSION aFormat;
+       
+       if ( theCommandID != 122)
+         aFilename = QAD_FileDlg::getFileName(parent, "", aFilter, aTitle, false);
+       else
+         {
+           QStringList filters;
+           for ( QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin(); it != aFilterMap.end(); ++it )
+             filters.push_back( it.key() );
+           
+           QAD_FileDlg* fd = new QAD_FileDlg( parent, false, true, true );
+           fd->setCaption( aTitle );
+           fd->setFilters( filters );
+           fd->exec();
+           aFilename = fd->selectedFile();
+           aFormat = aFilterMap[fd->selectedFilter()];
+           delete fd;
+         }
        if ( !aFilename.isEmpty() ) {
          // Check whether the file already exists and delete it if yes
          QFile aFile( aFilename );
        if ( !aFilename.isEmpty() ) {
          // Check whether the file already exists and delete it if yes
          QFile aFile( aFilename );
@@ -270,7 +294,7 @@ namespace{
          QAD_WaitCursor wc;
          switch ( theCommandID ) {
          case 122:
          QAD_WaitCursor wc;
          switch ( theCommandID ) {
          case 122:
-           aMesh->ExportMED( aFilename.latin1(), true ); // currently, automatic groups are always created
+           aMesh->ExportToMED( aFilename.latin1(), false, aFormat ); // currently, automatic groups are never created
            break;
          case 121:
            aMesh->ExportDAT( aFilename.latin1() );
            break;
          case 121:
            aMesh->ExportDAT( aFilename.latin1() );
@@ -286,20 +310,59 @@ namespace{
     }
   }  
   
     }
   }  
   
-  void SetViewMode(int theCommandID){
+  inline void InverseEntityMode(unsigned int& theOutputMode,
+                               unsigned int theMode)
+  {
+    bool anIsNotPresent = ~theOutputMode & theMode;
+    if(anIsNotPresent)
+      theOutputMode |= theMode;
+    else
+      theOutputMode &= ~theMode;
+  }
+
+  void SetDisplayEntity(int theCommandID){
+    SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
+    if(Sel->IObjectCount() >= 1){
+      SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+      for(; It.More(); It.Next()){
+       Handle(SALOME_InteractiveObject) IObject = It.Value();
+       if(IObject->hasEntry()){
+         if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
+           unsigned int aMode = anActor->GetEntityMode();
+           switch(theCommandID){
+           case 217:
+             InverseEntityMode(aMode,SMESH_Actor::eEdges);
+             break;
+           case 218:
+             InverseEntityMode(aMode,SMESH_Actor::eFaces);
+             break;
+           case 219:
+             InverseEntityMode(aMode,SMESH_Actor::eVolumes);
+             break;
+           case 220:
+             aMode = SMESH_Actor::eAllEntity;
+             break;
+           }
+           if(aMode)
+             anActor->SetEntityMode(aMode);
+         }
+       }
+      }
+    }
+  }
+
+  void SetDisplayMode(int theCommandID){
     SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
     if(Sel->IObjectCount() >= 1){
       switch(theCommandID){
       case 1134:{
        SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
     SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
     if(Sel->IObjectCount() >= 1){
       switch(theCommandID){
       case 1134:{
        SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
-       SMESHGUI_ClippingDlg *aDlg = 
-         new SMESHGUI_ClippingDlg(QAD_Application::getDesktop(),"",false);
+       new SMESHGUI_ClippingDlg(QAD_Application::getDesktop(),"",false);
        return;
       }
       case 1133:{
        SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
        return;
       }
       case 1133:{
        SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
-       SMESHGUI_TransparencyDlg *aDlg = 
-         new SMESHGUI_TransparencyDlg(QAD_Application::getDesktop(),"",false);
+       new SMESHGUI_TransparencyDlg(QAD_Application::getDesktop(),"",false);
        return;
       }}
       SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
        return;
       }}
       SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
@@ -504,7 +567,11 @@ namespace{
          switch ( theCommandID ){
          case 6001:
            aTitle = QObject::tr( "LENGTH_EDGES" );
          switch ( theCommandID ){
          case 6001:
            aTitle = QObject::tr( "LENGTH_EDGES" );
-           aControl = SMESH_Actor::eLengthEdges;
+           aControl = SMESH_Actor::eLength;
+           break;
+         case 6018:
+           aTitle = QObject::tr( "LENGTH2D_EDGES" );
+           aControl = SMESH_Actor::eLength2D;
            break;
          case 6002:
            aTitle = QObject::tr( "FREE_EDGES" );
            break;
          case 6002:
            aTitle = QObject::tr( "FREE_EDGES" );
@@ -518,6 +585,10 @@ namespace{
            aTitle = QObject::tr( "MULTI_BORDERS" );
            aControl = SMESH_Actor::eMultiConnection;
            break;
            aTitle = QObject::tr( "MULTI_BORDERS" );
            aControl = SMESH_Actor::eMultiConnection;
            break;
+         case 6019:
+           aTitle = QObject::tr( "MULTI2D_BORDERS" );
+           aControl = SMESH_Actor::eMultiConnection2D;
+           break;
          case 6011:
            aTitle = QObject::tr( "AREA_ELEMENTS" );
            aControl = SMESH_Actor::eArea;
          case 6011:
            aTitle = QObject::tr( "AREA_ELEMENTS" );
            aControl = SMESH_Actor::eArea;
@@ -530,6 +601,10 @@ namespace{
            aTitle = QObject::tr( "ASPECTRATIO_ELEMENTS" );
            aControl = SMESH_Actor::eAspectRatio;
            break;
            aTitle = QObject::tr( "ASPECTRATIO_ELEMENTS" );
            aControl = SMESH_Actor::eAspectRatio;
            break;
+         case 6017:
+           aTitle = QObject::tr( "ASPECTRATIO_3D_ELEMENTS" );
+           aControl = SMESH_Actor::eAspectRatio3D;
+           break;
          case 6014:
            aTitle = QObject::tr( "MINIMUMANGLE_ELEMENTS" );
            aControl = SMESH_Actor::eMinimumAngle;
          case 6014:
            aTitle = QObject::tr( "MINIMUMANGLE_ELEMENTS" );
            aControl = SMESH_Actor::eMinimumAngle;
@@ -1029,14 +1104,22 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 1134: // Clipping
   case 1133: // Tranparency
   case 1132: // Colors / Size
   case 1134: // Clipping
   case 1133: // Tranparency
   case 1132: // Colors / Size
-  case 215:
-  case 213:
-  case 212:
-  case 211:
-    {
-      ::SetViewMode(theCommandID);
-      break;
-    }
+
+    // Display Mode
+  case 215: // Nodes
+  case 213: // Nodes
+  case 212: // Nodes
+  case 211: // Nodes
+    ::SetDisplayMode(theCommandID);
+  break;
+
+    // Display Entity
+  case 217: // Edges
+  case 218: // Faces
+  case 219: // Volumes
+  case 220: // All Entity
+    ::SetDisplayEntity(theCommandID);
+  break;
 
   case 214:                                    // UPDATE
     {
 
   case 214:                                    // UPDATE
     {
@@ -1076,7 +1159,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_NodesDlg *aDlg = new SMESHGUI_NodesDlg(parent, "", Sel);
+       new SMESHGUI_NodesDlg(parent, "", Sel);
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@@ -1092,7 +1175,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
     {
       EmitSignalDeactivateDialog();
     if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
     {
       EmitSignalDeactivateDialog();
-      SMESHGUI_FilterDlg *aDlg = new SMESHGUI_FilterDlg( parent, SMESH::EDGE );
+      new SMESHGUI_FilterDlg( parent, SMESH::EDGE );
     }
     break;
   }
     }
     break;
   }
@@ -1108,7 +1191,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       
       if(checkLock(aStudy)) break;
       SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
       
       if(checkLock(aStudy)) break;
       SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-      SMESHGUI_MoveNodesDlg *aDlg = new SMESHGUI_MoveNodesDlg( parent, Sel );
+      new SMESHGUI_MoveNodesDlg( parent, Sel );
       break;
     }
     
       break;
     }
     
@@ -1216,7 +1299,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_AddSubMeshDlg *aDlg = new SMESHGUI_AddSubMeshDlg(parent, "", Sel);
+       new SMESHGUI_AddSubMeshDlg(parent, "", Sel);
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@@ -1231,7 +1314,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      SMESHGUI_InitMeshDlg *aDlg = new SMESHGUI_InitMeshDlg(parent, "", Sel);
+      new SMESHGUI_InitMeshDlg(parent, "", Sel);
       break;
     }
 
       break;
     }
 
@@ -1240,7 +1323,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
+      new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
       break;
     }
 
       break;
     }
 
@@ -1249,7 +1332,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
+      new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
       break;
     }
 
       break;
     }
 
@@ -1258,7 +1341,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-      SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
+      new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
       break;
     }
 
       break;
     }
 
@@ -1331,7 +1414,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_SmoothingDlg *aDlg = new SMESHGUI_SmoothingDlg(parent, "", Sel);
+       new SMESHGUI_SmoothingDlg(parent, "", Sel);
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@@ -1346,7 +1429,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_ExtrusionDlg *aDlg = new SMESHGUI_ExtrusionDlg(parent, "", Sel);
+       new SMESHGUI_ExtrusionDlg(parent, "", Sel);
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@@ -1361,7 +1444,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_RevolutionDlg *aDlg = new SMESHGUI_RevolutionDlg(parent, "", Sel);
+       new SMESHGUI_RevolutionDlg(parent, "", Sel);
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@@ -1388,6 +1471,21 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       }
       break;
     }
       }
       break;
     }
+  case 416: // Extrusion along a path
+    {
+      if(checkLock(aStudy)) break;
+      if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+       EmitSignalDeactivateDialog();
+       SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+       new SMESHGUI_ExtrusionAlongPathDlg(parent, Sel);
+      }
+      else {
+       QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+                             tr("SMESH_BUT_OK"));
+      }
+      break;
+    }
   case 801:                                     // CREATE GROUP
     {
       if(checkLock(aStudy)) break;
   case 801:                                     // CREATE GROUP
     {
       if(checkLock(aStudy)) break;
@@ -1544,7 +1642,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
         for ( ; It.More(); It.Next() ) {
           Sel->ClearIObjects();
           Sel->AddIObject( It.Value() );
         for ( ; It.More(); It.Next() ) {
           Sel->ClearIObjects();
           Sel->AddIObject( It.Value() );
-          SMESHGUI_MeshInfosDlg *aDlg = new SMESHGUI_MeshInfosDlg(parent, "", false);
+          new SMESHGUI_MeshInfosDlg(parent, "", false);
         }
         // restore selection
         Sel->ClearIObjects();
         }
         // restore selection
         Sel->ClearIObjects();
@@ -1552,7 +1650,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
           Sel->AddIObject( It.Value() );
       }
       else
           Sel->AddIObject( It.Value() );
       }
       else
-        SMESHGUI_MeshInfosDlg *aDlg = new SMESHGUI_MeshInfosDlg(parent, "", false);
+        new SMESHGUI_MeshInfosDlg(parent, "", false);
       break;
     }
 
       break;
     }
 
@@ -1567,7 +1665,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
         for ( ; It.More(); It.Next() ) {
           Sel->ClearIObjects();
           Sel->AddIObject( It.Value() );
         for ( ; It.More(); It.Next() ) {
           Sel->ClearIObjects();
           Sel->AddIObject( It.Value() );
-          SMESHGUI_StandardMeshInfosDlg *aDlg = new SMESHGUI_StandardMeshInfosDlg(parent, "", false);
+          new SMESHGUI_StandardMeshInfosDlg(parent, "", false);
         }
         // restore selection
         Sel->ClearIObjects();
         }
         // restore selection
         Sel->ClearIObjects();
@@ -1575,7 +1673,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
           Sel->AddIObject( It.Value() );
       }
       else
           Sel->AddIObject( It.Value() );
       }
       else
-        SMESHGUI_StandardMeshInfosDlg *aDlg = new SMESHGUI_StandardMeshInfosDlg(parent, "", false);
+        new SMESHGUI_StandardMeshInfosDlg(parent, "", false);
       break;
     } 
     
       break;
     } 
     
@@ -1605,12 +1703,23 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       break;
     }
 
       break;
     }
 
-  case 1007:
+  case 10070:
     {
       ( new SMESHGUI_PrecisionDlg( parent ) )->exec();
       break;
     }
 
     {
       ( new SMESHGUI_PrecisionDlg( parent ) )->exec();
       break;
     }
 
+  case 10071:
+    {
+      parent->menuBar()->setItemChecked(10071, !parent->menuBar()->isItemChecked(10071));
+      if (parent->menuBar()->isItemChecked(10071)) {
+       QAD_CONFIG->addSetting("SMESH:DispayEntity","true");
+      }
+      else {
+       QAD_CONFIG->addSetting("SMESH:DispayEntity","false");
+      }
+      break;
+    }
   case 1006: 
     {
       SMESHGUI_Preferences_SelectionDlg* aDlg = 
   case 1006: 
     {
       SMESHGUI_Preferences_SelectionDlg* aDlg = 
@@ -1825,8 +1934,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
           type = SMDSAbs_Volume; nbNodes = 8; break;
         default:;
         }
           type = SMDSAbs_Volume; nbNodes = 8; break;
         default:;
         }
-       SMESHGUI_AddMeshElementDlg *aDlg =
-          new SMESHGUI_AddMeshElementDlg(parent, "", Sel, type, nbNodes);
+       new SMESHGUI_AddMeshElementDlg(parent, "", Sel, type, nbNodes);
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@@ -1842,7 +1950,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_RemoveNodesDlg *aDlg = new SMESHGUI_RemoveNodesDlg(parent, "", Sel);
+       new SMESHGUI_RemoveNodesDlg(parent, "", Sel);
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@@ -1857,7 +1965,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_RemoveElementsDlg *aDlg = new SMESHGUI_RemoveElementsDlg(parent, "", Sel);
+       new SMESHGUI_RemoveElementsDlg(parent, "", Sel);
       }
       else
        {
       }
       else
        {
@@ -1873,7 +1981,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_RenumberingDlg *aDlg = new SMESHGUI_RenumberingDlg(parent, "", Sel, 0);
+       new SMESHGUI_RenumberingDlg(parent, "", Sel, 0);
       }
       else
        {
       }
       else
        {
@@ -1889,7 +1997,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_RenumberingDlg *aDlg = new SMESHGUI_RenumberingDlg(parent, "", Sel, 1);
+       new SMESHGUI_RenumberingDlg(parent, "", Sel, 1);
       }
       else
        {
       }
       else
        {
@@ -1905,7 +2013,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_TranslationDlg *aDlg = new SMESHGUI_TranslationDlg(parent, "", Sel);
+       new SMESHGUI_TranslationDlg(parent, "", Sel);
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@@ -1920,7 +2028,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_RotationDlg *aDlg = new SMESHGUI_RotationDlg(parent, "", Sel);
+       new SMESHGUI_RotationDlg(parent, "", Sel);
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@@ -1935,7 +2043,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_SymmetryDlg *aDlg = new SMESHGUI_SymmetryDlg(parent, "", Sel);
+       new SMESHGUI_SymmetryDlg(parent, "", Sel);
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@@ -1950,7 +2058,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_SewingDlg *aDlg = new SMESHGUI_SewingDlg(parent, "", Sel);
+       new SMESHGUI_SewingDlg(parent, "", Sel);
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@@ -1965,7 +2073,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
        EmitSignalDeactivateDialog();
        SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
-       SMESHGUI_MergeNodesDlg *aDlg = new SMESHGUI_MergeNodesDlg(parent, "", Sel);
+       new SMESHGUI_MergeNodesDlg(parent, "", Sel);
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
       }
       else {
        QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@@ -1980,16 +2088,14 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
     {
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
     {
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
-      SMESHGUI_CreateHypothesesDlg *aDlg =
-        new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, false);
+      new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, false);
       break;
     }
   case 5010: // ALGO
     {
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
       break;
     }
   case 5010: // ALGO
     {
       if(checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
-      SMESHGUI_CreateHypothesesDlg *aDlg =
-        new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, true);
+      new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, true);
       break;
     }
 
       break;
     }
 
@@ -2007,13 +2113,16 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   }
   break;
 
   }
   break;
 
-  case 6016:                                   // CONTROLS 
+  case 6017:                                   // CONTROLS 
+  case 6016:
   case 6015:
   case 6014:
   case 6013:
   case 6012:
   case 6011:
   case 6001:
   case 6015:
   case 6014:
   case 6013:
   case 6012:
   case 6011:
   case 6001:
+  case 6018:
+  case 6019:
   case 6002:
   case 6003:
   case 6004:    
   case 6002:
   case 6003:
   case 6004:    
@@ -2198,6 +2307,12 @@ bool SMESHGUI::SetSettings(QAD_Desktop * parent)
     myAutomaticUpdate = false;
   }
 
     myAutomaticUpdate = false;
   }
 
+  QString anIsDisplayEntity = QAD_CONFIG->getSetting("SMESH:DispayEntity");
+  if(anIsDisplayEntity.compare("true") == 0)
+    parent->menuBar()->setItemChecked(10071,true);
+  else
+    parent->menuBar()->setItemChecked(10071,false);
+
   /* Selection */
   SMESH::UpdateSelectionProp();
 
   /* Selection */
   SMESH::UpdateSelectionProp();
 
@@ -2316,29 +2431,30 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
         if ( !aGeomGroup->_is_nil()  ) // group linked on geometry
          popup->removeItem( 803 ); // EDIT GROUP
           
         if ( !aGeomGroup->_is_nil()  ) // group linked on geometry
          popup->removeItem( 803 ); // EDIT GROUP
           
-       SMESH_Actor* ac = SMESH::FindActorByEntry(IObject->getEntry());
+       SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
        // if object has actor
        // if object has actor
-       if ( ac && studyFrame->getTypeView() == VIEW_VTK ) {
+       if ( anActor && studyFrame->getTypeView() == VIEW_VTK ) {
          VTKViewer_RenderWindowInteractor* myRenderInter = SMESH::GetCurrentVtkView()->getRWInteractor();
          if ( myRenderInter->isVisible( IObject ) ) {
            popup->removeItem( QAD_Display_Popup_ID );
          VTKViewer_RenderWindowInteractor* myRenderInter = SMESH::GetCurrentVtkView()->getRWInteractor();
          if ( myRenderInter->isVisible( IObject ) ) {
            popup->removeItem( QAD_Display_Popup_ID );
-           popup->setItemChecked( 9010, ac->GetPointsLabeled() ); // Numbering / Display Nodes #
-           popup->setItemChecked( 9011, ac->GetCellsLabeled() );  // Numbering / Display Elements #
-           TVisualObjPtr aVisualObj = ac->GetObject();
-           int aNbEdges = aVisualObj->GetNbEntities(SMESH::EDGE);
-           int aNbFaces = aVisualObj->GetNbEntities(SMESH::FACE);
-           int aNbVolumes = aVisualObj->GetNbEntities(SMESH::VOLUME);
+           popup->setItemChecked( 9010, anActor->GetPointsLabeled() ); // Numbering / Display Nodes #
+           popup->setItemChecked( 9011, anActor->GetCellsLabeled() );  // Numbering / Display Elements #
+           TVisualObjPtr aVisualObj = anActor->GetObject();
+           int aNbEdges = aVisualObj->GetNbEntities(SMDSAbs_Edge);
+           int aNbFaces = aVisualObj->GetNbEntities(SMDSAbs_Face);
+           int aNbVolumes = aVisualObj->GetNbEntities(SMDSAbs_Volume);
+
            QMenuItem* mi = popup->findItem( 1131 );
            if ( mi && mi->popup() ) {
            QMenuItem* mi = popup->findItem( 1131 );
            if ( mi && mi->popup() ) {
-             int  prType = ac->GetRepresentation();
+             int  prType = anActor->GetRepresentation();
              // Display Mode / Wireframe
              // Display Mode / Wireframe
-             if(!aNbFaces && !aNbVolumes && !aNbEdges){
+             if(aNbVolumes == 0 && aNbFaces == 0 && aNbEdges == 0){
                mi->popup()->removeItem( 211 );
              }else{
                mi->popup()->setItemChecked( 211, prType == SMESH_Actor::eEdge );
              }
              // Display Mode / Shading
                mi->popup()->removeItem( 211 );
              }else{
                mi->popup()->setItemChecked( 211, prType == SMESH_Actor::eEdge );
              }
              // Display Mode / Shading
-             if(!aNbFaces && !aNbVolumes){
+             if(aNbFaces == 0 && aNbVolumes == 0){
                mi->popup()->removeItem( 212 );
              }else{
                mi->popup()->setItemChecked( 212, prType == SMESH_Actor::eSurface );
                mi->popup()->removeItem( 212 );
              }else{
                mi->popup()->setItemChecked( 212, prType == SMESH_Actor::eSurface );
@@ -2346,18 +2462,62 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
              // Display Mode / Points
              mi->popup()->setItemChecked( 215, prType == SMESH_Actor::ePoint );  
              // Display Mode / Shrink
              // Display Mode / Points
              mi->popup()->setItemChecked( 215, prType == SMESH_Actor::ePoint );  
              // Display Mode / Shrink
-             bool isShrunk = ac->IsShrunk();
-             bool isShrunkable = ac->IsShrunkable();
+             bool isShrunk = anActor->IsShrunk();
+             bool isShrunkable = anActor->IsShrunkable();
              mi->popup()->setItemChecked( 213, isShrunk );   
              mi->popup()->setItemEnabled( 213, prType != SMESH_Actor::ePoint && isShrunkable);
            }
              mi->popup()->setItemChecked( 213, isShrunk );   
              mi->popup()->setItemEnabled( 213, prType != SMESH_Actor::ePoint && isShrunkable);
            }
-           // Scalar Bar
+
+           // Display Entity
+           mi = popup->findItem( 1135 );
+           int aIsSomething=0;
+           if (aNbVolumes>0) aIsSomething++;
+           if (aNbFaces>0) aIsSomething++;
+           if (aNbEdges>0) aIsSomething++;
+           if ( mi && (aIsSomething <= 1)){
+             popup->removeItem(1135);
+           }else if ( mi && mi->popup() ) {
+             QPopupMenu* aPopup = mi->popup();
+             unsigned int aMode = anActor->GetEntityMode();
+             
+             bool aIsVolumesMode = aMode & SMESH_Actor::eVolumes;
+             bool aIsFacesMode   = aMode & SMESH_Actor::eFaces;
+             bool aIsEdgesMode   = aMode & SMESH_Actor::eEdges;
+             
+             if(aNbVolumes == 0)
+               aPopup->removeItem( 219 );
+             else
+               aPopup->setItemChecked( 219, aIsVolumesMode );
+
+             if(aNbFaces == 0)
+               aPopup->removeItem( 218 );
+             else
+               aPopup->setItemChecked( 218, aIsFacesMode );
+
+
+             if(aNbEdges == 0)
+               aPopup->removeItem( 217 );
+             else
+               aPopup->setItemChecked( 217, aIsEdgesMode );
+
+
+             bool aIsRemove = (aNbVolumes == 0 || aIsVolumesMode);
+             aIsRemove &= (aNbFaces == 0 || aIsFacesMode);
+             aIsRemove &= (aNbEdges == 0 || aIsEdgesMode);
+
+             if(aIsRemove)
+               aPopup->removeItem( 220 );
+           }
+
+           // Controls
            mi = popup->findItem( 2000 );
            if ( mi && mi->popup() ) {
            mi = popup->findItem( 2000 );
            if ( mi && mi->popup() ) {
-             SMESH_Actor::eControl cMode = ac->GetControlMode();
+             SMESH_Actor::eControl cMode = anActor->GetControlMode();
              switch ( cMode ) {
              switch ( cMode ) {
-             case SMESH_Actor::eLengthEdges:
+             case SMESH_Actor::eLength:
                mi->popup()->setItemChecked( 6001, true ); break;
                mi->popup()->setItemChecked( 6001, true ); break;
+             case SMESH_Actor::eLength2D:
+               mi->popup()->setItemChecked( 6018, true ); break;
              case SMESH_Actor::eFreeEdges:
                mi->popup()->setItemChecked( 6002, true );
                mi->popup()->removeItem( 201 );
              case SMESH_Actor::eFreeEdges:
                mi->popup()->setItemChecked( 6002, true );
                mi->popup()->removeItem( 201 );
@@ -2368,12 +2528,16 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
                break;
              case SMESH_Actor::eMultiConnection:
                mi->popup()->setItemChecked( 6004, true ); break;
                break;
              case SMESH_Actor::eMultiConnection:
                mi->popup()->setItemChecked( 6004, true ); break;
+             case SMESH_Actor::eMultiConnection2D:
+               mi->popup()->setItemChecked( 6019, true ); break;
              case SMESH_Actor::eArea:
                mi->popup()->setItemChecked( 6011, true ); break;
              case SMESH_Actor::eTaper:
                mi->popup()->setItemChecked( 6012, true ); break;
              case SMESH_Actor::eAspectRatio:
                mi->popup()->setItemChecked( 6013, true ); break;
              case SMESH_Actor::eArea:
                mi->popup()->setItemChecked( 6011, true ); break;
              case SMESH_Actor::eTaper:
                mi->popup()->setItemChecked( 6012, true ); break;
              case SMESH_Actor::eAspectRatio:
                mi->popup()->setItemChecked( 6013, true ); break;
+             case SMESH_Actor::eAspectRatio3D:
+               mi->popup()->setItemChecked( 6017, true ); break;
              case SMESH_Actor::eMinimumAngle:
                mi->popup()->setItemChecked( 6014, true ); break;
              case SMESH_Actor::eWarping:
              case SMESH_Actor::eMinimumAngle:
                mi->popup()->setItemChecked( 6014, true ); break;
              case SMESH_Actor::eWarping:
@@ -2386,13 +2550,14 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
                mi->popup()->removeItem( 201 );
                break;
              }
                mi->popup()->removeItem( 201 );
                break;
              }
-             TVisualObjPtr aVisualObj = ac->GetObject();
-             if(!aNbEdges){
+             TVisualObjPtr aVisualObj = anActor->GetObject();
+             if(aNbEdges == 0){
                mi->popup()->removeItem( 6001 );
                mi->popup()->removeItem( 6003 );
                mi->popup()->removeItem( 6004 );
              }
                mi->popup()->removeItem( 6001 );
                mi->popup()->removeItem( 6003 );
                mi->popup()->removeItem( 6004 );
              }
-             if(!aNbFaces){
+             if(aNbFaces == 0){
+               mi->popup()->removeItem( 6018 );
                mi->popup()->removeItem( 6002 );
                mi->popup()->removeItem( 6011 );
                mi->popup()->removeItem( 6012 );
                mi->popup()->removeItem( 6002 );
                mi->popup()->removeItem( 6011 );
                mi->popup()->removeItem( 6012 );
@@ -2400,8 +2565,12 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
                mi->popup()->removeItem( 6014 );
                mi->popup()->removeItem( 6015 );
                mi->popup()->removeItem( 6016 );
                mi->popup()->removeItem( 6014 );
                mi->popup()->removeItem( 6015 );
                mi->popup()->removeItem( 6016 );
+               mi->popup()->removeItem( 6019 );
+             }
+             if(aNbVolumes == 0){
+               mi->popup()->removeItem( 6017 );
              }
              }
-             if(!aNbFaces && !aNbEdges)
+             if(aNbFaces == 0 && aNbEdges == 0 && aNbVolumes == 0)
                popup->removeItem( 2000 );                         // Scalar Bar
            }
          }
                popup->removeItem( 2000 );                         // Scalar Bar
            }
          }
index d98228dde97b9bb7bbc93a283cf3b76406fa4808..567d567f347acadad7fd1f2d3264df1b49d81106 100644 (file)
 #include "SALOME_InteractiveObject.hxx"
 #include "SMESH_ActorUtils.h"
 
 #include "SALOME_InteractiveObject.hxx"
 #include "SMESH_ActorUtils.h"
 
+#include "VTKViewer_ViewFrame.h"
+#include "VTKViewer_RenderWindow.h"
+
+#include <vtkRenderer.h>
+
 using namespace std;
 
 
 using namespace std;
 
 
@@ -151,8 +156,6 @@ protected:
     myActor->SetInfinitive(true);
     myActor->SetMapper( myMapper );
 
     myActor->SetInfinitive(true);
     myActor->SetMapper( myMapper );
 
-    static float anOpacity = 0.75;
-
     vtkProperty* aProp = vtkProperty::New();
     float anRGB[3];
     anRGB[0] = SMESH::GetFloat("SMESH:SettingsFillColorRed", 0)/255.;
     vtkProperty* aProp = vtkProperty::New();
     float anRGB[3];
     anRGB[0] = SMESH::GetFloat("SMESH:SettingsFillColorRed", 0)/255.;
@@ -375,9 +378,8 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( QWidget* parent,
 SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg()
 {
   // no need to delete child widgets, Qt does it all for us
 SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg()
 {
   // no need to delete child widgets, Qt does it all for us
-  //cout<<"SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg\n";
   std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
   std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
-  SMESH::GetCurrentVtkView()->Repaint();
+  SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
 }
 
 
 }
 
 
@@ -406,10 +408,8 @@ void SMESHGUI_ClippingDlg::ClickOnApply()
       aCollection->AddItem(anOrientedPlane);
       anOrientedPlane->Delete();
     }
       aCollection->AddItem(anOrientedPlane);
       anOrientedPlane->Delete();
     }
-    
-    myActor->SetVisibility(myActor->GetVisibility());
-    
-    SMESH::GetCurrentVtkView()->Repaint();
+
+    SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
   }
 }
 
   }
 }
 
@@ -466,7 +466,7 @@ void SMESHGUI_ClippingDlg::onSelectionChanged()
     }
   }
   Sinchronize();
     }
   }
   Sinchronize();
-  SMESH::GetCurrentVtkView()->Repaint();
+  SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
 }
 
 
 }
 
 
@@ -484,8 +484,7 @@ void SMESHGUI_ClippingDlg::onSelectPlane(int theIndex)
   // Orientation
   SMESH::Orientation anOrientation = aPlane->GetOrientation();
   
   // Orientation
   SMESH::Orientation anOrientation = aPlane->GetOrientation();
   
-  // Distance and Rotations
-  float aDistance;
+  // Rotations
   double aRot[2] = {aPlane->myAngle[0], aPlane->myAngle[1]};
 
   // Set plane parameters in the dialog
   double aRot[2] = {aPlane->myAngle[0], aPlane->myAngle[1]};
 
   // Set plane parameters in the dialog
@@ -550,7 +549,7 @@ void SMESHGUI_ClippingDlg::ClickOnDelete()
     ClickOnApply();
 
   Sinchronize();
     ClickOnApply();
 
   Sinchronize();
-  SMESH::GetCurrentVtkView()->Repaint();
+  SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
 }
 
 
 }
 
 
@@ -702,7 +701,6 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam()
   
   myActor->SetPlaneParam(aNormal, getDistance(), aPlane);
 
   
   myActor->SetPlaneParam(aNormal, getDistance(), aPlane);
 
-  float* anOrig = aPlane->GetOrigin();
   vtkDataSet* aDataSet = myActor->GetInput();
   float *aPnt = aDataSet->GetCenter();
 
   vtkDataSet* aDataSet = myActor->GetInput();
   float *aPnt = aDataSet->GetCenter();
 
@@ -746,11 +744,11 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam()
   if(AutoApplyCheckBox->isChecked())
     ClickOnApply();
   
   if(AutoApplyCheckBox->isChecked())
     ClickOnApply();
   
-  SMESH::GetCurrentVtkView()->Repaint();
+  SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
 }
 
 
 void SMESHGUI_ClippingDlg::OnPreviewToggle(bool theIsToggled){
   std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(theIsToggled));
 }
 
 
 void SMESHGUI_ClippingDlg::OnPreviewToggle(bool theIsToggled){
   std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(theIsToggled));
-  SMESH::GetCurrentVtkView()->Repaint();
+  SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
 }
 }
diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx
new file mode 100644 (file)
index 0000000..d99f0ad
--- /dev/null
@@ -0,0 +1,1127 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESHGUI_ExtrusionAlongPathDlg.cxx
+//  Author : Vadim SANDLER
+//  Module : SMESH
+//  $Header: 
+
+#include "SMESHGUI_ExtrusionAlongPathDlg.h"
+#include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESH_Actor.h"
+#include "SMESH_NumberFilter.hxx"
+#include "SMDS_Mesh.hxx"
+#include "GEOM_ShapeTypeFilter.hxx"
+#include "GEOMBase.h"
+
+#include "QAD_Application.h"
+#include "QAD_WaitCursor.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+#include "utilities.h"
+
+#include <BRep_Tool.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <gp_Pnt.hxx>
+
+// QT Includes
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qtoolbutton.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qlistbox.h>
+#include <qlayout.h>
+#include <qvalidator.h>
+#include <qptrlist.h>
+
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
+using namespace std;
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg()
+// purpose  : constructor
+//=================================================================================
+SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( QWidget* parent, SALOME_Selection* Sel, bool modal )
+     : QDialog( parent, "SMESHGUI_ExtrusionAlongPathDlg", modal, 
+               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose )
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg");
+  myType = -1;
+  QPixmap edgeImage  ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_DLG_EDGE" ) ) );
+  QPixmap faceImage  ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_DLG_TRIANGLE" ) ) );
+  QPixmap selectImage( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
+  QPixmap addImage   ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_APPEND" ) ) );
+  QPixmap removeImage( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_REMOVE" ) ) );
+
+  setCaption( tr( "EXTRUSION_ALONG_PATH" ) );
+  setSizeGripEnabled( TRUE );
+
+  QGridLayout* topLayout = new QGridLayout( this ); 
+  topLayout->setSpacing( 6 ); topLayout->setMargin( 11 );
+
+  /***************************************************************/
+  // Elements type group box (1d / 2d elements)
+  ElementsTypeGrp = new QButtonGroup( tr( "SMESH_EXTRUSION" ), this );
+  ElementsTypeGrp->setColumnLayout( 0, Qt::Vertical );
+  ElementsTypeGrp->layout()->setSpacing( 0 );  ElementsTypeGrp->layout()->setMargin( 0 );
+  QGridLayout* ElementsTypeGrpLayout = new QGridLayout( ElementsTypeGrp->layout() );
+  ElementsTypeGrpLayout->setAlignment( Qt::AlignTop );
+  ElementsTypeGrpLayout->setSpacing( 6 ); ElementsTypeGrpLayout->setMargin( 11 );
+
+  Elements1dRB = new QRadioButton( ElementsTypeGrp );
+  Elements1dRB->setPixmap( edgeImage );
+  Elements2dRB = new QRadioButton( ElementsTypeGrp );
+  Elements2dRB->setPixmap( faceImage );
+  Elements1dRB->setChecked( true );
+
+  // layouting
+  ElementsTypeGrpLayout->addWidget( Elements1dRB, 0, 0 );
+  ElementsTypeGrpLayout->addWidget( Elements2dRB, 0, 2 );
+  
+  /***************************************************************/
+  // Arguments group box
+  ArgumentsGrp = new QGroupBox( tr( "EXTRUSION_1D" ), this );
+  ArgumentsGrp->setColumnLayout( 0, Qt::Vertical );
+  ArgumentsGrp->layout()->setSpacing( 0 ); ArgumentsGrp->layout()->setMargin( 0 );
+  QGridLayout* ArgumentsGrpLayout = new QGridLayout( ArgumentsGrp->layout() );
+  ArgumentsGrpLayout->setAlignment( Qt::AlignTop );
+  ArgumentsGrpLayout->setSpacing( 6 ); ArgumentsGrpLayout->setMargin( 11 );
+
+  // Controls for elements selection
+  ElementsLab = new QLabel( tr( "SMESH_ID_ELEMENTS" ), ArgumentsGrp );
+
+  SelectElementsButton = new QToolButton( ArgumentsGrp );
+  SelectElementsButton->setPixmap( selectImage );
+
+  ElementsLineEdit = new QLineEdit( ArgumentsGrp );
+  ElementsLineEdit->setValidator( new SMESHGUI_IdValidator( this ) );
+
+  // Controls for the whole mesh selection
+  MeshCheck = new QCheckBox( tr( "SMESH_SELECT_WHOLE_MESH" ), ArgumentsGrp );
+
+  // Controls for path selection
+  PathGrp = new QGroupBox( tr( "SMESH_PATH" ), ArgumentsGrp );
+  PathGrp->setColumnLayout( 0, Qt::Vertical );
+  PathGrp->layout()->setSpacing( 0 ); PathGrp->layout()->setMargin( 0 );
+  QGridLayout* PathGrpLayout = new QGridLayout( PathGrp->layout() );
+  PathGrpLayout->setAlignment( Qt::AlignTop );
+  PathGrpLayout->setSpacing( 6 ); PathGrpLayout->setMargin( 11 );
+  
+  // Controls for path mesh selection
+  PathMeshLab = new QLabel( tr( "SMESH_PATH_MESH" ), PathGrp );
+
+  SelectPathMeshButton = new QToolButton( PathGrp );
+  SelectPathMeshButton->setPixmap( selectImage );
+
+  PathMeshLineEdit = new QLineEdit( PathGrp );
+  PathMeshLineEdit->setReadOnly( true );
+
+  // Controls for path shape selection
+  PathShapeLab = new QLabel( tr( "SMESH_PATH_SHAPE" ), PathGrp );
+
+  SelectPathShapeButton = new QToolButton( PathGrp );
+  SelectPathShapeButton->setPixmap( selectImage );
+
+  PathShapeLineEdit = new QLineEdit( PathGrp );
+  PathShapeLineEdit->setReadOnly( true );
+
+  // Controls for path starting point selection
+  StartPointLab = new QLabel( tr( "SMESH_PATH_START" ), PathGrp );
+
+  SelectStartPointButton = new QToolButton( PathGrp );
+  SelectStartPointButton->setPixmap( selectImage );
+
+  StartPointLineEdit = new QLineEdit( PathGrp );
+  StartPointLineEdit->setValidator( new QIntValidator( this ) );
+
+  // layouting
+  PathGrpLayout->addWidget( PathMeshLab,            0, 0 );
+  PathGrpLayout->addWidget( SelectPathMeshButton,   0, 1 );
+  PathGrpLayout->addWidget( PathMeshLineEdit,       0, 2 );
+  PathGrpLayout->addWidget( PathShapeLab,           1, 0 );
+  PathGrpLayout->addWidget( SelectPathShapeButton,  1, 1 );
+  PathGrpLayout->addWidget( PathShapeLineEdit,      1, 2 );
+  PathGrpLayout->addWidget( StartPointLab,          2, 0 );
+  PathGrpLayout->addWidget( SelectStartPointButton, 2, 1 );
+  PathGrpLayout->addWidget( StartPointLineEdit,     2, 2 );
+
+  // Controls for angles defining
+  AnglesCheck = new QCheckBox( tr( "SMESH_USE_ANGLES" ), ArgumentsGrp );
+  
+  AnglesGrp = new QGroupBox( tr( "SMESH_ANGLES" ), ArgumentsGrp );
+  AnglesGrp->setColumnLayout( 0, Qt::Vertical );
+  AnglesGrp->layout()->setSpacing( 0 ); AnglesGrp->layout()->setMargin( 0 );
+  QGridLayout* AnglesGrpLayout = new QGridLayout( AnglesGrp->layout() );
+  AnglesGrpLayout->setAlignment( Qt::AlignTop );
+  AnglesGrpLayout->setSpacing( 6 ); AnglesGrpLayout->setMargin( 11 );
+  
+  AnglesList = new QListBox( AnglesGrp );
+  AnglesList->setSelectionMode( QListBox::Extended );
+
+  AddAngleButton = new QToolButton( AnglesGrp ); 
+  AddAngleButton->setPixmap( addImage );
+
+  RemoveAngleButton = new QToolButton( AnglesGrp ); 
+  RemoveAngleButton->setPixmap( removeImage );
+
+  AngleSpin = new SMESHGUI_SpinBox( AnglesGrp );
+
+  // layouting
+  QVBoxLayout* bLayout = new QVBoxLayout(); 
+  bLayout->addWidget( AddAngleButton );
+  bLayout->addSpacing( 6 );
+  bLayout->addWidget( RemoveAngleButton );
+  bLayout->addStretch();
+  AnglesGrpLayout->addMultiCellWidget( AnglesList, 0, 1, 0, 0 );
+  AnglesGrpLayout->addMultiCellLayout( bLayout,    0, 1, 1, 1 );
+  AnglesGrpLayout->addWidget(          AngleSpin,  0,    2    );
+  AnglesGrpLayout->setRowStretch( 1, 10 );
+  
+  // Controls for base point defining
+  BasePointCheck = new QCheckBox( tr( "SMESH_USE_BASE_POINT" ), ArgumentsGrp );
+
+  BasePointGrp = new QGroupBox( tr( "SMESH_BASE_POINT" ), ArgumentsGrp );
+  BasePointGrp->setColumnLayout( 0, Qt::Vertical );
+  BasePointGrp->layout()->setSpacing( 0 ); BasePointGrp->layout()->setMargin( 0 );
+  QGridLayout* BasePointGrpLayout = new QGridLayout( BasePointGrp->layout() );
+  BasePointGrpLayout->setAlignment( Qt::AlignTop );
+  BasePointGrpLayout->setSpacing( 6 ); BasePointGrpLayout->setMargin( 11 );
+  
+  SelectBasePointButton = new QToolButton( BasePointGrp );
+  SelectBasePointButton->setPixmap( selectImage );
+
+  XLab  = new QLabel( tr( "SMESH_X" ), BasePointGrp );
+  XSpin = new SMESHGUI_SpinBox( BasePointGrp );
+  YLab  = new QLabel( tr( "SMESH_Y" ), BasePointGrp );
+  YSpin = new SMESHGUI_SpinBox( BasePointGrp );
+  ZLab  = new QLabel( tr( "SMESH_Z" ), BasePointGrp );
+  ZSpin = new SMESHGUI_SpinBox( BasePointGrp );
+
+  // layouting
+  BasePointGrpLayout->addWidget( SelectBasePointButton, 0, 0 );
+  BasePointGrpLayout->addWidget( XLab,                  0, 1 );
+  BasePointGrpLayout->addWidget( XSpin,                 0, 2 );
+  BasePointGrpLayout->addWidget( YLab,                  0, 3 );
+  BasePointGrpLayout->addWidget( YSpin,                 0, 4 );
+  BasePointGrpLayout->addWidget( ZLab,                  0, 5 );
+  BasePointGrpLayout->addWidget( ZSpin,                 0, 6 );
+
+  // layouting
+  ArgumentsGrpLayout->addWidget(          ElementsLab,            0,    0    );
+  ArgumentsGrpLayout->addWidget(          SelectElementsButton,   0,    1    );
+  ArgumentsGrpLayout->addWidget(          ElementsLineEdit,       0,    2    );
+  ArgumentsGrpLayout->addMultiCellWidget( MeshCheck,              1, 1, 0, 2 );
+  ArgumentsGrpLayout->addMultiCellWidget( PathGrp,                2, 2, 0, 2 );
+  ArgumentsGrpLayout->addWidget(          AnglesCheck,            3,    0    );
+  ArgumentsGrpLayout->addMultiCellWidget( AnglesGrp,              3, 4, 1, 2 );
+  ArgumentsGrpLayout->addWidget(          BasePointCheck,         5,    0    );
+  ArgumentsGrpLayout->addMultiCellWidget( BasePointGrp,           5, 6, 1, 2 );
+  ArgumentsGrpLayout->setRowStretch( 4, 10 );
+
+  /***************************************************************/
+  // common buttons group box
+  ButtonsGrp = new QGroupBox( this );
+  ButtonsGrp->setColumnLayout( 0, Qt::Vertical );
+  ButtonsGrp->layout()->setSpacing( 0 ); ButtonsGrp->layout()->setMargin( 0 );
+  QGridLayout* ButtonsGrpLayout = new QGridLayout( ButtonsGrp->layout() );
+  ButtonsGrpLayout->setAlignment( Qt::AlignTop );
+  ButtonsGrpLayout->setSpacing( 6 ); ButtonsGrpLayout->setMargin( 11 );
+
+  OkButton = new QPushButton( tr( "SMESH_BUT_OK" ), ButtonsGrp );
+  OkButton->setAutoDefault( true );
+  OkButton->setDefault( true );
+
+  ApplyButton = new QPushButton( tr( "SMESH_BUT_APPLY" ), ButtonsGrp );
+  ApplyButton->setAutoDefault( true );
+
+  CloseButton = new QPushButton( tr( "SMESH_BUT_CLOSE" ), ButtonsGrp );
+  CloseButton->setAutoDefault( true );
+
+  // layouting
+  ButtonsGrpLayout->addWidget( OkButton,    0, 0 );
+  ButtonsGrpLayout->addWidget( ApplyButton, 0, 1 );
+  ButtonsGrpLayout->addWidget( CloseButton, 0, 3 );
+  ButtonsGrpLayout->addColSpacing( 2, 10 );
+  ButtonsGrpLayout->setColStretch( 2, 10 );
+
+  /***************************************************************/
+  // layouting
+  topLayout->addWidget( ElementsTypeGrp, 0, 0 );
+  topLayout->addWidget( ArgumentsGrp,    1, 0 );
+  topLayout->addWidget( ButtonsGrp,      2, 0 );
+
+  /***************************************************************/
+  // Initialisations
+  XSpin->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+  YSpin->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+  ZSpin->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+  AngleSpin->RangeStepAndValidator( -999999.999, +999999.999, 5.0, 3 );
+  mySelection = Sel;  
+  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+  mySMESHGUI->SetActiveDialogBox( this ) ;
+  
+  // Costruction of the logical filter for the elements: mesh/sub-mesh/group
+  SMESH_ListOfFilter aListOfFilters;
+  Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
+  if ( !aMeshOrSubMeshFilter.IsNull() )
+    aListOfFilters.Append( aMeshOrSubMeshFilter );
+  Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
+  if ( !aSmeshGroupFilter.IsNull() )
+    aListOfFilters.Append( aSmeshGroupFilter );
+  
+  myElementsFilter = new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR );
+  
+  myPathMeshFilter = new SMESH_TypeFilter( MESH );
+  
+  Init();
+
+  /***************************************************************/
+  // signals-slots connections
+  connect( OkButton,     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+  connect( CloseButton,  SIGNAL( clicked() ), this, SLOT( reject() ) ) ;
+  connect( ApplyButton,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+
+  connect( AddAngleButton,    SIGNAL( clicked() ), this, SLOT( OnAngleAdded() ) );
+  connect( RemoveAngleButton, SIGNAL( clicked() ), this, SLOT( OnAngleRemoved() ) );
+
+  connect( ElementsTypeGrp, SIGNAL( clicked( int ) ), SLOT( TypeChanged( int ) ) );
+  
+  connect( SelectElementsButton,   SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+  connect( SelectPathMeshButton,   SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+  connect( SelectPathShapeButton,  SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+  connect( SelectStartPointButton, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+  connect( SelectBasePointButton,  SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+
+  connect( mySMESHGUI,  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+  connect( mySelection, SIGNAL( currentSelectionChanged() ),      this, SLOT( SelectionIntoArgument() ) );
+  connect( mySMESHGUI,  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( reject() ) ) ;
+
+  connect( ElementsLineEdit, SIGNAL( textChanged( const QString& ) ),
+          SLOT( onTextChange( const QString& ) ) );
+  connect( StartPointLineEdit, SIGNAL( textChanged( const QString& ) ),
+          SLOT( onTextChange( const QString& ) ) );
+
+  connect( MeshCheck,      SIGNAL( toggled( bool ) ), SLOT( onSelectMesh() ) );
+  connect( AnglesCheck,    SIGNAL( toggled( bool ) ), SLOT( onAnglesCheck() ) );
+  connect( BasePointCheck, SIGNAL( toggled( bool ) ), SLOT( onBasePointCheck() ) );
+
+  AnglesList->installEventFilter( this );
+  ElementsLineEdit->installEventFilter( this );
+  StartPointLineEdit->installEventFilter( this );
+  XSpin->editor()->installEventFilter( this );
+  YSpin->editor()->installEventFilter( this );
+  ZSpin->editor()->installEventFilter( this );
+
+  /***************************************************************/
+  // set position and show dialog box
+  int x, y ;
+  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+  this->move( x, y ) ;
+  this->show() ; // displays Dialog
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::~SMESHGUI_ExtrusionAlongPathDlg()
+// purpose  : destructor
+//=================================================================================
+SMESHGUI_ExtrusionAlongPathDlg::~SMESHGUI_ExtrusionAlongPathDlg()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::~SMESHGUI_ExtrusionAlongPathDlg");
+  // no need to delete child widgets, Qt does it all for us
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::eventFilter
+// purpose  : event filter
+//=================================================================================
+bool SMESHGUI_ExtrusionAlongPathDlg::eventFilter( QObject* object, QEvent* event )
+{
+  if ( event->type() == QEvent::KeyPress ) {
+    QKeyEvent* ke = ( QKeyEvent* )event;
+    if ( object == AnglesList ) {
+      if ( ke->key() == Key_Delete )
+       OnAngleRemoved();
+    }
+  }
+  else if ( event->type() == QEvent::FocusIn ) {
+    if ( object == ElementsLineEdit ) {
+      if ( myEditCurrentArgument != ElementsLineEdit )
+       SetEditCurrentArgument( SelectElementsButton );
+    }
+    else if ( object == StartPointLineEdit ) {
+      if ( myEditCurrentArgument != StartPointLineEdit )
+       SetEditCurrentArgument( SelectStartPointButton );
+    }
+    else if ( object == XSpin->editor() || object == YSpin->editor() || object == ZSpin->editor() ) {
+      if ( myEditCurrentArgument != XSpin )
+       SetEditCurrentArgument( SelectBasePointButton );
+    }
+  }
+  return QDialog::eventFilter( object, event );
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::Init()
+// purpose  : initialization
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::Init( bool ResetControls )
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::Init");
+  myBusy = false;
+  myEditCurrentArgument = 0;
+  myMesh      = SMESH::SMESH_Mesh::_nil();
+  myIDSource  = SMESH::SMESH_IDSource::_nil();
+  myMeshActor = 0;
+  myPathMesh  = SMESH::SMESH_Mesh::_nil();
+  myPathShape = GEOM::GEOM_Object::_nil();
+  
+  ElementsLineEdit->clear();
+  PathMeshLineEdit->clear();
+  PathShapeLineEdit->clear();
+  StartPointLineEdit->clear();
+
+  if( ResetControls ) {
+    XSpin->SetValue( 0.0 );
+    YSpin->SetValue( 0.0 );
+    ZSpin->SetValue( 0.0 );
+    
+    AngleSpin->SetValue( 45 );
+    MeshCheck->setChecked( false );
+    TypeChanged( 0 );
+    onSelectMesh();
+    onAnglesCheck();
+    onBasePointCheck();
+  }
+  SetEditCurrentArgument( 0 );
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::TypeChanged()
+// purpose  : Called when user changes type of elements ( 1d / 2d )
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::TypeChanged( int type )
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::TypeChanged");
+  if ( myType != type ) {
+    disconnect( mySelection, 0, this, 0 );
+    
+    if ( type == 0 )
+      ArgumentsGrp->setTitle( tr( "EXTRUSION_1D" ) );
+    else if ( type == 1 )
+      ArgumentsGrp->setTitle( tr( "EXTRUSION_2D" ) );
+    
+    // clear elements ID list
+    if ( !MeshCheck->isChecked() ) {
+      ElementsLineEdit->clear();
+    }
+    // set selection mode if necessary
+    if( myEditCurrentArgument == ElementsLineEdit ) {
+      mySelection->ClearIObjects();
+      mySelection->ClearFilters();
+      SMESH::SetPickable();
+  
+      SMESH::SetPointRepresentation( false );
+      if ( MeshCheck->isChecked() ) {
+       QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+       mySelection->AddFilter( myElementsFilter );
+      }
+      else  {
+       if ( type == 0 )
+         QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
+       if ( type == 1 )
+         QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
+      }
+    }
+    connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  }
+  myType = type;
+} 
+
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
+// purpose  : Called when user presses <Apply> button
+//=================================================================================
+bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply");
+  if ( mySMESHGUI->ActiveStudyLocked() ) {
+    return false;
+  }
+  
+  if( myMesh->_is_nil() || MeshCheck->isChecked() && myIDSource->_is_nil() || !myMeshActor || myPathMesh->_is_nil() || myPathShape->_is_nil() ) {
+    return false;
+  }
+
+  SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+  if ( MeshCheck->isChecked() ) {
+    // If "Select whole mesh, submesh or group" check box is on ->
+    // get all elements of the required type from the object selected
+
+    // if MESH object is selected
+    if ( !CORBA::is_nil( SMESH::SMESH_Mesh::_narrow( myIDSource ) ) ) {
+      // get mesh
+      SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( myIDSource );
+      // get IDs from mesh...
+      if ( Elements1dRB->isChecked() )
+       // 1d elements
+       anElementsId = aMesh->GetElementsByType( SMESH::EDGE );
+      else if ( Elements2dRB->isChecked() ) {
+       anElementsId = aMesh->GetElementsByType( SMESH::FACE );
+      }
+    }
+    // SUBMESH is selected
+    if ( !CORBA::is_nil( SMESH::SMESH_subMesh::_narrow( myIDSource ) ) ) {
+      // get submesh
+      SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( myIDSource );
+      // get IDs from submesh
+      if ( Elements1dRB->isChecked() )
+       // 1d elements
+       anElementsId = aSubMesh->GetElementsByType( SMESH::EDGE );
+      else if ( Elements2dRB->isChecked() )
+       // 2d elements
+       anElementsId = aSubMesh->GetElementsByType( SMESH::FACE );
+    }  
+    // GROUP is selected
+    if ( !CORBA::is_nil( SMESH::SMESH_GroupBase::_narrow( myIDSource ) ) ) {
+      // get smesh group
+      SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( myIDSource );
+      // get IDs from group
+      // 1d elements or 2d elements
+      if ( Elements1dRB->isChecked() && aGroup->GetType() == SMESH::EDGE ||
+          Elements2dRB->isChecked() && aGroup->GetType() == SMESH::FACE )
+       anElementsId = aGroup->GetListOfID();
+    }
+  }
+  else {
+    // If "Select whole mesh, submesh or group" check box is off ->
+    // use only elements of given type selected by user
+
+    SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh();
+    if ( aMesh ) {
+      QStringList aListElementsId = QStringList::split( " ", ElementsLineEdit->text(), false );
+      anElementsId = new SMESH::long_array;
+      anElementsId->length( aListElementsId.count() );
+      bool bOk;
+      int j = 0;
+      for ( int i = 0; i < aListElementsId.count(); i++ ) {
+       long ind = aListElementsId[ i ].toLong( &bOk );
+       if  ( bOk ) {
+         const SMDS_MeshElement* e = aMesh->FindElement( ind );
+         if ( e ) {
+           bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge || 
+                            Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
+           if ( typeMatch )
+             anElementsId[ j++ ] = ind;
+         }
+       }
+      }
+      anElementsId->length( j );
+    }
+  }
+      
+  if ( anElementsId->length() <= 0 ) {
+    return false;
+  }
+
+  if ( StartPointLineEdit->text().stripWhiteSpace().isEmpty() ) {
+    return false;
+  }
+  
+  bool bOk;
+  long aNodeStart = StartPointLineEdit->text().toLong( &bOk );
+  if ( !bOk ) {
+    return false;
+  }
+  
+  // get angles
+  SMESH::double_array_var anAngles = new SMESH::double_array;
+  if ( AnglesCheck->isChecked() ) {
+    anAngles->length( AnglesList->count() );
+    int j = 0;
+    bool bOk;
+    for ( int i = 0; i < AnglesList->count(); i++ ) {
+      long angle = AnglesList->text( i ).toLong( &bOk );
+      if  ( bOk )
+       anAngles[ j++ ] = angle;
+    }
+    anAngles->length( j );
+  }
+
+  // get base point
+  SMESH::PointStruct aBasePoint;
+  if ( BasePointCheck->isChecked() ) {
+    aBasePoint.x = XSpin->GetValue();
+    aBasePoint.y = YSpin->GetValue();
+    aBasePoint.z = ZSpin->GetValue();
+  }
+  
+  try {
+    QAD_WaitCursor wc;
+    SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+    aMeshEditor->ExtrusionAlongPath( anElementsId.inout(), myPathMesh, myPathShape, aNodeStart, 
+                                    AnglesCheck->isChecked(), anAngles.inout(), 
+                                    BasePointCheck->isChecked(), aBasePoint );
+  }
+  catch( ... ) {
+    return false;
+  }
+    
+  mySelection->ClearIObjects();
+  SMESH::UpdateView();
+  Init( false );
+  TypeChanged( GetConstructorId() );
+  return true;
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::ClickOnOk()
+// purpose  : Called when user presses <OK> button
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::ClickOnOk()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::ClickOnOk");
+  if ( !ClickOnApply() )
+    return;
+  reject();
+}
+
+//=======================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::onTextChange
+// purpose  : 
+//=======================================================================
+
+void SMESHGUI_ExtrusionAlongPathDlg::onTextChange(const QString& theNewText)
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::onTextChange");
+  QLineEdit* send = (QLineEdit*)sender();
+  if ( send != StartPointLineEdit && send != ElementsLineEdit )
+    send = ElementsLineEdit;
+
+  // return if busy
+  if ( myBusy ) 
+    return;
+
+  // set busy flag
+  SetBusy sb( this );
+  
+  if ( send == ElementsLineEdit && myEditCurrentArgument == ElementsLineEdit ) {
+    // hilight entered elements
+    SMDS_Mesh* aMesh = 0;
+    if ( myMeshActor )
+      aMesh = myMeshActor->GetObject()->GetMesh();
+    if ( aMesh ) {
+      mySelection->ClearIObjects();
+      mySelection->AddIObject( myMeshActor->getIO() );
+      
+      QStringList aListId = QStringList::split( " ", theNewText, false );
+      bool bOk;
+      for ( int i = 0; i < aListId.count(); i++ ) {
+       long ind = aListId[ i ].toLong( &bOk );
+       if ( bOk ) {
+         const SMDS_MeshElement* e = aMesh->FindElement( ind );
+         if ( e ) {
+           // check also type of element
+           bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge || 
+                            Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
+           if ( typeMatch ) {
+             if ( !mySelection->IsIndexSelected( myMeshActor->getIO(), e->GetID() ) )
+               mySelection->AddOrRemoveIndex( myMeshActor->getIO(), e->GetID(), true );
+           }
+         }
+       }
+      }
+    }
+  }
+  else if ( send == StartPointLineEdit && myEditCurrentArgument == StartPointLineEdit ) {
+    if ( !myPathMesh->_is_nil() ) {
+      SMESH_Actor* aPathActor = SMESH::FindActorByObject( myPathMesh );
+      SMDS_Mesh* aMesh = 0;
+      if ( aPathActor )
+       aMesh = aPathActor->GetObject()->GetMesh();
+      if ( aMesh ) {
+       mySelection->ClearIObjects();
+       mySelection->AddIObject( aPathActor->getIO() );
+      
+       bool bOk;
+       long ind = theNewText.toLong( &bOk );
+       if ( bOk ) {
+         const SMDS_MeshNode* n = aMesh->FindNode( ind );
+         if ( n ) {
+           if ( !mySelection->IsIndexSelected( aPathActor->getIO(), n->GetID() ) ) {
+             mySelection->AddOrRemoveIndex( aPathActor->getIO(), n->GetID(), true );
+           }
+         }
+       }
+      }
+    }
+  }
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
+// purpose  : Called when selection as changed or other case
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument");
+  // return if busy
+  if ( myBusy ) 
+    return;
+  
+  // return if dialog box is inactive
+  if ( !ButtonsGrp->isEnabled() )
+    return;
+
+  // selected objects count
+  int nbSel = mySelection->IObjectCount();
+
+  // set busy flag
+  SetBusy sb( this );
+
+  if ( myEditCurrentArgument == ElementsLineEdit ) {
+    // we are now selecting mesh elements (or whole mesh/submesh/group)
+    // reset
+    ElementsLineEdit->clear();
+    myMesh      = SMESH::SMESH_Mesh::_nil();
+    myIDSource  = SMESH::SMESH_IDSource::_nil();
+    myMeshActor = 0;
+    
+    // only one object is acceptable
+    if( nbSel != 1 )
+      return;
+
+    // try to get mesh from selection
+    Handle( SALOME_InteractiveObject ) IO = mySelection->firstIObject();
+    myMesh = SMESH::GetMeshByIO( IO );
+    if( myMesh->_is_nil() )
+      return;
+    // find actor
+    myMeshActor = SMESH::FindActorByObject( myMesh );
+    if ( !myMeshActor )
+      return;
+
+    if ( MeshCheck->isChecked() ) {
+      // If "Select whole mesh, submesh or group" check box is on ->
+      // get ID source and put it's name to the edit box
+      QString aString;
+      SMESH::GetNameOfSelectedIObjects( mySelection, aString );
+
+      myIDSource = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
+      ElementsLineEdit->setText( aString );
+    }
+    else {
+      // If "Select whole mesh, submesh or group" check box is off ->
+      // try to get selected elements IDs
+      QString aString;
+      int aNbUnits = SMESH::GetNameOfSelectedElements( mySelection, aString );
+      ElementsLineEdit->setText( aString );
+    }
+  }
+  else if ( myEditCurrentArgument == PathMeshLineEdit ) {
+    // we are now selecting path mesh
+    // reset
+    PathMeshLineEdit->clear();
+    myPathMesh = SMESH::SMESH_Mesh::_nil();
+    PathShapeLineEdit->clear();
+    myPathShape = GEOM::GEOM_Object::_nil();
+    StartPointLineEdit->clear();
+
+    // only one object is acceptable
+    if( nbSel != 1 )
+      return;
+
+    // try to get mesh from selection
+    Handle( SALOME_InteractiveObject ) IO = mySelection->firstIObject();
+    myPathMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( IO );
+    if( myPathMesh->_is_nil() )
+      return;
+
+    QString aString;
+    SMESH::GetNameOfSelectedIObjects( mySelection, aString );
+    PathMeshLineEdit->setText( aString );
+  }
+  else if ( myEditCurrentArgument == PathShapeLineEdit ) {
+    // we are now selecting path mesh
+    // reset
+    PathShapeLineEdit->clear();
+    myPathShape = GEOM::GEOM_Object::_nil();
+    StartPointLineEdit->clear();
+
+    // return if path mesh is not yet selected
+    if ( myPathMesh->_is_nil() )
+      return;
+
+    // only one object is acceptable
+    if( nbSel != 1 )
+      return;
+
+    // try to get shape from selection
+    Handle( SALOME_InteractiveObject ) IO = mySelection->firstIObject();
+    myPathShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>( IO );
+    if ( myPathShape->_is_nil() )
+      return;
+
+    QString aString;
+    SMESH::GetNameOfSelectedIObjects( mySelection, aString );
+    PathShapeLineEdit->setText( aString );
+  }
+  else if ( myEditCurrentArgument == StartPointLineEdit ) {
+    // we are now selecting start point of path
+    // reset
+    StartPointLineEdit->clear();
+
+    // return if path mesh or path shape is not yet selected
+    if ( myPathMesh->_is_nil() || myPathShape->_is_nil() )
+      return;
+
+    // only one object is acceptable
+    if( nbSel != 1 )
+      return;
+
+    // try to get shape from selection
+    Handle( SALOME_InteractiveObject ) IO = mySelection->firstIObject();
+    
+    QString aString;
+    int aNbUnits = SMESH::GetNameOfSelectedElements( mySelection, aString );
+    if ( aNbUnits == 1 )
+      StartPointLineEdit->setText( aString.stripWhiteSpace() );
+  }
+  else if ( myEditCurrentArgument == XSpin ) {
+    // we are now selecting base point
+    // reset is not performed here!
+
+    // return if is not enabled
+    if ( !BasePointGrp->isEnabled() ) 
+      return;
+
+    // only one object is acceptable
+    if( nbSel != 1 )
+      return;
+    
+    // try to get shape from selection
+    Handle( SALOME_InteractiveObject ) IO = mySelection->firstIObject();
+    
+    // check if geom vertex is selected
+    GEOM::GEOM_Object_var aGeomObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( IO );
+    TopoDS_Vertex aVertex;
+    if( !aGeomObj->_is_nil() ) {
+      if(  aGeomObj->IsShape() && GEOMBase::GetShape( aGeomObj, aVertex ) && !aVertex.IsNull() ) {
+       gp_Pnt aPnt = BRep_Tool::Pnt( aVertex );
+       XSpin->SetValue( aPnt.X() );
+       YSpin->SetValue( aPnt.Y() );
+       ZSpin->SetValue( aPnt.Z() );
+      }
+      return;
+    }
+
+    // check if smesh node is selected
+    SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( IO );
+    if( aMesh->_is_nil() )
+      return;
+
+    QString aString;
+    int aNbUnits = SMESH::GetNameOfSelectedNodes( mySelection, aString );
+    // return if more than one node is selected
+    if( aNbUnits != 1 )
+      return;
+      
+    SMESH_Actor* aMeshActor = SMESH::FindActorByObject( aMesh );
+    if ( !aMeshActor )
+      return;
+
+    SMDS_Mesh* mesh = aMeshActor->GetObject()->GetMesh();
+    if (!mesh)
+      return;
+
+    const SMDS_MeshNode* n = mesh->FindNode( aString.toLong() );
+    if ( !n )
+      return;
+
+    XSpin->SetValue( n->X() );
+    YSpin->SetValue( n->Y() );
+    ZSpin->SetValue( n->Z() );
+  }
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument()
+// purpose  :
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument");
+  QToolButton* send = (QToolButton*)sender();
+  if ( send != SelectElementsButton   && 
+       send != SelectPathMeshButton   && 
+       send != SelectPathShapeButton  && 
+       send != SelectStartPointButton && 
+       send != SelectBasePointButton )
+    return;
+  SetEditCurrentArgument( send );
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument()
+// purpose  :
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument( QToolButton* button )
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument(button)");
+  disconnect( mySelection, 0, this, 0 );
+  mySelection->ClearIObjects();
+  mySelection->ClearFilters();
+  SMESH::SetPickable();
+  
+  if( button == SelectElementsButton ) {
+    myEditCurrentArgument = ElementsLineEdit;
+    SMESH::SetPointRepresentation( false );
+    if ( MeshCheck->isChecked() ) {
+      QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+      mySelection->AddFilter( myElementsFilter );
+    }
+    else  {
+      if ( Elements1dRB->isChecked() )
+       QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
+      else if ( Elements2dRB->isChecked() )
+       QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
+    }
+  }
+  else if ( button == SelectPathMeshButton ) {
+    myEditCurrentArgument = PathMeshLineEdit;
+    SMESH::SetPointRepresentation( false );
+    QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+    mySelection->AddFilter( myPathMeshFilter );
+  }
+  else if ( button == SelectPathShapeButton ) {
+    myEditCurrentArgument = PathShapeLineEdit;
+    SMESH::SetPointRepresentation( false );
+    QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+
+    if ( !myPathMesh->_is_nil() ) {
+      TColStd_MapOfInteger aTypes;
+      aTypes.Add( TopAbs_EDGE );
+      aTypes.Add( TopAbs_WIRE );
+      GEOM::GEOM_Object_var aMainShape = myPathMesh->GetShapeToMesh();
+      SMESH_Actor* aPathActor = SMESH::FindActorByObject( myPathMesh );
+
+      if ( !aMainShape->_is_nil() && aPathActor )
+       mySelection->AddFilter( new SMESH_NumberFilter( "GEOM", TopAbs_SHAPE, -1, aTypes, aMainShape ) );
+       //SMESH::SetPickable( aPathActor );
+    }
+  }
+  else if ( button == SelectStartPointButton ) {
+    myEditCurrentArgument = StartPointLineEdit;
+    if ( !myPathMesh->_is_nil() ) {
+      SMESH_Actor* aPathActor = SMESH::FindActorByObject( myPathMesh );
+      if ( aPathActor ) {
+       SMESH::SetPointRepresentation( true );
+       QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+       SMESH::SetPickable( aPathActor );
+      }
+    }
+  }
+  else if ( button == SelectBasePointButton ) {
+    myEditCurrentArgument = XSpin;
+    SMESH::SetPointRepresentation( true );
+    QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+
+    SMESH_ListOfFilter aListOfFilters;
+    Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
+    if ( !aMeshOrSubMeshFilter.IsNull() )
+      aListOfFilters.Append( aMeshOrSubMeshFilter );
+    Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
+    if ( !aSmeshGroupFilter.IsNull() )
+      aListOfFilters.Append( aSmeshGroupFilter );
+    //Handle(GEOM_ShapeTypeFilter) aVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX );
+    Handle(SMESH_NumberFilter) aVertexFilter = new SMESH_NumberFilter( "GEOM", TopAbs_SHAPE, -1, TopAbs_VERTEX, GEOM::GEOM_Object::_nil() );
+    if ( !aVertexFilter.IsNull() )
+      aListOfFilters.Append( aVertexFilter );
+  
+    mySelection->AddFilter( new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR ) );
+  }
+
+  if ( myEditCurrentArgument && !myEditCurrentArgument->hasFocus() )
+    myEditCurrentArgument->setFocus();
+
+  connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::DeactivateActiveDialog()
+// purpose  : Deactivates this dialog
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::DeactivateActiveDialog()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::DeactivateActiveDialog");
+  if ( ElementsTypeGrp->isEnabled() ) {
+    ElementsTypeGrp->setEnabled( false );
+    ArgumentsGrp->setEnabled( false );
+    ButtonsGrp->setEnabled( false );
+    mySMESHGUI->ResetState();    
+    mySMESHGUI->SetActiveDialogBox( 0 );
+  }
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::ActivateThisDialog()
+// purpose  : Activates this dialog
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::ActivateThisDialog()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::ActivateThisDialog");
+  // Emit a signal to deactivate the active dialog
+  mySMESHGUI->EmitSignalDeactivateDialog();   
+  ElementsTypeGrp->setEnabled( true );
+  ArgumentsGrp->setEnabled( true );
+  ButtonsGrp->setEnabled( true );
+  
+  mySMESHGUI->SetActiveDialogBox( this );
+
+  TypeChanged( GetConstructorId() );
+  SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::enterEvent()
+// purpose  : Mouse enter event
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::enterEvent(QEvent* e)
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::enterEvent");
+  if ( ElementsTypeGrp->isEnabled() )
+    return;  
+  ActivateThisDialog();
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::reject()
+// purpose  : Called when dialog box is closed
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::reject()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::reject");
+  disconnect( mySelection, 0, this, 0 );
+  mySelection->ClearFilters();
+  mySelection->ClearIObjects();
+  SMESH::SetPickable();
+  SMESH::SetPointRepresentation( false );
+  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+  mySMESHGUI->ResetState() ;
+  QDialog::reject();
+}
+
+//=================================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId()
+// purpose  : 
+//=================================================================================
+int SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId()
+{ 
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId");
+  if ( ElementsTypeGrp != NULL && ElementsTypeGrp->selected() != NULL )
+    return ElementsTypeGrp->id( ElementsTypeGrp->selected() );
+  return -1;
+}
+
+//=======================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::onSelectMesh
+// purpose  :
+//=======================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::onSelectMesh()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::onSelectMesh");
+  bool toSelectMesh = MeshCheck->isChecked();
+  
+  ElementsLineEdit->setReadOnly( toSelectMesh );
+  ElementsLab->setText( toSelectMesh ? tr( "SMESH_NAME" ) : tr( "SMESH_ID_ELEMENTS" ) );
+  ElementsLineEdit->clear();
+  
+  SetEditCurrentArgument( SelectElementsButton );
+}
+
+//=======================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::onAnglesCheck
+// purpose  : called when "Use Angles" check box is switched
+//=======================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::onAnglesCheck()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::onAnglesCheck");
+  AnglesGrp->setEnabled( AnglesCheck->isChecked() );
+}
+
+//=======================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::onBasePointCheck
+// purpose  : called when "Use Base Point" check box is switched
+//=======================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::onBasePointCheck()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::onBasePointCheck");
+  BasePointGrp->setEnabled( BasePointCheck->isChecked() );
+}
+
+//=======================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded
+// purpose  : Called when user adds angle to the list
+//=======================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded");
+  AnglesList->insertItem( QString::number( AngleSpin->GetValue() ) );
+}
+
+//=======================================================================
+// function : SMESHGUI_ExtrusionAlongPathDlg::OnAngleRemoved
+// purpose  : Called when user removes angle(s) from the list
+//=======================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::OnAngleRemoved()
+{
+  MESSAGE("SMESHGUI_ExtrusionAlongPathDlg::OnAngleRemoved");
+  QList<QListBoxItem> aList;
+  aList.setAutoDelete( false );
+  for ( int i = 0; i < AnglesList->count(); i++ )
+    if ( AnglesList->isSelected( i ) )
+      aList.append( AnglesList->item( i ) );
+
+  for ( int i = 0; i < aList.count(); i++ )
+    delete aList.at( i );
+}
+
diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h
new file mode 100644 (file)
index 0000000..951dbb3
--- /dev/null
@@ -0,0 +1,156 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESHGUI_ExtrusionAlongPathDlg.h
+//  Author : Vadim SANDLER
+//  Module : SMESH
+//  $Header: 
+
+#ifndef DIALOGBOX_EXTRUSION_PATH_H
+#define DIALOGBOX_EXTRUSION_PATH_H
+
+#include "SALOME_Selection.h"
+#include "SMESH_LogicalFilter.hxx"
+#include "SMESH_TypeFilter.hxx"
+// QT Includes
+#include <qdialog.h>
+
+class QButtonGroup;
+class QRadioButton;
+class QGroupBox;
+class QLabel;
+class QToolButton;
+class QLineEdit;
+class QCheckBox;
+class QListBox;
+class QPushButton;
+class SMESHGUI_SpinBox;
+class SMESHGUI;
+class SMESH_Actor;
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+//=================================================================================
+// class    : SMESHGUI_ExtrusionAlongPathDlg
+// purpose  :
+//=================================================================================
+class SMESHGUI_ExtrusionAlongPathDlg : public QDialog
+{ 
+  Q_OBJECT
+
+  class SetBusy {
+    public:
+      SetBusy( SMESHGUI_ExtrusionAlongPathDlg* _dlg ) { myDlg = _dlg; myDlg->myBusy = true; }
+      ~SetBusy() { myDlg->myBusy = false; }
+    private:
+      SMESHGUI_ExtrusionAlongPathDlg* myDlg;
+  };
+  friend class SetBusy;
+
+public:
+  SMESHGUI_ExtrusionAlongPathDlg( QWidget* parent = 0, SALOME_Selection* Sel = 0, bool modal = FALSE );
+  ~SMESHGUI_ExtrusionAlongPathDlg();
+
+  bool eventFilter( QObject* object, QEvent* event );
+
+protected slots:
+  void reject();
+
+private:
+  void Init( bool ResetControls = true ) ;
+  void enterEvent ( QEvent * ) ;                          /* mouse enter the QWidget */
+  int  GetConstructorId();
+  void SetEditCurrentArgument( QToolButton* button );
+
+  SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
+  SALOME_Selection*             mySelection ;             /* User shape selection */
+  QWidget*                      myEditCurrentArgument;    /* Current  argument */
+  
+  bool                          myBusy;
+  SMESH::SMESH_IDSource_var     myIDSource;
+  SMESH::SMESH_Mesh_var         myMesh;
+  SMESH_Actor*                  myMeshActor;
+  SMESH::SMESH_Mesh_var         myPathMesh;
+  GEOM::GEOM_Object_var         myPathShape;
+  Handle(SMESH_LogicalFilter)   myElementsFilter;
+  Handle(SMESH_TypeFilter)      myPathMeshFilter;
+  int                           myType;
+
+  // widgets
+  QButtonGroup*     ElementsTypeGrp;
+  QRadioButton*     Elements1dRB;
+  QRadioButton*     Elements2dRB;
+  QGroupBox*        ArgumentsGrp;
+  QLabel*           ElementsLab;
+  QToolButton*      SelectElementsButton;
+  QLineEdit*        ElementsLineEdit;
+  QCheckBox*        MeshCheck;
+  QGroupBox*        PathGrp;
+  QLabel*           PathMeshLab;
+  QToolButton*      SelectPathMeshButton;
+  QLineEdit*        PathMeshLineEdit;
+  QLabel*           PathShapeLab;
+  QToolButton*      SelectPathShapeButton;
+  QLineEdit*        PathShapeLineEdit;
+  QLabel*           StartPointLab;
+  QToolButton*      SelectStartPointButton;
+  QLineEdit*        StartPointLineEdit;
+  QCheckBox*        AnglesCheck;
+  QGroupBox*        AnglesGrp;
+  QListBox*         AnglesList;
+  QToolButton*      AddAngleButton;
+  QToolButton*      RemoveAngleButton;
+  SMESHGUI_SpinBox* AngleSpin;
+  QCheckBox*        BasePointCheck;
+  QGroupBox*        BasePointGrp;
+  QToolButton*      SelectBasePointButton;
+  QLabel*           XLab;
+  SMESHGUI_SpinBox* XSpin;
+  QLabel*           YLab;
+  SMESHGUI_SpinBox* YSpin;
+  QLabel*           ZLab;
+  SMESHGUI_SpinBox* ZSpin;
+  QGroupBox*        ButtonsGrp;
+  QPushButton*      OkButton;
+  QPushButton*      ApplyButton;
+  QPushButton*      CloseButton;
+  
+private slots:
+  void TypeChanged( int type );
+  void ClickOnOk();
+  bool ClickOnApply();
+  void SetEditCurrentArgument();
+  void SelectionIntoArgument();
+  void DeactivateActiveDialog();
+  void ActivateThisDialog();
+  void onTextChange(const QString&);
+  void onSelectMesh();
+  void onAnglesCheck();
+  void onBasePointCheck();
+  void OnAngleAdded();
+  void OnAngleRemoved();
+};
+
+#endif // DIALOGBOX_EXTRUSION_PATH_H
index c47fa7a5b98b265efea52b5ea75f4832857cd97c..7e3ad503fe94003054f2d98e2d3bcf74141f6356 100644 (file)
 #include <qvalidator.h>
 #include <qpixmap.h>
 
 #include <qvalidator.h>
 #include <qpixmap.h>
 
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
 using namespace std;
 
 //=================================================================================
 using namespace std;
 
 //=================================================================================
index 7aeb763d3f6655cdd93c1f08f7159fe6168df0bf..f20b321cab3ba6430087aed222255ba74ee46914 100755 (executable)
 #include <qobjectlist.h>
 #include <qvalidator.h>
 
 #include <qobjectlist.h>
 #include <qvalidator.h>
 
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
 #define SPACING 5                  
 #define MARGIN  10
 
 #define SPACING 5                  
 #define MARGIN  10
 
@@ -654,7 +658,8 @@ bool SMESHGUI_FilterTable::IsValid( const bool theMess, const int theEntityType
     if ( aCriterion == FT_RangeOfIds ||
          aCriterion == FT_BelongToGeom ||
          aCriterion == FT_BelongToPlane ||
     if ( aCriterion == FT_RangeOfIds ||
          aCriterion == FT_BelongToGeom ||
          aCriterion == FT_BelongToPlane ||
-         aCriterion == FT_BelongToCylinder )
+         aCriterion == FT_BelongToCylinder ||
+        aCriterion == FT_LyingOnGeom)
     {
       if ( aTable->text( i, 2 ).isEmpty() )
       {
     {
       if ( aTable->text( i, 2 ).isEmpty() )
       {
@@ -768,7 +773,8 @@ void SMESHGUI_FilterTable::GetCriterion( const int                 theRow,
   if ( aCriterionType != FT_RangeOfIds &&
        aCriterionType != FT_BelongToGeom &&
        aCriterionType != FT_BelongToPlane &&
   if ( aCriterionType != FT_RangeOfIds &&
        aCriterionType != FT_BelongToGeom &&
        aCriterionType != FT_BelongToPlane &&
-       aCriterionType != FT_BelongToCylinder )
+       aCriterionType != FT_BelongToCylinder &&
+       aCriterionType != FT_LyingOnGeom)
   {
     theCriterion.Compare = ( (ComboItem*)aTable->item( theRow, 1 ) )->GetValue();
     theCriterion.Threshold = aTable->item( theRow, 2 )->text().toDouble();
   {
     theCriterion.Compare = ( (ComboItem*)aTable->item( theRow, 1 ) )->GetValue();
     theCriterion.Threshold = aTable->item( theRow, 2 )->text().toDouble();
@@ -813,7 +819,8 @@ void SMESHGUI_FilterTable::SetCriterion( const int                       theRow,
   if ( theCriterion.Type != FT_RangeOfIds &&
        theCriterion.Type != FT_BelongToGeom &&
        theCriterion.Type != FT_BelongToPlane &&
   if ( theCriterion.Type != FT_RangeOfIds &&
        theCriterion.Type != FT_BelongToGeom &&
        theCriterion.Type != FT_BelongToPlane &&
-       theCriterion.Type != FT_BelongToCylinder )
+       theCriterion.Type != FT_BelongToCylinder &&
+       theCriterion.Type != FT_LyingOnGeom)
     aTable->setText( theRow, 2, QString( "%1" ).arg( theCriterion.Threshold, 0, 'g', 15 ) );
   else
     aTable->setText( theRow, 2, QString( theCriterion.ThresholdStr ) );
     aTable->setText( theRow, 2, QString( "%1" ).arg( theCriterion.Threshold, 0, 'g', 15 ) );
   else
     aTable->setText( theRow, 2, QString( theCriterion.ThresholdStr ) );
@@ -902,7 +909,6 @@ void SMESHGUI_FilterTable::onAddBtn()
   int aType = GetType();
   addRow( myTables[ aType ], aType );
 
   int aType = GetType();
   addRow( myTables[ aType ], aType );
 
-  Table* aTable = myTables[ aType ];
   Update();
 }
 
   Update();
 }
 
@@ -965,6 +971,7 @@ void SMESHGUI_FilterTable::updateAdditionalWidget()
   ComboItem* anItem = ( (ComboItem*)aTable->item( aRow, 0 ) );
   bool toEnable = ( (ComboItem*)aTable->item( aRow, 1 ) )->GetValue() == FT_EqualTo &&
                   GetCriterionType( aRow ) != FT_BelongToGeom &&
   ComboItem* anItem = ( (ComboItem*)aTable->item( aRow, 0 ) );
   bool toEnable = ( (ComboItem*)aTable->item( aRow, 1 ) )->GetValue() == FT_EqualTo &&
                   GetCriterionType( aRow ) != FT_BelongToGeom &&
+                  GetCriterionType( aRow ) != FT_LyingOnGeom &&
                   GetCriterionType( aRow ) != FT_RangeOfIds &&
                   GetCriterionType( aRow ) != FT_FreeEdges;
   if ( !myAddWidgets.contains( anItem ) )
                   GetCriterionType( aRow ) != FT_RangeOfIds &&
                   GetCriterionType( aRow ) != FT_FreeEdges;
   if ( !myAddWidgets.contains( anItem ) )
@@ -1047,7 +1054,8 @@ void SMESHGUI_FilterTable::onCriterionChanged( const int row, const int col, con
   else if ( aCriterionType == SMESH::FT_RangeOfIds ||
             aCriterionType == SMESH::FT_BelongToGeom ||
             aCriterionType == SMESH::FT_BelongToPlane ||
   else if ( aCriterionType == SMESH::FT_RangeOfIds ||
             aCriterionType == SMESH::FT_BelongToGeom ||
             aCriterionType == SMESH::FT_BelongToPlane ||
-            aCriterionType == SMESH::FT_BelongToCylinder )
+            aCriterionType == SMESH::FT_BelongToCylinder ||
+           aCriterionType == SMESH::FT_LyingOnGeom)
   {
     QMap<int, QString> aMap;
     aMap[ FT_EqualTo ] = tr( "EQUAL_TO" );
   {
     QMap<int, QString> aMap;
     aMap[ FT_EqualTo ] = tr( "EQUAL_TO" );
@@ -1239,6 +1247,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
       aCriteria[ SMESH::FT_BelongToGeom     ] = tr( "BELONG_TO_GEOM" );
       aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
       aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
       aCriteria[ SMESH::FT_BelongToGeom     ] = tr( "BELONG_TO_GEOM" );
       aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
       aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
+      aCriteria[ SMESH::FT_LyingOnGeom      ] = tr( "LYING_ON_GEOM" );
     }
     return aCriteria;
   }
     }
     return aCriteria;
   }
@@ -1254,6 +1263,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
       aCriteria[ SMESH::FT_BelongToGeom     ] = tr( "BELONG_TO_GEOM" );
       aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
       aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
       aCriteria[ SMESH::FT_BelongToGeom     ] = tr( "BELONG_TO_GEOM" );
       aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
       aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
+      aCriteria[ SMESH::FT_LyingOnGeom      ] = tr( "LYING_ON_GEOM" );
     }
     return aCriteria;
   }
     }
     return aCriteria;
   }
@@ -1273,6 +1283,9 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
       aCriteria[ SMESH::FT_BelongToGeom     ] = tr( "BELONG_TO_GEOM" );
       aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
       aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
       aCriteria[ SMESH::FT_BelongToGeom     ] = tr( "BELONG_TO_GEOM" );
       aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
       aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
+      aCriteria[ SMESH::FT_LyingOnGeom      ] = tr( "LYING_ON_GEOM" );
+      aCriteria[ SMESH::FT_Length2D         ] = tr( "LENGTH2D" );
+      aCriteria[ SMESH::FT_MultiConnection2D] = tr( "MULTI2D_BORDERS" );
     }
     return aCriteria;
   }
     }
     return aCriteria;
   }
@@ -1281,8 +1294,10 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
     static QMap<int, QString> aCriteria;
     if ( aCriteria.isEmpty() )
     {
     static QMap<int, QString> aCriteria;
     if ( aCriteria.isEmpty() )
     {
+      aCriteria[ SMESH::FT_AspectRatio3D] = tr( "ASPECT_RATIO_3D" );
       aCriteria[ SMESH::FT_RangeOfIds   ] = tr( "RANGE_OF_IDS" );
       aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
       aCriteria[ SMESH::FT_RangeOfIds   ] = tr( "RANGE_OF_IDS" );
       aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
+      aCriteria[ SMESH::FT_LyingOnGeom ] = tr( "LYING_ON_GEOM" );
     }
     return aCriteria;
   }
     }
     return aCriteria;
   }
@@ -1341,9 +1356,6 @@ SMESHGUI_FilterTable::Table* SMESHGUI_FilterTable::createTable( QWidget*  thePar
   static int aLenCr = abs(  aMaxLenCr -
                             aMetrics.width( tr( "CRITERION" ) ) ) / aMetrics.width( ' ' ) + 5;
 
   static int aLenCr = abs(  aMaxLenCr -
                             aMetrics.width( tr( "CRITERION" ) ) ) / aMetrics.width( ' ' ) + 5;
 
-  static int aLenCo = abs(  maxLength( getCompare(), aMetrics ) -
-                            aMetrics.width( tr( "COMPARE" ) ) ) / aMetrics.width( ' ' ) + 5;
-
   QString aCrStr;
   aCrStr.fill( ' ', aLenCr );
   QString aCoStr;
   QString aCrStr;
   aCrStr.fill( ' ', aLenCr );
   QString aCoStr;
@@ -1999,7 +2011,8 @@ bool SMESHGUI_FilterDlg::isValid() const
     int aType = myTable->GetCriterionType( i );
     if ( aType == FT_BelongToGeom ||
          aType == FT_BelongToPlane ||
     int aType = myTable->GetCriterionType( i );
     if ( aType == FT_BelongToGeom ||
          aType == FT_BelongToPlane ||
-         aType == FT_BelongToCylinder  )
+         aType == FT_BelongToCylinder ||
+        aType == FT_LyingOnGeom)
     {
       QString aName;
       myTable->GetThreshold( i, aName );
     {
       QString aName;
       myTable->GetThreshold( i, aName );
@@ -2312,7 +2325,7 @@ void SMESHGUI_FilterDlg::filterSelectionSource( const int theType,
 
       if ( aSelMap.Extent() > 0 )
       {
 
       if ( aSelMap.Extent() > 0 )
       {
-        if(SMESH_Actor *anActor = SMESH::FindActorByEntry( anIter.Key()->getEntry() ) )
+        if( SMESH::FindActorByEntry( anIter.Key()->getEntry() ) )
         {
           for ( int i = 1; i <= aSelMap.Extent(); i++ )
             aToBeFiltered.Add( aSelMap(i) );
         {
           for ( int i = 1; i <= aSelMap.Extent(); i++ )
             aToBeFiltered.Add( aSelMap(i) );
@@ -2418,7 +2431,8 @@ void SMESHGUI_FilterDlg::onSelectionDone()
         !myTable->CurrentCell( aRow, aCol ) ||
         myTable->GetCriterionType( aRow ) != FT_BelongToGeom &&
         myTable->GetCriterionType( aRow ) != FT_BelongToPlane &&
         !myTable->CurrentCell( aRow, aCol ) ||
         myTable->GetCriterionType( aRow ) != FT_BelongToGeom &&
         myTable->GetCriterionType( aRow ) != FT_BelongToPlane &&
-        myTable->GetCriterionType( aRow ) != FT_BelongToCylinder)
+        myTable->GetCriterionType( aRow ) != FT_BelongToCylinder &&
+       myTable->GetCriterionType( aRow ) != FT_LyingOnGeom )
     return;
 
   Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject() ;
     return;
 
   Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject() ;
@@ -2461,9 +2475,10 @@ void SMESHGUI_FilterDlg::updateSelection()
   if ( myTable->CurrentCell( aRow, aCol ) &&
        ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom ||
          myTable->GetCriterionType( aRow ) == FT_BelongToPlane ||
   if ( myTable->CurrentCell( aRow, aCol ) &&
        ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom ||
          myTable->GetCriterionType( aRow ) == FT_BelongToPlane ||
-         myTable->GetCriterionType( aRow ) == FT_BelongToCylinder ) )
+         myTable->GetCriterionType( aRow ) == FT_BelongToCylinder ||
+        myTable->GetCriterionType( aRow ) == FT_LyingOnGeom) )
   {
   {
-    if ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom )
+    if ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom ||  myTable->GetCriterionType( aRow ) == FT_LyingOnGeom )
       mySelection->AddFilter( new SALOME_TypeFilter( "GEOM" ) );
     else if ( myTable->GetCriterionType( aRow ) == FT_BelongToPlane )
       mySelection->AddFilter( new GEOM_FaceFilter( StdSelect_Plane ) );
       mySelection->AddFilter( new SALOME_TypeFilter( "GEOM" ) );
     else if ( myTable->GetCriterionType( aRow ) == FT_BelongToPlane )
       mySelection->AddFilter( new GEOM_FaceFilter( StdSelect_Plane ) );
index ed7295a118ce4c509100660c738021af0a52acfc..4d7445df36f047f324a43d2e40df1bc07de1c05c 100644 (file)
@@ -498,6 +498,10 @@ void SMESHGUI_GroupDlg::onGrpTypeChanged(int id)
 //=================================================================================
 void SMESHGUI_GroupDlg::setSelectionMode(int theMode)
 {
 //=================================================================================
 void SMESHGUI_GroupDlg::setSelectionMode(int theMode)
 {
+  // PAL7314
+  if (myMesh->_is_nil())
+    return;
+  
   if (mySelectionMode != theMode) {
     mySelection->ClearIObjects();
     mySelection->ClearFilters();
   if (mySelectionMode != theMode) {
     mySelection->ClearIObjects();
     mySelection->ClearFilters();
index da8fde1c942fc2d141cd3348fe35046af7b09d18..8e1c433b491e446aab4aa19d3e42f2309550b53f 100755 (executable)
-//  SMESH SMESHGUI : GUI for SMESH component\r
-//\r
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
-// \r
-//  This library is free software; you can redistribute it and/or \r
-//  modify it under the terms of the GNU Lesser General Public \r
-//  License as published by the Free Software Foundation; either \r
-//  version 2.1 of the License. \r
-// \r
-//  This library is distributed in the hope that it will be useful, \r
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU \r
-//  Lesser General Public License for more details. \r
-// \r
-//  You should have received a copy of the GNU Lesser General Public \r
-//  License along with this library; if not, write to the Free Software \r
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA \r
-// \r
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
-//\r
-//\r
-//\r
-//  File   : SMESHGUI_MeshPatternDlg.cxx\r
-//  Author : Sergey LITONIN\r
-//  Module : SMESH\r
-\r
-#include "SMESHGUI_MeshPatternDlg.h"\r
-\r
-#include "QAD_Desktop.h"\r
-#include "QAD_FileDlg.h"\r
-\r
-#include "SMESHGUI_SpinBox.h"\r
-#include "SMESHGUI.h"\r
-#include "SALOME_Selection.h"\r
-#include "SMESH_NumberFilter.hxx"\r
-#include "SMESHGUI_Utils.h"\r
-#include "SMESHGUI_VTKUtils.h"\r
-#include "SMESHGUI_CreatePatternDlg.h"\r
-#include "SMESHGUI_PatternWidget.h"\r
-#include "SMESH_Actor.h"\r
-#include "SALOMEGUI_QtCatchCorbaException.hxx"\r
-#include "VTKViewer_ViewFrame.h"\r
-#include "SMESHGUI_PatternUtils.h"\r
-#include "SMESH_ActorUtils.h"\r
-\r
-#include <TColStd_MapOfInteger.hxx>\r
-\r
-#include <qframe.h>\r
-#include <qlayout.h>\r
-#include <qlineedit.h>\r
-#include <qpushbutton.h>\r
-#include <qgroupbox.h>\r
-#include <qlabel.h>\r
-#include <qradiobutton.h>\r
-#include <qcheckbox.h>\r
-#include <qbuttongroup.h>\r
-#include <qmessagebox.h>\r
-#include <qcstring.h>\r
-\r
-#include <vtkCell.h>\r
-#include <vtkIdList.h>\r
-#include <vtkIntArray.h>\r
-#include <vtkCellArray.h>\r
-#include <vtkUnsignedCharArray.h>\r
-#include <vtkUnstructuredGrid.h>\r
-#include <vtkDataSetMapper.h>\r
-\r
-#define SPACING 5\r
-#define MARGIN  10\r
-\r
-/*\r
-  Class       : SMESHGUI_MeshPatternDlg\r
-  Description : Dialog to specify filters for VTK viewer\r
-*/\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg\r
-// Purpose : Constructor\r
-//=======================================================================\r
-SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( QWidget*          theParent,\r
-                                            SALOME_Selection* theSelection,\r
-                                            const char*       theName )\r
-: QDialog( theParent, theName, false,\r
-           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )\r
-{\r
-  setCaption( tr( "CAPTION" ) );\r
-\r
-  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );\r
-\r
-  QFrame* aMainFrame = createMainFrame  ( this );\r
-  QFrame* aBtnFrame  = createButtonFrame( this );\r
-\r
-\r
-\r
-\r
-  aDlgLay->addWidget( aMainFrame );\r
-  aDlgLay->addWidget( aBtnFrame );\r
-\r
-  aDlgLay->setStretchFactor( aMainFrame, 1 );\r
-\r
-  myCreationDlg = 0;\r
-  Init( theSelection );\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::createMainFrame\r
-// Purpose : Create frame containing dialog's input fields\r
-//=======================================================================\r
-QFrame* SMESHGUI_MeshPatternDlg::createMainFrame( QWidget* theParent )\r
-{\r
-  QPixmap iconSlct( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );\r
-  QPixmap icon2d  ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_2d" ) ) );\r
-  QPixmap icon3d  ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_3d" ) ) );\r
-  QPixmap iconOpen( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_FILE_OPEN" ) ) );\r
-\r
-  QPixmap iconSample2d( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_2D" ) ) );\r
-  QPixmap iconSample3d( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_3D" ) ) );\r
-\r
-  QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, theParent );\r
-  aMainGrp->setFrameStyle( QFrame::NoFrame );\r
-  aMainGrp->setInsideMargin( 0 );\r
-\r
-  // Pattern type group\r
-  \r
-  myTypeGrp = new QButtonGroup( 1, Qt::Vertical, tr( "PATTERN_TYPE" ), aMainGrp );\r
-  mySwitch2d = new QRadioButton( myTypeGrp );\r
-  mySwitch3d = new QRadioButton( myTypeGrp );\r
-  mySwitch2d->setPixmap( icon2d );\r
-  mySwitch3d->setPixmap( icon3d );\r
-  myTypeGrp->insert( mySwitch2d, Type_2d );\r
-  myTypeGrp->insert( mySwitch3d, Type_3d );\r
-\r
-\r
-  // Mesh group\r
-  \r
-  QGroupBox* aMeshGrp = new QGroupBox( 1, Qt::Vertical, tr( "SMESH_MESH" ), aMainGrp );\r
-  new QLabel( tr( "SMESH_MESH" ), aMeshGrp );\r
-  mySelBtn[ Mesh ] = new QPushButton( aMeshGrp );\r
-  mySelBtn[ Mesh ]->setPixmap( iconSlct );\r
-  mySelEdit[ Mesh ] = new QLineEdit( aMeshGrp );\r
-  mySelEdit[ Mesh ]->setReadOnly( true );\r
-\r
-  // Pattern group\r
-  \r
-  QGroupBox* aPatGrp = new QGroupBox( 1, Qt::Horizontal, tr( "PATTERN" ), aMainGrp );\r
-\r
-  // pattern name\r
-  QGroupBox* aNameGrp = new QGroupBox( 1, Qt::Vertical, aPatGrp );\r
-  aNameGrp->setFrameStyle( QFrame::NoFrame );\r
-  aNameGrp->setInsideMargin( 0 );\r
-  new QLabel( tr( "PATTERN" ), aNameGrp );\r
-  myName = new QLineEdit( aNameGrp );\r
-  myName->setReadOnly( true );\r
-  myOpenBtn = new QPushButton( aNameGrp );\r
-  myOpenBtn->setPixmap( iconOpen );\r
-  myNewBtn = new QPushButton( tr( "NEW" ), aNameGrp );\r
-\r
-  // selection widgets\r
-  QGroupBox* aGrp = new QGroupBox( 3, Qt::Horizontal, aPatGrp );\r
-  aGrp->setFrameStyle( QFrame::NoFrame );\r
-  aGrp->setInsideMargin( 0 );\r
-\r
-  for ( int i = Object; i <= Vertex2; i++ )\r
-  {\r
-    mySelLbl[ i ] = new QLabel( aGrp );\r
-    mySelBtn[ i ] = new QPushButton( aGrp );\r
-    mySelBtn[ i ]->setPixmap( iconSlct );\r
-    mySelEdit[ i ] = new QLineEdit( aGrp );\r
-    mySelEdit[ i ]->setReadOnly( true );\r
-  }\r
-\r
-  // reverse check box\r
-  myReverseChk = new QCheckBox( tr( "REVERSE" ), aPatGrp );\r
-\r
-  // Pictures 2d and 3d\r
-  for ( int i = 0; i < 2; i++ )\r
-  {\r
-    QWidget* aPreview, *aPicture;\r
-    if ( i == 0 )\r
-    {\r
-      myPicture2d = new SMESHGUI_PatternWidget( aPatGrp ),\r
-      myPicture2d->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );\r
-    }\r
-    else\r
-    {\r
-      myPicture3d = new QFrame( aPatGrp ),\r
-      myPreview3d = new QLabel( myPicture3d );\r
-      myPreview3d->setPixmap( iconSample3d );\r
-      QGridLayout* aLay = new QGridLayout( myPicture3d, 3, 3, 0, 0 );\r
-      QSpacerItem* aSpacerH1 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );\r
-      QSpacerItem* aSpacerH2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );\r
-      QSpacerItem* aSpacerV1 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );\r
-      QSpacerItem* aSpacerV2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );\r
-      aLay->addItem( aSpacerH1, 1, 0 );\r
-      aLay->addItem( aSpacerH2, 1, 2 );\r
-      aLay->addItem( aSpacerV1, 0, 1 );\r
-      aLay->addItem( aSpacerV2, 2, 1 );\r
-      aLay->addWidget( myPreview3d, 1, 1 );\r
-    }\r
-  }\r
-\r
-  myPreviewChk = new QCheckBox( tr( "PREVIEW" ), aPatGrp );\r
-\r
-  // Connect signals and slots\r
-\r
-  connect( myTypeGrp,    SIGNAL( clicked( int )  ), SLOT( onTypeChanged( int ) ) );\r
-  connect( myOpenBtn,    SIGNAL( clicked()       ), SLOT( onOpen()             ) );\r
-  connect( myNewBtn,     SIGNAL( clicked()       ), SLOT( onNew()              ) );\r
-  connect( myReverseChk, SIGNAL( toggled( bool ) ), SLOT( onReverse( bool )    ) );\r
-  connect( myPreviewChk, SIGNAL( toggled( bool ) ), SLOT( onPreview( bool )    ) );\r
-\r
-  QMap< int, QPushButton* >::iterator anIter;\r
-  for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter )\r
-    connect( *anIter, SIGNAL( clicked() ), SLOT( onSelInputChanged() ) );\r
-\r
-  return aMainGrp;\r
-}\r
-\r
-//=======================================================================\r
-\r
-// name    : SMESHGUI_MeshPatternDlg::createButtonFrame\r
-// Purpose : Create frame containing buttons\r
-//=======================================================================\r
-QFrame* SMESHGUI_MeshPatternDlg::createButtonFrame( QWidget* theParent )\r
-{\r
-  QFrame* aFrame = new QFrame( theParent );\r
-  aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );\r
-\r
-  myOkBtn     = new QPushButton( tr( "SMESH_BUT_OK"    ), aFrame );\r
-  myApplyBtn  = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );\r
-  myCloseBtn  = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );\r
-\r
-  QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );\r
-\r
-  QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );\r
-\r
-  aLay->addWidget( myOkBtn );\r
-  aLay->addWidget( myApplyBtn );\r
-  aLay->addItem( aSpacer);\r
-  aLay->addWidget( myCloseBtn );\r
-\r
-  connect( myOkBtn,    SIGNAL( clicked() ), SLOT( onOk() ) );\r
-  connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;\r
-  connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );\r
-\r
-  return aFrame;\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg\r
-// Purpose : Destructor\r
-//=======================================================================\r
-SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg()\r
-{\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::Init\r
-// Purpose : Init dialog fields, connect signals and slots, show dialog\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::Init( SALOME_Selection* theSelection )\r
-{\r
-  myPattern = SMESH::GetPattern();\r
-  myPreviewActor = 0;\r
-  myIsCreateDlgOpen = false;\r
-  mySelInput = Mesh;\r
-  myType = -1;\r
-  myNbPoints = -1;\r
-  mySelection = theSelection;\r
-  SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();\r
-  aSMESHGUI->SetActiveDialogBox( ( QDialog* )this );\r
-  myMesh = SMESH::SMESH_Mesh::_nil();\r
-\r
-  myMeshShape = GEOM::GEOM_Object::_nil();\r
-  myGeomObj[ Object  ] = GEOM::GEOM_Object::_nil();\r
-  myGeomObj[ Vertex1 ] = GEOM::GEOM_Object::_nil();\r
-  myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();\r
-\r
-  // selection and SMESHGUI\r
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );\r
-  connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );\r
-  connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );\r
-\r
-  myTypeGrp->setButton( Type_2d );\r
-  onTypeChanged( Type_2d );\r
-\r
-  updateGeometry();\r
-\r
-  resize( minimumSize() );\r
-\r
-  activateSelection();\r
-  onSelectionDone();\r
-\r
-  int x, y ;\r
-  aSMESHGUI->DefineDlgPosition( this, x, y );\r
-  this->move( x, y );\r
-  this->show();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::isValid\r
-// Purpose : Verify validity of entry data\r
-//=======================================================================\r
-bool SMESHGUI_MeshPatternDlg::isValid( const bool theMess )\r
-{\r
-  if ( myMesh->_is_nil() || myMeshShape->_is_nil() || myGeomObj[ Object ]->_is_nil() ||\r
-       myGeomObj[ Vertex1 ]->_is_nil() || myType == Type_3d && myGeomObj[ Vertex2 ]->_is_nil() )\r
-  {\r
-    if ( theMess )\r
-      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
-        tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SMESHGUI_INVALID_PARAMETERS" ), QMessageBox::Ok );\r
-    return false;\r
-  }\r
-  else\r
-    return true;\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::onApply\r
-// Purpose : SLOT called when "Apply" button pressed.\r
-//=======================================================================\r
-bool SMESHGUI_MeshPatternDlg::onApply()\r
-{\r
-  try\r
-  {\r
-    if ( !isValid() )\r
-      return false;\r
-\r
-    if ( myType == Type_2d )\r
-      myPattern->ApplyToFace(\r
-        myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() );\r
-    else\r
-      myPattern->ApplyTo3DBlock(\r
-        myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );\r
-\r
-    if ( myPattern->MakeMesh( myMesh ) )\r
-    {\r
-      mySelection->ClearIObjects();\r
-      SMESH::UpdateView();\r
-      SMESHGUI::GetSMESHGUI()->GetActiveStudy()->updateObjBrowser( true );\r
-      return true;\r
-    }\r
-    else\r
-    {\r
-      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
-        tr( "SMESH_ERROR" ), tr( "SMESH_OPERATION_FAILED" ), QMessageBox::Ok );\r
-      return false;\r
-    }\r
-  }\r
-  catch( const SALOME::SALOME_Exception& S_ex )\r
-  {\r
-    QtCatchCorbaException( S_ex );    \r
-  }\r
-  catch( ... )\r
-  {\r
-  }\r
-\r
-  return false;\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::onOk\r
-// Purpose : SLOT called when "Ok" button pressed.\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::onOk()\r
-{\r
-  if ( onApply() )\r
-    onClose();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::onClose\r
-// Purpose : SLOT called when "Close" button pressed. Close dialog\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::onClose()\r
-{\r
-  mySelection->ClearFilters();\r
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );\r
-  disconnect( mySelection, 0, this, 0 );\r
-  disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );\r
-  SMESHGUI::GetSMESHGUI()->ResetState();\r
-  erasePreview();\r
-  reject();\r
-}\r
-\r
-\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::onSelectionDone\r
-// Purpose : SLOT called when selection changed\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::onSelectionDone()\r
-{\r
-  try\r
-  {\r
-    if ( mySelection->IObjectCount() != 1 )\r
-      return;\r
-\r
-    if ( mySelInput == Mesh )\r
-    {\r
-      // Retrieve mesh from selection\r
-      Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();\r
-      SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( anIO );\r
-      if ( aMesh->_is_nil() )\r
-        return;\r
-\r
-      // Get geom object corresponding to the mesh\r
-      SALOMEDS::Study_var aStudy =\r
-        SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getStudyDocument();\r
-\r
-      SALOMEDS::SObject_var aSO = SMESH::FindSObject( aMesh.in() );\r
-      if ( aSO->_is_nil() )\r
-        return;\r
-\r
-      bool isFound = false;\r
-      SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( aSO );\r
-      for( ; anIter->More(); anIter->Next() )\r
-      {\r
-        SALOMEDS::SObject_var aSO = anIter->Value();\r
-        SALOMEDS::SObject_var aRefSO;\r
-\r
-        GEOM::GEOM_Object_var aMeshShape = GEOM::GEOM_Object::_narrow(\r
-          aSO->ReferencedObject( aRefSO )? aRefSO->GetObject() : aSO->GetObject() );\r
-\r
-        if ( !aMeshShape->_is_nil() )\r
-        {\r
-          isFound = true;\r
-          myMeshShape = aMeshShape;\r
-          break;\r
-\r
-        }\r
-      }\r
-\r
-      if ( !isFound )\r
-        return;\r
-\r
-      // Clear fields of geom objects if mesh was changed\r
-      if ( myMesh != aMesh )\r
-      {\r
-        for ( int i = Object; i <= Vertex2; i++ )\r
-        {\r
-          myGeomObj[ i ] = GEOM::GEOM_Object::_nil();\r
-          mySelEdit[ i ]->setText( "" );\r
-        }\r
-      }\r
-\r
-      myMesh = aMesh;\r
-\r
-      // Set name of mesh in line edit\r
-      QString aName;\r
-      SMESH::GetNameOfSelectedIObjects( mySelection, aName );\r
-      mySelEdit[ Mesh ]->setText( aName );\r
-    }\r
-    else\r
-    {\r
-      // Get geom object from selection\r
-      Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();\r
-      GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( anIO );\r
-      if ( anObj->_is_nil() )\r
-        return;\r
-\r
-      // Clear fields of vertexes if face or 3d block was changed\r
-      if ( anObj != myGeomObj[ mySelInput ] && mySelInput == Object )\r
-      {\r
-        for ( int i = Vertex1; i <= Vertex2; i++ )\r
-        {\r
-          myGeomObj[ i ] = GEOM::GEOM_Object::_nil();\r
-          mySelEdit[ i ]->setText( "" );\r
-        }\r
-      }\r
-\r
-      myGeomObj[ mySelInput ] = anObj;\r
-\r
-      // Set name of geom object in line edit\r
-      QString aName;\r
-      SMESH::GetNameOfSelectedIObjects( mySelection, aName );\r
-      mySelEdit[ mySelInput ]->setText( aName );\r
-    }\r
-  }\r
-  catch( const SALOME::SALOME_Exception& S_ex )\r
-  {\r
-    QtCatchCorbaException( S_ex );\r
-    resetSelInput();\r
-  }\r
-  catch( ... )\r
-  {\r
-    resetSelInput();\r
-  }\r
-\r
-  updateWgState();\r
-  displayPreview();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::resetSelInput\r
-// Purpose : Reset fields corresponding to the current selection input\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::resetSelInput()\r
-{\r
-  if ( mySelInput == Mesh )\r
-  {\r
-    myMesh = SMESH::SMESH_Mesh::_nil();\r
-    myMeshShape = GEOM::GEOM_Object::_nil();\r
-  }\r
-\r
-  else\r
-    myGeomObj[ mySelInput ] = GEOM::GEOM_Object::_nil();\r
-\r
-  mySelEdit[ mySelInput ]->setText( "" );\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::onDeactivate\r
-// Purpose : SLOT called when dialog must be deativated\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::onDeactivate()\r
-{\r
-  mySelection->ClearFilters();\r
-  //if ( myReverseChk->isChecked() )\r
-  //  erasePreview();\r
-  disconnect( mySelection, 0, this, 0 );\r
-  setEnabled( false );\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::enterEvent\r
-// Purpose : Event filter\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::enterEvent( QEvent* )\r
-{\r
-  if ( myIsCreateDlgOpen )\r
-    return;\r
-    \r
-  if ( myReverseChk->isChecked() )\r
-    displayPreview();\r
-  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;\r
-  setEnabled( true );\r
-  activateSelection();\r
-  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );\r
-}\r
-\r
-\r
-//=================================================================================\r
-// function : closeEvent()\r
-// purpose  :\r
-//=================================================================================\r
-void SMESHGUI_MeshPatternDlg::closeEvent( QCloseEvent* e )\r
-{\r
-  onClose() ;\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::onSelInputChanged\r
-// Purpose : SLOT. Called when -> button clicked.\r
-//           Change current selection input field\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::onSelInputChanged()\r
-{\r
-  const QObject* aSender = sender();\r
-  for ( int i = Mesh; i <= Vertex2; i++ )\r
-    if ( aSender == mySelBtn[ i ] )\r
-      mySelInput = i;\r
-\r
-  activateSelection();\r
-  onSelectionDone();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::prepareFilters\r
-// Purpose : Prepare filters for dialog\r
-//=======================================================================\r
-\r
-QStringList SMESHGUI_MeshPatternDlg::prepareFilters() const\r
-{\r
-  static QStringList aList;\r
-  if ( aList.isEmpty() )\r
-  {\r
-    aList.append( tr( "PATTERN_FILT" ) );\r
-    //aList.append( tr( "ALL_FILES_FILTER" ) );\r
-  }\r
-\r
-  return aList;\r
-}\r
-\r
-//================================================================\r
-\r
-// Function : SMESHGUI_MeshPatternDlg::autoExtension\r
-// Purpose  : Append extension to the file name\r
-//================================================================\r
-QString SMESHGUI_MeshPatternDlg::autoExtension( const QString& theFileName ) const\r
-{\r
-  QString anExt = theFileName.section( '.', -1 );\r
-  return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::onOpen\r
-// Purpose : SLOT. Called when "Open" button clicked.\r
-//           Displays file open dialog\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::onOpen()\r
-{\r
-  QAD_FileDlg* aDlg = new QAD_FileDlg( this, true );\r
-  aDlg->setCaption( tr( "LOAD_PATTERN" ) );\r
-  aDlg->setMode( QFileDialogP::ExistingFile );\r
-  aDlg->setFilters( prepareFilters() );\r
-  if ( myName->text() != "" )\r
-    aDlg->setSelection( myName->text() + ".smp" );\r
-  QPushButton* anOkBtn = ( QPushButton* )aDlg->child( "OK", "QPushButton" );\r
-  if ( anOkBtn != 0 )\r
-    anOkBtn->setText( tr( "SMESH_BUT_OK" ) );\r
-\r
-  if ( aDlg->exec() != Accepted )\r
-    return;\r
-\r
-  QString fName = aDlg->selectedFile();\r
-  if ( fName.isEmpty() )\r
-    return;\r
-\r
-  if ( QFileInfo( fName ).extension().isEmpty() )\r
-    fName = autoExtension( fName );\r
-\r
-  fName = QDir::convertSeparators( fName );\r
-  \r
-  QString prev = QDir::convertSeparators( myName->text() );\r
-  if ( prev == fName )\r
-    return;\r
-\r
-  // Read string from file\r
-  QFile aFile( fName );\r
-  if ( !aFile.open( IO_ReadOnly ) )\r
-  {\r
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
-      tr( "SMESH_ERROR" ), tr( "ERROR_OF_OPENING" ), QMessageBox::Ok );\r
-    return;\r
-  }\r
-  \r
-  QByteArray aDataArray = aFile.readAll();\r
-  const char* aData = aDataArray.data();\r
-  if ( aData == 0 )\r
-  {\r
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
-      tr( "SMESH_ERROR" ), tr( "ERROR_OF_READING" ), QMessageBox::Ok );\r
-    return;\r
-  }\r
-  \r
-  if ( loadFromFile( aData ) )\r
-    myName->setText( QFileInfo( fName ).baseName() );\r
-    \r
-  updateWgState();\r
-  displayPreview();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::onCloseCreationDlg\r
-// Purpose : SLOT. Called when "Pattern creation" dialog closed with "Close"\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::onCloseCreationDlg()\r
-{\r
-  setEnabled( true );\r
-  myIsCreateDlgOpen = false;\r
-}\r
-\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::onOkCreationDlg\r
-// Purpose : SLOT. Called when "Pattern creation" dialog closed with OK\r
-//           or SAVE buttons. Initialize myPattern field. Redisplay preview\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::onOkCreationDlg()\r
-{\r
-  myPattern = SMESH::SMESH_Pattern::_duplicate( myCreationDlg->GetPattern() );\r
-  myName->setText( myCreationDlg->GetPatternName() );\r
-  displayPreview();\r
-  setEnabled( true );\r
-  myIsCreateDlgOpen = false;\r
-}\r
-\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::onNew\r
-// Purpose : SLOT. Called when "New..." button clicked. Create new pattern\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::onNew()\r
-{\r
-  setEnabled( false );\r
-  myIsCreateDlgOpen = true;\r
-  if ( myCreationDlg == 0 )\r
-  {\r
-    myCreationDlg = new SMESHGUI_CreatePatternDlg( this, mySelection, myType );\r
-    connect( myCreationDlg, SIGNAL( NewPattern() ), SLOT( onOkCreationDlg() ) );\r
-    connect( myCreationDlg, SIGNAL( Close() ), SLOT( onCloseCreationDlg() ) );\r
-  }\r
-  else\r
-    myCreationDlg->Init( mySelection, myType );\r
-\r
-  myCreationDlg->SetMesh( myMesh );\r
-  myCreationDlg->show();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::onReverse\r
-// Purpose : SLOT. Called when state of "Reverse order..." checkbox chaged\r
-//           Calculate new points of the mesh to be created. Redisplay preview\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::onReverse( bool )\r
-{\r
-  displayPreview();\r
-}\r
-\r
-//=======================================================================\r
-\r
-// name    : SMESHGUI_MeshPatternDlg::onPreview\r
-// Purpose : SLOT. Called when state of "Preview" checkbox changed\r
-//           Display/Erase preview\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::onPreview( bool )\r
-{\r
-  displayPreview();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::displayPreview\r
-// Purpose : Display preview\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::displayPreview()\r
-{\r
-  try\r
-  {\r
-    // Redisplay preview in dialog\r
-\r
-    SMESH::point_array_var pnts = myPattern->GetPoints();\r
-    SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();\r
-    SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints();\r
-\r
-    if ( pnts->length()       == 0 ||\r
-         keyPoints->length()  == 0 ||\r
-         elemPoints->length() == 0 )\r
-    {\r
-      erasePreview();\r
-      return;\r
-    }\r
-\r
-    else\r
-    {\r
-      PointVector aPoints( pnts->length() );\r
-      QValueVector<int> aKeyPoints( keyPoints->length() );\r
-      ConnectivityVector anElemPoints( elemPoints->length() );\r
-\r
-      for ( int i = 0, n = pnts->length(); i < n; i++ )\r
-        aPoints[ i ] = pnts[ i ];\r
-\r
-      for ( int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++ )\r
-        aKeyPoints[ i2 ] = keyPoints[ i2 ];\r
-\r
-      for ( int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++ )\r
-      {\r
-        QValueVector<int> aVec( elemPoints[ i3 ].length() );\r
-        for ( int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++ )\r
-          aVec[ i4 ] = elemPoints[ i3 ][ i4 ];\r
-\r
-        anElemPoints[ i3 ] = aVec;\r
-      }\r
-\r
-      myPicture2d->SetPoints( aPoints, aKeyPoints, anElemPoints );\r
-    }\r
-\r
-\r
-    // Redisplay preview in 3D viewer\r
-\r
-    if ( myPreviewActor != 0 )\r
-    {\r
-      if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )\r
-      {\r
-        vf->RemoveActor(myPreviewActor);\r
-        vf->Repaint();\r
-      }\r
-      myPreviewActor->Delete();\r
-      myPreviewActor = 0;\r
-    }\r
-\r
-    if ( !myPreviewChk->isChecked() || !isValid( false ) )\r
-      return;\r
-\r
-    vtkUnstructuredGrid* aGrid = getGrid();\r
-    if ( aGrid == 0 )\r
-      return;\r
-\r
-    // Create and display actor\r
-    vtkDataSetMapper* aMapper = vtkDataSetMapper::New();\r
-    aMapper->SetInput( aGrid );\r
-\r
-    myPreviewActor = SALOME_Actor::New();\r
-    myPreviewActor->PickableOff();\r
-    myPreviewActor->SetMapper( aMapper );\r
-\r
-    vtkProperty* aProp = vtkProperty::New();\r
-    aProp->SetRepresentationToWireframe();\r
-    aProp->SetColor( 250, 0, 250 );\r
-    if ( SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh ) )\r
-      aProp->SetLineWidth( SMESH::GetFloat( "SMESH:SettingsWidth", 1 ) +1 );\r
-    else\r
-      aProp->SetLineWidth( 1 );\r
-    myPreviewActor->SetProperty( aProp );\r
-\r
-    myPreviewActor->SetRepresentation( 3 );\r
-\r
-    SMESH::GetCurrentVtkView()->AddActor( myPreviewActor );\r
-    SMESH::GetCurrentVtkView()->Repaint();\r
-\r
-    aProp->Delete();\r
-    aGrid->Delete();\r
-  }\r
-  catch( const SALOME::SALOME_Exception& S_ex )\r
-  {\r
-    QtCatchCorbaException( S_ex );\r
-    erasePreview();\r
-  }\r
-  catch( ... )\r
-  {\r
-    erasePreview();\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::erasePreview\r
-// Purpose : Erase preview\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::erasePreview()\r
-{\r
-  // Erase preview in 2D viewer\r
-  myPicture2d->SetPoints( PointVector(), QValueVector<int>(), ConnectivityVector() );\r
-\r
-  // Erase preview in 3D viewer\r
-  if ( myPreviewActor == 0 )\r
-    return;\r
-\r
-\r
-  if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )\r
-  {\r
-    vf->RemoveActor(myPreviewActor);\r
-    vf->Repaint();\r
-  }\r
-  myPreviewActor->Delete();\r
-  myPreviewActor = 0;\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::updateWgState\r
-// Purpose : Enable/disable selection widgets\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::updateWgState()\r
-{\r
-  if ( myMesh->_is_nil() )\r
-  {\r
-    for ( int i = Object; i <= Vertex2; i++ )\r
-    {\r
-      mySelBtn [ i ]->setEnabled( false );\r
-      mySelEdit[ i ]->setEnabled( false );\r
-      mySelEdit[ i ]->setText( "" );\r
-    }\r
-  }\r
-  else\r
-  {\r
-    mySelBtn [ Object ]->setEnabled( true );\r
-    mySelEdit[ Object ]->setEnabled( true );\r
-    \r
-    if ( myGeomObj[ Object ]->_is_nil() )\r
-    {\r
-      for ( int i = Vertex1; i <= Vertex2; i++ )\r
-      {\r
-        mySelBtn [ i ]->setEnabled( false );\r
-        mySelEdit[ i ]->setEnabled( false );\r
-        mySelEdit[ i ]->setText( "" );\r
-      }\r
-    }\r
-    else\r
-    {\r
-      for ( int i = Object; i <= Vertex2; i++ )\r
-      {\r
-        mySelBtn [ i ]->setEnabled( true );\r
-        mySelEdit[ i ]->setEnabled( true );\r
-      }\r
-    }\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::activateSelection\r
-// Purpose : Activate selection in accordance with current selection input\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::activateSelection()\r
-{\r
-  mySelection->ClearFilters();\r
-  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );\r
-  \r
-  if ( mySelInput == Object && !myMeshShape->_is_nil() )\r
-  {\r
-    if ( myType == Type_2d )\r
-    {\r
-      if ( myNbPoints > 0 )\r
-        mySelection->AddFilter( new SMESH_NumberFilter( \r
-\r
-          "GEOM", TopAbs_VERTEX, myNbPoints, TopAbs_FACE, myMeshShape ) );\r
-      else\r
-        mySelection->AddFilter( new SMESH_NumberFilter(\r
-          "GEOM", TopAbs_SHAPE, myNbPoints, TopAbs_FACE, myMeshShape ) );\r
-    }\r
-    else\r
-    {\r
-      TColStd_MapOfInteger aTypes;\r
-      aTypes.Add( TopAbs_SHELL );\r
-      aTypes.Add( TopAbs_SOLID );\r
-      mySelection->AddFilter( new SMESH_NumberFilter(\r
-        "GEOM", TopAbs_FACE, 6, aTypes, myMeshShape, true ) );\r
-    }\r
-  }\r
-  else if ( ( mySelInput == Vertex1 || mySelInput == Vertex2 ) && !myGeomObj[ Object ]->_is_nil()  )\r
-  {\r
-    mySelection->AddFilter( new SMESH_NumberFilter(\r
-      "GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX, myGeomObj[ Object ] ) );\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::loadFromFile\r
-// Purpose : Load pattern from file\r
-//=======================================================================\r
-bool SMESHGUI_MeshPatternDlg::loadFromFile( const QString& theName )\r
-{\r
-  try\r
-  {\r
-    SMESH::SMESH_Pattern_var aPattern = SMESH::GetPattern();\r
-\r
-    if ( !aPattern->LoadFromFile( theName.latin1() ) ||\r
-         myType == Type_2d && !aPattern->Is2D())\r
-    {\r
-      SMESH::SMESH_Pattern::ErrorCode aCode = aPattern->GetErrorCode();\r
-      QString aMess;\r
-      if      ( aCode == SMESH::SMESH_Pattern::ERR_READ_NB_POINTS      ) aMess = tr( "ERR_READ_NB_POINTS" );\r
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_POINT_COORDS   ) aMess = tr( "ERR_READ_POINT_COORDS" );\r
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_TOO_FEW_POINTS ) aMess = tr( "ERR_READ_TOO_FEW_POINTS" );\r
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_3D_COORD       ) aMess = tr( "ERR_READ_3D_COORD" );\r
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_NO_KEYPOINT    ) aMess = tr( "ERR_READ_NO_KEYPOINT" );\r
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_INDEX      ) aMess = tr( "ERR_READ_BAD_INDEX" );\r
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_ELEM_POINTS    ) aMess = tr( "ERR_READ_ELEM_POINTS" );\r
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_NO_ELEMS       ) aMess = tr( "ERR_READ_NO_ELEMS" );\r
-      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_KEY_POINT  ) aMess = tr( "ERR_READ_BAD_KEY_POINT" );\r
-      else                                                               aMess = tr( "ERROR_OF_LOADING" );\r
-\r
-      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
-        tr( "SMESH_ERROR" ), aMess, QMessageBox::Ok );\r
-      return false;\r
-    }\r
-    else\r
-    {\r
-      myPattern = aPattern;\r
-      return true;\r
-    }\r
-  }\r
-  catch( const SALOME::SALOME_Exception& S_ex )\r
-  {\r
-    QtCatchCorbaException( S_ex );\r
-    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
-        tr( "SMESH_ERROR" ), tr( "ERROR_OF_LOADING" ), QMessageBox::Ok );\r
-      return false;\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::onTypeChanged\r
-\r
-// Purpose : SLOT. Called when pattern type changed.\r
-//           Change dialog's look and feel\r
-//=======================================================================\r
-void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )\r
-{\r
-  if ( myType == theType )\r
-    return;\r
-\r
-  myType = theType;\r
-\r
-  myNbPoints = -1;\r
-  myGeomObj[ Object  ] = GEOM::GEOM_Object::_nil();\r
-  myGeomObj[ Vertex1 ] = GEOM::GEOM_Object::_nil();\r
-  myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();\r
-  myPattern = SMESH::GetPattern();\r
-\r
-  myName->setText( "" );\r
-  mySelEdit[ Object  ]->setText( "" );\r
-  mySelEdit[ Vertex1 ]->setText( "" );\r
-  mySelEdit[ Vertex2 ]->setText( "" );\r
-\r
-  if ( theType == Type_2d )\r
-  {\r
-    mySelLbl [ Vertex2 ]->hide();\r
-    mySelBtn [ Vertex2 ]->hide();\r
-    mySelEdit[ Vertex2 ]->hide();\r
-    myReverseChk->show();\r
-    myPicture2d->show();\r
-    myPicture3d->hide();\r
-    mySelLbl[ Object  ]->setText( tr( "FACE" ) );\r
-    mySelLbl[ Vertex1 ]->setText( tr( "VERTEX" ) );\r
-  }\r
-  else\r
-  {\r
-    mySelLbl [ Vertex2 ]->show();\r
-    mySelBtn [ Vertex2 ]->show();\r
-    mySelEdit[ Vertex2 ]->show();\r
-    myReverseChk->hide();\r
-    myPicture2d->hide();\r
-    myPicture3d->show();\r
-    mySelLbl[ Object  ]->setText( tr( "3D_BLOCK" ) );\r
-    mySelLbl[ Vertex1 ]->setText( tr( "VERTEX1" ) );\r
-    mySelLbl[ Vertex2 ]->setText( tr( "VERTEX2" ) );\r
-  }\r
-\r
-  mySelInput = Mesh;\r
-  activateSelection();\r
-  updateWgState();\r
-  displayPreview();\r
-}\r
-\r
-//=======================================================================\r
-// name    : SMESHGUI_MeshPatternDlg::getGrid\r
-// Purpose : Get unstructured grid for pattern\r
-//=======================================================================\r
-vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid()\r
-{\r
-  try\r
-  {\r
-    // Get points from pattern\r
-    SMESH::point_array_var pnts = myType == Type_2d\r
-      ? myPattern->ApplyToFace( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() )\r
-      : myPattern->ApplyTo3DBlock( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );\r
-\r
-    SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints();\r
-\r
-    if ( pnts->length() == 0 || elemPoints->length() == 0 )\r
-      return 0;\r
-\r
-    \r
-\r
-    // to do : to be removed /////////////////////////////////////////////\r
-\r
-#ifdef DEB_SLN\r
-    for ( int i1 = 0, n1 = pnts->length(); i1 < n1; i1++ )\r
-      printf( "%d: %g %g %g\n", i1, pnts[ i1 ].x, pnts[ i1 ].y, pnts[ i1 ].z );\r
-\r
-    printf( "\nELEMENTS : \n" );\r
-    for ( int i2 = 0, n2 = elemPoints->length(); i2 < n2; i2++ )\r
-    {\r
-\r
-      printf( "%d: ", i2 );\r
-      for ( int i3 = 0, n3 = elemPoints[ i2 ].length(); i3 < n3; i3++ )\r
-        printf( "%d ", elemPoints[ i2 ][ i3 ] );\r
-\r
-      printf( "\n" );\r
-\r
-    }\r
-#endif\r
-    //////////////////////////////////////////////////////////////////////\r
-\r
-    // Calculate number of points used for cell\r
-    vtkIdType aNbCells = elemPoints->length();\r
-    vtkIdType aCellsSize = 0;\r
-    for ( int i = 0, n = elemPoints->length(); i < n; i++ )\r
-      aCellsSize += elemPoints[ i ].length();\r
-\r
-    // Create unstructured grid and other  usefull arrays\r
-    vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();\r
-\r
-    vtkCellArray* aConnectivity = vtkCellArray::New();\r
-    aConnectivity->Allocate( aCellsSize, 0 );\r
-\r
-    vtkPoints* aPoints = vtkPoints::New();\r
-    aPoints->SetNumberOfPoints( pnts->length() );\r
-\r
-    vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();\r
-    aCellTypesArray->SetNumberOfComponents( 1 );\r
-    aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );\r
-\r
-    vtkIdList *anIdList = vtkIdList::New();\r
-\r
-    // Fill array of points\r
-    for ( int p = 0, nbPnt = pnts->length(); p < nbPnt; p++ )\r
-      aPoints->SetPoint( p, pnts[ p ].x, pnts[ p ].y, pnts[ p ].z );\r
-\r
-    for ( int e = 0, nbElem = elemPoints->length(); e < nbElem; e++ )\r
-    {\r
-      int nbPoints = elemPoints[ e ].length();\r
-      anIdList->SetNumberOfIds( nbPoints );\r
-      for ( int i = 0; i < nbPoints; i++ )\r
-        anIdList->SetId( i, elemPoints[ e ][ i ] );\r
-\r
-      aConnectivity->InsertNextCell( anIdList );\r
-\r
-      if      ( nbPoints == 3 ) aCellTypesArray->InsertNextValue( VTK_TRIANGLE );\r
-      else if ( nbPoints == 5 ) aCellTypesArray->InsertNextValue( VTK_PYRAMID );\r
-      else if ( nbPoints == 6 ) aCellTypesArray->InsertNextValue( VTK_WEDGE );\r
-      else if ( nbPoints == 8 ) aCellTypesArray->InsertNextValue( VTK_HEXAHEDRON );\r
-      else if ( nbPoints == 4 && myType == Type_2d ) aCellTypesArray->InsertNextValue( VTK_QUAD );\r
-      else if ( nbPoints == 4 && myType == Type_3d ) aCellTypesArray->InsertNextValue( VTK_TETRA );\r
-      else aCellTypesArray->InsertNextValue( VTK_EMPTY_CELL );\r
-    }\r
-\r
-    vtkIntArray* aCellLocationsArray = vtkIntArray::New();\r
-    aCellLocationsArray->SetNumberOfComponents( 1 );\r
-    aCellLocationsArray->SetNumberOfTuples( aNbCells );\r
-\r
-    aConnectivity->InitTraversal();\r
-    for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )\r
-      aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );\r
-\r
-    aGrid->SetPoints( aPoints );\r
-    aGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );\r
-\r
-    aConnectivity->Delete();\r
-    aPoints->Delete();\r
-    aCellTypesArray->Delete();\r
-    anIdList->Delete();\r
-    aCellLocationsArray->Delete();\r
-\r
-    return aGrid;\r
-  }\r
-  catch( ... )\r
-  {\r
-    return 0;\r
-  }\r
-}\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESHGUI_MeshPatternDlg.cxx
+//  Author : Sergey LITONIN
+//  Module : SMESH
+
+#include "SMESHGUI_MeshPatternDlg.h"
+
+#include "QAD_Desktop.h"
+#include "QAD_FileDlg.h"
+
+#include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI.h"
+#include "SALOME_Selection.h"
+#include "SMESH_NumberFilter.hxx"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_CreatePatternDlg.h"
+#include "SMESHGUI_PatternWidget.h"
+#include "SMESH_Actor.h"
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "VTKViewer_ViewFrame.h"
+#include "SMESHGUI_PatternUtils.h"
+#include "SMESH_ActorUtils.h"
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_Mesh.hxx"
+
+#include <TColStd_MapOfInteger.hxx>
+
+#include <qframe.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qbuttongroup.h>
+#include <qmessagebox.h>
+#include <qcstring.h>
+#include <qspinbox.h>
+#include <qvaluelist.h>
+
+#include <vtkCell.h>
+#include <vtkIdList.h>
+#include <vtkIntArray.h>
+#include <vtkCellArray.h>
+#include <vtkUnsignedCharArray.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDataSetMapper.h>
+
+#define SPACING 5
+#define MARGIN  10
+
+/*
+  Class       : SMESHGUI_MeshPatternDlg
+  Description : Dialog to specify filters for VTK viewer
+*/
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( QWidget*          theParent,
+                                            SALOME_Selection* theSelection,
+                                            const char*       theName )
+: QDialog( theParent, theName, false,
+         WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+  myBusy( false )
+{
+  setCaption( tr( "CAPTION" ) );
+
+  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+
+  QFrame* aMainFrame = createMainFrame  ( this );
+  QFrame* aBtnFrame  = createButtonFrame( this );
+
+
+
+
+  aDlgLay->addWidget( aMainFrame );
+  aDlgLay->addWidget( aBtnFrame );
+
+  aDlgLay->setStretchFactor( aMainFrame, 1 );
+
+  myCreationDlg = 0;
+  Init( theSelection );
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::createMainFrame
+// Purpose : Create frame containing dialog's input fields
+//=======================================================================
+QFrame* SMESHGUI_MeshPatternDlg::createMainFrame( QWidget* theParent )
+{
+  QPixmap iconSlct( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
+  QPixmap icon2d  ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_2d" ) ) );
+  QPixmap icon3d  ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_3d" ) ) );
+  QPixmap iconOpen( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_FILE_OPEN" ) ) );
+
+  QPixmap iconSample2d( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_2D" ) ) );
+  QPixmap iconSample3d( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_3D" ) ) );
+
+  QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, theParent );
+  aMainGrp->setFrameStyle( QFrame::NoFrame );
+  aMainGrp->setInsideMargin( 0 );
+
+  // Pattern type group
+  
+  myTypeGrp = new QButtonGroup( 1, Qt::Vertical, tr( "PATTERN_TYPE" ), aMainGrp );
+  mySwitch2d = new QRadioButton( myTypeGrp );
+  mySwitch3d = new QRadioButton( myTypeGrp );
+  mySwitch2d->setPixmap( icon2d );
+  mySwitch3d->setPixmap( icon3d );
+  myTypeGrp->insert( mySwitch2d, Type_2d );
+  myTypeGrp->insert( mySwitch3d, Type_3d );
+
+
+  // Mesh group
+  
+  QGroupBox* aMeshGrp = new QGroupBox( 1, Qt::Vertical, tr( "SMESH_MESH" ), aMainGrp );
+  new QLabel( tr( "SMESH_MESH" ), aMeshGrp );
+  mySelBtn[ Mesh ] = new QPushButton( aMeshGrp );
+  mySelBtn[ Mesh ]->setPixmap( iconSlct );
+  mySelEdit[ Mesh ] = new QLineEdit( aMeshGrp );
+  mySelEdit[ Mesh ]->setReadOnly( true );
+
+  // Pattern group
+  
+  QGroupBox* aPatGrp = new QGroupBox( 1, Qt::Horizontal, tr( "PATTERN" ), aMainGrp );
+
+  // pattern name
+  QGroupBox* aNameGrp = new QGroupBox( 1, Qt::Vertical, aPatGrp );
+  aNameGrp->setFrameStyle( QFrame::NoFrame );
+  aNameGrp->setInsideMargin( 0 );
+  new QLabel( tr( "PATTERN" ), aNameGrp );
+  myName = new QLineEdit( aNameGrp );
+  myName->setReadOnly( true );
+  myOpenBtn = new QPushButton( aNameGrp );
+  myOpenBtn->setPixmap( iconOpen );
+  myNewBtn = new QPushButton( tr( "NEW" ), aNameGrp );
+
+  // Mode selection check box
+  myRefine = new QCheckBox( tr( "REFINE" ), aPatGrp );
+
+  // selection widgets for Apply to geom mode
+  myGeomGrp = new QGroupBox( 3, Qt::Horizontal, aPatGrp );
+  myGeomGrp->setFrameStyle( QFrame::NoFrame );
+  myGeomGrp->setInsideMargin( 0 );
+
+  for ( int i = Object; i <= Vertex2; i++ )
+  {
+    mySelLbl[ i ] = new QLabel( myGeomGrp );
+    mySelBtn[ i ] = new QPushButton( myGeomGrp );
+    mySelBtn[ i ]->setPixmap( iconSlct );
+    mySelEdit[ i ] = new QLineEdit( myGeomGrp );
+    mySelEdit[ i ]->setReadOnly( true );
+  }
+
+  // Widgets for refinement of existing mesh elements
+  myRefineGrp = new QFrame( aPatGrp );
+  myRefineGrp->setFrameStyle( QFrame::NoFrame );
+  QGridLayout* aRefGrid = new QGridLayout( myRefineGrp, 3, 3, 0, 5 );
+
+  mySelLbl[ Ids ] = new QLabel( myRefineGrp );
+  mySelBtn[ Ids ] = new QPushButton( myRefineGrp );
+  mySelBtn[ Ids ]->setPixmap( iconSlct );
+  mySelEdit[ Ids ] = new QLineEdit( myRefineGrp );
+
+  QLabel* aNodeLbl = new QLabel( tr( "NODE_1" ), myRefineGrp );
+  myNode1          = new QSpinBox( myRefineGrp );
+  myNode2Lbl       = new QLabel( tr( "NODE_2" ), myRefineGrp );
+  myNode2          = new QSpinBox( myRefineGrp );
+
+  aRefGrid->addWidget( mySelLbl [ Ids ], 0, 0 );
+  aRefGrid->addWidget( mySelBtn [ Ids ], 0, 1 );
+  aRefGrid->addWidget( mySelEdit[ Ids ], 0, 2 );
+  aRefGrid->addWidget( aNodeLbl, 1, 0 );
+  aRefGrid->addMultiCellWidget( myNode1, 1, 1, 1, 2 );
+  aRefGrid->addWidget( myNode2Lbl, 2, 0 );
+  aRefGrid->addMultiCellWidget( myNode2, 2, 2, 1, 2 );
+
+  // reverse check box
+  myReverseChk = new QCheckBox( tr( "REVERSE" ), aPatGrp );
+
+  // Pictures 2d and 3d
+  for ( int i = 0; i < 2; i++ )
+  {
+    if ( i == 0 )
+    {
+      myPicture2d = new SMESHGUI_PatternWidget( aPatGrp ),
+      myPicture2d->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+    }
+    else
+    {
+      myPicture3d = new QFrame( aPatGrp ),
+      myPreview3d = new QLabel( myPicture3d );
+      myPreview3d->setPixmap( iconSample3d );
+      QGridLayout* aLay = new QGridLayout( myPicture3d, 3, 3, 0, 0 );
+      QSpacerItem* aSpacerH1 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+      QSpacerItem* aSpacerH2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+      QSpacerItem* aSpacerV1 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
+      QSpacerItem* aSpacerV2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
+      aLay->addItem( aSpacerH1, 1, 0 );
+      aLay->addItem( aSpacerH2, 1, 2 );
+      aLay->addItem( aSpacerV1, 0, 1 );
+      aLay->addItem( aSpacerV2, 2, 1 );
+      aLay->addWidget( myPreview3d, 1, 1 );
+    }
+  }
+
+  myPreviewChk = new QCheckBox( tr( "PREVIEW" ), aPatGrp );
+
+  // Connect signals and slots
+
+  connect( myTypeGrp,      SIGNAL( clicked( int )  ),               SLOT( onTypeChanged( int ) ) );
+  connect( myOpenBtn,      SIGNAL( clicked()       ),               SLOT( onOpen()             ) );
+  connect( myNewBtn,       SIGNAL( clicked()       ),               SLOT( onNew()              ) );
+  connect( myReverseChk,   SIGNAL( toggled( bool ) ),               SLOT( onReverse( bool )    ) );
+  connect( myPreviewChk,   SIGNAL( toggled( bool ) ),               SLOT( onPreview( bool )    ) );
+  connect( myRefine,       SIGNAL( toggled( bool ) ),               SLOT( onModeToggled( bool ) ) );
+  connect( myNode1,        SIGNAL( valueChanged( int ) ),           SLOT( onNodeChanged( int ) ) );
+  connect( myNode2,        SIGNAL( valueChanged( int ) ),           SLOT( onNodeChanged( int ) ) );
+  connect( mySelEdit[Ids], SIGNAL( textChanged( const QString& ) ), SLOT( onTextChanged( const QString& ) ) );
+
+  QMap< int, QPushButton* >::iterator anIter;
+  for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter )
+    connect( *anIter, SIGNAL( clicked() ), SLOT( onSelInputChanged() ) );
+
+  return aMainGrp;
+}
+
+//=======================================================================
+
+// name    : SMESHGUI_MeshPatternDlg::createButtonFrame
+// Purpose : Create frame containing buttons
+//=======================================================================
+QFrame* SMESHGUI_MeshPatternDlg::createButtonFrame( QWidget* theParent )
+{
+  QFrame* aFrame = new QFrame( theParent );
+  aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+
+  myOkBtn     = new QPushButton( tr( "SMESH_BUT_OK"    ), aFrame );
+  myApplyBtn  = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
+  myCloseBtn  = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
+
+  QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+
+  QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
+
+  aLay->addWidget( myOkBtn );
+  aLay->addWidget( myApplyBtn );
+  aLay->addItem( aSpacer);
+  aLay->addWidget( myCloseBtn );
+
+  connect( myOkBtn,    SIGNAL( clicked() ), SLOT( onOk() ) );
+  connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
+  connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
+
+  return aFrame;
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg
+// Purpose : Destructor
+//=======================================================================
+SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg()
+{
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::Init
+// Purpose : Init dialog fields, connect signals and slots, show dialog
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::Init( SALOME_Selection* theSelection )
+{
+  myPattern = SMESH::GetPattern();
+  myPreviewActor = 0;
+  myIsCreateDlgOpen = false;
+  mySelInput = Mesh;
+  myType = -1;
+  myNbPoints = -1;
+  mySelection = theSelection;
+  SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
+  aSMESHGUI->SetActiveDialogBox( ( QDialog* )this );
+  myMesh = SMESH::SMESH_Mesh::_nil();
+
+  myMeshShape = GEOM::GEOM_Object::_nil();
+  myGeomObj[ Object  ] = GEOM::GEOM_Object::_nil();
+  myGeomObj[ Vertex1 ] = GEOM::GEOM_Object::_nil();
+  myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();
+
+  // selection and SMESHGUI
+  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
+  connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
+  connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+
+  myTypeGrp->setButton( Type_2d );
+  onTypeChanged( Type_2d );
+  onModeToggled( isRefine() );
+
+  updateGeometry();
+
+  resize( minimumSize() );
+
+  activateSelection();
+  onSelectionDone();
+
+  int x, y ;
+  aSMESHGUI->DefineDlgPosition( this, x, y );
+  this->move( x, y );
+  this->show();
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::isValid
+// Purpose : Verify validity of entry data
+//=======================================================================
+bool SMESHGUI_MeshPatternDlg::isValid( const bool theMess )
+{
+  QValueList<int> ids;
+  if ( ( isRefine() && ( myMesh->_is_nil() || !getIds( ids ) || getNode( false ) < 0 || myType == Type_3d && ( getNode( true ) < 0 || getNode( false ) == getNode( true ) ) ) ) 
+       || ( !isRefine() && ( myMesh->_is_nil() || myMeshShape->_is_nil() || myGeomObj[ Object ]->_is_nil() ||
+       myGeomObj[ Vertex1 ]->_is_nil() || myType == Type_3d && myGeomObj[ Vertex2 ]->_is_nil() ) ) )
+  {
+    if ( theMess )
+      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+        tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SMESHGUI_INVALID_PARAMETERS" ), QMessageBox::Ok );
+    return false;
+  }
+  else
+    return true;
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::onApply
+// Purpose : SLOT called when "Apply" button pressed.
+//=======================================================================
+bool SMESHGUI_MeshPatternDlg::onApply()
+{
+  try
+  {
+    if ( !isValid() )
+      return false;
+
+    erasePreview();
+
+    if ( isRefine() ) { // Refining existing mesh elements
+      QValueList<int> ids;
+      getIds( ids );
+      SMESH::long_array_var varIds = new SMESH::long_array();
+      varIds->length( ids.count() );
+      int i = 0;
+      for ( QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it )
+       varIds[i++] = *it;
+      myType == Type_2d
+       ? myPattern->ApplyToMeshFaces  ( myMesh, varIds, getNode( false ), myReverseChk->isChecked() )
+       : myPattern->ApplyToHexahedrons( myMesh, varIds, getNode( false ), getNode( true ) );
+    }
+    else { // Applying a pattern to geometrical object
+    if ( myType == Type_2d )
+      myPattern->ApplyToFace(
+        myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() );
+    else
+      myPattern->ApplyTo3DBlock(
+        myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );
+    }
+
+    if ( myPattern->MakeMesh( myMesh ) )
+    {
+      mySelection->ClearIObjects();
+      SMESH::UpdateView();
+      SMESHGUI::GetSMESHGUI()->GetActiveStudy()->updateObjBrowser( true );
+      return true;
+    }
+    else
+    {
+      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+        tr( "SMESH_ERROR" ), tr( "SMESH_OPERATION_FAILED" ), QMessageBox::Ok );
+      return false;
+    }
+  }
+  catch( const SALOME::SALOME_Exception& S_ex )
+  {
+    QtCatchCorbaException( S_ex );    
+  }
+  catch( ... )
+  {
+  }
+
+  return false;
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::onOk
+// Purpose : SLOT called when "Ok" button pressed.
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onOk()
+{
+  if ( onApply() )
+    onClose();
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::onClose
+// Purpose : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onClose()
+{
+  mySelection->ClearFilters();
+  SMESH::SetPickable();
+  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+  disconnect( mySelection, 0, this, 0 );
+  disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+  SMESHGUI::GetSMESHGUI()->ResetState();
+  erasePreview();
+  reject();
+}
+
+
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::onSelectionDone
+// Purpose : SLOT called when selection changed
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onSelectionDone()
+{
+  if ( myBusy )
+    return;
+  
+  try
+  {
+    if ( mySelInput == Mesh )
+    {
+      if ( mySelection->IObjectCount() != 1 )
+       return;
+
+      // Retrieve mesh from selection
+      Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
+      SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( anIO );
+      if ( aMesh->_is_nil() )
+        return;
+
+      // Get geom object corresponding to the mesh
+      SALOMEDS::Study_var aStudy =
+        SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getStudyDocument();
+
+      SALOMEDS::SObject_var aSO = SMESH::FindSObject( aMesh.in() );
+      if ( aSO->_is_nil() )
+        return;
+
+      bool isFound = false;
+      SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( aSO );
+      for( ; anIter->More(); anIter->Next() )
+      {
+        SALOMEDS::SObject_var aSO = anIter->Value();
+        SALOMEDS::SObject_var aRefSO;
+
+        GEOM::GEOM_Object_var aMeshShape = GEOM::GEOM_Object::_narrow(
+          aSO->ReferencedObject( aRefSO )? aRefSO->GetObject() : aSO->GetObject() );
+
+        if ( !aMeshShape->_is_nil() )
+        {
+          isFound = true;
+          myMeshShape = aMeshShape;
+          break;
+
+        }
+      }
+
+      if ( !isFound )
+        myMeshShape = GEOM::GEOM_Object::_nil();
+
+      // Clear fields of geom objects if mesh was changed
+      if ( myMesh != aMesh )
+      {
+        for ( int i = Object; i <= Ids; i++ )
+        {
+          myGeomObj[ i ] = GEOM::GEOM_Object::_nil();
+          mySelEdit[ i ]->setText( "" );
+        }
+      }
+
+      myMesh = aMesh;
+
+      // Set name of mesh in line edit
+      QString aName;
+      SMESH::GetNameOfSelectedIObjects( mySelection, aName );
+      mySelEdit[ Mesh ]->setText( aName );
+    }
+    else if ( mySelInput == Ids ) {
+      QString anIds;
+      if ( !SMESH::GetNameOfSelectedElements( mySelection, anIds ) )
+       anIds = "";
+      myBusy = true;
+      mySelEdit[ Ids ]->setText( anIds );
+      myBusy = false;
+    }
+    else
+    {
+      if ( mySelection->IObjectCount() != 1 )
+       return;
+
+      // Get geom object from selection
+      Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
+      GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( anIO );
+      if ( anObj->_is_nil() )
+        return;
+
+      // Clear fields of vertexes if face or 3d block was changed
+      if ( anObj != myGeomObj[ mySelInput ] && mySelInput == Object )
+      {
+        for ( int i = Vertex1; i <= Vertex2; i++ )
+        {
+          myGeomObj[ i ] = GEOM::GEOM_Object::_nil();
+          mySelEdit[ i ]->setText( "" );
+        }
+      }
+
+      myGeomObj[ mySelInput ] = anObj;
+
+      // Set name of geom object in line edit
+      QString aName;
+      SMESH::GetNameOfSelectedIObjects( mySelection, aName );
+      mySelEdit[ mySelInput ]->setText( aName );
+    }
+  }
+  catch( const SALOME::SALOME_Exception& S_ex )
+  {
+    QtCatchCorbaException( S_ex );
+    resetSelInput();
+  }
+  catch( ... )
+  {
+    resetSelInput();
+  }
+
+  updateWgState();
+  displayPreview();
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::resetSelInput
+// Purpose : Reset fields corresponding to the current selection input
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::resetSelInput()
+{
+  if ( mySelInput == Mesh )
+  {
+    myMesh = SMESH::SMESH_Mesh::_nil();
+    myMeshShape = GEOM::GEOM_Object::_nil();
+  }
+
+  else
+    myGeomObj[ mySelInput ] = GEOM::GEOM_Object::_nil();
+
+  mySelEdit[ mySelInput ]->setText( "" );
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::onDeactivate
+// Purpose : SLOT called when dialog must be deativated
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onDeactivate()
+{
+  mySelection->ClearFilters();
+  //if ( myReverseChk->isChecked() )
+  //  erasePreview();
+  disconnect( mySelection, 0, this, 0 );
+  setEnabled( false );
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::enterEvent
+// Purpose : Event filter
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::enterEvent( QEvent* )
+{
+  if ( myIsCreateDlgOpen )
+    return;
+    
+  if ( myReverseChk->isChecked() )
+    displayPreview();
+  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;
+  setEnabled( true );
+  activateSelection();
+  connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
+  onTextChanged( mySelEdit[Ids]->text() );
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose  :
+//=================================================================================
+void SMESHGUI_MeshPatternDlg::closeEvent( QCloseEvent* e )
+{
+  onClose() ;
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::onSelInputChanged
+// Purpose : SLOT. Called when -> button clicked.
+//           Change current selection input field
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onSelInputChanged()
+{
+  const QObject* aSender = sender();
+  for ( int i = Mesh; i <= Ids; i++ )
+    if ( aSender == mySelBtn[ i ] )
+      mySelInput = i;
+
+  activateSelection();
+  onSelectionDone();
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::prepareFilters
+// Purpose : Prepare filters for dialog
+//=======================================================================
+
+QStringList SMESHGUI_MeshPatternDlg::prepareFilters() const
+{
+  static QStringList aList;
+  if ( aList.isEmpty() )
+  {
+    aList.append( tr( "PATTERN_FILT" ) );
+    //aList.append( tr( "ALL_FILES_FILTER" ) );
+  }
+
+  return aList;
+}
+
+//================================================================
+
+// Function : SMESHGUI_MeshPatternDlg::autoExtension
+// Purpose  : Append extension to the file name
+//================================================================
+QString SMESHGUI_MeshPatternDlg::autoExtension( const QString& theFileName ) const
+{
+  QString anExt = theFileName.section( '.', -1 );
+  return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::onOpen
+// Purpose : SLOT. Called when "Open" button clicked.
+//           Displays file open dialog
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onOpen()
+{
+  QAD_FileDlg* aDlg = new QAD_FileDlg( this, true );
+  aDlg->setCaption( tr( "LOAD_PATTERN" ) );
+  aDlg->setMode( QFileDialogP::ExistingFile );
+  aDlg->setFilters( prepareFilters() );
+  if ( myName->text() != "" )
+    aDlg->setSelection( myName->text() + ".smp" );
+  QPushButton* anOkBtn = ( QPushButton* )aDlg->child( "OK", "QPushButton" );
+  if ( anOkBtn != 0 )
+    anOkBtn->setText( tr( "SMESH_BUT_OK" ) );
+
+  if ( aDlg->exec() != Accepted )
+    return;
+
+  QString fName = aDlg->selectedFile();
+  if ( fName.isEmpty() )
+    return;
+
+  if ( QFileInfo( fName ).extension().isEmpty() )
+    fName = autoExtension( fName );
+
+  fName = QDir::convertSeparators( fName );
+  
+  QString prev = QDir::convertSeparators( myName->text() );
+  if ( prev == fName )
+    return;
+
+  // Read string from file
+  QFile aFile( fName );
+  if ( !aFile.open( IO_ReadOnly ) )
+  {
+    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+      tr( "SMESH_ERROR" ), tr( "ERROR_OF_OPENING" ), QMessageBox::Ok );
+    return;
+  }
+  
+  QByteArray aDataArray = aFile.readAll();
+  const char* aData = aDataArray.data();
+  if ( aData == 0 )
+  {
+    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+      tr( "SMESH_ERROR" ), tr( "ERROR_OF_READING" ), QMessageBox::Ok );
+    return;
+  }
+  
+  if ( loadFromFile( aData ) )
+    myName->setText( QFileInfo( fName ).baseName() );
+    
+  updateWgState();
+  displayPreview();
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::onCloseCreationDlg
+// Purpose : SLOT. Called when "Pattern creation" dialog closed with "Close"
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onCloseCreationDlg()
+{
+  setEnabled( true );
+  myIsCreateDlgOpen = false;
+}
+
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::onOkCreationDlg
+// Purpose : SLOT. Called when "Pattern creation" dialog closed with OK
+//           or SAVE buttons. Initialize myPattern field. Redisplay preview
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onOkCreationDlg()
+{
+  myPattern = SMESH::SMESH_Pattern::_duplicate( myCreationDlg->GetPattern() );
+  myName->setText( myCreationDlg->GetPatternName() );
+  displayPreview();
+  setEnabled( true );
+  myIsCreateDlgOpen = false;
+}
+
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::onNew
+// Purpose : SLOT. Called when "New..." button clicked. Create new pattern
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onNew()
+{
+  setEnabled( false );
+  myIsCreateDlgOpen = true;
+  if ( myCreationDlg == 0 )
+  {
+    myCreationDlg = new SMESHGUI_CreatePatternDlg( this, mySelection, myType );
+    connect( myCreationDlg, SIGNAL( NewPattern() ), SLOT( onOkCreationDlg() ) );
+    connect( myCreationDlg, SIGNAL( Close() ), SLOT( onCloseCreationDlg() ) );
+  }
+  else
+    myCreationDlg->Init( mySelection, myType );
+
+  myCreationDlg->SetMesh( myMesh );
+  myCreationDlg->show();
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::onReverse
+// Purpose : SLOT. Called when state of "Reverse order..." checkbox chaged
+//           Calculate new points of the mesh to be created. Redisplay preview
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onReverse( bool )
+{
+  displayPreview();
+}
+
+//=======================================================================
+
+// name    : SMESHGUI_MeshPatternDlg::onPreview
+// Purpose : SLOT. Called when state of "Preview" checkbox changed
+//           Display/Erase preview
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onPreview( bool )
+{
+  displayPreview();
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::displayPreview
+// Purpose : Display preview
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::displayPreview()
+{
+  try
+  {
+    // Redisplay preview in dialog
+
+    SMESH::point_array_var pnts = myPattern->GetPoints();
+    SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
+    SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints();
+
+    if ( pnts->length()       == 0 ||
+         keyPoints->length()  == 0 ||
+         elemPoints->length() == 0 )
+    {
+      erasePreview();
+      return;
+    }
+
+    else
+    {
+      PointVector aPoints( pnts->length() );
+      QValueVector<int> aKeyPoints( keyPoints->length() );
+      ConnectivityVector anElemPoints( elemPoints->length() );
+
+      for ( int i = 0, n = pnts->length(); i < n; i++ )
+        aPoints[ i ] = pnts[ i ];
+
+      for ( int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++ )
+        aKeyPoints[ i2 ] = keyPoints[ i2 ];
+
+      for ( int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++ )
+      {
+        QValueVector<int> aVec( elemPoints[ i3 ].length() );
+        for ( int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++ )
+          aVec[ i4 ] = elemPoints[ i3 ][ i4 ];
+
+        anElemPoints[ i3 ] = aVec;
+      }
+
+      myPicture2d->SetPoints( aPoints, aKeyPoints, anElemPoints );
+    }
+
+
+    // Redisplay preview in 3D viewer
+
+    if ( myPreviewActor != 0 )
+    {
+      if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )
+      {
+        vf->RemoveActor(myPreviewActor);
+        vf->Repaint();
+      }
+      myPreviewActor->Delete();
+      myPreviewActor = 0;
+    }
+
+    if ( !myPreviewChk->isChecked() || !isValid( false ) )
+      return;
+
+    vtkUnstructuredGrid* aGrid = getGrid();
+    if ( aGrid == 0 )
+      return;
+
+    // Create and display actor
+    vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
+    aMapper->SetInput( aGrid );
+
+    myPreviewActor = SALOME_Actor::New();
+    myPreviewActor->PickableOff();
+    myPreviewActor->SetMapper( aMapper );
+
+    vtkProperty* aProp = vtkProperty::New();
+    aProp->SetRepresentationToWireframe();
+    aProp->SetColor( 250, 0, 250 );
+    if ( SMESH::FindActorByObject( myMesh ) )
+      aProp->SetLineWidth( SMESH::GetFloat( "SMESH:SettingsWidth", 1 ) +1 );
+    else
+      aProp->SetLineWidth( 1 );
+    myPreviewActor->SetProperty( aProp );
+
+    myPreviewActor->SetRepresentation( 3 );
+
+    SMESH::GetCurrentVtkView()->AddActor( myPreviewActor );
+    SMESH::GetCurrentVtkView()->Repaint();
+
+    aProp->Delete();
+    aGrid->Delete();
+  }
+  catch( const SALOME::SALOME_Exception& S_ex )
+  {
+    QtCatchCorbaException( S_ex );
+    erasePreview();
+  }
+  catch( ... )
+  {
+    erasePreview();
+  }
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::erasePreview
+// Purpose : Erase preview
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::erasePreview()
+{
+  // Erase preview in 2D viewer
+  myPicture2d->SetPoints( PointVector(), QValueVector<int>(), ConnectivityVector() );
+
+  // Erase preview in 3D viewer
+  if ( myPreviewActor == 0 )
+    return;
+
+
+  if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )
+  {
+    vf->RemoveActor(myPreviewActor);
+    vf->Repaint();
+  }
+  myPreviewActor->Delete();
+  myPreviewActor = 0;
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::updateWgState
+// Purpose : Enable/disable selection widgets
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::updateWgState()
+{
+  if ( myMesh->_is_nil() )
+  {
+    for ( int i = Object; i <= Ids; i++ )
+    {
+      mySelBtn [ i ]->setEnabled( false );
+      mySelEdit[ i ]->setEnabled( false );
+      mySelEdit[ i ]->setText( "" );
+    }
+    myNode1->setEnabled( false );
+    myNode2->setEnabled( false );
+    myNode1->setRange( 0, 0 );
+    myNode2->setRange( 0, 0 );
+  }
+  else
+  {
+    mySelBtn [ Object ]->setEnabled( true );
+    mySelEdit[ Object ]->setEnabled( true );
+    mySelBtn [ Ids ]   ->setEnabled( true );
+    mySelEdit[ Ids ]   ->setEnabled( true );
+    
+    if ( myGeomObj[ Object ]->_is_nil() )
+    {
+      for ( int i = Vertex1; i <= Vertex2; i++ )
+      {
+        mySelBtn [ i ]->setEnabled( false );
+        mySelEdit[ i ]->setEnabled( false );
+        mySelEdit[ i ]->setText( "" );
+      }
+    }
+    else
+    {
+      for ( int i = Object; i <= Vertex2; i++ )
+      {
+        mySelBtn [ i ]->setEnabled( true );
+        mySelEdit[ i ]->setEnabled( true );
+      }
+    }
+
+    QValueList<int> ids;
+    if ( !CORBA::is_nil( myPattern ) && getIds( ids ) ) {
+      SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
+      if ( keyPoints->length() ) {
+       myNode1->setEnabled( true );
+       myNode2->setEnabled( true );
+       myNode1->setRange( 1, keyPoints->length() );
+       myNode2->setRange( 1, keyPoints->length() );
+       return;
+      }
+    }
+
+    myNode1->setEnabled( false );
+    myNode2->setEnabled( false );
+    myNode1->setRange( 0, 0 );
+    myNode2->setRange( 0, 0 );
+  }
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::activateSelection
+// Purpose : Activate selection in accordance with current selection input
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::activateSelection()
+{
+  mySelection->ClearFilters();
+  if ( mySelInput == Ids ) {
+    SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
+    if ( anActor )
+      SMESH::SetPickable(anActor);
+
+    if ( myType == Type_2d )
+      QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
+    else
+      QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+  }
+  else {
+    SMESH::SetPickable();
+  QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+  }
+  
+  if ( mySelInput == Object && !myMeshShape->_is_nil() )
+  {
+    if ( myType == Type_2d )
+    {
+      if ( myNbPoints > 0 )
+        mySelection->AddFilter( new SMESH_NumberFilter( 
+
+          "GEOM", TopAbs_VERTEX, myNbPoints, TopAbs_FACE, myMeshShape ) );
+      else
+        mySelection->AddFilter( new SMESH_NumberFilter(
+          "GEOM", TopAbs_SHAPE, myNbPoints, TopAbs_FACE, myMeshShape ) );
+    }
+    else
+    {
+      TColStd_MapOfInteger aTypes;
+      aTypes.Add( TopAbs_SHELL );
+      aTypes.Add( TopAbs_SOLID );
+      mySelection->AddFilter( new SMESH_NumberFilter(
+        "GEOM", TopAbs_FACE, 6, aTypes, myMeshShape, true ) );
+    }
+  }
+  else if ( ( mySelInput == Vertex1 || mySelInput == Vertex2 ) && !myGeomObj[ Object ]->_is_nil()  )
+  {
+    mySelection->AddFilter( new SMESH_NumberFilter(
+      "GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX, myGeomObj[ Object ] ) );
+  }
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::loadFromFile
+// Purpose : Load pattern from file
+//=======================================================================
+bool SMESHGUI_MeshPatternDlg::loadFromFile( const QString& theName )
+{
+  try
+  {
+    SMESH::SMESH_Pattern_var aPattern = SMESH::GetPattern();
+
+    if ( !aPattern->LoadFromFile( theName.latin1() ) ||
+         myType == Type_2d && !aPattern->Is2D())
+    {
+      SMESH::SMESH_Pattern::ErrorCode aCode = aPattern->GetErrorCode();
+      QString aMess;
+      if      ( aCode == SMESH::SMESH_Pattern::ERR_READ_NB_POINTS      ) aMess = tr( "ERR_READ_NB_POINTS" );
+      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_POINT_COORDS   ) aMess = tr( "ERR_READ_POINT_COORDS" );
+      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_TOO_FEW_POINTS ) aMess = tr( "ERR_READ_TOO_FEW_POINTS" );
+      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_3D_COORD       ) aMess = tr( "ERR_READ_3D_COORD" );
+      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_NO_KEYPOINT    ) aMess = tr( "ERR_READ_NO_KEYPOINT" );
+      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_INDEX      ) aMess = tr( "ERR_READ_BAD_INDEX" );
+      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_ELEM_POINTS    ) aMess = tr( "ERR_READ_ELEM_POINTS" );
+      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_NO_ELEMS       ) aMess = tr( "ERR_READ_NO_ELEMS" );
+      else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_KEY_POINT  ) aMess = tr( "ERR_READ_BAD_KEY_POINT" );
+      else                                                               aMess = tr( "ERROR_OF_LOADING" );
+
+      QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+        tr( "SMESH_ERROR" ), aMess, QMessageBox::Ok );
+      return false;
+    }
+    else
+    {
+      myPattern = aPattern;
+      return true;
+    }
+  }
+  catch( const SALOME::SALOME_Exception& S_ex )
+  {
+    QtCatchCorbaException( S_ex );
+    QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+        tr( "SMESH_ERROR" ), tr( "ERROR_OF_LOADING" ), QMessageBox::Ok );
+      return false;
+  }
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::onTypeChanged
+
+// Purpose : SLOT. Called when pattern type changed.
+//           Change dialog's look and feel
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
+{
+  if ( myType == theType )
+    return;
+
+  myType = theType;
+
+  myNbPoints = -1;
+  myGeomObj[ Object  ] = GEOM::GEOM_Object::_nil();
+  myGeomObj[ Vertex1 ] = GEOM::GEOM_Object::_nil();
+  myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();
+  myPattern = SMESH::GetPattern();
+
+  myName->setText( "" );
+  mySelEdit[ Object  ]->setText( "" );
+  mySelEdit[ Vertex1 ]->setText( "" );
+  mySelEdit[ Vertex2 ]->setText( "" );
+  mySelEdit[ Ids ]    ->setText( "" );
+
+  if ( theType == Type_2d )
+  {
+    // Geom widgets
+    mySelLbl [ Vertex2 ]->hide();
+    mySelBtn [ Vertex2 ]->hide();
+    mySelEdit[ Vertex2 ]->hide();
+    myReverseChk->show();
+    myPicture2d->show();
+    myPicture3d->hide();
+    mySelLbl[ Object  ]->setText( tr( "FACE" ) );
+    mySelLbl[ Vertex1 ]->setText( tr( "VERTEX" ) );
+    // Refine widgets
+    mySelLbl[ Ids ]->setText( tr( "MESH_FACES" ) );
+    myNode2Lbl->hide();
+    myNode2   ->hide();
+  }
+  else
+  {
+    // Geom widgets
+    mySelLbl [ Vertex2 ]->show();
+    mySelBtn [ Vertex2 ]->show();
+    mySelEdit[ Vertex2 ]->show();
+    myReverseChk->hide();
+    myPicture2d->hide();
+    myPicture3d->show();
+    mySelLbl[ Object  ]->setText( tr( "3D_BLOCK" ) );
+    mySelLbl[ Vertex1 ]->setText( tr( "VERTEX1" ) );
+    mySelLbl[ Vertex2 ]->setText( tr( "VERTEX2" ) );
+    // Refine widgets
+    mySelLbl[ Ids ]->setText( tr( "MESH_VOLUMES" ) );
+    myNode2Lbl->show();
+    myNode2   ->show();
+  }
+
+  mySelInput = Mesh;
+  activateSelection();
+  updateWgState();
+  displayPreview();
+}
+
+//=======================================================================
+// name    : SMESHGUI_MeshPatternDlg::getGrid
+// Purpose : Get unstructured grid for pattern
+//=======================================================================
+vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid()
+{
+  try
+  {
+    // Get points from pattern
+    SMESH::point_array_var pnts;
+    QValueList<int> ids;
+    if ( isRefine() && getIds( ids ) ) {
+      SMESH::long_array_var varIds = new SMESH::long_array();
+      varIds->length( ids.count() );
+      int i = 0;
+      for ( QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it )
+       varIds[i++] = *it;
+      pnts = myType == Type_2d
+       ? myPattern->ApplyToMeshFaces  ( myMesh, varIds, getNode( false ), myReverseChk->isChecked() )
+       : myPattern->ApplyToHexahedrons( myMesh, varIds, getNode( false ), getNode( true ) );
+    }
+    else {
+      pnts = myType == Type_2d
+       ? myPattern->ApplyToFace   ( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() )
+      : myPattern->ApplyTo3DBlock( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );
+    }
+
+    SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints();
+
+    if ( pnts->length() == 0 || elemPoints->length() == 0 )
+      return 0;
+
+    
+
+    // to do : to be removed /////////////////////////////////////////////
+
+#ifdef DEB_SLN
+    for ( int i1 = 0, n1 = pnts->length(); i1 < n1; i1++ )
+      printf( "%d: %g %g %g\n", i1, pnts[ i1 ].x, pnts[ i1 ].y, pnts[ i1 ].z );
+
+    printf( "\nELEMENTS : \n" );
+    for ( int i2 = 0, n2 = elemPoints->length(); i2 < n2; i2++ )
+    {
+
+      printf( "%d: ", i2 );
+      for ( int i3 = 0, n3 = elemPoints[ i2 ].length(); i3 < n3; i3++ )
+        printf( "%d ", elemPoints[ i2 ][ i3 ] );
+
+      printf( "\n" );
+
+    }
+#endif
+    //////////////////////////////////////////////////////////////////////
+
+    // Calculate number of points used for cell
+    vtkIdType aNbCells = elemPoints->length();
+    vtkIdType aCellsSize = 0;
+    for ( int i = 0, n = elemPoints->length(); i < n; i++ )
+      aCellsSize += elemPoints[ i ].length();
+
+    // Create unstructured grid and other  usefull arrays
+    vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
+
+    vtkCellArray* aConnectivity = vtkCellArray::New();
+    aConnectivity->Allocate( aCellsSize, 0 );
+
+    vtkPoints* aPoints = vtkPoints::New();
+    aPoints->SetNumberOfPoints( pnts->length() );
+
+    vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+    aCellTypesArray->SetNumberOfComponents( 1 );
+    aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
+
+    vtkIdList *anIdList = vtkIdList::New();
+
+    // Fill array of points
+    for ( int p = 0, nbPnt = pnts->length(); p < nbPnt; p++ )
+      aPoints->SetPoint( p, pnts[ p ].x, pnts[ p ].y, pnts[ p ].z );
+
+    for ( int e = 0, nbElem = elemPoints->length(); e < nbElem; e++ )
+    {
+      int nbPoints = elemPoints[ e ].length();
+      anIdList->SetNumberOfIds( nbPoints );
+      for ( int i = 0; i < nbPoints; i++ )
+        anIdList->SetId( i, elemPoints[ e ][ i ] );
+
+      aConnectivity->InsertNextCell( anIdList );
+
+      if      ( nbPoints == 3 ) aCellTypesArray->InsertNextValue( VTK_TRIANGLE );
+      else if ( nbPoints == 5 ) aCellTypesArray->InsertNextValue( VTK_PYRAMID );
+      else if ( nbPoints == 6 ) aCellTypesArray->InsertNextValue( VTK_WEDGE );
+      else if ( nbPoints == 8 ) aCellTypesArray->InsertNextValue( VTK_HEXAHEDRON );
+      else if ( nbPoints == 4 && myType == Type_2d ) aCellTypesArray->InsertNextValue( VTK_QUAD );
+      else if ( nbPoints == 4 && myType == Type_3d ) aCellTypesArray->InsertNextValue( VTK_TETRA );
+      else aCellTypesArray->InsertNextValue( VTK_EMPTY_CELL );
+    }
+
+    vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+    aCellLocationsArray->SetNumberOfComponents( 1 );
+    aCellLocationsArray->SetNumberOfTuples( aNbCells );
+
+    aConnectivity->InitTraversal();
+    for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
+      aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+
+    aGrid->SetPoints( aPoints );
+    aGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
+
+    aConnectivity->Delete();
+    aPoints->Delete();
+    aCellTypesArray->Delete();
+    anIdList->Delete();
+    aCellLocationsArray->Delete();
+
+    return aGrid;
+  }
+  catch( ... )
+  {
+    return 0;
+  }
+}
+
+//=======================================================================
+// name    : onModeToggled
+// Purpose : 
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onModeToggled( bool on )
+{
+  on ? myRefineGrp->show() : myRefineGrp->hide();
+  on ? myGeomGrp->hide()   : myGeomGrp->show();
+}
+
+//=======================================================================
+// name    : isRefine
+// Purpose : 
+//=======================================================================
+bool SMESHGUI_MeshPatternDlg::isRefine() const
+{
+  return myRefine->isChecked();
+}
+
+//=======================================================================
+//function : onTextChanged
+//purpose  : 
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onTextChanged(const QString& theNewText)
+{
+  if ( myBusy || !isRefine() )
+    return;
+
+  myBusy = true;
+
+  if ( mySelInput != Ids ) {
+    mySelInput = Ids;
+    activateSelection();
+  }
+
+  // hilight entered elements/nodes
+  SMDS_Mesh* aMesh = 0;
+  SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
+  if ( anActor )
+    aMesh = anActor->GetObject()->GetMesh();
+
+  if ( aMesh ) {
+    mySelection->ClearIObjects();
+    mySelection->AddIObject( anActor->getIO() );
+
+    QStringList aListId = QStringList::split( " ", theNewText, false);
+
+    for ( int i = 0; i < aListId.count(); i++ ) {
+      const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
+      if ( e && e->GetType() == ( myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume ) ) {
+       if ( !mySelection->IsIndexSelected( anActor->getIO(), e->GetID() ) )
+         mySelection->AddOrRemoveIndex( anActor->getIO(), e->GetID(), true );
+      }
+    }
+  }
+
+  myBusy = false;
+}
+
+//=======================================================================
+//function : onNodeChanged
+//purpose  : 
+//=======================================================================
+void SMESHGUI_MeshPatternDlg::onNodeChanged( int value )
+{
+  if ( myType == Type_3d ) {
+    QSpinBox* first = (QSpinBox*)sender();
+    QSpinBox* second = first == myNode1 ? myNode2 : myNode1;
+    int secondVal = second->value();
+    if ( secondVal == value ) {
+      secondVal = value == second->maxValue() ? second->minValue() : value + 1;
+      bool blocked = second->signalsBlocked();
+      second->blockSignals( true );
+      second->setValue( secondVal );
+      second->blockSignals( blocked );
+    }
+  }
+
+  displayPreview();
+}
+
+//=======================================================================
+//function : getIds
+//purpose  : 
+//=======================================================================
+bool SMESHGUI_MeshPatternDlg::getIds( QValueList<int>& ids ) const
+{
+  ids.clear();
+  QStringList strIds = QStringList::split( " ", mySelEdit[Ids]->text() );
+  bool isOk;
+  int val;
+  for ( QStringList::iterator it = strIds.begin(); it != strIds.end(); ++it ) {
+    val = (*it).toInt( &isOk );
+    if ( isOk )
+      ids.append( val );
+  }
+
+  return ids.count();
+}
+
+//=======================================================================
+//function : getNode1
+//purpose  : 
+//=======================================================================
+int SMESHGUI_MeshPatternDlg::getNode( bool second ) const
+{
+  return second ? myNode2->value() - 1 : myNode1->value() - 1;
+}
+
index 1c1787b0cac7e3ece63d094059c90d9c3e0b5428..26a7332365a116fdc5570cd1975e04a196275412 100755 (executable)
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
-// \r
-//  This library is free software; you can redistribute it and/or \r
-//  modify it under the terms of the GNU Lesser General Public \r
-//  License as published by the Free Software Foundation; either \r
-//  version 2.1 of the License. \r
-// \r
-//  This library is distributed in the hope that it will be useful, \r
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU \r
-//  Lesser General Public License for more details. \r
-// \r
-//  You should have received a copy of the GNU Lesser General Public \r
-//  License along with this library; if not, write to the Free Software \r
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA \r
-// \r
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
-//\r
-//\r
-//\r
-//  File   : SMESHGUI_MeshPatternDlg.h\r
-//  Author : Sergey LITONIN\r
-//  Module : SMESH\r
-\r
-\r
-#ifndef SMESHGUI_MeshPatternDlg_H\r
-#define SMESHGUI_MeshPatternDlg_H\r
-\r
-#include <qdialog.h>\r
-\r
-// IDL Headers\r
-#include <SALOMEconfig.h>\r
-#include CORBA_SERVER_HEADER(GEOM_Gen)\r
-#include CORBA_SERVER_HEADER(SMESH_Mesh)\r
-#include CORBA_SERVER_HEADER(SMESH_Pattern)\r
-\r
-class QCloseEvent;\r
-class QFrame;\r
-class QLineEdit;\r
-class SMESHGUI_SpinBox;\r
-class QPushButton;\r
-class SALOME_Selection;\r
-class QRadioButton;\r
-class QCheckBox;\r
-class QButtonGroup;\r
-class QLabel;\r
-class SMESHGUI_CreatePatternDlg;\r
-class SMESHGUI_PatternWidget;\r
-class vtkUnstructuredGrid;\r
-class SALOME_Actor;\r
-\r
-/*\r
-  Class       : SMESHGUI_MeshPatternDlg\r
-  Description : Dialog to specify filters for VTK viewer\r
-*/\r
-\r
-class SMESHGUI_MeshPatternDlg : public QDialog\r
-{\r
-  Q_OBJECT\r
-\r
-  // Pattern type\r
-  enum { Type_2d, Type_3d };\r
-\r
-  // selection input\r
-  enum { Mesh, Object, Vertex1, Vertex2 };\r
-\r
-public:\r
-                                      SMESHGUI_MeshPatternDlg( QWidget*,\r
-                                                               SALOME_Selection*,\r
-                                                               const char* = 0 );\r
-  virtual                             ~SMESHGUI_MeshPatternDlg();\r
-\r
-  void                                Init( SALOME_Selection* );\r
-  \r
-private slots:\r
-\r
-  void                                onOk();\r
-  bool                                onApply();\r
-  void                                onClose();\r
-\r
-  void                                onDeactivate();\r
-\r
-  void                                onSelectionDone();\r
-  void                                onSelInputChanged();\r
-\r
-  void                                onTypeChanged( int );\r
-  void                                onOpen();\r
-  void                                onNew();\r
-  void                                onReverse( bool );\r
-  void                                onPreview( bool );\r
-  void                                onOkCreationDlg();\r
-  void                                onCloseCreationDlg();\r
-\r
-private:\r
-\r
-  QFrame*                             createButtonFrame( QWidget* );\r
-  QFrame*                             createMainFrame  ( QWidget* );\r
-  void                                displayPreview();\r
-  vtkUnstructuredGrid*                getGrid();\r
-  void                                erasePreview();\r
-  void                                updateWgState();\r
-  bool                                loadFromFile( const QString& );\r
-  void                                activateSelection();\r
-  QStringList                         prepareFilters() const;\r
-  QString                             autoExtension( const QString& theFileName ) const;\r
-  void                                closeEvent( QCloseEvent* e ) ;\r
-  void                                enterEvent ( QEvent * ) ;\r
-  bool                                isValid( const bool theMess = true );\r
-  void                                resetSelInput();\r
-\r
-private:\r
-\r
-  QPushButton*                        myOkBtn;\r
-  QPushButton*                        myApplyBtn;\r
-  QPushButton*                        myCloseBtn;\r
-\r
-  QButtonGroup*                       myTypeGrp;\r
-  QRadioButton*                       mySwitch2d;\r
-  QRadioButton*                       mySwitch3d;\r
-\r
-  QMap< int, QPushButton* >           mySelBtn;\r
-  QMap< int, QLineEdit* >             mySelEdit;\r
-  QMap< int, QLabel* >                mySelLbl;\r
-\r
-  QLineEdit*                          myName;\r
-  QPushButton*                        myOpenBtn;\r
-  QPushButton*                        myNewBtn;\r
-\r
-  QCheckBox*                          myReverseChk;\r
-  SMESHGUI_PatternWidget*             myPicture2d;\r
-  QFrame*                             myPicture3d;\r
-  QLabel*                             myPreview3d;\r
-\r
-  QCheckBox*                          myPreviewChk;\r
-    \r
-  SALOME_Selection*                   mySelection;\r
-  int                                 mySelInput;\r
-  int                                 myNbPoints;\r
-  int                                 myType;\r
-  bool                                myIsCreateDlgOpen;\r
-\r
-  SMESH::SMESH_Mesh_var               myMesh;\r
-  GEOM::GEOM_Object_var               myMeshShape;\r
-  QMap< int, GEOM::GEOM_Object_var >  myGeomObj;\r
-  \r
-  SMESHGUI_CreatePatternDlg*          myCreationDlg;\r
-  SMESH::SMESH_Pattern_var            myPattern;\r
-  SALOME_Actor*                       myPreviewActor;\r
-};\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESHGUI_MeshPatternDlg.h
+//  Author : Sergey LITONIN
+//  Module : SMESH
+
+
+#ifndef SMESHGUI_MeshPatternDlg_H
+#define SMESHGUI_MeshPatternDlg_H
+
+#include <qdialog.h>
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_SERVER_HEADER(SMESH_Pattern)
+
+class QCloseEvent;
+class QFrame;
+class QLineEdit;
+class SMESHGUI_SpinBox;
+class QPushButton;
+class SALOME_Selection;
+class QRadioButton;
+class QCheckBox;
+class QButtonGroup;
+class QLabel;
+class QSpinBox;
+class QGroupBox;
+class SMESHGUI_CreatePatternDlg;
+class SMESHGUI_PatternWidget;
+class vtkUnstructuredGrid;
+class SALOME_Actor;
+
+/*
+  Class       : SMESHGUI_MeshPatternDlg
+  Description : Dialog to specify filters for VTK viewer
+*/
+
+class SMESHGUI_MeshPatternDlg : public QDialog
+{
+  Q_OBJECT
+
+  // Pattern type
+  enum { Type_2d, Type_3d };
+
+  // selection input
+  enum { Mesh, Object, Vertex1, Vertex2, Ids };
+
+public:
+                                      SMESHGUI_MeshPatternDlg( QWidget*,
+                                                               SALOME_Selection*,
+                                                               const char* = 0 );
+  virtual                             ~SMESHGUI_MeshPatternDlg();
+
+  void                                Init( SALOME_Selection* );
+  
+private slots:
+
+  void                                onOk();
+  bool                                onApply();
+  void                                onClose();
+
+  void                                onDeactivate();
+
+  void                                onSelectionDone();
+  void                                onSelInputChanged();
+
+  void                                onTypeChanged( int );
+  void                                onModeToggled( bool );
+  void                                onOpen();
+  void                                onNew();
+  void                                onReverse( bool );
+  void                                onPreview( bool );
+  void                                onOkCreationDlg();
+  void                                onCloseCreationDlg();
+  void                                onTextChanged( const QString& );
+  void                                onNodeChanged( int value );
+
+private:
+
+  QFrame*                             createButtonFrame( QWidget* );
+  QFrame*                             createMainFrame  ( QWidget* );
+  void                                displayPreview();
+  vtkUnstructuredGrid*                getGrid();
+  void                                erasePreview();
+  void                                updateWgState();
+  bool                                loadFromFile( const QString& );
+  void                                activateSelection();
+  QStringList                         prepareFilters() const;
+  QString                             autoExtension( const QString& theFileName ) const;
+  void                                closeEvent( QCloseEvent* e ) ;
+  void                                enterEvent ( QEvent * ) ;
+  bool                                isValid( const bool theMess = true );
+  void                                resetSelInput();
+  bool                                isRefine() const;
+
+  bool                                getIds( QValueList<int>& ) const;
+  int                                 getNode( bool = false ) const;
+
+private:
+
+  QPushButton*                        myOkBtn;
+  QPushButton*                        myApplyBtn;
+  QPushButton*                        myCloseBtn;
+
+  QButtonGroup*                       myTypeGrp;
+  QRadioButton*                       mySwitch2d;
+  QRadioButton*                       mySwitch3d;
+
+  QCheckBox*                          myRefine;
+
+  QFrame*                             myRefineGrp;
+  QSpinBox*                           myNode1;
+  QSpinBox*                           myNode2;
+  QLabel*                             myNode2Lbl;
+
+  QGroupBox*                          myGeomGrp;
+  QMap< int, QPushButton* >           mySelBtn;
+  QMap< int, QLineEdit* >             mySelEdit;
+  QMap< int, QLabel* >                mySelLbl;
+
+  QLineEdit*                          myName;
+  QPushButton*                        myOpenBtn;
+  QPushButton*                        myNewBtn;
+
+  QCheckBox*                          myReverseChk;
+  SMESHGUI_PatternWidget*             myPicture2d;
+  QFrame*                             myPicture3d;
+  QLabel*                             myPreview3d;
+
+  QCheckBox*                          myPreviewChk;
+    
+  SALOME_Selection*                   mySelection;
+  int                                 mySelInput;
+  int                                 myNbPoints;
+  int                                 myType;
+  bool                                myIsCreateDlgOpen;
+  bool                                myBusy;
+
+  SMESH::SMESH_Mesh_var               myMesh;
+  GEOM::GEOM_Object_var               myMeshShape;
+  QMap< int, GEOM::GEOM_Object_var >  myGeomObj;
+  
+  SMESHGUI_CreatePatternDlg*          myCreationDlg;
+  SMESH::SMESH_Pattern_var            myPattern;
+  SALOME_Actor*                       myPreviewActor;
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index da81e169eb4aaa991f9e06ca7800e34e5f6cb7a1..b1662d8e64175f0d3ba5ec06e0e5553e415327ab 100755 (executable)
 #include <qpushbutton.h>
 #include <qapplication.h>
 
 #include <qpushbutton.h>
 #include <qapplication.h>
 
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
 #define SPACING 5
 #define MARGIN  10
 
 #define SPACING 5
 #define MARGIN  10
 
@@ -152,11 +156,13 @@ QFrame* SMESHGUI_MultiEditDlg::createMainFrame( QWidget* theParent )
   mySubmeshChk = new QCheckBox( tr( "SMESH_SUBMESH" ), aGrp );
   mySubmeshBtn = new QPushButton( aGrp );
   mySubmesh = new QLineEdit( aGrp );
   mySubmeshChk = new QCheckBox( tr( "SMESH_SUBMESH" ), aGrp );
   mySubmeshBtn = new QPushButton( aGrp );
   mySubmesh = new QLineEdit( aGrp );
+  mySubmesh->setReadOnly( true );
   mySubmeshBtn->setPixmap( aPix );
   
   myGroupChk = new QCheckBox( tr( "GROUP" ), aGrp );
   myGroupBtn = new QPushButton( aGrp );
   myGroup = new QLineEdit( aGrp );
   mySubmeshBtn->setPixmap( aPix );
   
   myGroupChk = new QCheckBox( tr( "GROUP" ), aGrp );
   myGroupBtn = new QPushButton( aGrp );
   myGroup = new QLineEdit( aGrp );
+  myGroup->setReadOnly( true );
   myGroupBtn->setPixmap( aPix );
 
   return aMainGrp;
   myGroupBtn->setPixmap( aPix );
 
   return aMainGrp;
index 872c2015fecb53886601558f1e2d917e827531a4..67b0daa2310cfec249b9c58e245e6abc9ae84356 100644 (file)
@@ -46,6 +46,8 @@
 #include "QAD_MessageBox.h"
 
 #include "SMESH_Actor.h"
 #include "QAD_MessageBox.h"
 
 #include "SMESH_Actor.h"
+#include "SMESH_ObjectDef.h"
+
 #include "SMDS_Mesh.hxx"
 #include "SMDS_MeshNode.hxx"
 
 #include "SMDS_Mesh.hxx"
 #include "SMDS_MeshNode.hxx"
 
index b55413f09530a9013d2a312c32500fc9e131a458..c2474d067ffbbceb207f0f7b8f351774280b3cfe 100644 (file)
@@ -602,7 +602,6 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
          myActor = anActor;
          vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
          
          myActor = anActor;
          vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
          
-         double aMin = 0.0, aMax = 0.0;
          if ( myScalarBarActor->GetLookupTable() ) {
            float *range = myScalarBarActor->GetLookupTable()->GetRange();
            myMinEdit->setText( QString::number( range[0] ) );
          if ( myScalarBarActor->GetLookupTable() ) {
            float *range = myScalarBarActor->GetLookupTable()->GetRange();
            myMinEdit->setText( QString::number( range[0] ) );
index 35b9df5ef96a4c20349f6483845db15e117c3c61..00ede0b48b97be7f86dda60ad901e52749e0ca0a 100644 (file)
@@ -246,7 +246,6 @@ void SMESHGUI_RenumberingDlg::ClickOnApply()
   
   if ( !myMesh->_is_nil())
     {
   
   if ( !myMesh->_is_nil())
     {
-      bool aResult = false;
       try
        {
          SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
       try
        {
          SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
index 9b7be8bb4c9dae35b1c7d396078ab9209c5cbfa2..f7782b57dc44dc2977995108bb618b36ab04783b 100644 (file)
 #include <qvalidator.h>
 #include <qpixmap.h>
 
 #include <qvalidator.h>
 #include <qpixmap.h>
 
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
 using namespace std;
 
 //=================================================================================
 using namespace std;
 
 //=================================================================================
index a060d034a6954cd89ca89bcce75aa99c363fe7ed..fd7253b76e22edd6a31cfee198fc5e1f58b58ea1 100644 (file)
 #include <qlayout.h>
 #include <qpixmap.h>
 
 #include <qlayout.h>
 #include <qpixmap.h>
 
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
 using namespace std;
 
 //=================================================================================
 using namespace std;
 
 //=================================================================================
index dbbdfd30b0477ecf08d0d38c7adc6be24a9301d9..3099baeb0130867ac3831c27de0a76c55e90ebae 100644 (file)
 #include <qvalidator.h>
 #include <qpixmap.h>
 
 #include <qvalidator.h>
 #include <qpixmap.h>
 
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
 using namespace std;
 
 //=================================================================================
 using namespace std;
 
 //=================================================================================
index 4fdf10e86625b9d572926cb96efb9f6814cafa85..fab8312d2133e9d1a9709fe8419ecacce2e00969 100644 (file)
@@ -44,16 +44,17 @@ public :
   SMESHGUI_SpinBox( QWidget* parent, const char* name = 0 ) ;
   ~SMESHGUI_SpinBox() ;
   
   SMESHGUI_SpinBox( QWidget* parent, const char* name = 0 ) ;
   ~SMESHGUI_SpinBox() ;
   
-  void    RangeStepAndValidator( double         min = -1000000.0, 
-                                double         max = +1000000.0, 
-                                double         step = 100.0, 
-                                unsigned short decimals = 3 ) ;
-  void    SetValue( double v ) ;
-  double  GetValue() ;
-  QString GetString() ;
+  void       RangeStepAndValidator( double         min = -1000000.0, 
+                                   double         max = +1000000.0, 
+                                   double         step = 100.0, 
+                                   unsigned short decimals = 3 ) ;
+  void       SetValue( double v ) ;
+  double     GetValue() ;
+  QString    GetString() ;
+  QLineEdit* editor() { return QAD_SpinBoxDbl::editor(); } 
 
 public slots:
 
 public slots:
-  void    SetStep( double newStep );
+  void       SetStep( double newStep );
 
 };
 #endif //  SMESHSPINBOX_H
 
 };
 #endif //  SMESHSPINBOX_H
index 31a92ef231e751db54ff8d6f256880fbbe5f9350..1186ce9d4f8fede4585e1600da42fbfe07b02b83 100644 (file)
 #include <qlayout.h>
 #include <qpixmap.h>
 
 #include <qlayout.h>
 #include <qpixmap.h>
 
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
 using namespace std;
 
 //=================================================================================
 using namespace std;
 
 //=================================================================================
index 641ec5c7b39b3864b8b70f2f322cfa2071fcedc2..0bb568609bb4aaebec9d26846006363008183922 100644 (file)
 #include <qspinbox.h> 
 #include <qpixmap.h>
 
 #include <qspinbox.h> 
 #include <qpixmap.h>
 
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
 using namespace std;
 
 //=================================================================================
 using namespace std;
 
 //=================================================================================
index 42e6db2615853cf3a6ad4abc84d8ff0a828f941a..15a7be0391e4de7175d487e57f992512a4c42547 100644 (file)
@@ -50,6 +50,7 @@
 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
 
 #include "SMESH_Actor.h"
 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
 
 #include "SMESH_Actor.h"
+#include "SMESH_ObjectDef.h"
 
 using namespace std;
 
 
 using namespace std;
 
@@ -155,6 +156,19 @@ namespace SMESH{
   }
 
 
   }
 
 
+  void RepaintViewFrame(VTKViewer_ViewFrame* theFrame)
+  {
+    theFrame->Repaint();
+  }
+
+
+  void RenderViewFrame(VTKViewer_ViewFrame* theFrame)
+  {
+    theFrame->getRW()->getRenderWindow()->Render();
+    theFrame->Repaint();
+  }
+
+
   SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame, 
                                const char* theEntry)
   {
   SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame, 
                                const char* theEntry)
   {
@@ -506,7 +520,7 @@ namespace SMESH{
   {
     theName = "";
     if(theIO->hasEntry()){
   {
     theName = "";
     if(theIO->hasEntry()){
-      if(SMESH_Actor *anActor = FindActorByEntry(theIO->getEntry())){
+      if(FindActorByEntry(theIO->getEntry())){
        TColStd_IndexedMapOfInteger aMapIndex;
        theSel->GetIndex(theIO,aMapIndex);
        for(int i = 1; i <= aMapIndex.Extent(); i++){
        TColStd_IndexedMapOfInteger aMapIndex;
        theSel->GetIndex(theIO,aMapIndex);
        for(int i = 1; i <= aMapIndex.Extent(); i++){
@@ -535,7 +549,7 @@ namespace SMESH{
   {
     theName = "";
     if(theIO->hasEntry()){
   {
     theName = "";
     if(theIO->hasEntry()){
-      if(SMESH_Actor *anActor = FindActorByEntry(theIO->getEntry())){
+      if(FindActorByEntry(theIO->getEntry())){
        TColStd_IndexedMapOfInteger aMapIndex;
        theSel->GetIndex(theIO,aMapIndex);
        typedef std::set<int> TIdContainer;
        TColStd_IndexedMapOfInteger aMapIndex;
        theSel->GetIndex(theIO,aMapIndex);
        typedef std::set<int> TIdContainer;
index 9937073b667cbfdad3d8cb9448e003bb1c764b65..a2732f7034df29cbad1fef025df8cb94070d0c81 100644 (file)
@@ -63,6 +63,9 @@ namespace SMESH{
 
   VTKViewer_ViewFrame* GetCurrentVtkView();
 
 
   VTKViewer_ViewFrame* GetCurrentVtkView();
 
+  void RepaintViewFrame(VTKViewer_ViewFrame* theFrame);
+
+  void RenderViewFrame(VTKViewer_ViewFrame* theFrame);
 
   //----------------------------------------------------------------------------
   SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame, 
 
   //----------------------------------------------------------------------------
   SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame, 
index 1cb8085b24f186770441b75cf7ffe87285996b7b..60dff5a19bca3c6cbe91cf333066fe5018a4f701 100644 (file)
@@ -211,27 +211,12 @@ msgstr "pattern_sample_2d.png"
 msgid "ICON_PATTERN_SAMPLE_3D"
 msgstr "pattern_sample_3D.png"
 
 msgid "ICON_PATTERN_SAMPLE_3D"
 msgstr "pattern_sample_3D.png"
 
+#-----------------------------------------------------------
+# Add/Remove buttons
+#-----------------------------------------------------------
 
 
+msgid "ICON_APPEND"
+msgstr "mesh_add.png"
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+msgid "ICON_REMOVE"
+msgstr "mesh_remove.png"
\ No newline at end of file
index 8a0a4163bb3c662369d67b2cbe3cdec603364c17..b4d3146409b4a27bb6d0a4367ba20008405f0889 100644 (file)
@@ -961,12 +961,21 @@ msgstr "Free borders"
 msgid "SMESHGUI_FilterTable::MULTI_BORDERS"
 msgstr "Borders at multi-connections"
 
 msgid "SMESHGUI_FilterTable::MULTI_BORDERS"
 msgstr "Borders at multi-connections"
 
+#msgid "SMESHGUI_FilterTable::MULTI2D_BORDERS"
+#msgstr "Borders at multi-connections 2D"
+
 msgid "SMESHGUI_FilterTable::LENGTH"
 msgstr "Length"
 
 msgid "SMESHGUI_FilterTable::LENGTH"
 msgstr "Length"
 
+#msgid "SMESHGUI_FilterTable::LENGTH2D"
+#msgstr "Length2D"
+
 msgid "SMESHGUI_FilterTable::ASPECT_RATIO"
 msgstr "Aspect ratio"
 
 msgid "SMESHGUI_FilterTable::ASPECT_RATIO"
 msgstr "Aspect ratio"
 
+msgid "SMESHGUI_FilterTable::ASPECT_RATIO_3D"
+msgstr "Aspect ratio 3D"
+
 msgid "SMESHGUI_FilterTable::WARPING"
 msgstr "Warping"
 
 msgid "SMESHGUI_FilterTable::WARPING"
 msgstr "Warping"
 
@@ -1039,6 +1048,9 @@ msgstr "Belong to Plane"
 msgid "SMESHGUI_FilterTable::BELONG_TO_CYLINDER"
 msgstr "Belong to Cylinder"
 
 msgid "SMESHGUI_FilterTable::BELONG_TO_CYLINDER"
 msgstr "Belong to Cylinder"
 
+msgid "SMESHGUI_FilterTable::LYING_ON_GEOM"
+msgstr "Lying on Geom"
+
 # -------------- SMESHGUI_FilterDlg --------------
 msgid "SMESHGUI_FilterDlg::TLT"
 msgstr "Selection filter"
 # -------------- SMESHGUI_FilterDlg --------------
 msgid "SMESHGUI_FilterDlg::TLT"
 msgstr "Selection filter"
@@ -1092,11 +1104,17 @@ msgstr "This command is available in VTK viewer only\nPlease, create VTK viewer
 msgid "LENGTH_EDGES"
 msgstr "Length"
 
 msgid "LENGTH_EDGES"
 msgstr "Length"
 
+msgid "LENGTH2D_EDGES"
+msgstr "Length 2D"
+
 msgid "FREE_BORDERS"
 msgid "FREE_BORDERS"
-msgstr "Free borders"
+msgstr "Free Borders"
 
 msgid "MULTI_BORDERS"
 
 msgid "MULTI_BORDERS"
-msgstr "Borders at multi-connections"
+msgstr "Borders at Multi-Connections"
+
+msgid "MULTI2D_BORDERS"
+msgstr "Borders at Multi-Connections 2D"
 
 msgid "AREA_ELEMENTS"
 msgstr "Area"
 
 msgid "AREA_ELEMENTS"
 msgstr "Area"
@@ -1107,6 +1125,9 @@ msgstr "Taper"
 msgid "ASPECTRATIO_ELEMENTS"
 msgstr "Aspect Ratio"
 
 msgid "ASPECTRATIO_ELEMENTS"
 msgstr "Aspect Ratio"
 
+msgid "ASPECTRATIO_3D_ELEMENTS"
+msgstr "Aspect Ratio 3D"
+
 msgid "MINIMUMANGLE_ELEMENTS"
 msgstr "Minimum Angle"
 
 msgid "MINIMUMANGLE_ELEMENTS"
 msgstr "Minimum Angle"
 
@@ -1414,7 +1435,6 @@ msgstr "Centroidal"
 msgid "SMESHGUI_ExtrusionDlg::EXTRUSION_ALONG_LINE"
 msgstr "Extrusion along a line"
 
 msgid "SMESHGUI_ExtrusionDlg::EXTRUSION_ALONG_LINE"
 msgstr "Extrusion along a line"
 
-
 msgid "SMESHGUI_ExtrusionDlg::EXTRUSION_1D"
 msgstr "Extrusion of 1D elements"
 
 msgid "SMESHGUI_ExtrusionDlg::EXTRUSION_1D"
 msgstr "Extrusion of 1D elements"
 
@@ -1423,6 +1443,41 @@ msgstr "Extrusion of 2D elements"
 
 #----------------------------------------------------
 
 
 #----------------------------------------------------
 
+msgid "SMESHGUI_ExtrusionAlongPathDlg::EXTRUSION_ALONG_PATH"
+msgstr "Extrusion along a path"
+
+msgid "SMESHGUI_ExtrusionAlongPathDlg::EXTRUSION_1D"
+msgstr "Extrusion of 1D elements"
+
+msgid "SMESHGUI_ExtrusionAlongPathDlg::EXTRUSION_2D"
+msgstr "Extrusion of 2D elements"
+
+msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_PATH"
+msgstr "Path"
+
+msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_PATH_MESH"
+msgstr "Mesh"
+
+msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_PATH_SHAPE"
+msgstr "Shape (edge or wire)"
+
+msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_PATH_START"
+msgstr "Start point"
+
+msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_USE_ANGLES"
+msgstr "Use Angles"
+
+msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_ANGLES"
+msgstr "Angles"
+
+msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_USE_BASE_POINT"
+msgstr "Use Base Point"
+
+msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_BASE_POINT"
+msgstr "Base Point"
+
+#----------------------------------------------------
+
 msgid "SMESHGUI_RevolutionDlg::REVOLUTION_AROUND_AXIS"
 msgstr "Revolution around an axis"
 
 msgid "SMESHGUI_RevolutionDlg::REVOLUTION_AROUND_AXIS"
 msgstr "Revolution around an axis"
 
@@ -1605,6 +1660,20 @@ msgstr "It is impossible to load pattern\nThere are no elements in it"
 msgid "SMESHGUI_MeshPatternDlg::ERR_READ_BAD_KEY_POINT"
 msgstr "It is impossible to load pattern\nKey-point not on a boundary"
 
 msgid "SMESHGUI_MeshPatternDlg::ERR_READ_BAD_KEY_POINT"
 msgstr "It is impossible to load pattern\nKey-point not on a boundary"
 
+msgid "SMESHGUI_MeshPatternDlg::REFINE"
+msgstr "Refine selected mesh elements"
+
+msgid "SMESHGUI_MeshPatternDlg::NODE_1"
+msgstr "Node 1"
+
+msgid "SMESHGUI_MeshPatternDlg::NODE_2"
+msgstr "Node 2"
+
+msgid "SMESHGUI_MeshPatternDlg::MESH_FACES"
+msgstr "Mesh faces"
+
+msgid "SMESHGUI_MeshPatternDlg::MESH_VOLUMES"
+msgstr "Mesh volumes"
 
 #----------------------------------------------------
 
 
 #----------------------------------------------------
 
index 2517d100fb487e2195755fd2fe6367316a9861b0..5a5457f9ed4072df7cd3b7a872dca683d7ab3060 100644 (file)
@@ -47,7 +47,7 @@ EXPORT_HEADERS= \
        SMESH_Hypothesis_i.hxx \
        SMESH.hxx
 
        SMESH_Hypothesis_i.hxx \
        SMESH.hxx
 
-EXPORT_PYSCRIPTS = smeshpy.py SMESH_test.py
+EXPORT_PYSCRIPTS = smeshpy.py
 
 # Libraries targets
 
 
 # Libraries targets
 
@@ -82,9 +82,9 @@ BIN = SMESHEngine
 BIN_SRC = 
 
 # additionnal information to compil and link file
 BIN_SRC = 
 
 # additionnal information to compil and link file
-CPPFLAGS+= $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
+CPPFLAGS+= $(OCC_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
            -I${GEOM_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
            -I${GEOM_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
-CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
+CXXFLAGS+= $(OCC_CXXFLAGS) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
            -I${GEOM_ROOT_DIR}/include/salome
 
 LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lRegistry -lSalomeHDFPersist -lSalomeLifeCycleCORBA -lTOOLSDS -lSalomeGenericObj \
            -I${GEOM_ROOT_DIR}/include/salome
 
 LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lRegistry -lSalomeHDFPersist -lSalomeLifeCycleCORBA -lTOOLSDS -lSalomeGenericObj \
index 05205350042ef21ba124e8ca65a5ad0c3af6d653..a5c073f29dd364497cbebc5192633d2e001f88f7 100644 (file)
@@ -91,7 +91,7 @@ static bool IsContains( SMESHDS_Mesh*           theMeshDS,
                         TopAbs_ShapeEnum        theAvoidShapeEnum = TopAbs_SHAPE )
 {
   TopExp_Explorer anExp( theShape,theFindShapeEnum,theAvoidShapeEnum );
                         TopAbs_ShapeEnum        theAvoidShapeEnum = TopAbs_SHAPE )
 {
   TopExp_Explorer anExp( theShape,theFindShapeEnum,theAvoidShapeEnum );
-
+  
   while( anExp.More() )
   {
     const TopoDS_Shape& aShape = anExp.Current();
   while( anExp.More() )
   {
     const TopoDS_Shape& aShape = anExp.Current();
@@ -171,6 +171,143 @@ SMESHDS_Mesh* Controls::BelongToGeom::GetMeshDS()
   return myMeshDS;
 }
 
   return myMeshDS;
 }
 
+/*
+  Class       : LyingOnGeom
+  Description : Predicate for verifying whether entiy lying or partially lying on
+                specified geometrical support
+*/
+
+Controls::LyingOnGeom::LyingOnGeom()
+: myMeshDS(NULL),
+  myType(SMDSAbs_All)
+{}
+
+void Controls::LyingOnGeom::SetMesh( SMDS_Mesh* theMesh )
+{
+ myMeshDS = dynamic_cast<SMESHDS_Mesh*>(theMesh);
+}
+
+void Controls::LyingOnGeom::SetGeom( const TopoDS_Shape& theShape )
+{
+  myShape = theShape;
+}
+
+bool Controls::LyingOnGeom::IsSatisfy( long theId )
+{
+  if ( myMeshDS == 0 || myShape.IsNull() )
+    return false;
+
+  if( myType == SMDSAbs_Node )
+  {
+    if( const SMDS_MeshNode* aNode = myMeshDS->FindNode( theId ) )
+    {
+      const SMDS_PositionPtr& aPosition = aNode->GetPosition();
+      SMDS_TypeOfPosition aTypeOfPosition = aPosition->GetTypeOfPosition();
+      switch( aTypeOfPosition )
+      {
+      case SMDS_TOP_VERTEX : return IsContains( myMeshDS,myShape,aNode,TopAbs_VERTEX );
+      case SMDS_TOP_EDGE   : return IsContains( myMeshDS,myShape,aNode,TopAbs_EDGE );
+      case SMDS_TOP_FACE   : return IsContains( myMeshDS,myShape,aNode,TopAbs_FACE );
+      case SMDS_TOP_3DSPACE: return IsContains( myMeshDS,myShape,aNode,TopAbs_SHELL );
+      }
+    }
+  }
+  else
+  {
+    if( const SMDS_MeshElement* anElem = myMeshDS->FindElement( theId ) )
+    {
+      if( myType == SMDSAbs_All )
+      {
+        return Contains( myMeshDS,myShape,anElem,TopAbs_EDGE ) ||
+               Contains( myMeshDS,myShape,anElem,TopAbs_FACE ) ||
+               Contains( myMeshDS,myShape,anElem,TopAbs_SHELL )||
+               Contains( myMeshDS,myShape,anElem,TopAbs_SOLID );
+      }
+      else if( myType == anElem->GetType() )
+      {
+        switch( myType )
+        {
+        case SMDSAbs_Edge  : return Contains( myMeshDS,myShape,anElem,TopAbs_EDGE );
+        case SMDSAbs_Face  : return Contains( myMeshDS,myShape,anElem,TopAbs_FACE );
+        case SMDSAbs_Volume: return Contains( myMeshDS,myShape,anElem,TopAbs_SHELL )||
+                                    Contains( myMeshDS,myShape,anElem,TopAbs_SOLID );
+        }
+      }
+    }
+  }
+    
+  return false;
+}
+
+void Controls::LyingOnGeom::SetType( SMDSAbs_ElementType theType )
+{
+  myType = theType;
+}
+
+SMDSAbs_ElementType Controls::LyingOnGeom::GetType() const
+{
+  return myType;
+}
+
+TopoDS_Shape Controls::LyingOnGeom::GetShape()
+{
+  return myShape;
+}
+
+SMESHDS_Mesh* Controls::LyingOnGeom::GetMeshDS()
+{
+  return myMeshDS;
+}
+
+bool Controls::LyingOnGeom::Contains( SMESHDS_Mesh*           theMeshDS,
+                                     const TopoDS_Shape&     theShape,
+                                     const SMDS_MeshElement* theElem,
+                                     TopAbs_ShapeEnum        theFindShapeEnum,
+                                     TopAbs_ShapeEnum        theAvoidShapeEnum )
+{
+  if (IsContains(theMeshDS, theShape, theElem, theFindShapeEnum, theAvoidShapeEnum))
+    return true;
+  
+  if ( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( theShape ) )
+    {
+      SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes();
+      while ( aNodeIt->more() )
+       {
+         const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(aNodeIt->next());
+         SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator();
+         while ( anElemIt->more() )
+           {
+             const SMDS_MeshElement* anElement = static_cast<const SMDS_MeshElement*>(anElemIt->next());
+             if (anElement == theElem)
+               return true;
+           }
+       }
+    }
+  
+  TopExp_Explorer anExp( theShape,TopAbs_VERTEX,theAvoidShapeEnum );
+
+  while( anExp.More() )
+  {
+    const TopoDS_Shape& aShape = anExp.Current();
+    if( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ) ){
+      SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes();
+      while ( aNodeIt->more() )
+       {
+         const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(aNodeIt->next());
+         SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator();
+         while ( anElemIt->more() )
+           {
+             const SMDS_MeshElement* anElement = static_cast<const SMDS_MeshElement*>(anElemIt->next());
+             if (anElement == theElem)
+               return true;
+           }
+       }
+    }
+    anExp.Next();
+  }
+  return false;
+}
+
 
 /*
                             AUXILIARY METHODS
 
 /*
                             AUXILIARY METHODS
@@ -334,6 +471,22 @@ FunctorType AspectRatio_i::GetFunctorType()
 }
 
 
 }
 
 
+/*
+  Class       : AspectRatio3D
+  Description : Functor for calculating aspect ratio 3D
+*/
+AspectRatio3D_i::AspectRatio3D_i()
+{
+  myNumericalFunctorPtr.reset( new Controls::AspectRatio3D() );
+  myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType AspectRatio3D_i::GetFunctorType()
+{
+  return SMESH::FT_AspectRatio3D;
+}
+
+
 /*
   Class       : Warping_i
   Description : Functor for calculating warping
 /*
   Class       : Warping_i
   Description : Functor for calculating warping
@@ -411,6 +564,47 @@ FunctorType Length_i::GetFunctorType()
   return SMESH::FT_Length;
 }
 
   return SMESH::FT_Length;
 }
 
+/*
+  Class       : Length2D_i
+  Description : Functor for calculating length of edge
+*/
+Length2D_i::Length2D_i()
+{
+  myNumericalFunctorPtr.reset( new Controls::Length2D() );
+  myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType Length2D_i::GetFunctorType()
+{
+  return SMESH::FT_Length2D;
+}
+
+SMESH::Length2D::Values* Length2D_i::GetValues()
+{
+  INFOS("Length2D_i::GetValues");
+  SMESH::Controls::Length2D::TValues aValues;
+  myLength2DPtr->GetValues( aValues );
+  
+  long i = 0, iEnd = aValues.size();
+
+  SMESH::Length2D::Values_var aResult = new SMESH::Length2D::Values(iEnd);
+
+  SMESH::Controls::Length2D::TValues::const_iterator anIter;
+  for ( anIter = aValues.begin() ; anIter != aValues.end(); anIter++, i++ )
+  {
+    const SMESH::Controls::Length2D::Value&  aVal = *anIter;
+    SMESH::Length2D::Value &aValue = aResult[ i ];
+    
+    aValue.myLength = aVal.myLength;
+    aValue.myPnt1 = aVal.myPntId[ 0 ];
+    aValue.myPnt2 = aVal.myPntId[ 1 ];
+   
+  }
+
+  INFOS("Length2D_i::GetValuess~");
+  return aResult._retn();
+}
+
 /*
   Class       : MultiConnection_i
   Description : Functor for calculating number of faces conneted to the edge
 /*
   Class       : MultiConnection_i
   Description : Functor for calculating number of faces conneted to the edge
@@ -426,6 +620,46 @@ FunctorType MultiConnection_i::GetFunctorType()
   return SMESH::FT_MultiConnection;
 }
 
   return SMESH::FT_MultiConnection;
 }
 
+/*
+  Class       : MultiConnection2D_i
+  Description : Functor for calculating number of faces conneted to the edge
+*/
+MultiConnection2D_i::MultiConnection2D_i()
+{
+  myNumericalFunctorPtr.reset( new Controls::MultiConnection2D() );
+  myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType MultiConnection2D_i::GetFunctorType()
+{
+  return SMESH::FT_MultiConnection2D;
+}
+
+SMESH::MultiConnection2D::Values* MultiConnection2D_i::GetValues()
+{
+  INFOS("MultiConnection2D_i::GetValues");
+  SMESH::Controls::MultiConnection2D::MValues aValues;
+  myMulticonnection2DPtr->GetValues( aValues );
+  
+  long i = 0, iEnd = aValues.size();
+
+  SMESH::MultiConnection2D::Values_var aResult = new SMESH::MultiConnection2D::Values(iEnd);
+
+  SMESH::Controls::MultiConnection2D::MValues::const_iterator anIter;
+  for ( anIter = aValues.begin() ; anIter != aValues.end(); anIter++, i++ )
+  {
+    const SMESH::Controls::MultiConnection2D::Value&  aVal = (*anIter).first;
+    SMESH::MultiConnection2D::Value &aValue = aResult[ i ];
+    
+    aValue.myPnt1 = aVal.myPntId[ 0 ];
+    aValue.myPnt2 = aVal.myPntId[ 1 ];
+    aValue.myNbConnects = (*anIter).second;
+   
+  }
+
+  INFOS("Multiconnection2D_i::GetValuess~");
+  return aResult._retn();
+}
 
 /*
                             PREDICATES
 
 /*
                             PREDICATES
@@ -599,7 +833,57 @@ FunctorType BelongToCylinder_i::GetFunctorType()
   return FT_BelongToCylinder;
 }
 
   return FT_BelongToCylinder;
 }
 
+/*
+  Class       : LyingOnGeom_i
+  Description : Predicate for selection on geometrical support
+*/
+LyingOnGeom_i::LyingOnGeom_i()
+{
+  myLyingOnGeomPtr.reset( new Controls::LyingOnGeom() );
+  myFunctorPtr = myPredicatePtr = myLyingOnGeomPtr;
+  myShapeName = 0;
+}
+
+LyingOnGeom_i::~LyingOnGeom_i()
+{
+  delete myShapeName;
+}
+
+void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
+{
+  if ( theGeom->_is_nil() )
+    return;
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
+  TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
+  myLyingOnGeomPtr->SetGeom( aLocShape );
+}
 
 
+void LyingOnGeom_i::SetGeom( const TopoDS_Shape& theShape )
+{
+  myLyingOnGeomPtr->SetGeom( theShape );
+}
+
+void LyingOnGeom_i::SetElementType(ElementType theType){
+  myLyingOnGeomPtr->SetType(SMDSAbs_ElementType(theType));
+}
+
+FunctorType LyingOnGeom_i::GetFunctorType()
+{
+  return SMESH::FT_LyingOnGeom;
+}
+
+void LyingOnGeom_i::SetShapeName( const char* theName )
+{
+  delete myShapeName;
+  myShapeName = strdup( theName );
+  myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+}
+
+char* LyingOnGeom_i::GetShapeName()
+{
+  return CORBA::string_dup( myShapeName );
+}
 
 /*
   Class       : FreeBorders_i
 
 /*
   Class       : FreeBorders_i
@@ -974,6 +1258,14 @@ AspectRatio_ptr FilterManager_i::CreateAspectRatio()
 }
 
 
 }
 
 
+AspectRatio3D_ptr FilterManager_i::CreateAspectRatio3D()
+{
+  SMESH::AspectRatio3D_i* aServant = new SMESH::AspectRatio3D_i();
+  SMESH::AspectRatio3D_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
 Warping_ptr FilterManager_i::CreateWarping()
 {
   SMESH::Warping_i* aServant = new SMESH::Warping_i();
 Warping_ptr FilterManager_i::CreateWarping()
 {
   SMESH::Warping_i* aServant = new SMESH::Warping_i();
@@ -1013,6 +1305,12 @@ Length_ptr FilterManager_i::CreateLength()
   return anObj._retn();
 }
 
   return anObj._retn();
 }
 
+Length2D_ptr FilterManager_i::CreateLength2D()
+{
+  SMESH::Length2D_i* aServant = new SMESH::Length2D_i();
+  SMESH::Length2D_var anObj = aServant->_this();
+  return anObj._retn();
+}
 
 MultiConnection_ptr FilterManager_i::CreateMultiConnection()
 {
 
 MultiConnection_ptr FilterManager_i::CreateMultiConnection()
 {
@@ -1021,6 +1319,12 @@ MultiConnection_ptr FilterManager_i::CreateMultiConnection()
   return anObj._retn();
 }
 
   return anObj._retn();
 }
 
+MultiConnection2D_ptr FilterManager_i::CreateMultiConnection2D()
+{
+  SMESH::MultiConnection2D_i* aServant = new SMESH::MultiConnection2D_i();
+  SMESH::MultiConnection2D_var anObj = aServant->_this();
+  return anObj._retn();
+}
 
 BelongToGeom_ptr FilterManager_i::CreateBelongToGeom()
 {
 
 BelongToGeom_ptr FilterManager_i::CreateBelongToGeom()
 {
@@ -1043,6 +1347,13 @@ BelongToCylinder_ptr FilterManager_i::CreateBelongToCylinder()
   return anObj._retn();
 }
 
   return anObj._retn();
 }
 
+LyingOnGeom_ptr FilterManager_i::CreateLyingOnGeom()
+{
+  SMESH::LyingOnGeom_i* aServant = new SMESH::LyingOnGeom_i();
+  SMESH::LyingOnGeom_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
 FreeBorders_ptr FilterManager_i::CreateFreeBorders()
 {
   SMESH::FreeBorders_i* aServant = new SMESH::FreeBorders_i();
 FreeBorders_ptr FilterManager_i::CreateFreeBorders()
 {
   SMESH::FreeBorders_i* aServant = new SMESH::FreeBorders_i();
@@ -1283,6 +1594,21 @@ static inline bool getCriteria( Predicate_i*                thePred,
       theCriteria[ i ].TypeOfElement = aPred->GetElementType();
       theCriteria[ i ].Tolerance     = aPred->GetTolerance();
 
       theCriteria[ i ].TypeOfElement = aPred->GetElementType();
       theCriteria[ i ].Tolerance     = aPred->GetTolerance();
 
+      return true;
+    }
+   case FT_LyingOnGeom:
+    {
+      LyingOnGeom_i* aPred = dynamic_cast<LyingOnGeom_i*>( thePred );
+
+      CORBA::ULong i = theCriteria->length();
+      theCriteria->length( i + 1 );
+
+      theCriteria[ i ] = createCriterion();
+
+      theCriteria[ i ].Type          = FT_LyingOnGeom;
+      theCriteria[ i ].ThresholdStr  = aPred->GetShapeName();
+      theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+
       return true;
     }
   case FT_RangeOfIds:
       return true;
     }
   case FT_RangeOfIds:
@@ -1399,12 +1725,21 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
       case SMESH::FT_MultiConnection:
         aFunctor = aFilterMgr->CreateMultiConnection();
         break;
       case SMESH::FT_MultiConnection:
         aFunctor = aFilterMgr->CreateMultiConnection();
         break;
+      case SMESH::FT_MultiConnection2D:
+       aFunctor = aFilterMgr->CreateMultiConnection2D();
+       break;
       case SMESH::FT_Length:
         aFunctor = aFilterMgr->CreateLength();
         break;
       case SMESH::FT_Length:
         aFunctor = aFilterMgr->CreateLength();
         break;
+      case SMESH::FT_Length2D:
+        aFunctor = aFilterMgr->CreateLength2D();
+        break;
       case SMESH::FT_AspectRatio:
         aFunctor = aFilterMgr->CreateAspectRatio();
         break;
       case SMESH::FT_AspectRatio:
         aFunctor = aFilterMgr->CreateAspectRatio();
         break;
+      case SMESH::FT_AspectRatio3D:
+        aFunctor = aFilterMgr->CreateAspectRatio3D();
+        break;
       case SMESH::FT_Warping:
         aFunctor = aFilterMgr->CreateWarping();
         break;
       case SMESH::FT_Warping:
         aFunctor = aFilterMgr->CreateWarping();
         break;
@@ -1450,6 +1785,14 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
           aPredicate = tmpPred;
         }
         break;
           aPredicate = tmpPred;
         }
         break;
+      case SMESH::FT_LyingOnGeom:
+        {
+          SMESH::LyingOnGeom_ptr tmpPred = aFilterMgr->CreateLyingOnGeom();
+          tmpPred->SetElementType( aTypeOfElem );
+          tmpPred->SetShapeName( aThresholdStr );
+          aPredicate = tmpPred;
+        }
+        break; 
       case SMESH::FT_RangeOfIds:
         {
           SMESH::RangeOfIds_ptr tmpPred = aFilterMgr->CreateRangeOfIds();
       case SMESH::FT_RangeOfIds:
         {
           SMESH::RangeOfIds_ptr tmpPred = aFilterMgr->CreateRangeOfIds();
@@ -1660,11 +2003,14 @@ static inline LDOMString toString( const long theType )
     case FT_BelongToGeom    : return "Belong to Geom";
     case FT_BelongToPlane   : return "Belong to Plane";
     case FT_BelongToCylinder: return "Belong to Cylinder";
     case FT_BelongToGeom    : return "Belong to Geom";
     case FT_BelongToPlane   : return "Belong to Plane";
     case FT_BelongToCylinder: return "Belong to Cylinder";
+    case FT_LyingOnGeom     : return "Lying on Geom";
     case FT_RangeOfIds      : return "Range of IDs";
     case FT_FreeBorders     : return "Free borders";
     case FT_FreeEdges       : return "Free edges";
     case FT_MultiConnection : return "Borders at multi-connections";
     case FT_RangeOfIds      : return "Range of IDs";
     case FT_FreeBorders     : return "Free borders";
     case FT_FreeEdges       : return "Free edges";
     case FT_MultiConnection : return "Borders at multi-connections";
+    case FT_MultiConnection2D: return "Borders at multi-connections 2D";
     case FT_Length          : return "Length";
     case FT_Length          : return "Length";
+    case FT_Length2D        : return "Length2D";
     case FT_LessThan        : return "Less than";
     case FT_MoreThan        : return "More than";
     case FT_EqualTo         : return "Equal to";
     case FT_LessThan        : return "Less than";
     case FT_MoreThan        : return "More than";
     case FT_EqualTo         : return "Equal to";
@@ -1691,10 +2037,13 @@ static inline SMESH::FunctorType toFunctorType( const LDOMString& theStr )
   else if ( theStr.equals( "Belong to Geom"               ) ) return FT_BelongToGeom;
   else if ( theStr.equals( "Belong to Plane"              ) ) return FT_BelongToPlane;
   else if ( theStr.equals( "Belong to Cylinder"           ) ) return FT_BelongToCylinder;
   else if ( theStr.equals( "Belong to Geom"               ) ) return FT_BelongToGeom;
   else if ( theStr.equals( "Belong to Plane"              ) ) return FT_BelongToPlane;
   else if ( theStr.equals( "Belong to Cylinder"           ) ) return FT_BelongToCylinder;
+  else if ( theStr.equals( "Lying on Geom"                ) ) return FT_LyingOnGeom;
   else if ( theStr.equals( "Free borders"                 ) ) return FT_FreeBorders;
   else if ( theStr.equals( "Free edges"                   ) ) return FT_FreeEdges;
   else if ( theStr.equals( "Borders at multi-connections" ) ) return FT_MultiConnection;
   else if ( theStr.equals( "Free borders"                 ) ) return FT_FreeBorders;
   else if ( theStr.equals( "Free edges"                   ) ) return FT_FreeEdges;
   else if ( theStr.equals( "Borders at multi-connections" ) ) return FT_MultiConnection;
+  //  else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D;
   else if ( theStr.equals( "Length"                       ) ) return FT_Length;
   else if ( theStr.equals( "Length"                       ) ) return FT_Length;
+  //  else if ( theStr.equals( "Length2D"                     ) ) return FT_Length2D;
   else if ( theStr.equals( "Range of IDs"                 ) ) return FT_RangeOfIds;
   else if ( theStr.equals( "Less than"                    ) ) return FT_LessThan;
   else if ( theStr.equals( "More than"                    ) ) return FT_MoreThan;
   else if ( theStr.equals( "Range of IDs"                 ) ) return FT_RangeOfIds;
   else if ( theStr.equals( "Less than"                    ) ) return FT_LessThan;
   else if ( theStr.equals( "More than"                    ) ) return FT_MoreThan;
@@ -2204,23 +2553,3 @@ string_array* FilterLibrary_i::GetAllNames()
 
   return aResArray._retn();
 }
 
   return aResArray._retn();
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index 2c3efb20eccbc020c20826ada847aba3a7d5e273..ce3246602d76d77f142d503ae0397a2eea0682f4 100644 (file)
@@ -35,7 +35,7 @@
 #include <TopoDS_Shape.hxx>
 
 #include "SALOME_GenericObj_i.hh"
 #include <TopoDS_Shape.hxx>
 
 #include "SALOME_GenericObj_i.hh"
-#include "SMESH_Controls.hxx"
+#include "SMESH_ControlsDef.hxx"
 
 class SMESHDS_Mesh;
 
 
 class SMESHDS_Mesh;
 
@@ -72,6 +72,39 @@ private:
   SMDSAbs_ElementType             myType;
 };
 typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
   SMDSAbs_ElementType             myType;
 };
 typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
+
+/*
+  Class       : LyingOnGeom
+  Description : Predicate for verifying whether entiy lying or partially lying on
+                specified geometrical support
+*/
+class LyingOnGeom: public virtual Predicate
+{
+public:
+                                  LyingOnGeom();
+  
+  virtual void                    SetMesh( SMDS_Mesh* theMesh );
+  virtual void                    SetGeom( const TopoDS_Shape& theShape );
+
+  virtual bool                    IsSatisfy( long theElementId );
+
+  virtual void                    SetType( SMDSAbs_ElementType theType );
+  virtual                         SMDSAbs_ElementType GetType() const;
+
+  TopoDS_Shape                    GetShape();
+  SMESHDS_Mesh*                   GetMeshDS();
+  
+  virtual bool                    Contains( SMESHDS_Mesh*           theMeshDS,
+                                           const TopoDS_Shape&     theShape,
+                                           const SMDS_MeshElement* theElem,
+                                           TopAbs_ShapeEnum        theFindShapeEnum,
+                                           TopAbs_ShapeEnum        theAvoidShapeEnum = TopAbs_SHAPE );
+private:
+  TopoDS_Shape                    myShape;
+  SMESHDS_Mesh*                   myMeshDS;
+  SMDSAbs_ElementType             myType;
+};
+typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
 }
 
 /*
 }
 
 /*
@@ -141,6 +174,19 @@ public:
 };
 
 
 };
 
 
+/*
+  Class       : AspectRatio3D_i
+  Description : Functor for calculating aspect ratio for 3D
+*/
+class AspectRatio3D_i: public virtual POA_SMESH::AspectRatio3D,
+                      public virtual NumericalFunctor_i
+{
+public:
+                                  AspectRatio3D_i();
+  FunctorType                     GetFunctorType();
+};
+
+
 /*
   Class       : Warping_i
   Description : Functor for calculating warping
 /*
   Class       : Warping_i
   Description : Functor for calculating warping
@@ -205,6 +251,22 @@ public:
   FunctorType                     GetFunctorType();
 };
 
   FunctorType                     GetFunctorType();
 };
 
+/*
+  Class       : Length2D_i
+  Description : Functor for calculating length of edge
+*/
+class Length2D_i: public virtual POA_SMESH::Length2D,
+                 public virtual NumericalFunctor_i
+{
+public:
+                                  Length2D_i();
+  SMESH::Length2D::Values*        GetValues();
+  FunctorType                     GetFunctorType();
+
+protected:
+  Controls::Length2DPtr          myLength2DPtr;
+};
+
 
 /*
   Class       : MultiConnection_i
 
 /*
   Class       : MultiConnection_i
@@ -218,6 +280,22 @@ public:
   FunctorType                     GetFunctorType();
 };
 
   FunctorType                     GetFunctorType();
 };
 
+/*
+  Class       : MultiConnection2D_i
+  Description : Functor for calculating number of faces conneted to the edge
+*/
+class MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D,
+                          public virtual NumericalFunctor_i
+{
+public:
+                                     MultiConnection2D_i();
+  SMESH::MultiConnection2D::Values*  GetValues();
+  FunctorType                        GetFunctorType();
+
+protected:
+  Controls::MultiConnection2DPtr     myMulticonnection2DPtr;
+};
+
 
 /*
                             PREDICATES
 
 /*
                             PREDICATES
@@ -314,6 +392,30 @@ public:
   FunctorType                     GetFunctorType();
 };
 
   FunctorType                     GetFunctorType();
 };
 
+/*
+  Class       : LyingOnGeom_i
+  Description : Predicate for selection on geometrical support(lying or partially lying)
+*/
+class LyingOnGeom_i: public virtual POA_SMESH::LyingOnGeom,
+                    public virtual Predicate_i
+{
+public:
+                                  LyingOnGeom_i();
+  virtual                         ~LyingOnGeom_i();
+    
+  void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
+  void                            SetElementType( ElementType theType );
+  FunctorType                     GetFunctorType();
+  
+  void                            SetGeom( const TopoDS_Shape& theShape );
+  
+  void                            SetShapeName( const char* theName );
+  char*                           GetShapeName();
+  
+protected:
+  Controls::LyingOnGeomPtr        myLyingOnGeomPtr;
+  char*                           myShapeName;
+};
 
 /*
   Class       : FreeBorders_i
 
 /*
   Class       : FreeBorders_i
@@ -583,17 +685,22 @@ public:
                             FilterManager_i();
   MinimumAngle_ptr          CreateMinimumAngle();
   AspectRatio_ptr           CreateAspectRatio();
                             FilterManager_i();
   MinimumAngle_ptr          CreateMinimumAngle();
   AspectRatio_ptr           CreateAspectRatio();
+  AspectRatio3D_ptr         CreateAspectRatio3D();
   Warping_ptr               CreateWarping();
   Taper_ptr                 CreateTaper();
   Skew_ptr                  CreateSkew();
   Area_ptr                  CreateArea();
   Length_ptr                CreateLength();
   Warping_ptr               CreateWarping();
   Taper_ptr                 CreateTaper();
   Skew_ptr                  CreateSkew();
   Area_ptr                  CreateArea();
   Length_ptr                CreateLength();
+  Length2D_ptr              CreateLength2D();
   MultiConnection_ptr       CreateMultiConnection();
   MultiConnection_ptr       CreateMultiConnection();
+  MultiConnection2D_ptr     CreateMultiConnection2D();
   
   BelongToGeom_ptr          CreateBelongToGeom();
   BelongToPlane_ptr         CreateBelongToPlane();
   BelongToCylinder_ptr      CreateBelongToCylinder();
 
   
   BelongToGeom_ptr          CreateBelongToGeom();
   BelongToPlane_ptr         CreateBelongToPlane();
   BelongToCylinder_ptr      CreateBelongToCylinder();
 
+  LyingOnGeom_ptr           CreateLyingOnGeom();
+
   FreeBorders_ptr           CreateFreeBorders();
   FreeEdges_ptr             CreateFreeEdges();
 
   FreeBorders_ptr           CreateFreeBorders();
   FreeEdges_ptr             CreateFreeEdges();
 
index c18cd7dc9bd5974541ddfcd21e05900b3dba67d5..f27cc396e78dff14f7ad4ce9ccab84e7950c2cd2 100644 (file)
@@ -533,6 +533,75 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObjec
   ExtrusionSweep(anElementsId, theStepVector, theNbOfSteps);
 }
 
   ExtrusionSweep(anElementsId, theStepVector, theNbOfSteps);
 }
 
+//=======================================================================
+//function : ExtrusionAlongPath
+//purpose  : 
+//=======================================================================
+
+void SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array &   theIDsOfElements,
+                                           SMESH::SMESH_Mesh_ptr       thePathMesh,
+                                           GEOM::GEOM_Object_ptr       thePathShape,
+                                           CORBA::Long                 theNodeStart,
+                                           CORBA::Boolean              theHasAngles,
+                                           const SMESH::double_array & theAngles,
+                                           CORBA::Boolean              theHasRefPoint,
+                                           const SMESH::PointStruct &  theRefPoint)
+{
+  SMESHDS_Mesh*  aMesh = GetMeshDS();
+
+  if ( thePathMesh->_is_nil() || thePathShape->_is_nil() )
+    return;
+
+  SMESH_Mesh_i* aMeshImp = dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( thePathMesh ).in() );
+  TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape );
+  SMESH_subMesh* aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape );
+
+  if ( !aSubMesh )
+    return;
+
+  SMDS_MeshNode* nodeStart = (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(theNodeStart);
+  if ( !nodeStart )
+    return;
+
+  set<const SMDS_MeshElement*> elements;
+  for (int i = 0; i < theIDsOfElements.length(); i++)
+  {
+    CORBA::Long index = theIDsOfElements[i];
+    const SMDS_MeshElement * elem = aMesh->FindElement(index);
+    if ( elem )
+      elements.insert( elem );
+  }
+
+  list<double> angles;
+  for (int i = 0; i < theAngles.length(); i++)
+  {
+    angles.push_back( theAngles[i] );
+  }
+
+  gp_Pnt refPnt( theRefPoint.x, theRefPoint.y, theRefPoint.z );
+
+  ::SMESH_MeshEditor anEditor( _myMesh );
+  int res = anEditor.ExtrusionAlongTrack( elements, aSubMesh, nodeStart, theHasAngles, angles, theHasRefPoint, refPnt );
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObject
+//purpose  : 
+//=======================================================================
+
+void SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr   theObject,
+                                                 SMESH::SMESH_Mesh_ptr       thePathMesh,
+                                                 GEOM::GEOM_Object_ptr       thePathShape,
+                                                 CORBA::Long                 theNodeStart,
+                                                 CORBA::Boolean              theHasAngles,
+                                                 const SMESH::double_array & theAngles,
+                                                 CORBA::Boolean              theHasRefPoint,
+                                                 const SMESH::PointStruct &  theRefPoint)
+{
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  ExtrusionAlongPath( anElementsId, thePathMesh, thePathShape, theNodeStart, theHasAngles, theAngles, theHasRefPoint, theRefPoint );
+}
+
 //=======================================================================
 //function : Mirror
 //purpose  : 
 //=======================================================================
 //function : Mirror
 //purpose  : 
@@ -681,7 +750,8 @@ void SMESH_MeshEditor_i::FindCoincidentNodes (CORBA::Double                  Tol
 {
   ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
   ::SMESH_MeshEditor anEditor( _myMesh );
 {
   ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
   ::SMESH_MeshEditor anEditor( _myMesh );
-  anEditor.FindCoincidentNodes( Tolerance, aListOfListOfNodes );
+  set<const SMDS_MeshNode*> nodes; // no input nodes
+  anEditor.FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes );
 
   GroupsOfNodes = new SMESH::array_of_long_array;
   GroupsOfNodes->length( aListOfListOfNodes.size() );
 
   GroupsOfNodes = new SMESH::array_of_long_array;
   GroupsOfNodes->length( aListOfListOfNodes.size() );
index 2923617bda2885a3ef90264a72282759544e23ee..3677d13425ceb11851af05aa2500a7028d3cfb14 100644 (file)
@@ -105,6 +105,24 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
                            const SMESH::DirStruct &  StepVector,
                            CORBA::Long               NbOfSteps);
   
                            const SMESH::DirStruct &  StepVector,
                            CORBA::Long               NbOfSteps);
   
+  void ExtrusionAlongPath(const SMESH::long_array &   IDsOfElements,
+                          SMESH::SMESH_Mesh_ptr       PathMesh,
+                          GEOM::GEOM_Object_ptr       PathShape,
+                          CORBA::Long                 NodeStart,
+                          CORBA::Boolean              HasAngles,
+                          const SMESH::double_array & Angles,
+                          CORBA::Boolean              HasRefPoint,
+                          const SMESH::PointStruct &  RefPoint);
+
+  void ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr   theObject,
+                                SMESH::SMESH_Mesh_ptr       PathMesh,
+                                GEOM::GEOM_Object_ptr       PathShape,
+                                CORBA::Long                 NodeStart,
+                                CORBA::Boolean              HasAngles,
+                                const SMESH::double_array & Angles,
+                                CORBA::Boolean              HasRefPoint,
+                                const SMESH::PointStruct &  RefPoint);
+
   void Mirror(const SMESH::long_array &           IDsOfElements,
               const SMESH::AxisStruct &           Axis,
               SMESH::SMESH_MeshEditor::MirrorType MirrorType,
   void Mirror(const SMESH::long_array &           IDsOfElements,
               const SMESH::AxisStruct &           Axis,
               SMESH::SMESH_MeshEditor::MirrorType MirrorType,
index 851f613104ce0a03fd9f26ab679ac45ab15c3b52..8197abb31f2a155860c9e8e42892f09d1c01b23f 100644 (file)
 #include "OpUtil.hxx"
 
 #include "TCollection_AsciiString.hxx"
 #include "OpUtil.hxx"
 
 #include "TCollection_AsciiString.hxx"
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
 #include "SMESHDS_Command.hxx"
 #include "SMESHDS_CommandType.hxx"
 #include "SMESH_MeshEditor_i.hxx"
 #include "SMESH_Gen_i.hxx"
 #include "DriverMED_R_SMESHDS_Mesh.h"
 
 #include "SMESHDS_Command.hxx"
 #include "SMESHDS_CommandType.hxx"
 #include "SMESH_MeshEditor_i.hxx"
 #include "SMESH_Gen_i.hxx"
 #include "DriverMED_R_SMESHDS_Mesh.h"
 
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+
 #include <string>
 #include <iostream>
 #include <string>
 #include <iostream>
-// _CS_gbo_050504 Ajout explicite du sstream pour ostringstream 
 #include <sstream>
 
 #ifdef _DEBUG_
 #include <sstream>
 
 #ifdef _DEBUG_
@@ -509,7 +509,7 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetSubMesh(GEOM::GEOM_Object_ptr aSubShap
   catch(SALOME_Exception & S_ex) {
     THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
   }
   catch(SALOME_Exception & S_ex) {
     THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
   }
-  return subMesh;
+  return subMesh._retn();
 }
 
 //=============================================================================
 }
 
 //=============================================================================
@@ -1049,10 +1049,13 @@ SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor()
  */
 //=============================================================================
 
  */
 //=============================================================================
 
-void SMESH_Mesh_i::ExportMED(const char *file, CORBA::Boolean auto_groups) throw(SALOME::SALOME_Exception)
+void SMESH_Mesh_i::ExportToMED( const char* file, 
+                               CORBA::Boolean auto_groups, 
+                               SMESH::MED_VERSION theVersion )
+  throw(SALOME::SALOME_Exception)
 {
   Unexpect aCatch(SALOME_SalomeException);
 {
   Unexpect aCatch(SALOME_SalomeException);
-
+  
   char* aMeshName = "Mesh";
   SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
   if ( !aStudy->_is_nil() ) {
   char* aMeshName = "Mesh";
   SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
   if ( !aStudy->_is_nil() ) {
@@ -1062,10 +1065,10 @@ void SMESH_Mesh_i::ExportMED(const char *file, CORBA::Boolean auto_groups) throw
       //SCRUTE(file);
       //SCRUTE(aMeshName);
       //SCRUTE(aMeshSO->GetID());
       //SCRUTE(file);
       //SCRUTE(aMeshName);
       //SCRUTE(aMeshSO->GetID());
-
+      
       // asv : 27.10.04 : fix of 6903: check for StudyLocked before adding attributes 
       if ( !aStudy->GetProperties()->IsLocked() ) 
       // asv : 27.10.04 : fix of 6903: check for StudyLocked before adding attributes 
       if ( !aStudy->GetProperties()->IsLocked() ) 
-      {
+       {
        SALOMEDS::GenericAttribute_var anAttr;
        SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
        SALOMEDS::AttributeExternalFileDef_var aFileName;
        SALOMEDS::GenericAttribute_var anAttr;
        SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
        SALOMEDS::AttributeExternalFileDef_var aFileName;
@@ -1078,10 +1081,17 @@ void SMESH_Mesh_i::ExportMED(const char *file, CORBA::Boolean auto_groups) throw
         aFileType = SALOMEDS::AttributeFileType::_narrow(anAttr);
         ASSERT(!aFileType->_is_nil());
         aFileType->SetValue("FICHIERMED");
         aFileType = SALOMEDS::AttributeFileType::_narrow(anAttr);
         ASSERT(!aFileType->_is_nil());
         aFileType->SetValue("FICHIERMED");
-      }
+       }
     }
   }
     }
   }
-  _impl->ExportMED( file, aMeshName, auto_groups );
+  _impl->ExportMED( file, aMeshName, auto_groups, theVersion );
+}
+
+void SMESH_Mesh_i::ExportMED( const char* file, 
+                             CORBA::Boolean auto_groups)
+  throw(SALOME::SALOME_Exception)
+{
+  ExportToMED(file,auto_groups,SMESH::MED_V2_1);
 }
 
 void SMESH_Mesh_i::ExportDAT(const char *file) throw(SALOME::SALOME_Exception)
 }
 
 void SMESH_Mesh_i::ExportDAT(const char *file) throw(SALOME::SALOME_Exception)
@@ -1126,6 +1136,17 @@ CORBA::Long SMESH_Mesh_i::NbNodes()throw(SALOME::SALOME_Exception)
   return _impl->NbNodes();
 }
 
   return _impl->NbNodes();
 }
 
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+CORBA::Long SMESH_Mesh_i::NbElements()throw (SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  return NbEdges() + NbFaces() + NbVolumes();
+}
+  
 //=============================================================================
 /*!
  *  
 //=============================================================================
 /*!
  *  
@@ -1237,3 +1258,98 @@ SMESH::long_array* SMESH_Mesh_i::GetIDs()
   
   return aResult._retn();
 }
   
   return aResult._retn();
 }
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+  
+SMESH::long_array* SMESH_Mesh_i::GetElementsId()
+     throw (SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  MESSAGE("SMESH_Mesh_i::GetElementsId");
+  SMESH::long_array_var aResult = new SMESH::long_array();
+  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
+
+  if ( aSMESHDS_Mesh == NULL )
+    return aResult._retn();
+
+  long nbElements = NbElements();
+  aResult->length( nbElements );
+  SMDS_ElemIteratorPtr anIt = aSMESHDS_Mesh->elementsIterator();
+  for ( int i = 0, n = nbElements; i < n && anIt->more(); i++ )
+    aResult[i] = anIt->next()->GetID();
+
+  return aResult._retn();
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESH::long_array* SMESH_Mesh_i::GetElementsByType( SMESH::ElementType theElemType )
+    throw (SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  MESSAGE("SMESH_subMesh_i::GetElementsByType");
+  SMESH::long_array_var aResult = new SMESH::long_array();
+  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
+
+  if ( aSMESHDS_Mesh == NULL )
+    return aResult._retn();
+
+  long nbElements = NbElements();
+
+  // No sense in returning ids of elements along with ids of nodes:
+  // when theElemType == SMESH::ALL, return node ids only if
+  // there are no elements
+  if ( theElemType == SMESH::NODE || theElemType == SMESH::ALL && nbElements == 0 )
+    return GetNodesId();
+
+  aResult->length( nbElements );
+
+  int i = 0;
+
+  SMDS_ElemIteratorPtr anIt = aSMESHDS_Mesh->elementsIterator();
+  while ( i < nbElements && anIt->more() ) {
+    const SMDS_MeshElement* anElem = anIt->next();
+    if ( theElemType == SMESH::ALL || anElem->GetType() == (SMDSAbs_ElementType)theElemType )
+      aResult[i++] = anElem->GetID();
+  }
+
+  aResult->length( i );
+
+  return aResult._retn();
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+  
+SMESH::long_array* SMESH_Mesh_i::GetNodesId()
+  throw (SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  MESSAGE("SMESH_subMesh_i::GetNodesId");
+  SMESH::long_array_var aResult = new SMESH::long_array();
+  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
+
+  if ( aSMESHDS_Mesh == NULL )
+    return aResult._retn();
+
+  long nbNodes = NbNodes();
+  aResult->length( nbNodes );
+  SMDS_NodeIteratorPtr anIt = aSMESHDS_Mesh->nodesIterator();
+  for ( int i = 0, n = nbNodes; i < n && anIt->more(); i++ )
+    aResult[i] = anIt->next()->GetID();
+
+  return aResult._retn();
+}
+
index 0b010c474cfe1cf5c2adcf16511467a0acd8ad20..3035c1ad3df6539d1ed84c1af6e3e03a886f6e11 100644 (file)
@@ -150,8 +150,11 @@ public:
   SMESH::DriverMED_ReadStatus ImportMEDFile( const char* theFileName, const char* theMeshName )
     throw (SALOME::SALOME_Exception);
 
   SMESH::DriverMED_ReadStatus ImportMEDFile( const char* theFileName, const char* theMeshName )
     throw (SALOME::SALOME_Exception);
 
+  void ExportToMED( const char* file, CORBA::Boolean auto_groups, SMESH::MED_VERSION theVersion )
+    throw (SALOME::SALOME_Exception);
   void ExportMED( const char* file, CORBA::Boolean auto_groups )
     throw (SALOME::SALOME_Exception);
   void ExportMED( const char* file, CORBA::Boolean auto_groups )
     throw (SALOME::SALOME_Exception);
+
   void ExportDAT( const char* file )
     throw (SALOME::SALOME_Exception);
   void ExportUNV( const char* file )
   void ExportDAT( const char* file )
     throw (SALOME::SALOME_Exception);
   void ExportUNV( const char* file )
@@ -165,6 +168,9 @@ public:
   CORBA::Long NbNodes()
     throw (SALOME::SALOME_Exception);
   
   CORBA::Long NbNodes()
     throw (SALOME::SALOME_Exception);
   
+  CORBA::Long NbElements()
+    throw (SALOME::SALOME_Exception);
+  
   CORBA::Long NbEdges()
     throw (SALOME::SALOME_Exception);
   
   CORBA::Long NbEdges()
     throw (SALOME::SALOME_Exception);
   
@@ -195,6 +201,15 @@ public:
   CORBA::Long NbSubMesh()
     throw (SALOME::SALOME_Exception);
 
   CORBA::Long NbSubMesh()
     throw (SALOME::SALOME_Exception);
 
+  SMESH::long_array* GetElementsId()
+    throw (SALOME::SALOME_Exception);
+
+  SMESH::long_array* GetElementsByType( SMESH::ElementType theElemType )
+    throw (SALOME::SALOME_Exception);
+  
+  SMESH::long_array* GetNodesId()
+    throw (SALOME::SALOME_Exception);
+  
   char* Dump();
   
   // Internal methods not available through CORBA
   char* Dump();
   
   // Internal methods not available through CORBA
index 206d497ba7a4c19b7c2d223bf230de877ef98e25..fa664b4a83208e2f6e8bfd6f6468255b7dd44dec 100644 (file)
 #include "SMESH_Gen_i.hxx"
 #include "SMESH_Mesh.hxx"
 #include "SMESH_Mesh_i.hxx"
 #include "SMESH_Gen_i.hxx"
 #include "SMESH_Mesh.hxx"
 #include "SMESH_Mesh_i.hxx"
+#include "SMDS_MeshFace.hxx"
+#include "SMDS_MeshVolume.hxx"
 
 #include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
 
 #include <sstream>
 
 #include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
 
 #include <sstream>
+#include <set>
 
 
+// =============================================================================
 //=============================================================================
 /*!
 //=============================================================================
 /*!
+// =============================================================================
  *  SMESH_Gen_i::GetPattern
  *
  *  Create pattern mapper
  *  SMESH_Gen_i::GetPattern
  *
  *  Create pattern mapper
@@ -64,16 +69,6 @@ SMESH_Pattern_i::SMESH_Pattern_i( SMESH_Gen_i* theGen_i ):
 {
 }
 
 {
 }
 
-//=======================================================================
-//function : getShape
-//purpose  : 
-//=======================================================================
-
-TopoDS_Shape SMESH_Pattern_i::getShape( GEOM::GEOM_Object_ptr & theGeomObject )
-{
-  return myGen->GetShapeReader()->GetShape( SMESH_Gen_i::GetGeomEngine(), theGeomObject );
-}
-
 //=======================================================================
 //function : getMesh
 //purpose  : 
 //=======================================================================
 //function : getMesh
 //purpose  : 
@@ -115,7 +110,7 @@ CORBA::Boolean SMESH_Pattern_i::LoadFromFace(SMESH::SMESH_Mesh_ptr theMesh,
   if ( !aMesh )
     return false;
 
   if ( !aMesh )
     return false;
 
-  TopoDS_Face aFace = TopoDS::Face( getShape( theFace ));
+  TopoDS_Face aFace = TopoDS::Face( myGen->GeomObjectToShape( theFace ));
   if ( aFace.IsNull() )
     return false;
 
   if ( aFace.IsNull() )
     return false;
 
@@ -137,7 +132,7 @@ CORBA::Boolean SMESH_Pattern_i::LoadFrom3DBlock(SMESH::SMESH_Mesh_ptr theMesh,
   if ( !aMesh )
     return false;
 
   if ( !aMesh )
     return false;
 
-  TopoDS_Shape aShape = getShape( theBlock );
+  TopoDS_Shape aShape = myGen->GeomObjectToShape( theBlock );
   if ( aShape.IsNull())
     return false;
 
   if ( aShape.IsNull())
     return false;
 
@@ -160,8 +155,8 @@ SMESH::point_array* SMESH_Pattern_i::ApplyToFace(GEOM::GEOM_Object_ptr theFace,
   SMESH::point_array_var points = new SMESH::point_array;
   list<const gp_XYZ *> xyzList;
 
   SMESH::point_array_var points = new SMESH::point_array;
   list<const gp_XYZ *> xyzList;
 
-  TopoDS_Shape F = getShape( theFace );
-  TopoDS_Shape V = getShape( theVertexOnKeyPoint1 );
+  TopoDS_Shape F = myGen->GeomObjectToShape( theFace );
+  TopoDS_Shape V = myGen->GeomObjectToShape( theVertexOnKeyPoint1 );
 
   if (!F.IsNull() && F.ShapeType() == TopAbs_FACE &&
       !V.IsNull() && V.ShapeType() == TopAbs_VERTEX
 
   if (!F.IsNull() && F.ShapeType() == TopAbs_FACE &&
       !V.IsNull() && V.ShapeType() == TopAbs_VERTEX
@@ -192,9 +187,9 @@ SMESH::point_array* SMESH_Pattern_i::ApplyTo3DBlock(GEOM::GEOM_Object_ptr theBlo
   SMESH::point_array_var points = new SMESH::point_array;
   list<const gp_XYZ *> xyzList;
 
   SMESH::point_array_var points = new SMESH::point_array;
   list<const gp_XYZ *> xyzList;
 
-  TopExp_Explorer exp( getShape( theBlock ), TopAbs_SHELL );
-  TopoDS_Shape V000 = getShape( theVertex000 );
-  TopoDS_Shape V001 = getShape( theVertex001 );
+  TopExp_Explorer exp( myGen->GeomObjectToShape( theBlock ), TopAbs_SHELL );
+  TopoDS_Shape V000 = myGen->GeomObjectToShape( theVertex000 );
+  TopoDS_Shape V001 = myGen->GeomObjectToShape( theVertex001 );
 
   if (exp.More() &&
       !V000.IsNull() && V000.ShapeType() == TopAbs_VERTEX &&
 
   if (exp.More() &&
       !V000.IsNull() && V000.ShapeType() == TopAbs_VERTEX &&
@@ -216,6 +211,86 @@ SMESH::point_array* SMESH_Pattern_i::ApplyTo3DBlock(GEOM::GEOM_Object_ptr theBlo
   return points._retn();
 }
 
   return points._retn();
 }
 
+//=======================================================================
+//function : ApplyToMeshFaces
+//purpose  : 
+//=======================================================================
+
+SMESH::point_array*
+  SMESH_Pattern_i::ApplyToMeshFaces(SMESH::SMESH_Mesh_ptr    theMesh,
+                                    const SMESH::long_array& theFacesIDs,
+                                    CORBA::Long              theNodeIndexOnKeyPoint1,
+                                    CORBA::Boolean           theReverse)
+{
+  SMESH::point_array_var points = new SMESH::point_array;
+
+  ::SMESH_Mesh* aMesh = getMesh( theMesh );
+  if ( !aMesh )
+    return points._retn();
+
+  list<const gp_XYZ *> xyzList;
+  set<const SMDS_MeshFace*> fset;
+  for (int i = 0; i < theFacesIDs.length(); i++)
+  {
+    CORBA::Long index = theFacesIDs[i];
+    const SMDS_MeshElement * elem = aMesh->GetMeshDS()->FindElement(index);
+    if ( elem && elem->GetType() == SMDSAbs_Face )
+      fset.insert( static_cast<const SMDS_MeshFace *>( elem ));
+  }
+  if (myPattern.Apply( fset, theNodeIndexOnKeyPoint1, theReverse ) &&
+      myPattern.GetMappedPoints( xyzList ))
+  {
+    points->length( xyzList.size() );
+    list<const gp_XYZ *>::iterator xyzIt = xyzList.begin();
+    for ( int i = 0; xyzIt != xyzList.end(); xyzIt++ ) {
+      SMESH::PointStruct & p = points[ i++ ];
+      (*xyzIt)->Coord( p.x, p.y, p.z );
+    }
+  }
+
+  return points._retn();
+}
+
+//=======================================================================
+//function : ApplyToHexahedrons
+//purpose  : 
+//=======================================================================
+
+SMESH::point_array*
+  SMESH_Pattern_i::ApplyToHexahedrons(SMESH::SMESH_Mesh_ptr    theMesh,
+                                      const SMESH::long_array& theVolumesIDs,
+                                      CORBA::Long              theNode000Index,
+                                      CORBA::Long              theNode001Index)
+{
+  SMESH::point_array_var points = new SMESH::point_array;
+
+  ::SMESH_Mesh* aMesh = getMesh( theMesh );
+  if ( !aMesh )
+    return points._retn();
+
+  list<const gp_XYZ *> xyzList;
+  set<const SMDS_MeshVolume*> vset;
+  for (int i = 0; i < theVolumesIDs.length(); i++)
+  {
+    CORBA::Long index = theVolumesIDs[i];
+    const SMDS_MeshElement * elem = aMesh->GetMeshDS()->FindElement(index);
+    if ( elem && elem->GetType() == SMDSAbs_Volume && elem->NbNodes() == 8 )
+      vset.insert( static_cast<const SMDS_MeshVolume *>( elem ));
+  }
+  if (myPattern.Apply( vset, theNode000Index, theNode001Index ) &&
+      myPattern.GetMappedPoints( xyzList ))
+  {
+    points->length( xyzList.size() );
+    list<const gp_XYZ *>::iterator xyzIt = xyzList.begin();
+    for ( int i = 0; xyzIt != xyzList.end(); xyzIt++ ) {
+      SMESH::PointStruct & p = points[ i++ ];
+      (*xyzIt)->Coord( p.x, p.y, p.z );
+    }
+  }
+
+  return points._retn();
+}
+
 //=======================================================================
 //function : MakeMesh
 //purpose  : 
 //=======================================================================
 //function : MakeMesh
 //purpose  : 
index 70520d877fa9b6db835dc772438cdf099a475bf4..7bcbdff6634b6077c4c4f9be4c5931d133c017e6 100644 (file)
@@ -65,6 +65,16 @@ class SMESH_Pattern_i:
                                      GEOM::GEOM_Object_ptr theVertex000,
                                      GEOM::GEOM_Object_ptr theVertex001);
 
                                      GEOM::GEOM_Object_ptr theVertex000,
                                      GEOM::GEOM_Object_ptr theVertex001);
 
+  SMESH::point_array* ApplyToMeshFaces(SMESH::SMESH_Mesh_ptr    theMesh,
+                                       const SMESH::long_array& theFacesIDs,
+                                       CORBA::Long              theNodeIndexOnKeyPoint1,
+                                       CORBA::Boolean           theReverse);
+
+  SMESH::point_array* ApplyToHexahedrons(SMESH::SMESH_Mesh_ptr    theMesh,
+                                         const SMESH::long_array& theVolumesIDs,
+                                         CORBA::Long              theNode000Index,
+                                         CORBA::Long              theNode001Index);
+
   CORBA::Boolean MakeMesh(SMESH::SMESH_Mesh_ptr theMesh);
 
   SMESH::SMESH_Pattern::ErrorCode GetErrorCode();
   CORBA::Boolean MakeMesh(SMESH::SMESH_Mesh_ptr theMesh);
 
   SMESH::SMESH_Pattern::ErrorCode GetErrorCode();
@@ -82,8 +92,6 @@ class SMESH_Pattern_i:
 
  private:
 
 
  private:
 
-  TopoDS_Shape getShape( GEOM::GEOM_Object_ptr & theGeomObject );
-
   ::SMESH_Mesh* getMesh( SMESH::SMESH_Mesh_ptr & theMesh );
 
   ::SMESH_Pattern myPattern;
   ::SMESH_Mesh* getMesh( SMESH::SMESH_Mesh_ptr & theMesh );
 
   ::SMESH_Pattern myPattern;
diff --git a/src/SMESH_I/SMESH_test.py b/src/SMESH_I/SMESH_test.py
deleted file mode 100644 (file)
index 0cc3a94..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-#  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
-#
-#  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-#
-#
-#
-#  File   : SMESH_test.py
-#  Module : SMESH
-
-import salome
-import geompy
-import smeshpy
-
-import SMESH
-import StdMeshers
-
-# ---- define a box
-
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idb = geompy.addToStudy(box, "box")
-
-# ---- add first face of box in study
-
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-face = subShapeList[0]
-name = geompy.SubShapeName(face, box)
-idf = geompy.addToStudyInFather(box, face, name)
-
-# ---- add shell from box  in study
-
-subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
-shell = subShellList[0]
-name = geompy.SubShapeName(shell, box)
-ids = geompy.addToStudyInFather(box, shell, name)
-
-# ---- add first edge of face in study
-
-edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
-edge = edgeList[0];
-name = geompy.SubShapeName(edge, face)
-ide = geompy.addToStudyInFather(face, edge, name)
-
-# ---- launch SMESH, init a Mesh with the box
-
-gen = smeshpy.smeshpy()
-mesh = gen.CreateMesh(idb)
-
-print "-------------------------- create Hypothesis"
-
-print "-------------------------- LocalLength"
-
-hypo1 = gen.CreateHypothesis("LocalLength", "libStdMeshersEngine.so")
-print hypo1.GetName()
-print hypo1.GetId()
-print hypo1.GetLength()
-hypo1.SetLength(100)
-print hypo1.GetLength()
-
-print "-------------------------- bidon"
-
-hyp3 = gen.CreateHypothesis("bidon", "")
-
-print "-------------------------- NumberOfSegments"
-
-hypo3 = gen.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
-hypo3.SetNumberOfSegments(7)
-print hypo3.GetName()
-print hypo3.GetNumberOfSegments()
-print hypo3.GetId()
-
-print "-------------------------- MaxElementArea"
-
-hypo4 = gen.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
-hypo4.SetMaxElementArea(5000)
-print hypo4.GetName()
-print hypo4.GetMaxElementArea()
-print hypo4.GetId()
-
-print "-------------------------- Regular_1D"
-
-algo_1 = gen.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
-print algo_1.GetName()
-print algo_1.GetId()
-listHyp = algo_1.GetCompatibleHypothesis()
-for hyp in listHyp:
-    print hyp
-print algo_1.GetId()
-
-print "-------------------------- MEFISTO_2D"
-
-algo_2 = gen.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
-print algo_2.GetName()
-print algo_2.GetId()
-listHyp = algo_2.GetCompatibleHypothesis()
-for hyp in listHyp:
-    print hyp
-print algo_2.GetId()
-
-print "-------------------------- add hypothesis to edge"
-
-edge = salome.IDToObject(ide)
-submesh = mesh.GetSubMesh(edge, "SubMeshEdge")
-ret = mesh.AddHypothesis(edge,algo_1)
-print ret
-ret = mesh.AddHypothesis(edge,hypo1)
-print ret
-
-##print "-------------------------- compute edge"
-##ret=gen.Compute(mesh,ide)
-##print ret
-##log=mesh.GetLog(1);
-##for a in log:
-##    print a
-
-print "-------------------------- add hypothesis to box"
-
-box = salome.IDToObject(idb)
-submesh = mesh.GetSubMesh(box, "SubMeshBox")
-ret = mesh.AddHypothesis(box,algo_1)
-print ret
-ret = mesh.AddHypothesis(box,hypo1)
-print ret
-ret = mesh.AddHypothesis(box,algo_2)
-print ret
-ret = mesh.AddHypothesis(box,hypo4)
-print ret
-
-print "-------------------------- compute"
-
-ret = gen.Compute(mesh,idf)
-print ret
-log = mesh.GetLog(1);
-for a in log:
-    print "-------"
-    ii = 0
-    ir = 0
-    comType = a.commandType
-    if comType == 0:
-        for i in range(a.number):
-            ind = a.indexes[ii]
-            ii = ii+1
-            r1 = a.coords[ir]
-            ir = ir+1
-            r2 = a.coords[ir]
-            ir = ir+1
-            r3 = a.coords[ir]
-            ir = ir+1
-            print "AddNode %i - %g %g %g" % (ind, r1, r2, r3)
-    elif comType == 1:
-        for i in range(a.number):
-            ind = a.indexes[ii]
-            ii = ii+1
-            i1 = a.indexes[ii]
-            ii = ii+1
-            i2 = a.indexes[ii]
-            ii = ii+1
-            print "AddEdge %i - %i %i" % (ind, i1, i2)
-    elif comType == 2:
-        for i in range(a.number):
-            ind = a.indexes[ii]
-            ii = ii+1
-            i1 = a.indexes[ii]
-            ii = ii+1
-            i2 = a.indexes[ii]
-            ii = ii+1
-            i3 = a.indexes[ii]
-            ii = ii+1
-            print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3)
-
-##print "-------------------------- compute box"
-##ret=gen.Compute(mesh,idb)
-##print ret
-##log=mesh.GetLog(1);
-##print log
-
-##shell=salome.IDToObject(ids)
-##submesh=mesh.GetElementsOnShape(shell)
-##ret=mesh.AddHypothesis(shell,algo_1)
-##print ret
-##ret=mesh.AddHypothesis(shell,hypo1)
-##print ret
-##ret=gen.Compute(mesh,ids)
-##print ret
index c6c8c040315a9b258e8ca0afa265e710181999d0..1b40066fab0da6c8b4899eb82649b143a5dbcfa4 100644 (file)
@@ -55,11 +55,13 @@ EXPORT_PYSCRIPTS = libSMESH_Swig.py \
                   hole2pyGibi.py \
                   cyl2geometry.py \
                   cyl2complementary.py \
                   hole2pyGibi.py \
                   cyl2geometry.py \
                   cyl2complementary.py \
+                   SMESH_test.py\
                    SMESH_test0.py\
                   SMESH_test1.py \
                   SMESH_test2.py \
                   SMESH_test3.py \
                   SMESH_test4.py \
                    SMESH_test0.py\
                   SMESH_test1.py \
                   SMESH_test2.py \
                   SMESH_test3.py \
                   SMESH_test4.py \
+                  SMESH_test5.py \
                   SMESH_mechanic.py \
                   SMESH_mechanic_tetra.py \
                   SMESH_mechanic_editor.py \
                   SMESH_mechanic.py \
                   SMESH_mechanic_tetra.py \
                   SMESH_mechanic_editor.py \
@@ -80,7 +82,8 @@ EXPORT_PYSCRIPTS = libSMESH_Swig.py \
                   SMESH_demo_hexa2_upd.py \
                   SMESH_hexaedre.py \
                   SMESH_Sphere.py \
                   SMESH_demo_hexa2_upd.py \
                   SMESH_hexaedre.py \
                   SMESH_Sphere.py \
-                  SMESH_GroupFromGeom.py
+                  SMESH_GroupFromGeom.py \
+                  SMESH_GroupLyingOnGeom.py
 
 LIB_CLIENT_IDL = SALOMEDS.idl \
                 SALOME_Exception.idl \
 
 LIB_CLIENT_IDL = SALOMEDS.idl \
                 SALOME_Exception.idl \
diff --git a/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py b/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py
new file mode 100644 (file)
index 0000000..0df585e
--- /dev/null
@@ -0,0 +1,25 @@
+import SMESH
+
+def BuildGroupLyingOn(theMesh, theElemType, theName, theShape):
+    aMeshGen = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
+
+    aFilterMgr = aMeshGen.CreateFilterManager()
+    aFilter = aFilterMgr.CreateFilter()
+   
+    aLyingOnGeom = aFilterMgr.CreateLyingOnGeom()
+    aLyingOnGeom.SetGeom(theShape)
+    aLyingOnGeom.SetElementType(theElemType)
+    
+    aFilter.SetPredicate(aLyingOnGeom)
+    anIds = aFilter.GetElementsId(theMesh)
+
+    aGroup = theMesh.CreateGroup(theElemType, theName)
+    aGroup.Add(anIds)
+
+#Example
+from SMESH_test1 import *
+
+smesh.Compute(mesh, box)
+BuildGroupLyingOn(mesh, SMESH.FACE, "Group of faces lying on edge", edge )
+
+salome.sg.updateObjBrowser(1);
diff --git a/src/SMESH_SWIG/SMESH_test.py b/src/SMESH_SWIG/SMESH_test.py
new file mode 100644 (file)
index 0000000..d2385f3
--- /dev/null
@@ -0,0 +1,200 @@
+#  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+#
+#  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+#  File   : SMESH_test.py
+#  Module : SMESH
+
+import salome
+import geompy
+import smeshpy
+
+import SMESH
+import StdMeshers
+
+# ---- define a box
+
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idb = geompy.addToStudy(box, "box")
+
+# ---- add first face of box in study
+
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+face = subShapeList[0]
+name = geompy.SubShapeName(face, box)
+idf = geompy.addToStudyInFather(box, face, name)
+
+# ---- add shell from box  in study
+
+subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
+shell = subShellList[0]
+name = geompy.SubShapeName(shell, box)
+ids = geompy.addToStudyInFather(box, shell, name)
+
+# ---- add first edge of face in study
+
+edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
+edge = edgeList[0];
+name = geompy.SubShapeName(edge, face)
+ide = geompy.addToStudyInFather(face, edge, name)
+
+# ---- launch SMESH, init a Mesh with the box
+
+gen = smeshpy.smeshpy()
+mesh = gen.CreateMesh(idb)
+
+print "-------------------------- create Hypothesis"
+
+print "-------------------------- LocalLength"
+
+hypo1 = gen.CreateHypothesis("LocalLength", "libStdMeshersEngine.so")
+print hypo1.GetName()
+print hypo1.GetId()
+print hypo1.GetLength()
+hypo1.SetLength(100)
+print hypo1.GetLength()
+
+print "-------------------------- bidon"
+
+hyp3 = gen.CreateHypothesis("bidon", "")
+
+print "-------------------------- NumberOfSegments"
+
+hypo3 = gen.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
+hypo3.SetNumberOfSegments(7)
+print hypo3.GetName()
+print hypo3.GetNumberOfSegments()
+print hypo3.GetId()
+
+print "-------------------------- MaxElementArea"
+
+hypo4 = gen.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
+hypo4.SetMaxElementArea(5000)
+print hypo4.GetName()
+print hypo4.GetMaxElementArea()
+print hypo4.GetId()
+
+print "-------------------------- Regular_1D"
+
+algo_1 = gen.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
+print algo_1.GetName()
+print algo_1.GetId()
+listHyp = algo_1.GetCompatibleHypothesis()
+for hyp in listHyp:
+    print hyp
+print algo_1.GetId()
+
+print "-------------------------- MEFISTO_2D"
+
+algo_2 = gen.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
+print algo_2.GetName()
+print algo_2.GetId()
+listHyp = algo_2.GetCompatibleHypothesis()
+for hyp in listHyp:
+    print hyp
+print algo_2.GetId()
+
+print "-------------------------- add hypothesis to edge"
+
+edge = salome.IDToObject(ide)
+submesh = mesh.GetSubMesh(edge, "SubMeshEdge")
+ret = mesh.AddHypothesis(edge,algo_1)
+print ret
+ret = mesh.AddHypothesis(edge,hypo1)
+print ret
+
+##print "-------------------------- compute edge"
+##ret=gen.Compute(mesh,ide)
+##print ret
+##log=mesh.GetLog(1);
+##for a in log:
+##    print a
+
+print "-------------------------- add hypothesis to box"
+
+box = salome.IDToObject(idb)
+submesh = mesh.GetSubMesh(box, "SubMeshBox")
+ret = mesh.AddHypothesis(box,algo_1)
+print ret
+ret = mesh.AddHypothesis(box,hypo1)
+print ret
+ret = mesh.AddHypothesis(box,algo_2)
+print ret
+ret = mesh.AddHypothesis(box,hypo4)
+print ret
+
+print "-------------------------- compute face"
+
+ret = gen.Compute(mesh,idf)
+print ret
+log = mesh.GetLog(0) # 0 - GetLog without ClearLog after, else if 1 - ClearLog after
+for a in log:
+    print "-------"
+    ii = 0
+    ir = 0
+    comType = a.commandType
+    if comType == 0:
+        for i in range(a.number):
+            ind = a.indexes[ii]
+            ii = ii+1
+            r1 = a.coords[ir]
+            ir = ir+1
+            r2 = a.coords[ir]
+            ir = ir+1
+            r3 = a.coords[ir]
+            ir = ir+1
+            print "AddNode %i - %g %g %g" % (ind, r1, r2, r3)
+    elif comType == 1:
+        for i in range(a.number):
+            ind = a.indexes[ii]
+            ii = ii+1
+            i1 = a.indexes[ii]
+            ii = ii+1
+            i2 = a.indexes[ii]
+            ii = ii+1
+            print "AddEdge %i - %i %i" % (ind, i1, i2)
+    elif comType == 2:
+        for i in range(a.number):
+            ind = a.indexes[ii]
+            ii = ii+1
+            i1 = a.indexes[ii]
+            ii = ii+1
+            i2 = a.indexes[ii]
+            ii = ii+1
+            i3 = a.indexes[ii]
+            ii = ii+1
+            print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3)
+
+##print "-------------------------- compute box"
+##ret=gen.Compute(mesh,idb)
+##print ret
+##log=mesh.GetLog(1);
+##print log
+
+##shell=salome.IDToObject(ids)
+##submesh=mesh.GetElementsOnShape(shell)
+##ret=mesh.AddHypothesis(shell,algo_1)
+##print ret
+##ret=mesh.AddHypothesis(shell,hypo1)
+##print ret
+##ret=gen.Compute(mesh,ids)
+##print ret
index 7259b6e35efd7852c84f91a421cf37d21935e19e..8a9e148dd186322d0f42241c09d4560f430bdd21 100644 (file)
@@ -50,7 +50,8 @@ def ConvertMED2UNV(thePath,theFile) :
         SetSObjName(anSObj,aFileName)
         print anSObj.GetName()
 
         SetSObjName(anSObj,aFileName)
         print anSObj.GetName()
 
-        aFileName = thePath + theFile + "." + str(iMesh) + ".unv"
+        aOutPath = '/tmp/'
+        aFileName = aOutPath + theFile + "." + str(iMesh) + ".unv"
         aMesh.ExportUNV(aFileName)
         aMesh = smesh.CreateMeshesFromUNV(aFileName)
         anSObj = salome.ObjectToSObject(aMesh)
         aMesh.ExportUNV(aFileName)
         aMesh = smesh.CreateMeshesFromUNV(aFileName)
         anSObj = salome.ObjectToSObject(aMesh)
index c5a7f9afc94ca344ce5df9e2c01c21492fd8ca21..70a41a971fd71e3a60e28505ba5d38b1660b0290 100644 (file)
@@ -79,7 +79,9 @@ d_element[10] = MakeCut(d_element[10], c_cyl)
 # Compound
 # --------
 
 # Compound
 # --------
 
-piece = MakeCompound(d_element)
+comp_all = MakeCompound(d_element)
+piece = BlocksOp.RemoveExtraEdges(comp_all)
+#piece = MakeCompound(d_element)
 
 # Add piece in study
 # ------------------
 
 # Add piece in study
 # ------------------
index 9e27f79ecc71f7ff7146137d705b85df2f886b81..5509d6a4850c34ad6388e219cc738400622de301 100644 (file)
@@ -149,7 +149,8 @@ cpd = cpd + r_element
 # Compound
 # --------
 
 # Compound
 # --------
 
-piece = MakeCompound(cpd)
+comp_all = MakeCompound(cpd)
+piece = BlocksOp.RemoveExtraEdges(comp_all)
 
 # Ajouter la piece dans l'etude
 # -----------------------------
 
 # Ajouter la piece dans l'etude
 # -----------------------------
index effc62d1db8d1503709f586734fe1006dfa72d67..528e4fe215a91fcb4e666b6ddc87bfe3f9f20e5c 100644 (file)
@@ -5,13 +5,16 @@
 # ------
 
 import geompy
 # ------
 
 import geompy
-
 import salome
 
 import StdMeshers
 import salome
 
 import StdMeshers
-
 import SMESH
 
 import SMESH
 
+"""
+ \namespace meshpy
+ \brief Module meshpy
+"""
+
 # Variables
 # ---------
 
 # Variables
 # ---------
 
@@ -20,24 +23,29 @@ smesh.SetCurrentStudy(salome.myStudy)
 smeshgui = salome.ImportComponentGUI("SMESH")
 smeshgui.Init(salome.myStudyId)
 
 smeshgui = salome.ImportComponentGUI("SMESH")
 smeshgui.Init(salome.myStudyId)
 
-# Hexahedrical meshing
-#
-# Examples: cube2pyGibi.py, lines 270-295
-#           cube2partition.py, lines 72-83
-# --------------------
-
 class MeshHexaImpl:
 class MeshHexaImpl:
+"""
+ Class MeshHexaImpl for Hexahedrical meshing
+
+ Examples: cube2pyGibi.py, lines 270-295
+           cube2partition.py, lines 72-83
+"""
     piece = 0
     name  = 0
     mesh  = 0
     cpt   = 0
 
     piece = 0
     name  = 0
     mesh  = 0
     cpt   = 0
 
-    # Sets algorithm and hypothesis for 1D discretization of the <shape>:
-    #   - algorithm  "Regular_1D"
-    #   - hypothesis "NumberOfSegments" with number of segments <n>
-    # --------------------
-
-    def Mesh1D(self, shape, n):
+    def Mesh1D(self, shape, n, propagate=0):
+    """
+     Define Wires discretization.
+     Sets algorithm and hypothesis for 1D discretization of \a shape:
+       - algorithm  "Regular_1D"
+       - hypothesis "NumberOfSegments" with number of segments \a n
+     \param shape Main shape or sub-shape to define wire discretization of
+     \param n Number of segments to split eash wire of the \a shape on
+     \param propagate Boolean flag. If propagate = 1,
+            "Propagation" hypothesis will be applied also to the \a shape
+    """
         hyp1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
         smeshgui.SetName(salome.ObjectToID(hyp1D), self.name+"/WireDiscretisation/"+str(self.cpt))
         self.mesh.AddHypothesis(shape, hyp1D)
         hyp1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
         smeshgui.SetName(salome.ObjectToID(hyp1D), self.name+"/WireDiscretisation/"+str(self.cpt))
         self.mesh.AddHypothesis(shape, hyp1D)
@@ -47,23 +55,31 @@ class MeshHexaImpl:
         smeshgui.SetName(salome.ObjectToID(hyp), self.name+"/Segments_"+str(n)+"/"+str(self.cpt))
         self.mesh.AddHypothesis(shape, hyp)
 
         smeshgui.SetName(salome.ObjectToID(hyp), self.name+"/Segments_"+str(n)+"/"+str(self.cpt))
         self.mesh.AddHypothesis(shape, hyp)
 
-        self.cpt=self.cpt+1
+        if propagate:
+            hypPro=smesh.CreateHypothesis("Propagation", "libStdMeshersEngine.so")
+            smeshgui.SetName(salome.ObjectToID(hypPro), self.name+"/Propagation/"+str(self.cpt))
+            self.mesh.AddHypothesis(shape, hypPro)
 
 
-    # Constructor
-    #
-    # Creates mesh on the shape <piece>,
-    # sets GUI name of this mesh to <name>.
-    # Sets the following global algorithms and hypotheses:
-    #   - for 1D discretization:
-    #       - algorithm  "Regular_1D"
-    #       - hypothesis "NumberOfSegments" with number of segments <n>,
-    #   - for 2D discretization:
-    #       - algorithm  "Quadrangle_2D"
-    #   - for 3D discretization:
-    #       - algorithm  "Hexa_3D"
-    # --------------------
+        self.cpt=self.cpt+1
 
     def __init__(self, piece, n, name):
 
     def __init__(self, piece, n, name):
+    """
+     Constructor
+
+     Creates mesh on the shape \a piece,
+     sets GUI name of this mesh to \a name. \n
+     Sets the following global algorithms and hypotheses:
+       - for 1D discretization:
+           - algorithm  "Regular_1D"
+           - hypothesis "NumberOfSegments" with number of segments \a n
+       - for 2D discretization:
+           - algorithm  "Quadrangle_2D"
+       - for 3D discretization:
+           - algorithm  "Hexa_3D"
+     \param piece Shape to be meshed
+     \param n Global number of segments for wires discretization
+     \param name Name for mesh to be created
+    """
         self.piece = piece
         self.name  = name
 
         self.piece = piece
         self.name  = name
 
@@ -80,30 +96,50 @@ class MeshHexaImpl:
         smeshgui.SetName(salome.ObjectToID(hyp3D), name+"/ijk")
         self.mesh.AddHypothesis(piece, hyp3D)
 
         smeshgui.SetName(salome.ObjectToID(hyp3D), name+"/ijk")
         self.mesh.AddHypothesis(piece, hyp3D)
 
-    # Creates sub-mesh of the mesh, created by constructor.
-    # This sub-mesh will be created on edge <edge>.
-    # Set algorithm and hypothesis for 1D discretization of the <edge>:
-    #   - algorithm  "Regular_1D"
-    #   - hypothesis "NumberOfSegments" with number of segments <n>
-    # Note: the <edge> will be automatically published in study under the shape, given in constructor.
-    # --------------------
-
     def local(self, edge, n):
     def local(self, edge, n):
+    """
+     Creates sub-mesh of the mesh, created by constructor.
+     This sub-mesh will be created on edge \a edge.
+     Set algorithm and hypothesis for 1D discretization of the \a edge:
+       - algorithm  "Regular_1D"
+       - hypothesis "NumberOfSegments" with number of segments \a n
+     \param edge Sub-edge of the main shape
+     \param n Number of segments to split the \a edge on
+     \note: \a edge will be automatically published in study under the shape, given in constructor.
+    """
         geompy.addToStudyInFather(self.piece, edge, geompy.SubShapeName(edge, self.piece))
         submesh = self.mesh.GetSubMesh(edge, self.name+"/SubMeshEdge/"+str(self.cpt))
         self.Mesh1D(edge, n)
 
         geompy.addToStudyInFather(self.piece, edge, geompy.SubShapeName(edge, self.piece))
         submesh = self.mesh.GetSubMesh(edge, self.name+"/SubMeshEdge/"+str(self.cpt))
         self.Mesh1D(edge, n)
 
-    # Computes mesh, created by constructor.
-    # --------------------
+    def Propagate(self, edge, n):
+    """
+     Creates sub-mesh of the mesh, created by constructor.
+     This sub-mesh will be created on edge \a edge and propagate the hypothesis on all correspondant edges.
+     Set algorithm and hypothesis for 1D discretization of the \a edge and all other propagate edges:
+       - algorithm  "Regular_1D"
+       - hypothesis "NumberOfSegments" with number of segments \a n
+       - hypothesis "Propagation"
+     \param edge Sub-edge of the main shape
+     \param n Number of segments to split the \a edge and all other propagate edges on
+     \note: \a edge will be automatically published in study under the shape, given in constructor.
+    """
+        geompy.addToStudyInFather(self.piece, edge, geompy.SubShapeName(edge, self.piece))
+        submesh = self.mesh.GetSubMesh(edge, self.name+"/SubMeshEdge/"+str(self.cpt))
+        self.Mesh1D(edge, n, 1)
 
     def Compute(self):
 
     def Compute(self):
+    """
+     Computes mesh, created by constructor.
+    """
         smesh.Compute(self.mesh, self.piece)
         salome.sg.updateObjBrowser(1)
 
         smesh.Compute(self.mesh, self.piece)
         salome.sg.updateObjBrowser(1)
 
-    # Creates mesh group based on a geometric group
-    # --------------------
-
     def Group(self, grp, name=""):
     def Group(self, grp, name=""):
+    """
+     Creates mesh group based on a geometric group
+     \param grp Geometric group
+     \param name Name for mesh group to be created
+    """
         if name == "":
             name = grp.GetName()
         tgeo = geompy.GroupOp.GetType(grp)
         if name == "":
             name = grp.GetName()
         tgeo = geompy.GroupOp.GetType(grp)
@@ -117,10 +153,12 @@ class MeshHexaImpl:
             type = SMESH.VOLUME
         return self.mesh.CreateGroupFromGEOM(type, name, grp)
 
             type = SMESH.VOLUME
         return self.mesh.CreateGroupFromGEOM(type, name, grp)
 
-    # Export mesh in a MED file
-    # --------------------
-
     def ExportMED(self, filename, groups=1):
     def ExportMED(self, filename, groups=1):
+    """
+     Export mesh in a MED file
+     \param filename Name for MED file to be created
+     \param groups Boolean flag. If groups = 1, mesh groups will be also stored in file
+    """
         self.mesh.ExportMED(filename, groups)
 
 MeshHexa = MeshHexaImpl
         self.mesh.ExportMED(filename, groups)
 
 MeshHexa = MeshHexaImpl
index d7d2e844e7f99fa4079d1fa6628e88df670fb2c8..86831c6b503740b975c5dac4521c0caf92c7f1c9 100644 (file)
@@ -218,7 +218,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(const TopoDS_Edge& theEdge
         double factor =
           length / (1 - pow( alpha,_value[ NB_SEGMENTS_IND ]));
 
         double factor =
           length / (1 - pow( alpha,_value[ NB_SEGMENTS_IND ]));
 
-        int i, NbPoints = (int) _value[ NB_SEGMENTS_IND ];
+        int i, NbPoints = 1 + (int) _value[ NB_SEGMENTS_IND ];
         for ( i = 2; i < NbPoints; i++ )
         {
           double param = factor * (1 - pow(alpha, i - 1));
         for ( i = 2; i < NbPoints; i++ )
         {
           double param = factor * (1 - pow(alpha, i - 1));
index 86eb49764867317fad1c31d590913e45f45739bd..fd44b0e5d0bd48fe276179a2c1f2022cefffe4f6 100644 (file)
@@ -66,7 +66,7 @@ LIB_SERVER_IDL =
 # additionnal information to compil and link file
 
 CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
 # additionnal information to compil and link file
 
 CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
-            $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
+            -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
             $(BOOST_CPPFLAGS)
 CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
 #$(OCC_CXXFLAGS)
             $(BOOST_CPPFLAGS)
 CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
 #$(OCC_CXXFLAGS)