-///////////////////////////////////////////////////////////////////////////////
-/// Create an iterator which iterate on nodes owned by the element.
-/// This method call elementsIterator().
-///////////////////////////////////////////////////////////////////////////////
-SMDS_ElemIteratorPtr SMDS_MeshElement::nodesIterator() const
-{
- return elementsIterator(SMDSAbs_Node);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// Create an iterator which iterate on edges linked with or owned by the element.
-/// This method call elementsIterator().
-///////////////////////////////////////////////////////////////////////////////
-SMDS_ElemIteratorPtr SMDS_MeshElement::edgesIterator() const
-{
- return elementsIterator(SMDSAbs_Edge);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// Create an iterator which iterate on faces linked with or owned by the element.
-/// This method call elementsIterator().
-///////////////////////////////////////////////////////////////////////////////
-SMDS_ElemIteratorPtr SMDS_MeshElement::facesIterator() const
-{
- return elementsIterator(SMDSAbs_Face);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-///Return The number of nodes owned by the current element
-///////////////////////////////////////////////////////////////////////////////
-int SMDS_MeshElement::NbNodes() const
-{
- int nbnodes=0;
- SMDS_ElemIteratorPtr it=nodesIterator();
- while(it->more())
- {
- it->next();
- nbnodes++;
- }
- return nbnodes;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-///Return the number of edges owned by or linked with the current element
-///////////////////////////////////////////////////////////////////////////////
-int SMDS_MeshElement::NbEdges() const
-{
- int nbedges=0;
- SMDS_ElemIteratorPtr it=edgesIterator();
- while(it->more())
- {
- it->next();
- nbedges++;
- }
- return nbedges;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-///Return the number of faces owned by or linked with the current element
-///////////////////////////////////////////////////////////////////////////////
-int SMDS_MeshElement::NbFaces() const
-{
- int nbfaces=0;
- SMDS_ElemIteratorPtr it=facesIterator();
- while(it->more())
- {
- it->next();
- nbfaces++;
- }
- return nbfaces;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-///Create an iterator which iterate on elements linked with the current element.
-///@param type The of elements on which you want to iterate
-///@return A smart pointer to iterator, you are not to take care of freeing memory
-///////////////////////////////////////////////////////////////////////////////
-class SMDS_MeshElement_MyIterator:public SMDS_ElemIterator
-{
- const SMDS_MeshElement * myElement;
- bool myMore;
- public:
- SMDS_MeshElement_MyIterator(const SMDS_MeshElement * element):
- myElement(element),myMore(true) {}
-
- bool more()
- {
- return myMore;
- }
-
- const SMDS_MeshElement* next()
- {
- myMore=false;
- return myElement;
- }
-};
-SMDS_ElemIteratorPtr SMDS_MeshElement::
- elementsIterator(SMDSAbs_ElementType type) const
-{
- /** @todo Check that iterator in the child classes return elements
- in the same order for each different implementation (i.e: SMDS_VolumeOfNodes
- and SMDS_VolumeOfFaces */
-
- if(type==GetType())
- return SMDS_ElemIteratorPtr(new SMDS_MeshElement_MyIterator(this));
- else
- {
- MESSAGE("Iterator not implemented");
- return SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL);
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-///Return the ID of the element
-///////////////////////////////////////////////////////////////////////////////
+//================================================================================
+/*!
+ * \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;
+}
+
+//================================================================================
+/*!
+ * \brief Return ID of an element
+ */
+//================================================================================
+