From: eap Date: Wed, 3 May 2006 15:06:18 +0000 (+0000) Subject: add GetNodeIndex() X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=69ddeca946672b13e84f32cdd05a590a403c04ab;p=modules%2Fsmesh.git add GetNodeIndex() --- diff --git a/src/SMDS/SMDS_MeshElement.cxx b/src/SMDS/SMDS_MeshElement.cxx index 83f073fdb..fa15e0e5f 100644 --- a/src/SMDS/SMDS_MeshElement.cxx +++ b/src/SMDS/SMDS_MeshElement.cxx @@ -218,3 +218,20 @@ bool SMDS_MeshElement::IsMediumNode(const SMDS_MeshNode* node) const { return false; } + +//================================================================================ + /*! + * \brief Check if a node belongs to the element + * \param node - the node to check + * \retval int - node index within the element, -1 if not found + */ +//================================================================================ + +int SMDS_MeshElement::GetNodeIndex( const SMDS_MeshNode* node ) const +{ + SMDS_ElemIteratorPtr nIt = nodesIterator(); + for ( int i = 0; nIt->more(); ++i ) + if ( nIt->next() == node ) + return i; + return -1; +} diff --git a/src/SMDS/SMDS_MeshElement.hxx b/src/SMDS/SMDS_MeshElement.hxx index 67ac8f247..794c352f5 100644 --- a/src/SMDS/SMDS_MeshElement.hxx +++ b/src/SMDS/SMDS_MeshElement.hxx @@ -108,6 +108,13 @@ public: return ind; } + /*! + * \brief Check if a node belongs to the element + * \param node - the node to check + * \retval int - node index within the element, -1 if not found + */ + int GetNodeIndex( const SMDS_MeshNode* node ) const; + protected: SMDS_MeshElement(int ID=-1); virtual void Print(std::ostream & OS) const;