X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Mesh.cxx;h=94b1b7a72c22313edf9cb2d51fd369b3afac1de5;hp=73030e901a943a47e4012b9870bc435b4411c03d;hb=22463abfc977f33a756ce1d6398c840b7a8e3af2;hpb=53a2fb6d670a8c71eb30dfa339447a25cd728e80 diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 73030e901..94b1b7a72 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -237,6 +237,26 @@ bool SMESH_Mesh::MeshExists( int meshId ) const 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 @@ -1552,7 +1572,8 @@ void SMESH_Mesh::ExportSTL(const char * file, //================================================================================ void SMESH_Mesh::ExportCGNS(const char * file, - const SMESHDS_Mesh* meshDS) + const SMESHDS_Mesh* meshDS, + const char * meshName) { int res = Driver_Mesh::DRS_FAIL; #ifdef WITH_CGNS @@ -1560,6 +1581,8 @@ void SMESH_Mesh::ExportCGNS(const char * file, myWriter.SetFile( file ); myWriter.SetMesh( const_cast( meshDS )); myWriter.SetMeshName( SMESH_Comment("Mesh_") << meshDS->GetPersistentId()); + if ( meshName && meshName[0] ) + myWriter.SetMeshName( meshName ); res = myWriter.Perform(); #endif if ( res != Driver_Mesh::DRS_OK )