Salome HOME
Implement Cancel Compute (end)
[modules/smesh.git] / src / SMESH / SMESH_Hypothesis.cxx
index 8210f156d498f34e1334d1e9c44f9450aea8a4de..dca74e5d1dd4697e0e24eb46fb761797a8ef553d 100644 (file)
@@ -24,6 +24,7 @@
 //  File   : SMESH_Hypothesis.cxx
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
+//  $Header$
 //
 #include "SMESH_Hypothesis.hxx"
 #include "SMESH_Gen.hxx"
@@ -151,6 +152,24 @@ void SMESH_Hypothesis::SetLibName(const char* theLibName)
   _libName = string(theLibName);
 }
 
+//=======================================================================
+//function : GetMeshByPersistentID
+//purpose  : Find a mesh with given persistent ID
+//=======================================================================
+
+SMESH_Mesh* SMESH_Hypothesis::GetMeshByPersistentID(int id)
+{
+  StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
+  map<int, SMESH_Mesh*>::iterator itm = itm = myStudyContext->mapMesh.begin();
+  for ( ; itm != myStudyContext->mapMesh.end(); itm++)
+  {
+    SMESH_Mesh* mesh = (*itm).second;
+    if ( mesh->GetMeshDS()->GetPersistentId() == id )
+      return mesh;
+  }
+  return 0;
+}
+
 //=============================================================================
 /*!
  *