From: prascle Date: Wed, 26 May 2010 07:13:13 +0000 (+0000) Subject: PR: merged from V5_1_4rc1 X-Git-Tag: smds_memimp_V5_1_4rc1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aa67cc96d730566d202d1014d97b7f0b3a4d71f4;p=modules%2Fsmesh.git PR: merged from V5_1_4rc1 --- diff --git a/Makefile.am b/Makefile.am index f6395e9bd..8b479765a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # -* Makefile *- # Author : Patrick GOLDBRONN (CEA) # Date : 28/06/2001 diff --git a/SMESH_version.h.in b/SMESH_version.h.in index d9b835afa..64d31df91 100644 --- a/SMESH_version.h.in +++ b/SMESH_version.h.in @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_version.h // Author : Vadim SANDLER // Module : SALOME diff --git a/adm_local/Makefile.am b/adm_local/Makefile.am index 0b7954458..8c38d3d27 100644 --- a/adm_local/Makefile.am +++ b/adm_local/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + include $(top_srcdir)/adm_local/unix/make_common_starter.am SUBDIRS = unix cmake_files diff --git a/adm_local/cmake_files/FindSMESH.cmake b/adm_local/cmake_files/FindSMESH.cmake index af250a460..cd7b4c55a 100644 --- a/adm_local/cmake_files/FindSMESH.cmake +++ b/adm_local/cmake_files/FindSMESH.cmake @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -22,6 +19,7 @@ SET(SMESH_CXXFLAGS -I${SMESH_ROOT_DIR}/include/salome) +FIND_LIBRARY(GeomSelectionTools GeomSelectionTools ${SMESH_ROOT_DIR}/lib/salome) FIND_LIBRARY(MEFISTO2D MEFISTO2D ${SMESH_ROOT_DIR}/lib/salome) FIND_LIBRARY(MeshDriverDAT MeshDriverDAT ${SMESH_ROOT_DIR}/lib/salome) FIND_LIBRARY(MeshDriverMED MeshDriverMED ${SMESH_ROOT_DIR}/lib/salome) diff --git a/adm_local/cmake_files/Makefile.am b/adm_local/cmake_files/Makefile.am index 95246b897..8d4db5e06 100644 --- a/adm_local/cmake_files/Makefile.am +++ b/adm_local/cmake_files/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + include $(top_srcdir)/adm_local/unix/make_common_starter.am admlocal_cmakedir = $(admlocaldir)/cmake_files diff --git a/adm_local/unix/Makefile.am b/adm_local/unix/Makefile.am index 5f6d5f753..190640454 100644 --- a/adm_local/unix/Makefile.am +++ b/adm_local/unix/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + include $(top_srcdir)/adm_local/unix/make_common_starter.am SUBDIRS = config_files diff --git a/adm_local/unix/config_files/Makefile.am b/adm_local/unix/config_files/Makefile.am index 54f5b3f51..ef0b61dd0 100644 --- a/adm_local/unix/config_files/Makefile.am +++ b/adm_local/unix/config_files/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,10 +16,9 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + include $(top_srcdir)/adm_local/unix/make_common_starter.am dist_admlocalm4_DATA = \ check_SMESH.m4 \ - check_f77.m4 \ - check_Platform.m4 \ - check_qwt.m4 + check_Platform.m4 diff --git a/adm_local/unix/config_files/check_Platform.m4 b/adm_local/unix/config_files/check_Platform.m4 index ff6606562..6262fbfaf 100755 --- a/adm_local/unix/config_files/check_Platform.m4 +++ b/adm_local/unix/config_files/check_Platform.m4 @@ -1,4 +1,4 @@ -dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +dnl Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE dnl dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA dnl dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com dnl + AC_DEFUN([CHECK_PLATFORM],[ AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_CPP])dnl diff --git a/adm_local/unix/config_files/check_SMESH.m4 b/adm_local/unix/config_files/check_SMESH.m4 index 4c0cdb6e4..6a704081e 100644 --- a/adm_local/unix/config_files/check_SMESH.m4 +++ b/adm_local/unix/config_files/check_SMESH.m4 @@ -1,4 +1,4 @@ -dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +dnl Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE dnl dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA dnl dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com dnl + # Check availability of SMesh binary distribution # # Author : Nicolas REJNERI (OPEN CASCADE, 2003) diff --git a/adm_local/unix/make_common_starter.am b/adm_local/unix/make_common_starter.am index cd851519b..782a8154d 100644 --- a/adm_local/unix/make_common_starter.am +++ b/adm_local/unix/make_common_starter.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -24,6 +21,7 @@ # The following is to avoid PACKAGE_... env variable # redefinition compilation warnings # ============================================================ +# AM_CXXFLAGS = @KERNEL_CXXFLAGS@ -include SALOMEconfig.h AM_CPPFLAGS = @KERNEL_CXXFLAGS@ -include SALOMEconfig.h diff --git a/bin/Makefile.am b/bin/Makefile.am index db97f629b..35df158eb 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # -* Makefile *- # Author : Guillaume Boulant (CSSI) # Module : SMESH diff --git a/bin/smesh_setenv.py b/bin/smesh_setenv.py index a25e5180b..6cf6a3233 100644 --- a/bin/smesh_setenv.py +++ b/bin/smesh_setenv.py @@ -1,9 +1,6 @@ #!/usr/bin/env python # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/build_cmake b/build_cmake index c7ead0ce7..a0e084b95 100755 --- a/build_cmake +++ b/build_cmake @@ -1,8 +1,5 @@ #!/bin/sh -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/build_cmake.bat b/build_cmake.bat index c763d56e4..8de3956bf 100644 --- a/build_cmake.bat +++ b/build_cmake.bat @@ -1,2 +1,20 @@ - +@REM Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +@REM +@REM This library is free software; you can redistribute it and/or +@REM modify it under the terms of the GNU Lesser General Public +@REM License as published by the Free Software Foundation; either +@REM version 2.1 of the License. +@REM +@REM This library is distributed in the hope that it will be useful, +@REM but WITHOUT ANY WARRANTY; without even the implied warranty of +@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +@REM Lesser General Public License for more details. +@REM +@REM You should have received a copy of the GNU Lesser General Public +@REM License along with this library; if not, write to the Free Software +@REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +@REM +@REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +@REM + %PYTHONBIN% %KERNEL_ROOT_DIR%\salome_adm\cmake_files\am2cmake.py --smesh diff --git a/build_configure b/build_configure index 6c5331b6a..607c2558b 100755 --- a/build_configure +++ b/build_configure @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Tool for updating list of .in file for the SALOME project # and regenerating configure script # Author : Marc Tajchman - CEA @@ -77,10 +78,19 @@ ABS_CONF_DIR=`pwd` # autom4te.cache (directory) echo "====================================================== aclocal" -aclocal -I adm_local/unix/config_files \ - -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ - -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ - -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files || exit 1 +if test -d "${GUI_ROOT_DIR}"; then + aclocal -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \ + -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ + -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files || exit 1 +else + aclocal -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ + -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files || exit 1 +fi + # ____________________________________________________________________ # libtoolize creates some configuration files (ltmain.sh, diff --git a/clean_configure b/clean_configure index 423451e2b..be3f7f1af 100755 --- a/clean_configure +++ b/clean_configure @@ -1,8 +1,5 @@ #!/bin/sh -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -20,6 +17,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + rm -rf autom4te.cache aclocal.m4 configure make_config find . -name "*~" -print -exec rm {} \; find . -name "*.pyc" -print -exec rm {} \; diff --git a/configure.ac b/configure.ac index 7f5e389b6..0cfcd12fa 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Author : Marc Tajchman (CEA) # Date : 28/06/2001 # Modified by : Patrick GOLDBRONN (CEA) @@ -26,7 +24,7 @@ # Modified by : Alexander BORODIN (OCN) - autotools usage # Created from configure.in.base # -AC_INIT([Salome2 Project SMESH module], [5.1.3], [webmaster.salome@opencascade.com], [SalomeSMESH]) +AC_INIT([Salome2 Project SMESH module], [5.1.4], [webmaster.salome@opencascade.com], [SalomeSMESH]) AC_CONFIG_AUX_DIR(adm_local/unix/config_files) AC_CANONICAL_HOST AC_CANONICAL_TARGET @@ -447,8 +445,10 @@ AC_OUTPUT([ \ doc/salome/gui/SMESH/Makefile \ doc/salome/gui/SMESH/doxyfile \ doc/salome/gui/SMESH/doxyfile_py \ + doc/salome/gui/SMESH/static/header.html \ doc/salome/tui/Makefile \ doc/salome/tui/doxyfile \ + doc/salome/tui/static/header.html \ src/Makefile \ src/Controls/Makefile \ src/Driver/Makefile \ @@ -458,6 +458,7 @@ AC_OUTPUT([ \ src/DriverUNV/Makefile \ src/MEFISTO2/Makefile \ src/OBJECT/Makefile \ + src/PluginUtils/Makefile \ src/SMDS/Makefile \ src/SMESH/Makefile \ src/SMESHClient/Makefile \ diff --git a/doc/Makefile.am b/doc/Makefile.am index 1902d9d21..f40fb81a5 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # -* Makefile *- # Author : Patrick GOLDBRONN (CEA) # Date : 30/11/2001 diff --git a/doc/salome/Makefile.am b/doc/salome/Makefile.am index 5a92861e5..4a09173c6 100644 --- a/doc/salome/Makefile.am +++ b/doc/salome/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # -* Makefile *- # Author : Patrick GOLDBRONN (CEA) # Date : 30/11/2001 diff --git a/doc/salome/gui/Makefile.am b/doc/salome/gui/Makefile.am index 0e41ee5ff..f2e7362f1 100644 --- a/doc/salome/gui/Makefile.am +++ b/doc/salome/gui/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.in # Author : Vasily Rusyaev (Open Cascade NN) # Modified by : Alexander BORODIN (OCN) - autotools usage diff --git a/doc/salome/gui/SMESH/Makefile.am b/doc/salome/gui/SMESH/Makefile.am index a93b57ccb..187295302 100755 --- a/doc/salome/gui/SMESH/Makefile.am +++ b/doc/salome/gui/SMESH/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.in # Author : Vasily Rusyaev (Open Cascade NN) # Modified by : Alexander BORODIN (OCN) - autotools usage @@ -26,7 +24,11 @@ # include $(top_srcdir)/adm_local/unix/make_common_starter.am -EXTRA_DIST += images input static +EXTRA_DIST += images input static/footer.html static/doxygen.css + +guidocdir = $(docdir)/gui/SMESH +guidoc_DATA = images/head.png + usr_docs: doxyfile_py doxyfile echo "===========================================" ; \ diff --git a/doc/salome/gui/SMESH/doxyfile.in b/doc/salome/gui/SMESH/doxyfile.in index b084396ba..ce268972f 100755 --- a/doc/salome/gui/SMESH/doxyfile.in +++ b/doc/salome/gui/SMESH/doxyfile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -22,7 +22,7 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "Mesh Module Reference Manual v.@VERSION@" +PROJECT_NAME = "SALOME Mesh User's Guide" OUTPUT_DIRECTORY = . CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English @@ -48,9 +48,9 @@ EXAMPLE_PATH = @top_srcdir@/src/SMESH_SWIG #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = . -HTML_HEADER = @srcdir@/static/header.html +HTML_HEADER = @builddir@/static/header.html HTML_FOOTER = @srcdir@/static/footer.html -#HTML_STYLESHEET = @srcdir@/static/doxygen.css +HTML_STYLESHEET = @srcdir@/static/doxygen.css TOC_EXPAND = YES DISABLE_INDEX = NO GENERATE_TREEVIEW = YES diff --git a/doc/salome/gui/SMESH/doxyfile_py.in b/doc/salome/gui/SMESH/doxyfile_py.in index c35d4aaa7..6d45aa6b5 100755 --- a/doc/salome/gui/SMESH/doxyfile_py.in +++ b/doc/salome/gui/SMESH/doxyfile_py.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -22,7 +22,7 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "Mesh Module Reference Manual v.@VERSION@" +PROJECT_NAME = "SALOME Mesh User's Guide" OUTPUT_DIRECTORY = . CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English @@ -109,9 +109,9 @@ EXAMPLE_PATH = @top_srcdir@/src/SMESH_SWIG #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = smeshpy_doc -HTML_HEADER = @srcdir@/static/header.html +HTML_HEADER = @builddir@/static/header.html HTML_FOOTER = @srcdir@/static/footer.html -#HTML_STYLESHEET = @srcdir@/static/doxygen.css +HTML_STYLESHEET = @srcdir@/static/doxygen.css TOC_EXPAND = YES DISABLE_INDEX = YES GENERATE_TREEVIEW = NO diff --git a/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png b/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png index 26403226c..009f71d51 100755 Binary files a/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png and b/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png differ diff --git a/doc/salome/gui/SMESH/images/add0delement.png b/doc/salome/gui/SMESH/images/add0delement.png index e6578f888..d3d8da302 100644 Binary files a/doc/salome/gui/SMESH/images/add0delement.png and b/doc/salome/gui/SMESH/images/add0delement.png differ diff --git a/doc/salome/gui/SMESH/images/addedge.png b/doc/salome/gui/SMESH/images/addedge.png index f142dffb2..34f4fe07a 100755 Binary files a/doc/salome/gui/SMESH/images/addedge.png and b/doc/salome/gui/SMESH/images/addedge.png differ diff --git a/doc/salome/gui/SMESH/images/addhexahedron.png b/doc/salome/gui/SMESH/images/addhexahedron.png index 78ea3b50f..65d881f86 100755 Binary files a/doc/salome/gui/SMESH/images/addhexahedron.png and b/doc/salome/gui/SMESH/images/addhexahedron.png differ diff --git a/doc/salome/gui/SMESH/images/addnode.png b/doc/salome/gui/SMESH/images/addnode.png index 1f5375b9a..bbde71e6a 100755 Binary files a/doc/salome/gui/SMESH/images/addnode.png and b/doc/salome/gui/SMESH/images/addnode.png differ diff --git a/doc/salome/gui/SMESH/images/addnode_notebook.png b/doc/salome/gui/SMESH/images/addnode_notebook.png index 4abab3358..804f806df 100755 Binary files a/doc/salome/gui/SMESH/images/addnode_notebook.png and b/doc/salome/gui/SMESH/images/addnode_notebook.png differ diff --git a/doc/salome/gui/SMESH/images/addpolygon.png b/doc/salome/gui/SMESH/images/addpolygon.png index 5d02dd70d..71b81ecca 100755 Binary files a/doc/salome/gui/SMESH/images/addpolygon.png and b/doc/salome/gui/SMESH/images/addpolygon.png differ diff --git a/doc/salome/gui/SMESH/images/addquadrangle.png b/doc/salome/gui/SMESH/images/addquadrangle.png index 3e5c87c42..3dccce258 100755 Binary files a/doc/salome/gui/SMESH/images/addquadrangle.png and b/doc/salome/gui/SMESH/images/addquadrangle.png differ diff --git a/doc/salome/gui/SMESH/images/addtetrahedron.png b/doc/salome/gui/SMESH/images/addtetrahedron.png index 37dc29659..0289a95e4 100755 Binary files a/doc/salome/gui/SMESH/images/addtetrahedron.png and b/doc/salome/gui/SMESH/images/addtetrahedron.png differ diff --git a/doc/salome/gui/SMESH/images/addtriangle.png b/doc/salome/gui/SMESH/images/addtriangle.png index 52a644e51..991085fd1 100755 Binary files a/doc/salome/gui/SMESH/images/addtriangle.png and b/doc/salome/gui/SMESH/images/addtriangle.png differ diff --git a/doc/salome/gui/SMESH/images/aqt.png b/doc/salome/gui/SMESH/images/aqt.png index ae8e0d081..46ee94dae 100755 Binary files a/doc/salome/gui/SMESH/images/aqt.png and b/doc/salome/gui/SMESH/images/aqt.png differ diff --git a/doc/salome/gui/SMESH/images/colors_size.png b/doc/salome/gui/SMESH/images/colors_size.png new file mode 100755 index 000000000..58210c0bc Binary files /dev/null and b/doc/salome/gui/SMESH/images/colors_size.png differ diff --git a/doc/salome/gui/SMESH/images/custom_point_marker.png b/doc/salome/gui/SMESH/images/custom_point_marker.png new file mode 100755 index 000000000..a46e33ed9 Binary files /dev/null and b/doc/salome/gui/SMESH/images/custom_point_marker.png differ diff --git a/doc/salome/gui/SMESH/images/dialog.png b/doc/salome/gui/SMESH/images/dialog.png index 1fa2c4263..2f3bbed31 100755 Binary files a/doc/salome/gui/SMESH/images/dialog.png and b/doc/salome/gui/SMESH/images/dialog.png differ diff --git a/doc/salome/gui/SMESH/images/findelement1.png b/doc/salome/gui/SMESH/images/findelement1.png new file mode 100644 index 000000000..c741368e2 Binary files /dev/null and b/doc/salome/gui/SMESH/images/findelement1.png differ diff --git a/doc/salome/gui/SMESH/images/findelement2.png b/doc/salome/gui/SMESH/images/findelement2.png new file mode 100644 index 000000000..b351b32ec Binary files /dev/null and b/doc/salome/gui/SMESH/images/findelement2.png differ diff --git a/doc/salome/gui/SMESH/images/findelement3.png b/doc/salome/gui/SMESH/images/findelement3.png new file mode 100644 index 000000000..26cfff2d7 Binary files /dev/null and b/doc/salome/gui/SMESH/images/findelement3.png differ diff --git a/doc/salome/gui/SMESH/images/head.png b/doc/salome/gui/SMESH/images/head.png new file mode 100755 index 000000000..307d9ef9a Binary files /dev/null and b/doc/salome/gui/SMESH/images/head.png differ diff --git a/doc/salome/gui/SMESH/images/hexotic_parameters.png b/doc/salome/gui/SMESH/images/hexotic_parameters.png new file mode 100644 index 000000000..c06ff3bb2 Binary files /dev/null and b/doc/salome/gui/SMESH/images/hexotic_parameters.png differ diff --git a/doc/salome/gui/SMESH/images/mergeelems.png b/doc/salome/gui/SMESH/images/mergeelems.png index c5e160884..eaa5a9323 100755 Binary files a/doc/salome/gui/SMESH/images/mergeelems.png and b/doc/salome/gui/SMESH/images/mergeelems.png differ diff --git a/doc/salome/gui/SMESH/images/mergeelems_auto.png b/doc/salome/gui/SMESH/images/mergeelems_auto.png new file mode 100644 index 000000000..f8ef74f13 Binary files /dev/null and b/doc/salome/gui/SMESH/images/mergeelems_auto.png differ diff --git a/doc/salome/gui/SMESH/images/mergenodes.png b/doc/salome/gui/SMESH/images/mergenodes.png index d14620101..024bc22e8 100755 Binary files a/doc/salome/gui/SMESH/images/mergenodes.png and b/doc/salome/gui/SMESH/images/mergenodes.png differ diff --git a/doc/salome/gui/SMESH/images/mergenodes_auto.png b/doc/salome/gui/SMESH/images/mergenodes_auto.png new file mode 100644 index 000000000..b2920867c Binary files /dev/null and b/doc/salome/gui/SMESH/images/mergenodes_auto.png differ diff --git a/doc/salome/gui/SMESH/images/mesh_order_123.png b/doc/salome/gui/SMESH/images/mesh_order_123.png new file mode 100644 index 000000000..952f20796 Binary files /dev/null and b/doc/salome/gui/SMESH/images/mesh_order_123.png differ diff --git a/doc/salome/gui/SMESH/images/mesh_order_123_res.png b/doc/salome/gui/SMESH/images/mesh_order_123_res.png new file mode 100644 index 000000000..7b7588c63 Binary files /dev/null and b/doc/salome/gui/SMESH/images/mesh_order_123_res.png differ diff --git a/doc/salome/gui/SMESH/images/mesh_order_213.png b/doc/salome/gui/SMESH/images/mesh_order_213.png new file mode 100644 index 000000000..959ca384e Binary files /dev/null and b/doc/salome/gui/SMESH/images/mesh_order_213.png differ diff --git a/doc/salome/gui/SMESH/images/mesh_order_213_res.png b/doc/salome/gui/SMESH/images/mesh_order_213_res.png new file mode 100644 index 000000000..ca36759a9 Binary files /dev/null and b/doc/salome/gui/SMESH/images/mesh_order_213_res.png differ diff --git a/doc/salome/gui/SMESH/images/mesh_order_321.png b/doc/salome/gui/SMESH/images/mesh_order_321.png new file mode 100644 index 000000000..7ad61fabd Binary files /dev/null and b/doc/salome/gui/SMESH/images/mesh_order_321.png differ diff --git a/doc/salome/gui/SMESH/images/mesh_order_321_res.png b/doc/salome/gui/SMESH/images/mesh_order_321_res.png new file mode 100644 index 000000000..051447093 Binary files /dev/null and b/doc/salome/gui/SMESH/images/mesh_order_321_res.png differ diff --git a/doc/salome/gui/SMESH/images/mesh_order_no_concurrent.png b/doc/salome/gui/SMESH/images/mesh_order_no_concurrent.png new file mode 100644 index 000000000..6df59a1f1 Binary files /dev/null and b/doc/salome/gui/SMESH/images/mesh_order_no_concurrent.png differ diff --git a/doc/salome/gui/SMESH/images/mesh_order_preview.png b/doc/salome/gui/SMESH/images/mesh_order_preview.png new file mode 100644 index 000000000..f4b5e3b98 Binary files /dev/null and b/doc/salome/gui/SMESH/images/mesh_order_preview.png differ diff --git a/doc/salome/gui/SMESH/images/point_marker_widget1.png b/doc/salome/gui/SMESH/images/point_marker_widget1.png new file mode 100755 index 000000000..13b8e6dab Binary files /dev/null and b/doc/salome/gui/SMESH/images/point_marker_widget1.png differ diff --git a/doc/salome/gui/SMESH/images/point_marker_widget2.png b/doc/salome/gui/SMESH/images/point_marker_widget2.png new file mode 100755 index 000000000..dbb81b40e Binary files /dev/null and b/doc/salome/gui/SMESH/images/point_marker_widget2.png differ diff --git a/doc/salome/gui/SMESH/images/scale01.png b/doc/salome/gui/SMESH/images/scale01.png new file mode 100644 index 000000000..72ae775ff Binary files /dev/null and b/doc/salome/gui/SMESH/images/scale01.png differ diff --git a/doc/salome/gui/SMESH/images/scale02.png b/doc/salome/gui/SMESH/images/scale02.png new file mode 100644 index 000000000..9d6a5f30f Binary files /dev/null and b/doc/salome/gui/SMESH/images/scale02.png differ diff --git a/doc/salome/gui/SMESH/images/scale03.png b/doc/salome/gui/SMESH/images/scale03.png new file mode 100644 index 000000000..891ae8d17 Binary files /dev/null and b/doc/salome/gui/SMESH/images/scale03.png differ diff --git a/doc/salome/gui/SMESH/images/scale04.png b/doc/salome/gui/SMESH/images/scale04.png new file mode 100644 index 000000000..a0428342a Binary files /dev/null and b/doc/salome/gui/SMESH/images/scale04.png differ diff --git a/doc/salome/gui/SMESH/images/scale06.png b/doc/salome/gui/SMESH/images/scale06.png new file mode 100644 index 000000000..2bd8219d2 Binary files /dev/null and b/doc/salome/gui/SMESH/images/scale06.png differ diff --git a/doc/salome/gui/SMESH/images/scale07.png b/doc/salome/gui/SMESH/images/scale07.png new file mode 100644 index 000000000..8ee0923bd Binary files /dev/null and b/doc/salome/gui/SMESH/images/scale07.png differ diff --git a/doc/salome/gui/SMESH/images/scale09.png b/doc/salome/gui/SMESH/images/scale09.png new file mode 100644 index 000000000..2816bac4b Binary files /dev/null and b/doc/salome/gui/SMESH/images/scale09.png differ diff --git a/doc/salome/gui/SMESH/images/scaleinit01.png b/doc/salome/gui/SMESH/images/scaleinit01.png new file mode 100644 index 000000000..97990a868 Binary files /dev/null and b/doc/salome/gui/SMESH/images/scaleinit01.png differ diff --git a/doc/salome/gui/SMESH/images/scaleinit02.png b/doc/salome/gui/SMESH/images/scaleinit02.png new file mode 100644 index 000000000..008d2e321 Binary files /dev/null and b/doc/salome/gui/SMESH/images/scaleinit02.png differ diff --git a/doc/salome/gui/SMESH/images/scaleres03.png b/doc/salome/gui/SMESH/images/scaleres03.png new file mode 100644 index 000000000..99b65d72a Binary files /dev/null and b/doc/salome/gui/SMESH/images/scaleres03.png differ diff --git a/doc/salome/gui/SMESH/images/scaleres04.png b/doc/salome/gui/SMESH/images/scaleres04.png new file mode 100644 index 000000000..0880989cb Binary files /dev/null and b/doc/salome/gui/SMESH/images/scaleres04.png differ diff --git a/doc/salome/gui/SMESH/images/scaleres06.png b/doc/salome/gui/SMESH/images/scaleres06.png new file mode 100644 index 000000000..059fa97f4 Binary files /dev/null and b/doc/salome/gui/SMESH/images/scaleres06.png differ diff --git a/doc/salome/gui/SMESH/images/scaleres07.png b/doc/salome/gui/SMESH/images/scaleres07.png new file mode 100644 index 000000000..b75f83c3c Binary files /dev/null and b/doc/salome/gui/SMESH/images/scaleres07.png differ diff --git a/doc/salome/gui/SMESH/images/scaleres09.png b/doc/salome/gui/SMESH/images/scaleres09.png new file mode 100644 index 000000000..4708be51f Binary files /dev/null and b/doc/salome/gui/SMESH/images/scaleres09.png differ diff --git a/doc/salome/gui/SMESH/images/split_into_tetra.png b/doc/salome/gui/SMESH/images/split_into_tetra.png new file mode 100644 index 000000000..bc88b1169 Binary files /dev/null and b/doc/salome/gui/SMESH/images/split_into_tetra.png differ diff --git a/doc/salome/gui/SMESH/images/split_into_tetra_icon.png b/doc/salome/gui/SMESH/images/split_into_tetra_icon.png new file mode 100644 index 000000000..b113c304d Binary files /dev/null and b/doc/salome/gui/SMESH/images/split_into_tetra_icon.png differ diff --git a/doc/salome/gui/SMESH/images/std_point_marker.png b/doc/salome/gui/SMESH/images/std_point_marker.png new file mode 100755 index 000000000..2a6269309 Binary files /dev/null and b/doc/salome/gui/SMESH/images/std_point_marker.png differ diff --git a/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc b/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc index dd42e9962..8e789536f 100644 --- a/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc +++ b/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc @@ -66,18 +66,25 @@ shows the good (left) and the bad (right) results of meshing. \image html hypo_quad_params_res_2.png "The resulting meshes" -
+See Also a sample TUI Script of a +\ref tui_quadrangle_parameters "Quadrangle Parameters" hypothesis. + \anchor quadrangle_preference_anchor

Quadrangle Preference

-This algorithm can be used only together with Quadrangle (Mapping) -algorithm. It allows to build quadrangular meshes even if the number +This algorithm can be used together with Quadrangle (Mapping) and Netgen 2D +algorithms. + +It allows Netgen 2D to build quadrangular meshes at any conditions. + +It allows Quadrangle (Mapping) to build quadrangular meshes even if the number of nodes at the opposite edges of a meshed face is not equal, otherwise this mesh will contain some triangular elements.
This hypothesis has one restriction on its work: the total quantity of segments on all four sides of the face must be even (divisible by 2). +
\anchor triangle_preference_anchor

Triangle Preference

diff --git a/doc/salome/gui/SMESH/input/about_hypo.doc b/doc/salome/gui/SMESH/input/about_hypo.doc index cc8f5fd52..9d9db7b32 100644 --- a/doc/salome/gui/SMESH/input/about_hypo.doc +++ b/doc/salome/gui/SMESH/input/about_hypo.doc @@ -45,6 +45,7 @@ meshers and thus, work only with definite algorithms.
  • \subpage ghs3d_hypo_page
  • - works with GHS3D algorithm.
  • \subpage ghs3dprl_hypo_page
  • - works with GHS3DPRL (tepal) algorithm.
  • \subpage blsurf_hypo_page
  • - works with BLSURF algorithm. +
  • \subpage hexotic_hypo_page
  • - works with Hexotic algorithm. There also exist diff --git a/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc b/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc index 5cb3b1548..451823b74 100644 --- a/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc +++ b/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc @@ -26,6 +26,10 @@ following associated submenu will appear: \image html image146.png From this submenu select the type of element which you would like to add to your mesh. +\note All dialogs intended for adding nodes or elements to mesh (except dialog for adding +0D elements) provide a possibility to add these nodes/elements to the specified group +(or to create the group if it doesn't exist). Add to group box allows to choose +an existing group for created node or element or to specify a name for new group. See Also sample TUI Scripts of diff --git a/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc b/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc index afe9b77b5..2a587d147 100644 --- a/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc +++ b/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc @@ -18,6 +18,11 @@ one of the following: \image html image152.png +\note All dialogs intended for adding quadratic elements to mesh provide a possibility +to add these elements to the specified group (or to create the group if it doesn't exist). +Add to group box allows to choose an existing group for created element or +to specify a name for new group. + To create any Quadratic Element specify the nodes which will form your triangle by selecting them in the 3D viewer with pressed Shift button. Their numbers will appear in the dialog box as Corner Nodes diff --git a/doc/salome/gui/SMESH/input/basic_meshing_algos.doc b/doc/salome/gui/SMESH/input/basic_meshing_algos.doc index a83a64f9f..e957a9713 100644 --- a/doc/salome/gui/SMESH/input/basic_meshing_algos.doc +++ b/doc/salome/gui/SMESH/input/basic_meshing_algos.doc @@ -47,6 +47,15 @@ tetrahedral (pyramidal) elements. \image html image126.gif "Example of a hexahedral 3D mesh" +Some of 3D meshing algorithms also can generate 3D meshes from 2D meshes, working without +geometrical objects. Such algorithms are + + + \note BLSURF and GHS3D are commercial meshers and require a license to be used within the Mesh module. diff --git a/doc/salome/gui/SMESH/input/colors_size.doc b/doc/salome/gui/SMESH/input/colors_size.doc new file mode 100644 index 000000000..aa244579b --- /dev/null +++ b/doc/salome/gui/SMESH/input/colors_size.doc @@ -0,0 +1,35 @@ +/*! + +\page colors_size_page Colors / Size + +\image html colors_size.png + +Using this dialog you can define the following set of mesh visualization +parameters: + + +*/ \ No newline at end of file diff --git a/doc/salome/gui/SMESH/input/constructing_meshes.doc b/doc/salome/gui/SMESH/input/constructing_meshes.doc index 625cff3bd..042b66320 100644 --- a/doc/salome/gui/SMESH/input/constructing_meshes.doc +++ b/doc/salome/gui/SMESH/input/constructing_meshes.doc @@ -152,10 +152,92 @@ evaluation will be displayed in the following information box: \image html mesh_evaluation_succeed.png + -Consider trying a sample script for construction of a mesh from our -\ref tui_creating_meshes_page "TUI Scripts" section. + + +\anchor mesh_order_anchor +It is allowed to change submesh priority in mesh computation when +there are concurrent submeshes present. I.e. user can change priority of +applying algorithms on shared subshapes of Mesh shape. +To change submesh priority: +
      +
    1. From the Mesh menu choose the "Change submesh priority" on +selected Mesh item, or invoke from popup menu. The opened dialogue box +shows a list of submeshes in the order of their priority. Algorithm and its +hypotheses of a submesh being upper in the list are applied before those of +a submesh lower in the list. + +There is an example of submesh order modifications of Mesh created on a Box +shape. The main Mesh object: +
        +
      • 3D Tetrahedron (Netgen) with HypothesisMax Element Volume
      • +
      • 2D Triangle (Mefisto) with HypothesisMax Element Area
      • +
      • 1D Wire discretisation with Number of Segments=20
      • +
      +The first submesh object Submesh_1 created on Face_1 +is: +
        +
      • 2D Netgen 1D-2D with Hypothesis Netgen Simple parameters +(Number of Segments = 4)
      • +
      +The second submesh object Submesh_2 created on Face_2 +is: +
        +
      • 2D Netgen 1D-2D with Hypothesis Netgen Simple parameters +(Number of Segments = 8)
      • +
      + +And the last third submesh object Submesh_3 created on Face_3 +is: +
        +
      • 2D Netgen 1D-2D with Hypothesis Netgen Simple parameters +(Number of Segments = 12)
      • +
      +The submeshes can become concurrent if their algorithms leads to mesh shared subshape +with different algorithms (or different algorithms parameters, i.e. hypothesises). +In fact, we have three submeshes with concurrent algorithms, because +they have different hypothesises assigned to them. + +The first mesh computation made with: +\image html mesh_order_123.png +
      "Mesh order SubMesh_1, SubMesh_2, SubMesh_3"
      +\image html mesh_order_123_res.png +
      "Result mesh with order SubMesh_1, SubMesh_2, SubMesh_3 "
      + +The next mesh computation with: +\image html mesh_order_213.png +
      "Mesh order SubMesh_2, SubMesh_1, SubMesh_3"
      +\image html mesh_order_213_res.png +
      "Result mesh with order SubMesh_2, SubMesh_1, SubMesh_3 "
      + +And the last mesh computation with: +\image html mesh_order_321.png +
      "Mesh order SubMesh_3, SubMesh_2, SubMesh_1"
      +\image html mesh_order_321_res.png +
      "Result mesh with order SubMesh_3, SubMesh_2, SubMesh_1 "
      + +As we can see each mesh computation has different number of result +elements and different mesh discretisation on shared edges (edges +that are shared between Face_1, Face_2 and Face_3) + +Additionally, submesh priority (order of algorithms to be applied) can +be modified not only in separate dialog box, but in Preview +also. This helps to preview different mesh results, modifying submesh +order. +\image html mesh_order_preview.png +
      "Preview with submesh priority list box"
      + +If there are no concurrent submeshes under Mesh object, then user will see the +following information dialog box +\image html mesh_order_no_concurrent.png +
      "No concurrent submeshes detected"
      +and no mesh order list box will appear in Preview dialog box. +
    +Consider trying a sample script for construction of a mesh from our +\ref tui_creating_meshes_page "TUI Scripts" section. + */ diff --git a/doc/salome/gui/SMESH/input/find_element_by_point.doc b/doc/salome/gui/SMESH/input/find_element_by_point.doc new file mode 100644 index 000000000..34380aed4 --- /dev/null +++ b/doc/salome/gui/SMESH/input/find_element_by_point.doc @@ -0,0 +1,41 @@ +/*! + +\page find_element_by_point_page Find Element by Point + +\n This functionality allows you to find all mesh elements to which +belongs a certain point. + +To find the elements: +
      +
    1. Select the mesh
    2. +
    3. Select from the Mesh menu or from the context menu the Find +Element by Point item. + +\image html findelement3.png +
      "Find Element by Point" button
      + +The following dialog box will appear: + +\image html findelement2.png + +
    4. +
    5. In this dialog box you should select: + +
        +
      • the coordinates of the point;
      • +
      • the type of elements to be found; it is also possible to find elements +of all types related to the reference point. To be exact, type "All" +means to find elements of any type except nodes and 0D elements.
      • +
      + +
    6. +
    7. Click the \b Apply or \b OK button.
    8. +
    + +\image html findelement1.png +
    The reference point and the related elements.
    + + +
    See Also a sample TUI Script of a \ref tui_find_element_by_point "Find Element by Point" operation. + +*/ diff --git a/doc/salome/gui/SMESH/input/ghs3dprl_hypo.doc b/doc/salome/gui/SMESH/input/ghs3dprl_hypo.doc index dc7985988..a7f69dfc8 100644 --- a/doc/salome/gui/SMESH/input/ghs3dprl_hypo.doc +++ b/doc/salome/gui/SMESH/input/ghs3dprl_hypo.doc @@ -2,20 +2,22 @@ \page ghs3dprl_hypo_page GHS3DPRL Parameters hypothesis -\n GHS3DPRL Parameters hypothesis works only with Tetrahedron (Tepal with TetMesh-GHS3D) algorithm. -\n -\n This algorithm is a commercial software, its use requires a licence (http://www.distene.com/fr/build/offer.html). - -\n Tepal gives the possibility to generate a partitioned +\n GHS3DPRL Parameters hypothesis works only with Tetrahedron (Tepal with TetMesh-GHS3D) algorithm. +This algorithm is a commercial software, its use requires a licence (http://www.distene.com/fr/build/offer.html). +\n Tepal_V1.4 gives the possibility to generate a partitioned mesh with 200 million tetrahedrons on a computer with average memory size -(2Go RAM) in about 50 hours on one CPU (Xeon, 2008). -This is a serious alternative to GHS3D, which requires a much less common +(2Go RAM) in about 50 hours on one CPU (Xeon, 2008). +\n New Tepal_V2.0 gives the possibility to generate a partitioned mesh with (for the moment) no more than 100 million +tetrahedrons on computers using MPI, (Total 16 Go RAM) +in about 900 seconds (!yes! : !seconds!) on 2 octo processors (Xeon, 2009). +The launch of this beta-version is described below. +\n This is a serious alternative to GHS3D, which requires a much less common configuration with 64Go RAM to only try to make a partition of a mesh with 200 million tetrahedrons, no result guaranteed. \n \note The Plugin doesn't load in the Memory the supposedly large resulting meshes. The meshes are saved in MED files and can be imported in the user-defined location via menu File-Import-MED Files. -\n Pay attention, that Salome GUI needs 2Go RAM. to load a MED +\n Pay attention, that Salome GUI needs 2Go RAM to load a MED file with 5 million tetrahedrons. \image html ghs3dprl_parameters_basic.png @@ -89,11 +91,10 @@ example: --verbose=0 --test=yes --menu=no --launchtepal=no \endverbatim - +\n
  • -

    - Advanced tepal Parameters

    +Advanced Tepal_V1.4 Parameters

    \verbatim @@ -142,11 +143,10 @@ With options : Arguments to pass to Tetmesh during cutting process \endverbatim - +\n

  • -

    -Advanced ghs3d Parameters (through tepal's --tetmesh_args) - type "ghs3d -h" in a Terminal.

    +Advanced ghs3d Parameters (through Tepal_V1.4's --tetmesh_args) - type "ghs3d -h" in a Terminal.

    \verbatim myname@myhost > ghs3d -h @@ -231,14 +231,16 @@ DESCRIPTION EMail: support@distene.com ) \endverbatim - +\n

  • Saving user's preferred GHS3DPRL Advanced Parameters


    GHS3DPRL Plugin launches standalone binary executable tepal2med.
    -You may rename tepal2med as tepal2med.exe for example, and replace -tepal2med by a shell script at your convenience to overriding parameters.
    ... or else $PATH modification... .
    Idem for tepal.

    +You may rename file tepal2med as tepal2med.exe for example, and replace +tepal2med by a shell script at your convenience to overriding parameters. +
    ... or else $PATH modification... .
    Idem for file tepal.

  • Advanced tepal2med Parameters - overriding parameter deletegroups

    +You may rename tepal2med as tepal2med.exe for example. \code #!/bin/bash @@ -250,11 +252,11 @@ tepal2med by a shell script at your convenience to overriding parameters.
    ... tepal2med.exe $* --deletegroups="(\bAll_Nodes|\bAll_Faces)" \endcode - +\n

  • -

    -Advanced tepal Parameters - overriding parameter component of ghs3d (to mesh holes).

    +Advanced Tepal_V1.4 Parameters - overriding parameter component of ghs3d (to mesh holes).

    +You may rename tepal as tepal.exe for example. \code #!/bin/bash @@ -269,11 +271,11 @@ SIMULOGD_LICENSE_FILE=29029@is142356 tepal.exe $* --tetmesh_args "-c 0" \endcode - +\n

  • -

    Advanced tepal Parameters - overriding launching tepal on other host.

    +You may rename tepal as tepal.exe for example. \code #!/bin/bash @@ -293,13 +295,107 @@ ssh otherhost "tepal.exe $* > /home/myname/tmp/tepal.log" #ssh otherhost "tepal.exe $* --tetmesh_args \"-c 0\"" > /home/myname/tmp/tepal.log \endcode +\n +

  • + +

    Tepal_V2.0 and MPI use.


    +This all new beta-version needs MPI, (openmpi-1.3.1 was used). To use it you have to proceed +as done in "overriding parameter component of ghs3d". +Advanced ghs3d Parameters (through Tepal_V1.4's --tetmesh_args) are not assumed yet. +It meshes holes. +\n You may rename tepal as tepal64_v2.exe for example, and replace tepal by a shell script like below. + +
  • +example tepal_v2_mpirun.

    + +\code +#!/bin/bash +#script tepal overriding launching Tepal_V2.0 with MPI (tepal run 64 bits only). +#we have renamed binary executable tepal as tepal64_v2.exe. +#typical command to launch tepal v1 : +#tepal -f /tmp/myname/GHS3DPRL -n 16 > /tmp/myname/tepal.log +#this file is an exemple to transform this call for tepal v2.0, +# (beta version using .mesh input file) +#you have to adapt for your convenience. + +#first problem is convert v1 input files GHS3DPRL.faces and GHS3DPRL.points +# to v2 input file GHS3DPRL.mesh. +#second problem is to launch on heterogeneous system linux cluster of +# 2 hosts (64 bits) of 8 nodes (by example) +# with different 2 executables codes linked on 2 different +# openmpi shared library codes. +#third problem is convert tepal v2 output files GHS3DPRL*.mesh +# to v1 input files GHS3DPRL*.faces an GHS3DPRL*.points. + +#you have to work on the same physical disk and same path input and ouput files : $SAME_DIR +#you have to work on different physical disk but same path and name for executable files +# (and shared libraries) : $DIFF_DIR + +echo "parameter 0="$0 +echo "parameter 1="$1 +echo "parameter 2="$2 +echo "parameter 3="$3 +echo "parameter 4="$4 + +export SAME_DIR=/same_physical_disk_and_same path/tmp +export DIFF_DIR=/different_physical_disk_but_same path/myname + +#copy input local files from local current directory (something like /tmp/myname) +#in this case we need /tmp/myname and $SAME_DIR different +cd $SAME_DIR +rm * +cp $2* . + +export IN_FILES=`basename $2` +export IN_DIR=`dirname $2` +#created .mesh from .faces et .points +/through_salome_path/facespoints2mesh.py $IN_FILES + +#there are 2 executable openmpi and library through 2 physical DIFF_DIR +export PATH=$DIFF_DIR/openmpi-1.3.1_install/bin:${PATH} +export LD_LIBRARY_PATH=$DIFF_DIR/openmpi-1.3.1_install/lib:${LD_LIBRARY_PATH} + +#there are 2 executables tepal_v2 through 2 physical DIFF_DIR +export LD_LIBRARY_PATH=$DIFF_DIR/tepal-2.0.0/bin/Linux_64:${LD_LIBRARY_PATH} +export PATH=$DIFF_DIR/tepal-2.0.0/bin/Linux_64:$PATH + +#small test betweeen friends +#rm hostnames.log +#mpirun -n $4 hostname >> hostnames.log + +#there necessary set env licence file for tepal v2 +export DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR" +export DLIM8VAR="dlim8 1:1:29030@is142356/0016175ef08c::a1ba...9e19" +export SIMULOGD_LICENSE_FILE=29029@is142356 +export LICENSE_FILE=/product/distene/dlim8.var.sh + +#mpirun with necessary set envenvironment +export TMP_ENV="-x PATH -x LD_LIBRARY_PATH -x DISTENE_LICENSE_FILE -x DLIM8VAR \ + -x SIMULOGD_LICENSE_FILE -x LICENSE_FILE" +#mpirun $TMPENV -n $4 which tepal64_v2.exe >> hostnames.log + +#real mpirun uncomment after verify small test +mpirun $TMPENV -n $4 tepal64_v2.exe --in $IN_FILES.mesh --out $IN_FILES.mesh --verbose 100 + +#convert output files tepalv1 format +/through_salome_path/mesh2facespoints.py $IN_FILES + +#copy ouputs files from $SAME_DIR to local current directory (something like /tmp/myname) +cp -f hostnames.log $IN_DIR +cp -f $IN_FILES* $IN_DIR + +#ls -al $SAME_DIR +#cat $SAME_DIR/hostnames.log +#cat /tmp/myname/tepal.log + +\endcode +\n

  • TUI use.


  • -

    example ex30_tepal.py.

    \code @@ -367,7 +463,7 @@ if os.access(results+".xml", os.F_OK): else: print "KO: tepal" \endcode - +\n

  • diff --git a/doc/salome/gui/SMESH/input/hexotic_hypo.doc b/doc/salome/gui/SMESH/input/hexotic_hypo.doc new file mode 100644 index 000000000..902b93ac5 --- /dev/null +++ b/doc/salome/gui/SMESH/input/hexotic_hypo.doc @@ -0,0 +1,30 @@ +/*! + +\page hexotic_hypo_page Hexotic Parameters hypothesis + +\n Hexotic Parameters hypothesis works only with Hexotic +algorithm. This algorithm is a commercial software. + +\image html hexotic_parameters.png + + + +*/ diff --git a/doc/salome/gui/SMESH/input/merging_elements.doc b/doc/salome/gui/SMESH/input/merging_elements.doc index 821f6f9f2..d677e179e 100644 --- a/doc/salome/gui/SMESH/input/merging_elements.doc +++ b/doc/salome/gui/SMESH/input/merging_elements.doc @@ -5,42 +5,59 @@ \n This functionality allows to merge coincident elements of a mesh selectable in the dialog box. - \image html mergeelems_ico.png "Merge elements button" +
      +
    1. From the \b Modification choose \b Transformation and from its +sub-menu select the Merge elements item. The following dialog box +shall appear:
    2. -\image html mergeelems.png +\image html mergeelems_auto.png +
      + + +
    3. Automatic mode: +
        +
      • In \b Automatic Mode the elements that were created on the same nodes will be merged.
      • +
      +
    4. + +
    5. If the \b Manual Mode is selected there are additional controls to +manage the elements to be merged in more detail: +\image html mergeelems.png +
      +
        +
      • \b Detect button generates the list of coincident elements for the given \b Tolerance.
      • +
      • Coincident elements is a list of groupes of elements for +merging. All elements of each group will form one after the operation.
          -
        • \b Name is the name of the mesh whose elements will be merged.
        • -
        • \b Tolerance is a maximum distance between elements sufficient for merging. -
            -
          • \b Detect button generates the list of coincident elements for the given \b Tolerance.
          • -
        • -
        • Coincident elements is a list of groupes of elements for - merging. All elements of each group will form one after the operation. -
            -
          • \b Remove button deletes the selected group from the list.
          • -
          • \b Add button adds to the list a group of elements selected in the - viewer with pressed "Shift" key.
          • -
          • Select all checkbox selects all groups.
          • -
        • -
        • Edit selected group list allows editing the selected group: -

          - \image html add.png -
          adds to the group the element selected in the viewer.
          -
          - \image html remove.png -
          removes from the group the selected element.
          -
          - \image html sort.png -
          moves the selected element to the first position in the - group. This means that all other elements will be merged into this - one.
          -
          -
        • -
        • To confirm your choice click \b Apply or Apply and Close button.
        • +
        • \b Remove button deletes the selected group from the list.
        • +
        • \b Add button adds to the list a group of elements selected in the +viewer with pressed "Shift" key.
        • +
        • Select all checkbox selects all groups.
        • +
      • +
      • Edit selected group list allows editing the selected group: +

        +\image html add.png +
        adds to the group the element selected in the viewer.
        +
        +\image html remove.png +
        removes from the group the selected element.
        +
        +\image html sort.png +
        moves the selected element to the first position in the +group. This means that all other elements will be merged into this +one.
        +
        +
      • +
      • To confirm your choice click \b Apply or Apply and Close button.
      +
    In this picture you see a triangle which coincides with one of the elements of the mesh. After we apply Merge Elements functionality, the diff --git a/doc/salome/gui/SMESH/input/merging_nodes.doc b/doc/salome/gui/SMESH/input/merging_nodes.doc index fb88fb89e..d94d6f49d 100644 --- a/doc/salome/gui/SMESH/input/merging_nodes.doc +++ b/doc/salome/gui/SMESH/input/merging_nodes.doc @@ -11,19 +11,30 @@ with desirable tolerance, edit these groups and merge.
    1. From the \b Modification choose \b Transformation and from its sub-menu select the Merge nodes item. The following dialog box -shall appear: - -\image html mergenodes.png +shall appear:
    2. +\image html mergenodes_auto.png +
      + +
    3. Automatic mode: +
      +
        +
      • In \b Automatic Mode to merge the Nodes, just input the tolerance +value and confirm by \b Apply button.
      • +
      +

    4. +
    5. If the \b Manual Mode is selected there are additional controls to +manage the nodes to be merged in more detail:
      • \b Detect button generates the list of coincident nodes for the given \b Tolerance.
      • -
      -
    6. Coincident nodes is a list of groupes of nodes for merging. All nodes of each group will form one after the operation. @@ -33,6 +44,9 @@ operation. viewer with pressed "Shift" key.
    7. Select all checkbox selects all groups.
    8. + +\image html mergenodes.png +
    9. Edit selected group list allows editing the selected group: @@ -60,4 +74,4 @@ one.

      See Also a sample TUI Script of a \ref tui_merging_nodes "Merge Nodes" operation. -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/SMESH/input/modifying_meshes.doc b/doc/salome/gui/SMESH/input/modifying_meshes.doc index cf63ff5f4..afa553f1b 100644 --- a/doc/salome/gui/SMESH/input/modifying_meshes.doc +++ b/doc/salome/gui/SMESH/input/modifying_meshes.doc @@ -18,6 +18,7 @@ elements of the mesh.
    10. its elements.
    11. \subpage rotation_page "Rotate" by the indicated axis and angle the mesh or some of its elements.
    12. +
    13. \subpage scale_page "Scale Transform" the mesh or some of its elements.
    14. Create a \subpage symmetry_page "symmetrical copy" of the mesh through a point or a vector of symmetry.
    15. Unite meshes by \subpage sewing_meshes_page "sewing" free borders, @@ -36,6 +37,7 @@ or created anew.
    16. \subpage changing_orientation_of_elements_page "Change orientation" of the selected elements.
    17. \subpage cutting_quadrangles_page "Cut a quadrangle" into two triangles.
    18. +
    19. \subpage split_to_tetra_page "Split" volumic elements into tetrahedra.
    20. \subpage smoothing_page "Smooth" elements, reducung distortions in them by adjusting the locations of element corners.
    21. Create an \subpage extrusion_page "extrusion" along a vector.
    22. diff --git a/doc/salome/gui/SMESH/input/pattern_mapping.doc b/doc/salome/gui/SMESH/input/pattern_mapping.doc index cf556d51b..db4be4144 100644 --- a/doc/salome/gui/SMESH/input/pattern_mapping.doc +++ b/doc/salome/gui/SMESH/input/pattern_mapping.doc @@ -71,7 +71,7 @@ having a mesh built on it. Mesh nodes lying on face vertices become key-points. Additionally, you may choose the way of getting nodes coordinates by projecting nodes on the face instead of using "positions on face" generated by mesher (if there is any). Faces -having a seam edge can?t be used for automatic pattern creation. +having a seam edge can't be used for automatic pattern creation. When creating a pattern from an existing mesh, there are two possible cases: @@ -132,4 +132,4 @@ isolines.
      See Also a sample TUI Script of a \ref tui_pattern_mapping "Pattern Mapping" operation. -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/SMESH/input/point_marker.doc b/doc/salome/gui/SMESH/input/point_marker.doc new file mode 100644 index 000000000..c298893ef --- /dev/null +++ b/doc/salome/gui/SMESH/input/point_marker.doc @@ -0,0 +1,53 @@ +/*! + +\page point_marker_page Point Marker + +\n You can change the representation of points in +the 3D viewer either by selecting one of the predefined +shapes or by loading a custom texture from an external file. + +- Standard point markers + +The Mesh module provides a set of predefined point marker shapes +which can be used to display points in 3D viewer. +Each standard point marker has two attributes: type (defines shape +form) and scale factor (defines shape size). + +\image html point_marker_widget1.png + +
      + +\image html std_point_marker.png "Mesh presentation with standard point markers" + +- Custom point markers + +It is also possible to load a point marker shape from an external file. +This file should provide a description of the point texture as a set +of lines; each line is represented as sequence of "0" and "1" symbols, +where "1" symbol means an opaque pixel and "0" symbol means a +transparent pixel. The width of the texture correspond to the length +of the longest line in the file, expanded to the nearest byte-aligned +value. The height of the texture is equal to the number of non-empty +lines in the file. Note that missing symbols are replaced by "0". + +Here is a texture file sample: + +
      +00111100
      +00111100
      +11111111
      +11111111
      +11111111
      +11111111
      +00111100
      +00111100
      +
      + +\image html point_marker_widget2.png + +
      + +\image html custom_point_marker.png "Mesh presentation with custom point markers" + +*/ + diff --git a/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc b/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc index 9f54f3eef..0854941ea 100644 --- a/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc +++ b/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc @@ -8,9 +8,16 @@ following conditions: the face must be a full circle or a part of circle The resulting mesh consists of triangles (near the center point) and quadrangles. -This algorithm requires the hypothesis indicating the number +This algorithm is optionally parametrized by the hypothesis indicating the number of mesh layers along the radius. The distribution of layers can be set with any 1D Hypothesis. +If no own hypothesis of the algorithm is assigned, any local or global hypothesis is used +by the algorithm to discretize edges. Note that if the geometrical face has two radial edges, +they must be meshed with equal number of segments. + +If no 1D hypothesis is assigned to an edge, "Default Number of Segments" preferences parameter +is used to discretize the edge. + \image html hypo_radquad_dlg.png \image html mesh_radquad_01.png "Radial Quadrangle 2D mesh on the top and the bottom faces of a cylinder" diff --git a/doc/salome/gui/SMESH/input/rotation.doc b/doc/salome/gui/SMESH/input/rotation.doc index 79d27d7c1..d93473eda 100644 --- a/doc/salome/gui/SMESH/input/rotation.doc +++ b/doc/salome/gui/SMESH/input/rotation.doc @@ -63,7 +63,7 @@ name in the adjacent box);
    23. Click \b Apply or Apply and Close button to confirm the operation.
    24. - +
    diff --git a/doc/salome/gui/SMESH/input/scale.doc b/doc/salome/gui/SMESH/input/scale.doc new file mode 100644 index 000000000..5b10fb5a5 --- /dev/null +++ b/doc/salome/gui/SMESH/input/scale.doc @@ -0,0 +1,134 @@ +/*! + +\page scale_page Scale + +\n This geometrical operation allows to scale in space your mesh +or some of its elements. + +To scale a mesh: + +
      +
    1. From the \b Modification menu choose \b Transformation -> \b Scale +\b Transform item. + +One of the following dialogs will appear: + +With one scale factor: +\image html scale01.png + +Or with different scale factors for axes: +\image html scale02.png + +
    2. + +
    3. +In the dialog: +
        +
      • specify the IDs of the translated elements: + +
          +
        • Select the whole mesh, submesh or group activating this +checkbox; or
        • +
        • choose mesh elements with the mouse in the 3D Viewer. It is +possible to select a whole area with a mouse frame; or
        • +
        • input the element IDs directly in ID Elements field. The selected elements will be highlighted in the +viewer; or
        • +
        • apply Filters. Set filter button allows to apply a filter to the selection of elements. See more +about filters in the \ref selection_filter_library_page "Selection filter library" page.
        • +
        +
      • + +
      • specify the base point for scale
      • + +
      • specify the scale factor
      • + +
      • specify the conditions of scale: +
          +
        • activate Move elements radio button to create the source +mesh (or elements) at the new location and erase it from the previous location;
        • +
        • activate Copy elements radio button to create the source +mesh (or elements) at the new location, but leave it at the previous +location, the source mesh will be considered one and single mesh with +the result of the scale operation;
        • +
        • activate Create as new mesh radio button to leave the +source mesh (or elements) at its previous location and create a new +mesh at the new location, the new mesh appears in the Object Browser +with the default name MeshName_scaled (it is possible to change this +name in the adjacent box);
        • +
        • activate Copy groups checkbox to copy the groups of elements of the source mesh to the newly created mesh.
        • +
        +
      • + + + +
      • Click \b Apply or Apply and Close button to confirm the operation.
      • +
      +
    + + + +Example of using: + +1. Create quandrangle mesh 3x3 on simple planar face (200x200) + +\image html scaleinit01.png + +and union 3 face (along axis Z) to group "gr_faces" + +\image html scaleinit02.png + + + +2. Perform scale operation for whole mesh with creation of new mesh: + +\image html scale03.png + +result after operation: + +\image html scaleres03.png + + + +3. Perform scale operation for whole mesh with copy of elements: + +\image html scale04.png + +result after operation: + +\image html scaleres04.png + + + +4. Perform scale operation for group of faces with copy of elements: + +\image html scale06.png + +result after operation: + +\image html scaleres06.png + + + +5. Perform scale operation for two edges with moving of elements: + +\image html scale07.png + +result after operation: + +\image html scaleres07.png + + + +6. Perform scale operation for one face with moving of elements: + +\image html scale09.png + +result after operation: + +\image html scaleres09.png + + +
    See Also a sample TUI Script of a \ref tui_scale "Scale" operation. + + +*/ diff --git a/doc/salome/gui/SMESH/input/split_to_tetra.doc b/doc/salome/gui/SMESH/input/split_to_tetra.doc new file mode 100644 index 000000000..57efb37eb --- /dev/null +++ b/doc/salome/gui/SMESH/input/split_to_tetra.doc @@ -0,0 +1,55 @@ +/*! + +\page split_to_tetra_page Splitting volumes into tetrahedra + +\n This operation allows to split volumic elements into tetrahedra. +2D mesh is modified accordingly. + +To split volumes: +
      +
    1. Display a mesh or a submesh in the 3D viewer.
    2. +
    3. In the \b Modification menu select the Split into Tetrahedra item or +click "Split into Tetrahedra" button in the toolbar. + +\image html split_into_tetra_icon.png +
      "Split into Tetrahedra" button
      + +The following dialog box will appear: + +\image html split_into_tetra.png + +\par +
        +
      • The main list contains the list of volumes. You can click on +a volume in the 3D viewer and it will be highlighted (lock Shift +keyboard button to select several volumes). Click \b Add button and +the ID of this volume will be added to the list. To remove a +selected element or elements from the list click \b Remove button. Sort +list button allows to sort the list of IDs. \b Filter button allows to +apply a definite filter to the selection of volumes. +
        Note: If you split not all adjacent non-tetrahedral volumes, your mesh becomes +non-conform.
      • +
      • Apply to all radio button allows to split all +volumes of the currently displayed mesh or submesh.
      • +
      + +
        +
      • \b Split hexahedron + +
          +
        • Into 5 tetrahedra and Into 6 tetrahedra allows to +specify the number of tetrahedra a hexahedron will be split into. If the specified method does +not allow to get a conform mesh, a generic solution is applied: an additional node +is created at gravity center of a hexahedron, serving an apex of tetrahedra, all quadrangle sides of the hexahedron are split into two triangles each serving a base of a new tetrahedron.
        • +
        + +
      • + +
      • Select from set of fields allows to choose a submesh or an +existing group whose elements will be automatically added to the +list.
      • +
      + +
    4. Click the \b Apply or Apply and Close button to confirm the operation.
    5. +
    +*/ diff --git a/doc/salome/gui/SMESH/input/symmetry.doc b/doc/salome/gui/SMESH/input/symmetry.doc index 967fff2c1..9daebe39e 100644 --- a/doc/salome/gui/SMESH/input/symmetry.doc +++ b/doc/salome/gui/SMESH/input/symmetry.doc @@ -5,7 +5,7 @@ \n This geometrical operation allows to perform a symmetrical copy of your mesh or some of its elements. -To create a symmtrical copy of the mesh: +To create a symmetrical copy of the mesh:
    1. From the \b Modification menu choose \b Transformation -> \b Symmetry item or click @@ -76,6 +76,7 @@ name in the adjacent box);
    2. Click \b Apply or Apply and Close button to confirm the operation.
    3. +
    diff --git a/doc/salome/gui/SMESH/input/translation.doc b/doc/salome/gui/SMESH/input/translation.doc index 2f0f0743e..b5e338094 100644 --- a/doc/salome/gui/SMESH/input/translation.doc +++ b/doc/salome/gui/SMESH/input/translation.doc @@ -65,6 +65,7 @@ name in the adjacent box);
  • Click \b Apply or Apply and Close button to confirm the operation.
  • +
    See Also a sample TUI Script of a \ref tui_translation "Translation" operation. diff --git a/doc/salome/gui/SMESH/input/tui_creating_meshes.doc b/doc/salome/gui/SMESH/input/tui_creating_meshes.doc index 87f740e98..359ffd7d5 100644 --- a/doc/salome/gui/SMESH/input/tui_creating_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_creating_meshes.doc @@ -82,6 +82,67 @@ quadra.Compute() \endcode +
    +

    Change priority of submeshes in Mesh

    + +\code +import salome +import geompy +import smesh +import SMESH + +Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) +[Face_1,Face_2,Face_3,Face_4,Face_5,Face_6] = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["FACE"]) + +# create Mesh object on Box shape +Mesh_1 = smesh.Mesh(Box_1) + +# assign mesh algorithms +Regular_1D = Mesh_1.Segment() +Nb_Segments_1 = Regular_1D.NumberOfSegments(20) +Nb_Segments_1.SetDistrType( 0 ) +MEFISTO_2D = Mesh_1.Triangle() +Max_Element_Area_1 = MEFISTO_2D.MaxElementArea(1200) +Tetrahedron_Netgen = Mesh_1.Tetrahedron(algo=smesh.NETGEN) +Max_Element_Volume_1 = Tetrahedron_Netgen.MaxElementVolume(40000) + +# create submesh and assign algorithms on Face_1 +Netgen_1D_2D = Mesh_1.Triangle(algo=smesh.NETGEN,geom=Face_1) +SubMesh_1 = Netgen_1D_2D.GetSubMesh() +NETGEN_2D_Simple_Parameters_1 = Netgen_1D_2D.Parameters(which=smesh.SIMPLE) +NETGEN_2D_Simple_Parameters_1.SetNumberOfSegments( 4 ) +NETGEN_2D_Simple_Parameters_1.LengthFromEdges() + +# create submesh and assign algorithms on Face_2 +Netgen_1D_2D_1 = Mesh_1.Triangle(algo=smesh.NETGEN,geom=Face_2) +SubMesh_2 = Netgen_1D_2D_1.GetSubMesh() +NETGEN_2D_Simple_Parameters_2 = Netgen_1D_2D_1.Parameters(which=smesh.SIMPLE) +NETGEN_2D_Simple_Parameters_2.SetNumberOfSegments( 8 ) +NETGEN_2D_Simple_Parameters_2.LengthFromEdges() +smeshObj_1 = smesh.CreateHypothesis('NETGEN_SimpleParameters_2D', +'NETGENEngine') + +# create submesh and assign algorithms on Face_3 +Netgen_1D_2D_2 = Mesh_1.Triangle(algo=smesh.NETGEN,geom=Face_3) +SubMesh_3 = Netgen_1D_2D_2.GetSubMesh() +NETGEN_2D_Simple_Parameters_3 = Netgen_1D_2D_2.Parameters(which=smesh.SIMPLE) +NETGEN_2D_Simple_Parameters_3.SetNumberOfSegments( 12 ) +NETGEN_2D_Simple_Parameters_3.LengthFromEdges() + +# check exisiting submesh priority order +[ [ SubMesh_1, SubMesh_3, SubMesh_2 ] ] = Mesh_1.GetMeshOrder() +# set new submesh order +isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_1, SubMesh_2, SubMesh_3 ] ]) +# compute mesh +isDone = Mesh_1.Compute() + +# clear mesh result and compute with other submesh order +Mesh_1.Clear() +isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_2, SubMesh_1, SubMesh_3 ] ]) +isDone = Mesh_1.Compute() + +\endcode +
    \anchor tui_editing_mesh

    Editing of a mesh

    diff --git a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc index 04725fdc6..80944666e 100644 --- a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc +++ b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc @@ -514,32 +514,69 @@ Mesh_1.Compute() \anchor tui_radial_quadrangle

    Radial Quadrangle 1D2D example

    \code -import salome -import geompy -import smesh -import StdMeshers +from smesh import * + +SetCurrentStudy(salome.myStudy) # Create face from the wire and add to study -WirePath = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WW", [0, 0, 0, 1, 0, 0, 0, 0, 1]) -Face = geompy.MakeFace(WirePath,1) +Face = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WF", [0, 0, 0, 1, 0, 0, 0, 0, 1]) geompy.addToStudy(Face,"Face") +edges = geompy.SubShapeAllSorted(Face, geompy.ShapeType["EDGE"]) +circle, radius1, radius2 = edges +geompy.addToStudyInFather(Face, radius1,"radius1") +geompy.addToStudyInFather(Face, radius2,"radius2") +geompy.addToStudyInFather(Face, circle,"circle") -# Define geometry for mesh, and 1D parameters + +# Define geometry for mesh, and Radial Quadrange algorithm mesh = smesh.Mesh(Face) -Wire_discretisation = mesh.Segment() -Nb_Segments = Wire_discretisation.NumberOfSegments(5) -Nb_Segments.SetDistrType( 0 ) +radial_Quad_algo = mesh.Quadrangle(algo=RADIAL_QUAD) -# Define 2D parameters and Radial Quadrange hypothesis -Number_of_Layers = smesh.CreateHypothesis('NumberOfLayers2D') -Number_of_Layers.SetNumberOfLayers( 4 ) -mesh.AddHypothesis(Number_of_Layers) -RadialQuadrangle_1D2D = smesh.CreateHypothesis('RadialQuadrangle_1D2D') -mesh.AddHypothesis(RadialQuadrangle_1D2D) +# The Radial Quadrange algorithm can work without any hypothesis +# In this case it uses "Default Nb of Segments" preferences parameter to discretize edges +mesh.Compute() +# The Radial Quadrange uses global or local 1d hypotheses if no its own hypotheses assigned. +# Define global hypotheses to discretize radial edges and a local one for circular edge +global_Nb_Segments = mesh.Segment().NumberOfSegments(5) +local_Nb_Segments = mesh.Segment(circle).NumberOfSegments(10) +mesh.Compute() + +# Define own parameters of Radial Quadrange algorithm +radial_Quad_algo.NumberOfLayers( 4 ) mesh.Compute() \endcode +\anchor tui_quadrangle_parameters +

    Quadrangle Parameters example

    +\code +import geompy +import smesh +import StdMeshers + +# Get 1/4 part from the disk face. +Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100) +Disk_1 = geompy.MakeDiskR(100, 1) +Common_1 = geompy.MakeCommon(Disk_1, Box_1) +geompy.addToStudy( Disk_1, "Disk_1" ) +geompy.addToStudy( Box_1, "Box_1" ) +geompy.addToStudy( Common_1, "Common_1" ) + +# Set the Geometry for meshing +Mesh_1 = smesh.Mesh(Common_1) + +# Create Quadrangle parameters and define the Base Vertex. +Quadrangle_Parameters_1 = smesh.CreateHypothesis('QuadrangleParams') +Quadrangle_Parameters_1.SetTriaVertex( 8 ) + +# Define 1D hypothesis and cmpute the mesh +Regular_1D = Mesh_1.Segment() +Nb_Segments_1 = Regular_1D.NumberOfSegments(10) +Nb_Segments_1.SetDistrType( 0 ) +status = Mesh_1.AddHypothesis(Quadrangle_Parameters_1) +Quadrangle_2D = Mesh_1.Quadrangle() +Mesh_1.Compute() +\endcode \n Other meshing algorithms: diff --git a/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc b/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc index 163afe0e4..1658e58c5 100644 --- a/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc @@ -44,6 +44,37 @@ angle270 = 1.5 * math.pi mesh.Rotate([], axisXYZ, angle270, 1) \endcode +
    +\anchor tui_scale +

    Scale

    + +\code +import geompy +Box = geompy.MakeBoxDXDYDZ(200, 200, 200) +f = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) + +import smesh,SMESH +import StdMeshers +Mesh1 = smesh.Mesh(f[0]) +Regular_1D = Mesh1.Segment() +Nb_Segments_1 = Regular_1D.NumberOfSegments(3) +Nb_Segments_1.SetDistrType( 0 ) +Quadrangle_2D = Mesh1.Quadrangle() +isDone = Mesh1.Compute() + +#Perform scale opration for whole mesh with creation of new mesh +newMesh = Mesh1.ScaleMakeMesh(Mesh1,SMESH.PointStruct(100,100,200),[0.5,0.3,0.7],True,"ScaledMesh") + +#Perform scale operation for whole mesh with copy of elements +Mesh1.Scale(Mesh1,SMESH.PointStruct(200,100,100),[0.5,0.5,0.5],True,True) + +#Perform scale opration for two edges with moving of elements +Mesh1.Scale([1,2],SMESH.PointStruct(-100,100,100),[0.8,1.0,0.7],False) + +#Perform scale opration for one face with moving of elements +Mesh1.Scale([21],SMESH.PointStruct(0,200,200),[0.7,0.7,0.7],False) +\endcode +
    \anchor tui_symmetry

    Symmetry

    @@ -319,4 +350,4 @@ mesh.Compute() mesh.SewSideElements([69, 70, 71, 72], [91, 92, 89, 90], 8, 38, 23, 58) \endcode -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/SMESH/input/tui_viewing_meshes.doc b/doc/salome/gui/SMESH/input/tui_viewing_meshes.doc index 862cb302e..7b2af8cb9 100644 --- a/doc/salome/gui/SMESH/input/tui_viewing_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_viewing_meshes.doc @@ -83,4 +83,53 @@ for i in keys: pass \endcode + + +
    +\anchor tui_find_element_by_point +

    Find Element by Point

    + +\code +import geompy +import smesh +import SMESH + +# Create a geometry to mesh +box = geompy.MakeBoxDXDYDZ(100,100,100) + +# Create a mesh +mesh = Mesh(box,"Mesh") +mesh.AutomaticHexahedralization() +mesh.Compute() + +# Create a point +x,y,z = 0, 0, 1 + +# Find all elements (except 0D ones) located at the point +all_elems_except_0D = mesh.FindElementsByPoint(x,y,z) +assert( len(all_elems_except_0D) == 4) + +# Find nodes at the point +nodes = mesh.FindElementsByPoint(x,y,z, SMESH.NODE ) +assert( len(nodes) == 0) +assert( len( mesh.FindElementsByPoint(x,y,0, SMESH.NODE)) == 1) + +# Find an edge at the point +edges = mesh.FindElementsByPoint(x,y,z, SMESH.EDGE ) +assert( len(edges) == 1) + +# Find faces at the point +edges = mesh.FindElementsByPoint(x,y,z, SMESH.FACE ) +assert( len(edges) == 2) + +# Find a volume at the point +vols = mesh.FindElementsByPoint(x,y,z, SMESH.VOLUME ) +assert( len(vols) == 1) + +# Find 0D elements at the point +edges = mesh.FindElementsByPoint(x,y,z, SMESH.ELEM0D ) +assert( len(edges) == 0) + +\endcode + */ diff --git a/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc b/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc index ee4c6dd4a..207c4dda5 100644 --- a/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc +++ b/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc @@ -24,6 +24,9 @@ Object Browser, applying all recent changes. information about the mesh.
  • \ref mesh_element_info_anchor "Mesh Element Info" - provides basic information about the selected element of the mesh.
  • +
  • \subpage find_element_by_point_page "Find Element by Point" - +allows to find all mesh elements, to which belongs a point with the +given coordinates.
  • \subpage numbering_page "Numbering" - allows to display the ID numbers of all meshing elements or nodes composing your mesh in the viewer.
  • @@ -31,9 +34,13 @@ viewer. Wireframe, Shading and Nodes presentation.
  • \subpage display_entity_page "Display Entity" - allows to display Faces, Edges or both.
  • +
  • 2D Quadratic - allows to select between the representation +of quadratic edges as broken lines or as arcs
  • Orientation of faces - shows vectors of orientation of -faces of the selected mesh
  • -
  • Colors / Size - allows to select color and size of +faces of the selected mesh. Vector is shown for each 2D mesh element +and for each free face of 3D mesh element. Vector direction is calculated by +the first three nodes of face as a cross product of vectors n1-n2 and n1-n3.
  • +
  • \subpage colors_size_page "Colors / Size" - allows to select color and size of meshes.
  • \subpage transparency_page "Transparency" - allows to change the transparency of mesh elements.
  • @@ -43,7 +50,12 @@ presents various information about meshes.
  • Hide - allows to hide the selected mesh from the viewer.
  • Show Only -allows to display only the selected mesh, hiding all other from the viewer.
  • Dump view - exports an object from the viewer in bmp, png, jpg or jpeg image format.
  • -
  • Change background - allows to redefine the background color. By default it is black.
  • +
  • Change background - allows to redefine the background +color. By default it is black.
  • +
  • View Operations checkbox - allows to show/hide the +visualization toolbar in the viewer window.
  • +
  • Recording Operations - allows to show/hide the recording +toolbar in the viewer window.
  • */ diff --git a/doc/salome/gui/SMESH/static/doxygen.css b/doc/salome/gui/SMESH/static/doxygen.css index 88e613d23..eb9f3c6a2 100755 --- a/doc/salome/gui/SMESH/static/doxygen.css +++ b/doc/salome/gui/SMESH/static/doxygen.css @@ -1,5 +1,35 @@ -H1 { +body { + font-family: Arial, Helvetica, sans-serif; + background-color: #ffffff; +} + +h1 { text-align: center; + text-decoration: none; + border: none; + line-height: 25px; + text-align: center; +// text-transform:uppercase; + background: #D9f4fd; + font-size: 12pt; + font-weight: bold; + border: 1px solid #CCCCCC; + -moz-border-radius: 8px; + -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); +/* background-color: rgb(75, 140, 185); + color: #ffffff; + text-align: center; + height: 25px;*/ + +} + +h2 { + font-size: 12pt; + font-weight: bold; +} + +table { + font-size: 10pt; } CAPTION { @@ -11,16 +41,6 @@ A.qindex {} A.qindexRef {} -/* Link to any cross-referenced Doxygen element */ -A.el { - text-decoration: none; - font-weight: bold -} - -A.elRef { - font-weight: bold -} - /* Link to any cross-referenced Doxygen element inside a code section (ex: header) */ @@ -37,7 +57,49 @@ A.codeRef { A:hover { text-decoration: none; - background-color: lightblue + background-color: lightblue; +} + +div.contents { + font-family: Arial, Helvetica, sans-serif; + font-size: 10pt; +} + +div.navpath { + font-size: 11pt; +} + +div.version { + background-color:#ffffde; + border:1px solid #cccccc; + font-family: Arial, Helvetica, sans-serif; + font-size: 9pt; + text-align: center; + width:100px; + -moz-border-radius: 8px; +// -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); +} + +div.header { + background: url("head.png"); + background-color: #175783; + border: 1px solid; + height: 80px; + background-repeat: no-repeat; + margin-bottom: 10px; +} + +div.tabs { + display: none; +} + +div.footer { + background-color: #D9f4fd; + border: 1px solid #AAAAAA; + font-family: Arial, Helvetica, sans-serif; + font-size: 11px; + padding: 10px; + margin-top: 15px; } DL.el { @@ -45,10 +107,8 @@ DL.el { } /* A code fragment (ex: header) */ -DIV.fragment { - width: 100%; +div.fragment { border: none; - background-color: #CCCCCC } /* In the alpha list (coumpound index), style of an alphabetical index letter */ @@ -94,10 +154,6 @@ DIV.groupText { font-size: smaller } -BODY { - background: #FFFFFF; -} - /*div.div-page { background-color: #FFFFFF; margin-left: 1em; @@ -168,3 +224,212 @@ span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } + +/* @group Code Colorization */ + +.fragment { + font-family: monospace, fixed; + font-size: 10pt; +} + +pre.fragment { + width: 95%; + border: 1px solid #CCCCCC; + -moz-border-radius: 8px; + -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); + background-color:#EEF3F5; + padding: 4px 6px; + margin: 4px 1px 4px 1px; +} + +/* Top Navigation style */ + +div.navigation { + margin-bottom:20px; +} + +/* Left navigation panel style */ + +body.ftvtree { + background-color: #D9f4fd; + margin: 10px; +} + +div.directory { + margin: 0; +} + +div.directory.p { + margin: 0; +} + +h3.swap { + font-size: 10pt; + margin-bottom: 0; +} + +/* Link to any cross-referenced Doxygen element */ +a.el { + text-decoration: none; + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; + font-size: 9pt; + color: #551a8b; +} + +a.el:hover { + background-color: transparent; +} + +a.elRef { + font-weight: normal; +} + + +#MSearchBox { + -moz-border-radius:8px 8px 8px 8px; + background-color:white; + border:1px solid #84B0C7; + margin:0; + padding:0; + white-space:nowrap; +} + +div.directory img { + vertical-align:-30%; +} + +div.directory p { + white-space:nowrap; + margin: 0; +} + +div.directory-alt div { + display: none; + margin: 0px; +} + + +div.directory div { + display: none; + margin: 0px; +} + +div.version { + background-color:#ffffde; + border:1px solid #cccccc; + font-family: Arial, Helvetica, sans-serif; + font-size: 9pt; + text-align: center; + width:100px; + -moz-border-radius: 8px; +// -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); +} + +/* @group Member Descriptions */ + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #FAFAFA; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memItemLeft, .memItemRight, .memTemplParams { + border-top: 1px solid #ccc; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memTemplParams { + color: #606060; + white-space: nowrap; +} + +/* @end */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; + margin-left: 3px; +} + +.memnav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.memitem { + padding: 0; + margin-bottom: 10px; +} + +.memname { + white-space: nowrap; + font-weight: bold; +} + +.memproto, .memdoc { + border: 1px solid #84b0c7; +} + +.memproto { + padding: 0; + background-color: #d5e1e8; + font-weight: bold; + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -moz-border-radius-topleft: 8px; + -moz-border-radius-topright: 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + +} + + + +.memdoc { + padding: 2px 5px; + background-color: #eef3f5; + border-top-width: 0; + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -moz-border-radius-bottomleft: 8px; + -moz-border-radius-bottomright: 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} + +/* @end */ diff --git a/doc/salome/gui/SMESH/static/footer.html b/doc/salome/gui/SMESH/static/footer.html index 6eab03cf2..fdfb138ca 100755 --- a/doc/salome/gui/SMESH/static/footer.html +++ b/doc/salome/gui/SMESH/static/footer.html @@ -3,10 +3,11 @@ -
    + diff --git a/doc/salome/gui/SMESH/static/header.html.in b/doc/salome/gui/SMESH/static/header.html.in new file mode 100755 index 000000000..6795e96eb --- /dev/null +++ b/doc/salome/gui/SMESH/static/header.html.in @@ -0,0 +1,10 @@ + + + + + $title + + +
    +
    Version: @VERSION@
    + diff --git a/doc/salome/tui/Makefile.am b/doc/salome/tui/Makefile.am index b8cd5eee5..7cc0f4a8f 100644 --- a/doc/salome/tui/Makefile.am +++ b/doc/salome/tui/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,13 +16,17 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.in # Author : Vasily Rusyaev (Open Cascade NN) # Module : doc # include $(top_srcdir)/adm_local/unix/make_common_starter.am -EXTRA_DIST += images static +EXTRA_DIST += images static/doxygen.css static/footer.html + +tuidocdir = $(docdir)/tui/SMESH +tuidoc_DATA = images/head.png images/smeshscreen.png dist_doc_DATA = \ extra/AddNetgenInSalome2.pdf \ diff --git a/doc/salome/tui/doxyfile.in b/doc/salome/tui/doxyfile.in index 787e16464..0eb988674 100755 --- a/doc/salome/tui/doxyfile.in +++ b/doc/salome/tui/doxyfile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -24,7 +24,7 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "Mesh Module Programming Guide v.@VERSION@" +PROJECT_NAME = "SALOME Mesh Module Developer" PROJECT_NUMBER = OUTPUT_DIRECTORY = SMESH CREATE_SUBDIRS = NO @@ -99,8 +99,9 @@ WARN_LOGFILE = log.txt INPUT = @top_srcdir@/src \ @top_srcdir@/bin \ @top_srcdir@/idl \ - @top_builddir@/bin -FILE_PATTERNS = *.idl *.hxx *.cxx *.h *.c *.hh *.cc @DOXYGEN_PYTHON_EXTENSION@ + @top_builddir@/bin \ + @srcdir@/input +FILE_PATTERNS = *.idl *.hxx *.cxx *.h *.c *.hh *.cc @DOXYGEN_PYTHON_EXTENSION@ *.doc RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO @@ -137,9 +138,9 @@ IGNORE_PREFIX = GENERATE_HTML = YES HTML_OUTPUT = . HTML_FILE_EXTENSION = .html -#HTML_HEADER = @srcdir@/static/myheader.html -#HTML_FOOTER = @srcdir@/static/footer.html -#HTML_STYLESHEET = @srcdir@/static/doxygen.css +HTML_HEADER = @builddir@/static/header.html +HTML_FOOTER = @srcdir@/static/footer.html +HTML_STYLESHEET = @srcdir@/static/doxygen.css HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = diff --git a/doc/salome/tui/images/head.png b/doc/salome/tui/images/head.png new file mode 100755 index 000000000..307d9ef9a Binary files /dev/null and b/doc/salome/tui/images/head.png differ diff --git a/doc/salome/tui/images/smeshscreen.png b/doc/salome/tui/images/smeshscreen.png new file mode 100755 index 000000000..638870e5f Binary files /dev/null and b/doc/salome/tui/images/smeshscreen.png differ diff --git a/doc/salome/tui/input/index.doc b/doc/salome/tui/input/index.doc new file mode 100644 index 000000000..d0ef8933b --- /dev/null +++ b/doc/salome/tui/input/index.doc @@ -0,0 +1,13 @@ +/*! \mainpage + +\image html smeshscreen.png + +To browse the \b SALOME Mesh module Developer Documentation, follow the links below or use navigation menu at the top of the page: + + +*/ \ No newline at end of file diff --git a/doc/salome/tui/static/doxygen.css b/doc/salome/tui/static/doxygen.css index 389449d87..ad299dd32 100755 --- a/doc/salome/tui/static/doxygen.css +++ b/doc/salome/tui/static/doxygen.css @@ -1,5 +1,32 @@ -H1 { +body { + font-family: Arial, Helvetica, sans-serif; + background-color: #ffffff; +} + +h1 { text-align: center; + text-decoration: none; + border: none; + line-height: 25px; + text-align: center; +// text-transform:uppercase; + background: #D9f4fd; + font-size: 12pt; + font-weight: bold; + border: 1px solid #CCCCCC; + margin-top: 50px; + -moz-border-radius: 8px; + -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); +} + +h2 { + font-size: 12pt; + font-weight: bold; +} + +table { + font-size: 10pt; + padding-left: 20px; } CAPTION { @@ -11,16 +38,6 @@ A.qindex {} A.qindexRef {} -/* Link to any cross-referenced Doxygen element */ -A.el { - text-decoration: none; - font-weight: bold -} - -A.elRef { - font-weight: bold -} - /* Link to any cross-referenced Doxygen element inside a code section (ex: header) */ @@ -37,7 +54,53 @@ A.codeRef { A:hover { text-decoration: none; - background-color: lightblue + background-color: lightblue; +} + +div.contents { + font-family: Arial, Helvetica, sans-serif; + font-size: 10pt; + padding: 20px; +} + +div.navpath { + font-size: 11pt; +} + +div.header { + background: url("head.png"); + background-color: #175783; + border: 1px solid; + height: 80px; + background-repeat: no-repeat; + margin-bottom:20px; +} + +div.tabs { + text-align: justify; + margin-left : 2px; + margin-right : 2px; + margin-top : 2px; + margin-bottom : 2px + font-weight: bold; + color: #FFFFFF; +} + +div.footer { + background-color: #D9f4fd; + border: 1px solid #AAAAAA; + font-family: Arial, Helvetica, sans-serif; + font-size: 11px; + padding: 10px; +} + +div.div-footer { + background-color: #D9f4fd; + border: 1px solid #AAAAAA; + font-family: Arial, Helvetica, sans-serif; + font-size: 11px; + padding: 10px; + text-align: center; } DL.el { @@ -45,10 +108,8 @@ DL.el { } /* A code fragment (ex: header) */ -DIV.fragment { - width: 100%; +div.fragment { border: none; - background-color: #CCCCCC } /* In the alpha list (coumpound index), style of an alphabetical index letter */ @@ -94,10 +155,6 @@ DIV.groupText { font-size: smaller } -BODY { - background: #FFFFFF; -} - /*div.div-page { background-color: #FFFFFF; margin-left: 1em; @@ -115,17 +172,19 @@ BODY { border-color: #0D299A; }*/ -DIV.div-footer { - margin-left: 1em; - margin-right: 1em; - margin-bottom: 0.2em; - text-align: right; - font-size: 9pt; +div.tabs { + text-align: justify; + margin-left : 2px; + margin-right : 2px; + margin-top : 2px; + margin-bottom : 2px + font-weight: bold; + color: #FFFFFF; } /* In File List, Coumpound List, etc, 1st column of the index */ TD.indexkey { - background-color: #CCCCCC; + background-color: #DDDDEE; font-weight: bold; padding-right : 10px; padding-top : 2px; @@ -139,7 +198,7 @@ TD.indexkey { /* In File List, Coumpound List, etc, 2nd column of the index */ TD.indexvalue { - background-color: #CCCCCC; + background-color: #EEEEFF; font-style: italic; padding-right : 10px; padding-top : 2px; @@ -158,3 +217,227 @@ span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } + +/* @group Code Colorization */ + +.fragment { + font-family: monospace, fixed; + font-size: 10pt; +} + +pre.fragment { + width: 95%; + border: 1px solid #CCCCCC; + -moz-border-radius: 8px; + -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); + background-color:#EEF3F5; + padding: 4px 6px; + margin: 20px; +} + +/* Top Navigation style */ + +div.navigation { + margin-bottom:20px; +} + +/* Left navigation panel style */ + +body.ftvtree { + background-color: #D9f4fd; + margin: 10px; +} + +div.directory { + margin: 0; +} + +div.directory.p { + margin: 0; +} + +h3.swap { + font-size: 10pt; + margin-bottom: 0; +} + +/* Link to any cross-referenced Doxygen element */ +a.el { + text-decoration: none; + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; + font-size: 10pt; + color: #551a8b; +} + +a.el:hover { + background-color: transparent; + color: #551acc; +} + +a { +// text-decoration: none; + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; + font-size: 10pt; + color: #551a8b; +} + +a:hover { + background-color: transparent; + color: #551acc; +} + +a.elRef { + font-weight: normal; +} + + +#MSearchBox { + -moz-border-radius:8px 8px 8px 8px; + background-color:white; + border:1px solid #84B0C7; + margin:0; + padding:0; + white-space:nowrap; +} + +div.directory img { + vertical-align:-30%; +} + +div.directory p { + white-space:nowrap; + margin: 0; +} + +div.directory-alt div { + display: none; + margin: 0px; +} + + +div.directory div { + display: none; + margin: 0px; +} + +div.version { + background-color:#ffffde; + border:1px solid #cccccc; + font-family: Arial, Helvetica, sans-serif; + font-size: 9pt; + text-align: center; + width:100px; + -moz-border-radius: 8px; + // -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); +} + + +/* @group Member Descriptions */ + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #FAFAFA; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memItemLeft, .memItemRight, .memTemplParams { + border-top: 1px solid #ccc; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memTemplParams { + color: #606060; + white-space: nowrap; +} + +/* @end */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; + margin-left: 3px; +} + +.memnav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.memitem { + padding: 0; + margin-bottom: 10px; +} + +.memname { + white-space: nowrap; + font-weight: bold; +} + +.memproto, .memdoc { + border: 1px solid #84b0c7; +} + +.memproto { + padding: 0; + background-color: #d5e1e8; + font-weight: bold; + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -moz-border-radius-topleft: 8px; + -moz-border-radius-topright: 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + +} + + + +.memdoc { + padding: 2px 5px; + background-color: #eef3f5; + border-top-width: 0; + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -moz-border-radius-bottomleft: 8px; + -moz-border-radius-bottomright: 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} + +/* @end */ diff --git a/doc/salome/tui/static/footer.html b/doc/salome/tui/static/footer.html index cb55f397a..53f5a62fe 100755 --- a/doc/salome/tui/static/footer.html +++ b/doc/salome/tui/static/footer.html @@ -1,5 +1,14 @@ - - - - + + + + + + + + diff --git a/doc/salome/tui/static/header.html.in b/doc/salome/tui/static/header.html.in new file mode 100755 index 000000000..791a37c53 --- /dev/null +++ b/doc/salome/tui/static/header.html.in @@ -0,0 +1,14 @@ + + + + + + $title + + + + +
    +
    Version: @VERSION@
    + + diff --git a/idl/Makefile.am b/idl/Makefile.am index 03486bd07..5a88808b3 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # This Makefile is responsible of generating the client and server # implementation of IDL interfaces for both C++ and python usage. # The building process of the C++ files is in charge of each source diff --git a/idl/SMESH_BasicHypothesis.idl b/idl/SMESH_BasicHypothesis.idl index 59b3a8a2c..871f07714 100644 --- a/idl/SMESH_BasicHypothesis.idl +++ b/idl/SMESH_BasicHypothesis.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_BasicHypothesis.idl // Author : Paul RASCLE, EDF // diff --git a/idl/SMESH_Filter.idl b/idl/SMESH_Filter.idl index 83c1d43d2..56f2cdce2 100644 --- a/idl/SMESH_Filter.idl +++ b/idl/SMESH_Filter.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_Filter.idl // Author : Alexey Petrov, OCC // diff --git a/idl/SMESH_Gen.idl b/idl/SMESH_Gen.idl index 9173c3f86..14527a9b3 100644 --- a/idl/SMESH_Gen.idl +++ b/idl/SMESH_Gen.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,9 +19,10 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_Gen.idl // Author : Paul RASCLE, EDF - +// #ifndef _SMESH_GEN_IDL_ #define _SMESH_GEN_IDL_ @@ -339,6 +340,16 @@ module SMESH * Can be used to check if the object was created in the same container, as this engine. */ long GetObjectId(in Object theObject); + + /*! + * \brief Get MED version of the file by its name. + */ + boolean GetMEDVersion(in string theFileName, out MED_VERSION theVersion); + + /*! + * \brief Get names of meshes defined in file with the specified name. + */ + string_array GetMeshNames(in string theFileName); }; }; diff --git a/idl/SMESH_Group.idl b/idl/SMESH_Group.idl index aa9cee125..c0bb54bc9 100644 --- a/idl/SMESH_Group.idl +++ b/idl/SMESH_Group.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_Group.idl // Author : Sergey ANIKIN, OCC // $Header$ diff --git a/idl/SMESH_Hypothesis.idl b/idl/SMESH_Hypothesis.idl index 56ae48b0c..443f7e75a 100644 --- a/idl/SMESH_Hypothesis.idl +++ b/idl/SMESH_Hypothesis.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_Hypothesis.idl // Author : Paul RASCLE, EDF // $Header$ diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index 8a5c37daa..4f5639fb1 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,10 +19,10 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_Mesh.idl // Author : Paul RASCLE, EDF // - #ifndef _SMESH_MESH_IDL_ #define _SMESH_MESH_IDL_ @@ -263,6 +263,10 @@ module SMESH interface SMESH_GroupOnGeom; interface SMESH_subMesh; interface SMESH_MeshEditor; + + typedef sequence submesh_array; + typedef sequence submesh_array_array; + interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource { /*! @@ -528,13 +532,23 @@ module SMESH * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ; * the typical use is auto_groups=false. * - theVersion : define the version of format of MED file, that will be created + * - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists + */ + void ExportToMEDX( in string file, in boolean auto_groups, in MED_VERSION theVersion, in boolean overwrite ) + raises (SALOME::SALOME_Exception); + + /*! + * Export Mesh to different MED Formats + * Works, just the same as ExportToMEDX, with overwrite parameter equal to true. + * The method is kept in order to support old functionality */ void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion ) raises (SALOME::SALOME_Exception); /*! * Export Mesh to MED_V2_1 MED format - * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1. + * Works, just the same as ExportToMEDX with MED_VERSION parameter equal to MED_V2_1 + * and overwrite parameter equal to true * The method is kept in order to support old functionality */ void ExportMED( in string file, in boolean auto_groups ) @@ -652,6 +666,9 @@ module SMESH ElementType GetElementType( in long id, in boolean iselem ) raises (SALOME::SALOME_Exception); + EntityType GetElementGeomType( in long id ) + raises (SALOME::SALOME_Exception); + long_array GetSubMeshElementsId(in long ShapeID) raises (SALOME::SALOME_Exception); @@ -661,6 +678,22 @@ module SMESH ElementType GetSubMeshElementType(in long ShapeID) raises (SALOME::SALOME_Exception); + + /*! + * Methods to set meshing order of submeshes + */ + + /*! + * \brief Return submesh objects list in meshing order + */ + submesh_array_array GetMeshOrder(); + + /*! + * \brief Set submesh object order + */ + boolean SetMeshOrder(in submesh_array_array theSubMeshArray); + + /*! * Get mesh description */ @@ -741,6 +774,16 @@ module SMESH */ long ElemNbFaces(in long id); + /*! + * Returns nodes of given face (counted from zero) for given volumic element. + */ + long_array GetElemFaceNodes(in long elemId, in short faceIndex); + + /*! + * Returns an element based on all given nodes. + */ + long FindElementByNodes(in long_array nodes); + /*! * Returns true if given element is polygon */ diff --git a/idl/SMESH_MeshEditor.idl b/idl/SMESH_MeshEditor.idl index 62623567a..983b2f486 100644 --- a/idl/SMESH_MeshEditor.idl +++ b/idl/SMESH_MeshEditor.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,9 +19,9 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_MeshEditor.idl // - #ifndef _SMESH_MESHEDITOR_IDL_ #define _SMESH_MESHEDITOR_IDL_ @@ -35,6 +35,11 @@ module SMESH interface NumericalFunctor; interface SMESH_MeshEditor { + /*! + * \brief Wrap a sequence of ids in a SMESH_IDSource + */ + SMESH_IDSource MakeIDSource(in long_array IDsOfElements); + boolean RemoveElements(in long_array IDsOfElements); boolean RemoveNodes(in long_array IDsOfNodes); @@ -211,6 +216,17 @@ module SMESH long BestSplit (in long IDOfQuad, in NumericalFunctor Criterion); + /*! + * \brief Split volumic elements into tetrahedrons + * \param elems - elements to split + * \param methodFlags - flags passing splitting method: + * 1 - split the hexahedron into 5 tetrahedrons + * 2 - split the hexahedron into 6 tetrahedrons + */ + void SplitVolumesIntoTetra(in SMESH_IDSource elems, in short methodFlags) + raises (SALOME::SALOME_Exception); + + enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH }; boolean Smooth(in long_array IDsOfElements, @@ -554,6 +570,19 @@ module SMESH in boolean CopyGroups, in string MeshName); + void Scale (in SMESH_IDSource theObject, + in PointStruct thePoint, + in double_array theScaleFact, + in boolean Copy); + ListOfGroups ScaleMakeGroups (in SMESH_IDSource theObject, + in PointStruct thePoint, + in double_array theScaleFact); + SMESH_Mesh ScaleMakeMesh (in SMESH_IDSource theObject, + in PointStruct thePoint, + in double_array theScaleFact, + in boolean CopyGroups, + in string MeshName); + void Rotate (in long_array IDsOfElements, in AxisStruct Axis, in double AngleInRadians, @@ -626,6 +655,12 @@ module SMESH */ long_array FindElementsByPoint(in double x, in double y, in double z, in ElementType type); + /*! + * Return point state in a closed 2D mesh in terms of TopAbs_State enumeration. + * TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails. + */ + short GetPointState(in double x, in double y, in double z); + enum Sew_Error { SEW_OK, SEW_BORDER1_NOT_FOUND, diff --git a/idl/SMESH_Pattern.idl b/idl/SMESH_Pattern.idl index 4f0bcfaa6..c00ab3a07 100644 --- a/idl/SMESH_Pattern.idl +++ b/idl/SMESH_Pattern.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_Pattern.idl // Created : Mon Aug 2 10:48:36 2004 // Author : Edward AGAPOV (eap) diff --git a/resources/Makefile.am b/resources/Makefile.am index 3fb97d2ae..ca671b982 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # -* Makefile *- # Author : Patrick GOLDBRONN (CEA) # Date : 28/06/2001 @@ -55,6 +53,7 @@ dist_salomeres_DATA = \ mesh_init.png \ mesh_length.png \ mesh_length_2d.png \ + mesh_find_elem_by_point.png \ mesh_free_edges.png \ mesh_free_edges_2d.png \ mesh_free_nodes.png \ @@ -166,7 +165,10 @@ dist_salomeres_DATA = \ mesh_extractGroup.png \ mesh_precompute.png \ mesh_2d_from_3d.png \ - mesh_free_faces.png + mesh_free_faces.png \ + scale.png \ + scale_along_axes.png \ + split_into_tetra.png # VSR: little trick to avoid putting if SMESHCatalog.xml to the distribution archive nodist_salomeres_SCRIPTS = SMESHCatalog.xml diff --git a/resources/SMESHCatalog.xml.in b/resources/SMESHCatalog.xml.in index 200d23297..5a5a88879 100644 --- a/resources/SMESHCatalog.xml.in +++ b/resources/SMESHCatalog.xml.in @@ -1,6 +1,6 @@ + + + + + + + + +
    + + +
    diff --git a/resources/StdMeshers.xml b/resources/StdMeshers.xml index d6083f4b0..d267ef1f6 100644 --- a/resources/StdMeshers.xml +++ b/resources/StdMeshers.xml @@ -1,7 +1,7 @@ Opaque @@ -2059,6 +2187,10 @@ Consider saving your work before application crash STB_2D_FROM_3D Create 2D mesh from 3D + + STB_MESH_ORDER + Change submesh priority + STB_CREATE_GROUP Create Group @@ -2409,6 +2541,10 @@ Consider saving your work before application crash STB_TRANS Translation + + STB_SCALE + Scale Transform + STB_TRANSP Transparency @@ -2565,6 +2701,10 @@ Consider saving your work before application crash TOP_2D_FROM_3D Create 2D mesh from 3D + + TOP_MESH_ORDER + Change submesh priority + TOP_CREATE_GROUP Create Group @@ -2915,6 +3055,10 @@ Consider saving your work before application crash TOP_TRANS Translation + + TOP_SCALE + Scale Transform + TOP_TRANSP Transparency @@ -3023,6 +3167,40 @@ Consider saving your work before application crash NO_MESH_SELECTED No mesh selected + + SMESH_PREF_def_precision + Default precision + + + SMESH_PREF_length_precision + Length precision + + + SMESH_PREF_angle_precision + Angular precision + + + SMESH_PREF_len_tol_precision + Length tolerance precision + + + SMESH_PREF_parametric_precision + Parametric precision + + + SMESH_PREF_area_precision + Area precision + + + SMESH_PREF_vol_precision + Volume precision + + + SMESH_PRECISION_HINT + +Input value precision can be adjusted using +'%1' parameter in Mesh module preferences. + SMESHGUI @@ -3103,6 +3281,10 @@ Please, create VTK viewer and try again PREF_NOTIFY_MODE Show a computation result notification + + SMESH_PREF_GROUP_PRECISION + Input fields precision + PREF_GROUP_ELEMENTS Elements @@ -3151,6 +3333,10 @@ Please, create VTK viewer and try again PREF_LABELS_COLOR Labels color + + PREF_MARKER_SCALE + Scale of marker + PREF_NODES Nodes @@ -3183,10 +3369,6 @@ Please, create VTK viewer and try again PREF_SHRINK_COEFF Shrink coef. - - PREF_SIZE - Size - PREF_TAB_GENERAL General @@ -3203,6 +3385,10 @@ Please, create VTK viewer and try again PREF_TITLE_COLOR Title color + + PREF_TYPE_OF_MARKER + Type of marker + PREF_COLOR_0D 0D elements @@ -3375,6 +3561,15 @@ Please, create VTK viewer and try again created during preview operation. Do you want to remove all this submeshes? + + SMESH_WRN_NOTHING_PREVIEW + No mesh preview is available + + + SMESH_REJECT_MESH_ORDER + The submesh priority changed during preview operation. +Do you want to restore original submesh priority? + SMESHGUI_ConvToQuadDlg @@ -4264,6 +4459,37 @@ Please specify them and try again Mesh to modify not selected + + SMESHGUI_FindElemByPointDlg + + CAPTION + Find Element by Point + + + CREATE_NEW_METHOD + Create a node + + + MESH_PASS_THROUGH_POINT + Make a node at point + + + METHOD + Method + + + MOVE_EXISTING_METHOD + Move a node + + + NODE_2MOVE + Node to move + + + NODE_2MOVE_ID + ID + + SMESHGUI_MeshDlg @@ -4592,6 +4818,25 @@ It is impossible to read point coordinates from file Use numeric functor + + SMESHGUI_CuttingIntoTetraDlg + + CAPTION + Splitting volumes into tetrahedra + + + SPLIT_METHOD + Split hexahedron + + + SPLIT_HEX_TO_5_TETRA + Into 5 tetrahedra + + + SPLIT_HEX_TO_6_TETRA + Into 6 tetrahedra + + SMESHGUI_PrecisionDlg @@ -4712,6 +4957,7 @@ It is impossible to read point coordinates from file MERGE_EQUAL_ELEMENTS Merge equal elements + NODE1_TO_MERGE Node 1 To Merge @@ -4864,4 +5110,77 @@ It is impossible to read point coordinates from file Create Groups from Geometry + + SMESHGUI_MeshOrderDlg + + SMESH_MESHORDER_TITLE + Order of submesh in meshing process + + + + SMESHGUI_MeshOrderOp + + SMESH_NO_CONCURENT_MESH + No concurent submeshes detected + + + + SMESHGUI_ClippingDlg + + CLIP_PLANES + Clipping planes + + + ROTATION_AROUND_X_Y2Z + Rotation around X (Y to Z): + + + ROTATION_AROUND_Y_X2Z + Rotation around Y (X to Z): + + + ROTATION_AROUND_Z_Y2X + Rotation around Z (Y to X): + + + ROTATION_AROUND_X_Z2Y + Rotation around X (Z to Y): + + + ROTATION_AROUND_Y_Z2X + Rotation around Y (Z to X): + + + ROTATION_AROUND_Z_X2Y + Rotation around Z (X to Y): + + + SHOW_PREVIEW + Show preview + + + AUTO_APPLY + Auto Apply + + + ALONG_XY + || X-Y + + + ALONG_YZ + || Y-Z + + + ALONG_ZX + || Z-X + + + PLANE_NUM + Plane# %1 + + + NO_PLANES + No planes + + diff --git a/src/SMESH_I/Makefile.am b/src/SMESH_I/Makefile.am index a2258d6b4..60cd3b312 100644 --- a/src/SMESH_I/Makefile.am +++ b/src/SMESH_I/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses # File : Makefile.in # Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH.hxx b/src/SMESH_I/SMESH.hxx index be211311a..3b8072d49 100644 --- a/src/SMESH_I/SMESH.hxx +++ b/src/SMESH_I/SMESH.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : // File : SMESH.hxx // Author : Michael ZORIN diff --git a/src/SMESH_I/SMESHEngine.cxx b/src/SMESH_I/SMESHEngine.cxx index 0c8d3bd60..1e146a128 100644 --- a/src/SMESH_I/SMESHEngine.cxx +++ b/src/SMESH_I/SMESHEngine.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + int main(int argc, char** argv) { return 1; diff --git a/src/SMESH_I/SMESH_0D_Algo_i.cxx b/src/SMESH_I/SMESH_0D_Algo_i.cxx index cd8247ba9..233fbe8fd 100644 --- a/src/SMESH_I/SMESH_0D_Algo_i.cxx +++ b/src/SMESH_I/SMESH_0D_Algo_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_0D_Algo_i.cxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH_0D_Algo_i.hxx b/src/SMESH_I/SMESH_0D_Algo_i.hxx index 401feed17..d98c84f3e 100644 --- a/src/SMESH_I/SMESH_0D_Algo_i.hxx +++ b/src/SMESH_I/SMESH_0D_Algo_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_0D_Algo_i.hxx // Module : SMESH diff --git a/src/SMESH_I/SMESH_1D_Algo_i.cxx b/src/SMESH_I/SMESH_1D_Algo_i.cxx index e5da53f79..393e5b7d0 100644 --- a/src/SMESH_I/SMESH_1D_Algo_i.cxx +++ b/src/SMESH_I/SMESH_1D_Algo_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_1D_Algo_i.cxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH_1D_Algo_i.hxx b/src/SMESH_I/SMESH_1D_Algo_i.hxx index 4ae7b0ea5..446d6db9a 100644 --- a/src/SMESH_I/SMESH_1D_Algo_i.hxx +++ b/src/SMESH_I/SMESH_1D_Algo_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_1D_Algo_i.hxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH_2D_Algo_i.cxx b/src/SMESH_I/SMESH_2D_Algo_i.cxx index 7fcf5a86d..e859366e1 100644 --- a/src/SMESH_I/SMESH_2D_Algo_i.cxx +++ b/src/SMESH_I/SMESH_2D_Algo_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_2D_Algo_i.cxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH_2D_Algo_i.hxx b/src/SMESH_I/SMESH_2D_Algo_i.hxx index 2579278fb..967db7042 100644 --- a/src/SMESH_I/SMESH_2D_Algo_i.hxx +++ b/src/SMESH_I/SMESH_2D_Algo_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_2D_Algo_i.hxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 8d3cacc13..640f51191 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,8 +19,8 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses -// // File : SMESH_2smeshpy.cxx // Created : Fri Nov 18 13:20:10 2005 // Author : Edward AGAPOV (eap) @@ -261,6 +261,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand Handle(_pySubMesh) subMesh = new _pySubMesh( aCommand ); myObjects.insert( make_pair( subMeshID, subMesh )); } + id_mesh->second->Process( aCommand ); return aCommand; } @@ -845,7 +846,8 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand ) } } // ---------------------------------------------------------------------- - else if ( method == "ExportToMED" ) { // ExportToMED() --> ExportMED() + else if ( method == "ExportToMED" || // ExportToMED() --> ExportMED() + method == "ExportToMEDX" ) { // ExportToMEDX() --> ExportMED() theCommand->SetMethod( "ExportMED" ); } // ---------------------------------------------------------------------- @@ -885,6 +887,34 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand ) // remove hyp from myHypos myHypos.remove( hyp ); } + // check for SubMesh order commands + else if ( theCommand->GetMethod() == "GetMeshOrder" || + theCommand->GetMethod() == "SetMeshOrder" ) { + // In fact arguments and result values does not support complex containers + // such as list of list + // So, here we parse it manually + // GetMeshOrder + //for(int ind = 0, n = theCommand->GetNbResultValues();indFindSubMesh( theCommand->GetResultValue(ind) ); + // SetMeshOrder + //for(int ind = 0, n = theCommand->GetNbArgs();indFindSubMesh( theCommand->GetArg(ind) ); + const bool isArg = theCommand->GetMethod() == "SetMeshOrder"; + const TCollection_AsciiString& cmdStr = theCommand->GetString(); + int begPos = (/*isArg ? cmdStr.Search( "(" ) :*/ cmdStr.Search( "[" )) + 1; + int endPos = (isArg ? cmdStr.Search( ")" ) : cmdStr.Search( "=" )) - 1; + if ( begPos != -1 && begPos < endPos && endPos <= cmdStr.Length() ) { + TCollection_AsciiString aSubStr = cmdStr.SubString( begPos, endPos ); + Standard_Integer index = 1; + TCollection_AsciiString anIDStr = aSubStr.Token("\t ,[]", index++); + while ( !anIDStr.IsEmpty() ) { + Handle(_pySubMesh) subMesh = theGen->FindSubMesh( anIDStr ); + if ( !subMesh.IsNull() ) + subMesh->Process( theCommand ); + anIDStr = aSubStr.Token("\t ,[]", index++); + } + } + } // add accessor method if necessary else { @@ -919,7 +949,7 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand ) "GetNodeInverseElements","GetShapeID","GetShapeIDForElem","GetElemNbNodes", "GetElemNode","IsMediumNode","IsMediumNodeOfAnyElem","ElemNbEdges","ElemNbFaces", "IsPoly","IsQuadratic","BaryCenter","GetHypothesisList", "SetAutoColor", "GetAutoColor", - "Clear", "ConvertToStandalone" + "Clear", "ConvertToStandalone", "GetMeshOrder", "SetMeshOrder" ,"" }; // <- mark of end sameMethods.Insert( names ); } @@ -1276,6 +1306,19 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th else if ( hypType == "TrianglePreference" ) { hyp->SetConvMethodAndType( "TrianglePreference", "Quadrangle_2D"); } + // RadialQuadrangle_1D2D ---------- + else if ( hypType == "RadialQuadrangle_1D2D" ) { + algo->SetConvMethodAndType( "Quadrangle" , hypType.ToCString()); + algo->myArgs.Append( "algo=smesh.RADIAL_QUAD" ); + } + else if ( hypType == "NumberOfLayers2D" ) { + hyp->SetConvMethodAndType( "NumberOfLayers", "RadialQuadrangle_1D2D"); + hyp->AddArgMethod( "SetNumberOfLayers" ); + } + else if ( hypType == "LayerDistribution2D" ) { + hyp = new _pyLayerDistributionHypo( theCreationCmd, "Get2DHypothesis" ); + hyp->SetConvMethodAndType( "LayerDistribution", "RadialQuadrangle_1D2D"); + } // BLSURF ---------- else if ( hypType == "BLSURF" ) { algo->SetConvMethodAndType( "Triangle", hypType.ToCString()); @@ -1375,14 +1418,11 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th hyp->AddArgMethod( "SetNumberOfLayers" ); } else if ( hypType == "LayerDistribution" ) { - hyp = new _pyLayerDistributionHypo( theCreationCmd ); + hyp = new _pyLayerDistributionHypo( theCreationCmd, "Get3DHypothesis" ); hyp->SetConvMethodAndType( "LayerDistribution", "RadialPrism_3D"); } - if ( algo->IsValid() ) { - return algo; - } - return hyp; + return algo->IsValid() ? algo : hyp; } //================================================================================ @@ -1615,46 +1655,10 @@ void _pyLayerDistributionHypo::Process( const Handle(_pyCommand)& theCommand) my1dHyp->ClearAllCommands(); } my1dHyp = hyp1d; - if ( my1dHyp.IsNull() ) - return; // something wrong :( - - // make a new name for 1D hyp = "HypType" + "_Distribution" - if ( my1dHyp->GetCreationCmd()->GetMethod() == "CreateHypothesis" ) { - // not yet converted creation cmd - TCollection_AsciiString hypTypeQuoted = my1dHyp->GetCreationCmd()->GetArg(1); - TCollection_AsciiString hypType = hypTypeQuoted.SubString( 2, hypTypeQuoted.Length() - 1 ); - newName = hypType + "_Distribution"; - my1dHyp->GetCreationCmd()->SetResultValue( newName ); - } - else { - // already converted creation cmd - newName = my1dHyp->GetCreationCmd()->GetResultValue(); - } - // as creation of 1D hyp was written later then it's edition, - // we need to find all it's edition calls and process them - list< Handle(_pyCommand) >& cmds = theGen->GetCommands(); - list< Handle(_pyCommand) >::iterator cmdIt = cmds.begin(); - for ( ; cmdIt != cmds.end(); ++cmdIt ) { - const _pyID& objID = (*cmdIt)->GetObject(); - if ( objID == hyp1dID ) { - my1dHyp->Process( *cmdIt ); - my1dHyp->GetCreationCmd()->AddDependantCmd( *cmdIt ); - ( *cmdIt )->SetObject( newName ); - } - } if ( !myArgCommands.empty() ) myArgCommands.front()->Clear(); - theCommand->SetArg( 1, newName ); myArgCommands.push_back( theCommand ); - // copy hyp1d's creation method and args -// myCreationMethod = hyp1d->GetCreationMethod(); -// myArgs = hyp1d->GetArgs(); -// // make them cleared at conversion -// myArgCommands = hyp1d->GetArgCommands(); - -// // to be cleared at convertion only -// myArgCommands.push_back( theCommand ); } //================================================================================ @@ -1679,20 +1683,23 @@ bool _pyLayerDistributionHypo::Addition2Creation( const Handle(_pyCommand)& theA _pyID geom = theAdditionCmd->GetArg( 1 ); - my1dHyp->SetMesh( theMesh ); - if ( !my1dHyp->Addition2Creation( theAdditionCmd, theMesh )) - return false; + Handle(_pyHypothesis) algo = theGen->FindAlgo( geom, theMesh, this ); + if ( !algo.IsNull() ) + { + my1dHyp->SetMesh( theMesh ); + my1dHyp->SetConvMethodAndType(my1dHyp->GetAlgoCreationMethod().ToCString(), + algo->GetAlgoType().ToCString()); + if ( !my1dHyp->Addition2Creation( theAdditionCmd, theMesh )) + return false; - // clear "SetLayerDistribution()" cmd - myArgCommands.front()->Clear(); + // clear "SetLayerDistribution()" cmd + myArgCommands.back()->Clear(); - // Convert my creation => me = RadialPrismAlgo.Get3DHypothesis() + // Convert my creation => me = RadialPrismAlgo.Get3DHypothesis() - // find RadialPrism algo created on for theMesh - Handle(_pyHypothesis) algo = theGen->FindAlgo( geom, theMesh, this ); - if ( !algo.IsNull() ) { + // find RadialPrism algo created on for theMesh GetCreationCmd()->SetObject( algo->GetID() ); - GetCreationCmd()->SetMethod( "Get3DHypothesis" ); + GetCreationCmd()->SetMethod( myAlgoMethod ); GetCreationCmd()->RemoveArgs(); theAdditionCmd->AddDependantCmd( GetCreationCmd() ); myIsWrapped = true; @@ -1708,8 +1715,38 @@ bool _pyLayerDistributionHypo::Addition2Creation( const Handle(_pyCommand)& theA void _pyLayerDistributionHypo::Flush() { - //my1dHyp.Nullify(); - //_pyHypothesis::Flush(); + // as creation of 1D hyp was written later then it's edition, + // we need to find all it's edition calls and process them + if ( !my1dHyp.IsNull() ) + { + _pyID hyp1dID = my1dHyp->GetCreationCmd()->GetResultValue(); + + // make a new name for 1D hyp = "HypType" + "_Distribution" + _pyID newName; + if ( my1dHyp->IsWrapped() ) { + newName = my1dHyp->GetCreationCmd()->GetMethod(); + } + else { + TCollection_AsciiString hypTypeQuoted = my1dHyp->GetCreationCmd()->GetArg(1); + newName = hypTypeQuoted.SubString( 2, hypTypeQuoted.Length() - 1 ); + } + newName += "_Distribution"; + my1dHyp->GetCreationCmd()->SetResultValue( newName ); + + list< Handle(_pyCommand) >& cmds = theGen->GetCommands(); + list< Handle(_pyCommand) >::iterator cmdIt = cmds.begin(); + for ( ; cmdIt != cmds.end(); ++cmdIt ) { + const _pyID& objID = (*cmdIt)->GetObject(); + if ( objID == hyp1dID ) { + my1dHyp->Process( *cmdIt ); + my1dHyp->GetCreationCmd()->AddDependantCmd( *cmdIt ); + ( *cmdIt )->SetObject( newName ); + } + } + // Set new hyp name to SetLayerDistribution() cmd + if ( !myArgCommands.empty() && !myArgCommands.back()->IsEmpty() ) + myArgCommands.back()->SetArg( 1, newName ); + } } //================================================================================ diff --git a/src/SMESH_I/SMESH_2smeshpy.hxx b/src/SMESH_I/SMESH_2smeshpy.hxx index 16926e54d..c5ad5122a 100644 --- a/src/SMESH_I/SMESH_2smeshpy.hxx +++ b/src/SMESH_I/SMESH_2smeshpy.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_smesh.hxx // Created : Fri Nov 18 12:05:18 2005 // Author : Edward AGAPOV (eap) @@ -113,7 +114,7 @@ public: int GetOrderNb() const { return myOrderNb; } void SetOrderNb( int theNb ) { myOrderNb = theNb; } int Length() { return myString.Length(); } - void Clear() { myString.Clear(); myBegPos.Clear(); } + void Clear() { myString.Clear(); myBegPos.Clear(); myArgs.Clear(); } bool IsEmpty() const { return myString.IsEmpty(); } TCollection_AsciiString GetIndentation(); const TCollection_AsciiString & GetResultValue(); @@ -373,9 +374,10 @@ DEFINE_STANDARD_HANDLE (_pyComplexParamHypo, _pyHypothesis); class _pyLayerDistributionHypo: public _pyHypothesis { Handle(_pyHypothesis) my1dHyp; + TCollection_AsciiString myAlgoMethod; public: - _pyLayerDistributionHypo(const Handle(_pyCommand)& theCreationCmd): - _pyHypothesis(theCreationCmd) {} + _pyLayerDistributionHypo(const Handle(_pyCommand)& theCreationCmd, const char* algoMethod): + _pyHypothesis(theCreationCmd), myAlgoMethod((char*)algoMethod) {} void Process( const Handle(_pyCommand)& theCommand); void Flush(); bool Addition2Creation( const Handle(_pyCommand)& theAdditionCmd, diff --git a/src/SMESH_I/SMESH_3D_Algo_i.cxx b/src/SMESH_I/SMESH_3D_Algo_i.cxx index 8aa242ba6..d72a20fb2 100644 --- a/src/SMESH_I/SMESH_3D_Algo_i.cxx +++ b/src/SMESH_I/SMESH_3D_Algo_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_3D_Algo_i.cxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH_3D_Algo_i.hxx b/src/SMESH_I/SMESH_3D_Algo_i.hxx index 4352e7296..384a07aa1 100644 --- a/src/SMESH_I/SMESH_3D_Algo_i.hxx +++ b/src/SMESH_I/SMESH_3D_Algo_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_3D_Algo_i.hxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH_Algo_i.cxx b/src/SMESH_I/SMESH_Algo_i.cxx index e567a15d6..32e580ff9 100644 --- a/src/SMESH_I/SMESH_Algo_i.cxx +++ b/src/SMESH_I/SMESH_Algo_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Algo_i.cxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH_Algo_i.hxx b/src/SMESH_I/SMESH_Algo_i.hxx index cfcfc5347..d511c50f9 100644 --- a/src/SMESH_I/SMESH_Algo_i.hxx +++ b/src/SMESH_I/SMESH_Algo_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Algo_i.hxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx index 5b012b59c..5be4f5de4 100644 --- a/src/SMESH_I/SMESH_DumpPython.cxx +++ b/src/SMESH_I/SMESH_DumpPython.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_Gen_i_DumpPython.cxx // Created : Thu Mar 24 17:17:59 2005 // Author : Julia DOROVSKIKH @@ -208,6 +209,32 @@ namespace SMESH return *this; } + TPythonDump& + TPythonDump:: + operator<<(SMESH::SMESH_Hypothesis_ptr theArg) + { + SALOMEDS::Study_var aStudy = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy(); + SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg); + if(aSObject->_is_nil() && !CORBA::is_nil(theArg)) + myStream << "hyp_" << theArg->GetId(); + else + *this << CORBA::Object_ptr( theArg ); + return *this; + } + + TPythonDump& + TPythonDump:: + operator<<(SMESH::SMESH_IDSource_ptr theArg) + { + SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); + SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy(); + SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg); + if(!aSObject->_is_nil() || CORBA::is_nil( theArg )) + return *this << aSObject; + SMESH::long_array_var anElementsId = theArg->GetIDs(); + return *this << anElementsId; + } + TPythonDump& TPythonDump:: operator<<(SMESH::FilterLibrary_i* theArg) @@ -484,9 +511,7 @@ Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Object_ptr theStudy, TCollection_AsciiString aSavedTrace (oldValue); // Add trace of API methods calls and replace study entries by names - TCollection_AsciiString aScript = - "# -*- coding: iso-8859-1 -*-\n" - "### This file is generated by SALOME automatically by dump python functionality of SMESH component\n\n"; + TCollection_AsciiString aScript; aScript += DumpPython_impl(aStudy, aMap, aMapNames, isPublished, isValidScript, aSavedTrace); diff --git a/src/SMESH_I/SMESH_Filter_i.cxx b/src/SMESH_I/SMESH_Filter_i.cxx index e9370beda..969ffb613 100644 --- a/src/SMESH_I/SMESH_Filter_i.cxx +++ b/src/SMESH_I/SMESH_Filter_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Filter_i.cxx // Author : Alexey Petrov, OCC diff --git a/src/SMESH_I/SMESH_Filter_i.hxx b/src/SMESH_I/SMESH_Filter_i.hxx index 44cc246bf..057c7693b 100644 --- a/src/SMESH_I/SMESH_Filter_i.hxx +++ b/src/SMESH_I/SMESH_Filter_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Filter_i.hxx // Author : Alexey Petrov, OCC diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index b00a7e8a0..6db942604 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Gen_i.cxx // Author : Paul RASCLE, EDF @@ -54,6 +55,7 @@ #ifdef WNT #include + #include #else #include #endif @@ -107,10 +109,12 @@ #include "OpUtil.hxx" #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog) +#include CORBA_CLIENT_HEADER(SALOME_Session) #include "GEOM_Client.hxx" #include "Utils_ExceptHandlers.hxx" #include "memoire.h" +#include "Basics_Utils.hxx" #include @@ -280,6 +284,28 @@ SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_ptr orb, // set it in standalone mode only //OSD::SetSignal( true ); + + // 0020605: EDF 1190 SMESH: Display performance. 80 seconds for 52000 cells. + // find out mode (embedded or standalone) here else + // meshes created before calling SMESH_Client::GetSMESHGen(), which calls + // SMESH_Gen_i::SetEmbeddedMode(), have wrong IsEmbeddedMode flag + if ( SALOME_NamingService* ns = GetNS() ) + { + CORBA::Object_var obj = ns->Resolve( "/Kernel/Session" ); + SALOME::Session_var session = SALOME::Session::_narrow( obj ) ; + if ( !session->_is_nil() ) + { + CORBA::String_var s_host = session->getHostname(); + CORBA::Long s_pid = session->getPID(); + string my_host = Kernel_Utils::GetHostname(); +#ifdef WNT + long my_pid = (long)_getpid(); +#else + long my_pid = (long) getpid(); +#endif + SetEmbeddedMode( s_pid == my_pid && my_host == s_host.in() ); + } + } } //============================================================================= @@ -770,7 +796,7 @@ void SMESH_Gen_i::SetBoundaryBoxSegmentation( CORBA::Long theNbSegments ) void SMESH_Gen_i::SetDefaultNbSegments(CORBA::Long theNbSegments) throw ( SALOME::SALOME_Exception ) { - if ( theNbSegments ) + if ( theNbSegments > 0 ) myGen.SetDefaultNbSegments( int(theNbSegments) ); else THROW_SALOME_CORBA_EXCEPTION( "non-positive number of segments", SALOME::BAD_PARAM ); @@ -1666,13 +1692,22 @@ SMESH::long_array* SMESH_Gen_i::Evaluate(SMESH::SMESH_Mesh_ptr theMesh, MapShapeNbElemsItr anIt = aResMap.begin(); for(; anIt!=aResMap.end(); anIt++) { const vector& aVec = (*anIt).second; - for(i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++) { - nbels[i] += aVec[i]; + for(i = SMESH::Entity_Node; i < aVec.size(); i++) { + int nbElem = aVec[i]; + if ( nbElem < 0 ) // algo failed, check that it has reported a message + { + SMESH_subMesh* sm = anIt->first; + SMESH_ComputeErrorPtr& error = sm->GetComputeError(); + const SMESH_Algo* algo = myGen.GetAlgo( myLocMesh, sm->GetSubShape()); + if ( algo && !error.get() || error->IsOK() ) + error.reset( new SMESH_ComputeError( COMPERR_ALGO_FAILED,"Failed to evaluate",algo)); + } + else + { + nbels[i] += aVec[i]; + } } } -#ifdef _DEBUG_ - cout<GetNbMeshes( &anErr ); + if( anErr >= 0 ) { + aResult->length( aNbMeshes ); + for( MED::TInt i = 0; i < aNbMeshes; i++ ) { + MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo( i+1 ); + aResult[i] = CORBA::string_dup( aMeshInfo->GetName().c_str() ); + } + } + return aResult._retn(); +} + //============================================================================= /*! * SMESH_Gen_i::Save @@ -2726,6 +2804,40 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent, //if ( shapeRefFound ) //myWriter.AddAllSubMeshes(); + // store submesh order if any + const TListOfListOfInt& theOrderIds = myLocMesh.GetMeshOrder(); + if ( theOrderIds.size() ) { + char order_list[ 30 ]; + strcpy( order_list, "Mesh Order" ); + // count number of submesh ids + int nbIDs = 0; + TListOfListOfInt::const_iterator idIt = theOrderIds.begin(); + for ( ; idIt != theOrderIds.end(); idIt++ ) + nbIDs += (*idIt).size(); + // number of values = number of IDs + + // number of lists (for separators) - 1 + int* smIDs = new int [ nbIDs + theOrderIds.size() - 1 ]; + idIt = theOrderIds.begin(); + for ( int i = 0; idIt != theOrderIds.end(); idIt++ ) { + const TListOfInt& idList = *idIt; + if (idIt != theOrderIds.begin()) // not first list + smIDs[ i++ ] = -1/* *idList.size()*/; // separator between lists + // dump submesh ids from current list + TListOfInt::const_iterator id_smId = idList.begin(); + for( ; id_smId != idList.end(); id_smId++ ) + smIDs[ i++ ] = *id_smId; + } + // write HDF group + aSize[ 0 ] = nbIDs + theOrderIds.size() - 1; + + aDataset = new HDFdataset( order_list, aTopGroup, HDF_INT32, aSize, 1 ); + aDataset->CreateOnDisk(); + aDataset->WriteOnDisk( smIDs ); + aDataset->CloseOnDisk(); + // + delete[] smIDs; + } + // groups root sub-branch SALOMEDS::SObject_var myGroupsBranch; for ( int i = GetNodeGroupsTag(); i <= GetVolumeGroupsTag(); i++ ) { @@ -2910,7 +3022,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent, aDataset->WriteOnDisk( smIDs ); aDataset->CloseOnDisk(); // - delete smIDs; + delete[] smIDs; } // Store node positions on sub-shapes (SMDS_Position): @@ -2940,6 +3052,8 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent, if ( nbNodes == 0 ) continue; int aShapeID = (*itSubM).first; + if ( aShapeID < 1 || aShapeID > mySMESHDSMesh->MaxShapeIndex() ) + continue; int aShapeType = mySMESHDSMesh->IndexToShape( aShapeID ).ShapeType(); // write only SMDS_FacePosition and SMDS_EdgePosition switch ( aShapeType ) { @@ -3498,7 +3612,6 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent, } } } - } } } @@ -4121,6 +4234,24 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent, aGroup->CloseOnDisk(); } } + // read submeh order if any + if( aTopGroup->ExistInternalObject( "Mesh Order" ) ) { + aDataset = new HDFdataset( "Mesh Order", aTopGroup ); + aDataset->OpenOnDisk(); + size = aDataset->GetSize(); + int* smIDs = new int[ size ]; + aDataset->ReadFromDisk( smIDs ); + aDataset->CloseOnDisk(); + TListOfListOfInt anOrderIds; + anOrderIds.push_back( TListOfInt() ); + for ( int i = 0; i < size; i++ ) + if ( smIDs[ i ] < 0 ) // is separator + anOrderIds.push_back( TListOfInt() ); + else + anOrderIds.back().push_back(smIDs[ i ]); + + myNewMeshImpl->GetImpl().SetMeshOrder( anOrderIds ); + } } // close mesh group if(aTopGroup) diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index 13bca294a..89cf79ca7 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Gen_i.hxx // Author : Paul RASCLE, EDF @@ -320,6 +321,13 @@ public: CORBA::Double theMergeTolerance) throw ( SALOME::SALOME_Exception ); + // Get MED version of the file by its name + CORBA::Boolean GetMEDVersion(const char* theFileName, + SMESH::MED_VERSION& theVersion); + + // Get names of meshes defined in file with the specified name + SMESH::string_array* GetMeshNames(const char* theFileName); + // **************************************************** // Interface inherited methods (from SALOMEDS::Driver) // **************************************************** diff --git a/src/SMESH_I/SMESH_Gen_i_1.cxx b/src/SMESH_I/SMESH_Gen_i_1.cxx index 2b216fe26..d5161e29f 100644 --- a/src/SMESH_I/SMESH_Gen_i_1.cxx +++ b/src/SMESH_I/SMESH_Gen_i_1.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Gen_i_1.cxx // Created : Thu Oct 21 17:24:06 2004 diff --git a/src/SMESH_I/SMESH_Group_i.cxx b/src/SMESH_I/SMESH_Group_i.cxx index 7502c5409..c69024ed2 100644 --- a/src/SMESH_I/SMESH_Group_i.cxx +++ b/src/SMESH_I/SMESH_Group_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes // File : SMESH_Group_i.cxx // Author : Sergey ANIKIN, OCC @@ -165,11 +166,12 @@ SMESH::ElementType SMESH_GroupBase_i::GetType() SMDSAbs_ElementType aSMDSType = aGroupDS->GetType(); SMESH::ElementType aType; switch (aSMDSType) { - case SMDSAbs_Node: aType = SMESH::NODE; break; - case SMDSAbs_Edge: aType = SMESH::EDGE; break; - case SMDSAbs_Face: aType = SMESH::FACE; break; - case SMDSAbs_Volume: aType = SMESH::VOLUME; break; - default: aType = SMESH::ALL; break; + case SMDSAbs_Node: aType = SMESH::NODE; break; + case SMDSAbs_Edge: aType = SMESH::EDGE; break; + case SMDSAbs_Face: aType = SMESH::FACE; break; + case SMDSAbs_Volume: aType = SMESH::VOLUME; break; + case SMDSAbs_0DElement: aType = SMESH::ELEM0D; break; + default: aType = SMESH::ALL; break; } return aType; } diff --git a/src/SMESH_I/SMESH_Group_i.hxx b/src/SMESH_I/SMESH_Group_i.hxx index 93f8354b9..30ea828c0 100644 --- a/src/SMESH_I/SMESH_Group_i.hxx +++ b/src/SMESH_I/SMESH_Group_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes // File : SMESH_Group_i.hxx // Author : Sergey ANIKIN, OCC diff --git a/src/SMESH_I/SMESH_Hypothesis_i.cxx b/src/SMESH_I/SMESH_Hypothesis_i.cxx index b677e647b..19d436ff6 100644 --- a/src/SMESH_I/SMESH_Hypothesis_i.cxx +++ b/src/SMESH_I/SMESH_Hypothesis_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Hypothesis_i.cxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH_Hypothesis_i.hxx b/src/SMESH_I/SMESH_Hypothesis_i.hxx index 13bd7742f..24c01d46a 100644 --- a/src/SMESH_I/SMESH_Hypothesis_i.hxx +++ b/src/SMESH_I/SMESH_Hypothesis_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Hypothesis_i.hxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH_MEDFamily_i.cxx b/src/SMESH_I/SMESH_MEDFamily_i.cxx index 393e49c42..66d26cc0d 100644 --- a/src/SMESH_I/SMESH_MEDFamily_i.cxx +++ b/src/SMESH_I/SMESH_MEDFamily_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_MEDFamily_i.cxx // Module : SMESH diff --git a/src/SMESH_I/SMESH_MEDFamily_i.hxx b/src/SMESH_I/SMESH_MEDFamily_i.hxx index e6af38067..06a13600d 100644 --- a/src/SMESH_I/SMESH_MEDFamily_i.hxx +++ b/src/SMESH_I/SMESH_MEDFamily_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_MEDFamily_i.hxx // Module : SMESH diff --git a/src/SMESH_I/SMESH_MEDMesh_i.cxx b/src/SMESH_I/SMESH_MEDMesh_i.cxx index f73bf1102..b1b093770 100644 --- a/src/SMESH_I/SMESH_MEDMesh_i.cxx +++ b/src/SMESH_I/SMESH_MEDMesh_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_MEDMesh_i.cxx // Module : SMESH diff --git a/src/SMESH_I/SMESH_MEDMesh_i.hxx b/src/SMESH_I/SMESH_MEDMesh_i.hxx index 72b31032e..68fcc96c3 100644 --- a/src/SMESH_I/SMESH_MEDMesh_i.hxx +++ b/src/SMESH_I/SMESH_MEDMesh_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_MEDMesh_i.hxx // Module : SMESH diff --git a/src/SMESH_I/SMESH_MEDSupport_i.cxx b/src/SMESH_I/SMESH_MEDSupport_i.cxx index 4b1e66ddf..c1a8fe548 100644 --- a/src/SMESH_I/SMESH_MEDSupport_i.cxx +++ b/src/SMESH_I/SMESH_MEDSupport_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_MEDSupport_i.cxx // Module : SMESH diff --git a/src/SMESH_I/SMESH_MEDSupport_i.hxx b/src/SMESH_I/SMESH_MEDSupport_i.hxx index 56c36a881..b30528dad 100644 --- a/src/SMESH_I/SMESH_MEDSupport_i.hxx +++ b/src/SMESH_I/SMESH_MEDSupport_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_MEDSupport_i.hxx // Module : SMESH diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index a5bc40799..0ccfca681 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,11 +19,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_MeshEditor_i.cxx // Author : Nicolas REJNERI // Module : SMESH - +// #include "SMESH_MeshEditor_i.hxx" #include "SMDS_Mesh0DElement.hxx" @@ -271,6 +272,27 @@ void SMESH_MeshEditor_i::initData(bool deleteSearchers) } } +//======================================================================= +//function : MakeIDSource +//purpose : Wrap a sequence of ids in a SMESH_IDSource +//======================================================================= + +struct _IDSource : public POA_SMESH::SMESH_IDSource +{ + SMESH::long_array _ids; + SMESH::long_array* GetIDs() { return new SMESH::long_array( _ids ); } + SMESH::long_array* GetMeshInfo() { return 0; } +}; + +SMESH::SMESH_IDSource_ptr SMESH_MeshEditor_i::MakeIDSource(const SMESH::long_array& ids) +{ + _IDSource* anIDSource = new _IDSource; + anIDSource->_ids = ids; + SMESH::SMESH_IDSource_var anIDSourceVar = anIDSource->_this(); + + return anIDSourceVar._retn(); +} + //============================================================================= /*! * @@ -290,9 +312,6 @@ SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array & IDsOfElements) // Update Python script TPythonDump() << "isDone = " << this << ".RemoveElements( " << IDsOfElements << " )"; -#ifdef _DEBUG_ - TPythonDump() << "print 'RemoveElements: ', isDone"; -#endif // Remove Elements return anEditor.Remove( IdList, false ); } @@ -314,9 +333,6 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::long_array & IDsOfNo // Update Python script TPythonDump() << "isDone = " << this << ".RemoveNodes( " << IDsOfNodes << " )"; -#ifdef _DEBUG_ - TPythonDump() << "print 'RemoveNodes: ', isDone"; -#endif return anEditor.Remove( IdList, true ); } @@ -468,14 +484,8 @@ CORBA::Long SMESH_MeshEditor_i::AddPolygonalFace (const SMESH::long_array & IDsO // Update Python script TPythonDump() <<"faceID = "<GetID(); - - return 0; + return elem ? elem->GetID() : 0; } //============================================================================= @@ -517,9 +527,6 @@ CORBA::Long SMESH_MeshEditor_i::AddVolume(const SMESH::long_array & IDsOfNodes) // Update Python script TPythonDump() << "volID = " << this << ".AddVolume( " << IDsOfNodes << " )"; -#ifdef _DEBUG_ - TPythonDump() << "print 'AddVolume: ', volID"; -#endif if(elem) return elem->GetID(); @@ -552,14 +559,8 @@ CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolume (const SMESH::long_array & I // Update Python script TPythonDump() << "volID = " << this << ".AddPolyhedralVolume( " << IDsOfNodes << ", " << Quantities << " )"; -#ifdef _DEBUG_ - TPythonDump() << "print 'AddPolyhedralVolume: ', volID"; -#endif - - if(elem) - return elem->GetID(); - return 0; + return elem ? elem->GetID() : 0; } //============================================================================= @@ -590,14 +591,8 @@ CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolumeByFaces (const SMESH::long_ar // Update Python script TPythonDump() << "volID = " << this << ".AddPolyhedralVolumeByFaces( " << IdsOfFaces << " )"; -#ifdef _DEBUG_ - TPythonDump() << "print 'AddPolyhedralVolume: ', volID"; -#endif - - if(elem) - return elem->GetID(); - return 0; + return elem ? elem->GetID() : 0; } //============================================================================= @@ -932,9 +927,6 @@ CORBA::Boolean SMESH_MeshEditor_i::TriToQuad (const SMESH::long_array & IDsOfE // Update Python script TPythonDump() << "isDone = " << this << ".TriToQuad( " << IDsOfElements << ", " << aNumericalFunctor << ", " << MaxAngle << " )"; -#ifdef _DEBUG_ - TPythonDump() << "print 'TriToQuad: ', isDone"; -#endif ::SMESH_MeshEditor anEditor( myMesh ); @@ -963,9 +955,6 @@ CORBA::Boolean SMESH_MeshEditor_i::TriToQuadObject (SMESH::SMESH_IDSource_ptr // Clear python line(s), created by TriToQuad() SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID()); -#ifdef _DEBUG_ - aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID()); -#endif SMESH::NumericalFunctor_i* aNumericalFunctor = SMESH::DownCast( Criterion ); @@ -973,9 +962,6 @@ CORBA::Boolean SMESH_MeshEditor_i::TriToQuadObject (SMESH::SMESH_IDSource_ptr // Update Python script TPythonDump() << "isDone = " << this << ".TriToQuadObject(" << theObject << ", " << aNumericalFunctor << ", " << MaxAngle << " )"; -#ifdef _DEBUG_ - TPythonDump() << "print 'TriToQuadObject: ', isDone"; -#endif return isDone; } @@ -1006,9 +992,6 @@ CORBA::Boolean SMESH_MeshEditor_i::QuadToTri (const SMESH::long_array & IDsOfE // Update Python script TPythonDump() << "isDone = " << this << ".QuadToTri( " << IDsOfElements << ", " << aNumericalFunctor << " )"; -#ifdef _DEBUG_ - TPythonDump() << "print 'QuadToTri: ', isDone"; -#endif ::SMESH_MeshEditor anEditor( myMesh ); CORBA::Boolean stat = anEditor.QuadToTri( faces, aCrit ); @@ -1035,18 +1018,12 @@ CORBA::Boolean SMESH_MeshEditor_i::QuadToTriObject (SMESH::SMESH_IDSource_ptr // Clear python line(s), created by QuadToTri() SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID()); -#ifdef _DEBUG_ - aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID()); -#endif SMESH::NumericalFunctor_i* aNumericalFunctor = SMESH::DownCast( Criterion ); // Update Python script TPythonDump() << "isDone = " << this << ".QuadToTriObject( " << theObject << ", " << aNumericalFunctor << " )"; -#ifdef _DEBUG_ - TPythonDump() << "print 'QuadToTriObject: ', isDone"; -#endif return isDone; } @@ -1069,9 +1046,6 @@ CORBA::Boolean SMESH_MeshEditor_i::SplitQuad (const SMESH::long_array & IDsOfEle // Update Python script TPythonDump() << "isDone = " << this << ".SplitQuad( " << IDsOfElements << ", " << Diag13 << " )"; -#ifdef _DEBUG_ - TPythonDump() << "print 'SplitQuad: ', isDone"; -#endif ::SMESH_MeshEditor anEditor( myMesh ); CORBA::Boolean stat = anEditor.QuadToTri( faces, Diag13 ); @@ -1098,16 +1072,10 @@ CORBA::Boolean SMESH_MeshEditor_i::SplitQuadObject (SMESH::SMESH_IDSource_ptr th // Clear python line(s), created by SplitQuad() SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID()); -#ifdef _DEBUG_ - aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID()); -#endif // Update Python script TPythonDump() << "isDone = " << this << ".SplitQuadObject( " << theObject << ", " << Diag13 << " )"; -#ifdef _DEBUG_ - TPythonDump() << "print 'SplitQuadObject: ', isDone"; -#endif return isDone; } @@ -1138,6 +1106,28 @@ CORBA::Long SMESH_MeshEditor_i::BestSplit (CORBA::Long IDOfQuad, return -1; } +//================================================================================ +/*! + * \brief Split volumic elements into tetrahedrons + */ +//================================================================================ + +void SMESH_MeshEditor_i::SplitVolumesIntoTetra (SMESH::SMESH_IDSource_ptr elems, + CORBA::Short methodFlags) + throw (SALOME::SALOME_Exception) +{ + Unexpect aCatch(SALOME_SalomeException); + + SMESH::long_array_var anElementsId = elems->GetIDs(); + TIDSortedElemSet elemSet; + arrayToSet( anElementsId, GetMeshDS(), elemSet, SMDSAbs_Volume ); + + ::SMESH_MeshEditor anEditor (myMesh); + anEditor.SplitVolumesIntoTetra( elemSet, int( methodFlags )); + + TPythonDump() << this << ".SplitVolumesIntoTetra( " + << elems << ", " << methodFlags << " )"; +} //======================================================================= //function : Smooth @@ -1253,9 +1243,6 @@ SMESH_MeshEditor_i::smooth(const SMESH::long_array & IDsOfElements, << "SMESH.SMESH_MeshEditor." << ( Method == SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH ? "CENTROIDAL_SMOOTH )" : "LAPLACIAN_SMOOTH )"); -#ifdef _DEBUG_ - TPythonDump() << "print 'Smooth: ', isDone"; -#endif return true; } @@ -1284,9 +1271,6 @@ SMESH_MeshEditor_i::smoothObject(SMESH::SMESH_IDSource_ptr theObjec // Clear python line(s), created by Smooth() SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID()); -#ifdef _DEBUG_ - aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID()); -#endif // Update Python script TPythonDump() << "isDone = " << this << "." @@ -1296,9 +1280,6 @@ SMESH_MeshEditor_i::smoothObject(SMESH::SMESH_IDSource_ptr theObjec << "SMESH.SMESH_MeshEditor." << ( Method == SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH ? "CENTROIDAL_SMOOTH )" : "LAPLACIAN_SMOOTH )"); -#ifdef _DEBUG_ - TPythonDump() << "print 'SmoothObject: ', isDone"; -#endif return isDone; } @@ -3346,6 +3327,140 @@ SMESH_MeshEditor_i::RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject, return mesh._retn(); } + +//======================================================================= +//function : scale +//purpose : +//======================================================================= + +SMESH::ListOfGroups* +SMESH_MeshEditor_i::scale(const SMESH::long_array & theIDsOfElements, + const SMESH::PointStruct& thePoint, + const SMESH::double_array& theScaleFact, + CORBA::Boolean theCopy, + const bool theMakeGroups, + ::SMESH_Mesh* theTargetMesh) +{ + initData(); + + TIDSortedElemSet elements; + arrayToSet(theIDsOfElements, GetMeshDS(), elements); + + gp_Pnt aPnt( thePoint.x, thePoint.y, thePoint.z ); + list aScaleFact; + for (int i = 0; i < theScaleFact.length(); i++) { + aScaleFact.push_back( theScaleFact[i] ); + } + + ::SMESH_MeshEditor anEditor( myMesh ); + ::SMESH_MeshEditor::PGroupIDs groupIds = + anEditor.Scale (elements, aPnt, aScaleFact, theCopy, + theMakeGroups, theTargetMesh); + + if(theCopy) + storeResult(anEditor); + + return theMakeGroups ? getGroups(groupIds.get()) : 0; +} + + +//======================================================================= +//function : Scale +//purpose : +//======================================================================= + +void SMESH_MeshEditor_i::Scale(SMESH::SMESH_IDSource_ptr theObject, + const SMESH::PointStruct& thePoint, + const SMESH::double_array& theScaleFact, + CORBA::Boolean theCopy) +{ + if ( !myPreviewMode ) { + TPythonDump() << this << ".Scale( " + << theObject << ", " + << "SMESH.PointStruct( " << thePoint.x << ", " + << thePoint.y << ", " << thePoint.z << " ) ," + << theScaleFact << ", " + << theCopy << " )"; + } + SMESH::long_array_var anElementsId = theObject->GetIDs(); + scale(anElementsId, thePoint, theScaleFact, theCopy, false); +} + + +//======================================================================= +//function : ScaleMakeGroups +//purpose : +//======================================================================= + +SMESH::ListOfGroups* +SMESH_MeshEditor_i::ScaleMakeGroups(SMESH::SMESH_IDSource_ptr theObject, + const SMESH::PointStruct& thePoint, + const SMESH::double_array& theScaleFact) +{ + SMESH::long_array_var anElementsId = theObject->GetIDs(); + SMESH::ListOfGroups * aGroups = + scale(anElementsId, thePoint, theScaleFact, true, true); + + if ( !myPreviewMode ) { + + TPythonDump aPythonDump; + DumpGroupsList(aPythonDump,aGroups); + aPythonDump << this << ".Scale(" + << theObject << "," + << "SMESH.PointStruct(" <( mesh ); + + if ( mesh_i ) { + SMESH::long_array_var anElementsId = theObject->GetIDs(); + scale(anElementsId, thePoint, theScaleFact, + false, theCopyGroups, & mesh_i->GetImpl()); + mesh_i->CreateGroupServants(); + } + if ( !myPreviewMode ) { + pydump << mesh << " = " << this << ".ScaleMakeMesh( " + << theObject << ", " + << "SMESH.PointStruct( " << thePoint.x << ", " + << thePoint.y << ", " << thePoint.z << " ) ," + << theScaleFact << ", " + << theCopyGroups << ", '" + << theMeshName << "' )"; + } + } + + //dump "GetGroups" + if(!myPreviewMode && mesh_i) + mesh_i->GetGroups(); + + return mesh._retn(); +} + + //======================================================================= //function : FindCoincidentNodes //purpose : @@ -3731,6 +3846,24 @@ SMESH::long_array* SMESH_MeshEditor_i::FindElementsByPoint(CORBA::Double x, return res._retn(); } +//======================================================================= +//function : GetPointState +//purpose : Return point state in a closed 2D mesh in terms of TopAbs_State enumeration. +// TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails. +//======================================================================= + +CORBA::Short SMESH_MeshEditor_i::GetPointState(CORBA::Double x, + CORBA::Double y, + CORBA::Double z) +{ + theSearchersDeleter.Set( myMesh ); + if ( !theElementSearcher ) { + ::SMESH_MeshEditor anEditor( myMesh ); + theElementSearcher = anEditor.GetElementSearcher(); + } + return CORBA::Short( theElementSearcher->GetPointState( gp_Pnt( x,y,z ))); +} + //======================================================================= //function : convError //purpose : @@ -4017,9 +4150,6 @@ CORBA::Boolean SMESH_MeshEditor_i::ChangeElemNodes(CORBA::Long ide, } TPythonDump() << "isDone = " << this << ".ChangeElemNodes( " << ide << ", " << newIDs << " )"; -#ifdef _DEBUG_ - TPythonDump() << "print 'ChangeElemNodes: ', isDone"; -#endif return GetMeshDS()->ChangeElementNodes( elem, & aNodes[0], nbn1+1 ); } @@ -4573,7 +4703,7 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroups( storeResult( aMeshEditor) ; // Update Python script - TPythonDump() << "isDone = " << this << ".DoubleNodeGroups( " << &theElems << ", " + TPythonDump() << "isDone = " << this << ".DoubleNodeElemGroups( " << &theElems << ", " << &theNodesNot << ", " << &theAffectedElems << " )"; return aResult; } diff --git a/src/SMESH_I/SMESH_MeshEditor_i.hxx b/src/SMESH_I/SMESH_MeshEditor_i.hxx index 5c4dd85ca..046573b17 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.hxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_MeshEditor_i.hxx // Author : Nicolas REJNERI @@ -41,12 +42,18 @@ class SMESH_Mesh_i; class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor { - public: +public: SMESH_MeshEditor_i(SMESH_Mesh_i * theMesh, bool isPreview); virtual ~ SMESH_MeshEditor_i(); // --- CORBA + + /*! + * \brief Wrap a sequence of ids in a SMESH_IDSource + */ + SMESH::SMESH_IDSource_ptr MakeIDSource(const SMESH::long_array& IDsOfElements); + CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements); CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes); @@ -131,6 +138,8 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor CORBA::Boolean Diag13); CORBA::Long BestSplit (CORBA::Long IDOfQuad, SMESH::NumericalFunctor_ptr Criterion); + void SplitVolumesIntoTetra (SMESH::SMESH_IDSource_ptr elems, + CORBA::Short methodFlags) throw (SALOME::SALOME_Exception); CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements, const SMESH::long_array & IDsOfFixedNodes, @@ -420,6 +429,21 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor CORBA::Boolean CopyGroups, const char* MeshName); + void Scale(SMESH::SMESH_IDSource_ptr theObject, + const SMESH::PointStruct& thePoint, + const SMESH::double_array& theScaleFact, + CORBA::Boolean theCopy); + + SMESH::ListOfGroups* ScaleMakeGroups(SMESH::SMESH_IDSource_ptr theObject, + const SMESH::PointStruct& thePoint, + const SMESH::double_array& theScaleFact); + + SMESH::SMESH_Mesh_ptr ScaleMakeMesh(SMESH::SMESH_IDSource_ptr Object, + const SMESH::PointStruct& Point, + const SMESH::double_array& theScaleFact, + CORBA::Boolean CopyGroups, + const char* MeshName); + void FindCoincidentNodes (CORBA::Double Tolerance, SMESH::array_of_long_array_out GroupsOfNodes); void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object, @@ -442,7 +466,6 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor CORBA::Double z); /*! * Return elements of given type where the given point is IN or ON. - * * 'ALL' type means elements of any type excluding nodes */ SMESH::long_array* FindElementsByPoint(CORBA::Double x, @@ -450,6 +473,11 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor CORBA::Double z, SMESH::ElementType type); + /*! + * Return point state in a closed 2D mesh in terms of TopAbs_State enumeration. + * TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails. + */ + CORBA::Short GetPointState(CORBA::Double x, CORBA::Double y, CORBA::Double z); SMESH::SMESH_MeshEditor::Sew_Error SewFreeBorders(CORBA::Long FirstNodeID1, @@ -696,6 +724,13 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor const bool MakeGroups, ::SMESH_Mesh* TargetMesh=0); + SMESH::ListOfGroups* scale(const SMESH::long_array & theIDsOfElements, + const SMESH::PointStruct& thePoint, + const SMESH::double_array& theScaleFact, + CORBA::Boolean theCopy, + const bool theMakeGroups, + ::SMESH_Mesh* theTargetMesh=0); + SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName); void DumpGroupsList(SMESH::TPythonDump & theDumpPython, diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 3f5ccd718..9f0101a9a 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Mesh_i.cxx // Author : Paul RASCLE, EDF @@ -68,8 +69,11 @@ #include #include #include +#include +#include // STL Includes +#include #include #include #include @@ -312,7 +316,7 @@ SMESH_Mesh_i::ImportMEDFile( const char* theFileName, const char* theMeshName ) char* SMESH_Mesh_i::GetVersionString(SMESH::MED_VERSION version, CORBA::Short nbDigits) { - std::string ver = DriverMED_W_SMESHDS_Mesh::GetVersionString(MED::EVersion(version), + string ver = DriverMED_W_SMESHDS_Mesh::GetVersionString(MED::EVersion(version), nbDigits); return CORBA::string_dup( ver.c_str() ); } @@ -1861,7 +1865,6 @@ void SMESH_Mesh_i::CheckGeomGroupModif() //============================================================================= /*! * \brief Create standalone group instead if group on geometry - * */ //============================================================================= @@ -1918,8 +1921,8 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::ConvertToStandalone( SMESH::SMESH_GroupOnGe _mapGroups[anId] = SMESH::SMESH_GroupBase::_duplicate( aGroup ); // register CORBA object for persistence - //int nextId = _gen_i->RegisterObject( aGroup ); - //if(MYDEBUG) MESSAGE( "Add group to map with id = "<< nextId); + /*int nextId =*/ _gen_i->RegisterObject( aGroup ); + builder->SetIOR( aGroupSO, _gen_i->GetORB()->object_to_string( aGroup ) ); return aGroup._retn(); @@ -2264,7 +2267,7 @@ CORBA::Boolean SMESH_Mesh_i::HasDuplicatedGroupNamesMED() return _impl->HasDuplicatedGroupNamesMED(); } -void SMESH_Mesh_i::PrepareForWriting (const char* file) +void SMESH_Mesh_i::PrepareForWriting (const char* file, bool overwrite) { TCollection_AsciiString aFullName ((char*)file); OSD_Path aPath (aFullName); @@ -2273,8 +2276,10 @@ void SMESH_Mesh_i::PrepareForWriting (const char* file) // existing filesystem node if (aFile.KindOfFile() == OSD_FILE) { if (aFile.IsWriteable()) { - aFile.Reset(); - aFile.Remove(); + if (overwrite) { + aFile.Reset(); + aFile.Remove(); + } if (aFile.Failed()) { TCollection_AsciiString msg ("File "); msg += aFullName + " cannot be replaced."; @@ -2305,15 +2310,16 @@ void SMESH_Mesh_i::PrepareForWriting (const char* file) } } -void SMESH_Mesh_i::ExportToMED (const char* file, - CORBA::Boolean auto_groups, - SMESH::MED_VERSION theVersion) +void SMESH_Mesh_i::ExportToMEDX (const char* file, + CORBA::Boolean auto_groups, + SMESH::MED_VERSION theVersion, + CORBA::Boolean overwrite) throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); // Perform Export - PrepareForWriting(file); + PrepareForWriting(file, overwrite); const char* aMeshName = "Mesh"; SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy(); if ( !aStudy->_is_nil() ) { @@ -2345,17 +2351,25 @@ void SMESH_Mesh_i::ExportToMED (const char* file, // check names of groups checkGroupNames(); - TPythonDump() << _this() << ".ExportToMED( '" - << file << "', " << auto_groups << ", " << theVersion << " )"; + TPythonDump() << _this() << ".ExportToMEDX( '" + << file << "', " << auto_groups << ", " << theVersion << ", " << overwrite << " )"; _impl->ExportMED( file, aMeshName, auto_groups, theVersion ); } +void SMESH_Mesh_i::ExportToMED (const char* file, + CORBA::Boolean auto_groups, + SMESH::MED_VERSION theVersion) + throw(SALOME::SALOME_Exception) +{ + ExportToMEDX(file,auto_groups,theVersion,true); +} + void SMESH_Mesh_i::ExportMED (const char* file, CORBA::Boolean auto_groups) throw(SALOME::SALOME_Exception) { - ExportToMED(file,auto_groups,SMESH::MED_V2_1); + ExportToMEDX(file,auto_groups,SMESH::MED_V2_1,true); } void SMESH_Mesh_i::ExportDAT (const char *file) @@ -2612,7 +2626,7 @@ CORBA::Long SMESH_Mesh_i::NbSubMesh()throw(SALOME::SALOME_Exception) //============================================================================= char* SMESH_Mesh_i::Dump() { - std::ostringstream os; + ostringstream os; _impl->Dump( os ); return CORBA::string_dup( os.str().c_str() ); } @@ -2745,6 +2759,21 @@ SMESH::ElementType SMESH_Mesh_i::GetElementType( const CORBA::Long id, const boo return ( SMESH::ElementType )_impl->GetElementType( id, iselem ); } +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::EntityType SMESH_Mesh_i::GetElementGeomType( const CORBA::Long id ) + throw (SALOME::SALOME_Exception) +{ + const SMDS_MeshElement* e = _impl->GetMeshDS()->FindElement(id); + if ( !e ) + THROW_SALOME_CORBA_EXCEPTION( "invalid element id", SALOME::BAD_PARAM ); + + return ( SMESH::EntityType ) e->GetEntityType(); +} //============================================================================= /*! @@ -3170,6 +3199,57 @@ CORBA::Long SMESH_Mesh_i::ElemNbFaces(const CORBA::Long id) return elem->NbFaces(); } +//======================================================================= +//function : GetElemFaceNodes +//purpose : Returns nodes of given face (counted from zero) for given element. +//======================================================================= + +SMESH::long_array* SMESH_Mesh_i::GetElemFaceNodes(CORBA::Long elemId, + CORBA::Short faceIndex) +{ + SMESH::long_array_var aResult = new SMESH::long_array(); + if ( SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS() ) + { + if ( const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(elemId) ) + { + SMDS_VolumeTool vtool( elem ); + if ( faceIndex < vtool.NbFaces() ) + { + aResult->length( vtool.NbFaceNodes( faceIndex )); + const SMDS_MeshNode** nn = vtool.GetFaceNodes( faceIndex ); + for ( int i = 0; i < aResult->length(); ++i ) + aResult[ i ] = nn[ i ]->GetID(); + } + } + } + return aResult._retn(); +} + +//======================================================================= +//function : FindElementByNodes +//purpose : Returns an element based on all given nodes. +//======================================================================= + +CORBA::Long SMESH_Mesh_i::FindElementByNodes(const SMESH::long_array& nodes) +{ + CORBA::Long elemID(0); + if ( SMESHDS_Mesh* mesh = _impl->GetMeshDS() ) + { + vector< const SMDS_MeshNode * > nn( nodes.length() ); + for ( int i = 0; i < nodes.length(); ++i ) + if ( !( nn[i] = mesh->FindNode( nodes[i] ))) + return elemID; + + const SMDS_MeshElement* elem = mesh->FindElement( nn ); + if ( !elem && ( _impl->NbEdges( ORDER_QUADRATIC ) || + _impl->NbFaces( ORDER_QUADRATIC ) || + _impl->NbVolumes( ORDER_QUADRATIC ))) + elem = mesh->FindElement( nn, SMDSAbs_All, /*noMedium=*/true ); + + if ( elem ) elemID = CORBA::Long( elem->GetID() ); + } + return elemID; +} //============================================================================= /*! @@ -3461,3 +3541,441 @@ void SMESH_Mesh_i::CollectMeshInfo(const SMDS_ElemIteratorPtr theItr, while (theItr->more()) theInfo[ theItr->next()->GetEntityType() ]++; } + +//============================================================================= +/*! + * \brief mapping of mesh dimension into shape type + */ +//============================================================================= +static TopAbs_ShapeEnum shapeTypeByDim(const int theDim) +{ + TopAbs_ShapeEnum aType = TopAbs_SOLID; + switch ( theDim ) { + case 0: aType = TopAbs_VERTEX; break; + case 1: aType = TopAbs_EDGE; break; + case 2: aType = TopAbs_FACE; break; + case 3: + default:aType = TopAbs_SOLID; break; + } + return aType; +} + +//============================================================================= +/*! + * \brief Internal structure used to find concurent submeshes + * + * It represents a pair < submesh, concurent dimension >, where + * 'concurrent dimension' is dimension of shape where the submesh can concurent + * with another submesh. In other words, it is dimension of a hypothesis assigned + * to submesh. + */ +//============================================================================= + +class SMESH_DimHyp +{ + public: + //! fileds + int _dim; //!< a dimension the algo can build (concurrent dimension) + int _ownDim; //!< dimension of shape of _subMesh (>=_dim) + TopTools_MapOfShape _shapeMap; + SMESH_subMesh* _subMesh; + list _hypothesises; //!< algo is first, then its parameters + + //! Constructors + SMESH_DimHyp(const SMESH_subMesh* theSubMesh, + const int theDim, + const TopoDS_Shape& theShape) + { + _subMesh = (SMESH_subMesh*)theSubMesh; + SetShape( theDim, theShape ); + } + + //! set shape + void SetShape(const int theDim, + const TopoDS_Shape& theShape) + { + _dim = theDim; + _ownDim = (int)SMESH_Gen::GetShapeDim(theShape); + if (_dim >= _ownDim) + _shapeMap.Add( theShape ); + else { + TopExp_Explorer anExp( theShape, shapeTypeByDim(theDim) ); + for( ; anExp.More(); anExp.Next() ) + _shapeMap.Add( anExp.Current() ); + } + } + + //! Check sharing of sub shapes + static bool isShareSubShapes(const TopTools_MapOfShape& theToCheck, + const TopTools_MapOfShape& theToFind, + const TopAbs_ShapeEnum theType) + { + bool isShared = false; + TopTools_MapIteratorOfMapOfShape anItr( theToCheck ); + for (; !isShared && anItr.More(); anItr.Next() ) { + const TopoDS_Shape aSubSh = anItr.Key(); + // check for case when concurrent dimensions are same + isShared = theToFind.Contains( aSubSh ); + // check for subshape with concurrent dimension + TopExp_Explorer anExp( aSubSh, theType ); + for ( ; !isShared && anExp.More(); anExp.Next() ) + isShared = theToFind.Contains( anExp.Current() ); + } + return isShared; + } + + //! check algorithms + static bool checkAlgo(const SMESHDS_Hypothesis* theA1, + const SMESHDS_Hypothesis* theA2) + { + if ( theA1->GetType() == SMESHDS_Hypothesis::PARAM_ALGO || + theA2->GetType() == SMESHDS_Hypothesis::PARAM_ALGO ) + return false; // one of the hypothesis is not algorithm + // check algorithm names (should be equal) + return strcmp( theA1->GetName(), theA2->GetName() ) == 0; + } + + + //! Check if subshape hypotheses are concurrent + bool IsConcurrent(const SMESH_DimHyp* theOther) const + { + if ( _subMesh == theOther->_subMesh ) + return false; // same subshape - should not be + + // if ( == && + // any of the two submeshes is not on COMPOUND shape ) + // -> no concurrency + bool meIsCompound = (_subMesh->GetSubMeshDS() && _subMesh->GetSubMeshDS()->IsComplexSubmesh()); + bool otherIsCompound = (theOther->_subMesh->GetSubMeshDS() && theOther->_subMesh->GetSubMeshDS()->IsComplexSubmesh()); + if ( (_ownDim == _dim || theOther->_ownDim == _dim ) && (!meIsCompound || !otherIsCompound)) + return false; + +// bool checkSubShape = ( _dim >= theOther->_dim ) +// ? isShareSubShapes( _shapeMap, theOther->_shapeMap, shapeTypeByDim(theOther->_dim) ) +// : isShareSubShapes( theOther->_shapeMap, _shapeMap, shapeTypeByDim(_dim) ) ; + bool checkSubShape = isShareSubShapes( _shapeMap, theOther->_shapeMap, shapeTypeByDim(_dim)); + if ( !checkSubShape ) + return false; + + // check algorithms to be same + if (!checkAlgo( _hypothesises.front(), theOther->_hypothesises.front() )) + return true; // different algorithms + + // check hypothesises for concurrence (skip first as algorithm) + int nbSame = 0; + // pointers should be same, becase it is referenes from mesh hypothesis partition + list ::const_iterator hypIt = _hypothesises.begin(); + list ::const_iterator otheEndIt = theOther->_hypothesises.end(); + for ( hypIt++ /*skip first as algo*/; hypIt != _hypothesises.end(); hypIt++ ) + if ( find( theOther->_hypothesises.begin(), otheEndIt, *hypIt ) != otheEndIt ) + nbSame++; + // the submeshes are concurrent if their algorithms has different parameters + return nbSame != theOther->_hypothesises.size() - 1; + } + +}; // end of SMESH_DimHyp + +typedef list TDimHypList; + +static void addDimHypInstance(const int theDim, + const TopoDS_Shape& theShape, + const SMESH_Algo* theAlgo, + const SMESH_subMesh* theSubMesh, + const list & theHypList, + TDimHypList* theDimHypListArr ) +{ + TDimHypList& listOfdimHyp = theDimHypListArr[theDim]; + if ( listOfdimHyp.empty() || listOfdimHyp.back()->_subMesh != theSubMesh ) { + SMESH_DimHyp* dimHyp = new SMESH_DimHyp( theSubMesh, theDim, theShape ); + listOfdimHyp.push_back( dimHyp ); + } + + SMESH_DimHyp* dimHyp = listOfdimHyp.back(); + dimHyp->_hypothesises.push_front(theAlgo); + list ::const_iterator hypIt = theHypList.begin(); + for( ; hypIt != theHypList.end(); hypIt++ ) + dimHyp->_hypothesises.push_back( *hypIt ); +} + +static void findConcurrents(const SMESH_DimHyp* theDimHyp, + const TDimHypList& theListOfDimHyp, + TListOfInt& theListOfConcurr ) +{ + TDimHypList::const_reverse_iterator rIt = theListOfDimHyp.rbegin(); + for ( ; rIt != theListOfDimHyp.rend(); rIt++ ) { + const SMESH_DimHyp* curDimHyp = *rIt; + if ( curDimHyp == theDimHyp ) + break; // meet own dimHyp pointer in same dimension + else if ( theDimHyp->IsConcurrent( curDimHyp ) ) + if ( find( theListOfConcurr.begin(), + theListOfConcurr.end(), + curDimHyp->_subMesh->GetId() ) == theListOfConcurr.end() ) + theListOfConcurr.push_back( curDimHyp->_subMesh->GetId() ); + } +} + +static void unionLists(TListOfInt& theListOfId, + TListOfListOfInt& theListOfListOfId, + const int theIndx ) +{ + TListOfListOfInt::iterator it = theListOfListOfId.begin(); + for ( int i = 0; it != theListOfListOfId.end(); it++, i++ ) { + if ( i < theIndx ) + continue; //skip already treated lists + // check if other list has any same submesh object + TListOfInt& otherListOfId = *it; + if ( find_first_of( theListOfId.begin(), theListOfId.end(), + otherListOfId.begin(), otherListOfId.end() ) == theListOfId.end() ) + continue; + + // union two lists (from source into target) + TListOfInt::iterator it2 = otherListOfId.begin(); + for ( ; it2 != otherListOfId.end(); it2++ ) { + if ( find( theListOfId.begin(), theListOfId.end(), (*it2) ) == theListOfId.end() ) + theListOfId.push_back(*it2); + } + // clear source list + otherListOfId.clear(); + } +} + +//! free memory allocated for dimension-hypothesis objects +static void removeDimHyps( TDimHypList* theArrOfList ) +{ + for (int i = 0; i < 4; i++ ) { + TDimHypList& listOfdimHyp = theArrOfList[i]; + TDimHypList::const_iterator it = listOfdimHyp.begin(); + for ( ; it != listOfdimHyp.end(); it++ ) + delete (*it); + } +} + +//============================================================================= +/*! + * \brief Return submesh objects list in meshing order + */ +//============================================================================= + +SMESH::submesh_array_array* SMESH_Mesh_i::GetMeshOrder() +{ + SMESH::submesh_array_array_var aResult = new SMESH::submesh_array_array(); + + SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS(); + if ( !aMeshDS ) + return aResult._retn(); + + ::SMESH_Mesh& mesh = GetImpl(); + TListOfListOfInt anOrder = mesh.GetMeshOrder(); // is there already defined order? + if ( !anOrder.size() ) { + + // collect submeshes detecting concurrent algorithms and hypothesises + TDimHypList dimHypListArr[4]; // dimHyp list for each shape dimension + + map::iterator i_sm = _mapSubMesh.begin(); + for ( ; i_sm != _mapSubMesh.end(); i_sm++ ) { + ::SMESH_subMesh* sm = (*i_sm).second; + // shape of submesh + const TopoDS_Shape& aSubMeshShape = sm->GetSubShape(); + + // list of assigned hypothesises + const list & hypList = mesh.GetHypothesisList(aSubMeshShape); + // Find out dimensions where the submesh can be concurrent. + // We define the dimensions by algo of each of hypotheses in hypList + list ::const_iterator hypIt = hypList.begin(); + for( ; hypIt != hypList.end(); hypIt++ ) { + SMESH_Algo* anAlgo = 0; + const SMESH_Hypothesis* hyp = dynamic_cast(*hypIt); + if ( hyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO ) + // hyp it-self is algo + anAlgo = (SMESH_Algo*)dynamic_cast(hyp); + else { + // try to find algorithm with help of subshapes + TopExp_Explorer anExp( aSubMeshShape, shapeTypeByDim(hyp->GetDim()) ); + for ( ; !anAlgo && anExp.More(); anExp.Next() ) + anAlgo = mesh.GetGen()->GetAlgo( mesh, anExp.Current() ); + } + if (!anAlgo) + continue; // no assigned algorithm to current submesh + + int dim = anAlgo->GetDim(); // top concurrent dimension (see comment to SMESH_DimHyp) + // the submesh can concurrent at (or lower dims if !anAlgo->NeedDescretBoundary()) + + // create instance of dimension-hypothesis for found concurrent dimension(s) and algorithm + for ( int j = anAlgo->NeedDescretBoundary() ? dim : 1, jn = dim; j <= jn; j++ ) + addDimHypInstance( j, aSubMeshShape, anAlgo, sm, hypList, dimHypListArr ); + } + } // end iterations on submesh + + // iterate on created dimension-hypotheses and check for concurrents + for ( int i = 0; i < 4; i++ ) { + const list& listOfDimHyp = dimHypListArr[i]; + // check for concurrents in own and other dimensions (step-by-step) + TDimHypList::const_iterator dhIt = listOfDimHyp.begin(); + for ( ; dhIt != listOfDimHyp.end(); dhIt++ ) { + const SMESH_DimHyp* dimHyp = *dhIt; + TListOfInt listOfConcurr; + // looking for concurrents and collect into own list + for ( int j = i; j < 4; j++ ) + findConcurrents( dimHyp, dimHypListArr[j], listOfConcurr ); + // check if any concurrents found + if ( listOfConcurr.size() > 0 ) { + // add own submesh to list of concurrent + listOfConcurr.push_front( dimHyp->_subMesh->GetId() ); + anOrder.push_back( listOfConcurr ); + } + } + } + + removeDimHyps(dimHypListArr); + + // now, minimise the number of concurrent groups + // Here we assume that lists of submhes can has same submesh + // in case of multi-dimension algorithms, as result + // list with common submesh have to be union into one list + int listIndx = 0; + TListOfListOfInt::iterator listIt = anOrder.begin(); + for(; listIt != anOrder.end(); listIt++, listIndx++ ) + unionLists( *listIt, anOrder, listIndx + 1 ); + } + // convert submesh ids into interface instances + // and dump command into python + convertMeshOrder( anOrder, aResult, true ); + + return aResult._retn(); +} + +//============================================================================= +/*! + * \brief find common submeshes with given submesh + * \param theSubMeshList list of already collected submesh to check + * \param theSubMesh given submesh to intersect with other + * \param theCommonSubMeshes collected common submeshes + */ +//============================================================================= + +static void findCommonSubMesh + (list& theSubMeshList, + const SMESH_subMesh* theSubMesh, + set& theCommon ) +{ + if ( !theSubMesh ) + return; + list::const_iterator it = theSubMeshList.begin(); + for ( ; it != theSubMeshList.end(); it++ ) + theSubMesh->FindIntersection( *it, theCommon ); + theSubMeshList.push_back( theSubMesh ); + //theCommon.insert( theSubMesh ); +} + +//============================================================================= +/*! + * \brief Set submesh object order + * \param theSubMeshArray submesh array order + */ +//============================================================================= + +::CORBA::Boolean SMESH_Mesh_i::SetMeshOrder(const SMESH::submesh_array_array& theSubMeshArray) +{ + bool res = false; + ::SMESH_Mesh& mesh = GetImpl(); + + TPythonDump aPythonDump; // prevent dump of called methods + aPythonDump << "isDone = " << _this() << ".SetMeshOrder( [ "; + + TListOfListOfInt subMeshOrder; + for ( int i = 0, n = theSubMeshArray.length(); i < n; i++ ) + { + const SMESH::submesh_array& aSMArray = theSubMeshArray[i]; + TListOfInt subMeshIds; + aPythonDump << "[ "; + // Collect subMeshes which should be clear + // do it list-by-list, because modification of submesh order + // take effect between concurrent submeshes only + set subMeshToClear; + list subMeshList; + for ( int j = 0, jn = aSMArray.length(); j < jn; j++ ) + { + const SMESH::SMESH_subMesh_var subMesh = SMESH::SMESH_subMesh::_duplicate(aSMArray[j]); + if ( j > 0 ) + aPythonDump << ", "; + aPythonDump << subMesh; + subMeshIds.push_back( subMesh->GetId() ); + // detect common parts of submeshes + if ( _mapSubMesh.find(subMesh->GetId()) != _mapSubMesh.end() ) + findCommonSubMesh( subMeshList, _mapSubMesh[ subMesh->GetId() ], subMeshToClear ); + } + aPythonDump << " ]"; + subMeshOrder.push_back( subMeshIds ); + + // clear collected submeshes + set::iterator clrIt = subMeshToClear.begin(); + for ( ; clrIt != subMeshToClear.end(); clrIt++ ) { + SMESH_subMesh* sm = (SMESH_subMesh*)*clrIt; + if ( sm ) + sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); + // ClearSubMesh( *clrIt ); + } + } + aPythonDump << " ])"; + + mesh.SetMeshOrder( subMeshOrder ); + res = true; + + return res; +} + +//============================================================================= +/*! + * \brief Convert submesh ids into submesh interfaces + */ +//============================================================================= + +void SMESH_Mesh_i::convertMeshOrder +(const TListOfListOfInt& theIdsOrder, + SMESH::submesh_array_array& theResOrder, + const bool theIsDump) +{ + int nbSet = theIdsOrder.size(); + TPythonDump aPythonDump; // prevent dump of called methods + if ( theIsDump ) + aPythonDump << "[ "; + theResOrder.length(nbSet); + TListOfListOfInt::const_iterator it = theIdsOrder.begin(); + int listIndx = 0; + for( ; it != theIdsOrder.end(); it++ ) { + // translate submesh identificators into submesh objects + // takeing into account real number of concurrent lists + const TListOfInt& aSubOrder = (*it); + if (!aSubOrder.size()) + continue; + if ( theIsDump ) + aPythonDump << "[ "; + // convert shape indeces into interfaces + SMESH::submesh_array_var aResSubSet = new SMESH::submesh_array(); + aResSubSet->length(aSubOrder.size()); + TListOfInt::const_iterator subIt = aSubOrder.begin(); + for( int j = 0; subIt != aSubOrder.end(); subIt++ ) { + if ( _mapSubMeshIor.find(*subIt) == _mapSubMeshIor.end() ) + continue; + SMESH::SMESH_subMesh_var subMesh = + SMESH::SMESH_subMesh::_duplicate( _mapSubMeshIor[*subIt] ); + if ( theIsDump ) { + if ( j > 0 ) + aPythonDump << ", "; + aPythonDump << subMesh; + } + aResSubSet[ j++ ] = subMesh; + } + if ( theIsDump ) + aPythonDump << " ]"; + theResOrder[ listIndx++ ] = aResSubSet; + } + // correct number of lists + theResOrder.length( listIndx ); + + if ( theIsDump ) { + // finilise python dump + aPythonDump << " ]"; + aPythonDump << " = " << _this() << ".GetMeshOrder()"; + } +} diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index e8598de34..bed9819da 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Mesh_i.hxx // Author : Paul RASCLE, EDF @@ -58,7 +59,7 @@ class SMESH_I_EXPORT SMESH_Mesh_i: public: SMESH_Mesh_i( PortableServer::POA_ptr thePOA, SMESH_Gen_i* myGen_i, - CORBA::Long studyId ); + CORBA::Long studyId ); virtual ~SMESH_Mesh_i(); @@ -206,6 +207,8 @@ public: */ char* GetVersionString(SMESH::MED_VERSION version, CORBA::Short nbDigits); + void ExportToMEDX( const char* file, CORBA::Boolean auto_groups, SMESH::MED_VERSION theVersion, CORBA::Boolean overwrite ) + 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 ) @@ -305,6 +308,9 @@ public: SMESH::ElementType GetElementType( CORBA::Long id, bool iselem ) throw (SALOME::SALOME_Exception); + SMESH::EntityType GetElementGeomType( CORBA::Long id ) + throw (SALOME::SALOME_Exception); + /*! * Returns ID of elements for given submesh */ @@ -338,7 +344,7 @@ public: static SMESH::Hypothesis_Status ConvertHypothesisStatus (SMESH_Hypothesis::Hypothesis_Status theStatus); - static void PrepareForWriting (const char* file); + static void PrepareForWriting (const char* file, bool overwrite = true); //int importMEDFile( const char* theFileName, const char* theMeshName ); @@ -450,7 +456,16 @@ public: * Returns number of faces for given element */ CORBA::Long ElemNbFaces(CORBA::Long id); - + /*! + * Returns nodes of given face (counted from zero) for given element. + */ + SMESH::long_array* GetElemFaceNodes(CORBA::Long elemId, CORBA::Short faceIndex); + + /*! + * Returns an element based on all given nodes. + */ + CORBA::Long FindElementByNodes(const SMESH::long_array& nodes); + /*! * Returns true if given element is polygon */ @@ -500,6 +515,16 @@ public: static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr, SMESH::long_array& theInfo); + + /*! + * \brief Return submesh objects list in meshing order + */ + virtual SMESH::submesh_array_array* GetMeshOrder(); + /*! + * \brief Set submesh object order + */ + virtual ::CORBA::Boolean SetMeshOrder(const SMESH::submesh_array_array& theSubMeshArray); + std::map _mapSubMesh_i; //NRI std::map _mapSubMesh; //NRI @@ -510,6 +535,13 @@ private: */ void checkGroupNames(); + /*! + * Convert submesh ids into submesh interfaces + */ + void convertMeshOrder(const TListOfListOfInt& theIdsOrder, + SMESH::submesh_array_array& theSubMeshOrder, + const bool theIsDump); + private: static int myIdGenerator; diff --git a/src/SMESH_I/SMESH_NoteBook.cxx b/src/SMESH_I/SMESH_NoteBook.cxx index 2345a4279..df42dd4f9 100644 --- a/src/SMESH_I/SMESH_NoteBook.cxx +++ b/src/SMESH_I/SMESH_NoteBook.cxx @@ -1,25 +1,25 @@ -// Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is 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. +// 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 +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_NoteBook.cxx // Author : Roman NIKOLAEV - +// #include "SMESH_2smeshpy.hxx" #include "SMESH_NoteBook.hxx" #include "SMESH_Gen_i.hxx" @@ -41,14 +41,14 @@ static int MYDEBUG = 0; using namespace std; -void SetVariable(Handle(_pyCommand) theCommand,const ObjectStates* theStates, int position, int theArgNb); +void SetVariable(Handle(_pyCommand) theCommand,const SMESH_ObjectStates* theStates, int position, int theArgNb); //================================================================================ /*! * \brief Constructor */ //================================================================================ -ObjectStates::ObjectStates(TCollection_AsciiString theType) +SMESH_ObjectStates::SMESH_ObjectStates(TCollection_AsciiString theType) { _type = theType; _dumpstate = 0; @@ -59,7 +59,7 @@ ObjectStates::ObjectStates(TCollection_AsciiString theType) * \brief Destructor */ //================================================================================ -ObjectStates::~ObjectStates() +SMESH_ObjectStates::~SMESH_ObjectStates() { } @@ -69,7 +69,7 @@ ObjectStates::~ObjectStates() * \param theState - Object state (vector of notebook variable) */ //================================================================================ -void ObjectStates::AddState(const TState &theState) +void SMESH_ObjectStates::AddState(const TState &theState) { _states.push_back(theState); } @@ -80,7 +80,7 @@ void ObjectStates::AddState(const TState &theState) * \\retval state - Object state (vector of notebook variable) */ //================================================================================ -TState ObjectStates::GetCurrectState() const +TState SMESH_ObjectStates::GetCurrectState() const { if(_states.size() > _dumpstate) return _states[_dumpstate]; @@ -94,7 +94,7 @@ TState ObjectStates::GetCurrectState() const * */ //================================================================================ -TAllStates ObjectStates::GetAllStates() const +TAllStates SMESH_ObjectStates::GetAllStates() const { return _states; } @@ -104,7 +104,7 @@ TAllStates ObjectStates::GetAllStates() const * */ //================================================================================ -void ObjectStates::IncrementState() +void SMESH_ObjectStates::IncrementState() { _dumpstate++; } @@ -114,7 +114,7 @@ void ObjectStates::IncrementState() * */ //================================================================================ -TCollection_AsciiString ObjectStates::GetObjectType() const{ +TCollection_AsciiString SMESH_ObjectStates::GetObjectType() const{ return _type; } @@ -125,7 +125,7 @@ TCollection_AsciiString ObjectStates::GetObjectType() const{ */ //================================================================================ LayerDistributionStates::LayerDistributionStates(): - ObjectStates("LayerDistribution") + SMESH_ObjectStates("LayerDistribution") { } //================================================================================ @@ -252,7 +252,7 @@ void SMESH_NoteBook::ReplaceVariables() if(it != _objectMap.end()) { if(MYDEBUG) cout << "Found object : " << (*it).first << endl; - ObjectStates *aStates = (*it).second; + SMESH_ObjectStates *aStates = (*it).second; // Case for LocalLength hypothesis if(aStates->GetObjectType().IsEqual("LocalLength") && aStates->GetCurrectState().size() >= 2) { if(aMethod.IsEqual("SetLength")) { @@ -674,12 +674,12 @@ void SMESH_NoteBook::InitObjectMap() } if(MYDEBUG) cout<<"The object Type : "<length(); i++) { TState aVars; @@ -697,7 +697,7 @@ void SMESH_NoteBook::InitObjectMap() } aState->AddState(aVars); } - _objectMap.insert(pair(TCollection_AsciiString(aSObject->GetID()),aState)); + _objectMap.insert(pair(TCollection_AsciiString(aSObject->GetID()),aState)); } } } @@ -850,10 +850,10 @@ bool SMESH_NoteBook::GetReal(const TCollection_AsciiString& theVarName, double& /*! - * Set variable of the ObjectStates from position to the _pyCommand + * Set variable of the SMESH_ObjectStates from position to the _pyCommand * method as nbArg argument */ -void SetVariable(Handle(_pyCommand) theCommand, const ObjectStates* theStates, int position, int theArgNb) +void SetVariable(Handle(_pyCommand) theCommand, const SMESH_ObjectStates* theStates, int position, int theArgNb) { if(theStates->GetCurrectState().size() > position) if(!theStates->GetCurrectState().at(position).IsEmpty()) diff --git a/src/SMESH_I/SMESH_NoteBook.hxx b/src/SMESH_I/SMESH_NoteBook.hxx index dfeb3b50a..94e348ecd 100644 --- a/src/SMESH_I/SMESH_NoteBook.hxx +++ b/src/SMESH_I/SMESH_NoteBook.hxx @@ -1,26 +1,25 @@ -// Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is 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. +// 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 +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_NoteBook.hxx // Author : Roman NIKOLAEV () - - +// #ifndef SMESH_NoteBook_HeaderFile #define SMESH_NoteBook_HeaderFile @@ -36,12 +35,12 @@ typedef std::vector TState; typedef std::vector TAllStates; typedef TCollection_AsciiString _pyID; -class ObjectStates{ +class SMESH_ObjectStates{ public: - ObjectStates(TCollection_AsciiString theType); - virtual ~ObjectStates(); + SMESH_ObjectStates(TCollection_AsciiString theType); + virtual ~SMESH_ObjectStates(); void AddState(const TState &theState); @@ -58,7 +57,7 @@ private: int _dumpstate; }; -class LayerDistributionStates : public ObjectStates +class LayerDistributionStates : public SMESH_ObjectStates { public: typedef std::map TDistributionMap; @@ -81,7 +80,7 @@ private: class SMESH_NoteBook { public: - typedef std::map TVariablesMap; + typedef std::map TVariablesMap; typedef std::map TMeshEditorMap; SMESH_NoteBook(); ~SMESH_NoteBook(); diff --git a/src/SMESH_I/SMESH_Pattern_i.cxx b/src/SMESH_I/SMESH_Pattern_i.cxx index f3f1fcfbc..3d725b8fb 100644 --- a/src/SMESH_I/SMESH_Pattern_i.cxx +++ b/src/SMESH_I/SMESH_Pattern_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Pattern_i.cxx // Created : Fri Aug 20 16:15:49 2004 diff --git a/src/SMESH_I/SMESH_Pattern_i.hxx b/src/SMESH_I/SMESH_Pattern_i.hxx index 8526ef9ad..5d5003ab8 100644 --- a/src/SMESH_I/SMESH_Pattern_i.hxx +++ b/src/SMESH_I/SMESH_Pattern_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Pattern_i.hxx // Created : Fri Aug 20 16:03:15 2004 diff --git a/src/SMESH_I/SMESH_PythonDump.hxx b/src/SMESH_I/SMESH_PythonDump.hxx index 10d6dd85c..afcd15ddb 100644 --- a/src/SMESH_I/SMESH_PythonDump.hxx +++ b/src/SMESH_I/SMESH_PythonDump.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _SMESH_PYTHONDUMP_HXX_ #define _SMESH_PYTHONDUMP_HXX_ @@ -117,6 +118,12 @@ namespace SMESH TPythonDump& operator<<(const SMESH::double_array& theArg); + TPythonDump& + operator<<(SMESH::SMESH_Hypothesis_ptr theArg); + + TPythonDump& + operator<<(SMESH::SMESH_IDSource_ptr theArg); + TPythonDump& operator<<(SALOMEDS::SObject_ptr theArg); diff --git a/src/SMESH_I/SMESH_subMesh_i.cxx b/src/SMESH_I/SMESH_subMesh_i.cxx index 2720de2c7..301f1a972 100644 --- a/src/SMESH_I/SMESH_subMesh_i.cxx +++ b/src/SMESH_I/SMESH_subMesh_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_subMesh_i.cxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/SMESH_subMesh_i.hxx b/src/SMESH_I/SMESH_subMesh_i.hxx index 5a6eb8bd8..bd53171ae 100644 --- a/src/SMESH_I/SMESH_subMesh_i.hxx +++ b/src/SMESH_I/SMESH_subMesh_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_subMesh_i.hxx // Author : Paul RASCLE, EDF diff --git a/src/SMESH_I/smeshpy.py b/src/SMESH_I/smeshpy.py index 5b820f22f..48a483688 100644 --- a/src/SMESH_I/smeshpy.py +++ b/src/SMESH_I/smeshpy.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses # File : smeshpy.py # Module : SMESH diff --git a/src/SMESH_SWIG/Makefile.am b/src/SMESH_SWIG/Makefile.am index 7b6ef9fe4..5a616b918 100644 --- a/src/SMESH_SWIG/Makefile.am +++ b/src/SMESH_SWIG/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.in # Author : Nicolas REJNERI, Paul RASCLE # Modified by : Alexander BORODIN (OCN) - autotools usage diff --git a/src/SMESH_SWIG/PAL_MESH_041_mesh.py b/src/SMESH_SWIG/PAL_MESH_041_mesh.py index 523429d2b..db62e40ce 100755 --- a/src/SMESH_SWIG/PAL_MESH_041_mesh.py +++ b/src/SMESH_SWIG/PAL_MESH_041_mesh.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + import salome import geompy import smesh @@ -54,7 +55,7 @@ Id_face1 = geompy.addToStudy(face1,"Face1") #-----------------------------SMESH------------------------------------------- - +smesh.SetCurrentStudy(salome.myStudy) # -- Init mesh -- plane_mesh = salome.IDToObject( Id_face1) diff --git a/src/SMESH_SWIG/PAL_MESH_043_2D.py b/src/SMESH_SWIG/PAL_MESH_043_2D.py index 35bd54cda..bdf8ba02e 100755 --- a/src/SMESH_SWIG/PAL_MESH_043_2D.py +++ b/src/SMESH_SWIG/PAL_MESH_043_2D.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_testExtrusion2D.py # Module : SMESH # Description : Create meshes to test extrusion of mesh elements along path @@ -52,6 +53,7 @@ id_ellipse2 = geompy.addToStudy(ellipse2, "Ellips 2") #---------------------------------SMESH +smesh.SetCurrentStudy(salome.myStudy) # create the path mesh mesh1 = smesh.Mesh(ellipse1, "Path Mesh") diff --git a/src/SMESH_SWIG/PAL_MESH_043_3D.py b/src/SMESH_SWIG/PAL_MESH_043_3D.py index bc4e115f0..156a86dc9 100755 --- a/src/SMESH_SWIG/PAL_MESH_043_3D.py +++ b/src/SMESH_SWIG/PAL_MESH_043_3D.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_testExtrusion3D.py # Module : SMESH # Description : Create meshes to test extrusion of mesh elements along path @@ -50,6 +51,7 @@ idcircle = geompy.addToStudy(circle, "Circle") idface = geompy.addToStudy(face, "Circular face") +smesh.SetCurrentStudy(salome.myStudy) # init a Mesh with the circular face mesh1 = smesh.Mesh(face, "Mesh on circular face") diff --git a/src/SMESH_SWIG/SMESH_AdvancedEditor.py b/src/SMESH_SWIG/SMESH_AdvancedEditor.py index a480d029f..2e5ae0bfc 100644 --- a/src/SMESH_SWIG/SMESH_AdvancedEditor.py +++ b/src/SMESH_SWIG/SMESH_AdvancedEditor.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,8 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + +import salome import smesh import math @@ -51,7 +53,8 @@ def GetNewNodes(mesh,Elems,OldNodes): pass return newnodes - +smesh.SetCurrentStudy(salome.myStudy) + # create empty mesh mesh = smesh.Mesh() diff --git a/src/SMESH_SWIG/SMESH_BelongToGeom.py b/src/SMESH_SWIG/SMESH_BelongToGeom.py index 0ba648118..02047a1cf 100644 --- a/src/SMESH_SWIG/SMESH_BelongToGeom.py +++ b/src/SMESH_SWIG/SMESH_BelongToGeom.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + from SMESH_test1 import * ## Old style diff --git a/src/SMESH_SWIG/SMESH_BuildCompound.py b/src/SMESH_SWIG/SMESH_BuildCompound.py index e82abfa40..2ed6eb0e8 100644 --- a/src/SMESH_SWIG/SMESH_BuildCompound.py +++ b/src/SMESH_SWIG/SMESH_BuildCompound.py @@ -1,8 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -20,6 +17,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_BuildCompound.py # Author : Alexander KOVALEV # Module : SMESH @@ -29,6 +27,7 @@ # ! as some sequences of symbols from this example are used during # ! documentation generation to identify certain places of this file # +import salome import geompy import smesh @@ -61,6 +60,8 @@ geompy.addToStudy(Box_sup, "Box_sup") geompy.addToStudyInFather(Box_sup, Fsup2, "Fsup") geompy.addToStudyInFather(Box_sup, Finf2, "Finf") +smesh.SetCurrentStudy(salome.myStudy) + ## create a bottom mesh Mesh_inf = smesh.Mesh(Box_inf, "Mesh_inf") algo1D_1=Mesh_inf.Segment() diff --git a/src/SMESH_SWIG/SMESH_GroupFromGeom.py b/src/SMESH_SWIG/SMESH_GroupFromGeom.py index e4763c0b0..a91a7c29e 100644 --- a/src/SMESH_SWIG/SMESH_GroupFromGeom.py +++ b/src/SMESH_SWIG/SMESH_GroupFromGeom.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_GroupFromGeom.py # Module : SMESH # diff --git a/src/SMESH_SWIG/SMESH_GroupFromGeom2.py b/src/SMESH_SWIG/SMESH_GroupFromGeom2.py index 85dbd4056..d7643bfdf 100755 --- a/src/SMESH_SWIG/SMESH_GroupFromGeom2.py +++ b/src/SMESH_SWIG/SMESH_GroupFromGeom2.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + #============================================================================== # Info. # Bug (from script, bug) : SMESH_GroupFromGeom.py, PAL6945 diff --git a/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py b/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py index 816dede85..e0cbb6404 100644 --- a/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py +++ b/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,8 +20,12 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + +import salome import smesh +smesh.SetCurrentStudy(salome.myStudy) + def BuildGroupLyingOn(theMesh, theElemType, theName, theShape): aFilterMgr = smesh.smesh.CreateFilterManager() aFilter = aFilterMgr.CreateFilter() diff --git a/src/SMESH_SWIG/SMESH_Nut.py b/src/SMESH_SWIG/SMESH_Nut.py index 11428f8c5..801e554f1 100755 --- a/src/SMESH_SWIG/SMESH_Nut.py +++ b/src/SMESH_SWIG/SMESH_Nut.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + ##################################################################### #Created :17/02/2005 #Auhtor :MASLOV Eugeny, KOVALTCHUK Alexey @@ -97,6 +98,8 @@ Cut_1_ID = geompy.addToStudy(Cut_1, "Cut_1") #Mesh creation +smesh.SetCurrentStudy(salome.myStudy) + # -- Init -- shape_mesh = salome.IDToObject( Cut_1_ID ) diff --git a/src/SMESH_SWIG/SMESH_Partition1_tetra.py b/src/SMESH_SWIG/SMESH_Partition1_tetra.py index e3af5d2d1..1fef52a73 100644 --- a/src/SMESH_SWIG/SMESH_Partition1_tetra.py +++ b/src/SMESH_SWIG/SMESH_Partition1_tetra.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Tetrahedrization of the geometry generated by the Python script GEOM_Partition1.py # Hypothesis and algorithms for the mesh generation are global # -- Rayon de la bariere @@ -119,6 +120,7 @@ status = geompy.CheckShape(alveole) print " check status ", status # ---- launch SMESH +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the alveole shape_mesh = salome.IDToObject( idalveole ) diff --git a/src/SMESH_SWIG/SMESH_Sphere.py b/src/SMESH_SWIG/SMESH_Sphere.py index 3b1ca2e79..63d746418 100644 --- a/src/SMESH_SWIG/SMESH_Sphere.py +++ b/src/SMESH_SWIG/SMESH_Sphere.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_Sphere.py # Author : Damien COQUERET, Open CASCADE @@ -103,6 +104,7 @@ Id_Result = addToStudy(Result, "Result") #----------------------------------------------------------------------- #Meshing +smesh.SetCurrentStudy(salome.myStudy) my_hexa = smesh.Mesh(Result, "Sphere_Mesh") algo = my_hexa.Segment() algo.NumberOfSegments(NbSeg) diff --git a/src/SMESH_SWIG/SMESH_blocks.py b/src/SMESH_SWIG/SMESH_blocks.py index d3e744d5f..ddbc7d5e7 100644 --- a/src/SMESH_SWIG/SMESH_blocks.py +++ b/src/SMESH_SWIG/SMESH_blocks.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # SMESH SMESH_SWIG : binding of C++ implementaion with Python # File : SMESH_blocks.py # Author : Julia DOROVSKIKH @@ -36,6 +37,7 @@ import GEOM_Spanner isBlocksTest = 0 # False isMeshTest = 1 # True +smesh.SetCurrentStudy(salome.myStudy) GEOM_Spanner.MakeSpanner(geompy, math, isBlocksTest, isMeshTest, smesh) diff --git a/src/SMESH_SWIG/SMESH_box.py b/src/SMESH_SWIG/SMESH_box.py index 8a1b39cac..c8df0179d 100755 --- a/src/SMESH_SWIG/SMESH_box.py +++ b/src/SMESH_SWIG/SMESH_box.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + #============================================================================== # Info. # Bug (from script, bug) : box.py, PAL5223 @@ -47,6 +48,7 @@ box = geompy.MakeBox(0.,0.,0.,1.,1.,1.) boxId = geompy.addToStudy(box,"box") # ---- SMESH +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh diff --git a/src/SMESH_SWIG/SMESH_box2_tetra.py b/src/SMESH_SWIG/SMESH_box2_tetra.py index 79cf3b536..365d64d94 100644 --- a/src/SMESH_SWIG/SMESH_box2_tetra.py +++ b/src/SMESH_SWIG/SMESH_box2_tetra.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Tetrahedrization of the geometry union of 2 boxes having a face in common # Hypothesis and algorithms for the mesh generation are global # @@ -73,6 +74,7 @@ print "number of Edges in shell : ", len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the shell diff --git a/src/SMESH_SWIG/SMESH_box3_tetra.py b/src/SMESH_SWIG/SMESH_box3_tetra.py index fd1b3ef62..19eb230da 100644 --- a/src/SMESH_SWIG/SMESH_box3_tetra.py +++ b/src/SMESH_SWIG/SMESH_box3_tetra.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Tetrahedrization of the geometry union of 3 boxes aligned where the middle # one has a race in common with the two others. # Hypothesis and algorithms for the mesh generation are global @@ -84,7 +85,7 @@ print "number of Edges in shell : ", len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- - +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the shell diff --git a/src/SMESH_SWIG/SMESH_box_tetra.py b/src/SMESH_SWIG/SMESH_box_tetra.py index 279ae11ab..42bc55336 100644 --- a/src/SMESH_SWIG/SMESH_box_tetra.py +++ b/src/SMESH_SWIG/SMESH_box_tetra.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Tetrahedrization of a simple box. Hypothesis and algorithms for # the mesh generation are global # @@ -45,6 +46,7 @@ print "number of Edges in box : ", len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the boxe diff --git a/src/SMESH_SWIG/SMESH_controls.py b/src/SMESH_SWIG/SMESH_controls.py index 41e561329..43c1b5874 100644 --- a/src/SMESH_SWIG/SMESH_controls.py +++ b/src/SMESH_SWIG/SMESH_controls.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_control.py # Author : Sergey LITONIN # Module : SMESH diff --git a/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py b/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py index f5f6d65e5..232f4efa9 100755 --- a/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py +++ b/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + #============================================================================== # Info. # Bug (from script, bug) : SMESH_demo_hexa2_upd.py, PAL6781 @@ -124,6 +125,7 @@ for i in range(8): idEdgeZ.append(geompy.addToStudyInFather(vol,edgeZ[i],"EdgeZ"+str(i+1))) ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the volume diff --git a/src/SMESH_SWIG/SMESH_fixation.py b/src/SMESH_SWIG/SMESH_fixation.py index bb406f035..ee6ae836a 100644 --- a/src/SMESH_SWIG/SMESH_fixation.py +++ b/src/SMESH_SWIG/SMESH_fixation.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_fix_volute.py # Author : Paul RASCLE, EDF # Module : SMESH diff --git a/src/SMESH_SWIG/SMESH_fixation_hexa.py b/src/SMESH_SWIG/SMESH_fixation_hexa.py index 6a73b38b8..e67021c5d 100644 --- a/src/SMESH_SWIG/SMESH_fixation_hexa.py +++ b/src/SMESH_SWIG/SMESH_fixation_hexa.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Hexahedrization of the geometry generated by the Python script # SMESH_fixation.py # Hypothesis and algorithms for the mesh generation are global @@ -45,6 +46,7 @@ status = geompy.CheckShape(compshell) print " check status ", status ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the compshell shape_mesh = salome.IDToObject( idcomp ) diff --git a/src/SMESH_SWIG/SMESH_fixation_netgen.py b/src/SMESH_SWIG/SMESH_fixation_netgen.py index 16295a5e5..789c90ebc 100644 --- a/src/SMESH_SWIG/SMESH_fixation_netgen.py +++ b/src/SMESH_SWIG/SMESH_fixation_netgen.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Tetrahedrization of the geometry generated by the Python script # SMESH_fixation.py # The new Netgen algorithm is used that discretizes baoundaries itself @@ -45,6 +46,7 @@ status = geompy.CheckShape(compshell) print " check status ", status ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) print "-------------------------- create Mesh, algorithm, hypothesis" diff --git a/src/SMESH_SWIG/SMESH_fixation_tetra.py b/src/SMESH_SWIG/SMESH_fixation_tetra.py index 483cd666d..fa63ce0cb 100644 --- a/src/SMESH_SWIG/SMESH_fixation_tetra.py +++ b/src/SMESH_SWIG/SMESH_fixation_tetra.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Tetrahedrization of the geometry generated by the Python script # SMESH_fixation.py # Hypothesis and algorithms for the mesh generation are global @@ -45,6 +46,7 @@ status = geompy.CheckShape(compshell) print " check status ", status ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the compshell diff --git a/src/SMESH_SWIG/SMESH_flight_skin.py b/src/SMESH_SWIG/SMESH_flight_skin.py index 534bed16c..7ab3583b5 100644 --- a/src/SMESH_SWIG/SMESH_flight_skin.py +++ b/src/SMESH_SWIG/SMESH_flight_skin.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Triangulation of the skin of the geometry from a Brep representing a plane # Hypothesis and algorithms for the mesh generation are global # @@ -55,6 +56,7 @@ print "number of Edges in flight : ", len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the shell shape_mesh = salome.IDToObject( idShape ) diff --git a/src/SMESH_SWIG/SMESH_freebord.py b/src/SMESH_SWIG/SMESH_freebord.py index 4c5fc646d..cc864aab8 100644 --- a/src/SMESH_SWIG/SMESH_freebord.py +++ b/src/SMESH_SWIG/SMESH_freebord.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + import salome import geompy import smesh @@ -41,6 +42,7 @@ idbox = geompy.addToStudy( aBox, "box" ) aBox = salome.IDToObject( idbox ) # Create mesh +smesh.SetCurrentStudy(salome.myStudy) mesh = smesh.Mesh(aBox, "Mesh_freebord") diff --git a/src/SMESH_SWIG/SMESH_hexaedre.py b/src/SMESH_SWIG/SMESH_hexaedre.py index 4345b08b8..6c1abaa26 100755 --- a/src/SMESH_SWIG/SMESH_hexaedre.py +++ b/src/SMESH_SWIG/SMESH_hexaedre.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + #============================================================================== # Info. # Bug (from script, bug) : hexaedre_modified.py, PAL6194, PAL7153 @@ -95,6 +96,7 @@ salome.sg.updateObjBrowser(1) # ----------------------------------------------------------------------------- print "-------------------------- mesh" +smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the geom shape shape_mesh = blob diff --git a/src/SMESH_SWIG/SMESH_mechanic.py b/src/SMESH_SWIG/SMESH_mechanic.py index 46032383c..6b84327cc 100644 --- a/src/SMESH_SWIG/SMESH_mechanic.py +++ b/src/SMESH_SWIG/SMESH_mechanic.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_withHole.py # Author : Lucien PIGNOLONI # Module : SMESH @@ -120,6 +121,7 @@ name = geompy.SubShapeName( sub_face4, mechanic ) Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name ) # ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # -- Init -- shape_mesh = salome.IDToObject( Id_mechanic ) diff --git a/src/SMESH_SWIG/SMESH_mechanic_editor.py b/src/SMESH_SWIG/SMESH_mechanic_editor.py index 9ff002704..94c0719ff 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_editor.py +++ b/src/SMESH_SWIG/SMESH_mechanic_editor.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_withHole.py # Author : Lucien PIGNOLONI # Module : SMESH @@ -118,6 +119,7 @@ name = geompy.SubShapeName( sub_face4, mechanic ) Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name ) # ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) # -- Init -- shape_mesh = salome.IDToObject( Id_mechanic ) diff --git a/src/SMESH_SWIG/SMESH_mechanic_netgen.py b/src/SMESH_SWIG/SMESH_mechanic_netgen.py index 038e64e0b..21f787040 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_netgen.py +++ b/src/SMESH_SWIG/SMESH_mechanic_netgen.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Quadrangulation of the geometry generated by the Python script # SMESH_mechanic.py # The new Netgen algorithm is used that discretizes baoundaries itself @@ -104,6 +105,7 @@ print "number of Faces in mechanic : ",len(subFaceList) print "number of Edges in mechanic : ",len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) print "-------------------------- create Mesh, algorithm, hypothesis" diff --git a/src/SMESH_SWIG/SMESH_mechanic_tetra.py b/src/SMESH_SWIG/SMESH_mechanic_tetra.py index 1307067df..c72428bff 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_tetra.py +++ b/src/SMESH_SWIG/SMESH_mechanic_tetra.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_withHole.py # Author : Lucien PIGNOLONI # Module : SMESH @@ -104,6 +105,7 @@ print "number of Faces in mechanic : ",len(subFaceList) print "number of Edges in mechanic : ",len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- +smesh.SetCurrentStudy(salome.myStudy) shape_mesh = salome.IDToObject( Id_mechanic ) diff --git a/src/SMESH_SWIG/SMESH_reg.py b/src/SMESH_SWIG/SMESH_reg.py index 92005898d..06dd5706c 100644 --- a/src/SMESH_SWIG/SMESH_reg.py +++ b/src/SMESH_SWIG/SMESH_reg.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_reg.py # Module : SMESH # @@ -58,7 +59,7 @@ salome.sg.updateObjBrowser(1); # ---- launch SMESH smeshgui = salome.ImportComponentGUI("SMESH") smeshgui.Init(salome.myStudyId) - +smesh.SetCurrentStudy(salome.myStudy) # ---- Creating meshes diff --git a/src/SMESH_SWIG/SMESH_shared_modules.py b/src/SMESH_SWIG/SMESH_shared_modules.py index 594832b32..9db144125 100644 --- a/src/SMESH_SWIG/SMESH_shared_modules.py +++ b/src/SMESH_SWIG/SMESH_shared_modules.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + """ """ diff --git a/src/SMESH_SWIG/SMESH_test.py b/src/SMESH_SWIG/SMESH_test.py index da4eda843..a80121aa4 100644 --- a/src/SMESH_SWIG/SMESH_test.py +++ b/src/SMESH_SWIG/SMESH_test.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses # File : SMESH_test.py # Module : SMESH @@ -56,6 +57,7 @@ ide = geompy.addToStudyInFather(face, edge, name) # ---- SMESH +smesh.SetCurrentStudy(salome.myStudy) box = salome.IDToObject(idb) mesh = smesh.Mesh(box, "Meshbox") @@ -124,11 +126,17 @@ for a in log: elif comType == 2: for i in range(a.number): ind = a.indexes[ii] + print ind ii = ii+1 + print ii i1 = a.indexes[ii] ii = ii+1 i2 = a.indexes[ii] + print i2 ii = ii+1 + print "ii", ii i3 = a.indexes[ii] + print i3 + #ii = ii+1 ii = ii+1 print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3) diff --git a/src/SMESH_SWIG/SMESH_test0.py b/src/SMESH_SWIG/SMESH_test0.py index 407d25ead..3a0f73c23 100644 --- a/src/SMESH_SWIG/SMESH_test0.py +++ b/src/SMESH_SWIG/SMESH_test0.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_test0.py # Module : SMESH # diff --git a/src/SMESH_SWIG/SMESH_test1.py b/src/SMESH_SWIG/SMESH_test1.py index cd68018d2..e5f964768 100644 --- a/src/SMESH_SWIG/SMESH_test1.py +++ b/src/SMESH_SWIG/SMESH_test1.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_test1.py # Module : SMESH # @@ -27,7 +28,6 @@ import salome import geompy import smesh - # ---- define a box box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) @@ -60,6 +60,8 @@ idedge = geompy.addToStudyInFather(face, edge, name) # ---- SMESH +smesh.SetCurrentStudy(salome.myStudy) + # ---- Init a Mesh with the box mesh = smesh.Mesh(box, "Meshbox") diff --git a/src/SMESH_SWIG/SMESH_test1_AndDisplay.py b/src/SMESH_SWIG/SMESH_test1_AndDisplay.py index c87694894..cedeabc92 100644 --- a/src/SMESH_SWIG/SMESH_test1_AndDisplay.py +++ b/src/SMESH_SWIG/SMESH_test1_AndDisplay.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_test1.py # Module : SMESH # @@ -60,6 +61,8 @@ idedge = geompy.addToStudyInFather(face, edge, name) # ---- SMESH +smesh.SetCurrentStudy(salome.myStudy) + # ---- Init a Mesh with the box mesh = smesh.Mesh(box, "Meshbox") diff --git a/src/SMESH_SWIG/SMESH_test2.py b/src/SMESH_SWIG/SMESH_test2.py index 01c912973..cc3d1a2e8 100644 --- a/src/SMESH_SWIG/SMESH_test2.py +++ b/src/SMESH_SWIG/SMESH_test2.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_test2.py # Module : SMESH # diff --git a/src/SMESH_SWIG/SMESH_test3.py b/src/SMESH_SWIG/SMESH_test3.py index a2c771b80..1a02159ed 100644 --- a/src/SMESH_SWIG/SMESH_test3.py +++ b/src/SMESH_SWIG/SMESH_test3.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_test3.py # Module : SMESH #import salome diff --git a/src/SMESH_SWIG/SMESH_test4.py b/src/SMESH_SWIG/SMESH_test4.py index 181833934..f5357c5e7 100755 --- a/src/SMESH_SWIG/SMESH_test4.py +++ b/src/SMESH_SWIG/SMESH_test4.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + import salome import geompy import smesh @@ -40,6 +41,7 @@ face = salome.IDToObject(idface) # ---- SMESH +smesh.SetCurrentStudy(salome.myStudy) mesh = smesh.Mesh(box, "Meshbox") # Set 1D algorithm/hypotheses to mesh diff --git a/src/SMESH_SWIG/SMESH_test5.py b/src/SMESH_SWIG/SMESH_test5.py index 616f0e39d..844c91511 100644 --- a/src/SMESH_SWIG/SMESH_test5.py +++ b/src/SMESH_SWIG/SMESH_test5.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : SMESH_test5.py # Module : SMESH # @@ -30,6 +31,8 @@ import CORBA import os import os.path +smesh.SetCurrentStudy(salome.myStudy) + def SetSObjName(theSObj,theName) : ok, anAttr = theSObj.FindAttribute("AttributeName") if ok: diff --git a/src/SMESH_SWIG/batchmode_mefisto.py b/src/SMESH_SWIG/batchmode_mefisto.py index 0e768a4d1..a4bc7ecf5 100644 --- a/src/SMESH_SWIG/batchmode_mefisto.py +++ b/src/SMESH_SWIG/batchmode_mefisto.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + import os import re diff --git a/src/SMESH_SWIG/batchmode_smesh.py b/src/SMESH_SWIG/batchmode_smesh.py index eb2c4e1fe..2b3e64bc4 100644 --- a/src/SMESH_SWIG/batchmode_smesh.py +++ b/src/SMESH_SWIG/batchmode_smesh.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : batchmode_smesh.py # Author : Oksana TCHEBANOVA # Module : SMESH @@ -33,6 +34,7 @@ import SMESH modulecatalog = naming_service.Resolve("/Kernel/ModulCatalog") smesh = lcc.FindOrLoadComponent("FactoryServer", "SMESH") +smesh.SetCurrentStudy(myStudy) myStudyBuilder = myStudy.NewBuilder() if myStudyBuilder is None: diff --git a/src/SMESH_SWIG/ex00_all.py b/src/SMESH_SWIG/ex00_all.py index 0ef515b9c..0977fa202 100644 --- a/src/SMESH_SWIG/ex00_all.py +++ b/src/SMESH_SWIG/ex00_all.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ================================== # Load all examples # ----------------- diff --git a/src/SMESH_SWIG/ex01_cube2build.py b/src/SMESH_SWIG/ex01_cube2build.py index 34bb6e39d..888a70642 100644 --- a/src/SMESH_SWIG/ex01_cube2build.py +++ b/src/SMESH_SWIG/ex01_cube2build.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -287,6 +288,8 @@ piece_id = addToStudy(piece, "ex01_cube2build") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create hexahedrical mesh on piece # --------------------------------- diff --git a/src/SMESH_SWIG/ex02_cube2primitive.py b/src/SMESH_SWIG/ex02_cube2primitive.py index 885d8722a..3890e97d4 100644 --- a/src/SMESH_SWIG/ex02_cube2primitive.py +++ b/src/SMESH_SWIG/ex02_cube2primitive.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -98,6 +99,8 @@ piece_id = addToStudy(piece, "ex02_cube2primitive") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create hexahedrical mesh on piece # --------------------------------- diff --git a/src/SMESH_SWIG/ex03_cube2partition.py b/src/SMESH_SWIG/ex03_cube2partition.py index d620a6411..6ca0bd7a3 100644 --- a/src/SMESH_SWIG/ex03_cube2partition.py +++ b/src/SMESH_SWIG/ex03_cube2partition.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -85,6 +86,8 @@ piece_id = addToStudy(piece, "ex03_cube2partition") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create hexahedrical mesh on piece # --------------------------------- diff --git a/src/SMESH_SWIG/ex04_cube5tetraHexa.py b/src/SMESH_SWIG/ex04_cube5tetraHexa.py index 02f6f2c87..ae3ca45f5 100644 --- a/src/SMESH_SWIG/ex04_cube5tetraHexa.py +++ b/src/SMESH_SWIG/ex04_cube5tetraHexa.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -66,6 +67,8 @@ piece_id = addToStudy(piece, "ex04_cube5tetraHexa") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex05_hole1build.py b/src/SMESH_SWIG/ex05_hole1build.py index 31793da2e..4b3c77581 100644 --- a/src/SMESH_SWIG/ex05_hole1build.py +++ b/src/SMESH_SWIG/ex05_hole1build.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -124,6 +125,8 @@ piece_id = addToStudy(piece, "ex05_hole1build") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex06_hole1boolean.py b/src/SMESH_SWIG/ex06_hole1boolean.py index acdc7f5e9..3c5054590 100644 --- a/src/SMESH_SWIG/ex06_hole1boolean.py +++ b/src/SMESH_SWIG/ex06_hole1boolean.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -118,6 +119,8 @@ piece_id = addToStudy(piece, "ex06_hole1boolean") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex07_hole1partition.py b/src/SMESH_SWIG/ex07_hole1partition.py index 4ca5c481d..6ef4f6c3d 100644 --- a/src/SMESH_SWIG/ex07_hole1partition.py +++ b/src/SMESH_SWIG/ex07_hole1partition.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -82,6 +83,8 @@ piece_id = addToStudy(piece, "ex07_hole1partition") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex08_hole2build.py b/src/SMESH_SWIG/ex08_hole2build.py index cb417562e..3e6e01b99 100644 --- a/src/SMESH_SWIG/ex08_hole2build.py +++ b/src/SMESH_SWIG/ex08_hole2build.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -115,6 +116,8 @@ piece_id = addToStudy(piece, "ex08_hole2build") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex09_grid4build.py b/src/SMESH_SWIG/ex09_grid4build.py index 4fd9c6db2..be1c47d3d 100644 --- a/src/SMESH_SWIG/ex09_grid4build.py +++ b/src/SMESH_SWIG/ex09_grid4build.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -118,6 +119,8 @@ piece_id = addToStudy(piece, "ex09_grid4build") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex10_grid4geometry.py b/src/SMESH_SWIG/ex10_grid4geometry.py index f9a8c399b..3c0d92706 100644 --- a/src/SMESH_SWIG/ex10_grid4geometry.py +++ b/src/SMESH_SWIG/ex10_grid4geometry.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -80,6 +81,8 @@ piece_id = addToStudy(piece, "ex10_grid4geometry") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex11_grid3partition.py b/src/SMESH_SWIG/ex11_grid3partition.py index 1ed38c03b..6b2407af9 100644 --- a/src/SMESH_SWIG/ex11_grid3partition.py +++ b/src/SMESH_SWIG/ex11_grid3partition.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -101,6 +102,8 @@ piece_id = addToStudy(piece, "ex11_grid3partition") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex12_grid17partition.py b/src/SMESH_SWIG/ex12_grid17partition.py index 3499a3e0b..d4ecdc1d3 100644 --- a/src/SMESH_SWIG/ex12_grid17partition.py +++ b/src/SMESH_SWIG/ex12_grid17partition.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -116,6 +117,8 @@ piece_id = addToStudy(piece, "ex12_grid17partition") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex13_hole1partial.py b/src/SMESH_SWIG/ex13_hole1partial.py index 609f48052..c11080657 100644 --- a/src/SMESH_SWIG/ex13_hole1partial.py +++ b/src/SMESH_SWIG/ex13_hole1partial.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ================================== # from geompy import * @@ -214,6 +215,8 @@ piece_id = addToStudy(piece, "ex13_hole1partial") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a mesh # ------------- diff --git a/src/SMESH_SWIG/ex14_cyl1holed.py b/src/SMESH_SWIG/ex14_cyl1holed.py index 1c89971fc..7f1b1592f 100644 --- a/src/SMESH_SWIG/ex14_cyl1holed.py +++ b/src/SMESH_SWIG/ex14_cyl1holed.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -99,6 +100,8 @@ piece_id = addToStudy(piece, "ex14_cyl1holed") # Maillage # ======== +smesh.SetCurrentStudy(salome.myStudy) + # Creer un maillage hexahedrique # ------------------------------ diff --git a/src/SMESH_SWIG/ex15_cyl2geometry.py b/src/SMESH_SWIG/ex15_cyl2geometry.py index 72a0a4b92..8231b0490 100644 --- a/src/SMESH_SWIG/ex15_cyl2geometry.py +++ b/src/SMESH_SWIG/ex15_cyl2geometry.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -168,7 +169,7 @@ cpd = cpd + r_element # Compound # -------- -piece = RemoveExtraEdges(MakeCompound(cpd), 0) +piece = RemoveExtraEdges(MakeCompound(cpd), True) # Ajouter la piece dans l'etude # ----------------------------- @@ -178,6 +179,8 @@ piece_id = addToStudy(piece, "ex15_cyl2geometry") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex16_cyl2complementary.py b/src/SMESH_SWIG/ex16_cyl2complementary.py index 4a3adf337..b46d11241 100644 --- a/src/SMESH_SWIG/ex16_cyl2complementary.py +++ b/src/SMESH_SWIG/ex16_cyl2complementary.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -108,6 +109,8 @@ piece_id = addToStudy(piece, "ex16_cyl2complementary") # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex17_dome1.py b/src/SMESH_SWIG/ex17_dome1.py index c94136b20..911fdce17 100644 --- a/src/SMESH_SWIG/ex17_dome1.py +++ b/src/SMESH_SWIG/ex17_dome1.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -81,6 +82,8 @@ piece_id = addToStudy(piece, "ex17_dome1") # Maillage # ======== +smesh.SetCurrentStudy(salome.myStudy) + # Maillage hexahedrique # --------------------- diff --git a/src/SMESH_SWIG/ex18_dome2.py b/src/SMESH_SWIG/ex18_dome2.py index fc78722d7..6a614064d 100644 --- a/src/SMESH_SWIG/ex18_dome2.py +++ b/src/SMESH_SWIG/ex18_dome2.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # from geompy import * @@ -118,6 +119,8 @@ piece_id = addToStudy(piece, "ex18_dome2") # Maillage # ======== +smesh.SetCurrentStudy(salome.myStudy) + # Maillage hexahedrique # --------------------- diff --git a/src/SMESH_SWIG/ex19_sphereINcube.py b/src/SMESH_SWIG/ex19_sphereINcube.py index 53b6e2ae6..043a2e312 100644 --- a/src/SMESH_SWIG/ex19_sphereINcube.py +++ b/src/SMESH_SWIG/ex19_sphereINcube.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ================================== # from geompy import * @@ -168,6 +169,8 @@ UnionList(groupe, groupe_sphere) # Meshing # ======= +smesh.SetCurrentStudy(salome.myStudy) + # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex21_lamp.py b/src/SMESH_SWIG/ex21_lamp.py index b7a511d4d..3bb7272f3 100644 --- a/src/SMESH_SWIG/ex21_lamp.py +++ b/src/SMESH_SWIG/ex21_lamp.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ================================== # from geompy import * @@ -93,6 +94,8 @@ UnionIDs(group, faces) # Create a mesh # ============= +smesh.SetCurrentStudy(salome.myStudy) + # Define a mesh on a geometry # --------------------------- diff --git a/src/SMESH_SWIG/ex24_cylinder.py b/src/SMESH_SWIG/ex24_cylinder.py index 2e7b52d82..6dd999cf5 100644 --- a/src/SMESH_SWIG/ex24_cylinder.py +++ b/src/SMESH_SWIG/ex24_cylinder.py @@ -1,8 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -20,13 +17,14 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ================================== # import math import geompy import smesh - +import salome geo = geompy # Parameters @@ -98,6 +96,8 @@ geo.DifferenceList(group_1, [group_1_box]) # Mesh the blocks with hexahedral # ------------------------------- +smesh.SetCurrentStudy(salome.myStudy) + def discretize(x, y, z, n, s=blocks): p = geo.MakeVertex(x, y, z) e = geo.GetEdgeNearPoint(s, p) diff --git a/src/SMESH_SWIG/ex29_refine.py b/src/SMESH_SWIG/ex29_refine.py index 2f378a1b1..ad6425781 100644 --- a/src/SMESH_SWIG/ex29_refine.py +++ b/src/SMESH_SWIG/ex29_refine.py @@ -1,8 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -20,6 +17,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # ======================================= # Procedure that take a triangulation and split all triangles in 4 others triangles # diff --git a/src/SMESH_SWIG/ex30_groupsOp.py b/src/SMESH_SWIG/ex30_groupsOp.py index f1a857d9a..4dfff9ffe 100755 --- a/src/SMESH_SWIG/ex30_groupsOp.py +++ b/src/SMESH_SWIG/ex30_groupsOp.py @@ -1,4 +1,22 @@ # -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# import sys import salome @@ -16,7 +34,7 @@ global Face_1 Face_1 = geompy.MakeFaceHW(100, 100, 1) geompy.addToStudy( Face_1, "Face_1" ) -#smesh.smesh.SetCurrentStudy(aStudyId) +smesh.SetCurrentStudy(salome.myStudy) import StdMeshers pattern = smesh.GetPattern() Mesh_1 = smesh.Mesh(Face_1) diff --git a/src/SMESH_SWIG/ex30_tepal.py b/src/SMESH_SWIG/ex30_tepal.py index 61a035022..5972e7f2d 100644 --- a/src/SMESH_SWIG/ex30_tepal.py +++ b/src/SMESH_SWIG/ex30_tepal.py @@ -1,7 +1,25 @@ # -*- coding: iso-8859-1 -*- -# CEA/LGLS 2008, Christian Van Wambeke (CEA/LGLS), Francis KLOSS (OCC) -# ==================================================================== +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# ==================================================================== +# import os import geompy @@ -28,6 +46,8 @@ geompy.addToStudy(cylinder, "Cylinder") # Define a mesh on a geometry # --------------------------- +smesh.SetCurrentStudy(salome.myStudy) + m = smesh.Mesh(cylinder) # 2D mesh with BLSURF diff --git a/src/SMESH_SWIG/ex31_dimGroup.py b/src/SMESH_SWIG/ex31_dimGroup.py index 7f4600d3f..56d74c6ce 100755 --- a/src/SMESH_SWIG/ex31_dimGroup.py +++ b/src/SMESH_SWIG/ex31_dimGroup.py @@ -1,4 +1,22 @@ # -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# import sys import salome @@ -18,7 +36,7 @@ global Box_1 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) geompy.addToStudy( Box_1, "Box_1" ) -#smesh.smesh.SetCurrentStudy(theStudy) +smesh.SetCurrentStudy(salome.myStudy) import StdMeshers Mesh_1 = smesh.Mesh(Box_1) Regular_1D = Mesh_1.Segment() diff --git a/src/SMESH_SWIG/smesh.py b/src/SMESH_SWIG/smesh.py index 217439fa5..a3188f96e 100644 --- a/src/SMESH_SWIG/smesh.py +++ b/src/SMESH_SWIG/smesh.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -20,6 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : smesh.py # Author : Francis KLOSS, OCC # Module : SMESH diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index 4789415c9..4cde48b12 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -1,8 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -20,6 +17,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : smesh.py # Author : Francis KLOSS, OCC # Module : SMESH @@ -99,6 +97,7 @@ from SMESH import * import StdMeshers import SALOME +import SALOMEDS # import NETGENPlugin module if possible noNETGENPlugin = 0 @@ -162,6 +161,8 @@ Hexa = 8 Hexotic = 9 BLSURF = 10 GHS3DPRL = 11 +QUADRANGLE = 0 +RADIAL_QUAD = 1 # MirrorType enumeration POINT = SMESH_MeshEditor.POINT @@ -194,6 +195,10 @@ DefaultSize, DefaultGeom, Custom = 0,0,1 PrecisionConfusion = 1e-07 +# TopAbs_State enumeration +[TopAbs_IN, TopAbs_OUT, TopAbs_ON, TopAbs_UNKNOWN] = range(4) + + ## Converts an angle from degrees to radians def DegreesToRadians(AngleInDegrees): from math import pi @@ -391,13 +396,33 @@ NO_NAME = "NoName" ## Gets object name def GetName(obj): - ior = salome.orb.object_to_string(obj) - sobj = salome.myStudy.FindObjectIOR(ior) - if sobj is None: - return NO_NAME - else: - attr = sobj.FindAttribute("AttributeName")[1] - return attr.Value() + if obj: + # object not null + if isinstance(obj, SALOMEDS._objref_SObject): + # study object + return obj.GetName() + ior = salome.orb.object_to_string(obj) + if ior: + # CORBA object + studies = salome.myStudyManager.GetOpenStudies() + for sname in studies: + s = salome.myStudyManager.GetStudyByName(sname) + if not s: continue + sobj = s.FindObjectIOR(ior) + if not sobj: continue + return sobj.GetName() + if hasattr(obj, "GetName"): + # unknown CORBA object, having GetName() method + return obj.GetName() + else: + # unknown CORBA object, no GetName() method + return NO_NAME + pass + if hasattr(obj, "GetName"): + # unknown non-CORBA object, having GetName() method + return obj.GetName() + pass + raise RuntimeError, "Null or invalid object" ## Prints error message if a hypothesis was not assigned. def TreatHypoStatus(status, hypName, geomName, isAlgo): @@ -432,10 +457,12 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo): return hypName = '"' + hypName + '"' geomName= '"' + geomName+ '"' - if status < HYP_UNKNOWN_FATAL: + if status < HYP_UNKNOWN_FATAL and not geomName =='""': print hypName, "was assigned to", geomName,"but", reason - else: + elif not geomName == '""': print hypName, "was not assigned to",geomName,":", reason + else: + print hypName, "was not assigned:", reason pass ## Check meshing plugin availability @@ -1031,17 +1058,20 @@ class Mesh: if (isinstance(algo, geompyDC.GEOM._objref_GEOM_Object)): geom = algo algo = MEFISTO - return Mesh_Triangle(self, algo, geom) ## Creates a quadrangle 2D algorithm for faces. # If the optional \a geom parameter is not set, this algorithm is global. # \n Otherwise, this algorithm defines a submesh based on \a geom subshape. # @param geom If defined, the subshape to be meshed (GEOM_Object) + # @param algo values are: smesh.QUADRANGLE || smesh.RADIAL_QUAD # @return an instance of Mesh_Quadrangle algorithm # @ingroup l3_algos_basic - def Quadrangle(self, geom=0): - return Mesh_Quadrangle(self, geom) + def Quadrangle(self, geom=0, algo=QUADRANGLE): + if algo==RADIAL_QUAD: + return Mesh_RadialQuadrangle1D2D(self,geom) + else: + return Mesh_Quadrangle(self, geom) ## Creates a tetrahedron 3D algorithm for solids. # The parameter \a algo permits to choose the algorithm: NETGEN or GHS3D @@ -1153,8 +1183,62 @@ class Mesh: print "Mesh computation failed, exception caught:" traceback.print_exc() if True:#not ok: - errors = self.smeshpyD.GetAlgoState( self.mesh, geom ) allReasons = "" + + # Treat compute errors + computeErrors = self.smeshpyD.GetComputeErrors( self.mesh, geom ) + for err in computeErrors: + shapeText = "" + if self.mesh.HasShapeToMesh(): + try: + mainIOR = salome.orb.object_to_string(geom) + for sname in salome.myStudyManager.GetOpenStudies(): + s = salome.myStudyManager.GetStudyByName(sname) + if not s: continue + mainSO = s.FindObjectIOR(mainIOR) + if not mainSO: continue + subIt = s.NewChildIterator(mainSO) + while subIt.More(): + subSO = subIt.Value() + subIt.Next() + obj = subSO.GetObject() + if not obj: continue + go = obj._narrow( geompyDC.GEOM._objref_GEOM_Object ) + if not go: continue + ids = go.GetSubShapeIndices() + if len(ids) == 1 and ids[0] == err.subShapeID: + shapeText = ' on "%s"' % subSO.GetName() + break + if not shapeText: + shape = self.geompyD.GetSubShape( geom, [err.subShapeID]) + if shape: + shapeText = " on %s #%s" % (shape.GetShapeType(), err.subShapeID) + else: + shapeText = " on subshape #%s" % (err.subShapeID) + except: + shapeText = " on subshape #%s" % (err.subShapeID) + errText = "" + stdErrors = ["OK", #COMPERR_OK + "Invalid input mesh", #COMPERR_BAD_INPUT_MESH + "std::exception", #COMPERR_STD_EXCEPTION + "OCC exception", #COMPERR_OCC_EXCEPTION + "SALOME exception", #COMPERR_SLM_EXCEPTION + "Unknown exception", #COMPERR_EXCEPTION + "Memory allocation problem", #COMPERR_MEMORY_PB + "Algorithm failed", #COMPERR_ALGO_FAILED + "Unexpected geometry"]#COMPERR_BAD_SHAPE + if err.code > 0: + if err.code < len(stdErrors): errText = stdErrors[err.code] + else: + errText = "code %s" % -err.code + if errText: errText += ". " + errText += err.comment + if allReasons != "":allReasons += "\n" + allReasons += '"%s" failed%s. Error: %s' %(err.algoName, shapeText, errText) + pass + + # Treat hyp errors + errors = self.smeshpyD.GetAlgoState( self.mesh, geom ) for err in errors: if err.isGlobalAlgo: glob = "global" @@ -1180,9 +1264,7 @@ class Mesh: reason = "For unknown reason."+\ " Revise Mesh.Compute() implementation in smeshDC.py!" pass - if allReasons != "": - allReasons += "\n" - pass + if allReasons != "":allReasons += "\n" allReasons += reason pass if allReasons != "": @@ -1201,6 +1283,18 @@ class Mesh: pass return ok + ## Return submesh objects list in meshing order + # @return list of list of submesh objects + # @ingroup l2_construct + def GetMeshOrder(self): + return self.mesh.GetMeshOrder() + + ## Return submesh objects list in meshing order + # @return list of list of submesh objects + # @ingroup l2_construct + def SetMeshOrder(self, submeshes): + return self.mesh.SetMeshOrder(submeshes) + ## Removes all nodes and elements # @ingroup l2_construct def Clear(self): @@ -1271,7 +1365,11 @@ class Mesh: pass status = self.mesh.AddHypothesis(geom, hyp) isAlgo = hyp._narrow( SMESH_Algo ) - TreatHypoStatus( status, GetName( hyp ), GetName( geom ), isAlgo ) + hyp_name = GetName( hyp ) + geom_name = "" + if geom: + geom_name = GetName( geom ) + TreatHypoStatus( status, hyp_name, geom_name, isAlgo ) return status ## Unassigns a hypothesis @@ -1876,6 +1974,12 @@ class Mesh: def GetElementType(self, id, iselem): return self.mesh.GetElementType(id, iselem) + ## Returns the geometric type of mesh element + # @return the value from SMESH::EntityType enumeration + # @ingroup l1_meshinfo + def GetElementGeomType(self, id): + return self.mesh.GetElementGeomType(id) + ## Returns the list of submesh elements IDs # @param Shape a geom object(subshape) IOR # Shape must be the subshape of a ShapeToMesh() @@ -1999,6 +2103,16 @@ class Mesh: def ElemNbFaces(self, id): return self.mesh.ElemNbFaces(id) + ## Returns nodes of given face (counted from zero) for given volumic element. + # @ingroup l1_meshinfo + def GetElemFaceNodes(self,elemId, faceIndex): + return self.mesh.GetElemFaceNodes(elemId, faceIndex) + + ## Returns an element based on all given nodes. + # @ingroup l1_meshinfo + def FindElementByNodes(self,nodes): + return self.mesh.FindElementByNodes(nodes) + ## Returns true if the given element is a polygon # @ingroup l1_meshinfo def IsPoly(self, id): @@ -2241,6 +2355,11 @@ class Mesh: def FindElementsByPoint(self, x, y, z, elementType = SMESH.ALL): return self.editor.FindElementsByPoint(x, y, z, elementType) + # Return point state in a closed 2D mesh in terms of TopAbs_State enumeration. + # TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails. + + def GetPointState(self, x, y, z): + return self.editor.GetPointState(x, y, z) ## Finds the node closest to a point and moves it to a point location # @param x the X coordinate of a point @@ -2373,6 +2492,17 @@ class Mesh: def BestSplit (self, IDOfQuad, theCriterion): return self.editor.BestSplit(IDOfQuad, self.smeshpyD.GetFunctor(theCriterion)) + ## Splits volumic elements into tetrahedrons + # @param elemIDs either list of elements or mesh or group or submesh + # @param method flags passing splitting method: + # 1 - split the hexahedron into 5 tetrahedrons + # 2 - split the hexahedron into 6 tetrahedrons + # @ingroup l2_modif_cutquadr + def SplitVolumesIntoTetra(self, elemIDs, method=1 ): + if isinstance( elemIDs, Mesh ): + elemIDs = elemIDs.GetMesh() + self.editor.SplitVolumesIntoTetra(elemIDs, method) + ## Splits quadrangle faces near triangular facets of volumes # # @ingroup l1_auxiliary @@ -3227,6 +3357,51 @@ class Mesh: mesh.SetParameters(Parameters) return Mesh( self.smeshpyD, self.geompyD, mesh ) + + + ## Scales the object + # @param theObject - the object to translate (mesh, submesh, or group) + # @param thePoint - base point for scale + # @param theScaleFact - scale factors for axises + # @param Copy - allows copying the translated elements + # @param MakeGroups - forces the generation of new groups from existing + # ones (if Copy) + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, + # empty list otherwise + def Scale(self, theObject, thePoint, theScaleFact, Copy, MakeGroups=False): + if ( isinstance( theObject, Mesh )): + theObject = theObject.GetMesh() + if ( isinstance( theObject, list )): + theObject = self.editor.MakeIDSource(theObject) + + thePoint, Parameters = ParsePointStruct(thePoint) + self.mesh.SetParameters(Parameters) + + if Copy and MakeGroups: + return self.editor.ScaleMakeGroups(theObject, thePoint, theScaleFact) + self.editor.Scale(theObject, thePoint, theScaleFact, Copy) + return [] + + ## Creates a new mesh from the translated object + # @param theObject - the object to translate (mesh, submesh, or group) + # @param thePoint - base point for scale + # @param theScaleFact - scale factors for axises + # @param MakeGroups - forces the generation of new groups from existing ones + # @param NewMeshName - the name of the newly created mesh + # @return instance of Mesh class + def ScaleMakeMesh(self, theObject, thePoint, theScaleFact, MakeGroups=False, NewMeshName=""): + if (isinstance(theObject, Mesh)): + theObject = theObject.GetMesh() + if ( isinstance( theObject, list )): + theObject = self.editor.MakeIDSource(theObject) + + mesh = self.editor.ScaleMakeMesh(theObject, thePoint, theScaleFact, + MakeGroups, NewMeshName) + #mesh.SetParameters(Parameters) + return Mesh( self.smeshpyD, self.geompyD, mesh ) + + + ## Rotates the elements # @param IDsOfElements list of elements ids # @param Axis the axis of rotation (AxisStruct or geom line) @@ -3451,7 +3626,7 @@ class Mesh: ## Creates a hole in a mesh by doubling the nodes of some particular elements # This method provided for convenience works as DoubleNodes() described above. - # @param theNodes identifiers of node to be doubled + # @param theNodeId identifiers of node to be doubled # @param theModifiedElems identifiers of elements to be updated # @return TRUE if operation has been completed successfully, FALSE otherwise # @ingroup l2_modif_edit @@ -3518,7 +3693,7 @@ class Mesh: # The replicated nodes should be associated to affected elements. # @ingroup l2_modif_edit def DoubleNodeElemGroupInRegion(self, theElems, theNodesNot, theShape): - return self.editor.DoubleNodeElemGroup(theElems, theNodesNot, theShape) + return self.editor.DoubleNodeElemGroupInRegion(theElems, theNodesNot, theShape) ## Creates a hole in a mesh by doubling the nodes of some particular elements # This method provided for convenience works as DoubleNodes() described above. @@ -3685,19 +3860,23 @@ class Mesh_Algorithm: raise RuntimeError, "Attemp to create " + algo + " algoritm on None shape" self.mesh = mesh piece = mesh.geom + name = "" if not geom: self.geom = piece else: self.geom = geom - name = GetName(geom) - if name==NO_NAME: + try: + name = GetName(geom) + pass + except: name = mesh.geompyD.SubShapeName(geom, piece) mesh.geompyD.addToStudyInFather(piece, geom, name) + pass self.subm = mesh.mesh.GetSubMesh(geom, algo.GetName()) self.algo = algo status = mesh.mesh.AddHypothesis(self.geom, self.algo) - TreatHypoStatus( status, algo.GetName(), GetName(self.geom), True ) + TreatHypoStatus( status, algo.GetName(), name, True ) def CompareHyp (self, hyp, args): print "CompareHyp is not implemented for ", self.__class__.__name__, ":", hyp.GetName() @@ -3902,10 +4081,13 @@ class Mesh_Segment(Mesh_Algorithm): def FixedPoints1D(self, points, nbSegs=[1], reversedEdges=[], UseExisting=0): if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges reversedEdges, UseExisting = [], reversedEdges + if reversedEdges and isinstance( reversedEdges[0], geompyDC.GEOM._objref_GEOM_Object ): + for i in range( len( reversedEdges )): + reversedEdges[i] = self.mesh.geompyD.GetSubShapeID(self.mesh.geom, reversedEdges[i] ) entry = self.MainShapeEntry() hyp = self.Hypothesis("FixedPoints1D", [points, nbSegs, reversedEdges, entry], UseExisting=UseExisting, - CompareMethod=self.CompareArithmetic1D) + CompareMethod=self.CompareFixedPoints1D) hyp.SetPoints(points) hyp.SetNbSegments(nbSegs) hyp.SetReversedEdges(reversedEdges) @@ -4014,11 +4196,14 @@ class Mesh_Segment(Mesh_Algorithm): ### 0D algorithm if self.geom is None: raise RuntimeError, "Attemp to create SegmentAroundVertex_0D algoritm on None shape" - name = GetName(self.geom) - if name == NO_NAME: + try: + name = GetName(self.geom) + pass + except: piece = self.mesh.geom name = self.mesh.geompyD.SubShapeName(self.geom, piece) self.mesh.geompyD.addToStudyInFather(piece, self.geom, name) + pass algo = self.FindAlgorithm("SegmentAroundVertex_0D", self.mesh.smeshpyD) if algo is None: algo = self.mesh.smeshpyD.CreateHypothesis("SegmentAroundVertex_0D", "libStdMeshersEngine.so") @@ -4415,6 +4600,25 @@ class Mesh_Quadrangle(Mesh_Algorithm): CompareMethod=self.CompareEqualHyp) return hyp + ## Defines "QuadrangleParams" hypothesis + # @param vertex: vertex of a trilateral geometrical face, around which triangles + # will be created while other elements will be quadrangles. + # Vertex can be either a GEOM_Object or a vertex ID within the + # shape to mesh + # @param UseExisting: if ==true - searches for the existing hypothesis created with + # the same parameters, else (default) - creates a new one + # + # @ingroup l3_hypos_additi + def TriangleVertex(self, vertex, UseExisting=0): + vertexID = vertex + if isinstance( vertexID, geompyDC.GEOM._objref_GEOM_Object ): + vertexID = self.mesh.geompyD.GetSubShapeID( self.mesh.geom, vertex ) + hyp = self.Hypothesis("QuadrangleParams", [vertexID], UseExisting = UseExisting, + CompareMethod=lambda hyp,args: hyp.GetTriaVertex()==args[0]) + hyp.SetTriaVertex( vertexID ) + return hyp + + # Public class: Mesh_Tetrahedron # ------------------------------ @@ -4912,6 +5116,7 @@ class Mesh_RadialPrism3D(Mesh_Algorithm): self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers ) self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp ) study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis + self.mesh.smeshpyD.SetCurrentStudy( None ) hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so) self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing self.distribHyp.SetLayerDistribution( hyp ) @@ -4998,7 +5203,7 @@ class Mesh_RadialQuadrangle1D2D(Mesh_Algorithm): Mesh_Algorithm.__init__(self) self.Create(mesh, geom, "RadialQuadrangle_1D2D") - self.distribHyp = self.Hypothesis("LayerDistribution2D", UseExisting=0) + self.distribHyp = None #self.Hypothesis("LayerDistribution2D", UseExisting=0) self.nbLayers = None ## Return 2D hypothesis holding the 1D one @@ -5009,21 +5214,26 @@ class Mesh_RadialQuadrangle1D2D(Mesh_Algorithm): # hypothesis. Returns the created hypothesis def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"): #print "OwnHypothesis",hypType - if not self.nbLayers is None: + if self.nbLayers: self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers ) + if self.distribHyp is None: + self.distribHyp = self.Hypothesis("LayerDistribution2D", UseExisting=0) + else: self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp ) study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis + self.mesh.smeshpyD.SetCurrentStudy( None ) hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so) self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing self.distribHyp.SetLayerDistribution( hyp ) return hyp - ## Defines "NumberOfLayers2D" hypothesis, specifying the number of layers + ## Defines "NumberOfLayers" hypothesis, specifying the number of layers # @param n number of layers # @param UseExisting if ==true - searches for the existing hypothesis created with # the same parameters, else (default) - creates a new one - def NumberOfLayers2D(self, n, UseExisting=0): - self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp ) + def NumberOfLayers(self, n, UseExisting=0): + if self.distribHyp: + self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp ) self.nbLayers = self.Hypothesis("NumberOfLayers2D", [n], UseExisting=UseExisting, CompareMethod=self.CompareNumberOfLayers) self.nbLayers.SetNumberOfLayers( n ) diff --git a/src/SMESH_SWIG_WITHIHM/Makefile.am b/src/SMESH_SWIG_WITHIHM/Makefile.am index 5370d7f3e..fc6d37ea1 100644 --- a/src/SMESH_SWIG_WITHIHM/Makefile.am +++ b/src/SMESH_SWIG_WITHIHM/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # SMESH SMESHGUI : GUI for SMESH component # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx index 4766864a2..05e44fb94 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : GUI for SMESH component // File : libSMESH_Swig.cxx // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -71,10 +69,10 @@ namespace inline SALOMEDS::SObject_var GetDomainRoot(const SALOMEDS::SComponent_var& theSComponentMesh, - const SALOMEDS::StudyBuilder_var& theStudyBuilder, - CORBA::Long theDomainRootTag, - const QString& theName, - const QString& thePixmap) + const SALOMEDS::StudyBuilder_var& theStudyBuilder, + CORBA::Long theDomainRootTag, + const QString& theName, + const QString& thePixmap) { SALOMEDS::SObject_var aDomainRoot; if (!theSComponentMesh->FindSubObject(theDomainRootTag,aDomainRoot)) { @@ -98,13 +96,13 @@ namespace inline SALOMEDS::SObject_var GetHypothesisRoot(const SALOMEDS::SComponent_var& theSComponentMesh, - const SALOMEDS::StudyBuilder_var& theStudyBuilder) + const SALOMEDS::StudyBuilder_var& theStudyBuilder) { return GetDomainRoot(theSComponentMesh, - theStudyBuilder, - SMESH::Tag_HypothesisRoot, - QObject::tr("SMESH_MEN_HYPOTHESIS"), - "ICON_SMESH_TREE_HYPO"); + theStudyBuilder, + SMESH::Tag_HypothesisRoot, + QObject::tr("SMESH_MEN_HYPOTHESIS"), + "ICON_SMESH_TREE_HYPO"); } @@ -112,13 +110,13 @@ namespace inline SALOMEDS::SObject_var GetAlgorithmsRoot(const SALOMEDS::SComponent_var& theSComponentMesh, - const SALOMEDS::StudyBuilder_var& theStudyBuilder) + const SALOMEDS::StudyBuilder_var& theStudyBuilder) { return GetDomainRoot(theSComponentMesh, - theStudyBuilder, - SMESH::Tag_AlgorithmsRoot, - QObject::tr("SMESH_MEN_ALGORITHMS"), - "ICON_SMESH_TREE_ALGO"); + theStudyBuilder, + SMESH::Tag_AlgorithmsRoot, + QObject::tr("SMESH_MEN_ALGORITHMS"), + "ICON_SMESH_TREE_ALGO"); } @@ -126,17 +124,17 @@ namespace inline SALOMEDS::SObject_var AddToDomain(const std::string& theIOR, - const SALOMEDS::SComponent_var& theSComponentMesh, - const SALOMEDS::StudyBuilder_var& theStudyBuilder, - CORBA::Long theDomainRootTag, - const QString& theDomainName, - const QString& theDomainPixmap) + const SALOMEDS::SComponent_var& theSComponentMesh, + const SALOMEDS::StudyBuilder_var& theStudyBuilder, + CORBA::Long theDomainRootTag, + const QString& theDomainName, + const QString& theDomainPixmap) { SALOMEDS::SObject_var aDomain = GetDomainRoot(theSComponentMesh, - theStudyBuilder, - SMESH::Tag_AlgorithmsRoot, - theDomainName, - theDomainPixmap); + theStudyBuilder, + SMESH::Tag_AlgorithmsRoot, + theDomainName, + theDomainPixmap); // Add New Hypothesis SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(aDomain); SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap"); @@ -157,42 +155,42 @@ namespace //--------------------------------------------------------------- SALOMEDS::SObject_var AddHypothesis(const std::string& theIOR, - const SALOMEDS::SComponent_var& theSComponentMesh, - const SALOMEDS::StudyBuilder_var& theStudyBuilder) + const SALOMEDS::SComponent_var& theSComponentMesh, + const SALOMEDS::StudyBuilder_var& theStudyBuilder) { return AddToDomain(theIOR, - theSComponentMesh, - theStudyBuilder, - SMESH::Tag_HypothesisRoot, - QObject::tr("SMESH_MEN_HYPOTHESIS"), - "ICON_SMESH_TREE_HYPO"); + theSComponentMesh, + theStudyBuilder, + SMESH::Tag_HypothesisRoot, + QObject::tr("SMESH_MEN_HYPOTHESIS"), + "ICON_SMESH_TREE_HYPO"); } //--------------------------------------------------------------- SALOMEDS::SObject_var AddAlgorithms(const std::string& theIOR, - const SALOMEDS::SComponent_var& theSComponentMesh, - const SALOMEDS::StudyBuilder_var& theStudyBuilder) + const SALOMEDS::SComponent_var& theSComponentMesh, + const SALOMEDS::StudyBuilder_var& theStudyBuilder) { return AddToDomain(theIOR, - theSComponentMesh, - theStudyBuilder, - SMESH::Tag_AlgorithmsRoot, - QObject::tr("SMESH_MEN_ALGORITHMS"), - "ICON_SMESH_TREE_ALGO"); + theSComponentMesh, + theStudyBuilder, + SMESH::Tag_AlgorithmsRoot, + QObject::tr("SMESH_MEN_ALGORITHMS"), + "ICON_SMESH_TREE_ALGO"); } //--------------------------------------------------------------- void SetDomain(const char* theMeshOrSubMeshEntry, - const char* theDomainEntry, - const SALOMEDS::Study_var& theStudy, - const SALOMEDS::StudyBuilder_var& theStudyBuilder, - long theRefOnAppliedDomainTag, - const QString& theAppliedDomainMEN, - const QString& theAppliedDomainICON) + const char* theDomainEntry, + const SALOMEDS::Study_var& theStudy, + const SALOMEDS::StudyBuilder_var& theStudyBuilder, + long theRefOnAppliedDomainTag, + const QString& theAppliedDomainMEN, + const QString& theAppliedDomainICON) { SALOMEDS::SObject_var aMeshOrSubMeshSO = theStudy->FindObjectID(theMeshOrSubMeshEntry); SALOMEDS::SObject_var aHypothesisSO = theStudy->FindObjectID(theDomainEntry); @@ -201,17 +199,17 @@ namespace //Find or Create Applied Hypothesis root SALOMEDS::SObject_var anAppliedDomainSO; if(!aMeshOrSubMeshSO->FindSubObject(theRefOnAppliedDomainTag,anAppliedDomainSO)){ - anAppliedDomainSO = theStudyBuilder->NewObjectToTag(aMeshOrSubMeshSO,theRefOnAppliedDomainTag); - SALOMEDS::GenericAttribute_var anAttr = - theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeName"); - SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(theAppliedDomainMEN.toLatin1().data()); - anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeSelectable"); - SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); - aSelAttr->SetSelectable(false); - anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributePixMap"); - SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - aPixmap->SetPixMap(theAppliedDomainICON.toLatin1().data()); + anAppliedDomainSO = theStudyBuilder->NewObjectToTag(aMeshOrSubMeshSO,theRefOnAppliedDomainTag); + SALOMEDS::GenericAttribute_var anAttr = + theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeName"); + SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(theAppliedDomainMEN.toLatin1().data()); + anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeSelectable"); + SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributePixMap"); + SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap(theAppliedDomainICON.toLatin1().data()); } SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(anAppliedDomainSO); theStudyBuilder->Addreference(aSObject,aHypothesisSO); @@ -222,34 +220,34 @@ namespace //--------------------------------------------------------------- void SetHypothesis(const char* theMeshOrSubMeshEntry, - const char* theDomainEntry, - const SALOMEDS::Study_var& theStudy, - const SALOMEDS::StudyBuilder_var& theStudyBuilder) + const char* theDomainEntry, + const SALOMEDS::Study_var& theStudy, + const SALOMEDS::StudyBuilder_var& theStudyBuilder) { SetDomain(theMeshOrSubMeshEntry, - theDomainEntry, - theStudy, - theStudyBuilder, - SMESH::Tag_RefOnAppliedHypothesis, - QObject::tr("SMESH_MEN_APPLIED_HYPOTHESIS"), - "ICON_SMESH_TREE_HYPO"); + theDomainEntry, + theStudy, + theStudyBuilder, + SMESH::Tag_RefOnAppliedHypothesis, + QObject::tr("SMESH_MEN_APPLIED_HYPOTHESIS"), + "ICON_SMESH_TREE_HYPO"); } //--------------------------------------------------------------- void SetAlgorithms(const char* theMeshOrSubMeshEntry, - const char* theDomainEntry, - const SALOMEDS::Study_var& theStudy, - const SALOMEDS::StudyBuilder_var& theStudyBuilder) + const char* theDomainEntry, + const SALOMEDS::Study_var& theStudy, + const SALOMEDS::StudyBuilder_var& theStudyBuilder) { SetDomain(theMeshOrSubMeshEntry, - theDomainEntry, - theStudy, - theStudyBuilder, - SMESH::Tag_RefOnAppliedAlgorithms, - QObject::tr("SMESH_MEN_APPLIED_ALGORIHTMS"), - "ICON_SMESH_TREE_ALGO"); + theDomainEntry, + theStudy, + theStudyBuilder, + SMESH::Tag_RefOnAppliedAlgorithms, + QObject::tr("SMESH_MEN_APPLIED_ALGORIHTMS"), + "ICON_SMESH_TREE_ALGO"); } } @@ -271,11 +269,11 @@ SMESH_Swig::SMESH_Swig() Execute() { try { - ORB_INIT &anORBInit = *SINGLETON_::Instance(); - ASSERT(SINGLETON_::IsAlreadyExisting()); - myORB = anORBInit( 0, 0 ); + ORB_INIT &anORBInit = *SINGLETON_::Instance(); + ASSERT(SINGLETON_::IsAlreadyExisting()); + myORB = anORBInit( 0, 0 ); } catch (...) { - INFOS("internal error : orb not found"); + INFOS("internal error : orb not found"); } } }; @@ -301,9 +299,9 @@ SMESH_Swig::Init(int theStudyID) SALOMEDS::SComponent_var& mySComponentMesh; public: TEvent(int theStudyID, - SALOMEDS::Study_var& theStudy, - SALOMEDS::StudyBuilder_var& theStudyBuilder, - SALOMEDS::SComponent_var& theSComponentMesh): + SALOMEDS::Study_var& theStudy, + SALOMEDS::StudyBuilder_var& theStudyBuilder, + SALOMEDS::SComponent_var& theSComponentMesh): myStudyID(theStudyID), myStudy(theStudy), myStudyBuilder(theStudyBuilder), @@ -334,28 +332,28 @@ SMESH_Swig::Init(int theStudyID) SALOMEDS::SComponent_var aSComponent = myStudy->FindComponent("SMESH"); if(aSComponent->_is_nil()){ - bool aLocked = myStudy->GetProperties()->IsLocked(); - if (aLocked) - myStudy->GetProperties()->SetLocked(false); - - aSComponent = myStudyBuilder->NewComponent("SMESH"); - anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - - SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI(); //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded - if (!aSMESHGUI){ - CAM_Module* aModule = anApp->module("Mesh"); - if(!aModule) - aModule = anApp->loadModule("Mesh"); - aSMESHGUI = dynamic_cast(aModule); - } //SRN: BugID IPAL9186: end of a fix - aName->SetValue(aSMESHGUI->moduleName().toLatin1().data()); - anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" ); - myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen); - if (aLocked) - myStudy->GetProperties()->SetLocked(true); + bool aLocked = myStudy->GetProperties()->IsLocked(); + if (aLocked) + myStudy->GetProperties()->SetLocked(false); + + aSComponent = myStudyBuilder->NewComponent("SMESH"); + anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + + SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI(); //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded + if (!aSMESHGUI){ + CAM_Module* aModule = anApp->module("Mesh"); + if(!aModule) + aModule = anApp->loadModule("Mesh"); + aSMESHGUI = dynamic_cast(aModule); + } //SRN: BugID IPAL9186: end of a fix + aName->SetValue(aSMESHGUI->moduleName().toLatin1().data()); + anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" ); + myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen); + if (aLocked) + myStudy->GetProperties()->SetLocked(true); } mySComponentMesh = SALOMEDS::SComponent::_narrow(aSComponent); @@ -367,9 +365,9 @@ SMESH_Swig::Init(int theStudyID) MESSAGE("Init"); ProcessVoidEvent(new TEvent(theStudyID, - myStudy, - myStudyBuilder, - mySComponentMesh)); + myStudy, + myStudyBuilder, + mySComponentMesh)); } @@ -414,8 +412,8 @@ const char* SMESH_Swig::AddNewHypothesis(const char* theIOR) MESSAGE("AddNewHypothesis"); SALOMEDS::SObject_var aSObject = ::AddHypothesis(theIOR, - mySComponentMesh, - myStudyBuilder); + mySComponentMesh, + myStudyBuilder); CORBA::String_var anEntry = aSObject->GetID(); return anEntry._retn(); } @@ -427,8 +425,8 @@ const char* SMESH_Swig::AddNewAlgorithms(const char* theIOR) MESSAGE("AddNewAlgorithms"); SALOMEDS::SObject_var aSObject = ::AddAlgorithms(theIOR, - mySComponentMesh, - myStudyBuilder); + mySComponentMesh, + myStudyBuilder); CORBA::String_var anEntry = aSObject->GetID(); return anEntry._retn(); } @@ -453,9 +451,9 @@ void SMESH_Swig::SetHypothesis(const char* theMeshOrSubMeshEntry, const char* theDomainEntry) { ::SetHypothesis(theMeshOrSubMeshEntry, - theDomainEntry, - myStudy, - myStudyBuilder); + theDomainEntry, + myStudy, + myStudyBuilder); } @@ -464,9 +462,9 @@ void SMESH_Swig::SetAlgorithms(const char* theMeshOrSubMeshEntry, const char* theDomainEntry) { ::SetAlgorithms(theMeshOrSubMeshEntry, - theDomainEntry, - myStudy, - myStudyBuilder); + theDomainEntry, + myStudy, + myStudyBuilder); } @@ -599,7 +597,7 @@ void SMESH_Swig::SetName(const char* theEntry, //================================================================================ void SMESH_Swig::SetMeshIcon(const char* theMeshEntry, - const bool theIsComputed, + const bool theIsComputed, const bool isEmpty) { class TEvent: public SALOME_Event @@ -609,8 +607,8 @@ void SMESH_Swig::SetMeshIcon(const char* theMeshEntry, bool myIsComputed, myIsEmpty; public: TEvent(const SALOMEDS::Study_var& theStudy, - const std::string& theMeshEntry, - const bool theIsComputed, + const std::string& theMeshEntry, + const bool theIsComputed, const bool isEmpty): myStudy(theStudy), myMeshEntry(theMeshEntry), @@ -624,13 +622,13 @@ void SMESH_Swig::SetMeshIcon(const char* theMeshEntry, { SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID(myMeshEntry.c_str()); if(!aMeshSO->_is_nil()) - if(_PTR(SObject) aMesh = ClientFactory::SObject(aMeshSO)) - SMESH::ModifiedMesh(aMesh,myIsComputed,myIsEmpty); + if(_PTR(SObject) aMesh = ClientFactory::SObject(aMeshSO)) + SMESH::ModifiedMesh(aMesh,myIsComputed,myIsEmpty); } }; ProcessVoidEvent(new TEvent(myStudy, - theMeshEntry, - theIsComputed, + theMeshEntry, + theIsComputed, isEmpty)); } diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h index bf60f35ff..7e7f1c600 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : GUI for SMESH component // File : libSMESH_Swig.h // Author : Nicolas REJNERI, Open CASCADE S.A.S. diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i index a865a8e95..bd795139c 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESHGUI : GUI for SMESH component // File : libSMESH_Swig.i // Author : Nicolas REJNERI, Open CASCADE S.A.S. diff --git a/src/StdMeshers/Makefile.am b/src/StdMeshers/Makefile.am index 1b51b3afb..ca9794c84 100644 --- a/src/StdMeshers/Makefile.am +++ b/src/StdMeshers/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # SMESH StdMeshers : implementaion of SMESH idl descriptions # File : Makefile.in # Author : Julia DOROVSKIKH @@ -73,7 +71,8 @@ salomeinclude_HEADERS = \ StdMeshers_CompositeHexa_3D.hxx \ StdMeshers_MaxLength.hxx \ StdMeshers_QuadrangleParams.hxx \ - StdMeshers_RadialQuadrangle_1D2D.hxx + StdMeshers_RadialQuadrangle_1D2D.hxx \ + StdMeshers_HexaFromSkin_3D.hxx # Libraries targets @@ -123,7 +122,8 @@ dist_libStdMeshers_la_SOURCES = \ StdMeshers_CompositeHexa_3D.cxx \ StdMeshers_MaxLength.cxx \ StdMeshers_QuadrangleParams.cxx \ - StdMeshers_RadialQuadrangle_1D2D.cxx + StdMeshers_RadialQuadrangle_1D2D.cxx \ + StdMeshers_HexaFromSkin_3D.cxx # additionnal information to compil and link file diff --git a/src/StdMeshers/SMESH_StdMeshers.hxx b/src/StdMeshers/SMESH_StdMeshers.hxx index aeee7480d..d65e082fb 100755 --- a/src/StdMeshers/SMESH_StdMeshers.hxx +++ b/src/StdMeshers/SMESH_StdMeshers.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_StdMeshers.hxx // Author : Alexander BORODIN // Module : SMESH diff --git a/src/StdMeshers/StdMeshers_Arithmetic1D.cxx b/src/StdMeshers/StdMeshers_Arithmetic1D.cxx index a24909a0c..9752bc6c4 100644 --- a/src/StdMeshers/StdMeshers_Arithmetic1D.cxx +++ b/src/StdMeshers/StdMeshers_Arithmetic1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Arithmetic1D.cxx // Author : Damien COQUERET, OCC diff --git a/src/StdMeshers/StdMeshers_Arithmetic1D.hxx b/src/StdMeshers/StdMeshers_Arithmetic1D.hxx index e3f3c37a8..c65e17b67 100644 --- a/src/StdMeshers/StdMeshers_Arithmetic1D.hxx +++ b/src/StdMeshers/StdMeshers_Arithmetic1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Arithmetic1D.hxx // Author : Damien COQUERET, OCC diff --git a/src/StdMeshers/StdMeshers_AutomaticLength.cxx b/src/StdMeshers/StdMeshers_AutomaticLength.cxx index 95710c94e..e7bd4e993 100644 --- a/src/StdMeshers/StdMeshers_AutomaticLength.cxx +++ b/src/StdMeshers/StdMeshers_AutomaticLength.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_AutomaticLength.cxx // Author : Edward AGAPOV, OCC diff --git a/src/StdMeshers/StdMeshers_AutomaticLength.hxx b/src/StdMeshers/StdMeshers_AutomaticLength.hxx index 627003aa6..0bf8aa25c 100644 --- a/src/StdMeshers/StdMeshers_AutomaticLength.hxx +++ b/src/StdMeshers/StdMeshers_AutomaticLength.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,11 +19,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_AutomaticLength.hxx // Author : Edward AGAPOV, OCC // Module : SMESH - +// #ifndef _SMESH_AutomaticLength_HXX_ #define _SMESH_AutomaticLength_HXX_ diff --git a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx index 38bbdeaf3..d55c17513 100644 --- a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx @@ -1,29 +1,28 @@ -// SMESH SMESH : implementaion of SMESH idl descriptions +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_CompositeHexa_3D.cxx // Module : SMESH // Created : Tue Nov 25 11:04:59 2008 // Author : Edward AGAPOV (eap) - +// #include "StdMeshers_CompositeHexa_3D.hxx" #include "SMDS_Mesh.hxx" diff --git a/src/StdMeshers/StdMeshers_CompositeHexa_3D.hxx b/src/StdMeshers/StdMeshers_CompositeHexa_3D.hxx index 8fd14ba06..01b373d86 100644 --- a/src/StdMeshers/StdMeshers_CompositeHexa_3D.hxx +++ b/src/StdMeshers/StdMeshers_CompositeHexa_3D.hxx @@ -1,29 +1,26 @@ -// SMESH SMESH : implementaion of SMESH idl descriptions +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_CompositeBlock_3D.hxx // Module : SMESH - +// #ifndef _SMESH_CompositeSegment_1D_HXX_ #define _SMESH_CompositeSegment_1D_HXX_ @@ -48,7 +45,7 @@ public: //virtual ~StdMeshers_CompositeHexa_3D(); virtual bool Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape); + const TopoDS_Shape& aShape); virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, MapShapeNbElems& aResMap); diff --git a/src/StdMeshers/StdMeshers_CompositeSegment_1D.cxx b/src/StdMeshers/StdMeshers_CompositeSegment_1D.cxx index eee3ef012..17161d9ef 100644 --- a/src/StdMeshers/StdMeshers_CompositeSegment_1D.cxx +++ b/src/StdMeshers/StdMeshers_CompositeSegment_1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Regular_1D.cxx // Moved here from SMESH_Regular_1D.cxx @@ -73,15 +74,16 @@ namespace { */ //================================================================================ - TopoDS_Edge nextC1Edge(const TopoDS_Edge& edge, - SMESH_Mesh & aMesh, - const bool forward) + TopoDS_Edge nextC1Edge(TopoDS_Edge edge, + SMESH_Mesh & aMesh, + const bool forward) { + if (edge.Orientation() > TopAbs_REVERSED) // INTERNAL + edge.Orientation( TopAbs_FORWARD ); TopoDS_Edge eNext; TopTools_MapOfShape edgeCounter; edgeCounter.Add( edge ); - TopoDS_Vertex v; - v = forward ? TopExp::LastVertex( edge,1 ) : TopExp::FirstVertex( edge,1 ); + TopoDS_Vertex v = forward ? TopExp::LastVertex(edge,true) : TopExp::FirstVertex(edge,true); TopTools_ListIteratorOfListOfShape ancestIt = aMesh.GetAncestors( v ); for ( ; ancestIt.More(); ancestIt.Next() ) { @@ -92,11 +94,11 @@ namespace { if ( edgeCounter.Extent() < 3 && !eNext.IsNull() ) { if ( SMESH_Algo::IsContinuous( edge, eNext )) { // care of orientation - bool reverse; - if ( forward ) - reverse = ( !v.IsSame( TopExp::FirstVertex( eNext, true ))); - else - reverse = ( !v.IsSame( TopExp::LastVertex( eNext, true ))); + if (eNext.Orientation() > TopAbs_REVERSED) // INTERNAL + eNext.Orientation( TopAbs_FORWARD ); + TopoDS_Vertex vn = + forward ? TopExp::FirstVertex(eNext,true) : TopExp::LastVertex(eNext,true); + bool reverse = (!v.IsSame(vn)); if ( reverse ) eNext.Reverse(); return eNext; @@ -297,14 +299,17 @@ StdMeshers_CompositeSegment_1D::GetFaceSide(SMESH_Mesh& aMesh, const bool ignoreMeshed) { list< TopoDS_Edge > edges; - edges.push_back( anEdge ); + if ( anEdge.Orientation() <= TopAbs_REVERSED ) + edges.push_back( anEdge ); + else + edges.push_back( TopoDS::Edge( anEdge.Oriented( TopAbs_FORWARD ))); // PAL21718 list hypList; SMESH_Algo* theAlgo = aMesh.GetGen()->GetAlgo( aMesh, anEdge ); if ( theAlgo ) hypList = theAlgo->GetUsedHypothesis(aMesh, anEdge, false); for ( int forward = 0; forward < 2; ++forward ) { - TopoDS_Edge eNext = nextC1Edge( anEdge, aMesh, forward ); + TopoDS_Edge eNext = nextC1Edge( edges.back(), aMesh, forward ); while ( !eNext.IsNull() ) { if ( ignoreMeshed ) { // eNext must not have computed mesh diff --git a/src/StdMeshers/StdMeshers_CompositeSegment_1D.hxx b/src/StdMeshers/StdMeshers_CompositeSegment_1D.hxx index 1ec160335..7f003f4ae 100644 --- a/src/StdMeshers/StdMeshers_CompositeSegment_1D.hxx +++ b/src/StdMeshers/StdMeshers_CompositeSegment_1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_CompositeSegment_1D.hxx // Module : SMESH @@ -43,7 +44,7 @@ public: virtual ~StdMeshers_CompositeSegment_1D(); virtual bool Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape); + const TopoDS_Shape& aShape); /*! * \brief Sets event listener to submeshes if necessary * \param subMesh - submesh where algo is set diff --git a/src/StdMeshers/StdMeshers_Deflection1D.cxx b/src/StdMeshers/StdMeshers_Deflection1D.cxx index 42ad9219a..7a8650601 100644 --- a/src/StdMeshers/StdMeshers_Deflection1D.cxx +++ b/src/StdMeshers/StdMeshers_Deflection1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers_Deflection1D : implementaion of SMESH idl descriptions // File : StdMeshers_Deflection1D.cxx // Module : SMESH diff --git a/src/StdMeshers/StdMeshers_Deflection1D.hxx b/src/StdMeshers/StdMeshers_Deflection1D.hxx index a3cf19b70..8a92b037c 100644 --- a/src/StdMeshers/StdMeshers_Deflection1D.hxx +++ b/src/StdMeshers/StdMeshers_Deflection1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,11 +19,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_Deflection1D.hxx // Module : SMESH // - #ifndef _StdMeshers_Deflection1D_HXX_ #define _StdMeshers_Deflection1D_HXX_ diff --git a/src/StdMeshers/StdMeshers_Distribution.cxx b/src/StdMeshers/StdMeshers_Distribution.cxx index f2e591f34..974c7ffa7 100644 --- a/src/StdMeshers/StdMeshers_Distribution.cxx +++ b/src/StdMeshers/StdMeshers_Distribution.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers : implementaion of point distribution algorithm // File : StdMeshers_Distribution.cxx // Author : Alexandre SOLOVYOV @@ -303,21 +304,21 @@ double dihotomySolve( Function& f, const double val, const double _start, const } bool buildDistribution( const TCollection_AsciiString& f, const int conv, const double start, const double end, - const int nbSeg, vector& data, const double eps ) + const int nbSeg, vector& data, const double eps ) { FunctionExpr F( f.ToCString(), conv ); return buildDistribution( F, start, end, nbSeg, data, eps ); } bool buildDistribution( const std::vector& f, const int conv, const double start, const double end, - const int nbSeg, vector& data, const double eps ) + const int nbSeg, vector& data, const double eps ) { FunctionTable F( f, conv ); return buildDistribution( F, start, end, nbSeg, data, eps ); } bool buildDistribution( const Function& func, const double start, const double end, const int nbSeg, - vector& data, const double eps ) + vector& data, const double eps ) { if( nbSeg<=0 ) return false; diff --git a/src/StdMeshers/StdMeshers_Distribution.hxx b/src/StdMeshers/StdMeshers_Distribution.hxx index 373305b63..2f5214a2b 100644 --- a/src/StdMeshers/StdMeshers_Distribution.hxx +++ b/src/StdMeshers/StdMeshers_Distribution.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers : implementaion of point distribution algorithm // File : StdMeshers_Distribution.hxx // Author : Alexandre SOLOVYOV @@ -102,16 +103,16 @@ private: STDMESHERS_EXPORT bool buildDistribution( const Function& f, - const double start, const double end, - const int nbSeg, - std::vector& data, - const double eps ); + const double start, const double end, + const int nbSeg, + std::vector& data, + const double eps ); STDMESHERS_EXPORT bool buildDistribution( const TCollection_AsciiString& f, const int conv, const double start, const double end, - const int nbSeg, std::vector& data, const double eps ); + const int nbSeg, std::vector& data, const double eps ); STDMESHERS_EXPORT bool buildDistribution( const std::vector& f, const int conv, const double start, const double end, - const int nbSeg, std::vector& data, const double eps ); + const int nbSeg, std::vector& data, const double eps ); #endif diff --git a/src/StdMeshers/StdMeshers_FaceSide.cxx b/src/StdMeshers/StdMeshers_FaceSide.cxx index f34def734..3a8d36530 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.cxx +++ b/src/StdMeshers/StdMeshers_FaceSide.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_FaceSide.hxx // Created : Wed Jan 31 18:41:25 2007 @@ -31,7 +32,7 @@ #include "SMDS_MeshNode.hxx" #include "SMESHDS_Mesh.hxx" #include "SMESHDS_SubMesh.hxx" -//#include "SMESH_Algo.hxx" +#include "SMESH_Algo.hxx" #include "SMESH_Mesh.hxx" #include "SMESH_MesherHelper.hxx" #include "SMESH_ComputeError.hxx" @@ -44,10 +45,14 @@ #include #include #include +#include #include #include #include +#include +#include + #include #include "utilities.h" @@ -87,9 +92,12 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace, int nbEdges = theEdges.size(); myEdge.resize( nbEdges ); myC2d.resize( nbEdges ); + myC3dAdaptor.resize( nbEdges ); myFirst.resize( nbEdges ); myLast.resize( nbEdges ); myNormPar.resize( nbEdges ); + myEdgeLength.resize( nbEdges ); + myIsUniform.resize( nbEdges, true ); myLength = 0; myNbPonits = myNbSegments = 0; myMesh = theMesh; @@ -99,16 +107,16 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace, if ( nbEdges == 0 ) return; SMESHDS_Mesh* meshDS = theMesh->GetMeshDS(); - vector len( nbEdges ); int nbDegen = 0; list::iterator edge = theEdges.begin(); + TopoDS_Iterator vExp; for ( int index = 0; edge != theEdges.end(); ++index, ++edge ) { int i = theIsForward ? index : nbEdges - index - 1; - len[i] = SMESH_Algo::EdgeLength( *edge ); - if ( len[i] < DBL_MIN ) nbDegen++; - myLength += len[i]; + myEdgeLength[i] = SMESH_Algo::EdgeLength( *edge ); + if ( myEdgeLength[i] < DBL_MIN ) nbDegen++; + myLength += myEdgeLength[i]; myEdge[i] = *edge; if ( !theIsForward ) myEdge[i].Reverse(); @@ -129,16 +137,41 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace, myNbPonits += nbN; myNbSegments += sm->NbElements(); } - if ( SMESH_Algo::VertexNode( TopExp::FirstVertex( *edge, 1), meshDS )) + // TopExp::FirstVertex() and TopExp::LastVertex() return NULL from INTERNAL edge + vExp.Initialize( *edge ); + if ( vExp.Value().Orientation() == TopAbs_REVERSED ) vExp.Next(); + if ( SMESH_Algo::VertexNode( TopoDS::Vertex( vExp.Value()), meshDS )) myNbPonits += 1; // for the first end else myMissingVertexNodes = true; - } - if ( SMESH_Algo::VertexNode( TopExp::LastVertex( theEdges.back(), 1), meshDS )) - myNbPonits++; // for the last end - else - myMissingVertexNodes = true; + // check if edge has non-uniform parametrization (issue 0020705) + if ( !myC2d[i].IsNull() && myEdgeLength[i] > DBL_MIN) + { + Geom2dAdaptor_Curve A2dC( myC2d[i] ); + double p2 = myFirst[i]+(myLast[i]-myFirst[i])/2., p4 = myFirst[i]+(myLast[i]-myFirst[i])/4.; + double d2 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p2 ); + double d4 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p4 ); + //cout<<"len = "<GetNodes(); + if ( u2nodeVec.empty() ) + while ( nItr->more() ) + { + const SMDS_MeshNode* node = nItr->next(); + if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge )) + continue; + double u = helper.GetNodeU( myEdge[i], node, 0, ¶mOK ); + + // paramSize is signed so orientation is taken into account + double normPar = prevNormPar + r * ( u - myFirst[i] ) / paramSize; + u2nodeVec.push_back( make_pair( normPar, node )); + } + u2node.insert( u2nodeVec.begin(), u2nodeVec.end() ); + + // Put 2nd vertex node for a last edge if ( i+1 == myEdge.size() ) { - node = SMESH_Algo::VertexNode( VLast, meshDS ); + node = SMESH_Algo::VertexNode( VV[1], meshDS ); if ( !node ) { MESSAGE(" NO NODE on VERTEX" ); return myPoints; } u2node.insert( make_pair( 1., node )); } - - // put internal nodes - SMESHDS_SubMesh* sm = meshDS->MeshElements( myEdge[i] ); - if ( !sm ) continue; - SMDS_NodeIteratorPtr nItr = sm->GetNodes(); - double paramSize = myLast[i] - myFirst[i], r = myNormPar[i] - prevNormPar; - while ( nItr->more() ) { - const SMDS_MeshNode* node = nItr->next(); - if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge )) - continue; - const SMDS_EdgePosition* epos = - static_cast(node->GetPosition()); - double u = epos->GetUParameter(); - // paramSize is signed so orientation is taken into account - double normPar = prevNormPar + r * ( u - myFirst[i] ) / paramSize; -#ifdef _DEBUG_ - if ( normPar > 1 || normPar < 0) { - dump("DEBUG"); - MESSAGE ( "WRONG normPar: "< 1 ) { reverse( myEdge ); reverse( myC2d ); + reverse( myC3dAdaptor ); reverse( myFirst ); reverse( myLast ); reverse( myNormPar ); + reverse( myEdgeLength ); + reverse( myIsUniform ); } myNormPar[nbEdges-1]=1.; myPoints.clear(); @@ -483,6 +539,7 @@ BRepAdaptor_CompCurve* StdMeshers_FaceSide::GetCurve3d() const return new BRepAdaptor_CompCurve( aWire ); } + //================================================================================ /*! * \brief Return 2D point by normalized parameter @@ -497,9 +554,22 @@ gp_Pnt2d StdMeshers_FaceSide::Value2d(double U) const int i = EdgeIndex( U ); double prevU = i ? myNormPar[ i-1 ] : 0; double r = ( U - prevU )/ ( myNormPar[ i ] - prevU ); - return myC2d[ i ]->Value( myFirst[i] * ( 1 - r ) + myLast[i] * r ); + + double par = myFirst[i] * ( 1 - r ) + myLast[i] * r; + + // check parametrization of curve + if( !myIsUniform[i] ) + { + double aLen3dU = r * myEdgeLength[i] * ( myFirst[i]>myLast[i] ? -1. : 1.); + GCPnts_AbscissaPoint AbPnt + ( const_cast( myC3dAdaptor[i]), aLen3dU, myFirst[i] ); + if( AbPnt.IsDone() ) { + par = AbPnt.Parameter(); + } + } + return myC2d[ i ]->Value(par); + } - //return gp_Pnt2d( 1e+100, 1e+100 ); return myDefaultPnt2d; } @@ -527,20 +597,28 @@ TSideVector StdMeshers_FaceSide::GetFaceWires(const TopoDS_Face& theFace, for ( int iW = 0; iW < nbWires; ++iW ) { std::advance( to, *nbE++ ); + if ( *nbE == 0 ) // Issue 0020676 + { + --nbWires; + --iW; + wires.resize( nbWires ); + continue; + } list< TopoDS_Edge > wireEdges( from, to ); // assure that there is a node on the first vertex // as StdMeshers_FaceSide::GetUVPtStruct() requires - while ( !SMESH_Algo::VertexNode( TopExp::FirstVertex( wireEdges.front(), true), - theMesh.GetMeshDS())) - { - wireEdges.splice(wireEdges.end(), wireEdges, - wireEdges.begin(), ++wireEdges.begin()); - if ( from->IsSame( wireEdges.front() )) { - theError = TError - ( new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH,"No nodes on vertices")); - return TSideVector(0); + if ( wireEdges.front().Orientation() != TopAbs_INTERNAL ) // Issue 0020676 + while ( !SMESH_Algo::VertexNode( TopExp::FirstVertex( wireEdges.front(), true), + theMesh.GetMeshDS())) + { + wireEdges.splice(wireEdges.end(), wireEdges, + wireEdges.begin(), ++wireEdges.begin()); + if ( from->IsSame( wireEdges.front() )) { + theError = TError + ( new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH,"No nodes on vertices")); + return TSideVector(0); + } } - } const bool isForward = true; StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh, isForward, theIgnoreMediumNodes); @@ -550,3 +628,42 @@ TSideVector StdMeshers_FaceSide::GetFaceWires(const TopoDS_Face& theFace, return wires; } +//================================================================================ +/*! + * \brief Return 1st vertex of the i-the edge + */ +//================================================================================ + +TopoDS_Vertex StdMeshers_FaceSide::FirstVertex(int i) const +{ + TopoDS_Vertex v; + if ( i < NbEdges() ) + { + v = myEdge[i].Orientation() <= TopAbs_REVERSED ? // FORWARD || REVERSED + TopExp::FirstVertex( myEdge[i], 1 ) : + TopoDS::Vertex( TopoDS_Iterator( myEdge[i] ).Value() ); + } + return v; +} + +//================================================================================ +/*! + * \brief Return last vertex of the i-the edge + */ +//================================================================================ + +TopoDS_Vertex StdMeshers_FaceSide::LastVertex(int i) const +{ + TopoDS_Vertex v; + if ( i < NbEdges() ) + { + const TopoDS_Edge& edge = i<0 ? myEdge[ NbEdges() + i ] : myEdge[i]; + if ( edge.Orientation() <= TopAbs_REVERSED ) // FORWARD || REVERSED + v = TopExp::LastVertex( edge, 1 ); + else + for ( TopoDS_Iterator vIt( edge ); vIt.More(); vIt.Next() ) + v = TopoDS::Vertex( vIt.Value() ); + } + return v; +} + diff --git a/src/StdMeshers/StdMeshers_FaceSide.hxx b/src/StdMeshers/StdMeshers_FaceSide.hxx index 8382a8fbd..69d3f87a8 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.hxx +++ b/src/StdMeshers/StdMeshers_FaceSide.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_FaceSide.hxx // Created : Wed Jan 31 18:41:25 2007 @@ -28,14 +29,13 @@ #ifndef StdMeshers_FaceSide_HeaderFile #define StdMeshers_FaceSide_HeaderFile -#include +#include +#include #include #include -#include -#include +#include #include "SMESH_StdMeshers.hxx" -#include "SMESH_Algo.hxx" #include #include @@ -47,7 +47,7 @@ class Adaptor2d_Curve2d; class Adaptor3d_Curve; class BRepAdaptor_CompCurve; class TopoDS_Face; -class SMESH_ComputeError; +struct SMESH_ComputeError; typedef struct uvPtStruct { @@ -124,7 +124,7 @@ public: */ SMESH_Mesh* GetMesh() const { return myMesh; } /*! - * \brief Return true if there vertices without nodes + * \brief Return true if there are vertices without nodes */ bool MissVertexNode() const { return myMissingVertexNodes; } /*! @@ -170,11 +170,11 @@ public: /*! * \brief Return 1st vertex of the i-the edge (count starts from zero) */ - inline TopoDS_Vertex FirstVertex(int i=0) const; + TopoDS_Vertex FirstVertex(int i=0) const; /*! * \brief Return last vertex of the i-the edge (count starts from zero) */ - inline TopoDS_Vertex LastVertex(int i=-1) const; + TopoDS_Vertex LastVertex(int i=-1) const; /*! * \brief Return first normalized parameter of the i-the edge (count starts from zero) */ @@ -198,11 +198,16 @@ public: protected: + + // DON't FORGET tO update Reverse() when adding one more vector! std::vector myPoints, myFalsePoints; std::vector myEdge; std::vector myC2d; + std::vector myC3dAdaptor; std::vector myFirst, myLast; std::vector myNormPar; + std::vector myEdgeLength; + std::vector myIsUniform; double myLength; int myNbPonits, myNbSegments; SMESH_Mesh* myMesh; @@ -243,28 +248,6 @@ inline double StdMeshers_FaceSide::Parameter(double U, TopoDS_Edge & edge) const return myFirst[i] * ( 1 - r ) + myLast[i] * r; } -//================================================================================ -/*! - * \brief Return 1st vertex of the i-the edge - */ -//================================================================================ - -inline TopoDS_Vertex StdMeshers_FaceSide::FirstVertex(int i) const -{ - return i < myEdge.size() ? TopExp::FirstVertex( myEdge[i], 1 ) : TopoDS_Vertex(); -} - -//================================================================================ -/*! - * \brief Return last vertex of the i-the edge - */ -//================================================================================ - -inline TopoDS_Vertex StdMeshers_FaceSide::LastVertex(int i) const -{ - return i<0 ? TopExp::LastVertex( myEdge.back(), 1) : i 0 ) { for ( int i = 0; i < listSize; i++) save << " " << _nbsegs[i]; } listSize = _edgeIDs.size(); - save << listSize; + save << " " << listSize; if ( listSize > 0 ) { for ( int i = 0; i < listSize; i++) save << " " << _edgeIDs[i]; @@ -154,6 +152,7 @@ istream & StdMeshers_FixedPoints1D::LoadFrom(istream & load) isOK = (load >> intVal); if (isOK && intVal > 0) { + _params.clear(); _params.reserve( intVal ); for (int i = 0; i < _params.capacity() && isOK; i++) { isOK = (load >> dblVal); @@ -163,6 +162,7 @@ istream & StdMeshers_FixedPoints1D::LoadFrom(istream & load) isOK = (load >> intVal); if (isOK && intVal > 0) { + _nbsegs.clear(); _nbsegs.reserve( intVal ); for (int i = 0; i < _nbsegs.capacity() && isOK; i++) { isOK = (load >> intVal); @@ -172,6 +172,7 @@ istream & StdMeshers_FixedPoints1D::LoadFrom(istream & load) isOK = (load >> intVal); if (isOK && intVal > 0) { + _edgeIDs.clear(); _edgeIDs.reserve( intVal ); for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) { isOK = (load >> intVal); diff --git a/src/StdMeshers/StdMeshers_FixedPoints1D.hxx b/src/StdMeshers/StdMeshers_FixedPoints1D.hxx index b5126e1c3..4d203e31d 100644 --- a/src/StdMeshers/StdMeshers_FixedPoints1D.hxx +++ b/src/StdMeshers/StdMeshers_FixedPoints1D.hxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_FixedPoints1D.hxx // Author : Damien COQUERET, OCC diff --git a/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx b/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx new file mode 100644 index 000000000..28b628c5c --- /dev/null +++ b/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx @@ -0,0 +1,1071 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : StdMeshers_HexaFromSkin_3D.cxx +// Created : Wed Jan 27 12:28:07 2010 +// Author : Edward AGAPOV (eap) +// +#include "StdMeshers_HexaFromSkin_3D.hxx" + +#include "SMDS_VolumeOfNodes.hxx" +#include "SMDS_VolumeTool.hxx" +#include "SMESH_Block.hxx" +#include "SMESH_MesherHelper.hxx" + +#include + +//#include "utilities.h" + +// Define error message +#ifdef _DEBUG_ +#define BAD_MESH_ERR \ + error(SMESH_Comment("Can't detect block-wise structure of the input 2D mesh.\n" \ + __FILE__ ":" )<<__LINE__) +#else +#define BAD_MESH_ERR \ + error(SMESH_Comment("Can't detect block-wise structure of the input 2D mesh")) +#endif + +// Debug output +#define _DUMP_(msg) //cout << msg << endl + + + +namespace +{ + enum EBoxSides //!< sides of the block + { + B_BOTTOM=0, B_RIGHT, B_TOP, B_LEFT, B_FRONT, B_BACK, B_UNDEFINED + }; + const char* SBoxSides[] = //!< names of block sides + { + "BOTTOM", "RIGHT", "TOP", "LEFT", "FRONT", "BACK", "UNDEFINED" + }; + enum EQuadEdge //!< edges of quadrangle side + { + Q_BOTTOM, Q_RIGHT, Q_TOP, Q_LEFT, Q_UNDEFINED + }; + + + //================================================================================ + /*! + * \brief return logical coordinates (i.e. min or max) of ends of edge + */ + //================================================================================ + + bool getEdgeEnds(EQuadEdge edge, bool& xMax1, bool& yMax1, bool& xMax2, bool& yMax2 ) + { + xMax1=0, yMax1=0, xMax2=1, yMax2=1; + switch( edge ) + { + case Q_BOTTOM: yMax2 = 0; break; + case Q_RIGHT: xMax1 = 1; break; + case Q_TOP: yMax1 = 1; break; + case Q_LEFT: xMax2 = 0; break; + default: + return false; + } + return true; + } + + //================================================================================ + /*! + * \brief return true if a node is at block corner + */ + //================================================================================ + + bool isCornerNode( const SMDS_MeshNode* n ) + { + return n && n->NbInverseElements( SMDSAbs_Face ) % 2; + } + + //================================================================================ + /*! + * \brief check element type + */ + //================================================================================ + + bool isQuadrangle(const SMDS_MeshElement* e) + { + return ( e && e->NbNodes() == ( e->IsQuadratic() ? 8 : 4 )); + } + + //================================================================================ + /*! + * \brief return opposite node of a quadrangle face + */ + //================================================================================ + + const SMDS_MeshNode* oppositeNode(const SMDS_MeshElement* quad, int iNode) + { + return quad->GetNode( (iNode+2) % 4 ); + } + + //================================================================================ + /*! + * \brief Convertor of a pair of integers to a sole index + */ + struct _Indexer + { + int _xSize, _ySize; + _Indexer( int xSize=0, int ySize=0 ): _xSize(xSize), _ySize(ySize) {} + int size() const { return _xSize * _ySize; } + int operator()(int x, int y) const { return y * _xSize + x; } + }; + //================================================================================ + /*! + * \brief Oriented convertor of a pair of integers to a sole index + */ + class _OrientedIndexer : public _Indexer + { + public: + enum OriFlags //!< types of block side orientation + { + REV_X = 1, REV_Y = 2, SWAP_XY = 4, MAX_ORI = REV_X|REV_Y|SWAP_XY + }; + _OrientedIndexer( const _Indexer& indexer, const int oriFlags ): + _Indexer( indexer._xSize, indexer._ySize ), + _xSize (indexer._xSize), _ySize(indexer._ySize), + _xRevFun((oriFlags & REV_X) ? & reverse : & lazy), + _yRevFun((oriFlags & REV_Y) ? & reverse : & lazy), + _swapFun((oriFlags & SWAP_XY ) ? & swap : & lazy) + { + (*_swapFun)( _xSize, _ySize ); + } + //!< Return index by XY + int operator()(int x, int y) const + { + (*_xRevFun)( x, const_cast( _xSize )); + (*_yRevFun)( y, const_cast( _ySize )); + (*_swapFun)( x, y ); + return _Indexer::operator()(x,y); + } + //!< Return index for a corner + int corner(bool xMax, bool yMax) const + { + int x = xMax, y = yMax, size = 2; + (*_xRevFun)( x, size ); + (*_yRevFun)( y, size ); + (*_swapFun)( x, y ); + return _Indexer::operator()(x ? _Indexer::_xSize-1 : 0 , y ? _Indexer::_ySize-1 : 0); + } + int xSize() const { return _xSize; } + int ySize() const { return _ySize; } + private: + _Indexer _indexer; + int _xSize, _ySize; + + typedef void (*TFun)(int& x, int& y); + TFun _xRevFun, _yRevFun, _swapFun; + + static void lazy(int&, int&) {} + static void reverse(int& x, int& size) { x = size - x - 1; } + static void swap(int& x, int& y) { std::swap(x,y); } + }; + //================================================================================ + /*! + * \brief Structure corresponding to the meshed side of block + */ + struct _BlockSide + { + vector _grid; + _Indexer _index; + int _nbBlocksExpected; + int _nbBlocksFound; + +#ifdef _DEBUG_ +#define _grid_access_(args) _grid.at( args ) +#else +#define _grid_access_(args) _grid[ args ] +#endif + //!< Return node at XY + const SMDS_MeshNode* getNode(int x, int y) const { return _grid_access_( _index( x, y )); } + //!< Set node at XY + void setNode(int x, int y, const SMDS_MeshNode* n) { _grid_access_( _index( x, y )) = n; } + //!< Return an edge + SMESH_OrientedLink getEdge(EQuadEdge edge) const + { + bool x1, y1, x2, y2; getEdgeEnds( edge, x1, y1, x2, y2 ); + return SMESH_OrientedLink( getCornerNode ( x1, y1 ), getCornerNode( x2, y2 )); + } + //!< Return a corner node + const SMDS_MeshNode* getCornerNode(bool isXMax, bool isYMax) const + { + return getNode( isXMax ? _index._xSize-1 : 0 , isYMax ? _index._ySize-1 : 0 ); + } + const SMDS_MeshElement* getCornerFace(const SMDS_MeshNode* cornerNode) const; + //!< True if all blocks this side belongs to have beem found + bool isBound() const { return _nbBlocksExpected <= _nbBlocksFound; } + //!< Return coordinates of node at XY + gp_XYZ getXYZ(int x, int y) const { return SMESH_MeshEditor::TNodeXYZ( getNode( x, y )); } + //!< Return gravity center of the four corners and the middle node + gp_XYZ getGC() const + { + gp_XYZ xyz = + getXYZ( 0, 0 ) + + getXYZ( _index._xSize-1, 0 ) + + getXYZ( 0, _index._ySize-1 ) + + getXYZ( _index._xSize-1, _index._ySize-1 ) + + getXYZ( _index._xSize/2, _index._ySize/2 ); + return xyz / 5; + } + //!< Return number of mesh faces + int getNbFaces() const { return (_index._xSize-1) * (_index._ySize-1); } + }; + //================================================================================ + /*! + * \brief _BlockSide with changed orientation + */ + struct _OrientedBlockSide + { + _BlockSide* _side; + _OrientedIndexer _index; + + _OrientedBlockSide( _BlockSide* side=0, const int oriFlags=0 ): + _side(side), _index(side ? side->_index : _Indexer(), oriFlags ) {} + //!< return coordinates by XY + gp_XYZ xyz(int x, int y) const + { + return SMESH_MeshEditor::TNodeXYZ( _side->_grid_access_( _index( x, y )) ); + } + //!< safely return a node by XY + const SMDS_MeshNode* node(int x, int y) const + { + int i = _index( x, y ); + return ( i < 0 || i >= _side->_grid.size()) ? 0 : _side->_grid[i]; + } + //!< Return an edge + SMESH_OrientedLink edge(EQuadEdge edge) const + { + bool x1, y1, x2, y2; getEdgeEnds( edge, x1, y1, x2, y2 ); + return SMESH_OrientedLink( cornerNode ( x1, y1 ), cornerNode( x2, y2 )); + } + //!< Return a corner node + const SMDS_MeshNode* cornerNode(bool isXMax, bool isYMax) const + { + return _side->_grid_access_( _index.corner( isXMax, isYMax )); + } + //!< return its size in nodes + int getHoriSize() const { return _index.xSize(); } + int getVertSize() const { return _index.ySize(); } + //!< True if _side has been initialized + operator bool() const { return _side; } + //! Direct access to _side + const _BlockSide* operator->() const { return _side; } + _BlockSide* operator->() { return _side; } + }; + //================================================================================ + /*! + * \brief Meshed skin of block + */ + struct _Block + { + _OrientedBlockSide _side[6]; // 6 sides of a sub-block + + const _OrientedBlockSide& getSide(int i) const { return _side[i]; } + bool hasSide( const _OrientedBlockSide& s) const + { + if ( s ) for (int i=0;i<6;++i) if ( _side[i] && _side[i]._side == s._side ) return true; + return false; + } + }; + //================================================================================ + /*! + * \brief Skin mesh possibly containing several meshed blocks + */ + class _Skin + { + public: + + int findBlocks(SMESH_Mesh& mesh); + //!< return i-th block + const _Block& getBlock(int i) const { return _blocks[i]; } + //!< return error description + const SMESH_Comment& error() const { return _error; } + + private: + bool fillSide( _BlockSide& side, const SMDS_MeshElement* cornerQuad); + bool fillRowsUntilCorner(const SMDS_MeshElement* quad, + const SMDS_MeshNode* n1, + const SMDS_MeshNode* n2, + vector& verRow1, + vector& verRow2, + bool alongN1N2 ); + _OrientedBlockSide findBlockSide( EBoxSides startBlockSide, + EQuadEdge sharedSideEdge1, + EQuadEdge sharedSideEdge2); + //!< update own data and data of the side bound to block + void setSideBoundToBlock( _BlockSide& side ) + { + side._nbBlocksFound++; + if ( side.isBound() ) + { + for ( int e = 0; e < int(Q_UNDEFINED); ++e ) + _edge2sides[ side.getEdge( (EQuadEdge) e ) ].erase( &side ); + } + } + //!< store reason of error + int error(const SMESH_Comment& reason) { _error = reason; return 0; } + + SMESH_Comment _error; + + list< _BlockSide > _allSides; + vector< _Block > _blocks; + + //map< const SMDS_MeshNode*, set< _BlockSide* > > _corner2sides; + map< SMESH_OrientedLink, set< _BlockSide* > > _edge2sides; + }; + + //================================================================================ + /*! + * \brief Find and return number of submeshes corresponding to blocks + */ + //================================================================================ + + int _Skin::findBlocks(SMESH_Mesh& mesh) + { + SMESHDS_Mesh* meshDS = mesh.GetMeshDS(); + + // Find a node at any block corner + + SMDS_NodeIteratorPtr nIt = meshDS->nodesIterator(/*idInceasingOrder=*/true); + if ( !nIt->more() ) return error("Empty mesh"); + + const SMDS_MeshNode* nCorner = 0; + while ( nIt->more() ) + { + nCorner = nIt->next(); + if ( isCornerNode( nCorner )) + break; + else + nCorner = 0; + } + if ( !nCorner ) + return BAD_MESH_ERR; + + // -------------------------------------------------------------------- + // Find all block sides starting from mesh faces sharing the corner node + // -------------------------------------------------------------------- + + int nbFacesOnSides = 0; + TIDSortedElemSet cornerFaces; // corner faces of found _BlockSide's + list< const SMDS_MeshNode* > corners( 1, nCorner ); + list< const SMDS_MeshNode* >::iterator corner = corners.begin(); + while ( corner != corners.end() ) + { + SMDS_ElemIteratorPtr faceIt = (*corner)->GetInverseElementIterator( SMDSAbs_Face ); + while ( faceIt->more() ) + { + const SMDS_MeshElement* face = faceIt->next(); + if ( !cornerFaces.insert( face ).second ) + continue; // already loaded block side + + if ( !isQuadrangle( face )) + return error("Non-quadrangle elements in the input mesh"); + + if ( _allSides.empty() || !_allSides.back()._grid.empty() ) + _allSides.push_back( _BlockSide() ); + + _BlockSide& side = _allSides.back(); + if ( !fillSide( side, face ) ) + { + if ( !_error.empty() ) + return false; + } + else + { + for ( int isXMax = 0; isXMax < 2; ++isXMax ) + for ( int isYMax = 0; isYMax < 2; ++isYMax ) + { + const SMDS_MeshNode* nCorner = side.getCornerNode(isXMax,isYMax ); + if ( !isCornerNode( nCorner )) + return BAD_MESH_ERR; + //_corner2sides[ nCorner ].insert( &side ); + corners.push_back( nCorner ); + cornerFaces.insert( side.getCornerFace( nCorner )); + } + for ( int e = 0; e < int(Q_UNDEFINED); ++e ) + _edge2sides[ side.getEdge( (EQuadEdge) e ) ].insert( &side ); + + nbFacesOnSides += side.getNbFaces(); + } + } + ++corner; + + // find block sides of other domains if any + if ( corner == corners.end() && nbFacesOnSides < mesh.NbQuadrangles() ) + { + while ( nIt->more() ) + { + nCorner = nIt->next(); + if ( isCornerNode( nCorner )) + corner = corners.insert( corner, nCorner ); + } + nbFacesOnSides = mesh.NbQuadrangles(); + } + } + + if ( _allSides.empty() ) + return BAD_MESH_ERR; + if ( _allSides.back()._grid.empty() ) + _allSides.pop_back(); + + // --------------------------- + // Organize sides into blocks + // --------------------------- + + // analyse sharing of sides by blocks + int nbBlockSides = 0; // nb of block sides taking into account their sharing + list < _BlockSide >::iterator sideIt = _allSides.begin(); + for ( ; sideIt != _allSides.end(); ++sideIt ) + { + _BlockSide& side = *sideIt; + bool isSharedSide = true; + for ( int e = 0; e < int(Q_UNDEFINED) && isSharedSide; ++e ) + isSharedSide = _edge2sides[ side.getEdge( (EQuadEdge) e ) ].size() > 2; + side._nbBlocksFound = 0; + side._nbBlocksExpected = isSharedSide ? 2 : 1; + nbBlockSides += side._nbBlocksExpected; + } + + // find sides of each block + int nbBlocks = 0; + while ( nbBlockSides >= 6 ) + { + // get any side not bound to all blocks it belongs to + sideIt = _allSides.begin(); + while ( sideIt != _allSides.end() && sideIt->isBound()) + ++sideIt; + + // start searching for block sides from the got side + bool ok = true; + if ( _blocks.empty() || _blocks.back()._side[B_FRONT] ) + _blocks.resize( _blocks.size() + 1 ); + + _Block& block = _blocks.back(); + block._side[B_FRONT] = &(*sideIt); + setSideBoundToBlock( *sideIt ); + nbBlockSides--; + + // edges of neighbour sides of B_FRONT corresponding to front's edges + EQuadEdge edgeOfFront[4] = { Q_BOTTOM, Q_RIGHT, Q_TOP, Q_LEFT }; + EQuadEdge edgeToFind [4] = { Q_BOTTOM, Q_LEFT, Q_BOTTOM, Q_LEFT }; + for ( int i = Q_BOTTOM; ok && i <= Q_LEFT; ++i ) + ok = ( block._side[i] = findBlockSide( B_FRONT, edgeOfFront[i], edgeToFind[i])); + if ( ok ) + ok = ( block._side[B_BACK] = findBlockSide( B_TOP, Q_TOP, Q_TOP )); + + if ( ok ) + { + // check if just found block is same as one of previously found + bool isSame = false; + for ( int i = 1; i < _blocks.size() && !isSame; ++i ) + { + _Block& prevBlock = _blocks[i-1]; + isSame = true; + for ( int j = 0; j < 6 && isSame; ++j ) + isSame = prevBlock.hasSide( block._side[ j ]); + } + ok = !isSame; + } + + // count the found sides + _DUMP_(endl); + for (int i = 0; i < B_UNDEFINED; ++i ) + { + _DUMP_("** Block side "<< SBoxSides[i] <<" "<< block._side[ i ]._side); + if ( block._side[ i ] ) + { + if ( ok && i != B_FRONT) + { + setSideBoundToBlock( *block._side[ i ]._side ); + nbBlockSides--; + } + _DUMP_("Corner 0,0 "<< block._side[ i ].cornerNode(0,0)); + _DUMP_("Corner 1,0 "<< block._side[ i ].cornerNode(1,0)); + _DUMP_("Corner 1,1 "<< block._side[ i ].cornerNode(1,1)); + _DUMP_("Corner 0,1 "<< block._side[ i ].cornerNode(0,1)); + } + else + { + _DUMP_("Not found"<GetNode(i))) + nCorner = firstQuad->GetNode(i); + if ( !nCorner ) return false; + + // get a node on block edge + int iCorner = firstQuad->GetNodeIndex( nCorner ); + const SMDS_MeshNode* nOnEdge = firstQuad->GetNode( (iCorner+1) % 4); + + // find out size of block side + vector horRow1, horRow2, verRow1, verRow2; + if ( !fillRowsUntilCorner( firstQuad, nCorner, nOnEdge, horRow1, horRow2, true ) || + !fillRowsUntilCorner( firstQuad, nCorner, nOnEdge, verRow1, verRow2, false )) + return false; + nbX = horRow1.size(), nbY = verRow1.size(); + + // store found nodes + side._index._xSize = horRow1.size(); + side._index._ySize = verRow1.size(); + side._grid.resize( side._index.size(), NULL ); + + for ( x = 0; x < horRow1.size(); ++x ) + { + side.setNode( x, 0, horRow1[x] ); + side.setNode( x, 1, horRow2[x] ); + } + for ( y = 0; y < verRow1.size(); ++y ) + { + side.setNode( 0, y, verRow1[y] ); + side.setNode( 1, y, verRow2[y] ); + } + } + // Find the rest nodes + + y = 1; // y of the row to fill + TIDSortedElemSet emptySet, avoidSet; + while ( ++y < nbY ) + { + // get next firstQuad in the next row of quadrangles + // + // n2up + // o---o <- y row + // | | + // o---o o o o o <- found nodes + //n1down n2down + // + int i1down, i2down, i2up; + const SMDS_MeshNode* n1down = side.getNode( 0, y-1 ); + const SMDS_MeshNode* n2down = side.getNode( 1, y-1 ); + avoidSet.clear(); avoidSet.insert( firstQuad ); + firstQuad = SMESH_MeshEditor::FindFaceInSet( n1down, n2down, emptySet, avoidSet, + &i1down, &i2down); + if ( !isQuadrangle( firstQuad )) + return BAD_MESH_ERR; + + const SMDS_MeshNode* n2up = oppositeNode( firstQuad, i1down ); + avoidSet.clear(); avoidSet.insert( firstQuad ); + + // find the rest nodes in the y-th row by faces in the row + + x = 1; + while ( ++x < nbX ) + { + const SMDS_MeshElement* quad = SMESH_MeshEditor::FindFaceInSet( n2up, n2down, emptySet, + avoidSet, &i2up, &i2down); + if ( !isQuadrangle( quad )) + return BAD_MESH_ERR; + + n2up = oppositeNode( quad, i2down ); + n2down = oppositeNode( quad, i2up ); + avoidSet.clear(); avoidSet.insert( quad ); + + side.setNode( x, y, n2up ); + } + } + + return true; + } + + //================================================================================ + /*! + * \brief Try to find a block side adjacent to the given side by given edge + */ + //================================================================================ + + _OrientedBlockSide _Skin::findBlockSide( EBoxSides startBlockSide, + EQuadEdge sharedSideEdge1, + EQuadEdge sharedSideEdge2) + { + _Block& block = _blocks.back(); + _OrientedBlockSide& side1 = block._side[ startBlockSide ]; + + // get corner nodes of the given block edge + SMESH_OrientedLink edge = side1.edge( sharedSideEdge1 ); + const SMDS_MeshNode* n1 = edge.node1(); + const SMDS_MeshNode* n2 = edge.node2(); + if ( edge._reversed ) swap( n1, n2 ); + + // find all sides sharing both nodes n1 and n2 + set< _BlockSide* > sidesOnEdge = _edge2sides[ edge ]; // copy a set + + // exclude loaded sides of block from sidesOnEdge + int nbLoadedSides = 0; + for (int i = 0; i < B_UNDEFINED; ++i ) + { + if ( block._side[ i ] ) + { + nbLoadedSides++; + sidesOnEdge.erase( block._side[ i ]._side ); + } + } + int nbSidesOnEdge = sidesOnEdge.size(); + _DUMP_("nbSidesOnEdge "<< nbSidesOnEdge << " " << n1->GetID() << "-" << n2->GetID() ); + if ( nbSidesOnEdge == 0 ) + return 0; + + _BlockSide* foundSide = 0; + if ( nbSidesOnEdge == 1 /*|| nbSidesOnEdge == 2 && nbLoadedSides == 1 */) + { + foundSide = *sidesOnEdge.begin(); + } + else + { + // Select one of found sides most close to startBlockSide + + // gravity center of already loaded block sides + gp_XYZ gc(0,0,0); + for (int i = 0; i < B_UNDEFINED; ++i ) + if ( block._side[ i ] ) + gc += block._side[ i ]._side->getGC(); + gc /= nbLoadedSides; + + gp_XYZ p1 ( n1->X(),n1->Y(),n1->Z()), p2 (n2->X(),n2->Y(),n2->Z()); + gp_Vec p1p2( p1, p2 ); + + const SMDS_MeshElement* face1 = side1->getCornerFace( n1 ); + gp_XYZ p1Op = SMESH_MeshEditor::TNodeXYZ( oppositeNode( face1, face1->GetNodeIndex(n1))); + gp_Vec side1Dir( p1, p1Op ); + gp_Ax2 pln( p1, p1p2, side1Dir ); // plane with normal p1p2 and X dir side1Dir + _DUMP_(" Select adjacent for "<< side1._side << " - side dir (" + << side1Dir.X() << ", " << side1Dir.Y() << ", " << side1Dir.Z() << ")" ); + + map < double , _BlockSide* > angleOfSide; + set< _BlockSide* >::iterator sideIt = sidesOnEdge.begin(); + for (; sideIt != sidesOnEdge.end(); ++sideIt ) + { + _BlockSide* sideI = *sideIt; + const SMDS_MeshElement* faceI = sideI->getCornerFace( n1 ); + gp_XYZ p1Op = SMESH_MeshEditor::TNodeXYZ( oppositeNode( faceI, faceI->GetNodeIndex(n1))); + gp_Vec sideIDir( p1, p1Op ); + // compute angle of (sideIDir projection to pln) and (X dir of pln) + gp_Vec2d sideIDirProj( sideIDir * pln.XDirection(), sideIDir * pln.YDirection()); + double angle = sideIDirProj.Angle( gp::DX2d() ); + if ( angle < 0 ) angle += 2 * PI; + angleOfSide.insert( make_pair( angle, sideI )); + _DUMP_(" "<< sideI << " - side dir (" + << sideIDir.X() << ", " << sideIDir.Y() << ", " << sideIDir.Z() << ")" + << " angle " << angle); + } + gp_Vec gcDir( p1, gc ); + gp_Vec2d gcDirProj( gcDir * pln.XDirection(), gcDir * pln.YDirection()); + double gcAngle = gcDirProj.Angle( gp::DX2d() ); + foundSide = gcAngle < 0 ? angleOfSide.rbegin()->second : angleOfSide.begin()->second; + _DUMP_(" selected "<< foundSide ); + } + + // Orient the found side correctly + + // corners of found side corresponding to nodes n1 and n2 + bool xMax1, yMax1, xMax2, yMax2; + if ( !getEdgeEnds( sharedSideEdge2, xMax1, yMax1, xMax2, yMax2 )) + return error(SMESH_Comment("Internal error at ")<<__FILE__<<":"<<__LINE__), + _OrientedBlockSide(0); + + for ( int ori = 0; ori < _OrientedIndexer::MAX_ORI+1; ++ori ) + { + _OrientedBlockSide orientedSide( foundSide, ori ); + const SMDS_MeshNode* n12 = orientedSide.cornerNode( xMax1, yMax1); + const SMDS_MeshNode* n22 = orientedSide.cornerNode( xMax2, yMax2); + if ( n1 == n12 && n2 == n22 ) + return orientedSide; + } + error(SMESH_Comment("Failed to orient a block side found by edge ")<& row1, + vector& row2, + const bool alongN1N2 ) + { + const SMDS_MeshNode* corner1 = n1; + + // Store nodes of quad in the rows and find new n1 and n2 to get + // the next face so that new n2 is on block edge + int i1 = quad->GetNodeIndex( n1 ); + int i2 = quad->GetNodeIndex( n2 ); + row1.clear(); row2.clear(); + row1.push_back( n1 ); + if ( alongN1N2 ) + { + row1.push_back( n2 ); + row2.push_back( oppositeNode( quad, i2 )); + row2.push_back( n1 = oppositeNode( quad, i1 )); + } + else + { + row2.push_back( n2 ); + row1.push_back( n2 = oppositeNode( quad, i2 )); + row2.push_back( n1 = oppositeNode( quad, i1 )); + } + + // Find the rest nodes + TIDSortedElemSet emptySet, avoidSet; + while ( !isCornerNode( n2 )) + { + avoidSet.clear(); avoidSet.insert( quad ); + quad = SMESH_MeshEditor::FindFaceInSet( n1, n2, emptySet, avoidSet, &i1, &i2 ); + if ( !isQuadrangle( quad )) + return BAD_MESH_ERR; + + row1.push_back( n2 = oppositeNode( quad, i1 )); + row2.push_back( n1 = oppositeNode( quad, i2 )); + } + return n1 != corner1; + } + + //================================================================================ + /*! + * \brief Return a corner face by a corner node + */ + //================================================================================ + + const SMDS_MeshElement* _BlockSide::getCornerFace(const SMDS_MeshNode* cornerNode) const + { + int x, y, isXMax, isYMax, found = 0; + for ( isXMax = 0; isXMax < 2; ++isXMax ) + { + for ( isYMax = 0; isYMax < 2; ++isYMax ) + { + x = isXMax ? _index._xSize-1 : 0; + y = isYMax ? _index._ySize-1 : 0; + found = ( getNode(x,y) == cornerNode ); + if ( found ) break; + } + if ( found ) break; + } + if ( !found ) return 0; + int dx = isXMax ? -1 : +1; + int dy = isYMax ? -1 : +1; + const SMDS_MeshNode* n1 = getNode(x,y); + const SMDS_MeshNode* n2 = getNode(x+dx,y); + const SMDS_MeshNode* n3 = getNode(x,y+dy); + const SMDS_MeshNode* n4 = getNode(x+dx,y+dy); + return SMDS_Mesh::FindFace(n1, n2, n3, n4 ); + } + +} + +//======================================================================= +//function : StdMeshers_HexaFromSkin_3D +//purpose : +//======================================================================= + +StdMeshers_HexaFromSkin_3D::StdMeshers_HexaFromSkin_3D(int hypId, int studyId, SMESH_Gen* gen) + :SMESH_3D_Algo(hypId, studyId, gen) +{ + MESSAGE("StdMeshers_HexaFromSkin_3D::StdMeshers_HexaFromSkin_3D"); + _name = "HexaFromSkin_3D"; +} + +StdMeshers_HexaFromSkin_3D::~StdMeshers_HexaFromSkin_3D() +{ + MESSAGE("StdMeshers_HexaFromSkin_3D::~StdMeshers_HexaFromSkin_3D"); +} + +//================================================================================ +/*! + * \brief Main method, which generates hexaheda + */ +//================================================================================ + +bool StdMeshers_HexaFromSkin_3D::Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper) +{ + _Skin skin; + int nbBlocks = skin.findBlocks(aMesh); + if ( nbBlocks == 0 ) + return error( skin.error()); + + vector< vector< const SMDS_MeshNode* > > columns; + int x, xSize, y, ySize, z, zSize; + _Indexer colIndex; + + for ( int i = 0; i < nbBlocks; ++i ) + { + const _Block& block = skin.getBlock( i ); + + // ------------------------------------------ + // Fill columns of nodes with existing nodes + // ------------------------------------------ + + xSize = block.getSide(B_BOTTOM).getHoriSize(); + ySize = block.getSide(B_BOTTOM).getVertSize(); + zSize = block.getSide(B_FRONT ).getVertSize(); + int X = xSize - 1, Y = ySize - 1, Z = zSize - 1; + colIndex = _Indexer( xSize, ySize ); + columns.resize( colIndex.size() ); + + // fill node columns by front and back box sides + for ( x = 0; x < xSize; ++x ) { + vector< const SMDS_MeshNode* >& column0 = columns[ colIndex( x, 0 )]; + vector< const SMDS_MeshNode* >& column1 = columns[ colIndex( x, Y )]; + column0.resize( zSize ); + column1.resize( zSize ); + for ( z = 0; z < zSize; ++z ) { + column0[ z ] = block.getSide(B_FRONT).node( x, z ); + column1[ z ] = block.getSide(B_BACK) .node( x, z ); + } + } + // fill node columns by left and right box sides + for ( y = 1; y < ySize-1; ++y ) { + vector< const SMDS_MeshNode* >& column0 = columns[ colIndex( 0, y )]; + vector< const SMDS_MeshNode* >& column1 = columns[ colIndex( X, y )]; + column0.resize( zSize ); + column1.resize( zSize ); + for ( z = 0; z < zSize; ++z ) { + column0[ z ] = block.getSide(B_LEFT) .node( y, z ); + column1[ z ] = block.getSide(B_RIGHT).node( y, z ); + } + } + // get nodes from top and bottom box sides + for ( x = 1; x < xSize-1; ++x ) { + for ( y = 1; y < ySize-1; ++y ) { + vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )]; + column.resize( zSize ); + column.front() = block.getSide(B_BOTTOM).node( x, y ); + column.back() = block.getSide(B_TOP) .node( x, y ); + } + } + + // ---------------------------- + // Add internal nodes of a box + // ---------------------------- + // projection points of internal nodes on box subshapes by which + // coordinates of internal nodes are computed + vector pointOnShape( SMESH_Block::ID_Shell ); + + // projections on vertices are constant + pointOnShape[ SMESH_Block::ID_V000 ] = block.getSide(B_BOTTOM).xyz( 0, 0 ); + pointOnShape[ SMESH_Block::ID_V100 ] = block.getSide(B_BOTTOM).xyz( X, 0 ); + pointOnShape[ SMESH_Block::ID_V010 ] = block.getSide(B_BOTTOM).xyz( 0, Y ); + pointOnShape[ SMESH_Block::ID_V110 ] = block.getSide(B_BOTTOM).xyz( X, Y ); + pointOnShape[ SMESH_Block::ID_V001 ] = block.getSide(B_TOP).xyz( 0, 0 ); + pointOnShape[ SMESH_Block::ID_V101 ] = block.getSide(B_TOP).xyz( X, 0 ); + pointOnShape[ SMESH_Block::ID_V011 ] = block.getSide(B_TOP).xyz( 0, Y ); + pointOnShape[ SMESH_Block::ID_V111 ] = block.getSide(B_TOP).xyz( X, Y ); + + for ( x = 1; x < xSize-1; ++x ) + { + gp_XYZ params; // normalized parameters of internal node within a unit box + params.SetCoord( 1, x / double(X) ); + for ( y = 1; y < ySize-1; ++y ) + { + params.SetCoord( 2, y / double(Y) ); + // column to fill during z loop + vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )]; + // projections on horizontal edges + pointOnShape[ SMESH_Block::ID_Ex00 ] = block.getSide(B_BOTTOM).xyz( x, 0 ); + pointOnShape[ SMESH_Block::ID_Ex10 ] = block.getSide(B_BOTTOM).xyz( x, Y ); + pointOnShape[ SMESH_Block::ID_E0y0 ] = block.getSide(B_BOTTOM).xyz( 0, y ); + pointOnShape[ SMESH_Block::ID_E1y0 ] = block.getSide(B_BOTTOM).xyz( X, y ); + pointOnShape[ SMESH_Block::ID_Ex01 ] = block.getSide(B_TOP).xyz( x, 0 ); + pointOnShape[ SMESH_Block::ID_Ex11 ] = block.getSide(B_TOP).xyz( x, Y ); + pointOnShape[ SMESH_Block::ID_E0y1 ] = block.getSide(B_TOP).xyz( 0, y ); + pointOnShape[ SMESH_Block::ID_E1y1 ] = block.getSide(B_TOP).xyz( X, y ); + // projections on horizontal sides + pointOnShape[ SMESH_Block::ID_Fxy0 ] = block.getSide(B_BOTTOM).xyz( x, y ); + pointOnShape[ SMESH_Block::ID_Fxy1 ] = block.getSide(B_TOP) .xyz( x, y ); + for ( z = 1; z < zSize-1; ++z ) // z loop + { + params.SetCoord( 3, z / double(Z) ); + // projections on vertical edges + pointOnShape[ SMESH_Block::ID_E00z ] = block.getSide(B_FRONT).xyz( 0, z ); + pointOnShape[ SMESH_Block::ID_E10z ] = block.getSide(B_FRONT).xyz( X, z ); + pointOnShape[ SMESH_Block::ID_E01z ] = block.getSide(B_BACK).xyz( 0, z ); + pointOnShape[ SMESH_Block::ID_E11z ] = block.getSide(B_BACK).xyz( X, z ); + // projections on vertical sides + pointOnShape[ SMESH_Block::ID_Fx0z ] = block.getSide(B_FRONT).xyz( x, z ); + pointOnShape[ SMESH_Block::ID_Fx1z ] = block.getSide(B_BACK) .xyz( x, z ); + pointOnShape[ SMESH_Block::ID_F0yz ] = block.getSide(B_LEFT) .xyz( y, z ); + pointOnShape[ SMESH_Block::ID_F1yz ] = block.getSide(B_RIGHT).xyz( y, z ); + + // compute internal node coordinates + gp_XYZ coords; + SMESH_Block::ShellPoint( params, pointOnShape, coords ); + column[ z ] = aHelper->AddNode( coords.X(), coords.Y(), coords.Z() ); + +#ifdef DEB_GRID + // debug + //cout << "----------------------------------------------------------------------"<& col00 = columns[ colIndex( x, y )]; + vector< const SMDS_MeshNode* >& col10 = columns[ colIndex( x+1, y )]; + vector< const SMDS_MeshNode* >& col01 = columns[ colIndex( x, y+1 )]; + vector< const SMDS_MeshNode* >& col11 = columns[ colIndex( x+1, y+1 )]; + // bottom face normal of a hexa mush point outside the volume + if ( isForw ) + for ( z = 0; z < zSize-1; ++z ) + aHelper->AddVolume(col00[z], col01[z], col11[z], col10[z], + col00[z+1], col01[z+1], col11[z+1], col10[z+1]); + else + for ( z = 0; z < zSize-1; ++z ) + aHelper->AddVolume(col00[z], col10[z], col11[z], col01[z], + col00[z+1], col10[z+1], col11[z+1], col01[z+1]); + } + } + } // loop on blocks + + return true; +} + +//================================================================================ +/*! + * \brief Evaluate nb of hexa + */ +//================================================================================ + +bool StdMeshers_HexaFromSkin_3D::Evaluate(SMESH_Mesh & aMesh, + const TopoDS_Shape & aShape, + MapShapeNbElems& aResMap) +{ + _Skin skin; + int nbBlocks = skin.findBlocks(aMesh); + if ( nbBlocks == 0 ) + return error( skin.error()); + + bool secondOrder = aMesh.NbFaces( ORDER_QUADRATIC ); + + int entity = secondOrder ? SMDSEntity_Quad_Hexa : SMDSEntity_Hexa; + vector& nbByType = aResMap[ aMesh.GetSubMesh( aShape )]; + if ( entity >= nbByType.size() ) + nbByType.resize( SMDSEntity_Last, 0 ); + + for ( int i = 0; i < nbBlocks; ++i ) + { + const _Block& block = skin.getBlock( i ); + + int nbX = block.getSide(B_BOTTOM).getHoriSize(); + int nbY = block.getSide(B_BOTTOM).getVertSize(); + int nbZ = block.getSide(B_FRONT ).getVertSize(); + + int nbHexa = (nbX-1) * (nbY-1) * (nbZ-1); + int nbNodes = (nbX-2) * (nbY-2) * (nbZ-2); + if ( secondOrder ) + nbNodes += + (nbX-2) * (nbY-2) * (nbZ-1) + + (nbX-2) * (nbY-1) * (nbZ-2) + + (nbX-1) * (nbY-2) * (nbZ-2); + + + nbByType[ entity ] += nbHexa; + nbByType[ SMDSEntity_Node ] += nbNodes; + } + + return true; +} + +//================================================================================ +/*! + * \brief Abstract method must be defined but does nothing + */ +//================================================================================ + +bool StdMeshers_HexaFromSkin_3D::CheckHypothesis(SMESH_Mesh&, const TopoDS_Shape&, + Hypothesis_Status& aStatus) +{ + aStatus = SMESH_Hypothesis::HYP_OK; + return true; +} + +//================================================================================ +/*! + * \brief Abstract method must be defined but just reports an error as this + * algo is not intended to work with shapes + */ +//================================================================================ + +bool StdMeshers_HexaFromSkin_3D::Compute(SMESH_Mesh&, const TopoDS_Shape&) +{ + return error("Algorithm can't work with geometrical shapes"); +} + diff --git a/src/StdMeshers/StdMeshers_HexaFromSkin_3D.hxx b/src/StdMeshers/StdMeshers_HexaFromSkin_3D.hxx new file mode 100644 index 000000000..a2d811fee --- /dev/null +++ b/src/StdMeshers/StdMeshers_HexaFromSkin_3D.hxx @@ -0,0 +1,54 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : StdMeshers_HexaFromSkin_3D.hxx +// Created : Wed Jan 27 12:23:21 2010 +// Author : Edward AGAPOV (eap) +// +#ifndef __StdMeshers_HexaFromSkin_3D_HXX__ +#define __StdMeshers_HexaFromSkin_3D_HXX__ + +#include "SMESH_StdMeshers.hxx" +#include "SMESH_3D_Algo.hxx" + +/*! + * \brief Alorithm generating hexahedral mesh from 2D skin of block + */ + +class STDMESHERS_EXPORT StdMeshers_HexaFromSkin_3D : public SMESH_3D_Algo +{ +public: + StdMeshers_HexaFromSkin_3D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~StdMeshers_HexaFromSkin_3D(); + + virtual bool Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + Hypothesis_Status& aStatus); + + virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); + + virtual bool Evaluate(SMESH_Mesh & aMesh, + const TopoDS_Shape & aShape, + MapShapeNbElems& aResMap); + +}; + +#endif diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.cxx b/src/StdMeshers/StdMeshers_Hexa_3D.cxx index 7e1c49a35..4701c050d 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Hexa_3D.cxx // Moved here from SMESH_Hexa_3D.cxx @@ -26,8 +27,10 @@ // Module : SMESH // #include "StdMeshers_Hexa_3D.hxx" + #include "StdMeshers_CompositeHexa_3D.hxx" #include "StdMeshers_FaceSide.hxx" +#include "StdMeshers_HexaFromSkin_3D.hxx" #include "StdMeshers_Penta_3D.hxx" #include "StdMeshers_Prism_3D.hxx" #include "StdMeshers_Quadrangle_2D.hxx" @@ -78,6 +81,7 @@ StdMeshers_Hexa_3D::StdMeshers_Hexa_3D(int hypId, int studyId, SMESH_Gen * gen) MESSAGE("StdMeshers_Hexa_3D::StdMeshers_Hexa_3D"); _name = "Hexa_3D"; _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type + _requireShape = false; } //============================================================================= @@ -865,10 +869,27 @@ bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh, return true; } +//================================================================================ +/*! + * \brief Computes hexahedral mesh from 2D mesh of block + */ +//================================================================================ + +bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper) +{ + static StdMeshers_HexaFromSkin_3D * algo = 0; + if ( !algo ) { + SMESH_Gen* gen = aMesh.GetGen(); + algo = new StdMeshers_HexaFromSkin_3D( gen->GetANewId(), 0, gen ); + } + algo->InitComputeError(); + algo->Compute( aMesh, aHelper ); + return error( algo->GetComputeError()); +} //============================================================================= /*! - * + * */ //============================================================================= diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.hxx b/src/StdMeshers/StdMeshers_Hexa_3D.hxx index d34d812dd..f4608a79a 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.hxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Hexa_3D.hxx // Moved here from SMESH_Hexa_3D.hxx @@ -73,9 +74,9 @@ public: const TopoDS_Shape& aShape, SMESH_Hypothesis::Hypothesis_Status& aStatus); - virtual bool Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape) - /*throw (SALOME_Exception)*/; + virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); + + virtual bool Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper); virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, MapShapeNbElems& aResMap); @@ -87,32 +88,32 @@ public: protected: TopoDS_Edge EdgeNotInFace(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - const TopoDS_Face& aFace, - const TopoDS_Vertex& aVertex, - const TopTools_IndexedDataMapOfShapeListOfShape& MS); + const TopoDS_Shape& aShape, + const TopoDS_Face& aFace, + const TopoDS_Vertex& aVertex, + const TopTools_IndexedDataMapOfShapeListOfShape& MS); int GetFaceIndex(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - const std::vector& meshFaces, - const TopoDS_Vertex& V0, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const TopoDS_Vertex& V3); + const TopoDS_Shape& aShape, + const std::vector& meshFaces, + const TopoDS_Vertex& V0, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3); void GetConv2DCoefs(const faceQuadStruct& quad, - const TopoDS_Shape& aShape, - const TopoDS_Vertex& V0, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const TopoDS_Vertex& V3, - Conv2DStruct& conv); + const TopoDS_Shape& aShape, + const TopoDS_Vertex& V0, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3, + Conv2DStruct& conv); void GetPoint(Pt3 p, - int i, int j, int k, - int nbx, int nby, int nbz, - Point3DStruct *np, - const SMESHDS_Mesh* meshDS); + int i, int j, int k, + int nbx, int nby, int nbz, + Point3DStruct *np, + const SMESHDS_Mesh* meshDS); bool ClearAndReturn(FaceQuadStruct* theQuads[6], const bool res); }; diff --git a/src/StdMeshers/StdMeshers_LayerDistribution.cxx b/src/StdMeshers/StdMeshers_LayerDistribution.cxx index 8e5987e6b..56cbf7492 100644 --- a/src/StdMeshers/StdMeshers_LayerDistribution.cxx +++ b/src/StdMeshers/StdMeshers_LayerDistribution.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's classes // File : StdMeshers_LayerDistribution.cxx // Author : Edward AGAPOV diff --git a/src/StdMeshers/StdMeshers_LayerDistribution.hxx b/src/StdMeshers/StdMeshers_LayerDistribution.hxx index aca054d4f..0f780cd22 100644 --- a/src/StdMeshers/StdMeshers_LayerDistribution.hxx +++ b/src/StdMeshers/StdMeshers_LayerDistribution.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_LayerDistribution.hxx // Author : Edward AGAPOV diff --git a/src/StdMeshers/StdMeshers_LayerDistribution2D.cxx b/src/StdMeshers/StdMeshers_LayerDistribution2D.cxx index 23d039bee..279466dcc 100644 --- a/src/StdMeshers/StdMeshers_LayerDistribution2D.cxx +++ b/src/StdMeshers/StdMeshers_LayerDistribution2D.cxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's classes // File : StdMeshers_LayerDistribution2D.cxx // Author : Edward AGAPOV diff --git a/src/StdMeshers/StdMeshers_LayerDistribution2D.hxx b/src/StdMeshers/StdMeshers_LayerDistribution2D.hxx index d06b6ead2..267003ab0 100644 --- a/src/StdMeshers/StdMeshers_LayerDistribution2D.hxx +++ b/src/StdMeshers/StdMeshers_LayerDistribution2D.hxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_LayerDistribution2D.hxx // Author : Edward AGAPOV diff --git a/src/StdMeshers/StdMeshers_LengthFromEdges.cxx b/src/StdMeshers/StdMeshers_LengthFromEdges.cxx index cad6e9186..9a8395f30 100644 --- a/src/StdMeshers/StdMeshers_LengthFromEdges.cxx +++ b/src/StdMeshers/StdMeshers_LengthFromEdges.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_LengthFromEdges.cxx // Moved here from SMESH_LengthFromEdges.cxx diff --git a/src/StdMeshers/StdMeshers_LengthFromEdges.hxx b/src/StdMeshers/StdMeshers_LengthFromEdges.hxx index cb52638e5..b0dd703b1 100644 --- a/src/StdMeshers/StdMeshers_LengthFromEdges.hxx +++ b/src/StdMeshers/StdMeshers_LengthFromEdges.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,13 +19,13 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_LengthFromEdges.hxx // Moved here from SMESH_LengthFromEdges.hxx // Author : Paul RASCLE, EDF // Module : SMESH // - #ifndef _SMESH_LENGTHFROMEDGES_HXX_ #define _SMESH_LENGTHFROMEDGES_HXX_ diff --git a/src/StdMeshers/StdMeshers_LocalLength.cxx b/src/StdMeshers/StdMeshers_LocalLength.cxx index d52d2de54..2c8646bd6 100644 --- a/src/StdMeshers/StdMeshers_LocalLength.cxx +++ b/src/StdMeshers/StdMeshers_LocalLength.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,13 +19,13 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_LocalLength.cxx // Moved here from SMESH_LocalLength.cxx // Author : Paul RASCLE, EDF // Module : SMESH // - #include "StdMeshers_LocalLength.hxx" #include "SMESH_Mesh.hxx" diff --git a/src/StdMeshers/StdMeshers_LocalLength.hxx b/src/StdMeshers/StdMeshers_LocalLength.hxx index 1c8d72b27..3dabbbaef 100644 --- a/src/StdMeshers/StdMeshers_LocalLength.hxx +++ b/src/StdMeshers/StdMeshers_LocalLength.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,13 +19,13 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_LocalLength.hxx // Moved here from SMESH_LocalLength.hxx // Author : Paul RASCLE, EDF // Module : SMESH // - #ifndef _SMESH_LOCALLENGTH_HXX_ #define _SMESH_LOCALLENGTH_HXX_ diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx index f4ef0198d..e8516d311 100644 --- a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx +++ b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_MEFISTO_2D.cxx // Moved here from SMESH_MEFISTO_2D.cxx @@ -296,8 +297,8 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh //============================================================================= bool StdMeshers_MEFISTO_2D::Evaluate(SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap) + const TopoDS_Shape & aShape, + MapShapeNbElems& aResMap) { MESSAGE("StdMeshers_MEFISTO_2D::Evaluate"); @@ -604,8 +605,31 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(TWireVector & wires, // set UV uvslf[m].x = uvPt->u * scalex; uvslf[m].y = uvPt->v * scaley; - if ( uvPt->node->GetPosition()->GetTypeOfPosition() == SMDS_TOP_VERTEX ) + switch ( uvPt->node->GetPosition()->GetTypeOfPosition()) + { + case SMDS_TOP_VERTEX: mOnVertex.push_back( m ); + break; + case SMDS_TOP_EDGE: + // In order to detect degenerated faces easily, we replace + // nodes on a degenerated edge by node on the vertex of that edge + if ( myTool->IsDegenShape( uvPt->node->GetPosition()->GetShapeId() )) + { + int edgeID = uvPt->node->GetPosition()->GetShapeId(); + SMESH_subMesh* edgeSM = myTool->GetMesh()->GetSubMeshContaining( edgeID ); + SMESH_subMeshIteratorPtr smIt = edgeSM->getDependsOnIterator( /*includeSelf=*/0, + /*complexShapeFirst=*/0); + if ( smIt->more() ) + { + SMESH_subMesh* vertexSM = smIt->next(); + SMDS_NodeIteratorPtr nIt = vertexSM->GetSubMeshDS()->GetNodes(); + if ( nIt->more() ) + mefistoToDS[m] = nIt->next(); + } + } + break; + default:; + } m++; } @@ -632,6 +656,9 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(TWireVector & wires, fixOverlappedLinkUV (uvslf[ mB ], uvslf[ m ], uvslf[ mA ]); } } +// cout << "MEFISTO INPUT************" << endl; +// for ( int i =0; i < m; ++i ) +// cout << i << ": \t" << uvslf[i].x << ", " << uvslf[i].y << " Node " << mefistoToDS[i]->GetID()<< endl; return true; } @@ -778,13 +805,17 @@ void StdMeshers_MEFISTO_2D::StoreResult(Z nbst, R2 * uvst, Z nbt, Z * nust, const SMDS_MeshNode * n2 = mefistoToDS[ nust[m++] - 1 ]; const SMDS_MeshNode * n3 = mefistoToDS[ nust[m++] - 1 ]; - SMDS_MeshElement * elt; - if (triangleIsWellOriented) - elt = myTool->AddFace(n1, n2, n3); - else - elt = myTool->AddFace(n1, n3, n2); - - meshDS->SetMeshElementOnShape(elt, faceID); + // avoid creating degenetrated faces + bool isDegen = ( myTool->HasDegeneratedEdges() && ( n1 == n2 || n1 == n3 || n2 == n3 )); + if ( !isDegen ) + { + SMDS_MeshElement * elt; + if (triangleIsWellOriented) + elt = myTool->AddFace(n1, n2, n3); + else + elt = myTool->AddFace(n1, n3, n2); + meshDS->SetMeshElementOnShape(elt, faceID); + } m++; } diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx index 73075dc07..36f916262 100644 --- a/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx +++ b/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_MEFISTO_2D.hxx // Moved here from SMESH_MEFISTO_2D.hxx @@ -55,7 +56,7 @@ public: SMESH_Hypothesis::Hypothesis_Status& aStatus); virtual bool Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape); + const TopoDS_Shape& aShape); virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, MapShapeNbElems& aResMap); @@ -64,19 +65,19 @@ public: typedef std::vector< StdMeshers_FaceSidePtr > TWireVector; bool LoadPoints(TWireVector & wires, - R2* uvslf, - std::vector< const SMDS_MeshNode*>& mefistoToDS, + R2* uvslf, + std::vector< const SMDS_MeshNode*>& mefistoToDS, double scalex, double scaley); void ComputeScaleOnFace(SMESH_Mesh& aMesh, - const TopoDS_Face& aFace, - double& scalex, - double& scaley); + const TopoDS_Face& aFace, + double& scalex, + double& scaley); void StoreResult (Z nbst, R2* uvst, Z nbt, Z* nust, - std::vector< const SMDS_MeshNode*>& mefistoToDS, + std::vector< const SMDS_MeshNode*>& mefistoToDS, double scalex, double scaley); - + protected: double _edgeLength; double _maxElementArea; diff --git a/src/StdMeshers/StdMeshers_MaxElementArea.cxx b/src/StdMeshers/StdMeshers_MaxElementArea.cxx index 1dce3de1f..75df5eefd 100644 --- a/src/StdMeshers/StdMeshers_MaxElementArea.cxx +++ b/src/StdMeshers/StdMeshers_MaxElementArea.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,13 +19,13 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_MaxElementArea.cxx // Moved here from SMESH_MaxElementArea.cxx // Author : Paul RASCLE, EDF // Module : SMESH // - #include "StdMeshers_MaxElementArea.hxx" #include "SMESH_ControlsDef.hxx" diff --git a/src/StdMeshers/StdMeshers_MaxElementArea.hxx b/src/StdMeshers/StdMeshers_MaxElementArea.hxx index 095067363..f1783ee53 100644 --- a/src/StdMeshers/StdMeshers_MaxElementArea.hxx +++ b/src/StdMeshers/StdMeshers_MaxElementArea.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_MaxElementArea.hxx // Moved here from SMESH_MaxElementArea.hxx diff --git a/src/StdMeshers/StdMeshers_MaxElementVolume.cxx b/src/StdMeshers/StdMeshers_MaxElementVolume.cxx index 79be9d6bc..b76924f04 100644 --- a/src/StdMeshers/StdMeshers_MaxElementVolume.cxx +++ b/src/StdMeshers/StdMeshers_MaxElementVolume.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_MaxElementVolume.cxx // Moved here from SMESH_MaxElementVolume.cxx diff --git a/src/StdMeshers/StdMeshers_MaxElementVolume.hxx b/src/StdMeshers/StdMeshers_MaxElementVolume.hxx index 6395fd419..a290332ab 100644 --- a/src/StdMeshers/StdMeshers_MaxElementVolume.hxx +++ b/src/StdMeshers/StdMeshers_MaxElementVolume.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,12 +19,13 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_MaxElementVolume.hxx // Moved here from SMESH_MaxElementVolume.hxx // Author : Paul RASCLE, EDF // Module : SMESH - +// #ifndef _SMESH_MAXELEMENTVOLUME_HXX_ #define _SMESH_MAXELEMENTVOLUME_HXX_ diff --git a/src/StdMeshers/StdMeshers_MaxLength.cxx b/src/StdMeshers/StdMeshers_MaxLength.cxx index 918fe6c78..8d14ce192 100644 --- a/src/StdMeshers/StdMeshers_MaxLength.cxx +++ b/src/StdMeshers/StdMeshers_MaxLength.cxx @@ -1,27 +1,26 @@ -// SMESH SMESH : implementaion of SMESH idl descriptions +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_MaxLength.cxx // Module : SMESH - +// #include "StdMeshers_MaxLength.hxx" #include "SMESH_Mesh.hxx" diff --git a/src/StdMeshers/StdMeshers_MaxLength.hxx b/src/StdMeshers/StdMeshers_MaxLength.hxx index 23d94a9f2..b05b42cad 100644 --- a/src/StdMeshers/StdMeshers_MaxLength.hxx +++ b/src/StdMeshers/StdMeshers_MaxLength.hxx @@ -1,27 +1,26 @@ -// SMESH SMESH : implementaion of SMESH idl descriptions +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_MaxLength.hxx // Module : SMESH - +// #ifndef _SMESH_MaxLength_HXX_ #define _SMESH_MaxLength_HXX_ diff --git a/src/StdMeshers/StdMeshers_NotConformAllowed.cxx b/src/StdMeshers/StdMeshers_NotConformAllowed.cxx index 66c58f13c..0d69fbb6d 100644 --- a/src/StdMeshers/StdMeshers_NotConformAllowed.cxx +++ b/src/StdMeshers/StdMeshers_NotConformAllowed.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_NotConformAllowed.cxx // Author : Paul RASCLE, EDF diff --git a/src/StdMeshers/StdMeshers_NotConformAllowed.hxx b/src/StdMeshers/StdMeshers_NotConformAllowed.hxx index ddcfcb445..e573039c1 100644 --- a/src/StdMeshers/StdMeshers_NotConformAllowed.hxx +++ b/src/StdMeshers/StdMeshers_NotConformAllowed.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_NotConformAllowed.hxx // Author : Paul RASCLE, EDF diff --git a/src/StdMeshers/StdMeshers_NumberOfLayers.cxx b/src/StdMeshers/StdMeshers_NumberOfLayers.cxx index 8abb02c63..5aa1b9c43 100644 --- a/src/StdMeshers/StdMeshers_NumberOfLayers.cxx +++ b/src/StdMeshers/StdMeshers_NumberOfLayers.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's classes // File : StdMeshers_NumberOfLayers.cxx // Author : Edward AGAPOV diff --git a/src/StdMeshers/StdMeshers_NumberOfLayers.hxx b/src/StdMeshers/StdMeshers_NumberOfLayers.hxx index ebaae84a9..98f5a4a14 100644 --- a/src/StdMeshers/StdMeshers_NumberOfLayers.hxx +++ b/src/StdMeshers/StdMeshers_NumberOfLayers.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_NumberOfLayers.hxx // Author : Edward AGAPOV diff --git a/src/StdMeshers/StdMeshers_NumberOfLayers2D.cxx b/src/StdMeshers/StdMeshers_NumberOfLayers2D.cxx index af2f04dab..da3ee6ccb 100644 --- a/src/StdMeshers/StdMeshers_NumberOfLayers2D.cxx +++ b/src/StdMeshers/StdMeshers_NumberOfLayers2D.cxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,12 +16,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's classes // File : StdMeshers_NumberOfLayers2D.cxx // Author : Edward AGAPOV // Module : SMESH // - #include "StdMeshers_NumberOfLayers2D.hxx" #include "utilities.h" diff --git a/src/StdMeshers/StdMeshers_NumberOfLayers2D.hxx b/src/StdMeshers/StdMeshers_NumberOfLayers2D.hxx index 42690f0e5..fef7cfb60 100644 --- a/src/StdMeshers/StdMeshers_NumberOfLayers2D.hxx +++ b/src/StdMeshers/StdMeshers_NumberOfLayers2D.hxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_NumberOfLayers2D.hxx // Author : Edward AGAPOV diff --git a/src/StdMeshers/StdMeshers_NumberOfSegments.cxx b/src/StdMeshers/StdMeshers_NumberOfSegments.cxx index ce4876ee3..2a9fd2c1a 100644 --- a/src/StdMeshers/StdMeshers_NumberOfSegments.cxx +++ b/src/StdMeshers/StdMeshers_NumberOfSegments.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_NumberOfSegments.cxx // Moved here from SMESH_NumberOfSegments.cxx diff --git a/src/StdMeshers/StdMeshers_NumberOfSegments.hxx b/src/StdMeshers/StdMeshers_NumberOfSegments.hxx index 985d192b2..1ca99dfe8 100644 --- a/src/StdMeshers/StdMeshers_NumberOfSegments.hxx +++ b/src/StdMeshers/StdMeshers_NumberOfSegments.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_NumberOfSegments.hxx // Moved here from SMESH_NumberOfSegments.hxx diff --git a/src/StdMeshers/StdMeshers_Penta_3D.cxx b/src/StdMeshers/StdMeshers_Penta_3D.cxx index a12a3f088..7e21e3113 100644 --- a/src/StdMeshers/StdMeshers_Penta_3D.cxx +++ b/src/StdMeshers/StdMeshers_Penta_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers_Penta_3D implementaion of SMESH idl descriptions // File : StdMeshers_Penta_3D.cxx // Module : SMESH diff --git a/src/StdMeshers/StdMeshers_Penta_3D.hxx b/src/StdMeshers/StdMeshers_Penta_3D.hxx index 882c3b4f3..0ef1037bf 100644 --- a/src/StdMeshers/StdMeshers_Penta_3D.hxx +++ b/src/StdMeshers/StdMeshers_Penta_3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_Penta_3D.hxx // Module : SMESH @@ -58,26 +59,26 @@ public: void Load (const TopoDS_Shell& theShell); void Load (const TopoDS_Shell& theShell, - const TopoDS_Vertex& theV000, - const TopoDS_Vertex& theV001); + const TopoDS_Vertex& theV000, + const TopoDS_Vertex& theV001); void ComputeParameters(const gp_Pnt& thePnt, - gp_XYZ& theXYZ); + gp_XYZ& theXYZ); void ComputeParameters(const gp_Pnt& thePnt, - const TopoDS_Shape& theShape, - gp_XYZ& theXYZ); + const TopoDS_Shape& theShape, + gp_XYZ& theXYZ); void ComputeParameters(const double& theU, - const TopoDS_Shape& theShape, - gp_XYZ& theXYZ); + const TopoDS_Shape& theShape, + gp_XYZ& theXYZ); void Point(const gp_XYZ& theParams, - gp_Pnt& thePnt); + gp_Pnt& thePnt); void Point(const gp_XYZ& theParams, - const TopoDS_Shape& theShape, - gp_Pnt& thePnt); + const TopoDS_Shape& theShape, + gp_Pnt& thePnt); int ShapeID(const TopoDS_Shape& theShape); @@ -206,7 +207,7 @@ class STDMESHERS_EXPORT StdMeshers_Penta_3D { // 0-the node on theBaseEdge. bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); + MapShapeNbElems& aResMap); protected: // methods @@ -223,17 +224,17 @@ class STDMESHERS_EXPORT StdMeshers_Penta_3D { std::vector*& aCol2); void ShapeSupportID(const bool theIsUpperLayer, - const SMESH_Block::TShapeID theBNSSID, - SMESH_Block::TShapeID& theSSID); + const SMESH_Block::TShapeID theBNSSID, + SMESH_Block::TShapeID& theSSID); void FindNodeOnShape(const TopoDS_Shape& aS, - const gp_XYZ& aParams, + const gp_XYZ& aParams, const int z, - StdMeshers_TNode& aTN); + StdMeshers_TNode& aTN); void CreateNode(const bool theIsUpperLayer, - const gp_XYZ& aParams, - StdMeshers_TNode& aTN); + const gp_XYZ& aParams, + StdMeshers_TNode& aTN); void ClearMeshOnFxy1(); diff --git a/src/StdMeshers/StdMeshers_Prism_3D.cxx b/src/StdMeshers/StdMeshers_Prism_3D.cxx index 009b0a7f4..c7bf42004 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.cxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Prism_3D.cxx // Module : SMESH @@ -37,14 +38,18 @@ #include "utilities.h" #include +#include #include #include +#include #include #include #include -#include #include +#include #include +#include +#include using namespace std; @@ -151,6 +156,152 @@ namespace { } params.push_back( parLast ); // 1. } + + //================================================================================ + /*! + * \brief Return coordinate system for z-th layer of nodes + */ + //================================================================================ + + gp_Ax2 getLayerCoordSys(const int z, + const vector< const TNodeColumn* >& columns, + int& xColumn) + { + // gravity center of a layer + gp_XYZ O(0,0,0); + int vertexCol = -1; + for ( int i = 0; i < columns.size(); ++i ) + { + O += gpXYZ( (*columns[ i ])[ z ]); + if ( vertexCol < 0 && + columns[ i ]->front()->GetPosition()->GetTypeOfPosition() == SMDS_TOP_VERTEX ) + vertexCol = i; + } + O /= columns.size(); + + // Z axis + gp_Vec Z(0,0,0); + int iPrev = columns.size()-1; + for ( int i = 0; i < columns.size(); ++i ) + { + gp_Vec v1( O, gpXYZ( (*columns[ iPrev ])[ z ])); + gp_Vec v2( O, gpXYZ( (*columns[ i ] )[ z ])); + Z += v1 ^ v2; + iPrev = i; + } + + if ( vertexCol >= 0 ) + { + O = gpXYZ( (*columns[ vertexCol ])[ z ]); + } + if ( xColumn < 0 || xColumn >= columns.size() ) + { + // select a column for X dir + double maxDist = 0; + for ( int i = 0; i < columns.size(); ++i ) + { + double dist = ( O - gpXYZ((*columns[ i ])[ z ])).SquareModulus(); + if ( dist > maxDist ) + { + xColumn = i; + maxDist = dist; + } + } + } + + // X axis + gp_Vec X( O, gpXYZ( (*columns[ xColumn ])[ z ])); + + return gp_Ax2( O, Z, X); + } + + //================================================================================ + /*! + * \brief Removes submeshes meshed with regular grid from given list + * \retval int - nb of removed submeshes + */ + //================================================================================ + + int removeQuasiQuads(list< SMESH_subMesh* >& notQuadSubMesh) + { + int oldNbSM = notQuadSubMesh.size(); + SMESHDS_Mesh* mesh = notQuadSubMesh.front()->GetFather()->GetMeshDS(); + list< SMESH_subMesh* >::iterator smIt = notQuadSubMesh.begin(); +#define __NEXT_SM { ++smIt; continue; } + while ( smIt != notQuadSubMesh.end() ) + { + SMESH_subMesh* faceSm = *smIt; + SMESHDS_SubMesh* faceSmDS = faceSm->GetSubMeshDS(); + int nbQuads = faceSmDS->NbElements(); + if ( nbQuads == 0 ) __NEXT_SM; + + // get oredered edges + list< TopoDS_Edge > orderedEdges; + list< int > nbEdgesInWires; + TopoDS_Vertex V000; + int nbWires = SMESH_Block::GetOrderedEdges( TopoDS::Face( faceSm->GetSubShape() ), + V000, orderedEdges, nbEdgesInWires ); + if ( nbWires != 1 || nbEdgesInWires.front() <= 4 ) + __NEXT_SM; + + // get nb of segements on edges + list nbSegOnEdge; + list< TopoDS_Edge >::iterator edge = orderedEdges.begin(); + for ( ; edge != orderedEdges.end(); ++edge ) + { + if ( SMESHDS_SubMesh* edgeSmDS = mesh->MeshElements( *edge )) + nbSegOnEdge.push_back( edgeSmDS->NbElements() ); + else + nbSegOnEdge.push_back(0); + } + + // unite nbSegOnEdge of continues edges + int nbEdges = nbEdgesInWires.front(); + list::iterator nbSegIt = nbSegOnEdge.begin(); + for ( edge = orderedEdges.begin(); edge != orderedEdges.end(); ) + { + const TopoDS_Edge& e1 = *edge++; + const TopoDS_Edge& e2 = ( edge == orderedEdges.end() ? orderedEdges.front() : *edge ); + if ( SMESH_Algo::IsContinuous( e1, e2 )) + { + // common vertex of continues edges must be shared by two 2D mesh elems of geom face + TopoDS_Vertex vCommon = TopExp::LastVertex( e1, true ); + const SMDS_MeshNode* vNode = SMESH_Algo::VertexNode( vCommon, mesh ); + int nbF = 0; + if ( vNode ) + { + SMDS_ElemIteratorPtr fIt = vNode->GetInverseElementIterator(SMDSAbs_Face); + while ( fIt->more() ) + nbF += faceSmDS->Contains( fIt->next() ); + } + list::iterator nbSegIt1 = nbSegIt++; + if ( !vNode || nbF == 2 ) // !vNode - two edges can be meshed as one + { + // unite + if ( nbSegIt == nbSegOnEdge.end() ) nbSegIt = nbSegOnEdge.begin(); + *nbSegIt += *nbSegIt1; + nbSegOnEdge.erase( nbSegIt1 ); + --nbEdges; + } + } + else + { + ++nbSegIt; + } + } + vector nbSegVec( nbSegOnEdge.begin(), nbSegOnEdge.end()); + if ( nbSegVec.size() == 4 && + nbSegVec[0] == nbSegVec[2] && + nbSegVec[1] == nbSegVec[3] && + nbSegVec[0] * nbSegVec[1] == nbQuads + ) + smIt = notQuadSubMesh.erase( smIt ); + else + __NEXT_SM; + } + + return oldNbSM - notQuadSubMesh.size(); + } } //======================================================================= @@ -162,7 +313,7 @@ StdMeshers_Prism_3D::StdMeshers_Prism_3D(int hypId, int studyId, SMESH_Gen* gen) :SMESH_3D_Algo(hypId, studyId, gen) { _name = "Prism_3D"; - _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit per shape type + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit per shape type myProjectTriangles = false; } @@ -257,75 +408,115 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh // Projections on the top and bottom faces are taken from nodes existing // on these faces; find correspondence between bottom and top nodes myBotToColumnMap.clear(); - if ( !assocOrProjBottom2Top() ) // it also fill myBotToColumnMap + if ( !assocOrProjBottom2Top() ) // it also fills myBotToColumnMap return false; // Create nodes inside the block - // loop on nodes inside the bottom face - TNode2ColumnMap::iterator bot_column = myBotToColumnMap.begin(); - for ( ; bot_column != myBotToColumnMap.end(); ++bot_column ) + // try to use transformation (issue 0020680) + vector trsf; + if ( myBlock.GetLayersTransformation(trsf)) { - const TNode& tBotNode = bot_column->first; // bottom TNode - if ( tBotNode.GetPositionType() != SMDS_TOP_FACE ) - continue; // node is not inside face - - // column nodes; middle part of the column are zero pointers - TNodeColumn& column = bot_column->second; - - // bottom node parameters and coords - myShapeXYZ[ ID_BOT_FACE ] = tBotNode.GetCoords(); - gp_XYZ botParams = tBotNode.GetParams(); - - // compute top node parameters - myShapeXYZ[ ID_TOP_FACE ] = gpXYZ( column.back() ); - gp_XYZ topParams = botParams; - topParams.SetZ( 1 ); - if ( column.size() > 2 ) { - gp_Pnt topCoords = myShapeXYZ[ ID_TOP_FACE ]; - if ( !myBlock.ComputeParameters( topCoords, topParams, ID_TOP_FACE, topParams )) - return error(TCom("Can't compute normalized parameters ") - << "for node " << column.back()->GetID() - << " on the face #"<< column.back()->GetPosition()->GetShapeId() ); - } + // loop on nodes inside the bottom face + TNode2ColumnMap::iterator bot_column = myBotToColumnMap.begin(); + for ( ; bot_column != myBotToColumnMap.end(); ++bot_column ) + { + const TNode& tBotNode = bot_column->first; // bottom TNode + if ( tBotNode.GetPositionType() != SMDS_TOP_FACE ) + continue; // node is not inside face + + // column nodes; middle part of the column are zero pointers + TNodeColumn& column = bot_column->second; + TNodeColumn::iterator columnNodes = column.begin(); + for ( int z = 0; columnNodes != column.end(); ++columnNodes, ++z) + { + const SMDS_MeshNode* & node = *columnNodes; + if ( node ) continue; // skip bottom or top node - // vertical loop - TNodeColumn::iterator columnNodes = column.begin(); - for ( int z = 0; columnNodes != column.end(); ++columnNodes, ++z) + gp_XYZ coords = tBotNode.GetCoords(); + trsf[z-1].Transforms( coords ); + node = meshDS->AddNode( coords.X(), coords.Y(), coords.Z() ); + meshDS->SetNodeInVolume( node, volumeID ); + } + } // loop on bottom nodes + } + else // use block approach + { + // loop on nodes inside the bottom face + TNode prevBNode; + TNode2ColumnMap::iterator bot_column = myBotToColumnMap.begin(); + for ( ; bot_column != myBotToColumnMap.end(); ++bot_column ) { - const SMDS_MeshNode* & node = *columnNodes; - if ( node ) continue; // skip bottom or top node - - // params of a node to create - double rz = (double) z / (double) ( column.size() - 1 ); - gp_XYZ params = botParams * ( 1 - rz ) + topParams * rz; - - // set coords on all faces and nodes - const int nbSideFaces = 4; - int sideFaceIDs[nbSideFaces] = { SMESH_Block::ID_Fx0z, - SMESH_Block::ID_Fx1z, - SMESH_Block::ID_F0yz, - SMESH_Block::ID_F1yz }; - for ( int iF = 0; iF < nbSideFaces; ++iF ) - if ( !setFaceAndEdgesXYZ( sideFaceIDs[ iF ], params, z )) - return false; - - // compute coords for a new node - gp_XYZ coords; - if ( !SMESH_Block::ShellPoint( params, myShapeXYZ, coords )) - return error("Can't compute coordinates by normalized parameters"); - - SHOWYXZ("TOPFacePoint ",myShapeXYZ[ ID_TOP_FACE]); - SHOWYXZ("BOT Node "<< tBotNode.myNode->GetID(),gpXYZ(tBotNode.myNode)); - SHOWYXZ("ShellPoint ",coords); - - // create a node - node = meshDS->AddNode( coords.X(), coords.Y(), coords.Z() ); - meshDS->SetNodeInVolume( node, volumeID ); - } - } // loop on bottom nodes + const TNode& tBotNode = bot_column->first; // bottom TNode + if ( tBotNode.GetPositionType() != SMDS_TOP_FACE ) + continue; // node is not inside face + // column nodes; middle part of the column are zero pointers + TNodeColumn& column = bot_column->second; + + // compute bottom node parameters + gp_XYZ paramHint(-1,-1,-1); + if ( prevBNode.IsNeighbor( tBotNode )) + paramHint = prevBNode.GetParams(); + if ( !myBlock.ComputeParameters( tBotNode.GetCoords(), tBotNode.ChangeParams(), + ID_BOT_FACE, paramHint )) + return error(TCom("Can't compute normalized parameters for node ") + << tBotNode.myNode->GetID() << " on the face #" + << myBlock.SubMesh( ID_BOT_FACE )->GetId() ); + prevBNode = tBotNode; + + myShapeXYZ[ ID_BOT_FACE ] = tBotNode.GetCoords(); + gp_XYZ botParams = tBotNode.GetParams(); + + // compute top node parameters + myShapeXYZ[ ID_TOP_FACE ] = gpXYZ( column.back() ); + gp_XYZ topParams = botParams; + topParams.SetZ( 1 ); + if ( column.size() > 2 ) { + gp_Pnt topCoords = myShapeXYZ[ ID_TOP_FACE ]; + if ( !myBlock.ComputeParameters( topCoords, topParams, ID_TOP_FACE, topParams )) + return error(TCom("Can't compute normalized parameters ") + << "for node " << column.back()->GetID() + << " on the face #"<< column.back()->GetPosition()->GetShapeId() ); + } + + // vertical loop + TNodeColumn::iterator columnNodes = column.begin(); + for ( int z = 0; columnNodes != column.end(); ++columnNodes, ++z) + { + const SMDS_MeshNode* & node = *columnNodes; + if ( node ) continue; // skip bottom or top node + + // params of a node to create + double rz = (double) z / (double) ( column.size() - 1 ); + gp_XYZ params = botParams * ( 1 - rz ) + topParams * rz; + + // set coords on all faces and nodes + const int nbSideFaces = 4; + int sideFaceIDs[nbSideFaces] = { SMESH_Block::ID_Fx0z, + SMESH_Block::ID_Fx1z, + SMESH_Block::ID_F0yz, + SMESH_Block::ID_F1yz }; + for ( int iF = 0; iF < nbSideFaces; ++iF ) + if ( !setFaceAndEdgesXYZ( sideFaceIDs[ iF ], params, z )) + return false; + + // compute coords for a new node + gp_XYZ coords; + if ( !SMESH_Block::ShellPoint( params, myShapeXYZ, coords )) + return error("Can't compute coordinates by normalized parameters"); + + SHOWYXZ("TOPFacePoint ",myShapeXYZ[ ID_TOP_FACE]); + SHOWYXZ("BOT Node "<< tBotNode.myNode->GetID(),gpXYZ(tBotNode.myNode)); + SHOWYXZ("ShellPoint ",coords); + + // create a node + node = meshDS->AddNode( coords.X(), coords.Y(), coords.Z() ); + meshDS->SetNodeInVolume( node, volumeID ); + } + } // loop on bottom nodes + } // Create volumes @@ -349,7 +540,7 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh { const SMDS_MeshNode* n = face->GetNode( i ); if ( n->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE ) { - bot_column = myBotToColumnMap.find( n ); + TNode2ColumnMap::iterator bot_column = myBotToColumnMap.find( n ); if ( bot_column == myBotToColumnMap.end() ) return error(TCom("No nodes found above node ") << n->GetID() ); columns[ i ] = & bot_column->second; @@ -375,8 +566,8 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh //======================================================================= bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh, - const TopoDS_Shape& theShape, - MapShapeNbElems& aResMap) + const TopoDS_Shape& theShape, + MapShapeNbElems& aResMap) { // find face contains only triangles vector < SMESH_subMesh * >meshFaces; @@ -436,8 +627,8 @@ bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh, bool IsOpposite = true; for(TopExp_Explorer exp(aFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) { if( Edges1.Contains(exp.Current()) ) { - IsOpposite = false; - break; + IsOpposite = false; + break; } } if(IsOpposite) { @@ -652,7 +843,7 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top() // Fill myBotToColumnMap int zSize = myBlock.VerticalSize(); - TNode prevTNode; + //TNode prevTNode; TNodeNodeMap::iterator bN_tN = n2nMap.begin(); for ( ; bN_tN != n2nMap.end(); ++bN_tN ) { @@ -660,19 +851,8 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top() const SMDS_MeshNode* topNode = bN_tN->second; if ( botNode->GetPosition()->GetTypeOfPosition() != SMDS_TOP_FACE ) continue; // wall columns are contained in myBlock - // compute bottom node params - TNode bN( botNode ); - if ( zSize > 2 ) { - gp_XYZ paramHint(-1,-1,-1); - if ( prevTNode.IsNeighbor( bN )) - paramHint = prevTNode.GetParams(); - if ( !myBlock.ComputeParameters( bN.GetCoords(), bN.ChangeParams(), - ID_BOT_FACE, paramHint )) - return error(TCom("Can't compute normalized parameters for node ") - << botNode->GetID() << " on the face #"<< botSM->GetId() ); - prevTNode = bN; - } // create node column + TNode bN( botNode ); TNode2ColumnMap::iterator bN_col = myBotToColumnMap.insert( make_pair ( bN, TNodeColumn() )).first; TNodeColumn & column = bN_col->second; @@ -813,10 +993,10 @@ bool StdMeshers_Prism_3D::setFaceAndEdgesXYZ( const int faceID, const gp_XYZ& pa SMESH_Block::GetFaceEdgesIDs( faceID, edgeVec ); myBlock.EdgePoint( edgeVec[ BASE ], params, myShapeXYZ[ edgeVec[ BASE ]]); - myBlock.EdgePoint( edgeVec[ TOP ], params, myShapeXYZ[ edgeVec[ TOP ]]); + myBlock.EdgePoint( edgeVec[ TOP ], params, myShapeXYZ[ edgeVec[ TOP ]]); SHOWYXZ("\nparams ", params); - SHOWYXZ("TOP is "< 0 && nbNotQuad != 2 ) - return error(COMPERR_BAD_SHAPE, - TCom("More than 2 not quadrilateral faces: ") - < 2 ) + { return error(COMPERR_BAD_INPUT_MESH, TCom("More than 2 faces with not quadrangle elements: ") < 0 && nbNotQuad != 2 ) + { + // Issue 0020843 - one of side faces is quasi-quadrilateral. + // Remove from notQuadGeomSubMesh faces meshed with regular grid + nbQuasiQuads = removeQuasiQuads( notQuadGeomSubMesh ); + nbNotQuad -= nbQuasiQuads; + if ( nbNotQuad > 0 && nbNotQuad != 2 ) + return error(COMPERR_BAD_SHAPE, + TCom("More than 2 not quadrilateral faces: ") + <dumpNodes( 4 ); // debug } // horizontal faces geometry { @@ -1432,6 +1623,87 @@ const TNodeColumn* StdMeshers_PrismAsBlock::GetNodeColumn(const SMDS_MeshNode* n return 0; } +//======================================================================= +//function : GetLayersTransformation +//purpose : Return transformations to get coordinates of nodes of each layer +// by nodes of the bottom. Layer is a set of nodes at a certain step +// from bottom to top. +//======================================================================= + +bool StdMeshers_PrismAsBlock::GetLayersTransformation(vector & trsf) const +{ + const int zSize = VerticalSize(); + if ( zSize < 3 ) return true; + trsf.resize( zSize - 2 ); + + // Select some node columns by which we will define coordinate system of layers + + vector< const TNodeColumn* > columns; + { + const TopoDS_Shape& baseFace = Shape(ID_BOT_FACE); + list< TopoDS_Edge > orderedEdges; + list< int > nbEdgesInWires; + GetOrderedEdges( TopoDS::Face( baseFace ), TopoDS_Vertex(), orderedEdges, nbEdgesInWires ); + bool isReverse; + list< TopoDS_Edge >::iterator edgeIt = orderedEdges.begin(); + for ( int iE = 0; iE < nbEdgesInWires.front(); ++iE, ++edgeIt ) + { + const TParam2ColumnMap& u2colMap = + GetParam2ColumnMap( myHelper->GetMeshDS()->ShapeToIndex( *edgeIt ), isReverse ); + isReverse = ( edgeIt->Orientation() == TopAbs_REVERSED ); + double f = u2colMap.begin()->first, l = u2colMap.rbegin()->first; + if ( isReverse ) swap ( f, l ); + const int nbCol = 5; + for ( int i = 0; i < nbCol; ++i ) + { + double u = f + i/double(nbCol) * ( l - f ); + const TNodeColumn* col = & getColumn( & u2colMap, u )->second; + if ( columns.empty() || col != columns.back() ) + columns.push_back( col ); + } + } + } + + // Find tolerance to check transformations + + double tol2; + { + Bnd_B3d bndBox; + for ( int i = 0; i < columns.size(); ++i ) + bndBox.Add( gpXYZ( columns[i]->front() )); + tol2 = bndBox.SquareExtent() * 4 * 1e-4; + } + + // Compute transformations + + int xCol = -1; + gp_Trsf fromCsZ, toCs0; + gp_Ax3 cs0 = getLayerCoordSys(0, columns, xCol ); + //double dist0 = cs0.Location().Distance( gpXYZ( (*columns[0])[0])); + toCs0.SetTransformation( cs0 ); + for ( int z = 1; z < zSize-1; ++z ) + { + gp_Ax3 csZ = getLayerCoordSys(z, columns, xCol ); + //double distZ = csZ.Location().Distance( gpXYZ( (*columns[0])[z])); + fromCsZ.SetTransformation( csZ ); + fromCsZ.Invert(); + gp_Trsf& t = trsf[ z-1 ]; + t = fromCsZ * toCs0; + //t.SetScaleFactor( distZ/dist0 ); - it does not work properly, wrong base point + + // check a transformation + for ( int i = 0; i < columns.size(); ++i ) + { + gp_Pnt p0 = gpXYZ( (*columns[i])[0] ); + gp_Pnt pz = gpXYZ( (*columns[i])[z] ); + t.Transforms( p0.ChangeCoord() ); + if ( p0.SquareDistance( pz ) > tol2 ) + return false; + } + } + return true; +} + //================================================================================ /*! * \brief Check curve orientation of a bootom edge @@ -1467,14 +1739,14 @@ bool StdMeshers_PrismAsBlock::IsForwardEdge(SMESHDS_Mesh* meshDS, } //================================================================================ - /*! - * \brief Find wall faces by bottom edges - * \param mesh - the mesh - * \param mainShape - the prism - * \param bottomFace - the bottom face - * \param bottomEdges - edges bounding the bottom face - * \param wallFaces - faces list to fill in - */ +/*! + * \brief Find wall faces by bottom edges + * \param mesh - the mesh + * \param mainShape - the prism + * \param bottomFace - the bottom face + * \param bottomEdges - edges bounding the bottom face + * \param wallFaces - faces list to fill in + */ //================================================================================ bool StdMeshers_PrismAsBlock::GetWallFaces( SMESH_Mesh* mesh, @@ -1727,8 +1999,6 @@ double StdMeshers_PrismAsBlock::TSideFace::GetColumns(const double U, r = 0.5; } else { -// if ( !myIsForward ) -// std::swap( col1, col2 ); double uf = col1->first; double ul = col2->first; r = ( u - uf ) / ( ul - uf ); @@ -1748,8 +2018,8 @@ double StdMeshers_PrismAsBlock::TSideFace::GetColumns(const double U, gp_Pnt StdMeshers_PrismAsBlock::TSideFace::Value(const Standard_Real U, const Standard_Real V) const { - double u; if ( !myComponents.empty() ) { + double u; TSideFace * comp = GetComponent(U,u); return comp->Value( u, V ); } @@ -1761,7 +2031,41 @@ gp_Pnt StdMeshers_PrismAsBlock::TSideFace::Value(const Standard_Real U, const SMDS_MeshNode* n2 = 0; const SMDS_MeshNode* n3 = 0; const SMDS_MeshNode* n4 = 0; - gp_XYZ pnt; + + // BEGIN issue 0020680: EDF 1252 SMESH: Bad cell created by Radial prism in center of torus + // Workaround for a wrongly located point returned by mySurface.Value() for + // UV located near boundary of BSpline surface. + // To bypass the problem, we take point from 3D curve of edge. + // It solves pb of the bloc_fiss_new.py + const double tol = 1e-3; + if ( V < tol || V+tol >= 1. ) + { + n1 = V < tol ? u_col1->second.front() : u_col1->second.back(); + n3 = V < tol ? u_col2->second.front() : u_col2->second.back(); + TopoDS_Edge edge; + if ( V < tol ) + { + edge = myBaseEdge; + } + else + { + TopoDS_Shape s = myHelper->GetSubShapeByNode( n1, myHelper->GetMeshDS() ); + if ( s.ShapeType() != TopAbs_EDGE ) + s = myHelper->GetSubShapeByNode( n3, myHelper->GetMeshDS() ); + if ( s.ShapeType() == TopAbs_EDGE ) + edge = TopoDS::Edge( s ); + } + if ( !edge.IsNull() ) + { + double u1 = myHelper->GetNodeU( edge, n1 ); + double u3 = myHelper->GetNodeU( edge, n3 ); + double u = u1 * ( 1 - hR ) + u3 * hR; + TopLoc_Location loc; double f,l; + Handle(Geom_Curve) curve = BRep_Tool::Curve( edge,loc,f,l ); + return curve->Value( u ).Transformed( loc ); + } + } + // END issue 0020680: EDF 1252 SMESH: Bad cell created by Radial prism in center of torus vR = getRAndNodes( & u_col1->second, V, n1, n2 ); vR = getRAndNodes( & u_col2->second, V, n3, n4 ); @@ -1775,8 +2079,9 @@ gp_Pnt StdMeshers_PrismAsBlock::TSideFace::Value(const Standard_Real U, gp_XY uv34 = uv3 * ( 1 - vR ) + uv4 * vR; gp_XY uv = uv12 * ( 1 - hR ) + uv34 * hR; - - return mySurface.Value( uv.X(), uv.Y() ); + + gp_Pnt p = mySurface.Value( uv.X(), uv.Y() ); + return p; } @@ -1954,6 +2259,28 @@ int StdMeshers_PrismAsBlock::TSideFace::InsertSubShapes(TBlockShapes& shapeMap) return nbInserted; } +//================================================================================ +/*! + * \brief Dump ids of nodes of sides + */ +//================================================================================ + +void StdMeshers_PrismAsBlock::TSideFace::dumpNodes(int nbNodes) const +{ +#ifdef _DEBUG_ + cout << endl << "NODES OF FACE "; SMESH_Block::DumpShapeID( myID, cout ) << endl; + THorizontalEdgeAdaptor* hSize0 = (THorizontalEdgeAdaptor*) HorizCurve(0); + cout << "Horiz side 0: "; hSize0->dumpNodes(nbNodes); cout << endl; + THorizontalEdgeAdaptor* hSize1 = (THorizontalEdgeAdaptor*) HorizCurve(1); + cout << "Horiz side 1: "; hSize1->dumpNodes(nbNodes); cout << endl; + TVerticalEdgeAdaptor* vSide0 = (TVerticalEdgeAdaptor*) VertiCurve(0); + cout << "Verti side 0: "; vSide0->dumpNodes(nbNodes); cout << endl; + TVerticalEdgeAdaptor* vSide1 = (TVerticalEdgeAdaptor*) VertiCurve(1); + cout << "Verti side 1: "; vSide1->dumpNodes(nbNodes); cout << endl; + delete hSize0; delete hSize1; delete vSide0; delete vSide1; +#endif +} + //================================================================================ /*! * \brief Creates TVerticalEdgeAdaptor @@ -1984,6 +2311,22 @@ gp_Pnt StdMeshers_PrismAsBlock::TVerticalEdgeAdaptor::Value(const Standard_Real return gpXYZ(n1) * ( 1 - r ) + gpXYZ(n2) * r; } +//================================================================================ +/*! + * \brief Dump ids of nodes + */ +//================================================================================ + +void StdMeshers_PrismAsBlock::TVerticalEdgeAdaptor::dumpNodes(int nbNodes) const +{ +#ifdef _DEBUG_ + for ( int i = 0; i < nbNodes && i < myNodeColumn->size(); ++i ) + cout << (*myNodeColumn)[i]->GetID() << " "; + if ( nbNodes < myNodeColumn->size() ) + cout << myNodeColumn->back()->GetID(); +#endif +} + //================================================================================ /*! * \brief Return coordinates for the given normalized parameter @@ -1997,6 +2340,50 @@ gp_Pnt StdMeshers_PrismAsBlock::THorizontalEdgeAdaptor::Value(const Standard_Rea return mySide->TSideFace::Value( U, myV ); } +//================================================================================ +/*! + * \brief Dump ids of first nodes and the last one + */ +//================================================================================ + +void StdMeshers_PrismAsBlock::THorizontalEdgeAdaptor::dumpNodes(int nbNodes) const +{ +#ifdef _DEBUG_ + // Not bedugged code. Last node is sometimes incorrect + const TSideFace* side = mySide; + double u = 0; + if ( mySide->IsComplex() ) + side = mySide->GetComponent(0,u); + + TParam2ColumnIt col, col2; + TParam2ColumnMap* u2cols = side->GetColumns(); + side->GetColumns( u , col, col2 ); + + int j, i = myV ? mySide->ColumnHeight()-1 : 0; + + const SMDS_MeshNode* n = 0; + const SMDS_MeshNode* lastN + = side->IsForward() ? u2cols->rbegin()->second[ i ] : u2cols->begin()->second[ i ]; + for ( j = 0; j < nbNodes && n != lastN; ++j ) + { + n = col->second[ i ]; + cout << n->GetID() << " "; + if ( side->IsForward() ) + ++col; + else + --col; + } + + // last node + u = 1; + if ( mySide->IsComplex() ) + side = mySide->GetComponent(1,u); + + side->GetColumns( u , col, col2 ); + if ( n != col->second[ i ] ) + cout << col->second[ i ]->GetID(); +#endif +} //================================================================================ /*! * \brief Return UV on pcurve for the given normalized parameter diff --git a/src/StdMeshers/StdMeshers_Prism_3D.hxx b/src/StdMeshers/StdMeshers_Prism_3D.hxx index d258bb432..d7278e813 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.hxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Prism_3D.hxx // Module : SMESH @@ -46,6 +47,7 @@ #include #include #include +#include class SMESHDS_SubMesh; @@ -58,7 +60,7 @@ typedef std::vector TNodeColumn; // map of bottom nodes to the column of nodes above them // (the column includes the bottom nodes) -typedef std::map< TNode, TNodeColumn > TNode2ColumnMap; +typedef std::map< TNode, TNodeColumn > TNode2ColumnMap; typedef std::map< double, TNodeColumn > TParam2ColumnMap; typedef std::map< double, TNodeColumn >::const_iterator TParam2ColumnIt; @@ -73,11 +75,11 @@ typedef TopTools_IndexedMapOfOrientedShape TBlockShapes; struct TNode { const SMDS_MeshNode* myNode; - gp_XYZ myParams; + mutable gp_XYZ myParams; gp_XYZ GetCoords() const { return gp_XYZ( myNode->X(), myNode->Y(), myNode->Z() ); } gp_XYZ GetParams() const { return myParams; } - gp_XYZ& ChangeParams() { return myParams; } + gp_XYZ& ChangeParams() const { return myParams; } bool HasParams() const { return myParams.X() >= 0.0; } SMDS_TypeOfPosition GetPositionType() const { return myNode ? myNode->GetPosition()->GetTypeOfPosition() : SMDS_TOP_UNSPEC; } @@ -144,13 +146,20 @@ public: * \retval const TParam2ColumnMap& - map */ const TParam2ColumnMap& GetParam2ColumnMap(const int baseEdgeID, - bool & isReverse) + bool & isReverse) const { - std::pair< TParam2ColumnMap*, bool > & col_frw = - myShapeIndex2ColumnMap[ baseEdgeID ]; + std::pair< TParam2ColumnMap*, bool > col_frw = + myShapeIndex2ColumnMap.find( baseEdgeID )->second; isReverse = !col_frw.second; return * col_frw.first; } + + /*! + * \brief Return transformations to get coordinates of nodes of each internal layer + * by nodes of the bottom. Layer is a set of nodes at a certain step + * from bottom to top. + */ + bool GetLayersTransformation(std::vector & trsf) const; /*! * \brief Return pointer to mesh @@ -284,6 +293,8 @@ private: int InsertSubShapes( TBlockShapes& shapeMap ) const; // redefine Adaptor methods gp_Pnt Value(const Standard_Real U,const Standard_Real V) const; + // debug + void dumpNodes(int nbNodes) const; }; // -------------------------------------------------------------------- @@ -299,6 +310,8 @@ private: gp_Pnt Value(const Standard_Real U) const; Standard_Real FirstParameter() const { return 0; } Standard_Real LastParameter() const { return 1; } + // debug + void dumpNodes(int nbNodes) const; }; // -------------------------------------------------------------------- @@ -316,6 +329,8 @@ private: gp_Pnt Value(const Standard_Real U) const; Standard_Real FirstParameter() const { return 0; } Standard_Real LastParameter() const { return 1; } + // debug + void dumpNodes(int nbNodes) const; }; // -------------------------------------------------------------------- @@ -337,20 +352,19 @@ private: Standard_Real FirstParameter() const { return 0; } Standard_Real LastParameter() const { return 1; } }; - // -------------------------------------------------------------------- - bool myNotQuadOnTop; - SMESH_MesherHelper* myHelper; - TBlockShapes myShapeIDMap; + bool myNotQuadOnTop; + SMESH_MesherHelper* myHelper; + TBlockShapes myShapeIDMap; + SMESH_ComputeErrorPtr myError; // container of 4 side faces - TSideFace* mySide; + TSideFace* mySide; // node columns for each base edge - std::vector< TParam2ColumnMap > myParam2ColumnMaps; + std::vector< TParam2ColumnMap > myParam2ColumnMaps; // to find a column for a node by edge SMESHDS Index std::map< int, std::pair< TParam2ColumnMap*, bool > > myShapeIndex2ColumnMap; - SMESH_ComputeErrorPtr myError; /*! * \brief store error and comment and then return ( error == COMPERR_OK ) */ @@ -358,7 +372,6 @@ private: myError = SMESH_ComputeError::New(error,comment); return myError->IsOK(); } - //std::vector< SMESH_subMesh* > mySubMeshesVec; // submesh by in-block id }; // ============================================= @@ -432,7 +445,7 @@ private: StdMeshers_PrismAsBlock myBlock; SMESH_MesherHelper* myHelper; - std::vector myShapeXYZ; // point on each sub-shape + std::vector myShapeXYZ; // point on each sub-shape of the block // map of bottom nodes to the column of nodes above them // (the column includes the bottom node) diff --git a/src/StdMeshers/StdMeshers_ProjectionSource1D.cxx b/src/StdMeshers/StdMeshers_ProjectionSource1D.cxx index 9be958436..2fe95fa57 100644 --- a/src/StdMeshers/StdMeshers_ProjectionSource1D.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionSource1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's classes // File : StdMeshers_ProjectionSource1D.cxx // Author : Edward AGAPOV diff --git a/src/StdMeshers/StdMeshers_ProjectionSource1D.hxx b/src/StdMeshers/StdMeshers_ProjectionSource1D.hxx index 301dedf30..0f0549a8d 100644 --- a/src/StdMeshers/StdMeshers_ProjectionSource1D.hxx +++ b/src/StdMeshers/StdMeshers_ProjectionSource1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_ProjectionSource1D.hxx // Author : Edward AGAPOV diff --git a/src/StdMeshers/StdMeshers_ProjectionSource2D.cxx b/src/StdMeshers/StdMeshers_ProjectionSource2D.cxx index be0d809eb..068346f52 100644 --- a/src/StdMeshers/StdMeshers_ProjectionSource2D.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionSource2D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,11 +19,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's classes // File : StdMeshers_ProjectionSource2D.cxx // Author : Edward AGAPOV // Module : SMESH - +// #include "StdMeshers_ProjectionSource2D.hxx" #include "SMESH_Mesh.hxx" diff --git a/src/StdMeshers/StdMeshers_ProjectionSource2D.hxx b/src/StdMeshers/StdMeshers_ProjectionSource2D.hxx index a23d4c494..5f973bcaa 100644 --- a/src/StdMeshers/StdMeshers_ProjectionSource2D.hxx +++ b/src/StdMeshers/StdMeshers_ProjectionSource2D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,11 +19,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_ProjectionSource2D.hxx // Author : Edward AGAPOV // Module : SMESH - +// #ifndef _SMESH_ProjectionSource2D_HXX_ #define _SMESH_ProjectionSource2D_HXX_ diff --git a/src/StdMeshers/StdMeshers_ProjectionSource3D.cxx b/src/StdMeshers/StdMeshers_ProjectionSource3D.cxx index 4a8aa1086..c7b404d14 100644 --- a/src/StdMeshers/StdMeshers_ProjectionSource3D.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionSource3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,11 +19,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's classes // File : StdMeshers_ProjectionSource3D.cxx // Author : Edward AGAPOV // Module : SMESH - +// #include "StdMeshers_ProjectionSource3D.hxx" #include "utilities.h" diff --git a/src/StdMeshers/StdMeshers_ProjectionSource3D.hxx b/src/StdMeshers/StdMeshers_ProjectionSource3D.hxx index fd6848aec..ce37bac82 100644 --- a/src/StdMeshers/StdMeshers_ProjectionSource3D.hxx +++ b/src/StdMeshers/StdMeshers_ProjectionSource3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,11 +19,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_ProjectionSource3D.hxx // Author : Edward AGAPOV // Module : SMESH - +// #ifndef _SMESH_ProjectionSource3D_HXX_ #define _SMESH_ProjectionSource3D_HXX_ diff --git a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx index a964b99c9..c2dcb0c29 100644 --- a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_ProjectionUtils.cxx // Created : Fri Oct 27 10:24:28 2006 @@ -1283,44 +1284,6 @@ bool StdMeshers_ProjectionUtils::InsertAssociation( const TopoDS_Shape& theShape return false; } -//======================================================================= -//function : IsSubShape -//purpose : -//======================================================================= - -bool StdMeshers_ProjectionUtils::IsSubShape( const TopoDS_Shape& shape, - SMESH_Mesh* aMesh ) -{ - if ( shape.IsNull() || !aMesh ) - return false; - return - aMesh->GetMeshDS()->ShapeToIndex( shape ) || - // PAL16202 - shape.ShapeType() == TopAbs_COMPOUND && aMesh->GetMeshDS()->IsGroupOfSubShapes( shape ); -} - -//======================================================================= -//function : IsSubShape -//purpose : -//======================================================================= - -bool StdMeshers_ProjectionUtils::IsSubShape( const TopoDS_Shape& shape, - const TopoDS_Shape& mainShape ) -{ - if ( !shape.IsNull() && !mainShape.IsNull() ) - { - for ( TopExp_Explorer exp( mainShape, shape.ShapeType()); - exp.More(); - exp.Next() ) - if ( shape.IsSame( exp.Current() )) - return true; - } - SCRUTE((shape.IsNull())); - SCRUTE((mainShape.IsNull())); - return false; -} - - //======================================================================= /*! * \brief Finds an edge by its vertices in a main shape of the mesh @@ -1536,7 +1499,7 @@ FindMatchingNodesOnFaces( const TopoDS_Face& face1, if ( !assocMap.IsBound( e2 )) RETURN_BAD_RESULT("Association not found for edge " << meshDS2->ShapeToIndex( e2 )); TopoDS_Edge e1 = TopoDS::Edge( assocMap( e2 )); - if ( !IsSubShape( e1, face1 )) + if ( !helper1.IsSubShape( e1, face1 )) RETURN_BAD_RESULT("Wrong association, edge " << meshDS1->ShapeToIndex( e1 ) << " isn't a subshape of face " << meshDS1->ShapeToIndex( face1 )); // check that there are nodes on edges diff --git a/src/StdMeshers/StdMeshers_ProjectionUtils.hxx b/src/StdMeshers/StdMeshers_ProjectionUtils.hxx index dab575503..6a657e55d 100644 --- a/src/StdMeshers/StdMeshers_ProjectionUtils.hxx +++ b/src/StdMeshers/StdMeshers_ProjectionUtils.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_ProjectionUtils.hxx // Created : Thu Oct 26 15:37:24 2006 @@ -111,10 +112,6 @@ class StdMeshers_ProjectionUtils TShapeShapeMap & theAssociationMap, const bool theBidirectional=true); - static bool IsSubShape( const TopoDS_Shape& shape, SMESH_Mesh* aMesh ); - - static bool IsSubShape( const TopoDS_Shape& shape, const TopoDS_Shape& mainShape ); - /*! * \brief Finds an edge by its vertices in a main shape of the mesh */ diff --git a/src/StdMeshers/StdMeshers_Projection_1D.cxx b/src/StdMeshers/StdMeshers_Projection_1D.cxx index df55fc267..1a2b67fcd 100644 --- a/src/StdMeshers/StdMeshers_Projection_1D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Projection_1D.cxx // Module : SMESH @@ -67,7 +68,7 @@ StdMeshers_Projection_1D::StdMeshers_Projection_1D(int hypId, int studyId, SMESH :SMESH_1D_Algo(hypId, studyId, gen) { _name = "Projection_1D"; - _shapeType = (1 << TopAbs_EDGE); // 1 bit per shape type + _shapeType = (1 << TopAbs_EDGE); // 1 bit per shape type _compatibleHypothesis.push_back("ProjectionSource1D"); _sourceHypo = 0; @@ -128,25 +129,25 @@ bool StdMeshers_Projection_1D::CheckHypothesis(SMESH_Mesh& if ( _sourceHypo->HasVertexAssociation() ) { // source and target vertices - if ( !TAssocTool::IsSubShape( _sourceHypo->GetSourceVertex(), srcMesh ) || - !TAssocTool::IsSubShape( _sourceHypo->GetTargetVertex(), tgtMesh ) || - !TAssocTool::IsSubShape( _sourceHypo->GetSourceVertex(), - _sourceHypo->GetSourceEdge() )) + if ( !SMESH_MesherHelper::IsSubShape( _sourceHypo->GetSourceVertex(), srcMesh ) || + !SMESH_MesherHelper::IsSubShape( _sourceHypo->GetTargetVertex(), tgtMesh ) || + !SMESH_MesherHelper::IsSubShape( _sourceHypo->GetSourceVertex(), + _sourceHypo->GetSourceEdge() )) { aStatus = HYP_BAD_PARAMETER; - SCRUTE((TAssocTool::IsSubShape( _sourceHypo->GetSourceVertex(), srcMesh ))); - SCRUTE((TAssocTool::IsSubShape( _sourceHypo->GetTargetVertex(), tgtMesh ))); - SCRUTE((TAssocTool::IsSubShape( _sourceHypo->GetSourceVertex(), - _sourceHypo->GetSourceEdge() ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( _sourceHypo->GetSourceVertex(), srcMesh ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( _sourceHypo->GetTargetVertex(), tgtMesh ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( _sourceHypo->GetSourceVertex(), + _sourceHypo->GetSourceEdge() ))); } // PAL16202 - else + else { - bool isSub = TAssocTool::IsSubShape( _sourceHypo->GetTargetVertex(), aShape ); + bool isSub = SMESH_MesherHelper::IsSubShape( _sourceHypo->GetTargetVertex(), aShape ); if ( !_sourceHypo->IsCompoundSource() ) { if ( !isSub ) { aStatus = HYP_BAD_PARAMETER; - SCRUTE((TAssocTool::IsSubShape( _sourceHypo->GetTargetVertex(), aShape))); + SCRUTE((SMESH_MesherHelper::IsSubShape( _sourceHypo->GetTargetVertex(), aShape))); } } else if ( isSub ) { @@ -159,7 +160,7 @@ bool StdMeshers_Projection_1D::CheckHypothesis(SMESH_Mesh& { const TopoDS_Shape& ancestor = ancestIt.Value(); if ( ancestor.ShapeType() == TopAbs_EDGE && - TAssocTool::IsSubShape( ancestor, _sourceHypo->GetSourceEdge() )) + SMESH_MesherHelper::IsSubShape( ancestor, _sourceHypo->GetSourceEdge() )) { if ( sharingEdge.IsNull() || ancestor.IsSame( sharingEdge )) sharingEdge = ancestor; @@ -175,11 +176,11 @@ bool StdMeshers_Projection_1D::CheckHypothesis(SMESH_Mesh& } } // check source edge - if ( !TAssocTool::IsSubShape( _sourceHypo->GetSourceEdge(), srcMesh ) || + if ( !SMESH_MesherHelper::IsSubShape( _sourceHypo->GetSourceEdge(), srcMesh ) || ( srcMesh == tgtMesh && aShape == _sourceHypo->GetSourceEdge() )) { aStatus = HYP_BAD_PARAMETER; - SCRUTE((TAssocTool::IsSubShape( _sourceHypo->GetSourceEdge(), srcMesh ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( _sourceHypo->GetSourceEdge(), srcMesh ))); SCRUTE((srcMesh == tgtMesh)); SCRUTE(( aShape == _sourceHypo->GetSourceEdge() )); } @@ -379,8 +380,8 @@ bool StdMeshers_Projection_1D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& //======================================================================= bool StdMeshers_Projection_1D::Evaluate(SMESH_Mesh& theMesh, - const TopoDS_Shape& theShape, - MapShapeNbElems& aResMap) + const TopoDS_Shape& theShape, + MapShapeNbElems& aResMap) { if ( !_sourceHypo ) return false; @@ -390,7 +391,7 @@ bool StdMeshers_Projection_1D::Evaluate(SMESH_Mesh& theMesh, if ( !srcMesh ) srcMesh = tgtMesh; - SMESHDS_Mesh * meshDS = theMesh.GetMeshDS(); + //SMESHDS_Mesh * meshDS = theMesh.GetMeshDS(); // --------------------------- // Make subshapes association @@ -433,8 +434,8 @@ bool StdMeshers_Projection_1D::Evaluate(SMESH_Mesh& theMesh, // Find out nodes distribution on the source edge // ----------------------------------------------- - double srcLength = EdgeLength( srcEdge ); - double tgtLength = EdgeLength( tgtEdge ); + //double srcLength = EdgeLength( srcEdge ); + //double tgtLength = EdgeLength( tgtEdge ); vector< double > params; // sorted parameters of nodes on the source edge if ( !SMESH_Algo::GetNodeParamOnEdge( srcMesh->GetMeshDS(), srcEdge, params )) diff --git a/src/StdMeshers/StdMeshers_Projection_1D.hxx b/src/StdMeshers/StdMeshers_Projection_1D.hxx index be003ed7b..e188bf227 100644 --- a/src/StdMeshers/StdMeshers_Projection_1D.hxx +++ b/src/StdMeshers/StdMeshers_Projection_1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Projection_1D.hxx // Module : SMESH diff --git a/src/StdMeshers/StdMeshers_Projection_2D.cxx b/src/StdMeshers/StdMeshers_Projection_2D.cxx index 63b843d32..7af5ee189 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Projection_2D.cxx // Module : SMESH @@ -50,6 +51,8 @@ #include #include #include +#include +#include using namespace std; @@ -67,7 +70,7 @@ StdMeshers_Projection_2D::StdMeshers_Projection_2D(int hypId, int studyId, SMESH :SMESH_2D_Algo(hypId, studyId, gen) { _name = "Projection_2D"; - _shapeType = (1 << TopAbs_FACE); // 1 bit per shape type + _shapeType = (1 << TopAbs_FACE); // 1 bit per shape type _compatibleHypothesis.push_back("ProjectionSource2D"); _sourceHypo = 0; @@ -130,40 +133,40 @@ bool StdMeshers_Projection_2D::CheckHypothesis(SMESH_Mesh& TopoDS_Shape edge = TAssocTool::GetEdgeByVertices ( srcMesh, _sourceHypo->GetSourceVertex(1), _sourceHypo->GetSourceVertex(2) ); if ( edge.IsNull() || - !TAssocTool::IsSubShape( edge, srcMesh ) || - !TAssocTool::IsSubShape( edge, _sourceHypo->GetSourceFace() )) + !SMESH_MesherHelper::IsSubShape( edge, srcMesh ) || + !SMESH_MesherHelper::IsSubShape( edge, _sourceHypo->GetSourceFace() )) { theStatus = HYP_BAD_PARAMETER; SCRUTE((edge.IsNull())); - SCRUTE((TAssocTool::IsSubShape( edge, srcMesh ))); - SCRUTE((TAssocTool::IsSubShape( edge, _sourceHypo->GetSourceFace() ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( edge, srcMesh ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( edge, _sourceHypo->GetSourceFace() ))); } else { // target vertices edge = TAssocTool::GetEdgeByVertices ( tgtMesh, _sourceHypo->GetTargetVertex(1), _sourceHypo->GetTargetVertex(2) ); - if ( edge.IsNull() || !TAssocTool::IsSubShape( edge, tgtMesh )) + if ( edge.IsNull() || !SMESH_MesherHelper::IsSubShape( edge, tgtMesh )) { theStatus = HYP_BAD_PARAMETER; SCRUTE((edge.IsNull())); - SCRUTE((TAssocTool::IsSubShape( edge, tgtMesh ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( edge, tgtMesh ))); } // PAL16203 else if ( !_sourceHypo->IsCompoundSource() && - !TAssocTool::IsSubShape( edge, theShape )) + !SMESH_MesherHelper::IsSubShape( edge, theShape )) { theStatus = HYP_BAD_PARAMETER; - SCRUTE((TAssocTool::IsSubShape( edge, theShape ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( edge, theShape ))); } } } // check a source face - if ( !TAssocTool::IsSubShape( _sourceHypo->GetSourceFace(), srcMesh ) || + if ( !SMESH_MesherHelper::IsSubShape( _sourceHypo->GetSourceFace(), srcMesh ) || ( srcMesh == tgtMesh && theShape == _sourceHypo->GetSourceFace() )) { theStatus = HYP_BAD_PARAMETER; - SCRUTE((TAssocTool::IsSubShape( _sourceHypo->GetSourceFace(), srcMesh ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( _sourceHypo->GetSourceFace(), srcMesh ))); SCRUTE((srcMesh == tgtMesh)); SCRUTE(( theShape == _sourceHypo->GetSourceFace() )); } @@ -177,12 +180,11 @@ bool StdMeshers_Projection_2D::CheckHypothesis(SMESH_Mesh& namespace { - //================================================================================ /*! * \brief define if a node is new or old - * \param node - node to check - * \retval bool - true if the node existed before Compute() is called + * \param node - node to check + * \retval bool - true if the node existed before Compute() is called */ //================================================================================ @@ -356,7 +358,8 @@ namespace { //================================================================================ /*! - * \brief Preform projection in case if tgtFace.IsPartner( srcFace ) + * \brief Preform projection in case if tgtFace.IsPartner( srcFace ) and in case + * if projection by transformation is possible * \param tgtFace - target face * \param srcFace - source face * \param tgtMesh - target mesh @@ -371,8 +374,96 @@ namespace { SMESH_Mesh * srcMesh, const TAssocTool::TShapeShapeMap& shape2ShapeMap) { - if ( !tgtFace.IsPartner( srcFace )) - return false; + const double tol = 1e-6; + + gp_Trsf trsf; // transformation to get location of target nodes from source ones + if ( tgtFace.IsPartner( srcFace )) + { + gp_Trsf srcTrsf = srcFace.Location(); + gp_Trsf tgtTrsf = tgtFace.Location(); + trsf = srcTrsf.Inverted() * tgtTrsf; + } + else + { + // Try to find the transformation + + // make any local coord systems of src and tgt faces + vector srcPP, tgtPP; // 3 points on face boundaries to make axes of CS + SMESH_subMesh * srcSM = srcMesh->GetSubMesh( srcFace ); + SMESH_subMeshIteratorPtr smIt = srcSM->getDependsOnIterator(/*includeSelf=*/false,false); + srcSM = smIt->next(); // sm of a vertex + while ( smIt->more() && srcPP.size() < 3 ) + { + srcSM = smIt->next(); + SMESHDS_SubMesh* srcSmds = srcSM->GetSubMeshDS(); + if ( !srcSmds ) continue; + SMDS_NodeIteratorPtr nIt = srcSmds->GetNodes(); + while ( nIt->more() ) + { + SMESH_MeshEditor::TNodeXYZ p ( nIt->next()); + bool pOK = false; + switch ( srcPP.size() ) + { + case 0: pOK = true; break; + + case 1: pOK = ( srcPP[0].SquareDistance( p ) > tol ); break; + + case 2: + { + gp_Vec p0p1( srcPP[0], srcPP[1] ), p0p( srcPP[0], p ); + pOK = !p0p1.IsParallel( p0p, tol ); + break; + } + } + if ( !pOK ) + continue; + + // find corresponding point on target shape + pOK = false; + gp_Pnt tgtP; + const TopoDS_Shape& tgtShape = shape2ShapeMap( srcSM->GetSubShape() ); + if ( tgtShape.ShapeType() == TopAbs_VERTEX ) + { + tgtP = BRep_Tool::Pnt( TopoDS::Vertex( tgtShape )); + pOK = true; + //cout << "V - nS " << p._node->GetID() << " - nT " << SMESH_Algo::VertexNode(TopoDS::Vertex( tgtShape),tgtMesh->GetMeshDS())->GetID() << endl; + } + else if ( tgtPP.size() > 0 ) + { + if ( SMESHDS_SubMesh* tgtSmds = tgtMesh->GetMeshDS()->MeshElements( tgtShape )) + { + double srcDist = srcPP[0].Distance( p ); + double eTol = BRep_Tool::Tolerance( TopoDS::Edge( tgtShape )); + SMDS_NodeIteratorPtr nItT = tgtSmds->GetNodes(); + while ( nItT->more() && !pOK ) + { + const SMDS_MeshNode* n = nItT->next(); + tgtP = SMESH_MeshEditor::TNodeXYZ( n ); + pOK = ( fabs( srcDist - tgtPP[0].Distance( tgtP )) < 2*eTol ); + //cout << "E - nS " << p._node->GetID() << " - nT " << n->GetID()<< " OK - " << pOK<< " " << fabs( srcDist - tgtPP[0].Distance( tgtP ))<< " tol " << eTol<< endl; + } + } + } + if ( !pOK ) + continue; + + srcPP.push_back( p ); + tgtPP.push_back( tgtP ); + } + } + if ( srcPP.size() != 3 ) + return false; + + // make transformation + gp_Trsf fromTgtCS, toSrcCS; // from/to global CS + gp_Ax2 srcCS( srcPP[0], gp_Vec( srcPP[0], srcPP[1] ), gp_Vec( srcPP[0], srcPP[2])); + gp_Ax2 tgtCS( tgtPP[0], gp_Vec( tgtPP[0], tgtPP[1] ), gp_Vec( tgtPP[0], tgtPP[2])); + toSrcCS .SetTransformation( gp_Ax3( srcCS )); + fromTgtCS.SetTransformation( gp_Ax3( tgtCS )); + fromTgtCS.Invert(); + + trsf = fromTgtCS * toSrcCS; + } // Fill map of src to tgt nodes with nodes on edges @@ -382,8 +473,6 @@ namespace { for ( TopExp_Explorer srcEdge( srcFace, TopAbs_EDGE); srcEdge.More(); srcEdge.Next() ) { const TopoDS_Shape& tgtEdge = shape2ShapeMap( srcEdge.Current() ); - if ( !tgtEdge.IsPartner( srcEdge.Current() )) - return false; map< double, const SMDS_MeshNode* > srcNodes, tgtNodes; if ( !SMESH_Algo::GetSortedNodesOnEdge( srcMesh->GetMeshDS(), @@ -399,6 +488,30 @@ namespace { srcNodes.size() != tgtNodes.size()) return false; + if ( !tgtEdge.IsPartner( srcEdge.Current() )) + { + // check that transormation is OK by three nodes + gp_Pnt p0S = SMESH_MeshEditor::TNodeXYZ( (srcNodes.begin()) ->second); + gp_Pnt p1S = SMESH_MeshEditor::TNodeXYZ( (srcNodes.rbegin()) ->second); + gp_Pnt p2S = SMESH_MeshEditor::TNodeXYZ( (++srcNodes.begin())->second); + + gp_Pnt p0T = SMESH_MeshEditor::TNodeXYZ( (tgtNodes.begin()) ->second); + gp_Pnt p1T = SMESH_MeshEditor::TNodeXYZ( (tgtNodes.rbegin()) ->second); + gp_Pnt p2T = SMESH_MeshEditor::TNodeXYZ( (++tgtNodes.begin())->second); + + // transform source points, they must coinside with target ones + if ( p0T.SquareDistance( p0S.Transformed( trsf )) > tol || + p1T.SquareDistance( p1S.Transformed( trsf )) > tol || + p2T.SquareDistance( p2S.Transformed( trsf )) > tol ) + { + //cout << "KO trsf, 3 dist: " + //<< p0T.SquareDistance( p0S.Transformed( trsf ))<< ", " + //<< p1T.SquareDistance( p1S.Transformed( trsf ))<< ", " + //<< p2T.SquareDistance( p2S.Transformed( trsf ))<< ", "<::iterator u_tn = tgtNodes.begin(); map< double, const SMDS_MeshNode* >::iterator u_sn = srcNodes.begin(); for ( ; u_tn != tgtNodes.end(); ++u_tn, ++u_sn) @@ -407,11 +520,6 @@ namespace { // Make new faces - // transformation to get location of target nodes from source ones - gp_Trsf srcTrsf = srcFace.Location(); - gp_Trsf tgtTrsf = tgtFace.Location(); - gp_Trsf trsf = srcTrsf.Inverted() * tgtTrsf; - // prepare the helper adding quadratic elements if necessary SMESH_MesherHelper helper( *tgtMesh ); helper.IsQuadraticSubMesh( tgtFace ); @@ -545,9 +653,9 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& RETURN_BAD_RESULT("Not associated vertices, srcV1 " << srcV1.TShape().operator->() ); TopoDS_Vertex tgtV1 = TopoDS::Vertex( shape2ShapeMap( srcV1 )); - if ( !TAssocTool::IsSubShape( srcV1, srcFace )) + if ( !SMESH_MesherHelper::IsSubShape( srcV1, srcFace )) RETURN_BAD_RESULT("Wrong srcV1 " << srcV1.TShape().operator->()); - if ( !TAssocTool::IsSubShape( tgtV1, tgtFace )) + if ( !SMESH_MesherHelper::IsSubShape( tgtV1, tgtFace )) RETURN_BAD_RESULT("Wrong tgtV1 " << tgtV1.TShape().operator->()); // try to find out orientation by order of edges @@ -748,8 +856,8 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& //======================================================================= bool StdMeshers_Projection_2D::Evaluate(SMESH_Mesh& theMesh, - const TopoDS_Shape& theShape, - MapShapeNbElems& aResMap) + const TopoDS_Shape& theShape, + MapShapeNbElems& aResMap) { if ( !_sourceHypo ) return false; diff --git a/src/StdMeshers/StdMeshers_Projection_2D.hxx b/src/StdMeshers/StdMeshers_Projection_2D.hxx index 26506e81a..01eb80b9d 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.hxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Projection_2D.hxx // Module : SMESH diff --git a/src/StdMeshers/StdMeshers_Projection_3D.cxx b/src/StdMeshers/StdMeshers_Projection_3D.cxx index d8939fead..e30980e32 100644 --- a/src/StdMeshers/StdMeshers_Projection_3D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Projection_3D.cxx // Module : SMESH @@ -141,12 +142,12 @@ bool StdMeshers_Projection_3D::CheckHypothesis(SMESH_Mesh& TopoDS_Shape edge = TAssocTool::GetEdgeByVertices ( srcMesh, _sourceHypo->GetSourceVertex(1), _sourceHypo->GetSourceVertex(2) ); if ( edge.IsNull() || - !TAssocTool::IsSubShape( edge, srcMesh ) || - !TAssocTool::IsSubShape( edge, _sourceHypo->GetSource3DShape() )) + !SMESH_MesherHelper::IsSubShape( edge, srcMesh ) || + !SMESH_MesherHelper::IsSubShape( edge, _sourceHypo->GetSource3DShape() )) { SCRUTE((edge.IsNull())); - SCRUTE((TAssocTool::IsSubShape( edge, srcMesh ))); - SCRUTE((TAssocTool::IsSubShape( edge, _sourceHypo->GetSource3DShape() ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( edge, srcMesh ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( edge, _sourceHypo->GetSource3DShape() ))); aStatus = SMESH_Hypothesis::HYP_BAD_PARAMETER; } else @@ -155,21 +156,21 @@ bool StdMeshers_Projection_3D::CheckHypothesis(SMESH_Mesh& edge = TAssocTool::GetEdgeByVertices ( tgtMesh, _sourceHypo->GetTargetVertex(1), _sourceHypo->GetTargetVertex(2) ); if ( edge.IsNull() || - !TAssocTool::IsSubShape( edge, tgtMesh ) || - !TAssocTool::IsSubShape( edge, aShape )) + !SMESH_MesherHelper::IsSubShape( edge, tgtMesh ) || + !SMESH_MesherHelper::IsSubShape( edge, aShape )) { SCRUTE((edge.IsNull())); - SCRUTE((TAssocTool::IsSubShape( edge, tgtMesh ))); - SCRUTE((TAssocTool::IsSubShape( edge, aShape ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( edge, tgtMesh ))); + SCRUTE((SMESH_MesherHelper::IsSubShape( edge, aShape ))); aStatus = SMESH_Hypothesis::HYP_BAD_PARAMETER; } } } // check a source shape - if ( !TAssocTool::IsSubShape( _sourceHypo->GetSource3DShape(), srcMesh ) || + if ( !SMESH_MesherHelper::IsSubShape( _sourceHypo->GetSource3DShape(), srcMesh ) || ( srcMesh == tgtMesh && aShape == _sourceHypo->GetSource3DShape())) { - SCRUTE((TAssocTool::IsSubShape( _sourceHypo->GetSource3DShape(), srcMesh))); + SCRUTE((SMESH_MesherHelper::IsSubShape( _sourceHypo->GetSource3DShape(), srcMesh))); SCRUTE((srcMesh == tgtMesh)); SCRUTE((aShape == _sourceHypo->GetSource3DShape())); aStatus = SMESH_Hypothesis::HYP_BAD_PARAMETER; @@ -266,8 +267,8 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS return error("Association of subshapes failed" ); srcV000 = TopoDS::Vertex( shape2ShapeMap( tgtV000 )); srcV100 = TopoDS::Vertex( shape2ShapeMap( tgtV100 )); - if ( !TAssocTool::IsSubShape( srcV000, srcShell ) || - !TAssocTool::IsSubShape( srcV100, srcShell )) + if ( !SMESH_MesherHelper::IsSubShape( srcV000, srcShell ) || + !SMESH_MesherHelper::IsSubShape( srcV100, srcShell )) return error("Incorrect association of subshapes" ); } diff --git a/src/StdMeshers/StdMeshers_Projection_3D.hxx b/src/StdMeshers/StdMeshers_Projection_3D.hxx index 8f9554509..68aed3780 100644 --- a/src/StdMeshers/StdMeshers_Projection_3D.hxx +++ b/src/StdMeshers/StdMeshers_Projection_3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Projection_3D.hxx // Module : SMESH diff --git a/src/StdMeshers/StdMeshers_Propagation.cxx b/src/StdMeshers/StdMeshers_Propagation.cxx index c6b9b015f..8b88ce99a 100644 --- a/src/StdMeshers/StdMeshers_Propagation.cxx +++ b/src/StdMeshers/StdMeshers_Propagation.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,10 +19,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Propagation.cxx // Module : SMESH - +// #include "StdMeshers_Propagation.hxx" #include "utilities.h" diff --git a/src/StdMeshers/StdMeshers_Propagation.hxx b/src/StdMeshers/StdMeshers_Propagation.hxx index b02f9aebe..c2689d27c 100644 --- a/src/StdMeshers/StdMeshers_Propagation.hxx +++ b/src/StdMeshers/StdMeshers_Propagation.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,10 +19,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Propagation.hxx // Module : SMESH - +// #ifndef _SMESH_PROPAGATION_HXX_ #define _SMESH_PROPAGATION_HXX_ diff --git a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx index fcd7afd08..1ca7e5b12 100644 --- a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx +++ b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_QuadToTriaAdaptor.cxx // Module : SMESH @@ -27,32 +25,27 @@ // #include "StdMeshers_QuadToTriaAdaptor.hxx" -#include #include #include #include #include -#include +#include +#include #include #include #include #include #include -#include -typedef NCollection_Array1 StdMeshers_Array1OfSequenceOfInteger; - +#include -//======================================================================= -//function : StdMeshers_QuadToTriaAdaptor -//purpose : -//======================================================================= +using namespace std; -StdMeshers_QuadToTriaAdaptor::StdMeshers_QuadToTriaAdaptor() -{ -} +enum EQuadNature { NOT_QUAD, QUAD, DEGEN_QUAD }; + // sdt-like iterator used to get coordinates of nodes of mesh element +typedef SMDS_StdIterator< SMESH_MeshEditor::TNodeXYZ, SMDS_ElemIteratorPtr > TXyzIterator; //================================================================================ /*! @@ -63,26 +56,26 @@ StdMeshers_QuadToTriaAdaptor::StdMeshers_QuadToTriaAdaptor() StdMeshers_QuadToTriaAdaptor::~StdMeshers_QuadToTriaAdaptor() { // delete temporary faces - map< const SMDS_MeshElement*, list >::iterator - f_f = myResMap.begin(), ffEnd = myResMap.end(); + TQuad2Trias::iterator f_f = myResMap.begin(), ffEnd = myResMap.end(); for ( ; f_f != ffEnd; ++f_f ) { - list& fList = f_f->second; - list::iterator f = fList.begin(), fEnd = fList.end(); + TTriaList& fList = f_f->second; + TTriaList::iterator f = fList.begin(), fEnd = fList.end(); for ( ; f != fEnd; ++f ) delete *f; } myResMap.clear(); -// TF2PyramMap::iterator itp = myMapFPyram.begin(); -// for(; itp!=myMapFPyram.end(); itp++) +// TF2PyramMap::iterator itp = myPyram2Trias.begin(); +// for(; itp!=myPyram2Trias.end(); itp++) // cout << itp->second << endl; } //======================================================================= //function : FindBestPoint -//purpose : Auxilare for Compute() +//purpose : Return a point P laying on the line (PC,V) so that triangle +// (P, P1, P2) to be equilateral as much as possible // V - normal to (P1,P2,PC) //======================================================================= static gp_Pnt FindBestPoint(const gp_Pnt& P1, const gp_Pnt& P2, @@ -94,11 +87,10 @@ static gp_Pnt FindBestPoint(const gp_Pnt& P1, const gp_Pnt& P2, if( a < (b+c)/2 ) return PC; else { - // find shift along V in order to a became equal to (b+c)/2 + // find shift along V in order a to became equal to (b+c)/2 double shift = sqrt( a*a + (b*b-c*c)*(b*b-c*c)/16/a/a - (b*b+c*c)/2 ); gp_Dir aDir(V); - gp_Pnt Pbest( PC.X() + aDir.X()*shift, PC.Y() + aDir.Y()*shift, - PC.Z() + aDir.Z()*shift ); + gp_Pnt Pbest = PC.XYZ() + aDir.XYZ() * shift; return Pbest; } } @@ -183,6 +175,7 @@ static bool HasIntersection3(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint, //function : HasIntersection //purpose : Auxilare for CheckIntersection() //======================================================================= + static bool HasIntersection(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint, Handle(TColgp_HSequenceOfPnt)& aContour) { @@ -262,78 +255,53 @@ bool StdMeshers_QuadToTriaAdaptor::CheckIntersection //======================================================================= -//function : CompareTrias +//function : EqualTriangles //purpose : Auxilare for Compute() //======================================================================= -static bool CompareTrias(const SMDS_MeshElement* F1,const SMDS_MeshElement* F2) +static bool EqualTriangles(const SMDS_MeshElement* F1,const SMDS_MeshElement* F2) { return ( F1->GetNode(1)==F2->GetNode(2) && F1->GetNode(2)==F2->GetNode(1) ) || ( F1->GetNode(1)==F2->GetNode(1) && F1->GetNode(2)==F2->GetNode(2) ); } +//================================================================================ +/*! + * \brief Prepare data for the given face + * \param PN - coordinates of face nodes + * \param VN - cross products of vectors (PC-PN(i)) ^ (PC-PN(i+1)) + * \param FNodes - face nodes + * \param PC - gravity center of nodes + * \param VNorm - face normal (sum of VN) + * \param volumes - two volumes sharing the given face, the first is in VNorm direction + * \retval int - 0 if given face is not quad, + * 1 if given face is quad, + * 2 if given face is degenerate quad (two nodes are coincided) + */ +//================================================================================ -//======================================================================= -//function : IsDegenarate -//purpose : Auxilare for Preparation() -//======================================================================= -// static int IsDegenarate(const Handle(TColgp_HArray1OfPnt)& PN) -// { -// int i = 1; -// for(; i<4; i++) { -// int j = i+1; -// for(; j<=4; j++) { -// if( PN->Value(i).Distance(PN->Value(j)) < 1.e-6 ) -// return j; -// } -// } -// return 0; -// } - - -//======================================================================= -//function : Preparation -//purpose : Auxilare for Compute() -// : Return 0 if given face is not quad, -// 1 if given face is quad, -// 2 if given face is degenerate quad (two nodes are coincided) -//======================================================================= -int StdMeshers_QuadToTriaAdaptor::Preparation(const SMDS_MeshElement* face, - Handle(TColgp_HArray1OfPnt)& PN, - Handle(TColgp_HArray1OfVec)& VN, - std::vector& FNodes, - gp_Pnt& PC, gp_Vec& VNorm) +int StdMeshers_QuadToTriaAdaptor::Preparation(const SMDS_MeshElement* face, + Handle(TColgp_HArray1OfPnt)& PN, + Handle(TColgp_HArray1OfVec)& VN, + vector& FNodes, + gp_Pnt& PC, + gp_Vec& VNorm, + const SMDS_MeshElement** volumes) { - int i = 0; - double xc=0., yc=0., zc=0.; - SMDS_ElemIteratorPtr nodeIt = face->nodesIterator(); - if( !face->IsQuadratic() ) { + if( face->NbNodes() != ( face->IsQuadratic() ? 8 : 4 )) if( face->NbNodes() != 4 ) - return 0; - while ( nodeIt->more() ) { - i++; - const SMDS_MeshNode* node = static_cast( nodeIt->next() ); - FNodes[i-1] = node; - PN->SetValue( i, gp_Pnt(node->X(), node->Y(), node->Z()) ); - xc += node->X(); - yc += node->Y(); - zc += node->Z(); - } - } - else { - if( face->NbNodes() != 8) - return 0; - while ( nodeIt->more() ) { - i++; - const SMDS_MeshNode* node = static_cast( nodeIt->next() ); - FNodes[i-1] = node; - PN->SetValue( i, gp_Pnt(node->X(), node->Y(), node->Z()) ); - xc += node->X(); - yc += node->Y(); - zc += node->Z(); - if(i==4) break; - } + return NOT_QUAD; + + int i = 0; + gp_XYZ xyzC(0., 0., 0.); + for ( i = 0; i < 4; ++i ) + { + gp_XYZ p = SMESH_MeshEditor::TNodeXYZ( FNodes[i] = face->GetNode(i) ); + PN->SetValue( i+1, p ); + xyzC += p; } + PC = xyzC/4; + //cout<<" PC("<Value(i); - std::list< const SMDS_MeshNode* >::iterator itdg = myDegNodes.begin(); + list< const SMDS_MeshNode* >::iterator itdg = myDegNodes.begin(); const SMDS_MeshNode* DegNode = 0; for(; itdg!=myDegNodes.end(); itdg++) { const SMDS_MeshNode* N = (*itdg); @@ -377,24 +345,15 @@ int StdMeshers_QuadToTriaAdaptor::Preparation(const SMDS_MeshElement* face, FNodes[i-1] = FNodes[i]; } nbp = 3; - //PC = gp_Pnt( PN->Value(1).X() + PN.Value } - PC = gp_Pnt(xc/4., yc/4., zc/4.); - //cout<<" PC("<SetValue(5,PN->Value(1)); PN->SetValue(nbp+1,PN->Value(1)); - //FNodes[4] = FNodes[0]; FNodes[nbp] = FNodes[0]; // find normal direction - //gp_Vec V1(PC,PN->Value(4)); gp_Vec V1(PC,PN->Value(nbp)); gp_Vec V2(PC,PN->Value(1)); VNorm = V1.Crossed(V2); - //VN->SetValue(4,VNorm); VN->SetValue(nbp,VNorm); - //for(i=1; i<4; i++) { for(i=1; iValue(i)); V2 = gp_Vec(PC,PN->Value(i+1)); @@ -402,9 +361,37 @@ int StdMeshers_QuadToTriaAdaptor::Preparation(const SMDS_MeshElement* face, VN->SetValue(i,Vtmp); VNorm += Vtmp; } + + // find volumes sharing the face + if ( volumes ) + { + volumes[0] = volumes[1] = 0; + SMDS_ElemIteratorPtr vIt = FNodes[0]->GetInverseElementIterator( SMDSAbs_Volume ); + while ( vIt->more() ) + { + const SMDS_MeshElement* vol = vIt->next(); + bool volSharesAllNodes = true; + for ( int i = 1; i < face->NbNodes() && volSharesAllNodes; ++i ) + volSharesAllNodes = ( vol->GetNodeIndex( FNodes[i] ) >= 0 ); + if ( volSharesAllNodes ) + volumes[ volumes[0] ? 1 : 0 ] = vol; + // we could additionally check that vol has all FNodes in its one face using SMDS_VolumeTool + } + // define volume position relating to the face normal + if ( volumes[0] ) + { + // get volume gc + SMDS_ElemIteratorPtr nodeIt = volumes[0]->nodesIterator(); + gp_XYZ volGC(0,0,0); + volGC = accumulate( TXyzIterator(nodeIt), TXyzIterator(), volGC ) / volumes[0]->NbNodes(); + + if ( VNorm * gp_Vec( PC, volGC ) < 0 ) + swap( volumes[0], volumes[1] ); + } + } + //cout<<" VNorm("< FNodes(5); + vector FNodes(5); gp_Pnt PC; gp_Vec VNorm; int stat = Preparation(face, PN, VN, FNodes, PC, VNorm); @@ -446,13 +433,12 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape if(stat==2) { // degenerate face // add triangles to result map - std::list aList; SMDS_FaceOfNodes* NewFace; if(!isRev) NewFace = new SMDS_FaceOfNodes( FNodes[0], FNodes[1], FNodes[2] ); else NewFace = new SMDS_FaceOfNodes( FNodes[0], FNodes[2], FNodes[1] ); - aList.push_back(NewFace); + TTriaList aList( 1, NewFace ); myResMap.insert(make_pair(face,aList)); continue; } @@ -504,18 +490,18 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape } // create node for PCbest SMDS_MeshNode* NewNode = helper.AddNode( PCbest.X(), PCbest.Y(), PCbest.Z() ); + // add triangles to result map - std::list aList; - for(i=0; i<4; i++) { - SMDS_FaceOfNodes* NewFace = new SMDS_FaceOfNodes( NewNode, FNodes[i], FNodes[i+1] ); - aList.push_back(NewFace); - } - myResMap.insert(make_pair(face,aList)); + TTriaList& triaList = myResMap.insert( make_pair( face, TTriaList() ))->second; + for(i=0; i<4; i++) + triaList.push_back( new SMDS_FaceOfNodes( NewNode, FNodes[i], FNodes[i+1] )); + // create pyramid + if ( isRev ) swap( FNodes[1], FNodes[3]); SMDS_MeshVolume* aPyram = helper.AddVolume( FNodes[0], FNodes[1], FNodes[2], FNodes[3], NewNode ); - myMapFPyram.insert(make_pair(face,aPyram)); - } // end loop on elements on a face + myPyram2Trias.insert(make_pair(aPyram, & triaList)); + } // end loop on elements on a face submesh } } // end for(TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next()) { @@ -531,7 +517,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh) { myResMap.clear(); - myMapFPyram.clear(); + myPyram2Trias.clear(); SMESH_MesherHelper helper(aMesh); helper.IsQuadraticSubMesh(aMesh.GetShapeToMesh()); helper.SetElementsOnShape( true ); @@ -548,26 +534,29 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh) const SMDS_MeshElement* face = *itFace; if ( !face ) continue; //cout<GetID() = "<GetID()< FNodes(5); + vector FNodes(5); gp_Pnt PC; gp_Vec VNorm; - - int stat = Preparation(face, PN, VN, FNodes, PC, VNorm); - if(stat==0) + const SMDS_MeshElement* volumes[2]; + int what = Preparation(face, PN, VN, FNodes, PC, VNorm, volumes); + if ( what == NOT_QUAD ) continue; + if ( volumes[0] && volumes[1] ) + continue; // face is shared by two volumes - no space for a pyramid - if(stat==2) { + if ( what == DEGEN_QUAD ) + { // degenerate face // add triangles to result map - std::list aList; + TTriaList aList; SMDS_FaceOfNodes* NewFace; // check orientation - double tmp = PN->Value(1).Distance(PN->Value(2)) + - PN->Value(2).Distance(PN->Value(3)); + double tmp = PN->Value(1).Distance(PN->Value(2)) + PN->Value(2).Distance(PN->Value(3)); + // far points in VNorm direction gp_Pnt Ptmp1 = PC.XYZ() + VNorm.XYZ() * tmp * 1.e6; gp_Pnt Ptmp2 = PC.XYZ() - VNorm.XYZ() * tmp * 1.e6; // check intersection for Ptmp1 and Ptmp2 @@ -581,24 +570,10 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh) const SMDS_MeshElement* F = *itF; if(F==face) continue; Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt; - SMDS_ElemIteratorPtr nodeIt = F->nodesIterator(); - if( !F->IsQuadratic() ) { - while ( nodeIt->more() ) { - const SMDS_MeshNode* node = static_cast( nodeIt->next() ); - aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z())); - } - } - else { - int nn = 0; - while ( nodeIt->more() ) { - nn++; - const SMDS_MeshNode* node = static_cast( nodeIt->next() ); - aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z())); - if(nn==face->NbNodes()/2) break; - } - } + for ( int i = 0; i < 4; ++i ) + aContour->Append( SMESH_MeshEditor::TNodeXYZ( F->GetNode(i) )); gp_Pnt PPP; - if( HasIntersection(Ptmp1, PC, PPP, aContour) ) { + if( !volumes[0] && HasIntersection(Ptmp1, PC, PPP, aContour) ) { IsOK1 = true; double tmp = PC.Distance(PPP); if(tmpValue(i), PN->Value(i+1), PC, VN->Value(i)); - xc += Pbest.X(); - yc += Pbest.Y(); - zc += Pbest.Z(); + PCbest += Pbest.XYZ(); } - gp_Pnt PCbest(xc/4., yc/4., zc/4.); - double height = PCbest.Distance(PC); + PCbest /= 4; + + double height = PC.Distance(PCbest); // pyramid height to precise if(height<1.e-6) { // create new PCbest using a bit shift along VNorm PCbest = PC.XYZ() + VNorm.XYZ() * 0.001; - height = PCbest.Distance(PC); + height = PC.Distance(PCbest); } //cout<<" PCbest("<Value(1).Distance(PN->Value(3)) + - PN->Value(2).Distance(PN->Value(4)); - gp_Dir tmpDir(V1); - gp_Pnt Ptmp1 = PC.XYZ() + tmpDir.XYZ() * tmp * 1.e6; - gp_Pnt Ptmp2 = PC.XYZ() - tmpDir.XYZ() * tmp * 1.e6; - // check intersection for Ptmp1 and Ptmp2 - bool IsRev = false; - bool IsOK1 = false; - bool IsOK2 = false; - double dist1 = RealLast(); - double dist2 = RealLast(); - gp_Pnt Pres1,Pres2; - for (TIDSortedElemSet::iterator itF = sortedFaces.begin(); itF != fEnd; ++itF ) { + // Restrict pyramid height by intersection with other faces + gp_Vec tmpDir(PC,PCbest); tmpDir.Normalize(); + double tmp = PN->Value(1).Distance(PN->Value(3)) + PN->Value(2).Distance(PN->Value(4)); + // far points: in (PC, PCbest) direction and vice-versa + gp_Pnt farPnt[2] = { PC.XYZ() + tmpDir.XYZ() * tmp * 1.e6, + PC.XYZ() - tmpDir.XYZ() * tmp * 1.e6 }; + // check intersection for farPnt1 and farPnt2 + bool intersected[2] = { false, false }; + double dist [2] = { RealLast(), RealLast() }; + gp_Pnt intPnt[2]; + for (TIDSortedElemSet::iterator itF = sortedFaces.begin(); itF != fEnd; ++itF ) + { const SMDS_MeshElement* F = *itF; if(F==face) continue; Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt; - SMDS_ElemIteratorPtr nodeIt = F->nodesIterator(); - if( !F->IsQuadratic() ) { - while ( nodeIt->more() ) { - const SMDS_MeshNode* node = static_cast( nodeIt->next() ); - aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z())); - } - } - else { - int nn = 0; - while ( nodeIt->more() ) { - nn++; - const SMDS_MeshNode* node = static_cast( nodeIt->next() ); - aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z())); - if(nn==face->NbNodes()/2) break; - } - } - gp_Pnt PPP; - if( HasIntersection(Ptmp1, PC, PPP, aContour) ) { - IsOK1 = true; - double tmp = PC.Distance(PPP); - if(tmpNbNodes() / ( F->IsQuadratic() ? 2 : 1 ); + for ( i = 0; i < nbN; ++i ) + aContour->Append( SMESH_MeshEditor::TNodeXYZ( F->GetNode(i) )); + gp_Pnt intP; + for ( int isRev = 0; isRev < 2; ++isRev ) + { + if( !volumes[isRev] && HasIntersection(farPnt[isRev], PC, intP, aContour) ) { + intersected[isRev] = true; + double d = PC.Distance( intP ); + if( d < dist[isRev] ) + { + intPnt[isRev] = intP; + dist [isRev] = d; + } } } } - if( IsOK1 && !IsOK2 ) { - // using existed direction - double tmp = PC.Distance(Pres1)/3.; - if( height > tmp ) { - height = tmp; - PCbest = PC.XYZ() + tmpDir.XYZ() * height; - } - } - else if( !IsOK1 && IsOK2 ) { - // using opposite direction - IsRev = true; - double tmp = PC.Distance(Pres2)/3.; - if( height > tmp ) height = tmp; - PCbest = PC.XYZ() - tmpDir.XYZ() * height; - } - else { // IsOK1 && IsOK2 - double tmp1 = PC.Distance(Pres1)/3.; - double tmp2 = PC.Distance(Pres2)/3.; - if(tmp1 tmp1 ) { - height = tmp1; - PCbest = PC.XYZ() + tmpDir.XYZ() * height; - } - } - else { - // using opposite direction - IsRev = true; - if( height > tmp2 ) height = tmp2; - PCbest = PC.XYZ() - tmpDir.XYZ() * height; - } - } + // Create one or two pyramids - // create node for PCbest - SMDS_MeshNode* NewNode = helper.AddNode( PCbest.X(), PCbest.Y(), PCbest.Z() ); - // add triangles to result map - std::list aList; - for(i=0; i<4; i++) { - SMDS_FaceOfNodes* NewFace; - if(IsRev) - NewFace = new SMDS_FaceOfNodes( NewNode, FNodes[i], FNodes[i+1] ); + for ( int isRev = 0; isRev < 2; ++isRev ) + { + if( !intersected[isRev] ) continue; + double pyramidH = Min( height, PC.Distance(intPnt[isRev])/3.); + PCbest = PC.XYZ() + tmpDir.XYZ() * (isRev ? -pyramidH : pyramidH); + + // create node for PCbest + SMDS_MeshNode* NewNode = helper.AddNode( PCbest.X(), PCbest.Y(), PCbest.Z() ); + + // add triangles to result map + TTriaList& aList = myResMap.insert( make_pair( face, TTriaList()))->second; + for(i=0; i<4; i++) { + SMDS_FaceOfNodes* NewFace; + if(isRev) + NewFace = new SMDS_FaceOfNodes( NewNode, FNodes[i], FNodes[i+1] ); + else + NewFace = new SMDS_FaceOfNodes( NewNode, FNodes[i+1], FNodes[i] ); + aList.push_back(NewFace); + } + // create a pyramid + SMDS_MeshVolume* aPyram; + if(isRev) + aPyram = helper.AddVolume( FNodes[0], FNodes[1], FNodes[2], FNodes[3], NewNode ); else - NewFace = new SMDS_FaceOfNodes( NewNode, FNodes[i+1], FNodes[i] ); - aList.push_back(NewFace); + aPyram = helper.AddVolume( FNodes[0], FNodes[3], FNodes[2], FNodes[1], NewNode ); + myPyram2Trias.insert(make_pair(aPyram, & aList)); } - myResMap.insert(make_pair(face,aList)); - // create pyramid - SMDS_MeshVolume* aPyram; - if(IsRev) - aPyram = helper.AddVolume( FNodes[0], FNodes[1], FNodes[2], FNodes[3], NewNode ); - else - aPyram = helper.AddVolume( FNodes[0], FNodes[3], FNodes[2], FNodes[1], NewNode ); - myMapFPyram.insert(make_pair(face,aPyram)); - } // end loop on elements on a face + } // end loop on all faces return Compute2ndPart(aMesh); } - //======================================================================= //function : Compute2ndPart -//purpose : +//purpose : Update created pyramids and faces to avoid their intersection //======================================================================= bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& aMesh) @@ -781,254 +713,180 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& aMesh) SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); // check intersections between created pyramids - int NbPyram = myMapFPyram.size(); - //cout<<"NbPyram = "< Pyrams(NbPyram); - vector< const SMDS_MeshElement* > Faces(NbPyram); - TF2PyramMap::iterator itp = myMapFPyram.begin(); - int i = 0; - for(; itp!=myMapFPyram.end(); itp++, i++) { - Faces[i] = (*itp).first; - Pyrams[i] = (*itp).second; - } - StdMeshers_Array1OfSequenceOfInteger MergesInfo(0,NbPyram-1); - for(i=0; inodesIterator(); - std::vector Ps1( Prm1->NbNodes() ); - vector< const SMDS_MeshNode* > Ns1( Prm1->NbNodes() ); - int k = 0; - for ( ; k < Ns1.size(); ++k ) { - const SMDS_MeshNode* node = static_cast( nIt->next() ); - Ns1[k] = node; - Ps1[k] = gp_Pnt(node->X(), node->Y(), node->Z()); - } + int k = 0; + + // for each pyramid store list of merged pyramids with their faces + typedef map< const SMDS_MeshElement*, list< TPyram2Trias::iterator > > TPyram2Merged; + TPyram2Merged MergesInfo; + + // iterate on all pyramids + TPyram2Trias::iterator itPi = myPyram2Trias.begin(), itPEnd = myPyram2Trias.end(); + for ( ; itPi != itPEnd; ++itPi ) + { + const SMDS_MeshElement* PrmI = itPi->first; + TPyram2Merged::iterator pMergesI = MergesInfo.find( PrmI ); + + TXyzIterator xyzIt( PrmI->nodesIterator() ); + vector PsI( xyzIt, TXyzIterator() ); + + // compare PrmI with all the rest pyramids bool NeedMove = false; - for(int j=i+1; jChangeElementNodes(Prm2, &Ns2[0], Ns2.size()); - // update pyramids for J - for(k=2; k<=nbJ; k++) { - const SMDS_MeshElement* tmpPrm = Pyrams[aMergesJ.Value(k)]; - SMDS_ElemIteratorPtr tmpIt = tmpPrm->nodesIterator(); - vector< const SMDS_MeshNode* > Ns( tmpPrm->NbNodes() ); - for ( int m = 0; m < Ns.size(); ++m ) - Ns[m] = static_cast( tmpIt->next() ); - Ns[4] = CommonNode; - meshDS->ChangeElementNodes(tmpPrm, &Ns[0], Ns.size()); - } - // update MergesInfo - for(k=1; k<=nbI; k++) { - int num = aMergesI.Value(k); - TColStd_SequenceOfInteger& aSeq = MergesInfo.ChangeValue(num); - for(int m=1; m<=nbJ; m++) - aSeq.Append(aMergesJ.Value(m)); + if ( nbc == 4 ) + continue; // pyrams have a common base face + + if(nbc>0) + { + // Merge the two pyramids and others already merged with them + + // initialize merge info of pyramids + if ( pMergesI == MergesInfo.end() ) // first merge of PrmI + { + pMergesI = MergesInfo.insert( make_pair( PrmI, list())).first; + pMergesI->second.push_back( itPi ); } - for(k=1; k<=nbJ; k++) { - int num = aMergesJ.Value(k); - TColStd_SequenceOfInteger& aSeq = MergesInfo.ChangeValue(num); - for(int m=1; m<=nbI; m++) - aSeq.Append(aMergesI.Value(m)); + if ( pMergesJ == MergesInfo.end() ) // first merge of PrmJ + { + pMergesJ = MergesInfo.insert( make_pair( PrmJ, list())).first; + pMergesJ->second.push_back( itPj ); } + int nbI = pMergesI->second.size(), nbJ = pMergesJ->second.size(); - // update triangles for aMergesJ - for(k=1; k<=nbJ; k++) { - list< list< const SMDS_MeshNode* > > aFNodes; - list< const SMDS_MeshElement* > aFFaces; - int num = aMergesJ.Value(k); - map< const SMDS_MeshElement*, - list >::iterator itrm = myResMap.find(Faces[num]); - list& trias = itrm->second; - list::iterator itt = trias.begin(); - for(; itt!=trias.end(); itt++) { - SMDS_ElemIteratorPtr nodeIt = (*itt)->nodesIterator(); - const SMDS_MeshNode* NF[3]; - int nn = 0; - while ( nodeIt->more() ) - NF[nn++] = static_cast( nodeIt->next() ); - NF[0] = CommonNode; - SMDS_FaceOfNodes* Ftria = const_cast< SMDS_FaceOfNodes*>( (*itt) ); - Ftria->ChangeNodes(NF, 3); + // an apex node to make common to all merged pyramids + SMDS_MeshNode* CommonNode = const_cast(PrmI->GetNode(4)); + CommonNode->setXYZ( ( nbI*PsI[4].X() + nbJ*PsJ[4].X() ) / (nbI+nbJ), + ( nbI*PsI[4].Y() + nbJ*PsJ[4].Y() ) / (nbI+nbJ), + ( nbI*PsI[4].Z() + nbJ*PsJ[4].Z() ) / (nbI+nbJ) ); + NeedMove = true; + const SMDS_MeshNode* Nrem = PrmJ->GetNode(4); // node to remove + + list< TPyram2Trias::iterator >& aMergesI = pMergesI->second; + list< TPyram2Trias::iterator >& aMergesJ = pMergesJ->second; + + // find and remove coincided faces of merged pyramids + list< TPyram2Trias::iterator >::iterator itPttI, itPttJ; + TTriaList::iterator trI, trJ; + for ( itPttI = aMergesI.begin(); itPttI != aMergesI.end(); ++itPttI ) + { + TTriaList* triaListI = (*itPttI)->second; + for ( trI = triaListI->begin(); trI != triaListI->end(); ) + { + const SMDS_FaceOfNodes* FI = *trI; + + for ( itPttJ = aMergesJ.begin(); itPttJ != aMergesJ.end() && FI; ++itPttJ ) + { + TTriaList* triaListJ = (*itPttJ)->second; + for ( trJ = triaListJ->begin(); trJ != triaListJ->end(); ) + { + const SMDS_FaceOfNodes* FJ = *trJ; + + if( EqualTriangles(FI,FJ) ) + { + delete FI; + delete FJ; + FI = FJ = 0; + trI = triaListI->erase( trI ); + trJ = triaListJ->erase( trJ ); + break; // only one triangle of a pyramid can coincide with another pyramid + } + ++trJ; + } + } + if ( FI ) ++trI; // increament if triangle not deleted } } - // check and remove coincided faces - //TColStd_SequenceOfInteger IdRemovedTrias; - int i1 = 1; - for(; i1<=nbI; i1++) { - int numI = aMergesI.Value(i1); - map< const SMDS_MeshElement*, - list >::iterator itrmI = myResMap.find(Faces[numI]); - list& triasI = (*itrmI).second; - list::iterator ittI = triasI.begin(); - int nbfI = triasI.size(); - vector FsI(nbfI); - k = 0; - for(; ittI!=triasI.end(); ittI++) { - FsI[k] = (*ittI); - k++; + // set the common apex node to pyramids and triangles merged with J + for ( itPttJ = aMergesJ.begin(); itPttJ != aMergesJ.end(); ++itPttJ ) + { + const SMDS_MeshElement* Prm = (*itPttJ)->first; + TTriaList* triaList = (*itPttJ)->second; + + vector< const SMDS_MeshNode* > nodes( Prm->begin_nodes(), Prm->end_nodes() ); + nodes[4] = CommonNode; + meshDS->ChangeElementNodes( Prm, &nodes[0], nodes.size()); + + for ( TTriaList::iterator trIt = triaList->begin(); trIt != triaList->end(); ++trIt ) + { + SMDS_FaceOfNodes* Ftria = const_cast< SMDS_FaceOfNodes*>( *trIt ); + const SMDS_MeshNode* NF[3] = { CommonNode, Ftria->GetNode(1), Ftria->GetNode(2)}; + Ftria->ChangeNodes(NF, 3); } - int i2 = 0; - for(; i2 >::iterator itrmJ = myResMap.find(Faces[numJ]); - list& triasJ = (*itrmJ).second; - list::iterator ittJ = triasJ.begin(); - int nbfJ = triasJ.size(); - vector FsJ(nbfJ); - k = 0; - for(; ittJ!=triasJ.end(); ittJ++) { - FsJ[k] = (*ittJ); - k++; - } - int j2 = 0; - for(; j2GetID() ); - //IdRemovedTrias.Append( FJ->GetID() ); - FsI[i2] = 0; - FsJ[j2] = 0; - list new_triasI; - for(k=0; k new_triasJ; - for(k=0; kfirst; + list< TPyram2Trias::iterator >& merges = MergesInfo[ PrmI ]; + merges.insert( merges.end(), aMergesJ.begin(), aMergesJ.end() ); + } + for ( k = 0, itPttJ = aMergesJ.begin(); k < nbJ; ++itPttJ, ++k ) + { + const SMDS_MeshElement* PrmJ = (*itPttJ)->first; + list< TPyram2Trias::iterator >& merges = MergesInfo[ PrmJ ]; + merges.insert( merges.end(), aMergesI.begin(), aMergesI.end() ); + } + // removing node meshDS->RemoveNode(Nrem); } else { // nbc==0 - //cout<<"decrease height of pyramids"<(Ns1[4]); VN1.Scale(coef1); - aNode1->setXYZ( PC1.X()+VN1.X(), PC1.Y()+VN1.Y(), PC1.Z()+VN1.Z() ); - SMDS_MeshNode* aNode2 = const_cast(Ns2[4]); VN2.Scale(coef2); + SMDS_MeshNode* aNode1 = const_cast(PrmI->GetNode(4)); + aNode1->setXYZ( PC1.X()+VN1.X(), PC1.Y()+VN1.Y(), PC1.Z()+VN1.Z() ); + SMDS_MeshNode* aNode2 = const_cast(PrmJ->GetNode(4)); aNode2->setXYZ( PC2.X()+VN2.X(), PC2.Y()+VN2.Y(), PC2.Z()+VN2.Z() ); NeedMove = true; } } // end if(hasInt) - else { - //cout<<" no intersec for i="< -#include -#include +#include "SMDS_FaceOfNodes.hxx" + +class SMESH_Mesh; +class SMDS_MeshElement; +class SMDS_MeshNode; +class Handle(TColgp_HArray1OfPnt); +class Handle(TColgp_HArray1OfVec); +class TopoDS_Shape; +class gp_Pnt; +class gp_Vec; + #include #include @@ -40,8 +45,6 @@ class STDMESHERS_EXPORT StdMeshers_QuadToTriaAdaptor { public: - StdMeshers_QuadToTriaAdaptor(); - ~StdMeshers_QuadToTriaAdaptor(); bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); @@ -58,7 +61,8 @@ protected: Handle(TColgp_HArray1OfPnt)& PN, Handle(TColgp_HArray1OfVec)& VN, std::vector& FNodes, - gp_Pnt& PC, gp_Vec& VNorm); + gp_Pnt& PC, gp_Vec& VNorm, + const SMDS_MeshElement** volumes=0); bool CheckIntersection(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint, SMESH_Mesh& aMesh, @@ -67,10 +71,13 @@ protected: bool Compute2ndPart(SMESH_Mesh& aMesh); - typedef std::map< const SMDS_MeshElement*, const SMDS_MeshElement*, TIDCompare > TF2PyramMap; + typedef std::list TTriaList; + typedef std::multimap TQuad2Trias; + typedef std::map TPyram2Trias; + + TQuad2Trias myResMap; + TPyram2Trias myPyram2Trias; - std::map< const SMDS_MeshElement*, std::list > myResMap; - TF2PyramMap myMapFPyram; std::list< const SMDS_MeshNode* > myDegNodes; }; diff --git a/src/StdMeshers/StdMeshers_QuadrangleParams.cxx b/src/StdMeshers/StdMeshers_QuadrangleParams.cxx index ad3fee841..07cd7f649 100644 --- a/src/StdMeshers/StdMeshers_QuadrangleParams.cxx +++ b/src/StdMeshers/StdMeshers_QuadrangleParams.cxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_QuadrangleParams.cxx // Author : Sergey KUUL, OCC @@ -48,7 +46,7 @@ using namespace std; //============================================================================= StdMeshers_QuadrangleParams::StdMeshers_QuadrangleParams(int hypId, int studyId, - SMESH_Gen * gen) + SMESH_Gen * gen) :SMESH_Hypothesis(hypId, studyId, gen) { _name = "QuadrangleParams"; @@ -142,7 +140,7 @@ istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp) //================================================================================ bool StdMeshers_QuadrangleParams::SetParametersByMesh(const SMESH_Mesh* theMesh, - const TopoDS_Shape& theShape) + const TopoDS_Shape& theShape) { if ( !theMesh || theShape.IsNull() ) return false; @@ -158,7 +156,7 @@ bool StdMeshers_QuadrangleParams::SetParametersByMesh(const SMESH_Mesh* theMesh, //================================================================================ bool StdMeshers_QuadrangleParams::SetParametersByDefaults(const TDefaults& dflts, - const SMESH_Mesh* /*mesh*/) + const SMESH_Mesh* /*mesh*/) { return true; } diff --git a/src/StdMeshers/StdMeshers_QuadrangleParams.hxx b/src/StdMeshers/StdMeshers_QuadrangleParams.hxx index ab1c56fab..da37f0755 100644 --- a/src/StdMeshers/StdMeshers_QuadrangleParams.hxx +++ b/src/StdMeshers/StdMeshers_QuadrangleParams.hxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_QuadrangleParams.hxx // Author : Sergey KUUL, OCC @@ -52,9 +50,9 @@ public: virtual std::ostream & SaveTo(std::ostream & save); virtual std::istream & LoadFrom(std::istream & load); friend std::ostream& operator << (std::ostream & save, - StdMeshers_QuadrangleParams & hyp); + StdMeshers_QuadrangleParams & hyp); friend std::istream& operator >> (std::istream & load, - StdMeshers_QuadrangleParams & hyp); + StdMeshers_QuadrangleParams & hyp); /*! * \brief Initialize start and end length by the mesh built on the geometry @@ -63,14 +61,14 @@ public: * \retval bool - true if parameter values have been successfully defined */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, - const TopoDS_Shape& theShape); + const TopoDS_Shape& theShape); /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ virtual bool SetParametersByDefaults(const TDefaults& dflts, - const SMESH_Mesh* theMesh=0); + const SMESH_Mesh* theMesh=0); protected: int _triaVertexID; diff --git a/src/StdMeshers/StdMeshers_QuadranglePreference.cxx b/src/StdMeshers/StdMeshers_QuadranglePreference.cxx index cf3986e38..81a2601a4 100644 --- a/src/StdMeshers/StdMeshers_QuadranglePreference.cxx +++ b/src/StdMeshers/StdMeshers_QuadranglePreference.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,10 +19,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers_QuadranglePreference : implementaion of SMESH idl descriptions // File : StdMeshers_QuadranglePreference.cxx // Module : SMESH - +// #include "StdMeshers_QuadranglePreference.hxx" #include "utilities.h" diff --git a/src/StdMeshers/StdMeshers_QuadranglePreference.hxx b/src/StdMeshers/StdMeshers_QuadranglePreference.hxx index ec641d15a..24dcb7e5e 100644 --- a/src/StdMeshers/StdMeshers_QuadranglePreference.hxx +++ b/src/StdMeshers/StdMeshers_QuadranglePreference.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,10 +19,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_QuadranglePreference.hxx // Module : SMESH - +// #ifndef _StdMeshers_QuadranglePreference_HXX_ #define _StdMeshers_QuadranglePreference_HXX_ diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index 501915676..5e2031c23 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Quadrangle_2D.cxx // Moved here from SMESH_Quadrangle_2D.cxx @@ -43,7 +44,6 @@ #include "SMDS_EdgePosition.hxx" #include "SMDS_FacePosition.hxx" -#include #include #include #include @@ -51,7 +51,9 @@ #include #include #include +#include #include +#include #include #include "utilities.h" @@ -773,14 +775,21 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes int nbSides = 0; list< TopoDS_Edge >::iterator edgeIt = edges.begin(); - if ( nbEdgesInWire.front() == 3 ) { // exactly 3 edges - if(myTriaVertexID>0) { - SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); + if ( nbEdgesInWire.front() == 3 ) // exactly 3 edges + { + SMESH_Comment comment; + SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); + if ( myTriaVertexID == -1) + { + comment << "No Base vertex parameter provided for a trilateral geometrical face"; + } + else + { TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID)); - if(!V.IsNull()) { + if ( !V.IsNull() ) { TopoDS_Edge E1,E2,E3; for(; edgeIt != edges.end(); ++edgeIt) { - TopoDS_Edge E = TopoDS::Edge(*edgeIt); + TopoDS_Edge E = *edgeIt; TopoDS_Vertex VF, VL; TopExp::Vertices(E, VF, VL, true); if( VF.IsSame(V) ) @@ -790,22 +799,29 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes else E2 = E; } - quad->side.reserve(4); - quad->side.push_back( new StdMeshers_FaceSide(F, E1, &aMesh, true, ignoreMediumNodes)); - quad->side.push_back( new StdMeshers_FaceSide(F, E2, &aMesh, true, ignoreMediumNodes)); - quad->side.push_back( new StdMeshers_FaceSide(F, E3, &aMesh, false, ignoreMediumNodes)); - std::vector UVPSleft = quad->side[0]->GetUVPtStruct(true,0); - std::vector UVPStop = quad->side[1]->GetUVPtStruct(false,1); - std::vector UVPSright = quad->side[2]->GetUVPtStruct(true,1); - const SMDS_MeshNode* aNode = UVPSleft[0].node; - gp_Pnt2d aPnt2d( UVPSleft[0].u, UVPSleft[0].v ); - StdMeshers_FaceSide* VertFS = - new StdMeshers_FaceSide(aNode, aPnt2d, quad->side[1]); - quad->side.push_back(VertFS); - return quad; + if ( !E1.IsNull() && !E2.IsNull() && !E3.IsNull() ) + { + quad->side.push_back( new StdMeshers_FaceSide(F, E1, &aMesh, true, ignoreMediumNodes)); + quad->side.push_back( new StdMeshers_FaceSide(F, E2, &aMesh, true, ignoreMediumNodes)); + quad->side.push_back( new StdMeshers_FaceSide(F, E3, &aMesh, false,ignoreMediumNodes)); + const vector& UVPSleft = quad->side[0]->GetUVPtStruct(true,0); + /* vector& UVPStop = */quad->side[1]->GetUVPtStruct(false,1); + /* vector& UVPSright = */quad->side[2]->GetUVPtStruct(true,1); + const SMDS_MeshNode* aNode = UVPSleft[0].node; + gp_Pnt2d aPnt2d( UVPSleft[0].u, UVPSleft[0].v ); + quad->side.push_back( new StdMeshers_FaceSide(aNode, aPnt2d, quad->side[1])); + return quad; + } } + comment << "Invalid Base vertex parameter: " << myTriaVertexID << " is not among ["; + TopTools_MapOfShape vMap; + for ( TopExp_Explorer v( aShape, TopAbs_VERTEX ); v.More(); v.Next()) + if ( vMap.Add( v.Current() )) + comment << meshDS->ShapeToIndex( v.Current() ) << ( vMap.Extent()==3 ? "]" : ", "); } - return 0; + error( comment ); + delete quad; + return quad = 0; } else if ( nbEdgesInWire.front() == 4 ) { // exactly 4 edges for ( ; edgeIt != edges.end(); ++edgeIt, nbSides++ ) diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx index 25083af32..74c64f6f0 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Quadrangle_2D.hxx // Moved here from SMESH_Quadrangle_2D.hxx @@ -63,13 +64,13 @@ public: SMESH_Hypothesis::Hypothesis_Status& aStatus); virtual bool Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape); + const TopoDS_Shape& aShape); virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, MapShapeNbElems& aResMap); FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, + const TopoDS_Shape& aShape, const bool CreateQuadratic); protected: @@ -78,14 +79,14 @@ protected: const TopoDS_Shape& aShape); bool CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, - const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap, - std::vector& aNbNodes, + const TopoDS_Shape & aShape, + MapShapeNbElems& aResMap, + std::vector& aNbNodes, bool& IsQuadratic); bool SetNormalizedGrid(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - FaceQuadStruct*& quad); + const TopoDS_Shape& aShape, + FaceQuadStruct*& quad); void SplitQuad(SMESHDS_Mesh *theMeshDS, const int theFaceID, @@ -102,22 +103,22 @@ protected: FaceQuadStruct* quad); bool EvaluateQuadPref(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - std::vector& aNbNodes, - MapShapeNbElems& aResMap, + const TopoDS_Shape& aShape, + std::vector& aNbNodes, + MapShapeNbElems& aResMap, bool IsQuadratic); UVPtStruct* LoadEdgePoints2(SMESH_Mesh& aMesh, - const TopoDS_Face& F, const TopoDS_Edge& E, + const TopoDS_Face& F, const TopoDS_Edge& E, bool IsReverse); UVPtStruct* LoadEdgePoints(SMESH_Mesh& aMesh, - const TopoDS_Face& F, const TopoDS_Edge& E, - double first, double last); + const TopoDS_Face& F, const TopoDS_Edge& E, + double first, double last); UVPtStruct* MakeEdgePoints(SMESH_Mesh& aMesh, - const TopoDS_Face& F, const TopoDS_Edge& E, - double first, double last, int nb_segm); + const TopoDS_Face& F, const TopoDS_Edge& E, + double first, double last, int nb_segm); // true if QuadranglePreference hypothesis is assigned that forces // construction of quadrangles if the number of nodes on opposite edges diff --git a/src/StdMeshers/StdMeshers_QuadraticMesh.cxx b/src/StdMeshers/StdMeshers_QuadraticMesh.cxx index 4764356f2..de6fe8652 100644 --- a/src/StdMeshers/StdMeshers_QuadraticMesh.cxx +++ b/src/StdMeshers/StdMeshers_QuadraticMesh.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,10 +19,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers_QuadraticMesh : implementaion of SMESH idl descriptions // File : StdMeshers_QuadraticMesh.cxx // Module : SMESH - +// #include "StdMeshers_QuadraticMesh.hxx" #include "utilities.h" diff --git a/src/StdMeshers/StdMeshers_QuadraticMesh.hxx b/src/StdMeshers/StdMeshers_QuadraticMesh.hxx index 9972469c0..ec43466b4 100644 --- a/src/StdMeshers/StdMeshers_QuadraticMesh.hxx +++ b/src/StdMeshers/StdMeshers_QuadraticMesh.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,10 +19,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_QuadraticMesh.hxx // Module : SMESH - +// #ifndef _StdMeshers_QuadraticMesh_HXX_ #define _StdMeshers_QuadraticMesh_HXX_ diff --git a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx index fb6cc94e1..c08c6b31e 100644 --- a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx +++ b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_RadialPrism_3D.cxx // Module : SMESH @@ -71,7 +72,7 @@ StdMeshers_RadialPrism_3D::StdMeshers_RadialPrism_3D(int hypId, int studyId, SME :SMESH_3D_Algo(hypId, studyId, gen) { _name = "RadialPrism_3D"; - _shapeType = (1 << TopAbs_SOLID); // 1 bit per shape type + _shapeType = (1 << TopAbs_SOLID); // 1 bit per shape type _compatibleHypothesis.push_back("LayerDistribution"); _compatibleHypothesis.push_back("NumberOfLayers"); @@ -396,8 +397,8 @@ bool StdMeshers_RadialPrism_3D::computeLayerPositions(const gp_Pnt& pIn, //======================================================================= bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - MapShapeNbElems& aResMap) + const TopoDS_Shape& aShape, + MapShapeNbElems& aResMap) { // get 2 shells TopoDS_Solid solid = TopoDS::Solid( aShape ); diff --git a/src/StdMeshers/StdMeshers_RadialPrism_3D.hxx b/src/StdMeshers/StdMeshers_RadialPrism_3D.hxx index 21d8f8362..1d0b59375 100644 --- a/src/StdMeshers/StdMeshers_RadialPrism_3D.hxx +++ b/src/StdMeshers/StdMeshers_RadialPrism_3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_RadialPrism_3D.hxx // Module : SMESH diff --git a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx index 8d21195db..d03470fb3 100644 --- a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_RadialQuadrangle_1D2D.cxx // Module : SMESH @@ -27,15 +25,15 @@ // #include "StdMeshers_RadialQuadrangle_1D2D.hxx" -//#include "StdMeshers_ProjectionUtils.hxx" #include "StdMeshers_NumberOfLayers.hxx" #include "StdMeshers_LayerDistribution.hxx" -//#include "StdMeshers_Prism_3D.hxx" #include "StdMeshers_Regular_1D.hxx" +#include "StdMeshers_NumberOfSegments.hxx" #include "SMDS_MeshNode.hxx" #include "SMESHDS_SubMesh.hxx" #include "SMESH_Gen.hxx" +#include "SMESH_HypoFilter.hxx" #include "SMESH_Mesh.hxx" #include "SMESH_MesherHelper.hxx" #include "SMESH_subMesh.hxx" @@ -53,6 +51,7 @@ #include #include #include +#include #include @@ -61,8 +60,6 @@ using namespace std; #define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; } #define gpXYZ(n) gp_XYZ(n->X(),n->Y(),n->Z()) -//typedef StdMeshers_ProjectionUtils TAssocTool; - //======================================================================= //function : StdMeshers_RadialQuadrangle_1D2D @@ -82,6 +79,7 @@ StdMeshers_RadialQuadrangle_1D2D::StdMeshers_RadialQuadrangle_1D2D(int hypId, myNbLayerHypo = 0; myDistributionHypo = 0; _requireDescretBoundary = false; + _supportSubmeshes = true; } @@ -113,8 +111,8 @@ bool StdMeshers_RadialQuadrangle_1D2D::CheckHypothesis const list &hyps = GetUsedHypothesis(aMesh, aShape); if ( hyps.size() == 0 ) { - aStatus = SMESH_Hypothesis::HYP_MISSING; - return false; // can't work with no hypothesis + aStatus = SMESH_Hypothesis::HYP_OK; + return true; // can work with no hypothesis } if ( hyps.size() > 1 ) { @@ -146,27 +144,42 @@ namespace /*! * \brief Listener used to mark edges meshed by StdMeshers_RadialQuadrangle_1D2D */ - class TLinEdgeMarker : public SMESH_subMeshEventListener + class TEdgeMarker : public SMESH_subMeshEventListener { - TLinEdgeMarker(): SMESH_subMeshEventListener(/*isDeletable=*/false) {} + TEdgeMarker(): SMESH_subMeshEventListener(/*isDeletable=*/false) {} public: + //!< Return static listener static SMESH_subMeshEventListener* getListener() { - static TLinEdgeMarker theEdgeMarker; + static TEdgeMarker theEdgeMarker; return &theEdgeMarker; } + //! Clear face sumbesh if something happens on edges + void ProcessEvent(const int event, + const int eventType, + SMESH_subMesh* edgeSubMesh, + EventListenerData* data, + const SMESH_Hypothesis* /*hyp*/) + { + if ( data && !data->mySubMeshes.empty() && eventType == SMESH_subMesh::ALGO_EVENT) + { + ASSERT( data->mySubMeshes.front() != edgeSubMesh ); + SMESH_subMesh* faceSubMesh = data->mySubMeshes.front(); + faceSubMesh->ComputeStateEngine( SMESH_subMesh::CLEAN ); + } + } }; - + // ------------------------------------------------------------------------------ /*! * \brief Mark an edge as computed by StdMeshers_RadialQuadrangle_1D2D */ - void markLinEdgeAsComputedByMe(const TopoDS_Edge& edge, SMESH_subMesh* faceSubMesh) + void markEdgeAsComputedByMe(const TopoDS_Edge& edge, SMESH_subMesh* faceSubMesh) { if ( SMESH_subMesh* edgeSM = faceSubMesh->GetFather()->GetSubMeshContaining( edge )) { - if ( !edgeSM->GetEventListenerData( TLinEdgeMarker::getListener() )) - faceSubMesh->SetEventListener( TLinEdgeMarker::getListener(), + if ( !edgeSM->GetEventListenerData( TEdgeMarker::getListener() )) + faceSubMesh->SetEventListener( TEdgeMarker::getListener(), SMESH_subMeshEventListenerData::MakeData(faceSubMesh), edgeSM); } @@ -176,38 +189,30 @@ namespace * \brief Return true if a radial edge was meshed with StdMeshers_RadialQuadrangle_1D2D with * the same radial distribution */ - bool isEdgeCompitaballyMeshed(const TopoDS_Edge& edge, SMESH_subMesh* faceSubMesh) - { - if ( SMESH_subMesh* edgeSM = faceSubMesh->GetFather()->GetSubMeshContaining( edge )) - { - if ( SMESH_subMeshEventListenerData* otherFaceData = - edgeSM->GetEventListenerData( TLinEdgeMarker::getListener() )) - { - // compare hypothesis aplied to two disk faces sharing radial edges - SMESH_Mesh& mesh = *faceSubMesh->GetFather(); - SMESH_Algo* radialQuadAlgo = mesh.GetGen()->GetAlgo(mesh, faceSubMesh->GetSubShape() ); - SMESH_subMesh* otherFaceSubMesh = otherFaceData->mySubMeshes.front(); - const list & hyps1 = - radialQuadAlgo->GetUsedHypothesis( mesh, faceSubMesh->GetSubShape()); - const list & hyps2 = - radialQuadAlgo->GetUsedHypothesis( mesh, otherFaceSubMesh->GetSubShape()); - if( hyps1.empty() && hyps2.empty() ) - return true; // defaul hyps - if ( hyps1.size() != hyps2.size() || - strcmp( hyps1.front()->GetName(), hyps2.front()->GetName() )) - return false; - ostringstream hypDump1, hypDump2; - list ::const_iterator hyp1 = hyps1.begin(); - for ( ; hyp1 != hyps1.end(); ++hyp1 ) - const_cast(*hyp1)->SaveTo( hypDump1 ); - list ::const_iterator hyp2 = hyps2.begin(); - for ( ; hyp2 != hyps2.end(); ++hyp2 ) - const_cast(*hyp2)->SaveTo( hypDump2 ); - return hypDump1.str() == hypDump2.str(); - } - } - return false; - } +// bool isEdgeCompatiballyMeshed(const TopoDS_Edge& edge, SMESH_subMesh* faceSubMesh) +// { +// if ( SMESH_subMesh* edgeSM = faceSubMesh->GetFather()->GetSubMeshContaining( edge )) +// { +// if ( SMESH_subMeshEventListenerData* otherFaceData = +// edgeSM->GetEventListenerData( TEdgeMarker::getListener() )) +// { +// // compare hypothesis aplied to two disk faces sharing radial edges +// SMESH_Mesh& mesh = *faceSubMesh->GetFather(); +// SMESH_Algo* radialQuadAlgo = mesh.GetGen()->GetAlgo(mesh, faceSubMesh->GetSubShape() ); +// SMESH_subMesh* otherFaceSubMesh = otherFaceData->mySubMeshes.front(); +// list hyps1 = +// radialQuadAlgo->GetUsedHypothesis( mesh, faceSubMesh->GetSubShape()); +// list hyps2 = +// radialQuadAlgo->GetUsedHypothesis( mesh, otherFaceSubMesh->GetSubShape()); +// if( hyps1.empty() && hyps2.empty() ) +// return true; // defaul hyps +// if ( hyps1.size() != hyps2.size() ) +// return false; +// return *hyps1.front() == *hyps2.front(); +// } +// } +// return false; +// } //================================================================================ /*! @@ -273,6 +278,123 @@ namespace } return nbe; } + +//================================================================================ +//================================================================================ +/*! + * \brief Class computing layers distribution using data of + * StdMeshers_LayerDistribution hypothesis + */ +//================================================================================ +//================================================================================ + +class TNodeDistributor: public StdMeshers_Regular_1D +{ + list myUsedHyps; +public: + // ----------------------------------------------------------------------------- + static TNodeDistributor* GetDistributor(SMESH_Mesh& aMesh) + { + const int myID = -1000; + map < int, SMESH_1D_Algo * > & algoMap = aMesh.GetGen()->_map1D_Algo; + map < int, SMESH_1D_Algo * >::iterator id_algo = algoMap.find( myID ); + if ( id_algo == algoMap.end() ) + return new TNodeDistributor( myID, 0, aMesh.GetGen() ); + return static_cast< TNodeDistributor* >( id_algo->second ); + } + // ----------------------------------------------------------------------------- + //! Computes distribution of nodes on a straight line ending at pIn and pOut + bool Compute( vector< double > & positions, + gp_Pnt pIn, + gp_Pnt pOut, + SMESH_Mesh& aMesh, + const SMESH_Hypothesis* hyp1d) + { + if ( !hyp1d ) return error( "Invalid LayerDistribution hypothesis"); + + double len = pIn.Distance( pOut ); + if ( len <= DBL_MIN ) return error("Too close points of inner and outer shells"); + + myUsedHyps.clear(); + myUsedHyps.push_back( hyp1d ); + + TopoDS_Edge edge = BRepBuilderAPI_MakeEdge( pIn, pOut ); + SMESH_Hypothesis::Hypothesis_Status aStatus; + if ( !StdMeshers_Regular_1D::CheckHypothesis( aMesh, edge, aStatus )) + return error( "StdMeshers_Regular_1D::CheckHypothesis() failed " + "with LayerDistribution hypothesis"); + + BRepAdaptor_Curve C3D(edge); + double f = C3D.FirstParameter(), l = C3D.LastParameter(); + list< double > params; + if ( !StdMeshers_Regular_1D::computeInternalParameters( aMesh, C3D, len, f, l, params, false )) + return error("StdMeshers_Regular_1D failed to compute layers distribution"); + + positions.clear(); + positions.reserve( params.size() ); + for (list::iterator itU = params.begin(); itU != params.end(); itU++) + positions.push_back( *itU / len ); + return true; + } + // ----------------------------------------------------------------------------- + //! Make mesh on an adge using assigned 1d hyp or defaut nb of segments + bool ComputeCircularEdge(SMESH_Mesh& aMesh, + const TopoDS_Edge& anEdge) + { + _gen->Compute( aMesh, anEdge); + SMESH_subMesh *sm = aMesh.GetSubMesh(anEdge); + if ( sm->GetComputeState() != SMESH_subMesh::COMPUTE_OK) + { + // find any 1d hyp assigned (there can be a hyp w/o algo) + myUsedHyps = SMESH_Algo::GetUsedHypothesis(aMesh, anEdge, /*ignoreAux=*/true); + Hypothesis_Status aStatus; + if ( !StdMeshers_Regular_1D::CheckHypothesis( aMesh, anEdge, aStatus )) + { + // no valid 1d hyp assigned, use default nb of segments + _hypType = NB_SEGMENTS; + _ivalue[ DISTR_TYPE_IND ] = StdMeshers_NumberOfSegments::DT_Regular; + _ivalue[ NB_SEGMENTS_IND ] = _gen->GetDefaultNbSegments(); + } + return StdMeshers_Regular_1D::Compute( aMesh, anEdge ); + } + return true; + } + // ----------------------------------------------------------------------------- + //! Make mesh on an adge using assigned 1d hyp or defaut nb of segments + bool EvaluateCircularEdge(SMESH_Mesh& aMesh, + const TopoDS_Edge& anEdge, + MapShapeNbElems& aResMap) + { + _gen->Evaluate( aMesh, anEdge, aResMap ); + if ( aResMap.count( aMesh.GetSubMesh( anEdge ))) + return true; + + // find any 1d hyp assigned + myUsedHyps = SMESH_Algo::GetUsedHypothesis(aMesh, anEdge, /*ignoreAux=*/true); + Hypothesis_Status aStatus; + if ( !StdMeshers_Regular_1D::CheckHypothesis( aMesh, anEdge, aStatus )) + { + // no valid 1d hyp assigned, use default nb of segments + _hypType = NB_SEGMENTS; + _ivalue[ DISTR_TYPE_IND ] = StdMeshers_NumberOfSegments::DT_Regular; + _ivalue[ NB_SEGMENTS_IND ] = _gen->GetDefaultNbSegments(); + } + return StdMeshers_Regular_1D::Evaluate( aMesh, anEdge, aResMap ); + } +protected: + // ----------------------------------------------------------------------------- + TNodeDistributor( int hypId, int studyId, SMESH_Gen* gen) + : StdMeshers_Regular_1D( hypId, studyId, gen) + { + } + // ----------------------------------------------------------------------------- + virtual const list & + GetUsedHypothesis(SMESH_Mesh &, const TopoDS_Shape &, const bool) + { + return myUsedHyps; + } + // ----------------------------------------------------------------------------- +}; } //======================================================================= @@ -280,7 +402,7 @@ namespace * \brief Allow algo to do something after persistent restoration * \param subMesh - restored submesh * - * call markLinEdgeAsComputedByMe() + * call markEdgeAsComputedByMe() */ //======================================================================= @@ -290,8 +412,9 @@ void StdMeshers_RadialQuadrangle_1D2D::SubmeshRestored(SMESH_subMesh* faceSubMes { TopoDS_Edge CircEdge, LinEdge1, LinEdge2; analyseFace( faceSubMesh->GetSubShape(), CircEdge, LinEdge1, LinEdge2 ); - if ( !LinEdge1.IsNull() ) markLinEdgeAsComputedByMe( LinEdge1, faceSubMesh ); - if ( !LinEdge2.IsNull() ) markLinEdgeAsComputedByMe( LinEdge2, faceSubMesh ); + if ( !CircEdge.IsNull() ) markEdgeAsComputedByMe( CircEdge, faceSubMesh ); + if ( !LinEdge1.IsNull() ) markEdgeAsComputedByMe( LinEdge1, faceSubMesh ); + if ( !LinEdge2.IsNull() ) markEdgeAsComputedByMe( LinEdge2, faceSubMesh ); } } @@ -311,14 +434,15 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, // to delete helper at exit from Compute() auto_ptr helperDeleter( myHelper ); - myLayerPositions.clear(); + TNodeDistributor* algo1d = TNodeDistributor::GetDistributor(aMesh); TopoDS_Edge CircEdge, LinEdge1, LinEdge2; int nbe = analyseFace( aShape, CircEdge, LinEdge1, LinEdge2 ); - if( nbe>3 || nbe < 1 || CircEdge.IsNull() ) - return error(COMPERR_BAD_SHAPE); + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge )); + if( nbe>3 || nbe < 1 || aCirc.IsNull() ) + return error("The face must be a full circle or a part of circle (i.e. the number of edges is less or equal to 3 and one of them is a circle curve)"); - gp_Pnt P0,P1; + gp_Pnt P0, P1; // points for rotation TColgp_SequenceOfPnt Points; // angles for rotation @@ -335,15 +459,14 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, TopoDS_Face F = TopoDS::Face(aShape); Handle(Geom_Surface) S = BRep_Tool::Surface(F); + if(nbe==1) { - Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge )); - - bool ok = _gen->Compute( aMesh, CircEdge ); - if( !ok ) return false; + if (!algo1d->ComputeCircularEdge( aMesh, CircEdge )) + return error( algo1d->GetComputeError() ); map< double, const SMDS_MeshNode* > theNodes; - ok = GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); - if( !ok ) return false; + if ( !GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes)) + return error("Circular edge is incorrectly meshed"); CNodes.clear(); map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); @@ -363,8 +486,8 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() ); P0 = aCirc->Location(); - myLayerPositions.clear(); - computeLayerPositions(P0,P1); + if ( !computeLayerPositions(P0,P1)) + return false; exp.Init( CircEdge, TopAbs_VERTEX ); TopoDS_Vertex V1 = TopoDS::Vertex( exp.Current() ); @@ -413,22 +536,16 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, // other curve not line return error(COMPERR_BAD_SHAPE); } - bool linEdgeComputed = false; - if( SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1) ) { - if( !sm1->IsEmpty() ) - if( isEdgeCompitaballyMeshed( LinEdge1, aMesh.GetSubMesh(F) )) - linEdgeComputed = true; - else - return error("Invalid set of hypotheses"); - } - bool ok = _gen->Compute( aMesh, CircEdge ); - if( !ok ) return false; + if ( !algo1d->ComputeCircularEdge( aMesh, CircEdge )) + return error( algo1d->GetComputeError() ); map< double, const SMDS_MeshNode* > theNodes; - GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); + if ( !GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes) ) + return error("Circular edge is incorrectly meshed"); - CNodes.clear(); map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); + CNodes.clear(); + CNodes.push_back( itn->second ); double fang = (*itn).first; itn++; for(; itn != theNodes.end(); itn++ ) { @@ -440,13 +557,13 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, } const SMDS_MeshNode* NF = theNodes.begin()->second; const SMDS_MeshNode* NL = theNodes.rbegin()->second; - CNodes.push_back( NF ); P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() ); gp_Pnt P2( NL->X(), NL->Y(), NL->Z() ); P0 = aCirc->Location(); - myLayerPositions.clear(); - computeLayerPositions(P0,P1); + bool linEdgeComputed; + if ( !computeLayerPositions(P0,P1,LinEdge1,&linEdgeComputed)) + return false; if ( linEdgeComputed ) { @@ -537,7 +654,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, SMDS_MeshEdge* ME = myHelper->AddEdge( tmpNodes[i-1], tmpNodes[i] ); if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); } - markLinEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F )); + markEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F )); } } else // nbe==3 or ( nbe==2 && linEdge is INTERNAL ) @@ -549,33 +666,16 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, // segments of line double fp, lp; Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge )); - Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 )); - Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast( getCurve( LinEdge2 )); - if( aLine1.IsNull() || aLine2.IsNull() ) { - // other curve not line + Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 )); + Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast( getCurve( LinEdge2 )); + if( aCirc.IsNull() || aLine1.IsNull() || aLine2.IsNull() ) return error(COMPERR_BAD_SHAPE); - } - - bool linEdge1Computed = false; - if ( SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1)) - if( !sm1->IsEmpty() ) - if( isEdgeCompitaballyMeshed( LinEdge1, aMesh.GetSubMesh(F) )) - linEdge1Computed = true; - else - return error("Invalid set of hypotheses"); - - bool linEdge2Computed = false; - if ( SMESH_subMesh* sm2 = aMesh.GetSubMesh(LinEdge2)) - if( !sm2->IsEmpty() ) - if( isEdgeCompitaballyMeshed( LinEdge2, aMesh.GetSubMesh(F) )) - linEdge2Computed = true; - else - return error("Invalid set of hypotheses"); - bool ok = _gen->Compute( aMesh, CircEdge ); - if( !ok ) return false; + if ( !algo1d->ComputeCircularEdge( aMesh, CircEdge )) + return error( algo1d->GetComputeError() ); map< double, const SMDS_MeshNode* > theNodes; - GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); + if ( !GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes)) + return error("Circular edge is incorrectly meshed"); const SMDS_MeshNode* NF = theNodes.begin()->second; const SMDS_MeshNode* NL = theNodes.rbegin()->second; @@ -595,12 +695,19 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, gp_Pnt P2( NL->X(), NL->Y(), NL->Z() ); P0 = aCirc->Location(); - myLayerPositions.clear(); - computeLayerPositions(P0,P1); + bool linEdge1Computed, linEdge2Computed; + if ( !computeLayerPositions(P0,P1,LinEdge1,&linEdge1Computed)) + return false; Nodes1.resize( myLayerPositions.size()+1 ); Nodes2.resize( myLayerPositions.size()+1 ); + // check that both linear edges have same hypotheses + if ( !computeLayerPositions(P0,P1,LinEdge2, &linEdge2Computed)) + return false; + if ( Nodes1.size() != myLayerPositions.size()+1 ) + return error("Different hypotheses apply to radial edges"); + exp.Init( LinEdge1, TopAbs_VERTEX ); TopoDS_Vertex V1 = TopoDS::Vertex( exp.Current() ); exp.Next(); @@ -701,7 +808,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL ) Nodes2 = Nodes1; } - markLinEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F )); + markEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F )); // LinEdge2 if ( linEdge2Computed ) @@ -765,8 +872,9 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); } } - markLinEdgeAsComputedByMe( LinEdge2, aMesh.GetSubMesh( F )); + markEdgeAsComputedByMe( LinEdge2, aMesh.GetSubMesh( F )); } + markEdgeAsComputedByMe( CircEdge, aMesh.GetSubMesh( F )); // orientation bool IsForward = ( CircEdge.Orientation()==TopAbs_FORWARD ); @@ -850,106 +958,103 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, return true; } - -//================================================================================ //================================================================================ /*! - * \brief Class computing layers distribution using data of - * StdMeshers_LayerDistribution hypothesis + * \brief Compute positions of nodes on the radial edge + * \retval bool - is a success */ //================================================================================ -//================================================================================ -class TNodeDistributor: public StdMeshers_Regular_1D +bool StdMeshers_RadialQuadrangle_1D2D::computeLayerPositions(const gp_Pnt& p1, + const gp_Pnt& p2, + const TopoDS_Edge& linEdge, + bool* linEdgeComputed) { - list myUsedHyps; -public: - // ----------------------------------------------------------------------------- - static TNodeDistributor* GetDistributor(SMESH_Mesh& aMesh) - { - const int myID = -1000; - map < int, SMESH_1D_Algo * > & algoMap = aMesh.GetGen()->_map1D_Algo; - map < int, SMESH_1D_Algo * >::iterator id_algo = algoMap.find( myID ); - if ( id_algo == algoMap.end() ) - return new TNodeDistributor( myID, 0, aMesh.GetGen() ); - return static_cast< TNodeDistributor* >( id_algo->second ); - } - // ----------------------------------------------------------------------------- - bool Compute( vector< double > & positions, - gp_Pnt pIn, - gp_Pnt pOut, - SMESH_Mesh& aMesh, - const StdMeshers_LayerDistribution* hyp) - { - double len = pIn.Distance( pOut ); - if ( len <= DBL_MIN ) return error("Too close points of inner and outer shells"); + // First, try to compute positions of layers - if ( !hyp || !hyp->GetLayerDistribution() ) - return error( "Invalid LayerDistribution hypothesis"); - myUsedHyps.clear(); - myUsedHyps.push_back( hyp->GetLayerDistribution() ); + myLayerPositions.clear(); - TopoDS_Edge edge = BRepBuilderAPI_MakeEdge( pIn, pOut ); - SMESH_Hypothesis::Hypothesis_Status aStatus; - if ( !StdMeshers_Regular_1D::CheckHypothesis( aMesh, edge, aStatus )) - return error( "StdMeshers_Regular_1D::CheckHypothesis() failed " - "with LayerDistribution hypothesis"); + SMESH_Mesh * mesh = myHelper->GetMesh(); - BRepAdaptor_Curve C3D(edge); - double f = C3D.FirstParameter(), l = C3D.LastParameter(); - list< double > params; - if ( !StdMeshers_Regular_1D::computeInternalParameters( aMesh, C3D, len, f, l, params, false )) - return error("StdMeshers_Regular_1D failed to compute layers distribution"); + const SMESH_Hypothesis* hyp1D = myDistributionHypo ? myDistributionHypo->GetLayerDistribution() : 0; + int nbLayers = myNbLayerHypo ? myNbLayerHypo->GetNumberOfLayers() : 0; - positions.clear(); - positions.reserve( params.size() ); - for (list::iterator itU = params.begin(); itU != params.end(); itU++) - positions.push_back( *itU / len ); - return true; + if ( !hyp1D && !nbLayers ) + { + // No own algo hypotheses assigned, so first try to find any 1D hypothesis. + // We need some edge + TopoDS_Shape edge = linEdge; + if ( edge.IsNull() && !myHelper->GetSubShape().IsNull()) + for ( TopExp_Explorer e(myHelper->GetSubShape(), TopAbs_EDGE); e.More(); e.Next()) + edge = e.Current(); + if ( !edge.IsNull() ) + { + // find a hyp usable by TNodeDistributor + SMESH_HypoFilter hypKind; + TNodeDistributor::GetDistributor(*mesh)->InitCompatibleHypoFilter(hypKind,/*ignoreAux=*/1); + hyp1D = mesh->GetHypothesis( edge, hypKind, /*fromAncestors=*/true); + } } -protected: - // ----------------------------------------------------------------------------- - TNodeDistributor( int hypId, int studyId, SMESH_Gen* gen) - : StdMeshers_Regular_1D( hypId, studyId, gen) + if ( hyp1D ) // try to compute with hyp1D { + if ( !TNodeDistributor::GetDistributor(*mesh)->Compute( myLayerPositions,p1,p2,*mesh,hyp1D )) + if ( myDistributionHypo ) { // bad hyp assigned + return error( TNodeDistributor::GetDistributor(*mesh)->GetComputeError() ); + } + else { + // bad hyp found, its Ok, lets try with default nb of segnents + } } - // ----------------------------------------------------------------------------- - virtual const list & - GetUsedHypothesis(SMESH_Mesh &, const TopoDS_Shape &, const bool) + + if ( myLayerPositions.empty() ) // try to use nb of layers { - return myUsedHyps; + if ( !nbLayers ) + nbLayers = _gen->GetDefaultNbSegments(); + + if ( nbLayers ) + { + myLayerPositions.resize( nbLayers - 1 ); + for ( int z = 1; z < nbLayers; ++z ) + myLayerPositions[ z - 1 ] = double( z )/ double( nbLayers ); + } } - // ----------------------------------------------------------------------------- -}; -//================================================================================ -/*! - * \brief Compute positions of nodes between the internal and the external surfaces - * \retval bool - is a success - */ -//================================================================================ + // Second, check presence of a mesh built by other algo on linEdge + // and mesh conformity to my hypothesis -bool StdMeshers_RadialQuadrangle_1D2D::computeLayerPositions(const gp_Pnt& pIn, - const gp_Pnt& pOut) -{ - if ( myNbLayerHypo ) + bool meshComputed = (!linEdge.IsNull() && !mesh->GetSubMesh(linEdge)->IsEmpty() ); + if ( linEdgeComputed ) *linEdgeComputed = meshComputed; + + if ( meshComputed ) { - int nbSegments = myNbLayerHypo->GetNumberOfLayers(); - myLayerPositions.resize( nbSegments - 1 ); - for ( int z = 1; z < nbSegments; ++z ) - myLayerPositions[ z - 1 ] = double( z )/ double( nbSegments ); - return true; - } - if ( myDistributionHypo ) { - SMESH_Mesh * mesh = myHelper->GetMesh(); - if ( !TNodeDistributor::GetDistributor(*mesh)->Compute( myLayerPositions, pIn, pOut, - *mesh, myDistributionHypo )) + vector< double > nodeParams; + GetNodeParamOnEdge( mesh->GetMeshDS(), linEdge, nodeParams ); + + if ( myLayerPositions.empty() ) { - error( TNodeDistributor::GetDistributor(*mesh)->GetComputeError() ); - return false; + myLayerPositions.resize( nodeParams.size() - 2 ); + } + else if ( myDistributionHypo || myNbLayerHypo ) + { + // linEdge is computed by other algo. Check if there is a meshed face + // using nodes on linEdge + bool nodesAreUsed = false; + TopTools_ListIteratorOfListOfShape ancestIt = mesh->GetAncestors( linEdge ); + for ( ; ancestIt.More() && !nodesAreUsed; ancestIt.Next() ) + if ( ancestIt.Value().ShapeType() == TopAbs_FACE ) + nodesAreUsed = (!mesh->GetSubMesh( ancestIt.Value() )->IsEmpty()); + if ( !nodesAreUsed ) { + // rebuild them + mesh->GetSubMesh( linEdge )->ComputeStateEngine( SMESH_subMesh::CLEAN ); + if ( linEdgeComputed ) *linEdgeComputed = false; + } + else if ( myLayerPositions.size() != nodeParams.size()-2 ) { + return error("Radial edge is meshed by other algorithm"); + } } } - RETURN_BAD_RESULT("Bad hypothesis"); + + return !myLayerPositions.empty(); } @@ -965,113 +1070,82 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh, if( aShape.ShapeType() != TopAbs_FACE ) { return false; } - SMESH_subMesh * smf = aMesh.GetSubMesh(aShape); - MapShapeNbElemsItr anIt = aResMap.find(smf); - if( anIt != aResMap.end() ) { + SMESH_subMesh * sm = aMesh.GetSubMesh(aShape); + if( aResMap.count(sm) ) return false; - } - myLayerPositions.clear(); - gp_Pnt P0(0,0,0); - gp_Pnt P1(100,0,0); - computeLayerPositions(P0,P1); - - TopoDS_Edge E1,E2,E3; - Handle(Geom_Curve) C1,C2,C3; - double f1,l1,f2,l2,f3,l3; - int nbe = 0; - TopExp_Explorer exp; - for ( exp.Init( aShape, TopAbs_EDGE ); exp.More(); exp.Next() ) { - nbe++; - TopoDS_Edge E = TopoDS::Edge( exp.Current() ); - if(nbe==1) { - E1 = E; - C1 = BRep_Tool::Curve(E,f1,l1); - } - else if(nbe==2) { - E2 = E; - C2 = BRep_Tool::Curve(E,f2,l2); - } - else if(nbe==3) { - E3 = E; - C3 = BRep_Tool::Curve(E,f3,l3); - } - } + vector& aResVec = + aResMap.insert( make_pair(sm, vector(SMDSEntity_Last,0))).first->second; + + myHelper = new SMESH_MesherHelper( aMesh ); + myHelper->SetSubShape( aShape ); + auto_ptr helperDeleter( myHelper ); + + TNodeDistributor* algo1d = TNodeDistributor::GetDistributor(aMesh); TopoDS_Edge CircEdge, LinEdge1, LinEdge2; + int nbe = analyseFace( aShape, CircEdge, LinEdge1, LinEdge2 ); + if( nbe>3 || nbe < 1 || CircEdge.IsNull() ) + return false; + + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge )); + if( aCirc.IsNull() ) + return error(COMPERR_BAD_SHAPE); + + gp_Pnt P0 = aCirc->Location(); + gp_Pnt P1 = aCirc->Value(0.); + computeLayerPositions( P0, P1, LinEdge1 ); + int nb0d=0, nb2d_tria=0, nb2d_quad=0; - bool isQuadratic = false; - if(nbe==1) { + bool isQuadratic = false, ok = true; + if(nbe==1) + { // C1 must be a circle - Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); - if( !aCirc.IsNull() ) { - bool ok = _gen->Evaluate( aMesh, CircEdge, aResMap ); - if(ok) { - SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge); - MapShapeNbElemsItr anIt = aResMap.find(sm); - vector aVec = (*anIt).second; - isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; - if(isQuadratic) { - // main nodes - nb0d = (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); - // radial medium nodes - nb0d += (aVec[SMDSEntity_Node]+1) * (myLayerPositions.size()+1); - // other medium nodes - nb0d += (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); - } - else { - nb0d = (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); - } - nb2d_tria = aVec[SMDSEntity_Node] + 1; - nb2d_quad = nb0d; + ok = algo1d->EvaluateCircularEdge( aMesh, CircEdge, aResMap ); + if(ok) { + const vector& aVec = aResMap[aMesh.GetSubMesh(CircEdge)]; + isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; + if(isQuadratic) { + // main nodes + nb0d = (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); + // radial medium nodes + nb0d += (aVec[SMDSEntity_Node]+1) * (myLayerPositions.size()+1); + // other medium nodes + nb0d += (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); } + else { + nb0d = (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); + } + nb2d_tria = aVec[SMDSEntity_Node] + 1; + nb2d_quad = nb0d; } } - else if(nbe==2) { + else if(nbe==2 && LinEdge1.Orientation() != TopAbs_INTERNAL) + { // one curve must be a half of circle and other curve must be // a segment of line - Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1); - while( !tc.IsNull() ) { - C1 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C1); - } - tc = Handle(Geom_TrimmedCurve)::DownCast(C2); - while( !tc.IsNull() ) { - C2 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C2); - } - Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); - Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(C2); - CircEdge = E1; - LinEdge1 = E2; - double fp = f1; - double lp = l1; - if( aCirc.IsNull() ) { - aCirc = Handle(Geom_Circle)::DownCast(C2); - CircEdge = E2; - LinEdge1 = E1; - fp = f2; - lp = l2; - aLine = Handle(Geom_Line)::DownCast(C3); - } - bool ok = !aCirc.IsNull() && !aLine.IsNull(); + double fp, lp; + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge, &fp, &lp )); if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) { // not half of circle - ok = false; + return error(COMPERR_BAD_SHAPE); + } + Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 )); + if( aLine.IsNull() ) { + // other curve not line + return error(COMPERR_BAD_SHAPE); } - SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1); - MapShapeNbElemsItr anIt = aResMap.find(sm1); - if( anIt!=aResMap.end() ) { - ok = false; + ok = !aResMap.count( aMesh.GetSubMesh(LinEdge1) ); + if ( !ok ) { + const vector& aVec = aResMap[ aMesh.GetSubMesh(LinEdge1) ]; + ok = ( aVec[SMDSEntity_Node] == myLayerPositions.size() ); } if(ok) { - ok = _gen->Evaluate( aMesh, CircEdge, aResMap ); + ok = algo1d->EvaluateCircularEdge( aMesh, CircEdge, aResMap ); } if(ok) { - SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge); - MapShapeNbElemsItr anIt = aResMap.find(sm); - vector aVec = (*anIt).second; - isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; + const vector& aVec = aResMap[ aMesh.GetSubMesh(CircEdge) ]; + isQuadratic = aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]; if(isQuadratic) { // main nodes nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size(); @@ -1086,8 +1160,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh, nb2d_tria = aVec[SMDSEntity_Node] + 1; nb2d_quad = nb2d_tria * myLayerPositions.size(); // add evaluation for edges - vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i aResVec(SMDSEntity_Last,0); if(isQuadratic) { aResVec[SMDSEntity_Node] = 4*myLayerPositions.size() + 3; aResVec[SMDSEntity_Quad_Edge] = 2*myLayerPositions.size() + 2; @@ -1096,74 +1169,49 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh, aResVec[SMDSEntity_Node] = 2*myLayerPositions.size() + 1; aResVec[SMDSEntity_Edge] = 2*myLayerPositions.size() + 2; } - sm = aMesh.GetSubMesh(LinEdge1); - aResMap.insert(make_pair(sm,aResVec)); + aResMap[ aMesh.GetSubMesh(LinEdge1) ] = aResVec; } } - else { // nbe==3 + else // nbe==3 or ( nbe==2 && linEdge is INTERNAL ) + { + if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL ) + LinEdge2 = LinEdge1; + // one curve must be a part of circle and other curves must be // segments of line - Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1); - while( !tc.IsNull() ) { - C1 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C1); - } - tc = Handle(Geom_TrimmedCurve)::DownCast(C2); - while( !tc.IsNull() ) { - C2 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C2); - } - tc = Handle(Geom_TrimmedCurve)::DownCast(C3); - while( !tc.IsNull() ) { - C3 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C3); + Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 )); + Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast( getCurve( LinEdge2 )); + if( aLine1.IsNull() || aLine2.IsNull() ) { + // other curve not line + return error(COMPERR_BAD_SHAPE); } - Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); - Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast(C2); - Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast(C3); - CircEdge = E1; - LinEdge1 = E2; - LinEdge2 = E3; - double fp = f1; - double lp = l1; - if( aCirc.IsNull() ) { - aCirc = Handle(Geom_Circle)::DownCast(C2); - CircEdge = E2; - LinEdge1 = E3; - LinEdge2 = E1; - fp = f2; - lp = l2; - aLine1 = Handle(Geom_Line)::DownCast(C3); - aLine2 = Handle(Geom_Line)::DownCast(C1); - if( aCirc.IsNull() ) { - aCirc = Handle(Geom_Circle)::DownCast(C3); - CircEdge = E3; - LinEdge1 = E1; - LinEdge2 = E2; - fp = f3; - lp = l3; - aLine1 = Handle(Geom_Line)::DownCast(C1); - aLine2 = Handle(Geom_Line)::DownCast(C2); + int nbLayers = myLayerPositions.size(); + computeLayerPositions( P0, P1, LinEdge2 ); + if ( nbLayers != myLayerPositions.size() ) + return error("Different hypotheses apply to radial edges"); + + bool ok = !aResMap.count( aMesh.GetSubMesh(LinEdge1)); + if ( !ok ) { + if ( myDistributionHypo || myNbLayerHypo ) + ok = true; // override other 1d hyps + else { + const vector& aVec = aResMap[ aMesh.GetSubMesh(LinEdge1) ]; + ok = ( aVec[SMDSEntity_Node] == myLayerPositions.size() ); } } - bool ok = !aCirc.IsNull() && !aLine1.IsNull() && !aLine1.IsNull(); - SMESH_subMesh* sm = aMesh.GetSubMesh(LinEdge1); - MapShapeNbElemsItr anIt = aResMap.find(sm); - if( anIt!=aResMap.end() ) { - ok = false; - } - sm = aMesh.GetSubMesh(LinEdge2); - anIt = aResMap.find(sm); - if( anIt!=aResMap.end() ) { - ok = false; + if( ok && aResMap.count( aMesh.GetSubMesh(LinEdge2) )) { + if ( myDistributionHypo || myNbLayerHypo ) + ok = true; // override other 1d hyps + else { + const vector& aVec = aResMap[ aMesh.GetSubMesh(LinEdge2) ]; + ok = ( aVec[SMDSEntity_Node] == myLayerPositions.size() ); + } } if(ok) { - ok = _gen->Evaluate( aMesh, CircEdge, aResMap ); + ok = algo1d->EvaluateCircularEdge( aMesh, CircEdge, aResMap ); } if(ok) { - SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge); - MapShapeNbElemsItr anIt = aResMap.find(sm); - vector aVec = (*anIt).second; + const vector& aVec = aResMap[ aMesh.GetSubMesh(CircEdge) ]; isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; if(isQuadratic) { // main nodes @@ -1179,8 +1227,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh, nb2d_tria = aVec[SMDSEntity_Node] + 1; nb2d_quad = nb2d_tria * myLayerPositions.size(); // add evaluation for edges - vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i aResVec(SMDSEntity_Last, 0); if(isQuadratic) { aResVec[SMDSEntity_Node] = 2*myLayerPositions.size() + 1; aResVec[SMDSEntity_Quad_Edge] = myLayerPositions.size() + 1; @@ -1190,17 +1237,12 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh, aResVec[SMDSEntity_Edge] = myLayerPositions.size() + 1; } sm = aMesh.GetSubMesh(LinEdge1); - aResMap.insert(make_pair(sm,aResVec)); + aResMap[sm] = aResVec; sm = aMesh.GetSubMesh(LinEdge2); - aResMap.insert(make_pair(sm,aResVec)); + aResMap[sm] = aResVec; } } - vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i -//#include +#include + +#include class StdMeshers_NumberOfLayers; class StdMeshers_LayerDistribution; @@ -63,8 +61,10 @@ public: protected: - bool computeLayerPositions(const gp_Pnt& pIn, - const gp_Pnt& pOut); + bool computeLayerPositions(const gp_Pnt& p1, + const gp_Pnt& p2, + const TopoDS_Edge& linEdge=TopoDS_Edge(), + bool* linEdgeComputed = 0); const StdMeshers_NumberOfLayers* myNbLayerHypo; diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index c3e86a98d..391bd38c3 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,12 +19,13 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Regular_1D.cxx // Moved here from SMESH_Regular_1D.cxx // Author : Paul RASCLE, EDF // Module : SMESH - +// #include "StdMeshers_Regular_1D.hxx" #include "StdMeshers_Distribution.hxx" @@ -325,6 +326,8 @@ static bool computeParamByFunc(Adaptor3d_Curve& C3d, double first, double last, return false; prevU = U; } + if ( theReverse ) + theParams.reverse(); return true; } @@ -804,38 +807,83 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, } if(!IsExist) Params.InsertBefore(j,aPnts[i]); } - double pf, pl, par2, par1, psize; - if (theReverse) { - pf = l; - pl = f; + double par2, par1, lp; + par1 = f; + lp = l; + double sign = 1.0; + if(theReverse) { + par1 = l; + lp = f; + sign = -1.0; } - else { - pf = f; - pl = l; - } - psize = pl - pf; - par1 = pf; - //cout<<"aPnts.size() = "< tmpParams; + for(int i=2; i::iterator itP = tmpParams.begin(); + for(; itP != tmpParams.end(); itP++) { + theParams.push_back( *(itP) ); } + theParams.push_back( par2 ); + par1 = par2; } // add for last int nbseg = ( nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0]; - double dp = (pl-par1)/nbseg; - int j = 1; - for(; j tmpParams; + for(int i=2; i::iterator itP = tmpParams.begin(); + for(; itP != tmpParams.end(); itP++) { + theParams.push_back( *(itP) ); + } + if (theReverse) { theParams.reverse(); // NPAL18025 } @@ -1048,8 +1096,7 @@ bool StdMeshers_Regular_1D::Evaluate(SMESH_Mesh & theMesh, ASSERT(!VFirst.IsNull()); ASSERT(!VLast.IsNull()); - std::vector aVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i aVec(SMDSEntity_Last,0); if (!Curve.IsNull()) { list< double > params; diff --git a/src/StdMeshers/StdMeshers_Regular_1D.hxx b/src/StdMeshers/StdMeshers_Regular_1D.hxx index 86a573c54..c0217343b 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.hxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,12 +19,13 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Regular_1D.hxx // Moved here from SMESH_Regular_1D.hxx // Author : Paul RASCLE, EDF // Module : SMESH - +// #ifndef _SMESH_REGULAR_1D_HXX_ #define _SMESH_REGULAR_1D_HXX_ @@ -49,7 +50,7 @@ public: SMESH_Hypothesis::Hypothesis_Status& aStatus); virtual bool Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape); + const TopoDS_Shape& aShape); virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, MapShapeNbElems& aResMap); diff --git a/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.cxx b/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.cxx index 204909320..d2bb42baa 100644 --- a/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.cxx +++ b/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_SegmentAroundVertex_0D.cxx // Module : SMESH @@ -38,7 +39,7 @@ StdMeshers_SegmentAroundVertex_0D::StdMeshers_SegmentAroundVertex_0D { _name = "SegmentAroundVertex_0D"; // it is assigned to vertices but influence a state of EDGE submeshes - _shapeType = (1 << TopAbs_VERTEX); // 1 bit per shape type + _shapeType = (1 << TopAbs_VERTEX); // 1 bit per shape type _compatibleHypothesis.push_back("SegmentLengthAroundVertex"); } @@ -100,8 +101,8 @@ bool StdMeshers_SegmentAroundVertex_0D::Compute(SMESH_Mesh&, const TopoDS_Shape& //======================================================================= bool StdMeshers_SegmentAroundVertex_0D::Evaluate(SMESH_Mesh&, - const TopoDS_Shape&, - MapShapeNbElems&) + const TopoDS_Shape&, + MapShapeNbElems&) { // This algorithm exists in order just to enable assignation of // StdMeshers_SegmentLengthAroundVertex hypothesis diff --git a/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.hxx b/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.hxx index a2f1bd579..72371496d 100644 --- a/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.hxx +++ b/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_SegmentAroundVertex_0D.hxx // Module : SMESH diff --git a/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cxx b/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cxx index 599690c6a..70898baca 100644 --- a/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cxx +++ b/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,10 +19,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_SegmentLengthAroundVertex.cxx // Module : SMESH - +// #include "StdMeshers_SegmentLengthAroundVertex.hxx" #include "SMESH_Mesh.hxx" diff --git a/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.hxx b/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.hxx index c7c54bbf6..48e366b66 100644 --- a/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.hxx +++ b/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,11 +19,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_SegmentLengthAroundVertex.hxx // Author : Paul RASCLE, EDF // Module : SMESH - +// #ifndef _SMESH_SegmentLengthAroundVertex_HXX_ #define _SMESH_SegmentLengthAroundVertex_HXX_ diff --git a/src/StdMeshers/StdMeshers_StartEndLength.cxx b/src/StdMeshers/StdMeshers_StartEndLength.cxx index 46e9a7cc3..e4043dd7d 100644 --- a/src/StdMeshers/StdMeshers_StartEndLength.cxx +++ b/src/StdMeshers/StdMeshers_StartEndLength.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,10 +19,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers_StartEndLength : implementaion of SMESH idl descriptions // File : StdMeshers_StartEndLength.cxx // Module : SMESH - +// #include "StdMeshers_StartEndLength.hxx" #include "SMESH_Algo.hxx" diff --git a/src/StdMeshers/StdMeshers_StartEndLength.hxx b/src/StdMeshers/StdMeshers_StartEndLength.hxx index 35ae4e0c4..feb477a53 100644 --- a/src/StdMeshers/StdMeshers_StartEndLength.hxx +++ b/src/StdMeshers/StdMeshers_StartEndLength.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,10 +19,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_StartEndLength.hxx // Module : SMESH - +// #ifndef _STDMESHERS_STARTENDLENGTH_HXX_ #define _STDMESHERS_STARTENDLENGTH_HXX_ diff --git a/src/StdMeshers/StdMeshers_TrianglePreference.cxx b/src/StdMeshers/StdMeshers_TrianglePreference.cxx index 331cd0d1c..dac3ca289 100644 --- a/src/StdMeshers/StdMeshers_TrianglePreference.cxx +++ b/src/StdMeshers/StdMeshers_TrianglePreference.cxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,10 +16,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers_TrianglePreference // File : StdMeshers_TrianglePreference.cxx // Module : SMESH - +// #include "StdMeshers_TrianglePreference.hxx" #include "utilities.h" diff --git a/src/StdMeshers/StdMeshers_TrianglePreference.hxx b/src/StdMeshers/StdMeshers_TrianglePreference.hxx index 34ec364a1..c4fb0d7c3 100644 --- a/src/StdMeshers/StdMeshers_TrianglePreference.hxx +++ b/src/StdMeshers/StdMeshers_TrianglePreference.hxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,10 +16,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_TrianglePreference.hxx // Module : SMESH - +// #ifndef _StdMeshers_TrianglePreference_HXX_ #define _StdMeshers_TrianglePreference_HXX_ diff --git a/src/StdMeshers/StdMeshers_UseExisting_1D2D.cxx b/src/StdMeshers/StdMeshers_UseExisting_1D2D.cxx index 3638498e1..7a35a1b97 100644 --- a/src/StdMeshers/StdMeshers_UseExisting_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_UseExisting_1D2D.cxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_UseExisting_1D2D.cxx // Module : SMESH @@ -72,8 +70,8 @@ bool StdMeshers_UseExisting_1D::Compute(SMESH_Mesh&, const TopoDS_Shape&) //======================================================================= bool StdMeshers_UseExisting_1D::Evaluate(SMESH_Mesh&, - const TopoDS_Shape&, - MapShapeNbElems&) + const TopoDS_Shape&, + MapShapeNbElems&) { // This algorithm exists to allow mesh generation by mesh // edition functions in TUI mode @@ -126,8 +124,8 @@ bool StdMeshers_UseExisting_2D::Compute(SMESH_Mesh&, const TopoDS_Shape&) //======================================================================= bool StdMeshers_UseExisting_2D::Evaluate(SMESH_Mesh&, - const TopoDS_Shape&, - MapShapeNbElems&) + const TopoDS_Shape&, + MapShapeNbElems&) { // This algorithm exists to allow mesh generation by mesh edition // functions in TUI mode diff --git a/src/StdMeshers/StdMeshers_UseExisting_1D2D.hxx b/src/StdMeshers/StdMeshers_UseExisting_1D2D.hxx index 961fb4ba9..220cac842 100644 --- a/src/StdMeshers/StdMeshers_UseExisting_1D2D.hxx +++ b/src/StdMeshers/StdMeshers_UseExisting_1D2D.hxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_UseExisting_1D2D.hxx // Module : SMESH diff --git a/src/StdMeshersGUI/Makefile.am b/src/StdMeshersGUI/Makefile.am index e8a194771..7e76cbe67 100644 --- a/src/StdMeshersGUI/Makefile.am +++ b/src/StdMeshersGUI/Makefile.am @@ -1,7 +1,4 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # SMESH StdMeshersGUI : GUI for StdMeshers plugin # File : Makefile.in # Author : Julia DOROVSKIKH @@ -96,7 +94,8 @@ libStdMeshersGUI_la_LDFLAGS = \ ../SMESHGUI/libSMESH.la \ ../OBJECT/libSMESHObject.la \ $(GUI_LDFLAGS) -lSalomeApp \ - $(CAS_LDPATH) -lTKernel -lTKBO -lTKAdvTools + $(CAS_LDPATH) -lTKernel -lTKBO -lTKAdvTools \ + $(QWT_LIBS) # resources files nodist_salomeres_DATA= \ diff --git a/src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx b/src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx index 78982bec9..5bd4940b7 100755 --- a/src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx +++ b/src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESH_StdMeshersGUI.hxx // Author : Alexander BORODIN, Open CASCADE S.A.S. // diff --git a/src/StdMeshersGUI/StdMeshersGUI.cxx b/src/StdMeshersGUI/StdMeshersGUI.cxx index f3e400e82..eb744f72a 100644 --- a/src/StdMeshersGUI/StdMeshersGUI.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI.cxx // Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // SMESH includes diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx index e26ffd7e1..b3b101afb 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_DistrPreview.cxx // Author : Open CASCADE S.A.S. // SMESH includes @@ -222,13 +223,13 @@ void StdMeshersGUI_DistrPreview::update() { SMESH::double_array* arr = 0; if( isTableFunc() ) - arr = h->BuildDistributionTab( myTableFunc, myNbSeg, ( int )myConv ); + arr = h->BuildDistributionTab( myTableFunc, myNbSeg, ( int )myConv ); else - arr = h->BuildDistributionExpr( myFunction.toLatin1().data(), myNbSeg, ( int )myConv ); + arr = h->BuildDistributionExpr( myFunction.toLatin1().data(), myNbSeg, ( int )myConv ); if( arr ) { - distr = *arr; - delete arr; + distr = *arr; + delete arr; } } } @@ -337,7 +338,7 @@ bool isCorrectArg( const Handle( Expr_GeneralExpression )& expr ) if( !name.IsNull() ) { if( name->GetName()!="t" ) - res = false; + res = false; } else res = isCorrectArg( sub ); @@ -421,15 +422,15 @@ bool StdMeshersGUI_DistrPreview::convert( double& v ) const #ifdef NO_CAS_CATCH OCC_CATCH_SIGNALS; #endif - // in StdMeshers_NumberOfSegments.cc - // const double PRECISION = 1e-7; - // - if(v < -7) v = -7.0; - v = pow( 10.0, v ); + // in StdMeshers_NumberOfSegments.cc + // const double PRECISION = 1e-7; + // + if(v < -7) v = -7.0; + v = pow( 10.0, v ); } catch(Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - v = 0.0; - ok = false; + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + v = 0.0; + ok = false; } } break; diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h index 87a9eb86e..76af1d743 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_DistrPreview.h // Author : Open CASCADE S.A.S. // diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx index cc718ed66..7963dbe36 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,16 +19,18 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_DistrTable.cxx // Author : Open CASCADE S.A.S. // SMESH includes // #include "StdMeshersGUI_DistrTable.h" +#include + // Qt incldues #include #include -#include #include #include #include @@ -84,14 +86,14 @@ public: ~SpinBoxDelegate(); QWidget* createEditor( QWidget*, - const QStyleOptionViewItem&, - const QModelIndex& ) const; + const QStyleOptionViewItem&, + const QModelIndex& ) const; void setEditorData( QWidget*, const QModelIndex&) const; void setModelData( QWidget*, QAbstractItemModel*, - const QModelIndex& ) const; + const QModelIndex& ) const; void updateEditorGeometry( QWidget*, - const QStyleOptionViewItem&, - const QModelIndex& ) const; + const QStyleOptionViewItem&, + const QModelIndex& ) const; private: StdMeshersGUI_DistrTableFrame::Table* myTable; @@ -109,7 +111,7 @@ private: struct EditorData { int r, c; - QDoubleSpinBox* sb; + SMESHGUI_SpinBox* sb; EditorData() { reset(); } void reset() { r = -1; c = -1; sb = 0; } }; @@ -138,7 +140,7 @@ public: void addRow(); void deleteRow(); - void setEditor( int, int, QDoubleSpinBox* ); + void setEditor( int, int, SMESHGUI_SpinBox* ); protected: void closeEditor( QWidget*, QAbstractItemDelegate::EndEditHint ); @@ -173,21 +175,25 @@ StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: QWidget* StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: createEditor( QWidget* parent, - const QStyleOptionViewItem& /*option*/, - const QModelIndex& index ) const + const QStyleOptionViewItem& /*option*/, + const QModelIndex& index ) const { - QDoubleSpinBox* sb = new QDoubleSpinBox( parent ); + SMESHGUI_SpinBox* sb = new SMESHGUI_SpinBox( parent ); + + sb->setAcceptNames(false); // No Notebook variables allowed + double aMin = index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? + myTable->argMinimum( index.row() ) : + myTable->funcMinimum( index.row() ); + double aMax = index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? + myTable->argMaximum( index.row() ) : + myTable->funcMaximum( index.row() ); + double aStep = index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? + myTable->argStep( index.row() ) : + myTable->funcStep( index.row() ); + sb->RangeStepAndValidator( aMin, aMax, aStep, "parametric_precision" ); sb->setFrame(false); - sb->setMinimum( index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? - myTable->argMinimum( index.row() ) : - myTable->funcMinimum( index.row() ) ); - sb->setMaximum( index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? - myTable->argMaximum( index.row() ) : - myTable->funcMaximum( index.row() ) ); - sb->setSingleStep( index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? - myTable->argStep( index.row() ) : - myTable->funcStep( index.row() ) ); - myTable->setEditor( index.row(), index.column(), sb ); + + myTable->setEditor( index.row(), index.column(), sb ); return sb; } @@ -196,7 +202,7 @@ StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: setEditorData( QWidget* editor, const QModelIndex& index ) const { QString value = index.model()->data(index, Qt::DisplayRole).toString(); - QDoubleSpinBox* sb = static_cast(editor); + SMESHGUI_SpinBox* sb = static_cast(editor); bool bOk = false; double v = value.toDouble( &bOk ); @@ -208,17 +214,17 @@ setEditorData( QWidget* editor, const QModelIndex& index ) const void StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: setModelData( QWidget* editor, QAbstractItemModel* model, - const QModelIndex& index ) const + const QModelIndex& index ) const { - QDoubleSpinBox* sb = static_cast(editor); + SMESHGUI_SpinBox* sb = static_cast(editor); model->setData( index, QString::number( sb->value() ), Qt::DisplayRole ); } void StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: updateEditorGeometry( QWidget* editor, - const QStyleOptionViewItem& option, - const QModelIndex& /*index*/ ) const + const QStyleOptionViewItem& option, + const QModelIndex& /*index*/ ) const { editor->setGeometry( option.rect ); } @@ -247,7 +253,7 @@ Table( QWidget* parent, int rows ) void StdMeshersGUI_DistrTableFrame::Table:: -setEditor( int r, int c, QDoubleSpinBox* sb ) +setEditor( int r, int c, SMESHGUI_SpinBox* sb ) { myEditorData.r = r; myEditorData.c = c; @@ -530,9 +536,9 @@ StdMeshersGUI_DistrTableFrame( QWidget* parent ) connect( myButtons[ InsertRowBtn ], SIGNAL( clicked() ), this, SLOT( onInsert() ) ); connect( myButtons[ RemoveRowBtn ], SIGNAL( clicked() ), this, SLOT( onRemove() ) ); connect( myTable, SIGNAL( currentCellChanged( int, int, int, int ) ), - this, SIGNAL( currentChanged( int, int ) ) ); + this, SIGNAL( currentChanged( int, int ) ) ); connect( myTable, SIGNAL( cellChanged( int, int ) ), - this, SIGNAL( valueChanged( int, int ) ) ); + this, SIGNAL( valueChanged( int, int ) ) ); } StdMeshersGUI_DistrTableFrame:: diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.h b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.h index 11a4ab333..af68869b9 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.h +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_DistrTable.h // Author : Open CASCADE S.A.S. // diff --git a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx index c5c228bc7..8b503af3d 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,14 +16,16 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_FixedPointsParamWdg.cxx // Author : Open CASCADE S.A.S. // SMESH includes // #include "StdMeshersGUI_FixedPointsParamWdg.h" -#include -#include +#include + +#include // Qt includes #include @@ -76,12 +75,13 @@ StdMeshersGUI_FixedPointsParamWdg::LineDelegate::LineDelegate( QTreeWidget* pare } QWidget* StdMeshersGUI_FixedPointsParamWdg::LineDelegate::createEditor( QWidget* parent, - const QStyleOptionViewItem& option, - const QModelIndex& index ) const + const QStyleOptionViewItem& option, + const QModelIndex& index ) const { QWidget* w = 0; if ( (index.column() == 1 ) ) { - QtxIntSpinBox* sb = new QtxIntSpinBox( parent ); + SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( parent ); + sb->setAcceptNames( false ); // No Notebook variables allowed sb->setFrame( false ); sb->setRange( 1, 999); w = sb; @@ -91,11 +91,11 @@ QWidget* StdMeshersGUI_FixedPointsParamWdg::LineDelegate::createEditor( QWidget* } void StdMeshersGUI_FixedPointsParamWdg::LineDelegate::setModelData( QWidget* editor, - QAbstractItemModel* model, - const QModelIndex& index ) const + QAbstractItemModel* model, + const QModelIndex& index ) const { - model->setData( index, qobject_cast( editor )->value(), Qt::EditRole ); - model->setData( index, qobject_cast( editor )->value(), Qt::UserRole ); + model->setData( index, qobject_cast( editor )->value(), Qt::EditRole ); + model->setData( index, qobject_cast( editor )->value(), Qt::UserRole ); } //================================================================================ @@ -114,7 +114,7 @@ StdMeshersGUI_FixedPointsParamWdg myListWidget = new QListWidget( this ); myTreeWidget = new QTreeWidget( this ); - mySpinBox = new QtxDoubleSpinBox( this ); + mySpinBox = new SMESHGUI_SpinBox( this ); myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this ); myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this ); mySameValues = new QCheckBox( tr("SMESH_SAME_NB_SEGMENTS"), this); @@ -141,10 +141,8 @@ StdMeshersGUI_FixedPointsParamWdg myListWidget->setMinimumWidth( 80 ); myTreeWidget->setMinimumWidth( 200 ); - mySpinBox->setRange( 0, 1 ); - mySpinBox->setSingleStep( 0.1 ); - mySpinBox->setDecimals( 4 ); - mySpinBox->setPrecision( 4 ); + mySpinBox->setAcceptNames( false ); // No Notebook variables allowed + mySpinBox->RangeStepAndValidator( 0., 1., .1, "parametric_precision" ); myListWidget->setMinimumWidth( 70 ); connect( myAddButton, SIGNAL( clicked() ), SLOT( onAdd() ) ); @@ -205,7 +203,7 @@ void StdMeshersGUI_FixedPointsParamWdg::onAdd() { addPoint( mySpinBox->value() ); } - + //================================================================================= // function : onRemove() // purpose : Called when Remove Button Clicked @@ -264,7 +262,7 @@ void StdMeshersGUI_FixedPointsParamWdg::addPoint( double v) double lv = point( i ); if ( EQUAL_DBL(lv, v) ) { toInsert = false; break; } else if ( GT_DBL(lv, v) ) { - idx = i; break; + idx = i; break; } } if ( toInsert ) { @@ -292,7 +290,7 @@ void StdMeshersGUI_FixedPointsParamWdg::removePoints() delete myTreeWidget->topLevelItem( idx ); delete item; myTreeWidget->topLevelItem( idx )->setText( 0, treeItemText( idx == 0 ? 0 : point( idx-1 ), - idx > myListWidget->count()-1 ? 1 : point( idx ) ) ); + idx > myListWidget->count()-1 ? 1 : point( idx ) ) ); } onCheckBoxChanged(); updateState(); diff --git a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h index 273781d34..0e421fe44 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_FixedPointsParamWdg.h // Author : Open CASCADE S.A.S. (dmv) // @@ -34,7 +32,7 @@ #include class SMESHGUI; -class QtxDoubleSpinBox; +class SMESHGUI_SpinBox; class QPushButton; class QLineEdit; class QCheckBox; @@ -84,7 +82,7 @@ private: private: QListWidget* myListWidget; QTreeWidget* myTreeWidget; - QtxDoubleSpinBox* mySpinBox; + SMESHGUI_SpinBox* mySpinBox; QPushButton* myAddButton; QPushButton* myRemoveButton; QCheckBox* mySameValues; diff --git a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx index 5d187b6d0..b1ef69a5e 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_LayerDistributionParamWdg.cxx // Author : Open CASCADE S.A.S. // SMESH includes @@ -50,7 +51,7 @@ StdMeshersGUI_LayerDistributionParamWdg ::StdMeshersGUI_LayerDistributionParamWdg(SMESH::SMESH_Hypothesis_ptr hyp, - const QString& theName, + const QString& theName, QDialog* dlg): QWidget(), myName(theName), myDlg( dlg ) { diff --git a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.h b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.h index b47b122b1..c7e62c88a 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_LayerDistributionParamWdg.h // Author : Open CASCADE S.A.S. // @@ -51,7 +52,7 @@ class STDMESHERSGUI_EXPORT StdMeshersGUI_LayerDistributionParamWdg : public QWid public: StdMeshersGUI_LayerDistributionParamWdg(SMESH::SMESH_Hypothesis_ptr, - const QString&, + const QString&, QDialog*); ~StdMeshersGUI_LayerDistributionParamWdg(); diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx index 2ee5473af..9fce3fe98 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_NbSegmentsCreator.cxx // Author : Open CASCADE S.A.S. // SMESH includes @@ -149,7 +150,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame() // 3) scale myGroupLayout->addWidget( myLScale = new QLabel( tr( "SMESH_NB_SEGMENTS_SCALE_PARAM" ), GroupC1 ), row, 0 ); myScale = new SMESHGUI_SpinBox( GroupC1 ); - myScale->RangeStepAndValidator( 1E-5, 1E+5, 0.1, 6 ); + myScale->RangeStepAndValidator( 1E-5, 1E+5, 0.1, "parametric_precision" ); myGroupLayout->addWidget( myScale, row, 1 ); row++; diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h index 6053e8d34..f50b19433 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_NbSegmentsCreator.h // Author : Open CASCADE S.A.S. // diff --git a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.cxx index 37a3ce7ee..06f2431ec 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_ObjectReferenceParamWdg.cxx // Author : Open CASCADE S.A.S. // SMESH includes diff --git a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h index 62e5096af..c5fabc25e 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_ObjectReferenceParamWdg.h // Author : Open CASCADE S.A.S. // diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index 0d72900dc..8fd24f351 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_StdHypothesisCreator.cxx // Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // SMESH includes @@ -999,13 +1000,15 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const anEntry = h->GetObjectEntry(); aDirectionWidget->SetGeomShapeEntry( anEntry ); aDirectionWidget->SetMainShapeEntry( aMainEntry ); - SMESH::long_array_var aVec = new SMESH::long_array; - int vertID = h->GetTriaVertex(); - if(vertID>0) { - aVec->length(1); - aVec[0] = vertID; + if ( !isCreation() ) { + SMESH::long_array_var aVec = new SMESH::long_array; + int vertID = h->GetTriaVertex(); + if(vertID>0) { + aVec->length(1); + aVec[0] = vertID; + aDirectionWidget->SetListOfIDs( aVec ); + } } - aDirectionWidget->SetListOfIDs( aVec ); aDirectionWidget->showPreview( true ); customWidgets()->append ( aDirectionWidget ); } @@ -1028,38 +1031,38 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int) if( hypType()=="LocalLength" && sb ) { if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PARAM")) - sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); + sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" ); else if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PRECISION")) - sb->RangeStepAndValidator( 0.0, 1.0, 0.05, 7 ); + sb->RangeStepAndValidator( 0.0, 1.0, 0.05, "len_tol_precision" ); } else if( hypType()=="Arithmetic1D" && sb ) { - sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); + sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" ); } else if( hypType()=="MaxLength" && sb ) { - sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); + sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" ); sb->setEnabled( !widget< QCheckBox >( 1 )->isChecked() ); } else if( hypType()=="MaxElementArea" && sb ) { - sb->RangeStepAndValidator( VALUE_SMALL_2, VALUE_MAX_2, 1.0, 6 ); + sb->RangeStepAndValidator( VALUE_SMALL_2, VALUE_MAX_2, 1.0, "area_precision" ); } else if( hypType()=="MaxElementVolume" && sb ) { - sb->RangeStepAndValidator( VALUE_SMALL_3, VALUE_MAX_3, 1.0, 6 ); + sb->RangeStepAndValidator( VALUE_SMALL_3, VALUE_MAX_3, 1.0, "vol_precision" ); } else if( hypType()=="StartEndLength" && sb ) { - sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); + sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" ); } else if( hypType()=="Deflection1D" && sb ) { - sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); + sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" ); } else if ( sb ) // default validator for possible ancestors { - sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); + sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" ); } } diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h index 0973c5c03..1f693be44 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_StdHypothesisCreator.h // Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // diff --git a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx index 65b99514e..4bc2b7549 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,11 +16,11 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_SubShapeSelectorWdg.cxx // Author : Open CASCADE S.A.S. (dmv) // SMESH includes // - #include "StdMeshersGUI_SubShapeSelectorWdg.h" // SMESH Includes @@ -83,7 +80,7 @@ StdMeshersGUI_SubShapeSelectorWdg ::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ): QWidget( parent ), myPreviewActor( 0 ), - myMaxSize( 0 ) + myMaxSize( -1 ) { QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) ); @@ -146,6 +143,9 @@ void StdMeshersGUI_SubShapeSelectorWdg::init() myListOfIDs.clear(); mySelectedIDs.clear(); + myAddButton->setEnabled( false ); + myRemoveButton->setEnabled( false ); + mySMESHGUI = SMESHGUI::GetSMESHGUI(); mySelectionMgr = SMESH::GetSelectionMgr( mySMESHGUI ); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); @@ -199,63 +199,76 @@ void StdMeshersGUI_SubShapeSelectorWdg::SelectionIntoArgument() mySelectionMgr->selectedObjects( aList ); int nbSel = aList.Extent(); - if (nbSel < 1) - return; - - SALOME_ListIteratorOfListIO anIt (aList); + if (nbSel > 0) { + SALOME_ListIteratorOfListIO anIt (aList); - for ( ; anIt.More(); anIt.Next()) { // Loop on selected objects - Handle(SALOME_InteractiveObject) IO = anIt.Value(); - - GEOM::GEOM_Object_var aGeomObj = GetGeomObjectByEntry( IO->getEntry() ); - if ( !CORBA::is_nil( aGeomObj ) ) { // Selected Object From Study - GEOM::GEOM_Object_ptr aGeomFatherObj = aGeomObj->GetMainShape(); - QString aFatherEntry = ""; - QString aMainFatherEntry = ""; - TopoDS_Shape shape; - if ( !CORBA::is_nil( aGeomFatherObj ) ) { - // Get Main Shape - GEOM::GEOM_Object_var aGeomMain = GetGeomObjectByEntry( myEntry ); - if ( !CORBA::is_nil( aGeomMain ) && aGeomMain->GetType() == 37 ) { // Main Shape is a Group - GEOM::GEOM_Object_ptr aMainFatherObj = aGeomMain->GetMainShape(); - if ( !CORBA::is_nil( aMainFatherObj ) ) - aMainFatherEntry = aMainFatherObj->GetStudyEntry(); - } - aFatherEntry = aGeomFatherObj->GetStudyEntry(); - } + for ( ; anIt.More(); anIt.Next()) { // Loop on selected objects + Handle(SALOME_InteractiveObject) IO = anIt.Value(); - if ( aFatherEntry != "" && ( aFatherEntry == myEntry || aFatherEntry == aMainFatherEntry ) ) { - if ( aGeomObj->GetType() == 37 /*GEOM_GROUP*/ ) { // Selected Group that belongs the main object - GEOMBase::GetShape(aGeomObj, shape); - if ( !shape.IsNull() ) { - TopExp_Explorer exp( shape, mySubShType ); - for ( ; exp.More(); exp.Next() ) { - int index = myPreviewActor->GetIndexByShape( exp.Current() ); - if ( index ) { - mySelectedIDs.append( index ); - myPreviewActor->HighlightID( index ); - } - } - } - } else if ( aGeomObj->GetType() == 28 /*GEOM_SUBSHAPE*/ ) { - GEOMBase::GetShape(aGeomObj, shape); - if ( !shape.IsNull() && shape.ShapeType() == mySubShType ) { - int index = myPreviewActor->GetIndexByShape( shape ); - if ( index ) { - mySelectedIDs.append( index ); - myPreviewActor->HighlightID( index ); - } - } - } + GEOM::GEOM_Object_var aGeomObj = GetGeomObjectByEntry( IO->getEntry() ); + if ( !CORBA::is_nil( aGeomObj ) ) { // Selected Object From Study + GEOM::GEOM_Object_ptr aGeomFatherObj = aGeomObj->GetMainShape(); + QString aFatherEntry = ""; + QString aMainFatherEntry = ""; + TopoDS_Shape shape; + if ( !CORBA::is_nil( aGeomFatherObj ) ) { + // Get Main Shape + GEOM::GEOM_Object_var aGeomMain = GetGeomObjectByEntry( myEntry ); + if ( !CORBA::is_nil( aGeomMain ) && aGeomMain->GetType() == 37 ) { // Main Shape is a Group + GEOM::GEOM_Object_ptr aMainFatherObj = aGeomMain->GetMainShape(); + if ( !CORBA::is_nil( aMainFatherObj ) ) + aMainFatherEntry = aMainFatherObj->GetStudyEntry(); + } + aFatherEntry = aGeomFatherObj->GetStudyEntry(); + } + + if ( aFatherEntry != "" && ( aFatherEntry == myEntry || aFatherEntry == aMainFatherEntry ) ) { + if ( aGeomObj->GetType() == 37 /*GEOM_GROUP*/ ) { // Selected Group that belongs the main object + GEOMBase::GetShape(aGeomObj, shape); + if ( !shape.IsNull() ) { + TopExp_Explorer exp( shape, mySubShType ); + for ( ; exp.More(); exp.Next() ) { + int index = myPreviewActor->GetIndexByShape( exp.Current() ); + if ( index ) { + mySelectedIDs.append( index ); + myPreviewActor->HighlightID( index ); + } + } + } + } else if ( aGeomObj->GetType() == 28 /*GEOM_SUBSHAPE*/ ) { + GEOMBase::GetShape(aGeomObj, shape); + if ( !shape.IsNull() && shape.ShapeType() == mySubShType ) { + int index = myPreviewActor->GetIndexByShape( shape ); + if ( index ) { + mySelectedIDs.append( index ); + myPreviewActor->HighlightID( index ); + } + } + } + } + } else { // Selected Actor from Actor Collection + QString anEntry = IO->getEntry(); + QString str = "_"; + int index = anEntry.lastIndexOf( str ); + anEntry.remove(0, index+1); + int ind = anEntry.toInt(); + if ( ind ) + mySelectedIDs.append( ind ); } - } else { // Selected Actor from Actor Collection - QString anEntry = IO->getEntry(); - QString str = "_"; - int index = anEntry.lastIndexOf( str ); - anEntry.remove(0, index+1); - int ind = anEntry.toInt(); - if ( ind ) - mySelectedIDs.append( ind ); + } + } + // update add button + myAddButton->setEnabled( myListWidget->count() < myMaxSize && mySelectedIDs.size() > 0 && ( mySelectedIDs.size() <= myMaxSize || myMaxSize == -1 ) ); + + //Connect Selected Ids in viewer and dialog's Ids list + myListWidget->clearSelection(); + if ( mySelectedIDs.size() > 0 ) { + for (int i = 0; i < mySelectedIDs.size(); i++) { + QString anID = QString(" %1").arg( mySelectedIDs.at(i) ); + QList anItems = myListWidget->findItems ( anID, Qt::MatchExactly ); + QListWidgetItem* item; + foreach(item, anItems) + item->setSelected(true); } } } @@ -270,7 +283,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::onAdd() return; myListWidget->blockSignals( true ); - for (int i = 0; i < mySelectedIDs.size() && (myMaxSize < 1 || myListOfIDs.size() < myMaxSize); i++) { + for (int i = 0; i < mySelectedIDs.size() && (myMaxSize == -1 || myListOfIDs.size() < myMaxSize); i++) { if ( myListOfIDs.indexOf( mySelectedIDs.at(i) ) == -1 ) { QString anID = QString(" %1").arg( mySelectedIDs.at(i) ); @@ -282,9 +295,9 @@ void StdMeshersGUI_SubShapeSelectorWdg::onAdd() } onListSelectionChanged(); myListWidget->blockSignals( false ); - myAddButton->setEnabled( myListOfIDs.size() < myMaxSize ); + myAddButton->setEnabled( myMaxSize == -1 || myListOfIDs.size() < myMaxSize ); } - + //================================================================================= // function : onRemove() // purpose : Called when Remove Button Clicked @@ -327,6 +340,9 @@ void StdMeshersGUI_SubShapeSelectorWdg::onListSelectionChanged() QListWidgetItem* anItem; foreach(anItem, selItems) myPreviewActor->HighlightID( anItem->text().toInt() ); + + // update remove button + myRemoveButton->setEnabled( selItems.size() > 0 ); } //================================================================================= @@ -355,8 +371,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::updateState() state = true; myListWidget->setEnabled( state ); - myAddButton->setEnabled( state ); - myRemoveButton->setEnabled( state ); + myAddButton->setEnabled( mySelectedIDs.size() > 0 ); if (state) { myPreviewActor = new SMESH_PreviewActorsCollection(); @@ -421,7 +436,7 @@ SMESH::long_array_var StdMeshersGUI_SubShapeSelectorWdg::GetListOfIDs() anArray->length( size ); if ( size ) { for (int i = 0; i < size; i++) { - anArray[i] = myListOfIDs.at(i); + anArray[i] = myListOfIDs.at(i); } } return anArray; diff --git a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h index 49e49e82a..b29840bdf 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : StdMeshersGUI_SubShapeSelectorWdg.h // Author : Open CASCADE S.A.S. (dmv) // diff --git a/src/StdMeshersGUI/StdMeshers_images.ts b/src/StdMeshersGUI/StdMeshers_images.ts index 7438aa85e..fa4ca5767 100644 --- a/src/StdMeshersGUI/StdMeshers_images.ts +++ b/src/StdMeshersGUI/StdMeshers_images.ts @@ -1,6 +1,6 @@