From 7d08ac8481b4a92dcad8fe4a3ea88956856dea15 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 1 Dec 2015 14:32:09 +0300 Subject: [PATCH] Fix regression of non-regression tests - Coplanar faces filter (SMESH_Controls.cxx) - Convert to quadratic (SMESH_MesherHelper.cxx) - Missing Compute item in mesh pop-up in presence of a sub-mesh on compound only (no other algos) (SSMESHGUI_ComputeDlg.cxx) - set checkAll=False in call of SMESH_Gen::IsApplicable() (smeshBuilder.py) --- src/Controls/SMESH_Controls.cxx | 9 +++++---- src/SMESH/SMESH_MesherHelper.cxx | 11 ++++++----- src/SMESHGUI/SMESHGUI_ComputeDlg.cxx | 2 +- src/SMESH_SWIG/StdMeshersBuilder.py | 2 ++ src/SMESH_SWIG/smeshBuilder.py | 7 ++++--- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 9978a6d68..3f612a24f 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -3013,12 +3013,13 @@ bool ConnectedElements::IsSatisfy( long theElementId ) namespace { - inline bool isLessAngle( const gp_Vec& v1, const gp_Vec& v2, const double cos2 ) + inline bool isLessAngle( const gp_Vec& v1, const gp_Vec& v2, const double cos ) { double dot = v1 * v2; // cos * |v1| * |v2| double l1 = v1.SquareMagnitude(); double l2 = v2.SquareMagnitude(); - return ( dot * dot ) / l1 / l2 >= cos2; + return (( dot * cos >= 0 ) && + ( dot * dot ) / l1 / l2 >= ( cos * cos )); } } CoplanarFaces::CoplanarFaces() @@ -3046,7 +3047,7 @@ void CoplanarFaces::SetMesh( const SMDS_Mesh* theMesh ) if (!normOK) return; - const double cosTol2 = Cos( myToler ) * Cos( myToler ); + const double cosTol = Cos( myToler * M_PI / 180. ); NCollection_Map< SMESH_TLink, SMESH_TLink > checkedLinks; std::list< pair< const SMDS_MeshElement*, gp_Vec > > faceQueue; @@ -3070,7 +3071,7 @@ void CoplanarFaces::SetMesh( const SMDS_Mesh* theMesh ) if ( f->GetNodeIndex( n2 ) > -1 ) { gp_Vec norm = getNormale( static_cast(f), &normOK ); - if (!normOK || isLessAngle( myNorm, norm, cosTol2)) + if (!normOK || isLessAngle( myNorm, norm, cosTol)) { myCoplanarIDs.Add( f->GetID() ); faceQueue.push_back( make_pair( f, norm )); diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 3e52ed9b4..3703a7215 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -4059,12 +4059,13 @@ namespace { // Structures used by FixQuadraticElements() const QFace* QLink::GetContinuesFace( const QFace* face ) const { - for ( size_t i = 0; i < _faces.size(); ++i ) { - if ( _faces[i] == face ) { - int iF = i < 2 ? 1-i : 5-i; - return iF < (int)_faces.size() ? _faces[iF] : 0; + if ( _faces.size() <= 4 ) + for ( size_t i = 0; i < _faces.size(); ++i ) { + if ( _faces[i] == face ) { + int iF = i < 2 ? 1-i : 5-i; + return iF < (int)_faces.size() ? _faces[iF] : 0; + } } - } return 0; } //================================================================================ diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 429531fd2..a71b425d4 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -1773,7 +1773,7 @@ void SMESHGUI_PrecomputeOp::getAssignedAlgos(_PTR(SObject) theMesh, } // check sub-meshes - for ( aPart = SMESH::Tag_SubMeshOnEdge; aPart < SMESH::Tag_LastSubMesh; ++aPart ) + for ( aPart = SMESH::Tag_SubMeshOnEdge; aPart <= SMESH::Tag_LastSubMesh; ++aPart ) { if ( !theMesh->FindSubObject( aPart, aHypFolder )) continue; diff --git a/src/SMESH_SWIG/StdMeshersBuilder.py b/src/SMESH_SWIG/StdMeshersBuilder.py index 98acce5f6..d9ad9bf5e 100644 --- a/src/SMESH_SWIG/StdMeshersBuilder.py +++ b/src/SMESH_SWIG/StdMeshersBuilder.py @@ -1421,6 +1421,8 @@ class StdMeshersBuilder_UseExistingElements_1D2D(Mesh_Algorithm): hyp.GetCopySourceMesh() == args[1], args[2] ) hyp = self.Hypothesis("ImportSource2D", [groups, toCopyMesh, toCopyGroups], UseExisting=UseExisting, CompareMethod=compFun, toAdd=False) + if groups and isinstance( groups, SMESH._objref_SMESH_GroupBase ): + groups = [groups] hyp.SetSourceFaces(groups) hyp.SetCopySourceMesh(toCopyMesh, toCopyGroups) self.mesh.AddHypothesis(hyp, self.geom) diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index 22ea69d83..0dc3b25f0 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -1680,9 +1680,10 @@ class Mesh: if self.mesh.HasShapeToMesh(): hyp_type = hyp.GetName() lib_name = hyp.GetLibName() - checkAll = ( not geom.IsSame( self.mesh.GetShapeToMesh() )) - if checkAll and geom: - checkAll = geom.GetType() == 37 + # checkAll = ( not geom.IsSame( self.mesh.GetShapeToMesh() )) + # if checkAll and geom: + # checkAll = geom.GetType() == 37 + checkAll = False isApplicable = self.smeshpyD.IsApplicable(hyp_type, lib_name, geom, checkAll) if isApplicable: AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName()) -- 2.39.2