Salome HOME
Merge from V7_main
[modules/smesh.git] / src / SMDS / SMDS_VtkFace.cxx
index 56787bda0c232b07520ca874f95269b23a248763..3d5e82fee2ebf71788e16dc1d2d088ec9cc140ec 100644 (file)
@@ -161,6 +161,22 @@ SMDS_VtkFace::GetNode(const int ind) const
   return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ 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 SMDS_VtkFace::GetNodeIndex( const SMDS_MeshNode* node ) const
+{
+  vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+  vtkIdType npts, *pts;
+  grid->GetCellPoints( this->myVtkID, npts, pts );
+  for ( vtkIdType i = 0; i < npts; ++i )
+    if ( pts[i] == node->getVtkId() )
+      return i;
+  return -1;
+}
+
 bool SMDS_VtkFace::IsQuadratic() const
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();