From: eap Date: Wed, 29 Apr 2020 16:54:39 +0000 (+0300) Subject: #19026 EDF 21355 - Problem with Belog to GEOM X-Git-Tag: V9_5_0b1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=54580d9a2a716c32a6d7772a3545811d9538cb96;p=modules%2Fsmesh.git #19026 EDF 21355 - Problem with Belog to GEOM --- diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index b3bd67a7d..fce25f698 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -35,6 +35,7 @@ #include "SMESH_MeshAlgos.hxx" #include "SMESH_OctreeNode.hxx" +#include #include #include @@ -4265,6 +4266,8 @@ private: bool isOutOfNone (const gp_Pnt& p) { return true; } bool isBox (const TopoDS_Shape& s); + TopoDS_Shape prepareSolid( const TopoDS_Shape& theSolid ); + bool (Classifier::* myIsOutFun)(const gp_Pnt& p); BRepClass3d_SolidClassifier* mySolidClfr; // ptr because of a run-time forbidden copy-constructor Bnd_B3d myBox; @@ -4524,11 +4527,17 @@ bool ElementsOnShape::IsSatisfy (const SMDS_MeshElement* elem) centerXYZ /= elem->NbNodes(); isSatisfy = false; if ( myOctree ) + { + myWorkClassifiers.clear(); + myOctree->GetClassifiersAtPoint( centerXYZ, myWorkClassifiers ); for ( size_t i = 0; i < myWorkClassifiers.size() && !isSatisfy; ++i ) isSatisfy = ! myWorkClassifiers[i]->IsOut( centerXYZ ); + } else + { for ( size_t i = 0; i < myClassifiers.size() && !isSatisfy; ++i ) isSatisfy = ! myClassifiers[i].IsOut( centerXYZ ); + } } return isSatisfy; @@ -4613,7 +4622,7 @@ void ElementsOnShape::Classifier::Init( const TopoDS_Shape& theShape, } else { - mySolidClfr = new BRepClass3d_SolidClassifier(theShape); + mySolidClfr = new BRepClass3d_SolidClassifier( prepareSolid( theShape )); myIsOutFun = & ElementsOnShape::Classifier::isOutOfSolid; } break; @@ -4692,6 +4701,25 @@ ElementsOnShape::Classifier::~Classifier() delete mySolidClfr; mySolidClfr = 0; } +TopoDS_Shape ElementsOnShape::Classifier::prepareSolid( const TopoDS_Shape& theSolid ) +{ + // try to limit tolerance of theSolid down to myTol (issue #19026) + + // check if tolerance of theSolid is more than myTol + bool tolIsOk = true; // max tolerance is at VERTEXes + for ( TopExp_Explorer exp( theSolid, TopAbs_VERTEX ); exp.More() && tolIsOk; exp.Next() ) + tolIsOk = ( myTol >= BRep_Tool::Tolerance( TopoDS::Vertex( exp.Current() ))); + if ( tolIsOk ) + return theSolid; + + // make a copy to prevent the original shape from changes + TopoDS_Shape resultShape = BRepBuilderAPI_Copy( theSolid ); + + if ( !GEOMUtils::FixShapeTolerance( resultShape, TopAbs_SHAPE, myTol )) + return theSolid; + return resultShape; +} + bool ElementsOnShape::Classifier::isOutOfSolid( const gp_Pnt& p ) { if ( isOutOfBox( p )) return true; diff --git a/src/SMESH/SMESH_subMesh.hxx b/src/SMESH/SMESH_subMesh.hxx index 23ec4ed56..03dd98e49 100644 --- a/src/SMESH/SMESH_subMesh.hxx +++ b/src/SMESH/SMESH_subMesh.hxx @@ -126,7 +126,7 @@ class SMESH_EXPORT SMESH_subMesh // ================================================================== /*! - * \brief Sets an event listener and its data to a submesh + * \brief Set an event listener and its data to a submesh * \param listener - the listener to store * \param data - the listener data to store * \param where - the submesh to store the listener and it's data diff --git a/src/SMESH/SMESH_subMeshEventListener.hxx b/src/SMESH/SMESH_subMeshEventListener.hxx index cadfdce71..dddc54d1a 100644 --- a/src/SMESH/SMESH_subMeshEventListener.hxx +++ b/src/SMESH/SMESH_subMeshEventListener.hxx @@ -92,7 +92,7 @@ struct SMESH_subMeshEventListenerData !! they are used to track intermesh dependencies at mesh loading as well !! */ public: - SMESH_subMeshEventListenerData(bool isDeletable):myIsDeletable(isDeletable) {} + SMESH_subMeshEventListenerData(bool isDeletable):myIsDeletable(isDeletable),myType(-1) {} virtual ~SMESH_subMeshEventListenerData() {} bool IsDeletable() const { return myIsDeletable; } diff --git a/src/StdMeshers/StdMeshers_FaceSide.cxx b/src/StdMeshers/StdMeshers_FaceSide.cxx index 2fc28f15b..da593c9c3 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.cxx +++ b/src/StdMeshers/StdMeshers_FaceSide.cxx @@ -450,6 +450,7 @@ const std::vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXCons for ( size_t j = 0; j < u2nodeVec.size(); ++j ) u2node.insert( u2node.end(), u2nodeVec[j] ); } + continue; } // loop on myEdge's // Add 2nd VERTEX node for a last EDGE