Salome HOME
23092: EDF 10836 SMESH: UseExisting2DElements fails when geometry contains more than...
[modules/smesh.git] / src / SMESH / SMESH_Mesh.cxx
index 49446080fa25794004ca7f9c81952eedf4b3d7e6..94b1b7a72c22313edf9cb2d51fd369b3afac1de5 100644 (file)
@@ -237,6 +237,26 @@ bool SMESH_Mesh::MeshExists( int meshId ) const
   return _myDocument ? bool( _myDocument->GetMesh( meshId )) : false;
 }
 
   return _myDocument ? bool( _myDocument->GetMesh( meshId )) : false;
 }
 
+//================================================================================
+/*!
+ * \brief Return a mesh by id
+ */
+//================================================================================
+
+SMESH_Mesh* SMESH_Mesh::FindMesh( int meshId ) const
+{
+  if ( _id == meshId )
+    return (SMESH_Mesh*) this;
+
+  if ( StudyContextStruct *aStudyContext = _gen->GetStudyContext( _studyId ))
+  {
+    std::map < int, SMESH_Mesh * >::iterator i_m = aStudyContext->mapMesh.find( meshId );
+    if ( i_m != aStudyContext->mapMesh.end() )
+      return i_m->second;
+  }
+  return NULL;
+}
+
 //=============================================================================
 /*!
  * \brief Set geometry to be meshed
 //=============================================================================
 /*!
  * \brief Set geometry to be meshed