- for (;itLstInvCnx.More();itLstInvCnx.Next()) {
- Handle(SMDS_MeshElement)& ME = itLstInvCnx.Value();
- if (ME->IsSame(parent))
- myInverseElements.Remove(itLstInvCnx);
- if (!itLstInvCnx.More())
- break;
+ bool more()
+ {
+ return ( myIter < myCellList.size() );
+ }
+
+ const SMDS_MeshElement* next()
+ {
+ int vtkId = myCellList[ myIter++ ];
+ int smdsId = myMesh->FromVtkToSmds( vtkId );
+ const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
+ if (!elem)
+ {
+ MESSAGE("InverseIterator problem Null element");
+ throw SALOME_Exception("InverseIterator problem Null element");
+ }
+ return elem;
+ }
+ };
+
+ //=======================================================================
+ /*!
+ * \brief Iterator on a node
+ */
+ //=======================================================================
+
+ template< class ELEM_ITERATOR >
+ struct Iterator : public ELEM_ITERATOR
+ {
+ typedef typename ELEM_ITERATOR::value_type element_type;
+ const SMDS_MeshNode* myNode;
+
+ Iterator( const SMDS_MeshNode* n ): myNode( n ) {}
+
+ virtual bool more()
+ {
+ return myNode;
+ }
+ virtual element_type next()
+ {
+ element_type res = static_cast<element_type>( myNode );
+ myNode = 0;
+ return res;
+ }
+ };
+}
+
+SMDS_ElemIteratorPtr SMDS_MeshNode::GetInverseElementIterator(SMDSAbs_ElementType type) const
+{
+ if ( GetMesh()->NbElements() > 0 ) // avoid building links
+ {
+ vtkCellLinks::Link& l = getGrid()->GetLinks()->GetLink( GetVtkID() );
+ return boost::make_shared< InverseIterator >( GetMesh(), l.cells, l.ncells, type );
+ }
+ else
+ {
+ return boost::make_shared< InverseIterator >();