diff --git a/src/SMDS/SMDS_MeshNode.cxx b/src/SMDS/SMDS_MeshNode.cxx index e4b551912..b7a1cb117 100644 --- a/src/SMDS/SMDS_MeshNode.cxx +++ b/src/SMDS/SMDS_MeshNode.cxx @@ -240,6 +240,24 @@ bool SMDS_MeshNode::emptyInverseElements() return myInverseElements.IsEmpty() != Standard_False; } +//================================================================================ +/*! + * \brief Count inverse elements of given type + */ +//================================================================================ + +int SMDS_MeshNode::NbInverseNodes(SMDSAbs_ElementType type) const +{ + if ( type == SMDSAbs_All ) + return myInverseElements.Extent(); + int nb = 0; + NCollection_List::Iterator it( myInverseElements ); + for ( ; it.More(); it.Next() ) + if ( it.Value()->GetType() == type ) + nb++; + return nb; +} + /////////////////////////////////////////////////////////////////////////////// /// To be used with STL set /////////////////////////////////////////////////////////////////////////////// diff --git a/src/SMDS/SMDS_MeshNode.hxx b/src/SMDS/SMDS_MeshNode.hxx index 0da589b4d..10c1499cc 100644 --- a/src/SMDS/SMDS_MeshNode.hxx +++ b/src/SMDS/SMDS_MeshNode.hxx @@ -57,7 +57,7 @@ class SMDS_WNT_EXPORT SMDS_MeshNode:public SMDS_MeshElement void ClearInverseElements(); bool emptyInverseElements(); SMDS_ElemIteratorPtr GetInverseElementIterator(SMDSAbs_ElementType type=SMDSAbs_All) const; - int NbInverseNodes() const { return myInverseElements.Extent(); } + int NbInverseNodes(SMDSAbs_ElementType type=SMDSAbs_All) const; void SetPosition(const SMDS_PositionPtr& aPos); const SMDS_PositionPtr& GetPosition() const; SMDSAbs_ElementType GetType() const;