From bc9732c239da7261de6f236b744834d33404fc51 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 28 Feb 2007 09:13:32 +0000 Subject: [PATCH] PAL13460 (force the mesh to go through a point) add SMDSAbs_ElementType arg to NbInverseNodes() --- src/SMDS/SMDS_MeshNode.cxx | 18 ++++++++++++++++++ src/SMDS/SMDS_MeshNode.hxx | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) 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; -- 2.39.2