From: gdd Date: Mon, 10 Sep 2012 09:26:31 +0000 (+0000) Subject: Meshgems: first commit X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d85864535965939ad701bac4163c58b0a837fceb;p=plugins%2Fblsurfplugin.git Meshgems: first commit --- diff --git a/adm_local/cmake_files/FindCADSURF.cmake b/adm_local/cmake_files/FindCADSURF.cmake new file mode 100644 index 0000000..1954cb7 --- /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(CADSURF_INCLUDES) +SET(CADSURF_INCLUDES ${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(CADSURF_LIBS) +SET(CADSURF_LIBS ${CADSURF_LIBS} ${mg-cadsurf}) +SET(CADSURF_LIBS ${CADSURF_LIBS} ${mg-precad}) +IF(meshgems) + SET(CADSURF_LIBS ${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 a8d2a7e..d68d4fd 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/idl/BLSURFPlugin_Algorithm.idl b/idl/BLSURFPlugin_Algorithm.idl index d26ce56..ec9d552 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(); + + /*! + * Defines the minimal length under which an edge is considered to be a tiny one + */ + 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(); /*! - * To respect geometrical edges or not + * Determines the order of mesh elements to be generated (linear or quadratic) */ - void SetDecimesh(in boolean toIgnoreEdges); - boolean GetDecimesh(); + 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,16 @@ 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 remove nano edges. +// */ +// void SetPreCADRemoveNanoEdges(in boolean toRemoveNanoEdges); +// boolean GetPreCADRemoveNanoEdges(); /*! * To compute topology from scratch @@ -232,12 +285,12 @@ 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 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 +335,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(); diff --git a/src/BLSURFPlugin/BLSURFPluginDC.py b/src/BLSURFPlugin/BLSURFPluginDC.py index 791744e..39715f0 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,431 @@ 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 + + pass # end of BLSURF_Algorithm class + + #===================== + # 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 diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index e834c58..0c25c72 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 @@ -367,6 +367,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 +382,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 +401,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 +571,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 +649,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 +789,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 +883,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 +981,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 +1038,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 +1139,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 +1150,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 +1161,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); @@ -1095,23 +1180,23 @@ namespace 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); + cadsurf_session_delete(_css); // #if BLSURF_VERSION_LONG >= "3.1.1" // // if(geo_sizemap_e) @@ -1210,10 +1295,10 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) 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; @@ -1221,9 +1306,17 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) // #if BLSURF_VERSION_LONG >= "3.1.1" // c, // #endif - _hypothesis, bls, pcs, aMesh, &use_precad); + _hypothesis, css, pcs, aMesh, &use_precad); MESSAGE("END SetParameters"); + 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 haveQuadraticSubMesh = SMESH_MesherHelper( aMesh ).IsQuadraticSubMesh( aShape ); + helper.SetIsQuadratic( haveQuadraticSubMesh || (_hypothesis != NULL && _hypothesis->GetQuadraticMesh()) ); + bool needMerge = false; + set< SMESH_subMesh* > edgeSubmeshes; + // needed to prevent the opencascade memory managmement from freeing things vector curves; vector surfaces; @@ -1272,10 +1365,10 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) iface++; surfaces.push_back(BRep_Tool::Surface(f)); - /* create an object representing the face for blsurf */ - /* where face_id is an integer identifying the face. + /* 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()); @@ -1328,7 +1421,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) 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); - // scl.Perform() is bugged. The function was rewritten + // 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); @@ -1475,7 +1568,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) } } - /* attach the edge to the current blsurf face */ + /* 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 : */ @@ -1497,7 +1590,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) edgeSubmeshes.insert( sm ); StdMeshers_FaceSide edgeOfFace( f, e, &aMesh, e.Orientation() == TopAbs_FORWARD, - /*ignoreMedium=*/haveQudraticSubMesh); + /*ignoreMedium=*/haveQuadraticSubMesh); if ( edgeOfFace.MissVertexNode() ) return error(COMPERR_BAD_INPUT_MESH,"No node on vertex"); @@ -1658,20 +1751,20 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) } } - 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); +// cadsurf_data_set_sizemap(css, clean_iso_sizemap_p); +// cadsurf_data_set_sizemap(css, clean_iso_sizemap_e); +// cadsurf_data_set_sizemap(css, clean_iso_sizemap_f); // #endif std::cout << std::endl; @@ -1687,7 +1780,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) try { OCC_CATCH_SIGNALS; - status = blsurf_compute_mesh(bls); + status = cadsurf_compute_mesh(css); } catch ( std::exception& exc ) { @@ -1702,7 +1795,7 @@ 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 @@ -1714,10 +1807,10 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) 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); } @@ -1730,32 +1823,22 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) 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); mesh_get_edge_count(msh, &ne); 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]; @@ -1845,8 +1928,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 +1940,27 @@ 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 + std::cout << "This is a quadratic edge" << std::endl; + 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 +1973,36 @@ 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 + std::cout << "This is a quadratic triangle" << std::endl; + 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,6 +2019,37 @@ 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 @@ -1954,7 +2102,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) delete [] nodes; /* release the mesh object */ - blsurf_data_regain_mesh(bls, msh); + cadsurf_data_regain_mesh(css, msh); // Issue 0019864. On DebianSarge, FE signals do not obey to OSD::SetSignal(false) #ifndef WNT @@ -2159,20 +2307,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 +2360,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 +2375,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 +2395,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 +2410,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; } @@ -2345,19 +2481,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 +2505,7 @@ bool BLSURFPlugin_BLSURF::Evaluate(SMESH_Mesh& aMesh, MESSAGE("BLSURFPlugin_BLSURF::SetParameters using defaults"); } - bool IsQuadratic = false; + bool IsQuadratic = _quadraticMesh; // ---------------- // evaluate 1D @@ -2401,7 +2541,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 +2631,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..b89d5a2 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx @@ -59,9 +59,9 @@ #include "Utils_SALOME_Exception.hxx" extern "C"{ -#include "distene/blsurf.h" -#include "distene/api.h" -#include "distene/precad.h" +#include +#include +#include } #include diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx index f934918..3d18cc2 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", // 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", // default = 0 + "hmean_flag", // 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,73 @@ 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) + 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) { + return diagonal / 1000.0 ; } -//============================================================================= -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) { + return diagonal / 5.0 ; } -//====================================================================== -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) { + return diagonal; } -//============================================================================= -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) { + return diagonal * 1e-6 ; } //============================================================================= -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..3625fa5 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); + return this->GetImpl()->IsPhySizeRel(); +} + +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) { ASSERT(myBaseImpl); - if (GetPhyMin() != theMinSize) { - this->GetImpl()->SetPhyMin(theMinSize); - SMESH::TPythonDump() << _this() << ".SetPhyMin( " << theMinSize << " )"; + 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); + if ( IsMinSizeRel() && (GetMinSize() != theMinSize) ) { + this->GetImpl()->SetMinSize(theMinSize, true); + SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << ", isRelative = True )"; + } +} + +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize() { + ASSERT(myBaseImpl); + 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); - return this->GetImpl()->GetPhyMin(); + if (GetMaxSize() != theMaxSize) { + this->GetImpl()->SetMaxSize(theMaxSize, false); + SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )"; + } } //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) { +void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) { ASSERT(myBaseImpl); - if (GetPhyMax() != theMaxSize) { - this->GetImpl()->SetPhyMax(theMaxSize); - SMESH::TPythonDump() << _this() << ".SetPhyMax( " << theMaxSize << " )"; + if ( IsMaxSizeRel() && (GetMaxSize() != theMaxSize) ) { + this->GetImpl()->SetMaxSize(theMaxSize, true); + SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << ", isRelative = True )"; } } //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() { +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()->GetPhyMax(); + 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::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::SetOptimizeMesh(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh"); + ASSERT(myBaseImpl); + this->GetImpl()->SetOptimizeMesh(theValue); + std::string theValueStr = theValue ? "True" : "False"; + SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh + * + * Get true or false + */ +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetOptimizeMesh(); } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetDecimesh + * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh * * Set true or false */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetDecimesh"); +void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh"); ASSERT(myBaseImpl); - this->GetImpl()->SetDecimesh(theValue); + this->GetImpl()->SetQuadraticMesh(theValue); std::string theValueStr = theValue ? "True" : "False"; - SMESH::TPythonDump() << _this() << ".SetDecimesh( " << theValueStr.c_str() << " )"; + SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetDecimesh + * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh * * Get true or false */ //============================================================================= -CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetDecimesh"); +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); - return this->GetImpl()->GetDecimesh(); + 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()->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; diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx index 2c96546..fb7c33e 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(); 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..1f3e470 --- /dev/null +++ b/src/GUI/BLSURFPluginGUI_Dlg.h @@ -0,0 +1,106 @@ +// 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 + +#ifdef WIN32 + #if defined BLSURFPLUGIN_GUI_DLG_EXPORTS || defined BLSURFPluginGUI_Dlg_EXPORTS + #define BLSURFPLUGIN_GUI_DLG_EXPORT __declspec( dllexport ) + #else + #define BLSURFPLUGIN_GUI_DLG_EXPORT __declspec( dllimport ) + #endif +#else + #define BLSURFPLUGIN_GUI_DLG_EXPORT +#endif + +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" + +class BLSURFPLUGIN_GUI_DLG_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_DLG_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..dcfb8d9 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(); } } @@ -1506,47 +1279,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 + myStdWidget->myGradation->SetValue( data.myGradation ); + myStdWidget->myAllowQuadrangles->setChecked( data.myAllowQuadrangles ); + + if (data.myAngleMesh < 0) + myStdWidget->myAngleMesh->setText(""); else - myGeoMin->SetValue( data.myGeoMin ); - MESSAGE("data.myGeoMax: "<setText(""); + myStdWidget->myAngleMesh->SetValue( data.myAngleMesh ); + if (data.myChordalError < 0) + myStdWidget->myChordalError->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->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 +1343,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 +1365,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 +1462,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 +1492,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 +1676,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 +1861,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->GetString().isEmpty() ? -1.0 : myStdWidget->myPhySize->GetValue(); + h_data.myPhySizeRel = myStdWidget->myPhySizeRel->isChecked(); + h_data.myMinSize = myStdWidget->myMinSize->GetString().isEmpty() ? -1.0 : myStdWidget->myMinSize->GetValue(); + h_data.myMinSizeRel = myStdWidget->myMinSizeRel->isChecked(); + h_data.myMaxSize = myStdWidget->myMaxSize->GetString().isEmpty() ? -1.0 : myStdWidget->myMaxSize->GetValue(); + h_data.myMaxSizeRel = myStdWidget->myMaxSizeRel->isChecked(); + h_data.myGradation = myStdWidget->myGradation->GetString().isEmpty() ? -1.0 : myStdWidget->myGradation->GetValue(); + h_data.myAllowQuadrangles = myStdWidget->myAllowQuadrangles->isChecked(); + h_data.myAngleMesh = myStdWidget->myAngleMesh->GetString().isEmpty() ? -1.0 : myStdWidget->myAngleMesh->GetValue(); + h_data.myChordalError = myStdWidget->myChordalError->GetString().isEmpty() ? -1.0 : myStdWidget->myChordalError->GetValue(); + h_data.myAnisotropic = myStdWidget->myAnisotropic->isChecked(); + h_data.myAnisotropicRatio = myStdWidget->myAnisotropicRatio->GetString().isEmpty() ? -1.0 : myStdWidget->myAnisotropicRatio->GetValue(); + h_data.myRemoveTinyEdges = myStdWidget->myRemoveTinyEdges->isChecked(); + h_data.myTinyEdgeLength = myStdWidget->myTinyEdgeLength->GetString().isEmpty() ? -1.0 : myStdWidget->myTinyEdgeLength->GetValue(); + h_data.myForceBadElementRemoval= myStdWidget->myForceBadElementRemoval->isChecked(); + h_data.myBadElementAspectRatio = myStdWidget->myBadElementAspectRatio->GetString().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 +1942,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 +2016,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 +2042,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 +2059,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 +2445,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 +2533,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..bb88c89 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,17 @@ 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 \ $(GUI_LDFLAGS) -lqtx -lSalomeApp -lsuit -lSalomeObject -lLightApp \ $(GEOM_LDFLAGS) -lGEOM \ ${SMESH_LDFLAGS} -lSMESH -lGeomSelectionTools -lStdMeshersGUI -lSMESHFiltersSelection \ - $(CAS_KERNEL) $(BLSURF_LIBS) + $(CAS_KERNEL) $(MESHGEMS_CADSURF_LIBS) # resources files nodist_salomeres_DATA = \