From: vsr Date: Thu, 3 Apr 2014 11:25:50 +0000 (+0400) Subject: Merge branch V7_3_1_BR X-Git-Tag: V7_4_0a1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=5d68554076bbca0e1e95fb0db215a6c2b84b6c54;hp=fb2221e7e2cf95fdc97e2217c6328e0c9504ccb0 Merge branch V7_3_1_BR --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 97b780d46..4dd5f2eb1 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -32,7 +32,7 @@ SET(${PROJECT_NAME_UC}_MINOR_VERSION 3) SET(${PROJECT_NAME_UC}_PATCH_VERSION 1) SET(${PROJECT_NAME_UC}_VERSION ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION}) -SET(${PROJECT_NAME_UC}_VERSION_DEV 0) +SET(${PROJECT_NAME_UC}_VERSION_DEV 1) # Find KERNEL # =========== @@ -41,14 +41,11 @@ IF(EXISTS ${KERNEL_ROOT_DIR}) LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files") INCLUDE(SalomeMacros) FIND_PACKAGE(SalomeKERNEL REQUIRED) + KERNEL_WITH_CORBA() #check whether KERNEL builded with CORBA ELSE(EXISTS ${KERNEL_ROOT_DIR}) MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR") ENDIF(EXISTS ${KERNEL_ROOT_DIR}) -IF(SALOME_LIGHT_ONLY) - MESSAGE(FATAL_ERROR "SMESH module can't be built in Light mode (without CORBA)") -ENDIF() - # Platform setup # ============== INCLUDE(SalomeSetupPlatform) # From KERNEL @@ -125,7 +122,7 @@ IF(SALOME_BUILD_GUI) IF(EXISTS ${GUI_ROOT_DIR}) LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files") FIND_PACKAGE(SalomeGUI) - + FULL_GUI(TRUE) #check whether GUI builded in full mode and with CORBA ## ## Prerequisites From GUI: ## diff --git a/SMESH_version.h.in b/SMESH_version.h.in index 738d0841a..ddf1bff09 100644 --- a/SMESH_version.h.in +++ b/SMESH_version.h.in @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/SalomeSMESHConfig.cmake.in b/SalomeSMESHConfig.cmake.in index d82a2ee2a..204cb8816 100644 --- a/SalomeSMESHConfig.cmake.in +++ b/SalomeSMESHConfig.cmake.in @@ -5,28 +5,27 @@ # ############################################################### -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&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) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. +# This library is 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, or (at your option) any later version. # -# 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 -############################################################### ### Initialisation performed by CONFIGURE_PACKAGE_CONFIG_FILE: @PACKAGE_INIT@ diff --git a/adm_local/CMakeLists.txt b/adm_local/CMakeLists.txt index 84d97c22e..bedde74e0 100755 --- a/adm_local/CMakeLists.txt +++ b/adm_local/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/cmake_files/CMakeLists.txt b/adm_local/cmake_files/CMakeLists.txt index 602688c35..3ccd4f39d 100755 --- a/adm_local/cmake_files/CMakeLists.txt +++ b/adm_local/cmake_files/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/cmake_files/FindCGNS.cmake b/adm_local/cmake_files/FindCGNS.cmake index 34a0aa96c..84471e631 100644 --- a/adm_local/cmake_files/FindCGNS.cmake +++ b/adm_local/cmake_files/FindCGNS.cmake @@ -5,7 +5,7 @@ # ######################################################################### -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -13,7 +13,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/cmake_files/FindSMESH.cmake b/adm_local/cmake_files/FindSMESH.cmake index e764afe5b..aeb4ee6e0 100644 --- a/adm_local/cmake_files/FindSMESH.cmake +++ b/adm_local/cmake_files/FindSMESH.cmake @@ -1,9 +1,9 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/cmake_files/FindSalomeCGNS.cmake b/adm_local/cmake_files/FindSalomeCGNS.cmake index b43dd0cf5..1f5ced5b4 100644 --- a/adm_local/cmake_files/FindSalomeCGNS.cmake +++ b/adm_local/cmake_files/FindSalomeCGNS.cmake @@ -1,9 +1,9 @@ -# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2013-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/cmake_files/FindSalomeSMESH.cmake b/adm_local/cmake_files/FindSalomeSMESH.cmake index ac29b1a92..c433652b2 100644 --- a/adm_local/cmake_files/FindSalomeSMESH.cmake +++ b/adm_local/cmake_files/FindSalomeSMESH.cmake @@ -1,9 +1,9 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,7 +16,6 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -# IF(NOT SalomeSMESH_FIND_QUIETLY) MESSAGE(STATUS "Looking for Salome SMESH ...") diff --git a/adm_local/cmake_files/FindSalomeTBB.cmake b/adm_local/cmake_files/FindSalomeTBB.cmake index ae7ab0643..c7486e9a1 100644 --- a/adm_local/cmake_files/FindSalomeTBB.cmake +++ b/adm_local/cmake_files/FindSalomeTBB.cmake @@ -1,9 +1,9 @@ -# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2013-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/cmake_files/FindSalomef2c.cmake b/adm_local/cmake_files/FindSalomef2c.cmake index dcaf89366..1de9cd94c 100755 --- a/adm_local/cmake_files/FindSalomef2c.cmake +++ b/adm_local/cmake_files/FindSalomef2c.cmake @@ -1,9 +1,9 @@ -# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2013-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/cmake_files/FindTBB.cmake b/adm_local/cmake_files/FindTBB.cmake index d5cff334f..2fa30c576 100644 --- a/adm_local/cmake_files/FindTBB.cmake +++ b/adm_local/cmake_files/FindTBB.cmake @@ -5,7 +5,7 @@ # ######################################################################### -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -13,7 +13,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/cmake_files/Findf2c.cmake b/adm_local/cmake_files/Findf2c.cmake index e6cc8e1cc..896f1e349 100755 --- a/adm_local/cmake_files/Findf2c.cmake +++ b/adm_local/cmake_files/Findf2c.cmake @@ -6,7 +6,7 @@ # ######################################################################### -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -14,7 +14,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/unix/CMakeLists.txt b/adm_local/unix/CMakeLists.txt index 2f895ae4b..eb508c1f4 100755 --- a/adm_local/unix/CMakeLists.txt +++ b/adm_local/unix/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/unix/config_files/CMakeLists.txt b/adm_local/unix/config_files/CMakeLists.txt index 811a3abb2..a734dfab3 100755 --- a/adm_local/unix/config_files/CMakeLists.txt +++ b/adm_local/unix/config_files/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/unix/config_files/check_Platform.m4 b/adm_local/unix/config_files/check_Platform.m4 index 21c2baca9..16344da79 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +dnl Copyright (C) 2007-2014 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 @@ -6,7 +6,7 @@ dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License. +dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/unix/config_files/check_SMESH.m4 b/adm_local/unix/config_files/check_SMESH.m4 index 387759198..7e9d4eefa 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +dnl Copyright (C) 2007-2014 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 @@ -6,7 +6,7 @@ dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License. +dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/unix/config_files/check_cgal.m4 b/adm_local/unix/config_files/check_cgal.m4 index c987b5e38..ca787993f 100644 --- a/adm_local/unix/config_files/check_cgal.m4 +++ b/adm_local/unix/config_files/check_cgal.m4 @@ -1,4 +1,4 @@ -dnl Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +dnl Copyright (C) 2007-2014 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 @@ -6,7 +6,7 @@ dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License. +dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/unix/config_files/check_cgns.m4 b/adm_local/unix/config_files/check_cgns.m4 index 008301d7e..4f27dc6bd 100644 --- a/adm_local/unix/config_files/check_cgns.m4 +++ b/adm_local/unix/config_files/check_cgns.m4 @@ -1,4 +1,4 @@ -dnl Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +dnl Copyright (C) 2007-2014 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 @@ -6,7 +6,7 @@ dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License. +dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/unix/config_files/check_f77.m4 b/adm_local/unix/config_files/check_f77.m4 index 74fdfa501..99f34c0fa 100644 --- a/adm_local/unix/config_files/check_f77.m4 +++ b/adm_local/unix/config_files/check_f77.m4 @@ -1,4 +1,4 @@ -dnl Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +dnl Copyright (C) 2007-2014 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 @@ -6,7 +6,7 @@ dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License. +dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/unix/config_files/check_padder.m4 b/adm_local/unix/config_files/check_padder.m4 index 2adb6407b..ca8ace8ba 100644 --- a/adm_local/unix/config_files/check_padder.m4 +++ b/adm_local/unix/config_files/check_padder.m4 @@ -1,4 +1,4 @@ -dnl Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +dnl Copyright (C) 2007-2014 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 @@ -6,7 +6,7 @@ dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License. +dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/adm_local/unix/config_files/check_qwt.m4 b/adm_local/unix/config_files/check_qwt.m4 index 1d9ea498f..8990bffad 100644 --- a/adm_local/unix/config_files/check_qwt.m4 +++ b/adm_local/unix/config_files/check_qwt.m4 @@ -1,4 +1,4 @@ -dnl Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +dnl Copyright (C) 2007-2014 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 @@ -6,7 +6,7 @@ dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License. +dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt index dc1914013..4af8a501e 100755 --- a/bin/CMakeLists.txt +++ b/bin/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/bin/smesh_setenv.py b/bin/smesh_setenv.py index 9311968b0..b58c8e412 100644 --- a/bin/smesh_setenv.py +++ b/bin/smesh_setenv.py @@ -1,11 +1,11 @@ #!/usr/bin/env python # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 645a52301..27aa5730a 100755 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,4 +21,3 @@ # ADD_SUBDIRECTORY(salome) -ADD_SUBDIRECTORY(docutils) diff --git a/doc/docutils/CMakeLists.txt b/doc/docutils/CMakeLists.txt deleted file mode 100755 index a34d26b32..000000000 --- a/doc/docutils/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (C) 2012-2013 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 -# - -SALOME_CONFIGURE_FILE(conf.py.in conf.py) - -SET(_cmd_options -c ${CMAKE_CURRENT_BINARY_DIR} -b html -d doctrees -D latex_paper_size=a4 ${CMAKE_CURRENT_SOURCE_DIR} docutils) - -# This macro mainly prepares the environment in which sphinx should run: -# this sets the PYTHONPATH and LD_LIBRARY_PATH to include OMNIORB, DOCUTILS, SETUPTOOLS, etc ... -SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${SPHINX_EXECUTABLE}" "${_cmd_options}") - -ADD_CUSTOM_TARGET(html_docs COMMAND ${_cmd}) - -INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target html_docs)") -INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docutils DESTINATION ${SALOME_INSTALL_DOC}/tui/SMESH) -INSTALL(FILES ${PROJECT_SOURCE_DIR}/doc/salome/tui/images/head.png ${PROJECT_SOURCE_DIR}/doc/salome/tui/images/smeshscreen.png - DESTINATION ${SALOME_INSTALL_DOC}/tui/SMESH) - -SET(make_clean_files docutils doctrees) -SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}") diff --git a/doc/docutils/conf.py.in b/doc/docutils/conf.py.in deleted file mode 100644 index 6f929932f..000000000 --- a/doc/docutils/conf.py.in +++ /dev/null @@ -1,200 +0,0 @@ -# -*- coding: iso-8859-1 -*- -# -# yacs documentation build configuration file, created by -# sphinx-quickstart on Fri Aug 29 09:57:25 2008. -# -# This file is execfile()d with the current directory set to its containing dir. -# -# The contents of this file are pickled, so don't put values in the namespace -# that aren't pickleable (module imports are okay, they're removed automatically). -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys, os - -# If your extensions are in another directory, add it here. If the directory -# is relative to the documentation root, use os.path.abspath to make it -# absolute, like shown here. -#sys.path.append(os.path.abspath('.')) - -# General configuration -# --------------------- - -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc'] - -# Uncomment the following line to build the links with Python documentation -# (you might need to set http_proxy environment variable for this to work) -#extensions += ['sphinx.ext.intersphinx'] - -# Intersphinx mapping to add links to modules and objects in the Python -# standard library documentation -intersphinx_mapping = {'http://docs.python.org': None} - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix of source filenames. -source_suffix = '.rst' - -# The encoding of source files. -source_encoding = 'utf-8' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = 'SMESH python packages' -copyright = '2010 EDF R&D' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = '@SALOMESMESH_VERSION@' -# The full version, including alpha/beta/rc tags. -release = '@SALOMESMESH_VERSION@' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -language = 'en' - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of documents that shouldn't be included in the build. -#unused_docs = [] - -# List of directories, relative to source directory, that shouldn't be searched -# for source files. -exclude_trees = ['.build','ref','images','CVS','.svn'] - -# The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - - -# Options for HTML output -# ----------------------- - -# The theme to use for HTML and HTML Help pages. Major themes that come with -# Sphinx are currently 'default' and 'sphinxdoc'. -html_theme = 'default' -#html_theme = 'nature' -#html_theme = 'agogo' -#html_theme = 'sphinxdoc' -#html_theme = 'omadoc' - -# Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = ['themes'] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -#html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -#html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = ['_static'] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -html_use_modindex = False - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -#html_split_index = False - -# If true, the reST sources are included in the HTML build as _sources/. -html_copy_source = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = '' - -# Output file base name for HTML help builder. -htmlhelp_basename = 'smeshpydoc' - - -# Options for LaTeX output -# ------------------------ - -# The paper size ('letter' or 'a4'). -latex_paper_size = 'a4' - -# The font size ('10pt', '11pt' or '12pt'). -latex_font_size = '10pt' - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, document class [howto/manual]). -latex_documents = [ - ('index', 'smeshpy.tex', 'Documentation of the SMESH python packages', 'EDF R\&D', 'manual') -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -latex_logo = '@CMAKE_CURRENT_SOURCE_DIR@/../salome/tui/images/head.png' - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = True - -# Additional stuff for the LaTeX preamble. -#latex_preamble = '' - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -latex_use_modindex = False diff --git a/doc/docutils/docapi.rst b/doc/docutils/docapi.rst deleted file mode 100644 index b39c124dc..000000000 --- a/doc/docutils/docapi.rst +++ /dev/null @@ -1,17 +0,0 @@ - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - Documentation of the programming interface (API) -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -This section describes the python packages and modules of the -``salome.smesh`` python package. The main part is generated from the -code documentation included in source python files. - -:mod:`salome.smesh` -- Package containing the SMESH python utilities -==================================================================== - -:mod:`smeshstudytools` -- Tools to access SMESH objects in the study --------------------------------------------------------------------- - -.. automodule:: salome.smesh.smeshstudytools - :members: diff --git a/doc/docutils/index.rst b/doc/docutils/index.rst deleted file mode 100644 index 4863e8288..000000000 --- a/doc/docutils/index.rst +++ /dev/null @@ -1,10 +0,0 @@ - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - Documentation of the SMESH python package -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -.. toctree:: - :maxdepth: 3 - - overview.rst - docapi.rst diff --git a/doc/docutils/overview.rst b/doc/docutils/overview.rst deleted file mode 100644 index ce82cc812..000000000 --- a/doc/docutils/overview.rst +++ /dev/null @@ -1,24 +0,0 @@ - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -General presentation of the SMESH python package -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -The SMESH python package contains (today) helper functions to -manipulate mesh elements and interact with these elements. - -Note that these functions either encapsulate the python programming -interface of SMESH core (the CORBA or SWIG interface for example) or -extend existing utilities as the ``smesh.py`` module. - -The functions are distributed in the python package -``salome.smesh``. - -The specification of the programming interface of this package is -detailled in the part :doc:`Documentation of the programming interface -(API)` of this documentation. - -.. note:: - The main package ``salome`` contains other sub-packages that are - distributed with the other SALOME modules. For example, the KERNEL - module provides the python package ``salome.kernel`` and GEOM the - package ``salome.geom``. diff --git a/doc/salome/CMakeLists.txt b/doc/salome/CMakeLists.txt index ea8a2e204..197a24a4f 100755 --- a/doc/salome/CMakeLists.txt +++ b/doc/salome/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt index aefec539d..227764998 100644 --- a/doc/salome/examples/CMakeLists.txt +++ b/doc/salome/examples/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/doc/salome/examples/cartesian_algo.py b/doc/salome/examples/cartesian_algo.py index dc0dc23cf..e5651cb67 100644 --- a/doc/salome/examples/cartesian_algo.py +++ b/doc/salome/examples/cartesian_algo.py @@ -50,3 +50,40 @@ print "nb hexahedra",mesh.NbHexas() print "nb tetrahedra",mesh.NbTetras() print "nb polyhedra",mesh.NbPolyhedrons() print + +# Example of customization of dirtections of the grid axes + +# make a box with non-orthogonal edges +xDir = geompy.MakeVectorDXDYDZ( 1.0, 0.1, 0.0, "xDir" ) +yDir = geompy.MakeVectorDXDYDZ(-0.1, 1.0, 0.0, "yDir" ) +zDir = geompy.MakeVectorDXDYDZ( 0.2, 0.3, 1.0, "zDir" ) +face = geompy.MakePrismVecH( xDir, yDir, 1.0 ) +box = geompy.MakePrismVecH( face, zDir, 1.0, theName="box" ) + +spc = "0.1" # spacing + +# default axes +mesh = smesh.Mesh( box, "custom axes") +algo = mesh.BodyFitted() +algo.SetGrid( spc, spc, spc, 10000 ) +mesh.Compute() +print "Default axes" +print " nb hex:",mesh.NbHexas() + +# set axes using edges of the box +algo.SetAxesDirs( xDir, [-0.1,1,0], zDir ) +mesh.Compute() +print "Manual axes" +print " nb hex:",mesh.NbHexas() + +# set optimal orthogonal axes +algo.SetOptimalAxesDirs( isOrthogonal=True ) +mesh.Compute() +print "Optimal orthogonal axes" +print " nb hex:",mesh.NbHexas() + +# set optimal non-orthogonal axes +algo.SetOptimalAxesDirs( isOrthogonal=False ) +mesh.Compute() +print "Optimal non-orthogonal axes" +print " nb hex:",mesh.NbHexas() diff --git a/doc/salome/examples/defining_hypotheses_ex01.py b/doc/salome/examples/defining_hypotheses_ex01.py index 4bb75c56b..1d5d281c8 100644 --- a/doc/salome/examples/defining_hypotheses_ex01.py +++ b/doc/salome/examples/defining_hypotheses_ex01.py @@ -1,12 +1,11 @@ -# Arithmetic 1D +# Arithmetic 1D and Geometric Progression import salome salome.salome_init() -import GEOM + from salome.geom import geomBuilder geompy = geomBuilder.New(salome.myStudy) -import SMESH, SALOMEDS from salome.smesh import smeshBuilder smesh = smeshBuilder.New(salome.myStudy) @@ -21,12 +20,20 @@ hexa = smesh.Mesh(box, "Box : hexahedrical mesh") algo1D = hexa.Segment() # optionally reverse node distribution on certain edges -allEdges = geompy.SubShapeAllSortedIDs( box, geompy.ShapeType["EDGE"]) +allEdges = geompy.SubShapeAllSorted( box, geompy.ShapeType["EDGE"]) reversedEdges = [ allEdges[0], allEdges[4] ] # define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length algo1D.Arithmetic1D(1, 4, reversedEdges) +# define "Geometric Progression" hypothesis on one edge to cut this edge in segments with length increasing by 20% starting from 1 +gpAlgo = hexa.Segment( allEdges[1] ) +gpAlgo.GeometricProgression( 1, 1.2 ) + +# propagate distribution of nodes computed using "Geometric Progression" to parallel edges +gpAlgo.PropagationOfDistribution() + + # create a quadrangle 2D algorithm for faces hexa.Quadrangle() diff --git a/doc/salome/examples/defining_hypotheses_ex08.py b/doc/salome/examples/defining_hypotheses_ex08.py index 34fcbc377..3c877f3da 100644 --- a/doc/salome/examples/defining_hypotheses_ex08.py +++ b/doc/salome/examples/defining_hypotheses_ex08.py @@ -11,7 +11,8 @@ from salome.smesh import smeshBuilder smesh = smeshBuilder.New(salome.myStudy) # create a box -box = geompy.MakeBoxDXDYDZ(10., 10., 10.) +base = geompy.MakeSketcher("Sketcher:F 0 0:TT 10 0:TT 20 10:TT 0 10:WF", theName="F") +box = geompy.MakePrismDXDYDZ( base, 0,0,10 ) geompy.addToStudy(box, "Box") # get one edge of the box to put local hypothesis on @@ -20,7 +21,7 @@ EdgeX = geompy.GetEdgeNearPoint(box, p5) geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]") # create a hexahedral mesh on the box -hexa = smesh.Mesh(box, "Box : hexahedrical mesh") +hexa = smesh.Mesh(box, "Propagation of hypothesis") # set global algorithms and hypotheses algo1D = hexa.Segment() @@ -28,15 +29,37 @@ hexa.Quadrangle() hexa.Hexahedron() algo1D.NumberOfSegments(4) -# create a sub-mesh with local 1D hypothesis and propagation +# create a sub-mesh with local 1D hypothesis and "Propagation of 1D Hypothesis" algo_local = hexa.Segment(EdgeX) # define "Arithmetic1D" hypothesis to cut an edge in several segments with increasing length algo_local.Arithmetic1D(1, 4) -# define "Propagation" hypothesis that propagates all other 1D hypotheses -# from all edges on the opposite side of a face in case of quadrangular faces +# define "Propagation" hypothesis that propagates "Arithmetic1D" hypothesis +# from 'EdgeX' on opposite sides of all quadilateral faces algo_local.Propagation() -# compute the mesh +# compute the mesh which contains prisms hexa.Compute() + + +# create another mesh on the box +mesh = smesh.Mesh(box, "Propagation of distribution of nodes") + +# set global algorithms and hypotheses +algo1D = mesh.Segment() +mesh.Quadrangle() +mesh.Hexahedron() +algo1D.NumberOfSegments(4) + +# create a sub-mesh with local 1D hypothesis and "Propagation of Node Distribution" +algo_local = mesh.Segment(EdgeX) +algo_local.Arithmetic1D(1, 4) + +# define "Propagation Of Distribution" hypothesis that propagates +# distribution of nodes generated by "Arithmetic1D" hypothesis +# from 'EdgeX' on opposite sides of all quadilateral faces +algo_local.PropagationOfDistribution() + +# compute the mesh which contains hexahedra only +mesh.Compute() diff --git a/doc/salome/examples/defining_hypotheses_ex16.py b/doc/salome/examples/defining_hypotheses_ex16.py index 9125787b2..ce11e3e40 100644 --- a/doc/salome/examples/defining_hypotheses_ex16.py +++ b/doc/salome/examples/defining_hypotheses_ex16.py @@ -1,4 +1,4 @@ -# "Use Existing Elements" example +# "Import 2D Elements from Another Mesh" example import salome salome.salome_init() diff --git a/doc/salome/examples/testme.py b/doc/salome/examples/testme.py index 83aaeb11f..7fca21f06 100755 --- a/doc/salome/examples/testme.py +++ b/doc/salome/examples/testme.py @@ -1,9 +1,9 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/doc/salome/examples/use_existing_faces.py b/doc/salome/examples/use_existing_faces.py index 631316444..c4b95fdaf 100644 --- a/doc/salome/examples/use_existing_faces.py +++ b/doc/salome/examples/use_existing_faces.py @@ -1,4 +1,4 @@ -# Use existing faces algorithm +# Usage of "Use Faces to be Created Manually" algorithm import salome @@ -109,8 +109,8 @@ mesh.Compute() # compute 2D mesh mesh.Quadrangle() -mesh.UseExistingFaces(f1) # UseExistingFaces() allows using my2DMeshing() -mesh.UseExistingFaces(f2) +mesh.UseExistingFaces(f1) # UseExistingFaces() allows using my2DMeshing(); +mesh.UseExistingFaces(f2) # assign UseExistingFaces() BEFORE calling my2DMeshing()! my2DMeshing( f1 ) my2DMeshing( f2 ) assert mesh.Compute() diff --git a/doc/salome/gui/CMakeLists.txt b/doc/salome/gui/CMakeLists.txt index ae150c8a0..3347fdcc5 100755 --- a/doc/salome/gui/CMakeLists.txt +++ b/doc/salome/gui/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/doc/salome/gui/SMESH/CMakeLists.txt b/doc/salome/gui/SMESH/CMakeLists.txt index 7d8157bee..380fb6bbd 100644 --- a/doc/salome/gui/SMESH/CMakeLists.txt +++ b/doc/salome/gui/SMESH/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -30,7 +30,7 @@ SET(kernel_file "${KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py") SALOME_ACCUMULATE_ENVIRONMENT(SMESH_MeshersList NOCHECK ${DOC_SMESH_MeshersList}) -SET(_cmd_options ${smesh_file} -d -o tmp/smeshBuilder.py StdMeshers) +SET(_cmd_options ${smesh_file} -d -o tmp1/smeshBuilder.py StdMeshers) SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${PYTHON_EXECUTABLE}" "${_cmd_options}") ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp1 @@ -38,6 +38,7 @@ ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp1 COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp2/smeshBuilder.py ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smeshBuilder.py COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp2/smesh_algorithm.py ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smesh_algorithm.py COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp2/StdMeshersBuilder.py ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/StdMeshersBuilder.py + COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp2/smeshstudytools.py ${CMAKE_SOURCE_DIR}/src/SMESH_PY/smeshstudytools.py COMMAND ${_cmd} COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py COMMAND ${DOXYGEN_EXECUTABLE} doxyfile diff --git a/doc/salome/gui/SMESH/collect_mesh_methods.py b/doc/salome/gui/SMESH/collect_mesh_methods.py index 72fdb0382..6e2b7a481 100755 --- a/doc/salome/gui/SMESH/collect_mesh_methods.py +++ b/doc/salome/gui/SMESH/collect_mesh_methods.py @@ -1,11 +1,11 @@ #!/usr/bin/env python # -*- coding: iso-8859-1 -*- -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/doc/salome/gui/SMESH/doxyfile.in b/doc/salome/gui/SMESH/doxyfile.in index 5bbf12d85..e3b5ae87f 100755 --- a/doc/salome/gui/SMESH/doxyfile.in +++ b/doc/salome/gui/SMESH/doxyfile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/doc/salome/gui/SMESH/doxyfile_py.in b/doc/salome/gui/SMESH/doxyfile_py.in index 49a9c51fb..da7bdc731 100755 --- a/doc/salome/gui/SMESH/doxyfile_py.in +++ b/doc/salome/gui/SMESH/doxyfile_py.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -102,6 +102,7 @@ EXAMPLE_RECURSIVE = NO INPUT = tmp2/smeshBuilder.py \ tmp2/smesh_algorithm.py \ tmp2/StdMeshersBuilder.py \ + tmp2/smeshstudytools.py \ tmp1/smeshBuilder.py FILE_PATTERNS = IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images diff --git a/doc/salome/gui/SMESH/images/a-geometric1d.png b/doc/salome/gui/SMESH/images/a-geometric1d.png new file mode 100644 index 000000000..a60be94a4 Binary files /dev/null and b/doc/salome/gui/SMESH/images/a-geometric1d.png differ diff --git a/doc/salome/gui/SMESH/images/cartesian3D_hyp.png b/doc/salome/gui/SMESH/images/cartesian3D_hyp.png index b8373ed6d..c9a605fea 100644 Binary files a/doc/salome/gui/SMESH/images/cartesian3D_hyp.png and b/doc/salome/gui/SMESH/images/cartesian3D_hyp.png differ diff --git a/doc/salome/gui/SMESH/images/cartesian_implement_edge.png b/doc/salome/gui/SMESH/images/cartesian_implement_edge.png new file mode 100644 index 000000000..59ac9ba6f Binary files /dev/null and b/doc/salome/gui/SMESH/images/cartesian_implement_edge.png differ diff --git a/doc/salome/gui/SMESH/images/colors_size.png b/doc/salome/gui/SMESH/images/colors_size.png index 213652e79..0b1d3e566 100755 Binary files a/doc/salome/gui/SMESH/images/colors_size.png and b/doc/salome/gui/SMESH/images/colors_size.png differ diff --git a/doc/salome/gui/SMESH/images/createmesh-inv.png b/doc/salome/gui/SMESH/images/createmesh-inv.png old mode 100755 new mode 100644 index c7f7c31ed..2180d416a Binary files a/doc/salome/gui/SMESH/images/createmesh-inv.png and b/doc/salome/gui/SMESH/images/createmesh-inv.png differ diff --git a/doc/salome/gui/SMESH/images/duplicate01.png b/doc/salome/gui/SMESH/images/duplicate01.png index 02938fa41..f7acf9025 100644 Binary files a/doc/salome/gui/SMESH/images/duplicate01.png and b/doc/salome/gui/SMESH/images/duplicate01.png differ diff --git a/doc/salome/gui/SMESH/images/duplicate02.png b/doc/salome/gui/SMESH/images/duplicate02.png index 9653a3ea0..4bca64476 100644 Binary files a/doc/salome/gui/SMESH/images/duplicate02.png and b/doc/salome/gui/SMESH/images/duplicate02.png differ diff --git a/doc/salome/gui/SMESH/images/duplicate03.png b/doc/salome/gui/SMESH/images/duplicate03.png index 72b2a7a80..00c8c871f 100644 Binary files a/doc/salome/gui/SMESH/images/duplicate03.png and b/doc/salome/gui/SMESH/images/duplicate03.png differ diff --git a/doc/salome/gui/SMESH/images/duplicate04.png b/doc/salome/gui/SMESH/images/duplicate04.png new file mode 100644 index 000000000..70cb4adfb Binary files /dev/null and b/doc/salome/gui/SMESH/images/duplicate04.png differ diff --git a/doc/salome/gui/SMESH/images/hypo_quad_params_dialog.png b/doc/salome/gui/SMESH/images/hypo_quad_params_dialog.png index 3cd442a8d..62dc9f415 100644 Binary files a/doc/salome/gui/SMESH/images/hypo_quad_params_dialog.png and b/doc/salome/gui/SMESH/images/hypo_quad_params_dialog.png differ diff --git a/doc/salome/gui/SMESH/images/hypo_quad_params_dialog_enf.png b/doc/salome/gui/SMESH/images/hypo_quad_params_dialog_enf.png new file mode 100644 index 000000000..a3e7cfa39 Binary files /dev/null and b/doc/salome/gui/SMESH/images/hypo_quad_params_dialog_enf.png differ diff --git a/doc/salome/gui/SMESH/images/hypo_quad_params_dialog_vert.png b/doc/salome/gui/SMESH/images/hypo_quad_params_dialog_vert.png new file mode 100644 index 000000000..5c7585336 Binary files /dev/null and b/doc/salome/gui/SMESH/images/hypo_quad_params_dialog_vert.png differ diff --git a/doc/salome/gui/SMESH/images/hypo_quad_params_enfnodes_algo.png b/doc/salome/gui/SMESH/images/hypo_quad_params_enfnodes_algo.png new file mode 100755 index 000000000..adddf842c Binary files /dev/null and b/doc/salome/gui/SMESH/images/hypo_quad_params_enfnodes_algo.png differ diff --git a/doc/salome/gui/SMESH/images/meshtopass.png b/doc/salome/gui/SMESH/images/meshtopass.png deleted file mode 100755 index ebddaf448..000000000 Binary files a/doc/salome/gui/SMESH/images/meshtopass.png and /dev/null differ diff --git a/doc/salome/gui/SMESH/images/meshtopass1.png b/doc/salome/gui/SMESH/images/meshtopass1.png new file mode 100644 index 000000000..8ea8af795 Binary files /dev/null and b/doc/salome/gui/SMESH/images/meshtopass1.png differ diff --git a/doc/salome/gui/SMESH/images/meshtopass2.png b/doc/salome/gui/SMESH/images/meshtopass2.png new file mode 100644 index 000000000..b0bd28a89 Binary files /dev/null and b/doc/salome/gui/SMESH/images/meshtopass2.png differ diff --git a/doc/salome/gui/SMESH/images/pref22.png b/doc/salome/gui/SMESH/images/pref22.png index f6a7b5978..d557d2515 100755 Binary files a/doc/salome/gui/SMESH/images/pref22.png and b/doc/salome/gui/SMESH/images/pref22.png differ diff --git a/doc/salome/gui/SMESH/images/split_into_prisms.png b/doc/salome/gui/SMESH/images/split_into_prisms.png new file mode 100644 index 000000000..6b9f77a2d Binary files /dev/null and b/doc/salome/gui/SMESH/images/split_into_prisms.png differ diff --git a/doc/salome/gui/SMESH/images/split_into_tetra.png b/doc/salome/gui/SMESH/images/split_into_tetra.png index fce071e7d..a54f44529 100644 Binary files a/doc/salome/gui/SMESH/images/split_into_tetra.png and b/doc/salome/gui/SMESH/images/split_into_tetra.png differ diff --git a/doc/salome/gui/SMESH/images/viscous_layers_hyp.png b/doc/salome/gui/SMESH/images/viscous_layers_hyp.png index 9c9930317..717819138 100644 Binary files a/doc/salome/gui/SMESH/images/viscous_layers_hyp.png and b/doc/salome/gui/SMESH/images/viscous_layers_hyp.png differ diff --git a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc index 470fe0c4d..b992bc8e2 100644 --- a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc +++ b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc @@ -6,6 +6,7 @@
  • \ref adaptive_1d_anchor "Adaptive"
  • \ref arithmetic_1d_anchor "Arithmetic 1D"
  • +
  • \ref geometric_1d_anchor "Geometric Progression"
  • \ref average_length_anchor "Local Length"
  • \ref max_length_anchor "Max Size"
  • \ref deflection_1d_anchor "Deflection 1D"
  • @@ -55,7 +56,30 @@ picking them in the 3D viewer or by selecting the edges or groups of edges in th \image html b-ithmetic1d.png "Arithmetic 1D hypothesis - the size of mesh elements gradually increases" See Also a sample TUI Script of a -\ref tui_1d_arithmetic "Defining Arithmetic 1D hypothesis" operation. +\ref tui_1d_arithmetic "Defining Arithmetic 1D and Geometric Progression hypothesis" operation. + +
    +\anchor geometric_1d_anchor +

    Geometric Progression hypothesis

    + +Geometric Progression hypothesis allows to split edges into +segments with a length that changes in geometric progression (Lk = +Lk-1 * d) beginning from a given starting length and with a given +common ratio. + +The direction of the splitting is defined by the orientation of the +underlying geometrical edge. "Reverse Edges" list box allows to +specify the edges for which the splitting should be made in the +direction opposing to their orientation. This list box is enabled only +if the geometry object is selected for the meshing. In this case the +user can select edges to be reversed either directly picking them in +the 3D viewer or by selecting the edges or groups of edges in the +Object Browser. + +\image html a-geometric1d.png + +See Also a sample TUI Script of a +\ref tui_1d_arithmetic "Defining Arithmetic 1D and Geometric Progression hypothesis" operation.
    \anchor deflection_1d_anchor diff --git a/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc b/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc index 38efc810c..e019c8b87 100644 --- a/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc +++ b/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc @@ -38,32 +38,12 @@ of a given face. \image html hypo_quad_params_dialog.png "Quadrangle parameters creation/edition dialog" -Quadrangle parameters is a hypothesis for Quadrangle (Mapping). +Quadrangle parameters is a hypothesis for Quadrangle (Mapping) algorithm. -Base vertex parameter allows using Quadrangle (Mapping) -algorithm for meshing of trilateral faces. In this case it is -necessary to select the vertex, which will be used as the fourth edge -(degenerated). - -\image html hypo_quad_params_1.png "A face built from 3 edges" - -\image html hypo_quad_params_res.png "The resulting mesh" - -This parameter can be also used to mesh a segment of a circular face. -Please, consider that there is a limitation on the selection of the -vertex for the faces built with the angle > 180 degrees (see the picture). - -\image html hypo_quad_params_2.png "3/4 of a circular face" - -In this case, selection of a wrong vertex for the Base vertex -parameter will generate a wrong mesh. The picture below -shows the good (left) and the bad (right) results of meshing. - -\image html hypo_quad_params_res_2.png "The resulting meshes" - -Type parameter is used on faces with a different number of -segments on opposite sides to define the algorithm of transition -between them. The following types are available: +Transition tab is used to define the algorithm of transition +between opposite sides of faces with a different number of +segments on opposite sides. The following types of transition +algorithms are available: - Standard is the default case, when both triangles and quadrangles are possible in the transition area along the finer meshed sides. @@ -92,7 +72,65 @@ between them. The following types are available: to Nmin segments is log3( Nmax / Nmin ). The number of face rows is equal to the number of segments on each of equally discretized sides. - \image html reduce_three_to_one.png "The fastest transition pattern: 3 to 1" + +\image html reduce_three_to_one.png "The fastest transition pattern: 3 to 1" + +Base vertex tab allows using Quadrangle (Mapping) +algorithm for meshing of trilateral faces. In this case it is +necessary to select the vertex, which will be used as the fourth edge +(degenerated). + +\image html hypo_quad_params_dialog_vert.png "Base Vertex tab of Quadrangle parameters creation/edition dialog" + +\image html hypo_quad_params_1.png "A face built from 3 edges" + +\image html hypo_quad_params_res.png "The resulting mesh" + +This parameter can be also used to mesh a segment of a circular face. +Please, consider that there is a limitation on the selection of the +vertex for the faces built with the angle > 180 degrees (see the picture). + +\image html hypo_quad_params_2.png "3/4 of a circular face" + +In this case, selection of a wrong vertex for the Base vertex +parameter will generate a wrong mesh. The picture below +shows the good (left) and the bad (right) results of meshing. + +\image html hypo_quad_params_res_2.png "The resulting meshes" + +\image html hypo_quad_params_dialog_enf.png "Enforced nodes tab of Quadrangle parameters creation/edition dialog" + +Enforced nodes tab allows for defining points where the +algorithm should create nodes. There are two ways to define positions +of the enforced nodes. +
      +
    • \b Vertices group allows to set up shapes whose vertices will + define positions of the enforced nodes. Only vertices successfully + projected to the meshed face and located close enough to the + meshed face will be used to create the enforced nodes.
    • +
    • \b Points group allows to explicitly define coordinates of + points used to create the enforced nodes. Only points successfully + projected to the meshed face and located close enough to the + meshed face will be used to create the enforced nodes.
    • +
    +Algorithm of creation of the enforced nodes is following. + +\image html hypo_quad_params_enfnodes_algo.png "Steps of the algorithm of creation of the enforced nodes" +
      +
    1. Left image: Positions of nodes are computed without taking into + account the enforced vertex (yellow point).
    2. +
    3. Middle image: A node closest to the enforced vertex is + detected. Extreme nodes of the row and column of the detected node + are used to create virtual edges (yellow lines) ending at the + enforced vertex.
    4. +
    5. Right image: The meshed face is thus divided by the virtual + edges into four quadrilateral sub-domains each of which is meshed + as usually: the nodes of the row and column of detected node are + moved to the virtual edges and the quadrilateral elements are + constructed. +
    +If there are several enforced vertices, the algorithm is applied +recursively to the formed sub-domains. See Also a sample TUI Script of a \ref tui_quadrangle_parameters "Quadrangle Parameters" hypothesis. diff --git a/doc/salome/gui/SMESH/input/about_hypo.doc b/doc/salome/gui/SMESH/input/about_hypo.doc index 09768cc7c..65d5c7ad0 100644 --- a/doc/salome/gui/SMESH/input/about_hypo.doc +++ b/doc/salome/gui/SMESH/input/about_hypo.doc @@ -20,6 +20,7 @@ In \b MESH there are the following Basic Hypotheses:
  • \ref max_length_anchor "Max Size"
  • \ref adaptive_1d_anchor "Adaptive"
  • \ref arithmetic_1d_anchor "Arithmetic 1D"
  • +
  • \ref geometric_1d_anchor "Geometric 1D"
  • \ref start_and_end_length_anchor "Start and end length"
  • \ref deflection_1d_anchor "Deflection 1D"
  • \ref automatic_length_anchor "Automatic Length"
  • @@ -41,6 +42,7 @@ There also exist with other hypotheses:
    • \ref propagation_anchor "Propagation of 1D Hypothesis on opposite edges"
    • +
    • \ref propagofdistribution_anchor "Propagation of Node Distribution on Opposite Edges"
    • \ref viscous_layers_anchor "Viscous layers"
    • \ref quadratic_mesh_anchor "Quadratic mesh"
    • \ref non_conform_allowed_anchor "Non conform mesh allowed"
    • diff --git a/doc/salome/gui/SMESH/input/about_meshes.doc b/doc/salome/gui/SMESH/input/about_meshes.doc index 97d14a3ec..565b3a48b 100644 --- a/doc/salome/gui/SMESH/input/about_meshes.doc +++ b/doc/salome/gui/SMESH/input/about_meshes.doc @@ -5,15 +5,12 @@ \n \b MESH represents a discretization of a geometrical CAD model into a set of entities with a simple topology. -Meshes are stored in DAT, MED, UNV, STL, CGNS, GMF and SAUVE formats and can be -\subpage importing_exporting_meshes_page "imported from and exported to" - the file in these formats. - It is possible to \subpage constructing_meshes_page "construct meshes" on the basis of geometrical shapes produced in the GEOM module. It is also possible to \subpage constructing_submeshes_page "construct mesh on a part of the geometrical object", -for example, a face, with different meshing parameters than the whole mesh. +for example, a face, with different meshing parameters or using +another meshing algorithm than the whole mesh. Several created meshes can be \subpage building_compounds_page "combined into another mesh". @@ -26,6 +23,10 @@ depending on the changed parameters will be re-computed. Meshes can be edited using the MESH functions destined for \ref modifying_meshes_page "modification" of generated meshes. +Meshes are stored in DAT, MED, UNV, STL, CGNS, GMF and SAUVE formats and can be +\subpage importing_exporting_meshes_page "imported from and exported to" + the file in these formats. + The \b topology of a mesh is described by the relationships between its entities including: diff --git a/doc/salome/gui/SMESH/input/additional_hypo.doc b/doc/salome/gui/SMESH/input/additional_hypo.doc index 938c7870e..adccc49aa 100644 --- a/doc/salome/gui/SMESH/input/additional_hypo.doc +++ b/doc/salome/gui/SMESH/input/additional_hypo.doc @@ -38,6 +38,19 @@ has been locally defined on the opposite edge.
      See Also a sample TUI Script of a \ref tui_propagation "Propagation hypothesis" operation +\anchor propagofdistribution_anchor +

      Propagation of Node Distribution on Opposite Edges

      + +Propagation of Node Distribution on Opposite Edges allows to propagate +distribution of nodes onto an opposite edge. If a local hypothesis and +propagation are defined on an edge of a quadrangular face, the +opposite edge will have the same number of nodes and the same +relations between segment lengths, unless another hypothesis +has been locally defined on the opposite edge. + +
      See Also a sample TUI Script of a +\ref tui_propagation "Propagation hypothesis" operation + \anchor quadrangle_preference_anchor

      Quadrangle Preference

      @@ -68,29 +81,29 @@ computations.
    • Number of layers - defines the number of element layers.
    • Stretch factor - defines the growth factor of element height from the mesh boundary inwards.
    • -
    • Specified Edges are - defines how the shapes specified by +
    • Specified Faces/Edges are - defines how the shapes specified by the next parameter are used. -
    • Faces without layers and Edges with/without layers - - in the 3D case it defines geometrical faces on which element layers - should not be constructed; in the 2D case it defines geometrical edges - on which element layers either should be or should not be - constructed, depending on the value of the previous parameter - (Specified Edges are). +
    • Faces/Edges with/without layers - + defines geometrical faces or edges on which element layers + either should be or should not be constructed, depending on the + value of the previous parameter (Specified Faces/Edges are). + Faces (or edges) can be selected either in the Object Browser or in + the VTK Viewer. \note A mesh shown in the 3D Viewer can prevent selection of faces and edges, just hide the mesh to avoid this. To avoid a long wait when a geometry with many faces (or edges) is displayed, the number of faces (edges) shown at a time is limited by the value of "Sub-shapes preview chunk size" preference (in Preferences/Mesh/General tab).
      - Whatever shapes are specified by this - parameter, the element layers are not constructed on geometrical - faces shared by several solids in 3D case and edges shared by - several faces in 2D case. In other words the element layers can be - constructed on boundary faces and edges, and are not constructed on - internal faces and edges. There is an exception to this rule in 2D - case: if "Viscous Layers 2D" hypothesis is assigned to a sub-mesh, - the element layers can be constructed on boundary edges of the shape - of this sub-mesh. + If faces/edges without layers are specified, the element layers are + not constructed on geometrical faces shared by several solids in 3D + case and edges shared by several faces in 2D case. In other words, + in this mode the element layers can be constructed on boundary faces + and edges only, and are not constructed on internal faces and + edges. There is an exception to this rule: if a hypothesis is + assigned to a sub-mesh, the element layers can be constructed on + boundary faces/edges of the shape of this sub-mesh, at same time + possibly being internal faces/edges within the whole model. \image html viscous_layers_on_submesh.png 2D viscous layers constructed on boundary edges of a sub-mesh on a disk face.
    • @@ -101,5 +114,4 @@ computations.
      See also a sample TUI script of a \ref tui_viscous_layers "Viscous layers construction". - */ diff --git a/doc/salome/gui/SMESH/input/basic_meshing_algos.doc b/doc/salome/gui/SMESH/input/basic_meshing_algos.doc index 142ca62f4..e76863e8a 100644 --- a/doc/salome/gui/SMESH/input/basic_meshing_algos.doc +++ b/doc/salome/gui/SMESH/input/basic_meshing_algos.doc @@ -59,8 +59,8 @@ There is also a number of more specific algorithms:
    • \subpage prism_3d_algo_page "for meshing prismatic shapes"
    • \subpage radial_quadrangle_1D2D_algo_page "for meshing special 2d faces (circles and part of circles)"
    -\ref use_existing_anchor "Use existing edges" and -\ref use_existing_anchor "Use existing faces" algorithms can be +\ref use_existing_anchor "Use Edges to be Created Manually" and +\ref use_existing_anchor "Use Faces to be Created Manually" algorithms can be used to create a 1D or a 2D mesh in a python script. \ref constructing_meshes_page "Constructing meshes" page describes in diff --git a/doc/salome/gui/SMESH/input/cartesian_algo.doc b/doc/salome/gui/SMESH/input/cartesian_algo.doc index 3240150c7..7bf830690 100644 --- a/doc/salome/gui/SMESH/input/cartesian_algo.doc +++ b/doc/salome/gui/SMESH/input/cartesian_algo.doc @@ -31,7 +31,7 @@ nodes are inside and some outside. To apply this algorithm when you define your mesh, select Body Fitting in the list of 3D algorithms and click "Add Hypothesis" button and "Body Fitting Parameters"" menu - item. Dialog of Body Fitting Parameters +item. Dialog of Body Fitting Parameters hypothesis will appear.
    @@ -42,34 +42,64 @@ To apply this algorithm when you define your mesh, select Body This dialog allows to define
      -
    • \b Name of the algorithm
    • -
    • Minimal size of a cell truncated by the geometry boundary. If the - size of a truncated grid cell is \b Threshold times less than a - initial cell size, then a mesh element is not created.
    • -
    • Cartesian structured grid. Each grid axis is defined - individually. Definition mode chooses a way of grid - definition:
        -
      • You can specify the \b Coordinates of grid nodes. \b Insert button - inserts a node at distance \b Step (negative or positive) from a - selected node. \b Delete button removes a selected node. Double - click on a coordinate in the list enables its edition. A grid - defined by \b Coordinates should enclose the geometry, else the - algorithm will fail.
      • -
      • You can define the \b Spacing of a grid as an algebraic formula - f(t) where \a t is a position along a grid axis - normalized at [0.0,1.0]. The whole range of geometry can be - divided into sub-ranges with their own spacing formulas to apply; +
      • \b Name of the algorithm.
      • +
      • Minimal size of a cell truncated by the geometry boundary. If the + size of a truncated grid cell is \b Threshold times less than a + initial cell size, then a mesh element is not created.
      • +
      • Implement Edges check-box activates incorporation of + geometrical edges in the mesh. +\image html cartesian_implement_edge.png "'Implement Edges' switched off (left) and on (right)" +
      • Cartesian structured grid. Location of nodes along each grid axis + is defined individually. Definition mode chooses a way of + grid definition: +
          +
        • You can specify the \b Coordinates of grid nodes. \b Insert button + inserts a node at distance \b Step (negative or positive) from a + selected node. \b Delete button removes a selected node. Double + click on a coordinate in the list enables its edition. + \b Note that node coordinates are measured along directions of + axes that can differ from the directions of the Global Coordinate + System.
        • +
        • You can define the \b Spacing of a grid as an algebraic formula + f(t) where \a t is a position along a grid axis + normalized at [0.0,1.0]. The whole range of geometry can be + divided into sub-ranges with their own spacing formulas to apply; \a t varies between 0.0 and 1.0 within each sub-range. \b Insert button - divides a selected range into two ones. \b Delete button adds the - selected sub-range to the previous one. Double click on a range in - the list enables edition of its right boundary. Double click on a - function in the list enables its edition. -
        -
      • + divides a selected range into two ones. \b Delete button adds the + selected sub-range to the previous one. Double click on a range in + the list enables edition of its right boundary. Double click on a + function in the list enables its edition. +
      +
    • +
    • Coordinates of a Fixed Point. They allow to exactly + locate a grid node in a direction defined by spacing. If all the three + directions are defined by spacing, then there will be a mesh node at + the Fixed Point. If two directions are defined by spacing, + then there will be at least a link between mesh nodes passing through + the Fixed Point. If only one direction is defined by spacing, + then there will be at least an element facet passing through + the Fixed Point. If no directions are defined by spacing, + Fixed Point is disabled.
    • +
    • Directions of Axes. You can set up almost any + directions of grid axes that can help in generation of as many as + possible hexahedral elements. +
        +
      • Orthogonal Axes check-box, if activated, keeps the + axes orthogonal during their modification.
      • +
      • Selection buttons enable snapping corresponding axes to + direction of a geometrical edge selected in the Object + Browser. Edge direction is defined by coordinates of its end + points.
      • +
      • Optimal Axes button runs an algorithm that tries to + set the axes so that a number of generated hexahedra to be + maximal.
      • +
      • Reset button returns the axes in a default position + parallel to the axes of the Global Coordinate System.
      • +

    -See Also a sample TUI Script of a -\ref tui_cartesian_algo "Usage of Body Fitting algorithm". +See Also a sample TUI Script of a +\ref tui_cartesian_algo "Usage of Body Fitting algorithm". */ diff --git a/doc/salome/gui/SMESH/input/colors_size.doc b/doc/salome/gui/SMESH/input/colors_size.doc index e777e84a1..c8be2278e 100644 --- a/doc/salome/gui/SMESH/input/colors_size.doc +++ b/doc/salome/gui/SMESH/input/colors_size.doc @@ -41,6 +41,7 @@ shown. - \b Balls: - \b Color - color of discrete ball elements. - \b Size - size of discrete ball elements. + - \b Scale - scale factor of discrete ball elements. - Orientation vectors: - \b Color - color of orientation vectors. - \b Scale - size of orientation vectors. diff --git a/doc/salome/gui/SMESH/input/constructing_meshes.doc b/doc/salome/gui/SMESH/input/constructing_meshes.doc index 0671f8909..b6c687bb0 100644 --- a/doc/salome/gui/SMESH/input/constructing_meshes.doc +++ b/doc/salome/gui/SMESH/input/constructing_meshes.doc @@ -33,14 +33,15 @@ written in Python.
  • Apply \subpage basic_meshing_algos_page "meshing algorithms" and - \subpage about_hypo_page "hypotheses" which will be used at computation of + \subpage about_hypo_page "hypotheses" which will be used to compute this mesh. "Create mesh" dialog box contains several tab pages titled \b 3D, \b 2D, \b 1D and \b 0D. The title of each page reflects the dimension of the CAD model (geometry) the algorithms listed on - this page affect. For example, \b 3D page lists the algorithms - that affect 3D geometrical objects (solids). + this page affect and the maximal dimension of elements the algorithms + generate. For example, \b 3D page lists the algorithms that affect + 3D geometrical objects (solids). \note - Some page(s) can be disabled if the source geometrical @@ -86,9 +87,24 @@ written in Python. "Edit Hypothesis" button - Most standard 2D and 3D algorithms can work without hypotheses - using some default parameters. The use of additional hypotheses - is optional (i.e. you may leave "None" in this box). + Most 2D and 3D algorithms can work without hypotheses using some + default meshing parameters. Some algorithms does not require any + hypothesis. After selection of an algorithm "Hypothesis" field of + the dialog can contain: +
      +
    • \ if the algorithm can work using default + parameters.
    • +
    • \ if the algorithm requires a hypothesis defining + its parameters.
    • +
    • Nothing if the algorithm has no parameters to tune.
    • +
    + After selection of an algorithm "Add. Hypothesis" field of + the dialog can contain: +
      +
    • \ if the algorithm can be additionally tuned + using an additional hypothesis.
    • +
    • Nothing if the algorithm has no additional parameters to tune.
    • +
    Proceed in the same way with 2D and 1D Algorithms and Hypotheses that will be used to mesh faces and edges of your geometry. (Note @@ -331,26 +347,29 @@ By default, the information box is always shown after mesh computation operation

    \anchor use_existing_anchor -

    "Use existing edges" and "Use existing faces" algorithms

    +

    "Use Edges to be Created Manually" and "Use Faces to be Created Manually" algorithms

    It is possible to create a 1D or a 2D mesh in a python script (using AddNode, AddEdge and AddFace commands) and then use such sub-meshes in the construction of a 2D or a 3D mesh. For -this, there exist two algorithms: Use existing edges and Use - existing faces. -For example, you want to use standard algorithms to generate 1D and 3D +this, there exist two algorithms: Use Edges to be Created +Manually and Use Faces to be Created Manually. +Imagine, you want to use standard algorithms to generate 1D and 3D meshes and to create 2D mesh by your python code. Then you
    1. create a mesh object, assign a 1D algorithm,
    2. invoke \b Compute command, which computes a 1D mesh,
    3. -
    4. assign Use existing faces and a 3D algorithm,
    5. +
    6. assign Use Faces to be Created Manually and a 3D algorithm,
    7. run your python code, which creates a 2D mesh,
    8. invoke \b Compute command, which computes a 3D mesh.
    +\warning Use Edges to be Created Manually and Use Faces to +be Created Manually algorithms should be assigned _before_ +mesh generation by the Python code. Consider trying a sample script demonstrating the usage of -\ref tui_use_existing_faces "Use existing faces" algorithm for -construction of a 2D mesh using Python commands. +\ref tui_use_existing_faces "Use Faces to be Created Manually" +algorithm for construction of a 2D mesh using Python commands. \image html use_existing_face_sample_mesh.png Mesh computed by \ref tui_use_existing_faces "the sample script" diff --git a/doc/salome/gui/SMESH/input/double_nodes_page.doc b/doc/salome/gui/SMESH/input/double_nodes_page.doc index 817a7e40a..c86f0bdc1 100644 --- a/doc/salome/gui/SMESH/input/double_nodes_page.doc +++ b/doc/salome/gui/SMESH/input/double_nodes_page.doc @@ -4,7 +4,7 @@ \n This operation allows duplicating mesh nodes or/and elements, which can be useful to emulate a crack in the model. -Duplication consists in creation of mesh element "equal" to existing ones. +Duplication consists in creation of mesh elements "equal" to existing ones. To duplicate nodes or/and elements:
      @@ -14,7 +14,7 @@ Duplication consists in creation of mesh element "equal" to existing ones.
      \image html duplicate_nodes.png "Duplicate Nodes or/and Elements button" -
    1. Check in the dialog box one of three radio buttons corresponding to +
    2. Check in the dialog box one of four radio buttons corresponding to the type of duplication operation you would like to perform.
    3. Fill the other fields available in the dialog box (depending on the chosen operation mode).
    4. @@ -22,11 +22,12 @@ Duplication consists in creation of mesh element "equal" to existing ones. operation of duplication.
    -\n "Duplicate Nodes or/and Elements" dialog has three working modes: +\n "Duplicate Nodes or/and Elements" dialog has four working modes:
    • \ref mode_without_elem_anchor "Duplicate nodes only"
    • \ref mode_with_elem_anchor "Duplicate nodes and border elements"
    • \ref mode_elem_only_anchor "Duplicate elements only"
    • +
    • \ref mode_group_boundary_anchor "Duplicate nodes on group boundaries"

    @@ -103,12 +104,11 @@ located at the "crack" (if any) are cloned automatically.

    Duplicate elements only

    This mode duplicates the given elements, i.e. creates new elements with the same nodes as the given elements. -
    - \image html duplicate03.png +Parameters to be defined in this mode:
    • Group of elements to duplicate (mandatory): these elements will be duplicated.
    • @@ -118,6 +118,38 @@ This mode duplicates the given elements, i.e. creates new elements with the same "DoubleElements".
    +
    +\anchor mode_group_boundary_anchor +

    Duplicate nodes on group boundaries

    + +This mode duplicates nodes located on boundaries between given groups of +volumes. If required, flat elements are created on the duplicated +nodes: a triangular facet shared by two volumes of two groups generates +a flat prism, a quadrangular facet generates a flat hexahedron. +
    +The created flat volumes are stored in groups. These groups are named +according to the position of the group in the list of groups: group +"j_n_p" is a group of flat elements that are built between the group \#n +and the group \#p in the group list. All the flat elements are gathered +into the group named "joints3D". The flat element of the multiple +junctions between the simple junction are stored in a group named +"jointsMultiples". + +
    + +\image html duplicate04.png + +Parameters to be defined in this mode: +
      +
    • Groups of volumes (mandatory): list of volume + groups. These groups should be disjoint, i.e. should not share volumes.
    • +
    • Create joint elements : if checked - the flat elements are created.
    • +
    • On all boundaries : if checked - then the volumes not + included into the Groups of volumes are considered as another given + group. And thus nodes on boundary between Groups of volumes and the + rest mesh are also duplicated.
    • +
    +
    See Also a sample TUI Script of a \ref tui_duplicate_nodes "Duplicate nodes or/and elements" operation. diff --git a/doc/salome/gui/SMESH/input/index.doc b/doc/salome/gui/SMESH/input/index.doc index 9182f97be..a4c2a66ab 100644 --- a/doc/salome/gui/SMESH/input/index.doc +++ b/doc/salome/gui/SMESH/input/index.doc @@ -6,9 +6,9 @@ \n \b MESH module of SALOME is destined for:
      -
    • \ref importing_exporting_meshes_page "import and export of meshes in various formats";
    • \subpage about_meshes_page "meshing geometrical models" previously created or imported by the Geometry component;
    • +
    • \ref importing_exporting_meshes_page "import and export of meshes in various formats";
    • \subpage viewing_meshes_overview_page "viewing created meshes" in the VTK viewer;
    • \subpage grouping_elements_page "creating groups of mesh elements";
    • @@ -30,8 +30,6 @@ Also, there is a possibility to \subpage arranging_study_objects_page "re-arrang Almost all mesh module functionalities are accessible via \subpage smeshpy_interface_page "Mesh module Python interface". -Other functions are available in salome.smesh python package. - \image html image7.jpg "Example of MESH module usage for engineering tasks" */ diff --git a/doc/salome/gui/SMESH/input/mesh_preferences.doc b/doc/salome/gui/SMESH/input/mesh_preferences.doc index 02574d07d..e0374fd4c 100644 --- a/doc/salome/gui/SMESH/input/mesh_preferences.doc +++ b/doc/salome/gui/SMESH/input/mesh_preferences.doc @@ -159,6 +159,8 @@ later sessions with this module. - Size of 0D elements - specifies default size of 0D elements. - Size of ball elements - specifies default size of discrete elements (balls). + - Scale factor of ball elements - specifies default scale factor of discrete + elements (balls). - Line width - allows to define the width of 1D elements (edges). - Outline width - allows to define the width of borders of 2D and 3D elements (shown in the Shading mode). diff --git a/doc/salome/gui/SMESH/input/mesh_through_point.doc b/doc/salome/gui/SMESH/input/mesh_through_point.doc index 5f4166b38..958a662eb 100644 --- a/doc/salome/gui/SMESH/input/mesh_through_point.doc +++ b/doc/salome/gui/SMESH/input/mesh_through_point.doc @@ -14,17 +14,18 @@ click "Move Node" button in the toolbar. \image html image67.png
      "Move Node" button
      -The following dialog box shall appear: +One of the following dialogs will appear: -\image html meshtopass.png +\image html meshtopass1.png "manual method of selecting node" +\image html meshtopass2.png "automatic method of selecting node" +
    • Specify the way of selection of the node: manually (first radio button) or automatically (second radio button).
    • +
    • If the manual method selected, select the necessary node (X, Y, Z fields show the original coordinates of the node to move) or set the ID node.
    • Enter the coordinates of the destination point.
    • -
    • Check in Find closest to destination option or -select the necessary node manually (X, Y, Z, dX, dY, dZ fields show the original coordinates and displacement of the node to move). -\b Preview check-box shows the operation results.
    • -
    • Update Destination button is activated when Find closest to destination option is unchecked. Click Update Destination button to update the coordinates of the destination point.
    • -
    • Click the \b Apply or Apply and Close button.
    • +
    • Click Update Destination button to update the coordinates of the destination point.
    • +
    • Activate \b Preview checkbox to show the result of move in the viewer
    • +
    • Click the \b Apply or Apply and Close button to confirm the operation.
    • \image html moving_nodes1.png "The initial mesh" diff --git a/doc/salome/gui/SMESH/input/modifying_meshes.doc b/doc/salome/gui/SMESH/input/modifying_meshes.doc index b7b7e2e64..d32e56a48 100644 --- a/doc/salome/gui/SMESH/input/modifying_meshes.doc +++ b/doc/salome/gui/SMESH/input/modifying_meshes.doc @@ -39,7 +39,7 @@ with consequent transformation of all adjacent elements and edges. of the selected elements.
    • \subpage reorient_faces_page "Reorient faces by vector".
    • \subpage cutting_quadrangles_page "Cut a quadrangle" into two triangles.
    • -
    • \subpage split_to_tetra_page "Split" volumic elements into tetrahedra.
    • +
    • \subpage split_to_tetra_page "Split" volumic elements into tetrahedra or prisms.
    • \subpage smoothing_page "Smooth" elements, reducung distortions in them by adjusting the locations of element corners.
    • Create an \subpage extrusion_page "extrusion" along a vector.
    • diff --git a/doc/salome/gui/SMESH/input/smeshpy_interface.doc b/doc/salome/gui/SMESH/input/smeshpy_interface.doc index c690fb7ef..df7e15967 100644 --- a/doc/salome/gui/SMESH/input/smeshpy_interface.doc +++ b/doc/salome/gui/SMESH/input/smeshpy_interface.doc @@ -15,9 +15,24 @@ in the \ref smeshBuilder and \ref StdMeshersBuilder Python packages. \n You may have to modify your scripts generated with SALOME 6 or older versions. \n Please see \ref smesh_migration_page +The SMESH python package contains helper functions to manipulate mesh elements and +interact with these elements. + +Note that these functions either encapsulate the python programming interface of SMESH core +(the CORBA or SWIG interface for example) or extend existing utilities as the smesh.py module. + +The functions are distributed in the python package \b salome.smesh. + +\note +The main package \b salome contains other sub-packages that are distributed with the other +SALOME modules. For example, the KERNEL module provides the python package \b salome.kernel +and GEOM the package \b salome.geom. + Class \ref smeshBuilder.smeshBuilder "smeshBuilder" provides an interface to create and handle meshes. It can be used to create an empty mesh or to import mesh from the data file. +Class \ref smeshstudytools.SMeshStudyTools "SMeshStudyTools" provides several methods to manipulate mesh objects in Salome study. + As soon as mesh is created, it is possible to manage it via its own methods, described in class \ref smeshBuilder.Mesh "Mesh" documentation. diff --git a/doc/salome/gui/SMESH/input/split_to_tetra.doc b/doc/salome/gui/SMESH/input/split_to_tetra.doc index 325c30c11..eb7fe0f26 100644 --- a/doc/salome/gui/SMESH/input/split_to_tetra.doc +++ b/doc/salome/gui/SMESH/input/split_to_tetra.doc @@ -1,53 +1,86 @@ /*! -\page split_to_tetra_page Splitting volumes into tetrahedra +\page split_to_tetra_page Splitting volumes -\n This operation allows to split volumic elements into tetrahedra. -2D mesh is modified accordingly. +\n This operation allows to split either any volumic elements into +tetrahedra or hexahedra into prisms. 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. +
      4. Display a mesh, a sub-mesh or a group in the 3D viewer.
      5. +
      6. In the \b Modification menu select the Split Volumes item or +click "Split Volumes" button in the toolbar. \image html split_into_tetra_icon.png -
        "Split into Tetrahedra" button
        +
        "Split Volumes" button
        The following dialog box will appear: \image html split_into_tetra.png -\par +
        +Target element type group of radio-buttons allows to select +a type of operation. If \b Tetrahedron button is checked, then the +operation will split volumes of any type into tetrahedra. +If \b Prism button is checked, then the operation will split hexahedra +into prisms, and the dialog will look as follows: + +\image html split_into_prisms.png +
          -
        • 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 the -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.
        • +
        • The main list contains list of volumes to split. 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 the + 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.
        • + volumes of the currently selected mesh.
          -
        • \b Split hexahedron +
        • Split hexahedron group allows to specify a method of + splitting hexahedra.
            -
          • Into 5 tetrahedra, Into 6 tetrahedra and Into 24 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 the 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.
          • -
          - +
        • Into N tetrahedra/prisms allows to specify the number of + tetrahedra or prisms 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 the 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.
        • +
        • Facet to split group allows to specify a side (facet) of a + hexahedron to split into triangles when splitting into prisms. + The facet to split is defined by specifying a point and a direction + close to normal of the facet. The operation finds a hexahedron most + close to the specified point and splits a facet whose normal is most + close to the specified direction. Then the splitting is propagated + from that hexahedron to all adjacent hexahedra. +
            +
          • Hexa location allows to specify a start + point by which a first split hexahedron is found. + Selection button switches to selection of the element whose + barycenter will be used the start point and whose direction will be + used as a normal to facet to split into triangles. To return to + selection of volumes to split it is necessary to switch this button + off.
          • +
          • Facet normal allows to specify a direction of the + normal to hexahedron facet to split into triangles.
          • +
          +
        • All domains - if it is off the operation stops as all + hehexedra adjacent to the start hexahedron are split into + prisms. Else the operation tries to continue splitting starting from + another hexahedron closest to the Hexa location.
        • +
        -
      7. Select from a set of fields allows to choose a submesh or an -existing group whose elements will be automatically added to the -list.
      8. +
      9. Select from a set of fields allows to choose a sub-mesh or an + existing group whose elements will be added to the list as you ckick + \b Add button.
  • Click the \b Apply or Apply and Close button to confirm the operation.
  • diff --git a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc index 333017d77..c19afd1b9 100644 --- a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc +++ b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc @@ -9,6 +9,7 @@ This page provides example codes of \ref tui_defining_meshing_algos
    • \ref tui_1d_adaptive "Adaptive 1D" hypothesis
    • \ref tui_1d_arithmetic "Arithmetic 1D" hypothesis
    • +
    • \ref tui_1d_arithmetic "Geometric Progression" hypothesis
    • \ref tui_deflection_1d "Deflection 1D and Number of Segments" hypotheses
    • \ref tui_start_and_end_length "Start and End Length" hypotheses
    • \ref tui_average_length "Local Length"
    • @@ -36,7 +37,7 @@ This page provides example codes of \ref tui_defining_meshing_algos
    • \ref tui_quadrangle_parameters "Quadrangle Parameters" hypothesis
    -
  • \ref tui_import "Use Existing Elements" algorithm
  • +
  • \ref tui_import "Import 1D-2D Elements from Another Mesh" algorithm

@@ -44,7 +45,7 @@ This page provides example codes of \ref tui_defining_meshing_algos
\anchor tui_1d_arithmetic -

Arithmetic 1D

+

Arithmetic 1D and Geometric Progression

\tui_script{defining_hypotheses_ex01.py}
@@ -123,7 +124,7 @@ This page provides example codes of \ref tui_defining_meshing_algos \tui_script{defining_hypotheses_ex15.py} \anchor tui_import -

"Use Existing Elements" example

+

"Import 1D-2D Elements from Another Mesh" example

\tui_script{defining_hypotheses_ex16.py} \anchor tui_viscous_layers diff --git a/doc/salome/gui/SMESH/input/tui_use_existing_faces.doc b/doc/salome/gui/SMESH/input/tui_use_existing_faces.doc index ddc56cb83..03928c38b 100644 --- a/doc/salome/gui/SMESH/input/tui_use_existing_faces.doc +++ b/doc/salome/gui/SMESH/input/tui_use_existing_faces.doc @@ -1,9 +1,9 @@ /*! -\page tui_use_existing_faces Use existing faces algorithm +\page tui_use_existing_faces Usage of "Use Faces to be Created Manually" algorithm -This sample demonstrates how to use Use existing faces algorithm, -which is actulally just a stub allowing to use your own 2D algoritm +This sample demonstrates how to use Use Faces to be Created Manually algorithm, +which is actually just a stub allowing to use your own 2D algorithm implemented in Python. \tui_script{use_existing_faces.py} diff --git a/doc/salome/gui/SMESH/input/use_existing_algos.doc b/doc/salome/gui/SMESH/input/use_existing_algos.doc index 79f718510..55eb854dd 100644 --- a/doc/salome/gui/SMESH/input/use_existing_algos.doc +++ b/doc/salome/gui/SMESH/input/use_existing_algos.doc @@ -1,8 +1,9 @@ /*! -\page import_algos_page Use Existing Elements Algorithms +\page import_algos_page "Import Elements from Another Mesh" Algorithms -\n Use Existing Elements algorithms allow to define the mesh of a geometrical +\n Import nD Elements from Another Mesh algorithms allow to +define the mesh of a geometrical object by importing suitably located mesh elements from another mesh. The mesh elements to import from the other mesh should be contained in groups. If several groups are used to mesh the same geometry, validity of @@ -17,13 +18,14 @@ part, by storing meshes of parts in files and then fusing them together using these algorithms.
-Use Existing 1D Elements algorithm allows to define the mesh of -a geometrical edge (or group of edges) +Import 1D Elements from Another Mesh algorithm allows to define +the mesh of a geometrical edge (or group of edges) by importing mesh edges contained in a group (or groups) from another mesh. -\n To apply this algorithm select the edge to be meshed (indicated in +
+To apply this algorithm select the edge to be meshed (indicated in the field \b Geometry of Create mesh dialog box), -Use existing 1D elements in the list of 1D algorithms and click the -"Add Hypothesis" button. +Import 1D Elements from Another Mesh in the list of 1D +algorithms and click the "Add Hypothesis" button. The following dialog box will appear: \image html hyp_source_edges.png @@ -38,16 +40,16 @@ mesh. In this case To copy groups checkbox allows to create the same groups as in the imported source mesh. -Use Existing 2D Elements algorithm allows to define the mesh of -a geometrical face (or group of faces) +Import 1D-2D Elements from Another Mesh algorithm allows to define +the mesh of a geometrical face (or group of faces) by importing mesh faces contained in a group (or groups) from another (or this) mesh. 1D elements on the boundary of the geometrical face (if not yet present) are also created by the algorithm in conformity -with the created 2D elements. -\n To apply this algorithm select the geometrical face to be meshed (indicated in +with the created 2D elements.
+To apply this algorithm select the geometrical face to be meshed (indicated in the field \b Geometry of Create mesh dialog box), -Use existing 2D elements in the list of 2D algorithms and click the -"Add Hypothesis" button. +Import 1D-2D Elements from Another Mesh in the list of 2D +algorithms and click the "Add Hypothesis" button. The following dialog box will appear: \image html hyp_source_faces.png @@ -63,7 +65,7 @@ the same groups as in the imported source mesh.
See Also a sample TUI Script of a -\ref tui_import "Use Existing Elements Algorithms". +\ref tui_import "Import 2D Elements from Another Mesh". */ diff --git a/doc/salome/gui/SMESH/static/footer.html b/doc/salome/gui/SMESH/static/footer.html index 4137de2f0..2972fc5e3 100755 --- a/doc/salome/gui/SMESH/static/footer.html +++ b/doc/salome/gui/SMESH/static/footer.html @@ -4,7 +4,7 @@
    $navpath
diff --git a/doc/salome/tui/CMakeLists.txt b/doc/salome/tui/CMakeLists.txt index dd0a69478..065c8b843 100755 --- a/doc/salome/tui/CMakeLists.txt +++ b/doc/salome/tui/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/doc/salome/tui/doxyfile.in b/doc/salome/tui/doxyfile.in index 7379feaf1..41f8b4513 100755 --- a/doc/salome/tui/doxyfile.in +++ b/doc/salome/tui/doxyfile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/doc/salome/tui/static/footer.html b/doc/salome/tui/static/footer.html index 4137de2f0..2972fc5e3 100755 --- a/doc/salome/tui/static/footer.html +++ b/doc/salome/tui/static/footer.html @@ -4,7 +4,7 @@
    $navpath
diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt index 8d2cdac64..f938e0444 100755 --- a/idl/CMakeLists.txt +++ b/idl/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/idl/SMESH_BasicHypothesis.idl b/idl/SMESH_BasicHypothesis.idl index 798475b30..72d1b1a2d 100644 --- a/idl/SMESH_BasicHypothesis.idl +++ b/idl/SMESH_BasicHypothesis.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -127,10 +127,36 @@ module StdMeshers double GetFineness(); }; + /*! + * Common inteface of 1D hypotheses that can be reversed + */ + interface Reversible1D + { + /*! + * Set list of edges to reverse + */ + void SetReversedEdges( in SMESH::long_array list ); + + /*! + * Returns list of edges to reverse + */ + SMESH::long_array GetReversedEdges(); + + /*! + * Set entry of the main object + */ + void SetObjectEntry( in string entry ); + + /*! + * Get the entry of the main object + */ + string GetObjectEntry(); + }; + /*! * StdMeshers_NumberOfSegments: interface of "Nb. Segments" hypothesis */ - interface StdMeshers_NumberOfSegments : SMESH::SMESH_Hypothesis + interface StdMeshers_NumberOfSegments : SMESH::SMESH_Hypothesis, Reversible1D { /*! * Builds and returns point distribution according to passed density function @@ -209,32 +235,12 @@ module StdMeshers */ long ConversionMode() raises (SALOME::SALOME_Exception); - - /*! - * Set list of edges to reverse - */ - void SetReversedEdges( in SMESH::long_array list ); - - /*! - * Returns list of edges to reverse - */ - SMESH::long_array GetReversedEdges(); - - /*! - * Set entry of the main object - */ - void SetObjectEntry( in string entry ); - - /*! - * Get the entry of the main object - */ - string GetObjectEntry(); }; /*! * StdMeshers_Arithmetic1D: interface of "Arithmetic 1D" hypothesis */ - interface StdMeshers_Arithmetic1D : SMESH::SMESH_Hypothesis + interface StdMeshers_Arithmetic1D : SMESH::SMESH_Hypothesis, Reversible1D { /*! * Sets or parameter value @@ -260,26 +266,36 @@ module StdMeshers * Returns or parameter value */ double GetLength(in boolean isStartLength); - + + }; + + /*! + * StdMeshers_Arithmetic1D: interface of "Geometric 1D" hypothesis + */ + interface StdMeshers_Geometric1D : SMESH::SMESH_Hypothesis, Reversible1D + { /*! - * Set list of edges to reverse + * Sets length of the first segment */ - void SetReversedEdges( in SMESH::long_array list ); - + void SetStartLength(in double length) + raises (SALOME::SALOME_Exception); + /*! - * Returns list of edges to reverse + * Sets value of Common Ratio */ - SMESH::long_array GetReversedEdges(); - + void SetCommonRatio(in double factor) + raises (SALOME::SALOME_Exception); + /*! - * Set entry of the main object + * Returns length of the first segment */ - void SetObjectEntry( in string entry ); - + double GetStartLength(); + /*! - * Get the entry of the main object + * Returns value of Common Ratio */ - string GetObjectEntry(); + double GetCommonRatio(); + }; /*! @@ -319,7 +335,7 @@ module StdMeshers /*! * StdMeshers_StartEndLength: interface of "Start and End Length" hypothesis */ - interface StdMeshers_StartEndLength : SMESH::SMESH_Hypothesis + interface StdMeshers_StartEndLength : SMESH::SMESH_Hypothesis, Reversible1D { /*! * Sets or parameter value @@ -346,25 +362,6 @@ module StdMeshers */ double GetLength(in boolean isStartLength); - /*! - * Set list of edges to reverse - */ - void SetReversedEdges( in SMESH::long_array list ); - - /*! - * Returns list of edges to reverse - */ - SMESH::long_array GetReversedEdges(); - - /*! - * Set entry of the main object - */ - void SetObjectEntry( in string entry ); - - /*! - * Get the entry of the main object - */ - string GetObjectEntry(); }; @@ -388,7 +385,7 @@ module StdMeshers /*! * StdMeshers_FixedPoints1D: interface of "Fixed points 1D" hypothesis */ - interface StdMeshers_FixedPoints1D : SMESH::SMESH_Hypothesis + interface StdMeshers_FixedPoints1D : SMESH::SMESH_Hypothesis, Reversible1D { /*! * Sets some points on edge using parameter on curve from 0 to 1 @@ -410,26 +407,7 @@ module StdMeshers * Returns list of numbers of segments */ SMESH::long_array GetNbSegments(); - - /*! - * Set list of edges to reverse - */ - void SetReversedEdges( in SMESH::long_array list ); - - /*! - * Returns list of edges to reverse - */ - SMESH::long_array GetReversedEdges(); - - /*! - * Set entry of the main object - */ - void SetObjectEntry( in string entry ); - - /*! - * Get the entry of the main object - */ - string GetObjectEntry(); + }; /*! @@ -483,7 +461,8 @@ module StdMeshers }; /*! - * StdMeshers_Propagation: interface of "Propagation" hypothesis. + * StdMeshers_Propagation: interface of "Propagation of 1D Hyp. on + * Opposite Edges" hypothesis. * Presence of this hypothesis on any edge propagates any other 1D * hypothesis from this edge on all edges, opposite to it. * It concerns only edges of quadrangle faces. @@ -492,6 +471,17 @@ module StdMeshers { }; + /*! + * StdMeshers_Propagation: interface of "Propagation of Node + * Distribution on Opposite Edges" hypothesis. + * Presence of this hypothesis on any edge propagates distribution of nodes + * from this edge on all edges, opposite to it. + * It concerns only edges of quadrangle faces. + */ + interface StdMeshers_PropagOfDistribution : SMESH::SMESH_Hypothesis + { + }; + /*! * StdMeshers_QuadranglePreference: interface of "QuadranglePreference" hypothesis. * This hypothesis is used by StdMeshers_Quadrangle_2D algorithm. @@ -807,6 +797,22 @@ module StdMeshers * Get the type of quadrangulation */ QuadType GetQuadType(); + + /*! + * Set positions of enforced nodes + */ + void SetEnforcedNodes(in GEOM::ListOfGO vertices, in SMESH::nodes_array points) + raises (SALOME::SALOME_Exception); + + /*! + * Returns positions of enforced nodes + */ + void GetEnforcedNodes(out GEOM::ListOfGO vertices, out SMESH::nodes_array points); + + /*! + * Returns entries of shapes defining enforced nodes + */ + SMESH::string_array GetEnfVertices(); }; /*! @@ -865,6 +871,14 @@ module StdMeshers void SetIgnoreFaces(in SMESH::long_array faceIDs) raises (SALOME::SALOME_Exception); SMESH::long_array GetIgnoreFaces(); + /*! + * Set faces either to exclude from treatment or to make the Viscous Layers on. + */ + void SetFaces(in SMESH::long_array faceIDs, + in boolean toIgnore) raises (SALOME::SALOME_Exception); + SMESH::long_array GetFaces(); + boolean GetIsToIgnoreFaces(); + /*! * Set total thickness of layers of prisms */ @@ -928,15 +942,16 @@ module StdMeshers /*! * interface of "Body fitting Parameters" hypothesis. * This hypothesis specifies - * - Definition of the Cartesian grid * - Size threshold + * - Definition of the Cartesian grid + * - Direction of grid axes */ interface StdMeshers_CartesianParameters3D : SMESH::SMESH_Hypothesis { /*! * Set size threshold. A polyhedral cell got by cutting an initial * hexahedron by geometry boundary is considered small and is removed if - * it's size is \athreshold times less than the size of the initial hexahedron. + * it's size is \a threshold times less than the size of the initial hexahedron. * threshold must be > 1.0 */ void SetSizeThreshold(in double threshold) raises (SALOME::SALOME_Exception); @@ -951,8 +966,8 @@ module StdMeshers /*! * Set coordinates of nodes along an axis (countered from zero) */ - void SetGrid(in SMESH::double_array coords, - in short axis) raises (SALOME::SALOME_Exception); + void SetGrid(in SMESH::double_array coords, + in short axis) raises (SALOME::SALOME_Exception); SMESH::double_array GetGrid(in short axis) raises (SALOME::SALOME_Exception); /*! @@ -971,6 +986,39 @@ module StdMeshers void GetGridSpacing(out SMESH::string_array spaceFunctions, out SMESH::double_array internalPoints, in short axis) raises (SALOME::SALOME_Exception); + /*! + * Set custom direction of axes + */ + void SetAxesDirs(in SMESH::DirStruct x, + in SMESH::DirStruct y, + in SMESH::DirStruct z ) raises (SALOME::SALOME_Exception); + void GetAxesDirs(out SMESH::DirStruct x, + out SMESH::DirStruct y, + out SMESH::DirStruct z ); + /*! + * Set/unset a fixed point, at which a node will be created provided that grid + * is defined by spacing in all directions + */ + void SetFixedPoint(in SMESH::PointStruct p, in boolean toUnset); + boolean GetFixedPoint(out SMESH::PointStruct p); + + /*! + * Enables implementation of geometrical edges into the mesh. If this feature + * is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if + * they don't coincide with the grid lines + */ + void SetToAddEdges(in boolean toAdd); + boolean GetToAddEdges(); + + /*! + * Returns axes at which a number of generated hexahedra is maximal + */ + void ComputeOptimalAxesDirs(in GEOM::GEOM_Object shape, + in boolean isOrthogonal, + out SMESH::DirStruct x, + out SMESH::DirStruct y, + out SMESH::DirStruct z ) + raises (SALOME::SALOME_Exception); /*! * \brief Computes node coordinates by spacing functions @@ -978,13 +1026,15 @@ module StdMeshers * \param x1 - upper coordinate * \param spaceFuns - space functions * \param points - internal points - * \param coords - the computed coordinates + * \param axisName - e.g. "X" + * \return the computed coordinates */ SMESH::double_array ComputeCoordinates(in double x0, in double x1, in SMESH::string_array spaceFuns, in SMESH::double_array points, - in string axisName ) raises (SALOME::SALOME_Exception); + in string axisName ) + raises (SALOME::SALOME_Exception); }; /*! diff --git a/idl/SMESH_Filter.idl b/idl/SMESH_Filter.idl index 4522b2205..5da26e1d1 100644 --- a/idl/SMESH_Filter.idl +++ b/idl/SMESH_Filter.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/idl/SMESH_Gen.idl b/idl/SMESH_Gen.idl index 813364ba0..052423ae1 100644 --- a/idl/SMESH_Gen.idl +++ b/idl/SMESH_Gen.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -417,6 +417,13 @@ module SMESH void Move( in sobject_list what, in SALOMEDS::SObject where, in long row ); + /*! + * Return true if algorithm can be applied + */ + boolean IsApplicable( in string theAlgoType, + in string theLibName, + in GEOM::GEOM_Object theShapeObject, + in boolean toCheckAll ); }; }; diff --git a/idl/SMESH_Group.idl b/idl/SMESH_Group.idl index b648e75f3..399d701d9 100644 --- a/idl/SMESH_Group.idl +++ b/idl/SMESH_Group.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/idl/SMESH_Hypothesis.idl b/idl/SMESH_Hypothesis.idl index 55848758c..65f944111 100644 --- a/idl/SMESH_Hypothesis.idl +++ b/idl/SMESH_Hypothesis.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/idl/SMESH_Measurements.idl b/idl/SMESH_Measurements.idl index 43e5bf2bc..0315022f2 100644 --- a/idl/SMESH_Measurements.idl +++ b/idl/SMESH_Measurements.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index fb85b15af..059170dcb 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -613,39 +613,47 @@ module SMESH * - auto_groups : boolean parameter for creating/not creating * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ; * the typical use is auto_groups=false. - * - version : define the version of format of MED file, that will be created + * - version : defines the version of format of MED file, that will be created * - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists - * - autoDimension: if @c True (default), a space dimension of a MED mesh can be either + * - autoDimension : if @c true, a space dimension of a MED mesh can be either * - 1D if all mesh nodes lie on OX coordinate axis, or * - 2D if all mesh nodes lie on XOY coordinate plane, or * - 3D in the rest cases. - * - * If @a autoDimension is @c False, the space dimension is always 3. + * If @a autoDimension is @c false, the space dimension is always 3. */ void ExportToMEDX( in string file, in boolean auto_groups, in MED_VERSION version, in boolean overwrite, - in boolean autoDimension ) raises (SALOME::SALOME_Exception); + in boolean autoDimension) raises (SALOME::SALOME_Exception); /*! - * Export a part of Mesh into a MED file + * Export a [part of] Mesh into a MED file * @params * - meshPart : a part of mesh to store * - file : name of the MED file * - version : define the version of format of MED file, that will be created * - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists - * - autoDimension: if @c True, a space dimension for export is defined by mesh + * - autoDimension : if @c True, a space dimension for export is defined by mesh * configuration; for example a planar mesh lying on XOY plane * will be exported as a mesh in 2D space. * If @a autoDimension == @c False, the space dimension is 3. - */ - void ExportPartToMED( in SMESH_IDSource meshPart, - in string file, - in boolean auto_groups, - in MED_VERSION version, - in boolean overwrite, - in boolean autoDimension ) raises (SALOME::SALOME_Exception); + * - fields : list of GEOM fields defined on the shape to mesh. + * - geomAssocFields : each character of this string means a need to export a + * corresponding field; correspondence between fields and characters is following: + * - 'v' stands for _vertices_ field; + * - 'e' stands for _edges_ field; + * - 'f' stands for _faces_ field; + * - 's' stands for _solids_ field. + */ + void ExportPartToMED( in SMESH_IDSource meshPart, + in string file, + in boolean auto_groups, + in MED_VERSION version, + in boolean overwrite, + in boolean autoDimension, + in GEOM::ListOfFields fields, + in string geomAssocFields ) raises (SALOME::SALOME_Exception); /*! * Export Mesh to a MED Format file @@ -810,6 +818,9 @@ module SMESH EntityType GetElementGeomType( in long id ) raises (SALOME::SALOME_Exception); + GeometryType GetElementShape( in long id ) + raises (SALOME::SALOME_Exception); + long_array GetSubMeshElementsId(in long ShapeID) raises (SALOME::SALOME_Exception); @@ -824,6 +835,11 @@ module SMESH * Methods to set meshing order of submeshes */ + /*! + * \brief Return \c true if a meshing order not yet set for a concurrent sub-mesh + */ + boolean IsUnorderedSubMesh(in long submeshID); + /*! * \brief Return submesh objects list in meshing order */ @@ -925,6 +941,11 @@ module SMESH */ long_array GetElemFaceNodes(in long elemId, in short faceIndex); + /*! + * Returns three components of normal of given mesh face (or an empty array in KO case) + */ + double_array GetFaceNormal(in long faceId, in boolean normalized); + /*! * Returns an element based on all given nodes. */ diff --git a/idl/SMESH_MeshEditor.idl b/idl/SMESH_MeshEditor.idl index 43d7eac35..397efff44 100644 --- a/idl/SMESH_MeshEditor.idl +++ b/idl/SMESH_MeshEditor.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -323,6 +323,27 @@ module SMESH void SplitVolumesIntoTetra(in SMESH_IDSource elems, in short methodFlags) raises (SALOME::SALOME_Exception); + /*! + * \brief Split hexahedra into triangular prisms + * \param elems - elements to split + * \param startHexPoint - a point used to find a hexahedron for which \a facetToSplitNormal + * gives a normal vector defining facets to split into triangles. + * \param facetToSplitNormal - normal used to find a facet of hexahedron + * to split into triangles. + * \param methodFlags - flags passing splitting method: + * 1 - split the hexahedron into 2 prisms + * 2 - split the hexahedron into 4 prisms + * \param allDomains - if \c False, only hexahedra adjacent to one closest + * to \a facetToSplitNormal location are split, else \a facetToSplitNormal + * is used to find the facet to split in all domains present in \a elems. + */ + void SplitHexahedraIntoPrisms(in SMESH_IDSource elems, + in SMESH::PointStruct startHexPoint, + in SMESH::DirStruct facetToSplitNormal, + in short methodFlags, + in boolean allDomains) + raises (SALOME::SALOME_Exception); + enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH }; @@ -1254,10 +1275,13 @@ module SMESH * Triangles are transformed in prisms, and quadrangles in hexahedrons. * \param theDomains - list of groups of volumes * \param createJointElems - if TRUE, create the elements + * \param onAllBoundaries - if TRUE, the nodes and elements are also created on + * the boundary between \a theDomains and the rest mesh * \return TRUE if operation has been completed successfully, FALSE otherwise */ boolean DoubleNodesOnGroupBoundaries( in ListOfGroups theDomains, - in boolean createJointElems ) + in boolean createJointElems, + in boolean onAllBoundaries) raises (SALOME::SALOME_Exception); /*! diff --git a/idl/SMESH_Pattern.idl b/idl/SMESH_Pattern.idl index 0d90e8ae5..3a5e7900a 100644 --- a/idl/SMESH_Pattern.idl +++ b/idl/SMESH_Pattern.idl @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 99825bb76..f55e54a70 100755 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -67,6 +67,7 @@ SET(SMESH_RESOURCES_FILES mesh_line_n.png mesh_line.png mesh_move_node.png + mesh_move_without_node.png mesh_octahedron.png mesh_orientation.png mesh.png @@ -197,6 +198,7 @@ SET(SMESH_RESOURCES_FILES mesh_duplicate_nodes.png mesh_duplicate_nodes_with_elem.png mesh_duplicate_elem_only.png + mesh_duplicate_group_boundary.png mesh_bounding_box.png mesh_hypo_viscous_layers.png mesh_tree_hypo_viscous_layers.png diff --git a/resources/SMESHCatalog.xml.in b/resources/SMESHCatalog.xml.in index cabb43fb9..cf89dd5c2 100644 --- a/resources/SMESHCatalog.xml.in +++ b/resources/SMESHCatalog.xml.in @@ -1,6 +1,6 @@ volume to modify) @@ -10231,7 +10661,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorgetVtkId(); @@ -10244,26 +10674,30 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorfromVtkToSmds(neighborsVtkIds[n]); const SMDS_MeshElement* elem = meshDS->FindElement(smdsId); - if (! domain.count(elem)) // neighbor is in another domain : face is shared + if (elem && ! domain.count(elem)) // neighbor is in another domain : face is shared { bool ok = false ; - for (int idombis = 0; idombis < theElems.size(); idombis++) // check if the neighbor belongs to another domain of the list + for (int idombis = 0; idombis < theElems.size() && !ok; idombis++) // check if the neighbor belongs to another domain of the list { // MESSAGE("Domain " << idombis); const TIDSortedElemSet& domainbis = theElems[idombis]; if ( domainbis.count(elem)) ok = true ; // neighbor is in a correct domain : face is kept } - if ( ok ) // the characteristics of the face is stored + if ( ok || onAllBoundaries ) // the characteristics of the face is stored { DownIdType face(downIds[n], downTypes[n]); - if (!faceDomains.count(face)) - faceDomains[face] = emptyMap; // create an empty entry for face if (!faceDomains[face].count(idom)) { faceDomains[face][idom] = vtkId; // volume associated to face in this domain celldom[vtkId] = idom; //MESSAGE(" cell with a border " << vtkId << " domain " << idom); } + if ( !ok ) + { + theRestDomElems.insert( elem ); + faceDomains[face][iRestDom] = neighborsVtkIds[n]; + celldom[neighborsVtkIds[n]] = iRestDom; + } } } } @@ -10277,14 +10711,14 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector domvol = itface->second; + const std::map& domvol = itface->second; if (!domvol.count(idomain)) continue; DownIdType face = itface->first; @@ -10313,8 +10747,6 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector > mutipleNodesToFace; // nodes multi domains with domain order to transform in Face (junction between 3 or more 2D domains) MESSAGE(".. Duplication of the nodes"); - for (int idomain = 0; idomain < theElems.size(); idomain++) + for (int idomain = idom0; idomain < nbDomains; idomain++) { itface = faceDomains.begin(); for (; itface != faceDomains.end(); ++itface) { - std::map domvol = itface->second; + const std::map& domvol = itface->second; if (!domvol.count(idomain)) continue; DownIdType face = itface->first; @@ -10353,15 +10785,12 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector::iterator itdom = domvol.begin(); + std::map::const_iterator itdom = domvol.begin(); for (; itdom != domvol.end(); ++itdom) { int idom = itdom->first; @@ -10399,7 +10828,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorfromVtkToSmds(vtkVolIds[ivol]); SMDS_MeshElement* elem = (SMDS_MeshElement*)meshDS->FindElement(smdsId); - if (theElems[idom].count(elem)) + if (domain.count(elem)) { SMDS_VtkVolume* svol = dynamic_cast(elem); domvol[idom] = svol; @@ -10653,7 +11083,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector >::const_iterator itnod = nodeDomains.begin(); for (; itnod != nodeDomains.end(); ++itnod) diff --git a/src/SMESH/SMESH_MeshEditor.hxx b/src/SMESH/SMESH_MeshEditor.hxx index 870660a8a..865a395c9 100644 --- a/src/SMESH/SMESH_MeshEditor.hxx +++ b/src/SMESH/SMESH_MeshEditor.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -169,11 +169,32 @@ public: SMESH::Controls::NumericalFunctorPtr theCriterion); - enum SplitVolumToTetraFlags { HEXA_TO_5 = 1, HEXA_TO_6 = 2, HEXA_TO_24 = 3 };//! TFacetOfElem; + + //!<2nd arg of SplitVolumes() + enum SplitVolumToTetraFlags { HEXA_TO_5 = 1, // split into tetrahedra + HEXA_TO_6, + HEXA_TO_24, + HEXA_TO_2_PRISMS, // split into prisms + HEXA_TO_4_PRISMS }; + /*! + * \brief Split volumic elements into tetrahedra or prisms. + * If facet ID < 0, element is split into tetrahedra, + * else a hexahedron is split into prisms so that the given facet is + * split into triangles + */ + void SplitVolumes (const TFacetOfElem & theElems, const int theMethodFlags); + /*! - * \brief Split volumic elements into tetrahedra. + * \brief For hexahedra that will be split into prisms, finds facets to + * split into triangles + * \param [in,out] theHexas - the hexahedra + * \param [in] theFacetNormal - facet normal + * \param [out] theFacets - the hexahedra and found facet IDs */ - void SplitVolumesIntoTetra (const TIDSortedElemSet & theElems, const int theMethodFlags); + void GetHexaFacetsToSplit( TIDSortedElemSet& theHexas, + const gp_Ax1& theFacetNormal, + TFacetOfElem & theFacets); enum SmoothMethod { LAPLACIAN = 0, CENTROIDAL }; @@ -532,7 +553,8 @@ public: double OrientedAngle(const gp_Pnt& p0, const gp_Pnt& p1, const gp_Pnt& g1, const gp_Pnt& g2); bool DoubleNodesOnGroupBoundaries( const std::vector& theElems, - bool createJointElems); + bool createJointElems, + bool onAllBoundaries); bool CreateFlatElementsOnFacesGroups( const std::vector& theElems ); diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index b7d8759e9..6dda8f79b 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -245,8 +245,8 @@ void SMESH_MesherHelper::SetSubShape(const TopoDS_Shape& aSh) TopLoc_Location loc; Handle(Geom_Surface) surface = BRep_Tool::Surface( face, loc ); - if ( surface->IsUPeriodic() || surface->IsVPeriodic() || - surface->IsUClosed() || surface->IsVClosed() ) + // if ( surface->IsUPeriodic() || surface->IsVPeriodic() || + // surface->IsUClosed() || surface->IsVClosed() ) { //while ( surface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface ))) //surface = Handle(Geom_RectangularTrimmedSurface)::DownCast( surface )->BasisSurface(); @@ -478,7 +478,10 @@ bool SMESH_MesherHelper::toCheckPosOnShape(int shapeID ) const void SMESH_MesherHelper::setPosOnShapeValidity(int shapeID, bool ok ) const { - ((SMESH_MesherHelper*)this)->myNodePosShapesValidity.insert( make_pair( shapeID, ok)); + std::map< int,bool >::iterator sh_ok = + ((SMESH_MesherHelper*)this)->myNodePosShapesValidity.insert( make_pair( shapeID, ok)).first; + if ( !ok ) + sh_ok->second = ok; } //======================================================================= @@ -661,9 +664,10 @@ bool SMESH_MesherHelper::CheckNodeUV(const TopoDS_Face& F, const bool force, double distXYZ[4]) const { - int shapeID = n->getshapeId(); + int shapeID = n->getshapeId(); bool infinit = ( Precision::IsInfinite( uv.X() ) || Precision::IsInfinite( uv.Y() )); - if ( force || toCheckPosOnShape( shapeID ) || infinit ) + bool zero = ( uv.X() == 0. && uv.Y() == 0. ); + if ( force || toCheckPosOnShape( shapeID ) || infinit || zero ) { // check that uv is correct TopLoc_Location loc; @@ -896,9 +900,10 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E, const bool force, double distXYZ[4]) const { - int shapeID = n->getshapeId(); + int shapeID = n->getshapeId(); bool infinit = Precision::IsInfinite( u ); - if ( force || toCheckPosOnShape( shapeID ) || infinit ) + bool zero = ( u == 0. ); + if ( force || toCheckPosOnShape( shapeID ) || infinit || zero ) { TopLoc_Location loc; double f,l; Handle(Geom_Curve) curve = BRep_Tool::Curve( E,loc,f,l ); @@ -1423,8 +1428,15 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1, return getMediumNodeOnComposedWire(n1,n2,force3d); } E = TopoDS::Edge(meshDS->IndexToShape( edgeID = pos.first )); - u[0] = GetNodeU(E,n1,n2, force3d ? 0 : &uvOK[0]); - u[1] = GetNodeU(E,n2,n1, force3d ? 0 : &uvOK[1]); + try { + u[0] = GetNodeU(E,n1,n2, force3d ? 0 : &uvOK[0]); + u[1] = GetNodeU(E,n2,n1, force3d ? 0 : &uvOK[1]); + } + catch ( Standard_Failure& f ) + { + // issue 22502 / a node is on VERTEX not belonging to E + return getMediumNodeOnComposedWire(n1,n2,force3d); + } } if ( !force3d & uvOK[0] && uvOK[1] ) @@ -2920,7 +2932,7 @@ namespace { // Structures used by FixQuadraticElements() //======================================================================= #define __DMP__(txt) \ - //cout << txt + // cout << txt #define MSG(txt) __DMP__(txt<GetSubShape()); -// const SMDS_MeshNode* inFaceNode = uvHelper->GetNodeUVneedInFaceNode() ? GetNodeInFace() : 0; -// gp_XY uv1 = uvHelper->GetNodeUV( face, _sides[i]->node1(), inFaceNode ); -// gp_XY uv2 = uvHelper->GetNodeUV( face, _sides[i]->node2(), inFaceNode ); -// norm.SetCoord( uv1.Y() - uv2.Y(), uv2.X() - uv1.X(), 0 ); - -// const QLink* otherLink = _sides[(i + 1) % _sides.size()]; -// const SMDS_MeshNode* otherNode = -// otherLink->node1() == _sides[i]->node1() ? otherLink->node2() : otherLink->node1(); -// gp_XY pIn = uvHelper->GetNodeUV( face, otherNode, inFaceNode ); -// vecOut.SetCoord( uv1.X() - pIn.X(), uv1.Y() - pIn.Y(), 0 ); -// } -// else { - norm = _normal ^ gp_Vec( XYZ(_sides[i]->node1()), XYZ(_sides[i]->node2())); - gp_XYZ pIn = ( XYZ( _sides[0]->node1() ) + - XYZ( _sides[0]->node2() ) + - XYZ( _sides[1]->node1() )) / 3.; - vecOut.SetXYZ( _sides[i]->MiddlePnt() - pIn ); - //} + gp_Vec norm = _normal ^ gp_Vec( XYZ(_sides[i]->node1()), XYZ(_sides[i]->node2())); + gp_XYZ pIn = ( _sides[ (i+1)%3 ]->MiddlePnt() + + _sides[ (i+2)%3 ]->MiddlePnt() ) / 2.; + gp_Vec vecOut = ( _sides[i]->MiddlePnt() - pIn ); + if ( norm * vecOut < 0 ) norm.Reverse(); double mag2 = norm.SquareMagnitude(); @@ -3402,10 +3398,26 @@ namespace { // Structures used by FixQuadraticElements() int iL1 = (iL + 1) % 3, iL2 = (iL + 2) % 3; // indices of the two other links of triangle TLinkInSet link1 = theLinks.find( _sides[iL1] ); TLinkInSet link2 = theLinks.find( _sides[iL2] ); - if ( link1 == theLinks.end() || link2 == theLinks.end() ) - return thePrevLen; - const QFace* f1 = link1->NextFace( this ); // adjacent faces - const QFace* f2 = link2->NextFace( this ); + + const QFace *f1 = 0, *f2 = 0; // adjacent faces + bool isBndLink1 = true, isBndLink2 = true; + if ( link1 != theLinks.end() && link2 != theLinks.end() ) + { + f1 = link1->NextFace( this ); + f2 = link2->NextFace( this ); + + isBndLink1 = ( theLink->MediumPos() > (*link1)->MediumPos() ); + isBndLink2 = ( theLink->MediumPos() > (*link2)->MediumPos() ); + if ( theStep == theFirstStep ) // (issue 22541) quad-dominant mesh + { + if ( !isBndLink1 && !f1 ) + f1 = (*link1)->GetContinuesFace( this ); // get a quadrangle face + if ( !isBndLink2 && !f2 ) + f2 = (*link2)->GetContinuesFace( this ); + } + } + else if ( _sides.size() < 4 ) + return thePrevLen; // propagate to adjacent faces till limit step or boundary double len1 = thePrevLen + (theLink->MiddlePnt() - _sides[iL1]->MiddlePnt()).Modulus(); @@ -3414,7 +3426,7 @@ namespace { // Structures used by FixQuadraticElements() gp_Vec linkDir2(0,0,0); try { OCC_CATCH_SIGNALS; - if ( f1 && theLink->MediumPos() <= (*link1)->MediumPos() ) + if ( f1 && !isBndLink1 ) len1 = f1->MoveByBoundary ( *link1, theRefVec, theLinks, theFaceHelper, len1, theStep-1, &linkDir1, theSign); else @@ -3425,7 +3437,7 @@ namespace { // Structures used by FixQuadraticElements() } try { OCC_CATCH_SIGNALS; - if ( f2 && theLink->MediumPos() <= (*link2)->MediumPos() ) + if ( f2 && !isBndLink2 ) len2 = f2->MoveByBoundary ( *link2, theRefVec, theLinks, theFaceHelper, len2, theStep-1, &linkDir2, theSign); else @@ -3448,7 +3460,7 @@ namespace { // Structures used by FixQuadraticElements() MSG(string(theStep,'.')<<" Move "<< theLink->_mediumNode->GetID()<< " by " << refProj * ( 1 - r ) << " following " << - (choose1 ? *link1->_qlink : *link2->_qlink)); + (choose1 ? *link1->_qlink : *link2->_qlink)); // warning: link1 can be invalid if ( theLinkNorm ) *theLinkNorm = linkNorm; } diff --git a/src/SMESH/SMESH_MesherHelper.hxx b/src/SMESH/SMESH_MesherHelper.hxx index bfe44f75a..d67e335b5 100644 --- a/src/SMESH/SMESH_MesherHelper.hxx +++ b/src/SMESH/SMESH_MesherHelper.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH/SMESH_Pattern.cxx b/src/SMESH/SMESH_Pattern.cxx index 63e6f365f..9dc255a25 100644 --- a/src/SMESH/SMESH_Pattern.cxx +++ b/src/SMESH/SMESH_Pattern.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -2641,10 +2641,10 @@ bool SMESH_Pattern::Apply (const SMDS_MeshFace* theFace, list< const SMDS_MeshNode* > nodes; list< const SMDS_MeshNode* >::iterator n = nodes.end(); - SMDS_ElemIteratorPtr noIt = theFace->nodesIterator(); + SMDS_NodeIteratorPtr noIt = theFace->nodeIterator(); int iSub = 0; while ( noIt->more() && iSub < nbFaceNodes ) { - const SMDS_MeshNode* node = smdsNode( noIt->next() ); + const SMDS_MeshNode* node = noIt->next(); nodes.push_back( node ); if ( iSub++ == theNodeIndexOnKeyPoint1 ) n = --nodes.end(); @@ -2661,7 +2661,7 @@ bool SMESH_Pattern::Apply (const SMDS_MeshFace* theFace, list< gp_XYZ > xyzList; myOrderedNodes.resize( nbFaceNodes ); for ( iSub = 0, n = nodes.begin(); n != nodes.end(); ++n ) { - xyzList.push_back( gp_XYZ( (*n)->X(), (*n)->Y(), (*n)->Z() )); + xyzList.push_back( SMESH_TNodeXYZ( *n )); myOrderedNodes[ iSub++] = *n; } @@ -2963,11 +2963,6 @@ bool SMESH_Pattern::Apply (SMESH_Mesh* theMesh, myXYZ.resize( myPoints.size() * theFaces.size(), undefinedXYZ() ); myElements.reserve( theFaces.size() ); - // to find point index - map< TPoint*, int > pointIndex; - for ( int i = 0; i < myPoints.size(); i++ ) - pointIndex.insert( make_pair( & myPoints[ i ], i )); - int ind1 = 0; // lowest point index for a face // meshed geometry @@ -3019,7 +3014,7 @@ bool SMESH_Pattern::Apply (SMESH_Mesh* theMesh, { list< TPoint* > & linkPoints = getShapePoints( eID++ ); const SMDS_MeshNode* n1 = myOrderedNodes[ i ]; - const SMDS_MeshNode* n2 = myOrderedNodes[ i + 1 == nbNodes ? 0 : i + 1 ]; + const SMDS_MeshNode* n2 = myOrderedNodes[( i+1 ) % nbNodes ]; // make a link and a node set TNodeSet linkSet, node1Set; linkSet.insert( n1 ); @@ -3028,7 +3023,7 @@ bool SMESH_Pattern::Apply (SMESH_Mesh* theMesh, list< TPoint* >::iterator p = linkPoints.begin(); { // map the first link point to n1 - int nId = pointIndex[ *p ] + ind1; + int nId = ( *p - &myPoints[0] ) + ind1; myXYZIdToNodeMap[ nId ] = n1; list< list< int > >& groups = myIdsOnBoundary[ node1Set ]; groups.push_back(list< int > ()); @@ -3040,7 +3035,7 @@ bool SMESH_Pattern::Apply (SMESH_Mesh* theMesh, list< int >& indList = groups.back(); // add points to the map excluding the end points for ( p++; *p != linkPoints.back(); p++ ) - indList.push_back( pointIndex[ *p ] + ind1 ); + indList.push_back( ( *p - &myPoints[0] ) + ind1 ); } ind1 += myPoints.size(); } @@ -3443,7 +3438,7 @@ void SMESH_Pattern::mergePoints (const bool uniteGroups) Bnd_Box box; TNodeSet::const_iterator n = nodes.begin(); for ( ; n != nodes.end(); ++n ) - box.Add( gp_Pnt( (*n)->X(), (*n)->Y(), (*n)->Z() )); + box.Add( gp_Pnt( SMESH_TNodeXYZ( *n ))); double x, y, z, X, Y, Z; box.Get( x, y, z, X, Y, Z ); gp_Pnt p( x, y, z ), P( X, Y, Z ); @@ -3454,7 +3449,7 @@ void SMESH_Pattern::mergePoints (const bool uniteGroups) bool unite = ( uniteGroups && nodes.size() == 2 ); map< double, int > distIndMap; const SMDS_MeshNode* node = *nodes.begin(); - gp_Pnt P( node->X(), node->Y(), node->Z() ); + gp_Pnt P = SMESH_TNodeXYZ( node ); // compare points, replace indices @@ -3928,32 +3923,142 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh, myXYZ[ i ].Y(), myXYZ[ i ].Z()); } - } + if ( theMesh->HasShapeToMesh() ) + { + // set nodes on EDGEs (IMP 22368) + SMESH_MesherHelper helper( *theMesh ); + helper.ToFixNodeParameters( true ); + map< TNodeSet, list< list< int > > >::iterator idListIt = myIdsOnBoundary.begin(); + for ( ; idListIt != myIdsOnBoundary.end(); idListIt++ ) + { + list >& groups = idListIt->second; + const TNodeSet& nodes = idListIt->first; + if ( nodes.size() != 2 ) + continue; // not a link + const SMDS_MeshNode* n1 = *nodes.begin(); + const SMDS_MeshNode* n2 = *nodes.rbegin(); + TopoDS_Shape S1 = helper.GetSubShapeByNode( n1, aMeshDS ); + TopoDS_Shape S2 = helper.GetSubShapeByNode( n2, aMeshDS ); + if ( S1.IsNull() || S1.ShapeType() < TopAbs_EDGE || + S2.IsNull() || S2.ShapeType() < TopAbs_EDGE ) + continue; + TopoDS_Shape S; + if ( S1.ShapeType() == TopAbs_EDGE ) + { + if ( S1 == S2 || helper.IsSubShape( S2, S1 )) + S = S1; + } + else if ( S2.ShapeType() == TopAbs_EDGE ) + { + if ( helper.IsSubShape( S1, S2 )) + S = S2; + } + else + { + S = helper.GetCommonAncestor( S1, S2, *theMesh, TopAbs_EDGE ); + } + if ( S.IsNull() ) + continue; + const TopoDS_Edge & E = TopoDS::Edge( S ); + helper.SetSubShape( E ); + list >::iterator g = groups.begin(); + for ( ; g != groups.end(); ++g ) + { + list< int >& ids = *g; + list< int >::iterator id = ids.begin(); + for ( ; id != ids.end(); ++id ) + if ( nodesVector[ *id ] && nodesVector[ *id ]->getshapeId() < 1 ) + { + double u = 1e100; + aMeshDS->SetNodeOnEdge( nodesVector[ *id ], E, u ); + helper.CheckNodeU( E, nodesVector[ *id ], u, 1e-7, true ); + } + } + } + } + } // if ( onMeshElements ) + else { nodesVector.resize( myPoints.size(), 0 ); - // to find point index - map< TPoint*, int > pointIndex; - for ( int i = 0; i < myPoints.size(); i++ ) - pointIndex.insert( make_pair( & myPoints[ i ], i )); + // find existing nodes on EDGEs and VERTEXes (IMP 22368) + map< int, list< TPoint* > >::iterator idPointIt = myShapeIDToPointsMap.begin(); + if ( !myShapeIDMap.IsEmpty() && aMeshDS->NbNodes() > 0 ) + + for ( ; idPointIt != myShapeIDToPointsMap.end(); idPointIt++ ) + { + const TopoDS_Shape& S = myShapeIDMap( idPointIt->first ); + list< TPoint* > & points = idPointIt->second; + if ( points.empty() ) + continue; + + switch ( S.ShapeType() ) + { + case TopAbs_VERTEX: + { + int pIndex = points.back() - &myPoints[0]; + if ( !nodesVector[ pIndex ] ) + nodesVector[ pIndex ] = SMESH_Algo::VertexNode( TopoDS::Vertex( S ), aMeshDS ); + break; + } + case TopAbs_EDGE: + { + const TopoDS_Edge& edge = TopoDS::Edge( S ); + map< double, const SMDS_MeshNode* > paramsOfNodes; + if ( !SMESH_Algo::GetSortedNodesOnEdge( aMeshDS, edge, + /*ignoreMediumNodes=*/false, + paramsOfNodes ) + || paramsOfNodes.size() < 3 ) + break; + // points on VERTEXes are included with wrong myU + list< TPoint* >::reverse_iterator pItR = ++points.rbegin(); + list< TPoint* >::iterator pItF = ++points.begin(); + const bool isForward = ( (*pItF)->myU < (*pItR)->myU ); + map< double, const SMDS_MeshNode* >::iterator u2n = ++paramsOfNodes.begin(); + map< double, const SMDS_MeshNode* >::iterator u2nEnd = --paramsOfNodes.end(); + TPoint* p; + while ( u2n != u2nEnd && pItF != points.end() ) + { + const double u = u2n->first; + const SMDS_MeshNode* n = u2n->second; + const double tol = ( (++u2n)->first - u ) / 20; + do + { + p = ( isForward ? *pItF : *pItR ); + if ( Abs( u - p->myU ) < tol ) + { + int pIndex = p - &myPoints[0]; + if ( !nodesVector [ pIndex ] ) + nodesVector [ pIndex ] = n; + ++pItF; + ++pItR; + break; + } + } + while ( p->myU < u && ( ++pItF, ++pItR != points.rend() )); + } + break; + } + default:; + } + } // end of "find existing nodes on EDGEs and VERTEXes" // loop on sub-shapes of myShape: create nodes - map< int, list< TPoint* > >::iterator idPointIt = myShapeIDToPointsMap.begin(); + idPointIt = myShapeIDToPointsMap.begin(); for ( ; idPointIt != myShapeIDToPointsMap.end(); idPointIt++ ) { TopoDS_Shape S; - //SMESHDS_SubMesh * subMeshDS = 0; if ( !myShapeIDMap.IsEmpty() ) { S = myShapeIDMap( idPointIt->first ); - //subMeshDS = aMeshDS->MeshElements( S ); } list< TPoint* > & points = idPointIt->second; list< TPoint* >::iterator pIt = points.begin(); for ( ; pIt != points.end(); pIt++ ) { TPoint* point = *pIt; - int pIndex = pointIndex[ point ]; + //int pIndex = pointIndex[ point ]; + int pIndex = point - &myPoints[0]; if ( nodesVector [ pIndex ] ) continue; SMDS_MeshNode* node = aMeshDS->AddNode (point->myXYZ.X(), @@ -4148,8 +4253,9 @@ void SMESH_Pattern::createElements(SMESH_Mesh* theMes SMDS_ElemIteratorPtr noIt = elem->nodesIterator(); while ( noIt->more() ) { SMDS_MeshNode* node = const_cast(smdsNode( noIt->next() )); - if (!node->getshapeId() && - shellNodes.find( node ) == shellNodes.end() ) { + if ( node->getshapeId() < 1 && + shellNodes.find( node ) == shellNodes.end() ) + { if ( S.ShapeType() == TopAbs_FACE ) aMeshDS->SetNodeOnFace( node, shapeID, Precision::Infinite(),// <- it's a sign that UV is not set diff --git a/src/SMESH/SMESH_Pattern.hxx b/src/SMESH/SMESH_Pattern.hxx index b2606e463..cbe677493 100644 --- a/src/SMESH/SMESH_Pattern.hxx +++ b/src/SMESH/SMESH_Pattern.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -356,7 +356,7 @@ private: // all functions assure that shapes are indexed so that first go // ordered vertices, then ordered edge, then faces and maybe a shell TopTools_IndexedMapOfOrientedShape myShapeIDMap; - std::map< int, std::list< TPoint* > > myShapeIDToPointsMap; + std::map< int, std::list< TPoint*> > myShapeIDToPointsMap; // for the 2d case: // nb of key-points in each of pattern boundaries diff --git a/src/SMESH/SMESH_ProxyMesh.cxx b/src/SMESH/SMESH_ProxyMesh.cxx index 8649c7d3a..fd4f470b1 100644 --- a/src/SMESH/SMESH_ProxyMesh.cxx +++ b/src/SMESH/SMESH_ProxyMesh.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH/SMESH_ProxyMesh.hxx b/src/SMESH/SMESH_ProxyMesh.hxx index a367ef369..f0d86579e 100644 --- a/src/SMESH/SMESH_ProxyMesh.hxx +++ b/src/SMESH/SMESH_ProxyMesh.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH/SMESH_SMESH.hxx b/src/SMESH/SMESH_SMESH.hxx index 106eeb30e..257f96080 100755 --- a/src/SMESH/SMESH_SMESH.hxx +++ b/src/SMESH/SMESH_SMESH.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index df1c1b70c..0b9269fed 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH/SMESH_subMesh.hxx b/src/SMESH/SMESH_subMesh.hxx index 63ff08d3f..f38d6367a 100644 --- a/src/SMESH/SMESH_subMesh.hxx +++ b/src/SMESH/SMESH_subMesh.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH/SMESH_subMeshEventListener.hxx b/src/SMESH/SMESH_subMeshEventListener.hxx index 66e324f80..bccc5d073 100644 --- a/src/SMESH/SMESH_subMeshEventListener.hxx +++ b/src/SMESH/SMESH_subMeshEventListener.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH/memoire.h b/src/SMESH/memoire.h index 0500bf928..dc34dc2b5 100644 --- a/src/SMESH/memoire.h +++ b/src/SMESH/memoire.h @@ -1,9 +1,9 @@ -// Copyright (C) 2010-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2010-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHClient/CMakeLists.txt b/src/SMESHClient/CMakeLists.txt index e103f174c..24642b4f4 100644 --- a/src/SMESHClient/CMakeLists.txt +++ b/src/SMESHClient/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHClient/SMESHClientBin.cxx b/src/SMESHClient/SMESHClientBin.cxx index 7f6b90f32..25674a352 100644 --- a/src/SMESHClient/SMESHClientBin.cxx +++ b/src/SMESHClient/SMESHClientBin.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHClient/SMESH_Client.cxx b/src/SMESHClient/SMESH_Client.cxx index 48c963d97..d25d800d7 100644 --- a/src/SMESHClient/SMESH_Client.cxx +++ b/src/SMESHClient/SMESH_Client.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHClient/SMESH_Client.hxx b/src/SMESHClient/SMESH_Client.hxx index a8434f421..975885369 100644 --- a/src/SMESHClient/SMESH_Client.hxx +++ b/src/SMESHClient/SMESH_Client.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/CMakeLists.txt b/src/SMESHDS/CMakeLists.txt index 4359252ff..f5fb89fbe 100644 --- a/src/SMESHDS/CMakeLists.txt +++ b/src/SMESHDS/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_Command.cxx b/src/SMESHDS/SMESHDS_Command.cxx index b6077f900..b3f05171f 100644 --- a/src/SMESHDS/SMESHDS_Command.cxx +++ b/src/SMESHDS/SMESHDS_Command.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_Command.hxx b/src/SMESHDS/SMESHDS_Command.hxx index 71340f0b6..7b5349b10 100644 --- a/src/SMESHDS/SMESHDS_Command.hxx +++ b/src/SMESHDS/SMESHDS_Command.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_CommandType.hxx b/src/SMESHDS/SMESHDS_CommandType.hxx index 1bceb33da..e737f5f02 100644 --- a/src/SMESHDS/SMESHDS_CommandType.hxx +++ b/src/SMESHDS/SMESHDS_CommandType.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_DataMapOfShape.hxx b/src/SMESHDS/SMESHDS_DataMapOfShape.hxx index 5b8165cf1..21bb5a1e5 100755 --- a/src/SMESHDS/SMESHDS_DataMapOfShape.hxx +++ b/src/SMESHDS/SMESHDS_DataMapOfShape.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -32,13 +32,19 @@ /* * This method needed for instance NCollection_DataMap with TopoDS_Shape as key */ - -inline Standard_Boolean IsEqual(const TopoDS_Shape& S1, - const TopoDS_Shape& S2) +struct SMESHDS_Hasher { - return S1.IsSame(S2); -} - + static inline Standard_Boolean IsEqual(const TopoDS_Shape& S1, + const TopoDS_Shape& S2) + { + return S1.IsSame(S2); + } + static inline Standard_Integer HashCode(const TopoDS_Shape& S, + const Standard_Integer Upper) + { + return ::HashCode( S, Upper); + } +}; -#endif +#endif diff --git a/src/SMESHDS/SMESHDS_Document.cxx b/src/SMESHDS/SMESHDS_Document.cxx index cad399b74..93fbc5ec0 100644 --- a/src/SMESHDS/SMESHDS_Document.cxx +++ b/src/SMESHDS/SMESHDS_Document.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_Document.hxx b/src/SMESHDS/SMESHDS_Document.hxx index fb576984b..86f68cddc 100644 --- a/src/SMESHDS/SMESHDS_Document.hxx +++ b/src/SMESHDS/SMESHDS_Document.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_Group.cxx b/src/SMESHDS/SMESHDS_Group.cxx index 21a2ebbe2..ce85efa33 100644 --- a/src/SMESHDS/SMESHDS_Group.cxx +++ b/src/SMESHDS/SMESHDS_Group.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_Group.hxx b/src/SMESHDS/SMESHDS_Group.hxx index 9836e7a07..c6998c99e 100644 --- a/src/SMESHDS/SMESHDS_Group.hxx +++ b/src/SMESHDS/SMESHDS_Group.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_GroupBase.cxx b/src/SMESHDS/SMESHDS_GroupBase.cxx index 08dd7e5f6..d1b0d6ecd 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.cxx +++ b/src/SMESHDS/SMESHDS_GroupBase.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_GroupBase.hxx b/src/SMESHDS/SMESHDS_GroupBase.hxx index 3c6040b6e..c00887858 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.hxx +++ b/src/SMESHDS/SMESHDS_GroupBase.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_GroupOnFilter.cxx b/src/SMESHDS/SMESHDS_GroupOnFilter.cxx index 8cdd65fc8..e26bfa7e0 100644 --- a/src/SMESHDS/SMESHDS_GroupOnFilter.cxx +++ b/src/SMESHDS/SMESHDS_GroupOnFilter.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_GroupOnFilter.hxx b/src/SMESHDS/SMESHDS_GroupOnFilter.hxx index 7dfa3e517..b45e600ec 100644 --- a/src/SMESHDS/SMESHDS_GroupOnFilter.hxx +++ b/src/SMESHDS/SMESHDS_GroupOnFilter.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_GroupOnGeom.cxx b/src/SMESHDS/SMESHDS_GroupOnGeom.cxx index 7127171f3..78fd1440e 100644 --- a/src/SMESHDS/SMESHDS_GroupOnGeom.cxx +++ b/src/SMESHDS/SMESHDS_GroupOnGeom.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_GroupOnGeom.hxx b/src/SMESHDS/SMESHDS_GroupOnGeom.hxx index 6c05c7c05..b29b1a586 100644 --- a/src/SMESHDS/SMESHDS_GroupOnGeom.hxx +++ b/src/SMESHDS/SMESHDS_GroupOnGeom.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_Hypothesis.cxx b/src/SMESHDS/SMESHDS_Hypothesis.cxx index fb2ea91cf..a5851a204 100644 --- a/src/SMESHDS/SMESHDS_Hypothesis.cxx +++ b/src/SMESHDS/SMESHDS_Hypothesis.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_Hypothesis.hxx b/src/SMESHDS/SMESHDS_Hypothesis.hxx index e23f29b92..ea01d617a 100644 --- a/src/SMESHDS/SMESHDS_Hypothesis.hxx +++ b/src/SMESHDS/SMESHDS_Hypothesis.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index 3e5203279..089e9feec 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_Mesh.hxx b/src/SMESHDS/SMESHDS_Mesh.hxx index 360b8ef6b..8b8fc0a55 100644 --- a/src/SMESHDS/SMESHDS_Mesh.hxx +++ b/src/SMESHDS/SMESHDS_Mesh.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -50,18 +50,22 @@ class SMDS_MeshVolume ; class SMDS_Mesh0DElement; class SMDS_BallElement; -#include #include + /* * Using of native hash_map isn't portable and don't work on WIN32 platform. * So this functionality implement on new NCollection_DataMap technology */ +#include #include "SMESHDS_DataMapOfShape.hxx" +typedef std::list THypList; +typedef NCollection_DataMap< TopoDS_Shape, THypList, SMESHDS_Hasher > ShapeToHypothesis; class SMESHDS_GroupBase; class DownIdType; -class SMESHDS_EXPORT SMESHDS_Mesh:public SMDS_Mesh{ +class SMESHDS_EXPORT SMESHDS_Mesh : public SMDS_Mesh +{ public: SMESHDS_Mesh(int theMeshID, bool theIsEmbeddedMode); bool IsEmbeddedMode(); @@ -569,8 +573,11 @@ public: bool HasHypothesis(const TopoDS_Shape & S); const std::list& GetHypothesis(const TopoDS_Shape & S) const; bool IsUsedHypothesis(const SMESHDS_Hypothesis * H) const; + const ShapeToHypothesis & GetHypotheses() const { return myShapeToHypothesis; } + SMESHDS_Script * GetScript(); void ClearScript(); + int ShapeToIndex(const TopoDS_Shape & aShape) const; const TopoDS_Shape& IndexToShape(int ShapeIndex) const; int MaxShapeIndex() const { return myIndexToShape.Extent(); } @@ -603,15 +610,6 @@ private: it->second->AddNode( aNode ); // add aNode to submesh } - /*int HashCode( const TopoDS_Shape& S, const Standard_Integer theUpper ) const - { - return S.HashCode(2147483647); - }*/ - - typedef std::list THypList; - - typedef NCollection_DataMap< TopoDS_Shape, THypList > ShapeToHypothesis; - ShapeToHypothesis myShapeToHypothesis; int myMeshID, myPersistentID; diff --git a/src/SMESHDS/SMESHDS_Script.cxx b/src/SMESHDS/SMESHDS_Script.cxx index d715a20b4..1c7c38398 100644 --- a/src/SMESHDS/SMESHDS_Script.cxx +++ b/src/SMESHDS/SMESHDS_Script.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_Script.hxx b/src/SMESHDS/SMESHDS_Script.hxx index f7c2a9b18..ca71dd5d8 100644 --- a/src/SMESHDS/SMESHDS_Script.hxx +++ b/src/SMESHDS/SMESHDS_Script.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_SubMesh.cxx b/src/SMESHDS/SMESHDS_SubMesh.cxx index 7bf00c99d..915ab0cdc 100644 --- a/src/SMESHDS/SMESHDS_SubMesh.cxx +++ b/src/SMESHDS/SMESHDS_SubMesh.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESHDS_SubMesh.hxx b/src/SMESHDS/SMESHDS_SubMesh.hxx index 7b389182c..2f28f0e90 100644 --- a/src/SMESHDS/SMESHDS_SubMesh.hxx +++ b/src/SMESHDS/SMESHDS_SubMesh.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESH_Controls.hxx b/src/SMESHDS/SMESH_Controls.hxx index bd7871ac7..4feb3959e 100644 --- a/src/SMESHDS/SMESH_Controls.hxx +++ b/src/SMESHDS/SMESH_Controls.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHDS/SMESH_SMESHDS.hxx b/src/SMESHDS/SMESH_SMESHDS.hxx index af1f4210d..193992f33 100755 --- a/src/SMESHDS/SMESH_SMESHDS.hxx +++ b/src/SMESHDS/SMESH_SMESHDS.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHFiltersSelection/CMakeLists.txt b/src/SMESHFiltersSelection/CMakeLists.txt index 7a9b9566b..9d9b8d831 100644 --- a/src/SMESHFiltersSelection/CMakeLists.txt +++ b/src/SMESHFiltersSelection/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHFiltersSelection/SMESH_LogicalFilter.cxx b/src/SMESHFiltersSelection/SMESH_LogicalFilter.cxx index e16d20a17..61cadf00c 100644 --- a/src/SMESHFiltersSelection/SMESH_LogicalFilter.cxx +++ b/src/SMESHFiltersSelection/SMESH_LogicalFilter.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHFiltersSelection/SMESH_LogicalFilter.hxx b/src/SMESHFiltersSelection/SMESH_LogicalFilter.hxx index ddaaeb943..773fc3d76 100644 --- a/src/SMESHFiltersSelection/SMESH_LogicalFilter.hxx +++ b/src/SMESHFiltersSelection/SMESH_LogicalFilter.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHFiltersSelection/SMESH_NumberFilter.cxx b/src/SMESHFiltersSelection/SMESH_NumberFilter.cxx index 0e66f83d4..9cbe280ae 100644 --- a/src/SMESHFiltersSelection/SMESH_NumberFilter.cxx +++ b/src/SMESHFiltersSelection/SMESH_NumberFilter.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHFiltersSelection/SMESH_NumberFilter.hxx b/src/SMESHFiltersSelection/SMESH_NumberFilter.hxx index a1cd52702..a0e15e074 100644 --- a/src/SMESHFiltersSelection/SMESH_NumberFilter.hxx +++ b/src/SMESHFiltersSelection/SMESH_NumberFilter.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHFiltersSelection/SMESH_Type.h b/src/SMESHFiltersSelection/SMESH_Type.h index 0625c55bc..aaaafce7d 100644 --- a/src/SMESHFiltersSelection/SMESH_Type.h +++ b/src/SMESHFiltersSelection/SMESH_Type.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx b/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx index 7ce2a0459..9b1394da7 100644 --- a/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx +++ b/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHFiltersSelection/SMESH_TypeFilter.hxx b/src/SMESHFiltersSelection/SMESH_TypeFilter.hxx index 31f288cad..e48d3d81b 100644 --- a/src/SMESHFiltersSelection/SMESH_TypeFilter.hxx +++ b/src/SMESHFiltersSelection/SMESH_TypeFilter.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/CMakeLists.txt b/src/SMESHGUI/CMakeLists.txt index a3673cf3f..39f744757 100644 --- a/src/SMESHGUI/CMakeLists.txt +++ b/src/SMESHGUI/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -141,6 +141,7 @@ SET(_moc_HEADERS SMESHGUI_ReorientFacesDlg.h SMESHGUI_PropertiesDlg.h SMESHGUI_Add0DElemsOnAllNodesDlg.h + SMESHGUI_FieldSelectorWdg.h ) # header files / no moc processing @@ -246,6 +247,7 @@ SET(_other_SOURCES SMESHGUI_Filter.cxx SMESHGUI_MeshEditPreview.cxx SMESHGUI_FileValidator.cxx + SMESHGUI_FieldSelectorWdg.cxx ) # sources / to compile diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 6fb58cea1..336363ecb 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -44,6 +44,7 @@ #include "SMESHGUI_DuplicateNodesDlg.h" #include "SMESHGUI_ExtrusionAlongPathDlg.h" #include "SMESHGUI_ExtrusionDlg.h" +#include "SMESHGUI_FieldSelectorWdg.h" #include "SMESHGUI_FileInfoDlg.h" #include "SMESHGUI_FileValidator.h" #include "SMESHGUI_FilterDlg.h" @@ -181,7 +182,8 @@ // of auto-color picking up #define SIMPLE_AUTOCOLOR -//namespace{ +namespace +{ // Declarations //============================================================= void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh, @@ -195,9 +197,13 @@ void Control( int theCommandID ); - // Definitions - //============================================================= + //================================================================================ + /*! + * \brief Reads meshes from file + */ + //================================================================================ + void ImportMeshesFromFile( SMESH::SMESH_Gen_ptr theComponentMesh, int theCommandID ) { @@ -596,6 +602,8 @@ if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) anInitialPath = QDir::currentPath(); + QList< QPair< GEOM::ListOfFields_var, QString > > aFieldList; + // Get a file name to write in and additional otions if ( isUNV || isDAT || isGMF ) // Export w/o options { @@ -681,8 +689,13 @@ QStringList checkBoxes; checkBoxes << QObject::tr("SMESH_AUTO_GROUPS") << QObject::tr("SMESH_AUTO_DIM"); + SMESHGUI_FieldSelectorWdg* fieldSelWdg = new SMESHGUI_FieldSelectorWdg(); + QList< QWidget* > wdgList; + if ( fieldSelWdg->GetAllFeilds( aMeshList, aFieldList )) + wdgList.append( fieldSelWdg ); + SalomeApp_CheckFileDlg* fd = - new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true ); + new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true, wdgList ); fd->setWindowTitle( aTitle ); fd->setNameFilters( filters ); fd->selectNameFilter( aDefaultFilter ); @@ -772,6 +785,9 @@ } toCreateGroups = fd->IsChecked(0); toFindOutDim = fd->IsChecked(1); + fieldSelWdg->GetSelectedFeilds(); + if ( !fieldSelWdg->parent() ) + delete fieldSelWdg; delete fd; } else @@ -808,12 +824,16 @@ { SMESH::SMESH_IDSource_var aMeshOrGroup = (*aMeshIter).first; SMESH::SMESH_Mesh_var aMeshItem = aMeshOrGroup->GetMesh(); - if ( aMeshOrGroup->_is_equivalent( aMeshItem )) + const GEOM::ListOfFields& fields = aFieldList[ aMeshIndex ].first.in(); + const QString& geoAssFields = aFieldList[ aMeshIndex ].second; + const bool hasFields = ( fields.length() || !geoAssFields.isEmpty() ); + if ( !hasFields && aMeshOrGroup->_is_equivalent( aMeshItem )) aMeshItem->ExportToMEDX( aFilename.toUtf8().data(), toCreateGroups, aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim ); else aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toUtf8().data(), toCreateGroups, - aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim ); + aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim, + fields, geoAssFields.toLatin1().data() ); } } else if ( isSAUV ) @@ -1281,6 +1301,7 @@ int deltaF = 0, deltaV = 0; int elem0dSize = 1; int ballSize = 1; + double ballScale = 1.0; int edgeWidth = 1; int outlineWidth = 1; double shrinkCoef = 0.0; @@ -1325,6 +1346,7 @@ anActor->GetBallColor( color[0], color[1], color[2] ); ballColor.setRgbF( color[0], color[1], color[2] ); ballSize = qMax( (int)anActor->GetBallSize(), 1 ); // minimum allowed size is 1 + ballScale = qMax( (double)anActor->GetBallScale(), 1e-2 ); // minimum allowed scale is 1e-2 // outlines: color anActor->GetOutlineColor( color[0], color[1], color[2] ); outlineColor.setRgbF( color[0], color[1], color[2] ); @@ -1381,6 +1403,7 @@ // balls: color, size dlg.setBallColor( ballColor ); dlg.setBallSize( ballSize ); + dlg.setBallScale( ballScale ); // orientation: color, scale, 3d flag dlg.setOrientationColor( orientationColor ); dlg.setOrientationSize( int( orientationScale * 100. ) ); @@ -1407,6 +1430,7 @@ elem0dSize = dlg.elem0dSize(); ballColor = dlg.ballColor(); ballSize = dlg.ballSize(); + ballScale = dlg.ballScale(); orientationColor = dlg.orientationColor(); orientationScale = dlg.orientationSize() / 100.; orientation3d = dlg.orientation3d(); @@ -1450,6 +1474,7 @@ // balls: color, size anActor->SetBallColor( ballColor.redF(), ballColor.greenF(), ballColor.blueF() ); anActor->SetBallSize( ballSize ); + anActor->SetBallScale( ballScale ); // orientation: color, scale, 3d flag anActor->SetFacesOrientationColor( orientationColor.redF(), orientationColor.greenF(), orientationColor.blueF() ); anActor->SetFacesOrientationScale( orientationScale ); @@ -1698,190 +1723,190 @@ QString RefType = CheckTypeObject(selected.First()); SALOME_ListIteratorOfListIO It(selected); for ( ; It.More(); It.Next()) - { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - QString Type = CheckTypeObject(IObject); - if (Type.compare(RefType) != 0) - return "Heterogeneous Selection"; - } + { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + QString Type = CheckTypeObject(IObject); + if (Type.compare(RefType) != 0) + return "Heterogeneous Selection"; + } return RefType; } +} //namespace - void SMESHGUI::OnEditDelete() - { - // VSR 17/11/04: check if all objects selected belong to SMESH component --> start - LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr(); - SALOME_ListIO selected; aSel->selectedObjects( selected, QString::null, false ); +void SMESHGUI::OnEditDelete() +{ + // VSR 17/11/04: check if all objects selected belong to SMESH component --> start + LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr(); + SALOME_ListIO selected; aSel->selectedObjects( selected, QString::null, false ); - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder(); - _PTR(GenericAttribute) anAttr; - _PTR(AttributeIOR) anIOR; - - int objectCount = 0; - QString aNameList; - QString aParentComponent = QString::null; - Handle(SALOME_InteractiveObject) anIO; - for( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() ) - { - anIO = anIt.Value(); - QString cur = anIO->getComponentDataType(); - _PTR(SObject) aSO = aStudy->FindObjectID(anIO->getEntry()); - if (aSO) { - // check if object is reference - _PTR(SObject) aRefSObj; - aNameList.append("\n - "); - if ( aSO->ReferencedObject( aRefSObj ) ) { - QString aRefName = QString::fromStdString ( aRefSObj->GetName() ); - aNameList.append( aRefName ); - cur = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() ); - } - else - aNameList.append(anIO->getName()); - objectCount++; - } + _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder(); + _PTR(GenericAttribute) anAttr; + _PTR(AttributeIOR) anIOR; - if( aParentComponent.isNull() ) - aParentComponent = cur; - else if( !aParentComponent.isEmpty() && aParentComponent!=cur ) - aParentComponent = ""; + int objectCount = 0; + QString aNameList; + QString aParentComponent = QString::null; + Handle(SALOME_InteractiveObject) anIO; + for( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() ) + { + anIO = anIt.Value(); + QString cur = anIO->getComponentDataType(); + _PTR(SObject) aSO = aStudy->FindObjectID(anIO->getEntry()); + if (aSO) { + // check if object is reference + _PTR(SObject) aRefSObj; + aNameList.append("\n - "); + if ( aSO->ReferencedObject( aRefSObj ) ) { + QString aRefName = QString::fromStdString ( aRefSObj->GetName() ); + aNameList.append( aRefName ); + cur = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() ); + } + else + aNameList.append(anIO->getName()); + objectCount++; } - if ( objectCount == 0 ) - return; // No Valid Objects Selected + if( aParentComponent.isNull() ) + aParentComponent = cur; + else if( !aParentComponent.isEmpty() && aParentComponent!=cur ) + aParentComponent = ""; + } - if ( aParentComponent != SMESHGUI::GetSMESHGUI()->name() ) { - SUIT_MessageBox::warning( SMESHGUI::desktop(), - QObject::tr("ERR_ERROR"), - QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg( SMESHGUI::GetSMESHGUI()->moduleName() ) ); - return; - } - // VSR 17/11/04: check if all objects selected belong to SMESH component <-- finish - if (SUIT_MessageBox::warning - (SMESHGUI::desktop(), - QObject::tr("SMESH_WRN_WARNING"), - QObject::tr("SMESH_REALLY_DELETE").arg( objectCount ).arg( aNameList ), - SUIT_MessageBox::Yes | SUIT_MessageBox::No, - SUIT_MessageBox::Yes) != SUIT_MessageBox::Yes) - return; + if ( objectCount == 0 ) + return; // No Valid Objects Selected - SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if ( aParentComponent != SMESHGUI::GetSMESHGUI()->name() ) { + SUIT_MessageBox::warning( SMESHGUI::desktop(), + QObject::tr("ERR_ERROR"), + QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg( SMESHGUI::GetSMESHGUI()->moduleName() ) ); + return; + } + // VSR 17/11/04: check if all objects selected belong to SMESH component <-- finish + if (SUIT_MessageBox::warning + (SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_REALLY_DELETE").arg( objectCount ).arg( aNameList ), + SUIT_MessageBox::Yes | SUIT_MessageBox::No, + SUIT_MessageBox::Yes) != SUIT_MessageBox::Yes) + return; - // Put the whole hierarchy of sub-objects of the selected SO's into a list and - // then treat them all starting from the deepest objects (at list back) - std::list< _PTR(SObject) > listSO; - SALOME_ListIteratorOfListIO It(selected); - for( ; It.More(); It.Next()) // loop on selected IO's - { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - if(IObject->hasEntry()) { - _PTR(SObject) aSO = aStudy->FindObjectID(IObject->getEntry()); - - // disable removal of "SMESH" component object - if(aSO->FindAttribute(anAttr, "AttributeIOR")){ - anIOR = anAttr; - if ( engineIOR() == anIOR->Value().c_str() ) - continue; - } - //Check the referenced object - _PTR(SObject) aRefSObject; - if ( aSO && aSO->ReferencedObject( aRefSObject ) ) - aSO = aRefSObject; // Delete main Object instead of reference - - listSO.push_back( aSO ); - std::list< _PTR(SObject) >::iterator itSO = --listSO.end(); - for ( ; itSO != listSO.end(); ++itSO ) { - _PTR(ChildIterator) it = aStudy->NewChildIterator( *itSO ); - for (it->InitEx(false); it->More(); it->Next()) - listSO.push_back( it->Value() ); - } + SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); + + // Put the whole hierarchy of sub-objects of the selected SO's into a list and + // then treat them all starting from the deepest objects (at list back) + std::list< _PTR(SObject) > listSO; + SALOME_ListIteratorOfListIO It(selected); + for( ; It.More(); It.Next()) // loop on selected IO's + { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + if(IObject->hasEntry()) { + _PTR(SObject) aSO = aStudy->FindObjectID(IObject->getEntry()); + + // disable removal of "SMESH" component object + if(aSO->FindAttribute(anAttr, "AttributeIOR")){ + anIOR = anAttr; + if ( engineIOR() == anIOR->Value().c_str() ) + continue; + } + //Check the referenced object + _PTR(SObject) aRefSObject; + if ( aSO && aSO->ReferencedObject( aRefSObject ) ) + aSO = aRefSObject; // Delete main Object instead of reference + + listSO.push_back( aSO ); + std::list< _PTR(SObject) >::iterator itSO = --listSO.end(); + for ( ; itSO != listSO.end(); ++itSO ) { + _PTR(ChildIterator) it = aStudy->NewChildIterator( *itSO ); + for (it->InitEx(false); it->More(); it->Next()) + listSO.push_back( it->Value() ); } } - // Check if none of objects to delete is referred from outside - std::list< _PTR(SObject) >::reverse_iterator ritSO; - for ( ritSO = listSO.rbegin(); ritSO != listSO.rend(); ++ritSO ) - { - _PTR(SObject) SO = *ritSO; - if ( !SO ) continue; - std::vector<_PTR(SObject)> aReferences = aStudy->FindDependances( *ritSO ); - for (size_t i = 0; i < aReferences.size(); i++) { - _PTR(SComponent) aComponent = aReferences[i]->GetFatherComponent(); - std::string type = aComponent->ComponentDataType(); - if ( type != "SMESH" ) - { - SUIT_MessageBox::warning( anApp->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("DEP_OBJECT") ); - return; // outside SMESH, there is an object depending on a SMESH object - } + } + // Check if none of objects to delete is referred from outside + std::list< _PTR(SObject) >::reverse_iterator ritSO; + for ( ritSO = listSO.rbegin(); ritSO != listSO.rend(); ++ritSO ) + { + _PTR(SObject) SO = *ritSO; + if ( !SO ) continue; + std::vector<_PTR(SObject)> aReferences = aStudy->FindDependances( *ritSO ); + for (size_t i = 0; i < aReferences.size(); i++) { + _PTR(SComponent) aComponent = aReferences[i]->GetFatherComponent(); + std::string type = aComponent->ComponentDataType(); + if ( type != "SMESH" ) + { + SUIT_MessageBox::warning( anApp->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("DEP_OBJECT") ); + return; // outside SMESH, there is an object depending on a SMESH object } } + } - // Call mesh->Clear() to prevent loading mesh from file caused by hypotheses removal - for( It.Initialize( selected ); It.More(); It.Next()) // loop on selected IO's - { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface< SMESH::SMESH_Mesh >( IObject ); - if ( !mesh->_is_nil() ) - mesh->Clear(); - } + // Call mesh->Clear() to prevent loading mesh from file caused by hypotheses removal + for( It.Initialize( selected ); It.More(); It.Next()) // loop on selected IO's + { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface< SMESH::SMESH_Mesh >( IObject ); + if ( !mesh->_is_nil() ) + mesh->Clear(); + } - // Treat SO's in the list starting from the back - aStudyBuilder->NewCommand(); // There is a transaction - for ( ritSO = listSO.rbegin(); ritSO != listSO.rend(); ++ritSO ) - { - _PTR(SObject) SO = *ritSO; - if ( !SO ) continue; - std::string anEntry = SO->GetID(); + // Treat SO's in the list starting from the back + aStudyBuilder->NewCommand(); // There is a transaction + for ( ritSO = listSO.rbegin(); ritSO != listSO.rend(); ++ritSO ) + { + _PTR(SObject) SO = *ritSO; + if ( !SO ) continue; + std::string anEntry = SO->GetID(); - /** Erase graphical object and remove all its data **/ - if(SO->FindAttribute(anAttr, "AttributeIOR")) { - SMESH::RemoveVisualObjectWithActors( anEntry.c_str(), true); - } - /** Remove an object from data structures **/ - SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( SO )); - SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( SO )); - if ( !aGroup->_is_nil() ) { // DELETE GROUP - SMESH::SMESH_Mesh_var aMesh = aGroup->GetMesh(); - aMesh->RemoveGroup( aGroup ); - } - else if ( !aSubMesh->_is_nil() ) { // DELETE SUBMESH - SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather(); - aMesh->RemoveSubMesh( aSubMesh ); + /** Erase graphical object and remove all its data **/ + if(SO->FindAttribute(anAttr, "AttributeIOR")) { + SMESH::RemoveVisualObjectWithActors( anEntry.c_str(), true); + } + /** Remove an object from data structures **/ + SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( SO )); + SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( SO )); + if ( !aGroup->_is_nil() ) { // DELETE GROUP + SMESH::SMESH_Mesh_var aMesh = aGroup->GetMesh(); + aMesh->RemoveGroup( aGroup ); + } + else if ( !aSubMesh->_is_nil() ) { // DELETE SUBMESH + SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather(); + aMesh->RemoveSubMesh( aSubMesh ); - _PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh); - if (aMeshSO) - SMESH::ModifiedMesh(aMeshSO, false, aMesh->NbNodes()==0); + _PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh); + if (aMeshSO) + SMESH::ModifiedMesh(aMeshSO, false, aMesh->NbNodes()==0); + } + else { + Handle(SALOME_InteractiveObject) IObject = new SALOME_InteractiveObject + ( anEntry.c_str(), engineIOR().toLatin1().data(), SO->GetName().c_str() ); + QString objType = CheckTypeObject(IObject); + if ( objType == "Hypothesis" || objType == "Algorithm" ) {// DELETE HYPOTHESIS + SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject); + aStudyBuilder->RemoveObjectWithChildren( SO ); } - else { - Handle(SALOME_InteractiveObject) IObject = new SALOME_InteractiveObject - ( anEntry.c_str(), engineIOR().toLatin1().data(), SO->GetName().c_str() ); - QString objType = CheckTypeObject(IObject); - if ( objType == "Hypothesis" || objType == "Algorithm" ) {// DELETE HYPOTHESIS - SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject); - aStudyBuilder->RemoveObjectWithChildren( SO ); - } - else {// default action: remove SObject from the study - // san - it's no use opening a transaction here until UNDO/REDO is provided in SMESH - //SUIT_Operation *op = new SALOMEGUI_ImportOperation(myActiveStudy); - //op->start(); - aStudyBuilder->RemoveObjectWithChildren( SO ); - //op->finish(); - } + else {// default action: remove SObject from the study + // san - it's no use opening a transaction here until UNDO/REDO is provided in SMESH + //SUIT_Operation *op = new SALOMEGUI_ImportOperation(myActiveStudy); + //op->start(); + aStudyBuilder->RemoveObjectWithChildren( SO ); + //op->finish(); } - } /* listSO back loop */ + } + } /* listSO back loop */ - aStudyBuilder->CommitCommand(); + aStudyBuilder->CommitCommand(); - /* Clear any previous selection */ - SALOME_ListIO l1; - aSel->setSelectedObjects( l1 ); + /* Clear any previous selection */ + SALOME_ListIO l1; + aSel->setSelectedObjects( l1 ); - SMESHGUI::GetSMESHGUI()->updateObjBrowser(); - } -//} namespace + SMESHGUI::GetSMESHGUI()->updateObjBrowser(); +} extern "C" { SMESHGUI_EXPORT CAM_Module* createModule() @@ -2668,7 +2693,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) else if ( theCommandID == 410 ) aDlg = new SMESHGUI_UnionOfTrianglesDlg(this); else if ( theCommandID == 419 ) - aDlg = new SMESHGUI_CuttingIntoTetraDlg(this); + aDlg = new SMESHGUI_SplitVolumesDlg(this); else aDlg = new SMESHGUI_CuttingOfQuadsDlg(this); @@ -5016,6 +5041,8 @@ void SMESHGUI::createPreferences() LightApp_Preferences::IntSpin, "SMESH", "elem0d_size"); int ballSize = addPreference(tr("PREF_BALL_SIZE"), elemGroup, LightApp_Preferences::IntSpin, "SMESH", "ball_elem_size"); + double ballScale = addPreference(tr("PREF_BALL_SCALE"), elemGroup, + LightApp_Preferences::DblSpin, "SMESH", "ball_elem_scale"); int elemW = addPreference(tr("PREF_WIDTH"), elemGroup, LightApp_Preferences::IntSpin, "SMESH", "element_width"); int outW = addPreference(tr("PREF_OUTLINE_WIDTH"), elemGroup, @@ -5029,6 +5056,10 @@ void SMESHGUI::createPreferences() setPreferenceProperty( ballSize, "min", 1 ); setPreferenceProperty( ballSize, "max", 10 ); + setPreferenceProperty( ballScale, "min", 1e-2 ); + setPreferenceProperty( ballScale, "max", 1e7 ); + setPreferenceProperty( ballScale, "step", 0.5 ); + setPreferenceProperty( elemW, "min", 1 ); setPreferenceProperty( elemW, "max", 5 ); @@ -5701,6 +5732,7 @@ void SMESHGUI::storeVisualParameters (int savePoint) sizeStr << QString::number((int)aSmeshActor->Get0DSize()); sizeStr << "ball"; sizeStr << QString::number((int)aSmeshActor->GetBallSize()); + sizeStr << QString::number((double)aSmeshActor->GetBallScale()); sizeStr << "shrink"; sizeStr << QString::number(aSmeshActor->GetShrinkFactor()); sizeStr << "orientation"; @@ -6285,6 +6317,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint) int outlineWidth = -1; int elem0dSize = -1; int ballSize = -1; + double ballScale = -1.0; double shrinkSize = -1; double orientationSize = -1; bool orientation3d = false; @@ -6312,11 +6345,16 @@ void SMESHGUI::restoreVisualParameters (int savePoint) i++; } else if ( type == "ball" ) { - // ball size is given as single integer value - if ( i+1 >= sizes.count() ) break; // format error - int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error - ballSize = v; - i++; + // balls are specified by two values: size:scale, where + // - size - is a integer value specifying size + // - scale - is a double value specifying scale factor + if ( i+1 >= sizes.count() ) break; // format error + int v1 = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error + if ( i+2 >= sizes.count() ) break; // format error + double v2 = sizes[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error + ballSize = v1; + ballScale = v2; + i += 2; } else if ( type == "shrink" ) { // shrink factor is given as single floating point value @@ -6352,6 +6390,9 @@ void SMESHGUI::restoreVisualParameters (int savePoint) // ball size if ( ballSize > 0 ) aSmeshActor->SetBallSize( ballSize ); + // ball scale + if ( ballScale > 0.0 ) + aSmeshActor->SetBallScale( ballScale ); // shrink factor if ( shrinkSize > 0 ) aSmeshActor->SetShrinkFactor( shrinkSize ); diff --git a/src/SMESHGUI/SMESHGUI.h b/src/SMESHGUI/SMESHGUI.h index 74978853c..5ae600d3a 100644 --- a/src/SMESHGUI/SMESHGUI.h +++ b/src/SMESHGUI/SMESHGUI.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx index 10dbf474e..9cbad861c 100644 --- a/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h b/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h index 8bf9ca1db..d887c1451 100644 --- a/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx index 87c9b0ba7..79588047c 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -230,7 +230,7 @@ namespace SMESH for (int i = 0, iEnd = theIds.size(); i < iEnd; i++){ anIds->InsertId(0,theIds[i]); vtkIdType anId = myBallPolyData->InsertNextCell(VTK_POLY_VERTEX,anIds); - double d = theDiameter; + double d = theDiameter * theActor->GetBallScale(); aScalars->SetTuple(anId,&d); anIds->Reset(); } diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h index aa4bd8e20..af99005e2 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx index 929469024..31a6214dc 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -947,7 +947,7 @@ void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument() // get selected mesh SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); + mySelectionMgr->selectedObjects(aList); if (aList.Extent() != 1) { diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h index fa5bb51ce..bc336e668 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx index a1cf8baaf..f25ed72cc 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h index 3236114b4..a4fd91a49 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx index 836087663..5df21bca0 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -32,6 +32,9 @@ #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_SpinBox.h" +#include +#include + #include #include @@ -463,69 +466,38 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule, SVTK_ViewWindow CBRelativeOrientation->addItem( tr("ALONG_ZX") ); GroupParametersLayout->addWidget( CBRelativeOrientation, 0, 1 ); - TLValueDistance = new QLabel( GroupParameters ); - TLValueDistance->setObjectName( "TLValueDistance" ); - TLValueDistance->setAlignment( Qt::AlignCenter ); - TLValueDistance->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - QFont fnt = TLValueDistance->font(); fnt.setBold( true ); TLValueDistance->setFont( fnt ); - GroupParametersLayout->addWidget( TLValueDistance, 1, 1 ); - TextLabelDistance = new QLabel( tr("SMESH_DISTANCE"), GroupParameters ); TextLabelDistance->setObjectName( "TextLabelDistance" ); - GroupParametersLayout->addWidget( TextLabelDistance, 2, 0 ); - - SliderDistance = new QSlider( Qt::Horizontal, GroupParameters ); - SliderDistance->setObjectName( "SliderDistance" ); - SliderDistance->setMinimumSize( 300, 0 ); - SliderDistance->setMinimum( 0 ); - SliderDistance->setMaximum( 100 ); - SliderDistance->setSingleStep( 1 ); - SliderDistance->setPageStep( 10 ); - SliderDistance->setTracking( false ); - GroupParametersLayout->addWidget( SliderDistance, 2, 1 ); - - TLValueRotation1 = new QLabel( GroupParameters ); - TLValueRotation1->setObjectName( "TLValueRotation1" ); - TLValueRotation1->setAlignment( Qt::AlignCenter ); - TLValueRotation1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - TLValueRotation1->setFont( fnt ); - GroupParametersLayout->addWidget( TLValueRotation1, 3, 1 ); + GroupParametersLayout->addWidget( TextLabelDistance, 1, 0 ); + + SpinSliderDistance = new QtxDoubleSpinSlider( 0., 1., 0.01, GroupParameters ); + SpinSliderDistance->setObjectName( "SpinSliderDistance" ); + SpinSliderDistance->setPrecision( precision ); + QFont fnt = SpinSliderDistance->font(); fnt.setBold( true ); SpinSliderDistance->setFont( fnt ); + GroupParametersLayout->addWidget( SpinSliderDistance, 1, 1 ); + + QString aUnitRot = "\xB0"; TextLabelRotation1 = new QLabel( tr("ROTATION_AROUND_X_Y2Z"), GroupParameters ); TextLabelRotation1->setObjectName( "TextLabelRotation1" ); - GroupParametersLayout->addWidget( TextLabelRotation1, 4, 0 ); - - SliderRotation1 = new QSlider( Qt::Horizontal, GroupParameters ); - SliderRotation1->setObjectName( "SliderRotation1" ); - SliderRotation1->setMinimumSize( 300, 0 ); - SliderRotation1->setMinimum( -180 ); - SliderRotation1->setMaximum( 180 ); - SliderRotation1->setSingleStep( 1 ); - SliderRotation1->setPageStep( 10 ); - SliderRotation1->setTracking(false); - GroupParametersLayout->addWidget( SliderRotation1, 4, 1 ); - - TLValueRotation2 = new QLabel( GroupParameters ); - TLValueRotation2->setObjectName( "TLValueRotation2" ); - TLValueRotation2->setAlignment( Qt::AlignCenter ); - TLValueRotation2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - TLValueRotation2->setFont( fnt ); - GroupParametersLayout->addWidget( TLValueRotation2, 5, 1 ); + GroupParametersLayout->addWidget( TextLabelRotation1, 2, 0 ); + + SpinSliderRotation1 = new QtxIntSpinSlider( -180, 180, 1, GroupParameters ); + SpinSliderRotation1->setObjectName( "SpinSliderRotation1" ); + SpinSliderRotation1->setUnit( aUnitRot ); + SpinSliderRotation1->setFont( fnt ); + GroupParametersLayout->addWidget( SpinSliderRotation1, 2, 1 ); TextLabelRotation2 = new QLabel(tr("ROTATION_AROUND_Y_X2Z"), GroupParameters); TextLabelRotation2->setObjectName( "TextLabelRotation2" ); TextLabelRotation2->setObjectName( "TextLabelRotation2" ); - GroupParametersLayout->addWidget( TextLabelRotation2, 6, 0 ); - - SliderRotation2 = new QSlider( Qt::Horizontal, GroupParameters ); - SliderRotation2->setObjectName( "SliderRotation2" ); - SliderRotation2->setMinimumSize( 300, 0 ); - SliderRotation2->setMinimum( -180 ); - SliderRotation2->setMaximum( 180 ); - SliderRotation2->setSingleStep( 1 ); - SliderRotation2->setPageStep( 10 ); - SliderRotation2->setTracking(false); - GroupParametersLayout->addWidget( SliderRotation2, 6, 1 ); + GroupParametersLayout->addWidget( TextLabelRotation2, 3, 0 ); + + SpinSliderRotation2 = new QtxIntSpinSlider( -180, 180, 1, GroupParameters ); + SpinSliderRotation2->setObjectName( "SpinSliderRotation2" ); + SpinSliderRotation2->setUnit( aUnitRot ); + SpinSliderRotation2->setFont( fnt ); + GroupParametersLayout->addWidget( SpinSliderRotation2, 3, 1 ); /***************************************************************/ QWidget* CheckBoxWidget = new QWidget( this ); @@ -598,12 +570,9 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule, SVTK_ViewWindow connect( CBAbsoluteOrientation, SIGNAL ( activated ( int ) ), this, SLOT( onSelectAbsoluteOrientation( int ) ) ) ; connect( CBRelativeOrientation, SIGNAL( activated( int ) ), this, SLOT( onSelectRelativeOrientation( int ) ) ); - connect( SliderDistance, SIGNAL( sliderMoved( int ) ), this, SLOT( SliderDistanceHasMoved( int ) ) ); - connect( SliderDistance, SIGNAL( valueChanged( int ) ), this, SLOT( SliderDistanceHasMoved( int ) ) ); - connect( SliderRotation1, SIGNAL( sliderMoved( int ) ), this, SLOT( SliderRotation1HasMoved( int ) ) ); - connect( SliderRotation1, SIGNAL( valueChanged( int ) ), this, SLOT( SliderRotation1HasMoved( int ) ) ); - connect( SliderRotation2, SIGNAL( sliderMoved( int ) ), this, SLOT( SliderRotation2HasMoved( int ) ) ); - connect( SliderRotation2, SIGNAL( valueChanged( int ) ), this, SLOT( SliderRotation2HasMoved( int ) ) ); + connect( SpinSliderDistance, SIGNAL( valueChanged( double ) ), this, SLOT( SetCurrentPlaneParam() ) ); + connect( SpinSliderRotation1, SIGNAL( valueChanged( int ) ), this, SLOT( SetCurrentPlaneParam() ) ); + connect( SpinSliderRotation2, SIGNAL( valueChanged( int ) ), this, SLOT( SetCurrentPlaneParam() ) ); connect( PreviewCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( OnPreviewToggle( bool ) ) ); connect( AutoApplyCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( onAutoApply( bool ) ) ); @@ -652,7 +621,7 @@ SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg() */ double SMESHGUI_ClippingDlg::getDistance() const { - return TLValueDistance->text().toDouble(); + return SpinSliderDistance->value(); } /*! @@ -660,7 +629,7 @@ double SMESHGUI_ClippingDlg::getDistance() const */ void SMESHGUI_ClippingDlg::setDistance( const double theDistance ) { - SliderDistance->setValue( theDistance*100 ); + SpinSliderDistance->setValue( theDistance ); } /*! @@ -668,7 +637,7 @@ void SMESHGUI_ClippingDlg::setDistance( const double theDistance ) */ double SMESHGUI_ClippingDlg::getRotation1() const { - return TLValueRotation1->text().remove("\xB0").toInt(); + return SpinSliderRotation1->value(); } /*! @@ -676,7 +645,7 @@ double SMESHGUI_ClippingDlg::getRotation1() const */ double SMESHGUI_ClippingDlg::getRotation2() const { - return TLValueRotation2->text().remove("\xB0").toInt(); + return SpinSliderRotation2->value(); } /*! @@ -684,8 +653,8 @@ double SMESHGUI_ClippingDlg::getRotation2() const */ void SMESHGUI_ClippingDlg::setRotation (const double theRot1, const double theRot2) { - SliderRotation1->setValue( theRot1 ); - SliderRotation2->setValue( theRot2 ); + SpinSliderRotation1->setValue( int(floor(theRot1)) ); + SpinSliderRotation2->setValue( int(floor(theRot2)) ); } /*! @@ -762,22 +731,22 @@ void rotationToNormal ( double theRotation[2], switch ( theOrientation ) { case 0: case 1: - theDir[0][1] = anU[0]; - theDir[0][2] = aV[0]; - theDir[1][0] = anU[1]; - theDir[1][2] = aV[1]; + theDir[0][1] = anU[0]; + theDir[0][2] = aV[0]; + theDir[1][0] = anU[1]; + theDir[1][2] = aV[1]; break; case 2: - theDir[0][2] = anU[0]; - theDir[0][0] = aV[0]; - theDir[1][1] = anU[1]; - theDir[1][0] = aV[1]; + theDir[0][2] = anU[0]; + theDir[0][0] = aV[0]; + theDir[1][1] = anU[1]; + theDir[1][0] = aV[1]; break; case 3: - theDir[0][0] = anU[0]; - theDir[0][1] = aV[0]; - theDir[1][2] = anU[1]; - theDir[1][1] = aV[1]; + theDir[0][0] = anU[0]; + theDir[0][1] = aV[0]; + theDir[1][2] = anU[1]; + theDir[1][1] = aV[1]; break; } @@ -799,12 +768,12 @@ bool SMESHGUI_ClippingDlg::AddPlane ( SMESH::TActorList theActorList, int anOrientation; if ( thePlane->PlaneMode == SMESH::Absolute ) - anOrientation = thePlane->myAbsoluteOrientation; + anOrientation = thePlane->myAbsoluteOrientation; else if ( thePlane->PlaneMode == SMESH::Relative ) - anOrientation = thePlane->myRelativeOrientation + 1; + anOrientation = thePlane->myRelativeOrientation + 1; if ( anOrientation == 0 ) { - // compute a direction for plane in absolute mode + // compute a direction for plane in absolute mode double znam = sqrt( thePlane->Dx*thePlane->Dx + thePlane->Dy*thePlane->Dy + thePlane->Dz*thePlane->Dz ); double aRotation = acos( thePlane->Dy/znam )/aCoeff; if ( thePlane->Dy >= 0.0 && thePlane->Dz >= 0.0 ) thePlane->myAngle[0] = 90.0 + aRotation; @@ -905,10 +874,10 @@ bool SMESHGUI_ClippingDlg::AddPlane ( SMESH::TActorList theActorList, for ( ; anIter != theActorList.end(); anIter++ ) if( vtkActor* aVTKActor = *anIter ) if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) ) { - if( thePlane->IsOpenGLClipping ) + if( thePlane->IsOpenGLClipping ) anActor->AddOpenGLClippingPlane( thePlane->InvertPlane() ); - else - anActor->AddClippingPlane( thePlane ); + else + anActor->AddClippingPlane( thePlane ); } return true; @@ -1008,13 +977,10 @@ void SMESHGUI_ClippingDlg::initParam() CBAbsoluteOrientation->setCurrentIndex(0); - TLValueDistance->setText( "0.5" ); - TLValueRotation1->setText( "0\xB0" ); - TLValueRotation2->setText( "0\xB0" ); + SpinSliderDistance->setValue( 0.5 ); + SpinSliderRotation1->setValue( 0 ); + SpinSliderRotation2->setValue( 0 ); CBRelativeOrientation->setCurrentIndex( 0 ); - SliderDistance->setValue( 50 ); - SliderRotation1->setValue( 0 ); - SliderRotation2->setValue( 0 ); } /*! @@ -1066,9 +1032,9 @@ void SMESHGUI_ClippingDlg::synchronize() } else if ( CurrentMode == SMESH::Relative ) { CBRelativeOrientation->setEnabled( anIsControlsEnable ); - SliderDistance->setEnabled( anIsControlsEnable ); - SliderRotation1->setEnabled( anIsControlsEnable ); - SliderRotation2->setEnabled( anIsControlsEnable ); + SpinSliderDistance->setEnabled( anIsControlsEnable ); + SpinSliderRotation1->setEnabled( anIsControlsEnable ); + SpinSliderRotation2->setEnabled( anIsControlsEnable ); } } @@ -1167,9 +1133,13 @@ void SMESHGUI_ClippingDlg::updateActorItem( QListWidgetItem* theItem, else if( theItem->checkState() == Qt::Unchecked && anIsPushed ) anActorList.remove( anActor ); - SMESH::ComputeBounds( anActorList, myBounds ); - myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2], - myBounds[3], myBounds[4], myBounds[5] ); + if( SMESH::ComputeBounds( anActorList, myBounds ) ) { + myPreviewWidget->On(); + myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2], + myBounds[3], myBounds[4], myBounds[5] ); + } + else + myPreviewWidget->Off(); } } } @@ -1278,9 +1248,14 @@ void SMESHGUI_ClippingDlg::ClickOnNew() bool anIsBlocked = ActorList->blockSignals( true ); - SMESH::ComputeBounds( anActorList, myBounds ); - myPreviewWidget->PlaceWidget( myBounds[0],myBounds[1],myBounds[2], - myBounds[3],myBounds[4],myBounds[5] ); + if( SMESH::ComputeBounds( anActorList, myBounds ) ) { + myPreviewWidget->On(); + myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2], + myBounds[3], myBounds[4], myBounds[5] ); + } + else + myPreviewWidget->Off(); + synchronize(); SetCurrentPlaneParam(); @@ -1365,9 +1340,15 @@ void SMESHGUI_ClippingDlg::onSelectPlane ( int theIndex ) } } myIsSelectPlane = false; - SMESH::ComputeBounds( aPlaneData.ActorList, myBounds ); - myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2], - myBounds[3], myBounds[4], myBounds[5] ); + + if( SMESH::ComputeBounds( aPlaneData.ActorList, myBounds ) ) { + myPreviewWidget->On(); + myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2], + myBounds[3], myBounds[4], myBounds[5] ); + } + else + myPreviewWidget->Off(); + SetCurrentPlaneParam(); // Actors @@ -1454,9 +1435,9 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam() double aRot[2] = { getRotation1(), getRotation2() }; int anOrient; if ( aPlane->PlaneMode == SMESH::Absolute ) - anOrient = CBAbsoluteOrientation->currentIndex(); + anOrient = CBAbsoluteOrientation->currentIndex(); else if ( aPlane->PlaneMode == SMESH::Relative ) - anOrient = CBRelativeOrientation->currentIndex() + 1; + anOrient = CBRelativeOrientation->currentIndex() + 1; if ( aPlane->PlaneMode == SMESH::Relative ) { aPlane->myAngle[0] = aRot[0]; @@ -1466,7 +1447,7 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam() } if ( anOrient == 0 ) { - // compute a direction for plane in absolute mode + // compute a direction for plane in absolute mode double znam = sqrt( aPlane->Dx*aPlane->Dx + aPlane->Dy*aPlane->Dy + aPlane->Dz*aPlane->Dz ); double aRotation = acos( aPlane->Dy/znam )/aCoeff; if ( aPlane->Dy >= 0.0 && aPlane->Dz >= 0.0 ) aRot[0] = 90.0 + aRotation; @@ -1508,7 +1489,7 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam() anOrigin[1] = aPlane->Y; anOrigin[2] = aPlane->Z; } - + if( anIsOk ) { aPlane->SetNormal( aNormal ); aPlane->SetOrigin( anOrigin ); @@ -1614,7 +1595,7 @@ void SMESHGUI_ClippingDlg::setBoundsForPreviewWidget() if( anOrigin[2] < aBounds[4] ) { myBounds[4] = anOrigin[2]; isBoundsChanged = true; } if( anOrigin[2] > aBounds[5] ) { - myBounds[5] = anOrigin[2]; isBoundsChanged = true; } + myBounds[5] = anOrigin[2]; isBoundsChanged = true; } } if( isBoundsChanged ) @@ -1698,10 +1679,8 @@ void SMESHGUI_ClippingDlg::absolutePlaneToRelative ( double theOrigin[3], double else if( aDirection[0] < 0 && aDirection[1] < 0 && aDirection[2] < 0 && aRot[0] > 0 ) { aRot[0] = aRotation1 + 270.0; aRot[1] = aRotation2 + 90.0; } - SliderRotation1HasMoved( qRound( aRot[0] ) ); - SliderRotation1->setValue( qRound( aRot[0] ) ); - SliderRotation2HasMoved( qRound( aRot[1] ) ); - SliderRotation2->setValue( qRound( aRot[1] ) ); + SpinSliderRotation1->setValue( qRound( aRot[0] ) ); + SpinSliderRotation2->setValue( qRound( aRot[1] ) ); int aCurPlaneIndex = ComboBoxPlanes->currentIndex(); const SMESH::TPlaneData& aPlaneData = myPlanes[ aCurPlaneIndex ]; @@ -1717,8 +1696,7 @@ void SMESHGUI_ClippingDlg::absolutePlaneToRelative ( double theOrigin[3], double else if( aDist < 0.0 ) aDist = 0.0; - SliderDistanceHasMoved( qRound( aDist*100 ) ); - SliderDistance->setValue( qRound( aDist*100 ) ); + SpinSliderDistance->setValue( qRound( aDist*100 ) ); return; } @@ -1803,10 +1781,10 @@ void SMESHGUI_ClippingDlg::ClickOnApply() for( ; anIter3 != anActorList.end(); anIter3++ ) if( vtkActor* aVTKActor = *anIter3 ) if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) ) { - if( anOrientedPlane->IsOpenGLClipping ) + if( anOrientedPlane->IsOpenGLClipping ) anActor->AddOpenGLClippingPlane( anOrientedPlane->InvertPlane() ); - else - anActor->AddClippingPlane( anOrientedPlane ); + else + anActor->AddClippingPlane( anOrientedPlane ); } SMESH::ClippingPlaneInfo aClippingPlaneInfo; @@ -1816,11 +1794,9 @@ void SMESHGUI_ClippingDlg::ClickOnApply() aClippingPlaneInfoList.push_back( aClippingPlaneInfo ); } - SMESH_Actor* anSMESHActor; anAllActors->InitTraversal(); while( vtkActor* aVTKActor = anAllActors->GetNextActor() ) if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) ) { - anSMESHActor = anActor; anActor->SetOpenGLClippingPlane(); } @@ -1851,34 +1827,6 @@ void SMESHGUI_ClippingDlg::ClickOnHelp() } } -/*! - SLOT: Called when value of slider distance change -*/ -void SMESHGUI_ClippingDlg::SliderDistanceHasMoved( int value ) -{ - double new_value = value/100.; - TLValueDistance->setText( QString("%1").arg( new_value ) ); - SetCurrentPlaneParam(); -} - -/*! - SLOT: Called when value of slider rotation1 change -*/ -void SMESHGUI_ClippingDlg::SliderRotation1HasMoved( int value ) -{ - TLValueRotation1->setText( QString("%1\xB0").arg( value ) ); - SetCurrentPlaneParam(); -} - -/*! - SLOT: Called when value of slider rotation2 change -*/ -void SMESHGUI_ClippingDlg::SliderRotation2HasMoved( int value ) -{ - TLValueRotation2->setText( QString("%1\xB0").arg( value ) ); - SetCurrentPlaneParam(); -} - void SMESHGUI_ClippingDlg::onSelectAbsoluteOrientation( int mode ) { bool isUserMode = (mode==0); diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.h b/src/SMESHGUI/SMESHGUI_ClippingDlg.h index b66c6f149..bab2458ed 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.h +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -60,6 +60,8 @@ class SALOME_Actor; class SMESHGUI; class SMESH_Actor; class QtxDoubleSpinBox; +class QtxDoubleSpinSlider; +class QtxIntSpinSlider; class vtkActor; class vtkDataSetMapper; class vtkPlaneSource; @@ -224,12 +226,9 @@ private: QLabel* TextLabelDistance; QLabel* TextLabelRotation1; QLabel* TextLabelRotation2; - QLabel* TLValueDistance; - QLabel* TLValueRotation1; - QLabel* TLValueRotation2; - QSlider* SliderDistance; - QSlider* SliderRotation1; - QSlider* SliderRotation2; + QtxDoubleSpinSlider* SpinSliderDistance; + QtxIntSpinSlider* SpinSliderRotation1; + QtxIntSpinSlider* SpinSliderRotation2; QComboBox* CBRelativeOrientation; QCheckBox* PreviewCheckBox; @@ -266,9 +265,6 @@ public slots: void ClickOnApply(); void ClickOnHelp(); - void SliderDistanceHasMoved(int); - void SliderRotation1HasMoved(int); - void SliderRotation2HasMoved(int); void onSelectAbsoluteOrientation( int ); void onSelectRelativeOrientation( int ); void onReset(); diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index e99cf69b5..c0524289c 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -382,7 +382,11 @@ namespace SMESH if ( !geom->_is_nil() ) { GEOM::ListOfLong_var list = geom->GetSubShapeIndices(); if ( list->length() == 1 && list[0] == subShapeID ) - subSO = it->Value(); + { + GEOM::GEOM_Object_var mainGO = geom->GetMainShape(); + if ( aMainShape->IsSame( mainGO )) + subSO = it->Value(); + } } } } @@ -439,8 +443,10 @@ namespace SMESH QString shapeText(int subShapeID, GEOM::GEOM_Object_var aMainShape ) { QString text; - if ( _PTR(SObject) aSO = getSubShapeSO( subShapeID, aMainShape )) - text = aSO->GetName().c_str(); + if ( _PTR(SObject) aSO = getSubShapeSO( subShapeID, aMainShape )) { + text = aSO->GetName().c_str(); + text += QString(" (%1)").arg( aSO->GetID().c_str() ); + } else { text = QString("#%1").arg( subShapeID ); GEOM::GEOM_Object_wrap shape = getSubShape( subShapeID, aMainShape ); @@ -613,8 +619,8 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent, bool ForEval) // add all widgets to aFrame QVBoxLayout* aLay = new QVBoxLayout(aFrame); - aLay->setMargin( 0 ); - aLay->setSpacing( 0 ); + aLay->setMargin( MARGIN ); + aLay->setSpacing( SPACING ); aLay->addWidget( aPixGrp ); aLay->addWidget( nameBox ); aLay->addWidget( myBriefInfo ); @@ -748,10 +754,12 @@ SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget QLabel * nbNodesName = new QLabel(tr("SMESH_MESHINFO_NODES"), this ); QLabel * nbElemsName = new QLabel(tr("SMESH_MESHINFO_ELEMENTS"), this ); - QLabel * freeRAMName = new QLabel(tr("SMESH_FREERAM"), this ); nbNodesLabel = new QLabel("0", this ); nbElemsLabel = new QLabel("0", this ); +#ifndef WIN32 + QLabel * freeRAMName = new QLabel(tr("SMESH_FREERAM"), this ); freeRAMLabel = new QLabel("", this ); +#endif progressBar = new QProgressBar(this); progressBar->setMinimum( 0 ); progressBar->setMaximum( 1000 ); @@ -1189,7 +1197,8 @@ void SMESHGUI_BaseComputeOp::onPublishShape() if ( so->_is_nil() ) { CORBA::String_var name = so->GetName(); CORBA::String_var entry = so->GetID(); - table()->item( r, COL_SHAPE )->setText( name.in() ); + QString shapeText = QString("%1 (%2)").arg( name.in() ).arg( entry.in() ); + table()->item( r, COL_SHAPE )->setText( shapeText ); table()->item( r, COL_PUBLISHED )->setText( entry.in() ); } break; @@ -1202,7 +1211,8 @@ void SMESHGUI_BaseComputeOp::onPublishShape() if ( !so->_is_nil() ) { CORBA::String_var name = so->GetName(); CORBA::String_var entry = so->GetID(); - table()->item( row, COL_SHAPE )->setText( name.in() ); + QString shapeText = QString("%1 (%2)").arg( name.in() ).arg( entry.in() ); + table()->item( row, COL_SHAPE )->setText( shapeText ); table()->item( row, COL_PUBLISHED )->setText( entry.in() ); } } diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.h b/src/SMESHGUI/SMESHGUI_ComputeDlg.h index d67709d37..ad1bd8f98 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.h +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx b/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx index cc6fec761..59855bb49 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.h b/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.h index 458eb4806..d3b461fe5 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.h +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx index 33e1aaf07..70b7493cb 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.h b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.h index f18c5810a..023789c66 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.h +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx index 0e1f921cc..39665f3a5 100644 --- a/src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -477,7 +477,7 @@ void SMESHGUI_CopyMeshDlg::SelectionIntoArgument() // get selected mesh SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); + mySelectionMgr->selectedObjects(aList); int nbSel = aList.Extent(); if (nbSel != 1) return; diff --git a/src/SMESHGUI/SMESHGUI_CopyMeshDlg.h b/src/SMESHGUI/SMESHGUI_CopyMeshDlg.h index 7622662da..a81a37669 100644 --- a/src/SMESHGUI/SMESHGUI_CopyMeshDlg.h +++ b/src/SMESHGUI/SMESHGUI_CopyMeshDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx index 9f2daa28d..34771755d 100755 --- a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.h b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.h index c4acc0e39..515c230d1 100755 --- a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.h +++ b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx index 8b52bb3f9..73fac9a84 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h index 57469283d..4f6de47b9 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx index e619b81f0..5d0a1ee7d 100644 --- a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h index 9c69f9427..e9f3f2ade 100644 --- a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h +++ b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Dialog.cxx b/src/SMESHGUI/SMESHGUI_Dialog.cxx index 23525fe69..a5fcf31c5 100644 --- a/src/SMESHGUI/SMESHGUI_Dialog.cxx +++ b/src/SMESHGUI/SMESHGUI_Dialog.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -46,9 +46,10 @@ SMESHGUI_Dialog::SMESHGUI_Dialog( QWidget* parent, const bool modal, : LightApp_Dialog( parent == 0 ? desktop() : parent, "", modal, allowResize, flags ) { int pr = prefix( "SMESH" ); - typeName( pr + SMESH::MESH ) = tr( "DLG_MESH" ); + typeName( pr + SMESH::MESH ) = tr( "DLG_MESH" ); typeName( pr + SMESH::HYPOTHESIS ) = tr( "DLG_HYPO" ); - typeName( pr + SMESH::ALGORITHM ) = tr( "DLG_ALGO" ); + typeName( pr + SMESH::ALGORITHM ) = tr( "DLG_ALGO" ); + typeName( prefix( "GEOM" ) ) = tr( "DLG_GEOM" ); setButtonText(1, tr("SMESH_BUT_APPLY_AND_CLOSE")); //rename OK to Apply and Close if ( flags & Close ) setButtonPosition( Right, Close ); diff --git a/src/SMESHGUI/SMESHGUI_Dialog.h b/src/SMESHGUI/SMESHGUI_Dialog.h index 5d250a16b..582af4243 100644 --- a/src/SMESHGUI/SMESHGUI_Dialog.h +++ b/src/SMESHGUI/SMESHGUI_Dialog.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Displayer.cxx b/src/SMESHGUI/SMESHGUI_Displayer.cxx index 58a34d61b..4c672d2b5 100644 --- a/src/SMESHGUI/SMESHGUI_Displayer.cxx +++ b/src/SMESHGUI/SMESHGUI_Displayer.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Displayer.h b/src/SMESHGUI/SMESHGUI_Displayer.h index c0b10b05f..446bedce1 100644 --- a/src/SMESHGUI/SMESHGUI_Displayer.h +++ b/src/SMESHGUI/SMESHGUI_Displayer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx index 24d4a37cb..368aa77ca 100644 --- a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -110,6 +110,7 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) QPixmap iconWithoutElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES"))); QPixmap iconWithElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES_WITH_ELEM"))); QPixmap iconElemOnly (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_ELEM_ONLY"))); + QPixmap iconGrpBoundary (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_GROUP_BOUNDARY"))); QPixmap iconSelect (aResMgr->loadPixmap("SMESH", tr("ICON_SELECT"))); // Main layout @@ -130,13 +131,17 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) aRadioButton2->setIcon(iconWithElem); QRadioButton* aRadioButton3 = new QRadioButton(aConstructorsBox); aRadioButton3->setIcon(iconElemOnly); + QRadioButton* aRadioButton4 = new QRadioButton(aConstructorsBox); + aRadioButton4->setIcon(iconGrpBoundary); aConstructorsBoxLayout->addWidget(aRadioButton1); aConstructorsBoxLayout->addWidget(aRadioButton2); aConstructorsBoxLayout->addWidget(aRadioButton3); + aConstructorsBoxLayout->addWidget(aRadioButton4); myGroupConstructors->addButton(aRadioButton1, 0); myGroupConstructors->addButton(aRadioButton2, 1); myGroupConstructors->addButton(aRadioButton3, 2); + myGroupConstructors->addButton(aRadioButton4, 3); // Arguments myGroupArguments = new QGroupBox(this); @@ -162,8 +167,8 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) myLineEdit3 = new QLineEdit(myGroupArguments); myLineEdit3->setReadOnly(true); - myCheckBoxNewElemGroup = new QCheckBox(tr("CONSTRUCT_NEW_GROUP_ELEMENTS"), myGroupArguments); - myCheckBoxNewNodeGroup = new QCheckBox(tr("CONSTRUCT_NEW_GROUP_NODES"), myGroupArguments); + myCheckBox1 = new QCheckBox(tr("CONSTRUCT_NEW_GROUP_ELEMENTS"), myGroupArguments); + myCheckBox2 = new QCheckBox(tr("CONSTRUCT_NEW_GROUP_NODES"), myGroupArguments); aGroupArgumentsLayout->addWidget(myTextLabel1, 0, 0); aGroupArgumentsLayout->addWidget(mySelectButton1, 0, 1); @@ -174,8 +179,8 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) aGroupArgumentsLayout->addWidget(myTextLabel3, 2, 0); aGroupArgumentsLayout->addWidget(mySelectButton3, 2, 1); aGroupArgumentsLayout->addWidget(myLineEdit3, 2, 2); - aGroupArgumentsLayout->addWidget(myCheckBoxNewElemGroup, 3, 0); - aGroupArgumentsLayout->addWidget(myCheckBoxNewNodeGroup, 4, 0); + aGroupArgumentsLayout->addWidget(myCheckBox1, 3, 0); + aGroupArgumentsLayout->addWidget(myCheckBox2, 4, 0); aGroupArgumentsLayout->setRowStretch(5, 1); // Buttons @@ -207,8 +212,8 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) aMainLayout->addWidget(myGroupArguments); aMainLayout->addWidget(aGroupButtons); - myCheckBoxNewElemGroup->setChecked(true); - myCheckBoxNewNodeGroup->setChecked(true); + myCheckBox1->setChecked(true); + myCheckBox2->setChecked(true); // Initialize the dialog Init(); @@ -223,6 +228,8 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) connect(mySelectButton2, SIGNAL (clicked()), this, SLOT(onEditCurrentArgument())); connect(mySelectButton3, SIGNAL (clicked()), this, SLOT(onEditCurrentArgument())); + connect(myCheckBox2, SIGNAL(stateChanged(int)), SLOT(updateButtons())); + connect(myButtonOk, SIGNAL(clicked()), this, SLOT(onOk())); connect(myButtonClose, SIGNAL(clicked()), this, SLOT(reject())); connect(myButtonApply, SIGNAL(clicked()), this, SLOT(onApply())); @@ -298,8 +305,9 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId) myTextLabel1->setText(tr("GROUP_NODES_TO_DUPLICATE")); myTextLabel2->setText(tr("GROUP_NODES_TO_REPLACE")); - myCheckBoxNewElemGroup->hide(); - myCheckBoxNewNodeGroup->show(); + myCheckBox1->hide(); + myCheckBox2->show(); + myCheckBox2->setText( tr("CONSTRUCT_NEW_GROUP_NODES")); // Hide the third field myTextLabel2->show(); @@ -319,8 +327,10 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId) myTextLabel2->setText(tr("GROUP_NODES_NOT_DUPLICATE")); myTextLabel3->setText(tr("GROUP_ELEMS_TO_REPLACE")); - myCheckBoxNewElemGroup->show(); - myCheckBoxNewNodeGroup->show(); + myCheckBox1->show(); + myCheckBox2->show(); + myCheckBox1->setText( tr("CONSTRUCT_NEW_GROUP_ELEMENTS")); + myCheckBox2->setText( tr("CONSTRUCT_NEW_GROUP_NODES")); // Show the third field myTextLabel2->show(); @@ -338,8 +348,30 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId) myGroupArguments->setTitle(tr("DUPLICATION_ONLY_ELEMS")); myTextLabel1->setText(tr("GROUP_ELEMS_TO_DUPLICATE")); - myCheckBoxNewElemGroup->show(); - myCheckBoxNewNodeGroup->hide(); + myCheckBox1->show(); + myCheckBox1->setText( tr("CONSTRUCT_NEW_GROUP_ELEMENTS")); + myCheckBox2->hide(); + + // Hide the second and the third field + myTextLabel2->hide(); + mySelectButton2->hide(); + myLineEdit2->hide(); + myTextLabel3->hide(); + mySelectButton3->hide(); + myLineEdit3->hide(); + + break; + } + case 3: + { + // Set text to the group of arguments and to all the labels + myGroupArguments->setTitle(tr("DUPLICATION_GROUP_BOUNDARY")); + myTextLabel1->setText(tr("GROUP_VOLUME_GROUPS")); + + myCheckBox1->show(); + myCheckBox2->show(); + myCheckBox1->setText( tr("CREATE_JOINT_ELEMENTS")); + myCheckBox2->setText( tr("ON_ALL_BOUNDARIES")); // Hide the second and the third field myTextLabel2->hide(); @@ -352,7 +384,9 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId) break; } } - + myGroupArguments->hide(); + myGroupArguments->show(); + this->resize(this->sizeHint().width(), this->minimumSizeHint().height()); // Process selection onSelectionChanged(); } @@ -367,8 +401,8 @@ bool SMESHGUI_DuplicateNodesDlg::onApply() BusyLocker lock( myBusy ); - bool toCreateElemGroup = myCheckBoxNewElemGroup->isChecked(); - bool toCreateNodeGroup = myCheckBoxNewNodeGroup->isChecked(); + bool toCreateElemGroup = myCheckBox1->isChecked(); + bool toCreateNodeGroup = myCheckBox2->isChecked(); int operationMode = myGroupConstructors->checkedId(); // Apply changes @@ -451,14 +485,28 @@ bool SMESHGUI_DuplicateNodesDlg::onApply() } break; } + case 3: + { + bool createJointElems = myCheckBox1->isChecked(); + bool onAllBoundaries = myCheckBox2->isChecked(); + + SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups(); + g1->length( myGroups1.count() ); + for ( int i = 0; i < myGroups1.count(); i++ ) + g1[i] = myGroups1[i]; + + result = aMeshEditor->DoubleNodesOnGroupBoundaries( g1.in(), createJointElems, onAllBoundaries ); + + break; } + } // switch( operationMode ) } catch (const SALOME::SALOME_Exception& S_ex) { SalomeApp_Tools::QtCatchCorbaException(S_ex); } catch ( const std::exception& exc ) { INFOS( "Follow exception was cought:\n\t" << exc.what() ); - } + } catch (...) { INFOS( "Unknown exception was cought !!!" ); } @@ -553,6 +601,9 @@ void SMESHGUI_DuplicateNodesDlg::onSelectionChanged() case 2: ok = ( aGroupType != SMESH::NODE ); break; + case 3: + ok = ( aGroupType == SMESH::VOLUME ); + break; } } if ( ok ) aGroups << aGroup; @@ -575,8 +626,15 @@ void SMESHGUI_DuplicateNodesDlg::onSelectionChanged() else if ( myCurrentLineEdit == myLineEdit3 ) myGroups3.clear(); myCurrentLineEdit->clear(); } - // Enable/disable "Apply and Close" and "Apply" buttons + updateButtons(); +} + +/*! + * \brief Enable/disable "Apply and Close" and "Apply" buttons + */ +void SMESHGUI_DuplicateNodesDlg::updateButtons() +{ bool isDataValid = isValid(); myButtonOk->setEnabled( isDataValid ); myButtonApply->setEnabled( isDataValid ); @@ -610,12 +668,15 @@ void SMESHGUI_DuplicateNodesDlg::onEditCurrentArgument() */ bool SMESHGUI_DuplicateNodesDlg::isValid() { - return myGroupConstructors->checkedId() == 1 ? - ( !myGroups1.isEmpty() && !myGroups3.isEmpty() ) : - ( !myGroups1.isEmpty() ); + switch( myGroupConstructors->checkedId() ) + { + case 1: return ( !myGroups1.isEmpty() && !myGroups3.isEmpty() ); + case 3: return ( myGroups1.count() > ( myCheckBox2->isChecked() ? 0 : 1 )); + default: return !myGroups1.isEmpty(); + } + return false; } - /*! \brief SLOT called when dialog shoud be deativated. */ diff --git a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h index 1a7d9da94..5bf5247d2 100644 --- a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -83,6 +83,8 @@ private slots: void onDeactivate(); + void updateButtons(); + private: QLineEdit* myCurrentLineEdit; @@ -98,8 +100,8 @@ private: QLineEdit* myLineEdit1; QLineEdit* myLineEdit2; QLineEdit* myLineEdit3; - QCheckBox* myCheckBoxNewElemGroup; - QCheckBox* myCheckBoxNewNodeGroup; + QCheckBox* myCheckBox1; + QCheckBox* myCheckBox2; QPushButton* myButtonOk; QPushButton* myButtonApply; diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index 9e18fdab6..8c2d0ef51 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h index 01907a798..bedc111ef 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index c9145b2ad..5dba32360 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -487,6 +487,9 @@ void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId) if (CheckBoxMesh->isChecked()) onSelectMesh(true); + myEditCurrentArgument->hide(); + myEditCurrentArgument->show(); + connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -823,7 +826,7 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument() } // get selected mesh SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type()); + mySelectionMgr->selectedObjects(aList); int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString); if (nbSel != 1) return; diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h index 22b693b28..c3acc56d0 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_FieldSelectorWdg.cxx b/src/SMESHGUI/SMESHGUI_FieldSelectorWdg.cxx new file mode 100644 index 000000000..d17809507 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_FieldSelectorWdg.cxx @@ -0,0 +1,250 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "SMESHGUI_FieldSelectorWdg.h" + +#include "SMESHGUI_Utils.h" +#include "SMESHGUI_GEOMGenUtils.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include "SMESHGUI.h" + +namespace +{ + QTreeWidgetItem* createItem( QTreeWidget* tree, + const QString& text, + const int index, + QTreeWidgetItem* parentItem=0) + { + QTreeWidgetItem* item; + if ( parentItem ) + item = new QTreeWidgetItem( parentItem ); + else + item = new QTreeWidgetItem( tree ); + item->setText( 0, text ); + item->setData( 0, Qt::UserRole, index ); + item->setFlags( item->flags() | Qt::ItemIsUserCheckable | Qt::ItemIsEditable ); + item->setCheckState( 0, Qt::Unchecked ); + item->setExpanded( true ); + if ( index < 0 ) + { + QFont f = item->font( 0 ); + f.setItalic( true ); + item->setFont( 0, f ); + } + return item; + } +} + +//-------------------------------------------------------------------------------- +/*! + * \brief Constructor of SMESHGUI_FieldSelectorWdg + */ +SMESHGUI_FieldSelectorWdg::SMESHGUI_FieldSelectorWdg( QWidget* p ) + :QGroupBox( tr("FIELDS_TO_EXPORT"), p ) +{ + setCheckable( true ); + myTree = new QTreeWidget( this ); + myTree->setHeaderHidden( true ); + + QVBoxLayout* lay = new QVBoxLayout( this ); + lay->addWidget( myTree ); + + connect( myTree, SIGNAL( itemChanged(QTreeWidgetItem*, int)), + this, SLOT ( onItemCheck(QTreeWidgetItem*, int))); +} + +//-------------------------------------------------------------------------------- +/*! + * \brief Retrieves all fields defined on geometry of given meshes + */ +bool SMESHGUI_FieldSelectorWdg:: +GetAllFeilds(const QList< QPair< SMESH::SMESH_IDSource_var, QString > >& meshes, + QList< QPair< GEOM::ListOfFields_var, QString > >& fields) +{ + myFields = & fields; + myTree->clear(); + + _PTR(Study) study = SMESH::GetActiveStudyDocument(); + GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); + GEOM::GEOM_IFieldOperations_wrap fieldOp = geomGen->GetIFieldOperations( study->StudyId() ); + + for ( int iM = 0; iM < meshes.count(); ++iM ) + { + GEOM::ListOfFields_var fields; + QString geoAss; + + SMESH::SMESH_Mesh_var mesh = meshes[iM].first->GetMesh(); + if ( !mesh->_is_nil() && mesh->HasShapeToMesh() ) + { + SMESH::array_of_ElementType_var elemTypes = meshes[iM].first->GetTypes(); + if ( &elemTypes.in() && elemTypes->length() > 0 ) + { + QTreeWidgetItem* meshItem = createItem( myTree, meshes[iM].second, iM ); + + GEOM::GEOM_Object_var shape = mesh->GetShapeToMesh(); + fields = fieldOp->GetFields( shape ); + for ( size_t iF = 0; iF < fields->length(); ++iF ) + { + GEOM::field_data_type dataType = fields[ iF ]->GetDataType(); + if ( dataType == GEOM::FDT_String ) + continue; + GEOM::ListOfLong_var stepIDs = fields[ iF ]->GetSteps(); + if ( stepIDs->length() < 1 ) + continue; + GEOM::string_array_var comps = fields[ iF ]->GetComponents(); + if ( comps->length() < 1 ) + continue; + CORBA::Short dim = fields[iF]->GetDimension(); + if ( dim < 0 ) + continue; // "whole shape" field ignored + + CORBA::String_var name = fields[iF]->GetName(); + createItem( myTree, name.in(), iF, meshItem ); + } + QString geoAss; + for ( size_t i = 0; i < elemTypes->length(); ++i ) + { + QString name; + switch ( elemTypes[i] ) { + case SMESH::NODE: name = "_vertices_"; break; + case SMESH::EDGE: name = "_edges_" ; break; + case SMESH::FACE: name = "_faces_" ; break; + case SMESH::VOLUME: name = "_solids_" ; break; + default: continue; + } + geoAss += name[1]; + createItem( myTree, name, -1, meshItem ); + } + if ( !geoAss.isEmpty() && !geoAss.count('v') ) + { + createItem( myTree, "_vertices_", -1, meshItem ); + } + } + } // if ( mesh->HasShapeToMesh() ) + + if ( ! &fields.in() ) + fields = new GEOM::ListOfFields(); + + myFields->push_back( qMakePair( fields, QString() )); + + } // loop on meshes + + setChecked( false ); + + return myTree->topLevelItemCount(); +} + +//-------------------------------------------------------------------------------- +/*! + * \brief Filter off not selected fields from myFields + */ +bool SMESHGUI_FieldSelectorWdg::GetSelectedFeilds() +{ + int nbSelected = 0; + if ( myTree->isEnabled() ) + for ( size_t i = 0; i < myTree->topLevelItemCount(); ++i ) + { + QTreeWidgetItem* meshItem = myTree->topLevelItem( i ); + int iM = meshItem->data( 0, Qt::UserRole ).toInt(); + + GEOM::ListOfFields& fields = (*myFields)[ iM ].first.inout(); + QString& geoAss = (*myFields)[ iM ].second; + + int nbF = 0; + QTreeWidgetItemIterator it ( meshItem, QTreeWidgetItemIterator::Checked ); + if ( *it == meshItem ) ++it; + for ( ; *it ; ++it, ++nbSelected ) + { + if ( !(*it)->parent() ) + break; // next mesh item + + int iF = (*it)->data( 0, Qt::UserRole ).toInt(); + if ( iF < 0 ) + { + geoAss += (*it)->text(0)[1]; + } + else + { + if ( nbF != iF ) + fields[ nbF ] = fields[ iF ]; + ++nbF; + } + } + fields.length( nbF ); + } + else + { + for ( size_t iF = 0; iF < myFields->count(); ++iF ) + { + GEOM::ListOfFields& fields = (*myFields)[ iF ].first.inout(); + fields.length( 0 ); + } + } + return nbSelected; +} + +//-------------------------------------------------------------------------------- +/*! + * \brief SLOT called when a tree item is checked + */ +void SMESHGUI_FieldSelectorWdg::onItemCheck(QTreeWidgetItem * item, int column) +{ + myTree->blockSignals( true ); + if ( !item->parent() ) // mesh item + { + Qt::CheckState st = item->checkState(0); + QTreeWidgetItemIterator it( item ); + for ( ++it; *it ; ++it ) + if ( !(*it)->parent() ) + break; // next mesh item + else + (*it)->setCheckState( 0, st ); + } + else // field item + { + // update CheckState of a parent mesh item + QTreeWidgetItem* meshItem = item->parent(); + Qt::CheckState st = item->checkState(0); + QTreeWidgetItemIterator it( meshItem ); + for ( ++it; *it ; ++it ) + if ( !(*it)->parent() ) + { + break; // next mesh item + } + else if ( (*it)->checkState(0) != st ) + { + st = Qt::PartiallyChecked; + break; + } + meshItem->setCheckState( 0, st ); + } + myTree->blockSignals( false ); +} diff --git a/src/SMESHGUI/SMESHGUI_FieldSelectorWdg.h b/src/SMESHGUI/SMESHGUI_FieldSelectorWdg.h new file mode 100644 index 000000000..feaa83415 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_FieldSelectorWdg.h @@ -0,0 +1,61 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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 +// +#ifndef STDMESHERSGUI_FieldSelectorWdg_H +#define STDMESHERSGUI_FieldSelectorWdg_H + +#include "SMESH_SMESHGUI.hxx" + +#include +#include CORBA_CLIENT_HEADER(SMESH_Mesh) +#include CORBA_CLIENT_HEADER(GEOM_Gen) + +#include + +class QTreeWidget; +class QTreeWidgetItem; + +/*! + * \brief Widget listing all fields available for export to MED file + */ +class SMESHGUI_EXPORT SMESHGUI_FieldSelectorWdg : public QGroupBox +{ + Q_OBJECT + + public: + SMESHGUI_FieldSelectorWdg( QWidget* = 0 ); + + bool GetAllFeilds(const QList< QPair< SMESH::SMESH_IDSource_var, QString > >& meshes, + QList< QPair< GEOM::ListOfFields_var, QString > >& fields); + + bool GetSelectedFeilds(); + + private slots: + + void onItemCheck(QTreeWidgetItem * item, int column); + + private: + + QList< QPair< GEOM::ListOfFields_var, QString > > * myFields; + QTreeWidget* myTree; +}; + +#endif // STDMESHERSGUI_FieldSelectorWdg_H diff --git a/src/SMESHGUI/SMESHGUI_FileInfoDlg.cxx b/src/SMESHGUI/SMESHGUI_FileInfoDlg.cxx index 498a72dad..587b43042 100644 --- a/src/SMESHGUI/SMESHGUI_FileInfoDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FileInfoDlg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_FileInfoDlg.h b/src/SMESHGUI/SMESHGUI_FileInfoDlg.h index 2cab5a95b..afbf6e9c1 100644 --- a/src/SMESHGUI/SMESHGUI_FileInfoDlg.h +++ b/src/SMESHGUI/SMESHGUI_FileInfoDlg.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_FileValidator.cxx b/src/SMESHGUI/SMESHGUI_FileValidator.cxx index f52be45dd..7e7eeed50 100755 --- a/src/SMESHGUI/SMESHGUI_FileValidator.cxx +++ b/src/SMESHGUI/SMESHGUI_FileValidator.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_FileValidator.h b/src/SMESHGUI/SMESHGUI_FileValidator.h index 98d2cfafa..ad76aae44 100755 --- a/src/SMESHGUI/SMESHGUI_FileValidator.h +++ b/src/SMESHGUI/SMESHGUI_FileValidator.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Filter.cxx b/src/SMESHGUI/SMESHGUI_Filter.cxx index 95e02173e..a6daed8fc 100755 --- a/src/SMESHGUI/SMESHGUI_Filter.cxx +++ b/src/SMESHGUI/SMESHGUI_Filter.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -51,6 +51,9 @@ IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_FacesFilter, SMESHGUI_Filter) IMPLEMENT_STANDARD_HANDLE(SMESHGUI_VolumesFilter, SMESHGUI_Filter) IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_VolumesFilter, SMESHGUI_Filter) +IMPLEMENT_STANDARD_HANDLE(SMESHGUI_VolumeShapeFilter, SMESHGUI_Filter) +IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_VolumeShapeFilter, SMESHGUI_Filter) + /* Class : SMESHGUI_PredicateFilter Description : Selection filter for VTK viewer. This class aggregate object @@ -492,3 +495,86 @@ bool SMESHGUI_VolumesFilter::IsNodeFilter() const { return false; } + + +/* + Class : SMESHGUI_VolumeShapeFilter + Description : Verify whether selected cell is a volume of a certain shape +*/ + + +//======================================================================= +// name : SMESHGUI_VolumeShapeFilter::SMESHGUI_VolumeShapeFilter +// Purpose : Constructor +//======================================================================= +SMESHGUI_VolumeShapeFilter::SMESHGUI_VolumeShapeFilter(const SMDSAbs_GeometryType shape) + : SMESHGUI_Filter(), myGeometryType( shape ) +{ +} + +//======================================================================= +// name : SMESHGUI_VolumeShapeFilter::IsValid +// Purpose : Verify whether selected cell is a volume of a certain shape +//======================================================================= +bool SMESHGUI_VolumeShapeFilter::IsValid( const int theCellId ) const +{ + if ( myActor == 0 || theCellId < 1 ) + return false; + + SMESH_Actor* anActor = dynamic_cast< SMESH_Actor* >( myActor ); + if ( !anActor || anActor->GetObject() == 0 ) + return false; + + SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh(); + const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) ); + + return anElem && anElem->GetGeomType() == myGeometryType; +} + +//======================================================================= +// name : SMESHGUI_VolumeShapeFilter::IsValid +// Purpose : Verify whether selected cell is volume +//======================================================================= +bool SMESHGUI_VolumeShapeFilter::IsObjValid( const int theObjId ) const +{ + if ( myActor == 0 ) + return false; + + SMESH_Actor* anActor = dynamic_cast< SMESH_Actor* >( myActor ); + if ( !anActor || anActor->GetObject() == 0 ) + return false; + + SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh(); + const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId ); + + return anElem && anElem->GetGeomType() == myGeometryType; +} + +//======================================================================= +// name : SMESHGUI_VolumeShapeFilter::GetId +// Purpose : Get ID of the filter. Must return value from SMESHGUI_FilterType +// enumeration. All filters must have different ids +//======================================================================= +int SMESHGUI_VolumeShapeFilter::GetId() const +{ + return GetId( myGeometryType ); +} + +//======================================================================= +//function : GetId +//purpose : Compose filter ID basing on +//======================================================================= + +int SMESHGUI_VolumeShapeFilter::GetId( SMDSAbs_GeometryType shape ) +{ + return SMESH::FirstGeometryTypeFilter + shape; +} + +//======================================================================= +// name : SMESHGUI_VolumeShapeFilter::IsNodeFilter +// Purpose : Returns true if filter is intended for nodes +//======================================================================= +bool SMESHGUI_VolumeShapeFilter::IsNodeFilter() const +{ + return false; +} diff --git a/src/SMESHGUI/SMESHGUI_Filter.h b/src/SMESHGUI/SMESHGUI_Filter.h index 26c5feffd..ab68a6b1b 100755 --- a/src/SMESHGUI/SMESHGUI_Filter.h +++ b/src/SMESHGUI/SMESHGUI_Filter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,6 +29,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMDSAbs_ElementType.hxx" // SALOME GUI includes #include @@ -42,15 +43,17 @@ class SALOME_Actor; namespace SMESH { enum SMESHGUI_FilterType { - UnknownFilter = -1, - NodeFilter = 0, - EdgeFilter = 1, - FaceFilter = 2, - VolumeFilter = 3, - AllElementsFilter = 4, - QuadFilter = 5, - TriaFilter = 6, - LastFilter + UnknownFilter = -1, + NodeFilter = 0, + EdgeFilter = 1, + FaceFilter = 2, + VolumeFilter = 3, + AllElementsFilter = 4, + QuadFilter = 5, + TriaFilter = 6, + FirstGeometryTypeFilter, + FirstEntityTypeFilter = FirstGeometryTypeFilter + SMDSGeom_NONE, + LastFilter = FirstEntityTypeFilter + SMDSEntity_Last }; }; @@ -181,10 +184,34 @@ public: Standard_EXPORT virtual bool IsValid( const int ) const; Standard_EXPORT virtual bool IsObjValid( const int ) const; Standard_EXPORT virtual int GetId() const; - Standard_EXPORT virtual bool IsNodeFilter() const; + Standard_EXPORT virtual bool IsNodeFilter() const; public: DEFINE_STANDARD_RTTI(SMESHGUI_VolumesFilter) }; +/* + Class : SMESHGUI_VolumeShapeFilter + Description : Verify whether selected cell is a volume of a certain shape +*/ + +DEFINE_STANDARD_HANDLE(SMESHGUI_VolumeShapeFilter, SMESHGUI_Filter) + +class SMESHGUI_VolumeShapeFilter : public SMESHGUI_Filter +{ + SMDSAbs_GeometryType myGeometryType; +public: + Standard_EXPORT SMESHGUI_VolumeShapeFilter(const SMDSAbs_GeometryType shape); + + Standard_EXPORT virtual bool IsValid( const int ) const; + Standard_EXPORT virtual bool IsObjValid( const int ) const; + Standard_EXPORT virtual int GetId() const; + Standard_EXPORT virtual bool IsNodeFilter() const; + + Standard_EXPORT static int GetId( SMDSAbs_GeometryType geom ); + +public: + DEFINE_STANDARD_RTTI(SMESHGUI_VolumeShapeFilter) +}; + #endif // SMESHGUI_FILTER_H diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index 3ffd0419b..4211d08bf 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -1149,7 +1149,7 @@ bool SMESHGUI_FilterTable::IsValid (const bool theMess, const int theEntityType) if (aTable->text(i, 2).isEmpty()) errMsg = tr( "ERROR" ); } - else + else // check correctness of a numeric value { bool aRes = false; bool isSignalsBlocked = aTable->signalsBlocked(); @@ -1159,10 +1159,6 @@ bool SMESHGUI_FilterTable::IsValid (const bool theMess, const int theEntityType) if (!aRes && aTable->isEditable(i, 2)) errMsg = tr( "ERROR" ); - else if (aType == SMESH::EDGE && - GetCriterionType(i, aType) == SMESH::FT_MultiConnection && - aThreshold == 1) - errMsg = tr( "MULTIEDGES_ERROR" ); } if (!errMsg.isEmpty()) { @@ -1814,7 +1810,7 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con case SMESH::FT_EqualVolumes: break; case SMESH::FT_MultiConnection: - case SMESH::FT_MultiConnection2D: anIsIntCriterion = true; break; + case SMESH::FT_MultiConnection2D: anIsIntCriterion = true; nbCompareSigns = 3; break; case SMESH::FT_Length: case SMESH::FT_Length2D: anIsDoubleCriterion = true; break; diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.h b/src/SMESHGUI/SMESHGUI_FilterDlg.h index 157869821..e00941329 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.h +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx index f29839e87..d360c4a6f 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h index 7a095f2a7..12158bef8 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_FilterUtils.cxx b/src/SMESHGUI/SMESHGUI_FilterUtils.cxx index 52dcf46a1..c0b4acb23 100644 --- a/src/SMESHGUI/SMESHGUI_FilterUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterUtils.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_FilterUtils.h b/src/SMESHGUI/SMESHGUI_FilterUtils.h index c8ef11544..86bd1d72d 100644 --- a/src/SMESHGUI/SMESHGUI_FilterUtils.h +++ b/src/SMESHGUI/SMESHGUI_FilterUtils.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx b/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx index fa84ad3bf..12dad3e0f 100644 --- a/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.h b/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.h index 162c4ebd1..568ae6295 100644 --- a/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.h +++ b/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx index f38d18647..48821ddad 100644 --- a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h index ceed1c930..3e7760916 100644 --- a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h +++ b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index 832ac1c8d..54a1a5c70 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.h b/src/SMESHGUI/SMESHGUI_GroupDlg.h index 06f8cef7f..8deca4976 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.h +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx index 51e725840..06887d6c0 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.h b/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.h index c09a26d9e..2fa69da68 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.h +++ b/src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx index a61be035a..33a4720ea 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_GroupOpDlg.h b/src/SMESHGUI/SMESHGUI_GroupOpDlg.h index f70aadb5d..db086cd79 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOpDlg.h +++ b/src/SMESHGUI/SMESHGUI_GroupOpDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_GroupUtils.cxx b/src/SMESHGUI/SMESHGUI_GroupUtils.cxx index b71aa8673..2584d2b4f 100644 --- a/src/SMESHGUI/SMESHGUI_GroupUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupUtils.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_GroupUtils.h b/src/SMESHGUI/SMESHGUI_GroupUtils.h index 996c0f3f9..e9910d058 100644 --- a/src/SMESHGUI/SMESHGUI_GroupUtils.h +++ b/src/SMESHGUI/SMESHGUI_GroupUtils.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index fa9add8e0..af1377aba 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -551,6 +551,8 @@ QString SMESHGUI_GenericHypothesisCreator::helpPage() const aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor"; else if ( aHypType == "Arithmetic1D") aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor"; + else if ( aHypType == "GeometricProgression") + aHelpFileName = "a1d_meshing_hypo_page.html#geometric_1d_anchor"; else if ( aHypType == "FixedPoints1D") aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor"; else if ( aHypType == "MaxElementArea") @@ -709,9 +711,10 @@ HypothesisData::HypothesisData( const QString& theTypeName, const QString& theClientLibName, const QString& theLabel, const QString& theIconId, + const QString& theContext, const QList& theDim, - const bool theIsAux, - const QStringList& theNeededHypos, + const bool theIsAuxOrNeedHyp, + const QStringList& theBasicHypos, const QStringList& theOptionalHypos, const QStringList& theInputTypes, const QStringList& theOutputTypes, @@ -723,9 +726,10 @@ HypothesisData::HypothesisData( const QString& theTypeName, ClientLibName( theClientLibName ), Label( theLabel ), IconId( theIconId ), + Context( theContext ), Dim( theDim ), - IsAux( theIsAux ), - NeededHypos( theNeededHypos ), + IsAuxOrNeedHyp( theIsAuxOrNeedHyp ), + BasicHypos( theBasicHypos ), OptionalHypos( theOptionalHypos ), InputTypes( theInputTypes ), OutputTypes( theOutputTypes ), diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.h b/src/SMESHGUI/SMESHGUI_Hypotheses.h index 83da609d3..fcadee8dd 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.h +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -173,7 +173,7 @@ class HypothesisData public: HypothesisData( const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, - const QList&, const bool, + const QString&, const QList&, const bool, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const bool=true, const bool supportSub=false ); @@ -184,13 +184,15 @@ public: QString ClientLibName; //!< client library name QString Label; //!< label QString IconId; //!< icon identifier + QString Context; //!< ["GLOBAL","LOCAL","ANY"(default)] QList Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration) - bool IsAux; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise + bool IsAuxOrNeedHyp; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise + //!< TRUE if given algorithm can't work w/o hypotheses bool IsNeedGeometry; //!< TRUE if the algorithm works with shapes only, FALSE otherwise bool IsSupportSubmeshes; //!< TRUE if the algo building all-dim elems supports submeshes // for algorithm only: dependencies algo <-> algo and algo -> hypos - QStringList NeededHypos; //!< list of obligatory hypotheses + QStringList BasicHypos; //!< list of basic hypotheses QStringList OptionalHypos;//!< list of optional hypotheses QStringList InputTypes; //!< list of element types required as a prerequisite QStringList OutputTypes; //!< list of types of generated elements diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index 2d45966ed..878163738 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -84,7 +84,7 @@ namespace SMESH typedef IMap THypothesisDataMap; THypothesisDataMap myHypothesesMap; THypothesisDataMap myAlgorithmsMap; - + // BUG 0020378 //typedef QMap THypCreatorMap; //THypCreatorMap myHypCreatorMap; @@ -220,16 +220,16 @@ namespace SMESH if (ok) { THypothesisDataMap::ConstIterator it1 = aXmlHandler->myHypothesesMap.begin(); - + for( ;it1 != aXmlHandler->myHypothesesMap.end(); it1++) myHypothesesMap.insert( it1.key(), it1.value() ); - + it1 = aXmlHandler->myAlgorithmsMap.begin(); for( ;it1 != aXmlHandler->myAlgorithmsMap.end(); it1++) myAlgorithmsMap.insert( it1.key(), it1.value() ); - + QList::iterator it; - for ( it = aXmlHandler->myListOfHypothesesSets.begin(); + for ( it = aXmlHandler->myListOfHypothesesSets.begin(); it != aXmlHandler->myListOfHypothesesSets.end(); ++it ) { @@ -266,30 +266,31 @@ namespace SMESH } - QStringList GetAvailableHypotheses( const bool isAlgo, - const int theDim, + QStringList GetAvailableHypotheses( const bool isAlgo, + const int theDim, const bool isAux, - const bool isNeedGeometry) + const bool isNeedGeometry, + const bool isSubMesh) { QStringList aHypList; // Init list of available hypotheses, if needed InitAvailableHypotheses(); bool checkGeometry = ( !isNeedGeometry && isAlgo ); + const char* context = isSubMesh ? "LOCAL" : "GLOBAL"; // fill list of hypotheses/algorithms THypothesisDataMap& pMap = isAlgo ? myAlgorithmsMap : myHypothesesMap; THypothesisDataMap::ConstIterator anIter; - for ( anIter = pMap.begin(); anIter != pMap.end(); anIter++ ) { + for ( anIter = pMap.begin(); anIter != pMap.end(); anIter++ ) + { HypothesisData* aData = anIter.value(); - if(!aData || aData->Label.isEmpty()) continue; - if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux) { - if (checkGeometry) { - if (aData->IsNeedGeometry == isNeedGeometry) - aHypList.append(anIter.key()); - } - else { - aHypList.append(anIter.key()); - } + if (( aData && !aData->Label.isEmpty() ) && + ( theDim < 0 || aData->Dim.contains( theDim )) && + ( isAlgo || aData->IsAuxOrNeedHyp == isAux ) && + ( aData->Context == "ANY" || aData->Context == context ) && + ( !checkGeometry || aData->IsNeedGeometry == isNeedGeometry )) + { + aHypList.append(anIter.key()); } } return aHypList; @@ -302,15 +303,13 @@ namespace SMESH // Init list of available hypotheses, if needed InitAvailableHypotheses(); - QList::iterator hypoSet; - for ( hypoSet = myListOfHypothesesSets.begin(); - hypoSet != myListOfHypothesesSets.end(); - ++hypoSet ) { + for ( hypoSet = myListOfHypothesesSets.begin(); + hypoSet != myListOfHypothesesSets.end(); + ++hypoSet ) { HypothesesSet* aSet = *hypoSet; - if ( aSet && - ( aSet->count( true ) || aSet->count( false )) && - aSet->maxDim() <= maxDim) + if ( aSet && ( aSet->count( true ) || aSet->count( false )) && + aSet->maxDim() <= maxDim) { aSetNameList.append( mangledHypoSetName( aSet )); } @@ -322,7 +321,7 @@ namespace SMESH QStringList reversedNames; for ( int i = 0; i < aSetNameList.count(); ++i ) reversedNames.prepend( aSetNameList[i] ); - + return reversedNames; } @@ -330,7 +329,7 @@ namespace SMESH { QString name = demangledHypoSetName( theSetName ); QList::iterator hypoSet; - for ( hypoSet = myListOfHypothesesSets.begin(); + for ( hypoSet = myListOfHypothesesSets.begin(); hypoSet != myListOfHypothesesSets.end(); ++hypoSet ) { HypothesesSet* aSet = *hypoSet; @@ -363,7 +362,7 @@ namespace SMESH isAuxiliary = false; if ( !algoData ) return false; - if ( algoData->NeededHypos.contains( hypType )) + if ( algoData->BasicHypos.contains( hypType )) return true; if ( algoData->OptionalHypos.contains( hypType)) { isAuxiliary = true; @@ -407,7 +406,7 @@ namespace SMESH // 2. Get names of plugin libraries HypothesisData* aHypData = GetHypothesisData(aHypType); - if (!aHypData) + if (!aHypData) return aCreator; QString aClientLibName = aHypData->ClientLibName; @@ -424,7 +423,7 @@ namespace SMESH #ifdef WIN32 const char* anError = "Can't load client meshers plugin library"; #else - const char* anError = dlerror(); + const char* anError = dlerror(); #endif INFOS(anError); // always display this kind of error ! } @@ -454,7 +453,7 @@ namespace SMESH //rnv : This dynamic property of the QObject stores the name of the plugin. // It is used to obtain plugin root dir environment variable - // in the SMESHGUI_HypothesisDlg class. Plugin root dir environment + // in the SMESHGUI_HypothesisDlg class. Plugin root dir environment // variable is used to display documentation. aCreator->setProperty(PLUGIN_NAME,aHypData->PluginName); } @@ -474,7 +473,7 @@ namespace SMESH const QString& aHypName, const bool isAlgo) { - if(MYDEBUG) MESSAGE("Create " << aHypType.toLatin1().data() << + if(MYDEBUG) MESSAGE("Create " << aHypType.toLatin1().data() << " with name " << aHypName.toLatin1().data()); HypothesisData* aHypData = GetHypothesisData(aHypType); QString aServLib = aHypData->ServerLibName; @@ -498,6 +497,17 @@ namespace SMESH return SMESH::SMESH_Hypothesis::_nil(); } + bool IsApplicable(const QString& aHypType, + GEOM::GEOM_Object_ptr theGeomObject, + const bool toCheckAll) + { + HypothesisData* aHypData = GetHypothesisData(aHypType); + QString aServLib = aHypData->ServerLibName; + return SMESHGUI::GetSMESHGen()->IsApplicable( aHypType.toLatin1().data(), + aServLib.toLatin1().data(), + theGeomObject, + toCheckAll); + } bool AddHypothesisOnMesh (SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp) @@ -627,7 +637,7 @@ namespace SMESH if (!aSubMesh->_is_nil()) aMesh = aSubMesh->GetFather(); - if (!aMesh->_is_nil()) { + if (!aMesh->_is_nil()) { if (aMesh->HasShapeToMesh() && !aShapeObject->_is_nil()) { res = aMesh->RemoveHypothesis(aShapeObject, anHyp); if (res < SMESH::HYP_UNKNOWN_FATAL) { @@ -635,14 +645,14 @@ namespace SMESH if (meshSO) SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0); } - + } else if(!aMesh->HasShapeToMesh()){ res = aMesh->RemoveHypothesis(aShapeObject, anHyp); if (res < SMESH::HYP_UNKNOWN_FATAL) { _PTR(SObject) meshSO = SMESH::FindSObject(aMesh); if (meshSO) - SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0); + SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0); } } if (res > SMESH::HYP_OK) { @@ -704,7 +714,7 @@ namespace SMESH QString msg; if ( !hasAlgo ) msg = QObject::tr( "STATE_ALGO_MISSING" ); - else + else switch( error.state ) { CASE2MESSAGE( HYP_MISSING ); CASE2MESSAGE( HYP_NOTCONFORM ); diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h index a2c12f595..2841b7a7f 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -69,9 +69,10 @@ namespace SMESH QStringList GetAvailableHypotheses( const bool, const int = -1, const bool = false, - const bool = true); + const bool = true, + const bool = false); SMESHGUI_EXPORT - QStringList GetHypothesesSets( int maxDim ); + QStringList GetHypothesesSets( int ); SMESHGUI_EXPORT HypothesesSet* GetHypothesesSet( const QString& ); @@ -95,6 +96,10 @@ namespace SMESH SMESH::SMESH_Hypothesis_ptr CreateHypothesis( const QString&, const QString&, const bool = false ); + SMESHGUI_EXPORT + bool IsApplicable( const QString&, + GEOM::GEOM_Object_ptr, + const bool = false ); SMESHGUI_EXPORT bool AddHypothesisOnMesh( SMESH::SMESH_Mesh_ptr, SMESH::SMESH_Hypothesis_ptr ); diff --git a/src/SMESHGUI/SMESHGUI_IdValidator.h b/src/SMESHGUI/SMESHGUI_IdValidator.h index caca7f14b..4c535901b 100644 --- a/src/SMESHGUI/SMESHGUI_IdValidator.h +++ b/src/SMESHGUI/SMESHGUI_IdValidator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.cxx b/src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.cxx index 3ae4ac699..74ea3dc4b 100644 --- a/src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.cxx +++ b/src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.h b/src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.h index fe2307893..79867d791 100644 --- a/src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.h +++ b/src/SMESHGUI/SMESHGUI_Make2DFrom3DOp.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx index d86fd4b54..970500e69 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -61,6 +61,7 @@ #include // Qt includes +#include #include #include #include @@ -95,12 +96,11 @@ SMESHGUI_MakeNodeAtPointDlg::SMESHGUI_MakeNodeAtPointDlg() QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame()); aDlgLay->setMargin(0); aDlgLay->setSpacing(SPACING); + myMainFrame = createMainFrame(mainFrame()); - QWidget* aMainFrame = createMainFrame (mainFrame()); + aDlgLay->addWidget(myMainFrame); - aDlgLay->addWidget(aMainFrame); - - aDlgLay->setStretchFactor(aMainFrame, 1); + aDlgLay->setStretchFactor(myMainFrame, 1); } //======================================================================= @@ -112,62 +112,33 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) QWidget* aFrame = new QWidget(theParent); SUIT_ResourceMgr* rm = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() ); - QPixmap iconMoveNode (rm->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE"))); - QPixmap iconSelect (rm->loadPixmap("SMESH", tr("ICON_SELECT"))); + QPixmap iconMoveNode (rm->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE"))); + QPixmap iconMoveWithoutNode (rm->loadPixmap("SMESH", tr("ICON_DLG_MOVE_WITHOUT_NODE"))); + QPixmap iconSelect (rm->loadPixmap("SMESH", tr("ICON_SELECT"))); // constructor - - QGroupBox* aPixGrp = new QGroupBox(tr("MOVE_NODE"), aFrame); - QButtonGroup* aBtnGrp = new QButtonGroup(this); + QGroupBox* aPixGrp = new QGroupBox(tr("MOVE_NODE"), this); + aPixGrp->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myButtonGroup = new QButtonGroup(this); QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp); aPixGrpLayout->setMargin(MARGIN); aPixGrpLayout->setSpacing(SPACING); - QRadioButton* aRBut = new QRadioButton(aPixGrp); - aRBut->setIcon(iconMoveNode); - aRBut->setChecked(true); - aPixGrpLayout->addWidget(aRBut); - aBtnGrp->addButton(aRBut, 0); - - // coordinates - - QGroupBox* aCoordGrp = new QGroupBox(tr("DESTINATION"), aFrame); - QHBoxLayout* aCoordGrpLayout = new QHBoxLayout(aCoordGrp); - aCoordGrpLayout->setMargin(MARGIN); - aCoordGrpLayout->setSpacing(SPACING); - - myCoordBtn = new QPushButton(aCoordGrp); - myCoordBtn->setIcon(iconSelect); - myCoordBtn->setCheckable(true); - - QLabel* aXLabel = new QLabel(tr("SMESH_X"), aCoordGrp); - myX = new SMESHGUI_SpinBox(aCoordGrp); - - QLabel* aYLabel = new QLabel(tr("SMESH_Y"), aCoordGrp); - myY = new SMESHGUI_SpinBox(aCoordGrp); - - QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp); - myZ = new SMESHGUI_SpinBox(aCoordGrp); + myRButNodeToMove = new QRadioButton(aPixGrp); + myRButMoveWithoutNode = new QRadioButton(aPixGrp); + myRButNodeToMove->setIcon(iconMoveNode); + myRButMoveWithoutNode->setIcon(iconMoveWithoutNode); + myRButNodeToMove->setChecked(true); - myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); - myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); - myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + aPixGrpLayout->addWidget(myRButNodeToMove); + aPixGrpLayout->addWidget(myRButMoveWithoutNode); + myButtonGroup->addButton(myRButNodeToMove, 0); + myButtonGroup->addButton(myRButMoveWithoutNode, 1); - aCoordGrpLayout->addWidget(myCoordBtn); - aCoordGrpLayout->addWidget(aXLabel); - aCoordGrpLayout->addWidget(myX); - aCoordGrpLayout->addWidget(aYLabel); - aCoordGrpLayout->addWidget(myY); - aCoordGrpLayout->addWidget(aZLabel); - aCoordGrpLayout->addWidget(myZ); - aCoordGrpLayout->setStretchFactor(myX, 1); - aCoordGrpLayout->setStretchFactor(myY, 1); - aCoordGrpLayout->setStretchFactor(myZ, 1); - - // node ID + // Node to move myNodeToMoveGrp = new QGroupBox(tr("NODE_2MOVE"), aFrame); - + myNodeToMoveGrp->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); QLabel* idLabel = new QLabel(tr("NODE_2MOVE_ID"), myNodeToMoveGrp); myIdBtn = new QPushButton(myNodeToMoveGrp); myIdBtn->setIcon(iconSelect); @@ -195,27 +166,9 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) myCurrentZ->setButtonSymbols(QAbstractSpinBox::NoButtons); myCurrentZ->setReadOnly(true); - QLabel* aDXLabel = new QLabel(tr("SMESH_DX"), aCoordWidget); - myDX = new SMESHGUI_SpinBox(aCoordWidget); - myDX->setButtonSymbols(QAbstractSpinBox::NoButtons); - myDX->setReadOnly(true); - - QLabel* aDYLabel = new QLabel(tr("SMESH_DY"), aCoordWidget); - myDY = new SMESHGUI_SpinBox(aCoordWidget); - myDY->setButtonSymbols(QAbstractSpinBox::NoButtons); - myDY->setReadOnly(true); - - QLabel* aDZLabel = new QLabel(tr("SMESH_DZ"), aCoordWidget); - myDZ = new SMESHGUI_SpinBox(aCoordWidget); - myDZ->setButtonSymbols(QAbstractSpinBox::NoButtons); - myDZ->setReadOnly(true); - myCurrentX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); myCurrentY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); myCurrentZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); - myDX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); - myDY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); - myDZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); QGridLayout* aCoordLayout = new QGridLayout(aCoordWidget); aCoordLayout->setMargin(0); @@ -226,19 +179,10 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) aCoordLayout->addWidget(myCurrentY, 0, 3); aCoordLayout->addWidget(aCurrentZLabel, 0, 4); aCoordLayout->addWidget(myCurrentZ, 0, 5); - aCoordLayout->addWidget(aDXLabel, 1, 0); - aCoordLayout->addWidget(myDX, 1, 1); - aCoordLayout->addWidget(aDYLabel, 1, 2); - aCoordLayout->addWidget(myDY, 1, 3); - aCoordLayout->addWidget(aDZLabel, 1, 4); - aCoordLayout->addWidget(myDZ, 1, 5); aCoordLayout->setColumnStretch(1, 1); aCoordLayout->setColumnStretch(3, 1); aCoordLayout->setColumnStretch(5, 1); - myAutoSearchChkBox = new QCheckBox( tr("AUTO_SEARCH"), myNodeToMoveGrp); - myPreviewChkBox = new QCheckBox( tr("PREVIEW"), myNodeToMoveGrp); - QGridLayout* myNodeToMoveGrpLayout = new QGridLayout(myNodeToMoveGrp); myNodeToMoveGrpLayout->setSpacing(SPACING); myNodeToMoveGrpLayout->setMargin(MARGIN); @@ -248,20 +192,79 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) myNodeToMoveGrpLayout->addWidget( myId, 0, 2 ); myNodeToMoveGrpLayout->addWidget( myUpdateBtn, 0, 3 ); myNodeToMoveGrpLayout->addWidget( aCoordWidget, 1, 0, 1, 4 ); - myNodeToMoveGrpLayout->addWidget( myAutoSearchChkBox, 2, 0, 1, 4 ); - myNodeToMoveGrpLayout->addWidget( myPreviewChkBox, 3, 0, 1, 4 ); + + // Destination + + myDestinationGrp = new QGroupBox(tr("DESTINATION"), aFrame); + myDestinationGrp->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + myDestBtn = new QPushButton(myDestinationGrp); + myDestBtn->setIcon(iconSelect); + myDestBtn->setCheckable(true); + + QLabel* aDestinationXLabel = new QLabel(tr("SMESH_X"), myDestinationGrp); + myDestinationX = new SMESHGUI_SpinBox(myDestinationGrp); + + QLabel* aDestinationYLabel = new QLabel(tr("SMESH_Y"), myDestinationGrp); + myDestinationY = new SMESHGUI_SpinBox(myDestinationGrp); + + QLabel* aDestinationZLabel = new QLabel(tr("SMESH_Z"), myDestinationGrp); + myDestinationZ = new SMESHGUI_SpinBox(myDestinationGrp); + + myDestDXLabel = new QLabel(tr("SMESH_DX"), myDestinationGrp); + myDestDX = new SMESHGUI_SpinBox(myDestinationGrp); + myDestDX->setReadOnly(true); + + myDestDYLabel = new QLabel(tr("SMESH_DY"), myDestinationGrp); + myDestDY = new SMESHGUI_SpinBox(myDestinationGrp); + myDestDY->setReadOnly(true); + + myDestDZLabel = new QLabel(tr("SMESH_DZ"), myDestinationGrp); + myDestDZ = new SMESHGUI_SpinBox(myDestinationGrp); + myDestDZ->setReadOnly(true); + + myDestinationX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + myDestinationY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + myDestinationZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + myDestDX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + myDestDY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + myDestDZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + + QGridLayout* aDestLayout = new QGridLayout(myDestinationGrp); + aDestLayout->setMargin(MARGIN); + aDestLayout->setSpacing(SPACING); + aDestLayout->addWidget(myDestBtn, 0, 0); + aDestLayout->addWidget(aDestinationXLabel, 0, 1); + aDestLayout->addWidget(myDestinationX, 0, 2); + aDestLayout->addWidget(aDestinationYLabel, 0, 3); + aDestLayout->addWidget(myDestinationY, 0, 4); + aDestLayout->addWidget(aDestinationZLabel, 0, 5); + aDestLayout->addWidget(myDestinationZ, 0, 6); + aDestLayout->addWidget(myDestDXLabel, 1, 1); + aDestLayout->addWidget(myDestDX, 1, 2); + aDestLayout->addWidget(myDestDYLabel, 1, 3); + aDestLayout->addWidget(myDestDY, 1, 4); + aDestLayout->addWidget(myDestDZLabel, 1, 5); + aDestLayout->addWidget(myDestDZ, 1, 6); + aDestLayout->setColumnStretch(2, 1); + aDestLayout->setColumnStretch(4, 1); + aDestLayout->setColumnStretch(6, 1); + + // Preview + + myPreviewChkBox = new QCheckBox( tr("PREVIEW"), aFrame); QVBoxLayout* aLay = new QVBoxLayout(aFrame); aLay->addWidget(aPixGrp); - aLay->addWidget(aCoordGrp); aLay->addWidget(myNodeToMoveGrp); + aLay->addWidget(myDestinationGrp); + aLay->addWidget(myPreviewChkBox); - connect(myCoordBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); + connect(myDestBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); connect(myIdBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); - connect(myAutoSearchChkBox, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); + connect(myButtonGroup, SIGNAL (buttonClicked(int)), SLOT(ConstructorsClicked(int))); myIdBtn->setChecked(true); - myAutoSearchChkBox->setChecked(true); return aFrame; } @@ -277,38 +280,61 @@ void SMESHGUI_MakeNodeAtPointDlg::ButtonToggled (bool on) { const QObject* aSender = sender(); if ( on ) { - if ( aSender == myCoordBtn ) // button to set coord by node selection + if ( aSender == myDestBtn ) // button to set coord by node selection { if ( myIdBtn->isEnabled() ) myIdBtn->setChecked( !on ); } else if ( aSender == myIdBtn ) // button to select a node to move { - myCoordBtn->setChecked( !on ); + myDestBtn->setChecked( !on ); } } - if ( aSender == myAutoSearchChkBox ) // automatic node search - { - if ( on ) { +} +//================================================================================ +/*! + * \brief SLOT called when clicked radio button + * \param int - number of the button + */ +//================================================================================ +void SMESHGUI_MakeNodeAtPointDlg::ConstructorsClicked (int constructorId) +{ + switch (constructorId) { + case 0: + { + myDestDXLabel->show(); + myDestDYLabel->show(); + myDestDZLabel->show(); + myDestDX->show(); + myDestDY->show(); + myDestDZ->show(); myCurrentX->SetValue(0); myCurrentY->SetValue(0); myCurrentZ->SetValue(0); - myDX->SetValue(0); - myDY->SetValue(0); - myDZ->SetValue(0); - myId->setText(""); - myId->setReadOnly ( true ); - myIdBtn->setChecked( false ); - myIdBtn->setEnabled( false ); - myCoordBtn->setChecked( true ); - myUpdateBtn->setEnabled( false ); + if (!myNodeToMoveGrp->isVisible()) myNodeToMoveGrp->show(); + break; } - else { - myId->setReadOnly ( false ); - myIdBtn->setEnabled( true ); - myUpdateBtn->setEnabled( true ); + case 1: + { + myId->setText(""); + myCurrentX->SetValue(0); + myCurrentY->SetValue(0); + myCurrentZ->SetValue(0); + myDestDXLabel->hide(); + myDestDYLabel->hide(); + myDestDZLabel->hide(); + myDestDX->hide(); + myDestDY->hide(); + myDestDZ->hide(); + if (myNodeToMoveGrp->isVisible()) {myNodeToMoveGrp->hide();} + break; } } + QApplication::instance()->processEvents(); + myMainFrame->hide(); + myMainFrame->show(); + updateGeometry(); + resize(minimumSizeHint()); } //================================================================================ @@ -326,14 +352,17 @@ SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp() myNoPreview = false; myUpdateDestination = false; + myDestCoordChanged = true; // connect signals and slots - connect(myDlg->myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); - connect(myDlg->myY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); - connect(myDlg->myZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); + connect(myDlg->myDestinationX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); + connect(myDlg->myDestinationY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); + connect(myDlg->myDestinationZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); + connect(myDlg->myDestDX, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged())); + connect(myDlg->myDestDY, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged())); + connect(myDlg->myDestDZ, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged())); connect(myDlg->myId,SIGNAL (textChanged(const QString&)),SLOT(redisplayPreview())); connect(myDlg->myPreviewChkBox, SIGNAL (toggled(bool)),SLOT(redisplayPreview())); - connect(myDlg->myAutoSearchChkBox,SIGNAL (toggled(bool)),SLOT(redisplayPreview())); // IPAL22913: TC6.5.0: selected in "Move node" dialog box node is not highlighted // note: this slot seems to be lost together with removed obsolete SMESHGUI_MoveNodesDlg class @@ -348,6 +377,13 @@ void SMESHGUI_MakeNodeAtPointOp::onUpdateDestination() myUpdateDestination = false; } +void SMESHGUI_MakeNodeAtPointOp::onDestCoordChanged() +{ + myDestCoordChanged = false; + redisplayPreview(); + myDestCoordChanged = true; +} + //======================================================================= // function : startOperation() // purpose : Init dialog fields, connect signals and slots, show dialog @@ -380,17 +416,23 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation() // IPAL19360 SMESHGUI_SelectionOp::startOperation(); // this method should be called only after filter creation //activateSelection(); // set filters // called inside of previous statement - - myDlg->myX->SetValue(0); - myDlg->myY->SetValue(0); - myDlg->myZ->SetValue(0); + myDlg->myId->setText(""); + myDlg->myDestinationX->SetValue(0); + myDlg->myDestinationY->SetValue(0); + myDlg->myDestinationZ->SetValue(0); + myDlg->myDestDX->SetValue(0); + myDlg->myDestDY->SetValue(0); + myDlg->myDestDZ->SetValue(0); myDlg->myCurrentX->SetValue(0); myDlg->myCurrentY->SetValue(0); myDlg->myCurrentZ->SetValue(0); - myDlg->myDX->SetValue(0); - myDlg->myDY->SetValue(0); - myDlg->myDZ->SetValue(0); - myDlg->myId->setText(""); + myDlg->myDestDX->setReadOnly(true); + myDlg->myDestDY->setReadOnly(true); + myDlg->myDestDZ->setReadOnly(true); + myDlg->myRButNodeToMove->setChecked(true); + + myDlg->ConstructorsClicked(GetConstructorId()); + myDlg->show(); onSelectionDone(); // init myMeshActor @@ -403,6 +445,15 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation() } } +//================================================================================= +// function : GetConstructorId() +// purpose : +//================================================================================= +int SMESHGUI_MakeNodeAtPointOp::GetConstructorId() +{ + return myDlg->myButtonGroup->checkedId(); +} + //================================================================================ /*! * \brief Stops operation @@ -450,9 +501,9 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() } QStringList aParameters; - aParameters << myDlg->myX->text(); - aParameters << myDlg->myY->text(); - aParameters << myDlg->myZ->text(); + aParameters << myDlg->myDestinationX->text(); + aParameters << myDlg->myDestinationY->text(); + aParameters << myDlg->myDestinationZ->text(); try { SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO()); @@ -470,24 +521,23 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() bool ok; int anId = myDlg->myId->text().toInt( &ok ); if( !ok || anId < 1 ) - anId = aMeshEditor->FindNodeClosestTo(myDlg->myX->GetValue(), - myDlg->myY->GetValue(), - myDlg->myZ->GetValue()); + anId = aMeshEditor->FindNodeClosestTo(myDlg->myDestinationX->GetValue(), + myDlg->myDestinationY->GetValue(), + myDlg->myDestinationZ->GetValue()); int aResult = aMeshEditor->MoveNode(anId, - myDlg->myX->GetValue(), - myDlg->myY->GetValue(), - myDlg->myZ->GetValue() ); + myDlg->myDestinationX->GetValue(), + myDlg->myDestinationY->GetValue(), + myDlg->myDestinationZ->GetValue() ); if (aResult) { myDlg->myCurrentX->SetValue(0); myDlg->myCurrentY->SetValue(0); myDlg->myCurrentZ->SetValue(0); - myDlg->myDX->SetValue(0); - myDlg->myDY->SetValue(0); - myDlg->myDZ->SetValue(0); - myDlg->myId->setText(""); + myDlg->myDestDX->SetValue(0); + myDlg->myDestDY->SetValue(0); + myDlg->myDestDZ->SetValue(0); SALOME_ListIO aList; selectionMgr()->setSelectedObjects(aList,false); @@ -515,8 +565,7 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg ) { bool ok = true; - if ( myMeshActor && - !myDlg->myAutoSearchChkBox->isChecked() ) + if ( myMeshActor && myDlg->myRButNodeToMove->isChecked() ) { ok = false; int id = myDlg->myId->text().toInt(); @@ -527,9 +576,9 @@ bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg ) msg += tr("INVALID_ID") + "\n"; } - ok = myDlg->myX->isValid( msg, !myNoPreview ) && ok; - ok = myDlg->myY->isValid( msg, !myNoPreview ) && ok; - ok = myDlg->myZ->isValid( msg, !myNoPreview ) && ok; + ok = myDlg->myDestinationX->isValid( msg, !myNoPreview ) && ok; + ok = myDlg->myDestinationY->isValid( msg, !myNoPreview ) && ok; + ok = myDlg->myDestinationZ->isValid( msg, !myNoPreview ) && ok; return ok; } @@ -553,7 +602,7 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() SMESH_Actor* aMeshActor = SMESH::FindActorByEntry(anIO->getEntry()); if (!aMeshActor) { // coord by geom - if ( myDlg->myCoordBtn->isChecked() ) { + if ( myDlg->myDestBtn->isChecked() ) { GEOM::GEOM_Object_var geom = SMESH::IObjectToInterface(anIO); if ( !geom->_is_nil() ) { TopoDS_Vertex aShape; @@ -561,9 +610,9 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() aShape.ShapeType() == TopAbs_VERTEX ) { gp_Pnt P = BRep_Tool::Pnt(aShape); myNoPreview = true; - myDlg->myX->SetValue(P.X()); - myDlg->myY->SetValue(P.Y()); - myDlg->myZ->SetValue(P.Z()); + myDlg->myDestinationX->SetValue(P.X()); + myDlg->myDestinationY->SetValue(P.Y()); + myDlg->myDestinationZ->SetValue(P.Z()); myNoPreview = false; redisplayPreview(); } @@ -581,10 +630,10 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() if (SMDS_Mesh* aMesh = aMeshActor->GetObject()->GetMesh()) { if (const SMDS_MeshNode* aNode = aMesh->FindNode(aString.toInt())) { myNoPreview = true; - if ( myDlg->myCoordBtn->isChecked() ) { // set coord - myDlg->myX->SetValue(aNode->X()); - myDlg->myY->SetValue(aNode->Y()); - myDlg->myZ->SetValue(aNode->Z()); + if ( myDlg->myDestBtn->isChecked() ) { // set coord + myDlg->myDestinationX->SetValue(aNode->X()); + myDlg->myDestinationY->SetValue(aNode->Y()); + myDlg->myDestinationZ->SetValue(aNode->Z()); myNoPreview = false; redisplayPreview(); } @@ -599,15 +648,18 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() double x = aCurrentNode->X(); double y = aCurrentNode->Y(); double z = aCurrentNode->Z(); - double dx = myDlg->myX->GetValue() - x; - double dy = myDlg->myY->GetValue() - y; - double dz = myDlg->myZ->GetValue() - z; + double dx = myDlg->myDestinationX->GetValue() - x; + double dy = myDlg->myDestinationY->GetValue() - y; + double dz = myDlg->myDestinationZ->GetValue() - z; myDlg->myCurrentX->SetValue(x); myDlg->myCurrentY->SetValue(y); myDlg->myCurrentZ->SetValue(z); - myDlg->myDX->SetValue(dx); - myDlg->myDY->SetValue(dy); - myDlg->myDZ->SetValue(dz); + myDlg->myDestDX->SetValue(dx); + myDlg->myDestDY->SetValue(dy); + myDlg->myDestDZ->SetValue(dz); + myDlg->myDestDX->setReadOnly(false); + myDlg->myDestDY->setReadOnly(false); + myDlg->myDestDZ->setReadOnly(false); } } } @@ -633,20 +685,10 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() bool moveShown = false; if ( myMeshActor) { - const bool autoSearch = myDlg->myAutoSearchChkBox->isChecked(); - const bool preview = myDlg->myPreviewChkBox->isChecked(); - if ( autoSearch ) - { - myDlg->myCurrentX->SetValue(0); - myDlg->myCurrentY->SetValue(0); - myDlg->myCurrentZ->SetValue(0); - myDlg->myDX->SetValue(0); - myDlg->myDY->SetValue(0); - myDlg->myDZ->SetValue(0); - myDlg->myId->setText(""); - } + const bool isPreview = myDlg->myPreviewChkBox->isChecked(); + const bool isMoveNode = myDlg->myRButMoveWithoutNode->isChecked(); QString msg; - if ( autoSearch || isValid( msg ) ) + if ( isValid( msg ) ) { try { SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO()); @@ -656,53 +698,68 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() { SUIT_OverrideCursor aWaitCursor; - int anId = 0; - if ( autoSearch ) - anId = aPreviewer->FindNodeClosestTo(myDlg->myX->GetValue(), - myDlg->myY->GetValue(), - myDlg->myZ->GetValue()); - else - anId = myDlg->myId->text().toInt(); + int anId = myDlg->myId->text().toInt(); - // find id and/or just compute preview - aPreviewer->MoveNode(anId, - myDlg->myX->GetValue(), - myDlg->myY->GetValue(), - myDlg->myZ->GetValue()); - if ( autoSearch ) { // set found id - QString idTxt("%1"); - if ( anId > 0 ) - idTxt = idTxt.arg( anId ); - else - idTxt = ""; - myDlg->myId->setText( idTxt ); - } - - SMESH::double_array* aXYZ = aMesh->GetNodeXYZ( anId ); - if( aXYZ && aXYZ->length() >= 3 ) + SMESH::double_array_var aXYZ = aMesh->GetNodeXYZ( anId ); + if( &aXYZ.in() && aXYZ->length() >= 3 ) { - double x = aXYZ->operator[](0); - double y = aXYZ->operator[](1); - double z = aXYZ->operator[](2); + double x = aXYZ[0]; + double y = aXYZ[1]; + double z = aXYZ[2]; + double dx = 0; + double dy = 0; + double dz = 0; if ( myUpdateDestination ) { - myDlg->myX->SetValue(x); - myDlg->myY->SetValue(y); - myDlg->myZ->SetValue(z); + myDlg->myDestinationX->SetValue(x); + myDlg->myDestinationY->SetValue(y); + myDlg->myDestinationZ->SetValue(z); + } + if ( myDestCoordChanged ) { + dx = myDlg->myDestinationX->GetValue() - myDlg->myCurrentX->GetValue(); + dy = myDlg->myDestinationY->GetValue() - myDlg->myCurrentY->GetValue(); + dz = myDlg->myDestinationZ->GetValue() - myDlg->myCurrentZ->GetValue(); + myDlg->myDestDX->SetValue(dx); + myDlg->myDestDY->SetValue(dy); + myDlg->myDestDZ->SetValue(dz); + } + else { + dx = myDlg->myDestDX->GetValue() + myDlg->myCurrentX->GetValue();; + dy = myDlg->myDestDY->GetValue() + myDlg->myCurrentY->GetValue();; + dz = myDlg->myDestDZ->GetValue() + myDlg->myCurrentZ->GetValue();; + myDlg->myDestinationX->SetValue(dx); + myDlg->myDestinationY->SetValue(dy); + myDlg->myDestinationZ->SetValue(dz); } - - double dx = myDlg->myX->GetValue() - x; - double dy = myDlg->myY->GetValue() - y; - double dz = myDlg->myZ->GetValue() - z; myDlg->myCurrentX->SetValue(x); myDlg->myCurrentY->SetValue(y); myDlg->myCurrentZ->SetValue(z); - myDlg->myDX->SetValue(dx); - myDlg->myDY->SetValue(dy); - myDlg->myDZ->SetValue(dz); + myDlg->myDestDX->setReadOnly(false); + myDlg->myDestDY->setReadOnly(false); + myDlg->myDestDZ->setReadOnly(false); } + else { + myDlg->myCurrentX->SetValue(0); + myDlg->myCurrentY->SetValue(0); + myDlg->myCurrentZ->SetValue(0); + myDlg->myDestDX->SetValue(0); + myDlg->myDestDY->SetValue(0); + myDlg->myDestDZ->SetValue(0); + myDlg->myDestDX->setReadOnly(true); + myDlg->myDestDY->setReadOnly(true); + myDlg->myDestDZ->setReadOnly(true); + } + if ( isPreview && isMoveNode && anId == 0 ) + anId = aPreviewer->FindNodeClosestTo(myDlg->myDestinationX->GetValue(), + myDlg->myDestinationY->GetValue(), + myDlg->myDestinationZ->GetValue()); + // find id and/or just compute preview + aPreviewer->MoveNode(anId, + myDlg->myDestinationX->GetValue(), + myDlg->myDestinationY->GetValue(), + myDlg->myDestinationZ->GetValue()); - if ( preview ) { // fill preview data + if ( isPreview ) { // fill preview data aMeshPreviewStruct = aPreviewer->GetPreviewData(); moveShown = ( anId > 0 ); } @@ -718,9 +775,9 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() aMeshPreviewStruct = new SMESH::MeshPreviewStruct(); aMeshPreviewStruct->nodesXYZ.length(1); - aMeshPreviewStruct->nodesXYZ[0].x = myDlg->myX->GetValue(); - aMeshPreviewStruct->nodesXYZ[0].y = myDlg->myY->GetValue(); - aMeshPreviewStruct->nodesXYZ[0].z = myDlg->myZ->GetValue(); + aMeshPreviewStruct->nodesXYZ[0].x = myDlg->myDestinationX->GetValue(); + aMeshPreviewStruct->nodesXYZ[0].y = myDlg->myDestinationY->GetValue(); + aMeshPreviewStruct->nodesXYZ[0].z = myDlg->myDestinationZ->GetValue(); aMeshPreviewStruct->elementTypes.length(1); aMeshPreviewStruct->elementTypes[0].SMDS_ElementType = SMESH::NODE; @@ -737,7 +794,7 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() mySimulation->SetData(aMeshPreviewStruct._retn()); } else -{ + { mySimulation->SetVisibility(false); } diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h index 4ab5194e1..24be56a42 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -32,10 +32,12 @@ #include "SMESHGUI_Dialog.h" #include "SMESHGUI_SelectionOp.h" +class QButtonGroup; +class QCheckBox; class QGroupBox; class QLineEdit; class QPushButton; -class QCheckBox; +class QRadioButton; class SMESHGUI_SpinBox; class SMESHGUI_MeshEditPreview; class SMESHGUI_MakeNodeAtPointDlg; @@ -70,8 +72,11 @@ private slots: void redisplayPreview(); void onTextChange( const QString& ); void onUpdateDestination(); + void onDestCoordChanged(); private: + int GetConstructorId(); + SMESHGUI_MakeNodeAtPointDlg* myDlg; SUIT_SelectionFilter* myFilter; @@ -80,6 +85,7 @@ private: SMESH_Actor* myMeshActor; bool myNoPreview; bool myUpdateDestination; + bool myDestCoordChanged; }; /*! @@ -96,21 +102,29 @@ public: private: QWidget* createMainFrame( QWidget* ); - QPushButton* myCoordBtn; + QWidget* myMainFrame; + + QButtonGroup* myButtonGroup; + QRadioButton* myRButNodeToMove; + QRadioButton* myRButMoveWithoutNode; + QPushButton* myDestBtn; QPushButton* myUpdateBtn; - SMESHGUI_SpinBox* myX; - SMESHGUI_SpinBox* myY; - SMESHGUI_SpinBox* myZ; + QGroupBox* myDestinationGrp; QGroupBox* myNodeToMoveGrp; QPushButton* myIdBtn; QLineEdit* myId; SMESHGUI_SpinBox* myCurrentX; SMESHGUI_SpinBox* myCurrentY; SMESHGUI_SpinBox* myCurrentZ; - SMESHGUI_SpinBox* myDX; - SMESHGUI_SpinBox* myDY; - SMESHGUI_SpinBox* myDZ; - QCheckBox* myAutoSearchChkBox; + SMESHGUI_SpinBox* myDestinationX; + SMESHGUI_SpinBox* myDestinationY; + SMESHGUI_SpinBox* myDestinationZ; + QLabel* myDestDXLabel; + QLabel* myDestDYLabel; + QLabel* myDestDZLabel; + SMESHGUI_SpinBox* myDestDX; + SMESHGUI_SpinBox* myDestDY; + SMESHGUI_SpinBox* myDestDZ; QCheckBox* myPreviewChkBox; QString myHelpFileName; @@ -119,6 +133,7 @@ private: private slots: void ButtonToggled( bool ); + void ConstructorsClicked( int ); }; #endif // SMESHGUI_MAKENODEATPOINTDLG_H diff --git a/src/SMESHGUI/SMESHGUI_Measurements.cxx b/src/SMESHGUI/SMESHGUI_Measurements.cxx index 8cbf40364..e00937aff 100644 --- a/src/SMESHGUI/SMESHGUI_Measurements.cxx +++ b/src/SMESHGUI/SMESHGUI_Measurements.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Measurements.h b/src/SMESHGUI/SMESHGUI_Measurements.h index 65e3539cd..964f7418d 100644 --- a/src/SMESHGUI/SMESHGUI_Measurements.h +++ b/src/SMESHGUI/SMESHGUI_Measurements.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_MergeDlg.cxx b/src/SMESHGUI/SMESHGUI_MergeDlg.cxx index 24b96938d..f5b7754c2 100644 --- a/src/SMESHGUI/SMESHGUI_MergeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MergeDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_MergeDlg.h b/src/SMESHGUI/SMESHGUI_MergeDlg.h index de4fa51e6..fed3a1865 100644 --- a/src/SMESHGUI/SMESHGUI_MergeDlg.h +++ b/src/SMESHGUI/SMESHGUI_MergeDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx index 4b030bbc0..682673205 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -149,16 +149,20 @@ void SMESHGUI_MeshTab::setAvailableHyps( const int theId, const QStringList& the myAvailableHyps[ theId ] = theHyps; bool enable = ! theHyps.isEmpty(); - if ( theId == Algo ) + if ( theId == Algo ) // fill list of algos { myHyp[ Algo ]->clear(); - myHyp[ Algo ]->addItem( tr( "NONE" ) ); - myHyp[ Algo ]->addItems( theHyps ); - myHyp[ Algo ]->setCurrentIndex( 0 ); + if ( enable ) + { + myHyp[ Algo ]->addItem( tr( "NONE" ) ); + myHyp[ Algo ]->addItems( theHyps ); + myHyp[ Algo ]->setCurrentIndex( 0 ); + } } - else { + else // enable buttons + { myCreateHyp[ theId ]->setEnabled( enable ); - myEditHyp[ theId ]->setEnabled( false ); + myEditHyp [ theId ]->setEnabled( false ); } myHyp[ theId ]->setEnabled( enable ); } @@ -166,21 +170,30 @@ void SMESHGUI_MeshTab::setAvailableHyps( const int theId, const QStringList& the //================================================================================ /*! * \brief Sets existing hypothesis - * \param theId - identifier of hypothesis (main or additional, see HypType enumeration) - * \param theHyps - list of available hypothesis names - * + * \param theId - identifier of hypothesis (main or additional, see HypType enumeration) + * \param theHyps - list of available hypothesis names + * \param theDefaultAvlbl - \c true means that the algorithm can with w/o hypothesis + * with some default parameters + * * Sets existing main or additional hypothesis for this tab */ //================================================================================ -void SMESHGUI_MeshTab::setExistingHyps( const int theId, const QStringList& theHyps ) +void SMESHGUI_MeshTab::setExistingHyps( const int theId, + const QStringList& theHyps, + bool theDefaultAvlbl) { if ( theId != Algo ) { + bool enable = ! myAvailableHyps[ theId ].isEmpty(); myHyp[ theId ]->clear(); - myHyp[ theId ]->addItem( tr( "NONE" ) ); - myHyp[ theId ]->addItems( theHyps ); - myHyp[ theId ]->setCurrentIndex( 0 ); - myHyp[ theId ]->setEnabled( !theHyps.isEmpty() ); + if ( enable ) + { + QString none = tr( theDefaultAvlbl ? "DEFAULT" : ( theId == AddHyp ) ? "NONE" : "NONE" ); + myHyp[ theId ]->addItem( none ); + myHyp[ theId ]->addItems( theHyps ); + myHyp[ theId ]->setCurrentIndex( 0 ); + } + myHyp [ theId ]->setEnabled( enable ); myEditHyp[ theId ]->setEnabled( false ); } } @@ -188,9 +201,9 @@ void SMESHGUI_MeshTab::setExistingHyps( const int theId, const QStringList& theH //================================================================================ /*! * \brief Adds hypothesis in combo box of available ones - * \param theId - identifier of hypothesis (main or additional, see HypType enumeration) - * \param theHyp - name of hypothesis to be added - * + * \param theId - identifier of hypothesis (main or additional, see HypType enumeration) + * \param theHyp - name of hypothesis to be added + * * Adds hypothesis in combo box of available ones. This method is called by operation * after creation of new hypothesis. */ @@ -364,6 +377,9 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh // geometry createObject( tr( "GEOMETRY" ), mainFrame(), Geom ); myGeomPopup = 0; + // mesh type + QLabel* anMeshTypeLbl = new QLabel( tr( "MESH_TYPE" ), this ); + myMeshType = new QComboBox( this ); // Create tab widget @@ -398,10 +414,16 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh aLay->addWidget( objectWg( Geom, Label ), 2, 0 ); aLay->addWidget( objectWg( Geom, Btn ), 2, 1 ); aLay->addWidget( objectWg( Geom, Control ), 2, 2 ); - aLay->addWidget( myTabWg, 4, 0, 1, 3 ); - aLay->addWidget( myHypoSetButton, 5, 0, 1, 3 ); + aLay->addWidget( anMeshTypeLbl, 3, 0 ); + aLay->addWidget( myMeshType, 3, 2 ); + aLay->addWidget( myTabWg, 5, 0, 1, 3 ); + aLay->addWidget( myHypoSetButton, 6, 0, 1, 3 ); aLay->setRowMinimumHeight( 3, 20 ); + myMeshType->clear(); + + // Connect signals and slots + connect( myMeshType, SIGNAL( activated( int ) ), SLOT( onChangedMeshType( int ) ) ); // Disable controls if necessary setObjectShown( Mesh, false ); if ( theToCreate ) @@ -615,3 +637,43 @@ int SMESHGUI_MeshDlg::getActiveObject() return i; return -1; } +//================================================================================ +/*! + * \brief Sets available types of mesh + * \param theTypeMesh - list of available types of mesh + */ +//================================================================================ +void SMESHGUI_MeshDlg::setAvailableMeshType( const QStringList& theTypeMesh ) +{ + myMeshType->clear(); + myMeshType->addItems(theTypeMesh); +} +//================================================================================ +/*! + * \brief Emits selectMeshType( const int, const int ) signal + * + * SLOT is called when a combo box "mesh type" is selected. + */ +//================================================================================ +void SMESHGUI_MeshDlg::onChangedMeshType( const int isIndex ) +{ + emit selectMeshType( Dim3D - myTabWg->currentIndex(), isIndex ); +} +//================================================================================ +/*! + * \brief Get current index types of mesh + */ +//================================================================================ +int SMESHGUI_MeshDlg::currentMeshType( ) +{ + return myMeshType->currentIndex( ); +} +//================================================================================ +/*! + * \brief Set current index types of mesh + */ +//================================================================================ +void SMESHGUI_MeshDlg::setCurrentMeshType( const int theIndex ) +{ + myMeshType->setCurrentIndex( theIndex ); +} diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.h b/src/SMESHGUI/SMESHGUI_MeshDlg.h index 6ba8e6cb9..2d0cdde74 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -74,21 +74,27 @@ public: void enableTab(const int); bool isTabEnabled(const int) const; int getActiveObject(); + void setAvailableMeshType(const QStringList& ); + int currentMeshType(); + void setCurrentMeshType( const int ); signals: void hypoSet( const QString& ); void geomSelectionByMesh( bool ); + void selectMeshType( const int, const int ); private slots: void onHypoSetPopup( QAction* ); void onGeomPopup( QAction* ); void onGeomSelectionButton( bool ); + void onChangedMeshType( const int ); private: QMap myTabs; QTabWidget* myTabWg; QToolButton* myHypoSetButton; QMenu* myGeomPopup; + QComboBox* myMeshType; }; /*! @@ -114,7 +120,7 @@ public: virtual ~SMESHGUI_MeshTab(); void setAvailableHyps( const int, const QStringList& ); - void setExistingHyps( const int, const QStringList& ); + void setExistingHyps( const int, const QStringList&, bool=false); void addHyp( const int, const QString& ); void renameHyp( const int, const int, const QString& ); void setCurrentHyp( const int, const int ); diff --git a/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx b/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx index 439abbb57..ef9ac22ad 100644 --- a/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,23 +28,26 @@ #include "SMESHGUI_MeshEditPreview.h" #include "SMESHGUI_VTKUtils.h" - -#include -#include +#include "SMESH_Actor.h" +#include "SMESH_ActorUtils.h" // SALOME GUI includes -#include +#include #include +#include // VTK includes -#include -#include #include -#include -#include -#include +#include #include +#include +#include #include +#include +#include +#include +#include +#include // Qt includes #include @@ -53,6 +56,8 @@ #include #include CORBA_SERVER_HEADER(SMESH_MeshEditor) +#include + //================================================================================ /*! * \brief Constructor @@ -86,7 +91,6 @@ SMESHGUI_MeshEditPreview::SMESHGUI_MeshEditPreview(SVTK_ViewWindow* theViewWindo aMapper->Delete(); myViewWindow->AddActor(myPreviewActor); - } //================================================================================ @@ -99,9 +103,15 @@ SMESHGUI_MeshEditPreview::~SMESHGUI_MeshEditPreview() { myGrid->Delete(); + for ( size_t iA = 0; iA < myLabelActors.size(); ++iA ) + if ( myLabelActors[iA] ) + { + myPreviewActor->GetRenderer()->RemoveActor( myLabelActors[iA] ); + myLabelActors[iA]->Delete(); + } + myViewWindow->RemoveActor(myPreviewActor); myPreviewActor->Delete(); - } //================================================================================ @@ -224,6 +234,128 @@ void SMESHGUI_MeshEditPreview::SetData (const SMESH::MeshPreviewStruct* previewD SetVisibility(true); } +//================================================================================ +/*! + * \brief Set shape of an arrow of a unit length and nb of arrows + */ +//================================================================================ + +void SMESHGUI_MeshEditPreview::SetArrowShapeAndNb( int nbArrows, + double headLength, + double headRadius, + double start, + const char* labels) +{ + const int theNbPoints = 10; // in one arrow + myUnitArrowPnts.reserve( theNbPoints ); + myUnitArrowPnts.clear(); + + // unit arrow || OZ + + for ( int i = 0; i < theNbPoints - 2; ++i ) + { + double angle = i * 2 * M_PI / ( theNbPoints - 2 ); + myUnitArrowPnts.push_back( gp_Pnt( headRadius * Cos( angle ), + headRadius * Sin( angle ), + 1. - headLength )); + } + myUnitArrowPnts.push_back( gp_Pnt( 0, 0, start )); + myUnitArrowPnts.push_back( gp_Pnt( 0, 0, 1 )); + + + // nodes of all arrows + + vtkPoints* aPoints = vtkPoints::New(); + aPoints->SetNumberOfPoints( theNbPoints * nbArrows ); + for ( int iP = 0, iA = 0; iA < nbArrows; ++iA ) + for ( int i = 0; i < theNbPoints; ++i, ++iP ) + aPoints->SetPoint( iP, + myUnitArrowPnts[i].X(), + myUnitArrowPnts[i].Y(), + myUnitArrowPnts[i].Z() ); + myGrid->SetPoints(aPoints); + aPoints->Delete(); + + // connectivity of all arrows + + const int theNbCells = ( theNbPoints - 1 ); // in one arrow + myGrid->Allocate( theNbCells * nbArrows ); + for ( int nP = 0, iA = 0; iA < nbArrows; ++iA, nP += theNbPoints ) + { + vtkIdType conn[3] = { theNbPoints - 1 + nP, // arrow end + theNbPoints - 3 + nP, // point on a circle + nP }; // point on a circle + for ( int i = 0; i < theNbCells-1; ++i ) + { + myGrid->InsertNextCell( VTK_TRIANGLE, 3, conn ); + conn[1] = conn[2]; + conn[2] = conn[2] + 1; + } + conn[1] = theNbPoints - 2 + nP; + myGrid->InsertNextCell( VTK_LINE, 2, conn ); + } + + myLabelActors.resize( nbArrows, ( vtkTextActor*) NULL ); + char label[] = "X"; + if ( labels ) + for ( int iP = 0, iA = 0; iA < nbArrows; ++iA ) + { + label[0] = labels[iA]; + vtkTextMapper* text = vtkTextMapper::New(); + text->SetInput( label ); + vtkCoordinate* coord = vtkCoordinate::New(); + + myLabelActors[iA] = vtkTextActor::New(); + //myLabelActors[iA]->SetMapper( text ); + myLabelActors[iA]->SetInput( label ); + myLabelActors[iA]->SetTextScaleModeToNone(); + myLabelActors[iA]->PickableOff(); + myLabelActors[iA]->GetPositionCoordinate()->SetReferenceCoordinate( coord ); + + text->Delete(); + coord->Delete(); + + myPreviewActor->GetRenderer()->AddActor(myLabelActors[iA]); + } +} + +//================================================================================ +/*! + * \brief Set data to show moved/rotated/scaled arrows + * \param [in] axes - location and direction of the arrows + * \param [in] length - length of arrows + */ +//================================================================================ + +void SMESHGUI_MeshEditPreview::SetArrows( const gp_Ax1* axes, + double length ) +{ + vtkPoints* aPoints = myGrid->GetPoints(); + + for ( int iP = 0, iA = 0; iA < myLabelActors.size(); ++iA ) + { + gp_Trsf trsf; + trsf.SetTransformation( gp_Ax3( axes[iA].Location(), axes[iA].Direction() ), gp::XOY() ); + + for ( size_t i = 0; i < myUnitArrowPnts.size(); ++i, ++iP ) + { + gp_Pnt p = myUnitArrowPnts[i].Scaled( gp::Origin(), length ); + p.Transform( trsf ); + aPoints->SetPoint( iP, p.X(), p.Y(), p.Z() ); + } + if ( myLabelActors[iA] ) + if ( vtkCoordinate* aCoord = + myLabelActors[iA]->GetPositionCoordinate()->GetReferenceCoordinate() ) + { + double p[3]; + aPoints->GetPoint( iP-1, p ); + aCoord->SetValue( p ); + } + } + + myGrid->Modified(); +} + //================================================================================ /*! * \brief Set visibility @@ -233,6 +365,9 @@ void SMESHGUI_MeshEditPreview::SetData (const SMESH::MeshPreviewStruct* previewD void SMESHGUI_MeshEditPreview::SetVisibility (bool theVisibility) { myPreviewActor->SetVisibility(theVisibility); + for ( size_t iA = 0; iA < myLabelActors.size(); ++iA ) + if ( myLabelActors[iA] ) + myLabelActors[iA]->SetVisibility(theVisibility); SMESH::RepaintCurrentView(); } @@ -252,7 +387,19 @@ void SMESHGUI_MeshEditPreview::SetColor(double R, double G, double B) * \brief Get preview actor */ //================================================================================ + SALOME_Actor* SMESHGUI_MeshEditPreview::GetActor() const { return myPreviewActor; } + +//================================================================================ +/*! + * \brief Returns the priewed vtkUnstructuredGrid + */ +//================================================================================ + +vtkUnstructuredGrid* SMESHGUI_MeshEditPreview::GetGrid() const +{ + return myGrid; +} diff --git a/src/SMESHGUI/SMESHGUI_MeshEditPreview.h b/src/SMESHGUI/SMESHGUI_MeshEditPreview.h index bd94152ea..7eaff287a 100644 --- a/src/SMESHGUI/SMESHGUI_MeshEditPreview.h +++ b/src/SMESHGUI/SMESHGUI_MeshEditPreview.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -27,12 +27,15 @@ #ifndef SMESHGUI_MESHEDITPREVIEW_H #define SMESHGUI_MESHEDITPREVIEW_H -// SMESH includes #include "SMESH_SMESHGUI.hxx" +#include +#include +#include +class SALOME_Actor; class SVTK_ViewWindow; +class vtkTextActor; class vtkUnstructuredGrid; -class SALOME_Actor; namespace SMESH { @@ -49,14 +52,28 @@ class SMESHGUI_EXPORT SMESHGUI_MeshEditPreview vtkUnstructuredGrid* myGrid; SALOME_Actor* myPreviewActor; + std::vector myUnitArrowPnts; + std::vector myLabelActors; + public: SMESHGUI_MeshEditPreview( SVTK_ViewWindow* ); ~SMESHGUI_MeshEditPreview(); void SetData( const SMESH::MeshPreviewStruct* ); + void SetVisibility( bool ); void SetColor( double, double, double ); + + void SetArrowShapeAndNb( int nbArrows, + double headLength, + double headRadius, + double start=0., + const char* labels=0); + void SetArrows( const gp_Ax1* axes, + double length); + SALOME_Actor* GetActor() const; + vtkUnstructuredGrid* GetGrid() const; }; #endif // SMESHGUI_MESHEDITPREVIEW_H diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx index e17221fff..2dca23bba 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,6 +29,7 @@ #include "SMDS_EdgePosition.hxx" #include "SMDS_FacePosition.hxx" #include "SMDS_Mesh.hxx" +#include "SMDS_VolumeTool.hxx" #include "SMESHDS_Mesh.hxx" #include "SMESHGUI.h" #include "SMESHGUI_FilterUtils.h" @@ -246,20 +247,22 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent ) // elements QWidget* aElemLine = createLine(); - QLabel* aElemLab = new QLabel( tr( "ELEMENTS_LAB" ), this ); - QLabel* aElemTotal = new QLabel( tr( "TOTAL_LAB" ), this ); - QLabel* aElemLin = new QLabel( tr( "LINEAR_LAB" ), this ); - QLabel* aElemQuad = new QLabel( tr( "QUADRATIC_LAB" ), this ); + QLabel* aElemLab = new QLabel( tr( "ELEMENTS_LAB" ), this ); + QLabel* aElemTotal = new QLabel( tr( "TOTAL_LAB" ), this ); + QLabel* aElemLin = new QLabel( tr( "LINEAR_LAB" ), this ); + QLabel* aElemQuad = new QLabel( tr( "QUADRATIC_LAB" ), this ); + QLabel* aElemBiQuad = new QLabel( tr( "BI_QUADRATIC_LAB" ), this ); myWidgets[ index++ ] << aElemLine; - myWidgets[ index++ ] << aElemLab << aElemTotal << aElemLin << aElemQuad; + myWidgets[ index++ ] << aElemLab << aElemTotal << aElemLin << aElemQuad << aElemBiQuad; // ... Number elements QWidget* aNbLine = createLine(); QLabel* aNbTotal = createField(); QLabel* aNbLin = createField(); QLabel* aNbQuad = createField(); + QLabel* aNbBiQuad = createField(); myWidgets[ index++ ] << aNbLine; - myWidgets[ index++ ] << new QLabel( "", this ) << aNbTotal << aNbLin << aNbQuad; + myWidgets[ index++ ] << new QLabel( "", this ) << aNbTotal << aNbLin << aNbQuad << aNbBiQuad; // ... 0D elements QWidget* a0DLine = createLine(); @@ -285,57 +288,62 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent ) myWidgets[ index++ ] << a1DLab << a1DTotal << a1DLin << a1DQuad; // ... 2D elements - QWidget* a2DLine = createLine(); - QLabel* a2DLab = new QLabel( tr( "2D_LAB" ), this ); - QLabel* a2DTotal = createField(); - QLabel* a2DLin = createField(); - QLabel* a2DQuad = createField(); - QLabel* a2DTriLab = new QLabel( tr( "TRIANGLES_LAB" ), this ); - QLabel* a2DTriTotal = createField(); - QLabel* a2DTriLin = createField(); - QLabel* a2DTriQuad = createField(); - QLabel* a2DQuaLab = new QLabel( tr( "QUADRANGLES_LAB" ), this ); - QLabel* a2DQuaTotal = createField(); - QLabel* a2DQuaLin = createField(); - QLabel* a2DQuaQuad = createField(); - QLabel* a2DPolLab = new QLabel( tr( "POLYGONS_LAB" ), this ); - QLabel* a2DPolTotal = createField(); + QWidget* a2DLine = createLine(); + QLabel* a2DLab = new QLabel( tr( "2D_LAB" ), this ); + QLabel* a2DTotal = createField(); + QLabel* a2DLin = createField(); + QLabel* a2DQuad = createField(); + QLabel* a2DBiQuad = createField(); + QLabel* a2DTriLab = new QLabel( tr( "TRIANGLES_LAB" ), this ); + QLabel* a2DTriTotal = createField(); + QLabel* a2DTriLin = createField(); + QLabel* a2DTriQuad = createField(); + QLabel* a2DTriBiQuad = createField(); + QLabel* a2DQuaLab = new QLabel( tr( "QUADRANGLES_LAB" ), this ); + QLabel* a2DQuaTotal = createField(); + QLabel* a2DQuaLin = createField(); + QLabel* a2DQuaQuad = createField(); + QLabel* a2DQuaBiQuad = createField(); + QLabel* a2DPolLab = new QLabel( tr( "POLYGONS_LAB" ), this ); + QLabel* a2DPolTotal = createField(); myWidgets[ index++ ] << a2DLine; - myWidgets[ index++ ] << a2DLab << a2DTotal << a2DLin << a2DQuad; - myWidgets[ index++ ] << a2DTriLab << a2DTriTotal << a2DTriLin << a2DTriQuad; - myWidgets[ index++ ] << a2DQuaLab << a2DQuaTotal << a2DQuaLin << a2DQuaQuad; + myWidgets[ index++ ] << a2DLab << a2DTotal << a2DLin << a2DQuad << a2DBiQuad; + myWidgets[ index++ ] << a2DTriLab << a2DTriTotal << a2DTriLin << a2DTriQuad << a2DTriBiQuad; + myWidgets[ index++ ] << a2DQuaLab << a2DQuaTotal << a2DQuaLin << a2DQuaQuad << a2DQuaBiQuad; myWidgets[ index++ ] << a2DPolLab << a2DPolTotal; // ... 3D elements - QWidget* a3DLine = createLine(); - QLabel* a3DLab = new QLabel( tr( "3D_LAB" ), this ); - QLabel* a3DTotal = createField(); - QLabel* a3DLin = createField(); - QLabel* a3DQuad = createField(); - QLabel* a3DTetLab = new QLabel( tr( "TETRAHEDRONS_LAB" ), this ); - QLabel* a3DTetTotal = createField(); - QLabel* a3DTetLin = createField(); - QLabel* a3DTetQuad = createField(); - QLabel* a3DHexLab = new QLabel( tr( "HEXAHEDONRS_LAB" ), this ); - QLabel* a3DHexTotal = createField(); - QLabel* a3DHexLin = createField(); - QLabel* a3DHexQuad = createField(); - QLabel* a3DPyrLab = new QLabel( tr( "PYRAMIDS_LAB" ), this ); - QLabel* a3DPyrTotal = createField(); - QLabel* a3DPyrLin = createField(); - QLabel* a3DPyrQuad = createField(); - QLabel* a3DPriLab = new QLabel( tr( "PRISMS_LAB" ), this ); - QLabel* a3DPriTotal = createField(); - QLabel* a3DPriLin = createField(); - QLabel* a3DPriQuad = createField(); + QWidget* a3DLine = createLine(); + QLabel* a3DLab = new QLabel( tr( "3D_LAB" ), this ); + QLabel* a3DTotal = createField(); + QLabel* a3DLin = createField(); + QLabel* a3DQuad = createField(); + QLabel* a3DBiQuad = createField(); + QLabel* a3DTetLab = new QLabel( tr( "TETRAHEDRONS_LAB" ), this ); + QLabel* a3DTetTotal = createField(); + QLabel* a3DTetLin = createField(); + QLabel* a3DTetQuad = createField(); + QLabel* a3DHexLab = new QLabel( tr( "HEXAHEDONRS_LAB" ), this ); + QLabel* a3DHexTotal = createField(); + QLabel* a3DHexLin = createField(); + QLabel* a3DHexQuad = createField(); + QLabel* a3DHexBiQuad = createField(); + QLabel* a3DPyrLab = new QLabel( tr( "PYRAMIDS_LAB" ), this ); + QLabel* a3DPyrTotal = createField(); + QLabel* a3DPyrLin = createField(); + QLabel* a3DPyrQuad = createField(); + QLabel* a3DPriLab = new QLabel( tr( "PRISMS_LAB" ), this ); + QLabel* a3DPriTotal = createField(); + QLabel* a3DPriLin = createField(); + QLabel* a3DPriQuad = createField(); QLabel* a3DHexPriLab = new QLabel( tr( "HEX_PRISMS_LAB" ), this ); QLabel* a3DHexPriTotal = createField(); - QLabel* a3DPolLab = new QLabel( tr( "POLYHEDRONS_LAB" ), this ); - QLabel* a3DPolTotal = createField(); + QLabel* a3DPolLab = new QLabel( tr( "POLYHEDRONS_LAB" ), this ); + QLabel* a3DPolTotal = createField(); myWidgets[ index++ ] << a3DLine; - myWidgets[ index++ ] << a3DLab << a3DTotal << a3DLin << a3DQuad; + myWidgets[ index++ ] << a3DLab << a3DTotal << a3DLin << a3DQuad << a3DBiQuad; myWidgets[ index++ ] << a3DTetLab << a3DTetTotal << a3DTetLin << a3DTetQuad; - myWidgets[ index++ ] << a3DHexLab << a3DHexTotal << a3DHexLin << a3DHexQuad; + myWidgets[ index++ ] << a3DHexLab << a3DHexTotal << a3DHexLin << a3DHexQuad << a3DHexBiQuad; myWidgets[ index++ ] << a3DPyrLab << a3DPyrTotal << a3DPyrLin << a3DPyrQuad; myWidgets[ index++ ] << a3DPriLab << a3DPriTotal << a3DPriLin << a3DPriQuad; myWidgets[ index++ ] << a3DHexPriLab << a3DHexPriTotal; @@ -345,92 +353,101 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent ) myLoadBtn->setAutoDefault( true ); connect( myLoadBtn, SIGNAL( clicked() ), this, SLOT( loadMesh() ) ); - setFontAttributes( aNameLab, Bold ); - setFontAttributes( aObjLab, Bold ); - setFontAttributes( aNodesLab, Bold ); - setFontAttributes( aElemLab, Bold ); - setFontAttributes( aElemTotal, Italic ); - setFontAttributes( aElemLin, Italic ); - setFontAttributes( aElemQuad, Italic ); - setFontAttributes( a0DLab, Bold ); - setFontAttributes( aBallLab, Bold ); - setFontAttributes( a1DLab, Bold ); - setFontAttributes( a2DLab, Bold ); - setFontAttributes( a3DLab, Bold ); + setFontAttributes( aNameLab, Bold ); + setFontAttributes( aObjLab, Bold ); + setFontAttributes( aNodesLab, Bold ); + setFontAttributes( aElemLab, Bold ); + setFontAttributes( aElemTotal, Italic ); + setFontAttributes( aElemLin, Italic ); + setFontAttributes( aElemQuad, Italic ); + setFontAttributes( aElemBiQuad, Italic ); + setFontAttributes( a0DLab, Bold ); + setFontAttributes( aBallLab, Bold ); + setFontAttributes( a1DLab, Bold ); + setFontAttributes( a2DLab, Bold ); + setFontAttributes( a3DLab, Bold ); l->addWidget( aNameLab, 0, 0 ); - l->addWidget( aName, 0, 1, 1, 3 ); + l->addWidget( aName, 0, 1, 1, 4 ); l->addWidget( aObjLab, 1, 0 ); - l->addWidget( aObj, 1, 1, 1, 3 ); - l->addWidget( aNodesLine, 2, 0, 1, 4 ); + l->addWidget( aObj, 1, 1, 1, 4 ); + l->addWidget( aNodesLine, 2, 0, 1, 5 ); l->addWidget( aNodesLab, 3, 0 ); l->addWidget( aNodes, 3, 1 ); - l->addWidget( aElemLine, 4, 0, 1, 4 ); + l->addWidget( aElemLine, 4, 0, 1, 5 ); l->addWidget( aElemLab, 5, 0 ); l->addWidget( aElemTotal, 5, 1 ); l->addWidget( aElemLin, 5, 2 ); l->addWidget( aElemQuad, 5, 3 ); - l->addWidget( aNbLine, 6, 1, 1, 3 ); + l->addWidget( aElemBiQuad, 5, 4 ); + l->addWidget( aNbLine, 6, 1, 1, 4 ); l->addWidget( aNbTotal, 7, 1 ); l->addWidget( aNbLin, 7, 2 ); l->addWidget( aNbQuad, 7, 3 ); - l->addWidget( a0DLine, 8, 1, 1, 3 ); + l->addWidget( aNbBiQuad, 7, 4 ); + l->addWidget( a0DLine, 8, 1, 1, 4 ); l->addWidget( a0DLab, 9, 0 ); l->addWidget( a0DTotal, 9, 1 ); - l->addWidget( aBallLine, 10, 1, 1, 3 ); + l->addWidget( aBallLine, 10, 1, 1, 4 ); l->addWidget( aBallLab, 11, 0 ); l->addWidget( aBallTotal, 11, 1 ); - l->addWidget( a1DLine, 12, 1, 1, 3 ); + l->addWidget( a1DLine, 12, 1, 1, 4 ); l->addWidget( a1DLab, 13, 0 ); l->addWidget( a1DTotal, 13, 1 ); l->addWidget( a1DLin, 13, 2 ); l->addWidget( a1DQuad, 13, 3 ); - l->addWidget( a2DLine, 14, 1, 1, 3 ); - l->addWidget( a2DLab, 15, 0 ); - l->addWidget( a2DTotal, 15, 1 ); - l->addWidget( a2DLin, 15, 2 ); - l->addWidget( a2DQuad, 15, 3 ); - l->addWidget( a2DTriLab, 16, 0 ); - l->addWidget( a2DTriTotal, 16, 1 ); - l->addWidget( a2DTriLin, 16, 2 ); - l->addWidget( a2DTriQuad, 16, 3 ); - l->addWidget( a2DQuaLab, 17, 0 ); - l->addWidget( a2DQuaTotal, 17, 1 ); - l->addWidget( a2DQuaLin, 17, 2 ); - l->addWidget( a2DQuaQuad, 17, 3 ); - l->addWidget( a2DPolLab, 18, 0 ); - l->addWidget( a2DPolTotal, 18, 1 ); - l->addWidget( a3DLine, 19, 1, 1, 3 ); - l->addWidget( a3DLab, 20, 0 ); - l->addWidget( a3DTotal, 20, 1 ); - l->addWidget( a3DLin, 20, 2 ); - l->addWidget( a3DQuad, 20, 3 ); - l->addWidget( a3DTetLab, 21, 0 ); - l->addWidget( a3DTetTotal, 21, 1 ); - l->addWidget( a3DTetLin, 21, 2 ); - l->addWidget( a3DTetQuad, 21, 3 ); - l->addWidget( a3DHexLab, 22, 0 ); - l->addWidget( a3DHexTotal, 22, 1 ); - l->addWidget( a3DHexLin, 22, 2 ); - l->addWidget( a3DHexQuad, 22, 3 ); - l->addWidget( a3DPyrLab, 23, 0 ); - l->addWidget( a3DPyrTotal, 23, 1 ); - l->addWidget( a3DPyrLin, 23, 2 ); - l->addWidget( a3DPyrQuad, 23, 3 ); - l->addWidget( a3DPriLab, 24, 0 ); - l->addWidget( a3DPriTotal, 24, 1 ); - l->addWidget( a3DPriLin, 24, 2 ); - l->addWidget( a3DPriQuad, 24, 3 ); + l->addWidget( a2DLine, 14, 1, 1, 4 ); + l->addWidget( a2DLab, 15, 0 ); + l->addWidget( a2DTotal, 15, 1 ); + l->addWidget( a2DLin, 15, 2 ); + l->addWidget( a2DQuad, 15, 3 ); + l->addWidget( a2DBiQuad, 15, 4 ); + l->addWidget( a2DTriLab, 16, 0 ); + l->addWidget( a2DTriTotal, 16, 1 ); + l->addWidget( a2DTriLin, 16, 2 ); + l->addWidget( a2DTriQuad, 16, 3 ); + l->addWidget( a2DTriBiQuad, 16, 4 ); + l->addWidget( a2DQuaLab, 17, 0 ); + l->addWidget( a2DQuaTotal, 17, 1 ); + l->addWidget( a2DQuaLin, 17, 2 ); + l->addWidget( a2DQuaQuad, 17, 3 ); + l->addWidget( a2DQuaBiQuad, 17, 4 ); + l->addWidget( a2DPolLab, 18, 0 ); + l->addWidget( a2DPolTotal, 18, 1 ); + l->addWidget( a3DLine, 19, 1, 1, 4 ); + l->addWidget( a3DLab, 20, 0 ); + l->addWidget( a3DTotal, 20, 1 ); + l->addWidget( a3DLin, 20, 2 ); + l->addWidget( a3DQuad, 20, 3 ); + l->addWidget( a3DBiQuad, 20, 4 ); + l->addWidget( a3DTetLab, 21, 0 ); + l->addWidget( a3DTetTotal, 21, 1 ); + l->addWidget( a3DTetLin, 21, 2 ); + l->addWidget( a3DTetQuad, 21, 3 ); + l->addWidget( a3DHexLab, 22, 0 ); + l->addWidget( a3DHexTotal, 22, 1 ); + l->addWidget( a3DHexLin, 22, 2 ); + l->addWidget( a3DHexQuad, 22, 3 ); + l->addWidget( a3DHexBiQuad, 22, 4 ); + l->addWidget( a3DPyrLab, 23, 0 ); + l->addWidget( a3DPyrTotal, 23, 1 ); + l->addWidget( a3DPyrLin, 23, 2 ); + l->addWidget( a3DPyrQuad, 23, 3 ); + l->addWidget( a3DPriLab, 24, 0 ); + l->addWidget( a3DPriTotal, 24, 1 ); + l->addWidget( a3DPriLin, 24, 2 ); + l->addWidget( a3DPriQuad, 24, 3 ); l->addWidget( a3DHexPriLab, 25, 0 ); l->addWidget( a3DHexPriTotal, 25, 1 ); - l->addWidget( a3DPolLab, 26, 0 ); - l->addWidget( a3DPolTotal, 26, 1 ); - l->addWidget( myLoadBtn, 28, 1, 1, 3 ); + l->addWidget( a3DPolLab, 26, 0 ); + l->addWidget( a3DPolTotal, 26, 1 ); + l->addWidget( myLoadBtn, 28, 1, 1, 4 ); l->setColumnStretch( 0, 0 ); l->setColumnStretch( 1, 5 ); l->setColumnStretch( 2, 5 ); l->setColumnStretch( 3, 5 ); + l->setColumnStretch( 4, 5 ); l->setRowStretch( 27, 5 ); clear(); @@ -484,49 +501,59 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) myWidgets[i1D][iTotal] ->setProperty( "text", QString::number( nbEdges ) ); myWidgets[i1D][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Edge] ) ); myWidgets[i1D][iQuadratic]->setProperty( "text", QString::number( info[SMDSEntity_Quad_Edge] ) ); - long nbTriangles = info[SMDSEntity_Triangle] + info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_BiQuad_Triangle]; - long nbQuadrangles = info[SMDSEntity_Quadrangle] + info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle]; - long nb2DLinear = info[SMDSEntity_Triangle] + info[SMDSEntity_Quadrangle] + info[SMDSEntity_Polygon]; - long nb2DQuadratic = info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_BiQuad_Triangle] + info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle]; - myWidgets[i2D][iTotal] ->setProperty( "text", QString::number( nb2DLinear + nb2DQuadratic )); - myWidgets[i2D][iLinear] ->setProperty( "text", QString::number( nb2DLinear ) ); - myWidgets[i2D][iQuadratic] ->setProperty( "text", QString::number( nb2DQuadratic ) ); - myWidgets[i2DTriangles][iTotal] ->setProperty( "text", QString::number( nbTriangles ) ); - myWidgets[i2DTriangles][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Triangle] ) ); - myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_BiQuad_Triangle]) ); - myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", QString::number( nbQuadrangles ) ); - myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Quadrangle] ) ); - myWidgets[i2DQuadrangles][iQuadratic]->setProperty( "text", QString::number( info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle] )); - myWidgets[i2DPolygons][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Polygon] ) ); - long nbTetrahedrons = info[SMDSEntity_Tetra] + info[SMDSEntity_Quad_Tetra]; - long nbHexahedrons = info[SMDSEntity_Hexa] + info[SMDSEntity_Quad_Hexa] + info[SMDSEntity_TriQuad_Hexa]; - long nbPyramids = info[SMDSEntity_Pyramid] + info[SMDSEntity_Quad_Pyramid]; - long nbPrisms = info[SMDSEntity_Penta] + info[SMDSEntity_Quad_Penta]; - long nb3DLinear = info[SMDSEntity_Tetra] + info[SMDSEntity_Hexa] + info[SMDSEntity_Pyramid] + info[SMDSEntity_Penta] + info[SMDSEntity_Polyhedra] + info[SMDSEntity_Hexagonal_Prism]; - long nb3DQuadratic = info[SMDSEntity_Quad_Tetra] + info[SMDSEntity_Quad_Hexa] + info[SMDSEntity_TriQuad_Hexa] + info[SMDSEntity_Quad_Pyramid] + info[SMDSEntity_Quad_Penta]; - myWidgets[i3D][iTotal] ->setProperty( "text", QString::number( nb3DLinear + nb3DQuadratic ) ); - myWidgets[i3D][iLinear] ->setProperty( "text", QString::number( nb3DLinear ) ); - myWidgets[i3D][iQuadratic] ->setProperty( "text", QString::number( nb3DQuadratic ) ); - myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", QString::number( nbTetrahedrons ) ); - myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Tetra] ) ); - myWidgets[i3DTetrahedrons][iQuadratic]->setProperty( "text", QString::number( info[SMDSEntity_Quad_Tetra] ) ); - myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", QString::number( nbHexahedrons ) ); - myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Hexa] ) ); - myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Hexa] + info[SMDSEntity_TriQuad_Hexa] ) ); - myWidgets[i3DPyramids][iTotal] ->setProperty( "text", QString::number( nbPyramids ) ); - myWidgets[i3DPyramids][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Pyramid] ) ); - myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Pyramid] ) ); - myWidgets[i3DPrisms][iTotal] ->setProperty( "text", QString::number( nbPrisms ) ); - myWidgets[i3DPrisms][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Penta] ) ); - myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Penta] ) ); - myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Hexagonal_Prism] ) ); - myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Polyhedra] ) ); - long nbElemTotal = info[SMDSEntity_0D] + info[SMDSEntity_Ball] + nbEdges + nb2DLinear + nb2DQuadratic + nb3DLinear + nb3DQuadratic; - long nbElemLinerial = info[SMDSEntity_Edge] + nb2DLinear + nb3DLinear; - long nbElemQuadratic = info[SMDSEntity_Quad_Edge] + nb2DQuadratic + nb3DQuadratic; - myWidgets[iNb][iTotal] ->setProperty( "text", QString::number( nbElemTotal ) ); - myWidgets[iNb][iLinear] ->setProperty( "text", QString::number( nbElemLinerial ) ); - myWidgets[iNb][iQuadratic]->setProperty( "text", QString::number( nbElemQuadratic ) ); + long nbTriangles = info[SMDSEntity_Triangle] + info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_BiQuad_Triangle]; + long nbQuadrangles = info[SMDSEntity_Quadrangle] + info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle]; + long nb2DLinear = info[SMDSEntity_Triangle] + info[SMDSEntity_Quadrangle] + info[SMDSEntity_Polygon]; + long nb2DQuadratic = info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_Quad_Quadrangle]; + long nb2DBiQuadratic = info[SMDSEntity_BiQuad_Triangle] + info[SMDSEntity_BiQuad_Quadrangle]; + + myWidgets[i2D][iTotal] ->setProperty( "text", QString::number( nb2DLinear + nb2DQuadratic )); + myWidgets[i2D][iLinear] ->setProperty( "text", QString::number( nb2DLinear ) ); + myWidgets[i2D][iQuadratic] ->setProperty( "text", QString::number( nb2DQuadratic ) ); + myWidgets[i2D][iBiQuadratic] ->setProperty( "text", QString::number( nb2DBiQuadratic ) ); + myWidgets[i2DTriangles][iTotal] ->setProperty( "text", QString::number( nbTriangles ) ); + myWidgets[i2DTriangles][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Triangle] ) ); + myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Triangle] ) ); + myWidgets[i2DTriangles][iBiQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_BiQuad_Triangle] ) ); + myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", QString::number( nbQuadrangles ) ); + myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Quadrangle] ) ); + myWidgets[i2DQuadrangles][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Quadrangle] ) ); + myWidgets[i2DQuadrangles][iBiQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_BiQuad_Quadrangle] ) ); + myWidgets[i2DPolygons][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Polygon] ) ); + long nbTetrahedrons = info[SMDSEntity_Tetra] + info[SMDSEntity_Quad_Tetra]; + long nbHexahedrons = info[SMDSEntity_Hexa] + info[SMDSEntity_Quad_Hexa] + info[SMDSEntity_TriQuad_Hexa]; + long nbPyramids = info[SMDSEntity_Pyramid] + info[SMDSEntity_Quad_Pyramid]; + long nbPrisms = info[SMDSEntity_Penta] + info[SMDSEntity_Quad_Penta]; + long nb3DLinear = info[SMDSEntity_Tetra] + info[SMDSEntity_Hexa] + info[SMDSEntity_Pyramid] + info[SMDSEntity_Penta] + info[SMDSEntity_Polyhedra] + info[SMDSEntity_Hexagonal_Prism]; + long nb3DQuadratic = info[SMDSEntity_Quad_Tetra] + info[SMDSEntity_Quad_Hexa] + info[SMDSEntity_Quad_Pyramid] + info[SMDSEntity_Quad_Penta]; + long nb3DBiQuadratic = info[SMDSEntity_TriQuad_Hexa]; + myWidgets[i3D][iTotal] ->setProperty( "text", QString::number( nb3DLinear + nb3DQuadratic ) ); + myWidgets[i3D][iLinear] ->setProperty( "text", QString::number( nb3DLinear ) ); + myWidgets[i3D][iQuadratic] ->setProperty( "text", QString::number( nb3DQuadratic ) ); + myWidgets[i3D][iBiQuadratic] ->setProperty( "text", QString::number( nb3DBiQuadratic ) ); + myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", QString::number( nbTetrahedrons ) ); + myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Tetra] ) ); + myWidgets[i3DTetrahedrons][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Tetra] ) ); + myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", QString::number( nbHexahedrons ) ); + myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Hexa] ) ); + myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Hexa] ) ); + myWidgets[i3DHexahedrons][iBiQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_TriQuad_Hexa] ) ); + myWidgets[i3DPyramids][iTotal] ->setProperty( "text", QString::number( nbPyramids ) ); + myWidgets[i3DPyramids][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Pyramid] ) ); + myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Pyramid] ) ); + myWidgets[i3DPrisms][iTotal] ->setProperty( "text", QString::number( nbPrisms ) ); + myWidgets[i3DPrisms][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Penta] ) ); + myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Penta] ) ); + myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Hexagonal_Prism] ) ); + myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Polyhedra] ) ); + long nbElemTotal = info[SMDSEntity_0D] + info[SMDSEntity_Ball] + nbEdges + nb2DLinear + nb2DQuadratic + nb2DBiQuadratic + nb3DLinear + nb3DQuadratic + nb3DBiQuadratic; + long nbElemLinerial = info[SMDSEntity_Edge] + nb2DLinear + nb3DLinear; + long nbElemQuadratic = info[SMDSEntity_Quad_Edge] + nb2DQuadratic + nb3DQuadratic; + long nbElemBiQuadratic = nb2DBiQuadratic + nb3DBiQuadratic; + myWidgets[iNb][iTotal] ->setProperty( "text", QString::number( nbElemTotal ) ); + myWidgets[iNb][iLinear] ->setProperty( "text", QString::number( nbElemLinerial ) ); + myWidgets[iNb][iQuadratic] ->setProperty( "text", QString::number( nbElemQuadratic ) ); + myWidgets[iNb][iBiQuadratic]->setProperty( "text", QString::number( nbElemBiQuadratic ) ); // before full loading from study file, type of elements in a sub-mesh can't be defined // in some cases bool infoOK = obj->IsMeshInfoCorrect(); @@ -541,82 +568,94 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) hasAnyInfo = info[i]; if ( hasAnyInfo ) // believe it is a sub-mesh { - if ( nb2DLinear + nb2DQuadratic > 0 ) + if ( nb2DLinear + nb2DQuadratic + nb2DBiQuadratic > 0 ) { - myWidgets[i2D][iLinear] ->setProperty( "text", "?" ); - myWidgets[i2D][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i2DTriangles][iTotal] ->setProperty( "text", "?" ); - myWidgets[i2DTriangles][iLinear] ->setProperty( "text", "?" ); - myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", "?" ); - myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", "?" ); - myWidgets[i2DQuadrangles][iQuadratic]->setProperty( "text", "?" ); - myWidgets[i2DPolygons][iTotal] ->setProperty( "text", "?" ); - myWidgets[iNb][iTotal] ->setProperty( "text", "?" ); - myWidgets[iNb][iLinear] ->setProperty( "text", "?" ); - myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2D][iLinear] ->setProperty( "text", "?" ); + myWidgets[i2D][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2D][iBiQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2DTriangles][iTotal] ->setProperty( "text", "?" ); + myWidgets[i2DTriangles][iLinear] ->setProperty( "text", "?" ); + myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2DTriangles][iBiQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", "?" ); + myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", "?" ); + myWidgets[i2DQuadrangles][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2DQuadrangles][iBiQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2DPolygons][iTotal] ->setProperty( "text", "?" ); + myWidgets[iNb][iTotal] ->setProperty( "text", "?" ); + myWidgets[iNb][iLinear] ->setProperty( "text", "?" ); + myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[iNb][iBiQuadratic] ->setProperty( "text", "?" ); } - else if ( nb3DLinear + nb3DQuadratic > 0 ) + else if ( nb3DLinear + nb3DQuadratic + nb3DBiQuadratic > 0 ) { - myWidgets[i3D][iLinear] ->setProperty( "text", "?" ); - myWidgets[i3D][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", "?" ); - myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", "?" ); - myWidgets[i3DTetrahedrons][iQuadratic]->setProperty( "text", "?" ); - myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", "?" ); - myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", "?" ); - myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i3DPyramids][iTotal] ->setProperty( "text", "?" ); - myWidgets[i3DPyramids][iLinear] ->setProperty( "text", "?" ); - myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i3DPrisms][iTotal] ->setProperty( "text", "?" ); - myWidgets[i3DPrisms][iLinear] ->setProperty( "text", "?" ); - myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", "?" ); - myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", "?" ); - myWidgets[iNb][iTotal] ->setProperty( "text", "?" ); - myWidgets[iNb][iLinear] ->setProperty( "text", "?" ); - myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3D][iLinear] ->setProperty( "text", "?" ); + myWidgets[i3D][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3D][iBiQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", "?" ); + myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", "?" ); + myWidgets[i3DTetrahedrons][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", "?" ); + myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", "?" ); + myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3DHexahedrons][iBiQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3DPyramids][iTotal] ->setProperty( "text", "?" ); + myWidgets[i3DPyramids][iLinear] ->setProperty( "text", "?" ); + myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3DPrisms][iTotal] ->setProperty( "text", "?" ); + myWidgets[i3DPrisms][iLinear] ->setProperty( "text", "?" ); + myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", "?" ); + myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", "?" ); + myWidgets[iNb][iTotal] ->setProperty( "text", "?" ); + myWidgets[iNb][iLinear] ->setProperty( "text", "?" ); + myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[iNb][iBiQuadratic] ->setProperty( "text", "?" ); } } else { - myWidgets[iNodes][iTotal] ->setProperty( "text", "?" ); - myWidgets[i0D][iTotal] ->setProperty( "text", "?" ); - myWidgets[iBalls][iTotal] ->setProperty( "text", "?" ); - myWidgets[i1D][iTotal] ->setProperty( "text", "?" ); - myWidgets[i1D][iLinear] ->setProperty( "text", "?" ); - myWidgets[i1D][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i2D][iTotal] ->setProperty( "text", "?" ); - myWidgets[i2D][iLinear] ->setProperty( "text", "?" ); - myWidgets[i2D][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i2DTriangles][iTotal] ->setProperty( "text", "?" ); - myWidgets[i2DTriangles][iLinear] ->setProperty( "text", "?" ); - myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", "?" ); - myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", "?" ); - myWidgets[i2DQuadrangles][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i2DPolygons][iTotal] ->setProperty( "text", "?" ); - myWidgets[i3D][iTotal] ->setProperty( "text", "?" ); - myWidgets[i3D][iLinear] ->setProperty( "text", "?" ); - myWidgets[i3D][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", "?" ); - myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", "?" ); - myWidgets[i3DTetrahedrons][iQuadratic]->setProperty( "text", "?" ); - myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", "?" ); - myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", "?" ); - myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i3DPyramids][iTotal] ->setProperty( "text", "?" ); - myWidgets[i3DPyramids][iLinear] ->setProperty( "text", "?" ); - myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i3DPrisms][iTotal] ->setProperty( "text", "?" ); - myWidgets[i3DPrisms][iLinear] ->setProperty( "text", "?" ); - myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", "?" ); - myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", "?" ); - myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", "?" ); - myWidgets[iNb][iTotal] ->setProperty( "text", "?" ); - myWidgets[iNb][iLinear] ->setProperty( "text", "?" ); - myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[iNodes][iTotal] ->setProperty( "text", "?" ); + myWidgets[i0D][iTotal] ->setProperty( "text", "?" ); + myWidgets[iBalls][iTotal] ->setProperty( "text", "?" ); + myWidgets[i1D][iTotal] ->setProperty( "text", "?" ); + myWidgets[i1D][iLinear] ->setProperty( "text", "?" ); + myWidgets[i1D][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2D][iTotal] ->setProperty( "text", "?" ); + myWidgets[i2D][iLinear] ->setProperty( "text", "?" ); + myWidgets[i2D][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2D][iBiQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2DTriangles][iTotal] ->setProperty( "text", "?" ); + myWidgets[i2DTriangles][iLinear] ->setProperty( "text", "?" ); + myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2DTriangles][iBiQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", "?" ); + myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", "?" ); + myWidgets[i2DQuadrangles][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2DQuadrangles][iBiQuadratic] ->setProperty( "text", "?" ); + myWidgets[i2DPolygons][iTotal] ->setProperty( "text", "?" ); + myWidgets[i3D][iTotal] ->setProperty( "text", "?" ); + myWidgets[i3D][iLinear] ->setProperty( "text", "?" ); + myWidgets[i3D][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", "?" ); + myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", "?" ); + myWidgets[i3DTetrahedrons][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", "?" ); + myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", "?" ); + myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3DHexahedrons][iBiQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3DPyramids][iTotal] ->setProperty( "text", "?" ); + myWidgets[i3DPyramids][iLinear] ->setProperty( "text", "?" ); + myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3DPrisms][iTotal] ->setProperty( "text", "?" ); + myWidgets[i3DPrisms][iLinear] ->setProperty( "text", "?" ); + myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", "?" ); + myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", "?" ); + myWidgets[iNb][iTotal] ->setProperty( "text", "?" ); + myWidgets[iNb][iLinear] ->setProperty( "text", "?" ); + myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[iNb][iBiQuadratic] ->setProperty( "text", "?" ); } } } @@ -651,44 +690,50 @@ void SMESHGUI_MeshInfo::loadMesh() */ void SMESHGUI_MeshInfo::clear() { - myWidgets[iName][iSingle] ->setProperty( "text", QString() ); - myWidgets[iObject][iSingle] ->setProperty( "text", QString() ); - myWidgets[iNodes][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i0D][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[iBalls][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i1D][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i1D][iLinear] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i1D][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i2D][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i2D][iLinear] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i2D][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i2DTriangles][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i2DTriangles][iLinear] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i2DQuadrangles][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i2DPolygons][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3D][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3D][iLinear] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3D][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DTetrahedrons][iQuadratic]->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DPyramids][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DPyramids][iLinear] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DPrisms][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DPrisms][iLinear] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[iNb][iTotal] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[iNb][iLinear] ->setProperty( "text", QString::number( 0 ) ); - myWidgets[iNb][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[iName][iSingle] ->setProperty( "text", QString() ); + myWidgets[iObject][iSingle] ->setProperty( "text", QString() ); + myWidgets[iNodes][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i0D][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[iBalls][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i1D][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i1D][iLinear] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i1D][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2D][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2D][iLinear] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2D][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2D][iBiQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2DTriangles][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2DTriangles][iLinear] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2DTriangles][iBiQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2DQuadrangles][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2DQuadrangles][iBiQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i2DPolygons][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3D][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3D][iLinear] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3D][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3D][iBiQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DTetrahedrons][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DHexahedrons][iBiQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DPyramids][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DPyramids][iLinear] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DPrisms][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DPrisms][iLinear] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[iNb][iTotal] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[iNb][iLinear] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[iNb][iQuadratic] ->setProperty( "text", QString::number( 0 ) ); + myWidgets[iNb][iBiQuadratic] ->setProperty( "text", QString::number( 0 ) ); } /*! @@ -763,6 +808,7 @@ void SMESHGUI_MeshInfo::saveInfo( QTextStream &out ) out << QString( SPACING_INFO, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[iNb][iTotal]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[iNb][iLinear]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[iNb][iQuadratic]->property( "text" ) ).toString() << "\n"; + out << QString( SPACING_INFO, ' ' ) << tr( "BI_QUADRATIC_LAB" ) << ": " << ( myWidgets[iNb][iBiQuadratic]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO, ' ' ) << tr( "0D_LAB" ) << "\n"; out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i0D][iTotal]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO, ' ' ) << tr( "BALL_LAB" ) << "\n"; @@ -775,20 +821,24 @@ void SMESHGUI_MeshInfo::saveInfo( QTextStream &out ) out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i2D][iTotal]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*2, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i2D][iLinear]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*2, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i2D][iQuadratic]->property( "text" ) ).toString() << "\n"; + out << QString( SPACING_INFO*2, ' ' ) << tr( "BI_QUADRATIC_LAB" ) << ": " << ( myWidgets[i2D][iBiQuadratic]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*2, ' ' ) << tr( "TRIANGLES_LAB" ) << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i2DTriangles][iTotal]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i2DTriangles][iLinear]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i2DTriangles][iQuadratic]->property( "text" ) ).toString() << "\n"; + out << QString( SPACING_INFO*3, ' ' ) << tr( "BI_QUADRATIC_LAB" ) << ": " << ( myWidgets[i2DTriangles][iBiQuadratic]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*2, ' ' ) << tr( "QUADRANGLES_LAB" ) << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i2DQuadrangles][iTotal]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i2DQuadrangles][iLinear]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i2DQuadrangles][iQuadratic]->property( "text" ) ).toString() << "\n"; + out << QString( SPACING_INFO*3, ' ' ) << tr( "BI_QUADRATIC_LAB" ) << ": " << ( myWidgets[i2DQuadrangles][iBiQuadratic]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*2, ' ' ) << tr( "POLYGONS_LAB" ) << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i2DPolygons][iTotal]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO, ' ' ) << tr( "3D_LAB" ) << "\n"; out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i3D][iTotal]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*2, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i3D][iLinear]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*2, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i3D][iQuadratic]->property( "text" ) ).toString() << "\n"; + out << QString( SPACING_INFO*2, ' ' ) << tr( "BI_QUADRATIC_LAB" ) << ": " << ( myWidgets[i3D][iBiQuadratic]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*2, ' ' ) << tr( "TETRAHEDRONS_LAB" ) << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i3DTetrahedrons][iTotal]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i3DTetrahedrons][iLinear]->property( "text" ) ).toString() << "\n"; @@ -797,6 +847,7 @@ void SMESHGUI_MeshInfo::saveInfo( QTextStream &out ) out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i3DHexahedrons][iTotal]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i3DHexahedrons][iLinear]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i3DHexahedrons][iQuadratic]->property( "text" ) ).toString() << "\n"; + out << QString( SPACING_INFO*3, ' ' ) << tr( "BI_QUADRATIC_LAB" ) << ": " << ( myWidgets[i3DHexahedrons][iBiQuadratic]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*2, ' ' ) << tr( "PYRAMIDS_LAB" ) << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i3DPyramids][iTotal]->property( "text" ) ).toString() << "\n"; out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i3DPyramids][iLinear]->property( "text" ) ).toString() << "\n"; @@ -1788,66 +1839,34 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) // connectivity QTreeWidgetItem* conItem = createItem( elemItem, Bold ); conItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) ); - SMDS_ElemIteratorPtr nodeIt = e->nodesIterator(); - for ( int idx = 1; nodeIt->more(); idx++ ) { - const SMDS_MeshNode* node = static_cast( nodeIt->next() ); - // node number and ID - QTreeWidgetItem* nodeItem = createItem( conItem, Bold ); - nodeItem->setText( 0, QString( "%1 %2 / %3" ).arg( SMESHGUI_ElemInfo::tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ) ); - nodeItem->setText( 1, QString( "#%1" ).arg( node->GetID() ) ); - nodeItem->setData( 1, TypeRole, ElemConnectivity ); - nodeItem->setData( 1, IdRole, node->GetID() ); - nodeItem->setExpanded( false ); - // node coordinates - QTreeWidgetItem* coordItem = createItem( nodeItem ); - coordItem->setText( 0, SMESHGUI_ElemInfo::tr( "COORDINATES" ) ); - QTreeWidgetItem* xItem = createItem( coordItem ); - xItem->setText( 0, "X" ); - xItem->setText( 1, QString::number( node->X(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); - QTreeWidgetItem* yItem = createItem( coordItem ); - yItem->setText( 0, "Y" ); - yItem->setText( 1, QString::number( node->Y(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); - QTreeWidgetItem* zItem = createItem( coordItem ); - zItem->setText( 0, "Z" ); - zItem->setText( 1, QString::number( node->Z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); - // node connectivity - QTreeWidgetItem* nconItem = createItem( nodeItem ); - nconItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) ); - Connectivity connectivity = nodeConnectivity( node ); - if ( !connectivity.isEmpty() ) { - QString con = formatConnectivity( connectivity, SMDSAbs_0DElement ); - if ( !con.isEmpty() ) { - QTreeWidgetItem* i = createItem( nconItem ); - i->setText( 0, SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" ) ); - i->setText( 1, con ); - } - con = formatConnectivity( connectivity, SMDSAbs_Edge ); - if ( !con.isEmpty() ) { - QTreeWidgetItem* i = createItem( nconItem ); - i->setText( 0, SMESHGUI_ElemInfo::tr( "EDGES" ) ); - i->setText( 1, con ); - i->setData( 1, TypeRole, NodeConnectivity ); - } - con = formatConnectivity( connectivity, SMDSAbs_Ball ); - if ( !con.isEmpty() ) { - QTreeWidgetItem* i = createItem( nconItem ); - i->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" ) ); - i->setText( 1, con ); - i->setData( 1, TypeRole, NodeConnectivity ); - } - con = formatConnectivity( connectivity, SMDSAbs_Face ); - if ( !con.isEmpty() ) { - QTreeWidgetItem* i = createItem( nconItem ); - i->setText( 0, SMESHGUI_ElemInfo::tr( "FACES" ) ); - i->setText( 1, con ); - i->setData( 1, TypeRole, NodeConnectivity ); - } - con = formatConnectivity( connectivity, SMDSAbs_Volume ); - if ( !con.isEmpty() ) { - QTreeWidgetItem* i = createItem( nconItem ); - i->setText( 0, SMESHGUI_ElemInfo::tr( "VOLUMES" ) ); - i->setText( 1, con ); - i->setData( 1, TypeRole, NodeConnectivity ); + + + if( e->GetGeomType() != SMDSGeom_POLYHEDRA ) { + SMDS_ElemIteratorPtr nodeIt = e->nodesIterator(); + for ( int idx = 1; nodeIt->more(); idx++ ) { + const SMDS_MeshNode* node = static_cast( nodeIt->next() ); + nodeInfo( node, idx, e->NbNodes(), conItem ); + } + } + else { + const SMDS_VtkVolume* aVtkVolume = dynamic_cast(e); + SMDS_ElemIteratorPtr nodeIt = aVtkVolume->uniqueNodesIterator(); + QList uniqueNodes; + while ( nodeIt->more() ) + uniqueNodes.append( nodeIt->next() ); + + SMDS_VolumeTool vtool( e ); + const int nbFaces = vtool.NbFaces(); + for( int face_id = 0; face_id < nbFaces; face_id++ ) { + QTreeWidgetItem* faceItem = createItem( conItem, Bold ); + faceItem->setText( 0, QString( "%1 %2 / %3" ).arg( SMESHGUI_ElemInfo::tr( "FACE" ) ).arg( face_id + 1 ).arg( nbFaces ) ); + faceItem->setExpanded( true ); + + const SMDS_MeshNode** aNodeIds = vtool.GetFaceNodes( face_id ); + const int nbNodes = vtool.NbFaceNodes( face_id ); + for( int node_id = 0; node_id < nbNodes; node_id++ ) { + const SMDS_MeshNode* node = aNodeIds[node_id]; + nodeInfo( node, uniqueNodes.indexOf(node) + 1, aVtkVolume->NbUniqueNodes(), faceItem ); } } } @@ -2027,6 +2046,77 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) } } +/*! + \brief Show node information + \param node mesh node for showing + \param index index of current node + \param nbNodes number of unique nodes in element + \param parentItem parent item of tree +*/ +void SMESHGUI_TreeElemInfo::nodeInfo( const SMDS_MeshNode* node, int index, + int nbNodes, QTreeWidgetItem* parentItem ) +{ + int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 ); + // node number and ID + QTreeWidgetItem* nodeItem = createItem( parentItem, Bold ); + nodeItem->setText( 0, QString( "%1 %2 / %3" ).arg( SMESHGUI_ElemInfo::tr( "NODE" ) ).arg( index ).arg( nbNodes ) ); + nodeItem->setText( 1, QString( "#%1" ).arg( node->GetID() ) ); + nodeItem->setData( 1, TypeRole, ElemConnectivity ); + nodeItem->setData( 1, IdRole, node->GetID() ); + nodeItem->setExpanded( false ); + // node coordinates + QTreeWidgetItem* coordItem = createItem( nodeItem ); + coordItem->setText( 0, SMESHGUI_ElemInfo::tr( "COORDINATES" ) ); + QTreeWidgetItem* xItem = createItem( coordItem ); + xItem->setText( 0, "X" ); + xItem->setText( 1, QString::number( node->X(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); + QTreeWidgetItem* yItem = createItem( coordItem ); + yItem->setText( 0, "Y" ); + yItem->setText( 1, QString::number( node->Y(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); + QTreeWidgetItem* zItem = createItem( coordItem ); + zItem->setText( 0, "Z" ); + zItem->setText( 1, QString::number( node->Z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); + // node connectivity + QTreeWidgetItem* nconItem = createItem( nodeItem ); + nconItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) ); + Connectivity connectivity = nodeConnectivity( node ); + if ( !connectivity.isEmpty() ) { + QString con = formatConnectivity( connectivity, SMDSAbs_0DElement ); + if ( !con.isEmpty() ) { + QTreeWidgetItem* i = createItem( nconItem ); + i->setText( 0, SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" ) ); + i->setText( 1, con ); + } + con = formatConnectivity( connectivity, SMDSAbs_Edge ); + if ( !con.isEmpty() ) { + QTreeWidgetItem* i = createItem( nconItem ); + i->setText( 0, SMESHGUI_ElemInfo::tr( "EDGES" ) ); + i->setText( 1, con ); + i->setData( 1, TypeRole, NodeConnectivity ); + } + con = formatConnectivity( connectivity, SMDSAbs_Ball ); + if ( !con.isEmpty() ) { + QTreeWidgetItem* i = createItem( nconItem ); + i->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" ) ); + i->setText( 1, con ); + i->setData( 1, TypeRole, NodeConnectivity ); + } + con = formatConnectivity( connectivity, SMDSAbs_Face ); + if ( !con.isEmpty() ) { + QTreeWidgetItem* i = createItem( nconItem ); + i->setText( 0, SMESHGUI_ElemInfo::tr( "FACES" ) ); + i->setText( 1, con ); + i->setData( 1, TypeRole, NodeConnectivity ); + } + con = formatConnectivity( connectivity, SMDSAbs_Volume ); + if ( !con.isEmpty() ) { + QTreeWidgetItem* i = createItem( nconItem ); + i->setText( 0, SMESHGUI_ElemInfo::tr( "VOLUMES" ) ); + i->setText( 1, con ); + i->setData( 1, TypeRole, NodeConnectivity ); + } + } +} /*! \brief Internal clean-up (reset widget) */ diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.h b/src/SMESHGUI/SMESHGUI_MeshInfo.h index bc8c40683..54ee1aca5 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.h +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -108,7 +108,8 @@ class SMESHGUI_EXPORT SMESHGUI_MeshInfo : public QFrame iSingle = 1, iTotal = iSingle, iLinear, - iQuadratic + iQuadratic, + iBiQuadratic }; typedef QList wlist; @@ -225,6 +226,7 @@ public: protected: void contextMenuEvent( QContextMenuEvent* e ); void information( const QList& ); + void nodeInfo( const SMDS_MeshNode*, int, int, QTreeWidgetItem* ); void clearInternal(); private slots: diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx b/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx index 30db6e8ce..59900714e 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -63,15 +63,15 @@ SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent my0DElem(0), myBall(0), myNbEdge(0), myNbLinEdge(0), myNbQuadEdge(0), - myNbTrai(0), myNbLinTrai(0), myNbQuadTrai(0), - myNbQuad(0), myNbLinQuad(0), myNbQuadQuad(0), - myNbFace(0), myNbLinFace(0), myNbQuadFace(0), + myNbTrai(0), myNbLinTrai(0), myNbQuadTrai(0), myNbBiQuadTrai(0), + myNbQuad(0), myNbLinQuad(0), myNbQuadQuad(0), myNbBiQuadQuad(0), + myNbFace(0), myNbLinFace(0), myNbQuadFace(0), myNbBiQuadFace(0), myNbPolyg(0), - myNbHexa(0), myNbLinHexa(0), myNbQuadHexa(0), + myNbHexa(0), myNbLinHexa(0), myNbQuadHexa(0), myNbBiQuadHexa(0), myNbTetra(0),myNbLinTetra(0),myNbQuadTetra(0), myNbPyra(0), myNbLinPyra(0), myNbQuadPyra(0), myNbPrism(0),myNbLinPrism(0), myNbQuadPrism(0), - myNbVolum(0), myNbLinVolum(0), myNbQuadVolum(0), + myNbVolum(0), myNbLinVolum(0), myNbQuadVolum(0), myNbBiQuadVolum(0), myNbHexaPrism(0), myNbPolyh(0) { @@ -101,6 +101,10 @@ SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent lab = new QLabel(tr("SMESH_MESHINFO_ORDER2"), this ); lab->setMinimumWidth(100); lab->setFont( italic ); l->addWidget( lab, row, 3 ); + // -- + lab = new QLabel(tr("SMESH_MESHINFO_ORDER3"), this ); + lab->setMinimumWidth(100); lab->setFont( italic ); + l->addWidget( lab, row, 4 ); if ( myFull ) { @@ -163,44 +167,53 @@ SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent // -- lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this); lab->setFont( bold ); - l->addWidget( lab, row, 0 ); + l->addWidget( lab, row, 0 ); // -- - myNbFace = new QLabel( this ); - l->addWidget( myNbFace, row, 1 ); + myNbFace = new QLabel( this ); + l->addWidget( myNbFace, row, 1 ); // -- - myNbLinFace = new QLabel( this ); - l->addWidget( myNbLinFace, row, 2 ); + myNbLinFace = new QLabel( this ); + l->addWidget( myNbLinFace, row, 2 ); // -- - myNbQuadFace = new QLabel( this ); - l->addWidget( myNbQuadFace, row, 3 ); + myNbQuadFace = new QLabel( this ); + l->addWidget( myNbQuadFace, row, 3 ); + // -- + myNbBiQuadFace = new QLabel( this ); + l->addWidget( myNbBiQuadFace, row, 4 ); // -- row++; // increment row count // ... triangles lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), this ); - l->addWidget( lab, row, 0 ); + l->addWidget( lab, row, 0 ); + // -- + myNbTrai = new QLabel( this ); + l->addWidget( myNbTrai, row, 1 ); // -- - myNbTrai = new QLabel( this ); - l->addWidget( myNbTrai, row, 1 ); + myNbLinTrai = new QLabel( this ); + l->addWidget( myNbLinTrai, row, 2 ); // -- - myNbLinTrai = new QLabel( this ); - l->addWidget( myNbLinTrai, row, 2 ); + myNbQuadTrai = new QLabel( this ); + l->addWidget( myNbQuadTrai, row, 3 ); // -- - myNbQuadTrai = new QLabel( this ); - l->addWidget( myNbQuadTrai, row, 3 ); + myNbBiQuadTrai = new QLabel( this ); + l->addWidget( myNbBiQuadTrai, row, 4 ); // -- row++; // increment row count // ... quadrangles lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), this ); - l->addWidget( lab, row, 0 ); + l->addWidget( lab, row, 0 ); + // -- + myNbQuad = new QLabel( this ); + l->addWidget( myNbQuad, row, 1 ); // -- - myNbQuad = new QLabel( this ); - l->addWidget( myNbQuad, row, 1 ); + myNbLinQuad = new QLabel( this ); + l->addWidget( myNbLinQuad, row, 2 ); // -- - myNbLinQuad = new QLabel( this ); - l->addWidget( myNbLinQuad, row, 2 ); + myNbQuadQuad = new QLabel( this ); + l->addWidget( myNbQuadQuad, row, 3 ); // -- - myNbQuadQuad = new QLabel( this ); - l->addWidget( myNbQuadQuad, row, 3 ); + myNbBiQuadQuad = new QLabel( this ); + l->addWidget( myNbBiQuadQuad, row, 4 ); // -- row++; // increment row count // ... poligones @@ -216,16 +229,19 @@ SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent // -- lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this); lab->setFont( bold ); - l->addWidget( lab, row, 0 ); + l->addWidget( lab, row, 0 ); // -- - myNbVolum = new QLabel( this ); - l->addWidget( myNbVolum, row, 1 ); + myNbVolum = new QLabel( this ); + l->addWidget( myNbVolum, row, 1 ); // -- - myNbLinVolum = new QLabel( this ); - l->addWidget( myNbLinVolum, row, 2 ); + myNbLinVolum = new QLabel( this ); + l->addWidget( myNbLinVolum, row, 2 ); // -- - myNbQuadVolum = new QLabel( this ); - l->addWidget( myNbQuadVolum, row, 3 ); + myNbQuadVolum = new QLabel( this ); + l->addWidget( myNbQuadVolum, row, 3 ); + // -- + myNbBiQuadVolum = new QLabel( this ); + l->addWidget( myNbBiQuadVolum, row, 4 ); // -- row++; // increment row count // ... tetras @@ -244,16 +260,19 @@ SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent row++; // increment row count // ... hexas lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), this ); - l->addWidget( lab, row, 0 ); + l->addWidget( lab, row, 0 ); + // -- + myNbHexa = new QLabel( this ); + l->addWidget( myNbHexa, row, 1 ); // -- - myNbHexa = new QLabel( this ); - l->addWidget( myNbHexa, row, 1 ); + myNbLinHexa = new QLabel( this ); + l->addWidget( myNbLinHexa, row, 2 ); // -- - myNbLinHexa = new QLabel( this ); - l->addWidget( myNbLinHexa, row, 2 ); + myNbQuadHexa = new QLabel( this ); + l->addWidget( myNbQuadHexa, row, 3 ); // -- - myNbQuadHexa = new QLabel( this ); - l->addWidget( myNbQuadHexa, row, 3 ); + myNbBiQuadHexa = new QLabel( this ); + l->addWidget( myNbBiQuadHexa, row, 4 ); // -- row++; // increment row count // ... pyras @@ -349,31 +368,37 @@ SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent row = l->rowCount(); // retrieve current row count // -- lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this); - l->addWidget( lab, row, 0 ); + l->addWidget( lab, row, 0 ); + // -- + myNbFace = new QLabel( this ); + l->addWidget( myNbFace, row, 1 ); // -- - myNbFace = new QLabel( this ); - l->addWidget( myNbFace, row, 1 ); + myNbLinFace = new QLabel( this ); + l->addWidget( myNbLinFace, row, 2 ); // -- - myNbLinFace = new QLabel( this ); - l->addWidget( myNbLinFace, row, 2 ); + myNbQuadFace = new QLabel( this ); + l->addWidget( myNbQuadFace, row, 3 ); // -- - myNbQuadFace = new QLabel( this ); - l->addWidget( myNbQuadFace, row, 3 ); + myNbBiQuadFace = new QLabel( this ); + l->addWidget( myNbBiQuadFace, row, 4 ); // volumes row = l->rowCount(); // retrieve current row count // -- lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this); - l->addWidget( lab, row, 0 ); + l->addWidget( lab, row, 0 ); // -- - myNbVolum = new QLabel( this ); - l->addWidget( myNbVolum, row, 1 ); + myNbVolum = new QLabel( this ); + l->addWidget( myNbVolum, row, 1 ); // -- - myNbLinVolum = new QLabel( this ); - l->addWidget( myNbLinVolum, row, 2 ); + myNbLinVolum = new QLabel( this ); + l->addWidget( myNbLinVolum, row, 2 ); // -- - myNbQuadVolum = new QLabel( this ); - l->addWidget( myNbQuadVolum, row, 3 ); + myNbQuadVolum = new QLabel( this ); + l->addWidget( myNbQuadVolum, row, 3 ); + // -- + myNbBiQuadVolum = new QLabel( this ); + l->addWidget( myNbBiQuadVolum, row, 4 ); } } @@ -386,89 +411,90 @@ SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent void SMESHGUI_MeshInfosBox::SetMeshInfo(const SMESH::long_array& theInfo) { // nodes - myNbNode ->setText( QString("%1").arg( theInfo[SMDSEntity_Node] )); + myNbNode ->setText( QString("%1").arg( theInfo[SMDSEntity_Node] )); //0D elements - my0DElem ->setText( QString("%1").arg( theInfo[SMDSEntity_0D] )); + my0DElem ->setText( QString("%1").arg( theInfo[SMDSEntity_0D] )); //balls - myBall ->setText( QString("%1").arg( theInfo[SMDSEntity_Ball] )); + myBall ->setText( QString("%1").arg( theInfo[SMDSEntity_Ball] )); // edges - myNbEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Edge] + - theInfo[SMDSEntity_Quad_Edge] )); - myNbLinEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Edge] )); - myNbQuadEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Edge] )); + myNbEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Edge] + + theInfo[SMDSEntity_Quad_Edge] )); + myNbLinEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Edge] )); + myNbQuadEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Edge] )); // faces - myNbFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] + - theInfo[SMDSEntity_Quad_Triangle] + - theInfo[SMDSEntity_BiQuad_Triangle] + - theInfo[SMDSEntity_Quadrangle] + - theInfo[SMDSEntity_Quad_Quadrangle] + - theInfo[SMDSEntity_BiQuad_Quadrangle] + - theInfo[SMDSEntity_Polygon] )); - myNbLinFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] + - theInfo[SMDSEntity_Quadrangle] + - theInfo[SMDSEntity_Polygon] )); - myNbQuadFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] + - theInfo[SMDSEntity_Quad_Quadrangle] + - theInfo[SMDSEntity_BiQuad_Quadrangle] )); + myNbFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] + + theInfo[SMDSEntity_Quad_Triangle] + + theInfo[SMDSEntity_BiQuad_Triangle] + + theInfo[SMDSEntity_Quadrangle] + + theInfo[SMDSEntity_Quad_Quadrangle] + + theInfo[SMDSEntity_BiQuad_Quadrangle] + + theInfo[SMDSEntity_Polygon] )); + myNbLinFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] + + theInfo[SMDSEntity_Quadrangle] + + theInfo[SMDSEntity_Polygon] )); + myNbQuadFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] + + theInfo[SMDSEntity_Quad_Quadrangle] )); + myNbBiQuadFace ->setText( QString("%1").arg( theInfo[SMDSEntity_BiQuad_Triangle] + + theInfo[SMDSEntity_BiQuad_Quadrangle] )); // volumes - myNbVolum ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] + - theInfo[SMDSEntity_Quad_Tetra] + - theInfo[SMDSEntity_Pyramid] + - theInfo[SMDSEntity_Quad_Pyramid] + - theInfo[SMDSEntity_Hexa] + - theInfo[SMDSEntity_Quad_Hexa] + - theInfo[SMDSEntity_TriQuad_Hexa] + - theInfo[SMDSEntity_Penta] + - theInfo[SMDSEntity_Quad_Penta] + - theInfo[SMDSEntity_Hexagonal_Prism] + - theInfo[SMDSEntity_Polyhedra] )); - myNbLinVolum ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] + - theInfo[SMDSEntity_Pyramid] + - theInfo[SMDSEntity_Hexa] + - theInfo[SMDSEntity_Penta] + - theInfo[SMDSEntity_Polyhedra] )); - myNbQuadVolum->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Tetra] + - theInfo[SMDSEntity_Quad_Pyramid] + - theInfo[SMDSEntity_Quad_Hexa] + - theInfo[SMDSEntity_TriQuad_Hexa] + - theInfo[SMDSEntity_Quad_Penta] )); + myNbVolum ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] + + theInfo[SMDSEntity_Quad_Tetra] + + theInfo[SMDSEntity_Pyramid] + + theInfo[SMDSEntity_Quad_Pyramid] + + theInfo[SMDSEntity_Hexa] + + theInfo[SMDSEntity_Quad_Hexa] + + theInfo[SMDSEntity_TriQuad_Hexa] + + theInfo[SMDSEntity_Penta] + + theInfo[SMDSEntity_Quad_Penta] + + theInfo[SMDSEntity_Hexagonal_Prism] + + theInfo[SMDSEntity_Polyhedra] )); + myNbLinVolum ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] + + theInfo[SMDSEntity_Pyramid] + + theInfo[SMDSEntity_Hexa] + + theInfo[SMDSEntity_Penta] + + theInfo[SMDSEntity_Polyhedra] )); + myNbQuadVolum ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Tetra] + + theInfo[SMDSEntity_Quad_Pyramid] + + theInfo[SMDSEntity_Quad_Hexa] + + theInfo[SMDSEntity_Quad_Penta] )); + myNbBiQuadVolum->setText( QString("%1").arg( theInfo[SMDSEntity_TriQuad_Hexa] )); if ( myFull ) { // triangles - myNbTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] + - theInfo[SMDSEntity_Quad_Triangle] + - theInfo[SMDSEntity_BiQuad_Triangle] )); - myNbLinTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] )); - myNbQuadTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] + - theInfo[SMDSEntity_BiQuad_Triangle] )); + myNbTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] + + theInfo[SMDSEntity_Quad_Triangle] + + theInfo[SMDSEntity_BiQuad_Triangle] )); + myNbLinTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] )); + myNbQuadTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] )); + myNbBiQuadTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_BiQuad_Triangle] )); // quadrangles - myNbQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quadrangle] + - theInfo[SMDSEntity_Quad_Quadrangle] + - theInfo[SMDSEntity_BiQuad_Quadrangle] )); - myNbLinQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quadrangle] )); - myNbQuadQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Quadrangle] + - theInfo[SMDSEntity_BiQuad_Quadrangle])); + myNbQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quadrangle] + + theInfo[SMDSEntity_Quad_Quadrangle] + + theInfo[SMDSEntity_BiQuad_Quadrangle] )); + myNbLinQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quadrangle] )); + myNbQuadQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Quadrangle] )); + myNbBiQuadQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_BiQuad_Quadrangle])); // poligones - myNbPolyg ->setText( QString("%1").arg( theInfo[SMDSEntity_Polygon] )); + myNbPolyg ->setText( QString("%1").arg( theInfo[SMDSEntity_Polygon] )); // tetras - myNbTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] + - theInfo[SMDSEntity_Quad_Tetra] )); - myNbLinTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] )); - myNbQuadTetra->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Tetra] )); + myNbTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] + + theInfo[SMDSEntity_Quad_Tetra] )); + myNbLinTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] )); + myNbQuadTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Tetra] )); // hexas - myNbHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Hexa] + - theInfo[SMDSEntity_TriQuad_Hexa], - theInfo[SMDSEntity_Quad_Hexa] )); - myNbLinHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Hexa] )); - myNbQuadHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Hexa] + - theInfo[SMDSEntity_TriQuad_Hexa] )); + myNbHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Hexa] + + theInfo[SMDSEntity_TriQuad_Hexa] + + theInfo[SMDSEntity_Quad_Hexa] )); + myNbLinHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Hexa] )); + myNbQuadHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Hexa] )); + myNbBiQuadHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_TriQuad_Hexa] )); // pyras myNbPyra ->setText( QString("%1").arg( theInfo[SMDSEntity_Pyramid] + theInfo[SMDSEntity_Quad_Pyramid] )); diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosBox.h b/src/SMESHGUI/SMESHGUI_MeshInfosBox.h index 46758eb0f..92e752976 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfosBox.h +++ b/src/SMESHGUI/SMESHGUI_MeshInfosBox.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -59,16 +59,20 @@ private: QLabel* myNbTrai; QLabel* myNbLinTrai; QLabel* myNbQuadTrai; + QLabel* myNbBiQuadTrai; QLabel* myNbQuad; QLabel* myNbLinQuad; QLabel* myNbQuadQuad; + QLabel* myNbBiQuadQuad; QLabel* myNbFace; QLabel* myNbLinFace; QLabel* myNbQuadFace; + QLabel* myNbBiQuadFace; QLabel* myNbPolyg; QLabel* myNbHexa; QLabel* myNbLinHexa; QLabel* myNbQuadHexa; + QLabel* myNbBiQuadHexa; QLabel* myNbTetra; QLabel* myNbLinTetra; QLabel* myNbQuadTetra; @@ -81,6 +85,7 @@ private: QLabel* myNbVolum; QLabel* myNbLinVolum; QLabel* myNbQuadVolum; + QLabel* myNbBiQuadVolum; QLabel* myNbHexaPrism; QLabel* myNbPolyh; }; diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 62a5c4b74..c2ec7fcec 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -41,6 +41,7 @@ #include #include #include +#include // SALOME GUI includes #include @@ -63,6 +64,7 @@ // Qt includes #include #include +#include // OCCT includes #include @@ -95,6 +97,7 @@ SMESHGUI_MeshOp::SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh ) if ( GeometryGUI::GetGeomGen()->_is_nil() )// check that GEOM_Gen exists GeometryGUI::InitGeomGen(); myIsOnGeometry = true; + myMaxShapeDim = -1; } //================================================================================ @@ -211,14 +214,16 @@ void SMESHGUI_MeshOp::startOperation() } connect( myDlg, SIGNAL( hypoSet( const QString& )), SLOT( onHypoSet( const QString& ))); connect( myDlg, SIGNAL( geomSelectionByMesh( bool )), SLOT( onGeomSelectionByMesh( bool ))); - - if ( myToCreate ) + connect( myDlg, SIGNAL( selectMeshType( const int, const int ) ), SLOT( onAlgoSetByMeshType( const int, const int))); + if ( myToCreate ) { if ( myIsMesh ) myHelpFileName = "constructing_meshes_page.html"; - else myHelpFileName = "constructing_submeshes_page.html"; - else myHelpFileName = "editing_meshes_page.html"; + else myHelpFileName = "constructing_submeshes_page.html"; + } + else { + myHelpFileName = "editing_meshes_page.html"; + } } SMESHGUI_SelectionOp::startOperation(); - // iterate through dimensions and get available algoritms, set them to the dialog _PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" ); for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ ) @@ -245,11 +250,17 @@ void SMESHGUI_MeshOp::startOperation() myDlg->activateObject( SMESHGUI_MeshDlg::Obj ); myDlg->setCurrentTab( SMESH::DIM_3D ); + + QStringList TypeMeshList; + createMeshTypeList( TypeMeshList ); + setAvailableMeshType( TypeMeshList ); + myDlg->show(); myDlg->setGeomPopupEnabled(false); selectionDone(); myIgnoreAlgoSelection = false; + myHasConcurrentSubBefore = false; myObjectToSelect.clear(); } @@ -582,21 +593,23 @@ void SMESHGUI_MeshOp::selectionDone() onAlgoSelected(-1, i); } myDlg->setMaxHypoDim( shapeDim ); + myMaxShapeDim = shapeDim; myDlg->setHypoSets( SMESH::GetHypothesesSets( shapeDim )); if (!myToCreate) // edition: read hypotheses { if (pObj != 0) { - SMESH::SMESH_subMesh_var aVar = + SMESH::SMESH_subMesh_var submeshVar = SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() ); - myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, !aVar->_is_nil() ); + myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, !submeshVar->_is_nil() ); myDlg->setObjectShown( SMESHGUI_MeshDlg::Geom, true ); myDlg->objectWg( SMESHGUI_MeshDlg::Mesh, SMESHGUI_MeshDlg::Btn )->hide(); myDlg->objectWg( SMESHGUI_MeshDlg::Geom, SMESHGUI_MeshDlg::Btn )->hide(); myDlg->updateGeometry(); myDlg->adjustSize(); readMesh(); + myIsMesh = submeshVar->_is_nil(); } else myDlg->reset(); @@ -669,12 +682,20 @@ void SMESHGUI_MeshOp::selectionDone() for (int i = SMESH::DIM_0D;i < SMESH::DIM_3D; ++i) { myDlg->disableTab(i); } - //Hide labels and fields (Mesh ang Geometry) + myMaxShapeDim = -1; + //Hide labels and fields (Mesh and Geometry) myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, false ); myDlg->setObjectShown( SMESHGUI_MeshDlg::Geom, false ); myDlg->adjustSize(); readMesh(); } + int curIndex = myDlg->currentMeshType( ); + QStringList TypeMeshList; + createMeshTypeList( TypeMeshList ); + setAvailableMeshType( TypeMeshList ); + curIndex =( curIndex >= TypeMeshList.count() ) ? 0 : curIndex; + myDlg->setCurrentMeshType( curIndex ); + setFilteredAlgoData( myMaxShapeDim, curIndex); } catch ( const SALOME::SALOME_Exception& S_ex ) { @@ -730,9 +751,13 @@ bool SMESHGUI_MeshOp::isValid( QString& theMess ) const if ( myToCreate ) { QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); - if ( aGeomEntry == "" ) + if ( aGeomEntry.isEmpty() ) { - theMess = tr( "GEOMETRY_OBJECT_IS_NOT_DEFINED" ); + theMess = tr( myIsMesh ? + "GEOMETRY_OBJECT_IS_NOT_DEFINED_MESH" : + "GEOMETRY_OBJECT_IS_NOT_DEFINED_SUBMESH"); + if ( !myIsMesh ) + return false; dlg()->show(); if ( SUIT_MessageBox::warning( myDlg, tr( "SMESH_WRN_WARNING" ), theMess, SUIT_MessageBox::Yes, SUIT_MessageBox::No ) == SUIT_MessageBox::No ) @@ -821,7 +846,7 @@ void SMESHGUI_MeshOp::availableHyps( const int theDim, theHyps.clear(); bool isAlgo = ( theHypType == Algo ); bool isAux = ( theHypType == AddHyp ); - QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( isAlgo, theDim, isAux, myIsOnGeometry ); + QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( isAlgo, theDim, isAux, myIsOnGeometry, !myIsMesh ); QStringList::const_iterator anIter; for ( anIter = aHypTypeNameList.begin(); anIter != aHypTypeNameList.end(); ++anIter ) @@ -837,23 +862,23 @@ void SMESHGUI_MeshOp::availableHyps( const int theDim, //================================================================================ /*! * \brief Gets existing hypotheses or algorithms - * \param theDim - specifies dimension of returned hypotheses/algorifms - * \param theHypType - specifies whether algorims or hypotheses or additional ones - * are retrieved (possible values are in HypType enumeration) - * \param theFather - start object for finding ( may be component, mesh, or sub-mesh ) - * \param theHyps - output list of names. - * \param theHypVars - output list of variables. - * \param theAlgoData - to select hypos able to be used by this algo (optional) + * \param theDim - specifies dimension of returned hypotheses/algorifms + * \param theHypType - specifies whether algorims or hypotheses or additional ones + * are retrieved (possible values are in HypType enumeration) + * \param theFather - start object for finding ( may be component, mesh, or sub-mesh ) + * \param theHyps - output list of names. + * \param theHypVars - output list of variables. + * \param theAlgoData - to select hypos able to be used by this algo (optional) * * Gets existing (i.e. already created) hypotheses or algorithm in accordance with * input parameters */ //================================================================================ -void SMESHGUI_MeshOp::existingHyps( const int theDim, - const int theHypType, - _PTR(SObject) theFather, - QStringList& theHyps, - THypList& theHypList, +void SMESHGUI_MeshOp::existingHyps( const int theDim, + const int theHypType, + _PTR(SObject) theFather, + QStringList& theHyps, + THypList& theHypList, HypothesisData* theAlgoData) { // Clear hypoheses list @@ -906,7 +931,7 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim, if ( !aData) continue; if ( ( theDim == -1 || aData->Dim.contains( theDim ) ) && ( isCompatible ( theAlgoData, aData, theHypType )) && - ( isAux == aData->IsAux )) + ( theHypType == Algo || isAux == aData->IsAuxOrNeedHyp )) { std::string aHypName = aName->Value(); theHyps.append( aHypName.c_str() ); @@ -1371,20 +1396,47 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, const bool isSubmesh = ( myToCreate ? !myIsMesh : myDlg->isObjectShown( SMESHGUI_MeshDlg::Mesh )); + // if ( aDim >= SMESH::DIM_2D ) myAvailableHypData[ aDim ][ Algo ] = myFilteredAlgoData[aDim]; HypothesisData* algoData = hypData( aDim, Algo, theIndex ); HypothesisData* algoByDim[4]; algoByDim[ aDim ] = algoData; QStringList anAvailable; - if ( !algoData ) { // all algos becomes available - availableHyps( aDim, Algo, anAvailable, myAvailableHypData[ aDim ][ Algo ]); - myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailable ); + + // check that tab enabled of one less dimension + if ( aDim > SMESH::DIM_0D ) + { + if ( isAccessibleDim( aDim - 1 ) ) + { + if (( myDlg->currentMeshType() != MT_ANY ) && + ( !algoData || ( myIsOnGeometry && algoData->InputTypes.isEmpty() ))) + for (int i = aDim - 1; i >= SMESH::DIM_0D; i--) + if ( isAccessibleDim( i ) ) { + myDlg->disableTab( i ); + setCurrentHyp(i, Algo, -1); + } + } + else if ( algoData && myIsOnGeometry && !algoData->InputTypes.isEmpty() ) + { + myDlg->enableTab( aDim - 1 ); + } } // check that algorithms of other dimentions are compatible with // the selected one - - // 2 loops: backward and forward from algo dimension + if ( !algoData ) { // all algos becomes available + if (myDlg->currentMeshType() == MT_ANY || aDim == SMESH::DIM_1D || aDim == SMESH::DIM_0D) + availableHyps( aDim, Algo, anAvailable, myAvailableHypData[ aDim ][ Algo ]); + else{ + anAvailable.clear(); + for (int i = 0; i < myFilteredAlgoData[aDim].count(); ++i) { + HypothesisData* aCurAlgo = myFilteredAlgoData[aDim][ i ]; + anAvailable.append( aCurAlgo->Label ); + } + } + myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailable ); + } + // 2 loops: backward and forward from algo dimension for ( int forward = false; forward <= true; ++forward ) { int dim = aDim + 1, lastDim = SMESH::DIM_3D, dir = 1; @@ -1412,12 +1464,26 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, curAlgo = 0; } // set new available algoritms - availableHyps( dim, Algo, anAvailable, myAvailableHypData[dim][Algo], prevAlgo ); + if (myDlg->currentMeshType() == MT_ANY || dim == SMESH::DIM_1D || dim == SMESH::DIM_0D) + availableHyps( dim, Algo, anAvailable, myAvailableHypData[dim][Algo], prevAlgo ); + else{ + anAvailable.clear(); + myAvailableHypData[dim][Algo].clear(); + for (int i = 0; i < myFilteredAlgoData[dim].count(); ++i) { + HypothesisData* aCurAlgo = myFilteredAlgoData[dim][ i ]; + if ( isCompatible ( prevAlgo, aCurAlgo, Algo )) { + anAvailable.append( aCurAlgo->Label ); + myAvailableHypData[dim][Algo].append( aCurAlgo ); + } + } + } HypothesisData* soleCompatible = 0; if ( anAvailable.count() == 1 ) soleCompatible = myAvailableHypData[dim][Algo][0]; - if ( dim == aTopDim && prevAlgo ) // all available algoritms should be selectable any way - availableHyps( dim, Algo, anAvailable, myAvailableHypData[dim][Algo], 0 ); + if ( dim == aTopDim && prevAlgo ) {// all available algoritms should be selectable any way + if (myDlg->currentMeshType() == MT_ANY) + availableHyps( dim, Algo, anAvailable, myAvailableHypData[dim][Algo], 0 ); + } myDlg->tab( dim )->setAvailableHyps( Algo, anAvailable ); noCompatible = anAvailable.isEmpty(); @@ -1426,7 +1492,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, if ( !isSubmesh && algoIndex < 0 && soleCompatible && !forward && dim != SMESH::DIM_0D) // select the sole compatible algo algoIndex = myAvailableHypData[dim][Algo].indexOf( soleCompatible ); - setCurrentHyp( dim, Algo, algoIndex ); + setCurrentHyp( dim, Algo, algoIndex); // remember current algo prevAlgo = algoByDim[ dim ] = hypData( dim, Algo, algoIndex ); @@ -1458,8 +1524,8 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, bool algoDeselectedByUser = ( theDim < 0 && aDim == dim ); CORBA::String_var curHypType = curHyp->GetName(); if ( !algoDeselectedByUser && - myObjHyps[ dim ][ type ].count() > 0 && - !strcmp( curHypType, myObjHyps[ dim ][ type ].first().first->GetName()) ) + myObjHyps[ dim ][ type ].count() > 0 && + !strcmp( curHypType, myObjHyps[ dim ][ type ].first().first->GetName()) ) { HypothesisData* hypData = SMESH::GetHypothesisData( curHyp->GetName() ); for (int i = 0; i < myAvailableHypData[ dim ][ Algo ].count(); ++i) { @@ -1472,6 +1538,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, } } // get hyps compatible with curAlgo + bool defaulHypAvlbl = false; if ( curAlgo ) { // check if a selected hyp is compatible with the curAlgo @@ -1482,10 +1549,11 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, } existingHyps( dim, type, pObj, anExisting, myExistingHyps[ dim ][ type ], curAlgo); availableHyps( dim, type, anAvailable, myAvailableHypData[ dim ][ type ], curAlgo); + defaulHypAvlbl = (type == MainHyp && !curAlgo->IsAuxOrNeedHyp ); } // set list of hypotheses myDlg->tab( dim )->setAvailableHyps( type, anAvailable ); - myDlg->tab( dim )->setExistingHyps( type, anExisting ); + myDlg->tab( dim )->setExistingHyps( type, anExisting, defaulHypAvlbl ); // set current existing hypothesis if ( !curHyp->_is_nil() && !anExisting.isEmpty() ) @@ -1497,8 +1565,8 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, CORBA::String_var hypTypeName = myExistingHyps[ dim ][ type ].first().first->GetName(); bool isOptional = true; if ( algoByDim[ dim ] && - SMESH::IsAvailableHypothesis( algoByDim[ dim ], hypTypeName.in(), isOptional ) && - !isOptional ) + SMESH::IsAvailableHypothesis( algoByDim[ dim ], hypTypeName.in(), isOptional ) && + !isOptional ) hypIndex = 0; } setCurrentHyp( dim, type, hypIndex ); @@ -1603,9 +1671,6 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList ) { theMess = ""; - //QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); - //QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); - QStringList aList; myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aList ); if ( aList.isEmpty() ) @@ -1625,8 +1690,20 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList ) } return true; } + QString namePrefix; + if ( aList.count() > 1 ) + { + namePrefix = myDlg->objectText( SMESHGUI_MeshDlg::Obj ); + int i = namePrefix.length() - 1; + while ( i > 0 && namePrefix[i].isDigit() ) + --i; + if ( i < namePrefix.length() - 1 ) + namePrefix.chop( namePrefix.length() - 1 - i ); + else + namePrefix += "_"; + } QStringList::Iterator it = aList.begin(); - for ( ; it!=aList.end(); it++) + for ( int i = 0; it!=aList.end(); it++, ++i ) { QString aGeomEntry = *it; _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() ); @@ -1645,8 +1722,9 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList ) return false; _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar.in() ); if ( aMeshSO ) { - SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ) ); theEntryList.append( aMeshSO->GetID().c_str() ); + if ( i > 0 ) setDefaultName( namePrefix ); + SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ) ); } for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ ) { @@ -1804,6 +1882,8 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList selectObject( _PTR(SObject)() ); selectionDone(); + checkSubMeshConcurrency( aMeshVar, aSubMeshVar, /*askUser=*/true ); + return true; } @@ -1860,13 +1940,17 @@ void SMESHGUI_MeshOp::setCurrentHyp( const int theDim, * Generates and sets default mesh/submesh name(Mesh_1, Mesh_2, etc.) */ //================================================================================ -void SMESHGUI_MeshOp::setDefaultName() const +void SMESHGUI_MeshOp::setDefaultName( const QString& thePrefix ) const { QString aResName; _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); int i = 1; - QString aPrefix = tr( myIsMesh ? "SMESH_OBJECT_MESH" : "SMESH_SUBMESH" ) + "_"; + + QString aPrefix = thePrefix; + if ( aPrefix.isEmpty() ) + aPrefix = tr( myIsMesh ? "SMESH_OBJECT_MESH" : "SMESH_SUBMESH" ) + "_"; + _PTR(SObject) anObj; do { @@ -1969,7 +2053,7 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim ) //================================================================================ /*! - * \brief Reads parameters of an edited mesh and assigns them to the dialog + * \brief Reads parameters of an edited mesh/sub-mesh and assigns them to the dialog * * Called when mesh is edited only. */ @@ -1994,6 +2078,7 @@ void SMESHGUI_MeshOp::readMesh() QString aMeshName = name( aMeshSO ); myDlg->setObjectText( SMESHGUI_MeshDlg::Mesh, aMeshName ); } + myHasConcurrentSubBefore = checkSubMeshConcurrency( aMeshVar, aSubMeshVar ); } // Get name of geometry object @@ -2009,6 +2094,7 @@ void SMESHGUI_MeshOp::readMesh() // Get hypotheses and algorithms assigned to the mesh/sub-mesh QStringList anExisting; const int lastDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D; + bool algoFound = false; for ( int dim = SMESH::DIM_3D; dim >= lastDim; --dim ) { // get algorithm @@ -2025,10 +2111,12 @@ void SMESHGUI_MeshOp::readMesh() // myAvailableHypData[ dim ][ Algo ].push_back( algoData ); // aHypIndex = myAvailableHypData[ dim ][ hypType ].count() - 1; // } + algoFound = ( aHypIndex > -1 ); } setCurrentHyp( dim, Algo, aHypIndex ); // set existing and available hypothesis according to the selected algo - onAlgoSelected( aHypIndex, dim ); + if ( aHypIndex > -1 || !algoFound ) + onAlgoSelected( aHypIndex, dim ); } // get hypotheses @@ -2165,6 +2253,14 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess ) } } + SALOMEDS_SObject* aSObject = _CAST(SObject, pObj); + CORBA::Object_var anObject = aSObject->GetObject(); + SMESH::SMESH_Mesh_var aMeshVar = SMESH::SMESH_Mesh::_narrow( anObject ); + SMESH::SMESH_subMesh_var aSubMeshVar = SMESH::SMESH_subMesh::_narrow( anObject ); + bool isMesh = !aMeshVar->_is_nil(); + if ( !isMesh && !aSubMeshVar->_is_nil() ) + aMeshVar = aSubMeshVar->GetFather(); + // Assign new algorithms and hypotheses for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ ) { @@ -2177,18 +2273,11 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess ) if ( !anAlgoVar->_is_nil() && // some algo selected and myObjHyps[ dim ][ Algo ].count() == 0 ) // no algo assigned { - SALOMEDS_SObject* aSObject = _CAST(SObject, pObj); - CORBA::Object_var anObject = aSObject->GetObject(); - SMESH::SMESH_Mesh_var aMeshVar = SMESH::SMESH_Mesh::_narrow( anObject ); - bool isMesh = !aMeshVar->_is_nil(); - if ( isMesh ) { + if ( isMesh ) SMESH::AddHypothesisOnMesh( aMeshVar, anAlgoVar ); - } else { - SMESH::SMESH_subMesh_var aVar = - SMESH::SMESH_subMesh::_narrow( _CAST(SObject,pObj)->GetObject() ); - if ( !aVar->_is_nil() ) - SMESH::AddHypothesisOnSubMesh( aVar, anAlgoVar ); - } + else if ( !aSubMeshVar->_is_nil() ) + SMESH::AddHypothesisOnSubMesh( aSubMeshVar, anAlgoVar ); + myObjHyps[ dim ][ Algo ].append( THypItem( anAlgoVar, aName) ); } @@ -2213,24 +2302,14 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess ) } // assign new hypotheses - if ( aNewHypIndex != anOldHypIndex && aNewHypIndex != -1 ) + if ( aNewHypIndex != anOldHypIndex && aNewHypIndex > -1 ) { - SMESH::SMESH_Mesh_var aMeshVar = - SMESH::SMESH_Mesh::_narrow( _CAST(SObject,pObj)->GetObject() ); - bool isMesh = !aMeshVar->_is_nil(); if ( isMesh ) - { SMESH::AddHypothesisOnMesh (aMeshVar, myExistingHyps[ dim ][ hypType ][ aNewHypIndex ].first ); - } - else - { - SMESH::SMESH_subMesh_var aVar = - SMESH::SMESH_subMesh::_narrow( _CAST(SObject,pObj)->GetObject() ); - if ( !aVar->_is_nil() ) - SMESH::AddHypothesisOnSubMesh - ( aVar, myExistingHyps[ dim ][ hypType ][ aNewHypIndex ].first ); - } + else if ( !aSubMeshVar->_is_nil() ) + SMESH::AddHypothesisOnSubMesh + ( aSubMeshVar, myExistingHyps[ dim ][ hypType ][ aNewHypIndex ].first ); } // reread all hypotheses of mesh if necessary QStringList anExisting; @@ -2238,9 +2317,61 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess ) } } + myHasConcurrentSubBefore = + checkSubMeshConcurrency( aMeshVar, aSubMeshVar, /*askUser=*/!myHasConcurrentSubBefore ); + return true; } +//================================================================================ +/*! + * \brief Checks if a concurrent sub-meshes appear as result of sub-mesh + * creation/edition and, if (askUser) , proposes the uses to set up a desired + * order of sub-mesh computation. + * Returns \c true if a sub-mesh concurrency detected. + */ +//================================================================================ + +bool SMESHGUI_MeshOp::checkSubMeshConcurrency(SMESH::SMESH_Mesh_ptr mesh, + SMESH::SMESH_subMesh_ptr submesh, + bool askUser) +{ + if ( CORBA::is_nil( mesh ) || CORBA::is_nil( submesh )) + return false; + + bool isNewConcurrent = mesh->IsUnorderedSubMesh( submesh->GetId() ); + if ( isNewConcurrent && askUser ) + { + int butID = SUIT_MessageBox::warning( myDlg->parentWidget(), tr( "SMESH_WARNING" ), + tr("CONCURRENT_SUBMESH_APPEARS"), + tr("SMESH_BUT_YES"), tr("SMESH_BUT_NO")); + if ( butID == 0 ) + { + _PTR(SObject) meshSO = SMESH::FindSObject( mesh ); + LightApp_SelectionMgr* aSelectionMgr = selectionMgr(); + if ( meshSO && aSelectionMgr ) + { + myDlg->setEnabled( false ); // disactivate selection + selectionMgr()->clearFilters(); + selectObject( meshSO ); + SMESHGUI::GetSMESHGUI()->OnGUIEvent( 713 ); // MESH_ORDER + qApp->processEvents(); + + myDlg->setEnabled( true ); + int obj = myDlg->getActiveObject(); + onActivateObject( obj ); // restore filter + if ( !myToCreate ) + { + selectObject( SMESH::FindSObject( submesh )); + selectionDone(); + } + } + } + } + + return isNewConcurrent; +} + //================================================================================ /*! * \brief Verifies whether given operator is valid for this one @@ -2343,3 +2474,280 @@ void SMESHGUI_MeshOp::selectObject( _PTR(SObject) theSObj ) const sm->setSelectedObjects( anIOList, false ); } } +//================================================================================ +/*! + * \brief Create available list types of mesh + * \param theTypeMesh - Output list of available types of mesh + */ +//================================================================================ +void SMESHGUI_MeshOp::createMeshTypeList( QStringList& theTypeMesh) +{ + theTypeMesh.clear(); + theTypeMesh.append( tr( "MT_ANY" ) ); + if ( myMaxShapeDim >= 2 || myMaxShapeDim == -1 ) + { + theTypeMesh.append( tr( "MT_TRIANGULAR" ) ); + theTypeMesh.append( tr( "MT_QUADRILATERAL" ) ); + } + if ( myMaxShapeDim == 3 || myMaxShapeDim == -1 ) + { + theTypeMesh.append( tr( "MT_TETRAHEDRAL" ) ); + theTypeMesh.append( tr( "MT_HEXAHEDRAL" ) ); + } + +} +//================================================================================ +/*! + * \brief Set available types of mesh + * \param theTypeMesh - List of available types of mesh + */ +//================================================================================ +void SMESHGUI_MeshOp::setAvailableMeshType( const QStringList& theTypeMesh ) +{ + myDlg->setAvailableMeshType( theTypeMesh ); +} + +//================================================================================ +/*! + * \brief SLOT. Is called when the user select type of mesh + * \param theTabIndex - Index of current active tab + * \param theIndex - Index of current type of mesh + */ +//================================================================================ +void SMESHGUI_MeshOp::onAlgoSetByMeshType( const int theTabIndex, const int theIndex) +{ + setFilteredAlgoData( theTabIndex, theIndex); +} + +//================================================================================ +/*! + * \brief Set a filtered list of available algorithms by mesh type + * \param theTabIndex - Index of current active tab + * \param theIndex - Index of current type of mesh + */ +//================================================================================ +void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theIndex) +{ + int aDim; + THypDataList anAvailableAlgsData; + QStringList anAvailableAlgs; + QString anCompareType = ""; + bool isAvailableChoiceAlgo = false; + int anCurrentAvailableAlgo = 0; + bool isNone = true; + switch ( theIndex ) { + case MT_ANY: + anCompareType = "ANY"; + aDim = SMESH::DIM_3D; + break; + case MT_TRIANGULAR: + aDim = SMESH::DIM_2D; + anCompareType = "TRIA"; + break; + case MT_QUADRILATERAL: + aDim = SMESH::DIM_2D; + anCompareType = "QUAD"; + break; + case MT_TETRAHEDRAL: + aDim = SMESH::DIM_3D; + anCompareType = "TETRA"; + break; + case MT_HEXAHEDRAL: + aDim = SMESH::DIM_3D; + anCompareType = "HEXA"; + break; + default:; + } + + bool toCheckIsApplicableToAll = !myIsMesh; + GEOM::GEOM_Object_var aGeomVar; + QString anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); + if ( _PTR(SObject) so = studyDS()->FindObjectID( anEntry.toLatin1().data() )) + { + CORBA::Object_var obj = _CAST( SObject,so )->GetObject(); + aGeomVar = GEOM::GEOM_Object::_narrow( obj ); + if ( !aGeomVar->_is_nil() && toCheckIsApplicableToAll ) + toCheckIsApplicableToAll = ( aGeomVar->GetType() == GEOM_GROUP ); + } + + if ( anCompareType == "ANY" ) + { + for ( int dim = SMESH::DIM_2D; dim <= SMESH::DIM_3D; dim++ ) + { + isNone = currentHyp( dim, Algo ) < 0; + isAvailableChoiceAlgo = false; + // retrieves a list of available algorithms from resources + availableHyps( dim, Algo, anAvailableAlgs, anAvailableAlgsData ); + //return current algo in current tab and set new algorithm list + HypothesisData* algoCur; + if ( !isNone && !myAvailableHypData[dim][Algo].empty() ) { + algoCur = myAvailableHypData[dim][Algo].at( currentHyp( dim, Algo ) ); + } + myAvailableHypData[dim][Algo].clear(); + anAvailableAlgs.clear(); + for (int i = 0 ; i < anAvailableAlgsData.count(); i++) + { + HypothesisData* curAlgo = anAvailableAlgsData.at(i); + if ( aGeomVar->_is_nil() || + SMESH::IsApplicable( curAlgo->TypeName, aGeomVar, toCheckIsApplicableToAll )) + { + anAvailableAlgs.append( curAlgo->Label ); + myAvailableHypData[dim][Algo].append( curAlgo ); + } + } + if ( !isNone && algoCur ) { + for (int i = 0 ; i < myAvailableHypData[dim][Algo].count(); i++) + { + HypothesisData* algoAny = myAvailableHypData[dim][Algo].at(i); + if ( algoAny->Label == algoCur->Label ){ + isAvailableChoiceAlgo = true; + anCurrentAvailableAlgo = i; + break; + } + } + } + else if ( !isNone ) { + isAvailableChoiceAlgo = true; + anCurrentAvailableAlgo = currentHyp( dim, Algo ); + } + myDlg->tab( dim )->setAvailableHyps( Algo, anAvailableAlgs ); + if ( isAvailableChoiceAlgo ) + setCurrentHyp( dim, Algo, anCurrentAvailableAlgo ); + } + if ( !myIsOnGeometry ) + for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ ) { + if ( i < SMESH::DIM_3D ) myDlg->disableTab( i ); + else myDlg->enableTab( i ); + } + else + for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ ) { + if ( i > myMaxShapeDim ) myDlg->disableTab( i ); + else myDlg->enableTab( i ); + } + myDlg->setCurrentTab( theTabIndex ); + } + else + { + QString anCurrentAlgo; + bool isReqDisBound = true; + QString anCurrentCompareType = anCompareType; + isNone = currentHyp( aDim, Algo ) < 0; + if ( !isNone && !myAvailableHypData[aDim][Algo].empty() && + myAvailableHypData[aDim][Algo].count() != anAvailableAlgsData.count() ) + isReqDisBound = myAvailableHypData[aDim][Algo].at( currentHyp( aDim, Algo ) )->InputTypes.isEmpty(); + else if ( !isNone ) + isReqDisBound = anAvailableAlgsData.at( currentHyp( aDim, Algo ) )->InputTypes.isEmpty(); + for ( int dim = aDim; dim >= SMESH::DIM_2D; dim-- ) + { + bool isNoneAlg = currentHyp( dim, Algo ) < 0; + isAvailableChoiceAlgo = false; + // retrieves a list of available algorithms from resources + availableHyps( dim, Algo, anAvailableAlgs, anAvailableAlgsData ); + // finding algorithm which is selected + if ( !isNoneAlg && !myAvailableHypData[dim][Algo].empty() && + myAvailableHypData[dim][Algo].count() != anAvailableAlgsData.count() ) + anCurrentAlgo = myAvailableHypData[dim][Algo].at( currentHyp( dim, Algo ) )->Label; + else if ( !isNoneAlg ) + anCurrentAlgo = anAvailableAlgsData.at( currentHyp( dim, Algo ) )->Label; + anAvailableAlgs.clear(); + myAvailableHypData[dim][Algo].clear(); + myFilteredAlgoData[dim].clear(); + // finding and adding algorithm depending on the type mesh + for ( int i = 0 ; i < anAvailableAlgsData.count(); i++ ) + { + HypothesisData* algoIn = anAvailableAlgsData.at( i ); + bool isAvailableAlgo = ( algoIn->OutputTypes.count() == 0 ); + QStringList::const_iterator inElemType = algoIn->OutputTypes.begin(); + for ( ; inElemType != algoIn->OutputTypes.end(); inElemType++ ) + { + if ( *inElemType == anCurrentCompareType ) { + isAvailableAlgo = true; + break; + } + } + if ( isAvailableAlgo || algoIn->OutputTypes.count()==0 ) { + if ( aGeomVar->_is_nil() || myMaxShapeDim != dim || + SMESH::IsApplicable( algoIn->TypeName, aGeomVar, toCheckIsApplicableToAll )) + { + anAvailableAlgs.append( algoIn->Label ); + myAvailableHypData[dim][Algo].append( algoIn ); + myFilteredAlgoData[dim].append( algoIn ); + } + } + //algorithm will be active, if the chosen algorithm available in the current mesh type + if ( !isNoneAlg && isAvailableAlgo && algoIn->Label == anCurrentAlgo ) { + isAvailableChoiceAlgo = true; + anCurrentAvailableAlgo = anAvailableAlgs.count() - 1 ; + } + } + //set new algorithm list and select the current algorithm + myDlg->tab( dim )->setAvailableHyps( Algo, anAvailableAlgs ); + anCurrentCompareType = ( anCompareType == "HEXA" ) ? "QUAD" : "TRIA"; + if ( isAvailableChoiceAlgo ) + setCurrentHyp( dim, Algo, anCurrentAvailableAlgo ); + else + setCurrentHyp( dim, Algo, -1 ); + } + + if ( isNone || isReqDisBound ) { + for ( int i = SMESH::DIM_0D; i <= myMaxShapeDim; i++ ) { + if ( aDim != i ) { + myDlg->disableTab( i ); + setCurrentHyp(i, Algo, -1); + } + } + } + else if ( !isNone ) { + if ( aDim == SMESH::DIM_2D){ + myDlg->disableTab( SMESH::DIM_3D ); + setCurrentHyp( SMESH::DIM_3D, Algo, -1); + } + for ( int i = myMaxShapeDim; i > SMESH::DIM_0D; i-- ) + { + isReqDisBound = ( currentHyp( i, Algo ) < 0 ) ? true : + myAvailableHypData[i][Algo].at( currentHyp( i, Algo ) )->InputTypes.isEmpty(); + if ( isReqDisBound ) { + for (int j = i - 1; j >= SMESH::DIM_0D; j--){ + myDlg->disableTab( j ); + setCurrentHyp( j , Algo, -1 ); + } + break; + } + } + } + myDlg->enableTab( aDim ); + myDlg->setCurrentTab( aDim ); + } + QStringList aHypothesesSetsList = SMESH::GetHypothesesSets( aDim ); + QStringList aFilteredHypothesesSetsList; + aFilteredHypothesesSetsList.clear(); + QStringList::const_iterator inHypoSetName = aHypothesesSetsList.begin(); + for ( ; inHypoSetName != aHypothesesSetsList.end(); ++inHypoSetName ) + { + HypothesesSet* currentHypoSet = SMESH::GetHypothesesSet( *inHypoSetName ); + bool isAvailable = false; + currentHypoSet->init( true ); + while ( currentHypoSet->next(), currentHypoSet->more() ) + { + isAvailable = false; + if ( HypothesisData* algoDataIn = SMESH::GetHypothesisData( currentHypoSet->current() )) + { + for (int i = SMESH::DIM_0D; i <= myMaxShapeDim; i++) + { + for (int j = 0; j < myAvailableHypData[i][Algo].count(); ++j) { + HypothesisData* aCurAlgo = hypData( i, Algo, j ); + if ( aCurAlgo->Label == algoDataIn->Label ){ + isAvailable = true; + break; + } + } + if ( isAvailable ) break; + } + if ( !isAvailable ) break; + } + } + if ( isAvailable ) + aFilteredHypothesesSetsList.append( *inHypoSetName ); + } + myDlg->setHypoSets( aFilteredHypothesesSetsList ); +} diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.h b/src/SMESHGUI/SMESHGUI_MeshOp.h index 91c39ed72..fcaedabf3 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.h +++ b/src/SMESHGUI/SMESHGUI_MeshOp.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -48,6 +48,7 @@ class SMESHGUI_EXPORT SMESHGUI_MeshOp : public SMESHGUI_SelectionOp public: enum HypType{ Algo = 0, MainHyp, AddHyp, NbHypTypes }; + enum MeshType{ MT_ANY = 0, MT_TRIANGULAR, MT_QUADRILATERAL, MT_TETRAHEDRAL, MT_HEXAHEDRAL }; typedef std::pair THypItem; typedef QList< THypItem > THypList; @@ -83,6 +84,7 @@ protected slots: void processSet(); void onHypoCreated( int ); void onHypoEdited( int ); + void onAlgoSetByMeshType( const int, const int ); private: typedef QList THypDataList; // typedef: list of hypothesis data @@ -109,11 +111,14 @@ private: bool createMesh( QString&, QStringList& ); bool createSubMesh( QString&, QStringList& ); bool editMeshOrSubMesh( QString& ); + bool checkSubMeshConcurrency( SMESH::SMESH_Mesh_ptr mesh, + SMESH::SMESH_subMesh_ptr submesh, + bool askUser=false); int currentHyp( const int, const int ) const; bool isAccessibleDim( const int ) const; void setCurrentHyp( const int, const int, const int ); - void setDefaultName() const; + void setDefaultName( const QString& prefix="" ) const; SMESH::SMESH_Hypothesis_var getAlgo( const int ); void readMesh(); QString name( _PTR(SObject) ) const; @@ -125,24 +130,26 @@ private: char* isSubmeshIgnored() const; _PTR(SObject) getSubmeshByGeom() const; void selectObject( _PTR(SObject) ) const; - + void createMeshTypeList( QStringList& ); + void setAvailableMeshType( const QStringList& ); + void setFilteredAlgoData( const int, const int ); private: SMESHGUI_MeshDlg* myDlg; SMESHGUI_ShapeByMeshOp* myShapeByMeshOp; bool myToCreate; bool myIsMesh; bool myIsOnGeometry; //!< TRUE if edited mesh accotiated with geometrical object + bool myHasConcurrentSubBefore; TDim2Type2HypList myExistingHyps; //!< all hypothesis of SMESH module TDim2Type2HypList myObjHyps; //!< hypothesis assigned to the current // edited mesh/sub-mesh - // hypdata corresponding to hypotheses present in myDlg THypDataList myAvailableHypData[4][NbHypTypes]; - + THypDataList myFilteredAlgoData[4]; bool myIgnoreAlgoSelection; HypothesesSet* myHypoSet; - int myDim, myType; + int myDim, myType, myMaxShapeDim; QString myObjectToSelect; }; diff --git a/src/SMESHGUI/SMESHGUI_MeshOrderDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshOrderDlg.cxx index ee38d0ce4..4feeca8da 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOrderDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOrderDlg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_MeshOrderDlg.h b/src/SMESHGUI/SMESHGUI_MeshOrderDlg.h index dafe10fd0..629d3d352 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOrderDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshOrderDlg.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx index 96caaa581..88a471b21 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -295,7 +295,8 @@ bool SMESHGUI_MeshOrderMgr::SetMeshOrder( const ListListId& theListListIds ) _PTR(SObject) aSmObj = smIter->Value(); SMESH::SMESH_subMesh_var sm = SMESH::SObjectToInterface( aSmObj ); - mapOfSubMesh[ sm->GetId() ] = SMESH::SMESH_subMesh::_duplicate(sm); + if ( !sm->_is_nil() ) + mapOfSubMesh[ sm->GetId() ] = SMESH::SMESH_subMesh::_duplicate(sm); } } diff --git a/src/SMESHGUI/SMESHGUI_MeshOrderOp.h b/src/SMESHGUI/SMESHGUI_MeshOrderOp.h index a899d3b22..6b4940ed1 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOrderOp.h +++ b/src/SMESHGUI/SMESHGUI_MeshOrderOp.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index 3d6501053..46bf3ef55 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -119,13 +119,13 @@ SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule ) aDlgLay->setMargin( MARGIN ); aDlgLay->setSpacing( SPACING ); - QWidget* aMainFrame = createMainFrame ( this ); + myMainFrame = createMainFrame ( this ); QWidget* aBtnFrame = createButtonFrame( this ); - aDlgLay->addWidget( aMainFrame ); + aDlgLay->addWidget( myMainFrame ); aDlgLay->addWidget( aBtnFrame ); - aDlgLay->setStretchFactor( aMainFrame, 1 ); + aDlgLay->setStretchFactor( myMainFrame, 1 ); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); @@ -1201,11 +1201,16 @@ void SMESHGUI_MeshPatternDlg::onTypeChanged (int theType) myNode2Lbl->show(); myNode2 ->show(); } - mySelInput = Mesh; activateSelection(); updateWgState(); displayPreview(); + myPicture2d->hide(); + myPicture2d->show(); + myPicture2d->resize(minimumSizeHint()); + myMainFrame->hide(); + myMainFrame->show(); + resize(minimumSizeHint()); } //======================================================================= @@ -1331,8 +1336,10 @@ void SMESHGUI_MeshPatternDlg::onModeToggled (bool on) { on ? myRefineGrp->show() : myRefineGrp->hide(); on ? myGeomGrp->hide() : myGeomGrp->show(); - + myMainFrame->hide(); + myMainFrame->show(); displayPreview(); + resize(minimumSizeHint()); } //======================================================================= diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h index 0ec8a49d7..43317618f 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -141,6 +141,8 @@ private: QMap mySelEdit; QMap mySelLbl; + QWidget* myMainFrame; + QLineEdit* myName; QPushButton* myOpenBtn; QPushButton* myNewBtn; diff --git a/src/SMESHGUI/SMESHGUI_MeshUtils.cxx b/src/SMESHGUI/SMESHGUI_MeshUtils.cxx index b6036d4de..d4e69f5e2 100644 --- a/src/SMESHGUI/SMESHGUI_MeshUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshUtils.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_MeshUtils.h b/src/SMESHGUI/SMESHGUI_MeshUtils.h index d0fa41a7c..fcadc44d9 100644 --- a/src/SMESHGUI/SMESHGUI_MeshUtils.h +++ b/src/SMESHGUI/SMESHGUI_MeshUtils.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx index d48e740f5..503de82d7 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -36,9 +36,12 @@ #include "SMESHGUI_SpinBox.h" #include "SMESHGUI_MeshEditPreview.h" -#include -#include -#include +#include "SMDS_Mesh.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_VolumeTool.hxx" +#include "SMESH_Actor.h" +#include "SMESH_MeshAlgos.hxx" +#include "SMESH_TypeFilter.hxx" // SALOME GUI includes #include @@ -58,9 +61,11 @@ #include // OCCT includes -#include +#include #include +#include #include +#include // VTK includes #include @@ -103,9 +108,10 @@ // Purpose : Constructor //======================================================================= SMESHGUI_MultiEditDlg -::SMESHGUI_MultiEditDlg(SMESHGUI* theModule, - const int theMode, - const bool the3d2d): +::SMESHGUI_MultiEditDlg(SMESHGUI* theModule, + const int theMode, + const bool the3d2d, + bool theDoInit): SMESHGUI_PreviewDlg(theModule), mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), @@ -128,7 +134,8 @@ SMESHGUI_MultiEditDlg aDlgLay->addWidget(aMainFrame); aDlgLay->addWidget(aBtnFrame); - Init(); + if ( theDoInit ) + Init(); } //======================================================================= @@ -162,6 +169,7 @@ QWidget* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool QRadioButton* aFaceRb = new QRadioButton(tr("SMESH_FACE"), aEntityTypeGrp); QRadioButton* aVolumeRb = new QRadioButton(tr("SMESH_VOLUME"), aEntityTypeGrp); + aEntityLayout->addWidget(aFaceRb); aEntityLayout->addWidget(aVolumeRb); @@ -226,9 +234,6 @@ QWidget* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool myComboBoxFunctor->addItem(tr("ASPECTRATIO_ELEMENTS")); myComboBoxFunctor->addItem(tr("MINIMUMANGLE_ELEMENTS")); myComboBoxFunctor->addItem(tr("SKEW_ELEMENTS")); - //myComboBoxFunctor->addItem(tr("AREA_ELEMENTS")); - //myComboBoxFunctor->addItem(tr("LENGTH2D_EDGES")); // for existing elements only - //myComboBoxFunctor->addItem(tr("MULTI2D_BORDERS")); // for existing elements only myComboBoxFunctor->setCurrentIndex(0); aCriterionLayout->addWidget(myChoiceWidget); @@ -305,7 +310,7 @@ QWidget* SMESHGUI_MultiEditDlg::createButtonFrame (QWidget* theParent) bool SMESHGUI_MultiEditDlg::isValid (const bool /*theMess*/) { return (!myMesh->_is_nil() && - (myListBox->count() > 0 || (myToAllChk->isChecked()/* && myActor*/))); + (myListBox->count() > 0 || (myToAllChk->isChecked() && nbElemsInMesh() > 0))); } //======================================================================= @@ -1071,6 +1076,11 @@ bool SMESHGUI_ChangeOrientationDlg::process (SMESH::SMESH_MeshEditor_ptr theEdit return theEditor->ReorientObject( obj ); } +int SMESHGUI_ChangeOrientationDlg::nbElemsInMesh() +{ + return ( myFilterType = SMESH::FaceFilter ) ? myMesh->NbFaces() : myMesh->NbVolumes(); +} + /*! * Class : SMESHGUI_UnionOfTrianglesDlg * Description : Construction of quadrangles by automatic association of triangles @@ -1163,39 +1173,44 @@ bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEdito ok = theEditor->TriToQuadObject(obj, aCriterion, aMaxAngle); return ok; } + +int SMESHGUI_UnionOfTrianglesDlg::nbElemsInMesh() +{ + return myMesh->NbTriangles(); +} void SMESHGUI_UnionOfTrianglesDlg::onDisplaySimulation( bool toDisplayPreview ) { if ( myPreviewCheckBox->isChecked() && toDisplayPreview ) { if ( isValid( true ) ) { try{ - SUIT_OverrideCursor aWaitCursor; - // get Ids of elements - SMESH::SMESH_IDSource_var obj; - SMESH::long_array_var anElemIds = getIds( obj ); + SUIT_OverrideCursor aWaitCursor; + // get Ids of elements + SMESH::SMESH_IDSource_var obj; + SMESH::long_array_var anElemIds = getIds( obj ); - SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor(); - SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer(); + SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor(); + SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer(); - double aMaxAngle = myMaxAngleSpin->GetValue() * M_PI / 180.0; + double aMaxAngle = myMaxAngleSpin->GetValue() * M_PI / 180.0; - if ( CORBA::is_nil( obj ) ) - aMeshEditor->TriToQuad( anElemIds.inout(), aCriterion, aMaxAngle ); - else - aMeshEditor->TriToQuadObject( obj, aCriterion, aMaxAngle ); + if ( CORBA::is_nil( obj ) ) + aMeshEditor->TriToQuad( anElemIds.inout(), aCriterion, aMaxAngle ); + else + aMeshEditor->TriToQuadObject( obj, aCriterion, aMaxAngle ); - SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData(); + SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData(); - vtkProperty* aProp = vtkProperty::New(); - aProp->SetRepresentationToWireframe(); - aProp->SetColor( 250, 0, 250 ); - aProp->SetLineWidth( SMESH::GetFloat( "SMESH:element_width", 1 ) + 3 ); - mySimulation->GetActor()->SetProperty( aProp ); - aProp->Delete(); + vtkProperty* aProp = vtkProperty::New(); + aProp->SetRepresentationToWireframe(); + aProp->SetColor( 250, 0, 250 ); + aProp->SetLineWidth( SMESH::GetFloat( "SMESH:element_width", 1 ) + 3 ); + mySimulation->GetActor()->SetProperty( aProp ); + aProp->Delete(); - mySimulation->SetData( aMeshPreviewStruct._retn() ); + mySimulation->SetData( aMeshPreviewStruct._retn() ); } catch ( ... ) { - hidePreview(); + hidePreview(); } } else { hidePreview(); @@ -1279,6 +1294,12 @@ bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor, return hasObj ? theEditor->QuadToTriObject(obj, aCrit) : theEditor->QuadToTri(theIds, aCrit); } +int SMESHGUI_CuttingOfQuadsDlg::nbElemsInMesh() +{ + return myMesh->NbQuadrangles(); +} + + void SMESHGUI_CuttingOfQuadsDlg::onCriterionRB() { if (myGroupChoice->checkedId() == 2) // Use numeric functor @@ -1488,51 +1509,149 @@ void SMESHGUI_CuttingOfQuadsDlg::displayPreview() } /*! - * Class : SMESHGUI_CuttingIntoTetraDlg - * Description : Modification of orientation of faces + * Class : SMESHGUI_SplitVolumesDlg + * Description : Spliter of volumes into tetrahedra or prisms */ -SMESHGUI_CuttingIntoTetraDlg::SMESHGUI_CuttingIntoTetraDlg(SMESHGUI* theModule) - : SMESHGUI_MultiEditDlg(theModule, SMESH::VolumeFilter, false) +SMESHGUI_SplitVolumesDlg::SMESHGUI_SplitVolumesDlg(SMESHGUI* theModule) + : SMESHGUI_MultiEditDlg(theModule, SMESH::VolumeFilter, /*the3d2d=*/true, /*doInit=*/false) { setWindowTitle(tr("CAPTION")); myHelpFileName = "split_to_tetra_page.html"; myEntityType = 1; + myCellSize = -1.; + + // Facet selection group + + myFacetSelGrp = new QGroupBox(tr("FACET_TO_SPLIT"), myCriterionGrp->parentWidget()); + QGridLayout* facetSelLayout = new QGridLayout( myFacetSelGrp ); + facetSelLayout->setMargin(MARGIN); + facetSelLayout->setSpacing(SPACING); + + QLabel* pointLbl = new QLabel( tr("START_POINT"), myFacetSelGrp); + QLabel* normalLbl = new QLabel( tr("FACET_NORMAL"), myFacetSelGrp); + myFacetSelBtn = new QPushButton( mySubmeshBtn->icon(), "", myFacetSelGrp ); + myFacetSelBtn->setCheckable( true ); + QLabel* XLbl = new QLabel( tr("SMESH_X"), myFacetSelGrp); + QLabel* YLbl = new QLabel( tr("SMESH_Y"), myFacetSelGrp); + QLabel* ZLbl = new QLabel( tr("SMESH_Z"), myFacetSelGrp); + QLabel* dXLbl = new QLabel( tr("SMESH_DX"), myFacetSelGrp); + QLabel* dYLbl = new QLabel( tr("SMESH_DY"), myFacetSelGrp); + QLabel* dZLbl = new QLabel( tr("SMESH_DZ"), myFacetSelGrp); + QPushButton* axisBtn[3]; + for ( int i = 0; i < 3; ++i ) + { + myPointSpin[i] = new SMESHGUI_SpinBox( myFacetSelGrp ); + myDirSpin [i] = new SMESHGUI_SpinBox( myFacetSelGrp ); + myPointSpin[i]->RangeStepAndValidator( -1e10, 1e10, 10 ); + myDirSpin [i]->RangeStepAndValidator( -1., 1., 0.1 ); + myPointSpin[i]->SetValue(0.); + myDirSpin [i]->SetValue(0.); + myAxisBtn [i] = new QPushButton( QString("|| O") + char('X'+i ), myFacetSelGrp); + } + myDirSpin[2]->SetValue(1.); + + myAllDomainsChk = new QCheckBox( tr("ALL_DOMAINS"), mySelGrp ); + + facetSelLayout->addWidget( pointLbl, 0, 0 ); + facetSelLayout->addWidget( myFacetSelBtn, 0, 1 ); + facetSelLayout->addWidget( XLbl, 0, 2 ); + facetSelLayout->addWidget( myPointSpin[0],0, 3 ); + facetSelLayout->addWidget( YLbl, 0, 4 ); + facetSelLayout->addWidget( myPointSpin[1],0, 5 ); + facetSelLayout->addWidget( ZLbl, 0, 6 ); + facetSelLayout->addWidget( myPointSpin[2],0, 7 ); + + facetSelLayout->addWidget( normalLbl, 1, 0 ); + facetSelLayout->addWidget( dXLbl, 1, 2 ); + facetSelLayout->addWidget( myDirSpin[0], 1, 3 ); + facetSelLayout->addWidget( dYLbl, 1, 4 ); + facetSelLayout->addWidget( myDirSpin[1], 1, 5 ); + facetSelLayout->addWidget( dZLbl, 1, 6 ); + facetSelLayout->addWidget( myDirSpin[2], 1, 7 ); + + facetSelLayout->addWidget( myAxisBtn[0], 2, 2, 1, 2 ); + facetSelLayout->addWidget( myAxisBtn[1], 2, 4, 1, 2 ); + facetSelLayout->addWidget( myAxisBtn[2], 2, 6, 1, 2 ); + + myCriterionGrp->layout()->addWidget( myFacetSelGrp ); + myCriterionGrp->layout()->addWidget( myAllDomainsChk ); + //myChoiceWidget->layout()->addWidget( myAllDomainsChk ); + + connect( myFacetSelBtn, SIGNAL(clicked(bool)), SLOT(onFacetSelection(bool)) ); + for ( int i = 0; i < 3; ++i ) + { + connect( myAxisBtn [i], SIGNAL(clicked()), SLOT(onSetDir()) ); + connect( myPointSpin[i], SIGNAL(valueChanged (const QString&)), + this, SLOT (updateNormalPreview(const QString&)) ); + connect( myDirSpin [i], SIGNAL(valueChanged (const QString&)), + this, SLOT (updateNormalPreview(const QString&)) ); + } + if ( myEntityTypeGrp ) + { + myEntityTypeGrp->button(0)->setText( tr("SMESH_TETRAS")); + myEntityTypeGrp->button(1)->setText( tr("SMESH_PRISM")); + if ( QGroupBox* gb = qobject_cast< QGroupBox* >( myEntityTypeGrp->button(0)->parent() )) + gb->setTitle( tr("TARGET_ELEM_TYPE")); + } myToAllChk->setChecked( true ); //aplly to the whole mesh by default bool hasHexa = true;//myMesh->_is_nil() ? false : myMesh->NbHexas(); - if ( hasHexa ) { - myGroupChoice->button(0)->setText( tr("SPLIT_HEX_TO_5_TETRA")); - myGroupChoice->button(1)->setText( tr("SPLIT_HEX_TO_6_TETRA")); - myGroupChoice->button(2)->setText( tr("SPLIT_HEX_TO_24_TETRA")); - myCriterionGrp->setTitle( tr("SPLIT_METHOD")); myCriterionGrp->show(); myComboBoxFunctor->hide(); myChoiceWidget->show(); } - setSelectionMode(); - updateButtons(); + + on3d2dChanged( 0 ); + Init(); } -SMESHGUI_CuttingIntoTetraDlg::~SMESHGUI_CuttingIntoTetraDlg() +SMESHGUI_SplitVolumesDlg::~SMESHGUI_SplitVolumesDlg() { } -bool SMESHGUI_CuttingIntoTetraDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor, - const SMESH::long_array& theIds, - SMESH::SMESH_IDSource_ptr theObj) +bool SMESHGUI_SplitVolumesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor, + const SMESH::long_array& theIds, + SMESH::SMESH_IDSource_ptr theObj) { SMESH::SMESH_IDSource_wrap obj = theObj; if ( CORBA::is_nil( obj )) - obj = theEditor->MakeIDSource( theIds, myEntityType ? SMESH::VOLUME : SMESH::FACE ); + obj = theEditor->MakeIDSource( theIds, SMESH::VOLUME ); else obj->Register(); try { - theEditor->SplitVolumesIntoTetra( obj, myGroupChoice->checkedId()+1 ); + if ( isIntoPrisms() ) + { + QStringList aParameters; + aParameters << myPointSpin[0]->text(); + aParameters << myPointSpin[1]->text(); + aParameters << myPointSpin[2]->text(); + aParameters << myDirSpin[0]->text(); + aParameters << myDirSpin[1]->text(); + aParameters << myDirSpin[2]->text(); + myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); + + SMESH::PointStruct_var point = new SMESH::PointStruct; + point->x = myPointSpin[0]->GetValue(); + point->y = myPointSpin[1]->GetValue(); + point->z = myPointSpin[2]->GetValue(); + SMESH::DirStruct_var norm = new SMESH::DirStruct; + norm->PS.x = myDirSpin[0]->GetValue(); + norm->PS.y = myDirSpin[1]->GetValue(); + norm->PS.z = myDirSpin[2]->GetValue(); + + theEditor->SplitHexahedraIntoPrisms( obj, point, norm, + myGroupChoice->checkedId()+1, + myAllDomainsChk->isChecked() ); + } + else + { + theEditor->SplitVolumesIntoTetra( obj, myGroupChoice->checkedId()+1 ); + } } catch ( const SALOME::SALOME_Exception& S_ex ) { SalomeApp_Tools::QtCatchCorbaException( S_ex ); @@ -1543,3 +1662,314 @@ bool SMESHGUI_CuttingIntoTetraDlg::process (SMESH::SMESH_MeshEditor_ptr theEdito } return true; } + +int SMESHGUI_SplitVolumesDlg::nbElemsInMesh() +{ + return isIntoPrisms() ? myMesh->NbHexas() : myMesh->NbVolumes() - myMesh->NbTetras(); +} + +bool SMESHGUI_SplitVolumesDlg::isIntoPrisms() +{ + return ( myEntityTypeGrp->checkedId() == 1 ); +} + +//================================================================================ +/*! + * \brief Slot called when a target element type changes + */ +//================================================================================ + +void SMESHGUI_SplitVolumesDlg::on3d2dChanged(int isPrism) +{ + if ( isPrism ) + { + myFacetSelGrp->show(); + myAllDomainsChk->show(); + myGroupChoice->button(2)->hide(); + myGroupChoice->button(0)->setText( tr("SPLIT_HEX_TO_2_PRISMS")); + myGroupChoice->button(1)->setText( tr("SPLIT_HEX_TO_4_PRISMS")); + } + else + { + myFacetSelGrp->hide(); + myAllDomainsChk->hide(); + myGroupChoice->button(2)->show(); + myGroupChoice->button(0)->setText( tr("SPLIT_HEX_TO_5_TETRA")); + myGroupChoice->button(1)->setText( tr("SPLIT_HEX_TO_6_TETRA")); + myGroupChoice->button(2)->setText( tr("SPLIT_HEX_TO_24_TETRA")); + } + SMESHGUI_MultiEditDlg::on3d2dChanged( !myEntityType ); + myEntityType = 1; // == VOLUME + myChoiceWidget->hide(); + myChoiceWidget->show(); + resize(minimumSizeHint()); + onSelectionDone(); +} + +//================================================================================ +/*! + * \brief Set selection mode + */ +//================================================================================ + +void SMESHGUI_SplitVolumesDlg::setSelectionMode() +{ + if ( myBusy || !isEnabled() ) return; + + SMESH::RemoveFilters(); + + mySelectionMgr->clearFilters(); + + if (mySubmeshChk->isChecked()) { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); + mySelectionMgr->installFilter(new SMESH_TypeFilter(SMESH::SUBMESH)); + myFacetSelBtn->setChecked( false ); + } + else if (myGroupChk->isChecked()) { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); + mySelectionMgr->installFilter(new SMESH_TypeFilter(SMESH::GROUP)); + myFacetSelBtn->setChecked( false ); + } + + if ( myFacetSelBtn->isChecked() ) + { + // facet selection - select any element + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( CellSelection ); + myFilterType = SMESH::AllElementsFilter; + } + else + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( VolumeSelection ); + if ( isIntoPrisms() ) + { + SMESH::SetFilter(new SMESHGUI_VolumeShapeFilter( SMDSGeom_HEXA )); + myFilterType = SMESHGUI_VolumeShapeFilter::GetId( SMDSGeom_HEXA ); + } + else // to tetrahedra + { + SMESH::SetFilter(new SMESHGUI_VolumesFilter()); + myFilterType = SMESH::VolumeFilter; + } + } +} + +//================================================================================ +/*! + * \brief SLOT called when selection changed + */ +//================================================================================ + +void SMESHGUI_SplitVolumesDlg::onSelectionDone() +{ + if (myBusy || !isEnabled()) return; + + if ( !myFacetSelBtn->isChecked() ) + { + SMESHGUI_MultiEditDlg::onSelectionDone(); + } + else // set point and normal by a selected element + { + const SALOME_ListIO& aList = mySelector->StoredIObjects(); + int nbSel = aList.Extent(); + if (nbSel > 0) + { + Handle(SALOME_InteractiveObject) anIO = aList.First(); + + myActor = SMESH::FindActorByEntry( anIO->getEntry() ); + + SMESH::SMESH_Mesh_var aSelMesh = SMESH::GetMeshByIO(anIO); + if (!aSelMesh->_is_nil()) + myMesh = aSelMesh; + + TColStd_IndexedMapOfInteger aMapIndex; + mySelector->GetIndex( anIO, aMapIndex ); + if ( !aMapIndex.IsEmpty() ) + showFacetByElement( aMapIndex(1) ); + else if ( myCellSize < 0 ) + showFacetByElement( 1 ); + } + updateButtons(); + } + + myCriterionGrp->setEnabled( !myMesh->_is_nil() && nbElemsInMesh() > 0 ); +} + +//================================================================================ +/*! + * \brief Show facet normal by a selected element + */ +//================================================================================ + +void SMESHGUI_SplitVolumesDlg::showFacetByElement( int elemID ) +{ + if ( !isIntoPrisms() || !myActor ) + { + mySimulation->SetVisibility( false ); + return; + } + SMDS_Mesh* mesh = myActor->GetObject()->GetMesh(); + const SMDS_MeshElement* elem = mesh->FindElement( elemID ); + if ( !elem ) return; + + // set point XYZ by the element barycenter + gp_XYZ bc( 0,0,0 ); + Bnd_B3d bbox; + SMDS_NodeIteratorPtr nIt = elem->nodeIterator(); + vector< const SMDS_MeshNode* > nodes; + nodes.reserve( elem->NbNodes() ); + while ( nIt->more() ) + { + nodes.push_back( nIt->next() ); + gp_XYZ p = SMESH_TNodeXYZ( nodes.back() ); + bc += p; + bbox.Add( p ); + } + bc /= nodes.size(); + + myPointSpin[0]->SetValue( bc.X() ); + myPointSpin[1]->SetValue( bc.Y() ); + myPointSpin[2]->SetValue( bc.Z() ); + + // set size + myCellSize = sqrt( bbox.SquareExtent() ); + + // set normal and size + gp_XYZ norm; + switch ( elem->GetType()) + { + case SMDSAbs_Edge: + { + norm = SMESH_TNodeXYZ( nodes[1] ) - SMESH_TNodeXYZ( nodes[0] ); + break; + } + case SMDSAbs_Face: + { + if ( !SMESH_MeshAlgos::FaceNormal( elem, norm, /*normalized=*/false )) + return; + break; + } + case SMDSAbs_Volume: + { + SMDS_VolumeTool vTool( elem ); + vTool.SetExternalNormal(); + bool freeFacetFound = false; + double n[3]; + for ( int i = 0; i < vTool.NbFaces() && !freeFacetFound; ++i ) + if (( freeFacetFound = vTool.IsFreeFace( i ))) + vTool.GetFaceNormal( i, n[0], n[1], n[2] ); + if ( !freeFacetFound ) + vTool.GetFaceNormal( 0, n[0], n[1], n[2] ); + norm.SetCoord( n[0], n[1], n[2] ); + break; + } + default: return; + } + + double size = norm.Modulus(); + if ( size < 1e-20 ) + return; + norm /= size; + + myDirSpin[0]->SetValue( norm.X() ); + myDirSpin[1]->SetValue( norm.Y() ); + myDirSpin[2]->SetValue( norm.Z() ); + + if ( myCellSize > 0. ) + updateNormalPreview(); +} + +//================================================================================ +/*! + * \brief SLOT called when a point or a normal changes + */ +//================================================================================ + +void SMESHGUI_SplitVolumesDlg::updateNormalPreview(const QString&) +{ + if ( myCellSize < 0. ) + { + showFacetByElement( 1 ); + return; + } + + gp_Pnt point ( myPointSpin[0]->GetValue(), + myPointSpin[1]->GetValue(), + myPointSpin[2]->GetValue() ); + gp_XYZ norm ( myDirSpin[0]->GetValue(), + myDirSpin[1]->GetValue(), + myDirSpin[2]->GetValue() ); + if ( norm.Modulus() < 1e-20 ) + return; + + vtkUnstructuredGrid* grid = mySimulation->GetGrid(); + + // Initialize the preview mesh of an arrow + if ( grid->GetNumberOfPoints() == 0 ) + { + mySimulation->SetArrowShapeAndNb( /*nb=*/1, /*hLen=*/0.3, /*R=*/0.1, /*start=*/0 ); + } + + // Compute new coordinates of the grid according to the dialog controls + + gp_Ax1 axis( point, norm ); + mySimulation->SetArrows( &axis, 4 * myCellSize ); + mySimulation->SetVisibility(true); +} + +//================================================================================ +/*! + * \brief Slot called when facet selection button is clicked + */ +//================================================================================ + +void SMESHGUI_SplitVolumesDlg::onFacetSelection(bool isFacetSelection) +{ + setSelectionMode(); + onSelectionDone(); + mySelGrp->setEnabled( !isFacetSelection ); +} + +//================================================================================ +/*! + * \brief Slot called when an || axis button is clicked + */ +//================================================================================ + +void SMESHGUI_SplitVolumesDlg::onSetDir() +{ + myDirSpin[0]->SetValue(0.); + myDirSpin[1]->SetValue(0.); + myDirSpin[2]->SetValue(0.); + int i = 0; + for ( ; i < 3; ++i ) + if ( sender() == myAxisBtn[i] ) + break; + if ( i == 3 ) + i == 0; + myDirSpin[i]->SetValue(1.); + + if ( myActor && !myMesh->_is_nil() && myMesh->NbNodes() > 0 ) + { + double b[6]; + myActor->GetUnstructuredGrid()->GetBounds(b); + gp_XYZ center( 0.5 * ( b[0] + b[1] ), + 0.5 * ( b[2] + b[3] ), + 0.5 * ( b[4] + b[5] )); + gp_XYZ point ( myPointSpin[0]->GetValue(), + myPointSpin[1]->GetValue(), + myPointSpin[2]->GetValue() ); + gp_XYZ norm ( myDirSpin[0]->GetValue(), + myDirSpin[1]->GetValue(), + myDirSpin[2]->GetValue() ); + + gp_Vec cp( center, point ); + if ( cp.Dot( norm ) < 0. ) + myDirSpin[i]->SetValue(-1.); + } + + updateNormalPreview(); +} diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.h b/src/SMESHGUI/SMESHGUI_MultiEditDlg.h index 68847772b..a8a0d0a62 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.h +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -70,7 +70,10 @@ class SMESHGUI_EXPORT SMESHGUI_MultiEditDlg : public SMESHGUI_PreviewDlg Q_OBJECT public: - SMESHGUI_MultiEditDlg( SMESHGUI*, const int, const bool = false ); + SMESHGUI_MultiEditDlg( SMESHGUI* theModule, + const int theMode, + const bool the3d2d = false, + bool theDoInit = true ); virtual ~SMESHGUI_MultiEditDlg(); void Init(); @@ -87,7 +90,7 @@ protected slots: void onHelp(); void onDeactivate(); - void onSelectionDone(); + virtual void onSelectionDone(); void onFilterBtn(); void onAddBtn(); @@ -98,7 +101,7 @@ protected slots: void onGroupChk(); virtual void onToAllChk(); void onFilterAccepted(); - void on3d2dChanged(int); + virtual void on3d2dChanged(int); SMESH::NumericalFunctor_ptr getNumericalFunctor(); @@ -110,11 +113,12 @@ protected: virtual bool isValid( const bool ); SMESH::long_array_var getIds(SMESH::SMESH_IDSource_var& obj); void updateButtons(); - void setSelectionMode(); + virtual void setSelectionMode(); virtual bool isIdValid( const int ) const; virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& , SMESH::SMESH_IDSource_ptr obj) = 0; + virtual int nbElemsInMesh() = 0; int entityType(); protected: @@ -178,6 +182,7 @@ protected: virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& , SMESH::SMESH_IDSource_ptr obj); + virtual int nbElemsInMesh(); }; /*! @@ -197,6 +202,7 @@ protected: virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array&, SMESH::SMESH_IDSource_ptr obj ); + virtual int nbElemsInMesh(); protected slots: virtual void onDisplaySimulation( bool ); @@ -221,6 +227,7 @@ protected: virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& , SMESH::SMESH_IDSource_ptr obj); + virtual int nbElemsInMesh(); protected slots: virtual void reject(); @@ -237,21 +244,45 @@ private: }; /*! - * Class : SMESHGUI_CuttingIntoTetraDlg + * Class : SMESHGUI_SplitVolumesDlg * Description : Split all volumes into tetrahedrons */ -class SMESHGUI_CuttingIntoTetraDlg : public SMESHGUI_MultiEditDlg +class SMESHGUI_SplitVolumesDlg : public SMESHGUI_MultiEditDlg { Q_OBJECT public: - SMESHGUI_CuttingIntoTetraDlg( SMESHGUI* ); - virtual ~SMESHGUI_CuttingIntoTetraDlg(); + SMESHGUI_SplitVolumesDlg( SMESHGUI* ); + virtual ~SMESHGUI_SplitVolumesDlg(); + +protected slots: + + virtual void on3d2dChanged(int); + virtual void onSelectionDone(); + + void onFacetSelection(bool); + void onSetDir(); + void updateNormalPreview(const QString& s=""); protected: + virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array&, SMESH::SMESH_IDSource_ptr obj ); + virtual int nbElemsInMesh(); + + virtual void setSelectionMode(); + void showFacetByElement( int id ); + bool isIntoPrisms(); + + QGroupBox* myFacetSelGrp; + SMESHGUI_SpinBox* myPointSpin[3]; + SMESHGUI_SpinBox* myDirSpin [3]; + QPushButton* myFacetSelBtn; + QPushButton* myAxisBtn[3]; + QCheckBox* myAllDomainsChk; + + double myCellSize; }; #endif // SMESHGUI_MULTIEDITDLG_H diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx index 1d52cc073..6988b3972 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.h b/src/SMESHGUI/SMESHGUI_NodesDlg.h index 735a55c3a..b5b2faa9d 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Operation.cxx b/src/SMESHGUI/SMESHGUI_Operation.cxx index 62311db80..59c4e139d 100755 --- a/src/SMESHGUI/SMESHGUI_Operation.cxx +++ b/src/SMESHGUI/SMESHGUI_Operation.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Operation.h b/src/SMESHGUI/SMESHGUI_Operation.h index 7d49e7356..4e5097c93 100755 --- a/src/SMESHGUI/SMESHGUI_Operation.h +++ b/src/SMESHGUI/SMESHGUI_Operation.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_PatternUtils.cxx b/src/SMESHGUI/SMESHGUI_PatternUtils.cxx index 5996a41bf..5b469954c 100644 --- a/src/SMESHGUI/SMESHGUI_PatternUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_PatternUtils.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_PatternUtils.h b/src/SMESHGUI/SMESHGUI_PatternUtils.h index 2c6b0e711..4d7a821ea 100644 --- a/src/SMESHGUI/SMESHGUI_PatternUtils.h +++ b/src/SMESHGUI/SMESHGUI_PatternUtils.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_PatternWidget.cxx b/src/SMESHGUI/SMESHGUI_PatternWidget.cxx index aafdcee7b..747cd59a8 100644 --- a/src/SMESHGUI/SMESHGUI_PatternWidget.cxx +++ b/src/SMESHGUI/SMESHGUI_PatternWidget.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -42,7 +42,7 @@ SMESHGUI_PatternWidget::SMESHGUI_PatternWidget( QWidget* parent ) : QFrame( parent ) { myMinU = myMinV = myMaxU = myMaxV = 0; - setMinimumHeight( 150 ); + //setMinimumHeight( 150 ); } //================================================================================= diff --git a/src/SMESHGUI/SMESHGUI_PatternWidget.h b/src/SMESHGUI/SMESHGUI_PatternWidget.h index ca76c605e..3c2087bff 100644 --- a/src/SMESHGUI/SMESHGUI_PatternWidget.h +++ b/src/SMESHGUI/SMESHGUI_PatternWidget.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx index 168f9e108..4ecb44cab 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h index 9c9fc9539..d286d2c41 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_PreviewDlg.cxx b/src/SMESHGUI/SMESHGUI_PreviewDlg.cxx index 254e8b0fa..3fc6b4776 100644 --- a/src/SMESHGUI/SMESHGUI_PreviewDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_PreviewDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_PreviewDlg.h b/src/SMESHGUI/SMESHGUI_PreviewDlg.h index 5d125c673..1b63f9224 100644 --- a/src/SMESHGUI/SMESHGUI_PreviewDlg.h +++ b/src/SMESHGUI/SMESHGUI_PreviewDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx b/src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx index f7444c60d..400a02532 100644 --- a/src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -157,6 +158,8 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark myBallColor = new QtxColorButton( myBallGrp ); QLabel* ballSizeLab = new QLabel( tr( "SIZE" ), myBallGrp ); myBallSize = new QtxIntSpinBox( myBallGrp ); + QLabel* ballScaleLab = new QLabel( tr( "SCALE_FACTOR" ), myBallGrp ); + myBallScale = new QtxDoubleSpinBox( 1e-2, 1e7, 0.5, myBallGrp ); hl = new QHBoxLayout( myBallGrp ); hl->setMargin( MARGIN ); hl->setSpacing( SPACING ); @@ -164,6 +167,8 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark hl->addWidget( myBallColor ); hl->addWidget( ballSizeLab ); hl->addWidget( myBallSize ); + hl->addWidget( ballScaleLab ); + hl->addWidget( myBallScale ); widthLab1 = qMax( widthLab1, ballColorLab->minimumSizeHint().width() ); widthLab2 = qMax( widthLab2, ballSizeLab->minimumSizeHint().width() ); @@ -171,7 +176,7 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark myOrientationGrp = new QGroupBox( tr( "ORIENTATIONS" ), mainFrame() ); QLabel* orientationColorLab = new QLabel( tr( "COLOR" ), myOrientationGrp ); myOrientationColor = new QtxColorButton( myOrientationGrp ); - QLabel* orientationScaleLab = new QLabel( tr( "ORIENTATION_SCALE" ), myOrientationGrp ); + QLabel* orientationScaleLab = new QLabel( tr( "SCALE_FACTOR" ), myOrientationGrp ); myOrientationSize = new QtxIntSpinBox( myOrientationGrp ); myOrientationSize->setSuffix( "% "); myOrientation3d = new QCheckBox( tr("ORIENTATION_3D"), myOrientationGrp ); @@ -236,6 +241,7 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark myOutlineWidth->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myElem0dSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myBallSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + myBallScale->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myOrientationSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myShrinkSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); @@ -530,6 +536,24 @@ int SMESHGUI_PropertiesDlg::ballSize() const return myBallSize->value(); } +/*! + \brief Set discrete elements (balls) scale factor + \param size discrete elements (balls) scale factor +*/ +void SMESHGUI_PropertiesDlg::setBallScale( double size ) +{ + myBallScale->setValue( size ); +} + +/*! + \brief Get discrete elements (balls) scale factor + \return current discrete elements (balls) scale factor +*/ +double SMESHGUI_PropertiesDlg::ballScale() const +{ + return myBallScale->value(); +} + /*! \brief Set orientation vectors color \param color orientation vectors color diff --git a/src/SMESHGUI/SMESHGUI_PropertiesDlg.h b/src/SMESHGUI/SMESHGUI_PropertiesDlg.h index 390b5a126..5ec3ce620 100644 --- a/src/SMESHGUI/SMESHGUI_PropertiesDlg.h +++ b/src/SMESHGUI/SMESHGUI_PropertiesDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -38,6 +38,7 @@ class QGroupBox; class QtxColorButton; class QtxBiColorTool; class QtxIntSpinBox; +class QtxDoubleSpinBox; class VTKViewer_MarkerWidget; class SMESHGUI_EXPORT SMESHGUI_PropertiesDlg : public SMESHGUI_Dialog @@ -83,6 +84,8 @@ public: QColor ballColor() const; void setBallSize( int ); int ballSize() const; + void setBallScale( double ); + double ballScale() const; void setOrientationColor( const QColor& ); QColor orientationColor() const; @@ -132,6 +135,7 @@ private: // - balls QtxColorButton* myBallColor; QtxIntSpinBox* myBallSize; + QtxDoubleSpinBox* myBallScale; // - orientation vectors QtxColorButton* myOrientationColor; QtxIntSpinBox* myOrientationSize; diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx index 2b7fbbdc4..9654bc166 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h index b8df30aeb..b48726223 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx index bfcd05733..5780ce55a 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -364,7 +364,7 @@ void SMESHGUI_RemoveNodesDlg::SelectionIntoArgument() // get selected mesh SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); + mySelectionMgr->selectedObjects(aList); int nbSel = aList.Extent(); if (nbSel == 1) { diff --git a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h index c327e300a..0ffc235ac 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx b/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx index 00633ebcc..0c70bfdbb 100644 --- a/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_RenumberingDlg.h b/src/SMESHGUI/SMESHGUI_RenumberingDlg.h index dc0f518ed..26ae2b311 100644 --- a/src/SMESHGUI/SMESHGUI_RenumberingDlg.h +++ b/src/SMESHGUI/SMESHGUI_RenumberingDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_ReorientFacesDlg.cxx b/src/SMESHGUI/SMESHGUI_ReorientFacesDlg.cxx index e32551bb1..aee6f62d7 100644 --- a/src/SMESHGUI/SMESHGUI_ReorientFacesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ReorientFacesDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_ReorientFacesDlg.h b/src/SMESHGUI/SMESHGUI_ReorientFacesDlg.h index 6d03a5770..400850b89 100644 --- a/src/SMESHGUI/SMESHGUI_ReorientFacesDlg.h +++ b/src/SMESHGUI/SMESHGUI_ReorientFacesDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index a70f3e02c..6e5ccb913 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -712,8 +712,8 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument() return; // get selected mesh - const SALOME_ListIO& aList = mySelector->StoredIObjects(); - + SALOME_ListIO aList; + mySelectionMgr->selectedObjects(aList); int nbSel = aList.Extent(); if (nbSel != 1) return; diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h index 4dffd6429..811f65132 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx index 18aabb74c..936a228c1 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -664,7 +664,7 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument() // get selected mesh SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); + mySelectionMgr->selectedObjects(aList); int nbSel = aList.Extent(); if (nbSel < 1) diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.h b/src/SMESHGUI/SMESHGUI_RotationDlg.h index 97131cb57..3f2c1b9ce 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.h +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx b/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx index 09a941be6..9da433c69 100644 --- a/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -425,6 +425,8 @@ void SMESHGUI_ScaleDlg::ConstructorsClicked (int constructorId) connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); QApplication::instance()->processEvents(); + myEditCurrentArgument->hide(); + myEditCurrentArgument->show(); updateGeometry(); resize(100,100); } @@ -704,7 +706,7 @@ void SMESHGUI_ScaleDlg::SelectionIntoArgument() // get selected mesh SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); + mySelectionMgr->selectedObjects(aList); int nbSel = aList.Extent(); if (nbSel < 1) diff --git a/src/SMESHGUI/SMESHGUI_ScaleDlg.h b/src/SMESHGUI/SMESHGUI_ScaleDlg.h index aee598be9..378b17af0 100644 --- a/src/SMESHGUI/SMESHGUI_ScaleDlg.h +++ b/src/SMESHGUI/SMESHGUI_ScaleDlg.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx index ea8bf0317..80ca03466 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.cxx +++ b/src/SMESHGUI/SMESHGUI_Selection.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Selection.h b/src/SMESHGUI/SMESHGUI_Selection.h index 5f2a50bdb..0a9d46ccc 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.h +++ b/src/SMESHGUI/SMESHGUI_Selection.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_SelectionOp.cxx b/src/SMESHGUI/SMESHGUI_SelectionOp.cxx index ce349a055..0c8486ed2 100644 --- a/src/SMESHGUI/SMESHGUI_SelectionOp.cxx +++ b/src/SMESHGUI/SMESHGUI_SelectionOp.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -318,7 +318,9 @@ int SMESHGUI_SelectionOp::typeById( const QString& str, const EntityType objtype GEOM::GEOM_Object_var obj = GEOM::GEOM_Object::_narrow( dynamic_cast( sobj.get() )->GetObject() ); if( !CORBA::is_nil( obj ) ) - res = SMESHGUI_Dialog::prefix( "GEOM" ) + obj->GetType(); + // as decoding of type id is not realized in LightApp_Dialog, + //make all GEOM objects have same type id + res = SMESHGUI_Dialog::prefix( "GEOM" );// + obj->GetType(); } } else diff --git a/src/SMESHGUI/SMESHGUI_SelectionOp.h b/src/SMESHGUI/SMESHGUI_SelectionOp.h index 82070355c..c8080f9ae 100644 --- a/src/SMESHGUI/SMESHGUI_SelectionOp.h +++ b/src/SMESHGUI/SMESHGUI_SelectionOp.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx index 94e008506..6bb73e2dd 100644 --- a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -726,7 +726,7 @@ void SMESHGUI_SewingDlg::SelectionIntoArgument (bool isSelectionChanged) // get selected mesh SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); + mySelectionMgr->selectedObjects(aList); int nbSel = aList.Extent(); if (nbSel != 1) diff --git a/src/SMESHGUI/SMESHGUI_SewingDlg.h b/src/SMESHGUI/SMESHGUI_SewingDlg.h index e34ad4a46..7ba8a45c4 100644 --- a/src/SMESHGUI/SMESHGUI_SewingDlg.h +++ b/src/SMESHGUI/SMESHGUI_SewingDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx index fbd51ae0b..9c63004b3 100644 --- a/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -420,7 +420,7 @@ void SMESHGUI_ShapeByMeshOp::onSelectionDone() try { SALOME_ListIO aList; - selectionMgr()->selectedObjects(aList, SVTK_Viewer::Type()); + selectionMgr()->selectedObjects(aList); if (!myIsMultipleAllowed && aList.Extent() != 1) return; diff --git a/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.h b/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.h index fc7386272..4b6abe4f4 100644 --- a/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.h +++ b/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx index 8059552fe..df03f4559 100755 --- a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_SingleEditDlg.h b/src/SMESHGUI/SMESHGUI_SingleEditDlg.h index d652d3a13..9e5261746 100755 --- a/src/SMESHGUI/SMESHGUI_SingleEditDlg.h +++ b/src/SMESHGUI/SMESHGUI_SingleEditDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx index a3ad8b311..7e1d8d051 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -565,7 +565,7 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument() // get selected mesh SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); + mySelectionMgr->selectedObjects(aList); int nbSel = aList.Extent(); if (nbSel != 1) return; diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.h b/src/SMESHGUI/SMESHGUI_SmoothingDlg.h index 13d022622..792134d38 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.h +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_SpinBox.cxx b/src/SMESHGUI/SMESHGUI_SpinBox.cxx index d0094a58d..b1817d584 100644 --- a/src/SMESHGUI/SMESHGUI_SpinBox.cxx +++ b/src/SMESHGUI/SMESHGUI_SpinBox.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_SpinBox.h b/src/SMESHGUI/SMESHGUI_SpinBox.h index 6bc244e64..dab3f34ba 100644 --- a/src/SMESHGUI/SMESHGUI_SpinBox.h +++ b/src/SMESHGUI/SMESHGUI_SpinBox.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx index 869026ab0..c887edf84 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -453,6 +453,8 @@ void SMESHGUI_SymmetryDlg::ConstructorsClicked (int constructorId) onDisplaySimulation(true); QApplication::instance()->processEvents(); + myEditCurrentArgument->hide(); + myEditCurrentArgument->show(); updateGeometry(); resize(100,100); } @@ -722,7 +724,7 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument() // get selected mesh SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); + mySelectionMgr->selectedObjects(aList); int nbSel = aList.Extent(); if (nbSel < 1) diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.h b/src/SMESHGUI/SMESHGUI_SymmetryDlg.h index bb7b4ecd3..efb69b831 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.h +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx index 3805733db..e4bf823f8 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -451,7 +451,8 @@ void SMESHGUI_TranslationDlg::ConstructorsClicked (int constructorId) connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); onDisplaySimulation(true); - + myEditCurrentArgument->hide(); + myEditCurrentArgument->show(); QApplication::instance()->processEvents(); updateGeometry(); resize(100,100); @@ -728,7 +729,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument() // get selected mesh SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); + mySelectionMgr->selectedObjects(aList); int nbSel = aList.Extent(); if (nbSel < 1) diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.h b/src/SMESHGUI/SMESHGUI_TranslationDlg.h index 8b11e0f1e..4ee72ab04 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.h +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx b/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx index 25788102f..58b52c670 100644 --- a/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_TransparencyDlg.h b/src/SMESHGUI/SMESHGUI_TransparencyDlg.h index a7ddf88fb..91f13fc41 100644 --- a/src/SMESHGUI/SMESHGUI_TransparencyDlg.h +++ b/src/SMESHGUI/SMESHGUI_TransparencyDlg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Utils.cxx b/src/SMESHGUI/SMESHGUI_Utils.cxx index 563e740ad..d539ac8a0 100644 --- a/src/SMESHGUI/SMESHGUI_Utils.cxx +++ b/src/SMESHGUI/SMESHGUI_Utils.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_Utils.h b/src/SMESHGUI/SMESHGUI_Utils.h index 49a98c2d2..2cf9eaac2 100644 --- a/src/SMESHGUI/SMESHGUI_Utils.h +++ b/src/SMESHGUI/SMESHGUI_Utils.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index 4a72abca5..6b67d5e9c 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.h b/src/SMESHGUI/SMESHGUI_VTKUtils.h index c45edf22f..4fe56eef7 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.h +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESHGUI_XmlHandler.cxx b/src/SMESHGUI/SMESHGUI_XmlHandler.cxx index d2c18706b..b5c53d4b5 100644 --- a/src/SMESHGUI/SMESHGUI_XmlHandler.cxx +++ b/src/SMESHGUI/SMESHGUI_XmlHandler.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -69,8 +69,8 @@ bool SMESHGUI_XmlHandler::startDocument() Reimplemented from QXmlDefaultHandler. */ -bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, - const QString& qName, +bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, + const QString& qName, const QXmlAttributes& atts) { if (qName == "meshers") @@ -80,22 +80,22 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, } else if (qName == "meshers-group") // group of hypotheses and algorithms { -// if (atts.value("server-lib") != "") + // if (atts.value("server-lib") != "") { myPluginName = atts.value("name"); myServerLib = atts.value("server-lib"); myClientLib = atts.value("gui-lib"); -/* It's Need to tranlate lib name for WIN32 or X platform - * (only client lib, because server lib translates in SMESH_Gen_i::createHypothesis - * for normal work of *.py files ) - */ + /* It's Need to tranlate lib name for WIN32 or X platform + * (only client lib, because server lib translates in SMESH_Gen_i::createHypothesis + * for normal work of *.py files ) + */ if( !myClientLib.isEmpty() ) { #ifdef WIN32 - //myServerLib += ".dll"; + //myServerLib += ".dll"; myClientLib += ".dll"; #else - //myServerLib = "lib" + myServerLib + ".so"; + //myServerLib = "lib" + myServerLib + ".so"; myClientLib = "lib" + myClientLib + ".so"; #endif } @@ -123,9 +123,11 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, if (atts.value("type") != "") { QString aHypAlType = atts.value("type"); - QString aLabel = atts.value("label-id"); - QString anIcon = atts.value("icon-id"); - bool isAux = atts.value("auxiliary") == "true"; + QString aLabel = atts.value("label-id"); + QString anIcon = atts.value("icon-id"); + bool isAuxOrNeedHyp = ( qName == "hypothesis" ? + atts.value("auxiliary") == "true" : + atts.value("need-hyp" ) == "true" ); bool isNeedGeom = true, isSupportSubmeshes = false; QString aNeedGeom = atts.value("need-geom"); if ( !aNeedGeom.isEmpty() ) @@ -133,6 +135,11 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, QString suppSub = atts.value("support-submeshes"); if ( !suppSub.isEmpty() ) isSupportSubmeshes = (suppSub == "true"); + QString context = atts.value("context"); + if ( context.isEmpty() ) + context = "ANY"; + else + context = context.toUpper(); QString aDimStr = atts.value("dim"); aDimStr = aDimStr.remove( ' ' ); @@ -158,11 +165,11 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, attr[ i ] = aStr.split( ',', QString::SkipEmptyParts ); } } - + if ( !aHypAlType.contains( BAD_HYP_FLAG ) ) { HypothesisData* aHypData = new HypothesisData (aHypAlType, myPluginName, myServerLib, myClientLib, - aLabel, anIcon, aDim, isAux, + aLabel, anIcon, context, aDim, isAuxOrNeedHyp, attr[ HYPOS ], attr[ OPT_HYPOS ], attr[ INPUT ], attr[ OUTPUT ], isNeedGeom, isSupportSubmeshes ); @@ -189,9 +196,9 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, bool badSet = hypos.contains( BAD_HYP_FLAG ) || algos.contains( BAD_HYP_FLAG ); if ( !badSet ) - myListOfHypothesesSets.append( new HypothesesSet ( atts.value("name"), - hypos.split( ',', QString::SkipEmptyParts ), - algos.split( ',', QString::SkipEmptyParts ) ) ); + myListOfHypothesesSets.append( new HypothesesSet ( atts.value("name"), + hypos.split( ',', QString::SkipEmptyParts ), + algos.split( ',', QString::SkipEmptyParts ) ) ); } } else if ( qName == "python-wrap" || diff --git a/src/SMESHGUI/SMESHGUI_XmlHandler.h b/src/SMESHGUI/SMESHGUI_XmlHandler.h index 87b83e2bf..28203594c 100644 --- a/src/SMESHGUI/SMESHGUI_XmlHandler.h +++ b/src/SMESHGUI/SMESHGUI_XmlHandler.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESH_SMESHGUI.hxx b/src/SMESHGUI/SMESH_SMESHGUI.hxx index c94612f6e..0638b5995 100755 --- a/src/SMESHGUI/SMESH_SMESHGUI.hxx +++ b/src/SMESHGUI/SMESH_SMESHGUI.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index c985f167e..b27b101ca 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -151,6 +151,10 @@ ICON_DLG_MOVE_NODE mesh_move_node.png + + ICON_DLG_MOVE_WITHOUT_NODE + mesh_move_without_node.png + ICON_DLG_NODE mesh_vertex.png @@ -435,10 +439,14 @@ ICON_SMESH_DUPLICATE_NODES_WITH_ELEM mesh_duplicate_nodes_with_elem.png - + ICON_SMESH_DUPLICATE_ELEM_ONLY mesh_duplicate_elem_only.png + + ICON_SMESH_DUPLICATE_GROUP_BOUNDARY + mesh_duplicate_group_boundary.png + ICON_SMESH_TREE_ALGO mesh_tree_algo.png diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 174bcf165..9b320f8e4 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -1066,15 +1066,15 @@ MEN_SPLIT_TO_TETRA - Split into Tetrahedra + Split Volumes TOP_SPLIT_TO_TETRA - Split into Tetrahedra + Split Volumes STB_SPLIT_TO_TETRA - Split into Tetrahedra + Split Volumes MESHERS_FILE_CANT_OPEN @@ -2040,6 +2040,10 @@ Check algorithm documentation for supported geometry SMESH_MESHINFO_ORDER2 Quadratic + + SMESH_MESHINFO_ORDER3 + Bi-Quadratic + SMESH_MESHINFO_HEXAPRISM Hexagonal prisms @@ -4220,19 +4224,30 @@ It can't be deleted Sort child items + + SMESHGUI_FieldSelectorWdg + + FIELDS_TO_EXPORT + Export Fields + + SMESHGUI_Dialog DLG_MESH - meshes + mesh(s) DLG_HYPO - hypotheses + hypothesis(s) DLG_ALGO - algorithms + algorithm(s) + + + DLG_GEOM + object(s) @@ -4562,6 +4577,10 @@ Please, create VTK viewer and try again PREF_BALL_SIZE Size of ball elements + + PREF_BALL_SCALE + Scale factor of ball elements + PREF_WIDTH Line width @@ -5977,6 +5996,10 @@ Please specify them and try again MESH Mesh + + MESH_TYPE + Mesh type + NAME Name @@ -5998,10 +6021,15 @@ Please specify them and try again No sense in creating a submesh ignored by global algorithm "%1" - GEOMETRY_OBJECT_IS_NOT_DEFINED + GEOMETRY_OBJECT_IS_NOT_DEFINED_MESH Geometry object is not defined. Do you want to create an empty mesh without algorithms and hypotheses? + + + GEOMETRY_OBJECT_IS_NOT_DEFINED_SUBMESH + Geometry object is not defined. +Please specify it and try again GEOMETRY_OBJECT_IS_NULL @@ -6032,6 +6060,26 @@ Please specify it and try again MESH_IS_NULL Mesh is null + + MT_ANY + Any + + + MT_HEXAHEDRAL + Hexahedral + + + MT_TETRAHEDRAL + Tetrahedral + + + MT_TRIANGULAR + Triangular + + + MT_QUADRILATERAL + Quadrilateral + NAME_OF_MESH_IS_EMPTY Name of mesh is empty @@ -6047,6 +6095,14 @@ Please enter valid name and try again There is no object for editing. Please select mesh or sub-mesh and try again + + CONCURRENT_SUBMESH_APPEARS + +The assigned algorithm has the same priority as one assigned to an +adjacent sub-mesh, hence it's undefined which algorithm to use for +meshing boundary shared by two sub-meshes. Would you like to set +the order of sub-mesh computation? + SMESHGUI_MeshPatternDlg @@ -6209,6 +6265,14 @@ It is impossible to read point coordinates from file NONE <None> + + DEFAULT + <Default> + + + SELECT + <Select> + SMESHGUI_MultiEditDlg @@ -6254,10 +6318,10 @@ It is impossible to read point coordinates from file - SMESHGUI_CuttingIntoTetraDlg + SMESHGUI_SplitVolumesDlg CAPTION - Splitting volumes into tetrahedra + Splitting volumes SPLIT_METHOD @@ -6275,6 +6339,34 @@ It is impossible to read point coordinates from file SPLIT_HEX_TO_24_TETRA Into 24 tetrahedra + + SPLIT_HEX_TO_2_PRISMS + Into 2 prisms + + + SPLIT_HEX_TO_4_PRISMS + Into 4 Prisms + + + TARGET_ELEM_TYPE + Target element type + + + FACET_TO_SPLIT + Facet to split + + + START_POINT + Hexa location + + + FACET_NORMAL + Facet normal + + + ALL_DOMAINS + All domains + SMESHGUI_PrecisionDlg @@ -6668,6 +6760,10 @@ It is impossible to read point coordinates from file DUPLICATION_ONLY_ELEMS Duplicate elements only + + DUPLICATION_GROUP_BOUNDARY + Duplicate nodes on group boundaries + GROUP_ELEMS_TO_DUPLICATE Group of elements to duplicate @@ -6680,6 +6776,10 @@ It is impossible to read point coordinates from file GROUP_ELEMS_TO_REPLACE Group of elements to replace nodes with new ones + + GROUP_VOLUME_GROUPS + Groups of volumes + CONSTRUCT_NEW_GROUP_NODES Construct group with newly created nodes @@ -6688,6 +6788,14 @@ It is impossible to read point coordinates from file CONSTRUCT_NEW_GROUP_ELEMENTS Construct group with newly created elements + + CREATE_JOINT_ELEMENTS + Create joint elements + + + ON_ALL_BOUNDARIES + On all boundaries + SMESHGUI_Make2DFrom3DDlg @@ -6815,6 +6923,10 @@ as they are of improper type: QUADRATIC_LAB Quadratic + + BI_QUADRATIC_LAB + Bi-Quadratic + 0D_LAB 0D: @@ -7668,7 +7780,7 @@ as they are of improper type: Size: - ORIENTATION_SCALE + SCALE_FACTOR Scale: diff --git a/src/SMESHGUI/SMESH_msg_fr.ts b/src/SMESHGUI/SMESH_msg_fr.ts index 749b17e7e..3181afe3f 100755 --- a/src/SMESHGUI/SMESH_msg_fr.ts +++ b/src/SMESHGUI/SMESH_msg_fr.ts @@ -3,102 +3,6 @@ @default - - TB_ADD1D - Mesh Toolbar - - - TB_INFO - Information Toolbar - - - TB_GROUP - Group Toolbar - - - TB_MEASUREM - Measurements Toolbar - - - TB_CTRL3D - Volume Controls Toolbar - - - TB_CTRL2D - Face Controls Toolbar - - - TB_CTRL1D - Edge Controls Toolbar - - - TB_CTRL0D - Node Controls Toolbar - - - TB_TRANSFORM - Transformation Toolbar - - - TB_RENUMBER - Renumbering Toolbar - - - TB_REM - Remove Toolbar - - - TB_ADDNON - Add Non Linear Element Toolbar - - - TB_ADD - Add Element Toolbar - - - COMPERR_BAD_PARMETERS - Invalid input parameters - - - SMESH_GIGABYTE - %1 GB - - - SMESH_FREERAM - Free RAM - - - STB_BIQUADRATIC_TRIANGLE - BiQuadratic Triangle - - - TOP_BIQUADRATIC_TRIANGLE - BiQuadratic Triangle - - - MEN_BIQUADRATIC_TRIANGLE - BiQuadratic Triangle - - - SMESH_BIQUADRATIC_TRIANGLES - BiQuadratic Triangles - - - SMESH_BIQUADRATIC_TRIANGLE - BiQuadratic Triangle - - - SMESH_AUTO_DIM - Automatically define space dimension - - - SMESH_ADD_BIQUADRATIC_TRIANGLE_TITLE - Add BiQuadratic Triangle - - - COMPERR_WARNING - Warning - SMESH_EXPORT_MESH Exporter le maillage @@ -219,6 +123,10 @@ COMPERR_STD_EXCEPTION std::exception + + COMPERR_WARNING + Attention + COMPERR_UNKNOWN Erreur inconnue @@ -231,6 +139,10 @@ COMPERR_NO_MESH_ON_SHAPE Aucun élément n'est associé à une sous-shape + + COMPERR_BAD_PARMETERS + Paramètres d'entrée invalides + EDITERR_NO_MEDIUM_ON_GEOM Certain noeuds milieux (affichés en magenta) ne sont pas placés @@ -806,43 +718,43 @@ MEN_BASIC_PROPERTIES - Basic Properties + Propriétés basiques MEN_MEASURE_LENGTH - Length + Longueur STB_MEASURE_LENGTH - Calculate sum of length of all 1D elements of the selected object(s) + Calcul de la somme des longueurs de tous les éléments 1D des objets sélectionnés TOP_MEASURE_LENGTH - Length + Longueur MEN_MEASURE_AREA - Area + Surface STB_MEASURE_AREA - Calculate sum of area of all 2D elements of the selected object(s) + Calcul de la somme des surfaces de tous les éléments 2D des objets sélectionnés TOP_MEASURE_AREA - Area + Surface MEN_MEASURE_VOLUME - Volume + Volume STB_MEASURE_VOLUME - Calculate sum of volume of all 3D elements of the selected object(s) + Calcul de la somme des volumes de tous les éléments 3D des objets sélectionnés TOP_MEASURE_VOLUME - Volume + Volume MEN_MOVE @@ -962,7 +874,7 @@ MEN_OVERALL_MESH_QUALITY - Overall Mesh Quality + Qualité du maillage global MEN_DISTRIBUTION_CTRL @@ -1365,6 +1277,10 @@ Merci de les corriger, puis essayez de nouveau SMESH_ADD_QUADRATIC_TRIANGLE_TITLE Ajouter un triangle quadratique + + SMESH_ADD_BIQUADRATIC_TRIANGLE_TITLE + Ajouter un triangle biquadratique + SMESH_ADD_SUBMESH Construction d'un sous-maillage @@ -1401,6 +1317,10 @@ Merci de les corriger, puis essayez de nouveau SMESH_AUTO_GROUPS Créer les groupes automatiquement + + SMESH_AUTO_DIM + Définition automatique des dimensions spatiales + SMESH_REQUIRED_GROUPS Créer les groupes des types nécessaires @@ -2120,6 +2040,10 @@ Référez-vous à la documentation sur l'algorithme et la géométrie suppo SMESH_MESHINFO_ORDER2 Quadratique + + SMESH_MESHINFO_ORDER3 + Bi-Quadratic + SMESH_MESHINFO_HEXAPRISM Prismes hexagonaux @@ -2516,6 +2440,26 @@ Référez-vous à la documentation sur l'algorithme et la géométrie suppo STB_BIQUADRATIC_QUADRANGLE Quadrangle biquadratique + + SMESH_BIQUADRATIC_TRIANGLE + Triangle biquadratique + + + SMESH_BIQUADRATIC_TRIANGLES + Triangles biquadratiques + + + MEN_BIQUADRATIC_TRIANGLE + Triangle biquadratique + + + TOP_BIQUADRATIC_TRIANGLE + Triangle biquadratique + + + STB_BIQUADRATIC_TRIANGLE + Triangle biquadratique + SMESH_QUADRATIC_TETRAHEDRON Tétraèdre quadratique @@ -3478,12 +3422,44 @@ Utilisez le menu "Visualiser une entité" pour les afficher. Cône - TB_ADD_REMOVE - Ajouter/supprimer la barre d'outils + TB_ADD + Barre d'ajout d'éléments + + + TB_ADDNON + Barre d'ajout d'éléments non linéaires + + + TB_REM + Barre de suppression + + + TB_RENUMBER + Barre de renumérotation + + + TB_TRANSFORM + Barre des transformations + + + TB_CTRL0D + Barre des contrôles des nœuds + + + TB_CTRL1D + Barre des contrôles des arêtes + + + TB_CTRL2D + Barre des contrôles des faces - TB_CTRL - Barre d'outils des contrôles + TB_CTRL3D + Barre des contrôles des volumes + + + TB_MEASUREM + Barre des mesures TB_DISP_MODE @@ -3497,6 +3473,18 @@ Utilisez le menu "Visualiser une entité" pour les afficher. TB_MESH Barre de maillage + + TB_GROUP + Barre des groupes + + + TB_INFO + Barre d'information + + + TB_ADD1D + Barre de maillage + TB_MODIFY Barre des modifications @@ -4087,7 +4075,7 @@ Utilisez le menu "Visualiser une entité" pour les afficher. UPDATE_DESTINATION - Update Destination + Mettre à jour la destination VOLUME_3D_ELEMENTS @@ -4220,13 +4208,21 @@ avec le paramètre '%1' des préférences du module Mesh.L'objet sélectionné a été utilisé pour en créer un autre. Il ne peut pas être supprimé. + + SMESH_FREERAM + RAM libre + + + SMESH_GIGABYTE + %1 GB + MEN_SORT_CHILD_ITEMS - Sort children + Trier les enfants STB_SORT_CHILD_ITEMS - Sort child items + Trier les items enfants @@ -4246,10 +4242,6 @@ Il ne peut pas être supprimé. SMESHGUI - - PREF_PREVIEW_COLOR - Preview color - NOT_A_VTK_VIEWER Cette commande n'est disponible qu'à partir d'une fenêtre VTK. @@ -4293,7 +4285,7 @@ Ouvrez une fenêtre VTK et essayez de nouveau PREF_INCREMENTAL_LIMIT - Incremental limit check + Vérification de la limite incrémentale PREF_BACKFACE @@ -4363,6 +4355,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau PREF_FILL Remplir + + PREF_PREVIEW_COLOR + Couleur de prévisualisation + PREF_NOTIFY_MODE Montrer la notification sur le résultat de calcul @@ -4409,7 +4405,7 @@ Ouvrez une fenêtre VTK et essayez de nouveau PREF_DUMP_CTRL_INFO - Dump controls information + Copier les informations des contrôles PREF_GPP_NODES_LIMIT @@ -4417,7 +4413,7 @@ Ouvrez une fenêtre VTK et essayez de nouveau PREF_CTRL_LIMIT - Automatic controls compute limit + Contrôle automatique des limites du calcul SMESH_PREF_GROUP_PRECISION @@ -4571,6 +4567,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau PREF_BALL_SIZE Taille des éléments particulaires + + PREF_BALL_SCALE + Facteur d'échelle des éléments particulaires + PREF_WIDTH Epaisseur de ligne @@ -4615,10 +4615,6 @@ Ouvrez une fenêtre VTK et essayez de nouveau SMESHGUI_AddQuadraticElementDlg - - SMESH_ADD_BIQUADRATIC_TRIANGLE - Add BiQuadratic Triangle - SMESH_ADD_QUADRATIC_EDGE Ajouter une arête quadratique @@ -4655,6 +4651,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau SMESH_ADD_QUADRATIC_TRIANGLE Ajouter un triangle quadratique + + SMESH_ADD_BIQUADRATIC_TRIANGLE + Ajouter un triangle biquadratique + SMESH_CORNER_NODES Nœuds angulaires: @@ -4728,10 +4728,6 @@ Ouvrez une fenêtre VTK et essayez de nouveau SMESHGUI_ComputeDlg - - GROUP_OF_BAD_MESH - Bad Mesh to Group - CAPTION Le calcul du maillage a échoué @@ -4768,6 +4764,25 @@ Ouvrez une fenêtre VTK et essayez de nouveau SHOW_BAD_MESH Montrer le maillage incorrect + + GROUP_OF_BAD_MESH + Grouper les mauvais éléments + + + + SMESHGUI_ComputeDlg_QThreadQDialog + + CANCEL + Annuler + + + CANCELING + Annulation... + + + TITLE + Calcul + SMESHGUI_PrecomputeDlg @@ -4951,14 +4966,14 @@ Vérifiez l'espace de disque disponible et vos droits d'écriture dans SMESHGUI_CuttingOfQuadsDlg - - TO_4_TRIA - Cut into 4 triangles - CAPTION Découpe des quadrangles + + TO_4_TRIA + Découpe en 4 triangles + SMESHGUI_DeleteGroupDlg @@ -5000,11 +5015,11 @@ Choisissez un groupe et essayez de nouveau SHOW_NODES_IDS - Show double nodes IDs + Afficher les IDs des nœuds doubles SHOW_ELEMS_IDS - Show double elements IDs + Afficher les IDs des éléments doubles EXCLUDE_GROUPS @@ -5324,22 +5339,6 @@ Vérifiez la validité des informations données SMESHGUI_FilterTable - - ENTITY_TYPE_24 - BALL - - - ENTITY_TYPE_23 - QPOLYEDRE - - - ENTITY_TYPE_1 - POINT1 - - - CONNECTED_ELEMS - Elements of a domain - ADD Ajouter @@ -5420,6 +5419,10 @@ Vérifiez la validité des informations données COPLANAR_FACES Faces coplanaires + + CONNECTED_ELEMS + Eléments d'un domaine + NUMBEROFNODESINELEMENT Nombre de noeuds dans l'élément @@ -5597,6 +5600,10 @@ Entrez une valeur correcte et essayez de nouveau ENTITY_TYPE_0 + NONE + + + ENTITY_TYPE_1 POINT1 @@ -5617,70 +5624,78 @@ Entrez une valeur correcte et essayez de nouveau ENTITY_TYPE_6 - QUAD4 + TRIA7 ENTITY_TYPE_7 - QUAD8 + QUAD4 ENTITY_TYPE_8 - QUAD9 + QUAD8 ENTITY_TYPE_9 - TETRA4 + QUAD9 ENTITY_TYPE_10 - TETRA10 + POLYGON ENTITY_TYPE_11 - PYRA5 + QPOLYGON ENTITY_TYPE_12 - PYRA13 + TETRA4 ENTITY_TYPE_13 - PENTA6 + TETRA10 ENTITY_TYPE_14 - PENTA15 + PYRA5 ENTITY_TYPE_15 - HEXA8 + PYRA13 ENTITY_TYPE_16 - HEXA20 + HEXA8 ENTITY_TYPE_17 - HEXA27 + HEXA20 ENTITY_TYPE_18 - OCTA12 + HEXA27 ENTITY_TYPE_19 - POLYGONE + PENTA6 ENTITY_TYPE_20 - POLYEDRE + PENTA15 ENTITY_TYPE_21 - NONE + OCTA12 ENTITY_TYPE_22 + POLYEDRE + + + ENTITY_TYPE_23 + QPOLYEDRE + + + ENTITY_TYPE_24 BALL @@ -5971,6 +5986,10 @@ Indiquez-les et essayez de nouveau MESH Maillage + + MESH_TYPE + Type de maillage + NAME Nom @@ -5993,9 +6012,9 @@ Voulez-vous éditer ce sous-maillage? GEOMETRY_OBJECT_IS_NOT_DEFINED - Geometry object is not defined. -Do you want to create an empty mesh -without algorithms and hypotheses? + La géométrie n'est pas définie. +Voulez-vous créer un maillage vide +sans algorithme ni hypothèse ? GEOMETRY_OBJECT_IS_NULL @@ -6026,6 +6045,26 @@ Spécifiez-le et essayez de nouveau MESH_IS_NULL Le maillage est nul + + MT_ANY + Tout type + + + MT_HEXAHEDRAL + Hexahèdre + + + MT_TETRAHEDRAL + Tetrahèdre + + + MT_TRIANGULAR + Triangulaire + + + MT_QUADRILATERAL + Quadrilatères + NAME_OF_MESH_IS_EMPTY Le nom du maillage est vide @@ -6619,14 +6658,6 @@ Il y a trop peu de points dans le fichier RELATIVE Relative - - RESET - Réinitialiser - - - INVERT - Inverser - BASE_POINT Le point fondamental @@ -6635,13 +6666,17 @@ Il y a trop peu de points dans le fichier DIRECTION Direction + + RESET + Réinitialiser + + + INVERT + Inverser + SMESHGUI_DuplicateNodesDlg - - DUPLICATION_ONLY_ELEMS - Duplicate elements only - DUPLICATION_MODE Mode de duplication @@ -6662,6 +6697,10 @@ Il y a trop peu de points dans le fichier DUPLICATION_WITH_ELEMS Avec duplication des éléments de frontière + + DUPLICATION_ONLY_ELEMS + Avec duplication des éléments de frontière seulement + GROUP_ELEMS_TO_DUPLICATE Groupe des éléments à dupliquer @@ -6809,6 +6848,10 @@ en raison de leurs types incompatibles: QUADRATIC_LAB Quadratique + + BI_QUADRATIC_LAB + Bi-Quadratic + 0D_LAB 0D: @@ -6918,15 +6961,15 @@ en raison de leurs types incompatibles: ELEM_INFO - Infos sur les éléments + Informations sur les éléments ADDITIONAL_INFO - Infos détaillées + Informations détaillées CTRL_INFO - Quality Info + Informations sur la qualité NODE_MODE @@ -7298,90 +7341,90 @@ en raison de leurs types incompatibles: SMESHGUI_CtrlInfo CTRL_INFO - Quality information + Informations sur la qualité NAME_LAB - Name: + Nom: VALUE - Value + Valeur BUT_COMPUTE - Compute + Calculer NODES_INFO - Nodes Information: + Informations des nœuds: NUMBER_OF_THE_FREE_NODES - Number of the free nodes - - - NUMBER_OF_THE_DOUBLE_NODES - Number of the double nodes + Nombre de nœuds libres DOUBLE_NODES_TOLERANCE Tolérance des nœuds doubles + + NUMBER_OF_THE_DOUBLE_NODES + Nombre de nœuds doubles + EDGES_INFO - Edges Information: + Informations des arêtes: NUMBER_OF_THE_DOUBLE_EDGES - Number of the double edges + Nombre d'arêtes doubles FACES_INFO - Faces Information: + Informations des faces: NUMBER_OF_THE_DOUBLE_FACES - Number of the double faces + Nombre de faces doubles ASPECT_RATIO_HISTOGRAM - Aspect Ratio histogram + Histogramme du rapport de forme VOLUMES_INFO - Volumes Information: + Informations des volumes: NUMBER_OF_THE_DOUBLE_VOLUMES - Number of the double volumes + Nombre de volumes doubles NUMBER_OF_THE_OVER_CONSTRAINED - Number of the over-constrained + Nombre de sur-contraintes ASPECT_RATIO_3D_HISTOGRAM - Aspect Ratio 3D histogram + Histogramme du rapport de forme 3D SMESHGUI_CtrlInfoDlg - SAVE_INFO - Save info + CTRL_INFO + Informations sur la qualité - TEXT_FILES - Text files (*.txt) + BUT_DUMP_MESH + &Dumper - BUT_DUMP_MESH - &Dump + TEXT_FILES + Fichiers texte (*.txt) - CTRL_INFO - Quality Info + SAVE_INFO + Sauvegarder les informations @@ -7427,27 +7470,27 @@ en raison de leurs types incompatibles: SMESHGUI_BasicProperties PROPERTY - Property + Propriété LENGTH - Length + Longueur AREA - Area + Surface VOLUME - Volume + Volume SOURCE_MESH_SUBMESH_GROUP - Source (mesh, sub-mesh or group) + Source (maillage, sous-maillage ou groupe) COMPUTE - Compute + Calculer @@ -7481,7 +7524,7 @@ en raison de leurs types incompatibles: BASIC_PROPERTIES - Basic Properties + Propriétés basiques @@ -7662,7 +7705,7 @@ en raison de leurs types incompatibles: Taille: - ORIENTATION_SCALE + SCALE_FACTOR Echelle: @@ -7674,19 +7717,4 @@ en raison de leurs types incompatibles: Coef de réduction: - - SMESHGUI_ComputeDlg_QThreadQDialog - - TITLE - Compute - - - CANCELING - Canceling... - - - CANCEL - Cancel - - diff --git a/src/SMESHGUI/SMESH_msg_ja.ts b/src/SMESHGUI/SMESH_msg_ja.ts index f5e88adb6..8350a23d7 100644 --- a/src/SMESHGUI/SMESH_msg_ja.ts +++ b/src/SMESHGUI/SMESH_msg_ja.ts @@ -2011,6 +2011,10 @@ SMESH_MESHINFO_ORDER2 二次 + + SMESH_MESHINFO_ORDER3 + Bi-Quadratic + SMESH_MESHINFO_HEXAPRISM 六角形プリズム @@ -6718,6 +6722,10 @@ QUADRATIC_LAB 二次 + + BI_QUADRATIC_LAB + Bi-Quadratic + 0D_LAB 0D: @@ -7571,7 +7579,7 @@ サイズ - ORIENTATION_SCALE + SCALE_FACTOR スケール: diff --git a/src/SMESHUtils/CMakeLists.txt b/src/SMESHUtils/CMakeLists.txt index ecdc716c0..5261c5d7f 100644 --- a/src/SMESHUtils/CMakeLists.txt +++ b/src/SMESHUtils/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -42,6 +42,7 @@ SET(_link_LIBRARIES ${CAS_TKG3d} ${CAS_TKGeomBase} ${CAS_TKGeomAlgo} + ${Boost_LIBRARIES} SMESHDS ) diff --git a/src/SMESHUtils/SMESH_Block.cxx b/src/SMESHUtils/SMESH_Block.cxx index 7d2ed2a71..472061d24 100644 --- a/src/SMESHUtils/SMESH_Block.cxx +++ b/src/SMESHUtils/SMESH_Block.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -26,6 +26,11 @@ // #include "SMESH_Block.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshVolume.hxx" +#include "SMDS_VolumeTool.hxx" +#include "SMESH_MeshAlgos.hxx" + #include #include #include @@ -56,10 +61,7 @@ #include #include -#include "SMDS_MeshNode.hxx" -#include "SMDS_MeshVolume.hxx" -#include "SMDS_VolumeTool.hxx" -#include "utilities.h" +#include #include #include @@ -309,24 +311,15 @@ gp_XYZ SMESH_Block::TFace::Point( const gp_XYZ& theParams ) const namespace { + inline bool isPntInTria( const gp_XY& p, const gp_XY& t0, const gp_XY& t1, const gp_XY& t2 ) { - const double // matrix 2x2 - T11 = t0.X()-t2.X(), T12 = t1.X()-t2.X(), - T21 = t0.Y()-t2.Y(), T22 = t1.Y()-t2.Y(); - const double Tdet = T11*T22 - T12*T21; // matrix determinant - if ( Abs( Tdet ) < std::numeric_limits::min() ) - return false; - // matrix inverse - const double t11 = T22, t12 = -T12, t21 = -T21, t22 = T11; - // vector - const double r11 = p.X()-t2.X(), r12 = p.Y()-t2.Y(); - // barycentric coordinates: mutiply matrix by vector - const double bc0 = (t11 * r11 + t12 * r12)/Tdet; - const double bc1 = (t21 * r11 + t22 * r12)/Tdet; + double bc0, bc1; + SMESH_MeshAlgos::GetBarycentricCoords( p, t0, t1, t2, bc0, bc1 ); return ( bc0 >= 0. && bc1 >= 0. && bc0 + bc1 <= 1. ); } + inline bool isPntInQuad( const gp_XY& p, const gp_XY& q0, const gp_XY& q1, const gp_XY& q2, const gp_XY& q3 ) { diff --git a/src/SMESHUtils/SMESH_Block.hxx b/src/SMESHUtils/SMESH_Block.hxx index a2fcd0a1a..47de73b39 100644 --- a/src/SMESHUtils/SMESH_Block.hxx +++ b/src/SMESHUtils/SMESH_Block.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -68,20 +68,19 @@ class SMESHUtils_EXPORT SMESH_Block: public math_FunctionSetWithDerivatives // ---------------------------- ID_NONE = 0, - ID_V000 = 1, ID_V100, ID_V010, ID_V110, ID_V001, ID_V101, ID_V011, ID_V111, + ID_V000 = 1, ID_V100, ID_V010, ID_V110, ID_V001, ID_V101, ID_V011, ID_V111, // 1-8 - ID_Ex00, ID_Ex10, ID_Ex01, ID_Ex11, - ID_E0y0, ID_E1y0, ID_E0y1, ID_E1y1, - ID_E00z, ID_E10z, ID_E01z, ID_E11z, + ID_Ex00, ID_Ex10, ID_Ex01, ID_Ex11, // 9-12 + ID_E0y0, ID_E1y0, ID_E0y1, ID_E1y1, // 13-16 + ID_E00z, ID_E10z, ID_E01z, ID_E11z, // 17-20 - ID_Fxy0, ID_Fxy1, ID_Fx0z, ID_Fx1z, ID_F0yz, ID_F1yz, + ID_Fxy0, ID_Fxy1, ID_Fx0z, ID_Fx1z, ID_F0yz, ID_F1yz, // 21-26 - ID_Shell - }; - enum { // to use TShapeID for indexing certain type subshapes + ID_Shell, // 27 - ID_FirstV = ID_V000, ID_FirstE = ID_Ex00, ID_FirstF = ID_Fxy0 + // to use TShapeID for indexing certain type subshapes + ID_FirstV = ID_V000, ID_FirstE = ID_Ex00, ID_FirstF = ID_Fxy0 }; @@ -285,7 +284,7 @@ public: std::list< int > & theNbEdgesInWires, TopoDS_Vertex theFirstVertex=TopoDS_Vertex(), const bool theShapeAnalysisAlgo=false); - // Return nb wires and a list of oredered edges. + // Return nb wires and a list of ordered edges. // It is used to assign indices to subshapes. // theFirstVertex may be NULL. // Always try to set a seam edge first diff --git a/src/SMESHUtils/SMESH_Comment.hxx b/src/SMESHUtils/SMESH_Comment.hxx index 415171743..8e8db16d1 100644 --- a/src/SMESHUtils/SMESH_Comment.hxx +++ b/src/SMESHUtils/SMESH_Comment.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHUtils/SMESH_ComputeError.hxx b/src/SMESHUtils/SMESH_ComputeError.hxx index 07d1a9088..68a867870 100644 --- a/src/SMESHUtils/SMESH_ComputeError.hxx +++ b/src/SMESHUtils/SMESH_ComputeError.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -111,6 +111,7 @@ std::string SMESH_ComputeError::CommonName() const _case2char(COMPERR_WARNING ); _case2char(COMPERR_CANCELED ); _case2char(COMPERR_NO_MESH_ON_SHAPE); + _case2char(COMPERR_BAD_PARMETERS ); default:; } return ""; diff --git a/src/SMESHUtils/SMESH_File.cxx b/src/SMESHUtils/SMESH_File.cxx index 79bbfbc8a..d75cd108a 100644 --- a/src/SMESHUtils/SMESH_File.cxx +++ b/src/SMESHUtils/SMESH_File.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,14 +21,8 @@ // Created : Wed Mar 10 11:23:25 2010 // Author : Edward AGAPOV (eap) // -#include "SMESH_File.hxx" -#include "utilities.h" -#include -#include -#include -#include -#include +#include "SMESH_File.hxx" #include #include @@ -40,6 +34,10 @@ #include #endif +#include + +namespace boofs = boost::filesystem; + //================================================================================ /*! * \brief Creator opening the file for reading by default @@ -133,6 +131,16 @@ void SMESH_File::close() _pos = _end = 0; _size = -1; } + else if ( _file >= 0 ) + { +#ifdef WIN32 + CloseHandle(_file); + _file = INVALID_HANDLE_VALUE; +#else + ::close(_file); + _file = -1; +#endif + } } //================================================================================ @@ -144,15 +152,12 @@ void SMESH_File::close() bool SMESH_File::remove() { close(); - try { - OSD_Path filePath(TCollection_AsciiString((char*)_name.data())); - OSD_File(filePath).Remove(); - } - catch ( Standard_ProgramError ) { - MESSAGE("Can't remove file: " << _name << " ; file does not exist or permission denied"); - return false; - } - return true; + + boost::system::error_code err; + boofs::remove( _name, err ); + _error = err.message(); + + return !err; } //================================================================================ @@ -161,21 +166,45 @@ bool SMESH_File::remove() */ //================================================================================ -int SMESH_File::size() const +long SMESH_File::size() { - if ( _size >= 0 ) return _size; // size of open file + if ( _size >= 0 ) return _size; // size of an open file - int size = -1; - int file = ::open( _name.data(), O_RDONLY ); - if ( file > 0 ) - { - struct stat status; - int err = fstat( file, &status); - if ( !err ) - size = status.st_size; - ::close( file ); - } - return size; + boost::system::error_code err; + boost::uintmax_t size = boofs::file_size( _name, err ); + _error = err.message(); + + return err ? -1 : (long) size; +} + +//================================================================================ +/*! + * \brief Check existence + */ +//================================================================================ + +bool SMESH_File::exists() +{ + boost::system::error_code err; + bool res = boofs::exists( _name, err ); + _error = err.message(); + + return err ? false : res; +} + +//================================================================================ +/*! + * \brief Check existence + */ +//================================================================================ + +bool SMESH_File::isDirectory() +{ + boost::system::error_code err; + bool res = boofs::is_directory( _name, err ); + _error = err.message(); + + return err ? false : res; } //================================================================================ @@ -238,3 +267,56 @@ bool SMESH_File::getInts(std::vector& ints) } return ( i == ints.size() ); } + +//================================================================================ +/*! + * \brief Open for binary writing only. + */ +//================================================================================ + +bool SMESH_File::openForWriting() +{ +#ifdef WIN32 + + _file = CreateFile( _name.c_str(), // name of the write + GENERIC_WRITE, // open for writing + 0, // do not share + NULL, // default security + OPEN_ALWAYS, // CREATE NEW or OPEN EXISTING + FILE_ATTRIBUTE_NORMAL, // normal file + NULL); // no attr. template + return ( _file != INVALID_HANDLE_VALUE ); + +#else + + _file = ::open( _name.c_str(), + O_WRONLY | O_CREAT, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ); // rw-r--r-- + return _file >= 0; + +#endif +} + +//================================================================================ +/*! + * \brief Write binary data + */ +//================================================================================ + +bool SMESH_File::writeRaw(const void* data, size_t size) +{ +#ifdef WIN32 + + DWORD nbWritten = 0; + BOOL err = WriteFile( _file, data, size, & nbWritten, NULL); + + return (( err == FALSE ) && + ( nbWritten == (DWORD) size )); + +#else + + ssize_t nbWritten = ::write( _file, data, size ); + return ( nbWritten == size ); + +#endif +} diff --git a/src/SMESHUtils/SMESH_File.hxx b/src/SMESHUtils/SMESH_File.hxx index 9625c0339..0e7ccca52 100644 --- a/src/SMESHUtils/SMESH_File.hxx +++ b/src/SMESHUtils/SMESH_File.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -42,24 +42,30 @@ class SMESHUtils_EXPORT SMESH_File { public: - SMESH_File(const std::string& name, bool open=true); + SMESH_File(const std::string& name, bool openForReading=true); ~SMESH_File(); std::string getName() const { return _name; } - bool open(); + const std::string& error() const { return _error; } void close(); bool remove(); - int size() const; + long size(); + + bool exists(); + + bool isDirectory(); // ------------------------ // Access to file contents // ------------------------ + bool open(); // for reading + operator const char*() const { return _pos; } bool operator++() { return ++_pos < _end; } @@ -68,6 +74,8 @@ public: bool eof() const { return _pos >= _end; } + const char* end() const { return _end; } + const char* getPos() const { return _pos; } void setPos(const char* pos); @@ -78,10 +86,31 @@ public: bool getInts(std::vector& ids); + // ------------------------ + // Writting a binary file + // ------------------------ + + bool openForWriting(); // binary writing only + + template + bool write( const T* values, size_t nbTValues ) + { + return writeRaw((const void*) values, nbTValues * sizeof(T)); + } + + template + bool write( const T& value ) + { + return writeRaw((const void*) & value, sizeof(T)); + } + + bool writeRaw(const void* data, size_t size); + private: std::string _name; //!< file name int _size; //!< file size + std::string _error; #ifdef WIN32 HANDLE _file, _mapObj; #else diff --git a/src/SMESHUtils/SMESH_MeshAlgos.cxx b/src/SMESHUtils/SMESH_MeshAlgos.cxx index 45acf33b1..957828474 100644 --- a/src/SMESHUtils/SMESH_MeshAlgos.cxx +++ b/src/SMESHUtils/SMESH_MeshAlgos.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,9 +28,11 @@ #include "SMESH_MeshAlgos.hxx" +#include "SMDS_FaceOfNodes.hxx" #include "SMDS_LinearEdge.hxx" -#include "SMDS_VolumeTool.hxx" #include "SMDS_Mesh.hxx" +#include "SMDS_PolygonalFaceOfNodes.hxx" +#include "SMDS_VolumeTool.hxx" #include "SMESH_OctreeNode.hxx" #include @@ -743,7 +745,7 @@ SMESH_ElementSearcherImpl::FindClosestTo( const gp_Pnt& point, { const SMDS_MeshElement* closestElem = 0; - if ( type == SMDSAbs_Face ) + if ( type == SMDSAbs_Face || type == SMDSAbs_Volume ) { if ( !_ebbTree || _elementType != type ) { @@ -757,10 +759,10 @@ SMESH_ElementSearcherImpl::FindClosestTo( const gp_Pnt& point, { gp_Pnt boxCenter = 0.5 * ( _ebbTree->getBox()->CornerMin() + _ebbTree->getBox()->CornerMax() ); - double radius; + double radius = -1; if ( _ebbTree->getBox()->IsOut( point.XYZ() )) radius = point.Distance( boxCenter ) - 0.5 * _ebbTree->maxSize(); - else + if ( radius < 0 ) radius = _ebbTree->maxSize() / pow( 2., _ebbTree->getHeight()) / 2; while ( suspectElems.empty() ) { @@ -773,8 +775,7 @@ SMESH_ElementSearcherImpl::FindClosestTo( const gp_Pnt& point, TIDSortedElemSet::iterator elem = suspectElems.begin(); for ( ; elem != suspectElems.end(); ++elem ) { - double dist = SMESH_MeshAlgos::GetDistance( dynamic_cast(*elem), - point ); + double dist = SMESH_MeshAlgos::GetDistance( *elem, point ); if ( dist < minDist + 1e-10) { minDist = dist; @@ -1290,6 +1291,31 @@ namespace } } +//======================================================================= +/*! + * \brief Return minimal distance from a point to an element + * + * Currently we ignore non-planarity and 2nd order of face + */ +//======================================================================= + +double SMESH_MeshAlgos::GetDistance( const SMDS_MeshElement* elem, + const gp_Pnt& point ) +{ + switch ( elem->GetType() ) + { + case SMDSAbs_Volume: + return GetDistance( dynamic_cast( elem ), point); + case SMDSAbs_Face: + return GetDistance( dynamic_cast( elem ), point); + case SMDSAbs_Edge: + return GetDistance( dynamic_cast( elem ), point); + case SMDSAbs_Node: + return point.Distance( SMESH_TNodeXYZ( elem )); + } + return -1; +} + //======================================================================= /*! * \brief Return minimal distance from a point to a face @@ -1386,6 +1412,101 @@ double SMESH_MeshAlgos::GetDistance( const SMDS_MeshFace* face, return badDistance; } +//======================================================================= +/*! + * \brief Return minimal distance from a point to an edge + */ +//======================================================================= + +double SMESH_MeshAlgos::GetDistance( const SMDS_MeshEdge* edge, const gp_Pnt& point ) +{ + throw SALOME_Exception(LOCALIZED("not implemented so far")); +} + +//======================================================================= +/*! + * \brief Return minimal distance from a point to a volume + * + * Currently we ignore non-planarity and 2nd order + */ +//======================================================================= + +double SMESH_MeshAlgos::GetDistance( const SMDS_MeshVolume* volume, const gp_Pnt& point ) +{ + SMDS_VolumeTool vTool( volume ); + vTool.SetExternalNormal(); + const int iQ = volume->IsQuadratic() ? 2 : 1; + + double n[3], bc[3]; + double minDist = 1e100, dist; + for ( int iF = 0; iF < vTool.NbFaces(); ++iF ) + { + // skip a facet with normal not "looking at" the point + if ( !vTool.GetFaceNormal( iF, n[0], n[1], n[2] ) || + !vTool.GetFaceBaryCenter( iF, bc[0], bc[1], bc[2] )) + continue; + gp_XYZ bcp = point.XYZ() - gp_XYZ( bc[0], bc[1], bc[2] ); + if ( gp_XYZ( n[0], n[1], n[2] ) * bcp < 1e-6 ) + continue; + + // find distance to a facet + const SMDS_MeshNode** nodes = vTool.GetFaceNodes( iF ); + switch ( vTool.NbFaceNodes( iF ) / iQ ) { + case 3: + { + SMDS_FaceOfNodes tmpFace( nodes[0], nodes[ 1*iQ ], nodes[ 2*iQ ] ); + dist = GetDistance( &tmpFace, point ); + break; + } + case 4: + { + SMDS_FaceOfNodes tmpFace( nodes[0], nodes[ 1*iQ ], nodes[ 2*iQ ], nodes[ 3*iQ ]); + dist = GetDistance( &tmpFace, point ); + break; + } + default: + vector nvec( nodes, nodes + vTool.NbFaceNodes( iF )); + SMDS_PolygonalFaceOfNodes tmpFace( nvec ); + dist = GetDistance( &tmpFace, point ); + } + minDist = Min( minDist, dist ); + } + return minDist; +} + +//================================================================================ +/*! + * \brief Returns barycentric coordinates of a point within a triangle. + * A not returned bc2 = 1. - bc0 - bc1. + * The point lies within the triangle if ( bc0 >= 0 && bc1 >= 0 && bc0+bc1 <= 1 ) + */ +//================================================================================ + +void SMESH_MeshAlgos::GetBarycentricCoords( const gp_XY& p, + const gp_XY& t0, + const gp_XY& t1, + const gp_XY& t2, + double & bc0, + double & bc1) +{ + const double // matrix 2x2 + T11 = t0.X()-t2.X(), T12 = t1.X()-t2.X(), + T21 = t0.Y()-t2.Y(), T22 = t1.Y()-t2.Y(); + const double Tdet = T11*T22 - T12*T21; // matrix determinant + if ( Abs( Tdet ) < std::numeric_limits::min() ) + { + bc0 = bc1 = 2.; + return; + } + // matrix inverse + const double t11 = T22, t12 = -T12, t21 = -T21, t22 = T11; + // vector + const double r11 = p.X()-t2.X(), r12 = p.Y()-t2.Y(); + // barycentric coordinates: mutiply matrix by vector + bc0 = (t11 * r11 + t12 * r12)/Tdet; + bc1 = (t21 * r11 + t22 * r12)/Tdet; +} + //======================================================================= //function : FindFaceInSet //purpose : Return a face having linked nodes n1 and n2 and which is diff --git a/src/SMESHUtils/SMESH_MeshAlgos.hxx b/src/SMESHUtils/SMESH_MeshAlgos.hxx index a02ba10dd..f1604572b 100644 --- a/src/SMESHUtils/SMESH_MeshAlgos.hxx +++ b/src/SMESHUtils/SMESH_MeshAlgos.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -97,9 +97,25 @@ namespace SMESH_MeshAlgos /*! * \brief Return true if the point is IN or ON of the element */ - SMESHUtils_EXPORT bool IsOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol ); + SMESHUtils_EXPORT + bool IsOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol ); - SMESHUtils_EXPORT double GetDistance( const SMDS_MeshFace* face, const gp_Pnt& point ); + SMESHUtils_EXPORT + double GetDistance( const SMDS_MeshElement* elem, const gp_Pnt& point ); + + SMESHUtils_EXPORT + double GetDistance( const SMDS_MeshEdge* edge, const gp_Pnt& point ); + + SMESHUtils_EXPORT + double GetDistance( const SMDS_MeshFace* face, const gp_Pnt& point ); + + SMESHUtils_EXPORT + double GetDistance( const SMDS_MeshVolume* volume, const gp_Pnt& point ); + + SMESHUtils_EXPORT + void GetBarycentricCoords( const gp_XY& point, + const gp_XY& t0, const gp_XY& t1, const gp_XY& t2, + double & bc0, double & bc1); /*! * Return a face having linked nodes n1 and n2 and which is @@ -107,35 +123,40 @@ namespace SMESH_MeshAlgos * - in elemSet provided that !elemSet.empty() * i1 and i2 optionally returns indices of n1 and n2 */ - SMESHUtils_EXPORT const SMDS_MeshElement* - FindFaceInSet(const SMDS_MeshNode* n1, - const SMDS_MeshNode* n2, - const TIDSortedElemSet& elemSet, - const TIDSortedElemSet& avoidSet, - int* i1=0, - int* i2=0); + SMESHUtils_EXPORT + const SMDS_MeshElement* FindFaceInSet(const SMDS_MeshNode* n1, + const SMDS_MeshNode* n2, + const TIDSortedElemSet& elemSet, + const TIDSortedElemSet& avoidSet, + int* i1=0, + int* i2=0); /*! * \brief Calculate normal of a mesh face */ - SMESHUtils_EXPORT bool FaceNormal(const SMDS_MeshElement* F, gp_XYZ& normal, bool normalized=true); + SMESHUtils_EXPORT + bool FaceNormal(const SMDS_MeshElement* F, gp_XYZ& normal, bool normalized=true); /*! * \brief Return nodes common to two elements */ - SMESHUtils_EXPORT std::vector< const SMDS_MeshNode*> GetCommonNodes(const SMDS_MeshElement* e1, + SMESHUtils_EXPORT + std::vector< const SMDS_MeshNode*> GetCommonNodes(const SMDS_MeshElement* e1, const SMDS_MeshElement* e2); /*! * \brief Return SMESH_NodeSearcher. The caller is responsible for deleteing it */ - SMESHUtils_EXPORT SMESH_NodeSearcher* GetNodeSearcher( SMDS_Mesh& mesh ); + SMESHUtils_EXPORT + SMESH_NodeSearcher* GetNodeSearcher( SMDS_Mesh& mesh ); /*! * \brief Return SMESH_ElementSearcher. The caller is responsible for deleting it */ - SMESHUtils_EXPORT SMESH_ElementSearcher* GetElementSearcher( SMDS_Mesh& mesh ); - SMESHUtils_EXPORT SMESH_ElementSearcher* GetElementSearcher( SMDS_Mesh& mesh, - SMDS_ElemIteratorPtr elemIt ); + SMESHUtils_EXPORT + SMESH_ElementSearcher* GetElementSearcher( SMDS_Mesh& mesh ); + SMESHUtils_EXPORT + SMESH_ElementSearcher* GetElementSearcher( SMDS_Mesh& mesh, + SMDS_ElemIteratorPtr elemIt ); } #endif diff --git a/src/SMESHUtils/SMESH_Octree.cxx b/src/SMESHUtils/SMESH_Octree.cxx index 483fcf37a..45ceb21b3 100644 --- a/src/SMESHUtils/SMESH_Octree.cxx +++ b/src/SMESHUtils/SMESH_Octree.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHUtils/SMESH_Octree.hxx b/src/SMESHUtils/SMESH_Octree.hxx index ebcc8dd64..df25fd573 100644 --- a/src/SMESHUtils/SMESH_Octree.hxx +++ b/src/SMESHUtils/SMESH_Octree.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHUtils/SMESH_OctreeNode.cxx b/src/SMESHUtils/SMESH_OctreeNode.cxx index 95353575f..1c85e0469 100644 --- a/src/SMESHUtils/SMESH_OctreeNode.cxx +++ b/src/SMESHUtils/SMESH_OctreeNode.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -222,6 +222,7 @@ bool SMESH_OctreeNode::NodesAround(const gp_XYZ &node, } else if ( NbNodes() > 0 ) { + size_t nbFoundBefore = dist2Nodes.size(); double minDist = precision * precision; gp_Pnt p1 ( node.X(), node.Y(), node.Z() ); TIDSortedNodeSet::iterator nIt = myNodes.begin(); @@ -235,7 +236,7 @@ bool SMESH_OctreeNode::NodesAround(const gp_XYZ &node, // if ( dist2Nodes.size() > 1 ) // leave only closest node in dist2Nodes // dist2Nodes.erase( ++dist2Nodes.begin(), dist2Nodes.end()); - return ( sqrt( minDist) <= precision * 1e-12 ); + return ( nbFoundBefore < dist2Nodes.size() ); } } return false; diff --git a/src/SMESHUtils/SMESH_OctreeNode.hxx b/src/SMESHUtils/SMESH_OctreeNode.hxx index a4bd31846..dac8766ba 100644 --- a/src/SMESHUtils/SMESH_OctreeNode.hxx +++ b/src/SMESHUtils/SMESH_OctreeNode.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHUtils/SMESH_Quadtree.cxx b/src/SMESHUtils/SMESH_Quadtree.cxx index 041d0f696..c57243043 100644 --- a/src/SMESHUtils/SMESH_Quadtree.cxx +++ b/src/SMESHUtils/SMESH_Quadtree.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHUtils/SMESH_Quadtree.hxx b/src/SMESHUtils/SMESH_Quadtree.hxx index 1afb599f3..59ede255d 100644 --- a/src/SMESHUtils/SMESH_Quadtree.hxx +++ b/src/SMESHUtils/SMESH_Quadtree.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHUtils/SMESH_Tree.hxx b/src/SMESHUtils/SMESH_Tree.hxx index cb821ce71..4c0e16a7e 100644 --- a/src/SMESHUtils/SMESH_Tree.hxx +++ b/src/SMESHUtils/SMESH_Tree.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHUtils/SMESH_TryCatch.cxx b/src/SMESHUtils/SMESH_TryCatch.cxx index 486ec24ad..eaac4e60d 100644 --- a/src/SMESHUtils/SMESH_TryCatch.cxx +++ b/src/SMESHUtils/SMESH_TryCatch.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHUtils/SMESH_TryCatch.hxx b/src/SMESHUtils/SMESH_TryCatch.hxx index 6a9d53621..00fbcef58 100644 --- a/src/SMESHUtils/SMESH_TryCatch.hxx +++ b/src/SMESHUtils/SMESH_TryCatch.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESHUtils/SMESH_TypeDefs.hxx b/src/SMESHUtils/SMESH_TypeDefs.hxx index 2555cc371..2d116bf9c 100644 --- a/src/SMESHUtils/SMESH_TypeDefs.hxx +++ b/src/SMESHUtils/SMESH_TypeDefs.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,9 +29,10 @@ #include "SMESH_Utils.hxx" -#include +#include "SMDS_MeshNode.hxx" #include +#include #include #include @@ -42,7 +43,7 @@ typedef std::map, TIDCompare > TElemOfElemListMap; typedef std::map, TIDCompare > TElemOfNodeListMap; -typedef std::map TNodeNodeMap; +typedef std::map TNodeNodeMap; //!< Set of elements sorted by ID, to be used to assure predictability of edition typedef std::set< const SMDS_MeshElement*, TIDCompare > TIDSortedElemSet; @@ -50,8 +51,8 @@ typedef std::set< const SMDS_MeshNode*, TIDCompare > TIDSortedNodeSet; typedef std::pair< const SMDS_MeshNode*, const SMDS_MeshNode* > NLink; -struct faceQuadStruct; // defined in StdMeshers_Quadrangle_2D.hxx -typedef boost::shared_ptr TFaceQuadStructPtr; +struct FaceQuadStruct; // defined in StdMeshers_Quadrangle_2D.hxx +typedef boost::shared_ptr TFaceQuadStructPtr; namespace SMESHUtils @@ -71,6 +72,30 @@ namespace SMESHUtils TVECTOR v2( vec ); vec.swap( v2 ); } + /*! + * \brief Auto pointer + */ + template + struct Deleter + { + TOBJ* _obj; + Deleter( TOBJ* obj ): _obj( obj ) {} + ~Deleter() { delete _obj; _obj = 0; } + private: + Deleter( const Deleter& ); + }; + /*! + * \brief Auto pointer to array + */ + template + struct ArrayDeleter + { + TOBJ* _obj; + ArrayDeleter( TOBJ* obj ): _obj( obj ) {} + ~ArrayDeleter() { delete [] _obj; _obj = 0; } + private: + ArrayDeleter( const ArrayDeleter& ); + }; } //======================================================================= @@ -137,6 +162,10 @@ typedef struct uvPtStruct double x, y; // 2d parameter, normalized [0,1] const SMDS_MeshNode * node; + uvPtStruct(): node(NULL) {} + + inline gp_XY UV() const { return gp_XY( u, v ); } + struct NodeAccessor // accessor to iterate on nodes in UVPtStructVec { static const SMDS_MeshNode* value(std::vector< uvPtStruct >::const_iterator it) @@ -166,46 +195,4 @@ DEFINE_BASECOLLECTION (SMESH_BaseCollectionNodePtr, SMDS_MeshNodePtr) DEFINE_SEQUENCE(SMESH_SequenceOfNode, SMESH_BaseCollectionNodePtr, SMDS_MeshNodePtr) -// -------------------------------------------------------------------------------- -// #include "SMESHDS_DataMapOfShape.hxx" - -// #include - -// #include - -/// Class SMESH_IndexedMapOfShape - -// DEFINE_BASECOLLECTION (SMESH_BaseCollectionShape, TopoDS_Shape) -// DEFINE_INDEXEDMAP (SMESH_IndexedMapOfShape, SMESH_BaseCollectionShape, TopoDS_Shape) - -/// Class SMESH_IndexedDataMapOfShapeIndexedMapOfShape - -// DEFINE_BASECOLLECTION (SMESH_BaseCollectionIndexedMapOfShape, SMESH_IndexedMapOfShape) -// DEFINE_INDEXEDDATAMAP (SMESH_IndexedDataMapOfShapeIndexedMapOfShape, -// SMESH_BaseCollectionIndexedMapOfShape, TopoDS_Shape, -// SMESH_IndexedMapOfShape) - -// -------------------------------------------------------------------------------- -// class SMESH_DataMapOfElemPtrSequenceOfElemPtr - -// SMESHUtils_EXPORT -// inline Standard_Integer HashCode(SMDS_MeshElementPtr theElem, -// const Standard_Integer theUpper) -// { -// void* anElem = (void*) theElem; -// return HashCode(anElem,theUpper); -// } - -// SMESHUtils_EXPORT -// inline Standard_Boolean IsEqual(SMDS_MeshElementPtr theOne, -// SMDS_MeshElementPtr theTwo) -// { -// return theOne == theTwo; -// } - -// DEFINE_BASECOLLECTION (SMESH_BaseCollectionSequenceOfElemPtr, SMESH_SequenceOfElemPtr) -// DEFINE_DATAMAP (SMESH_DataMapOfElemPtrSequenceOfElemPtr, -// SMESH_BaseCollectionSequenceOfElemPtr, -// SMDS_MeshElementPtr, SMESH_SequenceOfElemPtr) - #endif diff --git a/src/SMESHUtils/SMESH_Utils.hxx b/src/SMESHUtils/SMESH_Utils.hxx index 815c1c435..88a6a9305 100755 --- a/src/SMESHUtils/SMESH_Utils.hxx +++ b/src/SMESHUtils/SMESH_Utils.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/CMakeLists.txt b/src/SMESH_I/CMakeLists.txt index 7eaa07cf3..3643f0928 100644 --- a/src/SMESH_I/CMakeLists.txt +++ b/src/SMESH_I/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -80,6 +80,7 @@ SET(_link_LIBRARIES SMDS SMESHDS SMESHControls + MeshDriverMED ) # --- headers --- diff --git a/src/SMESH_I/SMESH.hxx b/src/SMESH_I/SMESH.hxx index 4565eb8b7..bd2a48bec 100644 --- a/src/SMESH_I/SMESH.hxx +++ b/src/SMESH_I/SMESH.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_0D_Algo_i.cxx b/src/SMESH_I/SMESH_0D_Algo_i.cxx index 55ef49645..a97a169cc 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_0D_Algo_i.hxx b/src/SMESH_I/SMESH_0D_Algo_i.hxx index e0c9017c5..c401cd258 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_1D_Algo_i.cxx b/src/SMESH_I/SMESH_1D_Algo_i.cxx index b433eb9e1..7f7d1a4c3 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_1D_Algo_i.hxx b/src/SMESH_I/SMESH_1D_Algo_i.hxx index f7b2f6b28..107187977 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_2D_Algo_i.cxx b/src/SMESH_I/SMESH_2D_Algo_i.cxx index 36114f9c3..92cb289b6 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_2D_Algo_i.hxx b/src/SMESH_I/SMESH_2D_Algo_i.hxx index f527b7dc9..da442b4c1 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 929da0dcf..f5595c08a 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -372,7 +372,7 @@ namespace { */ //================================================================================ - void StructToList( Handle( _pyCommand)& theCommand ) + void StructToList( Handle( _pyCommand)& theCommand, const bool checkMethod=true ) { static TStringSet methodsAcceptingList; if ( methodsAcceptingList.empty() ) { @@ -386,11 +386,11 @@ namespace { "ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups", "Translate","TranslateMakeGroups","TranslateMakeMesh", "TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh", - "ExtrusionAlongPathX","ExtrusionAlongPathObjX" + "ExtrusionAlongPathX","ExtrusionAlongPathObjX","SplitHexahedraIntoPrisms" ,"" }; // <- mark of the end methodsAcceptingList.Insert( methodNames ); } - if ( methodsAcceptingList.Contains( theCommand->GetMethod() )) + if ( !checkMethod || methodsAcceptingList.Contains( theCommand->GetMethod() )) { for ( int i = theCommand->GetNbArgs(); i > 0; --i ) { @@ -1963,9 +1963,9 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand ) TCollection_AsciiString newMethod = method; newMethod.Remove( 7, 6 ); theCommand->SetMethod( newMethod ); - // make the 1st arg be the last one (or last but one for ExportMED()) + // make the 1st arg be the last one (or last but three for ExportMED()) _pyID partID = theCommand->GetArg( 1 ); - int nbArgs = theCommand->GetNbArgs() - (newMethod == "ExportMED"); + int nbArgs = theCommand->GetNbArgs() - 3 * (newMethod == "ExportMED"); for ( int i = 2; i <= nbArgs; ++i ) theCommand->SetArg( i-1, theCommand->GetArg( i )); theCommand->SetArg( nbArgs, partID ); @@ -2075,6 +2075,7 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand ) "GetSubMeshElementsId","GetSubMeshNodesId","GetSubMeshElementType","Dump","GetNodeXYZ", "GetNodeInverseElements","GetShapeID","GetShapeIDForElem","GetElemNbNodes", "GetElemNode","IsMediumNode","IsMediumNodeOfAnyElem","ElemNbEdges","ElemNbFaces", + "GetElemFaceNodes", "GetFaceNormal", "FindElementByNodes", "IsPoly","IsQuadratic","BaryCenter","GetHypothesisList", "SetAutoColor", "GetAutoColor", "Clear", "ConvertToStandalone", "GetMeshOrder", "SetMeshOrder" ,"" }; // <- mark of end @@ -2375,7 +2376,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) "GetLastCreatedElems", "MirrorMakeMesh","MirrorObjectMakeMesh","TranslateMakeMesh","TranslateObjectMakeMesh", "Scale","ScaleMakeMesh","RotateMakeMesh","RotateObjectMakeMesh","MakeBoundaryMesh", - "MakeBoundaryElements", "SplitVolumesIntoTetra", + "MakeBoundaryElements", "SplitVolumesIntoTetra","SplitHexahedraIntoPrisms", "DoubleElements","DoubleNodes","DoubleNode","DoubleNodeGroup","DoubleNodeGroups", "DoubleNodeElem","DoubleNodeElemInRegion","DoubleNodeElemGroup", "DoubleNodeElemGroupInRegion","DoubleNodeElemGroups","DoubleNodeElemGroupsInRegion", @@ -2631,6 +2632,8 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th hyp->SetConvMethodAndType( "SetGrid", "Cartesian_3D"); for ( int iArg = 0; iArg < 4; ++iArg ) hyp->setCreationArg( iArg+1, "[]"); + hyp->AddAccumulativeMethod( "SetGrid" ); + hyp->AddAccumulativeMethod( "SetGridSpacing" ); } else { @@ -3089,9 +3092,11 @@ void _pyComplexParamHypo::Process( const Handle(_pyCommand)& theCommand) { // CartesianParameters3D hyp - if ( theCommand->GetMethod() == "SetSizeThreshold" ) + if ( theCommand->GetMethod() == "SetSizeThreshold" || + theCommand->GetMethod() == "SetToAddEdges" ) { - setCreationArg( 4, theCommand->GetArg( 1 )); + int iEdges = ( theCommand->GetMethod().Value( 4 ) == 'T' ); + setCreationArg( 4+iEdges, theCommand->GetArg( 1 )); myArgCommands.push_back( theCommand ); return; } @@ -3113,7 +3118,9 @@ void _pyComplexParamHypo::Process( const Handle(_pyCommand)& theCommand) myCurCrMethod->myArgs[ iArg ] += "]"; } myArgCommands.push_back( theCommand ); - rememberCmdOfParameter( theCommand ); + //rememberCmdOfParameter( theCommand ); -- these commands are marked as + // accumulative, else, if the creation + // is not converted, commands for axes 1 and 2 are lost return; } } @@ -3154,13 +3161,23 @@ void _pyComplexParamHypo::Flush() for ( ; cmd != myUnusedCommands.end(); ++cmd ) if ((*cmd)->GetMethod() == "SetObjectEntry" ) (*cmd)->Clear(); + + if ( GetAlgoType() == "Cartesian_3D" ) + { + _pyID algo = myCreationCmd->GetObject(); + for ( cmd = myProcessedCmds.begin(); cmd != myProcessedCmds.end(); ++cmd ) + { + StructToList( *cmd, /*checkMethod=*/false ); + (*cmd)->SetObject( algo ); + } + } } } //================================================================================ /*! * \brief Convert methods of 1D hypotheses to my own methods - * \param theCommand - The called hypothesis method + * \param theCommand - The called hypothesis method */ //================================================================================ diff --git a/src/SMESH_I/SMESH_2smeshpy.hxx b/src/SMESH_I/SMESH_2smeshpy.hxx index 9008d0a56..4e6531dde 100644 --- a/src/SMESH_I/SMESH_2smeshpy.hxx +++ b/src/SMESH_I/SMESH_2smeshpy.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_3D_Algo_i.cxx b/src/SMESH_I/SMESH_3D_Algo_i.cxx index 07fe7b4db..178d906c8 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_3D_Algo_i.hxx b/src/SMESH_I/SMESH_3D_Algo_i.hxx index d47bdade8..a18bbab1b 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_Algo_i.cxx b/src/SMESH_I/SMESH_Algo_i.cxx index df7276aad..3001b7650 100644 --- a/src/SMESH_I/SMESH_Algo_i.cxx +++ b/src/SMESH_I/SMESH_Algo_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_Algo_i.hxx b/src/SMESH_I/SMESH_Algo_i.hxx index 357e12ef0..70f041860 100644 --- a/src/SMESH_I/SMESH_Algo_i.hxx +++ b/src/SMESH_I/SMESH_Algo_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx index 43ffd029b..494722b8a 100644 --- a/src/SMESH_I/SMESH_DumpPython.cxx +++ b/src/SMESH_I/SMESH_DumpPython.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -240,13 +240,20 @@ namespace SMESH template void DumpArray(const TArray& theArray, TPythonDump & theStream) { - theStream << "[ "; - for (int i = 1; i <= theArray.length(); i++) { - theStream << theArray[i-1]; - if ( i < theArray.length() ) - theStream << ", "; + if ( theArray.length() == 0 ) + { + theStream << "[]"; + } + else + { + theStream << "[ "; + for (int i = 1; i <= theArray.length(); i++) { + theStream << theArray[i-1]; + if ( i < theArray.length() ) + theStream << ", "; + } + theStream << " ]"; } - theStream << " ]"; } TPythonDump& @@ -263,6 +270,13 @@ namespace SMESH return *this; } + TPythonDump& + TPythonDump::operator<<(const SMESH::nodes_array& theArg) + { + DumpArray( theArg, *this ); + return *this; + } + TPythonDump& TPythonDump::operator<<(const SMESH::string_array& theArray) { @@ -517,6 +531,16 @@ namespace SMESH DumpArray( *theList, *this ); return *this; } + TPythonDump& TPythonDump::operator<<(const GEOM::ListOfGO& theList) + { + DumpArray( theList, *this ); + return *this; + } + TPythonDump& TPythonDump::operator<<(const GEOM::ListOfGBO& theList) + { + DumpArray( theList, *this ); + return *this; + } TPythonDump& TPythonDump::operator<<(const SMESH::ListOfIDSources& theList) { DumpArray( theList, *this ); diff --git a/src/SMESH_I/SMESH_Filter_i.cxx b/src/SMESH_I/SMESH_Filter_i.cxx index 5ccc12bff..351a0f268 100644 --- a/src/SMESH_I/SMESH_Filter_i.cxx +++ b/src/SMESH_I/SMESH_Filter_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_Filter_i.hxx b/src/SMESH_I/SMESH_Filter_i.hxx index 87684f257..92c4618df 100644 --- a/src/SMESH_I/SMESH_Filter_i.hxx +++ b/src/SMESH_I/SMESH_Filter_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 5bcf88bda..718d2bc94 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -93,7 +93,7 @@ #include "SMESH_Mesh_i.hxx" #include "SMESH_PreMeshInfo.hxx" #include "SMESH_PythonDump.hxx" -//#include "memoire.h" +#include "SMESH_TryCatch.hxx" // to include after OCC headers! #include CORBA_SERVER_HEADER(SMESH_Group) #include CORBA_SERVER_HEADER(SMESH_Filter) @@ -355,20 +355,20 @@ SMESH_Gen_i::~SMESH_Gen_i() if ( myShapeReader ) delete myShapeReader; } - //============================================================================= /*! - * SMESH_Gen_i::createHypothesis + * SMESH_Gen_i::getHypothesisCreator * - * Create hypothesis of given type + * Get hypothesis creator */ //============================================================================= -SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName, - const char* theLibName) +GenericHypothesisCreator_i* SMESH_Gen_i::getHypothesisCreator(const char* theHypName, + const char* theLibName, + std::string& thePlatformLibName) throw (SALOME::SALOME_Exception) { - /* It's Need to tranlate lib name for WIN32 or X platform */ std::string aPlatformLibName; + /* It's Need to tranlate lib name for WIN32 or X platform */ if ( theLibName && theLibName[0] != '\0' ) { int libNameLen = strlen(theLibName); @@ -395,14 +395,13 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName #endif } } + thePlatformLibName = aPlatformLibName; Unexpect aCatch(SALOME_SalomeException); if(MYDEBUG) MESSAGE( "Create Hypothesis <" << theHypName << "> from " << aPlatformLibName); - // create a new hypothesis object servant - SMESH_Hypothesis_i* myHypothesis_i = 0; - SMESH::SMESH_Hypothesis_var hypothesis_i; - + typedef GenericHypothesisCreator_i* (*GetHypothesisCreator)(const char* ); + GenericHypothesisCreator_i* aCreator; try { // check, if creator for this hypothesis type already exists @@ -424,7 +423,6 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName // get method, returning hypothesis creator if(MYDEBUG) MESSAGE("Find GetHypothesisCreator() method ..."); - typedef GenericHypothesisCreator_i* (*GetHypothesisCreator)(const char* theHypName); GetHypothesisCreator procHandle = (GetHypothesisCreator)GetProc( libHandle, "GetHypothesisCreator" ); if (!procHandle) @@ -435,26 +433,47 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName // get hypothesis creator if(MYDEBUG) MESSAGE("Get Hypothesis Creator for " << theHypName); - GenericHypothesisCreator_i* aCreator = procHandle(theHypName); + aCreator = procHandle(theHypName); if (!aCreator) { throw(SALOME_Exception(LOCALIZED("no such a hypothesis in this plugin"))); } - // map hypothesis creator to a hypothesis name myHypCreatorMap[string(theHypName)] = aCreator; + return aCreator; + } + else + { + return myHypCreatorMap[string(theHypName)]; } - - // create a new hypothesis object, store its ref. in studyContext - if(MYDEBUG) MESSAGE("Create Hypothesis " << theHypName); - myHypothesis_i = - myHypCreatorMap[string(theHypName)]->Create(myPoa, GetCurrentStudyID(), &myGen); - myHypothesis_i->SetLibName(aPlatformLibName.c_str()); // for persistency assurance } catch (SALOME_Exception& S_ex) { THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); } + return aCreator; +} + +//============================================================================= +/*! + * SMESH_Gen_i::createHypothesis + * + * Create hypothesis of given type + */ +//============================================================================= +SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName, + const char* theLibName) +{ + SMESH_Hypothesis_i* myHypothesis_i = 0; + SMESH::SMESH_Hypothesis_var hypothesis_i; + std::string aPlatformLibName; + typedef GenericHypothesisCreator_i* (*GetHypothesisCreator)(const char* ); + GenericHypothesisCreator_i* aCreator = getHypothesisCreator(theHypName, theLibName, aPlatformLibName); + // create a new hypothesis object, store its ref. in studyContext + if(MYDEBUG) MESSAGE("Create Hypothesis " << theHypName); + myHypothesis_i = + myHypCreatorMap[string(theHypName)]->Create(myPoa, GetCurrentStudyID(), &myGen); + myHypothesis_i->SetLibName(aPlatformLibName.c_str()); // for persistency assurance if (!myHypothesis_i) return hypothesis_i._retn(); @@ -621,7 +640,7 @@ void SMESH_Gen_i::setCurrentStudy( SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_wrap so = anIter->Value(); CORBA::Object_var ior = SObjectToObject( so ); if ( SMESH_Mesh_i* mesh = SMESH::DownCast( ior )) - mesh->CheckGeomGroupModif(); + mesh->CheckGeomModif(); } } } @@ -1723,7 +1742,7 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh, ASSERT( meshServant ); if ( meshServant ) { // NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation" - meshServant->CheckGeomGroupModif(); + meshServant->CheckGeomModif(); // get local TopoDS_Shape TopoDS_Shape myLocShape; if(theMesh->HasShapeToMesh()) @@ -1805,7 +1824,7 @@ SMESH::MeshPreviewStruct* SMESH_Gen_i::Precompute( SMESH::SMESH_Mesh_ptr theMesh ASSERT( meshServant ); if ( meshServant ) { // NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation" - meshServant->CheckGeomGroupModif(); + meshServant->CheckGeomModif(); // get local TopoDS_Shape TopoDS_Shape myLocShape; if(theMesh->HasShapeToMesh()) @@ -2001,7 +2020,7 @@ SMESH::long_array* SMESH_Gen_i::Evaluate(SMESH::SMESH_Mesh_ptr theMesh, ASSERT( meshServant ); if ( meshServant ) { // NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation" - meshServant->CheckGeomGroupModif(); + meshServant->CheckGeomModif(); // get local TopoDS_Shape TopoDS_Shape myLocShape; if(theMesh->HasShapeToMesh()) @@ -2635,6 +2654,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CopyMesh(SMESH::SMESH_IDSource_ptr meshPart, SMESH::array_of_ElementType_var srcElemTypes = meshPart->GetTypes(); if ( SMESH::DownCast( meshPart )) { + srcMesh_i->Load(); srcElemIt = srcMeshDS->elementsIterator(); srcNodeIt = srcMeshDS->nodesIterator(); } @@ -2701,10 +2721,15 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CopyMesh(SMESH::SMESH_IDSource_ptr meshPart, const SMDS_MeshElement * newElem; switch ( elem->GetEntityType() ) { case SMDSEntity_Polyhedra: - newElem = editor.GetMeshDS()-> - AddPolyhedralVolumeWithID( nodes, - static_cast(elem)->GetQuantities(), - ID); + if ( toKeepIDs ) + newElem = editor.GetMeshDS()-> + AddPolyhedralVolumeWithID( nodes, + static_cast(elem)->GetQuantities(), + ID); + else + newElem = editor.GetMeshDS()-> + AddPolyhedralVolume( nodes, + static_cast(elem)->GetQuantities()); break; case SMDSEntity_Ball: newElem = editor.AddElement( nodes, SMDSAbs_Ball, false, ID, @@ -5042,13 +5067,42 @@ void SMESH_Gen_i::Move( const SMESH::sobject_list& what, useCaseBuilder->AppendTo( where, sobj ); // append to the end of list } } +//================================================================================= +// function : IsApplicable +// purpose : Return true if algorithm can be applied +//================================================================================= +CORBA::Boolean SMESH_Gen_i::IsApplicable ( const char* theAlgoType, + const char* theLibName, + GEOM::GEOM_Object_ptr theGeomObject, + CORBA::Boolean toCheckAll) +{ + SMESH_TRY; + + std::string aPlatformLibName; + typedef GenericHypothesisCreator_i* (*GetHypothesisCreator)(const char*); + GenericHypothesisCreator_i* aCreator = getHypothesisCreator(theAlgoType, theLibName, aPlatformLibName); + if (aCreator) + { + TopoDS_Shape shape = GeomObjectToShape( theGeomObject ); + if ( !shape.IsNull() ) + return aCreator->IsApplicable( shape, toCheckAll ); + } + else + { + return false; + } + + SMESH_CATCH( SMESH::doNothing ); + return true; +} //================================================================================= // function : importData // purpose : imports mesh data file (the med one) into the SMESH internal data structure //================================================================================= -Engines::ListOfIdentifiers* SMESH_Gen_i::importData( - CORBA::Long studyId, Engines::DataContainer_ptr data, const Engines::ListOfOptions& options) +Engines::ListOfIdentifiers* SMESH_Gen_i::importData(CORBA::Long studyId, + Engines::DataContainer_ptr data, + const Engines::ListOfOptions& options) { Engines::ListOfIdentifiers_var aResultIds = new Engines::ListOfIdentifiers; list aResultList; diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index 6b134e51f..3405a8375 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -595,13 +595,20 @@ public: void Move( const SMESH::sobject_list& what, SALOMEDS::SObject_ptr where, CORBA::Long row ); + CORBA::Boolean IsApplicable ( const char* theAlgoType, + const char* theLibName, + GEOM::GEOM_Object_ptr theShapeObject, + CORBA::Boolean toCheckAll); private: + // Get hypothesis creator + GenericHypothesisCreator_i* getHypothesisCreator( const char* theHypName, + const char* theLibName, + std::string& thePlatformLibName) + throw ( SALOME::SALOME_Exception ); // Create hypothesis of given type SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName, - const char* theLibName) - throw ( SALOME::SALOME_Exception ); - + const char* theLibName); // Create empty mesh on shape SMESH::SMESH_Mesh_ptr createMesh() throw ( SALOME::SALOME_Exception ); diff --git a/src/SMESH_I/SMESH_Gen_i_1.cxx b/src/SMESH_I/SMESH_Gen_i_1.cxx index a3bc17331..f155ae93d 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_Group_i.cxx b/src/SMESH_I/SMESH_Group_i.cxx index 76dae4673..ebdd1052c 100644 --- a/src/SMESH_I/SMESH_Group_i.cxx +++ b/src/SMESH_I/SMESH_Group_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -411,9 +411,9 @@ CORBA::Long SMESH_Group_i::AddFrom( SMESH::SMESH_IDSource_ptr theSource ) long prevNb = Size(); SMESHDS_Group* aGroupDS = dynamic_cast( GetGroupDS() ); if (aGroupDS) { - SMDS_ElemIteratorPtr elemIt = SMESH_Mesh_i::GetElements( theSource, GetType() ); - while ( elemIt->more() ) - aGroupDS->SMDSGroup().Add( elemIt->next() ); + if ( SMDS_ElemIteratorPtr elemIt = SMESH_Mesh_i::GetElements( theSource, GetType() )) + while ( elemIt->more() ) + aGroupDS->SMDSGroup().Add( elemIt->next() ); } // Update Python script diff --git a/src/SMESH_I/SMESH_Group_i.hxx b/src/SMESH_I/SMESH_Group_i.hxx index 152abd53c..f08e51b24 100644 --- a/src/SMESH_I/SMESH_Group_i.hxx +++ b/src/SMESH_I/SMESH_Group_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_Hypothesis_i.cxx b/src/SMESH_I/SMESH_Hypothesis_i.cxx index c1b5c956a..ceac6085e 100644 --- a/src/SMESH_I/SMESH_Hypothesis_i.cxx +++ b/src/SMESH_I/SMESH_Hypothesis_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_Hypothesis_i.hxx b/src/SMESH_I/SMESH_Hypothesis_i.hxx index 835131af0..5cc8e54d9 100644 --- a/src/SMESH_I/SMESH_Hypothesis_i.hxx +++ b/src/SMESH_I/SMESH_Hypothesis_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -134,6 +134,7 @@ public: ::SMESH_Gen* theGenImpl) = 0; // return the name of IDL module virtual std::string GetModuleName() = 0; + virtual bool IsApplicable( const TopoDS_Shape &S, bool toCheckAll ) {return true;} }; //============================================================================= diff --git a/src/SMESH_I/SMESH_Measurements_i.cxx b/src/SMESH_I/SMESH_Measurements_i.cxx index 5107e5b2b..d0de81b91 100644 --- a/src/SMESH_I/SMESH_Measurements_i.cxx +++ b/src/SMESH_I/SMESH_Measurements_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_Measurements_i.hxx b/src/SMESH_I/SMESH_Measurements_i.hxx index f7135ae44..127017c5a 100644 --- a/src/SMESH_I/SMESH_Measurements_i.hxx +++ b/src/SMESH_I/SMESH_Measurements_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 69bf34ec1..9de57c975 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -1999,13 +1999,15 @@ void SMESH_MeshEditor_i::SplitVolumesIntoTetra (SMESH::SMESH_IDSource_ptr elems, { SMESH_TRY; initData(); - prepareIdSource( elems ); - SMESH::long_array_var anElementsId = elems->GetIDs(); - TIDSortedElemSet elemSet; - arrayToSet( anElementsId, getMeshDS(), elemSet, SMDSAbs_Volume ); - getEditor().SplitVolumesIntoTetra( elemSet, int( methodFlags )); + ::SMESH_MeshEditor::TFacetOfElem elemSet; + const int noneFacet = -1; + SMDS_ElemIteratorPtr volIt = myMesh_i->GetElements( elems, SMESH::VOLUME ); + while( volIt->more() ) + elemSet.insert( elemSet.end(), make_pair( volIt->next(), noneFacet )); + + getEditor().SplitVolumes( elemSet, int( methodFlags )); declareMeshModified( /*isReComputeSafe=*/true ); // it does not influence Compute() TPythonDump() << this << ".SplitVolumesIntoTetra( " @@ -2014,6 +2016,70 @@ void SMESH_MeshEditor_i::SplitVolumesIntoTetra (SMESH::SMESH_IDSource_ptr elems, SMESH_CATCH( SMESH::throwCorbaException ); } +//================================================================================ +/*! + * \brief Split hexahedra into triangular prisms + * \param elems - elements to split + * \param facetToSplitNormal - normal used to find a facet of hexahedron + * to split into triangles + * \param methodFlags - flags passing splitting method: + * 1 - split the hexahedron into 2 prisms + * 2 - split the hexahedron into 4 prisms + */ +//================================================================================ + +void SMESH_MeshEditor_i::SplitHexahedraIntoPrisms (SMESH::SMESH_IDSource_ptr elems, + const SMESH::PointStruct & startHexPoint, + const SMESH::DirStruct& facetToSplitNormal, + CORBA::Short methodFlags, + CORBA::Boolean allDomains) + throw (SALOME::SALOME_Exception) +{ + SMESH_TRY; + initData(); + prepareIdSource( elems ); + + gp_Ax1 facetNorm( gp_Pnt( startHexPoint.x, + startHexPoint.y, + startHexPoint.z ), + gp_Dir( facetToSplitNormal.PS.x, + facetToSplitNormal.PS.y, + facetToSplitNormal.PS.z )); + TIDSortedElemSet elemSet; + SMESH::long_array_var anElementsId = elems->GetIDs(); + SMDS_MeshElement::GeomFilter filter( SMDSGeom_HEXA ); + arrayToSet( anElementsId, getMeshDS(), elemSet, SMDSAbs_Volume, &filter ); + + ::SMESH_MeshEditor::TFacetOfElem elemFacets; + while ( !elemSet.empty() ) + { + getEditor().GetHexaFacetsToSplit( elemSet, facetNorm, elemFacets ); + if ( !allDomains ) + break; + + ::SMESH_MeshEditor::TFacetOfElem::iterator ef = elemFacets.begin(); + for ( ; ef != elemFacets.end(); ++ef ) + elemSet.erase( ef->first ); + } + + if ( methodFlags == 2 ) + methodFlags = int( ::SMESH_MeshEditor::HEXA_TO_4_PRISMS ); + else + methodFlags = int( ::SMESH_MeshEditor::HEXA_TO_2_PRISMS ); + + getEditor().SplitVolumes( elemFacets, int( methodFlags )); + declareMeshModified( /*isReComputeSafe=*/true ); // it does not influence Compute() + + TPythonDump() << this << ".SplitHexahedraIntoPrisms( " + << elems << ", " + << startHexPoint << ", " + << facetToSplitNormal<< ", " + << methodFlags<< ", " + << allDomains << " )"; + + SMESH_CATCH( SMESH::throwCorbaException ); +} + //======================================================================= //function : Smooth //purpose : @@ -5187,13 +5253,6 @@ SMESH::long_array* SMESH_MeshEditor_i::FindElementsByPoint(CORBA::Double x, for ( int i = 0; i < foundElems.size(); ++i ) res[i] = foundElems[i]->GetID(); - if ( !myIsPreviewMode ) // call from tui - TPythonDump() << "res = " << this << ".FindElementsByPoint( " - << x << ", " - << y << ", " - << z << ", " - << type << " )"; - return res._retn(); SMESH_CATCH( SMESH::throwCorbaException ); @@ -5255,14 +5314,6 @@ SMESH_MeshEditor_i::FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elementID for ( int i = 0; i < foundElems.size(); ++i ) res[i] = foundElems[i]->GetID(); - if ( !myIsPreviewMode ) // call from tui - TPythonDump() << "res = " << this << ".FindAmongElementsByPoint( " - << elementIDs << ", " - << x << ", " - << y << ", " - << z << ", " - << type << " )"; - return res._retn(); SMESH_CATCH( SMESH::throwCorbaException ); @@ -6824,18 +6875,21 @@ CORBA::Boolean SMESH_MeshEditor_i::Make2DMeshFrom3D() * If there is no shared faces between the group #n and the group #p in the list, the group j_n_p is not created. * All the flat elements are gathered into the group named "joints3D" (or "joints2D" in 2D situation). * The flat element of the multiple junctions between the simple junction are stored in a group named "jointsMultiples". - * @param theDomains - list of groups of volumes - * @param createJointElems - if TRUE, create the elements - * @return TRUE if operation has been completed successfully, FALSE otherwise + * \param theDomains - list of groups of volumes + * \param createJointElems - if TRUE, create the elements + * \param onAllBoundaries - if TRUE, the nodes and elements are also created on + * the boundary between \a theDomains and the rest mesh + * \return TRUE if operation has been completed successfully, FALSE otherwise */ //================================================================================ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains, - CORBA::Boolean createJointElems ) + CORBA::Boolean createJointElems, + CORBA::Boolean onAllBoundaries ) throw (SALOME::SALOME_Exception) { - bool aResult = false; + bool isOK = false; SMESH_TRY; initData(); @@ -6843,10 +6897,11 @@ SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& the SMESHDS_Mesh* aMeshDS = getMeshDS(); // MESSAGE("theDomains.length = "< domains; - domains.clear(); + domains.resize( theDomains.length() ); for ( int i = 0, n = theDomains.length(); i < n; i++ ) { @@ -6855,26 +6910,25 @@ SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& the { // if ( aGrp->GetType() != SMESH::VOLUME ) // THROW_SALOME_CORBA_EXCEPTION("Not a volume group", SALOME::BAD_PARAM); - TIDSortedElemSet domain; - domain.clear(); - domains.push_back(domain); SMESH::long_array_var anIDs = aGrp->GetIDs(); arrayToSet( anIDs, aMeshDS, domains[ i ], SMDSAbs_All ); } } - aResult = getEditor().DoubleNodesOnGroupBoundaries( domains, createJointElems ); + isOK = getEditor().DoubleNodesOnGroupBoundaries( domains, createJointElems, onAllBoundaries ); // TODO publish the groups of flat elements in study - declareMeshModified( /*isReComputeSafe=*/ !aResult ); + declareMeshModified( /*isReComputeSafe=*/ !isOK ); // Update Python script TPythonDump() << "isDone = " << this << ".DoubleNodesOnGroupBoundaries( " << &theDomains - << ", " << createJointElems << " )"; + << ", " << createJointElems << ", " << onAllBoundaries << " )"; SMESH_CATCH( SMESH::throwCorbaException ); - return aResult; + myMesh_i->CreateGroupServants(); // publish created groups if any + + return isOK; } //================================================================================ diff --git a/src/SMESH_I/SMESH_MeshEditor_i.hxx b/src/SMESH_I/SMESH_MeshEditor_i.hxx index e74df3788..ead3048b0 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.hxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -233,6 +233,12 @@ public: void SplitVolumesIntoTetra(SMESH::SMESH_IDSource_ptr elems, CORBA::Short methodFlags) throw (SALOME::SALOME_Exception); + void SplitHexahedraIntoPrisms(SMESH::SMESH_IDSource_ptr elems, + const SMESH::PointStruct & startHexPoint, + const SMESH::DirStruct& facetToSplitNormal, + CORBA::Short methodFlags, + CORBA::Boolean allDomains) + throw (SALOME::SALOME_Exception); CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements, const SMESH::long_array & IDsOfFixedNodes, @@ -917,12 +923,15 @@ public: * The nodes of the internal faces at the boundaries of the groups are doubled. * In option, the internal faces are replaced by flat elements. * Triangles are transformed in prisms, and quadrangles in hexahedrons. - * @param theDomains - list of groups of volumes - * @param createJointElems - if TRUE, create the elements - * @return TRUE if operation has been completed successfully, FALSE otherwise + * \param theDomains - list of groups of volumes + * \param createJointElems - if TRUE, create the elements + * \param onAllBoundaries - if TRUE, the nodes and elements are also create on + * the boundary between \a theDomains and the rest mesh + * \return TRUE if operation has been completed successfully, FALSE otherwise */ CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains, - CORBA::Boolean createJointElems ) + CORBA::Boolean createJointElems, + CORBA::Boolean onAllBoundaries ) throw (SALOME::SALOME_Exception); /*! * \brief Double nodes on some external faces and create flat elements. diff --git a/src/SMESH_I/SMESH_MeshPartDS.hxx b/src/SMESH_I/SMESH_MeshPartDS.hxx index a558c22d2..f58249f2e 100644 --- a/src/SMESH_I/SMESH_MeshPartDS.hxx +++ b/src/SMESH_I/SMESH_MeshPartDS.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 812d3c0cd..b0c453b46 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -26,6 +26,7 @@ #include "SMESH_Mesh_i.hxx" #include "DriverMED_R_SMESHDS_Mesh.h" +#include "DriverMED_W_Field.h" #include "DriverMED_W_SMESHDS_Mesh.h" #include "MED_Factory.hxx" #include "SMDS_EdgePosition.hxx" @@ -40,10 +41,13 @@ #include "SMESHDS_Group.hxx" #include "SMESHDS_GroupOnGeom.hxx" #include "SMESH_Controls.hxx" +#include "SMESH_File.hxx" #include "SMESH_Filter_i.hxx" #include "SMESH_Gen_i.hxx" #include "SMESH_Group.hxx" #include "SMESH_Group_i.hxx" +#include "SMESH_Mesh.hxx" +#include "SMESH_MeshAlgos.hxx" #include "SMESH_MeshEditor.hxx" #include "SMESH_MeshEditor_i.hxx" #include "SMESH_MeshPartDS.hxx" @@ -52,12 +56,9 @@ #include "SMESH_PythonDump.hxx" #include "SMESH_subMesh_i.hxx" -#include #include #include -#include #include -#include #include #include @@ -65,30 +66,23 @@ // OCCT Includes #include -#include -#include -#include -#include -#include -#include +#include #include -#include -#include #include #include #include #include #include -#include "SMESH_TryCatch.hxx" // include after OCCT headers! - // STL Includes #include -#include #include #include -#include +// to pass CORBA exception through SMESH_TRY +#define SMY_OWN_CATCH catch( SALOME::SALOME_Exception& se ) { throw se; } + +#include "SMESH_TryCatch.hxx" // include after OCCT headers! #ifdef _DEBUG_ static int MYDEBUG = 0; @@ -120,6 +114,7 @@ SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA, _editor = NULL; _previewEditor = NULL; _preMeshInfo = NULL; + _mainShapeTick = 0; } //============================================================================= @@ -193,6 +188,8 @@ void SMESH_Mesh_i::SetShape( GEOM::GEOM_Object_ptr theShapeObject ) // to track changes of GEOM groups SMESH::SMESH_Mesh_var mesh = _this(); addGeomGroupData( theShapeObject, mesh ); + if ( !CORBA::is_nil( theShapeObject )) + _mainShapeTick = theShapeObject->GetTick(); } //================================================================================ @@ -275,7 +272,7 @@ void SMESH_Mesh_i::Clear() throw (SALOME::SALOME_Exception) try { _impl->Clear(); - CheckGeomGroupModif(); // issue 20145 + //CheckGeomGroupModif(); // issue 20145 } catch(SALOME_Exception & S_ex) { THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); @@ -396,14 +393,7 @@ SMESH_Mesh_i::ImportMEDFile( const char* theFileName, const char* theMeshName ) _medFileInfo->major = major; _medFileInfo->minor = minor; _medFileInfo->release = release; -#ifdef WIN32 - struct _stati64 d; - if ( ::_stati64( theFileName, &d ) != -1 ) -#else - struct stat64 d; - if ( ::stat64( theFileName, &d ) != -1 ) -#endif - _medFileInfo->fileSize = d.st_size; + _medFileInfo->fileSize = SMESH_File( theFileName ).size(); return ConvertDriverMEDReadStatus(status); } @@ -1503,7 +1493,7 @@ SMESH_Mesh_i::CutListOfGroups(const SMESH::ListOfGroups& theMainGroups, if ( aType == SMESH::ALL ) aType = aGrp->GetType(); else if ( aType != aGrp->GetType() ) - THROW_SALOME_CORBA_EXCEPTION("UnionListOfGroups(): different group types", + THROW_SALOME_CORBA_EXCEPTION("CutListOfGroups(): different group types", SALOME::BAD_PARAM); if ( SMESH_GroupBase_i* grp_i = SMESH::DownCast< SMESH_GroupBase_i* >( aGrp )) if ( SMESHDS_GroupBase* grpDS = grp_i->GetGroupDS() ) @@ -1521,7 +1511,7 @@ SMESH_Mesh_i::CutListOfGroups(const SMESH::ListOfGroups& theMainGroups, if ( CORBA::is_nil( aGrp ) ) continue; if ( aType != aGrp->GetType() ) - THROW_SALOME_CORBA_EXCEPTION("UnionListOfGroups(): different group types", + THROW_SALOME_CORBA_EXCEPTION("CutListOfGroups(): different group types", SALOME::BAD_PARAM); if ( SMESH_GroupBase_i* grp_i = SMESH::DownCast< SMESH_GroupBase_i* >( aGrp )) if ( SMESHDS_GroupBase* grpDS = grp_i->GetGroupDS() ) @@ -1702,6 +1692,9 @@ void SMESH_Mesh_i::addGeomGroupData(GEOM::GEOM_Object_ptr theGeomObj, groupData._indices.insert( ids[i] ); // SMESH object groupData._smeshObject = CORBA::Object::_duplicate( theSmeshObj ); + // shape index in SMESHDS + // TopoDS_Shape shape = _gen_i->GeomObjectToShape( theGeomObj ); + // groupData._dsID = shape.IsNull() ? 0 : _impl->GetSubMesh( shape )->GetId(); } //================================================================================ @@ -1775,22 +1768,176 @@ TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData) namespace { - //============================================================================= + //----------------------------------------------------------------------------- /*! * \brief Storage of shape and index used in CheckGeomGroupModif() */ - //============================================================================= struct TIndexedShape { int _index; TopoDS_Shape _shape; TIndexedShape( int i, const TopoDS_Shape& s ):_index(i), _shape(s) {} }; + //----------------------------------------------------------------------------- + /*! + * \brief Data to re-create a group on geometry + */ + struct TGroupOnGeomData + { + int _oldID; + int _shapeID; + SMDSAbs_ElementType _type; + std::string _name; + Quantity_Color _color; + }; } + +//============================================================================= +/*! + * \brief Update data if geometry changes + * + * Issue 0022501 + */ +//============================================================================= + +void SMESH_Mesh_i::CheckGeomModif() +{ + if ( !_impl->HasShapeToMesh() ) return; + + SALOMEDS::Study_var study = _gen_i->GetCurrentStudy(); + if ( study->_is_nil() ) return; + + GEOM::GEOM_Object_var mainGO = _gen_i->ShapeToGeomObject( _impl->GetShapeToMesh() ); + if ( mainGO->_is_nil() ) return; + + if ( mainGO->GetType() == GEOM_GROUP || + mainGO->GetTick() == _mainShapeTick ) + { + CheckGeomGroupModif(); + return; + } + + GEOM_Client* geomClient = _gen_i->GetShapeReader(); + if ( !geomClient ) return; + GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine(); + if ( geomGen->_is_nil() ) return; + + CORBA::String_var ior = geomGen->GetStringFromIOR( mainGO ); + geomClient->RemoveShapeFromBuffer( ior.in() ); + + // Update data taking into account that + // all sub-shapes change but IDs of sub-shapes remain (except for geom groups) + + _impl->Clear(); + TopoDS_Shape newShape = _gen_i->GeomObjectToShape( mainGO ); + if ( newShape.IsNull() ) + return; + + _mainShapeTick = mainGO->GetTick(); + + SMESHDS_Mesh * meshDS = _impl->GetMeshDS(); + + // store data of groups on geometry + vector< TGroupOnGeomData > groupsData; + const set& groups = meshDS->GetGroups(); + groupsData.reserve( groups.size() ); + set::const_iterator g = groups.begin(); + for ( ; g != groups.end(); ++g ) + if ( const SMESHDS_GroupOnGeom* group = dynamic_cast< SMESHDS_GroupOnGeom* >( *g )) + { + TGroupOnGeomData data; + data._oldID = group->GetID(); + data._shapeID = meshDS->ShapeToIndex( group->GetShape() ); + data._type = group->GetType(); + data._name = group->GetStoreName(); + data._color = group->GetColor(); + groupsData.push_back( data ); + } + // store assigned hypotheses + vector< pair< int, THypList > > ids2Hyps; + const ShapeToHypothesis & hyps = meshDS->GetHypotheses(); + for ( ShapeToHypothesis::Iterator s2hyps( hyps ); s2hyps.More(); s2hyps.Next() ) + { + const TopoDS_Shape& s = s2hyps.Key(); + const THypList& hyps = s2hyps.ChangeValue(); + ids2Hyps.push_back( make_pair( meshDS->ShapeToIndex( s ), hyps )); + } + + // change shape to mesh + int oldNbSubShapes = meshDS->MaxShapeIndex(); + _impl->ShapeToMesh( TopoDS_Shape() ); + _impl->ShapeToMesh( newShape ); + + // re-add shapes of geom groups + list::iterator data = _geomGroupData.begin(); + for ( ; data != _geomGroupData.end(); ++data ) + { + TopoDS_Shape newShape = newGroupShape( *data ); + if ( !newShape.IsNull() ) + { + if ( meshDS->ShapeToIndex( newShape ) > 0 ) // a group reduced to one sub-shape + { + TopoDS_Compound compound; + BRep_Builder().MakeCompound( compound ); + BRep_Builder().Add( compound, newShape ); + newShape = compound; + } + _impl->GetSubMesh( newShape ); + } + } + if ( oldNbSubShapes != meshDS->MaxShapeIndex() ) + THROW_SALOME_CORBA_EXCEPTION( "SMESH_Mesh_i::CheckGeomModif() bug", + SALOME::INTERNAL_ERROR ); + + // re-assign hypotheses + for ( size_t i = 0; i < ids2Hyps.size(); ++i ) + { + const TopoDS_Shape& s = meshDS->IndexToShape( ids2Hyps[i].first ); + const THypList& hyps = ids2Hyps[i].second; + THypList::const_iterator h = hyps.begin(); + for ( ; h != hyps.end(); ++h ) + _impl->AddHypothesis( s, (*h)->GetID() ); + } + + // restore groups + for ( size_t i = 0; i < groupsData.size(); ++i ) + { + const TGroupOnGeomData& data = groupsData[i]; + + map::iterator i2g = _mapGroups.find( data._oldID ); + if ( i2g == _mapGroups.end() ) continue; + + SMESH_GroupBase_i* gr_i = SMESH::DownCast( i2g->second ); + if ( !gr_i ) continue; + + int id; + SMESH_Group* g = _impl->AddGroup( data._type, data._name.c_str(), id, + meshDS->IndexToShape( data._shapeID )); + if ( !g ) + { + _mapGroups.erase( i2g ); + } + else + { + g->GetGroupDS()->SetColor( data._color ); + gr_i->changeLocalId( id ); + _mapGroups[ id ] = i2g->second; + if ( data._oldID != id ) + _mapGroups.erase( i2g ); + } + } + + // update _mapSubMesh + map::iterator i_sm = _mapSubMesh.begin(); + for ( ; i_sm != _mapSubMesh.end(); ++i_sm ) + i_sm->second = _impl->GetSubMesh( meshDS->IndexToShape( i_sm->first )); + +} + //============================================================================= /*! * \brief Update objects depending on changed geom groups - * + * * NPAL16168: geometrical group edition from a submesh don't modifiy mesh computation * issue 0020210: Update of a smesh group after modification of the associated geom group */ @@ -2608,44 +2755,36 @@ CORBA::Boolean SMESH_Mesh_i::HasDuplicatedGroupNamesMED() void SMESH_Mesh_i::PrepareForWriting (const char* file, bool overwrite) { - TCollection_AsciiString aFullName ((char*)file); - OSD_Path aPath (aFullName); - OSD_File aFile (aPath); - if (aFile.Exists()) { + SMESH_File aFile( file ); + SMESH_Comment msg; + if (aFile.exists()) { // existing filesystem node - if (aFile.KindOfFile() == OSD_FILE) { - if (aFile.IsWriteable()) { - if (overwrite) { - aFile.Reset(); - aFile.Remove(); - } - if (aFile.Failed()) { - TCollection_AsciiString msg ("File "); - msg += aFullName + " cannot be replaced."; - THROW_SALOME_CORBA_EXCEPTION(msg.ToCString(), SALOME::BAD_PARAM); + if ( !aFile.isDirectory() ) { + if ( aFile.openForWriting() ) { + if ( overwrite && ! aFile.remove()) { + msg << "Can't replace " << aFile.getName(); } } else { - TCollection_AsciiString msg ("File "); - msg += aFullName + " cannot be overwritten."; - THROW_SALOME_CORBA_EXCEPTION(msg.ToCString(), SALOME::BAD_PARAM); + msg << "Can't write into " << aFile.getName(); } } else { - TCollection_AsciiString msg ("Location "); - msg += aFullName + " is not a file."; - THROW_SALOME_CORBA_EXCEPTION(msg.ToCString(), SALOME::BAD_PARAM); + msg << "Location " << aFile.getName() << " is not a file"; } - } else { + } + else { // nonexisting file; check if it can be created - aFile.Reset(); - aFile.Build(OSD_WriteOnly, OSD_Protection()); - if (aFile.Failed()) { - TCollection_AsciiString msg ("You cannot create the file "); - msg += aFullName + ". Check the directory existance and access rights."; - THROW_SALOME_CORBA_EXCEPTION(msg.ToCString(), SALOME::BAD_PARAM); - } else { - aFile.Close(); - aFile.Remove(); + if ( !aFile.openForWriting() ) { + msg << "You cannot create the file " + << aFile.getName() + << ". Check the directory existance and access rights"; } + aFile.remove(); + } + + if ( !msg.empty() ) + { + msg << "."; + THROW_SALOME_CORBA_EXCEPTION(msg.c_str(), SALOME::BAD_PARAM); } } @@ -2715,13 +2854,13 @@ void SMESH_Mesh_i::ExportToMEDX (const char* file, _preMeshInfo->FullLoadFromFile(); string aMeshName = prepareMeshNameAndGroups(file, overwrite); + _impl->ExportMED( file, aMeshName.c_str(), auto_groups, theVersion, 0, autoDimension ); + TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportToMEDX( r'" << file << "', " << auto_groups << ", " << theVersion << ", " << overwrite << ", " << autoDimension << " )"; - _impl->ExportMED( file, aMeshName.c_str(), auto_groups, theVersion, 0, autoDimension ); - SMESH_CATCH( SMESH::throwCorbaException ); } @@ -2849,20 +2988,65 @@ void SMESH_Mesh_i::ExportSTL (const char *file, const bool isascii) */ //================================================================================ -void SMESH_Mesh_i::ExportPartToMED(::SMESH::SMESH_IDSource_ptr meshPart, - const char* file, - CORBA::Boolean auto_groups, - ::SMESH::MED_VERSION version, - ::CORBA::Boolean overwrite, - ::CORBA::Boolean autoDimension) +void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart, + const char* file, + CORBA::Boolean auto_groups, + SMESH::MED_VERSION version, + CORBA::Boolean overwrite, + CORBA::Boolean autoDimension, + const GEOM::ListOfFields& fields, + const char* geomAssocFields) throw (SALOME::SALOME_Exception) { - Unexpect aCatch(SALOME_SalomeException); - TPythonDump pyDump; + SMESH_TRY; + if ( _preMeshInfo ) + _preMeshInfo->FullLoadFromFile(); + + // check fields + bool have0dField = false; + if ( fields.length() > 0 ) + { + GEOM::GEOM_Object_var shapeToMesh = GetShapeToMesh(); + if ( shapeToMesh->_is_nil() ) + THROW_SALOME_CORBA_EXCEPTION( "No shape to mesh", SALOME::INTERNAL_ERROR ); + + for ( size_t i = 0; i < fields.length(); ++i ) + { + if ( fields[i]->GetDataType() == GEOM::FDT_String ) + THROW_SALOME_CORBA_EXCEPTION + ( "Export of string fields is not supported", SALOME::BAD_PARAM); + GEOM::GEOM_Object_var fieldShape = fields[i]->GetShape(); + if ( fieldShape->_is_nil() ) + THROW_SALOME_CORBA_EXCEPTION( "Null shape under a field", SALOME::INTERNAL_ERROR ); + if ( !fieldShape->IsSame( shapeToMesh ) ) + THROW_SALOME_CORBA_EXCEPTION + ( "Field defined not on shape", SALOME::BAD_PARAM); + if ( fields[i]->GetDimension() == 0 ) + have0dField = true; + } + if ( geomAssocFields ) + for ( int i = 0; geomAssocFields[i]; ++i ) + switch ( geomAssocFields[i] ) { + case 'v':case 'e':case 'f':case 's': break; + case 'V':case 'E':case 'F':case 'S': break; + default: THROW_SALOME_CORBA_EXCEPTION + ( "geomAssocFields can include only [vefs] characters", SALOME::BAD_PARAM); + } + } + + SMESHDS_Mesh* meshDS = _impl->GetMeshDS(); - if ( SMESH_Mesh_i * mesh = SMESH::DownCast< SMESH_Mesh_i* >( meshPart )) + // write mesh + + string aMeshName = "Mesh"; + SMESHUtils::Deleter< SMESH_MeshPartDS > tmpDSDeleter(0); + if ( CORBA::is_nil( meshPart ) || + SMESH::DownCast< SMESH_Mesh_i* >( meshPart )) { - mesh->ExportToMEDX( file, auto_groups, version, autoDimension ); + aMeshName = prepareMeshNameAndGroups(file, overwrite); + _impl->ExportMED( file, aMeshName.c_str(), auto_groups, + version, 0, autoDimension, /*addODOnVertices=*/have0dField); + meshDS = _impl->GetMeshDS(); } else { @@ -2871,7 +3055,6 @@ void SMESH_Mesh_i::ExportPartToMED(::SMESH::SMESH_IDSource_ptr meshPart, PrepareForWriting(file, overwrite); - string aMeshName = "Mesh"; SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy(); if ( !aStudy->_is_nil() ) { SALOMEDS::SObject_wrap SO = _gen_i->ObjectToSObject( aStudy, meshPart ); @@ -2880,13 +3063,287 @@ void SMESH_Mesh_i::ExportPartToMED(::SMESH::SMESH_IDSource_ptr meshPart, aMeshName = name; } } - SMESH_MeshPartDS partDS( meshPart ); - _impl->ExportMED( file, aMeshName.c_str(), auto_groups, version, &partDS, autoDimension ); + SMESH_MeshPartDS* partDS = new SMESH_MeshPartDS( meshPart ); + _impl->ExportMED( file, aMeshName.c_str(), auto_groups, + version, partDS, autoDimension, /*addODOnVertices=*/have0dField); + meshDS = tmpDSDeleter._obj = partDS; + } + + // write fields + + if ( _impl->HasShapeToMesh() ) + { + DriverMED_W_Field fieldWriter; + fieldWriter.SetFile( file ); + fieldWriter.SetMeshName( aMeshName ); + fieldWriter.AddODOnVertices( have0dField ); + + exportMEDFields( fieldWriter, meshDS, fields, geomAssocFields ); } - pyDump << SMESH::SMESH_Mesh_var(_this()) << ".ExportPartToMED( " - << meshPart << ", r'" << file << "', " - << auto_groups << ", " << version << ", " << overwrite << ", " - << autoDimension << " )"; + + // dump + GEOM::ListOfGBO_var goList = new GEOM::ListOfGBO; + goList->length( fields.length() ); + for ( size_t i = 0; i < fields.length(); ++i ) + { + GEOM::GEOM_BaseObject_var gbo = GEOM::GEOM_BaseObject::_narrow( fields[i] ); + goList[i] = gbo; + } + TPythonDump() << _this() << ".ExportPartToMED( " + << meshPart << ", r'" << file << "', " + << auto_groups << ", " << version << ", " << overwrite << ", " + << autoDimension << ", " << goList + << ", '" << ( geomAssocFields ? geomAssocFields : "" ) << "'" << " )"; + + SMESH_CATCH( SMESH::throwCorbaException ); +} + +//================================================================================ +/*! + * Write GEOM fields to MED file + */ +//================================================================================ + +void SMESH_Mesh_i::exportMEDFields( DriverMED_W_Field& fieldWriter, + SMESHDS_Mesh* meshDS, + const GEOM::ListOfFields& fields, + const char* geomAssocFields) +{ +#define METH "SMESH_Mesh_i::exportMEDFields() " + + if (( fields.length() < 1 ) && + ( !geomAssocFields || !geomAssocFields[0] )) + return; + + std::vector< double > dblVals( meshDS->MaxShapeIndex()+1 ); + std::vector< int > intVals( meshDS->MaxShapeIndex()+1 ); + std::vector< int > subIdsByDim[ 4 ]; + const double noneDblValue = 0.; + const double noneIntValue = 0; + + for ( size_t iF = 0; iF < fields.length(); ++iF ) + { + // set field data + + int dim = fields[ iF ]->GetDimension(); + SMDSAbs_ElementType elemType; + TopAbs_ShapeEnum shapeType; + switch ( dim ) { + case 0: elemType = SMDSAbs_0DElement; shapeType = TopAbs_VERTEX; break; + case 1: elemType = SMDSAbs_Edge; shapeType = TopAbs_EDGE; break; + case 2: elemType = SMDSAbs_Face; shapeType = TopAbs_FACE; break; + case 3: elemType = SMDSAbs_Volume; shapeType = TopAbs_SOLID; break; + default: + continue; // skip fields on whole shape + } + GEOM::field_data_type dataType = fields[ iF ]->GetDataType(); + if ( dataType == GEOM::FDT_String ) + continue; + GEOM::ListOfLong_var stepIDs = fields[ iF ]->GetSteps(); + if ( stepIDs->length() < 1 ) + continue; + GEOM::string_array_var comps = fields[ iF ]->GetComponents(); + if ( comps->length() < 1 ) + continue; + CORBA::String_var name = fields[ iF ]->GetName(); + + if ( !fieldWriter.Set( meshDS, + name.in(), + elemType, + comps->length(), + /*isIntData=*/false ))//( dataType == GEOM::FDT_Int ))) + continue; + + for ( size_t iC = 0; iC < comps->length(); ++iC ) + fieldWriter.SetCompName( iC, comps[ iC ].in() ); + + // find sub-shape IDs + + std::vector< int >& subIds = subIdsByDim[ dim ]; + if ( subIds.empty() ) + for ( int id = 1; id <= meshDS->MaxShapeIndex(); ++id ) + if ( meshDS->IndexToShape( id ).ShapeType() == shapeType ) + subIds.push_back( id ); + + // write steps + + SMDS_ElemIteratorPtr elemIt = fieldWriter.GetOrderedElems(); + if ( !elemIt ) + continue; + + for ( size_t iS = 0; iS < stepIDs->length(); ++iS ) + { + GEOM::GEOM_FieldStep_var step = fields[ iF ]->GetStep( stepIDs[ iS ]); + if ( step->_is_nil() ) + continue; + + CORBA::Long stamp = step->GetStamp(); + CORBA::Long id = step->GetID(); + fieldWriter.SetDtIt( int( stamp ), int( id )); + + // fill dblVals or intVals + switch ( dataType ) + { + case GEOM::FDT_Double: + { + GEOM::GEOM_DoubleFieldStep_var dblStep = GEOM::GEOM_DoubleFieldStep::_narrow( step ); + if ( dblStep->_is_nil() ) continue; + GEOM::ListOfDouble_var vv = dblStep->GetValues(); + if ( vv->length() != subIds.size() ) + THROW_SALOME_CORBA_EXCEPTION( METH "BUG: wrong nb subIds", SALOME::INTERNAL_ERROR ); + for ( size_t i = 0; i < vv->length(); ++i ) + dblVals[ subIds[ i ]] = vv[ i ]; + break; + } + case GEOM::FDT_Int: + { + GEOM::GEOM_IntFieldStep_var intStep = GEOM::GEOM_IntFieldStep::_narrow( step ); + if ( intStep->_is_nil() ) continue; + GEOM::ListOfLong_var vv = intStep->GetValues(); + if ( vv->length() != subIds.size() ) + THROW_SALOME_CORBA_EXCEPTION( METH "BUG: wrong nb subIds", SALOME::INTERNAL_ERROR ); + for ( size_t i = 0; i < vv->length(); ++i ) + intVals[ subIds[ i ]] = (int) vv[ i ]; + break; + } + case GEOM::FDT_Bool: + { + GEOM::GEOM_BoolFieldStep_var boolStep = GEOM::GEOM_BoolFieldStep::_narrow( step ); + if ( boolStep->_is_nil() ) continue; + GEOM::short_array_var vv = boolStep->GetValues(); + if ( vv->length() != subIds.size() ) + THROW_SALOME_CORBA_EXCEPTION( METH "BUG: wrong nb subIds", SALOME::INTERNAL_ERROR ); + for ( size_t i = 0; i < vv->length(); ++i ) + intVals[ subIds[ i ]] = (int) vv[ i ]; + break; + } + default: continue; + } + + // pass values to fieldWriter + elemIt = fieldWriter.GetOrderedElems(); + if ( dataType == GEOM::FDT_Double ) + while ( elemIt->more() ) + { + const SMDS_MeshElement* e = elemIt->next(); + const int shapeID = e->getshapeId(); + if ( shapeID < 1 || shapeID >= dblVals.size() ) + fieldWriter.AddValue( noneDblValue ); + else + fieldWriter.AddValue( dblVals[ shapeID ]); + } + else + while ( elemIt->more() ) + { + const SMDS_MeshElement* e = elemIt->next(); + const int shapeID = e->getshapeId(); + if ( shapeID < 1 || shapeID >= intVals.size() ) + fieldWriter.AddValue( (double) noneIntValue ); + else + fieldWriter.AddValue( (double) intVals[ shapeID ]); + } + + // write a step + fieldWriter.Perform(); + SMESH_ComputeErrorPtr res = fieldWriter.GetError(); + if ( res && res->IsKO() ) + { + if ( res->myComment.empty() ) + { THROW_SALOME_CORBA_EXCEPTION( METH "Fatal error", SALOME::INTERNAL_ERROR ); } + else + { THROW_SALOME_CORBA_EXCEPTION( res->myComment.c_str(), SALOME::INTERNAL_ERROR ); } + } + + } // loop on steps + } // loop on fields + + if ( !geomAssocFields || !geomAssocFields[0] ) + return; + + // write geomAssocFields + + std::vector< int > shapeDim( TopAbs_SHAPE + 1 ); + shapeDim[ TopAbs_COMPOUND ] = 3; + shapeDim[ TopAbs_COMPSOLID ] = 3; + shapeDim[ TopAbs_SOLID ] = 3; + shapeDim[ TopAbs_SHELL ] = 2; + shapeDim[ TopAbs_FACE ] = 2; + shapeDim[ TopAbs_WIRE ] = 1; + shapeDim[ TopAbs_EDGE ] = 1; + shapeDim[ TopAbs_VERTEX ] = 0; + shapeDim[ TopAbs_SHAPE ] = 3; + + for ( int iF = 0; geomAssocFields[ iF ]; ++iF ) + { + std::vector< std::string > compNames; + switch ( geomAssocFields[ iF ]) { + case 'v': case 'V': + fieldWriter.Set( meshDS, "_vertices_", SMDSAbs_Node, /*nbComps=*/2, /*isInt=*/false ); + compNames.push_back( "dim" ); + break; + case 'e': case 'E': + fieldWriter.Set( meshDS, "_edges_", SMDSAbs_Edge, /*nbComps=*/1, /*isInt=*/false ); + break; + case 'f': case 'F': + fieldWriter.Set( meshDS, "_faces_", SMDSAbs_Face, /*nbComps=*/1, /*isInt=*/false ); + break; + case 's': case 'S': + fieldWriter.Set( meshDS, "_solids_", SMDSAbs_Volume, /*nbComps=*/1, /*isInt=*/false ); + break; + default: continue; + } + compNames.push_back( "id" ); + for ( size_t iC = 0; iC < compNames.size(); ++iC ) + fieldWriter.SetCompName( iC, compNames[ iC ].c_str() ); + + fieldWriter.SetDtIt( -1, -1 ); + + SMDS_ElemIteratorPtr elemIt = fieldWriter.GetOrderedElems(); + if ( !elemIt ) + continue; + + if ( compNames.size() == 2 ) // _vertices_ + while ( elemIt->more() ) + { + const SMDS_MeshElement* e = elemIt->next(); + const int shapeID = e->getshapeId(); + if ( shapeID < 1 ) + { + fieldWriter.AddValue( (double) -1 ); + fieldWriter.AddValue( (double) -1 ); + } + else + { + const TopoDS_Shape& S = meshDS->IndexToShape( shapeID ); + fieldWriter.AddValue( (double) ( S.IsNull() ? -1 : shapeDim[ S.ShapeType() ])); + fieldWriter.AddValue( (double) shapeID ); + } + } + else + while ( elemIt->more() ) + { + const SMDS_MeshElement* e = elemIt->next(); + const int shapeID = e->getshapeId(); + if ( shapeID < 1 ) + fieldWriter.AddValue( (double) -1 ); + else + fieldWriter.AddValue( (double) shapeID ); + } + + // write a step + fieldWriter.Perform(); + SMESH_ComputeErrorPtr res = fieldWriter.GetError(); + if ( res && res->IsKO() ) + { + if ( res->myComment.empty() ) + { THROW_SALOME_CORBA_EXCEPTION( METH "Fatal error", SALOME::INTERNAL_ERROR ); } + else + { THROW_SALOME_CORBA_EXCEPTION( res->myComment.c_str(), SALOME::INTERNAL_ERROR ); } + } + + } // loop on geomAssocFields + +#undef METH } //================================================================================ @@ -3466,6 +3923,25 @@ SMESH::EntityType SMESH_Mesh_i::GetElementGeomType( const CORBA::Long id ) return ( SMESH::EntityType ) e->GetEntityType(); } +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::GeometryType SMESH_Mesh_i::GetElementShape( const CORBA::Long id ) + throw (SALOME::SALOME_Exception) +{ + if ( _preMeshInfo ) + _preMeshInfo->FullLoadFromFile(); + + const SMDS_MeshElement* e = _impl->GetMeshDS()->FindElement(id); + if ( !e ) + THROW_SALOME_CORBA_EXCEPTION( "invalid element id", SALOME::BAD_PARAM ); + + return ( SMESH::GeometryType ) e->GetGeomType(); +} + //============================================================================= /*! * Returns ID of elements for given submesh @@ -3662,17 +4138,11 @@ SMESH::long_array* SMESH_Mesh_i::GetNodeInverseElements(const CORBA::Long id) // find inverse elements SMDS_ElemIteratorPtr eIt = aNode->GetInverseElementIterator(); - TColStd_SequenceOfInteger IDs; - while(eIt->more()) { + aResult->length( aNode->NbInverseElements() ); + for( int i = 0; eIt->more(); ++i ) + { const SMDS_MeshElement* elem = eIt->next(); - IDs.Append(elem->GetID()); - } - if(IDs.Length()>0) { - aResult->length(IDs.Length()); - int i = 1; - for(; i<=IDs.Length(); i++) { - aResult[i-1] = IDs.Value(i); - } + aResult[ i ] = elem->GetID(); } return aResult._retn(); } @@ -4023,6 +4493,33 @@ SMESH::long_array* SMESH_Mesh_i::GetElemFaceNodes(CORBA::Long elemId, return aResult._retn(); } +//======================================================================= +//function : GetElemFaceNodes +//purpose : Returns three components of normal of given mesh face. +//======================================================================= + +SMESH::double_array* SMESH_Mesh_i::GetFaceNormal(CORBA::Long elemId, + CORBA::Boolean normalized) +{ + if ( _preMeshInfo ) + _preMeshInfo->FullLoadFromFile(); + + SMESH::double_array_var aResult = new SMESH::double_array(); + + if ( SMESHDS_Mesh* mesh = _impl->GetMeshDS() ) + { + gp_XYZ normal; + if ( SMESH_MeshAlgos::FaceNormal( mesh->FindElement(elemId), normal, normalized )) + { + aResult->length( 3 ); + aResult[ 0 ] = normal.X(); + aResult[ 1 ] = normal.Y(); + aResult[ 2 ] = normal.Z(); + } + } + return aResult._retn(); +} + //======================================================================= //function : FindElementByNodes //purpose : Returns an element based on all given nodes. @@ -5053,8 +5550,37 @@ void findCommonSubMesh (list& theSubMeshList, //theCommon.insert( theSubMesh ); } +//----------------------------------------------------------------------------- +bool isSubMeshInList ( int smID, const TListOfListOfInt& smLists ) +{ + TListOfListOfInt::const_iterator listsIt = smLists.begin(); + for ( ; listsIt != smLists.end(); ++listsIt ) + { + const TListOfInt& smIDs = *listsIt; + if ( std::find( smIDs.begin(), smIDs.end(), smID ) != smIDs.end() ) + return true; + } + return false; +} + } // namespace +//============================================================================= +/*! + * \brief Return \c true if a meshing order not yet set for a concurrent sub-mesh + */ +//============================================================================= + +CORBA::Boolean SMESH_Mesh_i::IsUnorderedSubMesh(CORBA::Long submeshID) +{ + TListOfListOfInt anOrder = GetImpl().GetMeshOrder(); // already defined order + if ( isSubMeshInList( submeshID, anOrder )) + return false; + + TListOfListOfInt allConurrent = findConcurrentSubMeshes(); + return isSubMeshInList( submeshID, allConurrent ); +} + //============================================================================= /*! * \brief Return submesh objects list in meshing order @@ -5068,14 +5594,37 @@ SMESH::submesh_array_array* SMESH_Mesh_i::GetMeshOrder() 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() ) { + TListOfListOfInt anOrder = GetImpl().GetMeshOrder(); // already defined order + TListOfListOfInt allConurrent = findConcurrentSubMeshes(); + anOrder.splice( anOrder.end(), allConurrent ); + + 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, false ); + + return aResult._retn(); +} + +//============================================================================= +/*! + * \brief Finds concurrent sub-meshes + */ +//============================================================================= + +TListOfListOfInt SMESH_Mesh_i::findConcurrentSubMeshes() +{ + TListOfListOfInt anOrder; + ::SMESH_Mesh& mesh = GetImpl(); + { // collect submeshes and detect 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; @@ -5147,11 +5696,8 @@ SMESH::submesh_array_array* SMESH_Mesh_i::GetMeshOrder() 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, false ); - return aResult._retn(); + return anOrder; } //============================================================================= @@ -5240,7 +5786,8 @@ void SMESH_Mesh_i::convertMeshOrder (const TListOfListOfInt& theIdsOrder, 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++ ) { + int j; + for( j = 0; subIt != aSubOrder.end(); subIt++ ) { if ( _mapSubMeshIor.find(*subIt) == _mapSubMeshIor.end() ) continue; SMESH::SMESH_subMesh_var subMesh = @@ -5254,7 +5801,8 @@ void SMESH_Mesh_i::convertMeshOrder (const TListOfListOfInt& theIdsOrder, } if ( theIsDump ) aPythonDump << " ]"; - theResOrder[ listIndx++ ] = aResSubSet; + if ( j > 1 ) + theResOrder[ listIndx++ ] = aResSubSet; } // correct number of lists theResOrder.length( listIndx ); diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index c52699bb2..cd9a7a916 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -47,6 +47,8 @@ class SMESH_GroupBase_i; class SMESH_subMesh_i; class SMESH_PreMeshInfo; class SMESH_MeshEditor_i; +class DriverMED_W_Field; +class SMESHDS_Mesh; class SMESH_I_EXPORT SMESH_Mesh_i: public virtual POA_SMESH::SMESH_Mesh, @@ -255,7 +257,9 @@ public: CORBA::Boolean auto_groups, SMESH::MED_VERSION version, CORBA::Boolean overwrite, - CORBA::Boolean autoDim=true) throw (SALOME::SALOME_Exception); + CORBA::Boolean autoDim, + const GEOM::ListOfFields& fields, + const char* geomAssocFields) throw (SALOME::SALOME_Exception); void ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart, const char* file) throw (SALOME::SALOME_Exception); void ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart, @@ -368,6 +372,9 @@ public: SMESH::EntityType GetElementGeomType( CORBA::Long id ) throw (SALOME::SALOME_Exception); + SMESH::GeometryType GetElementShape( CORBA::Long id ) + throw (SALOME::SALOME_Exception); + /*! * Returns ID of elements for given submesh */ @@ -433,6 +440,12 @@ public: void checkMeshLoaded(); + /*! + * \brief Update data if geometry changes + * + * Issue 0022501 + */ + void CheckGeomModif(); /*! * \brief Update hypotheses assigned to geom groups if the latter change * @@ -532,6 +545,11 @@ public: */ SMESH::long_array* GetElemFaceNodes(CORBA::Long elemId, CORBA::Short faceIndex); + /*! + * Returns three components of normal of given mesh face (or an empty array in KO case) + */ + SMESH::double_array* GetFaceNormal(CORBA::Long faceId, CORBA::Boolean normalized); + /*! * Returns an element based on all given nodes. */ @@ -577,6 +595,10 @@ public: */ SMESH::string_array* GetLastParameters(); + /*! + * \brief Return \c true if a meshing order not yet set for a concurrent sub-mesh + */ + CORBA::Boolean IsUnorderedSubMesh(CORBA::Long submeshID); /*! * \brief Return submesh objects list in meshing order */ @@ -638,6 +660,13 @@ private: */ void checkGroupNames(); + /* + * Write GEOM fields to MED file + */ + void exportMEDFields( DriverMED_W_Field & writer, + SMESHDS_Mesh* meshDS, + const GEOM::ListOfFields& fields, + const char* geomAssocFields); /*! * Convert submesh ids into submesh interfaces */ @@ -645,6 +674,11 @@ private: SMESH::submesh_array_array& theSubMeshOrder, const bool theIsDump); + /*! + * \brief Finds concurrent sub-meshes + */ + TListOfListOfInt findConcurrentSubMeshes(); + private: static int _idGenerator; @@ -674,6 +708,7 @@ private: CORBA::Object_var _smeshObject; // SMESH object depending on GEOM group }; std::list _geomGroupData; + int _mainShapeTick; // to track modifications of the meshed shape /*! * Remember GEOM group data diff --git a/src/SMESH_I/SMESH_NoteBook.cxx b/src/SMESH_I/SMESH_NoteBook.cxx index 324dd253e..800df2ece 100644 --- a/src/SMESH_I/SMESH_NoteBook.cxx +++ b/src/SMESH_I/SMESH_NoteBook.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_NoteBook.hxx b/src/SMESH_I/SMESH_NoteBook.hxx index 3ef1c8b6b..12491c5be 100644 --- a/src/SMESH_I/SMESH_NoteBook.hxx +++ b/src/SMESH_I/SMESH_NoteBook.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_Pattern_i.cxx b/src/SMESH_I/SMESH_Pattern_i.cxx index ba7fafb00..8a90fb765 100644 --- a/src/SMESH_I/SMESH_Pattern_i.cxx +++ b/src/SMESH_I/SMESH_Pattern_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_Pattern_i.hxx b/src/SMESH_I/SMESH_Pattern_i.hxx index 4032c7a11..ef39ace50 100644 --- a/src/SMESH_I/SMESH_Pattern_i.hxx +++ b/src/SMESH_I/SMESH_Pattern_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_PreMeshInfo.cxx b/src/SMESH_I/SMESH_PreMeshInfo.cxx index 159db363b..59a7e65c8 100644 --- a/src/SMESH_I/SMESH_PreMeshInfo.cxx +++ b/src/SMESH_I/SMESH_PreMeshInfo.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -26,7 +26,9 @@ #include "SMESH_PreMeshInfo.hxx" +#include "DriverMED.hxx" #include "DriverMED_R_SMESHDS_Mesh.h" +#include "MED_Factory.hxx" #include "SMDS_EdgePosition.hxx" #include "SMDS_FacePosition.hxx" #include "SMDS_SpacePosition.hxx" @@ -38,8 +40,6 @@ #include "SMESH_Mesh_i.hxx" #include "SMESH_subMesh_i.hxx" -#include - #include #include #include @@ -228,54 +228,17 @@ namespace static map< MED::EGeometrieElement, SMDSAbs_EntityType> med2smeshTypes; if ( med2smeshTypes.empty() ) { - med2smeshTypes[ MED::ePOINT1 ] = SMDSEntity_0D ; - med2smeshTypes[ MED::eSEG2 ] = SMDSEntity_Edge ; - med2smeshTypes[ MED::eSEG3 ] = SMDSEntity_Quad_Edge ; - med2smeshTypes[ MED::eTRIA3 ] = SMDSEntity_Triangle ; - med2smeshTypes[ MED::eTRIA6 ] = SMDSEntity_Quad_Triangle ; - med2smeshTypes[ MED::eTRIA7 ] = SMDSEntity_BiQuad_Triangle ; - med2smeshTypes[ MED::eQUAD4 ] = SMDSEntity_Quadrangle ; - med2smeshTypes[ MED::eQUAD8 ] = SMDSEntity_Quad_Quadrangle ; - med2smeshTypes[ MED::eQUAD9 ] = SMDSEntity_BiQuad_Quadrangle ; - med2smeshTypes[ MED::eTETRA4 ] = SMDSEntity_Tetra ; - med2smeshTypes[ MED::ePYRA5 ] = SMDSEntity_Pyramid ; - med2smeshTypes[ MED::ePENTA6 ] = SMDSEntity_Penta ; - med2smeshTypes[ MED::eHEXA8 ] = SMDSEntity_Hexa ; - med2smeshTypes[ MED::eOCTA12 ] = SMDSEntity_Hexagonal_Prism ; - med2smeshTypes[ MED::eTETRA10 ] = SMDSEntity_Quad_Tetra ; - med2smeshTypes[ MED::ePYRA13 ] = SMDSEntity_Quad_Pyramid ; - med2smeshTypes[ MED::ePENTA15 ] = SMDSEntity_Quad_Penta ; - med2smeshTypes[ MED::eHEXA20 ] = SMDSEntity_Quad_Hexa ; - med2smeshTypes[ MED::eHEXA27 ] = SMDSEntity_TriQuad_Hexa ; - med2smeshTypes[ MED::ePOLYGONE ] = SMDSEntity_Polygon ; - med2smeshTypes[ MED::ePOLYEDRE ] = SMDSEntity_Polyhedra ; - med2smeshTypes[ MED::eNONE ] = SMDSEntity_Node ; - med2smeshTypes[ MED::eBALL ] = SMDSEntity_Ball ; + for ( int iG = 0; iG < SMDSEntity_Last; ++iG ) + { + SMDSAbs_EntityType smdsType = (SMDSAbs_EntityType) iG; + MED::EGeometrieElement medType = + (MED::EGeometrieElement) DriverMED::GetMedGeoType( smdsType ); + med2smeshTypes.insert( make_pair( medType, smdsType )); + } } return med2smeshTypes; } - //================================================================================ - /*! - * \brief Return a vector intended to retrieve - * MED::EGeometrieElement by SMDSAbs_EntityType - */ - //================================================================================ - - const vector& mesh2medElemType() - { - static vector mesh2medElemTypes; - if ( mesh2medElemTypes.empty() ) - { - mesh2medElemTypes.resize( SMDSEntity_Last + 1 ); - Tmed2smeshElemTypeMap::const_iterator me2sme = med2smeshElemTypeMap().begin(); - Tmed2smeshElemTypeMap::const_iterator me2smeEnd = med2smeshElemTypeMap().end(); - for ( ; me2sme != me2smeEnd; ++me2sme ) - mesh2medElemTypes[ me2sme->second ] = me2sme->first; - } - return mesh2medElemTypes; - } - //================================================================================ /*! * \brief Writes meshInfo into a HDF file @@ -289,14 +252,14 @@ namespace // we use med identification of element (MED::EGeometrieElement) types // but not enum SMDSAbs_EntityType because values of SMDSAbs_EntityType may // change at insertion of new items in the middle. - const vector& medTypes = mesh2medElemType(); + //const vector& medTypes = mesh2medElemType(); vector data; for ( size_t i = 0; i < meshInfo->length(); ++i ) if ( meshInfo[i] > 0 ) { - data.push_back( medTypes[ i ] ); + data.push_back( DriverMED::GetMedGeoType( SMDSAbs_EntityType( i ))); //medTypes[ i ] ); data.push_back( meshInfo[ i ] ); } diff --git a/src/SMESH_I/SMESH_PreMeshInfo.hxx b/src/SMESH_I/SMESH_PreMeshInfo.hxx index 87f83ba2f..ef2351cf1 100644 --- a/src/SMESH_I/SMESH_PreMeshInfo.hxx +++ b/src/SMESH_I/SMESH_PreMeshInfo.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_PythonDump.hxx b/src/SMESH_I/SMESH_PythonDump.hxx index 595e732fa..13d66a497 100644 --- a/src/SMESH_I/SMESH_PythonDump.hxx +++ b/src/SMESH_I/SMESH_PythonDump.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -27,6 +27,7 @@ #include #include CORBA_SERVER_HEADER(SMESH_Mesh) +#include CORBA_SERVER_HEADER(GEOM_Gen) #include CORBA_SERVER_HEADER(SALOMEDS) #include @@ -162,6 +163,9 @@ namespace SMESH TPythonDump& operator<<(const SMESH::string_array& theArg); + TPythonDump& + operator<<(const SMESH::nodes_array& theArg); + TPythonDump& operator<<(SMESH::SMESH_Hypothesis_ptr theArg); @@ -216,6 +220,12 @@ namespace SMESH TPythonDump& operator<<(const SMESH::ListOfGroups * theList); + TPythonDump& + operator<<(const GEOM::ListOfGO& theList); + + TPythonDump& + operator<<(const GEOM::ListOfGBO& theList); + TPythonDump& operator<<(const SMESH::ListOfIDSources& theList); diff --git a/src/SMESH_I/SMESH_subMesh_i.cxx b/src/SMESH_I/SMESH_subMesh_i.cxx index 19a483dcb..ac64d86ad 100644 --- a/src/SMESH_I/SMESH_subMesh_i.cxx +++ b/src/SMESH_I/SMESH_subMesh_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_I/SMESH_subMesh_i.hxx b/src/SMESH_I/SMESH_subMesh_i.hxx index 5282620dd..69fdcd72e 100644 --- a/src/SMESH_I/SMESH_subMesh_i.hxx +++ b/src/SMESH_I/SMESH_subMesh_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_PY/CMakeLists.txt b/src/SMESH_PY/CMakeLists.txt index 22f3d372a..a8ae78e08 100644 --- a/src/SMESH_PY/CMakeLists.txt +++ b/src/SMESH_PY/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_PY/__init__.py b/src/SMESH_PY/__init__.py index ce5d41cdb..3b1f2f4b2 100644 --- a/src/SMESH_PY/__init__.py +++ b/src/SMESH_PY/__init__.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2010-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2010-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_PY/smeshstudytools.py b/src/SMESH_PY/smeshstudytools.py index 4a2a9c692..a04376579 100644 --- a/src/SMESH_PY/smeshstudytools.py +++ b/src/SMESH_PY/smeshstudytools.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,6 +18,16 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + +## \package smeshstudytools Python API to access SMESH objects in the study. + +## \defgroup smeshstudytools Accessing SMESH object in the study +# \{ +# \details +# Module \b smeshstudytools provides a new class SMeshStudyTools to facilitate the +# use of mesh objects in Salome study. +# \} + """ This module provides a new class :class:`SMeshStudyTools` to facilitate the use of mesh objects in Salome study. @@ -31,6 +41,15 @@ from salome.kernel.deprecation import is_called_by_sphinx if not is_called_by_sphinx(): from salome.gui import helper +## This class provides several methods to manipulate mesh objects in Salome +# study. The parameter \em studyEditor defines a \b StudyEditor +# object used to access the study. If \b None, the method returns a +# \b StudyEditor object on the current study. +# +# \b editor +# This instance attribute contains the underlying \b StudyEditor object. +# It can be used to access the study but the attribute itself should not be modified. +# \ingroup smeshstudytools class SMeshStudyTools: """ This class provides several methods to manipulate mesh objects in Salome @@ -56,13 +75,18 @@ class SMeshStudyTools: self.editor = studyEditor self.smeshGui = None + ## This function updates the tools so that it works on the + # specified study. def updateStudy(self, studyId=None): """ This function updates the tools so that it works on the specified study. """ self.editor = getStudyEditor(studyId) - + + ## Get the mesh item owning the mesh group \em meshGroupItem. + # \param meshGroupItem (SObject) mesh group belonging to the searched mesh. + # \return The SObject corresponding to the mesh, or None if it was not found. def getMeshFromGroup(self, meshGroupItem): """ Get the mesh item owning the mesh group `meshGroupItem`. @@ -81,20 +105,22 @@ class SMeshStudyTools: meshItem = salome.ObjectToSObject(meshObj) return meshItem - + ## Returns the MESH object currently selected in the active study. def getMeshObjectSelected(self): - ''' + """ Returns the MESH object currently selected in the active study. - ''' + """ sobject, entry = helper.getSObjectSelected() meshObject = self.getMeshObjectFromEntry(entry) return meshObject + ## Returns the MESH object associated to the specified entry, + # (the entry is the identifier of an item in the objects browser). def getMeshObjectFromEntry(self, entry): - ''' + """ Returns the MESH object associated to the specified entry, (the entry is the identifier of an item in the objects browser). - ''' + """ if entry is None: return None import SMESH @@ -103,12 +129,14 @@ class SMeshStudyTools: meshObject=smesh.IDToObject(entry) return meshObject - + + ## Returns the SMESH object associated to the specified \em SObject, + # (the SObject is an item in the objects browser). def getMeshObjectFromSObject(self, sobject): - ''' + """ Returns the SMESH object associated to the specified SObject, (the SObject is an item in the objects browser). - ''' + """ if sobject is None: return None @@ -116,11 +144,13 @@ class SMeshStudyTools: meshObject = obj._narrow(SMESH.SMESH_Mesh) return meshObject + ## Display the SMESH object associated to the specified \em entry + # (the entry is the identifier of an item in the objects browser). def displayMeshObjectFromEntry(self,entry): - ''' + """ Display the SMESH object associated to the specified entry (the entry is the identifier of an item in the objects browser). - ''' + """ if self.smeshGui is None: self.smeshGui = salome.ImportComponentGUI("SMESH") diff --git a/src/SMESH_SWIG/CMakeLists.txt b/src/SMESH_SWIG/CMakeLists.txt index cc0e6c94b..f11ded911 100644 --- a/src/SMESH_SWIG/CMakeLists.txt +++ b/src/SMESH_SWIG/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/PAL_MESH_041_mesh.py b/src/SMESH_SWIG/PAL_MESH_041_mesh.py index 12c5b8837..672183e8c 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/PAL_MESH_043_2D.py b/src/SMESH_SWIG/PAL_MESH_043_2D.py index a51bf5b00..b36472401 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/PAL_MESH_043_3D.py b/src/SMESH_SWIG/PAL_MESH_043_3D.py index b547265bc..8ed443096 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_AdvancedEditor.py b/src/SMESH_SWIG/SMESH_AdvancedEditor.py index 49062d342..1d8468aad 100644 --- a/src/SMESH_SWIG/SMESH_AdvancedEditor.py +++ b/src/SMESH_SWIG/SMESH_AdvancedEditor.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_BelongToGeom.py b/src/SMESH_SWIG/SMESH_BelongToGeom.py index 4efbc01b4..cfbfdbd42 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_BuildCompound.py b/src/SMESH_SWIG/SMESH_BuildCompound.py index 599b09dd0..30d418663 100644 --- a/src/SMESH_SWIG/SMESH_BuildCompound.py +++ b/src/SMESH_SWIG/SMESH_BuildCompound.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_GroupFromGeom.py b/src/SMESH_SWIG/SMESH_GroupFromGeom.py index 2631388ec..4140aaeb4 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_GroupFromGeom2.py b/src/SMESH_SWIG/SMESH_GroupFromGeom2.py index 9b13c6f61..4e1aeb1f2 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py b/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py index 3c55446cb..54e6b5360 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_Nut.py b/src/SMESH_SWIG/SMESH_Nut.py index fdbeb489c..09637e6c3 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_Partition1_tetra.py b/src/SMESH_SWIG/SMESH_Partition1_tetra.py index 5a85f26ff..16c301efb 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_Sphere.py b/src/SMESH_SWIG/SMESH_Sphere.py index 58d2aadd3..0b745d4c8 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_blocks.py b/src/SMESH_SWIG/SMESH_blocks.py index c5a5e17e6..84fbef2f6 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_box.py b/src/SMESH_SWIG/SMESH_box.py index c38c5292f..d287da529 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_box2_tetra.py b/src/SMESH_SWIG/SMESH_box2_tetra.py index 850df8e66..4677ff760 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_box3_tetra.py b/src/SMESH_SWIG/SMESH_box3_tetra.py index 1e4963d4a..c914e2536 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_box_tetra.py b/src/SMESH_SWIG/SMESH_box_tetra.py index f6edcf762..42797d079 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_controls.py b/src/SMESH_SWIG/SMESH_controls.py index 5084f5c4d..6604c5ba6 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py b/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py index 6e6837816..2423b8898 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_fixation.py b/src/SMESH_SWIG/SMESH_fixation.py index 8a327def5..58baf90b6 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_fixation_hexa.py b/src/SMESH_SWIG/SMESH_fixation_hexa.py index 489a2971f..7c30de974 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_fixation_netgen.py b/src/SMESH_SWIG/SMESH_fixation_netgen.py index 1f31fdd20..5fa307f9c 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_fixation_tetra.py b/src/SMESH_SWIG/SMESH_fixation_tetra.py index 77d1d37e1..0964cff0d 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_flight_skin.py b/src/SMESH_SWIG/SMESH_flight_skin.py index fce24d749..699bca493 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_freebord.py b/src/SMESH_SWIG/SMESH_freebord.py index 809fbff8d..b5be912c4 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_hexaedre.py b/src/SMESH_SWIG/SMESH_hexaedre.py index dc9b617b5..1284b20e5 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_mechanic.py b/src/SMESH_SWIG/SMESH_mechanic.py index 784ccd373..bd1b239dc 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_mechanic_editor.py b/src/SMESH_SWIG/SMESH_mechanic_editor.py index c973d4b44..2db6baf0f 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_editor.py +++ b/src/SMESH_SWIG/SMESH_mechanic_editor.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_mechanic_netgen.py b/src/SMESH_SWIG/SMESH_mechanic_netgen.py index 280975e64..a6a757a0a 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_mechanic_tetra.py b/src/SMESH_SWIG/SMESH_mechanic_tetra.py index 68996d81c..7a72d6f5c 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_reg.py b/src/SMESH_SWIG/SMESH_reg.py index 2880748b2..8883aba83 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_shared_modules.py b/src/SMESH_SWIG/SMESH_shared_modules.py index 57098e8f1..f8bdb0f58 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_test.py b/src/SMESH_SWIG/SMESH_test.py index c296df6fd..5a2c43eac 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_test0.py b/src/SMESH_SWIG/SMESH_test0.py index 0ddb6f3c6..ce8ffb33c 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_test1.py b/src/SMESH_SWIG/SMESH_test1.py index 2a34cec6c..5a4237e0a 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_test1_AndDisplay.py b/src/SMESH_SWIG/SMESH_test1_AndDisplay.py index c3a09133d..30eb5e17b 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_test2.py b/src/SMESH_SWIG/SMESH_test2.py index c2aa883ec..9c11bb8b9 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_test3.py b/src/SMESH_SWIG/SMESH_test3.py index 5a967a42e..65bb26292 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_test4.py b/src/SMESH_SWIG/SMESH_test4.py index ea8bc3c8c..bd63444ed 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/SMESH_test5.py b/src/SMESH_SWIG/SMESH_test5.py index 625a82f9e..df88ecc30 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/StdMeshersBuilder.py b/src/SMESH_SWIG/StdMeshersBuilder.py index e28659b55..1e9c73533 100644 --- a/src/SMESH_SWIG/StdMeshersBuilder.py +++ b/src/SMESH_SWIG/StdMeshersBuilder.py @@ -1,9 +1,9 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -199,7 +199,8 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm): hyp.SetDeflection(deflection) return hyp - ## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with increasing arithmetic length + ## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with a length + # that changes in arithmetic progression # @param start defines the length of the first segment # @param end defines the length of the last segment # @param reversedEdges is a list of edges to mesh using reversed orientation. @@ -226,6 +227,32 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm): hyp.SetObjectEntry( entry ) return hyp + ## Defines "GeometricProgression" hypothesis to cut an edge in several + # segments with a length that changes in Geometric progression + # @param start defines the length of the first segment + # @param ratio defines the common ratio of the geometric progression + # @param reversedEdges is a list of edges to mesh using reversed orientation. + # A list item can also be a tuple (edge, 1st_vertex_of_edge) + # @param UseExisting if ==true - searches for an existing hypothesis created with + # the same parameters, else (default) - creates a new one + # @return an instance of StdMeshers_Geometric1D hypothesis + # @ingroup l3_hypos_1dhyps + def GeometricProgression(self, start, ratio, reversedEdges=[], UseExisting=0): + reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges) + entry = self.MainShapeEntry() + from salome.smesh.smeshBuilder import IsEqual + compFun = lambda hyp, args: ( IsEqual(hyp.GetLength(1), args[0]) and \ + IsEqual(hyp.GetLength(0), args[1]) and \ + hyp.GetReversedEdges() == args[2] and \ + (not args[2] or hyp.GetObjectEntry() == args[3])) + hyp = self.Hypothesis("GeometricProgression", [start, ratio, reversedEdgeInd, entry], + UseExisting=UseExisting, CompareMethod=compFun) + hyp.SetStartLength( start ) + hyp.SetCommonRatio( ratio ) + hyp.SetReversedEdges( reversedEdgeInd ) + hyp.SetObjectEntry( entry ) + return hyp + ## Defines "FixedPoints1D" hypothesis to cut an edge using parameter # on curve from 0 to 1 (additionally it is neecessary to check # orientation of edges and create list of reversed edges if it is @@ -237,7 +264,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm): # A list item can also be a tuple (edge, 1st_vertex_of_edge) # @param UseExisting if ==true - searches for an existing hypothesis created with # the same parameters, else (default) - creates a new one - # @return an instance of StdMeshers_Arithmetic1D hypothesis + # @return an instance of StdMeshers_FixedPoints1D hypothesis # @ingroup l3_hypos_1dhyps def FixedPoints1D(self, points, nbSegs=[1], reversedEdges=[], UseExisting=0): if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges @@ -295,12 +322,23 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm): hyp.SetDeflection(d) return hyp - ## Defines "Propagation" hypothesis that propagates all other hypotheses on all other edges that are at - # the opposite side in case of quadrangular faces + ## Defines "Propagation" hypothesis that propagates 1D hypotheses + # from an edge where this hypothesis is assigned to + # on all other edges that are at the opposite side in case of quadrangular faces + # This hypothesis should be assigned to an edge to propagate a hypothesis from. # @ingroup l3_hypos_additi def Propagation(self): return self.Hypothesis("Propagation", UseExisting=1, CompareMethod=self.CompareEqualHyp) + ## Defines "Propagation of Node Distribution" hypothesis that propagates + # distribution of nodes from an edge where this hypothesis is assigned to, + # to opposite edges of quadrangular faces, so that number of segments on all these + # edges will be the same, as well as relations between segment lengths. + # @ingroup l3_hypos_additi + def PropagationOfDistribution(self): + return self.Hypothesis("PropagOfDistribution", UseExisting=1, + CompareMethod=self.CompareEqualHyp) + ## Defines "AutomaticLength" hypothesis # @param fineness for the fineness [0-1] # @param UseExisting if ==true - searches for an existing hypothesis created with the @@ -552,28 +590,56 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm): # same number of segments, the other pair must have an even difference # between the numbers of segments on the sides. # @param triangleVertex: 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 + # 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 enfVertices: list of shapes defining positions where nodes (enforced nodes) + # must be created by the mesher. Shapes can be of any type, + # vertices of given shapes define positions of enforced nodes. + # Only vertices successfully projected to the face are used. + # @param enfPoints: list of points giving positions of enforced nodes. + # Point can be defined either as SMESH.PointStruct's + # ([SMESH.PointStruct(x1,y1,z1), SMESH.PointStruct(x2,y2,z2),...]) + # or triples of values ([[x1,y1,z1], [x2,y2,z2], ...]). + # In the case if the defined QuadrangleParameters() refer to a sole face, + # all given points must lie on this face, else the mesher fails. + # @param UseExisting: if \c True - searches for the existing hypothesis created with + # the same parameters, else (default) - creates a new one # @ingroup l3_hypos_quad - def QuadrangleParameters(self, quadType=StdMeshers.QUAD_STANDARD, triangleVertex=0, UseExisting=0): - import GEOM + def QuadrangleParameters(self, quadType=StdMeshers.QUAD_STANDARD, triangleVertex=0, + enfVertices=[],enfPoints=[],UseExisting=0): + import GEOM, SMESH vertexID = triangleVertex if isinstance( triangleVertex, GEOM._objref_GEOM_Object ): vertexID = self.mesh.geompyD.GetSubShapeID( self.mesh.geom, triangleVertex ) + if isinstance( enfVertices, int ) and not enfPoints and not UseExisting: + # a call of old syntax, before inserting enfVertices and enfPoints before UseExisting + UseExisting, enfVertices = enfVertices, [] + pStructs, xyz = [], [] + for p in enfPoints: + if isinstance( p, SMESH.PointStruct ): + xyz.append(( p.x, p.y, p.z )) + pStructs.append( p ) + else: + xyz.append(( p[0], p[1], p[2] )) + pStructs.append( SMESH.PointStruct( p[0], p[1], p[2] )) if not self.params: compFun = lambda hyp,args: \ hyp.GetQuadType() == args[0] and \ - ( hyp.GetTriaVertex()==args[1] or ( hyp.GetTriaVertex()<1 and args[1]<1)) - self.params = self.Hypothesis("QuadrangleParams", [quadType,vertexID], + (hyp.GetTriaVertex()==args[1] or ( hyp.GetTriaVertex()<1 and args[1]<1)) and \ + ((hyp.GetEnforcedNodes()) == (args[2],args[3])) # True w/o enfVertices only + entries = [ shape.GetStudyEntry() for shape in enfVertices ] + self.params = self.Hypothesis("QuadrangleParams", [quadType,vertexID,entries,xyz], UseExisting = UseExisting, CompareMethod=compFun) pass if self.params.GetQuadType() != quadType: self.params.SetQuadType(quadType) if vertexID > 0: self.params.SetTriaVertex( vertexID ) + from salome.smesh.smeshBuilder import AssureGeomPublished + for v in enfVertices: + AssureGeomPublished( self.mesh, v ) + self.params.SetEnforcedNodes( enfVertices, pStructs ) return self.params ## Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only @@ -980,7 +1046,8 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): return hyp ## Defines "Arithmetic1D" hypothesis, specifying the distribution of segments - # to build between the inner and the outer shells with a length that changes in arithmetic progression + # to build between the inner and the outer shells with a length that changes + # in arithmetic progression # @param start the length of the first segment # @param end the length of the last segment def Arithmetic1D(self, start, end ): @@ -992,6 +1059,20 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): hyp.SetLength(end , 0) return hyp + ## Defines "GeometricProgression" hypothesis, specifying the distribution of segments + # to build between the inner and the outer shells with a length that changes + # in Geometric progression + # @param start the length of the first segment + # @param ratio the common ratio of the geometric progression + def GeometricProgression(self, start, ratio ): + if self.algoType != "RadialPrism_3D": + print "Prism_3D algorith doesn't support any hyposesis" + return None + hyp = self.OwnHypothesis("GeometricProgression", [start, ratio]) + hyp.SetStartLength( start ) + hyp.SetCommonRatio( ratio ) + return hyp + ## Defines "StartEndLength" hypothesis, specifying distribution of segments # to build between the inner and the outer shells as geometric length increasing # @param start for the length of the first segment @@ -1148,6 +1229,16 @@ class StdMeshersBuilder_RadialQuadrangle1D2D(Mesh_Algorithm): hyp.SetLength(end , 0) return hyp + ## Defines "GeometricProgression" hypothesis, specifying the distribution of segments + # with a length that changes in Geometric progression + # @param start the length of the first segment + # @param ratio the common ratio of the geometric progression + def GeometricProgression(self, start, ratio ): + hyp = self.OwnHypothesis("GeometricProgression", [start, ratio]) + hyp.SetStartLength( start ) + hyp.SetCommonRatio( ratio ) + return hyp + ## Defines "StartEndLength" hypothesis, specifying distribution of segments # as geometric length increasing # @param start for the length of the first segment @@ -1309,22 +1400,21 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm): # Examples: # - "10.5" - defines a grid with a constant spacing # - [["1", "1+10*t", "11"] [0.1, 0.6]] - defines different spacing in 3 ranges. - # @param yGridDef defines the grid along the Y asix the same way as \a xGridDef does - # @param zGridDef defines the grid along the Z asix the same way as \a xGridDef does + # @param yGridDef defines the grid along the Y asix the same way as \a xGridDef does. + # @param zGridDef defines the grid along the Z asix the same way as \a xGridDef does. # @param sizeThreshold (> 1.0) defines a minimal size of a polyhedron so that - # a polyhedron of size less than hexSize/sizeThreshold is not created - # @param UseExisting if ==true - searches for the existing hypothesis created with - # the same parameters, else (default) - creates a new one - def SetGrid(self, xGridDef, yGridDef, zGridDef, sizeThreshold=4.0, UseExisting=False): + # a polyhedron of size less than hexSize/sizeThreshold is not created. + # @param implEdges enables implementation of geometrical edges into the mesh. + def SetGrid(self, xGridDef, yGridDef, zGridDef, sizeThreshold=4.0, implEdges=False): if not self.hyp: compFun = lambda hyp, args: False self.hyp = self.Hypothesis("CartesianParameters3D", [xGridDef, yGridDef, zGridDef, sizeThreshold], - UseExisting=UseExisting, CompareMethod=compFun) + UseExisting=False, CompareMethod=compFun) if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ): self.mesh.AddHypothesis( self.hyp, self.geom ) - for axis, gridDef in enumerate( [xGridDef, yGridDef, zGridDef]): + for axis, gridDef in enumerate( [xGridDef, yGridDef, zGridDef] ): if not gridDef: raise ValueError, "Empty grid definition" if isinstance( gridDef, str ): self.hyp.SetGridSpacing( [gridDef], [], axis ) @@ -1336,8 +1426,69 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm): else: self.hyp.SetGridSpacing( gridDef[0], gridDef[1], axis ) self.hyp.SetSizeThreshold( sizeThreshold ) + self.hyp.SetToAddEdges( implEdges ) return self.hyp + ## Defines custom directions of axes of the grid + # @param xAxis either SMESH.DirStruct or a vector, or 3 vector components + # @param yAxis either SMESH.DirStruct or a vector, or 3 vector components + # @param zAxis either SMESH.DirStruct or a vector, or 3 vector components + def SetAxesDirs( self, xAxis, yAxis, zAxis ): + import GEOM + if hasattr( xAxis, "__getitem__" ): + xAxis = self.mesh.smeshpyD.MakeDirStruct( xAxis[0],xAxis[1],xAxis[2] ) + elif isinstance( xAxis, GEOM._objref_GEOM_Object ): + xAxis = self.mesh.smeshpyD.GetDirStruct( xAxis ) + if hasattr( yAxis, "__getitem__" ): + yAxis = self.mesh.smeshpyD.MakeDirStruct( yAxis[0],yAxis[1],yAxis[2] ) + elif isinstance( yAxis, GEOM._objref_GEOM_Object ): + yAxis = self.mesh.smeshpyD.GetDirStruct( yAxis ) + if hasattr( zAxis, "__getitem__" ): + zAxis = self.mesh.smeshpyD.MakeDirStruct( zAxis[0],zAxis[1],zAxis[2] ) + elif isinstance( zAxis, GEOM._objref_GEOM_Object ): + zAxis = self.mesh.smeshpyD.GetDirStruct( zAxis ) + if not self.hyp: + self.hyp = self.Hypothesis("CartesianParameters3D") + if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ): + self.mesh.AddHypothesis( self.hyp, self.geom ) + self.hyp.SetAxesDirs( xAxis, yAxis, zAxis ) + return self.hyp + + ## Automatically defines directions of axes of the grid at which + # a number of generated hexahedra is maximal + # @param isOrthogonal defines whether the axes mush be orthogonal + def SetOptimalAxesDirs(self, isOrthogonal=True): + if not self.hyp: + self.hyp = self.Hypothesis("CartesianParameters3D") + if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ): + self.mesh.AddHypothesis( self.hyp, self.geom ) + x,y,z = self.hyp.ComputeOptimalAxesDirs( self.geom, isOrthogonal ) + self.hyp.SetAxesDirs( x,y,z ) + return self.hyp + + ## Sets/unsets a fixed point. The algorithm makes a plane of the grid pass + # through the fixed point in each direction at which the grid is defined + # by spacing + # @param p coordinates of the fixed point. Either SMESH.PointStruct or + # a vertex or 3 components of coordinates. + # @param toUnset defines whether the fixed point is defined or removed. + def SetFixedPoint( self, p, toUnset=False ): + import SMESH, GEOM + if toUnset: + if not self.hyp: return + p = SMESH.PointStruct(0,0,0) + elif hasattr( p, "__getitem__" ): + p = SMESH.PointStruct( p[0],p[1],p[2] ) + elif isinstance( p, GEOM._objref_GEOM_Object ): + p = self.mesh.smeshpyD.GetPointStruct( p ) + if not self.hyp: + self.hyp = self.Hypothesis("CartesianParameters3D") + if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ): + self.mesh.AddHypothesis( self.hyp, self.geom ) + self.hyp.SetFixedPoint( p, toUnset ) + return self.hyp + + pass # end of StdMeshersBuilder_Cartesian_3D class ## Defines a stub 1D algorithm, which enables "manual" creation of nodes and diff --git a/src/SMESH_SWIG/__init__.py b/src/SMESH_SWIG/__init__.py index 630e0eda8..af0e5b208 100644 --- a/src/SMESH_SWIG/__init__.py +++ b/src/SMESH_SWIG/__init__.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/batchmode_mefisto.py b/src/SMESH_SWIG/batchmode_mefisto.py index 608edbd83..d3e5ced2d 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/batchmode_smesh.py b/src/SMESH_SWIG/batchmode_smesh.py index df4ce35c6..0d92fa69e 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex00_all.py b/src/SMESH_SWIG/ex00_all.py index 18cd1f284..3c75a1a8c 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex01_cube2build.py b/src/SMESH_SWIG/ex01_cube2build.py index 76b3a3840..aac3b4fc8 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex02_cube2primitive.py b/src/SMESH_SWIG/ex02_cube2primitive.py index e064c2ec7..1080b3957 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex03_cube2partition.py b/src/SMESH_SWIG/ex03_cube2partition.py index ea1c24cf4..a339e350e 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex04_cube5tetraHexa.py b/src/SMESH_SWIG/ex04_cube5tetraHexa.py index fae90efe0..fae3a095f 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex05_hole1build.py b/src/SMESH_SWIG/ex05_hole1build.py index 1c0493df8..b7a55672e 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex06_hole1boolean.py b/src/SMESH_SWIG/ex06_hole1boolean.py index 7729e0379..45a831cfd 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex07_hole1partition.py b/src/SMESH_SWIG/ex07_hole1partition.py index d6ec2a23c..1b5cd2c99 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex08_hole2build.py b/src/SMESH_SWIG/ex08_hole2build.py index 0c33f99a4..1b00e2dd7 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex09_grid4build.py b/src/SMESH_SWIG/ex09_grid4build.py index a015b75e2..367fbdd25 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex10_grid4geometry.py b/src/SMESH_SWIG/ex10_grid4geometry.py index c743d40d4..d129ffea4 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex11_grid3partition.py b/src/SMESH_SWIG/ex11_grid3partition.py index 3d3e336f3..197132f41 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex12_grid17partition.py b/src/SMESH_SWIG/ex12_grid17partition.py index b8f550880..a548126d4 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex13_hole1partial.py b/src/SMESH_SWIG/ex13_hole1partial.py index 772df4bd3..e34f06c2b 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex14_cyl1holed.py b/src/SMESH_SWIG/ex14_cyl1holed.py index 02eb337af..6f007504e 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex15_cyl2geometry.py b/src/SMESH_SWIG/ex15_cyl2geometry.py index 4f77b34b5..27f4c6115 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex16_cyl2complementary.py b/src/SMESH_SWIG/ex16_cyl2complementary.py index bab16b2e9..1f98e3f1d 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex17_dome1.py b/src/SMESH_SWIG/ex17_dome1.py index c94c55d4c..a204dcafc 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex18_dome2.py b/src/SMESH_SWIG/ex18_dome2.py index db66d8514..be243ac99 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex19_sphereINcube.py b/src/SMESH_SWIG/ex19_sphereINcube.py index b8ffcf36b..d59b048a5 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex21_lamp.py b/src/SMESH_SWIG/ex21_lamp.py index 40ae9591d..ebd582a8d 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-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex24_cylinder.py b/src/SMESH_SWIG/ex24_cylinder.py index 0ab9ddaec..f510c05fa 100644 --- a/src/SMESH_SWIG/ex24_cylinder.py +++ b/src/SMESH_SWIG/ex24_cylinder.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex29_refine.py b/src/SMESH_SWIG/ex29_refine.py index 6325ed890..a709614fa 100644 --- a/src/SMESH_SWIG/ex29_refine.py +++ b/src/SMESH_SWIG/ex29_refine.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex30_groupsOp.py b/src/SMESH_SWIG/ex30_groupsOp.py index 5cae0b029..53dcd14a7 100755 --- a/src/SMESH_SWIG/ex30_groupsOp.py +++ b/src/SMESH_SWIG/ex30_groupsOp.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex30_tepal.py b/src/SMESH_SWIG/ex30_tepal.py index fd41f3aae..f40a8284a 100644 --- a/src/SMESH_SWIG/ex30_tepal.py +++ b/src/SMESH_SWIG/ex30_tepal.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/ex31_dimGroup.py b/src/SMESH_SWIG/ex31_dimGroup.py index 65830faac..037dfcec7 100755 --- a/src/SMESH_SWIG/ex31_dimGroup.py +++ b/src/SMESH_SWIG/ex31_dimGroup.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/smesh.py b/src/SMESH_SWIG/smesh.py index 99ab3db11..d5ba24ac3 100644 --- a/src/SMESH_SWIG/smesh.py +++ b/src/SMESH_SWIG/smesh.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index 5e68dc230..ce0a35594 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -1,9 +1,9 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -73,7 +73,7 @@ ## @defgroup l2_modif_invdiag Diagonal inversion of elements ## @defgroup l2_modif_unitetri Uniting triangles ## @defgroup l2_modif_changori Changing orientation of elements -## @defgroup l2_modif_cutquadr Cutting quadrangles +## @defgroup l2_modif_cutquadr Cutting elements ## @defgroup l2_modif_smooth Smoothing ## @defgroup l2_modif_extrurev Extrusion and Revolution ## @defgroup l2_modif_patterns Pattern mapping @@ -93,6 +93,16 @@ import SALOME import SALOMEDS import os +class MeshMeta(type): + def __instancecheck__(cls, inst): + """Implement isinstance(inst, cls).""" + return any(cls.__subclasscheck__(c) + for c in {type(inst), inst.__class__}) + + def __subclasscheck__(cls, sub): + """Implement issubclass(sub, cls).""" + return type.__subclasscheck__(cls, sub) or (cls.__name__ == sub.__name__ and cls.__module__ == sub.__module__) + ## @addtogroup l1_auxiliary ## @{ @@ -307,7 +317,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): [TopAbs_IN, TopAbs_OUT, TopAbs_ON, TopAbs_UNKNOWN] = range(4) # Methods of splitting a hexahedron into tetrahedra - Hex_5Tet, Hex_6Tet, Hex_24Tet = 1, 2, 3 + Hex_5Tet, Hex_6Tet, Hex_24Tet, Hex_2Prisms, Hex_4Prisms = 1, 2, 3, 1, 2 def __new__(cls): global engine @@ -374,9 +384,12 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): #print "init_smesh" self.SetCurrentStudy(theStudy,geompyD) - ## Creates an empty Mesh. This mesh can have an underlying geometry. - # @param obj the Geometrical object on which the mesh is built. If not defined, - # the mesh will have no underlying geometry. + ## Creates a mesh. This can be either an empty mesh, possibly having an underlying geometry, + # or a mesh wrapping a CORBA mesh given as a parameter. + # @param obj either (1) a CORBA mesh (SMESH._objref_SMESH_Mesh) got e.g. by calling + # salome.myStudy.FindObjectID("0:1:2:3").GetObject() or + # (2) a Geometrical object for meshing or + # (3) none. # @param name the name for the new mesh. # @return an instance of Mesh class. # @ingroup l2_construct @@ -851,11 +864,15 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): ## Creates a filter from criteria # @param criteria a list of criteria + # @param binOp binary operator used when binary operator of criteria is undefined # @return SMESH_Filter # # Example of Filters usage # @ingroup l1_controls - def GetFilterFromCriteria(self,criteria): + def GetFilterFromCriteria(self,criteria, binOp=SMESH.FT_LogicalAND): + for i in range( len( criteria ) - 1 ): + if criteria[i].BinaryOp == self.EnumToLong( SMESH.FT_Undefined ): + criteria[i].BinaryOp = self.EnumToLong( binOp ) aFilterMgr = self.CreateFilterManager() aFilter = aFilterMgr.CreateFilter() aFilter.SetCriteria(criteria) @@ -1140,6 +1157,7 @@ def New( study, instance=None): # new nodes and elements and by changing the existing entities), to get information # about a mesh and to export a mesh into different formats. class Mesh: + __metaclass__ = MeshMeta geom = 0 mesh = 0 @@ -1548,13 +1566,24 @@ class Mesh: if not geom: geom = self.mesh.GetShapeToMesh() pass - AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName()) - status = self.mesh.AddHypothesis(geom, hyp) - isAlgo = hyp._narrow( SMESH_Algo ) + isApplicable = True + if self.mesh.HasShapeToMesh(): + hyp_type = hyp.GetName() + lib_name = hyp.GetLibName() + checkAll = ( not geom.IsSame( self.mesh.GetShapeToMesh() )) + if checkAll and geom: + checkAll = geom.GetType() == 37 + isApplicable = self.smeshpyD.IsApplicable(hyp_type, lib_name, geom, checkAll) + if isApplicable: + AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName()) + status = self.mesh.AddHypothesis(geom, hyp) + else: + status = HYP_BAD_GEOMETRY hyp_name = GetName( hyp ) geom_name = "" if geom: - geom_name = GetName( geom ) + geom_name = geom.GetName() + isAlgo = hyp._narrow( SMESH_Algo ) TreatHypoStatus( status, hyp_name, geom_name, isAlgo ) return status @@ -1626,17 +1655,24 @@ class Mesh: # - 1D if all mesh nodes lie on OX coordinate axis, or # - 2D if all mesh nodes lie on XOY coordinate plane, or # - 3D in the rest cases. - # # If @a autoDimension is @c False, the space dimension is always 3. + # @param fields : list of GEOM fields defined on the shape to mesh. + # @param geomAssocFields : each character of this string means a need to export a + # corresponding field; correspondence between fields and characters is following: + # - 'v' stands for _vertices_ field; + # - 'e' stands for _edges_ field; + # - 'f' stands for _faces_ field; + # - 's' stands for _solids_ field. # @ingroup l2_impexp def ExportMED(self, f, auto_groups=0, version=MED_V2_2, - overwrite=1, meshPart=None, autoDimension=True): - if meshPart: + overwrite=1, meshPart=None, autoDimension=True, fields=[], geomAssocFields=''): + if meshPart or fields or geomAssocFields: unRegister = genObjUnRegister() if isinstance( meshPart, list ): meshPart = self.GetIDSource( meshPart, SMESH.ALL ) unRegister.set( meshPart ) - self.mesh.ExportPartToMED( meshPart, f, auto_groups, version, overwrite, autoDimension) + self.mesh.ExportPartToMED( meshPart, f, auto_groups, version, overwrite, autoDimension, + fields, geomAssocFields) else: self.mesh.ExportToMEDX(f, auto_groups, version, overwrite, autoDimension) @@ -1897,7 +1933,7 @@ class Mesh: def RemoveGroupWithContents(self, group): self.mesh.RemoveGroupWithContents(group) - ## Gets the list of groups existing in the mesh + ## Gets the list of groups existing in the mesh in the order of creation (starting from the oldest one) # @return a sequence of SMESH_GroupBase # @ingroup l2_grps_create def GetGroups(self): @@ -2284,6 +2320,12 @@ class Mesh: def GetElementGeomType(self, id): return self.mesh.GetElementGeomType(id) + ## Returns the shape type of mesh element + # @return the value from SMESH::GeometryType enumeration + # @ingroup l1_meshinfo + def GetElementShape(self, id): + return self.mesh.GetElementShape(id) + ## Returns the list of submesh elements IDs # @param Shape a geom object(sub-shape) IOR # Shape must be the sub-shape of a ShapeToMesh() @@ -2418,6 +2460,12 @@ class Mesh: def GetElemFaceNodes(self,elemId, faceIndex): return self.mesh.GetElemFaceNodes(elemId, faceIndex) + ## Returns three components of normal of given mesh face + # (or an empty array in KO case) + # @ingroup l1_meshinfo + def GetFaceNormal(self, faceId, normalized=False): + return self.mesh.GetFaceNormal(faceId,normalized) + ## Returns an element based on all given nodes. # @ingroup l1_meshinfo def FindElementByNodes(self,nodes): @@ -3020,18 +3068,60 @@ class Mesh: 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: Hex_5Tet, Hex_6Tet, Hex_24Tet - # Hex_5Tet - split the hexahedron into 5 tetrahedrons, etc + # @param elems either a list of elements or a mesh or a group or a submesh or a filter + # @param method flags passing splitting method: + # smesh.Hex_5Tet, smesh.Hex_6Tet, smesh.Hex_24Tet. + # smesh.Hex_5Tet - to split the hexahedron into 5 tetrahedrons, etc. + # @ingroup l2_modif_cutquadr + def SplitVolumesIntoTetra(self, elems, method=smeshBuilder.Hex_5Tet ): + unRegister = genObjUnRegister() + if isinstance( elems, Mesh ): + elems = elems.GetMesh() + if ( isinstance( elems, list )): + elems = self.editor.MakeIDSource(elems, SMESH.VOLUME) + unRegister.set( elems ) + self.editor.SplitVolumesIntoTetra(elems, method) + + ## Splits hexahedra into prisms + # @param elems either a list of elements or a mesh or a group or a submesh or a filter + # @param startHexPoint a point used to find a hexahedron for which @a facetNormal + # gives a normal vector defining facets to split into triangles. + # @a startHexPoint can be either a triple of coordinates or a vertex. + # @param facetNormal a normal to a facet to split into triangles of a + # hexahedron found by @a startHexPoint. + # @a facetNormal can be either a triple of coordinates or an edge. + # @param method flags passing splitting method: smesh.Hex_2Prisms, smesh.Hex_4Prisms. + # smesh.Hex_2Prisms - to split the hexahedron into 2 prisms, etc. + # @param allDomains if @c False, only hexahedra adjacent to one closest + # to @a startHexPoint are split, else @a startHexPoint + # is used to find the facet to split in all domains present in @a elems. # @ingroup l2_modif_cutquadr - def SplitVolumesIntoTetra(self, elemIDs, method=smeshBuilder.Hex_5Tet ): + def SplitHexahedraIntoPrisms(self, elems, startHexPoint, facetNormal, + method=smeshBuilder.Hex_2Prisms, allDomains=False ): + # IDSource unRegister = genObjUnRegister() - if isinstance( elemIDs, Mesh ): - elemIDs = elemIDs.GetMesh() - if ( isinstance( elemIDs, list )): - elemIDs = self.editor.MakeIDSource(elemIDs, SMESH.VOLUME) - unRegister.set( elemIDs ) - self.editor.SplitVolumesIntoTetra(elemIDs, method) + if isinstance( elems, Mesh ): + elems = elems.GetMesh() + if ( isinstance( elems, list )): + elems = self.editor.MakeIDSource(elems, SMESH.VOLUME) + unRegister.set( elems ) + pass + # axis + if isinstance( startHexPoint, geomBuilder.GEOM._objref_GEOM_Object): + startHexPoint = self.smeshpyD.GetPointStruct( startHexPoint ) + elif isinstance( startHexPoint, list ): + startHexPoint = SMESH.PointStruct( startHexPoint[0], + startHexPoint[1], + startHexPoint[2]) + if isinstance( facetNormal, geomBuilder.GEOM._objref_GEOM_Object): + facetNormal = self.smeshpyD.GetDirStruct( facetNormal ) + elif isinstance( facetNormal, list ): + facetNormal = self.smeshpyD.MakeDirStruct( facetNormal[0], + facetNormal[1], + facetNormal[2]) + self.mesh.SetParameters( startHexPoint.parameters + facetNormal.PS.parameters ) + + self.editor.SplitHexahedraIntoPrisms(elems, startHexPoint, facetNormal, method, allDomains) ## Splits quadrangle faces near triangular facets of volumes # @@ -3181,7 +3271,8 @@ class Mesh: # Note that nodes built on edges and boundary nodes are always fixed. # @param MaxNbOfIterations the maximum number of iterations # @param MaxAspectRatio varies in range [1.0, inf] - # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + # @param Method is either Laplacian (smesh.LAPLACIAN_SMOOTH) + # or Centroidal (smesh.CENTROIDAL_SMOOTH) # @return TRUE in case of success, FALSE otherwise. # @ingroup l2_modif_smooth def Smooth(self, IDsOfElements, IDsOfFixedNodes, @@ -3199,7 +3290,8 @@ class Mesh: # Note that nodes built on edges and boundary nodes are always fixed. # @param MaxNbOfIterations the maximum number of iterations # @param MaxAspectRatio varies in range [1.0, inf] - # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + # @param Method is either Laplacian (smesh.LAPLACIAN_SMOOTH) + # or Centroidal (smesh.CENTROIDAL_SMOOTH) # @return TRUE in case of success, FALSE otherwise. # @ingroup l2_modif_smooth def SmoothObject(self, theObject, IDsOfFixedNodes, @@ -3215,7 +3307,8 @@ class Mesh: # Note that nodes built on edges and boundary nodes are always fixed. # @param MaxNbOfIterations the maximum number of iterations # @param MaxAspectRatio varies in range [1.0, inf] - # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + # @param Method is either Laplacian (smesh.LAPLACIAN_SMOOTH) + # or Centroidal (smesh.CENTROIDAL_SMOOTH) # @return TRUE in case of success, FALSE otherwise. # @ingroup l2_modif_smooth def SmoothParametric(self, IDsOfElements, IDsOfFixedNodes, @@ -3233,7 +3326,8 @@ class Mesh: # Note that nodes built on edges and boundary nodes are always fixed. # @param MaxNbOfIterations the maximum number of iterations # @param MaxAspectRatio varies in range [1.0, inf] - # @param Method Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + # @param Method is either Laplacian (smesh.LAPLACIAN_SMOOTH) + # or Centroidal (smesh.CENTROIDAL_SMOOTH) # @return TRUE in case of success, FALSE otherwise. # @ingroup l2_modif_smooth def SmoothParametricObject(self, theObject, IDsOfFixedNodes, @@ -4412,9 +4506,11 @@ class Mesh: # Triangles are transformed in prisms, and quadrangles in hexahedrons. # @param theDomains - list of groups of volumes # @param createJointElems - if TRUE, create the elements + # @param onAllBoundaries - if TRUE, the nodes and elements are also created on + # the boundary between \a theDomains and the rest mesh # @return TRUE if operation has been completed successfully, FALSE otherwise - def DoubleNodesOnGroupBoundaries(self, theDomains, createJointElems ): - return self.editor.DoubleNodesOnGroupBoundaries( theDomains, createJointElems ) + def DoubleNodesOnGroupBoundaries(self, theDomains, createJointElems, onAllBoundaries=False ): + return self.editor.DoubleNodesOnGroupBoundaries( theDomains, createJointElems, onAllBoundaries ) ## Double nodes on some external faces and create flat elements. # Flat elements are mainly used by some types of mechanic calculations. @@ -4534,7 +4630,7 @@ class Mesh: return self._valueFromFunctor(SMESH.FT_Skew, elemId) pass # end of Mesh class - + ## Helper class for wrapping of SMESH.SMESH_Pattern CORBA class # class Pattern(SMESH._objref_SMESH_Pattern): diff --git a/src/SMESH_SWIG/smesh_algorithm.py b/src/SMESH_SWIG/smesh_algorithm.py index a81f825a6..cac705e12 100644 --- a/src/SMESH_SWIG/smesh_algorithm.py +++ b/src/SMESH_SWIG/smesh_algorithm.py @@ -1,9 +1,9 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -195,21 +195,14 @@ class Mesh_Algorithm: if geom is None and mesh.mesh.HasShapeToMesh(): raise RuntimeError, "Attemp to create " + algo + " algoritm on None shape" self.mesh = mesh - name = "" if not geom or geom.IsSame( mesh.geom ): self.geom = mesh.geom else: self.geom = geom AssureGeomPublished( mesh, geom ) - try: - name = GetName(geom) - pass - except: - pass self.subm = mesh.mesh.GetSubMesh(geom, algo.GetName()) self.algo = algo - status = mesh.mesh.AddHypothesis(self.geom, self.algo) - TreatHypoStatus( status, algo.GetName(), name, True ) + status = mesh.AddHypothesis(self.algo, self.geom) return def CompareHyp (self, hyp, args): @@ -267,21 +260,26 @@ class Mesh_Algorithm: # @param thickness total thickness of layers of prisms # @param numberOfLayers number of layers of prisms # @param stretchFactor factor (>1.0) of growth of layer thickness towards inside of mesh - # @param ignoreFaces list of geometrical faces (or their ids) not to generate layers on + # @param faces list of geometrical faces (or their ids). + # Viscous layers are either generated on these faces or not, depending on + # the value of \a isFacesToIgnore parameter. + # @param isFacesToIgnore if \c True, the Viscous layers are not generated on the + # faces specified by the previous parameter (\a faces). # @ingroup l3_hypos_additi - def ViscousLayers(self, thickness, numberOfLayers, stretchFactor, ignoreFaces=[]): + def ViscousLayers(self, thickness, numberOfLayers, stretchFactor, + faces=[], isFacesToIgnore=True ): if not isinstance(self.algo, SMESH._objref_SMESH_3D_Algo): raise TypeError, "ViscousLayers are supported by 3D algorithms only" if not "ViscousLayers" in self.GetCompatibleHypothesis(): raise TypeError, "ViscousLayers are not supported by %s"%self.algo.GetName() - if ignoreFaces and isinstance( ignoreFaces[0], geomBuilder.GEOM._objref_GEOM_Object ): - ignoreFaces = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in ignoreFaces ] + if faces and isinstance( faces[0], geomBuilder.GEOM._objref_GEOM_Object ): + faces = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in faces ] hyp = self.Hypothesis("ViscousLayers", - [thickness, numberOfLayers, stretchFactor, ignoreFaces]) + [thickness, numberOfLayers, stretchFactor, faces]) hyp.SetTotalThickness(thickness) hyp.SetNumberLayers(numberOfLayers) hyp.SetStretchFactor(stretchFactor) - hyp.SetIgnoreFaces(ignoreFaces) + hyp.SetFaces(faces, isFacesToIgnore) return hyp ## Defines "ViscousLayers2D" hypothesis to give parameters of layers of quadrilateral @@ -290,9 +288,9 @@ class Mesh_Algorithm: # @param thickness total thickness of layers of quadrilaterals # @param numberOfLayers number of layers # @param stretchFactor factor (>1.0) of growth of layer thickness towards inside of mesh - # @param edges list of geometrical edge (or their ids). + # @param edges list of geometrical edges (or their ids). # Viscous layers are either generated on these edges or not, depending on - # the values of \a isEdgesToIgnore parameter. + # the value of \a isEdgesToIgnore parameter. # @param isEdgesToIgnore if \c True, the Viscous layers are not generated on the # edges specified by the previous parameter (\a edges). # @ingroup l3_hypos_additi @@ -313,7 +311,7 @@ class Mesh_Algorithm: hyp.SetEdges(edges, isEdgesToIgnore) return hyp - ## Transform a list of ether edges or tuples (edge, 1st_vertex_of_edge) + ## Transform a list of either edges or tuples (edge, 1st_vertex_of_edge) # into a list acceptable to SetReversedEdges() of some 1D hypotheses # @ingroup l3_hypos_1dhyps def ReversedEdgeIndices(self, reverseList): diff --git a/src/SMESH_SWIG_WITHIHM/CMakeLists.txt b/src/SMESH_SWIG_WITHIHM/CMakeLists.txt index d900626ef..acc21d3c8 100644 --- a/src/SMESH_SWIG_WITHIHM/CMakeLists.txt +++ b/src/SMESH_SWIG_WITHIHM/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx index 5aa7e1aed..633f986f9 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h index 9b4c5319d..e20cdbc11 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i index c10c0fe96..f255dd549 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/CMakeLists.txt b/src/StdMeshers/CMakeLists.txt index de84b5026..b30a69e09 100644 --- a/src/StdMeshers/CMakeLists.txt +++ b/src/StdMeshers/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -30,6 +30,7 @@ INCLUDE_DIRECTORIES( ${VTK_INCLUDE_DIRS} ${KERNEL_INCLUDE_DIRS} ${GUI_INCLUDE_DIRS} + ${GEOM_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/src/SMESHUtils ${PROJECT_SOURCE_DIR}/src/SMESH ${PROJECT_SOURCE_DIR}/src/SMESHDS @@ -61,6 +62,7 @@ SET(_link_LIBRARIES ${CAS_TKAdvTools} ${CAS_TKTopAlgo} ${CAS_TKG3d} + ${GEOM_GEOMUtils} SMESHimpl SMESHDS ${TBB_LIBS} @@ -75,8 +77,10 @@ ENDIF(SALOME_SMESH_ENABLE_MEFISTO) # header files / no moc processing SET(StdMeshers_HEADERS StdMeshers_LocalLength.hxx + StdMeshers_Reversible1D.hxx StdMeshers_StartEndLength.hxx StdMeshers_Arithmetic1D.hxx + StdMeshers_Geometric1D.hxx StdMeshers_FixedPoints1D.hxx StdMeshers_NumberOfSegments.hxx StdMeshers_Deflection1D.hxx @@ -136,8 +140,10 @@ ENDIF(SALOME_SMESH_ENABLE_MEFISTO) # sources / static SET(StdMeshers_SOURCES StdMeshers_LocalLength.cxx + StdMeshers_Reversible1D.cxx StdMeshers_StartEndLength.cxx StdMeshers_Arithmetic1D.cxx + StdMeshers_Geometric1D.cxx StdMeshers_FixedPoints1D.cxx StdMeshers_NumberOfSegments.cxx StdMeshers_Deflection1D.cxx diff --git a/src/StdMeshers/SMESH_StdMeshers.hxx b/src/StdMeshers/SMESH_StdMeshers.hxx index 7904c05ea..3d62963fe 100755 --- a/src/StdMeshers/SMESH_StdMeshers.hxx +++ b/src/StdMeshers/SMESH_StdMeshers.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Adaptive1D.cxx b/src/StdMeshers/StdMeshers_Adaptive1D.cxx index 1d3d0f31a..ecb30b1aa 100644 --- a/src/StdMeshers/StdMeshers_Adaptive1D.cxx +++ b/src/StdMeshers/StdMeshers_Adaptive1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Adaptive1D.hxx b/src/StdMeshers/StdMeshers_Adaptive1D.hxx index dfaa98efe..a62118087 100644 --- a/src/StdMeshers/StdMeshers_Adaptive1D.hxx +++ b/src/StdMeshers/StdMeshers_Adaptive1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Arithmetic1D.cxx b/src/StdMeshers/StdMeshers_Arithmetic1D.cxx index a7c988c1e..481b5b173 100644 --- a/src/StdMeshers/StdMeshers_Arithmetic1D.cxx +++ b/src/StdMeshers/StdMeshers_Arithmetic1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Arithmetic1D.hxx b/src/StdMeshers/StdMeshers_Arithmetic1D.hxx index e8ff635fa..8a402383a 100644 --- a/src/StdMeshers/StdMeshers_Arithmetic1D.hxx +++ b/src/StdMeshers/StdMeshers_Arithmetic1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_AutomaticLength.cxx b/src/StdMeshers/StdMeshers_AutomaticLength.cxx index 3c8a01a47..5c04dd7fc 100644 --- a/src/StdMeshers/StdMeshers_AutomaticLength.cxx +++ b/src/StdMeshers/StdMeshers_AutomaticLength.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_AutomaticLength.hxx b/src/StdMeshers/StdMeshers_AutomaticLength.hxx index d8dead7c5..3d74c78cf 100644 --- a/src/StdMeshers/StdMeshers_AutomaticLength.hxx +++ b/src/StdMeshers/StdMeshers_AutomaticLength.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_CartesianParameters3D.cxx b/src/StdMeshers/StdMeshers_CartesianParameters3D.cxx index fa4aa909f..0b7ac0235 100644 --- a/src/StdMeshers/StdMeshers_CartesianParameters3D.cxx +++ b/src/StdMeshers/StdMeshers_CartesianParameters3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -32,11 +32,27 @@ #include "utilities.h" -#include -#include - +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + using namespace std; //======================================================================= @@ -48,10 +64,28 @@ StdMeshers_CartesianParameters3D::StdMeshers_CartesianParameters3D(int h int studyId, SMESH_Gen * gen) : SMESH_Hypothesis(hypId, studyId, gen), - _sizeThreshold( 4.0 ) // default according to the customer specification + _sizeThreshold( 4.0 ), // default according to the customer specification + _toAddEdges( false ) { _name = "CartesianParameters3D"; // used by "Cartesian_3D" _param_algo_dim = 3; // 3D + + _axisDirs[0] = 1.; + _axisDirs[1] = 0.; + _axisDirs[2] = 0.; + + _axisDirs[3] = 0.; + _axisDirs[4] = 1.; + _axisDirs[5] = 0.; + + _axisDirs[6] = 0.; + _axisDirs[7] = 0.; + _axisDirs[8] = 1.; + + _fixedPoint[0] = 0.; + _fixedPoint[1] = 0.; + _fixedPoint[2] = 0.; + SetFixedPoint( _fixedPoint, /*toUnset=*/true ); } @@ -59,6 +93,22 @@ namespace { const char* axisName[3] = { "X", "Y", "Z" }; + typedef std::pair< double, std::pair< double, double > > TCooTriple; + +#define gpXYZ( cTriple ) gp_XYZ( (cTriple).first, (cTriple).second.first, (cTriple).second.second ) + + //================================================================================ + /*! + * \brief Compare two normals + */ + //================================================================================ + + bool sameDir( const TCooTriple& n1, const TCooTriple& n2 ) + { + gp_XYZ xyz1 = gpXYZ( n1 ), xyz2 = gpXYZ( n2 ); + return ( xyz1 - xyz2 ).Modulus() < 0.01; + } + //================================================================================ /*! * \brief Checks validity of an axis index, throws in case of invalidity @@ -163,6 +213,36 @@ void StdMeshers_CartesianParameters3D::SetGridSpacing(std::vector& xSpac NotifySubMeshesHypothesisModification(); } +//======================================================================= +//function : SetFixedPoint +//purpose : * Set/unset a fixed point, at which a node will be created provided that grid +// * is defined by spacing in all directions +//======================================================================= + +void StdMeshers_CartesianParameters3D::SetFixedPoint(const double p[3], bool toUnset) +{ + if ( toUnset != Precision::IsInfinite( _fixedPoint[0] )) + NotifySubMeshesHypothesisModification(); + + if ( toUnset ) + _fixedPoint[0] = Precision::Infinite(); + else + std::copy( &p[0], &p[0]+3, &_fixedPoint[0] ); +} + +//======================================================================= +//function : GetFixedPoint +//purpose : Returns either false or (true + point coordinates) +//======================================================================= + +bool StdMeshers_CartesianParameters3D::GetFixedPoint(double p[3]) const +{ + if ( Precision::IsInfinite( _fixedPoint[0] )) + return false; + std::copy( &_fixedPoint[0], &_fixedPoint[0]+3, &p[0] ); +} + + //======================================================================= //function : SetSizeThreshold //purpose : Set size threshold @@ -215,15 +295,36 @@ bool StdMeshers_CartesianParameters3D::IsGridBySpacing(const int axis) const //purpose : Computes node coordinates by spacing functions //======================================================================= -void StdMeshers_CartesianParameters3D::ComputeCoordinates(const double x0, - const double x1, - vector& spaceFuns, - vector& points, - vector& coords, - const std::string& axis ) +void StdMeshers_CartesianParameters3D::ComputeCoordinates(const double x0, + const double x1, + vector& theSpaceFuns, + vector& thePoints, + vector& coords, + const string& axis, + const double* xForced ) throw ( SALOME_Exception ) { - checkGridSpacing( spaceFuns, points, axis ); + checkGridSpacing( theSpaceFuns, thePoints, axis ); + + vector spaceFuns = theSpaceFuns; + vector points = thePoints; + + bool forced = false; + if (( forced = ( xForced && ( x0 < *xForced ) && ( *xForced < x1 )))) + { + // divide a range at xForced + + // find a range to insert xForced + double pos = ( *xForced - x0 ) / ( x1 - x0 ); + int iR = 1; + while ( pos > points[ iR ] ) ++iR; + + // insert xForced + vector::iterator pntIt = points.begin() + iR; + points.insert( pntIt, pos ); + vector::iterator funIt = spaceFuns.begin() + iR; + spaceFuns.insert( funIt, spaceFuns[ iR-1 ]); + } coords.clear(); for ( size_t i = 0; i < spaceFuns.size(); ++i ) @@ -266,6 +367,28 @@ void StdMeshers_CartesianParameters3D::ComputeCoordinates(const double x if ( fabs( coords.back() - p1 ) > 0.5 * lastCellLen ) coords.push_back ( p1 ); } + + // correct coords if a forced point is too close to a neighbor node + if ( forced ) + { + int iF = 0; + double minLen = ( x1 - x0 ); + for ( size_t i = 1; i < coords.size(); ++i ) + { + if ( !iF && Abs( coords[i] - *xForced ) < 1e-20 ) + iF = i++; // xForced found + else + minLen = Min( minLen, coords[i] - coords[i-1] ); + } + const double tol = minLen * 1e-3; + int iRem = -1; + if (( iF > 1 ) && ( coords[iF] - coords[iF-1] < tol )) + iRem = iF-1; + else if (( iF < coords.size()-2 ) && ( coords[iF+1] - coords[iF] < tol )) + iRem = iF+1; + if ( iRem > 0 ) + coords.erase( coords.begin() + iRem ); + } } //======================================================================= @@ -291,23 +414,281 @@ void StdMeshers_CartesianParameters3D::GetCoordinates(std::vector& xNode bndBox.Get(x0,y0,z0, x1,y1,z1); } + double fp[3], *pfp[3] = { NULL, NULL, NULL }; + if ( GetFixedPoint( fp )) + { + // convert fp into a basis defined by _axisDirs + gp_XYZ axis[3] = { gp_XYZ( _axisDirs[0], _axisDirs[1], _axisDirs[2] ), + gp_XYZ( _axisDirs[3], _axisDirs[4], _axisDirs[5] ), + gp_XYZ( _axisDirs[6], _axisDirs[7], _axisDirs[8] ) }; + axis[0].Normalize(); + axis[1].Normalize(); + axis[2].Normalize(); + + gp_Mat basis( axis[0], axis[1], axis[2] ); + gp_Mat bi = basis.Inverted(); + + gp_XYZ p( fp[0], fp[1], fp[2] ); + p *= bi; + p.Coord( fp[0], fp[1], fp[2] ); + + pfp[0] = & fp[0]; + pfp[1] = & fp[1]; + pfp[2] = & fp[2]; + } + StdMeshers_CartesianParameters3D* me = const_cast(this); if ( IsGridBySpacing(0) ) - ComputeCoordinates( x0, x1, me->_spaceFunctions[0], me->_internalPoints[0], xNodes, "X" ); + ComputeCoordinates + ( x0, x1, me->_spaceFunctions[0], me->_internalPoints[0], xNodes, "X", pfp[0] ); else xNodes = _coords[0]; if ( IsGridBySpacing(1) ) - ComputeCoordinates( y0, y1, me->_spaceFunctions[1], me->_internalPoints[1], yNodes, "Y" ); + ComputeCoordinates + ( y0, y1, me->_spaceFunctions[1], me->_internalPoints[1], yNodes, "Y", pfp[1] ); else yNodes = _coords[1]; if ( IsGridBySpacing(2) ) - ComputeCoordinates( z0, z1, me->_spaceFunctions[2], me->_internalPoints[2], zNodes, "Z" ); + ComputeCoordinates + ( z0, z1, me->_spaceFunctions[2], me->_internalPoints[2], zNodes, "Z", pfp[2] ); else zNodes = _coords[2]; } +//======================================================================= +//function : ComputeOptimalAxesDirs +//purpose : Returns axes at which number of hexahedra is maximal +//======================================================================= + +void StdMeshers_CartesianParameters3D:: +ComputeOptimalAxesDirs(const TopoDS_Shape& shape, + const bool isOrthogonal, + double dirCoords[9]) +{ + for ( int i = 0; i < 9; ++i ) dirCoords[i] = 0.; + dirCoords[0] = dirCoords[4] = dirCoords[8] = 1.; + + if ( shape.IsNull() ) return; + + TopLoc_Location loc; + TopExp_Explorer exp; + + // get external FACEs of the shape + TopTools_MapOfShape faceMap; + for ( exp.Init( shape, TopAbs_FACE ); exp.More(); exp.Next() ) + if ( !faceMap.Add( exp.Current() )) + faceMap.Remove( exp.Current() ); + + // sort areas of planar faces by normal direction + + std::multimap< TCooTriple, double > areasByNormal; + + TopTools_MapIteratorOfMapOfShape fIt ( faceMap ); + for ( ; fIt.More(); fIt.Next() ) + { + const TopoDS_Face& face = TopoDS::Face( fIt.Key() ); + Handle(Geom_Surface) surf = BRep_Tool::Surface( face, loc ); + if ( surf.IsNull() ) continue; + + GeomLib_IsPlanarSurface check( surf, 1e-5 ); + if ( !check.IsPlanar() ) continue; + + GProp_GProps SProps; + BRepGProp::SurfaceProperties( face, SProps ); + double area = SProps.Mass(); + + gp_Pln pln = check.Plan(); + gp_Dir norm = pln.Axis().Direction().Transformed( loc ); + if ( norm.X() < -1e-3 ) { // negative X + norm.Reverse(); + } else if ( norm.X() < 1e-3 ) { // zero X + if ( norm.Y() < -1e-3 ) { // negative Y + norm.Reverse(); + } else if ( norm.Y() < 1e-3 ) { // zero X && zero Y + if ( norm.Y() < -1e-3 ) // negative Z + norm.Reverse(); + } + } + TCooTriple coo3( norm.X(), make_pair( norm.Y(), norm.Z() )); + areasByNormal.insert( make_pair( coo3, area )); + } + + // group coplanar normals and sort groups by sum area + + std::multimap< double, vector< const TCooTriple* > > normsByArea; + std::multimap< TCooTriple, double >::iterator norm2a = areasByNormal.begin(); + const TCooTriple* norm1 = 0; + double sumArea = 0; + vector< const TCooTriple* > norms; + for ( int iF = 1; norm2a != areasByNormal.end(); ++norm2a, ++iF ) + { + + if ( !norm1 || !sameDir( *norm1, norm2a->first )) + { + if ( !norms.empty() ) + { + normsByArea.insert( make_pair( sumArea, norms )); + norms.clear(); + } + norm1 = & norm2a->first; + sumArea = norm2a->second; + norms.push_back( norm1 ); + } + else + { + sumArea += norm2a->second; + norms.push_back( & norm2a->first ); + } + if ( iF == areasByNormal.size() ) + normsByArea.insert( make_pair( sumArea, norms )); + } + + // try to set dirs by planar faces + + gp_XYZ normDirs[3]; // normals to largest planes + + if ( !normsByArea.empty() ) + { + norm1 = normsByArea.rbegin()->second[0]; + normDirs[0] = gpXYZ( *norm1 ); + + if ( normsByArea.size() == 1 ) + { + normDirs[1] = normDirs[0]; + if ( Abs( normDirs[0].Y() ) < 1e-100 && + Abs( normDirs[0].Z() ) < 1e-100 ) // normDirs[0] || OX + normDirs[1].SetY( normDirs[0].Y() + 1. ); + else + normDirs[1].SetX( normDirs[0].X() + 1. ); + } + else + { + // look for 2 other directions + gp_XYZ testDir = normDirs[0], minDir, maxDir; + for ( int is2nd = 0; is2nd < 2; ++is2nd ) + { + double maxMetric = 0, minMetric = 1e100; + std::multimap< double, vector< const TCooTriple* > >::iterator a2n; + for ( a2n = normsByArea.begin(); a2n != normsByArea.end(); ++a2n ) + { + gp_XYZ n = gpXYZ( *( a2n->second[0]) ); + double dot = Abs( n * testDir ); + double metric = ( 1. - dot ) * ( isOrthogonal ? 1 : a2n->first ); + if ( metric > maxMetric ) + { + maxDir = n; + maxMetric = metric; + } + if ( metric < minMetric ) + { + minDir = n; + minMetric = metric; + } + } + if ( is2nd ) + { + normDirs[2] = minDir; + } + else + { + normDirs[1] = maxDir; + normDirs[2] = normDirs[0] ^ normDirs[1]; + if ( isOrthogonal || normsByArea.size() < 3 ) + break; + testDir = normDirs[2]; + } + } + } + if ( isOrthogonal || normsByArea.size() == 1 ) + { + normDirs[2] = normDirs[0] ^ normDirs[1]; + normDirs[1] = normDirs[2] ^ normDirs[0]; + } + } + else + { + return; + } + + gp_XYZ dirs[3]; + dirs[0] = normDirs[0] ^ normDirs[1]; + dirs[1] = normDirs[1] ^ normDirs[2]; + dirs[2] = normDirs[2] ^ normDirs[0]; + + dirs[0].Normalize(); + dirs[1].Normalize(); + dirs[2].Normalize(); + + // Select dirs for X, Y and Z axes + int iX = ( Abs( dirs[0].X() ) > Abs( dirs[1].X() )) ? 0 : 1; + if ( Abs( dirs[iX].X() ) < Abs( dirs[2].X() )) + iX = 2; + int iY = ( iX == 0 ) ? 1 : (( Abs( dirs[0].Y() ) > Abs( dirs[1].Y() )) ? 0 : 1 ); + if ( Abs( dirs[iY].Y() ) < Abs( dirs[2].Y() ) && iX != 2 ) + iY = 2; + int iZ = 3 - iX - iY; + + if ( dirs[iX].X() < 0 ) dirs[iX].Reverse(); + if ( dirs[iY].Y() < 0 ) dirs[iY].Reverse(); + gp_XYZ zDir = dirs[iX] ^ dirs[iY]; + if ( dirs[iZ] * zDir < 0 ) + dirs[iZ].Reverse(); + + dirCoords[0] = dirs[iX].X(); + dirCoords[1] = dirs[iX].Y(); + dirCoords[2] = dirs[iX].Z(); + dirCoords[3] = dirs[iY].X(); + dirCoords[4] = dirs[iY].Y(); + dirCoords[5] = dirs[iY].Z(); + dirCoords[6] = dirs[iZ].X(); + dirCoords[7] = dirs[iZ].Y(); + dirCoords[8] = dirs[iZ].Z(); +} + +//======================================================================= +//function : SetAxisDirs +//purpose : Sets custom direction of axes +//======================================================================= + +void StdMeshers_CartesianParameters3D::SetAxisDirs(const double* the9DirComps) + throw ( SALOME_Exception ) +{ + gp_Vec x( the9DirComps[0], + the9DirComps[1], + the9DirComps[2] ); + gp_Vec y( the9DirComps[3], + the9DirComps[4], + the9DirComps[5] ); + gp_Vec z( the9DirComps[6], + the9DirComps[7], + the9DirComps[8] ); + if ( x.Magnitude() < RealSmall() || + y.Magnitude() < RealSmall() || + z.Magnitude() < RealSmall() ) + throw SALOME_Exception("Zero magnitude of axis direction"); + + if ( x.IsParallel( y, M_PI / 180. ) || + x.IsParallel( z, M_PI / 180. ) || + y.IsParallel( z, M_PI / 180. )) + throw SALOME_Exception("Parallel axis directions"); + + gp_Vec normXY = x ^ y, normYZ = y ^ z; + if ( normXY.IsParallel( normYZ, M_PI / 180. )) + throw SALOME_Exception("Axes lie in one plane"); + + bool isChanged = false; + for ( int i = 0; i < 9; ++i ) + { + if ( Abs( _axisDirs[i] - the9DirComps[i] ) > 1e-7 ) + isChanged = true; + _axisDirs[i] = the9DirComps[i]; + } + if ( isChanged ) + NotifySubMeshesHypothesisModification(); +} + //======================================================================= //function : GetGrid //purpose : Return coordinates of node positions along the three axes @@ -332,6 +713,33 @@ double StdMeshers_CartesianParameters3D::GetSizeThreshold() const return _sizeThreshold; } +//======================================================================= +//function : SetToAddEdges +//purpose : Enables implementation of geometrical edges into the mesh. If this feature +// is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if +// they don't coincide with the grid lines +//======================================================================= + +void StdMeshers_CartesianParameters3D::SetToAddEdges(bool toAdd) +{ + if ( _toAddEdges != toAdd ) + { + _toAddEdges = toAdd; + NotifySubMeshesHypothesisModification(); + } +} + +//======================================================================= +//function : GetToAddEdges +//purpose : Returns true if implementation of geometrical edges into the +// mesh is enabled +//======================================================================= + +bool StdMeshers_CartesianParameters3D::GetToAddEdges() const +{ + return _toAddEdges; +} + //======================================================================= //function : IsDefined //purpose : Return true if parameters are well defined @@ -369,6 +777,15 @@ std::ostream & StdMeshers_CartesianParameters3D::SaveTo(std::ostream & save) for ( size_t j = 0; j < _spaceFunctions[i].size(); ++j ) save << _spaceFunctions[i][j] << " "; } + save << _toAddEdges << " "; + + save.setf( save.scientific ); + save.precision( 12 ); + for ( int i = 0; i < 9; ++i ) + save << _axisDirs[i] << " "; + + for ( int i = 0; i < 3; ++i ) + save << _fixedPoint[i] << " "; return save; } @@ -382,7 +799,7 @@ std::istream & StdMeshers_CartesianParameters3D::LoadFrom(std::istream & load) { bool ok; - ok = (load >> _sizeThreshold ); + ok = ( load >> _sizeThreshold ); for ( int ax = 0; ax < 3; ++ax ) { if (ok) @@ -419,6 +836,15 @@ std::istream & StdMeshers_CartesianParameters3D::LoadFrom(std::istream & load) } } } + + ok = ( load >> _toAddEdges ); + + for ( int i = 0; i < 9 && ok; ++i ) + ok = ( load >> _axisDirs[i]); + + for ( int i = 0; i < 3 && ok ; ++i ) + ok = ( load >> _fixedPoint[i]); + return load; } diff --git a/src/StdMeshers/StdMeshers_CartesianParameters3D.hxx b/src/StdMeshers/StdMeshers_CartesianParameters3D.hxx index adb22f00c..5edbc53a2 100644 --- a/src/StdMeshers/StdMeshers_CartesianParameters3D.hxx +++ b/src/StdMeshers/StdMeshers_CartesianParameters3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -78,6 +78,13 @@ public: bool IsGridBySpacing(const int axis) const throw ( SALOME_Exception ); + /*! + * Set/unset a fixed point, at which a node will be created provided that grid + * is defined by spacing in all directions + */ + void SetFixedPoint(const double p[3], bool toUnset); + bool GetFixedPoint(double p[3]) const; + /*! * \brief Computes node coordinates by spacing functions * \param x0 - lower coordinate @@ -91,7 +98,8 @@ public: std::vector& spaceFuns, std::vector& points, std::vector& coords, - const std::string& axis ) throw (SALOME_Exception); + const std::string& axis, + const double* xForced=0) throw (SALOME_Exception); /*! * Return coordinates of node positions along the three axes. * If the grid is defined by spacing functions, the coordinates are computed @@ -100,10 +108,22 @@ public: std::vector& yNodes, std::vector& zNodes, const Bnd_Box& bndBox) const throw ( SALOME_Exception ); + + /*! + * \brief Set custom direction of axes + */ + void SetAxisDirs(const double* the9DirComps) throw ( SALOME_Exception ); + const double* GetAxisDirs() const { return _axisDirs; } + /*! + * \brief Returns axes at which number of hexahedra is maximal + */ + static void ComputeOptimalAxesDirs(const TopoDS_Shape& shape, + const bool isOrthogonal, + double dirCoords[9]); /*! * Set size threshold. A polyhedral cell got by cutting an initial * hexahedron by geometry boundary is considered small and is removed if - * it's size is \athreshold times less than the size of the initial hexahedron. + * it's size is \athreshold times less than the size of the initial hexahedron. */ void SetSizeThreshold(const double threshold) throw ( SALOME_Exception ); /*! @@ -111,6 +131,14 @@ public: */ double GetSizeThreshold() const; + /*! + * \brief Enables implementation of geometrical edges into the mesh. If this feature + * is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if + * they don't coincide with the grid lines + */ + void SetToAddEdges(bool toAdd); + bool GetToAddEdges() const; + /*! * \brief Return true if parameters are well defined */ @@ -138,7 +166,11 @@ public: std::vector _spaceFunctions[3]; std::vector _internalPoints[3]; + double _axisDirs [9]; + double _fixedPoint[3]; + double _sizeThreshold; + bool _toAddEdges; }; #endif diff --git a/src/StdMeshers/StdMeshers_Cartesian_3D.cxx b/src/StdMeshers/StdMeshers_Cartesian_3D.cxx index 83447b16a..eb23a493a 100644 --- a/src/StdMeshers/StdMeshers_Cartesian_3D.cxx +++ b/src/StdMeshers/StdMeshers_Cartesian_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -33,20 +33,29 @@ #include "SMESH_subMeshEventListener.hxx" #include "StdMeshers_CartesianParameters3D.hxx" -#include "utilities.h" -#include "Utils_ExceptHandlers.hxx" +#include +#include #include +#include + +#include #include #include #include +#include #include +#include #include +#include #include #include +#include #include #include #include +#include +#include #include #include #include @@ -63,9 +72,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -76,7 +85,9 @@ #include #include -//#undef WITH_TBB +#include + +#undef WITH_TBB #ifdef WITH_TBB #include //#include @@ -150,6 +161,8 @@ bool StdMeshers_Cartesian_3D::CheckHypothesis (SMESH_Mesh& aMesh, namespace { + typedef int TGeomID; + //============================================================================= // Definitions of internal utils // -------------------------------------------------------------------------- @@ -161,17 +174,40 @@ namespace }; // -------------------------------------------------------------------------- /*! - * \brief Data of intersection between a GridLine and a TopoDS_Face + * \brief Common data of any intersection between a Grid and a shape */ - struct IntersectionPoint + struct B_IntersectPoint { - double _paramOnLine; - mutable Transition _transition; mutable const SMDS_MeshNode* _node; - mutable size_t _indexOnLine; + mutable vector< TGeomID > _faceIDs; + + B_IntersectPoint(): _node(NULL) {} + void Add( const vector< TGeomID >& fIDs, const SMDS_MeshNode* n=0 ) const; + int HasCommonFace( const B_IntersectPoint * other, int avoidFace=-1 ) const; + bool IsOnFace( int faceID ) const; + virtual ~B_IntersectPoint() {} + }; + // -------------------------------------------------------------------------- + /*! + * \brief Data of intersection between a GridLine and a TopoDS_Face + */ + struct F_IntersectPoint : public B_IntersectPoint + { + double _paramOnLine; + mutable Transition _transition; + mutable size_t _indexOnLine; - IntersectionPoint(): _node(0) {} - bool operator< ( const IntersectionPoint& o ) const { return _paramOnLine < o._paramOnLine; } + bool operator< ( const F_IntersectPoint& o ) const { return _paramOnLine < o._paramOnLine; } + }; + // -------------------------------------------------------------------------- + /*! + * \brief Data of intersection between GridPlanes and a TopoDS_EDGE + */ + struct E_IntersectPoint : public B_IntersectPoint + { + gp_Pnt _point; + double _uvw[3]; + TGeomID _shapeID; }; // -------------------------------------------------------------------------- /*! @@ -181,10 +217,20 @@ namespace { gp_Lin _line; double _length; // line length - multiset< IntersectionPoint > _intPoints; + multiset< F_IntersectPoint > _intPoints; void RemoveExcessIntPoints( const double tol ); - bool GetIsOutBefore( multiset< IntersectionPoint >::iterator ip, bool prevIsOut ); + bool GetIsOutBefore( multiset< F_IntersectPoint >::iterator ip, bool prevIsOut ); + }; + // -------------------------------------------------------------------------- + /*! + * \brief Planes of the grid used to find intersections of an EDGE with a hexahedron + */ + struct GridPlanes + { + gp_XYZ _uNorm, _vNorm, _zNorm; + vector< gp_XYZ > _origins; // origin points of all planes in one direction + vector< double > _zProjs; // projections of origins to _zNorm }; // -------------------------------------------------------------------------- /*! @@ -234,11 +280,20 @@ namespace struct Grid { vector< double > _coords[3]; // coordinates of grid nodes - vector< GridLine > _lines [3]; // in 3 directions + gp_XYZ _axes [3]; // axis directions + vector< GridLine > _lines [3]; // in 3 directions double _tol, _minCellSize; + gp_XYZ _origin; + gp_Mat _invB; // inverted basis of _axes + //bool _isOrthogonalAxes; + + vector< const SMDS_MeshNode* > _nodes; // mesh nodes at grid nodes + vector< const F_IntersectPoint* > _gridIntP; // grid node intersection with geometry - vector< const SMDS_MeshNode* > _nodes; // mesh nodes at grid nodes - vector< bool > _isBndNode; // is mesh node at intersection with geometry + list< E_IntersectPoint > _edgeIntP; // intersections with EDGEs + TopTools_IndexedMapOfShape _shapes; + + SMESH_MesherHelper* _helper; size_t CellIndex( size_t i, size_t j, size_t k ) const { @@ -257,7 +312,9 @@ namespace void SetCoordinates(const vector& xCoords, const vector& yCoords, const vector& zCoords, - const TopoDS_Shape& shape ); + const double* axesDirs, + const Bnd_Box& bndBox ); + void ComputeUVW(const gp_XYZ& p, double uvw[3]); void ComputeNodes(SMESH_MesherHelper& helper); }; #ifdef ELLIPSOLID_WORKAROUND @@ -302,10 +359,11 @@ namespace struct FaceGridIntersector { TopoDS_Face _face; + TGeomID _faceID; Grid* _grid; Bnd_Box _bndBox; __IntCurvesFace_Intersector* _surfaceInt; - vector< std::pair< GridLine*, IntersectionPoint > > _intersections; + vector< std::pair< GridLine*, F_IntersectPoint > > _intersections; FaceGridIntersector(): _grid(0), _surfaceInt(0) {} void Intersect(); @@ -314,7 +372,12 @@ namespace void StoreIntersections() { for ( size_t i = 0; i < _intersections.size(); ++i ) - _intersections[i].first->_intPoints.insert( _intersections[i].second ); + { + multiset< F_IntersectPoint >::iterator ip = + _intersections[i].first->_intPoints.insert( _intersections[i].second ); + ip->_faceIDs.reserve( 1 ); + ip->_faceIDs.push_back( _faceID ); + } } const Bnd_Box& GetFaceBndBox() { @@ -352,7 +415,7 @@ namespace gp_Torus _torus; __IntCurvesFace_Intersector* _surfaceInt; - vector< IntersectionPoint > _intPoints; + vector< F_IntersectPoint > _intPoints; void IntersectWithPlane (const GridLine& gridLine); void IntersectWithCylinder(const GridLine& gridLine); @@ -381,22 +444,65 @@ namespace struct _Face; struct _Link; // -------------------------------------------------------------------------------- - struct _Node //!< node either at a hexahedron corner or at GridLine intersection + struct _Node //!< node either at a hexahedron corner or at intersection { - const SMDS_MeshNode* _node; // mesh node at hexahedron corner - const IntersectionPoint* _intPoint; - - _Node(const SMDS_MeshNode* n=0, const IntersectionPoint* ip=0):_node(n), _intPoint(ip) {} - const SMDS_MeshNode* Node() const { return _intPoint ? _intPoint->_node : _node; } - //bool IsCorner() const { return _node; } + const SMDS_MeshNode* _node; // mesh node at hexahedron corner + const B_IntersectPoint* _intPoint; + const _Face* _usedInFace; + + _Node(const SMDS_MeshNode* n=0, const B_IntersectPoint* ip=0) + :_node(n), _intPoint(ip), _usedInFace(0) {} + const SMDS_MeshNode* Node() const + { return ( _intPoint && _intPoint->_node ) ? _intPoint->_node : _node; } + //const F_IntersectPoint* FaceIntPnt() const + //{ return static_cast< const F_IntersectPoint* >( _intPoint ); } + const E_IntersectPoint* EdgeIntPnt() const + { return static_cast< const E_IntersectPoint* >( _intPoint ); } + bool IsUsedInFace( const _Face* polygon = 0 ) + { + return polygon ? ( _usedInFace == polygon ) : bool( _usedInFace ); + } + void Add( const E_IntersectPoint* ip ) + { + if ( !_intPoint ) { + _intPoint = ip; + } + else if ( !_intPoint->_node ) { + ip->Add( _intPoint->_faceIDs ); + _intPoint = ip; + } + else { + _intPoint->Add( ip->_faceIDs ); + } + } + int IsLinked( const B_IntersectPoint* other, + int avoidFace=-1 ) const // returns id of a common face + { + return _intPoint ? _intPoint->HasCommonFace( other, avoidFace ) : 0; + } + bool IsOnFace( int faceID ) const // returns true if faceID is found + { + return _intPoint ? _intPoint->IsOnFace( faceID ) : false; + } + gp_Pnt Point() const + { + if ( const SMDS_MeshNode* n = Node() ) + return SMESH_TNodeXYZ( n ); + if ( const E_IntersectPoint* eip = + dynamic_cast< const E_IntersectPoint* >( _intPoint )) + return eip->_point; + return gp_Pnt( 1e100, 0, 0 ); + } }; // -------------------------------------------------------------------------------- struct _Link // link connecting two _Node's { _Node* _nodes[2]; - vector< _Node> _intNodes; // _Node's at GridLine intersections - vector< _Link > _splits; - vector< _Face*> _faces; + _Face* _faces[2]; // polygons sharing a link + vector< const F_IntersectPoint* > _fIntPoints; // GridLine intersections with FACEs + vector< _Node* > _fIntNodes; // _Node's at _fIntPoints + vector< _Link > _splits; + _Link() { _faces[0] = 0; } }; // -------------------------------------------------------------------------------- struct _OrientedLink @@ -411,55 +517,117 @@ namespace return _OrientedLink(&_link->_splits[_reverse ? NbResultLinks()-i-1 : i],_reverse); } _Node* FirstNode() const { return _link->_nodes[ _reverse ]; } - _Node* LastNode() const { return _link->_nodes[ !_reverse ]; } + _Node* LastNode() const { return _link->_nodes[ !_reverse ]; } + operator bool() const { return _link; } + vector< TGeomID > GetNotUsedFace(const set& usedIDs ) const // returns supporting FACEs + { + vector< TGeomID > faces; + const B_IntersectPoint *ip0, *ip1; + if (( ip0 = _link->_nodes[0]->_intPoint ) && + ( ip1 = _link->_nodes[1]->_intPoint )) + { + for ( size_t i = 0; i < ip0->_faceIDs.size(); ++i ) + if ( ip1->IsOnFace ( ip0->_faceIDs[i] ) && + !usedIDs.count( ip0->_faceIDs[i] ) ) + faces.push_back( ip0->_faceIDs[i] ); + } + return faces; + } + bool HasEdgeNodes() const + { + return ( dynamic_cast< const E_IntersectPoint* >( _link->_nodes[0]->_intPoint ) || + dynamic_cast< const E_IntersectPoint* >( _link->_nodes[1]->_intPoint )); + } + int NbFaces() const + { + return !_link->_faces[0] ? 0 : 1 + bool( _link->_faces[1] ); + } + void AddFace( _Face* f ) + { + if ( _link->_faces[0] ) + { + _link->_faces[1] = f; + } + else + { + _link->_faces[0] = f; + _link->_faces[1] = 0; + } + } + void RemoveFace( _Face* f ) + { + if ( !_link->_faces[0] ) return; + + if ( _link->_faces[1] == f ) + { + _link->_faces[1] = 0; + } + else if ( _link->_faces[0] == f ) + { + _link->_faces[0]; + if ( _link->_faces[1] ) + { + _link->_faces[0] = _link->_faces[1]; + _link->_faces[1] = 0; + } + } + } }; // -------------------------------------------------------------------------------- struct _Face { - vector< _OrientedLink > _links; - vector< _Link > _polyLinks; // links added to close a polygonal face + vector< _OrientedLink > _links; // links on GridLine's + vector< _Link > _polyLinks; // links added to close a polygonal face + vector< _Node* > _eIntNodes; // nodes at intersection with EDGEs + bool isPolyLink( const _OrientedLink& ol ) + { + return _polyLinks.empty() ? false : + ( &_polyLinks[0] <= ol._link && ol._link <= &_polyLinks.back() ); + } }; // -------------------------------------------------------------------------------- struct _volumeDef // holder of nodes of a volume mesh element { - vector< const SMDS_MeshNode* > _nodes; - vector< int > _quantities; + vector< _Node* > _nodes; + vector< int > _quantities; typedef boost::shared_ptr<_volumeDef> Ptr; - void set( const vector< const SMDS_MeshNode* >& nodes, - const vector< int > quant = vector< int >() ) + void set( const vector< _Node* >& nodes, + const vector< int >& quant = vector< int >() ) { _nodes = nodes; _quantities = quant; } - // static Ptr New( const vector< const SMDS_MeshNode* >& nodes, - // const vector< int > quant = vector< int >() ) - // { - // _volumeDef* def = new _volumeDef; - // def->_nodes = nodes; - // def->_quantities = quant; - // return Ptr( def ); - // } }; // topology of a hexahedron int _nodeShift[8]; - _Node _hexNodes[8]; - _Link _hexLinks[12]; - _Face _hexQuads[6]; + _Node _hexNodes [8]; + _Link _hexLinks [12]; + _Face _hexQuads [6]; // faces resulted from hexahedron intersection vector< _Face > _polygons; + // intresections with EDGEs + vector< const E_IntersectPoint* > _eIntPoints; + + // additional nodes created at intersection points + vector< _Node > _intNodes; + + // nodes inside the hexahedron (at VERTEXes) + vector< _Node* > _vIntNodes; + // computed volume elements //vector< _volumeDef::Ptr > _volumeDefs; _volumeDef _volumeDefs; Grid* _grid; double _sizeThreshold, _sideLength[3]; - int _nbCornerNodes, _nbIntNodes, _nbBndNodes; + int _nbCornerNodes, _nbFaceIntNodes, _nbBndNodes; int _origNodeInd; // index of _hexNodes[0] node within the _grid size_t _i,_j,_k; public: Hexahedron(const double sizeThreshold, Grid* grid); - int MakeElements(SMESH_MesherHelper& helper); + int MakeElements(SMESH_MesherHelper& helper, + const map< TGeomID, vector< TGeomID > >& edge2faceIDsMap); void ComputeElements(); void Init() { init( _i, _j, _k ); } @@ -467,15 +635,39 @@ namespace Hexahedron(const Hexahedron& other ); void init( size_t i, size_t j, size_t k ); void init( size_t i ); + void addEdges(SMESH_MesherHelper& helper, + vector< Hexahedron* >& intersectedHex, + const map< TGeomID, vector< TGeomID > >& edge2faceIDsMap); + gp_Pnt findIntPoint( double u1, double proj1, double u2, double proj2, + double proj, BRepAdaptor_Curve& curve, + const gp_XYZ& axis, const gp_XYZ& origin ); + int getEntity( const E_IntersectPoint* ip, int* facets, int& sub ); + bool addIntersection( const E_IntersectPoint& ip, + vector< Hexahedron* >& hexes, + int ijk[], int dIJK[] ); + bool findChain( _Node* n1, _Node* n2, _Face& quad, vector<_Node*>& chainNodes ); + bool closePolygon( _Face* polygon, vector<_Node*>& chainNodes ) const; int addElements(SMESH_MesherHelper& helper); + bool is1stNodeOut( _Link& link ) const; bool isInHole() const; bool checkPolyhedronSize() const; bool addHexa (); bool addTetra(); bool addPenta(); bool addPyra (); + bool debugDumpLink( _Link* link ); + _Node* FindEqualNode( vector< _Node* >& nodes, + const E_IntersectPoint* ip, + const double tol2 ) + { + for ( size_t i = 0; i < nodes.size(); ++i ) + if ( nodes[i]->EdgeIntPnt() == ip || + nodes[i]->Point().SquareDistance( ip->_point ) <= tol2 ) + return nodes[i]; + return 0; + } }; - + #ifdef WITH_TBB // -------------------------------------------------------------------------- /*! @@ -507,11 +699,34 @@ namespace _faceVec[i].Intersect(); } }; - #endif + //============================================================================= // Implementation of internal utils //============================================================================= + /*! + * \brief adjust \a i to have \a val between values[i] and values[i+1] + */ + inline void locateValue( int & i, double val, const vector& values, + int& di, double tol ) + { + //val += values[0]; // input \a val is measured from 0. + if ( i > values.size()-2 ) + i = values.size()-2; + else + while ( i+2 < values.size() && val > values[ i+1 ]) + ++i; + while ( i > 0 && val < values[ i ]) + --i; + + if ( i > 0 && val - values[ i ] < tol ) + di = -1; + else if ( i+2 < values.size() && values[ i+1 ] - val < tol ) + di = 1; + else + di = 0; + } + //============================================================================= /* * Remove coincident intersection points */ @@ -520,15 +735,16 @@ namespace if ( _intPoints.size() < 2 ) return; set< Transition > tranSet; - multiset< IntersectionPoint >::iterator ip1, ip2 = _intPoints.begin(); + multiset< F_IntersectPoint >::iterator ip1, ip2 = _intPoints.begin(); while ( ip2 != _intPoints.end() ) { tranSet.clear(); ip1 = ip2++; - while ( ip2->_paramOnLine - ip1->_paramOnLine <= tol && ip2 != _intPoints.end()) + while ( ip2 != _intPoints.end() && ip2->_paramOnLine - ip1->_paramOnLine <= tol ) { tranSet.insert( ip1->_transition ); tranSet.insert( ip2->_transition ); + ip2->Add( ip1->_faceIDs ); _intPoints.erase( ip1 ); ip1 = ip2++; } @@ -547,7 +763,7 @@ namespace /* * Return "is OUT" state for nodes before the given intersection point */ - bool GridLine::GetIsOutBefore( multiset< IntersectionPoint >::iterator ip, bool prevIsOut ) + bool GridLine::GetIsOutBefore( multiset< F_IntersectPoint >::iterator ip, bool prevIsOut ) { if ( ip->_transition == Trans_IN ) return true; @@ -558,7 +774,7 @@ namespace // singularity point (apex of a cone) if ( _intPoints.size() == 1 || ip == _intPoints.begin() ) return true; - multiset< IntersectionPoint >::iterator ipBef = ip, ipAft = ++ip; + multiset< F_IntersectPoint >::iterator ipBef = ip, ipAft = ++ip; if ( ipAft == _intPoints.end() ) return false; --ipBef; @@ -566,7 +782,51 @@ namespace return ( ipBef->_transition == Trans_OUT ); return ( ipBef->_transition != Trans_OUT ); } - return prevIsOut; // _transition == Trans_TANGENT + // _transition == Trans_TANGENT + return !prevIsOut; + } + //================================================================================ + /* + * Adds face IDs + */ + void B_IntersectPoint::Add( const vector< TGeomID >& fIDs, + const SMDS_MeshNode* n) const + { + if ( _faceIDs.empty() ) + _faceIDs = fIDs; + else + for ( size_t i = 0; i < fIDs.size(); ++i ) + { + vector< TGeomID >::iterator it = + std::find( _faceIDs.begin(), _faceIDs.end(), fIDs[i] ); + if ( it == _faceIDs.end() ) + _faceIDs.push_back( fIDs[i] ); + } + if ( !_node ) + _node = n; + } + //================================================================================ + /* + * Returns index of a common face if any, else zero + */ + int B_IntersectPoint::HasCommonFace( const B_IntersectPoint * other, int avoidFace ) const + { + if ( other ) + for ( size_t i = 0; i < other->_faceIDs.size(); ++i ) + if ( avoidFace != other->_faceIDs[i] && + IsOnFace ( other->_faceIDs[i] )) + return other->_faceIDs[i]; + return 0; + } + //================================================================================ + /* + * Returns \c true if \a faceID in in this->_faceIDs + */ + bool B_IntersectPoint::IsOnFace( int faceID ) const // returns true if faceID is found + { + vector< TGeomID >::const_iterator it = + std::find( _faceIDs.begin(), _faceIDs.end(), faceID ); + return ( it != _faceIDs.end() ); } //================================================================================ /* @@ -575,7 +835,7 @@ namespace LineIndexer Grid::GetLineIndexer(size_t iDir) const { const size_t indices[] = { 1,2,0, 0,2,1, 0,1,2 }; - const string s[] = { "X", "Y", "Z" }; + const string s [] = { "X", "Y", "Z" }; LineIndexer li( _coords[0].size(), _coords[1].size(), _coords[2].size(), indices[iDir*3], indices[iDir*3+1], indices[iDir*3+2], s[indices[iDir*3]], s[indices[iDir*3+1]], s[indices[iDir*3+2]]); @@ -588,12 +848,33 @@ namespace void Grid::SetCoordinates(const vector& xCoords, const vector& yCoords, const vector& zCoords, - const TopoDS_Shape& shape) + const double* axesDirs, + const Bnd_Box& shapeBox) { _coords[0] = xCoords; _coords[1] = yCoords; _coords[2] = zCoords; + _axes[0].SetCoord( axesDirs[0], + axesDirs[1], + axesDirs[2]); + _axes[1].SetCoord( axesDirs[3], + axesDirs[4], + axesDirs[5]); + _axes[2].SetCoord( axesDirs[6], + axesDirs[7], + axesDirs[8]); + _axes[0].Normalize(); + _axes[1].Normalize(); + _axes[2].Normalize(); + + _invB.SetCols( _axes[0], _axes[1], _axes[2] ); + _invB.Invert(); + + // _isOrthogonalAxes = ( Abs( _axes[0] * _axes[1] ) < 1e-20 && + // Abs( _axes[1] * _axes[2] ) < 1e-20 && + // Abs( _axes[2] * _axes[0] ) < 1e-20 ); + // compute tolerance _minCellSize = Precision::Infinite(); for ( int iDir = 0; iDir < 3; ++iDir ) // loop on 3 line directions @@ -607,21 +888,37 @@ namespace } if ( _minCellSize < Precision::Confusion() ) throw SMESH_ComputeError (COMPERR_ALGO_FAILED, - SMESH_Comment("Too small cell size: ") << _tol ); + SMESH_Comment("Too small cell size: ") << _minCellSize ); _tol = _minCellSize / 1000.; - // attune grid extremities to shape bounding box computed by vertices - Bnd_Box shapeBox; - for ( TopExp_Explorer vExp( shape, TopAbs_VERTEX ); vExp.More(); vExp.Next() ) - shapeBox.Add( BRep_Tool::Pnt( TopoDS::Vertex( vExp.Current() ))); - + // attune grid extremities to shape bounding box + double sP[6]; // aXmin, aYmin, aZmin, aXmax, aYmax, aZmax shapeBox.Get(sP[0],sP[1],sP[2],sP[3],sP[4],sP[5]); double* cP[6] = { &_coords[0].front(), &_coords[1].front(), &_coords[2].front(), &_coords[0].back(), &_coords[1].back(), &_coords[2].back() }; for ( int i = 0; i < 6; ++i ) if ( fabs( sP[i] - *cP[i] ) < _tol ) - *cP[i] = sP[i] + _tol/1000. * ( i < 3 ? +1 : -1 ); + *cP[i] = sP[i];// + _tol/1000. * ( i < 3 ? +1 : -1 ); + + for ( int iDir = 0; iDir < 3; ++iDir ) + { + if ( _coords[iDir][0] - sP[iDir] > _tol ) + { + _minCellSize = Min( _minCellSize, _coords[iDir][0] - sP[iDir] ); + _coords[iDir].insert( _coords[iDir].begin(), sP[iDir] + _tol/1000.); + } + if ( sP[iDir+3] - _coords[iDir].back() > _tol ) + { + _minCellSize = Min( _minCellSize, sP[iDir+3] - _coords[iDir].back() ); + _coords[iDir].push_back( sP[iDir+3] - _tol/1000.); + } + } + _tol = _minCellSize / 1000.; + + _origin = ( _coords[0][0] * _axes[0] + + _coords[1][0] * _axes[1] + + _coords[2][0] * _axes[2] ); // create lines for ( int iDir = 0; iDir < 3; ++iDir ) // loop on 3 line directions @@ -629,17 +926,34 @@ namespace LineIndexer li = GetLineIndexer( iDir ); _lines[iDir].resize( li.NbLines() ); double len = _coords[ iDir ].back() - _coords[iDir].front(); - gp_Vec dir( iDir==0, iDir==1, iDir==2 ); for ( ; li.More(); ++li ) { GridLine& gl = _lines[iDir][ li.LineIndex() ]; - gl._line.SetLocation(gp_Pnt(_coords[0][li.I()], _coords[1][li.J()], _coords[2][li.K()])); - gl._line.SetDirection( dir ); + gl._line.SetLocation( _coords[0][li.I()] * _axes[0] + + _coords[1][li.J()] * _axes[1] + + _coords[2][li.K()] * _axes[2] ); + gl._line.SetDirection( _axes[ iDir ]); gl._length = len; } } } //================================================================================ + /* + * Computes coordinates of a point in the grid CS + */ + void Grid::ComputeUVW(const gp_XYZ& P, double UVW[3]) + { + // gp_XYZ p = P - _origin; + // UVW[ 0 ] = p.X() * _invB( 1, 1 ) + p.Y() * _invB( 1, 2 ) + p.Z() * _invB( 1, 3 ); + // UVW[ 1 ] = p.X() * _invB( 2, 1 ) + p.Y() * _invB( 2, 2 ) + p.Z() * _invB( 2, 3 ); + // UVW[ 2 ] = p.X() * _invB( 3, 1 ) + p.Y() * _invB( 3, 2 ) + p.Z() * _invB( 3, 3 ); + // UVW[ 0 ] += _coords[0][0]; + // UVW[ 1 ] += _coords[1][0]; + // UVW[ 2 ] += _coords[2][0]; + gp_XYZ p = P * _invB; + p.Coord( UVW[0], UVW[1], UVW[2] ); + } + //================================================================================ /* * Creates all nodes */ @@ -649,7 +963,7 @@ namespace const size_t nbGridNodes = _coords[0].size() * _coords[1].size() * _coords[2].size(); vector< bool > isNodeOut( nbGridNodes, false ); _nodes.resize( nbGridNodes, 0 ); - _isBndNode.resize( nbGridNodes, false ); + _gridIntP.resize( nbGridNodes, NULL ); for ( int iDir = 0; iDir < 3; ++iDir ) // loop on 3 line directions { @@ -668,12 +982,16 @@ namespace nIndex0 = NodeIndex( li.I(), li.J(), li.K() ); GridLine& line = _lines[ iDir ][ li.LineIndex() ]; + const gp_XYZ lineLoc = line._line.Location().XYZ(); + const gp_XYZ lineDir = line._line.Direction().XYZ(); line.RemoveExcessIntPoints( _tol ); - multiset< IntersectionPoint >& intPnts = _lines[ iDir ][ li.LineIndex() ]._intPoints; - multiset< IntersectionPoint >::iterator ip = intPnts.begin(); + multiset< F_IntersectPoint >& intPnts = _lines[ iDir ][ li.LineIndex() ]._intPoints; + multiset< F_IntersectPoint >::iterator ip = intPnts.begin(); bool isOut = true; - const double* nodeCoord = & coords[0], *coord0 = nodeCoord, *coordEnd = coord0 + coords.size(); + const double* nodeCoord = & coords[0]; + const double* coord0 = nodeCoord; + const double* coordEnd = coord0 + coords.size(); double nodeParam = 0; for ( ; ip != intPnts.end(); ++ip ) { @@ -696,24 +1014,30 @@ namespace // create a mesh node on a GridLine at ip if it does not coincide with a grid node if ( nodeParam > ip->_paramOnLine + _tol ) { - li.SetIndexOnLine( 0 ); - double xyz[3] = { _coords[0][ li.I() ], _coords[1][ li.J() ], _coords[2][ li.K() ]}; - xyz[ li._iConst ] += ip->_paramOnLine; - ip->_node = helper.AddNode( xyz[0], xyz[1], xyz[2] ); + // li.SetIndexOnLine( 0 ); + // double xyz[3] = { _coords[0][ li.I() ], _coords[1][ li.J() ], _coords[2][ li.K() ]}; + // xyz[ li._iConst ] += ip->_paramOnLine; + gp_XYZ xyz = lineLoc + ip->_paramOnLine * lineDir; + ip->_node = helper.AddNode( xyz.X(), xyz.Y(), xyz.Z() ); ip->_indexOnLine = nodeCoord-coord0-1; } // create a mesh node at ip concident with a grid node else { int nodeIndex = nIndex0 + nShift * ( nodeCoord-coord0 ); - if ( ! _nodes[ nodeIndex ] ) + if ( !_nodes[ nodeIndex ] ) { - li.SetIndexOnLine( nodeCoord-coord0 ); - double xyz[3] = { _coords[0][ li.I() ], _coords[1][ li.J() ], _coords[2][ li.K() ]}; - _nodes[ nodeIndex ] = helper.AddNode( xyz[0], xyz[1], xyz[2] ); - _isBndNode[ nodeIndex ] = true; + //li.SetIndexOnLine( nodeCoord-coord0 ); + //double xyz[3] = { _coords[0][ li.I() ], _coords[1][ li.J() ], _coords[2][ li.K() ]}; + gp_XYZ xyz = lineLoc + nodeParam * lineDir; + _nodes [ nodeIndex ] = helper.AddNode( xyz.X(), xyz.Y(), xyz.Z() ); + _gridIntP[ nodeIndex ] = & * ip; } - //ip->_node = _nodes[ nodeIndex ]; + if ( _gridIntP[ nodeIndex ] ) + _gridIntP[ nodeIndex ]->Add( ip->_faceIDs ); + else + _gridIntP[ nodeIndex ] = & * ip; + // ip->_node = _nodes[ nodeIndex ]; -- to differ from ip on links ip->_indexOnLine = nodeCoord-coord0; if ( ++nodeCoord < coordEnd ) nodeParam = *nodeCoord - *coord0; @@ -733,7 +1057,13 @@ namespace { size_t nodeIndex = NodeIndex( x, y, z ); if ( !isNodeOut[ nodeIndex ] && !_nodes[ nodeIndex] ) - _nodes[ nodeIndex ] = helper.AddNode( _coords[0][x], _coords[1][y], _coords[2][z] ); + { + //_nodes[ nodeIndex ] = helper.AddNode( _coords[0][x], _coords[1][y], _coords[2][z] ); + gp_XYZ xyz = ( _coords[0][x] * _axes[0] + + _coords[1][y] * _axes[1] + + _coords[2][z] * _axes[2] ); + _nodes[ nodeIndex ] = helper.AddNode( xyz.X(), xyz.Y(), xyz.Z() ); + } } #ifdef _MY_DEBUG_ @@ -744,7 +1074,7 @@ namespace LineIndexer li = GetLineIndexer( iDir ); for ( ; li.More(); ++li ) { - multiset< IntersectionPoint >& intPnts = _lines[ iDir ][ li.LineIndex() ]._intPoints; + multiset< F_IntersectPoint >& intPnts = _lines[ iDir ][ li.LineIndex() ]._intPoints; if ( intPnts.empty() ) continue; if ( intPnts.size() == 1 ) { @@ -782,72 +1112,72 @@ namespace */ bool FaceGridIntersector::IsInGrid(const Bnd_Box& gridBox) { - double x0,y0,z0, x1,y1,z1; - const Bnd_Box& faceBox = GetFaceBndBox(); - faceBox.Get(x0,y0,z0, x1,y1,z1); - - if ( !gridBox.IsOut( gp_Pnt( x0,y0,z0 )) && - !gridBox.IsOut( gp_Pnt( x1,y1,z1 ))) - return true; - - double X0,Y0,Z0, X1,Y1,Z1; - gridBox.Get(X0,Y0,Z0, X1,Y1,Z1); - double faceP[6] = { x0,y0,z0, x1,y1,z1 }; - double gridP[6] = { X0,Y0,Z0, X1,Y1,Z1 }; - gp_Dir axes[3] = { gp::DX(), gp::DY(), gp::DZ() }; - for ( int iDir = 0; iDir < 6; ++iDir ) - { - if ( iDir < 3 && gridP[ iDir ] <= faceP[ iDir ] ) continue; - if ( iDir >= 3 && gridP[ iDir ] >= faceP[ iDir ] ) continue; - - // check if the face intersects a side of a gridBox - - gp_Pnt p = iDir < 3 ? gp_Pnt( X0,Y0,Z0 ) : gp_Pnt( X1,Y1,Z1 ); - gp_Ax1 norm( p, axes[ iDir % 3 ] ); - if ( iDir < 3 ) norm.Reverse(); - - gp_XYZ O = norm.Location().XYZ(), N = norm.Direction().XYZ(); - - TopLoc_Location loc = _face.Location(); - Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(_face,loc); - if ( !aPoly.IsNull() ) - { - if ( !loc.IsIdentity() ) - { - norm.Transform( loc.Transformation().Inverted() ); - O = norm.Location().XYZ(), N = norm.Direction().XYZ(); - } - const double deflection = aPoly->Deflection(); - - const TColgp_Array1OfPnt& nodes = aPoly->Nodes(); - for ( int i = nodes.Lower(); i <= nodes.Upper(); ++i ) - if (( nodes( i ).XYZ() - O ) * N > _grid->_tol + deflection ) - return false; - } - else - { - BRepAdaptor_Surface surf( _face ); - double u0, u1, v0, v1, du, dv, u, v; - BRepTools::UVBounds( _face, u0, u1, v0, v1); - if ( surf.GetType() == GeomAbs_Plane ) { - du = u1 - u0, dv = v1 - v0; - } - else { - du = surf.UResolution( _grid->_minCellSize / 10. ); - dv = surf.VResolution( _grid->_minCellSize / 10. ); - } - for ( u = u0, v = v0; u <= u1 && v <= v1; u += du, v += dv ) - { - gp_Pnt p = surf.Value( u, v ); - if (( p.XYZ() - O ) * N > _grid->_tol ) - { - TopAbs_State state = GetCurveFaceIntersector()->ClassifyUVPoint(gp_Pnt2d( u, v )); - if ( state == TopAbs_IN || state == TopAbs_ON ) - return false; - } - } - } - } + // double x0,y0,z0, x1,y1,z1; + // const Bnd_Box& faceBox = GetFaceBndBox(); + // faceBox.Get(x0,y0,z0, x1,y1,z1); + + // if ( !gridBox.IsOut( gp_Pnt( x0,y0,z0 )) && + // !gridBox.IsOut( gp_Pnt( x1,y1,z1 ))) + // return true; + + // double X0,Y0,Z0, X1,Y1,Z1; + // gridBox.Get(X0,Y0,Z0, X1,Y1,Z1); + // double faceP[6] = { x0,y0,z0, x1,y1,z1 }; + // double gridP[6] = { X0,Y0,Z0, X1,Y1,Z1 }; + // gp_Dir axes[3] = { gp::DX(), gp::DY(), gp::DZ() }; + // for ( int iDir = 0; iDir < 6; ++iDir ) + // { + // if ( iDir < 3 && gridP[ iDir ] <= faceP[ iDir ] ) continue; + // if ( iDir >= 3 && gridP[ iDir ] >= faceP[ iDir ] ) continue; + + // // check if the face intersects a side of a gridBox + + // gp_Pnt p = iDir < 3 ? gp_Pnt( X0,Y0,Z0 ) : gp_Pnt( X1,Y1,Z1 ); + // gp_Ax1 norm( p, axes[ iDir % 3 ] ); + // if ( iDir < 3 ) norm.Reverse(); + + // gp_XYZ O = norm.Location().XYZ(), N = norm.Direction().XYZ(); + + // TopLoc_Location loc = _face.Location(); + // Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(_face,loc); + // if ( !aPoly.IsNull() ) + // { + // if ( !loc.IsIdentity() ) + // { + // norm.Transform( loc.Transformation().Inverted() ); + // O = norm.Location().XYZ(), N = norm.Direction().XYZ(); + // } + // const double deflection = aPoly->Deflection(); + + // const TColgp_Array1OfPnt& nodes = aPoly->Nodes(); + // for ( int i = nodes.Lower(); i <= nodes.Upper(); ++i ) + // if (( nodes( i ).XYZ() - O ) * N > _grid->_tol + deflection ) + // return false; + // } + // else + // { + // BRepAdaptor_Surface surf( _face ); + // double u0, u1, v0, v1, du, dv, u, v; + // BRepTools::UVBounds( _face, u0, u1, v0, v1); + // if ( surf.GetType() == GeomAbs_Plane ) { + // du = u1 - u0, dv = v1 - v0; + // } + // else { + // du = surf.UResolution( _grid->_minCellSize / 10. ); + // dv = surf.VResolution( _grid->_minCellSize / 10. ); + // } + // for ( u = u0, v = v0; u <= u1 && v <= v1; u += du, v += dv ) + // { + // gp_Pnt p = surf.Value( u, v ); + // if (( p.XYZ() - O ) * N > _grid->_tol ) + // { + // TopAbs_State state = GetCurveFaceIntersector()->ClassifyUVPoint(gp_Pnt2d( u, v )); + // if ( state == TopAbs_IN || state == TopAbs_ON ) + // return false; + // } + // } + // } + // } return true; } //============================================================================= @@ -921,7 +1251,7 @@ namespace if ( _bndBox.IsOut( gridLine._line )) continue; intersector._intPoints.clear(); - (intersector.*interFunction)( gridLine ); + (intersector.*interFunction)( gridLine ); // <- intersection with gridLine for ( size_t i = 0; i < intersector._intPoints.size(); ++i ) _intersections.push_back( make_pair( &gridLine, intersector._intPoints[i] )); } @@ -944,7 +1274,7 @@ namespace { if ( !toClassify || UVIsOnFace() ) { - IntersectionPoint p; + F_IntersectPoint p; p._paramOnLine = _w; p._transition = _transition; _intPoints.push_back( p ); @@ -970,7 +1300,7 @@ namespace */ void FaceLineIntersector::IntersectWithCylinder(const GridLine& gridLine) { - IntAna_IntConicQuad linCylinder( gridLine._line,_cylinder); + IntAna_IntConicQuad linCylinder( gridLine._line, _cylinder ); if ( linCylinder.IsDone() && linCylinder.NbPoints() > 0 ) { _w = linCylinder.ParamOnConic(1); @@ -1181,7 +1511,7 @@ namespace * \brief Creates topology of the hexahedron */ Hexahedron::Hexahedron(const double sizeThreshold, Grid* grid) - : _grid( grid ), _sizeThreshold( sizeThreshold ), _nbIntNodes(0) + : _grid( grid ), _sizeThreshold( sizeThreshold ), _nbFaceIntNodes(0) { _polygons.reserve(100); // to avoid reallocation; @@ -1214,8 +1544,6 @@ namespace _Link& link = _hexLinks[ SMESH_Block::ShapeIndex( linkID )]; link._nodes[0] = &_hexNodes[ SMESH_Block::ShapeIndex( idVec[0] )]; link._nodes[1] = &_hexNodes[ SMESH_Block::ShapeIndex( idVec[1] )]; - link._intNodes.reserve( 10 ); // to avoid reallocation - link._splits.reserve( 10 ); } // set links to faces @@ -1246,7 +1574,7 @@ namespace * \brief Copy constructor */ Hexahedron::Hexahedron( const Hexahedron& other ) - :_grid( other._grid ), _sizeThreshold( other._sizeThreshold ), _nbIntNodes(0) + :_grid( other._grid ), _sizeThreshold( other._sizeThreshold ), _nbFaceIntNodes(0) { _polygons.reserve(100); // to avoid reallocation; @@ -1259,8 +1587,6 @@ namespace _Link& tgtLink = this->_hexLinks[ i ]; tgtLink._nodes[0] = _hexNodes + ( srcLink._nodes[0] - other._hexNodes ); tgtLink._nodes[1] = _hexNodes + ( srcLink._nodes[1] - other._hexNodes ); - tgtLink._intNodes.reserve( 10 ); // to avoid reallocation - tgtLink._splits.reserve( 10 ); } for ( int i = 0; i < 6; ++i ) @@ -1291,40 +1617,184 @@ namespace _origNodeInd = _grid->NodeIndex( i,j,k ); for ( int iN = 0; iN < 8; ++iN ) { - _hexNodes[iN]._node = _grid->_nodes[ _origNodeInd + _nodeShift[iN] ]; + _hexNodes[iN]._node = _grid->_nodes [ _origNodeInd + _nodeShift[iN] ]; + _hexNodes[iN]._intPoint = _grid->_gridIntP[ _origNodeInd + _nodeShift[iN] ]; _nbCornerNodes += bool( _hexNodes[iN]._node ); - _nbBndNodes += _grid->_isBndNode[ _origNodeInd + _nodeShift[iN] ]; + _nbBndNodes += bool( _hexNodes[iN]._intPoint ); } _sideLength[0] = _grid->_coords[0][i+1] - _grid->_coords[0][i]; _sideLength[1] = _grid->_coords[1][j+1] - _grid->_coords[1][j]; _sideLength[2] = _grid->_coords[2][k+1] - _grid->_coords[2][k]; - if ( _nbCornerNodes < 8 && _nbIntNodes + _nbCornerNodes > 3) + _intNodes.clear(); + _vIntNodes.clear(); + + if ( _nbFaceIntNodes + _eIntPoints.size() > 0 && + _nbFaceIntNodes + _nbCornerNodes + _eIntPoints.size() > 3) { + _intNodes.reserve( 3 * _nbBndNodes + _nbFaceIntNodes + _eIntPoints.size() ); + _Link split; - // create sub-links (_splits) by splitting links with _intNodes + // create sub-links (_splits) by splitting links with _fIntPoints for ( int iLink = 0; iLink < 12; ++iLink ) { _Link& link = _hexLinks[ iLink ]; + link._fIntNodes.resize( link._fIntPoints.size() ); + for ( size_t i = 0; i < link._fIntPoints.size(); ++i ) + { + _intNodes.push_back( _Node( 0, link._fIntPoints[i] )); + link._fIntNodes[ i ] = & _intNodes.back(); + } + link._splits.clear(); split._nodes[ 0 ] = link._nodes[0]; - for ( size_t i = 0; i < link._intNodes.size(); ++ i ) + bool isOut = ( ! link._nodes[0]->Node() ); // is1stNodeOut( iLink ); + bool checkTransition; + for ( size_t i = 0; i < link._fIntNodes.size(); ++i ) + { + if ( link._fIntNodes[i]->Node() ) // intersection non-coinsident with a grid node + { + if ( split._nodes[ 0 ]->Node() && !isOut ) + { + split._nodes[ 1 ] = link._fIntNodes[i]; + link._splits.push_back( split ); + } + split._nodes[ 0 ] = link._fIntNodes[i]; + checkTransition = true; + } + else // FACE intersection coinsident with a grid node + { + checkTransition = ( link._nodes[0]->Node() ); + } + if ( checkTransition ) + { + switch ( link._fIntPoints[i]->_transition ) { + case Trans_OUT: isOut = true; break; + case Trans_IN : isOut = false; break; + default: + if ( !link._fIntNodes[i]->Node() && i == 0 ) + isOut = is1stNodeOut( link ); + else + ; // isOut remains the same + } + } + } + if ( link._nodes[ 1 ]->Node() && split._nodes[ 0 ]->Node() && !isOut ) + { + split._nodes[ 1 ] = link._nodes[1]; + link._splits.push_back( split ); + } + } + + // Create _Node's at intersections with EDGEs. + + const double tol2 = _grid->_tol * _grid->_tol; + int facets[3], nbFacets, subEntity; + + for ( size_t iP = 0; iP < _eIntPoints.size(); ++iP ) + { + nbFacets = getEntity( _eIntPoints[iP], facets, subEntity ); + _Node* equalNode = 0; + switch( nbFacets ) { + case 1: // in a _Face + { + _Face& quad = _hexQuads[ facets[0] - SMESH_Block::ID_FirstF ]; + equalNode = FindEqualNode( quad._eIntNodes, _eIntPoints[ iP ], tol2 ); + if ( equalNode ) { + equalNode->Add( _eIntPoints[ iP ] ); + } + else { + _intNodes.push_back( _Node( 0, _eIntPoints[ iP ])); + quad._eIntNodes.push_back( & _intNodes.back() ); + } + break; + } + case 2: // on a _Link + { + _Link& link = _hexLinks[ subEntity - SMESH_Block::ID_FirstE ]; + if ( link._splits.size() > 0 ) + { + equalNode = FindEqualNode( link._fIntNodes, _eIntPoints[ iP ], tol2 ); + if ( equalNode ) + equalNode->Add( _eIntPoints[ iP ] ); + } + else + { + _intNodes.push_back( _Node( 0, _eIntPoints[ iP ])); + for ( int iF = 0; iF < 2; ++iF ) + { + _Face& quad = _hexQuads[ facets[iF] - SMESH_Block::ID_FirstF ]; + equalNode = FindEqualNode( quad._eIntNodes, _eIntPoints[ iP ], tol2 ); + if ( equalNode ) { + equalNode->Add( _eIntPoints[ iP ] ); + } + else { + quad._eIntNodes.push_back( & _intNodes.back() ); + } + } + } + break; + } + case 3: // at a corner { - if ( split._nodes[ 0 ]->Node() ) + _Node& node = _hexNodes[ subEntity - SMESH_Block::ID_FirstV ]; + if ( node.Node() > 0 ) + { + if ( node._intPoint ) + node._intPoint->Add( _eIntPoints[ iP ]->_faceIDs, _eIntPoints[ iP ]->_node ); + } + else { - split._nodes[ 1 ] = &link._intNodes[i]; - link._splits.push_back( split ); + _intNodes.push_back( _Node( 0, _eIntPoints[ iP ])); + for ( int iF = 0; iF < 3; ++iF ) + { + _Face& quad = _hexQuads[ facets[iF] - SMESH_Block::ID_FirstF ]; + equalNode = FindEqualNode( quad._eIntNodes, _eIntPoints[ iP ], tol2 ); + if ( equalNode ) { + equalNode->Add( _eIntPoints[ iP ] ); + } + else { + quad._eIntNodes.push_back( & _intNodes.back() ); + } + } } - split._nodes[ 0 ] = &link._intNodes[i]; + break; } - if ( link._nodes[ 1 ]->Node() && split._nodes[ 0 ]->Node() ) + } // switch( nbFacets ) + + if ( nbFacets == 0 || + _grid->_shapes( _eIntPoints[ iP ]->_shapeID ).ShapeType() == TopAbs_VERTEX ) + { + equalNode = FindEqualNode( _vIntNodes, _eIntPoints[ iP ], tol2 ); + if ( equalNode ) { + equalNode->Add( _eIntPoints[ iP ] ); + } + else { + if ( _intNodes.empty() || _intNodes.back().EdgeIntPnt() != _eIntPoints[ iP ]) + _intNodes.push_back( _Node( 0, _eIntPoints[ iP ])); + _vIntNodes.push_back( & _intNodes.back() ); + } + } + } // loop on _eIntPoints + } + else if ( 3 < _nbCornerNodes && _nbCornerNodes < 8 ) // _nbFaceIntNodes == 0 + { + _Link split; + // create sub-links (_splits) of whole links + for ( int iLink = 0; iLink < 12; ++iLink ) + { + _Link& link = _hexLinks[ iLink ]; + link._splits.clear(); + if ( link._nodes[ 0 ]->Node() && link._nodes[ 1 ]->Node() ) { + split._nodes[ 0 ] = link._nodes[0]; split._nodes[ 1 ] = link._nodes[1]; link._splits.push_back( split ); } } } + } //================================================================================ /*! @@ -1348,149 +1818,505 @@ namespace { Init(); - if ( _nbCornerNodes + _nbIntNodes < 4 ) + int nbIntersections = _nbFaceIntNodes + _eIntPoints.size(); + if ( _nbCornerNodes + nbIntersections < 4 ) return; - if ( _nbBndNodes == _nbCornerNodes && isInHole() ) + if ( _nbBndNodes == _nbCornerNodes && nbIntersections == 0 && isInHole() ) return; _polygons.clear(); + _polygons.reserve( 20 ); - vector polyhedraNodes; - vector quantities; - - // create polygons from quadrangles and get their nodes + // Create polygons from quadrangles + // -------------------------------- - vector<_Node*> nodes; - nodes.reserve( _nbCornerNodes + _nbIntNodes ); + _Link polyLink; + vector< _OrientedLink > splits; + vector<_Node*> chainNodes, usedEdgeNodes; + _Face* coplanarPolyg; - _Link polyLink; - polyLink._faces.reserve( 1 ); + bool hasEdgeIntersections = !_eIntPoints.empty(); for ( int iF = 0; iF < 6; ++iF ) // loop on 6 sides of a hexahedron { - const _Face& quad = _hexQuads[ iF ] ; + _Face& quad = _hexQuads[ iF ] ; _polygons.resize( _polygons.size() + 1 ); - _Face& polygon = _polygons.back(); - polygon._links.clear(); - polygon._polyLinks.clear(); polygon._polyLinks.reserve( 10 ); + _Face* polygon = &_polygons.back(); + polygon->_polyLinks.reserve( 20 ); - // add splits of a link to a polygon and collect info on nodes - //int nbIn = 0, nbOut = 0, nbCorners = 0; - nodes.clear(); + splits.clear(); for ( int iE = 0; iE < 4; ++iE ) // loop on 4 sides of a quadrangle + for ( int iS = 0; iS < quad._links[ iE ].NbResultLinks(); ++iS ) + splits.push_back( quad._links[ iE ].ResultLink( iS )); + + // add splits of links to a polygon and add _polyLinks to make + // polygon's boundary closed + + int nbSplits = splits.size(); + if ( nbSplits < 2 && quad._eIntNodes.empty() ) + nbSplits = 0; + +#ifdef _DEBUG_ + for ( size_t iP = 0; iP < quad._eIntNodes.size(); ++iP ) + if ( quad._eIntNodes[ iP ]->IsUsedInFace( polygon )) + quad._eIntNodes[ iP ]->_usedInFace = 0; +#endif + int nbUsedEdgeNodes = 0; + + while ( nbSplits > 0 ) { - int nbSpits = quad._links[ iE ].NbResultLinks(); - for ( int iS = 0; iS < nbSpits; ++iS ) + size_t iS = 0; + while ( !splits[ iS ] ) + ++iS; + + if ( !polygon->_links.empty() ) + { + _polygons.resize( _polygons.size() + 1 ); + polygon = &_polygons.back(); + polygon->_polyLinks.reserve( 20 ); + } + polygon->_links.push_back( splits[ iS ] ); + splits[ iS++ ]._link = 0; + --nbSplits; + + _Node* nFirst = polygon->_links.back().FirstNode(); + _Node *n1,*n2 = polygon->_links.back().LastNode(); + for ( ; nFirst != n2 && iS < splits.size(); ++iS ) { - _OrientedLink split = quad._links[ iE ].ResultLink( iS ); - _Node* n = split.FirstNode(); - if ( !polygon._links.empty() ) + _OrientedLink& split = splits[ iS ]; + if ( !split ) continue; + + n1 = split.FirstNode(); + if ( n1 != n2 ) { - _Node* nPrev = polygon._links.back().LastNode(); - if ( nPrev != n ) + // try to connect to intersections with EDGEs + if ( quad._eIntNodes.size() > nbUsedEdgeNodes && + findChain( n2, n1, quad, chainNodes )) + { + for ( size_t i = 1; i < chainNodes.size(); ++i ) + { + polyLink._nodes[0] = chainNodes[i-1]; + polyLink._nodes[1] = chainNodes[i]; + polygon->_polyLinks.push_back( polyLink ); + polygon->_links.push_back( _OrientedLink( &polygon->_polyLinks.back() )); + nbUsedEdgeNodes += ( polyLink._nodes[1]->IsUsedInFace( polygon )); + } + if ( chainNodes.back() != n1 ) + { + n2 = chainNodes.back(); + --iS; + continue; + } + } + // try to connect to a split ending on the same FACE + else { - polyLink._nodes[0] = nPrev; - polyLink._nodes[1] = n; - polygon._polyLinks.push_back( polyLink ); - polygon._links.push_back( _OrientedLink( &polygon._polyLinks.back() )); - nodes.push_back( nPrev ); + _OrientedLink foundSplit; + for ( int i = iS; i < splits.size() && !foundSplit; ++i ) + if (( foundSplit = splits[ i ]) && + ( n2->IsLinked( foundSplit.FirstNode()->_intPoint ))) + { + polyLink._nodes[0] = n2; + polyLink._nodes[1] = foundSplit.FirstNode(); + polygon->_polyLinks.push_back( polyLink ); + polygon->_links.push_back( _OrientedLink( &polygon->_polyLinks.back() )); + iS = i - 1; + } + else + { + foundSplit._link = 0; + } + if ( foundSplit ) + { + n2 = foundSplit.FirstNode(); + continue; + } + else + { + if ( n2->IsLinked( nFirst->_intPoint )) + break; + polyLink._nodes[0] = n2; + polyLink._nodes[1] = n1; + polygon->_polyLinks.push_back( polyLink ); + polygon->_links.push_back( _OrientedLink( &polygon->_polyLinks.back() )); + } } } - polygon._links.push_back( split ); - nodes.push_back( n ); + polygon->_links.push_back( split ); + split._link = 0; + --nbSplits; + n2 = polygon->_links.back().LastNode(); + + } // loop on splits + + if ( nFirst != n2 ) // close a polygon + { + if ( !findChain( n2, nFirst, quad, chainNodes )) + { + if ( !closePolygon( polygon, chainNodes )) + chainNodes.push_back( nFirst ); + } + for ( size_t i = 1; i < chainNodes.size(); ++i ) + { + polyLink._nodes[0] = chainNodes[i-1]; + polyLink._nodes[1] = chainNodes[i]; + polygon->_polyLinks.push_back( polyLink ); + polygon->_links.push_back( _OrientedLink( &polygon->_polyLinks.back() )); + nbUsedEdgeNodes += bool( polyLink._nodes[1]->IsUsedInFace( polygon )); + } } - } - if ( polygon._links.size() > 1 ) - { - _Node* n1 = polygon._links.back().LastNode(); - _Node* n2 = polygon._links.front().FirstNode(); - if ( n1 != n2 ) + + if ( polygon->_links.size() < 3 && nbSplits > 0 ) { - polyLink._nodes[0] = n1; - polyLink._nodes[1] = n2; - polygon._polyLinks.push_back( polyLink ); - polygon._links.push_back( _OrientedLink( &polygon._polyLinks.back() )); - nodes.push_back( n1 ); + polygon->_polyLinks.clear(); + polygon->_links.clear(); } - // add polygon to its links - for ( size_t iL = 0; iL < polygon._links.size(); ++iL ) - polygon._links[ iL ]._link->_faces.push_back( &polygon ); - // store polygon nodes - quantities.push_back( nodes.size() ); - for ( size_t i = 0; i < nodes.size(); ++i ) - polyhedraNodes.push_back( nodes[i]->Node() ); - } - else + } // while ( nbSplits > 0 ) + + // if ( quad._eIntNodes.size() > nbUsedEdgeNodes ) + // { + // // make _vIntNodes from not used _eIntNodes + // const double tol = 0.05 * Min( Min( _sideLength[0], _sideLength[1] ), _sideLength[0] ); + // for ( size_t iP = 0; iP < quad._eIntNodes.size(); ++iP ) + // { + // if ( quad._eIntNodes[ iP ]->IsUsedInFace() ) continue; + // _Node* equalNode = + // FindEqualNode( _vIntNodes, quad._eIntNodes[ iP ].EdgeIntPnt(), tol*tol ); + // if ( equalNode ) + // equalNode->Add( quad._eIntNodes[ iP ].EdgeIntPnt() ); + // else + // _vIntNodes.push_back( quad._eIntNodes[ iP ]); + // } + // } + + if ( polygon->_links.size() < 3 ) { - _polygons.resize( _polygons.size() - 1 ); + _polygons.pop_back(); + //usedEdgeNodes.resize( usedEdgeNodes.size() - nbUsedEdgeNodes ); } - } + } // loop on 6 hexahedron sides + + // Create polygons closing holes in a polyhedron + // ---------------------------------------------- - // create polygons closing holes in a polyhedron + // clear _usedInFace + for ( size_t iN = 0; iN < _intNodes.size(); ++iN ) + _intNodes[ iN ]._usedInFace = 0; + // add polygons to their links and mark used nodes + for ( size_t iP = 0; iP < _polygons.size(); ++iP ) + { + _Face& polygon = _polygons[ iP ]; + for ( size_t iL = 0; iL < polygon._links.size(); ++iL ) + { + polygon._links[ iL ].AddFace( &polygon ); + polygon._links[ iL ].FirstNode()->_usedInFace = &polygon; + } + } // find free links vector< _OrientedLink* > freeLinks; + freeLinks.reserve(20); for ( size_t iP = 0; iP < _polygons.size(); ++iP ) { _Face& polygon = _polygons[ iP ]; for ( size_t iL = 0; iL < polygon._links.size(); ++iL ) - if ( polygon._links[ iL ]._link->_faces.size() < 2 ) + if ( polygon._links[ iL ].NbFaces() < 2 ) + { freeLinks.push_back( & polygon._links[ iL ]); + freeLinks.back()->FirstNode()->IsUsedInFace() == true; + } } - // make closed chains of free links int nbFreeLinks = freeLinks.size(); - if ( 0 < nbFreeLinks && nbFreeLinks < 3 ) return; + if ( nbFreeLinks > 0 && nbFreeLinks < 3 ) return; + + // put not used intersection nodes to _vIntNodes + int nbVertexNodes = 0; // nb not used vertex nodes + { + for ( size_t iN = 0; iN < _vIntNodes.size(); ++iN ) + nbVertexNodes += ( !_vIntNodes[ iN ]->IsUsedInFace() ); + + const double tol = 1e-3 * Min( Min( _sideLength[0], _sideLength[1] ), _sideLength[0] ); + for ( size_t iN = _nbFaceIntNodes; iN < _intNodes.size(); ++iN ) + { + if ( _intNodes[ iN ].IsUsedInFace() ) continue; + if ( dynamic_cast< const F_IntersectPoint* >( _intNodes[ iN ]._intPoint )) continue; + _Node* equalNode = + FindEqualNode( _vIntNodes, _intNodes[ iN ].EdgeIntPnt(), tol*tol ); + if ( !equalNode /*|| equalNode->IsUsedInFace()*/ ) + { + _vIntNodes.push_back( &_intNodes[ iN ]); + ++nbVertexNodes; + } + } + } + + set usedFaceIDs; + TGeomID curFace = 0; + const size_t nbQuadPolygons = _polygons.size(); + + // create polygons by making closed chains of free links + size_t iPolygon = _polygons.size(); while ( nbFreeLinks > 0 ) { - nodes.clear(); - _polygons.resize( _polygons.size() + 1 ); - _Face& polygon = _polygons.back(); - polygon._links.clear(); + if ( iPolygon == _polygons.size() ) + _polygons.resize( _polygons.size() + 1 ); + _Face& polygon = _polygons[ iPolygon ]; + polygon._polyLinks.reserve( 20 ); + polygon._links.reserve( 20 ); - // get a remaining link to start from _OrientedLink* curLink = 0; - for ( size_t iL = 0; iL < freeLinks.size() && !curLink; ++iL ) - if (( curLink = freeLinks[ iL ] )) - freeLinks[ iL ] = 0; - nodes.push_back( curLink->LastNode() ); - polygon._links.push_back( *curLink ); - - // find all links connected to curLink - _Node* curNode = 0; - do - { - curNode = curLink->FirstNode(); - curLink = 0; + _Node* curNode; + if (( !hasEdgeIntersections ) || + ( nbFreeLinks < 4 && nbVertexNodes == 0 )) + { + // get a remaining link to start from for ( size_t iL = 0; iL < freeLinks.size() && !curLink; ++iL ) - if ( freeLinks[ iL ] && freeLinks[ iL ]->LastNode() == curNode ) - { - curLink = freeLinks[ iL ]; + if (( curLink = freeLinks[ iL ] )) freeLinks[ iL ] = 0; - nodes.push_back( curNode ); - polygon._links.push_back( *curLink ); + polygon._links.push_back( *curLink ); + --nbFreeLinks; + do + { + // find all links connected to curLink + curNode = curLink->FirstNode(); + curLink = 0; + for ( size_t iL = 0; iL < freeLinks.size() && !curLink; ++iL ) + if ( freeLinks[ iL ] && freeLinks[ iL ]->LastNode() == curNode ) + { + curLink = freeLinks[ iL ]; + freeLinks[ iL ] = 0; + --nbFreeLinks; + polygon._links.push_back( *curLink ); + } + } while ( curLink ); + } + else // there are intersections with EDGEs + { + // get a remaining link to start from, one lying on minimal + // nb of FACEs + { + vector< pair< TGeomID, int > > facesOfLink[3]; + pair< TGeomID, int > faceOfLink( -1, -1 ); + vector< TGeomID > faces; + for ( size_t iL = 0; iL < freeLinks.size(); ++iL ) + if ( freeLinks[ iL ] ) + { + faces = freeLinks[ iL ]->GetNotUsedFace( usedFaceIDs ); + if ( faces.size() == 1 ) + { + faceOfLink = make_pair( faces[0], iL ); + if ( !freeLinks[ iL ]->HasEdgeNodes() ) + break; + facesOfLink[0].push_back( faceOfLink ); + } + else if ( facesOfLink[0].empty() ) + { + faceOfLink = make_pair(( faces.empty() ? -1 : faces[0]), iL ); + facesOfLink[ 1 + faces.empty() ].push_back( faceOfLink ); + } + } + for ( int i = 0; faceOfLink.second < 0 && i < 3; ++i ) + if ( !facesOfLink[i].empty() ) + faceOfLink = facesOfLink[i][0]; + + if ( faceOfLink.first < 0 ) // all faces used + { + for ( size_t i = 0; i < facesOfLink[2].size() && faceOfLink.first < 1; ++i ) + { + curLink = freeLinks[ facesOfLink[2][i].second ]; + faceOfLink.first = curLink->FirstNode()->IsLinked( curLink->LastNode()->_intPoint ); + } + usedFaceIDs.clear(); } - } while ( curLink ); + curFace = faceOfLink.first; + curLink = freeLinks[ faceOfLink.second ]; + freeLinks[ faceOfLink.second ] = 0; + } + usedFaceIDs.insert( curFace ); + polygon._links.push_back( *curLink ); + --nbFreeLinks; - nbFreeLinks -= polygon._links.size(); + // find all links bounding a FACE of curLink + do + { + // go forward from curLink + curNode = curLink->LastNode(); + curLink = 0; + for ( size_t iL = 0; iL < freeLinks.size() && !curLink; ++iL ) + if ( freeLinks[ iL ] && + freeLinks[ iL ]->FirstNode() == curNode && + freeLinks[ iL ]->LastNode()->IsOnFace( curFace )) + { + curLink = freeLinks[ iL ]; + freeLinks[ iL ] = 0; + polygon._links.push_back( *curLink ); + --nbFreeLinks; + } + } while ( curLink ); - if ( curNode != nodes.front() || polygon._links.size() < 3 ) - return; // closed polygon not found -> invalid polyhedron + std::reverse( polygon._links.begin(), polygon._links.end() ); - quantities.push_back( nodes.size() ); - for ( size_t i = 0; i < nodes.size(); ++i ) - polyhedraNodes.push_back( nodes[i]->Node() ); + curLink = & polygon._links.back(); + do + { + // go backward from curLink + curNode = curLink->FirstNode(); + curLink = 0; + for ( size_t iL = 0; iL < freeLinks.size() && !curLink; ++iL ) + if ( freeLinks[ iL ] && + freeLinks[ iL ]->LastNode() == curNode && + freeLinks[ iL ]->FirstNode()->IsOnFace( curFace )) + { + curLink = freeLinks[ iL ]; + freeLinks[ iL ] = 0; + polygon._links.push_back( *curLink ); + --nbFreeLinks; + } + } while ( curLink ); + + curNode = polygon._links.back().FirstNode(); + + if ( polygon._links[0].LastNode() != curNode ) + { + if ( nbVertexNodes > 0 ) + { + // add links with _vIntNodes if not already used + for ( size_t iN = 0; iN < _vIntNodes.size(); ++iN ) + if ( !_vIntNodes[ iN ]->IsUsedInFace() && + _vIntNodes[ iN ]->IsOnFace( curFace )) + { + _vIntNodes[ iN ]->_usedInFace = &polygon; + --nbVertexNodes; + polyLink._nodes[0] = _vIntNodes[ iN ]; + polyLink._nodes[1] = curNode; + polygon._polyLinks.push_back( polyLink ); + polygon._links.push_back( _OrientedLink( &polygon._polyLinks.back() )); + freeLinks.push_back( &polygon._links.back() ); + ++nbFreeLinks; + curNode = _vIntNodes[ iN ]; + // TODO: to reorder _vIntNodes within polygon, if there are several ones + } + } + // if ( polygon._links.size() > 1 ) + { + polyLink._nodes[0] = polygon._links[0].LastNode(); + polyLink._nodes[1] = curNode; + polygon._polyLinks.push_back( polyLink ); + polygon._links.push_back( _OrientedLink( &polygon._polyLinks.back() )); + freeLinks.push_back( &polygon._links.back() ); + ++nbFreeLinks; + } + } + } // if there are intersections with EDGEs - // add polygon to its links and reverse links - for ( size_t i = 0; i < polygon._links.size(); ++i ) + if ( polygon._links.size() < 2 || + polygon._links[0].LastNode() != polygon._links.back().FirstNode() ) + return; // closed polygon not found -> invalid polyhedron + + if ( polygon._links.size() == 2 ) { - polygon._links[i].Reverse(); - polygon._links[i]._link->_faces.push_back( &polygon ); + if ( freeLinks.back() == &polygon._links.back() ) + { + freeLinks.pop_back(); + --nbFreeLinks; + } + if ( polygon._links.front().NbFaces() > 0 ) + polygon._links.back().AddFace( polygon._links.front()._link->_faces[0] ); + if ( polygon._links.back().NbFaces() > 0 ) + polygon._links.front().AddFace( polygon._links.back()._link->_faces[0] ); + + _polygons.pop_back(); } + else // polygon._links.size() >= 2 + { + // add polygon to its links + for ( size_t iL = 0; iL < polygon._links.size(); ++iL ) + { + polygon._links[ iL ].AddFace( &polygon ); + polygon._links[ iL ].Reverse(); + } + if ( hasEdgeIntersections && iPolygon == _polygons.size() - 1 ) + { + // check that a polygon does not lie in the plane of another polygon + coplanarPolyg = 0; + for ( size_t iL = 0; iL < polygon._links.size() && !coplanarPolyg; ++iL ) + { + if ( polygon._links[ iL ].NbFaces() < 2 ) + continue; // it's a just added free link + // look for a polygon made on a hexa side and sharing + // two or more haxa links + size_t iL2; + coplanarPolyg = polygon._links[ iL ]._link->_faces[0]; + for ( iL2 = iL + 1; iL2 < polygon._links.size(); ++iL2 ) + if ( polygon._links[ iL2 ]._link->_faces[0] == coplanarPolyg && + !coplanarPolyg->isPolyLink( polygon._links[ iL2 ]) && + coplanarPolyg < & _polygons[ nbQuadPolygons ]) + break; + if ( iL2 == polygon._links.size() ) + coplanarPolyg = 0; + } + if ( 0 /*coplanarPolyg*/ ) // coplanar polygon found + { + freeLinks.resize( freeLinks.size() - polygon._polyLinks.size() ); + nbFreeLinks -= polygon._polyLinks.size(); + + // fill freeLinks with links not shared by coplanarPolyg and polygon + for ( size_t iL = 0; iL < polygon._links.size(); ++iL ) + if ( polygon._links[ iL ]._link->_faces[1] && + polygon._links[ iL ]._link->_faces[0] != coplanarPolyg ) + { + _Face* p = polygon._links[ iL ]._link->_faces[0]; + for ( size_t iL2 = 0; iL2 < p->_links.size(); ++iL2 ) + if ( p->_links[ iL2 ]._link == polygon._links[ iL ]._link ) + { + freeLinks.push_back( & p->_links[ iL2 ] ); + ++nbFreeLinks; + freeLinks.back()->RemoveFace( &polygon ); + break; + } + } + for ( size_t iL = 0; iL < coplanarPolyg->_links.size(); ++iL ) + if ( coplanarPolyg->_links[ iL ]._link->_faces[1] && + coplanarPolyg->_links[ iL ]._link->_faces[1] != &polygon ) + { + _Face* p = coplanarPolyg->_links[ iL ]._link->_faces[0]; + if ( p == coplanarPolyg ) + p = coplanarPolyg->_links[ iL ]._link->_faces[1]; + for ( size_t iL2 = 0; iL2 < p->_links.size(); ++iL2 ) + if ( p->_links[ iL2 ]._link == coplanarPolyg->_links[ iL ]._link ) + { + freeLinks.push_back( & p->_links[ iL2 ] ); + ++nbFreeLinks; + freeLinks.back()->RemoveFace( coplanarPolyg ); + break; + } + } + // set coplanarPolyg to be re-created next + for ( size_t iP = 0; iP < _polygons.size(); ++iP ) + if ( coplanarPolyg == & _polygons[ iP ] ) + { + iPolygon = iP; + _polygons[ iPolygon ]._links.clear(); + _polygons[ iPolygon ]._polyLinks.clear(); + break; + } + if ( freeLinks.back() == &polygon._links.back() ) + { + freeLinks.pop_back(); + --nbFreeLinks; + } + _polygons.pop_back(); + usedFaceIDs.erase( curFace ); + continue; + } // if ( coplanarPolyg ) + } // if ( hasEdgeIntersections ) - //const size_t firstPoly = _polygons.size(); - } + iPolygon = _polygons.size(); + + } // end of case ( polygon._links.size() > 2 ) + } // while ( nbFreeLinks > 0 ) if ( ! checkPolyhedronSize() ) { @@ -1498,27 +2324,39 @@ namespace } // create a classic cell if possible - const int nbNodes = _nbCornerNodes + _nbIntNodes; + const int nbNodes = _nbCornerNodes + nbIntersections; bool isClassicElem = false; if ( nbNodes == 8 && _polygons.size() == 6 ) isClassicElem = addHexa(); else if ( nbNodes == 4 && _polygons.size() == 4 ) isClassicElem = addTetra(); else if ( nbNodes == 6 && _polygons.size() == 5 ) isClassicElem = addPenta(); else if ( nbNodes == 5 && _polygons.size() == 5 ) isClassicElem = addPyra (); if ( !isClassicElem ) - _volumeDefs.set( polyhedraNodes, quantities ); + { + _volumeDefs._nodes.clear(); + _volumeDefs._quantities.clear(); + + for ( size_t iF = 0; iF < _polygons.size(); ++iF ) + { + const size_t nbLinks = _polygons[ iF ]._links.size(); + _volumeDefs._quantities.push_back( nbLinks ); + for ( size_t iL = 0; iL < nbLinks; ++iL ) + _volumeDefs._nodes.push_back( _polygons[ iF ]._links[ iL ].FirstNode() ); + } + } } //================================================================================ /*! * \brief Create elements in the mesh */ - int Hexahedron::MakeElements(SMESH_MesherHelper& helper) + int Hexahedron::MakeElements(SMESH_MesherHelper& helper, + const map< TGeomID, vector< TGeomID > >& edge2faceIDsMap) { SMESHDS_Mesh* mesh = helper.GetMeshDS(); size_t nbCells[3] = { _grid->_coords[0].size() - 1, _grid->_coords[1].size() - 1, _grid->_coords[2].size() - 1 }; - const size_t nbGridCells = nbCells[0] *nbCells [1] * nbCells[2]; + const size_t nbGridCells = nbCells[0] * nbCells[1] * nbCells[2]; vector< Hexahedron* > intersectedHex( nbGridCells, 0 ); int nbIntHex = 0; @@ -1535,10 +2373,10 @@ namespace for ( ; lineInd.More(); ++lineInd ) { GridLine& line = _grid->_lines[ iDir ][ lineInd.LineIndex() ]; - multiset< IntersectionPoint >::const_iterator ip = line._intPoints.begin(); + multiset< F_IntersectPoint >::const_iterator ip = line._intPoints.begin(); for ( ; ip != line._intPoints.end(); ++ip ) { - if ( !ip->_node ) continue; + // if ( !ip->_node ) continue; // intersection at a grid node lineInd.SetIndexOnLine( ip->_indexOnLine ); for ( int iL = 0; iL < 4; ++iL ) // loop on 4 cells sharing a link { @@ -1560,13 +2398,17 @@ namespace ++nbIntHex; } const int iLink = iL + iDir * 4; - hex->_hexLinks[iLink]._intNodes.push_back( _Node( 0, &(*ip) )); - hex->_nbIntNodes++; + hex->_hexLinks[iLink]._fIntPoints.push_back( &(*ip) ); + //hex->_hexLinks[iLink]._fIntNodes.push_back( _Node( 0, &(*ip) )); + hex->_nbFaceIntNodes += bool( ip->_node ); } } } } + // implement geom edges into the mesh + addEdges( helper, intersectedHex, edge2faceIDsMap ); + // add not split hexadrons to the mesh int nbAdded = 0; vector intHexInd( nbIntHex ); @@ -1577,14 +2419,16 @@ namespace if ( hex ) { intHexInd[ nbIntHex++ ] = i; - if ( hex->_nbIntNodes > 0 ) continue; - init( hex->_i, hex->_j, hex->_k ); + if ( hex->_nbFaceIntNodes > 0 || hex->_eIntPoints.size() > 0 ) + continue; // treat intersected hex later + this->init( hex->_i, hex->_j, hex->_k ); } else { - init( i ); + this->init( i ); } - if ( _nbCornerNodes == 8 && ( _nbBndNodes < _nbCornerNodes || !isInHole() )) + if (( _nbCornerNodes == 8 ) && + ( _nbBndNodes < _nbCornerNodes || !isInHole() )) { // order of _hexNodes is defined by enum SMESH_Block::TShapeID SMDS_MeshElement* el = @@ -1605,7 +2449,10 @@ namespace { // all intersection of hex with geometry are at grid nodes hex = new Hexahedron( *this ); - hex->init( i ); + //hex->init( i ); + hex->_i = _i; + hex->_j = _j; + hex->_k = _k; intHexInd.push_back(0); intHexInd[ nbIntHex++ ] = i; } @@ -1636,6 +2483,492 @@ namespace return nbAdded; } + //================================================================================ + /*! + * \brief Implements geom edges into the mesh + */ + void Hexahedron::addEdges(SMESH_MesherHelper& helper, + vector< Hexahedron* >& hexes, + const map< TGeomID, vector< TGeomID > >& edge2faceIDsMap) + { + if ( edge2faceIDsMap.empty() ) return; + + // Prepare planes for intersecting with EDGEs + GridPlanes pln[3]; + { + for ( int iDirZ = 0; iDirZ < 3; ++iDirZ ) // iDirZ gives normal direction to planes + { + GridPlanes& planes = pln[ iDirZ ]; + int iDirX = ( iDirZ + 1 ) % 3; + int iDirY = ( iDirZ + 2 ) % 3; + // planes._uNorm = ( _grid->_axes[ iDirY ] ^ _grid->_axes[ iDirZ ] ).Normalized(); + // planes._vNorm = ( _grid->_axes[ iDirZ ] ^ _grid->_axes[ iDirX ] ).Normalized(); + planes._zNorm = ( _grid->_axes[ iDirX ] ^ _grid->_axes[ iDirY ] ).Normalized(); + planes._zProjs.resize ( _grid->_coords[ iDirZ ].size() ); + planes._zProjs [0] = 0; + const double zFactor = _grid->_axes[ iDirZ ] * planes._zNorm; + const vector< double > & u = _grid->_coords[ iDirZ ]; + for ( int i = 1; i < planes._zProjs.size(); ++i ) + { + planes._zProjs [i] = zFactor * ( u[i] - u[0] ); + } + } + } + const double deflection = _grid->_minCellSize / 20.; + const double tol = _grid->_tol; + E_IntersectPoint ip; + + // Intersect EDGEs with the planes + map< TGeomID, vector< TGeomID > >::const_iterator e2fIt = edge2faceIDsMap.begin(); + for ( ; e2fIt != edge2faceIDsMap.end(); ++e2fIt ) + { + const TGeomID edgeID = e2fIt->first; + const TopoDS_Edge & E = TopoDS::Edge( _grid->_shapes( edgeID )); + BRepAdaptor_Curve curve( E ); + TopoDS_Vertex v1 = helper.IthVertex( 0, E, false ); + TopoDS_Vertex v2 = helper.IthVertex( 1, E, false ); + + ip._faceIDs = e2fIt->second; + ip._shapeID = edgeID; + + // discretize the EGDE + GCPnts_UniformDeflection discret( curve, deflection, true ); + if ( !discret.IsDone() || discret.NbPoints() < 2 ) + continue; + + // perform intersection + for ( int iDirZ = 0; iDirZ < 3; ++iDirZ ) + { + GridPlanes& planes = pln[ iDirZ ]; + int iDirX = ( iDirZ + 1 ) % 3; + int iDirY = ( iDirZ + 2 ) % 3; + double xLen = _grid->_coords[ iDirX ].back() - _grid->_coords[ iDirX ][0]; + double yLen = _grid->_coords[ iDirY ].back() - _grid->_coords[ iDirY ][0]; + double zLen = _grid->_coords[ iDirZ ].back() - _grid->_coords[ iDirZ ][0]; + //double zFactor = _grid->_axes[ iDirZ ] * planes._zNorm; + int dIJK[3], d000[3] = { 0,0,0 }; + double o[3] = { _grid->_coords[0][0], + _grid->_coords[1][0], + _grid->_coords[2][0] }; + + // locate the 1st point of a segment within the grid + gp_XYZ p1 = discret.Value( 1 ).XYZ(); + double u1 = discret.Parameter( 1 ); + double zProj1 = planes._zNorm * ( p1 - _grid->_origin ); + + _grid->ComputeUVW( p1, ip._uvw ); + int iX1 = int(( ip._uvw[iDirX] - o[iDirX]) / xLen * (_grid->_coords[ iDirX ].size() - 1)); + int iY1 = int(( ip._uvw[iDirY] - o[iDirY]) / yLen * (_grid->_coords[ iDirY ].size() - 1)); + int iZ1 = int(( ip._uvw[iDirZ] - o[iDirZ]) / zLen * (_grid->_coords[ iDirZ ].size() - 1)); + locateValue( iX1, ip._uvw[iDirX], _grid->_coords[ iDirX ], dIJK[ iDirX ], tol ); + locateValue( iY1, ip._uvw[iDirY], _grid->_coords[ iDirY ], dIJK[ iDirY ], tol ); + locateValue( iZ1, ip._uvw[iDirZ], _grid->_coords[ iDirZ ], dIJK[ iDirZ ], tol ); + + int ijk[3]; // grid index where a segment intersect a plane + ijk[ iDirX ] = iX1; + ijk[ iDirY ] = iY1; + ijk[ iDirZ ] = iZ1; + + // add the 1st vertex point to a hexahedron + if ( iDirZ == 0 ) + { + ip._point = p1; + ip._shapeID = _grid->_shapes.Add( v1 ); + _grid->_edgeIntP.push_back( ip ); + if ( !addIntersection( _grid->_edgeIntP.back(), hexes, ijk, d000 )) + _grid->_edgeIntP.pop_back(); + ip._shapeID = edgeID; + } + for ( int iP = 2; iP <= discret.NbPoints(); ++iP ) + { + // locate the 2nd point of a segment within the grid + gp_XYZ p2 = discret.Value( iP ).XYZ(); + double u2 = discret.Parameter( iP ); + double zProj2 = planes._zNorm * ( p2 - _grid->_origin ); + int iZ2 = iZ1; + if ( Abs( zProj2 - zProj1 ) <= std::numeric_limits::min() ) + continue; + locateValue( iZ2, zProj2, planes._zProjs, dIJK[ iDirZ ], tol ); + + // treat intersections with planes between 2 end points of a segment + int dZ = ( iZ1 <= iZ2 ) ? +1 : -1; + int iZ = iZ1 + ( iZ1 < iZ2 ); + for ( int i = 0, nb = Abs( iZ1 - iZ2 ); i < nb; ++i, iZ += dZ ) + { + ip._point = findIntPoint( u1, zProj1, u2, zProj2, + planes._zProjs[ iZ ], + curve, planes._zNorm, _grid->_origin ); + _grid->ComputeUVW( ip._point.XYZ(), ip._uvw ); + locateValue( ijk[iDirX], ip._uvw[iDirX], _grid->_coords[iDirX], dIJK[iDirX], tol ); + locateValue( ijk[iDirY], ip._uvw[iDirY], _grid->_coords[iDirY], dIJK[iDirY], tol ); + ijk[ iDirZ ] = iZ; + + // add ip to hex "above" the plane + _grid->_edgeIntP.push_back( ip ); + dIJK[ iDirZ ] = 0; + bool added = addIntersection(_grid->_edgeIntP.back(), hexes, ijk, dIJK); + + // add ip to hex "below" the plane + ijk[ iDirZ ] = iZ-1; + if ( !addIntersection( _grid->_edgeIntP.back(), hexes, ijk, dIJK ) && + !added) + _grid->_edgeIntP.pop_back(); + } + iZ1 = iZ2; + p1 = p2; + u1 = u2; + zProj1 = zProj2; + } + // add the 2nd vertex point to a hexahedron + if ( iDirZ == 0 ) + { + ip._shapeID = _grid->_shapes.Add( v2 ); + ip._point = p1; + _grid->ComputeUVW( p1, ip._uvw ); + locateValue( ijk[iDirX], ip._uvw[iDirX], _grid->_coords[iDirX], dIJK[iDirX], tol ); + locateValue( ijk[iDirY], ip._uvw[iDirY], _grid->_coords[iDirY], dIJK[iDirY], tol ); + ijk[ iDirZ ] = iZ1; + _grid->_edgeIntP.push_back( ip ); + if ( !addIntersection( _grid->_edgeIntP.back(), hexes, ijk, d000 )) + _grid->_edgeIntP.pop_back(); + ip._shapeID = edgeID; + } + } // loop on 3 grid directions + } // loop on EDGEs + + // Create nodes at found intersections + // const E_IntersectPoint* eip; + // for ( size_t i = 0; i < hexes.size(); ++i ) + // { + // Hexahedron* h = hexes[i]; + // if ( !h ) continue; + // for ( int iF = 0; iF < 6; ++iF ) + // { + // _Face& quad = h->_hexQuads[ iF ]; + // for ( size_t iP = 0; iP < quad._eIntNodes.size(); ++iP ) + // if ( !quad._eIntNodes[ iP ]._node ) + // if (( eip = quad._eIntNodes[ iP ].EdgeIntPnt() )) + // quad._eIntNodes[ iP ]._intPoint->_node = helper.AddNode( eip->_point.X(), + // eip->_point.Y(), + // eip->_point.Z() ); + // } + // for ( size_t iP = 0; iP < hexes[i]->_vIntNodes.size(); ++iP ) + // if (( eip = h->_vIntNodes[ iP ].EdgeIntPnt() )) + // h->_vIntNodes[ iP ]._intPoint->_node = helper.AddNode( eip->_point.X(), + // eip->_point.Y(), + // eip->_point.Z() ); + // } + } + + //================================================================================ + /*! + * \brief Finds intersection of a curve with a plane + * \param [in] u1 - parameter of one curve point + * \param [in] proj1 - projection of the curve point to the plane normal + * \param [in] u2 - parameter of another curve point + * \param [in] proj2 - projection of the other curve point to the plane normal + * \param [in] proj - projection of a point where the curve intersects the plane + * \param [in] curve - the curve + * \param [in] axis - the plane normal + * \param [in] origin - the plane origin + * \return gp_Pnt - the found intersection point + */ + gp_Pnt Hexahedron::findIntPoint( double u1, double proj1, + double u2, double proj2, + double proj, + BRepAdaptor_Curve& curve, + const gp_XYZ& axis, + const gp_XYZ& origin) + { + double r = (( proj - proj1 ) / ( proj2 - proj1 )); + double u = u1 * ( 1 - r ) + u2 * r; + gp_Pnt p = curve.Value( u ); + double newProj = axis * ( p.XYZ() - origin ); + if ( Abs( proj - newProj ) > _grid->_tol / 10. ) + { + if ( r > 0.5 ) + return findIntPoint( u2, proj2, u, newProj, proj, curve, axis, origin ); + else + return findIntPoint( u1, proj2, u, newProj, proj, curve, axis, origin ); + } + return p; + } + + //================================================================================ + /*! + * \brief Returns indices of a hexahedron sub-entities holding a point + * \param [in] ip - intersection point + * \param [out] facets - 0-3 facets holding a point + * \param [out] sub - index of a vertex or an edge holding a point + * \return int - number of facets holding a point + */ + int Hexahedron::getEntity( const E_IntersectPoint* ip, int* facets, int& sub ) + { + enum { X = 1, Y = 2, Z = 4 }; // == 001, 010, 100 + int nbFacets = 0; + int vertex = 0, egdeMask = 0; + + if ( Abs( _grid->_coords[0][ _i ] - ip->_uvw[0] ) < _grid->_tol ) { + facets[ nbFacets++ ] = SMESH_Block::ID_F0yz; + egdeMask |= X; + } + else if ( Abs( _grid->_coords[0][ _i+1 ] - ip->_uvw[0] ) < _grid->_tol ) { + facets[ nbFacets++ ] = SMESH_Block::ID_F1yz; + vertex |= X; + egdeMask |= X; + } + if ( Abs( _grid->_coords[1][ _j ] - ip->_uvw[1] ) < _grid->_tol ) { + facets[ nbFacets++ ] = SMESH_Block::ID_Fx0z; + egdeMask |= Y; + } + else if ( Abs( _grid->_coords[1][ _j+1 ] - ip->_uvw[1] ) < _grid->_tol ) { + facets[ nbFacets++ ] = SMESH_Block::ID_Fx1z; + vertex |= Y; + egdeMask |= Y; + } + if ( Abs( _grid->_coords[2][ _k ] - ip->_uvw[2] ) < _grid->_tol ) { + facets[ nbFacets++ ] = SMESH_Block::ID_Fxy0; + egdeMask |= Z; + } + else if ( Abs( _grid->_coords[2][ _k+1 ] - ip->_uvw[2] ) < _grid->_tol ) { + facets[ nbFacets++ ] = SMESH_Block::ID_Fxy1; + vertex |= Z; + egdeMask |= Z; + } + + switch ( nbFacets ) + { + case 0: sub = 0; break; + case 1: sub = facets[0]; break; + case 2: { + const int edge [3][8] = { + { SMESH_Block::ID_E00z, SMESH_Block::ID_E10z, + SMESH_Block::ID_E01z, SMESH_Block::ID_E11z }, + { SMESH_Block::ID_E0y0, SMESH_Block::ID_E1y0, 0, 0, + SMESH_Block::ID_E0y1, SMESH_Block::ID_E1y1 }, + { SMESH_Block::ID_Ex00, 0, SMESH_Block::ID_Ex10, 0, + SMESH_Block::ID_Ex01, 0, SMESH_Block::ID_Ex11 } + }; + switch ( egdeMask ) { + case X | Y: sub = edge[ 0 ][ vertex ]; break; + case X | Z: sub = edge[ 1 ][ vertex ]; break; + default: sub = edge[ 2 ][ vertex ]; + } + break; + } + //case 3: + default: + sub = vertex + SMESH_Block::ID_FirstV; + } + + return nbFacets; + } + //================================================================================ + /*! + * \brief Adds intersection with an EDGE + */ + bool Hexahedron::addIntersection( const E_IntersectPoint& ip, + vector< Hexahedron* >& hexes, + int ijk[], int dIJK[] ) + { + bool added = false; + + size_t hexIndex[4] = { + _grid->CellIndex( ijk[0], ijk[1], ijk[2] ), + dIJK[0] ? _grid->CellIndex( ijk[0]+dIJK[0], ijk[1], ijk[2] ) : -1, + dIJK[1] ? _grid->CellIndex( ijk[0], ijk[1]+dIJK[1], ijk[2] ) : -1, + dIJK[2] ? _grid->CellIndex( ijk[0], ijk[1], ijk[2]+dIJK[2] ) : -1 + }; + for ( int i = 0; i < 4; ++i ) + { + if ( /*0 <= hexIndex[i] &&*/ hexIndex[i] < hexes.size() && hexes[ hexIndex[i] ] ) + { + Hexahedron* h = hexes[ hexIndex[i] ]; + // check if ip is really inside the hex +#ifdef _DEBUG_ + if (( _grid->_coords[0][ h->_i ] - _grid->_tol > ip._uvw[0] ) || + ( _grid->_coords[0][ h->_i+1 ] + _grid->_tol < ip._uvw[0] ) || + ( _grid->_coords[1][ h->_j ] - _grid->_tol > ip._uvw[1] ) || + ( _grid->_coords[1][ h->_j+1 ] + _grid->_tol < ip._uvw[1] ) || + ( _grid->_coords[2][ h->_k ] - _grid->_tol > ip._uvw[2] ) || + ( _grid->_coords[2][ h->_k+1 ] + _grid->_tol < ip._uvw[2] )) + throw SALOME_Exception("ip outside a hex"); +#endif + h->_eIntPoints.push_back( & ip ); + added = true; + } + } + return added; + } + //================================================================================ + /*! + * \brief Finds nodes at a path from one node to another via intersections with EDGEs + */ + bool Hexahedron::findChain( _Node* n1, + _Node* n2, + _Face& quad, + vector<_Node*>& chn ) + { + chn.clear(); + chn.push_back( n1 ); + for ( size_t iP = 0; iP < quad._eIntNodes.size(); ++iP ) + if ( !quad._eIntNodes[ iP ]->IsUsedInFace( &quad ) && + n1->IsLinked( quad._eIntNodes[ iP ]->_intPoint ) && + n2->IsLinked( quad._eIntNodes[ iP ]->_intPoint )) + { + chn.push_back( quad._eIntNodes[ iP ]); + chn.push_back( n2 ); + quad._eIntNodes[ iP ]->_usedInFace = &quad; + return true; + } + bool found; + do + { + found = false; + for ( size_t iP = 0; iP < quad._eIntNodes.size(); ++iP ) + if ( !quad._eIntNodes[ iP ]->IsUsedInFace( &quad ) && + chn.back()->IsLinked( quad._eIntNodes[ iP ]->_intPoint )) + { + chn.push_back( quad._eIntNodes[ iP ]); + found = quad._eIntNodes[ iP ]->_usedInFace = &quad; + break; + } + } while ( found && ! chn.back()->IsLinked( n2->_intPoint ) ); + + if ( chn.back() != n2 && chn.back()->IsLinked( n2->_intPoint )) + chn.push_back( n2 ); + + return chn.size() > 1; + } + //================================================================================ + /*! + * \brief Try to heal a polygon whose ends are not connected + */ + bool Hexahedron::closePolygon( _Face* polygon, vector<_Node*>& chainNodes ) const + { + int i = -1, nbLinks = polygon->_links.size(); + if ( nbLinks < 3 ) + return false; + vector< _OrientedLink > newLinks; + // find a node lying on the same FACE as the last one + _Node* node = polygon->_links.back().LastNode(); + int avoidFace = node->IsLinked( polygon->_links.back().FirstNode()->_intPoint ); + for ( i = nbLinks - 2; i >= 0; --i ) + if ( node->IsLinked( polygon->_links[i].FirstNode()->_intPoint, avoidFace )) + break; + if ( i >= 0 ) + { + for ( ; i < nbLinks; ++i ) + newLinks.push_back( polygon->_links[i] ); + } + else + { + // find a node lying on the same FACE as the first one + node = polygon->_links[0].FirstNode(); + avoidFace = node->IsLinked( polygon->_links[0].LastNode()->_intPoint ); + for ( i = 1; i < nbLinks; ++i ) + if ( node->IsLinked( polygon->_links[i].LastNode()->_intPoint, avoidFace )) + break; + if ( i < nbLinks ) + for ( nbLinks = i + 1, i = 0; i < nbLinks; ++i ) + newLinks.push_back( polygon->_links[i] ); + } + if ( newLinks.size() > 1 ) + { + polygon->_links.swap( newLinks ); + chainNodes.clear(); + chainNodes.push_back( polygon->_links.back().LastNode() ); + chainNodes.push_back( polygon->_links[0].FirstNode() ); + return true; + } + return false; + } + //================================================================================ + /*! + * \brief Checks transition at the 1st node of a link + */ + bool Hexahedron::is1stNodeOut( _Link& link /*int iLink*/ ) const + { + // new version is for the case: tangent transition at the 1st node + bool isOut = false; + if ( link._fIntNodes.size() > 1 ) + { + // check transition at the next intersection + switch ( link._fIntPoints[1]->_transition ) { + case Trans_OUT: return false; + case Trans_IN : return true; + default: ; // tangent transition + } + } + gp_Pnt p1 = link._nodes[0]->Point(); + gp_Pnt p2 = link._nodes[1]->Point(); + gp_Pnt testPnt = 0.8 * p1.XYZ() + 0.2 * p2.XYZ(); + + TGeomID faceID = link._fIntPoints[0]->_faceIDs[0]; + const TopoDS_Face& face = TopoDS::Face( _grid->_shapes( faceID )); + TopLoc_Location loc; + GeomAPI_ProjectPointOnSurf& proj = + _grid->_helper->GetProjector( face, loc, 0.1*_grid->_tol ); + testPnt.Transform( loc ); + proj.Perform( testPnt ); + if ( proj.IsDone() && + proj.NbPoints() > 0 && + proj.LowerDistance() > _grid->_tol ) + { + Quantity_Parameter u,v; + proj.LowerDistanceParameters( u,v ); + gp_Dir normal; + if ( GeomLib::NormEstim( BRep_Tool::Surface( face, loc ), + gp_Pnt2d( u,v ), + 0.1*_grid->_tol, + normal ) < 3 ) + { + if ( face.Orientation() == TopAbs_REVERSED ) + normal.Reverse(); + gp_Vec v( proj.NearestPoint(), testPnt ); + return v * normal > 0; + } + } + // if ( !_hexLinks[ iLink ]._nodes[0]->Node() ) // no node + // return true; + // if ( !_hexLinks[ iLink ]._nodes[0]->_intPoint ) // no intersection with geometry + // return false; + // switch ( _hexLinks[ iLink ]._nodes[0]->FaceIntPnt()->_transition ) { + // case Trans_OUT: return true; + // case Trans_IN : return false; + // default: ; // tangent transition + // } + +// // ijk of a GridLine corresponding to the link +// int iDir = iLink / 4; +// int indSub = iLink % 4; +// LineIndexer li = _grid->GetLineIndexer( iDir ); +// li.SetIJK( _i,_j,_k ); +// size_t lineIndex[4] = { li.LineIndex (), +// li.LineIndex10(), +// li.LineIndex01(), +// li.LineIndex11() }; +// GridLine& line = _grid->_lines[ iDir ][ lineIndex[ indSub ]]; + +// // analyze transition of previous ip +// bool isOut = true; +// multiset< F_IntersectPoint >::const_iterator ip = line._intPoints.begin(); +// for ( ; ip != line._intPoints.end(); ++ip ) +// { +// if ( &(*ip) == _hexLinks[ iLink ]._nodes[0]->_intPoint ) +// break; +// switch ( ip->_transition ) { +// case Trans_OUT: isOut = true; +// case Trans_IN : isOut = false; +// default:; +// } +// } +// #ifdef _DEBUG_ +// if ( ip == line._intPoints.end() ) +// cout << "BUG: Wrong GridLine. IKJ = ( "<< _i << " " << _j << " " << _k << " )" << endl; +// #endif + return isOut; + } //================================================================================ /*! * \brief Adds computed elements to the mesh @@ -1646,8 +2979,19 @@ namespace // add elements resulted from hexahedron intersection //for ( size_t i = 0; i < _volumeDefs.size(); ++i ) { - vector< const SMDS_MeshNode* >& nodes = _volumeDefs._nodes; - + vector< const SMDS_MeshNode* > nodes( _volumeDefs._nodes.size() ); + for ( size_t iN = 0; iN < nodes.size(); ++iN ) + if ( !( nodes[iN] = _volumeDefs._nodes[iN]->Node() )) + { + if ( const E_IntersectPoint* eip = _volumeDefs._nodes[iN]->EdgeIntPnt() ) + nodes[iN] = _volumeDefs._nodes[iN]->_intPoint->_node = + helper.AddNode( eip->_point.X(), + eip->_point.Y(), + eip->_point.Z() ); + else + throw SALOME_Exception("Bug: no node at intersection point"); + } + if ( !_volumeDefs._quantities.empty() ) { helper.AddPolyhedralVolume( nodes, _volumeDefs._quantities ); @@ -1679,8 +3023,11 @@ namespace */ bool Hexahedron::isInHole() const { + if ( !_vIntNodes.empty() ) + return false; + const int ijk[3] = { _i, _j, _k }; - IntersectionPoint curIntPnt; + F_IntersectPoint curIntPnt; // consider a cell to be in a hole if all links in any direction // comes OUT of geometry @@ -1698,19 +3045,19 @@ namespace { const _Link& link = _hexLinks[ iL + 4*iDir ]; // check transition of the first node of a link - const IntersectionPoint* firstIntPnt = 0; + const F_IntersectPoint* firstIntPnt = 0; if ( link._nodes[0]->Node() ) // 1st node is a hexa corner { curIntPnt._paramOnLine = coords[ ijk[ iDir ]] - coords[0]; const GridLine& line = _grid->_lines[ iDir ][ lineIndex[ iL ]]; - multiset< IntersectionPoint >::const_iterator ip = + multiset< F_IntersectPoint >::const_iterator ip = line._intPoints.upper_bound( curIntPnt ); --ip; firstIntPnt = &(*ip); } - else if ( !link._intNodes.empty() ) + else if ( !link._fIntPoints.empty() ) { - firstIntPnt = link._intNodes[0]._intPoint; + firstIntPnt = link._fIntPoints[0]; } if ( firstIntPnt ) @@ -1736,10 +3083,10 @@ namespace { const _Face& polygon = _polygons[iP]; gp_XYZ area (0,0,0); - SMESH_TNodeXYZ p1 ( polygon._links[ 0 ].FirstNode()->Node() ); + gp_XYZ p1 = polygon._links[ 0 ].FirstNode()->Point().XYZ(); for ( size_t iL = 0; iL < polygon._links.size(); ++iL ) { - SMESH_TNodeXYZ p2 ( polygon._links[ iL ].LastNode()->Node() ); + gp_XYZ p2 = polygon._links[ iL ].LastNode()->Point().XYZ(); area += p1 ^ p2; p1 = p2; } @@ -1764,30 +3111,32 @@ namespace _polygons[4]._links.size() != 4 || _polygons[5]._links.size() != 4 ) return false; - const SMDS_MeshNode* nodes[8]; + _Node* nodes[8]; int nbN = 0; for ( int iL = 0; iL < 4; ++iL ) { // a base node - nodes[iL] = _polygons[0]._links[iL].FirstNode()->Node(); + nodes[iL] = _polygons[0]._links[iL].FirstNode(); ++nbN; // find a top node above the base node _Link* link = _polygons[0]._links[iL]._link; - ASSERT( link->_faces.size() > 1 ); + //ASSERT( link->_faces.size() > 1 ); + if ( !link->_faces[0] || !link->_faces[1] ) + return debugDumpLink( link ); // a quadrangle sharing with _polygons[0] _Face* quad = link->_faces[ bool( link->_faces[0] == & _polygons[0] )]; for ( int i = 0; i < 4; ++i ) if ( quad->_links[i]._link == link ) { // 1st node of a link opposite to in - nodes[iL+4] = quad->_links[(i+2)%4].FirstNode()->Node(); + nodes[iL+4] = quad->_links[(i+2)%4].FirstNode(); ++nbN; break; } } if ( nbN == 8 ) - _volumeDefs.set( vector< const SMDS_MeshNode* >( nodes, nodes+8 )); + _volumeDefs.set( vector< _Node* >( nodes, nodes+8 )); return nbN == 8; } @@ -1797,21 +3146,23 @@ namespace */ bool Hexahedron::addTetra() { - const SMDS_MeshNode* nodes[4]; - nodes[0] = _polygons[0]._links[0].FirstNode()->Node(); - nodes[1] = _polygons[0]._links[1].FirstNode()->Node(); - nodes[2] = _polygons[0]._links[2].FirstNode()->Node(); + _Node* nodes[4]; + nodes[0] = _polygons[0]._links[0].FirstNode(); + nodes[1] = _polygons[0]._links[1].FirstNode(); + nodes[2] = _polygons[0]._links[2].FirstNode(); _Link* link = _polygons[0]._links[0]._link; - ASSERT( link->_faces.size() > 1 ); + //ASSERT( link->_faces.size() > 1 ); + if ( !link->_faces[0] || !link->_faces[1] ) + return debugDumpLink( link ); // a triangle sharing with _polygons[0] _Face* tria = link->_faces[ bool( link->_faces[0] == & _polygons[0] )]; for ( int i = 0; i < 3; ++i ) if ( tria->_links[i]._link == link ) { - nodes[3] = tria->_links[(i+1)%3].LastNode()->Node(); - _volumeDefs.set( vector< const SMDS_MeshNode* >( nodes, nodes+4 )); + nodes[3] = tria->_links[(i+1)%3].LastNode(); + _volumeDefs.set( vector< _Node* >( nodes, nodes+4 )); return true; } @@ -1831,17 +3182,19 @@ namespace if ( iTri < 0 ) return false; // find nodes - const SMDS_MeshNode* nodes[6]; + _Node* nodes[6]; int nbN = 0; for ( int iL = 0; iL < 3; ++iL ) { // a base node - nodes[iL] = _polygons[ iTri ]._links[iL].FirstNode()->Node(); + nodes[iL] = _polygons[ iTri ]._links[iL].FirstNode(); ++nbN; // find a top node above the base node _Link* link = _polygons[ iTri ]._links[iL]._link; - ASSERT( link->_faces.size() > 1 ); + //ASSERT( link->_faces.size() > 1 ); + if ( !link->_faces[0] || !link->_faces[1] ) + return debugDumpLink( link ); // a quadrangle sharing with a base triangle _Face* quad = link->_faces[ bool( link->_faces[0] == & _polygons[ iTri ] )]; if ( quad->_links.size() != 4 ) return false; @@ -1849,13 +3202,13 @@ namespace if ( quad->_links[i]._link == link ) { // 1st node of a link opposite to in - nodes[iL+3] = quad->_links[(i+2)%4].FirstNode()->Node(); + nodes[iL+3] = quad->_links[(i+2)%4].FirstNode(); ++nbN; break; } } if ( nbN == 6 ) - _volumeDefs.set( vector< const SMDS_MeshNode* >( nodes, nodes+6 )); + _volumeDefs.set( vector< _Node* >( nodes, nodes+6 )); return ( nbN == 6 ); } @@ -1873,14 +3226,16 @@ namespace if ( iQuad < 0 ) return false; // find nodes - const SMDS_MeshNode* nodes[5]; - nodes[0] = _polygons[iQuad]._links[0].FirstNode()->Node(); - nodes[1] = _polygons[iQuad]._links[1].FirstNode()->Node(); - nodes[2] = _polygons[iQuad]._links[2].FirstNode()->Node(); - nodes[3] = _polygons[iQuad]._links[3].FirstNode()->Node(); + _Node* nodes[5]; + nodes[0] = _polygons[iQuad]._links[0].FirstNode(); + nodes[1] = _polygons[iQuad]._links[1].FirstNode(); + nodes[2] = _polygons[iQuad]._links[2].FirstNode(); + nodes[3] = _polygons[iQuad]._links[3].FirstNode(); _Link* link = _polygons[iQuad]._links[0]._link; - ASSERT( link->_faces.size() > 1 ); + //ASSERT( link->_faces.size() > 1 ); + if ( !link->_faces[0] || !link->_faces[1] ) + return debugDumpLink( link ); // a triangle sharing with a base quadrangle _Face* tria = link->_faces[ bool( link->_faces[0] == & _polygons[ iQuad ] )]; @@ -1888,13 +3243,111 @@ namespace for ( int i = 0; i < 3; ++i ) if ( tria->_links[i]._link == link ) { - nodes[4] = tria->_links[(i+1)%3].LastNode()->Node(); - _volumeDefs.set( vector< const SMDS_MeshNode* >( nodes, nodes+5 )); + nodes[4] = tria->_links[(i+1)%3].LastNode(); + _volumeDefs.set( vector< _Node* >( nodes, nodes+5 )); return true; } return false; } + //================================================================================ + /*! + * \brief Dump a link and return \c false + */ + bool Hexahedron::debugDumpLink( Hexahedron::_Link* link ) + { +#ifdef _DEBUG_ + gp_Pnt p1 = link->_nodes[0]->Point(), p2 = link->_nodes[1]->Point(); + cout << "BUG: not shared link. IKJ = ( "<< _i << " " << _j << " " << _k << " )" << endl + << "n1 (" << p1.X() << ", "<< p1.Y() << ", "<< p1.Z() << " )" << endl + << "n2 (" << p2.X() << ", "<< p2.Y() << ", "<< p2.Z() << " )" << endl; +#endif + return false; + } + + //================================================================================ + /*! + * \brief computes exact bounding box with axes parallel to given ones + */ + //================================================================================ + + void getExactBndBox( const vector< TopoDS_Shape >& faceVec, + const double* axesDirs, + Bnd_Box& shapeBox ) + { + BRep_Builder b; + TopoDS_Compound allFacesComp; + b.MakeCompound( allFacesComp ); + for ( size_t iF = 0; iF < faceVec.size(); ++iF ) + b.Add( allFacesComp, faceVec[ iF ] ); + + double sP[6]; // aXmin, aYmin, aZmin, aXmax, aYmax, aZmax + shapeBox.Get(sP[0],sP[1],sP[2],sP[3],sP[4],sP[5]); + double farDist = 0; + for ( int i = 0; i < 6; ++i ) + farDist = Max( farDist, 10 * sP[i] ); + + gp_XYZ axis[3] = { gp_XYZ( axesDirs[0], axesDirs[1], axesDirs[2] ), + gp_XYZ( axesDirs[3], axesDirs[4], axesDirs[5] ), + gp_XYZ( axesDirs[6], axesDirs[7], axesDirs[8] ) }; + axis[0].Normalize(); + axis[1].Normalize(); + axis[2].Normalize(); + + gp_Mat basis( axis[0], axis[1], axis[2] ); + gp_Mat bi = basis.Inverted(); + + gp_Pnt pMin, pMax; + for ( int iDir = 0; iDir < 3; ++iDir ) + { + gp_XYZ axis0 = axis[ iDir ]; + gp_XYZ axis1 = axis[ ( iDir + 1 ) % 3 ]; + gp_XYZ axis2 = axis[ ( iDir + 2 ) % 3 ]; + for ( int isMax = 0; isMax < 2; ++isMax ) + { + double shift = isMax ? farDist : -farDist; + gp_XYZ orig = shift * axis0; + gp_XYZ norm = axis1 ^ axis2; + gp_Pln pln( orig, norm ); + norm = pln.Axis().Direction().XYZ(); + BRepBuilderAPI_MakeFace plane( pln, -farDist, farDist, -farDist, farDist ); + + gp_Pnt& pAxis = isMax ? pMax : pMin; + gp_Pnt pPlane, pFaces; + double dist = GEOMUtils::GetMinDistance( plane, allFacesComp, pPlane, pFaces ); + if ( dist < 0 ) + { + Bnd_B3d bb; + gp_XYZ corner; + for ( int i = 0; i < 2; ++i ) { + corner.SetCoord( 1, sP[ i*3 ]); + for ( int j = 0; j < 2; ++j ) { + corner.SetCoord( 2, sP[ i*3 + 1 ]); + for ( int k = 0; k < 2; ++k ) + { + corner.SetCoord( 3, sP[ i*3 + 2 ]); + corner *= bi; + bb.Add( corner ); + } + } + } + corner = isMax ? bb.CornerMax() : bb.CornerMin(); + pAxis.SetCoord( iDir+1, corner.Coord( iDir+1 )); + } + else + { + gp_XYZ pf = pFaces.XYZ() * bi; + pAxis.SetCoord( iDir+1, pf.Coord( iDir+1 ) ); + } + } + } // loop on 3 axes + + shapeBox.SetVoid(); + shapeBox.Add( pMin ); + shapeBox.Add( pMax ); + + return; + } } // namespace @@ -1926,51 +3379,56 @@ bool StdMeshers_Cartesian_3D::Compute(SMESH_Mesh & theMesh, _computeCanceled = false; + SMESH_MesherHelper helper( theMesh ); + try { Grid grid; + grid._helper = &helper; - TopTools_MapOfShape faceMap; - for ( TopExp_Explorer fExp( theShape, TopAbs_FACE ); fExp.More(); fExp.Next() ) - if ( !faceMap.Add( fExp.Current() )) - faceMap.Remove( fExp.Current() ); // remove a face shared by two solids - + vector< TopoDS_Shape > faceVec; + { + TopTools_MapOfShape faceMap; + TopExp_Explorer fExp; + for ( fExp.Init( theShape, TopAbs_FACE ); fExp.More(); fExp.Next() ) + if ( !faceMap.Add( fExp.Current() )) + faceMap.Remove( fExp.Current() ); // remove a face shared by two solids + + for ( fExp.ReInit(); fExp.More(); fExp.Next() ) + if ( faceMap.Contains( fExp.Current() )) + faceVec.push_back( fExp.Current() ); + } + vector facesItersectors( faceVec.size() ); + map< TGeomID, vector< TGeomID > > edge2faceIDsMap; + TopExp_Explorer eExp; Bnd_Box shapeBox; - vector facesItersectors( faceMap.Extent() ); - TopTools_MapIteratorOfMapOfShape faceMppIt( faceMap ); - for ( int i = 0; faceMppIt.More(); faceMppIt.Next(), ++i ) + for ( int i = 0; i < faceVec.size(); ++i ) { - facesItersectors[i]._face = TopoDS::Face( faceMppIt.Key() ); - facesItersectors[i]._grid = &grid; + facesItersectors[i]._face = TopoDS::Face ( faceVec[i] ); + facesItersectors[i]._faceID = grid._shapes.Add( faceVec[i] ); + facesItersectors[i]._grid = &grid; shapeBox.Add( facesItersectors[i].GetFaceBndBox() ); + + if ( _hyp->GetToAddEdges() ) + { + helper.SetSubShape( faceVec[i] ); + for ( eExp.Init( faceVec[i], TopAbs_EDGE ); eExp.More(); eExp.Next() ) + { + const TopoDS_Edge& edge = TopoDS::Edge( eExp.Current() ); + if ( !SMESH_Algo::isDegenerated( edge ) && + !helper.IsRealSeam( edge )) + edge2faceIDsMap[ grid._shapes.Add( edge )].push_back( facesItersectors[i]._faceID ); + } + } } + getExactBndBox( faceVec, _hyp->GetAxisDirs(), shapeBox ); + vector xCoords, yCoords, zCoords; _hyp->GetCoordinates( xCoords, yCoords, zCoords, shapeBox ); - grid.SetCoordinates( xCoords, yCoords, zCoords, theShape ); - - // check if the grid encloses the shape - if ( !_hyp->IsGridBySpacing(0) || - !_hyp->IsGridBySpacing(1) || - !_hyp->IsGridBySpacing(2) ) - { - Bnd_Box gridBox; - gridBox.Add( gp_Pnt( xCoords[0], yCoords[0], zCoords[0] )); - gridBox.Add( gp_Pnt( xCoords.back(), yCoords.back(), zCoords.back() )); - double x0,y0,z0, x1,y1,z1; - shapeBox.Get(x0,y0,z0, x1,y1,z1); - if ( gridBox.IsOut( gp_Pnt( x0,y0,z0 )) || - gridBox.IsOut( gp_Pnt( x1,y1,z1 ))) - for ( size_t i = 0; i < facesItersectors.size(); ++i ) - { - if ( !facesItersectors[i].IsInGrid( gridBox )) - return error("The grid doesn't enclose the geometry"); -#ifdef ELLIPSOLID_WORKAROUND - delete facesItersectors[i]._surfaceInt, facesItersectors[i]._surfaceInt = 0; -#endif - } - } + grid.SetCoordinates( xCoords, yCoords, zCoords, _hyp->GetAxisDirs(), shapeBox ); + if ( _computeCanceled ) return false; #ifdef WITH_TBB @@ -2001,7 +3459,6 @@ bool StdMeshers_Cartesian_3D::Compute(SMESH_Mesh & theMesh, for ( size_t i = 0; i < facesItersectors.size(); ++i ) facesItersectors[i].StoreIntersections(); - SMESH_MesherHelper helper( theMesh ); TopExp_Explorer solidExp (theShape, TopAbs_SOLID); helper.SetSubShape( solidExp.Current() ); helper.SetElementsOnShape( true ); @@ -2015,12 +3472,12 @@ bool StdMeshers_Cartesian_3D::Compute(SMESH_Mesh & theMesh, // create volume elements Hexahedron hex( _hyp->GetSizeThreshold(), &grid ); - int nbAdded = hex.MakeElements( helper ); + int nbAdded = hex.MakeElements( helper, edge2faceIDsMap ); SMESHDS_Mesh* meshDS = theMesh.GetMeshDS(); if ( nbAdded > 0 ) { - // make all SOLIDS computed + // make all SOLIDs computed if ( SMESHDS_SubMesh* sm1 = meshDS->MeshElements( solidExp.Current()) ) { SMDS_ElemIteratorPtr volIt = sm1->GetElements(); @@ -2038,23 +3495,28 @@ bool StdMeshers_Cartesian_3D::Compute(SMESH_Mesh & theMesh, // remove free nodes if ( SMESHDS_SubMesh * smDS = meshDS->MeshElements( helper.GetSubShapeID() )) { - // intersection nodes + TIDSortedNodeSet nodesToRemove; + // get intersection nodes for ( int iDir = 0; iDir < 3; ++iDir ) { vector< GridLine >& lines = grid._lines[ iDir ]; for ( size_t i = 0; i < lines.size(); ++i ) { - multiset< IntersectionPoint >::iterator ip = lines[i]._intPoints.begin(); + multiset< F_IntersectPoint >::iterator ip = lines[i]._intPoints.begin(); for ( ; ip != lines[i]._intPoints.end(); ++ip ) if ( ip->_node && ip->_node->NbInverseElements() == 0 ) - meshDS->RemoveFreeNode( ip->_node, smDS, /*fromGroups=*/false ); + nodesToRemove.insert( nodesToRemove.end(), ip->_node ); } } - // grid nodes + // get grid nodes for ( size_t i = 0; i < grid._nodes.size(); ++i ) - if ( !grid._isBndNode[i] ) // nodes on boundary are already removed - if ( grid._nodes[i] && grid._nodes[i]->NbInverseElements() == 0 ) - meshDS->RemoveFreeNode( grid._nodes[i], smDS, /*fromGroups=*/false ); + if ( grid._nodes[i] && grid._nodes[i]->NbInverseElements() == 0 ) + nodesToRemove.insert( nodesToRemove.end(), grid._nodes[i] ); + + // do remove + TIDSortedNodeSet::iterator n = nodesToRemove.begin(); + for ( ; n != nodesToRemove.end(); ++n ) + meshDS->RemoveFreeNode( *n, smDS, /*fromGroups=*/false ); } return nbAdded; diff --git a/src/StdMeshers/StdMeshers_Cartesian_3D.hxx b/src/StdMeshers/StdMeshers_Cartesian_3D.hxx index 3d5d47325..0caab9f1e 100644 --- a/src/StdMeshers/StdMeshers_Cartesian_3D.hxx +++ b/src/StdMeshers/StdMeshers_Cartesian_3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx index 30b645a62..1311ca42c 100644 --- a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_CompositeHexa_3D.hxx b/src/StdMeshers/StdMeshers_CompositeHexa_3D.hxx index 458ff946e..0a27f88f9 100644 --- a/src/StdMeshers/StdMeshers_CompositeHexa_3D.hxx +++ b/src/StdMeshers/StdMeshers_CompositeHexa_3D.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_CompositeSegment_1D.cxx b/src/StdMeshers/StdMeshers_CompositeSegment_1D.cxx index 6de7b8e52..5a830c208 100644 --- a/src/StdMeshers/StdMeshers_CompositeSegment_1D.cxx +++ b/src/StdMeshers/StdMeshers_CompositeSegment_1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_CompositeSegment_1D.hxx b/src/StdMeshers/StdMeshers_CompositeSegment_1D.hxx index c76b5497a..f7cd5d324 100644 --- a/src/StdMeshers/StdMeshers_CompositeSegment_1D.hxx +++ b/src/StdMeshers/StdMeshers_CompositeSegment_1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Deflection1D.cxx b/src/StdMeshers/StdMeshers_Deflection1D.cxx index be865e829..cf8223cd8 100644 --- a/src/StdMeshers/StdMeshers_Deflection1D.cxx +++ b/src/StdMeshers/StdMeshers_Deflection1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Deflection1D.hxx b/src/StdMeshers/StdMeshers_Deflection1D.hxx index 2f6e6c43f..e52536b2f 100644 --- a/src/StdMeshers/StdMeshers_Deflection1D.hxx +++ b/src/StdMeshers/StdMeshers_Deflection1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Distribution.cxx b/src/StdMeshers/StdMeshers_Distribution.cxx index bd9499353..aa7ebf1f5 100644 --- a/src/StdMeshers/StdMeshers_Distribution.cxx +++ b/src/StdMeshers/StdMeshers_Distribution.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Distribution.hxx b/src/StdMeshers/StdMeshers_Distribution.hxx index 630fed8ad..d5744d2da 100644 --- a/src/StdMeshers/StdMeshers_Distribution.hxx +++ b/src/StdMeshers/StdMeshers_Distribution.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_FaceSide.cxx b/src/StdMeshers/StdMeshers_FaceSide.cxx index 4e5e0478a..b543928dc 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.cxx +++ b/src/StdMeshers/StdMeshers_FaceSide.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -251,7 +251,8 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const StdMeshers_FaceSide* theSide, */ //================================================================================ -StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes) +StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes, + const TopoDS_Face& theFace) { myEdge.resize( 1 ); myEdgeID.resize( 1, -1 ); @@ -272,12 +273,42 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes) if ( !myPoints.empty() ) { myPoints[0].normParam = 0; - gp_Pnt pPrev = SMESH_TNodeXYZ( myPoints[0].node ); - for ( size_t i = 1; i < myPoints.size(); ++i ) + if ( myPoints[0].node && + myPoints.back().node && + myPoints[ myNbPonits/2 ].node ) { - gp_Pnt p = SMESH_TNodeXYZ( myPoints[i].node ); - myLength += ( myPoints[i].normParam = p.Distance( pPrev )); - pPrev = p; + gp_Pnt pPrev = SMESH_TNodeXYZ( myPoints[0].node ); + for ( size_t i = 1; i < myPoints.size(); ++i ) + { + gp_Pnt p = SMESH_TNodeXYZ( myPoints[i].node ); + myLength += p.Distance( pPrev ); + myPoints[i].normParam = myLength; + pPrev = p; + } + } + else if ( !theFace.IsNull() ) + { + TopLoc_Location loc; + Handle(Geom_Surface) surf = BRep_Tool::Surface( theFace, loc ); + gp_Pnt pPrev = surf->Value( myPoints[0].u, myPoints[0].v ); + for ( size_t i = 1; i < myPoints.size(); ++i ) + { + gp_Pnt p = surf->Value( myPoints[i].u, myPoints[i].v ); + myLength += p.Distance( pPrev ); + myPoints[i].normParam = myLength; + pPrev = p; + } + } + else + { + gp_Pnt2d pPrev = myPoints[0].UV(); + for ( size_t i = 1; i < myPoints.size(); ++i ) + { + gp_Pnt2d p = myPoints[i].UV(); + myLength += p.Distance( pPrev ); + myPoints[i].normParam = myLength; + pPrev = p; + } } if ( myLength > std::numeric_limits::min() ) for ( size_t i = 1; i < myPoints.size(); ++i ) @@ -694,6 +725,7 @@ void StdMeshers_FaceSide::Reverse() } for ( size_t i = 0; i < myEdge.size(); ++i ) { + if ( myEdge[i].IsNull() ) continue; // for a side on points only double fp,lp; Handle(Geom_Curve) C3d = BRep_Tool::Curve(myEdge[i],fp,lp); if ( !C3d.IsNull() ) @@ -926,6 +958,18 @@ gp_Pnt2d StdMeshers_FaceSide::Value2d(double U) const return myC2d[ i ]->Value(par); } + else if ( !myPoints.empty() ) + { + int i = U * double( myPoints.size()-1 ); + while ( i > 0 && myPoints[ i ].normParam > U ) + --i; + while ( i+1 < myPoints.size() && myPoints[ i+1 ].normParam < U ) + ++i; + double r = (( U - myPoints[ i ].normParam ) / + ( myPoints[ i+1 ].normParam - myPoints[ i ].normParam )); + return ( myPoints[ i ].UV() * ( 1 - r ) + + myPoints[ i+1 ].UV() * r ); + } return myDefaultPnt2d; } diff --git a/src/StdMeshers/StdMeshers_FaceSide.hxx b/src/StdMeshers/StdMeshers_FaceSide.hxx index 4f714d4bf..9ef5960fb 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.hxx +++ b/src/StdMeshers/StdMeshers_FaceSide.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -47,7 +48,6 @@ class SMESH_Mesh; class Adaptor2d_Curve2d; class Adaptor3d_Curve; class BRepAdaptor_CompCurve; -class TopoDS_Face; struct SMESH_ComputeError; class StdMeshers_FaceSide; @@ -96,7 +96,43 @@ public: /*! * \brief Create a side from an UVPtStructVec */ - StdMeshers_FaceSide(UVPtStructVec& theSideNodes); + StdMeshers_FaceSide(UVPtStructVec& theSideNodes, + const TopoDS_Face& theFace = TopoDS_Face()); + + // static "consrtuctors" + static StdMeshers_FaceSidePtr New(const TopoDS_Face& Face, + const TopoDS_Edge& Edge, + SMESH_Mesh* Mesh, + const bool IsForward, + const bool IgnoreMediumNodes, + SMESH_ProxyMesh::Ptr ProxyMesh = SMESH_ProxyMesh::Ptr()) + { return StdMeshers_FaceSidePtr + ( new StdMeshers_FaceSide( Face,Edge,Mesh,IsForward,IgnoreMediumNodes,ProxyMesh )); + } + static StdMeshers_FaceSidePtr New (const TopoDS_Face& Face, + std::list& Edges, + SMESH_Mesh* Mesh, + const bool IsForward, + const bool IgnoreMediumNodes, + SMESH_ProxyMesh::Ptr ProxyMesh = SMESH_ProxyMesh::Ptr()) + { return StdMeshers_FaceSidePtr + ( new StdMeshers_FaceSide( Face,Edges,Mesh,IsForward,IgnoreMediumNodes,ProxyMesh )); + } + static StdMeshers_FaceSidePtr New (const StdMeshers_FaceSide* Side, + const SMDS_MeshNode* Node, + const gp_Pnt2d* Pnt2d1, + const gp_Pnt2d* Pnt2d2=NULL, + const Handle(Geom2d_Curve)& C2d=NULL, + const double UFirst=0., + const double ULast=1.) + { return StdMeshers_FaceSidePtr + ( new StdMeshers_FaceSide( Side,Node,Pnt2d1,Pnt2d2,C2d,UFirst,ULast )); + } + static StdMeshers_FaceSidePtr New (UVPtStructVec& theSideNodes, + const TopoDS_Face& theFace = TopoDS_Face()) + { + return StdMeshers_FaceSidePtr( new StdMeshers_FaceSide( theSideNodes, theFace )); + } /*! * \brief Return wires of a face as StdMeshers_FaceSide's diff --git a/src/StdMeshers/StdMeshers_FixedPoints1D.cxx b/src/StdMeshers/StdMeshers_FixedPoints1D.cxx index bcc8855d3..a731f9b2a 100644 --- a/src/StdMeshers/StdMeshers_FixedPoints1D.cxx +++ b/src/StdMeshers/StdMeshers_FixedPoints1D.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_FixedPoints1D.hxx b/src/StdMeshers/StdMeshers_FixedPoints1D.hxx index 2f74c15a3..5cbcd4c10 100644 --- a/src/StdMeshers/StdMeshers_FixedPoints1D.hxx +++ b/src/StdMeshers/StdMeshers_FixedPoints1D.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Geometric1D.cxx b/src/StdMeshers/StdMeshers_Geometric1D.cxx new file mode 100644 index 000000000..35820dc46 --- /dev/null +++ b/src/StdMeshers/StdMeshers_Geometric1D.cxx @@ -0,0 +1,204 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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_Geometric1D.cxx +// Module : SMESH +// +#include "StdMeshers_Geometric1D.hxx" + +#include "SMESH_Mesh.hxx" + +#include +#include +#include +#include +#include +#include +#include + +//============================================================================= +/*! + * Constructor + */ +//============================================================================= + +StdMeshers_Geometric1D::StdMeshers_Geometric1D(int hypId, int studyId, SMESH_Gen * gen) + :StdMeshers_Reversible1D(hypId, studyId, gen) +{ + _begLength = 1.; + _ratio = 1.; + _name = "GeometricProgression"; +} + +//============================================================================= +/*! + * Sets length of the first segment + */ +//============================================================================= + +void StdMeshers_Geometric1D::SetStartLength(double length) + throw(SALOME_Exception) +{ + if ( _begLength != length ) + { + if (length <= 0) + throw SALOME_Exception(LOCALIZED("length must be positive")); + _begLength = length; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * Sets value of Common Ratio + */ +//============================================================================= + +void StdMeshers_Geometric1D::SetCommonRatio(double factor) + throw(SALOME_Exception) +{ + if ( _ratio != factor ) + { + if (factor == 0) + throw SALOME_Exception(LOCALIZED("Zero factor is not allowed")); + _ratio = factor; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * Returns length of the first segment + */ +//============================================================================= + +double StdMeshers_Geometric1D::GetStartLength() const +{ + return _begLength; +} + +//============================================================================= +/*! + * Returns value of Common Ratio + */ +//============================================================================= + +double StdMeshers_Geometric1D::GetCommonRatio() const +{ + return _ratio; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & StdMeshers_Geometric1D::SaveTo(ostream & save) +{ + save << _begLength << " " << _ratio << " "; + + StdMeshers_Reversible1D::SaveTo( save ); + + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & StdMeshers_Geometric1D::LoadFrom(istream & load) +{ + bool isOK = true; + isOK = (load >> _begLength); + isOK = (load >> _ratio); + + if (isOK) + StdMeshers_Reversible1D::LoadFrom( load ); + + return load; +} + +//================================================================================ +/*! + * \brief Initialize start and end length by the mesh built on the geometry + * \param theMesh - the built mesh + * \param theShape - the geometry of interest + * \retval bool - true if parameter values have been successfully defined + */ +//================================================================================ + +bool StdMeshers_Geometric1D::SetParametersByMesh(const SMESH_Mesh* theMesh, + const TopoDS_Shape& theShape) +{ + if ( !theMesh || theShape.IsNull() ) + return false; + + _begLength = _ratio = 0.; + + int nbEdges = 0; + TopTools_IndexedMapOfShape edgeMap; + TopExp::MapShapes( theShape, TopAbs_EDGE, edgeMap ); + for ( int i = 1; i <= edgeMap.Extent(); ++i ) + { + const TopoDS_Edge& edge = TopoDS::Edge( edgeMap( i )); + BRepAdaptor_Curve C( edge ); + + vector< double > params; + if ( SMESH_Algo::GetNodeParamOnEdge( theMesh->GetMeshDS(), edge, params )) + { + nbEdges++; + double l1 = GCPnts_AbscissaPoint::Length( C, params[0], params[1] ); + _begLength += l1; + if ( params.size() > 2 && l1 > 1e-100 ) + _ratio += GCPnts_AbscissaPoint::Length( C, params[1], params[2]) / l1; + else + _ratio += 1; + } + } + if ( nbEdges ) { + _begLength /= nbEdges; + _ratio /= nbEdges; + } + else { + _begLength = 1; + _ratio = 1; + } + return nbEdges; +} + +//================================================================================ +/*! + * \brief Initialize my parameter values by default parameters. + * \retval bool - true if parameter values have been successfully defined + */ +//================================================================================ + +bool StdMeshers_Geometric1D::SetParametersByDefaults(const TDefaults& dflts, + const SMESH_Mesh* /*mesh*/) +{ + return ( _begLength = dflts._elemLength ); +} + diff --git a/src/StdMeshers/StdMeshers_Geometric1D.hxx b/src/StdMeshers/StdMeshers_Geometric1D.hxx new file mode 100644 index 000000000..a14edc2f5 --- /dev/null +++ b/src/StdMeshers/StdMeshers_Geometric1D.hxx @@ -0,0 +1,67 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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_Geometric1D.hxx +// Module : SMESH +// +#ifndef _SMESH_Geometric1D_HXX_ +#define _SMESH_Geometric1D_HXX_ + +#include "SMESH_StdMeshers.hxx" + +#include "StdMeshers_Reversible1D.hxx" +#include "Utils_SALOME_Exception.hxx" + +class STDMESHERS_EXPORT StdMeshers_Geometric1D: public StdMeshers_Reversible1D +{ +public: + StdMeshers_Geometric1D(int hypId, int studyId, SMESH_Gen* gen); + + void SetStartLength(double length) throw(SALOME_Exception); + void SetCommonRatio(double factor) throw(SALOME_Exception); + + double GetStartLength() const; + double GetCommonRatio() const; + + virtual std::ostream & SaveTo(std::ostream & save); + virtual std::istream & LoadFrom(std::istream & load); + + /*! + * \brief Initialize start and end length by the mesh built on the geometry + * \param theMesh - the built mesh + * \param theShape - the geometry of interest + * \retval bool - true if parameter values have been successfully defined + */ + virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, 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); + +protected: + double _begLength, _ratio; +}; + +#endif diff --git a/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx b/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx index e316d2971..b4a502da3 100644 --- a/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx +++ b/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_HexaFromSkin_3D.hxx b/src/StdMeshers/StdMeshers_HexaFromSkin_3D.hxx index 21ea20624..c6d5dbee2 100644 --- a/src/StdMeshers/StdMeshers_HexaFromSkin_3D.hxx +++ b/src/StdMeshers/StdMeshers_HexaFromSkin_3D.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.cxx b/src/StdMeshers/StdMeshers_Hexa_3D.cxx index 949ba6709..0271fc41c 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -222,8 +222,8 @@ namespace * \brief Finds FaceQuadStruct having a side equal to a given one and rearranges * the found FaceQuadStruct::side to have the given side at a Q_BOTTOM place */ - FaceQuadStructPtr getQuadWithBottom( StdMeshers_FaceSide* side, - FaceQuadStructPtr quad[ 6 ]) + FaceQuadStructPtr getQuadWithBottom( StdMeshers_FaceSidePtr side, + FaceQuadStructPtr quad[ 6 ]) { FaceQuadStructPtr foundQuad; for ( int i = 1; i < 6; ++i ) @@ -231,7 +231,7 @@ namespace if ( !quad[i] ) continue; for ( unsigned iS = 0; iS < quad[i]->side.size(); ++iS ) { - const StdMeshers_FaceSide* side2 = quad[i]->side[iS]; + const StdMeshers_FaceSidePtr side2 = quad[i]->side[iS]; if (( side->FirstVertex().IsSame( side2->FirstVertex() ) || side->FirstVertex().IsSame( side2->LastVertex() )) && @@ -241,7 +241,7 @@ namespace { if ( iS != Q_BOTTOM ) { - vector< StdMeshers_FaceSide*> newSides; + vector< FaceQuadStruct::Side > newSides; for ( unsigned j = iS; j < quad[i]->side.size(); ++j ) newSides.push_back( quad[i]->side[j] ); for ( unsigned j = 0; j < iS; ++j ) @@ -287,9 +287,9 @@ namespace //============================================================================= /*! * Generates hexahedron mesh on hexaedron like form using algorithm from - * "Application de l'interpolation transfinie à la création de maillages + * "Application de l'interpolation transfinie � la cr�ation de maillages * C0 ou G1 continus sur des triangles, quadrangles, tetraedres, pentaedres - * et hexaedres déformés." + * et hexaedres d�form�s." * Alain PERONNET - 8 janvier 1999 */ //============================================================================= @@ -391,7 +391,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for ( int i = 0; i < 6; ++i ) { const TopoDS_Face& F = aCubeSide[i]._quad->face; - StdMeshers_FaceSide* baseQuadSide = aCubeSide[i]._quad->side[ Q_BOTTOM ]; + StdMeshers_FaceSidePtr baseQuadSide = aCubeSide[i]._quad->side[ Q_BOTTOM ]; list baseEdges( baseQuadSide->Edges().begin(), baseQuadSide->Edges().end() ); // assure correctness of node positions on baseE: @@ -741,6 +741,39 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper return error( algo->GetComputeError()); } +//================================================================================ +/*! + * \brief Return true if the algorithm can mesh this shape + * \param [in] aShape - shape to check + * \param [in] toCheckAll - if true, this check returns OK if all shapes are OK, + * else, returns OK if at least one shape is OK + */ +//================================================================================ + +bool StdMeshers_Hexa_3D::IsApplicable( const TopoDS_Shape & aShape, bool toCheckAll ) +{ + TopExp_Explorer exp0( aShape, TopAbs_SOLID ); + if ( !exp0.More() ) return false; + + for ( ; exp0.More(); exp0.Next() ) + { + int nbFoundShells = 0; + TopExp_Explorer exp1( exp0.Current(), TopAbs_SHELL ); + for ( ; exp1.More(); exp1.Next(), ++nbFoundShells) + if ( nbFoundShells == 2 ) break; + if ( nbFoundShells != 1 ) { + if ( toCheckAll ) return false; + continue; + } + exp1.Init( exp0.Current(), TopAbs_FACE ); + int nbEdges = SMESH_MesherHelper::Count( exp1.Current(), TopAbs_EDGE, /*ignoreSame=*/true ); + bool ok = ( nbEdges > 3 ); + if ( toCheckAll && !ok ) return false; + if ( !toCheckAll && ok ) return true; + } + return toCheckAll; +}; + //======================================================================= //function : ComputePentahedralMesh //purpose : diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.hxx b/src/StdMeshers/StdMeshers_Hexa_3D.hxx index 8be85aafe..7c64bd497 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.hxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -54,6 +54,7 @@ public: virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, MapShapeNbElems& aResMap); + static bool IsApplicable(const TopoDS_Shape & aShape, bool toCheckAll); protected: const StdMeshers_ViscousLayers* _viscousLayersHyp; diff --git a/src/StdMeshers/StdMeshers_ImportSource.cxx b/src/StdMeshers/StdMeshers_ImportSource.cxx index 4bcebe2fa..aea046595 100644 --- a/src/StdMeshers/StdMeshers_ImportSource.cxx +++ b/src/StdMeshers/StdMeshers_ImportSource.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_ImportSource.hxx b/src/StdMeshers/StdMeshers_ImportSource.hxx index 2066dff4b..78facb160 100644 --- a/src/StdMeshers/StdMeshers_ImportSource.hxx +++ b/src/StdMeshers/StdMeshers_ImportSource.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Import_1D.cxx b/src/StdMeshers/StdMeshers_Import_1D.cxx index a75c2f5cc..ee9fe4ef1 100644 --- a/src/StdMeshers/StdMeshers_Import_1D.cxx +++ b/src/StdMeshers/StdMeshers_Import_1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Import_1D.hxx b/src/StdMeshers/StdMeshers_Import_1D.hxx index 2b2ceabfd..b45fe5f50 100644 --- a/src/StdMeshers/StdMeshers_Import_1D.hxx +++ b/src/StdMeshers/StdMeshers_Import_1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Import_1D2D.cxx b/src/StdMeshers/StdMeshers_Import_1D2D.cxx index 4b54fa774..6aff7c207 100644 --- a/src/StdMeshers/StdMeshers_Import_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_Import_1D2D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Import_1D2D.hxx b/src/StdMeshers/StdMeshers_Import_1D2D.hxx index e40a0b2ff..e008b99d4 100644 --- a/src/StdMeshers/StdMeshers_Import_1D2D.hxx +++ b/src/StdMeshers/StdMeshers_Import_1D2D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_LayerDistribution.cxx b/src/StdMeshers/StdMeshers_LayerDistribution.cxx index 4748230bc..6b7b972da 100644 --- a/src/StdMeshers/StdMeshers_LayerDistribution.cxx +++ b/src/StdMeshers/StdMeshers_LayerDistribution.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_LayerDistribution.hxx b/src/StdMeshers/StdMeshers_LayerDistribution.hxx index a6a7737b0..25823ecbb 100644 --- a/src/StdMeshers/StdMeshers_LayerDistribution.hxx +++ b/src/StdMeshers/StdMeshers_LayerDistribution.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_LayerDistribution2D.cxx b/src/StdMeshers/StdMeshers_LayerDistribution2D.cxx index 42287a266..815768e4f 100644 --- a/src/StdMeshers/StdMeshers_LayerDistribution2D.cxx +++ b/src/StdMeshers/StdMeshers_LayerDistribution2D.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_LayerDistribution2D.hxx b/src/StdMeshers/StdMeshers_LayerDistribution2D.hxx index c645c5f40..a17fe0627 100644 --- a/src/StdMeshers/StdMeshers_LayerDistribution2D.hxx +++ b/src/StdMeshers/StdMeshers_LayerDistribution2D.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_LengthFromEdges.cxx b/src/StdMeshers/StdMeshers_LengthFromEdges.cxx index 38d4de8fb..48bc31a8e 100644 --- a/src/StdMeshers/StdMeshers_LengthFromEdges.cxx +++ b/src/StdMeshers/StdMeshers_LengthFromEdges.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_LengthFromEdges.hxx b/src/StdMeshers/StdMeshers_LengthFromEdges.hxx index f896ed6b8..fb9bf49de 100644 --- a/src/StdMeshers/StdMeshers_LengthFromEdges.hxx +++ b/src/StdMeshers/StdMeshers_LengthFromEdges.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_LocalLength.cxx b/src/StdMeshers/StdMeshers_LocalLength.cxx index 89a5dd8c7..6546c4492 100644 --- a/src/StdMeshers/StdMeshers_LocalLength.cxx +++ b/src/StdMeshers/StdMeshers_LocalLength.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_LocalLength.hxx b/src/StdMeshers/StdMeshers_LocalLength.hxx index 6febdeedb..5d3895d9e 100644 --- a/src/StdMeshers/StdMeshers_LocalLength.hxx +++ b/src/StdMeshers/StdMeshers_LocalLength.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx index 6f9499cd3..75db56313 100644 --- a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx +++ b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx index 34eed0587..c7b513805 100644 --- a/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx +++ b/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_MaxElementArea.cxx b/src/StdMeshers/StdMeshers_MaxElementArea.cxx index f75f1970e..0b027ad45 100644 --- a/src/StdMeshers/StdMeshers_MaxElementArea.cxx +++ b/src/StdMeshers/StdMeshers_MaxElementArea.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_MaxElementArea.hxx b/src/StdMeshers/StdMeshers_MaxElementArea.hxx index 06fdebd4b..4864643e9 100644 --- a/src/StdMeshers/StdMeshers_MaxElementArea.hxx +++ b/src/StdMeshers/StdMeshers_MaxElementArea.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_MaxElementVolume.cxx b/src/StdMeshers/StdMeshers_MaxElementVolume.cxx index 0f24ceabf..2b3fd114c 100644 --- a/src/StdMeshers/StdMeshers_MaxElementVolume.cxx +++ b/src/StdMeshers/StdMeshers_MaxElementVolume.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_MaxElementVolume.hxx b/src/StdMeshers/StdMeshers_MaxElementVolume.hxx index b0603bbaa..9b1ef03b9 100644 --- a/src/StdMeshers/StdMeshers_MaxElementVolume.hxx +++ b/src/StdMeshers/StdMeshers_MaxElementVolume.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_MaxLength.cxx b/src/StdMeshers/StdMeshers_MaxLength.cxx index 72c701ff7..661b3e603 100644 --- a/src/StdMeshers/StdMeshers_MaxLength.cxx +++ b/src/StdMeshers/StdMeshers_MaxLength.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_MaxLength.hxx b/src/StdMeshers/StdMeshers_MaxLength.hxx index f0c5b4069..48b2fe5a0 100644 --- a/src/StdMeshers/StdMeshers_MaxLength.hxx +++ b/src/StdMeshers/StdMeshers_MaxLength.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_NotConformAllowed.cxx b/src/StdMeshers/StdMeshers_NotConformAllowed.cxx index 0b169e8d0..e88b93fc9 100644 --- a/src/StdMeshers/StdMeshers_NotConformAllowed.cxx +++ b/src/StdMeshers/StdMeshers_NotConformAllowed.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_NotConformAllowed.hxx b/src/StdMeshers/StdMeshers_NotConformAllowed.hxx index 06d7badbb..7d79bedf8 100644 --- a/src/StdMeshers/StdMeshers_NotConformAllowed.hxx +++ b/src/StdMeshers/StdMeshers_NotConformAllowed.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_NumberOfLayers.cxx b/src/StdMeshers/StdMeshers_NumberOfLayers.cxx index c19e21620..ad7cfbfe2 100644 --- a/src/StdMeshers/StdMeshers_NumberOfLayers.cxx +++ b/src/StdMeshers/StdMeshers_NumberOfLayers.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_NumberOfLayers.hxx b/src/StdMeshers/StdMeshers_NumberOfLayers.hxx index 16fc30495..2e6365b5b 100644 --- a/src/StdMeshers/StdMeshers_NumberOfLayers.hxx +++ b/src/StdMeshers/StdMeshers_NumberOfLayers.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_NumberOfLayers2D.cxx b/src/StdMeshers/StdMeshers_NumberOfLayers2D.cxx index 61c6c76d2..66f5690f7 100644 --- a/src/StdMeshers/StdMeshers_NumberOfLayers2D.cxx +++ b/src/StdMeshers/StdMeshers_NumberOfLayers2D.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_NumberOfLayers2D.hxx b/src/StdMeshers/StdMeshers_NumberOfLayers2D.hxx index de8710305..daad9b2fd 100644 --- a/src/StdMeshers/StdMeshers_NumberOfLayers2D.hxx +++ b/src/StdMeshers/StdMeshers_NumberOfLayers2D.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_NumberOfSegments.cxx b/src/StdMeshers/StdMeshers_NumberOfSegments.cxx index 5f230274f..f09dc7a10 100644 --- a/src/StdMeshers/StdMeshers_NumberOfSegments.cxx +++ b/src/StdMeshers/StdMeshers_NumberOfSegments.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_NumberOfSegments.hxx b/src/StdMeshers/StdMeshers_NumberOfSegments.hxx index ae7c9dd47..6857cffb3 100644 --- a/src/StdMeshers/StdMeshers_NumberOfSegments.hxx +++ b/src/StdMeshers/StdMeshers_NumberOfSegments.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Penta_3D.cxx b/src/StdMeshers/StdMeshers_Penta_3D.cxx index 3db3f2dd9..2038c10f7 100644 --- a/src/StdMeshers/StdMeshers_Penta_3D.cxx +++ b/src/StdMeshers/StdMeshers_Penta_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Penta_3D.hxx b/src/StdMeshers/StdMeshers_Penta_3D.hxx index 43a599bd2..ef09f3a35 100644 --- a/src/StdMeshers/StdMeshers_Penta_3D.hxx +++ b/src/StdMeshers/StdMeshers_Penta_3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Prism_3D.cxx b/src/StdMeshers/StdMeshers_Prism_3D.cxx index 07e9a166d..c43a126c3 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.cxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -107,7 +107,7 @@ namespace { algo->myProxyMesh->GetMesh() != helper->GetMesh() ) algo->myProxyMesh.reset( new SMESH_ProxyMesh( *helper->GetMesh() )); - algo->myQuadStruct.reset(); + algo->myQuadList.clear(); if ( helper ) algo->_quadraticMesh = helper->GetIsQuadratic(); @@ -166,15 +166,15 @@ namespace { //================================================================================ bool setBottomEdge( const TopoDS_Edge& botE, - faceQuadStruct::Ptr& quad, + FaceQuadStruct::Ptr& quad, const TopoDS_Shape& face) { - quad->side[ QUAD_TOP_SIDE ]->Reverse(); - quad->side[ QUAD_LEFT_SIDE ]->Reverse(); + quad->side[ QUAD_TOP_SIDE ].grid->Reverse(); + quad->side[ QUAD_LEFT_SIDE ].grid->Reverse(); int edgeIndex = 0; for ( size_t i = 0; i < quad->side.size(); ++i ) { - StdMeshers_FaceSide* quadSide = quad->side[i]; + StdMeshers_FaceSidePtr quadSide = quad->side[i]; for ( int iE = 0; iE < quadSide->NbEdges(); ++iE ) if ( botE.IsSame( quadSide->Edge( iE ))) { @@ -681,7 +681,7 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh continue; // already computed prism } // find a source FACE of the SOLID: it's a FACE sharing a bottom EDGE with wFace - const TopoDS_Edge& wEdge = (*wQuad)->side[ QUAD_TOP_SIDE ]->Edge(0); + const TopoDS_Edge& wEdge = (*wQuad)->side[ QUAD_TOP_SIDE ].grid->Edge(0); PShapeIteratorPtr faceIt = myHelper->GetAncestors( wEdge, *myHelper->GetMesh(), TopAbs_FACE); while ( const TopoDS_Shape* f = faceIt->next() ) @@ -879,7 +879,7 @@ bool StdMeshers_Prism_3D::getWallFaces( Prism_3D::TPrismTopo & thePrism, int nbKnownFaces; do { nbKnownFaces = faceMap.Extent(); - StdMeshers_FaceSide *rightSide, *topSide; // sides of the quad + StdMeshers_FaceSidePtr rightSide, topSide; // sides of the quad for ( size_t i = 0; i < thePrism.myWallQuads.size(); ++i ) { rightSide = thePrism.myWallQuads[i].back()->side[ QUAD_RIGHT_SIDE ]; @@ -911,8 +911,8 @@ bool StdMeshers_Prism_3D::getWallFaces( Prism_3D::TPrismTopo & thePrism, { for ( size_t i = 0; i < thePrism.myWallQuads.size(); ++i ) { - StdMeshers_FaceSide* topSide = thePrism.myWallQuads[i].back()->side[ QUAD_TOP_SIDE ]; - const TopoDS_Edge & topE = topSide->Edge( 0 ); + StdMeshers_FaceSidePtr topSide = thePrism.myWallQuads[i].back()->side[ QUAD_TOP_SIDE ]; + const TopoDS_Edge & topE = topSide->Edge( 0 ); if ( topSide->NbEdges() > 1 ) return toSM( error(COMPERR_BAD_SHAPE, TCom("Side face #") << shapeID( thePrism.myWallQuads[i].back()->face ) @@ -958,8 +958,8 @@ bool StdMeshers_Prism_3D::getWallFaces( Prism_3D::TPrismTopo & thePrism, // Check that the top FACE shares all the top EDGEs for ( size_t i = 0; i < thePrism.myWallQuads.size(); ++i ) { - StdMeshers_FaceSide* topSide = thePrism.myWallQuads[i].back()->side[ QUAD_TOP_SIDE ]; - const TopoDS_Edge & topE = topSide->Edge( 0 ); + StdMeshers_FaceSidePtr topSide = thePrism.myWallQuads[i].back()->side[ QUAD_TOP_SIDE ]; + const TopoDS_Edge & topE = topSide->Edge( 0 ); if ( !myHelper->IsSubShape( topE, thePrism.myTop )) return toSM( error( TCom("Wrong source face (#") << shapeID( thePrism.myBottom ))); } @@ -1205,7 +1205,7 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism) int wgt = 0; // "weight" for ( ; quad != thePrism.myWallQuads[iW].end(); ++quad ) { - StdMeshers_FaceSide* lftSide = (*quad)->side[ QUAD_LEFT_SIDE ]; + StdMeshers_FaceSidePtr lftSide = (*quad)->side[ QUAD_LEFT_SIDE ]; for ( int i = 0; i < lftSide->NbEdges(); ++i ) { ++wgt; @@ -1224,7 +1224,7 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism) quad = thePrism.myWallQuads[iW].begin(); for ( ; quad != thePrism.myWallQuads[iW].end(); ++quad ) for ( int i = 0; i < NB_QUAD_SIDES; ++i ) - (*quad)->side[ i ]->SetIgnoreMediumNodes( true ); + (*quad)->side[ i ].grid->SetIgnoreMediumNodes( true ); } } @@ -1237,8 +1237,8 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism) Prism_3D::TQuadList::const_iterator quad = quads.begin(); for ( ; quad != quads.end(); ++quad ) { - StdMeshers_FaceSide* rgtSide = (*quad)->side[ QUAD_RIGHT_SIDE ]; // tgt - StdMeshers_FaceSide* lftSide = (*quad)->side[ QUAD_LEFT_SIDE ]; // src + StdMeshers_FaceSidePtr rgtSide = (*quad)->side[ QUAD_RIGHT_SIDE ]; // tgt + StdMeshers_FaceSidePtr lftSide = (*quad)->side[ QUAD_LEFT_SIDE ]; // src bool swapLeftRight = ( lftSide->NbSegments( /*update=*/true ) == 0 && rgtSide->NbSegments( /*update=*/true ) > 0 ); if ( swapLeftRight ) @@ -1373,8 +1373,8 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism) // to compute stuctured quad mesh on wall FACEs // --------------------------------------------------- { - const TopoDS_Edge& botE = (*quad)->side[ QUAD_BOTTOM_SIDE ]->Edge(0); - const TopoDS_Edge& topE = (*quad)->side[ QUAD_TOP_SIDE ]->Edge(0); + const TopoDS_Edge& botE = (*quad)->side[ QUAD_BOTTOM_SIDE ].grid->Edge(0); + const TopoDS_Edge& topE = (*quad)->side[ QUAD_TOP_SIDE ].grid->Edge(0); SMESH_subMesh* botSM = mesh->GetSubMesh( botE ); SMESH_subMesh* topSM = mesh->GetSubMesh( topE ); SMESH_subMesh* srcSM = botSM; @@ -2037,6 +2037,341 @@ int StdMeshers_Prism_3D::shapeID( const TopoDS_Shape& S ) return myHelper->GetMeshDS()->ShapeToIndex( S ); } +namespace // utils used by StdMeshers_Prism_3D::IsApplicable() +{ + struct EdgeWithNeighbors + { + TopoDS_Edge _edge; + int _iL, _iR; + EdgeWithNeighbors(const TopoDS_Edge& E, int iE, int nbE, int shift = 0 ): + _edge( E ), + _iL( SMESH_MesherHelper::WrapIndex( iE-1, nbE ) + shift ), + _iR( SMESH_MesherHelper::WrapIndex( iE+1, nbE ) + shift ) + { + } + EdgeWithNeighbors() {} + }; + struct PrismSide + { + TopoDS_Face _face; + TopTools_IndexedMapOfShape *_faces; // pointer because its copy constructor is private + TopoDS_Edge _topEdge; + vector< EdgeWithNeighbors >*_edges; + int _iBotEdge; + vector< bool > _isCheckedEdge; + int _nbCheckedEdges; // nb of EDGEs whose location is defined + PrismSide *_leftSide; + PrismSide *_rightSide; + const TopoDS_Edge& Edge( int i ) const + { + return (*_edges)[ i ]._edge; + } + int FindEdge( const TopoDS_Edge& E ) const + { + for ( size_t i = 0; i < _edges->size(); ++i ) + if ( E.IsSame( Edge( i ))) return i; + return -1; + } + }; + //-------------------------------------------------------------------------------- + /*! + * \brief Return ordered edges of a face + */ + bool getEdges( const TopoDS_Face& face, + vector< EdgeWithNeighbors > & edges, + const bool noHolesAllowed) + { + list< TopoDS_Edge > ee; + list< int > nbEdgesInWires; + int nbW = SMESH_Block::GetOrderedEdges( face, ee, nbEdgesInWires ); + if ( nbW > 1 && noHolesAllowed ) + return false; + + int iE, nbTot = 0; + list< TopoDS_Edge >::iterator e = ee.begin(); + list< int >::iterator nbE = nbEdgesInWires.begin(); + for ( ; nbE != nbEdgesInWires.end(); ++nbE ) + for ( iE = 0; iE < *nbE; ++e, ++iE ) + if ( SMESH_Algo::isDegenerated( *e )) + { + ee.erase( e ); + --(*nbE); + --iE; + } + else + { + e->Orientation( TopAbs_FORWARD ); // for operator==() to work + } + + edges.clear(); + e = ee.begin(); + for ( nbE = nbEdgesInWires.begin(); nbE != nbEdgesInWires.end(); ++nbE ) + { + for ( iE = 0; iE < *nbE; ++e, ++iE ) + edges.push_back( EdgeWithNeighbors( *e, iE, *nbE, nbTot )); + nbTot += *nbE; + } + return edges.size(); + } + //-------------------------------------------------------------------------------- + /*! + * \brief Return another faces sharing an edge + */ + const TopoDS_Shape & getAnotherFace( const TopoDS_Face& face, + const TopoDS_Edge& edge, + TopTools_IndexedDataMapOfShapeListOfShape& facesOfEdge) + { + TopTools_ListIteratorOfListOfShape faceIt( facesOfEdge.FindFromKey( edge )); + for ( ; faceIt.More(); faceIt.Next() ) + if ( !face.IsSame( faceIt.Value() )) + return faceIt.Value(); + return face; + } +} + +//================================================================================ +/*! + * \brief Return true if the algorithm can mesh this shape + * \param [in] aShape - shape to check + * \param [in] toCheckAll - if true, this check returns OK if all shapes are OK, + * else, returns OK if at least one shape is OK + */ +//================================================================================ + +bool StdMeshers_Prism_3D::IsApplicable(const TopoDS_Shape & shape, bool toCheckAll) +{ + TopExp_Explorer sExp( shape, TopAbs_SOLID ); + if ( !sExp.More() ) + return false; + + for ( ; sExp.More(); sExp.Next() ) + { + // check nb shells + TopoDS_Shape shell; + TopExp_Explorer shExp( sExp.Current(), TopAbs_SHELL ); + if ( shExp.More() ) { + shell = shExp.Current(); + shExp.Next(); + if ( shExp.More() ) + shell.Nullify(); + } + if ( shell.IsNull() ) { + if ( toCheckAll ) return false; + continue; + } + // get all faces + TopTools_IndexedMapOfShape allFaces; + TopExp::MapShapes( shell, TopAbs_FACE, allFaces ); + if ( allFaces.Extent() < 3 ) { + if ( toCheckAll ) return false; + continue; + } + // is a box? + if ( allFaces.Extent() == 6 ) + { + TopTools_IndexedMapOfOrientedShape map; + bool isBox = SMESH_Block::FindBlockShapes( TopoDS::Shell( shell ), + TopoDS_Vertex(), TopoDS_Vertex(), map ); + if ( isBox ) { + if ( !toCheckAll ) return true; + continue; + } + } +#ifdef _DEBUG_ + TopTools_IndexedMapOfShape allShapes; + TopExp::MapShapes( shape, allShapes ); +#endif + + TopTools_IndexedDataMapOfShapeListOfShape facesOfEdge; + TopTools_ListIteratorOfListOfShape faceIt; + TopExp::MapShapesAndAncestors( sExp.Current(), TopAbs_EDGE, TopAbs_FACE , facesOfEdge ); + if ( facesOfEdge.IsEmpty() ) { + if ( toCheckAll ) return false; + continue; + } + + typedef vector< EdgeWithNeighbors > TEdgeWithNeighborsVec; + vector< TEdgeWithNeighborsVec > faceEdgesVec( allFaces.Extent() + 1 ); + TopTools_IndexedMapOfShape* facesOfSide = new TopTools_IndexedMapOfShape[ faceEdgesVec.size() ]; + SMESHUtils::ArrayDeleter delFacesOfSide( facesOfSide ); + + // try to use each face as a bottom one + bool prismDetected = false; + for ( int iF = 1; iF < allFaces.Extent() && !prismDetected; ++iF ) + { + const TopoDS_Face& botF = TopoDS::Face( allFaces( iF )); + + TEdgeWithNeighborsVec& botEdges = faceEdgesVec[ iF ]; + if ( botEdges.empty() ) + { + if ( !getEdges( botF, botEdges, /*noHoles=*/false )) + break; + if ( allFaces.Extent()-1 <= (int) botEdges.size() ) + continue; // all faces are adjacent to botF - no top FACE + } + // init data of side FACEs + vector< PrismSide > sides( botEdges.size() ); + for ( int iS = 0; iS < botEdges.size(); ++iS ) + { + sides[ iS ]._topEdge = botEdges[ iS ]._edge; + sides[ iS ]._face = botF; + sides[ iS ]._leftSide = & sides[ botEdges[ iS ]._iR ]; + sides[ iS ]._rightSide = & sides[ botEdges[ iS ]._iL ]; + sides[ iS ]._faces = & facesOfSide[ iS ]; + sides[ iS ]._faces->Clear(); + } + + bool isOK = true; // ok for a current botF + bool isAdvanced = true; + int nbFoundSideFaces = 0; + for ( int iLoop = 0; isOK && isAdvanced; ++iLoop ) + { + isAdvanced = false; + for ( size_t iS = 0; iS < sides.size() && isOK; ++iS ) + { + PrismSide& side = sides[ iS ]; + if ( side._face.IsNull() ) + continue; + if ( side._topEdge.IsNull() ) + { + // find vertical EDGEs --- EGDEs shared with neighbor side FACEs + for ( int is2nd = 0; is2nd < 2 && isOK; ++is2nd ) // 2 adjacent neighbors + { + int di = is2nd ? 1 : -1; + const PrismSide* adjSide = is2nd ? side._rightSide : side._leftSide; + for ( size_t i = 1; i < side._edges->size(); ++i ) + { + int iE = SMESH_MesherHelper::WrapIndex( i*di + side._iBotEdge, side._edges->size()); + if ( side._isCheckedEdge[ iE ] ) continue; + const TopoDS_Edge& vertE = side.Edge( iE ); + const TopoDS_Shape& neighborF = getAnotherFace( side._face, vertE, facesOfEdge ); + bool isEdgeShared = adjSide->_faces->Contains( neighborF ); + if ( isEdgeShared ) + { + isAdvanced = true; + side._isCheckedEdge[ iE ] = true; + side._nbCheckedEdges++; + int nbNotCheckedE = side._edges->size() - side._nbCheckedEdges; + if ( nbNotCheckedE == 1 ) + break; + } + else + { + if ( i == 1 && iLoop == 0 ) isOK = false; + break; + } + } + } + // find a top EDGE + int nbNotCheckedE = side._edges->size() - side._nbCheckedEdges; + if ( nbNotCheckedE == 1 ) + { + vector::iterator ii = std::find( side._isCheckedEdge.begin(), + side._isCheckedEdge.end(), false ); + if ( ii != side._isCheckedEdge.end() ) + { + size_t iE = std::distance( side._isCheckedEdge.begin(), ii ); + side._topEdge = side.Edge( iE ); + } + } + isOK = ( nbNotCheckedE >= 1 ); + } + else //if ( !side._topEdge.IsNull() ) + { + // get a next face of a side + const TopoDS_Shape& f = getAnotherFace( side._face, side._topEdge, facesOfEdge ); + side._faces->Add( f ); + bool stop = false; + if ( f.IsSame( side._face ) || // _topEdge is a seam + SMESH_MesherHelper::Count( f, TopAbs_WIRE, false ) != 1 ) + { + stop = true; + } + else if ( side._leftSide != & side ) // not closed side face + { + if ( side._leftSide->_faces->Contains( f )) + { + stop = true; + side._leftSide->_face.Nullify(); + side._leftSide->_topEdge.Nullify(); + } + if ( side._rightSide->_faces->Contains( f )) + { + stop = true; + side._rightSide->_face.Nullify(); + side._rightSide->_topEdge.Nullify(); + } + } + if ( stop ) + { + side._face.Nullify(); + side._topEdge.Nullify(); + continue; + } + side._face = TopoDS::Face( f ); + int faceID = allFaces.FindIndex( side._face ); + side._edges = & faceEdgesVec[ faceID ]; + if ( side._edges->empty() ) + if ( !getEdges( side._face, * side._edges, /*noHoles=*/true )) + break; + const int nbE = side._edges->size(); + if ( nbE >= 4 ) + { + isAdvanced = true; + ++nbFoundSideFaces; + side._iBotEdge = side.FindEdge( side._topEdge ); + side._isCheckedEdge.clear(); + side._isCheckedEdge.resize( nbE, false ); + side._isCheckedEdge[ side._iBotEdge ] = true; + side._nbCheckedEdges = 1; // bottom EDGE is known + } + side._topEdge.Nullify(); + isOK = ( !side._edges->empty() || side._faces->Extent() > 1 ); + + } //if ( !side._topEdge.IsNull() ) + + } // loop on prism sides + + if ( nbFoundSideFaces > allFaces.Extent() ) + { + isOK = false; + } + if ( iLoop > allFaces.Extent() * 10 ) + { + isOK = false; +#ifdef _DEBUG_ + cerr << "BUG: infinite loop in StdMeshers_Prism_3D::IsApplicable()" << endl; +#endif + } + } // while isAdvanced + + if ( isOK && sides[0]._faces->Extent() > 1 ) + { + const int nbFaces = sides[0]._faces->Extent(); + if ( botEdges.size() == 1 ) // cylinder + { + prismDetected = ( nbFaces == allFaces.Extent()-1 ); + } + else + { + const TopoDS_Shape& topFace = sides[0]._faces->FindKey( nbFaces ); + size_t iS; + for ( iS = 1; iS < sides.size(); ++iS ) + if ( !sides[ iS ]._faces->Contains( topFace )) + break; + prismDetected = ( iS == sides.size() ); + } + } + } // loop on allFaces + + if ( !prismDetected && toCheckAll ) return false; + if ( prismDetected && !toCheckAll ) return true; + + } // loop on solids + + return toCheckAll; +} + namespace Prism_3D { //================================================================================ @@ -2352,7 +2687,7 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper, Prism_3D::TQuadList::const_iterator quad = thePrism.myWallQuads[ iE ].begin(); for ( ; quad != thePrism.myWallQuads[ iE ].end(); ++quad ) { - const TopoDS_Edge& quadBot = (*quad)->side[ QUAD_BOTTOM_SIDE ]->Edge( 0 ); + const TopoDS_Edge& quadBot = (*quad)->side[ QUAD_BOTTOM_SIDE ].grid->Edge( 0 ); if ( !myHelper->LoadNodeColumns( faceColumns, (*quad)->face, quadBot, meshDS )) return error(COMPERR_BAD_INPUT_MESH, TCom("Can't find regular quadrangle mesh ") << "on a side face #" << MeshDS()->ShapeToIndex( (*quad)->face )); @@ -2373,7 +2708,7 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper, Prism_3D::TQuadList::const_iterator quad = thePrism.myWallQuads[ iE ].begin(); for ( ; quad != thePrism.myWallQuads[ iE ].end(); ++quad ) { - const TopoDS_Edge& quadBot = (*quad)->side[ QUAD_BOTTOM_SIDE ]->Edge( 0 ); + const TopoDS_Edge& quadBot = (*quad)->side[ QUAD_BOTTOM_SIDE ].grid->Edge( 0 ); if ( !myHelper->LoadNodeColumns( faceColumns, (*quad)->face, quadBot, meshDS )) return error(COMPERR_BAD_INPUT_MESH, TCom("Can't find regular quadrangle mesh ") << "on a side face #" << MeshDS()->ShapeToIndex( (*quad)->face )); @@ -3592,6 +3927,8 @@ TPCurveOnHorFaceAdaptor::TPCurveOnHorFaceAdaptor( const TSideFace* sideFace, const int Z = isTop ? sideFace->ColumnHeight() - 1 : 0; map u2nodes; sideFace->GetNodesAtZ( Z, u2nodes ); + if ( u2nodes.empty() ) + return; SMESH_MesherHelper helper( *sideFace->GetMesh() ); helper.SetSubShape( horFace ); @@ -3656,7 +3993,7 @@ gp_Pnt2d StdMeshers_PrismAsBlock::TPCurveOnHorFaceAdaptor::Value(const Standard_ map< double, gp_XY >::const_iterator i1 = myUVmap.upper_bound( U ); if ( i1 == myUVmap.end() ) - return myUVmap.rbegin()->second; + return myUVmap.empty() ? gp_XY(0,0) : myUVmap.rbegin()->second; if ( i1 == myUVmap.begin() ) return (*i1).second; diff --git a/src/StdMeshers/StdMeshers_Prism_3D.hxx b/src/StdMeshers/StdMeshers_Prism_3D.hxx index 9fcfd2585..3a4f61f4d 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.hxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -432,9 +432,11 @@ public: * \param helper - helper initialized by mesh and shape to add prisms to */ static void AddPrisms( std::vector & nodeColumns, - SMESH_MesherHelper* helper); + SMESH_MesherHelper* helper); -private: + static bool IsApplicable(const TopoDS_Shape & aShape, bool toCheckAll); + + private: /*! * \brief Analyse shape geometry and mesh. diff --git a/src/StdMeshers/StdMeshers_ProjectionSource1D.cxx b/src/StdMeshers/StdMeshers_ProjectionSource1D.cxx index d9f0d746c..8dd29e4c8 100644 --- a/src/StdMeshers/StdMeshers_ProjectionSource1D.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionSource1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_ProjectionSource1D.hxx b/src/StdMeshers/StdMeshers_ProjectionSource1D.hxx index 4845f3c7d..3cbf55c8c 100644 --- a/src/StdMeshers/StdMeshers_ProjectionSource1D.hxx +++ b/src/StdMeshers/StdMeshers_ProjectionSource1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_ProjectionSource2D.cxx b/src/StdMeshers/StdMeshers_ProjectionSource2D.cxx index 1cd3ca041..5034d7920 100644 --- a/src/StdMeshers/StdMeshers_ProjectionSource2D.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionSource2D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_ProjectionSource2D.hxx b/src/StdMeshers/StdMeshers_ProjectionSource2D.hxx index 967c57d28..892730e44 100644 --- a/src/StdMeshers/StdMeshers_ProjectionSource2D.hxx +++ b/src/StdMeshers/StdMeshers_ProjectionSource2D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_ProjectionSource3D.cxx b/src/StdMeshers/StdMeshers_ProjectionSource3D.cxx index c52e47210..efa55b390 100644 --- a/src/StdMeshers/StdMeshers_ProjectionSource3D.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionSource3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_ProjectionSource3D.hxx b/src/StdMeshers/StdMeshers_ProjectionSource3D.hxx index 64980c919..abaa2df89 100644 --- a/src/StdMeshers/StdMeshers_ProjectionSource3D.hxx +++ b/src/StdMeshers/StdMeshers_ProjectionSource3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx index 262c92507..730f78c62 100644 --- a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_ProjectionUtils.hxx b/src/StdMeshers/StdMeshers_ProjectionUtils.hxx index 55dd1a68e..9709cd6c8 100644 --- a/src/StdMeshers/StdMeshers_ProjectionUtils.hxx +++ b/src/StdMeshers/StdMeshers_ProjectionUtils.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Projection_1D.cxx b/src/StdMeshers/StdMeshers_Projection_1D.cxx index 4d9fad919..10da51638 100644 --- a/src/StdMeshers/StdMeshers_Projection_1D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Projection_1D.hxx b/src/StdMeshers/StdMeshers_Projection_1D.hxx index 73f3f35e6..b76450ef4 100644 --- a/src/StdMeshers/StdMeshers_Projection_1D.hxx +++ b/src/StdMeshers/StdMeshers_Projection_1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Projection_1D2D.cxx b/src/StdMeshers/StdMeshers_Projection_1D2D.cxx index 517eddf9e..63fc73dc9 100644 --- a/src/StdMeshers/StdMeshers_Projection_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_1D2D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Projection_1D2D.hxx b/src/StdMeshers/StdMeshers_Projection_1D2D.hxx index e5ae80b6d..a8a20f405 100644 --- a/src/StdMeshers/StdMeshers_Projection_1D2D.hxx +++ b/src/StdMeshers/StdMeshers_Projection_1D2D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Projection_2D.cxx b/src/StdMeshers/StdMeshers_Projection_2D.cxx index 6bb6adc1f..c4bbc0c68 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -1018,9 +1018,9 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& map< double, const SMDS_MeshNode* >::iterator u_oldNode, u_newNode, u_newOnSeam, newEnd; set< const SMDS_MeshNode* > seamNodes; - // mapper puts on a seam edge nodes from 2 edges + // mapper changed, no more "mapper puts on a seam edge nodes from 2 edges" if ( isSeam && ! getBoundaryNodes ( sm, tgtFace, u2nodesOnSeam, seamNodes )) - RETURN_BAD_RESULT("getBoundaryNodes() failed"); + ;//RETURN_BAD_RESULT("getBoundaryNodes() failed"); SMDS_NodeIteratorPtr nIt = smDS->GetNodes(); while ( nIt->more() ) diff --git a/src/StdMeshers/StdMeshers_Projection_2D.hxx b/src/StdMeshers/StdMeshers_Projection_2D.hxx index f46b48d47..57e34dbc4 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.hxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Projection_3D.cxx b/src/StdMeshers/StdMeshers_Projection_3D.cxx index 767acddbb..3079c7bd8 100644 --- a/src/StdMeshers/StdMeshers_Projection_3D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Projection_3D.hxx b/src/StdMeshers/StdMeshers_Projection_3D.hxx index 14595442e..363a38e93 100644 --- a/src/StdMeshers/StdMeshers_Projection_3D.hxx +++ b/src/StdMeshers/StdMeshers_Projection_3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Propagation.cxx b/src/StdMeshers/StdMeshers_Propagation.cxx index bfe999db9..730bc5a52 100644 --- a/src/StdMeshers/StdMeshers_Propagation.cxx +++ b/src/StdMeshers/StdMeshers_Propagation.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -64,7 +64,8 @@ namespace { /*! * \brief Return an edge from which hypotheses are propagated from */ - static TopoDS_Edge GetSource(SMESH_subMesh * submesh); + static TopoDS_Edge GetSource(SMESH_subMesh * submesh, + bool& isPropagOfDistribution); /*! * \brief Does it's main job */ @@ -90,23 +91,28 @@ StdMeshers_Propagation::StdMeshers_Propagation (int hypId, int studyId, SMESH_Ge _name = GetName(); _param_algo_dim = -1; // 1D auxiliary } +StdMeshers_PropagOfDistribution::StdMeshers_PropagOfDistribution (int hypId, + int studyId, + SMESH_Gen * gen) + : StdMeshers_Propagation(hypId, studyId, gen) { _name = GetName(); } StdMeshers_Propagation::~StdMeshers_Propagation() {} string StdMeshers_Propagation::GetName () { return "Propagation"; } +string StdMeshers_PropagOfDistribution::GetName () { return "PropagOfDistribution"; } ostream & StdMeshers_Propagation::SaveTo (ostream & save) { return save; } istream & StdMeshers_Propagation::LoadFrom (istream & load) { return load; } -ostream & operator << (ostream & save, StdMeshers_Propagation & hyp) { return hyp.SaveTo(save); } -istream & operator >> (istream & load, StdMeshers_Propagation & hyp) { return hyp.LoadFrom(load); } bool StdMeshers_Propagation::SetParametersByMesh(const SMESH_Mesh*, const TopoDS_Shape& ) { return false; } bool StdMeshers_Propagation::SetParametersByDefaults(const TDefaults&,const SMESH_Mesh*) { return false; } void StdMeshers_Propagation::SetPropagationMgr(SMESH_subMesh* subMesh) { PropagationMgr::Set( subMesh ); } /*! - * \brief Return an edge from which hypotheses are propagated from + * \brief Return an edge from which hypotheses are propagated */ -TopoDS_Edge StdMeshers_Propagation::GetPropagationSource(SMESH_Mesh& theMesh, - const TopoDS_Shape& theEdge) +TopoDS_Edge StdMeshers_Propagation::GetPropagationSource(SMESH_Mesh& theMesh, + const TopoDS_Shape& theEdge, + bool& isPropagOfDistribution) { - return PropagationMgr::GetSource(theMesh.GetSubMeshContaining( theEdge )); + return PropagationMgr::GetSource( theMesh.GetSubMeshContaining( theEdge ), + isPropagOfDistribution); } //============================================================================= @@ -126,11 +132,13 @@ namespace { struct PropagationMgrData : public EventListenerData { bool myForward; //!< true if a curve of edge in chain is codirected with one of source edge + bool myIsPropagOfDistribution; //!< type of Propagation hyp PropagationMgrData( SubMeshState state=WAIT_PROPAG_HYP ): EventListenerData(true) { - myType = state; myForward = true; + myType = state; myForward = true; myIsPropagOfDistribution = false; } void Init() { myType = WAIT_PROPAG_HYP; mySubMeshes.clear(); myForward = true; + myIsPropagOfDistribution = false; } SubMeshState State() const { return (SubMeshState) myType; @@ -217,8 +225,13 @@ namespace { const SMESH_Hypothesis* getProagationHyp (SMESH_Mesh& theMesh, const TopoDS_Shape& theEdge) { - static SMESH_HypoFilter propagHypFilter - ( SMESH_HypoFilter::HasName( StdMeshers_Propagation::GetName ())); + static SMESH_HypoFilter propagHypFilter; + if ( propagHypFilter.IsEmpty() ) + { + propagHypFilter. + Init( SMESH_HypoFilter::HasName( StdMeshers_Propagation::GetName ())). + Or ( SMESH_HypoFilter::HasName( StdMeshers_PropagOfDistribution::GetName ())); + } return theMesh.GetHypothesis( theEdge, propagHypFilter, true ); } //================================================================================ @@ -248,6 +261,10 @@ namespace { PropagationMgrData* chainData = getData( theMainSubMesh ); chainData->SetState( HAS_PROPAG_HYP ); + if ( const SMESH_Hypothesis * propagHyp = getProagationHyp( *mesh, theMainEdge )) + chainData->myIsPropagOfDistribution = + ( StdMeshers_PropagOfDistribution::GetName() == propagHyp->GetName() ); + // Edge submeshes, to which the 1D hypothesis will be propagated from theMainEdge list & chain = chainData->mySubMeshes; chain.clear(); @@ -462,17 +479,21 @@ namespace { { if ( findData( submesh )) return; DBGMSG( "PropagationMgr::Set() on " << submesh->GetId() ); - EventListenerData* data = new PropagationMgrData(); + PropagationMgrData* data = new PropagationMgrData(); submesh->SetEventListener( getListener(), data, submesh ); const SMESH_Hypothesis * propagHyp = getProagationHyp( *submesh->GetFather(), submesh->GetSubShape() ); if ( propagHyp ) + { + data->myIsPropagOfDistribution = + ( StdMeshers_PropagOfDistribution::GetName() == propagHyp->GetName() ); getListener()->ProcessEvent( SMESH_subMesh::ADD_HYP, SMESH_subMesh::ALGO_EVENT, submesh, data, propagHyp); + } } //================================================================================ /*! @@ -480,7 +501,8 @@ namespace { */ //================================================================================ - TopoDS_Edge PropagationMgr::GetSource(SMESH_subMesh * submesh) + TopoDS_Edge PropagationMgr::GetSource(SMESH_subMesh * submesh, + bool& isPropagOfDistribution) { if ( PropagationMgrData* data = findData( submesh )) { if ( data->State() == IN_CHAIN ) { @@ -489,6 +511,9 @@ namespace { TopoDS_Shape edge = sm->GetSubShape(); edge = edge.Oriented( data->myForward ? TopAbs_FORWARD : TopAbs_REVERSED ); DBGMSG( " GetSource() = edge " << sm->GetId() << " REV = " << (!data->myForward)); + isPropagOfDistribution = false; + if ( PropagationMgrData* data = findData( sm )) + isPropagOfDistribution = data->myIsPropagOfDistribution; if ( edge.ShapeType() == TopAbs_EDGE ) return TopoDS::Edge( edge ); } @@ -502,9 +527,9 @@ namespace { */ //================================================================================ - void PropagationMgr::ProcessEvent(const int event, - const int eventType, - SMESH_subMesh* subMesh, + void PropagationMgr::ProcessEvent(const int event, + const int eventType, + SMESH_subMesh* subMesh, SMESH_subMeshEventListenerData* listenerData, const SMESH_Hypothesis* hyp) { @@ -516,7 +541,8 @@ namespace { return; DBGMSG( "PropagationMgr::ProcessEvent() on " << subMesh->GetId() ); - bool isPropagHyp = ( StdMeshers_Propagation::GetName() == hyp->GetName() ); + bool isPropagHyp = ( StdMeshers_Propagation::GetName() == hyp->GetName() || + StdMeshers_PropagOfDistribution::GetName() == hyp->GetName() ); PropagationMgrData* data = static_cast( listenerData ); switch ( data->State() ) { diff --git a/src/StdMeshers/StdMeshers_Propagation.hxx b/src/StdMeshers/StdMeshers_Propagation.hxx index c5a1616f7..fa6acfda3 100644 --- a/src/StdMeshers/StdMeshers_Propagation.hxx +++ b/src/StdMeshers/StdMeshers_Propagation.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -50,8 +50,6 @@ class STDMESHERS_EXPORT StdMeshers_Propagation:public SMESH_Hypothesis virtual std::ostream & SaveTo(std::ostream & save); virtual std::istream & LoadFrom(std::istream & load); - friend std::ostream & operator <<(std::ostream & save, StdMeshers_Propagation & hyp); - friend std::istream & operator >>(std::istream & load, StdMeshers_Propagation & hyp); static std::string GetName (); @@ -69,7 +67,9 @@ class STDMESHERS_EXPORT StdMeshers_Propagation:public SMESH_Hypothesis * \param theEdge - edge to which hypotheses are propagated * \retval TopoDS_Edge - source edge, also passing orientation */ - static TopoDS_Edge GetPropagationSource(SMESH_Mesh& theMesh, const TopoDS_Shape& theEdge); + static TopoDS_Edge GetPropagationSource(SMESH_Mesh& theMesh, + const TopoDS_Shape& theEdge, + bool& isPropagOfDistribution ); /*! * \brief Initialize my parameter values by the mesh built on the geometry @@ -88,4 +88,19 @@ class STDMESHERS_EXPORT StdMeshers_Propagation:public SMESH_Hypothesis virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0); }; + +// ======================================================================= +/*! + * \brief Propagation Of Distribution hypothesis + */ +// ======================================================================= + +class STDMESHERS_EXPORT StdMeshers_PropagOfDistribution: public StdMeshers_Propagation +{ + public: + StdMeshers_PropagOfDistribution(int hypId, int studyId, SMESH_Gen * gen); + + static std::string GetName(); +}; + #endif diff --git a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx index c69fa9e7a..8ddd342ca 100644 --- a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx +++ b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.hxx b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.hxx index c2d4f4b42..0cdb63fd1 100644 --- a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.hxx +++ b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_QuadrangleParams.cxx b/src/StdMeshers/StdMeshers_QuadrangleParams.cxx index 5369e598c..4ed750b13 100644 --- a/src/StdMeshers/StdMeshers_QuadrangleParams.cxx +++ b/src/StdMeshers/StdMeshers_QuadrangleParams.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -87,6 +87,43 @@ void StdMeshers_QuadrangleParams::SetQuadType (StdMeshers_QuadType type) } } +//================================================================================ +/*! + * \brief Set positions of enforced nodes + */ +//================================================================================ + +void StdMeshers_QuadrangleParams:: +SetEnforcedNodes( const std::vector< TopoDS_Shape >& shapes, + const std::vector< gp_Pnt >& points ) +{ + bool isChanged = ( shapes != _enforcedVertices || + points.size() != _enforcedPoints.size() ); + for ( size_t i = 0; i < points.size() && !isChanged; ++i ) + isChanged = ( _enforcedPoints[ i ].SquareDistance( points[i] ) > 1e-100 ); + + if ( isChanged ) + { + _enforcedVertices = shapes; + _enforcedPoints = points; + NotifySubMeshesHypothesisModification(); + } +} + +//================================================================================ +/*! + * \brief Returns positions of enforced nodes + */ +//================================================================================ + +void StdMeshers_QuadrangleParams:: +GetEnforcedNodes( std::vector< TopoDS_Shape >& shapes, + std::vector< gp_Pnt >& points ) const +{ + shapes = _enforcedVertices; + points = _enforcedPoints; +} + //============================================================================= /*! * @@ -98,6 +135,13 @@ ostream & StdMeshers_QuadrangleParams::SaveTo(ostream & save) save << _triaVertexID << " UNDEFINED " << int(_quadType); else save << _triaVertexID << " " << _objEntry << " " << int(_quadType); + + save << " " << _enforcedPoints.size(); + for ( size_t i = 0; i < _enforcedPoints.size(); ++i ) + save << " " << _enforcedPoints[i].X() + << " " << _enforcedPoints[i].Y() + << " " << _enforcedPoints[i].Z(); + return save; } @@ -122,29 +166,25 @@ istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load) if (isOK) _quadType = StdMeshers_QuadType(type); + // _enforcedVertices are loaded at StdMeshers_I level + // because GEOM objects are referred by study entry. + + int nbP = 0; + double x,y,z; + if ( load >> nbP && nbP > 0 ) + { + _enforcedPoints.reserve( nbP ); + while ( _enforcedPoints.size() < _enforcedPoints.capacity() ) + if ( load >> x && + load >> y && + load >> z ) + _enforcedPoints.push_back( gp_Pnt( x,y,z )); + else + break; + } return load; } -//============================================================================= -/*! - * - */ -//============================================================================= -ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp) -{ - return hyp.SaveTo( save ); -} - -//============================================================================= -/*! - * - */ -//============================================================================= -istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp) -{ - return hyp.LoadFrom( load ); -} - //================================================================================ /*! * \brief Redifined method diff --git a/src/StdMeshers/StdMeshers_QuadrangleParams.hxx b/src/StdMeshers/StdMeshers_QuadrangleParams.hxx index 9d8374daa..9dc1641f5 100644 --- a/src/StdMeshers/StdMeshers_QuadrangleParams.hxx +++ b/src/StdMeshers/StdMeshers_QuadrangleParams.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,9 +24,12 @@ #define _SMESH_QUADRANGLEPARAMS_HXX_ #include "SMESH_StdMeshers.hxx" - #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" + +#include + +#include +#include enum StdMeshers_QuadType { @@ -38,8 +41,7 @@ enum StdMeshers_QuadType QUAD_NB_TYPES }; -class STDMESHERS_EXPORT StdMeshers_QuadrangleParams: - public SMESH_Hypothesis +class STDMESHERS_EXPORT StdMeshers_QuadrangleParams: public SMESH_Hypothesis { public: StdMeshers_QuadrangleParams(int hypId, int studyId, SMESH_Gen* gen); @@ -54,12 +56,13 @@ public: void SetQuadType (StdMeshers_QuadType type); StdMeshers_QuadType GetQuadType() const { return _quadType; } + void SetEnforcedNodes( const std::vector< TopoDS_Shape >& shapes, + const std::vector< gp_Pnt >& points ); + void GetEnforcedNodes( std::vector< TopoDS_Shape >& shapes, + std::vector< gp_Pnt >& points ) const; + virtual std::ostream & SaveTo(std::ostream & save); virtual std::istream & LoadFrom(std::istream & load); - friend std::ostream& operator << (std::ostream & save, - StdMeshers_QuadrangleParams & hyp); - friend std::istream& operator >> (std::istream & load, - StdMeshers_QuadrangleParams & hyp); /*! * \brief Initialize start and end length by the mesh built on the geometry @@ -78,9 +81,11 @@ public: const SMESH_Mesh* theMesh=0); protected: - int _triaVertexID; - std::string _objEntry; - StdMeshers_QuadType _quadType; + int _triaVertexID; + std::string _objEntry; + StdMeshers_QuadType _quadType; + std::vector< TopoDS_Shape > _enforcedVertices; + std::vector< gp_Pnt > _enforcedPoints; }; #endif diff --git a/src/StdMeshers/StdMeshers_QuadranglePreference.cxx b/src/StdMeshers/StdMeshers_QuadranglePreference.cxx index e5dcecb39..61260eff4 100644 --- a/src/StdMeshers/StdMeshers_QuadranglePreference.cxx +++ b/src/StdMeshers/StdMeshers_QuadranglePreference.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_QuadranglePreference.hxx b/src/StdMeshers/StdMeshers_QuadranglePreference.hxx index 57ef8c0ad..2657ac8aa 100644 --- a/src/StdMeshers/StdMeshers_QuadranglePreference.hxx +++ b/src/StdMeshers/StdMeshers_QuadranglePreference.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index 62fadc505..016a5098d 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -33,14 +33,19 @@ #include "SMESH_Block.hxx" #include "SMESH_Comment.hxx" #include "SMESH_Gen.hxx" +#include "SMESH_HypoFilter.hxx" #include "SMESH_Mesh.hxx" +#include "SMESH_MeshAlgos.hxx" #include "SMESH_MesherHelper.hxx" #include "SMESH_subMesh.hxx" #include "StdMeshers_FaceSide.hxx" #include "StdMeshers_QuadrangleParams.hxx" #include "StdMeshers_ViscousLayers2D.hxx" +#include +#include #include +#include #include #include #include @@ -85,8 +90,10 @@ StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId, myTrianglePreference(false), myTriaVertexID(-1), myNeedSmooth(false), + myCheckOri(false), + myParams( NULL ), myQuadType(QUAD_STANDARD), - myHelper( 0 ) + myHelper( NULL ) { MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D"); _name = "Quadrangle_2D"; @@ -119,15 +126,16 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis const TopoDS_Shape& aShape, SMESH_Hypothesis::Hypothesis_Status& aStatus) { - myTriaVertexID = -1; - myQuadType = QUAD_STANDARD; + myTriaVertexID = -1; + myQuadType = QUAD_STANDARD; myQuadranglePreference = false; - myTrianglePreference = false; - myQuadStruct.reset(); - myHelper = NULL; + myTrianglePreference = false; + myHelper = (SMESH_MesherHelper*)NULL; + myParams = NULL; + myQuadList.clear(); bool isOk = true; - aStatus = SMESH_Hypothesis::HYP_OK; + aStatus = SMESH_Hypothesis::HYP_OK; const list & hyps = GetUsedHypothesis(aMesh, aShape, false); @@ -138,11 +146,11 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis // First assigned hypothesis (if any) is processed now if (hyps.size() > 0) { aHyp = hyps.front(); - if (strcmp("QuadrangleParams", aHyp->GetName()) == 0) { - const StdMeshers_QuadrangleParams* aHyp1 = - (const StdMeshers_QuadrangleParams*)aHyp; - myTriaVertexID = aHyp1->GetTriaVertex(); - myQuadType = aHyp1->GetQuadType(); + if (strcmp("QuadrangleParams", aHyp->GetName()) == 0) + { + myParams = (const StdMeshers_QuadrangleParams*)aHyp; + myTriaVertexID = myParams->GetTriaVertex(); + myQuadType = myParams->GetQuadType(); if (myQuadType == QUAD_QUADRANGLE_PREF || myQuadType == QUAD_QUADRANGLE_PREF_REVERSED) myQuadranglePreference = true; @@ -208,35 +216,43 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, const TopoDS_Face& F = TopoDS::Face(aShape); aMesh.GetSubMesh( F ); + // do not initialize my fields before this as StdMeshers_ViscousLayers2D + // can call Compute() recursively + SMESH_ProxyMesh::Ptr proxyMesh = StdMeshers_ViscousLayers2D::Compute( aMesh, F ); + if ( !proxyMesh ) + return false; + + myProxyMesh = proxyMesh; + SMESH_MesherHelper helper (aMesh); myHelper = &helper; - myProxyMesh = StdMeshers_ViscousLayers2D::Compute( aMesh, F ); - if ( !myProxyMesh ) - return false; - _quadraticMesh = myHelper->IsQuadraticSubMesh(aShape); myNeedSmooth = false; + myCheckOri = false; FaceQuadStruct::Ptr quad = CheckNbEdges( aMesh, F, /*considerMesh=*/true ); if (!quad) return false; - myQuadStruct = quad; + myQuadList.clear(); + myQuadList.push_back( quad ); + + if ( !getEnforcedUV() ) + return false; updateDegenUV( quad ); + int n1 = quad->side[0].NbPoints(); + int n2 = quad->side[1].NbPoints(); + int n3 = quad->side[2].NbPoints(); + int n4 = quad->side[3].NbPoints(); + enum { NOT_COMPUTED = -1, COMPUTE_FAILED = 0, COMPUTE_OK = 1 }; int res = NOT_COMPUTED; if (myQuadranglePreference) { - int n1 = quad->side[0]->NbPoints(); - int n2 = quad->side[1]->NbPoints(); - int n3 = quad->side[2]->NbPoints(); - int n4 = quad->side[3]->NbPoints(); int nfull = n1+n2+n3+n4; - int ntmp = nfull/2; - ntmp = ntmp*2; - if (nfull == ntmp && ((n1 != n3) || (n2 != n4))) + if ((nfull % 2) == 0 && ((n1 != n3) || (n2 != n4))) { // special path genarating only quandrangle faces res = computeQuadPref( aMesh, F, quad ); @@ -244,10 +260,6 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, } else if (myQuadType == QUAD_REDUCED) { - int n1 = quad->side[0]->NbPoints(); - int n2 = quad->side[1]->NbPoints(); - int n3 = quad->side[2]->NbPoints(); - int n4 = quad->side[3]->NbPoints(); int n13 = n1 - n3; int n24 = n2 - n4; int n13tmp = n13/2; n13tmp = n13tmp*2; @@ -275,15 +287,106 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, if ( res == NOT_COMPUTED ) { - res = computeQuadDominant( aMesh, F, quad ); + if ( n1 != n3 || n2 != n4 ) + res = computeTriangles( aMesh, F, quad ); + else + res = computeQuadDominant( aMesh, F ); } if ( res == COMPUTE_OK && myNeedSmooth ) smooth( quad ); + if ( res == COMPUTE_OK ) + res = check(); + return ( res == COMPUTE_OK ); } +//================================================================================ +/*! + * \brief Compute quadrangles and triangles on the quad + */ +//================================================================================ + +bool StdMeshers_Quadrangle_2D::computeTriangles(SMESH_Mesh& aMesh, + const TopoDS_Face& aFace, + FaceQuadStruct::Ptr quad) +{ + int nb = quad->side[0].grid->NbPoints(); + int nr = quad->side[1].grid->NbPoints(); + int nt = quad->side[2].grid->NbPoints(); + int nl = quad->side[3].grid->NbPoints(); + + // rotate the quad to have nbNodeOut sides on TOP [and LEFT] + if ( nb > nt ) + quad->shift( nl > nr ? 3 : 2, true ); + else if ( nr > nl ) + quad->shift( 1, true ); + else if ( nl > nr ) + quad->shift( nt > nb ? 0 : 3, true ); + + if ( !setNormalizedGrid( quad )) + return false; + + if ( quad->nbNodeOut( QUAD_TOP_SIDE )) + { + splitQuad( quad, 0, quad->jSize-2 ); + } + if ( quad->nbNodeOut( QUAD_BOTTOM_SIDE )) // this should not happen + { + splitQuad( quad, 0, 1 ); + } + FaceQuadStruct::Ptr newQuad = myQuadList.back(); + if ( quad != newQuad ) // split done + { + { + FaceQuadStruct::Ptr botQuad = // a bottom part + ( quad->side[ QUAD_LEFT_SIDE ].from == 0 ) ? quad : newQuad; + if ( botQuad->nbNodeOut( QUAD_LEFT_SIDE ) > 0 ) + botQuad->side[ QUAD_LEFT_SIDE ].to += botQuad->nbNodeOut( QUAD_LEFT_SIDE ); + else if ( botQuad->nbNodeOut( QUAD_RIGHT_SIDE ) > 0 ) + botQuad->side[ QUAD_RIGHT_SIDE ].to += botQuad->nbNodeOut( QUAD_RIGHT_SIDE ); + } + // make quad be a greatest one + if ( quad->side[ QUAD_LEFT_SIDE ].NbPoints() == 2 || + quad->side[ QUAD_RIGHT_SIDE ].NbPoints() == 2 ) + quad = newQuad; + if ( !setNormalizedGrid( quad )) + return false; + } + + if ( quad->nbNodeOut( QUAD_RIGHT_SIDE )) + { + splitQuad( quad, quad->iSize-2, 0 ); + } + if ( quad->nbNodeOut( QUAD_LEFT_SIDE )) + { + splitQuad( quad, 1, 0 ); + } + + return computeQuadDominant( aMesh, aFace ); +} + +//================================================================================ +/*! + * \brief Compute quadrangles and possibly triangles on all quads of myQuadList + */ +//================================================================================ + +bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, + const TopoDS_Face& aFace) +{ + if ( !addEnforcedNodes() ) + return false; + + std::list< FaceQuadStruct::Ptr >::iterator quad = myQuadList.begin(); + for ( ; quad != myQuadList.end(); ++quad ) + if ( !computeQuadDominant( aMesh, aFace, *quad )) + return false; + + return true; +} + //================================================================================ /*! * \brief Compute quadrangles and possibly triangles @@ -294,37 +397,28 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, const TopoDS_Face& aFace, FaceQuadStruct::Ptr quad) { - // set normalized grid on unit square in parametric domain + // --- set normalized grid on unit square in parametric domain - if (!setNormalizedGrid(aMesh, aFace, quad)) + if ( !setNormalizedGrid( quad )) return false; - // --- compute 3D values on points, store points & quadrangles - - int nbdown = quad->side[0]->NbPoints(); - int nbup = quad->side[2]->NbPoints(); - - int nbright = quad->side[1]->NbPoints(); - int nbleft = quad->side[3]->NbPoints(); + // --- create nodes on points, and create quadrangles - int nbhoriz = Min(nbdown, nbup); - int nbvertic = Min(nbright, nbleft); + int nbhoriz = quad->iSize; + int nbvertic = quad->jSize; // internal mesh nodes SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); Handle(Geom_Surface) S = BRep_Tool::Surface(aFace); - int i, j, geomFaceID = meshDS->ShapeToIndex(aFace); - for (i = 1; i < nbhoriz - 1; i++) { - for (j = 1; j < nbvertic - 1; j++) { - int ij = j * nbhoriz + i; - double u = quad->uv_grid[ij].u; - double v = quad->uv_grid[ij].v; - gp_Pnt P = S->Value(u, v); - SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z()); - meshDS->SetNodeOnFace(node, geomFaceID, u, v); - quad->uv_grid[ij].node = node; + int i,j, geomFaceID = meshDS->ShapeToIndex(aFace); + for (i = 1; i < nbhoriz - 1; i++) + for (j = 1; j < nbvertic - 1; j++) + { + UVPtStruct& uvPnt = quad->UVPt( i, j ); + gp_Pnt P = S->Value( uvPnt.u, uvPnt.v ); + uvPnt.node = meshDS->AddNode(P.X(), P.Y(), P.Z()); + meshDS->SetNodeOnFace( uvPnt.node, geomFaceID, uvPnt.u, uvPnt.v ); } - } // mesh faces @@ -340,21 +434,20 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, // i // [0] - i = 0; int ilow = 0; int iup = nbhoriz - 1; - if (quad->isEdgeOut[3]) { ilow++; } else { if (quad->isEdgeOut[1]) iup--; } + if (quad->nbNodeOut(3)) { ilow++; } else { if (quad->nbNodeOut(1)) iup--; } int jlow = 0; int jup = nbvertic - 1; - if (quad->isEdgeOut[0]) { jlow++; } else { if (quad->isEdgeOut[2]) jup--; } + if (quad->nbNodeOut(0)) { jlow++; } else { if (quad->nbNodeOut(2)) jup--; } // regular quadrangles for (i = ilow; i < iup; i++) { for (j = jlow; j < jup; j++) { const SMDS_MeshNode *a, *b, *c, *d; - a = quad->uv_grid[j * nbhoriz + i ].node; - b = quad->uv_grid[j * nbhoriz + i + 1].node; + a = quad->uv_grid[ j * nbhoriz + i ].node; + b = quad->uv_grid[ j * nbhoriz + i + 1].node; c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node; d = quad->uv_grid[(j + 1) * nbhoriz + i ].node; SMDS_MeshFace* face = myHelper->AddFace(a, b, c, d); @@ -364,19 +457,25 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, } } - const vector& uv_e0 = quad->side[0]->GetUVPtStruct(true,0); - const vector& uv_e1 = quad->side[1]->GetUVPtStruct(false,1); - const vector& uv_e2 = quad->side[2]->GetUVPtStruct(true,1); - const vector& uv_e3 = quad->side[3]->GetUVPtStruct(false,0); + // Boundary elements (must always be on an outer boundary of the FACE) + + const vector& uv_e0 = quad->side[0].grid->GetUVPtStruct(); + const vector& uv_e1 = quad->side[1].grid->GetUVPtStruct(); + const vector& uv_e2 = quad->side[2].grid->GetUVPtStruct(); + const vector& uv_e3 = quad->side[3].grid->GetUVPtStruct(); if (uv_e0.empty() || uv_e1.empty() || uv_e2.empty() || uv_e3.empty()) return error(COMPERR_BAD_INPUT_MESH); double eps = Precision::Confusion(); - // Boundary quadrangles - - if (quad->isEdgeOut[0]) { + int nbdown = (int) uv_e0.size(); + int nbup = (int) uv_e2.size(); + int nbright = (int) uv_e1.size(); + int nbleft = (int) uv_e3.size(); + + if (quad->nbNodeOut(0) && nbvertic == 2) // this should not occure + { // Down edge is out // // |___|___|___|___|___|___| @@ -393,8 +492,12 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, // number of last node of the down edge to be processed int stop = nbdown - 1; // if right edge is out, we will stop at a node, previous to the last one - if (quad->isEdgeOut[1]) stop--; - + //if (quad->nbNodeOut(1)) stop--; + if ( quad->nbNodeOut( QUAD_RIGHT_SIDE )) + quad->UVPt( nbhoriz-1, 1 ).node = uv_e1[1].node; + if ( quad->nbNodeOut( QUAD_LEFT_SIDE )) + quad->UVPt( 0, 1 ).node = uv_e3[1].node; + // for each node of the down edge find nearest node // in the first row of the regular grid and link them for (i = 0; i < stop; i++) { @@ -449,7 +552,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, if (face) meshDS->SetMeshElementOnShape(face, geomFaceID); } else { - splitQuad(meshDS, geomFaceID, a, b, c, d); + splitQuadFace(meshDS, geomFaceID, a, b, c, d); } // if node d is not at position g - make additional triangles @@ -468,7 +571,8 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, } } } else { - if (quad->isEdgeOut[2]) { + if (quad->nbNodeOut(2) && nbvertic == 2) + { // Up edge is out // // <-<-<-<-<-<-<-<-<-<-<-<-< -- direction of processing @@ -483,9 +587,16 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, int g = nbhoriz - 1; // last processed node in the regular grid + ilow = 0; + iup = nbhoriz - 1; + int stop = 0; // if left edge is out, we will stop at a second node - if (quad->isEdgeOut[3]) stop++; + //if (quad->nbNodeOut(3)) stop++; + if ( quad->nbNodeOut( QUAD_RIGHT_SIDE )) + quad->UVPt( nbhoriz-1, 0 ).node = uv_e1[ nbright-2 ].node; + if ( quad->nbNodeOut( QUAD_LEFT_SIDE )) + quad->UVPt( 0, 0 ).node = uv_e3[ nbleft-2 ].node; // for each node of the up edge find nearest node // in the first row of the regular grid and link them @@ -536,10 +647,10 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, if (face) meshDS->SetMeshElementOnShape(face, geomFaceID); } else { - splitQuad(meshDS, geomFaceID, a, b, c, d); + splitQuadFace(meshDS, geomFaceID, a, b, c, d); } - if (near + 1 < g) { // if d not is at g - make additional triangles + if (near + 1 < g) { // if d is not at g - make additional triangles for (int k = near + 1; k < g; k++) { c = quad->uv_grid[nbhoriz*(nbvertic - 2) + k].node; if (k + 1 > iup) @@ -557,12 +668,14 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, } // right or left boundary quadrangles - if (quad->isEdgeOut[1]) { -// MESSAGE("right edge is out"); + if (quad->nbNodeOut( QUAD_RIGHT_SIDE ) && nbhoriz == 2) // this should not occure + { int g = 0; // last processed node in the grid int stop = nbright - 1; - if (quad->isEdgeOut[2]) stop--; - for (i = 0; i < stop; i++) { + i = 0; + if (quad->side[ QUAD_RIGHT_SIDE ].from != i ) i++; + if (quad->side[ QUAD_RIGHT_SIDE ].to != stop ) stop--; + for ( ; i < stop; i++) { const SMDS_MeshNode *a, *b, *c, *d; a = uv_e1[i].node; b = uv_e1[i + 1].node; @@ -609,7 +722,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, if (face) meshDS->SetMeshElementOnShape(face, geomFaceID); } else { - splitQuad(meshDS, geomFaceID, a, b, c, d); + splitQuadFace(meshDS, geomFaceID, a, b, c, d); } if (near - 1 > g) { // if d not is at g - make additional triangles @@ -627,12 +740,12 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, } } } else { - if (quad->isEdgeOut[3]) { + if (quad->nbNodeOut(3) && nbhoriz == 2) { // MESSAGE("left edge is out"); int g = nbvertic - 1; // last processed node in the grid int stop = 0; - if (quad->isEdgeOut[0]) stop++; - for (i = nbleft - 1; i > stop; i--) { + i = quad->side[ QUAD_LEFT_SIDE ].to-1; // nbleft - 1; + for (; i > stop; i--) { const SMDS_MeshNode *a, *b, *c, *d; a = uv_e3[i].node; b = uv_e3[i - 1].node; @@ -678,7 +791,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, if (face) meshDS->SetMeshElementOnShape(face, geomFaceID); } else { - splitQuad(meshDS, geomFaceID, a, b, c, d); + splitQuadFace(meshDS, geomFaceID, a, b, c, d); } if (near + 1 < g) { // if d not is at g - make additional triangles @@ -796,6 +909,38 @@ bool StdMeshers_Quadrangle_2D::Evaluate(SMESH_Mesh& aMesh, return true; } +//================================================================================ +/*! + * \brief Return true if the algorithm can mesh this shape + * \param [in] aShape - shape to check + * \param [in] toCheckAll - if true, this check returns OK if all shapes are OK, + * else, returns OK if at least one shape is OK + */ +//================================================================================ + +bool StdMeshers_Quadrangle_2D::IsApplicable( const TopoDS_Shape & aShape, bool toCheckAll ) +{ + int nbFoundFaces = 0; + for (TopExp_Explorer exp( aShape, TopAbs_FACE ); exp.More(); exp.Next(), ++nbFoundFaces ) + { + const TopoDS_Shape& aFace = exp.Current(); + int nbWire = SMESH_MesherHelper::Count( aFace, TopAbs_WIRE, false ); + if ( nbWire != 1 ) { + if ( toCheckAll ) return false; + continue; + } + + int nbNoDegenEdges = 0; + TopExp_Explorer eExp( aFace, TopAbs_EDGE ); + for ( ; eExp.More() && nbNoDegenEdges < 3; eExp.Next() ) { + if ( !SMESH_Algo::isDegenerated( TopoDS::Edge( eExp.Current() ))) + ++nbNoDegenEdges; + } + if ( toCheckAll && nbNoDegenEdges < 3 ) return false; + if ( !toCheckAll && nbNoDegenEdges >= 3 ) return true; + } + return ( toCheckAll && nbFoundFaces != 0 ); +} //================================================================================ /*! @@ -828,14 +973,14 @@ FaceQuadStruct::Ptr StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & const TopoDS_Shape & aShape, const bool considerMesh) { - if ( myQuadStruct && myQuadStruct->face.IsSame( aShape )) - return myQuadStruct; + if ( !myQuadList.empty() && myQuadList.front()->face.IsSame( aShape )) + return myQuadList.front(); TopoDS_Face F = TopoDS::Face(aShape); if ( F.Orientation() >= TopAbs_INTERNAL ) F.Orientation( TopAbs_FORWARD ); const bool ignoreMediumNodes = _quadraticMesh; - // verify 1 wire only, with 4 edges + // verify 1 wire only list< TopoDS_Edge > edges; list< int > nbEdgesInWire; int nbWire = SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire); @@ -852,7 +997,6 @@ FaceQuadStruct::Ptr StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & return FaceQuadStruct::Ptr(); } FaceQuadStruct::Ptr quad( new FaceQuadStruct ); - quad->uv_grid = 0; quad->side.reserve(nbEdgesInWire.front()); quad->face = F; @@ -870,17 +1014,17 @@ FaceQuadStruct::Ptr StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & else sideEdges.push_back( *edgeIt++ ); if ( !sideEdges.empty() ) - quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh, iSide < QUAD_TOP_SIDE, - ignoreMediumNodes, myProxyMesh)); + quad->side.push_back( StdMeshers_FaceSide::New(F, sideEdges, &aMesh, iSide < QUAD_TOP_SIDE, + ignoreMediumNodes, myProxyMesh)); else --iSide; } - 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 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(quad->side[1], aNode, &aPnt2d)); + gp_Pnt2d aPnt2d = UVPSleft[0].UV(); + quad->side.push_back( StdMeshers_FaceSide::New( quad->side[1].grid.get(), aNode, &aPnt2d )); myNeedSmooth = ( nbDegenEdges > 0 ); return quad; } @@ -922,15 +1066,15 @@ FaceQuadStruct::Ptr StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & } if ( !sideEdges.empty() ) { - quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh, iSide < QUAD_TOP_SIDE, - ignoreMediumNodes, myProxyMesh)); + quad->side.push_back( StdMeshers_FaceSide::New( F, sideEdges, &aMesh, iSide < QUAD_TOP_SIDE, + ignoreMediumNodes, myProxyMesh )); ++iSide; } else if ( !SMESH_Algo::isDegenerated( *edgeIt ) && // closed EDGE myHelper->IthVertex( 0, *edgeIt ).IsSame( myHelper->IthVertex( 1, *edgeIt ))) { - quad->side.push_back(new StdMeshers_FaceSide(F, *edgeIt++, &aMesh, iSide < QUAD_TOP_SIDE, - ignoreMediumNodes, myProxyMesh)); + quad->side.push_back( StdMeshers_FaceSide::New( F, *edgeIt++, &aMesh, iSide < QUAD_TOP_SIDE, + ignoreMediumNodes, myProxyMesh)); ++iSide; } if ( quad->side.size() == 4 ) @@ -1155,36 +1299,12 @@ StdMeshers_Quadrangle_2D::CheckAnd2Dcompute (SMESH_Mesh & aMesh, if ( quad ) { // set normalized grid on unit square in parametric domain - if ( ! setNormalizedGrid( aMesh, TopoDS::Face( aShape ), quad)) + if ( ! setNormalizedGrid( quad )) quad.reset(); } return quad; } -//============================================================================= -/*! - * - */ -//============================================================================= - -faceQuadStruct::~faceQuadStruct() -{ - for (size_t i = 0; i < side.size(); i++) { - if (side[i]) { - delete side[i]; - for (size_t j = i+1; j < side.size(); j++) - if ( side[i] == side[j] ) - side[j] = 0; - } - } - side.clear(); - - if (uv_grid) { - delete [] uv_grid; - uv_grid = 0; - } -} - namespace { inline const vector& getUVPtStructIn(FaceQuadStruct::Ptr& quad, int i, int nbSeg) @@ -1192,9 +1312,9 @@ namespace bool isXConst = (i == QUAD_BOTTOM_SIDE || i == QUAD_TOP_SIDE); double constValue = (i == QUAD_BOTTOM_SIDE || i == QUAD_LEFT_SIDE) ? 0 : 1; return - quad->isEdgeOut[i] ? - quad->side[i]->SimulateUVPtStruct(nbSeg,isXConst,constValue) : - quad->side[i]->GetUVPtStruct(isXConst,constValue); + quad->nbNodeOut(i) ? + quad->side[i].grid->SimulateUVPtStruct(nbSeg,isXConst,constValue) : + quad->side[i].grid->GetUVPtStruct (isXConst,constValue); } inline gp_UV calcUV(double x, double y, const gp_UV& a0,const gp_UV& a1,const gp_UV& a2,const gp_UV& a3, @@ -1212,10 +1332,11 @@ namespace */ //============================================================================= -bool StdMeshers_Quadrangle_2D::setNormalizedGrid (SMESH_Mesh & aMesh, - const TopoDS_Face& aFace, - FaceQuadStruct::Ptr & quad) +bool StdMeshers_Quadrangle_2D::setNormalizedGrid (FaceQuadStruct::Ptr quad) { + if ( !quad->uv_grid.empty() ) + return true; + // Algorithme décrit dans "Génération automatique de maillages" // P.L. GEORGE, MASSON, § 6.4.1 p. 84-85 // traitement dans le domaine paramétrique 2d u,v @@ -1232,82 +1353,133 @@ bool StdMeshers_Quadrangle_2D::setNormalizedGrid (SMESH_Mesh & aMesh, // min max 0 x0 1 // =down // + const FaceQuadStruct::Side & bSide = quad->side[0]; + const FaceQuadStruct::Side & rSide = quad->side[1]; + const FaceQuadStruct::Side & tSide = quad->side[2]; + const FaceQuadStruct::Side & lSide = quad->side[3]; - int nbhoriz = Min(quad->side[0]->NbPoints(), quad->side[2]->NbPoints()); - int nbvertic = Min(quad->side[1]->NbPoints(), quad->side[3]->NbPoints()); - - quad->isEdgeOut[0] = (quad->side[0]->NbPoints() > quad->side[2]->NbPoints()); - quad->isEdgeOut[1] = (quad->side[1]->NbPoints() > quad->side[3]->NbPoints()); - quad->isEdgeOut[2] = (quad->side[2]->NbPoints() > quad->side[0]->NbPoints()); - quad->isEdgeOut[3] = (quad->side[3]->NbPoints() > quad->side[1]->NbPoints()); - - UVPtStruct *uv_grid = quad->uv_grid = new UVPtStruct[nbvertic * nbhoriz]; - - const vector& uv_e0 = getUVPtStructIn(quad, 0, nbhoriz - 1); - const vector& uv_e1 = getUVPtStructIn(quad, 1, nbvertic - 1); - const vector& uv_e2 = getUVPtStructIn(quad, 2, nbhoriz - 1); - const vector& uv_e3 = getUVPtStructIn(quad, 3, nbvertic - 1); + int nbhoriz = Min( bSide.NbPoints(), tSide.NbPoints() ); + int nbvertic = Min( rSide.NbPoints(), lSide.NbPoints() ); + if ( myQuadList.size() == 1 ) + { + // all sub-quads must have NO sides with nbNodeOut > 0 + quad->nbNodeOut(0) = Max( 0, bSide.grid->NbPoints() - tSide.grid->NbPoints() ); + quad->nbNodeOut(1) = Max( 0, rSide.grid->NbPoints() - lSide.grid->NbPoints() ); + quad->nbNodeOut(2) = Max( 0, tSide.grid->NbPoints() - bSide.grid->NbPoints() ); + quad->nbNodeOut(3) = Max( 0, lSide.grid->NbPoints() - rSide.grid->NbPoints() ); + } + const vector& uv_e0 = bSide.GetUVPtStruct(); + const vector& uv_e1 = rSide.GetUVPtStruct(); + const vector& uv_e2 = tSide.GetUVPtStruct(); + const vector& uv_e3 = lSide.GetUVPtStruct(); if (uv_e0.empty() || uv_e1.empty() || uv_e2.empty() || uv_e3.empty()) //return error("Can't find nodes on sides"); return error(COMPERR_BAD_INPUT_MESH); + quad->uv_grid.resize( nbvertic * nbhoriz ); + quad->iSize = nbhoriz; + quad->jSize = nbvertic; + UVPtStruct *uv_grid = & quad->uv_grid[0]; + + quad->uv_box.Clear(); + // copy data of face boundary - { - const int j = 0; - for (int i = 0; i < nbhoriz; i++) // down - uv_grid[ j * nbhoriz + i ] = uv_e0[i]; + + FaceQuadStruct::SideIterator sideIter; + + { // BOTTOM + const int j = 0; + const double x0 = bSide.First().normParam; + const double dx = bSide.Last().normParam - bSide.First().normParam; + for ( sideIter.Init( bSide ); sideIter.More(); sideIter.Next() ) { + sideIter.UVPt().x = ( sideIter.UVPt().normParam - x0 ) / dx; + sideIter.UVPt().y = 0.; + uv_grid[ j * nbhoriz + sideIter.Count() ] = sideIter.UVPt(); + quad->uv_box.Add( sideIter.UVPt().UV() ); + } } - { - const int i = nbhoriz - 1; - for (int j = 0; j < nbvertic; j++) // right - uv_grid[ j * nbhoriz + i ] = uv_e1[j]; + { // RIGHT + const int i = nbhoriz - 1; + const double y0 = rSide.First().normParam; + const double dy = rSide.Last().normParam - rSide.First().normParam; + sideIter.Init( rSide ); + if ( quad->UVPt( i, sideIter.Count() ).node ) + sideIter.Next(); // avoid copying from a split emulated side + for ( ; sideIter.More(); sideIter.Next() ) { + sideIter.UVPt().x = 1.; + sideIter.UVPt().y = ( sideIter.UVPt().normParam - y0 ) / dy; + uv_grid[ sideIter.Count() * nbhoriz + i ] = sideIter.UVPt(); + quad->uv_box.Add( sideIter.UVPt().UV() ); + } } - { - const int j = nbvertic - 1; - for (int i = 0; i < nbhoriz; i++) // up - uv_grid[ j * nbhoriz + i ] = uv_e2[i]; + { // TOP + const int j = nbvertic - 1; + const double x0 = tSide.First().normParam; + const double dx = tSide.Last().normParam - tSide.First().normParam; + int i = 0, nb = nbhoriz; + sideIter.Init( tSide ); + if ( quad->UVPt( nb-1, j ).node ) --nb; // avoid copying from a split emulated side + for ( ; i < nb; i++, sideIter.Next()) { + sideIter.UVPt().x = ( sideIter.UVPt().normParam - x0 ) / dx; + sideIter.UVPt().y = 1.; + uv_grid[ j * nbhoriz + i ] = sideIter.UVPt(); + quad->uv_box.Add( sideIter.UVPt().UV() ); + } } - { + { // LEFT const int i = 0; - for (int j = 0; j < nbvertic; j++) // left - uv_grid[ j * nbhoriz + i ] = uv_e3[j]; + const double y0 = lSide.First().normParam; + const double dy = lSide.Last().normParam - lSide.First().normParam; + int j = 0, nb = nbvertic; + sideIter.Init( lSide ); + if ( quad->UVPt( i, j ).node ) + ++j, sideIter.Next(); // avoid copying from a split emulated side + if ( quad->UVPt( i, nb-1 ).node ) + --nb; + for ( ; j < nb; j++, sideIter.Next()) { + sideIter.UVPt().x = 0.; + sideIter.UVPt().y = ( sideIter.UVPt().normParam - y0 ) / dy; + uv_grid[ j * nbhoriz + i ] = sideIter.UVPt(); + quad->uv_box.Add( sideIter.UVPt().UV() ); + } } // normalized 2d parameters on grid - for (int i = 0; i < nbhoriz; i++) { - for (int j = 0; j < nbvertic; j++) { - int ij = j * nbhoriz + i; - // --- droite i cste : x = x0 + y(x1-x0) - double x0 = uv_e0[i].normParam; // bas - sud - double x1 = uv_e2[i].normParam; // haut - nord - // --- droite j cste : y = y0 + x(y1-y0) - double y0 = uv_e3[j].normParam; // gauche - ouest - double y1 = uv_e1[j].normParam; // droite - est + for (int i = 1; i < nbhoriz-1; i++) + { + const double x0 = quad->UVPt( i, 0 ).x; + const double x1 = quad->UVPt( i, nbvertic-1 ).x; + for (int j = 1; j < nbvertic-1; j++) + { + const double y0 = quad->UVPt( 0, j ).y; + const double y1 = quad->UVPt( nbhoriz-1, j ).y; // --- intersection : x=x0+(y0+x(y1-y0))(x1-x0) double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0)); double y = y0 + x * (y1 - y0); + int ij = j * nbhoriz + i; uv_grid[ij].x = x; uv_grid[ij].y = y; + uv_grid[ij].node = NULL; } } // projection on 2d domain (u,v) - gp_UV a0 (uv_e0.front().u, uv_e0.front().v); - gp_UV a1 (uv_e0.back().u, uv_e0.back().v ); - gp_UV a2 (uv_e2.back().u, uv_e2.back().v ); - gp_UV a3 (uv_e2.front().u, uv_e2.front().v); + gp_UV a0 = quad->UVPt( 0, 0 ).UV(); + gp_UV a1 = quad->UVPt( nbhoriz-1, 0 ).UV(); + gp_UV a2 = quad->UVPt( nbhoriz-1, nbvertic-1 ).UV(); + gp_UV a3 = quad->UVPt( 0, nbvertic-1 ).UV(); - for (int i = 0; i < nbhoriz; i++) + for (int i = 1; i < nbhoriz-1; i++) { - gp_UV p0( uv_e0[i].u, uv_e0[i].v ); - gp_UV p2( uv_e2[i].u, uv_e2[i].v ); - for (int j = 0; j < nbvertic; j++) + gp_UV p0 = quad->UVPt( i, 0 ).UV(); + gp_UV p2 = quad->UVPt( i, nbvertic-1 ).UV(); + for (int j = 1; j < nbvertic-1; j++) { - gp_UV p1( uv_e1[j].u, uv_e1[j].v ); - gp_UV p3( uv_e3[j].u, uv_e3[j].v ); + gp_UV p1 = quad->UVPt( nbhoriz-1, j ).UV(); + gp_UV p3 = quad->UVPt( 0, j ).UV(); int ij = j * nbhoriz + i; double x = uv_grid[ij].x; @@ -1327,31 +1499,55 @@ bool StdMeshers_Quadrangle_2D::setNormalizedGrid (SMESH_Mesh & aMesh, //purpose : auxilary function for computeQuadPref //======================================================================= -static void shiftQuad(FaceQuadStruct::Ptr& quad, const int num) +void StdMeshers_Quadrangle_2D::shiftQuad(FaceQuadStruct::Ptr& quad, const int num ) { - quad->shift( num, /*ori=*/true ); + quad->shift( num, /*ori=*/true, /*keepGrid=*/myQuadList.size() > 1 ); } //================================================================================ /*! - * \brief Rotate sides of a quad by nb + * \brief Rotate sides of a quad by given nb of quartes * \param nb - number of rotation quartes * \param ori - to keep orientation of sides as in an unit quad or not + * \param keepGrid - if \c true Side::grid is not changed, Side::from and Side::to + * are altered instead */ //================================================================================ -void FaceQuadStruct::shift( size_t nb, bool ori ) +void FaceQuadStruct::shift( size_t nb, bool ori, bool keepGrid ) { if ( nb == 0 ) return; - StdMeshers_FaceSide* sideArr[4] = { side[0], side[1], side[2], side[3] }; - for (int i = QUAD_BOTTOM_SIDE; i < NB_QUAD_SIDES; ++i) { + + vector< Side > newSides( side.size() ); + vector< Side* > sidePtrs( side.size() ); + for (int i = QUAD_BOTTOM_SIDE; i < NB_QUAD_SIDES; ++i) + { int id = (i + nb) % NB_QUAD_SIDES; - bool wasForward = (i < QUAD_TOP_SIDE); - bool newForward = (id < QUAD_TOP_SIDE); - if (ori && wasForward != newForward) - sideArr[ i ]->Reverse(); - side[ id ] = sideArr[ i ]; + if ( ori ) + { + bool wasForward = (i < QUAD_TOP_SIDE); + bool newForward = (id < QUAD_TOP_SIDE); + if ( wasForward != newForward ) + side[ i ].Reverse( keepGrid ); + } + newSides[ id ] = side[ i ]; + sidePtrs[ i ] = & side[ i ]; + } + // make newSides refer newSides via Side::Contact's + for ( size_t i = 0; i < newSides.size(); ++i ) + { + FaceQuadStruct::Side& ns = newSides[ i ]; + for ( size_t iC = 0; iC < ns.contacts.size(); ++iC ) + { + FaceQuadStruct::Side* oSide = ns.contacts[iC].other_side; + vector< Side* >::iterator sIt = std::find( sidePtrs.begin(), sidePtrs.end(), oSide ); + if ( sIt != sidePtrs.end() ) + ns.contacts[iC].other_side = & newSides[ *sIt - sidePtrs[0] ]; + } } + newSides.swap( side ); + + uv_grid.clear(); } //======================================================================= @@ -1367,10 +1563,10 @@ static gp_UV calcUV(double x0, double x1, double y0, double y1, double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0)); double y = y0 + x * (y1 - y0); - gp_UV p0 = quad->side[QUAD_BOTTOM_SIDE]->Value2d(x).XY(); - gp_UV p1 = quad->side[QUAD_RIGHT_SIDE ]->Value2d(y).XY(); - gp_UV p2 = quad->side[QUAD_TOP_SIDE ]->Value2d(x).XY(); - gp_UV p3 = quad->side[QUAD_LEFT_SIDE ]->Value2d(y).XY(); + gp_UV p0 = quad->side[QUAD_BOTTOM_SIDE].grid->Value2d(x).XY(); + gp_UV p1 = quad->side[QUAD_RIGHT_SIDE ].grid->Value2d(y).XY(); + gp_UV p2 = quad->side[QUAD_TOP_SIDE ].grid->Value2d(x).XY(); + gp_UV p3 = quad->side[QUAD_LEFT_SIDE ].grid->Value2d(y).XY(); gp_UV uv = calcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3); @@ -1387,10 +1583,10 @@ static gp_UV calcUV2(double x, double y, const gp_UV& a0, const gp_UV& a1, const gp_UV& a2, const gp_UV& a3) { - gp_UV p0 = quad->side[QUAD_BOTTOM_SIDE]->Value2d(x).XY(); - gp_UV p1 = quad->side[QUAD_RIGHT_SIDE ]->Value2d(y).XY(); - gp_UV p2 = quad->side[QUAD_TOP_SIDE ]->Value2d(x).XY(); - gp_UV p3 = quad->side[QUAD_LEFT_SIDE ]->Value2d(y).XY(); + gp_UV p0 = quad->side[QUAD_BOTTOM_SIDE].grid->Value2d(x).XY(); + gp_UV p1 = quad->side[QUAD_RIGHT_SIDE ].grid->Value2d(y).XY(); + gp_UV p2 = quad->side[QUAD_TOP_SIDE ].grid->Value2d(x).XY(); + gp_UV p3 = quad->side[QUAD_LEFT_SIDE ].grid->Value2d(y).XY(); gp_UV uv = calcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3); @@ -1408,34 +1604,44 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, const TopoDS_Face& aFace, FaceQuadStruct::Ptr quad) { - // Auxilary key in order to keep old variant - // of meshing after implementation new variant - // for bug 0016220 from Mantis. - bool OldVersion = (myQuadType == QUAD_QUADRANGLE_PREF_REVERSED); + const bool OldVersion = (myQuadType == QUAD_QUADRANGLE_PREF_REVERSED); + const bool WisF = true; SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); Handle(Geom_Surface) S = BRep_Tool::Surface(aFace); - bool WisF = true; - int i,j,geomFaceID = meshDS->ShapeToIndex(aFace); + int i,j, geomFaceID = meshDS->ShapeToIndex(aFace); - int nb = quad->side[0]->NbPoints(); - int nr = quad->side[1]->NbPoints(); - int nt = quad->side[2]->NbPoints(); - int nl = quad->side[3]->NbPoints(); + int nb = quad->side[0].NbPoints(); + int nr = quad->side[1].NbPoints(); + int nt = quad->side[2].NbPoints(); + int nl = quad->side[3].NbPoints(); int dh = abs(nb-nt); int dv = abs(nr-nl); - // rotate sides to be as in the picture below and to have - // dh >= dv and nt > nb - if ( dh >= dv ) - shiftQuad( quad, ( nt > nb ) ? 0 : 2 ); + if ( myForcedPnts.empty() ) + { + // rotate sides to be as in the picture below and to have + // dh >= dv and nt > nb + if ( dh >= dv ) + shiftQuad( quad, ( nt > nb ) ? 0 : 2 ); + else + shiftQuad( quad, ( nr > nl ) ? 1 : 3 ); + } else - shiftQuad( quad, ( nr > nl ) ? 1 : 3 ); + { + // rotate the quad to have nt > nb [and nr > nl] + if ( nb > nt ) + shiftQuad ( quad, nr > nl ? 1 : 2 ); + else if ( nr > nl ) + shiftQuad( quad, nb == nt ? 1 : 0 ); + else if ( nl > nr ) + shiftQuad( quad, 3 ); + } - nb = quad->side[0]->NbPoints(); - nr = quad->side[1]->NbPoints(); - nt = quad->side[2]->NbPoints(); - nl = quad->side[3]->NbPoints(); + nb = quad->side[0].NbPoints(); + nr = quad->side[1].NbPoints(); + nt = quad->side[2].NbPoints(); + nl = quad->side[3].NbPoints(); dh = abs(nb-nt); dv = abs(nr-nl); int nbh = Max(nb,nt); @@ -1470,6 +1676,326 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, // 0------------0 // 0 bottom 1 + + const int bfrom = quad->side[0].from; + const int rfrom = quad->side[1].from; + const int tfrom = quad->side[2].from; + const int lfrom = quad->side[3].from; + { + const vector& uv_eb_vec = quad->side[0].GetUVPtStruct(true,0); + const vector& uv_er_vec = quad->side[1].GetUVPtStruct(false,1); + const vector& uv_et_vec = quad->side[2].GetUVPtStruct(true,1); + const vector& uv_el_vec = quad->side[3].GetUVPtStruct(false,0); + if (uv_eb_vec.empty() || + uv_er_vec.empty() || + uv_et_vec.empty() || + uv_el_vec.empty()) + return error(COMPERR_BAD_INPUT_MESH); + } + FaceQuadStruct::SideIterator uv_eb, uv_er, uv_et, uv_el; + uv_eb.Init( quad->side[0] ); + uv_er.Init( quad->side[1] ); + uv_et.Init( quad->side[2] ); + uv_el.Init( quad->side[3] ); + + gp_UV a0,a1,a2,a3, p0,p1,p2,p3, uv; + double x,y; + + a0 = uv_eb[ 0 ].UV(); + a1 = uv_er[ 0 ].UV(); + a2 = uv_er[ nr-1 ].UV(); + a3 = uv_et[ 0 ].UV(); + + if ( !myForcedPnts.empty() ) + { + if ( dv != 0 && dh != 0 ) // here myQuadList.size() == 1 + { + const int dmin = Min( dv, dh ); + + // Make a side separating domains L and Cb + StdMeshers_FaceSidePtr sideLCb; + UVPtStruct p3dom; // a point where 3 domains meat + { // dmin + vector pointsLCb( dmin+1 ); // 1--------1 + pointsLCb[0] = uv_eb[0]; // | | | + for ( int i = 1; i <= dmin; ++i ) // | |Ct| + { // | L | | + x = uv_et[ i ].normParam; // | |__| + y = uv_er[ i ].normParam; // | / | + p0 = quad->side[0].grid->Value2d( x ).XY(); // | / Cb |dmin + p1 = uv_er[ i ].UV(); // |/ | + p2 = uv_et[ i ].UV(); // 0--------0 + p3 = quad->side[3].grid->Value2d( y ).XY(); + uv = calcUV( x,y, a0,a1,a2,a3, p0,p1,p2,p3 ); + pointsLCb[ i ].u = uv.X(); + pointsLCb[ i ].v = uv.Y(); + } + sideLCb = StdMeshers_FaceSide::New( pointsLCb, aFace ); + p3dom = pointsLCb.back(); + } + // Make a side separating domains L and Ct + StdMeshers_FaceSidePtr sideLCt; + { + vector pointsLCt( nl ); + pointsLCt[0] = p3dom; + pointsLCt.back() = uv_et[ dmin ]; + x = uv_et[ dmin ].normParam; + p0 = quad->side[0].grid->Value2d( x ).XY(); + p2 = uv_et[ dmin ].UV(); + double y0 = uv_er[ dmin ].normParam; + for ( int i = 1; i < nl-1; ++i ) + { + y = y0 + i / ( nl-1. ) * ( 1. - y0 ); + p1 = quad->side[1].grid->Value2d( y ).XY(); + p3 = quad->side[3].grid->Value2d( y ).XY(); + uv = calcUV( x,y, a0,a1,a2,a3, p0,p1,p2,p3 ); + pointsLCt[ i ].u = uv.X(); + pointsLCt[ i ].v = uv.Y(); + } + sideLCt = StdMeshers_FaceSide::New( pointsLCt, aFace ); + } + // Make a side separating domains Cb and Ct + StdMeshers_FaceSidePtr sideCbCt; + { + vector pointsCbCt( nb ); + pointsCbCt[0] = p3dom; + pointsCbCt.back() = uv_er[ dmin ]; + y = uv_er[ dmin ].normParam; + p1 = uv_er[ dmin ].UV(); + p3 = quad->side[3].grid->Value2d( y ).XY(); + double x0 = uv_et[ dmin ].normParam; + for ( int i = 1; i < nb-1; ++i ) + { + x = x0 + i / ( nb-1. ) * ( 1. - x0 ); + p2 = quad->side[2].grid->Value2d( x ).XY(); + p0 = quad->side[0].grid->Value2d( x ).XY(); + uv = calcUV( x,y, a0,a1,a2,a3, p0,p1,p2,p3 ); + pointsCbCt[ i ].u = uv.X(); + pointsCbCt[ i ].v = uv.Y(); + } + sideCbCt = StdMeshers_FaceSide::New( pointsCbCt, aFace ); + } + // Make Cb quad + FaceQuadStruct* qCb = new FaceQuadStruct( quad->face, "Cb" ); + myQuadList.push_back( FaceQuadStruct::Ptr( qCb )); + qCb->side.resize(4); + qCb->side[0] = quad->side[0]; + qCb->side[1] = quad->side[1]; + qCb->side[2] = sideCbCt; + qCb->side[3] = sideLCb; + qCb->side[1].to = dmin+1; + // Make L quad + FaceQuadStruct* qL = new FaceQuadStruct( quad->face, "L" ); + myQuadList.push_back( FaceQuadStruct::Ptr( qL )); + qL->side.resize(4); + qL->side[0] = sideLCb; + qL->side[1] = sideLCt; + qL->side[2] = quad->side[2]; + qL->side[3] = quad->side[3]; + qL->side[2].to = dmin+1; + // Make Ct from the main quad + FaceQuadStruct::Ptr qCt = quad; + qCt->side[0] = sideCbCt; + qCt->side[3] = sideLCt; + qCt->side[1].from = dmin; + qCt->side[2].from = dmin; + qCt->uv_grid.clear(); + qCt->name = "Ct"; + + // Connect sides + qCb->side[3].AddContact( dmin, & qCb->side[2], 0 ); + qCb->side[3].AddContact( dmin, & qCt->side[3], 0 ); + qCt->side[3].AddContact( 0, & qCt->side[0], 0 ); + qCt->side[0].AddContact( 0, & qL ->side[0], dmin ); + qL ->side[0].AddContact( dmin, & qL ->side[1], 0 ); + qL ->side[0].AddContact( dmin, & qCb->side[2], 0 ); + + if ( dh == dv ) + return computeQuadDominant( aMesh, aFace ); + else + return computeQuadPref( aMesh, aFace, qCt ); + + } // if ( dv != 0 && dh != 0 ) + + const int db = quad->side[0].IsReversed() ? -1 : +1; + const int dr = quad->side[1].IsReversed() ? -1 : +1; + const int dt = quad->side[2].IsReversed() ? -1 : +1; + const int dl = quad->side[3].IsReversed() ? -1 : +1; + + // Case dv == 0, here possibly myQuadList.size() > 1 + // + // lw nb lw = dh/2 + // +------------+ + // | | | | + // | | Ct | | + // | L | | R | + // | |____| | + // | / \ | + // | / Cb \ | + // |/ \| + // +------------+ + const int lw = dh/2; // lateral width + + double yCbL, yCbR; + { + double lL = quad->side[3].Length(); + double lLwL = quad->side[2].Length( tfrom, + tfrom + ( lw ) * dt ); + yCbL = lLwL / ( lLwL + lL ); + + double lR = quad->side[1].Length(); + double lLwR = quad->side[2].Length( tfrom + ( lw + nb-1 ) * dt, + tfrom + ( lw + nb-1 + lw ) * dt); + yCbR = lLwR / ( lLwR + lR ); + } + // Make sides separating domains Cb and L and R + StdMeshers_FaceSidePtr sideLCb, sideRCb; + UVPtStruct pTBL, pTBR; // points where 3 domains meat + { + vector pointsLCb( lw+1 ), pointsRCb( lw+1 ); + pointsLCb[0] = uv_eb[ 0 ]; + pointsRCb[0] = uv_eb[ nb-1 ]; + for ( int i = 1, i2 = nt-2; i <= lw; ++i, --i2 ) + { + x = quad->side[2].Param( i ); + y = yCbL * i / lw; + p0 = quad->side[0].Value2d( x ); + p1 = quad->side[1].Value2d( y ); + p2 = uv_et[ i ].UV(); + p3 = quad->side[3].Value2d( y ); + uv = calcUV( x,y, a0,a1,a2,a3, p0,p1,p2,p3 ); + pointsLCb[ i ].u = uv.X(); + pointsLCb[ i ].v = uv.Y(); + pointsLCb[ i ].x = x; + + x = quad->side[2].Param( i2 ); + y = yCbR * i / lw; + p1 = quad->side[1].Value2d( y ); + p0 = quad->side[0].Value2d( x ); + p2 = uv_et[ i2 ].UV(); + p3 = quad->side[3].Value2d( y ); + uv = calcUV( x,y, a0,a1,a2,a3, p0,p1,p2,p3 ); + pointsRCb[ i ].u = uv.X(); + pointsRCb[ i ].v = uv.Y(); + pointsRCb[ i ].x = x; + } + sideLCb = StdMeshers_FaceSide::New( pointsLCb, aFace ); + sideRCb = StdMeshers_FaceSide::New( pointsRCb, aFace ); + pTBL = pointsLCb.back(); + pTBR = pointsRCb.back(); + } + // Make sides separating domains Ct and L and R + StdMeshers_FaceSidePtr sideLCt, sideRCt; + { + vector pointsLCt( nl ), pointsRCt( nl ); + pointsLCt[0] = pTBL; + pointsLCt.back() = uv_et[ lw ]; + pointsRCt[0] = pTBR; + pointsRCt.back() = uv_et[ lw + nb - 1 ]; + x = pTBL.x; + p0 = quad->side[0].Value2d( x ); + p2 = uv_et[ lw ].UV(); + int iR = lw + nb - 1; + double xR = pTBR.x; + gp_UV p0R = quad->side[0].Value2d( xR ); + gp_UV p2R = uv_et[ iR ].UV(); + for ( int i = 1; i < nl-1; ++i ) + { + y = yCbL + ( 1. - yCbL ) * i / (nl-1.); + p1 = quad->side[1].Value2d( y ); + p3 = quad->side[3].Value2d( y ); + uv = calcUV( x,y, a0,a1,a2,a3, p0,p1,p2,p3 ); + pointsLCt[ i ].u = uv.X(); + pointsLCt[ i ].v = uv.Y(); + + y = yCbR + ( 1. - yCbR ) * i / (nl-1.); + p1 = quad->side[1].Value2d( y ); + p3 = quad->side[3].Value2d( y ); + uv = calcUV( xR,y, a0,a1,a2,a3, p0R,p1,p2R,p3 ); + pointsRCt[ i ].u = uv.X(); + pointsRCt[ i ].v = uv.Y(); + } + sideLCt = StdMeshers_FaceSide::New( pointsLCt, aFace ); + sideRCt = StdMeshers_FaceSide::New( pointsRCt, aFace ); + } + // Make a side separating domains Cb and Ct + StdMeshers_FaceSidePtr sideCbCt; + { + vector pointsCbCt( nb ); + pointsCbCt[0] = pTBL; + pointsCbCt.back() = pTBR; + p1 = quad->side[1].Value2d( yCbR ); + p3 = quad->side[3].Value2d( yCbL ); + for ( int i = 1; i < nb-1; ++i ) + { + x = quad->side[2].Param( i + lw ); + y = yCbL + ( yCbR - yCbL ) * i / (nb-1.); + p2 = uv_et[ i + lw ].UV(); + p0 = quad->side[0].Value2d( x ); + uv = calcUV( x,y, a0,a1,a2,a3, p0,p1,p2,p3 ); + pointsCbCt[ i ].u = uv.X(); + pointsCbCt[ i ].v = uv.Y(); + } + sideCbCt = StdMeshers_FaceSide::New( pointsCbCt, aFace ); + } + // Make Cb quad + FaceQuadStruct* qCb = new FaceQuadStruct( quad->face, "Cb" ); + myQuadList.push_back( FaceQuadStruct::Ptr( qCb )); + qCb->side.resize(4); + qCb->side[0] = quad->side[0]; + qCb->side[1] = sideRCb; + qCb->side[2] = sideCbCt; + qCb->side[3] = sideLCb; + // Make L quad + FaceQuadStruct* qL = new FaceQuadStruct( quad->face, "L" ); + myQuadList.push_back( FaceQuadStruct::Ptr( qL )); + qL->side.resize(4); + qL->side[0] = sideLCb; + qL->side[1] = sideLCt; + qL->side[2] = quad->side[2]; + qL->side[3] = quad->side[3]; + qL->side[2].to = ( lw + 1 ) * dt + tfrom; + // Make R quad + FaceQuadStruct* qR = new FaceQuadStruct( quad->face, "R" ); + myQuadList.push_back( FaceQuadStruct::Ptr( qR )); + qR->side.resize(4); + qR->side[0] = sideRCb; + qR->side[0].from = lw; + qR->side[0].to = -1; + qR->side[0].di = -1; + qR->side[1] = quad->side[1]; + qR->side[2] = quad->side[2]; + qR->side[2].from = ( lw + nb-1 ) * dt + tfrom; + qR->side[3] = sideRCt; + // Make Ct from the main quad + FaceQuadStruct::Ptr qCt = quad; + qCt->side[0] = sideCbCt; + qCt->side[1] = sideRCt; + qCt->side[2].from = ( lw ) * dt + tfrom; + qCt->side[2].to = ( lw + nb ) * dt + tfrom; + qCt->side[3] = sideLCt; + qCt->uv_grid.clear(); + qCt->name = "Ct"; + + // Connect sides + qCb->side[3].AddContact( lw, & qCb->side[2], 0 ); + qCb->side[3].AddContact( lw, & qCt->side[3], 0 ); + qCt->side[3].AddContact( 0, & qCt->side[0], 0 ); + qCt->side[0].AddContact( 0, & qL ->side[0], lw ); + qL ->side[0].AddContact( lw, & qL ->side[1], 0 ); + qL ->side[0].AddContact( lw, & qCb->side[2], 0 ); + // + qCb->side[1].AddContact( lw, & qCb->side[2], nb-1 ); + qCb->side[1].AddContact( lw, & qCt->side[1], 0 ); + qCt->side[0].AddContact( nb-1, & qCt->side[1], 0 ); + qCt->side[0].AddContact( nb-1, & qR ->side[0], lw ); + qR ->side[3].AddContact( 0, & qR ->side[0], lw ); + qR ->side[3].AddContact( 0, & qCb->side[2], nb-1 ); + + return computeQuadDominant( aMesh, aFace ); + + } // if ( !myForcedPnts.empty() ) + if ( dh > dv ) { addv = (dh-dv)/2; nbv = nbv + addv; @@ -1479,19 +2005,6 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, nbh = nbh + addh; } - const vector& uv_eb = quad->side[0]->GetUVPtStruct(true,0); - const vector& uv_er = quad->side[1]->GetUVPtStruct(false,1); - const vector& uv_et = quad->side[2]->GetUVPtStruct(true,1); - const vector& uv_el = quad->side[3]->GetUVPtStruct(false,0); - - if (uv_eb.size() != nb || uv_er.size() != nr || uv_et.size() != nt || uv_el.size() != nl) - return error(COMPERR_BAD_INPUT_MESH); - - if ( !OldVersion ) - { - // dh/2, Min(nb,nt), dh - dh/2, dv - } - // arrays for normalized params TColStd_SequenceOfReal npb, npr, npt, npl; for (i=0; i0) { // add top nodes - for (i=1; i<=dl; i++) + for (i=1; i<=dl; i++) NodesL.SetValue(i+1,nl,uv_et[i].node); // create and add needed nodes TColgp_SequenceOfXY UVtmp; @@ -1580,13 +2088,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, if (WisF) { SMDS_MeshFace* F = myHelper->AddFace(NodesL.Value(i,j), NodesL.Value(i+1,j), - NodesL.Value(i+1,j+1), NodesL.Value(i,j+1)); - if (F) meshDS->SetMeshElementOnShape(F, geomFaceID); - } - else { - SMDS_MeshFace* F = - myHelper->AddFace(NodesL.Value(i,j), NodesL.Value(i,j+1), - NodesL.Value(i+1,j+1), NodesL.Value(i+1,j)); + NodesL.Value(i+1,j+1), NodesL.Value(i,j+1)); if (F) meshDS->SetMeshElementOnShape(F, geomFaceID); } } @@ -1598,15 +2100,15 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, UVL.Append(gp_UV (uv_el[i].u, uv_el[i].v)); } } - + // step2: create faces for right domain StdMeshers_Array2OfNode NodesR(1,dr+1,1,nr); // add right nodes - for (j=1; j<=nr; j++) + for (j=1; j<=nr; j++) NodesR.SetValue(1,j,uv_er[nr-j].node); if (dr>0) { // add top nodes - for (i=1; i<=dr; i++) + for (i=1; i<=dr; i++) NodesR.SetValue(i+1,1,uv_et[nt-1-i].node); // create and add needed nodes TColgp_SequenceOfXY UVtmp; @@ -1643,13 +2145,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, if (WisF) { SMDS_MeshFace* F = myHelper->AddFace(NodesR.Value(i,j), NodesR.Value(i+1,j), - NodesR.Value(i+1,j+1), NodesR.Value(i,j+1)); - if (F) meshDS->SetMeshElementOnShape(F, geomFaceID); - } - else { - SMDS_MeshFace* F = - myHelper->AddFace(NodesR.Value(i,j), NodesR.Value(i,j+1), - NodesR.Value(i+1,j+1), NodesR.Value(i+1,j)); + NodesR.Value(i+1,j+1), NodesR.Value(i,j+1)); if (F) meshDS->SetMeshElementOnShape(F, geomFaceID); } } @@ -1661,7 +2157,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, UVR.Append(gp_UV(uv_er[i].u, uv_er[i].v)); } } - + // step3: create faces for central domain StdMeshers_Array2OfNode NodesC(1,nb,1,nbv); // add first line using NodesL @@ -1675,12 +2171,12 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, for (i=1; iAddFace(NodesC.Value(i,j), NodesC.Value(i+1,j), - NodesC.Value(i+1,j+1), NodesC.Value(i,j+1)); - if (F) meshDS->SetMeshElementOnShape(F, geomFaceID); - } - else { - SMDS_MeshFace* F = - myHelper->AddFace(NodesC.Value(i,j), NodesC.Value(i,j+1), - NodesC.Value(i+1,j+1), NodesC.Value(i+1,j)); + NodesC.Value(i+1,j+1), NodesC.Value(i,j+1)); if (F) meshDS->SetMeshElementOnShape(F, geomFaceID); } } @@ -1760,13 +2250,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, if (WisF) { SMDS_MeshFace* F = myHelper->AddFace(NodesBRD.Value(i,j), NodesBRD.Value(i+1,j), - NodesBRD.Value(i+1,j+1), NodesBRD.Value(i,j+1)); - if (F) meshDS->SetMeshElementOnShape(F, geomFaceID); - } - else { - SMDS_MeshFace* F = - myHelper->AddFace(NodesBRD.Value(i,j), NodesBRD.Value(i,j+1), - NodesBRD.Value(i+1,j+1), NodesBRD.Value(i+1,j)); + NodesBRD.Value(i+1,j+1), NodesBRD.Value(i,j+1)); if (F) meshDS->SetMeshElementOnShape(F, geomFaceID); } } @@ -1812,7 +2296,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, double yy1 = y1 + dy1*i; double dyy = yy1 - yy0; for (j=1; j<=nb; j++) { - double x = npt.Value(i+1+drl) + + double x = npt.Value(i+1+drl) + npb.Value(j) * (npt.Value(nt-i) - npt.Value(i+1+drl)); double y = yy0 + dyy*x; gp_UV UV = calcUV2(x, y, quad, a0, a1, a2, a3); @@ -1855,7 +2339,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, double yy1 = y1 + dy1*i; double dyy = yy1 - yy0; for (j=1; j<=nb; j++) { - double x = npt.Value(i+1) + + double x = npt.Value(i+1) + npb.Value(j) * (npt.Value(nt-i-drl) - npt.Value(i+1)); double y = yy0 + dyy*x; gp_UV UV = calcUV2(x, y, quad, a0, a1, a2, a3); @@ -1872,13 +2356,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, if (WisF) { SMDS_MeshFace* F = myHelper->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j), - NodesC.Value(i+1,j+1), NodesC.Value(i,j+1)); - if (F) meshDS->SetMeshElementOnShape(F, geomFaceID); - } - else { - SMDS_MeshFace* F = - myHelper->AddFace(NodesC.Value(i,j), NodesC.Value(i,j+1), - NodesC.Value(i+1,j+1), NodesC.Value(i+1,j)); + NodesC.Value(i+1,j+1), NodesC.Value(i,j+1)); if (F) meshDS->SetMeshElementOnShape(F, geomFaceID); } } @@ -1905,13 +2383,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, if (WisF) { SMDS_MeshFace* F = myHelper->AddFace(NodesLast.Value(i,1), NodesLast.Value(i+1,1), - NodesLast.Value(i+1,2), NodesLast.Value(i,2)); - if (F) meshDS->SetMeshElementOnShape(F, geomFaceID); - } - else { - SMDS_MeshFace* F = - myHelper->AddFace(NodesLast.Value(i,1), NodesLast.Value(i,2), - NodesLast.Value(i+1,2), NodesLast.Value(i+1,2)); + NodesLast.Value(i+1,2), NodesLast.Value(i,2)); if (F) meshDS->SetMeshElementOnShape(F, geomFaceID); } } @@ -2064,12 +2536,12 @@ bool StdMeshers_Quadrangle_2D::evaluateQuadPref(SMESH_Mesh & aMesh, */ //============================================================================= -void StdMeshers_Quadrangle_2D::splitQuad(SMESHDS_Mesh * theMeshDS, - int theFaceID, - const SMDS_MeshNode* theNode1, - const SMDS_MeshNode* theNode2, - const SMDS_MeshNode* theNode3, - const SMDS_MeshNode* theNode4) +void StdMeshers_Quadrangle_2D::splitQuadFace(SMESHDS_Mesh * theMeshDS, + int theFaceID, + const SMDS_MeshNode* theNode1, + const SMDS_MeshNode* theNode2, + const SMDS_MeshNode* theNode3, + const SMDS_MeshNode* theNode4) { SMDS_MeshFace* face; if ( SMESH_TNodeXYZ( theNode1 ).SquareDistance( theNode3 ) > @@ -2100,8 +2572,8 @@ namespace SMESH_MesherHelper* helper, Handle(Geom_Surface) S) { - const vector& uv_eb = quad->side[QUAD_BOTTOM_SIDE]->GetUVPtStruct(); - const vector& uv_et = quad->side[QUAD_TOP_SIDE ]->GetUVPtStruct(); + const vector& uv_eb = quad->side[QUAD_BOTTOM_SIDE].GetUVPtStruct(); + const vector& uv_et = quad->side[QUAD_TOP_SIDE ].GetUVPtStruct(); double rBot = ( uv_eb.size() - 1 ) * uvPt.normParam; double rTop = ( uv_et.size() - 1 ) * uvPt.normParam; int iBot = int( rBot ); @@ -2112,9 +2584,9 @@ namespace gp_UV uv = calcUV(/*x,y=*/x, y, /*a0,...=*/UVs[UV_A0], UVs[UV_A1], UVs[UV_A2], UVs[UV_A3], - /*p0=*/quad->side[QUAD_BOTTOM_SIDE]->Value2d( x ).XY(), + /*p0=*/quad->side[QUAD_BOTTOM_SIDE].grid->Value2d( x ).XY(), /*p1=*/UVs[ UV_R ], - /*p2=*/quad->side[QUAD_TOP_SIDE ]->Value2d( x ).XY(), + /*p2=*/quad->side[QUAD_TOP_SIDE ].grid->Value2d( x ).XY(), /*p3=*/UVs[ UV_L ]); gp_Pnt P = S->Value( uv.X(), uv.Y() ); uvPt.u = uv.X(); @@ -2280,10 +2752,10 @@ bool StdMeshers_Quadrangle_2D::computeReduced (SMESH_Mesh & aMesh, Handle(Geom_Surface) S = BRep_Tool::Surface(aFace); int i,j,geomFaceID = meshDS->ShapeToIndex(aFace); - int nb = quad->side[0]->NbPoints(); // bottom - int nr = quad->side[1]->NbPoints(); // right - int nt = quad->side[2]->NbPoints(); // top - int nl = quad->side[3]->NbPoints(); // left + int nb = quad->side[0].NbPoints(); // bottom + int nr = quad->side[1].NbPoints(); // right + int nt = quad->side[2].NbPoints(); // top + int nl = quad->side[3].NbPoints(); // left // Simple Reduce 10->8->6->4 (3 steps) Multiple Reduce 10->4 (1 step) // @@ -2372,10 +2844,10 @@ bool StdMeshers_Quadrangle_2D::computeReduced (SMESH_Mesh & aMesh, } } - nb = quad->side[0]->NbPoints(); - nr = quad->side[1]->NbPoints(); - nt = quad->side[2]->NbPoints(); - nl = quad->side[3]->NbPoints(); + nb = quad->side[0].NbPoints(); + nr = quad->side[1].NbPoints(); + nt = quad->side[2].NbPoints(); + nl = quad->side[3].NbPoints(); dh = abs(nb-nt); dv = abs(nr-nl); int nbh = Max(nb,nt); @@ -2392,10 +2864,10 @@ bool StdMeshers_Quadrangle_2D::computeReduced (SMESH_Mesh & aMesh, nbh = nbh + addh; } - const vector& uv_eb = quad->side[0]->GetUVPtStruct(true,0); - const vector& uv_er = quad->side[1]->GetUVPtStruct(false,1); - const vector& uv_et = quad->side[2]->GetUVPtStruct(true,1); - const vector& uv_el = quad->side[3]->GetUVPtStruct(false,0); + const vector& uv_eb = quad->side[0].GetUVPtStruct(true,0); + const vector& uv_er = quad->side[1].GetUVPtStruct(false,1); + const vector& uv_et = quad->side[2].GetUVPtStruct(true,1); + const vector& uv_el = quad->side[3].GetUVPtStruct(false,0); if (uv_eb.size() != nb || uv_er.size() != nr || uv_et.size() != nt || uv_el.size() != nl) return error(COMPERR_BAD_INPUT_MESH); @@ -2646,10 +3118,10 @@ bool StdMeshers_Quadrangle_2D::computeReduced (SMESH_Mesh & aMesh, } } - nb = quad->side[0]->NbPoints(); - nr = quad->side[1]->NbPoints(); - nt = quad->side[2]->NbPoints(); - nl = quad->side[3]->NbPoints(); + nb = quad->side[0].NbPoints(); + nr = quad->side[1].NbPoints(); + nt = quad->side[2].NbPoints(); + nl = quad->side[3].NbPoints(); // number of rows and columns int nrows = nr - 1; // and also == nl - 1 @@ -2711,10 +3183,10 @@ bool StdMeshers_Quadrangle_2D::computeReduced (SMESH_Mesh & aMesh, } } - const vector& uv_eb = quad->side[0]->GetUVPtStruct(true,0); - const vector& uv_er = quad->side[1]->GetUVPtStruct(false,1); - const vector& uv_et = quad->side[2]->GetUVPtStruct(true,1); - const vector& uv_el = quad->side[3]->GetUVPtStruct(false,0); + const vector& uv_eb = quad->side[0].GetUVPtStruct(true,0); + const vector& uv_er = quad->side[1].GetUVPtStruct(false,1); + const vector& uv_et = quad->side[2].GetUVPtStruct(true,1); + const vector& uv_el = quad->side[3].GetUVPtStruct(false,0); if (uv_eb.size() != nb || uv_er.size() != nr || uv_et.size() != nt || uv_el.size() != nl) return error(COMPERR_BAD_INPUT_MESH); @@ -3216,6 +3688,18 @@ namespace // data for smoothing double d = v1 ^ v2; return d > 1e-100; } + //================================================================================ + /*! + * \brief Returns area of a triangle + */ + //================================================================================ + + double getArea( const gp_UV uv1, const gp_UV uv2, const gp_UV uv3 ) + { + gp_XY v1 = uv1 - uv2, v2 = uv3 - uv2; + double a = v2 ^ v1; + return a; + } } //================================================================================ @@ -3234,8 +3718,7 @@ void StdMeshers_Quadrangle_2D::updateDegenUV(FaceQuadStruct::Ptr quad) // -------------------------------------------------------------------------- for ( unsigned i = 0; i < quad->side.size(); ++i ) { - StdMeshers_FaceSide* side = quad->side[i]; - const vector& uvVec = side->GetUVPtStruct(); + const vector& uvVec = quad->side[i].GetUVPtStruct(); // find which end of the side is on degenerated shape int degenInd = -1; @@ -3251,10 +3734,9 @@ void StdMeshers_Quadrangle_2D::updateDegenUV(FaceQuadStruct::Ptr quad) if ( i >= QUAD_TOP_SIDE ) isPrev = !isPrev; int i2 = ( isPrev ? ( i + 3 ) : ( i + 1 )) % 4; - StdMeshers_FaceSide* side2 = quad->side[ i2 ]; - const vector& uvVec2 = side2->GetUVPtStruct(); + const vector& uvVec2 = quad->side[ i2 ].GetUVPtStruct(); int degenInd2 = -1; - if ( uvVec[ degenInd ].node == uvVec2[0].node ) + if ( uvVec[ degenInd ].node == uvVec2.front().node ) degenInd2 = 0; else if ( uvVec[ degenInd ].node == uvVec2.back().node ) degenInd2 = uvVec2.size() - 1; @@ -3274,10 +3756,10 @@ void StdMeshers_Quadrangle_2D::updateDegenUV(FaceQuadStruct::Ptr quad) // ---------------------------------------------------------------------------- for ( unsigned i = 0; i < quad->side.size(); ++i ) { - StdMeshers_FaceSide* degSide = quad->side[i]; + StdMeshers_FaceSidePtr degSide = quad->side[i]; if ( !myHelper->IsDegenShape( degSide->EdgeID(0) )) continue; - StdMeshers_FaceSide* oppSide = quad->side[( i+2 ) % quad->side.size() ]; + StdMeshers_FaceSidePtr oppSide = quad->side[( i+2 ) % quad->side.size() ]; if ( degSide->NbSegments() == oppSide->NbSegments() ) continue; @@ -3286,11 +3768,10 @@ void StdMeshers_Quadrangle_2D::updateDegenUV(FaceQuadStruct::Ptr quad) const SMDS_MeshNode* n = uvVecDegOld[0].node; Handle(Geom2d_Curve) c2d = degSide->Curve2d(0); double f = degSide->FirstU(0), l = degSide->LastU(0); - gp_Pnt2d p1( uvVecDegOld.front().u, uvVecDegOld.front().v ); - gp_Pnt2d p2( uvVecDegOld.back().u, uvVecDegOld.back().v ); + gp_Pnt2d p1 = uvVecDegOld.front().UV(); + gp_Pnt2d p2 = uvVecDegOld.back().UV(); - delete degSide; - quad->side[i] = new StdMeshers_FaceSide( oppSide, n, &p1, &p2, c2d, f, l ); + quad->side[i] = StdMeshers_FaceSide::New( oppSide.get(), n, &p1, &p2, c2d, f, l ); } } @@ -3306,6 +3787,8 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad) // Get nodes to smooth + // TODO: do not smooth fixed nodes + typedef map< const SMDS_MeshNode*, TSmoothNode, TIDCompare > TNo2SmooNoMap; TNo2SmooNoMap smooNoMap; @@ -3344,11 +3827,11 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad) // set _uv of smooth nodes on FACE boundary for ( unsigned i = 0; i < quad->side.size(); ++i ) { - const vector& uvVec = quad->side[i]->GetUVPtStruct(); + const vector& uvVec = quad->side[i].GetUVPtStruct(); for ( unsigned j = 0; j < uvVec.size(); ++j ) { TSmoothNode & sNode = smooNoMap[ uvVec[j].node ]; - sNode._uv.SetCoord( uvVec[j].u, uvVec[j].v ); + sNode._uv = uvVec[j].UV(); sNode._xyz = SMESH_TNodeXYZ( uvVec[j].node ); } } @@ -3459,37 +3942,175 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad) } } -/*//================================================================================ +//================================================================================ /*! - * \brief Finds vertices at the most sharp face corners - * \param [in] theFace - the FACE - * \param [in,out] theWire - the ordered edges of the face. It can be modified to - * have the first VERTEX of the first EDGE in \a vertices - * \param [out] theVertices - the found corner vertices in the order corresponding to - * the order of EDGEs in \a theWire - * \param [out] theNbDegenEdges - nb of degenerated EDGEs in theFace - * \param [in] theConsiderMesh - if \c true, only meshed VERTEXes are considered - * as possible corners - * \return int - number of quad sides found: 0, 3 or 4 + * \brief Checks validity of generated faces */ //================================================================================ -int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face& theFace, - SMESH_Mesh & theMesh, - std::list& theWire, - std::vector& theVertices, - int & theNbDegenEdges, - const bool theConsiderMesh) +bool StdMeshers_Quadrangle_2D::check() { - theNbDegenEdges = 0; + const bool isOK = true; + if ( !myCheckOri || myQuadList.empty() || !myQuadList.front() || !myHelper ) + return isOK; - SMESH_MesherHelper helper( theMesh ); + TopoDS_Face geomFace = TopoDS::Face( myHelper->GetSubShape() ); + SMESHDS_Mesh* meshDS = myHelper->GetMeshDS(); + SMESHDS_SubMesh* fSubMesh = meshDS->MeshElements( geomFace ); + bool toCheckUV; + if ( geomFace.Orientation() >= TopAbs_INTERNAL ) geomFace.Orientation( TopAbs_FORWARD ); - // sort theVertices by angle - multimap vertexByAngle; - TopTools_DataMapOfShapeReal angleByVertex; - TopoDS_Edge prevE = theWire.back(); - if ( SMESH_Algo::isDegenerated( prevE )) + // Get a reference orientation sign + + double okSign; + { + TError err; + TSideVector wireVec = + StdMeshers_FaceSide::GetFaceWires( geomFace, *myHelper->GetMesh(), true, err ); + StdMeshers_FaceSidePtr wire = wireVec[0]; + + // find a right angle VERTEX + int iVertex; + double maxAngle = -1e100; + for ( int i = 0; i < wire->NbEdges(); ++i ) + { + int iPrev = myHelper->WrapIndex( i-1, wire->NbEdges() ); + const TopoDS_Edge& e1 = wire->Edge( iPrev ); + const TopoDS_Edge& e2 = wire->Edge( i ); + double angle = myHelper->GetAngle( e1, e2, geomFace ); + if ( maxAngle < angle && angle < 0.9 * M_PI ) + { + maxAngle = angle; + iVertex = i; + } + } + if ( maxAngle < -2*M_PI ) return isOK; + + // get a sign of 2D area of a corner face + + int iPrev = myHelper->WrapIndex( iVertex-1, wire->NbEdges() ); + const TopoDS_Edge& e1 = wire->Edge( iPrev ); + const TopoDS_Edge& e2 = wire->Edge( iVertex ); + + gp_Vec2d v1, v2; gp_Pnt2d p; + double u[2]; + { + bool rev = ( e1.Orientation() == TopAbs_REVERSED ); + Handle(Geom2d_Curve) c = BRep_Tool::CurveOnSurface( e1, geomFace, u[0], u[1] ); + c->D1( u[ !rev ], p, v1 ); + if ( !rev ) + v1.Reverse(); + } + { + bool rev = ( e2.Orientation() == TopAbs_REVERSED ); + Handle(Geom2d_Curve) c = BRep_Tool::CurveOnSurface( e2, geomFace, u[0], u[1] ); + c->D1( u[ rev ], p, v2 ); + if ( rev ) + v2.Reverse(); + } + + okSign = v2 ^ v1; + + if ( maxAngle < 0 ) + okSign *= -1; + } + + // Look for incorrectly oriented faces + + std::list badFaces; + + const SMDS_MeshNode* nn [ 8 ]; // 8 is just for safety + gp_UV uv [ 8 ]; + SMDS_ElemIteratorPtr fIt = fSubMesh->GetElements(); + while ( fIt->more() ) // loop on faces bound to a FACE + { + const SMDS_MeshElement* f = fIt->next(); + + const int nbN = f->NbCornerNodes(); + for ( int i = 0; i < nbN; ++i ) + nn[ i ] = f->GetNode( i ); + + const SMDS_MeshNode* nInFace = 0; + if ( myHelper->HasSeam() ) + for ( int i = 0; i < nbN && !nInFace; ++i ) + if ( !myHelper->IsSeamShape( nn[i]->getshapeId() )) + nInFace = nn[i]; + + for ( int i = 0; i < nbN; ++i ) + uv[ i ] = myHelper->GetNodeUV( geomFace, nn[i], nInFace, &toCheckUV ); + + switch ( nbN ) { + case 4: + { + double sign1 = getArea( uv[0], uv[1], uv[2] ); + double sign2 = getArea( uv[0], uv[2], uv[3] ); + if ( sign1 * sign2 < 0 ) + { + sign2 = getArea( uv[1], uv[2], uv[3] ); + sign1 = getArea( uv[1], uv[3], uv[0] ); + if ( sign1 * sign2 < 0 ) + continue; // this should not happen + } + if ( sign1 * okSign < 0 ) + badFaces.push_back ( f ); + break; + } + case 3: + { + double sign = getArea( uv[0], uv[1], uv[2] ); + if ( sign * okSign < 0 ) + badFaces.push_back ( f ); + break; + } + default:; + } + } + + if ( !badFaces.empty() ) + { + SMESH_subMesh* fSM = myHelper->GetMesh()->GetSubMesh( geomFace ); + SMESH_ComputeErrorPtr& err = fSM->GetComputeError(); + err.reset ( new SMESH_ComputeError( COMPERR_ALGO_FAILED, + "Inverted elements generated")); + err->myBadElements.swap( badFaces ); + + return !isOK; + } + + return isOK; +} + +/*//================================================================================ +/*! + * \brief Finds vertices at the most sharp face corners + * \param [in] theFace - the FACE + * \param [in,out] theWire - the ordered edges of the face. It can be modified to + * have the first VERTEX of the first EDGE in \a vertices + * \param [out] theVertices - the found corner vertices in the order corresponding to + * the order of EDGEs in \a theWire + * \param [out] theNbDegenEdges - nb of degenerated EDGEs in theFace + * \param [in] theConsiderMesh - if \c true, only meshed VERTEXes are considered + * as possible corners + * \return int - number of quad sides found: 0, 3 or 4 + */ +//================================================================================ + +int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face& theFace, + SMESH_Mesh & theMesh, + std::list& theWire, + std::vector& theVertices, + int & theNbDegenEdges, + const bool theConsiderMesh) +{ + theNbDegenEdges = 0; + + SMESH_MesherHelper helper( theMesh ); + + // sort theVertices by angle + multimap vertexByAngle; + TopTools_DataMapOfShapeReal angleByVertex; + TopoDS_Edge prevE = theWire.back(); + if ( SMESH_Algo::isDegenerated( prevE )) { list::reverse_iterator edge = ++theWire.rbegin(); while ( SMESH_Algo::isDegenerated( *edge )) @@ -3521,7 +4142,8 @@ int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face& theFace, TopoDS_Shape triaVertex = helper.GetMeshDS()->IndexToShape( myTriaVertexID ); if ( !triaVertex.IsNull() && triaVertex.ShapeType() == TopAbs_VERTEX && - helper.IsSubShape( triaVertex, theFace )) + helper.IsSubShape( triaVertex, theFace ) && + ( vertexByAngle.size() != 4 || vertexByAngle.begin()->first < 5 * M_PI/180. )) nbCorners = 3; else triaVertex.Nullify(); @@ -3572,6 +4194,9 @@ int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face& theFace, isThereVariants = ( lostAngle * 1.1 >= lastAngle ); } + myCheckOri = ( vertexByAngle.size() > nbCorners || + vertexByAngle.begin()->first < 5.* M_PI/180 ); + // make theWire begin from a corner vertex or triaVertex if ( nbCorners == 3 ) while ( !triaVertex.IsSame( ( helper.IthVertex( 0, theWire.front() ))) || @@ -3704,3 +4329,1070 @@ int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face& theFace, return nbCorners; } + +//================================================================================ +/*! + * \brief Constructor of a side of quad + */ +//================================================================================ + +FaceQuadStruct::Side::Side(StdMeshers_FaceSidePtr theGrid) + : grid(theGrid), nbNodeOut(0), from(0), to(theGrid ? theGrid->NbPoints() : 0 ), di(1) +{ +} + +//============================================================================= +/*! + * \brief Constructor of a quad + */ +//============================================================================= + +FaceQuadStruct::FaceQuadStruct(const TopoDS_Face& F, const std::string& theName) + : face( F ), name( theName ) +{ + side.reserve(4); +} + +//================================================================================ +/*! + * \brief Fills myForcedPnts + */ +//================================================================================ + +bool StdMeshers_Quadrangle_2D::getEnforcedUV() +{ + myForcedPnts.clear(); + if ( !myParams ) return true; // missing hypothesis + + std::vector< TopoDS_Shape > shapes; + std::vector< gp_Pnt > points; + myParams->GetEnforcedNodes( shapes, points ); + + TopTools_IndexedMapOfShape vMap; + for ( size_t i = 0; i < shapes.size(); ++i ) + if ( !shapes[i].IsNull() ) + TopExp::MapShapes( shapes[i], TopAbs_VERTEX, vMap ); + + size_t nbPoints = points.size(); + for ( int i = 1; i <= vMap.Extent(); ++i ) + points.push_back( BRep_Tool::Pnt( TopoDS::Vertex( vMap( i )))); + + // find out if all points must be in the FACE, which is so if + // myParams is a local hypothesis on the FACE being meshed + bool isStrictCheck = false; + { + SMESH_HypoFilter paramFilter( SMESH_HypoFilter::Is( myParams )); + TopoDS_Shape assignedTo; + if ( myHelper->GetMesh()->GetHypothesis( myHelper->GetSubShape(), + paramFilter, + /*ancestors=*/true, + &assignedTo )) + isStrictCheck = ( assignedTo.IsSame( myHelper->GetSubShape() )); + } + + multimap< double, ForcedPoint > sortedFP; // sort points by distance from EDGEs + + Standard_Real u1,u2,v1,v2; + const TopoDS_Face& face = TopoDS::Face( myHelper->GetSubShape() ); + const double tol = BRep_Tool::Tolerance( face ); + Handle(Geom_Surface) surf = BRep_Tool::Surface( face ); + surf->Bounds( u1,u2,v1,v2 ); + GeomAPI_ProjectPointOnSurf project; + project.Init(surf, u1,u2, v1,v2, tol ); + Bnd_Box bbox; + BRepBndLib::Add( face, bbox ); + double farTol = 0.01 * sqrt( bbox.SquareExtent() ); + + for ( size_t iP = 0; iP < points.size(); ++iP ) + { + project.Perform( points[ iP ]); + if ( !project.IsDone() ) + { + if ( isStrictCheck && iP < nbPoints ) + return error + (TComm("Projection of an enforced point to the face failed - (") + << points[ iP ].X() << ", "<< points[ iP ].Y() << ", "<< points[ iP ].Z() << " )"); + continue; + } + if ( project.LowerDistance() > farTol ) + { + if ( isStrictCheck && iP < nbPoints ) + return error + (COMPERR_BAD_PARMETERS, TComm("An enforced point is too far from the face, dist = ") + << project.LowerDistance() << " - (" + << points[ iP ].X() << ", "<< points[ iP ].Y() << ", "<< points[ iP ].Z() << " )"); + continue; + } + Quantity_Parameter u, v; + project.LowerDistanceParameters(u, v); + gp_Pnt2d uv( u, v ); + BRepClass_FaceClassifier clsf ( face, uv, tol ); + switch ( clsf.State() ) { + case TopAbs_IN: + { + double edgeDist = ( Min( Abs( u - u1 ), Abs( u - u2 )) + + Min( Abs( v - v1 ), Abs( v - v2 ))); + ForcedPoint fp; + fp.uv = uv.XY(); + fp.xyz = points[ iP ].XYZ(); + if ( iP >= nbPoints ) + fp.vertex = TopoDS::Vertex( vMap( iP - nbPoints + 1 )); + + sortedFP.insert( make_pair( edgeDist, fp )); + break; + } + case TopAbs_OUT: + { + if ( isStrictCheck && iP < nbPoints ) + return error + (COMPERR_BAD_PARMETERS, TComm("An enforced point is out of the face boundary - ") + << points[ iP ].X() << ", "<< points[ iP ].Y() << ", "<< points[ iP ].Z() << " )"); + break; + } + case TopAbs_ON: + { + if ( isStrictCheck && iP < nbPoints ) + return error + (COMPERR_BAD_PARMETERS, TComm("An enforced point is on the face boundary - ") + << points[ iP ].X() << ", "<< points[ iP ].Y() << ", "<< points[ iP ].Z() << " )"); + break; + } + default: + { + if ( isStrictCheck && iP < nbPoints ) + return error + (TComm("Classification of an enforced point ralative to the face boundary failed - ") + << points[ iP ].X() << ", "<< points[ iP ].Y() << ", "<< points[ iP ].Z() << " )"); + } + } + } + + multimap< double, ForcedPoint >::iterator d2uv = sortedFP.begin(); + for ( ; d2uv != sortedFP.end(); ++d2uv ) + myForcedPnts.push_back( (*d2uv).second ); + + return true; +} + +//================================================================================ +/*! + * \brief Splits quads by adding points of enforced nodes and create nodes on + * the sides shared by quads + */ +//================================================================================ + +bool StdMeshers_Quadrangle_2D::addEnforcedNodes() +{ + // if ( myForcedPnts.empty() ) + // return true; + + // make a map of quads sharing a side + map< StdMeshers_FaceSidePtr, vector< FaceQuadStruct::Ptr > > quadsBySide; + list< FaceQuadStruct::Ptr >::iterator quadIt = myQuadList.begin(); + for ( ; quadIt != myQuadList.end(); ++quadIt ) + for ( size_t iSide = 0; iSide < (*quadIt)->side.size(); ++iSide ) + { + if ( !setNormalizedGrid( *quadIt )) + return false; + quadsBySide[ (*quadIt)->side[iSide] ].push_back( *quadIt ); + } + + SMESH_Mesh* mesh = myHelper->GetMesh(); + SMESHDS_Mesh* meshDS = myHelper->GetMeshDS(); + const TopoDS_Face& face = TopoDS::Face( myHelper->GetSubShape() ); + Handle(Geom_Surface) surf = BRep_Tool::Surface( face ); + + for ( size_t iFP = 0; iFP < myForcedPnts.size(); ++iFP ) + { + bool isNodeEnforced = false; + + // look for a quad enclosing a enforced point + for ( quadIt = myQuadList.begin(); quadIt != myQuadList.end(); ++quadIt ) + { + FaceQuadStruct::Ptr quad = *quadIt; + if ( !setNormalizedGrid( *quadIt )) + return false; + int i,j; + if ( !quad->findCell( myForcedPnts[ iFP ], i, j )) + continue; + + // a grid cell is found, select a node of the cell to move + // to the enforced point to and to split the quad at + multimap< double, pair< int, int > > ijByDist; + for ( int di = 0; di < 2; ++di ) + for ( int dj = 0; dj < 2; ++dj ) + { + double dist2 = ( myForcedPnts[ iFP ].uv - quad->UVPt( i+di,j+dj ).UV() ).SquareModulus(); + ijByDist.insert( make_pair( dist2, make_pair( di,dj ))); + } + // try all nodes starting from the closest one + set< FaceQuadStruct::Ptr > changedQuads; + multimap< double, pair< int, int > >::iterator d2ij = ijByDist.begin(); + for ( ; !isNodeEnforced && d2ij != ijByDist.end(); ++d2ij ) + { + int di = d2ij->second.first; + int dj = d2ij->second.second; + + // check if a node is at a side + int iSide = -1; + if ( dj== 0 && j == 0 ) + iSide = QUAD_BOTTOM_SIDE; + else if ( dj == 1 && j+2 == quad->jSize ) + iSide = QUAD_TOP_SIDE; + else if ( di == 0 && i == 0 ) + iSide = QUAD_LEFT_SIDE; + else if ( di == 1 && i+2 == quad->iSize ) + iSide = QUAD_RIGHT_SIDE; + + if ( iSide > -1 ) // ----- node is at a side + { + FaceQuadStruct::Side& side = quad->side[ iSide ]; + // check if this node can be moved + if ( quadsBySide[ side ].size() < 2 ) + continue; // its a face boundary -> can't move the node + + int quadNodeIndex = ( iSide % 2 ) ? j : i; + int sideNodeIndex = side.ToSideIndex( quadNodeIndex ); + if ( side.IsForced( sideNodeIndex )) + { + // the node is already moved to another enforced point + isNodeEnforced = quad->isEqual( myForcedPnts[ iFP ], i, j ); + continue; + } + // make a node of a side forced + vector& points = (vector&) side.GetUVPtStruct(); + points[ sideNodeIndex ].u = myForcedPnts[ iFP ].U(); + points[ sideNodeIndex ].v = myForcedPnts[ iFP ].V(); + + updateSideUV( side, sideNodeIndex, quadsBySide ); + + // update adjacent sides + set< StdMeshers_FaceSidePtr > updatedSides; + updatedSides.insert( side ); + for ( size_t i = 0; i < side.contacts.size(); ++i ) + if ( side.contacts[i].point == sideNodeIndex ) + { + const vector< FaceQuadStruct::Ptr >& adjQuads = + quadsBySide[ *side.contacts[i].other_side ]; + if ( adjQuads.size() > 1 && + updatedSides.insert( * side.contacts[i].other_side ).second ) + { + updateSideUV( *side.contacts[i].other_side, + side.contacts[i].other_point, + quadsBySide ); + } + changedQuads.insert( adjQuads.begin(), adjQuads.end() ); + } + const vector< FaceQuadStruct::Ptr >& adjQuads = quadsBySide[ side ]; + changedQuads.insert( adjQuads.begin(), adjQuads.end() ); + + isNodeEnforced = true; + } + else // ------------------ node is inside the quad + { + i += di; + j += dj; + // make a new side passing through IJ node and split the quad + int indForced, iNewSide; + if ( quad->iSize < quad->jSize ) // split vertically + { + quad->updateUV( myForcedPnts[ iFP ].uv, i, j, /*isVert=*/true ); + indForced = j; + iNewSide = splitQuad( quad, i, 0 ); + } + else + { + quad->updateUV( myForcedPnts[ iFP ].uv, i, j, /*isVert=*/false ); + indForced = i; + iNewSide = splitQuad( quad, 0, j ); + } + FaceQuadStruct::Ptr newQuad = myQuadList.back(); + FaceQuadStruct::Side& newSide = newQuad->side[ iNewSide ]; + + newSide.forced_nodes.insert( indForced ); + quad->side[( iNewSide+2 ) % 4 ].forced_nodes.insert( indForced ); + + quadsBySide[ newSide ].push_back( quad ); + quadsBySide[ newQuad->side[0] ].push_back( newQuad ); + quadsBySide[ newQuad->side[1] ].push_back( newQuad ); + quadsBySide[ newQuad->side[2] ].push_back( newQuad ); + quadsBySide[ newQuad->side[3] ].push_back( newQuad ); + + isNodeEnforced = true; + + } // end of "node is inside the quad" + + } // loop on nodes of the cell + + // remove out-of-date uv grid of changedQuads + set< FaceQuadStruct::Ptr >::iterator qIt = changedQuads.begin(); + for ( ; qIt != changedQuads.end(); ++qIt ) + (*qIt)->uv_grid.clear(); + + if ( isNodeEnforced ) + break; + + } // loop on quads + + if ( !isNodeEnforced ) + { + if ( !myForcedPnts[ iFP ].vertex.IsNull() ) + return error(TComm("Unable to move any node to vertex #") + <GetMeshDS()->ShapeToIndex( myForcedPnts[ iFP ].vertex )); + else + return error(TComm("Unable to move any node to point ( ") + << myForcedPnts[iFP].xyz.X() << ", " + << myForcedPnts[iFP].xyz.Y() << ", " + << myForcedPnts[iFP].xyz.Z() << " )"); + } + + } // loop on enforced points + + // Compute nodes on all sides, where not yet present + + for ( quadIt = myQuadList.begin(); quadIt != myQuadList.end(); ++quadIt ) + { + FaceQuadStruct::Ptr quad = *quadIt; + for ( int iSide = 0; iSide < 4; ++iSide ) + { + FaceQuadStruct::Side & side = quad->side[ iSide ]; + if ( side.nbNodeOut > 0 ) + continue; // emulated side + vector< FaceQuadStruct::Ptr >& quadVec = quadsBySide[ side ]; + if ( quadVec.size() <= 1 ) + continue; // outer side + + bool missedNodesOnSide = false; + const vector& points = side.grid->GetUVPtStruct(); + for ( size_t iC = 0; iC < side.contacts.size(); ++iC ) + { + const vector& oGrid = side.contacts[iC].other_side->grid->GetUVPtStruct(); + const UVPtStruct& uvPt = points[ side.contacts[iC].point ]; + if ( side.contacts[iC].other_point >= oGrid.size() || + side.contacts[iC].point >= points.size() ) + throw SALOME_Exception( "StdMeshers_Quadrangle_2D::addEnforcedNodes(): wrong contact" ); + if ( oGrid[ side.contacts[iC].other_point ].node ) + (( UVPtStruct& ) uvPt).node = oGrid[ side.contacts[iC].other_point ].node; + } + for ( size_t iP = 0; iP < points.size(); ++iP ) + if ( !points[ iP ].node ) + { + UVPtStruct& uvPnt = ( UVPtStruct& ) points[ iP ]; + gp_Pnt P = surf->Value( uvPnt.u, uvPnt.v ); + uvPnt.node = meshDS->AddNode(P.X(), P.Y(), P.Z()); + meshDS->SetNodeOnFace( uvPnt.node, myHelper->GetSubShapeID(), uvPnt.u, uvPnt.v ); + missedNodesOnSide = true; + } + if ( missedNodesOnSide ) + { + // clear uv_grid where nodes are missing + for ( size_t iQ = 0; iQ < quadVec.size(); ++iQ ) + quadVec[ iQ ]->uv_grid.clear(); + } + } + } + + return true; +} + +//================================================================================ +/*! + * \brief Splits a quad at I or J. Returns an index of a new side in the new quad + */ +//================================================================================ + +int StdMeshers_Quadrangle_2D::splitQuad(FaceQuadStruct::Ptr quad, int I, int J) +{ + FaceQuadStruct* newQuad = new FaceQuadStruct( quad->face ); + myQuadList.push_back( FaceQuadStruct::Ptr( newQuad )); + + vector points; + if ( I > 0 ) + { + points.reserve( quad->jSize ); + for ( int jP = 0; jP < quad->jSize; ++jP ) + points.push_back( quad->UVPt( I, jP )); + + newQuad->side.resize( 4 ); + newQuad->side[ QUAD_BOTTOM_SIDE ] = quad->side[ QUAD_BOTTOM_SIDE ]; + newQuad->side[ QUAD_RIGHT_SIDE ] = quad->side[ QUAD_RIGHT_SIDE ]; + newQuad->side[ QUAD_TOP_SIDE ] = quad->side[ QUAD_TOP_SIDE ]; + newQuad->side[ QUAD_LEFT_SIDE ] = StdMeshers_FaceSide::New( points, quad->face ); + + FaceQuadStruct::Side& newSide = newQuad->side[ QUAD_LEFT_SIDE ]; + FaceQuadStruct::Side& newSide2 = quad->side [ QUAD_RIGHT_SIDE ]; + + quad->side[ QUAD_RIGHT_SIDE ] = newSide; + + int iBot = quad->side[ QUAD_BOTTOM_SIDE ].ToSideIndex( I ); + int iTop = quad->side[ QUAD_TOP_SIDE ].ToSideIndex( I ); + + newSide.AddContact ( 0, & quad->side[ QUAD_BOTTOM_SIDE ], iBot ); + newSide2.AddContact( 0, & quad->side[ QUAD_BOTTOM_SIDE ], iBot ); + newSide.AddContact ( quad->jSize - 1, & quad->side[ QUAD_TOP_SIDE ], iTop ); + newSide2.AddContact( quad->jSize - 1, & quad->side[ QUAD_TOP_SIDE ], iTop ); + // cout << "Contact: L " << &newSide << " "<< newSide.NbPoints() + // << " R " << &newSide2 << " "<< newSide2.NbPoints() + // << " B " << &quad->side[ QUAD_BOTTOM_SIDE ] << " "<< quad->side[ QUAD_BOTTOM_SIDE].NbPoints() + // << " T " << &quad->side[ QUAD_TOP_SIDE ] << " "<< quad->side[ QUAD_TOP_SIDE].NbPoints()<< endl; + + newQuad->side[ QUAD_BOTTOM_SIDE ].from = iBot; + newQuad->side[ QUAD_TOP_SIDE ].from = iTop; + newQuad->name = ( TComm("Right of I=") << I ); + + quad->side[ QUAD_BOTTOM_SIDE ].to = iBot + 1; + quad->side[ QUAD_TOP_SIDE ].to = iTop + 1; + quad->uv_grid.clear(); + + return QUAD_LEFT_SIDE; + } + else if ( J > 0 ) //// split horizontally, a new quad is below an old one + { + points.reserve( quad->iSize ); + for ( int iP = 0; iP < quad->iSize; ++iP ) + points.push_back( quad->UVPt( iP, J )); + + newQuad->side.resize( 4 ); + newQuad->side[ QUAD_BOTTOM_SIDE ] = quad->side[ QUAD_BOTTOM_SIDE ]; + newQuad->side[ QUAD_RIGHT_SIDE ] = quad->side[ QUAD_RIGHT_SIDE ]; + newQuad->side[ QUAD_TOP_SIDE ] = StdMeshers_FaceSide::New( points, quad->face ); + newQuad->side[ QUAD_LEFT_SIDE ] = quad->side[ QUAD_LEFT_SIDE ]; + + FaceQuadStruct::Side& newSide = newQuad->side[ QUAD_TOP_SIDE ]; + FaceQuadStruct::Side& newSide2 = quad->side [ QUAD_BOTTOM_SIDE ]; + + quad->side[ QUAD_BOTTOM_SIDE ] = newSide; + + int iLft = quad->side[ QUAD_LEFT_SIDE ].ToSideIndex( J ); + int iRgt = quad->side[ QUAD_RIGHT_SIDE ].ToSideIndex( J ); + + newSide.AddContact ( 0, & quad->side[ QUAD_LEFT_SIDE ], iLft ); + newSide2.AddContact( 0, & quad->side[ QUAD_LEFT_SIDE ], iLft ); + newSide.AddContact ( quad->iSize - 1, & quad->side[ QUAD_RIGHT_SIDE ], iRgt ); + newSide2.AddContact( quad->iSize - 1, & quad->side[ QUAD_RIGHT_SIDE ], iRgt ); + // cout << "Contact: T " << &newSide << " "<< newSide.NbPoints() + // << " B " << &newSide2 << " "<< newSide2.NbPoints() + // << " L " << &quad->side[ QUAD_LEFT_SIDE ] << " "<< quad->side[ QUAD_LEFT_SIDE].NbPoints() + // << " R " << &quad->side[ QUAD_RIGHT_SIDE ] << " "<< quad->side[ QUAD_RIGHT_SIDE].NbPoints()<< endl; + + newQuad->side[ QUAD_RIGHT_SIDE ].to = iRgt+1; + newQuad->side[ QUAD_LEFT_SIDE ].to = iLft+1; + newQuad->name = ( TComm("Below J=") << J ); + + quad->side[ QUAD_RIGHT_SIDE ].from = iRgt; + quad->side[ QUAD_LEFT_SIDE ].from = iLft; + quad->uv_grid.clear(); + + return QUAD_TOP_SIDE; + } + + myQuadList.pop_back(); + return -1; +} + +//================================================================================ +/*! + * \brief Updates UV of a side after moving its node + */ +//================================================================================ + +void StdMeshers_Quadrangle_2D::updateSideUV( FaceQuadStruct::Side& side, + int iForced, + const TQuadsBySide& quadsBySide, + int * iNext) +{ + if ( !iNext ) + { + side.forced_nodes.insert( iForced ); + + // update parts of the side before and after iForced + + set::iterator iIt = side.forced_nodes.upper_bound( iForced ); + int iEnd = Min( side.NbPoints()-1, ( iIt == side.forced_nodes.end() ) ? int(1e7) : *iIt ); + if ( iForced + 1 < iEnd ) + updateSideUV( side, iForced, quadsBySide, &iEnd ); + + iIt = side.forced_nodes.lower_bound( iForced ); + int iBeg = Max( 0, ( iIt == side.forced_nodes.begin() ) ? 0 : *--iIt ); + if ( iForced - 1 > iBeg ) + updateSideUV( side, iForced, quadsBySide, &iBeg ); + + return; + } + + const int iFrom = Min ( iForced, *iNext ); + const int iTo = Max ( iForced, *iNext ) + 1; + const int sideSize = iTo - iFrom; + + vector points[4]; // side points of a temporary quad + + // from the quads get grid points adjacent to the side + // to make two sides of a temporary quad + vector< FaceQuadStruct::Ptr > quads = quadsBySide.find( side )->second; // copy! + for ( int is2nd = 0; is2nd < 2; ++is2nd ) + { + points[ is2nd ].reserve( sideSize ); + int nbLoops = 0; + while ( points[is2nd].size() < sideSize ) + { + int iCur = iFrom + points[is2nd].size() - int( !points[is2nd].empty() ); + + // look for a quad adjacent to iCur-th point of the side + for ( size_t iQ = 0; iQ < quads.size(); ++iQ ) + { + FaceQuadStruct::Ptr q = quads[ iQ ]; + if ( !q ) + continue; + size_t iS; + for ( iS = 0; iS < q->side.size(); ++iS ) + if ( side.grid == q->side[ iS ].grid ) + break; + bool isOut; + if ( !q->side[ iS ].IsReversed() ) + isOut = ( q->side[ iS ].from > iCur || q->side[ iS ].to-1 <= iCur ); + else + isOut = ( q->side[ iS ].to >= iCur || q->side[ iS ].from <= iCur ); + if ( isOut ) + continue; + if ( !setNormalizedGrid( q )) + continue; + + // found - copy points + int i,j,di,dj,nb; + if ( iS % 2 ) // right or left + { + i = ( iS == QUAD_LEFT_SIDE ) ? 1 : q->iSize-2; + j = q->side[ iS ].ToQuadIndex( iCur ); + di = 0; + dj = ( q->side[ iS ].IsReversed() ) ? -1 : +1; + nb = ( q->side[ iS ].IsReversed() ) ? j+1 : q->jSize-j; + } + else // bottom or top + { + i = q->side[ iS ].ToQuadIndex( iCur ); + j = ( iS == QUAD_BOTTOM_SIDE ) ? 1 : q->jSize-2; + di = ( q->side[ iS ].IsReversed() ) ? -1 : +1; + dj = 0; + nb = ( q->side[ iS ].IsReversed() ) ? i+1 : q->iSize-i; + } + if ( !points[is2nd].empty() ) + { + gp_UV lastUV = points[is2nd].back().UV(); + gp_UV quadUV = q->UVPt( i, j ).UV(); + if ( ( lastUV - quadUV ).SquareModulus() > 1e-10 ) + continue; // quad is on the other side of the side + i += di; j += dj; --nb; + } + for ( ; nb > 0 ; --nb ) + { + points[ is2nd ].push_back( q->UVPt( i, j )); + if ( points[is2nd].size() >= sideSize ) + break; + i += di; j += dj; + } + quads[ iQ ].reset(); // not to use this quad anymore + + if ( points[is2nd].size() >= sideSize ) + break; + } // loop on quads + + if ( nbLoops++ > quads.size() ) + throw SALOME_Exception( "StdMeshers_Quadrangle_2D::updateSideUV() bug: infinite loop" ); + + } // while ( points[is2nd].size() < sideSize ) + } // two loops to fill points[0] and points[1] + + // points for other pair of opposite sides of the temporary quad + + enum { L,R,B,T }; // side index of points[] + + points[B].push_back( points[L].front() ); + points[B].push_back( side.GetUVPtStruct()[ iFrom ]); + points[B].push_back( points[R].front() ); + + points[T].push_back( points[L].back() ); + points[T].push_back( side.GetUVPtStruct()[ iTo-1 ]); + points[T].push_back( points[R].back() ); + + // make the temporary quad + FaceQuadStruct::Ptr tmpQuad + ( new FaceQuadStruct( TopoDS::Face( myHelper->GetSubShape() ), "tmpQuad")); + tmpQuad->side.push_back( StdMeshers_FaceSide::New( points[B] )); // bottom + tmpQuad->side.push_back( StdMeshers_FaceSide::New( points[R] )); // right + tmpQuad->side.push_back( StdMeshers_FaceSide::New( points[T] )); + tmpQuad->side.push_back( StdMeshers_FaceSide::New( points[L] )); + + // compute new UV of the side + setNormalizedGrid( tmpQuad ); + gp_UV uv = tmpQuad->UVPt(1,0).UV(); + tmpQuad->updateUV( uv, 1,0, /*isVertical=*/true ); + + // update UV of the side + vector& sidePoints = (vector&) side.GetUVPtStruct(); + for ( int i = iFrom; i < iTo; ++i ) + { + const uvPtStruct& uvPt = tmpQuad->UVPt( 1, i-iFrom ); + sidePoints[ i ].u = uvPt.u; + sidePoints[ i ].v = uvPt.v; + } +} + +//================================================================================ +/*! + * \brief Finds indices of a grid quad enclosing the given enforced UV + */ +//================================================================================ + +bool FaceQuadStruct::findCell( const gp_XY& UV, int & I, int & J ) +{ + // setNormalizedGrid() must be called before! + if ( uv_box.IsOut( UV )) + return false; + + // find an approximate position + double x = 0.5, y = 0.5; + gp_XY t0 = UVPt( iSize - 1, 0 ).UV(); + gp_XY t1 = UVPt( 0, jSize - 1 ).UV(); + gp_XY t2 = UVPt( 0, 0 ).UV(); + SMESH_MeshAlgos::GetBarycentricCoords( UV, t0, t1, t2, x, y ); + x = Min( 1., Max( 0., x )); + y = Min( 1., Max( 0., y )); + + // precise the position + normPa2IJ( x,y, I,J ); + if ( !isNear( UV, I,J )) + { + // look for the most close IJ by traversing uv_grid in the middle + double dist2, minDist2 = ( UV - UVPt( I,J ).UV() ).SquareModulus(); + for ( int isU = 0; isU < 2; ++isU ) + { + int ind1 = isU ? 0 : iSize / 2; + int ind2 = isU ? jSize / 2 : 0; + int di1 = isU ? Max( 2, iSize / 20 ) : 0; + int di2 = isU ? 0 : Max( 2, jSize / 20 ); + int i,nb = isU ? iSize / di1 : jSize / di2; + for ( i = 0; i < nb; ++i, ind1 += di1, ind2 += di2 ) + if (( dist2 = ( UV - UVPt( ind1,ind2 ).UV() ).SquareModulus() ) < minDist2 ) + { + I = ind1; + J = ind2; + if ( isNear( UV, I,J )) + return true; + minDist2 = ( UV - UVPt( I,J ).UV() ).SquareModulus(); + } + } + if ( !isNear( UV, I,J, Max( iSize, jSize ) /2 )) + return false; + } + return true; +} + +//================================================================================ +/*! + * \brief Find indices (i,j) of a point in uv_grid by normalized parameters (x,y) + */ +//================================================================================ + +void FaceQuadStruct::normPa2IJ(double X, double Y, int & I, int & J ) +{ + + I = Min( int ( iSize * X ), iSize - 2 ); + J = Min( int ( jSize * Y ), jSize - 2 ); + + int oldI, oldJ; + do + { + oldI = I, oldJ = J; + while ( X <= UVPt( I,J ).x && I != 0 ) + --I; + while ( X > UVPt( I+1,J ).x && I+2 < iSize ) + ++I; + while ( Y <= UVPt( I,J ).y && J != 0 ) + --J; + while ( Y > UVPt( I,J+1 ).y && J+2 < jSize ) + ++J; + } while ( oldI != I || oldJ != J ); +} + +//================================================================================ +/*! + * \brief Looks for UV in quads around a given (I,J) and precise (I,J) + */ +//================================================================================ + +bool FaceQuadStruct::isNear( const gp_XY& UV, int & I, int & J, int nbLoops ) +{ + if ( I+1 >= iSize ) I = iSize - 2; + if ( J+1 >= jSize ) J = jSize - 2; + + double bcI, bcJ; + gp_XY uvI, uvJ, uv0, uv1; + for ( int iLoop = 0; iLoop < nbLoops; ++iLoop ) + { + int oldI = I, oldJ = J; + + uvI = UVPt( I+1, J ).UV(); + uvJ = UVPt( I, J+1 ).UV(); + uv0 = UVPt( I, J ).UV(); + SMESH_MeshAlgos::GetBarycentricCoords( UV, uvI, uvJ, uv0, bcI, bcJ ); + if ( bcI >= 0. && bcJ >= 0. && bcI + bcJ <= 1.) + return true; + + if ( I > 0 && bcI < 0. ) --I; + if ( I+2 < iSize && bcI > 1. ) ++I; + if ( J > 0 && bcJ < 0. ) --J; + if ( J+2 < jSize && bcJ > 1. ) ++J; + + uv1 = UVPt( I+1,J+1).UV(); + if ( I != oldI || J != oldJ ) + { + uvI = UVPt( I+1, J ).UV(); + uvJ = UVPt( I, J+1 ).UV(); + } + SMESH_MeshAlgos::GetBarycentricCoords( UV, uvI, uvJ, uv1, bcI, bcJ ); + if ( bcI >= 0. && bcJ >= 0. && bcI + bcJ <= 1.) + return true; + + if ( I > 0 && bcI > 1. ) --I; + if ( I+2 < iSize && bcI < 0. ) ++I; + if ( J > 0 && bcJ > 1. ) --J; + if ( J+2 < jSize && bcJ < 0. ) ++J; + + if ( I == oldI && J == oldJ ) + return false; + + if ( iLoop+1 == nbLoops ) + { + uvI = UVPt( I+1, J ).UV(); + uvJ = UVPt( I, J+1 ).UV(); + uv0 = UVPt( I, J ).UV(); + SMESH_MeshAlgos::GetBarycentricCoords( UV, uvI, uvJ, uv0, bcI, bcJ ); + if ( bcI >= 0. && bcJ >= 0. && bcI + bcJ <= 1.) + return true; + + uv1 = UVPt( I+1,J+1).UV(); + SMESH_MeshAlgos::GetBarycentricCoords( UV, uvI, uvJ, uv1, bcI, bcJ ); + if ( bcI >= 0. && bcJ >= 0. && bcI + bcJ <= 1.) + return true; + } + } + return false; +} + +//================================================================================ +/*! + * \brief Checks if a given UV is equal to a given grid point + */ +//================================================================================ + +bool FaceQuadStruct::isEqual( const gp_XY& UV, int I, int J ) +{ + TopLoc_Location loc; + Handle(Geom_Surface) surf = BRep_Tool::Surface( face, loc ); + gp_Pnt p1 = surf->Value( UV.X(), UV.Y() ); + gp_Pnt p2 = surf->Value( UVPt( I,J ).u, UVPt( I,J ).v ); + + double dist2 = 1e100; + for ( int di = -1; di < 2; di += 2 ) + { + int i = I + di; + if ( i < 0 || i+1 >= iSize ) continue; + for ( int dj = -1; dj < 2; dj += 2 ) + { + int j = J + dj; + if ( j < 0 || j+1 >= jSize ) continue; + + dist2 = Min( dist2, + p2.SquareDistance( surf->Value( UVPt( i,j ).u, UVPt( i,j ).v ))); + } + } + double tol2 = dist2 / 1000.; + return p1.SquareDistance( p2 ) < tol2; +} + +//================================================================================ +/*! + * \brief Recompute UV of grid points around a moved point in one direction + */ +//================================================================================ + +void FaceQuadStruct::updateUV( const gp_XY& UV, int I, int J, bool isVertical ) +{ + UVPt( I, J ).u = UV.X(); + UVPt( I, J ).v = UV.Y(); + + if ( isVertical ) + { + // above J + if ( J+1 < jSize-1 ) + { + gp_UV a0 = UVPt( 0, J ).UV(); + gp_UV a1 = UVPt( iSize-1, J ).UV(); + gp_UV a2 = UVPt( iSize-1, jSize-1 ).UV(); + gp_UV a3 = UVPt( 0, jSize-1 ).UV(); + + gp_UV p0 = UVPt( I, J ).UV(); + gp_UV p2 = UVPt( I, jSize-1 ).UV(); + const double y0 = UVPt( I, J ).y, dy = 1. - y0; + for (int j = J+1; j < jSize-1; j++) + { + gp_UV p1 = UVPt( iSize-1, j ).UV(); + gp_UV p3 = UVPt( 0, j ).UV(); + + UVPtStruct& uvPt = UVPt( I, j ); + gp_UV uv = calcUV( uvPt.x, ( uvPt.y - y0 ) / dy, a0,a1,a2,a3, p0,p1,p2,p3); + uvPt.u = uv.X(); + uvPt.v = uv.Y(); + } + } + // under J + if ( J-1 > 0 ) + { + gp_UV a0 = UVPt( 0, 0 ).UV(); + gp_UV a1 = UVPt( iSize-1, 0 ).UV(); + gp_UV a2 = UVPt( iSize-1, J ).UV(); + gp_UV a3 = UVPt( 0, J ).UV(); + + gp_UV p0 = UVPt( I, 0 ).UV(); + gp_UV p2 = UVPt( I, J ).UV(); + const double y0 = 0., dy = UVPt( I, J ).y - y0; + for (int j = 1; j < J; j++) + { + gp_UV p1 = UVPt( iSize-1, j ).UV(); + gp_UV p3 = UVPt( 0, j ).UV(); + + UVPtStruct& uvPt = UVPt( I, j ); + gp_UV uv = calcUV( uvPt.x, ( uvPt.y - y0 ) / dy, a0,a1,a2,a3, p0,p1,p2,p3); + uvPt.u = uv.X(); + uvPt.v = uv.Y(); + } + } + } + else // horizontally + { + // before I + if ( I-1 > 0 ) + { + gp_UV a0 = UVPt( 0, 0 ).UV(); + gp_UV a1 = UVPt( I, 0 ).UV(); + gp_UV a2 = UVPt( I, jSize-1 ).UV(); + gp_UV a3 = UVPt( 0, jSize-1 ).UV(); + + gp_UV p1 = UVPt( I, J ).UV(); + gp_UV p3 = UVPt( 0, J ).UV(); + const double x0 = 0., dx = UVPt( I, J ).x - x0; + for (int i = 1; i < I; i++) + { + gp_UV p0 = UVPt( i, 0 ).UV(); + gp_UV p2 = UVPt( i, jSize-1 ).UV(); + + UVPtStruct& uvPt = UVPt( i, J ); + gp_UV uv = calcUV(( uvPt.x - x0 ) / dx , uvPt.y, a0,a1,a2,a3, p0,p1,p2,p3); + uvPt.u = uv.X(); + uvPt.v = uv.Y(); + } + } + // after I + if ( I+1 < iSize-1 ) + { + gp_UV a0 = UVPt( I, 0 ).UV(); + gp_UV a1 = UVPt( iSize-1, 0 ).UV(); + gp_UV a2 = UVPt( iSize-1, jSize-1 ).UV(); + gp_UV a3 = UVPt( I, jSize-1 ).UV(); + + gp_UV p1 = UVPt( iSize-1, J ).UV(); + gp_UV p3 = UVPt( I, J ).UV(); + const double x0 = UVPt( I, J ).x, dx = 1. - x0; + for (int i = I+1; i < iSize-1; i++) + { + gp_UV p0 = UVPt( i, 0 ).UV(); + gp_UV p2 = UVPt( i, jSize-1 ).UV(); + + UVPtStruct& uvPt = UVPt( i, J ); + gp_UV uv = calcUV(( uvPt.x - x0 ) / dx , uvPt.y, a0,a1,a2,a3, p0,p1,p2,p3); + uvPt.u = uv.X(); + uvPt.v = uv.Y(); + } + } + } +} + +//================================================================================ +/*! + * \brief Side copying + */ +//================================================================================ + +FaceQuadStruct::Side& FaceQuadStruct::Side::operator=(const Side& otherSide) +{ + grid = otherSide.grid; + from = otherSide.from; + to = otherSide.to; + di = otherSide.di; + forced_nodes = otherSide.forced_nodes; + contacts = otherSide.contacts; + nbNodeOut = otherSide.nbNodeOut; + + for ( size_t iC = 0; iC < contacts.size(); ++iC ) + { + FaceQuadStruct::Side* oSide = contacts[iC].other_side; + for ( size_t iOC = 0; iOC < oSide->contacts.size(); ++iOC ) + if ( oSide->contacts[iOC].other_side == & otherSide ) + { + // cout << "SHIFT old " << &otherSide << " " << otherSide.NbPoints() + // << " -> new " << this << " " << this->NbPoints() << endl; + oSide->contacts[iOC].other_side = this; + } + } + return *this; +} + +//================================================================================ +/*! + * \brief Converts node index of a quad to node index of this side + */ +//================================================================================ + +int FaceQuadStruct::Side::ToSideIndex( int quadNodeIndex ) const +{ + return from + di * quadNodeIndex; +} + +//================================================================================ +/*! + * \brief Converts node index of this side to node index of a quad + */ +//================================================================================ + +int FaceQuadStruct::Side::ToQuadIndex( int sideNodeIndex ) const +{ + return ( sideNodeIndex - from ) * di; +} + +//================================================================================ +/*! + * \brief Reverse the side + */ +//================================================================================ + +bool FaceQuadStruct::Side::Reverse(bool keepGrid) +{ + if ( grid ) + { + if ( keepGrid ) + { + from -= di; + to -= di; + std::swap( from, to ); + di *= -1; + } + else + { + grid->Reverse(); + } + } + return (bool)grid; +} + +//================================================================================ +/*! + * \brief Checks if a node is enforced + * \param [in] nodeIndex - an index of a node in a size + * \return bool - \c true if the node is forced + */ +//================================================================================ + +bool FaceQuadStruct::Side::IsForced( int nodeIndex ) const +{ + if ( nodeIndex < 0 || nodeIndex >= grid->NbPoints() ) + throw SALOME_Exception( " FaceQuadStruct::Side::IsForced(): wrong index" ); + + if ( forced_nodes.count( nodeIndex ) ) + return true; + + for ( size_t i = 0; i < this->contacts.size(); ++i ) + if ( contacts[ i ].point == nodeIndex && + contacts[ i ].other_side->forced_nodes.count( contacts[ i ].other_point )) + return true; + + return false; +} + +//================================================================================ +/*! + * \brief Sets up a contact between this and another side + */ +//================================================================================ + +void FaceQuadStruct::Side::AddContact( int ip, Side* side, int iop ) +{ + if ( ip >= GetUVPtStruct().size() || + iop >= side->GetUVPtStruct().size() ) + throw SALOME_Exception( "FaceQuadStruct::Side::AddContact(): wrong point" ); + { + contacts.resize( contacts.size() + 1 ); + Contact& c = contacts.back(); + c.point = ip; + c.other_side = side; + c.other_point = iop; + } + { + side->contacts.resize( side->contacts.size() + 1 ); + Contact& c = side->contacts.back(); + c.point = iop; + c.other_side = this; + c.other_point = ip; + } +} + +//================================================================================ +/*! + * \brief Returns a normalized parameter of a point indexed within a quadrangle + */ +//================================================================================ + +double FaceQuadStruct::Side::Param( int i ) const +{ + const vector& points = GetUVPtStruct(); + return (( points[ from + i * di ].normParam - points[ from ].normParam ) / + ( points[ to - 1 * di ].normParam - points[ from ].normParam )); +} + +//================================================================================ +/*! + * \brief Returns UV by a parameter normalized within a quadrangle + */ +//================================================================================ + +gp_XY FaceQuadStruct::Side::Value2d( double x ) const +{ + const vector& points = GetUVPtStruct(); + double u = ( points[ from ].normParam + + x * ( points[ to-di ].normParam - points[ from ].normParam )); + return grid->Value2d( u ).XY(); +} + +//================================================================================ +/*! + * \brief Returns side length + */ +//================================================================================ + +double FaceQuadStruct::Side::Length(int theFrom, int theTo) const +{ + if ( IsReversed() != ( theTo < theFrom )) + std::swap( theTo, theFrom ); + + const vector& points = GetUVPtStruct(); + double r; + if ( theFrom == theTo && theTo == -1 ) + r = Abs( First().normParam - + Last ().normParam ); + else if ( IsReversed() ) + r = Abs( points[ Max( to, theTo+1 ) ].normParam - + points[ Min( from, theFrom ) ].normParam ); + else + r = Abs( points[ Min( to, theTo-1 ) ].normParam - + points[ Max( from, theFrom ) ].normParam ); + return r * grid->Length(); +} diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx index 54a2a0664..b17fd7fa7 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -30,35 +30,109 @@ #include "SMESH_Algo.hxx" #include "SMESH_ProxyMesh.hxx" #include "SMESH_StdMeshers.hxx" +#include "StdMeshers_FaceSide.hxx" #include "StdMeshers_QuadrangleParams.hxx" #include +#include class SMDS_MeshNode; class SMESH_Mesh; class SMESH_MesherHelper; class SMESH_ProxyMesh; -class StdMeshers_FaceSide; struct uvPtStruct; enum TSideID { QUAD_BOTTOM_SIDE=0, QUAD_RIGHT_SIDE, QUAD_TOP_SIDE, QUAD_LEFT_SIDE, NB_QUAD_SIDES }; typedef uvPtStruct UVPtStruct; -typedef struct faceQuadStruct +struct FaceQuadStruct { - std::vector< StdMeshers_FaceSide*> side; - bool isEdgeOut[4]; // true, if an EDGE has more nodes, than an opposite one - UVPtStruct* uv_grid; - TopoDS_Face face; - ~faceQuadStruct(); - void shift( size_t nb, bool keepUnitOri ); - typedef boost::shared_ptr Ptr; -} FaceQuadStruct; + struct Side // a side of FaceQuadStruct + { + struct Contact // contact of two sides + { + int point; // index of a grid point of this side where two sides meat + Side* other_side; + int other_point; + }; + StdMeshers_FaceSidePtr grid; + int from, to; // indices of grid points used by the quad + int di; // +1 or -1 depending on IsReversed() + std::set forced_nodes; // indices of forced grid points + std::vector contacts; // contacts with sides of other quads + int nbNodeOut; // nb of missing nodes on an opposite shorter side + + Side(StdMeshers_FaceSidePtr theGrid = StdMeshers_FaceSidePtr()); + Side& operator=(const Side& otherSide); + operator StdMeshers_FaceSidePtr() { return grid; } + operator const StdMeshers_FaceSidePtr() const { return grid; } + void AddContact( int ip, Side* side, int iop ); + int ToSideIndex( int quadNodeIndex ) const; + int ToQuadIndex( int sideNodeIndex ) const; + bool IsForced( int nodeIndex ) const; + bool IsReversed() const { return nbNodeOut ? false : to < from; } + bool Reverse(bool keepGrid); + int NbPoints() const { return Abs( to - from ); } + double Param( int nodeIndex ) const; + double Length( int from=-1, int to=-1) const; + gp_XY Value2d( double x ) const; + const UVPtStruct& First() const { return GetUVPtStruct()[ from ]; } + const UVPtStruct& Last() const { + return GetUVPtStruct()[ to-nbNodeOut-(IsReversed() ? -1 : +1)]; + } + // some sortcuts + const vector& GetUVPtStruct(bool isXConst=0, double constValue=0) const + { return nbNodeOut ? + grid->SimulateUVPtStruct( NbPoints()-nbNodeOut-1, isXConst, constValue ) : + grid->GetUVPtStruct( isXConst, constValue ); + } + }; + struct SideIterator // iterator on UVPtStruct of a Side + { + const UVPtStruct *uvPtr, *uvEnd; + int dPtr, counter; + SideIterator(): uvPtr(0), uvEnd(0), dPtr(0), counter(0) {} + void Init( const Side& side ) { + dPtr = counter = 0; + uvPtr = uvEnd = 0; + if ( side.NbPoints() > 0 ) { + uvPtr = & side.First(); + uvEnd = & side.Last(); + dPtr = ( uvEnd > uvPtr ) ? +1 : -1; + uvEnd += dPtr; + } + } + bool More() const { return uvPtr != uvEnd; } + void Next() { uvPtr += dPtr; ++counter; } + UVPtStruct& UVPt() const { return (UVPtStruct&) *uvPtr; } + UVPtStruct& operator[](int i) { return (UVPtStruct&) uvPtr[ i*dPtr]; } + int Count() const { return counter; } + }; + + std::vector< Side > side; + std::vector< UVPtStruct> uv_grid; + int iSize, jSize; + TopoDS_Face face; + Bnd_B2d uv_box; + std::string name; // to ease debugging + + FaceQuadStruct ( const TopoDS_Face& F = TopoDS_Face(), const std::string& nm="main" ); + UVPtStruct& UVPt( int i, int j ) { return uv_grid[ i + j * iSize ]; } + void shift ( size_t nb, bool keepUnitOri, bool keepGrid=false ); + int & nbNodeOut( int iSide ) { return side[ iSide ].nbNodeOut; } + bool findCell ( const gp_XY& uv, int & i, int & j ); + bool isNear ( const gp_XY& uv, int & i, int & j, int nbLoops=1 ); + bool isEqual ( const gp_XY& uv, int i, int j ); + void normPa2IJ( double x, double y, int & i, int & j ); + void updateUV ( const gp_XY& uv, int i, int j, bool isVertical ); + + typedef boost::shared_ptr Ptr; +}; class STDMESHERS_EXPORT StdMeshers_Quadrangle_2D: public SMESH_2D_Algo { -public: + public: StdMeshers_Quadrangle_2D(int hypId, int studyId, SMESH_Gen* gen); virtual ~StdMeshers_Quadrangle_2D(); @@ -81,7 +155,9 @@ public: const TopoDS_Shape& aShape, const bool considerMesh=false); -protected: + static bool IsApplicable(const TopoDS_Shape & aShape, bool toCheckAll); + + protected: bool checkNbEdgesForEvaluate(SMESH_Mesh& aMesh, const TopoDS_Shape & aShape, @@ -89,16 +165,17 @@ protected: std::vector& aNbNodes, bool& IsQuadratic); - bool setNormalizedGrid(SMESH_Mesh& aMesh, - const TopoDS_Face& aFace, - FaceQuadStruct::Ptr& quad); - - void splitQuad(SMESHDS_Mesh *theMeshDS, - const int theFaceID, - const SMDS_MeshNode* theNode1, - const SMDS_MeshNode* theNode2, - const SMDS_MeshNode* theNode3, - const SMDS_MeshNode* theNode4); + bool setNormalizedGrid(FaceQuadStruct::Ptr quad); + + void splitQuadFace(SMESHDS_Mesh * theMeshDS, + const int theFaceID, + const SMDS_MeshNode* theNode1, + const SMDS_MeshNode* theNode2, + const SMDS_MeshNode* theNode3, + const SMDS_MeshNode* theNode4); + + bool computeQuadDominant(SMESH_Mesh& aMesh, + const TopoDS_Face& aFace); bool computeQuadDominant(SMESH_Mesh& aMesh, const TopoDS_Face& aFace, @@ -108,6 +185,10 @@ protected: const TopoDS_Face& aFace, FaceQuadStruct::Ptr quad); + bool computeTriangles(SMESH_Mesh& aMesh, + const TopoDS_Face& aFace, + FaceQuadStruct::Ptr quad); + bool evaluateQuadPref(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, std::vector& aNbNodes, @@ -122,6 +203,8 @@ protected: void smooth (FaceQuadStruct::Ptr quad); + bool check(); + int getCorners(const TopoDS_Face& theFace, SMESH_Mesh & theMesh, std::list& theWire, @@ -129,20 +212,45 @@ protected: int & theNbDegenEdges, const bool considerMesh); + bool getEnforcedUV(); + + bool addEnforcedNodes(); + + int splitQuad(FaceQuadStruct::Ptr quad, int i, int j); + + void shiftQuad(FaceQuadStruct::Ptr& quad, const int num ); + + typedef std::map< StdMeshers_FaceSidePtr, std::vector< FaceQuadStruct::Ptr > > TQuadsBySide; + void updateSideUV( FaceQuadStruct::Side& side, + int iForced, + const TQuadsBySide& quads, + int * iNext=NULL); + + + protected: // Fields - // true if QuadranglePreference hypothesis is assigned that forces - // construction of quadrangles if the number of nodes on opposite edges - // is not the same in the case where the global number of nodes on edges - // is even bool myQuadranglePreference; bool myTrianglePreference; int myTriaVertexID; - bool myNeedSmooth; + bool myNeedSmooth, myCheckOri; + const StdMeshers_QuadrangleParams* myParams; + StdMeshers_QuadType myQuadType; + + SMESH_MesherHelper* myHelper; + SMESH_ProxyMesh::Ptr myProxyMesh; + std::list< FaceQuadStruct::Ptr > myQuadList; + + struct ForcedPoint + { + gp_XY uv; + gp_XYZ xyz; + TopoDS_Vertex vertex; - StdMeshers_QuadType myQuadType; - SMESH_MesherHelper* myHelper; // tool for working with quadratic elements - SMESH_ProxyMesh::Ptr myProxyMesh; - FaceQuadStruct::Ptr myQuadStruct; + double U() const { return uv.X(); } + double V() const { return uv.Y(); } + operator const gp_XY& () { return uv; } + }; + std::vector< ForcedPoint > myForcedPnts; }; #endif diff --git a/src/StdMeshers/StdMeshers_QuadraticMesh.cxx b/src/StdMeshers/StdMeshers_QuadraticMesh.cxx index be7b65fae..582191183 100644 --- a/src/StdMeshers/StdMeshers_QuadraticMesh.cxx +++ b/src/StdMeshers/StdMeshers_QuadraticMesh.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_QuadraticMesh.hxx b/src/StdMeshers/StdMeshers_QuadraticMesh.hxx index 5f3ee87a2..866b120ad 100644 --- a/src/StdMeshers/StdMeshers_QuadraticMesh.hxx +++ b/src/StdMeshers/StdMeshers_QuadraticMesh.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx index 1814680af..17411417e 100644 --- a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx +++ b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -598,3 +598,57 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, return true; } + +//================================================================================ +/*! + * \brief Return true if the algorithm can mesh this shape + * \param [in] aShape - shape to check + * \param [in] toCheckAll - if true, this check returns OK if all shapes are OK, + * else, returns OK if at least one shape is OK + */ +//================================================================================ + +bool StdMeshers_RadialPrism_3D::IsApplicable( const TopoDS_Shape & aShape, bool toCheckAll ) +{ + bool isCurShellApp; + int nbFoundSolids = 0; + for (TopExp_Explorer exp( aShape, TopAbs_SOLID ); exp.More(); exp.Next(), ++nbFoundSolids ) + { + TopoDS_Shape shell[2]; + int nbShells = 0; + for ( TopoDS_Iterator It (exp.Current()); It.More(); It.Next() ) + { + nbShells++; + if ( nbShells > 2 ) { + if ( toCheckAll ) return false; + break; + } + shell[ nbShells-1 ] = It.Value(); + } + if ( nbShells != 2 ) { + if ( toCheckAll ) return false; + continue; + } + + int nbFaces1 = SMESH_MesherHelper:: Count( shell[0], TopAbs_FACE, 0 ); + int nbFaces2 = SMESH_MesherHelper:: Count( shell[1], TopAbs_FACE, 0 ); + if ( nbFaces1 != nbFaces2 ){ + if( toCheckAll ) return false; + continue; + } + int nbEdges1 = SMESH_MesherHelper:: Count( shell[0], TopAbs_EDGE, 0 ); + int nbEdges2 = SMESH_MesherHelper:: Count( shell[1], TopAbs_EDGE, 0 ); + if ( nbEdges1 != nbEdges2 ){ + if( toCheckAll ) return false; + continue; + } + int nbVertices1 = SMESH_MesherHelper:: Count( shell[0], TopAbs_VERTEX, 0 ); + int nbVertices2 = SMESH_MesherHelper:: Count( shell[1], TopAbs_VERTEX, 0 ); + if ( nbVertices1 != nbVertices2 ){ + if( toCheckAll ) return false; + continue; + } + if ( !toCheckAll ) return true; + } + return ( toCheckAll && nbFoundSolids != 0); +}; diff --git a/src/StdMeshers/StdMeshers_RadialPrism_3D.hxx b/src/StdMeshers/StdMeshers_RadialPrism_3D.hxx index ea9185e30..e1b1f21f4 100644 --- a/src/StdMeshers/StdMeshers_RadialPrism_3D.hxx +++ b/src/StdMeshers/StdMeshers_RadialPrism_3D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -55,6 +55,8 @@ public: virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, MapShapeNbElems& aResMap); + static bool IsApplicable(const TopoDS_Shape & aShape, bool toCheckAll); + protected: typedef std::vector TNodeColumn; diff --git a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx index fde94e9ae..92b294900 100644 --- a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -1281,3 +1281,24 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh, return false; } + +//================================================================================ +/*! + * \brief Return true if applied compute mesh on this shape + */ +//================================================================================ + +bool StdMeshers_RadialQuadrangle_1D2D::IsApplicable( const TopoDS_Shape & aShape, bool toCheckAll ) +{ + int nbFoundFaces = 0; + for (TopExp_Explorer exp( aShape, TopAbs_FACE ); exp.More(); exp.Next(), ++nbFoundFaces ){ + TopoDS_Edge CircEdge, LinEdge1, LinEdge2; + int nbe = analyseFace( exp.Current(), CircEdge, LinEdge1, LinEdge2 ); + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge )); + bool ok = ( nbe <= 3 && nbe >= 1 && !aCirc.IsNull() ); + if( toCheckAll && !ok ) return false; + if( !toCheckAll && ok ) return true; + } + if( toCheckAll && nbFoundFaces != 0 ) return true; + return false; +}; diff --git a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.hxx b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.hxx index 5a1723898..80f117f14 100644 --- a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.hxx +++ b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -59,6 +59,8 @@ public: */ virtual void SubmeshRestored(SMESH_subMesh* subMesh); + static bool IsApplicable(const TopoDS_Shape & aShape, bool toCheckAll); + protected: bool computeLayerPositions(const gp_Pnt& p1, diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index 5377a6fa5..f3449e85d 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -37,6 +37,7 @@ #include "SMESH_subMeshEventListener.hxx" #include "StdMeshers_Adaptive1D.hxx" #include "StdMeshers_Arithmetic1D.hxx" +#include "StdMeshers_Geometric1D.hxx" #include "StdMeshers_AutomaticLength.hxx" #include "StdMeshers_Deflection1D.hxx" #include "StdMeshers_Distribution.hxx" @@ -89,12 +90,14 @@ StdMeshers_Regular_1D::StdMeshers_Regular_1D(int hypId, int studyId, _compatibleHypothesis.push_back("StartEndLength"); _compatibleHypothesis.push_back("Deflection1D"); _compatibleHypothesis.push_back("Arithmetic1D"); + _compatibleHypothesis.push_back("GeometricProgression"); _compatibleHypothesis.push_back("FixedPoints1D"); _compatibleHypothesis.push_back("AutomaticLength"); _compatibleHypothesis.push_back("Adaptive1D"); - - _compatibleHypothesis.push_back("QuadraticMesh"); // auxiliary !!! - _compatibleHypothesis.push_back("Propagation"); // auxiliary !!! + // auxiliary: + _compatibleHypothesis.push_back("QuadraticMesh"); + _compatibleHypothesis.push_back("Propagation"); + _compatibleHypothesis.push_back("PropagOfDistribution"); } //============================================================================= @@ -223,6 +226,21 @@ bool StdMeshers_Regular_1D::CheckHypothesis( SMESH_Mesh& aMesh, aStatus = SMESH_Hypothesis::HYP_OK; } + else if (hypName == "GeometricProgression") + { + const StdMeshers_Geometric1D * hyp = + dynamic_cast (theHyp); + ASSERT(hyp); + _value[ BEG_LENGTH_IND ] = hyp->GetStartLength(); + _value[ END_LENGTH_IND ] = hyp->GetCommonRatio(); + ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 ); + _hypType = GEOMETRIC_1D; + + _revEdgesIDs = hyp->GetReversedEdges(); + + aStatus = SMESH_Hypothesis::HYP_OK; + } + else if (hypName == "FixedPoints1D") { _fpHyp = dynamic_cast (theHyp); ASSERT(_fpHyp); @@ -616,6 +634,58 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, double f = theFirstU, l = theLastU; + // Propagation Of Distribution + // + if ( !_mainEdge.IsNull() && _isPropagOfDistribution ) + { + TopoDS_Edge mainEdge = TopoDS::Edge( _mainEdge ); // should not be a reference! + _gen->Compute( theMesh, mainEdge, /*aShapeOnly=*/true, /*anUpward=*/true); + + SMESHDS_SubMesh* smDS = theMesh.GetMeshDS()->MeshElements( mainEdge ); + if ( !smDS ) + return error("No mesh on the source edge of Propagation Of Distribution"); + if ( smDS->NbNodes() < 1 ) + return true; // 1 segment + + vector< double > mainEdgeParams; + if ( ! SMESH_Algo::GetNodeParamOnEdge( theMesh.GetMeshDS(), mainEdge, mainEdgeParams )) + return error("Bad node parameters on the source edge of Propagation Of Distribution"); + + vector< double > segLen( mainEdgeParams.size() - 1 ); + double totalLen = 0; + BRepAdaptor_Curve mainEdgeCurve( mainEdge ); + for ( size_t i = 1; i < mainEdgeParams.size(); ++i ) + { + segLen[ i-1 ] = GCPnts_AbscissaPoint::Length( mainEdgeCurve, + mainEdgeParams[i-1], + mainEdgeParams[i]); + totalLen += segLen[ i-1 ]; + } + for ( size_t i = 0; i < segLen.size(); ++i ) + segLen[ i ] *= theLength / totalLen; + + size_t iSeg = theReverse ? segLen.size()-1 : 0; + size_t dSeg = theReverse ? -1 : +1; + double param = theFirstU; + int nbParams = 0; + for ( int i = 0, nb = segLen.size()-1; i < nb; ++i, iSeg += dSeg ) + { + GCPnts_AbscissaPoint Discret( theC3d, segLen[ iSeg ], param ); + if ( !Discret.IsDone() ) break; + param = Discret.Parameter(); + theParams.push_back( param ); + ++nbParams; + } + if ( nbParams != segLen.size()-1 ) + return error( SMESH_Comment("Can't divide into ") << segLen.size() << " segements"); + + compensateError( segLen[ theReverse ? segLen.size()-1 : 0 ], + segLen[ theReverse ? 0 : segLen.size()-1 ], + f, l, theLength, theC3d, theParams, true ); + return true; + } + + switch( _hypType ) { case LOCAL_LENGTH: @@ -824,9 +894,54 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, return true; } + case GEOMETRIC_1D: { + + double a1 = _value[ BEG_LENGTH_IND ], an; + double q = _value[ END_LENGTH_IND ]; + + double U1 = theReverse ? l : f; + double Un = theReverse ? f : l; + double param = U1; + double eltSize = a1; + if ( theReverse ) + eltSize = -eltSize; + + int nbParams = 0; + while ( true ) { + // computes a point on a curve at the distance + // from the point of parameter . + GCPnts_AbscissaPoint Discret( theC3d, eltSize, param ); + if ( !Discret.IsDone() ) break; + param = Discret.Parameter(); + if ( f < param && param < l ) + theParams.push_back( param ); + else + break; + an = eltSize; + eltSize *= q; + ++nbParams; + } + if ( nbParams > 1 ) + { + if ( Abs( param - Un ) < 0.2 * Abs( param - theParams.back() )) + { + compensateError( a1, eltSize, U1, Un, theLength, theC3d, theParams ); + } + else if ( Abs( Un - theParams.back() ) < + 0.2 * Abs( theParams.back() - *(--theParams.rbegin()))) + { + theParams.pop_back(); + compensateError( a1, an, U1, Un, theLength, theC3d, theParams ); + } + } + if (theReverse) theParams.reverse(); // NPAL18025 + + return true; + } + case FIXED_POINTS_1D: { const std::vector& aPnts = _fpHyp->GetPoints(); - const std::vector& nbsegs = _fpHyp->GetNbSegments(); + const std::vector& nbsegs = _fpHyp->GetNbSegments(); int i = 0; TColStd_SequenceOfReal Params; for(; i on this edge; diff --git a/src/StdMeshers/StdMeshers_Regular_1D.hxx b/src/StdMeshers/StdMeshers_Regular_1D.hxx index fbb9d0380..7db04d4af 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.hxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -102,7 +102,7 @@ protected: StdMeshers_SegmentLengthAroundVertex* getVertexHyp(SMESH_Mesh & theMesh, const TopoDS_Vertex & theV); - enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, ADAPTIVE, NONE }; + enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, ADAPTIVE, GEOMETRIC_1D, NONE }; enum ValueIndex { SCALE_FACTOR_IND = 0, @@ -140,6 +140,7 @@ protected: // a source of propagated hypothesis, is set by CheckHypothesis() // always called before Compute() TopoDS_Shape _mainEdge; + bool _isPropagOfDistribution; }; #endif diff --git a/src/StdMeshers/StdMeshers_Reversible1D.cxx b/src/StdMeshers/StdMeshers_Reversible1D.cxx new file mode 100644 index 000000000..fe589a9dc --- /dev/null +++ b/src/StdMeshers/StdMeshers_Reversible1D.cxx @@ -0,0 +1,99 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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_Reversible1D.cxx +// Module : SMESH +// + +#include "StdMeshers_Reversible1D.hxx" + +//============================================================================= +/*! + * + */ +//============================================================================= + +StdMeshers_Reversible1D::StdMeshers_Reversible1D(int hypId, int studyId, SMESH_Gen * gen) + :SMESH_Hypothesis(hypId, studyId, gen) +{ + _param_algo_dim = 1; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void StdMeshers_Reversible1D::SetReversedEdges( const std::vector& ids ) +{ + if ( ids != _edgeIDs ) + { + _edgeIDs = ids; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +std::ostream & StdMeshers_Reversible1D::SaveTo(std::ostream & save) +{ + save << " " << _edgeIDs.size() << " "; + + if ( !_edgeIDs.empty() ) + { + for ( size_t i = 0; i < _edgeIDs.size(); i++) + save << " " << _edgeIDs[i]; + save << " " << _objEntry << " "; + } + + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +std::istream & StdMeshers_Reversible1D::LoadFrom(std::istream & load) +{ + bool isOK; + int intVal; + + isOK = (load >> intVal); + if (isOK && intVal > 0) { + _edgeIDs.reserve( intVal ); + for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) { + isOK = (load >> intVal); + if ( isOK ) _edgeIDs.push_back( intVal ); + } + isOK = (load >> _objEntry); + } + + return load; +} diff --git a/src/StdMeshers/StdMeshers_Reversible1D.hxx b/src/StdMeshers/StdMeshers_Reversible1D.hxx new file mode 100644 index 000000000..5a2588c4e --- /dev/null +++ b/src/StdMeshers/StdMeshers_Reversible1D.hxx @@ -0,0 +1,59 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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_Reversible1D.hxx +// Module : SMESH +// +#ifndef _SMESH_Reversible1D_HXX_ +#define _SMESH_Reversible1D_HXX_ + +#include "SMESH_StdMeshers.hxx" +#include "SMESH_Hypothesis.hxx" + +#include + +/*! + * \brief A base of reversible 1D hypotheses + */ +class STDMESHERS_EXPORT StdMeshers_Reversible1D : public SMESH_Hypothesis +{ +public: + StdMeshers_Reversible1D(int hypId, int studyId, SMESH_Gen* gen); + + void SetReversedEdges( const std::vector& ids); + + void SetObjectEntry( const char* entry ) { _objEntry = entry; } + + const char* GetObjectEntry() { return _objEntry.c_str(); } + + const std::vector& GetReversedEdges() const { return _edgeIDs; } + + virtual std::ostream & SaveTo(std::ostream & save); + virtual std::istream & LoadFrom(std::istream & load); + +protected: + std::vector _edgeIDs; + std::string _objEntry; +}; + +#endif diff --git a/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.cxx b/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.cxx index dccb48233..845f7c65a 100644 --- a/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.cxx +++ b/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.hxx b/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.hxx index 40c5113c4..c863445d0 100644 --- a/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.hxx +++ b/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cxx b/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cxx index 9ad1475a5..4e2db58e0 100644 --- a/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cxx +++ b/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.hxx b/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.hxx index cbec5ac71..a3843758e 100644 --- a/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.hxx +++ b/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_StartEndLength.cxx b/src/StdMeshers/StdMeshers_StartEndLength.cxx index 9974f6a3b..7f0e46592 100644 --- a/src/StdMeshers/StdMeshers_StartEndLength.cxx +++ b/src/StdMeshers/StdMeshers_StartEndLength.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_StartEndLength.hxx b/src/StdMeshers/StdMeshers_StartEndLength.hxx index 5c9a9ae69..8f3274db8 100644 --- a/src/StdMeshers/StdMeshers_StartEndLength.hxx +++ b/src/StdMeshers/StdMeshers_StartEndLength.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_UseExisting_1D2D.cxx b/src/StdMeshers/StdMeshers_UseExisting_1D2D.cxx index ee2eb57f6..8dea8bf19 100644 --- a/src/StdMeshers/StdMeshers_UseExisting_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_UseExisting_1D2D.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,6 +25,9 @@ // #include "StdMeshers_UseExisting_1D2D.hxx" +#include "SMESH_Mesh.hxx" +#include "SMESH_subMesh.hxx" + //======================================================================= //function : StdMeshers_UseExisting_1D //purpose : @@ -56,10 +59,11 @@ bool StdMeshers_UseExisting_1D::CheckHypothesis(SMESH_Mesh& , //purpose : //======================================================================= -bool StdMeshers_UseExisting_1D::Compute(SMESH_Mesh&, const TopoDS_Shape&) +bool StdMeshers_UseExisting_1D::Compute(SMESH_Mesh& mesh, const TopoDS_Shape& edge) { // This algorithm exists to allow mesh generation by mesh // edition functions in TUI mode + mesh.GetSubMesh( edge )->SetIsAlwaysComputed( true ); return true; } @@ -110,10 +114,11 @@ bool StdMeshers_UseExisting_2D::CheckHypothesis(SMESH_Mesh& , //purpose : //======================================================================= -bool StdMeshers_UseExisting_2D::Compute(SMESH_Mesh&, const TopoDS_Shape&) +bool StdMeshers_UseExisting_2D::Compute(SMESH_Mesh& mesh, const TopoDS_Shape& face) { // This algorithm exists to allow mesh generation by mesh edition // functions in TUI mode + mesh.GetSubMesh( face )->SetIsAlwaysComputed( true ); return true; } diff --git a/src/StdMeshers/StdMeshers_UseExisting_1D2D.hxx b/src/StdMeshers/StdMeshers_UseExisting_1D2D.hxx index f1cd686a5..4b708461e 100644 --- a/src/StdMeshers/StdMeshers_UseExisting_1D2D.hxx +++ b/src/StdMeshers/StdMeshers_UseExisting_1D2D.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_ViscousLayers.cxx b/src/StdMeshers/StdMeshers_ViscousLayers.cxx index e38c311ad..a012d0292 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers.cxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -35,6 +35,7 @@ #include "SMESH_ControlsDef.hxx" #include "SMESH_Gen.hxx" #include "SMESH_Group.hxx" +#include "SMESH_HypoFilter.hxx" #include "SMESH_Mesh.hxx" #include "SMESH_MeshAlgos.hxx" #include "SMESH_MesherHelper.hxx" @@ -63,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -382,8 +384,10 @@ namespace VISCOUS_3D { TopoDS_Shape _solid; const StdMeshers_ViscousLayers* _hyp; + TopoDS_Shape _hypShape; _MeshOfSolid* _proxyMesh; set _reversedFaceIds; + set _ignoreFaceIds; double _stepSize, _stepSizeCoeff; const SMDS_MeshNode* _stepSizeNodes[2]; @@ -393,10 +397,10 @@ namespace VISCOUS_3D // iteration over the map is 5 time longer than over the vector vector< _LayerEdge* > _edges; - // key: an id of shape (EDGE or VERTEX) shared by a FACE with - // layers and a FACE w/o layers + // key: an id of shape (EDGE or VERTEX) shared by a FACE with + // layers and a FACE w/o layers // value: the shape (FACE or EDGE) to shrink mesh on. - // _LayerEdge's basing on nodes on key shape are inflated along the value shape + // _LayerEdge's basing on nodes on key shape are inflated along the value shape map< TGeomID, TopoDS_Shape > _shrinkShape2Shape; // FACE's WOL, srink on which is forbiden due to algo on the adjacent SOLID @@ -414,7 +418,9 @@ namespace VISCOUS_3D _SolidData(const TopoDS_Shape& s=TopoDS_Shape(), const StdMeshers_ViscousLayers* h=0, - _MeshOfSolid* m=0) :_solid(s), _hyp(h), _proxyMesh(m) {} + const TopoDS_Shape& hs=TopoDS_Shape(), + _MeshOfSolid* m=0) + :_solid(s), _hyp(h), _hypShape(hs), _proxyMesh(m) {} ~_SolidData(); Handle(Geom_Curve) CurveForSmooth( const TopoDS_Edge& E, @@ -517,7 +523,6 @@ namespace VISCOUS_3D SMESH_ComputeErrorPtr _error; vector< _SolidData > _sdVec; - set _ignoreShapeIds; int _tmpFaceID; }; //-------------------------------------------------------------------------------- @@ -617,7 +622,7 @@ namespace VISCOUS_3D // StdMeshers_ViscousLayers::StdMeshers_ViscousLayers(int hypId, int studyId, SMESH_Gen* gen) :SMESH_Hypothesis(hypId, studyId, gen), - _isToIgnoreShapes(18), _nbLayers(1), _thickness(1), _stretchFactor(1) + _isToIgnoreShapes(1), _nbLayers(1), _thickness(1), _stretchFactor(1) { _name = StdMeshers_ViscousLayers::GetHypType(); _param_algo_dim = -3; // auxiliary hyp used by 3D algos @@ -686,7 +691,7 @@ std::ostream & StdMeshers_ViscousLayers::SaveTo(std::ostream & save) << " " << _thickness << " " << _stretchFactor << " " << _shapeIds.size(); - for ( unsigned i = 0; i < _shapeIds.size(); ++i ) + for ( size_t i = 0; i < _shapeIds.size(); ++i ) save << " " << _shapeIds[i]; save << " " << !_isToIgnoreShapes; // negate to keep the behavior in old studies. return save; @@ -788,7 +793,7 @@ namespace // get average dir of edges going fromV gp_XYZ edgeDir; //if ( edges.size() > 1 ) - for ( unsigned i = 0; i < edges.size(); ++i ) + for ( size_t i = 0; i < edges.size(); ++i ) { edgeDir = getEdgeDir( edges[i], fromV ); double size2 = edgeDir.SquareModulus(); @@ -909,9 +914,9 @@ namespace py = new ofstream(fname); *py << "import SMESH" << endl << "from salome.smesh import smeshBuilder" << endl - << "smesh = smeshBuilder.New(salome.myStudy)" << endl + << "smesh = smeshBuilder.New(salome.myStudy)" << endl << "meshSO = smesh.GetCurrentStudy().FindObjectID('0:1:2:3')" << endl - << "mesh = smesh.Mesh( meshSO.GetObject() )"<GetGen(); + SMESH_HypoFilter filter; for ( int i = 1; i <= allSolids.Extent(); ++i ) { // find StdMeshers_ViscousLayers hyp assigned to the i-th solid @@ -1122,10 +1128,14 @@ bool _ViscousBuilder::findSolidsWithLayers() viscHyp = dynamic_cast( *hyp ); if ( viscHyp ) { + TopoDS_Shape hypShape; + filter.Init( filter.Is( viscHyp )); + _mesh->GetHypothesis( allSolids(i), filter, true, &hypShape ); + _MeshOfSolid* proxyMesh = _ViscousListener::GetSolidMesh( _mesh, allSolids(i), /*toCreate=*/true); - _sdVec.push_back( _SolidData( allSolids(i), viscHyp, proxyMesh )); + _sdVec.push_back( _SolidData( allSolids(i), viscHyp, hypShape, proxyMesh )); _sdVec.back()._index = getMeshDS()->ShapeToIndex( allSolids(i)); } } @@ -1144,44 +1154,69 @@ bool _ViscousBuilder::findSolidsWithLayers() bool _ViscousBuilder::findFacesWithLayers() { + SMESH_MesherHelper helper( *_mesh ); + TopExp_Explorer exp; + TopTools_IndexedMapOfShape solids; + // collect all faces to ignore defined by hyp - vector ignoreFaces; - for ( unsigned i = 0; i < _sdVec.size(); ++i ) + for ( size_t i = 0; i < _sdVec.size(); ++i ) { + solids.Add( _sdVec[i]._solid ); + vector ids = _sdVec[i]._hyp->GetBndShapes(); - for ( unsigned i = 0; i < ids.size(); ++i ) + if ( _sdVec[i]._hyp->IsToIgnoreShapes() ) // FACEs to ignore are given { - const TopoDS_Shape& s = getMeshDS()->IndexToShape( ids[i] ); - if ( !s.IsNull() && s.ShapeType() == TopAbs_FACE ) + for ( size_t ii = 0; ii < ids.size(); ++ii ) { - _ignoreShapeIds.insert( ids[i] ); - ignoreFaces.push_back( s ); + const TopoDS_Shape& s = getMeshDS()->IndexToShape( ids[ii] ); + if ( !s.IsNull() && s.ShapeType() == TopAbs_FACE ) + _sdVec[i]._ignoreFaceIds.insert( ids[ii] ); + } + } + else // FACEs with layers are given + { + exp.Init( _sdVec[i]._solid, TopAbs_FACE ); + for ( ; exp.More(); exp.Next() ) + { + TGeomID faceInd = getMeshDS()->ShapeToIndex( exp.Current() ); + if ( find( ids.begin(), ids.end(), faceInd ) == ids.end() ) + _sdVec[i]._ignoreFaceIds.insert( faceInd ); } } - } - // ignore internal faces - SMESH_MesherHelper helper( *_mesh ); - TopExp_Explorer exp; - for ( unsigned i = 0; i < _sdVec.size(); ++i ) - { - exp.Init( _sdVec[i]._solid.Oriented( TopAbs_FORWARD ), TopAbs_FACE ); - for ( ; exp.More(); exp.Next() ) + // ignore internal FACEs if inlets and outlets are specified { - TGeomID faceInd = getMeshDS()->ShapeToIndex( exp.Current() ); - if ( helper.NbAncestors( exp.Current(), *_mesh, TopAbs_SOLID ) > 1 ) - { - _ignoreShapeIds.insert( faceInd ); - ignoreFaces.push_back( exp.Current() ); - if ( helper.IsReversedSubMesh( TopoDS::Face( exp.Current() ))) + TopTools_IndexedDataMapOfShapeListOfShape solidsOfFace; + if ( _sdVec[i]._hyp->IsToIgnoreShapes() ) + TopExp::MapShapesAndAncestors( _sdVec[i]._hypShape, + TopAbs_FACE, TopAbs_SOLID, solidsOfFace); + + exp.Init( _sdVec[i]._solid.Oriented( TopAbs_FORWARD ), TopAbs_FACE ); + for ( ; exp.More(); exp.Next() ) + { + const TopoDS_Face& face = TopoDS::Face( exp.Current() ); + if ( helper.NbAncestors( face, *_mesh, TopAbs_SOLID ) < 2 ) + continue; + + const TGeomID faceInd = getMeshDS()->ShapeToIndex( face ); + if ( _sdVec[i]._hyp->IsToIgnoreShapes() ) + { + int nbSolids = solidsOfFace.FindFromKey( face ).Extent(); + if ( nbSolids > 1 ) + _sdVec[i]._ignoreFaceIds.insert( faceInd ); + } + + if ( helper.IsReversedSubMesh( face )) + { _sdVec[i]._reversedFaceIds.insert( faceInd ); + } } } } // Find faces to shrink mesh on (solution 2 in issue 0020832); TopTools_IndexedMapOfShape shapes; - for ( unsigned i = 0; i < _sdVec.size(); ++i ) + for ( size_t i = 0; i < _sdVec.size(); ++i ) { shapes.Clear(); TopExp::MapShapes(_sdVec[i]._solid, TopAbs_EDGE, shapes); @@ -1201,18 +1236,35 @@ bool _ViscousBuilder::findFacesWithLayers() // check presence of layers on them int ignore[2]; for ( int j = 0; j < 2; ++j ) - ignore[j] = _ignoreShapeIds.count ( getMeshDS()->ShapeToIndex( FF[j] )); - if ( ignore[0] == ignore[1] ) continue; // nothing interesting + ignore[j] = _sdVec[i]._ignoreFaceIds.count ( getMeshDS()->ShapeToIndex( FF[j] )); + if ( ignore[0] == ignore[1] ) + continue; // nothing interesting TopoDS_Shape fWOL = FF[ ignore[0] ? 0 : 1 ]; + // check presence of layers on fWOL within an adjacent SOLID + PShapeIteratorPtr sIt = helper.GetAncestors( fWOL, *_mesh, TopAbs_SOLID ); + while ( const TopoDS_Shape* solid = sIt->next() ) + if ( !solid->IsSame( _sdVec[i]._solid )) + { + int iSolid = solids.FindIndex( *solid ); + int iFace = getMeshDS()->ShapeToIndex( fWOL ); + if ( iSolid > 0 && !_sdVec[ iSolid-1 ]._ignoreFaceIds.count( iFace )) + { + _sdVec[i]._noShrinkFaces.insert( iFace ); + fWOL.Nullify(); + } + } // add edge to maps - TGeomID edgeInd = getMeshDS()->ShapeToIndex( edge ); - _sdVec[i]._shrinkShape2Shape.insert( make_pair( edgeInd, fWOL )); + if ( !fWOL.IsNull()) + { + TGeomID edgeInd = getMeshDS()->ShapeToIndex( edge ); + _sdVec[i]._shrinkShape2Shape.insert( make_pair( edgeInd, fWOL )); + } } } // Exclude from _shrinkShape2Shape FACE's that can't be shrinked since // the algo of the SOLID sharing the FACE does not support it set< string > notSupportAlgos; notSupportAlgos.insert("Hexa_3D"); - for ( unsigned i = 0; i < _sdVec.size(); ++i ) + for ( size_t i = 0; i < _sdVec.size(); ++i ) { TopTools_MapOfShape noShrinkVertices; map< TGeomID, TopoDS_Shape >::iterator e2f = _sdVec[i]._shrinkShape2Shape.begin(); @@ -1229,7 +1281,7 @@ bool _ViscousBuilder::findFacesWithLayers() SMESH_Algo* algo = _mesh->GetGen()->GetAlgo( *_mesh, *solid ); if ( !algo || !notSupportAlgos.count( algo->GetName() )) continue; notShrinkFace = true; - for ( unsigned j = 0; j < _sdVec.size(); ++j ) + for ( size_t j = 0; j < _sdVec.size(); ++j ) { if ( _sdVec[j]._solid.IsSame( *solid ) ) if ( _sdVec[j]._shrinkShape2Shape.count( edgeID )) @@ -1262,10 +1314,10 @@ bool _ViscousBuilder::findFacesWithLayers() } } } - + // Find the SHAPE along which to inflate _LayerEdge based on VERTEX - for ( unsigned i = 0; i < _sdVec.size(); ++i ) + for ( size_t i = 0; i < _sdVec.size(); ++i ) { shapes.Clear(); TopExp::MapShapes(_sdVec[i]._solid, TopAbs_VERTEX, shapes); @@ -1279,11 +1331,12 @@ bool _ViscousBuilder::findFacesWithLayers() while ( fIt->more()) { const TopoDS_Shape* f = fIt->next(); - const int fID = getMeshDS()->ShapeToIndex( *f ); if ( helper.IsSubShape( *f, _sdVec[i]._solid ) ) { totalNbFaces++; - if ( _ignoreShapeIds.count ( fID ) && ! _sdVec[i]._noShrinkFaces.count( fID )) + const int fID = getMeshDS()->ShapeToIndex( *f ); + if ( _sdVec[i]._ignoreFaceIds.count ( fID ) && + !_sdVec[i]._noShrinkFaces.count( fID )) facesWOL.push_back( *f ); } } @@ -1293,42 +1346,42 @@ bool _ViscousBuilder::findFacesWithLayers() switch ( facesWOL.size() ) { case 1: + { + helper.SetSubShape( facesWOL[0] ); + if ( helper.IsRealSeam( vInd )) // inflate along a seam edge? { - helper.SetSubShape( facesWOL[0] ); - if ( helper.IsRealSeam( vInd )) // inflate along a seam edge? + TopoDS_Shape seamEdge; + PShapeIteratorPtr eIt = helper.GetAncestors(vertex, *_mesh, TopAbs_EDGE); + while ( eIt->more() && seamEdge.IsNull() ) { - TopoDS_Shape seamEdge; - PShapeIteratorPtr eIt = helper.GetAncestors(vertex, *_mesh, TopAbs_EDGE); - while ( eIt->more() && seamEdge.IsNull() ) - { - const TopoDS_Shape* e = eIt->next(); - if ( helper.IsRealSeam( *e ) ) - seamEdge = *e; - } - if ( !seamEdge.IsNull() ) - { - _sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, seamEdge )); - break; - } + const TopoDS_Shape* e = eIt->next(); + if ( helper.IsRealSeam( *e ) ) + seamEdge = *e; + } + if ( !seamEdge.IsNull() ) + { + _sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, seamEdge )); + break; } - _sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, facesWOL[0] )); - break; } + _sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, facesWOL[0] )); + break; + } case 2: + { + // find an edge shared by 2 faces + PShapeIteratorPtr eIt = helper.GetAncestors(vertex, *_mesh, TopAbs_EDGE); + while ( eIt->more()) { - // find an edge shared by 2 faces - PShapeIteratorPtr eIt = helper.GetAncestors(vertex, *_mesh, TopAbs_EDGE); - while ( eIt->more()) + const TopoDS_Shape* e = eIt->next(); + if ( helper.IsSubShape( *e, facesWOL[0]) && + helper.IsSubShape( *e, facesWOL[1])) { - const TopoDS_Shape* e = eIt->next(); - if ( helper.IsSubShape( *e, facesWOL[0]) && - helper.IsSubShape( *e, facesWOL[1])) - { - _sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, *e )); break; - } + _sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, *e )); break; } - break; } + break; + } default: return error("Not yet supported case", _sdVec[i]._index); } @@ -1351,10 +1404,10 @@ bool _ViscousBuilder::makeLayer(_SolidData& data) subIds = data._noShrinkFaces; TopExp_Explorer exp( data._solid, TopAbs_FACE ); for ( ; exp.More(); exp.Next() ) - if ( ! _ignoreShapeIds.count( getMeshDS()->ShapeToIndex( exp.Current() ))) { SMESH_subMesh* fSubM = _mesh->GetSubMesh( exp.Current() ); - faceIds.insert( fSubM->GetId() ); + if ( ! data._ignoreFaceIds.count( getMeshDS()->ShapeToIndex( exp.Current() ))) + faceIds.insert( fSubM->GetId() ); SMESH_subMeshIteratorPtr subIt = fSubM->getDependsOnIterator(/*includeSelf=*/true, /*complexShapeFirst=*/false); while ( subIt->more() ) @@ -1368,7 +1421,7 @@ bool _ViscousBuilder::makeLayer(_SolidData& data) for (; s2s != data._shrinkShape2Shape.end(); ++s2s ) { TGeomID shapeInd = s2s->first; - for ( unsigned i = 0; i < _sdVec.size(); ++i ) + for ( size_t i = 0; i < _sdVec.size(); ++i ) { if ( _sdVec[i]._index == data._index ) continue; map< TGeomID, TopoDS_Shape >::iterator s2s2 = _sdVec[i]._shrinkShape2Shape.find( shapeInd ); @@ -1475,7 +1528,7 @@ bool _ViscousBuilder::makeLayer(_SolidData& data) // Set target nodes into _Simplex and _2NearEdges TNode2Edge::iterator n2e; - for ( unsigned i = 0; i < data._edges.size(); ++i ) + for ( size_t i = 0; i < data._edges.size(); ++i ) { if ( data._edges[i]->IsOnEdge()) for ( int j = 0; j < 2; ++j ) @@ -1489,7 +1542,7 @@ bool _ViscousBuilder::makeLayer(_SolidData& data) data._edges[i]->_2neibors->_edges[j] = n2e->second; } else - for ( unsigned j = 0; j < data._edges[i]->_simplices.size(); ++j ) + for ( size_t j = 0; j < data._edges[i]->_simplices.size(); ++j ) { _Simplex& s = data._edges[i]->_simplices[j]; s._nNext = data._n2eMap[ s._nNext ]->_nodes.back(); @@ -1573,7 +1626,7 @@ bool _ViscousBuilder::sortEdges( _SolidData& data, SMESH_MesherHelper helper( *_mesh ); bool ok = true; - for ( unsigned iS = 0; iS < edgesByGeom.size(); ++iS ) + for ( size_t iS = 0; iS < edgesByGeom.size(); ++iS ) { vector<_LayerEdge*>& eS = edgesByGeom[iS]; if ( eS.empty() ) continue; @@ -1617,7 +1670,7 @@ bool _ViscousBuilder::sortEdges( _SolidData& data, if ( eE.empty() ) continue; if ( eE[0]->_sWOL.IsNull() ) { - for ( unsigned i = 0; i < eE.size() && !needSmooth; ++i ) + for ( size_t i = 0; i < eE.size() && !needSmooth; ++i ) needSmooth = ( eE[i]->_cosin > 0.1 ); } else @@ -1625,7 +1678,7 @@ bool _ViscousBuilder::sortEdges( _SolidData& data, const TopoDS_Face& F1 = TopoDS::Face( S ); const TopoDS_Face& F2 = TopoDS::Face( eE[0]->_sWOL ); const TopoDS_Edge& E = TopoDS::Edge( eExp.Current() ); - for ( unsigned i = 0; i < eE.size() && !needSmooth; ++i ) + for ( size_t i = 0; i < eE.size() && !needSmooth; ++i ) { gp_Vec dir1 = getFaceDir( F1, E, eE[i]->_nodes[0], helper, ok ); gp_Vec dir2 = getFaceDir( F2, E, eE[i]->_nodes[0], helper, ok ); @@ -1664,7 +1717,7 @@ bool _ViscousBuilder::sortEdges( _SolidData& data, } // then the rest _LayerEdge's - for ( unsigned iS = 0; iS < edgesByGeom.size(); ++iS ) + for ( size_t iS = 0; iS < edgesByGeom.size(); ++iS ) { vector<_LayerEdge*>& eVec = edgesByGeom[iS]; data._edges.insert( data._edges.end(), eVec.begin(), eVec.end() ); @@ -1870,9 +1923,9 @@ bool _ViscousBuilder::setEdgeData(_LayerEdge& edge, if ( posType == SMDS_TOP_FACE ) { - getSimplices( node, edge._simplices, _ignoreShapeIds, &data ); + getSimplices( node, edge._simplices, data._ignoreFaceIds, &data ); double avgNormProj = 0, avgLen = 0; - for ( unsigned i = 0; i < edge._simplices.size(); ++i ) + for ( size_t i = 0; i < edge._simplices.size(); ++i ) { gp_XYZ vec = edge._pos.back() - SMESH_TNodeXYZ( edge._simplices[i]._nPrev ); avgNormProj += edge._normal * vec; @@ -2103,7 +2156,7 @@ void _ViscousBuilder::getSimplices( const SMDS_MeshNode* node, void _ViscousBuilder::makeGroupOfLE() { #ifdef _DEBUG_ - for ( unsigned i = 0 ; i < _sdVec.size(); ++i ) + for ( size_t i = 0 ; i < _sdVec.size(); ++i ) { if ( _sdVec[i]._edges.empty() ) continue; // string name = SMESH_Comment("_LayerEdge's_") << i; @@ -2113,10 +2166,10 @@ void _ViscousBuilder::makeGroupOfLE() // SMESHDS_Mesh* mDS = _mesh->GetMeshDS(); dumpFunction( SMESH_Comment("make_LayerEdge_") << i ); - for ( unsigned j = 0 ; j < _sdVec[i]._edges.size(); ++j ) + for ( size_t j = 0 ; j < _sdVec[i]._edges.size(); ++j ) { _LayerEdge* le = _sdVec[i]._edges[j]; - for ( unsigned iN = 1; iN < le->_nodes.size(); ++iN ) + for ( size_t iN = 1; iN < le->_nodes.size(); ++iN ) dumpCmd(SMESH_Comment("mesh.AddEdge([ ") <_nodes[iN-1]->GetID() << ", " << le->_nodes[iN]->GetID() <<"])"); //gDS->SMDSGroup().Add( mDS->AddEdge( le->_nodes[iN-1], le->_nodes[iN])); @@ -2124,7 +2177,7 @@ void _ViscousBuilder::makeGroupOfLE() dumpFunctionEnd(); dumpFunction( SMESH_Comment("makeNormals") << i ); - for ( unsigned j = 0 ; j < _sdVec[i]._edges.size(); ++j ) + for ( size_t j = 0 ; j < _sdVec[i]._edges.size(); ++j ) { _LayerEdge& edge = *_sdVec[i]._edges[j]; SMESH_TNodeXYZ nXYZ( edge._nodes[0] ); @@ -2178,7 +2231,7 @@ bool _ViscousBuilder::inflate(_SolidData& data) auto_ptr searcher ( SMESH_MeshAlgos::GetElementSearcher( *getMeshDS(), data._proxyMesh->GetFaces( data._solid )) ); - for ( unsigned i = 0; i < data._edges.size(); ++i ) + for ( size_t i = 0; i < data._edges.size(); ++i ) { if ( data._edges[i]->IsOnEdge() ) continue; data._edges[i]->FindIntersection( *searcher, intersecDist, data._epsilon ); @@ -2213,7 +2266,7 @@ bool _ViscousBuilder::inflate(_SolidData& data) // Elongate _LayerEdge's dumpFunction(SMESH_Comment("inflate")<SetNewLength( curThick, helper ); } @@ -2229,7 +2282,7 @@ bool _ViscousBuilder::inflate(_SolidData& data) if ( nbSteps > 0 ) { dumpFunction(SMESH_Comment("invalidate")<InvalidateStep( nbSteps+1 ); } @@ -2241,7 +2294,7 @@ bool _ViscousBuilder::inflate(_SolidData& data) // Evaluate achieved thickness avgThick = 0; - for ( unsigned i = 0; i < data._edges.size(); ++i ) + for ( size_t i = 0; i < data._edges.size(); ++i ) avgThick += data._edges[i]->_len; avgThick /= data._edges.size(); #ifdef __myDEBUG @@ -2289,7 +2342,7 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data, TopoDS_Face F; int iBeg, iEnd = 0; - for ( unsigned iS = 0; iS < data._endEdgeToSmooth.size(); ++iS ) + for ( size_t iS = 0; iS < data._endEdgeToSmooth.size(); ++iS ) { iBeg = iEnd; iEnd = data._endEdgeToSmooth[ iS ]; @@ -2355,7 +2408,7 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data, { _LayerEdge* edge = data._edges[i]; SMESH_TNodeXYZ tgtXYZ( edge->_nodes.back() ); - for ( unsigned j = 0; j < edge->_simplices.size(); ++j ) + for ( size_t j = 0; j < edge->_simplices.size(); ++j ) if ( !edge->_simplices[j].IsForward( edge->_nodes[0], &tgtXYZ )) { cout << "Bad simplex ( " << edge->_nodes[0]->GetID()<< " "<< tgtXYZ._node->GetID() @@ -2384,7 +2437,7 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data, const SMDS_MeshElement* closestFace = 0; int iLE = 0; #endif - for ( unsigned i = 0; i < data._edges.size(); ++i ) + for ( size_t i = 0; i < data._edges.size(); ++i ) { if ( data._edges[i]->FindIntersection( *searcher, dist, data._epsilon, &intFace )) return false; @@ -2695,7 +2748,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data, vector< const SMDS_MeshNode*> nodes(4); // of a tmp mesh face dumpFunction(SMESH_Comment("makeTmpFacesOnEdges")<IsOnEdge() || !edge->_sWOL.IsNull() ) continue; @@ -2712,7 +2765,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data, } // look for a _LayerEdge containg tgt2 // _LayerEdge* neiborEdge = 0; -// unsigned di = 0; // check _edges[i+di] and _edges[i-di] +// size_t di = 0; // check _edges[i+di] and _edges[i-di] // while ( !neiborEdge && ++di <= data._edges.size() ) // { // if ( i+di < data._edges.size() && data._edges[i+di]->_nodes.back() == tgt2 ) @@ -2751,7 +2804,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data, TLEdge2LEdgeSet edge2CloseEdge; const double eps = data._epsilon * data._epsilon; - for ( unsigned i = 0; i < data._edges.size(); ++i ) + for ( size_t i = 0; i < data._edges.size(); ++i ) { _LayerEdge* edge = data._edges[i]; if ( !edge->IsOnEdge() || !edge->_sWOL.IsNull() ) continue; @@ -2922,7 +2975,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data, // 2) Check absence of intersections // TODO? - for ( unsigned i = 0 ; i < tmpFaces.size(); ++i ) + for ( size_t i = 0 ; i < tmpFaces.size(); ++i ) delete tmpFaces[i]; return true; @@ -2948,7 +3001,7 @@ bool _LayerEdge::FindIntersection( SMESH_ElementSearcher& searcher, bool segmentIntersected = false; distance = Precision::Infinite(); int iFace = -1; // intersected face - for ( unsigned j = 0 ; j < suspectFaces.size() && !segmentIntersected; ++j ) + for ( size_t j = 0 ; j < suspectFaces.size() && !segmentIntersected; ++j ) { const SMDS_MeshElement* face = suspectFaces[j]; if ( face->GetNodeIndex( _nodes.back() ) >= 0 || @@ -3236,7 +3289,7 @@ bool _LayerEdge::Smooth(int& badNb) // compute new position for the last _pos gp_XYZ newPos (0,0,0); - for ( unsigned i = 0; i < _simplices.size(); ++i ) + for ( size_t i = 0; i < _simplices.size(); ++i ) newPos += SMESH_TNodeXYZ( _simplices[i]._nPrev ); newPos /= _simplices.size(); @@ -3259,11 +3312,11 @@ bool _LayerEdge::Smooth(int& badNb) // count quality metrics (orientation) of tetras around _tgtNode int nbOkBefore = 0; SMESH_TNodeXYZ tgtXYZ( _nodes.back() ); - for ( unsigned i = 0; i < _simplices.size(); ++i ) + for ( size_t i = 0; i < _simplices.size(); ++i ) nbOkBefore += _simplices[i].IsForward( _nodes[0], &tgtXYZ ); int nbOkAfter = 0; - for ( unsigned i = 0; i < _simplices.size(); ++i ) + for ( size_t i = 0; i < _simplices.size(); ++i ) nbOkAfter += _simplices[i].IsForward( _nodes[0], &newPos ); if ( nbOkAfter < nbOkBefore ) @@ -3389,14 +3442,14 @@ bool _ViscousBuilder::refine(_SolidData& data) gp_XY uv; bool isOnEdge; - for ( unsigned i = 0; i < data._edges.size(); ++i ) + for ( size_t i = 0; i < data._edges.size(); ++i ) { _LayerEdge& edge = *data._edges[i]; // get accumulated length of segments vector< double > segLen( edge._pos.size() ); segLen[0] = 0.0; - for ( unsigned j = 1; j < edge._pos.size(); ++j ) + for ( size_t j = 1; j < edge._pos.size(); ++j ) segLen[j] = segLen[j-1] + (edge._pos[j-1] - edge._pos[j] ).Modulus(); // allocate memory for new nodes if it is not yet refined @@ -3444,8 +3497,8 @@ bool _ViscousBuilder::refine(_SolidData& data) // create intermediate nodes double hSum = 0, hi = h0/f; - unsigned iSeg = 1; - for ( unsigned iStep = 1; iStep < edge._nodes.size(); ++iStep ) + size_t iSeg = 1; + for ( size_t iStep = 1; iStep < edge._nodes.size(); ++iStep ) { // compute an intermediate position hi *= f; @@ -3512,7 +3565,7 @@ bool _ViscousBuilder::refine(_SolidData& data) if ( !getMeshDS()->IsEmbeddedMode() ) // Log node movement - for ( unsigned i = 0; i < data._edges.size(); ++i ) + for ( size_t i = 0; i < data._edges.size(); ++i ) { _LayerEdge& edge = *data._edges[i]; SMESH_TNodeXYZ p ( edge._nodes.back() ); @@ -3526,7 +3579,7 @@ bool _ViscousBuilder::refine(_SolidData& data) TopExp_Explorer exp( data._solid, TopAbs_FACE ); for ( ; exp.More(); exp.Next() ) { - if ( _ignoreShapeIds.count( getMeshDS()->ShapeToIndex( exp.Current() ))) + if ( data._ignoreFaceIds.count( getMeshDS()->ShapeToIndex( exp.Current() ))) continue; SMESHDS_SubMesh* fSubM = getMeshDS()->MeshElements( exp.Current() ); SMDS_ElemIteratorPtr fIt = fSubM->GetElements(); @@ -3577,7 +3630,7 @@ bool _ViscousBuilder::shrink() // make map of (ids of FACEs to shrink mesh on) to (_SolidData containing _LayerEdge's // inflated along FACE or EDGE) map< TGeomID, _SolidData* > f2sdMap; - for ( unsigned i = 0 ; i < _sdVec.size(); ++i ) + for ( size_t i = 0 ; i < _sdVec.size(); ++i ) { _SolidData& data = _sdVec[i]; TopTools_MapOfShape FFMap; @@ -3684,7 +3737,7 @@ bool _ViscousBuilder::shrink() // Replace source nodes by target nodes in mesh faces to shrink const SMDS_MeshNode* nodes[20]; - for ( unsigned i = 0; i < lEdges.size(); ++i ) + for ( size_t i = 0; i < lEdges.size(); ++i ) { _LayerEdge& edge = *lEdges[i]; const SMDS_MeshNode* srcNode = edge._nodes[0]; @@ -3712,7 +3765,7 @@ bool _ViscousBuilder::shrink() vector< _SmoothNode > nodesToSmooth( smoothNodes.size() ); { const bool sortSimplices = isConcaveFace; - for ( unsigned i = 0; i < smoothNodes.size(); ++i ) + for ( size_t i = 0; i < smoothNodes.size(); ++i ) { const SMDS_MeshNode* n = smoothNodes[i]; nodesToSmooth[ i ]._node = n; @@ -3728,7 +3781,7 @@ bool _ViscousBuilder::shrink() // Find EDGE's to shrink and set simpices to LayerEdge's set< _Shrinker1D* > eShri1D; { - for ( unsigned i = 0; i < lEdges.size(); ++i ) + for ( size_t i = 0; i < lEdges.size(); ++i ) { _LayerEdge* edge = lEdges[i]; if ( edge->_sWOL.ShapeType() == TopAbs_EDGE ) @@ -3801,7 +3854,7 @@ bool _ViscousBuilder::shrink() int oldBadNb = badNb; badNb = 0; moved = false; - for ( unsigned i = 0; i < nodesToSmooth.size(); ++i ) + for ( size_t i = 0; i < nodesToSmooth.size(); ++i ) { moved |= nodesToSmooth[i].Smooth( badNb,surface,helper,refSign, smoothType, /*set3D=*/isConcaveFace); @@ -3870,7 +3923,7 @@ bool _ViscousBuilder::shrink() case 3: smoothType = _SmoothNode::ANGULAR; break; } dumpFunction(SMESH_Comment("shrinkFace")<first<<"_st"<<++smooStep); // debug - for ( unsigned i = 0; i < nodesToSmooth.size(); ++i ) + for ( size_t i = 0; i < nodesToSmooth.size(); ++i ) { nodesToSmooth[i].Smooth( badNb,surface,helper,refSign, smoothType,/*set3D=*/st==1 ); @@ -3883,7 +3936,7 @@ bool _ViscousBuilder::shrink() if ( !getMeshDS()->IsEmbeddedMode() ) // Log node movement - for ( unsigned i = 0; i < nodesToSmooth.size(); ++i ) + for ( size_t i = 0; i < nodesToSmooth.size(); ++i ) { SMESH_TNodeXYZ p ( nodesToSmooth[i]._node ); getMeshDS()->MoveNode( nodesToSmooth[i]._node, p.X(), p.Y(), p.Z() ); @@ -3937,7 +3990,7 @@ bool _ViscousBuilder::prepareEdgeToShrink( _LayerEdge& edge, // if ( faceSubMesh->Contains( f )) // faces.push_back( f ); // } - // for ( unsigned i = 0; i < faces.size(); ++i ) + // for ( size_t i = 0; i < faces.size(); ++i ) // { // const int nbNodes = faces[i]->NbCornerNodes(); // for ( int j = 0; j < nbNodes; ++j ) @@ -4397,11 +4450,11 @@ bool _SmoothNode::Smooth(int& badNb, // count quality metrics (orientation) of triangles around the node int nbOkBefore = 0; gp_XY tgtUV = helper.GetNodeUV( face, _node ); - for ( unsigned i = 0; i < _simplices.size(); ++i ) + for ( size_t i = 0; i < _simplices.size(); ++i ) nbOkBefore += _simplices[i].IsForward( tgtUV, _node, face, helper, refSign ); int nbOkAfter = 0; - for ( unsigned i = 0; i < _simplices.size(); ++i ) + for ( size_t i = 0; i < _simplices.size(); ++i ) nbOkAfter += _simplices[i].IsForward( newPos, _node, face, helper, refSign ); if ( nbOkAfter < nbOkBefore ) @@ -4496,7 +4549,7 @@ gp_XY _SmoothNode::computeAngularPos(vector& uv, _SolidData::~_SolidData() { - for ( unsigned i = 0; i < _edges.size(); ++i ) + for ( size_t i = 0; i < _edges.size(); ++i ) { if ( _edges[i] && _edges[i]->_2neibors ) delete _edges[i]->_2neibors; @@ -4569,7 +4622,7 @@ void _Shrinker1D::AddEdge( const _LayerEdge* e, SMESH_MesherHelper& helper ) { // remove target node of the _LayerEdge from _nodes int nbFound = 0; - for ( unsigned i = 0; i < _nodes.size(); ++i ) + for ( size_t i = 0; i < _nodes.size(); ++i ) if ( !_nodes[i] || _nodes[i] == tgtNode0 || _nodes[i] == tgtNode1 ) _nodes[i] = 0, nbFound++; if ( nbFound == _nodes.size() ) @@ -4607,7 +4660,7 @@ void _Shrinker1D::Compute(bool set3D, SMESH_MesherHelper& helper) l = helper.GetNodeU( E, _edges[1]->_nodes.back(), _nodes.back() ); double totLen = GCPnts_AbscissaPoint::Length( aCurve, f, l ); - for ( unsigned i = 0; i < _nodes.size(); ++i ) + for ( size_t i = 0; i < _nodes.size(); ++i ) { if ( !_nodes[i] ) continue; double len = totLen * _normPar[i]; @@ -4629,7 +4682,7 @@ void _Shrinker1D::Compute(bool set3D, SMESH_MesherHelper& helper) if ( _edges[1] ) l = helper.GetNodeU( E, _edges[1]->_nodes.back(), _nodes.back() ); - for ( unsigned i = 0; i < _nodes.size(); ++i ) + for ( size_t i = 0; i < _nodes.size(); ++i ) { if ( !_nodes[i] ) continue; double u = f * ( 1-_normPar[i] ) + l * _normPar[i]; @@ -4648,7 +4701,7 @@ void _Shrinker1D::Compute(bool set3D, SMESH_MesherHelper& helper) void _Shrinker1D::RestoreParams() { if ( _done ) - for ( unsigned i = 0; i < _nodes.size(); ++i ) + for ( size_t i = 0; i < _nodes.size(); ++i ) { if ( !_nodes[i] ) continue; SMDS_EdgePosition* pos = static_cast( _nodes[i]->GetPosition() ); @@ -4701,7 +4754,7 @@ bool _ViscousBuilder::addBoundaryElements() { SMESH_MesherHelper helper( *_mesh ); - for ( unsigned i = 0; i < _sdVec.size(); ++i ) + for ( size_t i = 0; i < _sdVec.size(); ++i ) { _SolidData& data = _sdVec[i]; TopTools_IndexedMapOfShape geomEdges; @@ -4772,7 +4825,7 @@ bool _ViscousBuilder::addBoundaryElements() { const TopoDS_Shape* pF = fIt->next(); if ( helper.IsSubShape( *pF, data._solid) && - !_ignoreShapeIds.count( e2f->first )) + !data._ignoreFaceIds.count( e2f->first )) F = *pF; } } @@ -4788,7 +4841,7 @@ bool _ViscousBuilder::addBoundaryElements() // Make faces const int dj1 = reverse ? 0 : 1; const int dj2 = reverse ? 1 : 0; - for ( unsigned j = 1; j < ledges.size(); ++j ) + for ( size_t j = 1; j < ledges.size(); ++j ) { vector< const SMDS_MeshNode*>& nn1 = ledges[j-dj1]->_nodes; vector< const SMDS_MeshNode*>& nn2 = ledges[j-dj2]->_nodes; diff --git a/src/StdMeshers/StdMeshers_ViscousLayers.hxx b/src/StdMeshers/StdMeshers_ViscousLayers.hxx index b62e165b0..5fe0a7b80 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers.hxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers/StdMeshers_ViscousLayers2D.cxx b/src/StdMeshers/StdMeshers_ViscousLayers2D.cxx index 96dbbad62..7e5134380 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers2D.cxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers2D.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -389,6 +389,7 @@ namespace VISCOUS_2D TSideVector _faceSideVec; // wires (StdMeshers_FaceSide) of _face vector<_PolyLine> _polyLineVec; // fronts to advance bool _is2DIsotropic; // is same U and V resoulution of _face + vector _clearedFaces; // FACEs whose mesh was removed by shrink() double _fPowN; // to compute thickness of layers double _thickness; // required or possible layers thickness @@ -633,25 +634,31 @@ bool _ViscousBuilder2D::findEdgesWithLayers(const TopoDS_Shape& theShapeHypAssig // collect all EDGEs to ignore defined by hyp int nbMyEdgesIgnored = getEdgesToIgnore( _hyp, _face, getMeshDS(), _ignoreShapeIds ); - // check all EDGEs of the _face - int totalNbEdges = 0; + // get all shared EDGEs + TopTools_MapOfShape sharedEdges; TopTools_IndexedDataMapOfShapeListOfShape facesOfEdgeMap; TopExp::MapShapesAndAncestors( theShapeHypAssignedTo, TopAbs_EDGE, TopAbs_FACE, facesOfEdgeMap); + for ( int iE = 1; iE <= facesOfEdgeMap.Extent(); ++iE ) + if ( facesOfEdgeMap( iE ).Extent() > 1 ) + sharedEdges.Add( facesOfEdgeMap.FindKey( iE )); + + // check all EDGEs of the _face + int totalNbEdges = 0; for ( size_t iWire = 0; iWire < _faceSideVec.size(); ++iWire ) { StdMeshers_FaceSidePtr wire = _faceSideVec[ iWire ]; totalNbEdges += wire->NbEdges(); for ( int iE = 0; iE < wire->NbEdges(); ++iE ) { - const TopTools_ListOfShape& faceList = facesOfEdgeMap.FindFromKey( wire->Edge( iE )); - if ( faceList.Extent() > 1 ) + if ( sharedEdges.Contains( wire->Edge( iE ))) { // ignore internal EDGEs (shared by several FACEs) const TGeomID edgeID = wire->EdgeID( iE ); _ignoreShapeIds.insert( edgeID ); // check if ends of an EDGE are to be added to _noShrinkVert + const TopTools_ListOfShape& faceList = facesOfEdgeMap.FindFromKey( wire->Edge( iE )); TopTools_ListIteratorOfListOfShape faceIt( faceList ); for ( ; faceIt.More(); faceIt.Next() ) { @@ -682,7 +689,8 @@ bool _ViscousBuilder2D::findEdgesWithLayers(const TopoDS_Shape& theShapeHypAssig while ( const TopoDS_Shape* edge = edgeIt->next() ) if ( !edge->IsSame( wire->Edge( iE )) && _helper.IsSubShape( *edge, neighbourFace ) && - neighbourIgnoreEdges.count( getMeshDS()->ShapeToIndex( *edge ))) + ( neighbourIgnoreEdges.count( getMeshDS()->ShapeToIndex( *edge )) || + sharedEdges.Contains( *edge ))) { _noShrinkVert.insert( getMeshDS()->ShapeToIndex( vertex )); break; @@ -1480,10 +1488,19 @@ bool _ViscousBuilder2D::shrink() if ( nbAdvancable == 0 ) continue; - const TopoDS_Edge& E = L._wire->Edge ( L._edgeInd ); - const int edgeID = L._wire->EdgeID ( L._edgeInd ); - const double edgeLen = L._wire->EdgeLength( L._edgeInd ); - Handle(Geom2d_Curve) pcurve = L._wire->Curve2d ( L._edgeInd ); + const TopoDS_Vertex& V1 = L._wire->FirstVertex( L._edgeInd ); + const TopoDS_Vertex& V2 = L._wire->LastVertex ( L._edgeInd ); + const int v1ID = getMeshDS()->ShapeToIndex( V1 ); + const int v2ID = getMeshDS()->ShapeToIndex( V2 ); + const bool isShrinkableL = ! _noShrinkVert.count( v1ID ) && L._leftLine->_advancable; + const bool isShrinkableR = ! _noShrinkVert.count( v2ID ) && L._rightLine->_advancable; + if ( !isShrinkableL && !isShrinkableR ) + continue; + + const TopoDS_Edge& E = L._wire->Edge ( L._edgeInd ); + const int edgeID = L._wire->EdgeID ( L._edgeInd ); + const double edgeLen = L._wire->EdgeLength ( L._edgeInd ); + Handle(Geom2d_Curve) pcurve = L._wire->Curve2d ( L._edgeInd ); const bool edgeReversed = ( E.Orientation() == TopAbs_REVERSED ); SMESH_MesherHelper helper( *_mesh ); // to create nodes and edges on E @@ -1499,10 +1516,12 @@ bool _ViscousBuilder2D::shrink() { adjFace = TopoDS::Face( *f ); SMESH_ProxyMesh::Ptr pm = _ProxyMeshHolder::FindProxyMeshOfFace( adjFace, *_mesh ); - if ( !pm || pm->NbProxySubMeshes() == 0 ) + if ( !pm || pm->NbProxySubMeshes() == 0 /*|| !pm->GetProxySubMesh( E )*/) { // There are no viscous layers on an adjacent FACE, clear it's 2D mesh removeMeshFaces( adjFace ); + // if ( removeMeshFaces( adjFace )) + // _clearedFaces.push_back( adjFace ); // to re-compute after all } else { @@ -1512,7 +1531,7 @@ bool _ViscousBuilder2D::shrink() // const vector& points = L._wire->GetUVPtStruct(); int iPFrom = L._firstPntInd, iPTo = L._lastPntInd; - if ( L._leftLine->_advancable ) + if ( isShrinkableL ) { vector& uvVec = L._lEdges.front()._uvRefined; for ( int i = 0; i < _hyp->GetNumberLayers(); ++i ) { @@ -1521,7 +1540,7 @@ bool _ViscousBuilder2D::shrink() uvVec.push_back ( pcurve->Value( uvPt.param ).XY() ); } } - if ( L._rightLine->_advancable ) + if ( isShrinkableR ) { vector& uvVec = L._lEdges.back()._uvRefined; for ( int i = 0; i < _hyp->GetNumberLayers(); ++i ) { @@ -1532,8 +1551,8 @@ bool _ViscousBuilder2D::shrink() } // make proxy sub-mesh data of present nodes // - if ( L._leftLine->_advancable ) iPFrom += _hyp->GetNumberLayers(); - if ( L._rightLine->_advancable ) iPTo -= _hyp->GetNumberLayers(); + if ( isShrinkableL ) iPFrom += _hyp->GetNumberLayers(); + if ( isShrinkableR ) iPTo -= _hyp->GetNumberLayers(); UVPtStructVec nodeDataVec( & points[ iPFrom ], & points[ iPTo + 1 ]); double normSize = nodeDataVec.back().normParam - nodeDataVec.front().normParam; @@ -1605,6 +1624,8 @@ bool _ViscousBuilder2D::shrink() if ( !L2->_advancable && !toShrinkForAdjacent( adjFace, E, L._wire->FirstVertex( L._edgeInd + isR ))) continue; + if ( isR ? !isShrinkableR : !isShrinkableL ) + continue; double & u = isR ? u2 : u1; // param to move double u0 = isR ? ul : uf; // init value of the param to move @@ -1641,17 +1662,17 @@ bool _ViscousBuilder2D::shrink() length1D = Abs( u - curveInt.Point( 1 ).ParamOnFirst() ); double maxDist2d = 2 * L2->_lEdges[ iLSeg2 ]._length2D; isConvex = ( length1D < maxDist2d * len1dTo2dRatio ); - /* |L seg2 - * | o---o--- - * | / | - * |/ | L2 - * x------x--- */ + /* |L seg2 + * | o---o--- + * | / | + * |/ | L2 + * x------x--- */ } - if ( !isConvex ) { /* concave VERTEX */ /* o-----o--- - * \ | + if ( !isConvex ) { /* concave VERTEX */ /* o-----o--- + * \ | * \ | L2 - * x--x--- - * / + * x--x--- + * / * L / */ length2D = L2->_lEdges[ iFSeg2 ]._length2D; //if ( L2->_advancable ) continue; @@ -1737,7 +1758,7 @@ bool _ViscousBuilder2D::shrink() { const SMDS_MeshElement* segment = segIt->next(); if ( segment->getshapeId() != edgeID ) continue; - + const int nbNodes = segment->NbNodes(); for ( int i = 0; i < nbNodes; ++i ) { @@ -1808,16 +1829,16 @@ bool _ViscousBuilder2D::shrink() } // concatenate nodeDataVec and nodeDataForAdjacent nodeDataVec.insert(( isRShrinkedForAdjacent ? nodeDataVec.end() : nodeDataVec.begin() ), - nodeDataForAdjacent.begin(), nodeDataForAdjacent.end() ); + nodeDataForAdjacent.begin(), nodeDataForAdjacent.end() ); } // Extend nodeDataVec by a node located at the end of not shared _LayerEdge /* n - to add to nodeDataVec - * o-----o--- - * |\ | + * o-----o--- + * |\ | * | o---o--- * | |x--x--- L2 - * | / + * | / * |/ L * x * / */ @@ -1855,7 +1876,7 @@ bool _ViscousBuilder2D::shrink() nodeDataVec.insert(( isR ? nodeDataVec.end() : nodeDataVec.begin() ), ptOfNode ); // recompute normParam of nodes in nodeDataVec - newLength = GCPnts_AbscissaPoint::Length( curve, + newLength = GCPnts_AbscissaPoint::Length( curve, nodeDataVec.front().param, nodeDataVec.back().param); for ( size_t iP = 1; iP < nodeDataVec.size(); ++iP ) @@ -1891,6 +1912,9 @@ bool _ViscousBuilder2D::toShrinkForAdjacent( const TopoDS_Face& adjFace, const TopoDS_Edge& E, const TopoDS_Vertex& V) { + if ( _noShrinkVert.count( getMeshDS()->ShapeToIndex( V ))) + return false; + TopoDS_Shape hypAssignedTo; if ( const StdMeshers_ViscousLayers2D* vlHyp = findHyp( *_mesh, adjFace, &hypAssignedTo )) { @@ -1934,18 +1958,18 @@ bool _ViscousBuilder2D::refine() if ( !L._advancable ) continue; // replace an inactive (1st) _LayerEdge with an active one of a neighbour _PolyLine - size_t iLE = 0, nbLE = L._lEdges.size(); + //size_t iLE = 0, nbLE = L._lEdges.size(); const bool leftEdgeShared = L.IsCommonEdgeShared( *L._leftLine ); const bool rightEdgeShared = L.IsCommonEdgeShared( *L._rightLine ); if ( /*!L._leftLine->_advancable &&*/ leftEdgeShared ) { L._lEdges[0] = L._leftLine->_lEdges.back(); - iLE += int( !L._leftLine->_advancable ); + //iLE += int( !L._leftLine->_advancable ); } if ( !L._rightLine->_advancable && rightEdgeShared ) { L._lEdges.back() = L._rightLine->_lEdges[0]; - --nbLE; + //--nbLE; } // limit length of neighbour _LayerEdge's to avoid sharp change of layers thickness @@ -1989,6 +2013,9 @@ bool _ViscousBuilder2D::refine() // cerr << "import smesh" << endl << "mesh = smesh.Mesh()"<< endl; // calculate intermediate UV on _LayerEdge's ( _LayerEdge::_uvRefined ) + size_t iLE = 0, nbLE = L._lEdges.size(); + if ( ! L._lEdges[0]._uvRefined.empty() ) ++iLE; + if ( ! L._lEdges.back()._uvRefined.empty() ) --nbLE; for ( ; iLE < nbLE; ++iLE ) { _LayerEdge& LE = L._lEdges[iLE]; @@ -2029,14 +2056,21 @@ bool _ViscousBuilder2D::refine() // Create layers of faces + const TopoDS_Vertex& V1 = L._wire->FirstVertex( L._edgeInd ); + const TopoDS_Vertex& V2 = L._wire->LastVertex ( L._edgeInd ); + const int v1ID = getMeshDS()->ShapeToIndex( V1 ); + const int v2ID = getMeshDS()->ShapeToIndex( V2 ); + const bool isShrinkableL = ! _noShrinkVert.count( v1ID ); + const bool isShrinkableR = ! _noShrinkVert.count( v2ID ); + bool hasLeftNode = ( !L._leftLine->_rightNodes.empty() && leftEdgeShared ); bool hasRightNode = ( !L._rightLine->_leftNodes.empty() && rightEdgeShared ); bool hasOwnLeftNode = ( !L._leftNodes.empty() ); bool hasOwnRightNode = ( !L._rightNodes.empty() ); bool isClosedEdge = ( outerNodes.front() == outerNodes.back() ); size_t iS, - iN0 = ( hasLeftNode || hasOwnLeftNode || isClosedEdge ), - nbN = innerNodes.size() - ( hasRightNode || hasOwnRightNode ); + iN0 = ( hasLeftNode || hasOwnLeftNode || isClosedEdge || !isShrinkableL ), + nbN = innerNodes.size() - ( hasRightNode || hasOwnRightNode || !isShrinkableR); L._leftNodes .reserve( _hyp->GetNumberLayers() ); L._rightNodes.reserve( _hyp->GetNumberLayers() ); int cur = 0, prev = -1; // to take into account orientation of _face @@ -2081,8 +2115,10 @@ bool _ViscousBuilder2D::refine() if ( hasOwnRightNode ) innerNodes.back() = L._rightNodes[ iF ]; else if ( hasRightNode ) innerNodes.back() = L._rightLine->_leftNodes[ iF ]; if ( isClosedEdge ) innerNodes.front() = innerNodes.back(); // circle - if ( !hasOwnLeftNode ) L._leftNodes.push_back( innerNodes.front() ); - if ( !hasOwnRightNode ) L._rightNodes.push_back( innerNodes.back() ); + if ( !isShrinkableL ) innerNodes.front() = outerNodes.front(); + if ( !isShrinkableR ) innerNodes.back() = outerNodes.back(); + if ( !hasOwnLeftNode ) L._leftNodes.push_back( innerNodes.front() ); + if ( !hasOwnRightNode ) L._rightNodes.push_back( innerNodes.back() ); // create faces for ( size_t i = 1; i < innerNodes.size(); ++i ) @@ -2137,6 +2173,14 @@ bool _ViscousBuilder2D::refine() } // loop on _PolyLine's + // re-compute FACEs whose mesh was removed by shrink() + for ( size_t i = 0; i < _clearedFaces.size(); ++i ) + { + SMESH_subMesh* sm = _mesh->GetSubMesh( _clearedFaces[i] ); + if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE ) + sm->ComputeStateEngine( SMESH_subMesh::COMPUTE ); + } + return true; } diff --git a/src/StdMeshers/StdMeshers_ViscousLayers2D.hxx b/src/StdMeshers/StdMeshers_ViscousLayers2D.hxx index 5b7f09548..a7b6c9c45 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers2D.hxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers2D.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/CMakeLists.txt b/src/StdMeshersGUI/CMakeLists.txt index f6e38a1f9..229c9ac2d 100644 --- a/src/StdMeshersGUI/CMakeLists.txt +++ b/src/StdMeshersGUI/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx b/src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx index a85cdc286..0e78ac5ac 100755 --- a/src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx +++ b/src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI.cxx b/src/StdMeshersGUI/StdMeshersGUI.cxx index 982ddbaf2..c23b6fd01 100644 --- a/src/StdMeshersGUI/StdMeshersGUI.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -27,6 +27,7 @@ #include "StdMeshersGUI_StdHypothesisCreator.h" #include "StdMeshersGUI_NbSegmentsCreator.h" #include "StdMeshersGUI_CartesianParamCreator.h" +#include "StdMeshersGUI_QuadrangleParamWdg.h" //============================================================================= /*! GetHypothesisCreator @@ -42,6 +43,8 @@ extern "C" return new StdMeshersGUI_NbSegmentsCreator(); else if ( aHypType=="CartesianParameters3D" ) return new StdMeshersGUI_CartesianParamCreator( aHypType ); + else if ( aHypType=="QuadrangleParams" ) + return new StdMeshersGUI_QuadrangleParamCreator( aHypType ); else return new StdMeshersGUI_StdHypothesisCreator( aHypType ); } diff --git a/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.cxx index 937c79066..88ad6ddc3 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,23 +25,39 @@ // SMESH includes #include "StdMeshersGUI_CartesianParamCreator.h" -#include -#include -#include -#include +#include "SMESHGUI.h" +#include "SMESHGUI_Utils.h" +#include "SMESHGUI_VTKUtils.h" +#include "SMESHGUI_HypothesesUtils.h" +#include "SMESHGUI_SpinBox.h" +#include "SMESHGUI_MeshEditPreview.h" // IDL includes #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) // SALOME GUI includes -#include -#include +#include #include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include // Qt includes #include #include #include +#include #include #include #include @@ -49,14 +65,14 @@ #include #include #include +#include #include #include #include +#include #include #include #include -#include -#include #define SPACING 6 #define MARGIN 11 @@ -162,7 +178,7 @@ namespace StdMeshersGUI myStepSpin->SetValue( myStep = 1. ); // 3) Coodrinates/Spacing group - QFrame* csFrame = new QFrame( this ); + QFrame* csFrame = new QFrame( this ); QVBoxLayout* scLay = new QVBoxLayout( csFrame ); scLay->setMargin( 0 ); scLay->setSpacing( SPACING ); @@ -200,11 +216,18 @@ namespace StdMeshersGUI connect( myInsertBtn, SIGNAL( clicked() ), SLOT( onInsert() )); connect( myDeleteBtn, SIGNAL( clicked() ), SLOT( onDelete() )); connect( myModeGroup, SIGNAL( buttonClicked ( int )), SLOT( onMode(int))); + connect( myModeGroup, SIGNAL( buttonClicked ( int )), SIGNAL( gridModeChanged(int))); connect( mySpacingTreeWdg, SIGNAL( itemSelectionChanged()), SLOT( updateButtons() )); connect( myCoordList, SIGNAL( itemSelectionChanged()), SLOT( updateButtons() )); connect( myStepSpin, SIGNAL( valueChanged(double)), SLOT( onStepChange() )); } + //================================================================================ + /*! + * \brief SLOT onInsert + */ + //================================================================================ + void GridAxisTab::onInsert() { if ( isGridBySpacing() ) @@ -253,6 +276,12 @@ namespace StdMeshersGUI updateButtons(); } + //================================================================================ + /*! + * \brief SLOT onDelete + */ + //================================================================================ + void GridAxisTab::onDelete() { if ( isGridBySpacing() ) @@ -282,6 +311,12 @@ namespace StdMeshersGUI updateButtons(); } + //================================================================================ + /*! + * \brief SLOT onMode + */ + //================================================================================ + void GridAxisTab::onMode(int isSpacing) { mySpacingTreeWdg->setShown( isSpacing ); @@ -312,6 +347,12 @@ namespace StdMeshersGUI updateButtons(); } + //================================================================================ + /*! + * \brief SLOT onStepChange + */ + //================================================================================ + void GridAxisTab::onStepChange() { if ( fabs( myStepSpin->GetValue() ) < 1e-100 ) @@ -322,6 +363,12 @@ namespace StdMeshersGUI myStep = myStepSpin->GetValue(); } + //================================================================================ + /*! + * \brief Enables/disables buttons + */ + //================================================================================ + void GridAxisTab::updateButtons() { bool insertEnable = false, deleteEnable = false; @@ -346,6 +393,12 @@ namespace StdMeshersGUI myDeleteBtn->setEnabled( deleteEnable ); } + //================================================================================ + /*! + * \brief Inserts coordinates into myCoordList + */ + //================================================================================ + void GridAxisTab::setCoordinates( SMESH::double_array_var coords ) { myCoordList->clear(); @@ -356,6 +409,12 @@ namespace StdMeshersGUI onMode( COORD_BUT ); } + //================================================================================ + /*! + * \brief Sets spacing got from hypothesis + */ + //================================================================================ + void GridAxisTab::setSpacing( SMESH::string_array_var funs, SMESH::double_array_var points ) { mySpacingTreeWdg->clear(); @@ -369,11 +428,23 @@ namespace StdMeshersGUI onMode( SPACING_BUT ); } + //================================================================================ + /*! + * \brief Checks grid definintion mode + */ + //================================================================================ + bool GridAxisTab::isGridBySpacing() const { return ( myModeGroup->checkedId() == SPACING_BUT ); } + //================================================================================ + /*! + * \brief Returns coordinates to set to a hypothesis + */ + //================================================================================ + SMESH::double_array* GridAxisTab::getCoordinates() { SMESH::double_array_var coords = new SMESH::double_array; @@ -384,6 +455,12 @@ namespace StdMeshersGUI return coords._retn(); } + //================================================================================ + /*! + * \brief Returms spacing to set to a hypothesis + */ + //================================================================================ + void GridAxisTab::getSpacing(SMESH::string_array_out funs, SMESH::double_array_out points) const { @@ -403,6 +480,12 @@ namespace StdMeshersGUI } + //================================================================================ + /*! + * \brief Verifies parameters + */ + //================================================================================ + bool GridAxisTab::checkParams(QString& msg, SMESH::SMESH_Hypothesis_var& hyp) const { if ( isGridBySpacing() ) @@ -431,6 +514,12 @@ namespace StdMeshersGUI return true; } + //================================================================================ + /*! + * \brief LineDelegate constructor + */ + //================================================================================ + LineDelegate::LineDelegate( QWidget* parent ): QItemDelegate( parent ), mySpacingTreeWdg( qobject_cast( parent )), @@ -438,6 +527,12 @@ namespace StdMeshersGUI { } + //================================================================================ + /*! + * \brief Creates an editor depending on a current item + */ + //================================================================================ + QWidget* LineDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem& opt, const QModelIndex& index) const @@ -471,6 +566,12 @@ namespace StdMeshersGUI return w; } + //================================================================================ + /*! + * \brief Limit value range in the spin of a neighbor range + */ + //================================================================================ + void LineDelegate::setEditorData ( QWidget * editor, const QModelIndex & index ) const { if ( mySpacingTreeWdg && index.column() == 0 ) @@ -493,6 +594,13 @@ namespace StdMeshersGUI QItemDelegate::setEditorData( editor, index ); } } + + //================================================================================ + /*! + * \brief + */ + //================================================================================ + void LineDelegate::setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const @@ -529,6 +637,53 @@ namespace StdMeshersGUI } // namespace StdMeshersGUI +namespace +{ + const double theAngTol = M_PI / 180.; + + //================================================================================ + /*! + * \brief Set variables to groups of spin boxes + */ + //================================================================================ + + void setText( const QString& vars, SMESHGUI_SpinBox** spins ) + { + QStringList varList = vars.split( ':' ); + for ( int i = 0; i < 3 && i < varList.count(); ++i ) + if ( !varList[i].isEmpty() ) + spins[i]->setText( varList[i] ); + } + + //================================================================================ + /*! + * \brief Computes more 2 axes by one + * \param [in] iOk - index of a given axis + * \param [in,out] dirs - directions of 3 axes + */ + //================================================================================ + + void get3Dirs( int iOk, gp_XYZ dirs[3] ) + { + dirs[ ( iOk+1 ) % 3 ] = dirs[ iOk ]; + + if ( Abs( dirs[ iOk ].Y() ) < 1e-100 && + Abs( dirs[ iOk ].Z() ) < 1e-100 ) + // dirs[ iOk ] || OX + dirs[ ( iOk+1 ) % 3 ].SetY( dirs[ iOk ].Y() + 1. ); + else + dirs[ ( iOk+1 ) % 3 ].SetX( dirs[ iOk ].X() + 1. ); + + dirs[( iOk+2 ) % 3] = dirs[ iOk ] ^ dirs[ ( iOk+1 ) % 3 ]; + dirs[( iOk+1 ) % 3] = dirs[ ( iOk+2 ) % 3 ] ^ dirs[ iOk ]; + } +} + +//================================================================================ +/*! + * \brief StdMeshersGUI_CartesianParamCreator constructor + */ +//================================================================================ StdMeshersGUI_CartesianParamCreator::StdMeshersGUI_CartesianParamCreator(const QString& aHypType) : StdMeshersGUI_StdHypothesisCreator( aHypType ), @@ -537,8 +692,23 @@ StdMeshersGUI_CartesianParamCreator::StdMeshersGUI_CartesianParamCreator(const Q myAxisTabs[0] = 0; myAxisTabs[1] = 0; myAxisTabs[2] = 0; + + myAxesPreview = new SMESHGUI_MeshEditPreview( SMESH::GetViewWindow( SMESHGUI::GetSMESHGUI() )); + myAxesPreview->SetArrowShapeAndNb( /*nbArrows=*/3, + /*headLength=*/0.1, + /*headRadius=*/0.01, + /*start=*/0., + /*labels=*/"XYZ"); + + myDirTic[0] = myDirTic[1] = myDirTic[2] = 0; } +//================================================================================ +/*! + * \brief StdMeshersGUI_CartesianParamCreator destructor + */ +//================================================================================ + StdMeshersGUI_CartesianParamCreator::~StdMeshersGUI_CartesianParamCreator() { if ( myAxisTabs[0] ) delete myAxisTabs[0]; @@ -547,8 +717,16 @@ StdMeshersGUI_CartesianParamCreator::~StdMeshersGUI_CartesianParamCreator() myAxisTabs[0] = 0; myAxisTabs[1] = 0; myAxisTabs[2] = 0; + + delete myAxesPreview; } +//================================================================================ +/*! + * \brief Validate parameters + */ +//================================================================================ + bool StdMeshersGUI_CartesianParamCreator::checkParams( QString& msg ) const { if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) ) @@ -567,9 +745,22 @@ bool StdMeshersGUI_CartesianParamCreator::checkParams( QString& msg ) const if ( !myAxisTabs[1]->checkParams( msg, hyp )) return false; if ( !myAxisTabs[2]->checkParams( msg, hyp )) return false; + StdMeshersGUI_CartesianParamCreator* me = (StdMeshersGUI_CartesianParamCreator*) this; + if ( !me->updateAxesPreview() ) + { + msg = tr("INVALID_AXES_DIR"); + return false; + } + return true; } +//================================================================================ +/*! + * \brief Create widgets + */ +//================================================================================ + QFrame* StdMeshersGUI_CartesianParamCreator::buildFrame() { QFrame* fr = new QFrame(); @@ -610,7 +801,12 @@ QFrame* StdMeshersGUI_CartesianParamCreator::buildFrame() argGroupLayout->addWidget( myThreshold, row, 1 ); row++; - // 2) Grid definition + // 2) "Implement edges" + myAddEdges = new QCheckBox( tr("ADD_EDGES"), GroupC1 ); + argGroupLayout->addWidget( myAddEdges, row, 0, 1, 2 ); + row++; + + // 3) Grid definition QTabWidget* tabWdg = new QTabWidget( fr ); myAxisTabs[ 0 ] = new StdMeshersGUI::GridAxisTab( tabWdg, 0 ); myAxisTabs[ 1 ] = new StdMeshersGUI::GridAxisTab( tabWdg, 1 ); @@ -619,10 +815,154 @@ QFrame* StdMeshersGUI_CartesianParamCreator::buildFrame() tabWdg->addTab( myAxisTabs[ 1 ], tr( "AXIS_Y" ) ); tabWdg->addTab( myAxisTabs[ 2 ], tr( "AXIS_Z" ) ); argGroupLayout->addWidget( tabWdg, row, 0, 1, 2 ); + row++; + + QPixmap aPix = SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")); + + // 4) Fixed point + myFixedPointGrp = new QGroupBox( tr("FIXED_POINT"), fr ); + myFixedPointGrp->setCheckable( true ); + //QPushButton* pointBtn = new QPushButton( QIcon(aPix), "", myFixedPointGrp ); + QLabel* pXLbl = new QLabel( tr("SMESH_X"), myFixedPointGrp ); + QLabel* pYLbl = new QLabel( tr("SMESH_Y"), myFixedPointGrp ); + QLabel* pZLbl = new QLabel( tr("SMESH_Z"), myFixedPointGrp ); + for ( int i = 0; i < 3; ++i ) + { + myPointSpin[i] = new SMESHGUI_SpinBox( myFixedPointGrp ); + myPointSpin[i]->RangeStepAndValidator( -1e20, 1e20, 10 ); + myPointSpin[i]->SetValue( 0. ); + } + QHBoxLayout* aFixedPointLay = new QHBoxLayout( myFixedPointGrp ); + aFixedPointLay->addWidget( pXLbl, 0, Qt::AlignRight ); + aFixedPointLay->addWidget( myPointSpin[0], 1 ); + aFixedPointLay->addWidget( pYLbl, 0, Qt::AlignRight ); + aFixedPointLay->addWidget( myPointSpin[1], 1 ); + aFixedPointLay->addWidget( pZLbl, 0, Qt::AlignRight ); + aFixedPointLay->addWidget( myPointSpin[2], 1 ); + argGroupLayout->addWidget( myFixedPointGrp, row, 0, 1, 2 ); + row++; + + // 5) Axes direction + QGroupBox* axesDirGrp = new QGroupBox( tr("AXES_DIRECTION"), fr ); + QGridLayout* axisDirLay = new QGridLayout( axesDirGrp ); + axisDirLay->setSpacing( SPACING ); + axisDirLay->setMargin( MARGIN ); + axisDirLay->setColumnStretch( 0, 2 ); + // is orthogonal + myOrthogonalChk = new QCheckBox( tr("ORTHOGONAL_AXES"), axesDirGrp ); + axisDirLay->addWidget( myOrthogonalChk, 0, 0, 1, 7 ); + // axes + QLabel* axisLbl[3]; + axisLbl[0] = new QLabel( tr( "AXIS_X"), axesDirGrp ); + axisLbl[1] = new QLabel( tr( "AXIS_Y"), axesDirGrp ); + axisLbl[2] = new QLabel( tr( "AXIS_Z"), axesDirGrp ); + QLabel* dLbl[3]; + myAxisBtnGrp = new QButtonGroup( axesDirGrp ); + SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] }; + for ( int i = 0; i < 3; ++i ) + { + QPushButton* axisBtn = new QPushButton( QIcon(aPix), "", axesDirGrp ); + axisBtn->setCheckable( true ); + myAxisBtnGrp->addButton( axisBtn, i ); + myXDirSpin[i] = new SMESHGUI_SpinBox( axesDirGrp ); + myYDirSpin[i] = new SMESHGUI_SpinBox( axesDirGrp ); + myZDirSpin[i] = new SMESHGUI_SpinBox( axesDirGrp ); + myXDirSpin[i]->RangeStepAndValidator( -1, 1, 0.1, "len_tol_precision" ); + myYDirSpin[i]->RangeStepAndValidator( -1, 1, 0.1, "len_tol_precision" ); + myZDirSpin[i]->RangeStepAndValidator( -1, 1, 0.1, "len_tol_precision" ); + dLbl[0] = new QLabel( tr("SMESH_DX"), axesDirGrp ); + dLbl[1] = new QLabel( tr("SMESH_DY"), axesDirGrp ); + dLbl[2] = new QLabel( tr("SMESH_DZ"), axesDirGrp ); + axisDirLay->addWidget( axisLbl[i], i+1, 0 ); + axisDirLay->addWidget( axisBtn, i+1, 1 ); + axisDirLay->addWidget( dLbl[0], i+1, 2 ); + axisDirLay->addWidget( dLbl[1], i+1, 4 ); + axisDirLay->addWidget( dLbl[2], i+1, 6 ); + axisDirLay->addWidget( myXDirSpin[i], 1, 3+i*2 ); + axisDirLay->addWidget( myYDirSpin[i], 2, 3+i*2 ); + axisDirLay->addWidget( myZDirSpin[i], 3, 3+i*2 ); + } + axisDirLay->setColumnStretch( 3, 10 ); + axisDirLay->setColumnStretch( 5, 10 ); + axisDirLay->setColumnStretch( 7, 10 ); + + // set optimal axes + QPushButton* optimBtn = new QPushButton( tr("OPTIMAL_AXES"), axesDirGrp ); + QPushButton* resetBtn = new QPushButton( tr("RESET_AXES"), axesDirGrp ); + axisDirLay->addWidget( optimBtn, 4, 0, 1, 4 ); + axisDirLay->addWidget( resetBtn, 4, 4, 1, 4 ); + + argGroupLayout->addWidget( axesDirGrp, row, 0, 1, 2 ); + row++; + + // Signals + + LightApp_SelectionMgr* selMgr = SMESH::GetSelectionMgr( SMESHGUI::GetSMESHGUI() ); + + connect( selMgr, SIGNAL( currentSelectionChanged()), SLOT( onSelectionChange())); + connect( myOrthogonalChk, SIGNAL( toggled(bool)), SLOT( onOrthogonalAxes(bool))); + connect( optimBtn, SIGNAL( clicked(bool)), SLOT( onOptimalAxes(bool))); + connect( resetBtn, SIGNAL( clicked(bool)), SLOT( onResetAxes(bool))); + for ( int i = 0; i < 3; ++i ) + { + connect( myXDirSpin[i], SIGNAL(valueChanged (const QString&)), + this, SLOT (onAxisDirChange(const QString&)) ); + connect( myYDirSpin[i], SIGNAL(valueChanged (const QString&)), + this, SLOT (onAxisDirChange(const QString&)) ); + connect( myZDirSpin[i], SIGNAL(valueChanged (const QString&)), + this, SLOT (onAxisDirChange(const QString&)) ); + connect( myAxisTabs[i], SIGNAL(gridModeChanged(int)), + this, SLOT (onGridModeChanged(int))); + } + + // Show axes + myAxesLen = 120; // default trihedron size is 100 + myOrigin[0] = myOrigin[1] = myOrigin[2] = 0.; + TopoDS_Shape shape; + QString shapeEntry = getMainShapeEntry(); + if ( !shapeEntry.isEmpty() ) + { + // find origin + Handle(SALOME_InteractiveObject) io = + new SALOME_InteractiveObject( shapeEntry.toStdString().c_str(), "GEOM" ); + GEOM::GEOM_Object_var geomObj = SMESH::IObjectToInterface( io ); + if ( GEOMBase::GetShape( geomObj, shape ) && !shape.IsNull()) + { + Bnd_Box box; + BRepBndLib::Add( shape, box ); + double max[3]; + if ( !box.IsVoid() ) + { + box.Get( myOrigin[0], myOrigin[1], myOrigin[2], max[0], max[1], max[2] ); + gp_Pnt o( myOrigin[0], myOrigin[1], myOrigin[2] ); + gp_Pnt x( max[0], max[1], max[2] ); + myAxesLen = o.Distance( x ); + + double step = 1e20; + while ( step > myAxesLen / 5 ) + step /= 10; + myPointSpin[0]->SetStep( step ); + myPointSpin[1]->SetStep( step ); + myPointSpin[2]->SetStep( step ); + } + } + } + myAxisBtnGrp->button(0)->setEnabled( !shape.IsNull() ); + myAxisBtnGrp->button(1)->setEnabled( !shape.IsNull() ); + myAxisBtnGrp->button(2)->setEnabled( !shape.IsNull() ); + optimBtn->setEnabled( !shape.IsNull() ); + + updateAxesPreview(); return fr; } +//================================================================================ +/*! + * \brief Tranfer parameters from hypothesis to widgets + */ +//================================================================================ + void StdMeshersGUI_CartesianParamCreator::retrieveParams() const { StdMeshers::StdMeshers_CartesianParameters3D_var h = @@ -637,6 +977,9 @@ void StdMeshersGUI_CartesianParamCreator::retrieveParams() const else myThreshold->setText( varName ); + myAddEdges->setChecked( h->GetToAddEdges() ); + + // grid definition for ( int ax = 0; ax < 3; ++ax ) { if ( h->IsGridBySpacing( ax )) @@ -652,10 +995,62 @@ void StdMeshersGUI_CartesianParamCreator::retrieveParams() const myAxisTabs[ax]->setCoordinates( coords ); } } + + // fixed point + SMESH::PointStruct fp; + StdMeshersGUI_CartesianParamCreator* me = (StdMeshersGUI_CartesianParamCreator*) this; + if ( h->GetFixedPoint( fp )) + { + me->myPointSpin[0]->SetValue( fp.x ); + me->myPointSpin[1]->SetValue( fp.y ); + me->myPointSpin[2]->SetValue( fp.z ); + setText( getVariableName("GetFixedPoint"), &me->myPointSpin[0] ); + myFixedPointGrp->setChecked( true ); + } + else + { + myFixedPointGrp->setChecked( false ); + } + + // axes directions + SMESHGUI_SpinBox** spins[3] = { &me->myXDirSpin[0], &me->myYDirSpin[0], &me->myZDirSpin[0] }; + SMESH::DirStruct axisDir[3]; + h->GetAxesDirs( axisDir[0], + axisDir[1], + axisDir[2]); + QString vars = getVariableName("GetAxesDirs"); + for ( int i = 0; i < 3; ++i ) + { + spins[i][0]->SetValue( axisDir[i].PS.x ); + spins[i][1]->SetValue( axisDir[i].PS.y ); + spins[i][2]->SetValue( axisDir[i].PS.z ); + setText( vars, spins[i] ); + + // cut off 3 used vars + if ( !vars.isEmpty() ) + { + int ind = -1; + for ( int j = 0; j < 3; ++j ) + if (( ind = vars.indexOf(':', ind+1 )) < 0 ) + break; + if ( ind < 0 ) + vars.clear(); + else + vars.remove( 0, ind+1 ); + } + } + if ( dlg() ) - dlg()->setMinimumSize( dlg()->minimumSizeHint().width(), dlg()->minimumSizeHint().height() ); + dlg()->setMinimumSize( dlg()->minimumSizeHint().width(), + dlg()->minimumSizeHint().height() ); } +//================================================================================ +/*! + * \brief Tranfer parameters from widgets to hypothesis + */ +//================================================================================ + QString StdMeshersGUI_CartesianParamCreator::storeParams() const { StdMeshers::StdMeshers_CartesianParameters3D_var h = @@ -666,9 +1061,12 @@ QString StdMeshersGUI_CartesianParamCreator::storeParams() const if( isCreation() ) SMESH::SetName( SMESH::FindSObject( h ), myName->text().toLatin1().constData() ); + // threshold h->SetVarParameter( myThreshold->text().toLatin1().constData(), "SetSizeThreshold" ); h->SetSizeThreshold( myThreshold->text().toDouble() ); + h->SetToAddEdges( myAddEdges->isChecked() ); + // grid for ( int ax = 0; ax < 3; ++ax ) { if ( myAxisTabs[ax]->isGridBySpacing()) @@ -684,6 +1082,40 @@ QString StdMeshersGUI_CartesianParamCreator::storeParams() const h->SetGrid( coords, ax ); } } + + // fixed point + QStringList params; + params << myPointSpin[0]->text(); + params << myPointSpin[1]->text(); + params << myPointSpin[2]->text(); + h->SetVarParameter( params.join(":").toLatin1().constData(), "SetFixedPoint" ); + params.clear(); + + SMESH::PointStruct ps; + ps.x = myPointSpin[0]->GetValue(); + ps.y = myPointSpin[1]->GetValue(); + ps.z = myPointSpin[2]->GetValue(); + h->SetFixedPoint( ps, !myFixedPointGrp->isEnabled() || !myFixedPointGrp->isChecked() ); + + // axes directions + SMESHGUI_SpinBox* const * spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] }; + for ( int ax = 0; ax < 3; ++ax ) + { + params << spins[ax][0]->text(); + params << spins[ax][1]->text(); + params << spins[ax][2]->text(); + } + h->SetVarParameter( params.join(":").toLatin1().constData(), "SetAxesDirs" ); + + SMESH::DirStruct axDir[3]; + for ( int ax = 0; ax < 3; ++ax ) + { + axDir[ax].PS.x = spins[ax][0]->GetValue(); + axDir[ax].PS.y = spins[ax][1]->GetValue(); + axDir[ax].PS.z = spins[ax][2]->GetValue(); + } + h->SetAxesDirs( axDir[0], axDir[1], axDir[2] ); + } catch(const SALOME::SALOME_Exception& ex) { @@ -692,7 +1124,298 @@ QString StdMeshersGUI_CartesianParamCreator::storeParams() const return ""; } +//================================================================================ +/*! + * \brief Returns a name of help page + */ +//================================================================================ + QString StdMeshersGUI_CartesianParamCreator::helpPage() const { return "cartesian_algo_page.html#cartesian_hyp_anchor"; } + +//================================================================================ +/*! + * \brief Show axes if they are OK + */ +//================================================================================ + +bool StdMeshersGUI_CartesianParamCreator::updateAxesPreview() +{ + bool isOk = true; + gp_Ax1 axes[3]; + SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] }; + for ( int i = 0; i < 3 && isOk; ++i ) + { + gp_XYZ dir( spins[i][0]->GetValue(), + spins[i][1]->GetValue(), + spins[i][2]->GetValue()); + if (( isOk = ( dir.Modulus() > 1e-100 ))) + axes[i].SetDirection( gp_Dir( dir )); + + axes[i].SetLocation ( gp_Pnt( myOrigin[0], + myOrigin[1], + myOrigin[2])); + } + gp_Vec norm01 = axes[0].Direction().XYZ() ^ axes[1].Direction().XYZ(); + gp_Vec norm12 = axes[1].Direction().XYZ() ^ axes[2].Direction().XYZ(); + if ( isOk ) + isOk = ( !axes[0].Direction().IsParallel( axes[1].Direction(), theAngTol ) && + !axes[1].Direction().IsParallel( axes[2].Direction(), theAngTol ) && + !axes[2].Direction().IsParallel( axes[0].Direction(), theAngTol ) && + !norm01.IsParallel( norm12, theAngTol ) ); + if ( isOk ) + myAxesPreview->SetArrows( axes, myAxesLen ); + + myAxesPreview->SetVisibility( isOk ); + + return isOk; +} + +//================================================================================ +/*! + * \brief Makes axes orthogonal if necessary + */ +//================================================================================ + +void StdMeshersGUI_CartesianParamCreator::onOrthogonalAxes(bool isOrtho) +{ + if ( !isOrtho ) + { + updateAxesPreview(); + return; + } + + std::multimap< int, int > ageOfAxis; + gp_XYZ dirs[3]; + SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] }; + int nbOk = 0, isOk; + for ( int iAx = 0; iAx < 3; ++iAx ) + { + dirs[iAx].SetCoord( spins[iAx][0]->GetValue(), + spins[iAx][1]->GetValue(), + spins[iAx][2]->GetValue()); + if (( isOk = ( dirs[iAx].Modulus() > 1e-100 ))) + ageOfAxis.insert( std::make_pair( myDirTic[iAx], iAx )); + else + ageOfAxis.insert( std::make_pair( -1, iAx )); + nbOk += isOk; + } + switch ( nbOk ) + { + case 0: + { + dirs[0].SetCoord( 1, 0, 0 ); + dirs[1].SetCoord( 0, 1, 0 ); + dirs[2].SetCoord( 0, 0, 1 ); + break; + } + case 1: + { + int iOk = ageOfAxis.rbegin()->second; + get3Dirs( iOk, dirs ); + break; + } + default: + std::multimap< int, int >::reverse_iterator ag2ax = ageOfAxis.rbegin(); + int iOk1 = ag2ax->second; + int iOk2 = (++ag2ax)->second; + int iKo = (++ag2ax)->second; + if ( gp_Vec( dirs[ iOk1 ]).IsParallel( gp_Vec( dirs[ iOk2 ]), theAngTol )) + std::swap( iOk2, iKo ); + if ( gp_Vec( dirs[ iOk1 ]).IsParallel( gp_Vec( dirs[ iOk2 ]), theAngTol )) + { + get3Dirs( iOk1, dirs ); + } + else + { + dirs[ iKo ] = dirs[ iOk1 ] ^ dirs[ iOk2 ]; + dirs[ iOk2 ] = dirs[ iKo ] ^ dirs[ iOk1 ]; + if ( ( iOk1+1 ) % 3 != iOk2 ) + dirs[ iKo ].Reverse(); + } + } + + for ( int iAx = 0; iAx < 3; ++iAx ) + { + double size = dirs[iAx].Modulus(); + if ( size > 1e-100 ) + dirs[iAx] /= size; + for (int i = 0; i < 3; ++i ) + { + bool isBlocked = spins[iAx][i]->blockSignals( true ); + spins[iAx][i]->SetValue( dirs[iAx].Coord( i+1 )); + spins[iAx][i]->blockSignals( isBlocked ); + } + } + + updateAxesPreview(); +} + +//================================================================================ +/*! + * \brief Increment myDirTic and update the preview of axes + */ +//================================================================================ + +void StdMeshersGUI_CartesianParamCreator::onAxisDirChange(const QString&) +{ + QObject* changedSpin = sender(); + SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] }; + for ( int iAx = 0; iAx < 3; ++iAx ) + if ( spins[iAx][0] == changedSpin || + spins[iAx][1] == changedSpin || + spins[iAx][2] == changedSpin ) + { + myDirTic[ iAx ] = 1 + Max( Max( myDirTic[0], myDirTic[1] ), myDirTic[2] ); + break; + } + + onOrthogonalAxes( myOrthogonalChk->isChecked() ); +} + +//================================================================================ +/*! + * \brief Sets axis direction by a selected EDGE + */ +//================================================================================ + +void StdMeshersGUI_CartesianParamCreator::onSelectionChange() +{ + int iAxis = myAxisBtnGrp->checkedId(); + if ( iAxis < 0 ) + return; + + SALOME_ListIO aList; + SMESHGUI::GetSMESHGUI()->selectionMgr()->selectedObjects(aList); + + TopoDS_Shape edge, shape; + for( SALOME_ListIteratorOfListIO anIt( aList ); anIt.More(); anIt.Next() ) + { + GEOM::GEOM_Object_var go = SMESH::IObjectToInterface( anIt.Value() ); + if ( GEOMBase::GetShape( go, shape ) && shape.ShapeType() == TopAbs_EDGE ) + { + if ( !edge.IsNull() ) + return; // several EDGEs selected + edge = shape; + } + } + if ( edge.IsNull() ) + return; + + TopoDS_Shape vv[2]; + TopoDS_Iterator vIt( edge ); + for ( ; vIt.More() && vv[1].IsNull(); vIt.Next() ) + vv[ !vv[0].IsNull() ] = vIt.Value(); + + gp_Pnt pp[2]; + if ( !GEOMBase::VertexToPoint( vv[0], pp[0] ) || + !GEOMBase::VertexToPoint( vv[1], pp[1] )) + return; + + SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] }; + + gp_Vec newDir( pp[0], pp[1] ); + gp_Vec curDir( spins[iAxis][0]->GetValue(), + spins[iAxis][1]->GetValue(), + spins[iAxis][2]->GetValue()); + if ( newDir * curDir < 0 ) + newDir.Reverse(); + + double size = newDir.Magnitude(); + if ( size < 1e-100 ) + return; + newDir /= size; + + for (int i = 0; i < 3; ++i ) + { + bool isBlocked = spins[iAxis][i]->blockSignals( true ); + spins[iAxis][i]->SetValue( newDir.Coord( i+1 )); + spins[iAxis][i]->blockSignals( isBlocked ); + } + myDirTic[ iAxis ] = 1 + Max( Max( myDirTic[0], myDirTic[1] ), myDirTic[2] ); + + onOrthogonalAxes( myOrthogonalChk->isChecked() ); +} + +//================================================================================ +/*! + * \brief Sets axes at which number of hexahedra is maximal + */ +//================================================================================ + +void StdMeshersGUI_CartesianParamCreator::onOptimalAxes(bool) +{ + StdMeshers::StdMeshers_CartesianParameters3D_var h = + StdMeshers::StdMeshers_CartesianParameters3D::_narrow( hypothesis() ); + if ( h->_is_nil() ) + return; + + QString shapeEntry = getMainShapeEntry(); + if ( shapeEntry.isEmpty() ) + return; + + Handle(SALOME_InteractiveObject) io = + new SALOME_InteractiveObject( shapeEntry.toStdString().c_str(), "GEOM" ); + GEOM::GEOM_Object_var geomObj = SMESH::IObjectToInterface( io ); + if ( geomObj->_is_nil() ) + return; + + SMESH::DirStruct axDirs[3]; + h->ComputeOptimalAxesDirs( geomObj, + myOrthogonalChk->isChecked(), + axDirs[0], + axDirs[1], + axDirs[2]); + + SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] }; + for ( int iAx = 0; iAx < 3; ++iAx ) + { + double coords[3] = { axDirs[iAx].PS.x, axDirs[iAx].PS.y, axDirs[iAx].PS.z }; + for (int i = 0; i < 3; ++i ) + { + bool isBlocked = spins[iAx][i]->blockSignals( true ); + spins[iAx][i]->SetValue( coords[ i ]); + spins[iAx][i]->blockSignals( isBlocked ); + } + } + updateAxesPreview(); +} + +//================================================================================ +/*! + * \brief Sets axes || to the axes of global CS + */ +//================================================================================ + +void StdMeshersGUI_CartesianParamCreator::onResetAxes(bool) +{ + SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] }; + for ( int iAx = 0; iAx < 3; ++iAx ) + { + for (int i = 0; i < 3; ++i ) + { + bool isBlocked = spins[iAx][i]->blockSignals( true ); + spins[iAx][i]->SetValue( iAx == i ? 1. : 0. ); + spins[iAx][i]->blockSignals( isBlocked ); + } + myDirTic[iAx] = 0; + } + updateAxesPreview(); +} + +//================================================================================ +/*! + * \brief SLOT called when the grid definintion mode changes + */ +//================================================================================ + +void StdMeshersGUI_CartesianParamCreator::onGridModeChanged(int) +{ + bool haveSpacing = ( myAxisTabs[0]->isGridBySpacing() || + myAxisTabs[1]->isGridBySpacing() || + myAxisTabs[2]->isGridBySpacing() ); + + myFixedPointGrp->setEnabled( haveSpacing ); +} diff --git a/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.h b/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.h index 5a02d5ca1..48477ea0d 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -39,18 +39,21 @@ #include #include -class SMESHGUI_SpinBox; -class QLineEdit; +class QAbstractItemModel; class QButtonGroup; -class QTreeWidgetItem; -class QString; -class QWidget; -class QTreeWidget; +class QCheckBox; +class QGroupBox; +class QLineEdit; class QListWidget; -class QStyleOptionViewItem; -class QModelIndex; -class QAbstractItemModel; class QListWidgetItem; +class QModelIndex; +class QString; +class QStyleOptionViewItem; +class QTreeWidget; +class QTreeWidgetItem; +class QWidget; +class SMESHGUI_MeshEditPreview; +class SMESHGUI_SpinBox; namespace StdMeshersGUI { @@ -78,6 +81,9 @@ namespace StdMeshersGUI SMESH::double_array* getCoordinates(); void getSpacing(SMESH::string_array_out funs, SMESH::double_array_out points) const; + signals: + void gridModeChanged(int); + private slots: void onInsert(); void onDelete(); @@ -125,18 +131,40 @@ public: StdMeshersGUI_CartesianParamCreator( const QString& aHypType ); virtual ~StdMeshersGUI_CartesianParamCreator(); - virtual bool checkParams( QString& ) const; - virtual QString helpPage() const; + virtual bool checkParams( QString& ) const; + virtual QString helpPage() const; protected: virtual QFrame* buildFrame(); virtual void retrieveParams() const; virtual QString storeParams() const; +private slots: + bool updateAxesPreview(); + void onOrthogonalAxes(bool); + void onAxisDirChange(const QString&); + void onSelectionChange(); + void onOptimalAxes(bool); + void onResetAxes(bool); + void onGridModeChanged(int); + private: QLineEdit* myName; SMESHGUI_SpinBox* myThreshold; + QCheckBox* myAddEdges; + StdMeshersGUI::GridAxisTab* myAxisTabs[3]; + QGroupBox* myFixedPointGrp; + SMESHGUI_SpinBox* myPointSpin[3]; + QCheckBox* myOrthogonalChk; + QButtonGroup* myAxisBtnGrp; + SMESHGUI_SpinBox* myXDirSpin[3]; + SMESHGUI_SpinBox* myYDirSpin[3]; + SMESHGUI_SpinBox* myZDirSpin[3]; + SMESHGUI_MeshEditPreview* myAxesPreview; + double myOrigin[3]; + double myAxesLen; + int myDirTic[3]; }; #endif // STDMESHERSGUI_CartesianParamCreator_H diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx index cac019a7b..5234cf911 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h index 9659781ad..3806b3e55 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx index 6b733a249..582b92b25 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.h b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.h index 8078d08b5..7cdbc84e8 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.h +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx index 7451a16e5..4d36d494c 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h index c60a0949e..bcd19407e 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx index 4cbe1bce3..78608b81f 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.h b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.h index aaeb5ff2d..2a86090de 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx index 3e2bd4e43..9003083e8 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h index 1792ae855..7c9cb4dc4 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.cxx index 90fe4011b..85b048d6e 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h index f1582f2ba..02f4f36e0 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_QuadrangleParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_QuadrangleParamWdg.cxx index bbde9200c..a99177bce 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_QuadrangleParamWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_QuadrangleParamWdg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -23,29 +23,401 @@ #include "StdMeshersGUI_QuadrangleParamWdg.h" #include "SMESHGUI.h" +#include "SMESHGUI_SpinBox.h" +#include "StdMeshersGUI_SubShapeSelectorWdg.h" -#include "SUIT_ResourceMgr.h" +#include +#include +#include +#include +#include // Qt includes #include -#include -#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include // IDL includes #include #include CORBA_CLIENT_HEADER(SMESH_BasicHypothesis) +#include CORBA_CLIENT_HEADER(GEOM_Gen) + #define SPACING 6 -#define MARGIN 0 +#define MARGIN 11 + +enum { TAB_TRANSITION, TAB_VERTEX, TAB_ENF_POINTS }; + +//================================================================================ +// function : Constructor +// purpose : +//================================================================================ + +StdMeshersGUI_QuadrangleParamCreator::StdMeshersGUI_QuadrangleParamCreator(const QString& aHypType) + : StdMeshersGUI_StdHypothesisCreator( aHypType ) +{ +} + +//======================================================================= +//function : helpPage +//purpose : +//======================================================================= + +QString StdMeshersGUI_QuadrangleParamCreator::helpPage() const +{ + return "a2d_meshing_hypo_page.html#hypo_quad_params_anchor"; +} + +//======================================================================= +//function : buildFrame +//purpose : +//======================================================================= + +QFrame* StdMeshersGUI_QuadrangleParamCreator::buildFrame() +{ + QFrame* fr = new QFrame(); + + QGridLayout* lay = new QGridLayout( fr ); + lay->setMargin( MARGIN ); + lay->setSpacing( SPACING ); + int row = 0; + + myName = 0; + if ( isCreation() ) + { + myName = new QLineEdit( fr ); + QLabel* nameLab = new QLabel( tr("SMESH_NAME")); + lay->addWidget( nameLab, row, 0 ); + lay->addWidget( myName, row, 1 ); + ++row; + } + + // Transition type + + myTypeWdg = new StdMeshersGUI_QuadrangleParamWdg( fr ); + + // Vertexes + + myVertexSelWdg = new StdMeshersGUI_SubShapeSelectorWdg( fr, TopAbs_VERTEX ); + myVertexSelWdg->layout()->setMargin( MARGIN ); + + // Enforced Points + + QWidget* pointsFrame = new QWidget( fr ); + QVBoxLayout* pointsLay = new QVBoxLayout( pointsFrame ); + pointsLay->setMargin(MARGIN); + pointsLay->setSpacing(SPACING); + + // shapes + QGroupBox* shapesGroup = new QGroupBox( tr("SHAPES"), pointsFrame ); + myShapesList = new QListWidget( shapesGroup ); + myAddShapeBut = new QPushButton( tr("SMESH_BUT_ADD"), shapesGroup ); + QPushButton* remShapeBut = new QPushButton( tr("SMESH_BUT_REMOVE"), shapesGroup ); + // + QGridLayout* shapesLay = new QGridLayout( shapesGroup ); + shapesLay->setMargin(MARGIN); + shapesLay->setSpacing(SPACING); + shapesLay->addWidget( myShapesList, 0, 0, 3, 2 ); + shapesLay->addWidget( myAddShapeBut, 0, 2 ); + shapesLay->addWidget( remShapeBut, 1, 2 ); + shapesLay->setColumnStretch( 0, 1 ); + shapesLay->setRowStretch ( 2, 1 ); + + // coords + QGroupBox* coordsGroup = new QGroupBox( tr("POINTS"), pointsFrame ); + myCoordsTreeWdg = new QTreeWidget( coordsGroup ); + myCoordsTreeWdg->setColumnCount ( 3 ); + myCoordsTreeWdg->setHeaderLabels( QStringList() << "X" << "Y" << "Z" ); + myCoordsTreeWdg->setItemDelegate( new ItemDelegate( myCoordsTreeWdg )); + QPushButton* addCoordBut = new QPushButton( tr("SMESH_BUT_ADD"), coordsGroup ); + QPushButton* remCoordBut = new QPushButton( tr("SMESH_BUT_REMOVE"), coordsGroup ); + // + QGridLayout* coordsLay = new QGridLayout( coordsGroup ); + coordsLay->setMargin(MARGIN); + coordsLay->setSpacing(SPACING); + coordsLay->addWidget( myCoordsTreeWdg, 0, 0, 3, 2 ); + coordsLay->addWidget( addCoordBut, 0, 2 ); + coordsLay->addWidget( remCoordBut, 1, 2 ); + coordsLay->setColumnStretch( 0, 1 ); + coordsLay->setRowStretch ( 2, 1 ); + + pointsLay->addWidget( shapesGroup ); + pointsLay->addWidget( coordsGroup ); + + // Tabs + myTabs = new QTabWidget( fr ); + myTabs->addTab( myTypeWdg, tr("TRANSITION")); + myTabs->addTab( myVertexSelWdg, tr("SMESH_BASE_VERTEX")); + myTabs->addTab( pointsFrame, tr("ENF_NODES")); + + lay->addWidget( myTabs, row, 0, 2, 3 ); + + // signals + connect( myTypeWdg, SIGNAL( typeChanged(int)), SLOT( onTypeChanged(int))); + connect( myAddShapeBut, SIGNAL( clicked()), SLOT( onAddShape() )); + connect( remShapeBut, SIGNAL( clicked()), SLOT( onRemoveShape() )); + connect( addCoordBut, SIGNAL( clicked()), SLOT( onAddPoint() )); + connect( remCoordBut, SIGNAL( clicked()), SLOT( onRemovePoint() )); + connect( myTabs, SIGNAL( currentChanged(int)),SLOT( onTabChanged(int))); + + LightApp_SelectionMgr* selMgr = SMESHGUI::GetSMESHGUI()->selectionMgr(); + connect( selMgr, SIGNAL(currentSelectionChanged()), SLOT( onSelectionChanged())); + + return fr; +} + +//======================================================================= +//function : retrieveParams +//purpose : +//======================================================================= + +void StdMeshersGUI_QuadrangleParamCreator::retrieveParams() const +{ + StdMeshers::StdMeshers_QuadrangleParams_var h = + StdMeshers::StdMeshers_QuadrangleParams::_narrow( initParamsHypothesis() ); + + // name + if( myName ) + myName->setText( hypName() ); + + // main shape + myVertexSelWdg->SetMaxSize(1); + QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); + QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); + if ( anEntry.isEmpty() ) + anEntry = h->GetObjectEntry(); + myVertexSelWdg->SetGeomShapeEntry(anEntry); + myVertexSelWdg->SetMainShapeEntry(aMainEntry); + + if ( !isCreation()) + { + // type + myTypeWdg->SetType(int(h->GetQuadType())); + + // vertex + int vertID = h->GetTriaVertex(); + if (vertID > 0) { + SMESH::long_array_var aVec = new SMESH::long_array; + aVec->length(1); + aVec[0] = vertID; + myVertexSelWdg->SetListOfIDs(aVec); + } + + // enforced nodes + GEOM::ListOfGO_var shapes; + SMESH::nodes_array_var points; + h->GetEnforcedNodes( shapes, points ); + for ( int i = 0; i < shapes->length(); ++i ) + { + CORBA::String_var name = shapes[i]->GetName(); + CORBA::String_var entry = shapes[i]->GetStudyEntry(); + QListWidgetItem* item = new QListWidgetItem( name.in() ); + item->setData( Qt::UserRole, entry.in() ); + myShapesList->addItem( item ); + } + for ( int i = 0; i < points->length(); ++i ) + { + QTreeWidgetItem* item = new QTreeWidgetItem + ( QStringList() + << QString::number( points[i].x ) + << QString::number( points[i].y ) + << QString::number( points[i].z )); + item->setFlags( item->flags() | Qt::ItemIsEditable ); + myCoordsTreeWdg->addTopLevelItem( item ); + } + } + ((StdMeshersGUI_QuadrangleParamCreator*) this)->onSelectionChanged(); +} + +//======================================================================= +//function : storeParams +//purpose : +//======================================================================= + +QString StdMeshersGUI_QuadrangleParamCreator::storeParams() const +{ + StdMeshers::StdMeshers_QuadrangleParams_var h = + StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() ); + + // name + if( myName ) + SMESH::SetName( SMESH::FindSObject( h ), myName->text().toLatin1().constData() ); + + // transition + h->SetQuadType( StdMeshers::QuadType( myTypeWdg->GetType()) ); + + // vertex + if ( myVertexSelWdg->GetListSize() > 0 ) + { + h->SetTriaVertex( myVertexSelWdg->GetListOfIDs()[0] ); // getlist must be called once + h->SetObjectEntry( myVertexSelWdg->GetMainShapeEntry() ); + } + else + { + h->SetTriaVertex( -1 ); + } + + // enfored nodes + + GEOM::ListOfGO_var goList = new GEOM::ListOfGO; + int nbShapes = 0; + goList->length( myShapesList->count() ); + for ( int i = 0; i < myShapesList->count(); ++i ) + { + QListWidgetItem* item = myShapesList->item(i); + QString entry = item->data( Qt::UserRole ).toString(); + Handle(SALOME_InteractiveObject) io = + new SALOME_InteractiveObject( entry.toStdString().c_str(), "GEOM" ); + GEOM::GEOM_Object_var go = GEOMBase::ConvertIOinGEOMObject( io ); + if ( !go->_is_nil() ) + goList[ nbShapes++ ] = go; + } + goList->length( nbShapes ); + + SMESH::nodes_array_var points = new SMESH::nodes_array; + points->length( myCoordsTreeWdg->topLevelItemCount() ); + for ( int i = 0; i < myCoordsTreeWdg->topLevelItemCount(); ++i ) + { + QTreeWidgetItem* item = myCoordsTreeWdg->topLevelItem( i ); + points[i].x = item->text(0).toInt(); + points[i].y = item->text(1).toInt(); + points[i].z = item->text(2).toInt(); + } + h->SetEnforcedNodes( goList, points ); + + return ""; +} + +//======================================================================= +//function : onTypeChanged +//purpose : +//======================================================================= + +void StdMeshersGUI_QuadrangleParamCreator::onTypeChanged(int type) +{ + myTabs->setTabEnabled( TAB_ENF_POINTS, ( type != StdMeshers::QUAD_REDUCED )); +} + +//======================================================================= +//function : onAddShape +//purpose : +//======================================================================= + +void StdMeshersGUI_QuadrangleParamCreator::onAddShape() +{ + if ( !mySelectedShapeIO.IsNull() ) + { + QListWidgetItem* item = new QListWidgetItem( mySelectedShapeIO->getName() ); + item->setData( Qt::UserRole, mySelectedShapeIO->getEntry() ); + myShapesList->addItem( item ); + mySelectedShapeIO.Nullify(); + myAddShapeBut->setEnabled( false ); + } +} + +//======================================================================= +//function : onRemoveShape +//purpose : +//======================================================================= + +void StdMeshersGUI_QuadrangleParamCreator::onRemoveShape() +{ + if ( QListWidgetItem * item = myShapesList->currentItem() ) + delete item; + onSelectionChanged(); +} + +//======================================================================= +//function : onAddPoint +//purpose : +//======================================================================= + +void StdMeshersGUI_QuadrangleParamCreator::onAddPoint() +{ + QTreeWidgetItem* item = new QTreeWidgetItem( QStringList() << "0" << "0" << "0" ); + item->setFlags( item->flags() | Qt::ItemIsEditable ); + myCoordsTreeWdg->addTopLevelItem( item ); +} + +//======================================================================= +//function : onRemovePoint +//purpose : +//======================================================================= + +void StdMeshersGUI_QuadrangleParamCreator::onRemovePoint() +{ + if ( myCoordsTreeWdg->topLevelItemCount() ) + delete myCoordsTreeWdg->currentItem(); +} + +//======================================================================= +//function : onSelectionChanged +//purpose : +//======================================================================= + +void StdMeshersGUI_QuadrangleParamCreator::onSelectionChanged() +{ + mySelectedShapeIO.Nullify(); + + // find a sole selected geometry + LightApp_SelectionMgr* selMgr = SMESHGUI::GetSMESHGUI()->selectionMgr(); + SALOME_ListIO selList; + selMgr->selectedObjects( selList ); + SALOME_ListIteratorOfListIO selIt( selList ); + for ( ; selIt.More(); selIt.Next() ) + { + GEOM::GEOM_Object_var go = GEOMBase::ConvertIOinGEOMObject( selIt.Value() ); + if ( !go->_is_nil() ) + { + if ( !mySelectedShapeIO.IsNull() ) + { + mySelectedShapeIO.Nullify(); + break; + } + mySelectedShapeIO = selIt.Value(); + if ( !mySelectedShapeIO->getName() || !mySelectedShapeIO->getName()[0] ) + mySelectedShapeIO.Nullify(); + } + } + // check if a selected geometry is not already in myShapesList + if ( !mySelectedShapeIO.IsNull() ) + { + for ( int i = 0; i < myShapesList->count(); ++i ) + if ( myShapesList->item(i)->data( Qt::UserRole ) == mySelectedShapeIO->getEntry() ) + { + mySelectedShapeIO.Nullify(); + break; + } + } + myAddShapeBut->setEnabled( !mySelectedShapeIO.IsNull() ); +} + +//======================================================================= +//function : onTabChanged +//purpose : +//======================================================================= + +void StdMeshersGUI_QuadrangleParamCreator::onTabChanged(int i) +{ + myVertexSelWdg->showPreview( i == TAB_VERTEX ); +} //================================================================================ // function : Constructor // purpose : //================================================================================ + StdMeshersGUI_QuadrangleParamWdg::StdMeshersGUI_QuadrangleParamWdg (QWidget * parent) - : QWidget(parent), - myType(0) + : QWidget(parent), myType(0) { myType = new QButtonGroup (this); @@ -71,6 +443,8 @@ StdMeshersGUI_QuadrangleParamWdg::StdMeshersGUI_QuadrangleParamWdg (QWidget * pa setLayout(typeLay); setMinimumWidth(300); + + connect( myType, SIGNAL( buttonClicked(int)), this, SIGNAL( typeChanged(int))); } //================================================================================ @@ -98,3 +472,25 @@ int StdMeshersGUI_QuadrangleParamWdg::GetType() { return myType->checkedId(); } + +//================================================================================ +/*! + \brief Constructor +*/ +StdMeshersGUI_QuadrangleParamCreator:: +ItemDelegate::ItemDelegate( QObject* parent ) : QItemDelegate( parent ) +{ +} +//================================================================================ +/*! + \brief Create item editor widget +*/ +QWidget* StdMeshersGUI_QuadrangleParamCreator:: +ItemDelegate::createEditor( QWidget* parent, + const QStyleOptionViewItem& option, + const QModelIndex& index ) const +{ + SMESHGUI_SpinBox* sb = new SMESHGUI_SpinBox( parent ); + sb->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10 ); + return sb; +} diff --git a/src/StdMeshersGUI/StdMeshersGUI_QuadrangleParamWdg.h b/src/StdMeshersGUI/StdMeshersGUI_QuadrangleParamWdg.h index 7ce5b314d..3e87369b0 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_QuadrangleParamWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_QuadrangleParamWdg.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,26 +24,104 @@ // SMESH includes #include "SMESH_StdMeshersGUI.hxx" +#include "StdMeshersGUI_StdHypothesisCreator.h" + +#include // Qt includes #include +#include + class QButtonGroup; +class QLineEdit; +class QListWidget; +class QPushButton; +class QTabWidget; +class QTreeWidget; +class StdMeshersGUI_QuadrangleParamWdg; +class StdMeshersGUI_SubShapeSelectorWdg; + +//================================================================================ +/*! + * \brief Quadrangle Parameters Creator + */ +class STDMESHERSGUI_EXPORT StdMeshersGUI_QuadrangleParamCreator : public StdMeshersGUI_StdHypothesisCreator +{ + Q_OBJECT + + class ItemDelegate; + + public: + StdMeshersGUI_QuadrangleParamCreator( const QString& aHypType ); + + //virtual bool checkParams( QString& ) const; + virtual QString helpPage() const; + + protected: + virtual QFrame* buildFrame(); + virtual void retrieveParams() const; + virtual QString storeParams() const; + + private slots: + + void onTypeChanged(int type); + void onAddShape(); + void onRemoveShape(); + void onAddPoint(); + void onRemovePoint(); + void onSelectionChanged(); + void onTabChanged(int); + + private: + QLineEdit* myName; + StdMeshersGUI_QuadrangleParamWdg* myTypeWdg; + StdMeshersGUI_SubShapeSelectorWdg* myVertexSelWdg; + QListWidget* myShapesList; + QPushButton* myAddShapeBut; + QTreeWidget* myCoordsTreeWdg; + QTabWidget* myTabs; + Handle(SALOME_InteractiveObject) mySelectedShapeIO; +}; + +//================================================================================ +/*! + * \brief Transition type widget + */ class STDMESHERSGUI_EXPORT StdMeshersGUI_QuadrangleParamWdg : public QWidget { Q_OBJECT -public: + public: StdMeshersGUI_QuadrangleParamWdg (QWidget* parent = 0); ~StdMeshersGUI_QuadrangleParamWdg(); void SetType (int theType); int GetType (); -private: - // Quadranle preference, Triangle preference, Reduced - QButtonGroup* myType; + GEOM::ListOfGO* GetShapes(); + SMESH::nodes_array* GetPoints(); + void Set( GEOM::ListOfGO_var shapes, SMESH::nodes_array_var points ); + + signals: + + void typeChanged(int); + + private: + QButtonGroup* myType; // Quadranle preference, Triangle preference, Reduced +}; + +//================================================================================ +/*! + * \brief Item delegate for a tree widget + */ +class StdMeshersGUI_QuadrangleParamCreator::ItemDelegate : public QItemDelegate +{ + Q_OBJECT +public: + ItemDelegate( QObject* ); + QWidget* createEditor( QWidget*, const QStyleOptionViewItem&, const QModelIndex& ) const; }; #endif // STDMESHERSGUI_QUADRANGLEPARAMWDG_H diff --git a/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.cxx index cca80aa17..1d939f28b 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h b/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h index fd8be84a2..a0133136b 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index ca774d105..891b2c0c8 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -523,6 +523,23 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const h->SetObjectEntry( w->GetMainShapeEntry() ); } } + else if( hypType()=="GeometricProgression" ) + { + StdMeshers::StdMeshers_Geometric1D_var h = + StdMeshers::StdMeshers_Geometric1D::_narrow( hypothesis() ); + + StdMeshersGUI_SubShapeSelectorWdg* w = + widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 ); + + h->SetVarParameter( params[0].text(), "SetStartLength" ); + h->SetStartLength( params[0].myValue.toDouble() ); + h->SetVarParameter( params[1].text(), "SetCommonRatio" ); + h->SetCommonRatio( params[1].myValue.toDouble() ); + if (w) { + h->SetReversedEdges( w->GetListOfIDs() ); + h->SetObjectEntry( w->GetMainShapeEntry() ); + } + } else if( hypType()=="FixedPoints1D" ) { StdMeshers::StdMeshers_FixedPoints1D_var h = @@ -704,9 +721,9 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const h->SetStretchFactor ( params[2].myValue.toDouble() ); if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg = - widget< StdMeshersGUI_SubShapeSelectorWdg >( 3 )) + widget< StdMeshersGUI_SubShapeSelectorWdg >( 4 )) { - h->SetIgnoreFaces( idsWg->GetListOfIDs() ); + h->SetFaces( idsWg->GetListOfIDs(), params[3].myValue.toInt() ); } } else if( hypType()=="ViscousLayers2D" ) @@ -727,23 +744,23 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const h->SetEdges( idsWg->GetListOfIDs(), params[3].myValue.toInt() ); } } - else if( hypType()=="QuadrangleParams" ) - { - StdMeshers::StdMeshers_QuadrangleParams_var h = - StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() ); - StdMeshersGUI_SubShapeSelectorWdg* w1 = - widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 ); - StdMeshersGUI_QuadrangleParamWdg* w2 = - widget< StdMeshersGUI_QuadrangleParamWdg >( 1 ); - if (w1 && w2) { - if (w1->GetListSize() > 0) { - h->SetTriaVertex(w1->GetListOfIDs()[0]); // getlist must be called once - const char * entry = w1->GetMainShapeEntry(); - h->SetObjectEntry(entry); - } - h->SetQuadType(StdMeshers::QuadType(w2->GetType())); - } - } + // else if( hypType()=="QuadrangleParams" ) + // { + // StdMeshers::StdMeshers_QuadrangleParams_var h = + // StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() ); + // StdMeshersGUI_SubShapeSelectorWdg* w1 = + // widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 ); + // StdMeshersGUI_QuadrangleParamWdg* w2 = + // widget< StdMeshersGUI_QuadrangleParamWdg >( 1 ); + // if (w1 && w2) { + // if (w1->GetListSize() > 0) { + // h->SetTriaVertex(w1->GetListOfIDs()[0]); // getlist must be called once + // const char * entry = w1->GetMainShapeEntry(); + // h->SetObjectEntry(entry); + // } + // h->SetQuadType(StdMeshers::QuadType(w2->GetType())); + // } + // } } return valueStr; } @@ -878,6 +895,41 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const customWidgets()->append ( aDirectionWidget ); } + else if( hypType()=="GeometricProgression" ) + { + StdMeshers::StdMeshers_Geometric1D_var h = + StdMeshers::StdMeshers_Geometric1D::_narrow( hyp ); + + item.myName = tr( "SMESH_START_LENGTH_PARAM" ); + if(!initVariableName( hyp, item, "SetStartLength" )) + item.myValue = h->GetStartLength(); + p.append( item ); + + customWidgets()->append (0); + + item.myName = tr( "SMESH_COMMON_RATIO" ); + if(!initVariableName( hyp, item, "SetCommonRatio" )) + item.myValue = h->GetCommonRatio(); + p.append( item ); + + customWidgets()->append (0); + + item.myName = tr( "SMESH_REVERSED_EDGES" ); + p.append( item ); + + StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget = + new StdMeshersGUI_SubShapeSelectorWdg(); + QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); + QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); + if ( aGeomEntry == "" ) + aGeomEntry = h->GetObjectEntry(); + + aDirectionWidget->SetGeomShapeEntry( aGeomEntry ); + aDirectionWidget->SetMainShapeEntry( aMainEntry ); + aDirectionWidget->SetListOfIDs( h->GetReversedEdges() ); + aDirectionWidget->showPreview( true ); + customWidgets()->append ( aDirectionWidget ); + } else if( hypType()=="FixedPoints1D" ) { @@ -1190,17 +1242,30 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const customWidgets()->append (0); QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); + QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); if ( !aMainEntry.isEmpty() ) { - item.myName = tr( "SMESH_FACES_WO_LAYERS" ); + item.myName = tr( "TO_IGNORE_FACES_OR_NOT" ); + p.append( item ); + + StdMeshersGUI_RadioButtonsGrpWdg* ignoreWdg = new StdMeshersGUI_RadioButtonsGrpWdg(""); + ignoreWdg->setButtonLabels ( QStringList() + << tr("NOT_TO_IGNORE_FACES") + << tr("TO_IGNORE_FACES") ); + ignoreWdg->setChecked( h->GetIsToIgnoreFaces() ); + connect(ignoreWdg->getButtonGroup(),SIGNAL(buttonClicked(int)),this,SLOT(onValueChanged())); + customWidgets()->append( ignoreWdg ); + + item.myName = + tr( h->GetIsToIgnoreFaces() ? "SMESH_FACES_WO_LAYERS" : "SMESH_FACES_WITH_LAYERS" ); p.append( item ); StdMeshersGUI_SubShapeSelectorWdg* idsWg = new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_FACE); - idsWg->SetGeomShapeEntry( aMainEntry ); idsWg->SetMainShapeEntry( aMainEntry ); - idsWg->SetListOfIDs( h->GetIgnoreFaces() ); + idsWg->SetGeomShapeEntry( aSubEntry.isEmpty() ? aMainEntry : aSubEntry ); + idsWg->SetListOfIDs( h->GetFaces() ); idsWg->showPreview( true ); customWidgets()->append ( idsWg ); } @@ -1229,6 +1294,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const customWidgets()->append (0); QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); + QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); if ( !aMainEntry.isEmpty() ) { item.myName = tr("TO_IGNORE_EDGES_OR_NOT"); @@ -1249,53 +1315,53 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const StdMeshersGUI_SubShapeSelectorWdg* idsWg = new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_EDGE); - idsWg->SetGeomShapeEntry( aMainEntry ); idsWg->SetMainShapeEntry( aMainEntry ); + idsWg->SetGeomShapeEntry( aSubEntry.isEmpty() ? aMainEntry : aSubEntry ); idsWg->SetListOfIDs( h->GetEdges() ); idsWg->showPreview( true ); customWidgets()->append ( idsWg ); } } - else if (hypType() == "QuadrangleParams") - { - StdMeshers::StdMeshers_QuadrangleParams_var h = - StdMeshers::StdMeshers_QuadrangleParams::_narrow(hyp); - - item.myName = tr("SMESH_BASE_VERTEX"); - p.append(item); - - StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget = - new StdMeshersGUI_SubShapeSelectorWdg(0, TopAbs_VERTEX); - aDirectionWidget->SetMaxSize(1); - QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); - QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); - if (anEntry == "") - anEntry = h->GetObjectEntry(); - aDirectionWidget->SetGeomShapeEntry(anEntry); - aDirectionWidget->SetMainShapeEntry(aMainEntry); - 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->showPreview(true); - - item.myName = tr("SMESH_QUAD_TYPE"); - p.append(item); - - StdMeshersGUI_QuadrangleParamWdg* aTypeWidget = - new StdMeshersGUI_QuadrangleParamWdg(); - if (!isCreation()) { - aTypeWidget->SetType(int(h->GetQuadType())); - } - - customWidgets()->append(aDirectionWidget); - customWidgets()->append(aTypeWidget); - } + // else if (hypType() == "QuadrangleParams") + // { + // StdMeshers::StdMeshers_QuadrangleParams_var h = + // StdMeshers::StdMeshers_QuadrangleParams::_narrow(hyp); + + // item.myName = tr("SMESH_BASE_VERTEX"); + // p.append(item); + + // StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget = + // new StdMeshersGUI_SubShapeSelectorWdg(0, TopAbs_VERTEX); + // aDirectionWidget->SetMaxSize(1); + // QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); + // QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); + // if (anEntry == "") + // anEntry = h->GetObjectEntry(); + // aDirectionWidget->SetGeomShapeEntry(anEntry); + // aDirectionWidget->SetMainShapeEntry(aMainEntry); + // 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->showPreview(true); + + // item.myName = tr("SMESH_QUAD_TYPE"); + // p.append(item); + + // StdMeshersGUI_QuadrangleParamWdg* aTypeWidget = + // new StdMeshersGUI_QuadrangleParamWdg(); + // if (!isCreation()) { + // aTypeWidget->SetType(int(h->GetQuadType())); + // } + + // customWidgets()->append(aDirectionWidget); + // customWidgets()->append(aTypeWidget); + // } else res = false; return res; @@ -1325,6 +1391,13 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int) { sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" ); } + else if( hypType()=="GeometricProgression" ) + { + if (sb->objectName() == tr("SMESH_START_LENGTH_PARAM")) + sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" ); + else if (sb->objectName() == tr("SMESH_COMMON_RATIO")) + sb->RangeStepAndValidator( -VALUE_MAX, VALUE_MAX, 0.5, "len_tol_precision" ); + } else if( hypType()=="MaxLength" ) { sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" ); @@ -1423,6 +1496,7 @@ QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) cons types.insert( "Deflection1D", "DEFLECTION1D" ); types.insert( "Adaptive1D", "ADAPTIVE1D" ); types.insert( "Arithmetic1D", "ARITHMETIC_1D" ); + types.insert( "GeometricProgression", "GEOMETRIC_1D" ); types.insert( "FixedPoints1D", "FIXED_POINTS_1D" ); types.insert( "AutomaticLength", "AUTOMATIC_LENGTH" ); types.insert( "ProjectionSource1D", "PROJECTION_SOURCE_1D" ); @@ -1519,13 +1593,11 @@ bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & pa param.myValue = w->GetValue(); return true; } - if ( widget->inherits( "StdMeshersGUI_QuadrangleParamWdg" )) - { - //const StdMeshersGUI_QuadrangleParamWdg * w = - // static_cast( widget ); - param.myValue = "QuadType"; - return true; - } + // if ( widget->inherits( "StdMeshersGUI_QuadrangleParamWdg" )) + // { + // param.myValue = "QuadType"; + // return true; + // } if ( widget->inherits( "StdMeshersGUI_FixedPointsParamWdg" )) { const StdMeshersGUI_FixedPointsParamWdg * w = @@ -1596,12 +1668,15 @@ void StdMeshersGUI_StdHypothesisCreator::valueChanged( QWidget* paramWidget) toCopyGroups->setEnabled( true ); } } - else if ( hypType() == "ViscousLayers2D" && paramWidget->inherits("QButtonGroup")) + else if ( hypType().startsWith( "ViscousLayers" ) && paramWidget->inherits("QButtonGroup")) { if ( QLabel* label = getLabel(4) ) { bool toIgnore = widget< StdMeshersGUI_RadioButtonsGrpWdg >( 3 )->checkedId(); - label->setText( tr( toIgnore ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" )); + if ( hypType() == "ViscousLayers2D" ) + label->setText( tr( toIgnore ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" )); + else + label->setText( tr( toIgnore ? "SMESH_FACES_WO_LAYERS" : "SMESH_FACES_WITH_LAYERS" )); } } } diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h index b43746cd2..2f8a3859c 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx index 4f63c559b..935df0cc3 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h index 661b6bd18..f8ea6e9e1 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshersGUI/StdMeshers_images.ts b/src/StdMeshersGUI/StdMeshers_images.ts index a729340e2..537118cf5 100644 --- a/src/StdMeshersGUI/StdMeshers_images.ts +++ b/src/StdMeshersGUI/StdMeshers_images.ts @@ -7,6 +7,10 @@ ICON_DLG_ARITHMETIC_1D mesh_hypo_length.png + + ICON_DLG_GEOMETRIC_1D + mesh_hypo_length.png + ICON_DLG_FIXED_POINTS_1D mesh_hypo_length.png @@ -23,10 +27,6 @@ ICON_DLG_ADAPTIVE1D mesh_hypo_length.png - - ICON_DLG_GEOMETRIC_1D - mesh_hypo_length.png - ICON_DLG_LAYER_DISTRIBUTION mesh_hypo_layer_distribution.png @@ -163,6 +163,10 @@ ICON_SMESH_TREE_HYPO_Arithmetic1D mesh_tree_hypo_length.png + + ICON_SMESH_TREE_HYPO_Geometric1D + mesh_tree_hypo_length.png + ICON_SMESH_TREE_HYPO_AutomaticLength mesh_tree_hypo_length.png @@ -231,6 +235,10 @@ ICON_SMESH_TREE_HYPO_Propagation mesh_tree_hypo_length.png + + ICON_SMESH_TREE_HYPO_PropagOfDistribution + mesh_tree_hypo_length.png + ICON_SMESH_TREE_HYPO_QuadranglePreference mesh_tree_algo_quad.png diff --git a/src/StdMeshersGUI/StdMeshers_msg_en.ts b/src/StdMeshersGUI/StdMeshers_msg_en.ts index c9982405e..08dcd5671 100644 --- a/src/StdMeshersGUI/StdMeshers_msg_en.ts +++ b/src/StdMeshersGUI/StdMeshers_msg_en.ts @@ -15,6 +15,18 @@ TO_IGNORE_EDGES Edges without layers (inlets and oulets) + + TO_IGNORE_FACES_OR_NOT + Specified faces are + + + NOT_TO_IGNORE_FACES + Faces with layers (walls) + + + TO_IGNORE_FACES + Faces without layers (inlets and oulets) + @default @@ -23,13 +35,21 @@ Arithmetic 1D - SMESH_ARITHMETIC_1D_PARAM - Arithmetic Reason + SMESH_ARITHMETIC_1D_TITLE + Hypothesis Construction - SMESH_ARITHMETIC_1D_TITLE + SMESH_GEOMETRIC_1D_HYPOTHESIS + Geometric Progression + + + SMESH_GEOMETRIC_1D_TITLE Hypothesis Construction + + SMESH_COMMON_RATIO + Common Ratio + SMESH_AUTOMATIC_LENGTH_HYPOTHESIS Automatic Length @@ -472,6 +492,29 @@ Reduced + + StdMeshersGUI_QuadrangleParamCreator + + POINTS + Points + + + SHAPES + Vertices + + + TRANSITION + Transition + + + ENF_NODES + Enforced nodes + + + + + + StdMeshersGUI_LayerDistributionParamWdg @@ -493,6 +536,10 @@ THRESHOLD Threshold + + ADD_EDGES + Implement Edges + AXIS_X Axis X @@ -505,6 +552,30 @@ AXIS_Z Axis Z + + INVALID_AXES_DIR + Invalid directions of axes + + + FIXED_POINT + Fixed Point + + + AXES_DIRECTION + Directions of Axes + + + ORTHOGONAL_AXES + Orthogonal Axes + + + OPTIMAL_AXES + Optimal Axes + + + RESET_AXES + Reset + StdMeshersGUI::GridAxisTab diff --git a/src/StdMeshersGUI/StdMeshers_msg_fr.ts b/src/StdMeshersGUI/StdMeshers_msg_fr.ts index 4f3de7883..dba900057 100755 --- a/src/StdMeshersGUI/StdMeshers_msg_fr.ts +++ b/src/StdMeshersGUI/StdMeshers_msg_fr.ts @@ -3,6 +3,18 @@ @default + + SMESH_COMMON_RATIO + Common Ratio + + + SMESH_GEOMETRIC_1D_TITLE + Hypothesis Construction + + + SMESH_GEOMETRIC_1D_HYPOTHESIS + Geometric Progression + SMESH_EDGES_WITH_LAYERS Edges with layers @@ -475,6 +487,10 @@ StdMeshersGUI_CartesianParamCreator + + ADD_EDGES + Implement Edges + THRESHOLD Seuil diff --git a/src/StdMeshers_I/CMakeLists.txt b/src/StdMeshers_I/CMakeLists.txt index 51cbd0c0d..e53bf5fa4 100644 --- a/src/StdMeshers_I/CMakeLists.txt +++ b/src/StdMeshers_I/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -129,8 +129,10 @@ ENDIF(SALOME_SMESH_ENABLE_MEFISTO) SET(StdMeshersEngine_SOURCES StdMeshers_i.cxx StdMeshers_LocalLength_i.cxx + StdMeshers_Reversible1D_i.cxx StdMeshers_StartEndLength_i.cxx StdMeshers_Arithmetic1D_i.cxx + StdMeshers_Geometric1D_i.cxx StdMeshers_FixedPoints1D_i.cxx StdMeshers_NumberOfSegments_i.cxx StdMeshers_Deflection1D_i.cxx diff --git a/src/StdMeshers_I/SMESH_StdMeshers_I.hxx b/src/StdMeshers_I/SMESH_StdMeshers_I.hxx index dc04b886c..f1aed23dc 100755 --- a/src/StdMeshers_I/SMESH_StdMeshers_I.hxx +++ b/src/StdMeshers_I/SMESH_StdMeshers_I.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Adaptive1D_i.cxx b/src/StdMeshers_I/StdMeshers_Adaptive1D_i.cxx index 99bc768ed..c6d82b9c1 100644 --- a/src/StdMeshers_I/StdMeshers_Adaptive1D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Adaptive1D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Adaptive1D_i.hxx b/src/StdMeshers_I/StdMeshers_Adaptive1D_i.hxx index ac168ec72..7dd59e708 100644 --- a/src/StdMeshers_I/StdMeshers_Adaptive1D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Adaptive1D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.cxx b/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.cxx index c2ae8af9e..9fe0a6e71 100644 --- a/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.hxx b/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.hxx index 45a868d9d..53d6538d8 100644 --- a/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_AutomaticLength_i.cxx b/src/StdMeshers_I/StdMeshers_AutomaticLength_i.cxx index 93189bae7..1b77d6e86 100644 --- a/src/StdMeshers_I/StdMeshers_AutomaticLength_i.cxx +++ b/src/StdMeshers_I/StdMeshers_AutomaticLength_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_AutomaticLength_i.hxx b/src/StdMeshers_I/StdMeshers_AutomaticLength_i.hxx index e7bb68b30..cccf0075a 100644 --- a/src/StdMeshers_I/StdMeshers_AutomaticLength_i.hxx +++ b/src/StdMeshers_I/StdMeshers_AutomaticLength_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_CartesianParameters3D_i.cxx b/src/StdMeshers_I/StdMeshers_CartesianParameters3D_i.cxx index 5221f2cec..cd90066a0 100644 --- a/src/StdMeshers_I/StdMeshers_CartesianParameters3D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_CartesianParameters3D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -224,9 +224,124 @@ void StdMeshers_CartesianParameters3D_i::GetGridSpacing(SMESH::string_array_out } } +//======================================================================= +//function : SetAxesDirs +//purpose : Set custom direction of axes +//======================================================================= + +void StdMeshers_CartesianParameters3D_i::SetAxesDirs(const SMESH::DirStruct& xDir, + const SMESH::DirStruct& yDir, + const SMESH::DirStruct& zDir) + throw (SALOME::SALOME_Exception) +{ + double coords[9]; + coords[0] = xDir.PS.x; + coords[1] = xDir.PS.y; + coords[2] = xDir.PS.z; + coords[3] = yDir.PS.x; + coords[4] = yDir.PS.y; + coords[5] = yDir.PS.z; + coords[6] = zDir.PS.x; + coords[7] = zDir.PS.y; + coords[8] = zDir.PS.z; + try { + this->GetImpl()->SetAxisDirs(coords); + + SMESH::TPythonDump() << _this() << ".SetAxesDirs( " + << xDir << ", " + << yDir << ", " + << zDir << " )"; + } + catch ( SALOME_Exception& S_ex ) { + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); + } +} + +//======================================================================= +//function : GetAxesDirs +//purpose : Returns direction of axes +//======================================================================= + +void StdMeshers_CartesianParameters3D_i::GetAxesDirs(SMESH::DirStruct& xDir, + SMESH::DirStruct& yDir, + SMESH::DirStruct& zDir) +{ + const double* coords = GetImpl()->GetAxisDirs(); + xDir.PS.x = coords[0]; + xDir.PS.y = coords[1]; + xDir.PS.z = coords[2]; + yDir.PS.x = coords[3]; + yDir.PS.y = coords[4]; + yDir.PS.z = coords[5]; + zDir.PS.x = coords[6]; + zDir.PS.y = coords[7]; + zDir.PS.z = coords[8]; +} + +//======================================================================= +//function : SetFixedPoint +//purpose : * Set/unset a fixed point, at which a node will be created provided that grid +// * is defined by spacing in all directions +//======================================================================= + +void StdMeshers_CartesianParameters3D_i::SetFixedPoint(const SMESH::PointStruct& ps, + CORBA::Boolean toUnset) +{ + double p[3] = { ps.x, ps.y, ps.z }; + GetImpl()->SetFixedPoint( p, toUnset ); + + SMESH::TPythonDump() << _this() << ".SetFixedPoint( " << ps << ", " << toUnset << " )"; +} + +//======================================================================= +//function : GetFixedPoint +//purpose : Returns a fixed point +//======================================================================= + +CORBA::Boolean StdMeshers_CartesianParameters3D_i::GetFixedPoint(SMESH::PointStruct& ps) +{ + double p[3]; + if ( GetImpl()->GetFixedPoint( p ) ) + { + ps.x = p[0]; + ps.y = p[1]; + ps.z = p[2]; + return true; + } + else + { + ps.x = 0.; + ps.y = 0.; + ps.z = 0.; + } + return false; +} + +//======================================================================= +//function : SetToAddEdges +//purpose : Enables implementation of geometrical edges into the mesh. +//======================================================================= + +void StdMeshers_CartesianParameters3D_i::SetToAddEdges(CORBA::Boolean toAdd) +{ + GetImpl()->SetToAddEdges( toAdd ); + SMESH::TPythonDump() << _this() << ".SetToAddEdges( " << toAdd << " )"; +} + +//======================================================================= +//function : GetToAddEdges +//purpose : Returns true if implementation of geometrical edges into the +// mesh is enabled +//======================================================================= + +CORBA::Boolean StdMeshers_CartesianParameters3D_i::GetToAddEdges() +{ + return GetImpl()->GetToAddEdges(); +} + //======================================================================= //function : IsGridBySpacing -//purpose : Return true if the grid is defined by spacing functions and +//purpose : Return true if the grid is defined by spacing functions and // not by node coordinates //======================================================================= @@ -235,6 +350,37 @@ CORBA::Boolean StdMeshers_CartesianParameters3D_i::IsGridBySpacing(CORBA::Short return this->GetImpl()->IsGridBySpacing(axis); } +//======================================================================= +//function : ComputeOptimalAxesDirs +//purpose : Returns axes at which number of hexahedra is maximal +//======================================================================= + +void StdMeshers_CartesianParameters3D_i:: +ComputeOptimalAxesDirs(GEOM::GEOM_Object_ptr go, + CORBA::Boolean isOrthogonal, + SMESH::DirStruct& xDir, + SMESH::DirStruct& yDir, + SMESH::DirStruct& zDir) + throw (SALOME::SALOME_Exception) +{ + TopoDS_Shape shape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( go ); + if ( shape.IsNull() ) + THROW_SALOME_CORBA_EXCEPTION( "Null shape", SALOME::BAD_PARAM ); + + double c[9]; + ::StdMeshers_CartesianParameters3D::ComputeOptimalAxesDirs( shape, isOrthogonal, c ); + + xDir.PS.x = c[0]; + xDir.PS.y = c[1]; + xDir.PS.z = c[2]; + yDir.PS.x = c[3]; + yDir.PS.y = c[4]; + yDir.PS.z = c[5]; + zDir.PS.x = c[6]; + zDir.PS.y = c[7]; + zDir.PS.z = c[8]; +} + //======================================================================= //function : ComputeCoordinates //purpose : Computes node coordinates by spacing functions @@ -246,13 +392,13 @@ StdMeshers_CartesianParameters3D_i::ComputeCoordinates(CORBA::Double const SMESH::string_array& spaceFuns, const SMESH::double_array& points, const char* axisName ) - throw (SALOME::SALOME_Exception) + throw (SALOME::SALOME_Exception) { vector xFuns; vector xPoints, coords; _array2vec( spaceFuns, xFuns, (const char*) ); _array2vec( points, xPoints, ); - + try { this->GetImpl()->ComputeCoordinates( x0, x1, xFuns, xPoints, coords, axisName ); } diff --git a/src/StdMeshers_I/StdMeshers_CartesianParameters3D_i.hxx b/src/StdMeshers_I/StdMeshers_CartesianParameters3D_i.hxx index a1f00f605..7246ac1f3 100644 --- a/src/StdMeshers_I/StdMeshers_CartesianParameters3D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_CartesianParameters3D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -83,6 +83,30 @@ class STDMESHERS_I_EXPORT StdMeshers_CartesianParameters3D_i: void GetGridSpacing(SMESH::string_array_out xSpaceFunctions, SMESH::double_array_out xInternalPoints, CORBA::Short axis) throw (SALOME::SALOME_Exception); + /*! + * Set custom direction of axes + */ + void SetAxesDirs(const SMESH::DirStruct& x, + const SMESH::DirStruct& y, + const SMESH::DirStruct& z) throw (SALOME::SALOME_Exception); + void GetAxesDirs(SMESH::DirStruct& x, + SMESH::DirStruct& y, + SMESH::DirStruct& z); + /*! + * Set/unset a fixed point, at which a node will be created provided that grid + * is defined by spacing in all directions + */ + void SetFixedPoint(const ::SMESH::PointStruct& p, CORBA::Boolean toUnset); + CORBA::Boolean GetFixedPoint(::SMESH::PointStruct& p); + + + /*! + * \brief Enables implementation of geometrical edges into the mesh. If this feature + * is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if + * they don't coincide with the grid lines + */ + void SetToAddEdges(CORBA::Boolean toAdd); + CORBA::Boolean GetToAddEdges(); /*! * \brief Return true if the grid is defined by spacing functions and @@ -90,6 +114,14 @@ class STDMESHERS_I_EXPORT StdMeshers_CartesianParameters3D_i: */ CORBA::Boolean IsGridBySpacing(CORBA::Short axis); + /*! + * Returns axes at which number of hexahedra is maximal + */ + void ComputeOptimalAxesDirs(GEOM::GEOM_Object_ptr shape, + CORBA::Boolean isOrthogonal, + SMESH::DirStruct& x, + SMESH::DirStruct& y, + SMESH::DirStruct& z) throw (SALOME::SALOME_Exception); /*! * \brief Computes node coordinates by spacing functions * \param x0 - lower coordinate diff --git a/src/StdMeshers_I/StdMeshers_Cartesian_3D_i.cxx b/src/StdMeshers_I/StdMeshers_Cartesian_3D_i.cxx index aca5cda26..b17bdf2d5 100644 --- a/src/StdMeshers_I/StdMeshers_Cartesian_3D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Cartesian_3D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Cartesian_3D_i.hxx b/src/StdMeshers_I/StdMeshers_Cartesian_3D_i.hxx index 8690d8317..c6b1bbb34 100644 --- a/src/StdMeshers_I/StdMeshers_Cartesian_3D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Cartesian_3D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_CompositeSegment_1D_i.cxx b/src/StdMeshers_I/StdMeshers_CompositeSegment_1D_i.cxx index 252af2b60..acc773b9a 100644 --- a/src/StdMeshers_I/StdMeshers_CompositeSegment_1D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_CompositeSegment_1D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_CompositeSegment_1D_i.hxx b/src/StdMeshers_I/StdMeshers_CompositeSegment_1D_i.hxx index 5d6bf8e1f..614731046 100644 --- a/src/StdMeshers_I/StdMeshers_CompositeSegment_1D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_CompositeSegment_1D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Deflection1D_i.cxx b/src/StdMeshers_I/StdMeshers_Deflection1D_i.cxx index 3a4b0a9e0..1668a857e 100644 --- a/src/StdMeshers_I/StdMeshers_Deflection1D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Deflection1D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Deflection1D_i.hxx b/src/StdMeshers_I/StdMeshers_Deflection1D_i.hxx index ae8908b3d..60186cfcd 100644 --- a/src/StdMeshers_I/StdMeshers_Deflection1D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Deflection1D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.cxx b/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.cxx index 73fd93755..12bd81879 100644 --- a/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.hxx b/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.hxx index 76e12a797..803414187 100644 --- a/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Geometric1D_i.cxx b/src/StdMeshers_I/StdMeshers_Geometric1D_i.cxx new file mode 100644 index 000000000..6bf870191 --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_Geometric1D_i.cxx @@ -0,0 +1,143 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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_I : idl implementation based on 'SMESH' unit's calsses +// File : StdMeshers_Geometric1D_i.cxx +// Module : SMESH +// +#include "StdMeshers_Geometric1D_i.hxx" +#include "SMESH_Gen_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_PythonDump.hxx" + +#include +#include + +//============================================================================= +/*! + * StdMeshers_Geometric1D_i::StdMeshers_Geometric1D_i + * + * Constructor + */ +//============================================================================= + +StdMeshers_Geometric1D_i::StdMeshers_Geometric1D_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + StdMeshers_Reversible1D_i( this ) +{ + myBaseImpl = new ::StdMeshers_Geometric1D( theGenImpl->GetANewId(), + theStudyId, + theGenImpl ); +} + +//============================================================================= +/*! + * Sets parameter value + */ +//============================================================================= + +void StdMeshers_Geometric1D_i::SetStartLength( CORBA::Double theLength ) + throw (SALOME::SALOME_Exception) +{ + try { + this->GetImpl()->SetStartLength( theLength ); + } + catch ( SALOME_Exception& S_ex ) { + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); + } + // Update Python script + SMESH::TPythonDump() + << _this() << ".SetStartLength( " << SMESH::TVar(theLength) << " )"; +} + +//============================================================================= +/*! + * Sets parameter value + */ +//============================================================================= + +void StdMeshers_Geometric1D_i::SetCommonRatio( CORBA::Double factor ) + throw (SALOME::SALOME_Exception) +{ + try { + this->GetImpl()->SetCommonRatio( factor ); + } + catch ( SALOME_Exception& S_ex ) { + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); + } + // Update Python script + SMESH::TPythonDump() + << _this() << ".SetCommonRatio( " << SMESH::TVar(factor) << " )"; +} + +//============================================================================= +/*! + * Returns length of the first segment + */ +//============================================================================= + +CORBA::Double StdMeshers_Geometric1D_i::GetStartLength() +{ + return this->GetImpl()->GetStartLength(); +} + +//============================================================================= +/*! + * Returns value of Common Ratio + */ +//============================================================================= + +CORBA::Double StdMeshers_Geometric1D_i::GetCommonRatio() +{ + return this->GetImpl()->GetCommonRatio(); +} + +//============================================================================= +/*! + * StdMeshers_Geometric1D_i::GetImpl + * + * Get implementation + */ +//============================================================================= + +::StdMeshers_Geometric1D* StdMeshers_Geometric1D_i::GetImpl() +{ + return ( ::StdMeshers_Geometric1D* )myBaseImpl; +} + +//================================================================================ +/*! + * \brief Verify whether hypothesis supports given entity type + * \param type - dimension (see SMESH::Dimension enumeration) + * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise + * + * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration) + */ +//================================================================================ + +CORBA::Boolean StdMeshers_Geometric1D_i::IsDimSupported(::SMESH::Dimension type) +{ + return type == SMESH::DIM_1D; +} diff --git a/src/StdMeshers_I/StdMeshers_Geometric1D_i.hxx b/src/StdMeshers_I/StdMeshers_Geometric1D_i.hxx new file mode 100644 index 000000000..fb980724d --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_Geometric1D_i.hxx @@ -0,0 +1,65 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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_I : idl implementation based on 'SMESH' unit's calsses +// File : StdMeshers_Geometric1D_i.hxx +// Module : SMESH +// +#ifndef _SMESH_Geometric1D_I_HXX_ +#define _SMESH_Geometric1D_I_HXX_ + +#include "SMESH_StdMeshers_I.hxx" + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_Hypothesis_i.hxx" +#include "StdMeshers_Geometric1D.hxx" +#include "StdMeshers_Reversible1D_i.hxx" + +// ====================================================== +// Geometric 1D hypothesis +// ====================================================== +class STDMESHERS_I_EXPORT StdMeshers_Geometric1D_i: + public virtual POA_StdMeshers::StdMeshers_Geometric1D, + public virtual SMESH_Hypothesis_i, + public virtual StdMeshers_Reversible1D_i +{ + public: + // Constructor + StdMeshers_Geometric1D_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ); + + void SetStartLength(CORBA::Double length) throw(SALOME::SALOME_Exception); + void SetCommonRatio(CORBA::Double factor) throw(SALOME::SALOME_Exception); + + CORBA::Double GetStartLength(); + CORBA::Double GetCommonRatio(); + + virtual ::CORBA::Boolean IsDimSupported(::SMESH::Dimension type); + + // Get implementation + ::StdMeshers_Geometric1D* GetImpl(); +}; + +#endif diff --git a/src/StdMeshers_I/StdMeshers_Hexa_3D_i.cxx b/src/StdMeshers_I/StdMeshers_Hexa_3D_i.cxx index d1e12a850..9b1f7e22b 100644 --- a/src/StdMeshers_I/StdMeshers_Hexa_3D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Hexa_3D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,6 @@ // Moved here from SMESH_Hexa_3D_i.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #include "StdMeshers_Hexa_3D_i.hxx" #include "SMESH_Gen.hxx" @@ -44,17 +43,17 @@ using namespace std; //============================================================================= StdMeshers_Hexa_3D_i::StdMeshers_Hexa_3D_i( PortableServer::POA_ptr thePOA, - int theStudyId, - ::SMESH_Gen* theGenImpl ) - : SALOME::GenericObj_i( thePOA ), - SMESH_Hypothesis_i( thePOA ), - SMESH_Algo_i( thePOA ), - SMESH_3D_Algo_i( thePOA ) + int theStudyId, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + SMESH_Algo_i( thePOA ), + SMESH_3D_Algo_i( thePOA ) { MESSAGE( "StdMeshers_Hexa_3D_i::StdMeshers_Hexa_3D_i" ); myBaseImpl = new ::StdMeshers_Hexa_3D( theGenImpl->GetANewId(), - theStudyId, - theGenImpl ); + theStudyId, + theGenImpl ); } //============================================================================= @@ -83,3 +82,17 @@ StdMeshers_Hexa_3D_i::~StdMeshers_Hexa_3D_i() MESSAGE( "StdMeshers_Hexa_3D_i::GetImpl" ); return ( ::StdMeshers_Hexa_3D* )myBaseImpl; } + +//============================================================================= +/*! + * StdMeshers_Hexa_3D_i::IsApplicable + * + * Return true if the algorithm is applicable to a shape + */ +//============================================================================= + +CORBA::Boolean StdMeshers_Hexa_3D_i::IsApplicable( const TopoDS_Shape &S, + CORBA::Boolean toCheckAll ) +{ + return ::StdMeshers_Hexa_3D::IsApplicable( S, toCheckAll ); +} diff --git a/src/StdMeshers_I/StdMeshers_Hexa_3D_i.hxx b/src/StdMeshers_I/StdMeshers_Hexa_3D_i.hxx index 7224f145f..999eb94d2 100644 --- a/src/StdMeshers_I/StdMeshers_Hexa_3D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Hexa_3D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,6 @@ // Moved here from SMESH_Hexa_3D_i.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #ifndef _SMESH_HEXA_3D_I_HXX_ #define _SMESH_HEXA_3D_I_HXX_ @@ -58,6 +57,9 @@ public: // Get implementation ::StdMeshers_Hexa_3D* GetImpl(); + + // Return true if the algorithm is applicable to a shape + static CORBA::Boolean IsApplicable(const TopoDS_Shape &S, CORBA::Boolean toCheckAll); }; #endif diff --git a/src/StdMeshers_I/StdMeshers_ImportSource1D_i.cxx b/src/StdMeshers_I/StdMeshers_ImportSource1D_i.cxx index e86a81e03..cea7bc36f 100644 --- a/src/StdMeshers_I/StdMeshers_ImportSource1D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_ImportSource1D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_ImportSource1D_i.hxx b/src/StdMeshers_I/StdMeshers_ImportSource1D_i.hxx index d2a00512a..b48d9e28b 100644 --- a/src/StdMeshers_I/StdMeshers_ImportSource1D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_ImportSource1D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_ImportSource2D_i.cxx b/src/StdMeshers_I/StdMeshers_ImportSource2D_i.cxx index 085da0287..545d98d01 100644 --- a/src/StdMeshers_I/StdMeshers_ImportSource2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_ImportSource2D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_ImportSource2D_i.hxx b/src/StdMeshers_I/StdMeshers_ImportSource2D_i.hxx index 13cf85b51..53570f515 100644 --- a/src/StdMeshers_I/StdMeshers_ImportSource2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_ImportSource2D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Import_1D2D_i.cxx b/src/StdMeshers_I/StdMeshers_Import_1D2D_i.cxx index f87523b2e..c15ed6f3c 100644 --- a/src/StdMeshers_I/StdMeshers_Import_1D2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Import_1D2D_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Import_1D2D_i.hxx b/src/StdMeshers_I/StdMeshers_Import_1D2D_i.hxx index 8fc293f29..662871cb7 100644 --- a/src/StdMeshers_I/StdMeshers_Import_1D2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Import_1D2D_i.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Import_1D_i.cxx b/src/StdMeshers_I/StdMeshers_Import_1D_i.cxx index d186ad10c..e7b1a1f57 100644 --- a/src/StdMeshers_I/StdMeshers_Import_1D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Import_1D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Import_1D_i.hxx b/src/StdMeshers_I/StdMeshers_Import_1D_i.hxx index ec02c0f45..5dd4e1e30 100644 --- a/src/StdMeshers_I/StdMeshers_Import_1D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Import_1D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.cxx b/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.cxx index a7891071a..c710649e2 100644 --- a/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.hxx b/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.hxx index 275148bd1..abb456f47 100644 --- a/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_LayerDistribution_i.cxx b/src/StdMeshers_I/StdMeshers_LayerDistribution_i.cxx index 8a9db16a7..bfdc32947 100644 --- a/src/StdMeshers_I/StdMeshers_LayerDistribution_i.cxx +++ b/src/StdMeshers_I/StdMeshers_LayerDistribution_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_LayerDistribution_i.hxx b/src/StdMeshers_I/StdMeshers_LayerDistribution_i.hxx index e603a3efc..a54acd92c 100644 --- a/src/StdMeshers_I/StdMeshers_LayerDistribution_i.hxx +++ b/src/StdMeshers_I/StdMeshers_LayerDistribution_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_LengthFromEdges_i.cxx b/src/StdMeshers_I/StdMeshers_LengthFromEdges_i.cxx index c1b48360b..9802d36d8 100644 --- a/src/StdMeshers_I/StdMeshers_LengthFromEdges_i.cxx +++ b/src/StdMeshers_I/StdMeshers_LengthFromEdges_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_LengthFromEdges_i.hxx b/src/StdMeshers_I/StdMeshers_LengthFromEdges_i.hxx index df22866a5..7fe1ddf09 100644 --- a/src/StdMeshers_I/StdMeshers_LengthFromEdges_i.hxx +++ b/src/StdMeshers_I/StdMeshers_LengthFromEdges_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_LocalLength_i.cxx b/src/StdMeshers_I/StdMeshers_LocalLength_i.cxx index 3a26c63b0..f9d209d5e 100644 --- a/src/StdMeshers_I/StdMeshers_LocalLength_i.cxx +++ b/src/StdMeshers_I/StdMeshers_LocalLength_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_LocalLength_i.hxx b/src/StdMeshers_I/StdMeshers_LocalLength_i.hxx index 4b659ba01..4b9ce3123 100644 --- a/src/StdMeshers_I/StdMeshers_LocalLength_i.hxx +++ b/src/StdMeshers_I/StdMeshers_LocalLength_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.cxx b/src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.cxx index 7507fa509..df1f7d025 100644 --- a/src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.hxx b/src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.hxx index c0cb08d39..a7542cdc7 100644 --- a/src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_MaxElementArea_i.cxx b/src/StdMeshers_I/StdMeshers_MaxElementArea_i.cxx index f10fa6cb3..43c9f853f 100644 --- a/src/StdMeshers_I/StdMeshers_MaxElementArea_i.cxx +++ b/src/StdMeshers_I/StdMeshers_MaxElementArea_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx b/src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx index 3689e4973..e3482d123 100644 --- a/src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx +++ b/src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.cxx b/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.cxx index 37cf749f4..dfd637651 100644 --- a/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.cxx +++ b/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx b/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx index 601dea39d..0a7c75ae4 100644 --- a/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx +++ b/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_MaxLength_i.cxx b/src/StdMeshers_I/StdMeshers_MaxLength_i.cxx index d2fbfe2fa..258c8ac19 100644 --- a/src/StdMeshers_I/StdMeshers_MaxLength_i.cxx +++ b/src/StdMeshers_I/StdMeshers_MaxLength_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_MaxLength_i.hxx b/src/StdMeshers_I/StdMeshers_MaxLength_i.hxx index 02814bb23..8ab02cb68 100644 --- a/src/StdMeshers_I/StdMeshers_MaxLength_i.hxx +++ b/src/StdMeshers_I/StdMeshers_MaxLength_i.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_NotConformAllowed_i.cxx b/src/StdMeshers_I/StdMeshers_NotConformAllowed_i.cxx index a9e97fe94..c2a1931b6 100644 --- a/src/StdMeshers_I/StdMeshers_NotConformAllowed_i.cxx +++ b/src/StdMeshers_I/StdMeshers_NotConformAllowed_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_NotConformAllowed_i.hxx b/src/StdMeshers_I/StdMeshers_NotConformAllowed_i.hxx index 470df1089..be2df28ab 100644 --- a/src/StdMeshers_I/StdMeshers_NotConformAllowed_i.hxx +++ b/src/StdMeshers_I/StdMeshers_NotConformAllowed_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.cxx b/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.cxx index cb8abc352..220ac6506 100644 --- a/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.hxx b/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.hxx index 58c6d72e9..af4e58063 100644 --- a/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.cxx b/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.cxx index 3c7ec1044..c0c9ffcb8 100644 --- a/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.cxx +++ b/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.hxx b/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.hxx index 3ed8f9326..d177572d2 100644 --- a/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.hxx +++ b/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx b/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx index 24fef1a9c..a59fd1318 100644 --- a/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx +++ b/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.hxx b/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.hxx index c526769f6..e81711b2f 100644 --- a/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.hxx +++ b/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_ObjRefUlils.cxx b/src/StdMeshers_I/StdMeshers_ObjRefUlils.cxx index 88a0163ec..4afaa0a8b 100644 --- a/src/StdMeshers_I/StdMeshers_ObjRefUlils.cxx +++ b/src/StdMeshers_I/StdMeshers_ObjRefUlils.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -37,7 +37,7 @@ using namespace std; //purpose : Return study entry of GEOM Object //======================================================================= -std::string StdMeshers_ObjRefUlils::GeomObjectToEntry(GEOM::GEOM_Object_ptr& theGeomObject) +std::string StdMeshers_ObjRefUlils::GeomObjectToEntry(GEOM::GEOM_Object_ptr theGeomObject) { if ( CORBA::is_nil( theGeomObject )) return "NULL_OBJECT"; @@ -109,13 +109,16 @@ void StdMeshers_ObjRefUlils::SaveToStream( const TopoDS_Shape& theShape, ostream */ //================================================================================ -TopoDS_Shape StdMeshers_ObjRefUlils::LoadFromStream( istream & stream) +TopoDS_Shape StdMeshers_ObjRefUlils::LoadFromStream( istream & stream, + std::string* entry) { - if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) { - SALOMEDS::Study_var study = gen->GetCurrentStudy(); - if ( ! study->_is_nil() ) { - string str; - if (stream >> str) { + string str; + if (stream >> str) { + if ( entry ) + * entry = str; + if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) { + SALOMEDS::Study_var study = gen->GetCurrentStudy(); + if ( ! study->_is_nil() ) { SALOMEDS::SObject_wrap sobj = study->FindObjectID( str.c_str() ); CORBA::Object_var obj = gen->SObjectToObject( sobj ); GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_narrow( obj ); @@ -123,6 +126,8 @@ TopoDS_Shape StdMeshers_ObjRefUlils::LoadFromStream( istream & stream) } } } + if ( entry ) + entry->clear(); return TopoDS_Shape(); } diff --git a/src/StdMeshers_I/StdMeshers_ObjRefUlils.hxx b/src/StdMeshers_I/StdMeshers_ObjRefUlils.hxx index c7d6ed865..b79fba02f 100644 --- a/src/StdMeshers_I/StdMeshers_ObjRefUlils.hxx +++ b/src/StdMeshers_I/StdMeshers_ObjRefUlils.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -68,7 +68,7 @@ public: /*! * \brief Return study entry of GEOM Object */ - static std::string GeomObjectToEntry(GEOM::GEOM_Object_ptr& theGeomObject); + static std::string GeomObjectToEntry(GEOM::GEOM_Object_ptr theGeomObject); /*! * \brief Return GEOM Object by its study entry or TopoDS_Shape @@ -89,7 +89,7 @@ public: * \param stream - the stream * \retval TopoDS_Shape - resulting shape */ - static TopoDS_Shape LoadFromStream( std::istream & stream ); + static TopoDS_Shape LoadFromStream( std::istream & stream, std::string* entry=NULL ); /*! * \brief Store the CORBA object in the stream diff --git a/src/StdMeshers_I/StdMeshers_Prism_3D_i.cxx b/src/StdMeshers_I/StdMeshers_Prism_3D_i.cxx index d19fdb979..450e32586 100644 --- a/src/StdMeshers_I/StdMeshers_Prism_3D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Prism_3D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,6 @@ // Moved here from SMESH_Prism_3D_i.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #include "StdMeshers_Prism_3D_i.hxx" #include "SMESH_Gen.hxx" @@ -42,12 +41,12 @@ using namespace std; //============================================================================= StdMeshers_Prism_3D_i::StdMeshers_Prism_3D_i( PortableServer::POA_ptr thePOA, - int theStudyId, - ::SMESH_Gen* theGenImpl ) - : SALOME::GenericObj_i( thePOA ), - SMESH_Hypothesis_i( thePOA ), - SMESH_Algo_i( thePOA ), - SMESH_3D_Algo_i( thePOA ) + int theStudyId, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + SMESH_Algo_i( thePOA ), + SMESH_3D_Algo_i( thePOA ) { MESSAGE( "StdMeshers_Prism_3D_i::StdMeshers_Prism_3D_i" ); myBaseImpl = new ::StdMeshers_Prism_3D( theGenImpl->GetANewId(), @@ -67,6 +66,13 @@ StdMeshers_Prism_3D_i::~StdMeshers_Prism_3D_i() MESSAGE( "StdMeshers_Prism_3D_i::GetImpl" ); return ( ::StdMeshers_Prism_3D* )myBaseImpl; } +//----------------------------------------------------------------------------- + +CORBA::Boolean StdMeshers_Prism_3D_i::IsApplicable( const TopoDS_Shape &S, + CORBA::Boolean toCheckAll ) +{ + return ::StdMeshers_Prism_3D::IsApplicable( S, toCheckAll ); +} //============================================================================= @@ -76,17 +82,17 @@ StdMeshers_Prism_3D_i::~StdMeshers_Prism_3D_i() //============================================================================= StdMeshers_RadialPrism_3D_i::StdMeshers_RadialPrism_3D_i( PortableServer::POA_ptr thePOA, - int theStudyId, - ::SMESH_Gen* theGenImpl ) - : SALOME::GenericObj_i( thePOA ), - SMESH_Hypothesis_i( thePOA ), - SMESH_Algo_i( thePOA ), - SMESH_3D_Algo_i( thePOA ) + int theStudyId, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + SMESH_Algo_i( thePOA ), + SMESH_3D_Algo_i( thePOA ) { MESSAGE( "StdMeshers_RadialPrism_3D_i::StdMeshers_RadialPrism_3D_i" ); myBaseImpl = new ::StdMeshers_RadialPrism_3D( theGenImpl->GetANewId(), - theStudyId, - theGenImpl ); + theStudyId, + theGenImpl ); } //----------------------------------------------------------------------------- @@ -101,4 +107,10 @@ StdMeshers_RadialPrism_3D_i::~StdMeshers_RadialPrism_3D_i() MESSAGE( "StdMeshers_RadialPrism_3D_i::GetImpl" ); return ( ::StdMeshers_RadialPrism_3D* )myBaseImpl; } +//----------------------------------------------------------------------------- +CORBA::Boolean StdMeshers_RadialPrism_3D_i::IsApplicable( const TopoDS_Shape &S, + CORBA::Boolean toCheckAll ) +{ + return ::StdMeshers_RadialPrism_3D::IsApplicable( S, toCheckAll ); +} diff --git a/src/StdMeshers_I/StdMeshers_Prism_3D_i.hxx b/src/StdMeshers_I/StdMeshers_Prism_3D_i.hxx index 995463cc3..dc01ef2e7 100644 --- a/src/StdMeshers_I/StdMeshers_Prism_3D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Prism_3D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,6 @@ // Moved here from SMESH_Prism_3D_i.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #ifndef _SMESH_Prism_3D_I_HXX_ #define _SMESH_Prism_3D_I_HXX_ @@ -57,6 +56,9 @@ public: // Get implementation ::StdMeshers_Prism_3D* GetImpl(); + + // Return true if the algorithm is applicable to a shape + static CORBA::Boolean IsApplicable(const TopoDS_Shape &S, CORBA::Boolean toCheckAll); }; // ====================================================== @@ -77,6 +79,9 @@ public: // Get implementation ::StdMeshers_RadialPrism_3D* GetImpl(); + + // Return true if the algorithm is applicable to a shape + static CORBA::Boolean IsApplicable(const TopoDS_Shape &S, CORBA::Boolean toCheckAll); }; diff --git a/src/StdMeshers_I/StdMeshers_ProjectionSource1D_i.cxx b/src/StdMeshers_I/StdMeshers_ProjectionSource1D_i.cxx index deb62285d..9ee397fae 100644 --- a/src/StdMeshers_I/StdMeshers_ProjectionSource1D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_ProjectionSource1D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_ProjectionSource1D_i.hxx b/src/StdMeshers_I/StdMeshers_ProjectionSource1D_i.hxx index c50a996d8..9b4fa3368 100644 --- a/src/StdMeshers_I/StdMeshers_ProjectionSource1D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_ProjectionSource1D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_ProjectionSource2D_i.cxx b/src/StdMeshers_I/StdMeshers_ProjectionSource2D_i.cxx index 8e33647ff..28f63e480 100644 --- a/src/StdMeshers_I/StdMeshers_ProjectionSource2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_ProjectionSource2D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_ProjectionSource2D_i.hxx b/src/StdMeshers_I/StdMeshers_ProjectionSource2D_i.hxx index f26e6ca58..2aea213ba 100644 --- a/src/StdMeshers_I/StdMeshers_ProjectionSource2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_ProjectionSource2D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_ProjectionSource3D_i.cxx b/src/StdMeshers_I/StdMeshers_ProjectionSource3D_i.cxx index 8dd2b5f9f..05414ee40 100644 --- a/src/StdMeshers_I/StdMeshers_ProjectionSource3D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_ProjectionSource3D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_ProjectionSource3D_i.hxx b/src/StdMeshers_I/StdMeshers_ProjectionSource3D_i.hxx index b92e8d8e9..e28f881e7 100644 --- a/src/StdMeshers_I/StdMeshers_ProjectionSource3D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_ProjectionSource3D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Projection_1D_2D_3D_i.cxx b/src/StdMeshers_I/StdMeshers_Projection_1D_2D_3D_i.cxx index e6ff323e9..771b4e828 100644 --- a/src/StdMeshers_I/StdMeshers_Projection_1D_2D_3D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Projection_1D_2D_3D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Projection_1D_2D_3D_i.hxx b/src/StdMeshers_I/StdMeshers_Projection_1D_2D_3D_i.hxx index 47635e949..c1d3517e0 100644 --- a/src/StdMeshers_I/StdMeshers_Projection_1D_2D_3D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Projection_1D_2D_3D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Propagation_i.cxx b/src/StdMeshers_I/StdMeshers_Propagation_i.cxx index 919d2f698..f49333a5e 100644 --- a/src/StdMeshers_I/StdMeshers_Propagation_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Propagation_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -23,7 +23,6 @@ // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_Propagation_i.cxx // Module : SMESH -// $Header$ // #include "StdMeshers_Propagation_i.hxx" #include "SMESH_Gen.hxx" @@ -43,8 +42,8 @@ using namespace std; StdMeshers_Propagation_i::StdMeshers_Propagation_i (PortableServer::POA_ptr thePOA, int theStudyId, ::SMESH_Gen* theGenImpl ) - : SALOME::GenericObj_i( thePOA ), - SMESH_Hypothesis_i( thePOA ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ) { MESSAGE( "StdMeshers_Propagation_i::StdMeshers_Propagation_i" ); myBaseImpl = new ::StdMeshers_Propagation(theGenImpl->GetANewId(), @@ -52,41 +51,49 @@ StdMeshers_Propagation_i::StdMeshers_Propagation_i (PortableServer::POA_ptr theP theGenImpl); } -//============================================================================= +//================================================================================ /*! - * StdMeshers_Propagation_i::~StdMeshers_Propagation_i + * \brief Verify whether hypothesis supports given entity type + * \param type - dimension (see SMESH::Dimension enumeration) + * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise * - * Destructor + * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration) */ -//============================================================================= -StdMeshers_Propagation_i::~StdMeshers_Propagation_i() +//================================================================================ +CORBA::Boolean StdMeshers_Propagation_i::IsDimSupported( SMESH::Dimension type ) { - MESSAGE( "StdMeshers_Propagation_i::~StdMeshers_Propagation_i" ); + return type == SMESH::DIM_1D; } //============================================================================= /*! - * StdMeshers_Propagation_i::GetImpl + * StdMeshers_PropagOfDistribution_i::StdMeshers_PropagOfDistribution_i * - * Get implementation + * Constructor */ //============================================================================= -::StdMeshers_Propagation* StdMeshers_Propagation_i::GetImpl() +StdMeshers_PropagOfDistribution_i:: +StdMeshers_PropagOfDistribution_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ) { - MESSAGE( "StdMeshers_Propagation_i::GetImpl" ); - return ( ::StdMeshers_Propagation* )myBaseImpl; + myBaseImpl = new ::StdMeshers_PropagOfDistribution(theGenImpl->GetANewId(), + theStudyId, + theGenImpl); } //================================================================================ /*! - * \brief Verify whether hypothesis supports given entity type - * \param type - dimension (see SMESH::Dimension enumeration) - * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise - * + * \brief Verify whether hypothesis supports given entity type + * \param type - dimension (see SMESH::Dimension enumeration) + * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise + * * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration) */ -//================================================================================ -CORBA::Boolean StdMeshers_Propagation_i::IsDimSupported( SMESH::Dimension type ) +//================================================================================ +CORBA::Boolean StdMeshers_PropagOfDistribution_i::IsDimSupported( SMESH::Dimension type ) { return type == SMESH::DIM_1D; } diff --git a/src/StdMeshers_I/StdMeshers_Propagation_i.hxx b/src/StdMeshers_I/StdMeshers_Propagation_i.hxx index 0b303abfd..c7d8ba481 100644 --- a/src/StdMeshers_I/StdMeshers_Propagation_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Propagation_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -23,7 +23,6 @@ // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_Propagation_i.hxx // Module : SMESH -// $Header$ // #ifndef _SMESH_PROPAGATION_I_HXX_ #define _SMESH_PROPAGATION_I_HXX_ @@ -41,6 +40,7 @@ class SMESH_Gen; // ====================================================== // Propagation hypothesis // ====================================================== + class STDMESHERS_I_EXPORT StdMeshers_Propagation_i: public virtual POA_StdMeshers::StdMeshers_Propagation, public virtual SMESH_Hypothesis_i @@ -50,11 +50,24 @@ public: StdMeshers_Propagation_i (PortableServer::POA_ptr thePOA, int theStudyId, ::SMESH_Gen* theGenImpl); - // Destructor - virtual ~StdMeshers_Propagation_i(); + + // Verify whether hypothesis supports given entity type + CORBA::Boolean IsDimSupported( SMESH::Dimension type ); +}; + +// ====================================================== +// Propagation of Distribution hypothesis +// ====================================================== - // Get implementation - ::StdMeshers_Propagation* GetImpl(); +class STDMESHERS_I_EXPORT StdMeshers_PropagOfDistribution_i: + public virtual POA_StdMeshers::StdMeshers_PropagOfDistribution, + public virtual SMESH_Hypothesis_i +{ +public: + // Constructor + StdMeshers_PropagOfDistribution_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl); // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported( SMESH::Dimension type ); diff --git a/src/StdMeshers_I/StdMeshers_QuadrangleParams_i.cxx b/src/StdMeshers_I/StdMeshers_QuadrangleParams_i.cxx index ba32f927a..a76be4f4f 100644 --- a/src/StdMeshers_I/StdMeshers_QuadrangleParams_i.cxx +++ b/src/StdMeshers_I/StdMeshers_QuadrangleParams_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,14 +21,17 @@ // Module : SMESH #include "StdMeshers_QuadrangleParams_i.hxx" -#include "SMESH_Gen_i.hxx" + #include "SMESH_Gen.hxx" +#include "SMESH_Gen_i.hxx" #include "SMESH_PythonDump.hxx" +#include "StdMeshers_ObjRefUlils.hxx" -#include "Utils_CorbaException.hxx" -#include "utilities.h" +#include +#include -#include +#include +#include "SMESH_TryCatch.hxx" using namespace std; @@ -82,13 +85,11 @@ void StdMeshers_QuadrangleParams_i::SetTriaVertex(CORBA::Long vertID) this->GetImpl()->SetTriaVertex( vertID ); } catch ( SALOME_Exception& S_ex ) { - THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), - SALOME::BAD_PARAM ); + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); } // Update Python script - SMESH::TPythonDump() << _this() << ".SetTriaVertex( " - << vertID << " )"; + SMESH::TPythonDump() << _this() << ".SetTriaVertex( " << vertID << " )"; } //============================================================================= @@ -147,8 +148,7 @@ char* StdMeshers_QuadrangleParams_i::GetObjectEntry() entry = this->GetImpl()->GetObjectEntry(); } catch ( SALOME_Exception& S_ex ) { - THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), - SALOME::BAD_PARAM ); + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); } return CORBA::string_dup( entry ); } @@ -162,12 +162,6 @@ char* StdMeshers_QuadrangleParams_i::GetObjectEntry() //============================================================================= void StdMeshers_QuadrangleParams_i::SetQuadType(StdMeshers::QuadType type) { - //static char* quadTypes[5] = {"StdMeshers.QUAD_STANDARD", - // "StdMeshers.QUAD_TRIANGLE_PREF", - // "StdMeshers.QUAD_QUADRANGLE_PREF", - // "StdMeshers.QUAD_QUADRANGLE_PREF_REVERSED", - // "StdMeshers.QUAD_REDUCED"}; - MESSAGE("StdMeshers_QuadrangleParams_i::SetQuadType"); ASSERT(myBaseImpl); @@ -199,7 +193,6 @@ void StdMeshers_QuadrangleParams_i::SetQuadType(StdMeshers::QuadType type) quadType = "UNKNOWN"; } SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadType << " )"; - //SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadTypes[int(type)] << " )"; } //============================================================================= @@ -216,6 +209,100 @@ StdMeshers::QuadType StdMeshers_QuadrangleParams_i::GetQuadType() return StdMeshers::QuadType(int(this->GetImpl()->GetQuadType())); } +//================================================================================ +/*! + * \brief Set positions of enforced nodes + */ +//================================================================================ + +void StdMeshers_QuadrangleParams_i::SetEnforcedNodes(const GEOM::ListOfGO& theVertices, + const SMESH::nodes_array& thePoints) + throw ( SALOME::SALOME_Exception ) +{ + try { + std::vector< TopoDS_Shape > shapes; + std::vector< gp_Pnt > points; + shapes.reserve( theVertices.length() ); + points.reserve( thePoints.length() ); + + myShapeEntries.clear(); + + for ( size_t i = 0; i < theVertices.length(); ++i ) + { + if ( CORBA::is_nil( theVertices[i] )) + continue; + CORBA::String_var entry = theVertices[i]->GetStudyEntry(); + if ( !entry.in() || !entry.in()[0] ) + THROW_SALOME_CORBA_EXCEPTION( "Not published enforced vertex shape", SALOME::BAD_PARAM ); + + shapes.push_back( StdMeshers_ObjRefUlils::GeomObjectToShape( theVertices[i].in() )); + myShapeEntries.push_back( entry.in() ); + } + for ( size_t i = 0; i < thePoints.length(); ++i ) + { + points.push_back( gp_Pnt( thePoints[i].x, thePoints[i].y, thePoints[i].z )); + } + this->GetImpl()->SetEnforcedNodes( shapes, points ); + } + catch ( SALOME_Exception& S_ex ) { + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); + } + // Update Python script + SMESH::TPythonDump() << _this() << ".SetEnforcedNodes( " + << theVertices << ", " << thePoints << " )"; +} + +//================================================================================ +/*! + * \brief Returns positions of enforced nodes + */ +//================================================================================ + +void StdMeshers_QuadrangleParams_i::GetEnforcedNodes(GEOM::ListOfGO_out theVertices, + SMESH::nodes_array_out thePoints) +{ + SMESH_TRY; + + std::vector< TopoDS_Shape > shapes; + std::vector< gp_Pnt > points; + this->GetImpl()->GetEnforcedNodes( shapes, points ); + + theVertices = new GEOM::ListOfGO; + thePoints = new SMESH::nodes_array; + + size_t i = 0; + theVertices->length( myShapeEntries.size() ); + for ( i = 0; i < myShapeEntries.size(); ++i ) + theVertices[i] = + StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject( myShapeEntries[i], shapes[i] ); + + thePoints->length( points.size() ); + for ( i = 0; i < points.size(); ++i ) + { + thePoints[i].x = points[i].X(); + thePoints[i].y = points[i].Y(); + thePoints[i].z = points[i].Z(); + } + SMESH_CATCH( SMESH::doNothing ); +} + +//================================================================================ +/*! + * \brief Returns study entries of shapes defining enforced nodes + */ +//================================================================================ + +SMESH::string_array* StdMeshers_QuadrangleParams_i::GetEnfVertices() +{ + SMESH::string_array_var arr = new SMESH::string_array; + arr->length( myShapeEntries.size() ); + + for ( size_t i = 0; i < myShapeEntries.size(); ++i ) + arr[ i ] = myShapeEntries[ i ].c_str(); + + return arr._retn(); +} + //============================================================================= /*! * StdMeshers_QuadrangleParams_i::GetImpl @@ -243,3 +330,58 @@ CORBA::Boolean StdMeshers_QuadrangleParams_i::IsDimSupported( SMESH::Dimension t { return type == SMESH::DIM_2D; } + +//================================================================================ +/*! + * \brief Write parameters in a string + * \retval char* - resulting string + */ +//================================================================================ + +char* StdMeshers_QuadrangleParams_i::SaveTo() +{ + ASSERT( myBaseImpl ); + std::ostringstream os; + + os << "ENTRIES: " << myShapeEntries.size(); + for ( size_t i = 0; i < myShapeEntries.size(); ++i ) + StdMeshers_ObjRefUlils::SaveToStream( myShapeEntries[ i ], os ); + os << " "; + + myBaseImpl->SaveTo( os ); + + return CORBA::string_dup( os.str().c_str() ); +} + +//================================================================================ +/*! + * \brief Retrieve parameters from the string + * \param theStream - the input string + */ +//================================================================================ + +void StdMeshers_QuadrangleParams_i::LoadFrom( const char* theStream ) +{ + ASSERT( myBaseImpl ); + + bool hasEntries = ( strncmp( "ENTRIES: ", theStream, 9 ) == 0 ); + std::istringstream is( theStream + ( hasEntries ? 9 : 0 )); + + if ( hasEntries ) + { + int nb = 0; + if ( is >> nb && nb > 0 ) + { + std::vector< TopoDS_Shape > shapes; + std::vector< gp_Pnt > points; + myShapeEntries.resize( nb ); + + for ( int i = 0; i < nb; ++i ) + shapes.push_back( StdMeshers_ObjRefUlils::LoadFromStream( is, & myShapeEntries[i] )); + + GetImpl()->SetEnforcedNodes( shapes, points ); + } + } + + myBaseImpl->LoadFrom( is ); +} diff --git a/src/StdMeshers_I/StdMeshers_QuadrangleParams_i.hxx b/src/StdMeshers_I/StdMeshers_QuadrangleParams_i.hxx index 4596712a0..6a3d00400 100644 --- a/src/StdMeshers_I/StdMeshers_QuadrangleParams_i.hxx +++ b/src/StdMeshers_I/StdMeshers_QuadrangleParams_i.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,7 +19,6 @@ // File : StdMeshers_QuadrangleParams_i.hxx // Author : Sergey KUUL, OCC // Module : SMESH -// $Header$ #ifndef _SMESH_QUADRANGLEPARAMS_I_HXX_ #define _SMESH_QUADRANGLEPARAMS_I_HXX_ @@ -47,13 +46,6 @@ public: // Destructor virtual ~StdMeshers_QuadrangleParams_i(); - // Set length - //void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart ) - // throw ( SALOME::SALOME_Exception ); - - // Get length - //CORBA::Double GetLength(CORBA::Boolean theIsStart); - // Set base vertex for triangles void SetTriaVertex (CORBA::Long vertID); @@ -72,11 +64,31 @@ public: // Get the type of quadrangulation StdMeshers::QuadType GetQuadType(); + // Set positions of enforced nodes + void SetEnforcedNodes(const GEOM::ListOfGO& vertices, + const SMESH::nodes_array& points) throw ( SALOME::SALOME_Exception ); + + // Returns positions of enforced nodes + void GetEnforcedNodes(GEOM::ListOfGO_out vertices, SMESH::nodes_array_out points); + + // Returns entries of shapes defining enforced nodes + SMESH::string_array* GetEnfVertices(); + + // Get implementation ::StdMeshers_QuadrangleParams* GetImpl(); // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + + // Redefined Persistence + virtual char* SaveTo(); + virtual void LoadFrom( const char* theStream ); + + protected: + + std::vector myShapeEntries; + }; #endif diff --git a/src/StdMeshers_I/StdMeshers_QuadranglePreference_i.cxx b/src/StdMeshers_I/StdMeshers_QuadranglePreference_i.cxx index d0f1354ae..e1b44fe31 100644 --- a/src/StdMeshers_I/StdMeshers_QuadranglePreference_i.cxx +++ b/src/StdMeshers_I/StdMeshers_QuadranglePreference_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_QuadranglePreference_i.hxx b/src/StdMeshers_I/StdMeshers_QuadranglePreference_i.hxx index 9759fa077..474246550 100644 --- a/src/StdMeshers_I/StdMeshers_QuadranglePreference_i.hxx +++ b/src/StdMeshers_I/StdMeshers_QuadranglePreference_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.cxx b/src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.cxx index e09f1313a..3ca07c9e8 100644 --- a/src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,6 @@ // Moved here from SMESH_Quadrangle_2D_i.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #include "StdMeshers_Quadrangle_2D_i.hxx" #include "SMESH_Gen.hxx" @@ -44,17 +43,17 @@ using namespace std; //============================================================================= StdMeshers_Quadrangle_2D_i::StdMeshers_Quadrangle_2D_i( PortableServer::POA_ptr thePOA, - int theStudyId, - ::SMESH_Gen* theGenImpl ) - : SALOME::GenericObj_i( thePOA ), - SMESH_Hypothesis_i( thePOA ), - SMESH_Algo_i( thePOA ), - SMESH_2D_Algo_i( thePOA ) + int theStudyId, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + SMESH_Algo_i( thePOA ), + SMESH_2D_Algo_i( thePOA ) { MESSAGE( "StdMeshers_Quadrangle_2D_i::StdMeshers_Quadrangle_2D_i" ); myBaseImpl = new ::StdMeshers_Quadrangle_2D( theGenImpl->GetANewId(), - theStudyId, - theGenImpl ); + theStudyId, + theGenImpl ); } //============================================================================= @@ -62,7 +61,7 @@ StdMeshers_Quadrangle_2D_i::StdMeshers_Quadrangle_2D_i( PortableServer::POA_ptr * StdMeshers_Quadrangle_2D_i::~StdMeshers_Quadrangle_2D_i * * Destructor - * + * */ //============================================================================= @@ -85,3 +84,17 @@ StdMeshers_Quadrangle_2D_i::~StdMeshers_Quadrangle_2D_i() return ( ::StdMeshers_Quadrangle_2D* )myBaseImpl; } +//============================================================================= +/*! + * StdMeshers_Quadrangle_2D_i::IsApplicable + * + * Return true if the algorithm is applicable to a shape + */ +//============================================================================= + +CORBA::Boolean StdMeshers_Quadrangle_2D_i::IsApplicable( const TopoDS_Shape &S, + CORBA::Boolean toCheckAll ) +{ + return ::StdMeshers_Quadrangle_2D::IsApplicable( S, toCheckAll ); +} + diff --git a/src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.hxx b/src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.hxx index eea60f3df..194817527 100644 --- a/src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,6 @@ // Moved here from SMESH_Quadrangle_2D_i.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #ifndef _SMESH_QUADRANGLE_2D_I_HXX_ #define _SMESH_QUADRANGLE_2D_I_HXX_ @@ -47,17 +46,20 @@ class STDMESHERS_I_EXPORT StdMeshers_Quadrangle_2D_i: public virtual POA_StdMeshers::StdMeshers_Quadrangle_2D, public virtual SMESH_2D_Algo_i { -public: + public: // Constructor StdMeshers_Quadrangle_2D_i( PortableServer::POA_ptr thePOA, - int theStudyId, - ::SMESH_Gen* theGenImpl ); + int theStudyId, + ::SMESH_Gen* theGenImpl ); // Destructor virtual ~StdMeshers_Quadrangle_2D_i(); // Get implementation ::StdMeshers_Quadrangle_2D* GetImpl(); + + // Return true if the algorithm is applicable to a shape + static CORBA::Boolean IsApplicable(const TopoDS_Shape &S, CORBA::Boolean toCheckAll); }; #endif diff --git a/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.cxx b/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.cxx index 6d5813927..b7309f46f 100644 --- a/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.cxx +++ b/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.hxx b/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.hxx index 113e72b36..bfa27b206 100644 --- a/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.hxx +++ b/src/StdMeshers_I/StdMeshers_QuadraticMesh_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.cxx b/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.cxx index d69291af8..2e085910f 100644 --- a/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -66,3 +66,9 @@ StdMeshers_RadialQuadrangle_1D2D_i::~StdMeshers_RadialQuadrangle_1D2D_i() return ( ::StdMeshers_RadialQuadrangle_1D2D* )myBaseImpl; } +//----------------------------------------------------------------------------- + +CORBA::Boolean StdMeshers_RadialQuadrangle_1D2D_i::IsApplicable( const TopoDS_Shape &S, CORBA::Boolean toCheckAll ) +{ + return ::StdMeshers_RadialQuadrangle_1D2D::IsApplicable( S, toCheckAll ); +} diff --git a/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.hxx b/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.hxx index f710d2581..6b5ad3115 100644 --- a/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -47,6 +47,9 @@ public: // Get implementation ::StdMeshers_RadialQuadrangle_1D2D* GetImpl(); + + // Return true if the algorithm is applicable to a shape + static CORBA::Boolean IsApplicable(const TopoDS_Shape &S, CORBA::Boolean toCheckAll); }; diff --git a/src/StdMeshers_I/StdMeshers_Regular_1D_i.cxx b/src/StdMeshers_I/StdMeshers_Regular_1D_i.cxx index a20b18632..151551f2e 100644 --- a/src/StdMeshers_I/StdMeshers_Regular_1D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Regular_1D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Regular_1D_i.hxx b/src/StdMeshers_I/StdMeshers_Regular_1D_i.hxx index 43ccce8e2..c1ddc6bec 100644 --- a/src/StdMeshers_I/StdMeshers_Regular_1D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Regular_1D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_Reversible1D_i.cxx b/src/StdMeshers_I/StdMeshers_Reversible1D_i.cxx new file mode 100644 index 000000000..b09207f24 --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_Reversible1D_i.cxx @@ -0,0 +1,143 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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_I : idl implementation based on 'SMESH' unit's calsses +// File : StdMeshers_Reversible1D_i.cxx +// Module : SMESH +// +#include "StdMeshers_Reversible1D_i.hxx" +#include "SMESH_PythonDump.hxx" + +#include +#include + +#include CORBA_SERVER_HEADER(SMESH_Hypothesis) + +//================================================================================ +/*! + * \brief Constructor + */ +//================================================================================ + +StdMeshers_Reversible1D_i::StdMeshers_Reversible1D_i( SMESH_Hypothesis_i* reversible ) + : myHyp( reversible ) +{ +} + +//============================================================================= +/*! + * StdMeshers_Reversible1D_i::SetReversedEdges + * + * Set edges to reverse + */ +//============================================================================= + +void StdMeshers_Reversible1D_i::SetReversedEdges( const SMESH::long_array& theIds ) +{ + try { + std::vector ids( theIds.length() ); + CORBA::Long iEnd = theIds.length(); + for ( CORBA::Long i = 0; i < iEnd; i++ ) + ids[ i ] = theIds[ i ]; + + this->GetImpl()->SetReversedEdges( ids ); + } + catch ( SALOME_Exception& S_ex ) { + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); + } + + // Update Python script + SMESH::TPythonDump() << myHyp->_this() << ".SetReversedEdges( " << theIds << " )"; +} + +//============================================================================= +/*! + * StdMeshers_Reversible1D_i::SetObjectEntry + * + * Set the Entry for the Main Object + */ +//============================================================================= + +void StdMeshers_Reversible1D_i::SetObjectEntry( const char* theEntry ) +{ + string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping + try { + this->GetImpl()->SetObjectEntry( entry.c_str() ); + // Update Python script + SMESH::TPythonDump() << myHyp->_this() << ".SetObjectEntry( \"" << entry.c_str() << "\" )"; + } + catch ( SALOME_Exception& S_ex ) { + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),SALOME::BAD_PARAM ); + } +} + +//============================================================================= +/*! + * StdMeshers_Reversible1D_i::GetObjectEntry + * + * Set the Entry for the Main Object + */ +//============================================================================= + +char* StdMeshers_Reversible1D_i::GetObjectEntry() +{ + const char* entry; + try { + entry = this->GetImpl()->GetObjectEntry(); + } + catch ( SALOME_Exception& S_ex ) { + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); + } + return CORBA::string_dup( entry ); +} + +//============================================================================= +/*! + * StdMeshers_Reversible1D_i::GetReversedEdges + * + * Get reversed edges + */ +//============================================================================= + +SMESH::long_array* StdMeshers_Reversible1D_i::GetReversedEdges() +{ + SMESH::long_array_var anArray = new SMESH::long_array; + std::vector ids = this->GetImpl()->GetReversedEdges(); + anArray->length( ids.size() ); + for ( CORBA::Long i = 0; i < ids.size(); i++) + anArray [ i ] = ids [ i ]; + + return anArray._retn(); +} + +//============================================================================= +/*! + * StdMeshers_Reversible1D_i::GetImpl + * + * Get implementation + */ +//============================================================================= + +::StdMeshers_Reversible1D* StdMeshers_Reversible1D_i::GetImpl() +{ + return ( ::StdMeshers_Reversible1D* )myHyp->GetImpl(); +} diff --git a/src/StdMeshers_I/StdMeshers_Reversible1D_i.hxx b/src/StdMeshers_I/StdMeshers_Reversible1D_i.hxx new file mode 100644 index 000000000..f03c5d854 --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_Reversible1D_i.hxx @@ -0,0 +1,66 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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_I : idl implementation based on 'SMESH' unit's calsses +// File : StdMeshers_Reversible1D_i.hxx +// Module : SMESH +// +#ifndef _SMESH_Reversible1D_I_HXX_ +#define _SMESH_Reversible1D_I_HXX_ + +#include "SMESH_StdMeshers_I.hxx" + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_Hypothesis_i.hxx" +#include "StdMeshers_Reversible1D.hxx" + +// ====================================================== +// Common metrhods of Reversible 1D hypotheses +// ====================================================== +class STDMESHERS_I_EXPORT StdMeshers_Reversible1D_i: + public virtual POA_StdMeshers::Reversible1D +{ + public: + StdMeshers_Reversible1D_i( SMESH_Hypothesis_i* reversible ); + + //Set Reversed Edges + void SetReversedEdges( const SMESH::long_array& theIDs); + + //Get Reversed Edges + SMESH::long_array* GetReversedEdges(); + + //Set the Entry of the Object + void SetObjectEntry( const char* theEntry); + + //Get Object Entry + char* GetObjectEntry(); + + // Get implementation + ::StdMeshers_Reversible1D* GetImpl(); + + private: + SMESH_Hypothesis_i* myHyp; +}; + +#endif diff --git a/src/StdMeshers_I/StdMeshers_SegmentAroundVertex_0D_i.cxx b/src/StdMeshers_I/StdMeshers_SegmentAroundVertex_0D_i.cxx index ec9381ae1..346842f63 100644 --- a/src/StdMeshers_I/StdMeshers_SegmentAroundVertex_0D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_SegmentAroundVertex_0D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_SegmentAroundVertex_0D_i.hxx b/src/StdMeshers_I/StdMeshers_SegmentAroundVertex_0D_i.hxx index 9b03579d1..9a5c5030a 100644 --- a/src/StdMeshers_I/StdMeshers_SegmentAroundVertex_0D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_SegmentAroundVertex_0D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.cxx b/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.cxx index 912c53236..a294ee464 100644 --- a/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.cxx +++ b/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.hxx b/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.hxx index 0d6c58e20..1729a48bc 100644 --- a/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.hxx +++ b/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_StartEndLength_i.cxx b/src/StdMeshers_I/StdMeshers_StartEndLength_i.cxx index e6e03703e..7e8b3ac4c 100644 --- a/src/StdMeshers_I/StdMeshers_StartEndLength_i.cxx +++ b/src/StdMeshers_I/StdMeshers_StartEndLength_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_StartEndLength_i.hxx b/src/StdMeshers_I/StdMeshers_StartEndLength_i.hxx index 873583407..79a9dbf55 100644 --- a/src/StdMeshers_I/StdMeshers_StartEndLength_i.hxx +++ b/src/StdMeshers_I/StdMeshers_StartEndLength_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_UseExisting_1D2D_i.cxx b/src/StdMeshers_I/StdMeshers_UseExisting_1D2D_i.cxx index 9c2e16027..8790c9810 100644 --- a/src/StdMeshers_I/StdMeshers_UseExisting_1D2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_UseExisting_1D2D_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_UseExisting_1D2D_i.hxx b/src/StdMeshers_I/StdMeshers_UseExisting_1D2D_i.hxx index 187412245..01f182067 100644 --- a/src/StdMeshers_I/StdMeshers_UseExisting_1D2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_UseExisting_1D2D_i.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx b/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx index e26f4cae5..c8fae2d92 100644 --- a/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx b/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx index 91b072146..f521d3431 100644 --- a/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx b/src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx index 5ad82c7ec..6a1f41daa 100644 --- a/src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx +++ b/src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -78,15 +78,18 @@ StdMeshers_ViscousLayers_i::~StdMeshers_ViscousLayers_i() */ //================================================================================ -void StdMeshers_ViscousLayers_i::SetIgnoreFaces(const ::SMESH::long_array& faceIDs) -throw ( SALOME::SALOME_Exception ) +void StdMeshers_ViscousLayers_i::SetFaces(const ::SMESH::long_array& faceIDs, + CORBA::Boolean toIgnore) + throw ( SALOME::SALOME_Exception ) { vector ids( faceIDs.length() ); for ( unsigned i = 0; i < ids.size(); ++i ) if (( ids[i] = faceIDs[i] ) < 1 ) THROW_SALOME_CORBA_EXCEPTION( "Invalid face id", SALOME::BAD_PARAM ); - GetImpl()->SetBndShapes( ids, /*toIgnore=*/true ); - SMESH::TPythonDump() << _this() << ".SetIgnoreFaces( " << faceIDs << " )"; + + GetImpl()->SetBndShapes( ids, toIgnore ); + + SMESH::TPythonDump() << _this() << ".SetFaces( " << faceIDs << ", " << toIgnore << " )"; } //================================================================================ @@ -95,16 +98,13 @@ throw ( SALOME::SALOME_Exception ) */ //================================================================================ -SMESH::long_array* StdMeshers_ViscousLayers_i::GetIgnoreFaces() +SMESH::long_array* StdMeshers_ViscousLayers_i::GetFaces() { + vector idsVec = GetImpl()->GetBndShapes(); SMESH::long_array_var ids = new SMESH::long_array; - if ( GetImpl()->IsToIgnoreShapes() ) - { - vector idsVec = GetImpl()->GetBndShapes(); - ids->length( idsVec.size() ); - for ( unsigned i = 0; i < idsVec.size(); ++i ) - ids[i] = idsVec[i]; - } + ids->length( idsVec.size() ); + for ( unsigned i = 0; i < idsVec.size(); ++i ) + ids[i] = idsVec[i]; return ids._retn(); } @@ -114,6 +114,47 @@ SMESH::long_array* StdMeshers_ViscousLayers_i::GetIgnoreFaces() */ //================================================================================ +SMESH::long_array* StdMeshers_ViscousLayers_i::GetIgnoreFaces() +{ + if ( GetImpl()->IsToIgnoreShapes() ) + return this->GetFaces(); + return new SMESH::long_array; +} + +//================================================================================ +/*! + * \brief + */ +//================================================================================ + +CORBA::Boolean StdMeshers_ViscousLayers_i::GetIsToIgnoreFaces() +{ + return GetImpl()->IsToIgnoreShapes(); +} + +//================================================================================ +/*! + * \brief + */ +//================================================================================ + +void StdMeshers_ViscousLayers_i::SetIgnoreFaces(const ::SMESH::long_array& faceIDs) +throw ( SALOME::SALOME_Exception ) +{ + vector ids( faceIDs.length() ); + for ( unsigned i = 0; i < ids.size(); ++i ) + if (( ids[i] = faceIDs[i] ) < 1 ) + THROW_SALOME_CORBA_EXCEPTION( "Invalid face id", SALOME::BAD_PARAM ); + GetImpl()->SetBndShapes( ids, /*toIgnore=*/true ); + SMESH::TPythonDump() << _this() << ".SetIgnoreFaces( " << faceIDs << " )"; +} + +//================================================================================ +/*! + * \brief + */ +//================================================================================ + void StdMeshers_ViscousLayers_i::SetTotalThickness(::CORBA::Double thickness) throw ( SALOME::SALOME_Exception ) { diff --git a/src/StdMeshers_I/StdMeshers_ViscousLayers_i.hxx b/src/StdMeshers_I/StdMeshers_ViscousLayers_i.hxx index 59c8d324c..e2e5b4b9d 100644 --- a/src/StdMeshers_I/StdMeshers_ViscousLayers_i.hxx +++ b/src/StdMeshers_I/StdMeshers_ViscousLayers_i.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -51,6 +51,11 @@ class STDMESHERS_I_EXPORT StdMeshers_ViscousLayers_i: void SetIgnoreFaces(const ::SMESH::long_array& faceIDs) throw ( SALOME::SALOME_Exception ); SMESH::long_array* GetIgnoreFaces(); + void SetFaces(const SMESH::long_array& faceIDs, + CORBA::Boolean toIgnore) throw (SALOME::SALOME_Exception); + SMESH::long_array* GetFaces(); + CORBA::Boolean GetIsToIgnoreFaces(); + void SetTotalThickness(::CORBA::Double thickness) throw ( SALOME::SALOME_Exception ); ::CORBA::Double GetTotalThickness(); diff --git a/src/StdMeshers_I/StdMeshers_i.cxx b/src/StdMeshers_I/StdMeshers_i.cxx index 3cc3ac050..bdfcb2fc8 100644 --- a/src/StdMeshers_I/StdMeshers_i.cxx +++ b/src/StdMeshers_I/StdMeshers_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -35,6 +35,7 @@ #include "StdMeshers_AutomaticLength_i.hxx" #include "StdMeshers_StartEndLength_i.hxx" #include "StdMeshers_Arithmetic1D_i.hxx" +#include "StdMeshers_Geometric1D_i.hxx" #include "StdMeshers_FixedPoints1D_i.hxx" #include "StdMeshers_NumberOfSegments_i.hxx" #include "StdMeshers_Deflection1D_i.hxx" @@ -79,11 +80,23 @@ #include "StdMeshers_ViscousLayers2D_i.hxx" #include "StdMeshers_CartesianParameters3D_i.hxx" -template class StdHypothesisCreator_i:public HypothesisCreator_i +namespace SMESH { + class ApplicableToAny + { + public: + static CORBA::Boolean IsApplicable( const TopoDS_Shape &S, CORBA::Boolean toCheckAll ) { + return true; + } + }; +}; +template class StdHypothesisCreator_i:public HypothesisCreator_i { public: // as we have 'module StdMeshers' in SMESH_BasicHypothesis.idl virtual std::string GetModuleName() { return "StdMeshers"; } + virtual CORBA::Boolean IsApplicable( const TopoDS_Shape & S, CORBA::Boolean toCheckAll ) { + return TIsApplicable::IsApplicable( S, toCheckAll ); + } }; //============================================================================= @@ -136,6 +149,8 @@ STDMESHERS_I_EXPORT aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Propagation") == 0) aCreator = new StdHypothesisCreator_i; + else if (strcmp(aHypName, "PropagOfDistribution") == 0) + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "MaxElementArea") == 0) aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "MaxElementVolume") == 0) @@ -150,6 +165,8 @@ STDMESHERS_I_EXPORT aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Arithmetic1D") == 0) aCreator = new StdHypothesisCreator_i; + else if (strcmp(aHypName, "GeometricProgression") == 0) + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "AutomaticLength") == 0) aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "QuadranglePreference") == 0) @@ -198,9 +215,9 @@ STDMESHERS_I_EXPORT aCreator = new StdHypothesisCreator_i; #endif else if (strcmp(aHypName, "Quadrangle_2D") == 0) - aCreator = new StdHypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Hexa_3D") == 0) - aCreator = new StdHypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Projection_1D") == 0) aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Projection_1D2D") == 0) @@ -208,11 +225,11 @@ STDMESHERS_I_EXPORT else if (strcmp(aHypName, "Projection_2D") == 0) aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Projection_3D") == 0) - aCreator = new StdHypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Prism_3D") == 0) - aCreator = new StdHypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "RadialPrism_3D") == 0) - aCreator = new StdHypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "SegmentAroundVertex_0D") == 0) aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "CompositeSegment_1D") == 0) @@ -222,7 +239,7 @@ STDMESHERS_I_EXPORT else if (strcmp(aHypName, "UseExisting_2D") == 0) aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "RadialQuadrangle_1D2D") == 0) - aCreator = new StdHypothesisCreator_i; + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Import_1D") == 0) aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Import_1D2D") == 0) diff --git a/src/Tools/CMakeLists.txt b/src/Tools/CMakeLists.txt index a2abf7d49..bf0346e8f 100644 --- a/src/Tools/CMakeLists.txt +++ b/src/Tools/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -20,10 +20,13 @@ ADD_SUBDIRECTORY(MeshCut) ADD_SUBDIRECTORY(padder) ADD_SUBDIRECTORY(Verima) +ADD_SUBDIRECTORY(blocFissure) +ADD_SUBDIRECTORY(MacMesh) IF(SALOME_BUILD_GUI) ADD_SUBDIRECTORY(MGCleanerPlug) ADD_SUBDIRECTORY(YamsPlug) + ADD_SUBDIRECTORY(ZCracksPlug) ENDIF(SALOME_BUILD_GUI) # scripts / static diff --git a/src/Tools/MGCleanerPlug/CMakeLists.txt b/src/Tools/MGCleanerPlug/CMakeLists.txt index d6147291d..f631a56c5 100644 --- a/src/Tools/MGCleanerPlug/CMakeLists.txt +++ b/src/Tools/MGCleanerPlug/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py b/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py index b7d02ec8e..9eb639064 100644 --- a/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py +++ b/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2013 EDF R&D +# Copyright (C) 2007-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py b/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py index aa8170a97..b139a0d4c 100644 --- a/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py +++ b/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2013 EDF R&D +# Copyright (C) 2007-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MGCleanerPlug/MGCleanerplug_plugin.py b/src/Tools/MGCleanerPlug/MGCleanerplug_plugin.py index 80eeae790..18893f886 100644 --- a/src/Tools/MGCleanerPlug/MGCleanerplug_plugin.py +++ b/src/Tools/MGCleanerPlug/MGCleanerplug_plugin.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2006-2013 EDF R&D +# Copyright (C) 2006-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MGCleanerPlug/doc/CMakeLists.txt b/src/Tools/MGCleanerPlug/doc/CMakeLists.txt index 686ed4be9..faeb39e6d 100755 --- a/src/Tools/MGCleanerPlug/doc/CMakeLists.txt +++ b/src/Tools/MGCleanerPlug/doc/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MGCleanerPlug/doc/conf.py.in b/src/Tools/MGCleanerPlug/doc/conf.py.in index cb90813a7..5d8876c8b 100644 --- a/src/Tools/MGCleanerPlug/doc/conf.py.in +++ b/src/Tools/MGCleanerPlug/doc/conf.py.in @@ -36,7 +36,7 @@ master_doc = 'index' # General substitutions. project = 'MGCleaner Plug-in' -copyright = '2013, CEA' +copyright = '2013-2014, CEA' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. diff --git a/src/Tools/MacMesh/CMakeLists.txt b/src/Tools/MacMesh/CMakeLists.txt new file mode 100644 index 000000000..4cf6c7293 --- /dev/null +++ b/src/Tools/MacMesh/CMakeLists.txt @@ -0,0 +1,68 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 + +SET(MACMESH_INSTALL_PY ${SALOME_SMESH_INSTALL_PLUGINS}/MacMesh) +SET(MACMESH_INSTALL_DOC ${SALOME_INSTALL_DOC}/gui/SMESH/MacMesh) + +SALOME_CONFIGURE_FILE(Doc/index.html.in index.html) +SALOME_CONFIGURE_FILE(Example/PressureValve.py.in PressureValve.py) + +SET(plugin_DOC_FILES + Doc/MacMesh.v.10avr.pdf + ${CMAKE_CURRENT_BINARY_DIR}/index.html + Doc/snap.jpg + ) + +IF(SALOME_BUILD_DOC) + INSTALL(FILES ${plugin_DOC_FILES} DESTINATION ${MACMESH_INSTALL_DOC}) +ENDIF(SALOME_BUILD_DOC) + +# --- scripts --- + +# scripts / static +SET(plugin_SCRIPTS + MacMesh/Alarms.py + MacMesh/CentralUnrefine.py + MacMesh/CompositeBox.py + MacMesh/CompositeBoxF.py + MacMesh/Config.py + MacMesh/CutnGroup.py + MacMesh/Cylinder.py + MacMesh/GenFunctions.py + MacMesh/MacObject.py + MacMesh/PublishGroups.py + MacMesh/SharpAngle.py +) +SET(sample_SCRIPT + ${CMAKE_CURRENT_BINARY_DIR}/PressureValve.py +) +# --- rules --- + +SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${MACMESH_INSTALL_PY}) +SALOME_INSTALL_SCRIPTS("${sample_SCRIPT}" ${SALOME_INSTALL_SCRIPT_PYTHON} DEF_PERMS) + +SET(testname MacMesh_Example_PressureValve) +SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) +ADD_TEST( + NAME ${testname} + COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py ${sample_SCRIPT}) +SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}") + diff --git a/src/Tools/MacMesh/Doc/MacMesh.v.10avr.pdf b/src/Tools/MacMesh/Doc/MacMesh.v.10avr.pdf new file mode 100755 index 000000000..0c59d56a6 Binary files /dev/null and b/src/Tools/MacMesh/Doc/MacMesh.v.10avr.pdf differ diff --git a/src/Tools/MacMesh/Doc/index.html.in b/src/Tools/MacMesh/Doc/index.html.in new file mode 100644 index 000000000..fc87fe214 --- /dev/null +++ b/src/Tools/MacMesh/Doc/index.html.in @@ -0,0 +1,20 @@ + + + + + MacMesh for Salome + +

The multi-purpose Salome plug-in for regular 2D meshing

+
    +
  • Consider reading + User manual to learn how to use the plug-in
  • +
  • Type import PressureValve in the Python console of + Salome to run a sample script
  • +
  • + Download the sample script
  • +
  • Python files of the plugin are located in
    + ${SMESH_ROOT_DIR}/@MACMESH_INSTALL_PY@ directory
  • +
+ + + diff --git a/src/Tools/MacMesh/Doc/snap.jpg b/src/Tools/MacMesh/Doc/snap.jpg new file mode 100644 index 000000000..a9765fc59 Binary files /dev/null and b/src/Tools/MacMesh/Doc/snap.jpg differ diff --git a/src/Tools/MacMesh/Example/PressureValve.py.in b/src/Tools/MacMesh/Example/PressureValve.py.in new file mode 100755 index 000000000..713e27f4a --- /dev/null +++ b/src/Tools/MacMesh/Example/PressureValve.py.in @@ -0,0 +1,115 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 + +################################################################## +# Header for salome initialization ############################### + +import sys, salome, math, os +sys.path.append( os.path.join( os.getenv('SMESH_ROOT_DIR'), '@MACMESH_INSTALL_PY@')) + +import Config, GenFunctions + +Config.theStudy = salome.myStudy; + +from MacObject import * +from SharpAngle import * +from CentralUnrefine import * +from PublishGroups import * +from CompositeBox import * +from CompositeBoxF import * + + + +################################################################## +# Mesh name ###################################################### + +Config.StudyName = "SRV_X." + +################################################################## +# Definition of geometrical parameters ########################### + +X = 1.0 # Valve initial opening + +Config.StudyName += str(X)+"mm" + +R = 7.5 # Upstream pipe radius +T = 5.0 # Upstream pipe thickness +H = 20.0 # Upstream pipe height +J = 6.0 # Jet distance +E = 60.0 # Exit extent + +################################################################## +# Definition of meshing parameters ############################### + +d = 0.1 # Meshing element size at the inner corner +Nl = 1 # Number of levels in the local refinement +################################################################## +Bloc = [] + +# Object No. 1 # +Bloc.append( SharpAngleOut(0.,0.,X,1.5*X,X,d,'NE',Nl, + groups=['PH','PV_IN','VH',None,None,None]) ) + +# Object No. 2 # +Bloc.append( CompositeBox(X/2.+0.5*(R-X/2.),0.5*(X+X/2.)-X/2.,R-X/2.,X+X/2., + groups=[None,'VH',None,'AXIS'] ) ) + +# Object No. 3 # +Bloc.append( CompositeBoxF((0.,-X/2.),(R,-X/2.),(R,-H),(0.,-H), + groups=['IN',None,'PV_IN','AXIS'] ) ) + +# Object No. 4 # +Bloc.append( SharpAngleOut(-T,0.,X,X,X,d,'NW',Nl, + groups=['PH','PV_OUT',None,None,None,None]) ) + +# Object No. 5 # +Bloc.append( SharpAngleOut(-T,X,X,X,X,d,'SW',Nl, + groups=['VH','VV',None,None,None,None]) ) + +if X < T : + gap = T-X + Bloc.append( MacObject('CompBoxF',[(-X/2.-gap/2.,X/2.),(gap,X)], + ['auto'],groups=['PH','VH',None,None] ) ) + +# Object No. 6 # +Bloc.append( MacObject('CompBoxF',[(-T-X/2.-(J-X/2.)/2.,X/2.),(J-X/2.,2.*X)], + ['auto'],groups=[None,None,None,None] ) ) + +# Object No. 7 # +Bloc.append( CentralUnrefine(-T-J,X/2.,2.*E-J,E,'EW', + groups=[None,None,None,'OUT_V','OUT_H_HI','OUT_H_LO'])) + +# Object No. 8 # +Bloc.append( CompositeBox(-T-J/2.,-X/2.-0.5*((E-X)/2.-X/2.),J,(E-X)/2.-X/2., + groups=['OUT_H_LO',None,None,'PV_OUT'] ) ) + +# Object No. 9 # +Bloc.append( CompositeBox(-T-J/2.,X+X/2.+0.5*((E-X)/2.-X/2.),J,(E-X)/2.-X/2., + groups=[None,'OUT_H_HI',None,'VV'] ) ) + +SRVMesh = PublishGroups() + +RealLocalMeshing = Bloc[0][0].GeoPar[1][0]/Bloc[0][0].DirectionalMeshParams[0] +ExtrusionAngle = 2. * math.asin(RealLocalMeshing/(2*R))*180./math.pi +print "\nThe mesh will be revolved with an angle of :",ExtrusionAngle + +RevolveMesh(SRVMesh, Center=[R+0.01,0,0], Direction=[0,1,0], AngleDeg=ExtrusionAngle, Scale=0.001) + diff --git a/src/Tools/MacMesh/MacMesh/Alarms.py b/src/Tools/MacMesh/MacMesh/Alarms.py new file mode 100644 index 000000000..9bfd71a66 --- /dev/null +++ b/src/Tools/MacMesh/MacMesh/Alarms.py @@ -0,0 +1,31 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 + +def Message (code) : + import sys + MessageString = { 1 : lambda x: "Successfully created \n", + 2 : lambda x: "Fatal: Incorrect input \n", + 3 : lambda x: "Fatal: Overlapping objects detected \n", + 4 : lambda x: "Fatal: Incompatible object type with neighbouring objects" }[code](str(code)) + print MessageString + #if code > 1 : sys.exit() + return 1 + diff --git a/src/Tools/MacMesh/MacMesh/CentralUnrefine.py b/src/Tools/MacMesh/MacMesh/CentralUnrefine.py new file mode 100644 index 000000000..2a7c9d59c --- /dev/null +++ b/src/Tools/MacMesh/MacMesh/CentralUnrefine.py @@ -0,0 +1,190 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 object allows unrefining from a central point (actually, a line) to the exterior +# X0 and Y0 are the center points of the origin point and not those of the center of the generated block + + + +import sys, math, commands +CWD = commands.getoutput('pwd') +sys.path.append(CWD) + +from MacObject import * +import Config, GenFunctions + +def CentralUnrefine (X0 , Y0 , DX , DY , Orientation, **args ) : + + DirPar = {'SN' : lambda : ['NW', 'NE', 'EW', 'NW', 'SN', 'SN', 'NE', 'WE'], + 'NS' : lambda : ['SE', 'SW', 'WE', 'SE', 'NS', 'NS', 'SW', 'EW'], + 'EW' : lambda : ['NW', 'SW', 'SN', 'NW', 'EW', 'EW', 'SW', 'NS'], + 'WE' : lambda : ['SE', 'NE', 'NS', 'SE', 'WE', 'WE', 'NE', 'SN'], }[Orientation]() + + CoefVer = {'SN' : lambda : 1., + 'NS' : lambda : -1., + 'EW' : lambda : 0., + 'WE' : lambda : 0., }[Orientation]() + + CoefHor = {'SN' : lambda : 0., + 'NS' : lambda : 0., + 'EW' : lambda : -1., + 'WE' : lambda : 1., }[Orientation]() + + + MacObject('CompBoxF',[(X0+CoefHor*DX/2,Y0+CoefVer*DY/2),(DX,DY)],['auto'],publish=0) + ToLook1 = {'SN' : lambda : 2, + 'NS' : lambda : 3, + 'EW' : lambda : 1, + 'WE' : lambda : 0, }[Orientation]() + + ToLook2 = {'SN' : lambda : 0, + 'NS' : lambda : 0, + 'EW' : lambda : 2, + 'WE' : lambda : 2, }[Orientation]() + + ToLook3 = {'SN' : lambda : [0,1,2,3], + 'NS' : lambda : [1,0,3,2], + 'EW' : lambda : [3,2,1,0], + 'WE' : lambda : [2,3,0,1], }[Orientation]() + + if args.__contains__('groups') : + GroupNames = args['groups'] + else : GroupNames = [None, None, None, None, None, None] + + ExistingSegments = Config.ListObj[-1].DirectionalMeshParams[ToLook1] + ObjIDs = Config.Connections[-1][ToLook1] + RemoveLastObj() + + ExtensionSegments = math.ceil(ExistingSegments/12.)*12. + Dmin = 1.E50 + Dmax = -1.E50 + for ObjID in ObjIDs : + Boundaries = Config.ListObj[ObjID].Boundaries() + if Boundaries[ToLook2] < Dmin : Dmin = Boundaries[ToLook2] + if Boundaries[ToLook2+1] > Dmax : Dmax = Boundaries[ToLook2+1] + dx = 0 + if ExtensionSegments > ExistingSegments : + dn = (ExtensionSegments-ExistingSegments)/2. + dx = dn*(Dmax-Dmin)/ExistingSegments + #MacObject('CompBoxF',[(X0-CoefHor*dx/2+CoefVer*(-X0+Dmin-dx/2),Y0-CoefVer*dx/2+CoefHor*(-Y0+Dmin-dx/2)),(dx,dx)],[(dn,dn)],publish=0) + #MacObject('CompBoxF',[(X0-CoefHor*dx/2+CoefVer*(-X0+Dmax+dx/2),Y0-CoefVer*dx/2+CoefHor*(-Y0+Dmax+dx/2)),(dx,dx)],[(dn,dn)],publish=0) + + BoxSide = (Dmax-Dmin+2*dx)/2. + + Obj = [] + Obj.append(MacObject('BoxAng32',[(X0+CoefHor*(BoxSide/2)+CoefVer*(-BoxSide/2),Y0+CoefVer*(BoxSide/2)+CoefHor*(-BoxSide/2)),(BoxSide,BoxSide)],[int(ExtensionSegments/6),DirPar[0]],groups=GroupArray(ToLook3[0],GroupNames[0]))) + Obj.append(MacObject('BoxAng32',[(X0+CoefHor*(BoxSide/2)+CoefVer*(BoxSide/2),Y0+CoefVer*(BoxSide/2)+CoefHor*(BoxSide/2)),(BoxSide,BoxSide)],[int(ExtensionSegments/6),DirPar[1]],groups=GroupArray(ToLook3[0],GroupNames[0]))) + + NLevOpt = 0 + for NLevels in range (1,100) : + DX1 = abs(CoefVer)*BoxSide*2.**(NLevels+1)+abs(CoefHor)*BoxSide*2.**(NLevels) + DY1 = abs(CoefHor)*BoxSide*2.**(NLevels+1)+abs(CoefVer)*BoxSide*2.**(NLevels) + if DX1 > DX or DY1 > DY : + NLevOpt = NLevels-1 + DXinner = DX1/2. + DYinner = DY1/2. + break + + dummyArray = [DXinner,DYinner,DYinner,DXinner] + D1inner = dummyArray[ToLook2] # = DXinner for SN and NS orientations + D2inner = dummyArray[ToLook2+1] # = DYinner for SN and NS orientations + + dummyArray = [DX,DY,DY,DX] + D1 = dummyArray[ToLook2] # = DX for SN and NS orientations + D2 = dummyArray[ToLook2+1] # = DY for SN and NS orientations + + if D1inner < D1 : + GN0a = GroupArray(ToLook3[0],GroupNames[1]) + GN0b = GroupArray(ToLook3[0],GroupNames[2]) + GN01 = GroupArray(ToLook3[0],GroupNames[1]) + GN02 = GroupArray(ToLook3[0],GroupNames[2]) + if D2inner < D2 : + GN10 = [None,None,None,None] + GN11 = [None,None,None,None] + GN20 = [None,None,None,None] + else : + GN10 = GroupArray(ToLook3[1],GroupNames[3]) + GN11 = GroupArray(ToLook3[1],GroupNames[3]) + GN20 = GroupArray(ToLook3[1],GroupNames[3]) + else : + GN0a = GroupArray(ToLook3[0],GroupNames[1]) + GN0b = GroupArray(ToLook3[0],GroupNames[2]) + GN01 = GroupArray([ToLook3[0],ToLook3[2]],[GroupNames[1],GroupNames[4]]) + GN02 = GroupArray([ToLook3[0],ToLook3[3]],[GroupNames[2],GroupNames[5]]) + if D2inner < D2 : + GN10 = GroupArray(ToLook3[2],GroupNames[4]) + GN11 = GroupArray(ToLook3[3],GroupNames[5]) + GN20 = [None,None,None,None] + else : + GN10 = GroupArray([ToLook3[1],ToLook3[2]],[GroupNames[3],GroupNames[4]]) + GN11 = GroupArray([ToLook3[1],ToLook3[3]],[GroupNames[3],GroupNames[5]]) + GN20 = GroupArray(ToLook3[1],GroupNames[3]) + + for N in range (1,NLevOpt+1): + n=N-1 + D = BoxSide*(2.**n) + if N < NLevOpt : + Obj.append(MacObject('Box42' ,[(X0+D*(CoefHor*1/2-CoefVer*3/2) , Y0+D*(CoefVer*1/2-CoefHor*3/2) ) , (D,D)],['auto',DirPar[2]], groups=GN0a)) + Obj.append(MacObject('BoxAng32',[(X0+D*(CoefHor*3/2-CoefVer*3/2) , Y0+D*(CoefVer*3/2-CoefHor*3/2) ) , (D,D)],['auto',DirPar[3]])) + Obj.append(MacObject('Box42' ,[(X0+D*(CoefHor*3/2-CoefVer*1/2) , Y0+D*(CoefVer*3/2-CoefHor*1/2) ) , (D,D)],['auto',DirPar[4]])) + Obj.append(MacObject('Box42' ,[(X0+D*(CoefHor*3/2+CoefVer*1/2) , Y0+D*(CoefHor*1/2+CoefVer*3/2) ) , (D,D)],['auto',DirPar[5]])) + Obj.append(MacObject('BoxAng32',[(X0+D*(CoefVer*3/2+CoefHor*3/2) , Y0+D*(CoefVer*3/2+CoefHor*3/2) ) , (D,D)],['auto',DirPar[6]])) + Obj.append(MacObject('Box42' ,[(X0+D*(CoefVer*3/2+CoefHor*1/2) , Y0+D*(CoefHor*3/2+CoefVer*1/2) ) , (D,D)],['auto',DirPar[7]], groups=GN0b)) + else : + Obj.append(MacObject('Box42' ,[(X0+D*(CoefHor*1/2-CoefVer*3/2) , Y0+D*(CoefVer*1/2-CoefHor*3/2) ) , (D,D)],['auto',DirPar[2]], groups=GN01)) + Obj.append(MacObject('BoxAng32',[(X0+D*(CoefHor*3/2-CoefVer*3/2) , Y0+D*(CoefVer*3/2-CoefHor*3/2) ) , (D,D)],['auto',DirPar[3]], groups=GN10)) + Obj.append(MacObject('Box42' ,[(X0+D*(CoefHor*3/2-CoefVer*1/2) , Y0+D*(CoefVer*3/2-CoefHor*1/2) ) , (D,D)],['auto',DirPar[4]], groups=GN20)) + Obj.append(MacObject('Box42' ,[(X0+D*(CoefHor*3/2+CoefVer*1/2) , Y0+D*(CoefHor*1/2+CoefVer*3/2) ) , (D,D)],['auto',DirPar[5]], groups=GN20)) + Obj.append(MacObject('BoxAng32',[(X0+D*(CoefVer*3/2+CoefHor*3/2) , Y0+D*(CoefVer*3/2+CoefHor*3/2) ) , (D,D)],['auto',DirPar[6]], groups=GN11)) + Obj.append(MacObject('Box42' ,[(X0+D*(CoefVer*3/2+CoefHor*1/2) , Y0+D*(CoefHor*3/2+CoefVer*1/2) ) , (D,D)],['auto',DirPar[7]], groups=GN02)) + + + if CoefVer and DX>DXinner : + Obj.append(MacObject('CompBoxF',[(X0-CoefVer*0.25*(DX+DXinner),Y0+CoefVer*DYinner/2),((DX-DXinner)/2,DYinner)],['auto'], groups = GroupArray([ToLook3[0],ToLook3[2]],[GroupNames[1],GroupNames[4]]))) + Obj.append(MacObject('CompBoxF',[(X0+CoefVer*0.25*(DX+DXinner),Y0+CoefVer*DYinner/2),((DX-DXinner)/2,DYinner)],['auto'], groups = GroupArray([ToLook3[0],ToLook3[3]],[GroupNames[2],GroupNames[5]]))) + if DY>DYinner : + Obj.append(MacObject('CompBoxF',[(X0-CoefVer*0.25*(DX+DXinner),Y0+CoefVer*(DY+DYinner)/2.),((DX-DXinner)/2,DY-DYinner)],['auto'], groups = GroupArray([ToLook3[1],ToLook3[2]],[GroupNames[3],GroupNames[4]]))) + Obj.append(MacObject('CompBoxF',[(X0+CoefVer*0.25*(DX+DXinner),Y0+CoefVer*(DY+DYinner)/2.),((DX-DXinner)/2,DY-DYinner)],['auto'], groups = GroupArray([ToLook3[1],ToLook3[3]],[GroupNames[3],GroupNames[5]]))) + Obj.append(MacObject('CompBoxF',[(X0,Y0+CoefVer*(DY+DYinner)/2.),(DXinner,DY-DYinner)],['auto'], groups = GroupArray(ToLook3[1],GroupNames[3]))) + elif CoefHor and DY>DYinner : + Obj.append(MacObject('CompBoxF',[(X0+CoefHor*DXinner/2,Y0-CoefHor*0.25*(DY+DYinner)),(DXinner,(DY-DYinner)/2)],['auto'], groups = GroupArray([ToLook3[0],ToLook3[2]],[GroupNames[1],GroupNames[4]]))) + Obj.append(MacObject('CompBoxF',[(X0+CoefHor*DXinner/2,Y0+CoefHor*0.25*(DY+DYinner)),(DXinner,(DY-DYinner)/2)],['auto'], groups = GroupArray([ToLook3[0],ToLook3[3]],[GroupNames[2],GroupNames[5]]))) + if DX>DXinner : + Obj.append(MacObject('CompBoxF',[(X0+CoefHor*(DX+DXinner)/2.,Y0-CoefHor*0.25*(DY+DYinner)),(DX-DXinner,(DY-DYinner)/2)],['auto'], groups = GroupArray([ToLook3[1],ToLook3[2]],[GroupNames[3],GroupNames[4]]))) + Obj.append(MacObject('CompBoxF',[(X0+CoefHor*(DX+DXinner)/2.,Y0+CoefHor*0.25*(DY+DYinner)),(DX-DXinner,(DY-DYinner)/2)],['auto'], groups = GroupArray([ToLook3[1],ToLook3[3]],[GroupNames[3],GroupNames[5]]))) + Obj.append(MacObject('CompBoxF',[(X0+CoefHor*(DX+DXinner)/2.,Y0),(DX-DXinner,DYinner)],['auto'], groups = GroupArray(ToLook3[1],GroupNames[3]))) + return Obj + +def RemoveLastObj() : + Config.ListObj = Config.ListObj[:-1] + Config.Connections = Config.Connections[:-1] + +def GroupArray(indices, GroupNames) : + if type(indices) is int : + indices = [indices] + GroupNames = [GroupNames] + Output = [None,None,None,None] + for i, ind in enumerate(indices) : + Output[ind] = GroupNames[i] + return Output diff --git a/src/Tools/MacMesh/MacMesh/CompositeBox.py b/src/Tools/MacMesh/MacMesh/CompositeBox.py new file mode 100644 index 000000000..773fc41b7 --- /dev/null +++ b/src/Tools/MacMesh/MacMesh/CompositeBox.py @@ -0,0 +1,188 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 + + + +# INTRODUCTION HERE + +import sys, math, copy, commands +CWD = commands.getoutput('pwd') +sys.path.append(CWD) + +from MacObject import * +import Config, GenFunctions + +def CompositeBox (X0 , Y0 , DX , DY , **args ) : + + if args.__contains__('groups') : + GroupNames = args['groups'] + else : GroupNames = [None, None, None, None] + # Create a full Box just to inherit, globally, the mesh parameters of bounding objects + MacObject('CompBoxF',[(X0,Y0),(DX,DY)],['auto'],publish=0) + + # Save the existing number of segments on each direction + ExistingSegments = Config.ListObj[-1].DirectionalMeshParams + + # Sort the connection list for the full Box + ObjIDLists = SortObjLists(Config.Connections[-1],X0 , Y0 , DX , DY ) + RemoveLastObj() + + print "ObjIDLists: ", ObjIDLists + + RealSegments = [] + Direction = [] + flag = 0 + if not(args.__contains__('recursive')) : Config.Count = 0 + print "Config.Count : ", Config.Count + Config.Criterion = GetCriterion(ObjIDLists) + for index, ObjList in enumerate(ObjIDLists) : + if not (ObjList[0] == -1 or Config.Count >= Config.Criterion): + if len(ObjList)>1 : flag = 1 + else : flag = 0 + for ObjID in ObjList: + ToLook0 = [2,2,0,0][index] + ToLook1 = [3,2,1,0][index] + CommonSide = FindCommonSide(Config.ListObj[ObjID].DirBoundaries(ToLook1),[X0-DX/2.,X0+DX/2.,Y0-DY/2.,Y0+DY/2.][ToLook0:ToLook0+2]) + ToLook2 = [1,0,3,2][index] + RealSegments.append(Config.ListObj[ObjID].DirectionalMeshParams[ToLook2]*IntLen(CommonSide)/IntLen(Config.ListObj[ObjID].DirBoundaries(ToLook1))) + Direction.append(ToLook0/2) + + if flag and Config.Count < Config.Criterion: + if index < 2 : + if abs(CommonSide[0] - (Y0-DY/2.))<1e-7 : SouthGR = GroupNames[0] + else : SouthGR = None + if abs(CommonSide[1] - (Y0+DY/2.))<1e-7 : NorthGR = GroupNames[1] + else : NorthGR = None + CompositeBox (X0, CommonSide[0]+IntLen(CommonSide)/2., DX,IntLen(CommonSide), recursive=1, groups = [SouthGR,NorthGR]+GroupNames[2:4]) + else : + if abs(CommonSide[0] - (X0-DX/2.))<1e-7 : EastGR = GroupNames[2] + else : EastGR = None + if abs(CommonSide[1] - (X0+DX/2.))<1e-7 : WestGR = GroupNames[3] + else : WestGR = None + CompositeBox (CommonSide[0]+IntLen(CommonSide)/2., Y0, IntLen(CommonSide),DY, recursive=1, groups = GroupNames[0:2]+[EastGR,WestGR]) + + if Config.Count >= Config.Criterion : + break + if flag == 0 and Config.Count < Config.Criterion: + #print "Dir : ", Direction + #print "RealSegments : ", RealSegments + + #Xind = Direction.index(0) + #Yind = Direction.index(1) + #MacObject('CompBoxF',[(X0,Y0),(DX,DY)] ,[(RealSegments[Xind],RealSegments[Yind])], groups = GroupNames) + MacObject('CompBoxF',[(X0,Y0),(DX,DY)] ,['auto'], groups = GroupNames) + + Config.Count += 1 + + +def FindCommonSide (Int1, Int2) : + if abs(min(Int1[1],Int2[1])-max(Int1[0],Int2[0])) < 1e-5: return [0,0] + else : return [max(Int1[0],Int2[0]), min(Int1[1],Int2[1])] + +def IntLen (Interval) : + return abs(Interval[1]-Interval[0]) + +def RemoveLastObj() : + Config.ListObj = Config.ListObj[:-1] + Config.Connections = Config.Connections[:-1] + +def GetCriterion (ObjListIDs): + return max(Config.Criterion, max(len(ObjListIDs[0]),len(ObjListIDs[1]))*max(len(ObjListIDs[2]),len(ObjListIDs[3]))) + +def SortObjLists (List,X0,Y0,DX,DY) : + """ + This function sorts the list of neighbouring objects on each side, according to their intersection + with the object being created. From South to North and from East to West + """ + Output = List + # First find the directions where no neighbour exists + # Important : Here we assume that exactly two directions have no neighbours !!! + # Should we change this to allow a more general case ???? + dummy = IndexMultiOcc(List,(-1,)) + + # dummy[0] is either 0, meaning there is no neighbour on X- (West) + # or 1, meaning there is no neighbour on X+ (East) + # Similarly dummy[1] can be either 2 or 3 (South and North respectively) + # In order to get back to the formalism of groups (SNWE) + # => we do the following to define Sense of no neighbours and then the Direction list + # is calculated as to include uniquely the directions where we DO have neighbours + if len(dummy) == 1 : + # This adds a second direction where neighbours are not regarded, it is either 0 or 2 + dummy.append(2*(dummy[0]+2<4)) + print("Careful, you have neighbours on 3 or more sides of the box, we will not check if on two parallel sides the boxes are compatible !!!") + if len(dummy) == 2 or len(dummy) == 1 : + # Sense contains : Vertical then Horizontal + Sense = [dummy[1]%2,dummy[0]] + DirList = [[1,0][dummy[0]],[3,2][dummy[1]%2]] + for index,Direction in enumerate(DirList) : + ObjList = List[Direction] + RankMin = [] + ToLook0 = [2,2,0,0][Direction] + ToLook1 = [3,2,1,0][Direction] + for index1,ObjID in enumerate(ObjList) : + RankMin.append([-1.,1.][Sense[index]] * FindCommonSide(Config.ListObj[ObjID].DirBoundaries(ToLook1),[X0-DX/2.,X0+DX/2.,Y0-DY/2.,Y0+DY/2.][ToLook0:ToLook0+2])[Sense[index]]) + Output[Direction] = SortList(ObjList,RankMin) + + elif len(dummy) == 3 : + # We find the direction where we do have neighbours and then we sort the object list along it + Sense = dummy[0]%2 + Direction = [ i not in dummy for i in range(4) ].index(True) + ObjList = List[Direction] + RankMin = [] + ToLook0 = [2,2,0,0][Direction] + ToLook1 = [3,2,1,0][Direction] + for index1,ObjID in enumerate(ObjList) : + RankMin.append([-1.,1.][Sense] * FindCommonSide(Config.ListObj[ObjID].DirBoundaries(ToLook1),[X0-DX/2.,X0+DX/2.,Y0-DY/2.,Y0+DY/2.][ToLook0:ToLook0+2])[Sense]) + Output[Direction] = SortList(ObjList,RankMin) + else : + print ("Error : the composite box being created has no neighbours, how on earth do you want us to inherit its mesh parameters!!!") + + + return Output + +def IndexMultiOcc (Array,Element) : + """ + This functions returns the occurrences indices of Element in Array. + As opposed to Array.index(Element) method, this allows determining + multiple entries rather than just the first one! + """ + Output = [] + try : Array.index(Element) + except ValueError : print "No more occurrences" + else : Output.append(Array.index(Element)) + + if not(Output == []) and len(Array) > 1 : + for index, ArrElem in enumerate(Array[Output[0]+1:]) : + if ArrElem == Element : Output.append(index+Output[0]+1) + + return Output + +def SortList (ValList, CritList): + Output = [] + SortedCritList = copy.copy(CritList) + SortedCritList.sort() + for i in range(0,len(ValList)): + index = CritList.index(SortedCritList[i]) + Output.append(ValList[index]) + return Output + + + diff --git a/src/Tools/MacMesh/MacMesh/CompositeBoxF.py b/src/Tools/MacMesh/MacMesh/CompositeBoxF.py new file mode 100644 index 000000000..88cdc83b0 --- /dev/null +++ b/src/Tools/MacMesh/MacMesh/CompositeBoxF.py @@ -0,0 +1,254 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 + + + + +# INTRODUCTION HERE + +import sys, math, copy, commands +CWD = commands.getoutput('pwd') +sys.path.append(CWD) + +from MacObject import * +import Config, GenFunctions + +def CompositeBoxF (Pt1 , Pt2 , Pt3 , Pt4 , **args ) : + [Pt1 , Pt2 , Pt3 , Pt4] = GenFunctions.SortPoints([Pt1 , Pt2 , Pt3 , Pt4]) + if args.__contains__('groups') : + GroupNames = args['groups'] + else : GroupNames = [None, None, None, None] + # Create a full NonOrtho box just to inherit, globally, the mesh parameters of bounding objects + dummy = MacObject('NonOrtho',[Pt1,Pt2,Pt3,Pt4],['auto'],publish=0) + # Save the existing number of segments on each direction + ExistingSeg0 = Config.ListObj[-1].DirectionalMeshParams + Convention = [2,3,0,1] + ExistingSegments = [ExistingSeg0[Convention[i]] for i in range(4)] + # Save Boundary lengths on each direction + BoundaryLengths = [IntLen(dummy.DirBoundaries(i)) for i in range(4) ] + # Calculate global mesh element size on each direction + GlobalDelta = [1.*BoundaryLengths[i]/ExistingSegments[i] for i in range(4) ] + print "GlobalDelta :",GlobalDelta + # Sort the connection list for the full Box + [(X0,Y0),(DX,DY)] = dummy.GeoPar + ObjIDLists = SortObjLists(Config.Connections[-1],X0 , Y0 , DX , DY ) + [Xmin,Xmax,Ymin,Ymax] = dummy.Boundaries() # Used for groups determination + RemoveLastObj() + + RealSegments = [] + Direction = [] + flag = 0 + if not(args.__contains__('recursive')) : + Config.Count = 0 + + Config.Criterion = GetCriterion(ObjIDLists) + for index, ObjList in enumerate(ObjIDLists) : + if not (ObjList[0] == -1 or Config.Count >= Config.Criterion): + if not(args.__contains__('recursive')) : + Config.DirIndex = index + if index > 1 : Config.RefPts = [Pt2, Pt3] + elif index == 0 : Config.RefPts = [Pt1, Pt2] + else : Config.RefPts = [Pt4, Pt3] + + if len(ObjList)>1 : flag = 1 + else : flag = 0 + for ObjID in ObjList: + ToLook0 = [2,3,0,1][index] + ToLook1 = [3,2,1,0][index] + CommonSide = FindCommonSide(Config.ListObj[ObjID].DirBoundaries(ToLook1),dummy.DirBoundaries(ToLook0)) + ToLook2 = [1,0,3,2][index] + RealSegments = Config.ListObj[ObjID].DirectionalMeshParams[ToLook2]*IntLen(CommonSide)/IntLen(Config.ListObj[ObjID].DirBoundaries(ToLook1)) + LocalDelta = 1.*IntLen(CommonSide)/RealSegments + print "Direction:", ["West","East","South","North"][ToLook2] + print "IntLen(CommonSide):",IntLen(CommonSide) + print "RealSegments:",RealSegments + print "LocalDelta:",LocalDelta + if flag and Config.Count < Config.Criterion: + if index ==0 : + if abs(CommonSide[0] - Ymin)<1e-7 : SouthGR = GroupNames[0] + else : SouthGR = None + if abs(CommonSide[1] - Ymax)<1e-7 : NorthGR = GroupNames[1] + else : NorthGR = None + + NDelta = Config.ListObj[ObjID].DirectionalMeshParams[ToLook2]* (LocalDelta-GlobalDelta[Convention[index]]) + [Pt1,Pt2] = Config.RefPts + Coef = [1.,-1.][index] + Vref1 = [Coef*(Pt2[0]-Pt1[0]),Coef*(Pt2[1]-Pt1[1])] + Vref2 = NormalizeVector([Pt2[0]-Pt3[0],Pt2[1]-Pt3[1]]) + Ptref = Config.ListObj[ObjID].PtCoor[[2,3][index]] + NewPt = ExtrapPoint (Ptref,Vref1,Vref2,NDelta) + CompositeBoxF (Pt1, Pt2, NewPt, Ptref, recursive=1, groups = [SouthGR,NorthGR]+GroupNames[2:4]) + elif index == 1: + if abs(CommonSide[0] - Ymin)<1e-7 : SouthGR = GroupNames[0] + else : SouthGR = None + if abs(CommonSide[1] - Ymax)<1e-7 : NorthGR = GroupNames[1] + else : NorthGR = None + + NDelta = Config.ListObj[ObjID].DirectionalMeshParams[ToLook2]* (LocalDelta-GlobalDelta[Convention[index]]) + [Pt4,Pt3] = Config.RefPts + Coef = 1. + Vref1 = [Coef*(Pt4[0]-Pt3[0]),Coef*(Pt4[1]-Pt3[1])] + Vref2 = NormalizeVector([Pt1[0]-Pt4[0],Pt1[1]-Pt4[1]]) + Ptref = Config.ListObj[ObjID].PtCoor[0] + NewPt = ExtrapPoint (Ptref,Vref1,Vref2,NDelta) + CompositeBoxF (NewPt, Ptref, Pt3, Pt4, recursive=1, groups = [SouthGR,NorthGR]+GroupNames[2:4]) + else : + if abs(CommonSide[0] - Xmin)<1e-7 : WestGR = GroupNames[2] + else : WestGR = None + if abs(CommonSide[1] - Xmax)<1e-7 : EastGR = GroupNames[3] + else : EastGR = None + + NDelta = Config.ListObj[ObjID].DirectionalMeshParams[ToLook2]* (LocalDelta-GlobalDelta[Convention[index]]) + [Pt2,Pt3] = Config.RefPts + Coef = [1.,-1.][index-2] + Vref1 = [Coef*(Pt3[0]-Pt2[0]),Coef*(Pt3[1]-Pt2[1])] + Vref2 = NormalizeVector([Pt3[0]-Pt4[0],Pt3[1]-Pt4[1]]) + Ptref = Config.ListObj[ObjID].PtCoor[[3,0][index-2]] + NewPt = ExtrapPoint (Ptref,Vref1,Vref2,NDelta) + CompositeBoxF (Ptref, Pt2, Pt3, NewPt, recursive=1, groups = GroupNames[0:2] + [WestGR,EastGR]) + + if Config.Count >= Config.Criterion : + break + if flag == 0 and Config.Count < Config.Criterion: + print "Creating NonOrtho object with the points:", Pt1,Pt2,Pt3,Pt4 + MacObject('NonOrtho',[Pt1,Pt2,Pt3,Pt4] ,['auto'], groups = GroupNames) + + Config.Count += 1 + if Config.DirIndex > 1 : Config.RefPts = [Pt1, Pt4] + elif Config.DirIndex==0 : Config.RefPts = [Pt4, Pt3] + else : Config.RefPts = [Pt1, Pt2] + +def FindCommonSide (Int1, Int2) : + if max(Int1[0],Int2[0]) we do the following to define Sense of no neighbours and then the Direction list + # is calculated as to include uniquely the directions where we DO have neighbours + if len(dummy) == 1 : + # This adds a second direction where neighbours are not regarded, it is either 0 or 2 + dummy.append(2*(dummy[0]+2<4)) + print("Careful, you have neighbours on 3 or more sides of the box, we will not check if on two parallel sides the boxes are compatible !!!") + if len(dummy) == 2 or len(dummy) == 1 : + # Sense contains : Vertical then Horizontal + Sense = [dummy[1]%2,dummy[0]] + DirList = [[1,0][dummy[0]],[3,2][dummy[1]%2]] + for index,Direction in enumerate(DirList) : + ObjList = List[Direction] + RankMin = [] + ToLook0 = [2,2,0,0][Direction] + ToLook1 = [3,2,1,0][Direction] + for index1,ObjID in enumerate(ObjList) : + RankMin.append([-1.,1.][Sense[index]] * FindCommonSide(Config.ListObj[ObjID].DirBoundaries(ToLook1),[X0-DX/2.,X0+DX/2.,Y0-DY/2.,Y0+DY/2.][ToLook0:ToLook0+2])[Sense[index]]) + Output[Direction] = SortList(ObjList,RankMin) + + elif len(dummy) == 3 : + # We find the direction where we do have neighbours and then we sort the object list along it + Sense = dummy[0]%2 + Direction = [ i not in dummy for i in range(4) ].index(True) + ObjList = List[Direction] + RankMin = [] + ToLook0 = [2,2,0,0][Direction] + ToLook1 = [3,2,1,0][Direction] + for index1,ObjID in enumerate(ObjList) : + RankMin.append([-1.,1.][Sense] * FindCommonSide(Config.ListObj[ObjID].DirBoundaries(ToLook1),[X0-DX/2.,X0+DX/2.,Y0-DY/2.,Y0+DY/2.][ToLook0:ToLook0+2])[Sense]) + Output[Direction] = SortList(ObjList,RankMin) + else : + print ("Error : the composite box being created has no neighbours, how on earth do you want us to inherit its mesh parameters!!!") + + + return Output + +def IndexMultiOcc (Array,Element) : + """ + This functions returns the occurrences indices of Element in Array. + As opposed to Array.index(Element) method, this allows determining + multiple entries rather than just the first one! + """ + Output = [] + try : Array.index(Element) + except ValueError : print "No more occurrences" + else : Output.append(Array.index(Element)) + + if not(Output == []) and len(Array) > 1 : + for index, ArrElem in enumerate(Array[Output[0]+1:]) : + if ArrElem == Element : Output.append(index+Output[0]+1) + + return Output + +def SortList (ValList, CritList): + Output = [] + SortedCritList = copy.copy(CritList) + SortedCritList.sort() + for i in range(0,len(ValList)): + index = CritList.index(SortedCritList[i]) + Output.append(ValList[index]) + return Output + +def ExtrapPoint (Ptref,Vref1,Vref2,Delta): + """ + This function allows determining the absolute coordinates of an extrapolation point + as shown in the following : + + + ExtrapPoint x---Vref2->--------o + / delta_glob |Vref1 + / | + Ptref x---------------------+ + delta_loc * Nseg + + Delta = (delta_loc - delta_glob) * Nseg + """ + + X = Ptref[0] + Vref1[0] + Delta*Vref2[0] + Y = Ptref[1] + Vref1[1] + Delta*Vref2[1] + return (X,Y,) + diff --git a/src/Tools/MacMesh/MacMesh/Config.py b/src/Tools/MacMesh/MacMesh/Config.py new file mode 100644 index 000000000..a0816f497 --- /dev/null +++ b/src/Tools/MacMesh/MacMesh/Config.py @@ -0,0 +1,60 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 + + + +dz = 1 +debug = 1 + +try : ListObj +except NameError : ListObj = [] + +try: Connections +except NameError: Connections = [] + +try : publish +except NameError : publish = 1 + +try : Groups +except NameError : Groups = [] + +try : StudyName +except NameError : StudyName = "Compound" + +try : Criterion +except NameError : Criterion = 1 + +try : Count +except NameError : Count = 0 + +try : RefPts +except NameError : RefPts = [] + +try : DirIndex +except NameError : DirIndex = 0 + +try : theStudy +except NameError : + import salome + salome.salome_init() + theStudy = salome.myStudy + + diff --git a/src/Tools/MacMesh/MacMesh/CutnGroup.py b/src/Tools/MacMesh/MacMesh/CutnGroup.py new file mode 100644 index 000000000..3a4cd4f49 --- /dev/null +++ b/src/Tools/MacMesh/MacMesh/CutnGroup.py @@ -0,0 +1,229 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 module allows cutting and grouping geometries by defining plane sections, with level of cutting as well as customizable Prefixes. + +import math, Config + +from salome.geom import geomBuilder +geompy = geomBuilder.New( Config.theStudy ) + +def Go(GeoObj, CutPlnLst, OutLvlLst, PrefixLst, Publish): + + """ + This function cuts any geometry (with infinite trim !) into several subgeometries that are cleanly saved inside the navigation tree. (Check GoTrim for the same functionality with custom trim size) + - GeoObj is the geometrical object to be cut and grouped + - CutPlnLst is a list of plane definitions. Each plane is a 6-tuple (contains 6 values). The first three represent the coordinates of the origin point and the second three represent the coordinates of the normal vector to the plane + Example 1: [(0,0,0,1,0,0)]: cut along a plane passing through the origin and normal to the x-axis + Example 2: [(0,0,0,1,0,0),(50,0,0,0,1,0)]: in addition to the first plane cut, cut through a plane passing by (50,0,0) and normal to the y axis. + Note that the plane size us determined automatically from the size of the geometry in question (using a very big trim size = 100 x length of geometry!) + - OutLvlLst is a list containing integers that represent the inner sectioning level with respect to the original geometry type + A value of 1 means that the section will provide elements of one level lower than the original type. For exemple a solid sectioned at level 1 will produce faces. A Face sectioned at level 1 will produce edges. + A value of 2 means that a deeper sectioning will be applied. A solid sectioned with level 2 will give faces and edges. A face will give edges and vertices. An edge will give only vertices + The number of elements in this list should be (this is verified in the code) equal to the number of elements in the plane cut list. This is logical. + Example 1: [1] + Example 2: [1, 2], This means that the cut over the second plane will produce two types of elements unlike the first cut which will only output the first level objects. + - PrefixLst is a list of strings that contains the naming Prefixes that are used by the script to generate the subshape names. This is very useful for relating the results to the sectioning requested. + Example 1: ['Entry'] + Example 2: ['Entry','Exit'] The resulting groups from the sectioning with plane no.1 will then be saved as "Entry_FACE" and/or "Entry_EDGE" according to the original geometry object type and the cutting level + + Imagine that we have a solid called ExampleSolid, an example command will be: + CutnGroup.Go(ExampleSolid,[(0,0,0,1,0,0),(50,0,0,0,1,0)],[1, 2],['Entry','Exit']) + """ + + NumCuts = CheckInput(CutPlnLst, OutLvlLst, PrefixLst, 1) + OrigType = FindStandType(GeoObj,0) + InvDictionary = dict((v,k) for k, v in geompy.ShapeType.iteritems()) # Give geometry type name as a function of standard type numbering, ex: 4=FACE, 6=EDGE, 7=VERTEX + TrimSize = geompy.BasicProperties(GeoObj)[0]*100 + CutPlane = [] ; Sections = [] ; Parts = [] + + if NumCuts: + for i in range(0, NumCuts): # Loop over the cutting planes to create them one by one + CutPlane.append(CreatePlane(CutPlnLst[i],TrimSize)) + OutFather = geompy.MakePartition([GeoObj],CutPlane, [], [],FindStandType(GeoObj,1), 0, [], 0) #Creating the partition object + if Publish: geompy.addToStudy(OutFather,'SectionedObject') + for i in range(0, NumCuts): + for j in range(OrigType+1+2, OrigType+1+2*(OutLvlLst[i]+1),2): + if j == 8 : j = 7; # Exception for the vertex case (=7) + PossSubShapesID = geompy.SubShapeAllIDs(OutFather,j) # List of subshape IDs than correspond to the required cutting level (section type : face/wire/vertex) + PossSubShapes = geompy.ExtractShapes(OutFather,j) # and the corresponding objects + Accepted = [] + for k in range(0,len(PossSubShapesID)): # Loop over all the subshapes checking if they belong to the cutting plane! if yes add them to current list + if IsOnPlane(PossSubShapes[k], CutPlnLst[i], 1e-7): + Accepted.append(PossSubShapesID[k]) + if Accepted : # If some element is found, save it as a group with the prescribed Prefix + dummyObj = geompy.CreateGroup(OutFather, j) + geompy.UnionIDs(dummyObj, Accepted) + Sections.append(dummyObj) + if Publish:geompy.addToStudyInFather(OutFather, dummyObj, PrefixLst[i]+"_"+InvDictionary[j][0:2]) + else : + print "Warning: For the section no.", i, ", No intersection of type " + InvDictionary[j] + " was found. Hence, no corresponding groups were created" + + SubShapesID = geompy.SubShapeAllIDs(OutFather,OrigType+1) # Saving also the groups corresponding to the sectioned item of the same type: ex. A solid into n sub-solids due to the sections + for i in range(0,len(SubShapesID)): + dummyObj = geompy.CreateGroup(OutFather, OrigType+1) + geompy.UnionIDs(dummyObj, [SubShapesID[i]]) + Parts.append(dummyObj) + if Publish: geompy.addToStudyInFather(OutFather, dummyObj, "SB"+"_"+InvDictionary[OrigType+1][0:3]+"_"+str(i+1)) + + return OutFather, Sections, Parts + else: + print("Fatal error, the routine cannot continue any further, check your input variables") + return -1 + +def GoTrim(GeoObj, CutPlnLst, OutLvlLst, PrefixLst, Publish): + + """ + This function cuts any geometry into several subgeometries that are cleanly saved inside the navigation tree with a fully customizable trim size. + - GeoObj is the geometrical object to be cut and grouped + - CutPlnLst is a list of plane definitions. Each plane is a 7-tuple (contains 7 values). The first three represent the coordinates of the origin point and the second three represent the coordinates of the normal vector to the plane, the last value corresponds to the trim size of the planes + Example 1: [(0,0,0,1,0,0,5)]: cut along a plane passing through the origin and normal to the x-axis with a trim size of 5 + Example 2: [(0,0,0,1,0,0,5),(50,0,0,0,1,0,10)]: in addition to the first plane cut, cut through a plane passing by (50,0,0) and normal to the y axis with a trim size of 10 + - OutLvlLst is a list containing integers that represent the inner sectioning level with respect to the original geometry type + A value of 1 means that the section will provide elements of one level lower than the original type. For exemple a solid sectioned at level 1 will produce faces. A Face sectioned at level 1 will produce edges. + A value of 2 means that a deeper sectioning will be applied. A solid sectioned with level 2 will give faces and edges. A face will give edges and vertices. An edge will give only vertices + The number of elements in this list should be (this is verified in the code) equal to the number of elements in the plane cut list. This is logical. + Example 1: [1] + Example 2: [1, 2], This means that the cut over the second plane will produce two types of elements unlike the first cut which will only output the first level objects. + - PrefixLst is a list of strings that contains the naming Prefixes that are used by the script to generate the subshape names. This is very useful for relating the results to the sectioning requested. + Example 1: ['Entry'] + Example 2: ['Entry','Exit'] The resulting groups from the sectioning with plane no.1 will then be saved as "Entry_FACE" and/or "Entry_EDGE" according to the original geometry object type and the cutting level + + Imagine that we have a solid called ExampleSolid, an example command will be: + CutnGroup.Go(ExampleSolid,[(0,0,0,1,0,0,5),(50,0,0,0,1,0,10)],[1, 2],['Entry','Exit']) + """ + + NumCuts = CheckInput(CutPlnLst, OutLvlLst, PrefixLst, 0) + OrigType = FindStandType(GeoObj,0) + InvDictionary = dict((v,k) for k, v in geompy.ShapeType.iteritems()) # Give geometry type name as a function of standard type numbering, ex: 4=FACE, 6=EDGE, 7=VERTEX + CutPlane = [] ; Sections = [] ; Parts = [] + if NumCuts: + for i in range(0, NumCuts): # Loop over the cutting planes to create them one by one + CutPlane.append(CreatePlane(CutPlnLst[i][0:6],CutPlnLst[i][6])) + OutFather = geompy.MakePartition([GeoObj],CutPlane, [], [],FindStandType(GeoObj,1), 0, [], 0) #Creating the partition object + if Publish: geompy.addToStudy(OutFather,'SectionedObject') + for i in range(0, NumCuts): + for j in range(OrigType+1+2, OrigType+1+2*(OutLvlLst[i]+1),2): + if j == 8 : j = 7; # Exception for the vertex case (=7) + PossSubShapesID = geompy.SubShapeAllIDs(OutFather,j) # List of subshape IDs than correspond to the required cutting level (section type : face/wire/vertex) + PossSubShapes = geompy.ExtractShapes(OutFather,j) # and the corresponding objects + Accepted = [] + for k in range(0,len(PossSubShapesID)): # Loop over all the subshapes checking if they belong to the cutting plane WITH THE TRIM SIZE CONDITION! if yes add them to current list + if IsOnPlane(PossSubShapes[k], CutPlnLst[i], 1e-7) and Distance2Pt(geompy.PointCoordinates(geompy.MakeCDG(PossSubShapes[k])),CutPlnLst[i][0:3])<=CutPlnLst[i][-1]: + Accepted.append(PossSubShapesID[k]) + if Accepted : # If some element is found, save it as a group with the prescribed Prefix + dummyObj = geompy.CreateGroup(OutFather, j) + geompy.UnionIDs(dummyObj, Accepted) + Sections.append(dummyObj) + if Publish: geompy.addToStudyInFather(OutFather, dummyObj, PrefixLst[i]+"_"+InvDictionary[j][0:2]) + else : + print "Warning: For the section no.", i, ", No intersection of type " + InvDictionary[j] + " was found. Hence, no corresponding groups were created" + + SubShapesID = geompy.SubShapeAllIDs(OutFather,OrigType+1) # Saving also the groups corresponding to the sectioned item of the same type: ex. A solid into n sub-solids due to the sections + for i in range(0,len(SubShapesID)): + dummyObj = geompy.CreateGroup(OutFather, OrigType+1) + geompy.UnionIDs(dummyObj, [SubShapesID[i]]) + Parts.append(dummyObj) + if Publish: geompy.addToStudyInFather(OutFather, dummyObj, "SB"+"_"+InvDictionary[OrigType+1][0:3]+"_"+str(i+1)) + + return OutFather, Sections, Parts + else: + print("Fatal error, the routine cannot continue any further, check your input variables") + return -1 +def FindStandType(GeoObj, method): + """ + Find the standard index for the Geometrical object/compound type input, see dictionary in geompy.ShapeType + """ + TopType = GeoObj.GetMaxShapeType().__str__() + UnModType = geompy.ShapeType[TopType] + if method == 0 : + StandType = UnModType-int(not(UnModType%2)) # So that wires and edges and considered the same, faces and shells, and so on + else : + StandType = UnModType + + return(StandType) + +def CreatePlane(CutPlnVar,Trim): + """ + Creates a temporary point and vector in salome in order to build the sectioning planes needed + """ + Temp_Vtx = geompy.MakeVertex(CutPlnVar[0], CutPlnVar[1], CutPlnVar[2]) + Temp_Vec = geompy.MakeVectorDXDYDZ(CutPlnVar[3], CutPlnVar[4], CutPlnVar[5]) + CutPlane = geompy.MakePlane(Temp_Vtx, Temp_Vec, Trim) + return(CutPlane) + +def CheckInput(CutPlnLst, OutLvlLst, PrefixLst, AutoTrim): + """ + Checks the user input specifically if all needed parameters are provided + """ + if not ((len(CutPlnLst) == len(OutLvlLst)) and (len(CutPlnLst) == len(PrefixLst))): + print("Missing information about one or more of the cut planes") + return 0 + elif not ((len(CutPlnLst[0]) == 6+int(not AutoTrim))): + print("For each cutting plane you need to specify 6 parameters = 2 x 3 coordinates") + return 0 + else: + return len(CutPlnLst) + +def IsOnPlane(GeoSubObj, CutPlnVar, tolerance): + """ + Checks whether a geometry (vertex, segment, or face) belongs *completely* to the plane defined as a point and a normal vector + """ + # lambda function that represents the plane equation, function = 0 <=> Pt defined with Coor belongs to plane + PlaneEq = lambda Coor: CutPlnVar[3]*(Coor[0]-CutPlnVar[0])+CutPlnVar[4]*(Coor[1]-CutPlnVar[1])+CutPlnVar[5]*(Coor[2]-CutPlnVar[2]) + OrigType = FindStandType(GeoSubObj,0) + if (OrigType >= 7): # Vertex + NonTrimDecision = abs(PlaneEq(geompy.PointCoordinates(GeoSubObj))) < tolerance + if len(CutPlnVar) == 6 : return NonTrimDecision # No trim condition used + else : return (NonTrimDecision and Distance2Pt(CutPlnVar[0:3],geompy.PointCoordinates(GeoSubObj))<=CutPlnVar[6]/2) + elif (OrigType >= 5): # Line, decompose into two points then call recursively IsOnPlane function! + Verdict = True + for i in range(0,2): + Verdict = Verdict and IsOnPlane(geompy.GetVertexByIndex(GeoSubObj,i), CutPlnVar, tolerance) + return Verdict + elif (OrigType >= 3): # Face, decompose into three points then call recursively IsOnPlane function! + if IsOnPlane(geompy.MakeCDG(GeoSubObj),CutPlnVar, tolerance) : # Center of gravity belongs to plane, check if normal is parallel to plane + NormalP1Coor = geompy.PointCoordinates(geompy.GetVertexByIndex(geompy.GetNormal(GeoSubObj),0)) + NormalP2Coor = geompy.PointCoordinates(geompy.GetVertexByIndex(geompy.GetNormal(GeoSubObj),1)) + Normal = [NormalP1Coor[0]-NormalP2Coor[0], NormalP1Coor[1]-NormalP2Coor[1], NormalP1Coor[2]-NormalP2Coor[2]] + CrossP = CrossProd(CutPlnVar[3:6],Normal) # Checks whether normals (of section plane and of face) are parallel or not + if (abs(CrossP[0]) parallel + return True + else : + return False + else : + return False + + +def CrossProd(V1,V2): + """ + Determines the cross product of two 3D vectors + """ + return ([V1[1]*V2[2]-V1[2]*V2[1], V1[2]*V2[0]-V1[0]*V2[2], V1[0]*V2[1]-V1[1]*V2[0]]) + +def Distance2Pt(P1,P2): + """ + Returns the distance between two points + """ + return (math.sqrt((P1[0]-P2[0])**2+(P1[1]-P2[1])**2+(P1[2]-P2[2])**2)) diff --git a/src/Tools/MacMesh/MacMesh/Cylinder.py b/src/Tools/MacMesh/MacMesh/Cylinder.py new file mode 100644 index 000000000..e2e2c4219 --- /dev/null +++ b/src/Tools/MacMesh/MacMesh/Cylinder.py @@ -0,0 +1,119 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 is an automation of the cylinder-box object, defined with the coordinates of its center, its radius, and the box's +# boundary size. +# The pitch ratio is calculated automatically from the minimum of the box dimensions on x and y. +# This functions can take a groups input containing the group names of 4 sides in addition to the internal circular boundary +# in the following order : [South,North,West,East,Internal]. + +import sys, math, commands +CWD = commands.getoutput('pwd') +sys.path.append(CWD) + + +from MacObject import * +import Config, GenFunctions + +def Cylinder (X0 , Y0 , D , DX , DY , LocalMeshing , **args) : + if args.__contains__('DLocal') : DLocal = float(args['DLocal']) + else : DLocal = float(min(DX,DY)) + + # K is the pitch ratio + K = float(D)/(DLocal-D) + print "A local pitch ratio of K =", K ," will be used. " + NumCuts = 2*GenFunctions.QuarCylParam(K) + InternalMeshing = int(math.ceil(math.pi*D/(4*NumCuts*LocalMeshing))) + if InternalMeshing == 0 : InternalMeshing = 1 # This sets a minimum meshing condition in order to avoid an error. The user is notified of the value considered for the local meshing + print "Possible Local meshing is :", math.pi*D/(4*NumCuts*InternalMeshing), "\nThis value is returned by this function for your convenience.\n" + if args.__contains__('groups') : + GroupNames = args['groups'] + else : GroupNames = [None, None, None, None, None] + + if DY == DLocal : + if DX == DLocal: + GN1 = [None,GroupNames[1],None,GroupNames[3],GroupNames[4]] + GN2 = [None,GroupNames[1],GroupNames[2],None,GroupNames[4]] + GN3 = [GroupNames[0],None,GroupNames[2],None,GroupNames[4]] + GN4 = [GroupNames[0],None,None,GroupNames[3],GroupNames[4]] + else : + GN1 = [None,GroupNames[1],None,None,GroupNames[4]] + GN2 = [None,GroupNames[1],None,None,GroupNames[4]] + GN3 = [GroupNames[0],None,None,None,GroupNames[4]] + GN4 = [GroupNames[0],None,None,None,GroupNames[4]] + + GN5 = [GroupNames[0],GroupNames[1],None,GroupNames[3]] + GN6 = [GroupNames[0],GroupNames[1],GroupNames[2],None] + else : + if DX == DLocal: + GN1 = [None,None,None,GroupNames[3],GroupNames[4]] + GN2 = [None,None,GroupNames[2],None,GroupNames[4]] + GN3 = [None,None,GroupNames[2],None,GroupNames[4]] + GN4 = [None,None,None,GroupNames[3],GroupNames[4]] + GN7 = [GroupNames[0],None,GroupNames[2],GroupNames[3]] + GN8 = [None,GroupNames[1],GroupNames[2],GroupNames[3]] + else : + GN1 = [None,None,None,None,GroupNames[4]] + GN2 = [None,None,None,None,GroupNames[4]] + GN3 = [None,None,None,None,GroupNames[4]] + GN4 = [None,None,None,None,GroupNames[4]] + + GN5 = [None,None,None,GroupNames[3]] + GN6 = [None,None,GroupNames[2],None] + + GN9 = [GroupNames[0],None,None,GroupNames[3]] + GN10 = [GroupNames[0],None,None,None] + GN11 = [GroupNames[0],None,GroupNames[2],None] + + GN12 = [None,GroupNames[1],None,GroupNames[3]] + GN13 = [None,GroupNames[1],None,None] + GN14 = [None,GroupNames[1],GroupNames[2],None] + + Obj = [] + + Obj.append(MacObject('QuartCyl',[(X0+DLocal/4.,Y0+DLocal/4.),(DLocal/2.,DLocal/2.)],[InternalMeshing,'NE',K], groups = GN1)) + Obj.append(MacObject('QuartCyl',[(X0-DLocal/4.,Y0+DLocal/4.),(DLocal/2.,DLocal/2.)],['auto','NW',K], groups = GN2)) + Obj.append(MacObject('QuartCyl',[(X0-DLocal/4.,Y0-DLocal/4.),(DLocal/2.,DLocal/2.)],['auto','SW',K], groups = GN3)) + Obj.append(MacObject('QuartCyl',[(X0+DLocal/4.,Y0-DLocal/4.),(DLocal/2.,DLocal/2.)],['auto','SE',K], groups = GN4)) + + if DX > DLocal : + dX = (DX - DLocal)/2. + Obj.append(MacObject('CompBoxF',[(X0+DLocal/2.+dX/2.,Y0),(dX,DLocal)],['auto'], groups = GN5)) + Obj.append(MacObject('CompBoxF',[(X0-DLocal/2.-dX/2.,Y0),(dX,DLocal)],['auto'], groups = GN6)) + + if DY > DLocal : + dY = (DY - DLocal)/2. + if DX > DLocal : + Obj.append(MacObject('CompBoxF',[(X0+DLocal/2.+dX/2.,Y0-DLocal/2.-dY/2.),(dX,dY)],['auto'], groups = GN9)) + Obj.append(MacObject('CompBoxF',[(X0,Y0-DLocal/2.-dY/2.),(DLocal,dY)],['auto'], groups = GN10)) + Obj.append(MacObject('CompBoxF',[(X0-DLocal/2.-dX/2.,Y0-DLocal/2.-dY/2.),(dX,dY)],['auto'], groups = GN11)) + Obj.append(MacObject('CompBoxF',[(X0+DLocal/2.+dX/2.,Y0+DLocal/2.+dY/2.),(dX,dY)],['auto'], groups = GN12)) + Obj.append(MacObject('CompBoxF',[(X0,Y0+DLocal/2.+dY/2.),(DLocal,dY)],['auto'], groups = GN13)) + Obj.append(MacObject('CompBoxF',[(X0-DLocal/2.-dX/2.,Y0+DLocal/2.+dY/2.),(dX,dY)],['auto'], groups = GN14)) + else: + Obj.append(MacObject('CompBoxF',[(X0,Y0-DLocal/2.-dY/2.),(DLocal,dY)],['auto'], groups = GN7)) + Obj.append(MacObject('CompBoxF',[(X0,Y0+DLocal/2.+dY/2.),(DLocal,dY)],['auto'], groups = GN8)) + + return Obj diff --git a/src/Tools/MacMesh/MacMesh/GenFunctions.py b/src/Tools/MacMesh/MacMesh/GenFunctions.py new file mode 100644 index 000000000..2e3dce308 --- /dev/null +++ b/src/Tools/MacMesh/MacMesh/GenFunctions.py @@ -0,0 +1,873 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 + + + +# In this file are all the generation functions for manipulating the different created macro-objects + +import math, copy +import Config +import CutnGroup +import CompositeBox + +from salome.geom import geomBuilder +geompy = geomBuilder.New( Config.theStudy ) + +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New( Config.theStudy ) + +########################################################################################################## + +def Box11 (MacObject): + if Config.debug : print "Generating regular box" + + dummy1 = geompy.MakeScaleAlongAxes( ElemBox11 (), None , MacObject.GeoPar[1][0], MacObject.GeoPar[1][1], 1) + RectFace = geompy.MakeTranslation(dummy1, MacObject.GeoPar[0][0], MacObject.GeoPar[0][1], 0) + + MacObject.GeoChildren.append(RectFace) + MacObject.GeoChildrenNames.append("Box_"+ str(len(Config.ListObj)+1)) + + if Config.debug : Publish (MacObject.GeoChildren,MacObject.GeoChildrenNames) + + if Config.publish : + MacObject.Mesh.append(smesh.Mesh(RectFace)) # Creation of a new mesh + Quad2D = MacObject.Mesh[0].Quadrangle() # Applying a quadrangle hypothesis + + EdgeIDs = geompy.SubShapeAllSorted(RectFace,6) # List of Edge IDs belonging to RectFace, 6 = Edge in salome dictionary + Reg1D = MacObject.Mesh[0].Segment() + Reg1D.NumberOfSegments(MacObject.MeshPar[0]) + + MacObject.Mesh[0].Compute() # Generates the mesh + + MacObject.DirectionalMeshParams = [MacObject.MeshPar[0],MacObject.MeshPar[0],MacObject.MeshPar[0],MacObject.MeshPar[0]] + + MacObject.status = 1 + Config.ListObj.append(MacObject) + return MacObject + +########################################################################################################## + +def Box42 (MacObject): + if Config.debug : print "Generating box 4-2 reducer" + + Z_Axis = geompy.MakeVectorDXDYDZ(0., 0., 1.) + RotAngle = {'SN' : lambda : 0, + 'NS' : lambda : math.pi, + 'EW' : lambda : math.pi/2, + 'WE' : lambda : -math.pi/2, }[MacObject.MeshPar[1]]() + dummy0 = geompy.MakeRotation( ElemBox42 () , Z_Axis, RotAngle ) + dummy1 = geompy.MakeScaleAlongAxes( dummy0, None , MacObject.GeoPar[1][0], MacObject.GeoPar[1][1], 1) + RectFace = geompy.MakeTranslation(dummy1, MacObject.GeoPar[0][0], MacObject.GeoPar[0][1], 0) + + MacObject.GeoChildren.append(RectFace) + MacObject.GeoChildrenNames.append("Box_"+ str(len(Config.ListObj)+1)) + + if Config.debug : Publish (MacObject.GeoChildren,MacObject.GeoChildrenNames) + + if Config.publish : + MacObject.Mesh.append(smesh.Mesh(RectFace)) # Creation of a new mesh + Quad2D = MacObject.Mesh[0].Quadrangle() # Applying a quadrangle hypothesis + + EdgeIDs = geompy.SubShapeAllSorted(RectFace,6) # List of Edge IDs belonging to RectFace, 6 = Edge in salome dictionary + Reg1D = MacObject.Mesh[0].Segment() + Reg1D.NumberOfSegments(MacObject.MeshPar[0]) + + MacObject.Mesh[0].Compute() # Generates the mesh + + MacObject.status = 1 + + x = MacObject.MeshPar[0] + MacObject.DirectionalMeshParams = {'SN' : lambda : [3*x, 3*x, 4*x, 2*x], + 'NS' : lambda : [3*x, 3*x, 2*x, 4*x], + 'EW' : lambda : [2*x, 4*x, 3*x, 3*x], + 'WE' : lambda : [4*x, 2*x, 3*x, 3*x], }[MacObject.MeshPar[1]]() + + Config.ListObj.append(MacObject) + return MacObject + + +########################################################################################################## + +def BoxAng32 (MacObject): + if Config.debug : print "Generating sharp angle" + Z_Axis = geompy.MakeVectorDXDYDZ(0., 0., 1.) + RotAngle = {'NE' : lambda : 0, + 'NW' : lambda : math.pi/2, + 'SW' : lambda : math.pi, + 'SE' : lambda : -math.pi/2, }[MacObject.MeshPar[1]]() + dummy0 = geompy.MakeRotation( ElemEdge32 () , Z_Axis, RotAngle ) + dummy1 = geompy.MakeScaleAlongAxes( dummy0, None , MacObject.GeoPar[1][0], MacObject.GeoPar[1][1], 1) + RectFace = geompy.MakeTranslation(dummy1, MacObject.GeoPar[0][0], MacObject.GeoPar[0][1], 0) + + MacObject.GeoChildren.append(RectFace) + MacObject.GeoChildrenNames.append("Box_"+ str(len(Config.ListObj)+1)) + + if Config.debug : Publish (MacObject.GeoChildren,MacObject.GeoChildrenNames) + + if Config.publish : + MacObject.Mesh.append(smesh.Mesh(RectFace)) # Creation of a new mesh + Quad2D = MacObject.Mesh[0].Quadrangle() # Applying a quadrangle hypothesis + + EdgeIDs = geompy.SubShapeAllSorted(RectFace,6) # List of Edge IDs belonging to RectFace, 6 = Edge in salome dictionary + Reg1D = MacObject.Mesh[0].Segment() + Reg1D.NumberOfSegments(MacObject.MeshPar[0]) + + MacObject.Mesh[0].Compute() # Generates the mesh + + MacObject.status = 1 + + x = MacObject.MeshPar[0] + MacObject.DirectionalMeshParams = {'NE' : lambda : [3*x, 2*x, 3*x, 2*x], + 'NW' : lambda : [2*x, 3*x, 3*x, 2*x], + 'SW' : lambda : [2*x, 3*x, 2*x, 3*x], + 'SE' : lambda : [3*x, 2*x, 2*x, 3*x], }[MacObject.MeshPar[1]]() + + Config.ListObj.append(MacObject) + return MacObject +########################################################################################################## +def CompBox (MacObject): + if Config.debug : print "Generating composite box" + + dummy1 = geompy.MakeScaleAlongAxes( ElemBox11 (), None , MacObject.GeoPar[1][0], MacObject.GeoPar[1][1], 1) + RectFace = geompy.MakeTranslation(dummy1, MacObject.GeoPar[0][0], MacObject.GeoPar[0][1], 0) + + MacObject.GeoChildren.append(RectFace) + MacObject.GeoChildrenNames.append("Box_"+ str(len(Config.ListObj)+1)) + + if Config.debug : Publish (MacObject.GeoChildren,MacObject.GeoChildrenNames) + + if Config.publish : + MacObject.Mesh.append(smesh.Mesh(RectFace)) # Creation of a new mesh + Quad2D = MacObject.Mesh[0].Quadrangle() # Applying a quadrangle hypothesis + + EdgeIDs = geompy.SubShapeAllSorted(RectFace,6) # List of Edge IDs belonging to RectFace, 6 = Edge in salome dictionary + + ReducedRatio = ReduceRatio(MacObject.GeoPar[1][0],MacObject.GeoPar[1][1]) + + Reference = [0,0,0] + Vec = [(1,0,0),(0,1,0)] + for Edge in EdgeIDs: + for i in range(0,2): + if IsParallel(Edge,Vec[i]): + if not Reference[i]: # If this is the first found edge to be parallel to this direction, apply user preferences for meshing + Reference[i] = Edge + ApplyConstant1DMesh(MacObject.Mesh[0],Edge,int(round(ReducedRatio[i]*MacObject.MeshPar[0]))) + break + else: # If there already exists an edge parallel to this direction, then use a 1D projection + Apply1DProjMesh(MacObject.Mesh[0],Edge,Reference[i]) + break + + MacObject.Mesh[0].Compute() # Generates the mesh + + MacObject.DirectionalMeshParams = [MacObject.MeshPar[0]*ReducedRatio[1],MacObject.MeshPar[0]*ReducedRatio[1],MacObject.MeshPar[0]*ReducedRatio[0],MacObject.MeshPar[0]*ReducedRatio[0]] + + MacObject.status = 1 + Config.ListObj.append(MacObject) + return MacObject + +########################################################################################################## + +def CompBoxF (MacObject): + if Config.debug : print "Generating composite box" + + dummy1 = geompy.MakeScaleAlongAxes( ElemBox11 (), None , MacObject.GeoPar[1][0], MacObject.GeoPar[1][1], 1) + RectFace = geompy.MakeTranslation(dummy1, MacObject.GeoPar[0][0], MacObject.GeoPar[0][1], 0) + + MacObject.GeoChildren.append(RectFace) + MacObject.GeoChildrenNames.append("Box_"+ str(len(Config.ListObj)+1)) + + if Config.debug : Publish (MacObject.GeoChildren,MacObject.GeoChildrenNames) + + if Config.publish : + MacObject.Mesh.append(smesh.Mesh(RectFace)) # Creation of a new mesh + Quad2D = MacObject.Mesh[0].Quadrangle() # Applying a quadrangle hypothesis + + EdgeIDs = geompy.SubShapeAllSorted(RectFace,6) # List of Edge IDs belonging to RectFace, 6 = Edge in salome dictionary + + #ReducedRatio = ReduceRatio(MacObject.GeoPar[1][0],MacObject.GeoPar[1][1]) + + Reference = [0,0,0] + Vec = [(1,0,0),(0,1,0)] + for Edge in EdgeIDs: + for i in range(0,2): + if IsParallel(Edge,Vec[i]): + if not Reference[i]: # If this is the first found edge to be parallel to this direction, apply user preferences for meshing + Reference[i] = Edge + ApplyConstant1DMesh(MacObject.Mesh[0],Edge,int(round(MacObject.MeshPar[0][i]))) + break + else: # If there already exists an edge parallel to this direction, then use a 1D projection + Apply1DProjMesh(MacObject.Mesh[0],Edge,Reference[i]) + break + + MacObject.Mesh[0].Compute() # Generates the mesh + + MacObject.DirectionalMeshParams = [MacObject.MeshPar[0][1],MacObject.MeshPar[0][1],MacObject.MeshPar[0][0],MacObject.MeshPar[0][0]] + + MacObject.status = 1 + Config.ListObj.append(MacObject) + return MacObject +########################################################################################################## + +def NonOrtho (MacObject): + if Config.debug : print "Generating Non-orthogonal quadrangle" + + RectFace = Quadrangler (MacObject.PtCoor) + + MacObject.GeoChildren.append(RectFace) + MacObject.GeoChildrenNames.append("Quad_"+ str(len(Config.ListObj)+1)) + + + if Config.debug : Publish (MacObject.GeoChildren,MacObject.GeoChildrenNames) + + if Config.publish : + MacObject.Mesh.append(smesh.Mesh(RectFace)) # Creation of a new mesh + Quad2D = MacObject.Mesh[0].Quadrangle() # Applying a quadrangle hypothesis + + EdgeIDs = geompy.SubShapeAllSorted(RectFace,6) # List of Edge IDs belonging to RectFace, 6 = Edge in salome dictionary + + #ReducedRatio = ReduceRatio(MacObject.GeoPar[1][0],MacObject.GeoPar[1][1]) + + Vec = [MacObject.DirVectors(i) for i in range(4)] + for Edge in EdgeIDs: + Dir = [IsParallel(Edge,Vec[j]) for j in range(4)].index(True) + DirConv = [0,0,1,1][Dir] + ApplyConstant1DMesh(MacObject.Mesh[0],Edge,int(round(MacObject.MeshPar[0][DirConv]))) + + MacObject.Mesh[0].Compute() # Generates the mesh + + MacObject.DirectionalMeshParams = [MacObject.MeshPar[0][1],MacObject.MeshPar[0][1],MacObject.MeshPar[0][0],MacObject.MeshPar[0][0]] + + MacObject.status = 1 + Config.ListObj.append(MacObject) + return MacObject + +########################################################################################################## + +def QuartCyl (MacObject): + if Config.debug : print "Generating quarter cylinder" + Z_Axis = geompy.MakeVectorDXDYDZ(0., 0., 1.) + RotAngle = {'NE' : lambda : 0, + 'NW' : lambda : math.pi/2, + 'SW' : lambda : math.pi, + 'SE' : lambda : -math.pi/2, }[MacObject.MeshPar[1]]() + dummy0 = geompy.MakeRotation( ElemQuartCyl(MacObject.MeshPar[2]) , Z_Axis, RotAngle ) + dummy1 = geompy.MakeScaleAlongAxes( dummy0, None , MacObject.GeoPar[1][0]/10., MacObject.GeoPar[1][1]/10., 1) + RectFace = geompy.MakeTranslation(dummy1, MacObject.GeoPar[0][0], MacObject.GeoPar[0][1], 0) + + MacObject.GeoChildren.append(RectFace) + MacObject.GeoChildrenNames.append("Box_"+ str(len(Config.ListObj)+1)) + + if Config.debug : Publish (MacObject.GeoChildren,MacObject.GeoChildrenNames) + + if Config.publish : + MacObject.Mesh.append(smesh.Mesh(RectFace)) # Creation of a new mesh + Quad2D = MacObject.Mesh[0].Quadrangle() # Applying a quadrangle hypothesis + + EdgeIDs = geompy.SubShapeAllSorted(RectFace,6) # List of Edge IDs belonging to RectFace, 6 = Edge in salome dictionary + Reg1D = MacObject.Mesh[0].Segment() + + #if MacObject.MeshPar[0] == 2 and MacObject.MeshPar[2] <= 2.: + # print("Due to a bug in Salome 6.3, we are forced to either increase or decrease the local refinement by 50%, we choose in this case to increase the model's refinement.") + # MacObject.MeshPar[0] = 3 + + Reg1D.NumberOfSegments(MacObject.MeshPar[0]) + + MacObject.Mesh[0].Compute() # Generates the mesh + + MacObject.status = 1 + + x = MacObject.MeshPar[0] + N = QuarCylParam(MacObject.MeshPar[2])+1 + + MacObject.DirectionalMeshParams = {'NE' : lambda : [2*x, N*x, 2*x, N*x], + 'NW' : lambda : [N*x, 2*x, 2*x, N*x], + 'SW' : lambda : [N*x, 2*x, N*x, 2*x], + 'SE' : lambda : [2*x, N*x, N*x, 2*x], }[MacObject.MeshPar[1]]() + + Config.ListObj.append(MacObject) + return MacObject + +########################################################################################################## +# Below this are the elementary calculation/visualization functions +########################################################################################################## + +def Publish (ObjToPublish,NamesToPublish): + i = 0 + for GeoObj in ObjToPublish : + geompy.addToStudy(GeoObj,NamesToPublish[i]) + i = i+1 + +def IsParallel (Edge, Vector): + """ + Function checks whether a given edge object is parallel to a reference vector. + Output can be 0 (not parallel) or 1 (parallel and same sense) or 2 (parallel and opposite sense). + If the reference vector is null, the function returns 0 + """ + if Vector == (0,0,0) : return 0 + else : + P1 = geompy.PointCoordinates(geompy.GetVertexByIndex(Edge,0)) + P2 = geompy.PointCoordinates(geompy.GetVertexByIndex(Edge,1)) + V0 = [ P1[0] - P2[0], P1[1] - P2[1], P1[2] - P2[2] ] + if Distance2Pt((0,0,0),CrossProd(V0,Vector))<1e-7 and DotProd(V0,Vector) > 0 : return 1 + elif Distance2Pt((0,0,0),CrossProd(V0,Vector))<1e-7 and DotProd(V0,Vector) < 0 : return 2 + else : return 0 + +def IsOnCircle (Edge, Center, Radius): + """ + Function checks whether a given edge object belong to the periphery of a circle defined by its + center and radius. + Output can be 0 (does not belong) or 1 (belongs). + If the reference Radius is null, the function returns 0 + Note that this function is basic in the sense that it only checks if the two border points of a + given edge belong to the arc of reference. + """ + if Radius == 0 : return 0 + else : + P1 = geompy.PointCoordinates(geompy.GetVertexByIndex(Edge,0)) + P2 = geompy.PointCoordinates(geompy.GetVertexByIndex(Edge,1)) + if abs(Distance2Pt(Center,P1)-Radius) < 1e-6 and abs(Distance2Pt(Center,P2)-Radius) < 1e-6: + return 1 + else : + return 0 + +def CrossProd(V1,V2): + """ + Determines the cross product of two 3D vectors + """ + return ([V1[1]*V2[2]-V1[2]*V2[1], V1[2]*V2[0]-V1[0]*V2[2], V1[0]*V2[1]-V1[1]*V2[0]]) + +def QuarCylParam(PitchRatio): + R = float(PitchRatio)/(PitchRatio+1) + Eps = 1. - R + X = (R+Eps/2.)*math.sin(math.pi/4)+Eps/2. + N = int(math.floor((math.pi*R/4.)/(Eps/2.))) + return N + +def DotProd(V1,V2): + """ + Determines the dot product of two 3D vectors + """ + if len(V1)==2 : V1.append(0) + if len(V2)==2 : V2.append(0) + + return (V1[0]*V2[0]+V1[1]*V2[1]+V1[2]*V2[2]) + +def Distance2Pt(P1,P2): + """ + Returns the distance between two points + """ + return (math.sqrt((P1[0]-P2[0])**2+(P1[1]-P2[1])**2+(P1[2]-P2[2])**2)) + +def ApplyConstant1DMesh (ParentMsh, Edge, Nseg): + Reg1D = ParentMsh.Segment(geom=Edge) + Len = Reg1D.NumberOfSegments(Nseg) + +def Apply1DProjMesh (ParentMsh, Edge, Ref): + Proj1D = ParentMsh.Projection1D(geom=Edge) + SrcEdge = Proj1D.SourceEdge(Ref,None,None,None) + +def EdgeLength (Edge): + """ + This function returns the edge object length. + """ + P1 = geompy.PointCoordinates(geompy.GetVertexByIndex(Edge,0)) + P2 = geompy.PointCoordinates(geompy.GetVertexByIndex(Edge,1)) + return Distance2Pt(P1,P2) + + +def D2R (Angle): + return Angle*math.pi/180 + +def R2D (Angle): + return Angle*180/math.pi + +def F2D (FloatNumber): + return round(FloatNumber*100.)/100. + +def BezierGen (PointA, PointB, AngleA, AngleB): + + if AngleA == 0 and AngleB == 0 : return (geompy.MakeEdge(PointA, PointB)) + else : + A = geompy.PointCoordinates(PointA) + B = geompy.PointCoordinates(PointB) + dAB = Distance2Pt(A,B) + dAC = dAB * (math.tan(AngleA)*math.tan(AngleB)) / (math.sin(AngleA) * ( math.tan(AngleA)+math.tan(AngleB) ) ) + AngleOX_AB = math.acos((B[0]-A[0])/dAB) + PointC = geompy.MakeVertex(A[0]+math.cos(AngleA+AngleOX_AB)*dAC,A[1]+math.sin(AngleA+AngleOX_AB)*dAC,0) + CurveACB = geompy.MakeBezier([PointA,PointC,PointB]) + return CurveACB + +def GetSideAngleForBezier (PointA , PointB): + """ + This function takes for input two points A and B where the bezier line is needed. It calculates the incident + angle needed at point A so that the final curve is either at 0 or 90 degrees from the x'Ox axis + """ + A = geompy.PointCoordinates(PointA) + B = geompy.PointCoordinates(PointB) + ABx = B[0]-A[0] + dAB = Distance2Pt(A,B) + Alpha = math.acos(ABx/dAB) + #print "New angle request" + #print ABx, dAB, R2D(Alpha) + if Alpha < math.pi/4 : + #print "returning", R2D(-Alpha) + return -Alpha + elif Alpha < 3*math.pi/4 : + #print "returning", R2D(-(Alpha-math.pi/2)) + return -(Alpha-math.pi/2) + else : + #print "returning", R2D(-(Alpha-math.pi)) + return -(Alpha-math.pi) + +def VecDivRatio (Vec1, Vec2): + """ + This function tries to find the ratio of Vec1 on Vec2 while neglecting any zero term in Vec1. This is used afterwards + for determining the global mesh parameter from automatically detected directional mesh params. If no compatibility is + possible, the function returns -1 + """ + Vec3 = [] + for i in range(len(Vec1)) : + Vec3.append(float(Vec1[i])/Vec2[i]) + Ratio=[] + for i in Vec3 : + if not (abs(i)<1e-7) : Ratio.append(i) + if Ratio : + if min(Ratio) == max(Ratio) and min(Ratio)==int(min(Ratio)) : return(min(Ratio)) + else : return -1 + else : + return -2 + + +def ReduceRatio (dx, dy): + """ + This function transforms a decimal ratio into a scale between two integers, for example : [0.2,0.05] --> [4,1] ; + """ + Output = [0,0] + ratio = float(dy)/dx + if isinteger(ratio) : return [1,ratio] + elif dx == 1 : # when this function is called recursively! + for i in range(1,20) : # searches over 20 decimals + if isinteger(ratio * (10**i) ) : + Output = GetScale((10**i),int(round(ratio * (10**i) ) ) ) + break + else : + for n in range(0,i) : + if isinteger(ratio * ( 10**(i)-10**(n) )) : + Output = GetScale( 10**(i)-10**(n) , int(round(ratio * ( 10**(i)-10**(n) ) ) ) ) + break + if not (Output==[0,0]) : break + return Output + else : + for i in range(1,10) : # searches over 10 decimals + if isinteger(ratio * (10**i) ) : + Output = GetScale((10**i),int(round(ratio * (10**i) ) ) ) + break + else : + for n in range(0,i) : + if isinteger(ratio * ( 10**(i)-10**(n) )) : + Output = GetScale( 10**(i)-10**(n) , int(round(ratio * ( 10**(i)-10**(n) ) ) ) ) + break + if not (Output==[0,0]) : break + + if Output == [0,0] : + print "We are having some trouble while interpreting the following ratio: ",ratio, "\nWe will try a recursive method which may in some cases take some time..." + if dy > dx : + A = ReduceRatio (dx, dy-dx) + return ([A[0],A[1]+A[0]]) + else : + A = ReduceRatio (dy, dx-dy) + return ([A[1]+A[0],A[0]]) + + else : return Output + +def GetScale (X,Y): + """ + This function is called within ReduceRatio and aims to reduce down two integers X and Y by dividing them with their common divisors; + Example: 25 and 5 ---> 5 and 1 / 63 and 12 ---> 21 and 4 + """ + MaxDiv = max(X,Y) + Divisor = 2 # Initializing the divisor + while MaxDiv >= Divisor : + X0 = 0 + Y0 = 0 + if not(X%Divisor) : + X0 = X/Divisor + MaxDiv = max(MaxDiv,X0) + if not(Y%Divisor) : + Y0 = Y/Divisor + MaxDiv = max(MaxDiv,Y0) + if (X0*Y0) : + X = X0 + Y = Y0 + else : + Divisor = Divisor + 1 + return [X,Y] + +def isinteger (x) : + """ + This functions applies a simple check if the entered value is an integer + """ + x = float('%.5f' % (x)) #Truncate x to 5 digits after the decimal point + if math.ceil(x) == math.floor(x) : return True + else : return False +########################################################################################## +# Below this are the functions that create the elementary forms for the macro objects +########################################################################################## + +def ElemBox11 (): + """ + This function returns a simple square face of 1 side length + """ + RectFace = geompy.MakeFaceHW(1, 1, 1) + return RectFace + +def ElemBox42 (): + """ + This function returns a square face of 1 side length, partitioned + according to the elementary 4 to 2 reductor method + """ + OrigRectFace = geompy.MakeFaceHW(1, 1, 1) + + SouthPt1 = geompy.MakeVertex (-.25, -.5, 0) + SouthPt2 = geompy.MakeVertex (0, -.5, 0) + SouthPt3 = geompy.MakeVertex (.25, -.5, 0) + WestPt1 = geompy.MakeVertex (-.5, -.5+1./3, 0) + WestPt2 = geompy.MakeVertex (-.5, -.5+2./3, 0) + EastPt1 = geompy.MakeVertex (.5, -.5+1./3, 0) + EastPt2 = geompy.MakeVertex (.5, -.5+2./3, 0) + NorthPt = geompy.MakeVertex (0, .5, 0) + MidPt1 = geompy.MakeVertex (0, .05, 0) + MidPt2 = geompy.MakeVertex (.2, -.18, 0) + MidPt3 = geompy.MakeVertex (0, -.28, 0) + MidPt4 = geompy.MakeVertex (-.2, -.18, 0) + + Cutter = [] + Cutter.append(geompy.MakeEdge(SouthPt2, MidPt3)) + Cutter.append(geompy.MakeEdge(MidPt1, NorthPt)) + Cutter.append(BezierGen(SouthPt1, MidPt4, GetSideAngleForBezier(SouthPt1,MidPt4), D2R(15))) + Cutter.append(BezierGen(SouthPt3, MidPt2, GetSideAngleForBezier(SouthPt3,MidPt2), D2R(-15))) + Cutter.append(BezierGen(WestPt1, MidPt4, GetSideAngleForBezier(WestPt1,MidPt4), D2R(-10))) + Cutter.append(BezierGen(EastPt1, MidPt2, GetSideAngleForBezier(EastPt1,MidPt2), D2R(10))) + Cutter.append(BezierGen(WestPt2, MidPt1, GetSideAngleForBezier(WestPt2,MidPt1), D2R(-10))) + Cutter.append(BezierGen(EastPt2, MidPt1, GetSideAngleForBezier(EastPt2,MidPt1), D2R(10))) + Cutter.append(BezierGen(MidPt2, MidPt1, D2R(-15), D2R(-15))) + Cutter.append(BezierGen(MidPt3, MidPt2, D2R(10), D2R(15))) + Cutter.append(BezierGen(MidPt3, MidPt4, D2R(-10), D2R(-15))) + Cutter.append(BezierGen(MidPt4, MidPt1, D2R(15), D2R(15))) + + RectFace = geompy.MakePartition([OrigRectFace],Cutter, [], [],4, 0, [], 0) #Creating the partition object + #i=1 + #for SingleCut in Cutter : + # geompy.addToStudy(SingleCut,'Cutter'+str(i)) + # i = i+1 + #geompy.addToStudy(RectFace,'RectFace') + return RectFace + +def ElemEdge32 (): + """ + This function returns a square face of 1 side length, partitioned + according to the elementary edge with 3 to 2 reductor + """ + OrigRectFace = geompy.MakeFaceHW(1., 1., 1) + + SouthPt1 = geompy.MakeVertex (-1./6, -0.5, 0.) + SouthPt2 = geompy.MakeVertex ( 1./6, -0.5, 0.) + WestPt1 = geompy.MakeVertex (-0.5, -1./6, 0.) + WestPt2 = geompy.MakeVertex (-0.5, 1./6, 0.) + EastPt = geompy.MakeVertex ( 0.5, 0., 0.) + NorthPt = geompy.MakeVertex (0., 0.5, 0.) + + MidPt1 = geompy.MakeVertex (-0.2, -0.2, 0.) + MidPt2 = geompy.MakeVertex ( -0.02, -0.02, 0.) + + Cutter = [] + Cutter.append(BezierGen(SouthPt1, MidPt1, GetSideAngleForBezier(SouthPt1,MidPt1) , D2R(-5))) + Cutter.append(BezierGen( WestPt1, MidPt1, GetSideAngleForBezier(WestPt1 ,MidPt1) , D2R(-5))) + Cutter.append(BezierGen(SouthPt2, MidPt2, GetSideAngleForBezier(SouthPt2,MidPt2) , D2R(-10))) + Cutter.append(BezierGen( EastPt, MidPt2, GetSideAngleForBezier(EastPt ,MidPt2) , D2R(5))) + Cutter.append(BezierGen( WestPt2, MidPt2, GetSideAngleForBezier(WestPt2 ,MidPt2) , D2R(-10))) + Cutter.append(BezierGen( MidPt2, NorthPt, GetSideAngleForBezier(NorthPt ,MidPt2) , D2R(-5))) + + Cutter.append(geompy.MakeEdge(MidPt1, MidPt2)) + + RectFace = geompy.MakePartition([OrigRectFace],Cutter, [], [],4, 0, [], 0) #Creating the partition object + #i=1 + #for SingleCut in Cutter : + # geompy.addToStudy(SingleCut,'Cutter'+str(i)) + # i = i+1 + #geompy.addToStudy(RectFace,'RectFace') + return RectFace + +def Quadrangler (Points): + """ + This function returns a quadranglar face based on four points, non of which 3 are non-colinear. + The points are defined by their 2D [(x1,y1),(x2,y2)..] coordinates. + Note that the list of points is already arranged upon the creation in MacObject + """ + Pt = [] + for Point in Points: Pt.append(geompy.MakeVertex(Point[0], Point[1], 0)) + # The first point is added at the end of the list in order to facilitate the line creation + Pt.append(Pt[0]) + #Draw the lines in order to form the 4 side polygon + Ln=[] + for i in range(4) : Ln.append(geompy.MakeLineTwoPnt(Pt[i],Pt[i+1])) + RectFace = geompy.MakeQuad (Ln[0],Ln[1],Ln[2],Ln[3]) + return RectFace + +def ElemQuartCyl(K): + """ + This function returns a quarter cylinder to box relay of 1 side length, partitioned + with a pitch ratio of K, In other words the side of the box is R*(1+(1/K)) + """ + R = 10.*float(K)/(K+1) + Eps = 10.- R + + Config.theStudy.SetReal("R" , R) + Config.theStudy.SetReal("minusR" , -R) + Config.theStudy.SetReal("Eps", Eps) + + CylWire = geompy.MakeSketcher("Sketcher:F 'R' 0:R 0:L 'Eps':TT 10. 10.0:R 90:L 10.0:R 90:L 'Eps':R 90:C 'minusR' 90.0:WW", [0, 0, 0, 0, 0, 1, 1, 0, -0]) + CylFace = geompy.MakeFace(CylWire, 1) + + SouthPt = geompy.MakeVertex (R+Eps/2., 0., 0) + SouthWestPt = geompy.MakeVertex ( 0.,0., 0) #The origin can be used for practical partionning objectifs + WestPt = geompy.MakeVertex (0., R+Eps/2., 0) + + N = int(math.floor((math.pi*R/4.)/(Eps/2.))) + X = 10.*(1.-1./(N+1)) + + + EastPt = geompy.MakeVertex (10.0, X, 0.) + NorthPt = geompy.MakeVertex ( X, 10.0, 0.) + + DivFactor = 8./(F2D(math.log(K))-0.223) + #MidPt = geompy.MakeVertex ((R+Eps)*math.cos(math.pi/4), (R+Eps)*math.sin(math.pi/4), 0.) + MidPt = geompy.MakeVertex (X-Eps/DivFactor, X-Eps/DivFactor, 0.) + + Cutter = [] + Cutter.append(BezierGen(SouthWestPt, MidPt, GetSideAngleForBezier(SouthWestPt,MidPt) , D2R(-5))) + Cutter.append(BezierGen( EastPt, MidPt, GetSideAngleForBezier(EastPt,MidPt) , D2R(5))) + Cutter.append(BezierGen( MidPt, NorthPt, (-1)**((K<1.25)*1)*D2R(-5), GetSideAngleForBezier(NorthPt,MidPt))) + SMBezier = BezierGen( SouthPt, MidPt, GetSideAngleForBezier(SouthPt ,MidPt) , D2R((K<1.25)*180-5)) + WMBezier = BezierGen( WestPt, MidPt, GetSideAngleForBezier(WestPt, MidPt) , D2R(-5)) + Cutter.append(WMBezier) + Cutter.append(SMBezier) + + for i in range(1,N) : + # Determining intermediate points on the bezier lines and then performing additional cuts + + TempAnglePlus = (math.pi/4)*(1+float(i)/N) + SectionResult = CutnGroup.Go(WMBezier, [(0,0,0,math.sin(TempAnglePlus),-math.cos(TempAnglePlus),0)], [1], ['Dummy'], 0) + TempPt1 = SectionResult[1][0] + TempPt11 = geompy.MakeVertex ((N-i)*X/N, 10., 0) + + TempAngleMinus = (math.pi/4)*(1-float(i)/N) + SectionResult = CutnGroup.Go(SMBezier, [(0,0,0,math.sin(TempAngleMinus),-math.cos(TempAngleMinus),0)], [1], ['Dummy'], 0) + TempPt2 = SectionResult[1][0] + TempPt21 = geompy.MakeVertex (10., (N-i)*X/N, 0) + + Cutter.append(geompy.MakeEdge(SouthWestPt, TempPt1)) + Cutter.append(geompy.MakeEdge(SouthWestPt, TempPt2)) + Cutter.append(geompy.MakeEdge(TempPt1, TempPt11)) + Cutter.append(geompy.MakeEdge(TempPt2, TempPt21)) + + CylFace = geompy.MakePartition([CylFace],Cutter, [], [],4, 0, [], 0) #Creating the partition object + CylFace = geompy.MakeTranslation(CylFace, -5., -5., 0.0) + + return CylFace + +def CompatibilityTest(MacObject): + Type = MacObject.Type + if Type == 'Box11' : + BaseDirPar = [1,1,1,1] + return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar)) + elif Type == 'Box42' : + BaseDirPar = {'SN' : lambda : [3, 3, 4, 2], + 'NS' : lambda : [3, 3, 2, 4], + 'EW' : lambda : [2, 4, 3, 3], + 'WE' : lambda : [4, 2, 3, 3], }[MacObject.MeshPar[1]]() + return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar)) + elif Type == 'BoxAng32' : + BaseDirPar = {'NE' : lambda : [3, 2, 3, 2], + 'NW' : lambda : [2, 3, 3, 2], + 'SW' : lambda : [2, 3, 2, 3], + 'SE' : lambda : [3, 2, 2, 3], }[MacObject.MeshPar[1]]() + return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar)) + elif Type == 'CompBox' : + #print "dx is: ", MacObject.GeoPar[1][1], ". dy is: ",MacObject.GeoPar[1][0] + ReducedRatio = ReduceRatio(MacObject.GeoPar[1][0], MacObject.GeoPar[1][1]) + #print ReducedRatio + BaseDirPar = [ReducedRatio[1], ReducedRatio[1], ReducedRatio[0], ReducedRatio[0]] + return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar)) + + elif Type == 'QuartCyl' : + N = QuarCylParam(MacObject.MeshPar[2])+1 + BaseDirPar = {'NE' : lambda : [2, N, 2, N], + 'NW' : lambda : [N, 2, 2, N], + 'SW' : lambda : [N, 2, N, 2], + 'SE' : lambda : [2, N, N, 2], }[MacObject.MeshPar[1]]() + return int(VecDivRatio(MacObject.DirectionalMeshParams, BaseDirPar)) + elif Type == 'CompBoxF' : + RealRatio = MacObject.GeoPar[1][1]/MacObject.GeoPar[1][0] + Xd = 0 + Yd = 0 + if MacObject.DirectionalMeshParams[2]+MacObject.DirectionalMeshParams[3] : + A = int(max(MacObject.DirectionalMeshParams[2:4])) + Xd = int(VecDivRatio([A,0,0,0], [1,1,1,1])) + if MacObject.DirectionalMeshParams[0]+MacObject.DirectionalMeshParams[1] : + A = int(max(MacObject.DirectionalMeshParams[0:2])) + Yd = int(VecDivRatio([0,0,A,0], [1,1,1,1])) + + if Xd == 0 and Yd : Xd = int(round(Yd/RealRatio)) + elif Yd == 0 : Yd = int(round(RealRatio*Xd)) + + return [Xd,Yd] + elif Type == 'NonOrtho' : + MeanDX = 0.5*(IntLen(MacObject.DirBoundaries(0))+IntLen(MacObject.DirBoundaries(1))) + MeanDY = 0.5*(IntLen(MacObject.DirBoundaries(2))+IntLen(MacObject.DirBoundaries(3))) + RealRatio = MeanDY/MeanDX + Xd = 0 + Yd = 0 + if MacObject.DirectionalMeshParams[2]+MacObject.DirectionalMeshParams[3] : + A = int(max(MacObject.DirectionalMeshParams[2:4])) + Xd = int(VecDivRatio([A,0,0,0], [1,1,1,1])) + if MacObject.DirectionalMeshParams[0]+MacObject.DirectionalMeshParams[1] : + A = int(max(MacObject.DirectionalMeshParams[0:2])) + Yd = int(VecDivRatio([0,0,A,0], [1,1,1,1])) + + if Xd == 0 and Yd : Xd = int(round(Yd/RealRatio)) + elif Yd == 0 : Yd = int(round(RealRatio*Xd)) + + return [Xd,Yd] + +def IntLen (Interval) : + """ + This function returns the length of a given interval even if the latter is not sorted correctly. + """ + return abs(Interval[1]-Interval[0]) + +def NextTo (RefBox, Direction, Extension): + """ + This functions returns geometrical parameters for easy positioning of neighbouring objects. + The input (RefBox) and output are in the form : [(X0,Y0),(DX,DY)] + """ + X0_0 = RefBox[0][0] + Y0_0 = RefBox[0][1] + DX_0 = RefBox[1][0] + DY_0 = RefBox[1][1] + + DirectionalCoef = {'Above' : lambda : [ 0, 1], + 'Below' : lambda : [ 0,-1], + 'Right' : lambda : [ 1, 0], + 'Left ' : lambda : [-1, 0], }[Direction]() + + X0_1 = X0_0+ DirectionalCoef[0] * (DX_0/2.+Extension/2.) + DX_1 = abs(DirectionalCoef[0]) * (Extension) + abs(DirectionalCoef[1])*DX_0 + Y0_1 = Y0_0+ DirectionalCoef[1] * (DY_0/2.+Extension/2.) + DY_1 = abs(DirectionalCoef[1]) * (Extension) + abs(DirectionalCoef[0])*DY_0 + + return [(X0_1,Y0_1),(DX_1,DY_1)] + +def GeomMinMax (PtA, PtB): + """ + This function returns geometrical parameters in the format [(X0,Y0),(DX,DY)]. The input being + the coordinates of two points (Xa,Ya), (Xb,Yb). + """ + # First test that the vector relying the two points is oblique + AB = [PtB[0]- PtA[0],PtB[1]- PtA[1]] + if 0 in AB : + print ("Error: the two points are not correctly defined. In the orthonormal system XOY, it is impossible to define a rectangle with these two points") + return -1 + else: + X0 = 0.5*(PtA[0]+PtB[0]) + Y0 = 0.5*(PtA[1]+PtB[1]) + DX = abs(AB[0]) + DY = abs(AB[1]) + return [(X0,Y0),(DX,DY)] + +def AddIfDifferent (List, Element): + if not(Element in List): + List = List+(Element,) + return List + +def IndexMultiOcc (Array,Element) : + """ + This functions returns the occurrences indices of Element in Array. + As opposed to Array.index(Element) method, this allows determining + multiple entries rather than just the first one! + """ + Output = [] + try : Array.index(Element) + except ValueError : print "No more occurrences" + else : Output.append(Array.index(Element)) + + if not(Output == []) and len(Array) > 1 : + for index, ArrElem in enumerate(Array[Output[0]+1:]) : + if ArrElem == Element : Output.append(index+Output[0]+1) + + return Output + +def SortList (ValList, CritList): + Output = [] + SortedCritList = copy.copy(CritList) + SortedCritList.sort() + for i in range(0,len(ValList)): + if i > 0 : + if not(SortedCritList[i]==SortedCritList[i-1]): + index = IndexMultiOcc(CritList,SortedCritList[i]) + Output= Output + [ValList[j] for j in index] + else : + index = IndexMultiOcc(CritList,SortedCritList[i]) + Output= Output + [ValList[j] for j in index] + + return Output + +def SortPoints(Points): + """ + This function sorts a list of the coordinates of N points as to start at + an origin that represents Xmin and Xmax and then proceed in a counter + clock-wise sense + """ + NbPts = len(Points) + Xmin = min([Points[i][0] for i in range(NbPts)]) + Ymin = min([Points[i][1] for i in range(NbPts)]) + Xmax = max([Points[i][0] for i in range(NbPts)]) + Ymax = max([Points[i][1] for i in range(NbPts)]) + Crit = [(abs(Point[0]-Xmin)+0.1*(Xmax-Xmin))*(abs(Point[1]-Ymin)+0.1*(Ymax-Ymin)) for Point in Points] + #print "Input Points : ", Points + #print "Sorting Criterion : ", Crit + Order = SortList (range(NbPts), Crit) + #print "Sorted Results : ", Order + Output = [] + Output.append(Points[Order[0]]) + + Point0 = Points[Order[0]] + #print "Reference point :", Point0 + + V = [[Point1[0]-Point0[0],Point1[1]-Point0[1]] for Point1 in Points] + Cosines = [-(vec[0]-1E-10)/(math.sqrt(DotProd(vec,vec)+1e-25)) for vec in V] + #print "Cosines criterion :", Cosines + Order = SortList(range(NbPts),Cosines) + #print "Ordered points:", Order + for PtIndex in Order[:-1]: Output.append(Points[PtIndex]) + + return Output + diff --git a/src/Tools/MacMesh/MacMesh/MacObject.py b/src/Tools/MacMesh/MacMesh/MacObject.py new file mode 100644 index 000000000..4b78724cc --- /dev/null +++ b/src/Tools/MacMesh/MacMesh/MacObject.py @@ -0,0 +1,302 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 + + + +class MacObject: + """ + This represents a python class definition which contains + all necessary information about the macro object being created + in Salome + """ + + def __init__( self, ObjectType, GeoParameters, MeshParameters, **args ): + """ + Initializes the macro object to be created, saves parameters inside of it, checks for neighboring objects, + determines meshing parameters if necessary and finally launches the generation process. + """ + import Config,GenFunctions + if Config.debug : print "Initializing object No. " + str(len(Config.ListObj)+1) + + if 'publish' in args : + if args['publish']==0 : Config.publish = 0 + else : Config.publish = 1 + else : Config.publish = 1 + + if 'groups' in args : + self.GroupNames = args['groups'] + for group in args['groups'] : + if not(group in Config.Groups) and group : Config.Groups.append(group) + else : self.GroupNames = [None, None, None, None] + + if ObjectType == 'NonOrtho': + if not(len(GeoParameters)==4): print "Error: trying to construct a non-ortho object but the 4 constitutive vertices are not given!" + else : + Xmin = min([GeoParameters[i][0] for i in range(4)]) + Xmax = max([GeoParameters[i][0] for i in range(4)]) + Ymin = min([GeoParameters[i][1] for i in range(4)]) + Ymax = max([GeoParameters[i][1] for i in range(4)]) + self.GeoPar = [(0.5*(Xmin+Xmax),0.5*(Ymin+Ymax)),(Xmax-Xmin,Ymax-Ymin)] + self.PtCoor = GenFunctions.SortPoints(GeoParameters) + else: + self.GeoPar = GeoParameters + [Xmin,Ymin,Xmax,Ymax] = [ self.GeoPar[0][0]-0.5*self.GeoPar[1][0], self.GeoPar[0][1]-0.5*self.GeoPar[1][1] ] + [ self.GeoPar[0][0]+0.5*self.GeoPar[1][0], self.GeoPar[0][1]+0.5*self.GeoPar[1][1] ] + self.PtCoor = [(Xmin,Ymin),(Xmax,Ymin),(Xmax,Ymax),(Xmin,Ymax)] + + self.Type = ObjectType + self.LowBound = [ self.GeoPar[0][0]-0.5*self.GeoPar[1][0], self.GeoPar[0][1]-0.5*self.GeoPar[1][1] ] + self.UpperBound = [ self.GeoPar[0][0]+0.5*self.GeoPar[1][0], self.GeoPar[0][1]+0.5*self.GeoPar[1][1] ] + self.MeshPar = MeshParameters + self.GeoChildren = [] + self.GeoChildrenNames = [] + self.Mesh = [] + self.MeshGroups = [] + self.CheckInterfaces() + if 'auto' in MeshParameters : self.AutoParam() + if not(self.MeshPar[0]<0): self.Generate() + else : + Config.ListObj.append(self) + print("Aborting object creation\n ") + + def Generate(self) : + """ + This method generates the geometrical object with the corresponding mesh once all verifications (CheckInterfaces and AutoParam) + have been accomplished + """ + import GenFunctions, Alarms, Config + self = {'Box11' : lambda : GenFunctions.Box11(self), + 'Box42' : lambda : GenFunctions.Box42(self), + 'BoxAng32' : lambda : GenFunctions.BoxAng32(self), + 'CompBox' : lambda : GenFunctions.CompBox(self), + 'CompBoxF' : lambda : GenFunctions.CompBoxF(self), + 'NonOrtho' : lambda : GenFunctions.NonOrtho(self), + 'QuartCyl' : lambda : GenFunctions.QuartCyl(self) }[self.Type]() + + if Config.debug : Alarms.Message(self.status) # notification on the result of the generation algorithm + + + def CheckInterfaces(self): + """ + This method searches for neighbours for the object being created and saves them inside the Config.Connections + array. This array contains 4 entries per object corresponding to West, East, South, and North neighbours. + Note that an object may have more than one neighbour for a given direction. + """ + import Alarms, Config + from GenFunctions import AddIfDifferent + from CompositeBox import FindCommonSide + + Config.Connections.append([(-1,),(-1,),(-1,),(-1,)]) + itemID = len(Config.ListObj) + # In all cases except non ortho, PrincipleBoxes is unitary and contains the box in question + # In the non-ortho case it contains all possible combinations of boxes with 3 vertices + PrincipleBoxes = self.PrincipleBoxes() + for i, TestObj in enumerate(Config.ListObj): + SecondaryBoxes = TestObj.PrincipleBoxes() + ConnX = 0 + ConnY = 0 + for Box0 in PrincipleBoxes: + for Box1 in SecondaryBoxes: + # Along X + CenterDis = abs(Box1[0][0]-Box0[0][0]) + Extension = 0.5*(Box1[1][0]+Box0[1][0]) + if CenterDis - Extension < -1e-7 : + ConnX = -1 + elif CenterDis - Extension < 1e-7 : + if not(FindCommonSide(self.DirBoundaries(2),TestObj.DirBoundaries(3))==[0,0]) and Box1[0][0] < Box0[0][0] : ConnX = 1 + elif not(FindCommonSide(self.DirBoundaries(3),TestObj.DirBoundaries(2))==[0,0]) and Box1[0][0] >= Box0[0][0]: ConnX = 2 + else : ConnX = 0 + + # Along Y + CenterDis = abs(Box1[0][1]-Box0[0][1]) + Extension = 0.5*(Box1[1][1]+Box0[1][1]) + if CenterDis - Extension < -1e-7 : + ConnY = -1 + elif CenterDis - Extension < 1e-7 : + if not(FindCommonSide(self.DirBoundaries(0),TestObj.DirBoundaries(1))==[0,0]) and Box1[0][1] < Box0[0][1] : ConnY = 1 + elif not(FindCommonSide(self.DirBoundaries(1),TestObj.DirBoundaries(0))==[0,0]) and Box1[0][1] >= Box0[0][1]: ConnY = 2 + else : ConnY = 0 + + if not (ConnX*ConnY == 0) : + if max(ConnX,ConnY) == -1 and not('NonOrtho' in [self.Type,TestObj.Type]) : Alarms.Message(3) + else: + if ConnX == 1 and ConnY == -1: + if Config.Connections[i][1] == (-1,) : Config.Connections[i][1] = (itemID,) + else : Config.Connections[i][1] = AddIfDifferent(Config.Connections[i][1],itemID) + if Config.Connections[itemID][0] == (-1,) : Config.Connections[itemID][0] = (i,) + else : Config.Connections[itemID][0] = AddIfDifferent(Config.Connections[itemID][0],i) + elif ConnX == 2 and ConnY == -1: + if Config.Connections[i][0] == (-1,) : Config.Connections[i][0] = (itemID,) + else : Config.Connections[i][0] = AddIfDifferent(Config.Connections[i][0],itemID) + if Config.Connections[itemID][1] == (-1,) : Config.Connections[itemID][1] = (i,) + else : Config.Connections[itemID][1] = AddIfDifferent(Config.Connections[itemID][1],i) + elif ConnY == 1 and ConnX == -1: + if Config.Connections[i][3] == (-1,) : Config.Connections[i][3] = (itemID,) + else : Config.Connections[i][3] = AddIfDifferent(Config.Connections[i][3],itemID) + if Config.Connections[itemID][2] == (-1,) : Config.Connections[itemID][2] = (i,) + else : Config.Connections[itemID][2] = AddIfDifferent(Config.Connections[itemID][2],i) + elif ConnY ==2 and ConnX == -1: + if Config.Connections[i][2] == (-1,) : Config.Connections[i][2] = (itemID,) + else : Config.Connections[i][2] = AddIfDifferent(Config.Connections[i][2],itemID) + if Config.Connections[itemID][3] == (-1,) : Config.Connections[itemID][3] = (i,) + else : Config.Connections[itemID][3] = AddIfDifferent(Config.Connections[itemID][3],i) + + def AutoParam (self): + """ + This method is called only if the 'auto' keyword is used inside the meshing algorithm. It is based on the + connection results per object and tries to find the correct parameters for obtaining a final compatible mesh + between the objects already present and the one being created. If this is not possible, the method gives an error + message. + """ + import Alarms, Config, GenFunctions, CompositeBox + MeshPar = [0,0,0,0] # initialize the mesh parameter value to be used to -1 + [(X0,Y0),(DX,DY)] = self.GeoPar + ObjectsInvolved = [] + for i, Conn in enumerate(Config.Connections[-1]): + if not ( Conn == (-1,) ): # Meaning that there is one or more neighbors on this direction + for ObjID in Conn : + ToLook0 = [2,3,0,1][i] + ToLook1 = [3,2,1,0][i] + CommonSide = CompositeBox.FindCommonSide(Config.ListObj[ObjID].DirBoundaries(ToLook1),self.DirBoundaries(ToLook0)) + #print "Common Side is:", CommonSide + ToLook2 = [1,0,3,2][i] + #print "Full Side is:", CompositeBox.IntLen(Config.ListObj[ObjID].DirBoundaries(ToLook1)) + #print "Full Segments on this direction are:", Config.ListObj[ObjID].DirectionalMeshParams[ToLook2] + RealSegments = round(Config.ListObj[ObjID].DirectionalMeshParams[ToLook2]*CompositeBox.IntLen(CommonSide)/CompositeBox.IntLen(Config.ListObj[ObjID].DirBoundaries(ToLook1))) + #print "RealSegments :", RealSegments + + MeshPar[i] = MeshPar[i] + RealSegments + ObjectsInvolved.append(ObjID+1) + self.DirectionalMeshParams = MeshPar + self.MeshPar[0] = GenFunctions.CompatibilityTest(self) + + if self.MeshPar[0] < 0 : + Alarms.Message(4) + if self.MeshPar[0] == -1 : print ("Problem encountered with object(s) no. "+str(ObjectsInvolved)) + elif self.MeshPar[0] == -2 : print ("This object has no neighbours !!!") + + def Boundaries (self): + """ + This method returns the global boundaries of the MacObject. [Xmin,Xmax,Ymin,Ymax] + """ + Xmin = min([self.DirBoundaries(i)[0] for i in [0,1]]) + Xmax = max([self.DirBoundaries(i)[1] for i in [0,1]]) + Ymin = min([self.DirBoundaries(i)[0] for i in [2,3]]) + Ymax = max([self.DirBoundaries(i)[1] for i in [2,3]]) + + return [Xmin,Xmax,Ymin,Ymax] + + def DirBoundaries (self, Direction): + """ + This method returns a single interval giving [Xmin,Xmax] or [Ymin,Ymax] according to the required direction. + This works particularly well for nonorthogonal objects. + Direction : [0,1,2,3] <=> [South, North, West, East] + """ + PtCoor = self.PtCoor + PtCoor.append(self.PtCoor[0]) + if type(Direction) is str : + Dir = { 'South' : lambda : 0, + 'North' : lambda : 1, + 'West' : lambda : 2, + 'East' : lambda : 3,}[Direction]() + else : Dir = int(Direction) + + PtIndex = [0,2,3,1][Dir] + DirIndex = [0,0,1,1][Dir] + + return sorted([PtCoor[PtIndex][DirIndex],PtCoor[PtIndex+1][DirIndex]]) + def DirVectors (self, Direction): + """ + This method returns for a given object, the real vectors which define a given direction + The interest in using this method is for non-orthogonal objects where the sides can be + deviated from the orthogonal basis vectors + """ + if type(Direction) is str : + Dir = { 'South' : lambda : 0, + 'North' : lambda : 1, + 'West' : lambda : 2, + 'East' : lambda : 3,}[Direction]() + else : Dir = int(Direction) + PtCoor = self.PtCoor + PtCoor.append(self.PtCoor[0]) + PtIndex = [0,2,3,1][Dir] + return [PtCoor[PtIndex+1][0]-PtCoor[PtIndex][0],PtCoor[PtIndex+1][1]-PtCoor[PtIndex][1],0.] + + def GetBorder (self, Criterion): + import GenFunctions, Config + + from salome.geom import geomBuilder + geompy = geomBuilder.New( Config.theStudy ) + + if type(Criterion) is str : + Crit = {'South' : lambda : 0, + 'North' : lambda : 1, + 'West' : lambda : 2, + 'East' : lambda : 3,}[Criterion]() + else : Crit = int(Criterion) + + AcceptedObj = [] + if Crit < 4 : + Boundaries = self.Boundaries() + Research = {0 : lambda : [self.DirVectors(0),1,Boundaries[2]], + 1 : lambda : [self.DirVectors(1),1,Boundaries[3]], + 2 : lambda : [self.DirVectors(2),0,Boundaries[0]], + 3 : lambda : [self.DirVectors(3),0,Boundaries[1]], }[Crit]() + + for i,ElemObj in enumerate(self.GeoChildren): + EdgeIDs = geompy.ExtractShapes(ElemObj,6)# List of Edge IDs belonging to ElemObj + for Edge in EdgeIDs: + if GenFunctions.IsParallel(Edge,Research[0]): + if abs( geompy.PointCoordinates(geompy.GetVertexByIndex(Edge,0))[Research[1]] - Research[2] )< 1e-6 or abs( geompy.PointCoordinates(geompy.GetVertexByIndex(Edge,1))[Research[1]] - Research[2] )< 1e-6 : + AcceptedObj.append(Edge) + else : + CenterSrchPar = {'NE' : lambda : [-1., -1.], + 'NW' : lambda : [ 1., -1.], + 'SW' : lambda : [ 1., 1.], + 'SE' : lambda : [-1., 1.], }[self.MeshPar[1]]() + Radius = self.GeoPar[1][1]*float(self.MeshPar[2])/(self.MeshPar[2]+1) + Center = (self.GeoPar[0][0]+CenterSrchPar[0]*self.GeoPar[1][0]/2.,self.GeoPar[0][1]+CenterSrchPar[1]*self.GeoPar[1][1]/2.,0.) + for i,ElemObj in enumerate(self.GeoChildren): + EdgeIDs = geompy.ExtractShapes(ElemObj,6)# List of Edge IDs belonging to ElemObj + for Edge in EdgeIDs: + if GenFunctions.IsOnCircle(Edge,Center,Radius): + AcceptedObj.append(Edge) + return AcceptedObj + + def PrincipleBoxes (self): + """ + This function returns all possible combination rectangular shape objects that can contain at least 3 of the principle vertices + constituting the MacObject. This is indispensible for the Non-ortho types and shall return a number of 24 possible combinations + """ + from itertools import combinations + Boxes = [] + if self.Type == 'NonOrtho': + for combi in combinations(range(4),3): + Xmin = min([self.PtCoor[i][0] for i in combi]) + Xmax = max([self.PtCoor[i][0] for i in combi]) + Ymin = min([self.PtCoor[i][1] for i in combi]) + Ymax = max([self.PtCoor[i][1] for i in combi]) + Boxes.append([(0.5*(Xmin+Xmax),0.5*(Ymin+Ymax)),(Xmax-Xmin,Ymax-Ymin)]) + else : + Boxes = [self.GeoPar] + + return Boxes + + diff --git a/src/Tools/MacMesh/MacMesh/PublishGroups.py b/src/Tools/MacMesh/MacMesh/PublishGroups.py new file mode 100644 index 000000000..f63448899 --- /dev/null +++ b/src/Tools/MacMesh/MacMesh/PublishGroups.py @@ -0,0 +1,250 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 SMESH +import math +import Config + +from salome.geom import geomBuilder +geompy = geomBuilder.New( Config.theStudy ) + +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New( Config.theStudy ) + +########################################################################################################## + +def PublishGroups (): + aFilterManager = smesh.CreateFilterManager() + + # Building geometric and mesh compounds and groups ############################################## + if Config.debug : print "Searching for geometric groups and publishing final compound" + + TempGEOList = [] + TempMESHList = [] + + for MacroObj in Config.ListObj : + TempGEOList += MacroObj.GeoChildren + TempMESHList += MacroObj.Mesh + + FinalCompound = geompy.MakeCompound(TempGEOList) + geompy.addToStudy (FinalCompound,Config.StudyName) + MeshCompound = smesh.Concatenate(TempMESHList, 1, 1, 1e-5) + MeshCompound.SetName(Config.StudyName) + + GroupGEO = [] + for group in Config.Groups : + + # Geometric groups definition + TempGEOList = [] + TempNames = [] + for MacroObj in Config.ListObj : + if group in MacroObj.GroupNames : + Occurences = IndexMultiOcc(MacroObj.GroupNames, group) + for Occ in Occurences : + TempGEOList += MacroObj.GetBorder(Occ) + GroupGEO.append(geompy.MakeCompound(TempGEOList)) + geompy.addToStudyInFather(FinalCompound,GroupGEO[-1],'GR_'+group) + + # Mesh groups definition + Criterion = smesh.GetCriterion(SMESH.EDGE, SMESH.FT_BelongToGeom,'=',GroupGEO[-1],Tolerance=1e-06) + #Criterion = smesh.Filter.Criterion(18,39,0,'GR_'+group,'GR_'+group,39,39,1e-06,smesh.EDGE,7) + MeshCompound.MakeGroupByCriterion(group,Criterion) + + StudyBuilder = Config.theStudy.NewBuilder() + for MeshObj in TempMESHList: + SO = Config.theStudy.FindObjectIOR(Config.theStudy.ConvertObjectToIOR(MeshObj)) + if SO is not None: StudyBuilder.RemoveObjectWithChildren(SO) + + return MeshCompound + + +def IndexMultiOcc (Array,Element) : + """ + This function returns the occurrences indices of Element in Array. + As opposed to Array.index(Element) method, this allows determining + multiple entries rather than just the first one! + """ + Output = [] + try : Array.index(Element) + except ValueError : print "No more occurrences" + else : Output.append(Array.index(Element)) + + if not(Output == [-1]) and len(Array) > 1 : + for index, ArrElem in enumerate(Array[Output[0]+1:]) : + if ArrElem is Element : Output.append(index+Output[0]+1) + + return Output + +def Publish (ObjToPublish): + for i,GeoObj in enumerate(ObjToPublish) : geompy.addToStudy(GeoObj,"Sub_"+str(i)) + +def RevolveMesh(MainMesh,**args): + """ + This function premits to revolute and scale a 2D mesh while transforming the edge + groups into face groups. Moreover, the function automatically creates the face groups + corresponding to the symmetry lower and upper faces + Facultatif arguments are : + - Center [X,Y,Z], origin being the default + - Direction [VX,VY,VZ], x-axis being the default + - AngleDeg or AngleRad : ALPHA, 10 degrees being the default + - Scale : BETA, no scaling being default + """ + ################################################################################ + # Reading input arguments and proceeding to defaults if necessary + ################################################################################ + if 'Center' in args : CenterCoor = [float(Coor) for Coor in args['Center']] + else : + print "\nThe coordinates of the center of revolution were not given\nThe origin is used by default." + CenterCoor = [0.,0.,0.] + + if 'Direction' in args : Direction = [float(Dir) for Dir in args['Direction']] + else : + print "\nThe axis vector of revolution was not given\nThe x-axis is used by default." + Direction = [1.,0.,0.] + + if 'AngleDeg' in args : Angle = float(args['AngleDeg'])*math.pi/180. + elif 'AngleRad' in args : Angle = float(args['AngleRad']) + else : + print "\nThe revolution angle was not given\nAn angle of 10 degrees is used by default." + Angle = 10.*math.pi/180. + + if 'Scale' in args : Scale = float(args['Scale']) + else : Scale = 1. + + + # Creating the lower face group LOFAC + LOFAC = MainMesh.CreateEmptyGroup( SMESH.FACE, 'LOFAC' ) + LOFAC.AddFrom(MainMesh.GetMesh()) + + GR_Names = MainMesh.GetGroupNames() + GRs = MainMesh.GetGroups() + Rev3DMeshGroups = MainMesh.RotationSweepObject2D( MainMesh, SMESH.AxisStruct( CenterCoor[0], CenterCoor[1], CenterCoor[2], Direction[0], Direction[1], Direction[2] ), Angle, 1, 1e-05 ,True) + + # Adding an EDGE suffix to the edge groups (to be deleted eventually by the user...) + for GR in GRs: + CurrentName = GR.GetName() + if CurrentName in GR_Names and not(CurrentName=='LOFAC'): # Meaning that this is an old edge group + GR.SetName(CurrentName+'_EDGE') + + # Removing the _rotated prefix from the rotated FACE groups + for GR in Rev3DMeshGroups: + CurrentName = GR.GetName() + if CurrentName.endswith( "_rotated"): + if CurrentName.startswith( 'LOFAC_' ): + GR.SetName('VOL') + else: + GR.SetName(CurrentName[:-8]) + elif CurrentName == 'LOFAC_top': + GR.SetName('HIFAC') + #Index = [ GR_Names[i] in CurrentName for i in range(0,len(GR_Names)) ].index(True) + #GR.SetName(GR_Names[Index]) + + # Creating the upper face group HIFAC + ALLFAC = MainMesh.CreateEmptyGroup( SMESH.FACE, 'ALLFAC' ) + ALLFAC.AddFrom(MainMesh.GetMesh()) + + #HIFAC = MainMesh.GetMesh().CutListOfGroups( [ ALLFAC ], [LOFAC] + [ MeshGroup for MeshGroup in Rev3DMeshGroups if not(MeshGroup.GetName()=='VOL') ], 'HIFAC' ) + #HIFAC = MainMesh.GetMesh().CutListOfGroups( [ ALLFAC ], [LOFAC] + [ MeshGroup for MeshGroup in Rev3DMeshGroups if ( not(MeshGroup.GetName()=='VOL') and MeshGroup.GetType() == SMESH.FACE )], 'HIFAC' ) + + # Scaling down the mesh to meter units + if not(Scale==1.): + MeshEditor = MainMesh.GetMeshEditor() + MeshEditor.Scale( MainMesh.GetMesh(), SMESH.PointStruct( 0, 0, 0 ) ,[ Scale, Scale, Scale ], 0 ) + + +def ExtrudeMesh(MainMesh,**args): + """ + This function premits to extrude and scale a 2D mesh while transforming the edge + groups into face groups. Moreover, the function automatically creates the face groups + corresponding to the symmetry lower and upper faces + Facultatif arguments are : + - Direction [VX,VY,VZ], z-axis being default + - Distance : D, default is 1 + - NSteps : the object will be extruded by NSteps*Distance, default is Nsteps = 1 + - Scale : BETA, no scaling being default + """ + ################################################################################ + # Reading input arguments and proceeding to defaults if necessary + ################################################################################ + if 'Distance' in args : Distance = float(args['Distance']) + else : + print "\nThe extrusion distance was not given\nA default value of 1 is used." + Distance = 1. + + if 'Direction' in args : Direction = NormalizeVector([float(Dir) for Dir in args['Direction']],Distance) + else : + print "\nThe extrusion vector of revolution was not given\nThe z-axis is used by default." + Direction = NormalizeVector([0.,0.,1.],Distance) + + if 'Scale' in args : Scale = float(args['Scale']) + else : Scale = 1. + + if 'NSteps' in args : NSteps = int(args['NSteps']) + else : NSteps = 1 + + # Creating the lower face group LOFAC + LOFAC = MainMesh.CreateEmptyGroup( SMESH.FACE, 'LOFAC' ) + LOFAC.AddFrom(MainMesh.GetMesh()) + + GR_Names = MainMesh.GetGroupNames() + GRs = MainMesh.GetGroups() + Ext3DMeshGroups = MainMesh.ExtrusionSweepObject2D(MainMesh,SMESH.DirStruct(SMESH.PointStruct(Direction[0],Direction[1],Direction[2])), NSteps, True) + + # Adding an EDGE suffix to the edge groups (to be deleted eventually by the user...) + for GR in GRs: + CurrentName = GR.GetName() + if CurrentName in GR_Names and not(CurrentName=='LOFAC'): # Meaning that this is an old edge group + GR.SetName(CurrentName+'_EDGE') + + # Removing the _extruded suffix from the extruded FACE groups + for GR in Ext3DMeshGroups: + CurrentName = GR.GetName() + if CurrentName.endswith( "_extruded"): + if CurrentName.startswith( 'LOFAC_' ): + GR.SetName('VOL') + else: + GR.SetName(CurrentName[:-9]) + elif CurrentName == 'LOFAC_top': + GR.SetName('HIFAC') + + # Creating the upper face group HIFAC + ALLFAC = MainMesh.CreateEmptyGroup( SMESH.FACE, 'ALLFAC' ) + ALLFAC.AddFrom(MainMesh.GetMesh()) + + #HIFAC = MainMesh.GetMesh().CutListOfGroups( [ ALLFAC ], [LOFAC] + [ MeshGroup for MeshGroup in Ext3DMeshGroups if not(MeshGroup.GetName()=='VOL') ], 'HIFAC' ) + + # Scaling down the mesh to meter units + if not(Scale==1.): + MeshEditor = MainMesh.GetMeshEditor() + MeshEditor.Scale( MainMesh.GetMesh(), SMESH.PointStruct( 0, 0, 0 ) ,[ Scale, Scale, Scale ], 0 ) + + +def NormalizeVector (V,Norm): + """ + This function returns a normalized vector (magnitude = Norm), parallel to the entered one + """ + V = [float(Coor) for Coor in V] + Norm = float(Norm) + MagV = math.sqrt(V[0]*V[0]+V[1]*V[1]+V[2]*V[2]) + return [Coor*Norm/MagV for Coor in V] + diff --git a/src/Tools/MacMesh/MacMesh/SharpAngle.py b/src/Tools/MacMesh/MacMesh/SharpAngle.py new file mode 100644 index 000000000..dd6293029 --- /dev/null +++ b/src/Tools/MacMesh/MacMesh/SharpAngle.py @@ -0,0 +1,249 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE + +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# 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 is an automation of the sharp angle object, with a corner at (X0,Y0), side length : Extension and a fine local meshing : LocalMeshing +# The corner orientation is defined as NE (North-East) , NW (North-West), SE, or SW. The object's "arm" is 8/14 of Extension +# | | 8 6 +# ------- --------- +# ----> | | <---- +# | NW NE | oo +# _____| |_____ + +import sys, math, commands +CWD = commands.getoutput('pwd') +sys.path.append(CWD) + +from MacObject import * +from CompositeBox import * +import Config, GenFunctions + +def SharpAngleOut (X0 , Y0 , DX , DY , DLocal, LocalMeshing , CornerOrientation , NLevels, **args) : + if DLocal == 'auto' : DLocal = float(min(DX,DY)) + + BoxSide = DLocal/(2.**(NLevels+1)) + InternalMeshing = int(math.ceil(BoxSide/(3*LocalMeshing))) + InternalMeshing = InternalMeshing+InternalMeshing%2 # An even number is needed, otherwise the objects would not be compatible once created + if InternalMeshing == 0 : InternalMeshing = 2 # This sets a minimum meshing condition in order to avoid an error. The user is notified of the value considered for the local meshing + print "Possible Local meshing is :", BoxSide/(3*InternalMeshing), "\nThis value is returned by this function for your convenience" + + DirPar = {'NE' : lambda : ['NE', 'NW', 'SE', 'EW', 'NW', 'SN', 'SN', 'NE', 'WE', 'WE', 'SE', 'NS'], + 'NW' : lambda : ['NW', 'NE', 'SW', 'WE', 'NE', 'SN', 'SN', 'NW', 'EW', 'EW', 'SW', 'NS'], + 'SE' : lambda : ['SE', 'SW', 'NE', 'EW', 'SW', 'NS', 'NS', 'SE', 'WE', 'WE', 'NE', 'SN'], + 'SW' : lambda : ['SW', 'SE', 'NW', 'WE', 'SE', 'NS', 'NS', 'SW', 'EW', 'EW', 'NW', 'SN'], }[CornerOrientation]() + + CoefVer = {'NE' : lambda : 1, + 'NW' : lambda : 1, + 'SE' : lambda : -1, + 'SW' : lambda : -1, }[CornerOrientation]() + + CoefHor = {'NE' : lambda : 1, + 'NW' : lambda : -1, + 'SE' : lambda : 1, + 'SW' : lambda : -1, }[CornerOrientation]() + + ToLook = {'NE' : lambda : [0,2,1,3], + 'NW' : lambda : [0,3,1,2], + 'SE' : lambda : [1,2,0,3], + 'SW' : lambda : [1,3,0,2], }[CornerOrientation]() + + if args.__contains__('groups') : + GroupNames = args['groups'] + else : GroupNames = [None, None, None, None, None, None] + + GN00 = GroupArray(ToLook[0],GroupNames[0]) + GN01 = GroupArray(ToLook[1],GroupNames[1]) + + GN1 = GroupArray([ToLook[0],ToLook[1]],[GroupNames[0],GroupNames[5]]) + GN7 = GroupArray([ToLook[0],ToLook[1]],[GroupNames[4],GroupNames[1]]) + + if DY == DLocal : + GN2 = GroupArray([ToLook[1],ToLook[2]],[GroupNames[5],GroupNames[2]]) + GN3 = GroupArray(ToLook[2],GroupNames[2]) + if DX == DLocal: + GN4 = GroupArray([ToLook[2],ToLook[3]],[GroupNames[2],GroupNames[3]]) + GN5 = GroupArray(ToLook[3],GroupNames[3]) + GN6 = GroupArray([ToLook[3],ToLook[0]],[GroupNames[3],GroupNames[4]]) + else : + GN4 = GroupArray(ToLook[2],GroupNames[2]) + GN5 = [None,None,None,None] + GN6 = GroupArray(ToLook[0],GroupNames[4]) + GN21 = GroupArray([ToLook[3],ToLook[0],ToLook[2]],[GroupNames[3],GroupNames[4],GroupNames[2]]) + else : + GN2 = GroupArray(ToLook[1],GroupNames[5]) + GN3 = [None,None,None,None] + if DX == DLocal: + GN4 = GroupArray(ToLook[3],GroupNames[3]) + GN5 = GroupArray(ToLook[3],GroupNames[3]) + GN6 = GroupArray([ToLook[3],ToLook[0]],[GroupNames[3],GroupNames[4]]) + GN22 = GroupArray([ToLook[1],ToLook[2],ToLook[3]],[GroupNames[5],GroupNames[2],GroupNames[3]]) + else : + GN4 = [None,None,None,None] + GN5 = [None,None,None,None] + GN6 = GroupArray(ToLook[0],GroupNames[4]) + GN21 = GroupArray([ToLook[3],ToLook[0]],[GroupNames[3],GroupNames[4]]) + GN22 = GroupArray([ToLook[1],ToLook[2]],[GroupNames[5],GroupNames[2]]) + GN23 = GroupArray([ToLook[2],ToLook[3]],[GroupNames[2],GroupNames[3]]) + + Obj = [] + + Obj.append(MacObject('BoxAng32',[(X0+CoefHor*BoxSide/2,Y0+CoefVer*BoxSide/2),(BoxSide,BoxSide)],[InternalMeshing,DirPar[0]])) + Obj.append(MacObject('BoxAng32',[(X0-CoefHor*BoxSide/2,Y0+CoefVer*BoxSide/2),(BoxSide,BoxSide)],['auto',DirPar[1]], groups = GroupArray(ToLook[0],GroupNames[0]))) + Obj.append(MacObject('BoxAng32',[(X0+CoefHor*BoxSide/2,Y0-CoefVer*BoxSide/2),(BoxSide,BoxSide)],['auto',DirPar[2]], groups = GroupArray(ToLook[1],GroupNames[1]))) + + for N in range (1,NLevels+1): + n = N-1 + if N < NLevels : + Obj.append(MacObject('Box42',[(X0-CoefHor*BoxSide*(2**n)*3/2,Y0+CoefVer*(2**n)*BoxSide/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[3]] , groups = GN00)) + Obj.append(MacObject('BoxAng32',[(X0-CoefHor*(2**n)*BoxSide*3/2,Y0+CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[4]] )) + Obj.append(MacObject('Box42',[(X0-CoefHor*(2**n)*BoxSide/2,Y0+CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[5]] )) + Obj.append(MacObject('Box42',[(X0+CoefHor*(2**n)*BoxSide/2,Y0+CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[6]] )) + Obj.append(MacObject('BoxAng32',[(X0+CoefHor*(2**n)*BoxSide*3/2,Y0+CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[7]] )) + Obj.append(MacObject('Box42',[(X0+CoefHor*(2**n)*BoxSide*3/2,Y0+CoefVer*(2**n)*BoxSide/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[8]] )) + Obj.append(MacObject('Box42',[(X0+CoefHor*(2**n)*BoxSide*3/2,Y0-CoefVer*(2**n)*BoxSide/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[9]] )) + Obj.append(MacObject('BoxAng32',[(X0+CoefHor*(2**n)*BoxSide*3/2,Y0-CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[10]] )) + Obj.append(MacObject('Box42',[(X0+CoefHor*(2**n)*BoxSide/2,Y0-CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[11]] , groups = GN01)) + else : + Obj.append(MacObject('Box42',[(X0-CoefHor*BoxSide*(2**n)*3/2,Y0+CoefVer*(2**n)*BoxSide/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[3]] , groups = GN1)) + Obj.append(MacObject('BoxAng32',[(X0-CoefHor*(2**n)*BoxSide*3/2,Y0+CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[4]] , groups = GN2)) + Obj.append(MacObject('Box42',[(X0-CoefHor*(2**n)*BoxSide/2,Y0+CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[5]] , groups = GN3)) + Obj.append(MacObject('Box42',[(X0+CoefHor*(2**n)*BoxSide/2,Y0+CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[6]] , groups = GN3)) + Obj.append(MacObject('BoxAng32',[(X0+CoefHor*(2**n)*BoxSide*3/2,Y0+CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[7]] , groups = GN4)) + Obj.append(MacObject('Box42',[(X0+CoefHor*(2**n)*BoxSide*3/2,Y0+CoefVer*(2**n)*BoxSide/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[8]] , groups = GN5)) + Obj.append(MacObject('Box42',[(X0+CoefHor*(2**n)*BoxSide*3/2,Y0-CoefVer*(2**n)*BoxSide/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[9]] , groups = GN5)) + Obj.append(MacObject('BoxAng32',[(X0+CoefHor*(2**n)*BoxSide*3/2,Y0-CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[10]], groups = GN6)) + Obj.append(MacObject('Box42',[(X0+CoefHor*(2**n)*BoxSide/2,Y0-CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[11]] , groups = GN7)) + + OuterMeshing = (3/2)*InternalMeshing*2**(NLevels-1) + OuterSegLength = (DLocal/OuterMeshing) + + if DX > DLocal : + dX = DX - DLocal + Obj.append(MacObject('CompBoxF',[(X0+CoefHor*(DX)/2.,Y0),(dX,DLocal)],['auto'], groups = GN21)) + if DY > DLocal : + dY = DY - DLocal + if DX > DLocal : + Obj.append(MacObject('CompBoxF',[(X0+CoefHor*DX/2.,Y0+CoefVer*(DY)/2.),(DX-DLocal,dY)],['auto'], groups = GN23)) + + Obj.append(MacObject('CompBoxF',[(X0,Y0+CoefVer*(DY)/2.),(DLocal,dY)],['auto'], groups = GN22)) + + return Obj + +def SharpAngleIn (X0 , Y0 , DX , DY , DLocal, LocalMeshing , CornerOrientation , NLevels, **args) : + if DLocal == 'auto' : DLocal = float(min(DX,DY)) + + BoxSide = DLocal/(2.**(NLevels)) + InternalMeshing = int(math.ceil(BoxSide/(3*LocalMeshing))) + InternalMeshing = InternalMeshing+InternalMeshing%2 # An even number is needed, otherwise the objects would not be compatible once created + if InternalMeshing == 0 : InternalMeshing = 2 # This sets a minimum meshing condition in order to avoid an error. The user is notified of the value considered for the local meshing + print "Possible Local meshing is :", BoxSide/(3*InternalMeshing), "\nThis value is returned by this function for your convenience..." + + DirPar = {'NE' : lambda : ['NE', 'SN', 'NE', 'WE'], + 'NW' : lambda : ['NW', 'SN', 'NW', 'EW'], + 'SE' : lambda : ['SE', 'NS', 'SE', 'WE'], + 'SW' : lambda : ['SW', 'NS', 'SW', 'EW'], }[CornerOrientation]() + + CoefVer = {'NE' : lambda : 1, + 'NW' : lambda : 1, + 'SE' : lambda : -1, + 'SW' : lambda : -1, }[CornerOrientation]() + + CoefHor = {'NE' : lambda : 1, + 'NW' : lambda : -1, + 'SE' : lambda : 1, + 'SW' : lambda : -1, }[CornerOrientation]() + + ToLook = {'NE' : lambda : [0,2,1,3], + 'NW' : lambda : [0,3,1,2], + 'SE' : lambda : [1,2,0,3], + 'SW' : lambda : [1,3,0,2], }[CornerOrientation]() + + if args.__contains__('groups') : + GroupNames = args['groups'] + else : GroupNames = [None, None, None, None] + + GN01 = GroupArray([ToLook[0],ToLook[1]],[GroupNames[ToLook[0]],GroupNames[ToLook[1]]]) + GN02 = GroupArray(ToLook[1],GroupNames[ToLook[1]]) + GN03 = [None, None, None, None] + GN04 = GroupArray(ToLook[0],GroupNames[ToLook[0]]) + + if DY == DLocal : + GN05 = GroupArray([ToLook[1],ToLook[2]],[GroupNames[ToLook[1]],GroupNames[ToLook[2]]]) + GN08 = GroupArray([ToLook[0],ToLook[2],ToLook[3]],[GroupNames[ToLook[0]],GroupNames[ToLook[2]],GroupNames[ToLook[3]]]) + if DX == DLocal: + GN06 = GroupArray([ToLook[2],ToLook[3]],[GroupNames[ToLook[2]],GroupNames[ToLook[3]]]) + GN07 = GroupArray([ToLook[0],ToLook[3]],[GroupNames[ToLook[0]],GroupNames[ToLook[3]]]) + else : + GN06 = GroupArray(ToLook[2],GroupNames[ToLook[2]]) + GN07 = GroupArray(ToLook[0],GroupNames[ToLook[0]]) + else : + GN05 = GroupArray(ToLook[1],GroupNames[ToLook[1]]) + if DX == DLocal : + GN06 = GroupArray(ToLook[3],GroupNames[ToLook[3]]) + GN07 = GroupArray([ToLook[0],ToLook[3]],[GroupNames[ToLook[0]],GroupNames[ToLook[3]]]) + GN10 = GroupArray([ToLook[1],ToLook[2],ToLook[3]],[GroupNames[ToLook[1]],GroupNames[ToLook[2]],GroupNames[ToLook[3]]]) + else : + GN06 = [None, None, None, None] + GN07 = GroupArray(ToLook[0],GroupNames[ToLook[0]]) + GN08 = GroupArray([ToLook[0],ToLook[3]],[GroupNames[ToLook[0]],GroupNames[ToLook[3]]]) + GN09 = GroupArray([ToLook[2],ToLook[3]],[GroupNames[ToLook[2]],GroupNames[ToLook[3]]]) + GN10 = GroupArray([ToLook[1],ToLook[2]],[GroupNames[ToLook[1]],GroupNames[ToLook[2]]]) + + Obj = [] + + Obj.append(MacObject('BoxAng32',[(X0+CoefHor*BoxSide/2,Y0+CoefVer*BoxSide/2),(BoxSide,BoxSide)],[InternalMeshing,DirPar[0]],groups = GN01)) + + for N in range (1,NLevels+1): + n = N-1 + if N < NLevels : + Obj.append(MacObject('Box42',[(X0+CoefHor*(2**n)*BoxSide/2,Y0+CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[1]],groups = GN02)) + Obj.append(MacObject('BoxAng32',[(X0+CoefHor*(2**n)*BoxSide*3/2,Y0+CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[2]],groups = GN03)) + Obj.append(MacObject('Box42',[(X0+CoefHor*(2**n)*BoxSide*3/2,Y0+CoefVer*(2**n)*BoxSide/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[3]],groups = GN04)) + else : + Obj.append(MacObject('Box42',[(X0+CoefHor*(2**n)*BoxSide/2,Y0+CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[1]],groups = GN05)) + Obj.append(MacObject('BoxAng32',[(X0+CoefHor*(2**n)*BoxSide*3/2,Y0+CoefVer*(2**n)*BoxSide*3/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[2]],groups = GN06)) + Obj.append(MacObject('Box42',[(X0+CoefHor*(2**n)*BoxSide*3/2,Y0+CoefVer*(2**n)*BoxSide/2),((2**n)*BoxSide,(2**n)*BoxSide)],['auto',DirPar[3]],groups = GN07)) + + OuterMeshing = (3/2)*InternalMeshing*2**(NLevels-1) + OuterSegLength = (DLocal/OuterMeshing) + + if DX > DLocal : + dX = DX - DLocal + Obj = Obj + CompositeBox(X0+CoefHor*(DLocal+dX/2.),Y0+CoefVer*(DLocal)/2.,dX,DLocal, groups = GN08) + if DY > DLocal : + dY = DY - DLocal + + if DX > DLocal : + Obj = Obj + CompositeBox(X0+CoefHor*(DLocal+(DX-DLocal)/2.),Y0+CoefVer*(DLocal+dY/2.),DX-DLocal,dY, groups = GN09) + + Obj = Obj + CompositeBox(X0+CoefHor*DLocal/2,Y0+CoefVer*(DLocal+dY/2.),DLocal,dY,groups = GN10) + + return Obj + +def GroupArray(indices, GroupNames) : + if type(indices) is int : + indices = [indices] + GroupNames = [GroupNames] + Output = [None,None,None,None] + for i, ind in enumerate(indices) : + Output[ind] = GroupNames[i] + return Output diff --git a/src/Tools/MeshCut/AUTHORS b/src/Tools/MeshCut/AUTHORS index c02afecfc..5aed1ff41 100644 --- a/src/Tools/MeshCut/AUTHORS +++ b/src/Tools/MeshCut/AUTHORS @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/CMakeLists.txt b/src/Tools/MeshCut/CMakeLists.txt index 4bd505ef1..9eb6b11a7 100644 --- a/src/Tools/MeshCut/CMakeLists.txt +++ b/src/Tools/MeshCut/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Carre.cxx b/src/Tools/MeshCut/MeshCut_Carre.cxx index 5128f0471..8c5f88e67 100644 --- a/src/Tools/MeshCut/MeshCut_Carre.cxx +++ b/src/Tools/MeshCut/MeshCut_Carre.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Carre.hxx b/src/Tools/MeshCut/MeshCut_Carre.hxx index 3bceb5a07..ceb4bc118 100644 --- a/src/Tools/MeshCut/MeshCut_Carre.hxx +++ b/src/Tools/MeshCut/MeshCut_Carre.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Cas.cxx b/src/Tools/MeshCut/MeshCut_Cas.cxx index 1b4e9c5d2..9b43f468a 100644 --- a/src/Tools/MeshCut/MeshCut_Cas.cxx +++ b/src/Tools/MeshCut/MeshCut_Cas.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Cas.hxx b/src/Tools/MeshCut/MeshCut_Cas.hxx index d3700b582..be2d926a1 100644 --- a/src/Tools/MeshCut/MeshCut_Cas.hxx +++ b/src/Tools/MeshCut/MeshCut_Cas.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Cube.cxx b/src/Tools/MeshCut/MeshCut_Cube.cxx index 842cf2265..02572a17a 100644 --- a/src/Tools/MeshCut/MeshCut_Cube.cxx +++ b/src/Tools/MeshCut/MeshCut_Cube.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Cube.hxx b/src/Tools/MeshCut/MeshCut_Cube.hxx index a837c726e..58e36a4f7 100644 --- a/src/Tools/MeshCut/MeshCut_Cube.hxx +++ b/src/Tools/MeshCut/MeshCut_Cube.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_DC.cxx b/src/Tools/MeshCut/MeshCut_DC.cxx index 44bb0c202..e702abbe7 100644 --- a/src/Tools/MeshCut/MeshCut_DC.cxx +++ b/src/Tools/MeshCut/MeshCut_DC.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Fonctions.cxx b/src/Tools/MeshCut/MeshCut_Fonctions.cxx index 716ae846e..7fb1fc1ef 100644 --- a/src/Tools/MeshCut/MeshCut_Fonctions.cxx +++ b/src/Tools/MeshCut/MeshCut_Fonctions.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Fonctions.hxx b/src/Tools/MeshCut/MeshCut_Fonctions.hxx index 70f02cc81..ca589a035 100644 --- a/src/Tools/MeshCut/MeshCut_Fonctions.hxx +++ b/src/Tools/MeshCut/MeshCut_Fonctions.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Globals.hxx b/src/Tools/MeshCut/MeshCut_Globals.hxx index f0f36ca78..6997cf42b 100644 --- a/src/Tools/MeshCut/MeshCut_Globals.hxx +++ b/src/Tools/MeshCut/MeshCut_Globals.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Maillage.cxx b/src/Tools/MeshCut/MeshCut_Maillage.cxx index 01e9aa74b..38ec6cb7a 100644 --- a/src/Tools/MeshCut/MeshCut_Maillage.cxx +++ b/src/Tools/MeshCut/MeshCut_Maillage.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Maillage.hxx b/src/Tools/MeshCut/MeshCut_Maillage.hxx index e39e1a4e3..778728b6f 100644 --- a/src/Tools/MeshCut/MeshCut_Maillage.hxx +++ b/src/Tools/MeshCut/MeshCut_Maillage.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Utils.cxx b/src/Tools/MeshCut/MeshCut_Utils.cxx index 039670750..7670a2606 100644 --- a/src/Tools/MeshCut/MeshCut_Utils.cxx +++ b/src/Tools/MeshCut/MeshCut_Utils.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/MeshCut_Utils.hxx b/src/Tools/MeshCut/MeshCut_Utils.hxx index dbb0967ab..63658e5a8 100644 --- a/src/Tools/MeshCut/MeshCut_Utils.hxx +++ b/src/Tools/MeshCut/MeshCut_Utils.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 EDF R&D +// Copyright (C) 2006-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/MeshCut/meshcut_plugin.py b/src/Tools/MeshCut/meshcut_plugin.py index 81a43d383..997f72e28 100644 --- a/src/Tools/MeshCut/meshcut_plugin.py +++ b/src/Tools/MeshCut/meshcut_plugin.py @@ -1,9 +1,9 @@ -# Copyright (C) 2006-2013 EDF R&D +# Copyright (C) 2006-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/Base/CMakeLists.txt b/src/Tools/Verima/Base/CMakeLists.txt index ce7f0ae25..cf308ee0c 100644 --- a/src/Tools/Verima/Base/CMakeLists.txt +++ b/src/Tools/Verima/Base/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/Base/__init__.py b/src/Tools/Verima/Base/__init__.py index 07e6537b0..e191ff2ca 100644 --- a/src/Tools/Verima/Base/__init__.py +++ b/src/Tools/Verima/Base/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2013 EDF R&D +# Copyright (C) 2007-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/CMakeLists.txt b/src/Tools/Verima/CMakeLists.txt index 269d6d9ae..a71fe2997 100644 --- a/src/Tools/Verima/CMakeLists.txt +++ b/src/Tools/Verima/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/CreeDocuments/CMakeLists.txt b/src/Tools/Verima/CreeDocuments/CMakeLists.txt index 838796ed2..e9c294b25 100644 --- a/src/Tools/Verima/CreeDocuments/CMakeLists.txt +++ b/src/Tools/Verima/CreeDocuments/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/CreeDocuments/__init__.py b/src/Tools/Verima/CreeDocuments/__init__.py index 2f96268b2..7cb14af7c 100644 --- a/src/Tools/Verima/CreeDocuments/__init__.py +++ b/src/Tools/Verima/CreeDocuments/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2013 EDF R&D +# Copyright (C) 2007-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/CreeDocuments/templatesHtml/CMakeLists.txt b/src/Tools/Verima/CreeDocuments/templatesHtml/CMakeLists.txt index 1b6bd9075..3a2437b99 100644 --- a/src/Tools/Verima/CreeDocuments/templatesHtml/CMakeLists.txt +++ b/src/Tools/Verima/CreeDocuments/templatesHtml/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/Doc/CMakeLists.txt b/src/Tools/Verima/Doc/CMakeLists.txt index c4ca90b9b..0dfa0613d 100755 --- a/src/Tools/Verima/Doc/CMakeLists.txt +++ b/src/Tools/Verima/Doc/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/Doc/conf.py b/src/Tools/Verima/Doc/conf.py index b5341647f..eb5c48184 100644 --- a/src/Tools/Verima/Doc/conf.py +++ b/src/Tools/Verima/Doc/conf.py @@ -36,7 +36,7 @@ master_doc = 'index' # General substitutions. project = 'Verima Plug-in' -copyright = '2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE' +copyright = '2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. diff --git a/src/Tools/Verima/Doc/conf.py.in b/src/Tools/Verima/Doc/conf.py.in index 54d8271d4..026e2d8ed 100644 --- a/src/Tools/Verima/Doc/conf.py.in +++ b/src/Tools/Verima/Doc/conf.py.in @@ -36,7 +36,7 @@ master_doc = 'index' # General substitutions. project = 'Verima Plug-in' -copyright = '2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE' +copyright = '2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. diff --git a/src/Tools/Verima/Doc/makefile b/src/Tools/Verima/Doc/makefile index 74903ed5a..2cadddafd 100644 --- a/src/Tools/Verima/Doc/makefile +++ b/src/Tools/Verima/Doc/makefile @@ -1,21 +1,20 @@ -# Copyright (C) 2011 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # -# 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, or (at your option) any later version. # -# 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 # srcdir="." diff --git a/src/Tools/Verima/Gui/CMakeLists.txt b/src/Tools/Verima/Gui/CMakeLists.txt index 4c170d8d6..e905750d6 100644 --- a/src/Tools/Verima/Gui/CMakeLists.txt +++ b/src/Tools/Verima/Gui/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/Gui/__init__.py b/src/Tools/Verima/Gui/__init__.py index b6ea681fb..38b413ea3 100644 --- a/src/Tools/Verima/Gui/__init__.py +++ b/src/Tools/Verima/Gui/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2013 EDF R&D +# Copyright (C) 2007-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/Scripts/CMakeLists.txt b/src/Tools/Verima/Scripts/CMakeLists.txt index 30c77d90f..0ccd41e6f 100644 --- a/src/Tools/Verima/Scripts/CMakeLists.txt +++ b/src/Tools/Verima/Scripts/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/Scripts/a.py b/src/Tools/Verima/Scripts/a.py index 56ff1da42..d38d82790 100644 --- a/src/Tools/Verima/Scripts/a.py +++ b/src/Tools/Verima/Scripts/a.py @@ -1,7 +1,7 @@ # -*- coding: iso-8859-1 -*- ### -### Copyright EDF R&D 2012 +### Copyright EDF R&D 2012-2014 ### ### Gérald NICOLAS ### (33/0)1.47.65.56.94 diff --git a/src/Tools/Verima/Scripts/excavation.py b/src/Tools/Verima/Scripts/excavation.py index 3deee6f3a..50da51011 100644 --- a/src/Tools/Verima/Scripts/excavation.py +++ b/src/Tools/Verima/Scripts/excavation.py @@ -1,7 +1,7 @@ # -*- coding: iso-8859-1 -*- """ Maillage du tunnel -Copyright EDF R&D 2012, 2013 +Copyright EDF R&D 2012-2014 Gérald NICOLAS (+33/0)1.47.65.56.94 diff --git a/src/Tools/Verima/Scripts/excavation_6.6.py b/src/Tools/Verima/Scripts/excavation_6.6.py index 85fa6aa22..3acbf933e 100644 --- a/src/Tools/Verima/Scripts/excavation_6.6.py +++ b/src/Tools/Verima/Scripts/excavation_6.6.py @@ -1,7 +1,7 @@ # -*- coding: iso-8859-1 -*- ### -### Copyright EDF R&D 2012 +### Copyright EDF R&D 2012-2014 ### ### Gérald NICOLAS ### (33/0)1.47.65.56.94 diff --git a/src/Tools/Verima/Scripts/excavation_7.2.0.py b/src/Tools/Verima/Scripts/excavation_7.2.0.py index 3deee6f3a..50da51011 100644 --- a/src/Tools/Verima/Scripts/excavation_7.2.0.py +++ b/src/Tools/Verima/Scripts/excavation_7.2.0.py @@ -1,7 +1,7 @@ # -*- coding: iso-8859-1 -*- """ Maillage du tunnel -Copyright EDF R&D 2012, 2013 +Copyright EDF R&D 2012-2014 Gérald NICOLAS (+33/0)1.47.65.56.94 diff --git a/src/Tools/Verima/Stats/CMakeLists.txt b/src/Tools/Verima/Stats/CMakeLists.txt index 8a5d7e3f9..f53e313ee 100644 --- a/src/Tools/Verima/Stats/CMakeLists.txt +++ b/src/Tools/Verima/Stats/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/Stats/__init__.py b/src/Tools/Verima/Stats/__init__.py index 2f96268b2..7cb14af7c 100644 --- a/src/Tools/Verima/Stats/__init__.py +++ b/src/Tools/Verima/Stats/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2013 EDF R&D +# Copyright (C) 2007-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/Verima/__init__.py b/src/Tools/Verima/__init__.py index 88f6aa847..fd66d218a 100644 --- a/src/Tools/Verima/__init__.py +++ b/src/Tools/Verima/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2013 EDF R&D +# Copyright (C) 2007-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/YamsPlug/CMakeLists.txt b/src/Tools/YamsPlug/CMakeLists.txt index 7efe46b58..aaa6bd182 100644 --- a/src/Tools/YamsPlug/CMakeLists.txt +++ b/src/Tools/YamsPlug/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/YamsPlug/doc/CMakeLists.txt b/src/Tools/YamsPlug/doc/CMakeLists.txt index dffc3f9a3..b62b18713 100755 --- a/src/Tools/YamsPlug/doc/CMakeLists.txt +++ b/src/Tools/YamsPlug/doc/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/YamsPlug/doc/conf.py.in b/src/Tools/YamsPlug/doc/conf.py.in index dedf61b45..a49c3ab61 100644 --- a/src/Tools/YamsPlug/doc/conf.py.in +++ b/src/Tools/YamsPlug/doc/conf.py.in @@ -36,7 +36,7 @@ master_doc = 'index' # General substitutions. project = 'MeshGems-SurfOpt Plug-in' -copyright = '2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE' +copyright = '2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. diff --git a/src/Tools/YamsPlug/monViewText.py b/src/Tools/YamsPlug/monViewText.py index 5402841b8..d3061e688 100644 --- a/src/Tools/YamsPlug/monViewText.py +++ b/src/Tools/YamsPlug/monViewText.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2013 EDF R&D +# Copyright (C) 2007-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/YamsPlug/monYamsPlugDialog.py b/src/Tools/YamsPlug/monYamsPlugDialog.py index 076030b59..7f43838c4 100644 --- a/src/Tools/YamsPlug/monYamsPlugDialog.py +++ b/src/Tools/YamsPlug/monYamsPlugDialog.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2013 EDF R&D +# Copyright (C) 2007-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/YamsPlug/yamsplug_plugin.py b/src/Tools/YamsPlug/yamsplug_plugin.py index f61ed050f..94a4cd9fe 100644 --- a/src/Tools/YamsPlug/yamsplug_plugin.py +++ b/src/Tools/YamsPlug/yamsplug_plugin.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2006-2013 EDF R&D +# Copyright (C) 2006-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/ZCracksPlug/CMakeLists.txt b/src/Tools/ZCracksPlug/CMakeLists.txt new file mode 100644 index 000000000..07cbf93b1 --- /dev/null +++ b/src/Tools/ZCracksPlug/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright (C) 2012-2013 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 +# + + + +# --- scripts --- + +# scripts / static +SET(plugin_SCRIPTS + zcracks_plugin.py +) + + +# --- rules --- + +SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}) + diff --git a/src/Tools/ZCracksPlug/zcracks_plugin.py b/src/Tools/ZCracksPlug/zcracks_plugin.py new file mode 100644 index 000000000..85ced69cf --- /dev/null +++ b/src/Tools/ZCracksPlug/zcracks_plugin.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2006-2013 EDF R&D +# +# 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 SalomePyQt +sgPyQt = SalomePyQt.SalomePyQt() +import eficasSalome + +class EficasForZcracks(eficasSalome.MyEficas): + """ + """ + def __init__(self, fichier = None, version = None): + eficasSalome.MyEficas.__init__(self, sgPyQt.getDesktop(), + "ZCRACKS", + fichier, version = version) + #sgPyQt.createView(custom_appli.widgetname, self) + + +def ZcracksLct(context): + + window=EficasForZcracks() + window.show() diff --git a/src/Tools/blocFissure/CMakeLists.txt b/src/Tools/blocFissure/CMakeLists.txt new file mode 100644 index 000000000..462017460 --- /dev/null +++ b/src/Tools/blocFissure/CMakeLists.txt @@ -0,0 +1,40 @@ +# Copyright (C) 2012-2014 EDF R&D +# +# 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, or (at your option) any later version. +# +# 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 +# + +ADD_SUBDIRECTORY(CasTests) +ADD_SUBDIRECTORY(gmu) +ADD_SUBDIRECTORY(materielCasTests) + +IF(SALOME_BUILD_GUI) + ADD_SUBDIRECTORY(ihm) +ENDIF(SALOME_BUILD_GUI) + +# --- scripts --- + +# scripts / static +SET(plugin_SCRIPTS + __init__.py + casStandard.py + exemple.py + exemple2.py +) + +# --- rules --- + +SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure) diff --git a/src/Tools/blocFissure/CasTests/CMakeLists.txt b/src/Tools/blocFissure/CasTests/CMakeLists.txt new file mode 100644 index 000000000..3cf970add --- /dev/null +++ b/src/Tools/blocFissure/CasTests/CMakeLists.txt @@ -0,0 +1,55 @@ +# Copyright (C) 2012-2014 EDF R&D +# +# 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, or (at your option) any later version. +# +# 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 +# + +# --- scripts --- + +# scripts / static +SET(plugin_SCRIPTS + __init__.py + cubeAngle2.py + cubeAngle.py + cylindre_2.py + cylindre.py + disquePerce.py + ellipse_1.py + ellipse_2.py + eprouvetteCourbe.py + eprouvetteDroite_2.py + eprouvetteDroite.py + execution_Cas.py + faceGauche_2.py + faceGauche.py + fissureCoude_10.py + fissureCoude_1.py + fissureCoude_2.py + fissureCoude_3.py + fissure_Coude_4.py + fissureCoude_4.py + fissureCoude_5.py + fissureCoude_6.py + fissureCoude_7.py + fissureCoude_8.py + fissureCoude_9.py + fissure_Coude.py + vis_1.py +) + +# --- rules --- + +SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/CasTests) diff --git a/src/Tools/blocFissure/CasTests/__init__.py b/src/Tools/blocFissure/CasTests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/Tools/blocFissure/CasTests/cubeAngle.py b/src/Tools/blocFissure/CasTests/cubeAngle.py new file mode 100644 index 000000000..579d24140 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/cubeAngle.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from blocFissure.gmu.fissureGenerique import fissureGenerique + +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale + +O, OX, OY, OZ = triedreBase() + +class cubeAngle(fissureGenerique): + """ + problème de fissure plane coupant 2 faces (angle), débouches normaux, objet plan + """ + + nomProbleme = "cubeAngle" + + # --------------------------------------------------------------------------- + def genereMaillageSain(self, geometriesSaines, meshParams): + logging.info("genereMaillageSain %s", self.nomCas) + + ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med')) + smesh.SetName(objetSain.GetMesh(), 'objetSain') + + return [objetSain, True] # True : maillage hexa + + # --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour méthode insereFissureGenerale + lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage) + rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure + """ + logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(lgInfluence = 20, + rayonPipe = 10) + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + + lgInfluence = shapeFissureParams['lgInfluence'] + + shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"), "BREP") + fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(fondFiss, [4]) + geompy.addToStudy( shellFiss, 'shellFiss' ) + geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10) + + centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 8, + areteFaceFissure = 10) + + # --------------------------------------------------------------------------- + def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams): + elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams) + return elementsDefaut + + # --------------------------------------------------------------------------- + def genereMaillageFissure(self, geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step): + maillageFissure = insereFissureGenerale(maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step) + return maillageFissure + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 204, + Entity_Quad_Triangle = 336, + Entity_Quad_Edge = 278, + Entity_Quad_Penta = 96, + Entity_Quad_Hexa = 3651, + Entity_Node = 20490, + Entity_Quad_Tetra = 1877, + Entity_Quad_Quadrangle = 1702) + diff --git a/src/Tools/blocFissure/CasTests/cubeAngle2.py b/src/Tools/blocFissure/CasTests/cubeAngle2.py new file mode 100644 index 000000000..a33fc2acc --- /dev/null +++ b/src/Tools/blocFissure/CasTests/cubeAngle2.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +from cubeAngle import cubeAngle + +class cubeAngle2(cubeAngle): + """ + problème de fissure plane coupant 2 faces (angle), débouches normaux, objet plan + detection d'un probleme de tolerance sur les edges de jonction pipe et face fissure externe + """ + + nomProbleme = "cubeAngle2" + + # --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour méthode insereFissureGenerale + lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage) + rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure + """ + self.shapeFissureParams = dict(lgInfluence = 20, + rayonPipe = 5) + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 32, + areteFaceFissure = 5) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 748, + Entity_Quad_Triangle = 1228, + Entity_Quad_Edge = 351, + Entity_Quad_Penta = 640, + Entity_Quad_Hexa = 5827, + Entity_Node = 42865, + Entity_Quad_Tetra = 9216, + Entity_Quad_Quadrangle = 2518) + diff --git a/src/Tools/blocFissure/CasTests/cylindre.py b/src/Tools/blocFissure/CasTests/cylindre.py new file mode 100644 index 000000000..87657a1e6 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/cylindre.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from blocFissure.gmu.fissureGenerique import fissureGenerique + +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale + +O, OX, OY, OZ = triedreBase() + +class cylindre(fissureGenerique): + """ + problème de fissure plane sur cylindre, grand fond de fissure en arc de cercle + """ + + nomProbleme = "cylindre" + + # --------------------------------------------------------------------------- + def genereMaillageSain(self, geometriesSaines, meshParams): + """ + génère le maillage de l'objet sain, par chargement d'un fichier med + ici, les paramètres de géométrie et de maillage ne sont pas utiles + """ + logging.info("genereMaillageSain %s", self.nomCas) + + ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/CylindreSain.med")) + smesh.SetName(objetSain.GetMesh(), 'objetSain') + + return [objetSain, True] # True : maillage hexa + + # --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour méthode insereFissureGenerale + lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage) + rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure + """ + logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(lgInfluence = 20, + rayonPipe = 5) + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + + lgInfluence = shapeFissureParams['lgInfluence'] + + shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre2.brep"), "BREP") + fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(fondFiss, [7]) + geompy.addToStudy( shellFiss, 'shellFiss' ) + geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,15) + + centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 8, + areteFaceFissure = 20) + + # --------------------------------------------------------------------------- + def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams): + elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams) + return elementsDefaut + + # --------------------------------------------------------------------------- + def genereMaillageFissure(self, geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step): + maillageFissure = insereFissureGenerale(maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step) + return maillageFissure + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 1270, + Entity_Quad_Triangle = 1260, + Entity_Quad_Edge = 758, + Entity_Quad_Penta = 496, + Entity_Quad_Hexa = 18814, + Entity_Node = 113313, + Entity_Quad_Tetra = 20469, + Entity_Quad_Quadrangle = 7280) + diff --git a/src/Tools/blocFissure/CasTests/cylindre_2.py b/src/Tools/blocFissure/CasTests/cylindre_2.py new file mode 100644 index 000000000..e2023fe67 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/cylindre_2.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +import logging + +from cylindre import cylindre + +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale + +O, OX, OY, OZ = triedreBase() + +class cylindre_2(cylindre): + """ + problème de fissure plane sur cylindre hexa, fond de fissure complexe : polyline + """ + nomProbleme = "cylindre2" + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + + lgInfluence = shapeFissureParams['lgInfluence'] + + shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre.brep"), "BREP") + fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(fondFiss, [3]) + geompy.addToStudy( shellFiss, 'shellFiss' ) + geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,15) + + centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 1334, + Entity_Quad_Triangle = 1432, + Entity_Quad_Edge = 785, + Entity_Quad_Penta = 560, + Entity_Quad_Hexa = 19070, + Entity_Node = 114290, + Entity_Quad_Tetra = 19978, + Entity_Quad_Quadrangle = 7424) + diff --git a/src/Tools/blocFissure/CasTests/disquePerce.py b/src/Tools/blocFissure/CasTests/disquePerce.py new file mode 100644 index 000000000..5c4b63f3d --- /dev/null +++ b/src/Tools/blocFissure/CasTests/disquePerce.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu + +dicoParams = dict(nomCas = 'disque', + maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/disque.med'), + brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/ellipse_disque.brep"), + edgeFissIds = [4], + lgInfluence = 10, + meshBrep = (0.5,2.5), + rayonPipe = 1.0, + lenSegPipe = 1.5, + nbSegRad = 6, + nbSegCercle = 16, + areteFaceFissure = 2.5) + + # --------------------------------------------------------------------------- + +referencesMaillageFissure = dict(Entity_Quad_Pyramid = 610, + Entity_Quad_Triangle = 1284, + Entity_Quad_Edge = 393, + Entity_Quad_Penta = 592, + Entity_Quad_Hexa = 6952, + Entity_Node = 51119, + Entity_Quad_Tetra = 11672, + Entity_Quad_Quadrangle = 3000) + diff --git a/src/Tools/blocFissure/CasTests/ellipse_1.py b/src/Tools/blocFissure/CasTests/ellipse_1.py new file mode 100644 index 000000000..00eef0df6 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/ellipse_1.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from blocFissure.gmu.fissureGenerique import fissureGenerique + +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale + +O, OX, OY, OZ = triedreBase() + +class ellipse_1(fissureGenerique): + """ + problème de fissure non plane, débouchante non normale + """ + + nomProbleme = "ellipse1" + +# # --------------------------------------------------------------------------- +# def genereGeometrieSaine(self, geomParams): +# logging.info("genereGeometrieSaine %s", self.nomCas) +# box = geompy.MakeBox(0, -500, 0, 400, 500, 800, "boiteSaine") +# return [box] + + # --------------------------------------------------------------------------- + def genereMaillageSain(self, geometriesSaines, meshParams): + logging.info("genereMaillageSain %s", self.nomCas) + + ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/boiteSaine.med")) + smesh.SetName(objetSain.GetMesh(), 'objetSain') + + return [objetSain, True] # True : maillage hexa + + # --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour méthode insereFissureGenerale + lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage) + rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure + convexe : optionnel, True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne + pointIn_x : optionnel, coordonnée x d'un point dans le solide sain (pour orienter la face) + """ + logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(lgInfluence = 50, + rayonPipe = 20) + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + + lgInfluence = shapeFissureParams['lgInfluence'] + + shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/ellipse1.brep"), "BREP") + fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(fondFiss, [4]) + geompy.addToStudy( shellFiss, 'shellFiss' ) + geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25) + + centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 8, + areteFaceFissure = 1000) + + # --------------------------------------------------------------------------- + def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams): + elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams) + return elementsDefaut + + # --------------------------------------------------------------------------- + def genereMaillageFissure(self, geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step): + maillageFissure = insereFissureGenerale(maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step) + return maillageFissure + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 175, + Entity_Quad_Triangle = 298, + Entity_Quad_Edge = 248, + Entity_Quad_Penta = 96, + Entity_Quad_Hexa = 3699, + Entity_Node = 20741, + Entity_Quad_Tetra = 1979, + Entity_Quad_Quadrangle = 1694) + diff --git a/src/Tools/blocFissure/CasTests/ellipse_2.py b/src/Tools/blocFissure/CasTests/ellipse_2.py new file mode 100644 index 000000000..15e0c1b60 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/ellipse_2.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from ellipse_1 import ellipse_1 + +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale + +O, OX, OY, OZ = triedreBase() + +class ellipse_2(ellipse_1): + """ + problème de fissure non plane, débouchante non normale + """ + + nomProbleme = "ellipse2" + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + + lgInfluence = shapeFissureParams['lgInfluence'] + + shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/ellipse1_pb.brep"), "BREP") + fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(fondFiss, [4]) + geompy.addToStudy( shellFiss, 'shellFiss' ) + geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25) + + centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 159, + Entity_Quad_Triangle = 438, + Entity_Quad_Edge = 249, + Entity_Quad_Penta = 80, + Entity_Quad_Hexa = 3635, + Entity_Node = 20519, + Entity_Quad_Tetra = 1973, + Entity_Quad_Quadrangle = 1658) diff --git a/src/Tools/blocFissure/CasTests/eprouvetteCourbe.py b/src/Tools/blocFissure/CasTests/eprouvetteCourbe.py new file mode 100644 index 000000000..66f9774bf --- /dev/null +++ b/src/Tools/blocFissure/CasTests/eprouvetteCourbe.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from blocFissure.gmu.fissureGenerique import fissureGenerique + +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale + +O, OX, OY, OZ = triedreBase() + +class eprouvetteCourbe(fissureGenerique): + """ + problème de fissure plane coupant 3 faces (éprouvette), faces au débouché non planes, incidence presque normale + """ + + nomProbleme = "eprouvetteCourbe" + + # --------------------------------------------------------------------------- + def genereMaillageSain(self, geometriesSaines, meshParams): + logging.info("genereMaillageSain %s", self.nomCas) + + ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbe.med")) + smesh.SetName(objetSain.GetMesh(), 'objetSain') + + return [objetSain, True] # True : maillage hexa + + # --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour méthode insereFissureGenerale + lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage) + rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure + convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne + pointIn_x : optionnel coordonnée x d'un point dans le solide sain (pour orienter la face) + """ + logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(lgInfluence = 30, + rayonPipe = 10) + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + + lgInfluence = shapeFissureParams['lgInfluence'] + + shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"), "BREP") + fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(fondFiss, [8]) + geompy.addToStudy( shellFiss, 'shellFiss' ) + geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10) + + centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 8, + areteFaceFissure = 15) + + # --------------------------------------------------------------------------- + def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams): + elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams) + return elementsDefaut + + # --------------------------------------------------------------------------- + def genereMaillageFissure(self, geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step): + maillageFissure = insereFissureGenerale(maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step) + return maillageFissure + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 618, + Entity_Quad_Triangle = 1224, + Entity_Quad_Edge = 578, + Entity_Quad_Penta = 168, + Entity_Quad_Hexa = 18342, + Entity_Node = 98170, + Entity_Quad_Tetra = 10809, + Entity_Quad_Quadrangle = 5408) + diff --git a/src/Tools/blocFissure/CasTests/eprouvetteDroite.py b/src/Tools/blocFissure/CasTests/eprouvetteDroite.py new file mode 100644 index 000000000..8e08dd8e5 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/eprouvetteDroite.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import os +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from blocFissure.gmu.fissureGenerique import fissureGenerique + +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale + +O, OX, OY, OZ = triedreBase() + +class eprouvetteDroite(fissureGenerique): + """ + problème de fissure plane coupant 3 faces (éprouvette), débouches normaux, objet plan + """ + + nomProbleme = "eprouvetteDroite" + + # --------------------------------------------------------------------------- + def genereMaillageSain(self, geometriesSaines, meshParams): + logging.info("genereMaillageSain %s", self.nomCas) + + ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/eprouvetteDroite.med")) + smesh.SetName(objetSain.GetMesh(), 'objetSain') + + return [objetSain, True] # True : maillage hexa + + # --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour méthode insereFissureGenerale + lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage) + rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure + convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne + pointIn_x : optionnel coordonnée x d'un point dans le solide sain (pour orienter la face) + """ + logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(lgInfluence = 30, + rayonPipe = 10, + lenSegPipe = 6) + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + + lgInfluence = shapeFissureParams['lgInfluence'] + + shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_1.brep"), "BREP") + fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(fondFiss, [8]) + geompy.addToStudy( shellFiss, 'shellFiss' ) + geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10) + + centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 8, + areteFaceFissure = 15) + + # --------------------------------------------------------------------------- + def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams): + elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams) + return elementsDefaut + + # --------------------------------------------------------------------------- + def genereMaillageFissure(self, geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step): + maillageFissure = insereFissureGenerale(maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step) + return maillageFissure + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 368, + Entity_Quad_Triangle = 798, + Entity_Quad_Edge = 491, + Entity_Quad_Penta = 88, + Entity_Quad_Hexa = 9692, + Entity_Node = 52652, + Entity_Quad_Tetra = 5093, + Entity_Quad_Quadrangle = 3750) + diff --git a/src/Tools/blocFissure/CasTests/eprouvetteDroite_2.py b/src/Tools/blocFissure/CasTests/eprouvetteDroite_2.py new file mode 100644 index 000000000..de55fd25f --- /dev/null +++ b/src/Tools/blocFissure/CasTests/eprouvetteDroite_2.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from eprouvetteDroite import eprouvetteDroite + +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale + +O, OX, OY, OZ = triedreBase() + +class eprouvetteDroite_2(eprouvetteDroite): + """ + problème de fissure plane coupant 3 faces (éprouvette), débouches non normaux, objet plan + """ + + nomProbleme = "eprouvetteDroite2" + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + + lgInfluence = shapeFissureParams['lgInfluence'] + + shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_2.brep"), "BREP") + fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(fondFiss, [10]) + geompy.addToStudy( shellFiss, 'shellFiss' ) + geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10) + + centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 396, + Entity_Quad_Triangle = 1084, + Entity_Quad_Edge = 510, + Entity_Quad_Penta = 96, + Entity_Quad_Hexa = 9504, + Entity_Node = 55482, + Entity_Quad_Tetra = 7545, + Entity_Quad_Quadrangle = 3724) + diff --git a/src/Tools/blocFissure/CasTests/execution_Cas.py b/src/Tools/blocFissure/CasTests/execution_Cas.py new file mode 100644 index 000000000..2d7b80dbe --- /dev/null +++ b/src/Tools/blocFissure/CasTests/execution_Cas.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- + +import sys, traceback +from blocFissure import gmu +from blocFissure.gmu import initLog +#initLog.setDebug() +initLog.setVerbose() + +from blocFissure.gmu import geomsmesh +from blocFissure.casStandard import casStandard + +problemes = [] + +cas=0 +from blocFissure.CasTests.fissure_Coude import fissure_Coude +problemes.append(fissure_Coude(cas)) + +cas=1 +from blocFissure.CasTests.faceGauche import faceGauche +problemes.append(faceGauche(cas)) + +cas=2 +from blocFissure.CasTests.faceGauche_2 import faceGauche_2 +problemes.append(faceGauche_2(cas)) + +cas=3 +from blocFissure.CasTests.ellipse_1 import ellipse_1 +problemes.append(ellipse_1(cas)) + +cas=4 +from blocFissure.CasTests.fissure_Coude_4 import fissure_Coude_4 +problemes.append(fissure_Coude_4(cas)) + +cas=5 +from blocFissure.CasTests.cylindre import cylindre +problemes.append(cylindre(cas)) + +cas=6 +from blocFissure.CasTests.cylindre_2 import cylindre_2 +problemes.append(cylindre_2(cas)) + +cas=7 +from blocFissure.CasTests.eprouvetteCourbe import eprouvetteCourbe +problemes.append(eprouvetteCourbe(cas)) + +cas=8 +from blocFissure.CasTests.eprouvetteDroite import eprouvetteDroite +problemes.append(eprouvetteDroite(cas)) + +cas=9 +from blocFissure.CasTests.eprouvetteDroite_2 import eprouvetteDroite_2 +problemes.append(eprouvetteDroite_2(cas)) + +cas=10 +from blocFissure.CasTests.cubeAngle import cubeAngle +problemes.append(cubeAngle(cas)) + +cas=11 +from blocFissure.CasTests.fissureCoude_1 import fissureCoude_1 +problemes.append(fissureCoude_1(cas)) + +cas=12 +from blocFissure.CasTests.fissureCoude_2 import fissureCoude_2 +problemes.append(fissureCoude_2(cas)) + +cas=13 +from blocFissure.CasTests.fissureCoude_3 import fissureCoude_3 +problemes.append(fissureCoude_3(cas)) + +cas=14 +from blocFissure.CasTests.fissureCoude_4 import fissureCoude_4 +problemes.append(fissureCoude_4(cas)) + +cas=15 +from blocFissure.CasTests.fissureCoude_5 import fissureCoude_5 +problemes.append(fissureCoude_5(cas)) + +cas=16 +from blocFissure.CasTests.ellipse_2 import ellipse_2 +problemes.append(ellipse_2(cas)) + +cas=17 +from blocFissure.CasTests.cubeAngle2 import cubeAngle2 +problemes.append(cubeAngle2(cas)) + +cas=18 +from blocFissure.CasTests import disquePerce +problemes.append(casStandard(disquePerce.dicoParams, disquePerce.referencesMaillageFissure, cas)) + +cas=19 +from blocFissure.CasTests.fissureCoude_6 import fissureCoude_6 +problemes.append(fissureCoude_6(cas)) + +cas=20 +from blocFissure.CasTests.fissureCoude_7 import fissureCoude_7 +problemes.append(fissureCoude_7(cas)) + +cas=21 +from blocFissure.CasTests.fissureCoude_8 import fissureCoude_8 +problemes.append(fissureCoude_8(cas)) + +cas=22 +from blocFissure.CasTests.fissureCoude_9 import fissureCoude_9 +problemes.append(fissureCoude_9(cas)) + +cas=23 +from blocFissure.CasTests.fissureCoude_10 import fissureCoude_10 +problemes.append(fissureCoude_10(cas)) + +cas=24 +from blocFissure.CasTests.vis_1 import vis_1 +problemes.append(vis_1(cas)) + +# ---tous les cas en sequence, ou les cas selectionnés ... +runall = True +if runall: + torun = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,] +else: #prob 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 + torun = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] + +for i in range(len(problemes)): + if torun[i]: + try: + problemes[i].executeProbleme() + except: + traceback.print_exc() + print "---------------------------------------------------------------------" diff --git a/src/Tools/blocFissure/CasTests/faceGauche.py b/src/Tools/blocFissure/CasTests/faceGauche.py new file mode 100644 index 000000000..dfb251cc0 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/faceGauche.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from blocFissure.gmu.fissureGenerique import fissureGenerique + +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale + +O, OX, OY, OZ = triedreBase() + +class faceGauche(fissureGenerique): + """ + problème de fissure non plane, débouchante non normale + """ + + nomProbleme = "faceGauche" + + # --------------------------------------------------------------------------- + def genereMaillageSain(self, geometriesSaines, meshParams): + logging.info("genereMaillageSain %s", self.nomCas) + + ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheSain.med")) + smesh.SetName(objetSain.GetMesh(), 'objetSain') + + return [objetSain, True] # True : maillage hexa + + # --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour méthode insereFissureGenerale + lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage) + rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure + convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne + pointIn_x : optionnel coordonnée x d'un point dans le solide sain (pour orienter la face) + """ + logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(lgInfluence = 300, + rayonPipe = 20) + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + + lgInfluence = shapeFissureParams['lgInfluence'] + + shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheFiss.brep"), "BREP") + fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(fondFiss, [6]) + geompy.addToStudy( shellFiss, 'shellFiss' ) + geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,50) + + centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 8, + areteFaceFissure = 1000) + + # --------------------------------------------------------------------------- + def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams): + elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams) + return elementsDefaut + + # --------------------------------------------------------------------------- + def genereMaillageFissure(self, geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step): + maillageFissure = insereFissureGenerale(maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step) + return maillageFissure + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 1284, + Entity_Quad_Triangle = 2336, + Entity_Quad_Edge = 758, + Entity_Quad_Penta = 984, + Entity_Quad_Hexa = 6416, + Entity_Node = 85673, + Entity_Quad_Tetra = 35990, + Entity_Quad_Quadrangle = 4285) + diff --git a/src/Tools/blocFissure/CasTests/faceGauche_2.py b/src/Tools/blocFissure/CasTests/faceGauche_2.py new file mode 100644 index 000000000..cc8a03db8 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/faceGauche_2.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from blocFissure.gmu.fissureGenerique import fissureGenerique + + +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale + +O, OX, OY, OZ = triedreBase() + +class faceGauche_2(fissureGenerique): + """ + problème de fissure non plane, débouchante non normale + """ + + nomProbleme = "faceGauche2" + + # --------------------------------------------------------------------------- + def genereMaillageSain(self, geometriesSaines, meshParams): + logging.info("genereMaillageSain %s", self.nomCas) + + ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/boiteSaine.med")) + smesh.SetName(objetSain.GetMesh(), 'objetSain') + + return [objetSain, True] # True : maillage hexa + + # --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour méthode insereFissureGenerale + lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage) + rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure + convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne + pointIn_x : optionnel coordonnée x d'un point dans le solide sain (pour orienter la face) + """ + logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(lgInfluence = 100, + rayonPipe = 20) + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + + lgInfluence = shapeFissureParams['lgInfluence'] + + shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"), "BREP") + fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(fondFiss, [12, 4]) + geompy.addToStudy( shellFiss, 'shellFiss' ) + geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25) + + centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 8, + areteFaceFissure = 1000) + + # --------------------------------------------------------------------------- + def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams): + elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams) + return elementsDefaut + + # --------------------------------------------------------------------------- + def genereMaillageFissure(self, geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step): + maillageFissure = insereFissureGenerale(maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step) + return maillageFissure + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 859, + Entity_Quad_Triangle = 634, + Entity_Quad_Edge = 323, + Entity_Quad_Penta = 288, + Entity_Quad_Hexa = 3435, + Entity_Node = 44095, + Entity_Quad_Tetra = 18400, + Entity_Quad_Quadrangle = 2542) + diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_1.py b/src/Tools/blocFissure/CasTests/fissureCoude_1.py new file mode 100644 index 000000000..9e7636599 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/fissureCoude_1.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- + +from blocFissure.gmu.fissureCoude import fissureCoude + +class fissureCoude_1(fissureCoude): + """ + problème de fissure du Coude : + adaptation maillage + """ + +# --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 60, + r_cintr = 1200, + l_tube_p1 = 1600, + l_tube_p2 = 1200, + epais = 40, + de = 760) + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 16, + n_ep = 3, + n_long_coude = 15, + n_circ_g = 20, + n_circ_d = 20, + n_long_p2 = 12) + +# --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour le tuyau coude + profondeur : 0 < profondeur <= épaisseur + rayonPipe : rayon du pipe correspondant au maillage rayonnant + lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut) + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe). + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites) + pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) + externe : True : fissure face externe, False : fissure face interne + """ + print "setParamShapeFissure", self.nomCas + self.shapeFissureParams = dict(profondeur = 10, + rayonPipe = 2.5, + lenSegPipe = 2.5, + azimut = 160, + alpha = 20, + longueur = 400, + orientation = 90, + lgInfluence = 50, + elliptique = False, + externe = True) + +# --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + """ + Paramètres du maillage de la fissure pour le tuyau coudé + Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe. + nbSegRad = nombre de couronnes + nbSegCercle = nombre de secteurs + areteFaceFissure = taille cible de l'arête des triangles en face de fissure. + """ + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 6, + areteFaceFissure = 5) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 77917, + Entity_Quad_Edge = 975, + Entity_Quad_Triangle = 2182, + Entity_Quad_Quadrangle = 6842, + Entity_Quad_Tetra = 20135, + Entity_Quad_Hexa = 8994, + Entity_Quad_Penta = 972, + Entity_Quad_Pyramid = 1038) + diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_10.py b/src/Tools/blocFissure/CasTests/fissureCoude_10.py new file mode 100644 index 000000000..33ab3e012 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/fissureCoude_10.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- + +from blocFissure.gmu.fissureCoude import fissureCoude + +class fissureCoude_10(fissureCoude): + # cas test ASCOU17 + + +# --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 90, + r_cintr = 1143, + l_tube_p1 = 3200, + l_tube_p2 = 3200, + epais = 35, + de = 762) + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 13, + n_ep = 2, + n_long_coude = 20, + n_circ_g = 20, + n_circ_d = 20, + n_long_p2 = 13) + + # --------------------------------------------------------------------------- + + def setParamShapeFissure(self): + """ + paramètres de la fissure pour le tuyau coude + profondeur : 0 < profondeur <= épaisseur + rayonPipe : rayon du pipe correspondant au maillage rayonnant + lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut) + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe). + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites) + pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) + externe : True : fissure face externe, False : fissure face interne + """ +# logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(profondeur = 2.5, + rayonPipe = 1.5, + lenSegPipe = 6, + azimut = 180, + alpha = 45, + longueur = 1196, + orientation = 0, + lgInfluence = 30, + elliptique = False, + externe = False) + + # --------------------------------------------------------------------------- + + def setParamMaillageFissure(self): + """ + Paramètres du maillage de la fissure pour le tuyau coudé + Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe. + nbSegRad = nombre de couronnes + nbSegCercle = nombre de secteurs + areteFaceFissure = taille cible de l'arête des triangles en face de fissure. + """ + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 3, + nbsegCercle = 8, + areteFaceFissure = 2.5) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 93352, + Entity_Quad_Edge = 1456, + Entity_Quad_Triangle = 8934, + Entity_Quad_Quadrangle = 6978, + Entity_Quad_Tetra = 31147, + Entity_Quad_Hexa = 6972, + Entity_Quad_Penta = 1600, + Entity_Quad_Pyramid = 1696) + diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_2.py b/src/Tools/blocFissure/CasTests/fissureCoude_2.py new file mode 100644 index 000000000..0690c01d6 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/fissureCoude_2.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- + +from blocFissure.gmu.fissureCoude import fissureCoude + +class fissureCoude_2(fissureCoude): + """ + problème de fissure du Coude : + adaptation maillage + """ + +# --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 90, + r_cintr = 1200, + l_tube_p1 = 1600, + l_tube_p2 = 1200, + epais = 40, + de = 760) + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 16, + n_ep = 3, + n_long_coude = 15, + n_circ_g = 20, + n_circ_d = 20, + n_long_p2 = 12) + +# --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour le tuyau coude + profondeur : 0 < profondeur <= épaisseur + rayonPipe : rayon du pipe correspondant au maillage rayonnant + lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut) + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe). + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites) + pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) + externe : True : fissure face externe, False : fissure face interne + """ + print "setParamShapeFissure", self.nomCas + self.shapeFissureParams = dict(profondeur = 10, + rayonPipe = 2.5, + lenSegPipe = 2.5, + azimut = 200, + alpha = 40, + longueur = 800, + orientation = 0, + lgInfluence = 50, + elliptique = False, + externe = True) + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + """ + Paramètres du maillage de la fissure pour le tuyau coudé + Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe. + nbSegRad = nombre de couronnes + nbSegCercle = nombre de secteurs + areteFaceFissure = taille cible de l'arête des triangles en face de fissure. + """ + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 6, + areteFaceFissure = 5) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 132120, + Entity_Quad_Edge = 1411, + Entity_Quad_Triangle = 5342, + Entity_Quad_Quadrangle = 9524, + Entity_Quad_Tetra = 40902, + Entity_Quad_Hexa = 12981, + Entity_Quad_Penta = 1980, + Entity_Quad_Pyramid = 2064) + diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_3.py b/src/Tools/blocFissure/CasTests/fissureCoude_3.py new file mode 100644 index 000000000..653192d5b --- /dev/null +++ b/src/Tools/blocFissure/CasTests/fissureCoude_3.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- + +from blocFissure.gmu.fissureCoude import fissureCoude + +class fissureCoude_3(fissureCoude): + """ + problème de fissure du Coude + adaptation maillage + """ + +# --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 40, + r_cintr = 654, + l_tube_p1 = 1700, + l_tube_p2 = 1700, + epais = 62.5, + de = 912.4) + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 16, + n_ep = 3, + n_long_coude = 30, + n_circ_g = 50, + n_circ_d = 20, + n_long_p2 = 12) + +# --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour le tuyau coude + profondeur : 0 < profondeur <= épaisseur + rayonPipe : rayon du pipe correspondant au maillage rayonnant + lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut) + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe). + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites) + pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) + externe : True : fissure face externe, False : fissure face interne + """ + print "setParamShapeFissure", self.nomCas + self.shapeFissureParams = dict(profondeur = 10, + rayonPipe = 2.5, + lenSegPipe = 2.5, + azimut = 90, + alpha = 20, + longueur = 240, + orientation = 90, + lgInfluence = 30, + elliptique = False, + externe = False) + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + """ + Paramètres du maillage de la fissure pour le tuyau coudé + Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe. + nbSegRad = nombre de couronnes + nbSegCercle = nombre de secteurs + areteFaceFissure = taille cible de l'arête des triangles en face de fissure. + """ + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 6, + areteFaceFissure = 5) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 98643, + Entity_Quad_Edge = 1130, + Entity_Quad_Triangle = 1476, + Entity_Quad_Quadrangle = 11100, + Entity_Quad_Tetra = 15993, + Entity_Quad_Hexa = 14508, + Entity_Quad_Penta = 624, + Entity_Quad_Pyramid = 788) + diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_4.py b/src/Tools/blocFissure/CasTests/fissureCoude_4.py new file mode 100644 index 000000000..8d43dcc41 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/fissureCoude_4.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- + +from blocFissure.gmu.fissureCoude import fissureCoude + +class fissureCoude_4(fissureCoude): + """ + problème de fissure du Coude : ASCOU09A + adaptation maillage + """ + +# --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 40, + r_cintr = 654, + l_tube_p1 = 1700, + l_tube_p2 = 1700, + epais = 62.5, + de = 912.4) + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 16, + n_ep = 5, + n_long_coude = 30, + n_circ_g = 50, + n_circ_d = 20, + n_long_p2 = 12) + +# --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour le tuyau coude + profondeur : 0 < profondeur <= épaisseur + rayonPipe : rayon du pipe correspondant au maillage rayonnant + lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut) + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe). + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites) + pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) + externe : True : fissure face externe, False : fissure face interne + """ + print "setParamShapeFissure", self.nomCas + self.shapeFissureParams = dict(profondeur = 10, + rayonPipe = 2.5, + lenSegPipe =2.5, + azimut = 90, + alpha = 20, + longueur = 240, + orientation = 90, + lgInfluence = 30, + elliptique = False, + externe = True) + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + """ + Paramètres du maillage de la fissure pour le tuyau coudé + Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe. + nbSegRad = nombre de couronnes + nbSegCercle = nombre de secteurs + areteFaceFissure = taille cible de l'arête des triangles en face de fissure. + """ + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 6, + areteFaceFissure = 5) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 133832, + Entity_Quad_Edge = 1133, + Entity_Quad_Triangle = 1498, + Entity_Quad_Quadrangle = 11892, + Entity_Quad_Tetra = 18401, + Entity_Quad_Hexa = 22412, + Entity_Quad_Penta = 600, + Entity_Quad_Pyramid = 816) + diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_5.py b/src/Tools/blocFissure/CasTests/fissureCoude_5.py new file mode 100644 index 000000000..23477e134 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/fissureCoude_5.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- + +from blocFissure.gmu.fissureCoude import fissureCoude + +class fissureCoude_5(fissureCoude): + """ + problème de fissure du Coude : + adaptation maillage + """ + +# --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 90, + r_cintr = 1200, + l_tube_p1 = 1600, + l_tube_p2 = 1200, + epais = 40, + de = 760) + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 16, + n_ep = 3, + n_long_coude = 15, + n_circ_g = 20, + n_circ_d = 20, + n_long_p2 = 12) + +# --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour le tuyau coude + profondeur : 0 < profondeur <= épaisseur + rayonPipe : rayon du pipe correspondant au maillage rayonnant + lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut) + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe). + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites) + pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) + externe : True : fissure face externe, False : fissure face interne + """ + print "setParamShapeFissure", self.nomCas + self.shapeFissureParams = dict(profondeur = 10, + rayonPipe = 2.5, + lenSegPipe = 2.5, + azimut = 180, + alpha = 40, + longueur = 200, + orientation = 0, + lgInfluence = 50, + elliptique = False, + externe = False) + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + """ + Paramètres du maillage de la fissure pour le tuyau coudé + Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe. + nbSegRad = nombre de couronnes + nbSegCercle = nombre de secteurs + areteFaceFissure = taille cible de l'arête des triangles en face de fissure. + """ + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 6, + areteFaceFissure = 5) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 55217, + Entity_Quad_Edge = 762, + Entity_Quad_Triangle = 1586, + Entity_Quad_Quadrangle = 5610, + Entity_Quad_Tetra = 11468, + Entity_Quad_Hexa = 7200, + Entity_Quad_Penta = 516, + Entity_Quad_Pyramid = 552) + diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_6.py b/src/Tools/blocFissure/CasTests/fissureCoude_6.py new file mode 100644 index 000000000..0952579a8 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/fissureCoude_6.py @@ -0,0 +1,91 @@ +# -*- coding: utf-8 -*- + +from blocFissure.gmu.fissureCoude import fissureCoude + +class fissureCoude_6(fissureCoude): +# --- cas ASCOU08 + +# --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 40, + r_cintr = 854, + l_tube_p1 = 1700, + l_tube_p2 = 1700, + epais = 62.5, + de = 912.4) + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 15, + n_ep = 3, + n_long_coude = 16, + n_circ_g = 30, + n_circ_d = 30, + n_long_p2 = 15) + +# --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour le tuyau coude + profondeur : 0 < profondeur <= épaisseur + rayonPipe : rayon du pipe correspondant au maillage rayonnant + lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut) + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe). + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites) + pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) + externe : True : fissure face externe, False : fissure face interne + """ + print "setParamShapeFissure", self.nomCas + self.shapeFissureParams = dict(profondeur = 10, + rayonPipe = 4, + lenSegPipe = 4, + azimut = 90, + alpha = 20, + longueur = 133, + orientation = 0, + lgInfluence = 30, + elliptique = False, + externe = True) + + # --------------------------------------------------------------------------- + + def setParamMaillageFissure(self): + """ + Paramètres du maillage de la fissure pour le tuyau coudé + Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe. + nbSegRad = nombre de couronnes + nbSegCercle = nombre de secteurs + areteFaceFissure = taille cible de l'arête des triangles en face de fissure. + """ + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 12, + areteFaceFissure = 5) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 63783, + Entity_Quad_Edge = 831, + Entity_Quad_Triangle = 742, + Entity_Quad_Quadrangle = 7480, + Entity_Quad_Tetra = 8084, + Entity_Quad_Hexa = 10080, + Entity_Quad_Penta = 456, + Entity_Quad_Pyramid = 500) + + diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_7.py b/src/Tools/blocFissure/CasTests/fissureCoude_7.py new file mode 100644 index 000000000..d19a4b14c --- /dev/null +++ b/src/Tools/blocFissure/CasTests/fissureCoude_7.py @@ -0,0 +1,91 @@ +# -*- coding: utf-8 -*- + +from blocFissure.gmu.fissureCoude import fissureCoude + +class fissureCoude_7(fissureCoude): + + +# --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 40, + r_cintr = 654, + l_tube_p1 = 1700, + l_tube_p2 = 1700, + epais = 62.5, + de = 912.4) + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 15, + n_ep = 3, + n_long_coude = 16, + n_circ_g = 30, + n_circ_d = 30, + n_long_p2 = 15) + + # --------------------------------------------------------------------------- + + def setParamShapeFissure(self): + """ + paramètres de la fissure pour le tuyau coude + profondeur : 0 < profondeur <= épaisseur + rayonPipe : rayon du pipe correspondant au maillage rayonnant + lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut) + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe). + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites) + pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) + externe : True : fissure face externe, False : fissure face interne + """ +# logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(profondeur = 10, + rayonPipe = 4, + lenSegPipe = 4, + azimut = 0, + alpha = 20, + longueur = 240, + orientation = 0, + lgInfluence = 30, + elliptique = False, + externe = True) + + # --------------------------------------------------------------------------- + + def setParamMaillageFissure(self): + """ + Paramètres du maillage de la fissure pour le tuyau coudé + Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe. + nbSegRad = nombre de couronnes + nbSegCercle = nombre de secteurs + areteFaceFissure = taille cible de l'arête des triangles en face de fissure. + """ + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 12, + areteFaceFissure = 5) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 75580, + Entity_Quad_Edge = 899, + Entity_Quad_Triangle = 1158, + Entity_Quad_Quadrangle = 8022, + Entity_Quad_Tetra = 13162, + Entity_Quad_Hexa = 11272, + Entity_Quad_Penta = 756, + Entity_Quad_Pyramid = 812) + diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_8.py b/src/Tools/blocFissure/CasTests/fissureCoude_8.py new file mode 100644 index 000000000..49439b6ec --- /dev/null +++ b/src/Tools/blocFissure/CasTests/fissureCoude_8.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- + +from blocFissure.gmu.fissureCoude import fissureCoude + +class fissureCoude_8(fissureCoude): + # cas test ASCOU15 + + +# --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 90, + r_cintr = 2290, + l_tube_p1 = 3200, + l_tube_p2 = 3200, + epais = 30.5, + de = 762) + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 8, + n_ep = 2, + n_long_coude = 20, + n_circ_g = 20, + n_circ_d = 20, + n_long_p2 = 8) + + # --------------------------------------------------------------------------- + + def setParamShapeFissure(self): + """ + paramètres de la fissure pour le tuyau coude + profondeur : 0 < profondeur <= épaisseur + rayonPipe : rayon du pipe correspondant au maillage rayonnant + lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut) + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe). + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites) + pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) + externe : True : fissure face externe, False : fissure face interne + """ +# logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(profondeur = 8, + rayonPipe = 1, + lenSegPipe = 1.5, + azimut = 180, + alpha = 45, + longueur = 48, + orientation = 0, + lgInfluence = 30, + elliptique = True, + externe = False) + + # --------------------------------------------------------------------------- + + def setParamMaillageFissure(self): + """ + Paramètres du maillage de la fissure pour le tuyau coudé + Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe. + nbSegRad = nombre de couronnes + nbSegCercle = nombre de secteurs + areteFaceFissure = taille cible de l'arête des triangles en face de fissure. + """ + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 4, + nbsegCercle = 16, + areteFaceFissure = 5) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 50627, + Entity_Quad_Edge = 666, + Entity_Quad_Triangle = 1498, + Entity_Quad_Quadrangle = 4747, + Entity_Quad_Tetra = 13225, + Entity_Quad_Hexa = 5464, + Entity_Quad_Penta = 864, + Entity_Quad_Pyramid = 880) + diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_9.py b/src/Tools/blocFissure/CasTests/fissureCoude_9.py new file mode 100644 index 000000000..d7370d1ed --- /dev/null +++ b/src/Tools/blocFissure/CasTests/fissureCoude_9.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- + +from blocFissure.gmu.fissureCoude import fissureCoude + +class fissureCoude_9(fissureCoude): + # cas test ASCOU19 + + +# --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 90, + r_cintr = 1144, + l_tube_p1 = 1651, + l_tube_p2 = 1651, + epais = 39, + de = 762) + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 16, + n_ep = 4, + n_long_coude = 40, + n_circ_g = 40, + n_circ_d = 40, + n_long_p2 = 16) + +# --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour le tuyau coude + profondeur : 0 < profondeur <= épaisseur + rayonPipe : rayon du pipe correspondant au maillage rayonnant + lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut) + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe). + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites) + pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) + externe : True : fissure face externe, False : fissure face interne + """ + print "setParamShapeFissure", self.nomCas + self.shapeFissureParams = dict(profondeur = 10, + rayonPipe = 2, + lenSegPipe = 6, + azimut = 0, + alpha = 30.8456, + longueur = 240, + orientation = 90, + lgInfluence = 50, + elliptique = False, + externe = False) + +# --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + """ + Paramètres du maillage de la fissure pour le tuyau coudé + Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe. + nbSegRad = nombre de couronnes + nbSegCercle = nombre de secteurs + areteFaceFissure = taille cible de l'arête des triangles en face de fissure. + """ + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 6, + nbsegCercle = 20, + areteFaceFissure = 2.5) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 162936, + Entity_Quad_Edge = 1254, + Entity_Quad_Triangle = 3238, + Entity_Quad_Quadrangle = 15088, + Entity_Quad_Tetra = 19305, + Entity_Quad_Hexa = 27472, + Entity_Quad_Penta = 920, + Entity_Quad_Pyramid = 1056) + diff --git a/src/Tools/blocFissure/CasTests/fissure_Coude.py b/src/Tools/blocFissure/CasTests/fissure_Coude.py new file mode 100644 index 000000000..6f87ec6b4 --- /dev/null +++ b/src/Tools/blocFissure/CasTests/fissure_Coude.py @@ -0,0 +1,496 @@ +# -*- coding: utf-8 -*- + +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from blocFissure.gmu.fissureGenerique import fissureGenerique + +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureLongue import insereFissureLongue + +O, OX, OY, OZ = triedreBase() + +class fissure_Coude(fissureGenerique): + """ + problème de fissure du Coude : version de base + maillage hexa + """ + + nomProbleme = "tuyau_Coude" + + # --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 60, + r_cintr = 1200, + l_tube_p1 = 1600, + l_tube_p2 = 1200, + epais = 40, + de = 760) + + # --------------------------------------------------------------------------- + def genereGeometrieSaine(self, geomParams): + logging.info("genereGeometrieSaine %s", self.nomCas) + + angleCoude = geomParams['angleCoude'] + r_cintr = geomParams['r_cintr'] + l_tube_p1 = geomParams['l_tube_p1'] + l_tube_p2 = geomParams['l_tube_p2'] + epais = geomParams['epais'] + de = geomParams['de'] + + centre = geompy.MakeVertex(0, 0, -l_tube_p1) + Disk_1 = geompy.MakeDiskPntVecR(centre, OZ, de/2.) + Disk_2 = geompy.MakeDiskPntVecR(centre, OZ, de/2. -epais) + Cut_1 = geompy.MakeCut(Disk_1, Disk_2) + Extrusion_1 = geompy.MakePrismVecH(Cut_1, OZ, l_tube_p1) + axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1) + Revolution_1 = geompy.MakeRevolution(Cut_1, axe, angleCoude*math.pi/180.0) + Rotation_1 = geompy.MakeRotation(Cut_1, axe, angleCoude*math.pi/180.0) + Rotation_2 = geompy.MakeRotation(OZ, OY, angleCoude*math.pi/180.0) + Extrusion_2 = geompy.MakePrismVecH(Rotation_1, Rotation_2, -l_tube_p2) + Plane_1 = geompy.MakePlaneLCS(None, 100000, 3) + geompy.addToStudy( Plane_1, "Plane_1" ) + geompy.addToStudy( Extrusion_1, "Extrusion_1" ) + geompy.addToStudy( Revolution_1, "Revolution_1" ) + geompy.addToStudy( Extrusion_2, "Extrusion_2" ) + + P1 = O + geompy.addToStudy( P1, "P1" ) + op2 = geompy.MakeVertex(0, 0, -l_tube_p1) + P2 = geompy.MakeRotation(op2, axe, angleCoude*math.pi/180.0) + P2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, -l_tube_p2) + geompy.addToStudy( P2, "P2" ) + + # --- tube coude sain + + geometrieSaine = geompy.MakePartition([Extrusion_1, Revolution_1, Extrusion_2, P1, P2], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1) + geompy.addToStudy( geometrieSaine, self.nomCas ) + [P1, P2] = geompy.RestoreGivenSubShapes(geometrieSaine, [P1, P2], GEOM.FSM_GetInPlaceByHistory, False, True) + + [ep, circ_g, circ_d, long_p2, long_coude, long_p1] = geompy.Propagate(geometrieSaine) + geompy.addToStudyInFather( geometrieSaine, long_p1, 'long_p1' ) + geompy.addToStudyInFather( geometrieSaine, ep, 'ep' ) + geompy.addToStudyInFather( geometrieSaine, long_coude, 'long_coude' ) + geompy.addToStudyInFather( geometrieSaine, circ_g, 'circ_g' ) + geompy.addToStudyInFather( geometrieSaine, circ_d, 'circ_d' ) + geompy.addToStudyInFather( geometrieSaine, long_p2, 'long_p2' ) + + # --- face extremite tube (EXTUBE) + + facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], OZ, GEOM.ST_ON) + EXTUBE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) + geompy.UnionIDs(EXTUBE, facesIds) + geompy.addToStudyInFather( geometrieSaine, EXTUBE, 'EXTUBE' ) + + # --- edge bord extremite tube (BORDTU) + + edge1Ids = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["EDGE"], OZ, GEOM.ST_ON) + edge2Ids = geompy.GetShapesOnCylinderIDs(geometrieSaine, geompy.ShapeType["EDGE"], OZ, de/2., GEOM.ST_ON) + edgesIds = [] + for edge in edge1Ids: + if edge in edge2Ids: + edgesIds.append(edge) + BORDTU = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(BORDTU, edgesIds) + geompy.addToStudyInFather( geometrieSaine, BORDTU, 'BORDTU' ) + + # --- face origine tube (CLGV) + + pp2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, 10) + vec2 = geompy.MakeVector(P2, pp2) + #geompy.addToStudy(vec2, 'vec2') + facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON) + CLGV = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) + geompy.UnionIDs(CLGV, facesIds) + geompy.addToStudyInFather( geometrieSaine, CLGV, 'CLGV' ) + + # --- peau tube interieur (PEAUINT) + + extru1 = geompy.MakePrismVecH(Disk_2, OZ, l_tube_p1) + revol1 = geompy.MakeRevolution(Disk_2, axe, angleCoude*math.pi/180.0) + rot1 = geompy.MakeRotation(Disk_2, axe, angleCoude*math.pi/180.0) + extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2) + interne = geompy.MakeFuse(extru1, revol1) + interne = geompy.MakeFuse(extru2, interne) + geompy.addToStudy(interne, 'interne') + facesIds = geompy.GetShapesOnShapeIDs(interne, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ONIN) + PEAUINT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) + geompy.UnionIDs(PEAUINT, facesIds) + geompy.addToStudyInFather( geometrieSaine, PEAUINT, 'PEAUINT' ) + + # --- peau tube exterieur (PEAUEXT) + + cercle1 = geompy.MakeCircle(centre, OZ, de/2.) + extru1 = geompy.MakePrismVecH(cercle1, OZ, l_tube_p1) + revol1 = geompy.MakeRevolution(cercle1, axe, angleCoude*math.pi/180.0) + rot1 = geompy.MakeRotation(cercle1, axe, angleCoude*math.pi/180.0) + extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2) + externe = geompy.MakeFuse(extru1, revol1) + externe = geompy.MakeFuse(extru2, externe) + geompy.addToStudy(externe, 'externe') + facesIds = geompy.GetShapesOnShapeIDs(externe, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ON) + PEAUEXT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) + geompy.UnionIDs(PEAUEXT, facesIds) + geompy.addToStudyInFather( geometrieSaine, PEAUEXT, 'PEAUEXT' ) + + # --- solide sain + + volIds = geompy.SubShapeAllIDs(geometrieSaine, geompy.ShapeType["SOLID"]) + COUDE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["SOLID"]) + geompy.UnionIDs(COUDE, volIds) + geompy.addToStudyInFather( geometrieSaine, COUDE, 'COUDSAIN' ) + + geometriesSaines = [geometrieSaine, long_p1, ep, long_coude, circ_g, circ_d, long_p2, P1, P2, EXTUBE, BORDTU, CLGV, PEAUINT, PEAUEXT, COUDE] + + return geometriesSaines + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 16, + n_ep = 3, + n_long_coude = 15, + n_circ_g = 20, + n_circ_d = 20, + n_long_p2 = 12) + + # --------------------------------------------------------------------------- + def genereMaillageSain(self, geometriesSaines, meshParams): + logging.info("genereMaillageSain %s", self.nomCas) + + geometrieSaine = geometriesSaines[0] + long_p1 = geometriesSaines[1] + ep = geometriesSaines[2] + long_coude = geometriesSaines[3] + circ_g = geometriesSaines[4] + circ_d = geometriesSaines[5] + long_p2 = geometriesSaines[6] + P1 = geometriesSaines[7] + P2 = geometriesSaines[8] + EXTUBE = geometriesSaines[9] + BORDTU = geometriesSaines[10] + CLGV = geometriesSaines[11] + PEAUINT = geometriesSaines[12] + PEAUEXT = geometriesSaines[13] + COUDE = geometriesSaines[14] + + n_long_p1 = meshParams['n_long_p1'] + n_ep = meshParams['n_ep'] + n_long_coude = meshParams['n_long_coude'] + n_circ_g = meshParams['n_circ_g'] + n_circ_d = meshParams['n_circ_d'] + n_long_p2 = meshParams['n_long_p2'] + + maillageSain = smesh.Mesh(geometrieSaine) + + algo3d = maillageSain.Hexahedron() + algo2d = maillageSain.Quadrangle() + smesh.SetName(algo3d, "algo3d_maillageSain") + smesh.SetName(algo2d, "algo2d_maillageSain") + + algo1d_long_p1 = maillageSain.Segment(geom=long_p1) + hypo1d_long_p1 = algo1d_long_p1.NumberOfSegments(n_long_p1) + smesh.SetName(algo1d_long_p1, "algo1d_long_p1") + smesh.SetName(hypo1d_long_p1, "hypo1d_long_p1") + + algo1d_ep = maillageSain.Segment(geom=ep) + hypo1d_ep = algo1d_ep.NumberOfSegments(n_ep) + smesh.SetName(algo1d_ep, "algo1d_ep") + smesh.SetName(hypo1d_ep, "hypo1d_ep") + + algo1d_long_coude = maillageSain.Segment(geom=long_coude) + hypo1d_long_coude = algo1d_long_coude.NumberOfSegments(n_long_coude) + smesh.SetName(algo1d_long_coude, "algo1d_long_coude") + smesh.SetName(hypo1d_long_coude, "hypo1d_long_coude") + + algo1d_circ_g = maillageSain.Segment(geom=circ_g) + hypo1d_circ_g = algo1d_circ_g.NumberOfSegments(n_circ_g) + smesh.SetName(algo1d_circ_g, "algo1d_circ_g") + smesh.SetName(hypo1d_circ_g, "hypo1d_circ_g") + + algo1d_circ_d = maillageSain.Segment(geom=circ_d) + hypo1d_circ_d = algo1d_circ_d.NumberOfSegments(n_circ_d) + smesh.SetName(algo1d_circ_d, "algo1d_circ_d") + smesh.SetName(hypo1d_circ_d, "hypo1d_circ_d") + + algo1d_long_p2 = maillageSain.Segment(geom=long_p2) + hypo1d_long_p2 = algo1d_long_p2.NumberOfSegments(n_long_p2) + smesh.SetName(algo1d_long_p2, "algo1d_long_p2") + smesh.SetName(hypo1d_long_p2, "hypo1d_long_p2") + + isDone = maillageSain.Compute() + + mp1 = maillageSain.GroupOnGeom(P1,'P1',SMESH.NODE) + mp2 = maillageSain.GroupOnGeom(P2,'P2',SMESH.NODE) + ext = maillageSain.GroupOnGeom(EXTUBE,'EXTUBE',SMESH.FACE) + btu = maillageSain.GroupOnGeom(BORDTU,'BORDTU',SMESH.EDGE) + clg = maillageSain.GroupOnGeom(CLGV,'CLGV',SMESH.FACE) + pei = maillageSain.GroupOnGeom(PEAUINT,'PEAUINT',SMESH.FACE) + pex = maillageSain.GroupOnGeom(PEAUEXT,'PEAUEXT',SMESH.FACE) + cou = maillageSain.GroupOnGeom(COUDE,'COUDSAIN',SMESH.VOLUME) + + return [maillageSain, True] # True : maillage hexa + + # --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure + profondeur : 0 < profondeur <= épaisseur + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> ellipse, >2*profondeur = fissure longue + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + externe : True : fissure face externe, False : fissure face interne + """ + logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(profondeur = 10, + azimut = 160, + alpha = 20, + longueur = 400, + orientation = 90, + lgInfluence = 0, + elliptique = False, + externe = True) + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + logging.info("shapeFissureParams %s", shapeFissureParams) + + angleCoude = geomParams['angleCoude'] + r_cintr = geomParams['r_cintr'] + l_tube_p1 = geomParams['l_tube_p1'] + l_tube_p2 = geomParams['l_tube_p2'] + epais = geomParams['epais'] + de = geomParams['de'] + + profondeur = shapeFissureParams['profondeur'] + azimut = shapeFissureParams['azimut'] + alpha = shapeFissureParams['alpha'] + longueur = shapeFissureParams['longueur'] + orientation = shapeFissureParams['orientation'] + externe = shapeFissureParams['externe'] + lgInfluence = shapeFissureParams['lgInfluence'] + + azimut = -azimut # axe inverse / ASCOUF + axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1) + + if not lgInfluence: + lgInfluence = profondeur + + if longueur > 2*profondeur: + self.fissureLongue=True + else: + self.fissureLongue=False + + self.circonferentielle = False + self.longitudinale = False + if self.fissureLongue and (abs(orientation) < 45) : + self.longitudinale = True + elif self.fissureLongue: + self.circonferentielle = True + + if self.circonferentielle: + if externe: + raybor = de/2. + rayint = raybor - profondeur + rayext = raybor + profondeur + else: + rayext = de/2. - epais + rayint = raybor + profondeur + rayext = raybor - profondeur + lgfond = longueur -2*profondeur + angle = lgfond/(2*raybor) + pb = geompy.MakeVertex(raybor, 0, 0) + pi = geompy.MakeVertex(rayint, 0, 0) + pe = geompy.MakeVertex(rayext, 0, 0) + pl = geompy.MakeVertex(raybor, profondeur, 0) + pr = geompy.MakeVertex(raybor, -profondeur, 0) + pil = geompy.MakeRotation(pi, OZ, angle) + pll = geompy.MakeRotation(pl, OZ, angle) + pel = geompy.MakeRotation(pe, OZ, angle) + pir = geompy.MakeRotation(pi, OZ, -angle) + prr = geompy.MakeRotation(pr, OZ, -angle) + per = geompy.MakeRotation(pe, OZ, -angle) + arcl = geompy.MakeArc(pil, pll, pel) + arcr = geompy.MakeArc(pir, prr, per) + arci = geompy.MakeArc(pil, pi, pir) + arce = geompy.MakeArc(pel, pe, per) + wire0 = geompy.MakeWire([arcr, arci, arcl]) + cercle0 = geompy.MakeCircle(O, OY, profondeur/4.0) + cercle0 = geompy.MakeRotation(cercle0, OY, math.pi/2.0) + cercle0 = geompy.MakeTranslationTwoPoints(cercle0, O, pi) + facetube0 = geompy.MakeFaceWires([cercle0], 1) + facetubel = geompy.MakeRotation(facetube0, OZ, angle) + facetuber = geompy.MakeRotation(facetube0, OZ, -angle) + face0 = geompy.MakeFaceWires([arcl,arci, arce, arcr], 1) + plan0 = geompy.MakePlane(O, OZ, 10000) + geompy.addToStudy( face0, 'facefissOrig' ) + face1 = geompy.MakeRotation(face0, OZ, azimut*math.pi/180.) + face2 = geompy.MakeTranslation(face1, 0, 0, -l_tube_p1) + facefiss = geompy.MakeRotation(face2, axe, alpha*math.pi/180.) + geompy.addToStudy( facefiss, 'facefissPlace' ) + centre = geompy.MakeRotation(pb, OZ, azimut*math.pi/180.) + centre = geompy.MakeTranslation(centre, 0, 0, -l_tube_p1) + centre = geompy.MakeRotation(centre, axe, alpha*math.pi/180.) + geompy.addToStudy( centre, 'centrefissPlace' ) + arcr = geompy.MakeRotation(arcr, OZ, azimut*math.pi/180.) + arcr = geompy.MakeTranslation(arcr, 0, 0, -l_tube_p1) + arcr = geompy.MakeRotation(arcr, axe, alpha*math.pi/180.) + arci = geompy.MakeRotation(arci, OZ, azimut*math.pi/180.) + arci = geompy.MakeTranslation(arci, 0, 0, -l_tube_p1) + arci = geompy.MakeRotation(arci, axe, alpha*math.pi/180.) + arcl = geompy.MakeRotation(arcl, OZ, azimut*math.pi/180.) + arcl = geompy.MakeTranslation(arcl, 0, 0, -l_tube_p1) + arcl = geompy.MakeRotation(arcl, axe, alpha*math.pi/180.) + wiretube = geompy.MakeRotation(wire0, OZ, azimut*math.pi/180.) + wiretube = geompy.MakeTranslation(wiretube, 0, 0, -l_tube_p1) + wiretube = geompy.MakeRotation(wiretube, axe, alpha*math.pi/180.) + geompy.addToStudy(wiretube, 'wiretubePlace' ) + facetubel = geompy.MakeRotation(facetubel, OZ, azimut*math.pi/180.) + facetubel = geompy.MakeTranslation(facetubel, 0, 0, -l_tube_p1) + facetubel = geompy.MakeRotation(facetubel, axe, alpha*math.pi/180.) + geompy.addToStudy(facetubel, 'facetubeGauche' ) + facetuber = geompy.MakeRotation(facetuber, OZ, azimut*math.pi/180.) + facetuber = geompy.MakeTranslation(facetuber, 0, 0, -l_tube_p1) + facetuber = geompy.MakeRotation(facetuber, axe, alpha*math.pi/180.) + geompy.addToStudy(facetuber, 'facetubeDroit' ) + planfiss = geompy.MakeRotation(plan0, OZ, azimut*math.pi/180.) + planfiss = geompy.MakeTranslation(planfiss, 0, 0, -l_tube_p1) + planfiss = geompy.MakeRotation(planfiss, axe, alpha*math.pi/180.) + geompy.addToStudy(planfiss, 'planfissPlace' ) + pipefissl = geompy.MakePipe(facetubel, arcl) + pipefissi = geompy.MakePipe(facetubel, arci) + pipefissr = geompy.MakePipe(facetuber, arcr) + pipefiss = geompy.MakePartition([pipefissl, pipefissi, pipefissr], [planfiss, wiretube], [], [], geompy.ShapeType["SOLID"], 0, [], 0) + geompy.addToStudy(pipefiss, 'pipefissPlace' ) + + + elif self.longitudinale: + if externe: + raybor = r_cintr + de/2. + rayint = raybor - profondeur + rayext = raybor + profondeur + else: + rayext = r_cintr + de/2. - epais + rayint = raybor + profondeur + rayext = raybor - profondeur + lgfond = longueur -2*profondeur + angle = lgfond/(2*raybor) + pb = geompy.MakeVertex(-raybor, 0, 0) + pi = geompy.MakeVertex(-rayint, 0, 0) + pe = geompy.MakeVertex(-rayext, 0, 0) + pl = geompy.MakeVertex(-raybor, 0, -profondeur) + pr = geompy.MakeVertex(-raybor, 0, profondeur) + pil = geompy.MakeRotation(pi, OY, -angle) + pll = geompy.MakeRotation(pl, OY, -angle) + pel = geompy.MakeRotation(pe, OY, -angle) + pir = geompy.MakeRotation(pi, OY, angle) + prr = geompy.MakeRotation(pr, OY, angle) + per = geompy.MakeRotation(pe, OY, angle) + arcl = geompy.MakeArc(pil, pll, pel) + arcr = geompy.MakeArc(pir, prr, per) + arci = geompy.MakeArc(pil, pi, pir) + arce = geompy.MakeArc(pel, pe, per) + geompy.addToStudy( arcl, 'arcl' ) + geompy.addToStudy( arcr, 'arcr' ) + geompy.addToStudy( arci, 'arci' ) + geompy.addToStudy( arce, 'arce' ) + wire0 = geompy.MakeWire([arcr, arci, arcl]) + cercle0 = geompy.MakeCircle(O, OZ, profondeur/4.0) + #cercle0 = geompy.MakeRotation(cercle0, OZ, math.pi/2.0) + cercle0 = geompy.MakeTranslationTwoPoints(cercle0, O, pi) + geompy.addToStudy( cercle0, 'cercle0' ) + facetube0 = geompy.MakeFaceWires([cercle0], 1) + facetubel = geompy.MakeRotation(facetube0, OY, -angle) + facetuber = geompy.MakeRotation(facetube0, OY, angle) + geompy.addToStudy(facetubel , 'facetubel' ) + geompy.addToStudy( facetuber, 'facetuber' ) + face0 = geompy.MakeFaceWires([arcl,arci, arce, arcr], 1) + plan0 = geompy.MakePlane(O, OY, 10000) + geompy.addToStudy( face0, 'facefissOrig' ) + facefiss = geompy.MakeRotation(face0, OY, alpha*math.pi/180.) + geompy.addToStudy( facefiss, 'facefissPlace' ) + centre = geompy.MakeRotation(pb, OY, alpha*math.pi/180.) + geompy.addToStudy( centre, 'centrefissPlace' ) + arcr = geompy.MakeRotation(arcr, OY, alpha*math.pi/180.) + arci = geompy.MakeRotation(arci, OY, alpha*math.pi/180.) + arcl = geompy.MakeRotation(arcl, OY, alpha*math.pi/180.) + wiretube = geompy.MakeRotation(wire0, OY, alpha*math.pi/180.) + geompy.addToStudy(wiretube, 'wiretubePlace' ) + facetubel = geompy.MakeRotation(facetubel, OY, alpha*math.pi/180.) + geompy.addToStudy(facetubel, 'facetubeGauche' ) + facetuber = geompy.MakeRotation(facetuber, OY, alpha*math.pi/180.) + geompy.addToStudy(facetubel, 'facetubeDroit' ) + planfiss = geompy.MakeRotation(plan0, OY, alpha*math.pi/180.) + geompy.addToStudy(planfiss, 'planfissPlace' ) + pipefissl = geompy.MakePipe(facetubel, arcl) + pipefissi = geompy.MakePipe(facetubel, arci) + pipefissr = geompy.MakePipe(facetuber, arcr) + pipefiss = geompy.MakePartition([pipefissl, pipefissi, pipefissr], [planfiss, wiretube], [], [], geompy.ShapeType["SOLID"], 0, [], 0) + geompy.addToStudy(pipefiss, 'pipefissPlace' ) + else: + pass + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, 5 ,10) + + return [facefiss, centre, lgInfluence, coordsNoeudsFissure, wiretube, facetubel, facetuber, planfiss, pipefiss] + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegExt = 5, + nbsegGen = 25, + nbsegRad = 5, + scaleRad = 4, + nbsegCercle = 6, + nbsegFis = 20, + lensegEllipso = 1.0) + + # --------------------------------------------------------------------------- + def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams): + elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams) + return elementsDefaut + + # --------------------------------------------------------------------------- + def genereMaillageFissure(self, geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step): + maillageFissure = insereFissureLongue(geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step) + return maillageFissure + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 77491, + Entity_Quad_Edge = 1006, + Entity_Quad_Triangle = 2412, + Entity_Quad_Quadrangle = 6710, + Entity_Quad_Tetra = 20853, + Entity_Quad_Hexa = 8656, + Entity_Quad_Penta = 1176, + Entity_Quad_Pyramid = 1232) + diff --git a/src/Tools/blocFissure/CasTests/fissure_Coude_4.py b/src/Tools/blocFissure/CasTests/fissure_Coude_4.py new file mode 100644 index 000000000..55a8b090d --- /dev/null +++ b/src/Tools/blocFissure/CasTests/fissure_Coude_4.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +from fissure_Coude import fissure_Coude + +class fissure_Coude_4(fissure_Coude): + """ + probleme de fissure du Coude : ASCOU09A + adaptation maillage + """ + +# --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 40, + r_cintr = 654, + l_tube_p1 = 1700, + l_tube_p2 = 1700, + epais = 62.5, + de = 912.4) + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 16, + n_ep = 5, + n_long_coude = 30, + n_circ_g = 50, + n_circ_d = 20, + n_long_p2 = 12) + +# --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure + profondeur : 0 < profondeur <= épaisseur + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> ellipse, >2*profondeur = fissure longue + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + externe : True : fissure face externe, False : fissure face interne + """ + print "setParamShapeFissure", self.nomCas + self.shapeFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + profondeur = 10, + azimut = 90, + alpha = 20, + longueur = 240, + orientation = 90, + lgInfluence = 30, + elliptique = False, + convexe = True, + externe = True) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 948, + Entity_Quad_Triangle = 1562, + Entity_Quad_Edge = 1192, + Entity_Quad_Penta = 732, + Entity_Quad_Hexa = 22208, + Entity_Node = 133418, + Entity_Quad_Tetra = 18759, + Entity_Quad_Quadrangle = 11852) + diff --git a/src/Tools/blocFissure/CasTests/vis_1.py b/src/Tools/blocFissure/CasTests/vis_1.py new file mode 100644 index 000000000..fdcb5c94f --- /dev/null +++ b/src/Tools/blocFissure/CasTests/vis_1.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from blocFissure.gmu.fissureGenerique import fissureGenerique + +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale + +O, OX, OY, OZ = triedreBase() + +class vis_1(fissureGenerique): + """ + problème de fissure non plane, débouchante non normale + """ + + nomProbleme = "vis_1" + + # --------------------------------------------------------------------------- + def genereMaillageSain(self, geometriesSaines, meshParams): + logging.info("genereMaillageSain %s", self.nomCas) + + ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/visSain.med")) + smesh.SetName(objetSain.GetMesh(), 'objetSain') + + return [objetSain, True] # True : maillage hexa + + # --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour méthode insereFissureGenerale + lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage) + rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure + convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne + pointIn_x : optionnel coordonnée x d'un point dans le solide sain (pour orienter la face) + """ + logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(lgInfluence = 0.6, + rayonPipe = 0.1) + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + + lgInfluence = shapeFissureParams['lgInfluence'] + + shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"), "BREP") + fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(fondFiss, [4, 7, 9]) + geompy.addToStudy( shellFiss, 'shellFiss' ) + geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 0.1 ,0.2) + + centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 32, + areteFaceFissure = 0.1) + + # --------------------------------------------------------------------------- + def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams): + elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams) + return elementsDefaut + + # --------------------------------------------------------------------------- + def genereMaillageFissure(self, geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step): + maillageFissure = insereFissureGenerale(maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step) + return maillageFissure + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 1284, + Entity_Quad_Triangle = 2336, + Entity_Quad_Edge = 758, + Entity_Quad_Penta = 984, + Entity_Quad_Hexa = 6416, + Entity_Node = 85673, + Entity_Quad_Tetra = 35990, + Entity_Quad_Quadrangle = 4285) + diff --git a/src/Tools/blocFissure/README b/src/Tools/blocFissure/README new file mode 100644 index 000000000..62a3fa88e --- /dev/null +++ b/src/Tools/blocFissure/README @@ -0,0 +1,25 @@ + +Exécution des exemples et cas tests : +------------------------------------ + +- lancer salome +- exécuter les instructions suivantes dans la console Python embarquée, ou dans une console Python avec l'environnement SALOME + # les shapes et fichiers med nécessaires aux tests sont créés dans ${SMESH_ROOT_DIR}/share/salome/plugins/smesh/blocFissure/CasTests + # les maillages fissurés sont écrits dans le répertoire d'exécution. + + +# preparation des shapes et fichiers MED + +import sys, os +sys.path.append(os.path.join(os.environ["SMESH_ROOT_DIR"], "share", "salome", "plugins", "smesh")) +from blocFissure.materielCasTests import genereMateriel + +# execution exemples + +from blocFissure import exemple +from blocFissure import exemple + +# execution des cas tests + +from blocFissure.CasTests import execution_Cas + diff --git a/src/Tools/blocFissure/__init__.py b/src/Tools/blocFissure/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/Tools/blocFissure/casStandard.py b/src/Tools/blocFissure/casStandard.py new file mode 100644 index 000000000..9c1ac5505 --- /dev/null +++ b/src/Tools/blocFissure/casStandard.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from blocFissure.gmu.fissureGenerique import fissureGenerique + +from blocFissure.gmu.initEtude import initEtude +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale + +O, OX, OY, OZ = triedreBase() + +class casStandard(fissureGenerique): + """ + problème de fissure standard, défini par : + - un maillage sain (hexaèdres), + - une face géométrique de fissure, qui doit légèrement dépasser hors du volume maillé + - les numéros d'arêtes (edges géométriques) correspondant au fond de fissure + - les paramètres de maillage de la fissure + """ + + # --------------------------------------------------------------------------- + def __init__ (self, dicoParams, references = None, numeroCas = 0): + initEtude() + self.references = references + self.dicoParams = dicoParams + if self.dicoParams.has_key('nomCas'): + self.nomCas = self.dicoParams['nomCas'] + else: + self.nomCas = 'casStandard' + self.numeroCas = numeroCas + if self.numeroCas != 0: + self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas) + else: + self.nomProbleme = self.nomCas + if self.dicoParams.has_key('lenSegPipe'): + self.lenSegPipe = self.dicoParams['lenSegPipe'] + else: + self.lenSegPipe =self.dicoParams['rayonPipe'] + if self.dicoParams.has_key('step'): + step = self.dicoParams['step'] + else: + step = -1 # exécuter toutes les étapes + if self.numeroCas == 0: # valeur par défaut : exécution immédiate, sinon execution différée dans le cas d'une liste de problèmes + self.executeProbleme(step) + + # --------------------------------------------------------------------------- + def genereMaillageSain(self, geometriesSaines, meshParams): + logging.info("genereMaillageSain %s", self.nomCas) + + ([objetSain], status) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain']) + smesh.SetName(objetSain.GetMesh(), 'objetSain') + + return [objetSain, True] # True : maillage hexa + + # --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour méthode insereFissureGenerale + lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage) + rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure + convexe : True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne + pointIn_x : optionnel : coordonnée x d'un point dans le solide sain (pour orienter la face - idem avec y,z) + """ + logging.info("setParamShapeFissure %s", self.nomCas) + if self.dicoParams.has_key('pointInterieur'): + self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'], + rayonPipe = self.dicoParams['rayonPipe'], + lenSegPipe = self.lenSegPipe, + pointIn_x = self.dicoParams['pointInterieur'][0], + pointIn_y = self.dicoParams['pointInterieur'][1], + pointIn_z = self.dicoParams['pointInterieur'][2]) + else: + self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'], + rayonPipe = self.dicoParams['rayonPipe'], + lenSegPipe = self.lenSegPipe) + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + + lgInfluence = shapeFissureParams['lgInfluence'] + + shellFiss = geompy.ImportFile( self.dicoParams['brepFaceFissure'], "BREP") + fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(fondFiss, self.dicoParams['edgeFissIds'] ) + geompy.addToStudy( shellFiss, 'shellFiss' ) + geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1]) + + centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = self.dicoParams['nbSegRad'], + nbsegCercle = self.dicoParams['nbSegCercle'], + areteFaceFissure = self.dicoParams['areteFaceFissure']) + + # --------------------------------------------------------------------------- + def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams): + elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams) + return elementsDefaut + + # --------------------------------------------------------------------------- + def genereMaillageFissure(self, geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step): + maillageFissure = insereFissureGenerale(maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step) + return maillageFissure + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + if self.references is not None: + self.referencesMaillageFissure = self.references + else: + self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0, + Entity_Quad_Triangle = 0, + Entity_Quad_Edge = 0, + Entity_Quad_Penta = 0, + Entity_Quad_Hexa = 0, + Entity_Node = 0, + Entity_Quad_Tetra = 0, + Entity_Quad_Quadrangle = 0) + diff --git a/src/Tools/blocFissure/exemple.py b/src/Tools/blocFissure/exemple.py new file mode 100644 index 000000000..f351d59c9 --- /dev/null +++ b/src/Tools/blocFissure/exemple.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +import os +from blocFissure import gmu +from blocFissure.gmu import initLog +initLog.setDebug() +#initLog.setVerbose() + +from blocFissure.casStandard import casStandard + +dicoParams = dict(nomCas = 'angleCube', + maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med'), + brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"), + edgeFissIds = [4], + lgInfluence = 20, + meshBrep = (5,10), + rayonPipe = 5, + lenSegPipe = 2.5, + nbSegRad = 5, + nbSegCercle = 32, + areteFaceFissure = 10) + +execInstance = casStandard(dicoParams) diff --git a/src/Tools/blocFissure/exemple2.py b/src/Tools/blocFissure/exemple2.py new file mode 100644 index 000000000..c6d20eb27 --- /dev/null +++ b/src/Tools/blocFissure/exemple2.py @@ -0,0 +1,93 @@ +# -*- coding: iso-8859-1 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import salome_notebook +notebook = salome_notebook.NoteBook(theStudy) + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New(theStudy) + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) +Vertex_1 = geompy.MakeVertex(0, 0, 100) +Disk_1 = geompy.MakeDiskPntVecR(Vertex_1, OZ, 50) +Rotation_1 = geompy.MakeRotation(Box_1, OZ, 45*math.pi/180.0) +geompy.TranslateDXDYDZ(Rotation_1, -50, -250, 0) +Cut_1 = geompy.MakeCut(Disk_1, Rotation_1) +geompy.Export(Cut_1, "disk.brep", "BREP") +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( Vertex_1, 'Vertex_1' ) +geompy.addToStudy( Disk_1, 'Disk_1' ) +geompy.addToStudy( Rotation_1, 'Rotation_1' ) +geompy.addToStudy( Cut_1, 'Cut_1' ) + +### +### SMESH component +### + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New(theStudy) +from salome.StdMeshers import StdMeshersBuilder +boite = smesh.Mesh(Box_1) +Regular_1D = boite.Segment() +Nb_Segments_1 = Regular_1D.NumberOfSegments(15) +Nb_Segments_1.SetDistrType( 0 ) +Quadrangle_2D = boite.Quadrangle(algo=smeshBuilder.QUADRANGLE) +Hexa_3D = boite.Hexahedron(algo=smeshBuilder.Hexa) +isDone = boite.Compute() +smesh.SetName(boite, 'boite') +boite.ExportMED( r'boite.med', 0, SMESH.MED_V2_2, 1 ) + +## set object names +smesh.SetName(boite.GetMesh(), 'boite') +smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') +smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') +smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') +smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') + +import os +from blocFissure import gmu +from blocFissure.gmu import initLog +#initLog.setDebug() +initLog.setVerbose() + +from blocFissure.casStandard import casStandard + +dicoParams = dict(nomCas = 'angleCube2', + maillageSain = 'boite.med', + brepFaceFissure = "disk.brep", + edgeFissIds = [4], + lgInfluence = 20, + meshBrep = (5,10), + rayonPipe = 10, + nbSegRad = 5, + nbSegCercle = 8, + areteFaceFissure = 10) + +execInstance = casStandard(dicoParams) + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/src/Tools/blocFissure/gmu/CMakeLists.txt b/src/Tools/blocFissure/gmu/CMakeLists.txt new file mode 100644 index 000000000..8bd0ceb57 --- /dev/null +++ b/src/Tools/blocFissure/gmu/CMakeLists.txt @@ -0,0 +1,88 @@ +# Copyright (C) 2012-2014 EDF R&D +# +# 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, or (at your option) any later version. +# +# 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 +# + +# --- scripts --- + +# scripts / static +SET(plugin_SCRIPTS + __init__.py + blocDefaut.py + checkDecoupePartition.py + commonSubShapes.py + creeZoneDefautDansObjetSain.py + creeZoneDefautFilling.py + creeZoneDefautGeom.py + creeZoneDefautMaillage.py + distance2.py + eliminateDoubles.py + ellipsoideDefaut.py + enleveDefaut.py + extractionOrienteeMulti.py + extractionOrientee.py + facesCirculaires.py + facesFissure.py + facesToreInBloc.py + facesVolumesToriques.py + findWireEndVertices.py + findWireIntermediateVertices.py + fissureCoude.py + fissureGenerique.py + genereElemsFissureElliptique.py + genereMeshCalculZoneDefaut.py + geomsmesh.py + getCentreFondFiss.py + getStatsMaillageFissure.py + getSubshapeIds.py + initEtude.py + initLog.py + insereFissureElliptique.py + insereFissureGenerale.py + insereFissureLongue.py + meshBlocPart.py + orderEdgesFromWire.py + partitionBlocDefaut.py + partitionVolumeSain.py + peauInterne.py + produitMixte.py + projettePointSurCourbe.py + prolongeVertices.py + prolongeWire.py + propagateTore.py + putName.py + quadranglesToShape.py + regroupeSainEtDefaut.py + rotTrans.py + shapesSurFissure.py + shapeSurFissure.py + sortEdges.py + sortFaces.py + sortGeneratrices.py + sortSolids.py + substractSubShapes.py + testgmu.py + toreFissure.py + triedreBase.py + whichSideMulti.py + whichSide.py + whichSideVertex.py +) + +# --- rules --- + +SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/gmu) diff --git a/src/Tools/blocFissure/gmu/__init__.py b/src/Tools/blocFissure/gmu/__init__.py new file mode 100644 index 000000000..728082fb2 --- /dev/null +++ b/src/Tools/blocFissure/gmu/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +import os +import initLog +#initLog.setDebug() +#initLog.setVerbose() +#initLog.setRelease() + +# --- calcul path blocFissure + +apath = initLog.__file__ +isabs = os.path.isabs(apath) +pathGmu = os.path.split(apath)[0] +if isabs: + pathBloc = os.path.join(pathGmu, '..') +else: + pathBloc = os.path.join(os.getcwd(), pathGmu, '..') +pathBloc = os.path.normpath(pathBloc) diff --git a/src/Tools/blocFissure/gmu/blocDefaut.py b/src/Tools/blocFissure/gmu/blocDefaut.py new file mode 100644 index 000000000..0e6875777 --- /dev/null +++ b/src/Tools/blocFissure/gmu/blocDefaut.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- bloc defaut + +def blocDefaut(blocDim): + """ + Le bloc contenant la fissure est un cube construit centre a l'origine, dont on donne la demi arete. + @param blocdim : demi arete + @return cube (geomObject) + """ + logging.info("start") + geomObj_1 = geompy.MakeVertex(-blocDim, -blocDim, -blocDim) + geomObj_2 = geompy.MakeVertex( blocDim, blocDim, blocDim) + Box = geompy.MakeBoxTwoPnt(geomObj_1, geomObj_2) + #geompy.addToStudy( Box_1, 'Box_1' ) + return Box diff --git a/src/Tools/blocFissure/gmu/checkDecoupePartition.py b/src/Tools/blocFissure/gmu/checkDecoupePartition.py new file mode 100644 index 000000000..e1fcf2be1 --- /dev/null +++ b/src/Tools/blocFissure/gmu/checkDecoupePartition.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- teste si l'opération de partition a produit une modification + +def checkDecoupePartition(shapes, part): + """ + Teste si l'opération de partition a produit une découpe + (plus de shapes dans la partition). + Résultat non garanti si recouvrement des shapes d'origine. + @param shapes : liste des shapes d'origine + @param part : résultat de la partition + @return True si la partition a découpé les shapes d'origine + """ + logging.info('start') + # TODO: ShapeInfo donne des résultats faux (deux faces au lieu de une) + + isPart = False + orig = {} + for shape in shapes: + info = geompy.ShapeInfo(shape) + logging.debug("shape info %s", info) + for k in ['VERTEX', 'EDGE', 'FACE', 'SOLID']: + if k in orig.keys(): + orig[k] += info[k] + else: + orig[k] = info[k] + logging.debug("original shapes info %s", orig) + info = geompy.ShapeInfo(part) + logging.debug("partition info %s", info) + for k in ['VERTEX', 'EDGE', 'FACE', 'SOLID']: + if orig[k] < info[k]: + isPart = True + break + logging.debug("partition modifie l'original %s", isPart) + + return isPart + diff --git a/src/Tools/blocFissure/gmu/commonSubShapes.py b/src/Tools/blocFissure/gmu/commonSubShapes.py new file mode 100644 index 000000000..1777ae89c --- /dev/null +++ b/src/Tools/blocFissure/gmu/commonSubShapes.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- subShapes communes à deux listes + +def commonSubShapes(obj, sub1, sub2): + """ + liste de subshapes communes + """ + logging.info("start") + idsub1 = {} + subList = [] + for s in sub1: + idsub1[geompy.GetSubShapeID(obj, s)] = s + for s in sub2: + idsub = geompy.GetSubShapeID(obj, s) + if idsub in idsub1.keys(): + subList.append(s) + logging.debug("subList=%s", subList) + return subList diff --git a/src/Tools/blocFissure/gmu/creeZoneDefautDansObjetSain.py b/src/Tools/blocFissure/gmu/creeZoneDefautDansObjetSain.py new file mode 100644 index 000000000..edd6855db --- /dev/null +++ b/src/Tools/blocFissure/gmu/creeZoneDefautDansObjetSain.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import smesh +import SMESH +import SALOMEDS + +from creeZoneDefautMaillage import creeZoneDefautMaillage +from peauInterne import peauInterne +from quadranglesToShape import quadranglesToShape +from creeZoneDefautFilling import creeZoneDefautFilling +from creeZoneDefautGeom import creeZoneDefautGeom +from getCentreFondFiss import getCentreFondFiss + +# ----------------------------------------------------------------------------- +# --- + +def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, + shapeFissureParams, maillageFissureParams): + """ + TODO: a compléter + """ + logging.info('start') + + #smesh.SetCurrentStudy(salome.myStudy) + + geometrieSaine = geometriesSaines[0] + maillageSain = maillagesSains[0] + isHexa = maillagesSains[1] + shapeDefaut = shapesFissure[0] + tailleDefaut = shapesFissure[2] + coordsNoeudsFissure = shapesFissure[3] + + isElliptique = False + if shapeFissureParams.has_key('elliptique'): + isElliptique = shapeFissureParams['elliptique'] + if isElliptique: + if shapeFissureParams.has_key('demiGrandAxe'): + demiGrandAxe = shapeFissureParams['demiGrandAxe'] + else: + demiGrandAxe = shapeFissureParams['longueur'] + lgExtrusion = 2.0*demiGrandAxe + else: + lgExtrusion = 50. + + nomRep = maillageFissureParams['nomRep'] + nomFicSain = maillageFissureParams['nomFicSain'] + + fichierMaillageSain = nomRep + '/' + nomFicSain + '.med' + + # --- centre de fond de fissure et tangente + + edgeFondExt, centreFondFiss, tgtCentre = getCentreFondFiss(shapesFissure) + + + # --- zone de défaut + nomZones = "zoneDefaut" + + [origShapes, verticesShapes, dmoyen] = \ + creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut, nomZones, coordsNoeudsFissure) + + maillageSain.ExportMED( fichierMaillageSain, 0, SMESH.MED_V2_2, 1 ) + logging.debug("fichier maillage sain %s", fichierMaillageSain) + [maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges] = \ + peauInterne(fichierMaillageSain, nomZones) + + facesDefaut = [] + centresDefaut = [] + normalsDefaut =[] + extrusionsDefaut = [] + isPlane = False + if isHexa and not isPlane: + meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0) + fillings, noeuds_bords, bordsPartages, fillconts, idFilToCont = quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss) + for filling in fillings: + [faceDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \ + creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion) + facesDefaut.append(faceDefaut) + centresDefaut.append(centreDefaut) + normalsDefaut.append(normalDefaut) + extrusionsDefaut.append(extrusionDefaut) + else: + [facesDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \ + creeZoneDefautGeom( geometrieSaine, shapeDefaut, origShapes, verticesShapes, dmoyen, lgExtrusion) + bordsPartages =[] + for face in facesDefaut: + bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ? + fillconts = facesDefaut + idFilToCont = range(len(facesDefaut)) + + return [facesDefaut, centresDefaut, normalsDefaut, extrusionsDefaut, dmoyen, bordsPartages, fillconts, idFilToCont, + maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges, + edgeFondExt, centreFondFiss, tgtCentre] + diff --git a/src/Tools/blocFissure/gmu/creeZoneDefautFilling.py b/src/Tools/blocFissure/gmu/creeZoneDefautFilling.py new file mode 100644 index 000000000..ed3229eb8 --- /dev/null +++ b/src/Tools/blocFissure/gmu/creeZoneDefautFilling.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- crée zone géométrique défaut a partir d'un filling + +def creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion=50): + """ + Construction CAO de la zone à remailler, quand on utilise un filling, + après appel creeZoneDefautMaillage et quadranglesToShape + @param filling : la CAO de la peau du défaut reconstituée + @param shapeDefaut : objet géométrique représentant la fissure + (selon les cas, un point central, ou une shape plus complexe, + dont on ne garde que les vertices) + @return (facesDefaut = filling, centreDefaut, normalDefaut, extrusionDefaut) + """ + logging.info("start") + + trace = True + facesDefaut = filling + centreSphere = geompy.MakeCDG(shapeDefaut) + geompy.addToStudy(centreSphere, "cdg_defaut") + centreDefaut = geompy.MakeProjection(centreSphere, filling) + if trace: + geompy.addToStudy(centreDefaut, "centreDefaut") + normalDefaut = geompy.GetNormal(filling, centreDefaut) + if trace: + geompy.addToStudy(normalDefaut, "normalDefaut") + extrusionDefaut = geompy.MakePrismVecH(filling, normalDefaut, -lgExtrusion) + if trace: + geompy.addToStudy(extrusionDefaut, "extrusionDefaut") + + return facesDefaut, centreDefaut, normalDefaut, extrusionDefaut diff --git a/src/Tools/blocFissure/gmu/creeZoneDefautGeom.py b/src/Tools/blocFissure/gmu/creeZoneDefautGeom.py new file mode 100644 index 000000000..9969c8d8c --- /dev/null +++ b/src/Tools/blocFissure/gmu/creeZoneDefautGeom.py @@ -0,0 +1,207 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy +from prolongeVertices import prolongeVertices + +# ----------------------------------------------------------------------------- +# --- zone de defaut, constructions geometrique avec CAO d'origine + +def creeZoneDefautGeom(objetSain, shapeDefaut, origShapes, verticesShapes, dmoyen, lgExtrusion=50): + """ + Construction CAO de la zone à remailler, quand on utilise la CAO d'origine, + apres appel creeZoneDefautMaillage + @param objetSain : la géometrie de l'objet initial + @param shapeDefaut : objet géometrique représentant la fissure + (selon les cas, un point central, ou une shape plus complexe, + dont on ne garde que les vertices) + @param origShapes : liste id subShapes + @param verticesShapes : listes noeuds de bord + @param dmoyen : longueur arete moyenne bord + @lgExtrusion : distance d'extrusion de la face du defaut + (ne vaut que pour des fissures courtes) + @return (facesDefaut, centreDefaut, normalDefaut, extrusionDefaut) + """ + logging.info("start") + + trace = True + faces = [] + curves = [] + cdgs = [] + projs = [] + normals = [] + extrusions = [] + partitions = [] + decoupes = [] + + for ishape, vertices in enumerate(verticesShapes): + aShape = origShapes[ishape] + [face] = geompy.SubShapes(objetSain, [aShape]) + faces.append(face) + curve = geompy.MakePolyline(vertices, False) + curves.append(curve) + if trace: + name="poly_%d"%aShape + geompy.addToStudy(curve, name) + # + cdg = geompy.MakeCDG(curve) + cdgs.append(cdg) + if trace: + name="cdgpoly_%d"%aShape + geompy.addToStudy(cdg, name) + # + projCdg = geompy.MakeProjection(cdg, face) + projs.append(projCdg) + if trace: + name="projCdg_%d"%aShape + geompy.addToStudy(projCdg, name) + # + normal = geompy.GetNormal(face, projCdg) + normals.append(normal) + if trace: + name="normal_%d"%aShape + geompy.addToStudy(normal, name) + # + extrusion = geompy.MakePrismVecH2Ways(curve, normal, 10) + extrusions.append(extrusion) + if trace: + name="extrusion_%d"%aShape + geompy.addToStudy(extrusion, name) + # + verticesProlongees = prolongeVertices(vertices) + # + curveprol = geompy.MakePolyline(verticesProlongees, False) + if trace: + name="polyProl_%d"%aShape + geompy.addToStudy(curveprol, name) + # + extruprol = geompy.MakePrismVecH2Ways(curveprol, normal, 10) + if trace: + name="extruProl_%d"%aShape + geompy.addToStudy(extruprol, name) + # + partition = geompy.MakePartition([face], [extruprol], [], [], geompy.ShapeType["FACE"], 0, [], 0) + partitions.append(partition) + if trace: + name="partition_%d"%aShape + geompy.addToStudy(partition, name) + pass + # + + centreSphere = geompy.MakeCDG(shapeDefaut) + geompy.addToStudy(centreSphere, "cdg_defaut") + ccurves = geompy.MakeCompound(curves) + gravCenter = geompy.MakeCDG(ccurves) + geompy.addToStudy(gravCenter, "cdg_curves") + for i in range(len(partitions)): + if trace: + logging.debug(" --- original shape %s", origShapes[i]) + dists = [] + facesToSort = [] + subFaces = geompy.ExtractShapes(partitions[i], geompy.ShapeType["FACE"], True) + for aFace in subFaces: + cdg = geompy.MakeCDG(aFace) + distance = geompy.MinDistance(cdg, centreSphere) + dists.append(distance) + facesToSort.append(aFace) + if trace: + logging.debug("distance = %s", distance) + pass + pass + if len(dists) > 0: + minDist = min(dists) + for j,d in enumerate(dists): + if d == minDist: + aFace = facesToSort[j] + name="decoupe_%d"%origShapes[i] + geompy.addToStudy(aFace, name) + decoupes.append(aFace) + break + pass + pass + + facesDefaut = decoupes[0] + if len(decoupes) > 1: + facesDefaut = geompy.MakePartition(decoupes, [], [], [], geompy.ShapeType["FACE"], 0, [], 0) + geompy.addToStudy(facesDefaut, "facesDefaut") + + shells=[] + if len(decoupes) > 1: # plusieurs faces de defaut + subFaces = geompy.ExtractShapes(facesDefaut, geompy.ShapeType["FACE"], True) + # --- regroupe les subFaces en shells connectes + theFaces = list(subFaces) # copy + while len(theFaces) > 0: + logging.debug("------- len(theFaces) %s" , len(theFaces)) + theFace = theFaces[0] + logging.debug(" start with face %s",theFaces[0]) + theFaces[0:1] = [] + aShell = [theFace] + toAdd =[theFace] + while len(toAdd) > 0: + toAdd = [] + toRemove = [] + for i in range(len(theFaces)): + logging.debug(" try %s", theFaces[i]) + for aFace in aShell: + logging.debug(" with %s", aFace) + try: + edge = geompy.GetSharedShapesMulti([aFace, theFaces[i]], geompy.ShapeType["EDGE"]) + edgeShared = True + except: + edgeShared = False + if edgeShared: + if theFaces[i] not in toAdd: + toAdd.append(theFaces[i]) + toRemove.append(i) + logging.debug(" --- add %s", theFaces[i]) + aShell += toAdd + for k in sorted(toRemove, reverse=True): + theFaces[k:k+1] = [] + theShell = geompy.MakeShell(aShell) + name = "theShell%d"%len(shells) + geompy.addToStudy(theShell,name) + shells.append(theShell) + # + distances = [] + for aShell in shells: # --- trouver le shell en contact avec la fissure + distances.append(geompy.MinDistance(aShell, shapeDefaut)) + minDist = min(distances) + for index in range(len(distances)): + if distances[index] == minDist: + break + theShellDefaut = shells[index] + # + else: # --- une seule face de defaut + subFaces = [facesDefaut] + theShellDefaut = geompy.MakeShell(subFaces) + if trace: + geompy.addToStudy(theShellDefaut,"theShellDefaut") + + theFaces = geompy.ExtractShapes(theShellDefaut, geompy.ShapeType["FACE"], True) + distances = [] + for aFace in theFaces: + distances.append(geompy.MinDistance(aFace, centreSphere)) + minDist = min(distances) + for index in range(len(distances)): + if distances[index] == minDist: + break + + centreDefaut = geompy.MakeProjection(centreSphere, theFaces[index]) + if trace: + geompy.addToStudy(centreDefaut, "centreDefaut") + normalDefaut = geompy.GetNormal(subFaces[index], centreDefaut) + if trace: + geompy.addToStudy(normalDefaut, "normalDefaut") + extrusionDefaut = geompy.MakePrismVecH(theShellDefaut, normalDefaut, -lgExtrusion) + info = geompy.ShapeInfo(extrusionDefaut) + logging.debug("shape info %s", info) + if (info['SOLID'] > 1) or (info['COMPOUND'] > 0) : + solids = geompy.ExtractShapes(extrusionDefaut, geompy.ShapeType["SOLID"], True) + solid0 = solids[0] + for i in range(1,len(solids)): + solid0 = geompy.MakeFuse(solid0, solids[i]) + extrusionDefaut = solid0 + if trace: + geompy.addToStudy(extrusionDefaut, "extrusionDefaut") + + return facesDefaut, centreDefaut, normalDefaut, extrusionDefaut diff --git a/src/Tools/blocFissure/gmu/creeZoneDefautMaillage.py b/src/Tools/blocFissure/gmu/creeZoneDefautMaillage.py new file mode 100644 index 000000000..9fcb7d58e --- /dev/null +++ b/src/Tools/blocFissure/gmu/creeZoneDefautMaillage.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy +import math +from distance2 import distance2 + +# ----------------------------------------------------------------------------- +# --- zone de defaut extraite du maillage + +def creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut, + nomZones, coordsNoeudsFissure): + """ + Identification de la zone à remailler, opérations sur le maillage + de l'objet sain + La zone à remailler est définie à partir d'un objet géométrique + ou à partir d'un jeu de points et d'une distance d'influence. + @param maillagesSains : (le maillage de l'objet initial, booleen isHexa) + @param shapeDefaut : objet géométrique représentant la fissure + (selon les cas, un point central, ou une shape plus complexe, + dont on ne garde que les vertices) + @param tailleDefaut : distance d'influence définissant la zone à remailler: + tous les éléments du maillage initial qui pénètrent dans cette zone + sont détectés + @param nomZones : préfixe des noms de groupes créés dans le maillage initial. S'il y a un groupe de noeuds + @coordsNoeudsFissure : jeu de points donné par une liste (x1,y1,z1, x2,y2,z2, ...) + @return (origShapes, verticesShapes, dmoyen) liste id subShapes, + listes noeuds de bord, longueur arête moyenne bord + """ + logging.info("start") + + maillageSain = maillagesSains[0] + isHexa = maillagesSains[1] + lists = maillageSain.CreateHoleSkin(tailleDefaut, shapeDefaut, nomZones, coordsNoeudsFissure) + + logging.debug("lists=%s", lists) + + trace = True + origShapes = [] + verticesShapes = [] + + cumul = 0 # somme des distances carrées entre point ordonnés (taille des arêtes) + nb = 0 # nombre d'arêtes évaluées + + for aList in lists: + aShape = aList[0] + origShapes.append(aShape) + logging.debug(" shapeId %s", aShape) + vertices = [] + xyz0 = None + for inode in range(1, len(aList)): + xyz = maillageSain.GetNodeXYZ(aList[inode]) + if xyz0 is not None: + cumul += distance2(xyz, xyz0) + nb += 1 + xyz0 = xyz + #logging.debug(" node %s %s", aList[inode], xyz) + vertices.append(geompy.MakeVertex(xyz[0], xyz[1], xyz[2])) + pass + verticesShapes.append(vertices) + pass + + dmoyen = math.sqrt(cumul/nb) # ~ taille de l'arête moyenne du maillage global + return origShapes, verticesShapes, dmoyen diff --git a/src/Tools/blocFissure/gmu/distance2.py b/src/Tools/blocFissure/gmu/distance2.py new file mode 100644 index 000000000..acdbbdcea --- /dev/null +++ b/src/Tools/blocFissure/gmu/distance2.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +import logging + +# ----------------------------------------------------------------------------- +# --- calcul de distance carree entre deux points, jeux de coordonnees x,y,z + +def distance2(xyz1, xyz2): + """ + carré de la distance entre deux points donnés par des triplets [x,y,z] + """ + #logging.info("start") + + d2 = 0 + for i in range(3): + d2 += (xyz1[i]-xyz2[i])*(xyz1[i]-xyz2[i]) + logging.debug('d2=%s', d2) + return d2 + +# ----------------------------------------------------------------------------- +# --- test unitaire + +import unittest +class Test_distance2(unittest.TestCase): + + def setUp(self): + self.a=[0, 0, 0] + self.b=[3, 4, 5] + self.c=[-5,-4,-3] + + def test_calcul(self): + self.assertEqual(distance2(self.a, self.b), distance2(self.b, self.a)) + self.assertEqual(distance2(self.a, self.b), distance2(self.a, self.c)) + self.assertEqual(distance2(self.b, self.b), 0) + self.assertEqual(distance2(self.a, self.b), 50) + \ No newline at end of file diff --git a/src/Tools/blocFissure/gmu/eliminateDoubles.py b/src/Tools/blocFissure/gmu/eliminateDoubles.py new file mode 100644 index 000000000..b9e2e6c1d --- /dev/null +++ b/src/Tools/blocFissure/gmu/eliminateDoubles.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- éliminer les doublons d'une liste de subshapes + +def eliminateDoubles(obj, subshapes): + """ + éliminer les doublons d'une liste de subshapes + """ + idsubs = {} + for sub in subshapes: + subid = geompy.GetSubShapeID(obj, sub) + if subid in idsubs.keys(): + idsubs[subid].append(sub) + else: + idsubs[subid] = [sub] + shortList = [] + for k, v in idsubs.iteritems(): + shortList.append(v[0]) + logging.debug("shortList=%s", shortList) + return shortList diff --git a/src/Tools/blocFissure/gmu/ellipsoideDefaut.py b/src/Tools/blocFissure/gmu/ellipsoideDefaut.py new file mode 100644 index 000000000..3940d57ca --- /dev/null +++ b/src/Tools/blocFissure/gmu/ellipsoideDefaut.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +import logging +import math +from geomsmesh import geompy +from triedreBase import triedreBase +O, OX, OY, OZ = triedreBase() + +# ----------------------------------------------------------------------------- +# --- ellipsoide defaut + +def ellipsoideDefaut(minRad,allonge,rayTore): + """ + Le bloc contenant la fissure est un ellipsoide construit centre a l'origine, + contenant le tore elliptique de fissure + @param minRad :petit rayon + @param allonge :rapport grand rayon / petit rayon + @param rayTore :rayon du tore construit autour de la generatrice de l'ellipse + @return ellipsoide (geomObject) + """ + logging.info("start") + boule = geompy.MakeSphereR(2) + bouler = geompy.MakeRotation(boule, OY, math.pi/2.0) + face = geompy.MakeFaceHW(100, 100, 3) + boulepart = geompy.MakePartition([bouler], [face], [], [], geompy.ShapeType["SOLID"], 0, [], 0) + solids = geompy.ExtractShapes(boulepart, geompy.ShapeType["SOLID"], True) + solid0 = solids[0] + for i in range(1,len(solids)): + solid0 = geompy.MakeFuse(solid0, solids[i]) + ellipsoide = geompy.MakeScaleAlongAxes(solid0, O, minRad, minRad*(allonge+2.0)/2.0, minRad) # on limite l'allongement de l'ellipsoide + #geompy.addToStudy( ellipsoide, 'ellipsoide' ) + return ellipsoide diff --git a/src/Tools/blocFissure/gmu/enleveDefaut.py b/src/Tools/blocFissure/gmu/enleveDefaut.py new file mode 100644 index 000000000..011c76485 --- /dev/null +++ b/src/Tools/blocFissure/gmu/enleveDefaut.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +import logging + +# ----------------------------------------------------------------------------- +# --- maillage sain sans la zone defaut + +def enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges): + """ + Maillage sain sans la zone de defaut + TODO: a completer + """ + logging.info('start') + + maillageSain.RemoveGroupWithContents(zoneDefaut) + if zoneDefaut_skin is not None: + maillageSain.RemoveGroupWithContents(zoneDefaut_skin) + if zoneDefaut_internalFaces is not None: + maillageSain.RemoveGroupWithContents(zoneDefaut_internalFaces) + if zoneDefaut_internalEdges is not None: + maillageSain.RemoveGroupWithContents(zoneDefaut_internalEdges) + nbRemoved = maillageSain.RemoveOrphanNodes() + return maillageSain + diff --git a/src/Tools/blocFissure/gmu/extractionOrientee.py b/src/Tools/blocFissure/gmu/extractionOrientee.py new file mode 100644 index 000000000..2ea9e52f9 --- /dev/null +++ b/src/Tools/blocFissure/gmu/extractionOrientee.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +from whichSide import whichSide + +# ----------------------------------------------------------------------------- +# --- renvoie l'extraction des shapes d'un objet selon leur position par rapport à la face. + +def extractionOrientee(face, obj, ref, shapeType, tol, prefix=""): + """ + renvoie l'extraction des shapes d'un objet selon leur position + par rapport à la face. + shapeType in ["VERTEX", "EDGE", "FACE",...] + """ + logging.info('start') + trace = True + sideRef = whichSide(face, ref) + logging.debug("ref side %s", sideRef) + shapesInside = [] + shapesOutside = [] + shapesOnside = [] + shapes = geompy.ExtractShapes(obj, geompy.ShapeType[shapeType], False) + i=0 + j=0 + k=0 + prefix = prefix + shapeType + for shape in shapes: + side = whichSide(face, shape, tol) + if side == sideRef: + shapesInside.append(shape) + if trace: + name = prefix + "_Inside%d"%i + geompy.addToStudyInFather(obj, shape, name) + i+=1 + elif side == -sideRef: + shapesOutside.append(shape) + if trace: + name = prefix + "_Outside%d"%j + geompy.addToStudyInFather(obj, shape, name) + j+=1 + elif side == 0: + shapesOnside.append(shape) + if trace: + name = prefix + "_Onside%d"%k + geompy.addToStudyInFather(obj, shape, name) + k+=1 + logging.debug("--- shape was %s", name) + return [shapesInside, shapesOutside, shapesOnside] + diff --git a/src/Tools/blocFissure/gmu/extractionOrienteeMulti.py b/src/Tools/blocFissure/gmu/extractionOrienteeMulti.py new file mode 100644 index 000000000..86faec83d --- /dev/null +++ b/src/Tools/blocFissure/gmu/extractionOrienteeMulti.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +from whichSideMulti import whichSideMulti + +# ----------------------------------------------------------------------------- +# --- renvoie l'extraction des shapes d'un objet selon leur position par rapport à la face. + +def extractionOrienteeMulti(faces, ifil, obj, centre, shapeType, tol, prefix=""): + """ + renvoie l'extraction des shapes d'un objet selon leur position + par rapport aux faces. + shapeType in ["VERTEX", "EDGE", "FACE",...] + """ + logging.info('start') + trace = True + shapesInside = [] + shapesOutside = [] + shapesOnside = [] + shapes = geompy.ExtractShapes(obj, geompy.ShapeType[shapeType], False) + i=0 + j=0 + k=0 + prefix = prefix + shapeType + for shape in shapes: + side = whichSideMulti(faces, ifil, shape, centre, tol) + if side == 1: + shapesInside.append(shape) + if trace: + name = prefix + "_Inside%d"%i + geompy.addToStudyInFather(obj, shape, name) + i+=1 + elif side == -1: + shapesOutside.append(shape) + if trace: + name = prefix + "_Outside%d"%j + geompy.addToStudyInFather(obj, shape, name) + j+=1 + elif side == 0: + shapesOnside.append(shape) + if trace: + name = prefix + "_Onside%d"%k + geompy.addToStudyInFather(obj, shape, name) + k+=1 + logging.debug("--- shape was %s", name) + return [shapesInside, shapesOutside, shapesOnside] + diff --git a/src/Tools/blocFissure/gmu/facesCirculaires.py b/src/Tools/blocFissure/gmu/facesCirculaires.py new file mode 100644 index 000000000..daca717f2 --- /dev/null +++ b/src/Tools/blocFissure/gmu/facesCirculaires.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- TORE +## --- faces 1/2 circulaires et leur centre, edges de ces faces dans le plan de fissure + +def facesCirculaires(bloc, tore): + """ + Extraction des faces demi circulaires à l'intersection du tore partitionné et de la paroi, + de leur centre, les edges de ces faces situees dans le plan de fissure et un booleen par edge, + indiquant son sens (normal / reversed). + @param bloc : bloc defaut + @param tore : le tore partitionné et coupé + @return (faces, centres, edges, reverses) + """ + logging.info("start") + + faces = geompy.GetShapesOnShape(bloc, tore, geompy.ShapeType["FACE"], GEOM.ST_ON) + + geompy.addToStudyInFather( tore, faces[0], 'face0' ) + geompy.addToStudyInFather( tore, faces[1], 'face1' ) + geompy.addToStudyInFather( tore, faces[2], 'face2' ) + geompy.addToStudyInFather( tore, faces[3], 'face3' ) + + centres = [None, None, None, None] + [v1,centres[0],v3] = geompy.ExtractShapes(faces[0], geompy.ShapeType["VERTEX"], True) + [v1,centres[1],v3] = geompy.ExtractShapes(faces[1], geompy.ShapeType["VERTEX"], True) + [v1,centres[2],v3] = geompy.ExtractShapes(faces[2], geompy.ShapeType["VERTEX"], True) + [v1,centres[3],v3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["VERTEX"], True) + + geompy.addToStudyInFather( faces[0], centres[0], 'centre0' ) + geompy.addToStudyInFather( faces[1], centres[1], 'centre1' ) + geompy.addToStudyInFather( faces[2], centres[2], 'centre2' ) + geompy.addToStudyInFather( faces[3], centres[3], 'centre3' ) + + alledges = [None, None, None, None] + alledges[0] = geompy.ExtractShapes(faces[0], geompy.ShapeType["EDGE"], True) + alledges[1] = geompy.ExtractShapes(faces[1], geompy.ShapeType["EDGE"], True) + alledges[2] = geompy.ExtractShapes(faces[2], geompy.ShapeType["EDGE"], True) + alledges[3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["EDGE"], True) + + dicoedge = {} + edges = [] + reverses = [] + for i in range(len(alledges)): + edgesface = alledges[i] + lenef = [] + for j in range(len(edgesface)): + props = geompy.BasicProperties(edgesface[j]) + lenef.append(props[0]) + pass + maxlen = max(lenef) + for j in range(len(edgesface)): + if lenef[j] < maxlen: + edgid = geompy.GetSubShapeID(tore, edgesface[j]) + if not (edgid in dicoedge): + dicoedge[edgid] = edgesface[j] + edges.append(edgesface[j]) + named = 'edge_' + str(i) + '_' +str(j) + geompy.addToStudyInFather( faces[i], edgesface[j], named) + vertices = geompy.ExtractShapes(edgesface[j], geompy.ShapeType["VERTEX"], False) + #firstVertex = geompy.GetFirstVertex(edgesface[j]) + if geompy.GetSubShapeID(tore, vertices[0]) != geompy.GetSubShapeID(tore, centres[i]): + reverses.append(1) + #print 'reversed ' + str(edgid) + else: + reverses.append(0) + #print 'normal' + str(edgid) + pass + pass + pass + pass + + return faces, centres, edges, reverses + diff --git a/src/Tools/blocFissure/gmu/facesFissure.py b/src/Tools/blocFissure/gmu/facesFissure.py new file mode 100644 index 000000000..1cbf8cea4 --- /dev/null +++ b/src/Tools/blocFissure/gmu/facesFissure.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- faces fissure dans et hors tore, et edges face hors tore + +def facesFissure(blocp, faceFissure, extrusionDefaut, genint): + """ + extraction des faces de fissure dans et hors tore, des edges le long du tore et en paroi + @param faceFissure : la face de fissure avec la partie dans le tore elliptique et la partie externe + @return (facefissintore, facefissoutore, edgeint, edgeext) + """ + logging.info('start') + + [f0,f1] = geompy.ExtractShapes(faceFissure, geompy.ShapeType["FACE"], True) + ed0 = geompy.ExtractShapes(f0, geompy.ShapeType["EDGE"], True) + ed1 = geompy.ExtractShapes(f1, geompy.ShapeType["EDGE"], True) + if len(ed0) > len(ed1): + facefissintore = f0 + facefissoutore = f1 + else: + facefissintore = f1 + facefissoutore = f0 + + geompy.addToStudyInFather(faceFissure, facefissintore,'facefissintore') + geompy.addToStudyInFather(faceFissure, facefissoutore,'facefissoutore') + + edgeint = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_IN) + edgeext = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_ON) + + for i in range(len(edgeint)): + name = "edgeint_%d"%i + geompy.addToStudyInFather(facefissoutore, edgeint[i],name) + for i in range(len(edgeext)): + name = "edgeext_%d"%i + geompy.addToStudyInFather(facefissoutore, edgeext[i],name) + + reverext = [] + if len(edgeext) > 1: + vertices = geompy.ExtractShapes(genint, geompy.ShapeType["VERTEX"], False) + for i in range(len(edgeext)): + vertedge = geompy.ExtractShapes(edgeext[i], geompy.ShapeType["VERTEX"], False) + if ((geompy.GetSubShapeID(blocp, vertedge[0]) == geompy.GetSubShapeID(blocp, vertices[0])) or + (geompy.GetSubShapeID(blocp, vertedge[0]) == geompy.GetSubShapeID(blocp, vertices[1]))): + reverext.append(0) + else: + reverext.append(1) + + return facefissintore, facefissoutore, edgeint, edgeext, reverext diff --git a/src/Tools/blocFissure/gmu/facesToreInBloc.py b/src/Tools/blocFissure/gmu/facesToreInBloc.py new file mode 100644 index 000000000..043155426 --- /dev/null +++ b/src/Tools/blocFissure/gmu/facesToreInBloc.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- identification des faces tore et fissure dans le solide hors tore du bloc partitionné + +def facesToreInBloc(blocp, facefissoutore, facetore1, facetore2): + """ + identification des faces tore et fissure dans le bloc partitionné : sous shapes du bloc + @param blocp : bloc partitionné + @param facefissoutore : la face de fissure externe au tore + @param facetore1 : face du tore selon la génératrice + @param facetore2 : face du tore selon la génératrice + @return (blocFaceFiss, blocFaceTore1, blocFaceTore2) sous shapes reperées + """ + logging.info('start') + + blocFaceFiss = geompy.GetInPlaceByHistory(blocp, facefissoutore) + blocFaceTore1 = geompy.GetInPlaceByHistory(blocp, facetore1) + blocFaceTore2 = geompy.GetInPlaceByHistory(blocp, facetore2) + + geompy.addToStudyInFather(blocp, blocFaceFiss,'blocFaceFiss') + geompy.addToStudyInFather(blocp, blocFaceTore1,'blocFaceTore1') + geompy.addToStudyInFather(blocp, blocFaceTore2,'blocFaceTore2') + + return blocFaceFiss, blocFaceTore1, blocFaceTore2 + diff --git a/src/Tools/blocFissure/gmu/facesVolumesToriques.py b/src/Tools/blocFissure/gmu/facesVolumesToriques.py new file mode 100644 index 000000000..2ad4dc6e7 --- /dev/null +++ b/src/Tools/blocFissure/gmu/facesVolumesToriques.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy +from extractionOrientee import extractionOrientee +from getSubshapeIds import getSubshapeIds + +# ----------------------------------------------------------------------------- +# --- TORE +# --- faces toriques et volumes du tore + +def facesVolumesToriques(tore, plan, facesDefaut): + """ + Extraction des deux faces et volumes du tore partitionné, qui suivent la génératrice elliptique. + @param tore : le tore partitionné et coupé. + @param plan : le plan de coupe + @return (facetore1,facetore2) les 2 faces selon la génératrice + """ + logging.info("start") + + centre = geompy.MakeVertexOnSurface(plan, 0.5, 0.5) + normal = geompy.GetNormal(plan, centre) + reference = geompy.MakeTranslationVector(centre, normal) + + [facesInPlan, facesOutPlan, facesOnPlan] = extractionOrientee(plan, tore, reference, "FACE", 1.e-2, "faceTorePlan_") + [facesInSide, facesOutSide, facesOnSide] = extractionOrientee(facesDefaut, tore, reference, "FACE", 1.e-2, "faceTorePeau_") + facesIdInPlan = getSubshapeIds(tore, facesInPlan) + facesIdOutPlan = getSubshapeIds(tore, facesOutPlan) + facesIdOnSide = getSubshapeIds(tore, facesOnSide) + facesIdInSide = getSubshapeIds(tore, facesInSide) + facesIdOutSide = getSubshapeIds(tore, facesOutSide) + #facesIdInOutSide = facesIdInSide + facesIdOutSide + facetore1 = None + faceTore2 = None + for i, faceId in enumerate(facesIdInPlan): + if faceId not in facesIdOnSide: + facetore1 = facesInPlan[i] + break + for i, faceId in enumerate(facesIdOutPlan): + if faceId not in facesIdOnSide: + facetore2 = facesOutPlan[i] + break + + #[facetore1,facetore2] = geompy.GetShapesOnShape(pipe0, tore, geompy.ShapeType["FACE"], GEOM.ST_ON) + + geompy.addToStudyInFather( tore, facetore1, 'facetore1' ) + geompy.addToStudyInFather( tore, facetore2, 'facetore2' ) + + [volumeTore1, volumeTore2] = geompy.ExtractShapes(tore, geompy.ShapeType["SOLID"], True) + geompy.addToStudyInFather( tore, volumeTore1, 'volumeTore1' ) + geompy.addToStudyInFather( tore, volumeTore2, 'volumeTore2' ) + + return facetore1, facetore2, volumeTore1, volumeTore2 diff --git a/src/Tools/blocFissure/gmu/findWireEndVertices.py b/src/Tools/blocFissure/gmu/findWireEndVertices.py new file mode 100644 index 000000000..1196e28bd --- /dev/null +++ b/src/Tools/blocFissure/gmu/findWireEndVertices.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- trouver les vertices extremites d'un wire + +def findWireEndVertices(aWire, getNormals=False): + """ + trouver les vertices extremites d'un wire + calcul optionnel des tangentes. Attention à la tolérance qui peut être élevée (> 0.001) + """ + logging.info("start") + if geompy.NumberOfEdges(aWire) > 1: + edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False) + else: + edges = [aWire] + vertices = [] + idsubs = {} + shortList = [] + if getNormals: + normals = [] + idnorm = {} + shortNorm = [] + for edge in edges: + vert = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False) + vertices += vert + if getNormals: + v0 = geompy.MakeVertexOnCurve(edge, 0.0) + n0 = geompy.MakeTangentOnCurve(edge, 0.0) + v1 = geompy.MakeVertexOnCurve(edge, 1.0) + n1 = geompy.MakeTangentOnCurve(edge, 1.0) + dist = geompy.MinDistance(v0, vert[0]) + logging.debug("distance %s", dist) + if dist < 1.e-2: + normals += [n0, n1] + else: + normals += [n1, n0] + for i, sub in enumerate(vertices): + subid = geompy.GetSubShapeID(aWire, sub) + if subid in idsubs.keys(): + idsubs[subid].append(sub) + else: + idsubs[subid] = [sub] + name='vertex%d'%i + geompy.addToStudyInFather(aWire, sub, name) + if getNormals: + idnorm[subid] = normals[i] + name='norm%d'%i + geompy.addToStudyInFather(aWire, normals[i], name) + logging.debug("idsubs: %s", idsubs) + for k, v in idsubs.iteritems(): + if len(v) == 1: + shortList.append(v[0]) + if getNormals: + shortNorm.append(idnorm[k]) + if getNormals: + return shortList, shortNorm + else: + return shortList + diff --git a/src/Tools/blocFissure/gmu/findWireIntermediateVertices.py b/src/Tools/blocFissure/gmu/findWireIntermediateVertices.py new file mode 100644 index 000000000..3b8b40591 --- /dev/null +++ b/src/Tools/blocFissure/gmu/findWireIntermediateVertices.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- trouver les vertices intermediaires d'un wire + +def findWireIntermediateVertices(aWire, getNormals=False): + """ + trouver les vertices d'un wire qui ne sont pas aux extremités + calcul optionnel des tangentes. Attention à la tolérance qui peut être élevée (> 0.001) + """ + logging.info("start") + edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False) + vertices = [] + idsubs = {} + shortList = [] + if getNormals: + normals = [] + idnorm = {} + shortNorm = [] + for edge in edges: + vert = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False) + vertices += vert + if getNormals: + v0 = geompy.MakeVertexOnCurve(edge, 0.0) + n0 = geompy.MakeTangentOnCurve(edge, 0.0) + v1 = geompy.MakeVertexOnCurve(edge, 1.0) + n1 = geompy.MakeTangentOnCurve(edge, 1.0) + dist = geompy.MinDistance(v0, vert[0]) + logging.debug("distance %s", dist) + if dist < 1.e-2: + normals += [n0, n1] + else: + normals += [n1, n0] + for i, sub in enumerate(vertices): + subid = geompy.GetSubShapeID(aWire, sub) + if subid in idsubs.keys(): + idsubs[subid].append(sub) + else: + idsubs[subid] = [sub] + name='vertex%d'%i + geompy.addToStudyInFather(aWire, sub, name) + if getNormals: + idnorm[subid] = normals[i] + name='norm%d'%i + geompy.addToStudyInFather(aWire, normals[i], name) + for k, v in idsubs.iteritems(): + if len(v) > 1: + shortList.append(v[0]) + if getNormals: + shortNorm.append(idnorm[k]) + if getNormals: + return shortList, shortNorm + else: + return shortList + diff --git a/src/Tools/blocFissure/gmu/fissureCoude.py b/src/Tools/blocFissure/gmu/fissureCoude.py new file mode 100644 index 000000000..0490611aa --- /dev/null +++ b/src/Tools/blocFissure/gmu/fissureCoude.py @@ -0,0 +1,669 @@ +# -*- coding: utf-8 -*- + +from geomsmesh import geompy, smesh + +import math +import GEOM +import SALOMEDS +import SMESH +#import StdMeshers +#import GHS3DPlugin +#import NETGENPlugin +import logging + +from fissureGenerique import fissureGenerique + +from triedreBase import triedreBase +from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from insereFissureGenerale import insereFissureGenerale +from sortEdges import sortEdges + +O, OX, OY, OZ = triedreBase() + +class fissureCoude(fissureGenerique): + """ + problème de fissure du Coude : version de base + maillage hexa + """ + + nomProbleme = "tuyau_Coude" + + # --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = 60, + r_cintr = 1200, + l_tube_p1 = 1600, + l_tube_p2 = 1200, + epais = 40, + de = 760) + + # --------------------------------------------------------------------------- + def genereGeometrieSaine(self, geomParams): + logging.info("genereGeometrieSaine %s", self.nomCas) + + angleCoude = geomParams['angleCoude'] + r_cintr = geomParams['r_cintr'] + l_tube_p1 = geomParams['l_tube_p1'] + l_tube_p2 = geomParams['l_tube_p2'] + epais = geomParams['epais'] + de = geomParams['de'] + + centre = geompy.MakeVertex(0, 0, -l_tube_p1) + diskext = geompy.MakeDiskPntVecR(centre, OZ, de/2.) + diskint = geompy.MakeDiskPntVecR(centre, OZ, de/2. -epais) + couronne = geompy.MakeCut(diskext, diskint) + tube_1 = geompy.MakePrismVecH(couronne, OZ, l_tube_p1) + axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1) + coude = geompy.MakeRevolution(couronne, axe, angleCoude*math.pi/180.0) + Rotation_1 = geompy.MakeRotation(couronne, axe, angleCoude*math.pi/180.0) + Rotation_2 = geompy.MakeRotation(OZ, OY, angleCoude*math.pi/180.0) + tube_2 = geompy.MakePrismVecH(Rotation_1, Rotation_2, -l_tube_p2) + plan_y = geompy.MakePlaneLCS(None, 100000, 3) + geompy.addToStudy( plan_y, "plan_y" ) + geompy.addToStudy( tube_1, "tube_1" ) + geompy.addToStudy( coude, "coude" ) + geompy.addToStudy( tube_2, "tube_2" ) + + P1 = O + geompy.addToStudy( P1, "P1" ) + op2 = geompy.MakeVertex(0, 0, -l_tube_p1) + P2 = geompy.MakeRotation(op2, axe, angleCoude*math.pi/180.0) + P2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, -l_tube_p2) + geompy.addToStudy( P2, "P2" ) + + # --- tube coude sain + + geometrieSaine = geompy.MakePartition([tube_1, coude, tube_2, P1, P2], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1) + geompy.addToStudy( geometrieSaine, self.nomCas ) + [P1, P2] = geompy.RestoreGivenSubShapes(geometrieSaine, [P1, P2], GEOM.FSM_GetInPlaceByHistory, False, True) + + xmin = -de -r_cintr -l_tube_p2 + zmin = -l_tube_p1 -r_cintr -l_tube_p2 -de + ymax = de +100. + boxypos = geompy.MakeBox(xmin, 0, zmin, ymax, ymax, 100, "boxypos") + boxyneg = geompy.MakeBox(xmin, 0, zmin, ymax, -ymax, 100, "boxyneg") + edgesypos = geompy.GetShapesOnShape(boxypos, geometrieSaine, geompy.ShapeType["EDGE"], GEOM.ST_IN) + edgesyneg = geompy.GetShapesOnShape(boxyneg, geometrieSaine, geompy.ShapeType["EDGE"], GEOM.ST_IN) + circ_g = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"]) + geompy.UnionList(circ_g, edgesyneg) + circ_d = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"]) + geompy.UnionList(circ_d, edgesypos) + edgesy0pos = geompy.GetShapesOnShape(boxypos, geometrieSaine, geompy.ShapeType["EDGE"], GEOM.ST_ONIN) + grpedpos = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"]) + geompy.UnionList(grpedpos, edgesy0pos) + grpedy0 = geompy.CutGroups(grpedpos, circ_d, "edges_y0") + boxtub1 = geompy.MakeBox(-de/2.0 -1, -1, -l_tube_p1, de, de, 0, "boxtub1") + edgestub1 = geompy.GetShapesOnShape(boxtub1, geometrieSaine, geompy.ShapeType["EDGE"], GEOM.ST_IN) + grped = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"]) + geompy.UnionList(grped, edgestub1) + long_p1 = geompy.IntersectGroups(grped, grpedy0) + boxtub = geompy.MakeBox(-de/2.0 -1, -1, -l_tube_p1 -l_tube_p2, de, de, -l_tube_p1) + boxtub2 = geompy.MakeRotation(boxtub, axe, angleCoude*math.pi/180.0, "boxttub2") + edgestub2 = geompy.GetShapesOnShape(boxtub2, geometrieSaine, geompy.ShapeType["EDGE"], GEOM.ST_IN) + grped = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"]) + geompy.UnionList(grped, edgestub2) + long_p2 = geompy.IntersectGroups(grped, grpedy0) + boxtub1t = geompy.MakeTranslationVectorDistance(boxtub1, OZ, -l_tube_p1) + facer = geompy.GetShapesOnShape(boxtub1t, boxtub1, geompy.ShapeType["FACE"], GEOM.ST_ONIN, "facer") + boxcoud = geompy.MakeRevolution(facer[0], axe, angleCoude*math.pi/180.0, "boxcoud") + edgescoud = geompy.GetShapesOnShape(boxcoud, geometrieSaine, geompy.ShapeType["EDGE"], GEOM.ST_IN) + grped = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"]) + geompy.UnionList(grped, edgescoud) + long_coude = geompy.IntersectGroups(grped, grpedy0) + grped = geompy.CutGroups(grpedy0, long_p1) + grped = geompy.CutGroups(grped, long_p2) + ep = geompy.CutGroups(grped, long_coude) + geompy.addToStudyInFather( geometrieSaine, long_p1, 'long_p1' ) + geompy.addToStudyInFather( geometrieSaine, ep, 'ep' ) + geompy.addToStudyInFather( geometrieSaine, long_coude, 'long_coude' ) + geompy.addToStudyInFather( geometrieSaine, circ_g, 'circ_g' ) + geompy.addToStudyInFather( geometrieSaine, circ_d, 'circ_d' ) + geompy.addToStudyInFather( geometrieSaine, long_p2, 'long_p2' ) + + # --- face extremite tube (EXTUBE) + + facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], OZ, GEOM.ST_ON) + EXTUBE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) + geompy.UnionIDs(EXTUBE, facesIds) + geompy.addToStudyInFather( geometrieSaine, EXTUBE, 'EXTUBE' ) + + # --- edge bord extremite tube (BORDTU) + + edge1Ids = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["EDGE"], OZ, GEOM.ST_ON) + edge2Ids = geompy.GetShapesOnCylinderIDs(geometrieSaine, geompy.ShapeType["EDGE"], OZ, de/2. -epais, GEOM.ST_ON) + edgesIds = [] + for edge in edge1Ids: + if edge in edge2Ids: + edgesIds.append(edge) + BORDTU = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(BORDTU, edgesIds) + geompy.addToStudyInFather( geometrieSaine, BORDTU, 'BORDTU' ) + + # --- face origine tube (CLGV) + + pp2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, 10) + vec2 = geompy.MakeVector(P2, pp2) + #geompy.addToStudy(vec2, 'vec2') + facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON) + CLGV = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) + geompy.UnionIDs(CLGV, facesIds) + geompy.addToStudyInFather( geometrieSaine, CLGV, 'CLGV' ) + + # --- peau tube interieur (PEAUINT) + + extru1 = geompy.MakePrismVecH(diskint, OZ, l_tube_p1) + revol1 = geompy.MakeRevolution(diskint, axe, angleCoude*math.pi/180.0) + rot1 = geompy.MakeRotation(diskint, axe, angleCoude*math.pi/180.0) + extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2) + interne = geompy.MakeFuse(extru1, revol1) + interne = geompy.MakeFuse(extru2, interne) + geompy.addToStudy(interne, 'interne') + facesIds = geompy.GetShapesOnShapeIDs(interne, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ONIN) + PEAUINT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) + geompy.UnionIDs(PEAUINT, facesIds) + geompy.addToStudyInFather( geometrieSaine, PEAUINT, 'PEAUINT' ) + + # --- peau tube exterieur (PEAUEXT) + + cercle1 = geompy.MakeCircle(centre, OZ, de/2.) + extru1 = geompy.MakePrismVecH(cercle1, OZ, l_tube_p1) + revol1 = geompy.MakeRevolution(cercle1, axe, angleCoude*math.pi/180.0) + rot1 = geompy.MakeRotation(cercle1, axe, angleCoude*math.pi/180.0) + extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2) + externe = geompy.MakeFuse(extru1, revol1) + externe = geompy.MakeFuse(extru2, externe) + geompy.addToStudy(externe, 'externe') + facesIds = geompy.GetShapesOnShapeIDs(externe, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ON) + PEAUEXT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) + geompy.UnionIDs(PEAUEXT, facesIds) + geompy.addToStudyInFather( geometrieSaine, PEAUEXT, 'PEAUEXT' ) + + # --- solide sain + + volIds = geompy.SubShapeAllIDs(geometrieSaine, geompy.ShapeType["SOLID"]) + COUDE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["SOLID"]) + geompy.UnionIDs(COUDE, volIds) + geompy.addToStudyInFather( geometrieSaine, COUDE, 'COUDSAIN' ) + + geometriesSaines = [geometrieSaine, long_p1, ep, long_coude, circ_g, circ_d, long_p2, P1, P2, EXTUBE, BORDTU, CLGV, PEAUINT, PEAUEXT, COUDE] + + return geometriesSaines + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = 16, + n_ep = 3, + n_long_coude = 15, + n_circ_g = 20, + n_circ_d = 20, + n_long_p2 = 12) + + # --------------------------------------------------------------------------- + def genereMaillageSain(self, geometriesSaines, meshParams): + logging.info("genereMaillageSain %s", self.nomCas) + + geometrieSaine = geometriesSaines[0] + long_p1 = geometriesSaines[1] + ep = geometriesSaines[2] + long_coude = geometriesSaines[3] + circ_g = geometriesSaines[4] + circ_d = geometriesSaines[5] + long_p2 = geometriesSaines[6] + P1 = geometriesSaines[7] + P2 = geometriesSaines[8] + EXTUBE = geometriesSaines[9] + BORDTU = geometriesSaines[10] + CLGV = geometriesSaines[11] + PEAUINT = geometriesSaines[12] + PEAUEXT = geometriesSaines[13] + COUDE = geometriesSaines[14] + + n_long_p1 = meshParams['n_long_p1'] + n_ep = meshParams['n_ep'] + n_long_coude = meshParams['n_long_coude'] + n_circ_g = meshParams['n_circ_g'] + n_circ_d = meshParams['n_circ_d'] + n_long_p2 = meshParams['n_long_p2'] + + maillageSain = smesh.Mesh(geometrieSaine) + + algo3d = maillageSain.Hexahedron() + algo2d = maillageSain.Quadrangle() + smesh.SetName(algo3d, "algo3d_maillageSain") + smesh.SetName(algo2d, "algo2d_maillageSain") + + algo1d_long_p1 = maillageSain.Segment(geom=long_p1) + hypo1d_long_p1 = algo1d_long_p1.NumberOfSegments(n_long_p1) + smesh.SetName(algo1d_long_p1, "algo1d_long_p1") + smesh.SetName(hypo1d_long_p1, "hypo1d_long_p1") + + algo1d_ep = maillageSain.Segment(geom=ep) + hypo1d_ep = algo1d_ep.NumberOfSegments(n_ep) + smesh.SetName(algo1d_ep, "algo1d_ep") + smesh.SetName(hypo1d_ep, "hypo1d_ep") + + algo1d_long_coude = maillageSain.Segment(geom=long_coude) + hypo1d_long_coude = algo1d_long_coude.NumberOfSegments(n_long_coude) + smesh.SetName(algo1d_long_coude, "algo1d_long_coude") + smesh.SetName(hypo1d_long_coude, "hypo1d_long_coude") + + algo1d_circ_g = maillageSain.Segment(geom=circ_g) + hypo1d_circ_g = algo1d_circ_g.NumberOfSegments(n_circ_g) + smesh.SetName(algo1d_circ_g, "algo1d_circ_g") + smesh.SetName(hypo1d_circ_g, "hypo1d_circ_g") + + algo1d_circ_d = maillageSain.Segment(geom=circ_d) + hypo1d_circ_d = algo1d_circ_d.NumberOfSegments(n_circ_d) + smesh.SetName(algo1d_circ_d, "algo1d_circ_d") + smesh.SetName(hypo1d_circ_d, "hypo1d_circ_d") + + algo1d_long_p2 = maillageSain.Segment(geom=long_p2) + hypo1d_long_p2 = algo1d_long_p2.NumberOfSegments(n_long_p2) + smesh.SetName(algo1d_long_p2, "algo1d_long_p2") + smesh.SetName(hypo1d_long_p2, "hypo1d_long_p2") + + isDone = maillageSain.Compute() + + mp1 = maillageSain.GroupOnGeom(P1,'P1',SMESH.NODE) + mp2 = maillageSain.GroupOnGeom(P2,'P2',SMESH.NODE) + ext = maillageSain.GroupOnGeom(EXTUBE,'EXTUBE',SMESH.FACE) + btu = maillageSain.GroupOnGeom(BORDTU,'BORDTU',SMESH.EDGE) + clg = maillageSain.GroupOnGeom(CLGV,'CLGV',SMESH.FACE) + pei = maillageSain.GroupOnGeom(PEAUINT,'PEAUINT',SMESH.FACE) + pex = maillageSain.GroupOnGeom(PEAUEXT,'PEAUEXT',SMESH.FACE) + cou = maillageSain.GroupOnGeom(COUDE,'COUDSAIN',SMESH.VOLUME) + + return [maillageSain, True] # True : maillage hexa + + # --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour le tuyau coude + profondeur : 0 < profondeur <= épaisseur + rayonPipe : rayon du pipe correspondant au maillage rayonnant + lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut) + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe). + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites) + pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) + externe : True : fissure face externe, False : fissure face interne + """ + logging.info("setParamShapeFissure %s", self.nomCas) + self.shapeFissureParams = dict(profondeur = 10, + rayonPipe = 2.5, + lenSegPipe = 2.5, + azimut = 160, + alpha = 20, + longueur = 400, + orientation = 90, + lgInfluence = 50, + elliptique = False, + externe = True) + + # --------------------------------------------------------------------------- + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): + logging.info("genereShapeFissure %s", self.nomCas) + logging.info("shapeFissureParams %s", shapeFissureParams) + + angleCoude = geomParams['angleCoude'] + r_cintr = geomParams['r_cintr'] + l_tube_p1 = geomParams['l_tube_p1'] + l_tube_p2 = geomParams['l_tube_p2'] + epais = geomParams['epais'] + de = geomParams['de'] + + profondeur = shapeFissureParams['profondeur'] + azimut = shapeFissureParams['azimut'] + alpha = shapeFissureParams['alpha'] + longueur = shapeFissureParams['longueur'] + orientation = shapeFissureParams['orientation'] + externe = shapeFissureParams['externe'] + lgInfluence = shapeFissureParams['lgInfluence'] + self.elliptique = False + if shapeFissureParams.has_key('elliptique'): + self.elliptique = shapeFissureParams['elliptique'] + + + + azimut = -azimut # axe inverse / ASCOUF + axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1) + geompy.addToStudy(axe,"axe") + + if not lgInfluence: + lgInfluence = profondeur + + if longueur > 2*profondeur: + self.fissureLongue=True + else: + self.fissureLongue=False + self.elliptique = True + + self.circonferentielle = False + self.longitudinale = False + if self.fissureLongue and not self.elliptique: + if abs(orientation) < 45 : + self.longitudinale = True + else: + self.circonferentielle = True + + nbp1 = 10 + if self.circonferentielle: + if externe: + dp = -1.0 + raybor = de/2. + rayint = raybor - profondeur + rayext = raybor + profondeur/5.0 + else: + dp = 1.0 + raybor = de/2. - epais + rayint = raybor + profondeur + rayext = raybor - profondeur/5.0 + lgfond = longueur -2*profondeur + angle = lgfond/(2*raybor) + pb = geompy.MakeVertex(raybor, 0, 0) + pi = geompy.MakeVertex(rayint, 0, 0) + pbl = geompy.MakeRotation(pb, OZ, angle) + pbr = geompy.MakeRotation(pb, OZ, -angle) + geompy.addToStudy(pbl,"pbl") + geompy.addToStudy(pbr,"pbr") + pal = geompy.MakeTranslationVector(pbl, OZ) + par = geompy.MakeTranslationVector(pbr, OZ) + axl = geompy.MakeVector(pbl,pal) + axr = geompy.MakeVector(pbr,par) + pil = geompy.MakeRotation(pi, OZ, angle) + pir = geompy.MakeRotation(pi, OZ, -angle) + points = [] + nbp = 3*nbp1 + for i in range(nbp): + angi = dp*(nbp -i)*(2.0*math.pi/3.0)/nbp + pt = geompy.MakeRotation(pil, axl, angi) + points.append(pt) + for i in range(nbp): + angi = angle -2.0*i*angle/nbp + pt = geompy.MakeRotation(pi, OZ, angi) + points.append(pt) + for i in range(nbp+1): + angi = -dp*i*(2.0*math.pi/3.0)/nbp + pt = geompy.MakeRotation(pir, axr, angi) + points.append(pt) + for i, pt in enumerate(points): + pt = geompy.MakeRotation(pt, OZ, azimut*math.pi/180.) + pt = geompy.MakeTranslation(pt, 0, 0, -l_tube_p1) + pt = geompy.MakeRotation(pt, axe, alpha*math.pi/180.) + points[i] = pt + wire0 = geompy.MakeInterpol(points[0:nbp+1]) + wire1 = geompy.MakeInterpol(points[nbp:2*nbp+1]) + wire2 = geompy.MakeInterpol(points[2*nbp:3*nbp+1]) + #wiretube = geompy.MakeInterpol(points) + wiretube=geompy.MakeWire([wire0,wire1,wire2]) + geompy.addToStudy(wiretube,"wiretube") + + pe = geompy.MakeVertex(rayext, 0, 0) + pe = geompy.MakeRotation(pe, OZ, azimut*math.pi/180.) + pe = geompy.MakeTranslation(pe, 0, 0, -l_tube_p1) + pe = geompy.MakeRotation(pe, axe, alpha*math.pi/180.) + + arce = geompy.MakeArc(points[0], pe, points[-1]) + geompy.addToStudy(arce,"arce") + + facefiss = geompy.MakeFaceWires([arce, wiretube], 1) + geompy.addToStudy( facefiss, 'facefissPlace' ) + + pc = geompy.MakeVertex((raybor + rayint)/2.0, 0, 0) + centre = geompy.MakeRotation(pc, OZ, azimut*math.pi/180.) + centre = geompy.MakeTranslation(centre, 0, 0, -l_tube_p1) + centre = geompy.MakeRotation(centre, axe, alpha*math.pi/180.) + geompy.addToStudy( centre, 'centrefissPlace' ) + + wiretube = geompy.GetInPlace(facefiss, wiretube) + geompy.addToStudy(wiretube, 'wiretubePlace' ) + try: + edgetube = geompy.MakeEdgeWire(wiretube) + geompy.addToStudy(edgetube,"edgetube") + except: + logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans") + edgetube = None + + # --------------------------------------------------------- + + elif self.longitudinale: + if externe: + raybor = de/2. + dp = -1.0 + else: + raybor = de/2. - epais + dp = +1.0 + prof = dp * profondeur + lgfond = longueur -2*profondeur + cosaz = math.cos(azimut*math.pi/180.) + sinaz = math.sin(azimut*math.pi/180.) + alfrd = alpha*math.pi/180. + rayxy = r_cintr + raybor*cosaz + angle = lgfond/(2.*rayxy) + logging.debug("longueur: %s, angle: %s, rayon: %s",lgfond, angle, rayxy) + pb = geompy.MakeVertex(raybor*cosaz, raybor*sinaz, -l_tube_p1, "pb") + pi = geompy.MakeTranslation(pb, prof*cosaz, prof*sinaz, 0., "pi") + pbv = geompy.MakeTranslation(pb, -sinaz, cosaz, 0., "pbv") + axb = geompy.MakeVector(pb,pbv, "axb") + pbl = geompy.MakeRotation(pb, axe, alfrd -angle, "pbl") + pbr = geompy.MakeRotation(pb, axe, alfrd +angle, "pbr") + axl = geompy.MakeRotation(axb, axe, alfrd -angle, "axl") + axr = geompy.MakeRotation(axb, axe, alfrd +angle, "axr") + pil = geompy.MakeRotation(pi, axe, alfrd -angle, "pil") + pir = geompy.MakeRotation(pi, axe, alfrd +angle, "pir") + + curves = [] + + points = [] + nbp = 3*nbp1 + xs = [] + totx = 0 + for i in range(nbp+2): + x = math.sin(i*math.pi/(nbp+1)) # fonction de répartition des points : distance relative + x2 = x*x + totx += x2 + xs.append(totx) + logging.debug("x2: %s, totx: %s", x2, totx) + for i in range(nbp+1): + #posi = nbp -i # répartition équidistante des points sur la courbe + posi = nbp*(1 -xs[i]/totx) # points plus resserrés aux extrémités de la courbe + angi = -dp*posi*(5.0*math.pi/8.0)/nbp + pt = geompy.MakeRotation(pil, axl, angi) + points.append(pt) + curves.append(geompy.MakeInterpol(points)) + point0 = points[0] + geompy.addToStudy(curves[-1],"curve0") +# for i, pt in enumerate(points): +# name = "point%d"%i +# geompy.addToStudyInFather(curves[-1], pt, name) + + points = [] + nbp = 3*nbp1 + xs =[] + totx = 0 + for i in range(nbp+1): + x = math.sin(i*math.pi/nbp) + #x = 1.0 # répartition équidistante des points sur la courbe + x2 = x*x # points plus resserrés aux extrémités de la courbe + totx += x2 + xs.append(totx) + logging.debug("x2: %s, totx: %s", x2, totx) + for i in range(nbp): + angi = alfrd -angle +2.0*angle*xs[i]/totx + pt = geompy.MakeRotation(pi, axe, angi) + points.append(pt) + curves.append(geompy.MakeInterpol(points)) + geompy.addToStudy(curves[-1],"curve1") +# for i, pt in enumerate(points): +# name = "point%d"%i +# geompy.addToStudyInFather(curves[-1], pt, name) + + points = [] + nbp = 3*nbp1 + xs = [] + totx = 0 + for i in range(nbp+2): + x = math.sin(i*math.pi/(nbp+1)) + x2 = x*x + totx += x2 + xs.append(totx) + logging.debug("x2: %s, totx: %s", x2, totx) + for i in range(nbp+1): + #posi = nbp -i # répartition équidistante des points sur la courbe + posi = nbp*xs[i]/totx # points plus resserrés aux extrémités de la courbe + angi = dp*posi*(5.0*math.pi/8.0)/nbp + pt = geompy.MakeRotation(pir, axr, angi) + points.append(pt) + curves.append(geompy.MakeInterpol(points)) + point1 = points[-1] + geompy.addToStudy(curves[-1],"curve2") +# for i, pt in enumerate(points): +# name = "point%d"%i +# geompy.addToStudyInFather(curves[-1], pt, name) + + wiretube = geompy.MakeWire(curves) + geompy.addToStudy(wiretube,"wiretube") + try: + edgetube = geompy.MakeEdgeWire(wiretube) + geompy.addToStudy(edgetube,"edgetube") + except: + logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans") + edgetube = None + + pts = [] + pts.append(point0) + dpr = prof*math.cos(5.0*math.pi/8.0) + pe = geompy.MakeTranslation(pb, dpr*cosaz, dpr*sinaz, 0., "pe") + for i in range(nbp): + angi = alfrd -angle +2.0*i*angle/nbp + pt = geompy.MakeRotation(pe, axe, angi) + pts.append(pt) + pts.append(point1) + arce = geompy.MakeInterpol(pts) + geompy.addToStudy(arce,"arce") + + facefiss = geompy.MakeFaceWires([arce, wiretube], 0) + geompy.addToStudy( facefiss, 'facefissPlace' ) + + pc = geompy.MakeTranslation(pb, 0.5*prof*cosaz, 0.5*prof*sinaz, 0.) + centre = geompy.MakeRotation(pc, axe, alfrd) + geompy.addToStudy( centre, 'centrefissPlace' ) + + edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True) + edgesTriees, minl, maxl = sortEdges(edges) + edges = edgesTriees[:-1] # la plus grande correspond à arce, on l'elimine + wiretube = geompy.MakeWire(edges) + #wiretube = edgesTriees[-1] + geompy.addToStudy(wiretube, 'wiretubePlace' ) + + # --------------------------------------------------------- + + else: # fissure elliptique, longue ou courte + if externe: + raybor = de/2. + dp = -1.0 + else: + raybor = de/2. - epais + dp = +1.0 + prof = dp * profondeur + cosaz = math.cos(azimut*math.pi/180.) + sinaz = math.sin(azimut*math.pi/180.) + alfrd = alpha*math.pi/180. + pb = geompy.MakeVertex(raybor*cosaz, raybor*sinaz, -l_tube_p1, "pb") + pi = geompy.MakeTranslation(pb, prof*cosaz, prof*sinaz, 0., "pi") + pbv = geompy.MakeTranslation(pb, -profondeur*sinaz, profondeur*cosaz, 0., "pbv") + ayb = geompy.MakeVector(pb,pbv, "ayb") + pb0 = geompy.MakeRotation(pb, axe, alfrd, "pb0") + ay0 = geompy.MakeRotation(ayb, axe, alfrd, "ay0") + pi0 = geompy.MakeRotation(pi, axe, alfrd, "pi0") + az_ = geompy.MakeVector(pi0, pb0, "az_") + az0 = geompy.MakeTranslationVector(az_, az_, "az0") #normale sortante + ax0 = geompy.MakeRotation(ay0, az0, -math.pi/2.0, "ax0") + ax1 = geompy.MakeRotation(ax0, az0, orientation*math.pi/180., "ax1") + ay1 = geompy.MakeRotation(ay0, az0, orientation*math.pi/180., "ay1") + originLCS = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0, "originLCS") + coo = geompy.PointCoordinates(pb0) + cox = geompy.VectorCoordinates(ax1) + coy = geompy.VectorCoordinates(ay1) + localLCS = geompy.MakeMarker(coo[0], coo[1], coo[2], cox[0], cox[1], cox[2], coy[0], coy[1], coy[2], "localLCS") + + pco = geompy.MakeVertex(0, 0, -profondeur, "pco") + pao = geompy.MakeRotation(pco, OY, 0.6*math.pi, "pao") + pbo = geompy.MakeRotation(pco, OY, -0.6*math.pi, "pbo") + pce = geompy.MakeVertex(0, 0, 0.1*profondeur,"pce") + arcoo = geompy.MakeArc(pao, pco, pbo, "arcoo") + linoo = geompy.MakeArc(pao, pce, pbo, "linoo") + scalex = longueur/profondeur + arco =geompy.MakeScaleAlongAxes(arcoo, O, scalex, 1., 1., "arco") + lino =geompy.MakeScaleAlongAxes(linoo, O, scalex, 1., 1., "lino") + arci = geompy.MakePosition(arco, originLCS, localLCS, "arci") + arce = geompy.MakePosition(lino, originLCS, localLCS, "arce") + facefiss = geompy.MakeFaceWires([arce, arci], 0) + geompy.addToStudy( facefiss, 'facefissPlace' ) + edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True) + edgesTriees, minl, maxl = sortEdges(edges) + edgetube = edgesTriees[-1] # la plus grande correspond à arci + wiretube = edgetube + + pc = geompy.MakeTranslation(pb, 0.5*prof*cosaz, 0.5*prof*sinaz, 0.) + centre = geompy.MakeRotation(pc, axe, alfrd) + geompy.addToStudy( centre, 'centrefissPlace' ) + + coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, profondeur/2. ,profondeur) + + return [facefiss, centre, lgInfluence, coordsNoeudsFissure, wiretube, edgetube] + + # --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + """ + Paramètres du maillage de la fissure pour le tuyau coudé + Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe. + nbSegRad = nombre de couronnes + nbSegCercle = nombre de secteurs + areteFaceFissure = taille cible de l'arête des triangles en face de fissure. + """ + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = 5, + nbsegCercle = 6, + areteFaceFissure = 5) + + # --------------------------------------------------------------------------- + def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams): + elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams) + return elementsDefaut + + # --------------------------------------------------------------------------- + def genereMaillageFissure(self, geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step): + maillageFissure = insereFissureGenerale(maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step) + return maillageFissure + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 77917, + Entity_Quad_Edge = 975, + Entity_Quad_Triangle = 2182, + Entity_Quad_Quadrangle = 6842, + Entity_Quad_Tetra = 20135, + Entity_Quad_Hexa = 8994, + Entity_Quad_Penta = 972, + Entity_Quad_Pyramid = 1038) + diff --git a/src/Tools/blocFissure/gmu/fissureGenerique.py b/src/Tools/blocFissure/gmu/fissureGenerique.py new file mode 100644 index 000000000..17518e871 --- /dev/null +++ b/src/Tools/blocFissure/gmu/fissureGenerique.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- + +from blocFissure import gmu +from blocFissure.gmu.initEtude import initEtude +from blocFissure.gmu.getStatsMaillageFissure import getStatsMaillageFissure + +class fissureGenerique(): + """ + classe générique problème fissure: + génération géométrie et maillage sain + définition et positionnement d'une fissure + génération d'un bloc défaut inséré dans le maillage sain + """ + + nomProbleme = "generique" + + def __init__(self, numeroCas): + initEtude() + self.numeroCas = numeroCas + self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas) + self.fissureLongue = False + + def setParamGeometrieSaine(self): + self.geomParams = {} + + def genereGeometrieSaine(self, geomParams): + geometriesSaines = [None] + return geometriesSaines + + def setParamMaillageSain(self): + self.meshParams = {} + + def genereMaillageSain(self, geometriesSaines, meshParams): + maillagesSains = [None] + return maillagesSains + + def setParamShapeFissure(self): + self.shapeFissureParams = {} + + def genereShapeFissure(self, geometriesSaines, geomParams, shapeFissureParams): + shapesFissure = [None] + return shapesFissure + + def setParamMaillageFissure(self): + self.maillageFissureParams = {} + + def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, maillageFissureParams): + elementsDefaut = [None] + return elementsDefaut + + def genereMaillageFissure(self, geometriesSaines, maillagesSains, shapesFissure, + maillageFissureParams, elementsDefaut, step): + maillageFissure = None + return maillageFissure + + def setReferencesMaillageFissure(self): + referencesMaillageFissure = {} + return referencesMaillageFissure + +# --------------------------------------------------------------------------- + + def executeProbleme(self, step=-1): + print "executeProbleme", self.nomCas + if step == 0: + return + + self.setParamGeometrieSaine() + geometriesSaines = self.genereGeometrieSaine(self.geomParams) + if step == 1: + return + + self.setParamMaillageSain() + maillagesSains = self.genereMaillageSain(geometriesSaines, self.meshParams) + if step == 2: + return + + self.setParamShapeFissure() + shapesFissure = self.genereShapeFissure(geometriesSaines, self.geomParams, self.shapeFissureParams) + if step == 3: + return + + self.setParamMaillageFissure() + elementsDefaut = self.genereZoneDefaut(geometriesSaines, maillagesSains, shapesFissure, self.shapeFissureParams, self.maillageFissureParams) + if step == 4: + return + + maillageFissure = self.genereMaillageFissure(geometriesSaines, maillagesSains, + shapesFissure, self.shapeFissureParams, + self.maillageFissureParams, elementsDefaut, step) + + self.setReferencesMaillageFissure() + mesures = getStatsMaillageFissure(maillageFissure, self.referencesMaillageFissure, self.maillageFissureParams) + + + + + + diff --git a/src/Tools/blocFissure/gmu/genereElemsFissureElliptique.py b/src/Tools/blocFissure/gmu/genereElemsFissureElliptique.py new file mode 100644 index 000000000..bbf939417 --- /dev/null +++ b/src/Tools/blocFissure/gmu/genereElemsFissureElliptique.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +from toreFissure import toreFissure +from ellipsoideDefaut import ellipsoideDefaut +from rotTrans import rotTrans +from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut + +# ----------------------------------------------------------------------------- +# --- création élements géométriques fissure elliptique + +def genereElemsFissureElliptique(shapeFissureParams): + """ + TODO: a completer + """ + logging.info('start') + + centreDefaut = shapeFissureParams['centreDefaut'] + vecteurDefaut = shapeFissureParams['vecteurDefaut'] + demiGrandAxe = shapeFissureParams['demiGrandAxe'] + demiPetitAxe = shapeFissureParams['demiPetitAxe'] + orientation = shapeFissureParams['orientation'] + tailleDefaut = shapeFissureParams['taille'] + + # --- ellipse incomplete : generatrice + + allonge = demiGrandAxe/demiPetitAxe + rayonTore = demiPetitAxe/5.0 + generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part = toreFissure(demiPetitAxe, allonge, rayonTore) + ellipsoide = ellipsoideDefaut(demiPetitAxe, allonge, rayonTore) + + # --- positionnement sur le bloc defaut de generatrice, tore et plan fissure + + pipe0 = rotTrans(Pipe_1, orientation, centreDefaut, vecteurDefaut) + gener1 = rotTrans(generatrice, orientation, centreDefaut, vecteurDefaut) + pipe1 = rotTrans(Pipe1Part, orientation, centreDefaut, vecteurDefaut) + facefis1 = rotTrans(FaceFissure, orientation, centreDefaut, vecteurDefaut) + plane1 = rotTrans(Plane_1, orientation, centreDefaut, vecteurDefaut) + ellipsoide1 = rotTrans(ellipsoide, orientation, centreDefaut, vecteurDefaut) + + geompy.addToStudy( pipe0, 'pipe0' ) + geompy.addToStudy( gener1, 'gener1' ) + geompy.addToStudy( pipe1, 'pipe1' ) + geompy.addToStudy( facefis1, 'facefis1' ) + geompy.addToStudy( plane1, 'plane1' ) + geompy.addToStudy( ellipsoide1, 'ellipsoide1' ) + + shapeDefaut = facefis1 + xyz_defaut = geompy.PointCoordinates(centreDefaut) + coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefis1, demiPetitAxe/10.0, demiPetitAxe/5.0) + + return shapeDefaut, xyz_defaut, tailleDefaut, coordsNoeudsFissure, pipe0, gener1, pipe1, facefis1, plane1, ellipsoide1 diff --git a/src/Tools/blocFissure/gmu/genereMeshCalculZoneDefaut.py b/src/Tools/blocFissure/gmu/genereMeshCalculZoneDefaut.py new file mode 100644 index 000000000..a08664bad --- /dev/null +++ b/src/Tools/blocFissure/gmu/genereMeshCalculZoneDefaut.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import smesh +from salome.smesh import smeshBuilder + +# ----------------------------------------------------------------------------- +# --- maillage face de fissure pour identification zone de defaut + +def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize): + """ + TODO: a completer + """ + logging.info('start') + + meshFissure = smesh.Mesh(facefiss) + algo2d = meshFissure.Triangle(algo=smeshBuilder.NETGEN_1D2D) + hypo2d = algo2d.Parameters() + hypo2d.SetMaxSize( maxSize ) + hypo2d.SetSecondOrder( 0 ) + hypo2d.SetOptimize( 1 ) + hypo2d.SetFineness( 2 ) + hypo2d.SetMinSize( minSize ) + hypo2d.SetQuadAllowed( 0 ) + isDone = meshFissure.Compute() + smesh.SetName(algo2d, "algo2d_zoneFiss") + smesh.SetName(hypo2d, "hypo1d_zoneFiss") + + coordsNoeudsFissure = [] + nodeIds = meshFissure.GetNodesId() + for id in nodeIds: + coords = meshFissure.GetNodeXYZ(id) + coordsNoeudsFissure.append(coords[0]) + coordsNoeudsFissure.append(coords[1]) + coordsNoeudsFissure.append(coords[2]) + return coordsNoeudsFissure diff --git a/src/Tools/blocFissure/gmu/geomsmesh.py b/src/Tools/blocFissure/gmu/geomsmesh.py new file mode 100644 index 000000000..889d35ba3 --- /dev/null +++ b/src/Tools/blocFissure/gmu/geomsmesh.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +import logging +logging.info('start') + +import salome +salome.salome_init() + +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + +logging.debug("initialisation de geompy et smesh OK") diff --git a/src/Tools/blocFissure/gmu/getCentreFondFiss.py b/src/Tools/blocFissure/gmu/getCentreFondFiss.py new file mode 100644 index 000000000..6c04d3627 --- /dev/null +++ b/src/Tools/blocFissure/gmu/getCentreFondFiss.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy +import bisect + +publie = False + +def getCentreFondFiss(shapesFissure): + """ + identification du centre de fond de fissure, + transformation fond de fissure en edge unique (seulement pour la procédure insereFissureGenerale). + On distingue le cas d'utilisation de la procédure insereFissureLongue par le nombre d'éléments de shapesFissure. + """ + global publie + logging.debug("start") + + fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure + if len(shapesFissure) == 6: # procédure insereFissureGenerale, et edge fond de fissure fournie explicitement + edgeFondExt = shapesFissure[5] + else: + edgeFondExt = None + + if len(shapesFissure) > 6: # procédure insereFissureLongue (fissure plane, plusieurs edges sur le fond de fissure) + centreFondFiss = shapesFissure[1] + tgtCentre = None + else: # procédure insereFissureGenerale, détermination edge unique et milieu de l'edge + if geompy.NumberOfEdges(fondFiss) > 1: + if geompy.NbShapes(fondFiss, geompy.ShapeType["WIRE"]) > 0: # wire + aWire = fondFiss + else: # compound + edges = geompy.ExtractShapes(fondFiss, geompy.ShapeType["EDGE"], False) + aWire = geompy.MakeWire(edges, 1e-07) + else: + edgeFondExt = fondFiss + aWire = geompy.MakeWire([fondFiss], 1e-07) + if not publie: + geompy.addToStudy(aWire, "wireFondFissExt") + + lgWire = geompy.BasicProperties(aWire)[0] + edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], True) + lgEdges = [geompy.BasicProperties(ed)[0] for ed in edges] + lgSumEd =[sum(lgEdges[0:i+1]) for i in range(len(lgEdges))] + iedr = bisect.bisect_left(lgSumEd, lgWire/2.0) + iedg = iedr -1 + if iedg < 0: + lgOnEdge = lgWire/2.0 + else: + lgOnEdge = lgWire/2.0 - lgSumEd[iedg] + logging.debug("lgsumEdges %s", lgSumEd) + logging.debug("id edge: %s, lgOnEdge: %s, lgEdge: %s",iedr, lgOnEdge, lgEdges[iedr]) + if iedr > 0: # il y a une edge avant celle du milieu + if geompy.MinDistance(edges[iedr-1], geompy.MakeVertexOnCurve(edges[iedr], 0.0 )) < 1.e-3: # edge orientée croissante + centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr]) + else: + centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], 1.0 - lgOnEdge/lgEdges[iedr]) + elif iedr < len(edges)-1: # il y a une edge après celle du milieu + if geompy.MinDistance(edges[iedr+1], geompy.MakeVertexOnCurve(edges[iedr], 1.0 )) < 1.e-3: # edge orientée croissante + centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr]) + else: + centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], 1.0 - lgOnEdge/lgEdges[iedr]) + else: # on ne sait pas comment est orientée l'edge unique, mais ça n'a pas d'importance + centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr]) + geompy.addToStudyInFather(aWire, centreFondFiss, "centreFondFiss") + tgtCentre = geompy.MakeTangentOnCurve(edges[iedr], lgOnEdge/ lgEdges[iedr]) + + if edgeFondExt is None: # fond de fissure non fourni explicitement sous forme d'edge + try: + edgeFondExt = geompy.MakeEdgeWire(aWire, 0.0005, 1e-07) + except: + logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans") + edgeFondExt = None + if not publie and edgeFondExt is not None: + geompy.addToStudy(edgeFondExt, "edgeFondExt") + + publie = True + return edgeFondExt, centreFondFiss, tgtCentre diff --git a/src/Tools/blocFissure/gmu/getStatsMaillageFissure.py b/src/Tools/blocFissure/gmu/getStatsMaillageFissure.py new file mode 100644 index 000000000..453b6b904 --- /dev/null +++ b/src/Tools/blocFissure/gmu/getStatsMaillageFissure.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- + +import logging +import SMESH + +# ----------------------------------------------------------------------------- +# --- statistiques maillage + +def getStatsMaillageFissure(maillage, referencesMaillageFissure, maillageFissureParams): + """ + TODO: a completer + """ + logging.debug('start') + + nomRep = '.' + if maillageFissureParams.has_key('nomRep'): + nomRep = maillageFissureParams['nomRep'] + + nomFicFissure = maillageFissureParams['nomFicFissure'] + fichierStatMaillageFissure = nomRep + '/' + nomFicFissure + '.res' + fichierNewRef = nomRep + '/' + nomFicFissure + '.new' + logging.debug("fichierStatMaillageFissure=%s", fichierStatMaillageFissure) + + OK = False + if maillage is not None: + mesures = maillage.GetMeshInfo() + d= {} + for key, value in mesures.iteritems(): + logging.debug( "key: %s value: %s", key, value) + d[str(key)] = value + logging.debug("dico mesures %s", d) + + f = open(fichierStatMaillageFissure, 'w') + f2 = open(fichierNewRef, 'w') + OK = True + for key in ('Entity_Quad_Pyramid', 'Entity_Quad_Hexa', 'Entity_Quad_Quadrangle'): + if d[key] != referencesMaillageFissure[key]: + logging.info("Ecart: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key]) + f.write("Ecart: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n') + OK = False + else: + logging.info("Valeur_OK: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key]) + f.write("Valeur_OK: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n') + f2.write(key + " = " + str(d[key]) + ",\n") + tolerance = 0.05 + for key in ('Entity_Quad_Penta', 'Entity_Quad_Tetra', 'Entity_Quad_Triangle', 'Entity_Quad_Edge', 'Entity_Node'): + if (d[key] < (1.0 - tolerance)*referencesMaillageFissure[key]) \ + or (d[key] > (1.0 + tolerance)*referencesMaillageFissure[key]): + logging.info("Ecart: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key]) + f.write("Ecart: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n') + OK = False + else: + logging.info("Valeur_OK: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key]) + f.write("Valeur_OK: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n') + f2.write(key + " = " + str(d[key]) + ",\n") + f.close() + f2.close() + return OK diff --git a/src/Tools/blocFissure/gmu/getSubshapeIds.py b/src/Tools/blocFissure/gmu/getSubshapeIds.py new file mode 100644 index 000000000..778359646 --- /dev/null +++ b/src/Tools/blocFissure/gmu/getSubshapeIds.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- transformation d'une liste de subshapes en une liste d'Id + +def getSubshapeIds(obj, subshapes): + """ + transformation d'une liste de subshapes en une liste d'Id + """ + logging.debug("start") + subshapesId = [] + for sub in subshapes: + subshapesId.append(geompy.GetSubShapeID(obj, sub)) + logging.debug("subshapesId=%s", subshapesId) + return subshapesId diff --git a/src/Tools/blocFissure/gmu/initEtude.py b/src/Tools/blocFissure/gmu/initEtude.py new file mode 100644 index 000000000..1e73886b6 --- /dev/null +++ b/src/Tools/blocFissure/gmu/initEtude.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- + +import logging +myStudy = None + +def initEtude(): + """ + creation nouvelle etude salome + """ + import geomsmesh diff --git a/src/Tools/blocFissure/gmu/initLog.py b/src/Tools/blocFissure/gmu/initLog.py new file mode 100644 index 000000000..63908c1d0 --- /dev/null +++ b/src/Tools/blocFissure/gmu/initLog.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +import logging + +def setDebug(): + logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s', + level=logging.DEBUG) + logging.info('start Debug') + +def setVerbose(): + logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s', + level=logging.INFO) + logging.info('start Verbose') + +def setRelease(): + logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s', + level=logging.WARNING) + logging.warning('start Release') + +def setUnitTests(): + logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s', + level=logging.CRITICAL) + logging.critical('start UnitTests') + + #logging.basicConfig(filename='myapp.log', + # format='%(asctime)s %(message)s', + # datefmt='%m/%d/%Y %I:%M:%S %p', + # level=logging.DEBUG) diff --git a/src/Tools/blocFissure/gmu/insereFissureElliptique.py b/src/Tools/blocFissure/gmu/insereFissureElliptique.py new file mode 100644 index 000000000..95d4a6279 --- /dev/null +++ b/src/Tools/blocFissure/gmu/insereFissureElliptique.py @@ -0,0 +1,196 @@ +# -*- coding: utf-8 -*- + +import logging +import salome +from geomsmesh import geompy +from geomsmesh import smesh +import SMESH +import math + +from partitionBlocDefaut import partitionBlocDefaut +from facesVolumesToriques import facesVolumesToriques +from facesCirculaires import facesCirculaires +from propagateTore import propagateTore +from sortGeneratrices import sortGeneratrices +from facesFissure import facesFissure +from facesToreInBloc import facesToreInBloc +from shapeSurFissure import shapeSurFissure +from meshBlocPart import meshBlocPart +from enleveDefaut import enleveDefaut +from regroupeSainEtDefaut import RegroupeSainEtDefaut +from putName import putName + +# ----------------------------------------------------------------------------- +# --- procedure complete fissure elliptique + +def insereFissureElliptique(geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step=-1): + """ + TODO: a completer + """ + logging.info('start') + + geometrieSaine = geometriesSaines[0] + maillageSain = maillagesSains[0] + isHexa = maillagesSains[1] + shapeDefaut = shapesFissure[0] + tailleDefaut = shapesFissure[2] + pipe0 = shapesFissure[4] + gener1 = shapesFissure[5] + pipe1 = shapesFissure[6] + facefis1 = shapesFissure[7] + plane1 = shapesFissure[8] + ellipsoide1 = shapesFissure[9] + + + demiGrandAxe = shapeFissureParams['demiGrandAxe'] + demiPetitAxe = shapeFissureParams['demiPetitAxe'] + orientation = shapeFissureParams['orientation'] + + nomRep = maillageFissureParams['nomRep'] + nomFicSain = maillageFissureParams['nomFicSain'] + nomFicFissure = maillageFissureParams['nomFicFissure'] + + nbsegExt = maillageFissureParams['nbsegExt'] # 5 + nbsegGen = maillageFissureParams['nbsegGen'] # 25 + nbsegRad = maillageFissureParams['nbsegRad'] # 5 + scaleRad = maillageFissureParams['scaleRad'] # 4 + nbsegCercle = maillageFissureParams['nbsegCercle'] # 6 + nbsegFis = maillageFissureParams['nbsegFis'] # 20 + lensegEllipsoide = maillageFissureParams['lensegEllipso'] # 1.0 + + fichierMaillageSain = nomRep + '/' + nomFicSain + '.med' + fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med' + + facesDefaut = elementsDefaut[0] + centreDefaut = elementsDefaut[1] + normalDefaut = elementsDefaut[2] + extrusionDefaut = elementsDefaut[3] + dmoyen = elementsDefaut[4] + bordsPartages = elementsDefaut[5] + fillconts = elementsDefaut[6] + idFilToCont = elementsDefaut[7] + maillageSain = elementsDefaut[8] + internalBoundary = elementsDefaut[9] + zoneDefaut = elementsDefaut[10] + zoneDefaut_skin = elementsDefaut[11] + zoneDefaut_internalFaces = elementsDefaut[12] + zoneDefaut_internalEdges = elementsDefaut[13] + + ## --- ellipse incomplete : generatrice + #if step == 5: + #return None + + #allonge = demiGrandAxe/demiPetitAxe + #rayonTore = demiPetitAxe/5.0 + #generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part = self.toreFissure(demiPetitAxe, allonge, rayonTore) + #ellipsoide = self.ellipsoideDefaut(demiPetitAxe, allonge, rayonTore) + + ## --- positionnement sur le bloc defaut de generatrice, tore et plan fissure + #if step == 6: + #return None + + #pipe0 = self.rotTrans(Pipe_1, orientation, centreDefaut, normalDefaut) + #gener1 = self.rotTrans(generatrice, orientation, centreDefaut, normalDefaut) + #pipe1 = self.rotTrans(Pipe1Part, orientation, centreDefaut, normalDefaut) + #facefis1 = self.rotTrans(FaceFissure, orientation, centreDefaut, normalDefaut) + #plane1 = self.rotTrans(Plane_1, orientation, centreDefaut, normalDefaut) + #ellipsoide1 = self.rotTrans(ellipsoide, orientation, centreDefaut, normalDefaut) + + #geompy.addToStudy( pipe0, 'pipe0' ) + #geompy.addToStudy( gener1, 'gener1' ) + #geompy.addToStudy( pipe1, 'pipe1' ) + #geompy.addToStudy( facefis1, 'facefis1' ) + #geompy.addToStudy( plane1, 'plane1' ) + #geompy.addToStudy( ellipsoide1, 'ellipsoide1' ) + + # --- partition du bloc défaut par génératrice, tore et plan fissure + if step == 7: + return None + + [blocPartition, blocp, tore, + faceFissure, facesExternes, facesExtBloc, facesExtElli, + aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords] = \ + partitionBlocDefaut(extrusionDefaut, facesDefaut, gener1, pipe1, + facefis1, ellipsoide1) + if not isHexa: + edgesBords = None # maillage sain hexa ==> filling, et maillage edges Bords imposés du maillage sain + + # --- TORE + # --- faces toriques du tore + if step == 8: + return None + + [facetore1, facetore2, volumeTore1, volumeTore2] = facesVolumesToriques(tore, plane1, facesDefaut) + + # --- faces 1/2 circulaires et edges dans le plan de fissure + if step == 9: + return None + + [faces, centres, edges, reverses] = facesCirculaires(extrusionDefaut, tore) + + # --- recherche et classement des edges du tore par propagate + if step == 10: + return None + + [diams, circles, geners] = propagateTore(tore) + + # --- tri par longueur des 3 génératrices + if step == 11: + return None + + [genext, genint, gencnt] = sortGeneratrices(tore, geners) + + # --- faces fissure dans et hors tore, et edges face hors tore + if step == 12: + return None + + [facefissintore, facefissoutore, edgeint, edgeext, reverext] = \ + facesFissure(ellipsoidep, faceFissure, extrusionDefaut, genint) + + # --- identification des faces tore et fissure dans le solide hors tore + if step == 13: + return None + + [blocFaceFiss, blocFaceTore1, blocFaceTore2] = \ + facesToreInBloc(ellipsoidep, facefissoutore, facetore1, facetore2) + + # --- identification des shapes modifiées par la duplication des noeuds de la face fissure (d'un coté de la face) + + #shapesAModifier = self.shapesSurFissure(blocPartition, plane1 faceFissure, gencnt) + if step == 14: + return None + + extrusionFaceFissure, normfiss = shapeSurFissure(plane1) + + # --- maillage du bloc partitionne + + if step == 15: + return None + + [bloc1, blocComplet] = \ + meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, + gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, + aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, + nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle, + nbsegFis, dmoyen, lensegEllipsoide) + + if step == 16: + return None + maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges) + + if step == 17: + return None + maillageComplet = RegroupeSainEtDefaut(maillageSain, blocComplet, extrusionFaceFissure, faceFissure, 'VOLUMES') + + if step == 18: + return None + maillageComplet.ExportMED( fichierMaillageFissure, 0, SMESH.MED_V2_2, 1 ) + putName(maillageComplet, nomFicFissure) + logging.info("fichier maillage fissure : %s", fichierMaillageFissure) + + if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) + + return maillageComplet diff --git a/src/Tools/blocFissure/gmu/insereFissureGenerale.py b/src/Tools/blocFissure/gmu/insereFissureGenerale.py new file mode 100644 index 000000000..3204084a5 --- /dev/null +++ b/src/Tools/blocFissure/gmu/insereFissureGenerale.py @@ -0,0 +1,1371 @@ +# -*- coding: utf-8 -*- + +import logging +import salome +from geomsmesh import geompy +import GEOM +from geomsmesh import smesh +from salome.smesh import smeshBuilder +import SMESH +import math +import bisect + +from extractionOrientee import extractionOrientee +from extractionOrienteeMulti import extractionOrienteeMulti +from sortFaces import sortFaces +from sortEdges import sortEdges +from eliminateDoubles import eliminateDoubles +from substractSubShapes import substractSubShapes +from produitMixte import produitMixte +from findWireEndVertices import findWireEndVertices +from findWireIntermediateVertices import findWireIntermediateVertices +from orderEdgesFromWire import orderEdgesFromWire +from getSubshapeIds import getSubshapeIds +from putName import putName +from distance2 import distance2 +from enleveDefaut import enleveDefaut +from shapeSurFissure import shapeSurFissure +from regroupeSainEtDefaut import RegroupeSainEtDefaut +from triedreBase import triedreBase +from checkDecoupePartition import checkDecoupePartition +from whichSide import whichSide +from whichSideMulti import whichSideMulti +from whichSideVertex import whichSideVertex +from projettePointSurCourbe import projettePointSurCourbe +from prolongeWire import prolongeWire +#from getCentreFondFiss import getCentreFondFiss + +# ----------------------------------------------------------------------------- +# --- procédure complète fissure générale + +def insereFissureGenerale(maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step=-1): + """ + TODO: a completer + """ + logging.info('start') + + shapeDefaut = shapesFissure[0] # faces de fissure, débordant + fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure + + rayonPipe = shapeFissureParams['rayonPipe'] + if shapeFissureParams.has_key('lenSegPipe'): + lenSegPipe = shapeFissureParams['lenSegPipe'] + else: + lenSegPipe = rayonPipe + + nomRep = maillageFissureParams['nomRep'] + nomFicSain = maillageFissureParams['nomFicSain'] + nomFicFissure = maillageFissureParams['nomFicFissure'] + + nbsegRad = maillageFissureParams['nbsegRad'] # nombre de couches selon un rayon du pipe + nbsegCercle = maillageFissureParams['nbsegCercle'] # nombre de secteur dans un cercle du pipe + areteFaceFissure = maillageFissureParams['areteFaceFissure'] + + pointIn_x = 0.0 + pointIn_y = 0.0 + pointIn_z = 0.0 + isPointInterne = False + if shapeFissureParams.has_key('pointIn_x'): + pointIn_x = shapeFissureParams['pointIn_x'] + isPointInterne = True + if shapeFissureParams.has_key('pointIn_y'): + pointIn_y = shapeFissureParams['pointIn_y'] + isPointInterne = True + if shapeFissureParams.has_key('pointIn_z'): + pointIn_z = shapeFissureParams['pointIn_z'] + isPointInterne = True + if isPointInterne: + pointInterne = geompy.MakeVertex(pointIn_x, pointIn_y, pointIn_z) + + #fichierMaillageSain = nomRep + '/' + nomFicSain + '.med' + fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med' + + facesDefaut = elementsDefaut[0] # fillings des faces en peau + #centresDefaut = elementsDefaut[1] + #normalsDefaut = elementsDefaut[2] + #extrusionsDefaut = elementsDefaut[3] + dmoyen = elementsDefaut[4] + bordsPartages = elementsDefaut[5] + fillconts = elementsDefaut[6] + idFilToCont = elementsDefaut[7] + maillageSain = elementsDefaut[8] + internalBoundary = elementsDefaut[9] + zoneDefaut = elementsDefaut[10] + zoneDefaut_skin = elementsDefaut[11] + zoneDefaut_internalFaces = elementsDefaut[12] + zoneDefaut_internalEdges = elementsDefaut[13] + edgeFondExt = elementsDefaut[14] + centreFondFiss = elementsDefaut[15] + tgtCentre = elementsDefaut[16] + + # --- restriction de la face de fissure au domaine solide : + # partition face fissure étendue par fillings, on garde la plus grande face + + partShapeDefaut = geompy.MakePartition([shapeDefaut], facesDefaut, [], [], geompy.ShapeType["FACE"], 0, [], 0) + geompy.addToStudy(partShapeDefaut, 'partShapeDefaut') + facesPartShapeDefaut = geompy.ExtractShapes(partShapeDefaut, geompy.ShapeType["FACE"], False) + if isPointInterne: + distfaces = [(geompy.MinDistance(face,pointInterne), i, face) for i, face in enumerate(facesPartShapeDefaut)] + distfaces.sort() + logging.debug("selection de la face la plus proche du point interne, distance=%s",distfaces[0][0]) + facesPortFissure = distfaces[0][2] + else: + facesPartShapeDefautSorted, minSurf, maxSurf = sortFaces(facesPartShapeDefaut) # la face de fissure dans le volume doit être la plus grande + logging.debug("surfaces faces fissure étendue, min %s, max %s", minSurf, maxSurf) + facesPortFissure = facesPartShapeDefautSorted[-1] + + geompy.addToStudy(facesPortFissure, "facesPortFissure") + + O, OX, OY, OZ = triedreBase() + + # ----------------------------------------------------------------------------- + # --- pipe de fond de fissure, prolongé, partition face fissure par pipe + # identification des edges communes pipe et face fissure + + if geompy.NumberOfFaces(shapeDefaut) == 1: + plan = geompy.MakePlane(centreFondFiss, tgtCentre, 10000) + shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0) + fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss) + geompy.addToStudy(shapeDefaut, 'shapeDefaut_coupe') + geompy.addToStudyInFather(shapeDefaut, fondFissCoupe, 'fondFiss_coupe') + + extrem, norms = findWireEndVertices(fondFiss, True) + logging.debug("extrem: %s, norm: %s",extrem, norms) + cercle = geompy.MakeCircle(extrem[0], norms[0], rayonPipe) + cercle = geompy.MakeRotation(cercle, norms[0], math.pi/3.0 ) # éviter d'avoir l'arête de couture du pipe presque confondue avec la face fissure + geompy.addToStudy(cercle, 'cercle') + fondFissProlonge = prolongeWire(fondFiss, extrem, norms, 2*rayonPipe) + pipeFiss = geompy.MakePipe(cercle, fondFissProlonge) + geompy.addToStudy(pipeFiss, 'pipeFiss') + partFissPipe = geompy.MakePartition([shapeDefaut, pipeFiss], [], [], [], geompy.ShapeType["FACE"], 0, [], 1) + geompy.addToStudy(partFissPipe, 'partFissPipe') + fissPipe = geompy.GetInPlaceByHistory(partFissPipe, shapeDefaut) + geompy.addToStudy(fissPipe, 'fissPipe') + partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss) + geompy.addToStudy(partPipe, 'partPipe') + + edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"]) + for i, edge in enumerate(edgesPipeFiss): + name = "edgePipe%d"%i + geompy.addToStudyInFather(fissPipe, edge, name) + try: + wirePipeFiss = geompy.MakeWire(edgesPipeFiss) + except: + wirePipeFiss = geompy.MakeCompound(edgesPipeFiss) + logging.debug("wirePipeFiss construit sous forme de compound") + geompy.addToStudy(wirePipeFiss, "wirePipeFiss") + + wireFondFiss = geompy.GetInPlace(partFissPipe,fondFiss) + edgesFondFiss = geompy.GetSharedShapesMulti([fissPipe, wireFondFiss], geompy.ShapeType["EDGE"]) + for i, edge in enumerate(edgesFondFiss): + name = "edgeFondFiss%d"%i + geompy.addToStudyInFather(fissPipe, edge, name) + wireFondFiss = geompy.MakeWire(edgesFondFiss) + geompy.addToStudy(wireFondFiss,"wireFondFiss") + + # ----------------------------------------------------------------------------- + # --- peau et face de fissure + # + # --- partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée + # il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure + # liste de faces externes : facesDefaut + # liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection) + + partitionsPeauFissFond = [] + ipart = 0 + for filling in facesDefaut: + part = geompy.MakePartition([fissPipe, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0) + isPart = checkDecoupePartition([fissPipe, filling], part) + if isPart: # on recrée la partition avec toutes les faces filling en outil pour avoir une face de fissure correcte + otherFD = [fd for fd in facesDefaut if fd != filling] + if len(otherFD) > 0: + fissPipePart = geompy.MakePartition([fissPipe], otherFD, [], [], geompy.ShapeType["FACE"], 0, [], 0) + else: + fissPipePart = fissPipe + part = geompy.MakePartition([fissPipePart, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0) + partitionsPeauFissFond.append(part) + geompy.addToStudy( part, 'partitionPeauFissFond%d'%ipart ) + else: + partitionsPeauFissFond.append(None) + ipart = ipart +1 + + # --- arêtes vives détectées (dans quadranglesToShape) + + aretesVives = [] + aretesVivesCoupees = [] + ia = 0 + for a in bordsPartages: + if a[0] is not None: + aretesVives.append(a[0]) + name = "areteVive%d"%ia + geompy.addToStudy(a[0], name) + ia += 1 + aretesVivesC = None + if len(aretesVives) > 0: + aretesVivesC =geompy.MakeCompound(aretesVives) + + # ------------------------------------------------------- + # --- inventaire des faces de peau coupées par la fissure + # pour chaque face de peau : 0, 1 ou 2 faces débouchante du fond de fissure + # 0, 1 ou plus edges de la face de fissure externe au pipe + + nbFacesFilling = len(partitionsPeauFissFond) + ptEdgeFond = [ [] for i in range(nbFacesFilling)] # pour chaque face [points edge fond de fissure aux débouchés du pipe] + fsPipePeau = [ [] for i in range(nbFacesFilling)] # pour chaque face [faces du pipe débouchantes] + edRadFPiPo = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge radiale des faces du pipe débouchantes ] + fsFissuExt = [ [] for i in range(nbFacesFilling)] # pour chaque face [faces de fissure externes au pipe] + edFisExtPe = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge en peau des faces de fissure externes (pas subshape facePeau)] + edFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge commun au pipe des faces de fissure externes] + facesPeaux = [None for i in range(nbFacesFilling)] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes) + edCircPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe] + ptCircPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe] + gpedgeBord = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine + gpedgeVifs = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupes subshape des edges aux arêtes vives entre fillings + edFissPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes] + ptFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [point commun edFissPeau edCircPeau] + + for ifil, partitionPeauFissFond in enumerate(partitionsPeauFissFond): + fillingFaceExterne = facesDefaut[ifil] + fillingSansDecoupe = fillconts[idFilToCont[ifil]] + if partitionPeauFissFond is not None: + logging.debug("traitement partitionPeauFissFond %s", ifil) + # ----------------------------------------------------------------------- + # --- identification edges fond de fissure, edges pipe sur la face de fissure, + # edges prolongées + + edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss)) + geompy.addToStudyInFather(partitionPeauFissFond, edgesPipeC, "edgesPipeFiss") + edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss)) + geompy.addToStudyInFather(partitionPeauFissFond, edgesFondC, "edgesFondFiss") + + if aretesVivesC is None: + [edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3) + [facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3) + else: + [edgesInside, edgesOutside, edgesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3) + [facesInside, facesOutside, facesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3) + + edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"]) + verticesPipePeau = [] + + for i, edge in enumerate(edgesPipeIn): + try: + vertices = geompy.GetSharedShapesMulti([edge, geompy.MakeCompound(facesOnside)], geompy.ShapeType["VERTEX"]) + verticesPipePeau.append(vertices[0]) + name = "edgePipeIn%d"%i + geompy.addToStudyInFather(partitionPeauFissFond, edge, name) + name = "verticePipePeau%d"%i + geompy.addToStudyInFather(partitionPeauFissFond, vertices[0], name) + logging.debug("edgePipeIn%s coupe les faces OnSide", i) + except: + logging.debug("edgePipeIn%s ne coupe pas les faces OnSide", i) + edgesFondOut = [] + edgesFondIn =[] + if len(verticesPipePeau) > 0: # au moins une extrémité du pipe sur cette face de peau + tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesOutside)], geompy.ShapeType["EDGE"]) + edgesFondOut = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3] + tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"]) + edgesFondIn = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3] + verticesEdgesFondIn = [] # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn) + pipexts = [] # les segments de pipe associés au points de fond de fissure débouchants (même indice) + cercles = [] # les cercles de generation des pipes débouchant (même indice) + facesFissExt = [] # les faces de la fissure externe associés au points de fond de fissure débouchants (même indice) + edgesFissExtPeau = [] # edges des faces de fissure externe sur la peau (même indice) + edgesFissExtPipe = [] # edges des faces de fissure externe sur le pipe (même indice) + #logging.debug("edgesFondIn %s", edgesFondIn) + + edgesFondFiss, edgesIdByOrientation = orderEdgesFromWire(wireFondFiss) + for i,edge in enumerate(edgesFondFiss): + geompy.addToStudyInFather(wireFondFiss, edge, "edgeFondFiss%d"%i) + + for iedf, edge in enumerate(edgesFondIn): + name = "edgeFondIn%d"%iedf + geompy.addToStudyInFather(partitionPeauFissFond, edge, name) + dist = [ geompy.MinDistance(pt, edge) for pt in verticesPipePeau] + ptPeau = verticesPipePeau[dist.index(min(dist))] # le point de verticesPipePeau a distance minimale de l'edge + [u, PointOnEdge, EdgeInWireIndex] = geompy.MakeProjectionOnWire(ptPeau, wireFondFiss) + logging.debug("u:%s, EdgeInWireIndex: %s, len(edgesFondFiss): %s", u, EdgeInWireIndex, len(edgesFondFiss)) + localEdgeInFondFiss = edgesFondFiss[EdgeInWireIndex] + centre = PointOnEdge + centre2 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, u) + geompy.addToStudyInFather(partitionPeauFissFond, centre2, "centre2_%d"%iedf) + verticesEdgesFondIn.append(centre) + name = "verticeEdgesFondIn%d"%iedf + geompy.addToStudyInFather(partitionPeauFissFond, centre, name) + norm = geompy.MakeTangentOnCurve(localEdgeInFondFiss, u) + geompy.addToStudyInFather(partitionPeauFissFond, centre, "norm%d"%iedf) + cercle = geompy.MakeCircle(centre, norm, rayonPipe) + geompy.addToStudyInFather(partitionPeauFissFond, cercle, "cerclorig%d"%iedf) + [vertex] = geompy.ExtractShapes(cercle, geompy.ShapeType["VERTEX"], False) + vec1 = geompy.MakeVector(centre, vertex) + vec2 = geompy.MakeVector(centre, ptPeau) + angle = geompy.GetAngleRadians(vec1, vec2) + # cas général : on reconstitue une portion de pipe, avec l'arête de couture qui coincide + # avec la face de fissure, au niveau du débouché sur la face externe + # cas dégénéré : le pipe débouche perpendiculairement à une surface plane à l'origine. + # La partition filling / pipe reconstruit échoue. + # - Si on partitionne le filling avec un simple pipe obtenu par extrusion droite du cercle, + # cela donne un point en trop sur le cercle. + # - Si on prend une vraie surface plane (pas un filling), on peut faire la partition avec + # les pipes reconstruits + logging.debug("angle=%s", angle) + #if abs(angle) > 1.e-7: + sommetAxe = geompy.MakeTranslationVector(centre, norm) + pm = produitMixte(centre, vertex, ptPeau, sommetAxe) + if pm > 0: # ajout de pi a (-)angle pour éviter des points confondus (partition échoue) dans les cas dégénérés + cercle = geompy.MakeRotation(cercle, norm, angle + math.pi) + else: + cercle = geompy.MakeRotation(cercle, norm, -angle + math.pi) + name = "cercle%d"%iedf + geompy.addToStudyInFather(partitionPeauFissFond, cercle, name) + cercles.append(cercle) + + # --- estimation de la longueur du pipe necessaire de part et d'autre du point de sortie + if aretesVivesC is None: + faceTestPeau = fillingFaceExterne + else: + faceTestPeau = facesDefaut[ifil] + sideCentre = whichSide(faceTestPeau, centre) + locPt0 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 0.0) + locPt1 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 1.0) + sidePt0 = whichSide(faceTestPeau, locPt0) + sidePt1 = whichSide(faceTestPeau, locPt1) + logging.debug("position centre cercle: %s, extremité edge u0: %s, u1: %s", sideCentre, sidePt0, sidePt1) + normFace = geompy.GetNormal(faceTestPeau, ptPeau) + inclPipe = abs(geompy.GetAngleRadians(norm, normFace)) + lgp = max(rayonPipe/2., abs(3*rayonPipe*math.tan(inclPipe))) + logging.debug("angle inclinaison Pipe en sortie: %s degres, lgp: %s", inclPipe*180/math.pi, lgp) + + # --- position des points extremite du pipe sur l'edge debouchante + # il faut la distance curviligne ofp du point central par rapport à une extrémité de l'edge débouchante + locEdgePart = geompy.MakePartition([localEdgeInFondFiss],[centre], [], [], geompy.ShapeType["EDGE"], 0, [], 0) + edgesLoc = geompy.ExtractShapes(locEdgePart, geompy.ShapeType["EDGE"], False) + edgesLocSorted =[(geompy.MinDistance(edge, locPt0), kk, edge) for kk, edge in enumerate(edgesLoc)] + edgesLocSorted.sort() + ofp = geompy.BasicProperties(edgesLocSorted[0][2])[0] # distance curviligne centre locPt0 + logging.debug("distance curviligne centre extremite0: %s", ofp) + p1 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp +lgp, locPt0) + p2 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp -lgp, locPt0) + geompy.addToStudyInFather(wireFondFiss, p1, "p1_%d"%iedf) + geompy.addToStudyInFather(wireFondFiss, p2, "p2_%d"%iedf) + + edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], [], [], geompy.ShapeType["EDGE"], 0, [], 0) + edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True) + for edp in edps: + if geompy.MinDistance(centre, edp) < 1.e-3: + pipext = geompy.MakePipe(cercle, edp) + name = "pipeExt%d"%iedf + geompy.addToStudyInFather(partitionPeauFissFond, pipext, name) + pipexts.append(pipext) + + for face in facesInside: + logging.debug("recherche edges communes entre une face inside et (faces onside, edges pipe et fond débouchante)") + edgesPeauFis = [] + edgesPipeFis = [] + edgesPipeFnd = [] + try: + edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"]) + logging.debug(" faces onside %s",edgesPeauFis) + edgesPipeFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesPipeIn), face], geompy.ShapeType["EDGE"]) + logging.debug(" edgesPipeIn %s", edgesPipeFis) + edgesPipeFnd = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesFondIn), face], geompy.ShapeType["EDGE"]) + logging.debug(" edgesFondIn %s ", edgesPipeFnd) + except: + logging.debug(" pb edges communes %s %s %s",edgesPeauFis, edgesPipeFis, edgesPipeFnd) + pass + if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0): + dist = geompy.MinDistance(geompy.MakeCompound(edgesPeauFis), ptPeau) + logging.debug(" test distance extrémité reference %s", dist) + if dist < 1.e-3: # c'est la face de fissure externe associée + logging.debug(" face %s inside ajoutée", i) + facesFissExt.append(face) + name="faceFissExt%d"%iedf + geompy.addToStudyInFather(partitionPeauFissFond, face, name) + dist = 1. + for ipe, edpe in enumerate(edgesPeauFis): + for ipi, edpi in enumerate(edgesPipeFis): + dist = geompy.MinDistance(edpe, edpi) + if dist < 1.e-3: + edgesFissExtPeau.append(edpe) + name="edgesFissExtPeau%d"%iedf + geompy.addToStudyInFather(partitionPeauFissFond, edpe, name) + edgesFissExtPipe.append(edpi) + name="edgesFissExtPipe%d"%iedf + geompy.addToStudyInFather(partitionPeauFissFond, edpi, name) + break + if dist < 1.e-3: + break + + if len(verticesPipePeau) == 0: # aucune extrémité du pipe sur cette face de peau + # il faut recenser les edges de fissure sur la face de peau + j = 0 + for face in facesInside: + edgesPeauFis = [] + edgesPipeFis = [] + edgesPipeFnd = [] + try: + edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"]) + edgesPipeFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesPipeIn), face], geompy.ShapeType["EDGE"]) + edgesPipeFnd = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesFondIn), face], geompy.ShapeType["EDGE"]) + except: + pass + if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0): + edgesFissExtPeau.append(edgesPeauFis[0]) + name="edgesFissExtPeau%d"%j + geompy.addToStudyInFather(partitionPeauFissFond, edgesPeauFis[0], name) + j += 1 + + # ----------------------------------------------------------------------- + # --- identification faces de peau : face de peau percée du pipe, extrémités du pipe + # La partition avec le pipe peut créer un vertex (et un edge) de trop sur le cercle projeté, + # quand le cercle est très proche de la face. + # dans ce cas, la projection du cercle sur la face suivie d'une partition permet + # d'éviter le point en trop + + facesAndFond = facesOnside + facesAndFond.append(wireFondFiss) + try: + partitionPeauByPipe = geompy.MakePartition(facesAndFond, pipexts, [], [], geompy.ShapeType["FACE"], 0, [], 1) + except: + logging.debug("probleme partition face pipe, contournement avec MakeSection") + sections = [] + for pipext in pipexts: + sections.append(geompy.MakeSection(facesOnside[0], pipext)) + partitionPeauByPipe = geompy.MakePartition(facesAndFond, sections, [], [], geompy.ShapeType["FACE"], 0, [], 1) + + # contrôle edge en trop sur edges circulaires + if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau + edgeEnTrop = [] + outilPart = pipexts + facesPeau = geompy.ExtractShapes(partitionPeauByPipe, geompy.ShapeType["FACE"], False) + facesPeauSorted, minsur, maxsurf = sortFaces(facesPeau) + for i, face in enumerate(facesPeauSorted[:-1]): # on ne teste que la ou les petites faces "circulaires" + nbv = geompy.NumberOfEdges(face) + logging.debug("nombre d'edges sur face circulaire: %s", nbv) + if nbv > 3: + edgeEnTrop.append(True) # TODO : distinguer les cas avec deux faces circulaires dont l'une est correcte + else: + edgeEnTrop.append(False) + refaire = sum(edgeEnTrop) + if refaire > 0: + dc = [(geompy.MinDistance(verticesEdgesFondIn[0], fac), i) for i, fac in enumerate(facesPeauSorted[:-1])] + dc.sort() + logging.debug("dc sorted: %s", dc) + i0 = dc[0][1] # indice de facesPeauSorted qui correspond à verticesEdgesFondIn[0], donc 0 pour cercles + direct = (i0 == 0) + for i, bad in enumerate(edgeEnTrop): + if direct: + j = i + else: + j = 1-i + if bad: + outilPart[j] = geompy.MakeProjection(cercles[j],facesOnside[0]) + pass + partitionPeauByPipe = geompy.MakePartition(facesAndFond, outilPart, [], [], geompy.ShapeType["FACE"], 0, [], 1) + pass + + name="partitionPeauByPipe%d"%ifil + geompy.addToStudy(partitionPeauByPipe, name) + [edgesPeauFondIn, edgesPeauFondOut, edgesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "EDGE", 1.e-3) + [facesPeauFondIn, facesPeauFondOut, facesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "FACE", 1.e-3) + + if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau + facesPeauSorted, minsur, maxsurf = sortFaces(facesPeauFondOn) + facePeau = facesPeauSorted[-1] # la plus grande face + else: + facePeau =geompy.MakePartition(facesPeauFondOn, [], [], [], geompy.ShapeType["FACE"], 0, [], 1) + name="facePeau%d"%ifil + geompy.addToStudy(facePeau, name) + + facesPipePeau = [None for i in range(len(edgesFissExtPipe))] + endsEdgeFond = [None for i in range(len(edgesFissExtPipe))] + edgeRadFacePipePeau = [None for i in range(len(edgesFissExtPipe))] + + edgesListees = [] + edgesCircPeau = [] + verticesCircPeau = [] + if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau + + for face in facesPeauSorted[:-1]: # la ou les faces débouchantes, pas la grande face de peau + logging.debug("examen face debouchante circulaire") + for i,efep in enumerate(edgesFissExtPipe): + dist = geompy.MinDistance(face, efep) + logging.debug(" distance face circulaire edge %s", dist) + if dist < 1e-3: + for ik, edpfi in enumerate(edgesPeauFondIn): + if geompy.MinDistance(face, edpfi) < 1e-3: + break + sharedVertices = geompy.GetSharedShapesMulti([face, edgesPeauFondIn[ik]], geompy.ShapeType["VERTEX"]) + nameFace = "facePipePeau%d"%i + nameVert = "endEdgeFond%d"%i + nameEdge = "edgeRadFacePipePeau%d"%i + facesPipePeau[i] = face + endsEdgeFond[i] = sharedVertices[0] + geompy.addToStudy(face, nameFace) + geompy.addToStudy(sharedVertices[0], nameVert) + edgesFace = geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], True) + for edge in edgesFace: + if geompy.MinDistance(edge, sharedVertices[0]) < 1e-3: + edgeRadFacePipePeau[i] = edge + geompy.addToStudy(edge, nameEdge) + break + pass + pass + pass + pass + + # --- edges circulaires de la face de peau et points de jonction de la face externe de fissure + logging.debug("facesPipePeau: %s", facesPipePeau) + edgesCircPeau = [None for i in range(len(facesPipePeau))] + verticesCircPeau = [None for i in range(len(facesPipePeau))] + for i,fcirc in enumerate(facesPipePeau): + edges = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["EDGE"]) + grpEdgesCirc = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"]) + geompy.UnionList(grpEdgesCirc, edges) + edgesCircPeau[i] = grpEdgesCirc + name = "edgeCirc%d"%i + geompy.addToStudyInFather(facePeau, grpEdgesCirc, name) + edgesListees = edgesListees + edges + vertices = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["VERTEX"]) + grpVertCircPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["VERTEX"]) + geompy.UnionList(grpVertCircPeau, vertices) + verticesCircPeau[i] = grpVertCircPeau + name = "pointEdgeCirc%d"%i + geompy.addToStudyInFather(facePeau, grpVertCircPeau, name) + pass + pass # --- au moins une extrémité du pipe sur cette face de peau + + # --- edges de bord de la face de peau + + edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False) + edgesBords = [] + for i, edge in enumerate(edgesFilling): + edgepeau = geompy.GetInPlace(facePeau, edge) + name = "edgepeau%d"%i + geompy.addToStudyInFather(facePeau,edgepeau, name) + logging.debug("edgepeau %s", geompy.ShapeInfo(edgepeau)) + if geompy.ShapeInfo(edgepeau)['EDGE'] > 1: + logging.debug(" EDGES multiples") + edgs = geompy.ExtractShapes(edgepeau, geompy.ShapeType["EDGE"], False) + edgesBords += edgs + edgesListees += edgs + else: + logging.debug(" EDGE") + edgesBords.append(edgepeau) + edgesListees.append(edgepeau) + groupEdgesBordPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"]) + geompy.UnionList(groupEdgesBordPeau, edgesBords) + bordsVifs = None + if aretesVivesC is not None: + bordsVifs = geompy.GetInPlace(facePeau, aretesVivesC) + if bordsVifs is not None: + geompy.addToStudyInFather(facePeau, bordsVifs, "bordsVifs") + groupEdgesBordPeau = geompy.CutGroups(groupEdgesBordPeau, bordsVifs) + grptmp = None + if len(aretesVivesCoupees) > 0: + grpC = geompy.MakeCompound(aretesVivesCoupees) + grptmp = geompy.GetInPlace(facePeau, grpC) + if grptmp is not None: + grpnew = geompy.CutGroups(bordsVifs, grptmp) # ce qui est nouveau dans bordsVifs + else: + grpnew = bordsVifs + if grpnew is not None: + edv = geompy.ExtractShapes(grpnew, geompy.ShapeType["EDGE"], False) + aretesVivesCoupees += edv + logging.debug("aretesVivesCoupees %s",aretesVivesCoupees) + geompy.addToStudyInFather(facePeau, groupEdgesBordPeau , "EdgesBords") + + # --- edges de la face de peau partagées avec la face de fissure + + edgesPeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False) + edges = substractSubShapes(facePeau, edgesPeau, edgesListees) + edgesFissurePeau = [] + if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau + edgesFissurePeau = [None for i in range(len(verticesCircPeau))] # edges associés aux extrémités du pipe, en premier + for edge in edges: + for i, grpVert in enumerate(verticesCircPeau): + if (geompy.MinDistance(grpVert, edge) < 1.e-3) and (edge not in edgesFissurePeau): + edgesFissurePeau[i] = edge + name = "edgeFissurePeau%d"%i + geompy.addToStudyInFather(facePeau, edge, name) + for edge in edges: # on ajoute après les edges manquantes + if edge not in edgesFissurePeau: + edgesFissurePeau.append(edge) + else: + for i, edge in enumerate(edges): + edgesFissurePeau.append(edge) + name = "edgeFissurePeau%d"%i + geompy.addToStudyInFather(facePeau, edge, name) + + + ptEdgeFond[ifil] = endsEdgeFond # pour chaque face [points edge fond de fissure aux débouchés du pipe] + fsPipePeau[ifil] = facesPipePeau # pour chaque face [faces du pipe débouchantes] + edRadFPiPo[ifil] = edgeRadFacePipePeau # pour chaque face [edge radiale des faces du pipe débouchantes ] + fsFissuExt[ifil] = facesFissExt # pour chaque face [faces de fissure externes au pipe] + edFisExtPe[ifil] = edgesFissExtPeau # pour chaque face [edge en peau des faces de fissure externes (pas subshape facePeau)] + edFisExtPi[ifil] = edgesFissExtPipe # pour chaque face [edge commun au pipe des faces de fissure externes] + facesPeaux[ifil] = facePeau # pour chaque face : la face de peau finale a mailler (percee des faces débouchantes) + edCircPeau[ifil] = edgesCircPeau # pour chaque face de peau : [groupe subshapes edges circulaires aux débouchés du pipe] + ptCircPeau[ifil] = verticesCircPeau # pour chaque face de peau : [groupe subshapes points sur edges circulaires aux débouchés du pipe] + gpedgeBord[ifil] = groupEdgesBordPeau # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine + gpedgeVifs[ifil] = bordsVifs # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives + edFissPeau[ifil] = edgesFissurePeau # pour chaque face de peau : [subshape edge en peau des faces de fissure externes] + ptFisExtPi[ifil] = verticesPipePeau # pour chaque face de peau : [point commun edFissPeau edCircPeau] + + # ----------------------------------------------------------------------- + # fin de la boucle sur les faces de filling + # ----------------------------------------------------------------------- + + for i, avc in enumerate(aretesVivesCoupees): + name = "areteViveCoupee%d"%i + geompy.addToStudy(avc, name) + + # --- identification des faces et edges de fissure externe pour maillage + + facesFissExt = [] + edgesFissExtPeau = [] + edgesFissExtPipe = [] + for ifil in range(nbFacesFilling): # TODO: éliminer les doublons (comparer tous les vertices triés, avec mesure de distance ?) + facesFissExt += fsFissuExt[ifil] + edgesFissExtPeau += edFisExtPe[ifil] + edgesFissExtPipe += edFisExtPi[ifil] + logging.debug("---------------------------- identification faces de fissure externes au pipe :%s ", len(facesFissExt)) + # regroupement des faces de fissure externes au pipe. + + if len(facesFissExt) > 1: + faceFissureExterne = geompy.MakePartition(facesFissExt, [], [], [], geompy.ShapeType["FACE"], 0, [], 0) + edgesPipeFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesPipeFiss)) # edgesFissExtPipe peut ne pas couvrir toute la longueur + # edgesPeauFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesFissExtPeau)) + # il peut manquer des edges de faceFissureExterne en contact avec la peau dans edgesFissExtPeau + (isDone, closedFreeBoundaries, openFreeBoundaries) = geompy.GetFreeBoundary(faceFissureExterne) + edgesBordFFE = [] + for bound in closedFreeBoundaries: + edgesBordFFE += geompy.ExtractShapes(bound, geompy.ShapeType["EDGE"], False) + edgesBordFFEid = [ (ed,geompy.GetSubShapeID(faceFissureExterne, ed)) for ed in edgesBordFFE] + logging.debug("edgesBordFFEid %s", edgesBordFFEid) + edgesPPE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False) + edgesPPEid = [ geompy.GetSubShapeID(faceFissureExterne, ed) for ed in edgesPPE] + logging.debug("edgesPPEid %s", edgesPPEid) + edgesPFE = [ edid[0] for edid in edgesBordFFEid if edid[1] not in edgesPPEid] # on garde toutes les edges de bord non en contact avec le pipe + logging.debug("edgesPFE %s", edgesPFE) + edgesPeauFissureExterneC = geompy.MakeCompound(edgesPFE) + else: + faceFissureExterne = facesFissExt[0] + edgesPeauFissureExterneC = geompy.MakeCompound(edgesFissExtPeau) + edgesPipeFissureExterneC = geompy.MakeCompound(edgesFissExtPipe) + wirePipeFissureExterne = geompy.MakeWire(geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)) + geompy.addToStudy(faceFissureExterne, "faceFissureExterne") + geompy.addToStudyInFather(faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne") + geompy.addToStudyInFather(faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne") + + logging.debug("---------------------------- Preparation Maillage du Pipe --------------") + # ----------------------------------------------------------------------- + # --- preparation maillage du pipe : + # - détections des points a respecter : jonction des edges/faces constituant + # la face de fissure externe au pipe + # - points sur les edges de fond de fissure et edges pipe/face fissure, + # - vecteurs tangents au fond de fissure (normal au disque maillé) + + # --- option de maillage selon le rayon de courbure du fond de fissure + lenEdgeFondExt = 0 + for edff in edgesFondFiss: + lenEdgeFondExt += geompy.BasicProperties(edff)[0] + + disfond = [] + for filling in facesDefaut: + disfond.append(geompy.MinDistance(centreFondFiss, filling)) + disfond.sort() + rcourb = disfond[0] + nbSegQuart = 5 # on veut 5 segments min sur un quart de cercle + alpha = math.pi/(4*nbSegQuart) + deflexion = rcourb*(1.0 -math.cos(alpha)) + lgmin = lenSegPipe*0.25 + lgmax = lenSegPipe*1.5 + logging.debug("rcourb: %s, lenFond:%s, deflexion: %s, lgmin: %s, lgmax: %s", rcourb, lenEdgeFondExt, deflexion, lgmin, lgmax) + + meshFondExt = smesh.Mesh(wireFondFiss) + algo1d = meshFondExt.Segment() + hypo1d = algo1d.Adaptive(lgmin, lgmax, deflexion) # a ajuster selon la profondeur de la fissure + isDone = meshFondExt.Compute() + + ptGSdic = {} # dictionnaire [paramètre sur la courbe] --> point géométrique + allNodeIds = meshFondExt.GetNodesId() + for nodeId in allNodeIds: + xyz = meshFondExt.GetNodeXYZ(nodeId) + #logging.debug("nodeId %s, coords %s", nodeId, str(xyz)) + pt = geompy.MakeVertex(xyz[0], xyz[1], xyz[2]) + u, PointOnEdge, EdgeInWireIndex = geompy.MakeProjectionOnWire(pt, wireFondFiss) # u compris entre 0 et 1 + edgeOrder = edgesIdByOrientation[EdgeInWireIndex] + ptGSdic[(edgeOrder, EdgeInWireIndex, u)] = pt + #logging.debug("nodeId %s, u %s", nodeId, str(u)) + usort = sorted(ptGSdic) + logging.debug("nombre de points obtenus par deflexion %s",len(usort)) + + centres = [] + origins = [] + normals = [] + for edu in usort: + ied = edu[1] + u = edu[2] + vertcx = ptGSdic[edu] + norm = geompy.MakeTangentOnCurve(edgesFondFiss[ied], u) + plan = geompy.MakePlane(vertcx, norm, 3*rayonPipe) + part = geompy.MakePartition([plan], [wirePipeFiss], [], [], geompy.ShapeType["VERTEX"], 0, [], 0) + liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True) + if len(liste) == 5: # 4 coins du plan plus intersection recherchée + for point in liste: + if geompy.MinDistance(point, vertcx) < 1.1*rayonPipe: # les quatre coins sont plus loin + vertpx = point + break + centres.append(vertcx) + origins.append(vertpx) + normals.append(norm) +# name = "vertcx%d"%i +# geompy.addToStudyInFather(wireFondFiss, vertcx, name) +# name = "vertpx%d"%i +# geompy.addToStudyInFather(wireFondFiss, vertpx, name) +# name = "plan%d"%i +# geompy.addToStudyInFather(wireFondFiss, plan, name) + + # --- maillage du pipe étendu, sans tenir compte de l'intersection avec la face de peau + + logging.debug("nbsegCercle %s", nbsegCercle) + + # ----------------------------------------------------------------------- + # --- points géométriques + + gptsdisks = [] # vertices géométrie de tous les disques + raydisks = [[] for i in range(nbsegCercle)] + for i in range(len(centres)): # boucle sur les disques + gptdsk = [] # vertices géométrie d'un disque + vertcx = centres[i] + vertpx = origins[i] + normal = normals[i] + vec1 = geompy.MakeVector(vertcx, vertpx) + + points = [vertcx] # les points du rayon de référence + for j in range(nbsegRad): + pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, (j+1)*float(rayonPipe)/nbsegRad) + points.append(pt) + gptdsk.append(points) + pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, 1.5*rayonPipe) + rayon = geompy.MakeLineTwoPnt(vertcx, pt) + raydisks[0].append(rayon) + + for k in range(nbsegCercle-1): + angle = (k+1)*2*math.pi/nbsegCercle + pts = [vertcx] # les points d'un rayon obtenu par rotation + for j in range(nbsegRad): + pt = geompy.MakeRotation(points[j+1], normal, angle) + pts.append(pt) + gptdsk.append(pts) + ray = geompy.MakeRotation(rayon, normal, angle) + raydisks[k+1].append(ray) + + gptsdisks.append(gptdsk) + + # ----------------------------------------------------------------------- + # --- recherche des points en trop (externes au volume à remailler) + # - on associe chaque extrémité du pipe à une face filling + # - on part des disques aux extrémités du pipe + # - pour chaque disque, on prend les vertices de géométrie, + # on marque leur position relative à la face. + # - on s'arrete quand tous les noeuds sont dedans + + logging.debug("---------------------------- recherche des points du pipe a éliminer --------------") + + pt0 = centres[0] + pt1 = centres[-1] + idFillingFromBout = [None, None] # contiendra l'index du filling pour les extrémités 0 et 1 + for ifil in range(nbFacesFilling): + for ipt, pt in enumerate(ptEdgeFond[ifil]): # il y a un ou deux points débouchant sur cette face + if geompy.MinDistance(pt,pt0) < geompy.MinDistance(pt,pt1): # TODO: trouver plus fiable pour les cas tordus... + idFillingFromBout[0] = ifil + else: + idFillingFromBout[1] = ifil + logging.debug("association bouts du pipe - faces de filling: %s", idFillingFromBout) + + facesPipePeau = [] + edgeRadFacePipePeau = [] + for ifil in range(nbFacesFilling): + facesPipePeau += fsPipePeau[ifil] + edgeRadFacePipePeau += edRadFPiPo[ifil] + + logging.debug("recherche des disques de noeuds complètement internes") + idisklim = [] # indices des premier et dernier disques internes + idiskout = [] # indices des premier et dernier disques externes + for bout in range(2): + if bout == 0: + idisk = -1 + inc = 1 + numout = -1 + else: + idisk = len(gptsdisks) + inc = -1 + numout = len(gptsdisks) + inside = False + outside = True + while not inside: + idisk = idisk + inc + logging.debug("examen disque %s", idisk) + gptdsk = gptsdisks[idisk] + inside = True + for k in range(nbsegCercle): + points = gptdsk[k] + for j, pt in enumerate(points): + side = whichSideVertex(facesDefaut[idFillingFromBout[bout]], pt) + if side < 0: + if outside: # premier point detecté dedans + outside = False + numout = idisk -inc # le disque précédent était dehors + else: + inside = False # ce point est dehors + if not inside and not outside: + break + idisklim.append(idisk) # premier et dernier disques internes + idiskout.append(numout) # premier et dernier disques externes + + # --- listes de nappes radiales en filling à chaque extrémité débouchante + facesDebouchantes = [False, False] + idFacesDebouchantes = [-1, -1] # contiendra les indices des faces disque débouchantes (facesPipePeau) + listNappes =[] + for i, idisk in enumerate(idisklim): + numout = idiskout[i] + logging.debug("extremité %s, indices disques interne %s, externe %s",i, idisk, numout) + nappes = [] + if (idisk != 0) and (idisk != len(gptsdisks)-1): # si extrémité débouchante + for k in range(nbsegCercle): + if i == 0: + iddeb = max(0, numout) + idfin = max(iddeb+3,idisk+1) # il faut 3 rayons pour faire un filling qui suive le fond de fissure + #logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb) + comp = geompy.MakeCompound(raydisks[k][iddeb:idfin]) + name='compoundRay%d'%k + geompy.addToStudy(comp, name) + else: + idfin = min(len(gptsdisks), numout+1) + iddeb = min(idfin-3, idisk) # il faut 3 rayons pour faire un filling qui suive le fond de fissure + #logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb) + comp = geompy.MakeCompound(raydisks[k][iddeb:idfin]) + name='compoundRay%d'%k + geompy.addToStudy(comp, name) + nappe = geompy.MakeFilling(comp, 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default) + nappes.append(nappe) + name='nappe%d'%k + geompy.addToStudy(nappe, name) + facesDebouchantes[i] = True + listNappes.append(nappes) + + # --- mise en correspondance avec les indices des faces disque débouchantes (facesPipePeau) + for i, nappes in enumerate(listNappes): + if facesDebouchantes[i]: + for k, face in enumerate(facesPipePeau): + edge = geompy.MakeSection(face, nappes[0]) + if geompy.NbShapes(edge, geompy.ShapeType["EDGE"]) > 0: + idFacesDebouchantes[i] = k + break + logging.debug("idFacesDebouchantes: %s", idFacesDebouchantes) + + # --- construction des listes d'edges radiales sur chaque extrémité débouchante + listEdges = [] + for i, nappes in enumerate(listNappes): + id = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau) + if id < 0: + listEdges.append([]) + else: + face = facesPipePeau[id] + edges = [edgeRadFacePipePeau[id]] + for k, nappe in enumerate(nappes): + if k > 0: + obj = geompy.MakeSection(face, nappes[k]) # normalement une edge, parfois un compound d'edges dont un tout petit + edge = obj + vs = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False) + if len(vs) > 2: + eds = geompy.ExtractShapes(obj, geompy.ShapeType["EDGE"], False) + [edsorted, minl,maxl] = sortEdges(eds) + edge = edsorted[-1] + else: + maxl = geompy.BasicProperties(edge)[0] + if maxl < 0.01: # problème MakeSection + logging.debug("problème MakeSection recherche edge radiale %s, longueur trop faible: %s, utilisation partition", k, maxl) + partNappeFace = geompy.MakePartition([face, nappes[k]], [] , [], [], geompy.ShapeType["FACE"], 0, [], 0) + edps= geompy.ExtractShapes(partNappeFace, geompy.ShapeType["EDGE"], False) + ednouv = [] + for ii, ed in enumerate(edps): + vxs = geompy.ExtractShapes(ed, geompy.ShapeType["VERTEX"], False) + distx = [geompy.MinDistance(vx, face) for vx in vxs] + distx += [geompy.MinDistance(vx, nappes[k]) for vx in vxs] + dmax = max(distx) + logging.debug(" dmax %s",dmax) + if dmax < 0.01: + ednouv.append(ed) + logging.debug(" edges issues de la partition: %s", ednouv) + for ii, ed in enumerate(ednouv): + geompy.addToStudy(ed, "ednouv%d"%ii) + [edsorted, minl,maxl] = sortEdges(ednouv) + logging.debug(" longueur edge trouvée: %s", maxl) + edge = edsorted[-1] + edges.append(edge) + name = 'edgeEndPipe%d'%k + geompy.addToStudy(edge, name) + listEdges.append(edges) + + # --- création des points du maillage du pipe sur la face de peau + for i, edges in enumerate(listEdges): + id = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau) + if id >= 0: + gptdsk = [] + if id > 0: # id vaut 0 ou 1 + id = -1 # si id vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face) + centre = ptEdgeFond[idFillingFromBout[i]][id] + name = "centre%d"%id + geompy.addToStudy(centre, name) + vertPipePeau = ptFisExtPi[idFillingFromBout[i]][id] + geompy.addToStudyInFather(centre, vertPipePeau, "vertPipePeau") + grpsEdgesCirc = edCircPeau[idFillingFromBout[i]] # liste de groupes + edgesCirc = [] + for grpEdgesCirc in grpsEdgesCirc: + edgesCirc += geompy.ExtractShapes(grpEdgesCirc, geompy.ShapeType["EDGE"], False) + for k, edge in enumerate(edges): + extrems = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], True) + if geompy.MinDistance(centre, extrems[0]) < geompy.MinDistance(centre, extrems[1]): + bout = extrems[1] + else: + bout = extrems[0] + # ajustement du point extrémité (bout) sur l'edge circulaire en face de peau + logging.debug("edgesCirc: %s", edgesCirc) + distEdgeCirc = [(geompy.MinDistance(bout, edgeCirc), k2, edgeCirc) for k2, edgeCirc in enumerate(edgesCirc)] + distEdgeCirc.sort() + logging.debug("distEdgeCirc: %s", distEdgeCirc) + u = projettePointSurCourbe(bout, distEdgeCirc[0][2]) + if (abs(u) < 0.02) or (abs(1-u) < 0.02): # les points très proches d'une extrémité doivent y être mis précisément. + extrCircs = geompy.ExtractShapes(distEdgeCirc[0][2], geompy.ShapeType["VERTEX"], True) + if geompy.MinDistance(bout, extrCircs[0]) < geompy.MinDistance(bout, extrCircs[1]): + bout = extrCircs[0] + else: + bout = extrCircs[1] + pass + else: + bout = geompy.MakeVertexOnCurve(distEdgeCirc[0][2], u) + name ="bout%d"%k + geompy.addToStudyInFather(centre, bout, name) + # enregistrement des points dans la structure + points = [] + for j in range(nbsegRad +1): + u = j/float(nbsegRad) + points.append(geompy.MakeVertexOnCurve(edge, u)) + if geompy.MinDistance(bout, points[0]) < geompy.MinDistance(centre, points[0]): + points.reverse() + points[0] = centre + points[-1] = bout + gptdsk.append(points) + if i == 0: + gptsdisks[idisklim[0] -1] = gptdsk + idisklim[0] = idisklim[0] -1 + else: + gptsdisks[idisklim[1] +1] = gptdsk + idisklim[1] = idisklim[1] +1 + + # --- ajustement precis des points sur edgesPipeFissureExterneC + + edgesPFE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False) + verticesPFE = findWireIntermediateVertices(wirePipeFissureExterne) # vertices intermédiaires (des points en trop dans ptsInWireFissExtPipe) + idiskmin = idisklim[0] + 1 # on ne prend pas le disque sur la peau, déjà ajusté + idiskmax = idisklim[1] # on ne prend pas le disque sur la peau, déjà ajusté + idiskint = [] + for vtx in verticesPFE: + distPtVt = [] + for idisk in range(idiskmin, idiskmax): + gptdsk = gptsdisks[idisk] + pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe + distPtVt.append((geompy.MinDistance(pt, vtx), idisk)) + distPtVt.sort() + idiskint.append(distPtVt[0][1]) + gptsdisks[idiskint[-1]][0][-1] = vtx + logging.debug("ajustement point sur edgePipeFissureExterne, vertex: %s %s", idiskint[-1], distPtVt[0][0]) + for idisk in range(idiskmin, idiskmax): + if idisk in idiskint: + break + logging.debug("ajustement point sur edgePipeFissureExterne: %s", idisk) + gptdsk = gptsdisks[idisk] + pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe + distPtEd = [(geompy.MinDistance(pt, edgePFE), k, edgePFE) for k, edgePFE in enumerate(edgesPFE)] + distPtEd.sort() + edgePFE = distPtEd[0][2] + u = projettePointSurCourbe(pt, edgePFE) + ptproj = geompy.MakeVertexOnCurve(edgePFE, u) + gptsdisks[idisk][0][-1] = ptproj + + # ----------------------------------------------------------------------- + # --- maillage effectif du pipe + + logging.debug("---------------------------- maillage effectif du pipe --------------") + meshPipe = smesh.Mesh(None, "meshPipe") + fondFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "FONDFISS") + nodesFondFissGroup = meshPipe.CreateEmptyGroup(SMESH.NODE, "nfondfis") + faceFissGroup = meshPipe.CreateEmptyGroup(SMESH.FACE, "fisInPi") + edgeFaceFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeFaceFiss") + edgeCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe0") + edgeCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe1") + faceCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe0") + faceCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe1") + mptsdisks = [] # vertices maillage de tous les disques + mEdges = [] # identifiants edges maillage fond de fissure + mEdgeFaces = [] # identifiants edges maillage edge face de fissure externe + mFaces = [] # identifiants faces maillage fissure + mVols = [] # identifiants volumes maillage pipe + + mptdsk = None + for idisk in range(idisklim[0], idisklim[1]+1): # boucle sur les disques internes + + # ----------------------------------------------------------------------- + # --- points + + gptdsk = gptsdisks[idisk] + if idisk > idisklim[0]: + oldmpts = mptdsk + mptdsk = [] # vertices maillage d'un disque + for k in range(nbsegCercle): + points = gptdsk[k] + mptids = [] + for j, pt in enumerate(points): + if j == 0 and k > 0: + id = mptdsk[0][0] + else: + coords = geompy.PointCoordinates(pt) + id = meshPipe.AddNode(coords[0], coords[1], coords[2]) + mptids.append(id) + mptdsk.append(mptids) + mptsdisks.append(mptdsk) + + # ----------------------------------------------------------------------- + # --- groupes edges cercles debouchants + + if idisk == idisklim[0]: + pts = [] + for k in range(nbsegCercle): + pts.append(mptdsk[k][-1]) + edges = [] + for k in range(len(pts)): + k1 = (k+1)%len(pts) + idEdge = meshPipe.AddEdge([pts[k], pts[k1]]) + edges.append(idEdge) + edgeCircPipe0Group.Add(edges) + + if idisk == idisklim[1]: + pts = [] + for k in range(nbsegCercle): + pts.append(mptdsk[k][-1]) + edges = [] + for k in range(len(pts)): + k1 = (k+1)%len(pts) + idEdge = meshPipe.AddEdge([pts[k], pts[k1]]) + edges.append(idEdge) + edgeCircPipe1Group.Add(edges) + + # ----------------------------------------------------------------------- + # --- groupes faces debouchantes + + if idisk == idisklim[0]: + faces = [] + for j in range(nbsegRad): + for k in range(nbsegCercle): + k1 = k+1 + if k == nbsegCercle-1: + k1 = 0 + if j == 0: + idf = meshPipe.AddFace([mptdsk[k][0], mptdsk[k][1], mptdsk[k1][1]]) # triangle + else: + idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle + faces.append(idf) + faceCircPipe0Group.Add(faces) + + if idisk == idisklim[1]: + faces = [] + for j in range(nbsegRad): + for k in range(nbsegCercle): + k1 = k+1 + if k == nbsegCercle-1: + k1 = 0 + if j == 0: + idf = meshPipe.AddFace([mptdsk[k][0], mptdsk[k][1], mptdsk[k1][1]]) # triangle + else: + idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle + faces.append(idf) + faceCircPipe1Group.Add(faces) + + # ----------------------------------------------------------------------- + # --- mailles volumiques, groupes noeuds et edges de fond de fissure, groupe de face de fissure + + if idisk == idisklim[0]: + mEdges.append(0) + mEdgeFaces.append(0) + mFaces.append([0]) + mVols.append([[0]]) + nodesFondFissGroup.Add([mptdsk[0][0]]) + else: + ide = meshPipe.AddEdge([oldmpts[0][0], mptdsk[0][0]]) + mEdges.append(ide) + fondFissGroup.Add([ide]) + nodesFondFissGroup.Add([mptdsk[0][0]]) + ide2 = meshPipe.AddEdge([oldmpts[0][-1], mptdsk[0][-1]]) + mEdgeFaces.append(ide2) + edgeFaceFissGroup.Add([ide2]) + idFaces = [] + idVols = [] + + for j in range(nbsegRad): + idf = meshPipe.AddFace([oldmpts[0][j], mptdsk[0][j], mptdsk[0][j+1], oldmpts[0][j+1]]) + faceFissGroup.Add([idf]) + idFaces.append(idf) + + idVolCercle = [] + for k in range(nbsegCercle): + k1 = k+1 + if k == nbsegCercle-1: + k1 = 0 + if j == 0: + idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], + oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1]]) + else: + idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j], + oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1], oldmpts[k1][j]]) + idVolCercle.append(idv) + idVols.append(idVolCercle) + + mFaces.append(idFaces) + mVols.append(idVols) + + pipeFissGroup = meshPipe.CreateEmptyGroup( SMESH.VOLUME, 'PIPEFISS' ) + nbAdd = pipeFissGroup.AddFrom( meshPipe.GetMesh() ) + + nb, new_mesh, new_group = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries") + edgesCircPipeGroup = [edgeCircPipe0Group, edgeCircPipe1Group] + + # --- fin du maillage du pipe + # ----------------------------------------------------------------------- + # --- edges de bord, faces défaut à respecter + + aFilterManager = smesh.CreateFilterManager() + nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ]) + criteres = [] + unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0) + criteres.append(unCritere) + filtre = smesh.GetFilterFromCriteria(criteres) + bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre ) + smesh.SetName(bordsLibres, 'bordsLibres') + + # --- pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes + # on désigne les faces de peau en quadrangles par le groupe "skinFaces" + + skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' ) + nbAdd = skinFaces.AddFrom( internalBoundary.GetMesh() ) + + # --- maillage des éventuelles arêtes vives entre faces reconstruites + + if len(aretesVivesCoupees) > 0: + aretesVivesC = geompy.MakeCompound(aretesVivesCoupees) + meshAretesVives = smesh.Mesh(aretesVivesC) + algo1d = meshAretesVives.Segment() + hypo1d = algo1d.LocalLength(dmoyen/3.0,[],1e-07) + putName(algo1d.GetSubMesh(), "aretesVives") + putName(algo1d, "algo1d_aretesVives") + putName(hypo1d, "hypo1d_aretesVives") + isDone = meshAretesVives.Compute() + logging.info("aretesVives fini") + grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' ) + nbAdd = grpAretesVives.AddFrom( meshAretesVives.GetMesh() ) + + # ----------------------------------------------------------------------- + # --- maillage faces de fissure + + logging.debug("---------------------------- maillage faces de fissure externes au pipe :%s --------------", len(facesFissExt)) + + meshFaceFiss = smesh.Mesh(faceFissureExterne) + algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_1D2D) + hypo2d = algo2d.Parameters() + hypo2d.SetMaxSize( areteFaceFissure ) + hypo2d.SetSecondOrder( 0 ) + hypo2d.SetOptimize( 1 ) + hypo2d.SetFineness( 2 ) + hypo2d.SetMinSize( rayonPipe/float(nbsegRad) ) + hypo2d.SetQuadAllowed( 0 ) + putName(algo2d.GetSubMesh(), "faceFiss") + putName(algo2d, "algo2d_faceFiss") + putName(hypo2d, "hypo2d_faceFiss") + + algo1d = meshFaceFiss.UseExisting1DElements(geom=edgesPipeFissureExterneC) + hypo1d = algo1d.SourceEdges([ edgeFaceFissGroup ],0,0) + putName(algo1d.GetSubMesh(), "edgeFissPeau") + putName(algo1d, "algo1d_edgeFissPeau") + putName(hypo1d, "hypo1d_edgeFissPeau") + + isDone = meshFaceFiss.Compute() + logging.info("meshFaceFiss fini") + + grpFaceFissureExterne = meshFaceFiss.GroupOnGeom(faceFissureExterne, "fisOutPi", SMESH.FACE) + grpEdgesPeauFissureExterne = meshFaceFiss.GroupOnGeom(edgesPeauFissureExterneC,'edgesPeauFissureExterne',SMESH.EDGE) + grpEdgesPipeFissureExterne = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE) + + # --- maillage faces de peau + + boutFromIfil = [None for i in range(nbFacesFilling)] + if idFillingFromBout[0] != idFillingFromBout[1]: # repérage des extremites du pipe quand elles débouchent sur des faces différentes + boutFromIfil[idFillingFromBout[0]] = 0 + boutFromIfil[idFillingFromBout[1]] = 1 + + logging.debug("---------------------------- maillage faces de peau --------------") + meshesFacesPeau = [] + for ifil in range(nbFacesFilling): + meshFacePeau = None + if partitionsPeauFissFond[ifil] is None: # face de peau maillage sain intacte + + # --- edges de bord de la face de filling + filling = facesDefaut[ifil] + edgesFilling = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], False) + groupEdgesBordPeau = geompy.CreateGroup(filling, geompy.ShapeType["EDGE"]) + geompy.UnionList(groupEdgesBordPeau, edgesFilling) + geompy.addToStudyInFather(filling, groupEdgesBordPeau , "EdgesBords") + + meshFacePeau = smesh.Mesh(facesDefaut[ifil]) + + algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau) + hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) + putName(algo1d.GetSubMesh(), "bordsLibres", ifil) + putName(algo1d, "algo1d_bordsLibres", ifil) + putName(hypo1d, "hypo1d_bordsLibres", ifil) + + else: + + facePeau = facesPeaux[ifil] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes) + edgesCircPeau = edCircPeau[ifil] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe] + verticesCircPeau = ptCircPeau[ifil] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe] + groupEdgesBordPeau = gpedgeBord[ifil] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine + bordsVifs = gpedgeVifs[ifil] # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives + edgesFissurePeau = edFissPeau[ifil] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes] + + meshFacePeau = smesh.Mesh(facePeau) + + algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau) + hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) + putName(algo1d.GetSubMesh(), "bordsLibres", ifil) + putName(algo1d, "algo1d_bordsLibres", ifil) + putName(hypo1d, "hypo1d_bordsLibres", ifil) + + algo1d = meshFacePeau.UseExisting1DElements(geom=geompy.MakeCompound(edgesFissurePeau)) + hypo1d = algo1d.SourceEdges([ grpEdgesPeauFissureExterne ],0,0) + putName(algo1d.GetSubMesh(), "edgePeauFiss", ifil) + putName(algo1d, "algo1d_edgePeauFiss", ifil) + putName(hypo1d, "hypo1d_edgePeauFiss", ifil) + + if bordsVifs is not None: + algo1d = meshFacePeau.UseExisting1DElements(geom=bordsVifs) + hypo1d = algo1d.SourceEdges([ grpAretesVives ],0,0) + putName(algo1d.GetSubMesh(), "bordsVifs", ifil) + putName(algo1d, "algo1d_bordsVifs", ifil) + putName(hypo1d, "hypo1d_bordsVifs", ifil) + + for i, edgeCirc in enumerate(edgesCircPeau): + if edgeCirc is not None: + algo1d = meshFacePeau.UseExisting1DElements(geom=edgeCirc) + if boutFromIfil[ifil] is None: + hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[i] ],0,0) + else: + hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[boutFromIfil[ifil]] ],0,0) + name = "cercle%d"%i + putName(algo1d.GetSubMesh(), name, ifil) + putName(algo1d, "algo1d_" + name, ifil) + putName(hypo1d, "hypo1d_" + name, ifil) + + algo2d = meshFacePeau.Triangle(algo=smeshBuilder.NETGEN_1D2D) + hypo2d = algo2d.Parameters() + hypo2d.SetMaxSize( dmoyen ) + hypo2d.SetOptimize( 1 ) + hypo2d.SetFineness( 2 ) + hypo2d.SetMinSize( rayonPipe/float(nbsegRad) ) + hypo2d.SetQuadAllowed( 0 ) + putName(algo2d.GetSubMesh(), "facePeau", ifil) + putName(algo2d, "algo2d_facePeau", ifil) + putName(hypo2d, "hypo2d_facePeau", ifil) + + isDone = meshFacePeau.Compute() + logging.info("meshFacePeau %d fini", ifil) + GroupFaces = meshFacePeau.CreateEmptyGroup( SMESH.FACE, "facePeau%d"%ifil ) + nbAdd = GroupFaces.AddFrom( meshFacePeau.GetMesh() ) + meshesFacesPeau.append(meshFacePeau) + + # --- regroupement des maillages du défaut + + listMeshes = [internalBoundary.GetMesh(), + meshPipe.GetMesh(), + meshFaceFiss.GetMesh()] + for mp in meshesFacesPeau: + listMeshes.append(mp.GetMesh()) + + meshBoiteDefaut = smesh.Concatenate(listMeshes, 1, 1, 1e-05,False) + # pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes + # on désigne les faces de peau en quadrangles par le groupe "skinFaces" + group_faceFissOutPipe = None + group_faceFissInPipe = None + groups = meshBoiteDefaut.GetGroups() + for grp in groups: + if grp.GetType() == SMESH.FACE: + #if "internalBoundary" in grp.GetName(): + # grp.SetName("skinFaces") + if grp.GetName() == "fisOutPi": + group_faceFissOutPipe = grp + elif grp.GetName() == "fisInPi": + group_faceFissInPipe = grp + + # le maillage NETGEN ne passe pas toujours ==> utiliser GHS3D + distene=True + if distene: + algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.GHS3D) + else: + algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.NETGEN) + hypo3d = algo3d.MaxElementVolume(1000.0) + putName(algo3d.GetSubMesh(), "boiteDefaut") + putName(algo3d, "algo3d_boiteDefaut") + isDone = meshBoiteDefaut.Compute() + putName(meshBoiteDefaut, "boiteDefaut") + logging.info("meshBoiteDefaut fini") + + faceFissure = meshBoiteDefaut.GetMesh().UnionListOfGroups( [ group_faceFissOutPipe, group_faceFissInPipe ], 'FACE1' ) + maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin, + zoneDefaut_internalFaces, zoneDefaut_internalEdges) + putName(maillageSain, nomFicSain+"_coupe") + extrusionFaceFissure, normfiss = shapeSurFissure(facesPortFissure) + maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut, + None, None, 'COMPLET', normfiss) + + logging.info("conversion quadratique") + maillageComplet.ConvertToQuadratic( 1 ) + logging.info("groupes") + groups = maillageComplet.GetGroups() + grps = [ grp for grp in groups if grp.GetName() == 'FONDFISS'] + fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FONDFISS' ) + + logging.info("réorientation face de fissure FACE1") + grps = [ grp for grp in groups if grp.GetName() == 'FACE1'] + nb = maillageComplet.Reorient2D( grps[0], normfiss, grps[0].GetID(1)) + + logging.info("réorientation face de fissure FACE2") + plansim = geompy.MakePlane(O, normfiss, 10000) + fissnorm = geompy.MakeMirrorByPlane(normfiss, plansim) + grps = [ grp for grp in groups if grp.GetName() == 'FACE2'] + nb = maillageComplet.Reorient2D( grps[0], fissnorm, grps[0].GetID(1)) + fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' ) + + logging.info("export maillage fini") + maillageComplet.ExportMED( fichierMaillageFissure, 0, SMESH.MED_V2_2, 1 ) + putName(maillageComplet, nomFicFissure) + logging.info("fichier maillage fissure %s", fichierMaillageFissure) + + if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) + + logging.info("maillage fissure fini") + + return maillageComplet diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue.py b/src/Tools/blocFissure/gmu/insereFissureLongue.py new file mode 100644 index 000000000..ec8307c9d --- /dev/null +++ b/src/Tools/blocFissure/gmu/insereFissureLongue.py @@ -0,0 +1,656 @@ +# -*- coding: utf-8 -*- + +import logging +import salome +from geomsmesh import geompy +from geomsmesh import smesh +from salome.smesh import smeshBuilder +import SMESH +import math + +from extractionOrientee import extractionOrientee +from sortFaces import sortFaces +from sortEdges import sortEdges +from eliminateDoubles import eliminateDoubles +from substractSubShapes import substractSubShapes +from produitMixte import produitMixte +from findWireEndVertices import findWireEndVertices +from getSubshapeIds import getSubshapeIds +from putName import putName +from distance2 import distance2 +from enleveDefaut import enleveDefaut +from shapeSurFissure import shapeSurFissure +from regroupeSainEtDefaut import RegroupeSainEtDefaut +from triedreBase import triedreBase + +# ----------------------------------------------------------------------------- +# --- procedure complete fissure longue + +def insereFissureLongue(geometriesSaines, maillagesSains, + shapesFissure, shapeFissureParams, + maillageFissureParams, elementsDefaut, step=-1): + """ + TODO: a completer + """ + logging.info('start') + + #geometrieSaine = geometriesSaines[0] + #maillageSain = maillagesSains[0] + #isHexa = maillagesSains[1] + shapeDefaut = shapesFissure[0] # face de fissure, debordant + #tailleDefaut = shapesFissure[2] + wiretube = shapesFissure[4] # wire fond de fissure, debordant + planfiss = shapesFissure[7] # plan de fissure + pipefiss = shapesFissure[8] # pipe, debordant + + profondeur = shapeFissureParams['profondeur'] + rayonPipe = profondeur/4.0 + + nomRep = maillageFissureParams['nomRep'] + nomFicSain = maillageFissureParams['nomFicSain'] + nomFicFissure = maillageFissureParams['nomFicFissure'] + + #nbsegExt = maillageFissureParams['nbsegExt'] # 5 + #nbsegGen = maillageFissureParams['nbsegGen'] # 25 + #nbsegRad = maillageFissureParams['nbsegRad'] # 5 + #scaleRad = maillageFissureParams['scaleRad'] # 4 + #nbsegCercle = maillageFissureParams['nbsegCercle'] # 6 + #nbsegFis = maillageFissureParams['nbsegFis'] # 20 + #lensegEllipsoide = maillageFissureParams['lensegEllipso'] # 1.0 + + #fichierMaillageSain = nomRep + '/' + nomFicSain + '.med' + fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med' + + facesDefaut = elementsDefaut[0] + #centreDefaut = elementsDefaut[1] + #normalDefaut = elementsDefaut[2] + #extrusionDefaut = elementsDefaut[3] + #dmoyen = elementsDefaut[4] + #bordsPartages = elementsDefaut[5] + #fillconts = elementsDefaut[6] + #idFilToCont = elementsDefaut[7] + maillageSain = elementsDefaut[8] + internalBoundary = elementsDefaut[9] + zoneDefaut = elementsDefaut[10] + zoneDefaut_skin = elementsDefaut[11] + zoneDefaut_internalFaces = elementsDefaut[12] + zoneDefaut_internalEdges = elementsDefaut[13] + + facePorteFissure = shapeDefaut + WirePorteFondFissure = wiretube + fillingFaceExterne = facesDefaut[0] + print fillingFaceExterne + geompy.addToStudy(fillingFaceExterne, "fillingFaceExterne") + edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False) + + O, OX, OY, OZ = triedreBase() + + # ----------------------------------------------------------------------------- + # --- peau et face de fissure + + # --- partition peau defaut - face de fissure prolongee - wire de fond de fissure prolongée + partitionPeauFissFond = geompy.MakePartition([facePorteFissure, WirePorteFondFissure, fillingFaceExterne], [], [], [], geompy.ShapeType["FACE"], 0, [], 0) + geompy.addToStudy( partitionPeauFissFond, 'partitionPeauFissFond' ) + + edges = geompy.ExtractShapes(WirePorteFondFissure, geompy.ShapeType["EDGE"], False) + + lgmax = 0 + imax = 0 + for i, edge in enumerate(edges): + props = geompy.BasicProperties(edge) + lg = props[0] + if lg > lgmax: + lgmax = lg + imax = i + edgemax = edges[imax] + geompy.addToStudy(edgemax, 'edgemax') + centreFondFiss = geompy.MakeVertexOnCurve(edgemax, 0.5) + geompy.addToStudy(centreFondFiss, 'centreFondFiss') + tangentFondFiss = geompy.MakeTangentOnCurve(edgemax, 0.5) + geompy.addToStudy(tangentFondFiss, 'tangentFondFiss') + + bord1FondFiss = geompy.MakeVertexOnCurve(edgemax, 0.0) + geompy.addToStudy(bord1FondFiss, 'bord1FondFiss') + tangentBord1FondFiss = geompy.MakeTangentOnCurve(edgemax, 0.0) + geompy.addToStudy(tangentBord1FondFiss, 'tangentBord1FondFiss') + + bord2FondFiss = geompy.MakeVertexOnCurve(edgemax, 1.0) + geompy.addToStudy(bord2FondFiss, 'bord2FondFiss') + tangentBord2FondFiss = geompy.MakeTangentOnCurve(edgemax, 1.0) + geompy.addToStudy(tangentBord2FondFiss, 'tangentBord2FondFiss') + + planBord1 = geompy.MakePlane(bord1FondFiss, tangentBord1FondFiss, 3*rayonPipe) + planBord2 = geompy.MakePlane(bord2FondFiss, tangentBord2FondFiss, 3*rayonPipe) + geompy.addToStudy(planBord1, 'planBord1') + geompy.addToStudy(planBord2, 'planBord2') + + [edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3) + [facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3) + + # --- partition peau -face fissure - pipe fond de fissure prolongé + partitionPeauFissByPipe = geompy.MakePartition([facesInside[0], facesOnside[0]], [pipefiss], [], [], geompy.ShapeType["FACE"], 0, [], 0) + geompy.addToStudy( partitionPeauFissByPipe, 'partitionPeauFissByPipe' ) + + # --- identification face de peau + [facesPeauFissInside, facesPeauFissOutside, facesPeauFissOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissByPipe, centreFondFiss, "FACE", 0.1, "peauFiss_bord_") + facesPeauSorted, minsur, maxsurf = sortFaces(facesPeauFissOnside) # 4 demi disques, une grande face + facePeau = facesPeauSorted[-1] # la plus grande face + geompy.addToStudyInFather(partitionPeauFissByPipe, facePeau, "facePeau") + + # --- identification edges de bord face peau + edgesBords = [] + for i, edge in enumerate(edgesFilling): + edgepeau = geompy.GetInPlace(facePeau, edge) + edgesBords.append(edgepeau) + groupEdgesBordPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"]) + geompy.UnionList(groupEdgesBordPeau, edgesBords) + geompy.addToStudyInFather(facePeau, groupEdgesBordPeau , "EdgesBords") + + # --- identification face fissure externe au pipe et edge commune peau fissure + for face in facesPeauFissInside: + try: + sharedEdges = geompy.GetSharedShapesMulti([facePeau, face], geompy.ShapeType["EDGE"]) + if sharedEdges is not None: + faceFiss = face + edgePeauFiss = sharedEdges[0] + geompy.addToStudyInFather(partitionPeauFissByPipe, faceFiss, "faceFiss") + geompy.addToStudyInFather(faceFiss, edgePeauFiss, "edgePeauFiss") + geompy.addToStudyInFather(facePeau, edgePeauFiss, "edgePeauFiss") + break + except: + pass + verticesEdgePeauFiss = geompy.ExtractShapes(edgePeauFiss, geompy.ShapeType["VERTEX"], False) + + # --- identification edges demi cercle dans face de peau + edgesFacePeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False) + edgesFacePeauSorted, minlg, maxlg = sortEdges(edgesFacePeau) + demiCerclesPeau = edgesFacePeauSorted[0:4] + verticesDemiCerclesPeau = [] + for i, edge in enumerate(demiCerclesPeau): + name = "demiCerclePeau_%d"%i + geompy.addToStudyInFather(facePeau, edge, name) + verticesDemiCerclesPeau += geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False) + verticesDemiCerclesPeau = eliminateDoubles(facePeau, verticesDemiCerclesPeau) + for i, vertex in enumerate(verticesDemiCerclesPeau): + name = "verticesDemiCerclesPeau_%d"%i + geompy.addToStudyInFather(facePeau, vertex, name) + verticesOutCercles = substractSubShapes(facePeau, verticesDemiCerclesPeau, verticesEdgePeauFiss) + for i, vertex in enumerate(verticesOutCercles): + name = "verticesOutCercles_%d"%i + geompy.addToStudyInFather(facePeau, vertex, name) + + # --- demi cercles regroupés + groupsDemiCerclesPeau = [] + for i, vertex in enumerate(verticesEdgePeauFiss): + demis = [] + for edge in demiCerclesPeau: + if geompy.MinDistance(vertex, edge) < 1.e-5: + demis.append(edge) + group = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"]) + geompy.UnionList(group, demis) + name = "Cercle%d"%i + geompy.addToStudyInFather(facePeau, group , name) + groupsDemiCerclesPeau.append(group) + + # --- identification edges commune pipe face fissure externe au pipe + edgePeauFissId = geompy.GetSubShapeID(partitionPeauFissByPipe, edgePeauFiss) + edgesFaceFiss = geompy.ExtractShapes(faceFiss, geompy.ShapeType["EDGE"], False) + edgesFaceFissPipe = [] + for edge in edgesFaceFiss: + if geompy.GetSubShapeID(partitionPeauFissByPipe, edge) != edgePeauFissId: + edgesFaceFissPipe.append(edge) + name = "edgeFaceFissPipe_%d"%len(edgesFaceFissPipe) + geompy.addToStudyInFather(faceFiss, edge, name) + groupEdgesFaceFissPipe = geompy.CreateGroup(faceFiss, geompy.ShapeType["EDGE"]) + geompy.UnionList(groupEdgesFaceFissPipe, edgesFaceFissPipe) + geompy.addToStudyInFather(faceFiss, groupEdgesFaceFissPipe, "edgesFaceFissPipe") + + # ----------------------------------------------------------------------------- + # --- pipe de fond de fissure + + wireFondFiss = geompy.MakeWire(edgesInside, 1e-07) + + disque = geompy.MakeDiskPntVecR(centreFondFiss, tangentFondFiss, rayonPipe) + [vertex] = geompy.ExtractShapes(disque, geompy.ShapeType["VERTEX"], False) + vertproj = geompy.MakeProjection(vertex, planfiss) + vec1 = geompy.MakeVector(centreFondFiss, vertex) + try: + # si centreFondFiss et vertproj sont proches: exception. Angle = +- 90° + vec2 = geompy.MakeVector(centreFondFiss, vertproj) + angle = geompy.GetAngleRadians(vec1, vec2) + except: + # on utilise la projection du centre sur la peau pour avoir un vecteur non nul + vertproj = geompy.MakeProjection(centreFondFiss, facePeau) + vec2 = geompy.MakeVector(centreFondFiss, vertproj) + angle = geompy.GetAngleRadians(vec1, vec2) + sommetAxe = geompy.MakeTranslationVector(centreFondFiss, tangentFondFiss) + pm = produitMixte(centreFondFiss, vertex, vertproj, sommetAxe) + if pm > 0: + disque = geompy.MakeRotation(disque, tangentFondFiss, angle) + else: + disque = geompy.MakeRotation(disque, tangentFondFiss, -angle) + [vertexReference] = geompy.ExtractShapes(disque, geompy.ShapeType["VERTEX"], False) + + pipeFondFiss = geompy.MakePipe(disque, wireFondFiss) + pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], [], [], geompy.ShapeType["SOLID"], 0, [], 0) + #pipe = geompy.MakePipe(disque, WirePorteFondFissure) + #pipe = geompy.MakePartition([pipe],[fillingFaceExterne], [], [], geompy.ShapeType["SOLID"], 0, [], 0) + #pipes = geompy.ExtractShapes(pipe, geompy.ShapeType["SOLID"], False) + #pipesSorted, volmin, volmax = sortSolids(pipes) + #pipeFondFiss = pipesSorted[-1] + #pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], [], [], geompy.ShapeType["SOLID"], 0, [], 0) + + geompy.addToStudy( disque, 'disque') + geompy.addToStudy( wireFondFiss, 'wireFondFiss') + geompy.addToStudy( pipeFondFiss, 'pipeFondFiss') + + VerticesEndFondFiss = findWireEndVertices(wireFondFiss) + for i, v in enumerate(VerticesEndFondFiss): + name = "vertexEndFondFiss_%d"%i + geompy.addToStudyInFather(wireFondFiss, v, name) + VerticesEndPipeFiss = [] + for v in VerticesEndFondFiss: + VerticesEndPipeFiss.append(geompy.GetInPlace(pipeFondFiss, v)) + for i, v in enumerate(VerticesEndPipeFiss): + name = "vertexEndPipeFiss_%d"%i + geompy.addToStudyInFather(pipeFondFiss, v, name) + + geompy.addToStudyInFather(pipeFondFiss, VerticesEndPipeFiss[0], "PFOR") + geompy.addToStudyInFather(pipeFondFiss, VerticesEndPipeFiss[1], "PFEX") + if geompy.MinDistance(VerticesEndPipeFiss[0], verticesOutCercles[0]) > geompy.MinDistance(VerticesEndPipeFiss[0], verticesOutCercles[1]): + a = verticesOutCercles[0] + verticesOutCercles[0] = verticesOutCercles[1] + verticesOutCercles[1] = a + geompy.addToStudyInFather(facePeau, verticesOutCercles[0], "THOR") + geompy.addToStudyInFather(facePeau, verticesOutCercles[1], "THEX") + + [facesPipeInside, facesPipeOutside, facesPipeOnside] = extractionOrientee(fillingFaceExterne, pipeFondFiss, centreFondFiss, "FACE", 0.1, "pipe_bord_") + [edgesPipeInside, edgesPipeOutside, edgesPipeOnside] = extractionOrientee(fillingFaceExterne, pipeFondFiss, centreFondFiss, "EDGE", 0.1, "pipe_bord_") + disqueInt1 = geompy.GetInPlaceByHistory(pipeFondFiss, planBord1) + disqueInt2 = geompy.GetInPlaceByHistory(pipeFondFiss, planBord2) + disques = facesPipeOnside + [disqueInt1, disqueInt2] + edgesDiskInt = geompy.ExtractShapes(disqueInt1, geompy.ShapeType["EDGE"], False) + edgesDiskInt = edgesDiskInt +geompy.ExtractShapes(disqueInt2, geompy.ShapeType["EDGE"], False) + edgesSorted, minlg, maxlg = sortEdges(edgesDiskInt) # 4 rayons, 2 demi cercles + + centre = geompy.MakeVertexOnSurface(planfiss, 0.5, 0.5) + refpoint = geompy.MakeTranslationVector(centre, geompy.GetNormal(planfiss,centre)) + geompy.addToStudy(refpoint, 'refpoint') + [facesPipeInplan, facesPipeOutplan, facesPipeOnplan] = extractionOrientee(planfiss, pipeFondFiss, refpoint, "FACE", 0.1, "pipe_plan_") + [edgesPipeInplan, edgesPipeOutplan, edgesPipeOnplan] = extractionOrientee(planfiss, pipeFondFiss, refpoint, "EDGE", 0.1, "pipe_plan_") + + # --- rayon disques = (edgesPipeOnside inter edgesPipeOnplan) + rayons disque internes + # demi cercles = edgesPipeOnside moins edgesPipeOnplan + demi cercles disque internes + # generatrices = edgesPipeOnplan moins rayon disques (3 grandes et 6 petites) + edgesIdPipeOnside = getSubshapeIds(pipeFondFiss, edgesPipeOnside) + edgesIdPipeOnplan = getSubshapeIds(pipeFondFiss, edgesPipeOnplan) + rayons = [] + demiCercles = [] + for i, edgeId in enumerate(edgesIdPipeOnside): + if edgeId in edgesIdPipeOnplan: + rayons.append(edgesPipeOnside[i]) + else: + demiCercles.append(edgesPipeOnside[i]) + demiCerclesExternes = demiCercles + rayons = rayons + edgesSorted[:4] # les 4 plus petits sont les rayons + demiCercles = demiCercles + edgesSorted[4:] # les suivants sont les arcs de cercle + rayonsId = getSubshapeIds(pipeFondFiss, rayons) + generatrices = [] + for i, edgeId in enumerate(edgesIdPipeOnplan): + if edgeId not in rayonsId: + generatrices.append(edgesPipeOnplan[i]) + + # --- generatrices en contact avec la face fissure externe au pipe + generFiss = [] + for edge in generatrices: + distance = geompy.MinDistance(vertexReference, edge) + logging.debug("distance %s", distance) + if distance < 1.e-5: + generFiss.append(edge) + break + for edge in generatrices: + distance = geompy.MinDistance(generFiss[0], edge) + logging.debug("distance %s", distance) + if distance < 1.e-5: + generFiss.append(edge) + groupGenerFiss = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"]) + geompy.UnionList(groupGenerFiss, generFiss) + geompy.addToStudyInFather(pipeFondFiss, groupGenerFiss, "GenFiss") + + # --- demi cercles externes regroupés + groupsDemiCerclesPipe = [] + for i, vertex in enumerate(verticesEdgePeauFiss): + demis = [] + for edge in demiCerclesExternes: + if geompy.MinDistance(vertex, edge) < 0.1: + demis.append(edge) + group = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"]) + geompy.UnionList(group, demis) + name = "Cercle%d"%i + geompy.addToStudyInFather(pipeFondFiss, group , name) + groupsDemiCerclesPipe.append(group) + + # --- faces fissure dans le pipe + + facesFissinPipe = [] + generFissId = getSubshapeIds(pipeFondFiss, generFiss) + logging.debug("generatrice fissure %s", generFissId) + for face in facesPipeOnplan: + edges =geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], False) + edgesId = getSubshapeIds(pipeFondFiss, edges) + logging.debug(" edges %s", edgesId) + for i,edgeId in enumerate(edgesId): + if edgeId in generFissId: + logging.debug("face found") + facesFissinPipe.append(face) + name = "faceFissInPipe_%d"%i + geompy.addToStudyInFather(pipeFondFiss, face, name) + break + groupFaceFissInPipe = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["FACE"]) + geompy.UnionList(groupFaceFissInPipe, facesFissinPipe) + name = "FaceFissInPipe" + geompy.addToStudyInFather(pipeFondFiss, groupFaceFissInPipe , name) + + # --- edges de fond de fissure + + edgesFondFiss = [] + for i, edge in enumerate(edgesInside): + anEdge = geompy.GetInPlace(pipeFondFiss, edge) + logging.debug(" edge %s ", anEdge) + edgesFondFiss.append(anEdge) + name ="edgeFondFissure_%d"%i + geompy.addToStudyInFather(pipeFondFiss, anEdge, name) + groupEdgeFondFiss = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"]) + geompy.UnionList(groupEdgeFondFiss, edgesFondFiss) + name = "FONDFISS" + geompy.addToStudyInFather(pipeFondFiss, groupEdgeFondFiss , name) + + # ------------------------------------------------------------------------- + # --- maillage + + # --- edges de bord face defaut à respecter + + aFilterManager = smesh.CreateFilterManager() + nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ]) + criteres = [] + unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0) + criteres.append(unCritere) + filtre = smesh.GetFilterFromCriteria(criteres) + bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre ) + smesh.SetName(bordsLibres, 'bordsLibres') + + # --- pour aider l'algo hexa-tetra a ne pas mettre de pyramides a l'exterieur des volumes replies sur eux-memes + # on designe les faces de peau en quadrangles par le groupe "skinFaces" + + skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' ) + nbAdd = skinFaces.AddFrom( internalBoundary.GetMesh() ) + + # --- maillage pipe fond fissure + + meshFondFiss = smesh.Mesh(pipeFondFiss) + algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.QUADRANGLE) + algo3d = meshFondFiss.Prism() + putName(algo3d.GetSubMesh(), "pipe") + putName(algo3d, "algo3d_pipe") + putName(algo2d, "algo2d_pipe") + + for i, face in enumerate(disques): + algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.RADIAL_QUAD,geom=face) + putName(algo2d.GetSubMesh(), "disque", i) + putName(algo2d, "algo2d_disque", i) + + for i, edge in enumerate(rayons): + algo1d = meshFondFiss.Segment(geom=edge) + hypo1d = algo1d.NumberOfSegments(4) + putName(algo1d.GetSubMesh(), "rayon", i) + putName(algo1d, "algo1d_rayon", i) + putName(hypo1d, "hypo1d_rayon", i) + + for i, edge in enumerate(demiCercles): + algo1d = meshFondFiss.Segment(geom=edge) + hypo1d = algo1d.NumberOfSegments(6) + putName(algo1d.GetSubMesh(), "demiCercle", i) + putName(algo1d, "algo1d_demiCercle", i) + putName(hypo1d, "hypo1d_demiCercle", i) + + generSorted, minlg, maxlg = sortEdges(generatrices) + nbSegGenLong = int(math.sqrt(3.0)*maxlg/(profondeur - rayonPipe)) # on veut 2 triangles equilateraux dans la largeur de la face + nbSegGenBout = 6 + logging.info("min %s, max %s, nombre de segments %s, nombre de generatrices %s", minlg, maxlg, nbSegGenLong, len(generSorted)) + for i, edge in enumerate(generSorted): + algo1d = meshFondFiss.Segment(geom=edge) + if i < 6: + hypo1d = algo1d.NumberOfSegments(nbSegGenBout) + else: + hypo1d = algo1d.NumberOfSegments(nbSegGenLong) + putName(algo1d.GetSubMesh(), "generatrice", i) + putName(algo1d, "algo1d_generatrice", i) + putName(hypo1d, "hypo1d_generatrice", i) + isDone = meshFondFiss.Compute() + logging.info("meshFondFiss computed") + + disks = [] + for i, face in enumerate(disques[:4]): + name = "disk%d"%i + disks.append(meshFondFiss.GroupOnGeom(face, name, SMESH.FACE)) + peauext_pipe = meshFondFiss.GetMesh().UnionListOfGroups( disks, 'PEAUEXT' ) + + grpPFOR = meshFondFiss.GroupOnGeom(VerticesEndPipeFiss[0], "PFOR", SMESH.NODE) + grpPFEX = meshFondFiss.GroupOnGeom(VerticesEndPipeFiss[1], "PFEX", SMESH.NODE) + + grp = meshFondFiss.GroupOnGeom(groupFaceFissInPipe, "fisInPi", SMESH.FACE) + group_edgeFondFiss = meshFondFiss.GroupOnGeom(groupEdgeFondFiss, "FONDFISS", SMESH.EDGE) + noeudsFondFissure = meshFondFiss.GroupOnGeom(groupEdgeFondFiss, "nfondfis", SMESH.NODE) + groups_demiCercles = [] + groupnodes_demiCercles = [] + for i, group in enumerate(groupsDemiCerclesPipe): + name = "Cercle%d"%i + groups_demiCercles.append(meshFondFiss.GroupOnGeom(group, name, SMESH.EDGE)) + name = "nCercle%d"%i + groupnodes_demiCercles.append(meshFondFiss.GroupOnGeom(group, name, SMESH.NODE)) + group_generFiss = meshFondFiss.GroupOnGeom(groupGenerFiss, "GenFiss", SMESH.EDGE) + groupnode_generFiss = meshFondFiss.GroupOnGeom(groupGenerFiss, "GenFiss", SMESH.NODE) + grpNode0 = meshFondFiss.IntersectGroups(groupnode_generFiss, groupnodes_demiCercles[0], "Node0") + grpNode1 = meshFondFiss.IntersectGroups(groupnode_generFiss, groupnodes_demiCercles[1], "Node1") + idNode0 = grpNode0.GetID(1) + idNode1 = grpNode1.GetID(1) + coordsMesh = [] + coordsMesh.append(meshFondFiss.GetNodeXYZ(idNode0)) + coordsMesh.append(meshFondFiss.GetNodeXYZ(idNode1)) + coordsGeom = [] + for vertex in verticesEdgePeauFiss: + coord = geompy.PointCoordinates(vertex); + if distance2(coord, coordsMesh[0]) < 0.1: + meshFondFiss.MoveNode(idNode0, coord[0], coord[1], coord[2]) + if distance2(coord, coordsMesh[1]) < 0.1: + meshFondFiss.MoveNode(idNode1, coord[0], coord[1], coord[2]) + + for groupNodes in groupnodes_demiCercles: + for idNode in groupNodes.GetListOfID(): + coordMesh = meshFondFiss.GetNodeXYZ(idNode) + vertex = geompy.MakeVertex(coordMesh[0], coordMesh[1], coordMesh[2]) + minDist = 100000 + minCoord = None + imin = -1 + for i, edge in enumerate(demiCerclesPeau): + discoord = geompy.MinDistanceComponents(vertex, edge) + if discoord[0] = 0 and minDist > 1.E-6: + logging.debug("node id moved : %s distance=%s", idNode, minDist) + meshFondFiss.MoveNode(idNode, coordMesh[0] + minCoord[0], coordMesh[1] + minCoord[1], coordMesh[2] + minCoord[2]) + + + # --- maillage face de peau + + meshFacePeau = smesh.Mesh(facePeau) + algo2d = meshFacePeau.Triangle(algo=smeshBuilder.NETGEN_2D) + hypo2d = algo2d.Parameters() + hypo2d.SetMaxSize( 1000 ) + hypo2d.SetOptimize( 1 ) + hypo2d.SetFineness( 2 ) + hypo2d.SetMinSize( 2 ) + hypo2d.SetQuadAllowed( 0 ) + putName(algo2d.GetSubMesh(), "facePeau") + putName(algo2d, "algo2d_facePeau") + putName(hypo2d, "hypo2d_facePeau") + # + lenEdgePeauFiss = geompy.BasicProperties(edgePeauFiss)[0] + frac = profondeur/lenEdgePeauFiss + nbSeg = nbSegGenLong +2*nbSegGenBout + ratio = (nbSegGenBout/float(profondeur)) / (nbSegGenLong/lenEdgePeauFiss) + logging.info("lenEdgePeauFiss %s, profondeur %s, nbSegGenLong %s, nbSegGenBout %s, frac %s, ratio %s", lenEdgePeauFiss, profondeur, nbSegGenLong, nbSegGenBout, frac, ratio) + algo1d = meshFacePeau.Segment(geom=edgePeauFiss) + hypo1d = algo1d.NumberOfSegments(nbSeg,[],[ ]) + hypo1d.SetDistrType( 2 ) + hypo1d.SetConversionMode( 1 ) + hypo1d.SetTableFunction( [ 0, ratio, frac, 1, (1.-frac), 1, 1, ratio ] ) + putName(algo1d.GetSubMesh(), "edgePeauFiss") + putName(algo1d, "algo1d_edgePeauFiss") + putName(hypo1d, "hypo1d_edgePeauFiss") + # + algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau) + hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) + putName(algo1d.GetSubMesh(), "bordsLibres") + putName(algo1d, "algo1d_bordsLibres") + putName(hypo1d, "hypo1d_bordsLibres") + # + for i in range(2): + algo1d = meshFacePeau.UseExisting1DElements(geom=groupsDemiCerclesPeau[i]) + hypo1d = algo1d.SourceEdges([ groups_demiCercles[i] ],0,0) + putName(algo1d.GetSubMesh(), "DemiCercles", i) + putName(algo1d, "algo1d_groupDemiCercles", i) + putName(hypo1d, "hypo1d_groupDemiCercles", i) + # + isDone = meshFacePeau.Compute() + logging.info("meshFacePeau computed") + grpTHOR = meshFacePeau.GroupOnGeom(verticesOutCercles[0], "THOR", SMESH.NODE) + grpTHEX = meshFacePeau.GroupOnGeom(verticesOutCercles[1], "THEX", SMESH.NODE) + + groupEdgesPeauFiss = meshFacePeau.GroupOnGeom(edgePeauFiss, "PeauFis", SMESH.EDGE) + + peauext_face = meshFacePeau.CreateEmptyGroup( SMESH.FACE, 'PEAUEXT' ) + nbAdd = peauext_face.AddFrom( meshFacePeau.GetMesh() ) + + + # --- maillage face de fissure + + meshFaceFiss = smesh.Mesh(faceFiss) + algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_2D) + hypo2d = algo2d.Parameters() + hypo2d.SetMaxSize( (profondeur - rayonPipe)/math.sqrt(3.0) ) # pour avoir deux couches de triangles equilateraux partout sur la fissure + hypo2d.SetOptimize( 1 ) + hypo2d.SetFineness( 2 ) + hypo2d.SetMinSize( 2 ) + hypo2d.SetQuadAllowed( 0 ) + putName(algo2d.GetSubMesh(), "faceFiss") + putName(algo2d, "algo2d_faceFiss") + putName(hypo2d, "hypo2d_faceFiss") + # + algo1d = meshFaceFiss.UseExisting1DElements(geom=edgePeauFiss) + hypo1d = algo1d.SourceEdges([ groupEdgesPeauFiss ],0,0) + putName(algo1d.GetSubMesh(), "edgeFissPeau") + putName(algo1d, "algo1d_edgeFissPeau") + putName(hypo1d, "hypo1d_edgeFissPeau") + # + algo1d = meshFaceFiss.UseExisting1DElements(geom=groupEdgesFaceFissPipe) + hypo1d = algo1d.SourceEdges([ group_generFiss ],0,0) + putName(algo1d.GetSubMesh(), "edgeFissPeau") + putName(algo1d, "algo1d_edgeFissPeau") + putName(hypo1d, "hypo1d_edgeFissPeau") + # + isDone = meshFaceFiss.Compute() + logging.info("meshFaceFiss computed") + + grp = meshFaceFiss.GroupOnGeom(faceFiss, "fisOutPi", SMESH.FACE) + + meshBoiteDefaut = smesh.Concatenate([internalBoundary.GetMesh(), + meshFondFiss.GetMesh(), + meshFacePeau.GetMesh(), + meshFaceFiss.GetMesh()], + 1, 1, 1e-05,False) + # pour aider l'algo hexa-tetra a ne pas mettre de pyramides a l'exterieur des volumes replies sur eux-memes + # on designe les faces de peau en quadrangles par le groupe "skinFaces" + group_faceFissOutPipe = None + group_faceFissInPipe = None + groups = meshBoiteDefaut.GetGroups() + for grp in groups: + if grp.GetType() == SMESH.FACE: + #if "internalBoundary" in grp.GetName(): + # grp.SetName("skinFaces") + if grp.GetName() == "fisOutPi": + group_faceFissOutPipe = grp + elif grp.GetName() == "fisInPi": + group_faceFissInPipe = grp + + # le maillage NETGEN ne passe pas toujours ==> utiliser GHS3D + distene=True + if distene: + algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.GHS3D) + else: + algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.NETGEN) + hypo3d = algo3d.MaxElementVolume(1000.0) + putName(algo3d.GetSubMesh(), "boiteDefaut") + putName(algo3d, "algo3d_boiteDefaut") + isDone = meshBoiteDefaut.Compute() + logging.info("meshBoiteDefaut computed") + putName(meshBoiteDefaut, "boiteDefaut") + + groups = maillageSain.GetGroups() + grps1 = [ grp for grp in groups if grp.GetName() == 'P1'] + grps2 = [ grp for grp in groups if grp.GetName() == 'P2'] + coords1 = maillageSain.GetNodeXYZ(grps1[0].GetID(1)) + coords2 = maillageSain.GetNodeXYZ(grps2[0].GetID(1)) + logging.info("coords1 %s, coords2 %s",coords1, coords2) + + faceFissure = meshBoiteDefaut.GetMesh().UnionListOfGroups( [ group_faceFissOutPipe, group_faceFissInPipe ], 'FACE1' ) + maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges) + putName(maillageSain, nomFicSain+"_coupe") + extrusionFaceFissure, normfiss = shapeSurFissure(facePorteFissure) + maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut, extrusionFaceFissure, facePorteFissure, 'COUDE') + + groups = maillageComplet.GetGroups() + grps1 = [ grp for grp in groups if grp.GetName() == 'P1'] + grps2 = [ grp for grp in groups if grp.GetName() == 'P2'] + nodeid1 = maillageComplet.AddNode(coords1[0], coords1[1], coords1[2]) + nodeid2 = maillageComplet.AddNode(coords2[0], coords2[1], coords2[2]) + grps1[0].Add([nodeid1]) + grps2[0].Add([nodeid2]) + ma0d1 = maillageComplet.Add0DElement(nodeid1) + ma0d2 = maillageComplet.Add0DElement(nodeid2) + grpma0d1 = maillageComplet.CreateEmptyGroup( SMESH.ELEM0D, 'P1' ) + nbAdd = grpma0d1.Add( [ma0d1] ) + grpma0d2 = maillageComplet.CreateEmptyGroup( SMESH.ELEM0D, 'P2' ) + nbAdd = grpma0d2.Add( [ma0d2] ) + +# grps = [ grp for grp in groups if grp.GetName() == 'affectedEdges'] +# grps[0].SetName('affEdges') +# grps = [ grp for grp in groups if grp.GetName() == 'affectedFaces'] +# grps[0].SetName('affFaces') +# grps = [ grp for grp in groups if grp.GetName() == 'affectedVolumes'] +# grps[0].SetName('affVols') + + maillageComplet.ConvertToQuadratic( 1 ) + grps = [ grp for grp in groups if grp.GetName() == 'FONDFISS'] + fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FONDFISS' ) + + grps = [ grp for grp in groups if grp.GetName() == 'FACE1'] + nb = maillageComplet.Reorient2D( grps[0], normfiss, grps[0].GetID(1)) + + plansim = geompy.MakePlane(O, normfiss, 10000) + fissnorm = geompy.MakeMirrorByPlane(normfiss, plansim) + grps = [ grp for grp in groups if grp.GetName() == 'FACE2'] + nb = maillageComplet.Reorient2D( grps[0], fissnorm, grps[0].GetID(1)) + #isDone = maillageComplet.ReorientObject( grps[0] ) + fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' ) + + maillageComplet.ExportMED( fichierMaillageFissure, 0, SMESH.MED_V2_2, 1 ) + putName(maillageComplet, nomFicFissure) + logging.info("fichier maillage fissure %s", fichierMaillageFissure) + + if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) + + return maillageComplet \ No newline at end of file diff --git a/src/Tools/blocFissure/gmu/meshBlocPart.py b/src/Tools/blocFissure/gmu/meshBlocPart.py new file mode 100644 index 000000000..c868ed139 --- /dev/null +++ b/src/Tools/blocFissure/gmu/meshBlocPart.py @@ -0,0 +1,218 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy +from geomsmesh import smesh +from salome.smesh import smeshBuilder +import SMESH +from salome.StdMeshers import StdMeshersBuilder +from putName import putName + +# ----------------------------------------------------------------------------- +# --- maillage du bloc partitionne + +def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, + gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, + aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, + nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle, nbsegFis, dmoyen, lensegEllipsoide): + """ + Maillage du bloc partitionné + TODO: a completer + """ + logging.info('start') + + # --- edges de bord à respecter + + aFilterManager = smesh.CreateFilterManager() + nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ]) + criteres = [] + unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0) + criteres.append(unCritere) + filtre = smesh.GetFilterFromCriteria(criteres) + bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre ) + smesh.SetName(bordsLibres, 'bordsLibres') + + # --- maillage bloc + + bloc1 = smesh.Mesh(blocPartition) + + for i in range(len(sharedFaces)): + algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN, geom=sharedFaces[i]) + hypo2d = algo2d.Parameters(which=smesh.SIMPLE) + hypo2d.SetLocalLength(lensegEllipsoide) + hypo2d.LengthFromEdges() + hypo2d.SetAllowQuadrangles(0) + putName(algo2d.GetSubMesh(), "sharedFaces", i) + putName(algo2d, "algo2d_sharedFaces", i) + putName(hypo2d, "hypo2d_sharedFaces", i) + + for i in range(len(sharedEdges)): + algo1d = bloc1.Segment(geom=sharedEdges[i]) + hypo1d = algo1d.LocalLength(lensegEllipsoide) + putName(algo1d.GetSubMesh(), "sharedEdges", i) + putName(algo1d, "algo1d_sharedEdges", i) + putName(hypo1d, "hypo1d_sharedEdges", i) + + declareAlgoEllipsoideFirst = False + if declareAlgoEllipsoideFirst: + algo3d = bloc1.Tetrahedron(algo=smeshBuilder.NETGEN,geom=ellipsoidep) + hypo3d = algo3d.MaxElementVolume(1000.0) + putName(algo3d.GetSubMesh(), "ellipsoide") + putName(algo3d, "algo3d_ellipsoide") + putName(hypo3d, "hypo3d_ellipsoide") + + algo3d = bloc1.Prism(geom=tore) + algo2d = bloc1.Quadrangle(geom=tore) + algo1d = bloc1.Segment(geom=tore) + hypo1d = algo1d.NumberOfSegments(nbsegGen) + putName(algo3d.GetSubMesh(), "tore") + putName(algo3d, "algo3d_tore") + putName(algo2d, "algo2d_tore") + putName(algo1d, "algo1d_tore") + putName(hypo1d, "hypo1d_tore") + + for i in range(len(faces)): + algo2d = bloc1.Quadrangle(geom=faces[i]) + hypo2d = smesh.CreateHypothesis('QuadrangleParams') + hypo2d.SetTriaVertex( geompy.GetSubShapeID(blocPartition,centres[i]) ) + hypo2d.SetQuadType( StdMeshersBuilder.QUAD_STANDARD ) + status = bloc1.AddHypothesis(hypo2d,faces[i]) + putName(algo2d.GetSubMesh(), "faces", i) + putName(algo2d, "algo2d_faces", i) + putName(hypo2d, "hypo2d_faces", i) + + for i in range(len(edges)): + algo1d = bloc1.Segment(geom=edges[i]) + if reverses[i] > 0: + hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ geompy.GetSubShapeID(blocPartition,edges[i]) ]) + else: + hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ ]) + putName(algo1d.GetSubMesh(), "edges", i) + putName(algo1d, "algo1d_edges", i) + putName(hypo1d, "hypo1d_edges", i) + + for i in range(len(circles)): + algo1d = bloc1.Segment(geom=circles[i]) + hypo1d = algo1d.NumberOfSegments(nbsegCercle) + putName(algo1d.GetSubMesh(), "circles", i) + putName(algo1d, "algo1d_circles", i) + putName(hypo1d, "hypo1d_circles", i) + + if len(edgeext) == 1: + densite = int(round(nbsegFis/2)) + algo1d = bloc1.Segment(geom=edgeext[0]) + hypo1d = algo1d.NumberOfSegments(nbsegFis) + hypo1d.SetDistrType( 2 ) + hypo1d.SetConversionMode( 1 ) + hypo1d.SetTableFunction( [ 0, densite, 0.4, 1, 0.6, 1, 1, densite ] ) + putName(algo1d.GetSubMesh(), "edgeext") + putName(algo1d, "algo1d_edgeext") + putName(hypo1d, "hypo1d_edgeext") + else: + longTotal = 0 + longEdgeExts = [] + for i in range(len(edgeext)): + props = geompy.BasicProperties(edgeext[i]) + longEdgeExts.append(props[0]) + longTotal += props[0] + for i in range(len(edgeext)): + local = longTotal/nbsegFis + nbLocal = int(round(nbsegFis*longEdgeExts[i]/longTotal)) + densite = int(round(nbLocal/2)) + algo1d = bloc1.Segment(geom=edgeext[i]) + hypo1d = algo1d.NumberOfSegments(nbLocal) + hypo1d.SetDistrType( 2 ) + hypo1d.SetConversionMode( 1 ) + hypo1d.SetTableFunction( [ 0, densite, 0.8, 1, 1, 1 ] ) + if reverext[i]: + hypo1d.SetReversedEdges([ geompy.GetSubShapeID(blocPartition, edgeext[i]) ]) + putName(algo1d.GetSubMesh(), "edgeext", i) + putName(algo1d, "algo1d_edgeext", i) + putName(hypo1d, "hypo1d_edgeext", i) + + algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facefissoutore) + hypo2d = algo2d.LengthFromEdges() + putName(algo2d.GetSubMesh(), "facefissoutore") + putName(algo2d, "algo2d_facefissoutore") + putName(hypo2d, "hypo2d_facefissoutore") + + + maxElemArea = 0.5*dmoyen*dmoyen + logging.debug("dmoyen %s, maxElemArea %s", dmoyen, maxElemArea) + + for i in range(len(facesExternes)): + algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facesExternes[i]) + hypo2d = algo2d.MaxElementArea(maxElemArea) + if edgesBords is None: + algo1d = bloc1.Segment(geom=facesExternes[i]) + hypo1d = algo1d.NumberOfSegments(1) + putName(algo2d.GetSubMesh(), "facesExternes", i) + putName(algo2d, "algo2d_facesExternes", i) + putName(hypo2d, "hypo2d_facesExternes", i) + if edgesBords is None: + putName(algo1d, "algo1d_facesExternes", i) + putName(hypo1d, "hypo1d_facesExternes", i) + + for i in range(len(aretesInternes)): + algo1d = bloc1.Segment(geom=aretesInternes[i]) + hypo1d = algo1d.NumberOfSegments(nbsegExt) + putName(algo1d.GetSubMesh(), "aretesInternes", i) + putName(algo1d, "algo1d_aretesInternes", i) + putName(hypo1d, "hypo1d_aretesInternes", i) + + if edgesBords is not None: + algo1d = bloc1.UseExisting1DElements(geom=edgesBords) + hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) + putName(algo1d.GetSubMesh(), "bordsLibres") + putName(algo1d, "algo1d_bordsLibres") + putName(hypo1d, "hypo1d_bordsLibres") + + #isDone = bloc1.Compute() + + if not declareAlgoEllipsoideFirst: + algo3d = bloc1.Tetrahedron(algo=smeshBuilder.NETGEN,geom=ellipsoidep) + hypo3d = algo3d.MaxElementVolume(1000.0) + putName(algo3d.GetSubMesh(), "ellipsoide") + putName(algo3d, "algo3d_ellipsoide") + putName(hypo3d, "hypo3d_ellipsoide") + + isDone = bloc1.Compute() + + nbRemoved = bloc1.RemoveOrphanNodes() + + faceFissure1 = bloc1.GroupOnGeom(faceFissure,'FACE1',SMESH.FACE) + noeudsFondFissure = bloc1.GroupOnGeom(gencnt,'nfondfis',SMESH.NODE) + + groups_faceCommuneEllipsoideBloc = [] + for i in range(len(sharedFaces)): + name = "faceCommuneEllipsoideBloc_%d"%i + groups_faceCommuneEllipsoideBloc.append(bloc1.GroupOnGeom(sharedFaces[i], name, SMESH.FACE)) + groups_faceExterneBloc = [] + for i in range(len(facesExtBloc)): + name = "faceExterneBloc_%d"%i + groups_faceExterneBloc.append(bloc1.GroupOnGeom(facesExtBloc[i], name, SMESH.FACE)) + + skinBlocMeshes = [] + for i in range(len(groups_faceCommuneEllipsoideBloc)): + name = "faceCommuneEllipsoideBloc_%d"%i + skinBlocMeshes.append(smesh.CopyMesh(groups_faceCommuneEllipsoideBloc[i], name, 0, 0)) + for i in range(len(groups_faceExterneBloc)): + name = "faceExterneBloc_%d"%i + skinBlocMeshes.append(smesh.CopyMesh(groups_faceExterneBloc[i], name, 0, 0)) + + meshesBloc = [internalBoundary.GetMesh()] + for i in range(len(skinBlocMeshes)): + meshesBloc.append(skinBlocMeshes[i].GetMesh()) + blocMesh = smesh.Concatenate(meshesBloc, 1, 1, 1e-05,False) + + algo3d = blocMesh.Tetrahedron(algo=smeshBuilder.NETGEN) + hypo3d = algo3d.MaxElementVolume(1000.0) + putName(algo3d.GetSubMesh(), "bloc") + putName(algo3d, "algo3d_bloc") + putName(hypo3d, "hypo3d_bloc") + + is_done = blocMesh.Compute() + + blocComplet = smesh.Concatenate([bloc1.GetMesh(), blocMesh.GetMesh()], 1, 1, 1e-05,False) + + return bloc1, blocComplet \ No newline at end of file diff --git a/src/Tools/blocFissure/gmu/orderEdgesFromWire.py b/src/Tools/blocFissure/gmu/orderEdgesFromWire.py new file mode 100644 index 000000000..0a092e26c --- /dev/null +++ b/src/Tools/blocFissure/gmu/orderEdgesFromWire.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- trouver les vertices intermediaires d'un wire + +def orderEdgesFromWire(aWire): + """ + fournit les edges ordonnées d'un wire selon ExtractShapes(,,False), + et l'ordre des edges selon le sens de parcours (ordre des indices de la liste d'edges) + """ + logging.info("start") + edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False) + + idverts = {} + for i, edge in enumerate(edges): + verts = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], True) +# idverts[(i,0)] = verts[0] +# idverts[(i,1)] = verts[1] + v0 = geompy.MakeVertexOnCurve(edge, 0.0) + dist = geompy.MinDistance(v0, verts[0]) + if dist < 1.e-4: + idverts[(i,0)] = verts[0] + idverts[(i,1)] = verts[1] + else: + idverts[(i,0)] = verts[1] + idverts[(i,1)] = verts[0] + + idsubs = {} + for kv, sub in idverts.iteritems(): + subid = geompy.GetSubShapeID(aWire, sub) + if subid in idsubs.keys(): + idsubs[subid].append(kv) + else: + idsubs[subid] = [kv] + + debut = -1 + fin = -1 + for k, kvs in idsubs.iteritems(): + if len(kvs) == 1: # une extremité + kv = kvs[0] + if kv[1] == 0: + debut = kv[0] + else: + fin = kv[0] + logging.debug("nombre d'edges: %s, indice edge début: %s, fin: %s",len(edges), debut, fin) + if debut < 0: + logging.critical("les edges du wire ne sont pas orientées dans le même sens: pas de début trouvé") + return edges, range(len(edges)) + + orderedList = [debut] + while len(orderedList) < len(edges): + bout = orderedList[-1] + vertex = idverts[(bout,1)] + for k, v in idverts.iteritems(): + if k[0] not in orderedList: + if geompy.MinDistance(vertex, v) < 1.e-4: + if k[1] == 0: + orderedList.append(k[0]) + break + else: + logging.critical("les edges du wire ne sont pas orientées dans le même sens: une edge à l'envers") + return edges, range(len(edges)) + + logging.debug("liste des edges ordonnées selon le sens de parcours: %s", orderedList) + accessList = range(len(orderedList)) + for i,k in enumerate(orderedList): + accessList[k] = i + logging.info("position ordonnée des edges selon le sens de parcours: %s", accessList) + return edges, accessList diff --git a/src/Tools/blocFissure/gmu/partitionBlocDefaut.py b/src/Tools/blocFissure/gmu/partitionBlocDefaut.py new file mode 100644 index 000000000..4016c9a5b --- /dev/null +++ b/src/Tools/blocFissure/gmu/partitionBlocDefaut.py @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- partition du bloc defaut par generatrice, tore et plan fissure + +def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe, + facefis, ellipsoide): + """ + Partition du bloc defaut par la generatrice de l'ellipse, + le tore elliptique, la face plane de fissure + @param volDefaut : le bloc defaut + @param gener : la generatrice de l'ellipse, positionnée dans l'espace + @param pipe : le tore partitionné par le plan de fissure, positionné + dans l'espace + @param facefis : la face plane de la fissure, positionnée dans l'espace + @return (volDefautPart, blocp, tore, faceFissure), le bloc partitionné, + les sous shapes issues de la partition + (le bloc moins le tore, la generatrice, le tore, la face de fissure) + """ + logging.info("start") + + volDefautPart = geompy.MakePartition([volDefaut], [pipe, facefis, ellipsoide], [], [], geompy.ShapeType["SOLID"], 0, [], 1) + blocp = geompy.GetInPlaceByHistory(volDefautPart, volDefaut) + #gencnt = geompy.GetInPlaceByHistory(volDefautPart, gener) + tore = geompy.GetInPlaceByHistory(volDefautPart, pipe) + faceFissure = geompy.GetInPlaceByHistory(volDefautPart, facefis) + #ellipsoidep =geompy.GetInPlaceByHistory(volDefautPart, ellipsoide) + + geompy.addToStudy( volDefautPart, 'volDefautPart' ) + geompy.addToStudyInFather( volDefautPart, tore, 'tore' ) + geompy.addToStudyInFather( volDefautPart, faceFissure, 'FACE1' ) + #geompy.addToStudyInFather( volDefautPart, gencnt, 'generatrice' ) + + solids = geompy.ExtractShapes(blocp, geompy.ShapeType["SOLID"], True) + vols = [] + for i in range(len(solids)): + props = geompy.BasicProperties(solids[i]) + vols.append(props[2]) + maxvol = max(vols) + imaxvol = vols.index(maxvol) + blocp = solids[imaxvol] + vols[imaxvol] = 0 + maxvol = max(vols) + imaxvol = vols.index(maxvol) + ellipsoidep = solids[imaxvol] + + geompy.addToStudyInFather( volDefautPart, blocp, 'bloc' ) + geompy.addToStudyInFather( volDefautPart, ellipsoidep, 'ellipsoide' ) + + sharedFaces = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["FACE"]) + for i in range(len(sharedFaces)): + name = "faceCommuneEllipsoideBloc_%d"%i + geompy.addToStudyInFather(blocp, sharedFaces[i], name) + + #sharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"]) + allSharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"]) + sharedEdges = [] + for i in range(len(allSharedEdges)): + if geompy.NbShapes(allSharedEdges[i], geompy.ShapeType["VERTEX"]) > 1: # edge non degeneree + sharedEdges.append(allSharedEdges[i]) + for i in range(len(sharedEdges)): + name = "edgeCommuneEllipsoideBloc_%d"%i + geompy.addToStudyInFather(blocp, sharedEdges[i], name) + + facesExternes = [] + facesExtBloc = [] + facesExtElli = [] + faces = geompy.ExtractShapes(facesDefaut, geompy.ShapeType["FACE"], True) + if len(faces) == 0: + faces = [facesDefaut] + for i in range(len(faces)): + faceExt = geompy.GetInPlace(ellipsoidep, faces[i]) + if faceExt is not None: + name = "faceExterne_e%d"%i + geompy.addToStudyInFather(ellipsoidep, faceExt, name) + facesExternes.append(faceExt) + facesExtElli.append(faceExt) + + faceExt = geompy.GetInPlace(blocp, faces[i]) + if faceExt is not None: + name = "faceExterne_b%d"%i + geompy.addToStudyInFather(blocp, faceExt, name) + facesExternes.append(faceExt) + facesExtBloc.append(faceExt) + else: + logging.info(" recherche faces externes par GetShapesOnShape") + vertex = geompy.MakeVertexOnSurface(faces[i], 0.5, 0.5) + normal = geompy.GetNormal(faces[i], vertex) + extrusionFace = geompy.MakePrismVecH(faces[i], normal, 1) + #extrusionFace = geompy.MakePrismVecH2Ways(faces[i], normal, 0.1) + #extrusionFace = geompy.MakeScaleTransform(extrusionFace, vertex, 1.01) + name = "extrusionFace_b%d"%i + geompy.addToStudyInFather(blocp, extrusionFace, name) + #facesExt = geompy.GetShapesOnShape(extrusionFace, blocp, geompy.ShapeType["FACE"], GEOM.ST_ONIN) + facesExt = geompy.GetShapesOnShape(extrusionFace, blocp, geompy.ShapeType["FACE"], GEOM.ST_ON) + for j in range(len(facesExt)): + name = "faceExterne_b%d_%d"%(i,j) + geompy.addToStudyInFather(blocp, facesExt[j], name) + facesExternes.append(facesExt[j]) + facesExtBloc.append(facesExt[j]) + + if len(facesExtBloc) < len(faces): # toutes les faces externes du bloc n'ont pas été trouvées. TODO eliminer les detections multiples + logging.info(" recherche faces externes par aretes partagees avec faces externes ellipsoide") + facesBloc = geompy.ExtractShapes(blocp, geompy.ShapeType["FACE"], True) + for i in range(len(facesBloc)): + notOnEllipsoide = True + for j in range(len(sharedFaces)): # eliminer les faces communes avec l'ellipsoide + if facesBloc[i].IsSame(sharedFaces[j]): + notOnEllipsoide = False + break + if notOnEllipsoide: + for j in range(len(facesExtElli)): # les faces recherchees ont une ou plusieurs edge communes avec la ou les faces externes de l'ellipsoide + allSharedEdges = [] + try: + allSharedEdges += geompy.GetSharedShapesMulti([facesBloc[i], facesExtElli[j]], geompy.ShapeType["EDGE"]) + except: + pass + if len(allSharedEdges) > 0: + name = "faceExterne_b%d_%d"%(i,j) + geompy.addToStudyInFather(blocp, facesBloc[i], name) + facesExternes.append(facesBloc[i]) + facesExtBloc.append(facesBloc[i]) + + aretesInternes = [] + for i in range(len(facesExternes)): + for j in range(i+1,len(facesExternes)): + shared = [] + try: + shared += geompy.GetSharedShapesMulti([facesExternes[i], facesExternes[j]], geompy.ShapeType["EDGE"]) + except: + logging.info("no shared edges in %s,%s",i,j) + else: + aretesInternes += shared + for i in range(len(aretesInternes)): + name = "aretesInternes_%d"%i + geompy.addToStudyInFather(blocp, aretesInternes[i], name) + + edgesBords = [] + for faceExtB in facesExtBloc: + edges = geompy.ExtractShapes(faceExtB, geompy.ShapeType["EDGE"], True) + for i in range(len(edges)): + isInterne = False + for j in range(len(aretesInternes)): + if edges[i].IsSame(aretesInternes[j]): + isInterne = True + break + if not isInterne: + edgesBords.append(edges[i]) + name = "edgeBord%d"%i + geompy.addToStudyInFather(blocp,edges[i] , name) + group = None + if len(edgesBords) > 0: + group = geompy.CreateGroup(blocp, geompy.ShapeType["EDGE"]) + geompy.UnionList(group, edgesBords) + edgesBords = group + + return volDefautPart, blocp, tore, faceFissure, facesExternes, facesExtBloc, facesExtElli, aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords diff --git a/src/Tools/blocFissure/gmu/partitionVolumeSain.py b/src/Tools/blocFissure/gmu/partitionVolumeSain.py new file mode 100644 index 000000000..a23fa591a --- /dev/null +++ b/src/Tools/blocFissure/gmu/partitionVolumeSain.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- partition volume sain et bloc, face du bloc recevant la fissure + +def partitionVolumeSain(volumeSain,boiteDefaut): + """ + Partition du volume complet sur lequel porte le calcul par le cube qui contiendra le defaut + @param volumeSain : volume complet (geomObject) + @param boiteDefaut : cube qui contiendra le defaut, positionné dans l'espace (son centre doit être au voisinage + immediat de la peau de l'objet sain: le tore elliptique debouche de paroi) + @return (volumeSainPart, partieSaine, volDefaut, faceBloc) : volume complet partionné par le cube, partie saine, + bloc du defaut (solide commun au cube et au volume complet), face du bloc defaut correspondant à la paroi. + """ + logging.info("start") + + volumeSainPart = geompy.MakePartition([volumeSain], [boiteDefaut], [], [], geompy.ShapeType["SOLID"], 0, [], 0) + [a,b] = geompy.ExtractShapes(volumeSainPart, geompy.ShapeType["SOLID"], True) + volDefaut = geompy.GetInPlaceByHistory(volumeSainPart, boiteDefaut) + if geompy.GetSubShapeID(volumeSainPart,b) == geompy.GetSubShapeID(volumeSainPart,volDefaut): + partieSaine = a + else: + partieSaine = b + faceBloc = geompy.GetShapesOnShapeAsCompound(volumeSain, volDefaut, geompy.ShapeType["FACE"], GEOM.ST_ON) + + geompy.addToStudy( volumeSainPart, 'volumeSainPart' ) + geompy.addToStudyInFather( volumeSainPart, partieSaine, 'partieSaine' ) + geompy.addToStudyInFather( volumeSainPart, volDefaut, 'volDefaut' ) + geompy.addToStudyInFather( volDefaut, faceBloc, 'faceBloc' ) + return volumeSainPart, partieSaine, volDefaut, faceBloc diff --git a/src/Tools/blocFissure/gmu/peauInterne.py b/src/Tools/blocFissure/gmu/peauInterne.py new file mode 100644 index 000000000..6790061b9 --- /dev/null +++ b/src/Tools/blocFissure/gmu/peauInterne.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import smesh +import SMESH + +# ----------------------------------------------------------------------------- +# --- peau interne du defaut dans le maillage sain + +def peauInterne(fichierMaillage, nomZones): + """ + Retrouve les groupes de défaut dans le maillage sain modifié par CreateHoleSkin (CreeZoneDefautMaillage) + On récupère le volume et la peau de la zone de défaut, les éventuelles faces et arêtes internes de cette zone. + """ + logging.info("start") + ([maillageSain], status) = smesh.CreateMeshesFromMED(fichierMaillage) + + groups = maillageSain.GetGroups() + zoneDefaut = None + for grp in groups: + #print " ",grp.GetName() + if grp.GetName() == nomZones + "_vol": + zoneDefaut = grp + break + zoneDefaut_skin = None + for grp in groups: + if grp.GetName() == nomZones + "_skin": + zoneDefaut_skin = grp + break + zoneDefaut_internalFaces = None + for grp in groups: + if grp.GetName() == nomZones + "_internalFaces": + zoneDefaut_internalFaces = grp + break + zoneDefaut_internalEdges = None + for grp in groups: + if grp.GetName() == nomZones + "_internalEdges": + zoneDefaut_internalEdges = grp + break + + nbAdded, maillageSain, DefautBoundary = maillageSain.MakeBoundaryElements( SMESH.BND_2DFROM3D, 'DefBound', '', 0, [ zoneDefaut ]) + internal = maillageSain.GetMesh().CutListOfGroups( [ DefautBoundary ], [ zoneDefaut_skin ], 'internal' ) + internalBoundary = smesh.CopyMesh( internal, 'internalBoundary', 0, 0) + + return maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges + diff --git a/src/Tools/blocFissure/gmu/produitMixte.py b/src/Tools/blocFissure/gmu/produitMixte.py new file mode 100644 index 000000000..509a75889 --- /dev/null +++ b/src/Tools/blocFissure/gmu/produitMixte.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- calcul de produit mixte pour orientation + +def produitMixte(o, p1, p2, p3): + """ + produit mixte de 3 vecteurs a partir d'une origine et 3 points + """ + coordo = geompy.PointCoordinates(o) + coordp1 = geompy.PointCoordinates(p1) + coordp2 = geompy.PointCoordinates(p2) + coordp3 = geompy.PointCoordinates(p3) + u = [coordp1[0] - coordo[0], coordp1[1] - coordo[1], coordp1[2] - coordo[2]] + v = [coordp2[0] - coordo[0], coordp2[1] - coordo[1], coordp2[2] - coordo[2]] + w = [coordp3[0] - coordo[0], coordp3[1] - coordo[1], coordp3[2] - coordo[2]] + pm = (u[0]*v[1]*w[2] + v[0]*w[1]*u[2] + w[0]*u[1]*v[2]) - (u[0]*w[1]*v[2] + v[0]*u[1]*w[2] + w[0]*v[1]*u[2]) + logging.debug('pm=%s', pm) + return pm + diff --git a/src/Tools/blocFissure/gmu/projettePointSurCourbe.py b/src/Tools/blocFissure/gmu/projettePointSurCourbe.py new file mode 100644 index 000000000..fa43d3926 --- /dev/null +++ b/src/Tools/blocFissure/gmu/projettePointSurCourbe.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- + +from geomsmesh import geompy +import logging +import math + +# ----------------------------------------------------------------------------- +# --- projection d'un point sur une courbe. + +def projettePointSurCourbe(pt, edge): + """ + projection d'un point p sur une courbe c + on suppose que la distance (c(u), p) passe par un minimum quand u varie entre 0 et 1 + et qu'elle presente pas de minimum local + """ + #logging.debug("start") + + dist = [] + nbSlices = 50 + du = 1.0/nbSlices + for i in range(nbSlices + 1): + p = geompy.MakeVertexOnCurve(edge, du*i) + d = geompy.MinDistance(p,pt) + dist.append((d,i)) + dist.sort() + #logging.debug("dist %s", dist) + umin = du*dist[0][1] + umax = du*dist[1][1] + #umin = 0.0 + #umax = 1.0 + tol = 1.e-8 + pmin = geompy.MakeVertexOnCurve(edge, umin) + pmax = geompy.MakeVertexOnCurve(edge, umax) + dmin = geompy.MinDistance(pmin,pt) + dmax = geompy.MinDistance(pmax,pt) + dext = geompy.MinDistance(pmin,pmax) + i=0 + while dext > tol and i < 100 : + i = i+1 + utest = (umax + umin) / 2.0 + ptest = geompy.MakeVertexOnCurve(edge, utest) + dtest = geompy.MinDistance(ptest,pt) + if dmin < dmax: + umax = utest + pmax = ptest + dmax = dtest + else: + umin = utest + pmin = ptest + dmin = dtest + dext = geompy.MinDistance(pmin,pmax) + #logging.debug('umin=%s umax=%s dmin=%s dmax=%s dtest=%s dext=%s', umin,umax,dmin,dmax,dtest,dext) + if abs(utest) < 1.e-7: + utest = 0.0 + if abs(1.0-utest) < 1.e-7: + utest = 1.0 + logging.debug('u=%s, nbiter=%s dtest=%s dext=%s',utest,i,dtest,dext) + return utest + \ No newline at end of file diff --git a/src/Tools/blocFissure/gmu/prolongeVertices.py b/src/Tools/blocFissure/gmu/prolongeVertices.py new file mode 100644 index 000000000..e6e6f038a --- /dev/null +++ b/src/Tools/blocFissure/gmu/prolongeVertices.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- prolongation des segments extremité des polylines, pour la découpe + +def prolongeVertices(vertices): + """ + Prolongation des segments extremité d'une polyline définie par un vecteur de points. + Chaque nouvelle extremité est obtenue par symétrie point du voisin de cette ancienne extrémité + (symétrie de centre l'ancienne extrémite) : les segments extremes sont doublés. + @param vertices : liste ordonnée des points (geomObject) de la polyline + @return vertices : liste avec les deux extremités modifiées + """ + logging.info("start") + if len(vertices) < 2: + return vertices + v0 = vertices[0] + v1 = vertices[1] + m0 = geompy.MakeMirrorByPoint(v1, v0) + ve = vertices[-1] + vd = vertices[-2] + m1 = geompy.MakeMirrorByPoint(vd, ve) + vertices[0] = m0 + vertices[-1] = m1 + return vertices diff --git a/src/Tools/blocFissure/gmu/prolongeWire.py b/src/Tools/blocFissure/gmu/prolongeWire.py new file mode 100644 index 000000000..72e766dff --- /dev/null +++ b/src/Tools/blocFissure/gmu/prolongeWire.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- prolongation d'un wire par deux segments tangents + +def prolongeWire(aWire, extrem, norms, long): + """ + """ + logging.info("start") + if geompy.NumberOfEdges(aWire) > 1: + edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"]) + else: + edges = [aWire] + for i, v1 in enumerate(extrem): + exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-long, long)] + dists = [(geompy.MinDistance(v, aWire), i , v) for i, v in enumerate(exts)] + dists.sort() + v2 = dists[-1][-1] + #v2 = geompy.MakeTranslationVectorDistance(v1, norms[i], long) + edge = geompy.MakeEdge(v1, v2) + edges.append(edge) + name = "extrem%d"%i + #geompy.addToStudy(edge,name) + wireProlonge = geompy.MakeWire(edges) + geompy.addToStudy(wireProlonge, "wireProlonge") + return wireProlonge diff --git a/src/Tools/blocFissure/gmu/propagateTore.py b/src/Tools/blocFissure/gmu/propagateTore.py new file mode 100644 index 000000000..70678a420 --- /dev/null +++ b/src/Tools/blocFissure/gmu/propagateTore.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- recherche et classement des edges du tore par propagate + +def propagateTore(tore): + """ + Classement des edges du tore par une operation 'propagate' + @param tore partionné et coupé + @return (diams, circles, geners) edges dans le plan de fissure, edges demi circulaires, + edges selon la generatrice (liste de compounds) + """ + logging.info("start") + + lencomp = [] + compounds = geompy.Propagate(tore) + for i in range(len(compounds)): + #geompy.addToStudyInFather( tore, compounds[i], 'edges' ) + props = geompy.BasicProperties(compounds[i]) + lencomp.append(props[0]) + pass + minlen = min(lencomp) + maxlen = max(lencomp) + diams = [] + geners = [] + circles = [] + for i in range(len(lencomp)): + if (lencomp[i]- minlen)/minlen < 0.01 : + diams.append(compounds[i]) + elif (maxlen - lencomp[i])/lencomp[i] < 0.2 : + geners.append(compounds[i]) + else: + circles.append(compounds[i]) + + geompy.addToStudyInFather( tore, diams[0], 'diams0' ) + geompy.addToStudyInFather( tore, diams[1], 'diams1' ) + geompy.addToStudyInFather( tore, circles[0], 'circles0' ) + geompy.addToStudyInFather( tore, circles[1], 'circles1' ) + geompy.addToStudyInFather( tore, geners[0], 'geners' ) + + return diams, circles, geners diff --git a/src/Tools/blocFissure/gmu/putName.py b/src/Tools/blocFissure/gmu/putName.py new file mode 100644 index 000000000..b8d4cbfa3 --- /dev/null +++ b/src/Tools/blocFissure/gmu/putName.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from geomsmesh import smesh + +# ----------------------------------------------------------------------------- +# --- nommage des objets mesh (algorithme, hypothèse, subMesh) + +def putName(objmesh,name, i=-1): + if i >= 0: + suffix = "_%d"%i + name += suffix + smesh.SetName(objmesh, name) + diff --git a/src/Tools/blocFissure/gmu/quadranglesToShape.py b/src/Tools/blocFissure/gmu/quadranglesToShape.py new file mode 100644 index 000000000..faa9478f7 --- /dev/null +++ b/src/Tools/blocFissure/gmu/quadranglesToShape.py @@ -0,0 +1,323 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy +import GEOM +import math +import numpy as np + +def mydot(a): + return np.dot(a,a) + +# ----------------------------------------------------------------------------- +# --- groupe de quadrangles de face transformé en face géométrique par filling + +def quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss): + """ + groupe de quadrangles de face transformée en faces géométriques par filling + on part de quadrangles définissant une zone a 4 cotés (convexe), et on reconstitue n lignes de p points. + Ces n lignes de p points sont transformées en n courbes géométriques, + à partir desquelles on reconstitue une surface géométrique. + Il peut y avoir plusieurs faces géométriques reconstituées, si on fournit des groupes de quadrangles non connexes. + On détecte les angles vifs, pour conserver des arêtes vives délimitant des faces connexes. + @param meshQuad : maillages constitué de quadrangles constituant une ou plusieurs zones convexes + @return (fillings, noeuds_Bords) : liste de geomObject, listes des bords (bord = liste ordonnée de noeuds (geomObject)) + """ + logging.info("start") + + isVecteurDefaut = False + if shapeFissureParams.has_key('vecteurDefaut'): + isVecteurDefaut = True + vecteurDefaut = shapeFissureParams['vecteurDefaut'] + + fillings = [] # les faces reconstituées, découpées selon les arêtes vives + noeuds_bords = [] # + bords_Partages = [] # contient a la fin les courbes correspondant aux arêtes vives + fillconts = [] # les faces reconstituées, sans découpage selon les arêtes vives + idFilToCont = [] # index face découpée vers face sans découpe + iface = 0 # index face découpée + icont = 0 # index face continue + + allNodeIds = meshQuad.GetNodesId() + while len(allNodeIds): + nodeIds = allNodeIds + for idNode in nodeIds: # rechercher un coin + elems = meshQuad.GetNodeInverseElements(idNode) + if len(elems) == 1: + # un coin: un noeud, un element quadrangle + elem = elems[0] + break; + idStart = idNode # le noeud de coin + elemStart = elem # l'élément quadrangle au coin + xyz = meshQuad.GetNodeXYZ(idStart) + logging.debug("idStart %s, coords %s", idStart, str(xyz)) + + nodelines =[] # on va constituer une liste de lignes de points + nextLine = True + ligneFinale = False + while nextLine: + logging.debug("--- une ligne") + idNode = idStart + elem = elemStart + if ligneFinale: + agauche = False # sens de parcours des 4 noeuds d'un quadrangle + nextLine = False + else: + agauche = True + ligneIncomplete = True # on commence une ligne de points + debutLigne = True + nodeline = [] + elemline = [] + while ligneIncomplete: # compléter la ligne de points + nodeline.append(idNode) + allNodeIds.remove(idNode) + elemline.append(elem) + nodes = meshQuad.GetElemNodes(elem) + i = nodes.index(idNode) # repérer l'index du noeud courant (i) dans l'élément quadrangle (0 a 3) + if agauche: # déterminer le noeud suivant (j) et celui opposé (k) dans le quadrangle + if i < 3: + j = i+1 + else: + j = 0 + if j < 3: + k = j+1 + else: + k = 0 + else: + if i > 0: + j = i -1 + else: + j = 3 + if j > 0: + k = j -1 + else: + k = 3 + isuiv = nodes[j] #noeud suivant + iapres = nodes[k] #noeud opposé + if debutLigne: + debutLigne = False + # précédent a trouver, dernière ligne : précédent au lieu de suivant + if agauche: + if i > 0: + iprec = nodes[i -1] + else: + iprec = nodes[3] + idStart = iprec + elems3 = meshQuad.GetNodeInverseElements(iprec) + if len(elems3) == 1: # autre coin + ligneFinale = True + else: + for elem3 in elems3: + if elem3 != elem: + elemStart = elem3 + break + #print nodes, idNode, isuiv, iapres + elems1 = meshQuad.GetNodeInverseElements(isuiv) + elems2 = meshQuad.GetNodeInverseElements(iapres) + ligneIncomplete = False + for elem2 in elems2: + if elems1.count(elem2) and elem2 != elem: + ligneIncomplete = True + idNode = isuiv + elem = elem2 + break + if not ligneIncomplete: + nodeline.append(isuiv) + allNodeIds.remove(isuiv) + logging.debug("nodeline %s", nodeline) + logging.debug("elemline %s", elemline) + nodelines.append(nodeline) + + # on a constitué une liste de lignes de points connexes + logging.debug("dimensions [%s, %s]", len(nodelines), len(nodeline)) + + # stockage des coordonnées dans un tableau numpy + mat = np.zeros((len(nodelines), len(nodeline), 3)) + for i, ligne in enumerate(nodelines): + for j, nodeId in enumerate(ligne): + mat[i,j] = meshQuad.GetNodeXYZ(nodeId) + logging.debug("matrice de coordonnées: \n%s",mat) + logging.debug("dimensions %s", mat.shape) + + # recherche d'angles supérieurs a un seuil sur une ligne : angle entre deux vecteurs successifs + cosmin = math.cos(math.pi/4.) # TODO: angle reference en paramètre + vecx = mat[:, 1:, :] - mat[:, :-1, :] # vecteurs selon direction "x" + vx0 = vecx[:, :-1, :] # vecteurs amont + vx1 = vecx[:, 1:, :] # vecteurs aval + e = np.einsum('ijk,ijk->ij', vx0, vx1) # produit scalaire des vecteurs + f = np.apply_along_axis(mydot, 2, vx0) # normes carrées vecteurs amont + g = np.apply_along_axis(mydot, 2, vx1) # normes carrées vecteurs aval + h = e/(np.sqrt(f*g)) # cosinus + ruptureX = h < cosmin # True si angle > reference + logging.debug("matrice de rupture X: \n%s",ruptureX) + rupX = filter(lambda x: np.prod(ruptureX[:,x]), range(len(nodeline)-2)) + logging.debug("colonnes de rupture: %s",rupX) + # recherche d'angles supérieurs a un seuil sur une colonne : angle entre deux vecteurs successifs + vecy = mat[ 1:, :, :] - mat[:-1, :, :] # vecteurs selon direction "y" + vy0 = vecy[:-1, :, :] # vecteurs amont + vy1 = vecy[ 1:, :, :] # vecteurs aval + e = np.einsum('ijk,ijk->ij', vy0, vy1) # produit scalaire des vecteurs + f = np.apply_along_axis(mydot, 2, vy0) # normes carrées vecteurs amont + g = np.apply_along_axis(mydot, 2, vy1) # normes carrées vecteurs aval + h = e/(np.sqrt(f*g)) # cosinus + ruptureY = h < cosmin # True si angle > reference + logging.debug("matrice de rupture Y: \n%s",ruptureY) + rupY = filter(lambda x: np.prod(ruptureY[x, :]), range(len(nodelines)-2)) + logging.debug("lignes de rupture: %s",rupY) + if (len(rupX)*len(rupY)) > 0: + logging.critical("""Cas non traité: présence d'angles vifs dans 2 directions, + lors de la reconstitution des faces géométriques dans la zone remaillée""") + + mats = [] + bordsPartages = [] + if (len(rupX)> 0): + rupX.append(mat.shape[1]-1) + for i, index in enumerate(rupX): + imax = index+2 + imin = 0 + if i > 0: + imin = rupX[i-1] + 1 + mats.append(mat[:, imin:imax, :]) + if imax == mat.shape[1] + 1: + ifin = 0 + else: + ifin = imax + bordsPartages.append([imin,ifin]) # les indices différents de 0 correspondent à des bords partagés + elif (len(rupY)> 0): + rupY.append(mat.shape[0]-1) + for i, index in enumerate(rupY): + imax = index+2 + imin = 0 + if i > 0: + imin = rupY[i-1] + 1 + mats.append(mat[imin:imax, :, :]) + if imax == mat.shape[0] + 1: + ifin = 0 + else: + ifin = imax + bordsPartages.append([imin,ifin]) # les indices différents de 0 correspondent à des bords partagés + else: + mats.append(mat) + bordsPartages.append([0,0]) # les indices différents de 0 correspondent à des bords partagés + + curvconts = [] + for nmat, amat in enumerate(mats): + logging.debug("dimensions matrice %s: %s", nmat, amat.shape) + nbLignes = amat.shape[1] # pas de rupture, ou rupture selon des colonnes: on transpose + nbCols = amat.shape[0] + if len(rupY) > 0 : # rupture selon des lignes: pas de transposition + nbLignes = amat.shape[0] + nbCols = amat.shape[1] + curves = [] + noeudsBords = [] + for i in range(4): + noeudsBords.append([]) + k = 0 + for i in range(nbLignes): + nodeList = [] + for j in range(nbCols): + #logging.debug("point[%s,%s] = (%s, %s, %s)",i,j,amat[i,j,0], amat[i,j,1], amat[i,j,2]) + if len(rupY) > 0 : # pas de transposition + node = geompy.MakeVertex(amat[i,j,0], amat[i,j,1], amat[i,j,2]) + else: # transposition + node = geompy.MakeVertex(amat[j,i,0], amat[j,i,1], amat[j,i,2]) + nodeList.append(node) + if i == 0: + noeudsBords[0].append(node) + #name = "bord0_%d"%k + #geompy.addToStudy( node, name ) + if i == (nbLignes -1): + noeudsBords[2].append(node) + #name = "bord2_%d"%k + #geompy.addToStudy( node, name ) + if j == 0: + noeudsBords[1].append(node) + #name = "bord1_%d"%k + #geompy.addToStudy( node, name ) + if j == (nbCols -1): + noeudsBords[3].append(node) + #name = "bord3_%d"%k + #geompy.addToStudy( node, name ) + k += 1 + curve = geompy.MakeInterpol(nodeList, False, False) + #name = "curve_%d"%i + #geompy.addToStudy( curve, name ) + if len(curvconts) == 0 or len(curves) > 0: # éliminer les doublons de la surface sans découpe + curvconts.append(nodeList) + curves.append(curve) + if bordsPartages[nmat][0] : + bordsPartages[nmat][0] = curves[0] # la première ligne est un bord partagé + else: + bordsPartages[nmat][0] = None + if bordsPartages[nmat][1] : + bordsPartages[nmat][1] = curves[-1] # la dernière ligne est un bord partagé + else: + bordsPartages[nmat][1] = None + filling = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True) + # --- test orientation filling + vertex = geompy.MakeVertexOnSurface(filling, 0.5, 0.5) + normal = geompy.GetNormal(filling, vertex) + + if centreFondFiss is not None: + logging.debug("orientation filling a l'aide du centre de fond de fissure") + vecteurDefaut = geompy.MakeVector(centreFondFiss, vertex) + + if not isVecteurDefaut: + pointIn_x = 0.0 + pointIn_y = 0.0 + pointIn_z = 0.0 + pointExplicite = False + if shapeFissureParams.has_key('pointIn_x'): + pointExplicite = True + pointIn_x = shapeFissureParams['pointIn_x'] + if shapeFissureParams.has_key('pointIn_y'): + pointExplicite = True + pointIn_y = shapeFissureParams['pointIn_y'] + if shapeFissureParams.has_key('pointIn_z'): + pointExplicite = True + pointIn_z = shapeFissureParams['pointIn_z'] + if pointExplicite: + cdg = geompy.MakeVertex(pointIn_x, pointIn_y, pointIn_z) + logging.debug("orientation filling par point intérieur %s", (pointIn_x, pointIn_y, pointIn_z)) + vecteurDefaut = geompy.MakeVector(cdg, vertex) + + if shapeFissureParams.has_key('convexe'): + isConvexe = shapeFissureParams['convexe'] + logging.debug("orientation filling par indication de convexité %s", isConvexe) + cdg = geompy.MakeCDG(filling) + if isConvexe: + vecteurDefaut = geompy.MakeVector(cdg, vertex) + else: + vecteurDefaut = geompy.MakeVector(vertex, cdg) + + if vecteurDefaut is not None: + geompy.addToStudy(normal, "normFillOrig%d"%iface) + geompy.addToStudy(vecteurDefaut, "fromInterieur%d"%iface) + if geompy.GetAngleRadians(vecteurDefaut, normal) > math.pi/2.0: + filling = geompy.ChangeOrientation(filling) + geompy.addToStudy( filling, "filling%d"%iface ) + #geompy.ExportBREP(filling, "filling.brep") + iface = iface+1 + fillings.append(filling) + noeuds_bords.append(noeudsBords) + idFilToCont.append(icont) + bords_Partages += bordsPartages + pass # --- loop on mats + # --- reconstruction des faces continues à partir des listes de noeuds + # les courbes doivent suivre la courbure pour éviter les oscillations + if icont == iface - 1: # pas de découpe, on garde la même face + fillcont = fillings[-1] + else: + nbLignes = len(curvconts[0]) + curves = [] + for i in range(nbLignes): + nodes = [curvconts[j][i] for j in range(len(curvconts))] + curve = geompy.MakeInterpol(nodes, False, False) + curves.append(curve) + fillcont = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True) + geompy.addToStudy( fillcont, "filcont%d"%icont ) + fillconts.append(fillcont) + icont = icont+1 + pass # --- loop while there are remaining nodes + + return fillings, noeuds_bords, bords_Partages, fillconts, idFilToCont diff --git a/src/Tools/blocFissure/gmu/regroupeSainEtDefaut.py b/src/Tools/blocFissure/gmu/regroupeSainEtDefaut.py new file mode 100644 index 000000000..7acbe4c77 --- /dev/null +++ b/src/Tools/blocFissure/gmu/regroupeSainEtDefaut.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import smesh +import SMESH +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- maillage complet et fissure + +def RegroupeSainEtDefaut(maillageSain, blocComplet, extrusionFaceFissure, faceGeomFissure, nomVolume, normal = None): + """ + Maillage sain sans la zone de defaut + TODO: a completer + """ + logging.info('Concatenation') + + maillageComplet = smesh.Concatenate([maillageSain.GetMesh(), blocComplet.GetMesh()], 1, 1, 1e-05,False) + + groups = maillageComplet.GetGroups() + grps = [ grp for grp in groups if grp.GetName() == 'FACE1'] + faceFissure = grps[0] + grps = [ grp for grp in groups if grp.GetName() == 'nfondfis'] + noeudsFondFissure = grps[0] + grps = [ grp for grp in groups if grp.GetName() == 'fisInPi'] + fisInPi = grps[0] + grps = [ grp for grp in groups if grp.GetName() == 'fisOutPi'] + fisOutPi = grps[0] + + # --- TODO: fiabiliser l'orientation dans le cas general + if normal is None: + normal = smesh.MakeDirStruct( 0, 0, 1 ) + maillageComplet.Reorient2D( fisInPi, normal, [0,0,0]) + maillageComplet.Reorient2D( fisOutPi, normal, [0,0,0]) + + shapes = [] + if extrusionFaceFissure is not None: + subIds = geompy.SubShapeAllIDs(extrusionFaceFissure, geompy.ShapeType["SOLID"]) + if len(subIds) > 1: + shapes = geompy.ExtractShapes(extrusionFaceFissure, geompy.ShapeType["SOLID"], False) + else: + shapes = [extrusionFaceFissure] +# else: +# subIds = geompy.SubShapeAllIDs(faceGeomFissure, geompy.ShapeType["FACE"]) +# if len(subIds) > 1: +# shapes = geompy.ExtractShapes(faceGeomFissure, geompy.ShapeType["FACE"], False) +# else: +# shapes = [faceGeomFissure] + + grpEdges = [] + grpFaces = [] + grpVolumes = [] + if len(shapes) == 0: + shapes = [None] # calcul uniquement avec les normales des faces mailles de la fissure + for i, aShape in enumerate(shapes): + logging.info('Detection elements affectes par le dedoublement de la face %d'%i) + affectedGroups = maillageComplet.AffectedElemGroupsInRegion([faceFissure], [noeudsFondFissure], aShape) + grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedEdges'] + affectedEdges = grps[0] + affectedEdges.SetName('affEd%d'%i) + grpEdges.append(affectedEdges) + grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedFaces'] + affectedFaces = grps[0] + affectedFaces.SetName('affFa%d'%i) + grpFaces.append(affectedFaces) + grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedVolumes'] + affectedVolumes = grps[0] + affectedVolumes.SetName('affVo%d'%i) + grpVolumes.append(affectedVolumes) + logging.info("union des groupes d'edges") + affectedEdges = maillageComplet.UnionListOfGroups(grpEdges, 'affEdges') + logging.info("union des groupes de faces") + affectedFaces = maillageComplet.UnionListOfGroups(grpFaces, 'affFaces') + logging.info("union des groupes de volumes") + affectedVolumes = maillageComplet.UnionListOfGroups(grpVolumes, 'affVols') + for grp in affectedGroups: + logging.debug("nom groupe %s",grp.GetName()) + [ FACE2, FACE2_nodes ] = maillageComplet.DoubleNodeElemGroups([faceFissure], [noeudsFondFissure], affectedGroups, True, True) + FACE2.SetName( 'FACE2' ) + + GroupVol = maillageComplet.CreateEmptyGroup( SMESH.VOLUME, nomVolume ) + nbAdd = GroupVol.AddFrom( maillageComplet.GetMesh() ) + + return maillageComplet + diff --git a/src/Tools/blocFissure/gmu/rotTrans.py b/src/Tools/blocFissure/gmu/rotTrans.py new file mode 100644 index 000000000..7b8ff6e47 --- /dev/null +++ b/src/Tools/blocFissure/gmu/rotTrans.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy +import math +from triedreBase import triedreBase +O, OX, OY, OZ = triedreBase() + +# ----------------------------------------------------------------------------- +# --- operateur de rotation translation d'un objet centré à l'origine + +def rotTrans(objet, orientation, point, normal, trace = False): + """ + Déplacement par rotation translation d'un objet centré à l'origine, vers un point de la surface de la pièce saine + dans laquelle on insère le défaut. + @param objet : objet original centré à l'origine (geomObject) + @param orientation : rotation selon OX de l'objet original (degrés) + @param point : le point qui sera le centre de l'objet déplacé (geomObject), en général sur la surface de la pièce saine + @param normal : la normale à la surface de la pièce saine au point central (geomObject) + @return trans : objet transformé (geomObject) + """ + logging.info("start") + planXY = geompy.MakePlaneLCS(None, 2000, 1) + projXY = geompy.MakeProjection(normal, planXY) + [v1,v2] = geompy.ExtractShapes(projXY, geompy.ShapeType["VERTEX"], False) + xyz1 = geompy.PointCoordinates(v1) + xyz2 = geompy.PointCoordinates(v2) + x = xyz2[0] - xyz1[0] + y = xyz2[1] - xyz1[1] + sinalpha = y / math.sqrt(x*x + y*y) + cosalpha = x / math.sqrt(x*x + y*y) + alpha = math.asin(sinalpha) + if cosalpha < 0: + alpha = math.pi -alpha + + beta = geompy.GetAngleRadians(OZ, normal) + [v1,v2] = geompy.ExtractShapes(normal, geompy.ShapeType["VERTEX"], False) + xyz1 = geompy.PointCoordinates(v1) + xyz2 = geompy.PointCoordinates(v2) + z = xyz2[2] - xyz1[2] + if z < 0: + beta = math.pi -beta + + rot0 = geompy.MakeRotation(objet, OX, orientation*math.pi/180.0) + rot1 = geompy.MakeRotation(rot0, OZ, alpha) + axe2 = geompy.MakeRotation(OY, OZ, alpha) + rot2 = geompy.MakeRotation(rot1, axe2, beta -math.pi/2.) + logging.debug("alpha",alpha) + logging.debug("beta",beta) + if trace: + geompy.addToStudy( rot1, 'rot1' ) + geompy.addToStudy( axe2, 'axe2' ) + geompy.addToStudy( rot2, 'rot2' ) + + xyz = geompy.PointCoordinates(point) + trans = geompy.MakeTranslation(rot2, xyz[0], xyz[1], xyz[2]) + return trans diff --git a/src/Tools/blocFissure/gmu/shapeSurFissure.py b/src/Tools/blocFissure/gmu/shapeSurFissure.py new file mode 100644 index 000000000..10b125ff7 --- /dev/null +++ b/src/Tools/blocFissure/gmu/shapeSurFissure.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- construction d'une shape de dectection des éléments à modifier suite à la la duplication des noeuds de la face fissure (d'un coté de la face) + +def shapeSurFissure(facesFissure): + """ + TODO: a completer, Normaliser les vecteurs et ponderer par les surfaces... + """ + logging.info('start') + normal = None + subIds = geompy.SubShapeAllIDs(facesFissure, geompy.ShapeType["FACE"]) + if len(subIds) > 1: + logging.debug("plusieurs faces de fissure") + faces = geompy.ExtractShapes(facesFissure, geompy.ShapeType["FACE"], False) + extrusions = [] + for n,face in enumerate(faces): + vertex = geompy.MakeVertexOnSurface(face, 0.5, 0.5) + normal = geompy.GetNormal(face, vertex) + extrusion = geompy.MakePrismVecH(face, normal, 100) + extrusions.append(extrusion) + extrusionFaceFissure = geompy.MakeCompound(extrusions) + else: + logging.debug("une seule face de fissure") + face = facesFissure + vertex = geompy.MakeVertexOnSurface(face, 0.5, 0.5) + normal = geompy.GetNormal(face, vertex) + extrusionFaceFissure = geompy.MakePrismVecH(facesFissure, normal, 100) + + geompy.addToStudy(extrusionFaceFissure, "extrusionFaceFissure") + return extrusionFaceFissure, normal + diff --git a/src/Tools/blocFissure/gmu/shapesSurFissure.py b/src/Tools/blocFissure/gmu/shapesSurFissure.py new file mode 100644 index 000000000..a8a98a1a1 --- /dev/null +++ b/src/Tools/blocFissure/gmu/shapesSurFissure.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- identification des shapes modifiées par la duplication des noeuds de la face fissure (d'un coté de la face) + +def shapesSurFissure(blocPartition, plane1, faceFissure, gencnt): + """ + TODO: a completer + """ + logging.info('start') + + shapesAModifier = [] + vertex = geompy.MakeVertexOnSurface(plane1, 0.5, 0.5) + normal = geompy.GetNormal(plane1, vertex) + extrusion = geompy.MakePrismVecH(plane1, normal, 100) + + sharedSolids = [] + solids= geompy.GetShapesOnBox ( extrusion, blocPartition, geompy.ShapeType("SOLID"), GEOM.ST_ONIN ) + for solid in solids: + sharedSolids += geompy.GetSharedShapes(faceFissure, solid, geompy.ShapeType["SOLID"]) + logging.debug("sharedSolids %s",sharedSolids) + + sharedFaces = [] + faces= geompy.GetShapesOnBox ( extrusion, blocPartition, geompy.ShapeType("FACE"), GEOM.ST_ONIN ) + for face in faces: + sharedFaces += geompy.GetSharedShapes(faceFissure, face, geompy.ShapeType["FACE"]) + logging.debug("sharedFaces %s",sharedFaces) + + sharedEdges = [] + edges= geompy.GetShapesOnBox ( extrusion, blocPartition, geompy.ShapeType("EDGE"), GEOM.ST_ONIN ) + for edge in edges: + if not edge.IsSame(gencnt): + sharedEdges += geompy.GetSharedShapes(faceFissure, edge, geompy.ShapeType["EDGE"]) + logging.debug("sharedEdges %s",sharedEdges) + + shapesAModifier = [ sharedSolids, sharedFaces, sharedEdges] + return shapesAModifier diff --git a/src/Tools/blocFissure/gmu/sortEdges.py b/src/Tools/blocFissure/gmu/sortEdges.py new file mode 100644 index 000000000..6d633f7d8 --- /dev/null +++ b/src/Tools/blocFissure/gmu/sortEdges.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- tri par longueur d'edges + +def sortEdges(edgesToSort): + """ + tri des edges par longueur + """ + logging.info('start') + + lenEdges = [(geompy.BasicProperties(edge)[0], i, edge) for i, edge in enumerate(edgesToSort)] + lenEdges.sort() + edgesSorted = [edge for length, i, edge in lenEdges] + return edgesSorted, lenEdges[0][0], lenEdges[-1][0] + diff --git a/src/Tools/blocFissure/gmu/sortFaces.py b/src/Tools/blocFissure/gmu/sortFaces.py new file mode 100644 index 000000000..0fe962e6d --- /dev/null +++ b/src/Tools/blocFissure/gmu/sortFaces.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- tri par surface de faces + +def sortFaces(facesToSort): + """ + tri des faces par surface + """ + logging.info('start') + + surFaces = [(geompy.BasicProperties(face)[1], i, face) for i, face in enumerate(facesToSort)] + surFaces.sort() + facesSorted = [face for surf, i, face in surFaces] + return facesSorted, surFaces[0][0], surFaces[-1][0] + diff --git a/src/Tools/blocFissure/gmu/sortGeneratrices.py b/src/Tools/blocFissure/gmu/sortGeneratrices.py new file mode 100644 index 000000000..956a8bcb8 --- /dev/null +++ b/src/Tools/blocFissure/gmu/sortGeneratrices.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- tri par longueur des 3 generatrices + +def sortGeneratrices(tore, geners): + """ + tri des 3 edges 'génératrices' selon leur longueur. + @param tore + @param les edges 'generatrices' + @return (genext, genint, gencnt) les 3 edges, de la plus grande à la plus petite + """ + logging.info("start") + + genx = geompy.ExtractShapes(geners[0], geompy.ShapeType["EDGE"], True) + + lenx = [] + for i in range(len(genx)): + props = geompy.BasicProperties(genx[i]) + lenx.append(props[0]) + pass + minlen = min(lenx) + maxlen = max(lenx) + genext=None + gencnt=None + genint=None + for i in range(len(genx)): + if lenx[i] == minlen: + genint = genx[i] + elif lenx[i] == maxlen: + genext = genx[i] + else: + gencnt= genx[i] + pass + + geompy.addToStudyInFather( tore, genext, 'genext' ) + geompy.addToStudyInFather( tore, genint, 'genint' ) + geompy.addToStudyInFather( tore, gencnt, 'gencnt' ) + + return genext, genint, gencnt diff --git a/src/Tools/blocFissure/gmu/sortSolids.py b/src/Tools/blocFissure/gmu/sortSolids.py new file mode 100644 index 000000000..c51bca539 --- /dev/null +++ b/src/Tools/blocFissure/gmu/sortSolids.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- tri par volume de solides + +def sortSolids(solidsToSort): + """ + tri des solides par volume + """ + logging.info('start') + + volSolids = [(geompy.BasicProperties(solid)[2], i, solid) for i, solid in enumerate(solidsToSort)] + volSolids.sort() + solidsSorted = [solid for vol, i, solid in volSolids] + return solidsSorted, volSolids[0][0], volSolids[-1][0] + diff --git a/src/Tools/blocFissure/gmu/substractSubShapes.py b/src/Tools/blocFissure/gmu/substractSubShapes.py new file mode 100644 index 000000000..3f819d7f4 --- /dev/null +++ b/src/Tools/blocFissure/gmu/substractSubShapes.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- substract a list of subShapes from another + +def substractSubShapes(obj, subs, toRemove): + """ + liste de subshapes par difference + """ + logging.info("start") + idToremove = {} + subList = [] + for s in toRemove: + idToremove[geompy.GetSubShapeID(obj, s)] = s + for s in subs: + idsub = geompy.GetSubShapeID(obj, s) + if idsub not in idToremove.keys(): + subList.append(s) + logging.debug("subList=%s", subList) + return subList diff --git a/src/Tools/blocFissure/gmu/testgmu.py b/src/Tools/blocFissure/gmu/testgmu.py new file mode 100644 index 000000000..219e3a98b --- /dev/null +++ b/src/Tools/blocFissure/gmu/testgmu.py @@ -0,0 +1,22 @@ + +from blocFissure import gmu +from blocFissure.gmu.initEtude import initEtude +initEtude() +from blocFissure.gmu.triedreBase import triedreBase +O, OX, OY, OZ = triedreBase() + +from blocFissure.gmu.distance2 import distance2 +a=[10, 20, 30] +b=[5, 7, 3] +c=distance2(a,b) + +import unittest +from blocFissure.gmu import initLog +initLog.setUnitTests() + +from blocFissure.gmu import distance2 + +suite = unittest.TestLoader().loadTestsFromTestCase(distance2.Test_distance2) +unittest.TextTestRunner(verbosity=2).run(suite) + + diff --git a/src/Tools/blocFissure/gmu/toreFissure.py b/src/Tools/blocFissure/gmu/toreFissure.py new file mode 100644 index 000000000..899ef5e0c --- /dev/null +++ b/src/Tools/blocFissure/gmu/toreFissure.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy +import math +from triedreBase import triedreBase + +O, OX, OY, OZ = triedreBase() + +# ----------------------------------------------------------------------------- +# --- tore et plan de fissure + +def toreFissure(minRad,allonge,rayTore): + """ + Construction de la geometrie du tore elliptique autour du front de fissure. + L'ellipse est construite dans le plan xoy, axe oy. + @param minRad :petit rayon + @param allonge :rapport grand rayon / petit rayon + @param rayTore :rayon du tore construit autour de la generatrice de l'ellipse + @return (generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part) : ellipse, section du tore, + tore plein, face plane de le fissure, plan de la fissure, tore partitioné par le plan de fissure. + """ + logging.info("start ", minRad, allonge, rayTore) + + Vertex_1 = geompy.MakeVertex( minRad, 0, 0) + Vertex_2 = geompy.MakeVertex(-minRad, 0, 0) + Vertex_3 = geompy.MakeRotation(Vertex_1, OZ, 45*math.pi/180.0) + Arc_1 = geompy.MakeArc(Vertex_1, Vertex_2, Vertex_3) + generatrice = geompy.MakeScaleAlongAxes(Arc_1, O, 1, allonge, 1) + + #geompy.addToStudy( Vertex_1, 'Vertex_1' ) + #geompy.addToStudy( Vertex_2, 'Vertex_2' ) + #geompy.addToStudy( Vertex_3, 'Vertex_3' ) + #geompy.addToStudy( Arc_1, 'Arc_1' ) + #geompy.addToStudy( generatrice, 'generatrice' ) + + # --- face circulaire sur la generatrice, pour extrusion + + Circle_1 = geompy.MakeCircle(O, OY, rayTore) + Rotation_1 = geompy.MakeRotation(Circle_1, OY, -90*math.pi/180.0) + Translation_1 = geompy.MakeTranslation(Rotation_1, minRad, 0, 0) + FaceGenFiss = geompy.MakeFaceWires([Translation_1], 1) + + #geompy.addToStudy( Circle_1, 'Circle_1' ) + #geompy.addToStudy( Rotation_1, 'Rotation_1' ) + #geompy.addToStudy( Translation_1, 'Translation_1' ) + #geompy.addToStudy( FaceGenFiss, 'FaceGenFiss' ) + + # --- tore extrude + + Pipe_1 = geompy.MakePipe(FaceGenFiss, generatrice) + + # --- plan fissure, delimite par la generatrice + + Scale_1_vertex_3 = geompy.GetSubShape(generatrice, [3]) + Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Scale_1_vertex_3) + FaceFissure = geompy.MakeFaceWires([generatrice, Line_1], 1) + + #geompy.addToStudyInFather( generatrice, Scale_1_vertex_3, 'Scale_1:vertex_3' ) + #geompy.addToStudy( Line_1, 'Line_1' ) + #geompy.addToStudy( FaceFissure, 'FaceFissure' ) + + # --- tore coupe en 2 demi tore de section 1/2 disque + + Plane_1 = geompy.MakePlane(O, OZ, 2000) + Pipe1Part = geompy.MakePartition([Pipe_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1) + geompy.addToStudy(Pipe1Part , 'Pipe1Part' ) + + return generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part diff --git a/src/Tools/blocFissure/gmu/triedreBase.py b/src/Tools/blocFissure/gmu/triedreBase.py new file mode 100644 index 000000000..53135633e --- /dev/null +++ b/src/Tools/blocFissure/gmu/triedreBase.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# --- origine et vecteurs de base + +O = None +OX = None +OY = None +OZ = None + +def triedreBase(): + """ + definitions globales du triedre de reference, + objets partages par plusieurs methodes + """ + global O, OX, OY, OZ + + if O == None: + logging.info("start") + O = geompy.MakeVertex(0, 0, 0) + OX = geompy.MakeVectorDXDYDZ(1, 0, 0) + OY = geompy.MakeVectorDXDYDZ(0, 1, 0) + OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) + + geompy.addToStudy( O, 'O' ) + geompy.addToStudy( OX, 'OX' ) + geompy.addToStudy( OY, 'OY' ) + geompy.addToStudy( OZ, 'OZ' ) + + return O, OX, OY, OZ diff --git a/src/Tools/blocFissure/gmu/whichSide.py b/src/Tools/blocFissure/gmu/whichSide.py new file mode 100644 index 000000000..d31fad2dd --- /dev/null +++ b/src/Tools/blocFissure/gmu/whichSide.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même) + +def whichSide(face, obj, tol = 1.e-3): + """ + Position d'un objet par rapport a une face (non nécessairement plane). + L'objet est supposé situé entierement d'un coté de la face, + ou lui appartenant totalement (objets traversants non pris en compte) + renvoie 1 si 'objet est du coté de la normale à la face, + -1 de l'autre coté, 0 si il est sur la face + """ + logging.debug('start') + side = 0 + logging.debug("shape info %s", geompy.ShapeInfo(obj)) + nbEdges = geompy.NbShapes(obj, geompy.ShapeType["EDGE"]) # --- attention ! pour une seule edge presente, renvoie 2 + logging.debug(" nbEdges %s", nbEdges) + nbFaces = geompy.NbShapes(obj, geompy.ShapeType["FACE"]) # --- attention ! pour une seule face presente, renvoie 2 + logging.debug(" nbFaces %s", nbFaces) + vertices = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False) + if nbEdges > 0 and nbFaces == 0: # --- edges + if nbEdges <= 2: + point = geompy.MakeVertexOnCurve(obj, 0.5) + vertices.append(point) + else: + edges = geompy.ExtractShapes(obj, geompy.ShapeType["EDGE"], False) + for anEdge in edges: + point = geompy.MakeVertexOnCurve(anEdge, 0.5) + vertices.append(point) + elif nbFaces >0: # --- faces + if nbFaces <=2: + point = geompy.MakeVertexOnSurface(obj, 0.5, 0.5) + vertices.append(point) + if nbFaces > 2: + faces = geompy.ExtractShapes(obj, geompy.ShapeType["FACE"], False) + for aFace in faces: + point = geompy.MakeVertexOnSurface(aFace, 0.5, 0.5) + vertices.append(point) + else: # --- vertices + vertices = [obj] + for vertex in vertices: + distance = geompy.MinDistance(vertex, face) + logging.debug(" distance %s", distance) + if distance > tol: + projection = geompy.MakeProjection(vertex, face) + normal = geompy.GetNormal(face, projection) + vect = geompy.MakeVector(projection, vertex) + angle = geompy.GetAngle(normal, vect) + logging.debug(" angle %s", angle) + side = 1 + if abs(angle) > 10: + side = -1 + break + logging.debug(" side %s", side) + return side + diff --git a/src/Tools/blocFissure/gmu/whichSideMulti.py b/src/Tools/blocFissure/gmu/whichSideMulti.py new file mode 100644 index 000000000..248e6cf2c --- /dev/null +++ b/src/Tools/blocFissure/gmu/whichSideMulti.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même) + +def whichSideMulti(facerefs, ifil, obj, centre, tol = 1.e-3): + """ + Position d'un objet par rapport a un ensemble de faces (non nécessairement planes). + Ces faces délimitent partiellement un volume, le point "centre" est supposé dans le volume + L'objet est supposé situé entierement d'un coté des faces, + ou appartenant totalement à une face (objets traversants non pris en compte) + renvoie 1 si 'objet est dedans (inside), + -1 dehors (outside), 0 si il est sur une face d'index ifil + """ + logging.debug('start') + side = 0 + logging.debug("shape info %s", geompy.ShapeInfo(obj)) + nbEdges = geompy.NbShapes(obj, geompy.ShapeType["EDGE"]) # --- attention ! pour une seule edge presente, renvoie 2 + logging.debug(" nbEdges %s", nbEdges) + vertices = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False) + if nbEdges > 0 : # --- edges + if nbEdges <= 2: + point = geompy.MakeVertexOnCurve(obj, 0.5) + vertices.append(point) + else: + edges = geompy.ExtractShapes(obj, geompy.ShapeType["EDGE"], False) + for anEdge in edges: + point = geompy.MakeVertexOnCurve(anEdge, 0.5) + vertices.append(point) + else: # --- vertices + vertices = [obj] + nbOnRef = 0 + nbOnOther = 0 + for vertex in vertices: + nbMiss = 0 + for i, face in enumerate(facerefs): + distance = geompy.MinDistance(vertex, face) + logging.debug(" distance %s", distance) + if distance > tol: + if geompy.MinDistance(vertex, centre) > tol: + line = geompy.MakeLineTwoPnt(vertex, centre) + else : + side = 1 # le centre est inside... + break + part = geompy.MakePartition([line], [face], [], [], geompy.ShapeType["EDGE"], 0, [], 0) + nbpts = geompy.NbShapes(part,geompy.ShapeType["VERTEX"]) + if nbpts > 2: + side = -1 # outside + break + else: + nbMiss += 1 + pass # peut-être inside, tester les autres faces + else: + if i == ifil: + nbOnRef +=1 # le point est sur la face de référence, on continue avec les autres points + break + else: + nbOnOther += 1 # le point est sur une autre face, mais il peut aussi être sur la face de référence... + pass # on peut tester les autres faces + if nbMiss == len(facerefs): + side = 1 # inside + if side != 0: + break + if side == 0 and nbOnRef < len(vertices): + side = 1 # inside + logging.debug(" side %s", side) + return side + diff --git a/src/Tools/blocFissure/gmu/whichSideVertex.py b/src/Tools/blocFissure/gmu/whichSideVertex.py new file mode 100644 index 000000000..13a29c4fa --- /dev/null +++ b/src/Tools/blocFissure/gmu/whichSideVertex.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +import logging +from geomsmesh import geompy + +# ----------------------------------------------------------------------------- +# --- calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même) + +def whichSideVertex(face, vertex, tol = 1.e-3): + """ + Position d'un vertex par rapport a une face (non nécessairement plane). + renvoie 1 si le vertex est du coté de la normale à la face, + -1 de l'autre coté, 0 si il est sur la face + """ + #logging.info('start') + side = 0 + distance = geompy.MinDistance(vertex, face) + #logging.debug(" distance %s", distance) + if distance > tol: + projection = geompy.MakeProjection(vertex, face) + normal = geompy.GetNormal(face, projection) + vect = geompy.MakeVector(projection, vertex) + angle = geompy.GetAngle(normal, vect) + #logging.debug(" angle %s", angle) + side = 1 + if abs(angle) > 10: + side = -1 + logging.debug("side %s distance %s", side, distance) + return side + diff --git a/src/Tools/blocFissure/ihm/CMakeLists.txt b/src/Tools/blocFissure/ihm/CMakeLists.txt new file mode 100644 index 000000000..ab8e80b15 --- /dev/null +++ b/src/Tools/blocFissure/ihm/CMakeLists.txt @@ -0,0 +1,46 @@ +# Copyright (C) 2012-2014 EDF R&D +# +# 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, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +INCLUDE(UsePyQt4) + +# --- scripts --- + +# scripts / static +SET(plugin_SCRIPTS + __init__.py + fissureCoude_ihm.py + fissureCoude_plugin.py +) + +# --- resources --- + +# uic files / to be processed by pyuic +SET(_pyuic_files + fissureCoude.ui + fissureGenerale.ui +) + +# scripts / pyuic wrappings +PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) + +# --- rules --- + +SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/ihm) + +SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/ihm) \ No newline at end of file diff --git a/src/Tools/blocFissure/ihm/__init__.py b/src/Tools/blocFissure/ihm/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/Tools/blocFissure/ihm/dialogFissureCoude.dic b/src/Tools/blocFissure/ihm/dialogFissureCoude.dic new file mode 100644 index 000000000..8587899c0 --- /dev/null +++ b/src/Tools/blocFissure/ihm/dialogFissureCoude.dic @@ -0,0 +1 @@ +{'nbAxeTubeP2': 12, 'orientation': 90.0, 'nbAxeTubeP1': 16, 'posiAngul': 20.0, 'influence': 50.0, 'nbCirconf': 20, 'azimut': 160.0, 'longueur': 400.0, 'rbFissExt': True, 'cbForceEllipse': False, 'cbOptDiscrFiss': True, 'lTubeP2': 1200.0, 'dext': 760.0, 'angle': 60.0, 'cbOptDiscrSain': True, 'nbAxeCoude': 15, 'epais': 40.0, 'nbSecteurs': 6, 'aretesFaceFissure': 5.0, 'rCintr': 1200.0, 'rayonTore': 2.5, 'nbEpaisseur': 3, 'nbTranches': 176, 'rbPosiAngul': True, 'lenSegPipe': 2.4511363636363637, 'absCurv': 0.0, 'profondeur': 10.0, 'lTubeP1': 1600.0, 'nbCouronnes': 5} \ No newline at end of file diff --git a/src/Tools/blocFissure/ihm/fissureCoude.ui b/src/Tools/blocFissure/ihm/fissureCoude.ui new file mode 100644 index 000000000..2fc5575f1 --- /dev/null +++ b/src/Tools/blocFissure/ihm/fissureCoude.ui @@ -0,0 +1,1116 @@ + + + Dialog + + + + 0 + 0 + 826 + 540 + + + + Dialog + + + + + + + + + + Coude Sain + + + + + + Géométrie + + + + + + + + L_TUBE_P1 + + + + + + + Valeur de l'angle du coude en degrés + + + 5 + + + -181.000000000000000 + + + 180.000000000000000 + + + -181.000000000000000 + + + + + + + R_CINTR + + + + + + + EPAIS + + + + + + + Valeur de l’épaisseur du coude et des embouts + + + 5 + + + 1000000.000000000000000 + + + + + + + L_TUBE_P2 + + + + + + + Valeur de la longueur de l’embout P2 à l’extrémité duquel seront appliqués les chargements + + + 5 + + + 1000000.000000000000000 + + + + + + + DEXT + + + + + + + ANGLE + + + + + + + Valeur du diamètre externe du coude et des embouts droits + + + 5 + + + 1000000.000000000000000 + + + + + + + Valeur de la longueur de l’embout P1 à l’extrémité duquel seront appliqués les chargements + + + 5 + + + 1000000.000000000000000 + + + + + + + Valeur du rayon de cintrage du coude + + + 5 + + + 1000000.000000000000000 + + + + + + + + + + + + + + + Paramètres optionnels de discretisation + + + Options de discretisation + + + + + + + Maillage + + + + + + + + Nombres de segments + + + + + + + + + NB_AXE_TUBE_P1 + + + + + + + Nombre d’éléments le long de l’embout P1 + + + 10000 + + + 15 + + + + + + + NB_AXE_TUBE_P2 + + + + + + + Nombre d’éléments le long de l’embout P2 + + + 10000 + + + 15 + + + + + + + NB_AXE_COUDE + + + + + + + Nombre d’éléments le long de l’axe du coude + + + 10000 + + + 10 + + + + + + + NB_CIRCONF + + + + + + + <html><head/><body><p>Nombre d’éléments le long de la circonférence</p><p>(nombre pair)</p></body></html> + + + 10000 + + + 20 + + + + + + + NB_EPAISSEUR + + + + + + + Nombre d'éléments dans l'épaisseur + + + 10000 + + + 3 + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Fissure + + + + + + + + Géométrie fissure + + + + + + + + position + + + + + + <html><head/><body><p>Fissure positionnée sur la face interne</p></body></html> + + + fissure interne + + + + + + + <html><head/><body><p>Fissure positionnée sur la face externe</p></body></html> + + + fissure externe + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + <html><head/><body><p>Forcer une fissure de forme elliptique, même si elle est longue</p></body></html> + + + + + + forcer elliptique + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Valeur de la position circonférentielle du centre de la fissure comptée positivement en degrés à partir de l’extrados jusqu’à l’intrados en passant par le flanc gauche + + + 5 + + + -181.000000000000000 + + + 180.000000000000000 + + + -181.000000000000000 + + + + + + + PROFONDEUR + + + + + + + <html><head/><body><p>Profondeur de la fissure :</p><p>distance maximale entre le fond de fissure et la peau interne ou externe sur laquelle débouche la fissure</p></body></html> + + + 5 + + + 1000000.000000000000000 + + + + + + + LONGUEUR + + + + + + + AZIMUT + + + + + + + ORIEN + + + + + + + Valeur de l’angle en degrés formé par le grand axe de la fissure et la génératrice du coude donnant ainsi l’orientation du défaut + + + 5 + + + -1.000000000000000 + + + 90.000000000000000 + + + -1.000000000000000 + + + + + + + Longueur du grand axe de la fissure mesurée sur le coude en peau interne ou externe, suivant la peau sur laquelle se trouve la fissure + + + 5 + + + 1000000.000000000000000 + + + + + + + + + position longitudinale + + + + + + Définition de la position longitudinale par une abscisse curiviligne + + + ABS_CURV + + + + + + + Définition de la position longitudinale par un angle + + + POSI_ANGUL + + + + + + + <html><head/><body><p>Valeur de la position longitudinale du centre de la fissure définie par rapport à l'interface de l'embout P1 :</p><p>Abcisse curviligne le long de l'axe du coude, sur la peau interne ou externe, selon la position de la fissure.</p><p><br/></p></body></html> + + + 5 + + + 1000000.000000000000000 + + + + + + + <html><head/><body><p>Valeur de la position longitudinale du centre de la fissure définie par rapport à l'interface de l'embout P1 :</p><p>Angle en degrés formé par la section contenant le centre de la fissure et l'interface de l'embout P1.</p><p><br/></p></body></html> + + + 5 + + + -181.000000000000000 + + + 180.000000000000000 + + + -181.000000000000000 + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Maillage fissure + + + + + + maillage zone de fissure + + + + + + pipe rayonnant + + + + + + + + NB_TRANCHES + + + + + + + NB_COURONNE + + + + + + + <html><head/><body><p>Pipe rayonnant construit sur le fond de fissure :</p><p>nombre de couronnes du maillage rayonnant autour de la ligne de fond de fissure, y compris la couronne centrale formée de prismes.</p></body></html> + + + 1 + + + 10000 + + + 1 + + + + + + + NB_SECTEUR + + + + + + + <html><head/><body><p>Pipe rayonnant construit sur le fond de fissure :</p><p>nombre de secteurs selon un cercle normal au fond de fissure.</p></body></html> + + + 3 + + + 10000 + + + 3 + + + + + + + <html><head/><body><p>Pipe rayonnant construit sur le fond de fissure :</p><p>Nombre de mailles (approximatif) le long de la ligne de fond de fissure.</p></body></html> + + + 7 + + + 100000 + + + 7 + + + + + + + RAYON_TORE + + + + + + + false + + + <html><head/><body><p>Pipe rayonnant construit sur le fond de fissure :</p><p>Rayon du pipe.</p></body></html> + + + 5 + + + 1000000.000000000000000 + + + 2.000000000000000 + + + + + + + + + Qt::Horizontal + + + + 6 + 20 + + + + + + + + + + + Paramètres optionnels de discrétisation + + + Options de discretisation + + + + + + + true + + + faces externes + + + + + + aretes face fissure + + + + + + + <html><head/><body><p>Faces externes de la zone à remailler.</p><p>Mailage en triangles : valeur cible des arêtes.</p></body></html> + + + 5 + + + 1000000.000000000000000 + + + + + + + Qt::Horizontal + + + + 1 + 20 + + + + + + + + + + + + + + true + + + identification zone à remailler + + + + + + + + <html><head/><body><p>La zone remaillée contiendra toutes les mailles du maillage sain à une distance de la face de fissure inférieure à cette valeur.</p></body></html> + + + 5 + + + 1000000.000000000000000 + + + + + + + distance influence + + + + + + + + + Qt::Horizontal + + + + 47 + 20 + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 24 + + + + --- Calcul en cours --- + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 4 + + + + + + + + + + réinitialisation de tous les paramètres à leur valeur par défaut + + + Reset + + + + + + + réinitialisation de tous les paramètres à leur valeur de la précédente éxécution + + + Précédent + + + + + + + réinitialisation des paramètres à partir d'un fichier préalablement sauvegardé + + + Recharger + + + + + + + sauvegarde des paramètres dans un fichier à choisir + + + Sauver + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + verticalSpacer_2 + horizontalSpacer + lb_calcul + horizontalSpacer_9 + + + + + buttonBox + accepted() + Dialog + accept() + + + 1055 + 594 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 1055 + 594 + + + 286 + 274 + + + + + cb_optDiscrSain + clicked(bool) + gb_discrSain + setShown(bool) + + + 69 + 312 + + + 70 + 549 + + + + + cb_optDiscrFiss + clicked(bool) + gb_discrFacesExternes + setShown(bool) + + + 1033 + 311 + + + 1033 + 387 + + + + + cb_optDiscrFiss + clicked(bool) + gb_zoneRemail + setShown(bool) + + + 1033 + 311 + + + 1036 + 472 + + + + + cb_optDiscrFiss + clicked(bool) + dsb_rayonTore + setEnabled(bool) + + + 1033 + 311 + + + 1005 + 278 + + + + + rb_absCurv + toggled(bool) + dsb_absCurv + setEnabled(bool) + + + 477 + 392 + + + 649 + 396 + + + + + rb_posiAngul + toggled(bool) + dsb_posiAngul + setEnabled(bool) + + + 477 + 425 + + + 649 + 429 + + + + + diff --git a/src/Tools/blocFissure/ihm/fissureCoude_ihm.py b/src/Tools/blocFissure/ihm/fissureCoude_ihm.py new file mode 100644 index 000000000..1167c55fa --- /dev/null +++ b/src/Tools/blocFissure/ihm/fissureCoude_ihm.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- + +from blocFissure.gmu.fissureCoude import fissureCoude + +class fissureCoude_ihm(fissureCoude): + """ + problème de fissure du Coude : + pour version IHM graphique + """ + +# --------------------------------------------------------------------------- + def setDicoParams(self,dico): + self.dico = dico + +# --------------------------------------------------------------------------- + def setParamGeometrieSaine(self): + """ + Paramètres géométriques du tuyau coudé sain: + angleCoude + r_cintr + l_tube_p1 + l_tube_p2 + epais + de + """ + self.geomParams = dict(angleCoude = self.dico['angle'], + r_cintr = self.dico['rCintr'], + l_tube_p1 = self.dico['lTubeP1'], + l_tube_p2 = self.dico['lTubeP2'], + epais = self.dico['epais'], + de = self.dico['dext']) + + # --------------------------------------------------------------------------- + def setParamMaillageSain(self): + self.meshParams = dict(n_long_p1 = self.dico['nbAxeTubeP1'], + n_ep = self.dico['nbEpaisseur'], + n_long_coude = self.dico['nbAxeCoude'], + n_circ_g = self.dico['nbCirconf'], + n_circ_d = self.dico['nbCirconf'], + n_long_p2 = self.dico['nbAxeTubeP2']) + +# --------------------------------------------------------------------------- + def setParamShapeFissure(self): + """ + paramètres de la fissure pour le tuyau coude + profondeur : 0 < profondeur <= épaisseur + rayonPipe : rayon du pipe correspondant au maillage rayonnant + lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut) + azimut : entre 0 et 360° + alpha : 0 < alpha < angleCoude + longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe). + orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques + lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage) + elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites) + pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) + externe : True : fissure face externe, False : fissure face interne + """ + print "setParamShapeFissure", self.nomCas + self.shapeFissureParams = dict(profondeur = self.dico['profondeur'], + rayonPipe = self.dico['rayonTore'], + lenSegPipe = self.dico['lenSegPipe'], + azimut = self.dico['azimut'], + alpha = self.dico['posiAngul'], + longueur = self.dico['longueur'], + orientation = self.dico['orientation'], + lgInfluence = self.dico['influence'], + elliptique = self.dico['cbForceEllipse'], + externe = self.dico['rbFissExt']) + +# --------------------------------------------------------------------------- + def setParamMaillageFissure(self): + """ + Paramètres du maillage de la fissure pour le tuyau coudé + Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe. + nbSegRad = nombre de couronnes + nbSegCercle = nombre de secteurs + areteFaceFissure = taille cible de l'arête des triangles en face de fissure. + """ + self.maillageFissureParams = dict(nomRep = '.', + nomFicSain = self.nomCas, + nomFicFissure = 'fissure_' + self.nomCas, + nbsegRad = self.dico['nbCouronnes'], + nbsegCercle = self.dico['nbSecteurs'], + areteFaceFissure = self.dico['aretesFaceFissure']) + + # --------------------------------------------------------------------------- + def setReferencesMaillageFissure(self): + self.referencesMaillageFissure = dict(Entity_Node = 0, + Entity_Quad_Edge = 0, + Entity_Quad_Triangle = 0, + Entity_Quad_Quadrangle = 0, + Entity_Quad_Tetra = 0, + Entity_Quad_Hexa = 0, + Entity_Quad_Penta = 0, + Entity_Quad_Pyramid = 0) + diff --git a/src/Tools/blocFissure/ihm/fissureCoude_plugin.py b/src/Tools/blocFissure/ihm/fissureCoude_plugin.py new file mode 100644 index 000000000..9771d6c3c --- /dev/null +++ b/src/Tools/blocFissure/ihm/fissureCoude_plugin.py @@ -0,0 +1,417 @@ +# -*- coding: utf-8 -*- + +# Copyright (C) 2006-2014 EDF R&D +# +# 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, or (at your option) any later version. +# +# 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 +# + +# if you already have plugins defined in a salome_plugins.py file, add this file at the end. +# if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py + +import sys, traceback +import math +from blocFissure import gmu +from blocFissure.gmu import initLog +#initLog.setDebug() +initLog.setVerbose() + +from blocFissure.gmu import geomsmesh +from blocFissure.casStandard import casStandard + +from blocFissure.ihm.fissureCoude_ihm import fissureCoude_ihm + +def fissureCoudeDlg(context): + # get context study, studyId, salomeGui + study = context.study + studyId = context.studyId + sg = context.sg + + import os + #import subprocess + #import tempfile + from PyQt4 import QtCore + from PyQt4 import QtGui + from PyQt4.QtGui import QFileDialog + from PyQt4.QtGui import QMessageBox + from PyQt4.QtGui import QPalette + from PyQt4.QtGui import QColor + from fissureCoude_ui import Ui_Dialog + + class fissureCoudeDialog(QtGui.QDialog): + + def __init__(self): + QtGui.QDialog.__init__(self) + # Set up the user interface from Designer. + self.ui = Ui_Dialog() + self.ui.setupUi(self) + + self.blackPalette = self.ui.dsb_angle.palette() + self.redPalette = QPalette() + self.redPalette.setColor(QPalette.Text, QColor(255,0,0)) + self.NOK = False + + self.initDefaut() + self.initDialog(self.defaut) + self.ui.dsb_angle.setSpecialValueText("saisie_obligatoire") + self.ui.dsb_rCintr.setSpecialValueText("saisie_obligatoire") + self.ui.dsb_lTubeP1.setSpecialValueText("saisie_obligatoire") + self.ui.dsb_lTubeP2.setSpecialValueText("saisie_obligatoire") + self.ui.dsb_epais.setSpecialValueText("saisie_obligatoire") + self.ui.dsb_dext.setSpecialValueText("saisie_obligatoire") + self.ui.dsb_profondeur.setSpecialValueText("saisie_obligatoire") + self.ui.dsb_longueur.setSpecialValueText("saisie_obligatoire") + self.ui.dsb_azimut.setSpecialValueText("saisie_obligatoire") + self.ui.dsb_orientation.setSpecialValueText("saisie_obligatoire") + self.ui.dsb_posiAngul.setSpecialValueText("saisie_obligatoire") + self.ui.dsb_absCurv.setSpecialValueText("saisie_obligatoire") + self.ui.sb_nbTranches.setSpecialValueText("saisie_obligatoire") + self.ui.sb_nbCouronne.setSpecialValueText("saisie_obligatoire") + self.ui.sb_nbSecteur.setSpecialValueText("saisie_obligatoire") + self.ui.dsb_aretesFaceFissure.setSpecialValueText("automatique") + self.ui.dsb_influence.setSpecialValueText("automatique") + self.ui.lb_calcul.hide() + + # Connect up the buttons. + self.connect(self.ui.pb_valPrec, QtCore.SIGNAL("clicked()"), + self.readValPrec) + self.connect(self.ui.pb_reset, QtCore.SIGNAL("clicked()"), + self.resetVal) + self.connect(self.ui.pb_recharger, QtCore.SIGNAL("clicked()"), + self.recharger) + self.connect(self.ui.pb_sauver, QtCore.SIGNAL("clicked()"), + self.sauver) + self.disconnect(self.ui.buttonBox, QtCore.SIGNAL("accepted()"), self.accept) + self.connect(self.ui.buttonBox, QtCore.SIGNAL("accepted()"), + self.execute) + + def initDefaut(self): + self.defaut = dict( + angle = -181.0, + rCintr = 0.0, + lTubeP1 = 0.0, + lTubeP2 = 0.0, + epais = 0.0, + dext = 0.0, + profondeur = 0.0, + longueur = 0.0, + azimut = -181.0, + orientation = -1.0, + posiAngul = -181.0, + absCurv = 0.0, + nbTranches = 7, + nbCouronnes = 1, + nbSecteurs = 3, + cbOptDiscrSain = False, + cbOptDiscrFiss = False, + rbPosiAngul = True, + rbFissExt = True, + cbForceEllipse = False, + nbAxeTubeP1 = 15, + nbAxeTubeP2 = 15, + nbAxeCoude = 10, + nbCirconf = 20, + nbEpaisseur = 3, + rayonTore = 2.0, + aretesFaceFissure = 0.0, + influence = 0.0, + ) + + def initDialog(self, dico): + self.ui.dsb_angle.setValue(dico['angle']) + self.ui.dsb_rCintr.setValue(dico['rCintr']) + self.ui.dsb_lTubeP1.setValue(dico['lTubeP1']) + self.ui.dsb_lTubeP2.setValue(dico['lTubeP2']) + self.ui.dsb_epais.setValue(dico['epais']) + self.ui.dsb_dext.setValue(dico['dext']) + self.ui.dsb_profondeur.setValue(dico['profondeur']) + self.ui.dsb_longueur.setValue(dico['longueur']) + self.ui.dsb_azimut.setValue(dico['azimut']) + self.ui.dsb_orientation.setValue(dico['orientation']) + self.ui.dsb_posiAngul.setValue(dico['posiAngul']) + self.ui.dsb_absCurv.setValue(dico['absCurv']) + self.ui.sb_nbTranches.setValue(dico['nbTranches']) + self.ui.sb_nbCouronne.setValue(dico['nbCouronnes']) + self.ui.sb_nbSecteur.setValue(dico['nbSecteurs']) + self.ui.dsb_aretesFaceFissure.setValue(dico['aretesFaceFissure']) + self.ui.dsb_influence.setValue(dico['influence']) + self.ui.sb_nbAxeTubeP1.setValue(dico['nbAxeTubeP1']) + self.ui.sb_nbAxeTubeP2.setValue(dico['nbAxeTubeP2']) + self.ui.sb_nbAxeCoude.setValue(dico['nbAxeCoude']) + self.ui.sb_nbCirconf.setValue(dico['nbCirconf']) + self.ui.sb_nbEpaisseur.setValue(dico['nbEpaisseur']) + self.ui.dsb_rayonTore.setValue(dico['rayonTore']) + #self.ui.cb_optDiscrSain.setChecked(False) + #self.ui.gb_discrSain.setShown(False) + self.ui.cb_optDiscrSain.setChecked(not(dico['cbOptDiscrSain'])) + self.ui.cb_optDiscrSain.click() + self.ui.cb_optDiscrFiss.setChecked(not(dico['cbOptDiscrFiss'])) + self.ui.cb_optDiscrFiss.click() + if dico['rbPosiAngul']: + self.ui.dsb_absCurv.setEnabled(False) + self.ui.dsb_posiAngul.setEnabled(True) + self.ui.rb_posiAngul.setChecked(True) + #self.ui.rb_posiAngul.click() + else: + self.ui.dsb_absCurv.setEnabled(True) + self.ui.dsb_posiAngul.setEnabled(False) + self.ui.rb_absCurv.setChecked(True) + #self.ui.rb_absCurv.click() + self.ui.rb_fissExt.setChecked(dico['rbFissExt']) + self.ui.cb_forceEllipse.setChecked(dico['cbForceEllipse']) + incomplet = self.testval(dico) + pass + + def testval(self, dico): + incomplet = False + if dico['angle'] < -180.0: + self.ui.dsb_angle.setPalette(self.redPalette) + incomplet = True + else: + self.ui.dsb_angle.setPalette(self.blackPalette) + + if dico['rCintr'] == 0.0: + self.ui.dsb_rCintr.setPalette(self.redPalette) + incomplet = True + else: + self.ui.dsb_rCintr.setPalette(self.blackPalette) + + if dico['lTubeP1'] == 0.0: + self.ui.dsb_lTubeP1.setPalette(self.redPalette) + incomplet = True + else: + self.ui.dsb_lTubeP1.setPalette(self.blackPalette) + + if dico['lTubeP2'] == 0.0: + self.ui.dsb_lTubeP2.setPalette(self.redPalette) + incomplet = True + else: + self.ui.dsb_lTubeP2.setPalette(self.blackPalette) + + if dico['epais'] == 0.0: + self.ui.dsb_epais.setPalette(self.redPalette) + incomplet = True + else: + self.ui.dsb_epais.setPalette(self.blackPalette) + + if dico['dext'] == 0.0: + self.ui.dsb_dext.setPalette(self.redPalette) + incomplet = True + else: + self.ui.dsb_dext.setPalette(self.blackPalette) + + if dico['profondeur'] == 0.0: + self.ui.dsb_profondeur.setPalette(self.redPalette) + incomplet = True + else: + self.ui.dsb_profondeur.setPalette(self.blackPalette) + + if dico['longueur'] == 0.0: + self.ui.dsb_longueur.setPalette(self.redPalette) + incomplet = True + else: + self.ui.dsb_longueur.setPalette(self.blackPalette) + + if dico['azimut'] < -180.0: + self.ui.dsb_azimut.setPalette(self.redPalette) + incomplet = True + else: + self.ui.dsb_azimut.setPalette(self.blackPalette) + + if dico['orientation'] < 0.0: + self.ui.dsb_orientation.setPalette(self.redPalette) + incomplet = True + else: + self.ui.dsb_orientation.setPalette(self.blackPalette) + + if dico['posiAngul'] < -180.0 and dico['rbPosiAngul'] == True: + self.ui.dsb_posiAngul.setPalette(self.redPalette) + incomplet = True + else: + self.ui.dsb_posiAngul.setPalette(self.blackPalette) + + if dico['absCurv'] == 0.0 and dico['rbPosiAngul'] == False: + self.ui.dsb_absCurv.setPalette(self.redPalette) + incomplet = True + else: + self.ui.dsb_absCurv.setPalette(self.blackPalette) + + if dico['nbTranches'] == 7: + self.ui.sb_nbTranches.setPalette(self.redPalette) + incomplet = True + else: + self.ui.sb_nbTranches.setPalette(self.blackPalette) + + if dico['nbCouronnes'] == 1: + self.ui.sb_nbCouronne.setPalette(self.redPalette) + incomplet = True + else: + self.ui.sb_nbCouronne.setPalette(self.blackPalette) + + if dico['nbSecteurs'] == 3: + self.ui.sb_nbSecteur.setPalette(self.redPalette) + incomplet = True + else: + self.ui.sb_nbSecteur.setPalette(self.blackPalette) + + print "incomplet: ", incomplet + return incomplet + + def fileDefault(self): + filedef = os.path.expanduser("~/.config/salome/dialogFissureCoude.dic") + print filedef + return filedef + + def writeDefault(self, dico): + filedef = self.fileDefault() + f = open(filedef, 'w') + f.write(str(dico)) + f.close() + + def readValPrec(self): + filedef = self.fileDefault() + if os.path.exists(filedef): + f = open(filedef, 'r') + txt = f.read() + dico = eval(txt) + print dico + self.initDialog(dico) + + def resetVal(self): + #self.initDefaut() + self.initDialog(self.defaut) + + def sauver(self): + print "sauver" + fileDiag = QFileDialog(self) + fileDiag.setFileMode(QFileDialog.AnyFile) + fileDiag.setNameFilter("Parametres *.dic (*.dic)") + fileDiag.setViewMode(QFileDialog.List) + if fileDiag.exec_() : + fileNames = fileDiag.selectedFiles() + filedef = fileNames[0] + dico = self.creeDico() + f = open(filedef, 'w') + f.write(str(dico)) + f.close() + + def recharger(self): + print "recharger" + fileDiag = QFileDialog(self) + fileDiag.setFileMode(QFileDialog.ExistingFile) + fileDiag.setNameFilter("Parametres *.dic (*.dic)") + fileDiag.setViewMode(QFileDialog.Detail) + if fileDiag.exec_() : + fileNames = fileDiag.selectedFiles() + filedef = fileNames[0] + print filedef + if os.path.exists(filedef): + f = open(filedef, 'r') + txt = f.read() + dico = eval(txt) + print dico + self.initDialog(dico) + + def creeDico(self): + dico = dict( + angle = self.ui.dsb_angle.value(), + rCintr = self.ui.dsb_rCintr.value(), + lTubeP1 = self.ui.dsb_lTubeP1.value(), + lTubeP2 = self.ui.dsb_lTubeP2.value(), + epais = self.ui.dsb_epais.value(), + dext = self.ui.dsb_dext.value(), + profondeur = self.ui.dsb_profondeur.value(), + longueur = self.ui.dsb_longueur.value(), + azimut = self.ui.dsb_azimut.value(), + orientation = self.ui.dsb_orientation.value(), + posiAngul = self.ui.dsb_posiAngul.value(), + absCurv = self.ui.dsb_absCurv.value(), + nbTranches = self.ui.sb_nbTranches.value(), + nbCouronnes = self.ui.sb_nbCouronne.value(), + nbSecteurs = self.ui.sb_nbSecteur.value(), + cbOptDiscrSain = self.ui.cb_optDiscrSain.isChecked(), + cbOptDiscrFiss = self.ui.cb_optDiscrFiss.isChecked(), + rbPosiAngul = self.ui.rb_posiAngul.isChecked(), + rbFissExt = self.ui.rb_fissExt.isChecked(), + cbForceEllipse = self.ui.cb_forceEllipse.isChecked(), + nbAxeTubeP1 = self.ui.sb_nbAxeTubeP1.value(), + nbAxeTubeP2 = self.ui.sb_nbAxeTubeP2.value(), + nbAxeCoude = self.ui.sb_nbAxeCoude.value(), + nbCirconf = self.ui.sb_nbCirconf.value(), + nbEpaisseur = self.ui.sb_nbEpaisseur.value(), + rayonTore = self.ui.dsb_rayonTore.value(), + aretesFaceFissure = self.ui.dsb_aretesFaceFissure.value(), + influence = self.ui.dsb_influence.value(), + ) + print dico + return dico + + def checkValues(self): + return self.NOK + + def execute(self): + dico = self.creeDico() + NOK = self.testval(dico) + if not(NOK): + dico['lenSegPipe'] = (dico['longueur'] + math.pi*dico['profondeur'])/dico['nbTranches'] + print 'lenSegPipe', dico['lenSegPipe'] + areteMinAngle = (dico['rCintr'] -dico['dext']/2.0)*(dico['angle']*math.pi/180.0)/dico['nbAxeCoude'] + print'areteMinAngle', areteMinAngle + areteMinCirco = dico['dext']*math.pi/(2*dico['nbCirconf']) + print'areteMinCirco', areteMinCirco + areteMinEpais = dico['epais']/dico['nbEpaisseur'] + print'areteMinEpais', areteMinEpais + if dico['influence'] == 0: + dico['influence'] = max(areteMinAngle, areteMinCirco, areteMinEpais) + print 'influence', dico['influence'] + if dico['aretesFaceFissure'] == 0: + dico['aretesFaceFissure'] = (areteMinAngle + areteMinCirco)/2.0 + print 'aretesFaceFissure', dico['aretesFaceFissure'] + if dico['rbPosiAngul'] == False: + rmoy = (dico['dext'] - dico['epais'])/2.0 + eta = 1 + if dico['rbFissExt'] == False: + eta = -1 + dico['posiAngul'] = (180.0/math.pi)*dico['absCurv']/(dico['rCintr']+(rmoy+eta*dico['epais']/2.0)*math.cos(math.pi*dico['azimut']/180.)) + print 'posiAngul' , dico['posiAngul'] + + self.writeDefault(dico) + self.ui.lb_calcul.show() + probleme = fissureCoude_ihm(0) + probleme.setDicoParams(dico) + probleme.executeProbleme() + self.NOK = NOK + self.accept() + + pass + +# ---------------------------------------------------------------------------- + + window = fissureCoudeDialog() +# window.ui.dsb_tolerance.setValue(0.01) + retry = True + while(retry): + retry = False + window.exec_() + result = window.result() + if result: + # dialog accepted + print "dialog accepted, check" + retry = window.checkValues() + else: + print "dialog rejected, exit" + pass + diff --git a/src/Tools/blocFissure/ihm/fissureGenerale.ui b/src/Tools/blocFissure/ihm/fissureGenerale.ui new file mode 100644 index 000000000..c18b3c18d --- /dev/null +++ b/src/Tools/blocFissure/ihm/fissureGenerale.ui @@ -0,0 +1,448 @@ + + + Dialog + + + + 0 + 0 + 631 + 490 + + + + Dialog + + + <html><head/><body><p>Insertion d'un maillage de fissure dans un maillage hexaédrique sain.</p><p>Le maillage sain est fourni sous forme de fichier Med.</p><p>La face de fissure est décrite par une géométrie dans un fichier brep.</p><p>La ou les arêtes de fond de fissure sont données par leurs index dans la face de fissure.</p><p>La procédure identfie des mailles saines à enlever et remailler, construit un maillage régulier rayonnant autour de la ligne de fond de fissure, reconstitue les faces externes en triangles, complète la zone à remailler en tétraèdres.</p></body></html> + + + + + + maillage sain et géometries de fissure + + + + + + + + <html><head/><body><p>sélection du fichier med du maillage sain (hexaèdres)</p></body></html> + + + maillage sain + + + + + + + <html><head/><body><p>fichier med du maillage sain (hexaèdres)</p></body></html> + + + + + + + <html><head/><body><p>sélection du fichier brep (géométrie) décrivant la face de fissure.</p></body></html> + + + face fissure + + + + + + + <html><head/><body><p>fichier brep (géométrie) décrivant la face de fissure.</p></body></html> + + + + + + + + + + + index edges fond fissure + + + + + + + <html><head/><body><p>Index des edges décrivant le fond de fissure, dans la face de fissure.</p><p>Sous forme d'une liste Python.</p><p>Exemples :<span style=" color:#00ffff;"/><span style=" font-style:italic; color:#00ffff;">[5,9]</span> ou <span style=" font-style:italic; color:#00ffff;">[3]</span></p><p>(on peut récupérer ces valeurs à l'aide du dialogue de création de groupes d'edges, dans GEOM)</p></body></html> + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + identification zone à remailler + + + + + + + + distance influence + + + + + + + <html><head/><body><p>La zone remaillée contiendra toutes les mailles du maillage sain à une distance de la face de fissure inférieure à cette valeur.</p></body></html> + + + + + + + + + Qt::Horizontal + + + + 0 + 20 + + + + + + + + prémaillage face fissure + + + + + + + + min + + + + + + + <html><head/><body><p>Pour faciliter la détermination de la zone à remailler, il faut des points sur la face de fissure, suffisament resserrés, en relation avec la taille des mailles du maillage sain.</p><p>Ces points sont obtenus par pré maillage de la face de fissure, en triangles. On donne la taille min et max des triangles.</p></body></html> + + + 1000000.000000000000000 + + + + + + + max + + + + + + + <html><head/><body><p>Pour faciliter la détermination de la zone à remailler, il faut des points sur la face de fissure, suffisament resserrés, en relation avec la taille des mailles du maillage sain.</p><p>Ces points sont obtenus par pré maillage de la face de fissure, en triangles. On donne la taille min et max des triangles.</p></body></html> + + + 1000000.000000000000000 + + + + + + + + + Qt::Horizontal + + + + 34 + 20 + + + + + + + + + + + + + + maillage zone de fissure + + + + + + pipe rayonnant + + + + + + + + rayon pipe + + + + + + + <html><head/><body><p>Pipe rayonnant construit sur le fond de fissure :</p><p>Rayon du pipe.</p></body></html> + + + 1000000.000000000000000 + + + + + + + longueur mailles + + + + + + + <html><head/><body><p>Pipe rayonnant construit sur le fond de fissure :</p><p>Longueur des mailles le long de la ligne de fond de fissure.</p></body></html> + + + 1000000.000000000000000 + + + + + + + couronnes + + + + + + + <html><head/><body><p>Pipe rayonnant construit sur le fond de fissure :</p><p>nombre de couronnes de mailles autour de la ligne de fond de fissure.</p></body></html> + + + 2 + + + 10000 + + + 4 + + + + + + + secteurs + + + + + + + <html><head/><body><p>Pipe rayonnant construit sur le fond de fissure :</p><p>nombre de secteurs selon un cercle normal au fond de fissure.</p></body></html> + + + 4 + + + 10000 + + + 8 + + + + + + + + + Qt::Horizontal + + + + 6 + 20 + + + + + + + + + + + faces externes + + + + + + aretes face fissure + + + + + + + <html><head/><body><p>Faces externes de la zone à remailler.</p><p>Mailage en triangles : valeur cible des arêtes.</p></body></html> + + + 1000000.000000000000000 + + + + + + + Qt::Horizontal + + + + 1 + 20 + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 112 + + + + + + + + + + Qt::Vertical + + + + 20 + 13 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + bb_OkCancel + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + bb_OkCancel + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/Tools/blocFissure/materielCasTests/CMakeLists.txt b/src/Tools/blocFissure/materielCasTests/CMakeLists.txt new file mode 100644 index 000000000..094f30ab9 --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/CMakeLists.txt @@ -0,0 +1,41 @@ +# Copyright (C) 2012-2014 EDF R&D +# +# 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, or (at your option) any later version. +# +# 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 +# + +# --- scripts --- + +# scripts / static +SET(plugin_SCRIPTS + __init__.py + cubeAngle.py + decoupeCylindre.py + disque_perce.py + ellipse_disque.py + ellipse_probleme.py + ellipse.py + eprouvetteCourbe.py + eprouvetteDroite.py + fissureGauche2.py + fissureGauche.py + genereMateriel.py + vis.py +) + +# --- rules --- + +SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/materielCasTests) diff --git a/src/Tools/blocFissure/materielCasTests/__init__.py b/src/Tools/blocFissure/materielCasTests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/Tools/blocFissure/materielCasTests/cubeAngle.py b/src/Tools/blocFissure/materielCasTests/cubeAngle.py new file mode 100644 index 000000000..e596663ca --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/cubeAngle.py @@ -0,0 +1,78 @@ +# -*- coding: iso-8859-1 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import salome_notebook +notebook = salome_notebook.NoteBook(theStudy) + +import os +from blocFissure import gmu + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New(theStudy) + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) +Vertex_1 = geompy.MakeVertex(0, 0, 100) +Disk_1 = geompy.MakeDiskPntVecR(Vertex_1, OZ, 60) +Vertex_2 = geompy.MakeVertex(-5, -5, 90) +Vertex_3 = geompy.MakeVertex(65, 65, 110) +Box_2 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2) +Common_1 = geompy.MakeCommon(Disk_1, Box_2) +geompy.Export(Common_1, os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"), "BREP") +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( Vertex_1, 'Vertex_1' ) +geompy.addToStudy( Disk_1, 'Disk_1' ) +geompy.addToStudy( Vertex_2, 'Vertex_2' ) +geompy.addToStudy( Vertex_3, 'Vertex_3' ) +geompy.addToStudy( Box_2, 'Box_2' ) +geompy.addToStudy( Common_1, 'Common_1' ) + +### +### SMESH component +### + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New(theStudy) +from salome.StdMeshers import StdMeshersBuilder +Mesh_1 = smesh.Mesh(Box_1) +Regular_1D = Mesh_1.Segment() +Nb_Segments_1 = Regular_1D.NumberOfSegments(15) +Nb_Segments_1.SetDistrType( 0 ) +Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) +Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa) +isDone = Mesh_1.Compute() +smesh.SetName(Mesh_1, 'Mesh_1') +Mesh_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/CubeAngle.med"), 0, SMESH.MED_V2_2, 1 ) + +## set object names +smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1') +smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') +smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') +smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') +smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/src/Tools/blocFissure/materielCasTests/decoupeCylindre.py b/src/Tools/blocFissure/materielCasTests/decoupeCylindre.py new file mode 100644 index 000000000..b650fb2e9 --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/decoupeCylindre.py @@ -0,0 +1,167 @@ +# -*- coding: iso-8859-1 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import salome_notebook +notebook = salome_notebook.notebook + +import os +from blocFissure import gmu + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New(theStudy) + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +O_1 = geompy.MakeVertex(0, 0, 0) +OX_1 = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY_1 = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ_1 = geompy.MakeVectorDXDYDZ(0, 0, 1) +Vertex_1 = geompy.MakeVertex(0, 0, 500) +Vertex_2 = geompy.MakeVertex(100, 0, 500) +Vertex_3 = geompy.MakeVertex(110, 0, 500) +Vertex_4 = geompy.MakeVertex(117.071068, -2.928932, 500) +Vertex_5 = geompy.MakeVertex(120, -10, 500) +Vertex_6 = geompy.MakeVertex(120, -30, 500) +Vertex_7 = geompy.MakeVertex(122.928932, -37.071068, 500) +Vertex_8 = geompy.MakeVertex(130, -40, 500) +Vertex_9 = geompy.MakeVertex(135, -40, 500) +Vertex_10 = geompy.MakeVertex(160, -40, 500) +Plane_1 = geompy.MakePlaneLCS(None, 2000, 2) +Mirror_1_1 = geompy.MakeMirrorByPlane(Vertex_2, Plane_1) +Mirror_1_2 = geompy.MakeMirrorByPlane(Vertex_3, Plane_1) +Mirror_1_3 = geompy.MakeMirrorByPlane(Vertex_4, Plane_1) +Mirror_1_4 = geompy.MakeMirrorByPlane(Vertex_5, Plane_1) +Mirror_1_5 = geompy.MakeMirrorByPlane(Vertex_6, Plane_1) +Mirror_1_6 = geompy.MakeMirrorByPlane(Vertex_7, Plane_1) +Mirror_1_7 = geompy.MakeMirrorByPlane(Vertex_8, Plane_1) +Mirror_1_8 = geompy.MakeMirrorByPlane(Vertex_9, Plane_1) +Mirror_1_9 = geompy.MakeMirrorByPlane(Vertex_10, Plane_1) +Curve_2 = geompy.MakeInterpol([Mirror_1_9, Mirror_1_8, Mirror_1_7, Mirror_1_6, Mirror_1_5, Mirror_1_4, Mirror_1_3, Mirror_1_2, Mirror_1_1, Vertex_1, Vertex_2, Vertex_3, Vertex_4, Vertex_5, Vertex_6, Vertex_7, Vertex_8, Vertex_9, Vertex_10], False, False) +Circle_1 = geompy.MakeCircle(Vertex_1, None, 145) +Vertex_11 = geompy.MakeVertex(0, -165, 500) +Curve_2_vertex_2 = geompy.GetSubShape(Curve_2, [2]) +Curve_2_vertex_3 = geompy.GetSubShape(Curve_2, [3]) +Arc_1 = geompy.MakeArc(Curve_2_vertex_2, Vertex_11, Curve_2_vertex_3) +FissInCylindre = geompy.MakeFaceWires([Curve_2, Arc_1], 1) +Divided_Cylinder_1 = geompy.MakeDividedCylinder(145, 800, GEOM.SQUARE) +CylindreSain = geompy.MakeRotation(Divided_Cylinder_1, OZ, 45*math.pi/180.0) +[Compound_1, vertical, radial, Compound_4] = geompy.Propagate(CylindreSain) +geompy.Export(FissInCylindre, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre.brep"), "BREP") +Vertex_12 = geompy.MakeVertex(0, -145, 500) +Circle_2 = geompy.MakeCircle(Vertex_12, None, 145) +Face_1 = geompy.MakeFaceWires([Circle_2], 1) +Vertex_13 = geompy.MakeVertex(0, 0, 500) +Disk_1 = geompy.MakeDiskPntVecR(Vertex_13, OZ_1, 170) +FissInCylindre2 = geompy.MakeCommon(Face_1, Disk_1) +geompy.Export(FissInCylindre2, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre2.brep"), "BREP") +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( O_1, 'O' ) +geompy.addToStudy( OX_1, 'OX' ) +geompy.addToStudy( OY_1, 'OY' ) +geompy.addToStudy( OZ_1, 'OZ' ) +geompy.addToStudy( Vertex_1, 'Vertex_1' ) +geompy.addToStudy( Vertex_2, 'Vertex_2' ) +geompy.addToStudy( Vertex_3, 'Vertex_3' ) +geompy.addToStudy( Vertex_4, 'Vertex_4' ) +geompy.addToStudy( Vertex_5, 'Vertex_5' ) +geompy.addToStudy( Vertex_6, 'Vertex_6' ) +geompy.addToStudy( Vertex_7, 'Vertex_7' ) +geompy.addToStudy( Vertex_8, 'Vertex_8' ) +geompy.addToStudy( Vertex_9, 'Vertex_9' ) +geompy.addToStudy( Vertex_10, 'Vertex_10' ) +geompy.addToStudy( Plane_1, 'Plane_1' ) +geompy.addToStudy( Mirror_1_1, 'Mirror_1_1' ) +geompy.addToStudy( Mirror_1_2, 'Mirror_1_2' ) +geompy.addToStudy( Mirror_1_3, 'Mirror_1_3' ) +geompy.addToStudy( Mirror_1_4, 'Mirror_1_4' ) +geompy.addToStudy( Mirror_1_5, 'Mirror_1_5' ) +geompy.addToStudy( Mirror_1_6, 'Mirror_1_6' ) +geompy.addToStudy( Mirror_1_7, 'Mirror_1_7' ) +geompy.addToStudy( Mirror_1_8, 'Mirror_1_8' ) +geompy.addToStudy( Mirror_1_9, 'Mirror_1_9' ) +geompy.addToStudy( Curve_2, 'Curve_2' ) +geompy.addToStudy( Circle_1, 'Circle_1' ) +geompy.addToStudy( Vertex_11, 'Vertex_11' ) +geompy.addToStudyInFather( Curve_2, Curve_2_vertex_2, 'Curve_2:vertex_2' ) +geompy.addToStudyInFather( Curve_2, Curve_2_vertex_3, 'Curve_2:vertex_3' ) +geompy.addToStudy( Arc_1, 'Arc_1' ) +geompy.addToStudy( FissInCylindre, 'FissInCylindre' ) +geompy.addToStudy( Divided_Cylinder_1, 'Divided Cylinder_1' ) +geompy.addToStudy( CylindreSain, 'CylindreSain' ) +geompy.addToStudyInFather( CylindreSain, Compound_1, 'Compound_1' ) +geompy.addToStudyInFather( CylindreSain, vertical, 'vertical' ) +geompy.addToStudyInFather( CylindreSain, radial, 'radial' ) +geompy.addToStudyInFather( CylindreSain, Compound_4, 'Compound_4' ) +geompy.addToStudy( Vertex_12, 'Vertex_12' ) +geompy.addToStudy( Circle_2, 'Circle_2' ) +geompy.addToStudy( Face_1, 'Face_1' ) +geompy.addToStudy( Vertex_13, 'Vertex_13' ) +geompy.addToStudy( Disk_1, 'Disk_1' ) +geompy.addToStudy( FissInCylindre2, 'FissInCylindre2' ) + +### +### SMESH component +### + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New(theStudy) +from salome.StdMeshers import StdMeshersBuilder +smeshObj_1 = smesh.CreateHypothesis('NumberOfSegments') +smeshObj_1.SetNumberOfSegments( 5 ) +smeshObj_1.SetDistrType( 0 ) +CylindreSain_1 = smesh.Mesh(CylindreSain) +Regular_1D = CylindreSain_1.Segment() +Nb_Segments_1 = Regular_1D.NumberOfSegments(15,[],[ ]) +Nb_Segments_1.SetDistrType( 0 ) +Quadrangle_2D = CylindreSain_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) +Hexa_3D = CylindreSain_1.Hexahedron(algo=smeshBuilder.Hexa) +Regular_1D_1 = CylindreSain_1.Segment(geom=vertical) +Nb_Segments_2 = Regular_1D_1.NumberOfSegments(30,[],[ ]) +Nb_Segments_2.SetDistrType( 0 ) +Regular_1D_2 = CylindreSain_1.Segment(geom=radial) +Nb_Segments_3 = Regular_1D_2.NumberOfSegments(6,[],[ ]) +Nb_Segments_3.SetDistrType( 0 ) +isDone = CylindreSain_1.Compute() +smesh.SetName(CylindreSain_1, 'CylindreSain') +CylindreSain_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests//CylindreSain.med"), 0, SMESH.MED_V2_2, 1 ) +SubMesh_1 = Regular_1D_1.GetSubMesh() +SubMesh_2 = Regular_1D_2.GetSubMesh() + +## some objects were removed +aStudyBuilder = theStudy.NewBuilder() +SO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(smeshObj_1)) +if SO is not None: aStudyBuilder.RemoveObjectWithChildren(SO) +## set object names +smesh.SetName(CylindreSain_1.GetMesh(), 'CylindreSain') +smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') +smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') +smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') +smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') +smesh.SetName(Nb_Segments_2, 'Nb. Segments_2') +smesh.SetName(Nb_Segments_3, 'Nb. Segments_3') +smesh.SetName(SubMesh_1, 'SubMesh_1') +smesh.SetName(SubMesh_2, 'SubMesh_2') + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/src/Tools/blocFissure/materielCasTests/disque_perce.py b/src/Tools/blocFissure/materielCasTests/disque_perce.py new file mode 100644 index 000000000..2f2730d3d --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/disque_perce.py @@ -0,0 +1,89 @@ +# -*- coding: iso-8859-1 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import salome_notebook +notebook = salome_notebook.notebook + +import os +from blocFissure import gmu + + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New(theStudy) + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +Cylinder_1 = geompy.MakeCylinderRH(100, 300) +Cylinder_2 = geompy.MakeCylinderRH(600, 200) +Cut_1 = geompy.MakeCut(Cylinder_2, Cylinder_1) +Face_1 = geompy.MakeFaceHW(500, 1500, 3) +Disque = geompy.MakePartition([Cut_1], [Face_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0) +[Compound_1, Compound_2, Compound_3, Compound_4] = geompy.Propagate(Disque) +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Cylinder_1, 'Cylinder_1' ) +geompy.addToStudy( Cylinder_2, 'Cylinder_2' ) +geompy.addToStudy( Cut_1, 'Cut_1' ) +geompy.addToStudy( Face_1, 'Face_1' ) +geompy.addToStudy( Disque, 'Disque' ) +geompy.addToStudyInFather( Disque, Compound_1, 'Compound_1' ) +geompy.addToStudyInFather( Disque, Compound_2, 'Compound_2' ) +geompy.addToStudyInFather( Disque, Compound_3, 'Compound_3' ) +geompy.addToStudyInFather( Disque, Compound_4, 'Compound_4' ) + +### +### SMESH component +### + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New(theStudy) +from salome.StdMeshers import StdMeshersBuilder +Disque_1 = smesh.Mesh(Disque) +Regular_1D = Disque_1.Segment() +Nb_Segments_1 = Regular_1D.NumberOfSegments(10) +Nb_Segments_1.SetDistrType( 0 ) +Hexa_3D = Disque_1.Hexahedron(algo=smeshBuilder.Hexa) +Regular_1D_1 = Disque_1.Segment(geom=Compound_3) +Nb_Segments_2 = Regular_1D_1.NumberOfSegments(20) +Nb_Segments_2.SetDistrType( 0 ) +Regular_1D_2 = Disque_1.Segment(geom=Compound_4) +status = Disque_1.AddHypothesis(Nb_Segments_2,Compound_4) +Quadrangle_2D = Disque_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) +isDone = Disque_1.Compute() +smesh.SetName(Disque_1, 'Disque') +Disque_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/disque.med"), 0, SMESH.MED_V2_2, 1 ) +SubMesh_1 = Regular_1D_1.GetSubMesh() +SubMesh_2 = Regular_1D_2.GetSubMesh() + +## set object names +smesh.SetName(Disque_1.GetMesh(), 'Disque') +smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') +smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') +smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') +smesh.SetName(Nb_Segments_2, 'Nb. Segments_2') +smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') +smesh.SetName(SubMesh_1, 'SubMesh_1') +smesh.SetName(SubMesh_2, 'SubMesh_2') + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/src/Tools/blocFissure/materielCasTests/ellipse.py b/src/Tools/blocFissure/materielCasTests/ellipse.py new file mode 100644 index 000000000..8cf26ab68 --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/ellipse.py @@ -0,0 +1,61 @@ +# -*- coding: iso-8859-1 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import salome_notebook +notebook = salome_notebook.notebook + +import os +from blocFissure import gmu + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New(theStudy) + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +Vertex_1 = geompy.MakeVertex(400, 0, 400) +Vertex_2 = geompy.MakeVertex(400, 0, 500) +Vector_1 = geompy.MakeVector(Vertex_1, Vertex_2) +Disk_1 = geompy.MakeDiskPntVecR(Vertex_1, Vector_1, 50) +Rotation_1 = geompy.MakeRotation(Disk_1, Vector_1, 180*math.pi/180.0) +Scale_1 = geompy.MakeScaleAlongAxes(Rotation_1, Vertex_1, 1, 1.5, 1) +Vertex_3 = geompy.MakeVertex(420, -400, 300) +Vertex_4 = geompy.MakeVertex(500, 400, 500) +Box_1 = geompy.MakeBoxTwoPnt(Vertex_4, Vertex_3) +ellipse1 = geompy.MakeCut(Scale_1, Box_1) +[fondFiss] = geompy.SubShapes(ellipse1, [4]) +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Vertex_1, 'Vertex_1' ) +geompy.addToStudy( Vertex_2, 'Vertex_2' ) +geompy.addToStudy( Vector_1, 'Vector_1' ) +geompy.addToStudy( Disk_1, 'Disk_1' ) +geompy.addToStudy( Rotation_1, 'Rotation_1' ) +geompy.addToStudy( Scale_1, 'Scale_1' ) +geompy.addToStudy( Vertex_3, 'Vertex_3' ) +geompy.addToStudy( Vertex_4, 'Vertex_4' ) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( ellipse1, 'ellipse1' ) +geompy.addToStudyInFather( ellipse1, fondFiss, 'fondFiss' ) +geompy.Export(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1.brep"), "BREP") + + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/src/Tools/blocFissure/materielCasTests/ellipse_disque.py b/src/Tools/blocFissure/materielCasTests/ellipse_disque.py new file mode 100644 index 000000000..9e74ff06f --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/ellipse_disque.py @@ -0,0 +1,53 @@ +# -*- coding: iso-8859-1 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import salome_notebook +notebook = salome_notebook.NoteBook(theStudy) + +import os +from blocFissure import gmu + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New(theStudy) + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +Vertex_1 = geompy.MakeVertex(100, 0, 0) +Disk_1 = geompy.MakeDiskPntVecR(Vertex_1, OY, 12.5) +Scale_1 = geompy.MakeScaleAlongAxes(Disk_1, Vertex_1, 1, 1, 4.1) +Vertex_2 = geompy.MakeVertex(98, -2, -2) +Vertex_3 = geompy.MakeVertex(120, 2, 60) +Box_1 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2) +Ellipse_disque = geompy.MakeCommon(Box_1, Scale_1) +geompy.Export(Ellipse_disque, os.path.join(gmu.pathBloc, "materielCasTests/ellipse_disque.brep"), "BREP") +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Vertex_1, 'Vertex_1' ) +geompy.addToStudy( Disk_1, 'Disk_1' ) +geompy.addToStudy( Vertex_2, 'Vertex_2' ) +geompy.addToStudy( Scale_1, 'Scale_1' ) +geompy.addToStudy( Vertex_3, 'Vertex_3' ) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( Ellipse_disque, 'Ellipse_disque' ) + + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/src/Tools/blocFissure/materielCasTests/ellipse_probleme.py b/src/Tools/blocFissure/materielCasTests/ellipse_probleme.py new file mode 100644 index 000000000..742197ede --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/ellipse_probleme.py @@ -0,0 +1,59 @@ +# -*- coding: iso-8859-1 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import salome_notebook +notebook = salome_notebook.notebook + +import os +from blocFissure import gmu + +### +### GEOM component +### + + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + +geompy = geomBuilder.New(theStudy) + +Disk_1 = geompy.MakeDiskR(100, 1) +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +Scale_1 = geompy.MakeScaleAlongAxes(Disk_1, None, 0.4, 0.75, 1) +[Vertex_1] = geompy.ExtractShapes(Scale_1, geompy.ShapeType["VERTEX"], True) +Rotation_1 = geompy.MakeRotation(Scale_1, OY, 190*math.pi/180.0) +Rotation_2 = geompy.MakeRotation(Rotation_1, OZ, 10*math.pi/180.0) +Vertex_2 = geompy.MakeVertex(20, -100, -50) +Vertex_4 = geompy.MakeVertex(100, 100, 50) +Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_4) +Cut_1 = geompy.MakeCut(Rotation_1, Box_1) +ellipse1 = geompy.MakeTranslation(Cut_1, 400, 0, 400) +geompy.addToStudy( Disk_1, 'Disk_1' ) +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Scale_1, 'Scale_1' ) +geompy.addToStudyInFather( Scale_1, Vertex_1, 'Vertex_1' ) +geompy.addToStudy( Rotation_1, 'Rotation_1' ) +geompy.addToStudy( Rotation_2, 'Rotation_2' ) +geompy.addToStudy( Vertex_2, 'Vertex_2' ) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( Vertex_4, 'Vertex_4' ) +geompy.addToStudy( Cut_1, 'Cut_1' ) +geompy.addToStudy( ellipse1, 'ellipse1_pb' ) +geompy.Export(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1_pb.brep"), "BREP") + + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/src/Tools/blocFissure/materielCasTests/eprouvetteCourbe.py b/src/Tools/blocFissure/materielCasTests/eprouvetteCourbe.py new file mode 100644 index 000000000..7cbff0698 --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/eprouvetteCourbe.py @@ -0,0 +1,107 @@ +# -*- coding: iso-8859-1 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import salome_notebook +notebook = salome_notebook.notebook + +import os +from blocFissure import gmu + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New(theStudy) + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +Vertex_1 = geompy.MakeVertex(-2000, 0, 0) +Cylinder_1 = geompy.MakeCylinder(Vertex_1, OY, 1900, 300) +Cylinder_2 = geompy.MakeCylinder(Vertex_1, OY, 2100, 300) +Cut_1 = geompy.MakeCut(Cylinder_2, Cylinder_1) +Vertex_2 = geompy.MakeVertex(-500, -100, -300) +Vertex_3 = geompy.MakeVertex(500, 400, 300) +Box_1 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2) +Common_1 = geompy.MakeCommon(Box_1, Cut_1) +Vertex_4 = geompy.MakeVertex(-300, -1000, 0) +Cylinder_3 = geompy.MakeCylinder(Vertex_4, OX, 1100, 600) +EprouvetteCourbe = geompy.MakeCut(Common_1, Cylinder_3) +[Compound_y, Compound_z, Compound_x] = geompy.Propagate(EprouvetteCourbe) +geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0) +Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -110.000000 85.000000:T 220.000000 0.000000:T 0.000000 75.000000:T -220.000000 0.000000:WW", geomObj_1 ) +SectionDroite = geompy.MakeFaceWires([Sketch_1], 1) +geompy.Export(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"), "BREP") +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Vertex_1, 'Vertex_1' ) +geompy.addToStudy( Cylinder_1, 'Cylinder_1' ) +geompy.addToStudy( Cylinder_2, 'Cylinder_2' ) +geompy.addToStudy( Cut_1, 'Cut_1' ) +geompy.addToStudy( Vertex_2, 'Vertex_2' ) +geompy.addToStudy( Vertex_3, 'Vertex_3' ) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( Common_1, 'Common_1' ) +geompy.addToStudy( Cylinder_3, 'Cylinder_3' ) +geompy.addToStudy( Vertex_4, 'Vertex_4' ) +geompy.addToStudy( EprouvetteCourbe, 'EprouvetteCourbe' ) +geompy.addToStudy( Sketch_1, 'Sketch_1' ) +geompy.addToStudy( SectionDroite, 'SectionDroite' ) +geompy.addToStudyInFather( EprouvetteCourbe, Compound_y, 'Compound_y' ) +geompy.addToStudyInFather( EprouvetteCourbe, Compound_z, 'Compound_z' ) +geompy.addToStudyInFather( EprouvetteCourbe, Compound_x, 'Compound_x' ) + +### +### SMESH component +### + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New(theStudy) +from salome.StdMeshers import StdMeshersBuilder +EprouvetteCourbe_1 = smesh.Mesh(EprouvetteCourbe) +Regular_1D = EprouvetteCourbe_1.Segment() +Nb_Segments_1 = Regular_1D.NumberOfSegments(50) +Nb_Segments_1.SetDistrType( 0 ) +Quadrangle_2D = EprouvetteCourbe_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) +Hexa_3D = EprouvetteCourbe_1.Hexahedron(algo=smeshBuilder.Hexa) +Regular_1D_1 = EprouvetteCourbe_1.Segment(geom=Compound_x) +Nb_Segments_2 = Regular_1D_1.NumberOfSegments(15) +Nb_Segments_2.SetDistrType( 0 ) +Regular_1D_2 = EprouvetteCourbe_1.Segment(geom=Compound_y) +Nb_Segments_3 = Regular_1D_2.NumberOfSegments(25) +Nb_Segments_3.SetDistrType( 0 ) +isDone = EprouvetteCourbe_1.Compute() +smesh.SetName(EprouvetteCourbe_1, 'EprouvetteCourbe') +EprouvetteCourbe_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbe.med"), 0, SMESH.MED_V2_2, 1 ) +SubMesh_1 = Regular_1D_1.GetSubMesh() +SubMesh_2 = Regular_1D_2.GetSubMesh() + +## set object names +smesh.SetName(EprouvetteCourbe_1.GetMesh(), 'EprouvetteCourbe') +smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') +smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') +smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') +smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') +smesh.SetName(Nb_Segments_2, 'Nb. Segments_2') +smesh.SetName(Nb_Segments_3, 'Nb. Segments_3') +smesh.SetName(SubMesh_1, 'SubMesh_1') +smesh.SetName(SubMesh_2, 'SubMesh_2') + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/src/Tools/blocFissure/materielCasTests/eprouvetteDroite.py b/src/Tools/blocFissure/materielCasTests/eprouvetteDroite.py new file mode 100644 index 000000000..0a70a2685 --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/eprouvetteDroite.py @@ -0,0 +1,142 @@ +# -*- coding: iso-8859-1 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import salome_notebook +notebook = salome_notebook.NoteBook(theStudy) + +import os +from blocFissure import gmu + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New(theStudy) + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +eprouvetteDroite = geompy.MakeBoxDXDYDZ(100, 200, 500) +[Compound_z, Compound_y, Compound_x] = geompy.Propagate(eprouvetteDroite) + +Vertex_1 = geompy.MakeVertex(-10, -10, 200) +geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0) +Plane_1 = geompy.MakePlane(Vertex_1, OZ, 2000) +geomObj_2 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0) +Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F 0.000000 0.000000:TT 120.000000 0.000000:T 0.000000 100.000000:T -120.000000 0.000000:WW", Plane_1 ) +sectionDroite = geompy.MakeFaceWires([Sketch_1], 1) +Box_1_vertex_7 = geompy.GetSubShape(eprouvetteDroite, [7]) +Box_1_vertex_16 = geompy.GetSubShape(eprouvetteDroite, [16]) +Line_1 = geompy.MakeLineTwoPnt(Box_1_vertex_7, Box_1_vertex_16) +geomObj_3 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0) +Plane_2 = geompy.MakePlane(Vertex_1, Line_1, 2000) +geomObj_4 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0) +Sketch_2 = geompy.MakeSketcherOnPlane("Sketcher:F 0.000000 0.000000:T 120.000000 0.000000:T 0.000000 100.000000:T -120.000000 20.000000:WW", Plane_2 ) +SectionInclinee = geompy.MakeFaceWires([Sketch_2], 1) +geompy.Export(sectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFissPb1.brep"), "BREP") +geompy.Export(SectionInclinee, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss2.brep"), "BREP") +Vertex_2 = geompy.MakeVertex(110, -10, 200) +Vertex_3 = geompy.MakeVertex(110, 80, 200) +Vertex_4 = geompy.MakeVertex(-10, 80, 200) +Line_2 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2) +Line_3 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3) +Line_4 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_4) +Line_5 = geompy.MakeLineTwoPnt(Vertex_4, Vertex_1) +Face_1 = geompy.MakeFaceWires([Line_2, Line_3, Line_4, Line_5], 1) +Vertex_5 = geompy.MakeVertex(110, -10, 180) +Vertex_6 = geompy.MakeVertex(110, 70, 180) +Face_1_vertex_4 = geompy.GetSubShape(Face_1, [4]) +Line_6 = geompy.MakeLineTwoPnt(Face_1_vertex_4, Vertex_5) +Line_7 = geompy.MakeLineTwoPnt(Vertex_5, Vertex_6) +Face_1_vertex_9 = geompy.GetSubShape(Face_1, [9]) +Line_8 = geompy.MakeLineTwoPnt(Vertex_6, Face_1_vertex_9) +Face_2 = geompy.MakeFaceWires([Line_5, Line_6, Line_7, Line_8], 1) +geompy.Export(Face_1, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_1.brep"), "BREP") +geompy.Export(Face_2, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_2.brep"), "BREP") +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( eprouvetteDroite, 'eprouvetteDroite' ) +geompy.addToStudyInFather( eprouvetteDroite, Compound_z, 'Compound_z' ) +geompy.addToStudyInFather( eprouvetteDroite, Compound_y, 'Compound_y' ) +geompy.addToStudyInFather( eprouvetteDroite, Compound_x, 'Compound_x' ) +geompy.addToStudy( Vertex_1, 'Vertex_1' ) +geompy.addToStudy( Plane_1, 'Plane_1' ) +geompy.addToStudy( Sketch_1, 'Sketch_1' ) +geompy.addToStudy( sectionDroite, 'sectionDroite' ) +geompy.addToStudyInFather( eprouvetteDroite, Box_1_vertex_7, 'Box_1:vertex_7' ) +geompy.addToStudyInFather( eprouvetteDroite, Box_1_vertex_16, 'Box_1:vertex_16' ) +geompy.addToStudy( Line_1, 'Line_1' ) +geompy.addToStudy( Plane_2, 'Plane_2' ) +geompy.addToStudy( Sketch_2, 'Sketch_2' ) +geompy.addToStudy( SectionInclinee, 'SectionInclinee' ) +geompy.addToStudy( Vertex_2, 'Vertex_2' ) +geompy.addToStudy( Vertex_3, 'Vertex_3' ) +geompy.addToStudy( Vertex_4, 'Vertex_4' ) +geompy.addToStudy( Line_2, 'Line_2' ) +geompy.addToStudy( Line_3, 'Line_3' ) +geompy.addToStudy( Line_4, 'Line_4' ) +geompy.addToStudy( Line_5, 'Line_5' ) +geompy.addToStudy( Face_1, 'Face_1' ) +geompy.addToStudy( Vertex_5, 'Vertex_5' ) +geompy.addToStudy( Vertex_6, 'Vertex_6' ) +geompy.addToStudyInFather( Face_1, Face_1_vertex_4, 'Face_1:vertex_4' ) +geompy.addToStudy( Line_6, 'Line_6' ) +geompy.addToStudy( Line_7, 'Line_7' ) +geompy.addToStudyInFather( Face_1, Face_1_vertex_9, 'Face_1:vertex_9' ) +geompy.addToStudy( Line_8, 'Line_8' ) +geompy.addToStudy( Face_2, 'Face_2' ) + +### +### SMESH component +### + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New(theStudy) +from salome.StdMeshers import StdMeshersBuilder +eprouvetteDroite_1 = smesh.Mesh(eprouvetteDroite) +Regular_1D = eprouvetteDroite_1.Segment() +Nb_Segments_1 = Regular_1D.NumberOfSegments(50,[],[ ]) +Nb_Segments_1.SetDistrType( 0 ) +Quadrangle_2D = eprouvetteDroite_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) +Hexa_3D = eprouvetteDroite_1.Hexahedron(algo=smeshBuilder.Hexa) +Regular_1D_1 = eprouvetteDroite_1.Segment(geom=Compound_y) +Nb_Segments_2 = Regular_1D_1.NumberOfSegments(20,[],[ ]) +Nb_Segments_2.SetDistrType( 0 ) +Regular_1D_2 = eprouvetteDroite_1.Segment(geom=Compound_x) +Nb_Segments_3 = Regular_1D_2.NumberOfSegments(10,[],[ ]) +Nb_Segments_3.SetDistrType( 0 ) +isDone = eprouvetteDroite_1.Compute() +smesh.SetName(eprouvetteDroite_1, 'eprouvetteDroite') +eprouvetteDroite_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/eprouvetteDroite.med"), 0, SMESH.MED_V2_2, 1 ) +SubMesh_1 = Regular_1D_1.GetSubMesh() +SubMesh_2 = Regular_1D_2.GetSubMesh() + +## set object names +smesh.SetName(eprouvetteDroite_1.GetMesh(), 'eprouvetteDroite') +smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') +smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') +smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') +smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') +smesh.SetName(Nb_Segments_2, 'Nb. Segments_2') +smesh.SetName(Nb_Segments_3, 'Nb. Segments_3') +smesh.SetName(SubMesh_1, 'SubMesh_1') +smesh.SetName(SubMesh_2, 'SubMesh_2') + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/src/Tools/blocFissure/materielCasTests/fissureGauche.py b/src/Tools/blocFissure/materielCasTests/fissureGauche.py new file mode 100644 index 000000000..b378fa587 --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/fissureGauche.py @@ -0,0 +1,136 @@ +# -*- coding: iso-8859-1 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import salome_notebook +notebook = salome_notebook.notebook + +import os +from blocFissure import gmu + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New(theStudy) + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +geomObj_1 = geompy.MakeCylinderRH(1000, 3000) +Cylinder_1 = geompy.MakeRotation(geomObj_1, OZ, 180*math.pi/180.0) +geomObj_2 = geompy.MakeCylinder(O, OX, 2000, 5000) +Cylinder_2 = geompy.MakeRotation(geomObj_2, OX, 180*math.pi/180.0) +Translation_1 = geompy.MakeTranslation(Cylinder_2, -2000, 0, 0) +Fuse_1 = geompy.MakeFuse(Cylinder_1, Translation_1) +Fillet_1 = geompy.MakeFillet(Fuse_1, 800, geompy.ShapeType["EDGE"], [11]) +Vertex_1 = geompy.MakeVertex(0, -3000, -3000) +Vertex_2 = geompy.MakeVertex(2500, 3000, 3000) +Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_1) +Partition_1 = geompy.MakePartition([Box_1], [Fillet_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0) +geomObj_3 = geompy.MakeCylinderRH(1450, 8000) +Cylinder_3 = geompy.MakeRotation(geomObj_3, OZ, 180*math.pi/180.0) +Cut_1 = geompy.MakeCut(Partition_1, Cylinder_3) +[faceFiss1] = geompy.SubShapes(Cut_1, [61]) +[Vertex_3,geomObj_4] = geompy.SubShapes(faceFiss1, [4, 5]) +Cylinder_4 = geompy.MakeCylinderRH(2000, 4000) +Cylinder_5 = geompy.MakeCylinderRH(1500, 4000) +Cut_2 = geompy.MakeCut(Cylinder_4, Cylinder_5) +Plane_1 = geompy.MakePlaneLCS(None, 10000, 3) +Vertex_5 = geompy.MakeVertex(0, 0, 100) +Plane_2 = geompy.MakePlaneThreePnt(O, Vertex_5, Vertex_3, 10000) +Plane_3 = geompy.MakePlaneThreePnt(O, Vertex_5, geomObj_4, 10000) +Vertex_6 = geompy.MakeVertex(0, -5000, -5000) +Vertex_7 = geompy.MakeVertex(5000, 5000, 5000) +Box_2 = geompy.MakeBoxTwoPnt(Vertex_7, Vertex_6) +Common_1 = geompy.MakeCommon(Box_2, Cut_2) +objetSain = geompy.MakePartition([Common_1], [Plane_1, Plane_2, Plane_3], [], [], geompy.ShapeType["SOLID"], 0, [], 0) +[hauteurs, epaisseurs, Compound_3, Compound_4, Compound_5, Compound_6] = geompy.Propagate(objetSain) +geompy.Export(faceFiss1, os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheFiss.brep"), "BREP") +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Cylinder_1, 'Cylinder_1' ) +geompy.addToStudy( Cylinder_2, 'Cylinder_2' ) +geompy.addToStudy( Translation_1, 'Translation_1' ) +geompy.addToStudy( Fuse_1, 'Fuse_1' ) +geompy.addToStudy( Fillet_1, 'Fillet_1' ) +geompy.addToStudy( Vertex_1, 'Vertex_1' ) +geompy.addToStudy( Vertex_2, 'Vertex_2' ) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( Partition_1, 'Partition_1' ) +geompy.addToStudy( Cylinder_3, 'Cylinder_3' ) +geompy.addToStudy( Cut_1, 'Cut_1' ) +geompy.addToStudyInFather( Cut_1, faceFiss1, 'faceFiss1' ) +geompy.addToStudyInFather( faceFiss1, Vertex_3, 'Vertex_3' ) +geompy.addToStudy( Cylinder_4, 'Cylinder_4' ) +geompy.addToStudy( Cylinder_5, 'Cylinder_5' ) +geompy.addToStudy( Cut_2, 'Cut_2' ) +geompy.addToStudy( Plane_1, 'Plane_1' ) +geompy.addToStudy( Vertex_5, 'Vertex_5' ) +geompy.addToStudy( Plane_2, 'Plane_2' ) +geompy.addToStudy( Plane_3, 'Plane_3' ) +geompy.addToStudy( Vertex_6, 'Vertex_6' ) +geompy.addToStudy( Vertex_7, 'Vertex_7' ) +geompy.addToStudy( Box_2, 'Box_2' ) +geompy.addToStudy( Common_1, 'Common_1' ) +geompy.addToStudy( objetSain, 'objetSain' ) +geompy.addToStudyInFather( objetSain, hauteurs, 'hauteurs' ) +geompy.addToStudyInFather( objetSain, epaisseurs, 'epaisseurs' ) +geompy.addToStudyInFather( objetSain, Compound_3, 'Compound_3' ) +geompy.addToStudyInFather( objetSain, Compound_4, 'Compound_4' ) +geompy.addToStudyInFather( objetSain, Compound_5, 'Compound_5' ) +geompy.addToStudyInFather( objetSain, Compound_6, 'Compound_6' ) + +### +### SMESH component +### + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New(theStudy) +from salome.StdMeshers import StdMeshersBuilder +objetSain_1 = smesh.Mesh(objetSain) +Regular_1D = objetSain_1.Segment() +Nb_Segments_1 = Regular_1D.NumberOfSegments(10,[],[ ]) +Nb_Segments_1.SetDistrType( 0 ) +Quadrangle_2D = objetSain_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) +Hexa_3D = objetSain_1.Hexahedron(algo=smeshBuilder.Hexa) +Regular_1D_1 = objetSain_1.Segment(geom=hauteurs) +Nb_Segments_2 = Regular_1D_1.NumberOfSegments(15,[],[ ]) +Nb_Segments_2.SetDistrType( 0 ) +Regular_1D_2 = objetSain_1.Segment(geom=epaisseurs) +Nb_Segments_3 = Regular_1D_2.NumberOfSegments(5,[],[ ]) +Nb_Segments_3.SetDistrType( 0 ) +isDone = objetSain_1.Compute() +smesh.SetName(objetSain_1, 'objetSain') +objetSain_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheSain.med"), 0, SMESH.MED_V2_2, 1 ) +SubMesh_1 = Regular_1D_1.GetSubMesh() +SubMesh_2 = Regular_1D_2.GetSubMesh() + +## set object names +smesh.SetName(objetSain_1.GetMesh(), 'objetSain') +smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') +smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') +smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') +smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') +smesh.SetName(Nb_Segments_2, 'Nb. Segments_2') +smesh.SetName(Nb_Segments_3, 'Nb. Segments_3') +smesh.SetName(SubMesh_1, 'SubMesh_1') +smesh.SetName(SubMesh_2, 'SubMesh_2') + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/src/Tools/blocFissure/materielCasTests/fissureGauche2.py b/src/Tools/blocFissure/materielCasTests/fissureGauche2.py new file mode 100644 index 000000000..431668130 --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/fissureGauche2.py @@ -0,0 +1,98 @@ +# -*- coding: iso-8859-1 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import salome_notebook +notebook = salome_notebook.notebook + +import os +from blocFissure import gmu + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New(theStudy) + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +Circle_1 = geompy.MakeCircle(O, OX, 500) +Extrusion_1 = geompy.MakePrismVecH2Ways(Circle_1, OX, 500) +Vertex_1 = geompy.MakeVertex(500, 0, 0) +Circle_3 = geompy.MakeCircle(Vertex_1, OZ, 300) +Extrusion_2 = geompy.MakePrismVecH(Circle_3, OZ, 1000) +Partition_1 = geompy.MakePartition([Extrusion_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0) +[Face_1,Face_2] = geompy.SubShapes(Partition_1, [18, 13]) +FaceFissExt = geompy.MakeFuse(Face_2, Face_1) +geompy.Export(FaceFissExt, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2Fiss.brep"), "BREP") +Vertex_2 = geompy.MakeVertex(0, -500, 0) +Vertex_3 = geompy.MakeVertex(400, 500, 800) +objetSain = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2) +Rotation_1 = geompy.MakeRotation(Extrusion_1, OX, 180*math.pi/180.0) +Partition_2 = geompy.MakePartition([Rotation_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0) +[FaceFissExtSimple] = geompy.SubShapes(Partition_2, [13]) +Plane_1 = geompy.MakePlaneLCS(None, 2000, 3) +FaceFissExtCoupe = geompy.MakePartition([FaceFissExtSimple], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0) +geompy.Export(FaceFissExtCoupe, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"), "BREP") +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Circle_1, 'Circle_1' ) +geompy.addToStudy( Extrusion_1, 'Extrusion_1' ) +geompy.addToStudy( Vertex_1, 'Vertex_1' ) +geompy.addToStudy( Circle_3, 'Circle_3' ) +geompy.addToStudy( Extrusion_2, 'Extrusion_2' ) +geompy.addToStudy( Partition_1, 'Partition_1' ) +geompy.addToStudyInFather( Partition_1, Face_1, 'Face_1' ) +geompy.addToStudyInFather( Partition_1, Face_2, 'Face_2' ) +geompy.addToStudy( FaceFissExt, 'FaceFissExt' ) +geompy.addToStudy( Vertex_2, 'Vertex_2' ) +geompy.addToStudy( Vertex_3, 'Vertex_3' ) +geompy.addToStudy( objetSain, 'objetSain' ) +geompy.addToStudy( Rotation_1, 'Rotation_1' ) +geompy.addToStudy( Partition_2, 'Partition_2' ) +geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' ) +geompy.addToStudy( Plane_1, 'Plane_1' ) +geompy.addToStudy( FaceFissExtCoupe, 'FaceFissExtCoupe' ) + +### +### SMESH component +### + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New(theStudy) +from salome.StdMeshers import StdMeshersBuilder +Mesh_1 = smesh.Mesh(objetSain) +Regular_1D = Mesh_1.Segment() +Nb_Segments_1 = Regular_1D.NumberOfSegments(15,[],[ ]) +Nb_Segments_1.SetDistrType( 0 ) +Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) +Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa) +isDone = Mesh_1.Compute() +smesh.SetName(Mesh_1, 'Mesh_1') +Mesh_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/boiteSaine.med"), 0, SMESH.MED_V2_2, 1 ) + +## set object names +smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1') +smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') +smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') +smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') +smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/src/Tools/blocFissure/materielCasTests/genereMateriel.py b/src/Tools/blocFissure/materielCasTests/genereMateriel.py new file mode 100644 index 000000000..919b2a16a --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/genereMateriel.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from blocFissure.materielCasTests import cubeAngle +from blocFissure.materielCasTests import decoupeCylindre +from blocFissure.materielCasTests import eprouvetteCourbe +from blocFissure.materielCasTests import eprouvetteDroite +from blocFissure.materielCasTests import fissureGauche +from blocFissure.materielCasTests import fissureGauche2 +from blocFissure.materielCasTests import ellipse +from blocFissure.materielCasTests import ellipse_probleme +from blocFissure.materielCasTests import disque_perce +from blocFissure.materielCasTests import ellipse_disque +from blocFissure.materielCasTests import vis diff --git a/src/Tools/blocFissure/materielCasTests/vis.py b/src/Tools/blocFissure/materielCasTests/vis.py new file mode 100644 index 000000000..1819a56f7 --- /dev/null +++ b/src/Tools/blocFissure/materielCasTests/vis.py @@ -0,0 +1,273 @@ +# -*- coding: iso-8859-1 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import salome_notebook +notebook = salome_notebook.notebook + +import os +from blocFissure import gmu + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New(theStudy) +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0) +geomObj_2 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0) +sk = geompy.Sketcher2D() +sk.addPoint(0.000000, 0.000000) +sk.addSegmentAbsolute(10.000000, 0.000000) +sk.addSegmentAbsolute(10.000000, 98.750000) +sk.addArcAngleRadiusLength(0, -1.250000, 90.000000) +sk.addSegmentAbsolute(15.000000, 100.000000) +sk.addSegmentAbsolute(15.000000, 120.000000) +sk.addSegmentAbsolute(9.945000, 120.000000) +sk.addSegmentAbsolute(9.945000, 108.000000) +sk.addSegmentAbsolute(0.000000, 105.000000) +sk.close() +Sketch_1 = sk.wire(geomObj_2) +Face_1 = geompy.MakeFaceWires([Sketch_1], 1) +Vertex_1 = geompy.MakeVertex(15, 108, 0) +Vertex_2 = geompy.MakeVertex(0, 94, 0) +Vertex_3 = geompy.MakeVertex(10, 94, 0) +Face_1_vertex_17 = geompy.GetSubShape(Face_1, [17]) +Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Face_1_vertex_17) +Face_1_vertex_9 = geompy.GetSubShape(Face_1, [9]) +Line_2 = geompy.MakeLineTwoPnt(Face_1_vertex_17, Face_1_vertex_9) +Face_1_vertex_19 = geompy.GetSubShape(Face_1, [19]) +Face_1_vertex_7 = geompy.GetSubShape(Face_1, [7]) +Line_3 = geompy.MakeLineTwoPnt(Face_1_vertex_19, Face_1_vertex_7) +Line_4 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3) +coupe_vis = geompy.MakePartition([Face_1], [Line_1, Line_2, Line_3, Line_4], [], [], geompy.ShapeType["FACE"], 0, [], 0) +[tige, section, tige_haute, rond, tete, section_tete] = geompy.Propagate(coupe_vis) +conge = geompy.CreateGroup(coupe_vis, geompy.ShapeType["EDGE"]) +geompy.UnionIDs(conge, [21]) +appui = geompy.CreateGroup(coupe_vis, geompy.ShapeType["EDGE"]) +geompy.UnionIDs(appui, [37]) +p_imp = geompy.CreateGroup(coupe_vis, geompy.ShapeType["EDGE"]) +geompy.UnionIDs(p_imp, [4]) + +Vertex_4 = geompy.MakeVertex(11.25, 98.75, 0) +Vertex_5 = geompy.MakeVertexWithRef(Vertex_4, -0.5, 0.5, 0) +Vertex_6 = geompy.MakeVertexWithRef(Vertex_4, -5, 5, 0) +Line_5 = geompy.MakeLineTwoPnt(Vertex_5, Vertex_6) +Partition_1 = geompy.MakePartition([Line_5], [conge], [], [], geompy.ShapeType["EDGE"], 0, [], 1) +[Vertex_7] = geompy.SubShapes(Partition_1, [4]) +Vertex_8 = geompy.MakeVertexWithRef(Vertex_7, -1.1, 1.1, 0) +generatrice = geompy.MakeLineTwoPnt(Vertex_5, Vertex_8) +Revolution_1 = geompy.MakeRevolution2Ways(generatrice, OY, 60*math.pi/180.0) +Partition_2 = geompy.MakePartition([Revolution_1], [conge], [], [], geompy.ShapeType["FACE"], 0, [], 1) +Partition_2_vertex_11 = geompy.GetSubShape(Partition_2, [11]) +Plane_1 = geompy.MakePlane(Partition_2_vertex_11, OY, 2000) +Partition_3 = geompy.MakePartition([Revolution_1], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0) +Vertex_9 = geompy.MakeVertex(0, 99.633883, 8.977320000000001) +Vertex_10 = geompy.MakeVertex(0, 99.633883, -8.977320000000001) +Vertex_11 = geompy.MakeVertexWithRef(Vertex_9, 0, 0, -1) +Vertex11x = geompy.MakeVertexWithRef(Vertex_11, 1, 0, 0) +Line_11x = geompy.MakeLineTwoPnt(Vertex_11, Vertex11x) +Vertex_12 = geompy.MakeVertexWithRef(Vertex_10, 0, 0, 1) +Vertex12x = geompy.MakeVertexWithRef(Vertex_12, 1, 0, 0) +Line_12x = geompy.MakeLineTwoPnt(Vertex_12, Vertex12x) +Vertex_13 = geompy.MakeVertexWithRef(Vertex_11, 0, 1, 0) +Vertex_14 = geompy.MakeVertexWithRef(Vertex_12, 0, 1, 0) +Vertex_15 = geompy.MakeRotation(Vertex_9, Line_11x, 30*math.pi/180.0) +Vertex_16 = geompy.MakeRotation(Vertex_10, Line_12x, -30*math.pi/180.0) +Arc_1 = geompy.MakeArc(Vertex_15, Vertex_9, Vertex_13,False) +Arc_2 = geompy.MakeArc(Vertex_14, Vertex_10, Vertex_16,False) +Line_6 = geompy.MakeLineTwoPnt(Vertex_13, Vertex_14) +Line_8 = geompy.MakeLineTwoPnt(Vertex_16, Vertex_15) +Wire_1 = geompy.MakeWire([Arc_1, Arc_2, Line_6, Line_8], 1e-07) +Face_2 = geompy.MakeFaceWires([Wire_1], 1) +Extrusion_1 = geompy.MakePrismVecH(Face_2, OX, 15) +Revolution_2 = geompy.MakeRevolution2Ways(generatrice, OY, 65*math.pi/180.0) +Fissure = geompy.MakeCommonList([Extrusion_1, Revolution_2], True) +fondFiss = geompy.CreateGroup(Fissure, geompy.ShapeType["EDGE"]) +geompy.UnionIDs(fondFiss, [9, 7, 4]) +geompy.Export(Fissure, os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"), "BREP") + +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Sketch_1, 'Sketch_1' ) +geompy.addToStudy( Face_1, 'Face_1' ) +geompy.addToStudy( Vertex_1, 'Vertex_1' ) +geompy.addToStudy( Vertex_2, 'Vertex_2' ) +geompy.addToStudy( Vertex_3, 'Vertex_3' ) +geompy.addToStudyInFather( Face_1, Face_1_vertex_17, 'Face_1:vertex_17' ) +geompy.addToStudy( Line_1, 'Line_1' ) +geompy.addToStudyInFather( Face_1, Face_1_vertex_9, 'Face_1:vertex_9' ) +geompy.addToStudy( Line_2, 'Line_2' ) +geompy.addToStudyInFather( Face_1, Face_1_vertex_19, 'Face_1:vertex_19' ) +geompy.addToStudyInFather( Face_1, Face_1_vertex_7, 'Face_1:vertex_7' ) +geompy.addToStudy( Line_3, 'Line_3' ) +geompy.addToStudy( Line_4, 'Line_4' ) +geompy.addToStudy( coupe_vis, 'coupe_vis' ) +geompy.addToStudyInFather( coupe_vis, tige, 'tige' ) +geompy.addToStudyInFather( coupe_vis, section, 'section' ) +geompy.addToStudyInFather( coupe_vis, tige_haute, 'tige_haute' ) +geompy.addToStudyInFather( coupe_vis, rond, 'rond' ) +geompy.addToStudyInFather( coupe_vis, tete, 'tete' ) +geompy.addToStudyInFather( coupe_vis, section_tete, 'section_tete' ) +geompy.addToStudyInFather( coupe_vis, conge, 'conge' ) +geompy.addToStudyInFather( coupe_vis, appui, 'appui' ) +geompy.addToStudyInFather( coupe_vis, p_imp, 'p_imp' ) + +geompy.addToStudy( Vertex_4, 'Vertex_4' ) +geompy.addToStudy( Vertex_6, 'Vertex_6' ) +geompy.addToStudy( Vertex_5, 'Vertex_5' ) +geompy.addToStudy( Line_5, 'Line_5' ) +geompy.addToStudy( Partition_1, 'Partition_1' ) +geompy.addToStudyInFather( Partition_1, Vertex_7, 'Vertex_7' ) +geompy.addToStudy( Vertex_8, 'Vertex_8' ) +geompy.addToStudy( generatrice, 'generatrice' ) +geompy.addToStudy( Revolution_1, 'Revolution_1' ) +geompy.addToStudy( Partition_2, 'Partition_2' ) +geompy.addToStudyInFather( Partition_2, Partition_2_vertex_11, 'Partition_2:vertex_11' ) +geompy.addToStudy( Plane_1, 'Plane_1' ) +geompy.addToStudy( Partition_3, 'Partition_3' ) +geompy.addToStudy( Vertex_9, 'Vertex_9' ) +geompy.addToStudy( Vertex_10, 'Vertex_10' ) +geompy.addToStudy( Vertex_11, 'Vertex_11' ) +geompy.addToStudy( Vertex_12, 'Vertex_12' ) +geompy.addToStudy( Vertex_13, 'Vertex_13' ) +geompy.addToStudy( Vertex_14, 'Vertex_14' ) +geompy.addToStudy( Vertex_15, 'Vertex_15' ) +geompy.addToStudy( Vertex_16, 'Vertex_16' ) +geompy.addToStudy( Arc_1, 'Arc_1' ) +geompy.addToStudy( Arc_2, 'Arc_2' ) +geompy.addToStudy( Line_6, 'Line_6' ) +geompy.addToStudy( Line_8, 'Line_8' ) +geompy.addToStudy( Wire_1, 'Wire_1' ) +geompy.addToStudy( Face_2, 'Face_2' ) +geompy.addToStudy( Extrusion_1, 'Extrusion_1' ) +geompy.addToStudy( Revolution_2, 'Revolution_2' ) +geompy.addToStudy( Fissure, 'Fissure' ) +geompy.addToStudyInFather( Fissure, fondFiss, 'fondFiss' ) + +### +### SMESH component +### + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New(theStudy) +coupe_vis_1 = smesh.Mesh(coupe_vis) +Regular_1D = coupe_vis_1.Segment() +Nb_Segments_1 = Regular_1D.NumberOfSegments(10) +Nb_Segments_1.SetDistrType( 0 ) +Quadrangle_2D = coupe_vis_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) +isDone = coupe_vis_1.Compute() +Nb_Segments_2 = smesh.CreateHypothesis('NumberOfSegments') +Nb_Segments_2.SetNumberOfSegments( 30 ) +Nb_Segments_2.SetDistrType( 0 ) +status = coupe_vis_1.AddHypothesis(Regular_1D,tige) +status = coupe_vis_1.AddHypothesis(Nb_Segments_2,tige) +isDone = coupe_vis_1.Compute() +Nb_Segments_3 = smesh.CreateHypothesis('NumberOfSegments') +Nb_Segments_3.SetNumberOfSegments( 10 ) +Nb_Segments_3.SetScaleFactor( 3 ) +Nb_Segments_3.SetReversedEdges( [ ] ) +Nb_Segments_3.SetObjectEntry( "0:1:1:14" ) +status = coupe_vis_1.AddHypothesis(Regular_1D,section) +status = coupe_vis_1.AddHypothesis(Nb_Segments_3,section) +coupe_vis_1.Clear() +isDone = coupe_vis_1.Compute() +coupe_vis_1.Clear() +Nb_Segments_3.SetNumberOfSegments( 10 ) +Nb_Segments_3.SetDistrType( 1 ) +Nb_Segments_3.SetScaleFactor( 3 ) +Nb_Segments_3.SetReversedEdges( [ 23, 4, 9, 16 ] ) +Nb_Segments_3.SetObjectEntry( "0:1:1:14" ) +isDone = coupe_vis_1.Compute() +tige_1 = coupe_vis_1.GroupOnGeom(tige,'tige',SMESH.EDGE) +section_1 = coupe_vis_1.GroupOnGeom(section,'section',SMESH.EDGE) +tige_haute_1 = coupe_vis_1.GroupOnGeom(tige_haute,'tige_haute',SMESH.EDGE) +rond_1 = coupe_vis_1.GroupOnGeom(rond,'rond',SMESH.EDGE) +tete_1 = coupe_vis_1.GroupOnGeom(tete,'tete',SMESH.EDGE) +section_tete_1 = coupe_vis_1.GroupOnGeom(section_tete,'section_tete',SMESH.EDGE) +conge_1 = coupe_vis_1.GroupOnGeom(conge,'conge',SMESH.EDGE) +appui_1 = coupe_vis_1.GroupOnGeom(appui,'appui',SMESH.EDGE) +p_imp_1 = coupe_vis_1.GroupOnGeom(p_imp,'p_imp',SMESH.EDGE) +isDone = coupe_vis_1.SplitQuad( [ 691 ], 1 ) +visHex80 = smesh.CopyMesh( coupe_vis_1, 'visHex80', 1, 0) +[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2 ] = visHex80.GetGroups() +[ tige_rotated, section_rotated, tige_haute_rotated, rond_rotated, tete_rotated, section_tete_rotated, conge_rotated, appui_rotated, p_imp_rotated, tige_top, section_top, tige_haute_top, rond_top, tete_top, section_tete_top, conge_top, appui_top, p_imp_top ] = visHex80.RotationSweepObject2D( visHex80, SMESH.AxisStruct( 0, 0, 0, 0, 10, 0 ), math.pi/40, 40, 1e-05 ,True) +[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top ] = visHex80.GetGroups() +[ tige_mirrored, section_mirrored, tige_haute_mirrored, rond_mirrored, tete_mirrored, section_tete_mirrored, conge_mirrored, appui_mirrored, p_imp_mirrored, tige_rotated_mirrored, tige_top_mirrored, section_rotated_mirrored, section_top_mirrored, tige_haute_rotated_mirrored, tige_haute_top_mirrored, rond_rotated_mirrored, rond_top_mirrored, tete_rotated_mirrored, tete_top_mirrored, section_tete_rotated_mirrored, section_tete_top_mirrored, conge_rotated_mirrored, conge_top_mirrored, appui_rotated_mirrored, appui_top_mirrored, p_imp_rotated_mirrored, p_imp_top_mirrored ] = visHex80.MirrorObject( visHex80, SMESH.AxisStruct( 0, 0, 0, 0, 0, 10 ), SMESH.SMESH_MeshEditor.PLANE ,True,True) +[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top, tige_mirrored, section_mirrored, tige_haute_mirrored, rond_mirrored, tete_mirrored, section_tete_mirrored, conge_mirrored, appui_mirrored, p_imp_mirrored, tige_rotated_mirrored, tige_top_mirrored, section_rotated_mirrored, section_top_mirrored, tige_haute_rotated_mirrored, tige_haute_top_mirrored, rond_rotated_mirrored, rond_top_mirrored, tete_rotated_mirrored, tete_top_mirrored, section_tete_rotated_mirrored, section_tete_top_mirrored, conge_rotated_mirrored, conge_top_mirrored, appui_rotated_mirrored, appui_top_mirrored, p_imp_rotated_mirrored, p_imp_top_mirrored ] = visHex80.GetGroups() +coincident_nodes_on_part = visHex80.FindCoincidentNodesOnPart( visHex80, 1e-05, [ ] ) +visHex80.MergeNodes(coincident_nodes_on_part) +equal_elements = visHex80.FindEqualElements( visHex80 ) +visHex80.MergeElements(equal_elements) +[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top, tige_mirrored, section_mirrored, tige_haute_mirrored, rond_mirrored, tete_mirrored, section_tete_mirrored, conge_mirrored, appui_mirrored, p_imp_mirrored, tige_rotated_mirrored, tige_top_mirrored, section_rotated_mirrored, section_top_mirrored, tige_haute_rotated_mirrored, tige_haute_top_mirrored, rond_rotated_mirrored, rond_top_mirrored, tete_rotated_mirrored, tete_top_mirrored, section_tete_rotated_mirrored, section_tete_top_mirrored, conge_rotated_mirrored, conge_top_mirrored, appui_rotated_mirrored, appui_top_mirrored, p_imp_rotated_mirrored, p_imp_top_mirrored ] = visHex80.GetGroups() +SubMesh_1 = coupe_vis_1.GetSubMesh( tige, 'SubMesh_1' ) +SubMesh_2 = coupe_vis_1.GetSubMesh( section, 'SubMesh_2' ) +visHex80.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/visSain.med"), 0, SMESH.MED_V2_2, 1 ) + + +## Set names of Mesh objects +smesh.SetName(appui_rotated, 'appui_rotated') +smesh.SetName(p_imp_rotated, 'p_imp_rotated') +smesh.SetName(section_tete_rotated, 'section_tete_rotated') +smesh.SetName(conge_rotated, 'conge_rotated') +smesh.SetName(rond_rotated, 'rond_rotated') +smesh.SetName(tete_rotated, 'tete_rotated') +smesh.SetName(section_rotated, 'section_rotated') +smesh.SetName(tige_haute_rotated, 'tige_haute_rotated') +smesh.SetName(tige_rotated, 'tige_rotated') +smesh.SetName(SubMesh_2, 'SubMesh_2') +smesh.SetName(SubMesh_1, 'SubMesh_1') +smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') +smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') +smesh.SetName(appui_1, 'appui') +smesh.SetName(p_imp_1, 'p_imp') +smesh.SetName(coupe_vis_1.GetMesh(), 'coupe_vis') +smesh.SetName(visHex80.GetMesh(), 'visHex80') +smesh.SetName(tige_1, 'tige') +smesh.SetName(p_imp_2, 'p_imp') +smesh.SetName(section_1, 'section') +smesh.SetName(appui_2, 'appui') +smesh.SetName(tige_haute_1, 'tige_haute') +smesh.SetName(conge_2, 'conge') +smesh.SetName(rond_1, 'rond') +smesh.SetName(section_tete_2, 'section_tete') +smesh.SetName(tete_1, 'tete') +smesh.SetName(tete_2, 'tete') +smesh.SetName(section_tete_1, 'section_tete') +smesh.SetName(rond_2, 'rond') +smesh.SetName(conge_1, 'conge') +smesh.SetName(tige_haute_2, 'tige_haute') +smesh.SetName(section_2, 'section') +smesh.SetName(tige_2, 'tige') +smesh.SetName(p_imp_top, 'p_imp_top') +smesh.SetName(Nb_Segments_3, 'Nb. Segments_3') +smesh.SetName(conge_top, 'conge_top') +smesh.SetName(Nb_Segments_2, 'Nb. Segments_2') +smesh.SetName(appui_top, 'appui_top') +smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') +smesh.SetName(tete_top, 'tete_top') +smesh.SetName(section_tete_top, 'section_tete_top') +smesh.SetName(tige_haute_top, 'tige_haute_top') +smesh.SetName(rond_top, 'rond_top') +smesh.SetName(tige_top, 'tige_top') +smesh.SetName(section_top, 'section_top') + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/src/Tools/padder/CMakeLists.txt b/src/Tools/padder/CMakeLists.txt index 50c6f288b..55b2d8c19 100644 --- a/src/Tools/padder/CMakeLists.txt +++ b/src/Tools/padder/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/doc/CMakeLists.txt b/src/Tools/padder/doc/CMakeLists.txt index b745473d5..e9c34837e 100755 --- a/src/Tools/padder/doc/CMakeLists.txt +++ b/src/Tools/padder/doc/CMakeLists.txt @@ -1,12 +1,9 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&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-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/doc/doxyfile.in b/src/Tools/padder/doc/doxyfile.in index ffe51fc0d..6180b0aec 100755 --- a/src/Tools/padder/doc/doxyfile.in +++ b/src/Tools/padder/doc/doxyfile.in @@ -1,9 +1,9 @@ -# Copyright (C) 2007-2013 EDF R&D +# Copyright (C) 2007-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/meshjob/CMakeLists.txt b/src/Tools/padder/meshjob/CMakeLists.txt index e01960314..3f0816605 100644 --- a/src/Tools/padder/meshjob/CMakeLists.txt +++ b/src/Tools/padder/meshjob/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/meshjob/idl/CMakeLists.txt b/src/Tools/padder/meshjob/idl/CMakeLists.txt index ab73887fd..a5af8ea19 100755 --- a/src/Tools/padder/meshjob/idl/CMakeLists.txt +++ b/src/Tools/padder/meshjob/idl/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/meshjob/idl/MESHJOB.idl b/src/Tools/padder/meshjob/idl/MESHJOB.idl index 92a87d986..d4dfcada7 100644 --- a/src/Tools/padder/meshjob/idl/MESHJOB.idl +++ b/src/Tools/padder/meshjob/idl/MESHJOB.idl @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2013 EDF R&D +// Copyright (C) 2011-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/meshjob/idl/SPADDERPluginTest.idl b/src/Tools/padder/meshjob/idl/SPADDERPluginTest.idl index ff9231b99..d59708bcb 100644 --- a/src/Tools/padder/meshjob/idl/SPADDERPluginTest.idl +++ b/src/Tools/padder/meshjob/idl/SPADDERPluginTest.idl @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2013 EDF R&D +// Copyright (C) 2011-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/meshjob/impl/CMakeLists.txt b/src/Tools/padder/meshjob/impl/CMakeLists.txt index 8933c4fc5..aac67087b 100644 --- a/src/Tools/padder/meshjob/impl/CMakeLists.txt +++ b/src/Tools/padder/meshjob/impl/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx b/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx index 8f5a39b1d..2e6587594 100644 --- a/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx +++ b/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2013 EDF R&D +// Copyright (C) 2011-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx b/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx index f522c3604..d590565c6 100644 --- a/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx +++ b/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2013 EDF R&D +// Copyright (C) 2011-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx b/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx index 83565540c..467e69d63 100644 --- a/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx +++ b/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2013 EDF R&D +// Copyright (C) 2011-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx b/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx index 027685b06..10c2053ae 100644 --- a/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx +++ b/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2013 EDF R&D +// Copyright (C) 2011-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/meshjob/impl/testhelper.hxx b/src/Tools/padder/meshjob/impl/testhelper.hxx index c2bd2ebc1..6bedcb1f2 100644 --- a/src/Tools/padder/meshjob/impl/testhelper.hxx +++ b/src/Tools/padder/meshjob/impl/testhelper.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2013 EDF R&D +// Copyright (C) 2011-2014 EDF R&D // // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/resources/CMakeLists.txt b/src/Tools/padder/resources/CMakeLists.txt index f79353f3d..7d8d8e7b4 100755 --- a/src/Tools/padder/resources/CMakeLists.txt +++ b/src/Tools/padder/resources/CMakeLists.txt @@ -1,12 +1,9 @@ -# Copyright (C) 2007-2013 CEA/DEN, EDF R&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-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/resources/testdata/buildparticules.py b/src/Tools/padder/resources/testdata/buildparticules.py index b8d40dc02..657e4e4a7 100755 --- a/src/Tools/padder/resources/testdata/buildparticules.py +++ b/src/Tools/padder/resources/testdata/buildparticules.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -# Copyright (C) 2011-2013 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/spadderpy/CMakeLists.txt b/src/Tools/padder/spadderpy/CMakeLists.txt index e49653855..0c73c5f1e 100644 --- a/src/Tools/padder/spadderpy/CMakeLists.txt +++ b/src/Tools/padder/spadderpy/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/spadderpy/__init__.py b/src/Tools/padder/spadderpy/__init__.py index 025dfe4ef..57d022fd1 100644 --- a/src/Tools/padder/spadderpy/__init__.py +++ b/src/Tools/padder/spadderpy/__init__.py @@ -1,9 +1,9 @@ -# Copyright (C) 2011-2013 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/spadderpy/configreader.py b/src/Tools/padder/spadderpy/configreader.py index b79e4f73d..02e5188f7 100644 --- a/src/Tools/padder/spadderpy/configreader.py +++ b/src/Tools/padder/spadderpy/configreader.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2011-2013 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/spadderpy/gui/CMakeLists.txt b/src/Tools/padder/spadderpy/gui/CMakeLists.txt index 00b9f990d..3a1c02a51 100644 --- a/src/Tools/padder/spadderpy/gui/CMakeLists.txt +++ b/src/Tools/padder/spadderpy/gui/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/spadderpy/gui/__init__.py b/src/Tools/padder/spadderpy/gui/__init__.py index 4699f2719..27164b3ad 100644 --- a/src/Tools/padder/spadderpy/gui/__init__.py +++ b/src/Tools/padder/spadderpy/gui/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2011-2013 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # # 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/src/Tools/padder/spadderpy/gui/inputdata.py b/src/Tools/padder/spadderpy/gui/inputdata.py index 278d2626e..2a1687683 100644 --- a/src/Tools/padder/spadderpy/gui/inputdata.py +++ b/src/Tools/padder/spadderpy/gui/inputdata.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2011-2013 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/spadderpy/gui/inputdialog.py b/src/Tools/padder/spadderpy/gui/inputdialog.py index 6920b43d5..d51d5c7ba 100644 --- a/src/Tools/padder/spadderpy/gui/inputdialog.py +++ b/src/Tools/padder/spadderpy/gui/inputdialog.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2011-2013 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/spadderpy/gui/plugindialog.py b/src/Tools/padder/spadderpy/gui/plugindialog.py index ab6869288..e2aa0f84e 100644 --- a/src/Tools/padder/spadderpy/gui/plugindialog.py +++ b/src/Tools/padder/spadderpy/gui/plugindialog.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2011-2013 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -211,7 +211,7 @@ class PluginDialog(QDialog): name. This returns the filename. ''' filename=str("/tmp/padder_inputfile_"+meshName+".med") - meshObject.ExportToMEDX( filename, 0, SMESH.MED_V2_2, 1 ) + meshObject.ExportToMEDX( filename, 0, SMESH.MED_V2_2, 1, 1 ) return filename def clear(self): diff --git a/src/Tools/padder/spadderpy/plugin/CMakeLists.txt b/src/Tools/padder/spadderpy/plugin/CMakeLists.txt index e7c481bf2..d84588d3c 100644 --- a/src/Tools/padder/spadderpy/plugin/CMakeLists.txt +++ b/src/Tools/padder/spadderpy/plugin/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/spadderpy/plugin/envPlugins.sh.in b/src/Tools/padder/spadderpy/plugin/envPlugins.sh.in index 8f68aa703..0b533f6bd 100644 --- a/src/Tools/padder/spadderpy/plugin/envPlugins.sh.in +++ b/src/Tools/padder/spadderpy/plugin/envPlugins.sh.in @@ -1,9 +1,9 @@ -# Copyright (C) 2011-2013 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/spadderpy/plugin/spadderPlugin.py b/src/Tools/padder/spadderpy/plugin/spadderPlugin.py index 8c0c2d5a8..3902ab4fb 100644 --- a/src/Tools/padder/spadderpy/plugin/spadderPlugin.py +++ b/src/Tools/padder/spadderpy/plugin/spadderPlugin.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2011-2013 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/unittests/CMakeLists.txt b/src/Tools/padder/unittests/CMakeLists.txt index a351ad048..44c84025e 100644 --- a/src/Tools/padder/unittests/CMakeLists.txt +++ b/src/Tools/padder/unittests/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/unittests/__init__.py b/src/Tools/padder/unittests/__init__.py index ab477c5ec..0d8e495ba 100644 --- a/src/Tools/padder/unittests/__init__.py +++ b/src/Tools/padder/unittests/__init__.py @@ -1,9 +1,9 @@ -# Copyright (C) 2011-2013 CEA/DEN, EDF R&D +# Copyright (C) 2011-2014 CEA/DEN, EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/unittests/autotest.sh.in b/src/Tools/padder/unittests/autotest.sh.in index 19ed5fee4..e4130283b 100644 --- a/src/Tools/padder/unittests/autotest.sh.in +++ b/src/Tools/padder/unittests/autotest.sh.in @@ -1,10 +1,10 @@ #!/bin/bash -# Copyright (C) 2010-2013 EDF R&D +# Copyright (C) 2010-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/unittests/usecase_meshJobManager.py b/src/Tools/padder/unittests/usecase_meshJobManager.py index 6ad9f6e88..5402747c3 100644 --- a/src/Tools/padder/unittests/usecase_meshJobManager.py +++ b/src/Tools/padder/unittests/usecase_meshJobManager.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2011-2013 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/padder/unittests/usecase_spadderPluginTester.py b/src/Tools/padder/unittests/usecase_spadderPluginTester.py index 68d853521..132577d0a 100644 --- a/src/Tools/padder/unittests/usecase_spadderPluginTester.py +++ b/src/Tools/padder/unittests/usecase_spadderPluginTester.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2011-2013 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/Tools/smesh_plugins.py b/src/Tools/smesh_plugins.py index f7ac148f4..b043ec692 100644 --- a/src/Tools/smesh_plugins.py +++ b/src/Tools/smesh_plugins.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2011-2013 EDF R&D +# Copyright (C) 2011-2014 EDF R&D # # 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. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,6 +25,7 @@ from spadderPlugin import runSpadderPlugin from meshcut_plugin import MeshCut from yamsplug_plugin import YamsLct from MGCleanerplug_plugin import MGCleanerLct +from blocFissure.ihm.fissureCoude_plugin import fissureCoudeDlg salome_pluginsmanager.AddFunction('PADDER mesher', 'Create a mesh with PADDER', @@ -42,3 +43,21 @@ salome_pluginsmanager.AddFunction('ReMesh with MGCleaner', 'Run MGCleaner', MGCleanerLct) +salome_pluginsmanager.AddFunction('Meshed Pipe with a crack', + 'Create a mesh with blocFissure tool', + fissureCoudeDlg) + +# ZCracks plugin requires the module EFICAS to be installed +# thus it is first tested if this module is available before +# adding the plugin to salome_pluginsmanager +enable_zcracks = True +try: + import eficasSalome +except: + enable_zcracks = False + +if enable_zcracks: + from zcracks_plugin import ZcracksLct + salome_pluginsmanager.AddFunction('Run Zcrack', + 'Run Zcrack', + ZcracksLct)