+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File : GHS3DPLUGIN_version.h
-// Author : Vadim SANDLER
-// Module : SALOME
-//
-#if !defined(__GHS3DPLUGIN_VERSION_H__)
-#define __GHS3DPLUGIN_VERSION_H__
-
-/*!
- Specify version of SALOME GHS3DPLUGIN module, as follows
-
- GHS3DPLUGIN_VERSION_MAJOR : (integer) number identifying major version
- GHS3DPLUGIN_VERSION_MINOR : (integer) number identifying minor version
- GHS3DPLUGIN_VERSION_MAINTENANCE : (integer) number identifying maintenance version
- GHS3DPLUGIN_VERSION_STR : (string) complete version number "major.minor.maintenance"
- GHS3DPLUGIN_VERSION : (hex) complete version number (major << 16) + (minor << 8) + maintenance
- GHS3DPLUGIN_DEVELOPMENT : (integer) indicates development version when set to 1
-*/
-
-#define GHS3DPLUGIN_VERSION_MAJOR @SALOMEGHS3DPLUGIN_MAJOR_VERSION@
-#define GHS3DPLUGIN_VERSION_MINOR @SALOMEGHS3DPLUGIN_MINOR_VERSION@
-#define GHS3DPLUGIN_VERSION_MAINTENANCE @SALOMEGHS3DPLUGIN_PATCH_VERSION@
-#define GHS3DPLUGIN_VERSION_STR "@SALOMEGHS3DPLUGIN_VERSION@"
-#define GHS3DPLUGIN_VERSION @SALOMEGHS3DPLUGIN_XVERSION@
-#define GHS3DPLUGIN_DEVELOPMENT @SALOMEGHS3DPLUGIN_VERSION_DEV@
-
-#endif // __GHS3DPLUGIN_VERSION_H__
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : GHS3DPLUGIN_version.h
+// Author : Vadim SANDLER
+// Module : SALOME
+//
+#if !defined(__GHS3DPLUGIN_VERSION_H__)
+#define __GHS3DPLUGIN_VERSION_H__
+
+/*!
+ Specify version of SALOME GHS3DPLUGIN module, as follows
+
+ GHS3DPLUGIN_VERSION_MAJOR : (integer) number identifying major version
+ GHS3DPLUGIN_VERSION_MINOR : (integer) number identifying minor version
+ GHS3DPLUGIN_VERSION_MAINTENANCE : (integer) number identifying maintenance version
+ GHS3DPLUGIN_VERSION_STR : (string) complete version number "major.minor.maintenance"
+ GHS3DPLUGIN_VERSION : (hex) complete version number (major << 16) + (minor << 8) + maintenance
+ GHS3DPLUGIN_DEVELOPMENT : (integer) indicates development version when set to 1
+*/
+
+#define GHS3DPLUGIN_VERSION_MAJOR @SALOMEGHS3DPLUGIN_MAJOR_VERSION@
+#define GHS3DPLUGIN_VERSION_MINOR @SALOMEGHS3DPLUGIN_MINOR_VERSION@
+#define GHS3DPLUGIN_VERSION_MAINTENANCE @SALOMEGHS3DPLUGIN_PATCH_VERSION@
+#define GHS3DPLUGIN_VERSION_STR "@SALOMEGHS3DPLUGIN_VERSION@"
+#define GHS3DPLUGIN_VERSION @SALOMEGHS3DPLUGIN_XVERSION@
+#define GHS3DPLUGIN_DEVELOPMENT @SALOMEGHS3DPLUGIN_VERSION_DEV@
+
+#endif // __GHS3DPLUGIN_VERSION_H__
+++ /dev/null
-# - Config file for the @PROJECT_NAME@ package
-# It defines the following variables.
-# Specific to the pacakge @PROJECT_NAME@ itself:
-# @PROJECT_NAME_UC@_ROOT_DIR_EXP - the root path of the installation providing this CMake file
-#
-
-###############################################################
-# 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
-#
-# This library is free software; you can redistribute it and/or
-# modify it 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
-###############################################################
-
-### Initialisation performed by CONFIGURE_PACKAGE_CONFIG_FILE:
-@PACKAGE_INIT@
-
-# Load the dependencies for the libraries of @PROJECT_NAME@
-# (contains definitions for IMPORTED targets). This is only
-# imported if we are not built as a subproject (in this case targets are already there)
-IF(NOT TARGET GHS3DEngine AND NOT @PROJECT_NAME@_BINARY_DIR)
- INCLUDE("@PACKAGE_SALOME_INSTALL_CMAKE_LOCAL@/@PROJECT_NAME@Targets.cmake")
-ENDIF()
-
-# Package root dir:
-SET_AND_CHECK(GHS3DPLUGIN_ROOT_DIR_EXP "@PACKAGE_CMAKE_INSTALL_PREFIX@")
-
-# Include directories
-SET_AND_CHECK(GHS3DPLUGIN_INCLUDE_DIRS "${GHS3DPLUGIN_ROOT_DIR_EXP}/@SALOME_INSTALL_HEADERS@")
-SET(GHS3DPLUGIN_INCLUDE_DIRS "${GHS3DPLUGIN_INCLUDE_DIRS};@_SalomeGHS3DPLUGIN_EXTRA_HEADERS@")
-SET(GHS3DPLUGIN_DEFINITIONS "@SMESH_DEFINITIONS@")
-
-# Package specific environment variables
-@_SalomeGHS3DPLUGIN_EXTRA_ENV_FULL@
-
-#### Now the specificities
-
-# Options exported by the package:
-SET(SALOME_GHS3DPLUGIN_BUILD_TESTS @SALOME_BUILD_TESTS@)
-SET(SALOME_GHS3DPLUGIN_BUILD_DOC @SALOME_BUILD_DOC@)
-
-# Advanced options
-SET(SALOME_GHS3DPLUGIN_BUILD_GUI @SALOME_BUILD_GUI@)
-
-# Level 1 prerequisites:
-SET_AND_CHECK(SMESH_ROOT_DIR_EXP "@PACKAGE_SMESH_ROOT_DIR@")
-
-# For all prerequisites, load the corresponding targets if the package was used
-# in CONFIG mode. This ensures dependent projects link correctly
-# without having to set LD_LIBRARY_PATH:
-SET(_PREREQ @_PREREQ_LIST@)
-SET(_PREREQ_CONFIG_DIR @_PREREQ_DIR_LIST@)
-SET(_PREREQ_COMPONENTS "@_PREREQ_COMPO_LIST@")
-LIST(LENGTH _PREREQ_CONFIG_DIR _list_len)
-IF(NOT _list_len EQUAL 0)
- # Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
- MATH(EXPR _range "${_list_len}-1")
- FOREACH(_p RANGE ${_range})
- LIST(GET _PREREQ ${_p} _pkg )
- LIST(GET _PREREQ_CONFIG_DIR ${_p} _pkg_dir)
- LIST(GET _PREREQ_COMPONENTS ${_p} _pkg_compo)
- MESSAGE(STATUS "===> Reloading targets from ${_pkg} ...")
- IF(NOT _pkg_compo)
- FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE
- PATHS "${_pkg_dir}"
- NO_DEFAULT_PATH)
- ELSE()
- STRING(REPLACE "," ";" _compo_lst "${_pkg_compo}")
- MESSAGE(STATUS "===> (components: ${_pkg_compo})")
- FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE
- COMPONENTS ${_compo_lst}
- PATHS "${_pkg_dir}"
- NO_DEFAULT_PATH)
- ENDIF()
- ENDFOREACH()
-ENDIF()
-
-# Installation directories
-SET(SALOME_INSTALL_BINS "@SALOME_INSTALL_BINS@")
-SET(SALOME_INSTALL_LIBS "@SALOME_INSTALL_LIBS@")
-SET(SALOME_INSTALL_IDLS "@SALOME_INSTALL_IDLS@")
-SET(SALOME_INSTALL_HEADERS "@SALOME_INSTALL_HEADERS@")
-SET(SALOME_INSTALL_SCRIPT_SCRIPTS "@SALOME_INSTALL_SCRIPT_SCRIPTS@")
-SET(SALOME_INSTALL_SCRIPT_DATA "@SALOME_INSTALL_SCRIPT_DATA@")
-SET(SALOME_INSTALL_SCRIPT_PYTHON "@SALOME_INSTALL_SCRIPT_PYTHON@")
-SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "@SALOME_INSTALL_APPLISKEL_SCRIPTS@")
-SET(SALOME_INSTALL_APPLISKEL_PYTHON "@SALOME_INSTALL_APPLISKEL_PYTHON@")
-SET(SALOME_INSTALL_CMAKE_LOCAL "@SALOME_INSTALL_CMAKE_LOCAL@")
-SET(SALOME_INSTALL_PYTHON "@SALOME_INSTALL_PYTHON@")
-SET(SALOME_INSTALL_PYTHON_SHARED "@SALOME_INSTALL_PYTHON_SHARED@")
-SET(SALOME_INSTALL_RES "@SALOME_INSTALL_RES@")
-SET(SALOME_INSTALL_DOC "@SALOME_INSTALL_DOC@")
-SET(SALOME_INSTALL_AMCONFIG_LOCAL "@SALOME_INSTALL_AMCONFIG_LOCAL@")
-
-# Include SMESH targets if they were not already loaded:
-IF(NOT (TARGET SMESHEngine))
- INCLUDE("${SMESH_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE}/SalomeSMESHTargets.cmake")
-ENDIF()
-
-# Exposed GHS3DPLUGIN targets:
-SET(GHS3DPLUGIN_GHS3DEngine GHS3DEngine)
-SET(GHS3DPLUGIN_GHS3DPluginGUI GHS3DPluginGUI)
-SET(GHS3DPLUGIN_SalomeIDLGHS3DPLUGIN SalomeIDLGHS3DPLUGIN)
\ No newline at end of file
--- /dev/null
+# - Config file for the @PROJECT_NAME@ package
+# It defines the following variables.
+# Specific to the pacakge @PROJECT_NAME@ itself:
+# @PROJECT_NAME_UC@_ROOT_DIR_EXP - the root path of the installation providing this CMake file
+#
+
+###############################################################
+# 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
+#
+# This library is free software; you can redistribute it and/or
+# modify it 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
+###############################################################
+
+### Initialisation performed by CONFIGURE_PACKAGE_CONFIG_FILE:
+@PACKAGE_INIT@
+
+# Load the dependencies for the libraries of @PROJECT_NAME@
+# (contains definitions for IMPORTED targets). This is only
+# imported if we are not built as a subproject (in this case targets are already there)
+IF(NOT TARGET GHS3DEngine AND NOT @PROJECT_NAME@_BINARY_DIR)
+ INCLUDE("@PACKAGE_SALOME_INSTALL_CMAKE_LOCAL@/@PROJECT_NAME@Targets.cmake")
+ENDIF()
+
+# Package root dir:
+SET_AND_CHECK(GHS3DPLUGIN_ROOT_DIR_EXP "@PACKAGE_CMAKE_INSTALL_PREFIX@")
+
+# Include directories
+SET_AND_CHECK(GHS3DPLUGIN_INCLUDE_DIRS "${GHS3DPLUGIN_ROOT_DIR_EXP}/@SALOME_INSTALL_HEADERS@")
+SET(GHS3DPLUGIN_INCLUDE_DIRS "${GHS3DPLUGIN_INCLUDE_DIRS};@_SalomeGHS3DPLUGIN_EXTRA_HEADERS@")
+SET(GHS3DPLUGIN_DEFINITIONS "@SMESH_DEFINITIONS@")
+
+# Package specific environment variables
+@_SalomeGHS3DPLUGIN_EXTRA_ENV_FULL@
+
+#### Now the specificities
+
+# Options exported by the package:
+SET(SALOME_GHS3DPLUGIN_BUILD_TESTS @SALOME_BUILD_TESTS@)
+SET(SALOME_GHS3DPLUGIN_BUILD_DOC @SALOME_BUILD_DOC@)
+
+# Advanced options
+SET(SALOME_GHS3DPLUGIN_BUILD_GUI @SALOME_BUILD_GUI@)
+
+# Level 1 prerequisites:
+SET_AND_CHECK(SMESH_ROOT_DIR_EXP "@PACKAGE_SMESH_ROOT_DIR@")
+
+# For all prerequisites, load the corresponding targets if the package was used
+# in CONFIG mode. This ensures dependent projects link correctly
+# without having to set LD_LIBRARY_PATH:
+SET(_PREREQ @_PREREQ_LIST@)
+SET(_PREREQ_CONFIG_DIR @_PREREQ_DIR_LIST@)
+SET(_PREREQ_COMPONENTS "@_PREREQ_COMPO_LIST@")
+LIST(LENGTH _PREREQ_CONFIG_DIR _list_len)
+IF(NOT _list_len EQUAL 0)
+ # Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
+ MATH(EXPR _range "${_list_len}-1")
+ FOREACH(_p RANGE ${_range})
+ LIST(GET _PREREQ ${_p} _pkg )
+ LIST(GET _PREREQ_CONFIG_DIR ${_p} _pkg_dir)
+ LIST(GET _PREREQ_COMPONENTS ${_p} _pkg_compo)
+ MESSAGE(STATUS "===> Reloading targets from ${_pkg} ...")
+ IF(NOT _pkg_compo)
+ FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE
+ PATHS "${_pkg_dir}"
+ NO_DEFAULT_PATH)
+ ELSE()
+ STRING(REPLACE "," ";" _compo_lst "${_pkg_compo}")
+ MESSAGE(STATUS "===> (components: ${_pkg_compo})")
+ FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE
+ COMPONENTS ${_compo_lst}
+ PATHS "${_pkg_dir}"
+ NO_DEFAULT_PATH)
+ ENDIF()
+ ENDFOREACH()
+ENDIF()
+
+# Installation directories
+SET(SALOME_INSTALL_BINS "@SALOME_INSTALL_BINS@")
+SET(SALOME_INSTALL_LIBS "@SALOME_INSTALL_LIBS@")
+SET(SALOME_INSTALL_IDLS "@SALOME_INSTALL_IDLS@")
+SET(SALOME_INSTALL_HEADERS "@SALOME_INSTALL_HEADERS@")
+SET(SALOME_INSTALL_SCRIPT_SCRIPTS "@SALOME_INSTALL_SCRIPT_SCRIPTS@")
+SET(SALOME_INSTALL_SCRIPT_DATA "@SALOME_INSTALL_SCRIPT_DATA@")
+SET(SALOME_INSTALL_SCRIPT_PYTHON "@SALOME_INSTALL_SCRIPT_PYTHON@")
+SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "@SALOME_INSTALL_APPLISKEL_SCRIPTS@")
+SET(SALOME_INSTALL_APPLISKEL_PYTHON "@SALOME_INSTALL_APPLISKEL_PYTHON@")
+SET(SALOME_INSTALL_CMAKE_LOCAL "@SALOME_INSTALL_CMAKE_LOCAL@")
+SET(SALOME_INSTALL_PYTHON "@SALOME_INSTALL_PYTHON@")
+SET(SALOME_INSTALL_PYTHON_SHARED "@SALOME_INSTALL_PYTHON_SHARED@")
+SET(SALOME_INSTALL_RES "@SALOME_INSTALL_RES@")
+SET(SALOME_INSTALL_DOC "@SALOME_INSTALL_DOC@")
+SET(SALOME_INSTALL_AMCONFIG_LOCAL "@SALOME_INSTALL_AMCONFIG_LOCAL@")
+
+# Include SMESH targets if they were not already loaded:
+IF(NOT (TARGET SMESHEngine))
+ INCLUDE("${SMESH_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE}/SalomeSMESHTargets.cmake")
+ENDIF()
+
+# Exposed GHS3DPLUGIN targets:
+SET(GHS3DPLUGIN_GHS3DEngine GHS3DEngine)
+SET(GHS3DPLUGIN_GHS3DPluginGUI GHS3DPluginGUI)
+SET(GHS3DPLUGIN_SalomeIDLGHS3DPLUGIN SalomeIDLGHS3DPLUGIN)
\ No newline at end of file
+++ /dev/null
-# Copyright (C) 2007-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
-#
-#
-
-IF(NOT SalomeGHS3DPLUGIN_FIND_QUIETLY)
- MESSAGE(STATUS "Looking for Salome GHS3DPLUGIN ...")
-ENDIF()
-
-SET(CMAKE_PREFIX_PATH "${GHS3DPLUGIN_ROOT_DIR}")
-
-SALOME_FIND_PACKAGE(SalomeGHS3DPLUGIN SalomeGHS3DPLUGIN CONFIG)
-
-IF(NOT SalomeGHS3DPLUGIN_FIND_QUIETLY)
- MESSAGE(STATUS "Found Salome GHS3DPLUGIN: ${GHS3DPLUGIN_ROOT_DIR}")
-ENDIF()
-
-FOREACH(_res ${SalomeGHS3DPLUGIN_EXTRA_ENV})
- SALOME_ACCUMULATE_ENVIRONMENT(${_res} "${SalomeGHS3DPLUGIN_EXTRA_ENV_${_res}}")
-ENDFOREACH()
\ No newline at end of file
--- /dev/null
+# Copyright (C) 2007-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
+#
+#
+
+IF(NOT SalomeGHS3DPLUGIN_FIND_QUIETLY)
+ MESSAGE(STATUS "Looking for Salome GHS3DPLUGIN ...")
+ENDIF()
+
+SET(CMAKE_PREFIX_PATH "${GHS3DPLUGIN_ROOT_DIR}")
+
+SALOME_FIND_PACKAGE(SalomeGHS3DPLUGIN SalomeGHS3DPLUGIN CONFIG)
+
+IF(NOT SalomeGHS3DPLUGIN_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Salome GHS3DPLUGIN: ${GHS3DPLUGIN_ROOT_DIR}")
+ENDIF()
+
+FOREACH(_res ${SalomeGHS3DPLUGIN_EXTRA_ENV})
+ SALOME_ACCUMULATE_ENVIRONMENT(${_res} "${SalomeGHS3DPLUGIN_EXTRA_ENV_${_res}}")
+ENDFOREACH()
\ No newline at end of file
+++ /dev/null
-dnl Copyright (C) 2004-2013 CEA/DEN, EDF R&D
-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
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-dnl
-
-AC_DEFUN([CHECK_GHS3D],[
-
-GHS3D_ok=no
-
-AC_EXEEXT
-AC_CHECK_PROG(GHS3D, ghs3d$EXEEXT,found)
-
-if test "x$GHS3D" == x ; then
- AC_MSG_WARN(ghs3d program not found in PATH variable)
-else
- GHS3D_ok=yes
-fi
-
-AC_MSG_RESULT(for GHS3D: $GHS3D_ok)
-
-])dnl
+++ /dev/null
-dnl Copyright (C) 2004-2013 CEA/DEN, EDF R&D
-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
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-dnl
-
-# Check availability of GHS3DPLUGIN binary distribution
-#
-# Author : Marc Tajchman (CEA, 2002)
-#------------------------------------------------------------
-
-AC_DEFUN([CHECK_GHS3DPLUGIN],[
-
-GHS3DPLUGIN_LDFLAGS=""
-GHS3DPLUGIN_CXXFLAGS=""
-
-AC_CHECKING(for GHS3dPlugin)
-
-GHS3dPlugin_ok=no
-
-AC_ARG_WITH(ghs,
- --with-ghs3dPlugin=DIR root directory path of GHS3DPLUGIN build or installation,
- GHS3DPLUGIN_DIR="$withval",GHS3DPLUGIN_DIR="")
-
-if test "x$GHS3DPLUGIN_DIR" = "x" ; then
-
-# no --with-gui-dir option used
-
- if test "x$GHS3DPLUGIN_ROOT_DIR" != "x" ; then
-
- # SALOME_ROOT_DIR environment variable defined
- GHS3DPLUGIN_DIR=$GHS3DPLUGIN_ROOT_DIR
-
- else
-
- # search Salome binaries in PATH variable
- AC_PATH_PROG(TEMP, libGHS3DEngine.so)
- if test "x$TEMP" != "x" ; then
- GHS3DPLUGIN_DIR=`dirname $TEMP`
- fi
-
- fi
-
-fi
-
-if test -f ${GHS3DPLUGIN_DIR}/lib/salome/libGHS3DEngine.so ; then
- GHS3dPlugin_ok=yes
- AC_MSG_RESULT(Using GHS3DPLUGIN module distribution in ${GHS3DPLUGIN_DIR})
-
- if test "x$GHS3DPLUGIN_ROOT_DIR" == "x" ; then
- GHS3DPLUGIN_ROOT_DIR=${GHS3DPLUGIN_DIR}
- fi
- GHS3DPLUGIN_CXXFLAGS+=-I${GHS3DPLUGIN_ROOT_DIR}/include/salome
- GHS3DPLUGIN_LDFLAGS+=-L${GHS3DPLUGIN_ROOT_DIR}/lib${LIB_LOCATION_SUFFIX}/salome
- AC_SUBST(GHS3DPLUGIN_ROOT_DIR)
- AC_SUBST(GHS3DPLUGIN_LDFLAGS)
- AC_SUBST(GHS3DPLUGIN_CXXFLAGS)
-else
- AC_MSG_WARN("Cannot find compiled GHS3DPLUGIN module distribution")
-fi
-
-AC_MSG_RESULT(for GHS3DPLUGIN: $GHS3dPlugin_ok)
-
-])dnl
-
--- /dev/null
+dnl Copyright (C) 2004-2013 CEA/DEN, EDF R&D
+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
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+
+AC_DEFUN([CHECK_GHS3D],[
+
+GHS3D_ok=no
+
+AC_EXEEXT
+AC_CHECK_PROG(GHS3D, ghs3d$EXEEXT,found)
+
+if test "x$GHS3D" == x ; then
+ AC_MSG_WARN(ghs3d program not found in PATH variable)
+else
+ GHS3D_ok=yes
+fi
+
+AC_MSG_RESULT(for GHS3D: $GHS3D_ok)
+
+])dnl
--- /dev/null
+dnl Copyright (C) 2004-2013 CEA/DEN, EDF R&D
+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
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+
+# Check availability of GHS3DPLUGIN binary distribution
+#
+# Author : Marc Tajchman (CEA, 2002)
+#------------------------------------------------------------
+
+AC_DEFUN([CHECK_GHS3DPLUGIN],[
+
+GHS3DPLUGIN_LDFLAGS=""
+GHS3DPLUGIN_CXXFLAGS=""
+
+AC_CHECKING(for GHS3dPlugin)
+
+GHS3dPlugin_ok=no
+
+AC_ARG_WITH(ghs,
+ --with-ghs3dPlugin=DIR root directory path of GHS3DPLUGIN build or installation,
+ GHS3DPLUGIN_DIR="$withval",GHS3DPLUGIN_DIR="")
+
+if test "x$GHS3DPLUGIN_DIR" = "x" ; then
+
+# no --with-gui-dir option used
+
+ if test "x$GHS3DPLUGIN_ROOT_DIR" != "x" ; then
+
+ # SALOME_ROOT_DIR environment variable defined
+ GHS3DPLUGIN_DIR=$GHS3DPLUGIN_ROOT_DIR
+
+ else
+
+ # search Salome binaries in PATH variable
+ AC_PATH_PROG(TEMP, libGHS3DEngine.so)
+ if test "x$TEMP" != "x" ; then
+ GHS3DPLUGIN_DIR=`dirname $TEMP`
+ fi
+
+ fi
+
+fi
+
+if test -f ${GHS3DPLUGIN_DIR}/lib/salome/libGHS3DEngine.so ; then
+ GHS3dPlugin_ok=yes
+ AC_MSG_RESULT(Using GHS3DPLUGIN module distribution in ${GHS3DPLUGIN_DIR})
+
+ if test "x$GHS3DPLUGIN_ROOT_DIR" == "x" ; then
+ GHS3DPLUGIN_ROOT_DIR=${GHS3DPLUGIN_DIR}
+ fi
+ GHS3DPLUGIN_CXXFLAGS+=-I${GHS3DPLUGIN_ROOT_DIR}/include/salome
+ GHS3DPLUGIN_LDFLAGS+=-L${GHS3DPLUGIN_ROOT_DIR}/lib${LIB_LOCATION_SUFFIX}/salome
+ AC_SUBST(GHS3DPLUGIN_ROOT_DIR)
+ AC_SUBST(GHS3DPLUGIN_LDFLAGS)
+ AC_SUBST(GHS3DPLUGIN_CXXFLAGS)
+else
+ AC_MSG_WARN("Cannot find compiled GHS3DPLUGIN module distribution")
+fi
+
+AC_MSG_RESULT(for GHS3DPLUGIN: $GHS3dPlugin_ok)
+
+])dnl
+
+++ /dev/null
-
-# It is possible to constrain GHS3D with another mesh or group.
-# The constraint can refer to the nodes, edges or faces.
-# This feature is available only on 2D meshes without geometry.
-# The constraining elements are called enforced elements for the mesh.
-# They can be recovered using groups if necessary.
-
-# In the following examples, a box and a cylinder are meshed in 2D.
-# The mesh of the cylinder will be used as a constraint for the
-# 3D mesh of the box.
-
-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)
-
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-geompy.addToStudy( box, "box" )
-cylindre = geompy.MakeCylinderRH(50, 50)
-geompy.TranslateDXDYDZ(cylindre, 100, 100, 30)
-face_cyl = geompy.ExtractShapes(cylindre, geompy.ShapeType["FACE"], True)[1]
-geompy.addToStudy( cylindre, 'cylindre' )
-geompy.addToStudyInFather( cylindre, face_cyl, 'face_cyl' )
-p1 = geompy.MakeVertex(20, 20, 20)
-p2 = geompy.MakeVertex(180, 180, 20)
-c = geompy.MakeCompound([p1,p2])
-geompy.addToStudy( p1, "p1" )
-geompy.addToStudy( p2, "p2" )
-geompy.addToStudy( c, "c" )
-
-# Create the 2D algorithm and hypothesis
-BLSURF = smesh.CreateHypothesis('BLSURF', 'BLSURFEngine')
-# For the box
-BLSURF_Parameters = smesh.CreateHypothesis('BLSURF_Parameters', 'BLSURFEngine')
-BLSURF_Parameters.SetPhysicalMesh( 1 )
-BLSURF_Parameters.SetPhySize( 200 )
-# For the cylinder
-BLSURF_Parameters2 = smesh.CreateHypothesis('BLSURF_Parameters', 'BLSURFEngine')
-BLSURF_Parameters2.SetGeometricMesh( 1 )
-
-# Create the 3D algorithm and hypothesis
-GHS3D = smesh.CreateHypothesis('GHS3D_3D', 'GHS3DEngine')
-GHS3D_Parameters_node = smesh.CreateHypothesis('GHS3D_Parameters', 'GHS3DEngine')
-#GHS3D_Parameters_node.SetToMeshHoles( 1 )
-GHS3D_Parameters_edge = smesh.CreateHypothesis('GHS3D_Parameters', 'GHS3DEngine')
-#GHS3D_Parameters_edge.SetToMeshHoles( 1 )
-GHS3D_Parameters_face = smesh.CreateHypothesis('GHS3D_Parameters', 'GHS3DEngine')
-GHS3D_Parameters_face.SetToMeshHoles( 1 ) # to mesh inside the cylinder
-GHS3D_Parameters_mesh = smesh.CreateHypothesis('GHS3D_Parameters', 'GHS3DEngine')
-GHS3D_Parameters_mesh.SetToMeshHoles( 1 ) # to mesh inside the cylinder
-
-# Create the mesh on the cylinder
-Mesh_cylindre = smesh.Mesh(cylindre)
-smesh.SetName(Mesh_cylindre,"Mesh_cylindre")
-Mesh_cylindre.AddHypothesis( BLSURF )
-Mesh_cylindre.AddHypothesis( BLSURF_Parameters2 )
-# Create some groups
-face_cyl_faces = Mesh_cylindre.GroupOnGeom(face_cyl,'group_face_cyl', SMESH.FACE)
-face_cyl_edges = Mesh_cylindre.GroupOnGeom(face_cyl,'group_edge_cyl', SMESH.EDGE)
-face_cyl_nodes = Mesh_cylindre.GroupOnGeom(face_cyl,'group_node_cyl', SMESH.NODE)
-Mesh_cylindre.Compute()
-
-# Create the mesh on the cylinder
-Mesh_box_tri = smesh.Mesh(box)
-smesh.SetName(Mesh_box_tri,"Mesh_box_tri")
-Mesh_box_tri.AddHypothesis( BLSURF )
-Mesh_box_tri.AddHypothesis( BLSURF_Parameters )
-Mesh_box_tri.Compute()
-
-# Create 4 copies of the 2D mesh to test the 3 types of contraints (NODE, EDGE, FACE)
-# from the whole mesh and from groups of elements.
-# Then the 3D algo and hypothesis are assigned to them.
-
-mesh_mesh = smesh.CopyMesh( Mesh_box_tri, 'Enforced by faces of mesh', 0, 0)
-mesh_mesh.AddHypothesis( GHS3D )
-mesh_mesh.AddHypothesis( GHS3D_Parameters_mesh)
-
-mesh_node = smesh.CopyMesh( Mesh_box_tri, 'Enforced by group of nodes', 0, 0)
-mesh_node.AddHypothesis( GHS3D )
-mesh_node.AddHypothesis( GHS3D_Parameters_node)
-
-mesh_edge = smesh.CopyMesh( Mesh_box_tri, 'Enforced by group of edges', 0, 0)
-mesh_edge.AddHypothesis( GHS3D )
-mesh_edge.AddHypothesis( GHS3D_Parameters_edge)
-
-mesh_face = smesh.CopyMesh( Mesh_box_tri, 'Enforced by group of faces', 0, 0)
-mesh_face.AddHypothesis( GHS3D )
-mesh_face.AddHypothesis( GHS3D_Parameters_face)
-
-# Add the enforced elements
-GHS3D_Parameters_mesh.SetEnforcedMeshWithGroup(Mesh_cylindre.GetMesh(),SMESH.FACE,"faces from cylinder")
-GHS3D_Parameters_node.SetEnforcedMeshWithGroup(face_cyl_nodes,SMESH.NODE,"nodes from face_cyl_nodes")
-GHS3D_Parameters_edge.SetEnforcedMeshWithGroup(face_cyl_edges,SMESH.EDGE,"edges from face_cyl_edges")
-GHS3D_Parameters_face.SetEnforcedMeshWithGroup(face_cyl_faces,SMESH.FACE,"faces from face_cyl_faces")
-
-#Compute the meshes
-mesh_node.Compute()
-mesh_edge.Compute()
-mesh_face.Compute()
-mesh_mesh.Compute()
-
-# End of script
+++ /dev/null
-
-# An enforced vertex can be added via:
-# - the coordinates x,y,z
-# - a GEOM vertex or compound (No geometry, TUI only)
-#
-# The created enforced nodes can also be stored in
-# a group.
-#
-# This feature is available only on meshes without geometry.
-
-# Ex1: Add one enforced vertex with coordinates (50,50,100)
-# and physical size 2.
-
-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)
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
-geompy.addToStudy(box, "box")
-# create a mesh on the box
-ghs3dMesh = smesh.Mesh(box,"box: Ghs3D and BLSurf mesh")
-# create a BLSurf algorithm for faces
-ghs3dMesh.Triangle(algo=smeshBuilder.BLSURF)
-# compute the mesh
-ghs3dMesh.Compute()
-
-# Make a copy of the 2D mesh
-ghs3dMesh_wo_geometry = smesh.CopyMesh( ghs3dMesh, 'Ghs3D wo geometry', 0, 0)
-
-# create a Ghs3D algorithm and hypothesis and assign them to the mesh
-GHS3D = smesh.CreateHypothesis('GHS3D_3D', 'GHS3DEngine')
-GHS3D_Parameters = smesh.CreateHypothesis('GHS3D_Parameters', 'GHS3DEngine')
-ghs3dMesh.AddHypothesis( GHS3D )
-ghs3dMesh.AddHypothesis( GHS3D_Parameters )
-# Create the enforced vertex
-GHS3D_Parameters.SetEnforcedVertex( 50, 50, 100, 2) # no group
-# Compute the mesh
-ghs3dMesh.Compute()
-
-
-# Ex2: Add one vertex enforced by a GEOM vertex at (50,50,100)
-# with physical size 5 and add it to a group called "My special nodes"
-
-# Create another GHS3D hypothesis and assign it to the mesh without geometry
-GHS3D_Parameters_wo_geometry = smesh.CreateHypothesis('GHS3D_Parameters', 'GHS3DEngine')
-ghs3dMesh_wo_geometry.AddHypothesis( GHS3D )
-ghs3dMesh_wo_geometry.AddHypothesis( GHS3D_Parameters_wo_geometry )
-
-# Create the enforced vertex
-p1 = geompy.MakeVertex(150, 150, 100)
-geompy.addToStudy(p1, "p1")
-GHS3D_Parameters_wo_geometry.SetEnforcedVertexGeomWithGroup( p1, 5 , "My special nodes")
-#GHS3D_Parameters.SetEnforcedVertexGeom( p1, 5 ) # no group
-
-# compute the mesh
-ghs3dMesh_wo_geometry.Compute()
-
-# Erase all enforced vertices
-GHS3D_Parameters.ClearEnforcedVertices()
-
-# End of script
+++ /dev/null
-
-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)
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
-geompy.addToStudy(box, "box")
-
-# create a mesh on the box
-ghs3dMesh = smesh.Mesh(box,"box: Ghs3D and BLSurf mesh")
-
-# create a BLSurf algorithm for faces
-BLSURF = ghs3dMesh.Triangle(algo=smeshBuilder.BLSURF)
-GHS3D = ghs3dMesh.Tetrahedron(algo=smeshBuilder.GHS3D)
-
-# compute the mesh
-ghs3dMesh.Compute()
-
-# End of script
-
--- /dev/null
+
+# It is possible to constrain GHS3D with another mesh or group.
+# The constraint can refer to the nodes, edges or faces.
+# This feature is available only on 2D meshes without geometry.
+# The constraining elements are called enforced elements for the mesh.
+# They can be recovered using groups if necessary.
+
+# In the following examples, a box and a cylinder are meshed in 2D.
+# The mesh of the cylinder will be used as a constraint for the
+# 3D mesh of the box.
+
+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)
+
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+geompy.addToStudy( box, "box" )
+cylindre = geompy.MakeCylinderRH(50, 50)
+geompy.TranslateDXDYDZ(cylindre, 100, 100, 30)
+face_cyl = geompy.ExtractShapes(cylindre, geompy.ShapeType["FACE"], True)[1]
+geompy.addToStudy( cylindre, 'cylindre' )
+geompy.addToStudyInFather( cylindre, face_cyl, 'face_cyl' )
+p1 = geompy.MakeVertex(20, 20, 20)
+p2 = geompy.MakeVertex(180, 180, 20)
+c = geompy.MakeCompound([p1,p2])
+geompy.addToStudy( p1, "p1" )
+geompy.addToStudy( p2, "p2" )
+geompy.addToStudy( c, "c" )
+
+# Create the 2D algorithm and hypothesis
+BLSURF = smesh.CreateHypothesis('BLSURF', 'BLSURFEngine')
+# For the box
+BLSURF_Parameters = smesh.CreateHypothesis('BLSURF_Parameters', 'BLSURFEngine')
+BLSURF_Parameters.SetPhysicalMesh( 1 )
+BLSURF_Parameters.SetPhySize( 200 )
+# For the cylinder
+BLSURF_Parameters2 = smesh.CreateHypothesis('BLSURF_Parameters', 'BLSURFEngine')
+BLSURF_Parameters2.SetGeometricMesh( 1 )
+
+# Create the 3D algorithm and hypothesis
+GHS3D = smesh.CreateHypothesis('GHS3D_3D', 'GHS3DEngine')
+GHS3D_Parameters_node = smesh.CreateHypothesis('GHS3D_Parameters', 'GHS3DEngine')
+#GHS3D_Parameters_node.SetToMeshHoles( 1 )
+GHS3D_Parameters_edge = smesh.CreateHypothesis('GHS3D_Parameters', 'GHS3DEngine')
+#GHS3D_Parameters_edge.SetToMeshHoles( 1 )
+GHS3D_Parameters_face = smesh.CreateHypothesis('GHS3D_Parameters', 'GHS3DEngine')
+GHS3D_Parameters_face.SetToMeshHoles( 1 ) # to mesh inside the cylinder
+GHS3D_Parameters_mesh = smesh.CreateHypothesis('GHS3D_Parameters', 'GHS3DEngine')
+GHS3D_Parameters_mesh.SetToMeshHoles( 1 ) # to mesh inside the cylinder
+
+# Create the mesh on the cylinder
+Mesh_cylindre = smesh.Mesh(cylindre)
+smesh.SetName(Mesh_cylindre,"Mesh_cylindre")
+Mesh_cylindre.AddHypothesis( BLSURF )
+Mesh_cylindre.AddHypothesis( BLSURF_Parameters2 )
+# Create some groups
+face_cyl_faces = Mesh_cylindre.GroupOnGeom(face_cyl,'group_face_cyl', SMESH.FACE)
+face_cyl_edges = Mesh_cylindre.GroupOnGeom(face_cyl,'group_edge_cyl', SMESH.EDGE)
+face_cyl_nodes = Mesh_cylindre.GroupOnGeom(face_cyl,'group_node_cyl', SMESH.NODE)
+Mesh_cylindre.Compute()
+
+# Create the mesh on the cylinder
+Mesh_box_tri = smesh.Mesh(box)
+smesh.SetName(Mesh_box_tri,"Mesh_box_tri")
+Mesh_box_tri.AddHypothesis( BLSURF )
+Mesh_box_tri.AddHypothesis( BLSURF_Parameters )
+Mesh_box_tri.Compute()
+
+# Create 4 copies of the 2D mesh to test the 3 types of contraints (NODE, EDGE, FACE)
+# from the whole mesh and from groups of elements.
+# Then the 3D algo and hypothesis are assigned to them.
+
+mesh_mesh = smesh.CopyMesh( Mesh_box_tri, 'Enforced by faces of mesh', 0, 0)
+mesh_mesh.AddHypothesis( GHS3D )
+mesh_mesh.AddHypothesis( GHS3D_Parameters_mesh)
+
+mesh_node = smesh.CopyMesh( Mesh_box_tri, 'Enforced by group of nodes', 0, 0)
+mesh_node.AddHypothesis( GHS3D )
+mesh_node.AddHypothesis( GHS3D_Parameters_node)
+
+mesh_edge = smesh.CopyMesh( Mesh_box_tri, 'Enforced by group of edges', 0, 0)
+mesh_edge.AddHypothesis( GHS3D )
+mesh_edge.AddHypothesis( GHS3D_Parameters_edge)
+
+mesh_face = smesh.CopyMesh( Mesh_box_tri, 'Enforced by group of faces', 0, 0)
+mesh_face.AddHypothesis( GHS3D )
+mesh_face.AddHypothesis( GHS3D_Parameters_face)
+
+# Add the enforced elements
+GHS3D_Parameters_mesh.SetEnforcedMeshWithGroup(Mesh_cylindre.GetMesh(),SMESH.FACE,"faces from cylinder")
+GHS3D_Parameters_node.SetEnforcedMeshWithGroup(face_cyl_nodes,SMESH.NODE,"nodes from face_cyl_nodes")
+GHS3D_Parameters_edge.SetEnforcedMeshWithGroup(face_cyl_edges,SMESH.EDGE,"edges from face_cyl_edges")
+GHS3D_Parameters_face.SetEnforcedMeshWithGroup(face_cyl_faces,SMESH.FACE,"faces from face_cyl_faces")
+
+#Compute the meshes
+mesh_node.Compute()
+mesh_edge.Compute()
+mesh_face.Compute()
+mesh_mesh.Compute()
+
+# End of script
--- /dev/null
+
+# An enforced vertex can be added via:
+# - the coordinates x,y,z
+# - a GEOM vertex or compound (No geometry, TUI only)
+#
+# The created enforced nodes can also be stored in
+# a group.
+#
+# This feature is available only on meshes without geometry.
+
+# Ex1: Add one enforced vertex with coordinates (50,50,100)
+# and physical size 2.
+
+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)
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
+geompy.addToStudy(box, "box")
+# create a mesh on the box
+ghs3dMesh = smesh.Mesh(box,"box: Ghs3D and BLSurf mesh")
+# create a BLSurf algorithm for faces
+ghs3dMesh.Triangle(algo=smeshBuilder.BLSURF)
+# compute the mesh
+ghs3dMesh.Compute()
+
+# Make a copy of the 2D mesh
+ghs3dMesh_wo_geometry = smesh.CopyMesh( ghs3dMesh, 'Ghs3D wo geometry', 0, 0)
+
+# create a Ghs3D algorithm and hypothesis and assign them to the mesh
+GHS3D = smesh.CreateHypothesis('GHS3D_3D', 'GHS3DEngine')
+GHS3D_Parameters = smesh.CreateHypothesis('GHS3D_Parameters', 'GHS3DEngine')
+ghs3dMesh.AddHypothesis( GHS3D )
+ghs3dMesh.AddHypothesis( GHS3D_Parameters )
+# Create the enforced vertex
+GHS3D_Parameters.SetEnforcedVertex( 50, 50, 100, 2) # no group
+# Compute the mesh
+ghs3dMesh.Compute()
+
+
+# Ex2: Add one vertex enforced by a GEOM vertex at (50,50,100)
+# with physical size 5 and add it to a group called "My special nodes"
+
+# Create another GHS3D hypothesis and assign it to the mesh without geometry
+GHS3D_Parameters_wo_geometry = smesh.CreateHypothesis('GHS3D_Parameters', 'GHS3DEngine')
+ghs3dMesh_wo_geometry.AddHypothesis( GHS3D )
+ghs3dMesh_wo_geometry.AddHypothesis( GHS3D_Parameters_wo_geometry )
+
+# Create the enforced vertex
+p1 = geompy.MakeVertex(150, 150, 100)
+geompy.addToStudy(p1, "p1")
+GHS3D_Parameters_wo_geometry.SetEnforcedVertexGeomWithGroup( p1, 5 , "My special nodes")
+#GHS3D_Parameters.SetEnforcedVertexGeom( p1, 5 ) # no group
+
+# compute the mesh
+ghs3dMesh_wo_geometry.Compute()
+
+# Erase all enforced vertices
+GHS3D_Parameters.ClearEnforcedVertices()
+
+# End of script
--- /dev/null
+
+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)
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
+geompy.addToStudy(box, "box")
+
+# create a mesh on the box
+ghs3dMesh = smesh.Mesh(box,"box: Ghs3D and BLSurf mesh")
+
+# create a BLSurf algorithm for faces
+BLSURF = ghs3dMesh.Triangle(algo=smeshBuilder.BLSURF)
+GHS3D = ghs3dMesh.Tetrahedron(algo=smeshBuilder.GHS3D)
+
+# compute the mesh
+ghs3dMesh.Compute()
+
+# End of script
+
+++ /dev/null
-# 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(doxyfile.in doxyfile)
-SALOME_CONFIGURE_FILE(doxyfile_py.in doxyfile_py)
-SALOME_CONFIGURE_FILE(static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html)
-SALOME_CONFIGURE_FILE(static/header_py.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header_py.html)
-
-SET(DOC_SMESH_MeshersList GHS3DPlugin)
-SET(smesh_file "$(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py")
-SET(kernel_file "$ENV{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 GHS3DPlugin)
-SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${PYTHON_EXECUTABLE}" "${_cmd_options}")
-
-ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp
- COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp/GHS3DPluginBuilder.py ${CMAKE_SOURCE_DIR}/src/GHS3DPlugin/GHS3DPluginBuilder.py
- COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp/smesh_algorithm.py ${SMESH_ROOT_DIR}/${SALOME_INSTALL_PYTHON}/salome/smesh/smesh_algorithm.py
- COMMAND ${_cmd}
- COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py
- COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
- COMMAND ${CMAKE_COMMAND} -E remove_directory tmp
- VERBATIM
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-)
-
-INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target usr_docs)")
-INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/GHS3DPLUGIN DESTINATION ${SALOME_INSTALL_DOC}/gui/)
-INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/GHS3DPLUGIN)
-INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/GHS3DPLUGIN/ghs3dpluginpy_doc)
-
-SET(make_clean_files GHS3DPLUGIN ghs3dpluginpy_doc.tag)
-SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}")
+++ /dev/null
-# Copyright (C) 2007-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
-#
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "SALOME GHS3DPLUGIN User's Guide"
-OUTPUT_DIRECTORY = GHS3DPLUGIN
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-TAB_SIZE = 5
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-
-#---------------------------------------------------------------------------
-#Input related options
-#---------------------------------------------------------------------------
-INPUT = @CMAKE_CURRENT_SOURCE_DIR@/input
-FILE_PATTERNS = *.doc
-EXCLUDE =
-IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images
-EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/doc/salome/examples
-
-#---------------------------------------------------------------------------
-#HTML related options
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = .
-HTML_HEADER = @CMAKE_CURRENT_BINARY_DIR@/static/header.html
-HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/static/footer.html
-HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css
-TOC_EXPAND = YES
-DISABLE_INDEX = NO
-GENERATE_TREEVIEW = YES
-TREEVIEW_WIDTH = 300
-
-#---------------------------------------------------------------------------
-#SORT related options
-#---------------------------------------------------------------------------
-SORT_GROUP_NAMES = NO
-
-
-#---------------------------------------------------------------------------
-#LaTeX related option
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-EXTRA_PACKAGES = amsmath
-
-#---------------------------------------------------------------------------
-#RTF related options
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-
-#---------------------------------------------------------------------------
-#External reference options
-#---------------------------------------------------------------------------
-
-#rnv: 07.04.2011 Workaround for the doxygen 1.7.3:
-#because it wrongly defines location of the html files for search.
-TAGFILES = ghs3dpluginpy_doc.tag=../GHS3DPLUGIN/ghs3dpluginpy_doc
-SEARCHENGINE = YES
-
-#---------------------------------------------------------------------------
-#Custom commands
-#---------------------------------------------------------------------------
-ALIASES += tui_script{1}="\include \1 <a href=\"../../examples/GHS3DPLUGIN/\1\">Download this script</a>"
+++ /dev/null
-# Copyright (C) 2007-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
-#
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "SALOME GHS3DPLUGIN User's Guide"
-OUTPUT_DIRECTORY = GHS3DPLUGIN
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ALWAYS_DETAILED_SEC = YES
-INLINE_INHERITED_MEMB = YES
-FULL_PATH_NAMES = NO
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = YES
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-SEPARATE_MEMBER_PAGES = NO
-TAB_SIZE = 5
-OPTIMIZE_OUTPUT_FOR_C = YES
-OPTIMIZE_OUTPUT_JAVA = YES
-BUILTIN_STL_SUPPORT = NO
-DISTRIBUTE_GROUP_DOC = NO
-SUBGROUPING = YES
-
-#---------------------------------------------------------------------------
-# Build related options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = YES
-EXTRACT_STATIC = NO
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = YES
-CASE_SENSE_NAMES = YES
-HIDE_SCOPE_NAMES = YES
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = NO
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-MAX_INITIALIZER_LINES = 25
-SHOW_USED_FILES = NO
-SHOW_DIRECTORIES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = NO
-REFERENCES_RELATION = YES
-USE_HTAGS = NO
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_NO_PARAMDOC = NO
-EXCLUDE_SYMLINKS = NO
-EXAMPLE_RECURSIVE = NO
-
-#---------------------------------------------------------------------------
-#Input related options
-#---------------------------------------------------------------------------
-INPUT = tmp/GHS3DPluginBuilder.py \
- tmp/smeshBuilder.py \
- tmp/smesh_algorithm.py
-FILE_PATTERNS =
-IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images
-RECURSIVE = NO
-EXAMPLE_PATH =
-
-#---------------------------------------------------------------------------
-#HTML related options
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = ghs3dpluginpy_doc
-HTML_HEADER = @CMAKE_CURRENT_BINARY_DIR@/static/header_py.html
-HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/static/footer.html
-HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css
-TOC_EXPAND = YES
-DISABLE_INDEX = NO
-GENERATE_TREEVIEW = YES
-TREEVIEW_WIDTH = 300
-
-#---------------------------------------------------------------------------
-#LaTeX related option
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-
-#---------------------------------------------------------------------------
-#RTF related options
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = NO
-HIDE_UNDOC_RELATIONS = NO
-HAVE_DOT = YES
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = NO
-GROUP_GRAPHS = NO
-UML_LOOK = NO
-TEMPLATE_RELATIONS = YES
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DIRECTORY_GRAPH = YES
-DOT_IMAGE_FORMAT = png
-DOT_FONTNAME = Arial
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 1000
-DOT_TRANSPARENT = NO
-DOT_MULTI_TARGETS = NO
-GENERATE_LEGEND = NO
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-#External reference options
-#---------------------------------------------------------------------------
-GENERATE_TAGFILE = ghs3dpluginpy_doc.tag
-SEARCHENGINE = YES
+++ /dev/null
-/*!
-
-\page additional_hypo_page Additional Hypotheses
-
-\n <b>Additional Hypotheses</b> can be applied as a supplement to the
-main hypotheses, introducing additional concepts to mesh creation.
-
-One additional hypotheses can be used together with GHS3D algoritm:
-<ul>
-<li><b>Viscous Layers</b> additional hypothesis can be used together with GHS3D.
-This hypothesis allows creation of layers of highly stretched prisms near
-mesh boundary, which is beneficial for high quality viscous
-computations. The prisms constructed on the quadrangular mesh faces are
-actually the hexahedrons.</li>
-</ul>
-
-For more detailed description of the this additional hypothesis please refer SALOME Mesh User's Guide.
-*/
+++ /dev/null
-/*!
-
-\page ghs3d_hypo_page GHS3D Parameters hypothesis
-
-\anchor ghs3d_top
-GHS3D Parameters hypothesis works only with <b>Tetrahedron (GHS3D)</b>
-algorithm. This algorithm is a commercial software.
-
-To get a licence, visit http://www.distene.com/en/corp/eval-distene.html
-
-\tableofcontents
-
-\section ghs3d_general_parameters General parameters
-
-\image html ghs3d_parameters_basic.png
-
-- <b>Name</b> - allows to define the name of the hypothesis (GHS3D
-Parameters by default).
-
-- <b>Mesh holes</b> - if checked, the algorithm will
-create mesh in the holes inside a solid shape, else only the outermost
-shape will be meshed. Volumic elements created within holes are bound
-to the solid.
-
-- <b>Make groups of domains</b> - if checked, the algorithm will
-create groups of just generated elements corresponding to each mesh
-domain.<br>
-
-- <b>Optimization level</b> - allows choosing the required
-optimization level (higher level of optimisation provides better mesh,
-but can be time-consuming):
-
- - none
-
- - light
-
- - medium (standard)
-
- - standard+
-
- - strong
-
-\ref ghs3d_top "Back to top"
-
-\section ghs3d_advanced_parameters Advanced parameters
-
-\image html ghs3d_parameters_advanced.png
-
-\subsection memory_settings Memory settings
-
-- <b>Maximum memory size</b> - launches ghs3d software with
-work space limited to the specified amount of RAM, in Mbytes. If this option is
-checked off, the software will be launched with 7O% of the total RAM space.
-
-- <b>Initial memory size</b> - starts ghs3d software with
-the specified amount of work space, in Mbytes. If this option is checked off, the
-software will be started with 100 Megabytes of working space.
-
-\subsection log Logs and debug
-
-- <b>Working directory</b> - allows defining the folder for input and output
-files of ghs3d software, which are the files starting with "GHS3D_" prefix.
-
-- <b>Verbose level</b> - to choose verbosity level in the range from
-0 to 10.
-
- - 0, no standard output,
-
- - 2, prints the data, quality statistics of the skin and final
- meshes and indicates when the final mesh is being saved. In addition
- the software gives indication regarding the CPU time.
-
- - 10, same as 2 plus the main steps in the computation, quality
- statistics histogram of the skin mesh, quality statistics histogram
- together with the characteristics of the final mesh.
-
-- <b>Print log in a file</b> - if this option is checked on the log is printed in a
-file placed in the working directory, otherwise it is printed on the standard output.
-
-- <b>Remove log on success</b> - if this option is checked on the log file is kept only
-if an error occurs during the computation. This option is only available if <b>Print log in a file</b>
-is enabled (there must be a log file to delete it) and <b>Keep all working files</b> is disabled
-(in this case the log file is always kept).
-
-- <b>Keep all working files</b> - allows checking input and output files
-of ghs3d software, while usually these files are removed after the
-launch of the mesher. The log file (if any) is also kept if this option is checked.
-
-\subsection advanced_meshing_options Advanced meshing options
-
-- <b>Create new nodes</b> - if this option is checked off, ghs3d
-tries to create tetrahedrons using only the nodes of the 2D mesh.
-
-- <b>Remove the initial central point</b> TetMesh-GHS3D adds an internal point
-at the gravity centre of the bounding box to speed up and to simplify
-the meshing process. However, it is possible to refrain from creating
-this point by using the command line option -no initial central point. This can be
-particularly useful to generate a volume mesh without internal points at all and in some rare cases
-at the boundary regeneration phase when it is impossible to proceed
-with the standard options
-(for example, when one dimension of the domain is more than 20 times greater than the other two).
-Use this option if the boundary regeneration has failed with the standard parameters and before using
-the recovery version (command line option -C).
-Note: when using this option, the speed of the meshing process may
-decrease, and the quality may change.
-Note: the boundary regeneration may fail with this option, in some rare cases.
-
-- <b>Use boundary recovery version</b> - enables using a
-boundary recovery module which tries to
-create volume meshes starting from very poor quality surface meshes
-(almost flat triangles on the surface, high density propagation,
-extreme aspect ratios, etc.) which fails with the standard version. The
-resulting volume mesh will however most likely have a very poor
-quality (poor aspect ratio of elements, tetrahedra with a very small
-positive volume).
-
-- <b>Use FEM correction</b> - Applies finite-element correction by
-replacing overconstrained elements where it is possible. At first the process
-slices the overconstrained edges and at second the overconstrained
-facets. This ensures that there are no edges with two boundary
-vertices and that there are no facets with three boundary vertices. TetMesh-GHS3D gives the initial
-and final overconstrained edges and facets. It also gives the facets
-which have three edges on the boundary.
-Note: when using this option, the speed of the meshing process may
-decrease, quality may change, and the smallest volume may be smaller.
-By default, the FEM correction is not used.
-
-- <b>Volumic gradation</b> - Defines the volumic ratio between 2 consecutive elements.
-WARNING: Changing the default value of this parameter may dramatically decrease the quality of the resulting mesh.
-
-- <b>Option as text</b> - allows to input in the command line any text
-for ghs3d, for example, advanced options.
-
-\ref ghs3d_top "Back to top"
-
-\section ghs3d_enforced_vertices Enforced vertices
-
-\image html ghs3d_enforced_vertices.png
-
-GHS3D algorithm can locally make the mesh finer. It is possible to
-define enforced vertices in the volume where the mesh will be detailed.
-A node will be created at the enforced vertex coordinates.
-
-An enforced vertex is defined by:
-- A vertex
- - from GEOM (Vertex, Compound) - only avaible on meshes with no
- geometry attached
- - or from (x,y,z) cartesian coordinates
-- A constant physical size
-- If a group name is given, the created node will be added to the
-group. If the group does not exist, it is created.
-
-\ref ghs3d_top "Back to top"
-
-\section ghs3d_enforced_meshes Enforced Meshes
-
-\image html ghs3d_enforced_meshes.png
-
-GHS3D algorithm can be forced by other meshes, sub-meshes or
-groups. The constraint elements should be contained
-entirely into the solid mesh.
-- The constraint element types are:
- - NODE
- - EDGE
- - FACE
-- If a group name is given, the enforced elements will be added to
-the group. If the group does not exist, it is created.
-
-<br><b>See Also</b> a sample TUI Script of the \ref tui_ghs3d "creation of a Ghs3D hypothesis", including enforced vertices and meshes.
-
-\ref ghs3d_top "Back to top"
-
-*/
+++ /dev/null
-/*!
-
-\page ghs3dplugin_python_interface_page Python Interface
-
-Python package GHS3DPluginBuilder defines several classes, destined for creation of the 3D meshes.
-
-GHS3D meshing plugin dynamically adds several methods to the smeshBuilder.Mesh class to create meshing algorithms.
-
-Below you can see an example of usage of the GHS3DPluginBuilder Python API for mesh generation:
-
-\anchor tui_ghs3d
-
--# \ref tui_ghs3d_basic
--# \ref tui_ghs3d_enforced_vertices
--# \ref tui_ghs3d_enforced_meshes
-
-\section tui_ghs3d_basic Construction of Mesh using Ghs3D algorithm
-
-\anchor example_BLSURFPlugin
-<h2>Example of mesh generation with GHS3D algorithm:</h2>
-\tui_script{ghs3ddemo.py}
-
-
-\image html ghs3d_screenshot.png Ghs3d mesh without hypothesis
-
-\ref tui_ghs3d "Back to top"
-
-\section tui_ghs3d_enforced_vertices Adding enforced vertices
-
-<h2>Example of enforced vertices with GHS3D algorithm:</h2>
-\tui_script{ghs3d_enfvert.py}
-
-
-\image html ghs3d_screenshot_enf1.png Ghs3d mesh with enforced vertex
-\image html ghs3d_screenshot_enf2.png Ghs3d mesh with enforced vertex from GEOM vertex
-
-\ref tui_ghs3d "Back to top"
-
-\section tui_ghs3d_enforced_meshes Adding enforced mesh
-
-<h2>Example of enforced meshes with GHS3D algorithm:</h2>
-\tui_script{ghs3d_enfmesh.py}
-
-\image html ghs3d_screenshot_enf3.png
-\image html ghs3d_screenshot_enf4.png
-\image html ghs3d_screenshot_enf5.png
-\image html ghs3d_screenshot_enf6.png
-
-\ref tui_ghs3d "Back to top"
-
-*/
+++ /dev/null
-/*!
-
-\mainpage Introduction to GHS3DPLUGIN
-
-\b GHS3DPLUGIN plugin is destined for:
-- Meshing 3D geometric entities: volumes are split into tetrahedral (pyramidal) elements.
-- Generating 3D meshes from 2D meshes (triangles and quadrangles), working without geometrical objects.
-
-\note GHS3DPLUGIN plugin used GHS3D commercial mesher and require a
-license to be used within the Mesh module.
-
-To manage parameters of the GHS3DPLUGIN use \subpage ghs3d_hypo_page and \subpage additional_hypo_page
-
-Also all GHS3DPLUGIN functionalities are accessible via
-\subpage ghs3dplugin_python_interface_page "GHS3DPLUGIN Python interface".
-
-
-\image html image2.gif "Example of a tetrahedral 3D mesh"
-
-
-*/
+++ /dev/null
-<!-- HTML footer for doxygen 1.8.3.1-->
-<!--BEGIN GENERATE_TREEVIEW-->
-<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
- <ul>
- $navpath
- <li class="footer">
- Copyright © 2007-2013 CEA/DEN, EDF R&D<br>
- </li>
- </ul>
-</div>
-<!--END GENERATE_TREEVIEW-->
-</body>
-</html>
+++ /dev/null
-<!-- HTML header for doxygen 1.8.3.1-->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
-<meta http-equiv="X-UA-Compatible" content="IE=9"/>
-<meta name="generator" content="Doxygen $doxygenversion"/>
-<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
-<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
-<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
-<script type="text/javascript" src="$relpath^jquery.js"></script>
-<script type="text/javascript" src="$relpath^dynsections.js"></script>
-$treeview
-$search
-$mathjax
-<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
-$extrastylesheet
-</head>
-<body>
-<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
-
-<div id="titlearea"><div align="right"><div class="version">Version: @SALOMEGHS3DPLUGIN_VERSION@</div></div></div>
-<!-- end header part -->
+++ /dev/null
-<!-- HTML header for doxygen 1.8.3.1-->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
-<meta http-equiv="X-UA-Compatible" content="IE=9"/>
-<meta name="generator" content="Doxygen $doxygenversion"/>
-<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
-<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
-<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
-<script type="text/javascript" src="$relpath^jquery.js"></script>
-<script type="text/javascript" src="$relpath^dynsections.js"></script>
-$treeview
-$search
-$mathjax
-<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
-$extrastylesheet
-</head>
-<body>
-<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
-
-<div id="titlearea"><div align="right"><div class="version">Version: @SALOMEGHS3DPLUGIN_VERSION@</div></div></div>
-<div align="bottom-left"><a href=../index.html>Home</a></div>
-<!-- end header part -->
+++ /dev/null
-/* The extra CSS for doxygen 1.8.3.1 */
-
-#titlearea {
- background-image:url('head.png');
- background-color: #175783;
- border: 1px solid;
- height: 80px;
- background-repeat: no-repeat;
- padding: 0px;
- margin: 0px;
- width: 99.9%;
- border-bottom: 1px solid #5373B4;
-}
-
-div.version {
- border:1px solid #0000FF;
- color: #CCCCCC;
- font-family: Arial, Helvetica, sans-serif;
- font-size: 9pt;
- text-align: center;
- width:100px;
- -moz-border-radius: 8px;
- margin: 5px;
-}
-
-.navpath li.footer {
- line-height:15px;
- text-align: right;
-}
\ No newline at end of file
--- /dev/null
+# 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(doxyfile.in doxyfile)
+SALOME_CONFIGURE_FILE(doxyfile_py.in doxyfile_py)
+SALOME_CONFIGURE_FILE(static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html)
+SALOME_CONFIGURE_FILE(static/header_py.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header_py.html)
+
+SET(DOC_SMESH_MeshersList GHS3DPlugin)
+SET(smesh_file "$(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py")
+SET(kernel_file "$ENV{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 GHS3DPlugin)
+SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${PYTHON_EXECUTABLE}" "${_cmd_options}")
+
+ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp
+ COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp/GHS3DPluginBuilder.py ${CMAKE_SOURCE_DIR}/src/GHS3DPlugin/GHS3DPluginBuilder.py
+ COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp/smesh_algorithm.py ${SMESH_ROOT_DIR}/${SALOME_INSTALL_PYTHON}/salome/smesh/smesh_algorithm.py
+ COMMAND ${_cmd}
+ COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py
+ COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
+ COMMAND ${CMAKE_COMMAND} -E remove_directory tmp
+ VERBATIM
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target usr_docs)")
+INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/GHS3DPLUGIN DESTINATION ${SALOME_INSTALL_DOC}/gui/)
+INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/GHS3DPLUGIN)
+INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/GHS3DPLUGIN/ghs3dpluginpy_doc)
+
+SET(make_clean_files GHS3DPLUGIN ghs3dpluginpy_doc.tag)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}")
--- /dev/null
+# Copyright (C) 2007-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
+#
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = "SALOME GHS3DPLUGIN User's Guide"
+OUTPUT_DIRECTORY = GHS3DPLUGIN
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+TAB_SIZE = 5
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+
+#---------------------------------------------------------------------------
+#Input related options
+#---------------------------------------------------------------------------
+INPUT = @CMAKE_CURRENT_SOURCE_DIR@/input
+FILE_PATTERNS = *.doc
+EXCLUDE =
+IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images
+EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/doc/salome/examples
+
+#---------------------------------------------------------------------------
+#HTML related options
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = .
+HTML_HEADER = @CMAKE_CURRENT_BINARY_DIR@/static/header.html
+HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/static/footer.html
+HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css
+TOC_EXPAND = YES
+DISABLE_INDEX = NO
+GENERATE_TREEVIEW = YES
+TREEVIEW_WIDTH = 300
+
+#---------------------------------------------------------------------------
+#SORT related options
+#---------------------------------------------------------------------------
+SORT_GROUP_NAMES = NO
+
+
+#---------------------------------------------------------------------------
+#LaTeX related option
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+EXTRA_PACKAGES = amsmath
+
+#---------------------------------------------------------------------------
+#RTF related options
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+
+#---------------------------------------------------------------------------
+#External reference options
+#---------------------------------------------------------------------------
+
+#rnv: 07.04.2011 Workaround for the doxygen 1.7.3:
+#because it wrongly defines location of the html files for search.
+TAGFILES = ghs3dpluginpy_doc.tag=../GHS3DPLUGIN/ghs3dpluginpy_doc
+SEARCHENGINE = YES
+
+#---------------------------------------------------------------------------
+#Custom commands
+#---------------------------------------------------------------------------
+ALIASES += tui_script{1}="\include \1 <a href=\"../../examples/GHS3DPLUGIN/\1\">Download this script</a>"
--- /dev/null
+# Copyright (C) 2007-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
+#
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = "SALOME GHS3DPLUGIN User's Guide"
+OUTPUT_DIRECTORY = GHS3DPLUGIN
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = NO
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ALWAYS_DETAILED_SEC = YES
+INLINE_INHERITED_MEMB = YES
+FULL_PATH_NAMES = NO
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = YES
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 5
+OPTIMIZE_OUTPUT_FOR_C = YES
+OPTIMIZE_OUTPUT_JAVA = YES
+BUILTIN_STL_SUPPORT = NO
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+
+#---------------------------------------------------------------------------
+# Build related options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = YES
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = YES
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = YES
+SHOW_INCLUDE_FILES = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = NO
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+MAX_INITIALIZER_LINES = 25
+SHOW_USED_FILES = NO
+SHOW_DIRECTORIES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+EXCLUDE_SYMLINKS = NO
+EXAMPLE_RECURSIVE = NO
+
+#---------------------------------------------------------------------------
+#Input related options
+#---------------------------------------------------------------------------
+INPUT = tmp/GHS3DPluginBuilder.py \
+ tmp/smeshBuilder.py \
+ tmp/smesh_algorithm.py
+FILE_PATTERNS =
+IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images
+RECURSIVE = NO
+EXAMPLE_PATH =
+
+#---------------------------------------------------------------------------
+#HTML related options
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = ghs3dpluginpy_doc
+HTML_HEADER = @CMAKE_CURRENT_BINARY_DIR@/static/header_py.html
+HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/static/footer.html
+HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css
+TOC_EXPAND = YES
+DISABLE_INDEX = NO
+GENERATE_TREEVIEW = YES
+TREEVIEW_WIDTH = 300
+
+#---------------------------------------------------------------------------
+#LaTeX related option
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+
+#---------------------------------------------------------------------------
+#RTF related options
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = NO
+HIDE_UNDOC_RELATIONS = NO
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = NO
+GROUP_GRAPHS = NO
+UML_LOOK = NO
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_FONTNAME = Arial
+DOT_PATH =
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 1000
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = NO
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+#External reference options
+#---------------------------------------------------------------------------
+GENERATE_TAGFILE = ghs3dpluginpy_doc.tag
+SEARCHENGINE = YES
--- /dev/null
+/*!
+
+\page additional_hypo_page Additional Hypotheses
+
+\n <b>Additional Hypotheses</b> can be applied as a supplement to the
+main hypotheses, introducing additional concepts to mesh creation.
+
+One additional hypotheses can be used together with GHS3D algoritm:
+<ul>
+<li><b>Viscous Layers</b> additional hypothesis can be used together with GHS3D.
+This hypothesis allows creation of layers of highly stretched prisms near
+mesh boundary, which is beneficial for high quality viscous
+computations. The prisms constructed on the quadrangular mesh faces are
+actually the hexahedrons.</li>
+</ul>
+
+For more detailed description of the this additional hypothesis please refer SALOME Mesh User's Guide.
+*/
--- /dev/null
+/*!
+
+\page ghs3d_hypo_page GHS3D Parameters hypothesis
+
+\anchor ghs3d_top
+GHS3D Parameters hypothesis works only with <b>Tetrahedron (GHS3D)</b>
+algorithm. This algorithm is a commercial software.
+
+To get a licence, visit http://www.distene.com/en/corp/eval-distene.html
+
+\tableofcontents
+
+\section ghs3d_general_parameters General parameters
+
+\image html ghs3d_parameters_basic.png
+
+- <b>Name</b> - allows to define the name of the hypothesis (GHS3D
+Parameters by default).
+
+- <b>Mesh holes</b> - if checked, the algorithm will
+create mesh in the holes inside a solid shape, else only the outermost
+shape will be meshed. Volumic elements created within holes are bound
+to the solid.
+
+- <b>Make groups of domains</b> - if checked, the algorithm will
+create groups of just generated elements corresponding to each mesh
+domain.<br>
+
+- <b>Optimization level</b> - allows choosing the required
+optimization level (higher level of optimisation provides better mesh,
+but can be time-consuming):
+
+ - none
+
+ - light
+
+ - medium (standard)
+
+ - standard+
+
+ - strong
+
+\ref ghs3d_top "Back to top"
+
+\section ghs3d_advanced_parameters Advanced parameters
+
+\image html ghs3d_parameters_advanced.png
+
+\subsection memory_settings Memory settings
+
+- <b>Maximum memory size</b> - launches ghs3d software with
+work space limited to the specified amount of RAM, in Mbytes. If this option is
+checked off, the software will be launched with 7O% of the total RAM space.
+
+- <b>Initial memory size</b> - starts ghs3d software with
+the specified amount of work space, in Mbytes. If this option is checked off, the
+software will be started with 100 Megabytes of working space.
+
+\subsection log Logs and debug
+
+- <b>Working directory</b> - allows defining the folder for input and output
+files of ghs3d software, which are the files starting with "GHS3D_" prefix.
+
+- <b>Verbose level</b> - to choose verbosity level in the range from
+0 to 10.
+
+ - 0, no standard output,
+
+ - 2, prints the data, quality statistics of the skin and final
+ meshes and indicates when the final mesh is being saved. In addition
+ the software gives indication regarding the CPU time.
+
+ - 10, same as 2 plus the main steps in the computation, quality
+ statistics histogram of the skin mesh, quality statistics histogram
+ together with the characteristics of the final mesh.
+
+- <b>Print log in a file</b> - if this option is checked on the log is printed in a
+file placed in the working directory, otherwise it is printed on the standard output.
+
+- <b>Remove log on success</b> - if this option is checked on the log file is kept only
+if an error occurs during the computation. This option is only available if <b>Print log in a file</b>
+is enabled (there must be a log file to delete it) and <b>Keep all working files</b> is disabled
+(in this case the log file is always kept).
+
+- <b>Keep all working files</b> - allows checking input and output files
+of ghs3d software, while usually these files are removed after the
+launch of the mesher. The log file (if any) is also kept if this option is checked.
+
+\subsection advanced_meshing_options Advanced meshing options
+
+- <b>Create new nodes</b> - if this option is checked off, ghs3d
+tries to create tetrahedrons using only the nodes of the 2D mesh.
+
+- <b>Remove the initial central point</b> TetMesh-GHS3D adds an internal point
+at the gravity centre of the bounding box to speed up and to simplify
+the meshing process. However, it is possible to refrain from creating
+this point by using the command line option -no initial central point. This can be
+particularly useful to generate a volume mesh without internal points at all and in some rare cases
+at the boundary regeneration phase when it is impossible to proceed
+with the standard options
+(for example, when one dimension of the domain is more than 20 times greater than the other two).
+Use this option if the boundary regeneration has failed with the standard parameters and before using
+the recovery version (command line option -C).
+Note: when using this option, the speed of the meshing process may
+decrease, and the quality may change.
+Note: the boundary regeneration may fail with this option, in some rare cases.
+
+- <b>Use boundary recovery version</b> - enables using a
+boundary recovery module which tries to
+create volume meshes starting from very poor quality surface meshes
+(almost flat triangles on the surface, high density propagation,
+extreme aspect ratios, etc.) which fails with the standard version. The
+resulting volume mesh will however most likely have a very poor
+quality (poor aspect ratio of elements, tetrahedra with a very small
+positive volume).
+
+- <b>Use FEM correction</b> - Applies finite-element correction by
+replacing overconstrained elements where it is possible. At first the process
+slices the overconstrained edges and at second the overconstrained
+facets. This ensures that there are no edges with two boundary
+vertices and that there are no facets with three boundary vertices. TetMesh-GHS3D gives the initial
+and final overconstrained edges and facets. It also gives the facets
+which have three edges on the boundary.
+Note: when using this option, the speed of the meshing process may
+decrease, quality may change, and the smallest volume may be smaller.
+By default, the FEM correction is not used.
+
+- <b>Volumic gradation</b> - Defines the volumic ratio between 2 consecutive elements.
+WARNING: Changing the default value of this parameter may dramatically decrease the quality of the resulting mesh.
+
+- <b>Option as text</b> - allows to input in the command line any text
+for ghs3d, for example, advanced options.
+
+\ref ghs3d_top "Back to top"
+
+\section ghs3d_enforced_vertices Enforced vertices
+
+\image html ghs3d_enforced_vertices.png
+
+GHS3D algorithm can locally make the mesh finer. It is possible to
+define enforced vertices in the volume where the mesh will be detailed.
+A node will be created at the enforced vertex coordinates.
+
+An enforced vertex is defined by:
+- A vertex
+ - from GEOM (Vertex, Compound) - only avaible on meshes with no
+ geometry attached
+ - or from (x,y,z) cartesian coordinates
+- A constant physical size
+- If a group name is given, the created node will be added to the
+group. If the group does not exist, it is created.
+
+\ref ghs3d_top "Back to top"
+
+\section ghs3d_enforced_meshes Enforced Meshes
+
+\image html ghs3d_enforced_meshes.png
+
+GHS3D algorithm can be forced by other meshes, sub-meshes or
+groups. The constraint elements should be contained
+entirely into the solid mesh.
+- The constraint element types are:
+ - NODE
+ - EDGE
+ - FACE
+- If a group name is given, the enforced elements will be added to
+the group. If the group does not exist, it is created.
+
+<br><b>See Also</b> a sample TUI Script of the \ref tui_ghs3d "creation of a Ghs3D hypothesis", including enforced vertices and meshes.
+
+\ref ghs3d_top "Back to top"
+
+*/
--- /dev/null
+/*!
+
+\page ghs3dplugin_python_interface_page Python Interface
+
+Python package GHS3DPluginBuilder defines several classes, destined for creation of the 3D meshes.
+
+GHS3D meshing plugin dynamically adds several methods to the smeshBuilder.Mesh class to create meshing algorithms.
+
+Below you can see an example of usage of the GHS3DPluginBuilder Python API for mesh generation:
+
+\anchor tui_ghs3d
+
+-# \ref tui_ghs3d_basic
+-# \ref tui_ghs3d_enforced_vertices
+-# \ref tui_ghs3d_enforced_meshes
+
+\section tui_ghs3d_basic Construction of Mesh using Ghs3D algorithm
+
+\anchor example_BLSURFPlugin
+<h2>Example of mesh generation with GHS3D algorithm:</h2>
+\tui_script{ghs3ddemo.py}
+
+
+\image html ghs3d_screenshot.png Ghs3d mesh without hypothesis
+
+\ref tui_ghs3d "Back to top"
+
+\section tui_ghs3d_enforced_vertices Adding enforced vertices
+
+<h2>Example of enforced vertices with GHS3D algorithm:</h2>
+\tui_script{ghs3d_enfvert.py}
+
+
+\image html ghs3d_screenshot_enf1.png Ghs3d mesh with enforced vertex
+\image html ghs3d_screenshot_enf2.png Ghs3d mesh with enforced vertex from GEOM vertex
+
+\ref tui_ghs3d "Back to top"
+
+\section tui_ghs3d_enforced_meshes Adding enforced mesh
+
+<h2>Example of enforced meshes with GHS3D algorithm:</h2>
+\tui_script{ghs3d_enfmesh.py}
+
+\image html ghs3d_screenshot_enf3.png
+\image html ghs3d_screenshot_enf4.png
+\image html ghs3d_screenshot_enf5.png
+\image html ghs3d_screenshot_enf6.png
+
+\ref tui_ghs3d "Back to top"
+
+*/
--- /dev/null
+/*!
+
+\mainpage Introduction to GHS3DPLUGIN
+
+\b GHS3DPLUGIN plugin is destined for:
+- Meshing 3D geometric entities: volumes are split into tetrahedral (pyramidal) elements.
+- Generating 3D meshes from 2D meshes (triangles and quadrangles), working without geometrical objects.
+
+\note GHS3DPLUGIN plugin used GHS3D commercial mesher and require a
+license to be used within the Mesh module.
+
+To manage parameters of the GHS3DPLUGIN use \subpage ghs3d_hypo_page and \subpage additional_hypo_page
+
+Also all GHS3DPLUGIN functionalities are accessible via
+\subpage ghs3dplugin_python_interface_page "GHS3DPLUGIN Python interface".
+
+
+\image html image2.gif "Example of a tetrahedral 3D mesh"
+
+
+*/
--- /dev/null
+<!-- HTML footer for doxygen 1.8.3.1-->
+<!--BEGIN GENERATE_TREEVIEW-->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ $navpath
+ <li class="footer">
+ Copyright © 2007-2013 CEA/DEN, EDF R&D<br>
+ </li>
+ </ul>
+</div>
+<!--END GENERATE_TREEVIEW-->
+</body>
+</html>
--- /dev/null
+<!-- HTML header for doxygen 1.8.3.1-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen $doxygenversion"/>
+<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
+<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
+<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="$relpath^jquery.js"></script>
+<script type="text/javascript" src="$relpath^dynsections.js"></script>
+$treeview
+$search
+$mathjax
+<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
+$extrastylesheet
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+
+<div id="titlearea"><div align="right"><div class="version">Version: @SALOMEGHS3DPLUGIN_VERSION@</div></div></div>
+<!-- end header part -->
--- /dev/null
+<!-- HTML header for doxygen 1.8.3.1-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen $doxygenversion"/>
+<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
+<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
+<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="$relpath^jquery.js"></script>
+<script type="text/javascript" src="$relpath^dynsections.js"></script>
+$treeview
+$search
+$mathjax
+<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
+$extrastylesheet
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+
+<div id="titlearea"><div align="right"><div class="version">Version: @SALOMEGHS3DPLUGIN_VERSION@</div></div></div>
+<div align="bottom-left"><a href=../index.html>Home</a></div>
+<!-- end header part -->
--- /dev/null
+/* The extra CSS for doxygen 1.8.3.1 */
+
+#titlearea {
+ background-image:url('head.png');
+ background-color: #175783;
+ border: 1px solid;
+ height: 80px;
+ background-repeat: no-repeat;
+ padding: 0px;
+ margin: 0px;
+ width: 99.9%;
+ border-bottom: 1px solid #5373B4;
+}
+
+div.version {
+ border:1px solid #0000FF;
+ color: #CCCCCC;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 9pt;
+ text-align: center;
+ width:100px;
+ -moz-border-radius: 8px;
+ margin: 5px;
+}
+
+.navpath li.footer {
+ line-height:15px;
+ text-align: right;
+}
\ No newline at end of file
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File : GHS3D_Algorithm.idl
-// Author : Julia DOROVSKIKH
-//
-#ifndef _GHS3D_Algorithm_IDL_
-#define _GHS3D_Algorithm_IDL_
-
-#include "SALOME_Exception.idl"
-#include "SMESH_Hypothesis.idl"
-#include "SMESH_Mesh.idl"
-
-/*!
- * GHS3DPlugin: interfaces to GHS3D related hypotheses and algorithms
- */
-module GHS3DPlugin
-{
- typedef sequence<double,3> TCoords;
- struct GHS3DEnforcedVertex {
- string name;
- string geomEntry;
- boolean isCompound;
- TCoords coords;
- string groupName;
- double size;
- };
-
- typedef sequence<GHS3DEnforcedVertex> GHS3DEnforcedVertexList;
-
- struct GHS3DEnforcedMesh {
- string name;
- string entry;
- SMESH::ElementType elementType;
- string groupName;
- };
-
- typedef sequence<GHS3DEnforcedMesh> GHS3DEnforcedMeshList;
-
- /*!
- * GHS3DPlugin_GHS3D: interface of "Tetrahedron (GHS3D)" algorithm
- */
- interface GHS3DPlugin_GHS3D : SMESH::SMESH_3D_Algo
- {
- SMESH::SMESH_Mesh importGMFMesh(in string aGMFFileName);
- };
-
- /*!
- * Parameters of "Tetrahedron (GHS3D)" algorithm
- */
- interface GHS3DPlugin_Hypothesis : SMESH::SMESH_Hypothesis
- {
- /*!
- * To mesh "holes" in a solid or not. Default is to mesh.
- */
- void SetToMeshHoles(in boolean toMesh);
- boolean GetToMeshHoles();
- /*!
- * To make groups of volumes of different domains when mesh is generated from skin.
- * Default is to make groups.
- * This option works only (1) for the mesh w/o shape and (2) if GetToMeshHoles() == true
- */
- void SetToMakeGroupsOfDomains(in boolean toMakeGroups);
- boolean GetToMakeGroupsOfDomains();
- /*!
- * Maximal size of memory to be used by the algorithm (in Megabytes).
- * Negative value means not to use this option
- */
- void SetMaximumMemory(in double MB) raises (SALOME::SALOME_Exception);
- double GetMaximumMemory();
- /*!
- * Initial size of memory to be used by the algorithm (in Megabytes) in
- * automatic memory adjustment mode. Default is zero.
- * Negative value means not to use this option
- */
- void SetInitialMemory(in double MB) raises (SALOME::SALOME_Exception);
- double GetInitialMemory();
- /*!
- * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium
- */
- void SetOptimizationLevel(in short level) raises (SALOME::SALOME_Exception);
- short GetOptimizationLevel();
- /*!
- * Path to working directory
- */
- void SetWorkingDirectory(in string path) raises (SALOME::SALOME_Exception);
- string GetWorkingDirectory();
- /*!
- * To keep working files or remove them. Log file remains in case of errors anyway.
- */
- void SetKeepFiles(in boolean toKeep);
- boolean GetKeepFiles();
- /*!
- * Verbose level [0-10]
- * 0 - no standard output,
- * 2 - prints the data, quality statistics of the skin and final meshes and
- * indicates when the final mesh is being saved. In addition the software
- * gives indication regarding the CPU time.
- * 10 - same as 2 plus the main steps in the computation, quality statistics
- * histogram of the skin mesh, quality statistics histogram together with
- * the characteristics of the final mesh.
- */
- void SetVerboseLevel(in short level);
- short GetVerboseLevel();
- /*!
- * To create new nodes
- */
- void SetToCreateNewNodes(in boolean toCreate);
- boolean GetToCreateNewNodes();
- /*!
- * To use boundary recovery version which tries to create mesh on a very poor
- * quality surface mesh
- */
- void SetToUseBoundaryRecoveryVersion(in boolean toUse);
- boolean GetToUseBoundaryRecoveryVersion();
- /*!
- * Applies finite-element correction by replacing overconstrained elements where
- * it is possible. The process is cutting first the overconstrained edges and
- * second the overconstrained facets. This insure that no edges have two boundary
- * vertices and that no facets have three boundary vertices.
- */
- void SetFEMCorrection(in boolean toUseFem);
- boolean GetFEMCorrection();
- /*!
- * To removes initial central point.
- */
- void SetToRemoveCentralPoint(in boolean toRemove);
- boolean GetToRemoveCentralPoint();
- /*!
- * To set hiden/undocumented/advanced options
- */
- void SetTextOption(in string option);
- string GetTextOption();
- /*!
- * To define the volumic gradation
- */
- void SetGradation(in double gradation);
- double GetGradation();
- /*!
- * Print log in standard output
- */
- void SetStandardOutputLog(in boolean logInStandardOutput);
- boolean GetStandardOutputLog();
- /*!
- * Remove log file on success
- */
- void SetRemoveLogOnSuccess(in boolean removeLogOnSuccess);
- boolean GetRemoveLogOnSuccess();
- /*!
- * To set an enforced vertex
- */
- boolean SetEnforcedVertex(in double x, in double y, in double z, in double size) raises (SALOME::SALOME_Exception);
- boolean SetEnforcedVertexNamed(in double x, in double y, in double z, in double size, in string vertexName) raises (SALOME::SALOME_Exception);
- boolean SetEnforcedVertexWithGroup(in double x, in double y, in double z, in double size, in string groupName) raises (SALOME::SALOME_Exception);
- boolean SetEnforcedVertexNamedWithGroup(in double x, in double y, in double z, in double size, in string vertexName, in string groupName) raises (SALOME::SALOME_Exception);
- boolean SetEnforcedVertexGeom(in GEOM::GEOM_Object theVertex, in double size) raises (SALOME::SALOME_Exception);
- boolean SetEnforcedVertexGeomWithGroup(in GEOM::GEOM_Object theVertex, in double size, in string groupName) raises (SALOME::SALOME_Exception);
- double GetEnforcedVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
- double GetEnforcedVertexGeom(in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception);
- boolean RemoveEnforcedVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
- boolean RemoveEnforcedVertexGeom(in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception);
- GHS3DEnforcedVertexList GetEnforcedVertices();
- void ClearEnforcedVertices();
- /*!
- * Set/get/unset an enforced vertex (private method for GUI)
- */
- boolean p_SetEnforcedVertex(in double size, in double x, in double y, in double z,
- in string theVertexName, in string theVertexEntry, in string groupName,
- in boolean isCompound) raises (SALOME::SALOME_Exception);
-
- boolean SetEnforcedMesh(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType) raises (SALOME::SALOME_Exception);
- boolean SetEnforcedMeshWithGroup(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in string groupName) raises (SALOME::SALOME_Exception);
-
- /* OBSOLETE FUNCTIONS */
- boolean SetEnforcedMeshSize(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in double size) raises (SALOME::SALOME_Exception);
- boolean SetEnforcedMeshSizeWithGroup(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in double size, in string groupName) raises (SALOME::SALOME_Exception);
- /* OBSOLETE FUNCTIONS */
-
- GHS3DEnforcedMeshList GetEnforcedMeshes();
- void ClearEnforcedMeshes();
-
- /*!
- * Set/get/unset an enforced vertex (private method for GUI)
- */
- boolean p_SetEnforcedMesh(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in string name, in string groupName) raises (SALOME::SALOME_Exception);
- };
-};
-
-#endif
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : GHS3D_Algorithm.idl
+// Author : Julia DOROVSKIKH
+//
+#ifndef _GHS3D_Algorithm_IDL_
+#define _GHS3D_Algorithm_IDL_
+
+#include "SALOME_Exception.idl"
+#include "SMESH_Hypothesis.idl"
+#include "SMESH_Mesh.idl"
+
+/*!
+ * GHS3DPlugin: interfaces to GHS3D related hypotheses and algorithms
+ */
+module GHS3DPlugin
+{
+ typedef sequence<double,3> TCoords;
+ struct GHS3DEnforcedVertex {
+ string name;
+ string geomEntry;
+ boolean isCompound;
+ TCoords coords;
+ string groupName;
+ double size;
+ };
+
+ typedef sequence<GHS3DEnforcedVertex> GHS3DEnforcedVertexList;
+
+ struct GHS3DEnforcedMesh {
+ string name;
+ string entry;
+ SMESH::ElementType elementType;
+ string groupName;
+ };
+
+ typedef sequence<GHS3DEnforcedMesh> GHS3DEnforcedMeshList;
+
+ /*!
+ * GHS3DPlugin_GHS3D: interface of "Tetrahedron (GHS3D)" algorithm
+ */
+ interface GHS3DPlugin_GHS3D : SMESH::SMESH_3D_Algo
+ {
+ SMESH::SMESH_Mesh importGMFMesh(in string aGMFFileName);
+ };
+
+ /*!
+ * Parameters of "Tetrahedron (GHS3D)" algorithm
+ */
+ interface GHS3DPlugin_Hypothesis : SMESH::SMESH_Hypothesis
+ {
+ /*!
+ * To mesh "holes" in a solid or not. Default is to mesh.
+ */
+ void SetToMeshHoles(in boolean toMesh);
+ boolean GetToMeshHoles();
+ /*!
+ * To make groups of volumes of different domains when mesh is generated from skin.
+ * Default is to make groups.
+ * This option works only (1) for the mesh w/o shape and (2) if GetToMeshHoles() == true
+ */
+ void SetToMakeGroupsOfDomains(in boolean toMakeGroups);
+ boolean GetToMakeGroupsOfDomains();
+ /*!
+ * Maximal size of memory to be used by the algorithm (in Megabytes).
+ * Negative value means not to use this option
+ */
+ void SetMaximumMemory(in double MB) raises (SALOME::SALOME_Exception);
+ double GetMaximumMemory();
+ /*!
+ * Initial size of memory to be used by the algorithm (in Megabytes) in
+ * automatic memory adjustment mode. Default is zero.
+ * Negative value means not to use this option
+ */
+ void SetInitialMemory(in double MB) raises (SALOME::SALOME_Exception);
+ double GetInitialMemory();
+ /*!
+ * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium
+ */
+ void SetOptimizationLevel(in short level) raises (SALOME::SALOME_Exception);
+ short GetOptimizationLevel();
+ /*!
+ * Path to working directory
+ */
+ void SetWorkingDirectory(in string path) raises (SALOME::SALOME_Exception);
+ string GetWorkingDirectory();
+ /*!
+ * To keep working files or remove them. Log file remains in case of errors anyway.
+ */
+ void SetKeepFiles(in boolean toKeep);
+ boolean GetKeepFiles();
+ /*!
+ * Verbose level [0-10]
+ * 0 - no standard output,
+ * 2 - prints the data, quality statistics of the skin and final meshes and
+ * indicates when the final mesh is being saved. In addition the software
+ * gives indication regarding the CPU time.
+ * 10 - same as 2 plus the main steps in the computation, quality statistics
+ * histogram of the skin mesh, quality statistics histogram together with
+ * the characteristics of the final mesh.
+ */
+ void SetVerboseLevel(in short level);
+ short GetVerboseLevel();
+ /*!
+ * To create new nodes
+ */
+ void SetToCreateNewNodes(in boolean toCreate);
+ boolean GetToCreateNewNodes();
+ /*!
+ * To use boundary recovery version which tries to create mesh on a very poor
+ * quality surface mesh
+ */
+ void SetToUseBoundaryRecoveryVersion(in boolean toUse);
+ boolean GetToUseBoundaryRecoveryVersion();
+ /*!
+ * Applies finite-element correction by replacing overconstrained elements where
+ * it is possible. The process is cutting first the overconstrained edges and
+ * second the overconstrained facets. This insure that no edges have two boundary
+ * vertices and that no facets have three boundary vertices.
+ */
+ void SetFEMCorrection(in boolean toUseFem);
+ boolean GetFEMCorrection();
+ /*!
+ * To removes initial central point.
+ */
+ void SetToRemoveCentralPoint(in boolean toRemove);
+ boolean GetToRemoveCentralPoint();
+ /*!
+ * To set hiden/undocumented/advanced options
+ */
+ void SetTextOption(in string option);
+ string GetTextOption();
+ /*!
+ * To define the volumic gradation
+ */
+ void SetGradation(in double gradation);
+ double GetGradation();
+ /*!
+ * Print log in standard output
+ */
+ void SetStandardOutputLog(in boolean logInStandardOutput);
+ boolean GetStandardOutputLog();
+ /*!
+ * Remove log file on success
+ */
+ void SetRemoveLogOnSuccess(in boolean removeLogOnSuccess);
+ boolean GetRemoveLogOnSuccess();
+ /*!
+ * To set an enforced vertex
+ */
+ boolean SetEnforcedVertex(in double x, in double y, in double z, in double size) raises (SALOME::SALOME_Exception);
+ boolean SetEnforcedVertexNamed(in double x, in double y, in double z, in double size, in string vertexName) raises (SALOME::SALOME_Exception);
+ boolean SetEnforcedVertexWithGroup(in double x, in double y, in double z, in double size, in string groupName) raises (SALOME::SALOME_Exception);
+ boolean SetEnforcedVertexNamedWithGroup(in double x, in double y, in double z, in double size, in string vertexName, in string groupName) raises (SALOME::SALOME_Exception);
+ boolean SetEnforcedVertexGeom(in GEOM::GEOM_Object theVertex, in double size) raises (SALOME::SALOME_Exception);
+ boolean SetEnforcedVertexGeomWithGroup(in GEOM::GEOM_Object theVertex, in double size, in string groupName) raises (SALOME::SALOME_Exception);
+ double GetEnforcedVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+ double GetEnforcedVertexGeom(in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception);
+ boolean RemoveEnforcedVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+ boolean RemoveEnforcedVertexGeom(in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception);
+ GHS3DEnforcedVertexList GetEnforcedVertices();
+ void ClearEnforcedVertices();
+ /*!
+ * Set/get/unset an enforced vertex (private method for GUI)
+ */
+ boolean p_SetEnforcedVertex(in double size, in double x, in double y, in double z,
+ in string theVertexName, in string theVertexEntry, in string groupName,
+ in boolean isCompound) raises (SALOME::SALOME_Exception);
+
+ boolean SetEnforcedMesh(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType) raises (SALOME::SALOME_Exception);
+ boolean SetEnforcedMeshWithGroup(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in string groupName) raises (SALOME::SALOME_Exception);
+
+ /* OBSOLETE FUNCTIONS */
+ boolean SetEnforcedMeshSize(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in double size) raises (SALOME::SALOME_Exception);
+ boolean SetEnforcedMeshSizeWithGroup(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in double size, in string groupName) raises (SALOME::SALOME_Exception);
+ /* OBSOLETE FUNCTIONS */
+
+ GHS3DEnforcedMeshList GetEnforcedMeshes();
+ void ClearEnforcedMeshes();
+
+ /*!
+ * Set/get/unset an enforced vertex (private method for GUI)
+ */
+ boolean p_SetEnforcedMesh(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in string name, in string groupName) raises (SALOME::SALOME_Exception);
+ };
+};
+
+#endif
+++ /dev/null
-<?xml version='1.0' encoding='us-ascii'?>
-<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
-<!--
- Copyright (C) 2004-2013 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.
-
- 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
-
--->
-
-<!-- GUI customization for MESH component -->
-
-<meshers>
-
-<meshers-group name="GHS3D"
- resources="GHS3DPlugin"
- idl-module="GHS3DPlugin"
- server-lib="GHS3DEngine"
- gui-lib="GHS3DPluginGUI">
- <hypotheses>
- <hypothesis type="GHS3D_Parameters"
- label-id="GHS3D Parameters"
- icon-id="mesh_hypo_ghs3d.png"
- dim="3">
- <python-wrap>
- <accumulative-methods>
- SetEnforcedVertex,
- SetEnforcedVertexNamed,
- SetEnforcedVertexWithGroup,
- SetEnforcedVertexNamedWithGroup,
- SetEnforcedVertexGeom,
- SetEnforcedVertexGeomWithGroup,
- RemoveEnforcedVertex,
- RemoveEnforcedVertexGeom,
- SetEnforcedMeshWithGroup,
- SetEnforcedMeshSize,
- SetEnforcedMeshSizeWithGroup
- </accumulative-methods>
- </python-wrap>
- </hypothesis>
- </hypotheses>
-
- <algorithms>
- <algorithm type="GHS3D_3D"
- label-id="Tetrahedron (GHS3D)"
- icon-id="mesh_tree_hypo_ghs3d.png"
- input="TRIA,QUAD"
- need-geom="false"
- opt-hypos="GHS3D_Parameters, ViscousLayers"
- dim="3">
- <python-wrap>
- <algo>GHS3D_3D=Tetrahedron(algo=smeshBuilder.GHS3D)</algo>
- <hypo>GHS3D_Parameters=Parameters()</hypo>
- <hypo>ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreFaces())</hypo>
- </python-wrap>
- </algorithm>
-
- </algorithms>
-</meshers-group>
-
-</meshers>
--- /dev/null
+<?xml version='1.0' encoding='us-ascii'?>
+<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
+<!--
+ Copyright (C) 2004-2013 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.
+
+ 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
+
+-->
+
+<!-- GUI customization for MESH component -->
+
+<meshers>
+
+<meshers-group name="GHS3D"
+ resources="GHS3DPlugin"
+ idl-module="GHS3DPlugin"
+ server-lib="GHS3DEngine"
+ gui-lib="GHS3DPluginGUI">
+ <hypotheses>
+ <hypothesis type="GHS3D_Parameters"
+ label-id="GHS3D Parameters"
+ icon-id="mesh_hypo_ghs3d.png"
+ dim="3">
+ <python-wrap>
+ <accumulative-methods>
+ SetEnforcedVertex,
+ SetEnforcedVertexNamed,
+ SetEnforcedVertexWithGroup,
+ SetEnforcedVertexNamedWithGroup,
+ SetEnforcedVertexGeom,
+ SetEnforcedVertexGeomWithGroup,
+ RemoveEnforcedVertex,
+ RemoveEnforcedVertexGeom,
+ SetEnforcedMeshWithGroup,
+ SetEnforcedMeshSize,
+ SetEnforcedMeshSizeWithGroup
+ </accumulative-methods>
+ </python-wrap>
+ </hypothesis>
+ </hypotheses>
+
+ <algorithms>
+ <algorithm type="GHS3D_3D"
+ label-id="Tetrahedron (GHS3D)"
+ icon-id="mesh_tree_hypo_ghs3d.png"
+ input="TRIA,QUAD"
+ need-geom="false"
+ opt-hypos="GHS3D_Parameters, ViscousLayers"
+ dim="3">
+ <python-wrap>
+ <algo>GHS3D_3D=Tetrahedron(algo=smeshBuilder.GHS3D)</algo>
+ <hypo>GHS3D_Parameters=Parameters()</hypo>
+ <hypo>ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreFaces())</hypo>
+ </python-wrap>
+ </algorithm>
+
+ </algorithms>
+</meshers-group>
+
+</meshers>
+++ /dev/null
-# 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
-#
-
-# --- options ---
-# additional include directories
-INCLUDE_DIRECTORIES(
- ${KERNEL_INCLUDE_DIRS}
- ${CAS_INCLUDE_DIRS}
- ${GEOM_INCLUDE_DIRS}
- ${SMESH_INCLUDE_DIRS}
- ${VTK_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${OMNIORB_INCLUDE_DIR}
- ${PROJECT_BINARY_DIR}/idl
-)
-
-# additional preprocessor / compiler flags
-ADD_DEFINITIONS(
- ${OMNIORB_DEFINITIONS}
- ${CAS_DEFINITIONS}
- ${BOOST_DEFINITIONS}
-)
-
-# libraries to link to
-SET(_link_LIBRARIES
- ${CAS_TKBRep}
- ${CAS_TKG2d}
- ${CAS_TKG3d}
- ${CAS_TKTopAlgo}
- ${CAS_TKGeomBase}
- ${CAS_TKGeomAlgo}
- ${CAS_TKCDF}
- ${SMESH_SMESHimpl}
- ${SMESH_SMESHEngine}
- ${SMESH_SMESHDS}
- ${SMESH_SMDS}
- ${SMESH_StdMeshers}
- ${SMESH_MeshDriverGMF}
- ${KERNEL_SalomeGenericObj}
- ${KERNEL_SALOMELocalTrace}
- ${KERNEL_SALOMEBasics}
- ${KERNEL_SalomeNS}
- ${KERNEL_OpUtil}
- SalomeIDLGHS3DPLUGIN
-)
-
-# --- headers ---
-
-# header files
-SET(GHS3DEngine_HEADERS
- GHS3DPlugin_Defs.hxx
- GHS3DPlugin_GHS3D.hxx
- GHS3DPlugin_GHS3D_i.hxx
- GHS3DPlugin_Hypothesis.hxx
- GHS3DPlugin_Hypothesis_i.hxx
-)
-
-# --- sources ---
-
-# sources / static
-SET(GHS3DEngine_SOURCES
- GHS3DPlugin_GHS3D.cxx
- GHS3DPlugin_GHS3D_i.cxx
- GHS3DPlugin_i.cxx
- GHS3DPlugin_Hypothesis.cxx
- GHS3DPlugin_Hypothesis_i.cxx
-)
-
-# --- scripts ---
-
-# scripts / static
-SET(_bin_SCRIPTS
- __init__.py
- GHS3DPluginBuilder.py
-)
-
-# --- rules ---
-
-ADD_LIBRARY(GHS3DEngine ${GHS3DEngine_SOURCES})
-TARGET_LINK_LIBRARIES(GHS3DEngine ${_link_LIBRARIES} )
-INSTALL(TARGETS GHS3DEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
-
-INSTALL(FILES ${GHS3DEngine_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-
-SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/GHS3DPlugin)
+++ /dev/null
-# Copyright (C) 2007-2013 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.
-#
-# 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
-#
-
-##
-# @package GHS3DPluginBuilder
-# Python API for the GHS3D meshing plug-in module.
-
-from salome.smesh.smesh_algorithm import Mesh_Algorithm
-from salome.smesh.smeshBuilder import AssureGeomPublished
-
-# import GHS3DPlugin module if possible
-noGHS3DPlugin = 0
-try:
- import GHS3DPlugin
-except ImportError:
- noGHS3DPlugin = 1
- pass
-
-# Optimization level of GHS3D
-# V3.1
-None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization = 0,1,2,3
-# V4.1 (partialy redefines V3.1). Issue 0020574
-None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization, Strong_Optimization = 0,1,2,3,4
-
-#----------------------------
-# Mesh algo type identifiers
-#----------------------------
-
-## Algorithm type: GHS3D tetrahedron 3D algorithm, see GHS3D_Algorithm
-GHS3D = "GHS3D_3D"
-
-## Tetrahedron GHS3D 3D algorithm
-#
-# It can be created by calling smeshBuilder.Mesh.Tetrahedron( smeshBuilder.GHS3D, geom=0 )
-class GHS3D_Algorithm(Mesh_Algorithm):
-
- ## name of the dynamic method in smeshBuilder.Mesh class
- # @internal
- meshMethod = "Tetrahedron"
- ## type of algorithm used with helper function in smeshBuilder.Mesh class
- # @internal
- algoType = GHS3D
- ## doc string of the method in smeshBuilder.Mesh class
- # @internal
- docHelper = "Creates tetrahedron 3D algorithm for volumes"
-
- ## Private constructor.
- # @param mesh parent mesh object algorithm is assigned to
- # @param geom geometry (shape/sub-shape) algorithm is assigned to;
- # if it is @c 0 (default), the algorithm is assigned to the main shape
- def __init__(self, mesh, geom=0):
- Mesh_Algorithm.__init__(self)
- if noGHS3DPlugin: print "Warning: GHS3DPlugin module unavailable"
- self.Create(mesh, geom, self.algoType, "libGHS3DEngine.so")
- self.params = None
- pass
-
- ## Defines hypothesis having several parameters
- # @return hypothesis object
- def Parameters(self):
- if not self.params:
- self.params = self.Hypothesis("GHS3D_Parameters", [],
- "libGHS3DEngine.so", UseExisting=0)
- pass
- return self.params
-
- ## To mesh "holes" in a solid or not. Default is to mesh.
- # @param toMesh "mesh holes" flag value
- def SetToMeshHoles(self, toMesh):
- self.Parameters().SetToMeshHoles(toMesh)
- pass
-
- ## To make groups of volumes of different domains when mesh is generated from skin.
- # Default is to make groups.
- # This option works only (1) for the mesh w/o shape and (2) if GetToMeshHoles() == true
- # @param toMesh "mesh holes" flag value
- def SetToMakeGroupsOfDomains(self, toMakeGroups):
- self.Parameters().SetToMakeGroupsOfDomains(toMakeGroups)
- pass
-
- ## Set Optimization level:
- # @param level optimization level, one of the following values
- # - None_Optimization
- # - Light_Optimization
- # - Standard_Optimization
- # - StandardPlus_Optimization
- # - Strong_Optimization.
- # .
- # Default is Standard_Optimization
- def SetOptimizationLevel(self, level):
- self.Parameters().SetOptimizationLevel(level)
- pass
-
- ## Set maximal size of memory to be used by the algorithm (in Megabytes).
- # @param MB maximal size of memory
- def SetMaximumMemory(self, MB):
- self.Parameters().SetMaximumMemory(MB)
- pass
-
- ## Set initial size of memory to be used by the algorithm (in Megabytes) in
- # automatic memory adjustment mode.
- # @param MB initial size of memory
- def SetInitialMemory(self, MB):
- self.Parameters().SetInitialMemory(MB)
- pass
-
- ## Set path to working directory.
- # @param path working directory
- def SetWorkingDirectory(self, path):
- self.Parameters().SetWorkingDirectory(path)
- pass
-
- ## To keep working files or remove them.
- # @param toKeep "keep working files" flag value
- def SetKeepFiles(self, toKeep):
- self.Parameters().SetKeepFiles(toKeep)
- pass
-
- ## Remove or not the log file (if any) in case of successful computation.
- # The log file remains in case of errors anyway. If
- # the "keep working files" flag is set to true, this option
- # has no effect.
- # @param toRemove "remove log on success" flag value
- def SetRemoveLogOnSuccess(self, toRemove):
- self.Parameters().SetRemoveLogOnSuccess(toRemove)
- pass
-
- ## Print the the log in a file. If set to false, the
- # log is printed on the standard output
- # @param toPrintLogInFile "print log in a file" flag value
- def SetPrintLogInFile(self, toPrintLogInFile):
- self.Parameters().SetStandardOutputLog(not toPrintLogInFile)
- pass
-
- ## Set verbosity level [0-10].
- # @param level verbosity level
- # - 0 - no standard output,
- # - 2 - prints the data, quality statistics of the skin and final meshes and
- # indicates when the final mesh is being saved. In addition the software
- # gives indication regarding the CPU time.
- # - 10 - same as 2 plus the main steps in the computation, quality statistics
- # histogram of the skin mesh, quality statistics histogram together with
- # the characteristics of the final mesh.
- def SetVerboseLevel(self, level):
- self.Parameters().SetVerboseLevel(level)
- pass
-
- ## To create new nodes.
- # @param toCreate "create new nodes" flag value
- def SetToCreateNewNodes(self, toCreate):
- self.Parameters().SetToCreateNewNodes(toCreate)
- pass
-
- ## To use boundary recovery version which tries to create mesh on a very poor
- # quality surface mesh.
- # @param toUse "use boundary recovery version" flag value
- def SetToUseBoundaryRecoveryVersion(self, toUse):
- self.Parameters().SetToUseBoundaryRecoveryVersion(toUse)
- pass
-
- ## Applies finite-element correction by replacing overconstrained elements where
- # it is possible. The process is cutting first the overconstrained edges and
- # second the overconstrained facets. This insure that no edges have two boundary
- # vertices and that no facets have three boundary vertices.
- # @param toUseFem "apply finite-element correction" flag value
- def SetFEMCorrection(self, toUseFem):
- self.Parameters().SetFEMCorrection(toUseFem)
- pass
-
- ## To remove initial central point.
- # @param toRemove "remove initial central point" flag value
- def SetToRemoveCentralPoint(self, toRemove):
- self.Parameters().SetToRemoveCentralPoint(toRemove)
- pass
-
- ## To set an enforced vertex.
- # @param x : x coordinate
- # @param y : y coordinate
- # @param z : z coordinate
- # @param size : size of 1D element around enforced vertex
- # @param vertexName : name of the enforced vertex
- # @param groupName : name of the group
- def SetEnforcedVertex(self, x, y, z, size, vertexName = "", groupName = ""):
- if vertexName == "":
- if groupName == "":
- return self.Parameters().SetEnforcedVertex(x, y, z, size)
- else:
- return self.Parameters().SetEnforcedVertexWithGroup(x, y, z, size, groupName)
- pass
- else:
- if groupName == "":
- return self.Parameters().SetEnforcedVertexNamed(x, y, z, size, vertexName)
- else:
- return self.Parameters().SetEnforcedVertexNamedWithGroup(x, y, z, size, vertexName, groupName)
- pass
- pass
-
- ## To set an enforced vertex given a GEOM vertex, group or compound.
- # @param theVertex : GEOM vertex (or group, compound) to be projected on theFace.
- # @param size : size of 1D element around enforced vertex
- # @param groupName : name of the group
- def SetEnforcedVertexGeom(self, theVertex, size, groupName = ""):
- AssureGeomPublished( self.mesh, theVertex )
- if groupName == "":
- return self.Parameters().SetEnforcedVertexGeom(theVertex, size)
- else:
- return self.Parameters().SetEnforcedVertexGeomWithGroup(theVertex, size, groupName)
- pass
-
- ## To remove an enforced vertex.
- # @param x : x coordinate
- # @param y : y coordinate
- # @param z : z coordinate
- def RemoveEnforcedVertex(self, x, y, z):
- return self.Parameters().RemoveEnforcedVertex(x, y, z)
-
- ## To remove an enforced vertex given a GEOM vertex, group or compound.
- # @param theVertex : GEOM vertex (or group, compound) to be projected on theFace.
- def RemoveEnforcedVertexGeom(self, theVertex):
- AssureGeomPublished( self.mesh, theVertex )
- return self.Parameters().RemoveEnforcedVertexGeom(theVertex)
-
- ## To set an enforced mesh with given size and add the enforced elements in the group "groupName".
- # @param theSource : source mesh which provides constraint elements/nodes
- # @param elementType : SMESH.ElementType (NODE, EDGE or FACE)
- # @param size : size of elements around enforced elements. Unused if -1.
- # @param groupName : group in which enforced elements will be added. Unused if "".
- def SetEnforcedMesh(self, theSource, elementType, size = -1, groupName = ""):
- if size < 0:
- if groupName == "":
- return self.Parameters().SetEnforcedMesh(theSource, elementType)
- else:
- return self.Parameters().SetEnforcedMeshWithGroup(theSource, elementType, groupName)
- pass
- else:
- if groupName == "":
- return self.Parameters().SetEnforcedMeshSize(theSource, elementType, size)
- else:
- return self.Parameters().SetEnforcedMeshSizeWithGroup(theSource, elementType, size, groupName)
- pass
- pass
-
- ## Sets command line option as text.
- # @param option command line option
- def SetTextOption(self, option):
- self.Parameters().SetTextOption(option)
- pass
-
- pass # end of GHS3D_Algorithm class
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-//=============================================================================
-// File : GHS3DPlugin_Defs.hxx
-// Author : Alexander A. BORODIN
-//
-#ifndef _GHS3DPlugin_DEFS_HXX_
-#define _GHS3DPlugin_DEFS_HXX_
-
-#ifdef WIN32
- #if defined GHS3DPLUGIN_EXPORTS || defined GHS3DEngine_EXPORTS
- #define GHS3DPLUGIN_EXPORT __declspec( dllexport )
- #else
- #define GHS3DPLUGIN_EXPORT __declspec( dllimport )
- #endif
-#else
- #define GHS3DPLUGIN_EXPORT
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-//=============================================================================
-// File : GHS3DPlugin_GHS3D.cxx
-// Created :
-// Author : Edward AGAPOV, modified by Lioka RAZAFINDRAZAKA (CEA) 09/02/2007
-// Project : SALOME
-//=============================================================================
-//
-#include "GHS3DPlugin_GHS3D.hxx"
-#include "GHS3DPlugin_Hypothesis.hxx"
-
-#include <SMDS_FaceOfNodes.hxx>
-#include <SMDS_MeshElement.hxx>
-#include <SMDS_MeshNode.hxx>
-#include <SMDS_VolumeOfNodes.hxx>
-#include <SMESHDS_Group.hxx>
-#include <SMESH_Comment.hxx>
-#include <SMESH_Group.hxx>
-#include <SMESH_HypoFilter.hxx>
-#include <SMESH_Mesh.hxx>
-#include <SMESH_MeshAlgos.hxx>
-#include <SMESH_MeshEditor.hxx>
-#include <SMESH_MesherHelper.hxx>
-#include <SMESH_OctreeNode.hxx>
-#include <SMESH_subMeshEventListener.hxx>
-#include <StdMeshers_QuadToTriaAdaptor.hxx>
-#include <StdMeshers_ViscousLayers.hxx>
-
-#include <BRepAdaptor_Surface.hxx>
-#include <BRepBndLib.hxx>
-#include <BRepBuilderAPI_MakeVertex.hxx>
-#include <BRepClass3d.hxx>
-#include <BRepClass3d_SolidClassifier.hxx>
-#include <BRepExtrema_DistShapeShape.hxx>
-#include <BRepGProp.hxx>
-#include <BRepTools.hxx>
-#include <BRep_Tool.hxx>
-#include <Bnd_Box.hxx>
-#include <GProp_GProps.hxx>
-#include <GeomAPI_ProjectPointOnSurf.hxx>
-#include <OSD_File.hxx>
-#include <Precision.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_ProgramError.hxx>
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Solid.hxx>
-
-#include <Basics_Utils.hxx>
-#include <utilities.h>
-
-#ifdef WIN32
-#include <io.h>
-#else
-#include <sys/sysinfo.h>
-#endif
-#include <algorithm>
-
-#define castToNode(n) static_cast<const SMDS_MeshNode *>( n );
-
-extern "C"
-{
-#ifndef WIN32
-#include <unistd.h>
-#include <sys/mman.h>
-#endif
-#include <sys/stat.h>
-#include <fcntl.h>
-}
-
-#define HOLE_ID -1
-
-typedef const list<const SMDS_MeshFace*> TTriaList;
-
-static const char theDomainGroupNamePrefix[] = "Domain_";
-
-static void removeFile( const TCollection_AsciiString& fileName )
-{
- try {
- OSD_File( fileName ).Remove();
- }
- catch ( Standard_ProgramError ) {
- MESSAGE("Can't remove file: " << fileName.ToCString() << " ; file does not exist or permission denied");
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D(int hypId, int studyId, SMESH_Gen* gen)
- : SMESH_3D_Algo(hypId, studyId, gen)
-{
- MESSAGE("GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D");
- _name = Name();
- _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type
- _onlyUnaryInput = false; // Compute() will be called on a compound of solids
- _iShape=0;
- _nbShape=0;
- _compatibleHypothesis.push_back( GHS3DPlugin_Hypothesis::GetHypType());
- _compatibleHypothesis.push_back( StdMeshers_ViscousLayers::GetHypType() );
- _requireShape = false; // can work without shape_studyId
-
- smeshGen_i = SMESH_Gen_i::GetSMESHGen();
- CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager");
- SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
-
- MESSAGE("studyid = " << _studyId);
-
- myStudy = NULL;
- myStudy = aStudyMgr->GetStudyByID(_studyId);
- if (myStudy)
- MESSAGE("myStudy->StudyId() = " << myStudy->StudyId());
-
- _compute_canceled = false;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-GHS3DPlugin_GHS3D::~GHS3DPlugin_GHS3D()
-{
- MESSAGE("GHS3DPlugin_GHS3D::~GHS3DPlugin_GHS3D");
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-bool GHS3DPlugin_GHS3D::CheckHypothesis ( SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape,
- Hypothesis_Status& aStatus )
-{
- aStatus = SMESH_Hypothesis::HYP_OK;
-
- _hyp = 0;
- _viscousLayersHyp = 0;
- _keepFiles = false;
- _removeLogOnSuccess = true;
- _logInStandardOutput = false;
-
- const list <const SMESHDS_Hypothesis * >& hyps =
- GetUsedHypothesis(aMesh, aShape, /*ignoreAuxiliary=*/false);
- list <const SMESHDS_Hypothesis* >::const_iterator h = hyps.begin();
- for ( ; h != hyps.end(); ++h )
- {
- if ( !_hyp )
- _hyp = dynamic_cast< const GHS3DPlugin_Hypothesis*> ( *h );
- if ( !_viscousLayersHyp )
- _viscousLayersHyp = dynamic_cast< const StdMeshers_ViscousLayers*> ( *h );
- }
- if ( _hyp )
- {
- _keepFiles = _hyp->GetKeepFiles();
- _removeLogOnSuccess = _hyp->GetRemoveLogOnSuccess();
- _logInStandardOutput = _hyp->GetStandardOutputLog();
- }
-
- return true;
-}
-
-
-//=======================================================================
-//function : entryToShape
-//purpose :
-//=======================================================================
-
-TopoDS_Shape GHS3DPlugin_GHS3D::entryToShape(std::string entry)
-{
- MESSAGE("GHS3DPlugin_GHS3D::entryToShape "<<entry );
- GEOM::GEOM_Object_var aGeomObj;
- TopoDS_Shape S = TopoDS_Shape();
- SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() );
- if (!aSObj->_is_nil() ) {
- CORBA::Object_var obj = aSObj->GetObject();
- aGeomObj = GEOM::GEOM_Object::_narrow(obj);
- aSObj->UnRegister();
- }
- if ( !aGeomObj->_is_nil() )
- S = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
- return S;
-}
-
-//=======================================================================
-//function : findShape
-//purpose :
-//=======================================================================
-
-static TopoDS_Shape findShape(const SMDS_MeshNode *aNode[],
- TopoDS_Shape aShape,
- const TopoDS_Shape shape[],
- double** box,
- const int nShape,
- TopAbs_State * state = 0)
-{
- gp_XYZ aPnt(0,0,0);
- int j, iShape, nbNode = 4;
-
- for ( j=0; j<nbNode; j++ ) {
- gp_XYZ p ( aNode[j]->X(), aNode[j]->Y(), aNode[j]->Z() );
- if ( aNode[j]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_3DSPACE ) {
- aPnt = p;
- break;
- }
- aPnt += p / nbNode;
- }
-
- BRepClass3d_SolidClassifier SC (aShape, aPnt, Precision::Confusion());
- if (state) *state = SC.State();
- if ( SC.State() != TopAbs_IN || aShape.IsNull() || aShape.ShapeType() != TopAbs_SOLID) {
- for (iShape = 0; iShape < nShape; iShape++) {
- aShape = shape[iShape];
- if ( !( aPnt.X() < box[iShape][0] || box[iShape][1] < aPnt.X() ||
- aPnt.Y() < box[iShape][2] || box[iShape][3] < aPnt.Y() ||
- aPnt.Z() < box[iShape][4] || box[iShape][5] < aPnt.Z()) ) {
- BRepClass3d_SolidClassifier SC (aShape, aPnt, Precision::Confusion());
- if (state) *state = SC.State();
- if (SC.State() == TopAbs_IN)
- break;
- }
- }
- }
- return aShape;
-}
-
-//=======================================================================
-//function : readMapIntLine
-//purpose :
-//=======================================================================
-
-static char* readMapIntLine(char* ptr, int tab[]) {
- long int intVal;
- std::cout << std::endl;
-
- for ( int i=0; i<17; i++ ) {
- intVal = strtol(ptr, &ptr, 10);
- if ( i < 3 )
- tab[i] = intVal;
- }
- return ptr;
-}
-
-//================================================================================
-/*!
- * \brief returns true if a triangle defined by the nodes is a temporary face on a
- * side facet of pyramid and defines sub-domian inside the pyramid
- */
-//================================================================================
-
-static bool isTmpFace(const SMDS_MeshNode* node1,
- const SMDS_MeshNode* node2,
- const SMDS_MeshNode* node3)
-{
- // find a pyramid sharing the 3 nodes
- //const SMDS_MeshElement* pyram = 0;
- SMDS_ElemIteratorPtr vIt1 = node1->GetInverseElementIterator(SMDSAbs_Volume);
- while ( vIt1->more() )
- {
- const SMDS_MeshElement* pyram = vIt1->next();
- if ( pyram->NbCornerNodes() != 5 ) continue;
- int i2, i3;
- if ( (i2 = pyram->GetNodeIndex( node2 )) >= 0 &&
- (i3 = pyram->GetNodeIndex( node3 )) >= 0 )
- {
- // Triangle defines sub-domian inside the pyramid if it's
- // normal points out of the pyram
-
- // make i2 and i3 hold indices of base nodes of the pyram while
- // keeping the nodes order in the triangle
- const int iApex = 4;
- if ( i2 == iApex )
- i2 = i3, i3 = pyram->GetNodeIndex( node1 );
- else if ( i3 == iApex )
- i3 = i2, i2 = pyram->GetNodeIndex( node1 );
-
- int i3base = (i2+1) % 4; // next index after i2 within the pyramid base
- return ( i3base != i3 );
- }
- }
- return false;
-}
-
-//=======================================================================
-//function : findShapeID
-//purpose : find the solid corresponding to GHS3D sub-domain following
-// the technique proposed in GHS3D manual (available within
-// ghs3d installation) in chapter "B.4 Subdomain (sub-region) assignment".
-// In brief: normal of the triangle defined by the given nodes
-// points out of the domain it is associated to
-//=======================================================================
-
-static int findShapeID(SMESH_Mesh& mesh,
- const SMDS_MeshNode* node1,
- const SMDS_MeshNode* node2,
- const SMDS_MeshNode* node3,
- const bool toMeshHoles)
-{
- const int invalidID = 0;
- SMESHDS_Mesh* meshDS = mesh.GetMeshDS();
-
- // face the nodes belong to
- vector<const SMDS_MeshNode *> nodes(3);
- nodes[0] = node1;
- nodes[1] = node2;
- nodes[2] = node3;
- const SMDS_MeshElement * face = meshDS->FindElement( nodes, SMDSAbs_Face, /*noMedium=*/true);
- if ( !face )
- return isTmpFace(node1, node2, node3) ? HOLE_ID : invalidID;
-#ifdef _DEBUG_
- std::cout << "bnd face " << face->GetID() << " - ";
-#endif
- // geom face the face assigned to
- SMESH_MeshEditor editor(&mesh);
- int geomFaceID = editor.FindShape( face );
- if ( !geomFaceID )
- return isTmpFace(node1, node2, node3) ? HOLE_ID : invalidID;
- TopoDS_Shape shape = meshDS->IndexToShape( geomFaceID );
- if ( shape.IsNull() || shape.ShapeType() != TopAbs_FACE )
- return invalidID;
- TopoDS_Face geomFace = TopoDS::Face( shape );
-
- // solids bounded by geom face
- TopTools_IndexedMapOfShape solids, shells;
- TopTools_ListIteratorOfListOfShape ansIt = mesh.GetAncestors(geomFace);
- for ( ; ansIt.More(); ansIt.Next() ) {
- switch ( ansIt.Value().ShapeType() ) {
- case TopAbs_SOLID:
- solids.Add( ansIt.Value() ); break;
- case TopAbs_SHELL:
- shells.Add( ansIt.Value() ); break;
- default:;
- }
- }
- // analyse found solids
- if ( solids.Extent() == 0 || shells.Extent() == 0)
- return invalidID;
-
- const TopoDS_Solid& solid1 = TopoDS::Solid( solids(1) );
- if ( solids.Extent() == 1 )
- {
- if ( toMeshHoles )
- return meshDS->ShapeToIndex( solid1 );
-
- // - Are we at a hole boundary face?
- if ( shells(1).IsSame( BRepClass3d::OuterShell( solid1 )) )
- { // - No, but maybe a hole is bound by two shapes? Does shells(1) touches another shell?
- bool touch = false;
- TopExp_Explorer eExp( shells(1), TopAbs_EDGE );
- // check if any edge of shells(1) belongs to another shell
- for ( ; eExp.More() && !touch; eExp.Next() ) {
- ansIt = mesh.GetAncestors( eExp.Current() );
- for ( ; ansIt.More() && !touch; ansIt.Next() ) {
- if ( ansIt.Value().ShapeType() == TopAbs_SHELL )
- touch = ( !ansIt.Value().IsSame( shells(1) ));
- }
- }
- if (!touch)
- return meshDS->ShapeToIndex( solid1 );
- }
- }
- // find orientation of geom face within the first solid
- TopExp_Explorer fExp( solid1, TopAbs_FACE );
- for ( ; fExp.More(); fExp.Next() )
- if ( geomFace.IsSame( fExp.Current() )) {
- geomFace = TopoDS::Face( fExp.Current() );
- break;
- }
- if ( !fExp.More() )
- return invalidID; // face not found
-
- // normale to triangle
- gp_Pnt node1Pnt ( node1->X(), node1->Y(), node1->Z() );
- gp_Pnt node2Pnt ( node2->X(), node2->Y(), node2->Z() );
- gp_Pnt node3Pnt ( node3->X(), node3->Y(), node3->Z() );
- gp_Vec vec12( node1Pnt, node2Pnt );
- gp_Vec vec13( node1Pnt, node3Pnt );
- gp_Vec meshNormal = vec12 ^ vec13;
- if ( meshNormal.SquareMagnitude() < DBL_MIN )
- return invalidID;
-
- // get normale to geomFace at any node
- bool geomNormalOK = false;
- gp_Vec geomNormal;
- SMESH_MesherHelper helper( mesh ); helper.SetSubShape( geomFace );
- for ( int i = 0; !geomNormalOK && i < 3; ++i )
- {
- // find UV of i-th node on geomFace
- const SMDS_MeshNode* nNotOnSeamEdge = 0;
- if ( helper.IsSeamShape( nodes[i]->getshapeId() )) {
- if ( helper.IsSeamShape( nodes[(i+1)%3]->getshapeId() ))
- nNotOnSeamEdge = nodes[(i+2)%3];
- else
- nNotOnSeamEdge = nodes[(i+1)%3];
- }
- bool uvOK;
- gp_XY uv = helper.GetNodeUV( geomFace, nodes[i], nNotOnSeamEdge, &uvOK );
- // check that uv is correct
- if (uvOK) {
- double tol = 1e-6;
- TopoDS_Shape nodeShape = helper.GetSubShapeByNode( nodes[i], meshDS );
- if ( !nodeShape.IsNull() )
- switch ( nodeShape.ShapeType() )
- {
- case TopAbs_FACE: tol = BRep_Tool::Tolerance( TopoDS::Face( nodeShape )); break;
- case TopAbs_EDGE: tol = BRep_Tool::Tolerance( TopoDS::Edge( nodeShape )); break;
- case TopAbs_VERTEX: tol = BRep_Tool::Tolerance( TopoDS::Vertex( nodeShape )); break;
- default:;
- }
- gp_Pnt nodePnt ( nodes[i]->X(), nodes[i]->Y(), nodes[i]->Z() );
- BRepAdaptor_Surface surface( geomFace );
- uvOK = ( nodePnt.Distance( surface.Value( uv.X(), uv.Y() )) < 2 * tol );
- if ( uvOK ) {
- // normale to geomFace at UV
- gp_Vec du, dv;
- surface.D1( uv.X(), uv.Y(), nodePnt, du, dv );
- geomNormal = du ^ dv;
- if ( geomFace.Orientation() == TopAbs_REVERSED )
- geomNormal.Reverse();
- geomNormalOK = ( geomNormal.SquareMagnitude() > DBL_MIN * 1e3 );
- }
- }
- }
- if ( !geomNormalOK)
- return invalidID;
-
- // compare normals
- bool isReverse = ( meshNormal * geomNormal ) < 0;
- if ( !isReverse )
- return meshDS->ShapeToIndex( solid1 );
-
- if ( solids.Extent() == 1 )
- return HOLE_ID; // we are inside a hole
- else
- return meshDS->ShapeToIndex( solids(2) );
-}
-
-// //=======================================================================
-// //function : countShape
-// //purpose :
-// //=======================================================================
-//
-// template < class Mesh, class Shape >
-// static int countShape( Mesh* mesh, Shape shape ) {
-// TopExp_Explorer expShape ( mesh->ShapeToMesh(), shape );
-// TopTools_MapOfShape mapShape;
-// int nbShape = 0;
-// for ( ; expShape.More(); expShape.Next() ) {
-// if (mapShape.Add(expShape.Current())) {
-// nbShape++;
-// }
-// }
-// return nbShape;
-// }
-//
-// //=======================================================================
-// //function : getShape
-// //purpose :
-// //=======================================================================
-//
-// template < class Mesh, class Shape, class Tab >
-// void getShape(Mesh* mesh, Shape shape, Tab *t_Shape) {
-// TopExp_Explorer expShape ( mesh->ShapeToMesh(), shape );
-// TopTools_MapOfShape mapShape;
-// for ( int i=0; expShape.More(); expShape.Next() ) {
-// if (mapShape.Add(expShape.Current())) {
-// t_Shape[i] = expShape.Current();
-// i++;
-// }
-// }
-// return;
-// }
-//
-// // //=======================================================================
-// // //function : findEdgeID
-// // //purpose :
-// // //=======================================================================
-//
-// static int findEdgeID(const SMDS_MeshNode* aNode,
-// const SMESHDS_Mesh* theMesh,
-// const int nEdge,
-// const TopoDS_Shape* t_Edge) {
-//
-// TopoDS_Shape aPntShape, foundEdge;
-// TopoDS_Vertex aVertex;
-// gp_Pnt aPnt( aNode->X(), aNode->Y(), aNode->Z() );
-//
-// int foundInd, ind;
-// double nearest = RealLast(), *t_Dist;
-// double epsilon = Precision::Confusion();
-//
-// t_Dist = new double[ nEdge ];
-// aPntShape = BRepBuilderAPI_MakeVertex( aPnt ).Shape();
-// aVertex = TopoDS::Vertex( aPntShape );
-//
-// for ( ind=0; ind < nEdge; ind++ ) {
-// BRepExtrema_DistShapeShape aDistance ( aVertex, t_Edge[ind] );
-// t_Dist[ind] = aDistance.Value();
-// if ( t_Dist[ind] < nearest ) {
-// nearest = t_Dist[ind];
-// foundEdge = t_Edge[ind];
-// foundInd = ind;
-// if ( nearest < epsilon )
-// ind = nEdge;
-// }
-// }
-//
-// delete [] t_Dist;
-// return theMesh->ShapeToIndex( foundEdge );
-// }
-//
-//
-// // =======================================================================
-// // function : readGMFFile
-// // purpose : read GMF file with geometry associated to mesh
-// // =======================================================================
-//
-// static bool readGMFFile(const int fileOpen,
-// const char* theFileName,
-// SMESH_Mesh& theMesh,
-// const int nbShape,
-// const TopoDS_Shape* tabShape,
-// double** tabBox,
-// map <int,const SMDS_MeshNode*>& theGhs3dIdToNodeMap,
-// bool toMeshHoles,
-// int nbEnforcedVertices,
-// int nbEnforcedNodes)
-// {
-// TopoDS_Shape aShape;
-// TopoDS_Vertex aVertex;
-// SMESHDS_Mesh* theMeshDS = theMesh.GetMeshDS();
-// int nbElem = 0, nbRef = 0, IdShapeRef = 1;
-// int *tabID;
-// int aGMFNodeID = 0;
-// int compoundID =
-// nbShape ? theMeshDS->ShapeToIndex( tabShape[0] ) : theMeshDS->ShapeToIndex( theMeshDS->ShapeToMesh() );
-// int tetraShapeID = compoundID;
-// double epsilon = Precision::Confusion();
-// int *nodeAssigne, *GMFNodeAssigne;
-// SMDS_MeshNode** GMFNode;
-// TopoDS_Shape *tabCorner, *tabEdge;
-// std::map <GmfKwdCod,int> tabRef;
-//
-//
-// int ver, dim;
-// MESSAGE("Read " << theFileName << " file");
-// int InpMsh = GmfOpenMesh(theFileName, GmfRead, &ver, &dim);
-// if (!InpMsh)
-// return false;
-//
-// // ===========================
-// // Fill the tabID array: BEGIN
-// // ===========================
-//
-// /*
-// The output .mesh file does not contain yet the subdomain-info (Ghs3D 4.2)
-// */
-// Kernel_Utils::Localizer loc;
-// struct stat status;
-// size_t length;
-//
-// char *ptr, *mapPtr;
-// char *tetraPtr;
-// int *tab = new int[3];
-//
-// // Read the file state
-// fstat(fileOpen, &status);
-// length = status.st_size;
-//
-// // Mapping the result file into memory
-// #ifdef WIN32
-// HANDLE fd = CreateFile(theFileName, GENERIC_READ, FILE_SHARE_READ,
-// NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-// HANDLE hMapObject = CreateFileMapping(fd, NULL, PAGE_READONLY,
-// 0, (DWORD)length, NULL);
-// ptr = ( char* ) MapViewOfFile(hMapObject, FILE_MAP_READ, 0, 0, 0 );
-// #else
-// ptr = (char *) mmap(0,length,PROT_READ,MAP_PRIVATE,fileOpen,0);
-// #endif
-// mapPtr = ptr;
-//
-// ptr = readMapIntLine(ptr, tab);
-// tetraPtr = ptr;
-//
-// nbElem = tab[0];
-// int nbNodes = tab[1];
-//
-// for (int i=0; i < 4*nbElem; i++)
-// strtol(ptr, &ptr, 10);
-//
-// for (int iNode=1; iNode <= nbNodes; iNode++)
-// for (int iCoor=0; iCoor < 3; iCoor++)
-// strtod(ptr, &ptr);
-//
-//
-// // Reading the number of triangles which corresponds to the number of sub-domains
-// int nbTriangle = strtol(ptr, &ptr, 10);
-//
-//
-// // The keyword does not exist yet => to update when it is created
-// // int nbSubdomains = GmfStatKwd(InpMsh, GmfSubdomain);
-// // int id_tri[3];
-//
-//
-// tabID = new int[nbTriangle];
-// for (int i=0; i < nbTriangle; i++) {
-// tabID[i] = 0;
-// int nodeId1, nodeId2, nodeId3;
-// // find the solid corresponding to GHS3D sub-domain following
-// // the technique proposed in GHS3D manual in chapter
-// // "B.4 Subdomain (sub-region) assignment"
-//
-// nodeId1 = strtol(ptr, &ptr, 10);
-// nodeId2 = strtol(ptr, &ptr, 10);
-// nodeId3 = strtol(ptr, &ptr, 10);
-//
-// // // The keyword does not exist yet => to update when it is created
-// // GmfGetLin(InpMsh, GmfSubdomain, &id_tri[0], &id_tri[1], &id_tri[2]);
-// // nodeId1 = id_tri[0];
-// // nodeId2 = id_tri[1];
-// // nodeId3 = id_tri[2];
-//
-// if ( nbTriangle > 1 ) {
-// // get the nodes indices
-// const SMDS_MeshNode* n1 = theGhs3dIdToNodeMap[ nodeId1 ];
-// const SMDS_MeshNode* n2 = theGhs3dIdToNodeMap[ nodeId2 ];
-// const SMDS_MeshNode* n3 = theGhs3dIdToNodeMap[ nodeId3 ];
-// try {
-// OCC_CATCH_SIGNALS;
-// tabID[i] = findShapeID( theMesh, n1, n2, n3, toMeshHoles );
-// // -- 0020330: Pb with ghs3d as a submesh
-// // check that found shape is to be meshed
-// if ( tabID[i] > 0 ) {
-// const TopoDS_Shape& foundShape = theMeshDS->IndexToShape( tabID[i] );
-// bool isToBeMeshed = false;
-// for ( int iS = 0; !isToBeMeshed && iS < nbShape; ++iS )
-// isToBeMeshed = foundShape.IsSame( tabShape[ iS ]);
-// if ( !isToBeMeshed )
-// tabID[i] = HOLE_ID;
-// }
-// // END -- 0020330: Pb with ghs3d as a submesh
-// #ifdef _DEBUG_
-// std::cout << i+1 << " subdomain: findShapeID() returns " << tabID[i] << std::endl;
-// #endif
-// }
-// catch ( Standard_Failure & ex)
-// {
-// #ifdef _DEBUG_
-// std::cout << i+1 << " subdomain: Exception caugt: " << ex.GetMessageString() << std::endl;
-// #endif
-// }
-// catch (...) {
-// #ifdef _DEBUG_
-// std::cout << i+1 << " subdomain: unknown exception caught " << std::endl;
-// #endif
-// }
-// }
-// }
-//
-// // ===========================
-// // Fill the tabID array: END
-// // ===========================
-//
-//
-// tabRef[GmfVertices] = 3;
-// tabRef[GmfCorners] = 1;
-// tabRef[GmfEdges] = 2;
-// tabRef[GmfRidges] = 1;
-// tabRef[GmfTriangles] = 3;
-// // tabRef[GmfQuadrilaterals] = 4;
-// tabRef[GmfTetrahedra] = 4;
-// // tabRef[GmfHexahedra] = 8;
-//
-// SMDS_NodeIteratorPtr itOnGMFInputNode = theMeshDS->nodesIterator();
-// while ( itOnGMFInputNode->more() )
-// theMeshDS->RemoveNode( itOnGMFInputNode->next() );
-//
-//
-// int nbVertices = GmfStatKwd(InpMsh, GmfVertices);
-// int nbCorners = max(countShape( theMeshDS, TopAbs_VERTEX ) , GmfStatKwd(InpMsh, GmfCorners));
-// int nbShapeEdge = countShape( theMeshDS, TopAbs_EDGE );
-//
-// tabCorner = new TopoDS_Shape[ nbCorners ];
-// tabEdge = new TopoDS_Shape[ nbShapeEdge ];
-// nodeAssigne = new int[ nbVertices + 1 ];
-// GMFNodeAssigne = new int[ nbVertices + 1 ];
-// GMFNode = new SMDS_MeshNode*[ nbVertices + 1 ];
-//
-// getShape(theMeshDS, TopAbs_VERTEX, tabCorner);
-// getShape(theMeshDS, TopAbs_EDGE, tabEdge);
-//
-// std::map <GmfKwdCod,int>::const_iterator it = tabRef.begin();
-// for ( ; it != tabRef.end() ; ++it)
-// {
-// // int dummy;
-// GmfKwdCod token = it->first;
-// nbRef = it->second;
-//
-// nbElem = GmfStatKwd(InpMsh, token);
-// if (nbElem > 0) {
-// GmfGotoKwd(InpMsh, token);
-// std::cout << "Read " << nbElem;
-// }
-// else
-// continue;
-//
-// int id[nbElem*tabRef[token]];
-// int ghs3dShapeID[nbElem];
-//
-// if (token == GmfVertices) {
-// std::cout << " vertices" << std::endl;
-// int aGMFID;
-//
-// float VerTab_f[nbElem][3];
-// double VerTab_d[nbElem][3];
-// SMDS_MeshNode * aGMFNode;
-//
-// for ( int iElem = 0; iElem < nbElem; iElem++ ) {
-// aGMFID = iElem + 1;
-// if (ver == GmfFloat) {
-// GmfGetLin(InpMsh, token, &VerTab_f[nbElem][0], &VerTab_f[nbElem][1], &VerTab_f[nbElem][2], &ghs3dShapeID[iElem]);
-// aGMFNode = theMeshDS->AddNode(VerTab_f[nbElem][0], VerTab_f[nbElem][1], VerTab_f[nbElem][2]);
-// }
-// else {
-// GmfGetLin(InpMsh, token, &VerTab_d[nbElem][0], &VerTab_d[nbElem][1], &VerTab_d[nbElem][2], &ghs3dShapeID[iElem]);
-// aGMFNode = theMeshDS->AddNode(VerTab_d[nbElem][0], VerTab_d[nbElem][1], VerTab_d[nbElem][2]);
-// }
-// GMFNode[ aGMFID ] = aGMFNode;
-// nodeAssigne[ aGMFID ] = 0;
-// GMFNodeAssigne[ aGMFID ] = 0;
-// }
-// }
-// else if (token == GmfCorners && nbElem > 0) {
-// std::cout << " corners" << std::endl;
-// for ( int iElem = 0; iElem < nbElem; iElem++ )
-// GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]]);
-// }
-// else if (token == GmfRidges && nbElem > 0) {
-// std::cout << " ridges" << std::endl;
-// for ( int iElem = 0; iElem < nbElem; iElem++ )
-// GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]]);
-// }
-// else if (token == GmfEdges && nbElem > 0) {
-// std::cout << " edges" << std::endl;
-// for ( int iElem = 0; iElem < nbElem; iElem++ )
-// GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &ghs3dShapeID[iElem]);
-// }
-// else if (token == GmfTriangles && nbElem > 0) {
-// std::cout << " triangles" << std::endl;
-// for ( int iElem = 0; iElem < nbElem; iElem++ )
-// GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &ghs3dShapeID[iElem]);
-// }
-// // else if (token == GmfQuadrilaterals && nbElem > 0) {
-// // std::cout << " Quadrilaterals" << std::endl;
-// // for ( int iElem = 0; iElem < nbElem; iElem++ )
-// // GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3], &ghs3dShapeID[iElem]);
-// // }
-// else if (token == GmfTetrahedra && nbElem > 0) {
-// std::cout << " Tetrahedra" << std::endl;
-// for ( int iElem = 0; iElem < nbElem; iElem++ )
-// GmfGetLin(InpMsh, token,
-// &id[iElem*tabRef[token]],
-// &id[iElem*tabRef[token]+1],
-// &id[iElem*tabRef[token]+2],
-// &id[iElem*tabRef[token]+3],
-// &ghs3dShapeID[iElem]);
-// }
-// // else if (token == GmfHexahedra && nbElem > 0) {
-// // std::cout << " Hexahedra" << std::endl;
-// // for ( int iElem = 0; iElem < nbElem; iElem++ )
-// // GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3],
-// // &id[iElem*tabRef[token]+4], &id[iElem*tabRef[token]+5], &id[iElem*tabRef[token]+6], &id[iElem*tabRef[token]+7], &ghs3dShapeID[iElem]);
-// // }
-//
-// switch (token) {
-// case GmfCorners:
-// case GmfRidges:
-// case GmfEdges:
-// case GmfTriangles:
-// // case GmfQuadrilaterals:
-// case GmfTetrahedra:
-// // case GmfHexahedra:
-// {
-// int nodeDim, shapeID, *nodeID;
-// const SMDS_MeshNode** node;
-// // std::vector< SMDS_MeshNode* > enfNode( nbRef );
-// SMDS_MeshElement * aGMFElement;
-//
-// node = new const SMDS_MeshNode*[nbRef];
-// nodeID = new int[ nbRef ];
-//
-// for ( int iElem = 0; iElem < nbElem; iElem++ )
-// {
-// for ( int iRef = 0; iRef < nbRef; iRef++ )
-// {
-// aGMFNodeID = id[iElem*tabRef[token]+iRef]; // read nbRef aGMFNodeID
-// node [ iRef ] = GMFNode[ aGMFNodeID ];
-// nodeID[ iRef ] = aGMFNodeID;
-// }
-//
-// switch (token)
-// {
-// case GmfCorners: {
-// nodeDim = 1;
-// gp_Pnt GMFPnt ( node[0]->X(), node[0]->Y(), node[0]->Z() );
-// for ( int i=0; i<nbElem; i++ ) {
-// aVertex = TopoDS::Vertex( tabCorner[i] );
-// gp_Pnt aPnt = BRep_Tool::Pnt( aVertex );
-// if ( aPnt.Distance( GMFPnt ) < epsilon )
-// break;
-// }
-// break;
-// }
-// case GmfEdges: {
-// nodeDim = 2;
-// aGMFElement = theMeshDS->AddEdge( node[0], node[1] );
-// int iNode = 1;
-// if ( GMFNodeAssigne[ nodeID[0] ] == 0 || GMFNodeAssigne[ nodeID[0] ] == 2 )
-// iNode = 0;
-// shapeID = findEdgeID( node[iNode], theMeshDS, nbShapeEdge, tabEdge );
-// break;
-// }
-// case GmfRidges:
-// break;
-// case GmfTriangles: {
-// nodeDim = 3;
-// aGMFElement = theMeshDS->AddFace( node[0], node[1], node[2]);
-// shapeID = -1;
-// break;
-// }
-// // case GmfQuadrilaterals: {
-// // nodeDim = 4;
-// // aGMFElement = theMeshDS->AddFace( node[0], node[1], node[2], node[3] );
-// // shapeID = -1;
-// // break;
-// // }
-// case GmfTetrahedra: {
-//
-// // IN WORK
-// TopoDS_Shape aSolid;
-// // We always run GHS3D with "to mesh holes"==TRUE but we must not create
-// // tetras within holes depending on hypo option,
-// // so we first check if aTet is inside a hole and then create it
-// if ( nbTriangle > 1 ) {
-// tetraShapeID = HOLE_ID; // negative tetraShapeID means not to create tetras if !toMeshHoles
-// int aGhs3dShapeID = ghs3dShapeID[iElem] - IdShapeRef;
-// if ( tabID[ aGhs3dShapeID ] == 0 ) {
-// TopAbs_State state;
-// aSolid = findShape(node, aSolid, tabShape, tabBox, nbShape, &state);
-// if ( toMeshHoles || state == TopAbs_IN )
-// tetraShapeID = theMeshDS->ShapeToIndex( aSolid );
-// tabID[ aGhs3dShapeID ] = tetraShapeID;
-// }
-// else
-// tetraShapeID = tabID[ aGhs3dShapeID ];
-// }
-// else if ( nbShape > 1 ) {
-// // Case where nbTriangle == 1 while nbShape == 2 encountered
-// // with compound of 2 boxes and "To mesh holes"==False,
-// // so there are no subdomains specified for each tetrahedron.
-// // Try to guess a solid by a node already bound to shape
-// tetraShapeID = 0;
-// for ( int i=0; i<4 && tetraShapeID==0; i++ ) {
-// if ( nodeAssigne[ nodeID[i] ] == 1 &&
-// node[i]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_3DSPACE &&
-// node[i]->getshapeId() > 1 )
-// {
-// tetraShapeID = node[i]->getshapeId();
-// }
-// }
-// if ( tetraShapeID==0 ) {
-// aSolid = findShape(node, aSolid, tabShape, tabBox, nbShape);
-// tetraShapeID = theMeshDS->ShapeToIndex( aSolid );
-// }
-// }
-// // set new nodes and tetrahedron onto the shape
-// for ( int i=0; i<4; i++ ) {
-// if ( nodeAssigne[ nodeID[i] ] == 0 ) {
-// if ( tetraShapeID != HOLE_ID )
-// theMeshDS->SetNodeInVolume( node[i], tetraShapeID );
-// nodeAssigne[ nodeID[i] ] = tetraShapeID;
-// }
-// }
-// if ( toMeshHoles || tetraShapeID != HOLE_ID ) {
-// aGMFElement = theMeshDS->AddVolume( node[1], node[0], node[2], node[3] );
-// theMeshDS->SetMeshElementOnShape( aGMFElement, tetraShapeID );
-// }
-//
-// // IN WORK
-//
-// nodeDim = 5;
-// break;
-// }
-// // case GmfHexahedra: {
-// // nodeDim = 6;
-// // aGMFElement = theMeshDS->AddVolume( node[0], node[3], node[2], node[1],
-// // node[4], node[7], node[6], node[5] );
-// // break;
-// // }
-// default: continue;
-// }
-// if (token != GmfRidges)
-// {
-// for ( int i=0; i<nbRef; i++ ) {
-// if ( GMFNodeAssigne[ nodeID[i] ] == 0 ) {
-// if ( token == GmfCorners ) theMeshDS->SetNodeOnVertex( node[0], aVertex );
-// else if ( token == GmfEdges ) theMeshDS->SetNodeOnEdge( node[i], shapeID );
-// else if ( token == GmfTriangles ) theMeshDS->SetNodeOnFace( node[i], shapeID );
-// GMFNodeAssigne[ nodeID[i] ] = nodeDim;
-// }
-// }
-// if ( token != "Corners" )
-// theMeshDS->SetMeshElementOnShape( aGMFElement, shapeID );
-// }
-// } // for
-//
-// if ( !toMeshHoles ) {
-// map <int,const SMDS_MeshNode*>::iterator itOnNode = theGhs3dIdToNodeMap.find( nbVertices-(nbEnforcedVertices+nbEnforcedNodes) );
-// for ( ; itOnNode != theGhs3dIdToNodeMap.end(); ++itOnNode) {
-// if ( nodeAssigne[ itOnNode->first ] == HOLE_ID )
-// theMeshDS->RemoveFreeNode( itOnNode->second, 0 );
-// }
-// }
-//
-// delete [] node;
-// delete [] nodeID;
-// break;
-// } // case GmfTetrahedra
-// } // switch(token)
-// } // for
-// cout << std::endl;
-//
-// #ifdef WIN32
-// UnmapViewOfFile(mapPtr);
-// CloseHandle(hMapObject);
-// CloseHandle(fd);
-// #else
-// munmap(mapPtr, length);
-// #endif
-// close(fileOpen);
-//
-// delete [] tabID;
-// delete [] tabCorner;
-// delete [] tabEdge;
-// delete [] nodeAssigne;
-// delete [] GMFNodeAssigne;
-// delete [] GMFNode;
-//
-// return true;
-// }
-
-
-//=======================================================================
-//function : addElemInMeshGroup
-//purpose : Update or create groups in mesh
-//=======================================================================
-
-static void addElemInMeshGroup(SMESH_Mesh* theMesh,
- const SMDS_MeshElement* anElem,
- std::string& groupName,
- std::set<std::string>& groupsToRemove)
-{
- if ( !anElem ) return; // issue 0021776
-
- bool groupDone = false;
- SMESH_Mesh::GroupIteratorPtr grIt = theMesh->GetGroups();
- while (grIt->more()) {
- SMESH_Group * group = grIt->next();
- if ( !group ) continue;
- SMESHDS_GroupBase* groupDS = group->GetGroupDS();
- if ( !groupDS ) continue;
- if ( groupDS->GetType()==anElem->GetType() &&groupName.compare(group->GetName())==0) {
- SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( groupDS );
- aGroupDS->SMDSGroup().Add(anElem);
- groupDone = true;
-// MESSAGE("Successfully added enforced element to existing group " << groupName);
- break;
- }
- }
-
- if (!groupDone)
- {
- int groupId;
- SMESH_Group* aGroup = theMesh->AddGroup(anElem->GetType(), groupName.c_str(), groupId);
- aGroup->SetName( groupName.c_str() );
- SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( aGroup->GetGroupDS() );
- aGroupDS->SMDSGroup().Add(anElem);
-// MESSAGE("Successfully created enforced vertex group " << groupName);
- groupDone = true;
- }
- if (!groupDone)
- throw SALOME_Exception(LOCALIZED("A given element was not added to a group"));
-}
-
-
-//=======================================================================
-//function : updateMeshGroups
-//purpose : Update or create groups in mesh
-//=======================================================================
-
-static void updateMeshGroups(SMESH_Mesh* theMesh, std::set<std::string> groupsToRemove)
-{
- SMESH_Mesh::GroupIteratorPtr grIt = theMesh->GetGroups();
- while (grIt->more()) {
- SMESH_Group * group = grIt->next();
- if ( !group ) continue;
- SMESHDS_GroupBase* groupDS = group->GetGroupDS();
- if ( !groupDS ) continue;
- std::string currentGroupName = (string)group->GetName();
- if (groupDS->IsEmpty() && groupsToRemove.find(currentGroupName) != groupsToRemove.end()) {
- // Previous group created by enforced elements
- MESSAGE("Delete previous group created by removed enforced elements: " << group->GetName())
- theMesh->RemoveGroup(groupDS->GetID());
- }
- }
-}
-
-//=======================================================================
-//function : removeEmptyGroupsOfDomains
-//purpose : remove empty groups named "Domain_nb" created due to
-// "To make groups of domains" option.
-//=======================================================================
-
-static void removeEmptyGroupsOfDomains(SMESH_Mesh* mesh,
- bool notEmptyAsWell = false)
-{
- const char* refName = theDomainGroupNamePrefix;
- const size_t refLen = strlen( theDomainGroupNamePrefix );
-
- std::list<int> groupIDs = mesh->GetGroupIds();
- std::list<int>::const_iterator id = groupIDs.begin();
- for ( ; id != groupIDs.end(); ++id )
- {
- SMESH_Group* group = mesh->GetGroup( *id );
- if ( !group || ( !group->GetGroupDS()->IsEmpty() && !notEmptyAsWell ))
- continue;
- const char* name = group->GetName();
- char* end;
- // check the name
- if ( strncmp( name, refName, refLen ) == 0 && // starts from refName;
- isdigit( *( name + refLen )) && // refName is followed by a digit;
- strtol( name + refLen, &end, 10) >= 0 && // there are only digits ...
- *end == '\0') // ... till a string end.
- {
- mesh->RemoveGroup( *id );
- }
- }
-}
-
-//================================================================================
-/*!
- * \brief Create the groups corresponding to domains
- */
-//================================================================================
-
-static void makeDomainGroups( std::vector< std::vector< const SMDS_MeshElement* > >& elemsOfDomain,
- SMESH_MesherHelper* theHelper)
-{
- // int nbDomains = 0;
- // for ( size_t i = 0; i < elemsOfDomain.size(); ++i )
- // nbDomains += ( elemsOfDomain[i].size() > 0 );
-
- // if ( nbDomains > 1 )
- for ( size_t iDomain = 0; iDomain < elemsOfDomain.size(); ++iDomain )
- {
- std::vector< const SMDS_MeshElement* > & elems = elemsOfDomain[ iDomain ];
- if ( elems.empty() ) continue;
-
- // find existing groups
- std::vector< SMESH_Group* > groupOfType( SMDSAbs_NbElementTypes, (SMESH_Group*)NULL );
- const std::string domainName = ( SMESH_Comment( theDomainGroupNamePrefix ) << iDomain );
- SMESH_Mesh::GroupIteratorPtr groupIt = theHelper->GetMesh()->GetGroups();
- while ( groupIt->more() )
- {
- SMESH_Group* group = groupIt->next();
- if ( domainName == group->GetName() &&
- dynamic_cast< SMESHDS_Group* >( group->GetGroupDS()) )
- groupOfType[ group->GetGroupDS()->GetType() ] = group;
- }
- // create and fill the groups
- size_t iElem = 0;
- int groupID;
- do
- {
- SMESH_Group* group = groupOfType[ elems[ iElem ]->GetType() ];
- if ( !group )
- group = theHelper->GetMesh()->AddGroup( elems[ iElem ]->GetType(),
- domainName.c_str(), groupID );
- SMDS_MeshGroup& groupDS =
- static_cast< SMESHDS_Group* >( group->GetGroupDS() )->SMDSGroup();
-
- while ( iElem < elems.size() && groupDS.Add( elems[iElem] ))
- ++iElem;
-
- } while ( iElem < elems.size() );
- }
-}
-
-//=======================================================================
-//function : readGMFFile
-//purpose : read GMF file w/o geometry associated to mesh
-//=======================================================================
-
-static bool readGMFFile(const char* theFile,
- GHS3DPlugin_GHS3D* theAlgo,
- SMESH_MesherHelper* theHelper,
- std::vector <const SMDS_MeshNode*> & theNodeByGhs3dId,
- std::vector <const SMDS_MeshElement*> & theFaceByGhs3dId,
- map<const SMDS_MeshNode*,int> & theNodeToGhs3dIdMap,
- std::vector<std::string> & aNodeGroupByGhs3dId,
- std::vector<std::string> & anEdgeGroupByGhs3dId,
- std::vector<std::string> & aFaceGroupByGhs3dId,
- std::set<std::string> & groupsToRemove,
- bool toMakeGroupsOfDomains=false,
- bool toMeshHoles=true)
-{
- std::string tmpStr;
- SMESHDS_Mesh* theMeshDS = theHelper->GetMeshDS();
- const bool hasGeom = ( theHelper->GetMesh()->HasShapeToMesh() );
-
- int nbInitialNodes = theNodeByGhs3dId.size();
- int nbMeshNodes = theMeshDS->NbNodes();
-
- const bool isQuadMesh =
- theHelper->GetMesh()->NbEdges( ORDER_QUADRATIC ) ||
- theHelper->GetMesh()->NbFaces( ORDER_QUADRATIC ) ||
- theHelper->GetMesh()->NbVolumes( ORDER_QUADRATIC );
-
-#ifdef _DEBUG_
- std::cout << "theNodeByGhs3dId.size(): " << nbInitialNodes << std::endl;
- std::cout << "theHelper->GetMesh()->NbNodes(): " << nbMeshNodes << std::endl;
- std::cout << "isQuadMesh: " << isQuadMesh << std::endl;
-#endif
-
- // ---------------------------------
- // Read generated elements and nodes
- // ---------------------------------
-
- int nbElem = 0, nbRef = 0;
- int aGMFNodeID = 0;
- const SMDS_MeshNode** GMFNode;
-#ifdef _DEBUG_
- std::map<int, std::set<int> > subdomainId2tetraId;
-#endif
- std::map <GmfKwdCod,int> tabRef;
- const bool force3d = !hasGeom;
- const int noID = 0;
-
- tabRef[GmfVertices] = 3; // for new nodes and enforced nodes
- tabRef[GmfCorners] = 1;
- tabRef[GmfEdges] = 2; // for enforced edges
- tabRef[GmfRidges] = 1;
- tabRef[GmfTriangles] = 3; // for enforced faces
- tabRef[GmfQuadrilaterals] = 4;
- tabRef[GmfTetrahedra] = 4; // for new tetras
- tabRef[GmfHexahedra] = 8;
-
- int ver, dim;
- MESSAGE("Read " << theFile << " file");
- int InpMsh = GmfOpenMesh(theFile, GmfRead, &ver, &dim);
- if (!InpMsh)
- return false;
- MESSAGE("Done ");
-
- // Read ids of domains
- vector< int > solidIDByDomain;
- if ( hasGeom )
- {
- int solid1; // id used in case of 1 domain or some reading failure
- if ( theHelper->GetSubShape().ShapeType() == TopAbs_SOLID )
- solid1 = theHelper->GetSubShapeID();
- else
- solid1 = theMeshDS->ShapeToIndex
- ( TopExp_Explorer( theHelper->GetSubShape(), TopAbs_SOLID ).Current() );
-
- int nbDomains = GmfStatKwd( InpMsh, GmfSubDomainFromGeom );
- if ( nbDomains > 1 )
- {
- solidIDByDomain.resize( nbDomains+1, theHelper->GetSubShapeID() );
- int faceNbNodes, faceIndex, orientation, domainNb;
- GmfGotoKwd( InpMsh, GmfSubDomainFromGeom );
- for ( int i = 0; i < nbDomains; ++i )
- {
- faceIndex = 0;
- GmfGetLin( InpMsh, GmfSubDomainFromGeom,
- &faceNbNodes, &faceIndex, &orientation, &domainNb);
- solidIDByDomain[ domainNb ] = 1;
- if ( 0 < faceIndex && faceIndex-1 < theFaceByGhs3dId.size() )
- {
- const SMDS_MeshElement* face = theFaceByGhs3dId[ faceIndex-1 ];
- const SMDS_MeshNode* nn[3] = { face->GetNode(0),
- face->GetNode(1),
- face->GetNode(2) };
- if ( orientation < 0 )
- std::swap( nn[1], nn[2] );
- solidIDByDomain[ domainNb ] =
- findShapeID( *theHelper->GetMesh(), nn[0], nn[1], nn[2], toMeshHoles );
- if ( solidIDByDomain[ domainNb ] > 0 )
- {
- const TopoDS_Shape& foundShape = theMeshDS->IndexToShape( solidIDByDomain[ domainNb ] );
- if ( ! theHelper->IsSubShape( foundShape, theHelper->GetSubShape() ))
- solidIDByDomain[ domainNb ] = HOLE_ID;
- }
- }
- }
- }
- if ( solidIDByDomain.size() < 2 )
- solidIDByDomain.resize( 2, solid1 );
- }
-
- // Issue 0020682. Avoid creating nodes and tetras at place where
- // volumic elements already exist
- SMESH_ElementSearcher* elemSearcher = 0;
- std::vector< const SMDS_MeshElement* > foundVolumes;
- if ( !hasGeom && theHelper->GetMesh()->NbVolumes() > 0 )
- elemSearcher = SMESH_MeshAlgos::GetElementSearcher( *theMeshDS );
- auto_ptr< SMESH_ElementSearcher > elemSearcherDeleter( elemSearcher );
-
- // IMP 0022172: [CEA 790] create the groups corresponding to domains
- std::vector< std::vector< const SMDS_MeshElement* > > elemsOfDomain;
-
- int nbVertices = GmfStatKwd(InpMsh, GmfVertices) - nbInitialNodes;
- GMFNode = new const SMDS_MeshNode*[ nbVertices + 1 ];
-
- std::map <GmfKwdCod,int>::const_iterator it = tabRef.begin();
- for ( ; it != tabRef.end() ; ++it)
- {
- if(theAlgo->computeCanceled()) {
- GmfCloseMesh(InpMsh);
- delete [] GMFNode;
- return false;
- }
- int dummy, solidID;
- GmfKwdCod token = it->first;
- nbRef = it->second;
-
- nbElem = GmfStatKwd(InpMsh, token);
- if (nbElem > 0) {
- GmfGotoKwd(InpMsh, token);
- std::cout << "Read " << nbElem;
- }
- else
- continue;
-
- std::vector<int> id (nbElem*tabRef[token]); // node ids
- std::vector<int> domainID( nbElem ); // domain
-
- if (token == GmfVertices) {
- (nbElem <= 1) ? tmpStr = " vertex" : tmpStr = " vertices";
-// std::cout << nbInitialNodes << " from input mesh " << std::endl;
-
- // Remove orphan nodes from previous enforced mesh which was cleared
-// if ( nbElem < nbMeshNodes ) {
-// const SMDS_MeshNode* node;
-// SMDS_NodeIteratorPtr nodeIt = theMeshDS->nodesIterator();
-// while ( nodeIt->more() )
-// {
-// node = nodeIt->next();
-// if (theNodeToGhs3dIdMap.find(node) != theNodeToGhs3dIdMap.end())
-// theMeshDS->RemoveNode(node);
-// }
-// }
-
-
- int aGMFID;
-
- float VerTab_f[3];
- double x, y, z;
- const SMDS_MeshNode * aGMFNode;
-
- for ( int iElem = 0; iElem < nbElem; iElem++ ) {
- if(theAlgo->computeCanceled()) {
- GmfCloseMesh(InpMsh);
- delete [] GMFNode;
- return false;
- }
- if (ver == GmfFloat) {
- GmfGetLin(InpMsh, token, &VerTab_f[0], &VerTab_f[1], &VerTab_f[2], &dummy);
- x = VerTab_f[0];
- y = VerTab_f[1];
- z = VerTab_f[2];
- }
- else {
- GmfGetLin(InpMsh, token, &x, &y, &z, &dummy);
- }
- if (iElem >= nbInitialNodes) {
- if ( elemSearcher &&
- elemSearcher->FindElementsByPoint( gp_Pnt(x,y,z), SMDSAbs_Volume, foundVolumes))
- aGMFNode = 0;
- else
- aGMFNode = theHelper->AddNode(x, y, z);
-
- aGMFID = iElem -nbInitialNodes +1;
- GMFNode[ aGMFID ] = aGMFNode;
- if (aGMFID-1 < aNodeGroupByGhs3dId.size() && !aNodeGroupByGhs3dId.at(aGMFID-1).empty())
- addElemInMeshGroup(theHelper->GetMesh(), aGMFNode, aNodeGroupByGhs3dId.at(aGMFID-1), groupsToRemove);
- }
- }
- }
- else if (token == GmfCorners && nbElem > 0) {
- (nbElem <= 1) ? tmpStr = " corner" : tmpStr = " corners";
- for ( int iElem = 0; iElem < nbElem; iElem++ )
- GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]]);
- }
- else if (token == GmfRidges && nbElem > 0) {
- (nbElem <= 1) ? tmpStr = " ridge" : tmpStr = " ridges";
- for ( int iElem = 0; iElem < nbElem; iElem++ )
- GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]]);
- }
- else if (token == GmfEdges && nbElem > 0) {
- (nbElem <= 1) ? tmpStr = " edge" : tmpStr = " edges";
- for ( int iElem = 0; iElem < nbElem; iElem++ )
- GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &domainID[iElem]);
- }
- else if (token == GmfTriangles && nbElem > 0) {
- (nbElem <= 1) ? tmpStr = " triangle" : tmpStr = " triangles";
- for ( int iElem = 0; iElem < nbElem; iElem++ )
- GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &domainID[iElem]);
- }
- else if (token == GmfQuadrilaterals && nbElem > 0) {
- (nbElem <= 1) ? tmpStr = " Quadrilateral" : tmpStr = " Quadrilaterals";
- for ( int iElem = 0; iElem < nbElem; iElem++ )
- GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3], &domainID[iElem]);
- }
- else if (token == GmfTetrahedra && nbElem > 0) {
- (nbElem <= 1) ? tmpStr = " Tetrahedron" : tmpStr = " Tetrahedra";
- for ( int iElem = 0; iElem < nbElem; iElem++ ) {
- GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3], &domainID[iElem]);
-#ifdef _DEBUG_
- subdomainId2tetraId[dummy].insert(iElem+1);
-// MESSAGE("subdomainId2tetraId["<<dummy<<"].insert("<<iElem+1<<")");
-#endif
- }
- }
- else if (token == GmfHexahedra && nbElem > 0) {
- (nbElem <= 1) ? tmpStr = " Hexahedron" : tmpStr = " Hexahedra";
- for ( int iElem = 0; iElem < nbElem; iElem++ )
- GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3],
- &id[iElem*tabRef[token]+4], &id[iElem*tabRef[token]+5], &id[iElem*tabRef[token]+6], &id[iElem*tabRef[token]+7], &domainID[iElem]);
- }
- std::cout << tmpStr << std::endl;
- std::cout << std::endl;
-
- switch (token) {
- case GmfCorners:
- case GmfRidges:
- case GmfEdges:
- case GmfTriangles:
- case GmfQuadrilaterals:
- case GmfTetrahedra:
- case GmfHexahedra:
- {
- std::vector< const SMDS_MeshNode* > node( nbRef );
- std::vector< int > nodeID( nbRef );
- std::vector< SMDS_MeshNode* > enfNode( nbRef );
- const SMDS_MeshElement* aCreatedElem;
-
- for ( int iElem = 0; iElem < nbElem; iElem++ )
- {
- if(theAlgo->computeCanceled()) {
- GmfCloseMesh(InpMsh);
- delete [] GMFNode;
- return false;
- }
- // Check if elem is already in input mesh. If yes => skip
- bool fullyCreatedElement = false; // if at least one of the nodes was created
- for ( int iRef = 0; iRef < nbRef; iRef++ )
- {
- aGMFNodeID = id[iElem*tabRef[token]+iRef]; // read nbRef aGMFNodeID
- if (aGMFNodeID <= nbInitialNodes) // input nodes
- {
- aGMFNodeID--;
- node[ iRef ] = theNodeByGhs3dId[aGMFNodeID];
- }
- else
- {
- fullyCreatedElement = true;
- aGMFNodeID -= nbInitialNodes;
- nodeID[ iRef ] = aGMFNodeID ;
- node [ iRef ] = GMFNode[ aGMFNodeID ];
- }
- }
- aCreatedElem = 0;
- switch (token)
- {
- case GmfEdges:
- if (fullyCreatedElement) {
- aCreatedElem = theHelper->AddEdge( node[0], node[1], noID, force3d );
- if (anEdgeGroupByGhs3dId.size() && !anEdgeGroupByGhs3dId[iElem].empty())
- addElemInMeshGroup(theHelper->GetMesh(), aCreatedElem, anEdgeGroupByGhs3dId[iElem], groupsToRemove);
- }
- break;
- case GmfTriangles:
- if (fullyCreatedElement) {
- aCreatedElem = theHelper->AddFace( node[0], node[1], node[2], noID, force3d );
- if (aFaceGroupByGhs3dId.size() && !aFaceGroupByGhs3dId[iElem].empty())
- addElemInMeshGroup(theHelper->GetMesh(), aCreatedElem, aFaceGroupByGhs3dId[iElem], groupsToRemove);
- }
- break;
- case GmfQuadrilaterals:
- if (fullyCreatedElement) {
- aCreatedElem = theHelper->AddFace( node[0], node[1], node[2], node[3], noID, force3d );
- }
- break;
- case GmfTetrahedra:
- if ( hasGeom )
- {
- solidID = solidIDByDomain[ domainID[iElem]];
- if ( solidID != HOLE_ID )
- {
- aCreatedElem = theHelper->AddVolume( node[1], node[0], node[2], node[3],
- noID, force3d );
- theMeshDS->SetMeshElementOnShape( aCreatedElem, solidID );
- for ( int iN = 0; iN < 4; ++iN )
- if ( node[iN]->getshapeId() < 1 )
- theMeshDS->SetNodeInVolume( node[iN], solidID );
- }
- }
- else
- {
- if ( elemSearcher ) {
- // Issue 0020682. Avoid creating nodes and tetras at place where
- // volumic elements already exist
- if ( !node[1] || !node[0] || !node[2] || !node[3] )
- continue;
- if ( elemSearcher->FindElementsByPoint((SMESH_TNodeXYZ(node[0]) +
- SMESH_TNodeXYZ(node[1]) +
- SMESH_TNodeXYZ(node[2]) +
- SMESH_TNodeXYZ(node[3]) ) / 4.,
- SMDSAbs_Volume, foundVolumes ))
- break;
- }
- aCreatedElem = theHelper->AddVolume( node[1], node[0], node[2], node[3],
- noID, force3d );
- }
- break;
- case GmfHexahedra:
- if ( hasGeom )
- {
- solidID = solidIDByDomain[ domainID[iElem]];
- if ( solidID != HOLE_ID )
- {
- aCreatedElem = theHelper->AddVolume( node[0], node[3], node[2], node[1],
- node[4], node[7], node[6], node[5],
- noID, force3d );
- theMeshDS->SetMeshElementOnShape( aCreatedElem, solidID );
- for ( int iN = 0; iN < 8; ++iN )
- if ( node[iN]->getshapeId() < 1 )
- theMeshDS->SetNodeInVolume( node[iN], solidID );
- }
- }
- else
- {
- if ( elemSearcher ) {
- // Issue 0020682. Avoid creating nodes and tetras at place where
- // volumic elements already exist
- if ( !node[1] || !node[0] || !node[2] || !node[3] || !node[4] || !node[5] || !node[6] || !node[7])
- continue;
- if ( elemSearcher->FindElementsByPoint((SMESH_TNodeXYZ(node[0]) +
- SMESH_TNodeXYZ(node[1]) +
- SMESH_TNodeXYZ(node[2]) +
- SMESH_TNodeXYZ(node[3]) +
- SMESH_TNodeXYZ(node[4]) +
- SMESH_TNodeXYZ(node[5]) +
- SMESH_TNodeXYZ(node[6]) +
- SMESH_TNodeXYZ(node[7])) / 8.,
- SMDSAbs_Volume, foundVolumes ))
- break;
- }
- aCreatedElem = theHelper->AddVolume( node[0], node[3], node[2], node[1],
- node[4], node[7], node[6], node[5],
- noID, force3d );
- }
- break;
- default: continue;
- } // switch (token)
-
- if ( aCreatedElem && toMakeGroupsOfDomains )
- {
- if ( domainID[iElem] >= (int) elemsOfDomain.size() )
- elemsOfDomain.resize( domainID[iElem] + 1 );
- elemsOfDomain[ domainID[iElem] ].push_back( aCreatedElem );
- }
- } // loop on elements of one type
- break;
- } // case ...
- } // switch (token)
- } // loop on tabRef
-
- // remove nodes in holes
- if ( hasGeom )
- {
- for ( int i = 1; i <= nbVertices; ++i )
- if ( GMFNode[i]->NbInverseElements() == 0 )
- theMeshDS->RemoveFreeNode( GMFNode[i], /*sm=*/0, /*fromGroups=*/false );
- }
-
- GmfCloseMesh(InpMsh);
- delete [] GMFNode;
-
- // 0022172: [CEA 790] create the groups corresponding to domains
- if ( toMakeGroupsOfDomains )
- makeDomainGroups( elemsOfDomain, theHelper );
-
-#ifdef _DEBUG_
- MESSAGE("Nb subdomains " << subdomainId2tetraId.size());
- std::map<int, std::set<int> >::const_iterator subdomainIt = subdomainId2tetraId.begin();
- TCollection_AsciiString aSubdomainFileName = theFile;
- aSubdomainFileName = aSubdomainFileName + ".subdomain";
- ofstream aSubdomainFile ( aSubdomainFileName.ToCString() , ios::out);
-
- aSubdomainFile << "Nb subdomains " << subdomainId2tetraId.size() << std::endl;
- for(;subdomainIt != subdomainId2tetraId.end() ; ++subdomainIt) {
- int subdomainId = subdomainIt->first;
- std::set<int> tetraIds = subdomainIt->second;
- MESSAGE("Subdomain #"<<subdomainId<<": "<<tetraIds.size()<<" tetrahedrons");
- std::set<int>::const_iterator tetraIdsIt = tetraIds.begin();
- aSubdomainFile << subdomainId << std::endl;
- for(;tetraIdsIt != tetraIds.end() ; ++tetraIdsIt) {
- aSubdomainFile << (*tetraIdsIt) << " ";
- }
- aSubdomainFile << std::endl;
- }
- aSubdomainFile.close();
-#endif
-
- return true;
-}
-
-
-static bool writeGMFFile(const char* theMeshFileName,
- const char* theRequiredFileName,
- const char* theSolFileName,
- const SMESH_ProxyMesh& theProxyMesh,
- SMESH_MesherHelper& theHelper,
- std::vector <const SMDS_MeshNode*> & theNodeByGhs3dId,
- std::vector <const SMDS_MeshElement*> & theFaceByGhs3dId,
- std::map<const SMDS_MeshNode*,int> & aNodeToGhs3dIdMap,
- std::vector<std::string> & aNodeGroupByGhs3dId,
- std::vector<std::string> & anEdgeGroupByGhs3dId,
- std::vector<std::string> & aFaceGroupByGhs3dId,
- GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap & theEnforcedNodes,
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges,
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles,
- std::map<std::vector<double>, std::string> & enfVerticesWithGroup,
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues & theEnforcedVertices)
-{
- MESSAGE("writeGMFFile w/o geometry");
- std::string tmpStr;
- int idx, idxRequired = 0, idxSol = 0;
- const int dummyint = 0;
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues::const_iterator vertexIt;
- std::vector<double> enfVertexSizes;
- const SMDS_MeshElement* elem;
- TIDSortedElemSet anElemSet, theKeptEnforcedEdges, theKeptEnforcedTriangles;
- SMDS_ElemIteratorPtr nodeIt;
- std::vector <const SMDS_MeshNode*> theEnforcedNodeByGhs3dId;
- map<const SMDS_MeshNode*,int> anEnforcedNodeToGhs3dIdMap, anExistingEnforcedNodeToGhs3dIdMap;
- std::vector< const SMDS_MeshElement* > foundElems;
- map<const SMDS_MeshNode*,TopAbs_State> aNodeToTopAbs_StateMap;
- int nbFoundElems;
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap::iterator elemIt;
- TIDSortedElemSet::iterator elemSetIt;
- bool isOK;
- SMESH_Mesh* theMesh = theHelper.GetMesh();
- const bool hasGeom = theMesh->HasShapeToMesh();
- auto_ptr< SMESH_ElementSearcher > pntCls
- ( SMESH_MeshAlgos::GetElementSearcher(*theMesh->GetMeshDS()));
-
- int nbEnforcedVertices = theEnforcedVertices.size();
-
- // count faces
- int nbFaces = theProxyMesh.NbFaces();
- int nbNodes;
- theFaceByGhs3dId.reserve( nbFaces );
-
- // groups management
- int usedEnforcedNodes = 0;
- std::string gn = "";
-
- if ( nbFaces == 0 )
- return false;
-
- idx = GmfOpenMesh(theMeshFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
- if (!idx)
- return false;
-
- /* ========================== FACES ========================== */
- /* TRIANGLES ========================== */
- SMDS_ElemIteratorPtr eIt =
- hasGeom ? theProxyMesh.GetFaces( theHelper.GetSubShape()) : theProxyMesh.GetFaces();
- while ( eIt->more() )
- {
- elem = eIt->next();
- anElemSet.insert(elem);
- nodeIt = elem->nodesIterator();
- nbNodes = elem->NbCornerNodes();
- while ( nodeIt->more() && nbNodes--)
- {
- // find GHS3D ID
- const SMDS_MeshNode* node = castToNode( nodeIt->next() );
- int newId = aNodeToGhs3dIdMap.size() + 1; // ghs3d ids count from 1
- aNodeToGhs3dIdMap.insert( make_pair( node, newId ));
- }
- }
-
- /* EDGES ========================== */
-
- // Iterate over the enforced edges
- for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) {
- elem = elemIt->first;
- isOK = true;
- nodeIt = elem->nodesIterator();
- nbNodes = 2;
- while ( nodeIt->more() && nbNodes-- ) {
- // find GHS3D ID
- const SMDS_MeshNode* node = castToNode( nodeIt->next() );
- // Test if point is inside shape to mesh
- gp_Pnt myPoint(node->X(),node->Y(),node->Z());
- TopAbs_State result = pntCls->GetPointState( myPoint );
- if ( result == TopAbs_OUT ) {
- isOK = false;
- break;
- }
- aNodeToTopAbs_StateMap.insert( make_pair( node, result ));
- }
- if (isOK) {
- nodeIt = elem->nodesIterator();
- nbNodes = 2;
- int newId = -1;
- while ( nodeIt->more() && nbNodes-- ) {
- // find GHS3D ID
- const SMDS_MeshNode* node = castToNode( nodeIt->next() );
- gp_Pnt myPoint(node->X(),node->Y(),node->Z());
- nbFoundElems = pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems);
-#ifdef _DEBUG_
- std::cout << "Node at "<<node->X()<<", "<<node->Y()<<", "<<node->Z()<<std::endl;
- std::cout << "Nb nodes found : "<<nbFoundElems<<std::endl;
-#endif
- if (nbFoundElems ==0) {
- if ((*aNodeToTopAbs_StateMap.find(node)).second == TopAbs_IN) {
- newId = aNodeToGhs3dIdMap.size() + anEnforcedNodeToGhs3dIdMap.size() + 1; // ghs3d ids count from 1
- anEnforcedNodeToGhs3dIdMap.insert( make_pair( node, newId ));
- }
- }
- else if (nbFoundElems ==1) {
- const SMDS_MeshNode* existingNode = (SMDS_MeshNode*) foundElems.at(0);
- newId = (*aNodeToGhs3dIdMap.find(existingNode)).second;
- anExistingEnforcedNodeToGhs3dIdMap.insert( make_pair( node, newId ));
- }
- else
- isOK = false;
-#ifdef _DEBUG_
- std::cout << "GHS3D node ID: "<<newId<<std::endl;
-#endif
- }
- if (isOK)
- theKeptEnforcedEdges.insert(elem);
- }
- }
-
- /* ENFORCED TRIANGLES ========================== */
-
- // Iterate over the enforced triangles
- for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) {
- elem = elemIt->first;
- isOK = true;
- nodeIt = elem->nodesIterator();
- nbNodes = 3;
- while ( nodeIt->more() && nbNodes--) {
- // find GHS3D ID
- const SMDS_MeshNode* node = castToNode( nodeIt->next() );
- // Test if point is inside shape to mesh
- gp_Pnt myPoint(node->X(),node->Y(),node->Z());
- TopAbs_State result = pntCls->GetPointState( myPoint );
- if ( result == TopAbs_OUT ) {
- isOK = false;
- break;
- }
- aNodeToTopAbs_StateMap.insert( make_pair( node, result ));
- }
- if (isOK) {
- nodeIt = elem->nodesIterator();
- nbNodes = 3;
- int newId = -1;
- while ( nodeIt->more() && nbNodes--) {
- // find GHS3D ID
- const SMDS_MeshNode* node = castToNode( nodeIt->next() );
- gp_Pnt myPoint(node->X(),node->Y(),node->Z());
- nbFoundElems = pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems);
-#ifdef _DEBUG_
- std::cout << "Nb nodes found : "<<nbFoundElems<<std::endl;
-#endif
- if (nbFoundElems ==0) {
- if ((*aNodeToTopAbs_StateMap.find(node)).second == TopAbs_IN) {
- newId = aNodeToGhs3dIdMap.size() + anEnforcedNodeToGhs3dIdMap.size() + 1; // ghs3d ids count from 1
- anEnforcedNodeToGhs3dIdMap.insert( make_pair( node, newId ));
- }
- }
- else if (nbFoundElems ==1) {
- const SMDS_MeshNode* existingNode = (SMDS_MeshNode*) foundElems.at(0);
- newId = (*aNodeToGhs3dIdMap.find(existingNode)).second;
- anExistingEnforcedNodeToGhs3dIdMap.insert( make_pair( node, newId ));
- }
- else
- isOK = false;
-#ifdef _DEBUG_
- std::cout << "GHS3D node ID: "<<newId<<std::endl;
-#endif
- }
- if (isOK)
- theKeptEnforcedTriangles.insert(elem);
- }
- }
-
- // put nodes to theNodeByGhs3dId vector
-#ifdef _DEBUG_
- std::cout << "aNodeToGhs3dIdMap.size(): "<<aNodeToGhs3dIdMap.size()<<std::endl;
-#endif
- theNodeByGhs3dId.resize( aNodeToGhs3dIdMap.size() );
- map<const SMDS_MeshNode*,int>::const_iterator n2id = aNodeToGhs3dIdMap.begin();
- for ( ; n2id != aNodeToGhs3dIdMap.end(); ++ n2id)
- {
-// std::cout << "n2id->first: "<<n2id->first<<std::endl;
- theNodeByGhs3dId[ n2id->second - 1 ] = n2id->first; // ghs3d ids count from 1
- }
-
- // put nodes to anEnforcedNodeToGhs3dIdMap vector
-#ifdef _DEBUG_
- std::cout << "anEnforcedNodeToGhs3dIdMap.size(): "<<anEnforcedNodeToGhs3dIdMap.size()<<std::endl;
-#endif
- theEnforcedNodeByGhs3dId.resize( anEnforcedNodeToGhs3dIdMap.size());
- n2id = anEnforcedNodeToGhs3dIdMap.begin();
- for ( ; n2id != anEnforcedNodeToGhs3dIdMap.end(); ++ n2id)
- {
- if (n2id->second > aNodeToGhs3dIdMap.size()) {
- theEnforcedNodeByGhs3dId[ n2id->second - aNodeToGhs3dIdMap.size() - 1 ] = n2id->first; // ghs3d ids count from 1
- }
- }
-
-
- /* ========================== NODES ========================== */
- vector<const SMDS_MeshNode*> theOrderedNodes, theRequiredNodes;
- std::set< std::vector<double> > nodesCoords;
- vector<const SMDS_MeshNode*>::const_iterator ghs3dNodeIt = theNodeByGhs3dId.begin();
- vector<const SMDS_MeshNode*>::const_iterator after = theNodeByGhs3dId.end();
-
- (theNodeByGhs3dId.size() <= 1) ? tmpStr = " node" : " nodes";
- std::cout << theNodeByGhs3dId.size() << tmpStr << " from mesh ..." << std::endl;
- for ( ; ghs3dNodeIt != after; ++ghs3dNodeIt )
- {
- const SMDS_MeshNode* node = *ghs3dNodeIt;
- std::vector<double> coords;
- coords.push_back(node->X());
- coords.push_back(node->Y());
- coords.push_back(node->Z());
- nodesCoords.insert(coords);
- theOrderedNodes.push_back(node);
- }
-
- // Iterate over the enforced nodes given by enforced elements
- ghs3dNodeIt = theEnforcedNodeByGhs3dId.begin();
- after = theEnforcedNodeByGhs3dId.end();
- (theEnforcedNodeByGhs3dId.size() <= 1) ? tmpStr = " node" : " nodes";
- std::cout << theEnforcedNodeByGhs3dId.size() << tmpStr << " from enforced elements ..." << std::endl;
- for ( ; ghs3dNodeIt != after; ++ghs3dNodeIt )
- {
- const SMDS_MeshNode* node = *ghs3dNodeIt;
- std::vector<double> coords;
- coords.push_back(node->X());
- coords.push_back(node->Y());
- coords.push_back(node->Z());
-#ifdef _DEBUG_
- std::cout << "Node at " << node->X()<<", " <<node->Y()<<", " <<node->Z();
-#endif
-
- if (nodesCoords.find(coords) != nodesCoords.end()) {
- // node already exists in original mesh
-#ifdef _DEBUG_
- std::cout << " found" << std::endl;
-#endif
- continue;
- }
-
- if (theEnforcedVertices.find(coords) != theEnforcedVertices.end()) {
- // node already exists in enforced vertices
-#ifdef _DEBUG_
- std::cout << " found" << std::endl;
-#endif
- continue;
- }
-
-// gp_Pnt myPoint(node->X(),node->Y(),node->Z());
-// nbFoundElems = pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems);
-// if (nbFoundElems ==0) {
-// std::cout << " not found" << std::endl;
-// if ((*aNodeToTopAbs_StateMap.find(node)).second == TopAbs_IN) {
-// nodesCoords.insert(coords);
-// theOrderedNodes.push_back(node);
-// }
-// }
-// else {
-// std::cout << " found in initial mesh" << std::endl;
-// const SMDS_MeshNode* existingNode = (SMDS_MeshNode*) foundElems.at(0);
-// nodesCoords.insert(coords);
-// theOrderedNodes.push_back(existingNode);
-// }
-
-#ifdef _DEBUG_
- std::cout << " not found" << std::endl;
-#endif
-
- nodesCoords.insert(coords);
- theOrderedNodes.push_back(node);
-// theRequiredNodes.push_back(node);
- }
-
-
- // Iterate over the enforced nodes
- GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap::const_iterator enfNodeIt;
- (theEnforcedNodes.size() <= 1) ? tmpStr = " node" : " nodes";
- std::cout << theEnforcedNodes.size() << tmpStr << " from enforced nodes ..." << std::endl;
- for(enfNodeIt = theEnforcedNodes.begin() ; enfNodeIt != theEnforcedNodes.end() ; ++enfNodeIt)
- {
- const SMDS_MeshNode* node = enfNodeIt->first;
- std::vector<double> coords;
- coords.push_back(node->X());
- coords.push_back(node->Y());
- coords.push_back(node->Z());
-#ifdef _DEBUG_
- std::cout << "Node at " << node->X()<<", " <<node->Y()<<", " <<node->Z();
-#endif
-
- // Test if point is inside shape to mesh
- gp_Pnt myPoint(node->X(),node->Y(),node->Z());
- TopAbs_State result = pntCls->GetPointState( myPoint );
- if ( result == TopAbs_OUT ) {
-#ifdef _DEBUG_
- std::cout << " out of volume" << std::endl;
-#endif
- continue;
- }
-
- if (nodesCoords.find(coords) != nodesCoords.end()) {
-#ifdef _DEBUG_
- std::cout << " found in nodesCoords" << std::endl;
-#endif
-// theRequiredNodes.push_back(node);
- continue;
- }
-
- if (theEnforcedVertices.find(coords) != theEnforcedVertices.end()) {
-#ifdef _DEBUG_
- std::cout << " found in theEnforcedVertices" << std::endl;
-#endif
- continue;
- }
-
-// nbFoundElems = pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems);
-// if (nbFoundElems ==0) {
-// std::cout << " not found" << std::endl;
-// if (result == TopAbs_IN) {
-// nodesCoords.insert(coords);
-// theRequiredNodes.push_back(node);
-// }
-// }
-// else {
-// std::cout << " found in initial mesh" << std::endl;
-// const SMDS_MeshNode* existingNode = (SMDS_MeshNode*) foundElems.at(0);
-// // nodesCoords.insert(coords);
-// theRequiredNodes.push_back(existingNode);
-// }
-//
-//
-//
-// if (pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems) == 0)
-// continue;
-
-// if ( result != TopAbs_IN )
-// continue;
-
-#ifdef _DEBUG_
- std::cout << " not found" << std::endl;
-#endif
- nodesCoords.insert(coords);
-// theOrderedNodes.push_back(node);
- theRequiredNodes.push_back(node);
- }
- int requiredNodes = theRequiredNodes.size();
-
- int solSize = 0;
- std::vector<std::vector<double> > ReqVerTab;
- if (nbEnforcedVertices) {
-// ReqVerTab.clear();
- (nbEnforcedVertices <= 1) ? tmpStr = " node" : " nodes";
- std::cout << nbEnforcedVertices << tmpStr << " from enforced vertices ..." << std::endl;
- // Iterate over the enforced vertices
- for(vertexIt = theEnforcedVertices.begin() ; vertexIt != theEnforcedVertices.end() ; ++vertexIt) {
- double x = vertexIt->first[0];
- double y = vertexIt->first[1];
- double z = vertexIt->first[2];
- // Test if point is inside shape to mesh
- gp_Pnt myPoint(x,y,z);
- TopAbs_State result = pntCls->GetPointState( myPoint );
- if ( result == TopAbs_OUT )
- continue;
- //if (pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems) == 0)
- //continue;
-
-// if ( result != TopAbs_IN )
-// continue;
- std::vector<double> coords;
- coords.push_back(x);
- coords.push_back(y);
- coords.push_back(z);
- ReqVerTab.push_back(coords);
- enfVertexSizes.push_back(vertexIt->second);
- solSize++;
- }
- }
-
-
- // GmfVertices
- std::cout << "Begin writting required nodes in GmfVertices" << std::endl;
- std::cout << "Nb vertices: " << theOrderedNodes.size() << std::endl;
- GmfSetKwd(idx, GmfVertices, theOrderedNodes.size()/*+solSize*/);
- for (ghs3dNodeIt = theOrderedNodes.begin();ghs3dNodeIt != theOrderedNodes.end();++ghs3dNodeIt) {
- GmfSetLin(idx, GmfVertices, (*ghs3dNodeIt)->X(), (*ghs3dNodeIt)->Y(), (*ghs3dNodeIt)->Z(), dummyint);
- }
-
- std::cout << "End writting required nodes in GmfVertices" << std::endl;
-
- if (requiredNodes + solSize) {
- std::cout << "Begin writting in req and sol file" << std::endl;
- aNodeGroupByGhs3dId.resize( requiredNodes + solSize );
- idxRequired = GmfOpenMesh(theRequiredFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
- if (!idxRequired) {
- GmfCloseMesh(idx);
- return false;
- }
- idxSol = GmfOpenMesh(theSolFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
- if (!idxSol) {
- GmfCloseMesh(idx);
- if (idxRequired)
- GmfCloseMesh(idxRequired);
- return false;
- }
- int TypTab[] = {GmfSca};
- double ValTab[] = {0.0};
- GmfSetKwd(idxRequired, GmfVertices, requiredNodes + solSize);
- GmfSetKwd(idxSol, GmfSolAtVertices, requiredNodes + solSize, 1, TypTab);
-// int usedEnforcedNodes = 0;
-// std::string gn = "";
- for (ghs3dNodeIt = theRequiredNodes.begin();ghs3dNodeIt != theRequiredNodes.end();++ghs3dNodeIt) {
- GmfSetLin(idxRequired, GmfVertices, (*ghs3dNodeIt)->X(), (*ghs3dNodeIt)->Y(), (*ghs3dNodeIt)->Z(), dummyint);
- GmfSetLin(idxSol, GmfSolAtVertices, ValTab);
- if (theEnforcedNodes.find((*ghs3dNodeIt)) != theEnforcedNodes.end())
- gn = theEnforcedNodes.find((*ghs3dNodeIt))->second;
- aNodeGroupByGhs3dId[usedEnforcedNodes] = gn;
- usedEnforcedNodes++;
- }
-
- for (int i=0;i<solSize;i++) {
- std::cout << ReqVerTab[i][0] <<" "<< ReqVerTab[i][1] << " "<< ReqVerTab[i][2] << std::endl;
-#ifdef _DEBUG_
- std::cout << "enfVertexSizes.at("<<i<<"): " << enfVertexSizes.at(i) << std::endl;
-#endif
- double solTab[] = {enfVertexSizes.at(i)};
- GmfSetLin(idxRequired, GmfVertices, ReqVerTab[i][0], ReqVerTab[i][1], ReqVerTab[i][2], dummyint);
- GmfSetLin(idxSol, GmfSolAtVertices, solTab);
- aNodeGroupByGhs3dId[usedEnforcedNodes] = enfVerticesWithGroup.find(ReqVerTab[i])->second;
-#ifdef _DEBUG_
- std::cout << "aNodeGroupByGhs3dId["<<usedEnforcedNodes<<"] = \""<<aNodeGroupByGhs3dId[usedEnforcedNodes]<<"\""<<std::endl;
-#endif
- usedEnforcedNodes++;
- }
- std::cout << "End writting in req and sol file" << std::endl;
- }
-
- int nedge[2], ntri[3];
-
- // GmfEdges
- int usedEnforcedEdges = 0;
- if (theKeptEnforcedEdges.size()) {
- anEdgeGroupByGhs3dId.resize( theKeptEnforcedEdges.size() );
-// idxRequired = GmfOpenMesh(theRequiredFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
-// if (!idxRequired)
-// return false;
- GmfSetKwd(idx, GmfEdges, theKeptEnforcedEdges.size());
-// GmfSetKwd(idxRequired, GmfEdges, theKeptEnforcedEdges.size());
- for(elemSetIt = theKeptEnforcedEdges.begin() ; elemSetIt != theKeptEnforcedEdges.end() ; ++elemSetIt) {
- elem = (*elemSetIt);
- nodeIt = elem->nodesIterator();
- int index=0;
- while ( nodeIt->more() ) {
- // find GHS3D ID
- const SMDS_MeshNode* node = castToNode( nodeIt->next() );
- map< const SMDS_MeshNode*,int >::iterator it = anEnforcedNodeToGhs3dIdMap.find(node);
- if (it == anEnforcedNodeToGhs3dIdMap.end()) {
- it = anExistingEnforcedNodeToGhs3dIdMap.find(node);
- if (it == anEnforcedNodeToGhs3dIdMap.end())
- throw "Node not found";
- }
- nedge[index] = it->second;
- index++;
- }
- GmfSetLin(idx, GmfEdges, nedge[0], nedge[1], dummyint);
- anEdgeGroupByGhs3dId[usedEnforcedEdges] = theEnforcedEdges.find(elem)->second;
-// GmfSetLin(idxRequired, GmfEdges, nedge[0], nedge[1], dummyint);
- usedEnforcedEdges++;
- }
-// GmfCloseMesh(idxRequired);
- }
-
-
- if (usedEnforcedEdges) {
- GmfSetKwd(idx, GmfRequiredEdges, usedEnforcedEdges);
- for (int enfID=1;enfID<=usedEnforcedEdges;enfID++) {
- GmfSetLin(idx, GmfRequiredEdges, enfID);
- }
- }
-
- // GmfTriangles
- int usedEnforcedTriangles = 0;
- if (anElemSet.size()+theKeptEnforcedTriangles.size()) {
- aFaceGroupByGhs3dId.resize( anElemSet.size()+theKeptEnforcedTriangles.size() );
- GmfSetKwd(idx, GmfTriangles, anElemSet.size()+theKeptEnforcedTriangles.size());
- int k=0;
- for(elemSetIt = anElemSet.begin() ; elemSetIt != anElemSet.end() ; ++elemSetIt,++k) {
- elem = (*elemSetIt);
- theFaceByGhs3dId.push_back( elem );
- nodeIt = elem->nodesIterator();
- int index=0;
- for ( int j = 0; j < 3; ++j ) {
- // find GHS3D ID
- const SMDS_MeshNode* node = castToNode( nodeIt->next() );
- map< const SMDS_MeshNode*,int >::iterator it = aNodeToGhs3dIdMap.find(node);
- if (it == aNodeToGhs3dIdMap.end())
- throw "Node not found";
- ntri[index] = it->second;
- index++;
- }
- GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], dummyint);
- aFaceGroupByGhs3dId[k] = "";
- }
- if ( !theHelper.GetMesh()->HasShapeToMesh() )
- SMESHUtils::FreeVector( theFaceByGhs3dId );
- if (theKeptEnforcedTriangles.size()) {
- for(elemSetIt = theKeptEnforcedTriangles.begin() ; elemSetIt != theKeptEnforcedTriangles.end() ; ++elemSetIt,++k) {
- elem = (*elemSetIt);
- nodeIt = elem->nodesIterator();
- int index=0;
- for ( int j = 0; j < 3; ++j ) {
- // find GHS3D ID
- const SMDS_MeshNode* node = castToNode( nodeIt->next() );
- map< const SMDS_MeshNode*,int >::iterator it = anEnforcedNodeToGhs3dIdMap.find(node);
- if (it == anEnforcedNodeToGhs3dIdMap.end()) {
- it = anExistingEnforcedNodeToGhs3dIdMap.find(node);
- if (it == anEnforcedNodeToGhs3dIdMap.end())
- throw "Node not found";
- }
- ntri[index] = it->second;
- index++;
- }
- GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], dummyint);
- aFaceGroupByGhs3dId[k] = theEnforcedTriangles.find(elem)->second;
- usedEnforcedTriangles++;
- }
- }
- }
-
-
- if (usedEnforcedTriangles) {
- GmfSetKwd(idx, GmfRequiredTriangles, usedEnforcedTriangles);
- for (int enfID=1;enfID<=usedEnforcedTriangles;enfID++)
- GmfSetLin(idx, GmfRequiredTriangles, anElemSet.size()+enfID);
- }
-
- GmfCloseMesh(idx);
- if (idxRequired)
- GmfCloseMesh(idxRequired);
- if (idxSol)
- GmfCloseMesh(idxSol);
-
- return true;
-
-}
-
-// static bool writeGMFFile(const char* theMeshFileName,
-// const char* theRequiredFileName,
-// const char* theSolFileName,
-// SMESH_MesherHelper& theHelper,
-// const SMESH_ProxyMesh& theProxyMesh,
-// std::map <int,int> & theNodeId2NodeIndexMap,
-// std::map <int,int> & theSmdsToGhs3dIdMap,
-// std::map <int,const SMDS_MeshNode*> & theGhs3dIdToNodeMap,
-// TIDSortedNodeSet & theEnforcedNodes,
-// TIDSortedElemSet & theEnforcedEdges,
-// TIDSortedElemSet & theEnforcedTriangles,
-// // TIDSortedElemSet & theEnforcedQuadrangles,
-// GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues & theEnforcedVertices)
-// {
-// MESSAGE("writeGMFFile with geometry");
-// int idx, idxRequired, idxSol;
-// int nbv, nbev, nben, aGhs3dID = 0;
-// const int dummyint = 0;
-// GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues::const_iterator vertexIt;
-// std::vector<double> enfVertexSizes;
-// TIDSortedNodeSet::const_iterator enfNodeIt;
-// const SMDS_MeshNode* node;
-// SMDS_NodeIteratorPtr nodeIt;
-//
-// idx = GmfOpenMesh(theMeshFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
-// if (!idx)
-// return false;
-//
-// SMESHDS_Mesh * theMeshDS = theHelper.GetMeshDS();
-//
-// /* ========================== NODES ========================== */
-// // NB_NODES
-// nbv = theMeshDS->NbNodes();
-// if ( nbv == 0 )
-// return false;
-// nbev = theEnforcedVertices.size();
-// nben = theEnforcedNodes.size();
-//
-// // Issue 020674: EDF 870 SMESH: Mesh generated by Netgen not usable by GHS3D
-// // The problem is in nodes on degenerated edges, we need to skip nodes which are free
-// // and replace not-free nodes on edges by the node on vertex
-// TNodeNodeMap n2nDegen; // map a node on degenerated edge to a node on vertex
-// TNodeNodeMap::iterator n2nDegenIt;
-// if ( theHelper.HasDegeneratedEdges() )
-// {
-// set<int> checkedSM;
-// for (TopExp_Explorer e(theMeshDS->ShapeToMesh(), TopAbs_EDGE ); e.More(); e.Next())
-// {
-// SMESH_subMesh* sm = theHelper.GetMesh()->GetSubMesh( e.Current() );
-// if ( checkedSM.insert( sm->GetId() ).second && theHelper.IsDegenShape(sm->GetId() ))
-// {
-// if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() )
-// {
-// TopoDS_Shape vertex = TopoDS_Iterator( e.Current() ).Value();
-// const SMDS_MeshNode* vNode = SMESH_Algo::VertexNode( TopoDS::Vertex( vertex ), theMeshDS);
-// {
-// SMDS_NodeIteratorPtr nIt = smDS->GetNodes();
-// while ( nIt->more() )
-// n2nDegen.insert( make_pair( nIt->next(), vNode ));
-// }
-// }
-// }
-// }
-// }
-//
-// const bool isQuadMesh =
-// theHelper.GetMesh()->NbEdges( ORDER_QUADRATIC ) ||
-// theHelper.GetMesh()->NbFaces( ORDER_QUADRATIC ) ||
-// theHelper.GetMesh()->NbVolumes( ORDER_QUADRATIC );
-//
-// std::vector<std::vector<double> > VerTab;
-// std::set<std::vector<double> > VerMap;
-// VerTab.clear();
-// std::vector<double> aVerTab;
-// // Loop from 1 to NB_NODES
-//
-// nodeIt = theMeshDS->nodesIterator();
-//
-// while ( nodeIt->more() )
-// {
-// node = nodeIt->next();
-// if ( isQuadMesh && theHelper.IsMedium( node )) // Issue 0021238
-// continue;
-// if ( n2nDegen.count( node ) ) // Issue 0020674
-// continue;
-//
-// std::vector<double> coords;
-// coords.push_back(node->X());
-// coords.push_back(node->Y());
-// coords.push_back(node->Z());
-// if (VerMap.find(coords) != VerMap.end()) {
-// aGhs3dID = theSmdsToGhs3dIdMap[node->GetID()];
-// theGhs3dIdToNodeMap[theSmdsToGhs3dIdMap[node->GetID()]] = node;
-// continue;
-// }
-// VerTab.push_back(coords);
-// VerMap.insert(coords);
-// aGhs3dID++;
-// theSmdsToGhs3dIdMap.insert( make_pair( node->GetID(), aGhs3dID ));
-// theGhs3dIdToNodeMap.insert( make_pair( aGhs3dID, node ));
-// }
-//
-//
-// /* ENFORCED NODES ========================== */
-// if (nben) {
-// std::cout << "Add " << nben << " enforced nodes to input .mesh file" << std::endl;
-// for(enfNodeIt = theEnforcedNodes.begin() ; enfNodeIt != theEnforcedNodes.end() ; ++enfNodeIt) {
-// double x = (*enfNodeIt)->X();
-// double y = (*enfNodeIt)->Y();
-// double z = (*enfNodeIt)->Z();
-// // Test if point is inside shape to mesh
-// gp_Pnt myPoint(x,y,z);
-// BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh());
-// scl.Perform(myPoint, 1e-7);
-// TopAbs_State result = scl.State();
-// if ( result != TopAbs_IN )
-// continue;
-// std::vector<double> coords;
-// coords.push_back(x);
-// coords.push_back(y);
-// coords.push_back(z);
-// if (theEnforcedVertices.find(coords) != theEnforcedVertices.end())
-// continue;
-// if (VerMap.find(coords) != VerMap.end())
-// continue;
-// VerTab.push_back(coords);
-// VerMap.insert(coords);
-// aGhs3dID++;
-// theNodeId2NodeIndexMap.insert( make_pair( (*enfNodeIt)->GetID(), aGhs3dID ));
-// }
-// }
-//
-//
-// /* ENFORCED VERTICES ========================== */
-// int solSize = 0;
-// std::vector<std::vector<double> > ReqVerTab;
-// ReqVerTab.clear();
-// if (nbev) {
-// std::cout << "Add " << nbev << " enforced vertices to input .mesh file" << std::endl;
-// for(vertexIt = theEnforcedVertices.begin() ; vertexIt != theEnforcedVertices.end() ; ++vertexIt) {
-// double x = vertexIt->first[0];
-// double y = vertexIt->first[1];
-// double z = vertexIt->first[2];
-// // Test if point is inside shape to mesh
-// gp_Pnt myPoint(x,y,z);
-// BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh());
-// scl.Perform(myPoint, 1e-7);
-// TopAbs_State result = scl.State();
-// if ( result != TopAbs_IN )
-// continue;
-// enfVertexSizes.push_back(vertexIt->second);
-// std::vector<double> coords;
-// coords.push_back(x);
-// coords.push_back(y);
-// coords.push_back(z);
-// if (VerMap.find(coords) != VerMap.end())
-// continue;
-// ReqVerTab.push_back(coords);
-// VerMap.insert(coords);
-// solSize++;
-// }
-// }
-//
-//
-// /* ========================== FACES ========================== */
-//
-// int nbTriangles = 0/*, nbQuadrangles = 0*/, aSmdsID;
-// TopTools_IndexedMapOfShape facesMap, trianglesMap/*, quadranglesMap*/;
-// TIDSortedElemSet::const_iterator elemIt;
-// const SMESHDS_SubMesh* theSubMesh;
-// TopoDS_Shape aShape;
-// SMDS_ElemIteratorPtr itOnSubMesh, itOnSubFace;
-// const SMDS_MeshElement* aFace;
-// map<int,int>::const_iterator itOnMap;
-// std::vector<std::vector<int> > tt, qt,et;
-// tt.clear();
-// qt.clear();
-// et.clear();
-// std::vector<int> att, aqt, aet;
-//
-// TopExp::MapShapes( theMeshDS->ShapeToMesh(), TopAbs_FACE, facesMap );
-//
-// for ( int i = 1; i <= facesMap.Extent(); ++i )
-// if (( theSubMesh = theProxyMesh.GetSubMesh( facesMap(i))))
-// {
-// SMDS_ElemIteratorPtr it = theSubMesh->GetElements();
-// while (it->more())
-// {
-// const SMDS_MeshElement *elem = it->next();
-// int nbCornerNodes = elem->NbCornerNodes();
-// if (nbCornerNodes == 3)
-// {
-// trianglesMap.Add(facesMap(i));
-// nbTriangles ++;
-// }
-// // else if (nbCornerNodes == 4)
-// // {
-// // quadranglesMap.Add(facesMap(i));
-// // nbQuadrangles ++;
-// // }
-// }
-// }
-//
-// /* TRIANGLES ========================== */
-// if (nbTriangles) {
-// for ( int i = 1; i <= trianglesMap.Extent(); i++ )
-// {
-// aShape = trianglesMap(i);
-// theSubMesh = theProxyMesh.GetSubMesh(aShape);
-// if ( !theSubMesh ) continue;
-// itOnSubMesh = theSubMesh->GetElements();
-// while ( itOnSubMesh->more() )
-// {
-// aFace = itOnSubMesh->next();
-// itOnSubFace = aFace->nodesIterator();
-// att.clear();
-// for ( int j = 0; j < 3; ++j ) {
-// // find GHS3D ID
-// node = castToNode( itOnSubFace->next() );
-// if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() )
-// node = n2nDegenIt->second;
-// aSmdsID = node->GetID();
-// itOnMap = theSmdsToGhs3dIdMap.find( aSmdsID );
-// ASSERT( itOnMap != theSmdsToGhs3dIdMap.end() );
-// att.push_back((*itOnMap).second);
-// }
-// tt.push_back(att);
-// }
-// }
-// }
-//
-// if (theEnforcedTriangles.size()) {
-// std::cout << "Add " << theEnforcedTriangles.size() << " enforced triangles to input .mesh file" << std::endl;
-// // Iterate over the enforced triangles
-// for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) {
-// aFace = (*elemIt);
-// itOnSubFace = aFace->nodesIterator();
-// bool isOK = true;
-// att.clear();
-//
-// for ( int j = 0; j < 3; ++j ) {
-// node = castToNode( itOnSubFace->next() );
-// if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() )
-// node = n2nDegenIt->second;
-// // std::cout << node;
-// double x = node->X();
-// double y = node->Y();
-// double z = node->Z();
-// // Test if point is inside shape to mesh
-// gp_Pnt myPoint(x,y,z);
-// BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh());
-// scl.Perform(myPoint, 1e-7);
-// TopAbs_State result = scl.State();
-// if ( result != TopAbs_IN ) {
-// isOK = false;
-// theEnforcedTriangles.erase(elemIt);
-// continue;
-// }
-// std::vector<double> coords;
-// coords.push_back(x);
-// coords.push_back(y);
-// coords.push_back(z);
-// if (VerMap.find(coords) != VerMap.end()) {
-// att.push_back(theNodeId2NodeIndexMap[node->GetID()]);
-// continue;
-// }
-// VerTab.push_back(coords);
-// VerMap.insert(coords);
-// aGhs3dID++;
-// theNodeId2NodeIndexMap.insert( make_pair( node->GetID(), aGhs3dID ));
-// att.push_back(aGhs3dID);
-// }
-// if (isOK)
-// tt.push_back(att);
-// }
-// }
-//
-//
-// /* ========================== EDGES ========================== */
-//
-// if (theEnforcedEdges.size()) {
-// // Iterate over the enforced edges
-// std::cout << "Add " << theEnforcedEdges.size() << " enforced edges to input .mesh file" << std::endl;
-// for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) {
-// aFace = (*elemIt);
-// bool isOK = true;
-// itOnSubFace = aFace->nodesIterator();
-// aet.clear();
-// for ( int j = 0; j < 2; ++j ) {
-// node = castToNode( itOnSubFace->next() );
-// if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() )
-// node = n2nDegenIt->second;
-// double x = node->X();
-// double y = node->Y();
-// double z = node->Z();
-// // Test if point is inside shape to mesh
-// gp_Pnt myPoint(x,y,z);
-// BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh());
-// scl.Perform(myPoint, 1e-7);
-// TopAbs_State result = scl.State();
-// if ( result != TopAbs_IN ) {
-// isOK = false;
-// theEnforcedEdges.erase(elemIt);
-// continue;
-// }
-// std::vector<double> coords;
-// coords.push_back(x);
-// coords.push_back(y);
-// coords.push_back(z);
-// if (VerMap.find(coords) != VerMap.end()) {
-// aet.push_back(theNodeId2NodeIndexMap[node->GetID()]);
-// continue;
-// }
-// VerTab.push_back(coords);
-// VerMap.insert(coords);
-//
-// aGhs3dID++;
-// theNodeId2NodeIndexMap.insert( make_pair( node->GetID(), aGhs3dID ));
-// aet.push_back(aGhs3dID);
-// }
-// if (isOK)
-// et.push_back(aet);
-// }
-// }
-//
-//
-// /* Write vertices number */
-// MESSAGE("Number of vertices: "<<aGhs3dID);
-// MESSAGE("Size of vector: "<<VerTab.size());
-// GmfSetKwd(idx, GmfVertices, aGhs3dID/*+solSize*/);
-// for (int i=0;i<aGhs3dID;i++)
-// GmfSetLin(idx, GmfVertices, VerTab[i][0], VerTab[i][1], VerTab[i][2], dummyint);
-// // for (int i=0;i<solSize;i++) {
-// // std::cout << ReqVerTab[i][0] <<" "<< ReqVerTab[i][1] << " "<< ReqVerTab[i][2] << std::endl;
-// // GmfSetLin(idx, GmfVertices, ReqVerTab[i][0], ReqVerTab[i][1], ReqVerTab[i][2], dummyint);
-// // }
-//
-// if (solSize) {
-// idxRequired = GmfOpenMesh(theRequiredFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
-// if (!idxRequired) {
-// GmfCloseMesh(idx);
-// return false;
-// }
-// idxSol = GmfOpenMesh(theSolFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
-// if (!idxSol){
-// GmfCloseMesh(idx);
-// if (idxRequired)
-// GmfCloseMesh(idxRequired);
-// return false;
-// }
-//
-// int TypTab[] = {GmfSca};
-// GmfSetKwd(idxRequired, GmfVertices, solSize);
-// GmfSetKwd(idxSol, GmfSolAtVertices, solSize, 1, TypTab);
-//
-// for (int i=0;i<solSize;i++) {
-// double solTab[] = {enfVertexSizes.at(i)};
-// GmfSetLin(idxRequired, GmfVertices, ReqVerTab[i][0], ReqVerTab[i][1], ReqVerTab[i][2], dummyint);
-// GmfSetLin(idxSol, GmfSolAtVertices, solTab);
-// }
-// GmfCloseMesh(idxRequired);
-// GmfCloseMesh(idxSol);
-// }
-//
-// /* Write triangles number */
-// if (tt.size()) {
-// GmfSetKwd(idx, GmfTriangles, tt.size());
-// for (int i=0;i<tt.size();i++)
-// GmfSetLin(idx, GmfTriangles, tt[i][0], tt[i][1], tt[i][2], dummyint);
-// }
-//
-// /* Write edges number */
-// if (et.size()) {
-// GmfSetKwd(idx, GmfEdges, et.size());
-// for (int i=0;i<et.size();i++)
-// GmfSetLin(idx, GmfEdges, et[i][0], et[i][1], dummyint);
-// }
-//
-// /* QUADRANGLES ========================== */
-// // TODO: add pyramids ?
-// // if (nbQuadrangles) {
-// // for ( int i = 1; i <= quadranglesMap.Extent(); i++ )
-// // {
-// // aShape = quadranglesMap(i);
-// // theSubMesh = theProxyMesh.GetSubMesh(aShape);
-// // if ( !theSubMesh ) continue;
-// // itOnSubMesh = theSubMesh->GetElements();
-// // for ( int j = 0; j < 4; ++j )
-// // {
-// // aFace = itOnSubMesh->next();
-// // itOnSubFace = aFace->nodesIterator();
-// // aqt.clear();
-// // while ( itOnSubFace->more() ) {
-// // // find GHS3D ID
-// // aSmdsID = itOnSubFace->next()->GetID();
-// // itOnMap = theSmdsToGhs3dIdMap.find( aSmdsID );
-// // ASSERT( itOnMap != theSmdsToGhs3dIdMap.end() );
-// // aqt.push_back((*itOnMap).second);
-// // }
-// // qt.push_back(aqt);
-// // }
-// // }
-// // }
-// //
-// // if (theEnforcedQuadrangles.size()) {
-// // // Iterate over the enforced triangles
-// // for(elemIt = theEnforcedQuadrangles.begin() ; elemIt != theEnforcedQuadrangles.end() ; ++elemIt) {
-// // aFace = (*elemIt);
-// // bool isOK = true;
-// // itOnSubFace = aFace->nodesIterator();
-// // aqt.clear();
-// // for ( int j = 0; j < 4; ++j ) {
-// // int aNodeID = itOnSubFace->next()->GetID();
-// // itOnMap = theNodeId2NodeIndexMap.find(aNodeID);
-// // if (itOnMap != theNodeId2NodeIndexMap.end())
-// // aqt.push_back((*itOnMap).second);
-// // else {
-// // isOK = false;
-// // theEnforcedQuadrangles.erase(elemIt);
-// // break;
-// // }
-// // }
-// // if (isOK)
-// // qt.push_back(aqt);
-// // }
-// // }
-// //
-//
-// // /* Write quadrilaterals number */
-// // if (qt.size()) {
-// // GmfSetKwd(idx, GmfQuadrilaterals, qt.size());
-// // for (int i=0;i<qt.size();i++)
-// // GmfSetLin(idx, GmfQuadrilaterals, qt[i][0], qt[i][1], qt[i][2], qt[i][3], dummyint);
-// // }
-//
-// GmfCloseMesh(idx);
-// return true;
-// }
-
-
-//=======================================================================
-//function : writeFaces
-//purpose :
-//=======================================================================
-
-static bool writeFaces (ofstream & theFile,
- const SMESH_ProxyMesh& theMesh,
- const TopoDS_Shape& theShape,
- const map <int,int> & theSmdsToGhs3dIdMap,
- const map <int,int> & theEnforcedNodeIdToGhs3dIdMap,
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges,
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles)
-{
- // record structure:
- //
- // NB_ELEMS DUMMY_INT
- // Loop from 1 to NB_ELEMS
- // NB_NODES NODE_NB_1 NODE_NB_2 ... (NB_NODES + 1) times: DUMMY_INT
-
- TopoDS_Shape aShape;
- const SMESHDS_SubMesh* theSubMesh;
- const SMDS_MeshElement* aFace;
- const char* space = " ";
- const int dummyint = 0;
- map<int,int>::const_iterator itOnMap;
- SMDS_ElemIteratorPtr itOnSubMesh, itOnSubFace;
- int nbNodes, aSmdsID;
-
- TIDSortedElemSet::const_iterator elemIt;
- int nbEnforcedEdges = theEnforcedEdges.size();
- int nbEnforcedTriangles = theEnforcedTriangles.size();
-
- // count triangles bound to geometry
- int nbTriangles = 0;
-
- TopTools_IndexedMapOfShape facesMap, trianglesMap;
- TopExp::MapShapes( theShape, TopAbs_FACE, facesMap );
-
- int nbFaces = facesMap.Extent();
-
- for ( int i = 1; i <= nbFaces; ++i )
- if (( theSubMesh = theMesh.GetSubMesh( facesMap(i))))
- nbTriangles += theSubMesh->NbElements();
- std::string tmpStr;
- (nbFaces == 0 || nbFaces == 1) ? tmpStr = " shape " : tmpStr = " shapes " ;
- std::cout << " " << nbFaces << tmpStr << "of 2D dimension";
- int nbEnforcedElements = nbEnforcedEdges+nbEnforcedTriangles;
- if (nbEnforcedElements > 0) {
- (nbEnforcedElements == 1) ? tmpStr = "shape:" : tmpStr = "shapes:";
- std::cout << " and" << std::endl;
- std::cout << " " << nbEnforcedElements
- << " enforced " << tmpStr << std::endl;
- }
- else
- std::cout << std::endl;
- if (nbEnforcedEdges) {
- (nbEnforcedEdges == 1) ? tmpStr = "edge" : tmpStr = "edges";
- std::cout << " " << nbEnforcedEdges << " enforced " << tmpStr << std::endl;
- }
- if (nbEnforcedTriangles) {
- (nbEnforcedTriangles == 1) ? tmpStr = "triangle" : tmpStr = "triangles";
- std::cout << " " << nbEnforcedTriangles << " enforced " << tmpStr << std::endl;
- }
- std::cout << std::endl;
-
-// theFile << space << nbTriangles << space << dummyint << std::endl;
- std::ostringstream globalStream, localStream, aStream;
-
- for ( int i = 1; i <= facesMap.Extent(); i++ )
- {
- aShape = facesMap(i);
- theSubMesh = theMesh.GetSubMesh(aShape);
- if ( !theSubMesh ) continue;
- itOnSubMesh = theSubMesh->GetElements();
- while ( itOnSubMesh->more() )
- {
- aFace = itOnSubMesh->next();
- nbNodes = aFace->NbCornerNodes();
-
- localStream << nbNodes << space;
-
- itOnSubFace = aFace->nodesIterator();
- for ( int j = 0; j < 3; ++j ) {
- // find GHS3D ID
- aSmdsID = itOnSubFace->next()->GetID();
- itOnMap = theSmdsToGhs3dIdMap.find( aSmdsID );
- // if ( itOnMap == theSmdsToGhs3dIdMap.end() ) {
- // cout << "not found node: " << aSmdsID << endl;
- // return false;
- // }
- ASSERT( itOnMap != theSmdsToGhs3dIdMap.end() );
-
- localStream << (*itOnMap).second << space ;
- }
-
- // (NB_NODES + 1) times: DUMMY_INT
- for ( int j=0; j<=nbNodes; j++)
- localStream << dummyint << space ;
-
- localStream << std::endl;
- }
- }
-
- globalStream << localStream.str();
- localStream.str("");
-
- //
- // FACES : END
- //
-
-// //
-// // ENFORCED EDGES : BEGIN
-// //
-//
-// // Iterate over the enforced edges
-// int usedEnforcedEdges = 0;
-// bool isOK;
-// for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) {
-// aFace = (*elemIt);
-// isOK = true;
-// itOnSubFace = aFace->nodesIterator();
-// aStream.str("");
-// aStream << "2" << space ;
-// for ( int j = 0; j < 2; ++j ) {
-// aSmdsID = itOnSubFace->next()->GetID();
-// itOnMap = theEnforcedNodeIdToGhs3dIdMap.find(aSmdsID);
-// if (itOnMap != theEnforcedNodeIdToGhs3dIdMap.end())
-// aStream << (*itOnMap).second << space;
-// else {
-// isOK = false;
-// break;
-// }
-// }
-// if (isOK) {
-// for ( int j=0; j<=2; j++)
-// aStream << dummyint << space ;
-// // aStream << dummyint << space << dummyint;
-// localStream << aStream.str() << std::endl;
-// usedEnforcedEdges++;
-// }
-// }
-//
-// if (usedEnforcedEdges) {
-// globalStream << localStream.str();
-// localStream.str("");
-// }
-//
-// //
-// // ENFORCED EDGES : END
-// //
-// //
-//
-// //
-// // ENFORCED TRIANGLES : BEGIN
-// //
-// // Iterate over the enforced triangles
-// int usedEnforcedTriangles = 0;
-// for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) {
-// aFace = (*elemIt);
-// nbNodes = aFace->NbCornerNodes();
-// isOK = true;
-// itOnSubFace = aFace->nodesIterator();
-// aStream.str("");
-// aStream << nbNodes << space ;
-// for ( int j = 0; j < 3; ++j ) {
-// aSmdsID = itOnSubFace->next()->GetID();
-// itOnMap = theEnforcedNodeIdToGhs3dIdMap.find(aSmdsID);
-// if (itOnMap != theEnforcedNodeIdToGhs3dIdMap.end())
-// aStream << (*itOnMap).second << space;
-// else {
-// isOK = false;
-// break;
-// }
-// }
-// if (isOK) {
-// for ( int j=0; j<=3; j++)
-// aStream << dummyint << space ;
-// localStream << aStream.str() << std::endl;
-// usedEnforcedTriangles++;
-// }
-// }
-//
-// if (usedEnforcedTriangles) {
-// globalStream << localStream.str();
-// localStream.str("");
-// }
-//
-// //
-// // ENFORCED TRIANGLES : END
-// //
-
- theFile
- << nbTriangles/*+usedEnforcedTriangles+usedEnforcedEdges*/
- << " 0" << std::endl
- << globalStream.str();
-
- return true;
-}
-
-//=======================================================================
-//function : writePoints
-//purpose :
-//=======================================================================
-
-static bool writePoints (ofstream & theFile,
- SMESH_MesherHelper& theHelper,
- map <int,int> & theSmdsToGhs3dIdMap,
- map <int,int> & theEnforcedNodeIdToGhs3dIdMap,
- map <int,const SMDS_MeshNode*> & theGhs3dIdToNodeMap,
- GHS3DPlugin_Hypothesis::TID2SizeMap & theNodeIDToSizeMap,
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues & theEnforcedVertices,
- GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap & theEnforcedNodes,
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges,
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles)
-{
- // record structure:
- //
- // NB_NODES
- // Loop from 1 to NB_NODES
- // X Y Z DUMMY_INT
-
- SMESHDS_Mesh * theMeshDS = theHelper.GetMeshDS();
- int nbNodes = theMeshDS->NbNodes();
- if ( nbNodes == 0 )
- return false;
-
- int nbEnforcedVertices = theEnforcedVertices.size();
- int nbEnforcedNodes = theEnforcedNodes.size();
-
- const TopoDS_Shape shapeToMesh = theMeshDS->ShapeToMesh();
-
- int aGhs3dID = 1;
- SMDS_NodeIteratorPtr nodeIt = theMeshDS->nodesIterator();
- const SMDS_MeshNode* node;
-
- // Issue 020674: EDF 870 SMESH: Mesh generated by Netgen not usable by GHS3D
- // The problem is in nodes on degenerated edges, we need to skip nodes which are free
- // and replace not-free nodes on degenerated edges by the node on vertex
- TNodeNodeMap n2nDegen; // map a node on degenerated edge to a node on vertex
- TNodeNodeMap::iterator n2nDegenIt;
- if ( theHelper.HasDegeneratedEdges() )
- {
- set<int> checkedSM;
- for (TopExp_Explorer e(theMeshDS->ShapeToMesh(), TopAbs_EDGE ); e.More(); e.Next())
- {
- SMESH_subMesh* sm = theHelper.GetMesh()->GetSubMesh( e.Current() );
- if ( checkedSM.insert( sm->GetId() ).second && theHelper.IsDegenShape(sm->GetId() ))
- {
- if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() )
- {
- TopoDS_Shape vertex = TopoDS_Iterator( e.Current() ).Value();
- const SMDS_MeshNode* vNode = SMESH_Algo::VertexNode( TopoDS::Vertex( vertex ), theMeshDS);
- {
- SMDS_NodeIteratorPtr nIt = smDS->GetNodes();
- while ( nIt->more() )
- n2nDegen.insert( make_pair( nIt->next(), vNode ));
- }
- }
- }
- }
- nbNodes -= n2nDegen.size();
- }
-
- const bool isQuadMesh =
- theHelper.GetMesh()->NbEdges( ORDER_QUADRATIC ) ||
- theHelper.GetMesh()->NbFaces( ORDER_QUADRATIC ) ||
- theHelper.GetMesh()->NbVolumes( ORDER_QUADRATIC );
- if ( isQuadMesh )
- {
- // descrease nbNodes by nb of medium nodes
- while ( nodeIt->more() )
- {
- node = nodeIt->next();
- if ( !theHelper.IsDegenShape( node->getshapeId() ))
- nbNodes -= int( theHelper.IsMedium( node ));
- }
- nodeIt = theMeshDS->nodesIterator();
- }
-
- const char* space = " ";
- const int dummyint = 0;
-
- std::string tmpStr;
- (nbNodes == 0 || nbNodes == 1) ? tmpStr = " node" : tmpStr = " nodes";
- // NB_NODES
- std::cout << std::endl;
- std::cout << "The initial 2D mesh contains :" << std::endl;
- std::cout << " " << nbNodes << tmpStr << std::endl;
- if (nbEnforcedVertices > 0) {
- (nbEnforcedVertices == 1) ? tmpStr = "vertex" : tmpStr = "vertices";
- std::cout << " " << nbEnforcedVertices << " enforced " << tmpStr << std::endl;
- }
- if (nbEnforcedNodes > 0) {
- (nbEnforcedNodes == 1) ? tmpStr = "node" : tmpStr = "nodes";
- std::cout << " " << nbEnforcedNodes << " enforced " << tmpStr << std::endl;
- }
- std::cout << std::endl;
- std::cout << "Start writing in 'points' file ..." << std::endl;
-
- theFile << nbNodes << std::endl;
-
- // Loop from 1 to NB_NODES
-
- while ( nodeIt->more() )
- {
- node = nodeIt->next();
- if ( isQuadMesh && theHelper.IsMedium( node )) // Issue 0021238
- continue;
- if ( n2nDegen.count( node ) ) // Issue 0020674
- continue;
-
- theSmdsToGhs3dIdMap.insert( make_pair( node->GetID(), aGhs3dID ));
- theGhs3dIdToNodeMap.insert( make_pair( aGhs3dID, node ));
- aGhs3dID++;
-
- // X Y Z DUMMY_INT
- theFile
- << node->X() << space
- << node->Y() << space
- << node->Z() << space
- << dummyint;
-
- theFile << std::endl;
-
- }
-
- // Iterate over the enforced nodes
- std::map<int,double> enfVertexIndexSizeMap;
- if (nbEnforcedNodes) {
- GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap::const_iterator nodeIt = theEnforcedNodes.begin();
- for( ; nodeIt != theEnforcedNodes.end() ; ++nodeIt) {
- double x = nodeIt->first->X();
- double y = nodeIt->first->Y();
- double z = nodeIt->first->Z();
- // Test if point is inside shape to mesh
- gp_Pnt myPoint(x,y,z);
- BRepClass3d_SolidClassifier scl(shapeToMesh);
- scl.Perform(myPoint, 1e-7);
- TopAbs_State result = scl.State();
- if ( result != TopAbs_IN )
- continue;
- std::vector<double> coords;
- coords.push_back(x);
- coords.push_back(y);
- coords.push_back(z);
- if (theEnforcedVertices.find(coords) != theEnforcedVertices.end())
- continue;
-
-// double size = theNodeIDToSizeMap.find(nodeIt->first->GetID())->second;
- // theGhs3dIdToNodeMap.insert( make_pair( nbNodes + i, (*nodeIt) ));
- // MESSAGE("Adding enforced node (" << x << "," << y <<"," << z << ")");
- // X Y Z PHY_SIZE DUMMY_INT
- theFile
- << x << space
- << y << space
- << z << space
- << -1 << space
- << dummyint << space;
- theFile << std::endl;
- theEnforcedNodeIdToGhs3dIdMap.insert( make_pair( nodeIt->first->GetID(), aGhs3dID ));
- enfVertexIndexSizeMap[aGhs3dID] = -1;
- aGhs3dID++;
- // else
- // MESSAGE("Enforced vertex (" << x << "," << y <<"," << z << ") is not inside the geometry: it was not added ");
- }
- }
-
- if (nbEnforcedVertices) {
- // Iterate over the enforced vertices
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues::const_iterator vertexIt = theEnforcedVertices.begin();
- for( ; vertexIt != theEnforcedVertices.end() ; ++vertexIt) {
- double x = vertexIt->first[0];
- double y = vertexIt->first[1];
- double z = vertexIt->first[2];
- // Test if point is inside shape to mesh
- gp_Pnt myPoint(x,y,z);
- BRepClass3d_SolidClassifier scl(shapeToMesh);
- scl.Perform(myPoint, 1e-7);
- TopAbs_State result = scl.State();
- if ( result != TopAbs_IN )
- continue;
- MESSAGE("Adding enforced vertex (" << x << "," << y <<"," << z << ") = " << vertexIt->second);
- // X Y Z PHY_SIZE DUMMY_INT
- theFile
- << x << space
- << y << space
- << z << space
- << vertexIt->second << space
- << dummyint << space;
- theFile << std::endl;
- enfVertexIndexSizeMap[aGhs3dID] = vertexIt->second;
- aGhs3dID++;
- }
- }
-
-
- std::cout << std::endl;
- std::cout << "End writing in 'points' file." << std::endl;
-
- return true;
-}
-
-//=======================================================================
-//function : readResultFile
-//purpose : readResultFile with geometry
-//=======================================================================
-
-static bool readResultFile(const int fileOpen,
-#ifdef WIN32
- const char* fileName,
-#endif
- GHS3DPlugin_GHS3D* theAlgo,
- SMESH_MesherHelper& theHelper,
- TopoDS_Shape tabShape[],
- double** tabBox,
- const int nbShape,
- map <int,const SMDS_MeshNode*>& theGhs3dIdToNodeMap,
- std::map <int,int> & theNodeId2NodeIndexMap,
- bool toMeshHoles,
- int nbEnforcedVertices,
- int nbEnforcedNodes,
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges,
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles,
- bool toMakeGroupsOfDomains)
-{
- MESSAGE("GHS3DPlugin_GHS3D::readResultFile()");
- Kernel_Utils::Localizer loc;
- struct stat status;
- size_t length;
-
- std::string tmpStr;
-
- char *ptr, *mapPtr;
- char *tetraPtr;
- char *shapePtr;
-
- SMESHDS_Mesh* theMeshDS = theHelper.GetMeshDS();
-
- int nbElems, nbNodes, nbInputNodes;
- int nbTriangle;
- int ID, shapeID, ghs3dShapeID;
- int IdShapeRef = 1;
- int compoundID =
- nbShape ? theMeshDS->ShapeToIndex( tabShape[0] ) : theMeshDS->ShapeToIndex( theMeshDS->ShapeToMesh() );
-
- int *tab, *tabID, *nodeID, *nodeAssigne;
- double *coord;
- const SMDS_MeshNode **node;
-
- tab = new int[3];
- nodeID = new int[4];
- coord = new double[3];
- node = new const SMDS_MeshNode*[4];
-
- TopoDS_Shape aSolid;
- SMDS_MeshNode * aNewNode;
- map <int,const SMDS_MeshNode*>::iterator itOnNode;
- SMDS_MeshElement* aTet;
-#ifdef _DEBUG_
- set<int> shapeIDs;
-#endif
-
- // Read the file state
- fstat(fileOpen, &status);
- length = status.st_size;
-
- // Mapping the result file into memory
-#ifdef WIN32
- HANDLE fd = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- HANDLE hMapObject = CreateFileMapping(fd, NULL, PAGE_READONLY,
- 0, (DWORD)length, NULL);
- ptr = ( char* ) MapViewOfFile(hMapObject, FILE_MAP_READ, 0, 0, 0 );
-#else
- ptr = (char *) mmap(0,length,PROT_READ,MAP_PRIVATE,fileOpen,0);
-#endif
- mapPtr = ptr;
-
- ptr = readMapIntLine(ptr, tab);
- tetraPtr = ptr;
-
- nbElems = tab[0];
- nbNodes = tab[1];
- nbInputNodes = tab[2];
-
- nodeAssigne = new int[ nbNodes+1 ];
-
- if (nbShape > 0)
- aSolid = tabShape[0];
-
- // Reading the nodeId
- for (int i=0; i < 4*nbElems; i++)
- strtol(ptr, &ptr, 10);
-
- MESSAGE("nbInputNodes: "<<nbInputNodes);
- MESSAGE("nbEnforcedVertices: "<<nbEnforcedVertices);
- MESSAGE("nbEnforcedNodes: "<<nbEnforcedNodes);
- // Reading the nodeCoor and update the nodeMap
- for (int iNode=1; iNode <= nbNodes; iNode++) {
- if(theAlgo->computeCanceled())
- return false;
- for (int iCoor=0; iCoor < 3; iCoor++)
- coord[ iCoor ] = strtod(ptr, &ptr);
- nodeAssigne[ iNode ] = 1;
- if ( iNode > (nbInputNodes-(nbEnforcedVertices+nbEnforcedNodes)) ) {
- // Creating SMESH nodes
- // - for enforced vertices
- // - for vertices of forced edges
- // - for ghs3d nodes
- nodeAssigne[ iNode ] = 0;
- aNewNode = theMeshDS->AddNode( coord[0],coord[1],coord[2] );
- theGhs3dIdToNodeMap.insert(theGhs3dIdToNodeMap.end(), make_pair( iNode, aNewNode ));
- }
- }
-
- // Reading the number of triangles which corresponds to the number of sub-domains
- nbTriangle = strtol(ptr, &ptr, 10);
-
- tabID = new int[nbTriangle];
- for (int i=0; i < nbTriangle; i++) {
- if(theAlgo->computeCanceled())
- return false;
- tabID[i] = 0;
- // find the solid corresponding to GHS3D sub-domain following
- // the technique proposed in GHS3D manual in chapter
- // "B.4 Subdomain (sub-region) assignment"
- int nodeId1 = strtol(ptr, &ptr, 10);
- int nodeId2 = strtol(ptr, &ptr, 10);
- int nodeId3 = strtol(ptr, &ptr, 10);
- if ( nbTriangle > 1 ) {
- const SMDS_MeshNode* n1 = theGhs3dIdToNodeMap[ nodeId1 ];
- const SMDS_MeshNode* n2 = theGhs3dIdToNodeMap[ nodeId2 ];
- const SMDS_MeshNode* n3 = theGhs3dIdToNodeMap[ nodeId3 ];
- if (!n1 || !n2 || !n3) {
- tabID[i] = HOLE_ID;
- continue;
- }
- try {
- OCC_CATCH_SIGNALS;
-// tabID[i] = findShapeID( theHelper, n1, n2, n3, toMeshHoles );
- tabID[i] = findShapeID( *theHelper.GetMesh(), n1, n2, n3, toMeshHoles );
- // -- 0020330: Pb with ghs3d as a submesh
- // check that found shape is to be meshed
- if ( tabID[i] > 0 ) {
- const TopoDS_Shape& foundShape = theMeshDS->IndexToShape( tabID[i] );
- bool isToBeMeshed = false;
- for ( int iS = 0; !isToBeMeshed && iS < nbShape; ++iS )
- isToBeMeshed = foundShape.IsSame( tabShape[ iS ]);
- if ( !isToBeMeshed )
- tabID[i] = HOLE_ID;
- }
- // END -- 0020330: Pb with ghs3d as a submesh
-#ifdef _DEBUG_
- std::cout << i+1 << " subdomain: findShapeID() returns " << tabID[i] << std::endl;
-#endif
- }
- catch ( Standard_Failure & ex)
- {
-#ifdef _DEBUG_
- std::cout << i+1 << " subdomain: Exception caugt: " << ex.GetMessageString() << std::endl;
-#endif
- }
- catch (...) {
-#ifdef _DEBUG_
- std::cout << i+1 << " subdomain: unknown exception caught " << std::endl;
-#endif
- }
- }
- }
-
- shapePtr = ptr;
-
- if ( nbTriangle <= nbShape ) // no holes
- toMeshHoles = true; // not avoid creating tetras in holes
-
- // IMP 0022172: [CEA 790] create the groups corresponding to domains
- std::vector< std::vector< const SMDS_MeshElement* > > elemsOfDomain( Max( nbTriangle, nbShape ));
-
- // Associating the tetrahedrons to the shapes
- shapeID = compoundID;
- for (int iElem = 0; iElem < nbElems; iElem++) {
- if(theAlgo->computeCanceled())
- return false;
- for (int iNode = 0; iNode < 4; iNode++) {
- ID = strtol(tetraPtr, &tetraPtr, 10);
- itOnNode = theGhs3dIdToNodeMap.find(ID);
- node[ iNode ] = itOnNode->second;
- nodeID[ iNode ] = ID;
- }
- // We always run GHS3D with "to mesh holes"==TRUE but we must not create
- // tetras within holes depending on hypo option,
- // so we first check if aTet is inside a hole and then create it
- //aTet = theMeshDS->AddVolume( node[1], node[0], node[2], node[3] );
- ghs3dShapeID = 0; // domain ID
- if ( nbTriangle > 1 ) {
- shapeID = HOLE_ID; // negative shapeID means not to create tetras if !toMeshHoles
- ghs3dShapeID = strtol(shapePtr, &shapePtr, 10) - IdShapeRef;
- if ( tabID[ ghs3dShapeID ] == 0 ) {
- TopAbs_State state;
- aSolid = findShape(node, aSolid, tabShape, tabBox, nbShape, &state);
- if ( toMeshHoles || state == TopAbs_IN )
- shapeID = theMeshDS->ShapeToIndex( aSolid );
- tabID[ ghs3dShapeID ] = shapeID;
- }
- else
- shapeID = tabID[ ghs3dShapeID ];
- }
- else if ( nbShape > 1 ) {
- // Case where nbTriangle == 1 while nbShape == 2 encountered
- // with compound of 2 boxes and "To mesh holes"==False,
- // so there are no subdomains specified for each tetrahedron.
- // Try to guess a solid by a node already bound to shape
- shapeID = 0;
- for ( int i=0; i<4 && shapeID==0; i++ ) {
- if ( nodeAssigne[ nodeID[i] ] == 1 &&
- node[i]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_3DSPACE &&
- node[i]->getshapeId() > 1 )
- {
- shapeID = node[i]->getshapeId();
- }
- }
- if ( shapeID==0 ) {
- aSolid = findShape(node, aSolid, tabShape, tabBox, nbShape);
- shapeID = theMeshDS->ShapeToIndex( aSolid );
- }
- }
- // set new nodes and tetrahedron onto the shape
- for ( int i=0; i<4; i++ ) {
- if ( nodeAssigne[ nodeID[i] ] == 0 ) {
- if ( shapeID != HOLE_ID )
- theMeshDS->SetNodeInVolume( node[i], shapeID );
- nodeAssigne[ nodeID[i] ] = shapeID;
- }
- }
- if ( toMeshHoles || shapeID != HOLE_ID ) {
- aTet = theHelper.AddVolume( node[1], node[0], node[2], node[3],
- /*id=*/0, /*force3d=*/false);
- theMeshDS->SetMeshElementOnShape( aTet, shapeID );
- if ( toMakeGroupsOfDomains )
- {
- if ( int( elemsOfDomain.size() ) < ghs3dShapeID+1 )
- elemsOfDomain.resize( ghs3dShapeID+1 );
- elemsOfDomain[ ghs3dShapeID ].push_back( aTet );
- }
- }
-#ifdef _DEBUG_
- shapeIDs.insert( shapeID );
-#endif
- }
- if ( toMakeGroupsOfDomains )
- makeDomainGroups( elemsOfDomain, &theHelper );
-
- // Add enforced elements
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap::const_iterator elemIt;
- const SMDS_MeshElement* anElem;
- SMDS_ElemIteratorPtr itOnEnfElem;
- map<int,int>::const_iterator itOnMap;
- shapeID = compoundID;
- // Enforced edges
- if (theEnforcedEdges.size()) {
- (theEnforcedEdges.size() <= 1) ? tmpStr = " enforced edge" : " enforced edges";
- std::cout << "Add " << theEnforcedEdges.size() << tmpStr << std::endl;
- std::vector< const SMDS_MeshNode* > node( 2 );
- // Iterate over the enforced edges
- for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) {
- anElem = elemIt->first;
- bool addElem = true;
- itOnEnfElem = anElem->nodesIterator();
- for ( int j = 0; j < 2; ++j ) {
- int aNodeID = itOnEnfElem->next()->GetID();
- itOnMap = theNodeId2NodeIndexMap.find(aNodeID);
- if (itOnMap != theNodeId2NodeIndexMap.end()) {
- itOnNode = theGhs3dIdToNodeMap.find((*itOnMap).second);
- if (itOnNode != theGhs3dIdToNodeMap.end()) {
- node.push_back((*itOnNode).second);
-// shapeID =(*itOnNode).second->getshapeId();
- }
- else
- addElem = false;
- }
- else
- addElem = false;
- }
- if (addElem) {
- aTet = theHelper.AddEdge( node[0], node[1], 0, false);
- theMeshDS->SetMeshElementOnShape( aTet, shapeID );
- }
- }
- }
- // Enforced faces
- if (theEnforcedTriangles.size()) {
- (theEnforcedTriangles.size() <= 1) ? tmpStr = " enforced triangle" : " enforced triangles";
- std::cout << "Add " << theEnforcedTriangles.size() << " enforced triangles" << std::endl;
- std::vector< const SMDS_MeshNode* > node( 3 );
- // Iterate over the enforced triangles
- for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) {
- anElem = elemIt->first;
- bool addElem = true;
- itOnEnfElem = anElem->nodesIterator();
- for ( int j = 0; j < 3; ++j ) {
- int aNodeID = itOnEnfElem->next()->GetID();
- itOnMap = theNodeId2NodeIndexMap.find(aNodeID);
- if (itOnMap != theNodeId2NodeIndexMap.end()) {
- itOnNode = theGhs3dIdToNodeMap.find((*itOnMap).second);
- if (itOnNode != theGhs3dIdToNodeMap.end()) {
- node.push_back((*itOnNode).second);
-// shapeID =(*itOnNode).second->getshapeId();
- }
- else
- addElem = false;
- }
- else
- addElem = false;
- }
- if (addElem) {
- aTet = theHelper.AddFace( node[0], node[1], node[2], 0, false);
- theMeshDS->SetMeshElementOnShape( aTet, shapeID );
- }
- }
- }
-
- // Remove nodes of tetras inside holes if !toMeshHoles
- if ( !toMeshHoles ) {
- itOnNode = theGhs3dIdToNodeMap.find( nbInputNodes );
- for ( ; itOnNode != theGhs3dIdToNodeMap.end(); ++itOnNode) {
- ID = itOnNode->first;
- if ( nodeAssigne[ ID ] == HOLE_ID )
- theMeshDS->RemoveFreeNode( itOnNode->second, 0 );
- }
- }
-
-
- if ( nbElems ) {
- (nbElems <= 1) ? tmpStr = " tetrahedra" : " tetrahedrons";
- cout << nbElems << tmpStr << " have been associated to " << nbShape;
- (nbShape <= 1) ? tmpStr = " shape" : " shapes";
- cout << tmpStr << endl;
- }
-#ifdef WIN32
- UnmapViewOfFile(mapPtr);
- CloseHandle(hMapObject);
- CloseHandle(fd);
-#else
- munmap(mapPtr, length);
-#endif
- close(fileOpen);
-
- delete [] tab;
- delete [] tabID;
- delete [] nodeID;
- delete [] coord;
- delete [] node;
- delete [] nodeAssigne;
-
-#ifdef _DEBUG_
- shapeIDs.erase(-1);
- if ( shapeIDs.size() != nbShape ) {
- (shapeIDs.size() <= 1) ? tmpStr = " solid" : " solids";
- std::cout << "Only " << shapeIDs.size() << tmpStr << " of " << nbShape << " found" << std::endl;
- for (int i=0; i<nbShape; i++) {
- shapeID = theMeshDS->ShapeToIndex( tabShape[i] );
- if ( shapeIDs.find( shapeID ) == shapeIDs.end() )
- std::cout << " Solid #" << shapeID << " not found" << std::endl;
- }
- }
-#endif
-
- return true;
-}
-
-
-//=============================================================================
-/*!
- *Here we are going to use the GHS3D mesher with geometry
- */
-//=============================================================================
-
-bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh,
- const TopoDS_Shape& theShape)
-{
- bool Ok(false);
- //SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
-
- // we count the number of shapes
- // _nbShape = countShape( meshDS, TopAbs_SOLID ); -- 0020330: Pb with ghs3d as a submesh
- // _nbShape = 0;
- TopExp_Explorer expBox ( theShape, TopAbs_SOLID );
- // for ( ; expBox.More(); expBox.Next() )
- // _nbShape++;
-
- // create bounding box for every shape inside the compound
-
- // int iShape = 0;
- // TopoDS_Shape* tabShape;
- // double** tabBox;
- // tabShape = new TopoDS_Shape[_nbShape];
- // tabBox = new double*[_nbShape];
- // for (int i=0; i<_nbShape; i++)
- // tabBox[i] = new double[6];
- // Standard_Real Xmin, Ymin, Zmin, Xmax, Ymax, Zmax;
-
- // for (expBox.ReInit(); expBox.More(); expBox.Next()) {
- // tabShape[iShape] = expBox.Current();
- // Bnd_Box BoundingBox;
- // BRepBndLib::Add(expBox.Current(), BoundingBox);
- // BoundingBox.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
- // tabBox[iShape][0] = Xmin; tabBox[iShape][1] = Xmax;
- // tabBox[iShape][2] = Ymin; tabBox[iShape][3] = Ymax;
- // tabBox[iShape][4] = Zmin; tabBox[iShape][5] = Zmax;
- // iShape++;
- // }
-
- // a unique working file name
- // to avoid access to the same files by eg different users
- _genericName = GHS3DPlugin_Hypothesis::GetFileName(_hyp);
- TCollection_AsciiString aGenericName((char*) _genericName.c_str() );
- TCollection_AsciiString aGenericNameRequired = aGenericName + "_required";
-
- TCollection_AsciiString aLogFileName = aGenericName + ".log"; // log
- TCollection_AsciiString aResultFileName;
-
- TCollection_AsciiString aGMFFileName, aRequiredVerticesFileName, aSolFileName, aResSolFileName;
-//#ifdef _DEBUG_
- aGMFFileName = aGenericName + ".mesh"; // GMF mesh file
- aResultFileName = aGenericName + "Vol.mesh"; // GMF mesh file
- aResSolFileName = aGenericName + "Vol.sol"; // GMF mesh file
- aRequiredVerticesFileName = aGenericNameRequired + ".mesh"; // GMF required vertices mesh file
- aSolFileName = aGenericNameRequired + ".sol"; // GMF solution file
-//#else
-// aGMFFileName = aGenericName + ".meshb"; // GMF mesh file
-// aResultFileName = aGenericName + "Vol.meshb"; // GMF mesh file
-// aRequiredVerticesFileName = aGenericNameRequired + ".meshb"; // GMF required vertices mesh file
-// aSolFileName = aGenericNameRequired + ".solb"; // GMF solution file
-//#endif
-
- std::map <int,int> aNodeId2NodeIndexMap, aSmdsToGhs3dIdMap, anEnforcedNodeIdToGhs3dIdMap;
- //std::map <int,const SMDS_MeshNode*> aGhs3dIdToNodeMap;
- std::map <int, int> nodeID2nodeIndexMap;
- std::map<std::vector<double>, std::string> enfVerticesWithGroup;
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues coordsSizeMap = GHS3DPlugin_Hypothesis::GetEnforcedVerticesCoordsSize(_hyp);
- GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap enforcedNodes = GHS3DPlugin_Hypothesis::GetEnforcedNodes(_hyp);
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap enforcedEdges = GHS3DPlugin_Hypothesis::GetEnforcedEdges(_hyp);
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap enforcedTriangles = GHS3DPlugin_Hypothesis::GetEnforcedTriangles(_hyp);
-// TIDSortedElemSet enforcedQuadrangles = GHS3DPlugin_Hypothesis::GetEnforcedQuadrangles(_hyp);
- GHS3DPlugin_Hypothesis::TID2SizeMap nodeIDToSizeMap = GHS3DPlugin_Hypothesis::GetNodeIDToSizeMap(_hyp);
-
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList enfVertices = GHS3DPlugin_Hypothesis::GetEnforcedVertices(_hyp);
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList::const_iterator enfVerIt = enfVertices.begin();
- std::vector<double> coords;
-
- for ( ; enfVerIt != enfVertices.end() ; ++enfVerIt)
- {
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* enfVertex = (*enfVerIt);
-// if (enfVertex->geomEntry.empty() && enfVertex->coords.size()) {
- if (enfVertex->coords.size()) {
- coordsSizeMap.insert(make_pair(enfVertex->coords,enfVertex->size));
- enfVerticesWithGroup.insert(make_pair(enfVertex->coords,enfVertex->groupName));
-// MESSAGE("enfVerticesWithGroup.insert(make_pair(("<<enfVertex->coords[0]<<","<<enfVertex->coords[1]<<","<<enfVertex->coords[2]<<"),\""<<enfVertex->groupName<<"\"))");
- }
- else {
-// if (!enfVertex->geomEntry.empty()) {
- TopoDS_Shape GeomShape = entryToShape(enfVertex->geomEntry);
-// GeomType = GeomShape.ShapeType();
-
-// if (!enfVertex->isCompound) {
-// // if (GeomType == TopAbs_VERTEX) {
-// coords.clear();
-// aPnt = BRep_Tool::Pnt(TopoDS::Vertex(GeomShape));
-// coords.push_back(aPnt.X());
-// coords.push_back(aPnt.Y());
-// coords.push_back(aPnt.Z());
-// if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
-// coordsSizeMap.insert(make_pair(coords,enfVertex->size));
-// enfVerticesWithGroup.insert(make_pair(coords,enfVertex->groupName));
-// }
-// }
-//
-// // Group Management
-// else {
-// if (GeomType == TopAbs_COMPOUND){
- for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
- coords.clear();
- if (it.Value().ShapeType() == TopAbs_VERTEX){
- gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value()));
- coords.push_back(aPnt.X());
- coords.push_back(aPnt.Y());
- coords.push_back(aPnt.Z());
- if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
- coordsSizeMap.insert(make_pair(coords,enfVertex->size));
- enfVerticesWithGroup.insert(make_pair(coords,enfVertex->groupName));
-// MESSAGE("enfVerticesWithGroup.insert(make_pair(("<<coords[0]<<","<<coords[1]<<","<<coords[2]<<"),\""<<enfVertex->groupName<<"\"))");
- }
- }
- }
-// }
- }
- }
- int nbEnforcedVertices = coordsSizeMap.size();
- int nbEnforcedNodes = enforcedNodes.size();
-
- std::string tmpStr;
- (nbEnforcedNodes <= 1) ? tmpStr = "node" : "nodes";
- std::cout << nbEnforcedNodes << " enforced " << tmpStr << " from hypo" << std::endl;
- (nbEnforcedVertices <= 1) ? tmpStr = "vertex" : "vertices";
- std::cout << nbEnforcedVertices << " enforced " << tmpStr << " from hypo" << std::endl;
-
- SMESH_MesherHelper helper( theMesh );
- helper.SetSubShape( theShape );
-
- std::vector <const SMDS_MeshNode*> aNodeByGhs3dId, anEnforcedNodeByGhs3dId;
- std::vector <const SMDS_MeshElement*> aFaceByGhs3dId;
- std::map<const SMDS_MeshNode*,int> aNodeToGhs3dIdMap;
- std::vector<std::string> aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId;
- {
- SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( theMesh ));
-
- // make prisms on quadrangles
- if ( theMesh.NbQuadrangles() > 0 )
- {
- vector<SMESH_ProxyMesh::Ptr> components;
- for (expBox.ReInit(); expBox.More(); expBox.Next())
- {
- if ( _viscousLayersHyp )
- {
- proxyMesh = _viscousLayersHyp->Compute( theMesh, expBox.Current() );
- if ( !proxyMesh )
- return false;
- }
- StdMeshers_QuadToTriaAdaptor* q2t = new StdMeshers_QuadToTriaAdaptor;
- q2t->Compute( theMesh, expBox.Current(), proxyMesh.get() );
- components.push_back( SMESH_ProxyMesh::Ptr( q2t ));
- }
- proxyMesh.reset( new SMESH_ProxyMesh( components ));
- }
- // build viscous layers
- else if ( _viscousLayersHyp )
- {
- proxyMesh = _viscousLayersHyp->Compute( theMesh, theShape );
- if ( !proxyMesh )
- return false;
- }
-
- // Ok = (writePoints( aPointsFile, helper,
- // aSmdsToGhs3dIdMap, anEnforcedNodeIdToGhs3dIdMap, aGhs3dIdToNodeMap,
- // nodeIDToSizeMap,
- // coordsSizeMap, enforcedNodes, enforcedEdges, enforcedTriangles)
- // &&
- // writeFaces ( aFacesFile, *proxyMesh, theShape,
- // aSmdsToGhs3dIdMap, anEnforcedNodeIdToGhs3dIdMap,
- // enforcedEdges, enforcedTriangles ));
- Ok = writeGMFFile(aGMFFileName.ToCString(), aRequiredVerticesFileName.ToCString(), aSolFileName.ToCString(),
- *proxyMesh, helper,
- aNodeByGhs3dId, aFaceByGhs3dId, aNodeToGhs3dIdMap,
- aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId,
- enforcedNodes, enforcedEdges, enforcedTriangles, /*enforcedQuadrangles,*/
- enfVerticesWithGroup, coordsSizeMap);
- }
-
- // Write aSmdsToGhs3dIdMap to temp file
- TCollection_AsciiString aSmdsToGhs3dIdMapFileName;
- aSmdsToGhs3dIdMapFileName = aGenericName + ".ids"; // ids relation
- ofstream aIdsFile ( aSmdsToGhs3dIdMapFileName.ToCString() , ios::out);
- Ok = aIdsFile.rdbuf()->is_open();
- if (!Ok) {
- INFOS( "Can't write into " << aSmdsToGhs3dIdMapFileName);
- return error(SMESH_Comment("Can't write into ") << aSmdsToGhs3dIdMapFileName);
- }
- INFOS( "Writing ids relation into " << aSmdsToGhs3dIdMapFileName);
- aIdsFile << "Smds Ghs3d" << std::endl;
- map <int,int>::const_iterator myit;
- for (myit=aSmdsToGhs3dIdMap.begin() ; myit != aSmdsToGhs3dIdMap.end() ; ++myit) {
- aIdsFile << myit->first << " " << myit->second << std::endl;
- }
-
- aIdsFile.close();
-
- if ( ! Ok ) {
- if ( !_keepFiles ) {
- removeFile( aGMFFileName );
- removeFile( aRequiredVerticesFileName );
- removeFile( aSolFileName );
- removeFile( aSmdsToGhs3dIdMapFileName );
- }
- return error(COMPERR_BAD_INPUT_MESH);
- }
- removeFile( aResultFileName ); // needed for boundary recovery module usage
-
- // -----------------
- // run ghs3d mesher
- // -----------------
-
- TCollection_AsciiString cmd( (char*)GHS3DPlugin_Hypothesis::CommandToRun( _hyp ).c_str() );
-
- cmd += TCollection_AsciiString(" --in ") + aGMFFileName;
- if ( nbEnforcedVertices + nbEnforcedNodes)
- cmd += TCollection_AsciiString(" --required_vertices ") + aGenericNameRequired;
- cmd += TCollection_AsciiString(" --out ") + aResultFileName;
- if ( !_logInStandardOutput )
- cmd += TCollection_AsciiString(" 1>" ) + aLogFileName; // dump into file
-
- std::cout << std::endl;
- std::cout << "Ghs3d execution..." << std::endl;
- std::cout << cmd << std::endl;
-
- _compute_canceled = false;
-
- system( cmd.ToCString() ); // run
-
- std::cout << std::endl;
- std::cout << "End of Ghs3d execution !" << std::endl;
-
- // --------------
- // read a result
- // --------------
-
- // Mapping the result file
-
- // int fileOpen;
- // fileOpen = open( aResultFileName.ToCString(), O_RDONLY);
- // if ( fileOpen < 0 ) {
- // std::cout << std::endl;
- // std::cout << "Can't open the " << aResultFileName.ToCString() << " GHS3D output file" << std::endl;
- // std::cout << "Log: " << aLogFileName << std::endl;
- // Ok = false;
- // }
- // else {
- GHS3DPlugin_Hypothesis::TSetStrings groupsToRemove = GHS3DPlugin_Hypothesis::GetGroupsToRemove(_hyp);
- bool toMeshHoles =
- _hyp ? _hyp->GetToMeshHoles(true) : GHS3DPlugin_Hypothesis::DefaultMeshHoles();
- const bool toMakeGroupsOfDomains = GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains( _hyp );
-
- helper.IsQuadraticSubMesh( theShape );
- helper.SetElementsOnShape( false );
-
-// Ok = readResultFile( fileOpen,
-// #ifdef WIN32
-// aResultFileName.ToCString(),
-// #endif
-// this,
-// /*theMesh, */helper, tabShape, tabBox, _nbShape,
-// aGhs3dIdToNodeMap, aNodeId2NodeIndexMap,
-// toMeshHoles,
-// nbEnforcedVertices, nbEnforcedNodes,
-// enforcedEdges, enforcedTriangles,
-// toMakeGroupsOfDomains );
-
- Ok = readGMFFile(aResultFileName.ToCString(),
- this,
- &helper, aNodeByGhs3dId, aFaceByGhs3dId, aNodeToGhs3dIdMap,
- aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId,
- groupsToRemove, toMakeGroupsOfDomains, toMeshHoles);
-
- removeEmptyGroupsOfDomains( helper.GetMesh(), /*notEmptyAsWell =*/ !toMakeGroupsOfDomains );
- //}
-
-
-
-
- // ---------------------
- // remove working files
- // ---------------------
-
- if ( Ok )
- {
- if ( _removeLogOnSuccess )
- removeFile( aLogFileName );
-
- // if ( _hyp && _hyp->GetToMakeGroupsOfDomains() )
- // error( COMPERR_WARNING, "'toMakeGroupsOfDomains' is ignored since the mesh is on shape" );
- }
- else if ( OSD_File( aLogFileName ).Size() > 0 )
- {
- // get problem description from the log file
- _Ghs2smdsConvertor conv( aNodeByGhs3dId );
- storeErrorDescription( aLogFileName, conv );
- }
- else
- {
- // the log file is empty
- removeFile( aLogFileName );
- INFOS( "GHS3D Error, command '" << cmd.ToCString() << "' failed" );
- error(COMPERR_ALGO_FAILED, "ghs3d: command not found" );
- }
-
- if ( !_keepFiles ) {
- if (! Ok && _compute_canceled)
- removeFile( aLogFileName );
- removeFile( aGMFFileName );
- removeFile( aRequiredVerticesFileName );
- removeFile( aSolFileName );
- removeFile( aResSolFileName );
- removeFile( aResultFileName );
- removeFile( aSmdsToGhs3dIdMapFileName );
- }
- std::cout << "<" << aResultFileName.ToCString() << "> GHS3D output file ";
- if ( !Ok )
- std::cout << "not ";
- std::cout << "treated !" << std::endl;
- std::cout << std::endl;
-
- // _nbShape = 0; // re-initializing _nbShape for the next Compute() method call
- // delete [] tabShape;
- // delete [] tabBox;
-
- return Ok;
-}
-
-//=============================================================================
-/*!
- *Here we are going to use the GHS3D mesher w/o geometry
- */
-//=============================================================================
-bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh,
- SMESH_MesherHelper* theHelper)
-{
- MESSAGE("GHS3DPlugin_GHS3D::Compute()");
-
- theHelper->IsQuadraticSubMesh( theHelper->GetSubShape() );
-
- // a unique working file name
- // to avoid access to the same files by eg different users
- _genericName = GHS3DPlugin_Hypothesis::GetFileName(_hyp);
- TCollection_AsciiString aGenericName((char*) _genericName.c_str() );
- TCollection_AsciiString aGenericNameRequired = aGenericName + "_required";
-
- TCollection_AsciiString aLogFileName = aGenericName + ".log"; // log
- TCollection_AsciiString aResultFileName;
- bool Ok;
-
- TCollection_AsciiString aGMFFileName, aRequiredVerticesFileName, aSolFileName, aResSolFileName;
-//#ifdef _DEBUG_
- aGMFFileName = aGenericName + ".mesh"; // GMF mesh file
- aResultFileName = aGenericName + "Vol.mesh"; // GMF mesh file
- aResSolFileName = aGenericName + "Vol.sol"; // GMF mesh file
- aRequiredVerticesFileName = aGenericNameRequired + ".mesh"; // GMF required vertices mesh file
- aSolFileName = aGenericNameRequired + ".sol"; // GMF solution file
-//#else
-// aGMFFileName = aGenericName + ".meshb"; // GMF mesh file
-// aResultFileName = aGenericName + "Vol.meshb"; // GMF mesh file
-// aRequiredVerticesFileName = aGenericNameRequired + ".meshb"; // GMF required vertices mesh file
-// aSolFileName = aGenericNameRequired + ".solb"; // GMF solution file
-//#endif
-
- std::map <int, int> nodeID2nodeIndexMap;
- std::map<std::vector<double>, std::string> enfVerticesWithGroup;
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues coordsSizeMap;
- TopoDS_Shape GeomShape;
-// TopAbs_ShapeEnum GeomType;
- std::vector<double> coords;
- gp_Pnt aPnt;
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* enfVertex;
-
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList enfVertices = GHS3DPlugin_Hypothesis::GetEnforcedVertices(_hyp);
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList::const_iterator enfVerIt = enfVertices.begin();
-
- for ( ; enfVerIt != enfVertices.end() ; ++enfVerIt)
- {
- enfVertex = (*enfVerIt);
-// if (enfVertex->geomEntry.empty() && enfVertex->coords.size()) {
- if (enfVertex->coords.size()) {
- coordsSizeMap.insert(make_pair(enfVertex->coords,enfVertex->size));
- enfVerticesWithGroup.insert(make_pair(enfVertex->coords,enfVertex->groupName));
-// MESSAGE("enfVerticesWithGroup.insert(make_pair(("<<enfVertex->coords[0]<<","<<enfVertex->coords[1]<<","<<enfVertex->coords[2]<<"),\""<<enfVertex->groupName<<"\"))");
- }
- else {
-// if (!enfVertex->geomEntry.empty()) {
- GeomShape = entryToShape(enfVertex->geomEntry);
-// GeomType = GeomShape.ShapeType();
-
-// if (!enfVertex->isCompound) {
-// // if (GeomType == TopAbs_VERTEX) {
-// coords.clear();
-// aPnt = BRep_Tool::Pnt(TopoDS::Vertex(GeomShape));
-// coords.push_back(aPnt.X());
-// coords.push_back(aPnt.Y());
-// coords.push_back(aPnt.Z());
-// if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
-// coordsSizeMap.insert(make_pair(coords,enfVertex->size));
-// enfVerticesWithGroup.insert(make_pair(coords,enfVertex->groupName));
-// }
-// }
-//
-// // Group Management
-// else {
-// if (GeomType == TopAbs_COMPOUND){
- for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
- coords.clear();
- if (it.Value().ShapeType() == TopAbs_VERTEX){
- aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value()));
- coords.push_back(aPnt.X());
- coords.push_back(aPnt.Y());
- coords.push_back(aPnt.Z());
- if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
- coordsSizeMap.insert(make_pair(coords,enfVertex->size));
- enfVerticesWithGroup.insert(make_pair(coords,enfVertex->groupName));
-// MESSAGE("enfVerticesWithGroup.insert(make_pair(("<<coords[0]<<","<<coords[1]<<","<<coords[2]<<"),\""<<enfVertex->groupName<<"\"))");
- }
- }
- }
-// }
- }
- }
-
-// const SMDS_MeshNode* enfNode;
- GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap enforcedNodes = GHS3DPlugin_Hypothesis::GetEnforcedNodes(_hyp);
-// GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap::const_iterator enfNodeIt = enforcedNodes.begin();
-// for ( ; enfNodeIt != enforcedNodes.end() ; ++enfNodeIt)
-// {
-// enfNode = enfNodeIt->first;
-// coords.clear();
-// coords.push_back(enfNode->X());
-// coords.push_back(enfNode->Y());
-// coords.push_back(enfNode->Z());
-// if (enfVerticesWithGro
-// enfVerticesWithGroup.insert(make_pair(coords,enfNodeIt->second));
-// }
-
-
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap enforcedEdges = GHS3DPlugin_Hypothesis::GetEnforcedEdges(_hyp);
- GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap enforcedTriangles = GHS3DPlugin_Hypothesis::GetEnforcedTriangles(_hyp);
-// TIDSortedElemSet enforcedQuadrangles = GHS3DPlugin_Hypothesis::GetEnforcedQuadrangles(_hyp);
- GHS3DPlugin_Hypothesis::TID2SizeMap nodeIDToSizeMap = GHS3DPlugin_Hypothesis::GetNodeIDToSizeMap(_hyp);
-
- std::string tmpStr;
-
- int nbEnforcedVertices = coordsSizeMap.size();
- int nbEnforcedNodes = enforcedNodes.size();
- (nbEnforcedNodes <= 1) ? tmpStr = "node" : tmpStr = "nodes";
- std::cout << nbEnforcedNodes << " enforced " << tmpStr << " from hypo" << std::endl;
- (nbEnforcedVertices <= 1) ? tmpStr = "vertex" : tmpStr = "vertices";
- std::cout << nbEnforcedVertices << " enforced " << tmpStr << " from hypo" << std::endl;
-
- std::vector <const SMDS_MeshNode*> aNodeByGhs3dId, anEnforcedNodeByGhs3dId;
- std::vector <const SMDS_MeshElement*> aFaceByGhs3dId;
- std::map<const SMDS_MeshNode*,int> aNodeToGhs3dIdMap;
- std::vector<std::string> aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId;
- {
- SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( theMesh ));
- if ( theMesh.NbQuadrangles() > 0 )
- {
- StdMeshers_QuadToTriaAdaptor* aQuad2Trias = new StdMeshers_QuadToTriaAdaptor;
- aQuad2Trias->Compute( theMesh );
- proxyMesh.reset( aQuad2Trias );
- }
-
- Ok = writeGMFFile(aGMFFileName.ToCString(), aRequiredVerticesFileName.ToCString(), aSolFileName.ToCString(),
- *proxyMesh, *theHelper,
- aNodeByGhs3dId, aFaceByGhs3dId, aNodeToGhs3dIdMap,
- aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId,
- enforcedNodes, enforcedEdges, enforcedTriangles,
- enfVerticesWithGroup, coordsSizeMap);
- }
-
- // -----------------
- // run ghs3d mesher
- // -----------------
-
- TCollection_AsciiString cmd = TCollection_AsciiString((char*)GHS3DPlugin_Hypothesis::CommandToRun( _hyp, false ).c_str());
-
- cmd += TCollection_AsciiString(" --in ") + aGMFFileName;
- if ( nbEnforcedVertices + nbEnforcedNodes)
- cmd += TCollection_AsciiString(" --required_vertices ") + aGenericNameRequired;
- cmd += TCollection_AsciiString(" --out ") + aResultFileName;
- if ( !_logInStandardOutput )
- cmd += TCollection_AsciiString(" 1>" ) + aLogFileName; // dump into file
-
- std::cout << std::endl;
- std::cout << "Ghs3d execution..." << std::endl;
- std::cout << cmd << std::endl;
-
- _compute_canceled = false;
-
- system( cmd.ToCString() ); // run
-
- std::cout << std::endl;
- std::cout << "End of Ghs3d execution !" << std::endl;
-
- // --------------
- // read a result
- // --------------
- GHS3DPlugin_Hypothesis::TSetStrings groupsToRemove = GHS3DPlugin_Hypothesis::GetGroupsToRemove(_hyp);
- const bool toMakeGroupsOfDomains = GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains( _hyp );
-
- Ok = readGMFFile(aResultFileName.ToCString(),
- this,
- theHelper, aNodeByGhs3dId, aFaceByGhs3dId, aNodeToGhs3dIdMap,
- aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId,
- groupsToRemove, toMakeGroupsOfDomains);
-
- updateMeshGroups(theHelper->GetMesh(), groupsToRemove);
- removeEmptyGroupsOfDomains( theHelper->GetMesh(), /*notEmptyAsWell =*/ !toMakeGroupsOfDomains );
-
- if ( Ok ) {
- GHS3DPlugin_Hypothesis* that = (GHS3DPlugin_Hypothesis*)this->_hyp;
- if (that)
- that->ClearGroupsToRemove();
- }
- // ---------------------
- // remove working files
- // ---------------------
-
- if ( Ok )
- {
- if ( _removeLogOnSuccess )
- removeFile( aLogFileName );
-
- //if ( !toMakeGroupsOfDomains && _hyp && _hyp->GetToMakeGroupsOfDomains() )
- //error( COMPERR_WARNING, "'toMakeGroupsOfDomains' is ignored since 'toMeshHoles' is OFF." );
- }
- else if ( OSD_File( aLogFileName ).Size() > 0 )
- {
- // get problem description from the log file
- _Ghs2smdsConvertor conv( aNodeByGhs3dId );
- storeErrorDescription( aLogFileName, conv );
- }
- else {
- // the log file is empty
- removeFile( aLogFileName );
- INFOS( "GHS3D Error, command '" << cmd.ToCString() << "' failed" );
- error(COMPERR_ALGO_FAILED, "ghs3d: command not found" );
- }
-
- if ( !_keepFiles )
- {
- if (! Ok && _compute_canceled)
- removeFile( aLogFileName );
- removeFile( aGMFFileName );
- removeFile( aResultFileName );
- removeFile( aRequiredVerticesFileName );
- removeFile( aSolFileName );
- removeFile( aResSolFileName );
- }
- return Ok;
-}
-
-void GHS3DPlugin_GHS3D::CancelCompute()
-{
- _compute_canceled = true;
-#ifdef WIN32
-#else
- std::string cmd = "ps xo pid,args | grep " + _genericName;
- //cmd += " | grep -e \"^ *[0-9]\\+ \\+" + GHS3DPlugin_Hypothesis::GetExeName() + "\"";
- cmd += " | awk '{print $1}' | xargs kill -9 > /dev/null 2>&1";
- system( cmd.c_str() );
-#endif
-}
-
-//================================================================================
-/*!
- * \brief Provide human readable text by error code reported by ghs3d
- */
-//================================================================================
-
-static const char* translateError(const int errNum)
-{
- switch ( errNum ) {
- case 0:
- return "The surface mesh includes a face of type other than edge, "
- "triangle or quadrilateral. This face type is not supported.";
- case 1:
- return "Not enough memory for the face table.";
- case 2:
- return "Not enough memory.";
- case 3:
- return "Not enough memory.";
- case 4:
- return "Face is ignored.";
- case 5:
- return "End of file. Some data are missing in the file.";
- case 6:
- return "Read error on the file. There are wrong data in the file.";
- case 7:
- return "the metric file is inadequate (dimension other than 3).";
- case 8:
- return "the metric file is inadequate (values not per vertices).";
- case 9:
- return "the metric file contains more than one field.";
- case 10:
- return "the number of values in the \".bb\" (metric file) is incompatible with the expected"
- "value of number of mesh vertices in the \".noboite\" file.";
- case 12:
- return "Too many sub-domains.";
- case 13:
- return "the number of vertices is negative or null.";
- case 14:
- return "the number of faces is negative or null.";
- case 15:
- return "A face has a null vertex.";
- case 22:
- return "incompatible data.";
- case 131:
- return "the number of vertices is negative or null.";
- case 132:
- return "the number of vertices is negative or null (in the \".mesh\" file).";
- case 133:
- return "the number of faces is negative or null.";
- case 1000:
- return "A face appears more than once in the input surface mesh.";
- case 1001:
- return "An edge appears more than once in the input surface mesh.";
- case 1002:
- return "A face has a vertex negative or null.";
- case 1003:
- return "NOT ENOUGH MEMORY.";
- case 2000:
- return "Not enough available memory.";
- case 2002:
- return "Some initial points cannot be inserted. The surface mesh is probably very bad "
- "in terms of quality or the input list of points is wrong.";
- case 2003:
- return "Some vertices are too close to one another or coincident.";
- case 2004:
- return "Some vertices are too close to one another or coincident.";
- case 2012:
- return "A vertex cannot be inserted.";
- case 2014:
- return "There are at least two points considered as coincident.";
- case 2103:
- return "Some vertices are too close to one another or coincident.";
- case 3000:
- return "The surface mesh regeneration step has failed.";
- case 3009:
- return "Constrained edge cannot be enforced.";
- case 3019:
- return "Constrained face cannot be enforced.";
- case 3029:
- return "Missing faces.";
- case 3100:
- return "No guess to start the definition of the connected component(s).";
- case 3101:
- return "The surface mesh includes at least one hole. The domain is not well defined.";
- case 3102:
- return "Impossible to define a component.";
- case 3103:
- return "The surface edge intersects another surface edge.";
- case 3104:
- return "The surface edge intersects the surface face.";
- case 3105:
- return "One boundary point lies within a surface face.";
- case 3106:
- return "One surface edge intersects a surface face.";
- case 3107:
- return "One boundary point lies within a surface edge.";
- case 3108:
- return "Insufficient memory ressources detected due to a bad quality surface mesh leading "
- "to too many swaps.";
- case 3109:
- return "Edge is unique (i.e., bounds a hole in the surface).";
- case 3122:
- return "Presumably, the surface mesh is not compatible with the domain being processed.";
- case 3123:
- return "Too many components, too many sub-domain.";
- case 3209:
- return "The surface mesh includes at least one hole. "
- "Therefore there is no domain properly defined.";
- case 3300:
- return "Statistics.";
- case 3400:
- return "Statistics.";
- case 3500:
- return "Warning, it is dramatically tedious to enforce the boundary items.";
- case 4000:
- return "Not enough memory at this time, nevertheless, the program continues. "
- "The expected mesh will be correct but not really as large as required.";
- case 4002:
- return "see above error code, resulting quality may be poor.";
- case 4003:
- return "Not enough memory at this time, nevertheless, the program continues (warning).";
- case 8000:
- return "Unknown face type.";
- case 8005:
- case 8006:
- return "End of file. Some data are missing in the file.";
- case 9000:
- return "A too small volume element is detected.";
- case 9001:
- return "There exists at least a null or negative volume element.";
- case 9002:
- return "There exist null or negative volume elements.";
- case 9003:
- return "A too small volume element is detected. A face is considered being degenerated.";
- case 9100:
- return "Some element is suspected to be very bad shaped or wrong.";
- case 9102:
- return "A too bad quality face is detected. This face is considered degenerated.";
- case 9112:
- return "A too bad quality face is detected. This face is degenerated.";
- case 9122:
- return "Presumably, the surface mesh is not compatible with the domain being processed.";
- case 9999:
- return "Abnormal error occured, contact hotline.";
- case 23600:
- return "Not enough memory for the face table.";
- case 23601:
- return "The algorithm cannot run further. "
- "The surface mesh is probably very bad in terms of quality.";
- case 23602:
- return "Bad vertex number.";
- case 1001200:
- return "Cannot close mesh file NomFil.";
- case 1002010:
- return "There are wrong data.";
- case 1002120:
- return "The number of faces is negative or null.";
- case 1002170:
- return "The number of vertices is negative or null in the '.sol' file.";
- case 1002190:
- return "The number of tetrahedra is negative or null.";
- case 1002210:
- return "The number of vertices is negative or null.";
- case 1002211:
- return "A face has a vertex negative or null.";
- case 1002270:
- return "The field is not a size in file NomFil.";
- case 1002280:
- return "A count is wrong in the enclosing box in the .boite.mesh input "
- "file (option '--read_boite').";
- case 1002290:
- return "A tetrahedron has a vertex with a negative number.";
- case 1002300:
- return "the 'MeshVersionFormatted' is not 1 or 2 in the '.mesh' file or the '.sol'.";
- case 1002370:
- return "The number of values in the '.sol' (metric file) is incompatible with "
- "the expected value of number of mesh vertices in the '.mesh' file.";
- case 1003000:
- return "Not enough memory.";
- case 1003020:
- return "Not enough memory for the face table.";
- case 1003050:
- return "Insufficient memory ressources detected due to a bad quality "
- "surface mesh leading to too many swaps.";
- case 1005010:
- return "The surface coordinates of a vertex are differing from the "
- "volume coordinates, probably due to a precision problem.";
- case 1005050:
- return "Invalid dimension. Dimension 3 expected.";
- case 1005100:
- return "A point has a tag 0. This point is probably outside the domain which has been meshed.";
- case 1005103:
- return "The vertices of an element are too close to one another or coincident.";
- case 1005104:
- return "There are at least two points whose distance is very small, and considered as coincident.";
- case 1005105:
- return "Two vertices are too close to one another or coincident.";
- case 1005106:
- return "A vertex cannot be inserted.";
- case 1005107:
- return "Two vertices are too close to one another or coincident. Note : When "
- "this error occurs during the overconstrained processing phase, this is only "
- "a warning which means that it is difficult to break some overconstrained facets.";
- case 1005110:
- return "Two surface edges are intersecting.";
- case 1005120:
- return "A surface edge intersects a surface face.";
- case 1005150:
- return "A boundary point lies within a surface face.";
- case 1005160:
- return "A boundary point lies within a surface edge.";
- case 1005200:
- return "A surface mesh appears more than once in the input surface mesh.";
- case 1005210:
- return "An edge appears more than once in the input surface mesh.";
- case 1005225:
- return "Surface with unvalid triangles.";
- case 1005270:
- return "The metric in the '.sol' file contains more than one field.";
- case 1005300:
- return "The surface mesh includes at least one hole. The domain is not well defined.";
- case 1005301:
- return "Presumably, the surface mesh is not compatible with the domain being processed (warning).";
- case 1005302:
- return "Probable faces overlapping somewher.";
- case 1005320:
- return "The quadratic version does not work with prescribed free edges.";
- case 1005321:
- return "The quadratic version does not work with a volume mesh.";
- case 1005370:
- return "The metric in the '.sol' file is inadequate (values not per vertices).";
- case 1005371:
- return "The number of vertices in the '.sol' is different from the one in the "
- "'.mesh' file for the required vertices (option '--required_vertices').";
- case 1005372:
- return "More than one type in file NomFil. The type must be equal to 1 in the '.sol'"
- "for the required vertices (option '--required_vertices').";
- case 1005515:
- return "Bad vertex number.";
- case 1005560:
- return "No guess to start the definition of the connected component(s).";
- case 1005602:
- return "Some initial points cannot be inserted.";
- case 1005620:
- return "A too bad quality face is detected. This face is considered degenerated.";
- case 1005621:
- return "A too bad quality face is detected. This face is degenerated.";
- case 1005622:
- return "The algorithm cannot run further.";
- case 1005690:
- return "A too small volume element is detected.";
- case 1005691:
- return "A tetrahedra is suspected to be very bad shaped or wrong.";
- case 1005692:
- return "There is at least a null or negative volume element. The resulting mesh"
- "may be inappropriate.";
- case 1005693:
- return "There are some null or negative volume element. The resulting mesh may"
- "be inappropriate.";
- case 1005820:
- return "An edge is unique (i.e., bounds a hole in the surface).";
- case 1007000:
- return "Abnormal or internal error.";
- case 1007010:
- return "Too many components with respect to too many sub-domain.";
- case 1007400:
- return "An internal error has been encountered or a signal has been received. "
- "Current mesh will not be saved.";
- case 1008491:
- return "Impossible to define a component.";
- case 1008410:
- return "There are some overconstrained edges.";
- case 1008420:
- return "There are some overconstrained facets.";
- case 1008422:
- return "Give the number of missing faces (information given when regeneration phase failed).";
- case 1008423:
- return "A constrained face cannot be enforced (information given when regeneration phase failed).";
- case 1008441:
- return "A constrained edge cannot be enforced.";
- case 1008460:
- return "It is dramatically tedious to enforce the boundary items.";
- case 1008480:
- return "The surface mesh regeneration step has failed. A .boite.mesh and .boite.map files are created.";
- case 1008490:
- return "Invalid resulting mesh.";
- case 1008495:
- return "P2 correction not successful.";
- case 1009000:
- return "Program has received an interruption or a termination signal sent by the "
- "user or the system administrator. Current mesh will not be saved.";
- }
- return "";
-}
-
-//================================================================================
-/*!
- * \brief Retrieve from a string given number of integers
- */
-//================================================================================
-
-static char* getIds( char* ptr, int nbIds, vector<int>& ids )
-{
- ids.clear();
- ids.reserve( nbIds );
- while ( nbIds )
- {
- while ( !isdigit( *ptr )) ++ptr;
- if ( ptr[-1] == '-' ) --ptr;
- ids.push_back( strtol( ptr, &ptr, 10 ));
- --nbIds;
- }
- return ptr;
-}
-
-//================================================================================
-/*!
- * \brief Retrieve problem description form a log file
- * \retval bool - always false
- */
-//================================================================================
-
-bool GHS3DPlugin_GHS3D::storeErrorDescription(const TCollection_AsciiString& logFile,
- const _Ghs2smdsConvertor & toSmdsConvertor )
-{
- if(_compute_canceled)
- return error(SMESH_Comment("interruption initiated by user"));
- // open file
-#ifdef WIN32
- int file = ::_open (logFile.ToCString(), _O_RDONLY|_O_BINARY);
-#else
- int file = ::open (logFile.ToCString(), O_RDONLY);
-#endif
- if ( file < 0 )
- return error( SMESH_Comment("See ") << logFile << " for problem description");
-
- // get file size
- off_t length = lseek( file, 0, SEEK_END);
- lseek( file, 0, SEEK_SET);
-
- // read file
- vector< char > buf( length );
- int nBytesRead = ::read (file, & buf[0], length);
- ::close (file);
- char* ptr = & buf[0];
- char* bufEnd = ptr + nBytesRead;
-
- SMESH_Comment errDescription;
-
- enum { NODE = 1, EDGE, TRIA, VOL, SKIP_ID = 1 };
-
- // look for MeshGems version
- // Since "MG-TETRA -- MeshGems 1.1-3 (January, 2013)" error codes change.
- // To discriminate old codes from new ones we add 1000000 to the new codes.
- // This way value of the new codes is same as absolute value of codes printed
- // in the log after "MGMESSAGE" string.
- int versionAddition = 0;
- {
- char* verPtr = ptr;
- while ( ++verPtr < bufEnd )
- {
- if ( strncmp( verPtr, "MG-TETRA -- MeshGems ", 21 ) != 0 )
- continue;
- if ( strcmp( verPtr, "MG-TETRA -- MeshGems 1.1-3 " ) >= 0 )
- versionAddition = 1000000;
- ptr = verPtr;
- break;
- }
- }
-
- // look for errors "ERR #"
-
- set<string> foundErrorStr; // to avoid reporting same error several times
- set<int> elemErrorNums; // not to report different types of errors with bad elements
- while ( ++ptr < bufEnd )
- {
- if ( strncmp( ptr, "ERR ", 4 ) != 0 )
- continue;
-
- list<const SMDS_MeshElement*> badElems;
- vector<int> nodeIds;
-
- ptr += 4;
- char* errBeg = ptr;
- int errNum = strtol(ptr, &ptr, 10) + versionAddition;
- // we treat errors enumerated in [SALOME platform 0019316] issue
- // and all errors from a new (Release 1.1) MeshGems User Manual
- switch ( errNum ) {
- case 0015: // The face number (numfac) with vertices (f 1, f 2, f 3) has a null vertex.
- case 1005620 : // a too bad quality face is detected. This face is considered degenerated.
- ptr = getIds(ptr, SKIP_ID, nodeIds);
- ptr = getIds(ptr, TRIA, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- break;
- case 1005621 : // a too bad quality face is detected. This face is degenerated.
- // hence the is degenerated it is invisible, add its edges in addition
- ptr = getIds(ptr, SKIP_ID, nodeIds);
- ptr = getIds(ptr, TRIA, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- {
- vector<int> edgeNodes( nodeIds.begin(), --nodeIds.end() ); // 01
- badElems.push_back( toSmdsConvertor.getElement(edgeNodes));
- edgeNodes[1] = nodeIds[2]; // 02
- badElems.push_back( toSmdsConvertor.getElement(edgeNodes));
- edgeNodes[0] = nodeIds[1]; // 12
- }
- break;
- case 1000: // Face (f 1, f 2, f 3) appears more than once in the input surface mesh.
- // ERR 1000 : 1 3 2
- case 1002: // Face (f 1, f 2, f 3) has a vertex negative or null
- case 3019: // Constrained face (f 1, f 2, f 3) cannot be enforced
- case 1002211: // a face has a vertex negative or null.
- case 1005200 : // a surface mesh appears more than once in the input surface mesh.
- case 1008423 : // a constrained face cannot be enforced (regeneration phase failed).
- ptr = getIds(ptr, TRIA, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- break;
- case 1001: // Edge (e1, e2) appears more than once in the input surface mesh
- case 3009: // Constrained edge (e1, e2) cannot be enforced (warning).
- // ERR 3109 : EDGE 5 6 UNIQUE
- case 3109: // Edge (e1, e2) is unique (i.e., bounds a hole in the surface)
- case 1005210 : // an edge appears more than once in the input surface mesh.
- case 1005820 : // an edge is unique (i.e., bounds a hole in the surface).
- case 1008441 : // a constrained edge cannot be enforced.
- ptr = getIds(ptr, EDGE, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- break;
- case 2004: // Vertex v1 and vertex v2 are too close to one another or coincident (warning).
- case 2014: // at least two points whose distance is dist, i.e., considered as coincident
- case 2103: // Vertex v1 and vertex v2 are too close to one another or coincident (warning).
- // ERR 2103 : 16 WITH 3
- case 1005105 : // two vertices are too close to one another or coincident.
- case 1005107: // Two vertices are too close to one another or coincident.
- ptr = getIds(ptr, NODE, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- ptr = getIds(ptr, NODE, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- break;
- case 2012: // Vertex v1 cannot be inserted (warning).
- case 1005106 : // a vertex cannot be inserted.
- ptr = getIds(ptr, NODE, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- break;
- case 3103: // The surface edge (e1, e2) intersects another surface edge (e3, e4)
- case 1005110 : // two surface edges are intersecting.
- // ERR 3103 : 1 2 WITH 7 3
- ptr = getIds(ptr, EDGE, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- ptr = getIds(ptr, EDGE, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- break;
- case 3104: // The surface edge (e1, e2) intersects the surface face (f 1, f 2, f 3)
- // ERR 3104 : 9 10 WITH 1 2 3
- case 3106: // One surface edge (say e1, e2) intersects a surface face (f 1, f 2, f 3)
- case 1005120 : // a surface edge intersects a surface face.
- ptr = getIds(ptr, EDGE, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- ptr = getIds(ptr, TRIA, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- break;
- case 3105: // One boundary point (say p1) lies within a surface face (f 1, f 2, f 3)
- // ERR 3105 : 8 IN 2 3 5
- case 1005150 : // a boundary point lies within a surface face.
- ptr = getIds(ptr, NODE, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- ptr = getIds(ptr, TRIA, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- break;
- case 3107: // One boundary point (say p1) lies within a surface edge (e1, e2) (stop).
- // ERR 3107 : 2 IN 4 1
- case 1005160 : // a boundary point lies within a surface edge.
- ptr = getIds(ptr, NODE, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- ptr = getIds(ptr, EDGE, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- break;
- case 9000: // ERR 9000
- // ELEMENT 261 WITH VERTICES : 7 396 -8 242
- // VOLUME : -1.11325045E+11 W.R.T. EPSILON 0.
- // A too small volume element is detected. Are reported the index of the element,
- // its four vertex indices, its volume and the tolerance threshold value
- ptr = getIds(ptr, SKIP_ID, nodeIds);
- ptr = getIds(ptr, VOL, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- // even if all nodes found, volume it most probably invisible,
- // add its faces to demonstrate it anyhow
- {
- vector<int> faceNodes( nodeIds.begin(), --nodeIds.end() ); // 012
- badElems.push_back( toSmdsConvertor.getElement(faceNodes));
- faceNodes[2] = nodeIds[3]; // 013
- badElems.push_back( toSmdsConvertor.getElement(faceNodes));
- faceNodes[1] = nodeIds[2]; // 023
- badElems.push_back( toSmdsConvertor.getElement(faceNodes));
- faceNodes[0] = nodeIds[1]; // 123
- badElems.push_back( toSmdsConvertor.getElement(faceNodes));
- }
- break;
- case 9001: // ERR 9001
- // %% NUMBER OF NEGATIVE VOLUME TETS : 1
- // %% THE LARGEST NEGATIVE TET : 1.75376581E+11
- // %% NUMBER OF NULL VOLUME TETS : 0
- // There exists at least a null or negative volume element
- break;
- case 9002:
- // There exist n null or negative volume elements
- break;
- case 9003:
- // A too small volume element is detected
- break;
- case 9102:
- // A too bad quality face is detected. This face is considered degenerated,
- // its index, its three vertex indices together with its quality value are reported
- break; // same as next
- case 9112: // ERR 9112
- // FACE 2 WITH VERTICES : 4 2 5
- // SMALL INRADIUS : 0.
- // A too bad quality face is detected. This face is degenerated,
- // its index, its three vertex indices together with its inradius are reported
- ptr = getIds(ptr, SKIP_ID, nodeIds);
- ptr = getIds(ptr, TRIA, nodeIds);
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- // add triangle edges as it most probably has zero area and hence invisible
- {
- vector<int> edgeNodes(2);
- edgeNodes[0] = nodeIds[0]; edgeNodes[1] = nodeIds[1]; // 0-1
- badElems.push_back( toSmdsConvertor.getElement(edgeNodes));
- edgeNodes[1] = nodeIds[2]; // 0-2
- badElems.push_back( toSmdsConvertor.getElement(edgeNodes));
- edgeNodes[0] = nodeIds[1]; // 1-2
- badElems.push_back( toSmdsConvertor.getElement(edgeNodes));
- }
- break;
- case 1005103 : // the vertices of an element are too close to one another or coincident.
- ptr = getIds(ptr, TRIA, nodeIds);
- if ( nodeIds.back() == 0 ) // index of the third vertex of the element (0 for an edge)
- nodeIds.resize( EDGE );
- badElems.push_back( toSmdsConvertor.getElement(nodeIds));
- break;
- }
-
- bool isNewError = foundErrorStr.insert( string( errBeg, ptr )).second;
- if ( !isNewError )
- continue; // not to report same error several times
-
-// const SMDS_MeshElement* nullElem = 0;
-// bool allElemsOk = ( find( badElems.begin(), badElems.end(), nullElem) == badElems.end());
-
-// if ( allElemsOk && !badElems.empty() && !elemErrorNums.empty() ) {
-// bool oneMoreErrorType = elemErrorNums.insert( errNum ).second;
-// if ( oneMoreErrorType )
-// continue; // not to report different types of errors with bad elements
-// }
-
- // store bad elements
- //if ( allElemsOk ) {
- list<const SMDS_MeshElement*>::iterator elem = badElems.begin();
- for ( ; elem != badElems.end(); ++elem )
- addBadInputElement( *elem );
- //}
-
- // make error text
- string text = translateError( errNum );
- if ( errDescription.find( text ) == text.npos ) {
- if ( !errDescription.empty() )
- errDescription << "\n";
- errDescription << text;
- }
-
- } // end while
-
- if ( errDescription.empty() ) { // no errors found
- char msgLic1[] = "connection to server failed";
- char msgLic2[] = " Dlim ";
- if ( search( &buf[0], bufEnd, msgLic1, msgLic1 + strlen(msgLic1)) != bufEnd ||
- search( &buf[0], bufEnd, msgLic2, msgLic2 + strlen(msgLic2)) != bufEnd )
- errDescription << "Licence problems.";
- else
- {
- char msg2[] = "SEGMENTATION FAULT";
- if ( search( &buf[0], bufEnd, msg2, msg2 + strlen(msg2)) != bufEnd )
- errDescription << "ghs3d: SEGMENTATION FAULT. ";
- }
- }
-
- if ( errDescription.empty() )
- errDescription << "See " << logFile << " for problem description";
- else
- errDescription << "\nSee " << logFile << " for more information";
-
- return error( errDescription );
-}
-
-//================================================================================
-/*!
- * \brief Creates _Ghs2smdsConvertor
- */
-//================================================================================
-
-_Ghs2smdsConvertor::_Ghs2smdsConvertor( const map <int,const SMDS_MeshNode*> & ghs2NodeMap)
- :_ghs2NodeMap( & ghs2NodeMap ), _nodeByGhsId( 0 )
-{
-}
-
-//================================================================================
-/*!
- * \brief Creates _Ghs2smdsConvertor
- */
-//================================================================================
-
-_Ghs2smdsConvertor::_Ghs2smdsConvertor( const vector <const SMDS_MeshNode*> & nodeByGhsId)
- : _ghs2NodeMap( 0 ), _nodeByGhsId( &nodeByGhsId )
-{
-}
-
-//================================================================================
-/*!
- * \brief Return SMDS element by ids of GHS3D nodes
- */
-//================================================================================
-
-const SMDS_MeshElement* _Ghs2smdsConvertor::getElement(const vector<int>& ghsNodes) const
-{
- size_t nbNodes = ghsNodes.size();
- vector<const SMDS_MeshNode*> nodes( nbNodes, 0 );
- for ( size_t i = 0; i < nbNodes; ++i ) {
- int ghsNode = ghsNodes[ i ];
- if ( _ghs2NodeMap ) {
- map <int,const SMDS_MeshNode*>::const_iterator in = _ghs2NodeMap->find( ghsNode);
- if ( in == _ghs2NodeMap->end() )
- return 0;
- nodes[ i ] = in->second;
- }
- else {
- if ( ghsNode < 1 || ghsNode > _nodeByGhsId->size() )
- return 0;
- nodes[ i ] = (*_nodeByGhsId)[ ghsNode-1 ];
- }
- }
- if ( nbNodes == 1 )
- return nodes[0];
-
- if ( nbNodes == 2 ) {
- const SMDS_MeshElement* edge= SMDS_Mesh::FindEdge( nodes[0], nodes[1] );
- if ( !edge )
- edge = new SMDS_LinearEdge( nodes[0], nodes[1] );
- return edge;
- }
- if ( nbNodes == 3 ) {
- const SMDS_MeshElement* face = SMDS_Mesh::FindFace( nodes );
- if ( !face )
- face = new SMDS_FaceOfNodes( nodes[0], nodes[1], nodes[2] );
- return face;
- }
- if ( nbNodes == 4 )
- return new SMDS_VolumeOfNodes( nodes[0], nodes[1], nodes[2], nodes[3] );
-
- return 0;
-}
-
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool GHS3DPlugin_GHS3D::Evaluate(SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape,
- MapShapeNbElems& aResMap)
-{
- int nbtri = 0, nbqua = 0;
- double fullArea = 0.0;
- for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next()) {
- TopoDS_Face F = TopoDS::Face( exp.Current() );
- SMESH_subMesh *sm = aMesh.GetSubMesh(F);
- MapShapeNbElemsItr anIt = aResMap.find(sm);
- if( anIt==aResMap.end() ) {
- SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
- smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,
- "Submesh can not be evaluated",this));
- return false;
- }
- std::vector<int> aVec = (*anIt).second;
- nbtri += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
- nbqua += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
- GProp_GProps G;
- BRepGProp::SurfaceProperties(F,G);
- double anArea = G.Mass();
- fullArea += anArea;
- }
-
- // collect info from edges
- int nb0d_e = 0, nb1d_e = 0;
- bool IsQuadratic = false;
- bool IsFirst = true;
- TopTools_MapOfShape tmpMap;
- for (TopExp_Explorer exp(aShape, TopAbs_EDGE); exp.More(); exp.Next()) {
- TopoDS_Edge E = TopoDS::Edge(exp.Current());
- if( tmpMap.Contains(E) )
- continue;
- tmpMap.Add(E);
- SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
- MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
- std::vector<int> aVec = (*anIt).second;
- nb0d_e += aVec[SMDSEntity_Node];
- nb1d_e += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
- if(IsFirst) {
- IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
- IsFirst = false;
- }
- }
- tmpMap.Clear();
-
- double ELen = sqrt(2.* ( fullArea/(nbtri+nbqua*2) ) / sqrt(3.0) );
-
- GProp_GProps G;
- BRepGProp::VolumeProperties(aShape,G);
- double aVolume = G.Mass();
- double tetrVol = 0.1179*ELen*ELen*ELen;
- double CoeffQuality = 0.9;
- int nbVols = int(aVolume/tetrVol/CoeffQuality);
- int nb1d_f = (nbtri*3 + nbqua*4 - nb1d_e) / 2;
- int nb1d_in = (int) ( nbVols*6 - nb1d_e - nb1d_f ) / 5;
- std::vector<int> aVec(SMDSEntity_Last);
- for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
- if( IsQuadratic ) {
- aVec[SMDSEntity_Node] = nb1d_in/6 + 1 + nb1d_in;
- aVec[SMDSEntity_Quad_Tetra] = nbVols - nbqua*2;
- aVec[SMDSEntity_Quad_Pyramid] = nbqua;
- }
- else {
- aVec[SMDSEntity_Node] = nb1d_in/6 + 1;
- aVec[SMDSEntity_Tetra] = nbVols - nbqua*2;
- aVec[SMDSEntity_Pyramid] = nbqua;
- }
- SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
- aResMap.insert(std::make_pair(sm,aVec));
-
- return true;
-}
-
-bool GHS3DPlugin_GHS3D::importGMFMesh(const char* theGMFFileName, SMESH_Mesh& theMesh)
-{
- SMESH_MesherHelper* helper = new SMESH_MesherHelper(theMesh );
- std::vector <const SMDS_MeshNode*> dummyNodeVector;
- std::vector <const SMDS_MeshElement*> aFaceByGhs3dId;
- std::map<const SMDS_MeshNode*,int> dummyNodeMap;
- std::map<std::vector<double>, std::string> dummyEnfVertGroup;
- std::vector<std::string> dummyElemGroup;
- std::set<std::string> dummyGroupsToRemove;
-
- bool ok = readGMFFile(theGMFFileName,
- this,
- helper, dummyNodeVector, aFaceByGhs3dId, dummyNodeMap, dummyElemGroup, dummyElemGroup, dummyElemGroup, dummyGroupsToRemove);
- theMesh.GetMeshDS()->Modified();
- return ok;
-}
-
-namespace
-{
- //================================================================================
- /*!
- * \brief Sub-mesh event listener setting enforced elements as soon as an enforced
- * mesh is loaded
- */
- struct _EnforcedMeshRestorer : public SMESH_subMeshEventListener
- {
- _EnforcedMeshRestorer():
- SMESH_subMeshEventListener( /*isDeletable = */true, Name() )
- {}
-
- //================================================================================
- /*!
- * \brief Returns an ID of listener
- */
- static const char* Name() { return "GHS3DPlugin_GHS3D::_EnforcedMeshRestorer"; }
-
- //================================================================================
- /*!
- * \brief Treat events of the subMesh
- */
- void ProcessEvent(const int event,
- const int eventType,
- SMESH_subMesh* subMesh,
- SMESH_subMeshEventListenerData* data,
- const SMESH_Hypothesis* hyp)
- {
- if ( SMESH_subMesh::SUBMESH_LOADED == event &&
- SMESH_subMesh::COMPUTE_EVENT == eventType &&
- data &&
- !data->mySubMeshes.empty() )
- {
- // An enforced mesh (subMesh->_father) has been loaded from hdf file
- if ( GHS3DPlugin_Hypothesis* hyp = GetGHSHypothesis( data->mySubMeshes.front() ))
- hyp->RestoreEnfElemsByMeshes();
- }
- }
- //================================================================================
- /*!
- * \brief Returns GHS3DPlugin_Hypothesis used to compute a subMesh
- */
- static GHS3DPlugin_Hypothesis* GetGHSHypothesis( SMESH_subMesh* subMesh )
- {
- SMESH_HypoFilter ghsHypFilter( SMESH_HypoFilter::HasName( "GHS3D_Parameters" ));
- return (GHS3DPlugin_Hypothesis* )
- subMesh->GetFather()->GetHypothesis( subMesh->GetSubShape(),
- ghsHypFilter,
- /*visitAncestors=*/true);
- }
- };
-
- //================================================================================
- /*!
- * \brief Sub-mesh event listener removing empty groups created due to "To make
- * groups of domains".
- */
- struct _GroupsOfDomainsRemover : public SMESH_subMeshEventListener
- {
- _GroupsOfDomainsRemover():
- SMESH_subMeshEventListener( /*isDeletable = */true,
- "GHS3DPlugin_GHS3D::_GroupsOfDomainsRemover" ) {}
- /*!
- * \brief Treat events of the subMesh
- */
- void ProcessEvent(const int event,
- const int eventType,
- SMESH_subMesh* subMesh,
- SMESH_subMeshEventListenerData* data,
- const SMESH_Hypothesis* hyp)
- {
- if (SMESH_subMesh::ALGO_EVENT == eventType &&
- !subMesh->GetAlgo() )
- {
- removeEmptyGroupsOfDomains( subMesh->GetFather(), /*notEmptyAsWell=*/true );
- }
- }
- };
-}
-
-//================================================================================
-/*!
- * \brief Set an event listener to set enforced elements as soon as an enforced
- * mesh is loaded
- */
-//================================================================================
-
-void GHS3DPlugin_GHS3D::SubmeshRestored(SMESH_subMesh* subMesh)
-{
- if ( GHS3DPlugin_Hypothesis* hyp = _EnforcedMeshRestorer::GetGHSHypothesis( subMesh ))
- {
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList enfMeshes = hyp->_GetEnforcedMeshes();
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList::iterator it = enfMeshes.begin();
- for(;it != enfMeshes.end();++it) {
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedMesh* enfMesh = *it;
- if ( SMESH_Mesh* mesh = GetMeshByPersistentID( enfMesh->persistID ))
- {
- SMESH_subMesh* smToListen = mesh->GetSubMesh( mesh->GetShapeToMesh() );
- // a listener set to smToListen will care of hypothesis stored in SMESH_EventListenerData
- subMesh->SetEventListener( new _EnforcedMeshRestorer(),
- SMESH_subMeshEventListenerData::MakeData( subMesh ),
- smToListen);
- }
- }
- }
-}
-
-//================================================================================
-/*!
- * \brief Sets an event listener removing empty groups created due to "To make
- * groups of domains".
- * \param subMesh - submesh where algo is set
- *
- * This method is called when a submesh gets HYP_OK algo_state.
- * After being set, event listener is notified on each event of a submesh.
- */
-//================================================================================
-
-void GHS3DPlugin_GHS3D::SetEventListener(SMESH_subMesh* subMesh)
-{
- subMesh->SetEventListener( new _GroupsOfDomainsRemover(), 0, subMesh );
-}
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-//=============================================================================
-// File : GHS3DPlugin_GHS3D.hxx
-// Author : Edward AGAPOV, modified by Lioka RAZAFINDRAZAKA (CEA) 09/02/2007
-// Project : SALOME
-//=============================================================================
-//
-#ifndef _GHS3DPlugin_GHS3D_HXX_
-#define _GHS3DPlugin_GHS3D_HXX_
-
-#include "SMESH_Algo.hxx"
-#include "SMESH_Gen.hxx"
-#include "SMESH_Gen_i.hxx"
-
-#include <map>
-#include <vector>
-
-extern "C"
-{
- #include "libmesh5.h"
-}
-
-#ifndef GMFVERSION
-#define GMFVERSION GmfDouble
-#endif
-#define GMFDIMENSION 3
-
-class GHS3DPlugin_Hypothesis;
-class SMDS_MeshNode;
-class SMESH_Mesh;
-class StdMeshers_ViscousLayers;
-class TCollection_AsciiString;
-class _Ghs2smdsConvertor;
-class TopoDS_Shape;
-
-class GHS3DPlugin_GHS3D: public SMESH_3D_Algo
-{
-public:
- GHS3DPlugin_GHS3D(int hypId, int studyId, SMESH_Gen* gen);
- virtual ~GHS3DPlugin_GHS3D();
-
- virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape,
- Hypothesis_Status& aStatus);
-
- virtual bool Compute(SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape);
-
- virtual void CancelCompute();
- bool computeCanceled() { return _compute_canceled;};
-
- virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
- MapShapeNbElems& aResMap);
-
- virtual bool Compute(SMESH_Mesh& theMesh,
- SMESH_MesherHelper* aHelper);
-
- virtual void SubmeshRestored(SMESH_subMesh* subMesh);
-
- virtual void SetEventListener(SMESH_subMesh* subMesh);
-
- bool importGMFMesh(const char* aGMFFileName, SMESH_Mesh& aMesh);
-
- static const char* Name() { return "GHS3D_3D"; }
-
-protected:
- const GHS3DPlugin_Hypothesis* _hyp;
- const StdMeshers_ViscousLayers* _viscousLayersHyp;
- std::string _genericName;
-
-private:
-
- bool storeErrorDescription(const TCollection_AsciiString& logFile,
- const _Ghs2smdsConvertor & toSmdsConvertor );
- TopoDS_Shape entryToShape(std::string entry);
-
- int _iShape;
- int _nbShape;
- bool _keepFiles;
- bool _removeLogOnSuccess;
- bool _logInStandardOutput;
- SALOMEDS::Study_var myStudy;
- SMESH_Gen_i* smeshGen_i;
-
- volatile bool _compute_canceled;
-};
-
-/*!
- * \brief Convertor of GHS3D elements to SMDS ones
- */
-class _Ghs2smdsConvertor
-{
- const std::map <int,const SMDS_MeshNode*> * _ghs2NodeMap;
- const std::vector <const SMDS_MeshNode*> * _nodeByGhsId;
-
-public:
- _Ghs2smdsConvertor( const std::map <int,const SMDS_MeshNode*> & ghs2NodeMap);
-
- _Ghs2smdsConvertor( const std::vector <const SMDS_MeshNode*> & nodeByGhsId);
-
- const SMDS_MeshElement* getElement(const std::vector<int>& ghsNodes) const;
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// 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 : GHS3DPlugin_GHS3D_i.cxx
-// Author : Edward AGAPOV
-// Module : GHS3DPlugin
-// $Header$
-//
-#include "GHS3DPlugin_GHS3D_i.hxx"
-#include "SMESH_Gen.hxx"
-#include "SMESH_Mesh_i.hxx"
-#include "SMESH_Gen_i.hxx"
-#include "GHS3DPlugin_GHS3D.hxx"
-#include "SMESH_PythonDump.hxx"
-
-#include "utilities.h"
-#include <cstring>
-
-//=============================================================================
-/*!
- * GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_i
- *
- * Constructor
- */
-//=============================================================================
-
-GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_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 )
-{
- MESSAGE( "GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_i" );
- myBaseImpl = new ::GHS3DPlugin_GHS3D (theGenImpl->GetANewId(),
- theStudyId,
- theGenImpl );
-}
-
-//=============================================================================
-/*!
- * GHS3DPlugin_GHS3D_i::~GHS3DPlugin_GHS3D_i
- *
- * Destructor
- */
-//=============================================================================
-
-GHS3DPlugin_GHS3D_i::~GHS3DPlugin_GHS3D_i()
-{
- MESSAGE( "GHS3DPlugin_GHS3D_i::~GHS3DPlugin_GHS3D_i" );
-}
-
-//=============================================================================
-/*!
- * GHS3DPlugin_GHS3D_i::GetImpl
- *
- * Get implementation
- */
-//=============================================================================
-
-::GHS3DPlugin_GHS3D* GHS3DPlugin_GHS3D_i::GetImpl()
-{
- MESSAGE( "GHS3DPlugin_GHS3D_i::GetImpl" );
- return ( ::GHS3DPlugin_GHS3D* )myBaseImpl;
-}
-
-//=============================================================================
-/*!
- * GHS3DPlugin_GHS3D_i::~GHS3DPlugin_GHS3D_i
- *
- * Destructor
- */
-//=============================================================================
-
-SMESH::SMESH_Mesh_ptr GHS3DPlugin_GHS3D_i::importGMFMesh(const char* theGMFFileName)
-{
- MESSAGE( "GHS3DPlugin_GHS3D_i::importGMFMesh" );
- SMESH_Gen_i* smeshGen = SMESH_Gen_i::GetSMESHGen();
- SMESH::SMESH_Mesh_ptr theMesh = smeshGen->CreateEmptyMesh();
- smeshGen->RemoveLastFromPythonScript(smeshGen->GetCurrentStudy()->StudyId());
- SALOMEDS::SObject_ptr theSMesh = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(), theMesh);
-#ifdef WINNT
-#define SEP '\\'
-#else
-#define SEP '/'
-#endif
- string strFileName (theGMFFileName);
- strFileName = strFileName.substr(strFileName.rfind(SEP)+1);
- strFileName.erase(strFileName.rfind('.'));
- smeshGen->SetName(theSMesh, strFileName.c_str());
- SMESH_Mesh_i* meshServant = dynamic_cast<SMESH_Mesh_i*>( smeshGen->GetServant( theMesh ).in() );
- ASSERT( meshServant );
- if ( meshServant ) {
- if (GetImpl()->importGMFMesh(theGMFFileName, meshServant->GetImpl()))
- SMESH::TPythonDump() << theSMesh << " = " << _this() << ".importGMFMesh( \"" << theGMFFileName << "\")";
- }
- return theMesh;
-}
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File : GHS3DPlugin_GHS3D_i.hxx
-// Author : Edward AGAPOV
-// Module : GHS3DPlugin
-// $Header$
-//
-#ifndef _GHS3DPlugin_GHS3D_I_HXX_
-#define _GHS3DPlugin_GHS3D_I_HXX_
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(GHS3DPlugin_Algorithm)
-#include CORBA_SERVER_HEADER(SALOME_Exception)
-
-#include "SMESH_3D_Algo_i.hxx"
-#include "GHS3DPlugin_GHS3D.hxx"
-
-// ======================================================
-// GHS3D 3d algorithm
-// ======================================================
-class GHS3DPlugin_GHS3D_i:
- public virtual POA_GHS3DPlugin::GHS3DPlugin_GHS3D,
- public virtual SMESH_3D_Algo_i
-{
-public:
- // Constructor
- GHS3DPlugin_GHS3D_i (PortableServer::POA_ptr thePOA,
- int theStudyId,
- ::SMESH_Gen* theGenImpl );
- // Destructor
- virtual ~GHS3DPlugin_GHS3D_i();
-
- // Get implementation
- ::GHS3DPlugin_GHS3D* GetImpl();
-
- virtual SMESH::SMESH_Mesh_ptr importGMFMesh(const char* theGMFFileName);
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-//=============================================================================
-// File : GHS3DPlugin_Hypothesis.cxx
-// Created : Wed Apr 2 12:36:29 2008
-// Author : Edward AGAPOV (eap)
-//=============================================================================
-//
-#include "GHS3DPlugin_Hypothesis.hxx"
-#include <SMESH_ProxyMesh.hxx>
-#include <SMESH_Group.hxx>
-#include <StdMeshers_QuadToTriaAdaptor.hxx>
-
-#include <TCollection_AsciiString.hxx>
-
-#ifdef WIN32
-#include <process.h>
-#define getpid _getpid
-#endif
-
-//=======================================================================
-//function : GHS3DPlugin_Hypothesis
-//=======================================================================
-
-GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen)
- : SMESH_Hypothesis(hypId, studyId, gen),
- myToMeshHoles(DefaultMeshHoles()),
- myToMakeGroupsOfDomains(DefaultToMakeGroupsOfDomains()),
- myMaximumMemory(-1),
- myInitialMemory(-1),
- myOptimizationLevel(DefaultOptimizationLevel()),
- myWorkingDirectory(DefaultWorkingDirectory()),
- myKeepFiles(DefaultKeepFiles()),
- myVerboseLevel(DefaultVerboseLevel()),
- myToCreateNewNodes(DefaultToCreateNewNodes()),
- myToUseBoundaryRecoveryVersion(DefaultToUseBoundaryRecoveryVersion()),
- myToUseFemCorrection(DefaultToUseFEMCorrection()),
- myToRemoveCentralPoint(DefaultToRemoveCentralPoint()),
- myGradation(DefaultGradation()),
- myLogInStandardOutput(DefaultStandardOutputLog()),
- _enfVertexList(DefaultGHS3DEnforcedVertexList()),
- _enfVertexCoordsSizeList(DefaultGHS3DEnforcedVertexCoordsValues()),
- _enfVertexEntrySizeList(DefaultGHS3DEnforcedVertexEntryValues()),
- _coordsEnfVertexMap(DefaultCoordsGHS3DEnforcedVertexMap()),
- _geomEntryEnfVertexMap(DefaultGeomEntryGHS3DEnforcedVertexMap()),
- _enfMeshList(DefaultGHS3DEnforcedMeshList()),
- _entryEnfMeshMap(DefaultEntryGHS3DEnforcedMeshListMap()),
- _enfNodes(TIDSortedNodeGroupMap()),
- _enfEdges(TIDSortedElemGroupMap()),
- _enfTriangles(TIDSortedElemGroupMap()),
- _nodeIDToSizeMap(DefaultID2SizeMap()),
- _groupsToRemove(DefaultGroupsToRemove())
-{
- _name = "GHS3D_Parameters";
- _param_algo_dim = 3;
-}
-
-//=======================================================================
-//function : SetToMeshHoles
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetToMeshHoles(bool toMesh)
-{
- if ( myToMeshHoles != toMesh ) {
- myToMeshHoles = toMesh;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetToMeshHoles
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::GetToMeshHoles(bool checkFreeOption) const
-{
- if (checkFreeOption && !myTextOption.empty()) {
- if ( myTextOption.find("-c 0"))
- return true;
- if ( myTextOption.find("-c 1"))
- return false;
- }
- return myToMeshHoles;
-}
-
-//=======================================================================
-//function : SetToMakeGroupsOfDomains
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetToMakeGroupsOfDomains(bool toMakeGroups)
-{
- if ( myToMakeGroupsOfDomains != toMakeGroups ) {
- myToMakeGroupsOfDomains = toMakeGroups;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetToMakeGroupsOfDomains
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains() const
-{
- return myToMakeGroupsOfDomains;
-}
-
-//=======================================================================
-//function : GetToMakeGroupsOfDomains
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains(const GHS3DPlugin_Hypothesis* hyp)
-{
- bool res;
- if ( hyp ) res = /*hyp->GetToMeshHoles(true) &&*/ hyp->GetToMakeGroupsOfDomains();
- else res = /*DefaultMeshHoles() &&*/ DefaultToMakeGroupsOfDomains();
- return res;
-}
-
-//=======================================================================
-//function : SetMaximumMemory
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetMaximumMemory(double MB)
-{
- if ( myMaximumMemory != MB ) {
- myMaximumMemory = MB;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetMaximumMemory
-// * automatic memory adjustment mode. Default is zero
-//=======================================================================
-
-double GHS3DPlugin_Hypothesis::GetMaximumMemory() const
-{
- return myMaximumMemory;
-}
-
-//=======================================================================
-//function : SetInitialMemory
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetInitialMemory(double MB)
-{
- if ( myInitialMemory != MB ) {
- myInitialMemory = MB;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetInitialMemory
-//=======================================================================
-
-double GHS3DPlugin_Hypothesis::GetInitialMemory() const
-{
- return myInitialMemory;
-}
-
-//=======================================================================
-//function : SetOptimizationLevel
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetOptimizationLevel(OptimizationLevel level)
-{
- if ( myOptimizationLevel != level ) {
- myOptimizationLevel = level;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetOptimizationLevel
-//=======================================================================
-
-GHS3DPlugin_Hypothesis::OptimizationLevel GHS3DPlugin_Hypothesis::GetOptimizationLevel() const
-{
- return (OptimizationLevel) myOptimizationLevel;
-}
-
-//=======================================================================
-//function : SetWorkingDirectory
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetWorkingDirectory(const std::string& path)
-{
- if ( myWorkingDirectory != path ) {
- myWorkingDirectory = path;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetWorkingDirectory
-//=======================================================================
-
-std::string GHS3DPlugin_Hypothesis::GetWorkingDirectory() const
-{
- return myWorkingDirectory;
-}
-
-//=======================================================================
-//function : SetKeepFiles
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetKeepFiles(bool toKeep)
-{
- if ( myKeepFiles != toKeep ) {
- myKeepFiles = toKeep;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetKeepFiles
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::GetKeepFiles() const
-{
- return myKeepFiles;
-}
-
-//=======================================================================
-//function : SetVerboseLevel
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetVerboseLevel(short level)
-{
- if ( myVerboseLevel != level ) {
- myVerboseLevel = level;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetVerboseLevel
-//=======================================================================
-
-short GHS3DPlugin_Hypothesis::GetVerboseLevel() const
-{
- return myVerboseLevel;
-}
-
-//=======================================================================
-//function : SetToCreateNewNodes
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetToCreateNewNodes(bool toCreate)
-{
- if ( myToCreateNewNodes != toCreate ) {
- myToCreateNewNodes = toCreate;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetToCreateNewNodes
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::GetToCreateNewNodes() const
-{
- return myToCreateNewNodes;
-}
-
-//=======================================================================
-//function : SetToUseBoundaryRecoveryVersion
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetToUseBoundaryRecoveryVersion(bool toUse)
-{
- if ( myToUseBoundaryRecoveryVersion != toUse ) {
- myToUseBoundaryRecoveryVersion = toUse;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetToUseBoundaryRecoveryVersion
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::GetToUseBoundaryRecoveryVersion() const
-{
- return myToUseBoundaryRecoveryVersion;
-}
-
-//=======================================================================
-//function : SetFEMCorrection
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetFEMCorrection(bool toUseFem)
-{
- if ( myToUseFemCorrection != toUseFem ) {
- myToUseFemCorrection = toUseFem;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetFEMCorrection
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::GetFEMCorrection() const
-{
- return myToUseFemCorrection;
-}
-
-//=======================================================================
-//function : SetToRemoveCentralPoint
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetToRemoveCentralPoint(bool toRemove)
-{
- if ( myToRemoveCentralPoint != toRemove ) {
- myToRemoveCentralPoint = toRemove;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetToRemoveCentralPoint
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::GetToRemoveCentralPoint() const
-{
- return myToRemoveCentralPoint;
-}
-
-//=======================================================================
-//function : SetTextOption
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetTextOption(const std::string& option)
-{
- if ( myTextOption != option ) {
- myTextOption = option;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetTextOption
-//=======================================================================
-
-std::string GHS3DPlugin_Hypothesis::GetTextOption() const
-{
- return myTextOption;
-}
-
-//=======================================================================
-//function : SetGradation
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetGradation(double gradation)
-{
- if ( myGradation != gradation ) {
- myGradation = gradation;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetGradation
-//=======================================================================
-
-double GHS3DPlugin_Hypothesis::GetGradation() const
-{
- return myGradation;
-}
-
-//=======================================================================
-//function : SetStandardOutputLog
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetStandardOutputLog(bool logInStandardOutput)
-{
- if ( myLogInStandardOutput != logInStandardOutput ) {
- myLogInStandardOutput = logInStandardOutput;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetStandardOutputLog
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::GetStandardOutputLog() const
-{
- return myLogInStandardOutput;
-}
-
-//=======================================================================
-//function : SetRemoveLogOnSuccess
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::SetRemoveLogOnSuccess(bool removeLogOnSuccess)
-{
- if ( myRemoveLogOnSuccess != removeLogOnSuccess ) {
- myRemoveLogOnSuccess = removeLogOnSuccess;
- NotifySubMeshesHypothesisModification();
- }
-}
-
-//=======================================================================
-//function : GetRemoveLogOnSuccess
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::GetRemoveLogOnSuccess() const
-{
- return myRemoveLogOnSuccess;
-}
-
-//=======================================================================
-//function : SetEnforcedVertex
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string theEntry, std::string theGroupName,
- double size, double x, double y, double z, bool isCompound)
-{
- MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedVertex(\""<< theName << "\", \""<< theEntry << "\", \"" << theGroupName << "\", "
- << size << ", " << x << ", " << y << ", " << z << ", "<< isCompound << ")");
-
- bool toNotify = false;
- bool toCreate = true;
-
- TGHS3DEnforcedVertex *oldEnVertex;
- TGHS3DEnforcedVertex *newEnfVertex = new TGHS3DEnforcedVertex();
- newEnfVertex->name = theName;
- newEnfVertex->geomEntry = theEntry;
- newEnfVertex->coords.clear();
- if (!isCompound) {
- newEnfVertex->coords.push_back(x);
- newEnfVertex->coords.push_back(y);
- newEnfVertex->coords.push_back(z);
- }
- newEnfVertex->groupName = theGroupName;
- newEnfVertex->size = size;
- newEnfVertex->isCompound = isCompound;
-
-
- // update _enfVertexList
- TGHS3DEnforcedVertexList::iterator it = _enfVertexList.find(newEnfVertex);
- if (it != _enfVertexList.end()) {
- toCreate = false;
- oldEnVertex = (*it);
- MESSAGE("Enforced Vertex was found => Update");
- if (oldEnVertex->name != theName) {
- MESSAGE("Update name from \"" << oldEnVertex->name << "\" to \"" << theName << "\"");
- oldEnVertex->name = theName;
- toNotify = true;
- }
- if (oldEnVertex->groupName != theGroupName) {
- MESSAGE("Update group name from \"" << oldEnVertex->groupName << "\" to \"" << theGroupName << "\"");
- oldEnVertex->groupName = theGroupName;
- toNotify = true;
- }
- if (oldEnVertex->size != size) {
- MESSAGE("Update size from \"" << oldEnVertex->size << "\" to \"" << size << "\"");
- oldEnVertex->size = size;
- toNotify = true;
- }
- if (toNotify) {
- // update map coords / enf vertex if needed
- if (oldEnVertex->coords.size()) {
- _coordsEnfVertexMap[oldEnVertex->coords] = oldEnVertex;
- _enfVertexCoordsSizeList[oldEnVertex->coords] = size;
- }
-
- // update map geom entry / enf vertex if needed
- if (oldEnVertex->geomEntry != "") {
- _geomEntryEnfVertexMap[oldEnVertex->geomEntry] = oldEnVertex;
- _enfVertexEntrySizeList[oldEnVertex->geomEntry] = size;
- }
- }
- }
-
-// //////// CREATE ////////////
- if (toCreate) {
- toNotify = true;
- MESSAGE("Creating new enforced vertex");
- _enfVertexList.insert(newEnfVertex);
- if (theEntry == "") {
- _coordsEnfVertexMap[newEnfVertex->coords] = newEnfVertex;
- _enfVertexCoordsSizeList[newEnfVertex->coords] = size;
- }
- else {
- _geomEntryEnfVertexMap[newEnfVertex->geomEntry] = newEnfVertex;
- _enfVertexEntrySizeList[newEnfVertex->geomEntry] = size;
- }
- }
-
- if (toNotify)
- NotifySubMeshesHypothesisModification();
-
- MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedVertex END");
- return toNotify;
-}
-
-
-//=======================================================================
-//function : SetEnforcedMesh
-//=======================================================================
-bool GHS3DPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
-{
- TIDSortedElemSet theElemSet;
- SMDS_ElemIteratorPtr eIt = theMesh.GetMeshDS()->elementsIterator(SMDSAbs_ElementType(elementType));
- while ( eIt->more() )
- theElemSet.insert( eIt->next() );
- MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source mesh");
- bool added = SetEnforcedElements( theElemSet, elementType, groupName);
- if (added) {
- TGHS3DEnforcedMesh* newEnfMesh = new TGHS3DEnforcedMesh();
- newEnfMesh->persistID = theMesh.GetMeshDS()->GetPersistentId();
- newEnfMesh->name = name;
- newEnfMesh->entry = entry;
- newEnfMesh->elementType = elementType;
- newEnfMesh->groupName = groupName;
-
- TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
- if (it == _enfMeshList.end()) {
- _entryEnfMeshMap[entry].insert(newEnfMesh);
- _enfMeshList.insert(newEnfMesh);
- }
- else {
- delete newEnfMesh;
- }
- }
- return added;
-}
-
-//=======================================================================
-//function : SetEnforcedGroup
-//=======================================================================
-bool GHS3DPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
-{
- MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedGroup");
- TIDSortedElemSet theElemSet;
- if ( theIDs->length() == 0 ){MESSAGE("The source group is empty");}
- for (int i=0; i < theIDs->length(); i++) {
- CORBA::Long ind = theIDs[i];
- if (elementType == SMESH::NODE)
- {
- const SMDS_MeshNode * node = theMeshDS->FindNode(ind);
- if (node)
- theElemSet.insert( node );
- }
- else
- {
- const SMDS_MeshElement * elem = theMeshDS->FindElement(ind);
- if (elem)
- theElemSet.insert( elem );
- }
- }
-
-// SMDS_ElemIteratorPtr it = theGroup->GetGroupDS()->GetElements();
-// while ( it->more() )
-// theElemSet.insert( it->next() );
-
- MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source group ");
- bool added = SetEnforcedElements( theElemSet, elementType, groupName);
- if (added) {
- TGHS3DEnforcedMesh* newEnfMesh = new TGHS3DEnforcedMesh();
- newEnfMesh->name = name;
- newEnfMesh->entry = entry;
- newEnfMesh->elementType = elementType;
- newEnfMesh->groupName = groupName;
-
- TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
- if (it == _enfMeshList.end()) {
- _entryEnfMeshMap[entry].insert(newEnfMesh);
- _enfMeshList.insert(newEnfMesh);
- }
- }
- return added;
-}
-
-//=======================================================================
-//function : SetEnforcedElements
-//=======================================================================
-bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName)
-{
- MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedElements");
- TIDSortedElemSet::const_iterator it = theElemSet.begin();
- const SMDS_MeshElement* elem;
- const SMDS_MeshNode* node;
- bool added = true;
- pair<TIDSortedNodeGroupMap::iterator,bool> nodeRet;
- pair<TIDSortedElemGroupMap::iterator,bool> elemRet;
-
- for (;it != theElemSet.end();++it)
- {
- elem = (*it);
- switch (elementType) {
- case SMESH::NODE:
- node = dynamic_cast<const SMDS_MeshNode*>(elem);
- if (node) {
- nodeRet = _enfNodes.insert(make_pair(node,groupName));
- added = added && nodeRet.second;
- string msg = added ? "yes":"no";
- MESSAGE( "Node (" <<node->X()<<","<<node->Y()<<","<<node->Z()<< ") with ID " << node->GetID() <<" added ? " << msg);
- }
- else {
- SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
- for (;nodeIt->more();) {
- node = dynamic_cast<const SMDS_MeshNode*>(nodeIt->next());
- nodeRet = _enfNodes.insert(make_pair(node,groupName));
- added = added && nodeRet.second;
- }
-// added = true;s
- }
- break;
- case SMESH::EDGE:
- if (elem->GetType() == SMDSAbs_Edge) {
- elemRet = _enfEdges.insert(make_pair(elem,groupName));
- added = added && elemRet.second;
- }
- else if (elem->GetType() > SMDSAbs_Edge) {
- SMDS_ElemIteratorPtr it = elem->edgesIterator();
- for (;it->more();) {
- const SMDS_MeshElement* anEdge = it->next();
- elemRet = _enfEdges.insert(make_pair(anEdge,groupName));
- added = added && elemRet.second;
- }
- }
- break;
- case SMESH::FACE:
- if (elem->GetType() == SMDSAbs_Face)
- {
- if (elem->NbCornerNodes() == 3) {
- elemRet = _enfTriangles.insert(make_pair(elem,groupName));
- added = added && elemRet.second;
- }
- }
- else if (elem->GetType() > SMDSAbs_Face) { // Group of faces
- SMDS_ElemIteratorPtr it = elem->facesIterator();
- for (;it->more();) {
- const SMDS_MeshElement* aFace = it->next();
- if (aFace->NbCornerNodes() == 3) {
- elemRet = _enfTriangles.insert(make_pair(aFace,groupName));
- added = added && elemRet.second;
- }
- }
- }
- break;
- default:
- break;
- };
- }
- if (added)
- NotifySubMeshesHypothesisModification();
- return added;
-}
-
-
-//=======================================================================
-//function : GetEnforcedVertex
-//=======================================================================
-
-GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* GHS3DPlugin_Hypothesis::GetEnforcedVertex(double x, double y, double z)
- throw (std::invalid_argument)
-{
- std::vector<double> coord(3);
- coord[0] = x;
- coord[1] = y;
- coord[2] = z;
- if (_coordsEnfVertexMap.count(coord)>0)
- return _coordsEnfVertexMap[coord];
- std::ostringstream msg ;
- msg << "No enforced vertex at " << x << ", " << y << ", " << z;
- throw std::invalid_argument(msg.str());
-}
-
-GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* GHS3DPlugin_Hypothesis::GetEnforcedVertex(const std::string theEntry)
- throw (std::invalid_argument)
-{
- if (_geomEntryEnfVertexMap.count(theEntry)>0)
- return _geomEntryEnfVertexMap[theEntry];
-
- std::ostringstream msg ;
- msg << "No enforced vertex with entry " << theEntry;
- throw std::invalid_argument(msg.str());
-}
-
-//=======================================================================
-//function : RemoveEnforcedVertex
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::RemoveEnforcedVertex(double x, double y, double z, const std::string theEntry)
- throw (std::invalid_argument)
-{
- bool toNotify = false;
- std::ostringstream msg;
- TGHS3DEnforcedVertex *oldEnfVertex;
- std::vector<double> coords(3);
- coords[0] = x;
- coords[1] = y;
- coords[2] = z;
-
- // check that enf vertex with given enf vertex entry exists
- TGeomEntryGHS3DEnforcedVertexMap::iterator it_enfVertexEntry = _geomEntryEnfVertexMap.find(theEntry);
- if (it_enfVertexEntry != _geomEntryEnfVertexMap.end()) {
- // Success
- MESSAGE("Found enforced vertex with geom entry " << theEntry);
- oldEnfVertex = it_enfVertexEntry->second;
- _geomEntryEnfVertexMap.erase(it_enfVertexEntry);
- } else {
- // Fail
- MESSAGE("Enforced vertex with geom entry " << theEntry << " not found");
- // check that enf vertex with given coords exists
- TCoordsGHS3DEnforcedVertexMap::iterator it_coords_enf = _coordsEnfVertexMap.find(coords);
- if (it_coords_enf != _coordsEnfVertexMap.end()) {
- // Success
- MESSAGE("Found enforced vertex with coords " << x << ", " << y << ", " << z);
- oldEnfVertex = it_coords_enf->second;
- _coordsEnfVertexMap.erase(it_coords_enf);
- _enfVertexCoordsSizeList.erase(_enfVertexCoordsSizeList.find(coords));
- } else {
- // Fail
- MESSAGE("Enforced vertex with coords " << x << ", " << y << ", " << z << " not found");
- throw std::invalid_argument(msg.str());
- }
- }
-
- MESSAGE("Remove enf vertex from _enfVertexList");
-
- // update _enfVertexList
- TGHS3DEnforcedVertexList::iterator it = _enfVertexList.find(oldEnfVertex);
- if (it != _enfVertexList.end()) {
- if ((*it)->groupName != "")
- _groupsToRemove.insert((*it)->groupName);
- _enfVertexList.erase(it);
- toNotify = true;
- MESSAGE("Done");
- }
-
- if (toNotify)
- NotifySubMeshesHypothesisModification();
-
- return toNotify;
-}
-
-//=======================================================================
-//function : ClearEnforcedVertices
-//=======================================================================
-void GHS3DPlugin_Hypothesis::ClearEnforcedVertices()
-{
- TGHS3DEnforcedVertexList::const_iterator it = _enfVertexList.begin();
- for(;it != _enfVertexList.end();++it) {
- if ((*it)->groupName != "")
- _groupsToRemove.insert((*it)->groupName);
- }
- _enfVertexList.clear();
- _coordsEnfVertexMap.clear();
- _geomEntryEnfVertexMap.clear();
- _enfVertexCoordsSizeList.clear();
- _enfVertexEntrySizeList.clear();
- NotifySubMeshesHypothesisModification();
-}
-
-//=======================================================================
-//function : ClearEnforcedMeshes
-//=======================================================================
-void GHS3DPlugin_Hypothesis::ClearEnforcedMeshes()
-{
- TGHS3DEnforcedMeshList::const_iterator it = _enfMeshList.begin();
- for(;it != _enfMeshList.end();++it) {
- if ((*it)->groupName != "")
- _groupsToRemove.insert((*it)->groupName);
- }
- _enfNodes.clear();
- _enfEdges.clear();
- _enfTriangles.clear();
- _nodeIDToSizeMap.clear();
- _enfMeshList.clear();
- _entryEnfMeshMap.clear();
- NotifySubMeshesHypothesisModification();
-}
-
-//================================================================================
-/*!
- * \brief At mesh loading, restore enforced elements by just loaded enforced meshes
- */
-//================================================================================
-
-void GHS3DPlugin_Hypothesis::RestoreEnfElemsByMeshes()
-{
- TGHS3DEnforcedMeshList::const_iterator it = _enfMeshList.begin();
- for(;it != _enfMeshList.end();++it) {
- TGHS3DEnforcedMesh* enfMesh = *it;
- if ( SMESH_Mesh* mesh = GetMeshByPersistentID( enfMesh->persistID ))
- SetEnforcedMesh( *mesh,
- enfMesh->elementType,
- enfMesh->name,
- enfMesh->entry,
- enfMesh->groupName );
- enfMesh->persistID = -1; // not to restore again
- }
-}
-
-//=======================================================================
-//function : SetGroupsToRemove
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis::ClearGroupsToRemove()
-{
- _groupsToRemove.clear();
-}
-
-
-//=======================================================================
-//function : DefaultMeshHoles
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::DefaultMeshHoles()
-{
- return false; // PAL19680
-}
-
-//=======================================================================
-//function : DefaultToMakeGroupsOfDomains
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::DefaultToMakeGroupsOfDomains()
-{
- return false; // issue 0022172
-}
-
-//=======================================================================
-//function : DefaultMaximumMemory
-//=======================================================================
-
-#ifndef WIN32
-#include <sys/sysinfo.h>
-#else
-#include <windows.h>
-#endif
-
-double GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
-{
-#ifndef WIN32
- struct sysinfo si;
- int err = sysinfo( &si );
- if ( err == 0 ) {
- int ramMB = si.totalram * si.mem_unit / 1024 / 1024;
- return ( 0.7 * ramMB );
- }
-#else
- // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
- MEMORYSTATUSEX statex;
- statex.dwLength = sizeof (statex);
- int err = GlobalMemoryStatusEx (&statex);
- if (err != 0) {
- int totMB =
- statex.ullTotalPhys / 1024 / 1024 +
- statex.ullTotalPageFile / 1024 / 1024 +
- statex.ullTotalVirtual / 1024 / 1024;
- return ( 0.7 * totMB );
- }
-#endif
- return 1024;
-}
-
-//=======================================================================
-//function : DefaultInitialMemory
-//=======================================================================
-
-double GHS3DPlugin_Hypothesis::DefaultInitialMemory()
-{
- return DefaultMaximumMemory();
-}
-
-//=======================================================================
-//function : DefaultOptimizationLevel
-//=======================================================================
-
-short GHS3DPlugin_Hypothesis::DefaultOptimizationLevel()
-{
- return Medium;
-}
-
-//=======================================================================
-//function : DefaultWorkingDirectory
-//=======================================================================
-
-std::string GHS3DPlugin_Hypothesis::DefaultWorkingDirectory()
-{
- TCollection_AsciiString aTmpDir;
-
- char *Tmp_dir = getenv("SALOME_TMP_DIR");
- if(Tmp_dir != NULL) {
- aTmpDir = Tmp_dir;
- }
- else {
-#ifdef WIN32
- aTmpDir = TCollection_AsciiString("C:\\");
-#else
- aTmpDir = TCollection_AsciiString("/tmp/");
-#endif
- }
- return aTmpDir.ToCString();
-}
-
-//=======================================================================
-//function : DefaultKeepFiles
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::DefaultKeepFiles()
-{
- return false;
-}
-
-//=======================================================================
-//function : DefaultRemoveLogOnSuccess
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::DefaultRemoveLogOnSuccess()
-{
- return false;
-}
-
-
-//=======================================================================
-//function : DefaultVerboseLevel
-//=======================================================================
-
-short GHS3DPlugin_Hypothesis::DefaultVerboseLevel()
-{
- return 10;
-}
-
-//=======================================================================
-//function : DefaultToCreateNewNodes
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::DefaultToCreateNewNodes()
-{
- return true;
-}
-
-//=======================================================================
-//function : DefaultToUseBoundaryRecoveryVersion
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::DefaultToUseBoundaryRecoveryVersion()
-{
- return false;
-}
-
-//=======================================================================
-//function : DefaultToUseFEMCorrection
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::DefaultToUseFEMCorrection()
-{
- return false;
-}
-
-//=======================================================================
-//function : DefaultToRemoveCentralPoint
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::DefaultToRemoveCentralPoint()
-{
- return false;
-}
-
-//=======================================================================
-//function : DefaultGradation
-//=======================================================================
-
-double GHS3DPlugin_Hypothesis::DefaultGradation()
-{
- return 1.05;
-}
-
-//=======================================================================
-//function : DefaultStandardOutputLog
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::DefaultStandardOutputLog()
-{
- return false;
-}
-
-// //=======================================================================
-// //function : DefaultID2SizeMap
-// //=======================================================================
-//
-// GHS3DPlugin_Hypothesis::TID2SizeMap GHS3DPlugin_Hypothesis::DefaultID2SizeMap()
-// {
-// return GHS3DPlugin_Hypothesis::TID2SizeMap();
-// }
-
-
-//=======================================================================
-//function : SaveTo
-//=======================================================================
-
-std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save)
-{
- save << (int) myToMeshHoles << " ";
- save << myMaximumMemory << " ";
- save << myInitialMemory << " ";
- save << myOptimizationLevel << " ";
- save << myWorkingDirectory << " ";
- save << (int)myKeepFiles << " ";
- save << myVerboseLevel << " ";
- save << (int)myToCreateNewNodes << " ";
- save << (int)myToUseBoundaryRecoveryVersion << " ";
- save << (int)myToUseFemCorrection << " ";
- save << (int)myToRemoveCentralPoint << " ";
- save << myGradation << " ";
- save << myToMakeGroupsOfDomains << " ";
- if (!myTextOption.empty()) {
- save << "__OPTIONS_BEGIN__ ";
- save << myTextOption << " ";
- save << "__OPTIONS_END__ ";
- }
-
-
- TGHS3DEnforcedVertexList::iterator it = _enfVertexList.begin();
- if (it != _enfVertexList.end()) {
- save << " " << "__ENFORCED_VERTICES_BEGIN__ ";
- for ( ; it != _enfVertexList.end(); ++it ) {
- TGHS3DEnforcedVertex *enfVertex = (*it);
- save << " " << "__BEGIN_VERTEX__";
- if (!enfVertex->name.empty()) {
- save << " " << "__BEGIN_NAME__";
- save << " " << enfVertex->name;
- save << " " << "__END_NAME__";
- }
- if (!enfVertex->geomEntry.empty()) {
- save << " " << "__BEGIN_ENTRY__";
- save << " " << enfVertex->geomEntry;
- save << " " << enfVertex->isCompound;
- save << " " << "__END_ENTRY__";
- }
- if (!enfVertex->groupName.empty()) {
- save << " " << "__BEGIN_GROUP__";
- save << " " << enfVertex->groupName;
- save << " " << "__END_GROUP__";
- }
- if (enfVertex->coords.size()) {
- save << " " << "__BEGIN_COORDS__";
- for (int i=0;i<enfVertex->coords.size();i++)
- save << " " << enfVertex->coords[i];
- save << " " << "__END_COORDS__";
- }
- save << " " << "__BEGIN_SIZE__";
- save << " " << enfVertex->size;
- save << " " << "__END_SIZE__";
- save << " " << "__END_VERTEX__";
- }
- save << " " << "__ENFORCED_VERTICES_END__ ";
- }
-
- TGHS3DEnforcedMeshList::iterator it_mesh = _enfMeshList.begin();
- if (it_mesh != _enfMeshList.end()) {
- save << " " << "__ENFORCED_MESHES_BEGIN__ ";
- for ( ; it_mesh != _enfMeshList.end(); ++it_mesh ) {
- TGHS3DEnforcedMesh *enfMesh = (*it_mesh);
- save << " " << "__BEGIN_ENF_MESH__";
-
- save << " " << "__BEGIN_NAME__";
- save << " " << enfMesh->name;
- save << " " << "__END_NAME__";
-
- save << " " << "__BEGIN_ENTRY__";
- save << " " << enfMesh->entry;
- save << " " << "__END_ENTRY__";
-
- save << " " << "__BEGIN_ELEM_TYPE__";
- save << " " << (int)enfMesh->elementType;
- save << " " << "__END_ELEM_TYPE__";
-
- if (!enfMesh->groupName.empty()) {
- save << " " << "__BEGIN_GROUP__";
- save << " " << enfMesh->groupName;
- save << " " << "__END_GROUP__";
- }
- save << " " << "__PERSIST_ID__";
- save << " " << enfMesh->persistID;
- save << " " << "__END_ENF_MESH__";
- std::cout << "Saving of enforced mesh " << enfMesh->name.c_str() << " done" << std::endl;
- }
- save << " " << "__ENFORCED_MESHES_END__ ";
- }
- return save;
-}
-
-//=======================================================================
-//function : LoadFrom
-//=======================================================================
-
-std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load)
-{
- bool isOK = true;
- int i;
- double d;
-
- isOK = (load >> i);
- if (isOK)
- myToMeshHoles = i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> d);
- if (isOK)
- myMaximumMemory = d;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> d);
- if (isOK)
- myInitialMemory = d;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myOptimizationLevel = i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> myWorkingDirectory);
- if (isOK) {
- if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty
- myKeepFiles = false;
- myWorkingDirectory.clear();
- }
- else if ( myWorkingDirectory == "1" ) {
- myKeepFiles = true;
- myWorkingDirectory.clear();
- }
- }
- else
- load.clear(ios::badbit | load.rdstate());
-
- if ( !myWorkingDirectory.empty() ) {
- isOK = (load >> i);
- if (isOK)
- myKeepFiles = i;
- else
- load.clear(ios::badbit | load.rdstate());
- }
-
- isOK = (load >> i);
- if (isOK)
- myVerboseLevel = (short) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myToCreateNewNodes = (bool) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myToUseBoundaryRecoveryVersion = (bool) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myToUseFemCorrection = (bool) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myToRemoveCentralPoint = (bool) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> d);
- if (isOK)
- myGradation = d;
- else
- load.clear(ios::badbit | load.rdstate());
-
- std::string separator;
- bool hasOptions = false;
- bool hasEnforcedVertices = false;
- bool hasEnforcedMeshes = false;
- isOK = (load >> separator);
-
- if ( isOK && ( separator == "0" || separator == "1" ))
- {
- myToMakeGroupsOfDomains = ( separator == "1" );
- isOK = (load >> separator);
- }
-
- if (isOK) {
- if (separator == "__OPTIONS_BEGIN__")
- hasOptions = true;
- else if (separator == "__ENFORCED_VERTICES_BEGIN__")
- hasEnforcedVertices = true;
- else if (separator == "__ENFORCED_MESHES_BEGIN__")
- hasEnforcedMeshes = true;
- }
-
- if (hasOptions) {
- std::string txt;
- while (isOK) {
- isOK = (load >> txt);
- if (isOK) {
- if (txt == "__OPTIONS_END__") {
- if (!myTextOption.empty()) {
- // Remove last space
- myTextOption.erase(myTextOption.end()-1);
- }
- isOK = false;
- break;
- }
- myTextOption += txt;
- myTextOption += " ";
- }
- }
- }
-
- if (hasOptions) {
- isOK = (load >> separator);
- if (isOK && separator == "__ENFORCED_VERTICES_BEGIN__")
- hasEnforcedVertices = true;
- if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
- hasEnforcedMeshes = true;
- }
-
- if (hasEnforcedVertices) {
- std::string txt, name, entry, groupName;
- double size, coords[3];
- bool isCompound;
- bool hasCoords = false;
- isOK = (load >> txt); // __BEGIN_VERTEX__
- while (isOK) {
- if (txt == "__ENFORCED_VERTICES_END__")
- isOK = false;
-
- TGHS3DEnforcedVertex *enfVertex = new TGHS3DEnforcedVertex();
- while (isOK) {
- isOK = (load >> txt);
- if (txt == "__END_VERTEX__") {
- enfVertex->name = name;
- enfVertex->geomEntry = entry;
- enfVertex->isCompound = isCompound;
- enfVertex->groupName = groupName;
- enfVertex->coords.clear();
- if (hasCoords)
- enfVertex->coords.assign(coords,coords+3);
-
- _enfVertexList.insert(enfVertex);
-
- if (enfVertex->coords.size())
- _coordsEnfVertexMap[enfVertex->coords] = enfVertex;
- if (!enfVertex->geomEntry.empty())
- _geomEntryEnfVertexMap[enfVertex->geomEntry] = enfVertex;
-
- name.clear();
- entry.clear();
- groupName.clear();
- hasCoords = false;
- isOK = false;
- }
-
- if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
- while (isOK && (txt != "__END_NAME__")) {
- isOK = (load >> txt);
- if (txt != "__END_NAME__") {
- if (!name.empty())
- name += " ";
- name += txt;
- }
- }
- MESSAGE("name: " <<name);
- }
-
- if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
- isOK = (load >> entry);
- isOK = (load >> isCompound);
- isOK = (load >> txt); // __END_ENTRY__
- if (txt != "__END_ENTRY__")
- throw std::exception();
- MESSAGE("entry: " << entry);
- }
-
- if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
- while (isOK && (txt != "__END_GROUP__")) {
- isOK = (load >> txt);
- if (txt != "__END_GROUP__") {
- if (!groupName.empty())
- groupName += " ";
- groupName += txt;
- }
- }
- MESSAGE("groupName: " << groupName);
- }
-
- if (txt == "__BEGIN_COORDS__") { // __BEGIN_COORDS__
- hasCoords = true;
- isOK = (load >> coords[0] >> coords[1] >> coords[2]);
- isOK = (load >> txt); // __END_COORDS__
- if (txt != "__END_COORDS__")
- throw std::exception();
- MESSAGE("coords: " << coords[0] <<","<< coords[1] <<","<< coords[2]);
- }
-
- if (txt == "__BEGIN_SIZE__") { // __BEGIN_ENTRY__
- isOK = (load >> size);
- isOK = (load >> txt); // __END_ENTRY__
- if (txt != "__END_SIZE__") {
- throw std::exception();
- }
- MESSAGE("size: " << size);
- }
- }
- isOK = (load >> txt); // __BEGIN_VERTEX__
- }
- }
-
- if (hasEnforcedVertices) {
- isOK = (load >> separator);
- if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
- hasEnforcedMeshes = true;
- }
-
- if (hasEnforcedMeshes) {
- std::string txt, name, entry, groupName;
- int elementType = -1, persistID = -1;
- isOK = (load >> txt); // __BEGIN_ENF_MESH__
- while (isOK) {
- // if (isOK) {
- if (txt == "__ENFORCED_MESHES_END__")
- isOK = false;
-
- TGHS3DEnforcedMesh *enfMesh = new TGHS3DEnforcedMesh();
- while (isOK) {
- isOK = (load >> txt);
- if (txt == "__END_ENF_MESH__") {
- enfMesh->name = name;
- enfMesh->entry = entry;
- enfMesh->elementType = (SMESH::ElementType)elementType;
- enfMesh->groupName = groupName;
- enfMesh->persistID = persistID;
-
- _enfMeshList.insert(enfMesh);
- std::cout << "Restoring of enforced mesh " <<name << " done" << std::endl;
-
- name.clear();
- entry.clear();
- elementType = -1;
- groupName.clear();
- persistID = -1;
- isOK = false;
- }
-
- if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
- while (isOK && (txt != "__END_NAME__")) {
- isOK = (load >> txt);
- if (txt != "__END_NAME__") {
- if (!name.empty())
- name += " ";
- name += txt;
- }
- }
- MESSAGE("name: " <<name);
- }
-
- if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
- isOK = (load >> entry);
- isOK = (load >> txt); // __END_ENTRY__
- if (txt != "__END_ENTRY__")
- throw std::exception();
- MESSAGE("entry: " << entry);
- }
-
- if (txt == "__BEGIN_ELEM_TYPE__") { // __BEGIN_ELEM_TYPE__
- isOK = (load >> elementType);
- isOK = (load >> txt); // __END_ELEM_TYPE__
- if (txt != "__END_ELEM_TYPE__")
- throw std::exception();
- MESSAGE("elementType: " << elementType);
- }
-
- if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
- while (isOK && (txt != "__END_GROUP__")) {
- isOK = (load >> txt);
- if (txt != "__END_GROUP__") {
- if (!groupName.empty())
- groupName += " ";
- groupName += txt;
- }
- } // while
- MESSAGE("groupName: " << groupName);
- } // if
-
- if (txt == "__PERSIST_ID__") {
- isOK = (load >> persistID);
- MESSAGE("persistID: " << persistID);
- }
- std::cout << "isOK: " << isOK << std::endl;
- } // while
- // } // if
- isOK = (load >> txt); // __BEGIN_ENF_MESH__
- } // while
- } // if
-
- return load;
-}
-
-//=======================================================================
-//function : SetParametersByMesh
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* ,const TopoDS_Shape&)
-{
- return false;
-}
-
-
-//================================================================================
-/*!
- * \brief Sets myToMakeGroupsOfDomains depending on whether theMesh is on shape or not
- */
-//================================================================================
-
-bool GHS3DPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& dflts,
- const SMESH_Mesh* /*theMesh*/)
-{
- myToMakeGroupsOfDomains = ( !dflts._shape || dflts._shape->IsNull() );
- return true;
-}
-
-//================================================================================
-/*!
- * \brief Return command to run ghs3d mesher excluding file prefix (-f)
- */
-//================================================================================
-
-std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
- const bool hasShapeToMesh)
-{
- TCollection_AsciiString cmd = GetExeName().c_str();
- // check if any option is overridden by hyp->myTextOption
- bool m = hyp ? ( hyp->myTextOption.find("-m") == std::string::npos ) : true;
- bool M = hyp ? ( hyp->myTextOption.find("-M") == std::string::npos ) : true;
- bool c = hyp ? ( hyp->myTextOption.find("-c") == std::string::npos ) : true;
- bool o = hyp ? ( hyp->myTextOption.find("-o") == std::string::npos ) : true;
- bool p0 = hyp ? ( hyp->myTextOption.find("-p0") == std::string::npos ) : true;
- bool C = hyp ? ( hyp->myTextOption.find("-C") == std::string::npos ) : true;
- bool v = hyp ? ( hyp->myTextOption.find("-v") == std::string::npos ) : true;
- bool fem = hyp ? ( hyp->myTextOption.find("-FEM")== std::string::npos ) : true;
- bool rem = hyp ? ( hyp->myTextOption.find("-no_initial_central_point")== std::string::npos ) : true;
- bool gra = hyp ? ( hyp->myTextOption.find("-Dcpropa")== std::string::npos ) : true;
-
- // if use boundary recovery version, few options are allowed
- bool useBndRecovery = !C;
- if ( !useBndRecovery && hyp )
- useBndRecovery = hyp->myToUseBoundaryRecoveryVersion;
-
- // ghs3d needs to know amount of memory it may use (MB).
- // Default memory is defined at ghs3d installation but it may be not enough,
- // so allow to use about all available memory
- if ( m ) {
- double aMaximumMemory = hyp ? hyp->myMaximumMemory : -1;
- cmd += " -m ";
- if ( aMaximumMemory < 0 )
- cmd += DefaultMaximumMemory();
- else
- cmd += aMaximumMemory;
- }
- if ( M && !useBndRecovery ) {
- double aInitialMemory = hyp ? hyp->myInitialMemory : -1;
- cmd += " -M ";
- if ( aInitialMemory > 0 )
- cmd += aInitialMemory;
- else
- cmd += "100";
- }
- // component to mesh
- // 0 , all components to be meshed
- // 1 , only the main ( outermost ) component to be meshed
- if ( c && !useBndRecovery ) {
- // We always run GHS3D with "to mesh holes'==TRUE (see PAL19680)
- if ( hasShapeToMesh )
- cmd += " -c 0";
- else {
- bool aToMeshHoles = hyp ? hyp->myToMeshHoles : DefaultMeshHoles();
- if ( aToMeshHoles )
- cmd += " -c 0";
- else
- cmd += " -c 1";
- }
- }
-
- // optimization level
- if ( o && hyp && !useBndRecovery ) {
- if ( hyp->myOptimizationLevel >= 0 && hyp->myOptimizationLevel < 5 ) {
- const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
- cmd += " -o ";
- cmd += level[ hyp->myOptimizationLevel ];
- }
- }
-
- // to create internal nodes
- if ( p0 && hyp && !hyp->myToCreateNewNodes ) {
- cmd += " -p0";
- }
-
- // verbose mode
- if ( v && hyp ) {
- cmd += " -v ";
- cmd += hyp->myVerboseLevel;
- }
-
- // boundary recovery version
- if ( useBndRecovery ) {
- cmd += " -C";
- }
-
- // to use FEM correction
- if ( fem && hyp && hyp->myToUseFemCorrection) {
- cmd += " -FEM";
- }
-
- // to remove initial central point.
- if ( rem && hyp && hyp->myToRemoveCentralPoint) {
- cmd += " -no_initial_central_point";
- }
-
- // options as text
- if ( hyp && !hyp->myTextOption.empty() ) {
- cmd += " ";
- cmd += (char*) hyp->myTextOption.c_str();
- }
-
- // to define volumic gradation.
- if ( gra && hyp) {
- cmd += " -Dcpropa=";
- cmd += hyp->myGradation;
- }
-
-#ifdef WIN32
- cmd += " < NUL";
-#endif
-
- return cmd.ToCString();
-}
-
-//================================================================================
-/*!
- * \brief Return a unique file name
- */
-//================================================================================
-
-std::string GHS3DPlugin_Hypothesis::GetFileName(const GHS3DPlugin_Hypothesis* hyp)
-{
- std::string aTmpDir = hyp ? hyp->GetWorkingDirectory() : DefaultWorkingDirectory();
- const char lastChar = *aTmpDir.rbegin();
-#ifdef WIN32
- if(lastChar != '\\') aTmpDir+='\\';
-#else
- if(lastChar != '/') aTmpDir+='/';
-#endif
-
- TCollection_AsciiString aGenericName = (char*)aTmpDir.c_str();
- aGenericName += "GHS3D_";
- aGenericName += getpid();
- aGenericName += "_";
- aGenericName += Abs((Standard_Integer)(long) aGenericName.ToCString());
-
- return aGenericName.ToCString();
-}
-
-//================================================================================
-/*
- * Return the name of executable
- */
-//================================================================================
-
-std::string GHS3DPlugin_Hypothesis::GetExeName()
-{
- return "mg-tetra.exe";
-}
-
-//================================================================================
-/*!
-* \brief Return the enforced vertices
-*/
-//================================================================================
-
-GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList GHS3DPlugin_Hypothesis::GetEnforcedVertices(const GHS3DPlugin_Hypothesis* hyp)
-{
- return hyp ? hyp->_GetEnforcedVertices():DefaultGHS3DEnforcedVertexList();
-}
-
-GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues GHS3DPlugin_Hypothesis::GetEnforcedVerticesCoordsSize (const GHS3DPlugin_Hypothesis* hyp)
-{
- return hyp ? hyp->_GetEnforcedVerticesCoordsSize(): DefaultGHS3DEnforcedVertexCoordsValues();
-}
-
-GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexEntryValues GHS3DPlugin_Hypothesis::GetEnforcedVerticesEntrySize (const GHS3DPlugin_Hypothesis* hyp)
-{
- return hyp ? hyp->_GetEnforcedVerticesEntrySize(): DefaultGHS3DEnforcedVertexEntryValues();
-}
-
-GHS3DPlugin_Hypothesis::TCoordsGHS3DEnforcedVertexMap GHS3DPlugin_Hypothesis::GetEnforcedVerticesByCoords (const GHS3DPlugin_Hypothesis* hyp)
-{
- return hyp ? hyp->_GetEnforcedVerticesByCoords(): DefaultCoordsGHS3DEnforcedVertexMap();
-}
-
-GHS3DPlugin_Hypothesis::TGeomEntryGHS3DEnforcedVertexMap GHS3DPlugin_Hypothesis::GetEnforcedVerticesByEntry (const GHS3DPlugin_Hypothesis* hyp)
-{
- return hyp ? hyp->_GetEnforcedVerticesByEntry(): DefaultGeomEntryGHS3DEnforcedVertexMap();
-}
-
-GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap GHS3DPlugin_Hypothesis::GetEnforcedNodes(const GHS3DPlugin_Hypothesis* hyp)
-{
- return hyp ? hyp->_GetEnforcedNodes():DefaultIDSortedNodeGroupMap();
-}
-
-GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap GHS3DPlugin_Hypothesis::GetEnforcedEdges(const GHS3DPlugin_Hypothesis* hyp)
-{
- return hyp ? hyp->_GetEnforcedEdges():DefaultIDSortedElemGroupMap();
-}
-
-GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap GHS3DPlugin_Hypothesis::GetEnforcedTriangles(const GHS3DPlugin_Hypothesis* hyp)
-{
- return hyp ? hyp->_GetEnforcedTriangles():DefaultIDSortedElemGroupMap();
-}
-
-GHS3DPlugin_Hypothesis::TID2SizeMap GHS3DPlugin_Hypothesis::GetNodeIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp)
-{
- return hyp ? hyp->_GetNodeIDToSizeMap(): DefaultID2SizeMap();
-}
-
-GHS3DPlugin_Hypothesis::TSetStrings GHS3DPlugin_Hypothesis::GetGroupsToRemove(const GHS3DPlugin_Hypothesis* hyp)
-{
- return hyp ? hyp->_GetGroupsToRemove(): DefaultGroupsToRemove();
-}
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// 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
-//
-
-// GHS3DPlugin : C++ implementation
-// File : GHS3DPlugin_Hypothesis.hxx
-// Created : Wed Apr 2 12:21:17 2008
-// Author : Edward AGAPOV (eap)
-//
-#ifndef GHS3DPlugin_Hypothesis_HeaderFile
-#define GHS3DPlugin_Hypothesis_HeaderFile
-
-#include "GHS3DPlugin_Defs.hxx"
-
-#include <SMDS_MeshNode.hxx>
-
-#include "SMESH_Hypothesis.hxx"
-#include "SMESH_Mesh_i.hxx"
-#include "SMESH_Gen_i.hxx"
-#include "SMESH_TypeDefs.hxx"
-#include "utilities.h"
-
-#include <stdexcept>
-#include <map>
-#include <vector>
-#include <cstdio>
-
-class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis: public SMESH_Hypothesis
-{
-public:
-
- GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
-
- typedef std::map<std::vector<double>,double> TGHS3DEnforcedVertexCoordsValues;
- typedef std::map<std::string,double> TGHS3DEnforcedVertexEntryValues;
-
- struct TGHS3DEnforcedVertex {
- std::string name;
- std::string geomEntry;
- bool isCompound;
- std::vector<double> coords;
- std::string groupName;
- double size;
- };
-
- struct CompareGHS3DEnforcedVertex {
- bool operator () (const TGHS3DEnforcedVertex* e1, const TGHS3DEnforcedVertex* e2) const {
- if (e1 && e2) {
- if (e1->coords.size() && e2->coords.size())
- return (e1->coords < e2->coords);
- else
- return (e1->geomEntry < e2->geomEntry);
- }
- return false;
- }
- };
- typedef std::set< TGHS3DEnforcedVertex*, CompareGHS3DEnforcedVertex > TGHS3DEnforcedVertexList;
- // Map Coords / Enforced node
- typedef std::map< std::vector<double>, TGHS3DEnforcedVertex* > TCoordsGHS3DEnforcedVertexMap;
- // Map geom entry / Enforced node
- typedef std::map< std::string, TGHS3DEnforcedVertex* > TGeomEntryGHS3DEnforcedVertexMap;
- // Map groupName / Enforced node
- typedef std::map< std::string, TGHS3DEnforcedVertexList > TGroupNameGHS3DEnforcedVertexMap;
-
- ////////////////////
- // Enforced meshes
- ////////////////////
-
- struct TGHS3DEnforcedMesh {
- int persistID;
- std::string name;
- std::string entry;
- std::string groupName;
- SMESH::ElementType elementType;
- };
-
- struct CompareGHS3DEnforcedMesh {
- bool operator () (const TGHS3DEnforcedMesh* e1, const TGHS3DEnforcedMesh* e2) const {
- if (e1 && e2) {
- if (e1->entry == e2->entry)
- return (e1->elementType < e2->elementType);
- else
- return (e1->entry < e2->entry);
- }
- else
- return false;
- }
- };
- typedef std::set< TGHS3DEnforcedMesh*, CompareGHS3DEnforcedMesh > TGHS3DEnforcedMeshList;
- // Map mesh entry / Enforced mesh list
- // ex: 0:1:2:1 -> [ ("Mesh_1", "0:1:2:1", TopAbs_NODE, ""),
- // ("Mesh_1", "0:1:2:1", TopAbs_EDGE, "edge group")]
- typedef std::map< std::string, TGHS3DEnforcedMeshList > TEntryGHS3DEnforcedMeshListMap;
-
- typedef std::map<int,double> TID2SizeMap;
-
- struct TIDMeshIDCompare {
- bool operator () (const SMDS_MeshElement* e1, const SMDS_MeshElement* e2) const
- { return e1->getMeshId() == e2->getMeshId() ? e1->GetID() < e2->GetID() : e1->getMeshId() < e2->getMeshId() ; }
- };
-
- typedef std::map<const SMDS_MeshElement*, std::string, TIDMeshIDCompare > TIDSortedElemGroupMap;
- typedef std::map<const SMDS_MeshNode*, std::string, TIDMeshIDCompare > TIDSortedNodeGroupMap;
- typedef std::set<std::string> TSetStrings;
-
- static const char* GetHypType() { return "GHS3D_Parameters"; }
- /*!
- * To mesh "holes" in a solid or not. Default is to mesh.
- */
- void SetToMeshHoles(bool toMesh);
- bool GetToMeshHoles(bool checkFreeOption = false) const;
- /*!
- * To make groups of volumes of different domains when mesh is generated from skin.
- * Default is to make groups.
- * This option works only (1) for the mesh w/o shape and (2) if GetToMeshHoles() == true
- */
- void SetToMakeGroupsOfDomains(bool toMakeGroups);
- bool GetToMakeGroupsOfDomains() const;
- /*!
- * Maximal size of memory to be used by the algorithm (in Megabytes)
- */
- void SetMaximumMemory(double MB);
- double GetMaximumMemory() const;
- /*!
- * Initial size of memory to be used by the algorithm (in Megabytes) in
- * automatic memory adjustment mode. Default is zero
- */
- void SetInitialMemory(double MB);
- double GetInitialMemory() const;
- /*!
- * Optimization level: 0-none, 1-light, 2-medium, 3-standard+, 4-strong. Default is medium
- */
- enum OptimizationLevel { None = 0, Light, Medium, StandardPlus, Strong };
- void SetOptimizationLevel(OptimizationLevel level);
- OptimizationLevel GetOptimizationLevel() const;
- /*!
- * Path to working directory
- */
- void SetWorkingDirectory(const std::string& path);
- std::string GetWorkingDirectory() const;
- /*!
- * To keep working files or remove them. Log file remains in case of errors anyway.
- */
- void SetKeepFiles(bool toKeep);
- bool GetKeepFiles() const;
- /*!
- * Verbose level [0-10]
- * 0 - no standard output,
- * 2 - prints the data, quality statistics of the skin and final meshes and
- * indicates when the final mesh is being saved. In addition the software
- * gives indication regarding the CPU time.
- * 10 - same as 2 plus the main steps in the computation, quality statistics
- * histogram of the skin mesh, quality statistics histogram together with
- * the characteristics of the final mesh.
- */
- void SetVerboseLevel(short level);
- short GetVerboseLevel() const;
- /*!
- * To create new nodes
- */
- void SetToCreateNewNodes(bool toCreate);
- bool GetToCreateNewNodes() const;
- /*!
- * To use boundary recovery version which tries to create mesh on a very poor
- * quality surface mesh
- */
- void SetToUseBoundaryRecoveryVersion(bool toUse);
- bool GetToUseBoundaryRecoveryVersion() const;
- /*!
- * Applies finite-element correction by replacing overconstrained elements where
- * it is possible. The process is cutting first the overconstrained edges and
- * second the overconstrained facets. This insure that no edges have two boundary
- * vertices and that no facets have three boundary vertices.
- */
- void SetFEMCorrection(bool toUseFem);
- bool GetFEMCorrection() const;
- /*!
- * To removes initial central point.
- */
- void SetToRemoveCentralPoint(bool toRemove);
- bool GetToRemoveCentralPoint() const;
- /*!
- * To set hiden/undocumented/advanced options
- */
- void SetTextOption(const std::string& option);
- std::string GetTextOption() const;
- /*!
- * To define the volumic gradation
- */
- void SetGradation(double gradation);
- double GetGradation() const ;
- /*!
- * Print log in standard output
- */
- void SetStandardOutputLog(bool logInStandardOutput);
- bool GetStandardOutputLog() const ;
- /*!
- * Remove log file on success
- */
- void SetRemoveLogOnSuccess(bool removeLogOnSuccess);
- bool GetRemoveLogOnSuccess() const ;
-
-
-// struct TEnforcedEdge {
-// long ID;
-// long node1;
-// long node2;
-// std::string groupName;
-// };
-
-
- /*!
- * \brief Return command to run ghs3d mesher excluding file prefix (-f)
- */
- static std::string CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
- const bool hasShapeToMesh=true);
- /*!
- * \brief Return a unique file name
- */
- static std::string GetFileName(const GHS3DPlugin_Hypothesis* hyp);
- /*!
- * \brief Return the name of executable
- */
- static std::string GetExeName();
-
- /*!
- * To set an enforced vertex
- */
- bool SetEnforcedVertex(std::string aName, std::string anEntry, std::string aGroupName,
- double size, double x=0.0, double y=0.0, double z=0.0, bool isCompound = false);
- TGHS3DEnforcedVertex* GetEnforcedVertex(double x, double y, double z) throw (std::invalid_argument);
- TGHS3DEnforcedVertex* GetEnforcedVertex(const std::string anEntry) throw (std::invalid_argument);
- bool RemoveEnforcedVertex(double x=0.0, double y=0.0, double z=0.0, const std::string anEntry="" ) throw (std::invalid_argument);
- const TGHS3DEnforcedVertexCoordsValues _GetEnforcedVerticesCoordsSize() const {return _enfVertexCoordsSizeList; }
- const TGHS3DEnforcedVertexEntryValues _GetEnforcedVerticesEntrySize() const {return _enfVertexEntrySizeList; }
- const TGHS3DEnforcedVertexList _GetEnforcedVertices() const { return _enfVertexList; }
- const TCoordsGHS3DEnforcedVertexMap _GetEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
- const TGeomEntryGHS3DEnforcedVertexMap _GetEnforcedVerticesByEntry() const { return _geomEntryEnfVertexMap; }
- void ClearEnforcedVertices();
-
- /*!
- * To set enforced elements
- */
- bool SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName = "");
- bool SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName = "");
- bool SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName = "");
- const TGHS3DEnforcedMeshList _GetEnforcedMeshes() const { return _enfMeshList; }
- const TEntryGHS3DEnforcedMeshListMap _GetEnforcedMeshesByEntry() const { return _entryEnfMeshMap; }
- void ClearEnforcedMeshes();
- const TIDSortedNodeGroupMap _GetEnforcedNodes() const { return _enfNodes; }
- const TIDSortedElemGroupMap _GetEnforcedEdges() const { return _enfEdges; }
- const TIDSortedElemGroupMap _GetEnforcedTriangles() const { return _enfTriangles; }
- const TID2SizeMap _GetNodeIDToSizeMap() const {return _nodeIDToSizeMap; }
- const TSetStrings _GetGroupsToRemove() const {return _groupsToRemove; }
- void RestoreEnfElemsByMeshes(); // persistence
- /*!
- * \brief Return the enforced vertices
- */
- static TGHS3DEnforcedVertexList GetEnforcedVertices(const GHS3DPlugin_Hypothesis* hyp);
- static TGHS3DEnforcedVertexCoordsValues GetEnforcedVerticesCoordsSize(const GHS3DPlugin_Hypothesis* hyp);
- static TGHS3DEnforcedVertexEntryValues GetEnforcedVerticesEntrySize(const GHS3DPlugin_Hypothesis* hyp);
- static TCoordsGHS3DEnforcedVertexMap GetEnforcedVerticesByCoords(const GHS3DPlugin_Hypothesis* hyp);
- static TGeomEntryGHS3DEnforcedVertexMap GetEnforcedVerticesByEntry(const GHS3DPlugin_Hypothesis* hyp);
-
- static TGHS3DEnforcedMeshList GetEnforcedMeshes(const GHS3DPlugin_Hypothesis* hyp);
- static TEntryGHS3DEnforcedMeshListMap GetEnforcedMeshesByEntry(const GHS3DPlugin_Hypothesis* hyp);
- static TIDSortedNodeGroupMap GetEnforcedNodes(const GHS3DPlugin_Hypothesis* hyp);
- static TIDSortedElemGroupMap GetEnforcedEdges(const GHS3DPlugin_Hypothesis* hyp);
- static TIDSortedElemGroupMap GetEnforcedTriangles(const GHS3DPlugin_Hypothesis* hyp);
- static TID2SizeMap GetNodeIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp);
- static TSetStrings GetGroupsToRemove(const GHS3DPlugin_Hypothesis* hyp);
- static bool GetToMakeGroupsOfDomains(const GHS3DPlugin_Hypothesis* hyp);
- void ClearGroupsToRemove();
-
- static bool DefaultMeshHoles();
- static bool DefaultToMakeGroupsOfDomains();
- static double DefaultMaximumMemory();
- static double DefaultInitialMemory();
- static short DefaultOptimizationLevel();
- static std::string DefaultWorkingDirectory();
- static bool DefaultKeepFiles();
- static short DefaultVerboseLevel();
- static bool DefaultToCreateNewNodes();
- static bool DefaultToUseBoundaryRecoveryVersion();
- static bool DefaultToUseFEMCorrection();
- static bool DefaultToRemoveCentralPoint();
- static bool DefaultStandardOutputLog();
- static bool DefaultRemoveLogOnSuccess();
- static double DefaultGradation();
-
- static TGHS3DEnforcedVertex DefaultGHS3DEnforcedVertex() {return TGHS3DEnforcedVertex();}
- static TGHS3DEnforcedVertexList DefaultGHS3DEnforcedVertexList() {return TGHS3DEnforcedVertexList();}
- static TGHS3DEnforcedVertexCoordsValues DefaultGHS3DEnforcedVertexCoordsValues() {return TGHS3DEnforcedVertexCoordsValues();}
- static TGHS3DEnforcedVertexEntryValues DefaultGHS3DEnforcedVertexEntryValues() {return TGHS3DEnforcedVertexEntryValues();}
- static TCoordsGHS3DEnforcedVertexMap DefaultCoordsGHS3DEnforcedVertexMap() {return TCoordsGHS3DEnforcedVertexMap();}
- static TGeomEntryGHS3DEnforcedVertexMap DefaultGeomEntryGHS3DEnforcedVertexMap() {return TGeomEntryGHS3DEnforcedVertexMap();}
- static TGroupNameGHS3DEnforcedVertexMap DefaultGroupNameGHS3DEnforcedVertexMap() {return TGroupNameGHS3DEnforcedVertexMap();}
-
- static TGHS3DEnforcedMesh DefaultGHS3DEnforcedMesh() {return TGHS3DEnforcedMesh();}
- static TGHS3DEnforcedMeshList DefaultGHS3DEnforcedMeshList() {return TGHS3DEnforcedMeshList();}
- static TEntryGHS3DEnforcedMeshListMap DefaultEntryGHS3DEnforcedMeshListMap() {return TEntryGHS3DEnforcedMeshListMap();}
- static TIDSortedNodeGroupMap DefaultIDSortedNodeGroupMap() {return TIDSortedNodeGroupMap();}
- static TIDSortedElemGroupMap DefaultIDSortedElemGroupMap() {return TIDSortedElemGroupMap();}
- static TID2SizeMap DefaultID2SizeMap() {return TID2SizeMap();}
- static TSetStrings DefaultGroupsToRemove() {return TSetStrings();}
-
- // Persistence
- virtual std::ostream & SaveTo(std::ostream & save);
- virtual std::istream & LoadFrom(std::istream & load);
- friend GHS3DPLUGIN_EXPORT std::ostream & operator <<(std::ostream & save, GHS3DPlugin_Hypothesis & hyp);
- friend GHS3DPLUGIN_EXPORT std::istream & operator >>(std::istream & load, GHS3DPlugin_Hypothesis & hyp);
-
- /*!
- * \brief Does nothing
- */
- virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
-
- /*!
- * \brief Sets myToMakeGroupsOfDomains depending on whether theMesh is on shape or not
- */
- virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
-
-private:
-
- bool myToMeshHoles;
- bool myToMakeGroupsOfDomains;
- double myMaximumMemory;
- double myInitialMemory;
- short myOptimizationLevel;
- bool myKeepFiles;
- std::string myWorkingDirectory;
- short myVerboseLevel;
- bool myToCreateNewNodes;
- bool myToUseBoundaryRecoveryVersion;
- bool myToUseFemCorrection;
- bool myToRemoveCentralPoint;
- bool myLogInStandardOutput;
- bool myRemoveLogOnSuccess;
- std::string myTextOption;
- double myGradation;
-
- TGHS3DEnforcedVertexList _enfVertexList;
- TGHS3DEnforcedVertexCoordsValues _enfVertexCoordsSizeList;
- TGHS3DEnforcedVertexEntryValues _enfVertexEntrySizeList;
- // map to get "manual" enf vertex (through the coordinates)
- TCoordsGHS3DEnforcedVertexMap _coordsEnfVertexMap;
- // map to get "geom" enf vertex (through the geom entries)
- TGeomEntryGHS3DEnforcedVertexMap _geomEntryEnfVertexMap;
-
-
- TGHS3DEnforcedMeshList _enfMeshList;
- // map to get enf meshes through the entries
- TEntryGHS3DEnforcedMeshListMap _entryEnfMeshMap;
- TIDSortedNodeGroupMap _enfNodes;
- TIDSortedElemGroupMap _enfEdges;
- TIDSortedElemGroupMap _enfTriangles;
- TID2SizeMap _nodeIDToSizeMap;
- std::map<std::string, TIDSortedElemSet > _entryToElemsMap;
-
- TSetStrings _groupsToRemove;
-};
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File : GHS3DPlugin_Hypothesis_i.cxx
-// Created : Wed Apr 2 13:53:01 2008
-// Author : Edward AGAPOV (eap)
-//
-#include "GHS3DPlugin_Hypothesis_i.hxx"
-
-#include "SMESH_Gen.hxx"
-#include "SMESH_PythonDump.hxx"
-//#include "SMESH_Mesh.hxx"
-//#include "SMESH_ProxyMesh.hxx"
-//#include <StdMeshers_QuadToTriaAdaptor.hxx>
-
-#include "Utils_CorbaException.hxx"
-#include "utilities.h"
-#include "SMESH_Mesh_i.hxx"
-#include "SMESH_Group_i.hxx"
-#include "SMESH_Gen_i.hxx"
-#include "SMESH_TypeDefs.hxx"
-#include "SMESHDS_GroupBase.hxx"
-
-// SALOME KERNEL includes
-#include "SALOMEDSClient.hxx"
-#include <SALOMEDSClient_definitions.hxx>
-// // IDL headers
-// #include <SALOMEconfig.h>
-// #include CORBA_SERVER_HEADER(SALOMEDS)
-
-//=======================================================================
-//function : GHS3DPlugin_Hypothesis_i
-//=======================================================================
-
-GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
- int theStudyId,
- ::SMESH_Gen* theGenImpl)
- : SALOME::GenericObj_i( thePOA ),
- SMESH_Hypothesis_i( thePOA )
-{
- MESSAGE( "GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i" );
- myBaseImpl = new ::GHS3DPlugin_Hypothesis (theGenImpl->GetANewId(),
- theStudyId,
- theGenImpl);
-}
-
-//=======================================================================
-//function : ~GHS3DPlugin_Hypothesis_i
-//=======================================================================
-
-GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i()
-{
- MESSAGE( "GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i" );
-}
-
-//=======================================================================
-//function : SetToMeshHoles
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
-{
- ASSERT(myBaseImpl);
- this->GetImpl()->SetToMeshHoles(toMesh);
- SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
-}
-
-//=======================================================================
-//function : GetToMeshHoles
-//=======================================================================
-
-CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMeshHoles()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetToMeshHoles();
-}
-
-//=======================================================================
-//function : SetToMakeGroupsOfDomains
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups)
-{
- ASSERT(myBaseImpl);
- this->GetImpl()->SetToMakeGroupsOfDomains(toMakeGroups);
- SMESH::TPythonDump() << _this() << ".SetToMakeGroupsOfDomains( " << toMakeGroups << " )";
-}
-
-//=======================================================================
-//function : GetToMakeGroupsOfDomains
-//=======================================================================
-
-CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetToMakeGroupsOfDomains();
-}
-
-//=======================================================================
-//function : SetMaximumMemory
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Double MB)
- throw ( SALOME::SALOME_Exception )
-{
- if ( MB == 0 )
- THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
- ASSERT(myBaseImpl);
- this->GetImpl()->SetMaximumMemory(MB);
- SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
-}
-
-//=======================================================================
-//function : GetMaximumMemory
-//=======================================================================
-
-CORBA::Double GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetMaximumMemory();
-}
-
-//=======================================================================
-//function : SetInitialMemory
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Double MB)
- throw ( SALOME::SALOME_Exception )
-{
- if ( MB == 0 )
- THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
- ASSERT(myBaseImpl);
- this->GetImpl()->SetInitialMemory(MB);
- SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
-}
-
-//=======================================================================
-//function : GetInitialMemory
-//=======================================================================
-
-CORBA::Double GHS3DPlugin_Hypothesis_i::GetInitialMemory()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetInitialMemory();
-}
-
-//=======================================================================
-//function : SetOptimizationLevel
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
- throw ( SALOME::SALOME_Exception )
-{
- ::GHS3DPlugin_Hypothesis::OptimizationLevel l =
- (::GHS3DPlugin_Hypothesis::OptimizationLevel) level;
- if ( l < ::GHS3DPlugin_Hypothesis::None ||
- l > ::GHS3DPlugin_Hypothesis::Strong )
- THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
-
- ASSERT(myBaseImpl);
- this->GetImpl()->SetOptimizationLevel(l);
- SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
-}
-
-//=======================================================================
-//function : GetOptimizationLevel
-//=======================================================================
-
-CORBA::Short GHS3DPlugin_Hypothesis_i::GetOptimizationLevel()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetOptimizationLevel();
-}
-
-//=======================================================================
-//function : SetWorkingDirectory
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
-{
- if (!path )
- THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
-
- string file(path);
- const char lastChar = *file.rbegin();
-#ifdef WIN32
- if ( lastChar != '\\' ) file += '\\';
-#else
- if ( lastChar != '/' ) file += '/';
-#endif
- file += "GHS3D.log";
- SMESH_Mesh_i::PrepareForWriting (file.c_str());
-
- ASSERT(myBaseImpl);
- this->GetImpl()->SetWorkingDirectory(path);
- SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
-}
-
-//=======================================================================
-//function : GetWorkingDirectory
-//=======================================================================
-
-char* GHS3DPlugin_Hypothesis_i::GetWorkingDirectory()
-{
- ASSERT(myBaseImpl);
- return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
-}
-
-//=======================================================================
-//function : SetKeepFiles
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
-{
- ASSERT(myBaseImpl);
- this->GetImpl()->SetKeepFiles(toKeep);
- SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
-}
-
-//=======================================================================
-//function : GetKeepFiles
-//=======================================================================
-
-CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetKeepFiles()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetKeepFiles();
-}
-
-//=======================================================================
-//function : SetVerboseLevel
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
- throw ( SALOME::SALOME_Exception )
-{
- if (level < 0 || level > 10 )
- THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
- SALOME::BAD_PARAM );
- ASSERT(myBaseImpl);
- this->GetImpl()->SetVerboseLevel(level);
- SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
-}
-
-//=======================================================================
-//function : GetVerboseLevel
-//=======================================================================
-
-CORBA::Short GHS3DPlugin_Hypothesis_i::GetVerboseLevel()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetVerboseLevel();
-}
-
-//=======================================================================
-//function : SetToCreateNewNodes
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
-{
- ASSERT(myBaseImpl);
- this->GetImpl()->SetToCreateNewNodes(toCreate);
- SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
-}
-
-//=======================================================================
-//function : GetToCreateNewNodes
-//=======================================================================
-
-CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToCreateNewNodes()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetToCreateNewNodes();
-}
-
-//=======================================================================
-//function : SetToUseBoundaryRecoveryVersion
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
-{
- ASSERT(myBaseImpl);
- this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
- SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
-}
-
-//=======================================================================
-//function : GetToUseBoundaryRecoveryVersion
-//=======================================================================
-
-CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
-}
-
-//=======================================================================
-//function : SetFEMCorrection
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem)
-{
- ASSERT(myBaseImpl);
- this->GetImpl()->SetFEMCorrection(toUseFem);
- SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )";
-}
-
-//=======================================================================
-//function : GetFEMCorrection
-//=======================================================================
-
-CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetFEMCorrection()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetFEMCorrection();
-}
-
-//=======================================================================
-//function : SetToRemoveCentralPoint
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove)
-{
- ASSERT(myBaseImpl);
- this->GetImpl()->SetToRemoveCentralPoint(toRemove);
- SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )";
-}
-
-//=======================================================================
-//function : GetToRemoveCentralPoint
-//=======================================================================
-
-CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToRemoveCentralPoint()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetToRemoveCentralPoint();
-}
-
-//=======================================================================
-//function : SetTextOption
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetTextOption(const char* option)
-{
- ASSERT(myBaseImpl);
- this->GetImpl()->SetTextOption(option);
- SMESH::TPythonDump() << _this() << ".SetTextOption( '" << option << "' )";
-}
-
-//=======================================================================
-//function : GetTextOption
-//=======================================================================
-
-char* GHS3DPlugin_Hypothesis_i::GetTextOption()
-{
- ASSERT(myBaseImpl);
- return CORBA::string_dup( this->GetImpl()->GetTextOption().c_str() );
-}
-
-//=======================================================================
-//function : SetToRemoveCentralPoint
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
-{
- if (gradation <= 1)
- THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
- ASSERT(myBaseImpl);
- if (gradation != GetGradation()) {
- this->GetImpl()->SetGradation(gradation);
- SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
- }
-}
-
-//=======================================================================
-//function : GetToRemoveCentralPoint
-//=======================================================================
-
-CORBA::Double GHS3DPlugin_Hypothesis_i::GetGradation()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetGradation();
-}
-
-//=======================================================================
-//function : SetStandardOutputLog
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetStandardOutputLog(CORBA::Boolean logInStandardOutput)
-{
- ASSERT(myBaseImpl);
- this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
- SMESH::TPythonDump() << _this() << ".SetPrintLogInFile( " << !logInStandardOutput << " )";
-}
-
-//=======================================================================
-//function : GetStandardOutputLog
-//=======================================================================
-
-CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetStandardOutputLog()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetStandardOutputLog();
-}
-
-//=======================================================================
-//function : SetRemoveLogOnSuccess
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess)
-{
- ASSERT(myBaseImpl);
- this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
- SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
-}
-
-//=======================================================================
-//function : GetRemoveLogOnSuccess
-//=======================================================================
-
-CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
-{
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetRemoveLogOnSuccess();
-}
-
-//=======================================================================
-//function : SetEnforcedVertex
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
- throw (SALOME::SALOME_Exception) {
- ASSERT(myBaseImpl);
- MESSAGE("IDL : SetEnforcedVertex( "<< x << ", " << y << ", " << z << ", " << size << ")");
- return p_SetEnforcedVertex(size, x, y, z);
-}
-
-bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
- throw (SALOME::SALOME_Exception) {
- ASSERT(myBaseImpl);
- MESSAGE("IDL : SetEnforcedVertexNamed( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ")");
- return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
-}
-
-bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
- throw (SALOME::SALOME_Exception) {
- ASSERT(myBaseImpl);
- MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theGroupName << ")");
- return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
-}
-
-bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
- throw (SALOME::SALOME_Exception) {
- ASSERT(myBaseImpl);
- MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ", " << theGroupName << ")");
- return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
-}
-
-bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
- throw (SALOME::SALOME_Exception) {
- ASSERT(myBaseImpl);
-
- if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
- THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
- }
-
- string theVertexEntry = theVertex->GetStudyEntry();
- CORBA::Double x = 0, y = 0, z = 0;
- CORBA::Boolean isCompound = false;
- GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
- if (theVertexEntry.empty()) {
- string aName;
- if (theVertex->GetShapeType() == GEOM::VERTEX) {
- aName = "Vertex_";
- }
- if (theVertex->GetShapeType() == GEOM::COMPOUND) {
- aName = "Compound_";
- isCompound = true;
- }
- aName += theVertex->GetEntry();
- SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
- if (!theSVertex->_is_nil())
- theVertexEntry = theSVertex->GetID();
- }
- if (theVertexEntry.empty())
- THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
-
- if (theVertex->GetShapeType() == GEOM::VERTEX) {
- GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
- if (CORBA::is_nil(measureOp))
- return false;
-
- measureOp->PointCoordinates (theVertex, x, y, z);
- MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
- }
-
- string theVertexName = theVertex->GetName();
- MESSAGE("IDL : SetEnforcedVertexGeom( "<< theVertexEntry << ", " << size<< ")");
-
- return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
-}
-
-bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
- throw (SALOME::SALOME_Exception) {
- ASSERT(myBaseImpl);
-
- if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
- THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
- }
-
- string theVertexEntry = theVertex->GetStudyEntry();
- CORBA::Double x = 0, y = 0, z = 0;
- CORBA::Boolean isCompound = false;
- GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
- if (theVertexEntry.empty()) {
- string aName;
- if (theVertex->GetShapeType() == GEOM::VERTEX) {
- aName = "Vertex_";
- }
- if (theVertex->GetShapeType() == GEOM::COMPOUND) {
- aName = "Compound_";
- isCompound = true;
- }
- aName += theVertex->GetEntry();
- SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
- if (!theSVertex->_is_nil())
- theVertexEntry = theSVertex->GetID();
- }
- if (theVertexEntry.empty())
- THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
-
- if (theVertex->GetShapeType() == GEOM::VERTEX) {
- GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
- if (CORBA::is_nil(measureOp))
- return false;
-
- measureOp->PointCoordinates (theVertex, x, y, z);
- MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
- }
-
- string theVertexName = theVertex->GetName();
- MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theVertexEntry << ", " << size<< ", " << theGroupName << ")");
-
- return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
-}
-
-bool GHS3DPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
- const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
- CORBA::Boolean isCompound)
- throw (SALOME::SALOME_Exception) {
- ASSERT(myBaseImpl);
- MESSAGE("IDL : p_SetEnforcedVertex(" << size << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\", " << isCompound<< ")");
- bool newValue = false;
-
- ::GHS3DPlugin_Hypothesis::TCoordsGHS3DEnforcedVertexMap coordsList;
- ::GHS3DPlugin_Hypothesis::TGeomEntryGHS3DEnforcedVertexMap enfVertexEntryList;
- if (string(theVertexEntry).empty()) {
- coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
- std::vector<double> coords;
- coords.push_back(x);
- coords.push_back(y);
- coords.push_back(z);
- if (coordsList.find(coords) == coordsList.end()) {
- MESSAGE("Coords not found: add it in coordsList");
- newValue = true;
- }
- else {
- MESSAGE("Coords already found, compare names");
- ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
- if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
- MESSAGE("The names or size are different: update");
-// this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
- newValue = true;
- }
- else {
- MESSAGE("The names and size are identical");
- }
- }
-
- if (newValue) {
- if (string(theVertexName).empty()) {
- if (string(theGroupName).empty())
- SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
- else
- SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
- }
- else {
- if (string(theGroupName).empty())
- SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\")";
- else
- SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
- }
- }
- }
- else {
-// if (isCompound || (!isCompound && !string(theVertexEntry).empty())) {
- enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
-// ::BLSURFPlugin_Hypothesis::TGeomEntryGHS3DEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
- if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
- MESSAGE("Geom entry not found: add it in enfVertexEntryList");
- newValue = true;
- }
- else {
- MESSAGE("Geom entry already found, compare names");
- ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
- if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
- MESSAGE("The names or size are different: update");
-// this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
- newValue = true;
- }
- else {
- MESSAGE("The names and size are identical");
- }
- }
-
- if (newValue) {
- if (string(theGroupName).empty())
- SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
- else
- SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
- }
- }
-
- if (newValue)
- this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
-
- MESSAGE("IDL : SetEnforcedVertexEntry END");
- return newValue;
-}
-
-//=======================================================================
-//function : GetEnforcedVertex
-//=======================================================================
-
-CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
- throw (SALOME::SALOME_Exception)
-{
- ASSERT(myBaseImpl);
- try {
- bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
- SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
- return isDone;
- }
- catch (const std::invalid_argument& ex) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = ex.what();
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 513;
- throw SALOME::SALOME_Exception(ExDescription);
- }
- catch (SALOME_Exception& ex) {
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
-}
-
-//=======================================================================
-//function : GetEnforcedVertex
-//=======================================================================
-
-CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
- throw (SALOME::SALOME_Exception)
-{
- ASSERT(myBaseImpl);
-
- if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
- THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
- }
-
- string theVertexEntry = theVertex->GetStudyEntry();
- if (theVertexEntry.empty()) {
- GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
- string aName;
- if (theVertex->GetShapeType() == GEOM::VERTEX)
- aName = "Vertex_";
- if (theVertex->GetShapeType() == GEOM::COMPOUND)
- aName = "Compound_";
- aName += theVertex->GetEntry();
- SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
- if (!theSVertex->_is_nil())
- theVertexEntry = theSVertex->GetID();
- }
- if (theVertexEntry.empty())
- THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
-
- string theVertexName = theVertex->GetName();
-
- try {
- bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
- SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
- return isDone;
- }
- catch (const std::invalid_argument& ex) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = ex.what();
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 538;
- throw SALOME::SALOME_Exception(ExDescription);
- }
- catch (SALOME_Exception& ex) {
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
-}
-
-//=======================================================================
-//function : GetEnforcedVertices
-//=======================================================================
-
-GHS3DPlugin::GHS3DEnforcedVertexList* GHS3DPlugin_Hypothesis_i::GetEnforcedVertices()
-{
- ASSERT(myBaseImpl);
- GHS3DPlugin::GHS3DEnforcedVertexList_var result = new GHS3DPlugin::GHS3DEnforcedVertexList();
-
- const ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
- result->length( enfVertexList.size() );
-
- ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList::const_iterator it = enfVertexList.begin();
-
- for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
- ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* currentVertex = (*it);
- GHS3DPlugin::GHS3DEnforcedVertex_var enfVertex = new GHS3DPlugin::GHS3DEnforcedVertex();
- // Name
- enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
- // Geom Vertex Entry
- enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
- // Coords
- GHS3DPlugin::TCoords_var coords = new GHS3DPlugin::TCoords();
- coords->length(currentVertex->coords.size());
- for (int ind = 0; ind < currentVertex->coords.size(); ind++)
- coords[ind] = currentVertex->coords[ind];
- enfVertex->coords = coords;
- // Group Name
- enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
- // Size
- enfVertex->size = currentVertex->size;
- // isCompound
- enfVertex->isCompound = currentVertex->isCompound;
-
- result[i]=enfVertex;
- }
-
-// SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
-
- return result._retn();
-}
-
-//=======================================================================
-//function : RemoveEnforcedVertex
-//=======================================================================
-
-bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
- throw (SALOME::SALOME_Exception)
-{
- ASSERT(myBaseImpl);
- try {
- bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
- SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
- return res;
- }
- catch (const std::invalid_argument& ex) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = ex.what();
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 625;
- throw SALOME::SALOME_Exception(ExDescription);
- }
- catch (SALOME_Exception& ex) {
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
-}
-
-bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
- throw (SALOME::SALOME_Exception)
-{
- ASSERT(myBaseImpl);
-
- if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
- THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
- }
-
- string theVertexEntry = theVertex->GetStudyEntry();
- if (theVertexEntry.empty()) {
- GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
- string aName;
- if (theVertex->GetShapeType() == GEOM::VERTEX)
- aName = "Vertex_";
- if (theVertex->GetShapeType() == GEOM::COMPOUND)
- aName = "Compound_";
- aName += theVertex->GetEntry();
- SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
- if (!theSVertex->_is_nil())
- theVertexEntry = theSVertex->GetID();
- }
- if (theVertexEntry.empty())
- THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
-
- try {
- bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
- SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
- return res;
- }
- catch (const std::invalid_argument& ex) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = ex.what();
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 648;
- throw SALOME::SALOME_Exception(ExDescription);
- }
- catch (SALOME_Exception& ex) {
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
-}
-
-//=======================================================================
-//function : ClearEnforcedVertices
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::ClearEnforcedVertices()
-{
- ASSERT(myBaseImpl);
- this->GetImpl()->ClearEnforcedVertices();
- SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
-}
-
-//=======================================================================
-//function : ClearEnforcedMeshes
-//=======================================================================
-
-void GHS3DPlugin_Hypothesis_i::ClearEnforcedMeshes()
-{
- ASSERT(myBaseImpl);
- this->GetImpl()->ClearEnforcedMeshes();
- SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
-}
-
-//=======================================================================
-//function : GetEnforcedMeshes
-//=======================================================================
-
-GHS3DPlugin::GHS3DEnforcedMeshList* GHS3DPlugin_Hypothesis_i::GetEnforcedMeshes()
-{
- ASSERT(myBaseImpl);
- GHS3DPlugin::GHS3DEnforcedMeshList_var result = new GHS3DPlugin::GHS3DEnforcedMeshList();
-
- const ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
- result->length( enfMeshList.size() );
-
- ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList::const_iterator it = enfMeshList.begin();
-
- for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
- ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMesh* currentMesh = (*it);
- GHS3DPlugin::GHS3DEnforcedMesh_var enfMesh = new GHS3DPlugin::GHS3DEnforcedMesh();
- // Name
- enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
- // Mesh Entry
- enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
- // isCompound
- enfMesh->elementType = currentMesh->elementType;
- // Group Name
- enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
-
- result[i]=enfMesh;
- }
-
-// SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
-
- return result._retn();
-}
-
-/*!
- * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
- */
-bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
- throw (SALOME::SALOME_Exception)
-{
-// #if GHS3D_VERSION >= 42
- return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
-// #else
-// SALOME::ExceptionStruct ExDescription;
-// ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
-// ExDescription.type = SALOME::BAD_PARAM;
-// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-// ExDescription.lineNumber = 719;
-// throw SALOME::SALOME_Exception(ExDescription);
-// #endif
-}
-
-/*!
- * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
- */
-bool GHS3DPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
- throw (SALOME::SALOME_Exception)
-{
-// MESSAGE("GHS3DPlugin_Hypothesis_i::SetEnforcedMesh");
-// #if GHS3D_VERSION >= 42
- return p_SetEnforcedMesh(theSource, theType);
-// #else
-// SALOME::ExceptionStruct ExDescription;
-// ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
-// ExDescription.type = SALOME::BAD_PARAM;
-// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-// ExDescription.lineNumber = 750;
-// throw SALOME::SALOME_Exception(ExDescription);
-// #endif
-}
-
-/*!
- * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size. The elements will be grouped in theGroupName.
- */
-bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
- throw (SALOME::SALOME_Exception)
-{
-// #if GHS3D_VERSION >= 42
- return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
-// #else
-// SALOME::ExceptionStruct ExDescription;
-// ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
-// ExDescription.type = SALOME::BAD_PARAM;
-// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-// ExDescription.lineNumber = 750;
-// throw SALOME::SALOME_Exception(ExDescription);
-// #endif
-}
-
-/*!
- * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
- */
-bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
- throw (SALOME::SALOME_Exception)
-{
-// #if GHS3D_VERSION >= 42
- return p_SetEnforcedMesh(theSource, theType);
-// #else
-// SALOME::ExceptionStruct ExDescription;
-// ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
-// ExDescription.type = SALOME::BAD_PARAM;
-// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-// ExDescription.lineNumber = 750;
-// throw SALOME::SALOME_Exception(ExDescription);
-// #endif
-}
-
-bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
- throw (SALOME::SALOME_Exception)
-{
- MESSAGE("GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh");
- ASSERT(myBaseImpl);
-
- if (CORBA::is_nil( theSource ))
- {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = "The source mesh CORBA object is NULL";
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 840;
- throw SALOME::SALOME_Exception(ExDescription);
- }
-
- switch (theType) {
- case SMESH::NODE:
- MESSAGE("Required type is NODE");
- break;
- case SMESH::EDGE:
- MESSAGE("Required type is EDGE");
- break;
- case SMESH::FACE:
- MESSAGE("Required type is FACE");
- break;
- default:
- MESSAGE("Incompatible required type: " << theType);
- return false;
- }
-// MESSAGE("Required type is "<<theType);
- SMESH::array_of_ElementType_var types = theSource->GetTypes();
- MESSAGE("Available types:");
- for (int i=0;i<types->length();i++){MESSAGE(types[i]);}
- if ( types->length() >= 1 && types[types->length()-1] < theType)
- {
- MESSAGE("Required type not available");
- return false;
-// SALOME::ExceptionStruct ExDescription;
-// ExDescription.text = "The source mesh has bad type";
-// ExDescription.type = SALOME::BAD_PARAM;
-// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-// ExDescription.lineNumber = 840;
-// throw SALOME::SALOME_Exception(ExDescription);
- }
-
-
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
-
- SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
- SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
- SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-
- string enfMeshName = theName;
- if (enfMeshName.empty())
- enfMeshName = SObj->GetName();
-
- if (theMesh_i)
- {
- try {
- bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
- if (theGroupName != "") {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
- << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
- }
- else {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
- << theSource << ".GetMesh(), " << theType << " )";
- }
-
- return res;
- }
- catch (const std::invalid_argument& ex) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = ex.what();
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 840;
- throw SALOME::SALOME_Exception(ExDescription);
- }
- catch (SALOME_Exception& ex) {
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
- }
- else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
- {
- MESSAGE("The source is a group")
- try {
- bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
- if (theGroupName != "") {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
- << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
- }
- else {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
- << theSource << ", " << theType << " )";
- }
- return res;
- }
- catch (const std::invalid_argument& ex) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = ex.what();
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 840;
- throw SALOME::SALOME_Exception(ExDescription);
- }
- catch (SALOME_Exception& ex) {
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
- }
- else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
- {
- MESSAGE("The source is a group on geom")
- try {
- bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
- if (theGroupName != "") {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
- << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
- }
- else {
- SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
- << theSource << ", " << theType << " )";
- }
- return res;
- }
- catch (const std::invalid_argument& ex) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = ex.what();
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 840;
- throw SALOME::SALOME_Exception(ExDescription);
- }
- catch (SALOME_Exception& ex) {
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
- }
- return false;
-}
-//=============================================================================
-/*!
- * Get implementation
- */
-//=============================================================================
-
-::GHS3DPlugin_Hypothesis* GHS3DPlugin_Hypothesis_i::GetImpl()
-{
- return (::GHS3DPlugin_Hypothesis*)myBaseImpl;
-}
-
-//================================================================================
-/*!
- * \brief Verify whether hypothesis supports given entity type
- */
-//================================================================================
-
-CORBA::Boolean GHS3DPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
-{
- return type == SMESH::DIM_3D;
-}
-
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// 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
-//
-
-// GHS3DPlugin : C++ implementation
-// File : GHS3DPlugin_Hypothesis_i.hxx
-// Date : 03/04/2006
-// Project : SALOME
-//
-#ifndef _GHS3DPlugin_Hypothesis_i_HXX_
-#define _GHS3DPlugin_Hypothesis_i_HXX_
-
-#include "GHS3DPlugin_Defs.hxx"
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(GHS3DPlugin_Algorithm)
-
-#include "SMESH_Hypothesis_i.hxx"
-#include "SMESH_Mesh_i.hxx"
-#include "GHS3DPlugin_Hypothesis.hxx"
-
-class SMESH_Gen;
-
-// GHS3DPlugin parameters hypothesis
-
-class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i:
- public virtual POA_GHS3DPlugin::GHS3DPlugin_Hypothesis,
- public virtual SMESH_Hypothesis_i
-{
- public:
- // Constructor
- GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
- int theStudyId,
- ::SMESH_Gen* theGenImpl);
- // Destructor
- virtual ~GHS3DPlugin_Hypothesis_i();
-
- /*!
- * To mesh "holes" in a solid or not. Default is to mesh.
- */
- void SetToMeshHoles(CORBA::Boolean toMesh);
- CORBA::Boolean GetToMeshHoles();
- /*!
- * To make groups of volumes of different domains when mesh is generated from skin.
- * Default is to make groups.
- * This option works only (1) for the mesh w/o shape and (2) if GetToMeshHoles() == true
- */
- void SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups);
- CORBA::Boolean GetToMakeGroupsOfDomains();
- /*!
- * Maximal size of memory to be used by the algorithm (in Megabytes)
- */
- void SetMaximumMemory(CORBA::Double MB) throw ( SALOME::SALOME_Exception );
- CORBA::Double GetMaximumMemory();
- /*!
- * Initial size of memory to be used by the algorithm (in Megabytes) in
- * automatic memory adjustment mode. Default is zero
- */
- void SetInitialMemory(CORBA::Double MB) throw ( SALOME::SALOME_Exception );
- CORBA::Double GetInitialMemory();
- /*!
- * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium
- */
- void SetOptimizationLevel(CORBA::Short level) throw ( SALOME::SALOME_Exception );
- CORBA::Short GetOptimizationLevel();
- /*!
- * Path to working directory
- */
- void SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception );
- char* GetWorkingDirectory();
- /*!
- * To keep working files or remove them. Log file remains in case of errors anyway.
- */
- void SetKeepFiles(CORBA::Boolean toKeep);
- CORBA::Boolean GetKeepFiles();
- /*!
- * Verbose level [0-10]
- * 0 - no standard output,
- * 2 - prints the data, quality statistics of the skin and final meshes and
- * indicates when the final mesh is being saved. In addition the software
- * gives indication regarding the CPU time.
- * 10 - same as 2 plus the main steps in the computation, quality statistics
- * histogram of the skin mesh, quality statistics histogram together with
- * the characteristics of the final mesh.
- */
- void SetVerboseLevel(CORBA::Short level) throw ( SALOME::SALOME_Exception );
- CORBA::Short GetVerboseLevel();
- /*!
- * To create new nodes
- */
- void SetToCreateNewNodes(CORBA::Boolean toCreate);
- CORBA::Boolean GetToCreateNewNodes();
- /*!
- * To use boundary recovery version which tries to create mesh on a very poor
- * quality surface mesh
- */
- void SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse);
- CORBA::Boolean GetToUseBoundaryRecoveryVersion();
- /*!
- * Applies finite-element correction by replacing overconstrained elements where
- * it is possible. The process is cutting first the overconstrained edges and
- * second the overconstrained facets. This insure that no edges have two boundary
- * vertices and that no facets have three boundary vertices.
- */
- void SetFEMCorrection(CORBA::Boolean toUseFem);
- CORBA::Boolean GetFEMCorrection();
- /*!
- * To removes initial central point.
- */
- void SetToRemoveCentralPoint(CORBA::Boolean toRemove);
- CORBA::Boolean GetToRemoveCentralPoint();
- /*!
- * To set hiden/undocumented/advanced options
- */
- void SetTextOption(const char* option);
- char* GetTextOption();
- /*!
- * To define the volumic gradation
- */
- void SetGradation(CORBA::Double gradation);
- CORBA::Double GetGradation();
- /*!
- * Print log in standard output
- */
- void SetStandardOutputLog(CORBA::Boolean logInStandardOutput);
- CORBA::Boolean GetStandardOutputLog();
- /*!
- * Remove log file on success
- */
- void SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess);
- CORBA::Boolean GetRemoveLogOnSuccess();
- /*!
- * To set an enforced vertex
- */
- bool p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x = 0, CORBA::Double y = 0, CORBA::Double z = 0,
- const char* theVertexName = "", const char* theVertexEntry = "", const char* theGroupName = "",
- CORBA::Boolean isCompound = false)
- throw (SALOME::SALOME_Exception);
- bool SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size) throw (SALOME::SALOME_Exception);
- bool SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName) throw (SALOME::SALOME_Exception);
- bool SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName) throw (SALOME::SALOME_Exception);
- bool SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName) throw (SALOME::SALOME_Exception);
- bool SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size) throw (SALOME::SALOME_Exception);
- bool SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName) throw (SALOME::SALOME_Exception);
- CORBA::Double GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception);
- CORBA::Double GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex) throw (SALOME::SALOME_Exception);
- bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception);
- bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex) throw (SALOME::SALOME_Exception);
- GHS3DPlugin::GHS3DEnforcedVertexList* GetEnforcedVertices();
- void ClearEnforcedVertices();
- /*!
- * To set an enforced mesh
- */
- bool p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theName="", const char* theGroupName="") throw (SALOME::SALOME_Exception);
- bool SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType) throw (SALOME::SALOME_Exception);
- bool SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theGroupName) throw (SALOME::SALOME_Exception);
-
- /* OBSOLETE FUNCTIONS */
- bool SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size) throw (SALOME::SALOME_Exception);
- bool SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size, const char* theGroupName) throw (SALOME::SALOME_Exception);
- /* OBSOLETE FUNCTIONS */
-
- GHS3DPlugin::GHS3DEnforcedMeshList* GetEnforcedMeshes();
- void ClearEnforcedMeshes();
-
- // Get implementation
- ::GHS3DPlugin_Hypothesis* GetImpl();
-
- // Verify whether hypothesis supports given entity type
- CORBA::Boolean IsDimSupported( SMESH::Dimension type );
-
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// 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 GHS3DPlugin : implementaion of SMESH idl descriptions
-// File : GHS3DPlugin.cxx
-// Author : Julia DOROVSKIKH
-// Module : SMESH
-// $Header$
-//
-#include "SMESH_Hypothesis_i.hxx"
-
-#include "utilities.h"
-
-#include "GHS3DPlugin_GHS3D_i.hxx"
-#include "GHS3DPlugin_Hypothesis_i.hxx"
-
-template <class T> class GHS3DPlugin_Creator_i:public HypothesisCreator_i<T>
-{
- // as we have 'module GHS3DPlugin' in GHS3DPlugin_Algorithm.idl
- virtual std::string GetModuleName() { return "GHS3DPlugin"; }
-};
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-extern "C"
-{
- GHS3DPLUGIN_EXPORT GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName);
-
- GHS3DPLUGIN_EXPORT
- GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName)
- {
- MESSAGE("GetHypothesisCreator " << aHypName);
-
- GenericHypothesisCreator_i* aCreator = 0;
-
- // Hypotheses
-
- // Algorithm
- if (strcmp(aHypName, "GHS3D_3D") == 0)
- aCreator = new GHS3DPlugin_Creator_i<GHS3DPlugin_GHS3D_i>;
- // Hypothesis
- else if (strcmp(aHypName, "GHS3D_Parameters") == 0)
- aCreator = new GHS3DPlugin_Creator_i<GHS3DPlugin_Hypothesis_i>;
- else ;
-
- return aCreator;
- }
-}
+++ /dev/null
-# Copyright (C) 2007-2013 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.
-#
-# 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
-#
-
-##
-# @package GHS3DPluginBuilder
-# Python API for the GHS3D meshing plug-in module.
-
+++ /dev/null
-// Copyright (C) 2007-2013 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// ---
-// File : GHS3DPluginGUI.cxx
-// Authors : Gilles DAVID (Euriware)
-// ---
-//
-#include "GHS3DPluginGUI_HypothesisCreator.h"
-
-//=============================================================================
-/*! GetHypothesisCreator
- *
- */
-//=============================================================================
-extern "C"
-{
- GHS3DPLUGINGUI_EXPORT
- SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& aHypType )
- {
- SMESHGUI_GenericHypothesisCreator* aCreator = NULL;
- if ( aHypType == "GHS3D_Parameters" )
- aCreator = new GHS3DPluginGUI_HypothesisCreator( aHypType );
- return aCreator;
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2013 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// ---
-// File : GHS3DPluginGUI_Dlg.cxx
-// Authors : Renaud NEDELEC (OCC)
-// ---
-//
-
-#include "GHS3DPluginGUI_Dlg.h"
-
-#include <QFileDialog>
-
-#include <iostream>
-
-
-//////////////////////////////////////////
-// GHS3DPluginGUI_AdvWidget
-//////////////////////////////////////////
-
-GHS3DPluginGUI_AdvWidget::GHS3DPluginGUI_AdvWidget( QWidget* parent, Qt::WindowFlags f )
-: QWidget( parent, f )
-{
- setupUi( this );
-}
-
-GHS3DPluginGUI_AdvWidget::~GHS3DPluginGUI_AdvWidget()
-{
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>GHS3DPluginGUI_AdvWidget_QTD</class>
- <widget class="QWidget" name="GHS3DPluginGUI_AdvWidget_QTD">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>465</width>
- <height>477</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QGroupBox" name="memoryGroupBox">
- <property name="title">
- <string>Memory settings</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="3" column="4">
- <widget class="QLabel" name="maxMemoryLabel">
- <property name="text">
- <string>MB</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QCheckBox" name="initialMemoryCheck">
- <property name="text">
- <string>Initial memory size</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QCheckBox" name="maxMemoryCheck">
- <property name="text">
- <string>Max memory size</string>
- </property>
- </widget>
- </item>
- <item row="0" column="4">
- <widget class="QLabel" name="initialMemoryLabel">
- <property name="text">
- <string>MB</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2" colspan="2">
- <widget class="SMESHGUI_SpinBox" name="initialMemorySpin">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="3" column="2" colspan="2">
- <widget class="SMESHGUI_SpinBox" name="maxMemorySpin">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="logGroupBox">
- <property name="title">
- <string>Logs and debug</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="workingDirectoryLabel">
- <property name="text">
- <string>Working directory</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="workingDirectoryLineEdit"/>
- </item>
- <item row="0" column="2">
- <widget class="QPushButton" name="workingDirectoryPushButton">
- <property name="text">
- <string>PushButton</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="verboseLevelLabel">
- <property name="text">
- <string>Verbose level</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="verboseLevelSpin"/>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QCheckBox" name="logInFileCheck">
- <property name="text">
- <string>Print log in a file</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="removeLogOnSuccessCheck">
- <property name="text">
- <string>Remove log file on success</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="0">
- <widget class="QCheckBox" name="keepWorkingFilesCheck">
- <property name="text">
- <string>Keep working files</string>
- </property>
- <property name="autoExclusive">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="advancedMeshingGroupBox">
- <property name="title">
- <string>Advanced meshing options</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="7" column="1">
- <widget class="QLineEdit" name="textOptionLineEdit"/>
- </item>
- <item row="6" column="0">
- <widget class="QLabel" name="gradationLabel">
- <property name="text">
- <string>Volumic gradation</string>
- </property>
- </widget>
- </item>
- <item row="7" column="0">
- <widget class="QLabel" name="textOptionLabel">
- <property name="text">
- <string>Option as text</string>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="SMESHGUI_SpinBox" name="gradationSpinBox"/>
- </item>
- <item row="0" column="0">
- <widget class="QCheckBox" name="createNewNodesCheck">
- <property name="text">
- <string>Create new nodes</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="removeInitialCentralPointCheck">
- <property name="text">
- <string>Remove initial central point</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QCheckBox" name="FEMCorrectionCheck">
- <property name="text">
- <string>Use FEM correction</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="boundaryRecoveryCheck">
- <property name="text">
- <string>Use boundary recovery version</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>SMESHGUI_SpinBox</class>
- <extends>QSpinBox</extends>
- <header>SMESHGUI_SpinBox.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
+++ /dev/null
-// Copyright (C) 2007-2013 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.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File : GHS3DPluginGUI_Dlg.h
-// Author : Renaud NEDELEC (OpenCascade)
-
-#ifndef GHS3DPLUGINGUI_H
-#define GHS3DPLUGINGUI_H
-
-//////////////////////////////////////////
-// GHS3DPluginGUI_AdvWidget
-//////////////////////////////////////////
-
-#include "ui_GHS3DPluginGUI_AdvWidget_QTD.h"
-#include "GHS3DPluginGUI_HypothesisCreator.h"
-
-class GHS3DPLUGINGUI_EXPORT GHS3DPluginGUI_AdvWidget : public QWidget,
- public Ui::GHS3DPluginGUI_AdvWidget_QTD
-{
- Q_OBJECT
-
-public:
- GHS3DPluginGUI_AdvWidget( QWidget* = 0, Qt::WindowFlags = 0 );
- ~GHS3DPluginGUI_AdvWidget();
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// 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
-//
-
-// GHS3DPlugin GUI: GUI for plugged-in mesher GHS3DPlugin
-// File : GHS3DPluginGUI_Enums.h
-// Author : Gilles DAVID (Euriware)
-// Module : GHS3DPlugin
-//
-#ifndef GHS3DPLUGINGUI_Enums_HeaderFile
-#define GHS3DPLUGINGUI_Enums_HeaderFile
-
-// tabs
-enum {
- STD_TAB = 0,
- ADV_TAB,
- ENF_VER_TAB,
- ENF_MESH_TAB
-};
-
-// Enforced vertices array columns
-enum {
- ENF_VER_NAME_COLUMN = 0,
- ENF_VER_X_COLUMN,
- ENF_VER_Y_COLUMN,
- ENF_VER_Z_COLUMN,
- ENF_VER_SIZE_COLUMN,
- ENF_VER_ENTRY_COLUMN,
- ENF_VER_COMPOUND_COLUMN,
- ENF_VER_GROUP_COLUMN,
- ENF_VER_NB_COLUMNS
-};
-
-// Enforced meshes array columns
-enum {
- ENF_MESH_NAME_COLUMN = 0,
- ENF_MESH_ENTRY_COLUMN,
- ENF_MESH_CONSTRAINT_COLUMN,
- ENF_MESH_GROUP_COLUMN,
- ENF_MESH_NB_COLUMNS
-};
-
-// Enforced vertices widget inputs
-enum {
- ENF_VER_WARNING = 0,
- ENF_VER_VERTEX = 0,
- ENF_VER_X_COORD,
- ENF_VER_Y_COORD,
- ENF_VER_Z_COORD,
- ENF_VER_SIZE,
- ENF_VER_GROUP,
- ENF_VER_BTN,
- ENF_VER_NB_LINES
-};
-
-// Enforced meshes widget inputs
-enum {
- ENF_MESH_WARNING = 0,
- ENF_MESH_MESH = 0,
- ENF_MESH_CONSTRAINT,
- ENF_MESH_GROUP,
- ENF_MESH_BTN,
- ENF_MESH_NB_LINES
-};
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// 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
-//
-
-// GHS3DPlugin GUI: GUI for plugged-in mesher GHS3DPlugin
-// File : GHS3DPluginGUI_HypothesisCreator.cxx
-// Author : Michael Zorin
-// Module : GHS3DPlugin
-//
-#include "GHS3DPluginGUI_HypothesisCreator.h"
-#include "GHS3DPluginGUI_Enums.h"
-#include "GHS3DPluginGUI_Dlg.h"
-
-#include <GeometryGUI.h>
-
-#include <SMESHGUI_Utils.h>
-#include <SMESHGUI_SpinBox.h>
-#include <SMESHGUI_HypothesesUtils.h>
-#include <SMESH_NumberFilter.hxx>
-#include <SMESH_TypeFilter.hxx>
-#include <StdMeshersGUI_ObjectReferenceParamWdg.h>
-
-#include <LightApp_SelectionMgr.h>
-#include <SUIT_Session.h>
-#include <SUIT_MessageBox.h>
-#include <SUIT_ResourceMgr.h>
-#include <SUIT_FileDlg.h>
-#include <SalomeApp_Tools.h>
-#include <SalomeApp_TypeFilter.h>
-
-#include <TopoDS_Iterator.hxx>
-
-#include <QComboBox>
-#include <QPalette>
-#include <QLabel>
-#include <QFrame>
-#include <QVBoxLayout>
-#include <QGridLayout>
-#include <QLineEdit>
-#include <QCheckBox>
-#include <QTabWidget>
-#include <QSpinBox>
-#include <QPushButton>
-#include <QFileInfo>
-#include <QGroupBox>
-
-#include <QTableWidget>
-#include <QTableWidgetItem>
-#include <QHeaderView>
-
-#include <stdexcept>
-#include <utilities.h>
-
-#include <boost/algorithm/string.hpp>
-
-namespace {
-
-#ifdef WIN32
-#include <windows.h>
-#else
-#include <sys/sysinfo.h>
-#endif
-
- int maxAvailableMemory()
- {
-#ifdef WIN32
- // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
- MEMORYSTATUSEX statex;
- statex.dwLength = sizeof (statex);
- int err = GlobalMemoryStatusEx (&statex);
- if (err != 0) {
- int totMB =
- statex.ullTotalPhys / 1024 / 1024 +
- statex.ullTotalPageFile / 1024 / 1024 +
- statex.ullTotalVirtual / 1024 / 1024;
- return (int) ( 0.7 * totMB );
- }
-#else
- struct sysinfo si;
- int err = sysinfo( &si );
- if ( err == 0 ) {
- int totMB =
- si.totalram * si.mem_unit / 1024 / 1024 +
- si.totalswap * si.mem_unit / 1024 / 1024 ;
- return (int) ( 0.7 * totMB );
- }
-#endif
- return 0;
- }
-}
-
-//
-// BEGIN EnforcedVertexTableWidgetDelegate
-//
-
-EnforcedVertexTableWidgetDelegate::EnforcedVertexTableWidgetDelegate(QObject *parent)
- : QItemDelegate(parent)
-{
-}
-
-QWidget *EnforcedVertexTableWidgetDelegate::createEditor(QWidget *parent,
- const QStyleOptionViewItem & option ,
- const QModelIndex & index ) const
-{
- QModelIndex father = index.parent();
- QString entry = father.child(index.row(), ENF_VER_ENTRY_COLUMN).data().toString();
-
- if (index.column() == ENF_VER_X_COLUMN ||
- index.column() == ENF_VER_Y_COLUMN ||
- index.column() == ENF_VER_Z_COLUMN ||
- index.column() == ENF_VER_SIZE_COLUMN) {
- SMESHGUI_SpinBox *editor = new SMESHGUI_SpinBox(parent);
- if (index.column() == ENF_VER_SIZE_COLUMN)
- editor->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
- else
- editor->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
- editor->setReadOnly(!entry.isEmpty());
- editor->setDisabled(!entry.isEmpty());
- return editor;
- }
-// else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
-// QCheckBox *editor = new QCheckBox(parent);
-// editor->setDisabled(!entry.isEmpty());
-// return editor;
-// }
- else if (index.column() == ENF_VER_GROUP_COLUMN ||
- index.column() == ENF_VER_NAME_COLUMN) {
-// else {
- QLineEdit *editor = new QLineEdit(parent);
- if (index.column() != ENF_VER_GROUP_COLUMN) {
- editor->setReadOnly(!entry.isEmpty());
- editor->setDisabled(!entry.isEmpty());
- }
- return editor;
- }
- return QItemDelegate::createEditor(parent, option, index);
-}
-
-void EnforcedVertexTableWidgetDelegate::setEditorData(QWidget *editor,
- const QModelIndex &index) const
-{
- if (index.column() == ENF_VER_X_COLUMN ||
- index.column() == ENF_VER_Y_COLUMN ||
- index.column() == ENF_VER_Z_COLUMN ||
- index.column() == ENF_VER_SIZE_COLUMN)
- {
- SMESHGUI_SpinBox *lineEdit = qobject_cast<SMESHGUI_SpinBox*>(editor);
- lineEdit->SetValue(index.data().toDouble());
- }
- else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
- QCheckBox *checkBox = qobject_cast<QCheckBox*>(editor);
- checkBox->setChecked(index.data().toBool());
- }
- else {
- QItemDelegate::setEditorData(editor, index);
- }
-}
-
-void EnforcedVertexTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const
-{
- QModelIndex parent = index.parent();
-
- QString entry = parent.child(index.row(), ENF_VER_ENTRY_COLUMN).data().toString();
- bool isCompound = parent.child(index.row(), ENF_VER_COMPOUND_COLUMN).data(Qt::CheckStateRole).toBool();
-
- if (index.column() == ENF_VER_X_COLUMN ||
- index.column() == ENF_VER_Y_COLUMN ||
- index.column() == ENF_VER_Z_COLUMN) {
- SMESHGUI_SpinBox *lineEdit = qobject_cast<SMESHGUI_SpinBox*>(editor);
- if (!isCompound && !vertexExists(model, index, lineEdit->GetString()))
- model->setData(index, lineEdit->GetValue(), Qt::EditRole);
- }
- else if (index.column() == ENF_VER_SIZE_COLUMN)
- {
- SMESHGUI_SpinBox *lineEdit = qobject_cast<SMESHGUI_SpinBox*>(editor);
- const double newsize = lineEdit->GetValue();
- if (newsize > 0)
- model->setData(index, newsize, Qt::EditRole);
- }
- else if (index.column() == ENF_VER_NAME_COLUMN) {
- QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
- QString value = lineEdit->text();
- if (entry.isEmpty() && !vertexExists(model, index, value))
- model->setData(index, value, Qt::EditRole);
- }
- else if (index.column() == ENF_VER_ENTRY_COLUMN) {
- QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
- QString value = lineEdit->text();
- if (! vertexExists(model, index, value))
- model->setData(index, value, Qt::EditRole);
- }
- else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
- QCheckBox *checkBox = qobject_cast<QCheckBox*>(editor);
- model->setData(index, checkBox->isChecked(), Qt::CheckStateRole);
- }
- else {
- QItemDelegate::setModelData(editor, model, index);
- }
-}
-
-void EnforcedVertexTableWidgetDelegate::updateEditorGeometry(QWidget *editor,
- const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
-{
- editor->setGeometry(option.rect);
-}
-
-bool EnforcedVertexTableWidgetDelegate::vertexExists(QAbstractItemModel *model,
- const QModelIndex &index,
- QString value) const
-{
- bool exists = false;
- QModelIndex parent = index.parent();
- int row = index.row();
- int col = index.column();
-
- if (parent.isValid() && !value.isEmpty()) {
- if (col == ENF_VER_X_COLUMN || col == ENF_VER_Y_COLUMN || col == ENF_VER_Z_COLUMN) {
- double x, y, z;
- if (col == ENF_VER_X_COLUMN) {
- x = value.toDouble();
- y = parent.child(row, ENF_VER_Y_COLUMN).data().toDouble();
- z = parent.child(row, ENF_VER_Z_COLUMN).data().toDouble();
- }
- if (col == ENF_VER_Y_COLUMN) {
- y = value.toDouble();
- x = parent.child(row, ENF_VER_X_COLUMN).data().toDouble();
- z = parent.child(row, ENF_VER_Z_COLUMN).data().toDouble();
- }
- if (col == ENF_VER_Z_COLUMN) {
- z = value.toDouble();
- x = parent.child(row, ENF_VER_X_COLUMN).data().toDouble();
- y = parent.child(row, ENF_VER_Y_COLUMN).data().toDouble();
- }
- int nbChildren = model->rowCount(parent);
- for (int i = 0 ; i < nbChildren ; i++) {
- if (i != row) {
- double childX = parent.child(i, ENF_VER_X_COLUMN).data().toDouble();
- double childY = parent.child(i, ENF_VER_Y_COLUMN).data().toDouble();
- double childZ = parent.child(i, ENF_VER_Z_COLUMN).data().toDouble();
- if ((childX == x) && (childY == y) && (childZ == z)) {
- exists = true;
- break;
- }
- }
- }
- }
- else if (col == ENF_VER_NAME_COLUMN) {
- QString name = parent.child(row, ENF_VER_NAME_COLUMN).data().toString();
- if (name == value)
- exists = true;
- }
- }
-
- return exists;
-}
-
-//
-// END EnforcedVertexTableWidgetDelegate
-//
-
-//
-// BEGIN EnforcedMeshTableWidgetDelegate
-//
-
-EnforcedMeshTableWidgetDelegate::EnforcedMeshTableWidgetDelegate(QObject *parent)
- : QItemDelegate(parent)
-{
-}
-
-QWidget *EnforcedMeshTableWidgetDelegate::createEditor(QWidget *parent,
- const QStyleOptionViewItem & option ,
- const QModelIndex & index ) const
-{
- return QItemDelegate::createEditor(parent, option, index);
-}
-
-void EnforcedMeshTableWidgetDelegate::setEditorData(QWidget *editor,
- const QModelIndex &index) const
-{
- QItemDelegate::setEditorData(editor, index);
-}
-
-void EnforcedMeshTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const
-{
- QItemDelegate::setModelData(editor, model, index);
-
-}
-
-void EnforcedMeshTableWidgetDelegate::updateEditorGeometry(QWidget *editor,
- const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
-{
- editor->setGeometry(option.rect);
-}
-
-// bool EnforcedMeshTableWidgetDelegate::enfMeshExists(QAbstractItemModel *model,
-// const QModelIndex &index,
-// QString value) const
-// {
-// bool exists = false;
-// QModelIndex parent = index.parent();
-// int row = index.row();
-// int col = index.column();
-// return exists;
-// }
-
-//
-// END EnforcedMeshTableWidgetDelegate
-//
-
-
-GHS3DPluginGUI_HypothesisCreator::GHS3DPluginGUI_HypothesisCreator( const QString& theHypType )
-: SMESHGUI_GenericHypothesisCreator( theHypType )
-{
- GeomToolSelected = NULL;
- GeomToolSelected = getGeomSelectionTool();
-
- iconVertex = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_OBJBROWSER_VERTEX")));
- iconCompound = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_OBJBROWSER_COMPOUND")));
-// mySelectionMgr = SMESH::GetSelectionMgr(SMESHGUI::GetSMESHGUI());
- myEnfMeshConstraintLabels << tr( "GHS3D_ENF_MESH_CONSTRAINT_NODE" ) << tr( "GHS3D_ENF_MESH_CONSTRAINT_EDGE" ) << tr("GHS3D_ENF_MESH_CONSTRAINT_FACE");
-}
-
-GHS3DPluginGUI_HypothesisCreator::~GHS3DPluginGUI_HypothesisCreator()
-{
- GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
- that->getGeomSelectionTool()->selectionMgr()->clearFilters();
- myEnfMeshWdg->deactivateSelection();
-}
-
-/**
- * \brief {Get or create the geom selection tool for active study}
- * */
-GeomSelectionTools* GHS3DPluginGUI_HypothesisCreator::getGeomSelectionTool()
-{
- GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) {
- that->GeomToolSelected = new GeomSelectionTools(aStudy);
- }
- return that->GeomToolSelected;
-}
-
-GEOM::GEOM_Gen_var GHS3DPluginGUI_HypothesisCreator::getGeomEngine()
-{
- return GeometryGUI::GetGeomGen();
-}
-
-QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
-{
- QFrame* fr = new QFrame( 0 );
- QVBoxLayout* lay = new QVBoxLayout( fr );
- lay->setMargin( 5 );
- lay->setSpacing( 0 );
-
- // tab
- QTabWidget* tab = new QTabWidget( fr );
- tab->setTabShape( QTabWidget::Rounded );
- tab->setTabPosition( QTabWidget::North );
- lay->addWidget( tab );
-
- // basic parameters
- myStdGroup = new QWidget();
- QGridLayout* aStdLayout = new QGridLayout( myStdGroup );
- aStdLayout->setSpacing( 6 );
- aStdLayout->setMargin( 11 );
-
- int row = 0;
- myName = 0;
- if( isCreation() )
- {
- aStdLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), myStdGroup ), row, 0, 1, 1 );
- myName = new QLineEdit( myStdGroup );
- aStdLayout->addWidget( myName, row++, 1, 1, 1 );
- }
-
- myToMeshHolesCheck = new QCheckBox( tr( "GHS3D_TO_MESH_HOLES" ), myStdGroup );
- aStdLayout->addWidget( myToMeshHolesCheck, row, 0, 1, 1 );
- myToMakeGroupsOfDomains = new QCheckBox( tr( "GHS3D_TO_MAKE_DOMAIN_GROUPS" ), myStdGroup );
- aStdLayout->addWidget( myToMakeGroupsOfDomains, row++, 1, 1, 1 );
-
- aStdLayout->addWidget( new QLabel( tr( "GHS3D_OPTIMIZATIOL_LEVEL" ), myStdGroup ), row, 0, 1, 1 );
- myOptimizationLevelCombo = new QComboBox( myStdGroup );
- aStdLayout->addWidget( myOptimizationLevelCombo, row++, 1, 1, 1 );
-
- QStringList types;
- types << tr( "LEVEL_NONE" ) << tr( "LEVEL_LIGHT" ) << tr( "LEVEL_MEDIUM" ) << tr( "LEVEL_STANDARDPLUS" ) << tr( "LEVEL_STRONG" );
- myOptimizationLevelCombo->addItems( types );
-
- aStdLayout->setRowStretch( row, 10 );
-
- // advanced parameters
- myAdvGroup = new QWidget();
- QGridLayout* anAdvLayout = new QGridLayout( myAdvGroup );
- anAdvLayout->setSpacing( 6 );
- anAdvLayout->setMargin( 11 );
- myAdvWidget = new GHS3DPluginGUI_AdvWidget(myAdvGroup);
- anAdvLayout->addWidget( myAdvWidget);
-
- myAdvWidget->maxMemoryCheck->setText(tr( "MAX_MEMORY_SIZE" ));
- myAdvWidget->initialMemoryCheck->setText(tr( "INIT_MEMORY_SIZE" ));
-
- myAdvWidget->maxMemorySpin->RangeStepAndValidator(20.0, 1e6, 10.0);
- myAdvWidget->maxMemorySpin->setValue( 128.0 );
-
- myAdvWidget->initialMemorySpin->RangeStepAndValidator(0.0, 1e6, 10.0);
- myAdvWidget->initialMemorySpin->setValue( 100.0 );
-
- myAdvWidget->initialMemoryLabel ->setText (tr( "MEGABYTE" ));
- myAdvWidget->maxMemoryLabel ->setText (tr( "MEGABYTE" ));
-
- myAdvWidget->workingDirectoryLabel ->setText (tr( "WORKING_DIR" ));
- myAdvWidget->workingDirectoryPushButton ->setText (tr( "SELECT_DIR" ));
- myAdvWidget->keepWorkingFilesCheck ->setText (tr( "KEEP_WORKING_FILES" ));
- myAdvWidget->verboseLevelLabel ->setText (tr( "VERBOSE_LEVEL" ));
- myAdvWidget->removeLogOnSuccessCheck ->setText (tr( "REMOVE_LOG_ON_SUCCESS" ));
- myAdvWidget->logInFileCheck ->setText (tr( "LOG_IN_FILE" ));
-
- myAdvWidget->memoryGroupBox ->setTitle(tr( "MEMORY_GROUP_TITLE" ));
- myAdvWidget->logGroupBox ->setTitle(tr( "LOG_GROUP_TITLE" ));
- myAdvWidget->advancedMeshingGroupBox ->setTitle(tr( "ADVANCED_MESHING_GROUP_TITLE" ));
-
- myAdvWidget->createNewNodesCheck ->setText (tr( "TO_ADD_NODES" ));
- myAdvWidget->removeInitialCentralPointCheck->setText (tr( "NO_INITIAL_CENTRAL_POINT" ));
- myAdvWidget->boundaryRecoveryCheck ->setText (tr( "RECOVERY_VERSION" ));
- myAdvWidget->FEMCorrectionCheck ->setText (tr( "FEM_CORRECTION" ));
- myAdvWidget->gradationLabel ->setText (tr( "GHS3D_GRADATION" ));
- myAdvWidget->gradationSpinBox->RangeStepAndValidator(1.05, 5.0, 0.05, "length_precision");
- myAdvWidget->textOptionLabel->setText(tr( "TEXT_OPTION" ));
-
- // Enforced vertices parameters
- myEnfGroup = new QWidget();
- QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
-
- myEnforcedTableWidget = new QTableWidget(myEnfGroup);
- myEnforcedTableWidget ->setMinimumWidth(300);
- myEnforcedTableWidget->setRowCount( 0 );
- myEnforcedTableWidget->setColumnCount( ENF_VER_NB_COLUMNS );
- myEnforcedTableWidget->setSortingEnabled(true);
- QStringList enforcedHeaders;
- enforcedHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
- << tr( "GHS3D_ENF_VER_X_COLUMN" )<< tr( "GHS3D_ENF_VER_Y_COLUMN" ) << tr( "GHS3D_ENF_VER_Z_COLUMN" )
- << tr( "GHS3D_ENF_SIZE_COLUMN" ) << tr("GHS3D_ENF_ENTRY_COLUMN") << tr("GHS3D_ENF_VER_COMPOUND_COLUMN") << tr( "GHS3D_ENF_GROUP_COLUMN" );
-
- myEnforcedTableWidget->setHorizontalHeaderLabels(enforcedHeaders);
- myEnforcedTableWidget->verticalHeader()->hide();
- myEnforcedTableWidget->horizontalHeader()->setStretchLastSection(true);
- myEnforcedTableWidget->setAlternatingRowColors(true);
- myEnforcedTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
- myEnforcedTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
- myEnforcedTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
- myEnforcedTableWidget->resizeColumnsToContents();
- myEnforcedTableWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
- myEnforcedTableWidget->hideColumn(ENF_VER_COMPOUND_COLUMN);
-
- myEnforcedTableWidget->setItemDelegate(new EnforcedVertexTableWidgetDelegate());
-
-// VERTEX SELECTION
- TColStd_MapOfInteger shapeTypes;
- shapeTypes.Add( TopAbs_VERTEX );
- shapeTypes.Add( TopAbs_COMPOUND );
-
- SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes);
- myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true, /*stretch=*/false);
- myEnfVertexWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_VERTEX"), "QLineEdit { color: grey }");
-
- QLabel* myXCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_X_LABEL" ), myEnfGroup );
- myXCoord = new SMESHGUI_SpinBox(myEnfGroup);
- myXCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
- QLabel* myYCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_Y_LABEL" ), myEnfGroup );
- myYCoord = new SMESHGUI_SpinBox(myEnfGroup);
- myYCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
- QLabel* myZCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_Z_LABEL" ), myEnfGroup );
- myZCoord = new SMESHGUI_SpinBox(myEnfGroup);
- myZCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
- QLabel* mySizeLabel = new QLabel( tr( "GHS3D_ENF_SIZE_LABEL" ), myEnfGroup );
- mySizeValue = new SMESHGUI_SpinBox(myEnfGroup);
- mySizeValue->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
-
- QLabel* myGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfGroup );
- myGroupName = new QLineEdit(myEnfGroup);
-
- addVertexButton = new QPushButton(tr("GHS3D_ENF_ADD"),myEnfGroup);
- addVertexButton->setEnabled(false);
- removeVertexButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfGroup);
-// myGlobalGroupName = new QCheckBox(tr("GHS3D_ENF_VER_GROUPS"), myEnfGroup);
-// myGlobalGroupName->setChecked(false);
-
- // QGroupBox* GroupBox = new QGroupBox( myEnfGroup );
- // QLabel* info = new QLabel( GroupBox );
- // info->setText( tr( "GHS3D_ENF_VER_INFO" ) );
- // info->setWordWrap( true );
- // QVBoxLayout* GroupBoxVLayout = new QVBoxLayout( GroupBox );
- // GroupBoxVLayout->setSpacing( 6 );
- // GroupBoxVLayout->setMargin( 11 );
- // GroupBoxVLayout->addWidget( info );
-
-
- //anEnfLayout->addWidget(GroupBox, ENF_VER_WARNING, 0, 1, 2 );
- anEnfLayout->addWidget(myEnforcedTableWidget, ENF_VER_VERTEX, 0, ENF_VER_NB_LINES, 1);
-
- QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
- anEnfLayout2->addWidget(myEnfVertexWdg, ENF_VER_VERTEX, 0, 1, 2);
- anEnfLayout2->addWidget(myXCoordLabel, ENF_VER_X_COORD, 0, 1, 1);
- anEnfLayout2->addWidget(myXCoord, ENF_VER_X_COORD, 1, 1, 1);
- anEnfLayout2->addWidget(myYCoordLabel, ENF_VER_Y_COORD, 0, 1, 1);
- anEnfLayout2->addWidget(myYCoord, ENF_VER_Y_COORD, 1, 1, 1);
- anEnfLayout2->addWidget(myZCoordLabel, ENF_VER_Z_COORD, 0, 1, 1);
- anEnfLayout2->addWidget(myZCoord, ENF_VER_Z_COORD, 1, 1, 1);
- anEnfLayout2->addWidget(mySizeLabel, ENF_VER_SIZE, 0, 1, 1);
- anEnfLayout2->addWidget(mySizeValue, ENF_VER_SIZE, 1, 1, 1);
- anEnfLayout2->addWidget(myGroupNameLabel, ENF_VER_GROUP, 0, 1, 1);
- anEnfLayout2->addWidget(myGroupName, ENF_VER_GROUP, 1, 1, 1);
- anEnfLayout2->addWidget(addVertexButton, ENF_VER_BTN, 0, 1, 1);
- anEnfLayout2->addWidget(removeVertexButton, ENF_VER_BTN, 1, 1, 1);
- anEnfLayout2->setRowStretch(ENF_VER_NB_LINES, 1);
-
- anEnfLayout->addLayout(anEnfLayout2, ENF_VER_VERTEX, 1,ENF_VER_NB_LINES, 1);
- anEnfLayout->setRowStretch(ENF_VER_VERTEX, 10);
-
-
- // Enforced meshes parameters
- myEnfMeshGroup = new QWidget();
- QGridLayout* anEnfMeshLayout = new QGridLayout(myEnfMeshGroup);
-
- myEnforcedMeshTableWidget = new QTableWidget(myEnfGroup);
- myEnforcedMeshTableWidget->setRowCount( 0 );
- myEnforcedMeshTableWidget->setColumnCount( ENF_MESH_NB_COLUMNS );
- myEnforcedMeshTableWidget->setSortingEnabled(true);
- myEnforcedMeshTableWidget->verticalHeader()->hide();
- QStringList enforcedMeshHeaders;
- enforcedMeshHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
- << tr( "GHS3D_ENF_ENTRY_COLUMN" )
- << tr( "GHS3D_ENF_MESH_CONSTRAINT_COLUMN" )
- << tr( "GHS3D_ENF_GROUP_COLUMN" );
- myEnforcedMeshTableWidget->setHorizontalHeaderLabels(enforcedMeshHeaders);
- myEnforcedMeshTableWidget->horizontalHeader()->setStretchLastSection(true);
- myEnforcedMeshTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
- myEnforcedMeshTableWidget->setAlternatingRowColors(true);
- myEnforcedMeshTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
- myEnforcedMeshTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
- myEnforcedMeshTableWidget->resizeColumnsToContents();
- myEnforcedMeshTableWidget->hideColumn(ENF_MESH_ENTRY_COLUMN);
-
- myEnforcedMeshTableWidget->setItemDelegate(new EnforcedMeshTableWidgetDelegate());
-
-// myEnfMesh = SMESH::SMESH_Mesh::_nil();
-// myEnfMeshArray = new SMESH::mesh_array();
-
- myEnfMeshWdg = new StdMeshersGUI_ObjectReferenceParamWdg( SMESH::IDSOURCE, myEnfMeshGroup, /*multiSel=*/true);
- myEnfMeshWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_MESH"), "QLineEdit { color: grey }");
-
- myEnfMeshWdg->AvoidSimultaneousSelection(myEnfVertexWdg);
-
- QLabel* myMeshConstraintLabel = new QLabel( tr( "GHS3D_ENF_MESH_CONSTRAINT_LABEL" ), myEnfMeshGroup );
- myEnfMeshConstraint = new QComboBox(myEnfMeshGroup);
- myEnfMeshConstraint->insertItems(0,myEnfMeshConstraintLabels);
- myEnfMeshConstraint->setEditable(false);
- myEnfMeshConstraint->setCurrentIndex(0);
-
- QLabel* myMeshGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfMeshGroup );
- myMeshGroupName = new QLineEdit(myEnfMeshGroup);
-
- addEnfMeshButton = new QPushButton(tr("GHS3D_ENF_ADD"),myEnfMeshGroup);
-// addEnfMeshButton->setEnabled(false);
- removeEnfMeshButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfMeshGroup);
-
- // QGroupBox* GroupBox2 = new QGroupBox( myEnfMeshGroup );
- // QLabel* info2 = new QLabel( GroupBox2 );
- // info2->setText( tr( "GHS3D_ENF_MESH_INFO" ) );
- // info2->setWordWrap( true );
- // QVBoxLayout* GroupBox2VLayout = new QVBoxLayout( GroupBox2 );
- // GroupBox2VLayout->setSpacing( 6 );
- // GroupBox2VLayout->setMargin( 11 );
- // GroupBox2VLayout->addWidget( info2 );
-
- // anEnfMeshLayout->addWidget( GroupBox2, ENF_MESH_WARNING, 0, 1, 2 );
- anEnfMeshLayout->addWidget(myEnforcedMeshTableWidget, ENF_MESH_MESH, 0, ENF_MESH_NB_LINES , 1);
-
- QGridLayout* anEnfMeshLayout2 = new QGridLayout(myEnfMeshGroup);
- anEnfMeshLayout2->addWidget(myEnfMeshWdg, ENF_MESH_MESH, 0, 1, 2);
- anEnfMeshLayout2->addWidget(myMeshConstraintLabel, ENF_MESH_CONSTRAINT, 0, 1, 1);
- anEnfMeshLayout2->addWidget(myEnfMeshConstraint, ENF_MESH_CONSTRAINT, 1, 1, 1);
- anEnfMeshLayout2->addWidget(myMeshGroupNameLabel, ENF_MESH_GROUP, 0, 1, 1);
- anEnfMeshLayout2->addWidget(myMeshGroupName, ENF_MESH_GROUP, 1, 1, 1);
- anEnfMeshLayout2->addWidget(addEnfMeshButton, ENF_MESH_BTN, 0, 1, 1);
- anEnfMeshLayout2->addWidget(removeEnfMeshButton, ENF_MESH_BTN, 1, 1, 1);
- anEnfMeshLayout2->setRowStretch(ENF_MESH_NB_LINES, 1);
-
- anEnfMeshLayout->addLayout(anEnfMeshLayout2, ENF_MESH_MESH, 1, ENF_MESH_NB_LINES, 1);
- anEnfMeshLayout->setRowStretch(ENF_MESH_MESH, 10);
-
- // add tabs
- tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
- tab->insertTab( ADV_TAB, myAdvGroup, tr( "GHS3D_ADV_ARGS" ) );
- tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "GHS3D_ENFORCED_VERTICES" ) );
- tab->insertTab( ENF_MESH_TAB, myEnfMeshGroup, tr( "GHS3D_ENFORCED_MESHES" ) );
- tab->setCurrentIndex( STD_TAB );
-
- // connections
- //connect( myToMeshHolesCheck, SIGNAL( toggled( bool ) ), this, SLOT( onToMeshHoles(bool)));
- connect( myAdvWidget->maxMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
- connect( myAdvWidget->initialMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
- connect( myAdvWidget->boundaryRecoveryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
- connect( myAdvWidget->logInFileCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
- connect( myAdvWidget->keepWorkingFilesCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
- connect( myAdvWidget->workingDirectoryPushButton, SIGNAL( clicked() ), this, SLOT( onDirBtnClicked() ) );
-
- connect( myEnforcedTableWidget, SIGNAL( itemClicked(QTableWidgetItem *)), this, SLOT( synchronizeCoords() ) );
- connect( myEnforcedTableWidget, SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
- connect( myEnforcedTableWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( synchronizeCoords() ) );
- connect( addVertexButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedVertex() ) );
- connect( removeVertexButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedVertex() ) );
- connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
- connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
- connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- connect( mySizeValue, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) );
- connect( myXCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- connect( myYCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- connect( myZCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- connect( mySizeValue, SIGNAL( valueChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) );
- connect( this, SIGNAL( vertexDefined(bool) ), addVertexButton, SLOT( setEnabled(bool) ) );
-
- connect( addEnfMeshButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedMesh() ) );
- connect( removeEnfMeshButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedMesh() ) );
-// connect( myEnfMeshWdg, SIGNAL( contentModified()), this, SLOT( checkEnfMeshIsDefined() ) );
-// connect( myEnfMeshConstraint, SIGNAL( currentIndexChanged(int) ), this, SLOT( checkEnfMeshIsDefined() ) );
-// connect( this, SIGNAL( enfMeshDefined(bool) ), addEnfMeshButton, SLOT( setEnabled(bool) ) );
-
- return fr;
-}
-
-/**
- * This method checks if an enforced vertex is defined;
-**/
-void GHS3DPluginGUI_HypothesisCreator::clearEnfVertexSelection()
-{
- if (myEnfVertexWdg->NbObjects() != 0) {
- disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
- disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
- myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
- connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
- connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
- }
- GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
- that->checkVertexIsDefined();
-}
-
-/**
- * This method checks if an enforced vertex is defined;
-**/
-void GHS3DPluginGUI_HypothesisCreator::checkVertexIsDefined()
-{
- bool enfVertexIsDefined = false;
- enfVertexIsDefined = (!mySizeValue->GetString().isEmpty() &&
- (!myEnfVertexWdg->NbObjects() == 0 ||
- (myEnfVertexWdg->NbObjects() == 0 && !myXCoord->GetString().isEmpty()
- && !myYCoord->GetString().isEmpty()
- && !myZCoord->GetString().isEmpty())));
- emit vertexDefined(enfVertexIsDefined);
-}
-
-/**
- * This method checks if an enforced mesh is defined;
-**/
-void GHS3DPluginGUI_HypothesisCreator::checkEnfMeshIsDefined()
-{
- emit enfMeshDefined( myEnfVertexWdg->NbObjects() != 0);
-}
-
-/**
- * This method resets the content of the X, Y, Z, size and GroupName widgets;
-**/
-void GHS3DPluginGUI_HypothesisCreator::clearEnforcedVertexWidgets()
-{
- myXCoord->setCleared(true);
- myYCoord->setCleared(true);
- myZCoord->setCleared(true);
-// mySizeValue->setCleared(true);
- myXCoord->setText("");
- myYCoord->setText("");
- myZCoord->setText("");
-// mySizeValue->setText("");
-// myGroupName->setText("");
- addVertexButton->setEnabled(false);
-}
-
-/** GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(item)
-This method updates the tooltip of a modified item. The QLineEdit widgets content
-is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
-*/
-void GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetItem* item) {
-// MESSAGE("GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues");
- int row = myEnforcedTableWidget->row(item);
-
- QVariant vertexName = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole);
- QVariant x = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data( Qt::EditRole);
- QVariant y = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data( Qt::EditRole);
- QVariant z = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data( Qt::EditRole);
- QVariant size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data( Qt::EditRole);
- QVariant entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
- QString groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data( Qt::EditRole).toString();
-
- clearEnforcedVertexWidgets();
-
- if ( !x.isNull() || !entry.isNull()) {
- QString toolTip = vertexName.toString();
- toolTip += QString("(");
- if (entry.isNull() || (!entry.isNull() && entry.toString() == "")) {
- toolTip += x.toString();
- toolTip += QString(", ") + y.toString();
- toolTip += QString(", ") + z.toString();
- }
- else
- toolTip += entry.toString();
- toolTip += QString(")");
-
- if (!size.isNull())
- toolTip += QString("=") + size.toString();
-
- if (!groupName.isEmpty())
- toolTip += QString(" [") + groupName + QString("]");
-
-// MESSAGE("Tooltip: " << toolTip.toStdString());
- for (int col=0;col<ENF_VER_NB_COLUMNS;col++)
- myEnforcedTableWidget->item(row,col)->setToolTip(toolTip);
-
- if (!x.isNull()) {
- disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- myXCoord->SetValue(x.toDouble());
- myYCoord->SetValue(y.toDouble());
- myZCoord->SetValue(z.toDouble());
- connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- }
- if (!size.isNull())
- mySizeValue->SetValue(size.toDouble());
-
- if (!groupName.isEmpty())
- myGroupName->setText(groupName);
- }
-}
-
-void GHS3DPluginGUI_HypothesisCreator::onSelectEnforcedVertex() {
- int nbSelEnfVertex = myEnfVertexWdg->NbObjects();
- clearEnforcedVertexWidgets();
- if (nbSelEnfVertex == 1)
- {
- if ( CORBA::is_nil( getGeomEngine() ) && !GeometryGUI::InitGeomGen() )
- return ;
-
- myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(nbSelEnfVertex-1);
- if (myEnfVertex == GEOM::GEOM_Object::_nil())
- return;
- if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
- GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
- GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
- if (CORBA::is_nil(measureOp))
- return;
-
- CORBA::Double x,y,z;
- measureOp->PointCoordinates (myEnfVertex, x, y, z);
- if ( measureOp->IsDone() )
- {
- disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- myXCoord->SetValue(x);
- myYCoord->SetValue(y);
- myZCoord->SetValue(z);
- connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- }
- }
- }
-}
-
-/** GHS3DPluginGUI_HypothesisCreator::synchronizeCoords()
-This method synchronizes the QLineEdit/SMESHGUI_SpinBox widgets content with the coordinates
-of the enforced vertex clicked in the tree widget.
-*/
-void GHS3DPluginGUI_HypothesisCreator::synchronizeCoords() {
- clearEnforcedVertexWidgets();
- QList<QTableWidgetItem *> items = myEnforcedTableWidget->selectedItems();
-// myEnfVertexWdg->disconnect(SIGNAL(contentModified()));
- disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
- if (! items.isEmpty()) {
- QTableWidgetItem *item;
- int row;
- QVariant entry;
- if (items.size() == 1) {
- item = items[0];
- row = myEnforcedTableWidget->row(item);
- QVariant x = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data( Qt::EditRole);
- QVariant y = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data( Qt::EditRole);
- QVariant z = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data( Qt::EditRole);
- QVariant size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data( Qt::EditRole);
- entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
- if (!entry.isNull()) {
- SMESH::string_array_var objIds = new SMESH::string_array;
- objIds->length(1);
- objIds[0] = entry.toString().toStdString().c_str();
- myEnfVertexWdg->SetObjects(objIds);
- }
- else {
- myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
- }
- QVariant group = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data( Qt::EditRole);
- if (!x.isNull()/* && entry.isNull()*/) {
-// disconnect( myXCoord, SIGNAL( textChanged(const QString &)), this, SLOT( onSelectEnforcedVertex() ) );
- disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- myXCoord->SetValue(x.toDouble());
- myYCoord->SetValue(y.toDouble());
- myZCoord->SetValue(z.toDouble());
- connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
- }
- if (!size.isNull())
- mySizeValue->SetValue(size.toDouble());
-
- if (!group.isNull() && (!x.isNull() || !entry.isNull()))
- myGroupName->setText(group.toString());
- }
- else {
- QList<QString> entryList;
- for (int i = 0; i < items.size(); ++i) {
- item = items[i];
- row = myEnforcedTableWidget->row(item);
- entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
- if (!entry.isNull())
- entryList << entry.toString();
- }
- if (entryList.size() > 0) {
- SMESH::string_array_var objIds = new SMESH::string_array;
- objIds->length(entryList.size());
- for (int i = 0; i < entryList.size() ; i++)
- objIds[i] = entryList.at(i).toStdString().c_str();
- myEnfVertexWdg->SetObjects(objIds);
- }
- else {
- myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
- }
- }
- }
- else {
- myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
- }
- connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
- GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
- that->checkVertexIsDefined();
-}
-
-/** GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh( meshName, geomEntry, elemType, size, groupName)
-This method adds in the tree widget an enforced mesh from mesh, submesh or group with optionally size and and groupName.
-*/
-void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName)
-{
- MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", \"" << groupName << "\")");
- bool okToCreate = true;
- QString itemEntry = "";
- int itemElementType = 0;
- int rowCount = myEnforcedMeshTableWidget->rowCount();
- bool allColumns = true;
- for (int row = 0;row<rowCount;row++) {
- for (int col = 0 ; col < ENF_MESH_NB_COLUMNS ; col++) {
- MESSAGE("col: " << col);
- if (col == ENF_MESH_CONSTRAINT_COLUMN){
- if (qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col)) == 0) {
- allColumns = false;
- MESSAGE("allColumns = false");
- break;
- }
- }
- else if (myEnforcedMeshTableWidget->item(row, col) == 0) {
- allColumns = false;
- MESSAGE("allColumns = false");
- break;
- }
- if (col == ENF_MESH_CONSTRAINT_COLUMN) {
- QComboBox* itemComboBox = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col));
- itemElementType = itemComboBox->currentIndex();
- MESSAGE("itemElementType: " << itemElementType);
- }
- else if (col == ENF_MESH_ENTRY_COLUMN)
- itemEntry = myEnforcedMeshTableWidget->item(row, col)->data(Qt::EditRole).toString();
- }
-
- if (!allColumns)
- break;
-
- if (itemEntry == QString(entry.c_str()) && itemElementType == elementType) {
-// // update group name
-// if (itemGroupName.toStdString() != groupName) {
-// MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
-// myEnforcedMeshTableWidget->item(row, ENF_MESH_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
-// }
- okToCreate = false;
- break;
- } // if
- } // for
-
-
- if (!okToCreate)
- return;
-
- MESSAGE("Creation of enforced mesh");
-
- myEnforcedMeshTableWidget->setRowCount(rowCount+1);
- myEnforcedMeshTableWidget->setSortingEnabled(false);
-
- for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
- MESSAGE("Column: " << col);
- if (col == ENF_MESH_CONSTRAINT_COLUMN) {
- QComboBox* comboBox = new QComboBox();
- QPalette pal = comboBox->palette();
- pal.setColor(QPalette::Button, Qt::white);
- comboBox->setPalette(pal);
- comboBox->insertItems(0,myEnfMeshConstraintLabels);
- comboBox->setEditable(false);
- comboBox->setCurrentIndex(elementType);
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
- myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
- }
- else {
- QTableWidgetItem* item = new QTableWidgetItem();
- item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
- switch (col) {
- case ENF_MESH_NAME_COLUMN:
- item->setData( 0, name.c_str() );
- item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- myEnforcedMeshTableWidget->setItem(rowCount,col,item);
- break;
- case ENF_MESH_ENTRY_COLUMN:
- item->setData( 0, entry.c_str() );
- item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- myEnforcedMeshTableWidget->setItem(rowCount,col,item);
- break;
- case ENF_MESH_GROUP_COLUMN:
- item->setData( 0, groupName.c_str() );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- myEnforcedMeshTableWidget->setItem(rowCount,col,item);
- break;
- default:
- break;
- }
- }
- MESSAGE("Done");
- }
-
-// connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
-
- myEnforcedMeshTableWidget->setSortingEnabled(true);
-// myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
-// updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
-
-}
-
-/** GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex( x, y, z, size, vertexName, geomEntry, groupName)
-This method adds in the tree widget an enforced vertex with given size and coords (x,y,z) or GEOM vertex or compound and with optionally groupName.
-*/
-void GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z, double size, std::string vertexName, std::string geomEntry, std::string groupName, bool isCompound)
-{
- MESSAGE("addEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ", \"" << vertexName << ", \"" << geomEntry << "\", \"" << groupName << "\", " << isCompound << ")");
- myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
- bool okToCreate = true;
- double itemX,itemY,itemZ,itemSize = 0;
- QString itemEntry, itemGroupName = QString("");
-// bool itemIsCompound;
- int rowCount = myEnforcedTableWidget->rowCount();
- QVariant data;
- bool allColumns;
- for (int row = 0;row<rowCount;row++) {
- allColumns = true;
- for (int col = 0 ; col < ENF_VER_NB_COLUMNS ; col++) {
- if (myEnforcedTableWidget->item(row, col) == 0) {
- allColumns = false;
- break;
- }
-
- data = myEnforcedTableWidget->item(row, col)->data(Qt::EditRole);
- if (!data.isNull()) {
- switch (col) {
- case ENF_VER_GROUP_COLUMN:
- itemGroupName = data.toString();
- break;
- case ENF_VER_ENTRY_COLUMN:
- itemEntry = data.toString();
- break;
-// case ENF_VER_COMPOUND_COLUMN:
-// itemIsCompound = data.toBool();
-// break;
- case ENF_VER_X_COLUMN:
- itemX = data.toDouble();
- break;
- case ENF_VER_Y_COLUMN:
- itemY = data.toDouble();
- break;
- case ENF_VER_Z_COLUMN:
- itemZ = data.toDouble();
- break;
- case ENF_VER_SIZE_COLUMN:
- itemSize = data.toDouble();
- break;
- default:
- break;
- }
- }
- }
-
- if (!allColumns)
- break;
-
-
- if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) || /*( (itemEntry.toStdString() != "") && */ (itemEntry.toStdString() == geomEntry)/*)*/) {
- // update size
- if (itemSize != size) {
- MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
- myEnforcedTableWidget->item(row, ENF_VER_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size));
- }
- // update group name
- if (itemGroupName.toStdString() != groupName) {
- MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
- myEnforcedTableWidget->item(row, ENF_VER_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
- }
- okToCreate = false;
- break;
- } // if
- } // for
- if (!okToCreate) {
- if (geomEntry.empty()) {
- MESSAGE("Vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
- }
- else {
- MESSAGE("Vertex with entry " << geomEntry << " already exist: dont create again");
- }
- return;
- }
-
- if (geomEntry.empty()) {
- MESSAGE("Vertex with coords " << x << ", " << y << ", " << z<< " is created");
- }
- else {
- MESSAGE("Vertex with geom entry " << geomEntry << " is created");
- }
-
- int vertexIndex=0;
- int indexRef = -1;
- QString myVertexName;
- while(indexRef != vertexIndex) {
- indexRef = vertexIndex;
- if (vertexName.empty())
- myVertexName = QString("Vertex #%1").arg(vertexIndex);
- else
- myVertexName = QString(vertexName.c_str());
-
- for (int row = 0;row<rowCount;row++) {
- QString name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString();
- if (myVertexName == name) {
- vertexIndex++;
- break;
- }
- }
- }
-
- MESSAGE("myVertexName is \"" << myVertexName.toStdString() << "\"");
- myEnforcedTableWidget->setRowCount(rowCount+1);
- myEnforcedTableWidget->setSortingEnabled(false);
- for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
- MESSAGE("Column: " << col);
- QTableWidgetItem* item = new QTableWidgetItem();
- item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
- switch (col) {
- case ENF_VER_NAME_COLUMN:
- item->setData( Qt::EditRole, myVertexName );
- if (!geomEntry.empty()) {
- if (isCompound)
- item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
- else
- item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
- }
- break;
- case ENF_VER_X_COLUMN:
- if (!isCompound)
- item->setData( 0, QVariant(x) );
- break;
- case ENF_VER_Y_COLUMN:
- if (!isCompound)
- item->setData( 0, QVariant(y) );
- break;
- case ENF_VER_Z_COLUMN:
- if (!isCompound)
- item->setData( 0, QVariant(z) );
- break;
- case ENF_VER_SIZE_COLUMN:
- item->setData( 0, QVariant(size) );
- break;
- case ENF_VER_ENTRY_COLUMN:
- if (!geomEntry.empty())
- item->setData( 0, QString(geomEntry.c_str()) );
- break;
- case ENF_VER_COMPOUND_COLUMN:
- item->setData( Qt::CheckStateRole, isCompound );
- item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
- break;
- case ENF_VER_GROUP_COLUMN:
- if (!groupName.empty())
- item->setData( 0, QString(groupName.c_str()) );
- break;
- default:
- break;
- }
-
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- myEnforcedTableWidget->setItem(rowCount,col,item);
- MESSAGE("Done");
- }
-
- connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
-
- myEnforcedTableWidget->setSortingEnabled(true);
-// myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
- updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
-}
-
-/** GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
-This method is called when a item is added into the enforced meshes tree widget
-*/
-void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
-{
- MESSAGE("GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()");
-
- GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
-
- that->getGeomSelectionTool()->selectionMgr()->clearFilters();
- myEnfMeshWdg->deactivateSelection();
-
- for (int column = 0; column < myEnforcedMeshTableWidget->columnCount(); ++column)
- myEnforcedMeshTableWidget->resizeColumnToContents(column);
-
- // Vertex selection
- int selEnfMeshes = myEnfMeshWdg->NbObjects();
- if (selEnfMeshes == 0)
- return;
-
- std::string groupName = myMeshGroupName->text().toStdString();
-// if (myGlobalGroupName->isChecked())
-// groupName = myGlobalGroupName->text().toStdString();
-
- if (boost::trim_copy(groupName).empty())
- groupName = "";
-
-
- int elementType = myEnfMeshConstraint->currentIndex();
-
-
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- _PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil;
- QString meshEntry = myEnfMeshWdg->GetValue();
- MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString());
-
- if (selEnfMeshes == 1)
- {
- MESSAGE("1 SMESH object selected");
-// myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >();
-// std::string entry = myEnfMeshWdg->GetValue();
- aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str());
- CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
- if (!CORBA::is_nil(anObj)) {
-// SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
- addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
- }
- }
- else
- {
- MESSAGE(selEnfMeshes << " SMESH objects selected");
- QStringList meshEntries = meshEntry.split(" ", QString::SkipEmptyParts);
- QStringListIterator meshEntriesIt (meshEntries);
- while (meshEntriesIt.hasNext()) {
- aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str());
- CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
- if (!CORBA::is_nil(anObj)) {
-// SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
- addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
- }
- }
- }
-
- myEnfVertexWdg->SetObject(SMESH::SMESH_IDSource::_nil());
-
- for (int column = 0; column < myEnforcedMeshTableWidget->columnCount(); ++column)
- myEnforcedMeshTableWidget->resizeColumnToContents(column);
-}
-
-
-/** GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
-This method is called when a item is added into the enforced vertices tree widget
-*/
-void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
-{
- MESSAGE("GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()");
-
- GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
-
- that->getGeomSelectionTool()->selectionMgr()->clearFilters();
- myEnfVertexWdg->deactivateSelection();
-
- for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
- myEnforcedTableWidget->resizeColumnToContents(column);
-
- // Vertex selection
- int selEnfVertex = myEnfVertexWdg->NbObjects();
- bool coordsEmpty = (myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty());
- if ((selEnfVertex == 0) && coordsEmpty)
- return;
-
- std::string groupName = myGroupName->text().toStdString();
-// if (myGlobalGroupName->isChecked())
-// groupName = myGlobalGroupName->text().toStdString();
-
- if (boost::trim_copy(groupName).empty())
- groupName = "";
-
- double size = mySizeValue->GetValue();
-
- if (selEnfVertex <= 1)
- {
- MESSAGE("0 or 1 GEOM object selected");
- double x = 0, y = 0, z=0;
- if (myXCoord->GetString() != "") {
- x = myXCoord->GetValue();
- y = myYCoord->GetValue();
- z = myZCoord->GetValue();
- }
- if (selEnfVertex == 1) {
- MESSAGE("1 GEOM object selected");
- myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
- std::string entry = "";
- if (myEnfVertex != GEOM::GEOM_Object::_nil())
- entry = myEnfVertex->GetStudyEntry();
- addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),entry, groupName, myEnfVertex->GetShapeType() == GEOM::COMPOUND);
- }
- else {
- MESSAGE("0 GEOM object selected");
- MESSAGE("Coords: ("<<x<<","<<y<<","<<z<<")");
- addEnforcedVertex(x, y, z, size, "", "", groupName);
- }
- }
- else
- {
- if ( CORBA::is_nil(getGeomEngine()))
- return;
-
- GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
- if (CORBA::is_nil(measureOp))
- return;
-
- CORBA::Double x = 0, y = 0,z = 0;
- for (int j = 0 ; j < selEnfVertex ; j++)
- {
- myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(j);
- if (myEnfVertex == GEOM::GEOM_Object::_nil())
- continue;
- if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
- measureOp->PointCoordinates (myEnfVertex, x, y, z);
- if ( measureOp->IsDone() )
- addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
- } else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) {
- addEnforcedVertex(0., 0., 0., size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName, true);
- }
- }
- }
-
- myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
-
- for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
- myEnforcedTableWidget->resizeColumnToContents(column);
-}
-
-/** GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
-This method is called when a item is removed from the enforced meshes tree widget
-*/
-void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
-{
- QList<int> selectedRows;
- QList<QTableWidgetItem *> selectedItems = myEnforcedMeshTableWidget->selectedItems();
- QTableWidgetItem* item;
- int row;
- foreach( item, selectedItems ) {
- row = item->row();
- if (!selectedRows.contains( row ) )
- selectedRows.append(row);
- }
-
- qSort( selectedRows );
- QListIterator<int> it( selectedRows );
- it.toBack();
- while ( it.hasPrevious() ) {
- row = it.previous();
- MESSAGE("delete row #"<< row);
- myEnforcedMeshTableWidget->removeRow(row );
- }
-
- myEnforcedMeshTableWidget->selectionModel()->clearSelection();
-}
-
-/** GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
-This method is called when a item is removed from the enforced vertices tree widget
-*/
-void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
-{
- QList<int> selectedRows;
- QList<QTableWidgetItem *> selectedItems = myEnforcedTableWidget->selectedItems();
- QTableWidgetItem* item;
- int row;
- foreach( item, selectedItems ) {
- row = item->row();
- if (!selectedRows.contains( row ) )
- selectedRows.append(row);
- }
-
- qSort( selectedRows );
- QListIterator<int> it( selectedRows );
- it.toBack();
- while ( it.hasPrevious() ) {
- row = it.previous();
- MESSAGE("delete row #"<< row);
- myEnforcedTableWidget->removeRow(row );
- }
-
- myEnforcedTableWidget->selectionModel()->clearSelection();
-}
-
-void GHS3DPluginGUI_HypothesisCreator::onToMeshHoles(bool isOn)
-{
- // myToMakeGroupsOfDomains->setEnabled( isOn );
- // if ( !isOn )
- // myToMakeGroupsOfDomains->setChecked( false );
-}
-
-void GHS3DPluginGUI_HypothesisCreator::onDirBtnClicked()
-{
- QString dir = SUIT_FileDlg::getExistingDirectory( dlg(), myAdvWidget->workingDirectoryLineEdit->text(), QString() );
- if ( !dir.isEmpty() )
- myAdvWidget->workingDirectoryLineEdit->setText( dir );
-}
-
-void GHS3DPluginGUI_HypothesisCreator::updateWidgets()
-{
- //myToMakeGroupsOfDomains->setEnabled( myToMeshHolesCheck->isChecked() );
- myAdvWidget->maxMemorySpin->setEnabled( myAdvWidget->maxMemoryCheck->isChecked() );
- myAdvWidget->initialMemoryCheck->setEnabled( !myAdvWidget->boundaryRecoveryCheck->isChecked() );
- myAdvWidget->initialMemorySpin->setEnabled( myAdvWidget->initialMemoryCheck->isChecked() && !myAdvWidget->boundaryRecoveryCheck->isChecked() );
- myOptimizationLevelCombo->setEnabled( !myAdvWidget->boundaryRecoveryCheck->isChecked() );
- if ( sender() == myAdvWidget->logInFileCheck ||
- sender() == myAdvWidget->keepWorkingFilesCheck )
- {
- bool logFileRemovable = myAdvWidget->logInFileCheck->isChecked() &&
- !myAdvWidget->keepWorkingFilesCheck->isChecked();
-
- myAdvWidget->removeLogOnSuccessCheck->setEnabled( logFileRemovable );
- }
-}
-
-bool GHS3DPluginGUI_HypothesisCreator::checkParams(QString& msg) const
-{
- MESSAGE("GHS3DPluginGUI_HypothesisCreator::checkParams");
-
- if ( !QFileInfo( myAdvWidget->workingDirectoryLineEdit->text().trimmed() ).isWritable() ) {
- SUIT_MessageBox::warning( dlg(),
- tr( "SMESH_WRN_WARNING" ),
- tr( "GHS3D_PERMISSION_DENIED" ) );
- return false;
- }
-
- return true;
-}
-
-void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
-{
- MESSAGE("GHS3DPluginGUI_HypothesisCreator::retrieveParams");
- GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
- GHS3DHypothesisData data;
- readParamsFromHypo( data );
-
- if ( myName )
- myName->setText( data.myName );
-
- myToMeshHolesCheck ->setChecked ( data.myToMeshHoles );
- myToMakeGroupsOfDomains ->setChecked ( data.myToMakeGroupsOfDomains );
- myOptimizationLevelCombo ->setCurrentIndex( data.myOptimizationLevel );
- myAdvWidget->maxMemoryCheck ->setChecked ( data.myMaximumMemory > 0 );
- myAdvWidget->maxMemorySpin ->setValue ( qMax( data.myMaximumMemory,
- myAdvWidget->maxMemorySpin->minimum() ));
- myAdvWidget->initialMemoryCheck ->setChecked ( data.myInitialMemory > 0 );
- myAdvWidget->initialMemorySpin ->setValue ( qMax( data.myInitialMemory,
- myAdvWidget->initialMemorySpin->minimum() ));
- myAdvWidget->workingDirectoryLineEdit ->setText ( data.myWorkingDir );
- myAdvWidget->keepWorkingFilesCheck ->setChecked ( data.myKeepFiles );
- myAdvWidget->verboseLevelSpin ->setValue ( data.myVerboseLevel );
- myAdvWidget->createNewNodesCheck ->setChecked ( data.myToCreateNewNodes );
- myAdvWidget->removeInitialCentralPointCheck ->setChecked ( data.myRemoveInitialCentralPoint );
- myAdvWidget->boundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery );
- myAdvWidget->FEMCorrectionCheck ->setChecked ( data.myFEMCorrection );
- myAdvWidget->gradationSpinBox ->setValue ( data.myGradation );
- myAdvWidget->textOptionLineEdit ->setText ( data.myTextOption );
- myAdvWidget->logInFileCheck ->setChecked ( !data.myLogInStandardOutput );
- myAdvWidget->removeLogOnSuccessCheck ->setChecked ( data.myRemoveLogOnSuccess );
-
- TEnfVertexList::const_iterator it;
- int rowCount = 0;
- myEnforcedTableWidget->clearContents();
- myEnforcedTableWidget->setSortingEnabled(false);
- myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
- for(it = data.myEnforcedVertices.begin() ; it != data.myEnforcedVertices.end(); it++ )
- {
- TEnfVertex* enfVertex = (*it);
- myEnforcedTableWidget->setRowCount(rowCount+1);
-
- for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
- MESSAGE("Column: " << col);
-// MESSAGE("enfVertex->isCompound: " << enfVertex->isCompound);
- QTableWidgetItem* item = new QTableWidgetItem();
- item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
- switch (col) {
- case ENF_VER_NAME_COLUMN:
- item->setData( 0, enfVertex->name.c_str() );
- if (!enfVertex->geomEntry.empty()) {
- if (enfVertex->isCompound)
- item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
- else
- item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
-
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- }
- break;
- case ENF_VER_X_COLUMN:
- if (!enfVertex->isCompound) {
- item->setData( 0, enfVertex->coords.at(0) );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- }
- break;
- case ENF_VER_Y_COLUMN:
- if (!enfVertex->isCompound) {
- item->setData( 0, enfVertex->coords.at(1) );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- }
- break;
- case ENF_VER_Z_COLUMN:
- if (!enfVertex->isCompound) {
- item->setData( 0, enfVertex->coords.at(2) );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- }
- break;
- case ENF_VER_SIZE_COLUMN:
- item->setData( 0, enfVertex->size );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- break;
- case ENF_VER_ENTRY_COLUMN:
- item->setData( 0, enfVertex->geomEntry.c_str() );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- break;
- case ENF_VER_COMPOUND_COLUMN:
- item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
- item->setData( Qt::CheckStateRole, enfVertex->isCompound );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << enfVertex->isCompound);
- break;
- case ENF_VER_GROUP_COLUMN:
- item->setData( 0, enfVertex->groupName.c_str() );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- break;
- default:
- break;
- }
-
- myEnforcedTableWidget->setItem(rowCount,col,item);
- MESSAGE("Done");
- }
- that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
- rowCount++;
- }
-
- connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
- myEnforcedTableWidget->setSortingEnabled(true);
-
- for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
- myEnforcedTableWidget->resizeColumnToContents(column);
-
- // Update Enforced meshes QTableWidget
- TEnfMeshList::const_iterator itMesh;
- rowCount = 0;
- myEnforcedMeshTableWidget->clearContents();
- myEnforcedMeshTableWidget->setSortingEnabled(false);
-// myEnforcedMeshTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
- for(itMesh = data.myEnforcedMeshes.begin() ; itMesh != data.myEnforcedMeshes.end(); itMesh++ )
- {
- TEnfMesh* enfMesh = (*itMesh);
- myEnforcedMeshTableWidget->setRowCount(rowCount+1);
-
- for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
- MESSAGE("Column: " << col);
- if (col == ENF_MESH_CONSTRAINT_COLUMN) {
- QComboBox* comboBox = new QComboBox();
- QPalette pal = comboBox->palette();
- pal.setColor(QPalette::Button, Qt::white);
- comboBox->setPalette(pal);
- comboBox->insertItems(0,myEnfMeshConstraintLabels);
- comboBox->setEditable(false);
- comboBox->setCurrentIndex(enfMesh->elementType);
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
- myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
- }
- else {
- QTableWidgetItem* item = new QTableWidgetItem();
- item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
- switch (col) {
- case ENF_MESH_NAME_COLUMN:
- item->setData( 0, enfMesh->name.c_str() );
- item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- myEnforcedMeshTableWidget->setItem(rowCount,col,item);
- break;
- case ENF_MESH_ENTRY_COLUMN:
- item->setData( 0, enfMesh->entry.c_str() );
- item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- myEnforcedMeshTableWidget->setItem(rowCount,col,item);
- break;
- case ENF_MESH_GROUP_COLUMN:
- item->setData( 0, enfMesh->groupName.c_str() );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- myEnforcedMeshTableWidget->setItem(rowCount,col,item);
- break;
- default:
- break;
- }
- }
-
-// myEnforcedMeshTableWidget->setItem(rowCount,col,item);
- MESSAGE("Done");
- }
-// that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
- rowCount++;
- }
-
-// connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
- myEnforcedMeshTableWidget->setSortingEnabled(true);
-
- for (int col=0;col<ENF_MESH_NB_COLUMNS;col++)
- myEnforcedMeshTableWidget->resizeColumnToContents(col);
-
- that->updateWidgets();
- that->checkVertexIsDefined();
-}
-
-QString GHS3DPluginGUI_HypothesisCreator::storeParams() const
-{
- MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParams");
- GHS3DHypothesisData data;
- readParamsFromWidgets( data );
- storeParamsToHypo( data );
-
- QString valStr = "";
-
- if ( !data.myBoundaryRecovery )
- valStr = "-c " + QString::number( !data.myToMeshHoles );
-
- if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
- const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
- valStr += " -o ";
- valStr += level[ data.myOptimizationLevel ];
- }
- if ( data.myMaximumMemory > 0 ) {
- valStr += " -m ";
- valStr += QString::number( data.myMaximumMemory );
- }
- if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
- valStr += " -M ";
- valStr += QString::number( data.myInitialMemory );
- }
- valStr += " -v ";
- valStr += QString::number( data.myVerboseLevel );
-
- if ( !data.myToCreateNewNodes )
- valStr += " -p0";
-
- if ( data.myRemoveInitialCentralPoint )
- valStr += " -no_initial_central_point";
-
- if ( data.myBoundaryRecovery )
- valStr += " -C";
-
- if ( data.myFEMCorrection )
- valStr += " -FEM";
-
- if ( data.myGradation != 1.05 ) {
- valStr += " -Dcpropa=";
- valStr += QString::number( data.myGradation );
- }
-
- valStr += " ";
- valStr += data.myTextOption;
-
-// valStr += " #BEGIN ENFORCED VERTICES#";
-// // Add size map parameters storage
-// for (int i=0 ; i<mySmpModel->rowCount() ; i++) {
-// valStr += " (";
-// double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble();
-// double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble();
-// double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble();
-// double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble();
-// valStr += QString::number( x );
-// valStr += ",";
-// valStr += QString::number( y );
-// valStr += ",";
-// valStr += QString::number( z );
-// valStr += ")=";
-// valStr += QString::number( size );
-// if (i!=mySmpModel->rowCount()-1)
-// valStr += ";";
-// }
-// valStr += " #END ENFORCED VERTICES#";
-// MESSAGE(valStr.toStdString());
- return valStr;
-}
-
-bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& h_data ) const
-{
- MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo");
- GHS3DPlugin::GHS3DPlugin_Hypothesis_var h =
- GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( initParamsHypothesis() );
-
- HypothesisData* data = SMESH::GetHypothesisData( hypType() );
- h_data.myName = isCreation() && data ? hypName() : "";
-
- h_data.myToMeshHoles = h->GetToMeshHoles();
- h_data.myToMakeGroupsOfDomains = /*h->GetToMeshHoles() &&*/ h->GetToMakeGroupsOfDomains();
- h_data.myMaximumMemory = h->GetMaximumMemory();
- h_data.myInitialMemory = h->GetInitialMemory();
- h_data.myInitialMemory = h->GetInitialMemory();
- h_data.myOptimizationLevel = h->GetOptimizationLevel();
- h_data.myKeepFiles = h->GetKeepFiles();
- h_data.myWorkingDir = h->GetWorkingDirectory();
- h_data.myVerboseLevel = h->GetVerboseLevel();
- h_data.myToCreateNewNodes = h->GetToCreateNewNodes();
- h_data.myRemoveInitialCentralPoint = h->GetToRemoveCentralPoint();
- h_data.myBoundaryRecovery = h->GetToUseBoundaryRecoveryVersion();
- h_data.myFEMCorrection = h->GetFEMCorrection();
- h_data.myGradation = h->GetGradation();
- h_data.myTextOption = h->GetTextOption();
- h_data.myLogInStandardOutput = h->GetStandardOutputLog();
- h_data.myRemoveLogOnSuccess = h->GetRemoveLogOnSuccess();
-
- GHS3DPlugin::GHS3DEnforcedVertexList_var vertices = h->GetEnforcedVertices();
- MESSAGE("vertices->length(): " << vertices->length());
- h_data.myEnforcedVertices.clear();
- for (int i=0 ; i<vertices->length() ; i++) {
- TEnfVertex* myVertex = new TEnfVertex();
- myVertex->name = CORBA::string_dup(vertices[i].name.in());
- myVertex->geomEntry = CORBA::string_dup(vertices[i].geomEntry.in());
- myVertex->groupName = CORBA::string_dup(vertices[i].groupName.in());
- myVertex->size = vertices[i].size;
- myVertex->isCompound = vertices[i].isCompound;
- if (vertices[i].coords.length()) {
- for (int c = 0; c < vertices[i].coords.length() ; c++)
- myVertex->coords.push_back(vertices[i].coords[c]);
- MESSAGE("Add enforced vertex ("<< myVertex->coords.at(0) << ","<< myVertex->coords.at(1) << ","<< myVertex->coords.at(2) << ") ="<< myVertex->size);
- }
- h_data.myEnforcedVertices.insert(myVertex);
- }
-
- GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshes = h->GetEnforcedMeshes();
- MESSAGE("enfMeshes->length(): " << enfMeshes->length());
- h_data.myEnforcedMeshes.clear();
- for (int i=0 ; i<enfMeshes->length() ; i++) {
- TEnfMesh* myEnfMesh = new TEnfMesh();
- myEnfMesh->name = CORBA::string_dup(enfMeshes[i].name.in());
- myEnfMesh->entry = CORBA::string_dup(enfMeshes[i].entry.in());
- myEnfMesh->groupName = CORBA::string_dup(enfMeshes[i].groupName.in());
- switch (enfMeshes[i].elementType) {
- case SMESH::NODE:
- myEnfMesh->elementType = 0;
- break;
- case SMESH::EDGE:
- myEnfMesh->elementType = 1;
- break;
- case SMESH::FACE:
- myEnfMesh->elementType = 2;
- break;
- default:
- break;
- }
-// myEnfMesh->elementType = enfMeshes[i].elementType;
- h_data.myEnforcedMeshes.insert(myEnfMesh);
- }
- return true;
-}
-
-bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisData& h_data ) const
-{
- MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo");
- GHS3DPlugin::GHS3DPlugin_Hypothesis_var h =
- GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( hypothesis() );
-
- bool ok = true;
- try
- {
- if( isCreation() )
- SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() );
-
- if ( h->GetToMeshHoles() != h_data.myToMeshHoles ) // avoid duplication of DumpPython commands
- h->SetToMeshHoles ( h_data.myToMeshHoles );
- if ( h->GetToMakeGroupsOfDomains() != h_data.myToMakeGroupsOfDomains )
- h->SetToMakeGroupsOfDomains( h_data.myToMakeGroupsOfDomains );
- if ( h->GetMaximumMemory() != h_data.myMaximumMemory )
- h->SetMaximumMemory ( h_data.myMaximumMemory );
- if ( h->GetInitialMemory() != h_data.myInitialMemory )
- h->SetInitialMemory ( h_data.myInitialMemory );
- if ( h->GetInitialMemory() != h_data.myInitialMemory )
- h->SetInitialMemory ( h_data.myInitialMemory );
- if ( h->GetOptimizationLevel() != h_data.myOptimizationLevel )
- h->SetOptimizationLevel( h_data.myOptimizationLevel );
- if ( h->GetKeepFiles() != h_data.myKeepFiles )
- h->SetKeepFiles ( h_data.myKeepFiles );
- if ( h->GetWorkingDirectory() != h_data.myWorkingDir )
- h->SetWorkingDirectory ( h_data.myWorkingDir.toLatin1().constData() );
- if ( h->GetVerboseLevel() != h_data.myVerboseLevel )
- h->SetVerboseLevel ( h_data.myVerboseLevel );
- if ( h->GetToCreateNewNodes() != h_data.myToCreateNewNodes )
- h->SetToCreateNewNodes( h_data.myToCreateNewNodes );
- if ( h->GetToRemoveCentralPoint() != h_data.myRemoveInitialCentralPoint )
- h->SetToRemoveCentralPoint( h_data.myRemoveInitialCentralPoint );
- if ( h->GetToUseBoundaryRecoveryVersion() != h_data.myBoundaryRecovery )
- h->SetToUseBoundaryRecoveryVersion( h_data.myBoundaryRecovery );
- if ( h->GetFEMCorrection() != h_data.myFEMCorrection )
- h->SetFEMCorrection ( h_data.myFEMCorrection );
- if ( h->GetGradation() != h_data.myGradation )
- h->SetGradation ( h_data.myGradation );
- if ( h->GetTextOption() != h_data.myTextOption )
- h->SetTextOption ( h_data.myTextOption.toLatin1().constData() );
- if ( h->GetStandardOutputLog() != h_data.myLogInStandardOutput )
- h->SetStandardOutputLog( h_data.myLogInStandardOutput );
- if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess )
- h->SetRemoveLogOnSuccess( h_data.myRemoveLogOnSuccess );
-
- // Enforced vertices
- int nbVertex = (int) h_data.myEnforcedVertices.size();
- GHS3DPlugin::GHS3DEnforcedVertexList_var vertexHyp = h->GetEnforcedVertices();
- int nbVertexHyp = vertexHyp->length();
-
- MESSAGE("Store params for size maps: " << nbVertex << " enforced vertices");
- MESSAGE("h->GetEnforcedVertices()->length(): " << nbVertexHyp);
-
- // 1. Clear all enforced vertices in hypothesis
- // 2. Add new enforced vertex according to h_data
- if ( nbVertexHyp > 0)
- h->ClearEnforcedVertices();
-
- TEnfVertexList::const_iterator it;
- double x = 0, y = 0, z = 0;
- for(it = h_data.myEnforcedVertices.begin() ; it != h_data.myEnforcedVertices.end(); it++ ) {
- TEnfVertex* enfVertex = (*it);
- x =y =z = 0;
- if (enfVertex->coords.size()) {
- x = enfVertex->coords.at(0);
- y = enfVertex->coords.at(1);
- z = enfVertex->coords.at(2);
- }
- ok = h->p_SetEnforcedVertex( enfVertex->size, x, y, z, enfVertex->name.c_str(), enfVertex->geomEntry.c_str(), enfVertex->groupName.c_str(), enfVertex->isCompound);
- } // for
-
- // Enforced Meshes
- int nbEnfMeshes = (int) h_data.myEnforcedMeshes.size();
- GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshListHyp = h->GetEnforcedMeshes();
- int nbEnfMeshListHyp = enfMeshListHyp->length();
-
- MESSAGE("Store params for size maps: " << nbEnfMeshes << " enforced meshes");
- MESSAGE("h->GetEnforcedMeshes()->length(): " << nbEnfMeshListHyp);
-
- // 1. Clear all enforced vertices in hypothesis
- // 2. Add new enforced vertex according to h_data
- if ( nbEnfMeshListHyp > 0)
- h->ClearEnforcedMeshes();
-
- TEnfMeshList::const_iterator itEnfMesh;
-
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-
- for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
- TEnfMesh* enfMesh = (*itEnfMesh);
-
- _PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str());
- SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
-
- MESSAGE("enfMesh->elementType: " << enfMesh->elementType);
- SMESH::ElementType elementType;
- switch(enfMesh->elementType) {
- case 0:
- elementType = SMESH::NODE;
- break;
- case 1:
- elementType = SMESH::EDGE;
- break;
- case 2:
- elementType = SMESH::FACE;
- break;
- default:
- break;
- }
-
- std::cout << "h->p_SetEnforcedMesh(theSource, "<< elementType <<", \""<< enfMesh->name << "\", \"" << enfMesh->groupName.c_str() <<"\")"<<std::endl;
- ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->name.c_str(), enfMesh->groupName.c_str());
- } // for
- } // try
-// catch(const std::exception& ex) {
-// std::cout << "Exception: " << ex.what() << std::endl;
-// throw ex;
-// }
- catch ( const SALOME::SALOME_Exception& ex )
- {
- SalomeApp_Tools::QtCatchCorbaException( ex );
- ok = false;
- }
- return ok;
-}
-
-bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisData& h_data ) const
-{
- MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets");
- h_data.myName = myName ? myName->text() : "";
- h_data.myToMeshHoles = myToMeshHolesCheck->isChecked();
- h_data.myToMakeGroupsOfDomains = myToMakeGroupsOfDomains->isChecked();
- h_data.myMaximumMemory = myAdvWidget->maxMemoryCheck->isChecked() ? myAdvWidget->maxMemorySpin->value() : -1;
- h_data.myInitialMemory = myAdvWidget->initialMemoryCheck->isChecked() ? myAdvWidget->initialMemorySpin->value() : -1;
- h_data.myOptimizationLevel = myOptimizationLevelCombo->currentIndex();
- h_data.myKeepFiles = myAdvWidget->keepWorkingFilesCheck->isChecked();
- h_data.myWorkingDir = myAdvWidget->workingDirectoryLineEdit->text().trimmed();
- h_data.myVerboseLevel = myAdvWidget->verboseLevelSpin->value();
- h_data.myToCreateNewNodes = myAdvWidget->createNewNodesCheck->isChecked();
- h_data.myRemoveInitialCentralPoint = myAdvWidget->removeInitialCentralPointCheck->isChecked();
- h_data.myBoundaryRecovery = myAdvWidget->boundaryRecoveryCheck->isChecked();
- h_data.myFEMCorrection = myAdvWidget->FEMCorrectionCheck->isChecked();
- h_data.myGradation = myAdvWidget->gradationSpinBox->value();
- h_data.myTextOption = myAdvWidget->textOptionLineEdit->text();
- h_data.myLogInStandardOutput = !myAdvWidget->logInFileCheck->isChecked();
- h_data.myRemoveLogOnSuccess = myAdvWidget->removeLogOnSuccessCheck->isChecked();
-
- // Enforced vertices
- h_data.myEnforcedVertices.clear();
- QVariant valueX, valueY, valueZ;
- for (int row=0 ; row<myEnforcedTableWidget->rowCount() ; row++) {
-
- TEnfVertex *myVertex = new TEnfVertex();
- myVertex->name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
- MESSAGE("Add new enforced vertex \"" << myVertex->name << "\"" );
- myVertex->geomEntry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
- if (myVertex->geomEntry.size())
- MESSAGE("Geom entry is \"" << myVertex->geomEntry << "\"" );
- myVertex->groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
- if (myVertex->groupName.size())
- MESSAGE("Group name is \"" << myVertex->groupName << "\"" );
- valueX = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data(Qt::EditRole);
- valueY = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data(Qt::EditRole);
- valueZ = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data(Qt::EditRole);
- if (!valueX.isNull() && !valueY.isNull() && !valueZ.isNull()) {
- myVertex->coords.push_back(valueX.toDouble());
- myVertex->coords.push_back(valueY.toDouble());
- myVertex->coords.push_back(valueZ.toDouble());
- MESSAGE("Coords are (" << myVertex->coords.at(0) << ", "
- << myVertex->coords.at(1) << ", "
- << myVertex->coords.at(2) << ")");
- }
- myVertex->size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data(Qt::EditRole).toDouble();
- MESSAGE("Size is " << myVertex->size);
- myVertex->isCompound = myEnforcedTableWidget->item(row,ENF_VER_COMPOUND_COLUMN)->data(Qt::CheckStateRole).toBool();
- MESSAGE("Is compound ? " << myVertex->isCompound);
- h_data.myEnforcedVertices.insert(myVertex);
- }
-
- // Enforced meshes
- h_data.myEnforcedMeshes.clear();
-
- for (int row=0 ; row<myEnforcedMeshTableWidget->rowCount() ; row++) {
-
- TEnfMesh *myEnfMesh = new TEnfMesh();
- myEnfMesh->name = myEnforcedMeshTableWidget->item(row,ENF_MESH_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
- MESSAGE("Add new enforced mesh \"" << myEnfMesh->name << "\"" );
- myEnfMesh->entry = myEnforcedMeshTableWidget->item(row,ENF_MESH_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
- MESSAGE("Entry is \"" << myEnfMesh->entry << "\"" );
- myEnfMesh->groupName = myEnforcedMeshTableWidget->item(row,ENF_MESH_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
- MESSAGE("Group name is \"" << myEnfMesh->groupName << "\"" );
- QComboBox* combo = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row,ENF_MESH_CONSTRAINT_COLUMN));
- myEnfMesh->elementType = combo->currentIndex();
- MESSAGE("Element type: " << myEnfMesh->elementType);
- h_data.myEnforcedMeshes.insert(myEnfMesh);
- std::cout << "h_data.myEnforcedMeshes.size(): " << h_data.myEnforcedMeshes.size() << std::endl;
- }
-
- return true;
-}
-
-QString GHS3DPluginGUI_HypothesisCreator::caption() const
-{
- return tr( "GHS3D_TITLE" );
-}
-
-QPixmap GHS3DPluginGUI_HypothesisCreator::icon() const
-{
- return SUIT_Session::session()->resourceMgr()->loadPixmap( "GHS3DPlugin", tr( "ICON_DLG_GHS3D_PARAMETERS" ) );
-}
-
-QString GHS3DPluginGUI_HypothesisCreator::type() const
-{
- return tr( "GHS3D_HYPOTHESIS" );
-}
-
-QString GHS3DPluginGUI_HypothesisCreator::helpPage() const
-{
- return "ghs3d_hypo_page.html";
-}
+++ /dev/null
-// Copyright (C) 2004-2013 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.
-//
-// 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
-//
-
-// GHS3DPlugin GUI: GUI for plugged-in mesher GHS3DPlugin
-// File : GHS3DPluginGUI_HypothesisCreator.h
-// Author : Michael Zorin
-// Module : GHS3DPlugin
-//
-#ifndef GHS3DPLUGINGUI_HypothesisCreator_HeaderFile
-#define GHS3DPLUGINGUI_HypothesisCreator_HeaderFile
-
-#ifdef WIN32
- #if defined GHS3DPluginGUI_EXPORTS
- #define GHS3DPLUGINGUI_EXPORT __declspec( dllexport )
- #else
- #define GHS3DPLUGINGUI_EXPORT __declspec( dllimport )
- #endif
-#else
- #define GHS3DPLUGINGUI_EXPORT
-#endif
-
-#include <SMESHGUI_Hypotheses.h>
-#include <GeomSelectionTools.h>
-#include <TopAbs_ShapeEnum.hxx>
-
-#include <QItemDelegate>
-#include <map>
-#include <vector>
-#include <set>
-#include <GEOM_Client.hxx>
-#include CORBA_SERVER_HEADER(GHS3DPlugin_Algorithm)
-#include CORBA_SERVER_HEADER(SMESH_Gen)
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-
-class QWidget;
-class QComboBox;
-class QCheckBox;
-class QLineEdit;
-class QSpinBox;
-class QTableWidget;
-class QTableWidgetItem;
-class QHeaderView;
-
-class SMESHGUI_SpinBox;
-class StdMeshersGUI_ObjectReferenceParamWdg;
-class LightApp_SelectionMgr;
-class SUIT_SelectionFilter;
-class GHS3DPluginGUI_AdvWidget;
-
-class QTEnfVertex
-{
-
-public:
- QTEnfVertex(double size, double x=0., double y=0., double z=0., QString name="", QString geomEntry="", QString groupName="", bool isCompound = false);
-
-private:
- bool operator == (const QTEnfVertex* other) const {
- if (other) {
- if (this->coords.size() && other->coords.size())
- return (this->coords == other->coords);
- else
- return (this->geomEntry == other->geomEntry);
- }
- }
-
- QString name;
- QString geomEntry;
- bool isCompound;
- QString groupName;
- double size;
- std::vector<double> coords;
-};
-
-typedef QList< QTEnfVertex* > QEnfVertexList;
-
-// Enforced vertex
-struct TEnfVertex{
- std::string name;
- std::string geomEntry;
- bool isCompound;
- std::vector<double> coords;
- std::string groupName;
- double size;
-};
-
-struct CompareEnfVertices
-{
- bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
- if (e1 && e2) {
- if (e1->coords.size() && e2->coords.size())
- return (e1->coords < e2->coords);
- else
- return (e1->geomEntry < e2->geomEntry);
- }
- return false;
- }
-};
-
-// List of enforced vertices
-typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
-
-// Enforced mesh
-struct TEnfMesh{
- std::string name;
- std::string entry;
- int elementType;
- std::string groupName;
-};
-
-struct CompareEnfMeshes
-{
- bool operator () (const TEnfMesh* e1, const TEnfMesh* e2) const {
- if (e1 && e2) {
- if (e1->entry == e2->entry)
- return (e1->elementType < e2->elementType);
- else
- return (e1->entry < e2->entry);
- }
- else
- return false;
- }
-};
-// List of enforced meshes
-typedef std::set< TEnfMesh*, CompareEnfMeshes > TEnfMeshList;
-
-typedef struct
-{
- bool myToMeshHoles,myToMakeGroupsOfDomains,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery,myFEMCorrection,myRemoveInitialCentralPoint,
- myLogInStandardOutput, myRemoveLogOnSuccess;
- double myMaximumMemory,myInitialMemory;
- int myOptimizationLevel;
- QString myName,myWorkingDir,myTextOption;
- double myGradation;
- short myVerboseLevel;
- TEnfVertexList myEnforcedVertices;
- TEnfMeshList myEnforcedMeshes;
-} GHS3DHypothesisData;
-
-/*!
- \brief Class for creation of GHS3D2D and GHS3D3D hypotheses
-*/
-class GHS3DPLUGINGUI_EXPORT GHS3DPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
-{
- Q_OBJECT
-
-public:
- GHS3DPluginGUI_HypothesisCreator( const QString& );
- virtual ~GHS3DPluginGUI_HypothesisCreator();
-
- virtual bool checkParams(QString& msg) const;
- virtual QString helpPage() const;
-
-protected:
- virtual QFrame* buildFrame ();
- virtual void retrieveParams() const;
- virtual QString storeParams () const;
-
- virtual QString caption() const;
- virtual QPixmap icon() const;
- virtual QString type() const;
-
-protected slots:
- void onToMeshHoles(bool);
- void onDirBtnClicked();
- void updateWidgets();
-
- void addEnforcedVertex(double x=0, double y=0, double z=0, double size = 0,
- std::string vertexName = "", std::string geomEntry = "", std::string groupName = "",
- bool isCompound = false);
- void onAddEnforcedVertex();
- void onRemoveEnforcedVertex();
- void synchronizeCoords();
- void updateEnforcedVertexValues(QTableWidgetItem* );
- void onSelectEnforcedVertex();
- void clearEnforcedVertexWidgets();
- void checkVertexIsDefined();
- void clearEnfVertexSelection();
-
- void addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName = "");
- void onAddEnforcedMesh();
- void onRemoveEnforcedMesh();
- //void synchronizeEnforcedMesh();
- void checkEnfMeshIsDefined();
-
-signals:
- void vertexDefined(bool);
- void enfMeshDefined(bool);
-
-private:
- bool readParamsFromHypo( GHS3DHypothesisData& ) const;
- bool readParamsFromWidgets( GHS3DHypothesisData& ) const;
- bool storeParamsToHypo( const GHS3DHypothesisData& ) const;
- GeomSelectionTools* getGeomSelectionTool();
- GEOM::GEOM_Gen_var getGeomEngine();
-
-private:
- QWidget* myStdGroup;
- QLineEdit* myName;
- QCheckBox* myToMeshHolesCheck;
- QCheckBox* myToMakeGroupsOfDomains;
- QComboBox* myOptimizationLevelCombo;
-
- QWidget* myAdvGroup;
- GHS3DPluginGUI_AdvWidget* myAdvWidget;
-
- QWidget* myEnfGroup;
- QPixmap iconVertex, iconCompound;
- StdMeshersGUI_ObjectReferenceParamWdg *myEnfVertexWdg;
- GEOM::GEOM_Object_var myEnfVertex;
- QTableWidget* myEnforcedTableWidget;
- SMESHGUI_SpinBox* myXCoord;
- SMESHGUI_SpinBox* myYCoord;
- SMESHGUI_SpinBox* myZCoord;
- SMESHGUI_SpinBox* mySizeValue;
- QLineEdit* myGroupName;
-// QGroupBox* makeGroupsCheck;
-// QCheckBox* myGlobalGroupName;
- QPushButton* addVertexButton;
- QPushButton* removeVertexButton;
-
- QWidget* myEnfMeshGroup;
- StdMeshersGUI_ObjectReferenceParamWdg *myEnfMeshWdg;
-// SMESH::SMESH_IDSource_var myEnfMesh;
- QComboBox* myEnfMeshConstraint;
- QStringList myEnfMeshConstraintLabels;
-// SMESH::mesh_array_var myEnfMeshArray;
- QTableWidget* myEnforcedMeshTableWidget;
- QLineEdit* myMeshGroupName;
- QPushButton* addEnfMeshButton;
- QPushButton* removeEnfMeshButton;
-
- GeomSelectionTools* GeomToolSelected;
-// SVTK_Selector* mySelector;
-// LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
-};
-
-class EnforcedVertexTableWidgetDelegate : public QItemDelegate
-{
- Q_OBJECT
-
-public:
- EnforcedVertexTableWidgetDelegate(QObject *parent = 0);
-
- QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
-
- void setEditorData(QWidget *editor, const QModelIndex &index) const;
- void setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const;
-
- void updateEditorGeometry(QWidget *editor,
- const QStyleOptionViewItem &option, const QModelIndex &index) const;
-
- bool vertexExists(QAbstractItemModel *model, const QModelIndex &index, QString value) const;
-};
-
-class EnforcedMeshTableWidgetDelegate : public QItemDelegate
-{
- Q_OBJECT
-
-public:
- EnforcedMeshTableWidgetDelegate(QObject *parent = 0);
-
- QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
-
- void setEditorData(QWidget *editor, const QModelIndex &index) const;
- void setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const;
-
- void updateEditorGeometry(QWidget *editor,
- const QStyleOptionViewItem &option, const QModelIndex &index) const;
-};
-
-#endif
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.0" language="en_US">
- <context>
- <name>@default</name>
- <message>
- <source>ICON_DLG_GHS3D_PARAMETERS</source>
- <translation>mesh_hypo_ghs3d.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_TREE_ALGO_GHS3D_3D</source>
- <translation>mesh_tree_hypo_ghs3d.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_TREE_HYPO_GHS3D_Parameters</source>
- <translation>mesh_tree_hypo_ghs3d.png</translation>
- </message>
- </context>
-</TS>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.0" language="en_US">
-<context>
- <name>@default</name>
- <message>
- <source>GHS3D_ADV_ARGS</source>
- <translation>Advanced</translation>
- </message>
- <message>
- <source>GHS3D_HYPOTHESIS</source>
- <translation>GHS3D</translation>
- </message>
- <message>
- <source>GHS3D_OPTIMIZATIOL_LEVEL</source>
- <translation>Optimization level</translation>
- </message>
- <message>
- <source>GHS3D_PERMISSION_DENIED</source>
- <translation>Working directory is not writable</translation>
- </message>
- <message>
- <source>GHS3D_STD_ARGS</source>
- <translation>Parameters</translation>
- </message>
- <message>
- <source>GHS3D_TITLE</source>
- <translation>Hypothesis Construction</translation>
- </message>
- <message>
- <source>GHS3D_TO_MESH_HOLES</source>
- <translation>Mesh holes</translation>
- </message>
- <message>
- <source>GHS3D_TO_MAKE_DOMAIN_GROUPS</source>
- <translation>Make groups of domains</translation>
- </message>
- <message>
- <source>ADVANCED_MESHING_GROUP_TITLE</source>
- <translation>Advanced meshing options</translation>
- </message>
- <message>
- <source>INIT_MEMORY_SIZE</source>
- <translation>Initial memory size</translation>
- </message>
- <message>
- <source>KEEP_WORKING_FILES</source>
- <translation>Keep all working files</translation>
- </message>
- <message>
- <source>LEVEL_NONE</source>
- <translation>None</translation>
- </message>
- <message>
- <source>LEVEL_LIGHT</source>
- <translation>Light</translation>
- </message>
- <message>
- <source>LEVEL_MEDIUM</source>
- <translation>Medium (standard)</translation>
- </message>
- <message>
- <source>LEVEL_STANDARDPLUS</source>
- <translation>Standard+</translation>
- </message>
- <message>
- <source>LEVEL_STRONG</source>
- <translation>Strong</translation>
- </message>
- <message>
- <source>LOG_IN_FILE</source>
- <translation>Print log in a file</translation>
- </message>
- <message>
- <source>LOG_GROUP_TITLE</source>
- <translation>Logs and debug</translation>
- </message>
- <message>
- <source>MAX_MEMORY_SIZE</source>
- <translation>Maximum memory size</translation>
- </message>
- <message>
- <source>MEGABYTE</source>
- <translation>MB</translation>
- </message>
- <message>
- <source>MEMORY_GROUP_TITLE</source>
- <translation>Memory settings</translation>
- </message>
- <message>
- <source>NO_INITIAL_CENTRAL_POINT</source>
- <translation>Remove initial central point</translation>
- </message>
- <message>
- <source>RECOVERY_VERSION</source>
- <translation>Use boundary recovery version</translation>
- </message>
- <message>
- <source>FEM_CORRECTION</source>
- <translation>Use FEM correction</translation>
- </message>
- <message>
- <source>GHS3D_GRADATION</source>
- <translation>Volumic gradation</translation>
- </message>
- <message>
- <source>REMOVE_LOG_ON_SUCCESS</source>
- <translation>Remove log on success</translation>
- </message>
- <message>
- <source>SELECT_DIR</source>
- <translation>...</translation>
- </message>
- <message>
- <source>TEXT_OPTION</source>
- <translation>Option as text</translation>
- </message>
- <message>
- <source>TO_ADD_NODES</source>
- <translation>Create new nodes</translation>
- </message>
- <message>
- <source>VERBOSE_LEVEL</source>
- <translation>Verbose level</translation>
- </message>
- <message>
- <source>WORKING_DIR</source>
- <translation>Working directory</translation>
- </message>
- <message>
- <source>GHS3D_ENFORCED_VERTICES</source>
- <translation>Enforced vertices</translation>
- </message>
- <message>
- <source>GHS3D_ENFORCED_MESHES</source>
- <translation>Enforced meshes</translation>
- </message>
- <message>
- <source>GHS3D_ENF_NAME_COLUMN</source>
- <translation>Name</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_X_COLUMN</source>
- <translation>X</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_Y_COLUMN</source>
- <translation>Y</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_Z_COLUMN</source>
- <translation>Z</translation>
- </message>
- <message>
- <source>GHS3D_ENF_SIZE_COLUMN</source>
- <translation>Size</translation>
- </message>
- <message>
- <source>GHS3D_ENF_ENTRY_COLUMN</source>
- <translation>Vertex Entry</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_COLUMN</source>
- <translation>Constraint</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_COMPOUND_COLUMN</source>
- <translation>Compound</translation>
- </message>
- <message>
- <source>GHS3D_ENF_GROUP_COLUMN</source>
- <translation>Group</translation>
- </message>
- <message>
- <source>GHS3D_ENF_SELECT_VERTEX</source>
- <translation>Select a vertex</translation>
- </message>
- <message>
- <source>GHS3D_ENF_SELECT_MESH</source>
- <translation>Select a mesh</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_X_LABEL</source>
- <translation>X:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_Y_LABEL</source>
- <translation>Y:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_Z_LABEL</source>
- <translation>Z:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_LABEL</source>
- <translation>Constraint:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_NODE</source>
- <translation>Nodes</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_EDGE</source>
- <translation>Edges</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_FACE</source>
- <translation>Faces</translation>
- </message>
- <message>
- <source>GHS3D_ENF_SIZE_LABEL</source>
- <translation>Size:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_GROUP_LABEL</source>
- <translation>Group:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_ADD</source>
- <translation>Add</translation>
- </message>
- <message>
- <source>GHS3D_ENF_REMOVE</source>
- <translation>Remove</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_INFO</source>
- <translation><b>Warning</b>: Enforced vertices are currently only taken into account for meshes w/o associated geometry.</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_INFO</source>
- <translation><b>Warning</b>: Enforced meshes are currently only taken into account for meshes w/o associated geometry.</translation>
- </message>
-</context>
-</TS>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.0" language="fr_FR">
-<context>
- <name>@default</name>
- <message>
- <source>GHS3D_TO_MAKE_DOMAIN_GROUPS</source>
- <translation>Pour créer des groupes de domaines</translation>
- </message>
- <message>
- <source>GHS3D_ADV_ARGS</source>
- <translation>Avancé</translation>
- </message>
- <message>
- <source>GHS3D_HYPOTHESIS</source>
- <translation>GHS3D</translation>
- </message>
- <message>
- <source>GHS3D_OPTIMIZATIOL_LEVEL</source>
- <translation>Niveau d'optimisation</translation>
- </message>
- <message>
- <source>GHS3D_PERMISSION_DENIED</source>
- <translation>Il n'est pas possible d'écrire dans le répertoire</translation>
- </message>
- <message>
- <source>GHS3D_STD_ARGS</source>
- <translation>Paramètres</translation>
- </message>
- <message>
- <source>GHS3D_TITLE</source>
- <translation>Construction de l'hypothèse </translation>
- </message>
- <message>
- <source>GHS3D_TO_MESH_HOLES</source>
- <translation>Mailler les trous</translation>
- </message>
- <message>
- <source>ADVANCED_MESHING_GROUP_TITLE</source>
- <translation>Options de maillage avancées</translation>
- </message>
- <message>
- <source>INIT_MEMORY_SIZE</source>
- <translation>Taille initiale de la mémoire</translation>
- </message>
- <message>
- <source>KEEP_WORKING_FILES</source>
- <translation>Conserver tous les fichiers temporaires</translation>
- </message>
- <message>
- <source>LEVEL_NONE</source>
- <translation>Zéro</translation>
- </message>
- <message>
- <source>LEVEL_LIGHT</source>
- <translation>Léger</translation>
- </message>
- <message>
- <source>LEVEL_MEDIUM</source>
- <translation>Moyen (standard)</translation>
- </message>
- <message>
- <source>LEVEL_STANDARDPLUS</source>
- <translation>Standard+</translation>
- </message>
- <message>
- <source>LEVEL_STRONG</source>
- <translation>Fort</translation>
- </message>
- <message>
- <source>LOG_IN_FILE</source>
- <translation>Imprimer le log dans un fichier</translation>
- </message>
- <message>
- <source>LOG_GROUP_TITLE</source>
- <translation>Logs et debug</translation>
- </message>
- <message>
- <source>MAX_MEMORY_SIZE</source>
- <translation>Taille maximale de la mémoire</translation>
- </message>
- <message>
- <source>MEGABYTE</source>
- <translation>Megabytes</translation>
- </message>
- <message>
- <source>MEMORY_GROUP_TITLE</source>
- <translation>Paramètres mémoire</translation>
- </message>
- <message>
- <source>NO_INITIAL_CENTRAL_POINT</source>
- <translation>Supprimer le point central initial</translation>
- </message>
- <message>
- <source>RECOVERY_VERSION</source>
- <translation>Utiliser la version de restauration des frontières</translation>
- </message>
- <message>
- <source>FEM_CORRECTION</source>
- <translation>Utiliser la correction FEM</translation>
- </message>
- <message>
- <source>GHS3D_GRADATION</source>
- <translation>Gradation volumique</translation>
- </message>
- <message>
- <source>REMOVE_LOG_ON_SUCCESS</source>
- <translation>Supprimer le log en cas de succès</translation>
- </message>
- <message>
- <source>SELECT_DIR</source>
- <translation>...</translation>
- </message>
- <message>
- <source>TEXT_OPTION</source>
- <translation>Option comme texte</translation>
- </message>
- <message>
- <source>TO_ADD_NODES</source>
- <translation>Créer de nouveaux nœuds</translation>
- </message>
- <message>
- <source>VERBOSE_LEVEL</source>
- <translation>Niveau de verbosité</translation>
- </message>
- <message>
- <source>WORKING_DIR</source>
- <translation>Répertoire de travail</translation>
- </message>
- <message>
- <source>GHS3D_ENFORCED_VERTICES</source>
- <translation>Points de passage</translation>
- </message>
- <message>
- <source>GHS3D_ENFORCED_MESHES</source>
- <translation>Maillages de contrainte</translation>
- </message>
- <message>
- <source>GHS3D_ENF_NAME_COLUMN</source>
- <translation>Nom</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_X_COLUMN</source>
- <translation>X</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_Y_COLUMN</source>
- <translation>Y</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_Z_COLUMN</source>
- <translation>Z</translation>
- </message>
- <message>
- <source>GHS3D_ENF_SIZE_COLUMN</source>
- <translation>Taille</translation>
- </message>
- <message>
- <source>GHS3D_ENF_ENTRY_COLUMN</source>
- <translation>ID de point</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_COLUMN</source>
- <translation>Contrainte</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_COMPOUND_COLUMN</source>
- <translation>Compound</translation>
- </message>
- <message>
- <source>GHS3D_ENF_GROUP_COLUMN</source>
- <translation>Groupe</translation>
- </message>
- <message>
- <source>GHS3D_ENF_SELECT_VERTEX</source>
- <translation>Sélectionnez une/des point(s)</translation>
- </message>
- <message>
- <source>GHS3D_ENF_SELECT_MESH</source>
- <translation>Sélectionnez une/des maillage(s)</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_X_LABEL</source>
- <translation>X:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_Y_LABEL</source>
- <translation>Y:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_Z_LABEL</source>
- <translation>Z:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_LABEL</source>
- <translation>Contrainte:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_NODE</source>
- <translation>Noeuds</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_EDGE</source>
- <translation>Segments</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_FACE</source>
- <translation>Faces</translation>
- </message>
- <message>
- <source>GHS3D_ENF_SIZE_LABEL</source>
- <translation>Taille:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_GROUP_LABEL</source>
- <translation>Groupe:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_ADD</source>
- <translation>Ajouter</translation>
- </message>
- <message>
- <source>GHS3D_ENF_REMOVE</source>
- <translation>Supprimer</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_INFO</source>
- <translation><b>Attention</b>: Les points de passage ne sont pris en compte que pour des maillage sans géométrie associée.</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_INFO</source>
- <translation><b>Attention</b>: Les éléments de contraintes ne sont pris en compte que pour des maillage sans géométrie associée.</translation>
- </message>
-</context>
-</TS>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS>
- <context>
- <name>@default</name>
- <message>
- <source>GHS3D_ADV_ARGS</source>
- <translation>高度な</translation>
- </message>
- <message>
- <source>GHS3D_HYPOTHESIS</source>
- <translation>GHS3D</translation>
- </message>
- <message>
- <source>GHS3D_OPTIMIZATIOL_LEVEL</source>
- <translation>最適化のレベル</translation>
- </message>
- <message>
- <source>GHS3D_PERMISSION_DENIED</source>
- <translation>ディレクトリを作成することはできません。</translation>
- </message>
- <message>
- <source>GHS3D_STD_ARGS</source>
- <translation>パラメーター</translation>
- </message>
- <message>
- <source>GHS3D_TITLE</source>
- <translation>仮説の構築</translation>
- </message>
- <message>
- <source>GHS3D_TO_MESH_HOLES</source>
- <translation>メッシュの穴</translation>
- </message>
- <message>
- <source>GHS3D_TO_MAKE_DOMAIN_GROUPS</source>
- <translation>ドメインのグループを確認するには</translation>
- </message>
- <message>
- <source>ADVANCED_MESHING_GROUP_TITLE</source>
- <translation>高度なメッシュ オプション</translation>
- </message>
- <message>
- <source>INIT_MEMORY_SIZE</source>
- <translation>初期メモリのサイズ、</translation>
- </message>
- <message>
- <source>KEEP_WORKING_FILES</source>
- <translation>すべての一時ファイルを保持します。</translation>
- </message>
- <message>
- <source>LEVEL_NONE</source>
- <translation>なし</translation>
- </message>
- <message>
- <source>LEVEL_LIGHT</source>
- <translation>光</translation>
- </message>
- <message>
- <source>LEVEL_MEDIUM</source>
- <translation>(標準) の方法</translation>
- </message>
- <message>
- <source>LEVEL_STANDARDPLUS</source>
- <translation>標準</translation>
- </message>
- <message>
- <source>LEVEL_STRONG</source>
- <translation>砦</translation>
- </message>
- <message>
- <source>LOG_IN_FILE</source>
- <translation>ログ ファイルへの印刷します。</translation>
- </message>
- <message>
- <source>LOG_GROUP_TITLE</source>
- <translation>Et のログをデバッグ</translation>
- </message>
- <message>
- <source>MAX_MEMORY_SIZE</source>
- <translation>最大メモリ サイズ</translation>
- </message>
- <message>
- <source>MEGABYTE</source>
- <translation>メガバイト</translation>
- </message>
- <message>
- <source>MEMORY_GROUP_TITLE</source>
- <translation>メモリの設定</translation>
- </message>
- <message>
- <source>NO_INITIAL_CENTRAL_POINT</source>
- <translation>元の中心点を削除します。</translation>
- </message>
- <message>
- <source>RECOVERY_VERSION</source>
- <translation>バージョン境界の復元を使用します。</translation>
- </message>
- <message>
- <source>FEM_CORRECTION</source>
- <translation>GEF 補正を使用してください。</translation>
- </message>
- <message>
- <source>GHS3D_GRADATION</source>
- <translation>ボリュームのグラデーション</translation>
- </message>
- <message>
- <source>REMOVE_LOG_ON_SUCCESS</source>
- <translation>削除ログ成功</translation>
- </message>
- <message>
- <source>SELECT_DIR</source>
- <translation>...</translation>
- </message>
- <message>
- <source>TEXT_OPTION</source>
- <translation>テキスト オプション</translation>
- </message>
- <message>
- <source>TO_ADD_NODES</source>
- <translation>新しいノードを作成します。</translation>
- </message>
- <message>
- <source>VERBOSE_LEVEL</source>
- <translation>詳細レベル</translation>
- </message>
- <message>
- <source>WORKING_DIR</source>
- <translation>作業ディレクトリ</translation>
- </message>
- <message>
- <source>GHS3D_ENFORCED_VERTICES</source>
- <translation>交差点</translation>
- </message>
- <message>
- <source>GHS3D_ENFORCED_MESHES</source>
- <translation>制約メッシュ</translation>
- </message>
- <message>
- <source>GHS3D_ENF_NAME_COLUMN</source>
- <translation>名前</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_X_COLUMN</source>
- <translation>X</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_Y_COLUMN</source>
- <translation>そこ</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_Z_COLUMN</source>
- <translation>Z</translation>
- </message>
- <message>
- <source>GHS3D_ENF_SIZE_COLUMN</source>
- <translation>サイズ</translation>
- </message>
- <message>
- <source>GHS3D_ENF_ENTRY_COLUMN</source>
- <translation>ポイント ID</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_COLUMN</source>
- <translation>制約</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_COMPOUND_COLUMN</source>
- <translation>複合</translation>
- </message>
- <message>
- <source>GHS3D_ENF_GROUP_COLUMN</source>
- <translation>グループ</translation>
- </message>
- <message>
- <source>GHS3D_ENF_SELECT_VERTEX</source>
- <translation>・ ポイント (s) の選択</translation>
- </message>
- <message>
- <source>GHS3D_ENF_SELECT_MESH</source>
- <translation>1 つを選択/メッシュ (s)</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_X_LABEL</source>
- <translation>X:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_Y_LABEL</source>
- <translation>Y:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_Z_LABEL</source>
- <translation>Z:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_LABEL</source>
- <translation>制約:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_NODE</source>
- <translation>節点</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_EDGE</source>
- <translation>セグメント</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_CONSTRAINT_FACE</source>
- <translation>Faces</translation>
- </message>
- <message>
- <source>GHS3D_ENF_SIZE_LABEL</source>
- <translation>サイズ:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_GROUP_LABEL</source>
- <translation>グループ:</translation>
- </message>
- <message>
- <source>GHS3D_ENF_ADD</source>
- <translation>追加</translation>
- </message>
- <message>
- <source>GHS3D_ENF_REMOVE</source>
- <translation>削除</translation>
- </message>
- <message>
- <source>GHS3D_ENF_VER_INFO</source>
- <translation><b>注意</b>: 交差ポイント関連ジオメトリなしメッシュが考慮されます。</translation>
- </message>
- <message>
- <source>GHS3D_ENF_MESH_INFO</source>
- <translation><b>注意</b>: 要素制約の関連付けられたジオメトリなしメッシュ考慮されます。</translation>
- </message>
- </context>
-</TS>
--- /dev/null
+// Copyright (C) 2007-2013 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// ---
+// File : GHS3DPluginGUI.cxx
+// Authors : Gilles DAVID (Euriware)
+// ---
+//
+#include "GHS3DPluginGUI_HypothesisCreator.h"
+
+//=============================================================================
+/*! GetHypothesisCreator
+ *
+ */
+//=============================================================================
+extern "C"
+{
+ GHS3DPLUGINGUI_EXPORT
+ SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& aHypType )
+ {
+ SMESHGUI_GenericHypothesisCreator* aCreator = NULL;
+ if ( aHypType == "GHS3D_Parameters" )
+ aCreator = new GHS3DPluginGUI_HypothesisCreator( aHypType );
+ return aCreator;
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2013 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// ---
+// File : GHS3DPluginGUI_Dlg.cxx
+// Authors : Renaud NEDELEC (OCC)
+// ---
+//
+
+#include "GHS3DPluginGUI_Dlg.h"
+
+#include <QFileDialog>
+
+#include <iostream>
+
+
+//////////////////////////////////////////
+// GHS3DPluginGUI_AdvWidget
+//////////////////////////////////////////
+
+GHS3DPluginGUI_AdvWidget::GHS3DPluginGUI_AdvWidget( QWidget* parent, Qt::WindowFlags f )
+: QWidget( parent, f )
+{
+ setupUi( this );
+}
+
+GHS3DPluginGUI_AdvWidget::~GHS3DPluginGUI_AdvWidget()
+{
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>GHS3DPluginGUI_AdvWidget_QTD</class>
+ <widget class="QWidget" name="GHS3DPluginGUI_AdvWidget_QTD">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>465</width>
+ <height>477</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="memoryGroupBox">
+ <property name="title">
+ <string>Memory settings</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="3" column="4">
+ <widget class="QLabel" name="maxMemoryLabel">
+ <property name="text">
+ <string>MB</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="initialMemoryCheck">
+ <property name="text">
+ <string>Initial memory size</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="maxMemoryCheck">
+ <property name="text">
+ <string>Max memory size</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="4">
+ <widget class="QLabel" name="initialMemoryLabel">
+ <property name="text">
+ <string>MB</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2" colspan="2">
+ <widget class="SMESHGUI_SpinBox" name="initialMemorySpin">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2" colspan="2">
+ <widget class="SMESHGUI_SpinBox" name="maxMemorySpin">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="logGroupBox">
+ <property name="title">
+ <string>Logs and debug</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="workingDirectoryLabel">
+ <property name="text">
+ <string>Working directory</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="workingDirectoryLineEdit"/>
+ </item>
+ <item row="0" column="2">
+ <widget class="QPushButton" name="workingDirectoryPushButton">
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="verboseLevelLabel">
+ <property name="text">
+ <string>Verbose level</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="verboseLevelSpin"/>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QCheckBox" name="logInFileCheck">
+ <property name="text">
+ <string>Print log in a file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="removeLogOnSuccessCheck">
+ <property name="text">
+ <string>Remove log file on success</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="keepWorkingFilesCheck">
+ <property name="text">
+ <string>Keep working files</string>
+ </property>
+ <property name="autoExclusive">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="advancedMeshingGroupBox">
+ <property name="title">
+ <string>Advanced meshing options</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="7" column="1">
+ <widget class="QLineEdit" name="textOptionLineEdit"/>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="gradationLabel">
+ <property name="text">
+ <string>Volumic gradation</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0">
+ <widget class="QLabel" name="textOptionLabel">
+ <property name="text">
+ <string>Option as text</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="SMESHGUI_SpinBox" name="gradationSpinBox"/>
+ </item>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="createNewNodesCheck">
+ <property name="text">
+ <string>Create new nodes</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="removeInitialCentralPointCheck">
+ <property name="text">
+ <string>Remove initial central point</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="FEMCorrectionCheck">
+ <property name="text">
+ <string>Use FEM correction</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="boundaryRecoveryCheck">
+ <property name="text">
+ <string>Use boundary recovery version</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>SMESHGUI_SpinBox</class>
+ <extends>QSpinBox</extends>
+ <header>SMESHGUI_SpinBox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null
+// Copyright (C) 2007-2013 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : GHS3DPluginGUI_Dlg.h
+// Author : Renaud NEDELEC (OpenCascade)
+
+#ifndef GHS3DPLUGINGUI_H
+#define GHS3DPLUGINGUI_H
+
+//////////////////////////////////////////
+// GHS3DPluginGUI_AdvWidget
+//////////////////////////////////////////
+
+#include "ui_GHS3DPluginGUI_AdvWidget_QTD.h"
+#include "GHS3DPluginGUI_HypothesisCreator.h"
+
+class GHS3DPLUGINGUI_EXPORT GHS3DPluginGUI_AdvWidget : public QWidget,
+ public Ui::GHS3DPluginGUI_AdvWidget_QTD
+{
+ Q_OBJECT
+
+public:
+ GHS3DPluginGUI_AdvWidget( QWidget* = 0, Qt::WindowFlags = 0 );
+ ~GHS3DPluginGUI_AdvWidget();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// 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
+//
+
+// GHS3DPlugin GUI: GUI for plugged-in mesher GHS3DPlugin
+// File : GHS3DPluginGUI_Enums.h
+// Author : Gilles DAVID (Euriware)
+// Module : GHS3DPlugin
+//
+#ifndef GHS3DPLUGINGUI_Enums_HeaderFile
+#define GHS3DPLUGINGUI_Enums_HeaderFile
+
+// tabs
+enum {
+ STD_TAB = 0,
+ ADV_TAB,
+ ENF_VER_TAB,
+ ENF_MESH_TAB
+};
+
+// Enforced vertices array columns
+enum {
+ ENF_VER_NAME_COLUMN = 0,
+ ENF_VER_X_COLUMN,
+ ENF_VER_Y_COLUMN,
+ ENF_VER_Z_COLUMN,
+ ENF_VER_SIZE_COLUMN,
+ ENF_VER_ENTRY_COLUMN,
+ ENF_VER_COMPOUND_COLUMN,
+ ENF_VER_GROUP_COLUMN,
+ ENF_VER_NB_COLUMNS
+};
+
+// Enforced meshes array columns
+enum {
+ ENF_MESH_NAME_COLUMN = 0,
+ ENF_MESH_ENTRY_COLUMN,
+ ENF_MESH_CONSTRAINT_COLUMN,
+ ENF_MESH_GROUP_COLUMN,
+ ENF_MESH_NB_COLUMNS
+};
+
+// Enforced vertices widget inputs
+enum {
+ ENF_VER_WARNING = 0,
+ ENF_VER_VERTEX = 0,
+ ENF_VER_X_COORD,
+ ENF_VER_Y_COORD,
+ ENF_VER_Z_COORD,
+ ENF_VER_SIZE,
+ ENF_VER_GROUP,
+ ENF_VER_BTN,
+ ENF_VER_NB_LINES
+};
+
+// Enforced meshes widget inputs
+enum {
+ ENF_MESH_WARNING = 0,
+ ENF_MESH_MESH = 0,
+ ENF_MESH_CONSTRAINT,
+ ENF_MESH_GROUP,
+ ENF_MESH_BTN,
+ ENF_MESH_NB_LINES
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// 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
+//
+
+// GHS3DPlugin GUI: GUI for plugged-in mesher GHS3DPlugin
+// File : GHS3DPluginGUI_HypothesisCreator.cxx
+// Author : Michael Zorin
+// Module : GHS3DPlugin
+//
+#include "GHS3DPluginGUI_HypothesisCreator.h"
+#include "GHS3DPluginGUI_Enums.h"
+#include "GHS3DPluginGUI_Dlg.h"
+
+#include <GeometryGUI.h>
+
+#include <SMESHGUI_Utils.h>
+#include <SMESHGUI_SpinBox.h>
+#include <SMESHGUI_HypothesesUtils.h>
+#include <SMESH_NumberFilter.hxx>
+#include <SMESH_TypeFilter.hxx>
+#include <StdMeshersGUI_ObjectReferenceParamWdg.h>
+
+#include <LightApp_SelectionMgr.h>
+#include <SUIT_Session.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_FileDlg.h>
+#include <SalomeApp_Tools.h>
+#include <SalomeApp_TypeFilter.h>
+
+#include <TopoDS_Iterator.hxx>
+
+#include <QComboBox>
+#include <QPalette>
+#include <QLabel>
+#include <QFrame>
+#include <QVBoxLayout>
+#include <QGridLayout>
+#include <QLineEdit>
+#include <QCheckBox>
+#include <QTabWidget>
+#include <QSpinBox>
+#include <QPushButton>
+#include <QFileInfo>
+#include <QGroupBox>
+
+#include <QTableWidget>
+#include <QTableWidgetItem>
+#include <QHeaderView>
+
+#include <stdexcept>
+#include <utilities.h>
+
+#include <boost/algorithm/string.hpp>
+
+namespace {
+
+#ifdef WIN32
+#include <windows.h>
+#else
+#include <sys/sysinfo.h>
+#endif
+
+ int maxAvailableMemory()
+ {
+#ifdef WIN32
+ // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
+ MEMORYSTATUSEX statex;
+ statex.dwLength = sizeof (statex);
+ int err = GlobalMemoryStatusEx (&statex);
+ if (err != 0) {
+ int totMB =
+ statex.ullTotalPhys / 1024 / 1024 +
+ statex.ullTotalPageFile / 1024 / 1024 +
+ statex.ullTotalVirtual / 1024 / 1024;
+ return (int) ( 0.7 * totMB );
+ }
+#else
+ struct sysinfo si;
+ int err = sysinfo( &si );
+ if ( err == 0 ) {
+ int totMB =
+ si.totalram * si.mem_unit / 1024 / 1024 +
+ si.totalswap * si.mem_unit / 1024 / 1024 ;
+ return (int) ( 0.7 * totMB );
+ }
+#endif
+ return 0;
+ }
+}
+
+//
+// BEGIN EnforcedVertexTableWidgetDelegate
+//
+
+EnforcedVertexTableWidgetDelegate::EnforcedVertexTableWidgetDelegate(QObject *parent)
+ : QItemDelegate(parent)
+{
+}
+
+QWidget *EnforcedVertexTableWidgetDelegate::createEditor(QWidget *parent,
+ const QStyleOptionViewItem & option ,
+ const QModelIndex & index ) const
+{
+ QModelIndex father = index.parent();
+ QString entry = father.child(index.row(), ENF_VER_ENTRY_COLUMN).data().toString();
+
+ if (index.column() == ENF_VER_X_COLUMN ||
+ index.column() == ENF_VER_Y_COLUMN ||
+ index.column() == ENF_VER_Z_COLUMN ||
+ index.column() == ENF_VER_SIZE_COLUMN) {
+ SMESHGUI_SpinBox *editor = new SMESHGUI_SpinBox(parent);
+ if (index.column() == ENF_VER_SIZE_COLUMN)
+ editor->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
+ else
+ editor->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
+ editor->setReadOnly(!entry.isEmpty());
+ editor->setDisabled(!entry.isEmpty());
+ return editor;
+ }
+// else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
+// QCheckBox *editor = new QCheckBox(parent);
+// editor->setDisabled(!entry.isEmpty());
+// return editor;
+// }
+ else if (index.column() == ENF_VER_GROUP_COLUMN ||
+ index.column() == ENF_VER_NAME_COLUMN) {
+// else {
+ QLineEdit *editor = new QLineEdit(parent);
+ if (index.column() != ENF_VER_GROUP_COLUMN) {
+ editor->setReadOnly(!entry.isEmpty());
+ editor->setDisabled(!entry.isEmpty());
+ }
+ return editor;
+ }
+ return QItemDelegate::createEditor(parent, option, index);
+}
+
+void EnforcedVertexTableWidgetDelegate::setEditorData(QWidget *editor,
+ const QModelIndex &index) const
+{
+ if (index.column() == ENF_VER_X_COLUMN ||
+ index.column() == ENF_VER_Y_COLUMN ||
+ index.column() == ENF_VER_Z_COLUMN ||
+ index.column() == ENF_VER_SIZE_COLUMN)
+ {
+ SMESHGUI_SpinBox *lineEdit = qobject_cast<SMESHGUI_SpinBox*>(editor);
+ lineEdit->SetValue(index.data().toDouble());
+ }
+ else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
+ QCheckBox *checkBox = qobject_cast<QCheckBox*>(editor);
+ checkBox->setChecked(index.data().toBool());
+ }
+ else {
+ QItemDelegate::setEditorData(editor, index);
+ }
+}
+
+void EnforcedVertexTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
+ const QModelIndex &index) const
+{
+ QModelIndex parent = index.parent();
+
+ QString entry = parent.child(index.row(), ENF_VER_ENTRY_COLUMN).data().toString();
+ bool isCompound = parent.child(index.row(), ENF_VER_COMPOUND_COLUMN).data(Qt::CheckStateRole).toBool();
+
+ if (index.column() == ENF_VER_X_COLUMN ||
+ index.column() == ENF_VER_Y_COLUMN ||
+ index.column() == ENF_VER_Z_COLUMN) {
+ SMESHGUI_SpinBox *lineEdit = qobject_cast<SMESHGUI_SpinBox*>(editor);
+ if (!isCompound && !vertexExists(model, index, lineEdit->GetString()))
+ model->setData(index, lineEdit->GetValue(), Qt::EditRole);
+ }
+ else if (index.column() == ENF_VER_SIZE_COLUMN)
+ {
+ SMESHGUI_SpinBox *lineEdit = qobject_cast<SMESHGUI_SpinBox*>(editor);
+ const double newsize = lineEdit->GetValue();
+ if (newsize > 0)
+ model->setData(index, newsize, Qt::EditRole);
+ }
+ else if (index.column() == ENF_VER_NAME_COLUMN) {
+ QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
+ QString value = lineEdit->text();
+ if (entry.isEmpty() && !vertexExists(model, index, value))
+ model->setData(index, value, Qt::EditRole);
+ }
+ else if (index.column() == ENF_VER_ENTRY_COLUMN) {
+ QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
+ QString value = lineEdit->text();
+ if (! vertexExists(model, index, value))
+ model->setData(index, value, Qt::EditRole);
+ }
+ else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
+ QCheckBox *checkBox = qobject_cast<QCheckBox*>(editor);
+ model->setData(index, checkBox->isChecked(), Qt::CheckStateRole);
+ }
+ else {
+ QItemDelegate::setModelData(editor, model, index);
+ }
+}
+
+void EnforcedVertexTableWidgetDelegate::updateEditorGeometry(QWidget *editor,
+ const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
+{
+ editor->setGeometry(option.rect);
+}
+
+bool EnforcedVertexTableWidgetDelegate::vertexExists(QAbstractItemModel *model,
+ const QModelIndex &index,
+ QString value) const
+{
+ bool exists = false;
+ QModelIndex parent = index.parent();
+ int row = index.row();
+ int col = index.column();
+
+ if (parent.isValid() && !value.isEmpty()) {
+ if (col == ENF_VER_X_COLUMN || col == ENF_VER_Y_COLUMN || col == ENF_VER_Z_COLUMN) {
+ double x, y, z;
+ if (col == ENF_VER_X_COLUMN) {
+ x = value.toDouble();
+ y = parent.child(row, ENF_VER_Y_COLUMN).data().toDouble();
+ z = parent.child(row, ENF_VER_Z_COLUMN).data().toDouble();
+ }
+ if (col == ENF_VER_Y_COLUMN) {
+ y = value.toDouble();
+ x = parent.child(row, ENF_VER_X_COLUMN).data().toDouble();
+ z = parent.child(row, ENF_VER_Z_COLUMN).data().toDouble();
+ }
+ if (col == ENF_VER_Z_COLUMN) {
+ z = value.toDouble();
+ x = parent.child(row, ENF_VER_X_COLUMN).data().toDouble();
+ y = parent.child(row, ENF_VER_Y_COLUMN).data().toDouble();
+ }
+ int nbChildren = model->rowCount(parent);
+ for (int i = 0 ; i < nbChildren ; i++) {
+ if (i != row) {
+ double childX = parent.child(i, ENF_VER_X_COLUMN).data().toDouble();
+ double childY = parent.child(i, ENF_VER_Y_COLUMN).data().toDouble();
+ double childZ = parent.child(i, ENF_VER_Z_COLUMN).data().toDouble();
+ if ((childX == x) && (childY == y) && (childZ == z)) {
+ exists = true;
+ break;
+ }
+ }
+ }
+ }
+ else if (col == ENF_VER_NAME_COLUMN) {
+ QString name = parent.child(row, ENF_VER_NAME_COLUMN).data().toString();
+ if (name == value)
+ exists = true;
+ }
+ }
+
+ return exists;
+}
+
+//
+// END EnforcedVertexTableWidgetDelegate
+//
+
+//
+// BEGIN EnforcedMeshTableWidgetDelegate
+//
+
+EnforcedMeshTableWidgetDelegate::EnforcedMeshTableWidgetDelegate(QObject *parent)
+ : QItemDelegate(parent)
+{
+}
+
+QWidget *EnforcedMeshTableWidgetDelegate::createEditor(QWidget *parent,
+ const QStyleOptionViewItem & option ,
+ const QModelIndex & index ) const
+{
+ return QItemDelegate::createEditor(parent, option, index);
+}
+
+void EnforcedMeshTableWidgetDelegate::setEditorData(QWidget *editor,
+ const QModelIndex &index) const
+{
+ QItemDelegate::setEditorData(editor, index);
+}
+
+void EnforcedMeshTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
+ const QModelIndex &index) const
+{
+ QItemDelegate::setModelData(editor, model, index);
+
+}
+
+void EnforcedMeshTableWidgetDelegate::updateEditorGeometry(QWidget *editor,
+ const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
+{
+ editor->setGeometry(option.rect);
+}
+
+// bool EnforcedMeshTableWidgetDelegate::enfMeshExists(QAbstractItemModel *model,
+// const QModelIndex &index,
+// QString value) const
+// {
+// bool exists = false;
+// QModelIndex parent = index.parent();
+// int row = index.row();
+// int col = index.column();
+// return exists;
+// }
+
+//
+// END EnforcedMeshTableWidgetDelegate
+//
+
+
+GHS3DPluginGUI_HypothesisCreator::GHS3DPluginGUI_HypothesisCreator( const QString& theHypType )
+: SMESHGUI_GenericHypothesisCreator( theHypType )
+{
+ GeomToolSelected = NULL;
+ GeomToolSelected = getGeomSelectionTool();
+
+ iconVertex = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_OBJBROWSER_VERTEX")));
+ iconCompound = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_OBJBROWSER_COMPOUND")));
+// mySelectionMgr = SMESH::GetSelectionMgr(SMESHGUI::GetSMESHGUI());
+ myEnfMeshConstraintLabels << tr( "GHS3D_ENF_MESH_CONSTRAINT_NODE" ) << tr( "GHS3D_ENF_MESH_CONSTRAINT_EDGE" ) << tr("GHS3D_ENF_MESH_CONSTRAINT_FACE");
+}
+
+GHS3DPluginGUI_HypothesisCreator::~GHS3DPluginGUI_HypothesisCreator()
+{
+ GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
+ that->getGeomSelectionTool()->selectionMgr()->clearFilters();
+ myEnfMeshWdg->deactivateSelection();
+}
+
+/**
+ * \brief {Get or create the geom selection tool for active study}
+ * */
+GeomSelectionTools* GHS3DPluginGUI_HypothesisCreator::getGeomSelectionTool()
+{
+ GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
+ _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) {
+ that->GeomToolSelected = new GeomSelectionTools(aStudy);
+ }
+ return that->GeomToolSelected;
+}
+
+GEOM::GEOM_Gen_var GHS3DPluginGUI_HypothesisCreator::getGeomEngine()
+{
+ return GeometryGUI::GetGeomGen();
+}
+
+QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
+{
+ QFrame* fr = new QFrame( 0 );
+ QVBoxLayout* lay = new QVBoxLayout( fr );
+ lay->setMargin( 5 );
+ lay->setSpacing( 0 );
+
+ // tab
+ QTabWidget* tab = new QTabWidget( fr );
+ tab->setTabShape( QTabWidget::Rounded );
+ tab->setTabPosition( QTabWidget::North );
+ lay->addWidget( tab );
+
+ // basic parameters
+ myStdGroup = new QWidget();
+ QGridLayout* aStdLayout = new QGridLayout( myStdGroup );
+ aStdLayout->setSpacing( 6 );
+ aStdLayout->setMargin( 11 );
+
+ int row = 0;
+ myName = 0;
+ if( isCreation() )
+ {
+ aStdLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), myStdGroup ), row, 0, 1, 1 );
+ myName = new QLineEdit( myStdGroup );
+ aStdLayout->addWidget( myName, row++, 1, 1, 1 );
+ }
+
+ myToMeshHolesCheck = new QCheckBox( tr( "GHS3D_TO_MESH_HOLES" ), myStdGroup );
+ aStdLayout->addWidget( myToMeshHolesCheck, row, 0, 1, 1 );
+ myToMakeGroupsOfDomains = new QCheckBox( tr( "GHS3D_TO_MAKE_DOMAIN_GROUPS" ), myStdGroup );
+ aStdLayout->addWidget( myToMakeGroupsOfDomains, row++, 1, 1, 1 );
+
+ aStdLayout->addWidget( new QLabel( tr( "GHS3D_OPTIMIZATIOL_LEVEL" ), myStdGroup ), row, 0, 1, 1 );
+ myOptimizationLevelCombo = new QComboBox( myStdGroup );
+ aStdLayout->addWidget( myOptimizationLevelCombo, row++, 1, 1, 1 );
+
+ QStringList types;
+ types << tr( "LEVEL_NONE" ) << tr( "LEVEL_LIGHT" ) << tr( "LEVEL_MEDIUM" ) << tr( "LEVEL_STANDARDPLUS" ) << tr( "LEVEL_STRONG" );
+ myOptimizationLevelCombo->addItems( types );
+
+ aStdLayout->setRowStretch( row, 10 );
+
+ // advanced parameters
+ myAdvGroup = new QWidget();
+ QGridLayout* anAdvLayout = new QGridLayout( myAdvGroup );
+ anAdvLayout->setSpacing( 6 );
+ anAdvLayout->setMargin( 11 );
+ myAdvWidget = new GHS3DPluginGUI_AdvWidget(myAdvGroup);
+ anAdvLayout->addWidget( myAdvWidget);
+
+ myAdvWidget->maxMemoryCheck->setText(tr( "MAX_MEMORY_SIZE" ));
+ myAdvWidget->initialMemoryCheck->setText(tr( "INIT_MEMORY_SIZE" ));
+
+ myAdvWidget->maxMemorySpin->RangeStepAndValidator(20.0, 1e6, 10.0);
+ myAdvWidget->maxMemorySpin->setValue( 128.0 );
+
+ myAdvWidget->initialMemorySpin->RangeStepAndValidator(0.0, 1e6, 10.0);
+ myAdvWidget->initialMemorySpin->setValue( 100.0 );
+
+ myAdvWidget->initialMemoryLabel ->setText (tr( "MEGABYTE" ));
+ myAdvWidget->maxMemoryLabel ->setText (tr( "MEGABYTE" ));
+
+ myAdvWidget->workingDirectoryLabel ->setText (tr( "WORKING_DIR" ));
+ myAdvWidget->workingDirectoryPushButton ->setText (tr( "SELECT_DIR" ));
+ myAdvWidget->keepWorkingFilesCheck ->setText (tr( "KEEP_WORKING_FILES" ));
+ myAdvWidget->verboseLevelLabel ->setText (tr( "VERBOSE_LEVEL" ));
+ myAdvWidget->removeLogOnSuccessCheck ->setText (tr( "REMOVE_LOG_ON_SUCCESS" ));
+ myAdvWidget->logInFileCheck ->setText (tr( "LOG_IN_FILE" ));
+
+ myAdvWidget->memoryGroupBox ->setTitle(tr( "MEMORY_GROUP_TITLE" ));
+ myAdvWidget->logGroupBox ->setTitle(tr( "LOG_GROUP_TITLE" ));
+ myAdvWidget->advancedMeshingGroupBox ->setTitle(tr( "ADVANCED_MESHING_GROUP_TITLE" ));
+
+ myAdvWidget->createNewNodesCheck ->setText (tr( "TO_ADD_NODES" ));
+ myAdvWidget->removeInitialCentralPointCheck->setText (tr( "NO_INITIAL_CENTRAL_POINT" ));
+ myAdvWidget->boundaryRecoveryCheck ->setText (tr( "RECOVERY_VERSION" ));
+ myAdvWidget->FEMCorrectionCheck ->setText (tr( "FEM_CORRECTION" ));
+ myAdvWidget->gradationLabel ->setText (tr( "GHS3D_GRADATION" ));
+ myAdvWidget->gradationSpinBox->RangeStepAndValidator(1.05, 5.0, 0.05, "length_precision");
+ myAdvWidget->textOptionLabel->setText(tr( "TEXT_OPTION" ));
+
+ // Enforced vertices parameters
+ myEnfGroup = new QWidget();
+ QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
+
+ myEnforcedTableWidget = new QTableWidget(myEnfGroup);
+ myEnforcedTableWidget ->setMinimumWidth(300);
+ myEnforcedTableWidget->setRowCount( 0 );
+ myEnforcedTableWidget->setColumnCount( ENF_VER_NB_COLUMNS );
+ myEnforcedTableWidget->setSortingEnabled(true);
+ QStringList enforcedHeaders;
+ enforcedHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
+ << tr( "GHS3D_ENF_VER_X_COLUMN" )<< tr( "GHS3D_ENF_VER_Y_COLUMN" ) << tr( "GHS3D_ENF_VER_Z_COLUMN" )
+ << tr( "GHS3D_ENF_SIZE_COLUMN" ) << tr("GHS3D_ENF_ENTRY_COLUMN") << tr("GHS3D_ENF_VER_COMPOUND_COLUMN") << tr( "GHS3D_ENF_GROUP_COLUMN" );
+
+ myEnforcedTableWidget->setHorizontalHeaderLabels(enforcedHeaders);
+ myEnforcedTableWidget->verticalHeader()->hide();
+ myEnforcedTableWidget->horizontalHeader()->setStretchLastSection(true);
+ myEnforcedTableWidget->setAlternatingRowColors(true);
+ myEnforcedTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ myEnforcedTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
+ myEnforcedTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
+ myEnforcedTableWidget->resizeColumnsToContents();
+ myEnforcedTableWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
+ myEnforcedTableWidget->hideColumn(ENF_VER_COMPOUND_COLUMN);
+
+ myEnforcedTableWidget->setItemDelegate(new EnforcedVertexTableWidgetDelegate());
+
+// VERTEX SELECTION
+ TColStd_MapOfInteger shapeTypes;
+ shapeTypes.Add( TopAbs_VERTEX );
+ shapeTypes.Add( TopAbs_COMPOUND );
+
+ SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes);
+ myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true, /*stretch=*/false);
+ myEnfVertexWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_VERTEX"), "QLineEdit { color: grey }");
+
+ QLabel* myXCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_X_LABEL" ), myEnfGroup );
+ myXCoord = new SMESHGUI_SpinBox(myEnfGroup);
+ myXCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
+ QLabel* myYCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_Y_LABEL" ), myEnfGroup );
+ myYCoord = new SMESHGUI_SpinBox(myEnfGroup);
+ myYCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
+ QLabel* myZCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_Z_LABEL" ), myEnfGroup );
+ myZCoord = new SMESHGUI_SpinBox(myEnfGroup);
+ myZCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
+ QLabel* mySizeLabel = new QLabel( tr( "GHS3D_ENF_SIZE_LABEL" ), myEnfGroup );
+ mySizeValue = new SMESHGUI_SpinBox(myEnfGroup);
+ mySizeValue->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
+
+ QLabel* myGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfGroup );
+ myGroupName = new QLineEdit(myEnfGroup);
+
+ addVertexButton = new QPushButton(tr("GHS3D_ENF_ADD"),myEnfGroup);
+ addVertexButton->setEnabled(false);
+ removeVertexButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfGroup);
+// myGlobalGroupName = new QCheckBox(tr("GHS3D_ENF_VER_GROUPS"), myEnfGroup);
+// myGlobalGroupName->setChecked(false);
+
+ // QGroupBox* GroupBox = new QGroupBox( myEnfGroup );
+ // QLabel* info = new QLabel( GroupBox );
+ // info->setText( tr( "GHS3D_ENF_VER_INFO" ) );
+ // info->setWordWrap( true );
+ // QVBoxLayout* GroupBoxVLayout = new QVBoxLayout( GroupBox );
+ // GroupBoxVLayout->setSpacing( 6 );
+ // GroupBoxVLayout->setMargin( 11 );
+ // GroupBoxVLayout->addWidget( info );
+
+
+ //anEnfLayout->addWidget(GroupBox, ENF_VER_WARNING, 0, 1, 2 );
+ anEnfLayout->addWidget(myEnforcedTableWidget, ENF_VER_VERTEX, 0, ENF_VER_NB_LINES, 1);
+
+ QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
+ anEnfLayout2->addWidget(myEnfVertexWdg, ENF_VER_VERTEX, 0, 1, 2);
+ anEnfLayout2->addWidget(myXCoordLabel, ENF_VER_X_COORD, 0, 1, 1);
+ anEnfLayout2->addWidget(myXCoord, ENF_VER_X_COORD, 1, 1, 1);
+ anEnfLayout2->addWidget(myYCoordLabel, ENF_VER_Y_COORD, 0, 1, 1);
+ anEnfLayout2->addWidget(myYCoord, ENF_VER_Y_COORD, 1, 1, 1);
+ anEnfLayout2->addWidget(myZCoordLabel, ENF_VER_Z_COORD, 0, 1, 1);
+ anEnfLayout2->addWidget(myZCoord, ENF_VER_Z_COORD, 1, 1, 1);
+ anEnfLayout2->addWidget(mySizeLabel, ENF_VER_SIZE, 0, 1, 1);
+ anEnfLayout2->addWidget(mySizeValue, ENF_VER_SIZE, 1, 1, 1);
+ anEnfLayout2->addWidget(myGroupNameLabel, ENF_VER_GROUP, 0, 1, 1);
+ anEnfLayout2->addWidget(myGroupName, ENF_VER_GROUP, 1, 1, 1);
+ anEnfLayout2->addWidget(addVertexButton, ENF_VER_BTN, 0, 1, 1);
+ anEnfLayout2->addWidget(removeVertexButton, ENF_VER_BTN, 1, 1, 1);
+ anEnfLayout2->setRowStretch(ENF_VER_NB_LINES, 1);
+
+ anEnfLayout->addLayout(anEnfLayout2, ENF_VER_VERTEX, 1,ENF_VER_NB_LINES, 1);
+ anEnfLayout->setRowStretch(ENF_VER_VERTEX, 10);
+
+
+ // Enforced meshes parameters
+ myEnfMeshGroup = new QWidget();
+ QGridLayout* anEnfMeshLayout = new QGridLayout(myEnfMeshGroup);
+
+ myEnforcedMeshTableWidget = new QTableWidget(myEnfGroup);
+ myEnforcedMeshTableWidget->setRowCount( 0 );
+ myEnforcedMeshTableWidget->setColumnCount( ENF_MESH_NB_COLUMNS );
+ myEnforcedMeshTableWidget->setSortingEnabled(true);
+ myEnforcedMeshTableWidget->verticalHeader()->hide();
+ QStringList enforcedMeshHeaders;
+ enforcedMeshHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
+ << tr( "GHS3D_ENF_ENTRY_COLUMN" )
+ << tr( "GHS3D_ENF_MESH_CONSTRAINT_COLUMN" )
+ << tr( "GHS3D_ENF_GROUP_COLUMN" );
+ myEnforcedMeshTableWidget->setHorizontalHeaderLabels(enforcedMeshHeaders);
+ myEnforcedMeshTableWidget->horizontalHeader()->setStretchLastSection(true);
+ myEnforcedMeshTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
+ myEnforcedMeshTableWidget->setAlternatingRowColors(true);
+ myEnforcedMeshTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ myEnforcedMeshTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
+ myEnforcedMeshTableWidget->resizeColumnsToContents();
+ myEnforcedMeshTableWidget->hideColumn(ENF_MESH_ENTRY_COLUMN);
+
+ myEnforcedMeshTableWidget->setItemDelegate(new EnforcedMeshTableWidgetDelegate());
+
+// myEnfMesh = SMESH::SMESH_Mesh::_nil();
+// myEnfMeshArray = new SMESH::mesh_array();
+
+ myEnfMeshWdg = new StdMeshersGUI_ObjectReferenceParamWdg( SMESH::IDSOURCE, myEnfMeshGroup, /*multiSel=*/true);
+ myEnfMeshWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_MESH"), "QLineEdit { color: grey }");
+
+ myEnfMeshWdg->AvoidSimultaneousSelection(myEnfVertexWdg);
+
+ QLabel* myMeshConstraintLabel = new QLabel( tr( "GHS3D_ENF_MESH_CONSTRAINT_LABEL" ), myEnfMeshGroup );
+ myEnfMeshConstraint = new QComboBox(myEnfMeshGroup);
+ myEnfMeshConstraint->insertItems(0,myEnfMeshConstraintLabels);
+ myEnfMeshConstraint->setEditable(false);
+ myEnfMeshConstraint->setCurrentIndex(0);
+
+ QLabel* myMeshGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfMeshGroup );
+ myMeshGroupName = new QLineEdit(myEnfMeshGroup);
+
+ addEnfMeshButton = new QPushButton(tr("GHS3D_ENF_ADD"),myEnfMeshGroup);
+// addEnfMeshButton->setEnabled(false);
+ removeEnfMeshButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfMeshGroup);
+
+ // QGroupBox* GroupBox2 = new QGroupBox( myEnfMeshGroup );
+ // QLabel* info2 = new QLabel( GroupBox2 );
+ // info2->setText( tr( "GHS3D_ENF_MESH_INFO" ) );
+ // info2->setWordWrap( true );
+ // QVBoxLayout* GroupBox2VLayout = new QVBoxLayout( GroupBox2 );
+ // GroupBox2VLayout->setSpacing( 6 );
+ // GroupBox2VLayout->setMargin( 11 );
+ // GroupBox2VLayout->addWidget( info2 );
+
+ // anEnfMeshLayout->addWidget( GroupBox2, ENF_MESH_WARNING, 0, 1, 2 );
+ anEnfMeshLayout->addWidget(myEnforcedMeshTableWidget, ENF_MESH_MESH, 0, ENF_MESH_NB_LINES , 1);
+
+ QGridLayout* anEnfMeshLayout2 = new QGridLayout(myEnfMeshGroup);
+ anEnfMeshLayout2->addWidget(myEnfMeshWdg, ENF_MESH_MESH, 0, 1, 2);
+ anEnfMeshLayout2->addWidget(myMeshConstraintLabel, ENF_MESH_CONSTRAINT, 0, 1, 1);
+ anEnfMeshLayout2->addWidget(myEnfMeshConstraint, ENF_MESH_CONSTRAINT, 1, 1, 1);
+ anEnfMeshLayout2->addWidget(myMeshGroupNameLabel, ENF_MESH_GROUP, 0, 1, 1);
+ anEnfMeshLayout2->addWidget(myMeshGroupName, ENF_MESH_GROUP, 1, 1, 1);
+ anEnfMeshLayout2->addWidget(addEnfMeshButton, ENF_MESH_BTN, 0, 1, 1);
+ anEnfMeshLayout2->addWidget(removeEnfMeshButton, ENF_MESH_BTN, 1, 1, 1);
+ anEnfMeshLayout2->setRowStretch(ENF_MESH_NB_LINES, 1);
+
+ anEnfMeshLayout->addLayout(anEnfMeshLayout2, ENF_MESH_MESH, 1, ENF_MESH_NB_LINES, 1);
+ anEnfMeshLayout->setRowStretch(ENF_MESH_MESH, 10);
+
+ // add tabs
+ tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
+ tab->insertTab( ADV_TAB, myAdvGroup, tr( "GHS3D_ADV_ARGS" ) );
+ tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "GHS3D_ENFORCED_VERTICES" ) );
+ tab->insertTab( ENF_MESH_TAB, myEnfMeshGroup, tr( "GHS3D_ENFORCED_MESHES" ) );
+ tab->setCurrentIndex( STD_TAB );
+
+ // connections
+ //connect( myToMeshHolesCheck, SIGNAL( toggled( bool ) ), this, SLOT( onToMeshHoles(bool)));
+ connect( myAdvWidget->maxMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
+ connect( myAdvWidget->initialMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
+ connect( myAdvWidget->boundaryRecoveryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
+ connect( myAdvWidget->logInFileCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
+ connect( myAdvWidget->keepWorkingFilesCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
+ connect( myAdvWidget->workingDirectoryPushButton, SIGNAL( clicked() ), this, SLOT( onDirBtnClicked() ) );
+
+ connect( myEnforcedTableWidget, SIGNAL( itemClicked(QTableWidgetItem *)), this, SLOT( synchronizeCoords() ) );
+ connect( myEnforcedTableWidget, SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
+ connect( myEnforcedTableWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( synchronizeCoords() ) );
+ connect( addVertexButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedVertex() ) );
+ connect( removeVertexButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedVertex() ) );
+ connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
+ connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
+ connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ connect( mySizeValue, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) );
+ connect( myXCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ connect( myYCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ connect( myZCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ connect( mySizeValue, SIGNAL( valueChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) );
+ connect( this, SIGNAL( vertexDefined(bool) ), addVertexButton, SLOT( setEnabled(bool) ) );
+
+ connect( addEnfMeshButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedMesh() ) );
+ connect( removeEnfMeshButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedMesh() ) );
+// connect( myEnfMeshWdg, SIGNAL( contentModified()), this, SLOT( checkEnfMeshIsDefined() ) );
+// connect( myEnfMeshConstraint, SIGNAL( currentIndexChanged(int) ), this, SLOT( checkEnfMeshIsDefined() ) );
+// connect( this, SIGNAL( enfMeshDefined(bool) ), addEnfMeshButton, SLOT( setEnabled(bool) ) );
+
+ return fr;
+}
+
+/**
+ * This method checks if an enforced vertex is defined;
+**/
+void GHS3DPluginGUI_HypothesisCreator::clearEnfVertexSelection()
+{
+ if (myEnfVertexWdg->NbObjects() != 0) {
+ disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
+ disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
+ myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
+ connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
+ connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
+ }
+ GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
+ that->checkVertexIsDefined();
+}
+
+/**
+ * This method checks if an enforced vertex is defined;
+**/
+void GHS3DPluginGUI_HypothesisCreator::checkVertexIsDefined()
+{
+ bool enfVertexIsDefined = false;
+ enfVertexIsDefined = (!mySizeValue->GetString().isEmpty() &&
+ (!myEnfVertexWdg->NbObjects() == 0 ||
+ (myEnfVertexWdg->NbObjects() == 0 && !myXCoord->GetString().isEmpty()
+ && !myYCoord->GetString().isEmpty()
+ && !myZCoord->GetString().isEmpty())));
+ emit vertexDefined(enfVertexIsDefined);
+}
+
+/**
+ * This method checks if an enforced mesh is defined;
+**/
+void GHS3DPluginGUI_HypothesisCreator::checkEnfMeshIsDefined()
+{
+ emit enfMeshDefined( myEnfVertexWdg->NbObjects() != 0);
+}
+
+/**
+ * This method resets the content of the X, Y, Z, size and GroupName widgets;
+**/
+void GHS3DPluginGUI_HypothesisCreator::clearEnforcedVertexWidgets()
+{
+ myXCoord->setCleared(true);
+ myYCoord->setCleared(true);
+ myZCoord->setCleared(true);
+// mySizeValue->setCleared(true);
+ myXCoord->setText("");
+ myYCoord->setText("");
+ myZCoord->setText("");
+// mySizeValue->setText("");
+// myGroupName->setText("");
+ addVertexButton->setEnabled(false);
+}
+
+/** GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(item)
+This method updates the tooltip of a modified item. The QLineEdit widgets content
+is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
+*/
+void GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetItem* item) {
+// MESSAGE("GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues");
+ int row = myEnforcedTableWidget->row(item);
+
+ QVariant vertexName = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole);
+ QVariant x = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data( Qt::EditRole);
+ QVariant y = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data( Qt::EditRole);
+ QVariant z = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data( Qt::EditRole);
+ QVariant size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data( Qt::EditRole);
+ QVariant entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
+ QString groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data( Qt::EditRole).toString();
+
+ clearEnforcedVertexWidgets();
+
+ if ( !x.isNull() || !entry.isNull()) {
+ QString toolTip = vertexName.toString();
+ toolTip += QString("(");
+ if (entry.isNull() || (!entry.isNull() && entry.toString() == "")) {
+ toolTip += x.toString();
+ toolTip += QString(", ") + y.toString();
+ toolTip += QString(", ") + z.toString();
+ }
+ else
+ toolTip += entry.toString();
+ toolTip += QString(")");
+
+ if (!size.isNull())
+ toolTip += QString("=") + size.toString();
+
+ if (!groupName.isEmpty())
+ toolTip += QString(" [") + groupName + QString("]");
+
+// MESSAGE("Tooltip: " << toolTip.toStdString());
+ for (int col=0;col<ENF_VER_NB_COLUMNS;col++)
+ myEnforcedTableWidget->item(row,col)->setToolTip(toolTip);
+
+ if (!x.isNull()) {
+ disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ myXCoord->SetValue(x.toDouble());
+ myYCoord->SetValue(y.toDouble());
+ myZCoord->SetValue(z.toDouble());
+ connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ }
+ if (!size.isNull())
+ mySizeValue->SetValue(size.toDouble());
+
+ if (!groupName.isEmpty())
+ myGroupName->setText(groupName);
+ }
+}
+
+void GHS3DPluginGUI_HypothesisCreator::onSelectEnforcedVertex() {
+ int nbSelEnfVertex = myEnfVertexWdg->NbObjects();
+ clearEnforcedVertexWidgets();
+ if (nbSelEnfVertex == 1)
+ {
+ if ( CORBA::is_nil( getGeomEngine() ) && !GeometryGUI::InitGeomGen() )
+ return ;
+
+ myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(nbSelEnfVertex-1);
+ if (myEnfVertex == GEOM::GEOM_Object::_nil())
+ return;
+ if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
+ GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
+ GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
+ if (CORBA::is_nil(measureOp))
+ return;
+
+ CORBA::Double x,y,z;
+ measureOp->PointCoordinates (myEnfVertex, x, y, z);
+ if ( measureOp->IsDone() )
+ {
+ disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ myXCoord->SetValue(x);
+ myYCoord->SetValue(y);
+ myZCoord->SetValue(z);
+ connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ }
+ }
+ }
+}
+
+/** GHS3DPluginGUI_HypothesisCreator::synchronizeCoords()
+This method synchronizes the QLineEdit/SMESHGUI_SpinBox widgets content with the coordinates
+of the enforced vertex clicked in the tree widget.
+*/
+void GHS3DPluginGUI_HypothesisCreator::synchronizeCoords() {
+ clearEnforcedVertexWidgets();
+ QList<QTableWidgetItem *> items = myEnforcedTableWidget->selectedItems();
+// myEnfVertexWdg->disconnect(SIGNAL(contentModified()));
+ disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
+ if (! items.isEmpty()) {
+ QTableWidgetItem *item;
+ int row;
+ QVariant entry;
+ if (items.size() == 1) {
+ item = items[0];
+ row = myEnforcedTableWidget->row(item);
+ QVariant x = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data( Qt::EditRole);
+ QVariant y = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data( Qt::EditRole);
+ QVariant z = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data( Qt::EditRole);
+ QVariant size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data( Qt::EditRole);
+ entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
+ if (!entry.isNull()) {
+ SMESH::string_array_var objIds = new SMESH::string_array;
+ objIds->length(1);
+ objIds[0] = entry.toString().toStdString().c_str();
+ myEnfVertexWdg->SetObjects(objIds);
+ }
+ else {
+ myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
+ }
+ QVariant group = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data( Qt::EditRole);
+ if (!x.isNull()/* && entry.isNull()*/) {
+// disconnect( myXCoord, SIGNAL( textChanged(const QString &)), this, SLOT( onSelectEnforcedVertex() ) );
+ disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ myXCoord->SetValue(x.toDouble());
+ myYCoord->SetValue(y.toDouble());
+ myZCoord->SetValue(z.toDouble());
+ connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
+ }
+ if (!size.isNull())
+ mySizeValue->SetValue(size.toDouble());
+
+ if (!group.isNull() && (!x.isNull() || !entry.isNull()))
+ myGroupName->setText(group.toString());
+ }
+ else {
+ QList<QString> entryList;
+ for (int i = 0; i < items.size(); ++i) {
+ item = items[i];
+ row = myEnforcedTableWidget->row(item);
+ entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
+ if (!entry.isNull())
+ entryList << entry.toString();
+ }
+ if (entryList.size() > 0) {
+ SMESH::string_array_var objIds = new SMESH::string_array;
+ objIds->length(entryList.size());
+ for (int i = 0; i < entryList.size() ; i++)
+ objIds[i] = entryList.at(i).toStdString().c_str();
+ myEnfVertexWdg->SetObjects(objIds);
+ }
+ else {
+ myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
+ }
+ }
+ }
+ else {
+ myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
+ }
+ connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
+ GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
+ that->checkVertexIsDefined();
+}
+
+/** GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh( meshName, geomEntry, elemType, size, groupName)
+This method adds in the tree widget an enforced mesh from mesh, submesh or group with optionally size and and groupName.
+*/
+void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName)
+{
+ MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", \"" << groupName << "\")");
+ bool okToCreate = true;
+ QString itemEntry = "";
+ int itemElementType = 0;
+ int rowCount = myEnforcedMeshTableWidget->rowCount();
+ bool allColumns = true;
+ for (int row = 0;row<rowCount;row++) {
+ for (int col = 0 ; col < ENF_MESH_NB_COLUMNS ; col++) {
+ MESSAGE("col: " << col);
+ if (col == ENF_MESH_CONSTRAINT_COLUMN){
+ if (qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col)) == 0) {
+ allColumns = false;
+ MESSAGE("allColumns = false");
+ break;
+ }
+ }
+ else if (myEnforcedMeshTableWidget->item(row, col) == 0) {
+ allColumns = false;
+ MESSAGE("allColumns = false");
+ break;
+ }
+ if (col == ENF_MESH_CONSTRAINT_COLUMN) {
+ QComboBox* itemComboBox = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col));
+ itemElementType = itemComboBox->currentIndex();
+ MESSAGE("itemElementType: " << itemElementType);
+ }
+ else if (col == ENF_MESH_ENTRY_COLUMN)
+ itemEntry = myEnforcedMeshTableWidget->item(row, col)->data(Qt::EditRole).toString();
+ }
+
+ if (!allColumns)
+ break;
+
+ if (itemEntry == QString(entry.c_str()) && itemElementType == elementType) {
+// // update group name
+// if (itemGroupName.toStdString() != groupName) {
+// MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
+// myEnforcedMeshTableWidget->item(row, ENF_MESH_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
+// }
+ okToCreate = false;
+ break;
+ } // if
+ } // for
+
+
+ if (!okToCreate)
+ return;
+
+ MESSAGE("Creation of enforced mesh");
+
+ myEnforcedMeshTableWidget->setRowCount(rowCount+1);
+ myEnforcedMeshTableWidget->setSortingEnabled(false);
+
+ for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
+ MESSAGE("Column: " << col);
+ if (col == ENF_MESH_CONSTRAINT_COLUMN) {
+ QComboBox* comboBox = new QComboBox();
+ QPalette pal = comboBox->palette();
+ pal.setColor(QPalette::Button, Qt::white);
+ comboBox->setPalette(pal);
+ comboBox->insertItems(0,myEnfMeshConstraintLabels);
+ comboBox->setEditable(false);
+ comboBox->setCurrentIndex(elementType);
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
+ myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
+ }
+ else {
+ QTableWidgetItem* item = new QTableWidgetItem();
+ item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
+ switch (col) {
+ case ENF_MESH_NAME_COLUMN:
+ item->setData( 0, name.c_str() );
+ item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+ break;
+ case ENF_MESH_ENTRY_COLUMN:
+ item->setData( 0, entry.c_str() );
+ item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+ break;
+ case ENF_MESH_GROUP_COLUMN:
+ item->setData( 0, groupName.c_str() );
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+ break;
+ default:
+ break;
+ }
+ }
+ MESSAGE("Done");
+ }
+
+// connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
+
+ myEnforcedMeshTableWidget->setSortingEnabled(true);
+// myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
+// updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
+
+}
+
+/** GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex( x, y, z, size, vertexName, geomEntry, groupName)
+This method adds in the tree widget an enforced vertex with given size and coords (x,y,z) or GEOM vertex or compound and with optionally groupName.
+*/
+void GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z, double size, std::string vertexName, std::string geomEntry, std::string groupName, bool isCompound)
+{
+ MESSAGE("addEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ", \"" << vertexName << ", \"" << geomEntry << "\", \"" << groupName << "\", " << isCompound << ")");
+ myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
+ bool okToCreate = true;
+ double itemX,itemY,itemZ,itemSize = 0;
+ QString itemEntry, itemGroupName = QString("");
+// bool itemIsCompound;
+ int rowCount = myEnforcedTableWidget->rowCount();
+ QVariant data;
+ bool allColumns;
+ for (int row = 0;row<rowCount;row++) {
+ allColumns = true;
+ for (int col = 0 ; col < ENF_VER_NB_COLUMNS ; col++) {
+ if (myEnforcedTableWidget->item(row, col) == 0) {
+ allColumns = false;
+ break;
+ }
+
+ data = myEnforcedTableWidget->item(row, col)->data(Qt::EditRole);
+ if (!data.isNull()) {
+ switch (col) {
+ case ENF_VER_GROUP_COLUMN:
+ itemGroupName = data.toString();
+ break;
+ case ENF_VER_ENTRY_COLUMN:
+ itemEntry = data.toString();
+ break;
+// case ENF_VER_COMPOUND_COLUMN:
+// itemIsCompound = data.toBool();
+// break;
+ case ENF_VER_X_COLUMN:
+ itemX = data.toDouble();
+ break;
+ case ENF_VER_Y_COLUMN:
+ itemY = data.toDouble();
+ break;
+ case ENF_VER_Z_COLUMN:
+ itemZ = data.toDouble();
+ break;
+ case ENF_VER_SIZE_COLUMN:
+ itemSize = data.toDouble();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!allColumns)
+ break;
+
+
+ if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) || /*( (itemEntry.toStdString() != "") && */ (itemEntry.toStdString() == geomEntry)/*)*/) {
+ // update size
+ if (itemSize != size) {
+ MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
+ myEnforcedTableWidget->item(row, ENF_VER_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size));
+ }
+ // update group name
+ if (itemGroupName.toStdString() != groupName) {
+ MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
+ myEnforcedTableWidget->item(row, ENF_VER_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
+ }
+ okToCreate = false;
+ break;
+ } // if
+ } // for
+ if (!okToCreate) {
+ if (geomEntry.empty()) {
+ MESSAGE("Vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
+ }
+ else {
+ MESSAGE("Vertex with entry " << geomEntry << " already exist: dont create again");
+ }
+ return;
+ }
+
+ if (geomEntry.empty()) {
+ MESSAGE("Vertex with coords " << x << ", " << y << ", " << z<< " is created");
+ }
+ else {
+ MESSAGE("Vertex with geom entry " << geomEntry << " is created");
+ }
+
+ int vertexIndex=0;
+ int indexRef = -1;
+ QString myVertexName;
+ while(indexRef != vertexIndex) {
+ indexRef = vertexIndex;
+ if (vertexName.empty())
+ myVertexName = QString("Vertex #%1").arg(vertexIndex);
+ else
+ myVertexName = QString(vertexName.c_str());
+
+ for (int row = 0;row<rowCount;row++) {
+ QString name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString();
+ if (myVertexName == name) {
+ vertexIndex++;
+ break;
+ }
+ }
+ }
+
+ MESSAGE("myVertexName is \"" << myVertexName.toStdString() << "\"");
+ myEnforcedTableWidget->setRowCount(rowCount+1);
+ myEnforcedTableWidget->setSortingEnabled(false);
+ for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
+ MESSAGE("Column: " << col);
+ QTableWidgetItem* item = new QTableWidgetItem();
+ item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
+ switch (col) {
+ case ENF_VER_NAME_COLUMN:
+ item->setData( Qt::EditRole, myVertexName );
+ if (!geomEntry.empty()) {
+ if (isCompound)
+ item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
+ else
+ item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
+ }
+ break;
+ case ENF_VER_X_COLUMN:
+ if (!isCompound)
+ item->setData( 0, QVariant(x) );
+ break;
+ case ENF_VER_Y_COLUMN:
+ if (!isCompound)
+ item->setData( 0, QVariant(y) );
+ break;
+ case ENF_VER_Z_COLUMN:
+ if (!isCompound)
+ item->setData( 0, QVariant(z) );
+ break;
+ case ENF_VER_SIZE_COLUMN:
+ item->setData( 0, QVariant(size) );
+ break;
+ case ENF_VER_ENTRY_COLUMN:
+ if (!geomEntry.empty())
+ item->setData( 0, QString(geomEntry.c_str()) );
+ break;
+ case ENF_VER_COMPOUND_COLUMN:
+ item->setData( Qt::CheckStateRole, isCompound );
+ item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
+ break;
+ case ENF_VER_GROUP_COLUMN:
+ if (!groupName.empty())
+ item->setData( 0, QString(groupName.c_str()) );
+ break;
+ default:
+ break;
+ }
+
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ myEnforcedTableWidget->setItem(rowCount,col,item);
+ MESSAGE("Done");
+ }
+
+ connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
+
+ myEnforcedTableWidget->setSortingEnabled(true);
+// myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
+ updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
+}
+
+/** GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
+This method is called when a item is added into the enforced meshes tree widget
+*/
+void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
+{
+ MESSAGE("GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()");
+
+ GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
+
+ that->getGeomSelectionTool()->selectionMgr()->clearFilters();
+ myEnfMeshWdg->deactivateSelection();
+
+ for (int column = 0; column < myEnforcedMeshTableWidget->columnCount(); ++column)
+ myEnforcedMeshTableWidget->resizeColumnToContents(column);
+
+ // Vertex selection
+ int selEnfMeshes = myEnfMeshWdg->NbObjects();
+ if (selEnfMeshes == 0)
+ return;
+
+ std::string groupName = myMeshGroupName->text().toStdString();
+// if (myGlobalGroupName->isChecked())
+// groupName = myGlobalGroupName->text().toStdString();
+
+ if (boost::trim_copy(groupName).empty())
+ groupName = "";
+
+
+ int elementType = myEnfMeshConstraint->currentIndex();
+
+
+ _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ _PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil;
+ QString meshEntry = myEnfMeshWdg->GetValue();
+ MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString());
+
+ if (selEnfMeshes == 1)
+ {
+ MESSAGE("1 SMESH object selected");
+// myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >();
+// std::string entry = myEnfMeshWdg->GetValue();
+ aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str());
+ CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
+ if (!CORBA::is_nil(anObj)) {
+// SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
+ addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
+ }
+ }
+ else
+ {
+ MESSAGE(selEnfMeshes << " SMESH objects selected");
+ QStringList meshEntries = meshEntry.split(" ", QString::SkipEmptyParts);
+ QStringListIterator meshEntriesIt (meshEntries);
+ while (meshEntriesIt.hasNext()) {
+ aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str());
+ CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
+ if (!CORBA::is_nil(anObj)) {
+// SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
+ addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
+ }
+ }
+ }
+
+ myEnfVertexWdg->SetObject(SMESH::SMESH_IDSource::_nil());
+
+ for (int column = 0; column < myEnforcedMeshTableWidget->columnCount(); ++column)
+ myEnforcedMeshTableWidget->resizeColumnToContents(column);
+}
+
+
+/** GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
+This method is called when a item is added into the enforced vertices tree widget
+*/
+void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
+{
+ MESSAGE("GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()");
+
+ GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
+
+ that->getGeomSelectionTool()->selectionMgr()->clearFilters();
+ myEnfVertexWdg->deactivateSelection();
+
+ for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
+ myEnforcedTableWidget->resizeColumnToContents(column);
+
+ // Vertex selection
+ int selEnfVertex = myEnfVertexWdg->NbObjects();
+ bool coordsEmpty = (myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty());
+ if ((selEnfVertex == 0) && coordsEmpty)
+ return;
+
+ std::string groupName = myGroupName->text().toStdString();
+// if (myGlobalGroupName->isChecked())
+// groupName = myGlobalGroupName->text().toStdString();
+
+ if (boost::trim_copy(groupName).empty())
+ groupName = "";
+
+ double size = mySizeValue->GetValue();
+
+ if (selEnfVertex <= 1)
+ {
+ MESSAGE("0 or 1 GEOM object selected");
+ double x = 0, y = 0, z=0;
+ if (myXCoord->GetString() != "") {
+ x = myXCoord->GetValue();
+ y = myYCoord->GetValue();
+ z = myZCoord->GetValue();
+ }
+ if (selEnfVertex == 1) {
+ MESSAGE("1 GEOM object selected");
+ myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
+ std::string entry = "";
+ if (myEnfVertex != GEOM::GEOM_Object::_nil())
+ entry = myEnfVertex->GetStudyEntry();
+ addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),entry, groupName, myEnfVertex->GetShapeType() == GEOM::COMPOUND);
+ }
+ else {
+ MESSAGE("0 GEOM object selected");
+ MESSAGE("Coords: ("<<x<<","<<y<<","<<z<<")");
+ addEnforcedVertex(x, y, z, size, "", "", groupName);
+ }
+ }
+ else
+ {
+ if ( CORBA::is_nil(getGeomEngine()))
+ return;
+
+ GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
+ if (CORBA::is_nil(measureOp))
+ return;
+
+ CORBA::Double x = 0, y = 0,z = 0;
+ for (int j = 0 ; j < selEnfVertex ; j++)
+ {
+ myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(j);
+ if (myEnfVertex == GEOM::GEOM_Object::_nil())
+ continue;
+ if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
+ measureOp->PointCoordinates (myEnfVertex, x, y, z);
+ if ( measureOp->IsDone() )
+ addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ } else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) {
+ addEnforcedVertex(0., 0., 0., size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName, true);
+ }
+ }
+ }
+
+ myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
+
+ for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
+ myEnforcedTableWidget->resizeColumnToContents(column);
+}
+
+/** GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
+This method is called when a item is removed from the enforced meshes tree widget
+*/
+void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
+{
+ QList<int> selectedRows;
+ QList<QTableWidgetItem *> selectedItems = myEnforcedMeshTableWidget->selectedItems();
+ QTableWidgetItem* item;
+ int row;
+ foreach( item, selectedItems ) {
+ row = item->row();
+ if (!selectedRows.contains( row ) )
+ selectedRows.append(row);
+ }
+
+ qSort( selectedRows );
+ QListIterator<int> it( selectedRows );
+ it.toBack();
+ while ( it.hasPrevious() ) {
+ row = it.previous();
+ MESSAGE("delete row #"<< row);
+ myEnforcedMeshTableWidget->removeRow(row );
+ }
+
+ myEnforcedMeshTableWidget->selectionModel()->clearSelection();
+}
+
+/** GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
+This method is called when a item is removed from the enforced vertices tree widget
+*/
+void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
+{
+ QList<int> selectedRows;
+ QList<QTableWidgetItem *> selectedItems = myEnforcedTableWidget->selectedItems();
+ QTableWidgetItem* item;
+ int row;
+ foreach( item, selectedItems ) {
+ row = item->row();
+ if (!selectedRows.contains( row ) )
+ selectedRows.append(row);
+ }
+
+ qSort( selectedRows );
+ QListIterator<int> it( selectedRows );
+ it.toBack();
+ while ( it.hasPrevious() ) {
+ row = it.previous();
+ MESSAGE("delete row #"<< row);
+ myEnforcedTableWidget->removeRow(row );
+ }
+
+ myEnforcedTableWidget->selectionModel()->clearSelection();
+}
+
+void GHS3DPluginGUI_HypothesisCreator::onToMeshHoles(bool isOn)
+{
+ // myToMakeGroupsOfDomains->setEnabled( isOn );
+ // if ( !isOn )
+ // myToMakeGroupsOfDomains->setChecked( false );
+}
+
+void GHS3DPluginGUI_HypothesisCreator::onDirBtnClicked()
+{
+ QString dir = SUIT_FileDlg::getExistingDirectory( dlg(), myAdvWidget->workingDirectoryLineEdit->text(), QString() );
+ if ( !dir.isEmpty() )
+ myAdvWidget->workingDirectoryLineEdit->setText( dir );
+}
+
+void GHS3DPluginGUI_HypothesisCreator::updateWidgets()
+{
+ //myToMakeGroupsOfDomains->setEnabled( myToMeshHolesCheck->isChecked() );
+ myAdvWidget->maxMemorySpin->setEnabled( myAdvWidget->maxMemoryCheck->isChecked() );
+ myAdvWidget->initialMemoryCheck->setEnabled( !myAdvWidget->boundaryRecoveryCheck->isChecked() );
+ myAdvWidget->initialMemorySpin->setEnabled( myAdvWidget->initialMemoryCheck->isChecked() && !myAdvWidget->boundaryRecoveryCheck->isChecked() );
+ myOptimizationLevelCombo->setEnabled( !myAdvWidget->boundaryRecoveryCheck->isChecked() );
+ if ( sender() == myAdvWidget->logInFileCheck ||
+ sender() == myAdvWidget->keepWorkingFilesCheck )
+ {
+ bool logFileRemovable = myAdvWidget->logInFileCheck->isChecked() &&
+ !myAdvWidget->keepWorkingFilesCheck->isChecked();
+
+ myAdvWidget->removeLogOnSuccessCheck->setEnabled( logFileRemovable );
+ }
+}
+
+bool GHS3DPluginGUI_HypothesisCreator::checkParams(QString& msg) const
+{
+ MESSAGE("GHS3DPluginGUI_HypothesisCreator::checkParams");
+
+ if ( !QFileInfo( myAdvWidget->workingDirectoryLineEdit->text().trimmed() ).isWritable() ) {
+ SUIT_MessageBox::warning( dlg(),
+ tr( "SMESH_WRN_WARNING" ),
+ tr( "GHS3D_PERMISSION_DENIED" ) );
+ return false;
+ }
+
+ return true;
+}
+
+void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
+{
+ MESSAGE("GHS3DPluginGUI_HypothesisCreator::retrieveParams");
+ GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
+ GHS3DHypothesisData data;
+ readParamsFromHypo( data );
+
+ if ( myName )
+ myName->setText( data.myName );
+
+ myToMeshHolesCheck ->setChecked ( data.myToMeshHoles );
+ myToMakeGroupsOfDomains ->setChecked ( data.myToMakeGroupsOfDomains );
+ myOptimizationLevelCombo ->setCurrentIndex( data.myOptimizationLevel );
+ myAdvWidget->maxMemoryCheck ->setChecked ( data.myMaximumMemory > 0 );
+ myAdvWidget->maxMemorySpin ->setValue ( qMax( data.myMaximumMemory,
+ myAdvWidget->maxMemorySpin->minimum() ));
+ myAdvWidget->initialMemoryCheck ->setChecked ( data.myInitialMemory > 0 );
+ myAdvWidget->initialMemorySpin ->setValue ( qMax( data.myInitialMemory,
+ myAdvWidget->initialMemorySpin->minimum() ));
+ myAdvWidget->workingDirectoryLineEdit ->setText ( data.myWorkingDir );
+ myAdvWidget->keepWorkingFilesCheck ->setChecked ( data.myKeepFiles );
+ myAdvWidget->verboseLevelSpin ->setValue ( data.myVerboseLevel );
+ myAdvWidget->createNewNodesCheck ->setChecked ( data.myToCreateNewNodes );
+ myAdvWidget->removeInitialCentralPointCheck ->setChecked ( data.myRemoveInitialCentralPoint );
+ myAdvWidget->boundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery );
+ myAdvWidget->FEMCorrectionCheck ->setChecked ( data.myFEMCorrection );
+ myAdvWidget->gradationSpinBox ->setValue ( data.myGradation );
+ myAdvWidget->textOptionLineEdit ->setText ( data.myTextOption );
+ myAdvWidget->logInFileCheck ->setChecked ( !data.myLogInStandardOutput );
+ myAdvWidget->removeLogOnSuccessCheck ->setChecked ( data.myRemoveLogOnSuccess );
+
+ TEnfVertexList::const_iterator it;
+ int rowCount = 0;
+ myEnforcedTableWidget->clearContents();
+ myEnforcedTableWidget->setSortingEnabled(false);
+ myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
+ for(it = data.myEnforcedVertices.begin() ; it != data.myEnforcedVertices.end(); it++ )
+ {
+ TEnfVertex* enfVertex = (*it);
+ myEnforcedTableWidget->setRowCount(rowCount+1);
+
+ for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
+ MESSAGE("Column: " << col);
+// MESSAGE("enfVertex->isCompound: " << enfVertex->isCompound);
+ QTableWidgetItem* item = new QTableWidgetItem();
+ item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
+ switch (col) {
+ case ENF_VER_NAME_COLUMN:
+ item->setData( 0, enfVertex->name.c_str() );
+ if (!enfVertex->geomEntry.empty()) {
+ if (enfVertex->isCompound)
+ item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
+ else
+ item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
+
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ }
+ break;
+ case ENF_VER_X_COLUMN:
+ if (!enfVertex->isCompound) {
+ item->setData( 0, enfVertex->coords.at(0) );
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ }
+ break;
+ case ENF_VER_Y_COLUMN:
+ if (!enfVertex->isCompound) {
+ item->setData( 0, enfVertex->coords.at(1) );
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ }
+ break;
+ case ENF_VER_Z_COLUMN:
+ if (!enfVertex->isCompound) {
+ item->setData( 0, enfVertex->coords.at(2) );
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ }
+ break;
+ case ENF_VER_SIZE_COLUMN:
+ item->setData( 0, enfVertex->size );
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ break;
+ case ENF_VER_ENTRY_COLUMN:
+ item->setData( 0, enfVertex->geomEntry.c_str() );
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ break;
+ case ENF_VER_COMPOUND_COLUMN:
+ item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
+ item->setData( Qt::CheckStateRole, enfVertex->isCompound );
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << enfVertex->isCompound);
+ break;
+ case ENF_VER_GROUP_COLUMN:
+ item->setData( 0, enfVertex->groupName.c_str() );
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ break;
+ default:
+ break;
+ }
+
+ myEnforcedTableWidget->setItem(rowCount,col,item);
+ MESSAGE("Done");
+ }
+ that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
+ rowCount++;
+ }
+
+ connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
+ myEnforcedTableWidget->setSortingEnabled(true);
+
+ for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
+ myEnforcedTableWidget->resizeColumnToContents(column);
+
+ // Update Enforced meshes QTableWidget
+ TEnfMeshList::const_iterator itMesh;
+ rowCount = 0;
+ myEnforcedMeshTableWidget->clearContents();
+ myEnforcedMeshTableWidget->setSortingEnabled(false);
+// myEnforcedMeshTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
+ for(itMesh = data.myEnforcedMeshes.begin() ; itMesh != data.myEnforcedMeshes.end(); itMesh++ )
+ {
+ TEnfMesh* enfMesh = (*itMesh);
+ myEnforcedMeshTableWidget->setRowCount(rowCount+1);
+
+ for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
+ MESSAGE("Column: " << col);
+ if (col == ENF_MESH_CONSTRAINT_COLUMN) {
+ QComboBox* comboBox = new QComboBox();
+ QPalette pal = comboBox->palette();
+ pal.setColor(QPalette::Button, Qt::white);
+ comboBox->setPalette(pal);
+ comboBox->insertItems(0,myEnfMeshConstraintLabels);
+ comboBox->setEditable(false);
+ comboBox->setCurrentIndex(enfMesh->elementType);
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
+ myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
+ }
+ else {
+ QTableWidgetItem* item = new QTableWidgetItem();
+ item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
+ switch (col) {
+ case ENF_MESH_NAME_COLUMN:
+ item->setData( 0, enfMesh->name.c_str() );
+ item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+ break;
+ case ENF_MESH_ENTRY_COLUMN:
+ item->setData( 0, enfMesh->entry.c_str() );
+ item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+ break;
+ case ENF_MESH_GROUP_COLUMN:
+ item->setData( 0, enfMesh->groupName.c_str() );
+ MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
+ myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+ break;
+ default:
+ break;
+ }
+ }
+
+// myEnforcedMeshTableWidget->setItem(rowCount,col,item);
+ MESSAGE("Done");
+ }
+// that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
+ rowCount++;
+ }
+
+// connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
+ myEnforcedMeshTableWidget->setSortingEnabled(true);
+
+ for (int col=0;col<ENF_MESH_NB_COLUMNS;col++)
+ myEnforcedMeshTableWidget->resizeColumnToContents(col);
+
+ that->updateWidgets();
+ that->checkVertexIsDefined();
+}
+
+QString GHS3DPluginGUI_HypothesisCreator::storeParams() const
+{
+ MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParams");
+ GHS3DHypothesisData data;
+ readParamsFromWidgets( data );
+ storeParamsToHypo( data );
+
+ QString valStr = "";
+
+ if ( !data.myBoundaryRecovery )
+ valStr = "-c " + QString::number( !data.myToMeshHoles );
+
+ if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
+ const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
+ valStr += " -o ";
+ valStr += level[ data.myOptimizationLevel ];
+ }
+ if ( data.myMaximumMemory > 0 ) {
+ valStr += " -m ";
+ valStr += QString::number( data.myMaximumMemory );
+ }
+ if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
+ valStr += " -M ";
+ valStr += QString::number( data.myInitialMemory );
+ }
+ valStr += " -v ";
+ valStr += QString::number( data.myVerboseLevel );
+
+ if ( !data.myToCreateNewNodes )
+ valStr += " -p0";
+
+ if ( data.myRemoveInitialCentralPoint )
+ valStr += " -no_initial_central_point";
+
+ if ( data.myBoundaryRecovery )
+ valStr += " -C";
+
+ if ( data.myFEMCorrection )
+ valStr += " -FEM";
+
+ if ( data.myGradation != 1.05 ) {
+ valStr += " -Dcpropa=";
+ valStr += QString::number( data.myGradation );
+ }
+
+ valStr += " ";
+ valStr += data.myTextOption;
+
+// valStr += " #BEGIN ENFORCED VERTICES#";
+// // Add size map parameters storage
+// for (int i=0 ; i<mySmpModel->rowCount() ; i++) {
+// valStr += " (";
+// double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble();
+// double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble();
+// double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble();
+// double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble();
+// valStr += QString::number( x );
+// valStr += ",";
+// valStr += QString::number( y );
+// valStr += ",";
+// valStr += QString::number( z );
+// valStr += ")=";
+// valStr += QString::number( size );
+// if (i!=mySmpModel->rowCount()-1)
+// valStr += ";";
+// }
+// valStr += " #END ENFORCED VERTICES#";
+// MESSAGE(valStr.toStdString());
+ return valStr;
+}
+
+bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& h_data ) const
+{
+ MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo");
+ GHS3DPlugin::GHS3DPlugin_Hypothesis_var h =
+ GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( initParamsHypothesis() );
+
+ HypothesisData* data = SMESH::GetHypothesisData( hypType() );
+ h_data.myName = isCreation() && data ? hypName() : "";
+
+ h_data.myToMeshHoles = h->GetToMeshHoles();
+ h_data.myToMakeGroupsOfDomains = /*h->GetToMeshHoles() &&*/ h->GetToMakeGroupsOfDomains();
+ h_data.myMaximumMemory = h->GetMaximumMemory();
+ h_data.myInitialMemory = h->GetInitialMemory();
+ h_data.myInitialMemory = h->GetInitialMemory();
+ h_data.myOptimizationLevel = h->GetOptimizationLevel();
+ h_data.myKeepFiles = h->GetKeepFiles();
+ h_data.myWorkingDir = h->GetWorkingDirectory();
+ h_data.myVerboseLevel = h->GetVerboseLevel();
+ h_data.myToCreateNewNodes = h->GetToCreateNewNodes();
+ h_data.myRemoveInitialCentralPoint = h->GetToRemoveCentralPoint();
+ h_data.myBoundaryRecovery = h->GetToUseBoundaryRecoveryVersion();
+ h_data.myFEMCorrection = h->GetFEMCorrection();
+ h_data.myGradation = h->GetGradation();
+ h_data.myTextOption = h->GetTextOption();
+ h_data.myLogInStandardOutput = h->GetStandardOutputLog();
+ h_data.myRemoveLogOnSuccess = h->GetRemoveLogOnSuccess();
+
+ GHS3DPlugin::GHS3DEnforcedVertexList_var vertices = h->GetEnforcedVertices();
+ MESSAGE("vertices->length(): " << vertices->length());
+ h_data.myEnforcedVertices.clear();
+ for (int i=0 ; i<vertices->length() ; i++) {
+ TEnfVertex* myVertex = new TEnfVertex();
+ myVertex->name = CORBA::string_dup(vertices[i].name.in());
+ myVertex->geomEntry = CORBA::string_dup(vertices[i].geomEntry.in());
+ myVertex->groupName = CORBA::string_dup(vertices[i].groupName.in());
+ myVertex->size = vertices[i].size;
+ myVertex->isCompound = vertices[i].isCompound;
+ if (vertices[i].coords.length()) {
+ for (int c = 0; c < vertices[i].coords.length() ; c++)
+ myVertex->coords.push_back(vertices[i].coords[c]);
+ MESSAGE("Add enforced vertex ("<< myVertex->coords.at(0) << ","<< myVertex->coords.at(1) << ","<< myVertex->coords.at(2) << ") ="<< myVertex->size);
+ }
+ h_data.myEnforcedVertices.insert(myVertex);
+ }
+
+ GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshes = h->GetEnforcedMeshes();
+ MESSAGE("enfMeshes->length(): " << enfMeshes->length());
+ h_data.myEnforcedMeshes.clear();
+ for (int i=0 ; i<enfMeshes->length() ; i++) {
+ TEnfMesh* myEnfMesh = new TEnfMesh();
+ myEnfMesh->name = CORBA::string_dup(enfMeshes[i].name.in());
+ myEnfMesh->entry = CORBA::string_dup(enfMeshes[i].entry.in());
+ myEnfMesh->groupName = CORBA::string_dup(enfMeshes[i].groupName.in());
+ switch (enfMeshes[i].elementType) {
+ case SMESH::NODE:
+ myEnfMesh->elementType = 0;
+ break;
+ case SMESH::EDGE:
+ myEnfMesh->elementType = 1;
+ break;
+ case SMESH::FACE:
+ myEnfMesh->elementType = 2;
+ break;
+ default:
+ break;
+ }
+// myEnfMesh->elementType = enfMeshes[i].elementType;
+ h_data.myEnforcedMeshes.insert(myEnfMesh);
+ }
+ return true;
+}
+
+bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisData& h_data ) const
+{
+ MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo");
+ GHS3DPlugin::GHS3DPlugin_Hypothesis_var h =
+ GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( hypothesis() );
+
+ bool ok = true;
+ try
+ {
+ if( isCreation() )
+ SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() );
+
+ if ( h->GetToMeshHoles() != h_data.myToMeshHoles ) // avoid duplication of DumpPython commands
+ h->SetToMeshHoles ( h_data.myToMeshHoles );
+ if ( h->GetToMakeGroupsOfDomains() != h_data.myToMakeGroupsOfDomains )
+ h->SetToMakeGroupsOfDomains( h_data.myToMakeGroupsOfDomains );
+ if ( h->GetMaximumMemory() != h_data.myMaximumMemory )
+ h->SetMaximumMemory ( h_data.myMaximumMemory );
+ if ( h->GetInitialMemory() != h_data.myInitialMemory )
+ h->SetInitialMemory ( h_data.myInitialMemory );
+ if ( h->GetInitialMemory() != h_data.myInitialMemory )
+ h->SetInitialMemory ( h_data.myInitialMemory );
+ if ( h->GetOptimizationLevel() != h_data.myOptimizationLevel )
+ h->SetOptimizationLevel( h_data.myOptimizationLevel );
+ if ( h->GetKeepFiles() != h_data.myKeepFiles )
+ h->SetKeepFiles ( h_data.myKeepFiles );
+ if ( h->GetWorkingDirectory() != h_data.myWorkingDir )
+ h->SetWorkingDirectory ( h_data.myWorkingDir.toLatin1().constData() );
+ if ( h->GetVerboseLevel() != h_data.myVerboseLevel )
+ h->SetVerboseLevel ( h_data.myVerboseLevel );
+ if ( h->GetToCreateNewNodes() != h_data.myToCreateNewNodes )
+ h->SetToCreateNewNodes( h_data.myToCreateNewNodes );
+ if ( h->GetToRemoveCentralPoint() != h_data.myRemoveInitialCentralPoint )
+ h->SetToRemoveCentralPoint( h_data.myRemoveInitialCentralPoint );
+ if ( h->GetToUseBoundaryRecoveryVersion() != h_data.myBoundaryRecovery )
+ h->SetToUseBoundaryRecoveryVersion( h_data.myBoundaryRecovery );
+ if ( h->GetFEMCorrection() != h_data.myFEMCorrection )
+ h->SetFEMCorrection ( h_data.myFEMCorrection );
+ if ( h->GetGradation() != h_data.myGradation )
+ h->SetGradation ( h_data.myGradation );
+ if ( h->GetTextOption() != h_data.myTextOption )
+ h->SetTextOption ( h_data.myTextOption.toLatin1().constData() );
+ if ( h->GetStandardOutputLog() != h_data.myLogInStandardOutput )
+ h->SetStandardOutputLog( h_data.myLogInStandardOutput );
+ if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess )
+ h->SetRemoveLogOnSuccess( h_data.myRemoveLogOnSuccess );
+
+ // Enforced vertices
+ int nbVertex = (int) h_data.myEnforcedVertices.size();
+ GHS3DPlugin::GHS3DEnforcedVertexList_var vertexHyp = h->GetEnforcedVertices();
+ int nbVertexHyp = vertexHyp->length();
+
+ MESSAGE("Store params for size maps: " << nbVertex << " enforced vertices");
+ MESSAGE("h->GetEnforcedVertices()->length(): " << nbVertexHyp);
+
+ // 1. Clear all enforced vertices in hypothesis
+ // 2. Add new enforced vertex according to h_data
+ if ( nbVertexHyp > 0)
+ h->ClearEnforcedVertices();
+
+ TEnfVertexList::const_iterator it;
+ double x = 0, y = 0, z = 0;
+ for(it = h_data.myEnforcedVertices.begin() ; it != h_data.myEnforcedVertices.end(); it++ ) {
+ TEnfVertex* enfVertex = (*it);
+ x =y =z = 0;
+ if (enfVertex->coords.size()) {
+ x = enfVertex->coords.at(0);
+ y = enfVertex->coords.at(1);
+ z = enfVertex->coords.at(2);
+ }
+ ok = h->p_SetEnforcedVertex( enfVertex->size, x, y, z, enfVertex->name.c_str(), enfVertex->geomEntry.c_str(), enfVertex->groupName.c_str(), enfVertex->isCompound);
+ } // for
+
+ // Enforced Meshes
+ int nbEnfMeshes = (int) h_data.myEnforcedMeshes.size();
+ GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshListHyp = h->GetEnforcedMeshes();
+ int nbEnfMeshListHyp = enfMeshListHyp->length();
+
+ MESSAGE("Store params for size maps: " << nbEnfMeshes << " enforced meshes");
+ MESSAGE("h->GetEnforcedMeshes()->length(): " << nbEnfMeshListHyp);
+
+ // 1. Clear all enforced vertices in hypothesis
+ // 2. Add new enforced vertex according to h_data
+ if ( nbEnfMeshListHyp > 0)
+ h->ClearEnforcedMeshes();
+
+ TEnfMeshList::const_iterator itEnfMesh;
+
+ _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+
+ for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
+ TEnfMesh* enfMesh = (*itEnfMesh);
+
+ _PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str());
+ SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
+
+ MESSAGE("enfMesh->elementType: " << enfMesh->elementType);
+ SMESH::ElementType elementType;
+ switch(enfMesh->elementType) {
+ case 0:
+ elementType = SMESH::NODE;
+ break;
+ case 1:
+ elementType = SMESH::EDGE;
+ break;
+ case 2:
+ elementType = SMESH::FACE;
+ break;
+ default:
+ break;
+ }
+
+ std::cout << "h->p_SetEnforcedMesh(theSource, "<< elementType <<", \""<< enfMesh->name << "\", \"" << enfMesh->groupName.c_str() <<"\")"<<std::endl;
+ ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->name.c_str(), enfMesh->groupName.c_str());
+ } // for
+ } // try
+// catch(const std::exception& ex) {
+// std::cout << "Exception: " << ex.what() << std::endl;
+// throw ex;
+// }
+ catch ( const SALOME::SALOME_Exception& ex )
+ {
+ SalomeApp_Tools::QtCatchCorbaException( ex );
+ ok = false;
+ }
+ return ok;
+}
+
+bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisData& h_data ) const
+{
+ MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets");
+ h_data.myName = myName ? myName->text() : "";
+ h_data.myToMeshHoles = myToMeshHolesCheck->isChecked();
+ h_data.myToMakeGroupsOfDomains = myToMakeGroupsOfDomains->isChecked();
+ h_data.myMaximumMemory = myAdvWidget->maxMemoryCheck->isChecked() ? myAdvWidget->maxMemorySpin->value() : -1;
+ h_data.myInitialMemory = myAdvWidget->initialMemoryCheck->isChecked() ? myAdvWidget->initialMemorySpin->value() : -1;
+ h_data.myOptimizationLevel = myOptimizationLevelCombo->currentIndex();
+ h_data.myKeepFiles = myAdvWidget->keepWorkingFilesCheck->isChecked();
+ h_data.myWorkingDir = myAdvWidget->workingDirectoryLineEdit->text().trimmed();
+ h_data.myVerboseLevel = myAdvWidget->verboseLevelSpin->value();
+ h_data.myToCreateNewNodes = myAdvWidget->createNewNodesCheck->isChecked();
+ h_data.myRemoveInitialCentralPoint = myAdvWidget->removeInitialCentralPointCheck->isChecked();
+ h_data.myBoundaryRecovery = myAdvWidget->boundaryRecoveryCheck->isChecked();
+ h_data.myFEMCorrection = myAdvWidget->FEMCorrectionCheck->isChecked();
+ h_data.myGradation = myAdvWidget->gradationSpinBox->value();
+ h_data.myTextOption = myAdvWidget->textOptionLineEdit->text();
+ h_data.myLogInStandardOutput = !myAdvWidget->logInFileCheck->isChecked();
+ h_data.myRemoveLogOnSuccess = myAdvWidget->removeLogOnSuccessCheck->isChecked();
+
+ // Enforced vertices
+ h_data.myEnforcedVertices.clear();
+ QVariant valueX, valueY, valueZ;
+ for (int row=0 ; row<myEnforcedTableWidget->rowCount() ; row++) {
+
+ TEnfVertex *myVertex = new TEnfVertex();
+ myVertex->name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
+ MESSAGE("Add new enforced vertex \"" << myVertex->name << "\"" );
+ myVertex->geomEntry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
+ if (myVertex->geomEntry.size())
+ MESSAGE("Geom entry is \"" << myVertex->geomEntry << "\"" );
+ myVertex->groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
+ if (myVertex->groupName.size())
+ MESSAGE("Group name is \"" << myVertex->groupName << "\"" );
+ valueX = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data(Qt::EditRole);
+ valueY = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data(Qt::EditRole);
+ valueZ = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data(Qt::EditRole);
+ if (!valueX.isNull() && !valueY.isNull() && !valueZ.isNull()) {
+ myVertex->coords.push_back(valueX.toDouble());
+ myVertex->coords.push_back(valueY.toDouble());
+ myVertex->coords.push_back(valueZ.toDouble());
+ MESSAGE("Coords are (" << myVertex->coords.at(0) << ", "
+ << myVertex->coords.at(1) << ", "
+ << myVertex->coords.at(2) << ")");
+ }
+ myVertex->size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data(Qt::EditRole).toDouble();
+ MESSAGE("Size is " << myVertex->size);
+ myVertex->isCompound = myEnforcedTableWidget->item(row,ENF_VER_COMPOUND_COLUMN)->data(Qt::CheckStateRole).toBool();
+ MESSAGE("Is compound ? " << myVertex->isCompound);
+ h_data.myEnforcedVertices.insert(myVertex);
+ }
+
+ // Enforced meshes
+ h_data.myEnforcedMeshes.clear();
+
+ for (int row=0 ; row<myEnforcedMeshTableWidget->rowCount() ; row++) {
+
+ TEnfMesh *myEnfMesh = new TEnfMesh();
+ myEnfMesh->name = myEnforcedMeshTableWidget->item(row,ENF_MESH_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
+ MESSAGE("Add new enforced mesh \"" << myEnfMesh->name << "\"" );
+ myEnfMesh->entry = myEnforcedMeshTableWidget->item(row,ENF_MESH_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
+ MESSAGE("Entry is \"" << myEnfMesh->entry << "\"" );
+ myEnfMesh->groupName = myEnforcedMeshTableWidget->item(row,ENF_MESH_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
+ MESSAGE("Group name is \"" << myEnfMesh->groupName << "\"" );
+ QComboBox* combo = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row,ENF_MESH_CONSTRAINT_COLUMN));
+ myEnfMesh->elementType = combo->currentIndex();
+ MESSAGE("Element type: " << myEnfMesh->elementType);
+ h_data.myEnforcedMeshes.insert(myEnfMesh);
+ std::cout << "h_data.myEnforcedMeshes.size(): " << h_data.myEnforcedMeshes.size() << std::endl;
+ }
+
+ return true;
+}
+
+QString GHS3DPluginGUI_HypothesisCreator::caption() const
+{
+ return tr( "GHS3D_TITLE" );
+}
+
+QPixmap GHS3DPluginGUI_HypothesisCreator::icon() const
+{
+ return SUIT_Session::session()->resourceMgr()->loadPixmap( "GHS3DPlugin", tr( "ICON_DLG_GHS3D_PARAMETERS" ) );
+}
+
+QString GHS3DPluginGUI_HypothesisCreator::type() const
+{
+ return tr( "GHS3D_HYPOTHESIS" );
+}
+
+QString GHS3DPluginGUI_HypothesisCreator::helpPage() const
+{
+ return "ghs3d_hypo_page.html";
+}
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// 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
+//
+
+// GHS3DPlugin GUI: GUI for plugged-in mesher GHS3DPlugin
+// File : GHS3DPluginGUI_HypothesisCreator.h
+// Author : Michael Zorin
+// Module : GHS3DPlugin
+//
+#ifndef GHS3DPLUGINGUI_HypothesisCreator_HeaderFile
+#define GHS3DPLUGINGUI_HypothesisCreator_HeaderFile
+
+#ifdef WIN32
+ #if defined GHS3DPluginGUI_EXPORTS
+ #define GHS3DPLUGINGUI_EXPORT __declspec( dllexport )
+ #else
+ #define GHS3DPLUGINGUI_EXPORT __declspec( dllimport )
+ #endif
+#else
+ #define GHS3DPLUGINGUI_EXPORT
+#endif
+
+#include <SMESHGUI_Hypotheses.h>
+#include <GeomSelectionTools.h>
+#include <TopAbs_ShapeEnum.hxx>
+
+#include <QItemDelegate>
+#include <map>
+#include <vector>
+#include <set>
+#include <GEOM_Client.hxx>
+#include CORBA_SERVER_HEADER(GHS3DPlugin_Algorithm)
+#include CORBA_SERVER_HEADER(SMESH_Gen)
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+class QWidget;
+class QComboBox;
+class QCheckBox;
+class QLineEdit;
+class QSpinBox;
+class QTableWidget;
+class QTableWidgetItem;
+class QHeaderView;
+
+class SMESHGUI_SpinBox;
+class StdMeshersGUI_ObjectReferenceParamWdg;
+class LightApp_SelectionMgr;
+class SUIT_SelectionFilter;
+class GHS3DPluginGUI_AdvWidget;
+
+class QTEnfVertex
+{
+
+public:
+ QTEnfVertex(double size, double x=0., double y=0., double z=0., QString name="", QString geomEntry="", QString groupName="", bool isCompound = false);
+
+private:
+ bool operator == (const QTEnfVertex* other) const {
+ if (other) {
+ if (this->coords.size() && other->coords.size())
+ return (this->coords == other->coords);
+ else
+ return (this->geomEntry == other->geomEntry);
+ }
+ }
+
+ QString name;
+ QString geomEntry;
+ bool isCompound;
+ QString groupName;
+ double size;
+ std::vector<double> coords;
+};
+
+typedef QList< QTEnfVertex* > QEnfVertexList;
+
+// Enforced vertex
+struct TEnfVertex{
+ std::string name;
+ std::string geomEntry;
+ bool isCompound;
+ std::vector<double> coords;
+ std::string groupName;
+ double size;
+};
+
+struct CompareEnfVertices
+{
+ bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
+ if (e1 && e2) {
+ if (e1->coords.size() && e2->coords.size())
+ return (e1->coords < e2->coords);
+ else
+ return (e1->geomEntry < e2->geomEntry);
+ }
+ return false;
+ }
+};
+
+// List of enforced vertices
+typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
+
+// Enforced mesh
+struct TEnfMesh{
+ std::string name;
+ std::string entry;
+ int elementType;
+ std::string groupName;
+};
+
+struct CompareEnfMeshes
+{
+ bool operator () (const TEnfMesh* e1, const TEnfMesh* e2) const {
+ if (e1 && e2) {
+ if (e1->entry == e2->entry)
+ return (e1->elementType < e2->elementType);
+ else
+ return (e1->entry < e2->entry);
+ }
+ else
+ return false;
+ }
+};
+// List of enforced meshes
+typedef std::set< TEnfMesh*, CompareEnfMeshes > TEnfMeshList;
+
+typedef struct
+{
+ bool myToMeshHoles,myToMakeGroupsOfDomains,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery,myFEMCorrection,myRemoveInitialCentralPoint,
+ myLogInStandardOutput, myRemoveLogOnSuccess;
+ double myMaximumMemory,myInitialMemory;
+ int myOptimizationLevel;
+ QString myName,myWorkingDir,myTextOption;
+ double myGradation;
+ short myVerboseLevel;
+ TEnfVertexList myEnforcedVertices;
+ TEnfMeshList myEnforcedMeshes;
+} GHS3DHypothesisData;
+
+/*!
+ \brief Class for creation of GHS3D2D and GHS3D3D hypotheses
+*/
+class GHS3DPLUGINGUI_EXPORT GHS3DPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
+{
+ Q_OBJECT
+
+public:
+ GHS3DPluginGUI_HypothesisCreator( const QString& );
+ virtual ~GHS3DPluginGUI_HypothesisCreator();
+
+ virtual bool checkParams(QString& msg) const;
+ virtual QString helpPage() const;
+
+protected:
+ virtual QFrame* buildFrame ();
+ virtual void retrieveParams() const;
+ virtual QString storeParams () const;
+
+ virtual QString caption() const;
+ virtual QPixmap icon() const;
+ virtual QString type() const;
+
+protected slots:
+ void onToMeshHoles(bool);
+ void onDirBtnClicked();
+ void updateWidgets();
+
+ void addEnforcedVertex(double x=0, double y=0, double z=0, double size = 0,
+ std::string vertexName = "", std::string geomEntry = "", std::string groupName = "",
+ bool isCompound = false);
+ void onAddEnforcedVertex();
+ void onRemoveEnforcedVertex();
+ void synchronizeCoords();
+ void updateEnforcedVertexValues(QTableWidgetItem* );
+ void onSelectEnforcedVertex();
+ void clearEnforcedVertexWidgets();
+ void checkVertexIsDefined();
+ void clearEnfVertexSelection();
+
+ void addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName = "");
+ void onAddEnforcedMesh();
+ void onRemoveEnforcedMesh();
+ //void synchronizeEnforcedMesh();
+ void checkEnfMeshIsDefined();
+
+signals:
+ void vertexDefined(bool);
+ void enfMeshDefined(bool);
+
+private:
+ bool readParamsFromHypo( GHS3DHypothesisData& ) const;
+ bool readParamsFromWidgets( GHS3DHypothesisData& ) const;
+ bool storeParamsToHypo( const GHS3DHypothesisData& ) const;
+ GeomSelectionTools* getGeomSelectionTool();
+ GEOM::GEOM_Gen_var getGeomEngine();
+
+private:
+ QWidget* myStdGroup;
+ QLineEdit* myName;
+ QCheckBox* myToMeshHolesCheck;
+ QCheckBox* myToMakeGroupsOfDomains;
+ QComboBox* myOptimizationLevelCombo;
+
+ QWidget* myAdvGroup;
+ GHS3DPluginGUI_AdvWidget* myAdvWidget;
+
+ QWidget* myEnfGroup;
+ QPixmap iconVertex, iconCompound;
+ StdMeshersGUI_ObjectReferenceParamWdg *myEnfVertexWdg;
+ GEOM::GEOM_Object_var myEnfVertex;
+ QTableWidget* myEnforcedTableWidget;
+ SMESHGUI_SpinBox* myXCoord;
+ SMESHGUI_SpinBox* myYCoord;
+ SMESHGUI_SpinBox* myZCoord;
+ SMESHGUI_SpinBox* mySizeValue;
+ QLineEdit* myGroupName;
+// QGroupBox* makeGroupsCheck;
+// QCheckBox* myGlobalGroupName;
+ QPushButton* addVertexButton;
+ QPushButton* removeVertexButton;
+
+ QWidget* myEnfMeshGroup;
+ StdMeshersGUI_ObjectReferenceParamWdg *myEnfMeshWdg;
+// SMESH::SMESH_IDSource_var myEnfMesh;
+ QComboBox* myEnfMeshConstraint;
+ QStringList myEnfMeshConstraintLabels;
+// SMESH::mesh_array_var myEnfMeshArray;
+ QTableWidget* myEnforcedMeshTableWidget;
+ QLineEdit* myMeshGroupName;
+ QPushButton* addEnfMeshButton;
+ QPushButton* removeEnfMeshButton;
+
+ GeomSelectionTools* GeomToolSelected;
+// SVTK_Selector* mySelector;
+// LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
+};
+
+class EnforcedVertexTableWidgetDelegate : public QItemDelegate
+{
+ Q_OBJECT
+
+public:
+ EnforcedVertexTableWidgetDelegate(QObject *parent = 0);
+
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const;
+
+ void setEditorData(QWidget *editor, const QModelIndex &index) const;
+ void setModelData(QWidget *editor, QAbstractItemModel *model,
+ const QModelIndex &index) const;
+
+ void updateEditorGeometry(QWidget *editor,
+ const QStyleOptionViewItem &option, const QModelIndex &index) const;
+
+ bool vertexExists(QAbstractItemModel *model, const QModelIndex &index, QString value) const;
+};
+
+class EnforcedMeshTableWidgetDelegate : public QItemDelegate
+{
+ Q_OBJECT
+
+public:
+ EnforcedMeshTableWidgetDelegate(QObject *parent = 0);
+
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const;
+
+ void setEditorData(QWidget *editor, const QModelIndex &index) const;
+ void setModelData(QWidget *editor, QAbstractItemModel *model,
+ const QModelIndex &index) const;
+
+ void updateEditorGeometry(QWidget *editor,
+ const QStyleOptionViewItem &option, const QModelIndex &index) const;
+};
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
+ <context>
+ <name>@default</name>
+ <message>
+ <source>ICON_DLG_GHS3D_PARAMETERS</source>
+ <translation>mesh_hypo_ghs3d.png</translation>
+ </message>
+ <message>
+ <source>ICON_SMESH_TREE_ALGO_GHS3D_3D</source>
+ <translation>mesh_tree_hypo_ghs3d.png</translation>
+ </message>
+ <message>
+ <source>ICON_SMESH_TREE_HYPO_GHS3D_Parameters</source>
+ <translation>mesh_tree_hypo_ghs3d.png</translation>
+ </message>
+ </context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
+<context>
+ <name>@default</name>
+ <message>
+ <source>GHS3D_ADV_ARGS</source>
+ <translation>Advanced</translation>
+ </message>
+ <message>
+ <source>GHS3D_HYPOTHESIS</source>
+ <translation>GHS3D</translation>
+ </message>
+ <message>
+ <source>GHS3D_OPTIMIZATIOL_LEVEL</source>
+ <translation>Optimization level</translation>
+ </message>
+ <message>
+ <source>GHS3D_PERMISSION_DENIED</source>
+ <translation>Working directory is not writable</translation>
+ </message>
+ <message>
+ <source>GHS3D_STD_ARGS</source>
+ <translation>Parameters</translation>
+ </message>
+ <message>
+ <source>GHS3D_TITLE</source>
+ <translation>Hypothesis Construction</translation>
+ </message>
+ <message>
+ <source>GHS3D_TO_MESH_HOLES</source>
+ <translation>Mesh holes</translation>
+ </message>
+ <message>
+ <source>GHS3D_TO_MAKE_DOMAIN_GROUPS</source>
+ <translation>Make groups of domains</translation>
+ </message>
+ <message>
+ <source>ADVANCED_MESHING_GROUP_TITLE</source>
+ <translation>Advanced meshing options</translation>
+ </message>
+ <message>
+ <source>INIT_MEMORY_SIZE</source>
+ <translation>Initial memory size</translation>
+ </message>
+ <message>
+ <source>KEEP_WORKING_FILES</source>
+ <translation>Keep all working files</translation>
+ </message>
+ <message>
+ <source>LEVEL_NONE</source>
+ <translation>None</translation>
+ </message>
+ <message>
+ <source>LEVEL_LIGHT</source>
+ <translation>Light</translation>
+ </message>
+ <message>
+ <source>LEVEL_MEDIUM</source>
+ <translation>Medium (standard)</translation>
+ </message>
+ <message>
+ <source>LEVEL_STANDARDPLUS</source>
+ <translation>Standard+</translation>
+ </message>
+ <message>
+ <source>LEVEL_STRONG</source>
+ <translation>Strong</translation>
+ </message>
+ <message>
+ <source>LOG_IN_FILE</source>
+ <translation>Print log in a file</translation>
+ </message>
+ <message>
+ <source>LOG_GROUP_TITLE</source>
+ <translation>Logs and debug</translation>
+ </message>
+ <message>
+ <source>MAX_MEMORY_SIZE</source>
+ <translation>Maximum memory size</translation>
+ </message>
+ <message>
+ <source>MEGABYTE</source>
+ <translation>MB</translation>
+ </message>
+ <message>
+ <source>MEMORY_GROUP_TITLE</source>
+ <translation>Memory settings</translation>
+ </message>
+ <message>
+ <source>NO_INITIAL_CENTRAL_POINT</source>
+ <translation>Remove initial central point</translation>
+ </message>
+ <message>
+ <source>RECOVERY_VERSION</source>
+ <translation>Use boundary recovery version</translation>
+ </message>
+ <message>
+ <source>FEM_CORRECTION</source>
+ <translation>Use FEM correction</translation>
+ </message>
+ <message>
+ <source>GHS3D_GRADATION</source>
+ <translation>Volumic gradation</translation>
+ </message>
+ <message>
+ <source>REMOVE_LOG_ON_SUCCESS</source>
+ <translation>Remove log on success</translation>
+ </message>
+ <message>
+ <source>SELECT_DIR</source>
+ <translation>...</translation>
+ </message>
+ <message>
+ <source>TEXT_OPTION</source>
+ <translation>Option as text</translation>
+ </message>
+ <message>
+ <source>TO_ADD_NODES</source>
+ <translation>Create new nodes</translation>
+ </message>
+ <message>
+ <source>VERBOSE_LEVEL</source>
+ <translation>Verbose level</translation>
+ </message>
+ <message>
+ <source>WORKING_DIR</source>
+ <translation>Working directory</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENFORCED_VERTICES</source>
+ <translation>Enforced vertices</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENFORCED_MESHES</source>
+ <translation>Enforced meshes</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_NAME_COLUMN</source>
+ <translation>Name</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_X_COLUMN</source>
+ <translation>X</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_Y_COLUMN</source>
+ <translation>Y</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_Z_COLUMN</source>
+ <translation>Z</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_SIZE_COLUMN</source>
+ <translation>Size</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_ENTRY_COLUMN</source>
+ <translation>Vertex Entry</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_COLUMN</source>
+ <translation>Constraint</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_COMPOUND_COLUMN</source>
+ <translation>Compound</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_GROUP_COLUMN</source>
+ <translation>Group</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_SELECT_VERTEX</source>
+ <translation>Select a vertex</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_SELECT_MESH</source>
+ <translation>Select a mesh</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_X_LABEL</source>
+ <translation>X:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_Y_LABEL</source>
+ <translation>Y:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_Z_LABEL</source>
+ <translation>Z:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_LABEL</source>
+ <translation>Constraint:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_NODE</source>
+ <translation>Nodes</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_EDGE</source>
+ <translation>Edges</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_FACE</source>
+ <translation>Faces</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_SIZE_LABEL</source>
+ <translation>Size:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_GROUP_LABEL</source>
+ <translation>Group:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_ADD</source>
+ <translation>Add</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_REMOVE</source>
+ <translation>Remove</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_INFO</source>
+ <translation><b>Warning</b>: Enforced vertices are currently only taken into account for meshes w/o associated geometry.</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_INFO</source>
+ <translation><b>Warning</b>: Enforced meshes are currently only taken into account for meshes w/o associated geometry.</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>@default</name>
+ <message>
+ <source>GHS3D_TO_MAKE_DOMAIN_GROUPS</source>
+ <translation>Pour créer des groupes de domaines</translation>
+ </message>
+ <message>
+ <source>GHS3D_ADV_ARGS</source>
+ <translation>Avancé</translation>
+ </message>
+ <message>
+ <source>GHS3D_HYPOTHESIS</source>
+ <translation>GHS3D</translation>
+ </message>
+ <message>
+ <source>GHS3D_OPTIMIZATIOL_LEVEL</source>
+ <translation>Niveau d'optimisation</translation>
+ </message>
+ <message>
+ <source>GHS3D_PERMISSION_DENIED</source>
+ <translation>Il n'est pas possible d'écrire dans le répertoire</translation>
+ </message>
+ <message>
+ <source>GHS3D_STD_ARGS</source>
+ <translation>Paramètres</translation>
+ </message>
+ <message>
+ <source>GHS3D_TITLE</source>
+ <translation>Construction de l'hypothèse </translation>
+ </message>
+ <message>
+ <source>GHS3D_TO_MESH_HOLES</source>
+ <translation>Mailler les trous</translation>
+ </message>
+ <message>
+ <source>ADVANCED_MESHING_GROUP_TITLE</source>
+ <translation>Options de maillage avancées</translation>
+ </message>
+ <message>
+ <source>INIT_MEMORY_SIZE</source>
+ <translation>Taille initiale de la mémoire</translation>
+ </message>
+ <message>
+ <source>KEEP_WORKING_FILES</source>
+ <translation>Conserver tous les fichiers temporaires</translation>
+ </message>
+ <message>
+ <source>LEVEL_NONE</source>
+ <translation>Zéro</translation>
+ </message>
+ <message>
+ <source>LEVEL_LIGHT</source>
+ <translation>Léger</translation>
+ </message>
+ <message>
+ <source>LEVEL_MEDIUM</source>
+ <translation>Moyen (standard)</translation>
+ </message>
+ <message>
+ <source>LEVEL_STANDARDPLUS</source>
+ <translation>Standard+</translation>
+ </message>
+ <message>
+ <source>LEVEL_STRONG</source>
+ <translation>Fort</translation>
+ </message>
+ <message>
+ <source>LOG_IN_FILE</source>
+ <translation>Imprimer le log dans un fichier</translation>
+ </message>
+ <message>
+ <source>LOG_GROUP_TITLE</source>
+ <translation>Logs et debug</translation>
+ </message>
+ <message>
+ <source>MAX_MEMORY_SIZE</source>
+ <translation>Taille maximale de la mémoire</translation>
+ </message>
+ <message>
+ <source>MEGABYTE</source>
+ <translation>Megabytes</translation>
+ </message>
+ <message>
+ <source>MEMORY_GROUP_TITLE</source>
+ <translation>Paramètres mémoire</translation>
+ </message>
+ <message>
+ <source>NO_INITIAL_CENTRAL_POINT</source>
+ <translation>Supprimer le point central initial</translation>
+ </message>
+ <message>
+ <source>RECOVERY_VERSION</source>
+ <translation>Utiliser la version de restauration des frontières</translation>
+ </message>
+ <message>
+ <source>FEM_CORRECTION</source>
+ <translation>Utiliser la correction FEM</translation>
+ </message>
+ <message>
+ <source>GHS3D_GRADATION</source>
+ <translation>Gradation volumique</translation>
+ </message>
+ <message>
+ <source>REMOVE_LOG_ON_SUCCESS</source>
+ <translation>Supprimer le log en cas de succès</translation>
+ </message>
+ <message>
+ <source>SELECT_DIR</source>
+ <translation>...</translation>
+ </message>
+ <message>
+ <source>TEXT_OPTION</source>
+ <translation>Option comme texte</translation>
+ </message>
+ <message>
+ <source>TO_ADD_NODES</source>
+ <translation>Créer de nouveaux nœuds</translation>
+ </message>
+ <message>
+ <source>VERBOSE_LEVEL</source>
+ <translation>Niveau de verbosité</translation>
+ </message>
+ <message>
+ <source>WORKING_DIR</source>
+ <translation>Répertoire de travail</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENFORCED_VERTICES</source>
+ <translation>Points de passage</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENFORCED_MESHES</source>
+ <translation>Maillages de contrainte</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_NAME_COLUMN</source>
+ <translation>Nom</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_X_COLUMN</source>
+ <translation>X</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_Y_COLUMN</source>
+ <translation>Y</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_Z_COLUMN</source>
+ <translation>Z</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_SIZE_COLUMN</source>
+ <translation>Taille</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_ENTRY_COLUMN</source>
+ <translation>ID de point</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_COLUMN</source>
+ <translation>Contrainte</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_COMPOUND_COLUMN</source>
+ <translation>Compound</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_GROUP_COLUMN</source>
+ <translation>Groupe</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_SELECT_VERTEX</source>
+ <translation>Sélectionnez une/des point(s)</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_SELECT_MESH</source>
+ <translation>Sélectionnez une/des maillage(s)</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_X_LABEL</source>
+ <translation>X:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_Y_LABEL</source>
+ <translation>Y:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_Z_LABEL</source>
+ <translation>Z:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_LABEL</source>
+ <translation>Contrainte:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_NODE</source>
+ <translation>Noeuds</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_EDGE</source>
+ <translation>Segments</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_FACE</source>
+ <translation>Faces</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_SIZE_LABEL</source>
+ <translation>Taille:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_GROUP_LABEL</source>
+ <translation>Groupe:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_ADD</source>
+ <translation>Ajouter</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_REMOVE</source>
+ <translation>Supprimer</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_INFO</source>
+ <translation><b>Attention</b>: Les points de passage ne sont pris en compte que pour des maillage sans géométrie associée.</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_INFO</source>
+ <translation><b>Attention</b>: Les éléments de contraintes ne sont pris en compte que pour des maillage sans géométrie associée.</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS>
+ <context>
+ <name>@default</name>
+ <message>
+ <source>GHS3D_ADV_ARGS</source>
+ <translation>高度な</translation>
+ </message>
+ <message>
+ <source>GHS3D_HYPOTHESIS</source>
+ <translation>GHS3D</translation>
+ </message>
+ <message>
+ <source>GHS3D_OPTIMIZATIOL_LEVEL</source>
+ <translation>最適化のレベル</translation>
+ </message>
+ <message>
+ <source>GHS3D_PERMISSION_DENIED</source>
+ <translation>ディレクトリを作成することはできません。</translation>
+ </message>
+ <message>
+ <source>GHS3D_STD_ARGS</source>
+ <translation>パラメーター</translation>
+ </message>
+ <message>
+ <source>GHS3D_TITLE</source>
+ <translation>仮説の構築</translation>
+ </message>
+ <message>
+ <source>GHS3D_TO_MESH_HOLES</source>
+ <translation>メッシュの穴</translation>
+ </message>
+ <message>
+ <source>GHS3D_TO_MAKE_DOMAIN_GROUPS</source>
+ <translation>ドメインのグループを確認するには</translation>
+ </message>
+ <message>
+ <source>ADVANCED_MESHING_GROUP_TITLE</source>
+ <translation>高度なメッシュ オプション</translation>
+ </message>
+ <message>
+ <source>INIT_MEMORY_SIZE</source>
+ <translation>初期メモリのサイズ、</translation>
+ </message>
+ <message>
+ <source>KEEP_WORKING_FILES</source>
+ <translation>すべての一時ファイルを保持します。</translation>
+ </message>
+ <message>
+ <source>LEVEL_NONE</source>
+ <translation>なし</translation>
+ </message>
+ <message>
+ <source>LEVEL_LIGHT</source>
+ <translation>光</translation>
+ </message>
+ <message>
+ <source>LEVEL_MEDIUM</source>
+ <translation>(標準) の方法</translation>
+ </message>
+ <message>
+ <source>LEVEL_STANDARDPLUS</source>
+ <translation>標準</translation>
+ </message>
+ <message>
+ <source>LEVEL_STRONG</source>
+ <translation>砦</translation>
+ </message>
+ <message>
+ <source>LOG_IN_FILE</source>
+ <translation>ログ ファイルへの印刷します。</translation>
+ </message>
+ <message>
+ <source>LOG_GROUP_TITLE</source>
+ <translation>Et のログをデバッグ</translation>
+ </message>
+ <message>
+ <source>MAX_MEMORY_SIZE</source>
+ <translation>最大メモリ サイズ</translation>
+ </message>
+ <message>
+ <source>MEGABYTE</source>
+ <translation>メガバイト</translation>
+ </message>
+ <message>
+ <source>MEMORY_GROUP_TITLE</source>
+ <translation>メモリの設定</translation>
+ </message>
+ <message>
+ <source>NO_INITIAL_CENTRAL_POINT</source>
+ <translation>元の中心点を削除します。</translation>
+ </message>
+ <message>
+ <source>RECOVERY_VERSION</source>
+ <translation>バージョン境界の復元を使用します。</translation>
+ </message>
+ <message>
+ <source>FEM_CORRECTION</source>
+ <translation>GEF 補正を使用してください。</translation>
+ </message>
+ <message>
+ <source>GHS3D_GRADATION</source>
+ <translation>ボリュームのグラデーション</translation>
+ </message>
+ <message>
+ <source>REMOVE_LOG_ON_SUCCESS</source>
+ <translation>削除ログ成功</translation>
+ </message>
+ <message>
+ <source>SELECT_DIR</source>
+ <translation>...</translation>
+ </message>
+ <message>
+ <source>TEXT_OPTION</source>
+ <translation>テキスト オプション</translation>
+ </message>
+ <message>
+ <source>TO_ADD_NODES</source>
+ <translation>新しいノードを作成します。</translation>
+ </message>
+ <message>
+ <source>VERBOSE_LEVEL</source>
+ <translation>詳細レベル</translation>
+ </message>
+ <message>
+ <source>WORKING_DIR</source>
+ <translation>作業ディレクトリ</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENFORCED_VERTICES</source>
+ <translation>交差点</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENFORCED_MESHES</source>
+ <translation>制約メッシュ</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_NAME_COLUMN</source>
+ <translation>名前</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_X_COLUMN</source>
+ <translation>X</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_Y_COLUMN</source>
+ <translation>そこ</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_Z_COLUMN</source>
+ <translation>Z</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_SIZE_COLUMN</source>
+ <translation>サイズ</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_ENTRY_COLUMN</source>
+ <translation>ポイント ID</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_COLUMN</source>
+ <translation>制約</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_COMPOUND_COLUMN</source>
+ <translation>複合</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_GROUP_COLUMN</source>
+ <translation>グループ</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_SELECT_VERTEX</source>
+ <translation>・ ポイント (s) の選択</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_SELECT_MESH</source>
+ <translation>1 つを選択/メッシュ (s)</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_X_LABEL</source>
+ <translation>X:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_Y_LABEL</source>
+ <translation>Y:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_Z_LABEL</source>
+ <translation>Z:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_LABEL</source>
+ <translation>制約:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_NODE</source>
+ <translation>節点</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_EDGE</source>
+ <translation>セグメント</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_CONSTRAINT_FACE</source>
+ <translation>Faces</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_SIZE_LABEL</source>
+ <translation>サイズ:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_GROUP_LABEL</source>
+ <translation>グループ:</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_ADD</source>
+ <translation>追加</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_REMOVE</source>
+ <translation>削除</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_VER_INFO</source>
+ <translation><b>注意</b>: 交差ポイント関連ジオメトリなしメッシュが考慮されます。</translation>
+ </message>
+ <message>
+ <source>GHS3D_ENF_MESH_INFO</source>
+ <translation><b>注意</b>: 要素制約の関連付けられたジオメトリなしメッシュ考慮されます。</translation>
+ </message>
+ </context>
+</TS>
--- /dev/null
+# 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
+#
+
+# --- options ---
+# additional include directories
+INCLUDE_DIRECTORIES(
+ ${KERNEL_INCLUDE_DIRS}
+ ${CAS_INCLUDE_DIRS}
+ ${GEOM_INCLUDE_DIRS}
+ ${SMESH_INCLUDE_DIRS}
+ ${VTK_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+ ${OMNIORB_INCLUDE_DIR}
+ ${PROJECT_BINARY_DIR}/idl
+)
+
+# additional preprocessor / compiler flags
+ADD_DEFINITIONS(
+ ${OMNIORB_DEFINITIONS}
+ ${CAS_DEFINITIONS}
+ ${BOOST_DEFINITIONS}
+)
+
+# libraries to link to
+SET(_link_LIBRARIES
+ ${CAS_TKBRep}
+ ${CAS_TKG2d}
+ ${CAS_TKG3d}
+ ${CAS_TKTopAlgo}
+ ${CAS_TKGeomBase}
+ ${CAS_TKGeomAlgo}
+ ${CAS_TKCDF}
+ ${SMESH_SMESHimpl}
+ ${SMESH_SMESHEngine}
+ ${SMESH_SMESHDS}
+ ${SMESH_SMDS}
+ ${SMESH_StdMeshers}
+ ${SMESH_MeshDriverGMF}
+ ${KERNEL_SalomeGenericObj}
+ ${KERNEL_SALOMELocalTrace}
+ ${KERNEL_SALOMEBasics}
+ ${KERNEL_SalomeNS}
+ ${KERNEL_OpUtil}
+ SalomeIDLGHS3DPLUGIN
+)
+
+# --- headers ---
+
+# header files
+SET(GHS3DEngine_HEADERS
+ GHS3DPlugin_Defs.hxx
+ GHS3DPlugin_GHS3D.hxx
+ GHS3DPlugin_GHS3D_i.hxx
+ GHS3DPlugin_Hypothesis.hxx
+ GHS3DPlugin_Hypothesis_i.hxx
+)
+
+# --- sources ---
+
+# sources / static
+SET(GHS3DEngine_SOURCES
+ GHS3DPlugin_GHS3D.cxx
+ GHS3DPlugin_GHS3D_i.cxx
+ GHS3DPlugin_i.cxx
+ GHS3DPlugin_Hypothesis.cxx
+ GHS3DPlugin_Hypothesis_i.cxx
+)
+
+# --- scripts ---
+
+# scripts / static
+SET(_bin_SCRIPTS
+ __init__.py
+ GHS3DPluginBuilder.py
+)
+
+# --- rules ---
+
+ADD_LIBRARY(GHS3DEngine ${GHS3DEngine_SOURCES})
+TARGET_LINK_LIBRARIES(GHS3DEngine ${_link_LIBRARIES} )
+INSTALL(TARGETS GHS3DEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+
+INSTALL(FILES ${GHS3DEngine_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
+
+SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/GHS3DPlugin)
--- /dev/null
+# Copyright (C) 2007-2013 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.
+#
+# 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
+#
+
+##
+# @package GHS3DPluginBuilder
+# Python API for the GHS3D meshing plug-in module.
+
+from salome.smesh.smesh_algorithm import Mesh_Algorithm
+from salome.smesh.smeshBuilder import AssureGeomPublished
+
+# import GHS3DPlugin module if possible
+noGHS3DPlugin = 0
+try:
+ import GHS3DPlugin
+except ImportError:
+ noGHS3DPlugin = 1
+ pass
+
+# Optimization level of GHS3D
+# V3.1
+None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization = 0,1,2,3
+# V4.1 (partialy redefines V3.1). Issue 0020574
+None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization, Strong_Optimization = 0,1,2,3,4
+
+#----------------------------
+# Mesh algo type identifiers
+#----------------------------
+
+## Algorithm type: GHS3D tetrahedron 3D algorithm, see GHS3D_Algorithm
+GHS3D = "GHS3D_3D"
+
+## Tetrahedron GHS3D 3D algorithm
+#
+# It can be created by calling smeshBuilder.Mesh.Tetrahedron( smeshBuilder.GHS3D, geom=0 )
+class GHS3D_Algorithm(Mesh_Algorithm):
+
+ ## name of the dynamic method in smeshBuilder.Mesh class
+ # @internal
+ meshMethod = "Tetrahedron"
+ ## type of algorithm used with helper function in smeshBuilder.Mesh class
+ # @internal
+ algoType = GHS3D
+ ## doc string of the method in smeshBuilder.Mesh class
+ # @internal
+ docHelper = "Creates tetrahedron 3D algorithm for volumes"
+
+ ## Private constructor.
+ # @param mesh parent mesh object algorithm is assigned to
+ # @param geom geometry (shape/sub-shape) algorithm is assigned to;
+ # if it is @c 0 (default), the algorithm is assigned to the main shape
+ def __init__(self, mesh, geom=0):
+ Mesh_Algorithm.__init__(self)
+ if noGHS3DPlugin: print "Warning: GHS3DPlugin module unavailable"
+ self.Create(mesh, geom, self.algoType, "libGHS3DEngine.so")
+ self.params = None
+ pass
+
+ ## Defines hypothesis having several parameters
+ # @return hypothesis object
+ def Parameters(self):
+ if not self.params:
+ self.params = self.Hypothesis("GHS3D_Parameters", [],
+ "libGHS3DEngine.so", UseExisting=0)
+ pass
+ return self.params
+
+ ## To mesh "holes" in a solid or not. Default is to mesh.
+ # @param toMesh "mesh holes" flag value
+ def SetToMeshHoles(self, toMesh):
+ self.Parameters().SetToMeshHoles(toMesh)
+ pass
+
+ ## To make groups of volumes of different domains when mesh is generated from skin.
+ # Default is to make groups.
+ # This option works only (1) for the mesh w/o shape and (2) if GetToMeshHoles() == true
+ # @param toMesh "mesh holes" flag value
+ def SetToMakeGroupsOfDomains(self, toMakeGroups):
+ self.Parameters().SetToMakeGroupsOfDomains(toMakeGroups)
+ pass
+
+ ## Set Optimization level:
+ # @param level optimization level, one of the following values
+ # - None_Optimization
+ # - Light_Optimization
+ # - Standard_Optimization
+ # - StandardPlus_Optimization
+ # - Strong_Optimization.
+ # .
+ # Default is Standard_Optimization
+ def SetOptimizationLevel(self, level):
+ self.Parameters().SetOptimizationLevel(level)
+ pass
+
+ ## Set maximal size of memory to be used by the algorithm (in Megabytes).
+ # @param MB maximal size of memory
+ def SetMaximumMemory(self, MB):
+ self.Parameters().SetMaximumMemory(MB)
+ pass
+
+ ## Set initial size of memory to be used by the algorithm (in Megabytes) in
+ # automatic memory adjustment mode.
+ # @param MB initial size of memory
+ def SetInitialMemory(self, MB):
+ self.Parameters().SetInitialMemory(MB)
+ pass
+
+ ## Set path to working directory.
+ # @param path working directory
+ def SetWorkingDirectory(self, path):
+ self.Parameters().SetWorkingDirectory(path)
+ pass
+
+ ## To keep working files or remove them.
+ # @param toKeep "keep working files" flag value
+ def SetKeepFiles(self, toKeep):
+ self.Parameters().SetKeepFiles(toKeep)
+ pass
+
+ ## Remove or not the log file (if any) in case of successful computation.
+ # The log file remains in case of errors anyway. If
+ # the "keep working files" flag is set to true, this option
+ # has no effect.
+ # @param toRemove "remove log on success" flag value
+ def SetRemoveLogOnSuccess(self, toRemove):
+ self.Parameters().SetRemoveLogOnSuccess(toRemove)
+ pass
+
+ ## Print the the log in a file. If set to false, the
+ # log is printed on the standard output
+ # @param toPrintLogInFile "print log in a file" flag value
+ def SetPrintLogInFile(self, toPrintLogInFile):
+ self.Parameters().SetStandardOutputLog(not toPrintLogInFile)
+ pass
+
+ ## Set verbosity level [0-10].
+ # @param level verbosity level
+ # - 0 - no standard output,
+ # - 2 - prints the data, quality statistics of the skin and final meshes and
+ # indicates when the final mesh is being saved. In addition the software
+ # gives indication regarding the CPU time.
+ # - 10 - same as 2 plus the main steps in the computation, quality statistics
+ # histogram of the skin mesh, quality statistics histogram together with
+ # the characteristics of the final mesh.
+ def SetVerboseLevel(self, level):
+ self.Parameters().SetVerboseLevel(level)
+ pass
+
+ ## To create new nodes.
+ # @param toCreate "create new nodes" flag value
+ def SetToCreateNewNodes(self, toCreate):
+ self.Parameters().SetToCreateNewNodes(toCreate)
+ pass
+
+ ## To use boundary recovery version which tries to create mesh on a very poor
+ # quality surface mesh.
+ # @param toUse "use boundary recovery version" flag value
+ def SetToUseBoundaryRecoveryVersion(self, toUse):
+ self.Parameters().SetToUseBoundaryRecoveryVersion(toUse)
+ pass
+
+ ## Applies finite-element correction by replacing overconstrained elements where
+ # it is possible. The process is cutting first the overconstrained edges and
+ # second the overconstrained facets. This insure that no edges have two boundary
+ # vertices and that no facets have three boundary vertices.
+ # @param toUseFem "apply finite-element correction" flag value
+ def SetFEMCorrection(self, toUseFem):
+ self.Parameters().SetFEMCorrection(toUseFem)
+ pass
+
+ ## To remove initial central point.
+ # @param toRemove "remove initial central point" flag value
+ def SetToRemoveCentralPoint(self, toRemove):
+ self.Parameters().SetToRemoveCentralPoint(toRemove)
+ pass
+
+ ## To set an enforced vertex.
+ # @param x : x coordinate
+ # @param y : y coordinate
+ # @param z : z coordinate
+ # @param size : size of 1D element around enforced vertex
+ # @param vertexName : name of the enforced vertex
+ # @param groupName : name of the group
+ def SetEnforcedVertex(self, x, y, z, size, vertexName = "", groupName = ""):
+ if vertexName == "":
+ if groupName == "":
+ return self.Parameters().SetEnforcedVertex(x, y, z, size)
+ else:
+ return self.Parameters().SetEnforcedVertexWithGroup(x, y, z, size, groupName)
+ pass
+ else:
+ if groupName == "":
+ return self.Parameters().SetEnforcedVertexNamed(x, y, z, size, vertexName)
+ else:
+ return self.Parameters().SetEnforcedVertexNamedWithGroup(x, y, z, size, vertexName, groupName)
+ pass
+ pass
+
+ ## To set an enforced vertex given a GEOM vertex, group or compound.
+ # @param theVertex : GEOM vertex (or group, compound) to be projected on theFace.
+ # @param size : size of 1D element around enforced vertex
+ # @param groupName : name of the group
+ def SetEnforcedVertexGeom(self, theVertex, size, groupName = ""):
+ AssureGeomPublished( self.mesh, theVertex )
+ if groupName == "":
+ return self.Parameters().SetEnforcedVertexGeom(theVertex, size)
+ else:
+ return self.Parameters().SetEnforcedVertexGeomWithGroup(theVertex, size, groupName)
+ pass
+
+ ## To remove an enforced vertex.
+ # @param x : x coordinate
+ # @param y : y coordinate
+ # @param z : z coordinate
+ def RemoveEnforcedVertex(self, x, y, z):
+ return self.Parameters().RemoveEnforcedVertex(x, y, z)
+
+ ## To remove an enforced vertex given a GEOM vertex, group or compound.
+ # @param theVertex : GEOM vertex (or group, compound) to be projected on theFace.
+ def RemoveEnforcedVertexGeom(self, theVertex):
+ AssureGeomPublished( self.mesh, theVertex )
+ return self.Parameters().RemoveEnforcedVertexGeom(theVertex)
+
+ ## To set an enforced mesh with given size and add the enforced elements in the group "groupName".
+ # @param theSource : source mesh which provides constraint elements/nodes
+ # @param elementType : SMESH.ElementType (NODE, EDGE or FACE)
+ # @param size : size of elements around enforced elements. Unused if -1.
+ # @param groupName : group in which enforced elements will be added. Unused if "".
+ def SetEnforcedMesh(self, theSource, elementType, size = -1, groupName = ""):
+ if size < 0:
+ if groupName == "":
+ return self.Parameters().SetEnforcedMesh(theSource, elementType)
+ else:
+ return self.Parameters().SetEnforcedMeshWithGroup(theSource, elementType, groupName)
+ pass
+ else:
+ if groupName == "":
+ return self.Parameters().SetEnforcedMeshSize(theSource, elementType, size)
+ else:
+ return self.Parameters().SetEnforcedMeshSizeWithGroup(theSource, elementType, size, groupName)
+ pass
+ pass
+
+ ## Sets command line option as text.
+ # @param option command line option
+ def SetTextOption(self, option):
+ self.Parameters().SetTextOption(option)
+ pass
+
+ pass # end of GHS3D_Algorithm class
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//=============================================================================
+// File : GHS3DPlugin_Defs.hxx
+// Author : Alexander A. BORODIN
+//
+#ifndef _GHS3DPlugin_DEFS_HXX_
+#define _GHS3DPlugin_DEFS_HXX_
+
+#ifdef WIN32
+ #if defined GHS3DPLUGIN_EXPORTS || defined GHS3DEngine_EXPORTS
+ #define GHS3DPLUGIN_EXPORT __declspec( dllexport )
+ #else
+ #define GHS3DPLUGIN_EXPORT __declspec( dllimport )
+ #endif
+#else
+ #define GHS3DPLUGIN_EXPORT
+#endif
+
+#endif
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//=============================================================================
+// File : GHS3DPlugin_GHS3D.cxx
+// Created :
+// Author : Edward AGAPOV, modified by Lioka RAZAFINDRAZAKA (CEA) 09/02/2007
+// Project : SALOME
+//=============================================================================
+//
+#include "GHS3DPlugin_GHS3D.hxx"
+#include "GHS3DPlugin_Hypothesis.hxx"
+
+#include <SMDS_FaceOfNodes.hxx>
+#include <SMDS_MeshElement.hxx>
+#include <SMDS_MeshNode.hxx>
+#include <SMDS_VolumeOfNodes.hxx>
+#include <SMESHDS_Group.hxx>
+#include <SMESH_Comment.hxx>
+#include <SMESH_Group.hxx>
+#include <SMESH_HypoFilter.hxx>
+#include <SMESH_Mesh.hxx>
+#include <SMESH_MeshAlgos.hxx>
+#include <SMESH_MeshEditor.hxx>
+#include <SMESH_MesherHelper.hxx>
+#include <SMESH_OctreeNode.hxx>
+#include <SMESH_subMeshEventListener.hxx>
+#include <StdMeshers_QuadToTriaAdaptor.hxx>
+#include <StdMeshers_ViscousLayers.hxx>
+
+#include <BRepAdaptor_Surface.hxx>
+#include <BRepBndLib.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepClass3d.hxx>
+#include <BRepClass3d_SolidClassifier.hxx>
+#include <BRepExtrema_DistShapeShape.hxx>
+#include <BRepGProp.hxx>
+#include <BRepTools.hxx>
+#include <BRep_Tool.hxx>
+#include <Bnd_Box.hxx>
+#include <GProp_GProps.hxx>
+#include <GeomAPI_ProjectPointOnSurf.hxx>
+#include <OSD_File.hxx>
+#include <Precision.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_ProgramError.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Shell.hxx>
+#include <TopoDS_Solid.hxx>
+
+#include <Basics_Utils.hxx>
+#include <utilities.h>
+
+#ifdef WIN32
+#include <io.h>
+#else
+#include <sys/sysinfo.h>
+#endif
+#include <algorithm>
+
+#define castToNode(n) static_cast<const SMDS_MeshNode *>( n );
+
+extern "C"
+{
+#ifndef WIN32
+#include <unistd.h>
+#include <sys/mman.h>
+#endif
+#include <sys/stat.h>
+#include <fcntl.h>
+}
+
+#define HOLE_ID -1
+
+typedef const list<const SMDS_MeshFace*> TTriaList;
+
+static const char theDomainGroupNamePrefix[] = "Domain_";
+
+static void removeFile( const TCollection_AsciiString& fileName )
+{
+ try {
+ OSD_File( fileName ).Remove();
+ }
+ catch ( Standard_ProgramError ) {
+ MESSAGE("Can't remove file: " << fileName.ToCString() << " ; file does not exist or permission denied");
+ }
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D(int hypId, int studyId, SMESH_Gen* gen)
+ : SMESH_3D_Algo(hypId, studyId, gen)
+{
+ MESSAGE("GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D");
+ _name = Name();
+ _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type
+ _onlyUnaryInput = false; // Compute() will be called on a compound of solids
+ _iShape=0;
+ _nbShape=0;
+ _compatibleHypothesis.push_back( GHS3DPlugin_Hypothesis::GetHypType());
+ _compatibleHypothesis.push_back( StdMeshers_ViscousLayers::GetHypType() );
+ _requireShape = false; // can work without shape_studyId
+
+ smeshGen_i = SMESH_Gen_i::GetSMESHGen();
+ CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager");
+ SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
+
+ MESSAGE("studyid = " << _studyId);
+
+ myStudy = NULL;
+ myStudy = aStudyMgr->GetStudyByID(_studyId);
+ if (myStudy)
+ MESSAGE("myStudy->StudyId() = " << myStudy->StudyId());
+
+ _compute_canceled = false;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+GHS3DPlugin_GHS3D::~GHS3DPlugin_GHS3D()
+{
+ MESSAGE("GHS3DPlugin_GHS3D::~GHS3DPlugin_GHS3D");
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+bool GHS3DPlugin_GHS3D::CheckHypothesis ( SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape,
+ Hypothesis_Status& aStatus )
+{
+ aStatus = SMESH_Hypothesis::HYP_OK;
+
+ _hyp = 0;
+ _viscousLayersHyp = 0;
+ _keepFiles = false;
+ _removeLogOnSuccess = true;
+ _logInStandardOutput = false;
+
+ const list <const SMESHDS_Hypothesis * >& hyps =
+ GetUsedHypothesis(aMesh, aShape, /*ignoreAuxiliary=*/false);
+ list <const SMESHDS_Hypothesis* >::const_iterator h = hyps.begin();
+ for ( ; h != hyps.end(); ++h )
+ {
+ if ( !_hyp )
+ _hyp = dynamic_cast< const GHS3DPlugin_Hypothesis*> ( *h );
+ if ( !_viscousLayersHyp )
+ _viscousLayersHyp = dynamic_cast< const StdMeshers_ViscousLayers*> ( *h );
+ }
+ if ( _hyp )
+ {
+ _keepFiles = _hyp->GetKeepFiles();
+ _removeLogOnSuccess = _hyp->GetRemoveLogOnSuccess();
+ _logInStandardOutput = _hyp->GetStandardOutputLog();
+ }
+
+ return true;
+}
+
+
+//=======================================================================
+//function : entryToShape
+//purpose :
+//=======================================================================
+
+TopoDS_Shape GHS3DPlugin_GHS3D::entryToShape(std::string entry)
+{
+ MESSAGE("GHS3DPlugin_GHS3D::entryToShape "<<entry );
+ GEOM::GEOM_Object_var aGeomObj;
+ TopoDS_Shape S = TopoDS_Shape();
+ SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() );
+ if (!aSObj->_is_nil() ) {
+ CORBA::Object_var obj = aSObj->GetObject();
+ aGeomObj = GEOM::GEOM_Object::_narrow(obj);
+ aSObj->UnRegister();
+ }
+ if ( !aGeomObj->_is_nil() )
+ S = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
+ return S;
+}
+
+//=======================================================================
+//function : findShape
+//purpose :
+//=======================================================================
+
+static TopoDS_Shape findShape(const SMDS_MeshNode *aNode[],
+ TopoDS_Shape aShape,
+ const TopoDS_Shape shape[],
+ double** box,
+ const int nShape,
+ TopAbs_State * state = 0)
+{
+ gp_XYZ aPnt(0,0,0);
+ int j, iShape, nbNode = 4;
+
+ for ( j=0; j<nbNode; j++ ) {
+ gp_XYZ p ( aNode[j]->X(), aNode[j]->Y(), aNode[j]->Z() );
+ if ( aNode[j]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_3DSPACE ) {
+ aPnt = p;
+ break;
+ }
+ aPnt += p / nbNode;
+ }
+
+ BRepClass3d_SolidClassifier SC (aShape, aPnt, Precision::Confusion());
+ if (state) *state = SC.State();
+ if ( SC.State() != TopAbs_IN || aShape.IsNull() || aShape.ShapeType() != TopAbs_SOLID) {
+ for (iShape = 0; iShape < nShape; iShape++) {
+ aShape = shape[iShape];
+ if ( !( aPnt.X() < box[iShape][0] || box[iShape][1] < aPnt.X() ||
+ aPnt.Y() < box[iShape][2] || box[iShape][3] < aPnt.Y() ||
+ aPnt.Z() < box[iShape][4] || box[iShape][5] < aPnt.Z()) ) {
+ BRepClass3d_SolidClassifier SC (aShape, aPnt, Precision::Confusion());
+ if (state) *state = SC.State();
+ if (SC.State() == TopAbs_IN)
+ break;
+ }
+ }
+ }
+ return aShape;
+}
+
+//=======================================================================
+//function : readMapIntLine
+//purpose :
+//=======================================================================
+
+static char* readMapIntLine(char* ptr, int tab[]) {
+ long int intVal;
+ std::cout << std::endl;
+
+ for ( int i=0; i<17; i++ ) {
+ intVal = strtol(ptr, &ptr, 10);
+ if ( i < 3 )
+ tab[i] = intVal;
+ }
+ return ptr;
+}
+
+//================================================================================
+/*!
+ * \brief returns true if a triangle defined by the nodes is a temporary face on a
+ * side facet of pyramid and defines sub-domian inside the pyramid
+ */
+//================================================================================
+
+static bool isTmpFace(const SMDS_MeshNode* node1,
+ const SMDS_MeshNode* node2,
+ const SMDS_MeshNode* node3)
+{
+ // find a pyramid sharing the 3 nodes
+ //const SMDS_MeshElement* pyram = 0;
+ SMDS_ElemIteratorPtr vIt1 = node1->GetInverseElementIterator(SMDSAbs_Volume);
+ while ( vIt1->more() )
+ {
+ const SMDS_MeshElement* pyram = vIt1->next();
+ if ( pyram->NbCornerNodes() != 5 ) continue;
+ int i2, i3;
+ if ( (i2 = pyram->GetNodeIndex( node2 )) >= 0 &&
+ (i3 = pyram->GetNodeIndex( node3 )) >= 0 )
+ {
+ // Triangle defines sub-domian inside the pyramid if it's
+ // normal points out of the pyram
+
+ // make i2 and i3 hold indices of base nodes of the pyram while
+ // keeping the nodes order in the triangle
+ const int iApex = 4;
+ if ( i2 == iApex )
+ i2 = i3, i3 = pyram->GetNodeIndex( node1 );
+ else if ( i3 == iApex )
+ i3 = i2, i2 = pyram->GetNodeIndex( node1 );
+
+ int i3base = (i2+1) % 4; // next index after i2 within the pyramid base
+ return ( i3base != i3 );
+ }
+ }
+ return false;
+}
+
+//=======================================================================
+//function : findShapeID
+//purpose : find the solid corresponding to GHS3D sub-domain following
+// the technique proposed in GHS3D manual (available within
+// ghs3d installation) in chapter "B.4 Subdomain (sub-region) assignment".
+// In brief: normal of the triangle defined by the given nodes
+// points out of the domain it is associated to
+//=======================================================================
+
+static int findShapeID(SMESH_Mesh& mesh,
+ const SMDS_MeshNode* node1,
+ const SMDS_MeshNode* node2,
+ const SMDS_MeshNode* node3,
+ const bool toMeshHoles)
+{
+ const int invalidID = 0;
+ SMESHDS_Mesh* meshDS = mesh.GetMeshDS();
+
+ // face the nodes belong to
+ vector<const SMDS_MeshNode *> nodes(3);
+ nodes[0] = node1;
+ nodes[1] = node2;
+ nodes[2] = node3;
+ const SMDS_MeshElement * face = meshDS->FindElement( nodes, SMDSAbs_Face, /*noMedium=*/true);
+ if ( !face )
+ return isTmpFace(node1, node2, node3) ? HOLE_ID : invalidID;
+#ifdef _DEBUG_
+ std::cout << "bnd face " << face->GetID() << " - ";
+#endif
+ // geom face the face assigned to
+ SMESH_MeshEditor editor(&mesh);
+ int geomFaceID = editor.FindShape( face );
+ if ( !geomFaceID )
+ return isTmpFace(node1, node2, node3) ? HOLE_ID : invalidID;
+ TopoDS_Shape shape = meshDS->IndexToShape( geomFaceID );
+ if ( shape.IsNull() || shape.ShapeType() != TopAbs_FACE )
+ return invalidID;
+ TopoDS_Face geomFace = TopoDS::Face( shape );
+
+ // solids bounded by geom face
+ TopTools_IndexedMapOfShape solids, shells;
+ TopTools_ListIteratorOfListOfShape ansIt = mesh.GetAncestors(geomFace);
+ for ( ; ansIt.More(); ansIt.Next() ) {
+ switch ( ansIt.Value().ShapeType() ) {
+ case TopAbs_SOLID:
+ solids.Add( ansIt.Value() ); break;
+ case TopAbs_SHELL:
+ shells.Add( ansIt.Value() ); break;
+ default:;
+ }
+ }
+ // analyse found solids
+ if ( solids.Extent() == 0 || shells.Extent() == 0)
+ return invalidID;
+
+ const TopoDS_Solid& solid1 = TopoDS::Solid( solids(1) );
+ if ( solids.Extent() == 1 )
+ {
+ if ( toMeshHoles )
+ return meshDS->ShapeToIndex( solid1 );
+
+ // - Are we at a hole boundary face?
+ if ( shells(1).IsSame( BRepClass3d::OuterShell( solid1 )) )
+ { // - No, but maybe a hole is bound by two shapes? Does shells(1) touches another shell?
+ bool touch = false;
+ TopExp_Explorer eExp( shells(1), TopAbs_EDGE );
+ // check if any edge of shells(1) belongs to another shell
+ for ( ; eExp.More() && !touch; eExp.Next() ) {
+ ansIt = mesh.GetAncestors( eExp.Current() );
+ for ( ; ansIt.More() && !touch; ansIt.Next() ) {
+ if ( ansIt.Value().ShapeType() == TopAbs_SHELL )
+ touch = ( !ansIt.Value().IsSame( shells(1) ));
+ }
+ }
+ if (!touch)
+ return meshDS->ShapeToIndex( solid1 );
+ }
+ }
+ // find orientation of geom face within the first solid
+ TopExp_Explorer fExp( solid1, TopAbs_FACE );
+ for ( ; fExp.More(); fExp.Next() )
+ if ( geomFace.IsSame( fExp.Current() )) {
+ geomFace = TopoDS::Face( fExp.Current() );
+ break;
+ }
+ if ( !fExp.More() )
+ return invalidID; // face not found
+
+ // normale to triangle
+ gp_Pnt node1Pnt ( node1->X(), node1->Y(), node1->Z() );
+ gp_Pnt node2Pnt ( node2->X(), node2->Y(), node2->Z() );
+ gp_Pnt node3Pnt ( node3->X(), node3->Y(), node3->Z() );
+ gp_Vec vec12( node1Pnt, node2Pnt );
+ gp_Vec vec13( node1Pnt, node3Pnt );
+ gp_Vec meshNormal = vec12 ^ vec13;
+ if ( meshNormal.SquareMagnitude() < DBL_MIN )
+ return invalidID;
+
+ // get normale to geomFace at any node
+ bool geomNormalOK = false;
+ gp_Vec geomNormal;
+ SMESH_MesherHelper helper( mesh ); helper.SetSubShape( geomFace );
+ for ( int i = 0; !geomNormalOK && i < 3; ++i )
+ {
+ // find UV of i-th node on geomFace
+ const SMDS_MeshNode* nNotOnSeamEdge = 0;
+ if ( helper.IsSeamShape( nodes[i]->getshapeId() )) {
+ if ( helper.IsSeamShape( nodes[(i+1)%3]->getshapeId() ))
+ nNotOnSeamEdge = nodes[(i+2)%3];
+ else
+ nNotOnSeamEdge = nodes[(i+1)%3];
+ }
+ bool uvOK;
+ gp_XY uv = helper.GetNodeUV( geomFace, nodes[i], nNotOnSeamEdge, &uvOK );
+ // check that uv is correct
+ if (uvOK) {
+ double tol = 1e-6;
+ TopoDS_Shape nodeShape = helper.GetSubShapeByNode( nodes[i], meshDS );
+ if ( !nodeShape.IsNull() )
+ switch ( nodeShape.ShapeType() )
+ {
+ case TopAbs_FACE: tol = BRep_Tool::Tolerance( TopoDS::Face( nodeShape )); break;
+ case TopAbs_EDGE: tol = BRep_Tool::Tolerance( TopoDS::Edge( nodeShape )); break;
+ case TopAbs_VERTEX: tol = BRep_Tool::Tolerance( TopoDS::Vertex( nodeShape )); break;
+ default:;
+ }
+ gp_Pnt nodePnt ( nodes[i]->X(), nodes[i]->Y(), nodes[i]->Z() );
+ BRepAdaptor_Surface surface( geomFace );
+ uvOK = ( nodePnt.Distance( surface.Value( uv.X(), uv.Y() )) < 2 * tol );
+ if ( uvOK ) {
+ // normale to geomFace at UV
+ gp_Vec du, dv;
+ surface.D1( uv.X(), uv.Y(), nodePnt, du, dv );
+ geomNormal = du ^ dv;
+ if ( geomFace.Orientation() == TopAbs_REVERSED )
+ geomNormal.Reverse();
+ geomNormalOK = ( geomNormal.SquareMagnitude() > DBL_MIN * 1e3 );
+ }
+ }
+ }
+ if ( !geomNormalOK)
+ return invalidID;
+
+ // compare normals
+ bool isReverse = ( meshNormal * geomNormal ) < 0;
+ if ( !isReverse )
+ return meshDS->ShapeToIndex( solid1 );
+
+ if ( solids.Extent() == 1 )
+ return HOLE_ID; // we are inside a hole
+ else
+ return meshDS->ShapeToIndex( solids(2) );
+}
+
+// //=======================================================================
+// //function : countShape
+// //purpose :
+// //=======================================================================
+//
+// template < class Mesh, class Shape >
+// static int countShape( Mesh* mesh, Shape shape ) {
+// TopExp_Explorer expShape ( mesh->ShapeToMesh(), shape );
+// TopTools_MapOfShape mapShape;
+// int nbShape = 0;
+// for ( ; expShape.More(); expShape.Next() ) {
+// if (mapShape.Add(expShape.Current())) {
+// nbShape++;
+// }
+// }
+// return nbShape;
+// }
+//
+// //=======================================================================
+// //function : getShape
+// //purpose :
+// //=======================================================================
+//
+// template < class Mesh, class Shape, class Tab >
+// void getShape(Mesh* mesh, Shape shape, Tab *t_Shape) {
+// TopExp_Explorer expShape ( mesh->ShapeToMesh(), shape );
+// TopTools_MapOfShape mapShape;
+// for ( int i=0; expShape.More(); expShape.Next() ) {
+// if (mapShape.Add(expShape.Current())) {
+// t_Shape[i] = expShape.Current();
+// i++;
+// }
+// }
+// return;
+// }
+//
+// // //=======================================================================
+// // //function : findEdgeID
+// // //purpose :
+// // //=======================================================================
+//
+// static int findEdgeID(const SMDS_MeshNode* aNode,
+// const SMESHDS_Mesh* theMesh,
+// const int nEdge,
+// const TopoDS_Shape* t_Edge) {
+//
+// TopoDS_Shape aPntShape, foundEdge;
+// TopoDS_Vertex aVertex;
+// gp_Pnt aPnt( aNode->X(), aNode->Y(), aNode->Z() );
+//
+// int foundInd, ind;
+// double nearest = RealLast(), *t_Dist;
+// double epsilon = Precision::Confusion();
+//
+// t_Dist = new double[ nEdge ];
+// aPntShape = BRepBuilderAPI_MakeVertex( aPnt ).Shape();
+// aVertex = TopoDS::Vertex( aPntShape );
+//
+// for ( ind=0; ind < nEdge; ind++ ) {
+// BRepExtrema_DistShapeShape aDistance ( aVertex, t_Edge[ind] );
+// t_Dist[ind] = aDistance.Value();
+// if ( t_Dist[ind] < nearest ) {
+// nearest = t_Dist[ind];
+// foundEdge = t_Edge[ind];
+// foundInd = ind;
+// if ( nearest < epsilon )
+// ind = nEdge;
+// }
+// }
+//
+// delete [] t_Dist;
+// return theMesh->ShapeToIndex( foundEdge );
+// }
+//
+//
+// // =======================================================================
+// // function : readGMFFile
+// // purpose : read GMF file with geometry associated to mesh
+// // =======================================================================
+//
+// static bool readGMFFile(const int fileOpen,
+// const char* theFileName,
+// SMESH_Mesh& theMesh,
+// const int nbShape,
+// const TopoDS_Shape* tabShape,
+// double** tabBox,
+// map <int,const SMDS_MeshNode*>& theGhs3dIdToNodeMap,
+// bool toMeshHoles,
+// int nbEnforcedVertices,
+// int nbEnforcedNodes)
+// {
+// TopoDS_Shape aShape;
+// TopoDS_Vertex aVertex;
+// SMESHDS_Mesh* theMeshDS = theMesh.GetMeshDS();
+// int nbElem = 0, nbRef = 0, IdShapeRef = 1;
+// int *tabID;
+// int aGMFNodeID = 0;
+// int compoundID =
+// nbShape ? theMeshDS->ShapeToIndex( tabShape[0] ) : theMeshDS->ShapeToIndex( theMeshDS->ShapeToMesh() );
+// int tetraShapeID = compoundID;
+// double epsilon = Precision::Confusion();
+// int *nodeAssigne, *GMFNodeAssigne;
+// SMDS_MeshNode** GMFNode;
+// TopoDS_Shape *tabCorner, *tabEdge;
+// std::map <GmfKwdCod,int> tabRef;
+//
+//
+// int ver, dim;
+// MESSAGE("Read " << theFileName << " file");
+// int InpMsh = GmfOpenMesh(theFileName, GmfRead, &ver, &dim);
+// if (!InpMsh)
+// return false;
+//
+// // ===========================
+// // Fill the tabID array: BEGIN
+// // ===========================
+//
+// /*
+// The output .mesh file does not contain yet the subdomain-info (Ghs3D 4.2)
+// */
+// Kernel_Utils::Localizer loc;
+// struct stat status;
+// size_t length;
+//
+// char *ptr, *mapPtr;
+// char *tetraPtr;
+// int *tab = new int[3];
+//
+// // Read the file state
+// fstat(fileOpen, &status);
+// length = status.st_size;
+//
+// // Mapping the result file into memory
+// #ifdef WIN32
+// HANDLE fd = CreateFile(theFileName, GENERIC_READ, FILE_SHARE_READ,
+// NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+// HANDLE hMapObject = CreateFileMapping(fd, NULL, PAGE_READONLY,
+// 0, (DWORD)length, NULL);
+// ptr = ( char* ) MapViewOfFile(hMapObject, FILE_MAP_READ, 0, 0, 0 );
+// #else
+// ptr = (char *) mmap(0,length,PROT_READ,MAP_PRIVATE,fileOpen,0);
+// #endif
+// mapPtr = ptr;
+//
+// ptr = readMapIntLine(ptr, tab);
+// tetraPtr = ptr;
+//
+// nbElem = tab[0];
+// int nbNodes = tab[1];
+//
+// for (int i=0; i < 4*nbElem; i++)
+// strtol(ptr, &ptr, 10);
+//
+// for (int iNode=1; iNode <= nbNodes; iNode++)
+// for (int iCoor=0; iCoor < 3; iCoor++)
+// strtod(ptr, &ptr);
+//
+//
+// // Reading the number of triangles which corresponds to the number of sub-domains
+// int nbTriangle = strtol(ptr, &ptr, 10);
+//
+//
+// // The keyword does not exist yet => to update when it is created
+// // int nbSubdomains = GmfStatKwd(InpMsh, GmfSubdomain);
+// // int id_tri[3];
+//
+//
+// tabID = new int[nbTriangle];
+// for (int i=0; i < nbTriangle; i++) {
+// tabID[i] = 0;
+// int nodeId1, nodeId2, nodeId3;
+// // find the solid corresponding to GHS3D sub-domain following
+// // the technique proposed in GHS3D manual in chapter
+// // "B.4 Subdomain (sub-region) assignment"
+//
+// nodeId1 = strtol(ptr, &ptr, 10);
+// nodeId2 = strtol(ptr, &ptr, 10);
+// nodeId3 = strtol(ptr, &ptr, 10);
+//
+// // // The keyword does not exist yet => to update when it is created
+// // GmfGetLin(InpMsh, GmfSubdomain, &id_tri[0], &id_tri[1], &id_tri[2]);
+// // nodeId1 = id_tri[0];
+// // nodeId2 = id_tri[1];
+// // nodeId3 = id_tri[2];
+//
+// if ( nbTriangle > 1 ) {
+// // get the nodes indices
+// const SMDS_MeshNode* n1 = theGhs3dIdToNodeMap[ nodeId1 ];
+// const SMDS_MeshNode* n2 = theGhs3dIdToNodeMap[ nodeId2 ];
+// const SMDS_MeshNode* n3 = theGhs3dIdToNodeMap[ nodeId3 ];
+// try {
+// OCC_CATCH_SIGNALS;
+// tabID[i] = findShapeID( theMesh, n1, n2, n3, toMeshHoles );
+// // -- 0020330: Pb with ghs3d as a submesh
+// // check that found shape is to be meshed
+// if ( tabID[i] > 0 ) {
+// const TopoDS_Shape& foundShape = theMeshDS->IndexToShape( tabID[i] );
+// bool isToBeMeshed = false;
+// for ( int iS = 0; !isToBeMeshed && iS < nbShape; ++iS )
+// isToBeMeshed = foundShape.IsSame( tabShape[ iS ]);
+// if ( !isToBeMeshed )
+// tabID[i] = HOLE_ID;
+// }
+// // END -- 0020330: Pb with ghs3d as a submesh
+// #ifdef _DEBUG_
+// std::cout << i+1 << " subdomain: findShapeID() returns " << tabID[i] << std::endl;
+// #endif
+// }
+// catch ( Standard_Failure & ex)
+// {
+// #ifdef _DEBUG_
+// std::cout << i+1 << " subdomain: Exception caugt: " << ex.GetMessageString() << std::endl;
+// #endif
+// }
+// catch (...) {
+// #ifdef _DEBUG_
+// std::cout << i+1 << " subdomain: unknown exception caught " << std::endl;
+// #endif
+// }
+// }
+// }
+//
+// // ===========================
+// // Fill the tabID array: END
+// // ===========================
+//
+//
+// tabRef[GmfVertices] = 3;
+// tabRef[GmfCorners] = 1;
+// tabRef[GmfEdges] = 2;
+// tabRef[GmfRidges] = 1;
+// tabRef[GmfTriangles] = 3;
+// // tabRef[GmfQuadrilaterals] = 4;
+// tabRef[GmfTetrahedra] = 4;
+// // tabRef[GmfHexahedra] = 8;
+//
+// SMDS_NodeIteratorPtr itOnGMFInputNode = theMeshDS->nodesIterator();
+// while ( itOnGMFInputNode->more() )
+// theMeshDS->RemoveNode( itOnGMFInputNode->next() );
+//
+//
+// int nbVertices = GmfStatKwd(InpMsh, GmfVertices);
+// int nbCorners = max(countShape( theMeshDS, TopAbs_VERTEX ) , GmfStatKwd(InpMsh, GmfCorners));
+// int nbShapeEdge = countShape( theMeshDS, TopAbs_EDGE );
+//
+// tabCorner = new TopoDS_Shape[ nbCorners ];
+// tabEdge = new TopoDS_Shape[ nbShapeEdge ];
+// nodeAssigne = new int[ nbVertices + 1 ];
+// GMFNodeAssigne = new int[ nbVertices + 1 ];
+// GMFNode = new SMDS_MeshNode*[ nbVertices + 1 ];
+//
+// getShape(theMeshDS, TopAbs_VERTEX, tabCorner);
+// getShape(theMeshDS, TopAbs_EDGE, tabEdge);
+//
+// std::map <GmfKwdCod,int>::const_iterator it = tabRef.begin();
+// for ( ; it != tabRef.end() ; ++it)
+// {
+// // int dummy;
+// GmfKwdCod token = it->first;
+// nbRef = it->second;
+//
+// nbElem = GmfStatKwd(InpMsh, token);
+// if (nbElem > 0) {
+// GmfGotoKwd(InpMsh, token);
+// std::cout << "Read " << nbElem;
+// }
+// else
+// continue;
+//
+// int id[nbElem*tabRef[token]];
+// int ghs3dShapeID[nbElem];
+//
+// if (token == GmfVertices) {
+// std::cout << " vertices" << std::endl;
+// int aGMFID;
+//
+// float VerTab_f[nbElem][3];
+// double VerTab_d[nbElem][3];
+// SMDS_MeshNode * aGMFNode;
+//
+// for ( int iElem = 0; iElem < nbElem; iElem++ ) {
+// aGMFID = iElem + 1;
+// if (ver == GmfFloat) {
+// GmfGetLin(InpMsh, token, &VerTab_f[nbElem][0], &VerTab_f[nbElem][1], &VerTab_f[nbElem][2], &ghs3dShapeID[iElem]);
+// aGMFNode = theMeshDS->AddNode(VerTab_f[nbElem][0], VerTab_f[nbElem][1], VerTab_f[nbElem][2]);
+// }
+// else {
+// GmfGetLin(InpMsh, token, &VerTab_d[nbElem][0], &VerTab_d[nbElem][1], &VerTab_d[nbElem][2], &ghs3dShapeID[iElem]);
+// aGMFNode = theMeshDS->AddNode(VerTab_d[nbElem][0], VerTab_d[nbElem][1], VerTab_d[nbElem][2]);
+// }
+// GMFNode[ aGMFID ] = aGMFNode;
+// nodeAssigne[ aGMFID ] = 0;
+// GMFNodeAssigne[ aGMFID ] = 0;
+// }
+// }
+// else if (token == GmfCorners && nbElem > 0) {
+// std::cout << " corners" << std::endl;
+// for ( int iElem = 0; iElem < nbElem; iElem++ )
+// GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]]);
+// }
+// else if (token == GmfRidges && nbElem > 0) {
+// std::cout << " ridges" << std::endl;
+// for ( int iElem = 0; iElem < nbElem; iElem++ )
+// GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]]);
+// }
+// else if (token == GmfEdges && nbElem > 0) {
+// std::cout << " edges" << std::endl;
+// for ( int iElem = 0; iElem < nbElem; iElem++ )
+// GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &ghs3dShapeID[iElem]);
+// }
+// else if (token == GmfTriangles && nbElem > 0) {
+// std::cout << " triangles" << std::endl;
+// for ( int iElem = 0; iElem < nbElem; iElem++ )
+// GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &ghs3dShapeID[iElem]);
+// }
+// // else if (token == GmfQuadrilaterals && nbElem > 0) {
+// // std::cout << " Quadrilaterals" << std::endl;
+// // for ( int iElem = 0; iElem < nbElem; iElem++ )
+// // GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3], &ghs3dShapeID[iElem]);
+// // }
+// else if (token == GmfTetrahedra && nbElem > 0) {
+// std::cout << " Tetrahedra" << std::endl;
+// for ( int iElem = 0; iElem < nbElem; iElem++ )
+// GmfGetLin(InpMsh, token,
+// &id[iElem*tabRef[token]],
+// &id[iElem*tabRef[token]+1],
+// &id[iElem*tabRef[token]+2],
+// &id[iElem*tabRef[token]+3],
+// &ghs3dShapeID[iElem]);
+// }
+// // else if (token == GmfHexahedra && nbElem > 0) {
+// // std::cout << " Hexahedra" << std::endl;
+// // for ( int iElem = 0; iElem < nbElem; iElem++ )
+// // GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3],
+// // &id[iElem*tabRef[token]+4], &id[iElem*tabRef[token]+5], &id[iElem*tabRef[token]+6], &id[iElem*tabRef[token]+7], &ghs3dShapeID[iElem]);
+// // }
+//
+// switch (token) {
+// case GmfCorners:
+// case GmfRidges:
+// case GmfEdges:
+// case GmfTriangles:
+// // case GmfQuadrilaterals:
+// case GmfTetrahedra:
+// // case GmfHexahedra:
+// {
+// int nodeDim, shapeID, *nodeID;
+// const SMDS_MeshNode** node;
+// // std::vector< SMDS_MeshNode* > enfNode( nbRef );
+// SMDS_MeshElement * aGMFElement;
+//
+// node = new const SMDS_MeshNode*[nbRef];
+// nodeID = new int[ nbRef ];
+//
+// for ( int iElem = 0; iElem < nbElem; iElem++ )
+// {
+// for ( int iRef = 0; iRef < nbRef; iRef++ )
+// {
+// aGMFNodeID = id[iElem*tabRef[token]+iRef]; // read nbRef aGMFNodeID
+// node [ iRef ] = GMFNode[ aGMFNodeID ];
+// nodeID[ iRef ] = aGMFNodeID;
+// }
+//
+// switch (token)
+// {
+// case GmfCorners: {
+// nodeDim = 1;
+// gp_Pnt GMFPnt ( node[0]->X(), node[0]->Y(), node[0]->Z() );
+// for ( int i=0; i<nbElem; i++ ) {
+// aVertex = TopoDS::Vertex( tabCorner[i] );
+// gp_Pnt aPnt = BRep_Tool::Pnt( aVertex );
+// if ( aPnt.Distance( GMFPnt ) < epsilon )
+// break;
+// }
+// break;
+// }
+// case GmfEdges: {
+// nodeDim = 2;
+// aGMFElement = theMeshDS->AddEdge( node[0], node[1] );
+// int iNode = 1;
+// if ( GMFNodeAssigne[ nodeID[0] ] == 0 || GMFNodeAssigne[ nodeID[0] ] == 2 )
+// iNode = 0;
+// shapeID = findEdgeID( node[iNode], theMeshDS, nbShapeEdge, tabEdge );
+// break;
+// }
+// case GmfRidges:
+// break;
+// case GmfTriangles: {
+// nodeDim = 3;
+// aGMFElement = theMeshDS->AddFace( node[0], node[1], node[2]);
+// shapeID = -1;
+// break;
+// }
+// // case GmfQuadrilaterals: {
+// // nodeDim = 4;
+// // aGMFElement = theMeshDS->AddFace( node[0], node[1], node[2], node[3] );
+// // shapeID = -1;
+// // break;
+// // }
+// case GmfTetrahedra: {
+//
+// // IN WORK
+// TopoDS_Shape aSolid;
+// // We always run GHS3D with "to mesh holes"==TRUE but we must not create
+// // tetras within holes depending on hypo option,
+// // so we first check if aTet is inside a hole and then create it
+// if ( nbTriangle > 1 ) {
+// tetraShapeID = HOLE_ID; // negative tetraShapeID means not to create tetras if !toMeshHoles
+// int aGhs3dShapeID = ghs3dShapeID[iElem] - IdShapeRef;
+// if ( tabID[ aGhs3dShapeID ] == 0 ) {
+// TopAbs_State state;
+// aSolid = findShape(node, aSolid, tabShape, tabBox, nbShape, &state);
+// if ( toMeshHoles || state == TopAbs_IN )
+// tetraShapeID = theMeshDS->ShapeToIndex( aSolid );
+// tabID[ aGhs3dShapeID ] = tetraShapeID;
+// }
+// else
+// tetraShapeID = tabID[ aGhs3dShapeID ];
+// }
+// else if ( nbShape > 1 ) {
+// // Case where nbTriangle == 1 while nbShape == 2 encountered
+// // with compound of 2 boxes and "To mesh holes"==False,
+// // so there are no subdomains specified for each tetrahedron.
+// // Try to guess a solid by a node already bound to shape
+// tetraShapeID = 0;
+// for ( int i=0; i<4 && tetraShapeID==0; i++ ) {
+// if ( nodeAssigne[ nodeID[i] ] == 1 &&
+// node[i]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_3DSPACE &&
+// node[i]->getshapeId() > 1 )
+// {
+// tetraShapeID = node[i]->getshapeId();
+// }
+// }
+// if ( tetraShapeID==0 ) {
+// aSolid = findShape(node, aSolid, tabShape, tabBox, nbShape);
+// tetraShapeID = theMeshDS->ShapeToIndex( aSolid );
+// }
+// }
+// // set new nodes and tetrahedron onto the shape
+// for ( int i=0; i<4; i++ ) {
+// if ( nodeAssigne[ nodeID[i] ] == 0 ) {
+// if ( tetraShapeID != HOLE_ID )
+// theMeshDS->SetNodeInVolume( node[i], tetraShapeID );
+// nodeAssigne[ nodeID[i] ] = tetraShapeID;
+// }
+// }
+// if ( toMeshHoles || tetraShapeID != HOLE_ID ) {
+// aGMFElement = theMeshDS->AddVolume( node[1], node[0], node[2], node[3] );
+// theMeshDS->SetMeshElementOnShape( aGMFElement, tetraShapeID );
+// }
+//
+// // IN WORK
+//
+// nodeDim = 5;
+// break;
+// }
+// // case GmfHexahedra: {
+// // nodeDim = 6;
+// // aGMFElement = theMeshDS->AddVolume( node[0], node[3], node[2], node[1],
+// // node[4], node[7], node[6], node[5] );
+// // break;
+// // }
+// default: continue;
+// }
+// if (token != GmfRidges)
+// {
+// for ( int i=0; i<nbRef; i++ ) {
+// if ( GMFNodeAssigne[ nodeID[i] ] == 0 ) {
+// if ( token == GmfCorners ) theMeshDS->SetNodeOnVertex( node[0], aVertex );
+// else if ( token == GmfEdges ) theMeshDS->SetNodeOnEdge( node[i], shapeID );
+// else if ( token == GmfTriangles ) theMeshDS->SetNodeOnFace( node[i], shapeID );
+// GMFNodeAssigne[ nodeID[i] ] = nodeDim;
+// }
+// }
+// if ( token != "Corners" )
+// theMeshDS->SetMeshElementOnShape( aGMFElement, shapeID );
+// }
+// } // for
+//
+// if ( !toMeshHoles ) {
+// map <int,const SMDS_MeshNode*>::iterator itOnNode = theGhs3dIdToNodeMap.find( nbVertices-(nbEnforcedVertices+nbEnforcedNodes) );
+// for ( ; itOnNode != theGhs3dIdToNodeMap.end(); ++itOnNode) {
+// if ( nodeAssigne[ itOnNode->first ] == HOLE_ID )
+// theMeshDS->RemoveFreeNode( itOnNode->second, 0 );
+// }
+// }
+//
+// delete [] node;
+// delete [] nodeID;
+// break;
+// } // case GmfTetrahedra
+// } // switch(token)
+// } // for
+// cout << std::endl;
+//
+// #ifdef WIN32
+// UnmapViewOfFile(mapPtr);
+// CloseHandle(hMapObject);
+// CloseHandle(fd);
+// #else
+// munmap(mapPtr, length);
+// #endif
+// close(fileOpen);
+//
+// delete [] tabID;
+// delete [] tabCorner;
+// delete [] tabEdge;
+// delete [] nodeAssigne;
+// delete [] GMFNodeAssigne;
+// delete [] GMFNode;
+//
+// return true;
+// }
+
+
+//=======================================================================
+//function : addElemInMeshGroup
+//purpose : Update or create groups in mesh
+//=======================================================================
+
+static void addElemInMeshGroup(SMESH_Mesh* theMesh,
+ const SMDS_MeshElement* anElem,
+ std::string& groupName,
+ std::set<std::string>& groupsToRemove)
+{
+ if ( !anElem ) return; // issue 0021776
+
+ bool groupDone = false;
+ SMESH_Mesh::GroupIteratorPtr grIt = theMesh->GetGroups();
+ while (grIt->more()) {
+ SMESH_Group * group = grIt->next();
+ if ( !group ) continue;
+ SMESHDS_GroupBase* groupDS = group->GetGroupDS();
+ if ( !groupDS ) continue;
+ if ( groupDS->GetType()==anElem->GetType() &&groupName.compare(group->GetName())==0) {
+ SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( groupDS );
+ aGroupDS->SMDSGroup().Add(anElem);
+ groupDone = true;
+// MESSAGE("Successfully added enforced element to existing group " << groupName);
+ break;
+ }
+ }
+
+ if (!groupDone)
+ {
+ int groupId;
+ SMESH_Group* aGroup = theMesh->AddGroup(anElem->GetType(), groupName.c_str(), groupId);
+ aGroup->SetName( groupName.c_str() );
+ SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( aGroup->GetGroupDS() );
+ aGroupDS->SMDSGroup().Add(anElem);
+// MESSAGE("Successfully created enforced vertex group " << groupName);
+ groupDone = true;
+ }
+ if (!groupDone)
+ throw SALOME_Exception(LOCALIZED("A given element was not added to a group"));
+}
+
+
+//=======================================================================
+//function : updateMeshGroups
+//purpose : Update or create groups in mesh
+//=======================================================================
+
+static void updateMeshGroups(SMESH_Mesh* theMesh, std::set<std::string> groupsToRemove)
+{
+ SMESH_Mesh::GroupIteratorPtr grIt = theMesh->GetGroups();
+ while (grIt->more()) {
+ SMESH_Group * group = grIt->next();
+ if ( !group ) continue;
+ SMESHDS_GroupBase* groupDS = group->GetGroupDS();
+ if ( !groupDS ) continue;
+ std::string currentGroupName = (string)group->GetName();
+ if (groupDS->IsEmpty() && groupsToRemove.find(currentGroupName) != groupsToRemove.end()) {
+ // Previous group created by enforced elements
+ MESSAGE("Delete previous group created by removed enforced elements: " << group->GetName())
+ theMesh->RemoveGroup(groupDS->GetID());
+ }
+ }
+}
+
+//=======================================================================
+//function : removeEmptyGroupsOfDomains
+//purpose : remove empty groups named "Domain_nb" created due to
+// "To make groups of domains" option.
+//=======================================================================
+
+static void removeEmptyGroupsOfDomains(SMESH_Mesh* mesh,
+ bool notEmptyAsWell = false)
+{
+ const char* refName = theDomainGroupNamePrefix;
+ const size_t refLen = strlen( theDomainGroupNamePrefix );
+
+ std::list<int> groupIDs = mesh->GetGroupIds();
+ std::list<int>::const_iterator id = groupIDs.begin();
+ for ( ; id != groupIDs.end(); ++id )
+ {
+ SMESH_Group* group = mesh->GetGroup( *id );
+ if ( !group || ( !group->GetGroupDS()->IsEmpty() && !notEmptyAsWell ))
+ continue;
+ const char* name = group->GetName();
+ char* end;
+ // check the name
+ if ( strncmp( name, refName, refLen ) == 0 && // starts from refName;
+ isdigit( *( name + refLen )) && // refName is followed by a digit;
+ strtol( name + refLen, &end, 10) >= 0 && // there are only digits ...
+ *end == '\0') // ... till a string end.
+ {
+ mesh->RemoveGroup( *id );
+ }
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Create the groups corresponding to domains
+ */
+//================================================================================
+
+static void makeDomainGroups( std::vector< std::vector< const SMDS_MeshElement* > >& elemsOfDomain,
+ SMESH_MesherHelper* theHelper)
+{
+ // int nbDomains = 0;
+ // for ( size_t i = 0; i < elemsOfDomain.size(); ++i )
+ // nbDomains += ( elemsOfDomain[i].size() > 0 );
+
+ // if ( nbDomains > 1 )
+ for ( size_t iDomain = 0; iDomain < elemsOfDomain.size(); ++iDomain )
+ {
+ std::vector< const SMDS_MeshElement* > & elems = elemsOfDomain[ iDomain ];
+ if ( elems.empty() ) continue;
+
+ // find existing groups
+ std::vector< SMESH_Group* > groupOfType( SMDSAbs_NbElementTypes, (SMESH_Group*)NULL );
+ const std::string domainName = ( SMESH_Comment( theDomainGroupNamePrefix ) << iDomain );
+ SMESH_Mesh::GroupIteratorPtr groupIt = theHelper->GetMesh()->GetGroups();
+ while ( groupIt->more() )
+ {
+ SMESH_Group* group = groupIt->next();
+ if ( domainName == group->GetName() &&
+ dynamic_cast< SMESHDS_Group* >( group->GetGroupDS()) )
+ groupOfType[ group->GetGroupDS()->GetType() ] = group;
+ }
+ // create and fill the groups
+ size_t iElem = 0;
+ int groupID;
+ do
+ {
+ SMESH_Group* group = groupOfType[ elems[ iElem ]->GetType() ];
+ if ( !group )
+ group = theHelper->GetMesh()->AddGroup( elems[ iElem ]->GetType(),
+ domainName.c_str(), groupID );
+ SMDS_MeshGroup& groupDS =
+ static_cast< SMESHDS_Group* >( group->GetGroupDS() )->SMDSGroup();
+
+ while ( iElem < elems.size() && groupDS.Add( elems[iElem] ))
+ ++iElem;
+
+ } while ( iElem < elems.size() );
+ }
+}
+
+//=======================================================================
+//function : readGMFFile
+//purpose : read GMF file w/o geometry associated to mesh
+//=======================================================================
+
+static bool readGMFFile(const char* theFile,
+ GHS3DPlugin_GHS3D* theAlgo,
+ SMESH_MesherHelper* theHelper,
+ std::vector <const SMDS_MeshNode*> & theNodeByGhs3dId,
+ std::vector <const SMDS_MeshElement*> & theFaceByGhs3dId,
+ map<const SMDS_MeshNode*,int> & theNodeToGhs3dIdMap,
+ std::vector<std::string> & aNodeGroupByGhs3dId,
+ std::vector<std::string> & anEdgeGroupByGhs3dId,
+ std::vector<std::string> & aFaceGroupByGhs3dId,
+ std::set<std::string> & groupsToRemove,
+ bool toMakeGroupsOfDomains=false,
+ bool toMeshHoles=true)
+{
+ std::string tmpStr;
+ SMESHDS_Mesh* theMeshDS = theHelper->GetMeshDS();
+ const bool hasGeom = ( theHelper->GetMesh()->HasShapeToMesh() );
+
+ int nbInitialNodes = theNodeByGhs3dId.size();
+ int nbMeshNodes = theMeshDS->NbNodes();
+
+ const bool isQuadMesh =
+ theHelper->GetMesh()->NbEdges( ORDER_QUADRATIC ) ||
+ theHelper->GetMesh()->NbFaces( ORDER_QUADRATIC ) ||
+ theHelper->GetMesh()->NbVolumes( ORDER_QUADRATIC );
+
+#ifdef _DEBUG_
+ std::cout << "theNodeByGhs3dId.size(): " << nbInitialNodes << std::endl;
+ std::cout << "theHelper->GetMesh()->NbNodes(): " << nbMeshNodes << std::endl;
+ std::cout << "isQuadMesh: " << isQuadMesh << std::endl;
+#endif
+
+ // ---------------------------------
+ // Read generated elements and nodes
+ // ---------------------------------
+
+ int nbElem = 0, nbRef = 0;
+ int aGMFNodeID = 0;
+ const SMDS_MeshNode** GMFNode;
+#ifdef _DEBUG_
+ std::map<int, std::set<int> > subdomainId2tetraId;
+#endif
+ std::map <GmfKwdCod,int> tabRef;
+ const bool force3d = !hasGeom;
+ const int noID = 0;
+
+ tabRef[GmfVertices] = 3; // for new nodes and enforced nodes
+ tabRef[GmfCorners] = 1;
+ tabRef[GmfEdges] = 2; // for enforced edges
+ tabRef[GmfRidges] = 1;
+ tabRef[GmfTriangles] = 3; // for enforced faces
+ tabRef[GmfQuadrilaterals] = 4;
+ tabRef[GmfTetrahedra] = 4; // for new tetras
+ tabRef[GmfHexahedra] = 8;
+
+ int ver, dim;
+ MESSAGE("Read " << theFile << " file");
+ int InpMsh = GmfOpenMesh(theFile, GmfRead, &ver, &dim);
+ if (!InpMsh)
+ return false;
+ MESSAGE("Done ");
+
+ // Read ids of domains
+ vector< int > solidIDByDomain;
+ if ( hasGeom )
+ {
+ int solid1; // id used in case of 1 domain or some reading failure
+ if ( theHelper->GetSubShape().ShapeType() == TopAbs_SOLID )
+ solid1 = theHelper->GetSubShapeID();
+ else
+ solid1 = theMeshDS->ShapeToIndex
+ ( TopExp_Explorer( theHelper->GetSubShape(), TopAbs_SOLID ).Current() );
+
+ int nbDomains = GmfStatKwd( InpMsh, GmfSubDomainFromGeom );
+ if ( nbDomains > 1 )
+ {
+ solidIDByDomain.resize( nbDomains+1, theHelper->GetSubShapeID() );
+ int faceNbNodes, faceIndex, orientation, domainNb;
+ GmfGotoKwd( InpMsh, GmfSubDomainFromGeom );
+ for ( int i = 0; i < nbDomains; ++i )
+ {
+ faceIndex = 0;
+ GmfGetLin( InpMsh, GmfSubDomainFromGeom,
+ &faceNbNodes, &faceIndex, &orientation, &domainNb);
+ solidIDByDomain[ domainNb ] = 1;
+ if ( 0 < faceIndex && faceIndex-1 < theFaceByGhs3dId.size() )
+ {
+ const SMDS_MeshElement* face = theFaceByGhs3dId[ faceIndex-1 ];
+ const SMDS_MeshNode* nn[3] = { face->GetNode(0),
+ face->GetNode(1),
+ face->GetNode(2) };
+ if ( orientation < 0 )
+ std::swap( nn[1], nn[2] );
+ solidIDByDomain[ domainNb ] =
+ findShapeID( *theHelper->GetMesh(), nn[0], nn[1], nn[2], toMeshHoles );
+ if ( solidIDByDomain[ domainNb ] > 0 )
+ {
+ const TopoDS_Shape& foundShape = theMeshDS->IndexToShape( solidIDByDomain[ domainNb ] );
+ if ( ! theHelper->IsSubShape( foundShape, theHelper->GetSubShape() ))
+ solidIDByDomain[ domainNb ] = HOLE_ID;
+ }
+ }
+ }
+ }
+ if ( solidIDByDomain.size() < 2 )
+ solidIDByDomain.resize( 2, solid1 );
+ }
+
+ // Issue 0020682. Avoid creating nodes and tetras at place where
+ // volumic elements already exist
+ SMESH_ElementSearcher* elemSearcher = 0;
+ std::vector< const SMDS_MeshElement* > foundVolumes;
+ if ( !hasGeom && theHelper->GetMesh()->NbVolumes() > 0 )
+ elemSearcher = SMESH_MeshAlgos::GetElementSearcher( *theMeshDS );
+ auto_ptr< SMESH_ElementSearcher > elemSearcherDeleter( elemSearcher );
+
+ // IMP 0022172: [CEA 790] create the groups corresponding to domains
+ std::vector< std::vector< const SMDS_MeshElement* > > elemsOfDomain;
+
+ int nbVertices = GmfStatKwd(InpMsh, GmfVertices) - nbInitialNodes;
+ GMFNode = new const SMDS_MeshNode*[ nbVertices + 1 ];
+
+ std::map <GmfKwdCod,int>::const_iterator it = tabRef.begin();
+ for ( ; it != tabRef.end() ; ++it)
+ {
+ if(theAlgo->computeCanceled()) {
+ GmfCloseMesh(InpMsh);
+ delete [] GMFNode;
+ return false;
+ }
+ int dummy, solidID;
+ GmfKwdCod token = it->first;
+ nbRef = it->second;
+
+ nbElem = GmfStatKwd(InpMsh, token);
+ if (nbElem > 0) {
+ GmfGotoKwd(InpMsh, token);
+ std::cout << "Read " << nbElem;
+ }
+ else
+ continue;
+
+ std::vector<int> id (nbElem*tabRef[token]); // node ids
+ std::vector<int> domainID( nbElem ); // domain
+
+ if (token == GmfVertices) {
+ (nbElem <= 1) ? tmpStr = " vertex" : tmpStr = " vertices";
+// std::cout << nbInitialNodes << " from input mesh " << std::endl;
+
+ // Remove orphan nodes from previous enforced mesh which was cleared
+// if ( nbElem < nbMeshNodes ) {
+// const SMDS_MeshNode* node;
+// SMDS_NodeIteratorPtr nodeIt = theMeshDS->nodesIterator();
+// while ( nodeIt->more() )
+// {
+// node = nodeIt->next();
+// if (theNodeToGhs3dIdMap.find(node) != theNodeToGhs3dIdMap.end())
+// theMeshDS->RemoveNode(node);
+// }
+// }
+
+
+ int aGMFID;
+
+ float VerTab_f[3];
+ double x, y, z;
+ const SMDS_MeshNode * aGMFNode;
+
+ for ( int iElem = 0; iElem < nbElem; iElem++ ) {
+ if(theAlgo->computeCanceled()) {
+ GmfCloseMesh(InpMsh);
+ delete [] GMFNode;
+ return false;
+ }
+ if (ver == GmfFloat) {
+ GmfGetLin(InpMsh, token, &VerTab_f[0], &VerTab_f[1], &VerTab_f[2], &dummy);
+ x = VerTab_f[0];
+ y = VerTab_f[1];
+ z = VerTab_f[2];
+ }
+ else {
+ GmfGetLin(InpMsh, token, &x, &y, &z, &dummy);
+ }
+ if (iElem >= nbInitialNodes) {
+ if ( elemSearcher &&
+ elemSearcher->FindElementsByPoint( gp_Pnt(x,y,z), SMDSAbs_Volume, foundVolumes))
+ aGMFNode = 0;
+ else
+ aGMFNode = theHelper->AddNode(x, y, z);
+
+ aGMFID = iElem -nbInitialNodes +1;
+ GMFNode[ aGMFID ] = aGMFNode;
+ if (aGMFID-1 < aNodeGroupByGhs3dId.size() && !aNodeGroupByGhs3dId.at(aGMFID-1).empty())
+ addElemInMeshGroup(theHelper->GetMesh(), aGMFNode, aNodeGroupByGhs3dId.at(aGMFID-1), groupsToRemove);
+ }
+ }
+ }
+ else if (token == GmfCorners && nbElem > 0) {
+ (nbElem <= 1) ? tmpStr = " corner" : tmpStr = " corners";
+ for ( int iElem = 0; iElem < nbElem; iElem++ )
+ GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]]);
+ }
+ else if (token == GmfRidges && nbElem > 0) {
+ (nbElem <= 1) ? tmpStr = " ridge" : tmpStr = " ridges";
+ for ( int iElem = 0; iElem < nbElem; iElem++ )
+ GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]]);
+ }
+ else if (token == GmfEdges && nbElem > 0) {
+ (nbElem <= 1) ? tmpStr = " edge" : tmpStr = " edges";
+ for ( int iElem = 0; iElem < nbElem; iElem++ )
+ GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &domainID[iElem]);
+ }
+ else if (token == GmfTriangles && nbElem > 0) {
+ (nbElem <= 1) ? tmpStr = " triangle" : tmpStr = " triangles";
+ for ( int iElem = 0; iElem < nbElem; iElem++ )
+ GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &domainID[iElem]);
+ }
+ else if (token == GmfQuadrilaterals && nbElem > 0) {
+ (nbElem <= 1) ? tmpStr = " Quadrilateral" : tmpStr = " Quadrilaterals";
+ for ( int iElem = 0; iElem < nbElem; iElem++ )
+ GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3], &domainID[iElem]);
+ }
+ else if (token == GmfTetrahedra && nbElem > 0) {
+ (nbElem <= 1) ? tmpStr = " Tetrahedron" : tmpStr = " Tetrahedra";
+ for ( int iElem = 0; iElem < nbElem; iElem++ ) {
+ GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3], &domainID[iElem]);
+#ifdef _DEBUG_
+ subdomainId2tetraId[dummy].insert(iElem+1);
+// MESSAGE("subdomainId2tetraId["<<dummy<<"].insert("<<iElem+1<<")");
+#endif
+ }
+ }
+ else if (token == GmfHexahedra && nbElem > 0) {
+ (nbElem <= 1) ? tmpStr = " Hexahedron" : tmpStr = " Hexahedra";
+ for ( int iElem = 0; iElem < nbElem; iElem++ )
+ GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3],
+ &id[iElem*tabRef[token]+4], &id[iElem*tabRef[token]+5], &id[iElem*tabRef[token]+6], &id[iElem*tabRef[token]+7], &domainID[iElem]);
+ }
+ std::cout << tmpStr << std::endl;
+ std::cout << std::endl;
+
+ switch (token) {
+ case GmfCorners:
+ case GmfRidges:
+ case GmfEdges:
+ case GmfTriangles:
+ case GmfQuadrilaterals:
+ case GmfTetrahedra:
+ case GmfHexahedra:
+ {
+ std::vector< const SMDS_MeshNode* > node( nbRef );
+ std::vector< int > nodeID( nbRef );
+ std::vector< SMDS_MeshNode* > enfNode( nbRef );
+ const SMDS_MeshElement* aCreatedElem;
+
+ for ( int iElem = 0; iElem < nbElem; iElem++ )
+ {
+ if(theAlgo->computeCanceled()) {
+ GmfCloseMesh(InpMsh);
+ delete [] GMFNode;
+ return false;
+ }
+ // Check if elem is already in input mesh. If yes => skip
+ bool fullyCreatedElement = false; // if at least one of the nodes was created
+ for ( int iRef = 0; iRef < nbRef; iRef++ )
+ {
+ aGMFNodeID = id[iElem*tabRef[token]+iRef]; // read nbRef aGMFNodeID
+ if (aGMFNodeID <= nbInitialNodes) // input nodes
+ {
+ aGMFNodeID--;
+ node[ iRef ] = theNodeByGhs3dId[aGMFNodeID];
+ }
+ else
+ {
+ fullyCreatedElement = true;
+ aGMFNodeID -= nbInitialNodes;
+ nodeID[ iRef ] = aGMFNodeID ;
+ node [ iRef ] = GMFNode[ aGMFNodeID ];
+ }
+ }
+ aCreatedElem = 0;
+ switch (token)
+ {
+ case GmfEdges:
+ if (fullyCreatedElement) {
+ aCreatedElem = theHelper->AddEdge( node[0], node[1], noID, force3d );
+ if (anEdgeGroupByGhs3dId.size() && !anEdgeGroupByGhs3dId[iElem].empty())
+ addElemInMeshGroup(theHelper->GetMesh(), aCreatedElem, anEdgeGroupByGhs3dId[iElem], groupsToRemove);
+ }
+ break;
+ case GmfTriangles:
+ if (fullyCreatedElement) {
+ aCreatedElem = theHelper->AddFace( node[0], node[1], node[2], noID, force3d );
+ if (aFaceGroupByGhs3dId.size() && !aFaceGroupByGhs3dId[iElem].empty())
+ addElemInMeshGroup(theHelper->GetMesh(), aCreatedElem, aFaceGroupByGhs3dId[iElem], groupsToRemove);
+ }
+ break;
+ case GmfQuadrilaterals:
+ if (fullyCreatedElement) {
+ aCreatedElem = theHelper->AddFace( node[0], node[1], node[2], node[3], noID, force3d );
+ }
+ break;
+ case GmfTetrahedra:
+ if ( hasGeom )
+ {
+ solidID = solidIDByDomain[ domainID[iElem]];
+ if ( solidID != HOLE_ID )
+ {
+ aCreatedElem = theHelper->AddVolume( node[1], node[0], node[2], node[3],
+ noID, force3d );
+ theMeshDS->SetMeshElementOnShape( aCreatedElem, solidID );
+ for ( int iN = 0; iN < 4; ++iN )
+ if ( node[iN]->getshapeId() < 1 )
+ theMeshDS->SetNodeInVolume( node[iN], solidID );
+ }
+ }
+ else
+ {
+ if ( elemSearcher ) {
+ // Issue 0020682. Avoid creating nodes and tetras at place where
+ // volumic elements already exist
+ if ( !node[1] || !node[0] || !node[2] || !node[3] )
+ continue;
+ if ( elemSearcher->FindElementsByPoint((SMESH_TNodeXYZ(node[0]) +
+ SMESH_TNodeXYZ(node[1]) +
+ SMESH_TNodeXYZ(node[2]) +
+ SMESH_TNodeXYZ(node[3]) ) / 4.,
+ SMDSAbs_Volume, foundVolumes ))
+ break;
+ }
+ aCreatedElem = theHelper->AddVolume( node[1], node[0], node[2], node[3],
+ noID, force3d );
+ }
+ break;
+ case GmfHexahedra:
+ if ( hasGeom )
+ {
+ solidID = solidIDByDomain[ domainID[iElem]];
+ if ( solidID != HOLE_ID )
+ {
+ aCreatedElem = theHelper->AddVolume( node[0], node[3], node[2], node[1],
+ node[4], node[7], node[6], node[5],
+ noID, force3d );
+ theMeshDS->SetMeshElementOnShape( aCreatedElem, solidID );
+ for ( int iN = 0; iN < 8; ++iN )
+ if ( node[iN]->getshapeId() < 1 )
+ theMeshDS->SetNodeInVolume( node[iN], solidID );
+ }
+ }
+ else
+ {
+ if ( elemSearcher ) {
+ // Issue 0020682. Avoid creating nodes and tetras at place where
+ // volumic elements already exist
+ if ( !node[1] || !node[0] || !node[2] || !node[3] || !node[4] || !node[5] || !node[6] || !node[7])
+ continue;
+ if ( elemSearcher->FindElementsByPoint((SMESH_TNodeXYZ(node[0]) +
+ SMESH_TNodeXYZ(node[1]) +
+ SMESH_TNodeXYZ(node[2]) +
+ SMESH_TNodeXYZ(node[3]) +
+ SMESH_TNodeXYZ(node[4]) +
+ SMESH_TNodeXYZ(node[5]) +
+ SMESH_TNodeXYZ(node[6]) +
+ SMESH_TNodeXYZ(node[7])) / 8.,
+ SMDSAbs_Volume, foundVolumes ))
+ break;
+ }
+ aCreatedElem = theHelper->AddVolume( node[0], node[3], node[2], node[1],
+ node[4], node[7], node[6], node[5],
+ noID, force3d );
+ }
+ break;
+ default: continue;
+ } // switch (token)
+
+ if ( aCreatedElem && toMakeGroupsOfDomains )
+ {
+ if ( domainID[iElem] >= (int) elemsOfDomain.size() )
+ elemsOfDomain.resize( domainID[iElem] + 1 );
+ elemsOfDomain[ domainID[iElem] ].push_back( aCreatedElem );
+ }
+ } // loop on elements of one type
+ break;
+ } // case ...
+ } // switch (token)
+ } // loop on tabRef
+
+ // remove nodes in holes
+ if ( hasGeom )
+ {
+ for ( int i = 1; i <= nbVertices; ++i )
+ if ( GMFNode[i]->NbInverseElements() == 0 )
+ theMeshDS->RemoveFreeNode( GMFNode[i], /*sm=*/0, /*fromGroups=*/false );
+ }
+
+ GmfCloseMesh(InpMsh);
+ delete [] GMFNode;
+
+ // 0022172: [CEA 790] create the groups corresponding to domains
+ if ( toMakeGroupsOfDomains )
+ makeDomainGroups( elemsOfDomain, theHelper );
+
+#ifdef _DEBUG_
+ MESSAGE("Nb subdomains " << subdomainId2tetraId.size());
+ std::map<int, std::set<int> >::const_iterator subdomainIt = subdomainId2tetraId.begin();
+ TCollection_AsciiString aSubdomainFileName = theFile;
+ aSubdomainFileName = aSubdomainFileName + ".subdomain";
+ ofstream aSubdomainFile ( aSubdomainFileName.ToCString() , ios::out);
+
+ aSubdomainFile << "Nb subdomains " << subdomainId2tetraId.size() << std::endl;
+ for(;subdomainIt != subdomainId2tetraId.end() ; ++subdomainIt) {
+ int subdomainId = subdomainIt->first;
+ std::set<int> tetraIds = subdomainIt->second;
+ MESSAGE("Subdomain #"<<subdomainId<<": "<<tetraIds.size()<<" tetrahedrons");
+ std::set<int>::const_iterator tetraIdsIt = tetraIds.begin();
+ aSubdomainFile << subdomainId << std::endl;
+ for(;tetraIdsIt != tetraIds.end() ; ++tetraIdsIt) {
+ aSubdomainFile << (*tetraIdsIt) << " ";
+ }
+ aSubdomainFile << std::endl;
+ }
+ aSubdomainFile.close();
+#endif
+
+ return true;
+}
+
+
+static bool writeGMFFile(const char* theMeshFileName,
+ const char* theRequiredFileName,
+ const char* theSolFileName,
+ const SMESH_ProxyMesh& theProxyMesh,
+ SMESH_MesherHelper& theHelper,
+ std::vector <const SMDS_MeshNode*> & theNodeByGhs3dId,
+ std::vector <const SMDS_MeshElement*> & theFaceByGhs3dId,
+ std::map<const SMDS_MeshNode*,int> & aNodeToGhs3dIdMap,
+ std::vector<std::string> & aNodeGroupByGhs3dId,
+ std::vector<std::string> & anEdgeGroupByGhs3dId,
+ std::vector<std::string> & aFaceGroupByGhs3dId,
+ GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap & theEnforcedNodes,
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges,
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles,
+ std::map<std::vector<double>, std::string> & enfVerticesWithGroup,
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues & theEnforcedVertices)
+{
+ MESSAGE("writeGMFFile w/o geometry");
+ std::string tmpStr;
+ int idx, idxRequired = 0, idxSol = 0;
+ const int dummyint = 0;
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues::const_iterator vertexIt;
+ std::vector<double> enfVertexSizes;
+ const SMDS_MeshElement* elem;
+ TIDSortedElemSet anElemSet, theKeptEnforcedEdges, theKeptEnforcedTriangles;
+ SMDS_ElemIteratorPtr nodeIt;
+ std::vector <const SMDS_MeshNode*> theEnforcedNodeByGhs3dId;
+ map<const SMDS_MeshNode*,int> anEnforcedNodeToGhs3dIdMap, anExistingEnforcedNodeToGhs3dIdMap;
+ std::vector< const SMDS_MeshElement* > foundElems;
+ map<const SMDS_MeshNode*,TopAbs_State> aNodeToTopAbs_StateMap;
+ int nbFoundElems;
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap::iterator elemIt;
+ TIDSortedElemSet::iterator elemSetIt;
+ bool isOK;
+ SMESH_Mesh* theMesh = theHelper.GetMesh();
+ const bool hasGeom = theMesh->HasShapeToMesh();
+ auto_ptr< SMESH_ElementSearcher > pntCls
+ ( SMESH_MeshAlgos::GetElementSearcher(*theMesh->GetMeshDS()));
+
+ int nbEnforcedVertices = theEnforcedVertices.size();
+
+ // count faces
+ int nbFaces = theProxyMesh.NbFaces();
+ int nbNodes;
+ theFaceByGhs3dId.reserve( nbFaces );
+
+ // groups management
+ int usedEnforcedNodes = 0;
+ std::string gn = "";
+
+ if ( nbFaces == 0 )
+ return false;
+
+ idx = GmfOpenMesh(theMeshFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
+ if (!idx)
+ return false;
+
+ /* ========================== FACES ========================== */
+ /* TRIANGLES ========================== */
+ SMDS_ElemIteratorPtr eIt =
+ hasGeom ? theProxyMesh.GetFaces( theHelper.GetSubShape()) : theProxyMesh.GetFaces();
+ while ( eIt->more() )
+ {
+ elem = eIt->next();
+ anElemSet.insert(elem);
+ nodeIt = elem->nodesIterator();
+ nbNodes = elem->NbCornerNodes();
+ while ( nodeIt->more() && nbNodes--)
+ {
+ // find GHS3D ID
+ const SMDS_MeshNode* node = castToNode( nodeIt->next() );
+ int newId = aNodeToGhs3dIdMap.size() + 1; // ghs3d ids count from 1
+ aNodeToGhs3dIdMap.insert( make_pair( node, newId ));
+ }
+ }
+
+ /* EDGES ========================== */
+
+ // Iterate over the enforced edges
+ for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) {
+ elem = elemIt->first;
+ isOK = true;
+ nodeIt = elem->nodesIterator();
+ nbNodes = 2;
+ while ( nodeIt->more() && nbNodes-- ) {
+ // find GHS3D ID
+ const SMDS_MeshNode* node = castToNode( nodeIt->next() );
+ // Test if point is inside shape to mesh
+ gp_Pnt myPoint(node->X(),node->Y(),node->Z());
+ TopAbs_State result = pntCls->GetPointState( myPoint );
+ if ( result == TopAbs_OUT ) {
+ isOK = false;
+ break;
+ }
+ aNodeToTopAbs_StateMap.insert( make_pair( node, result ));
+ }
+ if (isOK) {
+ nodeIt = elem->nodesIterator();
+ nbNodes = 2;
+ int newId = -1;
+ while ( nodeIt->more() && nbNodes-- ) {
+ // find GHS3D ID
+ const SMDS_MeshNode* node = castToNode( nodeIt->next() );
+ gp_Pnt myPoint(node->X(),node->Y(),node->Z());
+ nbFoundElems = pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems);
+#ifdef _DEBUG_
+ std::cout << "Node at "<<node->X()<<", "<<node->Y()<<", "<<node->Z()<<std::endl;
+ std::cout << "Nb nodes found : "<<nbFoundElems<<std::endl;
+#endif
+ if (nbFoundElems ==0) {
+ if ((*aNodeToTopAbs_StateMap.find(node)).second == TopAbs_IN) {
+ newId = aNodeToGhs3dIdMap.size() + anEnforcedNodeToGhs3dIdMap.size() + 1; // ghs3d ids count from 1
+ anEnforcedNodeToGhs3dIdMap.insert( make_pair( node, newId ));
+ }
+ }
+ else if (nbFoundElems ==1) {
+ const SMDS_MeshNode* existingNode = (SMDS_MeshNode*) foundElems.at(0);
+ newId = (*aNodeToGhs3dIdMap.find(existingNode)).second;
+ anExistingEnforcedNodeToGhs3dIdMap.insert( make_pair( node, newId ));
+ }
+ else
+ isOK = false;
+#ifdef _DEBUG_
+ std::cout << "GHS3D node ID: "<<newId<<std::endl;
+#endif
+ }
+ if (isOK)
+ theKeptEnforcedEdges.insert(elem);
+ }
+ }
+
+ /* ENFORCED TRIANGLES ========================== */
+
+ // Iterate over the enforced triangles
+ for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) {
+ elem = elemIt->first;
+ isOK = true;
+ nodeIt = elem->nodesIterator();
+ nbNodes = 3;
+ while ( nodeIt->more() && nbNodes--) {
+ // find GHS3D ID
+ const SMDS_MeshNode* node = castToNode( nodeIt->next() );
+ // Test if point is inside shape to mesh
+ gp_Pnt myPoint(node->X(),node->Y(),node->Z());
+ TopAbs_State result = pntCls->GetPointState( myPoint );
+ if ( result == TopAbs_OUT ) {
+ isOK = false;
+ break;
+ }
+ aNodeToTopAbs_StateMap.insert( make_pair( node, result ));
+ }
+ if (isOK) {
+ nodeIt = elem->nodesIterator();
+ nbNodes = 3;
+ int newId = -1;
+ while ( nodeIt->more() && nbNodes--) {
+ // find GHS3D ID
+ const SMDS_MeshNode* node = castToNode( nodeIt->next() );
+ gp_Pnt myPoint(node->X(),node->Y(),node->Z());
+ nbFoundElems = pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems);
+#ifdef _DEBUG_
+ std::cout << "Nb nodes found : "<<nbFoundElems<<std::endl;
+#endif
+ if (nbFoundElems ==0) {
+ if ((*aNodeToTopAbs_StateMap.find(node)).second == TopAbs_IN) {
+ newId = aNodeToGhs3dIdMap.size() + anEnforcedNodeToGhs3dIdMap.size() + 1; // ghs3d ids count from 1
+ anEnforcedNodeToGhs3dIdMap.insert( make_pair( node, newId ));
+ }
+ }
+ else if (nbFoundElems ==1) {
+ const SMDS_MeshNode* existingNode = (SMDS_MeshNode*) foundElems.at(0);
+ newId = (*aNodeToGhs3dIdMap.find(existingNode)).second;
+ anExistingEnforcedNodeToGhs3dIdMap.insert( make_pair( node, newId ));
+ }
+ else
+ isOK = false;
+#ifdef _DEBUG_
+ std::cout << "GHS3D node ID: "<<newId<<std::endl;
+#endif
+ }
+ if (isOK)
+ theKeptEnforcedTriangles.insert(elem);
+ }
+ }
+
+ // put nodes to theNodeByGhs3dId vector
+#ifdef _DEBUG_
+ std::cout << "aNodeToGhs3dIdMap.size(): "<<aNodeToGhs3dIdMap.size()<<std::endl;
+#endif
+ theNodeByGhs3dId.resize( aNodeToGhs3dIdMap.size() );
+ map<const SMDS_MeshNode*,int>::const_iterator n2id = aNodeToGhs3dIdMap.begin();
+ for ( ; n2id != aNodeToGhs3dIdMap.end(); ++ n2id)
+ {
+// std::cout << "n2id->first: "<<n2id->first<<std::endl;
+ theNodeByGhs3dId[ n2id->second - 1 ] = n2id->first; // ghs3d ids count from 1
+ }
+
+ // put nodes to anEnforcedNodeToGhs3dIdMap vector
+#ifdef _DEBUG_
+ std::cout << "anEnforcedNodeToGhs3dIdMap.size(): "<<anEnforcedNodeToGhs3dIdMap.size()<<std::endl;
+#endif
+ theEnforcedNodeByGhs3dId.resize( anEnforcedNodeToGhs3dIdMap.size());
+ n2id = anEnforcedNodeToGhs3dIdMap.begin();
+ for ( ; n2id != anEnforcedNodeToGhs3dIdMap.end(); ++ n2id)
+ {
+ if (n2id->second > aNodeToGhs3dIdMap.size()) {
+ theEnforcedNodeByGhs3dId[ n2id->second - aNodeToGhs3dIdMap.size() - 1 ] = n2id->first; // ghs3d ids count from 1
+ }
+ }
+
+
+ /* ========================== NODES ========================== */
+ vector<const SMDS_MeshNode*> theOrderedNodes, theRequiredNodes;
+ std::set< std::vector<double> > nodesCoords;
+ vector<const SMDS_MeshNode*>::const_iterator ghs3dNodeIt = theNodeByGhs3dId.begin();
+ vector<const SMDS_MeshNode*>::const_iterator after = theNodeByGhs3dId.end();
+
+ (theNodeByGhs3dId.size() <= 1) ? tmpStr = " node" : " nodes";
+ std::cout << theNodeByGhs3dId.size() << tmpStr << " from mesh ..." << std::endl;
+ for ( ; ghs3dNodeIt != after; ++ghs3dNodeIt )
+ {
+ const SMDS_MeshNode* node = *ghs3dNodeIt;
+ std::vector<double> coords;
+ coords.push_back(node->X());
+ coords.push_back(node->Y());
+ coords.push_back(node->Z());
+ nodesCoords.insert(coords);
+ theOrderedNodes.push_back(node);
+ }
+
+ // Iterate over the enforced nodes given by enforced elements
+ ghs3dNodeIt = theEnforcedNodeByGhs3dId.begin();
+ after = theEnforcedNodeByGhs3dId.end();
+ (theEnforcedNodeByGhs3dId.size() <= 1) ? tmpStr = " node" : " nodes";
+ std::cout << theEnforcedNodeByGhs3dId.size() << tmpStr << " from enforced elements ..." << std::endl;
+ for ( ; ghs3dNodeIt != after; ++ghs3dNodeIt )
+ {
+ const SMDS_MeshNode* node = *ghs3dNodeIt;
+ std::vector<double> coords;
+ coords.push_back(node->X());
+ coords.push_back(node->Y());
+ coords.push_back(node->Z());
+#ifdef _DEBUG_
+ std::cout << "Node at " << node->X()<<", " <<node->Y()<<", " <<node->Z();
+#endif
+
+ if (nodesCoords.find(coords) != nodesCoords.end()) {
+ // node already exists in original mesh
+#ifdef _DEBUG_
+ std::cout << " found" << std::endl;
+#endif
+ continue;
+ }
+
+ if (theEnforcedVertices.find(coords) != theEnforcedVertices.end()) {
+ // node already exists in enforced vertices
+#ifdef _DEBUG_
+ std::cout << " found" << std::endl;
+#endif
+ continue;
+ }
+
+// gp_Pnt myPoint(node->X(),node->Y(),node->Z());
+// nbFoundElems = pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems);
+// if (nbFoundElems ==0) {
+// std::cout << " not found" << std::endl;
+// if ((*aNodeToTopAbs_StateMap.find(node)).second == TopAbs_IN) {
+// nodesCoords.insert(coords);
+// theOrderedNodes.push_back(node);
+// }
+// }
+// else {
+// std::cout << " found in initial mesh" << std::endl;
+// const SMDS_MeshNode* existingNode = (SMDS_MeshNode*) foundElems.at(0);
+// nodesCoords.insert(coords);
+// theOrderedNodes.push_back(existingNode);
+// }
+
+#ifdef _DEBUG_
+ std::cout << " not found" << std::endl;
+#endif
+
+ nodesCoords.insert(coords);
+ theOrderedNodes.push_back(node);
+// theRequiredNodes.push_back(node);
+ }
+
+
+ // Iterate over the enforced nodes
+ GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap::const_iterator enfNodeIt;
+ (theEnforcedNodes.size() <= 1) ? tmpStr = " node" : " nodes";
+ std::cout << theEnforcedNodes.size() << tmpStr << " from enforced nodes ..." << std::endl;
+ for(enfNodeIt = theEnforcedNodes.begin() ; enfNodeIt != theEnforcedNodes.end() ; ++enfNodeIt)
+ {
+ const SMDS_MeshNode* node = enfNodeIt->first;
+ std::vector<double> coords;
+ coords.push_back(node->X());
+ coords.push_back(node->Y());
+ coords.push_back(node->Z());
+#ifdef _DEBUG_
+ std::cout << "Node at " << node->X()<<", " <<node->Y()<<", " <<node->Z();
+#endif
+
+ // Test if point is inside shape to mesh
+ gp_Pnt myPoint(node->X(),node->Y(),node->Z());
+ TopAbs_State result = pntCls->GetPointState( myPoint );
+ if ( result == TopAbs_OUT ) {
+#ifdef _DEBUG_
+ std::cout << " out of volume" << std::endl;
+#endif
+ continue;
+ }
+
+ if (nodesCoords.find(coords) != nodesCoords.end()) {
+#ifdef _DEBUG_
+ std::cout << " found in nodesCoords" << std::endl;
+#endif
+// theRequiredNodes.push_back(node);
+ continue;
+ }
+
+ if (theEnforcedVertices.find(coords) != theEnforcedVertices.end()) {
+#ifdef _DEBUG_
+ std::cout << " found in theEnforcedVertices" << std::endl;
+#endif
+ continue;
+ }
+
+// nbFoundElems = pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems);
+// if (nbFoundElems ==0) {
+// std::cout << " not found" << std::endl;
+// if (result == TopAbs_IN) {
+// nodesCoords.insert(coords);
+// theRequiredNodes.push_back(node);
+// }
+// }
+// else {
+// std::cout << " found in initial mesh" << std::endl;
+// const SMDS_MeshNode* existingNode = (SMDS_MeshNode*) foundElems.at(0);
+// // nodesCoords.insert(coords);
+// theRequiredNodes.push_back(existingNode);
+// }
+//
+//
+//
+// if (pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems) == 0)
+// continue;
+
+// if ( result != TopAbs_IN )
+// continue;
+
+#ifdef _DEBUG_
+ std::cout << " not found" << std::endl;
+#endif
+ nodesCoords.insert(coords);
+// theOrderedNodes.push_back(node);
+ theRequiredNodes.push_back(node);
+ }
+ int requiredNodes = theRequiredNodes.size();
+
+ int solSize = 0;
+ std::vector<std::vector<double> > ReqVerTab;
+ if (nbEnforcedVertices) {
+// ReqVerTab.clear();
+ (nbEnforcedVertices <= 1) ? tmpStr = " node" : " nodes";
+ std::cout << nbEnforcedVertices << tmpStr << " from enforced vertices ..." << std::endl;
+ // Iterate over the enforced vertices
+ for(vertexIt = theEnforcedVertices.begin() ; vertexIt != theEnforcedVertices.end() ; ++vertexIt) {
+ double x = vertexIt->first[0];
+ double y = vertexIt->first[1];
+ double z = vertexIt->first[2];
+ // Test if point is inside shape to mesh
+ gp_Pnt myPoint(x,y,z);
+ TopAbs_State result = pntCls->GetPointState( myPoint );
+ if ( result == TopAbs_OUT )
+ continue;
+ //if (pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems) == 0)
+ //continue;
+
+// if ( result != TopAbs_IN )
+// continue;
+ std::vector<double> coords;
+ coords.push_back(x);
+ coords.push_back(y);
+ coords.push_back(z);
+ ReqVerTab.push_back(coords);
+ enfVertexSizes.push_back(vertexIt->second);
+ solSize++;
+ }
+ }
+
+
+ // GmfVertices
+ std::cout << "Begin writting required nodes in GmfVertices" << std::endl;
+ std::cout << "Nb vertices: " << theOrderedNodes.size() << std::endl;
+ GmfSetKwd(idx, GmfVertices, theOrderedNodes.size()/*+solSize*/);
+ for (ghs3dNodeIt = theOrderedNodes.begin();ghs3dNodeIt != theOrderedNodes.end();++ghs3dNodeIt) {
+ GmfSetLin(idx, GmfVertices, (*ghs3dNodeIt)->X(), (*ghs3dNodeIt)->Y(), (*ghs3dNodeIt)->Z(), dummyint);
+ }
+
+ std::cout << "End writting required nodes in GmfVertices" << std::endl;
+
+ if (requiredNodes + solSize) {
+ std::cout << "Begin writting in req and sol file" << std::endl;
+ aNodeGroupByGhs3dId.resize( requiredNodes + solSize );
+ idxRequired = GmfOpenMesh(theRequiredFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
+ if (!idxRequired) {
+ GmfCloseMesh(idx);
+ return false;
+ }
+ idxSol = GmfOpenMesh(theSolFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
+ if (!idxSol) {
+ GmfCloseMesh(idx);
+ if (idxRequired)
+ GmfCloseMesh(idxRequired);
+ return false;
+ }
+ int TypTab[] = {GmfSca};
+ double ValTab[] = {0.0};
+ GmfSetKwd(idxRequired, GmfVertices, requiredNodes + solSize);
+ GmfSetKwd(idxSol, GmfSolAtVertices, requiredNodes + solSize, 1, TypTab);
+// int usedEnforcedNodes = 0;
+// std::string gn = "";
+ for (ghs3dNodeIt = theRequiredNodes.begin();ghs3dNodeIt != theRequiredNodes.end();++ghs3dNodeIt) {
+ GmfSetLin(idxRequired, GmfVertices, (*ghs3dNodeIt)->X(), (*ghs3dNodeIt)->Y(), (*ghs3dNodeIt)->Z(), dummyint);
+ GmfSetLin(idxSol, GmfSolAtVertices, ValTab);
+ if (theEnforcedNodes.find((*ghs3dNodeIt)) != theEnforcedNodes.end())
+ gn = theEnforcedNodes.find((*ghs3dNodeIt))->second;
+ aNodeGroupByGhs3dId[usedEnforcedNodes] = gn;
+ usedEnforcedNodes++;
+ }
+
+ for (int i=0;i<solSize;i++) {
+ std::cout << ReqVerTab[i][0] <<" "<< ReqVerTab[i][1] << " "<< ReqVerTab[i][2] << std::endl;
+#ifdef _DEBUG_
+ std::cout << "enfVertexSizes.at("<<i<<"): " << enfVertexSizes.at(i) << std::endl;
+#endif
+ double solTab[] = {enfVertexSizes.at(i)};
+ GmfSetLin(idxRequired, GmfVertices, ReqVerTab[i][0], ReqVerTab[i][1], ReqVerTab[i][2], dummyint);
+ GmfSetLin(idxSol, GmfSolAtVertices, solTab);
+ aNodeGroupByGhs3dId[usedEnforcedNodes] = enfVerticesWithGroup.find(ReqVerTab[i])->second;
+#ifdef _DEBUG_
+ std::cout << "aNodeGroupByGhs3dId["<<usedEnforcedNodes<<"] = \""<<aNodeGroupByGhs3dId[usedEnforcedNodes]<<"\""<<std::endl;
+#endif
+ usedEnforcedNodes++;
+ }
+ std::cout << "End writting in req and sol file" << std::endl;
+ }
+
+ int nedge[2], ntri[3];
+
+ // GmfEdges
+ int usedEnforcedEdges = 0;
+ if (theKeptEnforcedEdges.size()) {
+ anEdgeGroupByGhs3dId.resize( theKeptEnforcedEdges.size() );
+// idxRequired = GmfOpenMesh(theRequiredFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
+// if (!idxRequired)
+// return false;
+ GmfSetKwd(idx, GmfEdges, theKeptEnforcedEdges.size());
+// GmfSetKwd(idxRequired, GmfEdges, theKeptEnforcedEdges.size());
+ for(elemSetIt = theKeptEnforcedEdges.begin() ; elemSetIt != theKeptEnforcedEdges.end() ; ++elemSetIt) {
+ elem = (*elemSetIt);
+ nodeIt = elem->nodesIterator();
+ int index=0;
+ while ( nodeIt->more() ) {
+ // find GHS3D ID
+ const SMDS_MeshNode* node = castToNode( nodeIt->next() );
+ map< const SMDS_MeshNode*,int >::iterator it = anEnforcedNodeToGhs3dIdMap.find(node);
+ if (it == anEnforcedNodeToGhs3dIdMap.end()) {
+ it = anExistingEnforcedNodeToGhs3dIdMap.find(node);
+ if (it == anEnforcedNodeToGhs3dIdMap.end())
+ throw "Node not found";
+ }
+ nedge[index] = it->second;
+ index++;
+ }
+ GmfSetLin(idx, GmfEdges, nedge[0], nedge[1], dummyint);
+ anEdgeGroupByGhs3dId[usedEnforcedEdges] = theEnforcedEdges.find(elem)->second;
+// GmfSetLin(idxRequired, GmfEdges, nedge[0], nedge[1], dummyint);
+ usedEnforcedEdges++;
+ }
+// GmfCloseMesh(idxRequired);
+ }
+
+
+ if (usedEnforcedEdges) {
+ GmfSetKwd(idx, GmfRequiredEdges, usedEnforcedEdges);
+ for (int enfID=1;enfID<=usedEnforcedEdges;enfID++) {
+ GmfSetLin(idx, GmfRequiredEdges, enfID);
+ }
+ }
+
+ // GmfTriangles
+ int usedEnforcedTriangles = 0;
+ if (anElemSet.size()+theKeptEnforcedTriangles.size()) {
+ aFaceGroupByGhs3dId.resize( anElemSet.size()+theKeptEnforcedTriangles.size() );
+ GmfSetKwd(idx, GmfTriangles, anElemSet.size()+theKeptEnforcedTriangles.size());
+ int k=0;
+ for(elemSetIt = anElemSet.begin() ; elemSetIt != anElemSet.end() ; ++elemSetIt,++k) {
+ elem = (*elemSetIt);
+ theFaceByGhs3dId.push_back( elem );
+ nodeIt = elem->nodesIterator();
+ int index=0;
+ for ( int j = 0; j < 3; ++j ) {
+ // find GHS3D ID
+ const SMDS_MeshNode* node = castToNode( nodeIt->next() );
+ map< const SMDS_MeshNode*,int >::iterator it = aNodeToGhs3dIdMap.find(node);
+ if (it == aNodeToGhs3dIdMap.end())
+ throw "Node not found";
+ ntri[index] = it->second;
+ index++;
+ }
+ GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], dummyint);
+ aFaceGroupByGhs3dId[k] = "";
+ }
+ if ( !theHelper.GetMesh()->HasShapeToMesh() )
+ SMESHUtils::FreeVector( theFaceByGhs3dId );
+ if (theKeptEnforcedTriangles.size()) {
+ for(elemSetIt = theKeptEnforcedTriangles.begin() ; elemSetIt != theKeptEnforcedTriangles.end() ; ++elemSetIt,++k) {
+ elem = (*elemSetIt);
+ nodeIt = elem->nodesIterator();
+ int index=0;
+ for ( int j = 0; j < 3; ++j ) {
+ // find GHS3D ID
+ const SMDS_MeshNode* node = castToNode( nodeIt->next() );
+ map< const SMDS_MeshNode*,int >::iterator it = anEnforcedNodeToGhs3dIdMap.find(node);
+ if (it == anEnforcedNodeToGhs3dIdMap.end()) {
+ it = anExistingEnforcedNodeToGhs3dIdMap.find(node);
+ if (it == anEnforcedNodeToGhs3dIdMap.end())
+ throw "Node not found";
+ }
+ ntri[index] = it->second;
+ index++;
+ }
+ GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], dummyint);
+ aFaceGroupByGhs3dId[k] = theEnforcedTriangles.find(elem)->second;
+ usedEnforcedTriangles++;
+ }
+ }
+ }
+
+
+ if (usedEnforcedTriangles) {
+ GmfSetKwd(idx, GmfRequiredTriangles, usedEnforcedTriangles);
+ for (int enfID=1;enfID<=usedEnforcedTriangles;enfID++)
+ GmfSetLin(idx, GmfRequiredTriangles, anElemSet.size()+enfID);
+ }
+
+ GmfCloseMesh(idx);
+ if (idxRequired)
+ GmfCloseMesh(idxRequired);
+ if (idxSol)
+ GmfCloseMesh(idxSol);
+
+ return true;
+
+}
+
+// static bool writeGMFFile(const char* theMeshFileName,
+// const char* theRequiredFileName,
+// const char* theSolFileName,
+// SMESH_MesherHelper& theHelper,
+// const SMESH_ProxyMesh& theProxyMesh,
+// std::map <int,int> & theNodeId2NodeIndexMap,
+// std::map <int,int> & theSmdsToGhs3dIdMap,
+// std::map <int,const SMDS_MeshNode*> & theGhs3dIdToNodeMap,
+// TIDSortedNodeSet & theEnforcedNodes,
+// TIDSortedElemSet & theEnforcedEdges,
+// TIDSortedElemSet & theEnforcedTriangles,
+// // TIDSortedElemSet & theEnforcedQuadrangles,
+// GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues & theEnforcedVertices)
+// {
+// MESSAGE("writeGMFFile with geometry");
+// int idx, idxRequired, idxSol;
+// int nbv, nbev, nben, aGhs3dID = 0;
+// const int dummyint = 0;
+// GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues::const_iterator vertexIt;
+// std::vector<double> enfVertexSizes;
+// TIDSortedNodeSet::const_iterator enfNodeIt;
+// const SMDS_MeshNode* node;
+// SMDS_NodeIteratorPtr nodeIt;
+//
+// idx = GmfOpenMesh(theMeshFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
+// if (!idx)
+// return false;
+//
+// SMESHDS_Mesh * theMeshDS = theHelper.GetMeshDS();
+//
+// /* ========================== NODES ========================== */
+// // NB_NODES
+// nbv = theMeshDS->NbNodes();
+// if ( nbv == 0 )
+// return false;
+// nbev = theEnforcedVertices.size();
+// nben = theEnforcedNodes.size();
+//
+// // Issue 020674: EDF 870 SMESH: Mesh generated by Netgen not usable by GHS3D
+// // The problem is in nodes on degenerated edges, we need to skip nodes which are free
+// // and replace not-free nodes on edges by the node on vertex
+// TNodeNodeMap n2nDegen; // map a node on degenerated edge to a node on vertex
+// TNodeNodeMap::iterator n2nDegenIt;
+// if ( theHelper.HasDegeneratedEdges() )
+// {
+// set<int> checkedSM;
+// for (TopExp_Explorer e(theMeshDS->ShapeToMesh(), TopAbs_EDGE ); e.More(); e.Next())
+// {
+// SMESH_subMesh* sm = theHelper.GetMesh()->GetSubMesh( e.Current() );
+// if ( checkedSM.insert( sm->GetId() ).second && theHelper.IsDegenShape(sm->GetId() ))
+// {
+// if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() )
+// {
+// TopoDS_Shape vertex = TopoDS_Iterator( e.Current() ).Value();
+// const SMDS_MeshNode* vNode = SMESH_Algo::VertexNode( TopoDS::Vertex( vertex ), theMeshDS);
+// {
+// SMDS_NodeIteratorPtr nIt = smDS->GetNodes();
+// while ( nIt->more() )
+// n2nDegen.insert( make_pair( nIt->next(), vNode ));
+// }
+// }
+// }
+// }
+// }
+//
+// const bool isQuadMesh =
+// theHelper.GetMesh()->NbEdges( ORDER_QUADRATIC ) ||
+// theHelper.GetMesh()->NbFaces( ORDER_QUADRATIC ) ||
+// theHelper.GetMesh()->NbVolumes( ORDER_QUADRATIC );
+//
+// std::vector<std::vector<double> > VerTab;
+// std::set<std::vector<double> > VerMap;
+// VerTab.clear();
+// std::vector<double> aVerTab;
+// // Loop from 1 to NB_NODES
+//
+// nodeIt = theMeshDS->nodesIterator();
+//
+// while ( nodeIt->more() )
+// {
+// node = nodeIt->next();
+// if ( isQuadMesh && theHelper.IsMedium( node )) // Issue 0021238
+// continue;
+// if ( n2nDegen.count( node ) ) // Issue 0020674
+// continue;
+//
+// std::vector<double> coords;
+// coords.push_back(node->X());
+// coords.push_back(node->Y());
+// coords.push_back(node->Z());
+// if (VerMap.find(coords) != VerMap.end()) {
+// aGhs3dID = theSmdsToGhs3dIdMap[node->GetID()];
+// theGhs3dIdToNodeMap[theSmdsToGhs3dIdMap[node->GetID()]] = node;
+// continue;
+// }
+// VerTab.push_back(coords);
+// VerMap.insert(coords);
+// aGhs3dID++;
+// theSmdsToGhs3dIdMap.insert( make_pair( node->GetID(), aGhs3dID ));
+// theGhs3dIdToNodeMap.insert( make_pair( aGhs3dID, node ));
+// }
+//
+//
+// /* ENFORCED NODES ========================== */
+// if (nben) {
+// std::cout << "Add " << nben << " enforced nodes to input .mesh file" << std::endl;
+// for(enfNodeIt = theEnforcedNodes.begin() ; enfNodeIt != theEnforcedNodes.end() ; ++enfNodeIt) {
+// double x = (*enfNodeIt)->X();
+// double y = (*enfNodeIt)->Y();
+// double z = (*enfNodeIt)->Z();
+// // Test if point is inside shape to mesh
+// gp_Pnt myPoint(x,y,z);
+// BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh());
+// scl.Perform(myPoint, 1e-7);
+// TopAbs_State result = scl.State();
+// if ( result != TopAbs_IN )
+// continue;
+// std::vector<double> coords;
+// coords.push_back(x);
+// coords.push_back(y);
+// coords.push_back(z);
+// if (theEnforcedVertices.find(coords) != theEnforcedVertices.end())
+// continue;
+// if (VerMap.find(coords) != VerMap.end())
+// continue;
+// VerTab.push_back(coords);
+// VerMap.insert(coords);
+// aGhs3dID++;
+// theNodeId2NodeIndexMap.insert( make_pair( (*enfNodeIt)->GetID(), aGhs3dID ));
+// }
+// }
+//
+//
+// /* ENFORCED VERTICES ========================== */
+// int solSize = 0;
+// std::vector<std::vector<double> > ReqVerTab;
+// ReqVerTab.clear();
+// if (nbev) {
+// std::cout << "Add " << nbev << " enforced vertices to input .mesh file" << std::endl;
+// for(vertexIt = theEnforcedVertices.begin() ; vertexIt != theEnforcedVertices.end() ; ++vertexIt) {
+// double x = vertexIt->first[0];
+// double y = vertexIt->first[1];
+// double z = vertexIt->first[2];
+// // Test if point is inside shape to mesh
+// gp_Pnt myPoint(x,y,z);
+// BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh());
+// scl.Perform(myPoint, 1e-7);
+// TopAbs_State result = scl.State();
+// if ( result != TopAbs_IN )
+// continue;
+// enfVertexSizes.push_back(vertexIt->second);
+// std::vector<double> coords;
+// coords.push_back(x);
+// coords.push_back(y);
+// coords.push_back(z);
+// if (VerMap.find(coords) != VerMap.end())
+// continue;
+// ReqVerTab.push_back(coords);
+// VerMap.insert(coords);
+// solSize++;
+// }
+// }
+//
+//
+// /* ========================== FACES ========================== */
+//
+// int nbTriangles = 0/*, nbQuadrangles = 0*/, aSmdsID;
+// TopTools_IndexedMapOfShape facesMap, trianglesMap/*, quadranglesMap*/;
+// TIDSortedElemSet::const_iterator elemIt;
+// const SMESHDS_SubMesh* theSubMesh;
+// TopoDS_Shape aShape;
+// SMDS_ElemIteratorPtr itOnSubMesh, itOnSubFace;
+// const SMDS_MeshElement* aFace;
+// map<int,int>::const_iterator itOnMap;
+// std::vector<std::vector<int> > tt, qt,et;
+// tt.clear();
+// qt.clear();
+// et.clear();
+// std::vector<int> att, aqt, aet;
+//
+// TopExp::MapShapes( theMeshDS->ShapeToMesh(), TopAbs_FACE, facesMap );
+//
+// for ( int i = 1; i <= facesMap.Extent(); ++i )
+// if (( theSubMesh = theProxyMesh.GetSubMesh( facesMap(i))))
+// {
+// SMDS_ElemIteratorPtr it = theSubMesh->GetElements();
+// while (it->more())
+// {
+// const SMDS_MeshElement *elem = it->next();
+// int nbCornerNodes = elem->NbCornerNodes();
+// if (nbCornerNodes == 3)
+// {
+// trianglesMap.Add(facesMap(i));
+// nbTriangles ++;
+// }
+// // else if (nbCornerNodes == 4)
+// // {
+// // quadranglesMap.Add(facesMap(i));
+// // nbQuadrangles ++;
+// // }
+// }
+// }
+//
+// /* TRIANGLES ========================== */
+// if (nbTriangles) {
+// for ( int i = 1; i <= trianglesMap.Extent(); i++ )
+// {
+// aShape = trianglesMap(i);
+// theSubMesh = theProxyMesh.GetSubMesh(aShape);
+// if ( !theSubMesh ) continue;
+// itOnSubMesh = theSubMesh->GetElements();
+// while ( itOnSubMesh->more() )
+// {
+// aFace = itOnSubMesh->next();
+// itOnSubFace = aFace->nodesIterator();
+// att.clear();
+// for ( int j = 0; j < 3; ++j ) {
+// // find GHS3D ID
+// node = castToNode( itOnSubFace->next() );
+// if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() )
+// node = n2nDegenIt->second;
+// aSmdsID = node->GetID();
+// itOnMap = theSmdsToGhs3dIdMap.find( aSmdsID );
+// ASSERT( itOnMap != theSmdsToGhs3dIdMap.end() );
+// att.push_back((*itOnMap).second);
+// }
+// tt.push_back(att);
+// }
+// }
+// }
+//
+// if (theEnforcedTriangles.size()) {
+// std::cout << "Add " << theEnforcedTriangles.size() << " enforced triangles to input .mesh file" << std::endl;
+// // Iterate over the enforced triangles
+// for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) {
+// aFace = (*elemIt);
+// itOnSubFace = aFace->nodesIterator();
+// bool isOK = true;
+// att.clear();
+//
+// for ( int j = 0; j < 3; ++j ) {
+// node = castToNode( itOnSubFace->next() );
+// if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() )
+// node = n2nDegenIt->second;
+// // std::cout << node;
+// double x = node->X();
+// double y = node->Y();
+// double z = node->Z();
+// // Test if point is inside shape to mesh
+// gp_Pnt myPoint(x,y,z);
+// BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh());
+// scl.Perform(myPoint, 1e-7);
+// TopAbs_State result = scl.State();
+// if ( result != TopAbs_IN ) {
+// isOK = false;
+// theEnforcedTriangles.erase(elemIt);
+// continue;
+// }
+// std::vector<double> coords;
+// coords.push_back(x);
+// coords.push_back(y);
+// coords.push_back(z);
+// if (VerMap.find(coords) != VerMap.end()) {
+// att.push_back(theNodeId2NodeIndexMap[node->GetID()]);
+// continue;
+// }
+// VerTab.push_back(coords);
+// VerMap.insert(coords);
+// aGhs3dID++;
+// theNodeId2NodeIndexMap.insert( make_pair( node->GetID(), aGhs3dID ));
+// att.push_back(aGhs3dID);
+// }
+// if (isOK)
+// tt.push_back(att);
+// }
+// }
+//
+//
+// /* ========================== EDGES ========================== */
+//
+// if (theEnforcedEdges.size()) {
+// // Iterate over the enforced edges
+// std::cout << "Add " << theEnforcedEdges.size() << " enforced edges to input .mesh file" << std::endl;
+// for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) {
+// aFace = (*elemIt);
+// bool isOK = true;
+// itOnSubFace = aFace->nodesIterator();
+// aet.clear();
+// for ( int j = 0; j < 2; ++j ) {
+// node = castToNode( itOnSubFace->next() );
+// if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() )
+// node = n2nDegenIt->second;
+// double x = node->X();
+// double y = node->Y();
+// double z = node->Z();
+// // Test if point is inside shape to mesh
+// gp_Pnt myPoint(x,y,z);
+// BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh());
+// scl.Perform(myPoint, 1e-7);
+// TopAbs_State result = scl.State();
+// if ( result != TopAbs_IN ) {
+// isOK = false;
+// theEnforcedEdges.erase(elemIt);
+// continue;
+// }
+// std::vector<double> coords;
+// coords.push_back(x);
+// coords.push_back(y);
+// coords.push_back(z);
+// if (VerMap.find(coords) != VerMap.end()) {
+// aet.push_back(theNodeId2NodeIndexMap[node->GetID()]);
+// continue;
+// }
+// VerTab.push_back(coords);
+// VerMap.insert(coords);
+//
+// aGhs3dID++;
+// theNodeId2NodeIndexMap.insert( make_pair( node->GetID(), aGhs3dID ));
+// aet.push_back(aGhs3dID);
+// }
+// if (isOK)
+// et.push_back(aet);
+// }
+// }
+//
+//
+// /* Write vertices number */
+// MESSAGE("Number of vertices: "<<aGhs3dID);
+// MESSAGE("Size of vector: "<<VerTab.size());
+// GmfSetKwd(idx, GmfVertices, aGhs3dID/*+solSize*/);
+// for (int i=0;i<aGhs3dID;i++)
+// GmfSetLin(idx, GmfVertices, VerTab[i][0], VerTab[i][1], VerTab[i][2], dummyint);
+// // for (int i=0;i<solSize;i++) {
+// // std::cout << ReqVerTab[i][0] <<" "<< ReqVerTab[i][1] << " "<< ReqVerTab[i][2] << std::endl;
+// // GmfSetLin(idx, GmfVertices, ReqVerTab[i][0], ReqVerTab[i][1], ReqVerTab[i][2], dummyint);
+// // }
+//
+// if (solSize) {
+// idxRequired = GmfOpenMesh(theRequiredFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
+// if (!idxRequired) {
+// GmfCloseMesh(idx);
+// return false;
+// }
+// idxSol = GmfOpenMesh(theSolFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
+// if (!idxSol){
+// GmfCloseMesh(idx);
+// if (idxRequired)
+// GmfCloseMesh(idxRequired);
+// return false;
+// }
+//
+// int TypTab[] = {GmfSca};
+// GmfSetKwd(idxRequired, GmfVertices, solSize);
+// GmfSetKwd(idxSol, GmfSolAtVertices, solSize, 1, TypTab);
+//
+// for (int i=0;i<solSize;i++) {
+// double solTab[] = {enfVertexSizes.at(i)};
+// GmfSetLin(idxRequired, GmfVertices, ReqVerTab[i][0], ReqVerTab[i][1], ReqVerTab[i][2], dummyint);
+// GmfSetLin(idxSol, GmfSolAtVertices, solTab);
+// }
+// GmfCloseMesh(idxRequired);
+// GmfCloseMesh(idxSol);
+// }
+//
+// /* Write triangles number */
+// if (tt.size()) {
+// GmfSetKwd(idx, GmfTriangles, tt.size());
+// for (int i=0;i<tt.size();i++)
+// GmfSetLin(idx, GmfTriangles, tt[i][0], tt[i][1], tt[i][2], dummyint);
+// }
+//
+// /* Write edges number */
+// if (et.size()) {
+// GmfSetKwd(idx, GmfEdges, et.size());
+// for (int i=0;i<et.size();i++)
+// GmfSetLin(idx, GmfEdges, et[i][0], et[i][1], dummyint);
+// }
+//
+// /* QUADRANGLES ========================== */
+// // TODO: add pyramids ?
+// // if (nbQuadrangles) {
+// // for ( int i = 1; i <= quadranglesMap.Extent(); i++ )
+// // {
+// // aShape = quadranglesMap(i);
+// // theSubMesh = theProxyMesh.GetSubMesh(aShape);
+// // if ( !theSubMesh ) continue;
+// // itOnSubMesh = theSubMesh->GetElements();
+// // for ( int j = 0; j < 4; ++j )
+// // {
+// // aFace = itOnSubMesh->next();
+// // itOnSubFace = aFace->nodesIterator();
+// // aqt.clear();
+// // while ( itOnSubFace->more() ) {
+// // // find GHS3D ID
+// // aSmdsID = itOnSubFace->next()->GetID();
+// // itOnMap = theSmdsToGhs3dIdMap.find( aSmdsID );
+// // ASSERT( itOnMap != theSmdsToGhs3dIdMap.end() );
+// // aqt.push_back((*itOnMap).second);
+// // }
+// // qt.push_back(aqt);
+// // }
+// // }
+// // }
+// //
+// // if (theEnforcedQuadrangles.size()) {
+// // // Iterate over the enforced triangles
+// // for(elemIt = theEnforcedQuadrangles.begin() ; elemIt != theEnforcedQuadrangles.end() ; ++elemIt) {
+// // aFace = (*elemIt);
+// // bool isOK = true;
+// // itOnSubFace = aFace->nodesIterator();
+// // aqt.clear();
+// // for ( int j = 0; j < 4; ++j ) {
+// // int aNodeID = itOnSubFace->next()->GetID();
+// // itOnMap = theNodeId2NodeIndexMap.find(aNodeID);
+// // if (itOnMap != theNodeId2NodeIndexMap.end())
+// // aqt.push_back((*itOnMap).second);
+// // else {
+// // isOK = false;
+// // theEnforcedQuadrangles.erase(elemIt);
+// // break;
+// // }
+// // }
+// // if (isOK)
+// // qt.push_back(aqt);
+// // }
+// // }
+// //
+//
+// // /* Write quadrilaterals number */
+// // if (qt.size()) {
+// // GmfSetKwd(idx, GmfQuadrilaterals, qt.size());
+// // for (int i=0;i<qt.size();i++)
+// // GmfSetLin(idx, GmfQuadrilaterals, qt[i][0], qt[i][1], qt[i][2], qt[i][3], dummyint);
+// // }
+//
+// GmfCloseMesh(idx);
+// return true;
+// }
+
+
+//=======================================================================
+//function : writeFaces
+//purpose :
+//=======================================================================
+
+static bool writeFaces (ofstream & theFile,
+ const SMESH_ProxyMesh& theMesh,
+ const TopoDS_Shape& theShape,
+ const map <int,int> & theSmdsToGhs3dIdMap,
+ const map <int,int> & theEnforcedNodeIdToGhs3dIdMap,
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges,
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles)
+{
+ // record structure:
+ //
+ // NB_ELEMS DUMMY_INT
+ // Loop from 1 to NB_ELEMS
+ // NB_NODES NODE_NB_1 NODE_NB_2 ... (NB_NODES + 1) times: DUMMY_INT
+
+ TopoDS_Shape aShape;
+ const SMESHDS_SubMesh* theSubMesh;
+ const SMDS_MeshElement* aFace;
+ const char* space = " ";
+ const int dummyint = 0;
+ map<int,int>::const_iterator itOnMap;
+ SMDS_ElemIteratorPtr itOnSubMesh, itOnSubFace;
+ int nbNodes, aSmdsID;
+
+ TIDSortedElemSet::const_iterator elemIt;
+ int nbEnforcedEdges = theEnforcedEdges.size();
+ int nbEnforcedTriangles = theEnforcedTriangles.size();
+
+ // count triangles bound to geometry
+ int nbTriangles = 0;
+
+ TopTools_IndexedMapOfShape facesMap, trianglesMap;
+ TopExp::MapShapes( theShape, TopAbs_FACE, facesMap );
+
+ int nbFaces = facesMap.Extent();
+
+ for ( int i = 1; i <= nbFaces; ++i )
+ if (( theSubMesh = theMesh.GetSubMesh( facesMap(i))))
+ nbTriangles += theSubMesh->NbElements();
+ std::string tmpStr;
+ (nbFaces == 0 || nbFaces == 1) ? tmpStr = " shape " : tmpStr = " shapes " ;
+ std::cout << " " << nbFaces << tmpStr << "of 2D dimension";
+ int nbEnforcedElements = nbEnforcedEdges+nbEnforcedTriangles;
+ if (nbEnforcedElements > 0) {
+ (nbEnforcedElements == 1) ? tmpStr = "shape:" : tmpStr = "shapes:";
+ std::cout << " and" << std::endl;
+ std::cout << " " << nbEnforcedElements
+ << " enforced " << tmpStr << std::endl;
+ }
+ else
+ std::cout << std::endl;
+ if (nbEnforcedEdges) {
+ (nbEnforcedEdges == 1) ? tmpStr = "edge" : tmpStr = "edges";
+ std::cout << " " << nbEnforcedEdges << " enforced " << tmpStr << std::endl;
+ }
+ if (nbEnforcedTriangles) {
+ (nbEnforcedTriangles == 1) ? tmpStr = "triangle" : tmpStr = "triangles";
+ std::cout << " " << nbEnforcedTriangles << " enforced " << tmpStr << std::endl;
+ }
+ std::cout << std::endl;
+
+// theFile << space << nbTriangles << space << dummyint << std::endl;
+ std::ostringstream globalStream, localStream, aStream;
+
+ for ( int i = 1; i <= facesMap.Extent(); i++ )
+ {
+ aShape = facesMap(i);
+ theSubMesh = theMesh.GetSubMesh(aShape);
+ if ( !theSubMesh ) continue;
+ itOnSubMesh = theSubMesh->GetElements();
+ while ( itOnSubMesh->more() )
+ {
+ aFace = itOnSubMesh->next();
+ nbNodes = aFace->NbCornerNodes();
+
+ localStream << nbNodes << space;
+
+ itOnSubFace = aFace->nodesIterator();
+ for ( int j = 0; j < 3; ++j ) {
+ // find GHS3D ID
+ aSmdsID = itOnSubFace->next()->GetID();
+ itOnMap = theSmdsToGhs3dIdMap.find( aSmdsID );
+ // if ( itOnMap == theSmdsToGhs3dIdMap.end() ) {
+ // cout << "not found node: " << aSmdsID << endl;
+ // return false;
+ // }
+ ASSERT( itOnMap != theSmdsToGhs3dIdMap.end() );
+
+ localStream << (*itOnMap).second << space ;
+ }
+
+ // (NB_NODES + 1) times: DUMMY_INT
+ for ( int j=0; j<=nbNodes; j++)
+ localStream << dummyint << space ;
+
+ localStream << std::endl;
+ }
+ }
+
+ globalStream << localStream.str();
+ localStream.str("");
+
+ //
+ // FACES : END
+ //
+
+// //
+// // ENFORCED EDGES : BEGIN
+// //
+//
+// // Iterate over the enforced edges
+// int usedEnforcedEdges = 0;
+// bool isOK;
+// for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) {
+// aFace = (*elemIt);
+// isOK = true;
+// itOnSubFace = aFace->nodesIterator();
+// aStream.str("");
+// aStream << "2" << space ;
+// for ( int j = 0; j < 2; ++j ) {
+// aSmdsID = itOnSubFace->next()->GetID();
+// itOnMap = theEnforcedNodeIdToGhs3dIdMap.find(aSmdsID);
+// if (itOnMap != theEnforcedNodeIdToGhs3dIdMap.end())
+// aStream << (*itOnMap).second << space;
+// else {
+// isOK = false;
+// break;
+// }
+// }
+// if (isOK) {
+// for ( int j=0; j<=2; j++)
+// aStream << dummyint << space ;
+// // aStream << dummyint << space << dummyint;
+// localStream << aStream.str() << std::endl;
+// usedEnforcedEdges++;
+// }
+// }
+//
+// if (usedEnforcedEdges) {
+// globalStream << localStream.str();
+// localStream.str("");
+// }
+//
+// //
+// // ENFORCED EDGES : END
+// //
+// //
+//
+// //
+// // ENFORCED TRIANGLES : BEGIN
+// //
+// // Iterate over the enforced triangles
+// int usedEnforcedTriangles = 0;
+// for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) {
+// aFace = (*elemIt);
+// nbNodes = aFace->NbCornerNodes();
+// isOK = true;
+// itOnSubFace = aFace->nodesIterator();
+// aStream.str("");
+// aStream << nbNodes << space ;
+// for ( int j = 0; j < 3; ++j ) {
+// aSmdsID = itOnSubFace->next()->GetID();
+// itOnMap = theEnforcedNodeIdToGhs3dIdMap.find(aSmdsID);
+// if (itOnMap != theEnforcedNodeIdToGhs3dIdMap.end())
+// aStream << (*itOnMap).second << space;
+// else {
+// isOK = false;
+// break;
+// }
+// }
+// if (isOK) {
+// for ( int j=0; j<=3; j++)
+// aStream << dummyint << space ;
+// localStream << aStream.str() << std::endl;
+// usedEnforcedTriangles++;
+// }
+// }
+//
+// if (usedEnforcedTriangles) {
+// globalStream << localStream.str();
+// localStream.str("");
+// }
+//
+// //
+// // ENFORCED TRIANGLES : END
+// //
+
+ theFile
+ << nbTriangles/*+usedEnforcedTriangles+usedEnforcedEdges*/
+ << " 0" << std::endl
+ << globalStream.str();
+
+ return true;
+}
+
+//=======================================================================
+//function : writePoints
+//purpose :
+//=======================================================================
+
+static bool writePoints (ofstream & theFile,
+ SMESH_MesherHelper& theHelper,
+ map <int,int> & theSmdsToGhs3dIdMap,
+ map <int,int> & theEnforcedNodeIdToGhs3dIdMap,
+ map <int,const SMDS_MeshNode*> & theGhs3dIdToNodeMap,
+ GHS3DPlugin_Hypothesis::TID2SizeMap & theNodeIDToSizeMap,
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues & theEnforcedVertices,
+ GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap & theEnforcedNodes,
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges,
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles)
+{
+ // record structure:
+ //
+ // NB_NODES
+ // Loop from 1 to NB_NODES
+ // X Y Z DUMMY_INT
+
+ SMESHDS_Mesh * theMeshDS = theHelper.GetMeshDS();
+ int nbNodes = theMeshDS->NbNodes();
+ if ( nbNodes == 0 )
+ return false;
+
+ int nbEnforcedVertices = theEnforcedVertices.size();
+ int nbEnforcedNodes = theEnforcedNodes.size();
+
+ const TopoDS_Shape shapeToMesh = theMeshDS->ShapeToMesh();
+
+ int aGhs3dID = 1;
+ SMDS_NodeIteratorPtr nodeIt = theMeshDS->nodesIterator();
+ const SMDS_MeshNode* node;
+
+ // Issue 020674: EDF 870 SMESH: Mesh generated by Netgen not usable by GHS3D
+ // The problem is in nodes on degenerated edges, we need to skip nodes which are free
+ // and replace not-free nodes on degenerated edges by the node on vertex
+ TNodeNodeMap n2nDegen; // map a node on degenerated edge to a node on vertex
+ TNodeNodeMap::iterator n2nDegenIt;
+ if ( theHelper.HasDegeneratedEdges() )
+ {
+ set<int> checkedSM;
+ for (TopExp_Explorer e(theMeshDS->ShapeToMesh(), TopAbs_EDGE ); e.More(); e.Next())
+ {
+ SMESH_subMesh* sm = theHelper.GetMesh()->GetSubMesh( e.Current() );
+ if ( checkedSM.insert( sm->GetId() ).second && theHelper.IsDegenShape(sm->GetId() ))
+ {
+ if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() )
+ {
+ TopoDS_Shape vertex = TopoDS_Iterator( e.Current() ).Value();
+ const SMDS_MeshNode* vNode = SMESH_Algo::VertexNode( TopoDS::Vertex( vertex ), theMeshDS);
+ {
+ SMDS_NodeIteratorPtr nIt = smDS->GetNodes();
+ while ( nIt->more() )
+ n2nDegen.insert( make_pair( nIt->next(), vNode ));
+ }
+ }
+ }
+ }
+ nbNodes -= n2nDegen.size();
+ }
+
+ const bool isQuadMesh =
+ theHelper.GetMesh()->NbEdges( ORDER_QUADRATIC ) ||
+ theHelper.GetMesh()->NbFaces( ORDER_QUADRATIC ) ||
+ theHelper.GetMesh()->NbVolumes( ORDER_QUADRATIC );
+ if ( isQuadMesh )
+ {
+ // descrease nbNodes by nb of medium nodes
+ while ( nodeIt->more() )
+ {
+ node = nodeIt->next();
+ if ( !theHelper.IsDegenShape( node->getshapeId() ))
+ nbNodes -= int( theHelper.IsMedium( node ));
+ }
+ nodeIt = theMeshDS->nodesIterator();
+ }
+
+ const char* space = " ";
+ const int dummyint = 0;
+
+ std::string tmpStr;
+ (nbNodes == 0 || nbNodes == 1) ? tmpStr = " node" : tmpStr = " nodes";
+ // NB_NODES
+ std::cout << std::endl;
+ std::cout << "The initial 2D mesh contains :" << std::endl;
+ std::cout << " " << nbNodes << tmpStr << std::endl;
+ if (nbEnforcedVertices > 0) {
+ (nbEnforcedVertices == 1) ? tmpStr = "vertex" : tmpStr = "vertices";
+ std::cout << " " << nbEnforcedVertices << " enforced " << tmpStr << std::endl;
+ }
+ if (nbEnforcedNodes > 0) {
+ (nbEnforcedNodes == 1) ? tmpStr = "node" : tmpStr = "nodes";
+ std::cout << " " << nbEnforcedNodes << " enforced " << tmpStr << std::endl;
+ }
+ std::cout << std::endl;
+ std::cout << "Start writing in 'points' file ..." << std::endl;
+
+ theFile << nbNodes << std::endl;
+
+ // Loop from 1 to NB_NODES
+
+ while ( nodeIt->more() )
+ {
+ node = nodeIt->next();
+ if ( isQuadMesh && theHelper.IsMedium( node )) // Issue 0021238
+ continue;
+ if ( n2nDegen.count( node ) ) // Issue 0020674
+ continue;
+
+ theSmdsToGhs3dIdMap.insert( make_pair( node->GetID(), aGhs3dID ));
+ theGhs3dIdToNodeMap.insert( make_pair( aGhs3dID, node ));
+ aGhs3dID++;
+
+ // X Y Z DUMMY_INT
+ theFile
+ << node->X() << space
+ << node->Y() << space
+ << node->Z() << space
+ << dummyint;
+
+ theFile << std::endl;
+
+ }
+
+ // Iterate over the enforced nodes
+ std::map<int,double> enfVertexIndexSizeMap;
+ if (nbEnforcedNodes) {
+ GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap::const_iterator nodeIt = theEnforcedNodes.begin();
+ for( ; nodeIt != theEnforcedNodes.end() ; ++nodeIt) {
+ double x = nodeIt->first->X();
+ double y = nodeIt->first->Y();
+ double z = nodeIt->first->Z();
+ // Test if point is inside shape to mesh
+ gp_Pnt myPoint(x,y,z);
+ BRepClass3d_SolidClassifier scl(shapeToMesh);
+ scl.Perform(myPoint, 1e-7);
+ TopAbs_State result = scl.State();
+ if ( result != TopAbs_IN )
+ continue;
+ std::vector<double> coords;
+ coords.push_back(x);
+ coords.push_back(y);
+ coords.push_back(z);
+ if (theEnforcedVertices.find(coords) != theEnforcedVertices.end())
+ continue;
+
+// double size = theNodeIDToSizeMap.find(nodeIt->first->GetID())->second;
+ // theGhs3dIdToNodeMap.insert( make_pair( nbNodes + i, (*nodeIt) ));
+ // MESSAGE("Adding enforced node (" << x << "," << y <<"," << z << ")");
+ // X Y Z PHY_SIZE DUMMY_INT
+ theFile
+ << x << space
+ << y << space
+ << z << space
+ << -1 << space
+ << dummyint << space;
+ theFile << std::endl;
+ theEnforcedNodeIdToGhs3dIdMap.insert( make_pair( nodeIt->first->GetID(), aGhs3dID ));
+ enfVertexIndexSizeMap[aGhs3dID] = -1;
+ aGhs3dID++;
+ // else
+ // MESSAGE("Enforced vertex (" << x << "," << y <<"," << z << ") is not inside the geometry: it was not added ");
+ }
+ }
+
+ if (nbEnforcedVertices) {
+ // Iterate over the enforced vertices
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues::const_iterator vertexIt = theEnforcedVertices.begin();
+ for( ; vertexIt != theEnforcedVertices.end() ; ++vertexIt) {
+ double x = vertexIt->first[0];
+ double y = vertexIt->first[1];
+ double z = vertexIt->first[2];
+ // Test if point is inside shape to mesh
+ gp_Pnt myPoint(x,y,z);
+ BRepClass3d_SolidClassifier scl(shapeToMesh);
+ scl.Perform(myPoint, 1e-7);
+ TopAbs_State result = scl.State();
+ if ( result != TopAbs_IN )
+ continue;
+ MESSAGE("Adding enforced vertex (" << x << "," << y <<"," << z << ") = " << vertexIt->second);
+ // X Y Z PHY_SIZE DUMMY_INT
+ theFile
+ << x << space
+ << y << space
+ << z << space
+ << vertexIt->second << space
+ << dummyint << space;
+ theFile << std::endl;
+ enfVertexIndexSizeMap[aGhs3dID] = vertexIt->second;
+ aGhs3dID++;
+ }
+ }
+
+
+ std::cout << std::endl;
+ std::cout << "End writing in 'points' file." << std::endl;
+
+ return true;
+}
+
+//=======================================================================
+//function : readResultFile
+//purpose : readResultFile with geometry
+//=======================================================================
+
+static bool readResultFile(const int fileOpen,
+#ifdef WIN32
+ const char* fileName,
+#endif
+ GHS3DPlugin_GHS3D* theAlgo,
+ SMESH_MesherHelper& theHelper,
+ TopoDS_Shape tabShape[],
+ double** tabBox,
+ const int nbShape,
+ map <int,const SMDS_MeshNode*>& theGhs3dIdToNodeMap,
+ std::map <int,int> & theNodeId2NodeIndexMap,
+ bool toMeshHoles,
+ int nbEnforcedVertices,
+ int nbEnforcedNodes,
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges,
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles,
+ bool toMakeGroupsOfDomains)
+{
+ MESSAGE("GHS3DPlugin_GHS3D::readResultFile()");
+ Kernel_Utils::Localizer loc;
+ struct stat status;
+ size_t length;
+
+ std::string tmpStr;
+
+ char *ptr, *mapPtr;
+ char *tetraPtr;
+ char *shapePtr;
+
+ SMESHDS_Mesh* theMeshDS = theHelper.GetMeshDS();
+
+ int nbElems, nbNodes, nbInputNodes;
+ int nbTriangle;
+ int ID, shapeID, ghs3dShapeID;
+ int IdShapeRef = 1;
+ int compoundID =
+ nbShape ? theMeshDS->ShapeToIndex( tabShape[0] ) : theMeshDS->ShapeToIndex( theMeshDS->ShapeToMesh() );
+
+ int *tab, *tabID, *nodeID, *nodeAssigne;
+ double *coord;
+ const SMDS_MeshNode **node;
+
+ tab = new int[3];
+ nodeID = new int[4];
+ coord = new double[3];
+ node = new const SMDS_MeshNode*[4];
+
+ TopoDS_Shape aSolid;
+ SMDS_MeshNode * aNewNode;
+ map <int,const SMDS_MeshNode*>::iterator itOnNode;
+ SMDS_MeshElement* aTet;
+#ifdef _DEBUG_
+ set<int> shapeIDs;
+#endif
+
+ // Read the file state
+ fstat(fileOpen, &status);
+ length = status.st_size;
+
+ // Mapping the result file into memory
+#ifdef WIN32
+ HANDLE fd = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ,
+ NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hMapObject = CreateFileMapping(fd, NULL, PAGE_READONLY,
+ 0, (DWORD)length, NULL);
+ ptr = ( char* ) MapViewOfFile(hMapObject, FILE_MAP_READ, 0, 0, 0 );
+#else
+ ptr = (char *) mmap(0,length,PROT_READ,MAP_PRIVATE,fileOpen,0);
+#endif
+ mapPtr = ptr;
+
+ ptr = readMapIntLine(ptr, tab);
+ tetraPtr = ptr;
+
+ nbElems = tab[0];
+ nbNodes = tab[1];
+ nbInputNodes = tab[2];
+
+ nodeAssigne = new int[ nbNodes+1 ];
+
+ if (nbShape > 0)
+ aSolid = tabShape[0];
+
+ // Reading the nodeId
+ for (int i=0; i < 4*nbElems; i++)
+ strtol(ptr, &ptr, 10);
+
+ MESSAGE("nbInputNodes: "<<nbInputNodes);
+ MESSAGE("nbEnforcedVertices: "<<nbEnforcedVertices);
+ MESSAGE("nbEnforcedNodes: "<<nbEnforcedNodes);
+ // Reading the nodeCoor and update the nodeMap
+ for (int iNode=1; iNode <= nbNodes; iNode++) {
+ if(theAlgo->computeCanceled())
+ return false;
+ for (int iCoor=0; iCoor < 3; iCoor++)
+ coord[ iCoor ] = strtod(ptr, &ptr);
+ nodeAssigne[ iNode ] = 1;
+ if ( iNode > (nbInputNodes-(nbEnforcedVertices+nbEnforcedNodes)) ) {
+ // Creating SMESH nodes
+ // - for enforced vertices
+ // - for vertices of forced edges
+ // - for ghs3d nodes
+ nodeAssigne[ iNode ] = 0;
+ aNewNode = theMeshDS->AddNode( coord[0],coord[1],coord[2] );
+ theGhs3dIdToNodeMap.insert(theGhs3dIdToNodeMap.end(), make_pair( iNode, aNewNode ));
+ }
+ }
+
+ // Reading the number of triangles which corresponds to the number of sub-domains
+ nbTriangle = strtol(ptr, &ptr, 10);
+
+ tabID = new int[nbTriangle];
+ for (int i=0; i < nbTriangle; i++) {
+ if(theAlgo->computeCanceled())
+ return false;
+ tabID[i] = 0;
+ // find the solid corresponding to GHS3D sub-domain following
+ // the technique proposed in GHS3D manual in chapter
+ // "B.4 Subdomain (sub-region) assignment"
+ int nodeId1 = strtol(ptr, &ptr, 10);
+ int nodeId2 = strtol(ptr, &ptr, 10);
+ int nodeId3 = strtol(ptr, &ptr, 10);
+ if ( nbTriangle > 1 ) {
+ const SMDS_MeshNode* n1 = theGhs3dIdToNodeMap[ nodeId1 ];
+ const SMDS_MeshNode* n2 = theGhs3dIdToNodeMap[ nodeId2 ];
+ const SMDS_MeshNode* n3 = theGhs3dIdToNodeMap[ nodeId3 ];
+ if (!n1 || !n2 || !n3) {
+ tabID[i] = HOLE_ID;
+ continue;
+ }
+ try {
+ OCC_CATCH_SIGNALS;
+// tabID[i] = findShapeID( theHelper, n1, n2, n3, toMeshHoles );
+ tabID[i] = findShapeID( *theHelper.GetMesh(), n1, n2, n3, toMeshHoles );
+ // -- 0020330: Pb with ghs3d as a submesh
+ // check that found shape is to be meshed
+ if ( tabID[i] > 0 ) {
+ const TopoDS_Shape& foundShape = theMeshDS->IndexToShape( tabID[i] );
+ bool isToBeMeshed = false;
+ for ( int iS = 0; !isToBeMeshed && iS < nbShape; ++iS )
+ isToBeMeshed = foundShape.IsSame( tabShape[ iS ]);
+ if ( !isToBeMeshed )
+ tabID[i] = HOLE_ID;
+ }
+ // END -- 0020330: Pb with ghs3d as a submesh
+#ifdef _DEBUG_
+ std::cout << i+1 << " subdomain: findShapeID() returns " << tabID[i] << std::endl;
+#endif
+ }
+ catch ( Standard_Failure & ex)
+ {
+#ifdef _DEBUG_
+ std::cout << i+1 << " subdomain: Exception caugt: " << ex.GetMessageString() << std::endl;
+#endif
+ }
+ catch (...) {
+#ifdef _DEBUG_
+ std::cout << i+1 << " subdomain: unknown exception caught " << std::endl;
+#endif
+ }
+ }
+ }
+
+ shapePtr = ptr;
+
+ if ( nbTriangle <= nbShape ) // no holes
+ toMeshHoles = true; // not avoid creating tetras in holes
+
+ // IMP 0022172: [CEA 790] create the groups corresponding to domains
+ std::vector< std::vector< const SMDS_MeshElement* > > elemsOfDomain( Max( nbTriangle, nbShape ));
+
+ // Associating the tetrahedrons to the shapes
+ shapeID = compoundID;
+ for (int iElem = 0; iElem < nbElems; iElem++) {
+ if(theAlgo->computeCanceled())
+ return false;
+ for (int iNode = 0; iNode < 4; iNode++) {
+ ID = strtol(tetraPtr, &tetraPtr, 10);
+ itOnNode = theGhs3dIdToNodeMap.find(ID);
+ node[ iNode ] = itOnNode->second;
+ nodeID[ iNode ] = ID;
+ }
+ // We always run GHS3D with "to mesh holes"==TRUE but we must not create
+ // tetras within holes depending on hypo option,
+ // so we first check if aTet is inside a hole and then create it
+ //aTet = theMeshDS->AddVolume( node[1], node[0], node[2], node[3] );
+ ghs3dShapeID = 0; // domain ID
+ if ( nbTriangle > 1 ) {
+ shapeID = HOLE_ID; // negative shapeID means not to create tetras if !toMeshHoles
+ ghs3dShapeID = strtol(shapePtr, &shapePtr, 10) - IdShapeRef;
+ if ( tabID[ ghs3dShapeID ] == 0 ) {
+ TopAbs_State state;
+ aSolid = findShape(node, aSolid, tabShape, tabBox, nbShape, &state);
+ if ( toMeshHoles || state == TopAbs_IN )
+ shapeID = theMeshDS->ShapeToIndex( aSolid );
+ tabID[ ghs3dShapeID ] = shapeID;
+ }
+ else
+ shapeID = tabID[ ghs3dShapeID ];
+ }
+ else if ( nbShape > 1 ) {
+ // Case where nbTriangle == 1 while nbShape == 2 encountered
+ // with compound of 2 boxes and "To mesh holes"==False,
+ // so there are no subdomains specified for each tetrahedron.
+ // Try to guess a solid by a node already bound to shape
+ shapeID = 0;
+ for ( int i=0; i<4 && shapeID==0; i++ ) {
+ if ( nodeAssigne[ nodeID[i] ] == 1 &&
+ node[i]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_3DSPACE &&
+ node[i]->getshapeId() > 1 )
+ {
+ shapeID = node[i]->getshapeId();
+ }
+ }
+ if ( shapeID==0 ) {
+ aSolid = findShape(node, aSolid, tabShape, tabBox, nbShape);
+ shapeID = theMeshDS->ShapeToIndex( aSolid );
+ }
+ }
+ // set new nodes and tetrahedron onto the shape
+ for ( int i=0; i<4; i++ ) {
+ if ( nodeAssigne[ nodeID[i] ] == 0 ) {
+ if ( shapeID != HOLE_ID )
+ theMeshDS->SetNodeInVolume( node[i], shapeID );
+ nodeAssigne[ nodeID[i] ] = shapeID;
+ }
+ }
+ if ( toMeshHoles || shapeID != HOLE_ID ) {
+ aTet = theHelper.AddVolume( node[1], node[0], node[2], node[3],
+ /*id=*/0, /*force3d=*/false);
+ theMeshDS->SetMeshElementOnShape( aTet, shapeID );
+ if ( toMakeGroupsOfDomains )
+ {
+ if ( int( elemsOfDomain.size() ) < ghs3dShapeID+1 )
+ elemsOfDomain.resize( ghs3dShapeID+1 );
+ elemsOfDomain[ ghs3dShapeID ].push_back( aTet );
+ }
+ }
+#ifdef _DEBUG_
+ shapeIDs.insert( shapeID );
+#endif
+ }
+ if ( toMakeGroupsOfDomains )
+ makeDomainGroups( elemsOfDomain, &theHelper );
+
+ // Add enforced elements
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap::const_iterator elemIt;
+ const SMDS_MeshElement* anElem;
+ SMDS_ElemIteratorPtr itOnEnfElem;
+ map<int,int>::const_iterator itOnMap;
+ shapeID = compoundID;
+ // Enforced edges
+ if (theEnforcedEdges.size()) {
+ (theEnforcedEdges.size() <= 1) ? tmpStr = " enforced edge" : " enforced edges";
+ std::cout << "Add " << theEnforcedEdges.size() << tmpStr << std::endl;
+ std::vector< const SMDS_MeshNode* > node( 2 );
+ // Iterate over the enforced edges
+ for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) {
+ anElem = elemIt->first;
+ bool addElem = true;
+ itOnEnfElem = anElem->nodesIterator();
+ for ( int j = 0; j < 2; ++j ) {
+ int aNodeID = itOnEnfElem->next()->GetID();
+ itOnMap = theNodeId2NodeIndexMap.find(aNodeID);
+ if (itOnMap != theNodeId2NodeIndexMap.end()) {
+ itOnNode = theGhs3dIdToNodeMap.find((*itOnMap).second);
+ if (itOnNode != theGhs3dIdToNodeMap.end()) {
+ node.push_back((*itOnNode).second);
+// shapeID =(*itOnNode).second->getshapeId();
+ }
+ else
+ addElem = false;
+ }
+ else
+ addElem = false;
+ }
+ if (addElem) {
+ aTet = theHelper.AddEdge( node[0], node[1], 0, false);
+ theMeshDS->SetMeshElementOnShape( aTet, shapeID );
+ }
+ }
+ }
+ // Enforced faces
+ if (theEnforcedTriangles.size()) {
+ (theEnforcedTriangles.size() <= 1) ? tmpStr = " enforced triangle" : " enforced triangles";
+ std::cout << "Add " << theEnforcedTriangles.size() << " enforced triangles" << std::endl;
+ std::vector< const SMDS_MeshNode* > node( 3 );
+ // Iterate over the enforced triangles
+ for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) {
+ anElem = elemIt->first;
+ bool addElem = true;
+ itOnEnfElem = anElem->nodesIterator();
+ for ( int j = 0; j < 3; ++j ) {
+ int aNodeID = itOnEnfElem->next()->GetID();
+ itOnMap = theNodeId2NodeIndexMap.find(aNodeID);
+ if (itOnMap != theNodeId2NodeIndexMap.end()) {
+ itOnNode = theGhs3dIdToNodeMap.find((*itOnMap).second);
+ if (itOnNode != theGhs3dIdToNodeMap.end()) {
+ node.push_back((*itOnNode).second);
+// shapeID =(*itOnNode).second->getshapeId();
+ }
+ else
+ addElem = false;
+ }
+ else
+ addElem = false;
+ }
+ if (addElem) {
+ aTet = theHelper.AddFace( node[0], node[1], node[2], 0, false);
+ theMeshDS->SetMeshElementOnShape( aTet, shapeID );
+ }
+ }
+ }
+
+ // Remove nodes of tetras inside holes if !toMeshHoles
+ if ( !toMeshHoles ) {
+ itOnNode = theGhs3dIdToNodeMap.find( nbInputNodes );
+ for ( ; itOnNode != theGhs3dIdToNodeMap.end(); ++itOnNode) {
+ ID = itOnNode->first;
+ if ( nodeAssigne[ ID ] == HOLE_ID )
+ theMeshDS->RemoveFreeNode( itOnNode->second, 0 );
+ }
+ }
+
+
+ if ( nbElems ) {
+ (nbElems <= 1) ? tmpStr = " tetrahedra" : " tetrahedrons";
+ cout << nbElems << tmpStr << " have been associated to " << nbShape;
+ (nbShape <= 1) ? tmpStr = " shape" : " shapes";
+ cout << tmpStr << endl;
+ }
+#ifdef WIN32
+ UnmapViewOfFile(mapPtr);
+ CloseHandle(hMapObject);
+ CloseHandle(fd);
+#else
+ munmap(mapPtr, length);
+#endif
+ close(fileOpen);
+
+ delete [] tab;
+ delete [] tabID;
+ delete [] nodeID;
+ delete [] coord;
+ delete [] node;
+ delete [] nodeAssigne;
+
+#ifdef _DEBUG_
+ shapeIDs.erase(-1);
+ if ( shapeIDs.size() != nbShape ) {
+ (shapeIDs.size() <= 1) ? tmpStr = " solid" : " solids";
+ std::cout << "Only " << shapeIDs.size() << tmpStr << " of " << nbShape << " found" << std::endl;
+ for (int i=0; i<nbShape; i++) {
+ shapeID = theMeshDS->ShapeToIndex( tabShape[i] );
+ if ( shapeIDs.find( shapeID ) == shapeIDs.end() )
+ std::cout << " Solid #" << shapeID << " not found" << std::endl;
+ }
+ }
+#endif
+
+ return true;
+}
+
+
+//=============================================================================
+/*!
+ *Here we are going to use the GHS3D mesher with geometry
+ */
+//=============================================================================
+
+bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh,
+ const TopoDS_Shape& theShape)
+{
+ bool Ok(false);
+ //SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
+
+ // we count the number of shapes
+ // _nbShape = countShape( meshDS, TopAbs_SOLID ); -- 0020330: Pb with ghs3d as a submesh
+ // _nbShape = 0;
+ TopExp_Explorer expBox ( theShape, TopAbs_SOLID );
+ // for ( ; expBox.More(); expBox.Next() )
+ // _nbShape++;
+
+ // create bounding box for every shape inside the compound
+
+ // int iShape = 0;
+ // TopoDS_Shape* tabShape;
+ // double** tabBox;
+ // tabShape = new TopoDS_Shape[_nbShape];
+ // tabBox = new double*[_nbShape];
+ // for (int i=0; i<_nbShape; i++)
+ // tabBox[i] = new double[6];
+ // Standard_Real Xmin, Ymin, Zmin, Xmax, Ymax, Zmax;
+
+ // for (expBox.ReInit(); expBox.More(); expBox.Next()) {
+ // tabShape[iShape] = expBox.Current();
+ // Bnd_Box BoundingBox;
+ // BRepBndLib::Add(expBox.Current(), BoundingBox);
+ // BoundingBox.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
+ // tabBox[iShape][0] = Xmin; tabBox[iShape][1] = Xmax;
+ // tabBox[iShape][2] = Ymin; tabBox[iShape][3] = Ymax;
+ // tabBox[iShape][4] = Zmin; tabBox[iShape][5] = Zmax;
+ // iShape++;
+ // }
+
+ // a unique working file name
+ // to avoid access to the same files by eg different users
+ _genericName = GHS3DPlugin_Hypothesis::GetFileName(_hyp);
+ TCollection_AsciiString aGenericName((char*) _genericName.c_str() );
+ TCollection_AsciiString aGenericNameRequired = aGenericName + "_required";
+
+ TCollection_AsciiString aLogFileName = aGenericName + ".log"; // log
+ TCollection_AsciiString aResultFileName;
+
+ TCollection_AsciiString aGMFFileName, aRequiredVerticesFileName, aSolFileName, aResSolFileName;
+//#ifdef _DEBUG_
+ aGMFFileName = aGenericName + ".mesh"; // GMF mesh file
+ aResultFileName = aGenericName + "Vol.mesh"; // GMF mesh file
+ aResSolFileName = aGenericName + "Vol.sol"; // GMF mesh file
+ aRequiredVerticesFileName = aGenericNameRequired + ".mesh"; // GMF required vertices mesh file
+ aSolFileName = aGenericNameRequired + ".sol"; // GMF solution file
+//#else
+// aGMFFileName = aGenericName + ".meshb"; // GMF mesh file
+// aResultFileName = aGenericName + "Vol.meshb"; // GMF mesh file
+// aRequiredVerticesFileName = aGenericNameRequired + ".meshb"; // GMF required vertices mesh file
+// aSolFileName = aGenericNameRequired + ".solb"; // GMF solution file
+//#endif
+
+ std::map <int,int> aNodeId2NodeIndexMap, aSmdsToGhs3dIdMap, anEnforcedNodeIdToGhs3dIdMap;
+ //std::map <int,const SMDS_MeshNode*> aGhs3dIdToNodeMap;
+ std::map <int, int> nodeID2nodeIndexMap;
+ std::map<std::vector<double>, std::string> enfVerticesWithGroup;
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues coordsSizeMap = GHS3DPlugin_Hypothesis::GetEnforcedVerticesCoordsSize(_hyp);
+ GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap enforcedNodes = GHS3DPlugin_Hypothesis::GetEnforcedNodes(_hyp);
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap enforcedEdges = GHS3DPlugin_Hypothesis::GetEnforcedEdges(_hyp);
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap enforcedTriangles = GHS3DPlugin_Hypothesis::GetEnforcedTriangles(_hyp);
+// TIDSortedElemSet enforcedQuadrangles = GHS3DPlugin_Hypothesis::GetEnforcedQuadrangles(_hyp);
+ GHS3DPlugin_Hypothesis::TID2SizeMap nodeIDToSizeMap = GHS3DPlugin_Hypothesis::GetNodeIDToSizeMap(_hyp);
+
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList enfVertices = GHS3DPlugin_Hypothesis::GetEnforcedVertices(_hyp);
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList::const_iterator enfVerIt = enfVertices.begin();
+ std::vector<double> coords;
+
+ for ( ; enfVerIt != enfVertices.end() ; ++enfVerIt)
+ {
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* enfVertex = (*enfVerIt);
+// if (enfVertex->geomEntry.empty() && enfVertex->coords.size()) {
+ if (enfVertex->coords.size()) {
+ coordsSizeMap.insert(make_pair(enfVertex->coords,enfVertex->size));
+ enfVerticesWithGroup.insert(make_pair(enfVertex->coords,enfVertex->groupName));
+// MESSAGE("enfVerticesWithGroup.insert(make_pair(("<<enfVertex->coords[0]<<","<<enfVertex->coords[1]<<","<<enfVertex->coords[2]<<"),\""<<enfVertex->groupName<<"\"))");
+ }
+ else {
+// if (!enfVertex->geomEntry.empty()) {
+ TopoDS_Shape GeomShape = entryToShape(enfVertex->geomEntry);
+// GeomType = GeomShape.ShapeType();
+
+// if (!enfVertex->isCompound) {
+// // if (GeomType == TopAbs_VERTEX) {
+// coords.clear();
+// aPnt = BRep_Tool::Pnt(TopoDS::Vertex(GeomShape));
+// coords.push_back(aPnt.X());
+// coords.push_back(aPnt.Y());
+// coords.push_back(aPnt.Z());
+// if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
+// coordsSizeMap.insert(make_pair(coords,enfVertex->size));
+// enfVerticesWithGroup.insert(make_pair(coords,enfVertex->groupName));
+// }
+// }
+//
+// // Group Management
+// else {
+// if (GeomType == TopAbs_COMPOUND){
+ for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
+ coords.clear();
+ if (it.Value().ShapeType() == TopAbs_VERTEX){
+ gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value()));
+ coords.push_back(aPnt.X());
+ coords.push_back(aPnt.Y());
+ coords.push_back(aPnt.Z());
+ if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
+ coordsSizeMap.insert(make_pair(coords,enfVertex->size));
+ enfVerticesWithGroup.insert(make_pair(coords,enfVertex->groupName));
+// MESSAGE("enfVerticesWithGroup.insert(make_pair(("<<coords[0]<<","<<coords[1]<<","<<coords[2]<<"),\""<<enfVertex->groupName<<"\"))");
+ }
+ }
+ }
+// }
+ }
+ }
+ int nbEnforcedVertices = coordsSizeMap.size();
+ int nbEnforcedNodes = enforcedNodes.size();
+
+ std::string tmpStr;
+ (nbEnforcedNodes <= 1) ? tmpStr = "node" : "nodes";
+ std::cout << nbEnforcedNodes << " enforced " << tmpStr << " from hypo" << std::endl;
+ (nbEnforcedVertices <= 1) ? tmpStr = "vertex" : "vertices";
+ std::cout << nbEnforcedVertices << " enforced " << tmpStr << " from hypo" << std::endl;
+
+ SMESH_MesherHelper helper( theMesh );
+ helper.SetSubShape( theShape );
+
+ std::vector <const SMDS_MeshNode*> aNodeByGhs3dId, anEnforcedNodeByGhs3dId;
+ std::vector <const SMDS_MeshElement*> aFaceByGhs3dId;
+ std::map<const SMDS_MeshNode*,int> aNodeToGhs3dIdMap;
+ std::vector<std::string> aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId;
+ {
+ SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( theMesh ));
+
+ // make prisms on quadrangles
+ if ( theMesh.NbQuadrangles() > 0 )
+ {
+ vector<SMESH_ProxyMesh::Ptr> components;
+ for (expBox.ReInit(); expBox.More(); expBox.Next())
+ {
+ if ( _viscousLayersHyp )
+ {
+ proxyMesh = _viscousLayersHyp->Compute( theMesh, expBox.Current() );
+ if ( !proxyMesh )
+ return false;
+ }
+ StdMeshers_QuadToTriaAdaptor* q2t = new StdMeshers_QuadToTriaAdaptor;
+ q2t->Compute( theMesh, expBox.Current(), proxyMesh.get() );
+ components.push_back( SMESH_ProxyMesh::Ptr( q2t ));
+ }
+ proxyMesh.reset( new SMESH_ProxyMesh( components ));
+ }
+ // build viscous layers
+ else if ( _viscousLayersHyp )
+ {
+ proxyMesh = _viscousLayersHyp->Compute( theMesh, theShape );
+ if ( !proxyMesh )
+ return false;
+ }
+
+ // Ok = (writePoints( aPointsFile, helper,
+ // aSmdsToGhs3dIdMap, anEnforcedNodeIdToGhs3dIdMap, aGhs3dIdToNodeMap,
+ // nodeIDToSizeMap,
+ // coordsSizeMap, enforcedNodes, enforcedEdges, enforcedTriangles)
+ // &&
+ // writeFaces ( aFacesFile, *proxyMesh, theShape,
+ // aSmdsToGhs3dIdMap, anEnforcedNodeIdToGhs3dIdMap,
+ // enforcedEdges, enforcedTriangles ));
+ Ok = writeGMFFile(aGMFFileName.ToCString(), aRequiredVerticesFileName.ToCString(), aSolFileName.ToCString(),
+ *proxyMesh, helper,
+ aNodeByGhs3dId, aFaceByGhs3dId, aNodeToGhs3dIdMap,
+ aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId,
+ enforcedNodes, enforcedEdges, enforcedTriangles, /*enforcedQuadrangles,*/
+ enfVerticesWithGroup, coordsSizeMap);
+ }
+
+ // Write aSmdsToGhs3dIdMap to temp file
+ TCollection_AsciiString aSmdsToGhs3dIdMapFileName;
+ aSmdsToGhs3dIdMapFileName = aGenericName + ".ids"; // ids relation
+ ofstream aIdsFile ( aSmdsToGhs3dIdMapFileName.ToCString() , ios::out);
+ Ok = aIdsFile.rdbuf()->is_open();
+ if (!Ok) {
+ INFOS( "Can't write into " << aSmdsToGhs3dIdMapFileName);
+ return error(SMESH_Comment("Can't write into ") << aSmdsToGhs3dIdMapFileName);
+ }
+ INFOS( "Writing ids relation into " << aSmdsToGhs3dIdMapFileName);
+ aIdsFile << "Smds Ghs3d" << std::endl;
+ map <int,int>::const_iterator myit;
+ for (myit=aSmdsToGhs3dIdMap.begin() ; myit != aSmdsToGhs3dIdMap.end() ; ++myit) {
+ aIdsFile << myit->first << " " << myit->second << std::endl;
+ }
+
+ aIdsFile.close();
+
+ if ( ! Ok ) {
+ if ( !_keepFiles ) {
+ removeFile( aGMFFileName );
+ removeFile( aRequiredVerticesFileName );
+ removeFile( aSolFileName );
+ removeFile( aSmdsToGhs3dIdMapFileName );
+ }
+ return error(COMPERR_BAD_INPUT_MESH);
+ }
+ removeFile( aResultFileName ); // needed for boundary recovery module usage
+
+ // -----------------
+ // run ghs3d mesher
+ // -----------------
+
+ TCollection_AsciiString cmd( (char*)GHS3DPlugin_Hypothesis::CommandToRun( _hyp ).c_str() );
+
+ cmd += TCollection_AsciiString(" --in ") + aGMFFileName;
+ if ( nbEnforcedVertices + nbEnforcedNodes)
+ cmd += TCollection_AsciiString(" --required_vertices ") + aGenericNameRequired;
+ cmd += TCollection_AsciiString(" --out ") + aResultFileName;
+ if ( !_logInStandardOutput )
+ cmd += TCollection_AsciiString(" 1>" ) + aLogFileName; // dump into file
+
+ std::cout << std::endl;
+ std::cout << "Ghs3d execution..." << std::endl;
+ std::cout << cmd << std::endl;
+
+ _compute_canceled = false;
+
+ system( cmd.ToCString() ); // run
+
+ std::cout << std::endl;
+ std::cout << "End of Ghs3d execution !" << std::endl;
+
+ // --------------
+ // read a result
+ // --------------
+
+ // Mapping the result file
+
+ // int fileOpen;
+ // fileOpen = open( aResultFileName.ToCString(), O_RDONLY);
+ // if ( fileOpen < 0 ) {
+ // std::cout << std::endl;
+ // std::cout << "Can't open the " << aResultFileName.ToCString() << " GHS3D output file" << std::endl;
+ // std::cout << "Log: " << aLogFileName << std::endl;
+ // Ok = false;
+ // }
+ // else {
+ GHS3DPlugin_Hypothesis::TSetStrings groupsToRemove = GHS3DPlugin_Hypothesis::GetGroupsToRemove(_hyp);
+ bool toMeshHoles =
+ _hyp ? _hyp->GetToMeshHoles(true) : GHS3DPlugin_Hypothesis::DefaultMeshHoles();
+ const bool toMakeGroupsOfDomains = GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains( _hyp );
+
+ helper.IsQuadraticSubMesh( theShape );
+ helper.SetElementsOnShape( false );
+
+// Ok = readResultFile( fileOpen,
+// #ifdef WIN32
+// aResultFileName.ToCString(),
+// #endif
+// this,
+// /*theMesh, */helper, tabShape, tabBox, _nbShape,
+// aGhs3dIdToNodeMap, aNodeId2NodeIndexMap,
+// toMeshHoles,
+// nbEnforcedVertices, nbEnforcedNodes,
+// enforcedEdges, enforcedTriangles,
+// toMakeGroupsOfDomains );
+
+ Ok = readGMFFile(aResultFileName.ToCString(),
+ this,
+ &helper, aNodeByGhs3dId, aFaceByGhs3dId, aNodeToGhs3dIdMap,
+ aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId,
+ groupsToRemove, toMakeGroupsOfDomains, toMeshHoles);
+
+ removeEmptyGroupsOfDomains( helper.GetMesh(), /*notEmptyAsWell =*/ !toMakeGroupsOfDomains );
+ //}
+
+
+
+
+ // ---------------------
+ // remove working files
+ // ---------------------
+
+ if ( Ok )
+ {
+ if ( _removeLogOnSuccess )
+ removeFile( aLogFileName );
+
+ // if ( _hyp && _hyp->GetToMakeGroupsOfDomains() )
+ // error( COMPERR_WARNING, "'toMakeGroupsOfDomains' is ignored since the mesh is on shape" );
+ }
+ else if ( OSD_File( aLogFileName ).Size() > 0 )
+ {
+ // get problem description from the log file
+ _Ghs2smdsConvertor conv( aNodeByGhs3dId );
+ storeErrorDescription( aLogFileName, conv );
+ }
+ else
+ {
+ // the log file is empty
+ removeFile( aLogFileName );
+ INFOS( "GHS3D Error, command '" << cmd.ToCString() << "' failed" );
+ error(COMPERR_ALGO_FAILED, "ghs3d: command not found" );
+ }
+
+ if ( !_keepFiles ) {
+ if (! Ok && _compute_canceled)
+ removeFile( aLogFileName );
+ removeFile( aGMFFileName );
+ removeFile( aRequiredVerticesFileName );
+ removeFile( aSolFileName );
+ removeFile( aResSolFileName );
+ removeFile( aResultFileName );
+ removeFile( aSmdsToGhs3dIdMapFileName );
+ }
+ std::cout << "<" << aResultFileName.ToCString() << "> GHS3D output file ";
+ if ( !Ok )
+ std::cout << "not ";
+ std::cout << "treated !" << std::endl;
+ std::cout << std::endl;
+
+ // _nbShape = 0; // re-initializing _nbShape for the next Compute() method call
+ // delete [] tabShape;
+ // delete [] tabBox;
+
+ return Ok;
+}
+
+//=============================================================================
+/*!
+ *Here we are going to use the GHS3D mesher w/o geometry
+ */
+//=============================================================================
+bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh,
+ SMESH_MesherHelper* theHelper)
+{
+ MESSAGE("GHS3DPlugin_GHS3D::Compute()");
+
+ theHelper->IsQuadraticSubMesh( theHelper->GetSubShape() );
+
+ // a unique working file name
+ // to avoid access to the same files by eg different users
+ _genericName = GHS3DPlugin_Hypothesis::GetFileName(_hyp);
+ TCollection_AsciiString aGenericName((char*) _genericName.c_str() );
+ TCollection_AsciiString aGenericNameRequired = aGenericName + "_required";
+
+ TCollection_AsciiString aLogFileName = aGenericName + ".log"; // log
+ TCollection_AsciiString aResultFileName;
+ bool Ok;
+
+ TCollection_AsciiString aGMFFileName, aRequiredVerticesFileName, aSolFileName, aResSolFileName;
+//#ifdef _DEBUG_
+ aGMFFileName = aGenericName + ".mesh"; // GMF mesh file
+ aResultFileName = aGenericName + "Vol.mesh"; // GMF mesh file
+ aResSolFileName = aGenericName + "Vol.sol"; // GMF mesh file
+ aRequiredVerticesFileName = aGenericNameRequired + ".mesh"; // GMF required vertices mesh file
+ aSolFileName = aGenericNameRequired + ".sol"; // GMF solution file
+//#else
+// aGMFFileName = aGenericName + ".meshb"; // GMF mesh file
+// aResultFileName = aGenericName + "Vol.meshb"; // GMF mesh file
+// aRequiredVerticesFileName = aGenericNameRequired + ".meshb"; // GMF required vertices mesh file
+// aSolFileName = aGenericNameRequired + ".solb"; // GMF solution file
+//#endif
+
+ std::map <int, int> nodeID2nodeIndexMap;
+ std::map<std::vector<double>, std::string> enfVerticesWithGroup;
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues coordsSizeMap;
+ TopoDS_Shape GeomShape;
+// TopAbs_ShapeEnum GeomType;
+ std::vector<double> coords;
+ gp_Pnt aPnt;
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* enfVertex;
+
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList enfVertices = GHS3DPlugin_Hypothesis::GetEnforcedVertices(_hyp);
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList::const_iterator enfVerIt = enfVertices.begin();
+
+ for ( ; enfVerIt != enfVertices.end() ; ++enfVerIt)
+ {
+ enfVertex = (*enfVerIt);
+// if (enfVertex->geomEntry.empty() && enfVertex->coords.size()) {
+ if (enfVertex->coords.size()) {
+ coordsSizeMap.insert(make_pair(enfVertex->coords,enfVertex->size));
+ enfVerticesWithGroup.insert(make_pair(enfVertex->coords,enfVertex->groupName));
+// MESSAGE("enfVerticesWithGroup.insert(make_pair(("<<enfVertex->coords[0]<<","<<enfVertex->coords[1]<<","<<enfVertex->coords[2]<<"),\""<<enfVertex->groupName<<"\"))");
+ }
+ else {
+// if (!enfVertex->geomEntry.empty()) {
+ GeomShape = entryToShape(enfVertex->geomEntry);
+// GeomType = GeomShape.ShapeType();
+
+// if (!enfVertex->isCompound) {
+// // if (GeomType == TopAbs_VERTEX) {
+// coords.clear();
+// aPnt = BRep_Tool::Pnt(TopoDS::Vertex(GeomShape));
+// coords.push_back(aPnt.X());
+// coords.push_back(aPnt.Y());
+// coords.push_back(aPnt.Z());
+// if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
+// coordsSizeMap.insert(make_pair(coords,enfVertex->size));
+// enfVerticesWithGroup.insert(make_pair(coords,enfVertex->groupName));
+// }
+// }
+//
+// // Group Management
+// else {
+// if (GeomType == TopAbs_COMPOUND){
+ for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
+ coords.clear();
+ if (it.Value().ShapeType() == TopAbs_VERTEX){
+ aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value()));
+ coords.push_back(aPnt.X());
+ coords.push_back(aPnt.Y());
+ coords.push_back(aPnt.Z());
+ if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
+ coordsSizeMap.insert(make_pair(coords,enfVertex->size));
+ enfVerticesWithGroup.insert(make_pair(coords,enfVertex->groupName));
+// MESSAGE("enfVerticesWithGroup.insert(make_pair(("<<coords[0]<<","<<coords[1]<<","<<coords[2]<<"),\""<<enfVertex->groupName<<"\"))");
+ }
+ }
+ }
+// }
+ }
+ }
+
+// const SMDS_MeshNode* enfNode;
+ GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap enforcedNodes = GHS3DPlugin_Hypothesis::GetEnforcedNodes(_hyp);
+// GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap::const_iterator enfNodeIt = enforcedNodes.begin();
+// for ( ; enfNodeIt != enforcedNodes.end() ; ++enfNodeIt)
+// {
+// enfNode = enfNodeIt->first;
+// coords.clear();
+// coords.push_back(enfNode->X());
+// coords.push_back(enfNode->Y());
+// coords.push_back(enfNode->Z());
+// if (enfVerticesWithGro
+// enfVerticesWithGroup.insert(make_pair(coords,enfNodeIt->second));
+// }
+
+
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap enforcedEdges = GHS3DPlugin_Hypothesis::GetEnforcedEdges(_hyp);
+ GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap enforcedTriangles = GHS3DPlugin_Hypothesis::GetEnforcedTriangles(_hyp);
+// TIDSortedElemSet enforcedQuadrangles = GHS3DPlugin_Hypothesis::GetEnforcedQuadrangles(_hyp);
+ GHS3DPlugin_Hypothesis::TID2SizeMap nodeIDToSizeMap = GHS3DPlugin_Hypothesis::GetNodeIDToSizeMap(_hyp);
+
+ std::string tmpStr;
+
+ int nbEnforcedVertices = coordsSizeMap.size();
+ int nbEnforcedNodes = enforcedNodes.size();
+ (nbEnforcedNodes <= 1) ? tmpStr = "node" : tmpStr = "nodes";
+ std::cout << nbEnforcedNodes << " enforced " << tmpStr << " from hypo" << std::endl;
+ (nbEnforcedVertices <= 1) ? tmpStr = "vertex" : tmpStr = "vertices";
+ std::cout << nbEnforcedVertices << " enforced " << tmpStr << " from hypo" << std::endl;
+
+ std::vector <const SMDS_MeshNode*> aNodeByGhs3dId, anEnforcedNodeByGhs3dId;
+ std::vector <const SMDS_MeshElement*> aFaceByGhs3dId;
+ std::map<const SMDS_MeshNode*,int> aNodeToGhs3dIdMap;
+ std::vector<std::string> aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId;
+ {
+ SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( theMesh ));
+ if ( theMesh.NbQuadrangles() > 0 )
+ {
+ StdMeshers_QuadToTriaAdaptor* aQuad2Trias = new StdMeshers_QuadToTriaAdaptor;
+ aQuad2Trias->Compute( theMesh );
+ proxyMesh.reset( aQuad2Trias );
+ }
+
+ Ok = writeGMFFile(aGMFFileName.ToCString(), aRequiredVerticesFileName.ToCString(), aSolFileName.ToCString(),
+ *proxyMesh, *theHelper,
+ aNodeByGhs3dId, aFaceByGhs3dId, aNodeToGhs3dIdMap,
+ aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId,
+ enforcedNodes, enforcedEdges, enforcedTriangles,
+ enfVerticesWithGroup, coordsSizeMap);
+ }
+
+ // -----------------
+ // run ghs3d mesher
+ // -----------------
+
+ TCollection_AsciiString cmd = TCollection_AsciiString((char*)GHS3DPlugin_Hypothesis::CommandToRun( _hyp, false ).c_str());
+
+ cmd += TCollection_AsciiString(" --in ") + aGMFFileName;
+ if ( nbEnforcedVertices + nbEnforcedNodes)
+ cmd += TCollection_AsciiString(" --required_vertices ") + aGenericNameRequired;
+ cmd += TCollection_AsciiString(" --out ") + aResultFileName;
+ if ( !_logInStandardOutput )
+ cmd += TCollection_AsciiString(" 1>" ) + aLogFileName; // dump into file
+
+ std::cout << std::endl;
+ std::cout << "Ghs3d execution..." << std::endl;
+ std::cout << cmd << std::endl;
+
+ _compute_canceled = false;
+
+ system( cmd.ToCString() ); // run
+
+ std::cout << std::endl;
+ std::cout << "End of Ghs3d execution !" << std::endl;
+
+ // --------------
+ // read a result
+ // --------------
+ GHS3DPlugin_Hypothesis::TSetStrings groupsToRemove = GHS3DPlugin_Hypothesis::GetGroupsToRemove(_hyp);
+ const bool toMakeGroupsOfDomains = GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains( _hyp );
+
+ Ok = readGMFFile(aResultFileName.ToCString(),
+ this,
+ theHelper, aNodeByGhs3dId, aFaceByGhs3dId, aNodeToGhs3dIdMap,
+ aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId,
+ groupsToRemove, toMakeGroupsOfDomains);
+
+ updateMeshGroups(theHelper->GetMesh(), groupsToRemove);
+ removeEmptyGroupsOfDomains( theHelper->GetMesh(), /*notEmptyAsWell =*/ !toMakeGroupsOfDomains );
+
+ if ( Ok ) {
+ GHS3DPlugin_Hypothesis* that = (GHS3DPlugin_Hypothesis*)this->_hyp;
+ if (that)
+ that->ClearGroupsToRemove();
+ }
+ // ---------------------
+ // remove working files
+ // ---------------------
+
+ if ( Ok )
+ {
+ if ( _removeLogOnSuccess )
+ removeFile( aLogFileName );
+
+ //if ( !toMakeGroupsOfDomains && _hyp && _hyp->GetToMakeGroupsOfDomains() )
+ //error( COMPERR_WARNING, "'toMakeGroupsOfDomains' is ignored since 'toMeshHoles' is OFF." );
+ }
+ else if ( OSD_File( aLogFileName ).Size() > 0 )
+ {
+ // get problem description from the log file
+ _Ghs2smdsConvertor conv( aNodeByGhs3dId );
+ storeErrorDescription( aLogFileName, conv );
+ }
+ else {
+ // the log file is empty
+ removeFile( aLogFileName );
+ INFOS( "GHS3D Error, command '" << cmd.ToCString() << "' failed" );
+ error(COMPERR_ALGO_FAILED, "ghs3d: command not found" );
+ }
+
+ if ( !_keepFiles )
+ {
+ if (! Ok && _compute_canceled)
+ removeFile( aLogFileName );
+ removeFile( aGMFFileName );
+ removeFile( aResultFileName );
+ removeFile( aRequiredVerticesFileName );
+ removeFile( aSolFileName );
+ removeFile( aResSolFileName );
+ }
+ return Ok;
+}
+
+void GHS3DPlugin_GHS3D::CancelCompute()
+{
+ _compute_canceled = true;
+#ifdef WIN32
+#else
+ std::string cmd = "ps xo pid,args | grep " + _genericName;
+ //cmd += " | grep -e \"^ *[0-9]\\+ \\+" + GHS3DPlugin_Hypothesis::GetExeName() + "\"";
+ cmd += " | awk '{print $1}' | xargs kill -9 > /dev/null 2>&1";
+ system( cmd.c_str() );
+#endif
+}
+
+//================================================================================
+/*!
+ * \brief Provide human readable text by error code reported by ghs3d
+ */
+//================================================================================
+
+static const char* translateError(const int errNum)
+{
+ switch ( errNum ) {
+ case 0:
+ return "The surface mesh includes a face of type other than edge, "
+ "triangle or quadrilateral. This face type is not supported.";
+ case 1:
+ return "Not enough memory for the face table.";
+ case 2:
+ return "Not enough memory.";
+ case 3:
+ return "Not enough memory.";
+ case 4:
+ return "Face is ignored.";
+ case 5:
+ return "End of file. Some data are missing in the file.";
+ case 6:
+ return "Read error on the file. There are wrong data in the file.";
+ case 7:
+ return "the metric file is inadequate (dimension other than 3).";
+ case 8:
+ return "the metric file is inadequate (values not per vertices).";
+ case 9:
+ return "the metric file contains more than one field.";
+ case 10:
+ return "the number of values in the \".bb\" (metric file) is incompatible with the expected"
+ "value of number of mesh vertices in the \".noboite\" file.";
+ case 12:
+ return "Too many sub-domains.";
+ case 13:
+ return "the number of vertices is negative or null.";
+ case 14:
+ return "the number of faces is negative or null.";
+ case 15:
+ return "A face has a null vertex.";
+ case 22:
+ return "incompatible data.";
+ case 131:
+ return "the number of vertices is negative or null.";
+ case 132:
+ return "the number of vertices is negative or null (in the \".mesh\" file).";
+ case 133:
+ return "the number of faces is negative or null.";
+ case 1000:
+ return "A face appears more than once in the input surface mesh.";
+ case 1001:
+ return "An edge appears more than once in the input surface mesh.";
+ case 1002:
+ return "A face has a vertex negative or null.";
+ case 1003:
+ return "NOT ENOUGH MEMORY.";
+ case 2000:
+ return "Not enough available memory.";
+ case 2002:
+ return "Some initial points cannot be inserted. The surface mesh is probably very bad "
+ "in terms of quality or the input list of points is wrong.";
+ case 2003:
+ return "Some vertices are too close to one another or coincident.";
+ case 2004:
+ return "Some vertices are too close to one another or coincident.";
+ case 2012:
+ return "A vertex cannot be inserted.";
+ case 2014:
+ return "There are at least two points considered as coincident.";
+ case 2103:
+ return "Some vertices are too close to one another or coincident.";
+ case 3000:
+ return "The surface mesh regeneration step has failed.";
+ case 3009:
+ return "Constrained edge cannot be enforced.";
+ case 3019:
+ return "Constrained face cannot be enforced.";
+ case 3029:
+ return "Missing faces.";
+ case 3100:
+ return "No guess to start the definition of the connected component(s).";
+ case 3101:
+ return "The surface mesh includes at least one hole. The domain is not well defined.";
+ case 3102:
+ return "Impossible to define a component.";
+ case 3103:
+ return "The surface edge intersects another surface edge.";
+ case 3104:
+ return "The surface edge intersects the surface face.";
+ case 3105:
+ return "One boundary point lies within a surface face.";
+ case 3106:
+ return "One surface edge intersects a surface face.";
+ case 3107:
+ return "One boundary point lies within a surface edge.";
+ case 3108:
+ return "Insufficient memory ressources detected due to a bad quality surface mesh leading "
+ "to too many swaps.";
+ case 3109:
+ return "Edge is unique (i.e., bounds a hole in the surface).";
+ case 3122:
+ return "Presumably, the surface mesh is not compatible with the domain being processed.";
+ case 3123:
+ return "Too many components, too many sub-domain.";
+ case 3209:
+ return "The surface mesh includes at least one hole. "
+ "Therefore there is no domain properly defined.";
+ case 3300:
+ return "Statistics.";
+ case 3400:
+ return "Statistics.";
+ case 3500:
+ return "Warning, it is dramatically tedious to enforce the boundary items.";
+ case 4000:
+ return "Not enough memory at this time, nevertheless, the program continues. "
+ "The expected mesh will be correct but not really as large as required.";
+ case 4002:
+ return "see above error code, resulting quality may be poor.";
+ case 4003:
+ return "Not enough memory at this time, nevertheless, the program continues (warning).";
+ case 8000:
+ return "Unknown face type.";
+ case 8005:
+ case 8006:
+ return "End of file. Some data are missing in the file.";
+ case 9000:
+ return "A too small volume element is detected.";
+ case 9001:
+ return "There exists at least a null or negative volume element.";
+ case 9002:
+ return "There exist null or negative volume elements.";
+ case 9003:
+ return "A too small volume element is detected. A face is considered being degenerated.";
+ case 9100:
+ return "Some element is suspected to be very bad shaped or wrong.";
+ case 9102:
+ return "A too bad quality face is detected. This face is considered degenerated.";
+ case 9112:
+ return "A too bad quality face is detected. This face is degenerated.";
+ case 9122:
+ return "Presumably, the surface mesh is not compatible with the domain being processed.";
+ case 9999:
+ return "Abnormal error occured, contact hotline.";
+ case 23600:
+ return "Not enough memory for the face table.";
+ case 23601:
+ return "The algorithm cannot run further. "
+ "The surface mesh is probably very bad in terms of quality.";
+ case 23602:
+ return "Bad vertex number.";
+ case 1001200:
+ return "Cannot close mesh file NomFil.";
+ case 1002010:
+ return "There are wrong data.";
+ case 1002120:
+ return "The number of faces is negative or null.";
+ case 1002170:
+ return "The number of vertices is negative or null in the '.sol' file.";
+ case 1002190:
+ return "The number of tetrahedra is negative or null.";
+ case 1002210:
+ return "The number of vertices is negative or null.";
+ case 1002211:
+ return "A face has a vertex negative or null.";
+ case 1002270:
+ return "The field is not a size in file NomFil.";
+ case 1002280:
+ return "A count is wrong in the enclosing box in the .boite.mesh input "
+ "file (option '--read_boite').";
+ case 1002290:
+ return "A tetrahedron has a vertex with a negative number.";
+ case 1002300:
+ return "the 'MeshVersionFormatted' is not 1 or 2 in the '.mesh' file or the '.sol'.";
+ case 1002370:
+ return "The number of values in the '.sol' (metric file) is incompatible with "
+ "the expected value of number of mesh vertices in the '.mesh' file.";
+ case 1003000:
+ return "Not enough memory.";
+ case 1003020:
+ return "Not enough memory for the face table.";
+ case 1003050:
+ return "Insufficient memory ressources detected due to a bad quality "
+ "surface mesh leading to too many swaps.";
+ case 1005010:
+ return "The surface coordinates of a vertex are differing from the "
+ "volume coordinates, probably due to a precision problem.";
+ case 1005050:
+ return "Invalid dimension. Dimension 3 expected.";
+ case 1005100:
+ return "A point has a tag 0. This point is probably outside the domain which has been meshed.";
+ case 1005103:
+ return "The vertices of an element are too close to one another or coincident.";
+ case 1005104:
+ return "There are at least two points whose distance is very small, and considered as coincident.";
+ case 1005105:
+ return "Two vertices are too close to one another or coincident.";
+ case 1005106:
+ return "A vertex cannot be inserted.";
+ case 1005107:
+ return "Two vertices are too close to one another or coincident. Note : When "
+ "this error occurs during the overconstrained processing phase, this is only "
+ "a warning which means that it is difficult to break some overconstrained facets.";
+ case 1005110:
+ return "Two surface edges are intersecting.";
+ case 1005120:
+ return "A surface edge intersects a surface face.";
+ case 1005150:
+ return "A boundary point lies within a surface face.";
+ case 1005160:
+ return "A boundary point lies within a surface edge.";
+ case 1005200:
+ return "A surface mesh appears more than once in the input surface mesh.";
+ case 1005210:
+ return "An edge appears more than once in the input surface mesh.";
+ case 1005225:
+ return "Surface with unvalid triangles.";
+ case 1005270:
+ return "The metric in the '.sol' file contains more than one field.";
+ case 1005300:
+ return "The surface mesh includes at least one hole. The domain is not well defined.";
+ case 1005301:
+ return "Presumably, the surface mesh is not compatible with the domain being processed (warning).";
+ case 1005302:
+ return "Probable faces overlapping somewher.";
+ case 1005320:
+ return "The quadratic version does not work with prescribed free edges.";
+ case 1005321:
+ return "The quadratic version does not work with a volume mesh.";
+ case 1005370:
+ return "The metric in the '.sol' file is inadequate (values not per vertices).";
+ case 1005371:
+ return "The number of vertices in the '.sol' is different from the one in the "
+ "'.mesh' file for the required vertices (option '--required_vertices').";
+ case 1005372:
+ return "More than one type in file NomFil. The type must be equal to 1 in the '.sol'"
+ "for the required vertices (option '--required_vertices').";
+ case 1005515:
+ return "Bad vertex number.";
+ case 1005560:
+ return "No guess to start the definition of the connected component(s).";
+ case 1005602:
+ return "Some initial points cannot be inserted.";
+ case 1005620:
+ return "A too bad quality face is detected. This face is considered degenerated.";
+ case 1005621:
+ return "A too bad quality face is detected. This face is degenerated.";
+ case 1005622:
+ return "The algorithm cannot run further.";
+ case 1005690:
+ return "A too small volume element is detected.";
+ case 1005691:
+ return "A tetrahedra is suspected to be very bad shaped or wrong.";
+ case 1005692:
+ return "There is at least a null or negative volume element. The resulting mesh"
+ "may be inappropriate.";
+ case 1005693:
+ return "There are some null or negative volume element. The resulting mesh may"
+ "be inappropriate.";
+ case 1005820:
+ return "An edge is unique (i.e., bounds a hole in the surface).";
+ case 1007000:
+ return "Abnormal or internal error.";
+ case 1007010:
+ return "Too many components with respect to too many sub-domain.";
+ case 1007400:
+ return "An internal error has been encountered or a signal has been received. "
+ "Current mesh will not be saved.";
+ case 1008491:
+ return "Impossible to define a component.";
+ case 1008410:
+ return "There are some overconstrained edges.";
+ case 1008420:
+ return "There are some overconstrained facets.";
+ case 1008422:
+ return "Give the number of missing faces (information given when regeneration phase failed).";
+ case 1008423:
+ return "A constrained face cannot be enforced (information given when regeneration phase failed).";
+ case 1008441:
+ return "A constrained edge cannot be enforced.";
+ case 1008460:
+ return "It is dramatically tedious to enforce the boundary items.";
+ case 1008480:
+ return "The surface mesh regeneration step has failed. A .boite.mesh and .boite.map files are created.";
+ case 1008490:
+ return "Invalid resulting mesh.";
+ case 1008495:
+ return "P2 correction not successful.";
+ case 1009000:
+ return "Program has received an interruption or a termination signal sent by the "
+ "user or the system administrator. Current mesh will not be saved.";
+ }
+ return "";
+}
+
+//================================================================================
+/*!
+ * \brief Retrieve from a string given number of integers
+ */
+//================================================================================
+
+static char* getIds( char* ptr, int nbIds, vector<int>& ids )
+{
+ ids.clear();
+ ids.reserve( nbIds );
+ while ( nbIds )
+ {
+ while ( !isdigit( *ptr )) ++ptr;
+ if ( ptr[-1] == '-' ) --ptr;
+ ids.push_back( strtol( ptr, &ptr, 10 ));
+ --nbIds;
+ }
+ return ptr;
+}
+
+//================================================================================
+/*!
+ * \brief Retrieve problem description form a log file
+ * \retval bool - always false
+ */
+//================================================================================
+
+bool GHS3DPlugin_GHS3D::storeErrorDescription(const TCollection_AsciiString& logFile,
+ const _Ghs2smdsConvertor & toSmdsConvertor )
+{
+ if(_compute_canceled)
+ return error(SMESH_Comment("interruption initiated by user"));
+ // open file
+#ifdef WIN32
+ int file = ::_open (logFile.ToCString(), _O_RDONLY|_O_BINARY);
+#else
+ int file = ::open (logFile.ToCString(), O_RDONLY);
+#endif
+ if ( file < 0 )
+ return error( SMESH_Comment("See ") << logFile << " for problem description");
+
+ // get file size
+ off_t length = lseek( file, 0, SEEK_END);
+ lseek( file, 0, SEEK_SET);
+
+ // read file
+ vector< char > buf( length );
+ int nBytesRead = ::read (file, & buf[0], length);
+ ::close (file);
+ char* ptr = & buf[0];
+ char* bufEnd = ptr + nBytesRead;
+
+ SMESH_Comment errDescription;
+
+ enum { NODE = 1, EDGE, TRIA, VOL, SKIP_ID = 1 };
+
+ // look for MeshGems version
+ // Since "MG-TETRA -- MeshGems 1.1-3 (January, 2013)" error codes change.
+ // To discriminate old codes from new ones we add 1000000 to the new codes.
+ // This way value of the new codes is same as absolute value of codes printed
+ // in the log after "MGMESSAGE" string.
+ int versionAddition = 0;
+ {
+ char* verPtr = ptr;
+ while ( ++verPtr < bufEnd )
+ {
+ if ( strncmp( verPtr, "MG-TETRA -- MeshGems ", 21 ) != 0 )
+ continue;
+ if ( strcmp( verPtr, "MG-TETRA -- MeshGems 1.1-3 " ) >= 0 )
+ versionAddition = 1000000;
+ ptr = verPtr;
+ break;
+ }
+ }
+
+ // look for errors "ERR #"
+
+ set<string> foundErrorStr; // to avoid reporting same error several times
+ set<int> elemErrorNums; // not to report different types of errors with bad elements
+ while ( ++ptr < bufEnd )
+ {
+ if ( strncmp( ptr, "ERR ", 4 ) != 0 )
+ continue;
+
+ list<const SMDS_MeshElement*> badElems;
+ vector<int> nodeIds;
+
+ ptr += 4;
+ char* errBeg = ptr;
+ int errNum = strtol(ptr, &ptr, 10) + versionAddition;
+ // we treat errors enumerated in [SALOME platform 0019316] issue
+ // and all errors from a new (Release 1.1) MeshGems User Manual
+ switch ( errNum ) {
+ case 0015: // The face number (numfac) with vertices (f 1, f 2, f 3) has a null vertex.
+ case 1005620 : // a too bad quality face is detected. This face is considered degenerated.
+ ptr = getIds(ptr, SKIP_ID, nodeIds);
+ ptr = getIds(ptr, TRIA, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ break;
+ case 1005621 : // a too bad quality face is detected. This face is degenerated.
+ // hence the is degenerated it is invisible, add its edges in addition
+ ptr = getIds(ptr, SKIP_ID, nodeIds);
+ ptr = getIds(ptr, TRIA, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ {
+ vector<int> edgeNodes( nodeIds.begin(), --nodeIds.end() ); // 01
+ badElems.push_back( toSmdsConvertor.getElement(edgeNodes));
+ edgeNodes[1] = nodeIds[2]; // 02
+ badElems.push_back( toSmdsConvertor.getElement(edgeNodes));
+ edgeNodes[0] = nodeIds[1]; // 12
+ }
+ break;
+ case 1000: // Face (f 1, f 2, f 3) appears more than once in the input surface mesh.
+ // ERR 1000 : 1 3 2
+ case 1002: // Face (f 1, f 2, f 3) has a vertex negative or null
+ case 3019: // Constrained face (f 1, f 2, f 3) cannot be enforced
+ case 1002211: // a face has a vertex negative or null.
+ case 1005200 : // a surface mesh appears more than once in the input surface mesh.
+ case 1008423 : // a constrained face cannot be enforced (regeneration phase failed).
+ ptr = getIds(ptr, TRIA, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ break;
+ case 1001: // Edge (e1, e2) appears more than once in the input surface mesh
+ case 3009: // Constrained edge (e1, e2) cannot be enforced (warning).
+ // ERR 3109 : EDGE 5 6 UNIQUE
+ case 3109: // Edge (e1, e2) is unique (i.e., bounds a hole in the surface)
+ case 1005210 : // an edge appears more than once in the input surface mesh.
+ case 1005820 : // an edge is unique (i.e., bounds a hole in the surface).
+ case 1008441 : // a constrained edge cannot be enforced.
+ ptr = getIds(ptr, EDGE, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ break;
+ case 2004: // Vertex v1 and vertex v2 are too close to one another or coincident (warning).
+ case 2014: // at least two points whose distance is dist, i.e., considered as coincident
+ case 2103: // Vertex v1 and vertex v2 are too close to one another or coincident (warning).
+ // ERR 2103 : 16 WITH 3
+ case 1005105 : // two vertices are too close to one another or coincident.
+ case 1005107: // Two vertices are too close to one another or coincident.
+ ptr = getIds(ptr, NODE, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ ptr = getIds(ptr, NODE, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ break;
+ case 2012: // Vertex v1 cannot be inserted (warning).
+ case 1005106 : // a vertex cannot be inserted.
+ ptr = getIds(ptr, NODE, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ break;
+ case 3103: // The surface edge (e1, e2) intersects another surface edge (e3, e4)
+ case 1005110 : // two surface edges are intersecting.
+ // ERR 3103 : 1 2 WITH 7 3
+ ptr = getIds(ptr, EDGE, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ ptr = getIds(ptr, EDGE, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ break;
+ case 3104: // The surface edge (e1, e2) intersects the surface face (f 1, f 2, f 3)
+ // ERR 3104 : 9 10 WITH 1 2 3
+ case 3106: // One surface edge (say e1, e2) intersects a surface face (f 1, f 2, f 3)
+ case 1005120 : // a surface edge intersects a surface face.
+ ptr = getIds(ptr, EDGE, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ ptr = getIds(ptr, TRIA, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ break;
+ case 3105: // One boundary point (say p1) lies within a surface face (f 1, f 2, f 3)
+ // ERR 3105 : 8 IN 2 3 5
+ case 1005150 : // a boundary point lies within a surface face.
+ ptr = getIds(ptr, NODE, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ ptr = getIds(ptr, TRIA, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ break;
+ case 3107: // One boundary point (say p1) lies within a surface edge (e1, e2) (stop).
+ // ERR 3107 : 2 IN 4 1
+ case 1005160 : // a boundary point lies within a surface edge.
+ ptr = getIds(ptr, NODE, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ ptr = getIds(ptr, EDGE, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ break;
+ case 9000: // ERR 9000
+ // ELEMENT 261 WITH VERTICES : 7 396 -8 242
+ // VOLUME : -1.11325045E+11 W.R.T. EPSILON 0.
+ // A too small volume element is detected. Are reported the index of the element,
+ // its four vertex indices, its volume and the tolerance threshold value
+ ptr = getIds(ptr, SKIP_ID, nodeIds);
+ ptr = getIds(ptr, VOL, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ // even if all nodes found, volume it most probably invisible,
+ // add its faces to demonstrate it anyhow
+ {
+ vector<int> faceNodes( nodeIds.begin(), --nodeIds.end() ); // 012
+ badElems.push_back( toSmdsConvertor.getElement(faceNodes));
+ faceNodes[2] = nodeIds[3]; // 013
+ badElems.push_back( toSmdsConvertor.getElement(faceNodes));
+ faceNodes[1] = nodeIds[2]; // 023
+ badElems.push_back( toSmdsConvertor.getElement(faceNodes));
+ faceNodes[0] = nodeIds[1]; // 123
+ badElems.push_back( toSmdsConvertor.getElement(faceNodes));
+ }
+ break;
+ case 9001: // ERR 9001
+ // %% NUMBER OF NEGATIVE VOLUME TETS : 1
+ // %% THE LARGEST NEGATIVE TET : 1.75376581E+11
+ // %% NUMBER OF NULL VOLUME TETS : 0
+ // There exists at least a null or negative volume element
+ break;
+ case 9002:
+ // There exist n null or negative volume elements
+ break;
+ case 9003:
+ // A too small volume element is detected
+ break;
+ case 9102:
+ // A too bad quality face is detected. This face is considered degenerated,
+ // its index, its three vertex indices together with its quality value are reported
+ break; // same as next
+ case 9112: // ERR 9112
+ // FACE 2 WITH VERTICES : 4 2 5
+ // SMALL INRADIUS : 0.
+ // A too bad quality face is detected. This face is degenerated,
+ // its index, its three vertex indices together with its inradius are reported
+ ptr = getIds(ptr, SKIP_ID, nodeIds);
+ ptr = getIds(ptr, TRIA, nodeIds);
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ // add triangle edges as it most probably has zero area and hence invisible
+ {
+ vector<int> edgeNodes(2);
+ edgeNodes[0] = nodeIds[0]; edgeNodes[1] = nodeIds[1]; // 0-1
+ badElems.push_back( toSmdsConvertor.getElement(edgeNodes));
+ edgeNodes[1] = nodeIds[2]; // 0-2
+ badElems.push_back( toSmdsConvertor.getElement(edgeNodes));
+ edgeNodes[0] = nodeIds[1]; // 1-2
+ badElems.push_back( toSmdsConvertor.getElement(edgeNodes));
+ }
+ break;
+ case 1005103 : // the vertices of an element are too close to one another or coincident.
+ ptr = getIds(ptr, TRIA, nodeIds);
+ if ( nodeIds.back() == 0 ) // index of the third vertex of the element (0 for an edge)
+ nodeIds.resize( EDGE );
+ badElems.push_back( toSmdsConvertor.getElement(nodeIds));
+ break;
+ }
+
+ bool isNewError = foundErrorStr.insert( string( errBeg, ptr )).second;
+ if ( !isNewError )
+ continue; // not to report same error several times
+
+// const SMDS_MeshElement* nullElem = 0;
+// bool allElemsOk = ( find( badElems.begin(), badElems.end(), nullElem) == badElems.end());
+
+// if ( allElemsOk && !badElems.empty() && !elemErrorNums.empty() ) {
+// bool oneMoreErrorType = elemErrorNums.insert( errNum ).second;
+// if ( oneMoreErrorType )
+// continue; // not to report different types of errors with bad elements
+// }
+
+ // store bad elements
+ //if ( allElemsOk ) {
+ list<const SMDS_MeshElement*>::iterator elem = badElems.begin();
+ for ( ; elem != badElems.end(); ++elem )
+ addBadInputElement( *elem );
+ //}
+
+ // make error text
+ string text = translateError( errNum );
+ if ( errDescription.find( text ) == text.npos ) {
+ if ( !errDescription.empty() )
+ errDescription << "\n";
+ errDescription << text;
+ }
+
+ } // end while
+
+ if ( errDescription.empty() ) { // no errors found
+ char msgLic1[] = "connection to server failed";
+ char msgLic2[] = " Dlim ";
+ if ( search( &buf[0], bufEnd, msgLic1, msgLic1 + strlen(msgLic1)) != bufEnd ||
+ search( &buf[0], bufEnd, msgLic2, msgLic2 + strlen(msgLic2)) != bufEnd )
+ errDescription << "Licence problems.";
+ else
+ {
+ char msg2[] = "SEGMENTATION FAULT";
+ if ( search( &buf[0], bufEnd, msg2, msg2 + strlen(msg2)) != bufEnd )
+ errDescription << "ghs3d: SEGMENTATION FAULT. ";
+ }
+ }
+
+ if ( errDescription.empty() )
+ errDescription << "See " << logFile << " for problem description";
+ else
+ errDescription << "\nSee " << logFile << " for more information";
+
+ return error( errDescription );
+}
+
+//================================================================================
+/*!
+ * \brief Creates _Ghs2smdsConvertor
+ */
+//================================================================================
+
+_Ghs2smdsConvertor::_Ghs2smdsConvertor( const map <int,const SMDS_MeshNode*> & ghs2NodeMap)
+ :_ghs2NodeMap( & ghs2NodeMap ), _nodeByGhsId( 0 )
+{
+}
+
+//================================================================================
+/*!
+ * \brief Creates _Ghs2smdsConvertor
+ */
+//================================================================================
+
+_Ghs2smdsConvertor::_Ghs2smdsConvertor( const vector <const SMDS_MeshNode*> & nodeByGhsId)
+ : _ghs2NodeMap( 0 ), _nodeByGhsId( &nodeByGhsId )
+{
+}
+
+//================================================================================
+/*!
+ * \brief Return SMDS element by ids of GHS3D nodes
+ */
+//================================================================================
+
+const SMDS_MeshElement* _Ghs2smdsConvertor::getElement(const vector<int>& ghsNodes) const
+{
+ size_t nbNodes = ghsNodes.size();
+ vector<const SMDS_MeshNode*> nodes( nbNodes, 0 );
+ for ( size_t i = 0; i < nbNodes; ++i ) {
+ int ghsNode = ghsNodes[ i ];
+ if ( _ghs2NodeMap ) {
+ map <int,const SMDS_MeshNode*>::const_iterator in = _ghs2NodeMap->find( ghsNode);
+ if ( in == _ghs2NodeMap->end() )
+ return 0;
+ nodes[ i ] = in->second;
+ }
+ else {
+ if ( ghsNode < 1 || ghsNode > _nodeByGhsId->size() )
+ return 0;
+ nodes[ i ] = (*_nodeByGhsId)[ ghsNode-1 ];
+ }
+ }
+ if ( nbNodes == 1 )
+ return nodes[0];
+
+ if ( nbNodes == 2 ) {
+ const SMDS_MeshElement* edge= SMDS_Mesh::FindEdge( nodes[0], nodes[1] );
+ if ( !edge )
+ edge = new SMDS_LinearEdge( nodes[0], nodes[1] );
+ return edge;
+ }
+ if ( nbNodes == 3 ) {
+ const SMDS_MeshElement* face = SMDS_Mesh::FindFace( nodes );
+ if ( !face )
+ face = new SMDS_FaceOfNodes( nodes[0], nodes[1], nodes[2] );
+ return face;
+ }
+ if ( nbNodes == 4 )
+ return new SMDS_VolumeOfNodes( nodes[0], nodes[1], nodes[2], nodes[3] );
+
+ return 0;
+}
+
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+bool GHS3DPlugin_GHS3D::Evaluate(SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape,
+ MapShapeNbElems& aResMap)
+{
+ int nbtri = 0, nbqua = 0;
+ double fullArea = 0.0;
+ for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next()) {
+ TopoDS_Face F = TopoDS::Face( exp.Current() );
+ SMESH_subMesh *sm = aMesh.GetSubMesh(F);
+ MapShapeNbElemsItr anIt = aResMap.find(sm);
+ if( anIt==aResMap.end() ) {
+ SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+ smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,
+ "Submesh can not be evaluated",this));
+ return false;
+ }
+ std::vector<int> aVec = (*anIt).second;
+ nbtri += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
+ nbqua += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+ GProp_GProps G;
+ BRepGProp::SurfaceProperties(F,G);
+ double anArea = G.Mass();
+ fullArea += anArea;
+ }
+
+ // collect info from edges
+ int nb0d_e = 0, nb1d_e = 0;
+ bool IsQuadratic = false;
+ bool IsFirst = true;
+ TopTools_MapOfShape tmpMap;
+ for (TopExp_Explorer exp(aShape, TopAbs_EDGE); exp.More(); exp.Next()) {
+ TopoDS_Edge E = TopoDS::Edge(exp.Current());
+ if( tmpMap.Contains(E) )
+ continue;
+ tmpMap.Add(E);
+ SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
+ MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
+ std::vector<int> aVec = (*anIt).second;
+ nb0d_e += aVec[SMDSEntity_Node];
+ nb1d_e += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+ if(IsFirst) {
+ IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
+ IsFirst = false;
+ }
+ }
+ tmpMap.Clear();
+
+ double ELen = sqrt(2.* ( fullArea/(nbtri+nbqua*2) ) / sqrt(3.0) );
+
+ GProp_GProps G;
+ BRepGProp::VolumeProperties(aShape,G);
+ double aVolume = G.Mass();
+ double tetrVol = 0.1179*ELen*ELen*ELen;
+ double CoeffQuality = 0.9;
+ int nbVols = int(aVolume/tetrVol/CoeffQuality);
+ int nb1d_f = (nbtri*3 + nbqua*4 - nb1d_e) / 2;
+ int nb1d_in = (int) ( nbVols*6 - nb1d_e - nb1d_f ) / 5;
+ std::vector<int> aVec(SMDSEntity_Last);
+ for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
+ if( IsQuadratic ) {
+ aVec[SMDSEntity_Node] = nb1d_in/6 + 1 + nb1d_in;
+ aVec[SMDSEntity_Quad_Tetra] = nbVols - nbqua*2;
+ aVec[SMDSEntity_Quad_Pyramid] = nbqua;
+ }
+ else {
+ aVec[SMDSEntity_Node] = nb1d_in/6 + 1;
+ aVec[SMDSEntity_Tetra] = nbVols - nbqua*2;
+ aVec[SMDSEntity_Pyramid] = nbqua;
+ }
+ SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
+ aResMap.insert(std::make_pair(sm,aVec));
+
+ return true;
+}
+
+bool GHS3DPlugin_GHS3D::importGMFMesh(const char* theGMFFileName, SMESH_Mesh& theMesh)
+{
+ SMESH_MesherHelper* helper = new SMESH_MesherHelper(theMesh );
+ std::vector <const SMDS_MeshNode*> dummyNodeVector;
+ std::vector <const SMDS_MeshElement*> aFaceByGhs3dId;
+ std::map<const SMDS_MeshNode*,int> dummyNodeMap;
+ std::map<std::vector<double>, std::string> dummyEnfVertGroup;
+ std::vector<std::string> dummyElemGroup;
+ std::set<std::string> dummyGroupsToRemove;
+
+ bool ok = readGMFFile(theGMFFileName,
+ this,
+ helper, dummyNodeVector, aFaceByGhs3dId, dummyNodeMap, dummyElemGroup, dummyElemGroup, dummyElemGroup, dummyGroupsToRemove);
+ theMesh.GetMeshDS()->Modified();
+ return ok;
+}
+
+namespace
+{
+ //================================================================================
+ /*!
+ * \brief Sub-mesh event listener setting enforced elements as soon as an enforced
+ * mesh is loaded
+ */
+ struct _EnforcedMeshRestorer : public SMESH_subMeshEventListener
+ {
+ _EnforcedMeshRestorer():
+ SMESH_subMeshEventListener( /*isDeletable = */true, Name() )
+ {}
+
+ //================================================================================
+ /*!
+ * \brief Returns an ID of listener
+ */
+ static const char* Name() { return "GHS3DPlugin_GHS3D::_EnforcedMeshRestorer"; }
+
+ //================================================================================
+ /*!
+ * \brief Treat events of the subMesh
+ */
+ void ProcessEvent(const int event,
+ const int eventType,
+ SMESH_subMesh* subMesh,
+ SMESH_subMeshEventListenerData* data,
+ const SMESH_Hypothesis* hyp)
+ {
+ if ( SMESH_subMesh::SUBMESH_LOADED == event &&
+ SMESH_subMesh::COMPUTE_EVENT == eventType &&
+ data &&
+ !data->mySubMeshes.empty() )
+ {
+ // An enforced mesh (subMesh->_father) has been loaded from hdf file
+ if ( GHS3DPlugin_Hypothesis* hyp = GetGHSHypothesis( data->mySubMeshes.front() ))
+ hyp->RestoreEnfElemsByMeshes();
+ }
+ }
+ //================================================================================
+ /*!
+ * \brief Returns GHS3DPlugin_Hypothesis used to compute a subMesh
+ */
+ static GHS3DPlugin_Hypothesis* GetGHSHypothesis( SMESH_subMesh* subMesh )
+ {
+ SMESH_HypoFilter ghsHypFilter( SMESH_HypoFilter::HasName( "GHS3D_Parameters" ));
+ return (GHS3DPlugin_Hypothesis* )
+ subMesh->GetFather()->GetHypothesis( subMesh->GetSubShape(),
+ ghsHypFilter,
+ /*visitAncestors=*/true);
+ }
+ };
+
+ //================================================================================
+ /*!
+ * \brief Sub-mesh event listener removing empty groups created due to "To make
+ * groups of domains".
+ */
+ struct _GroupsOfDomainsRemover : public SMESH_subMeshEventListener
+ {
+ _GroupsOfDomainsRemover():
+ SMESH_subMeshEventListener( /*isDeletable = */true,
+ "GHS3DPlugin_GHS3D::_GroupsOfDomainsRemover" ) {}
+ /*!
+ * \brief Treat events of the subMesh
+ */
+ void ProcessEvent(const int event,
+ const int eventType,
+ SMESH_subMesh* subMesh,
+ SMESH_subMeshEventListenerData* data,
+ const SMESH_Hypothesis* hyp)
+ {
+ if (SMESH_subMesh::ALGO_EVENT == eventType &&
+ !subMesh->GetAlgo() )
+ {
+ removeEmptyGroupsOfDomains( subMesh->GetFather(), /*notEmptyAsWell=*/true );
+ }
+ }
+ };
+}
+
+//================================================================================
+/*!
+ * \brief Set an event listener to set enforced elements as soon as an enforced
+ * mesh is loaded
+ */
+//================================================================================
+
+void GHS3DPlugin_GHS3D::SubmeshRestored(SMESH_subMesh* subMesh)
+{
+ if ( GHS3DPlugin_Hypothesis* hyp = _EnforcedMeshRestorer::GetGHSHypothesis( subMesh ))
+ {
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList enfMeshes = hyp->_GetEnforcedMeshes();
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList::iterator it = enfMeshes.begin();
+ for(;it != enfMeshes.end();++it) {
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedMesh* enfMesh = *it;
+ if ( SMESH_Mesh* mesh = GetMeshByPersistentID( enfMesh->persistID ))
+ {
+ SMESH_subMesh* smToListen = mesh->GetSubMesh( mesh->GetShapeToMesh() );
+ // a listener set to smToListen will care of hypothesis stored in SMESH_EventListenerData
+ subMesh->SetEventListener( new _EnforcedMeshRestorer(),
+ SMESH_subMeshEventListenerData::MakeData( subMesh ),
+ smToListen);
+ }
+ }
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Sets an event listener removing empty groups created due to "To make
+ * groups of domains".
+ * \param subMesh - submesh where algo is set
+ *
+ * This method is called when a submesh gets HYP_OK algo_state.
+ * After being set, event listener is notified on each event of a submesh.
+ */
+//================================================================================
+
+void GHS3DPlugin_GHS3D::SetEventListener(SMESH_subMesh* subMesh)
+{
+ subMesh->SetEventListener( new _GroupsOfDomainsRemover(), 0, subMesh );
+}
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//=============================================================================
+// File : GHS3DPlugin_GHS3D.hxx
+// Author : Edward AGAPOV, modified by Lioka RAZAFINDRAZAKA (CEA) 09/02/2007
+// Project : SALOME
+//=============================================================================
+//
+#ifndef _GHS3DPlugin_GHS3D_HXX_
+#define _GHS3DPlugin_GHS3D_HXX_
+
+#include "SMESH_Algo.hxx"
+#include "SMESH_Gen.hxx"
+#include "SMESH_Gen_i.hxx"
+
+#include <map>
+#include <vector>
+
+extern "C"
+{
+ #include "libmesh5.h"
+}
+
+#ifndef GMFVERSION
+#define GMFVERSION GmfDouble
+#endif
+#define GMFDIMENSION 3
+
+class GHS3DPlugin_Hypothesis;
+class SMDS_MeshNode;
+class SMESH_Mesh;
+class StdMeshers_ViscousLayers;
+class TCollection_AsciiString;
+class _Ghs2smdsConvertor;
+class TopoDS_Shape;
+
+class GHS3DPlugin_GHS3D: public SMESH_3D_Algo
+{
+public:
+ GHS3DPlugin_GHS3D(int hypId, int studyId, SMESH_Gen* gen);
+ virtual ~GHS3DPlugin_GHS3D();
+
+ virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape,
+ Hypothesis_Status& aStatus);
+
+ virtual bool Compute(SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape);
+
+ virtual void CancelCompute();
+ bool computeCanceled() { return _compute_canceled;};
+
+ virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
+ MapShapeNbElems& aResMap);
+
+ virtual bool Compute(SMESH_Mesh& theMesh,
+ SMESH_MesherHelper* aHelper);
+
+ virtual void SubmeshRestored(SMESH_subMesh* subMesh);
+
+ virtual void SetEventListener(SMESH_subMesh* subMesh);
+
+ bool importGMFMesh(const char* aGMFFileName, SMESH_Mesh& aMesh);
+
+ static const char* Name() { return "GHS3D_3D"; }
+
+protected:
+ const GHS3DPlugin_Hypothesis* _hyp;
+ const StdMeshers_ViscousLayers* _viscousLayersHyp;
+ std::string _genericName;
+
+private:
+
+ bool storeErrorDescription(const TCollection_AsciiString& logFile,
+ const _Ghs2smdsConvertor & toSmdsConvertor );
+ TopoDS_Shape entryToShape(std::string entry);
+
+ int _iShape;
+ int _nbShape;
+ bool _keepFiles;
+ bool _removeLogOnSuccess;
+ bool _logInStandardOutput;
+ SALOMEDS::Study_var myStudy;
+ SMESH_Gen_i* smeshGen_i;
+
+ volatile bool _compute_canceled;
+};
+
+/*!
+ * \brief Convertor of GHS3D elements to SMDS ones
+ */
+class _Ghs2smdsConvertor
+{
+ const std::map <int,const SMDS_MeshNode*> * _ghs2NodeMap;
+ const std::vector <const SMDS_MeshNode*> * _nodeByGhsId;
+
+public:
+ _Ghs2smdsConvertor( const std::map <int,const SMDS_MeshNode*> & ghs2NodeMap);
+
+ _Ghs2smdsConvertor( const std::vector <const SMDS_MeshNode*> & nodeByGhsId);
+
+ const SMDS_MeshElement* getElement(const std::vector<int>& ghsNodes) const;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// 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 : GHS3DPlugin_GHS3D_i.cxx
+// Author : Edward AGAPOV
+// Module : GHS3DPlugin
+// $Header$
+//
+#include "GHS3DPlugin_GHS3D_i.hxx"
+#include "SMESH_Gen.hxx"
+#include "SMESH_Mesh_i.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "GHS3DPlugin_GHS3D.hxx"
+#include "SMESH_PythonDump.hxx"
+
+#include "utilities.h"
+#include <cstring>
+
+//=============================================================================
+/*!
+ * GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_i
+ *
+ * Constructor
+ */
+//=============================================================================
+
+GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_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 )
+{
+ MESSAGE( "GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_i" );
+ myBaseImpl = new ::GHS3DPlugin_GHS3D (theGenImpl->GetANewId(),
+ theStudyId,
+ theGenImpl );
+}
+
+//=============================================================================
+/*!
+ * GHS3DPlugin_GHS3D_i::~GHS3DPlugin_GHS3D_i
+ *
+ * Destructor
+ */
+//=============================================================================
+
+GHS3DPlugin_GHS3D_i::~GHS3DPlugin_GHS3D_i()
+{
+ MESSAGE( "GHS3DPlugin_GHS3D_i::~GHS3DPlugin_GHS3D_i" );
+}
+
+//=============================================================================
+/*!
+ * GHS3DPlugin_GHS3D_i::GetImpl
+ *
+ * Get implementation
+ */
+//=============================================================================
+
+::GHS3DPlugin_GHS3D* GHS3DPlugin_GHS3D_i::GetImpl()
+{
+ MESSAGE( "GHS3DPlugin_GHS3D_i::GetImpl" );
+ return ( ::GHS3DPlugin_GHS3D* )myBaseImpl;
+}
+
+//=============================================================================
+/*!
+ * GHS3DPlugin_GHS3D_i::~GHS3DPlugin_GHS3D_i
+ *
+ * Destructor
+ */
+//=============================================================================
+
+SMESH::SMESH_Mesh_ptr GHS3DPlugin_GHS3D_i::importGMFMesh(const char* theGMFFileName)
+{
+ MESSAGE( "GHS3DPlugin_GHS3D_i::importGMFMesh" );
+ SMESH_Gen_i* smeshGen = SMESH_Gen_i::GetSMESHGen();
+ SMESH::SMESH_Mesh_ptr theMesh = smeshGen->CreateEmptyMesh();
+ smeshGen->RemoveLastFromPythonScript(smeshGen->GetCurrentStudy()->StudyId());
+ SALOMEDS::SObject_ptr theSMesh = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(), theMesh);
+#ifdef WINNT
+#define SEP '\\'
+#else
+#define SEP '/'
+#endif
+ string strFileName (theGMFFileName);
+ strFileName = strFileName.substr(strFileName.rfind(SEP)+1);
+ strFileName.erase(strFileName.rfind('.'));
+ smeshGen->SetName(theSMesh, strFileName.c_str());
+ SMESH_Mesh_i* meshServant = dynamic_cast<SMESH_Mesh_i*>( smeshGen->GetServant( theMesh ).in() );
+ ASSERT( meshServant );
+ if ( meshServant ) {
+ if (GetImpl()->importGMFMesh(theGMFFileName, meshServant->GetImpl()))
+ SMESH::TPythonDump() << theSMesh << " = " << _this() << ".importGMFMesh( \"" << theGMFFileName << "\")";
+ }
+ return theMesh;
+}
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : GHS3DPlugin_GHS3D_i.hxx
+// Author : Edward AGAPOV
+// Module : GHS3DPlugin
+// $Header$
+//
+#ifndef _GHS3DPlugin_GHS3D_I_HXX_
+#define _GHS3DPlugin_GHS3D_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(GHS3DPlugin_Algorithm)
+#include CORBA_SERVER_HEADER(SALOME_Exception)
+
+#include "SMESH_3D_Algo_i.hxx"
+#include "GHS3DPlugin_GHS3D.hxx"
+
+// ======================================================
+// GHS3D 3d algorithm
+// ======================================================
+class GHS3DPlugin_GHS3D_i:
+ public virtual POA_GHS3DPlugin::GHS3DPlugin_GHS3D,
+ public virtual SMESH_3D_Algo_i
+{
+public:
+ // Constructor
+ GHS3DPlugin_GHS3D_i (PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl );
+ // Destructor
+ virtual ~GHS3DPlugin_GHS3D_i();
+
+ // Get implementation
+ ::GHS3DPlugin_GHS3D* GetImpl();
+
+ virtual SMESH::SMESH_Mesh_ptr importGMFMesh(const char* theGMFFileName);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//=============================================================================
+// File : GHS3DPlugin_Hypothesis.cxx
+// Created : Wed Apr 2 12:36:29 2008
+// Author : Edward AGAPOV (eap)
+//=============================================================================
+//
+#include "GHS3DPlugin_Hypothesis.hxx"
+#include <SMESH_ProxyMesh.hxx>
+#include <SMESH_Group.hxx>
+#include <StdMeshers_QuadToTriaAdaptor.hxx>
+
+#include <TCollection_AsciiString.hxx>
+
+#ifdef WIN32
+#include <process.h>
+#define getpid _getpid
+#endif
+
+//=======================================================================
+//function : GHS3DPlugin_Hypothesis
+//=======================================================================
+
+GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen)
+ : SMESH_Hypothesis(hypId, studyId, gen),
+ myToMeshHoles(DefaultMeshHoles()),
+ myToMakeGroupsOfDomains(DefaultToMakeGroupsOfDomains()),
+ myMaximumMemory(-1),
+ myInitialMemory(-1),
+ myOptimizationLevel(DefaultOptimizationLevel()),
+ myWorkingDirectory(DefaultWorkingDirectory()),
+ myKeepFiles(DefaultKeepFiles()),
+ myVerboseLevel(DefaultVerboseLevel()),
+ myToCreateNewNodes(DefaultToCreateNewNodes()),
+ myToUseBoundaryRecoveryVersion(DefaultToUseBoundaryRecoveryVersion()),
+ myToUseFemCorrection(DefaultToUseFEMCorrection()),
+ myToRemoveCentralPoint(DefaultToRemoveCentralPoint()),
+ myGradation(DefaultGradation()),
+ myLogInStandardOutput(DefaultStandardOutputLog()),
+ _enfVertexList(DefaultGHS3DEnforcedVertexList()),
+ _enfVertexCoordsSizeList(DefaultGHS3DEnforcedVertexCoordsValues()),
+ _enfVertexEntrySizeList(DefaultGHS3DEnforcedVertexEntryValues()),
+ _coordsEnfVertexMap(DefaultCoordsGHS3DEnforcedVertexMap()),
+ _geomEntryEnfVertexMap(DefaultGeomEntryGHS3DEnforcedVertexMap()),
+ _enfMeshList(DefaultGHS3DEnforcedMeshList()),
+ _entryEnfMeshMap(DefaultEntryGHS3DEnforcedMeshListMap()),
+ _enfNodes(TIDSortedNodeGroupMap()),
+ _enfEdges(TIDSortedElemGroupMap()),
+ _enfTriangles(TIDSortedElemGroupMap()),
+ _nodeIDToSizeMap(DefaultID2SizeMap()),
+ _groupsToRemove(DefaultGroupsToRemove())
+{
+ _name = "GHS3D_Parameters";
+ _param_algo_dim = 3;
+}
+
+//=======================================================================
+//function : SetToMeshHoles
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetToMeshHoles(bool toMesh)
+{
+ if ( myToMeshHoles != toMesh ) {
+ myToMeshHoles = toMesh;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetToMeshHoles
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::GetToMeshHoles(bool checkFreeOption) const
+{
+ if (checkFreeOption && !myTextOption.empty()) {
+ if ( myTextOption.find("-c 0"))
+ return true;
+ if ( myTextOption.find("-c 1"))
+ return false;
+ }
+ return myToMeshHoles;
+}
+
+//=======================================================================
+//function : SetToMakeGroupsOfDomains
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetToMakeGroupsOfDomains(bool toMakeGroups)
+{
+ if ( myToMakeGroupsOfDomains != toMakeGroups ) {
+ myToMakeGroupsOfDomains = toMakeGroups;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetToMakeGroupsOfDomains
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains() const
+{
+ return myToMakeGroupsOfDomains;
+}
+
+//=======================================================================
+//function : GetToMakeGroupsOfDomains
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains(const GHS3DPlugin_Hypothesis* hyp)
+{
+ bool res;
+ if ( hyp ) res = /*hyp->GetToMeshHoles(true) &&*/ hyp->GetToMakeGroupsOfDomains();
+ else res = /*DefaultMeshHoles() &&*/ DefaultToMakeGroupsOfDomains();
+ return res;
+}
+
+//=======================================================================
+//function : SetMaximumMemory
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetMaximumMemory(double MB)
+{
+ if ( myMaximumMemory != MB ) {
+ myMaximumMemory = MB;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetMaximumMemory
+// * automatic memory adjustment mode. Default is zero
+//=======================================================================
+
+double GHS3DPlugin_Hypothesis::GetMaximumMemory() const
+{
+ return myMaximumMemory;
+}
+
+//=======================================================================
+//function : SetInitialMemory
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetInitialMemory(double MB)
+{
+ if ( myInitialMemory != MB ) {
+ myInitialMemory = MB;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetInitialMemory
+//=======================================================================
+
+double GHS3DPlugin_Hypothesis::GetInitialMemory() const
+{
+ return myInitialMemory;
+}
+
+//=======================================================================
+//function : SetOptimizationLevel
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetOptimizationLevel(OptimizationLevel level)
+{
+ if ( myOptimizationLevel != level ) {
+ myOptimizationLevel = level;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetOptimizationLevel
+//=======================================================================
+
+GHS3DPlugin_Hypothesis::OptimizationLevel GHS3DPlugin_Hypothesis::GetOptimizationLevel() const
+{
+ return (OptimizationLevel) myOptimizationLevel;
+}
+
+//=======================================================================
+//function : SetWorkingDirectory
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetWorkingDirectory(const std::string& path)
+{
+ if ( myWorkingDirectory != path ) {
+ myWorkingDirectory = path;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetWorkingDirectory
+//=======================================================================
+
+std::string GHS3DPlugin_Hypothesis::GetWorkingDirectory() const
+{
+ return myWorkingDirectory;
+}
+
+//=======================================================================
+//function : SetKeepFiles
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetKeepFiles(bool toKeep)
+{
+ if ( myKeepFiles != toKeep ) {
+ myKeepFiles = toKeep;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetKeepFiles
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::GetKeepFiles() const
+{
+ return myKeepFiles;
+}
+
+//=======================================================================
+//function : SetVerboseLevel
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetVerboseLevel(short level)
+{
+ if ( myVerboseLevel != level ) {
+ myVerboseLevel = level;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetVerboseLevel
+//=======================================================================
+
+short GHS3DPlugin_Hypothesis::GetVerboseLevel() const
+{
+ return myVerboseLevel;
+}
+
+//=======================================================================
+//function : SetToCreateNewNodes
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetToCreateNewNodes(bool toCreate)
+{
+ if ( myToCreateNewNodes != toCreate ) {
+ myToCreateNewNodes = toCreate;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetToCreateNewNodes
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::GetToCreateNewNodes() const
+{
+ return myToCreateNewNodes;
+}
+
+//=======================================================================
+//function : SetToUseBoundaryRecoveryVersion
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetToUseBoundaryRecoveryVersion(bool toUse)
+{
+ if ( myToUseBoundaryRecoveryVersion != toUse ) {
+ myToUseBoundaryRecoveryVersion = toUse;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetToUseBoundaryRecoveryVersion
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::GetToUseBoundaryRecoveryVersion() const
+{
+ return myToUseBoundaryRecoveryVersion;
+}
+
+//=======================================================================
+//function : SetFEMCorrection
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetFEMCorrection(bool toUseFem)
+{
+ if ( myToUseFemCorrection != toUseFem ) {
+ myToUseFemCorrection = toUseFem;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetFEMCorrection
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::GetFEMCorrection() const
+{
+ return myToUseFemCorrection;
+}
+
+//=======================================================================
+//function : SetToRemoveCentralPoint
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetToRemoveCentralPoint(bool toRemove)
+{
+ if ( myToRemoveCentralPoint != toRemove ) {
+ myToRemoveCentralPoint = toRemove;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetToRemoveCentralPoint
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::GetToRemoveCentralPoint() const
+{
+ return myToRemoveCentralPoint;
+}
+
+//=======================================================================
+//function : SetTextOption
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetTextOption(const std::string& option)
+{
+ if ( myTextOption != option ) {
+ myTextOption = option;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetTextOption
+//=======================================================================
+
+std::string GHS3DPlugin_Hypothesis::GetTextOption() const
+{
+ return myTextOption;
+}
+
+//=======================================================================
+//function : SetGradation
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetGradation(double gradation)
+{
+ if ( myGradation != gradation ) {
+ myGradation = gradation;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetGradation
+//=======================================================================
+
+double GHS3DPlugin_Hypothesis::GetGradation() const
+{
+ return myGradation;
+}
+
+//=======================================================================
+//function : SetStandardOutputLog
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetStandardOutputLog(bool logInStandardOutput)
+{
+ if ( myLogInStandardOutput != logInStandardOutput ) {
+ myLogInStandardOutput = logInStandardOutput;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetStandardOutputLog
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::GetStandardOutputLog() const
+{
+ return myLogInStandardOutput;
+}
+
+//=======================================================================
+//function : SetRemoveLogOnSuccess
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::SetRemoveLogOnSuccess(bool removeLogOnSuccess)
+{
+ if ( myRemoveLogOnSuccess != removeLogOnSuccess ) {
+ myRemoveLogOnSuccess = removeLogOnSuccess;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetRemoveLogOnSuccess
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::GetRemoveLogOnSuccess() const
+{
+ return myRemoveLogOnSuccess;
+}
+
+//=======================================================================
+//function : SetEnforcedVertex
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string theEntry, std::string theGroupName,
+ double size, double x, double y, double z, bool isCompound)
+{
+ MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedVertex(\""<< theName << "\", \""<< theEntry << "\", \"" << theGroupName << "\", "
+ << size << ", " << x << ", " << y << ", " << z << ", "<< isCompound << ")");
+
+ bool toNotify = false;
+ bool toCreate = true;
+
+ TGHS3DEnforcedVertex *oldEnVertex;
+ TGHS3DEnforcedVertex *newEnfVertex = new TGHS3DEnforcedVertex();
+ newEnfVertex->name = theName;
+ newEnfVertex->geomEntry = theEntry;
+ newEnfVertex->coords.clear();
+ if (!isCompound) {
+ newEnfVertex->coords.push_back(x);
+ newEnfVertex->coords.push_back(y);
+ newEnfVertex->coords.push_back(z);
+ }
+ newEnfVertex->groupName = theGroupName;
+ newEnfVertex->size = size;
+ newEnfVertex->isCompound = isCompound;
+
+
+ // update _enfVertexList
+ TGHS3DEnforcedVertexList::iterator it = _enfVertexList.find(newEnfVertex);
+ if (it != _enfVertexList.end()) {
+ toCreate = false;
+ oldEnVertex = (*it);
+ MESSAGE("Enforced Vertex was found => Update");
+ if (oldEnVertex->name != theName) {
+ MESSAGE("Update name from \"" << oldEnVertex->name << "\" to \"" << theName << "\"");
+ oldEnVertex->name = theName;
+ toNotify = true;
+ }
+ if (oldEnVertex->groupName != theGroupName) {
+ MESSAGE("Update group name from \"" << oldEnVertex->groupName << "\" to \"" << theGroupName << "\"");
+ oldEnVertex->groupName = theGroupName;
+ toNotify = true;
+ }
+ if (oldEnVertex->size != size) {
+ MESSAGE("Update size from \"" << oldEnVertex->size << "\" to \"" << size << "\"");
+ oldEnVertex->size = size;
+ toNotify = true;
+ }
+ if (toNotify) {
+ // update map coords / enf vertex if needed
+ if (oldEnVertex->coords.size()) {
+ _coordsEnfVertexMap[oldEnVertex->coords] = oldEnVertex;
+ _enfVertexCoordsSizeList[oldEnVertex->coords] = size;
+ }
+
+ // update map geom entry / enf vertex if needed
+ if (oldEnVertex->geomEntry != "") {
+ _geomEntryEnfVertexMap[oldEnVertex->geomEntry] = oldEnVertex;
+ _enfVertexEntrySizeList[oldEnVertex->geomEntry] = size;
+ }
+ }
+ }
+
+// //////// CREATE ////////////
+ if (toCreate) {
+ toNotify = true;
+ MESSAGE("Creating new enforced vertex");
+ _enfVertexList.insert(newEnfVertex);
+ if (theEntry == "") {
+ _coordsEnfVertexMap[newEnfVertex->coords] = newEnfVertex;
+ _enfVertexCoordsSizeList[newEnfVertex->coords] = size;
+ }
+ else {
+ _geomEntryEnfVertexMap[newEnfVertex->geomEntry] = newEnfVertex;
+ _enfVertexEntrySizeList[newEnfVertex->geomEntry] = size;
+ }
+ }
+
+ if (toNotify)
+ NotifySubMeshesHypothesisModification();
+
+ MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedVertex END");
+ return toNotify;
+}
+
+
+//=======================================================================
+//function : SetEnforcedMesh
+//=======================================================================
+bool GHS3DPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
+{
+ TIDSortedElemSet theElemSet;
+ SMDS_ElemIteratorPtr eIt = theMesh.GetMeshDS()->elementsIterator(SMDSAbs_ElementType(elementType));
+ while ( eIt->more() )
+ theElemSet.insert( eIt->next() );
+ MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source mesh");
+ bool added = SetEnforcedElements( theElemSet, elementType, groupName);
+ if (added) {
+ TGHS3DEnforcedMesh* newEnfMesh = new TGHS3DEnforcedMesh();
+ newEnfMesh->persistID = theMesh.GetMeshDS()->GetPersistentId();
+ newEnfMesh->name = name;
+ newEnfMesh->entry = entry;
+ newEnfMesh->elementType = elementType;
+ newEnfMesh->groupName = groupName;
+
+ TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
+ if (it == _enfMeshList.end()) {
+ _entryEnfMeshMap[entry].insert(newEnfMesh);
+ _enfMeshList.insert(newEnfMesh);
+ }
+ else {
+ delete newEnfMesh;
+ }
+ }
+ return added;
+}
+
+//=======================================================================
+//function : SetEnforcedGroup
+//=======================================================================
+bool GHS3DPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
+{
+ MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedGroup");
+ TIDSortedElemSet theElemSet;
+ if ( theIDs->length() == 0 ){MESSAGE("The source group is empty");}
+ for (int i=0; i < theIDs->length(); i++) {
+ CORBA::Long ind = theIDs[i];
+ if (elementType == SMESH::NODE)
+ {
+ const SMDS_MeshNode * node = theMeshDS->FindNode(ind);
+ if (node)
+ theElemSet.insert( node );
+ }
+ else
+ {
+ const SMDS_MeshElement * elem = theMeshDS->FindElement(ind);
+ if (elem)
+ theElemSet.insert( elem );
+ }
+ }
+
+// SMDS_ElemIteratorPtr it = theGroup->GetGroupDS()->GetElements();
+// while ( it->more() )
+// theElemSet.insert( it->next() );
+
+ MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source group ");
+ bool added = SetEnforcedElements( theElemSet, elementType, groupName);
+ if (added) {
+ TGHS3DEnforcedMesh* newEnfMesh = new TGHS3DEnforcedMesh();
+ newEnfMesh->name = name;
+ newEnfMesh->entry = entry;
+ newEnfMesh->elementType = elementType;
+ newEnfMesh->groupName = groupName;
+
+ TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
+ if (it == _enfMeshList.end()) {
+ _entryEnfMeshMap[entry].insert(newEnfMesh);
+ _enfMeshList.insert(newEnfMesh);
+ }
+ }
+ return added;
+}
+
+//=======================================================================
+//function : SetEnforcedElements
+//=======================================================================
+bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName)
+{
+ MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedElements");
+ TIDSortedElemSet::const_iterator it = theElemSet.begin();
+ const SMDS_MeshElement* elem;
+ const SMDS_MeshNode* node;
+ bool added = true;
+ pair<TIDSortedNodeGroupMap::iterator,bool> nodeRet;
+ pair<TIDSortedElemGroupMap::iterator,bool> elemRet;
+
+ for (;it != theElemSet.end();++it)
+ {
+ elem = (*it);
+ switch (elementType) {
+ case SMESH::NODE:
+ node = dynamic_cast<const SMDS_MeshNode*>(elem);
+ if (node) {
+ nodeRet = _enfNodes.insert(make_pair(node,groupName));
+ added = added && nodeRet.second;
+ string msg = added ? "yes":"no";
+ MESSAGE( "Node (" <<node->X()<<","<<node->Y()<<","<<node->Z()<< ") with ID " << node->GetID() <<" added ? " << msg);
+ }
+ else {
+ SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
+ for (;nodeIt->more();) {
+ node = dynamic_cast<const SMDS_MeshNode*>(nodeIt->next());
+ nodeRet = _enfNodes.insert(make_pair(node,groupName));
+ added = added && nodeRet.second;
+ }
+// added = true;s
+ }
+ break;
+ case SMESH::EDGE:
+ if (elem->GetType() == SMDSAbs_Edge) {
+ elemRet = _enfEdges.insert(make_pair(elem,groupName));
+ added = added && elemRet.second;
+ }
+ else if (elem->GetType() > SMDSAbs_Edge) {
+ SMDS_ElemIteratorPtr it = elem->edgesIterator();
+ for (;it->more();) {
+ const SMDS_MeshElement* anEdge = it->next();
+ elemRet = _enfEdges.insert(make_pair(anEdge,groupName));
+ added = added && elemRet.second;
+ }
+ }
+ break;
+ case SMESH::FACE:
+ if (elem->GetType() == SMDSAbs_Face)
+ {
+ if (elem->NbCornerNodes() == 3) {
+ elemRet = _enfTriangles.insert(make_pair(elem,groupName));
+ added = added && elemRet.second;
+ }
+ }
+ else if (elem->GetType() > SMDSAbs_Face) { // Group of faces
+ SMDS_ElemIteratorPtr it = elem->facesIterator();
+ for (;it->more();) {
+ const SMDS_MeshElement* aFace = it->next();
+ if (aFace->NbCornerNodes() == 3) {
+ elemRet = _enfTriangles.insert(make_pair(aFace,groupName));
+ added = added && elemRet.second;
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ };
+ }
+ if (added)
+ NotifySubMeshesHypothesisModification();
+ return added;
+}
+
+
+//=======================================================================
+//function : GetEnforcedVertex
+//=======================================================================
+
+GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* GHS3DPlugin_Hypothesis::GetEnforcedVertex(double x, double y, double z)
+ throw (std::invalid_argument)
+{
+ std::vector<double> coord(3);
+ coord[0] = x;
+ coord[1] = y;
+ coord[2] = z;
+ if (_coordsEnfVertexMap.count(coord)>0)
+ return _coordsEnfVertexMap[coord];
+ std::ostringstream msg ;
+ msg << "No enforced vertex at " << x << ", " << y << ", " << z;
+ throw std::invalid_argument(msg.str());
+}
+
+GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* GHS3DPlugin_Hypothesis::GetEnforcedVertex(const std::string theEntry)
+ throw (std::invalid_argument)
+{
+ if (_geomEntryEnfVertexMap.count(theEntry)>0)
+ return _geomEntryEnfVertexMap[theEntry];
+
+ std::ostringstream msg ;
+ msg << "No enforced vertex with entry " << theEntry;
+ throw std::invalid_argument(msg.str());
+}
+
+//=======================================================================
+//function : RemoveEnforcedVertex
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::RemoveEnforcedVertex(double x, double y, double z, const std::string theEntry)
+ throw (std::invalid_argument)
+{
+ bool toNotify = false;
+ std::ostringstream msg;
+ TGHS3DEnforcedVertex *oldEnfVertex;
+ std::vector<double> coords(3);
+ coords[0] = x;
+ coords[1] = y;
+ coords[2] = z;
+
+ // check that enf vertex with given enf vertex entry exists
+ TGeomEntryGHS3DEnforcedVertexMap::iterator it_enfVertexEntry = _geomEntryEnfVertexMap.find(theEntry);
+ if (it_enfVertexEntry != _geomEntryEnfVertexMap.end()) {
+ // Success
+ MESSAGE("Found enforced vertex with geom entry " << theEntry);
+ oldEnfVertex = it_enfVertexEntry->second;
+ _geomEntryEnfVertexMap.erase(it_enfVertexEntry);
+ } else {
+ // Fail
+ MESSAGE("Enforced vertex with geom entry " << theEntry << " not found");
+ // check that enf vertex with given coords exists
+ TCoordsGHS3DEnforcedVertexMap::iterator it_coords_enf = _coordsEnfVertexMap.find(coords);
+ if (it_coords_enf != _coordsEnfVertexMap.end()) {
+ // Success
+ MESSAGE("Found enforced vertex with coords " << x << ", " << y << ", " << z);
+ oldEnfVertex = it_coords_enf->second;
+ _coordsEnfVertexMap.erase(it_coords_enf);
+ _enfVertexCoordsSizeList.erase(_enfVertexCoordsSizeList.find(coords));
+ } else {
+ // Fail
+ MESSAGE("Enforced vertex with coords " << x << ", " << y << ", " << z << " not found");
+ throw std::invalid_argument(msg.str());
+ }
+ }
+
+ MESSAGE("Remove enf vertex from _enfVertexList");
+
+ // update _enfVertexList
+ TGHS3DEnforcedVertexList::iterator it = _enfVertexList.find(oldEnfVertex);
+ if (it != _enfVertexList.end()) {
+ if ((*it)->groupName != "")
+ _groupsToRemove.insert((*it)->groupName);
+ _enfVertexList.erase(it);
+ toNotify = true;
+ MESSAGE("Done");
+ }
+
+ if (toNotify)
+ NotifySubMeshesHypothesisModification();
+
+ return toNotify;
+}
+
+//=======================================================================
+//function : ClearEnforcedVertices
+//=======================================================================
+void GHS3DPlugin_Hypothesis::ClearEnforcedVertices()
+{
+ TGHS3DEnforcedVertexList::const_iterator it = _enfVertexList.begin();
+ for(;it != _enfVertexList.end();++it) {
+ if ((*it)->groupName != "")
+ _groupsToRemove.insert((*it)->groupName);
+ }
+ _enfVertexList.clear();
+ _coordsEnfVertexMap.clear();
+ _geomEntryEnfVertexMap.clear();
+ _enfVertexCoordsSizeList.clear();
+ _enfVertexEntrySizeList.clear();
+ NotifySubMeshesHypothesisModification();
+}
+
+//=======================================================================
+//function : ClearEnforcedMeshes
+//=======================================================================
+void GHS3DPlugin_Hypothesis::ClearEnforcedMeshes()
+{
+ TGHS3DEnforcedMeshList::const_iterator it = _enfMeshList.begin();
+ for(;it != _enfMeshList.end();++it) {
+ if ((*it)->groupName != "")
+ _groupsToRemove.insert((*it)->groupName);
+ }
+ _enfNodes.clear();
+ _enfEdges.clear();
+ _enfTriangles.clear();
+ _nodeIDToSizeMap.clear();
+ _enfMeshList.clear();
+ _entryEnfMeshMap.clear();
+ NotifySubMeshesHypothesisModification();
+}
+
+//================================================================================
+/*!
+ * \brief At mesh loading, restore enforced elements by just loaded enforced meshes
+ */
+//================================================================================
+
+void GHS3DPlugin_Hypothesis::RestoreEnfElemsByMeshes()
+{
+ TGHS3DEnforcedMeshList::const_iterator it = _enfMeshList.begin();
+ for(;it != _enfMeshList.end();++it) {
+ TGHS3DEnforcedMesh* enfMesh = *it;
+ if ( SMESH_Mesh* mesh = GetMeshByPersistentID( enfMesh->persistID ))
+ SetEnforcedMesh( *mesh,
+ enfMesh->elementType,
+ enfMesh->name,
+ enfMesh->entry,
+ enfMesh->groupName );
+ enfMesh->persistID = -1; // not to restore again
+ }
+}
+
+//=======================================================================
+//function : SetGroupsToRemove
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis::ClearGroupsToRemove()
+{
+ _groupsToRemove.clear();
+}
+
+
+//=======================================================================
+//function : DefaultMeshHoles
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::DefaultMeshHoles()
+{
+ return false; // PAL19680
+}
+
+//=======================================================================
+//function : DefaultToMakeGroupsOfDomains
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::DefaultToMakeGroupsOfDomains()
+{
+ return false; // issue 0022172
+}
+
+//=======================================================================
+//function : DefaultMaximumMemory
+//=======================================================================
+
+#ifndef WIN32
+#include <sys/sysinfo.h>
+#else
+#include <windows.h>
+#endif
+
+double GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
+{
+#ifndef WIN32
+ struct sysinfo si;
+ int err = sysinfo( &si );
+ if ( err == 0 ) {
+ int ramMB = si.totalram * si.mem_unit / 1024 / 1024;
+ return ( 0.7 * ramMB );
+ }
+#else
+ // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
+ MEMORYSTATUSEX statex;
+ statex.dwLength = sizeof (statex);
+ int err = GlobalMemoryStatusEx (&statex);
+ if (err != 0) {
+ int totMB =
+ statex.ullTotalPhys / 1024 / 1024 +
+ statex.ullTotalPageFile / 1024 / 1024 +
+ statex.ullTotalVirtual / 1024 / 1024;
+ return ( 0.7 * totMB );
+ }
+#endif
+ return 1024;
+}
+
+//=======================================================================
+//function : DefaultInitialMemory
+//=======================================================================
+
+double GHS3DPlugin_Hypothesis::DefaultInitialMemory()
+{
+ return DefaultMaximumMemory();
+}
+
+//=======================================================================
+//function : DefaultOptimizationLevel
+//=======================================================================
+
+short GHS3DPlugin_Hypothesis::DefaultOptimizationLevel()
+{
+ return Medium;
+}
+
+//=======================================================================
+//function : DefaultWorkingDirectory
+//=======================================================================
+
+std::string GHS3DPlugin_Hypothesis::DefaultWorkingDirectory()
+{
+ TCollection_AsciiString aTmpDir;
+
+ char *Tmp_dir = getenv("SALOME_TMP_DIR");
+ if(Tmp_dir != NULL) {
+ aTmpDir = Tmp_dir;
+ }
+ else {
+#ifdef WIN32
+ aTmpDir = TCollection_AsciiString("C:\\");
+#else
+ aTmpDir = TCollection_AsciiString("/tmp/");
+#endif
+ }
+ return aTmpDir.ToCString();
+}
+
+//=======================================================================
+//function : DefaultKeepFiles
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::DefaultKeepFiles()
+{
+ return false;
+}
+
+//=======================================================================
+//function : DefaultRemoveLogOnSuccess
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::DefaultRemoveLogOnSuccess()
+{
+ return false;
+}
+
+
+//=======================================================================
+//function : DefaultVerboseLevel
+//=======================================================================
+
+short GHS3DPlugin_Hypothesis::DefaultVerboseLevel()
+{
+ return 10;
+}
+
+//=======================================================================
+//function : DefaultToCreateNewNodes
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::DefaultToCreateNewNodes()
+{
+ return true;
+}
+
+//=======================================================================
+//function : DefaultToUseBoundaryRecoveryVersion
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::DefaultToUseBoundaryRecoveryVersion()
+{
+ return false;
+}
+
+//=======================================================================
+//function : DefaultToUseFEMCorrection
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::DefaultToUseFEMCorrection()
+{
+ return false;
+}
+
+//=======================================================================
+//function : DefaultToRemoveCentralPoint
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::DefaultToRemoveCentralPoint()
+{
+ return false;
+}
+
+//=======================================================================
+//function : DefaultGradation
+//=======================================================================
+
+double GHS3DPlugin_Hypothesis::DefaultGradation()
+{
+ return 1.05;
+}
+
+//=======================================================================
+//function : DefaultStandardOutputLog
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::DefaultStandardOutputLog()
+{
+ return false;
+}
+
+// //=======================================================================
+// //function : DefaultID2SizeMap
+// //=======================================================================
+//
+// GHS3DPlugin_Hypothesis::TID2SizeMap GHS3DPlugin_Hypothesis::DefaultID2SizeMap()
+// {
+// return GHS3DPlugin_Hypothesis::TID2SizeMap();
+// }
+
+
+//=======================================================================
+//function : SaveTo
+//=======================================================================
+
+std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save)
+{
+ save << (int) myToMeshHoles << " ";
+ save << myMaximumMemory << " ";
+ save << myInitialMemory << " ";
+ save << myOptimizationLevel << " ";
+ save << myWorkingDirectory << " ";
+ save << (int)myKeepFiles << " ";
+ save << myVerboseLevel << " ";
+ save << (int)myToCreateNewNodes << " ";
+ save << (int)myToUseBoundaryRecoveryVersion << " ";
+ save << (int)myToUseFemCorrection << " ";
+ save << (int)myToRemoveCentralPoint << " ";
+ save << myGradation << " ";
+ save << myToMakeGroupsOfDomains << " ";
+ if (!myTextOption.empty()) {
+ save << "__OPTIONS_BEGIN__ ";
+ save << myTextOption << " ";
+ save << "__OPTIONS_END__ ";
+ }
+
+
+ TGHS3DEnforcedVertexList::iterator it = _enfVertexList.begin();
+ if (it != _enfVertexList.end()) {
+ save << " " << "__ENFORCED_VERTICES_BEGIN__ ";
+ for ( ; it != _enfVertexList.end(); ++it ) {
+ TGHS3DEnforcedVertex *enfVertex = (*it);
+ save << " " << "__BEGIN_VERTEX__";
+ if (!enfVertex->name.empty()) {
+ save << " " << "__BEGIN_NAME__";
+ save << " " << enfVertex->name;
+ save << " " << "__END_NAME__";
+ }
+ if (!enfVertex->geomEntry.empty()) {
+ save << " " << "__BEGIN_ENTRY__";
+ save << " " << enfVertex->geomEntry;
+ save << " " << enfVertex->isCompound;
+ save << " " << "__END_ENTRY__";
+ }
+ if (!enfVertex->groupName.empty()) {
+ save << " " << "__BEGIN_GROUP__";
+ save << " " << enfVertex->groupName;
+ save << " " << "__END_GROUP__";
+ }
+ if (enfVertex->coords.size()) {
+ save << " " << "__BEGIN_COORDS__";
+ for (int i=0;i<enfVertex->coords.size();i++)
+ save << " " << enfVertex->coords[i];
+ save << " " << "__END_COORDS__";
+ }
+ save << " " << "__BEGIN_SIZE__";
+ save << " " << enfVertex->size;
+ save << " " << "__END_SIZE__";
+ save << " " << "__END_VERTEX__";
+ }
+ save << " " << "__ENFORCED_VERTICES_END__ ";
+ }
+
+ TGHS3DEnforcedMeshList::iterator it_mesh = _enfMeshList.begin();
+ if (it_mesh != _enfMeshList.end()) {
+ save << " " << "__ENFORCED_MESHES_BEGIN__ ";
+ for ( ; it_mesh != _enfMeshList.end(); ++it_mesh ) {
+ TGHS3DEnforcedMesh *enfMesh = (*it_mesh);
+ save << " " << "__BEGIN_ENF_MESH__";
+
+ save << " " << "__BEGIN_NAME__";
+ save << " " << enfMesh->name;
+ save << " " << "__END_NAME__";
+
+ save << " " << "__BEGIN_ENTRY__";
+ save << " " << enfMesh->entry;
+ save << " " << "__END_ENTRY__";
+
+ save << " " << "__BEGIN_ELEM_TYPE__";
+ save << " " << (int)enfMesh->elementType;
+ save << " " << "__END_ELEM_TYPE__";
+
+ if (!enfMesh->groupName.empty()) {
+ save << " " << "__BEGIN_GROUP__";
+ save << " " << enfMesh->groupName;
+ save << " " << "__END_GROUP__";
+ }
+ save << " " << "__PERSIST_ID__";
+ save << " " << enfMesh->persistID;
+ save << " " << "__END_ENF_MESH__";
+ std::cout << "Saving of enforced mesh " << enfMesh->name.c_str() << " done" << std::endl;
+ }
+ save << " " << "__ENFORCED_MESHES_END__ ";
+ }
+ return save;
+}
+
+//=======================================================================
+//function : LoadFrom
+//=======================================================================
+
+std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load)
+{
+ bool isOK = true;
+ int i;
+ double d;
+
+ isOK = (load >> i);
+ if (isOK)
+ myToMeshHoles = i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> d);
+ if (isOK)
+ myMaximumMemory = d;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> d);
+ if (isOK)
+ myInitialMemory = d;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myOptimizationLevel = i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> myWorkingDirectory);
+ if (isOK) {
+ if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty
+ myKeepFiles = false;
+ myWorkingDirectory.clear();
+ }
+ else if ( myWorkingDirectory == "1" ) {
+ myKeepFiles = true;
+ myWorkingDirectory.clear();
+ }
+ }
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ if ( !myWorkingDirectory.empty() ) {
+ isOK = (load >> i);
+ if (isOK)
+ myKeepFiles = i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+ }
+
+ isOK = (load >> i);
+ if (isOK)
+ myVerboseLevel = (short) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myToCreateNewNodes = (bool) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myToUseBoundaryRecoveryVersion = (bool) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myToUseFemCorrection = (bool) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myToRemoveCentralPoint = (bool) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> d);
+ if (isOK)
+ myGradation = d;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ std::string separator;
+ bool hasOptions = false;
+ bool hasEnforcedVertices = false;
+ bool hasEnforcedMeshes = false;
+ isOK = (load >> separator);
+
+ if ( isOK && ( separator == "0" || separator == "1" ))
+ {
+ myToMakeGroupsOfDomains = ( separator == "1" );
+ isOK = (load >> separator);
+ }
+
+ if (isOK) {
+ if (separator == "__OPTIONS_BEGIN__")
+ hasOptions = true;
+ else if (separator == "__ENFORCED_VERTICES_BEGIN__")
+ hasEnforcedVertices = true;
+ else if (separator == "__ENFORCED_MESHES_BEGIN__")
+ hasEnforcedMeshes = true;
+ }
+
+ if (hasOptions) {
+ std::string txt;
+ while (isOK) {
+ isOK = (load >> txt);
+ if (isOK) {
+ if (txt == "__OPTIONS_END__") {
+ if (!myTextOption.empty()) {
+ // Remove last space
+ myTextOption.erase(myTextOption.end()-1);
+ }
+ isOK = false;
+ break;
+ }
+ myTextOption += txt;
+ myTextOption += " ";
+ }
+ }
+ }
+
+ if (hasOptions) {
+ isOK = (load >> separator);
+ if (isOK && separator == "__ENFORCED_VERTICES_BEGIN__")
+ hasEnforcedVertices = true;
+ if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
+ hasEnforcedMeshes = true;
+ }
+
+ if (hasEnforcedVertices) {
+ std::string txt, name, entry, groupName;
+ double size, coords[3];
+ bool isCompound;
+ bool hasCoords = false;
+ isOK = (load >> txt); // __BEGIN_VERTEX__
+ while (isOK) {
+ if (txt == "__ENFORCED_VERTICES_END__")
+ isOK = false;
+
+ TGHS3DEnforcedVertex *enfVertex = new TGHS3DEnforcedVertex();
+ while (isOK) {
+ isOK = (load >> txt);
+ if (txt == "__END_VERTEX__") {
+ enfVertex->name = name;
+ enfVertex->geomEntry = entry;
+ enfVertex->isCompound = isCompound;
+ enfVertex->groupName = groupName;
+ enfVertex->coords.clear();
+ if (hasCoords)
+ enfVertex->coords.assign(coords,coords+3);
+
+ _enfVertexList.insert(enfVertex);
+
+ if (enfVertex->coords.size())
+ _coordsEnfVertexMap[enfVertex->coords] = enfVertex;
+ if (!enfVertex->geomEntry.empty())
+ _geomEntryEnfVertexMap[enfVertex->geomEntry] = enfVertex;
+
+ name.clear();
+ entry.clear();
+ groupName.clear();
+ hasCoords = false;
+ isOK = false;
+ }
+
+ if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
+ while (isOK && (txt != "__END_NAME__")) {
+ isOK = (load >> txt);
+ if (txt != "__END_NAME__") {
+ if (!name.empty())
+ name += " ";
+ name += txt;
+ }
+ }
+ MESSAGE("name: " <<name);
+ }
+
+ if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
+ isOK = (load >> entry);
+ isOK = (load >> isCompound);
+ isOK = (load >> txt); // __END_ENTRY__
+ if (txt != "__END_ENTRY__")
+ throw std::exception();
+ MESSAGE("entry: " << entry);
+ }
+
+ if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
+ while (isOK && (txt != "__END_GROUP__")) {
+ isOK = (load >> txt);
+ if (txt != "__END_GROUP__") {
+ if (!groupName.empty())
+ groupName += " ";
+ groupName += txt;
+ }
+ }
+ MESSAGE("groupName: " << groupName);
+ }
+
+ if (txt == "__BEGIN_COORDS__") { // __BEGIN_COORDS__
+ hasCoords = true;
+ isOK = (load >> coords[0] >> coords[1] >> coords[2]);
+ isOK = (load >> txt); // __END_COORDS__
+ if (txt != "__END_COORDS__")
+ throw std::exception();
+ MESSAGE("coords: " << coords[0] <<","<< coords[1] <<","<< coords[2]);
+ }
+
+ if (txt == "__BEGIN_SIZE__") { // __BEGIN_ENTRY__
+ isOK = (load >> size);
+ isOK = (load >> txt); // __END_ENTRY__
+ if (txt != "__END_SIZE__") {
+ throw std::exception();
+ }
+ MESSAGE("size: " << size);
+ }
+ }
+ isOK = (load >> txt); // __BEGIN_VERTEX__
+ }
+ }
+
+ if (hasEnforcedVertices) {
+ isOK = (load >> separator);
+ if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
+ hasEnforcedMeshes = true;
+ }
+
+ if (hasEnforcedMeshes) {
+ std::string txt, name, entry, groupName;
+ int elementType = -1, persistID = -1;
+ isOK = (load >> txt); // __BEGIN_ENF_MESH__
+ while (isOK) {
+ // if (isOK) {
+ if (txt == "__ENFORCED_MESHES_END__")
+ isOK = false;
+
+ TGHS3DEnforcedMesh *enfMesh = new TGHS3DEnforcedMesh();
+ while (isOK) {
+ isOK = (load >> txt);
+ if (txt == "__END_ENF_MESH__") {
+ enfMesh->name = name;
+ enfMesh->entry = entry;
+ enfMesh->elementType = (SMESH::ElementType)elementType;
+ enfMesh->groupName = groupName;
+ enfMesh->persistID = persistID;
+
+ _enfMeshList.insert(enfMesh);
+ std::cout << "Restoring of enforced mesh " <<name << " done" << std::endl;
+
+ name.clear();
+ entry.clear();
+ elementType = -1;
+ groupName.clear();
+ persistID = -1;
+ isOK = false;
+ }
+
+ if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
+ while (isOK && (txt != "__END_NAME__")) {
+ isOK = (load >> txt);
+ if (txt != "__END_NAME__") {
+ if (!name.empty())
+ name += " ";
+ name += txt;
+ }
+ }
+ MESSAGE("name: " <<name);
+ }
+
+ if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
+ isOK = (load >> entry);
+ isOK = (load >> txt); // __END_ENTRY__
+ if (txt != "__END_ENTRY__")
+ throw std::exception();
+ MESSAGE("entry: " << entry);
+ }
+
+ if (txt == "__BEGIN_ELEM_TYPE__") { // __BEGIN_ELEM_TYPE__
+ isOK = (load >> elementType);
+ isOK = (load >> txt); // __END_ELEM_TYPE__
+ if (txt != "__END_ELEM_TYPE__")
+ throw std::exception();
+ MESSAGE("elementType: " << elementType);
+ }
+
+ if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
+ while (isOK && (txt != "__END_GROUP__")) {
+ isOK = (load >> txt);
+ if (txt != "__END_GROUP__") {
+ if (!groupName.empty())
+ groupName += " ";
+ groupName += txt;
+ }
+ } // while
+ MESSAGE("groupName: " << groupName);
+ } // if
+
+ if (txt == "__PERSIST_ID__") {
+ isOK = (load >> persistID);
+ MESSAGE("persistID: " << persistID);
+ }
+ std::cout << "isOK: " << isOK << std::endl;
+ } // while
+ // } // if
+ isOK = (load >> txt); // __BEGIN_ENF_MESH__
+ } // while
+ } // if
+
+ return load;
+}
+
+//=======================================================================
+//function : SetParametersByMesh
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* ,const TopoDS_Shape&)
+{
+ return false;
+}
+
+
+//================================================================================
+/*!
+ * \brief Sets myToMakeGroupsOfDomains depending on whether theMesh is on shape or not
+ */
+//================================================================================
+
+bool GHS3DPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& dflts,
+ const SMESH_Mesh* /*theMesh*/)
+{
+ myToMakeGroupsOfDomains = ( !dflts._shape || dflts._shape->IsNull() );
+ return true;
+}
+
+//================================================================================
+/*!
+ * \brief Return command to run ghs3d mesher excluding file prefix (-f)
+ */
+//================================================================================
+
+std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
+ const bool hasShapeToMesh)
+{
+ TCollection_AsciiString cmd = GetExeName().c_str();
+ // check if any option is overridden by hyp->myTextOption
+ bool m = hyp ? ( hyp->myTextOption.find("-m") == std::string::npos ) : true;
+ bool M = hyp ? ( hyp->myTextOption.find("-M") == std::string::npos ) : true;
+ bool c = hyp ? ( hyp->myTextOption.find("-c") == std::string::npos ) : true;
+ bool o = hyp ? ( hyp->myTextOption.find("-o") == std::string::npos ) : true;
+ bool p0 = hyp ? ( hyp->myTextOption.find("-p0") == std::string::npos ) : true;
+ bool C = hyp ? ( hyp->myTextOption.find("-C") == std::string::npos ) : true;
+ bool v = hyp ? ( hyp->myTextOption.find("-v") == std::string::npos ) : true;
+ bool fem = hyp ? ( hyp->myTextOption.find("-FEM")== std::string::npos ) : true;
+ bool rem = hyp ? ( hyp->myTextOption.find("-no_initial_central_point")== std::string::npos ) : true;
+ bool gra = hyp ? ( hyp->myTextOption.find("-Dcpropa")== std::string::npos ) : true;
+
+ // if use boundary recovery version, few options are allowed
+ bool useBndRecovery = !C;
+ if ( !useBndRecovery && hyp )
+ useBndRecovery = hyp->myToUseBoundaryRecoveryVersion;
+
+ // ghs3d needs to know amount of memory it may use (MB).
+ // Default memory is defined at ghs3d installation but it may be not enough,
+ // so allow to use about all available memory
+ if ( m ) {
+ double aMaximumMemory = hyp ? hyp->myMaximumMemory : -1;
+ cmd += " -m ";
+ if ( aMaximumMemory < 0 )
+ cmd += DefaultMaximumMemory();
+ else
+ cmd += aMaximumMemory;
+ }
+ if ( M && !useBndRecovery ) {
+ double aInitialMemory = hyp ? hyp->myInitialMemory : -1;
+ cmd += " -M ";
+ if ( aInitialMemory > 0 )
+ cmd += aInitialMemory;
+ else
+ cmd += "100";
+ }
+ // component to mesh
+ // 0 , all components to be meshed
+ // 1 , only the main ( outermost ) component to be meshed
+ if ( c && !useBndRecovery ) {
+ // We always run GHS3D with "to mesh holes'==TRUE (see PAL19680)
+ if ( hasShapeToMesh )
+ cmd += " -c 0";
+ else {
+ bool aToMeshHoles = hyp ? hyp->myToMeshHoles : DefaultMeshHoles();
+ if ( aToMeshHoles )
+ cmd += " -c 0";
+ else
+ cmd += " -c 1";
+ }
+ }
+
+ // optimization level
+ if ( o && hyp && !useBndRecovery ) {
+ if ( hyp->myOptimizationLevel >= 0 && hyp->myOptimizationLevel < 5 ) {
+ const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
+ cmd += " -o ";
+ cmd += level[ hyp->myOptimizationLevel ];
+ }
+ }
+
+ // to create internal nodes
+ if ( p0 && hyp && !hyp->myToCreateNewNodes ) {
+ cmd += " -p0";
+ }
+
+ // verbose mode
+ if ( v && hyp ) {
+ cmd += " -v ";
+ cmd += hyp->myVerboseLevel;
+ }
+
+ // boundary recovery version
+ if ( useBndRecovery ) {
+ cmd += " -C";
+ }
+
+ // to use FEM correction
+ if ( fem && hyp && hyp->myToUseFemCorrection) {
+ cmd += " -FEM";
+ }
+
+ // to remove initial central point.
+ if ( rem && hyp && hyp->myToRemoveCentralPoint) {
+ cmd += " -no_initial_central_point";
+ }
+
+ // options as text
+ if ( hyp && !hyp->myTextOption.empty() ) {
+ cmd += " ";
+ cmd += (char*) hyp->myTextOption.c_str();
+ }
+
+ // to define volumic gradation.
+ if ( gra && hyp) {
+ cmd += " -Dcpropa=";
+ cmd += hyp->myGradation;
+ }
+
+#ifdef WIN32
+ cmd += " < NUL";
+#endif
+
+ return cmd.ToCString();
+}
+
+//================================================================================
+/*!
+ * \brief Return a unique file name
+ */
+//================================================================================
+
+std::string GHS3DPlugin_Hypothesis::GetFileName(const GHS3DPlugin_Hypothesis* hyp)
+{
+ std::string aTmpDir = hyp ? hyp->GetWorkingDirectory() : DefaultWorkingDirectory();
+ const char lastChar = *aTmpDir.rbegin();
+#ifdef WIN32
+ if(lastChar != '\\') aTmpDir+='\\';
+#else
+ if(lastChar != '/') aTmpDir+='/';
+#endif
+
+ TCollection_AsciiString aGenericName = (char*)aTmpDir.c_str();
+ aGenericName += "GHS3D_";
+ aGenericName += getpid();
+ aGenericName += "_";
+ aGenericName += Abs((Standard_Integer)(long) aGenericName.ToCString());
+
+ return aGenericName.ToCString();
+}
+
+//================================================================================
+/*
+ * Return the name of executable
+ */
+//================================================================================
+
+std::string GHS3DPlugin_Hypothesis::GetExeName()
+{
+ return "mg-tetra.exe";
+}
+
+//================================================================================
+/*!
+* \brief Return the enforced vertices
+*/
+//================================================================================
+
+GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList GHS3DPlugin_Hypothesis::GetEnforcedVertices(const GHS3DPlugin_Hypothesis* hyp)
+{
+ return hyp ? hyp->_GetEnforcedVertices():DefaultGHS3DEnforcedVertexList();
+}
+
+GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues GHS3DPlugin_Hypothesis::GetEnforcedVerticesCoordsSize (const GHS3DPlugin_Hypothesis* hyp)
+{
+ return hyp ? hyp->_GetEnforcedVerticesCoordsSize(): DefaultGHS3DEnforcedVertexCoordsValues();
+}
+
+GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexEntryValues GHS3DPlugin_Hypothesis::GetEnforcedVerticesEntrySize (const GHS3DPlugin_Hypothesis* hyp)
+{
+ return hyp ? hyp->_GetEnforcedVerticesEntrySize(): DefaultGHS3DEnforcedVertexEntryValues();
+}
+
+GHS3DPlugin_Hypothesis::TCoordsGHS3DEnforcedVertexMap GHS3DPlugin_Hypothesis::GetEnforcedVerticesByCoords (const GHS3DPlugin_Hypothesis* hyp)
+{
+ return hyp ? hyp->_GetEnforcedVerticesByCoords(): DefaultCoordsGHS3DEnforcedVertexMap();
+}
+
+GHS3DPlugin_Hypothesis::TGeomEntryGHS3DEnforcedVertexMap GHS3DPlugin_Hypothesis::GetEnforcedVerticesByEntry (const GHS3DPlugin_Hypothesis* hyp)
+{
+ return hyp ? hyp->_GetEnforcedVerticesByEntry(): DefaultGeomEntryGHS3DEnforcedVertexMap();
+}
+
+GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap GHS3DPlugin_Hypothesis::GetEnforcedNodes(const GHS3DPlugin_Hypothesis* hyp)
+{
+ return hyp ? hyp->_GetEnforcedNodes():DefaultIDSortedNodeGroupMap();
+}
+
+GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap GHS3DPlugin_Hypothesis::GetEnforcedEdges(const GHS3DPlugin_Hypothesis* hyp)
+{
+ return hyp ? hyp->_GetEnforcedEdges():DefaultIDSortedElemGroupMap();
+}
+
+GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap GHS3DPlugin_Hypothesis::GetEnforcedTriangles(const GHS3DPlugin_Hypothesis* hyp)
+{
+ return hyp ? hyp->_GetEnforcedTriangles():DefaultIDSortedElemGroupMap();
+}
+
+GHS3DPlugin_Hypothesis::TID2SizeMap GHS3DPlugin_Hypothesis::GetNodeIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp)
+{
+ return hyp ? hyp->_GetNodeIDToSizeMap(): DefaultID2SizeMap();
+}
+
+GHS3DPlugin_Hypothesis::TSetStrings GHS3DPlugin_Hypothesis::GetGroupsToRemove(const GHS3DPlugin_Hypothesis* hyp)
+{
+ return hyp ? hyp->_GetGroupsToRemove(): DefaultGroupsToRemove();
+}
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// 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
+//
+
+// GHS3DPlugin : C++ implementation
+// File : GHS3DPlugin_Hypothesis.hxx
+// Created : Wed Apr 2 12:21:17 2008
+// Author : Edward AGAPOV (eap)
+//
+#ifndef GHS3DPlugin_Hypothesis_HeaderFile
+#define GHS3DPlugin_Hypothesis_HeaderFile
+
+#include "GHS3DPlugin_Defs.hxx"
+
+#include <SMDS_MeshNode.hxx>
+
+#include "SMESH_Hypothesis.hxx"
+#include "SMESH_Mesh_i.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_TypeDefs.hxx"
+#include "utilities.h"
+
+#include <stdexcept>
+#include <map>
+#include <vector>
+#include <cstdio>
+
+class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis: public SMESH_Hypothesis
+{
+public:
+
+ GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
+
+ typedef std::map<std::vector<double>,double> TGHS3DEnforcedVertexCoordsValues;
+ typedef std::map<std::string,double> TGHS3DEnforcedVertexEntryValues;
+
+ struct TGHS3DEnforcedVertex {
+ std::string name;
+ std::string geomEntry;
+ bool isCompound;
+ std::vector<double> coords;
+ std::string groupName;
+ double size;
+ };
+
+ struct CompareGHS3DEnforcedVertex {
+ bool operator () (const TGHS3DEnforcedVertex* e1, const TGHS3DEnforcedVertex* e2) const {
+ if (e1 && e2) {
+ if (e1->coords.size() && e2->coords.size())
+ return (e1->coords < e2->coords);
+ else
+ return (e1->geomEntry < e2->geomEntry);
+ }
+ return false;
+ }
+ };
+ typedef std::set< TGHS3DEnforcedVertex*, CompareGHS3DEnforcedVertex > TGHS3DEnforcedVertexList;
+ // Map Coords / Enforced node
+ typedef std::map< std::vector<double>, TGHS3DEnforcedVertex* > TCoordsGHS3DEnforcedVertexMap;
+ // Map geom entry / Enforced node
+ typedef std::map< std::string, TGHS3DEnforcedVertex* > TGeomEntryGHS3DEnforcedVertexMap;
+ // Map groupName / Enforced node
+ typedef std::map< std::string, TGHS3DEnforcedVertexList > TGroupNameGHS3DEnforcedVertexMap;
+
+ ////////////////////
+ // Enforced meshes
+ ////////////////////
+
+ struct TGHS3DEnforcedMesh {
+ int persistID;
+ std::string name;
+ std::string entry;
+ std::string groupName;
+ SMESH::ElementType elementType;
+ };
+
+ struct CompareGHS3DEnforcedMesh {
+ bool operator () (const TGHS3DEnforcedMesh* e1, const TGHS3DEnforcedMesh* e2) const {
+ if (e1 && e2) {
+ if (e1->entry == e2->entry)
+ return (e1->elementType < e2->elementType);
+ else
+ return (e1->entry < e2->entry);
+ }
+ else
+ return false;
+ }
+ };
+ typedef std::set< TGHS3DEnforcedMesh*, CompareGHS3DEnforcedMesh > TGHS3DEnforcedMeshList;
+ // Map mesh entry / Enforced mesh list
+ // ex: 0:1:2:1 -> [ ("Mesh_1", "0:1:2:1", TopAbs_NODE, ""),
+ // ("Mesh_1", "0:1:2:1", TopAbs_EDGE, "edge group")]
+ typedef std::map< std::string, TGHS3DEnforcedMeshList > TEntryGHS3DEnforcedMeshListMap;
+
+ typedef std::map<int,double> TID2SizeMap;
+
+ struct TIDMeshIDCompare {
+ bool operator () (const SMDS_MeshElement* e1, const SMDS_MeshElement* e2) const
+ { return e1->getMeshId() == e2->getMeshId() ? e1->GetID() < e2->GetID() : e1->getMeshId() < e2->getMeshId() ; }
+ };
+
+ typedef std::map<const SMDS_MeshElement*, std::string, TIDMeshIDCompare > TIDSortedElemGroupMap;
+ typedef std::map<const SMDS_MeshNode*, std::string, TIDMeshIDCompare > TIDSortedNodeGroupMap;
+ typedef std::set<std::string> TSetStrings;
+
+ static const char* GetHypType() { return "GHS3D_Parameters"; }
+ /*!
+ * To mesh "holes" in a solid or not. Default is to mesh.
+ */
+ void SetToMeshHoles(bool toMesh);
+ bool GetToMeshHoles(bool checkFreeOption = false) const;
+ /*!
+ * To make groups of volumes of different domains when mesh is generated from skin.
+ * Default is to make groups.
+ * This option works only (1) for the mesh w/o shape and (2) if GetToMeshHoles() == true
+ */
+ void SetToMakeGroupsOfDomains(bool toMakeGroups);
+ bool GetToMakeGroupsOfDomains() const;
+ /*!
+ * Maximal size of memory to be used by the algorithm (in Megabytes)
+ */
+ void SetMaximumMemory(double MB);
+ double GetMaximumMemory() const;
+ /*!
+ * Initial size of memory to be used by the algorithm (in Megabytes) in
+ * automatic memory adjustment mode. Default is zero
+ */
+ void SetInitialMemory(double MB);
+ double GetInitialMemory() const;
+ /*!
+ * Optimization level: 0-none, 1-light, 2-medium, 3-standard+, 4-strong. Default is medium
+ */
+ enum OptimizationLevel { None = 0, Light, Medium, StandardPlus, Strong };
+ void SetOptimizationLevel(OptimizationLevel level);
+ OptimizationLevel GetOptimizationLevel() const;
+ /*!
+ * Path to working directory
+ */
+ void SetWorkingDirectory(const std::string& path);
+ std::string GetWorkingDirectory() const;
+ /*!
+ * To keep working files or remove them. Log file remains in case of errors anyway.
+ */
+ void SetKeepFiles(bool toKeep);
+ bool GetKeepFiles() const;
+ /*!
+ * Verbose level [0-10]
+ * 0 - no standard output,
+ * 2 - prints the data, quality statistics of the skin and final meshes and
+ * indicates when the final mesh is being saved. In addition the software
+ * gives indication regarding the CPU time.
+ * 10 - same as 2 plus the main steps in the computation, quality statistics
+ * histogram of the skin mesh, quality statistics histogram together with
+ * the characteristics of the final mesh.
+ */
+ void SetVerboseLevel(short level);
+ short GetVerboseLevel() const;
+ /*!
+ * To create new nodes
+ */
+ void SetToCreateNewNodes(bool toCreate);
+ bool GetToCreateNewNodes() const;
+ /*!
+ * To use boundary recovery version which tries to create mesh on a very poor
+ * quality surface mesh
+ */
+ void SetToUseBoundaryRecoveryVersion(bool toUse);
+ bool GetToUseBoundaryRecoveryVersion() const;
+ /*!
+ * Applies finite-element correction by replacing overconstrained elements where
+ * it is possible. The process is cutting first the overconstrained edges and
+ * second the overconstrained facets. This insure that no edges have two boundary
+ * vertices and that no facets have three boundary vertices.
+ */
+ void SetFEMCorrection(bool toUseFem);
+ bool GetFEMCorrection() const;
+ /*!
+ * To removes initial central point.
+ */
+ void SetToRemoveCentralPoint(bool toRemove);
+ bool GetToRemoveCentralPoint() const;
+ /*!
+ * To set hiden/undocumented/advanced options
+ */
+ void SetTextOption(const std::string& option);
+ std::string GetTextOption() const;
+ /*!
+ * To define the volumic gradation
+ */
+ void SetGradation(double gradation);
+ double GetGradation() const ;
+ /*!
+ * Print log in standard output
+ */
+ void SetStandardOutputLog(bool logInStandardOutput);
+ bool GetStandardOutputLog() const ;
+ /*!
+ * Remove log file on success
+ */
+ void SetRemoveLogOnSuccess(bool removeLogOnSuccess);
+ bool GetRemoveLogOnSuccess() const ;
+
+
+// struct TEnforcedEdge {
+// long ID;
+// long node1;
+// long node2;
+// std::string groupName;
+// };
+
+
+ /*!
+ * \brief Return command to run ghs3d mesher excluding file prefix (-f)
+ */
+ static std::string CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
+ const bool hasShapeToMesh=true);
+ /*!
+ * \brief Return a unique file name
+ */
+ static std::string GetFileName(const GHS3DPlugin_Hypothesis* hyp);
+ /*!
+ * \brief Return the name of executable
+ */
+ static std::string GetExeName();
+
+ /*!
+ * To set an enforced vertex
+ */
+ bool SetEnforcedVertex(std::string aName, std::string anEntry, std::string aGroupName,
+ double size, double x=0.0, double y=0.0, double z=0.0, bool isCompound = false);
+ TGHS3DEnforcedVertex* GetEnforcedVertex(double x, double y, double z) throw (std::invalid_argument);
+ TGHS3DEnforcedVertex* GetEnforcedVertex(const std::string anEntry) throw (std::invalid_argument);
+ bool RemoveEnforcedVertex(double x=0.0, double y=0.0, double z=0.0, const std::string anEntry="" ) throw (std::invalid_argument);
+ const TGHS3DEnforcedVertexCoordsValues _GetEnforcedVerticesCoordsSize() const {return _enfVertexCoordsSizeList; }
+ const TGHS3DEnforcedVertexEntryValues _GetEnforcedVerticesEntrySize() const {return _enfVertexEntrySizeList; }
+ const TGHS3DEnforcedVertexList _GetEnforcedVertices() const { return _enfVertexList; }
+ const TCoordsGHS3DEnforcedVertexMap _GetEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
+ const TGeomEntryGHS3DEnforcedVertexMap _GetEnforcedVerticesByEntry() const { return _geomEntryEnfVertexMap; }
+ void ClearEnforcedVertices();
+
+ /*!
+ * To set enforced elements
+ */
+ bool SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName = "");
+ bool SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName = "");
+ bool SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName = "");
+ const TGHS3DEnforcedMeshList _GetEnforcedMeshes() const { return _enfMeshList; }
+ const TEntryGHS3DEnforcedMeshListMap _GetEnforcedMeshesByEntry() const { return _entryEnfMeshMap; }
+ void ClearEnforcedMeshes();
+ const TIDSortedNodeGroupMap _GetEnforcedNodes() const { return _enfNodes; }
+ const TIDSortedElemGroupMap _GetEnforcedEdges() const { return _enfEdges; }
+ const TIDSortedElemGroupMap _GetEnforcedTriangles() const { return _enfTriangles; }
+ const TID2SizeMap _GetNodeIDToSizeMap() const {return _nodeIDToSizeMap; }
+ const TSetStrings _GetGroupsToRemove() const {return _groupsToRemove; }
+ void RestoreEnfElemsByMeshes(); // persistence
+ /*!
+ * \brief Return the enforced vertices
+ */
+ static TGHS3DEnforcedVertexList GetEnforcedVertices(const GHS3DPlugin_Hypothesis* hyp);
+ static TGHS3DEnforcedVertexCoordsValues GetEnforcedVerticesCoordsSize(const GHS3DPlugin_Hypothesis* hyp);
+ static TGHS3DEnforcedVertexEntryValues GetEnforcedVerticesEntrySize(const GHS3DPlugin_Hypothesis* hyp);
+ static TCoordsGHS3DEnforcedVertexMap GetEnforcedVerticesByCoords(const GHS3DPlugin_Hypothesis* hyp);
+ static TGeomEntryGHS3DEnforcedVertexMap GetEnforcedVerticesByEntry(const GHS3DPlugin_Hypothesis* hyp);
+
+ static TGHS3DEnforcedMeshList GetEnforcedMeshes(const GHS3DPlugin_Hypothesis* hyp);
+ static TEntryGHS3DEnforcedMeshListMap GetEnforcedMeshesByEntry(const GHS3DPlugin_Hypothesis* hyp);
+ static TIDSortedNodeGroupMap GetEnforcedNodes(const GHS3DPlugin_Hypothesis* hyp);
+ static TIDSortedElemGroupMap GetEnforcedEdges(const GHS3DPlugin_Hypothesis* hyp);
+ static TIDSortedElemGroupMap GetEnforcedTriangles(const GHS3DPlugin_Hypothesis* hyp);
+ static TID2SizeMap GetNodeIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp);
+ static TSetStrings GetGroupsToRemove(const GHS3DPlugin_Hypothesis* hyp);
+ static bool GetToMakeGroupsOfDomains(const GHS3DPlugin_Hypothesis* hyp);
+ void ClearGroupsToRemove();
+
+ static bool DefaultMeshHoles();
+ static bool DefaultToMakeGroupsOfDomains();
+ static double DefaultMaximumMemory();
+ static double DefaultInitialMemory();
+ static short DefaultOptimizationLevel();
+ static std::string DefaultWorkingDirectory();
+ static bool DefaultKeepFiles();
+ static short DefaultVerboseLevel();
+ static bool DefaultToCreateNewNodes();
+ static bool DefaultToUseBoundaryRecoveryVersion();
+ static bool DefaultToUseFEMCorrection();
+ static bool DefaultToRemoveCentralPoint();
+ static bool DefaultStandardOutputLog();
+ static bool DefaultRemoveLogOnSuccess();
+ static double DefaultGradation();
+
+ static TGHS3DEnforcedVertex DefaultGHS3DEnforcedVertex() {return TGHS3DEnforcedVertex();}
+ static TGHS3DEnforcedVertexList DefaultGHS3DEnforcedVertexList() {return TGHS3DEnforcedVertexList();}
+ static TGHS3DEnforcedVertexCoordsValues DefaultGHS3DEnforcedVertexCoordsValues() {return TGHS3DEnforcedVertexCoordsValues();}
+ static TGHS3DEnforcedVertexEntryValues DefaultGHS3DEnforcedVertexEntryValues() {return TGHS3DEnforcedVertexEntryValues();}
+ static TCoordsGHS3DEnforcedVertexMap DefaultCoordsGHS3DEnforcedVertexMap() {return TCoordsGHS3DEnforcedVertexMap();}
+ static TGeomEntryGHS3DEnforcedVertexMap DefaultGeomEntryGHS3DEnforcedVertexMap() {return TGeomEntryGHS3DEnforcedVertexMap();}
+ static TGroupNameGHS3DEnforcedVertexMap DefaultGroupNameGHS3DEnforcedVertexMap() {return TGroupNameGHS3DEnforcedVertexMap();}
+
+ static TGHS3DEnforcedMesh DefaultGHS3DEnforcedMesh() {return TGHS3DEnforcedMesh();}
+ static TGHS3DEnforcedMeshList DefaultGHS3DEnforcedMeshList() {return TGHS3DEnforcedMeshList();}
+ static TEntryGHS3DEnforcedMeshListMap DefaultEntryGHS3DEnforcedMeshListMap() {return TEntryGHS3DEnforcedMeshListMap();}
+ static TIDSortedNodeGroupMap DefaultIDSortedNodeGroupMap() {return TIDSortedNodeGroupMap();}
+ static TIDSortedElemGroupMap DefaultIDSortedElemGroupMap() {return TIDSortedElemGroupMap();}
+ static TID2SizeMap DefaultID2SizeMap() {return TID2SizeMap();}
+ static TSetStrings DefaultGroupsToRemove() {return TSetStrings();}
+
+ // Persistence
+ virtual std::ostream & SaveTo(std::ostream & save);
+ virtual std::istream & LoadFrom(std::istream & load);
+ friend GHS3DPLUGIN_EXPORT std::ostream & operator <<(std::ostream & save, GHS3DPlugin_Hypothesis & hyp);
+ friend GHS3DPLUGIN_EXPORT std::istream & operator >>(std::istream & load, GHS3DPlugin_Hypothesis & hyp);
+
+ /*!
+ * \brief Does nothing
+ */
+ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+
+ /*!
+ * \brief Sets myToMakeGroupsOfDomains depending on whether theMesh is on shape or not
+ */
+ virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
+
+private:
+
+ bool myToMeshHoles;
+ bool myToMakeGroupsOfDomains;
+ double myMaximumMemory;
+ double myInitialMemory;
+ short myOptimizationLevel;
+ bool myKeepFiles;
+ std::string myWorkingDirectory;
+ short myVerboseLevel;
+ bool myToCreateNewNodes;
+ bool myToUseBoundaryRecoveryVersion;
+ bool myToUseFemCorrection;
+ bool myToRemoveCentralPoint;
+ bool myLogInStandardOutput;
+ bool myRemoveLogOnSuccess;
+ std::string myTextOption;
+ double myGradation;
+
+ TGHS3DEnforcedVertexList _enfVertexList;
+ TGHS3DEnforcedVertexCoordsValues _enfVertexCoordsSizeList;
+ TGHS3DEnforcedVertexEntryValues _enfVertexEntrySizeList;
+ // map to get "manual" enf vertex (through the coordinates)
+ TCoordsGHS3DEnforcedVertexMap _coordsEnfVertexMap;
+ // map to get "geom" enf vertex (through the geom entries)
+ TGeomEntryGHS3DEnforcedVertexMap _geomEntryEnfVertexMap;
+
+
+ TGHS3DEnforcedMeshList _enfMeshList;
+ // map to get enf meshes through the entries
+ TEntryGHS3DEnforcedMeshListMap _entryEnfMeshMap;
+ TIDSortedNodeGroupMap _enfNodes;
+ TIDSortedElemGroupMap _enfEdges;
+ TIDSortedElemGroupMap _enfTriangles;
+ TID2SizeMap _nodeIDToSizeMap;
+ std::map<std::string, TIDSortedElemSet > _entryToElemsMap;
+
+ TSetStrings _groupsToRemove;
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : GHS3DPlugin_Hypothesis_i.cxx
+// Created : Wed Apr 2 13:53:01 2008
+// Author : Edward AGAPOV (eap)
+//
+#include "GHS3DPlugin_Hypothesis_i.hxx"
+
+#include "SMESH_Gen.hxx"
+#include "SMESH_PythonDump.hxx"
+//#include "SMESH_Mesh.hxx"
+//#include "SMESH_ProxyMesh.hxx"
+//#include <StdMeshers_QuadToTriaAdaptor.hxx>
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+#include "SMESH_Mesh_i.hxx"
+#include "SMESH_Group_i.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_TypeDefs.hxx"
+#include "SMESHDS_GroupBase.hxx"
+
+// SALOME KERNEL includes
+#include "SALOMEDSClient.hxx"
+#include <SALOMEDSClient_definitions.hxx>
+// // IDL headers
+// #include <SALOMEconfig.h>
+// #include CORBA_SERVER_HEADER(SALOMEDS)
+
+//=======================================================================
+//function : GHS3DPlugin_Hypothesis_i
+//=======================================================================
+
+GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl)
+ : SALOME::GenericObj_i( thePOA ),
+ SMESH_Hypothesis_i( thePOA )
+{
+ MESSAGE( "GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i" );
+ myBaseImpl = new ::GHS3DPlugin_Hypothesis (theGenImpl->GetANewId(),
+ theStudyId,
+ theGenImpl);
+}
+
+//=======================================================================
+//function : ~GHS3DPlugin_Hypothesis_i
+//=======================================================================
+
+GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i()
+{
+ MESSAGE( "GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i" );
+}
+
+//=======================================================================
+//function : SetToMeshHoles
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetToMeshHoles(toMesh);
+ SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
+}
+
+//=======================================================================
+//function : GetToMeshHoles
+//=======================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMeshHoles()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetToMeshHoles();
+}
+
+//=======================================================================
+//function : SetToMakeGroupsOfDomains
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetToMakeGroupsOfDomains(toMakeGroups);
+ SMESH::TPythonDump() << _this() << ".SetToMakeGroupsOfDomains( " << toMakeGroups << " )";
+}
+
+//=======================================================================
+//function : GetToMakeGroupsOfDomains
+//=======================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetToMakeGroupsOfDomains();
+}
+
+//=======================================================================
+//function : SetMaximumMemory
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Double MB)
+ throw ( SALOME::SALOME_Exception )
+{
+ if ( MB == 0 )
+ THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetMaximumMemory(MB);
+ SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
+}
+
+//=======================================================================
+//function : GetMaximumMemory
+//=======================================================================
+
+CORBA::Double GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetMaximumMemory();
+}
+
+//=======================================================================
+//function : SetInitialMemory
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Double MB)
+ throw ( SALOME::SALOME_Exception )
+{
+ if ( MB == 0 )
+ THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetInitialMemory(MB);
+ SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
+}
+
+//=======================================================================
+//function : GetInitialMemory
+//=======================================================================
+
+CORBA::Double GHS3DPlugin_Hypothesis_i::GetInitialMemory()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetInitialMemory();
+}
+
+//=======================================================================
+//function : SetOptimizationLevel
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
+ throw ( SALOME::SALOME_Exception )
+{
+ ::GHS3DPlugin_Hypothesis::OptimizationLevel l =
+ (::GHS3DPlugin_Hypothesis::OptimizationLevel) level;
+ if ( l < ::GHS3DPlugin_Hypothesis::None ||
+ l > ::GHS3DPlugin_Hypothesis::Strong )
+ THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
+
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetOptimizationLevel(l);
+ SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
+}
+
+//=======================================================================
+//function : GetOptimizationLevel
+//=======================================================================
+
+CORBA::Short GHS3DPlugin_Hypothesis_i::GetOptimizationLevel()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetOptimizationLevel();
+}
+
+//=======================================================================
+//function : SetWorkingDirectory
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
+{
+ if (!path )
+ THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
+
+ string file(path);
+ const char lastChar = *file.rbegin();
+#ifdef WIN32
+ if ( lastChar != '\\' ) file += '\\';
+#else
+ if ( lastChar != '/' ) file += '/';
+#endif
+ file += "GHS3D.log";
+ SMESH_Mesh_i::PrepareForWriting (file.c_str());
+
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetWorkingDirectory(path);
+ SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
+}
+
+//=======================================================================
+//function : GetWorkingDirectory
+//=======================================================================
+
+char* GHS3DPlugin_Hypothesis_i::GetWorkingDirectory()
+{
+ ASSERT(myBaseImpl);
+ return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
+}
+
+//=======================================================================
+//function : SetKeepFiles
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetKeepFiles(toKeep);
+ SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
+}
+
+//=======================================================================
+//function : GetKeepFiles
+//=======================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetKeepFiles()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetKeepFiles();
+}
+
+//=======================================================================
+//function : SetVerboseLevel
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
+ throw ( SALOME::SALOME_Exception )
+{
+ if (level < 0 || level > 10 )
+ THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
+ SALOME::BAD_PARAM );
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetVerboseLevel(level);
+ SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
+}
+
+//=======================================================================
+//function : GetVerboseLevel
+//=======================================================================
+
+CORBA::Short GHS3DPlugin_Hypothesis_i::GetVerboseLevel()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetVerboseLevel();
+}
+
+//=======================================================================
+//function : SetToCreateNewNodes
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetToCreateNewNodes(toCreate);
+ SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
+}
+
+//=======================================================================
+//function : GetToCreateNewNodes
+//=======================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToCreateNewNodes()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetToCreateNewNodes();
+}
+
+//=======================================================================
+//function : SetToUseBoundaryRecoveryVersion
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
+ SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
+}
+
+//=======================================================================
+//function : GetToUseBoundaryRecoveryVersion
+//=======================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
+}
+
+//=======================================================================
+//function : SetFEMCorrection
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetFEMCorrection(toUseFem);
+ SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )";
+}
+
+//=======================================================================
+//function : GetFEMCorrection
+//=======================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetFEMCorrection()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetFEMCorrection();
+}
+
+//=======================================================================
+//function : SetToRemoveCentralPoint
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetToRemoveCentralPoint(toRemove);
+ SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )";
+}
+
+//=======================================================================
+//function : GetToRemoveCentralPoint
+//=======================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToRemoveCentralPoint()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetToRemoveCentralPoint();
+}
+
+//=======================================================================
+//function : SetTextOption
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetTextOption(const char* option)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetTextOption(option);
+ SMESH::TPythonDump() << _this() << ".SetTextOption( '" << option << "' )";
+}
+
+//=======================================================================
+//function : GetTextOption
+//=======================================================================
+
+char* GHS3DPlugin_Hypothesis_i::GetTextOption()
+{
+ ASSERT(myBaseImpl);
+ return CORBA::string_dup( this->GetImpl()->GetTextOption().c_str() );
+}
+
+//=======================================================================
+//function : SetToRemoveCentralPoint
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
+{
+ if (gradation <= 1)
+ THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
+ ASSERT(myBaseImpl);
+ if (gradation != GetGradation()) {
+ this->GetImpl()->SetGradation(gradation);
+ SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
+ }
+}
+
+//=======================================================================
+//function : GetToRemoveCentralPoint
+//=======================================================================
+
+CORBA::Double GHS3DPlugin_Hypothesis_i::GetGradation()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetGradation();
+}
+
+//=======================================================================
+//function : SetStandardOutputLog
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetStandardOutputLog(CORBA::Boolean logInStandardOutput)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
+ SMESH::TPythonDump() << _this() << ".SetPrintLogInFile( " << !logInStandardOutput << " )";
+}
+
+//=======================================================================
+//function : GetStandardOutputLog
+//=======================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetStandardOutputLog()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetStandardOutputLog();
+}
+
+//=======================================================================
+//function : SetRemoveLogOnSuccess
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
+ SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
+}
+
+//=======================================================================
+//function : GetRemoveLogOnSuccess
+//=======================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
+{
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetRemoveLogOnSuccess();
+}
+
+//=======================================================================
+//function : SetEnforcedVertex
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
+ throw (SALOME::SALOME_Exception) {
+ ASSERT(myBaseImpl);
+ MESSAGE("IDL : SetEnforcedVertex( "<< x << ", " << y << ", " << z << ", " << size << ")");
+ return p_SetEnforcedVertex(size, x, y, z);
+}
+
+bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
+ throw (SALOME::SALOME_Exception) {
+ ASSERT(myBaseImpl);
+ MESSAGE("IDL : SetEnforcedVertexNamed( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ")");
+ return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
+}
+
+bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
+ throw (SALOME::SALOME_Exception) {
+ ASSERT(myBaseImpl);
+ MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theGroupName << ")");
+ return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
+}
+
+bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
+ throw (SALOME::SALOME_Exception) {
+ ASSERT(myBaseImpl);
+ MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ", " << theGroupName << ")");
+ return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
+}
+
+bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
+ throw (SALOME::SALOME_Exception) {
+ ASSERT(myBaseImpl);
+
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+
+ string theVertexEntry = theVertex->GetStudyEntry();
+ CORBA::Double x = 0, y = 0, z = 0;
+ CORBA::Boolean isCompound = false;
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ if (theVertexEntry.empty()) {
+ string aName;
+ if (theVertex->GetShapeType() == GEOM::VERTEX) {
+ aName = "Vertex_";
+ }
+ if (theVertex->GetShapeType() == GEOM::COMPOUND) {
+ aName = "Compound_";
+ isCompound = true;
+ }
+ aName += theVertex->GetEntry();
+ SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ if (theVertex->GetShapeType() == GEOM::VERTEX) {
+ GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
+ if (CORBA::is_nil(measureOp))
+ return false;
+
+ measureOp->PointCoordinates (theVertex, x, y, z);
+ MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
+ }
+
+ string theVertexName = theVertex->GetName();
+ MESSAGE("IDL : SetEnforcedVertexGeom( "<< theVertexEntry << ", " << size<< ")");
+
+ return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
+}
+
+bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
+ throw (SALOME::SALOME_Exception) {
+ ASSERT(myBaseImpl);
+
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+
+ string theVertexEntry = theVertex->GetStudyEntry();
+ CORBA::Double x = 0, y = 0, z = 0;
+ CORBA::Boolean isCompound = false;
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ if (theVertexEntry.empty()) {
+ string aName;
+ if (theVertex->GetShapeType() == GEOM::VERTEX) {
+ aName = "Vertex_";
+ }
+ if (theVertex->GetShapeType() == GEOM::COMPOUND) {
+ aName = "Compound_";
+ isCompound = true;
+ }
+ aName += theVertex->GetEntry();
+ SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ if (theVertex->GetShapeType() == GEOM::VERTEX) {
+ GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
+ if (CORBA::is_nil(measureOp))
+ return false;
+
+ measureOp->PointCoordinates (theVertex, x, y, z);
+ MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
+ }
+
+ string theVertexName = theVertex->GetName();
+ MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theVertexEntry << ", " << size<< ", " << theGroupName << ")");
+
+ return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
+}
+
+bool GHS3DPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
+ const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
+ CORBA::Boolean isCompound)
+ throw (SALOME::SALOME_Exception) {
+ ASSERT(myBaseImpl);
+ MESSAGE("IDL : p_SetEnforcedVertex(" << size << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\", " << isCompound<< ")");
+ bool newValue = false;
+
+ ::GHS3DPlugin_Hypothesis::TCoordsGHS3DEnforcedVertexMap coordsList;
+ ::GHS3DPlugin_Hypothesis::TGeomEntryGHS3DEnforcedVertexMap enfVertexEntryList;
+ if (string(theVertexEntry).empty()) {
+ coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
+ std::vector<double> coords;
+ coords.push_back(x);
+ coords.push_back(y);
+ coords.push_back(z);
+ if (coordsList.find(coords) == coordsList.end()) {
+ MESSAGE("Coords not found: add it in coordsList");
+ newValue = true;
+ }
+ else {
+ MESSAGE("Coords already found, compare names");
+ ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
+ if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
+ MESSAGE("The names or size are different: update");
+// this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
+ newValue = true;
+ }
+ else {
+ MESSAGE("The names and size are identical");
+ }
+ }
+
+ if (newValue) {
+ if (string(theVertexName).empty()) {
+ if (string(theGroupName).empty())
+ SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
+ else
+ SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
+ }
+ else {
+ if (string(theGroupName).empty())
+ SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\")";
+ else
+ SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
+ }
+ }
+ }
+ else {
+// if (isCompound || (!isCompound && !string(theVertexEntry).empty())) {
+ enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
+// ::BLSURFPlugin_Hypothesis::TGeomEntryGHS3DEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
+ if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
+ MESSAGE("Geom entry not found: add it in enfVertexEntryList");
+ newValue = true;
+ }
+ else {
+ MESSAGE("Geom entry already found, compare names");
+ ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
+ if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
+ MESSAGE("The names or size are different: update");
+// this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
+ newValue = true;
+ }
+ else {
+ MESSAGE("The names and size are identical");
+ }
+ }
+
+ if (newValue) {
+ if (string(theGroupName).empty())
+ SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
+ else
+ SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
+ }
+ }
+
+ if (newValue)
+ this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
+
+ MESSAGE("IDL : SetEnforcedVertexEntry END");
+ return newValue;
+}
+
+//=======================================================================
+//function : GetEnforcedVertex
+//=======================================================================
+
+CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+ try {
+ bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
+ SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
+ return isDone;
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+ ExDescription.lineNumber = 513;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+//=======================================================================
+//function : GetEnforcedVertex
+//=======================================================================
+
+CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+
+ string theVertexEntry = theVertex->GetStudyEntry();
+ if (theVertexEntry.empty()) {
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+ if (theVertex->GetShapeType() == GEOM::VERTEX)
+ aName = "Vertex_";
+ if (theVertex->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theVertex->GetEntry();
+ SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ string theVertexName = theVertex->GetName();
+
+ try {
+ bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
+ SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
+ return isDone;
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+ ExDescription.lineNumber = 538;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+//=======================================================================
+//function : GetEnforcedVertices
+//=======================================================================
+
+GHS3DPlugin::GHS3DEnforcedVertexList* GHS3DPlugin_Hypothesis_i::GetEnforcedVertices()
+{
+ ASSERT(myBaseImpl);
+ GHS3DPlugin::GHS3DEnforcedVertexList_var result = new GHS3DPlugin::GHS3DEnforcedVertexList();
+
+ const ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
+ result->length( enfVertexList.size() );
+
+ ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList::const_iterator it = enfVertexList.begin();
+
+ for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
+ ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* currentVertex = (*it);
+ GHS3DPlugin::GHS3DEnforcedVertex_var enfVertex = new GHS3DPlugin::GHS3DEnforcedVertex();
+ // Name
+ enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
+ // Geom Vertex Entry
+ enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
+ // Coords
+ GHS3DPlugin::TCoords_var coords = new GHS3DPlugin::TCoords();
+ coords->length(currentVertex->coords.size());
+ for (int ind = 0; ind < currentVertex->coords.size(); ind++)
+ coords[ind] = currentVertex->coords[ind];
+ enfVertex->coords = coords;
+ // Group Name
+ enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
+ // Size
+ enfVertex->size = currentVertex->size;
+ // isCompound
+ enfVertex->isCompound = currentVertex->isCompound;
+
+ result[i]=enfVertex;
+ }
+
+// SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
+
+ return result._retn();
+}
+
+//=======================================================================
+//function : RemoveEnforcedVertex
+//=======================================================================
+
+bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+ try {
+ bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
+ SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
+ return res;
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+ ExDescription.lineNumber = 625;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+
+ string theVertexEntry = theVertex->GetStudyEntry();
+ if (theVertexEntry.empty()) {
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+ if (theVertex->GetShapeType() == GEOM::VERTEX)
+ aName = "Vertex_";
+ if (theVertex->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theVertex->GetEntry();
+ SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ try {
+ bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
+ SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
+ return res;
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+ ExDescription.lineNumber = 648;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+//=======================================================================
+//function : ClearEnforcedVertices
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::ClearEnforcedVertices()
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->ClearEnforcedVertices();
+ SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
+}
+
+//=======================================================================
+//function : ClearEnforcedMeshes
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::ClearEnforcedMeshes()
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->ClearEnforcedMeshes();
+ SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
+}
+
+//=======================================================================
+//function : GetEnforcedMeshes
+//=======================================================================
+
+GHS3DPlugin::GHS3DEnforcedMeshList* GHS3DPlugin_Hypothesis_i::GetEnforcedMeshes()
+{
+ ASSERT(myBaseImpl);
+ GHS3DPlugin::GHS3DEnforcedMeshList_var result = new GHS3DPlugin::GHS3DEnforcedMeshList();
+
+ const ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
+ result->length( enfMeshList.size() );
+
+ ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList::const_iterator it = enfMeshList.begin();
+
+ for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
+ ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMesh* currentMesh = (*it);
+ GHS3DPlugin::GHS3DEnforcedMesh_var enfMesh = new GHS3DPlugin::GHS3DEnforcedMesh();
+ // Name
+ enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
+ // Mesh Entry
+ enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
+ // isCompound
+ enfMesh->elementType = currentMesh->elementType;
+ // Group Name
+ enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
+
+ result[i]=enfMesh;
+ }
+
+// SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
+
+ return result._retn();
+}
+
+/*!
+ * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
+ */
+bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
+// #if GHS3D_VERSION >= 42
+ return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
+// #else
+// SALOME::ExceptionStruct ExDescription;
+// ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
+// ExDescription.type = SALOME::BAD_PARAM;
+// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+// ExDescription.lineNumber = 719;
+// throw SALOME::SALOME_Exception(ExDescription);
+// #endif
+}
+
+/*!
+ * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
+ */
+bool GHS3DPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
+ throw (SALOME::SALOME_Exception)
+{
+// MESSAGE("GHS3DPlugin_Hypothesis_i::SetEnforcedMesh");
+// #if GHS3D_VERSION >= 42
+ return p_SetEnforcedMesh(theSource, theType);
+// #else
+// SALOME::ExceptionStruct ExDescription;
+// ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
+// ExDescription.type = SALOME::BAD_PARAM;
+// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+// ExDescription.lineNumber = 750;
+// throw SALOME::SALOME_Exception(ExDescription);
+// #endif
+}
+
+/*!
+ * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size. The elements will be grouped in theGroupName.
+ */
+bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
+// #if GHS3D_VERSION >= 42
+ return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
+// #else
+// SALOME::ExceptionStruct ExDescription;
+// ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
+// ExDescription.type = SALOME::BAD_PARAM;
+// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+// ExDescription.lineNumber = 750;
+// throw SALOME::SALOME_Exception(ExDescription);
+// #endif
+}
+
+/*!
+ * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
+ */
+bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
+ throw (SALOME::SALOME_Exception)
+{
+// #if GHS3D_VERSION >= 42
+ return p_SetEnforcedMesh(theSource, theType);
+// #else
+// SALOME::ExceptionStruct ExDescription;
+// ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
+// ExDescription.type = SALOME::BAD_PARAM;
+// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+// ExDescription.lineNumber = 750;
+// throw SALOME::SALOME_Exception(ExDescription);
+// #endif
+}
+
+bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
+ MESSAGE("GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh");
+ ASSERT(myBaseImpl);
+
+ if (CORBA::is_nil( theSource ))
+ {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = "The source mesh CORBA object is NULL";
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+ ExDescription.lineNumber = 840;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+
+ switch (theType) {
+ case SMESH::NODE:
+ MESSAGE("Required type is NODE");
+ break;
+ case SMESH::EDGE:
+ MESSAGE("Required type is EDGE");
+ break;
+ case SMESH::FACE:
+ MESSAGE("Required type is FACE");
+ break;
+ default:
+ MESSAGE("Incompatible required type: " << theType);
+ return false;
+ }
+// MESSAGE("Required type is "<<theType);
+ SMESH::array_of_ElementType_var types = theSource->GetTypes();
+ MESSAGE("Available types:");
+ for (int i=0;i<types->length();i++){MESSAGE(types[i]);}
+ if ( types->length() >= 1 && types[types->length()-1] < theType)
+ {
+ MESSAGE("Required type not available");
+ return false;
+// SALOME::ExceptionStruct ExDescription;
+// ExDescription.text = "The source mesh has bad type";
+// ExDescription.type = SALOME::BAD_PARAM;
+// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+// ExDescription.lineNumber = 840;
+// throw SALOME::SALOME_Exception(ExDescription);
+ }
+
+
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
+
+ SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
+ SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
+ SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
+
+ string enfMeshName = theName;
+ if (enfMeshName.empty())
+ enfMeshName = SObj->GetName();
+
+ if (theMesh_i)
+ {
+ try {
+ bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
+ if (theGroupName != "") {
+ SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
+ << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
+ }
+ else {
+ SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
+ << theSource << ".GetMesh(), " << theType << " )";
+ }
+
+ return res;
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+ ExDescription.lineNumber = 840;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+ }
+ else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
+ {
+ MESSAGE("The source is a group")
+ try {
+ bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
+ if (theGroupName != "") {
+ SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
+ << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
+ }
+ else {
+ SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
+ << theSource << ", " << theType << " )";
+ }
+ return res;
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+ ExDescription.lineNumber = 840;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+ }
+ else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
+ {
+ MESSAGE("The source is a group on geom")
+ try {
+ bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
+ if (theGroupName != "") {
+ SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
+ << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
+ }
+ else {
+ SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
+ << theSource << ", " << theType << " )";
+ }
+ return res;
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+ ExDescription.lineNumber = 840;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+ }
+ return false;
+}
+//=============================================================================
+/*!
+ * Get implementation
+ */
+//=============================================================================
+
+::GHS3DPlugin_Hypothesis* GHS3DPlugin_Hypothesis_i::GetImpl()
+{
+ return (::GHS3DPlugin_Hypothesis*)myBaseImpl;
+}
+
+//================================================================================
+/*!
+ * \brief Verify whether hypothesis supports given entity type
+ */
+//================================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
+{
+ return type == SMESH::DIM_3D;
+}
+
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// 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
+//
+
+// GHS3DPlugin : C++ implementation
+// File : GHS3DPlugin_Hypothesis_i.hxx
+// Date : 03/04/2006
+// Project : SALOME
+//
+#ifndef _GHS3DPlugin_Hypothesis_i_HXX_
+#define _GHS3DPlugin_Hypothesis_i_HXX_
+
+#include "GHS3DPlugin_Defs.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(GHS3DPlugin_Algorithm)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "SMESH_Mesh_i.hxx"
+#include "GHS3DPlugin_Hypothesis.hxx"
+
+class SMESH_Gen;
+
+// GHS3DPlugin parameters hypothesis
+
+class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i:
+ public virtual POA_GHS3DPlugin::GHS3DPlugin_Hypothesis,
+ public virtual SMESH_Hypothesis_i
+{
+ public:
+ // Constructor
+ GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl);
+ // Destructor
+ virtual ~GHS3DPlugin_Hypothesis_i();
+
+ /*!
+ * To mesh "holes" in a solid or not. Default is to mesh.
+ */
+ void SetToMeshHoles(CORBA::Boolean toMesh);
+ CORBA::Boolean GetToMeshHoles();
+ /*!
+ * To make groups of volumes of different domains when mesh is generated from skin.
+ * Default is to make groups.
+ * This option works only (1) for the mesh w/o shape and (2) if GetToMeshHoles() == true
+ */
+ void SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups);
+ CORBA::Boolean GetToMakeGroupsOfDomains();
+ /*!
+ * Maximal size of memory to be used by the algorithm (in Megabytes)
+ */
+ void SetMaximumMemory(CORBA::Double MB) throw ( SALOME::SALOME_Exception );
+ CORBA::Double GetMaximumMemory();
+ /*!
+ * Initial size of memory to be used by the algorithm (in Megabytes) in
+ * automatic memory adjustment mode. Default is zero
+ */
+ void SetInitialMemory(CORBA::Double MB) throw ( SALOME::SALOME_Exception );
+ CORBA::Double GetInitialMemory();
+ /*!
+ * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium
+ */
+ void SetOptimizationLevel(CORBA::Short level) throw ( SALOME::SALOME_Exception );
+ CORBA::Short GetOptimizationLevel();
+ /*!
+ * Path to working directory
+ */
+ void SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception );
+ char* GetWorkingDirectory();
+ /*!
+ * To keep working files or remove them. Log file remains in case of errors anyway.
+ */
+ void SetKeepFiles(CORBA::Boolean toKeep);
+ CORBA::Boolean GetKeepFiles();
+ /*!
+ * Verbose level [0-10]
+ * 0 - no standard output,
+ * 2 - prints the data, quality statistics of the skin and final meshes and
+ * indicates when the final mesh is being saved. In addition the software
+ * gives indication regarding the CPU time.
+ * 10 - same as 2 plus the main steps in the computation, quality statistics
+ * histogram of the skin mesh, quality statistics histogram together with
+ * the characteristics of the final mesh.
+ */
+ void SetVerboseLevel(CORBA::Short level) throw ( SALOME::SALOME_Exception );
+ CORBA::Short GetVerboseLevel();
+ /*!
+ * To create new nodes
+ */
+ void SetToCreateNewNodes(CORBA::Boolean toCreate);
+ CORBA::Boolean GetToCreateNewNodes();
+ /*!
+ * To use boundary recovery version which tries to create mesh on a very poor
+ * quality surface mesh
+ */
+ void SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse);
+ CORBA::Boolean GetToUseBoundaryRecoveryVersion();
+ /*!
+ * Applies finite-element correction by replacing overconstrained elements where
+ * it is possible. The process is cutting first the overconstrained edges and
+ * second the overconstrained facets. This insure that no edges have two boundary
+ * vertices and that no facets have three boundary vertices.
+ */
+ void SetFEMCorrection(CORBA::Boolean toUseFem);
+ CORBA::Boolean GetFEMCorrection();
+ /*!
+ * To removes initial central point.
+ */
+ void SetToRemoveCentralPoint(CORBA::Boolean toRemove);
+ CORBA::Boolean GetToRemoveCentralPoint();
+ /*!
+ * To set hiden/undocumented/advanced options
+ */
+ void SetTextOption(const char* option);
+ char* GetTextOption();
+ /*!
+ * To define the volumic gradation
+ */
+ void SetGradation(CORBA::Double gradation);
+ CORBA::Double GetGradation();
+ /*!
+ * Print log in standard output
+ */
+ void SetStandardOutputLog(CORBA::Boolean logInStandardOutput);
+ CORBA::Boolean GetStandardOutputLog();
+ /*!
+ * Remove log file on success
+ */
+ void SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess);
+ CORBA::Boolean GetRemoveLogOnSuccess();
+ /*!
+ * To set an enforced vertex
+ */
+ bool p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x = 0, CORBA::Double y = 0, CORBA::Double z = 0,
+ const char* theVertexName = "", const char* theVertexEntry = "", const char* theGroupName = "",
+ CORBA::Boolean isCompound = false)
+ throw (SALOME::SALOME_Exception);
+ bool SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size) throw (SALOME::SALOME_Exception);
+ bool SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName) throw (SALOME::SALOME_Exception);
+ bool SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName) throw (SALOME::SALOME_Exception);
+ bool SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName) throw (SALOME::SALOME_Exception);
+ bool SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size) throw (SALOME::SALOME_Exception);
+ bool SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName) throw (SALOME::SALOME_Exception);
+ CORBA::Double GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception);
+ CORBA::Double GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex) throw (SALOME::SALOME_Exception);
+ bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception);
+ bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex) throw (SALOME::SALOME_Exception);
+ GHS3DPlugin::GHS3DEnforcedVertexList* GetEnforcedVertices();
+ void ClearEnforcedVertices();
+ /*!
+ * To set an enforced mesh
+ */
+ bool p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theName="", const char* theGroupName="") throw (SALOME::SALOME_Exception);
+ bool SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType) throw (SALOME::SALOME_Exception);
+ bool SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theGroupName) throw (SALOME::SALOME_Exception);
+
+ /* OBSOLETE FUNCTIONS */
+ bool SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size) throw (SALOME::SALOME_Exception);
+ bool SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size, const char* theGroupName) throw (SALOME::SALOME_Exception);
+ /* OBSOLETE FUNCTIONS */
+
+ GHS3DPlugin::GHS3DEnforcedMeshList* GetEnforcedMeshes();
+ void ClearEnforcedMeshes();
+
+ // Get implementation
+ ::GHS3DPlugin_Hypothesis* GetImpl();
+
+ // Verify whether hypothesis supports given entity type
+ CORBA::Boolean IsDimSupported( SMESH::Dimension type );
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2004-2013 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.
+//
+// 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 GHS3DPlugin : implementaion of SMESH idl descriptions
+// File : GHS3DPlugin.cxx
+// Author : Julia DOROVSKIKH
+// Module : SMESH
+// $Header$
+//
+#include "SMESH_Hypothesis_i.hxx"
+
+#include "utilities.h"
+
+#include "GHS3DPlugin_GHS3D_i.hxx"
+#include "GHS3DPlugin_Hypothesis_i.hxx"
+
+template <class T> class GHS3DPlugin_Creator_i:public HypothesisCreator_i<T>
+{
+ // as we have 'module GHS3DPlugin' in GHS3DPlugin_Algorithm.idl
+ virtual std::string GetModuleName() { return "GHS3DPlugin"; }
+};
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+extern "C"
+{
+ GHS3DPLUGIN_EXPORT GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName);
+
+ GHS3DPLUGIN_EXPORT
+ GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName)
+ {
+ MESSAGE("GetHypothesisCreator " << aHypName);
+
+ GenericHypothesisCreator_i* aCreator = 0;
+
+ // Hypotheses
+
+ // Algorithm
+ if (strcmp(aHypName, "GHS3D_3D") == 0)
+ aCreator = new GHS3DPlugin_Creator_i<GHS3DPlugin_GHS3D_i>;
+ // Hypothesis
+ else if (strcmp(aHypName, "GHS3D_Parameters") == 0)
+ aCreator = new GHS3DPlugin_Creator_i<GHS3DPlugin_Hypothesis_i>;
+ else ;
+
+ return aCreator;
+ }
+}
--- /dev/null
+# Copyright (C) 2007-2013 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.
+#
+# 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
+#
+
+##
+# @package GHS3DPluginBuilder
+# Python API for the GHS3D meshing plug-in module.
+