From 3a69b3ea0f5145d86ac13cd132d91b202999a02e Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 19 Aug 2010 09:19:49 +0000 Subject: [PATCH] 0020958: EDF 1529 SMESH : If some faces have been meshed with small quadrangles Netgen 3D creates pyramids with volume zero and fails struct SMESH_ElementSearcher { + /*! + * \brief Return elements possibly intersecting the line + */ + virtual void GetElementsNearLine( const gp_Ax1& line, + SMDSAbs_ElementType type, + std::vector< const SMDS_MeshElement* >& foundElems)=0; --- src/SMESH/SMESH_MeshEditor.cxx | 25 ++++++++++++++++++++++++- src/SMESH/SMESH_MeshEditor.hxx | 11 +++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 8d9f81972..a4772e2da 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -6271,6 +6271,9 @@ struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher vector< const SMDS_MeshElement* >& foundElements); virtual TopAbs_State GetPointState(const gp_Pnt& point); + void GetElementsNearLine( const gp_Ax1& line, + SMDSAbs_ElementType type, + vector< const SMDS_MeshElement* >& foundElems); double getTolerance(); bool getIntersParamOnLine(const gp_Lin& line, const SMDS_MeshElement* face, const double tolerance, double & param); @@ -6279,7 +6282,7 @@ struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher { return _outerFaces.empty() || _outerFaces.count(face); } - struct TInters //!< data of intersection of the line and the mesh face used in GetPointState() + struct TInters //!< data of intersection of the line and the mesh face (used in GetPointState()) { const SMDS_MeshElement* _face; gp_Vec _faceNorm; @@ -6780,6 +6783,26 @@ TopAbs_State SMESH_ElementSearcherImpl::GetPointState(const gp_Pnt& point) return TopAbs_UNKNOWN; } +//======================================================================= +/*! + * \brief Return elements possibly intersecting the line + */ +//======================================================================= + +void SMESH_ElementSearcherImpl::GetElementsNearLine( const gp_Ax1& line, + SMDSAbs_ElementType type, + vector< const SMDS_MeshElement* >& foundElems) +{ + if ( !_ebbTree || _elementType != type ) + { + if ( _ebbTree ) delete _ebbTree; + _ebbTree = new ElementBndBoxTree( *_mesh, _elementType = type ); + } + TIDSortedElemSet suspectFaces; // elements possibly intersecting the line + _ebbTree->getElementsNearLine( line, suspectFaces ); + foundElems.assign( suspectFaces.begin(), suspectFaces.end()); +} + //======================================================================= /*! * \brief Return SMESH_ElementSearcher diff --git a/src/SMESH/SMESH_MeshEditor.hxx b/src/SMESH/SMESH_MeshEditor.hxx index ee8703ecc..10f5be34a 100644 --- a/src/SMESH/SMESH_MeshEditor.hxx +++ b/src/SMESH/SMESH_MeshEditor.hxx @@ -92,6 +92,13 @@ struct SMESH_ElementSearcher std::vector< const SMDS_MeshElement* >& foundElems)=0; virtual TopAbs_State GetPointState(const gp_Pnt& point) = 0; + + /*! + * \brief Return elements possibly intersecting the line + */ + virtual void GetElementsNearLine( const gp_Ax1& line, + SMDSAbs_ElementType type, + std::vector< const SMDS_MeshElement* >& foundElems)=0; }; //======================================================================= @@ -408,12 +415,12 @@ public: // Search among theNodes or in the whole mesh if theNodes is empty. /*! - * \brief Return SMESH_NodeSearcher + * \brief Return SMESH_NodeSearcher. The caller is responsible for deleteing it */ SMESH_NodeSearcher* GetNodeSearcher(); /*! - * \brief Return SMESH_ElementSearcher + * \brief Return SMESH_ElementSearcher. The caller is responsible for deleteing it */ SMESH_ElementSearcher* GetElementSearcher(); /*! -- 2.30.2