From 1958779443b1a2d3e5bc26087c19d7e989d61eb2 Mon Sep 17 00:00:00 2001 From: Christophe Bourcier Date: Fri, 18 Nov 2016 14:25:15 +0100 Subject: [PATCH] Fix the option remove_tiny_uv_edges to use the new advanced options mechanism The option remove_tiny_uv_edges was introduced in cbr/CEA_1537_remove_deprecated_precad as an advanced option but was lost during the merge in master. This option is needed to completely disable preprocessing of the CAD. --- idl/BLSURFPlugin_Algorithm.idl | 6 ---- src/BLSURFPlugin/BLSURFPluginBuilder.py | 6 ---- src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx | 3 -- src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx | 22 +++---------- src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx | 5 --- .../BLSURFPlugin_Hypothesis_i.cxx | 31 ------------------- .../BLSURFPlugin_Hypothesis_i.hxx | 3 -- src/GUI/BLSURFPlugin_msg_en.ts | 2 +- src/GUI/BLSURFPlugin_msg_fr.ts | 2 +- src/GUI/BLSURFPlugin_msg_ja.ts | 2 +- tests/test_precad_intersections.py | 1 + 11 files changed, 9 insertions(+), 74 deletions(-) diff --git a/idl/BLSURFPlugin_Algorithm.idl b/idl/BLSURFPlugin_Algorithm.idl index 1296ba1..545282a 100644 --- a/idl/BLSURFPlugin_Algorithm.idl +++ b/idl/BLSURFPlugin_Algorithm.idl @@ -446,12 +446,6 @@ module BLSURFPlugin void SetPreCADMergeEdges(in boolean toMergeEdges); boolean GetPreCADMergeEdges(); - /*! - * To remove tiny UV edges edges. - */ - void SetPreCADRemoveTinyUVEdges(in boolean toRemoveTinyUVEdges); - boolean GetPreCADRemoveTinyUVEdges(); - /*! * To remove duplicate CAD faces. */ diff --git a/src/BLSURFPlugin/BLSURFPluginBuilder.py b/src/BLSURFPlugin/BLSURFPluginBuilder.py index 9fd78e9..369a94f 100644 --- a/src/BLSURFPlugin/BLSURFPluginBuilder.py +++ b/src/BLSURFPlugin/BLSURFPluginBuilder.py @@ -347,12 +347,6 @@ class BLSURF_Algorithm(Mesh_Algorithm): self.Parameters().SetPreCADMergeEdges(toMergeEdges) pass - ## To remove tiny UV edges. - # @param toRemoveTinyUVEdges "remove_tiny_uv_edges" flag value - def SetPreCADRemoveTinyUVEdges(self, toRemoveTinyUVEdges=False): - self.Parameters().SetPreCADRemoveTinyUVEdges(toRemoveTinyUVEdges) - pass - ## To remove duplicate CAD Faces # @param toRemoveDuplicateCADFaces "remove_duplicate_cad_faces" flag value def SetPreCADRemoveDuplicateCADFaces(self, toRemoveDuplicateCADFaces=False): diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 8a91ab3..5a2acd9 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -915,7 +915,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, // PreCAD //int _precadMergeEdges = BLSURFPlugin_Hypothesis::GetDefaultPreCADMergeEdges(); - int _precadRemoveTinyUVEdges = BLSURFPlugin_Hypothesis::GetDefaultPreCADRemoveTinyUVEdges(); //int _precadRemoveDuplicateCADFaces = BLSURFPlugin_Hypothesis::GetDefaultPreCADRemoveDuplicateCADFaces(); //int _precadProcess3DTopology = BLSURFPlugin_Hypothesis::GetDefaultPreCADProcess3DTopology(); //int _precadDiscardInput = BLSURFPlugin_Hypothesis::GetDefaultPreCADDiscardInput(); @@ -971,7 +970,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, //_topology = (int) hyp->GetTopology(); // PreCAD //_precadMergeEdges = hyp->GetPreCADMergeEdges(); - _precadRemoveTinyUVEdges = hyp->GetPreCADRemoveTinyUVEdges(); //_precadRemoveDuplicateCADFaces = hyp->GetPreCADRemoveDuplicateCADFaces(); //_precadProcess3DTopology = hyp->GetPreCADProcess3DTopology(); //_precadDiscardInput = hyp->GetPreCADDiscardInput(); @@ -1002,7 +1000,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, } // PreProcessor (formerly PreCAD) -- commented params are preCADoptions (since 0023307) //set_param(css, "merge_edges", _precadMergeEdges ? "yes" : "no"); - set_param(css, "remove_tiny_uv_edges", _precadRemoveTinyUVEdges ? "yes" : "no"); //set_param(css, "remove_duplicate_cad_faces", _precadRemoveDuplicateCADFaces ? "yes" : "no"); //set_param(css, "process_3d_topology", _precadProcess3DTopology ? "1" : "0"); //set_param(css, "discard_input_topology", _precadDiscardInput ? "1" : "0"); diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx index ca91973..4048437 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx @@ -81,7 +81,6 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G _verb(GetDefaultVerbosity()), _topology(GetDefaultTopology()), _preCADMergeEdges(GetDefaultPreCADMergeEdges()), - _preCADRemoveTinyUVEdges(GetDefaultPreCADRemoveTinyUVEdges()), _preCADRemoveDuplicateCADFaces(GetDefaultPreCADRemoveDuplicateCADFaces()), _preCADProcess3DTopology(GetDefaultPreCADProcess3DTopology()), _preCADDiscardInput(GetDefaultPreCADDiscardInput()), @@ -143,6 +142,9 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G "debug", // default = 0 "process_3d_topology", // default = 1 // "remove_tiny_edges", // default = 0 + // remove_tiny_uv_edges option is not documented + // but it is useful that the user can change it to disable all preprocessing options + "remove_tiny_uv_edges", // default = 1 "" // mark of end }; const char* preCADintOptionNames[] = { // "manifold_geometry", // default = 0 @@ -208,6 +210,7 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G _defaultOptionValues["respect_geometry" ] = "yes"; _defaultOptionValues["tiny_edge_avoid_surface_intersections" ] = "yes"; _defaultOptionValues["process_3d_topology" ] = "no"; + _defaultOptionValues["remove_tiny_uv_edges" ] = "no"; _defaultOptionValues["closed_geometry" ] = "no"; _defaultOptionValues["debug" ] = "no"; _defaultOptionValues["discard_input_topology" ] = "no"; @@ -765,15 +768,6 @@ void BLSURFPlugin_Hypothesis::SetPreCADMergeEdges(bool theVal) } } -//============================================================================= -void BLSURFPlugin_Hypothesis::SetPreCADRemoveTinyUVEdges(bool theVal) -{ - if (theVal != _preCADRemoveTinyUVEdges) { - _preCADRemoveTinyUVEdges = theVal; - NotifySubMeshesHypothesisModification(); - } -} - //============================================================================= void BLSURFPlugin_Hypothesis::SetPreCADRemoveDuplicateCADFaces(bool theVal) { @@ -1901,7 +1895,7 @@ std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) 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 << " " << (int) _preCADRemoveDuplicateCADFaces << " " << (int) _preCADRemoveTinyUVEdges; + save << " " << (int) _preCADProcess3DTopology << " " << (int) _preCADRemoveDuplicateCADFaces; save << " " << (int)_optimiseTinyEdges << " " << _tinyEdgeOptimisationLength; save << " " << (int)_correctSurfaceIntersec << " " << _corrSurfaceIntersCost; save << " " << (int)_useGradation << " " << (int)_useVolumeGradation << " " << _volumeGradation; @@ -2445,12 +2439,6 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) else load.clear(std::ios::badbit | load.rdstate()); - isOK = static_cast(load >> i); - if (isOK) - _preCADRemoveTinyUVEdges = (bool) i; - else - load.clear(std::ios::badbit | load.rdstate()); - isOK = static_cast(load >> i); if (isOK) _optimiseTinyEdges = (bool) i; diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx index 18ffa41..bcf1e84 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx @@ -197,9 +197,6 @@ public: void SetPreCADMergeEdges(bool theVal); bool GetPreCADMergeEdges() const { return _preCADMergeEdges; } - void SetPreCADRemoveTinyUVEdges(bool theVal); - bool GetPreCADRemoveTinyUVEdges() const { return _preCADRemoveTinyUVEdges; } - void SetPreCADRemoveDuplicateCADFaces(bool theVal); bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; } @@ -445,7 +442,6 @@ public: static Topology GetDefaultTopology() { return FromCAD; } // PreCAD static bool GetDefaultPreCADMergeEdges() { return false; } - static bool GetDefaultPreCADRemoveTinyUVEdges() { return false; } static bool GetDefaultPreCADRemoveDuplicateCADFaces() { return false; } static bool GetDefaultPreCADProcess3DTopology() { return false; } static bool GetDefaultPreCADDiscardInput() { return false; } @@ -583,7 +579,6 @@ private: Topology _topology; bool _preCADMergeEdges; - bool _preCADRemoveTinyUVEdges; bool _preCADRemoveDuplicateCADFaces; bool _preCADProcess3DTopology; bool _preCADDiscardInput; diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx index 3db9133..16a3458 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx @@ -1132,34 +1132,6 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() { return this->GetImpl()->GetPreCADMergeEdges(); } -//============================================================================= -/*! - * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges - * - * Set true or false - */ -//============================================================================= -void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges"); - ASSERT(myBaseImpl); - this->GetImpl()->SetPreCADRemoveTinyUVEdges(theValue); - std::string theValueStr = theValue ? "True" : "False"; - SMESH::TPythonDump() << _this() << ".SetPreCADRemoveTinyUVEdges( " << theValueStr.c_str() << " )"; -} - -//============================================================================= -/*! - * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges - * - * Get true or false - */ -//============================================================================= -CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges"); - ASSERT(myBaseImpl); - return this->GetImpl()->GetPreCADRemoveTinyUVEdges(); -} - //============================================================================= /*! * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces @@ -1397,9 +1369,6 @@ void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, con else if ( name == "tiny_edge_optimisation_length" ) SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue )); - else if ( name == "remove_tiny_uv_edges" ) - SetPreCADRemoveTinyUVEdges( GetImpl()->ToBool( optionValue )); - else if ( name == "process_3d_topology" ) SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue )); diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx index ad283c9..50b6806 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx @@ -169,9 +169,6 @@ public: void SetPreCADMergeEdges(CORBA::Boolean theValue); CORBA::Boolean GetPreCADMergeEdges(); - void SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue); - CORBA::Boolean GetPreCADRemoveTinyUVEdges(); - void SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue); CORBA::Boolean GetPreCADRemoveDuplicateCADFaces(); diff --git a/src/GUI/BLSURFPlugin_msg_en.ts b/src/GUI/BLSURFPlugin_msg_en.ts index 80948d7..caa0fa0 100644 --- a/src/GUI/BLSURFPlugin_msg_en.ts +++ b/src/GUI/BLSURFPlugin_msg_en.ts @@ -287,7 +287,7 @@ The smaller this distance is, the closer the mesh is to the exact surface (only Merge edges - BLSURF_PRECAD_REMOVE_TINY_UV_EDGES + remove_tiny_uv_edges Remove tiny UV edges diff --git a/src/GUI/BLSURFPlugin_msg_fr.ts b/src/GUI/BLSURFPlugin_msg_fr.ts index b28d916..ffa22d4 100755 --- a/src/GUI/BLSURFPlugin_msg_fr.ts +++ b/src/GUI/BLSURFPlugin_msg_fr.ts @@ -291,7 +291,7 @@ Plus la distance est petite, plus le maillage sera proche de la surface (disponi Fusionner des arêtes - BLSURF_PRECAD_REMOVE_TINY_UV_EDGES + remove_tiny_uv_edges Supprime les petites arêtes UV diff --git a/src/GUI/BLSURFPlugin_msg_ja.ts b/src/GUI/BLSURFPlugin_msg_ja.ts index 22ae669..95b0a4c 100644 --- a/src/GUI/BLSURFPlugin_msg_ja.ts +++ b/src/GUI/BLSURFPlugin_msg_ja.ts @@ -276,7 +276,7 @@ エッジをマージします。 - BLSURF_PRECAD_REMOVE_TINY_UV_EDGES + remove_tiny_uv_edges 微小UVエッジの削除 diff --git a/tests/test_precad_intersections.py b/tests/test_precad_intersections.py index 0602459..47eef3d 100644 --- a/tests/test_precad_intersections.py +++ b/tests/test_precad_intersections.py @@ -49,6 +49,7 @@ BLSURF_Parameters = BLSURF_1.Parameters() BLSURF_Parameters.SetPhySize( 5 ) BLSURF_Parameters.SetPreCADMergeEdges( True ) BLSURF_Parameters.SetPreCADProcess3DTopology( True ) +BLSURF_Parameters.SetPreCADOptionValue( 'remove_tiny_uv_edges', 'yes' ) Mesh_1.Compute() -- 2.39.2