X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHUtils%2FSMESH_MeshAlgos.cxx;h=9f0c88e20e9c849f9e1efe4dc7c1c24ea94853f7;hp=db6f5e690b5eb2d33490c7ddcbe316e7da973ef3;hb=b09372829929f8f561495d6c16527134971a1909;hpb=6bc94c22113c7133067ebd33f85ccb437b3c3fe0 diff --git a/src/SMESHUtils/SMESH_MeshAlgos.cxx b/src/SMESHUtils/SMESH_MeshAlgos.cxx index db6f5e690..9f0c88e20 100644 --- a/src/SMESHUtils/SMESH_MeshAlgos.cxx +++ b/src/SMESHUtils/SMESH_MeshAlgos.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -281,7 +281,7 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint() double tolerance) :SMESH_Octree( new LimitAndPool() ) { - int nbElems = mesh.GetMeshInfo().NbElements( elemType ); + smIdType nbElems = mesh.GetMeshInfo().NbElements( elemType ); _elements.reserve( nbElems ); TElementBoxPool& elBoPool = getLimitAndPool()->_elBoPool; @@ -546,7 +546,8 @@ struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher { delete _ebbTree[i]; _ebbTree[i] = NULL; } - if ( _nodeSearcher ) delete _nodeSearcher; _nodeSearcher = 0; + if ( _nodeSearcher ) delete _nodeSearcher; + _nodeSearcher = 0; } virtual int FindElementsByPoint(const gp_Pnt& point, SMDSAbs_ElementType type, @@ -687,6 +688,9 @@ bool SMESH_ElementSearcherImpl::getIntersParamOnLine(const gp_Lin& lin GC_MakeSegment edge( SMESH_TNodeXYZ( face->GetNode( i )), SMESH_TNodeXYZ( face->GetNode( (i+1)%nbNodes) )); anExtCC.Init( lineCurve, edge.Value() ); + if ( !anExtCC.Extrema().IsDone() || + anExtCC.Extrema().IsParallel() ) + continue; if ( anExtCC.NbExtrema() > 0 && anExtCC.LowerDistance() <= tol) { Standard_Real pl, pe; @@ -1673,7 +1677,7 @@ double SMESH_MeshAlgos::GetDistance( const SMDS_MeshFace* face, try { tgtCS = gp_Ax3( xyz[0], OZ, OX ); } - catch ( Standard_Failure ) { + catch ( Standard_Failure& ) { return badDistance; } trsf.SetTransformation( tgtCS ); @@ -1980,7 +1984,11 @@ SMESH_MeshAlgos::FindSharpEdges( SMDS_Mesh* theMesh, typedef std::pair< bool, const SMDS_MeshNode* > TIsSharpAndMedium; typedef NCollection_DataMap< SMESH_TLink, TIsSharpAndMedium, SMESH_TLink > TLinkSharpMap; - TLinkSharpMap linkIsSharp( theMesh->NbFaces() ); + TLinkSharpMap linkIsSharp; + Standard_Integer nbBuckets = FromSmIdType( theMesh->NbFaces() ); + if ( nbBuckets > 0 ) + linkIsSharp.ReSize( nbBuckets ); + TIsSharpAndMedium sharpMedium( true, 0 ); bool & isSharp = sharpMedium.first; const SMDS_MeshNode* & nMedium = sharpMedium.second; @@ -2087,7 +2095,10 @@ SMESH_MeshAlgos::SeparateFacesByEdges( SMDS_Mesh* theMesh, const std::vector< Ed typedef std::vector< const SMDS_MeshElement* > TFaceVec; typedef NCollection_DataMap< SMESH_TLink, TFaceVec, SMESH_TLink > TFacesByLinks; - TFacesByLinks facesByLink( theMesh->NbFaces() ); + TFacesByLinks facesByLink; + Standard_Integer nbBuckets = FromSmIdType( theMesh->NbFaces() ); + if ( nbBuckets > 0 ) + facesByLink.ReSize( nbBuckets ); std::vector< const SMDS_MeshNode* > faceNodes; for ( SMDS_FaceIteratorPtr faceIt = theMesh->facesIterator(); faceIt->more(); )