From: vsr Date: Thu, 13 Dec 2012 12:19:49 +0000 (+0000) Subject: Merge from V6_main 13/12/2012 X-Git-Tag: V7_1_0_pre X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=92893180990bccec5db0f74c6efb0500145a0687;p=plugins%2Fblsurfplugin.git Merge from V6_main 13/12/2012 --- diff --git a/adm_local/cmake_files/FindCADSURF.cmake b/adm_local/cmake_files/FindCADSURF.cmake new file mode 100644 index 0000000..6822a40 --- /dev/null +++ b/adm_local/cmake_files/FindCADSURF.cmake @@ -0,0 +1,46 @@ +# Copyright (C) 2007-2012 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 +# + +SET(MESHGEMSHOME $ENV{MESHGEMSHOME}) +FIND_PATH(CADSURF_INCLUDES_DIR meshgems/cadsurf.h ${MESHGEMSHOME}/include) +SET(MESHGEMS_CADSURF_INCLUDES) +SET(MESHGEMS_CADSURF_INCLUDES ${MESHGEMS_CADSURF_INCLUDES} -I${CADSURF_INCLUDES_DIR}) + +SET(CADSURF_LIBS_PATHS) +SET(CADSURF_LIBS_PATHS ${CADSURF_LIBS_PATHS} ${MESHGEMSHOME}/lib) +IF(WINDOWS) + SET(CADSURF_LIBS_PATHS ${CADSURF_LIBS_PATHS} ${MESHGEMSHOME}/lib/WinXP_VC9) +ELSE(WINDOWS) + IF(CMAKE_SIZEOF_VOID_P STREQUAL 8) + SET(CADSURF_LIBS_PATHS ${CADSURF_LIBS_PATHS} ${MESHGEMSHOME}/lib/Linux_64) + ELSE() + SET(CADSURF_LIBS_PATHS ${CADSURF_LIBS_PATHS} ${MESHGEMSHOME}/lib/Linux) + ENDIF() +ENDIF(WINDOWS) + +FIND_LIBRARY(mg-cadsurf mg-cadsurf PATHS ${CADSURF_LIBS_PATHS}) +FIND_LIBRARY(mg-precad mg-precad PATHS ${CADSURF_LIBS_PATHS}) +FIND_LIBRARY(meshgems meshgems PATHS ${CADSURF_LIBS_PATHS}) + +SET(MESHGEMS_CADSURF_LIBS) +SET(MESHGEMS_CADSURF_LIBS ${MESHGEMS_CADSURF_LIBS} ${mg-cadsurf}) +SET(MESHGEMS_CADSURF_LIBS ${MESHGEMS_CADSURF_LIBS} ${mg-precad}) +IF(meshgems) + SET(MESHGEMS_CADSURF_LIBS ${MESHGEMS_CADSURF_LIBS} ${meshgems}) +ENDIF(meshgems) diff --git a/adm_local/unix/config_files/check_MESHGEMS_CADSURF.m4 b/adm_local/unix/config_files/check_MESHGEMS_CADSURF.m4 new file mode 100644 index 0000000..d2a0914 --- /dev/null +++ b/adm_local/unix/config_files/check_MESHGEMS_CADSURF.m4 @@ -0,0 +1,129 @@ +dnl Copyright (C) 2007-2012 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 + +dnl File : check_MESHGEMS_CADSURF.m4 +dnl Author : Gilles DAVID, Open CASCADE S.A.S (gilles.david@opencascade.com) +dnl +AC_DEFUN([CHECK_MESHGEMS_CADSURF],[ + +AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_PROG_CXXCPP])dnl + +AC_CHECKING([for MeshGems-CADSurf commercial product]) + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +MESHGEMS_CADSURF_INCLUDES="" +MESHGEMS_CADSURF_LIBS="" + +AC_ARG_WITH([meshgems], + [ --with_meshgems=DIR root directory path of MeshGems-CADSurf installation]) + +CADSURF_ok=no + +if test "$with_meshgems" != "no" ; then + if test "$with_meshgems" == "yes" || test "$with_meshgems" == "auto"; then + MESHGEMS_CADSURF_HOME="" + else + MESHGEMS_CADSURF_HOME="$with_meshgems" + fi + + if test "$MESHGEMS_CADSURF_HOME" == "" ; then + if test "x$MESHGEMS_CADSURFHOME" != "x" ; then + MESHGEMS_CADSURF_HOME=$MESHGEMS_CADSURFHOME + fi + if test "x$CADSURFHOME" != "x" ; then + MESHGEMS_CADSURF_HOME=$CADSURFHOME + fi + if test "x$MESHGEMSHOME" != "x" ; then + MESHGEMS_CADSURF_HOME=$MESHGEMSHOME + fi + fi + + if test "x$MESHGEMS_CADSURF_HOME" != "x"; then + + echo + echo ------------------------------------------------- + echo You are about to choose to use somehow the + echo MeshGems-CADSurf commercial product to generate 2D mesh. + echo + + LOCAL_INCLUDES="-I$MESHGEMS_CADSURF_HOME/include" + LOCAL_LIBS="-L$MESHGEMS_CADSURF_HOME/lib/Linux" + archtest="$(`which arch`)" + if test "x$archtest" = "x" ; then + archtest="`uname -m`" + fi + if test $archtest = "x86_64" ; then + LOCAL_LIBS="-L$MESHGEMS_CADSURF_HOME/lib/Linux_64" + fi + LOCAL_LIBS="${LOCAL_LIBS} -lmeshgems -lmg-cadsurf -lmg-precad" + + CPPFLAGS_old="$CPPFLAGS" + CXXFLAGS_old="$CXXFLAGS" + CPPFLAGS="$LOCAL_INCLUDES $CPPFLAGS" + CXXFLAGS="$LOCAL_INCLUDES $CXXFLAGS" + + AC_MSG_CHECKING([for MeshGems-CADSurf header file]) + + AC_CHECK_HEADER([meshgems/meshgems.h],[CADSURF_ok=yes],[CADSURF_ok=no]) + AC_CHECK_HEADER([meshgems/cadsurf.h],[CADSURF_ok=yes],[CADSURF_ok=no]) + + if test "x$CADSURF_ok" == "xyes"; then + + AC_MSG_CHECKING([for MeshGems-CADSurf library]) + + LIBS_old="$LIBS" + LIBS="-L. $LOCAL_LIBS $LIBS" + + AC_TRY_LINK( +extern "C" { +#include "meshgems/meshgems.h" +}, context_new(), + CADSURF_ok=yes,CADSURF_ok=no + ) + + LIBS="$LIBS_old" + + AC_MSG_RESULT([$CADSURF_ok]) + fi + + CPPFLAGS="$CPPFLAGS_old" + CXXFLAGS="$CXXFLAGS_old" + + fi +fi + +if test "x$CADSURF_ok" == xno ; then + AC_MSG_RESULT([for MeshGems-CADSurf: no]) + AC_MSG_WARN([MeshGems-CADSurf includes or libraries are not found or are not properly installed]) + AC_MSG_WARN([Cannot build without MeshGems-CADSurf. Use --with_meshgems option to define MeshGems installation.]) +else + MESHGEMS_CADSURF_INCLUDES=$LOCAL_INCLUDES + MESHGEMS_CADSURF_LIBS=$LOCAL_LIBS + AC_MSG_RESULT([for MeshGems-CADSurf: yes]) +fi + +AC_SUBST(MESHGEMS_CADSURF_INCLUDES) +AC_SUBST(MESHGEMS_CADSURF_LIBS) + +AC_LANG_RESTORE + +])dnl diff --git a/configure.ac b/configure.ac index 40768ae..a1f53a2 100644 --- a/configure.ac +++ b/configure.ac @@ -317,13 +317,21 @@ echo CHECK_HTML_GENERATORS +dnl echo +dnl echo --------------------------------------------- +dnl echo Testing BLSURF +dnl echo --------------------------------------------- +dnl echo +dnl +dnl CHECK_BLSURF + echo echo --------------------------------------------- -echo Testing BLSURF +echo Testing MeshGems-CADSurf echo --------------------------------------------- echo -CHECK_BLSURF +CHECK_MESHGEMS_CADSURF echo echo --------------------------------------------- @@ -368,11 +376,11 @@ echo echo Configure if test "${gui_ok}" = "yes"; then - variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok gui_ok BLSURF_ok" + variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok gui_ok CADSURF_ok" elif test "${SalomeGUI_need}" != "no"; then - variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok gui_ok BLSURF_ok" + variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok gui_ok CADSURF_ok" else - variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok BLSURF_ok" + variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok CADSURF_ok" fi for var in $variables diff --git a/doc/salome/gui/BLSURFPLUGIN/CMakeLists.txt b/doc/salome/gui/BLSURFPLUGIN/CMakeLists.txt new file mode 100755 index 0000000..ac96603 --- /dev/null +++ b/doc/salome/gui/BLSURFPLUGIN/CMakeLists.txt @@ -0,0 +1,75 @@ +# Copyright (C) 2012 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake) + +SET(top_builddir ${CMAKE_BINARY_DIR}) +SET(top_srcdir ${CMAKE_SOURCE_DIR}) +SET(srcdir ${CMAKE_CURRENT_SOURCE_DIR}) +SET(builddir ${CMAKE_CURRENT_BINARY_DIR}) +SET(datadir${CMAKE_INSTALL_PREFIX}/share) +SET(docdir ${datadir}/doc/salome) +SET(guidocdir ${docdir}/gui/BLSURFPLUGIN) + +SALOME_CONFIGURE_FILE(doxyfile.in doxyfile) +SALOME_CONFIGURE_FILE(doxyfile_py.in doxyfile_py) +SALOME_CONFIGURE_FILE(static/header.html.in ${builddir}/static/header.html) +SALOME_CONFIGURE_FILE(static/header_py.html.in ${builddir}/static/header_py.html) + +SET(DOC_SMESH_MeshersList BLSURFPlugin) +SET(f "$(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py") +IF(WINDOWS) + STRING(REPLACE "/" "\\" f ${f}) + STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${OMNIORB_ROOT_USER}/lib/x86_win32\;%PYTHONPATH% + @SET PYTHONPATH=${OMNIORB_ROOT_USER}/lib/python\;%PYTHONPATH% + @SET PATH=${OMNIORB_ROOT_USER}/lib/x86_win32\;%PATH% + @SET PATH=$ENV{KERNEL_ROOT_DIR}/lib/salome\;%PATH% + @SET PYTHONPATH=$ENV{KERNEL_ROOT_DIR}/bin/salome\;%PYTHONPATH% + @SET PYTHONPATH=$ENV{KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH% + @SET PYTHONPATH=$ENV{MED_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH% + @SET PYTHONPATH=$ENV{MED_ROOT_DIR}/bin/salome\;%PYTHONPATH% + @SET PYTHONPATH=$ENV{GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH% + @SET PYTHONPATH=$ENV{GEOM_ROOT_DIR}/bin/salome\;%PYTHONPATH% + @SET PYTHONPATH=$ENV{SMESH_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH% + @SET PYTHONPATH=$ENV{SMESH_ROOT_DIR}/bin/salome\;%PYTHONPATH% + @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH% + @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome\;%PYTHONPATH% + @SET SMESH_MeshersList=${DOC_SMESH_MeshersList} + ") + SET(EXT "bat") + SET(CALL_STR "call") +ELSE(WINDOWS) + SET(DOC_PYTHONPATH ${CMAKE_INSTALL_PREFIX}/bin/salome:${SMESH_ROOT_DIR}/bin/salome:${SMESH_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${MED_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${GEOM_ROOT_DIR}/bin/salome:${GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${KERNEL_ROOT_DIR}/bin/salome:${KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${OMNIORB_ROOT_USER}/lib/python${PYTHON_VERSION}/site-packages:${OMNIORB_ROOT_USER}/lib64/python${PYTHON_VERSION}/site-packages) + SET(SCR "export PYTHONPATH=${DOC_PYTHONPATH}:${PYTHONPATH} + export SMESH_MeshersList=${DOC_SMESH_MeshersList} + ") + SET(EXT "sh") + SET(CALL_STR ".") +ENDIF(WINDOWS) + +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} "${SCR}") + +ADD_CUSTOM_TARGET(usr_docs ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} && ${PYTHON_EXECUTABLE} ${f} -d -o smesh.py BLSURFPlugin + COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py + COMMAND ${DOXYGEN_EXECUTABLE} doxyfile + COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''smesh.py'''); os.remove(r'''tmp_env.${EXT}''')" + COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/BLSURFPLUGIN''',True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''',r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/BLSURFPLUGIN''', ignore=shutil.ignore_patterns('*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*')); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/head.png''',r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/BLSURFPLUGIN'''); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/head.png''',r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/BLSURFPLUGIN/blsurfpluginpy_doc''')" + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) diff --git a/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters.png b/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters.png index 4da8a9e..82c7e90 100644 Binary files a/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters.png and b/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters.png differ diff --git a/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_advanced.png b/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_advanced.png index 4fadb6b..1f2b0ee 100644 Binary files a/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_advanced.png and b/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_advanced.png differ diff --git a/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_enforced_vertices.png b/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_enforced_vertices.png index 4a76b1a..33996a6 100644 Binary files a/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_enforced_vertices.png and b/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_enforced_vertices.png differ diff --git a/doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc b/doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc index 9bc028a..481510c 100644 --- a/doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc +++ b/doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc @@ -3,11 +3,8 @@ \page blsurf_hypo_page BLSURF Parameters hypothesis \anchor blsurf_top -BLSURF Parameters hypothesis works only with \b DISTENE \b BLSurf 2d -algorithm. This algorithm is a commercial software. To obtain a -licence, visit http://www.distene.com/en/corp/eval-distene.html -\tableofcontents +\tableofcontents \section blsurf_general_parameters General parameters @@ -16,96 +13,88 @@ licence, visit http://www.distene.com/en/corp/eval-distene.html - Name - allows defining the name of the hypothesis (BLSURF Parameters_n by default). -- Physical Mesh - can be set to None, Custom - or Size Map +- Physical Mesh - can be set to None, Global size + or Local size - - if set to Custom, allows user input in the in User size, - Max Physical Size and Min Physical Size fields. + - if set to Global size, only the User size, + Max Size and Min Size fields are taken into account. - - if set to Size Map, behaves like Custom mode and takes into - account the custom elements sizes given in the Size Map tab. + - if set to Local size, behaves like Custom mode and takes into + account the "Gradation" parameter and the custom elements sizes given in the + "Local size" tab. -- User size - defines the size of the generated mesh elements. +- Geometrical mesh - can be set to None, Global size -- Max Physical Size - defines the upper limit of mesh element size. + - if set to Global size, allows user input in Mesh angle, + Mesh distance and Gradation fields. These fields control + computation of the element size, so called geometrical size, conform + to the surface geometry considering local curvatures. If both the User size + and the geometrical parameters are defined, the eventual element size + corresponds to the least of the two. -- Min Physical Size - defines the lower limit of mesh element size. +- User size - defines the size of the generated mesh elements. If "Relative value" +is checked, the value is relative to the diagonal of the shape. -- Geometrical mesh - if set to Custom, allows user input in -Angle Mesh S, Angle Mesh C and Gradation -fields. These fields control computation of the element size, so -called geometrical size, conform to the surface geometry -considering local curvatures. If both the User size and the -geometrical size are defined, the eventual element size -corresponds to the least of the two. +- Max Size - defines the upper limit of mesh element size. If "Relative value" +is checked, the value is relative to the diagonal of the shape. -- Angle Mesh S - maximum angle between the mesh face and the -tangent to the geometrical surface at each mesh node, in degrees. +- Min Size - defines the lower limit of mesh element size. If "Relative value" +is checked, the value is relative to the diagonal of the shape. -- Angle Mesh C - maximum angle between the mesh edge and the -tangent to the geometrical curve at each mesh node, in degrees. +- Gradation - maximum ratio between the lengths of two adjacent edges. -- Max Geometrical Size - defines the upper limit of the - geometrical size. +- Quadratic mesh - if checked, quadratic elements will be generated. -- Min Geometrical Size - defines the lower limit of the - geometrical size. +- Mesh angle - Limiting angle (in degree) between the plane of a triangle of the mesh and each of the tangent planes at the three vertices. +The smaller this angle is, the closer the mesh is to the exact surface, and the denser the resulting mesh is. -- Gradation - maximum ratio between the lengths of two adjacent - edges. +- Mesh distance - Maximum desired distance between a triangle and its supporting CAD surface. +The smaller this distance is, the closer the mesh is to the exact surface (only available in isotropic meshing). -- Allow Quadrangles - if checked, allows the creation of - quadrilateral elements. +- Anisotropic - if checked, this parameter defines the maximum anisotropic ratio of the metric governing the anisotropic meshing process. +The default value (0) means that the metric (and thus the generated elements) can be arbitrarily stretched. -- Patch independent - if checked, geometrical edges are not -respected and all geometrical faces are meshed as one hyper-face. +- Remove tiny edges - if checked, the tiny (nano) edges are removed from the generated mesh. +The tiny edge value defines the minimal length under which an edge is considered to be a tiny one. -\ref blsurf_top "Back to top" +- Remove bad elements - if checked, the bad elements (slivers) are removed from the generated mesh. +The bad element value defines the aspect ratio triggering the "bad element” classification. -\section blsurf_advanced_parameters Advanced parameters +- Mesh optimisation - if checked, the mesh will be optimized in order to get better shaped elements. -The notion of diag used in the descriptions means the diagonal -of the bounding box of the geometrical object to mesh. +- Allow Quadrangles - if checked, allows the creation of quadrilateral elements. -\image html blsurf_parameters_advanced.png - -- Verbosity level - defines the percentage of "verbosity" of -BLSURF [0-100]. +\ref blsurf_top "Back to top" -- Topology - allows creation of a conform mesh on a shell of -not sewed faces. The following choices are allowed: +\section blsurf_advanced_parameters Advanced parameters - - "From CAD" means that mesh conformity is assured by conformity - of a shape. +The notion of diag used in the descriptions means the diagonal of the bounding box of the geometrical object to mesh. - - "Pre-process" and "Pre-process++" allow the BLSURF software to - pre-process the geometrical model to eventually produce a conform - mesh. +\image html blsurf_parameters_advanced.png - - "PreCAD" is an auxiliary CAD pre-processing module which has - two main goals: +- PreCAD options -if checked, the PreCAD module will be used. This module has +two main goals: - - Complete missing or inadequate CAD descriptions. + - Complete missing or inadequate CAD descriptions. - - Perform topology reconstruction and specific geometry - enhancement for mesh generation. + - Perform topology reconstruction and specific geometry + enhancement for mesh generation. - \n This module requires a specific licence. The following PreCAD - options are the most significant and important ones: + \n This module requires a specific licence. The following PreCAD + options are the most significant and important ones: - Merge Edges - allows PreCAD to optimize the geometry by merging some - edges. This option is 0 by default. + edges. This option is checked by default. - - Remove nano edges - allows PreCAD to optimize the geometry by removing - the nano edges whenever possible. This option is 0 by default. - - - Nano edge length - gives the length below which an edge is considered as nano - for the topology processing. See also the \b remove_nano_edges option. If unset, PreCAD - default value is \f$\mathrm{diag} \times 10^{-5}\f$. + - Process 3D topology - allows PreCAD to perform the cleanup processing. + This option is checked by default. - Discard input topology - computes the CAD topology from scratch, without considering the topological information contained in the original CAD - (useful for iges files). This option is 0 by default. + (useful for iges files). This option is unchecked by default. + +- Verbosity level - defines the percentage of "verbosity" of +MeshGems-CADSurf and MeshGems-PreCAD [0-100]. - ExportGMF - saves the computed mesh into a GMF file (.mesh or .meshb). @@ -117,27 +106,14 @@ possible to input the value of the option and edit it later. The following BLSURF options are commonly usable: -- \b topo_eps1 (real) - is the tolerance level inside a CAD -patch. By default is equal to \f$\mathrm{diag} \times 10^{-4}\f$. This tolerance is used to -identify nodes to merge within one geometrical face when \b Topology -option is to pre-process. - -- \b topo_eps2 (real) - is the tolerance level between two CAD -patches. By default is equal to \f$\mathrm{diag} \times 10^{-4}\f$. This tolerance is used to -identify nodes to merge over different geometrical faces when -\b Topology option is to pre-process. - -- \b LSS (real) - is an abbreviation for "length of sub-segment". It is -a maximal allowed length of a mesh edge. Default is \f$0.5\f$. - - \b frontal (integer) - 1 - the mesh generator inserts points with an advancing front method. - - 0 - it inserts them with an algebraic method (on internal edges). This method is + - 0 - it inserts them with an algebraic method (on internal edges). This method is slightly faster but generates less regular meshes. - \n Default is 0. + \n Default is 1. - \anchor blsurf_hinterpol_flag \b hinterpol_flag (integer) - determines the computation of an interpolated value v between two points P1 and P2 on a @@ -164,115 +140,57 @@ values: \n Default is 0. -- \b CheckAdjacentEdges, \b CheckCloseEdges and \b CheckWellDefined -(integers) - give the number of calls of equally named subroutines the -purpose of which is to improve the mesh of domains having narrow -parts. At each iteration,\b CheckCloseEdges decreases the sizes of the -edges when two boundary curves are neighboring,\b CheckAdjacentEdges -balances the sizes of adjacent edges, and \b CheckWellDefined checks if -the parametric domain is well defined. Default values are 0. +The following PreCAD options are commonly usable. + +- \b closed_geometry (boolean) - describes whether the working geometry +should be closed or not. When activated, this option helps PreCAD to process +the dirtiest geometries. By default this option is 0. + +- \b create_tag_collision (boolean) - creates new tags from original ones in case +of collision (entity merge or association for example). By default +this option is 1. -- \b CoefRectangle (real)- defines the relative thickness of the rectangles -used by subroutine \b CheckCloseEdges (see above). Default is 0.25. +- \b debug (bool) - If debug = 1 PreCAD will be very verbose and will output +some intermediate files in the working directory. By default this +option is 0. -- \b eps_collapse (real) - if more than 0.0, BLSURF removes -curves whose lengths are less than \b eps_collapse. To obtain an -approximate value of the length of a curve, it is arbitrarily -split into 20 edges. Default is 0.0. +- \b manifold_geometry (int) - describes whether the working geometry should be manifold or not. +When activated, this option helps PreCAD to process the dirtiest +geometries. By default this option is 0. -- \b eps_ends (real) - is used to detect the curves whose lengths are very -small, that sometimes constitutes an error. A message is printed -if \f$\left|P2-P1\right| < eps\_ends\f$, where P1 and P2 are the -extremities of a curve. Default is \f$\frac{\mathrm{diag}}{500.0}\f$. +- \b periodic_tolerance (real) - defines the maximum distance error accepted between +two sets of periodic entities. By default this option is \f$\mathrm{diag} \times 10^{-5}\f$. -- \b prefix (char) - is a prefix of the files generated by -BLSURF. Default is "x". +- \b remove_tiny_edges (boolean) -optimize the geometry by removing the nano edges whenever possible. +By default this option is 0. -- \b refs (integer) - reference of a surface, used when exporting -files. Default is 1. +- \b required_entities (char) -controls the correction operations. Possible values are: -The following PreCAD options are commonly usable. + - "respect" - PreCAD is not allowed to correct or optimize a required edge. -- \b closed_geometry (int) - describes whether the working geometry -should be closed or not. When activated, this option helps PreCAD to process -the dirtiest geometries. By default this option is 0. + - "ignore" - PreCAD is allowed to correct a required edge. -- \b debug (int) - If debug = 1 PreCAD will be very verbose and will output -some intermediate files in the working directory. By default this -option is 0. + - "clear" - PreCAD will erase "required" status of each required entities, and will thus + be allowed to correct a required edge. -- \b eps_nano_relative (real) - the same as \b eps_nano, but relatively to -the diagonal of the box bounding the geometry. By default this option is \f$10^{-5}\f$. + \n By default this option is "respect". -- \b eps_sewing (real) - tolerance of the assembly. It rarely requires to be tuned. +- \b sewing_tolerance (real) - tolerance of the assembly. It rarely requires to be tuned. By default this option is \f$\mathrm{diag} \times 5 \cdot 10^{-4}\f$. -- \b eps_sewing_relative (real) - the same as \b eps_nano but relatively to -the diagonal of the box bounding the geometry. By default this option -is \f$5 \cdot 10^{-4}\f$. +- \b tags (char) -controls the optimisation process. Possible values are: -- \b manifold_geometry (int) - describes whether the working geometry should be manifold or not. -When activated, this option helps PreCAD to process the dirtiest -geometries. By default this option is 0. + - "respect" - PreCAD is not allowed to cross the CAD attributes boundaries for optimisation purpose. -- \b create_tag_collision (int) - creates new tags from original ones in case -of collision (entity merge or association for example). By default -this option is 0. + - "ignore" - PreCAD is allowed to cross the CAD attributes boundaries for optimisation. -- \b periodic_tolerance (real) - defines the maximum distance error accepted between -two sets of periodic entities. By default this option is \f$\mathrm{diag} \times 10^{-5}\f$. + - "clear" - PreCAD will erase each tgas of each entities, and will thus + be allowed to cross the CAD attributes boundaries in its optimisation purpose. -- \b periodic_tolerance_relative (real) - the same as \b periodic_tolerance but in a relative unit. -By default this option is \f$10^{-5}\f$. + \n By default this option is "respect". -- \b periodic_split_tolerance (real) - This periodicity processing related option defines -the minimum distance between a CAD point and an imprinted point. It allows to indirectly -control the number of created points and small edges. By default this -option is \f$\mathrm{diag} \times 10^{-4}\f$. - -- \b periodic_split_tolerance_relative (real - the same as \b -periodic_split_tolerance but in a relative unit. By default this -option is \f$10^{-4}\f$. - -The following advanced options are not documented and you can use them -at your own risk. - -- Integer variables: - - addsurf_ivertex - - anisotropic - - background - - coiter - - communication - - decim - - export_flag - - file_h - - gridnu - - gridnv - - intermedfile - - memory - - normals - - optim - - pardom_flag - - pinch - - rigid - - surforient - - tconf - - topo_collapse -- Real variables: - - addsurf_angle - - addsurf_R - - addsurf_H - - addsurf_FG - - addsurf_r - - addsurf_PA - - angle_compcurv - - angle_ridge - - anisotropic_ratio - - eps_pardom -- String variables: - - export_format - - export_option - - import_option +- \b tiny_edge_length (real) - the length below which en edge is considered as nano for the topology processing. +By default this option is \f$10^{-5}\f$. \ref blsurf_top "Back to top" @@ -432,6 +350,9 @@ The enforced vertex is the projection of a point defined by its - If a group name is specified : If the group exists, the enforced nodes will be added in the existing group, if the group does not exist it will be created. +All the internal vertices of the faces can be considered as enforced vertices if the corresponding checkbox is checked. +A group can optionnaly be defined on those enforced vertices. + \sa Sample TUI Script of the \ref tui_blsurf "creation of a BLSurf hypothesis", including enforced vertices. \ref blsurf_top "Back to top" diff --git a/doc/salome/gui/BLSURFPLUGIN/input/index.doc b/doc/salome/gui/BLSURFPLUGIN/input/index.doc index 3a35d84..83ea929 100644 --- a/doc/salome/gui/BLSURFPLUGIN/input/index.doc +++ b/doc/salome/gui/BLSURFPLUGIN/input/index.doc @@ -7,7 +7,7 @@ used within the SALOME Mesh module for generation of 2D mesh. \note BLSURFPLUGIN plugin uses DISTENE BLSurf commercial meshing software and requires a license at the run time (to work within the -Mesh module). +Mesh module). To obtain a licence, visit http://www.distene.com/en/corp/eval-distene.html \b BLSURFPLUGIN plugin is destined for: - Meshing of the 2D geometric entities. diff --git a/idl/BLSURFPlugin_Algorithm.idl b/idl/BLSURFPlugin_Algorithm.idl index d26ce56..1cd1cd9 100644 --- a/idl/BLSURFPlugin_Algorithm.idl +++ b/idl/BLSURFPlugin_Algorithm.idl @@ -122,14 +122,6 @@ module BLSURFPlugin */ interface BLSURFPlugin_Hypothesis : SMESH::SMESH_Hypothesis { - /*! - * Sets topology usage way defining how mesh conformity is assured - * value=0 - mesh conformity is assured by conformity of a shape - * value=1,2 - mesh conformity is assured by pre-processing a CAD model - * value=3 - mesh conformity is assured by pre-processing a CAD model with Pre-CAD - */ - void SetTopology(in long way); - long GetTopology(); /*! * Sets a way to define size of mesh elements to generate @@ -140,73 +132,128 @@ module BLSURFPlugin void SetPhysicalMesh(in long isCustom); long GetPhysicalMesh(); + /*! + * Sets a way to define maximum angular deflection of mesh from CAD model + * 0 - deflection is defined automatically + * 1 - deflection is set by SetAngleMesh() method + * 2 - deflection is set by SetAngleMesh() method. A sizemap is defined (TODO). + */ + void SetGeometricMesh(in long isCustom); + long GetGeometricMesh(); + /*! * Sets size of mesh elements to generate */ void SetPhySize(in double size); + void SetPhySizeRel(in double size); double GetPhySize(); + boolean IsPhySizeRel(); /*! - * Sets lower boundary of mesh element size (PhySize) + * Sets lower boundary of mesh element size */ - void SetPhyMin(in double theMinSize); - double GetPhyMin(); + void SetMinSize(in double theMinSize); + void SetMinSizeRel(in double theMinSize); + double GetMinSize(); + boolean IsMinSizeRel(); /*! - * Sets upper boundary of mesh element size (PhySize) + * Sets upper boundary of mesh element size */ - void SetPhyMax(in double theMaxSize); - double GetPhyMax(); + void SetMaxSize(in double theMaxSize); + void SetMaxSizeRel(in double theMaxSize); + double GetMaxSize(); + boolean IsMaxSizeRel(); /*! - * Sets a way to define maximum angular deflection of mesh from CAD model - * 0 - deflection is defined automatically - * 1 - deflection is set by SetAngleMeshS() and SetAngleMeshC() methods + * Sets maximal allowed ratio between the lengths of two adjacent edges */ - void SetGeometricMesh(in long isCustom); - long GetGeometricMesh(); + void SetGradation(in double ratio); + double GetGradation(); /*! - * Sets angular deflection (in degrees) of a mesh face from CAD surface + * Sets to create quadrilateral elements or not */ - void SetAngleMeshS(in double angle); - double GetAngleMeshS(); + void SetQuadAllowed(in boolean allowed); + boolean GetQuadAllowed(); /*! - * Sets angular deflection (in degrees) of a mesh edge from CAD curve + * Sets angular deflection (in degrees) of a mesh face and edge from CAD surface */ - void SetAngleMeshC(in double angle); - double GetAngleMeshC(); + void SetAngleMesh(in double angle); + double GetAngleMesh(); /*! - * Sets lower boundary of mesh element size computed to respect angular deflection + * Sets the maximum desired distance between a triangle and its supporting CAD surface */ - void SetGeoMin(in double theMinSize); - double GetGeoMin(); + void SetChordalError(in double distance); + double GetChordalError(); /*! - * Sets upper boundary of mesh element size computed to respect angular deflection + * Determines whether the generated mesh will be isotropic or anisotropic */ - void SetGeoMax(in double theMaxSize); - double GetGeoMax(); + void SetAnisotropic(in boolean anisotropic); + boolean GetAnisotropic(); /*! - * Sets maximal allowed ratio between the lengths of two adjacent edges + * Defines the maximum anisotropic ratio of the metric governing the anisotropic process. + * The default value of 0 means that the metric (and thus the generated elements) + * can be arbitrarily stretched. */ - void SetGradation(in double ratio); - double GetGradation(); + void SetAnisotropicRatio(in double ratio); + double GetAnisotropicRatio(); /*! - * Sets to create quadrilateral elements or not + * This patch-independent correction option can be activated to remove the tiny + * (nano) edges from the generated mesh, without taking into account the tags + * (attributes) specifications. */ - void SetQuadAllowed(in boolean allowed); - boolean GetQuadAllowed(); + void SetRemoveTinyEdges(in boolean remove); + boolean GetRemoveTinyEdges(); /*! - * To respect geometrical edges or not + * Defines the minimal length under which an edge is considered to be a tiny one */ - void SetDecimesh(in boolean toIgnoreEdges); - boolean GetDecimesh(); + void SetTinyEdgeLength(in double length); + double GetTinyEdgeLength(); + + /*! + * This patch independent correction option can be activated to remove the bad + * elements (often called slivers) from the generated mesh, without taking into account + * the tags (attributes) specification. + */ + void SetBadElementRemoval(in boolean remove); + boolean GetBadElementRemoval(); + + /*! + * This parameter defines the aspect ratio triggering the "bad element" + * classification for the force bad surface element removal option. + */ + void SetBadElementAspectRatio(in double ratio); + double GetBadElementAspectRatio(); + + /*! + * If this option is activated, MeshGems-CADSurf will optimize the mesh in order to + * get better shaped elements, during a process which respects the patch independent options. + * This optimisation cannot be fully performed when correct_surface_intersections = 1. + */ + void SetOptimizeMesh(in boolean optimize); + boolean GetOptimizeMesh(); + + /*! + * Determines the order of mesh elements to be generated (linear or quadratic) + */ + void SetQuadraticMesh(in boolean quadratic); + boolean GetQuadraticMesh(); + + /*! + * Sets topology usage way defining how mesh conformity is assured + * value=0 - mesh conformity is assured by conformity of a shape + * value=1,2 - mesh conformity is assured by pre-processing a CAD model (OBSOLETE) + * value=3 - mesh conformity is assured by pre-processing a CAD model with Pre-CAD + */ + void SetTopology(in long way); + long GetTopology(); /*! * Sets verbosity level in the range 0 to 100. @@ -221,10 +268,11 @@ module BLSURFPlugin boolean GetPreCADMergeEdges(); /*! - * To remove nano edges. + * To process 3D topology. */ - void SetPreCADRemoveNanoEdges(in boolean toRemoveNanoEdges); - boolean GetPreCADRemoveNanoEdges(); + void SetPreCADProcess3DTopology(in boolean toProcess); + boolean GetPreCADProcess3DTopology(); + /*! * To compute topology from scratch @@ -232,13 +280,6 @@ module BLSURFPlugin void SetPreCADDiscardInput(in boolean toDiscardInput); boolean GetPreCADDiscardInput(); - /*! - * Sets the length below which an edge is considered as nano - * for the topology processing. - */ - void SetPreCADEpsNano(in double epsNano); - double GetPreCADEpsNano(); - /*! * Sets advanced option value */ @@ -282,12 +323,14 @@ module BLSURFPlugin * Set/unset a SizeMap on geom object */ void SetSizeMap(in GEOM::GEOM_Object GeomObj, in string sizeMap); + void SetConstantSizeMap(in GEOM::GEOM_Object GeomObj, in double sizeMap); void UnsetSizeMap(in GEOM::GEOM_Object GeomObj); /*! * Set a SizeMap on geom object given by entry */ void SetSizeMapEntry(in string entry, in string sizeMap); + void SetConstantSizeMapEntry(in string entry, in GEOM::shape_type shapeType, in double sizeMap); string GetSizeMapEntry(in string entry); string_array GetSizeMapEntries(); @@ -390,6 +433,28 @@ module BLSURFPlugin void SetGMFFile(in string theFileName); string GetGMFFile(); // boolean GetGMFFileMode(); + + // + // Obsolete methods - To be removed in V7 + // + void SetPhyMin(in double theMinSize); + double GetPhyMin(); + void SetPhyMax(in double theMaxSize); + double GetPhyMax(); + void SetGeoMin(in double theMinSize); + double GetGeoMin(); + void SetGeoMax(in double theMaxSize); + double GetGeoMax(); + void SetAngleMeshS(in double angle); + double GetAngleMeshS(); + void SetAngleMeshC(in double angle); + double GetAngleMeshC(); + void SetDecimesh(in boolean toIgnoreEdges); + boolean GetDecimesh(); + void SetPreCADRemoveNanoEdges(in boolean toRemoveNanoEdges); + boolean GetPreCADRemoveNanoEdges(); + void SetPreCADEpsNano(in double epsNano); + double GetPreCADEpsNano(); }; }; diff --git a/resources/BLSURFPlugin.xml b/resources/BLSURFPlugin.xml index 7eb2e41..93cbaf7 100644 --- a/resources/BLSURFPlugin.xml +++ b/resources/BLSURFPlugin.xml @@ -66,13 +66,14 @@ BLSURF=Triangle(algo=smesh.BLSURF) BLSURF_Parameters=Parameters() + ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges()) diff --git a/src/BLSURFPlugin/BLSURFPluginDC.py b/src/BLSURFPlugin/BLSURFPluginDC.py index 791744e..c7b5568 100644 --- a/src/BLSURFPlugin/BLSURFPluginDC.py +++ b/src/BLSURFPlugin/BLSURFPluginDC.py @@ -28,16 +28,18 @@ from smesh import AssureGeomPublished FromCAD, PreProcess, PreProcessPlus, PreCAD = 0,1,2,3 # Element size flag of BLSURF -DefaultSize, DefaultGeom, BLSURF_Custom, SizeMap = 0,0,1,2 +DefaultSize, DefaultGeom, BLSURF_GlobalSize, BLSURF_LocalSize = 0,0,1,2 +# Retrocompatibility +BLSURF_Custom, SizeMap = BLSURF_GlobalSize, BLSURF_LocalSize # import BLSURFPlugin module if possible noBLSURFPlugin = 0 try: - import BLSURFPlugin + import BLSURFPlugin except ImportError: - noBLSURFPlugin = 1 - pass + noBLSURFPlugin = 1 + pass #---------------------------- # Mesh algo type identifiers @@ -56,333 +58,432 @@ BLSURF = "BLSURF" # class BLSURF_Algorithm(Mesh_Algorithm): - ## name of the dynamic method in smesh.Mesh class - # @internal - meshMethod = "Triangle" - ## type of algorithm used with helper function in smesh.Mesh class - # @internal - algoType = BLSURF - ## doc string of the method - # @internal - docHelper = "Creates triangle 2D algorithm for faces" - - _angleMeshS = 8 - _gradation = 1.1 - - ## 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 noBLSURFPlugin: - print "Warning: BLSURFPlugin module unavailable" - self.Create(mesh, geom, BLSURF, "libBLSURFEngine.so") - self.params=None - #self.SetPhysicalMesh() - PAL19680 - pass - - ## Sets a way to define size of mesh elements to generate. - # @param thePhysicalMesh is: DefaultSize, BLSURF_Custom or SizeMap. - def SetPhysicalMesh(self, thePhysicalMesh=DefaultSize): - self.Parameters().SetPhysicalMesh(thePhysicalMesh) - pass - - ## Sets size of mesh elements to generate. - # @param theVal value of mesh element size - def SetPhySize(self, theVal): - self.Parameters().SetPhySize(theVal) - pass - - ## Sets lower boundary of mesh element size (PhySize). - # @param theVal value of mesh element minimal size - def SetPhyMin(self, theVal=-1): - self.Parameters().SetPhyMin(theVal) - pass - - ## Sets upper boundary of mesh element size (PhySize). - # @param theVal value of mesh element maximal size - def SetPhyMax(self, theVal=-1): - self.Parameters().SetPhyMax(theVal) - pass - - ## Sets a way to define maximum angular deflection of mesh from CAD model. - # @param theGeometricMesh is: 0 (None) or 1 (Custom) - def SetGeometricMesh(self, theGeometricMesh=0): - if self.Parameters().GetPhysicalMesh() == 0: theGeometricMesh = 1 - self.Parameters().SetGeometricMesh(theGeometricMesh) - pass - - ## Sets angular deflection (in degrees) of a mesh face from CAD surface. - # @param theVal value of angular deflection for mesh face - def SetAngleMeshS(self, theVal=_angleMeshS): - if self.Parameters().GetGeometricMesh() == 0: theVal = self._angleMeshS - self.Parameters().SetAngleMeshS(theVal) - pass - - ## Sets angular deflection (in degrees) of a mesh edge from CAD curve. - # @param theVal value of angular deflection for mesh edge - def SetAngleMeshC(self, theVal=_angleMeshS): - if self.Parameters().GetGeometricMesh() == 0: theVal = self._angleMeshS - self.Parameters().SetAngleMeshC(theVal) - pass - - ## Sets lower boundary of mesh element size computed to respect angular deflection. - # @param theVal value of mesh element minimal size - def SetGeoMin(self, theVal=-1): - self.Parameters().SetGeoMin(theVal) - pass - - ## Sets upper boundary of mesh element size computed to respect angular deflection. - # @param theVal value of mesh element maximal size - def SetGeoMax(self, theVal=-1): - self.Parameters().SetGeoMax(theVal) - pass - - ## Sets maximal allowed ratio between the lengths of two adjacent edges. - # @param theVal value of maximal length ratio - def SetGradation(self, theVal=_gradation): - if self.Parameters().GetGeometricMesh() == 0: theVal = self._gradation - self.Parameters().SetGradation(theVal) - pass - - ## Sets topology usage way. - # @param way defines how mesh conformity is assured - # - FromCAD - mesh conformity is assured by conformity of a shape - # - PreProcess or PreProcessPlus - by pre-processing a CAD model - # - PreCAD - by pre-processing with PreCAD a CAD model - def SetTopology(self, way): - self.Parameters().SetTopology(way) - pass - - ## To respect geometrical edges or not. - # @param toIgnoreEdges "ignore edges" flag value - def SetDecimesh(self, toIgnoreEdges=False): - self.Parameters().SetDecimesh(toIgnoreEdges) - pass - - ## Sets verbosity level in the range 0 to 100. - # @param level verbosity level - def SetVerbosity(self, level): - self.Parameters().SetVerbosity(level) - pass - - ## To optimize merges edges. - # @param toMergeEdges "merge edges" flag value - def SetPreCADMergeEdges(self, toMergeEdges=False): - self.Parameters().SetPreCADMergeEdges(toMergeEdges) - pass - - ## To remove nano edges. - # @param toRemoveNanoEdges "remove nano edges" flag value - def SetPreCADRemoveNanoEdges(self, toRemoveNanoEdges=False): - self.Parameters().SetPreCADRemoveNanoEdges(toRemoveNanoEdges) - pass - - ## To compute topology from scratch - # @param toDiscardInput "discard input" flag value - def SetPreCADDiscardInput(self, toDiscardInput=False): - self.Parameters().SetPreCADDiscardInput(toDiscardInput) - pass - - ## Sets the length below which an edge is considered as nano - # for the topology processing. - # @param epsNano nano edge length threshold value - def SetPreCADEpsNano(self, epsNano): - self.Parameters().SetPreCADEpsNano(epsNano) - pass - - ## Sets advanced option value. - # @param optionName advanced option name - # @param level advanced option value - def SetOptionValue(self, optionName, level): - self.Parameters().SetOptionValue(optionName,level) - pass - - ## Sets advanced PreCAD option value. - # @param optionName name of the option - # @param optionValue value of the option - def SetPreCADOptionValue(self, optionName, optionValue): - self.Parameters().SetPreCADOptionValue(optionName,optionValue) - pass - - ## Sets GMF file for export at computation - # @param fileName GMF file name - def SetGMFFile(self, fileName): - self.Parameters().SetGMFFile(fileName) - pass - - #----------------------------------------- - # Enforced vertices (BLSURF) - #----------------------------------------- - - ## To get all the enforced vertices - def GetAllEnforcedVertices(self): - return self.Parameters().GetAllEnforcedVertices() - - ## To get all the enforced vertices sorted by face (or group, compound) - def GetAllEnforcedVerticesByFace(self): - return self.Parameters().GetAllEnforcedVerticesByFace() - - ## To get all the enforced vertices sorted by coords of input vertices - def GetAllEnforcedVerticesByCoords(self): - return self.Parameters().GetAllEnforcedVerticesByCoords() - - ## To get all the coords of input vertices sorted by face (or group, compound) - def GetAllCoordsByFace(self): - return self.Parameters().GetAllCoordsByFace() - - ## To get all the enforced vertices on a face (or group, compound) - # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex - def GetEnforcedVertices(self, theFace): - AssureGeomPublished( self.mesh, theFace ) - return self.Parameters().GetEnforcedVertices(theFace) - - ## To clear all the enforced vertices - def ClearAllEnforcedVertices(self): - return self.Parameters().ClearAllEnforcedVertices() - - ## To set an enforced vertex on a face (or group, compound) given the coordinates of a point. If the point is not on the face, it will projected on it. If there is no projection, no enforced vertex is created. - # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex - # @param x : x coordinate - # @param y : y coordinate - # @param z : z coordinate - # @param vertexName : name of the enforced vertex - # @param groupName : name of the group - def SetEnforcedVertex(self, theFace, x, y, z, vertexName = "", groupName = ""): - AssureGeomPublished( self.mesh, theFace ) - if vertexName == "": - if groupName == "": - return self.Parameters().SetEnforcedVertex(theFace, x, y, z) - else: - return self.Parameters().SetEnforcedVertexWithGroup(theFace, x, y, z, groupName) - pass - else: - if groupName == "": - return self.Parameters().SetEnforcedVertexNamed(theFace, x, y, z, vertexName) - else: - return self.Parameters().SetEnforcedVertexNamedWithGroup(theFace, x, y, z, vertexName, groupName) - pass - pass - - ## To set an enforced vertex on a face (or group, compound) given a GEOM vertex, group or compound. - # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex - # @param theVertex : GEOM vertex (or group, compound) to be projected on theFace. - # @param groupName : name of the group - def SetEnforcedVertexGeom(self, theFace, theVertex, groupName = ""): - AssureGeomPublished( self.mesh, theFace ) - AssureGeomPublished( self.mesh, theVertex ) - if groupName == "": - return self.Parameters().SetEnforcedVertexGeom(theFace, theVertex) - else: - return self.Parameters().SetEnforcedVertexGeomWithGroup(theFace, theVertex,groupName) - pass - - ## To remove an enforced vertex on a given GEOM face (or group, compound) given the coordinates. - # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex - # @param x : x coordinate - # @param y : y coordinate - # @param z : z coordinate - def UnsetEnforcedVertex(self, theFace, x, y, z): - AssureGeomPublished( self.mesh, theFace ) - return self.Parameters().UnsetEnforcedVertex(theFace, x, y, z) - - ## To remove an enforced vertex on a given GEOM face (or group, compound) given a GEOM vertex, group or compound. - # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex - # @param theVertex : GEOM vertex (or group, compound) to remove. - def UnsetEnforcedVertexGeom(self, theFace, theVertex): - AssureGeomPublished( self.mesh, theFace ) - AssureGeomPublished( self.mesh, theVertex ) - return self.Parameters().UnsetEnforcedVertexGeom(theFace, theVertex) - - ## To remove all enforced vertices on a given face. - # @param theFace : face (or group/compound of faces) on which to remove all enforced vertices - def UnsetEnforcedVertices(self, theFace): - AssureGeomPublished( self.mesh, theFace ) - return self.Parameters().UnsetEnforcedVertices(theFace) - - ## To tell BLSURF to add a node on internal vertices - # @param toEnforceInternalVertices : boolean; if True the internal vertices are added as enforced vertices - def SetInternalEnforcedVertexAllFaces(self, toEnforceInternalVertices): - return self.Parameters().SetInternalEnforcedVertexAllFaces(toEnforceInternalVertices) - - ## To know if BLSURF will add a node on internal vertices - def GetInternalEnforcedVertexAllFaces(self): - return self.Parameters().GetInternalEnforcedVertexAllFaces() - - ## To define a group for the nodes of internal vertices - # @param groupName : string; name of the group - def SetInternalEnforcedVertexAllFacesGroup(self, groupName): - return self.Parameters().SetInternalEnforcedVertexAllFacesGroup(groupName) - - ## To get the group name of the nodes of internal vertices - def GetInternalEnforcedVertexAllFacesGroup(self): - return self.Parameters().GetInternalEnforcedVertexAllFacesGroup() - - #----------------------------------------- - # Attractors - #----------------------------------------- - - ## Sets an attractor on the chosen face. The mesh size will decrease exponentially with the distance from theAttractor, following the rule h(d) = theEndSize - (theEndSize - theStartSize) * exp [ - ( d / theInfluenceDistance ) ^ 2 ] - # @param theFace : face on which the attractor will be defined - # @param theAttractor : geometrical object from which the mesh size "h" decreases exponentially - # @param theStartSize : mesh size on theAttractor - # @param theEndSize : maximum size that will be reached on theFace - # @param theInfluenceDistance : influence of the attractor ( the size grow slower on theFace if it's high) - # @param theConstantSizeDistance : distance until which the mesh size will be kept constant on theFace - def SetAttractorGeom(self, theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance): - AssureGeomPublished( self.mesh, theFace ) - AssureGeomPublished( self.mesh, theAttractor ) - self.Parameters().SetAttractorGeom(theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance) - pass - - ## Unsets an attractor on the chosen face. - # @param theFace : face on which the attractor has to be removed - def UnsetAttractorGeom(self, theFace): - AssureGeomPublished( self.mesh, theFace ) - self.Parameters().SetAttractorGeom(theFace) - pass - - #----------------------------------------- - # Size maps (BLSURF) - #----------------------------------------- - - ## To set a size map on a face, edge or vertex (or group, compound) given Python function. - # If theObject is a face, the function can be: def f(u,v): return u+v - # If theObject is an edge, the function can be: def f(t): return t/2 - # If theObject is a vertex, the function can be: def f(): return 10 - # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map - # @param theSizeMap : Size map defined as a string - def SetSizeMap(self, theObject, theSizeMap): - AssureGeomPublished( self.mesh, theObject ) - self.Parameters().SetSizeMap(theObject, theSizeMap) - pass - - ## To remove a size map defined on a face, edge or vertex (or group, compound) - # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map - def UnsetSizeMap(self, theObject): - AssureGeomPublished( self.mesh, theObject ) - self.Parameters().UnsetSizeMap(theObject) - pass - - ## To remove all the size maps - def ClearSizeMaps(self): - self.Parameters().ClearSizeMaps() - pass - - ## Sets QuadAllowed flag. - # @param toAllow "allow quadrangles" flag value - def SetQuadAllowed(self, toAllow=True): - self.Parameters().SetQuadAllowed(toAllow) - pass - - ## Defines hypothesis having several parameters - # @return hypothesis object - def Parameters(self): - if not self.params: - self.params = self.Hypothesis("BLSURF_Parameters", [], - "libBLSURFEngine.so", UseExisting=0) - pass - return self.params - - pass # end of BLSURF_Algorithm class + ## name of the dynamic method in smesh.Mesh class + # @internal + meshMethod = "Triangle" + ## type of algorithm used with helper function in smesh.Mesh class + # @internal + algoType = BLSURF + ## doc string of the method + # @internal + docHelper = "Creates triangle 2D algorithm for faces" + + _anisotropic_ratio = 0 + _bad_surface_element_aspect_ratio = 1000 + _geometric_approximation = 22 + _gradation = 1.3 + _metric = "isotropic" + _remove_tiny_edges = 0 + + ## 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 noBLSURFPlugin: + print "Warning: BLSURFPlugin module unavailable" + self.Create(mesh, geom, BLSURF, "libBLSURFEngine.so") + self.params=None + #self.SetPhysicalMesh() - PAL19680 + pass + + ## Sets a way to define size of mesh elements to generate. + # @param thePhysicalMesh is: DefaultSize, BLSURF_Custom or SizeMap. + def SetPhysicalMesh(self, thePhysicalMesh=DefaultSize): + physical_size_mode = thePhysicalMesh + if self.Parameters().GetGeometricMesh() == DefaultGeom: + if physical_size_mode == DefaultSize: + physical_size_mode = BLSURF_GlobalSize + self.Parameters().SetPhysicalMesh(physical_size_mode) + pass + + ## Sets a way to define maximum angular deflection of mesh from CAD model. + # @param theGeometricMesh is: DefaultGeom (0)) or BLSURF_GlobalSize (1)) + def SetGeometricMesh(self, theGeometricMesh=DefaultGeom): + geometric_size_mode = theGeometricMesh + if self.Parameters().GetPhysicalMesh() == DefaultSize: + if geometric_size_mode == DefaultGeom: + geometric_size_mode = BLSURF_GlobalSize + self.Parameters().SetGeometricMesh(geometric_size_mode) + pass + + ## Sets size of mesh elements to generate. + # @param theVal : constant global size when using a global physical size. + # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box + def SetPhySize(self, theVal, isRelative = False): + if self.Parameters().GetPhysicalMesh() == DefaultSize: + self.SetPhysicalMesh(BLSURF_GlobalSize) + if isRelative: + self.Parameters().SetPhySizeRel(theVal) + else: + self.Parameters().SetPhySize(theVal) + pass + + ## Sets lower boundary of mesh element size. + # @param theVal : global minimal cell size desired. + # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box + def SetMinSize(self, theVal=-1, isRelative = False): + if isRelative: + self.Parameters().SetMinSizeRel(theVal) + else: + self.Parameters().SetMinSize(theVal) + pass + + ## Sets upper boundary of mesh element size. + # @param theVal : global maximal cell size desired. + # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box + def SetMaxSize(self, theVal=-1): + if isRelative: + self.Parameters().SetMaxSizeRel(theVal) + else: + self.Parameters().SetMaxSize(theVal) + pass + + ## Sets angular deflection (in degrees) from CAD surface. + # @param theVal value of angular deflection + def SetAngleMesh(self, theVal=_geometric_approximation): + if self.Parameters().GetGeometricMesh() == DefaultGeom: + self.SetGeometricMesh(BLSURF_GlobalSize) + self.Parameters().SetAngleMesh(theVal) + pass + + ## Sets maximal allowed ratio between the lengths of two adjacent edges. + # @param theVal value of maximal length ratio + def SetGradation(self, theVal=_gradation): + if self.Parameters().GetGeometricMesh() == 0: theVal = self._gradation + self.Parameters().SetGradation(theVal) + pass + + ## Sets topology usage way. + # @param way defines how mesh conformity is assured + def SetTopology(self, way): + if way != PreCAD: + print "Warning: topology mode %d is no longer supported. Mode FromCAD is used."%way + way = FromCAD + self.Parameters().SetTopology(way) + pass + + ## To respect geometrical edges or not. + # @param toIgnoreEdges "ignore edges" flag value + def SetDecimesh(self, toIgnoreEdges=False): + if toIgnoreEdges: + self.SetOptionValue("respect_geometry","0") + else: + self.SetOptionValue("respect_geometry","1") + pass + + ## Sets verbosity level in the range 0 to 100. + # @param level verbosity level + def SetVerbosity(self, level): + self.Parameters().SetVerbosity(level) + pass + + ## To optimize merges edges. + # @param toMergeEdges "merge edges" flag value + def SetPreCADMergeEdges(self, toMergeEdges=False): + if self.Parameters().GetTopology() != PreCAD: + self.SetTopology(PreCAD) + self.Parameters().SetPreCADMergeEdges(toMergeEdges) + pass + + ## To process 3D topology. + # @param toProcess "PreCAD process 3D" flag value + def SetPreCADProcess3DTopology(self, toProcess=False): + if self.Parameters().GetTopology() != PreCAD: + self.SetTopology(PreCAD) + self.Parameters().SetPreCADProcess3DTopology(toProcess) + pass + + ## To remove nano edges. + # @param toRemoveNanoEdges "remove nano edges" flag value + def SetPreCADRemoveNanoEdges(self, toRemoveNanoEdges=False): + if toRemoveNanoEdges: + self.SetPreCADOptionValue("remove_tiny_edges","1") + else: + self.SetPreCADOptionValue("remove_tiny_edges","0") + pass + + ## To compute topology from scratch + # @param toDiscardInput "discard input" flag value + def SetPreCADDiscardInput(self, toDiscardInput=False): + if self.Parameters().GetTopology() != PreCAD: + self.SetTopology(PreCAD) + self.Parameters().SetPreCADDiscardInput(toDiscardInput) + pass + + ## Sets the length below which an edge is considered as nano + # for the topology processing. + # @param epsNano nano edge length threshold value + def SetPreCADEpsNano(self, epsNano): + self.SetPreCADOptionValue("tiny_edge_length","%f"%epsNano) + pass + + ## Sets advanced option value. + # @param optionName advanced option name + # @param level advanced option value + def SetOptionValue(self, optionName, level): + self.Parameters().SetOptionValue(optionName,level) + pass + + ## Sets advanced PreCAD option value. + # @param optionName name of the option + # @param optionValue value of the option + def SetPreCADOptionValue(self, optionName, optionValue): + if self.Parameters().GetTopology() != PreCAD: + self.SetTopology(PreCAD) + self.Parameters().SetPreCADOptionValue(optionName,optionValue) + pass + + ## Sets GMF file for export at computation + # @param fileName GMF file name + def SetGMFFile(self, fileName): + self.Parameters().SetGMFFile(fileName) + pass + + #----------------------------------------- + # Enforced vertices (BLSURF) + #----------------------------------------- + + ## To get all the enforced vertices + def GetAllEnforcedVertices(self): + return self.Parameters().GetAllEnforcedVertices() + + ## To get all the enforced vertices sorted by face (or group, compound) + def GetAllEnforcedVerticesByFace(self): + return self.Parameters().GetAllEnforcedVerticesByFace() + + ## To get all the enforced vertices sorted by coords of input vertices + def GetAllEnforcedVerticesByCoords(self): + return self.Parameters().GetAllEnforcedVerticesByCoords() + + ## To get all the coords of input vertices sorted by face (or group, compound) + def GetAllCoordsByFace(self): + return self.Parameters().GetAllCoordsByFace() + + ## To get all the enforced vertices on a face (or group, compound) + # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex + def GetEnforcedVertices(self, theFace): + AssureGeomPublished( self.mesh, theFace ) + return self.Parameters().GetEnforcedVertices(theFace) + + ## To clear all the enforced vertices + def ClearAllEnforcedVertices(self): + return self.Parameters().ClearAllEnforcedVertices() + + ## To set an enforced vertex on a face (or group, compound) given the coordinates of a point. If the point is not on the face, it will projected on it. If there is no projection, no enforced vertex is created. + # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex + # @param x : x coordinate + # @param y : y coordinate + # @param z : z coordinate + # @param vertexName : name of the enforced vertex + # @param groupName : name of the group + def SetEnforcedVertex(self, theFace, x, y, z, vertexName = "", groupName = ""): + AssureGeomPublished( self.mesh, theFace ) + if vertexName == "": + if groupName == "": + return self.Parameters().SetEnforcedVertex(theFace, x, y, z) + else: + return self.Parameters().SetEnforcedVertexWithGroup(theFace, x, y, z, groupName) + pass + else: + if groupName == "": + return self.Parameters().SetEnforcedVertexNamed(theFace, x, y, z, vertexName) + else: + return self.Parameters().SetEnforcedVertexNamedWithGroup(theFace, x, y, z, vertexName, groupName) + pass + pass + + ## To set an enforced vertex on a face (or group, compound) given a GEOM vertex, group or compound. + # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex + # @param theVertex : GEOM vertex (or group, compound) to be projected on theFace. + # @param groupName : name of the group + def SetEnforcedVertexGeom(self, theFace, theVertex, groupName = ""): + AssureGeomPublished( self.mesh, theFace ) + AssureGeomPublished( self.mesh, theVertex ) + if groupName == "": + return self.Parameters().SetEnforcedVertexGeom(theFace, theVertex) + else: + return self.Parameters().SetEnforcedVertexGeomWithGroup(theFace, theVertex,groupName) + pass + + ## To remove an enforced vertex on a given GEOM face (or group, compound) given the coordinates. + # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex + # @param x : x coordinate + # @param y : y coordinate + # @param z : z coordinate + def UnsetEnforcedVertex(self, theFace, x, y, z): + AssureGeomPublished( self.mesh, theFace ) + return self.Parameters().UnsetEnforcedVertex(theFace, x, y, z) + + ## To remove an enforced vertex on a given GEOM face (or group, compound) given a GEOM vertex, group or compound. + # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex + # @param theVertex : GEOM vertex (or group, compound) to remove. + def UnsetEnforcedVertexGeom(self, theFace, theVertex): + AssureGeomPublished( self.mesh, theFace ) + AssureGeomPublished( self.mesh, theVertex ) + return self.Parameters().UnsetEnforcedVertexGeom(theFace, theVertex) + + ## To remove all enforced vertices on a given face. + # @param theFace : face (or group/compound of faces) on which to remove all enforced vertices + def UnsetEnforcedVertices(self, theFace): + AssureGeomPublished( self.mesh, theFace ) + return self.Parameters().UnsetEnforcedVertices(theFace) + + ## To tell BLSURF to add a node on internal vertices + # @param toEnforceInternalVertices : boolean; if True the internal vertices are added as enforced vertices + def SetInternalEnforcedVertexAllFaces(self, toEnforceInternalVertices): + return self.Parameters().SetInternalEnforcedVertexAllFaces(toEnforceInternalVertices) + + ## To know if BLSURF will add a node on internal vertices + def GetInternalEnforcedVertexAllFaces(self): + return self.Parameters().GetInternalEnforcedVertexAllFaces() + + ## To define a group for the nodes of internal vertices + # @param groupName : string; name of the group + def SetInternalEnforcedVertexAllFacesGroup(self, groupName): + return self.Parameters().SetInternalEnforcedVertexAllFacesGroup(groupName) + + ## To get the group name of the nodes of internal vertices + def GetInternalEnforcedVertexAllFacesGroup(self): + return self.Parameters().GetInternalEnforcedVertexAllFacesGroup() + + #----------------------------------------- + # Attractors + #----------------------------------------- + + ## Sets an attractor on the chosen face. The mesh size will decrease exponentially with the distance from theAttractor, following the rule h(d) = theEndSize - (theEndSize - theStartSize) * exp [ - ( d / theInfluenceDistance ) ^ 2 ] + # @param theFace : face on which the attractor will be defined + # @param theAttractor : geometrical object from which the mesh size "h" decreases exponentially + # @param theStartSize : mesh size on theAttractor + # @param theEndSize : maximum size that will be reached on theFace + # @param theInfluenceDistance : influence of the attractor ( the size grow slower on theFace if it's high) + # @param theConstantSizeDistance : distance until which the mesh size will be kept constant on theFace + def SetAttractorGeom(self, theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance): + AssureGeomPublished( self.mesh, theFace ) + AssureGeomPublished( self.mesh, theAttractor ) + self.Parameters().SetAttractorGeom(theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance) + pass + + ## Unsets an attractor on the chosen face. + # @param theFace : face on which the attractor has to be removed + def UnsetAttractorGeom(self, theFace): + AssureGeomPublished( self.mesh, theFace ) + self.Parameters().SetAttractorGeom(theFace) + pass + + #----------------------------------------- + # Size maps (BLSURF) + #----------------------------------------- + + ## To set a size map on a face, edge or vertex (or group, compound) given Python function. + # If theObject is a face, the function can be: def f(u,v): return u+v + # If theObject is an edge, the function can be: def f(t): return t/2 + # If theObject is a vertex, the function can be: def f(): return 10 + # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map + # @param theSizeMap : Size map defined as a string + def SetSizeMap(self, theObject, theSizeMap): + AssureGeomPublished( self.mesh, theObject ) + self.Parameters().SetSizeMap(theObject, theSizeMap) + pass + + ## To set a constant size map on a face, edge or vertex (or group, compound). + # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map + # @param theSizeMap : Size map defined as a double + def SetConstantSizeMap(self, theObject, theSizeMap): + AssureGeomPublished( self.mesh, theObject ) + self.Parameters().SetConstantSizeMap(theObject, theSizeMap) + + ## To remove a size map defined on a face, edge or vertex (or group, compound) + # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map + def UnsetSizeMap(self, theObject): + AssureGeomPublished( self.mesh, theObject ) + self.Parameters().UnsetSizeMap(theObject) + pass + + ## To remove all the size maps + def ClearSizeMaps(self): + self.Parameters().ClearSizeMaps() + pass + + ## Sets QuadAllowed flag. + # @param toAllow "allow quadrangles" flag value + def SetQuadAllowed(self, toAllow=True): + self.Parameters().SetQuadAllowed(toAllow) + pass + + ## Defines hypothesis having several parameters + # @return hypothesis object + def Parameters(self): + if not self.params: + self.params = self.Hypothesis("BLSURF_Parameters", [], + "libBLSURFEngine.so", UseExisting=0) + pass + return self.params + + #===================== + # Obsolete methods + #===================== + # + # SALOME 6.6.0 + # + + ## Sets lower boundary of mesh element size (PhySize). + def SetPhyMin(self, theVal=-1): + """ + Obsolete function. Use SetMinSize. + """ + print "Warning: SetPhyMin is obsolete. Please use SetMinSize" + self.SetMinSize(theVal) + pass + + ## Sets upper boundary of mesh element size (PhySize). + def SetPhyMax(self, theVal=-1): + """ + Obsolete function. Use SetMaxSize. + """ + print "Warning: SetPhyMax is obsolete. Please use SetMaxSize" + self.SetMaxSize(theVal) + pass + + ## Sets angular deflection (in degrees) of a mesh face from CAD surface. + def SetAngleMeshS(self, theVal=_geometric_approximation): + """ + Obsolete function. Use SetAngleMesh. + """ + print "Warning: SetAngleMeshS is obsolete. Please use SetAngleMesh" + self.SetAngleMesh(theVal) + pass + + ## Sets angular deflection (in degrees) of a mesh edge from CAD curve. + def SetAngleMeshC(self, theVal=_geometric_approximation): + """ + Obsolete function. Use SetAngleMesh. + """ + print "Warning: SetAngleMeshC is obsolete. Please use SetAngleMesh" + self.SetAngleMesh(theVal) + pass + + ## Sets lower boundary of mesh element size computed to respect angular deflection. + def SetGeoMin(self, theVal=-1): + """ + Obsolete function. Use SetMinSize. + """ + print "Warning: SetGeoMin is obsolete. Please use SetMinSize" + self.SetMinSize(theVal) + pass + + ## Sets upper boundary of mesh element size computed to respect angular deflection. + def SetGeoMax(self, theVal=-1): + """ + Obsolete function. Use SetMaxSize. + """ + print "Warning: SetGeoMax is obsolete. Please use SetMaxSize" + self.SetMaxSize(theVal) + pass + + + pass # end of BLSURF_Algorithm class \ No newline at end of file diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index e834c58..01cc508 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -28,9 +28,9 @@ #include "BLSURFPlugin_Attractor.hxx" extern "C"{ -#include -#include -#include +#include +#include +#include } #include @@ -39,6 +39,7 @@ extern "C"{ #include #include +#include #include #include #include @@ -46,6 +47,7 @@ extern "C"{ #include #include #include +#include #include @@ -56,48 +58,42 @@ extern "C"{ #include // OPENCASCADE includes +#include +#include +//#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include +#include +#include #include -#include - -#include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include #include - -#include -#include -#include #include -#include -#include -#include - -#include -#include -#include +#include +#include +#include +#include +#include +#include #ifndef WNT #include #endif -#include -#include -#include -#include -#include -// #include -#include - /* ================================== * =========== PYTHON ============== * ==================================*/ @@ -244,6 +240,7 @@ BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId, int studyId, _name = "BLSURF"; _shapeType = (1 << TopAbs_FACE); // 1 bit /shape type _compatibleHypothesis.push_back(BLSURFPlugin_Hypothesis::GetHypType()); + _compatibleHypothesis.push_back(StdMeshers_ViscousLayers2D::GetHypType()); _requireDiscreteBoundary = false; _onlyUnaryInput = false; _hypothesis = NULL; @@ -319,38 +316,42 @@ bool BLSURFPlugin_BLSURF::CheckHypothesis const TopoDS_Shape& aShape, SMESH_Hypothesis::Hypothesis_Status& aStatus) { - _hypothesis = NULL; + _hypothesis = NULL; + _haveViscousLayers = false; list::const_iterator itl; const SMESHDS_Hypothesis* theHyp; - const list& hyps = GetUsedHypothesis(aMesh, aShape); - int nbHyp = hyps.size(); - if (!nbHyp) + const list& hyps = GetUsedHypothesis(aMesh, aShape, + /*ignoreAuxiliary=*/false); + aStatus = SMESH_Hypothesis::HYP_OK; + if ( hyps.empty() ) { - aStatus = SMESH_Hypothesis::HYP_OK; return true; // can work with no hypothesis } - itl = hyps.begin(); - theHyp = (*itl); // use only the first hypothesis - - string hypName = theHyp->GetName(); - - if (hypName == "BLSURF_Parameters") + for ( itl = hyps.begin(); itl != hyps.end(); ++itl ) { - _hypothesis = static_cast (theHyp); - ASSERT(_hypothesis); - if ( _hypothesis->GetPhysicalMesh() == BLSURFPlugin_Hypothesis::DefaultSize && - _hypothesis->GetGeometricMesh() == BLSURFPlugin_Hypothesis::DefaultGeom ) - // hphy_flag = 0 and hgeo_flag = 0 is not allowed (spec) - aStatus = SMESH_Hypothesis::HYP_BAD_PARAMETER; + theHyp = *itl; + string hypName = theHyp->GetName(); + if ( hypName == BLSURFPlugin_Hypothesis::GetHypType() ) + { + _hypothesis = static_cast (theHyp); + ASSERT(_hypothesis); + if ( _hypothesis->GetPhysicalMesh() == BLSURFPlugin_Hypothesis::DefaultSize && + _hypothesis->GetGeometricMesh() == BLSURFPlugin_Hypothesis::DefaultGeom ) + // hphy_flag = 0 and hgeo_flag = 0 is not allowed (spec) + aStatus = SMESH_Hypothesis::HYP_BAD_PARAMETER; + } + else if ( hypName == StdMeshers_ViscousLayers2D::GetHypType() ) + { + _haveViscousLayers = true; + } else - aStatus = SMESH_Hypothesis::HYP_OK; + { + aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE; + } } - else - aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE; - return aStatus == SMESH_Hypothesis::HYP_OK; } @@ -367,6 +368,14 @@ inline std::string to_string(double d) return o.str(); } +inline std::string to_string_rel(double d) +{ + std::ostringstream o; + o << d; + o << 'r'; + return o.str(); +} + inline std::string to_string(int i) { std::ostringstream o; @@ -374,6 +383,14 @@ inline std::string to_string(int i) return o.str(); } +inline std::string to_string_rel(int i) +{ + std::ostringstream o; + o << i; + o << 'r'; + return o.str(); +} + double _smp_phy_size; // #if BLSURF_VERSION_LONG >= "3.1.1" // // sizemap_t *geo_sizemap_e, *geo_sizemap_f; @@ -385,8 +402,6 @@ status_t size_on_surface(integer face_id, real *uv, real *size, void *user_data) status_t size_on_edge(integer edge_id, real t, real *size, void *user_data); status_t size_on_vertex(integer vertex_id, real *size, void *user_data); -double my_u_min=1e6,my_v_min=1e6,my_u_max=-1e6,my_v_max=-1e6; - typedef struct { gp_XY uv; gp_XYZ xyz; @@ -557,7 +572,7 @@ void BLSURFPlugin_BLSURF::createEnforcedVertexOnFace(TopoDS_Shape faceShape, BLS } ///////////////////////////////////////////////////////// -void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction) +void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction, double defaultSize) { MESSAGE("Attractor function: "<< AttractorFunction); double xa, ya, za; // Coordinates of attractor point @@ -635,7 +650,7 @@ void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction // We construct the python function ostringstream attractorFunctionStream; attractorFunctionStream << "def f(u,v): return "; - attractorFunctionStream << _smp_phy_size << "-(" << _smp_phy_size <<"-" << a << ")"; + attractorFunctionStream << defaultSize << "-(" << defaultSize <<"-" << a << ")"; //attractorFunctionStream << "*exp(-((u-("<GetBoundaryBoxSegmentation(); + int _physicalMesh = BLSURFPlugin_Hypothesis::GetDefaultPhysicalMesh(); + int _geometricMesh = BLSURFPlugin_Hypothesis::GetDefaultGeometricMesh(); + double _phySize = BLSURFPlugin_Hypothesis::GetDefaultPhySize(diagonal, bbSegmentation); + bool _phySizeRel = BLSURFPlugin_Hypothesis::GetDefaultPhySizeRel(); + double _minSize = BLSURFPlugin_Hypothesis::GetDefaultMinSize(diagonal); + bool _minSizeRel = BLSURFPlugin_Hypothesis::GetDefaultMinSizeRel(); + double _maxSize = BLSURFPlugin_Hypothesis::GetDefaultMaxSize(diagonal); + bool _maxSizeRel = BLSURFPlugin_Hypothesis::GetDefaultMaxSizeRel(); + double _gradation = BLSURFPlugin_Hypothesis::GetDefaultGradation(); + bool _quadAllowed = BLSURFPlugin_Hypothesis::GetDefaultQuadAllowed(); + double _angleMesh = BLSURFPlugin_Hypothesis::GetDefaultAngleMesh(); + double _chordalError = BLSURFPlugin_Hypothesis::GetDefaultChordalError(diagonal); + bool _anisotropic = BLSURFPlugin_Hypothesis::GetDefaultAnisotropic(); + double _anisotropicRatio = BLSURFPlugin_Hypothesis::GetDefaultAnisotropicRatio(); + bool _removeTinyEdges = BLSURFPlugin_Hypothesis::GetDefaultRemoveTinyEdges(); + double _tinyEdgeLength = BLSURFPlugin_Hypothesis::GetDefaultTinyEdgeLength(diagonal); + bool _badElementRemoval = BLSURFPlugin_Hypothesis::GetDefaultBadElementRemoval(); + double _badElementAspectRatio = BLSURFPlugin_Hypothesis::GetDefaultBadElementAspectRatio(); + bool _optimizeMesh = BLSURFPlugin_Hypothesis::GetDefaultOptimizeMesh(); + bool _quadraticMesh = BLSURFPlugin_Hypothesis::GetDefaultQuadraticMesh(); + int _verb = BLSURFPlugin_Hypothesis::GetDefaultVerbosity(); + int _topology = BLSURFPlugin_Hypothesis::GetDefaultTopology(); // PreCAD - int _precadMergeEdges = BLSURFPlugin_Hypothesis::GetDefaultPreCADMergeEdges(); - int _precadRemoveNanoEdges = BLSURFPlugin_Hypothesis::GetDefaultPreCADRemoveNanoEdges(); - int _precadDiscardInput = BLSURFPlugin_Hypothesis::GetDefaultPreCADDiscardInput(); - double _precadEpsNano = BLSURFPlugin_Hypothesis::GetDefaultPreCADEpsNano(); + int _precadMergeEdges = BLSURFPlugin_Hypothesis::GetDefaultPreCADMergeEdges(); + int _precadProcess3DTopology = BLSURFPlugin_Hypothesis::GetDefaultPreCADProcess3DTopology(); + int _precadDiscardInput = BLSURFPlugin_Hypothesis::GetDefaultPreCADDiscardInput(); if (hyp) { MESSAGE("BLSURFPlugin_BLSURF::SetParameters"); - _topology = (int) hyp->GetTopology(); _physicalMesh = (int) hyp->GetPhysicalMesh(); - _phySize = hyp->GetPhySize(); _geometricMesh = (int) hyp->GetGeometricMesh(); - _angleMeshS = hyp->GetAngleMeshS(); - _angleMeshC = hyp->GetAngleMeshC(); - _gradation = hyp->GetGradation(); + if (hyp->GetPhySize() > 0) + _phySize = hyp->GetPhySize(); + _phySizeRel = hyp->IsPhySizeRel(); + if (hyp->GetMinSize() > 0) + _minSize = hyp->GetMinSize(); + _minSizeRel = hyp->IsMinSizeRel(); + if (hyp->GetMaxSize() > 0) + _maxSize = hyp->GetMaxSize(); + _maxSizeRel = hyp->IsMaxSizeRel(); + if (hyp->GetGradation() > 0) + _gradation = hyp->GetGradation(); _quadAllowed = hyp->GetQuadAllowed(); - _decimesh = hyp->GetDecimesh(); + if (hyp->GetAngleMesh() > 0) + _angleMesh = hyp->GetAngleMesh(); + if (hyp->GetChordalError() > 0) + _chordalError = hyp->GetChordalError(); + _anisotropic = hyp->GetAnisotropic(); + if (hyp->GetAnisotropicRatio() >= 0) + _anisotropicRatio = hyp->GetAnisotropicRatio(); + _removeTinyEdges = hyp->GetRemoveTinyEdges(); + if (hyp->GetTinyEdgeLength() > 0) + _tinyEdgeLength = hyp->GetTinyEdgeLength(); + _badElementRemoval = hyp->GetBadElementRemoval(); + if (hyp->GetBadElementAspectRatio() >= 0) + _badElementAspectRatio = hyp->GetBadElementAspectRatio(); + _optimizeMesh = hyp->GetOptimizeMesh(); + _quadraticMesh = hyp->GetQuadraticMesh(); _verb = hyp->GetVerbosity(); - if ( hyp->GetPhyMin() != ::BLSURFPlugin_Hypothesis::undefinedDouble() ) - blsurf_set_param(bls, "hphymin", to_string(hyp->GetPhyMin()).c_str()); - if ( hyp->GetPhyMax() != ::BLSURFPlugin_Hypothesis::undefinedDouble() ) - blsurf_set_param(bls, "hphymax", to_string(hyp->GetPhyMax()).c_str()); - if ( hyp->GetGeoMin() != ::BLSURFPlugin_Hypothesis::undefinedDouble() ) - blsurf_set_param(bls, "hgeomin", to_string(hyp->GetGeoMin()).c_str()); - if ( hyp->GetGeoMax() != ::BLSURFPlugin_Hypothesis::undefinedDouble() ) - blsurf_set_param(bls, "hgeomax", to_string(hyp->GetGeoMax()).c_str()); + _topology = (int) hyp->GetTopology(); + // PreCAD + _precadMergeEdges = hyp->GetPreCADMergeEdges(); + _precadProcess3DTopology = hyp->GetPreCADProcess3DTopology(); + _precadDiscardInput = hyp->GetPreCADDiscardInput(); const BLSURFPlugin_Hypothesis::TOptionValues & opts = hyp->GetOptionValues(); BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt; for ( opIt = opts.begin(); opIt != opts.end(); ++opIt ) if ( !opIt->second.empty() ) { - MESSAGE("blsurf_set_param(): " << opIt->first << " = " << opIt->second); - blsurf_set_param(bls, opIt->first.c_str(), opIt->second.c_str()); + MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second); + cadsurf_set_param(css, opIt->first.c_str(), opIt->second.c_str()); } const BLSURFPlugin_Hypothesis::TOptionValues & preCADopts = hyp->GetPreCADOptionValues(); @@ -745,52 +790,89 @@ void BLSURFPlugin_BLSURF::SetParameters( if ( !opIt->second.empty() ) { if (_topology == BLSURFPlugin_Hypothesis::PreCAD) { MESSAGE("precad_set_param(): " << opIt->first << " = " << opIt->second); - blsurf_set_param(bls, opIt->first.c_str(), opIt->second.c_str()); + precad_set_param(pcs, opIt->first.c_str(), opIt->second.c_str()); } } - - // PreCAD - _precadMergeEdges = hyp->GetPreCADMergeEdges(); - _precadRemoveNanoEdges = hyp->GetPreCADRemoveNanoEdges(); - _precadDiscardInput = hyp->GetPreCADDiscardInput(); - _precadEpsNano = hyp->GetPreCADEpsNano(); - - } else { - //0020968: EDF1545 SMESH: Problem in the creation of a mesh group on geometry - // GetDefaultPhySize() sometimes leads to computation failure - _phySize = mesh.GetShapeDiagonalSize() / _gen->GetBoundaryBoxSegmentation(); - MESSAGE("BLSURFPlugin_BLSURF::SetParameters using defaults"); } +// else { +// //0020968: EDF1545 SMESH: Problem in the creation of a mesh group on geometry +// // GetDefaultPhySize() sometimes leads to computation failure +// // GDD 26/07/2012 From Distene documentation, global physical size default value = diag/100 +// _phySize = BLSURFPlugin_Hypothesis::GetDefaultPhySize(diagonal); +// _minSize = BLSURFPlugin_Hypothesis::GetDefaultMinSize(diagonal); +// _maxSize = BLSURFPlugin_Hypothesis::GetDefaultMaxSize(diagonal); +// _chordalError = BLSURFPlugin_Hypothesis::GetDefaultChordalError(diagonal); +// _tinyEdgeLength = BLSURFPlugin_Hypothesis::GetDefaultTinyEdgeLength(diagonal); +// MESSAGE("BLSURFPlugin_BLSURF::SetParameters using defaults"); +// } // PreCAD if (_topology == BLSURFPlugin_Hypothesis::PreCAD) { *use_precad = true; precad_set_param(pcs, "verbose", to_string(_verb).c_str()); precad_set_param(pcs, "merge_edges", _precadMergeEdges ? "1" : "0"); - precad_set_param(pcs, "remove_nano_edges", _precadRemoveNanoEdges ? "1" : "0"); + precad_set_param(pcs, "process_3d_topology", _precadProcess3DTopology ? "1" : "0"); precad_set_param(pcs, "discard_input_topology", _precadDiscardInput ? "1" : "0"); - if ( _precadEpsNano != ::BLSURFPlugin_Hypothesis::undefinedDouble() ) - precad_set_param(pcs, "eps_nano", to_string(_precadEpsNano).c_str()); - } - - _smp_phy_size = _phySize; - blsurf_set_param(bls, "topo_points", _topology == BLSURFPlugin_Hypothesis::Process || _topology == BLSURFPlugin_Hypothesis::Process2 ? "1" : "0"); - blsurf_set_param(bls, "topo_curves", _topology == BLSURFPlugin_Hypothesis::Process || _topology == BLSURFPlugin_Hypothesis::Process2 ? "1" : "0"); - blsurf_set_param(bls, "topo_project", _topology == BLSURFPlugin_Hypothesis::Process || _topology == BLSURFPlugin_Hypothesis::Process2 ? "1" : "0"); - blsurf_set_param(bls, "clean_boundary", _topology == BLSURFPlugin_Hypothesis::Process2 ? "1" : "0"); - blsurf_set_param(bls, "close_boundary", _topology == BLSURFPlugin_Hypothesis::Process2 ? "1" : "0"); - blsurf_set_param(bls, "hphy_flag", to_string(_physicalMesh).c_str()); - blsurf_set_param(bls, "hphydef", to_string(_phySize).c_str()); - blsurf_set_param(bls, "hgeo_flag", to_string(_geometricMesh).c_str()); - blsurf_set_param(bls, "relax_size", _decimesh ? "0": to_string(_geometricMesh).c_str()); - blsurf_set_param(bls, "angle_meshs", to_string(_angleMeshS).c_str()); - blsurf_set_param(bls, "angle_meshc", to_string(_angleMeshC).c_str()); - blsurf_set_param(bls, "gradation", to_string(_gradation).c_str()); - blsurf_set_param(bls, "patch_independent", _decimesh ? "1" : "0"); - blsurf_set_param(bls, "element", _quadAllowed ? "q1.0" : "p1"); - blsurf_set_param(bls, "verb", to_string(_verb).c_str()); + } - if (_physicalMesh == BLSURFPlugin_Hypothesis::SizeMap){ + bool useGradation = false; + switch (_physicalMesh) + { + case BLSURFPlugin_Hypothesis::PhysicalGlobalSize: + cadsurf_set_param(css, "physical_size_mode", "global"); + cadsurf_set_param(css, "global_physical_size", _phySizeRel ? to_string_rel(_phySize).c_str() : to_string(_phySize).c_str()); + break; + case BLSURFPlugin_Hypothesis::PhysicalLocalSize: + cadsurf_set_param(css, "physical_size_mode", "local"); + cadsurf_set_param(css, "global_physical_size", _phySizeRel ? to_string_rel(_phySize).c_str() : to_string(_phySize).c_str()); + useGradation = true; + break; + default: + cadsurf_set_param(css, "physical_size_mode", "none"); + } + + switch (_geometricMesh) + { + case BLSURFPlugin_Hypothesis::GeometricalGlobalSize: + cadsurf_set_param(css, "geometric_size_mode", "global"); + cadsurf_set_param(css, "geometric_approximation", to_string(_angleMesh).c_str()); + cadsurf_set_param(css, "chordal_error", to_string(_chordalError).c_str()); + useGradation = true; + break; + case BLSURFPlugin_Hypothesis::GeometricalLocalSize: + cadsurf_set_param(css, "geometric_size_mode", "local"); + cadsurf_set_param(css, "geometric_approximation", to_string(_angleMesh).c_str()); + cadsurf_set_param(css, "chordal_error", to_string(_chordalError).c_str()); + useGradation = true; + break; + default: + cadsurf_set_param(css, "geometric_size_mode", "none"); + } + + cadsurf_set_param(css, "minsize", _minSizeRel ? to_string_rel(_minSize).c_str() : to_string(_minSize).c_str()); + cadsurf_set_param(css, "maxsize", _maxSizeRel ? to_string_rel(_maxSize).c_str() : to_string(_maxSize).c_str()); + if ( useGradation ) + cadsurf_set_param(css, "gradation", to_string(_gradation).c_str()); + cadsurf_set_param(css, "element_generation", _quadAllowed ? "quad_dominant" : "triangle"); + + + cadsurf_set_param(css, "metric", _anisotropic ? "anisotropic" : "isotropic"); + if ( _anisotropic ) + cadsurf_set_param(css, "anisotropic_ratio", to_string(_anisotropicRatio).c_str()); + cadsurf_set_param(css, "remove_tiny_edges", _removeTinyEdges ? "1" : "0"); + if ( _removeTinyEdges ) + cadsurf_set_param(css, "tiny_edge_length", to_string(_tinyEdgeLength).c_str()); + cadsurf_set_param(css, "force_bad_surface_element_removal", _badElementRemoval ? "1" : "0"); + if ( _badElementRemoval ) + cadsurf_set_param(css, "bad_surface_element_aspect_ratio", to_string(_badElementAspectRatio).c_str()); + cadsurf_set_param(css, "optimisation", _optimizeMesh ? "yes" : "no"); + cadsurf_set_param(css, "element_order", _quadraticMesh ? "quadratic" : "linear"); + cadsurf_set_param(css, "verbose", to_string(_verb).c_str()); + + _smp_phy_size = _phySizeRel ? _phySize*diagonal : _phySize; + std::cout << "_smp_phy_size = " << _smp_phy_size << std::endl; + + if (_physicalMesh == BLSURFPlugin_Hypothesis::PhysicalLocalSize){ TopoDS_Shape GeomShape; TopoDS_Shape AttShape; TopAbs_ShapeEnum GeomType; @@ -802,7 +884,7 @@ void BLSURFPlugin_BLSURF::SetParameters( BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin(); for ( ; smIt != sizeMaps.end(); ++smIt ) { if ( !smIt->second.empty() ) { - MESSAGE("blsurf_set_sizeMap(): " << smIt->first << " = " << smIt->second); + MESSAGE("cadsurf_set_sizeMap(): " << smIt->first << " = " << smIt->second); GeomShape = entryToShape(smIt->first); GeomType = GeomShape.ShapeType(); MESSAGE("Geomtype is " << GeomType); @@ -900,42 +982,46 @@ void BLSURFPlugin_BLSURF::SetParameters( // // TODO appeler le constructeur des attracteurs directement ici MESSAGE("Setting Attractors"); - const BLSURFPlugin_Hypothesis::TSizeMap attractors = BLSURFPlugin_Hypothesis::GetAttractorEntries(hyp); - BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin(); - for ( ; atIt != attractors.end(); ++atIt ) { - if ( !atIt->second.empty() ) { - MESSAGE("blsurf_set_attractor(): " << atIt->first << " = " << atIt->second); - GeomShape = entryToShape(atIt->first); - GeomType = GeomShape.ShapeType(); - // Group Management - if (GeomType == TopAbs_COMPOUND){ - for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){ - if (it.Value().ShapeType() == TopAbs_FACE){ - HasSizeMapOnFace = true; - createAttractorOnFace(it.Value(), atIt->second); +// if ( !_phySizeRel ) { + const BLSURFPlugin_Hypothesis::TSizeMap attractors = BLSURFPlugin_Hypothesis::GetAttractorEntries(hyp); + BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin(); + for ( ; atIt != attractors.end(); ++atIt ) { + if ( !atIt->second.empty() ) { + MESSAGE("cadsurf_set_attractor(): " << atIt->first << " = " << atIt->second); + GeomShape = entryToShape(atIt->first); + GeomType = GeomShape.ShapeType(); + // Group Management + if (GeomType == TopAbs_COMPOUND){ + for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){ + if (it.Value().ShapeType() == TopAbs_FACE){ + HasSizeMapOnFace = true; + createAttractorOnFace(it.Value(), atIt->second, _phySizeRel ? _phySize*diagonal : _phySize); + } } } - } - if (GeomType == TopAbs_FACE){ - HasSizeMapOnFace = true; - createAttractorOnFace(GeomShape, atIt->second); - } -/* - if (GeomType == TopAbs_EDGE){ - HasSizeMapOnEdge = true; - HasSizeMapOnFace = true; - EdgeId2SizeMap[TopoDS::Edge(GeomShape).HashCode(IntegerLast())] = atIt->second; - } - if (GeomType == TopAbs_VERTEX){ - HasSizeMapOnVertex = true; - HasSizeMapOnEdge = true; - HasSizeMapOnFace = true; - VertexId2SizeMap[TopoDS::Vertex(GeomShape).HashCode(IntegerLast())] = atIt->second; + if (GeomType == TopAbs_FACE){ + HasSizeMapOnFace = true; + createAttractorOnFace(GeomShape, atIt->second, _phySizeRel ? _phySize*diagonal : _phySize); + } + /* + if (GeomType == TopAbs_EDGE){ + HasSizeMapOnEdge = true; + HasSizeMapOnFace = true; + EdgeId2SizeMap[TopoDS::Edge(GeomShape).HashCode(IntegerLast())] = atIt->second; + } + if (GeomType == TopAbs_VERTEX){ + HasSizeMapOnVertex = true; + HasSizeMapOnEdge = true; + HasSizeMapOnFace = true; + VertexId2SizeMap[TopoDS::Vertex(GeomShape).HashCode(IntegerLast())] = atIt->second; + } + */ } -*/ } - } +// } +// else +// MESSAGE("Impossible to create the attractors when the physical size is relative"); // Class Attractors // temporary commented out for testing @@ -953,7 +1039,7 @@ void BLSURFPlugin_BLSURF::SetParameters( BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator AtIt = class_attractors.begin(); for ( ; AtIt != class_attractors.end(); ++AtIt ) { if ( !AtIt->second->Empty() ) { - // MESSAGE("blsurf_set_attractor(): " << AtIt->first << " = " << AtIt->second); + // MESSAGE("cadsurf_set_attractor(): " << AtIt->first << " = " << AtIt->second); GeomShape = entryToShape(AtIt->first); AttShape = AtIt->second->GetAttractorShape(); GeomType = GeomShape.ShapeType(); @@ -1054,7 +1140,7 @@ void BLSURFPlugin_BLSURF::SetParameters( MESSAGE("Setting Size Map on FACES "); // #if BLSURF_VERSION_LONG < "3.1.1" - blsurf_data_set_sizemap_iso_cad_face(bls, size_on_surface, &_smp_phy_size); + cadsurf_data_set_sizemap_iso_cad_face(css, size_on_surface, &_smp_phy_size); // #else // if (*use_precad) // iso_sizemap_f = sizemap_new(c, distene_sizemap_type_iso_cad_face, (void *)size_on_surface, NULL); @@ -1065,7 +1151,7 @@ void BLSURFPlugin_BLSURF::SetParameters( if (HasSizeMapOnEdge){ MESSAGE("Setting Size Map on EDGES "); // #if BLSURF_VERSION_LONG < "3.1.1" - blsurf_data_set_sizemap_iso_cad_edge(bls, size_on_edge, &_smp_phy_size); + cadsurf_data_set_sizemap_iso_cad_edge(css, size_on_edge, &_smp_phy_size); // #else // if (*use_precad) // iso_sizemap_e = sizemap_new(c, distene_sizemap_type_iso_cad_edge, (void *)size_on_edge, NULL); @@ -1076,7 +1162,7 @@ void BLSURFPlugin_BLSURF::SetParameters( if (HasSizeMapOnVertex){ MESSAGE("Setting Size Map on VERTICES "); // #if BLSURF_VERSION_LONG < "3.1.1" - blsurf_data_set_sizemap_iso_cad_point(bls, size_on_vertex, &_smp_phy_size); + cadsurf_data_set_sizemap_iso_cad_point(css, size_on_vertex, &_smp_phy_size); // #else // if (*use_precad) // iso_sizemap_p = sizemap_new(c, distene_sizemap_type_iso_cad_point, (void *)size_on_vertex, NULL); @@ -1089,59 +1175,323 @@ void BLSURFPlugin_BLSURF::SetParameters( namespace { + // -------------------------------------------------------------------------- /*! * \brief Class correctly terminating usage of BLSURF library at destruction */ class BLSURF_Cleaner { context_t * _ctx; - blsurf_session_t* _bls; + cadsurf_session_t* _css; cad_t * _cad; dcad_t * _dcad; public: BLSURF_Cleaner(context_t * ctx, - blsurf_session_t* bls, + cadsurf_session_t* css, cad_t * cad, dcad_t * dcad) : _ctx ( ctx ), - _bls ( bls ), + _css ( css ), _cad ( cad ), _dcad( dcad ) { } ~BLSURF_Cleaner() { - blsurf_session_delete(_bls); + Clean( /*exceptContext=*/false ); + } + void Clean(const bool exceptContext) + { + if ( _css ) + { + cadsurf_session_delete(_css); _css = 0; + + // #if BLSURF_VERSION_LONG >= "3.1.1" + // // if(geo_sizemap_e) + // // distene_sizemap_delete(geo_sizemap_e); + // // if(geo_sizemap_f) + // // distene_sizemap_delete(geo_sizemap_f); + // if(iso_sizemap_p) + // distene_sizemap_delete(iso_sizemap_p); + // if(iso_sizemap_e) + // distene_sizemap_delete(iso_sizemap_e); + // if(iso_sizemap_f) + // distene_sizemap_delete(iso_sizemap_f); + // + // // if(clean_geo_sizemap_e) + // // distene_sizemap_delete(clean_geo_sizemap_e); + // // if(clean_geo_sizemap_f) + // // distene_sizemap_delete(clean_geo_sizemap_f); + // if(clean_iso_sizemap_p) + // distene_sizemap_delete(clean_iso_sizemap_p); + // if(clean_iso_sizemap_e) + // distene_sizemap_delete(clean_iso_sizemap_e); + // if(clean_iso_sizemap_f) + // distene_sizemap_delete(clean_iso_sizemap_f); + // #endif + + cad_delete(_cad); _cad = 0; + dcad_delete(_dcad); _dcad = 0; + if ( !exceptContext ) + { + context_delete(_ctx); _ctx = 0; + } + } + } + }; - // #if BLSURF_VERSION_LONG >= "3.1.1" - // // if(geo_sizemap_e) - // // distene_sizemap_delete(geo_sizemap_e); - // // if(geo_sizemap_f) - // // distene_sizemap_delete(geo_sizemap_f); - // if(iso_sizemap_p) - // distene_sizemap_delete(iso_sizemap_p); - // if(iso_sizemap_e) - // distene_sizemap_delete(iso_sizemap_e); - // if(iso_sizemap_f) - // distene_sizemap_delete(iso_sizemap_f); - // - // // if(clean_geo_sizemap_e) - // // distene_sizemap_delete(clean_geo_sizemap_e); - // // if(clean_geo_sizemap_f) - // // distene_sizemap_delete(clean_geo_sizemap_f); - // if(clean_iso_sizemap_p) - // distene_sizemap_delete(clean_iso_sizemap_p); - // if(clean_iso_sizemap_e) - // distene_sizemap_delete(clean_iso_sizemap_e); - // if(clean_iso_sizemap_f) - // distene_sizemap_delete(clean_iso_sizemap_f); - // #endif - - cad_delete(_cad); - dcad_delete(_dcad); - context_delete(_ctx); + // -------------------------------------------------------------------------- + // comparator to sort nodes and sub-meshes + struct ShapeTypeCompare + { + // sort nodes by position in the following order: + // SMDS_TOP_FACE=2, SMDS_TOP_EDGE=1, SMDS_TOP_VERTEX=0, SMDS_TOP_3DSPACE=3 + int operator()( const SMDS_MeshNode* n1, const SMDS_MeshNode* n2 ) const + { + SMDS_TypeOfPosition pos1 = n1->GetPosition()->GetTypeOfPosition(); + SMDS_TypeOfPosition pos2 = n2->GetPosition()->GetTypeOfPosition(); + if ( pos1 == pos2 ) return 0; + if ( pos1 < pos2 || pos1 == SMDS_TOP_3DSPACE ) return 1; + return -1; + } + // sort sub-meshes in order: EDGE, VERTEX + bool operator()( const SMESHDS_SubMesh* s1, const SMESHDS_SubMesh* s2 ) const + { + int isVertex1 = ( s1 && s1->NbElements() == 0 ); + int isVertex2 = ( s2 && s2->NbElements() == 0 ); + if ( isVertex1 == isVertex2 ) + return s1 < s2; + return isVertex1 < isVertex2; + } + }; + + //================================================================================ + /*! + * \brief Fills groups on nodes to be merged + */ + //================================================================================ + + void getNodeGroupsToMerge( const SMESHDS_SubMesh* smDS, + const TopoDS_Shape& shape, + SMESH_MeshEditor::TListOfListOfNodes& nodeGroupsToMerge) + { + SMDS_NodeIteratorPtr nIt = smDS->GetNodes(); + switch ( shape.ShapeType() ) + { + case TopAbs_VERTEX: { + std::list< const SMDS_MeshNode* > nodes; + while ( nIt->more() ) + nodes.push_back( nIt->next() ); + if ( nodes.size() > 1 ) + nodeGroupsToMerge.push_back( nodes ); + break; + } + case TopAbs_EDGE: { + std::multimap< double, const SMDS_MeshNode* > u2node; + const SMDS_EdgePosition* ePos; + while ( nIt->more() ) + { + const SMDS_MeshNode* n = nIt->next(); + if (( ePos = dynamic_cast< const SMDS_EdgePosition* >( n->GetPosition() ))) + u2node.insert( make_pair( ePos->GetUParameter(), n )); + } + if ( u2node.size() < 2 ) return; + + double tol = (( u2node.rbegin()->first - u2node.begin()->first ) / 20.) / u2node.size(); + std::multimap< double, const SMDS_MeshNode* >::iterator un2, un1; + for ( un2 = u2node.begin(), un1 = un2++; un2 != u2node.end(); un1 = un2++ ) + { + if (( un2->first - un1->first ) <= tol ) + { + std::list< const SMDS_MeshNode* > nodes; + nodes.push_back( un1->second ); + while (( un2->first - un1->first ) <= tol ) + { + nodes.push_back( un2->second ); + if ( ++un2 == u2node.end()) { + --un2; + break; + } + } + // make nodes created on the boundary of viscous layer replace nodes created + // by BLSURF as their SMDS_Position is more correct + nodes.sort( ShapeTypeCompare() ); + nodeGroupsToMerge.push_back( nodes ); + } + } + break; + } + default: ; + } + // SMESH_MeshEditor::TListOfListOfNodes::const_iterator nll = nodeGroupsToMerge.begin(); + // for ( ; nll != nodeGroupsToMerge.end(); ++nll ) + // { + // cout << "Merge "; + // const std::list< const SMDS_MeshNode* >& nl = *nll; + // std::list< const SMDS_MeshNode* >::const_iterator nIt = nl.begin(); + // for ( ; nIt != nl.end(); ++nIt ) + // cout << (*nIt) << " "; + // cout << endl; + // } + // cout << endl; + } + + //================================================================================ + /*! + * \brief A temporary mesh used to compute mesh on a proxy FACE + */ + //================================================================================ + + struct TmpMesh: public SMESH_Mesh + { + typedef std::map TN2NMap; + TN2NMap _tmp2origNN; + TopoDS_Face _proxyFace; + + TmpMesh() + { + _myMeshDS = new SMESHDS_Mesh( _id, true ); + } + //-------------------------------------------------------------------------------- + /*! + * \brief Creates a FACE bound by viscous layers and mesh each its EDGE with 1 segment + */ + //-------------------------------------------------------------------------------- + + const TopoDS_Face& makeProxyFace( SMESH_ProxyMesh::Ptr& viscousMesh, + const TopoDS_Face& origFace) + { + // get data of nodes on inner boundary of viscous layers + SMESH_Mesh* origMesh = viscousMesh->GetMesh(); + TError err; + TSideVector wireVec = StdMeshers_FaceSide::GetFaceWires(origFace, *origMesh, + /*skipMediumNodes = */true, + err, viscousMesh ); + if ( err && err->IsKO() ) + throw *err.get(); // it should be caught at SMESH_subMesh + + // proxy nodes and corresponding tmp VERTEXes + std::vector origNodes; + std::vector tmpVertex; + + // create a proxy FACE + TopoDS_Shape origFaceCopy = origFace.EmptyCopied(); + BRepBuilderAPI_MakeFace newFace( TopoDS::Face( origFaceCopy )); + for ( size_t iW = 0; iW != wireVec.size(); ++iW ) + { + StdMeshers_FaceSidePtr& wireData = wireVec[iW]; + const UVPtStructVec& wirePoints = wireData->GetUVPtStruct(); + if ( wirePoints.size() < 3 ) + continue; + + BRepBuilderAPI_MakePolygon wire; + for ( size_t iN = 1; iN < wirePoints.size(); ++iN ) + { + wire.Add( SMESH_TNodeXYZ( wirePoints[ iN ].node )); + origNodes.push_back( wirePoints[ iN ].node ); + tmpVertex.push_back( wire.LastVertex() ); + } + tmpVertex[0] = wire.FirstVertex(); + wire.Close(); + if ( !wire.IsDone() ) + throw SALOME_Exception("BLSURFPlugin_BLSURF: BRepBuilderAPI_MakePolygon failed"); + newFace.Add( wire ); + } + _proxyFace = newFace; + + // set a new shape to mesh + TopoDS_Compound auxCompoundToMesh; + BRep_Builder shapeBuilder; + shapeBuilder.MakeCompound( auxCompoundToMesh ); + shapeBuilder.Add( auxCompoundToMesh, _proxyFace ); + shapeBuilder.Add( auxCompoundToMesh, origMesh->GetShapeToMesh() ); + + ShapeToMesh( auxCompoundToMesh ); + + //TopExp_Explorer fExp( auxCompoundToMesh, TopAbs_FACE ); + //_proxyFace = TopoDS::Face( fExp.Current() ); + + + // Make input mesh for BLSURF: segments on EDGE's of newFace + + // make nodes and fill in _tmp2origNN + // + SMESHDS_Mesh* tmpMeshDS = GetMeshDS(); + for ( size_t i = 0; i < origNodes.size(); ++i ) + { + GetSubMesh( tmpVertex[i] )->ComputeStateEngine( SMESH_subMesh::COMPUTE ); + if ( const SMDS_MeshNode* tmpN = SMESH_Algo::VertexNode( tmpVertex[i], tmpMeshDS )) + _tmp2origNN.insert( _tmp2origNN.end(), make_pair( tmpN, origNodes[i] )); + else + throw SALOME_Exception("BLSURFPlugin_BLSURF: a proxy vertex not meshed"); + } + + // make segments + TopoDS_Vertex v1, v2; + for ( TopExp_Explorer edge( _proxyFace, TopAbs_EDGE ); edge.More(); edge.Next() ) + { + const TopoDS_Edge& E = TopoDS::Edge( edge.Current() ); + TopExp::Vertices( E, v1, v2 ); + const SMDS_MeshNode* n1 = SMESH_Algo::VertexNode( v1, tmpMeshDS ); + const SMDS_MeshNode* n2 = SMESH_Algo::VertexNode( v2, tmpMeshDS ); + + if ( SMDS_MeshElement* seg = tmpMeshDS->AddEdge( n1, n2 )) + tmpMeshDS->SetMeshElementOnShape( seg, E ); + } + + return _proxyFace; + } + + //-------------------------------------------------------------------------------- + /*! + * \brief Fill in the origMesh with faces computed by BLSURF in this tmp mesh + */ + //-------------------------------------------------------------------------------- + + void FillInOrigMesh( SMESH_Mesh& origMesh, + const TopoDS_Face& origFace ) + { + SMESH_MesherHelper helper( origMesh ); + helper.SetSubShape( origFace ); + helper.SetElementsOnShape( true ); + + // iterate over tmp faces and copy them in origMesh + const SMDS_MeshNode* nodes[27]; + const SMDS_MeshNode* nullNode = 0; + double xyz[3]; + SMDS_FaceIteratorPtr fIt = GetMeshDS()->facesIterator(/*idInceasingOrder=*/true); + while ( fIt->more() ) + { + const SMDS_MeshElement* f = fIt->next(); + SMDS_ElemIteratorPtr nIt = f->nodesIterator(); + int nbN = 0; + for ( ; nIt->more(); ++nbN ) + { + const SMDS_MeshNode* n = static_cast( nIt->next() ); + TN2NMap::iterator n2nIt = + _tmp2origNN.insert( _tmp2origNN.end(), make_pair( n, nullNode )); + if ( !n2nIt->second ) { + n->GetXYZ( xyz ); + gp_XY uv = helper.GetNodeUV( _proxyFace, n ); + n2nIt->second = helper.AddNode( xyz[0], xyz[1], xyz[2], uv.X(), uv.Y() ); + } + nodes[ nbN ] = n2nIt->second; + } + switch( nbN ) { + case 3: helper.AddFace( nodes[0], nodes[1], nodes[2] ); break; + // case 6: helper.AddFace( nodes[0], nodes[1], nodes[2], + // nodes[3], nodes[4], nodes[5]); break; + case 4: helper.AddFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break; + // case 9: helper.AddFace( nodes[0], nodes[1], nodes[2], nodes[3], + // nodes[4], nodes[5], nodes[6], nodes[7], nodes[8]); break; + // case 8: helper.AddFace( nodes[0], nodes[1], nodes[2], nodes[3], + // nodes[4], nodes[5], nodes[6], nodes[7]); break; + } + } } }; + + } // namespace status_t curv_fun(real t, real *uv, real *dt, real *dtt, void *user_data); @@ -1163,9 +1513,83 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) // Fix problem with locales Kernel_Utils::Localizer aLocalizer; + if ( !compute( aMesh, aShape )) + return false; + + if ( _haveViscousLayers ) + { + // Compute viscous layers + + TopTools_MapOfShape map; + for (TopExp_Explorer face_iter(aShape,TopAbs_FACE);face_iter.More();face_iter.Next()) + { + const TopoDS_Face& F = TopoDS::Face(face_iter.Current()); + if ( !map.Add( F )) continue; + SMESH_ProxyMesh::Ptr viscousMesh = StdMeshers_ViscousLayers2D::Compute( aMesh, F ); + if ( !viscousMesh ) + return false; // error in StdMeshers_ViscousLayers2D::Compute() + + // Compute BLSURF mesh on viscous layers + + if ( viscousMesh->NbProxySubMeshes() > 0 ) + { + TmpMesh tmpMesh; + const TopoDS_Face& proxyFace = tmpMesh.makeProxyFace( viscousMesh, F ); + if ( !compute( tmpMesh, proxyFace )) + return false; + tmpMesh.FillInOrigMesh( aMesh, F ); + } + } + + // Re-compute BLSURF mesh on the rest faces if the mesh was cleared + + for (TopExp_Explorer face_iter(aShape,TopAbs_FACE);face_iter.More();face_iter.Next()) + { + const TopoDS_Face& F = TopoDS::Face(face_iter.Current()); + SMESH_subMesh* fSM = aMesh.GetSubMesh( F ); + if ( fSM->IsMeshComputed() ) continue; + + if ( !compute( aMesh, aShape )) + return false; + break; + } + } + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ /* create a distene context (generic object) */ status_t status = STATUS_ERROR; + SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); + SMESH_MesherHelper helper( aMesh ); + // do not call helper.IsQuadraticSubMesh() because sub-meshes + // may be cleaned and helper.myTLinkNodeMap gets invalid in such a case + bool haveQuadraticSubMesh = SMESH_MesherHelper( aMesh ).IsQuadraticSubMesh( aShape ); + bool quadraticSubMeshAndViscousLayer = false; + bool needMerge = false; + typedef set< SMESHDS_SubMesh*, ShapeTypeCompare > TSubMeshSet; + TSubMeshSet edgeSubmeshes; + TSubMeshSet& mergeSubmeshes = edgeSubmeshes; + + TopTools_IndexedMapOfShape fmap; + TopTools_IndexedMapOfShape emap; + TopTools_IndexedMapOfShape pmap; + + // Issue 0019864. On DebianSarge, FE signals do not obey to OSD::SetSignal(false) +#ifndef WNT + feclearexcept( FE_ALL_EXCEPT ); + int oldFEFlags = fedisableexcept( FE_ALL_EXCEPT ); +#endif + context_t *ctx = context_new(); /* Set the message callback in the working context */ @@ -1178,7 +1602,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) #endif /* create the CAD object we will work on. It is associated to the context ctx. */ - cad_t *c = cad_new(ctx); + cad_t *c = cad_new(ctx); dcad_t *dcad = dcad_new(c); FacesWithSizeMap.Clear(); @@ -1190,15 +1614,6 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) VerticesWithSizeMap.Clear(); VertexId2SizeMap.clear(); - SMESH_MesherHelper helper( aMesh ); - // do not call helper.IsQuadraticSubMesh() because submeshes - // may be cleaned and helper.myTLinkNodeMap gets invalid in such a case - const bool haveQudraticSubMesh = SMESH_MesherHelper( aMesh ).IsQuadraticSubMesh( aShape ); - helper.SetIsQuadratic( haveQudraticSubMesh ); - bool needMerge = false; - set< SMESH_subMesh* > edgeSubmeshes; - set< SMESH_subMesh* >& mergeSubmeshes = edgeSubmeshes; - /* Now fill the CAD object with data from your CAD * environement. This is the most complex part of a successfull * integration. @@ -1206,50 +1621,50 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) // PreCAD // If user requests it, send the CAD through Distene preprocessor : PreCAD - cad_t *cleanc = NULL; + cad_t *cleanc = NULL; // preprocessed cad precad_session_t *pcs = precad_session_new(ctx); precad_data_set_cad(pcs, c); - blsurf_session_t *bls = blsurf_session_new(ctx); + cadsurf_session_t *css = cadsurf_session_new(ctx); - // an object that correctly deletes all blsurf objects at destruction - BLSURF_Cleaner cleaner( ctx,bls,c,dcad ); + // an object that correctly deletes all cadsurf objects at destruction + BLSURF_Cleaner cleaner( ctx,css,c,dcad ); MESSAGE("BEGIN SetParameters"); bool use_precad = false; SetParameters( -// #if BLSURF_VERSION_LONG >= "3.1.1" -// c, -// #endif - _hypothesis, bls, pcs, aMesh, &use_precad); + // #if BLSURF_VERSION_LONG >= "3.1.1" + // c, + // #endif + _hypothesis, css, pcs, aMesh, &use_precad); MESSAGE("END SetParameters"); + haveQuadraticSubMesh = haveQuadraticSubMesh || (_hypothesis != NULL && _hypothesis->GetQuadraticMesh()); + helper.SetIsQuadratic( haveQuadraticSubMesh ); + + // To remove as soon as quadratic mesh is allowed - BEGIN + // GDD: Viscous layer is not allowed with quadratic mesh + if (_haveViscousLayers && haveQuadraticSubMesh ) { + quadraticSubMeshAndViscousLayer = true; + _haveViscousLayers = !haveQuadraticSubMesh; + _comment += "Warning: Viscous layer is not possible with a quadratic mesh, it is ignored."; + error(COMPERR_WARNING, _comment); + } + // To remove as soon as quadratic mesh is allowed - END + // needed to prevent the opencascade memory managmement from freeing things vector curves; vector surfaces; - surfaces.resize(0); - curves.resize(0); - - TopTools_IndexedMapOfShape fmap; - TopTools_IndexedMapOfShape emap; - TopTools_IndexedMapOfShape pmap; - fmap.Clear(); - FaceId2PythonSmp.clear(); emap.Clear(); - EdgeId2PythonSmp.clear(); pmap.Clear(); + FaceId2PythonSmp.clear(); + EdgeId2PythonSmp.clear(); VertexId2PythonSmp.clear(); - assert(Py_IsInitialized()); - PyGILState_STATE gstate; - gstate = PyGILState_Ensure(); - - string theSizeMapStr; - /**************************************************************************************** - FACES + FACES *****************************************************************************************/ int iface = 0; string bad_end = "return"; @@ -1258,8 +1673,15 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) TopExp::MapShapes(aShape,TopAbs_VERTEX,_map); int ienf = _map.Extent(); - for (TopExp_Explorer face_iter(aShape,TopAbs_FACE);face_iter.More();face_iter.Next()) { - TopoDS_Face f=TopoDS::Face(face_iter.Current()); + assert(Py_IsInitialized()); + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); + + string theSizeMapStr; + + for (TopExp_Explorer face_iter(aShape,TopAbs_FACE);face_iter.More();face_iter.Next()) + { + TopoDS_Face f = TopoDS::Face(face_iter.Current()); // make INTERNAL face oriented FORWARD (issue 0020993) if (f.Orientation() != TopAbs_FORWARD && f.Orientation() != TopAbs_REVERSED ) @@ -1267,39 +1689,39 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) if (fmap.FindIndex(f) > 0) continue; + iface = fmap.Add(f); - fmap.Add(f); - iface++; surfaces.push_back(BRep_Tool::Surface(f)); - /* create an object representing the face for blsurf */ + /* create an object representing the face for cadsurf */ /* where face_id is an integer identifying the face. * surf_function is the function that defines the surface - * (For this face, it will be called by blsurf with your_face_object_ptr + * (For this face, it will be called by cadsurf with your_face_object_ptr * as last parameter. */ cad_face_t *fce = cad_face_new(c, iface, surf_fun, surfaces.back()); - /* by default a face has no tag (color). The following call sets it to the same value as the face_id : */ + /* by default a face has no tag (color). + The following call sets it to the same value as the face_id : */ cad_face_set_tag(fce, iface); /* Set face orientation (optional if you want a well oriented output mesh)*/ - if(f.Orientation() != TopAbs_FORWARD){ + if(f.Orientation() != TopAbs_FORWARD) cad_face_set_orientation(fce, CAD_ORIENTATION_REVERSED); - } else { + else cad_face_set_orientation(fce, CAD_ORIENTATION_FORWARD); - } - if (HasSizeMapOnFace && !use_precad){ -// MESSAGE("A size map is defined on a face") -// std::cout << "A size map is defined on a face" << std::endl; + if (HasSizeMapOnFace && !use_precad) + { + // ----------------- // Classic size map + // ----------------- faceKey = FacesWithSizeMap.FindIndex(f); - if (FaceId2SizeMap.find(faceKey)!=FaceId2SizeMap.end()){ + if (FaceId2SizeMap.find(faceKey)!=FaceId2SizeMap.end()) { MESSAGE("A size map is defined on face :"<second[0],attractor_iter->second[1]}; + double uvCoords[2] = {attractor_iter->second[0],attractor_iter->second[1]}; ienf++; MESSAGE("Add cad point on (u,v)=(" << uvCoords[0] << "," << uvCoords[1] << ") with id = " << ienf); cad_point_t* point_p = cad_point_new(fce, ienf, uvCoords); @@ -1354,101 +1776,106 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) } } + // ----------------- // Class Attractors + // ----------------- std::map::iterator clAttractor_iter = FaceId2ClassAttractor.find(faceKey); if (clAttractor_iter != FaceId2ClassAttractor.end()){ - MESSAGE("Face indice: " << iface); - MESSAGE("Adding attractor"); - FaceIndex2ClassAttractor[iface]=clAttractor_iter->second; - FaceId2ClassAttractor.erase(clAttractor_iter); - } + MESSAGE("Face indice: " << iface); + MESSAGE("Adding attractor"); + FaceIndex2ClassAttractor[iface]=clAttractor_iter->second; + FaceId2ClassAttractor.erase(clAttractor_iter); } + } // if (HasSizeMapOnFace && !use_precad) + // ------------------ // Enforced Vertices - faceKey = FacesWithEnforcedVertices.FindIndex(f); - std::map::const_iterator evmIt = FaceId2EnforcedVertexCoords.find(faceKey); - if (evmIt != FaceId2EnforcedVertexCoords.end()) { - MESSAGE("Some enforced vertices are defined"); - BLSURFPlugin_Hypothesis::TEnfVertexCoordsList evl; - MESSAGE("Face indice: " << iface); - MESSAGE("Adding enforced vertices"); - evl = evmIt->second; - MESSAGE("Number of vertices to add: "<< evl.size()); - BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator evlIt = evl.begin(); - for (; evlIt != evl.end(); ++evlIt) { - BLSURFPlugin_Hypothesis::TEnfVertexCoords xyzCoords; - xyzCoords.push_back(evlIt->at(2)); - xyzCoords.push_back(evlIt->at(3)); - xyzCoords.push_back(evlIt->at(4)); - MESSAGE("Check position of vertex =(" << xyzCoords[0] << "," << xyzCoords[1] << "," << xyzCoords[2] << ")"); - gp_Pnt P(xyzCoords[0],xyzCoords[1],xyzCoords[2]); - BRepClass_FaceClassifier scl(f,P,1e-7); - // OCC 6.3sp6 : scl.Perform() is bugged. The function was rewritten -// BRepClass_FaceClassifierPerform(&scl,f,P,1e-7); - // OCC 6.5.2: scl.Perform() is not bugged anymore - scl.Perform(f, P, 1e-7); - TopAbs_State result = scl.State(); - MESSAGE("Position of point on face: "<::const_iterator evmIt = FaceId2EnforcedVertexCoords.find(faceKey); + if (evmIt != FaceId2EnforcedVertexCoords.end()) { + MESSAGE("Some enforced vertices are defined"); + BLSURFPlugin_Hypothesis::TEnfVertexCoordsList evl; + MESSAGE("Face indice: " << iface); + MESSAGE("Adding enforced vertices"); + evl = evmIt->second; + MESSAGE("Number of vertices to add: "<< evl.size()); + BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator evlIt = evl.begin(); + for (; evlIt != evl.end(); ++evlIt) { + BLSURFPlugin_Hypothesis::TEnfVertexCoords xyzCoords; + xyzCoords.push_back(evlIt->at(2)); + xyzCoords.push_back(evlIt->at(3)); + xyzCoords.push_back(evlIt->at(4)); + MESSAGE("Check position of vertex =(" << xyzCoords[0] << "," << xyzCoords[1] << "," << xyzCoords[2] << ")"); + gp_Pnt P(xyzCoords[0],xyzCoords[1],xyzCoords[2]); + BRepClass_FaceClassifier scl(f,P,1e-7); + // OCC 6.3sp6 : scl.Perform() is bugged. The function was rewritten + // BRepClass_FaceClassifierPerform(&scl,f,P,1e-7); + // OCC 6.5.2: scl.Perform() is not bugged anymore + scl.Perform(f, P, 1e-7); + TopAbs_State result = scl.State(); + MESSAGE("Position of point on face: "<at(0),evlIt->at(1)}; + ienf++; + MESSAGE("Add cad point on (u,v)=(" << uvCoords[0] << "," << uvCoords[1] << ") with id = " << ienf); + cad_point_t* point_p = cad_point_new(fce, ienf, uvCoords); + int tag = 0; + std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(xyzCoords); + if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end() && + !enfCoordsIt->second.empty() ) { - // Point is inside face and not on border - MESSAGE("Point is in face: node is created"); - double uvCoords[2] = {evlIt->at(0),evlIt->at(1)}; - ienf++; - MESSAGE("Add cad point on (u,v)=(" << uvCoords[0] << "," << uvCoords[1] << ") with id = " << ienf); - cad_point_t* point_p = cad_point_new(fce, ienf, uvCoords); - int tag = 0; - std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(xyzCoords); - if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end() && - !enfCoordsIt->second.empty() ) - { - TopoDS_Vertex v = (*enfCoordsIt->second.begin())->vertex; - if ( v.IsNull() ) v = (*enfCoordsIt->second.rbegin())->vertex; - if ( !v.IsNull() ) { - tag = pmap.Add( v ); - mergeSubmeshes.insert( aMesh.GetSubMesh( v )); - //if ( tag != pmap.Extent() ) - needMerge = true; - } + // to merge nodes of an INTERNAL vertex belonging to several faces + TopoDS_Vertex v = (*enfCoordsIt->second.begin())->vertex; + if ( v.IsNull() ) v = (*enfCoordsIt->second.rbegin())->vertex; + if ( !v.IsNull() ) { + tag = pmap.Add( v ); + SMESH_subMesh* vSM = aMesh.GetSubMesh( v ); + vSM->ComputeStateEngine( SMESH_subMesh::COMPUTE ); + mergeSubmeshes.insert( vSM->GetSubMeshDS() ); + //if ( tag != pmap.Extent() ) + needMerge = true; } - if ( tag == 0 ) tag = ienf; - cad_point_set_tag(point_p, tag); } + if ( tag == 0 ) tag = ienf; + cad_point_set_tag(point_p, tag); } - FaceId2EnforcedVertexCoords.erase(faceKey); } -// else -// std::cout << "No enforced vertex defined" << std::endl; -// } + FaceId2EnforcedVertexCoords.erase(faceKey); + } /**************************************************************************************** - EDGES - now create the edges associated to this face + EDGES + now create the edges associated to this face *****************************************************************************************/ int edgeKey = -1; - for (TopExp_Explorer edge_iter(f,TopAbs_EDGE);edge_iter.More();edge_iter.Next()) { + for (TopExp_Explorer edge_iter(f,TopAbs_EDGE);edge_iter.More();edge_iter.Next()) + { TopoDS_Edge e = TopoDS::Edge(edge_iter.Current()); int ic = emap.FindIndex(e); if (ic <= 0) @@ -1474,15 +1901,49 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) EdgeId2SizeMap.erase(edgeKey); } } + /* data of nodes existing on the edge */ + StdMeshers_FaceSidePtr nodeData; + SMESH_subMesh* sm = aMesh.GetSubMesh( e ); + if ( !sm->IsEmpty() ) + { + SMESH_subMeshIteratorPtr subsmIt = sm->getDependsOnIterator( /*includeSelf=*/true, + /*complexFirst=*/false); + while ( subsmIt->more() ) + edgeSubmeshes.insert( subsmIt->next()->GetSubMeshDS() ); + + nodeData.reset( new StdMeshers_FaceSide( f, e, &aMesh, /*isForwrd = */true, + /*ignoreMedium=*/haveQuadraticSubMesh)); + if ( nodeData->MissVertexNode() ) + return error(COMPERR_BAD_INPUT_MESH,"No node on vertex"); - /* attach the edge to the current blsurf face */ + const std::vector& nodeDataVec = nodeData->GetUVPtStruct(); + if ( !nodeDataVec.empty() ) + { + if ( Abs( nodeDataVec[0].param - tmin ) > Abs( nodeDataVec.back().param - tmin )) + { + nodeData->Reverse(); + nodeData->GetUVPtStruct(); // nodeData recomputes nodeDataVec + } + // tmin and tmax can change in case of viscous layer on an adjacent edge + tmin = nodeDataVec.front().param; + tmax = nodeDataVec.back().param; + } + else + { + cout << "---------------- Invalid nodeData" << endl; + nodeData.reset(); + } + } + + /* attach the edge to the current cadsurf face */ cad_edge_t *edg = cad_edge_new(fce, ic, tmin, tmax, curv_fun, curves.back()); - /* by default an edge has no tag (color). The following call sets it to the same value as the edge_id : */ + /* by default an edge has no tag (color). + The following call sets it to the same value as the edge_id : */ cad_edge_set_tag(edg, ic); /* by default, an edge does not necessalry appear in the resulting mesh, - unless the following property is set : + unless the following property is set : */ cad_edge_set_property(edg, EDGE_PROPERTY_SOFT_REQUIRED); @@ -1491,29 +1952,27 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) cad_edge_set_property(edg, EDGE_PROPERTY_INTERNAL); // pass existing nodes of sub-meshes to BLSURF - SMESH_subMesh* sm = aMesh.GetSubMesh( e ); - if ( !sm->IsEmpty() ) + if ( nodeData ) { - edgeSubmeshes.insert( sm ); - - StdMeshers_FaceSide edgeOfFace( f, e, &aMesh, e.Orientation() == TopAbs_FORWARD, - /*ignoreMedium=*/haveQudraticSubMesh); - if ( edgeOfFace.MissVertexNode() ) - return error(COMPERR_BAD_INPUT_MESH,"No node on vertex"); - - const int nbNodes = edgeOfFace.NbPoints(); + const std::vector& nodeDataVec = nodeData->GetUVPtStruct(); + const int nbNodes = nodeDataVec.size(); dcad_edge_discretization_t *dedge; dcad_get_edge_discretization(dcad, edg, &dedge); dcad_edge_discretization_set_vertex_count( dedge, nbNodes ); - const std::vector& nodeData = edgeOfFace.GetUVPtStruct(); + // cout << endl << " EDGE " << ic << endl; + // cout << "tmin = "<= "3.1.1" -// /* We can now get the updated sizemaps (if any) */ -// // if(geo_sizemap_e) -// // clean_geo_sizemap_e = precad_new_sizemap(pcs, geo_sizemap_e); -// // -// // if(geo_sizemap_f) -// // clean_geo_sizemap_f = precad_new_sizemap(pcs, geo_sizemap_f); -// -// if(iso_sizemap_p) -// clean_iso_sizemap_p = precad_new_sizemap(pcs, iso_sizemap_p); -// -// if(iso_sizemap_e) -// clean_iso_sizemap_e = precad_new_sizemap(pcs, iso_sizemap_e); -// -// if(iso_sizemap_f) -// clean_iso_sizemap_f = precad_new_sizemap(pcs, iso_sizemap_f); -// #endif - - // Now we can delete the PreCAD session - precad_session_delete(pcs); + // #if BLSURF_VERSION_LONG >= "3.1.1" + // /* We can now get the updated sizemaps (if any) */ + // // if(geo_sizemap_e) + // // clean_geo_sizemap_e = precad_new_sizemap(pcs, geo_sizemap_e); + // // + // // if(geo_sizemap_f) + // // clean_geo_sizemap_f = precad_new_sizemap(pcs, geo_sizemap_f); + // + // if(iso_sizemap_p) + // clean_iso_sizemap_p = precad_new_sizemap(pcs, iso_sizemap_p); + // + // if(iso_sizemap_e) + // clean_iso_sizemap_e = precad_new_sizemap(pcs, iso_sizemap_e); + // + // if(iso_sizemap_f) + // clean_iso_sizemap_f = precad_new_sizemap(pcs, iso_sizemap_f); + // #endif } + // Now we can delete the PreCAD session + precad_session_delete(pcs); } - blsurf_data_set_dcad(bls, dcad); + cadsurf_data_set_dcad(css, dcad); if (cleanc) { // Give the pre-processed CAD object to the current BLSurf session - blsurf_data_set_cad(bls, cleanc); + cadsurf_data_set_cad(css, cleanc); } else { // Use the original one - blsurf_data_set_cad(bls, c); + cadsurf_data_set_cad(css, c); } -// #if BLSURF_VERSION_LONG >= "3.1.1" -// blsurf_data_set_sizemap(bls, clean_iso_sizemap_p); -// blsurf_data_set_sizemap(bls, clean_iso_sizemap_e); -// blsurf_data_set_sizemap(bls, clean_iso_sizemap_f); -// #endif - std::cout << std::endl; std::cout << "Beginning of Surface Mesh generation" << std::endl; std::cout << std::endl; - // Issue 0019864. On DebianSarge, FE signals do not obey to OSD::SetSignal(false) -#ifndef WNT - feclearexcept( FE_ALL_EXCEPT ); - int oldFEFlags = fedisableexcept( FE_ALL_EXCEPT ); -#endif - try { OCC_CATCH_SIGNALS; - status = blsurf_compute_mesh(bls); + status = cadsurf_compute_mesh(css); } catch ( std::exception& exc ) { @@ -1702,22 +2143,24 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) } catch (...) { if ( _comment.empty() ) - _comment = "Exception in blsurf_compute_mesh()"; + _comment = "Exception in cadsurf_compute_mesh()"; } if ( status != STATUS_OK) { // There was an error while meshing - //return error(_comment); + error(_comment); } + PyGILState_Release(gstate); + std::cout << std::endl; std::cout << "End of Surface Mesh generation" << std::endl; std::cout << std::endl; mesh_t *msh = NULL; - blsurf_data_get_mesh(bls, &msh); + cadsurf_data_get_mesh(css, &msh); if(!msh){ /* release the mesh object */ - blsurf_data_regain_mesh(bls, msh); + cadsurf_data_regain_mesh(css, msh); return error(_comment); } @@ -1725,30 +2168,17 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) if (_hypothesis) GMFFileName = _hypothesis->GetGMFFile(); if (GMFFileName != "") { -// bool GMFFileMode = _hypothesis->GetGMFFileMode(); + // bool GMFFileMode = _hypothesis->GetGMFFileMode(); bool asciiFound = (GMFFileName.find(".mesh",GMFFileName.length()-5) != std::string::npos); bool binaryFound = (GMFFileName.find(".meshb",GMFFileName.length()-6) != std::string::npos); if (!asciiFound && !binaryFound) GMFFileName.append(".mesh"); - /* - if (GMFFileMode) { - if (!binaryFound) { - if (asciiFound) - GMFFileName.append("b"); - else - GMFFileName.append(".meshb"); - } - } - else { - if (!asciiFound) - GMFFileName.append(".mesh"); - } - */ mesh_write_mesh(msh, GMFFileName.c_str()); } - /* retrieve mesh data (see distene/mesh.h) */ + /* retrieve mesh data (see meshgems/mesh.h) */ integer nv, ne, nt, nq, vtx[4], tag; + integer *evedg, *evtri, *evquad, type; real xyz[3]; mesh_get_vertex_count(msh, &nv); @@ -1756,8 +2186,10 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) mesh_get_triangle_count(msh, &nt); mesh_get_quadrangle_count(msh, &nq); + evedg = (integer *)mesh_calloc_generic_buffer(msh); + evtri = (integer *)mesh_calloc_generic_buffer(msh); + evquad = (integer *)mesh_calloc_generic_buffer(msh); - SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); SMDS_MeshNode** nodes = new SMDS_MeshNode*[nv+1]; bool* tags = new bool[nv+1]; @@ -1809,7 +2241,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) aGroupDS->SMDSGroup().Add(nodes[iv]); MESSAGE("Node ID: " << nodes[iv]->GetID()); // How can I inform the hypothesis ? -// _hypothesis->AddEnfVertexNodeID(currentEnfVertex->grpName,nodes[iv]->GetID()); + // _hypothesis->AddEnfVertexNodeID(currentEnfVertex->grpName,nodes[iv]->GetID()); groupDone = true; MESSAGE("Successfully added enforced vertex to existing group " << currentEnfVertex->grpName); break; @@ -1833,8 +2265,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) } } - - // internal point are tagged to zero + // internal points are tagged to zero if(tag > 0 && tag <= pmap.Extent() ){ meshDS->SetNodeOnVertex(nodes[iv], TopoDS::Vertex(pmap(tag))); tags[iv] = false; @@ -1845,8 +2276,9 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) /* enumerate edges */ for(int it=1;it<=ne;it++) { - + SMDS_MeshEdge* edg; mesh_get_edge_vertices(msh, it, vtx); + mesh_get_edge_extra_vertices(msh, it, &type, evedg); mesh_get_edge_tag(msh, it, &tag); if (tags[vtx[0]]) { Set_NodeOnEdge(meshDS, nodes[vtx[0]], emap(tag)); @@ -1856,16 +2288,26 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) Set_NodeOnEdge(meshDS, nodes[vtx[1]], emap(tag)); tags[vtx[1]] = false; }; - SMDS_MeshEdge* edg = helper.AddEdge(nodes[vtx[0]], nodes[vtx[1]]); + if (type == MESHGEMS_MESH_ELEMENT_TYPE_EDGE3) { + // QUADRATIC EDGE + if (tags[evedg[0]]) { + Set_NodeOnEdge(meshDS, nodes[evedg[0]], emap(tag)); + tags[evedg[0]] = false; + } + edg = meshDS->AddEdge(nodes[vtx[0]], nodes[vtx[1]], nodes[evedg[0]]); + } + else { + edg = helper.AddEdge(nodes[vtx[0]], nodes[vtx[1]]); + } meshDS->SetMeshElementOnShape(edg, TopoDS::Edge(emap(tag))); } /* enumerate triangles */ for(int it=1;it<=nt;it++) { + SMDS_MeshFace* tri; mesh_get_triangle_vertices(msh, it, vtx); - SMDS_MeshFace* tri = helper.AddFace(nodes[vtx[0]], nodes[vtx[1]], nodes[vtx[2]]); + mesh_get_triangle_extra_vertices(msh, it, &type, evtri); mesh_get_triangle_tag(msh, it, &tag); - meshDS->SetMeshElementOnShape(tri, TopoDS::Face(fmap(tag))); if (tags[vtx[0]]) { meshDS->SetNodeOnFace(nodes[vtx[0]], TopoDS::Face(fmap(tag))); tags[vtx[0]] = false; @@ -1878,14 +2320,35 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) meshDS->SetNodeOnFace(nodes[vtx[2]], TopoDS::Face(fmap(tag))); tags[vtx[2]] = false; }; + if (type == MESHGEMS_MESH_ELEMENT_TYPE_TRIA6) { + // QUADRATIC TRIANGLE + if (tags[evtri[0]]) { + meshDS->SetNodeOnFace(nodes[evtri[0]], TopoDS::Face(fmap(tag))); + tags[evtri[0]] = false; + } + if (tags[evtri[1]]) { + meshDS->SetNodeOnFace(nodes[evtri[1]], TopoDS::Face(fmap(tag))); + tags[evtri[1]] = false; + } + if (tags[evtri[2]]) { + meshDS->SetNodeOnFace(nodes[evtri[2]], TopoDS::Face(fmap(tag))); + tags[evtri[2]] = false; + } + tri = meshDS->AddFace(nodes[vtx[0]], nodes[vtx[1]], nodes[vtx[2]], + nodes[evtri[0]], nodes[evtri[1]], nodes[evtri[2]]); + } + else { + tri = helper.AddFace(nodes[vtx[0]], nodes[vtx[1]], nodes[vtx[2]]); + } + meshDS->SetMeshElementOnShape(tri, TopoDS::Face(fmap(tag))); } /* enumerate quadrangles */ for(int it=1;it<=nq;it++) { + SMDS_MeshFace* quad; mesh_get_quadrangle_vertices(msh, it, vtx); - SMDS_MeshFace* quad = helper.AddFace(nodes[vtx[0]], nodes[vtx[1]], nodes[vtx[2]], nodes[vtx[3]]); + mesh_get_quadrangle_extra_vertices(msh, it, &type, evquad); mesh_get_quadrangle_tag(msh, it, &tag); - meshDS->SetMeshElementOnShape(quad, TopoDS::Face(fmap(tag))); if (tags[vtx[0]]) { meshDS->SetNodeOnFace(nodes[vtx[0]], TopoDS::Face(fmap(tag))); tags[vtx[0]] = false; @@ -1902,59 +2365,110 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) meshDS->SetNodeOnFace(nodes[vtx[3]], TopoDS::Face(fmap(tag))); tags[vtx[3]] = false; }; + if (type == MESHGEMS_MESH_ELEMENT_TYPE_QUAD9) { + // QUADRATIC QUADRANGLE + std::cout << "This is a quadratic quadrangle" << std::endl; + if (tags[evquad[0]]) { + meshDS->SetNodeOnFace(nodes[evquad[0]], TopoDS::Face(fmap(tag))); + tags[evquad[0]] = false; + } + if (tags[evquad[1]]) { + meshDS->SetNodeOnFace(nodes[evquad[1]], TopoDS::Face(fmap(tag))); + tags[evquad[1]] = false; + } + if (tags[evquad[2]]) { + meshDS->SetNodeOnFace(nodes[evquad[2]], TopoDS::Face(fmap(tag))); + tags[evquad[2]] = false; + } + if (tags[evquad[3]]) { + meshDS->SetNodeOnFace(nodes[evquad[3]], TopoDS::Face(fmap(tag))); + tags[evquad[3]] = false; + } + if (tags[evquad[4]]) { + meshDS->SetNodeOnFace(nodes[evquad[4]], TopoDS::Face(fmap(tag))); + tags[evquad[4]] = false; + } + quad = meshDS->AddFace(nodes[vtx[0]], nodes[vtx[1]], nodes[vtx[2]], nodes[vtx[3]], + nodes[evquad[0]], nodes[evquad[1]], nodes[evquad[2]], nodes[evquad[3]], + nodes[evquad[4]]); + } + else { + quad = helper.AddFace(nodes[vtx[0]], nodes[vtx[1]], nodes[vtx[2]], nodes[vtx[3]]); + } + meshDS->SetMeshElementOnShape(quad, TopoDS::Face(fmap(tag))); } - // SetIsAlwaysComputed( true ) to sub-meshes of EDGEs w/o mesh - TopLoc_Location loc; double f,l; - for (int i = 1; i <= emap.Extent(); i++) - if ( SMESH_subMesh* sm = aMesh.GetSubMeshContaining( emap( i ))) - sm->SetIsAlwaysComputed( true ); - for (int i = 1; i <= pmap.Extent(); i++) - if ( SMESH_subMesh* sm = aMesh.GetSubMeshContaining( pmap( i ))) - if ( !sm->IsMeshComputed() ) - sm->SetIsAlwaysComputed( true ); + /* release the mesh object, the rest is released by cleaner */ + cadsurf_data_regain_mesh(css, msh); + + delete [] nodes; + delete [] tags; - if ( needMerge ) + if ( needMerge ) // sew mesh computed by BLSURF with pre-existing mesh { - set< SMESH_subMesh* >::iterator smIt = mergeSubmeshes.begin(); - for ( ; smIt != mergeSubmeshes.end(); ++smIt ) + SMESH_MeshEditor editor( &aMesh ); + SMESH_MeshEditor::TListOfListOfNodes nodeGroupsToMerge; + TIDSortedElemSet segementsOnEdge; + TIDSortedNodeSet nodesOnEdge; + TSubMeshSet::iterator smIt; + SMESHDS_SubMesh* smDS; + typedef SMDS_StdIterator< const SMDS_MeshNode*, SMDS_NodeIteratorPtr > TNodeIterator; + double tol; + + // merge nodes on EDGE's with ones computed by BLSURF + for ( smIt = mergeSubmeshes.begin(); smIt != mergeSubmeshes.end(); ++smIt ) { - SMESH_subMesh* sm = *smIt; - SMESH_subMeshIteratorPtr subsmIt = sm->getDependsOnIterator( /*includeSelf=*/true, - /*complexFirst=*/false); - TIDSortedNodeSet nodesOnEdge; - double mergeTolerance = 1e-7, tol; - while ( subsmIt->more() ) + if (! (smDS = *smIt) ) continue; + getNodeGroupsToMerge( smDS, meshDS->IndexToShape((*smIt)->GetID()), nodeGroupsToMerge ); + + SMDS_ElemIteratorPtr segIt = smDS->GetElements(); + while ( segIt->more() ) + segementsOnEdge.insert( segIt->next() ); + } + // merge nodes + editor.MergeNodes( nodeGroupsToMerge ); + + // merge segments + SMESH_MeshEditor::TListOfListOfElementsID equalSegments; + editor.FindEqualElements( segementsOnEdge, equalSegments ); + editor.MergeElements( equalSegments ); + + // remove excess segments created on the boundary of viscous layers + const SMDS_TypeOfPosition onFace = SMDS_TOP_FACE; + for ( int i = 1; i <= emap.Extent(); ++i ) + { + if ( SMESHDS_SubMesh* smDS = meshDS->MeshElements( emap( i ))) { - // get nodes from an edge - sm = subsmIt->next(); - if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() ) + SMDS_ElemIteratorPtr segIt = smDS->GetElements(); + while ( segIt->more() ) { - SMDS_NodeIteratorPtr nIt = smDS->GetNodes(); - while ( nIt->more() ) - nodesOnEdge.insert( nIt->next() ); + const SMDS_MeshElement* seg = segIt->next(); + if ( seg->GetNode(0)->GetPosition()->GetTypeOfPosition() == onFace || + seg->GetNode(1)->GetPosition()->GetTypeOfPosition() == onFace ) + meshDS->RemoveFreeElement( seg, smDS ); } - // get max tolerance - TopoDS_Shape subShape = sm->GetSubShape(); - if ( subShape.ShapeType() == TopAbs_EDGE ) - tol = BRep_Tool::Tolerance( TopoDS::Edge( subShape )); - else - tol = BRep_Tool::Tolerance( TopoDS::Vertex( subShape )); - mergeTolerance = Max( tol, mergeTolerance ); } - // find nodes to merge - SMESH_MeshEditor::TListOfListOfNodes nodeGroupsToMerge; - SMESH_MeshEditor editor( &aMesh ); - editor.FindCoincidentNodes( nodesOnEdge, mergeTolerance*2, nodeGroupsToMerge ); - // merge - editor.MergeNodes( nodeGroupsToMerge ); } } - delete [] nodes; + // SetIsAlwaysComputed( true ) to sub-meshes of EDGEs w/o mesh + TopLoc_Location loc; double f,l; + for (int i = 1; i <= emap.Extent(); i++) + if ( SMESH_subMesh* sm = aMesh.GetSubMeshContaining( emap( i ))) + sm->SetIsAlwaysComputed( true ); + for (int i = 1; i <= pmap.Extent(); i++) + if ( SMESH_subMesh* sm = aMesh.GetSubMeshContaining( pmap( i ))) + if ( !sm->IsMeshComputed() ) + sm->SetIsAlwaysComputed( true ); - /* release the mesh object */ - blsurf_data_regain_mesh(bls, msh); + // Set error to FACE's w/o elements + for ( int i = 1; i <= fmap.Extent(); ++i ) + { + SMESH_subMesh* sm = aMesh.GetSubMesh( fmap(i) ); + if ( !sm->GetSubMeshDS() || sm->GetSubMeshDS()->NbElements() == 0 ) + sm->GetComputeError().reset + ( new SMESH_ComputeError( COMPERR_ALGO_FAILED, _comment, this )); + } // Issue 0019864. On DebianSarge, FE signals do not obey to OSD::SetSignal(false) #ifndef WNT @@ -1964,20 +2478,26 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) #endif /* - std::cout << "FacesWithSizeMap" << std::endl; - FacesWithSizeMap.Statistics(std::cout); - std::cout << "EdgesWithSizeMap" << std::endl; - EdgesWithSizeMap.Statistics(std::cout); - std::cout << "VerticesWithSizeMap" << std::endl; - VerticesWithSizeMap.Statistics(std::cout); - std::cout << "FacesWithEnforcedVertices" << std::endl; - FacesWithEnforcedVertices.Statistics(std::cout); + std::cout << "FacesWithSizeMap" << std::endl; + FacesWithSizeMap.Statistics(std::cout); + std::cout << "EdgesWithSizeMap" << std::endl; + EdgesWithSizeMap.Statistics(std::cout); + std::cout << "VerticesWithSizeMap" << std::endl; + VerticesWithSizeMap.Statistics(std::cout); + std::cout << "FacesWithEnforcedVertices" << std::endl; + FacesWithEnforcedVertices.Statistics(std::cout); */ MESSAGE("END OF BLSURFPlugin_BLSURF::Compute()"); - return true; + return ( status == STATUS_OK && !quadraticSubMeshAndViscousLayer ); } +//================================================================================ +/*! + * \brief Terminates computation + */ +//================================================================================ + #ifdef WITH_SMESH_CANCEL_COMPUTE void BLSURFPlugin_BLSURF::CancelCompute() { @@ -2010,8 +2530,8 @@ void BLSURFPlugin_BLSURF::Set_NodeOnEdge(SMESHDS_Mesh* meshDS, SMDS_MeshNode* no pa = (double)proj.LowerDistanceParameter(); // Issue 0020656. Move node if it is too far from edge gp_Pnt curve_pnt = curve->Value( pa ); - double dist2 = pnt.SquareDistance( curve_pnt ); - double tol = BRep_Tool::Tolerance( edge ); + double dist2 = pnt.SquareDistance( curve_pnt ); + double tol = BRep_Tool::Tolerance( edge ); if ( 1e-14 < dist2 && dist2 <= 1000*tol ) // large enough and within tolerance { curve_pnt.Transform( loc ); @@ -2025,51 +2545,7 @@ void BLSURFPlugin_BLSURF::Set_NodeOnEdge(SMESHDS_Mesh* meshDS, SMDS_MeshNode* no meshDS->SetNodeOnEdge(node, edge, pa); } -//============================================================================= -/*! - * - */ -//============================================================================= - -ostream & BLSURFPlugin_BLSURF::SaveTo(ostream & save) -{ - return save; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -istream & BLSURFPlugin_BLSURF::LoadFrom(istream & load) -{ - return load; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -ostream & operator << (ostream & save, BLSURFPlugin_BLSURF & hyp) -{ - return hyp.SaveTo( save ); -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -istream & operator >> (istream & load, BLSURFPlugin_BLSURF & hyp) -{ - return hyp.LoadFrom( load ); -} - -/* Curve definition function See cad_curv_t in file distene/cad.h for +/* Curve definition function See cad_curv_t in file meshgems/cad.h for * more information. * NOTE : if when your CAD systems evaluates second * order derivatives it also computes first order derivatives and @@ -2110,7 +2586,7 @@ status_t curv_fun(real t, real *uv, real *dt, real *dtt, void *user_data) } /* Surface definition function. - * See cad_surf_t in file distene/cad.h for more information. + * See cad_surf_t in file meshgems/cad.h for more information. * NOTE : if when your CAD systems evaluates second order derivatives it also * computes first order derivatives and function evaluation, you can optimize * this example by making only one CAD call and filling the necessary xyz, du, dv, etc.. @@ -2159,20 +2635,6 @@ status_t surf_fun(real *uv, real *xyz, real*du, real *dv, status_t size_on_surface(integer face_id, real *uv, real *size, void *user_data) { - if (face_id == 1) { - if (my_u_min > uv[0]) { - my_u_min = uv[0]; - } - if (my_v_min > uv[1]) { - my_v_min = uv[1]; - } - if (my_u_max < uv[0]) { - my_u_max = uv[0]; - } - if (my_v_max < uv[1]) { - my_v_max = uv[1]; - } - } //MESSAGE("size_on_surface") if (FaceId2PythonSmp.count(face_id) != 0){ //MESSAGE("A size map is used to calculate size on face : "<Empty()) - double result = FaceIndex2ClassAttractor[face_id]->GetSize(uv[0],uv[1]); + real result = FaceIndex2ClassAttractor[face_id]->GetSize(uv[0],uv[1]); *size = result; - // MESSAGE("f(" << uv[0] << "," << uv[1] << ")" << " = " << result); } else { // MESSAGE("List of attractor is empty !!!") - *size = *((double*)user_data); + *size = *((real*)user_data); } +// std::cout << "Size_on_surface sur la face " << face_id << " donne une size de: " << *size << std::endl; return STATUS_OK; } @@ -2226,8 +2688,13 @@ status_t size_on_edge(integer edge_id, real t, real *size, void *user_data) PyGILState_STATE gstate; gstate = PyGILState_Ensure(); pyresult = PyObject_CallFunction(EdgeId2PythonSmp[edge_id],(char*)"(f)",t); - double result; - if ( pyresult == NULL){ + real result; + if ( pyresult != NULL) { + result = PyFloat_AsDouble(pyresult); + Py_DECREF(pyresult); +// *size = result; + } + else{ fflush(stderr); string err_description=""; new_stderr = newPyStdOut(err_description); @@ -2236,17 +2703,13 @@ status_t size_on_edge(integer edge_id, real t, real *size, void *user_data) PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__")); Py_DECREF(new_stderr); MESSAGE("Can't evaluate f(" << t << ")" << " error is " << err_description); - result = *((double*)user_data); - } - else { - result = PyFloat_AsDouble(pyresult); - Py_DECREF(pyresult); + result = *((real*)user_data); } *size = result; PyGILState_Release(gstate); } else { - *size = *((double*)user_data); + *size = *((real*)user_data); } return STATUS_OK; } @@ -2260,8 +2723,13 @@ status_t size_on_vertex(integer point_id, real *size, void *user_data) PyGILState_STATE gstate; gstate = PyGILState_Ensure(); pyresult = PyObject_CallFunction(VertexId2PythonSmp[point_id],(char*)""); - double result; - if ( pyresult == NULL){ + real result; + if ( pyresult != NULL) { + result = PyFloat_AsDouble(pyresult); + Py_DECREF(pyresult); +// *size = result; + } + else { fflush(stderr); string err_description=""; new_stderr = newPyStdOut(err_description); @@ -2270,17 +2738,13 @@ status_t size_on_vertex(integer point_id, real *size, void *user_data) PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__")); Py_DECREF(new_stderr); MESSAGE("Can't evaluate f()" << " error is " << err_description); - result = *((double*)user_data); - } - else { - result = PyFloat_AsDouble(pyresult); - Py_DECREF(pyresult); + result = *((real*)user_data); } *size = result; PyGILState_Release(gstate); } else { - *size = *((double*)user_data); + *size = *((real*)user_data); } return STATUS_OK; } @@ -2314,7 +2778,7 @@ status_t message_cb(message_t *msg, void *user_data) } /* This is the interrupt callback. PreCAD/BLSurf will call this - * function regularily. See the file distene/interrupt.h + * function regularily. See the file meshgems/interrupt.h */ status_t interrupt_cb(integer *interrupt_status, void *user_data) { @@ -2345,19 +2809,23 @@ bool BLSURFPlugin_BLSURF::Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, MapShapeNbElems& aResMap) { + double diagonal = aMesh.GetShapeDiagonalSize(); + double bbSegmentation = _gen->GetBoundaryBoxSegmentation(); int _physicalMesh = BLSURFPlugin_Hypothesis::GetDefaultPhysicalMesh(); - double _phySize = BLSURFPlugin_Hypothesis::GetDefaultPhySize(); + double _phySize = BLSURFPlugin_Hypothesis::GetDefaultPhySize(diagonal, bbSegmentation); + bool _phySizeRel = BLSURFPlugin_Hypothesis::GetDefaultPhySizeRel(); //int _geometricMesh = BLSURFPlugin_Hypothesis::GetDefaultGeometricMesh(); - //double _angleMeshS = BLSURFPlugin_Hypothesis::GetDefaultAngleMeshS(); - double _angleMeshC = BLSURFPlugin_Hypothesis::GetDefaultAngleMeshC(); + double _angleMesh = BLSURFPlugin_Hypothesis::GetDefaultAngleMesh(); bool _quadAllowed = BLSURFPlugin_Hypothesis::GetDefaultQuadAllowed(); if(_hypothesis) { _physicalMesh = (int) _hypothesis->GetPhysicalMesh(); - _phySize = _hypothesis->GetPhySize(); + _phySizeRel = _hypothesis->IsPhySizeRel(); + if ( _hypothesis->GetPhySize() > 0) + _phySize = _phySizeRel ? diagonal*_hypothesis->GetPhySize() : _hypothesis->GetPhySize(); //_geometricMesh = (int) hyp->GetGeometricMesh(); - //_angleMeshS = hyp->GetAngleMeshS(); - _angleMeshC = _hypothesis->GetAngleMeshC(); - _quadAllowed = _hypothesis->GetQuadAllowed(); + if (_hypothesis->GetAngleMesh() > 0) + _angleMesh = _hypothesis->GetAngleMesh(); + _quadAllowed = _hypothesis->GetQuadAllowed(); } else { //0020968: EDF1545 SMESH: Problem in the creation of a mesh group on geometry // GetDefaultPhySize() sometimes leads to computation failure @@ -2365,7 +2833,7 @@ bool BLSURFPlugin_BLSURF::Evaluate(SMESH_Mesh& aMesh, MESSAGE("BLSURFPlugin_BLSURF::SetParameters using defaults"); } - bool IsQuadratic = false; + bool IsQuadratic = _quadraticMesh; // ---------------- // evaluate 1D @@ -2401,7 +2869,7 @@ bool BLSURFPlugin_BLSURF::Evaluate(SMESH_Mesh& aMesh, V1 = V2; P2 = P3; } - nb1d = (int)( fullAng/_angleMeshC + 1 ); + nb1d = (int)( fullAng/_angleMesh + 1 ); } fullNbSeg += nb1d; std::vector aVec(SMDSEntity_Last); @@ -2491,56 +2959,3 @@ bool BLSURFPlugin_BLSURF::Evaluate(SMESH_Mesh& aMesh, return true; } - -//============================================================================= -/*! - * Rewritting of the BRepClass_FaceClassifier::Perform function which is bugged (CAS 6.3sp6) - * Following line was added: - * myExtrem.Perform(P); - */ -//============================================================================= -void BLSURFPlugin_BLSURF::BRepClass_FaceClassifierPerform(BRepClass_FaceClassifier* fc, - const TopoDS_Face& face, - const gp_Pnt& P, - const Standard_Real Tol) -{ - //-- Voir BRepExtrema_ExtPF.cxx - BRepAdaptor_Surface Surf(face); - Standard_Real U1, U2, V1, V2; - BRepTools::UVBounds(face, U1, U2, V1, V2); - Extrema_ExtPS myExtrem; - myExtrem.Initialize(Surf, U1, U2, V1, V2, Tol, Tol); - myExtrem.Perform(P); - //---------------------------------------------------------- - //-- On cherche le point le plus proche , PUIS - //-- On le classifie. - Standard_Integer nbv = 0; // xpu - Standard_Real MaxDist = RealLast(); - Standard_Integer indice = 0; - if (myExtrem.IsDone()) { - nbv = myExtrem.NbExt(); - for (Standard_Integer i = 1; i <= nbv; i++) { -#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 - Standard_Real d = myExtrem.SquareDistance(i); -#else - Standard_Real d = myExtrem.Value(i); - d = Abs(d); -#endif - if (d <= MaxDist) { - MaxDist = d; - indice = i; - } - } - } - if (indice) { - gp_Pnt2d Puv; - Standard_Real U1,U2; - myExtrem.Point(indice).Parameter(U1, U2); - Puv.SetCoord(U1, U2); - fc->Perform(face, Puv, Tol); - } - else { - fc->Perform(face, gp_Pnt2d(U1-1.0,V1 - 1.0), Tol); //-- NYI etc BUG PAS BEAU En attendant l acces a rejected - //-- le resultat est TopAbs_OUT; - } -} diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx index 6069072..cbee8ae 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx @@ -47,21 +47,22 @@ #endif #include -#include "SMESH_Algo.hxx" -#include "SMESH_Mesh.hxx" +#include +#include #include #include #include #include +#include #include #include CORBA_CLIENT_HEADER(SALOMEDS) #include CORBA_CLIENT_HEADER(GEOM_Gen) #include "Utils_SALOME_Exception.hxx" extern "C"{ -#include "distene/blsurf.h" -#include "distene/api.h" -#include "distene/precad.h" +#include +#include +#include } #include @@ -89,21 +90,20 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo { #ifdef WITH_SMESH_CANCEL_COMPUTE virtual void CancelCompute(); - bool computeCanceled() { return _compute_canceled;}; + bool computeCanceled() { return _compute_canceled; } #endif virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, MapShapeNbElems& aResMap); - ostream & SaveTo(ostream & save); - istream & LoadFrom(istream & load); - friend ostream & operator << (ostream & save, BLSURFPlugin_BLSURF & hyp); - friend istream & operator >> (istream & load, BLSURFPlugin_BLSURF & hyp); - protected: const BLSURFPlugin_Hypothesis* _hypothesis; + bool _haveViscousLayers; private: + bool compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + TopoDS_Shape entryToShape(std::string entry); void createEnforcedVertexOnFace(TopoDS_Shape FaceShape, BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList); void Set_NodeOnEdge(SMESHDS_Mesh* meshDS, SMDS_MeshNode* node, const TopoDS_Shape& ed); diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx index f934918..ada8a38 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx @@ -41,24 +41,32 @@ //============================================================================= BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen) : - SMESH_Hypothesis(hypId, studyId, gen), _topology(GetDefaultTopology()), + SMESH_Hypothesis(hypId, studyId, gen), _physicalMesh(GetDefaultPhysicalMesh()), - _phySize(GetDefaultPhySize()), - _phyMax(GetDefaultMaxSize()), - _phyMin(GetDefaultMinSize()), - _hgeoMax(GetDefaultMaxSize()), - _hgeoMin(GetDefaultMinSize()), _geometricMesh(GetDefaultGeometricMesh()), - _angleMeshS(GetDefaultAngleMeshS()), - _angleMeshC(GetDefaultAngleMeshC()), + _phySize(GetDefaultPhySize()), + _phySizeRel(GetDefaultPhySizeRel()), + _minSize(GetDefaultMinSize()), + _minSizeRel(GetDefaultMinSizeRel()), + _maxSize(GetDefaultMaxSize()), + _maxSizeRel(GetDefaultMaxSizeRel()), _gradation(GetDefaultGradation()), _quadAllowed(GetDefaultQuadAllowed()), - _decimesh(GetDefaultDecimesh()), + _angleMesh(GetDefaultAngleMesh()), + _chordalError(GetDefaultChordalError()), + _anisotropic(GetDefaultAnisotropic()), + _anisotropicRatio(GetDefaultAnisotropicRatio()), + _removeTinyEdges(GetDefaultRemoveTinyEdges()), + _tinyEdgeLength(GetDefaultTinyEdgeLength()), + _badElementRemoval(GetDefaultBadElementRemoval()), + _badElementAspectRatio(GetDefaultBadElementAspectRatio()), + _optimizeMesh(GetDefaultOptimizeMesh()), + _quadraticMesh(GetDefaultQuadraticMesh()), _verb(GetDefaultVerbosity()), + _topology(GetDefaultTopology()), _preCADMergeEdges(GetDefaultPreCADMergeEdges()), - _preCADRemoveNanoEdges(GetDefaultPreCADRemoveNanoEdges()), + _preCADProcess3DTopology(GetDefaultPreCADProcess3DTopology()), _preCADDiscardInput(GetDefaultPreCADDiscardInput()), - _preCADEpsNano(GetDefaultPreCADEpsNano()), _sizeMap(GetDefaultSizeMap()), _attractors(GetDefaultSizeMap()), _classAttractors(GetDefaultAttractorMap()), @@ -76,33 +84,64 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G _param_algo_dim = 2; // _GMFFileMode = false; // GMF ascii mode - - // to disable writing boundaries - //_phyMin = _phyMax = _hgeoMin = _hgeoMax = undefinedDouble(); + const char* boolOptionNames[] = { "correct_surface_intersections", // default = 1 + "create_tag_on_collision", // default = 1 + "debug", // default = 0 + "enforce_cad_edge_sizes", // default = 0 + "frontal", // ok default = 1 + "jacobian_rectification_respect_geometry", // default = 1 + "proximity", // default = 0 + "rectify_jacobian", // default = 1 + "respect_geometry", // default = 1 + "" // mark of end + }; - const char* intOptionNames[] = { "addsurf_ivertex", "anisotropic", "background", "CheckAdjacentEdges", "CheckCloseEdges", - "CheckWellDefined", "coiter", "communication", "debug", "decim", "export_flag", "file_h", "frontal", "gridnu", "gridnv", - "hinterpol_flag", "hmean_flag", "intermedfile", "memory", "normals", "optim", "pardom_flag", "pinch", "refs", - "rigid", "surforient", "tconf", "topo_collapse", - "proximity", "prox_nb_layer", "prox_ratio", // detects the volumic proximity of surfaces - "" // mark of end + const char* intOptionNames[] = { "hinterpol_flag", // ok default = 0 + "hmean_flag", // ok default = 0 + "max_number_of_points_per_patch", // default = 100000 + "prox_nb_layer", // detects the volumic proximity of surfaces + "" // mark of end }; - const char* doubleOptionNames[] = { "addsurf_angle", "addsurf_R", "addsurf_H", "addsurf_FG", "addsurf_r", - "addsurf_PA", "angle_compcurv", "angle_ridge", "anisotropic_ratio", "CoefRectangle", "eps_collapse", "eps_ends", "eps_pardom", "LSS", - "topo_eps1", "topo_eps2", "" // mark of end + const char* doubleOptionNames[] = { "surface_intersections_processing_max_cost",// default = 15 + "periodic_tolerance", // default = diag/100 + "prox_ratio", + "" // mark of end }; - const char* charOptionNames[] = { "export_format", "export_option", "import_option", "prefix", "" // mark of end + const char* charOptionNames[] = { "required_entities", // default = "respect" + "tags", // default = "respect" + "" // mark of end }; // PreCAD advanced options - const char* preCADintOptionNames[] = { "closed_geometry", "debug", "manifold_geometry", "create_tag_on_collision","" // mark of end + const char* preCADboolOptionNames[] = { "closed_geometry", // default = 0 + "create_tag_on_collision", // default = 1 + "debug", // default = 0 + "remove_tiny_edges", // default = 0 + "" // mark of end }; - const char* preCADdoubleOptionNames[] = { "eps_nano_relative", "eps_sewing", "eps_sewing_relative", "periodic_tolerance", - "periodic_tolerance_relative", "periodic_split_tolerance", "periodic_split_tolerance_relative", "" // mark of end + const char* preCADintOptionNames[] = { "manifold_geometry", // default = 0 + "" // mark of end + }; + const char* preCADdoubleOptionNames[] = { "periodic_tolerance", // default = diag * 1e-5 + "sewing_tolerance", // default = diag * 5e-4 + "tiny_edge_length", // default = diag * 1e-5 + "" // mark of end + }; + const char* preCADcharOptionNames[] = { "required_entities", // default = "respect" + "tags", // default = "respect" + "" // mark of end }; int i = 0; + while (boolOptionNames[i][0]) + _option2value[boolOptionNames[i++]].clear(); + + i = 0; + while (preCADboolOptionNames[i][0]) + _preCADoption2value[preCADboolOptionNames[i++]].clear(); + + i = 0; while (intOptionNames[i][0]) _option2value[intOptionNames[i++]].clear(); @@ -125,6 +164,11 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G _charOptions.insert(charOptionNames[i]); _option2value[charOptionNames[i++]].clear(); } + i = 0; + while (preCADcharOptionNames[i][0]) { + _preCADdoubleOptions.insert(preCADcharOptionNames[i]); + _preCADoption2value[preCADdoubleOptionNames[i++]].clear(); + } @@ -167,26 +211,34 @@ TopoDS_Shape BLSURFPlugin_Hypothesis::entryToShape(std::string entry) } //============================================================================= -void BLSURFPlugin_Hypothesis::SetTopology(Topology theTopology) { - if (theTopology != _topology) { - _topology = theTopology; +void BLSURFPlugin_Hypothesis::SetPhysicalMesh(PhysicalMesh thePhysicalMesh) { + if (thePhysicalMesh != _physicalMesh) { + _physicalMesh = thePhysicalMesh; NotifySubMeshesHypothesisModification(); } } //============================================================================= -void BLSURFPlugin_Hypothesis::SetPhysicalMesh(PhysicalMesh thePhysicalMesh) { - if (thePhysicalMesh != _physicalMesh) { - _physicalMesh = thePhysicalMesh; +void BLSURFPlugin_Hypothesis::SetGeometricMesh(GeometricMesh theGeometricMesh) { + if (theGeometricMesh != _geometricMesh) { + _geometricMesh = theGeometricMesh; +// switch (_geometricMesh) { +// case DefaultGeom: +// default: +// _angleMesh = GetDefaultAngleMesh(); +// _gradation = GetDefaultGradation(); +// break; +// } NotifySubMeshesHypothesisModification(); } } //============================================================================= -void BLSURFPlugin_Hypothesis::SetPhySize(double theVal) { - if (theVal != _phySize) { +void BLSURFPlugin_Hypothesis::SetPhySize(double theVal, bool isRelative) { + if ((theVal != _phySize) || (isRelative != _phySizeRel)) { + _phySizeRel = isRelative; if (theVal == 0) { - _phySize = GetPhyMax(); + _phySize = GetMaxSize(); MESSAGE("Warning: nul physical size is not allowed"); } else @@ -196,88 +248,123 @@ void BLSURFPlugin_Hypothesis::SetPhySize(double theVal) { } //============================================================================= -void BLSURFPlugin_Hypothesis::SetPhyMin(double theMinSize) { - if (theMinSize != _phyMin) { - _phyMin = theMinSize; +void BLSURFPlugin_Hypothesis::SetMinSize(double theMinSize, bool isRelative) { + if ((theMinSize != _minSize) || (isRelative != _minSizeRel)) { + _minSizeRel = isRelative; + _minSize = theMinSize; NotifySubMeshesHypothesisModification(); } } //============================================================================= -void BLSURFPlugin_Hypothesis::SetPhyMax(double theMaxSize) { - if (theMaxSize != _phyMax) { - _phyMax = theMaxSize; +void BLSURFPlugin_Hypothesis::SetMaxSize(double theMaxSize, bool isRelative) { + if ((theMaxSize != _maxSize) || (isRelative != _maxSizeRel)) { + _maxSizeRel = isRelative; + _maxSize = theMaxSize; NotifySubMeshesHypothesisModification(); } } //============================================================================= -void BLSURFPlugin_Hypothesis::SetGeoMin(double theMinSize) { - if (theMinSize != _hgeoMin) { - _hgeoMin = theMinSize; +void BLSURFPlugin_Hypothesis::SetGradation(double theVal) { + if (theVal != _gradation) { + _gradation = theVal; NotifySubMeshesHypothesisModification(); } } //============================================================================= -void BLSURFPlugin_Hypothesis::SetGeoMax(double theMaxSize) { - if (theMaxSize != _hgeoMax) { - _hgeoMax = theMaxSize; +void BLSURFPlugin_Hypothesis::SetQuadAllowed(bool theVal) { + if (theVal != _quadAllowed) { + _quadAllowed = theVal; NotifySubMeshesHypothesisModification(); } } //============================================================================= -void BLSURFPlugin_Hypothesis::SetGeometricMesh(GeometricMesh theGeometricMesh) { - if (theGeometricMesh != _geometricMesh) { - _geometricMesh = theGeometricMesh; - switch (_geometricMesh) { - case DefaultGeom: - default: - _angleMeshS = GetDefaultAngleMeshS(); - _gradation = GetDefaultGradation(); - break; - } +void BLSURFPlugin_Hypothesis::SetAngleMesh(double theVal) { + if (theVal != _angleMesh) { + _angleMesh = theVal; NotifySubMeshesHypothesisModification(); } } //============================================================================= -void BLSURFPlugin_Hypothesis::SetAngleMeshS(double theVal) { - if (theVal != _angleMeshS) { - _angleMeshS = theVal; +void BLSURFPlugin_Hypothesis::SetChordalError(double theDistance) { + if (theDistance != _chordalError) { + _chordalError = theDistance; NotifySubMeshesHypothesisModification(); } } //============================================================================= -void BLSURFPlugin_Hypothesis::SetAngleMeshC(double theVal) { - if (theVal != _angleMeshC) { - _angleMeshC = theVal; +void BLSURFPlugin_Hypothesis::SetAnisotropic(bool theVal) { + if (theVal != _anisotropic) { + _anisotropic = theVal; NotifySubMeshesHypothesisModification(); } } //============================================================================= -void BLSURFPlugin_Hypothesis::SetGradation(double theVal) { - if (theVal != _gradation) { - _gradation = theVal; +void BLSURFPlugin_Hypothesis::SetAnisotropicRatio(double theVal) { + if (theVal != _anisotropicRatio) { + _anisotropicRatio = theVal; NotifySubMeshesHypothesisModification(); } } //============================================================================= -void BLSURFPlugin_Hypothesis::SetQuadAllowed(bool theVal) { - if (theVal != _quadAllowed) { - _quadAllowed = theVal; +void BLSURFPlugin_Hypothesis::SetRemoveTinyEdges(bool theVal) { + if (theVal != _removeTinyEdges) { + _removeTinyEdges = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +void BLSURFPlugin_Hypothesis::SetTinyEdgeLength(double theVal) { + if (theVal != _tinyEdgeLength) { + _tinyEdgeLength = theVal; NotifySubMeshesHypothesisModification(); } } //============================================================================= -void BLSURFPlugin_Hypothesis::SetDecimesh(bool theVal) { - if (theVal != _decimesh) { - _decimesh = theVal; +void BLSURFPlugin_Hypothesis::SetBadElementRemoval(bool theVal) { + if (theVal != _badElementRemoval) { + _badElementRemoval = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +void BLSURFPlugin_Hypothesis::SetBadElementAspectRatio(double theVal) { + if (theVal != _badElementAspectRatio) { + _badElementAspectRatio = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +void BLSURFPlugin_Hypothesis::SetOptimizeMesh(bool theVal) { + if (theVal != _optimizeMesh) { + _optimizeMesh = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +void BLSURFPlugin_Hypothesis::SetQuadraticMesh(bool theVal) { + if (theVal != _quadraticMesh) { + _quadraticMesh = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +void BLSURFPlugin_Hypothesis::SetTopology(Topology theTopology) { + if (theTopology != _topology) { + _topology = theTopology; NotifySubMeshesHypothesisModification(); } } @@ -293,17 +380,17 @@ void BLSURFPlugin_Hypothesis::SetVerbosity(int theVal) { //============================================================================= void BLSURFPlugin_Hypothesis::SetPreCADMergeEdges(bool theVal) { if (theVal != _preCADMergeEdges) { - SetTopology(PreCAD); +// SetTopology(PreCAD); _preCADMergeEdges = theVal; NotifySubMeshesHypothesisModification(); } } //============================================================================= -void BLSURFPlugin_Hypothesis::SetPreCADRemoveNanoEdges(bool theVal) { - if (theVal != _preCADRemoveNanoEdges) { - SetTopology(PreCAD); - _preCADRemoveNanoEdges = theVal; +void BLSURFPlugin_Hypothesis::SetPreCADProcess3DTopology(bool theVal) { + if (theVal != _preCADProcess3DTopology) { +// SetTopology(PreCAD); + _preCADProcess3DTopology = theVal; NotifySubMeshesHypothesisModification(); } } @@ -311,21 +398,12 @@ void BLSURFPlugin_Hypothesis::SetPreCADRemoveNanoEdges(bool theVal) { //============================================================================= void BLSURFPlugin_Hypothesis::SetPreCADDiscardInput(bool theVal) { if (theVal != _preCADDiscardInput) { - SetTopology(PreCAD); +// SetTopology(PreCAD); _preCADDiscardInput = theVal; NotifySubMeshesHypothesisModification(); } } -//============================================================================= -void BLSURFPlugin_Hypothesis::SetPreCADEpsNano(double theVal) { - if (theVal != _preCADEpsNano) { - SetTopology(PreCAD); - _preCADEpsNano = theVal; - NotifySubMeshesHypothesisModification(); - } -} - //============================================================================= // void BLSURFPlugin_Hypothesis::SetGMFFile(const std::string& theFileName, bool isBinary) void BLSURFPlugin_Hypothesis::SetGMFFile(const std::string& theFileName) @@ -464,7 +542,7 @@ void BLSURFPlugin_Hypothesis::ClearPreCADOption(const std::string& optionName) { //======================================================================= void BLSURFPlugin_Hypothesis::SetSizeMapEntry(const std::string& entry, const std::string& sizeMap) { if (_sizeMap[entry].compare(sizeMap) != 0) { - SetPhysicalMesh(SizeMap); + SetPhysicalMesh(PhysicalLocalSize); _sizeMap[entry] = sizeMap; NotifySubMeshesHypothesisModification(); } @@ -493,7 +571,7 @@ BLSURFPlugin_Hypothesis::TSizeMap BLSURFPlugin_Hypothesis::GetSizeMapEntries(con //======================================================================= void BLSURFPlugin_Hypothesis::SetAttractorEntry(const std::string& entry, const std::string& attractor) { if (_attractors[entry].compare(attractor) != 0) { - SetPhysicalMesh(SizeMap); + SetPhysicalMesh(PhysicalLocalSize); _attractors[entry] = attractor; NotifySubMeshesHypothesisModification(); } @@ -522,7 +600,7 @@ BLSURFPlugin_Hypothesis::TSizeMap BLSURFPlugin_Hypothesis::GetAttractorEntries(c //======================================================================= void BLSURFPlugin_Hypothesis::SetClassAttractorEntry(const std::string& entry, const std::string& attEntry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius) { - SetPhysicalMesh(SizeMap); + SetPhysicalMesh(PhysicalLocalSize); // The new attractor can't be defined on the same face as another sizemap TSizeMap::iterator it = _sizeMap.find( entry ); @@ -676,7 +754,7 @@ bool BLSURFPlugin_Hypothesis::SetEnforcedVertex(TEntry theFaceEntry, TEnfName th MESSAGE("BLSURFPlugin_Hypothesis::SetEnforcedVertex("<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theVertexEntry << ", " << theGroupName << ")"); - SetPhysicalMesh(SizeMap); + SetPhysicalMesh(PhysicalLocalSize); // TEnfVertexList::iterator it; bool toNotify = false; @@ -1114,7 +1192,7 @@ void BLSURFPlugin_Hypothesis::SetInternalEnforcedVertexAllFaces(bool toEnforceIn if (toEnforceInternalVertices != _enforcedInternalVerticesAllFaces) { _enforcedInternalVerticesAllFaces = toEnforceInternalVertices; if (toEnforceInternalVertices) - SetPhysicalMesh(SizeMap); + SetPhysicalMesh(PhysicalLocalSize); NotifySubMeshesHypothesisModification(); } } @@ -1130,13 +1208,45 @@ void BLSURFPlugin_Hypothesis::SetInternalEnforcedVertexAllFacesGroup(BLSURFPlugi //============================================================================= std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) { + // We must keep at least the same number of arguments when increasing the SALOME version + // When BLSURF becomes CADMESH, some parameters were fused into a single one. Thus the same + // parameter can be written several times to keep the old global number of parameters. + + // Treat old options which are now in the advanced options + TOptionValues::iterator op_val; + int _decimesh = -1; + int _preCADRemoveNanoEdges = -1; + double _preCADEpsNano = -1.0; + op_val = _option2value.find("respect_geometry"); + if (op_val != _option2value.end()) { + std::string value = op_val->second; + if (!value.empty()) + _decimesh = value.compare("1") == 0 ? 1 : 0; + } + op_val = _preCADoption2value.find("remove_tiny_edges"); + if (op_val != _preCADoption2value.end()) { + std::string value = op_val->second; + if (!value.empty()) + _preCADRemoveNanoEdges = value.compare("1") == 0 ? 1 : 0; + } + op_val = _preCADoption2value.find("tiny_edge_length"); + if (op_val != _preCADoption2value.end()) { + std::string value = op_val->second; + if (!value.empty()) + _preCADEpsNano = strtod(value.c_str(), NULL); + } + save << " " << (int) _topology << " " << (int) _physicalMesh << " " << (int) _geometricMesh << " " << _phySize << " " - << _angleMeshS << " " << _gradation << " " << (int) _quadAllowed << " " << (int) _decimesh; - save << " " << _phyMin << " " << _phyMax << " " << _angleMeshC << " " << _hgeoMin << " " << _hgeoMax << " " << _verb; - save << " " << (int) _preCADMergeEdges << " " << (int) _preCADRemoveNanoEdges << " " << (int) _preCADDiscardInput << " " << _preCADEpsNano ; + << _angleMesh << " " << _gradation << " " << (int) _quadAllowed << " " << _decimesh; + save << " " << _minSize << " " << _maxSize << " " << _angleMesh << " " << _minSize << " " << _maxSize << " " << _verb; + save << " " << (int) _preCADMergeEdges << " " << _preCADRemoveNanoEdges << " " << (int) _preCADDiscardInput << " " << _preCADEpsNano ; save << " " << (int) _enforcedInternalVerticesAllFaces; + save << " " << (int) _phySizeRel << " " << (int) _minSizeRel << " " << (int) _maxSizeRel << " " << _chordalError ; + save << " " << (int) _anisotropic << " " << _anisotropicRatio << " " << (int) _removeTinyEdges << " " << _tinyEdgeLength ; + save << " " << (int) _badElementRemoval << " " << _badElementAspectRatio << " " << (int) _optimizeMesh << " " << (int) _quadraticMesh ; + save << " " << (int) _preCADProcess3DTopology; - TOptionValues::iterator op_val = _option2value.begin(); + op_val = _option2value.begin(); if (op_val != _option2value.end()) { save << " " << "__OPTIONS_BEGIN__"; for (; op_val != _option2value.end(); ++op_val) { @@ -1247,6 +1357,7 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { bool isOK = true; int i; double val; + std::string option_or_sm; isOK = (load >> i); if (isOK) @@ -1274,7 +1385,7 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { isOK = (load >> val); if (isOK) - _angleMeshS = val; + _angleMesh = val; else load.clear(std::ios::badbit | load.rdstate()); @@ -1291,38 +1402,46 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { load.clear(std::ios::badbit | load.rdstate()); isOK = (load >> i); - if (isOK) - _decimesh = (bool) i; + if (isOK) { + if ( i != -1) { // if value is -1, then this is no longer a standard option + std::string & value = _option2value["respect_geometry"]; + bool _decimesh = (bool) i; + value = _decimesh ? "1" : "0"; + } + } else load.clear(std::ios::badbit | load.rdstate()); isOK = (load >> val); if (isOK) - _phyMin = val; + _minSize = val; else load.clear(std::ios::badbit | load.rdstate()); isOK = (load >> val); if (isOK) - _phyMax = val; + _maxSize = val; else load.clear(std::ios::badbit | load.rdstate()); isOK = (load >> val); if (isOK) - _angleMeshC = val; + // former parameter: get min value + _angleMesh = min(val,_angleMesh); else load.clear(std::ios::badbit | load.rdstate()); isOK = (load >> val); if (isOK) - _hgeoMin = val; + // former parameter: get min value + _minSize = min(val,_minSize); else load.clear(std::ios::badbit | load.rdstate()); isOK = (load >> val); if (isOK) - _hgeoMax = val; + // former parameter: get max value + _maxSize = max(val,_maxSize); else load.clear(std::ios::badbit | load.rdstate()); @@ -1339,8 +1458,13 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { load.clear(std::ios::badbit | load.rdstate()); isOK = (load >> i); - if (isOK) - _preCADRemoveNanoEdges = (bool) i; + if (isOK) { + if ( i != -1) { // if value is -1, then this is no longer a standard option + std::string & value = _preCADoption2value["remove_tiny_edges"]; + bool _preCADRemoveNanoEdges = (bool) i; + value = _preCADRemoveNanoEdges ? "1" : "0"; + } + } else load.clear(std::ios::badbit | load.rdstate()); @@ -1351,8 +1475,14 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { load.clear(std::ios::badbit | load.rdstate()); isOK = (load >> val); - if (isOK) - _preCADEpsNano = val; + if (isOK) { // _preCADEpsNano + if ( (i + 1.0) < 1e-6 ) { // if value is -1, then this is no longer a standard option: get optional value "tiny_edge_length" instead + std::string & value = _preCADoption2value["tiny_edge_length"]; + std::ostringstream oss; + oss << i; + value = oss.str(); + } + } else load.clear(std::ios::badbit | load.rdstate()); @@ -1362,7 +1492,9 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { else load.clear(std::ios::badbit | load.rdstate()); - std::string option_or_sm; + // New options with MeshGems-CADSurf + + bool hasCADSurfOptions = false; bool hasOptions = false; bool hasPreCADOptions = false; bool hasSizeMap = false; @@ -1372,6 +1504,11 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { isOK = (load >> option_or_sm); if (isOK) + if ( (option_or_sm == "1")||(option_or_sm == "0") ) { + i = atoi(option_or_sm.c_str()); + hasCADSurfOptions = true; + _phySizeRel = (bool) i; + } if (option_or_sm == "__OPTIONS_BEGIN__") hasOptions = true; else if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__") @@ -1385,6 +1522,99 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__") hasEnforcedVertex = true; + if (isOK && hasCADSurfOptions) { + isOK = (load >> i); + if (isOK) + _minSizeRel = (bool) i; + else + load.clear(std::ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + _maxSizeRel = (bool) i; + else + load.clear(std::ios::badbit | load.rdstate()); + + isOK = (load >> val); + if (isOK) + _chordalError = val; + else + load.clear(std::ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + _anisotropic = (bool) i; + else + load.clear(std::ios::badbit | load.rdstate()); + + isOK = (load >> val); + if (isOK) + _anisotropicRatio = val; + else + load.clear(std::ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + _removeTinyEdges = (bool) i; + else + load.clear(std::ios::badbit | load.rdstate()); + + isOK = (load >> val); + if (isOK) + _tinyEdgeLength = val; + else + load.clear(std::ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + _badElementRemoval = (bool) i; + else + load.clear(std::ios::badbit | load.rdstate()); + + isOK = (load >> val); + if (isOK) + _badElementAspectRatio = val; + else + load.clear(std::ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + _optimizeMesh = (bool) i; + else + load.clear(std::ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + _quadraticMesh = (bool) i; + else + load.clear(std::ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + _preCADProcess3DTopology = (bool) i; + else + load.clear(std::ios::badbit | load.rdstate()); + + } + + + if (hasCADSurfOptions) { + isOK = (load >> option_or_sm); + if (isOK) + if (option_or_sm == "__OPTIONS_BEGIN__") + hasOptions = true; + else if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__") + hasPreCADOptions = true; + else if (option_or_sm == "__SIZEMAP_BEGIN__") + hasSizeMap = true; + else if (option_or_sm == "__ATTRACTORS_BEGIN__") + hasAttractor = true; + else if (option_or_sm == "__NEW_ATTRACTORS_BEGIN__") + hasNewAttractor = true; + else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__") + hasEnforcedVertex = true; + } + std::string optName, optValue; while (isOK && hasOptions) { isOK = (load >> optName); @@ -1731,79 +1961,81 @@ bool BLSURFPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh, con return false; } -//============================================================================= +//================================================================================ /*! - * \brief Initialize my parameter values by default parameters. - * \retval bool - true if parameter values have been successfully defined + * \brief Returns default global constant physical size given a default value of element length ratio */ -//============================================================================= +//================================================================================ -bool BLSURFPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh) { - return bool(_phySize = dflts._elemLength); +double BLSURFPlugin_Hypothesis::GetDefaultPhySize(double diagonal, double bbSegmentation) { + if (bbSegmentation != 0 && diagonal != 0) + return diagonal / bbSegmentation ; + return 10; } -//============================================================================= -BLSURFPlugin_Hypothesis::Topology BLSURFPlugin_Hypothesis::GetDefaultTopology() { - return FromCAD; -} +//================================================================================ +/*! + * \brief Returns default min size given a default value of element length ratio + */ +//================================================================================ -//============================================================================= -BLSURFPlugin_Hypothesis::PhysicalMesh BLSURFPlugin_Hypothesis::GetDefaultPhysicalMesh() { - return PhysicalUserDefined; +double BLSURFPlugin_Hypothesis::GetDefaultMinSize(double diagonal) { + if (diagonal != 0) + return diagonal / 1000.0 ; + return undefinedDouble(); } -//============================================================================= -double BLSURFPlugin_Hypothesis::GetDefaultPhySize() { - return 10; -} +//================================================================================ +/*! + * \brief Returns default max size given a default value of element length ratio + */ +//================================================================================ -//====================================================================== -double BLSURFPlugin_Hypothesis::GetDefaultMaxSize() { - return undefinedDouble(); // 1e+4; +double BLSURFPlugin_Hypothesis::GetDefaultMaxSize(double diagonal) { + if (diagonal != 0) + return diagonal / 5.0 ; + return undefinedDouble(); } -//====================================================================== -double BLSURFPlugin_Hypothesis::GetDefaultMinSize() { - return undefinedDouble(); //1e-4; -} +//================================================================================ +/*! + * \brief Returns default chordal error given a default value of element length ratio + */ +//================================================================================ -//====================================================================== -BLSURFPlugin_Hypothesis::GeometricMesh BLSURFPlugin_Hypothesis::GetDefaultGeometricMesh() { - return DefaultGeom; +double BLSURFPlugin_Hypothesis::GetDefaultChordalError(double diagonal) { + if (diagonal != 0) + return diagonal; + return undefinedDouble(); } -//============================================================================= -double BLSURFPlugin_Hypothesis::GetDefaultAngleMeshS() { - return 8; -} +//================================================================================ +/*! + * \brief Returns default tiny edge length given a default value of element length ratio + */ +//================================================================================ -//============================================================================= -double BLSURFPlugin_Hypothesis::GetDefaultGradation() { - return 1.1; +double BLSURFPlugin_Hypothesis::GetDefaultTinyEdgeLength(double diagonal) { + if (diagonal != 0) + return diagonal * 1e-6 ; + return undefinedDouble(); } //============================================================================= -bool BLSURFPlugin_Hypothesis::GetDefaultQuadAllowed() { - return false; -} - +/*! + * \brief Initialize my parameter values by default parameters. + * \retval bool - true if parameter values have been successfully defined + */ //============================================================================= -bool BLSURFPlugin_Hypothesis::GetDefaultDecimesh() { - return false; -} - -//====================================================================== -double BLSURFPlugin_Hypothesis::GetDefaultPreCADEpsNano() { - return undefinedDouble(); //1e-4; -} -//====================================================================== -std::string BLSURFPlugin_Hypothesis::GetDefaultGMFFile() { - return ""; -} +bool BLSURFPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh) { + double diagonal = dflts._elemLength*_gen->GetBoundaryBoxSegmentation(); + _phySize = GetDefaultPhySize(diagonal, _gen->GetBoundaryBoxSegmentation()); + _minSize = GetDefaultMinSize(diagonal); + _maxSize = GetDefaultMaxSize(diagonal); + _chordalError = GetDefaultChordalError(diagonal); + _tinyEdgeLength = GetDefaultTinyEdgeLength(diagonal); -//============================================================================= -bool BLSURFPlugin_Hypothesis::GetDefaultInternalEnforcedVertex() { - return false; + return true; +// return bool(_phySize = dflts._elemLength); } - diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx index 2b014b0..7475444 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx @@ -54,48 +54,37 @@ public: enum PhysicalMesh { DefaultSize, - PhysicalUserDefined, - SizeMap + PhysicalGlobalSize, + PhysicalLocalSize }; enum GeometricMesh { DefaultGeom, - UserDefined + GeometricalGlobalSize, + GeometricalLocalSize }; static const char* GetHypType() { return "BLSURF_Parameters"; } TopoDS_Shape entryToShape(std::string entry); - void SetTopology(Topology theTopology); - Topology GetTopology() const { return _topology; } - void SetPhysicalMesh(PhysicalMesh thePhysicalMesh); PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; } - void SetPhySize(double thePhySize); - double GetPhySize() const { return _phySize; } - - void SetPhyMin(double theMinSize); - double GetPhyMin() const { return _phyMin; } - - void SetPhyMax(double theMaxSize); - double GetPhyMax() const { return _phyMax; } - void SetGeometricMesh(GeometricMesh theGeometricMesh); GeometricMesh GetGeometricMesh() const { return _geometricMesh; } - void SetAngleMeshS(double theAngle); - double GetAngleMeshS() const { return _angleMeshS; } - - void SetAngleMeshC(double theAngle); - double GetAngleMeshC() const { return _angleMeshC; } + void SetPhySize(double thePhySize, bool isRelative = false); + double GetPhySize() const { return _phySize; } + bool IsPhySizeRel() const { return _phySizeRel; } - void SetGeoMin(double theMinSize); - double GetGeoMin() const { return _hgeoMin; } + void SetMinSize(double theMinSize, bool isRelative = false); + double GetMinSize() const { return _minSize; } + bool IsMinSizeRel() const { return _minSizeRel; } - void SetGeoMax(double theMaxSize); - double GetGeoMax() const { return _hgeoMax; } + void SetMaxSize(double theMaxSize, bool isRelative = false); + double GetMaxSize() const { return _maxSize; } + bool IsMaxSizeRel() const { return _maxSizeRel; } void SetGradation(double theGradation); double GetGradation() const { return _gradation; } @@ -103,8 +92,38 @@ public: void SetQuadAllowed(bool theVal); bool GetQuadAllowed() const { return _quadAllowed; } - void SetDecimesh(bool theVal); - bool GetDecimesh() const { return _decimesh; } + void SetAngleMesh(double theAngle); + double GetAngleMesh() const { return _angleMesh; } + + void SetChordalError(double theDistance); + double GetChordalError() const { return _chordalError; } + + void SetAnisotropic(bool theVal); + bool GetAnisotropic() const { return _anisotropic; } + + void SetAnisotropicRatio(double theVal); + double GetAnisotropicRatio() const { return _anisotropicRatio; } + + void SetRemoveTinyEdges(bool theVal); + bool GetRemoveTinyEdges() const { return _removeTinyEdges; } + + void SetTinyEdgeLength(double theVal); + double GetTinyEdgeLength() const { return _tinyEdgeLength; } + + void SetBadElementRemoval(bool theVal); + bool GetBadElementRemoval() const { return _badElementRemoval; } + + void SetBadElementAspectRatio(double theVal); + double GetBadElementAspectRatio() const { return _badElementAspectRatio; } + + void SetOptimizeMesh(bool theVal); + bool GetOptimizeMesh() const { return _optimizeMesh; } + + void SetQuadraticMesh(bool theVal); + bool GetQuadraticMesh() const { return _quadraticMesh; } + + void SetTopology(Topology theTopology); + Topology GetTopology() const { return _topology; } void SetVerbosity(int theVal); int GetVerbosity() const { return _verb; } @@ -115,14 +134,11 @@ public: void SetPreCADMergeEdges(bool theVal); bool GetPreCADMergeEdges() const { return _preCADMergeEdges; } - void SetPreCADRemoveNanoEdges(bool theVal); - bool GetPreCADRemoveNanoEdges() const { return _preCADRemoveNanoEdges; } + void SetPreCADProcess3DTopology(bool theVal); + bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; } void SetPreCADDiscardInput(bool theVal); bool GetPreCADDiscardInput() const { return _preCADDiscardInput; } - - void SetPreCADEpsNano(double theVal); - double GetPreCADEpsNano() const { return _preCADEpsNano; } typedef std::map TSizeMap; @@ -286,23 +302,39 @@ public: // void SetInternalEnforcedVertex(TEntry theFaceEntry, bool toEnforceInternalVertices, TEnfGroupName theGroupName); // bool GetInternalEnforcedVertex(const TEntry& theFaceEntry); - static Topology GetDefaultTopology(); - static PhysicalMesh GetDefaultPhysicalMesh(); - static double GetDefaultPhySize(); - static double GetDefaultMaxSize(); - static double GetDefaultMinSize(); - static GeometricMesh GetDefaultGeometricMesh(); - static double GetDefaultAngleMeshS(); - static double GetDefaultAngleMeshC() { return GetDefaultAngleMeshS(); } - static double GetDefaultGradation(); - static bool GetDefaultQuadAllowed(); - static bool GetDefaultDecimesh(); - static int GetDefaultVerbosity() { return 10; } + static PhysicalMesh GetDefaultPhysicalMesh() { return PhysicalGlobalSize; } + static GeometricMesh GetDefaultGeometricMesh() { return DefaultGeom; } + static double GetDefaultPhySize(double diagonal, double bbSegmentation); + static double GetDefaultPhySize() { return undefinedDouble(); } + static bool GetDefaultPhySizeRel() { return false; } + static double GetDefaultMinSize(double diagonal); + static double GetDefaultMinSize() { return undefinedDouble(); } + static bool GetDefaultMinSizeRel() { return false; } + static double GetDefaultMaxSize(double diagonal); + static double GetDefaultMaxSize() { return undefinedDouble(); } + static bool GetDefaultMaxSizeRel() { return false; } + static double GetDefaultGradation() { return 1.3; } + static bool GetDefaultQuadAllowed() { return false; } + static double GetDefaultAngleMesh() { return 22.0; } + + static double GetDefaultChordalError(double diagonal); + static double GetDefaultChordalError() { return undefinedDouble(); } + static bool GetDefaultAnisotropic() { return false; } + static double GetDefaultAnisotropicRatio() { return 0.0; } + static bool GetDefaultRemoveTinyEdges() { return false; } + static double GetDefaultTinyEdgeLength(double diagonal); + static double GetDefaultTinyEdgeLength() { return undefinedDouble(); } + static bool GetDefaultBadElementRemoval() { return false; } + static double GetDefaultBadElementAspectRatio() {return 1000.0; } + static bool GetDefaultOptimizeMesh() { return true; } + static bool GetDefaultQuadraticMesh() { return false; } + + static int GetDefaultVerbosity() { return 3; } + static Topology GetDefaultTopology() { return FromCAD; } // PreCAD - static bool GetDefaultPreCADMergeEdges() { return false; } - static bool GetDefaultPreCADRemoveNanoEdges() { return false; } + static bool GetDefaultPreCADMergeEdges() { return true; } + static bool GetDefaultPreCADProcess3DTopology() { return true; } static bool GetDefaultPreCADDiscardInput() { return false; } - static double GetDefaultPreCADEpsNano(); static TSizeMap GetDefaultSizeMap() { return TSizeMap();} static TAttractorMap GetDefaultAttractorMap() { return TAttractorMap(); } @@ -315,7 +347,7 @@ public: static TEnfVertexEntryEnfVertexMap GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); } static TGroupNameNodeIDMap GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); } - static bool GetDefaultInternalEnforcedVertex(); + static bool GetDefaultInternalEnforcedVertex() { return false; } /* TODO GROUPS static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); } @@ -344,7 +376,7 @@ public: // void SetGMFFile(const std::string& theFileName, bool isBinary); void SetGMFFile(const std::string& theFileName); std::string GetGMFFile() const { return _GMFFileName; } - static std::string GetDefaultGMFFile(); + static std::string GetDefaultGMFFile() { return "";} // bool GetGMFFileMode() const { return _GMFFileMode; } // Persistence @@ -369,23 +401,35 @@ public: private: - Topology _topology; PhysicalMesh _physicalMesh; - double _phySize, _phyMin, _phyMax; GeometricMesh _geometricMesh; - double _angleMeshS, _angleMeshC, _hgeoMin, _hgeoMax; + double _phySize; + bool _phySizeRel; + double _minSize, _maxSize; + bool _minSizeRel, _maxSizeRel; double _gradation; bool _quadAllowed; - bool _decimesh; + double _angleMesh; + double _chordalError; + bool _anisotropic; + double _anisotropicRatio; + bool _removeTinyEdges; + double _tinyEdgeLength; + bool _badElementRemoval; + double _badElementAspectRatio; + bool _optimizeMesh; + bool _quadraticMesh; int _verb; + Topology _topology; bool _preCADMergeEdges; - bool _preCADRemoveNanoEdges; + bool _preCADProcess3DTopology; bool _preCADDiscardInput; double _preCADEpsNano; TOptionValues _option2value, _preCADoption2value; - TOptionNames _doubleOptions, _charOptions, _preCADdoubleOptions, _preCADcharOptions; + TOptionNames _doubleOptions, _charOptions; + TOptionNames _preCADdoubleOptions, _preCADcharOptions; TSizeMap _sizeMap; TSizeMap _attractors; TAttractorMap _classAttractors; diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx index 0190ed0..77af19a 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx @@ -61,61 +61,62 @@ BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() { MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" ); } +//============================================================================= + +//============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetTopology + * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh * - * Set topology + * Set PhysicalMesh */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology"); +void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh"); ASSERT(myBaseImpl); - this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue); - SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )"; + this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue); + SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetTopology + * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh * - * Get Topology + * Get PhysicalMesh */ //============================================================================= -CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology"); +CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh"); ASSERT(myBaseImpl); - return this->GetImpl()->GetTopology(); + return this->GetImpl()->GetPhysicalMesh(); } -//============================================================================= - //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh + * BLSURFPlugin_Hypothesis_i::SetGeometricMesh * - * Set PhysicalMesh + * Set GeometricMesh */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh"); +void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh"); ASSERT(myBaseImpl); - this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue); - SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )"; + this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue); + SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh + * BLSURFPlugin_Hypothesis_i::GetGeometricMesh * - * Get PhysicalMesh + * Get GeometricMesh */ //============================================================================= -CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh"); +CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh"); ASSERT(myBaseImpl); - return this->GetImpl()->GetPhysicalMesh(); + return this->GetImpl()->GetGeometricMesh(); } //============================================================================= @@ -128,10 +129,24 @@ CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() { void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) { // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize"); ASSERT(myBaseImpl); - this->GetImpl()->SetPhySize(theValue); + this->GetImpl()->SetPhySize(theValue, false); SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )"; } +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetPhySizeRel + * + * Set Relative PhySize + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue) { +// MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel"); + ASSERT(myBaseImpl); + this->GetImpl()->SetPhySize(theValue, true); + SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << ", isRelative = True )"; +} + //============================================================================= /*! * BLSURFPlugin_Hypothesis_i::GetPhySize @@ -146,214 +161,440 @@ CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() { } //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) { +/*! + * BLSURFPlugin_Hypothesis_i::IsPhySizeRel + * + * Returns True if PhySize is relative + */ +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel() { +// MESSAGE("BLSURFPlugin_Hypothesis_i::IsPhySizeRel"); ASSERT(myBaseImpl); - if (GetPhyMin() != theMinSize) { - this->GetImpl()->SetPhyMin(theMinSize); - SMESH::TPythonDump() << _this() << ".SetPhyMin( " << theMinSize << " )"; + return this->GetImpl()->IsPhySizeRel(); +} + +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) { + ASSERT(myBaseImpl); + if (GetMinSize() != theMinSize) { + this->GetImpl()->SetMinSize(theMinSize, false); + SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )"; } } //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() { +void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize) { ASSERT(myBaseImpl); - return this->GetImpl()->GetPhyMin(); + if ( IsMinSizeRel() && (GetMinSize() != theMinSize) ) { + this->GetImpl()->SetMinSize(theMinSize, true); + SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << ", isRelative = True )"; + } } //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) { +CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize() { ASSERT(myBaseImpl); - if (GetPhyMax() != theMaxSize) { - this->GetImpl()->SetPhyMax(theMaxSize); - SMESH::TPythonDump() << _this() << ".SetPhyMax( " << theMaxSize << " )"; + return this->GetImpl()->GetMinSize(); +} + +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel() { +// MESSAGE("BLSURFPlugin_Hypothesis_i::IsMinSizeRel"); + ASSERT(myBaseImpl); + return this->GetImpl()->IsMinSizeRel(); +} + +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) { + ASSERT(myBaseImpl); + if (GetMaxSize() != theMaxSize) { + this->GetImpl()->SetMaxSize(theMaxSize, false); + SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )"; } } //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() { +void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) { ASSERT(myBaseImpl); - return this->GetImpl()->GetPhyMax(); + if ( IsMaxSizeRel() && (GetMaxSize() != theMaxSize) ) { + this->GetImpl()->SetMaxSize(theMaxSize, true); + SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << ", isRelative = True )"; + } +} + +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize() { + ASSERT(myBaseImpl); + return this->GetImpl()->GetMaxSize(); +} + +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() { +// MESSAGE("BLSURFPlugin_Hypothesis_i::IsMaxSizeRel"); + ASSERT(myBaseImpl); + return this->GetImpl()->IsMaxSizeRel(); } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetGeometricMesh + * BLSURFPlugin_Hypothesis_i::SetGradation * - * Set GeometricMesh + * Set Gradation */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation"); + ASSERT(myBaseImpl); + this->GetImpl()->SetGradation(theValue); + SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )"; +} //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh"); +/*! + * BLSURFPlugin_Hypothesis_i::GetGradation + * + * Get Gradation + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation"); ASSERT(myBaseImpl); - this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue); - SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )"; + return this->GetImpl()->GetGradation(); } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetGeometricMesh + * BLSURFPlugin_Hypothesis_i::SetQuadAllowed * - * Get GeometricMesh + * Set true or false */ //============================================================================= -CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh"); +void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed"); ASSERT(myBaseImpl); - return this->GetImpl()->GetGeometricMesh(); + this->GetImpl()->SetQuadAllowed(theValue); + std::string theValueStr = theValue ? "True" : "False"; + SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetAngleMeshS + * BLSURFPlugin_Hypothesis_i::GetQuadAllowed * - * Set AngleMeshS + * Get true or false */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMeshS"); +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed"); ASSERT(myBaseImpl); - this->GetImpl()->SetAngleMeshS(theValue); - SMESH::TPythonDump() << _this() << ".SetAngleMeshS( " << theValue << " )"; + return this->GetImpl()->GetQuadAllowed(); } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetAngleMeshS + * BLSURFPlugin_Hypothesis_i::SetAngleMesh * - * Get AngleMeshS + * Set AngleMesh */ //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMeshS"); +void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh"); ASSERT(myBaseImpl); - return this->GetImpl()->GetAngleMeshS(); + this->GetImpl()->SetAngleMesh(theValue); + SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )"; } //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double angle) { +/*! + * BLSURFPlugin_Hypothesis_i::GetAngleMesh + * + * Get AngleMesh + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh"); ASSERT(myBaseImpl); - this->GetImpl()->SetAngleMeshC(angle); - SMESH::TPythonDump() << _this() << ".SetAngleMeshC( " << angle << " )"; + return this->GetImpl()->GetAngleMesh(); } //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() { +/*! + * BLSURFPlugin_Hypothesis_i::SetChordalError + * + * Set Chordal Error + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError"); ASSERT(myBaseImpl); - return this->GetImpl()->GetAngleMeshC(); + this->GetImpl()->SetChordalError(theValue); + SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )"; } //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) { +/*! + * BLSURFPlugin_Hypothesis_i::GetChordalError + * + * Get Chordal Error + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError"); ASSERT(myBaseImpl); - if (GetGeoMin() != theMinSize) { - this->GetImpl()->SetGeoMin(theMinSize); - SMESH::TPythonDump() << _this() << ".SetGeoMin( " << theMinSize << " )"; - } + return this->GetImpl()->GetChordalError(); } //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() { +/*! + * BLSURFPlugin_Hypothesis_i::SetAnisotropic + * + * Set true or false + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic"); ASSERT(myBaseImpl); - return this->GetImpl()->GetGeoMin(); + this->GetImpl()->SetAnisotropic(theValue); + std::string theValueStr = theValue ? "True" : "False"; + SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )"; } //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) { +/*! + * BLSURFPlugin_Hypothesis_i::GetAnisotropic + * + * Get true or false + */ +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic"); ASSERT(myBaseImpl); - if (GetGeoMax() != theMaxSize) { - this->GetImpl()->SetGeoMax(theMaxSize); - SMESH::TPythonDump() << _this() << ".SetGeoMax( " << theMaxSize << " )"; - } + return this->GetImpl()->GetAnisotropic(); } //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() { +/*! + * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio + * + * Set Anisotropic Ratio + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio"); ASSERT(myBaseImpl); - return this->GetImpl()->GetGeoMax(); + this->GetImpl()->SetAnisotropicRatio(theValue); + SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetGradation + * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio * - * Set Gradation + * Get Anisotropic Ratio */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation"); +CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio"); ASSERT(myBaseImpl); - this->GetImpl()->SetGradation(theValue); - SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )"; + return this->GetImpl()->GetAnisotropicRatio(); } + //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetGradation + * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges * - * Get Gradation + * Set true or false */ //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation"); +void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges"); ASSERT(myBaseImpl); - return this->GetImpl()->GetGradation(); + this->GetImpl()->SetRemoveTinyEdges(theValue); + std::string theValueStr = theValue ? "True" : "False"; + SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetQuadAllowed + * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges + * + * Get true or false + */ +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetRemoveTinyEdges(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength + * + * Set Tiny Edge Length + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength"); + ASSERT(myBaseImpl); + this->GetImpl()->SetTinyEdgeLength(theValue); + SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength + * + * Get Tiny Edge Length + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetTinyEdgeLength(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval * * Set true or false */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed"); +void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval"); ASSERT(myBaseImpl); - this->GetImpl()->SetQuadAllowed(theValue); + this->GetImpl()->SetBadElementRemoval(theValue); std::string theValueStr = theValue ? "True" : "False"; - SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )"; + SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetQuadAllowed + * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval * * Get true or false */ //============================================================================= -CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed"); +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval"); ASSERT(myBaseImpl); - return this->GetImpl()->GetQuadAllowed(); + return this->GetImpl()->GetBadElementRemoval(); } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetDecimesh + * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio + * + * Set Bad Surface Element Aspect Ratio + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio"); + ASSERT(myBaseImpl); + this->GetImpl()->SetBadElementAspectRatio(theValue); + SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio + * + * Get Bad Surface Element Aspect Ratio + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetBadElementAspectRatio(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh * * Set true or false */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetDecimesh"); +void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh"); ASSERT(myBaseImpl); - this->GetImpl()->SetDecimesh(theValue); + this->GetImpl()->SetOptimizeMesh(theValue); std::string theValueStr = theValue ? "True" : "False"; - SMESH::TPythonDump() << _this() << ".SetDecimesh( " << theValueStr.c_str() << " )"; + SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetDecimesh + * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh * * Get true or false */ //============================================================================= -CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetDecimesh"); +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetOptimizeMesh(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh + * + * Set true or false + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh"); + ASSERT(myBaseImpl); + this->GetImpl()->SetQuadraticMesh(theValue); + std::string theValueStr = theValue ? "True" : "False"; + SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh + * + * Get true or false + */ +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetQuadraticMesh(); +} + + + + + +/*! + * BLSURFPlugin_Hypothesis_i::SetTopology + * + * Set topology + */ + +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology"); + ASSERT(myBaseImpl); + this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue); + SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetTopology + * + * Get Topology + */ +//============================================================================= +CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology"); ASSERT(myBaseImpl); - return this->GetImpl()->GetDecimesh(); + return this->GetImpl()->GetTopology(); } //============================================================================= @@ -402,30 +643,30 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() { //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges + * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology * * Set true or false */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges"); +void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology"); ASSERT(myBaseImpl); - this->GetImpl()->SetPreCADRemoveNanoEdges(theValue); + this->GetImpl()->SetPreCADProcess3DTopology(theValue); std::string theValueStr = theValue ? "True" : "False"; - SMESH::TPythonDump() << _this() << ".SetPreCADRemoveNanoEdges( " << theValueStr.c_str() << " )"; + SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges + * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology * * Get true or false */ //============================================================================= -CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges"); +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology"); ASSERT(myBaseImpl); - return this->GetImpl()->GetPreCADRemoveNanoEdges(); + return this->GetImpl()->GetPreCADProcess3DTopology(); } //============================================================================= @@ -456,32 +697,6 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() { return this->GetImpl()->GetPreCADDiscardInput(); } -//============================================================================= -/*! - * BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano - * - * Set length for nano edges - */ -//============================================================================= -void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano"); - ASSERT(myBaseImpl); - this->GetImpl()->SetPreCADEpsNano(theValue); - SMESH::TPythonDump() << _this() << ".SetPreCADEpsNano( " << theValue << " )"; -} - -//============================================================================= -/*! - * BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano - * - * Get length of nano edges - */ -//============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano"); - ASSERT(myBaseImpl); - return this->GetImpl()->GetPreCADEpsNano(); -} //============================================================================= @@ -695,6 +910,38 @@ void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* s //============================================================================= +void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap) + throw (SALOME::SALOME_Exception) { + ASSERT(myBaseImpl); + MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry); + bool valueChanged = false; + std::ostringstream sizeMapFunction; + switch (shapeType) { + case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break; + case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break; + case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break; + } + try { + valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str()); + if (valueChanged) + this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str()); + } catch (const std::invalid_argument& ex) { + SALOME::ExceptionStruct ExDescription; + ExDescription.text = ex.what(); + ExDescription.type = SALOME::BAD_PARAM; + ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)"; + ExDescription.lineNumber = 0; + throw SALOME::SALOME_Exception(ExDescription); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry); + if (valueChanged) + SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )"; +} + +//============================================================================= + void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor) throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); @@ -725,7 +972,7 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius) //TODO à finir +void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO à finir throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); @@ -937,6 +1184,19 @@ void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, SetSizeMapEntry(entry.c_str(), sizeMap); } +//============================================================================= + +void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) { + ASSERT(myBaseImpl); + string entry = GeomObj->GetStudyEntry(); + GEOM::shape_type shapeType = GeomObj->GetShapeType(); + if (shapeType == GEOM::COMPOUND) + shapeType = GeomObj->GetMaxShapeType(); + MESSAGE("IDL : GetName : " << GeomObj->GetName()); + MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")"); + SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap); +} + //============================================================================= void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) { ASSERT(myBaseImpl); @@ -967,7 +1227,7 @@ void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) { SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )"; } -void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theAttractor, double StartSize, double EndSize, double ActionRadius, double ConstantRadius) +void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theAttractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) { ASSERT(myBaseImpl); string theFaceEntry; @@ -2400,3 +2660,75 @@ char* BLSURFPlugin_Hypothesis_i::GetGMFFile() { CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) { return type == SMESH::DIM_2D; } + +// +// Obsolete methods - To be removed in V7 +// + +void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) { + this->SetMinSize(theMinSize); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() { + return this->GetMinSize(); +} +void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) { + this->SetMaxSize(theMaxSize); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() { + return this->GetMaxSize(); +} +void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) { + this->SetMinSize(theMinSize); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() { + return this->GetMinSize(); +} +void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) { + this->SetMaxSize(theMaxSize); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() { + return this->GetMaxSize(); +} +void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) { + this->SetAngleMesh(theValue); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() { + return this->GetAngleMesh(); +} +void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) { + this->SetAngleMesh(theValue); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() { + return this->GetAngleMesh(); +} +void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) { + std::string theValueStr = theValue ? "1" : "0"; + this->SetOptionValue("respect_geometry",theValueStr.c_str()); +} +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() { + std::string theValueStr = this->GetOptionValue("respect_geometry"); + if (theValueStr.empty() || theValueStr == "respect") + return true; + return false; +} +void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) { + std::string theValueStr = theValue ? "1" : "0"; + this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str()); +} +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() { + std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges"); + if (theValueStr == "1") + return true; + return false; +} +void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) { + std::ostringstream theValueStr; + theValueStr << theValue; + this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str()); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() { + std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length")); + double result; + theValueStr >> result; + return result; +} diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx index 2c96546..3712bee 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx @@ -45,35 +45,26 @@ public: // Destructor virtual ~BLSURFPlugin_Hypothesis_i(); - void SetTopology(CORBA::Long theValue); - CORBA::Long GetTopology(); - void SetPhysicalMesh(CORBA::Long theValue); CORBA::Long GetPhysicalMesh(); - void SetPhySize(CORBA::Double theValue); - CORBA::Double GetPhySize(); - - void SetPhyMin(CORBA::Double theMinSize); - CORBA::Double GetPhyMin(); - - void SetPhyMax(CORBA::Double theMaxSize); - CORBA::Double GetPhyMax(); - void SetGeometricMesh(CORBA::Long theValue); CORBA::Long GetGeometricMesh(); - void SetAngleMeshS(CORBA::Double theValue); - CORBA::Double GetAngleMeshS(); - - void SetAngleMeshC(CORBA::Double angle); - CORBA::Double GetAngleMeshC(); + void SetPhySize(CORBA::Double theValue); + void SetPhySizeRel(CORBA::Double theValue); + CORBA::Double GetPhySize(); + CORBA::Boolean IsPhySizeRel(); - void SetGeoMin(CORBA::Double theMinSize); - CORBA::Double GetGeoMin(); + void SetMinSize(CORBA::Double theMinSize); + void SetMinSizeRel(CORBA::Double theMinSize); + CORBA::Double GetMinSize(); + CORBA::Boolean IsMinSizeRel(); - void SetGeoMax(CORBA::Double theMaxSize); - CORBA::Double GetGeoMax(); + void SetMaxSize(CORBA::Double theMaxSize); + void SetMaxSizeRel(CORBA::Double theMaxSize); + CORBA::Double GetMaxSize(); + CORBA::Boolean IsMaxSizeRel(); void SetGradation(CORBA::Double theValue); CORBA::Double GetGradation(); @@ -81,8 +72,38 @@ public: void SetQuadAllowed(CORBA::Boolean theValue); CORBA::Boolean GetQuadAllowed(); - void SetDecimesh(CORBA::Boolean theValue); - CORBA::Boolean GetDecimesh(); + void SetAngleMesh(CORBA::Double theValue); + CORBA::Double GetAngleMesh(); + + void SetChordalError(CORBA::Double distance); + CORBA::Double GetChordalError(); + + void SetAnisotropic(CORBA::Boolean anisotropic); + CORBA::Boolean GetAnisotropic(); + + void SetAnisotropicRatio(CORBA::Double ratio); + CORBA::Double GetAnisotropicRatio(); + + void SetRemoveTinyEdges(CORBA::Boolean remove); + CORBA::Boolean GetRemoveTinyEdges(); + + void SetTinyEdgeLength(CORBA::Double length); + CORBA::Double GetTinyEdgeLength(); + + void SetBadElementRemoval(CORBA::Boolean remove); + CORBA::Boolean GetBadElementRemoval(); + + void SetBadElementAspectRatio(CORBA::Double ratio); + CORBA::Double GetBadElementAspectRatio(); + + void SetOptimizeMesh(CORBA::Boolean optimize); + CORBA::Boolean GetOptimizeMesh(); + + void SetQuadraticMesh(CORBA::Boolean quadratic); + CORBA::Boolean GetQuadraticMesh(); + + void SetTopology(CORBA::Long theValue); + CORBA::Long GetTopology(); void SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception); CORBA::Short GetVerbosity(); @@ -90,15 +111,12 @@ public: void SetPreCADMergeEdges(CORBA::Boolean theValue); CORBA::Boolean GetPreCADMergeEdges(); - void SetPreCADRemoveNanoEdges(CORBA::Boolean theValue); - CORBA::Boolean GetPreCADRemoveNanoEdges(); + void SetPreCADProcess3DTopology(CORBA::Boolean theValue); + CORBA::Boolean GetPreCADProcess3DTopology(); void SetPreCADDiscardInput(CORBA::Boolean theValue); CORBA::Boolean GetPreCADDiscardInput(); - void SetPreCADEpsNano(CORBA::Double theValue); - CORBA::Double GetPreCADEpsNano(); - void SetOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception); void SetPreCADOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception); char* GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception); @@ -115,6 +133,8 @@ public: void SetSizeMapEntry(const char* entry, const char* sizeMap) throw (SALOME::SALOME_Exception); + void SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap) throw (SALOME::SALOME_Exception); + char* GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception); void UnsetEntry(const char* entry); @@ -125,6 +145,8 @@ public: void SetSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap); + void SetConstantSizeMap(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap); + void UnsetSizeMap(GEOM::GEOM_Object_ptr GeomObj); void ClearSizeMaps(); @@ -144,11 +166,11 @@ public: * Set/get/unset an attractor on a face */ - void SetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj, GEOM::GEOM_Object_ptr Attractor, double StartSize, double EndSize, double ActionRadius, double ConstantRadius ); + void SetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj, GEOM::GEOM_Object_ptr Attractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius ); void UnsetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj); - void SetClassAttractorEntry(const char* entry, const char* att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius) throw (SALOME::SALOME_Exception); + void SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) throw (SALOME::SALOME_Exception); BLSURFPlugin::TAttParamsMap* GetAttractorParams(); @@ -247,6 +269,29 @@ public: // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported(SMESH::Dimension type); + + + // + // Obsolete methods - To be removed in V7 + // + void SetPhyMin(CORBA::Double theMinSize); + CORBA::Double GetPhyMin(); + void SetPhyMax(CORBA::Double theMaxSize); + CORBA::Double GetPhyMax(); + void SetGeoMin(CORBA::Double theMinSize); + CORBA::Double GetGeoMin(); + void SetGeoMax(CORBA::Double theMaxSize); + CORBA::Double GetGeoMax(); + void SetAngleMeshS(CORBA::Double angle); + CORBA::Double GetAngleMeshS(); + void SetAngleMeshC(CORBA::Double angle); + CORBA::Double GetAngleMeshC(); + void SetDecimesh(CORBA::Boolean toIgnoreEdges); + CORBA::Boolean GetDecimesh(); + void SetPreCADRemoveNanoEdges(CORBA::Boolean toRemoveNanoEdges); + CORBA::Boolean GetPreCADRemoveNanoEdges(); + void SetPreCADEpsNano(CORBA::Double epsNano); + CORBA::Double GetPreCADEpsNano(); }; #endif diff --git a/src/BLSURFPlugin/Makefile.am b/src/BLSURFPlugin/Makefile.am index 2d9cab3..6b0ad88 100644 --- a/src/BLSURFPlugin/Makefile.am +++ b/src/BLSURFPlugin/Makefile.am @@ -43,20 +43,20 @@ dist_libBLSURFEngine_la_SOURCES = \ BLSURFPlugin_i.cxx \ BLSURFPlugin_Attractor.cxx -libBLSURFEngine_la_CPPFLAGS = \ - $(QT_INCLUDES) \ - $(PYTHON_INCLUDES) \ - $(KERNEL_CXXFLAGS) \ - $(GUI_CXXFLAGS) \ - $(MED_CXXFLAGS) \ - $(GEOM_CXXFLAGS) \ - $(CAS_CPPFLAGS) \ - $(VTK_INCLUDES) \ - $(BLSURF_INCLUDES) \ - $(SMESH_CXXFLAGS) \ - $(CORBA_CXXFLAGS) \ - $(CORBA_INCLUDES) \ - $(BOOST_CPPFLAGS) \ +libBLSURFEngine_la_CPPFLAGS = \ + $(QT_INCLUDES) \ + $(PYTHON_INCLUDES) \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + $(MED_CXXFLAGS) \ + $(GEOM_CXXFLAGS) \ + $(CAS_CPPFLAGS) \ + $(VTK_INCLUDES) \ + $(MESHGEMS_CADSURF_INCLUDES) \ + $(SMESH_CXXFLAGS) \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + $(BOOST_CPPFLAGS) \ -I$(top_builddir)/idl #Qt uniquement necessaire pour le getActiveStudyDocument de SMeshGuiUtils.h @@ -65,7 +65,7 @@ libBLSURFEngine_la_LDFLAGS = \ ../../idl/libSalomeIDLBLSURFPLUGIN.la \ $(PYTHON_LIBS) \ $(CAS_KERNEL) -lTKBRep -lTKGeomBase -lTKGeomAlgo -lTKTopAlgo -lTKLCAF -lTKXSBase -lTKG2d -lTKG3d -lTKShHealing \ - $(BLSURF_LIBS) \ + $(MESHGEMS_CADSURF_LIBS) \ $(SMESH_LDFLAGS) -lSMESHimpl -lSMESHEngine -lStdMeshers -lStdMeshersEngine -lSMDS -lSMESHDS \ $(GEOM_LDFLAGS) -lGEOMbasic \ $(MED_LDFLAGS) -lSalomeIDLMED \ diff --git a/src/GUI/BLSURFPluginGUI_AdvWidget.cxx b/src/GUI/BLSURFPluginGUI_AdvWidget.cxx new file mode 100644 index 0000000..314f492 --- /dev/null +++ b/src/GUI/BLSURFPluginGUI_AdvWidget.cxx @@ -0,0 +1,56 @@ +// Copyright (C) 2007-2012 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 : BLSURFPluginGUI_Dlg.cxx +// Authors : Gilles DAVID (OCC) +// --- +// + +#include "BLSURFPluginGUI_Dlg.h" + +#include + +#include + + +////////////////////////////////////////// +// BLSURFPluginGUI_AdvWidget +////////////////////////////////////////// + +BLSURFPluginGUI_AdvWidget::BLSURFPluginGUI_AdvWidget( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); + myOptionTable->horizontalHeader()->hideSection( OPTION_ID_COLUMN ); +} + +BLSURFPluginGUI_AdvWidget::~BLSURFPluginGUI_AdvWidget() +{ +} + +void BLSURFPluginGUI_AdvWidget::onChooseGMFFile() { + QString fileName = QFileDialog::getSaveFileName(0, tr("BLSURF_GMF_FILE_DIALOG"), myGMFFileName->text(), tr("BLSURF_GMF_FILE_FORMAT")); + std::cout << "fileName: " << fileName.toStdString() << std::endl; + if (!fileName.endsWith(".mesh") && !fileName.endsWith(".meshb")) + fileName.append(".mesh"); + myGMFFileName->setText(fileName); +} + + diff --git a/src/GUI/BLSURFPluginGUI_AdvWidget_QTD.ui b/src/GUI/BLSURFPluginGUI_AdvWidget_QTD.ui new file mode 100644 index 0000000..b9580bf --- /dev/null +++ b/src/GUI/BLSURFPluginGUI_AdvWidget_QTD.ui @@ -0,0 +1,202 @@ + + + BLSURFPluginGUI_AdvWidget_QTD + + + + 0 + 0 + 567 + 226 + + + + + 0 + + + + + + + true + + + true + + + true + + + false + + + false + + + true + + + + OPTION_ID_COLUMN + + + + + OPTION_TYPE_COLUMN + + + + + OPTION_NAME_COLUMN + + + + + OPTION_VALUE_COLUMN + + + + + + + + BLSURF_ADD_OPTION + + + + + + + BLSURF_REMOVE_OPTION + + + + + + + + + 0 + + + + + BLSURF_PRECAD_GROUP + + + true + + + false + + + + + + BLSURF_PRECAD_MERGE_EDGES + + + true + + + + + + + BLSURF_PRECAD_PROCESS_3D_TOPOLOGY + + + true + + + + + + + BLSURF_PRECAD_DISCARD_INPUT + + + + + + + + + + BLSURF_GMF_FILE + + + + + + + + + + Qt::Vertical + + + + 20 + 53 + + + + + + + + BLSURF_VERBOSITY + + + + + + + 100 + + + 5 + + + + + + + + + myOptionTable + addBtn + rmBtn + myPreCADGroupBox + myPreCADMergeEdges + myPreCADProcess3DTopology + myPreCADDiscardInput + myVerbosity + chooseGMFBtn + myGMFFileName + + + + + chooseGMFBtn + clicked() + BLSURFPluginGUI_AdvWidget_QTD + onChooseGMFFile() + + + 371 + 136 + + + 328 + 194 + + + + + + onChooseGMFFile() + + diff --git a/src/GUI/BLSURFPluginGUI_Dlg.h b/src/GUI/BLSURFPluginGUI_Dlg.h new file mode 100644 index 0000000..a8693fe --- /dev/null +++ b/src/GUI/BLSURFPluginGUI_Dlg.h @@ -0,0 +1,97 @@ +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : DlgRef.h +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) + +#ifndef BLSURFPLUGINGUI_H +#define BLSURFPLUGINGUI_H + +enum PhysicalMesh + { + DefaultSize = 0, + PhysicalGlobalSize, + PhysicalLocalSize + }; + +enum GeometricMesh + { + DefaultGeom = 0, + GeometricalGlobalSize, + GeometricalLocalSize + }; + +enum Topology { + FromCAD = 0, + Process, + Process2, + PreCAD + } ; + +enum { + OPTION_ID_COLUMN = 0, + OPTION_TYPE_COLUMN, + OPTION_NAME_COLUMN, + OPTION_VALUE_COLUMN, + NB_COLUMNS, +}; + +////////////////////////////////////////// +// BLSURFPluginGUI_StdWidget +////////////////////////////////////////// + +#include "ui_BLSURFPluginGUI_StdWidget_QTD.h" +#include "BLSURFPluginGUI_HypothesisCreator.h" + +class BLSURFPLUGIN_GUI_EXPORT BLSURFPluginGUI_StdWidget : public QWidget, + public Ui::BLSURFPluginGUI_StdWidget_QTD +{ + Q_OBJECT + +public: + BLSURFPluginGUI_StdWidget( QWidget* = 0, Qt::WindowFlags = 0 ); + ~BLSURFPluginGUI_StdWidget(); + +public slots: + void onPhysicalMeshChanged(); + void onGeometricMeshChanged(); + void onEditingFinished(); + void resizeWidgets(); +}; + +////////////////////////////////////////// +// BLSURFPluginGUI_AdvWidget +////////////////////////////////////////// + +#include "ui_BLSURFPluginGUI_AdvWidget_QTD.h" + +class BLSURFPLUGIN_GUI_EXPORT BLSURFPluginGUI_AdvWidget : public QWidget, + public Ui::BLSURFPluginGUI_AdvWidget_QTD +{ + Q_OBJECT + +public: + BLSURFPluginGUI_AdvWidget( QWidget* = 0, Qt::WindowFlags = 0 ); + ~BLSURFPluginGUI_AdvWidget(); + +public slots: + void onChooseGMFFile(); +}; + +#endif \ No newline at end of file diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index 4884edf..daee40e 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -25,7 +25,7 @@ // --- // #include "BLSURFPluginGUI_HypothesisCreator.h" -// #include +#include "BLSURFPluginGUI_Dlg.h" #include "GeometryGUI.h" @@ -40,25 +40,24 @@ #include #include -#include +#include +#include #include -#include -#include #include -#include #include +#include #include +#include +#include #include -#include -#include -#include -#include #include -#include -#include -#include +#include +#include #include -#include +#include +#include +#include +#include #include #include @@ -81,38 +80,12 @@ #include #include -#define WITH_SIZE_BOUNDARIES - -enum Topology { - FromCAD, - Process, - Process2, - PreCAD - } ; - -enum PhysicalMesh - { - DefaultSize = 0, - PhysicalUserDefined, - SizeMap - }; - -enum GeometricMesh - { - DefaultGeom = 0, - UserDefined - }; enum { STD_TAB = 0, ADV_TAB, SMP_TAB, ENF_TAB, - OPTION_ID_COLUMN = 0, - OPTION_TYPE_COLUMN, - OPTION_NAME_COLUMN, - OPTION_VALUE_COLUMN, - NB_COLUMNS, SMP_NAME_COLUMN =0, SMP_SIZEMAP_COLUMN, SMP_ENTRY_COLUMN, @@ -426,75 +399,6 @@ bool EnforcedTreeWidgetDelegate::vertexExists(QAbstractItemModel *model, // END EnforcedTreeWidgetDelegate // -// -// BEGIN BLSURFPluginGUI_ObjectReferenceParamWdg -// -//================================================================================ - -// BLSURFPluginGUI_ObjectReferenceParamWdg::BLSURFPluginGUI_ObjectReferenceParamWdg -// ( SUIT_SelectionFilter* f, QWidget* parent, bool multiSelection) -// : StdMeshersGUI_ObjectReferenceParamWdg(f, parent, multiSelection) -// { -// init(); -// } -// -// -// BLSURFPluginGUI_ObjectReferenceParamWdg::BLSURFPluginGUI_ObjectReferenceParamWdg -// ( MeshObjectType objType, QWidget* parent, bool multiSelection ) -// : StdMeshersGUI_ObjectReferenceParamWdg( objType, parent, multiSelection ) -// { -// init(); -// } -// -// BLSURFPluginGUI_ObjectReferenceParamWdg::~BLSURFPluginGUI_ObjectReferenceParamWdg() -// { -// if ( myFilter ) -// { -// mySelectionMgr->removeFilter( myFilter ); -// delete myFilter; -// } -// } -// -// void BLSURFPluginGUI_ObjectReferenceParamWdg::init() -// { -// StdMeshersGUI_ObjectReferenceParamWdg::init(); -// disconnect( mySelButton, SIGNAL(clicked()), SLOT(activateSelection())); -// connect( mySelButton, SIGNAL(toggled(bool)), SLOT(setActivationStatus(bool))); -// } -// -// void BLSURFPluginGUI_ObjectReferenceParamWdg::setActivationStatus(bool status) -// { -// if (status) -// activateSelection(); -// else -// deactivateSelection(); -// } -// -// void BLSURFPluginGUI_ObjectReferenceParamWdg::activateSelectionOnly() -// { -// if ( !mySelectionActivated && mySelectionMgr ) -// { -// mySelectionActivated = true; -// mySelectionMgr->clearFilters(); -// if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) -// aViewWindow->SetSelectionMode(ActorSelection); -// if ( myFilter ) -// mySelectionMgr->installFilter( myFilter ); -// connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); -// } -// emit selectionActivated(); -// } -// -// void BLSURFPluginGUI_ObjectReferenceParamWdg::deactivateSelectionOnly() -// { -// mySelectionActivated = false; -// disconnect(mySelectionMgr, 0, this, 0 ); -// mySelectionMgr->removeFilter( myFilter ); -// } -// -// -// END BLSURFPluginGUI_ObjectReferenceParamWdg -// /** * \brief {BLSURFPluginGUI_HypothesisCreator constructor} @@ -562,17 +466,17 @@ bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const if ( ok ) { - myOptionTable->setFocus(); + myAdvWidget->myOptionTable->setFocus(); QApplication::instance()->processEvents(); - int row = 0, nbRows = myOptionTable->rowCount(); + int row = 0, nbRows = myAdvWidget->myOptionTable->rowCount(); for ( ; row < nbRows; ++row ) { - QString name = myOptionTable->item( row, OPTION_NAME_COLUMN )->text(); - QString value = myOptionTable->item( row, OPTION_VALUE_COLUMN )->text().trimmed(); + QString name = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text(); + QString value = myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->text().trimmed(); if ( !value.isEmpty() ) { try { - QString optionType = myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().trimmed(); + QString optionType = myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().trimmed(); if (optionType == "PRECAD") h->SetPreCADOptionValue( name.toLatin1().constData(), value.toLatin1().constData() ); else if (optionType == "BLSURF") @@ -656,169 +560,43 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() tab->setTabPosition( QTabWidget::North ); lay->addWidget( tab ); + myName = 0; + // basic parameters myStdGroup = new QWidget(); QGridLayout* aStdLayout = new QGridLayout( myStdGroup ); aStdLayout->setSpacing( 6 ); aStdLayout->setMargin( 11 ); - - myName = 0; + if( isCreation() ) myName = new QLineEdit( myStdGroup ); - - myGradation = new SMESHGUI_SpinBox( myStdGroup ); - myGradation->RangeStepAndValidator(1.1, 2.5, 0.1, "length_precision"); - - myPhysicalMesh = new QComboBox( myStdGroup ); - QStringList physicalTypes; - physicalTypes << tr( "BLSURF_DEFAULT_USER" ) << tr( "BLSURF_CUSTOM_USER" ) << tr( "BLSURF_SIZE_MAP"); - myPhysicalMesh->addItems( physicalTypes ); - - myPhySize = new SMESHGUI_SpinBox( myStdGroup ); - myPhySize->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision"); - -#ifdef WITH_SIZE_BOUNDARIES - myPhyMin = new SMESHGUI_SpinBox( myStdGroup ); - myPhyMin->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision"); - myPhyMin->setText(""); - myPhyMax = new SMESHGUI_SpinBox( myStdGroup ); - myPhyMax->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision"); - myPhyMax->setText(""); -#endif - - myGeometricMesh = new QComboBox( myStdGroup ); - QStringList types; - types << tr( "BLSURF_DEFAULT_GEOM" ) << tr( "BLSURF_CUSTOM_GEOM" ); - myGeometricMesh->addItems( types ); - - myAngleMeshS = new SMESHGUI_SpinBox( myStdGroup ); - myAngleMeshS->RangeStepAndValidator(0, 16, 0.5, "angular_precision"); - - myAngleMeshC = new SMESHGUI_SpinBox( myStdGroup ); - myAngleMeshC->RangeStepAndValidator(0, 16, 0.5, "angular_precision"); - -#ifdef WITH_SIZE_BOUNDARIES - myGeoMin = new SMESHGUI_SpinBox( myStdGroup ); - myGeoMin->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision"); - myGeoMin->setText(""); - myGeoMax = new SMESHGUI_SpinBox( myStdGroup ); - myGeoMax->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision"); - myGeoMax->setText(""); -#endif - myAllowQuadrangles = new QCheckBox( tr( "BLSURF_ALLOW_QUADRANGLES" ), myStdGroup ); - myDecimesh = new QCheckBox( tr( "BLSURF_DECIMESH" ), myStdGroup ); - - // ADD WIDGETS (STANDARD TAB) + myStdWidget = new BLSURFPluginGUI_StdWidget(myStdGroup); + int row = 0; if( isCreation() ) { - aStdLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), myStdGroup ), row, 0, 1, 1 ); - aStdLayout->addWidget( myName, row++, 1, 1, 3 ); - } - aStdLayout->addWidget( new QLabel( tr( "BLSURF_PHY_MESH" ), myStdGroup ), row, 0, 1, 1 ); - aStdLayout->addWidget( myPhysicalMesh, row++, 1, 1, 1 ); - aStdLayout->addWidget( new QLabel( tr( "BLSURF_HPHYDEF" ), myStdGroup), row, 0, 1, 1 ); - aStdLayout->addWidget( myPhySize, row++, 1, 1, 1 ); - aStdLayout->addWidget( new QLabel( tr( "BLSURF_GRADATION" ), myStdGroup ), row, 0, 1, 1 ); - aStdLayout->addWidget( myGradation, row++, 1, 1, 1 ); -#ifdef WITH_SIZE_BOUNDARIES - aStdLayout->addWidget( new QLabel( tr( "BLSURF_HPHYMIN" ), myStdGroup ), row, 0, 1, 1 ); - aStdLayout->addWidget( myPhyMin, row++, 1, 1, 1 ); - aStdLayout->addWidget( new QLabel( tr( "BLSURF_HPHYMAX" ), myStdGroup ), row, 0, 1, 1 ); - aStdLayout->addWidget( myPhyMax, row++, 1, 1, 1 ); -#endif + aStdLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), myStdGroup ), 0, 0, 1, 1 ); + aStdLayout->addWidget( myName, row++, 1, 1, 3 ); + } + aStdLayout->addWidget( myStdWidget, row++, 0, 1, 4 ); + int maxrow = row; + row = 0; if( isCreation() ) row = 1; - else - row = 0; - aStdLayout->addWidget( new QLabel( tr( "BLSURF_GEOM_MESH" ), myStdGroup ), row, 2, 1, 1 ); - aStdLayout->addWidget( myGeometricMesh, row++, 3, 1, 1 ); - aStdLayout->addWidget( new QLabel( tr( "BLSURF_ANGLE_MESH_S" ), myStdGroup ), row, 2, 1, 1 ); - aStdLayout->addWidget( myAngleMeshS, row++, 3, 1, 1 ); - aStdLayout->addWidget( new QLabel( tr( "BLSURF_ANGLE_MESH_C" ), myStdGroup ), row, 2, 1, 1 ); - aStdLayout->addWidget( myAngleMeshC, row++, 3, 1, 1 ); -#ifdef WITH_SIZE_BOUNDARIES - aStdLayout->addWidget( new QLabel( tr( "BLSURF_HGEOMIN" ), myStdGroup ), row, 2, 1, 1 ); - aStdLayout->addWidget( myGeoMin, row++, 3, 1, 1 ); - aStdLayout->addWidget( new QLabel( tr( "BLSURF_HGEOMAX" ), myStdGroup ), row, 2, 1, 1 ); - aStdLayout->addWidget( myGeoMax, row++, 3, 1, 1 ); -#endif - row = max(row,maxrow)+1; - aStdLayout->addWidget( myAllowQuadrangles, row, 0, 1, 2 ); - aStdLayout->addWidget( myDecimesh, row++, 2, 1, 2 ); +// row = max(row,maxrow)+1; aStdLayout->setRowStretch(row,1); + aStdLayout->setColumnStretch(1,1); maxrow = row; + // advanced parameters myAdvGroup = new QWidget(); QGridLayout* anAdvLayout = new QGridLayout( myAdvGroup ); anAdvLayout->setSpacing( 6 ); - anAdvLayout->setMargin( 11 ); - anAdvLayout->setRowStretch( 4, 5 ); - anAdvLayout->setColumnStretch( 1, 5 ); - - myTopology = new QComboBox( myAdvGroup ); - QStringList topologyTypes; - topologyTypes << tr( "BLSURF_TOPOLOGY_CAD" ) - << tr( "BLSURF_TOPOLOGY_PROCESS" ) - << tr( "BLSURF_TOPOLOGY_PROCESS2" ) - << tr( "BLSURF_TOPOLOGY_PRECAD" ); - myTopology->addItems( topologyTypes ); - - myVerbosity = new QSpinBox( myAdvGroup ); - myVerbosity->setMinimum( 0 ); - myVerbosity->setMaximum( 100 ); - myVerbosity->setSingleStep( 5 ); - - myOptionTable = new QTableWidget( 0, NB_COLUMNS, myAdvGroup ); - QStringList headers; - headers << tr( "OPTION_ID_COLUMN" )<< tr( "OPTION_TYPE_COLUMN" ) << tr( "OPTION_NAME_COLUMN" ) << tr( "OPTION_VALUE_COLUMN" ); - myOptionTable->setHorizontalHeaderLabels( headers ); - myOptionTable->horizontalHeader()->hideSection( OPTION_ID_COLUMN ); -// myOptionTable->horizontalHeader()->hideSection( OPTION_TYPE_COLUMN ); - myOptionTable->horizontalHeader()->setStretchLastSection(true); - myOptionTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft); - //myOptionTable->setColumnReadOnly( OPTION_NAME_COLUMN, TRUE );////// - //myOptionTable->setColumnReadOnly( OPTION_VALUE_COLUMN, FALSE );///// - myOptionTable->verticalHeader()->hide(); - //myOptionTable->setSelectionBehavior( QAbstractItemView::SelectRows ); - - QPushButton* addBtn = new QPushButton( tr( "ADD_OPTION"), myAdvGroup ); - addBtn->setMenu( new QMenu() ); - QPushButton* rmBtn = new QPushButton( tr( "REMOVE_OPTION"), myAdvGroup ); - - myPreCADGroupBox = new QGroupBox(tr("BLSURF_PRECAD_GROUP"), myAdvGroup ); - myPreCADGroupBox->setEnabled(false); - QGridLayout* aPreCADGroupLayout = new QGridLayout(myPreCADGroupBox); - myPreCADMergeEdges = new QCheckBox(tr("BLSURF_PRECAD_MERGE_EDGES"),myPreCADGroupBox); - aPreCADGroupLayout->addWidget(myPreCADMergeEdges,0,0,1,2); - myPreCADRemoveNanoEdges = new QCheckBox(tr("BLSURF_PRECAD_REMOVE_NANO_EDGES"),myPreCADGroupBox); - aPreCADGroupLayout->addWidget(myPreCADRemoveNanoEdges,1,0,1,2); - myPreCADEpsNano = new SMESHGUI_SpinBox(myPreCADGroupBox); - myPreCADEpsNano->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision"); - myPreCADEpsNano->setText(""); - aPreCADGroupLayout->addWidget( new QLabel( tr( "BLSURF_PRECAD_EPS_NANO" ), myPreCADGroupBox ), 2, 0, 1, 1 ); - aPreCADGroupLayout->addWidget(myPreCADEpsNano, 2, 1, 1, 1 ); - myPreCADDiscardInput = new QCheckBox(tr("BLSURF_PRECAD_DISCARD_INPUT"),myPreCADGroupBox); - aPreCADGroupLayout->addWidget(myPreCADDiscardInput, 3, 0, 1, 2); - - QPushButton* chooseGMFBtn = new QPushButton( tr( "BLSURF_GMF_FILE" ), myAdvGroup ); - myGMFFileName = new QLineEdit(myAdvGroup); -// myGMFFileMode = new QCheckBox(tr("BLSURF_GMF_MODE"),myAdvGroup); - - // ADD WIDGETS (ADVANCED TAB) - anAdvLayout->addWidget( new QLabel( tr( "BLSURF_VERBOSITY" ), myAdvGroup ), 0, 0, 1, 1 ); - anAdvLayout->addWidget( myVerbosity, 0, 1, 1, 1 ); - anAdvLayout->addWidget( new QLabel( tr( "BLSURF_TOPOLOGY" ), myAdvGroup ), 1, 0, 1, 1 ); - anAdvLayout->addWidget( myTopology, 1, 1, 1, 1 ); - anAdvLayout->addWidget( myPreCADGroupBox , 2, 0, 1, 2 ); - anAdvLayout->addWidget( addBtn, 0, 2, 1, 1 ); - anAdvLayout->addWidget( rmBtn, 0, 3, 1, 1 ); - anAdvLayout->addWidget( myOptionTable, 1, 2, 3, 2 ); - anAdvLayout->addWidget( chooseGMFBtn, 3, 0, 1, 1 ); - anAdvLayout->addWidget( myGMFFileName, 3, 1, 1, 1 ); -// anAdvLayout->addWidget( myGMFFileMode, 4, 0, 1, 2 ); - anAdvLayout->setRowStretch(4,1); + anAdvLayout->setMargin( 11 ); + myAdvWidget = new BLSURFPluginGUI_AdvWidget(myAdvGroup); + myAdvWidget->addBtn->setMenu( new QMenu() ); + anAdvLayout->addWidget( myAdvWidget); // Size Maps parameters @@ -1057,19 +835,14 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() // --- tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) ); tab->insertTab( ADV_TAB, myAdvGroup, tr( "BLSURF_ADV_ARGS" ) ); - tab->insertTab( SMP_TAB, mySmpGroup, tr( "BLSURF_SIZE_MAP" ) ); + tab->insertTab( SMP_TAB, mySmpGroup, tr( "LOCAL_SIZE" ) ); tab->insertTab( ENF_TAB, myEnfGroup, tr( "BLSURF_ENF_VER" ) ); tab->setCurrentIndex( STD_TAB ); - // --- - connect( myGeometricMesh, SIGNAL( activated( int ) ), this, SLOT( onGeometricMeshChanged() ) ); - connect( myPhysicalMesh, SIGNAL( activated( int ) ), this, SLOT( onPhysicalMeshChanged() ) ); - connect( myTopology, SIGNAL( activated( int ) ), this, SLOT( onTopologyChanged( int ) ) ); - connect( addBtn->menu(), SIGNAL( aboutToShow() ), this, SLOT( onAddOption() ) ); - connect( addBtn->menu(), SIGNAL( triggered( QAction* ) ), this, SLOT( onOptionChosenInPopup( QAction* ) ) ); - connect( rmBtn, SIGNAL( clicked()), this, SLOT( onDeleteOption() ) ); - connect( chooseGMFBtn, SIGNAL( clicked()), this, SLOT( onChooseGMFFile() ) ); + connect( myAdvWidget->addBtn->menu(), SIGNAL( aboutToShow() ), this, SLOT( onAddOption() ) ); + connect( myAdvWidget->addBtn->menu(), SIGNAL( triggered( QAction* ) ), this, SLOT( onOptionChosenInPopup( QAction* ) ) ); + connect( myAdvWidget->rmBtn, SIGNAL( clicked()), this, SLOT( onDeleteOption() ) ); // Size Maps connect( addMapButton, SIGNAL( clicked()), this, SLOT( onAddMap() ) ); @@ -1430,9 +1203,9 @@ void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices() { for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column) myEnforcedTreeWidget->resizeColumnToContents(column); - if ( myPhysicalMesh->currentIndex() != SizeMap ) { - myPhysicalMesh->setCurrentIndex( SizeMap ); - onPhysicalMeshChanged(); + if ( myStdWidget->myPhysicalMesh->currentIndex() != PhysicalLocalSize ) { + myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize ); + myStdWidget->onPhysicalMeshChanged(); } } @@ -1482,12 +1255,7 @@ void BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex() { void BLSURFPluginGUI_HypothesisCreator::onInternalVerticesClicked(int state) { - if (state == Qt::Checked) { - myInternalEnforcedVerticesAllFacesGroup->setEnabled(true); - } - if (state == Qt::Unchecked) { - myInternalEnforcedVerticesAllFacesGroup->setEnabled(false); - } + myInternalEnforcedVerticesAllFacesGroup->setEnabled(state == Qt::Checked); } /** BLSURFPluginGUI_HypothesisCreator::retrieveParams() @@ -1506,47 +1274,62 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const QFontMetrics metrics( myName->font() ); myName->setMinimumWidth( metrics.width( data.myName )+5 ); } - myTopology->setCurrentIndex( data.myTopology ); - myPreCADGroupBox->setEnabled(data.myTopology == PreCAD); - myPreCADMergeEdges->setChecked( data.myPreCADMergeEdges ); - myPreCADRemoveNanoEdges->setChecked( data.myPreCADRemoveNanoEdges ); - myPreCADDiscardInput->setChecked( data.myPreCADDiscardInput ); - MESSAGE("data.myPreCADEpsNano: "<setText(""); + myStdWidget->myPhysicalMesh->setCurrentIndex( data.myPhysicalMesh ); + myStdWidget->myGeometricMesh->setCurrentIndex( data.myGeometricMesh ); + if (data.myPhySize <= 0) + myStdWidget->myPhySize->setText(""); else - myPreCADEpsNano->SetValue( data.myPreCADEpsNano ); - myPhysicalMesh->setCurrentIndex( data.myPhysicalMesh ); - myPhySize->SetValue( data.myPhySize ); -#ifdef WITH_SIZE_BOUNDARIES - MESSAGE("data.myPhyMin: "<setText(""); + myStdWidget->myPhySize->SetValue( data.myPhySize ); + myStdWidget->myPhySizeRel->setChecked( data.myPhySizeRel ); + if (data.myMinSize < 0) + myStdWidget->myMinSize->setText(""); else - myPhyMin->SetValue( data.myPhyMin ); - MESSAGE("data.myPhyMax: "<setText(""); + myStdWidget->myMinSize->SetValue( data.myMinSize ); + myStdWidget->myMinSizeRel->setChecked( data.myMinSizeRel ); + if (data.myMaxSize < 0) + myStdWidget->myMaxSize->setText(""); else - myPhyMax->SetValue( data.myPhyMax ); - MESSAGE("data.myGeoMin: "<setText(""); + myStdWidget->myMaxSize->SetValue( data.myMaxSize ); + myStdWidget->myMaxSizeRel->setChecked( data.myMaxSizeRel ); + if (data.myGradation <= 0) + myStdWidget->myGradation->setText(""); else - myGeoMin->SetValue( data.myGeoMin ); - MESSAGE("data.myGeoMax: "<setText(""); + myStdWidget->myGradation->SetValue( data.myGradation ); + myStdWidget->myAllowQuadrangles->setChecked( data.myAllowQuadrangles ); + + if (data.myAngleMesh < 0) + myStdWidget->myAngleMesh->setText(""); else - myGeoMax->SetValue( data.myGeoMax ); -#endif - myGeometricMesh->setCurrentIndex( data.myGeometricMesh ); - myAngleMeshS->SetValue( data.myAngleMeshS ); - myAngleMeshC->SetValue( data.myAngleMeshC ); - myGradation->SetValue( data.myGradation ); - myAllowQuadrangles->setChecked( data.myAllowQuadrangles ); - myDecimesh->setChecked( data.myDecimesh ); - myVerbosity->setValue( data.myVerbosity ); + myStdWidget->myAngleMesh->SetValue( data.myAngleMesh ); + if (data.myChordalError <= 0) + myStdWidget->myChordalError->setText(""); + else + myStdWidget->myChordalError->SetValue( data.myChordalError ); + myStdWidget->myAnisotropic->setChecked( data.myAnisotropic ); + if (data.myAnisotropicRatio <= 0) + myStdWidget->myAnisotropicRatio->setText(""); + else + myStdWidget->myAnisotropicRatio->SetValue( data.myAnisotropicRatio ); + myStdWidget->myRemoveTinyEdges->setChecked( data.myRemoveTinyEdges ); + if (data.myTinyEdgeLength <= 0) + myStdWidget->myTinyEdgeLength->setText(""); + else + myStdWidget->myTinyEdgeLength->SetValue( data.myTinyEdgeLength ); + myStdWidget->myForceBadElementRemoval->setChecked( data.myForceBadElementRemoval ); + if (data.myBadElementAspectRatio <= 0) + myStdWidget->myBadElementAspectRatio->setText(""); + else + myStdWidget->myBadElementAspectRatio->SetValue( data.myBadElementAspectRatio ); + myStdWidget->myOptimizeMesh->setChecked( data.myOptimizeMesh ); + myStdWidget->myQuadraticMesh->setChecked( data.myQuadraticMesh ); + + myStdWidget->resizeWidgets(); + + myAdvWidget->myVerbosity->setValue( data.myVerbosity ); + myAdvWidget->myPreCADGroupBox->setChecked(data.myTopology == PreCAD); + myAdvWidget->myPreCADMergeEdges->setChecked( data.myPreCADMergeEdges ); + myAdvWidget->myPreCADProcess3DTopology->setChecked( data.myPreCADProcess3DTopology ); + myAdvWidget->myPreCADDiscardInput->setChecked( data.myPreCADDiscardInput ); if ( myOptions.operator->() ) { // MESSAGE("retrieveParams():myOptions->length() = " << myOptions->length()); @@ -1555,18 +1338,18 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const QStringList name_value = option.split( ":", QString::KeepEmptyParts ); if ( name_value.count() > 1 ) { QString idStr = QString("%1").arg( i ); - int row = myOptionTable->rowCount(); - myOptionTable->setRowCount( row+1 ); - myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) ); - myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 ); - myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( "BLSURF" ) ); - myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 ); - myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value[0] ) ); - myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 ); - myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value[1] ) ); - myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable | - Qt::ItemIsEditable | - Qt::ItemIsEnabled ); + int row = myAdvWidget->myOptionTable->rowCount(); + myAdvWidget->myOptionTable->setRowCount( row+1 ); + myAdvWidget->myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) ); + myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 ); + myAdvWidget->myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( "BLSURF" ) ); + myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 ); + myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value[0] ) ); + myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 ); + myAdvWidget->myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value[1] ) ); + myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable | + Qt::ItemIsEditable | + Qt::ItemIsEnabled ); } } } @@ -1577,23 +1360,23 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const QStringList name_value = option.split( ":", QString::KeepEmptyParts ); if ( name_value.count() > 1 ) { QString idStr = QString("%1").arg( i ); - int row = myOptionTable->rowCount(); - myOptionTable->setRowCount( row+1 ); - myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) ); - myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 ); - myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( "PRECAD" ) ); - myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 ); - myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value[0] ) ); - myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 ); - myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value[1] ) ); - myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable | - Qt::ItemIsEditable | - Qt::ItemIsEnabled ); + int row = myAdvWidget->myOptionTable->rowCount(); + myAdvWidget->myOptionTable->setRowCount( row+1 ); + myAdvWidget->myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) ); + myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 ); + myAdvWidget->myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( "PRECAD" ) ); + myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 ); + myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value[0] ) ); + myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 ); + myAdvWidget->myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value[1] ) ); + myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable | + Qt::ItemIsEditable | + Qt::ItemIsEnabled ); } } } - myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN ); - myGMFFileName->setText(QString(data.myGMFFileName.c_str())); + myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN ); + myAdvWidget->myGMFFileName->setText(QString(data.myGMFFileName.c_str())); // myGMFFileMode->setChecked(data.myGMFFileMode); // Sizemaps @@ -1674,8 +1457,8 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const myInternalEnforcedVerticesAllFacesGroup->setEnabled(data.myInternalEnforcedVerticesAllFaces); // update widgets - that->onPhysicalMeshChanged(); - that->onGeometricMeshChanged(); + that->myStdWidget->onPhysicalMeshChanged(); + that->myStdWidget->onGeometricMeshChanged(); } /** BLSURFPluginGUI_HypothesisCreator::storeParams() @@ -1704,37 +1487,39 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData HypothesisData* data = SMESH::GetHypothesisData( hypType() ); h_data.myName = isCreation() && data ? hypName() : ""; - h_data.myTopology = (int) h->GetTopology(); - h_data.myPhysicalMesh = (int) h->GetPhysicalMesh(); - h_data.myPhySize = h->GetPhySize(); - h_data.myGeometricMesh = (int) h->GetGeometricMesh(); - h_data.myAngleMeshS = h->GetAngleMeshS(); - h_data.myAngleMeshC = h->GetAngleMeshC(); - h_data.myGradation = h->GetGradation(); - h_data.myAllowQuadrangles = h->GetQuadAllowed(); - h_data.myDecimesh = h->GetDecimesh(); - h_data.myVerbosity = h->GetVerbosity(); - h_data.myPreCADMergeEdges = h->GetPreCADMergeEdges(); - h_data.myPreCADRemoveNanoEdges = h->GetPreCADRemoveNanoEdges(); - h_data.myPreCADDiscardInput = h->GetPreCADDiscardInput(); - double EpsNano = h->GetPreCADEpsNano(); - h_data.myPreCADEpsNano = EpsNano > 0 ? EpsNano : -1.0; - -#ifdef WITH_SIZE_BOUNDARIES - double PhyMin = h->GetPhyMin(); - double PhyMax = h->GetPhyMax(); - double GeoMin = h->GetGeoMin(); - double GeoMax = h->GetGeoMax(); -// if ( PhyMin > 0 ) -// h_data.myPhyMin = PhyMin > 0 ? QString::number( h->GetPhyMin() ) : QString(""); -// h_data.myPhyMax = PhyMax > 0 ? QString::number( h->GetPhyMax() ) : QString(""); -// h_data.myGeoMin = GeoMin > 0 ? QString::number( h->GetGeoMin() ) : QString(""); -// h_data.myGeoMax = GeoMax > 0 ? QString::number( h->GetGeoMax() ) : QString(""); - h_data.myPhyMin = PhyMin > 0 ? PhyMin : -1.0; - h_data.myPhyMax = PhyMax > 0 ? PhyMax : -1.0; - h_data.myGeoMin = GeoMin > 0 ? GeoMin : -1.0; - h_data.myGeoMax = GeoMax > 0 ? GeoMax : -1.0; -#endif + h_data.myPhysicalMesh = (int) h->GetPhysicalMesh(); + h_data.myGeometricMesh = (int) h->GetGeometricMesh(); + h_data.myPhySize = h->GetPhySize(); + h_data.myPhySizeRel = h->IsPhySizeRel(); + double minSize = h->GetMinSize(); + double maxSize = h->GetMaxSize(); + h_data.myMinSize = minSize > 0 ? minSize : -1.0; + h_data.myMinSizeRel = h->IsMinSizeRel(); + h_data.myMaxSize = maxSize > 0 ? maxSize : -1.0; + h_data.myMaxSizeRel = h->IsMaxSizeRel(); + h_data.myGradation = h->GetGradation(); + h_data.myAllowQuadrangles = h->GetQuadAllowed(); + double angle = h->GetAngleMesh(); + h_data.myAngleMesh = angle > 0 ? angle : -1.0; + double chordalError = h->GetChordalError(); + h_data.myChordalError = chordalError > 0 ? chordalError : -1.0; + h_data.myAnisotropic = h->GetAnisotropic(); + double myAnisotropicRatio = h->GetAnisotropicRatio(); + h_data.myAnisotropicRatio = myAnisotropicRatio > 0 ? myAnisotropicRatio : -1.0; + h_data.myRemoveTinyEdges = h->GetRemoveTinyEdges(); + double myTinyEdgeLength = h->GetTinyEdgeLength(); + h_data.myTinyEdgeLength = myTinyEdgeLength > 0 ? myTinyEdgeLength : -1.0; + h_data.myForceBadElementRemoval = h->GetBadElementRemoval(); + double myBadElementAspectRatio = h->GetBadElementAspectRatio(); + h_data.myBadElementAspectRatio = myBadElementAspectRatio > 0 ? myBadElementAspectRatio : -1.0; + h_data.myOptimizeMesh = h->GetOptimizeMesh(); + h_data.myQuadraticMesh = h->GetQuadraticMesh(); + h_data.myVerbosity = h->GetVerbosity(); + h_data.myTopology = (int) h->GetTopology(); + h_data.myPreCADMergeEdges = h->GetPreCADMergeEdges(); + h_data.myPreCADProcess3DTopology = h->GetPreCADProcess3DTopology(); + h_data.myPreCADDiscardInput = h->GetPreCADDiscardInput(); + BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; that->myOptions = h->GetOptionValues(); @@ -1886,52 +1671,77 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi bool ok = true; try { - if( isCreation() ) + if ( isCreation() ) SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() ); - if ( h->GetTopology() != h_data.myTopology ) // avoid duplication of DumpPython commands - h->SetTopology( (int) h_data.myTopology ); - if ( h->GetPhysicalMesh() != h_data.myPhysicalMesh ) + if ( h->GetPhysicalMesh() != h_data.myPhysicalMesh ) // avoid duplication of DumpPython commands h->SetPhysicalMesh( (int) h_data.myPhysicalMesh ); if ( h->GetGeometricMesh() != (int) h_data.myGeometricMesh ) h->SetGeometricMesh( (int) h_data.myGeometricMesh ); + + if ( ((int) h_data.myPhysicalMesh == PhysicalGlobalSize)||((int) h_data.myPhysicalMesh == PhysicalLocalSize) ) { + if ( h->GetPhySize() != h_data.myPhySize ) { + if ( h_data.myPhySizeRel ) + h->SetPhySizeRel( h_data.myPhySize ); + else + h->SetPhySize( h_data.myPhySize ); + } + } + if (h->GetMinSize() != h_data.myMinSize) { + if ( h_data.myMinSizeRel ) + h->SetMinSizeRel( h_data.myMinSize <= 0 ? -1 : h_data.myMinSize ); + else + h->SetMinSize( h_data.myMinSize <= 0 ? -1 : h_data.myMinSize ); + } + if (h->GetMaxSize() != h_data.myMaxSize) { + if ( h_data.myMaxSizeRel ) + h->SetMaxSizeRel( h_data.myMaxSize <= 0 ? -1 : h_data.myMaxSize ); + else + h->SetMaxSize( h_data.myMaxSize <= 0 ? -1 : h_data.myMaxSize ); + } if ( h->GetGradation() != h_data.myGradation ) - h->SetGradation( h_data.myGradation ); + h->SetGradation( h_data.myGradation <= 0 ? -1 : h_data.myGradation ); if ( h->GetQuadAllowed() != h_data.myAllowQuadrangles ) h->SetQuadAllowed( h_data.myAllowQuadrangles ); - if ( h->GetDecimesh() != h_data.myDecimesh ) - h->SetDecimesh( h_data.myDecimesh ); + + if ( (int) h_data.myGeometricMesh != DefaultGeom ) { + if ( h->GetAngleMesh() != h_data.myAngleMesh ) + h->SetAngleMesh( h_data.myAngleMesh <= 0 ? -1 :h_data.myAngleMesh ); + if ( h->GetChordalError() != h_data.myChordalError ) + h->SetChordalError( h_data.myChordalError <= 0 ? -1 :h_data.myChordalError ); + } + + if ( h->GetAnisotropic() != h_data.myAnisotropic ) + h->SetAnisotropic( h_data.myAnisotropic ); + if ( h_data.myAnisotropic && ( h->GetAnisotropicRatio() != h_data.myAnisotropicRatio ) ) + h->SetAnisotropicRatio( h_data.myAnisotropicRatio <= 0 ? -1 :h_data.myAnisotropicRatio ); + + if ( h->GetRemoveTinyEdges() != h_data.myRemoveTinyEdges ) + h->SetRemoveTinyEdges( h_data.myRemoveTinyEdges ); + if ( h_data.myRemoveTinyEdges && ( h->GetTinyEdgeLength() != h_data.myTinyEdgeLength ) ) + h->SetTinyEdgeLength( h_data.myTinyEdgeLength <= 0 ? -1 :h_data.myTinyEdgeLength ); + + if ( h->GetBadElementRemoval() != h_data.myForceBadElementRemoval ) + h->SetBadElementRemoval( h_data.myForceBadElementRemoval ); + if ( h_data.myForceBadElementRemoval && ( h->GetBadElementAspectRatio() != h_data.myBadElementAspectRatio ) ) + h->SetBadElementAspectRatio( h_data.myBadElementAspectRatio <= 0 ? -1 :h_data.myBadElementAspectRatio ); + + if ( h->GetOptimizeMesh() != h_data.myOptimizeMesh ) + h->SetOptimizeMesh( h_data.myOptimizeMesh ); + + if ( h->GetQuadraticMesh() != h_data.myQuadraticMesh ) + h->SetQuadraticMesh( h_data.myQuadraticMesh ); + if ( h->GetVerbosity() != h_data.myVerbosity ) h->SetVerbosity( h_data.myVerbosity ); + if ( h->GetTopology() != h_data.myTopology ) + h->SetTopology( (int) h_data.myTopology ); if ( h->GetPreCADMergeEdges() != h_data.myPreCADMergeEdges ) h->SetPreCADMergeEdges( h_data.myPreCADMergeEdges ); - if ( h->GetPreCADRemoveNanoEdges() != h_data.myPreCADRemoveNanoEdges ) - h->SetPreCADRemoveNanoEdges( h_data.myPreCADRemoveNanoEdges ); + if ( h->GetPreCADProcess3DTopology() != h_data.myPreCADProcess3DTopology ) + h->SetPreCADProcess3DTopology( h_data.myPreCADProcess3DTopology ); if ( h->GetPreCADDiscardInput() != h_data.myPreCADDiscardInput ) h->SetPreCADDiscardInput( h_data.myPreCADDiscardInput ); - if ( h->GetPreCADEpsNano() != h_data.myPreCADEpsNano && h_data.myPreCADEpsNano > 0) - h->SetPreCADEpsNano( h_data.myPreCADEpsNano ); - - if( ((int) h_data.myPhysicalMesh == PhysicalUserDefined)||((int) h_data.myPhysicalMesh == SizeMap) ) { - if ( h->GetPhySize() != h_data.myPhySize ) - h->SetPhySize( h_data.myPhySize ); - } - if( (int) h_data.myGeometricMesh == UserDefined ) { - if ( h->GetAngleMeshS() != h_data.myAngleMeshS ) - h->SetAngleMeshS( h_data.myAngleMeshS ); - if ( h->GetAngleMeshC() != h_data.myAngleMeshC ) - h->SetAngleMeshC( h_data.myAngleMeshC ); - } -#ifdef WITH_SIZE_BOUNDARIES - if (h->GetPhyMin() != h_data.myPhyMin && h_data.myPhyMin > 0) - h->SetPhyMin( h_data.myPhyMin ); - if (h->GetPhyMax() != h_data.myPhyMax && h_data.myPhyMax > 0) - h->SetPhyMax( h_data.myPhyMax ); - if (h->GetGeoMin() != h_data.myGeoMin && h_data.myGeoMin > 0) - h->SetGeoMin( h_data.myGeoMin ); - if (h->GetGeoMax() != h_data.myGeoMax && h_data.myGeoMax > 0) - h->SetGeoMax( h_data.myGeoMax ); -#endif h->SetOptionValues( myOptions ); // is set in checkParams() h->SetPreCADOptionValues( myPreCADOptions ); // is set in checkParams() @@ -2046,57 +1856,72 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes { MESSAGE("BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets"); h_data.myName = myName ? myName->text() : ""; - h_data.myTopology = myTopology->currentIndex(); - h_data.myPhysicalMesh = myPhysicalMesh->currentIndex(); - h_data.myPhySize = myPhySize->GetValue(); -#ifdef WITH_SIZE_BOUNDARIES - h_data.myPhyMin = myPhyMin->GetValue(); - h_data.myPhyMax = myPhyMax->GetValue(); - h_data.myGeoMin = myGeoMin->GetValue(); - h_data.myGeoMax = myGeoMax->GetValue(); -#endif - h_data.myGeometricMesh = myGeometricMesh->currentIndex(); - h_data.myAngleMeshS = myAngleMeshS->GetValue(); - h_data.myAngleMeshC = myAngleMeshC->GetValue(); - h_data.myGradation = myGradation->GetValue(); - h_data.myAllowQuadrangles = myAllowQuadrangles->isChecked(); - h_data.myDecimesh = myDecimesh->isChecked(); - h_data.myVerbosity = myVerbosity->value(); - h_data.myPreCADMergeEdges = myPreCADMergeEdges->isChecked(); - h_data.myPreCADRemoveNanoEdges = myPreCADRemoveNanoEdges->isChecked(); - h_data.myPreCADDiscardInput = myPreCADDiscardInput->isChecked(); - h_data.myPreCADEpsNano = myPreCADEpsNano->GetValue(); + h_data.myPhysicalMesh = myStdWidget->myPhysicalMesh->currentIndex(); + h_data.myGeometricMesh = myStdWidget->myGeometricMesh->currentIndex(); + h_data.myPhySize = myStdWidget->myPhySize->text().isEmpty() ? -1.0 : myStdWidget->myPhySize->GetValue(); + h_data.myPhySizeRel = myStdWidget->myPhySizeRel->isChecked(); + h_data.myMinSize = myStdWidget->myMinSize->text().isEmpty() ? -1.0 : myStdWidget->myMinSize->GetValue(); + h_data.myMinSizeRel = myStdWidget->myMinSizeRel->isChecked(); + h_data.myMaxSize = myStdWidget->myMaxSize->text().isEmpty() ? -1.0 : myStdWidget->myMaxSize->GetValue(); + h_data.myMaxSizeRel = myStdWidget->myMaxSizeRel->isChecked(); + h_data.myGradation = myStdWidget->myGradation->text().isEmpty() ? -1.0 : myStdWidget->myGradation->GetValue(); + h_data.myAllowQuadrangles = myStdWidget->myAllowQuadrangles->isChecked(); + h_data.myAngleMesh = myStdWidget->myAngleMesh->text().isEmpty() ? -1.0 : myStdWidget->myAngleMesh->GetValue(); + h_data.myChordalError = myStdWidget->myChordalError->text().isEmpty() ? -1.0 : myStdWidget->myChordalError->GetValue(); + h_data.myAnisotropic = myStdWidget->myAnisotropic->isChecked(); + h_data.myAnisotropicRatio = myStdWidget->myAnisotropicRatio->text().isEmpty() ? -1.0 : myStdWidget->myAnisotropicRatio->GetValue(); + h_data.myRemoveTinyEdges = myStdWidget->myRemoveTinyEdges->isChecked(); + h_data.myTinyEdgeLength = myStdWidget->myTinyEdgeLength->text().isEmpty() ? -1.0 : myStdWidget->myTinyEdgeLength->GetValue(); + h_data.myForceBadElementRemoval= myStdWidget->myForceBadElementRemoval->isChecked(); + h_data.myBadElementAspectRatio = myStdWidget->myBadElementAspectRatio->text().isEmpty() ? -1.0 : myStdWidget->myBadElementAspectRatio->GetValue(); + h_data.myOptimizeMesh = myStdWidget->myOptimizeMesh->isChecked(); + h_data.myQuadraticMesh = myStdWidget->myQuadraticMesh->isChecked(); + h_data.myVerbosity = myAdvWidget->myVerbosity->value(); + h_data.myTopology = myAdvWidget->myPreCADGroupBox->isChecked() ? PreCAD : FromCAD; + h_data.myPreCADMergeEdges = myAdvWidget->myPreCADMergeEdges->isChecked(); + h_data.myPreCADProcess3DTopology = myAdvWidget->myPreCADProcess3DTopology->isChecked(); + h_data.myPreCADDiscardInput = myAdvWidget->myPreCADDiscardInput->isChecked(); QString guiHyp; - guiHyp += tr("BLSURF_TOPOLOGY") + " = " + QString::number( h_data.myTopology ) + "; "; guiHyp += tr("BLSURF_PHY_MESH") + " = " + QString::number( h_data.myPhysicalMesh ) + "; "; - guiHyp += tr("BLSURF_HPHYDEF") + " = " + QString::number( h_data.myPhySize ) + "; "; guiHyp += tr("BLSURF_GEOM_MESH") + " = " + QString::number( h_data.myGeometricMesh ) + "; "; - guiHyp += tr("BLSURF_ANGLE_MESH_S") + " = " + QString::number( h_data.myAngleMeshS ) + "; "; + guiHyp += tr("BLSURF_HPHYDEF") + " = " + QString::number( h_data.myPhySize ) + "; "; + guiHyp += tr("BLSURF_HPHYDEF") + " " + tr("BLSURF_SIZE_REL") +" = " + QString(h_data.myPhySizeRel ? "yes" : "no") + "; "; + guiHyp += tr("BLSURF_MINSIZE") + " = "+ QString::number( h_data.myMinSize ) + "; "; + guiHyp += tr("BLSURF_MINSIZE") + " " + tr("BLSURF_SIZE_REL") + " = " + QString(h_data.myMinSizeRel ? "yes" : "no") + "; "; + guiHyp += tr("BLSURF_MAXSIZE") + " = "+ QString::number( h_data.myMaxSize ) + "; "; + guiHyp += tr("BLSURF_MAXSIZE") + " " + tr("BLSURF_SIZE_REL") + " = " + QString(h_data.myMaxSizeRel ? "yes" : "no") + "; "; guiHyp += tr("BLSURF_GRADATION") + " = " + QString::number( h_data.myGradation ) + "; "; guiHyp += tr("BLSURF_ALLOW_QUADRANGLES") + " = " + QString(h_data.myAllowQuadrangles ? "yes" : "no") + "; "; - guiHyp += tr("BLSURF_DECIMESH") + " = " + QString(h_data.myDecimesh ? "yes" : "no") + "; "; -#ifdef WITH_SIZE_BOUNDARIES - guiHyp += "hphymin = " + QString::number( h_data.myPhyMin ) + "; "; - guiHyp += "hphymax = " + QString::number( h_data.myPhyMax ) + "; "; - guiHyp += "hgeomin = " + QString::number( h_data.myGeoMin ) + "; "; - guiHyp += "hgeomax = " + QString::number( h_data.myGeoMax ) + "; "; -#endif + guiHyp += tr("BLSURF_ANGLE_MESH") + " = " + QString::number( h_data.myAngleMesh ) + "; "; + guiHyp += tr("BLSURF_CHORDAL_ERROR") + " = " + QString::number( h_data.myChordalError ) + "; "; + guiHyp += tr("BLSURF_ANISOTROPIC") + " = " + QString(h_data.myAnisotropic ? "yes" : "no") + "; "; + guiHyp += tr("BLSURF_ANISOTROPIC_RATIO") + " = " + QString::number( h_data.myAnisotropicRatio ) + "; "; + + + guiHyp += tr("BLSURF_REMOVE_TINY_EDGES") + " = " + QString(h_data.myRemoveTinyEdges ? "yes" : "no") + "; "; + guiHyp += tr("BLSURF_TINY_EDGES_LENGTH") + " = " + QString::number( h_data.myTinyEdgeLength ) + "; "; + guiHyp += tr("BLSURF_REMOVE_SLIVERS") + " = " + QString(h_data.myForceBadElementRemoval ? "yes" : "no") + "; "; + guiHyp += tr("BLSURF_BAD_SURFACE_ELEMENT_ASPECT_RATIO") + " = " + QString::number( h_data.myBadElementAspectRatio ) + "; "; + guiHyp += tr("BLSURF_OPTIMISATION") + " = " + QString(h_data.myOptimizeMesh ? "yes" : "no") + "; "; + guiHyp += tr("BLSURF_ELEMENT_ORDER") + " = " + QString(h_data.myQuadraticMesh ? "yes" : "no") + "; "; + + + guiHyp += tr("BLSURF_TOPOLOGY") + " = " + QString::number( h_data.myTopology ) + "; "; guiHyp += tr("BLSURF_PRECAD_MERGE_EDGES") + " = " + QString(h_data.myPreCADMergeEdges ? "yes" : "no") + "; "; - guiHyp += tr("BLSURF_PRECAD_REMOVE_NANO_EDGES") + " = " + QString(h_data.myPreCADRemoveNanoEdges ? "yes" : "no") + "; "; + guiHyp += tr("BLSURF_PRECAD_REMOVE_NANO_EDGES") + " = " + QString(h_data.myPreCADProcess3DTopology ? "yes" : "no") + "; "; guiHyp += tr("BLSURF_PRECAD_DISCARD_INPUT") + " = " + QString(h_data.myPreCADDiscardInput ? "yes" : "no") + "; "; - guiHyp += tr("BLSURF_PRECAD_EPS_NANO") + " = " + QString::number( h_data.myPreCADEpsNano ) + "; "; BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; - int row = 0, nbRows = myOptionTable->rowCount(); + int row = 0, nbRows = myAdvWidget->myOptionTable->rowCount(); for ( ; row < nbRows; ++row ) { - int id = myOptionTable->item( row, OPTION_ID_COLUMN )->text().toInt(); - std::string optionType = myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().toStdString(); + int id = myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->text().toInt(); + std::string optionType = myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().toStdString(); if ( id >= 0 && ( ( optionType == "BLSURF" && id < myOptions->length() ) || ( optionType == "PRECAD" && id < myPreCADOptions->length() ) ) ) { - QString name = myOptionTable->item( row, OPTION_NAME_COLUMN )->text(); - QString value = myOptionTable->item( row, OPTION_VALUE_COLUMN )->text().trimmed(); + QString name = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text(); + QString value = myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->text().trimmed(); if ( value.isNull() ) value = ""; if (optionType == "PRECAD") @@ -2112,7 +1937,7 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes } } - h_data.myGMFFileName = myGMFFileName->text().toStdString(); + h_data.myGMFFileName = myAdvWidget->myGMFFileName->text().toStdString(); // h_data.myGMFFileMode = myGMFFileMode->isChecked(); // SizeMap @@ -2186,58 +2011,6 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes return guiHyp; } - -void BLSURFPluginGUI_HypothesisCreator::onTopologyChanged(int index) { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::onTopologyChanged"); - myPreCADGroupBox->setEnabled(index == PreCAD); -} - -void BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged() { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged"); - bool isPhysicalUserDefined = (myPhysicalMesh->currentIndex() == PhysicalUserDefined); - bool isSizeMap = (myPhysicalMesh->currentIndex() == SizeMap); - bool isCustom = (isPhysicalUserDefined || isSizeMap) ; - bool geomIsCustom = (myGeometricMesh->currentIndex() == UserDefined); - - myGradation->setEnabled(!isPhysicalUserDefined || geomIsCustom); - myPhySize->setEnabled(isCustom); - myPhyMax->setEnabled(isCustom); - myPhyMin->setEnabled(isCustom); - - if ( !myGradation->isEnabled()) - myGradation->SetValue( 1.1 ); - - if ( !isCustom ) { - if ( myGeometricMesh->currentIndex() == DefaultGeom ) { - myGeometricMesh->setCurrentIndex( UserDefined ); - onGeometricMeshChanged(); - } - } -} - -void BLSURFPluginGUI_HypothesisCreator::onGeometricMeshChanged() { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::onGeometricMeshChanged"); - bool isCustom = (myGeometricMesh->currentIndex() == UserDefined); - bool phyIsSizemap = (myPhysicalMesh->currentIndex() == SizeMap); - - myAngleMeshS->setEnabled(isCustom); - myAngleMeshC->setEnabled(isCustom); - myGradation->setEnabled(isCustom || phyIsSizemap); - myGeoMax->setEnabled(isCustom); - myGeoMin->setEnabled(isCustom); - - if ( !myGradation->isEnabled()) - myGradation->SetValue( 1.1 ); - - if ( ! isCustom ) { - // hphy_flag = 0 and hgeo_flag = 0 is not allowed (spec) - if ( myPhysicalMesh->currentIndex() == DefaultSize ) { - myPhysicalMesh->setCurrentIndex( PhysicalUserDefined ); - onPhysicalMeshChanged(); - } - } -} - void BLSURFPluginGUI_HypothesisCreator::onAddOption() { QMenu* menu = (QMenu*)sender(); @@ -2264,7 +2037,7 @@ void BLSURFPluginGUI_HypothesisCreator::onAddOption() void BLSURFPluginGUI_HypothesisCreator::onOptionChosenInPopup( QAction* a ) { - myOptionTable->setFocus(); + myAdvWidget->myOptionTable->setFocus(); QMenu* menu = (QMenu*)( a->parent() ); int idx = menu->actions().indexOf( a ); @@ -2281,69 +2054,59 @@ void BLSURFPluginGUI_HypothesisCreator::onOptionChosenInPopup( QAction* a ) QString optionName = option.split( ":", QString::KeepEmptyParts )[0]; // look for a row with optionName - int row = 0, nbRows = myOptionTable->rowCount(); + int row = 0, nbRows = myAdvWidget->myOptionTable->rowCount(); for ( ; row < nbRows; ++row ) - if ( myOptionTable->item( row, OPTION_ID_COLUMN )->text() == idStr ) - if ( myOptionTable->item( row, OPTION_TYPE_COLUMN )->text() == optionType ) + if ( myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->text() == idStr ) + if ( myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text() == optionType ) break; // add a row if not found if ( row == nbRows ) { - myOptionTable->setRowCount( row+1 ); - myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) ); - myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 ); - myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( optionType ) ); - myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 ); - myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( optionName ) ); - myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 ); - myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( "" ) ); - myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable | - Qt::ItemIsEditable | - Qt::ItemIsEnabled ); - myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN ); - } - myOptionTable->clearSelection(); - myOptionTable->scrollToItem( myOptionTable->item( row, OPTION_VALUE_COLUMN ) ); - //myOptionTable->item( row, OPTION_VALUE_COLUMN )->setSelected( true ); - myOptionTable->setCurrentCell( row, OPTION_VALUE_COLUMN ); - //myOptionTable->openPersistentEditor( myOptionTable->item( row, OPTION_VALUE_COLUMN ) ); + myAdvWidget->myOptionTable->setRowCount( row+1 ); + myAdvWidget->myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) ); + myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 ); + myAdvWidget->myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( optionType ) ); + myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 ); + myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( optionName ) ); + myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 ); + myAdvWidget->myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( "" ) ); + myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable | + Qt::ItemIsEditable | + Qt::ItemIsEnabled ); + myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN ); + } + myAdvWidget->myOptionTable->clearSelection(); + myAdvWidget->myOptionTable->scrollToItem( myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN ) ); + //myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->setSelected( true ); + myAdvWidget->myOptionTable->setCurrentCell( row, OPTION_VALUE_COLUMN ); + //myAdvWidget->myOptionTable->openPersistentEditor( myOptionTable->item( row, OPTION_VALUE_COLUMN ) ); } void BLSURFPluginGUI_HypothesisCreator::onDeleteOption() { // clear option values and remember selected row QList selectedRows; - QList selected = myOptionTable->selectedItems(); + QList selected = myAdvWidget->myOptionTable->selectedItems(); QTableWidgetItem* item; foreach( item, selected ) { int row = item->row(); if ( !selectedRows.contains( row ) ) { selectedRows.append( row ); - int id = myOptionTable->item( row, OPTION_ID_COLUMN )->text().toInt(); - std::string optionType = myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().toStdString(); + int id = myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->text().toInt(); + QString optionType = myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text(); if ( id >= 0 ) if (optionType == "BLSURF" && id < myOptions->length() ) - myOptions[ id ] = myOptionTable->item( row, OPTION_NAME_COLUMN )->text().toLatin1().constData(); + myOptions[ id ] = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text().toLatin1().constData(); else if (optionType == "PRECAD" && id < myPreCADOptions->length() ) - myPreCADOptions[ id ] = myOptionTable->item( row, OPTION_NAME_COLUMN )->text().toLatin1().constData(); + myPreCADOptions[ id ] = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text().toLatin1().constData(); } } qSort( selectedRows ); QListIterator it( selectedRows ); it.toBack(); while ( it.hasPrevious() ) - myOptionTable->removeRow( it.previous() ); + myAdvWidget->myOptionTable->removeRow( it.previous() ); } -void BLSURFPluginGUI_HypothesisCreator::onChooseGMFFile() -{ -// QFileDialog dlg(0); -// dlg.selectFile(myGMFFileName->text()); -// dlg.setNameFilter(tr("BLSURF_GMF_FILE_FORMAT")); -// dlg.setDefaultSuffix(QString("mesh")); - myGMFFileName->setText(QFileDialog::getSaveFileName(0, tr("BLSURF_GMF_FILE_DIALOG"), myGMFFileName->text(), tr("BLSURF_GMF_FILE_FORMAT"))); -} - - // ********************** // *** BEGIN SIZE MAP *** // ********************** @@ -2677,9 +2440,9 @@ void BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anOb mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN ); mySizeMapTable->clearSelection(); - if ( myPhysicalMesh->currentIndex() != SizeMap ) { - myPhysicalMesh->setCurrentIndex( SizeMap ); - onPhysicalMeshChanged(); + if ( myStdWidget->myPhysicalMesh->currentIndex() != PhysicalLocalSize ) { + myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize ); + myStdWidget->onPhysicalMeshChanged(); } } @@ -2765,9 +2528,9 @@ void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN ); mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN ); - if ( myPhysicalMesh->currentIndex() != SizeMap ) { - myPhysicalMesh->setCurrentIndex( SizeMap ); - onPhysicalMeshChanged(); + if ( myStdWidget->myPhysicalMesh->currentIndex() != PhysicalLocalSize ) { + myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize ); + myStdWidget->onPhysicalMeshChanged(); } MESSAGE("mySMPMap.size() = "< +#include + +using namespace std; + +////////////////////////////////////////// +// BLSURFPluginGUI_StdWidget +////////////////////////////////////////// + +BLSURFPluginGUI_StdWidget::BLSURFPluginGUI_StdWidget( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); + myPhySize->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision"); + myMinSize->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision"); + myMaxSize->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision"); + myGradation->RangeStepAndValidator(1.1, COORD_MAX, 0.1, "length_precision"); + myAngleMesh->RangeStepAndValidator(0, 90, 0.5, "angular_precision"); + myChordalError->RangeStepAndValidator(0, COORD_MAX, 0.1, "length_precision"); + myAnisotropicRatio->RangeStepAndValidator(0, COORD_MAX, 0.1, "length_precision"); + myTinyEdgeLength->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, "length_precision"); + myBadElementAspectRatio->RangeStepAndValidator(0, COORD_MAX, 1000, "length_precision"); + myMinSize->setText(""); + myMaxSize->setText(""); + myAngleMesh->setText(""); + myChordalError->setText(""); + myAnisotropicRatio->setText(""); + myTinyEdgeLength->setText(""); + myBadElementAspectRatio->setText(""); +} + +BLSURFPluginGUI_StdWidget::~BLSURFPluginGUI_StdWidget() +{ +} + +void BLSURFPluginGUI_StdWidget::onPhysicalMeshChanged() { + bool isPhysicalGlobalSize = (myPhysicalMesh->currentIndex() == PhysicalGlobalSize); + bool isPhysicalLocalSize = (myPhysicalMesh->currentIndex() == PhysicalLocalSize); + bool isCustom = (isPhysicalGlobalSize || isPhysicalLocalSize) ; + bool geomIsCustom = (myGeometricMesh->currentIndex() != DefaultGeom); + + myGradation->setEnabled(!isPhysicalGlobalSize || geomIsCustom); + myPhySize->setEnabled(isCustom); + myPhySizeRel->setEnabled(isCustom); + + if ( !isCustom ) { + if ( myGeometricMesh->currentIndex() == DefaultGeom ) { + myGeometricMesh->setCurrentIndex( GeometricalGlobalSize ); + onGeometricMeshChanged(); + } + } +} + +void BLSURFPluginGUI_StdWidget::onGeometricMeshChanged() { + bool isCustom = (myGeometricMesh->currentIndex() != DefaultGeom); + bool isPhysicalLocalSize = (myPhysicalMesh->currentIndex() == PhysicalLocalSize); + + GeomParamsGroupBox->setEnabled(isCustom); + myGradation->setEnabled(isCustom || isPhysicalLocalSize); + + if ( ! isCustom ) { + // hphy_flag = 0 and hgeo_flag = 0 is not allowed (spec) + if ( myPhysicalMesh->currentIndex() == DefaultSize ) { + myPhysicalMesh->setCurrentIndex( PhysicalGlobalSize ); + onPhysicalMeshChanged(); + } + } +} + +void BLSURFPluginGUI_StdWidget::resizeWidgets() { + // Set minimum width of spin boxes + // Main parameters + QFontMetrics metrics1( myPhySize->font() ); + QFontMetrics metrics2( myMinSize->font() ); + QFontMetrics metrics3( myMaxSize->font() ); + int width1 = metrics1.width(myPhySize->GetString()); + int width2 = metrics2.width(myMinSize->GetString()); + int width3 = metrics3.width(myMaxSize->GetString()); + int max_width = max(width1,width2); + max_width = max(max_width, width3); + myPhySize->setMinimumWidth( max_width+50 ); + myMinSize->setMinimumWidth( max_width+50 ); + myMaxSize->setMinimumWidth( max_width+50 ); + // Geometrical parameters + metrics1 = myAngleMesh->font(); + metrics2 = myChordalError->font(); + width1 = metrics1.width(myAngleMesh->GetString()); + width2 = metrics2.width(myChordalError->GetString()); + max_width = max(width1,width2); + myAngleMesh->setMinimumWidth( max_width+50 ); + myChordalError->setMinimumWidth( max_width+50 ); + // Other parameters + metrics1 = myAnisotropicRatio->font(); + metrics2 = myTinyEdgeLength->font(); + metrics3 = myBadElementAspectRatio->font(); + width1 = metrics1.width(myAnisotropicRatio->GetString()); + width2 = metrics2.width(myTinyEdgeLength->GetString()); + width3 = metrics3.width(myBadElementAspectRatio->GetString()); + max_width = max(width1,width2); + max_width = max(max_width, width3); + myAnisotropicRatio->setMinimumWidth( max_width+50 ); + myTinyEdgeLength->setMinimumWidth( max_width+50 ); + myBadElementAspectRatio->setMinimumWidth( max_width+50 ); +} + +void BLSURFPluginGUI_StdWidget::onEditingFinished() { + SMESHGUI_SpinBox* spinBox = (SMESHGUI_SpinBox*)sender(); + bool isEmpty = spinBox->editor()->text().isEmpty(); + if ( isEmpty ) { + spinBox->SetValue(-1); + spinBox->setText(""); + } +} + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/GUI/BLSURFPluginGUI_StdWidget_QTD.ui b/src/GUI/BLSURFPluginGUI_StdWidget_QTD.ui new file mode 100644 index 0000000..9167973 --- /dev/null +++ b/src/GUI/BLSURFPluginGUI_StdWidget_QTD.ui @@ -0,0 +1,548 @@ + + + Gilles DAVID (OCC) + BLSURFPluginGUI_StdWidget_QTD + + + + 0 + 0 + 588 + 244 + + + + + 0 + + + + + BLSURF_MESH_TYPE + + + + + + BLSURF_PHY_MESH + + + + + + + BLSURF_PHY_MESH_TOOLTIP + + + 1 + + + + BLSURF_DEFAULT_USER + + + + + GLOBAL_SIZE + + + + + LOCAL_SIZE + + + + + + + + BLSURF_GEOM_MESH + + + + + + + BLSURF_GEOM_MESH_TOOLTIP + + + + BLSURF_DEFAULT_USER + + + + + GLOBAL_SIZE + + + + + + + + + + + false + + + BLSURF_GEOMETRICAL_PARAMETERS + + + + + + + + + + + + BLSURF_ANGLE_MESH_TOOLTIP + + + BLSURF_ANGLE_MESH + + + + + + + BLSURF_CHORDAL_TOOLTIP + + + BLSURF_CHORDAL_ERROR + + + + + + + + + + BLSURF_MAIN_PARAMETERS + + + + + + BLSURF_HPHYDEF_TOOLTIP + + + BLSURF_HPHYDEF + + + + + + + + + + BLSURF_SIZE_REL_TOOLTIP + + + BLSURF_SIZE_REL + + + + + + + + + + BLSURF_SIZE_REL_TOOLTIP + + + BLSURF_SIZE_REL + + + + + + + 10.000000000000000 + + + + + + + BLSURF_SIZE_REL_TOOLTIP + + + BLSURF_SIZE_REL + + + + + + + BLSURF_GRADATION_TOOLTIP + + + BLSURF_GRADATION + + + + + + + false + + + + + + + BLSURF_MINSIZE + + + + + + + BLSURF_MAXSIZE + + + + + + + BLSURF_ELEMENT_ORDER + + + + + + + + + + BLSURF_OTHER_PARAMETERS + + + + + + BLSURF_ANISOTROPIC_TOOLTIP + + + BLSURF_ANISOTROPIC + + + + + + + false + + + + + + + BLSURF_REMOVE_TINY_EDGES_TOOLTIP + + + BLSURF_REMOVE_TINY_EDGES + + + + + + + false + + + + + + + BLSURF_REMOVE_SLIVERS_TOOLTIP + + + BLSURF_REMOVE_SLIVERS + + + + + + + false + + + + + + + BLSURF_OPTIMISATION_TOOLTIP + + + BLSURF_OPTIMISATION + + + true + + + + + + + BLSURF_ALLOW_QUADRANGLES + + + + + + + + + + + SMESHGUI_SpinBox + QDoubleSpinBox +
SMESHGUI_SpinBox.h
+
+
+ + myPhysicalMesh + myGeometricMesh + myPhySize + myPhySizeRel + myMinSize + myMinSizeRel + myMaxSize + myMaxSizeRel + myGradation + myQuadraticMesh + myAngleMesh + myChordalError + myAnisotropic + myAnisotropicRatio + myRemoveTinyEdges + myTinyEdgeLength + myForceBadElementRemoval + myBadElementAspectRatio + myOptimizeMesh + myAllowQuadrangles + + + + + myGeometricMesh + activated(int) + BLSURFPluginGUI_StdWidget_QTD + onGeometricMeshChanged() + + + 188 + 60 + + + 281 + 243 + + + + + myPhysicalMesh + activated(int) + BLSURFPluginGUI_StdWidget_QTD + onPhysicalMeshChanged() + + + 188 + 37 + + + 218 + 243 + + + + + myAnisotropic + toggled(bool) + myAnisotropicRatio + setEnabled(bool) + + + 384 + 122 + + + 541 + 127 + + + + + myRemoveTinyEdges + toggled(bool) + myTinyEdgeLength + setEnabled(bool) + + + 414 + 151 + + + 547 + 152 + + + + + myForceBadElementRemoval + toggled(bool) + myBadElementAspectRatio + setEnabled(bool) + + + 448 + 181 + + + 542 + 180 + + + + + myAnisotropic + toggled(bool) + myChordalError + setDisabled(bool) + + + 441 + 119 + + + 525 + 60 + + + + + myAnisotropic + toggled(bool) + label_8 + setDisabled(bool) + + + 425 + 121 + + + 438 + 64 + + + + + myPhySize + editingFinished() + BLSURFPluginGUI_StdWidget_QTD + onEditingFinished() + + + 159 + 119 + + + 220 + 90 + + + + + myMinSize + editingFinished() + BLSURFPluginGUI_StdWidget_QTD + onEditingFinished() + + + 144 + 150 + + + 205 + 83 + + + + + myMaxSize + editingFinished() + BLSURFPluginGUI_StdWidget_QTD + onEditingFinished() + + + 128 + 176 + + + 135 + 83 + + + + + myGradation + editingFinished() + BLSURFPluginGUI_StdWidget_QTD + onEditingFinished() + + + 170 + 201 + + + 315 + 121 + + + + + myAngleMesh + editingFinished() + BLSURFPluginGUI_StdWidget_QTD + onEditingFinished() + + + 548 + 34 + + + 566 + 86 + + + + + myChordalError + editingFinished() + BLSURFPluginGUI_StdWidget_QTD + onEditingFinished() + + + 542 + 56 + + + 537 + 86 + + + + + + onGeometricMeshChanged() + onPhysicalMeshChanged() + onEditingFinished() + +
diff --git a/src/GUI/BLSURFPlugin_msg_en.ts b/src/GUI/BLSURFPlugin_msg_en.ts index e533c0a..767eb12 100644 --- a/src/GUI/BLSURFPlugin_msg_en.ts +++ b/src/GUI/BLSURFPlugin_msg_en.ts @@ -4,76 +4,159 @@ @default - ADD_OPTION - Add option + BLSURF_MESH_TYPE + Type of mesh - BLSURF_ALLOW_QUADRANGLES - Allow Quadrangles (Test) + BLSURF_PHY_MESH + Physical Mesh - BLSURF_ANGLE_MESH_C - Angle Mesh C + BLSURF_PHY_MESH_TOOLTIP + <b><u>Physical size mode</u></b><br><br> +- "Global size": the physical size is global and the mesher will use the global physical size provided.<br> +- "Local size": the size is locally computed, on curves and surfaces, using the associated physical sizemap functions.<br> +- "None": no physical size will be computed. - BLSURF_ANGLE_MESH_S - Angle Mesh S + BLSURF_GEOM_MESH + Geometrical Mesh - BLSURF_CUSTOM_GEOM - Custom + BLSURF_GEOM_MESH_TOOLTIP + <b><u>Geometric size mode</u></b><br><br> +- "Global size": the geometrical size is global and the mesher will use the geometrical approximation provided by the geometrical parameters..<br> +- "None": no geometrical sizes will be computed. - BLSURF_CUSTOM_USER - Custom + BLSURF_DEFAULT_USER + None - BLSURF_DECIMESH - Patch independent + GLOBAL_SIZE + Global size - BLSURF_DEFAULT_GEOM - None + LOCAL_SIZE + Local size - BLSURF_DEFAULT_USER - None + BLSURF_MAIN_PARAMETERS + Main parameters - BLSURF_GEOM_MESH - Geometrical Mesh + BLSURF_HPHYDEF + User Size + + + BLSURF_HPHYDEF_TOOLTIP + Defines the constant global size.<br> +The default computed value is <em>diag</em>/<em>ratio</em>, where <em>ratio</em> is defined in the preferences. + + + BLSURF_MINSIZE + Min Size + + + BLSURF_MINSIZE_TOOLTIP + Defines the global minimum cell size desired.<br> +The default computed value is <em>diag</em>/1000. + + + BLSURF_MAXSIZE + Max Size + + + BLSURF_MAXSIZE_TOOLTIP + Defines the global maximum cell size desired.<br> +The default computed value is <em>diag</em>/5. + + + BLSURF_SIZE_REL + Relative value + + + BLSURF_SIZE_REL_TOOLTIP + The value is relative to <em>diag</em> BLSURF_GRADATION Gradation - BLSURF_HGEOMAX - Max Geometrical Size + BLSURF_GRADATION_TOOLTIP + Maximum ratio between the lengths of two adjacent edges. - BLSURF_HGEOMIN - Min Geometrical Size + BLSURF_ALLOW_QUADRANGLES + Allow Quadrangles - BLSURF_HPHYDEF - User Size + BLSURF_GEOMETRICAL_PARAMETERS + Geometrical parameters - BLSURF_HPHYMAX - Max Physical Size + BLSURF_ANGLE_MESH + Mesh angle - BLSURF_HPHYMIN - Min Physical Size + BLSURF_ANGLE_MESH_TOOLTIP + Limiting angle between the plane of a triangle of the mesh and each of the tangent planes at the three vertices.<br> +The smaller this angle is, the closer the mesh is to the exact surface, and the denser the resulting mesh is. - BLSURF_HYPOTHESIS - BLSURF 2D + BLSURF_CHORDAL_ERROR + Mesh distance - BLSURF_PHY_MESH - Physical Mesh + BLSURF_CHORDAL_TOOLTIP + Maximum desired distance between a triangle and its supporting CAD surface.<br> +The smaller this distance is, the closer the mesh is to the exact surface (only available in isotropic meshing). + + + BLSURF_OTHER_PARAMETERS + Other parameters + + + BLSURF_ANISOTROPIC + Anisotropic + + + BLSURF_ANISOTROPIC_TOOLTIP + If checked, this parameter defines the maximum anisotropic ratio of the metric governing the anisotropic meshing process.<br> + The default value of 0 means that the metric (and thus the generated elements) can be arbitrarily stretched. + + + BLSURF_REMOVE_TINY_EDGES + Remove tiny edges + + + BLSURF_REMOVE_TINY_EDGES_TOOLTIP + If checked, this parameter defines the minimal length under which an edge is considered to be a tiny one. + + + BLSURF_REMOVE_SLIVERS + Remove bad elements + + + BLSURF_REMOVE_SLIVERS_TOOLTIP + If checked, this parameter defines the aspect ratio triggering the "bad element” classification. + + + BLSURF_OPTIMISATION + Mesh optimisation + + + BLSURF_OPTIMISATION_TOOLTIP + If checked, MeshGems-CADSurf will optimize the mesh in order to get better shaped elements. + + + BLSURF_ELEMENT_ORDER + Quadratic mesh + + + BLSURF_HYPOTHESIS + BLSURF 2D BLSURF_ADV_ARGS @@ -109,7 +192,7 @@ OBLIGATORY_VALUE - (Obligatory value) + (Mandatory value) OPTION_TYPE_COLUMN @@ -132,7 +215,11 @@ PreCAD - REMOVE_OPTION + BLSURF_ADD_OPTION + Add option + + + BLSURF_REMOVE_OPTION Clear option @@ -160,21 +247,13 @@ Merge edges - BLSURF_PRECAD_REMOVE_NANO_EDGES - Remove nano edges + BLSURF_PRECAD_PROCESS_3D_TOPOLOGY + Process 3D topology BLSURF_PRECAD_DISCARD_INPUT Discard input topology - - BLSURF_PRECAD_EPS_NANO - Nano edge length - - - BLSURF_SIZE_MAP - Local Size - SMP_ENTRY_COLUMN Entry diff --git a/src/GUI/BLSURFPlugin_msg_fr.ts b/src/GUI/BLSURFPlugin_msg_fr.ts index 6a8bde3..fbe4538 100755 --- a/src/GUI/BLSURFPlugin_msg_fr.ts +++ b/src/GUI/BLSURFPlugin_msg_fr.ts @@ -4,76 +4,159 @@ @default - ADD_OPTION - Ajouter l'option + BLSURF_MESH_TYPE + Type de maillage - BLSURF_ALLOW_QUADRANGLES - Autoriser les quadrangles (Test) + BLSURF_PHY_MESH + Maillage physique - BLSURF_ANGLE_MESH_C - Angle de maillage C + BLSURF_PHY_MESH_TOOLTIP + <b><u>Mode de taille physique</u></b><br><br> +- "Taille globale": la taille physique est globale et le mailleur utilisera la taille physique globale fournie.<br> +- "Taille locale": la taille est localement calculée sur les courbes et surfaces en utilisant les fonctions de carte de taille associées.<br> +- "Inactive": aucune taille physique ne sera calculée. - BLSURF_ANGLE_MESH_S - Angle de maillage S + BLSURF_GEOM_MESH + Maillage géométrique - BLSURF_CUSTOM_GEOM - Personnalisé + BLSURF_GEOM_MESH_TOOLTIP + <b><u>Mode de taille géométrique</u></b><br><br> +- "Taille globale": la taille géométrique est globale et le mailleur utilisera l'approximation géométrique fournie par les paramètres géométriques.<br> +- "Inactive": aucune taille géométrique ne sera calculée. - BLSURF_CUSTOM_USER - Personnalisé + BLSURF_DEFAULT_USER + Inactif - BLSURF_DECIMESH - S'affranchir des frontières des surfaces + GLOBAL_SIZE + Taille globale - BLSURF_DEFAULT_GEOM - Inactif + LOCAL_SIZE + Taille locale - BLSURF_DEFAULT_USER - Inactif + BLSURF_MAIN_PARAMETERS + Paramètres principaux - BLSURF_GEOM_MESH - Maillage géométrique + BLSURF_HPHYDEF + Taille d'utilisateur + + + BLSURF_HPHYDEF_TOOLTIP + Défini la taille globale constante pour le maillage physique.<br> +La valeur par défaut est calculée par <em>diag</em>/<em>ratio</em>, où <em>ratio</em> est défini dans les préférences. + + + BLSURF_MINSIZE + Taille minimale + + + BLSURF_MINSIZE_TOOLTIP + Défini la taille globale minimum de cellule désirée.<br> +La valeur par défaut est calculée par <em>diag</em>/1000. + + + BLSURF_MAXSIZE + Taille maximale + + + BLSURF_MAXSIZE_TOOLTIP + Défini la taille globale maximum de cellule désirée.<br> +La valeur par défaut est calculée par <em>diag</em>/5. + + + BLSURF_SIZE_REL + Valeur relative + + + BLSURF_SIZE_REL_TOOLTIP + La valeur est relative à <em>diag</em> BLSURF_GRADATION Taux d'accroissement - BLSURF_HGEOMAX - Taille géométrique maximale + BLSURF_GRADATION_TOOLTIP + Ratio maximum entre les longueurs de deux segments adjacents. - BLSURF_HGEOMIN - Taille géométrique minimale + BLSURF_ALLOW_QUADRANGLES + Autoriser les quadrangles - BLSURF_HPHYDEF - Taille d'utilisateur + BLSURF_GEOMETRICAL_PARAMETERS + Paramètres géometriques - BLSURF_HPHYMAX - Taille physique maximale + BLSURF_ANGLE_MESH + Angle de maillage - BLSURF_HPHYMIN - Taille physique minimale + BLSURF_ANGLE_MESH_TOOLTIP + Limite d'angle entre le plan d'un triangle du maillage et chacun des plans tangents aux sommets.<br> +Plus l'angle est petit, plus le maillage sera dense et proche de la géométrie. - BLSURF_HYPOTHESIS - BLSURF 2D + BLSURF_CHORDAL_ERROR + Distance du maillage - BLSURF_PHY_MESH - Maillage physique + BLSURF_CHORDAL_TOOLTIP + Distance maximum désirée entre un triangle et sa surface CAO.<br> +Plus la distance est petite, plus le maillage sera proche de la surface (disponible en mode isotrope seulement). + + + BLSURF_OTHER_PARAMETERS + Autres paramètres + + + BLSURF_ANISOTROPIC + Anisotropie + + + BLSURF_ANISOTROPIC_TOOLTIP + Si activé, ce paramètre défini le ratio d'anisotropie maximum de la métrique pilotant de processus de maillage anisotropique.<br> + La valeur par défaut de 0 signifie que la métrique (et donc les éléments générés) peut être étirée arbitrairement. + + + BLSURF_REMOVE_TINY_EDGES + Enlever les petites arêtes + + + BLSURF_REMOVE_TINY_EDGES_TOOLTIP + Si activé, ce paramètre défini la longueur minimale sous laquelle une arête est considérée comme toute petite. + + + BLSURF_REMOVE_SLIVERS + Enlever les mauvais éléments + + + BLSURF_REMOVE_SLIVERS_TOOLTIP + Si activé, ce paramètre défini les proportions déclenchants la classification des "mauvais éléments”. + + + BLSURF_OPTIMISATION + Optimisation du maillage + + + BLSURF_OPTIMISATION_TOOLTIP + Si activé, MeshGems-CADSurf optimisera le maillage pour obtenir des éléments de meilleurs qualité. + + + BLSURF_ELEMENT_ORDER + Maillage quadratique + + + BLSURF_HYPOTHESIS + BLSURF 2D BLSURF_ADV_ARGS @@ -132,7 +215,11 @@ PreCAD - REMOVE_OPTION + BLSURF_ADD_OPTION + Ajouter l'option + + + BLSURF_REMOVE_OPTION Effacer l'option @@ -160,21 +247,13 @@ Fusionner des arêtes - BLSURF_PRECAD_REMOVE_NANO_EDGES - Supprimer les petites arêtes + BLSURF_PRECAD_PROCESS_3D_TOPOLOGY + Nettoyer la CAO BLSURF_PRECAD_DISCARD_INPUT Ignorer la topologie - - BLSURF_PRECAD_EPS_NANO - Longueur max des petites arêtes - - - BLSURF_SIZE_MAP - Tailles locales - SMP_ENTRY_COLUMN Entrée diff --git a/src/GUI/Makefile.am b/src/GUI/Makefile.am index 8f0b6a0..e77ad36 100644 --- a/src/GUI/Makefile.am +++ b/src/GUI/Makefile.am @@ -26,6 +26,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files salomeinclude_HEADERS = \ + BLSURFPluginGUI_Dlg.h \ BLSURFPluginGUI_HypothesisCreator.h # Libraries targets @@ -33,10 +34,19 @@ lib_LTLIBRARIES = libBLSURFPluginGUI.la dist_libBLSURFPluginGUI_la_SOURCES = \ BLSURFPluginGUI.cxx \ + BLSURFPluginGUI_StdWidget.cxx \ + BLSURFPluginGUI_AdvWidget.cxx \ BLSURFPluginGUI_HypothesisCreator.cxx MOC_FILES = \ - BLSURFPluginGUI_HypothesisCreator_moc.cxx + BLSURFPluginGUI_HypothesisCreator_moc.cxx \ + BLSURFPluginGUI_Dlg_moc.cxx + +UIC_FILES = \ + ui_BLSURFPluginGUI_StdWidget_QTD.h \ + ui_BLSURFPluginGUI_AdvWidget_QTD.h + +BUILT_SOURCES = $(UIC_FILES) nodist_libBLSURFPluginGUI_la_SOURCES = \ $(MOC_FILES) @@ -56,17 +66,18 @@ libBLSURFPluginGUI_la_CPPFLAGS = \ $(BOOST_CPPFLAGS) \ $(CORBA_CXXFLAGS) \ $(CORBA_INCLUDES) \ - $(BLSURF_INCLUDES) \ + $(MESHGEMS_CADSURF_INCLUDES) \ -I$(srcdir)/../BLSURFPlugin \ -I$(top_builddir)/idl libBLSURFPluginGUI_la_LDFLAGS = \ - $(QT_LIBS) \ + $(QT_LIBS) $(QT_MT_LIBS)\ ../BLSURFPlugin/libBLSURFEngine.la \ + ../../idl/libSalomeIDLBLSURFPLUGIN.la \ $(GUI_LDFLAGS) -lqtx -lSalomeApp -lsuit -lSalomeObject -lLightApp \ $(GEOM_LDFLAGS) -lGEOM \ - ${SMESH_LDFLAGS} -lSMESH -lGeomSelectionTools -lStdMeshersGUI -lSMESHFiltersSelection \ - $(CAS_KERNEL) $(BLSURF_LIBS) + ${SMESH_LDFLAGS} -lSMESH -lSMESHEngine -lGeomSelectionTools -lStdMeshersGUI -lSMESHFiltersSelection \ + $(CAS_KERNEL) $(MESHGEMS_CADSURF_LIBS) # resources files nodist_salomeres_DATA = \