From deb77ce400a5a40275c8310bada89c9091ff6ebb Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Thu, 4 May 2017 11:52:23 +0200 Subject: [PATCH] correction for bug #23439: add use_deprecated_patch_mesher parameter to allow the behaviour of meshgems 2.1-11 --- idl/BLSURFPlugin_Algorithm.idl | 9 +++++++++ src/BLSURFPlugin/BLSURFPluginBuilder.py | 8 ++++++++ src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx | 18 ++++++++++++++++++ src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx | 3 +++ src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx | 18 ++++++++++++++++++ src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx | 3 +++ src/GUI/BLSURFPlugin_msg_en.ts | 4 ++++ src/GUI/BLSURFPlugin_msg_fr.ts | 4 ++++ src/GUI/BLSURFPlugin_msg_ja.ts | 4 ++++ 9 files changed, 71 insertions(+) diff --git a/idl/BLSURFPlugin_Algorithm.idl b/idl/BLSURFPlugin_Algorithm.idl index 141982f..671fd60 100644 --- a/idl/BLSURFPlugin_Algorithm.idl +++ b/idl/BLSURFPlugin_Algorithm.idl @@ -343,6 +343,15 @@ module BLSURFPlugin void SetJacobianRectification( in boolean allowRectification ); boolean GetJacobianRectification(); + /*! + * Set use_deprecated_patch_mesher parameter (compatibility with older versions of Meshgems) + * + * the use_deprecated_patch_mesher parameter allows to keep the same behaviour than + * in salome < 8.3 (meshgems 2.1.11 instead of meshgems >= 2.4.5) + */ + void SetUseDeprecatedPatchMesher( in boolean useDeprecatedPatchMesher ); + boolean GetUseDeprecatedPatchMesher(); + /*! * Set max_number_of_points_per_patch parameter * diff --git a/src/BLSURFPlugin/BLSURFPluginBuilder.py b/src/BLSURFPlugin/BLSURFPluginBuilder.py index af4e99d..4548fa3 100644 --- a/src/BLSURFPlugin/BLSURFPluginBuilder.py +++ b/src/BLSURFPlugin/BLSURFPluginBuilder.py @@ -234,6 +234,14 @@ class BLSURF_Algorithm(Mesh_Algorithm): def SetJacobianRectification( self, allowRectification ): self.Parameters().SetJacobianRectification( allowRectification ) + ## Set use_deprecated_patch_mesher parameter (compatibility with older versions of Meshgems) + # + # the use_deprecated_patch_mesher parameter allows to keep the same behaviour than + # in salome < 8.3 (meshgems 2.1.11 instead of meshgems >= 2.4.5) + # + def SetUseDeprecatedPatchMesher( self, useDeprecatedPatchMesher ): + self.Parameters().SetUseDeprecatedPatchMesher( useDeprecatedPatchMesher ) + ## Set respect_geometry parameter # # This patch independent option can be deactivated to allow MeshGems-CADSurf diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx index 0300bdd..d567f50 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx @@ -116,6 +116,7 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G // "remove_duplicate_cad_faces", // default = 1 "tiny_edge_avoid_surface_intersections", // default = 1 "debug", // default = 0 + "use_deprecated_patch_mesher", // default 0 // "tiny_edge_respect_geometry", // default = 0 "" // mark of end }; @@ -209,8 +210,10 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G _defaultOptionValues["max_number_of_points_per_patch" ] = "0"; _defaultOptionValues["max_number_of_threads" ] = "4"; _defaultOptionValues["rectify_jacobian" ] = "yes"; + _defaultOptionValues["use_deprecated_patch_mesher" ] = "yes"; _defaultOptionValues["respect_geometry" ] = "yes"; _defaultOptionValues["tiny_edge_avoid_surface_intersections" ] = "yes"; + _defaultOptionValues["use_deprecated_patch_mesher" ] = "no"; _defaultOptionValues["debug" ] = "no"; if ( hasgeom ) { @@ -538,6 +541,21 @@ bool BLSURFPlugin_Hypothesis::GetJacobianRectification() } //============================================================================= +void BLSURFPlugin_Hypothesis::SetUseDeprecatedPatchMesher( bool useDeprecatedPatchMesher ) +{ + if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher ) + { + SetOptionValue( "use_deprecated_patch_mesher", useDeprecatedPatchMesher ? "yes" : "no" ); + NotifySubMeshesHypothesisModification(); + } +} +//============================================================================= +bool BLSURFPlugin_Hypothesis::GetUseDeprecatedPatchMesher() +{ + return ToBool( GetOptionValue("use_deprecated_patch_mesher", GET_DEFAULT())); +} +//============================================================================= + void BLSURFPlugin_Hypothesis::SetMaxNumberOfPointsPerPatch( int nb ) throw (std::invalid_argument) { diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx index 1ed9675..1531872 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx @@ -157,6 +157,9 @@ public: void SetJacobianRectificationRespectGeometry( bool allowRectification ); bool GetJacobianRectificationRespectGeometry(); + void SetUseDeprecatedPatchMesher( bool useDeprecatedPatchMesher ); + bool GetUseDeprecatedPatchMesher(); + void SetJacobianRectification( bool allowRectification ); bool GetJacobianRectification(); diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx index b8c6677..3eef21b 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx @@ -832,6 +832,21 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification() } //============================================================================= +void BLSURFPlugin_Hypothesis_i::SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher ) +{ + if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher ) + { + this->GetImpl()->SetUseDeprecatedPatchMesher(useDeprecatedPatchMesher); + SMESH::TPythonDump() << _this() << ".SetUseDeprecatedPatchMesher( " << useDeprecatedPatchMesher << " )"; + } +} +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseDeprecatedPatchMesher() +{ + return this->GetImpl()->GetUseDeprecatedPatchMesher(); +} +//============================================================================= + void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception) { if ( GetMaxNumberOfPointsPerPatch() != nb ) @@ -1221,6 +1236,9 @@ void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const cha else if ( name == "rectify_jacobian" ) SetJacobianRectification( GetImpl()->ToBool( optionValue )); + else if ( name == "use_deprecated_patch_mesher" ) + SetUseDeprecatedPatchMesher( GetImpl()->ToBool( optionValue )); + else if ( name == "respect_geometry" ) SetRespectGeometry( GetImpl()->ToBool( optionValue )); diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx index 6a55caa..aceec48 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx @@ -138,6 +138,9 @@ public: void SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification ); CORBA::Boolean GetJacobianRectificationRespectGeometry(); + void SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher ); + CORBA::Boolean GetUseDeprecatedPatchMesher(); + void SetJacobianRectification( CORBA::Boolean allowRectification ); CORBA::Boolean GetJacobianRectification(); diff --git a/src/GUI/BLSURFPlugin_msg_en.ts b/src/GUI/BLSURFPlugin_msg_en.ts index a866bd4..6162398 100644 --- a/src/GUI/BLSURFPlugin_msg_en.ts +++ b/src/GUI/BLSURFPlugin_msg_en.ts @@ -637,6 +637,10 @@ The smaller this distance is, the closer the mesh is to the exact surface (only rectify_jacobian Rectify Jacobian + + use_deprecated_patch_mesher + use deprecated patch mesher + respect_geometry Respect geometry diff --git a/src/GUI/BLSURFPlugin_msg_fr.ts b/src/GUI/BLSURFPlugin_msg_fr.ts index 259cd86..56d7efd 100755 --- a/src/GUI/BLSURFPlugin_msg_fr.ts +++ b/src/GUI/BLSURFPlugin_msg_fr.ts @@ -637,6 +637,10 @@ Plus la distance est petite, plus le maillage sera proche de la surface (disponi rectify_jacobian Ajustement du Jacobien + + use_deprecated_patch_mesher + use deprecated patch mesher + respect_geometry Respect de la géométrie diff --git a/src/GUI/BLSURFPlugin_msg_ja.ts b/src/GUI/BLSURFPlugin_msg_ja.ts index 96534dd..1e0eb84 100644 --- a/src/GUI/BLSURFPlugin_msg_ja.ts +++ b/src/GUI/BLSURFPlugin_msg_ja.ts @@ -626,6 +626,10 @@ rectify_jacobian ヤコビアンの修正 + + use_deprecated_patch_mesher + use deprecated patch mesher + respect_geometry ジオメトリの尊重 -- 2.30.2