+using namespace std;
+
+namespace SMESH{
+ SMESH::SMESH_Mesh_var InitMesh(GEOM::GEOM_Object_ptr theShapeObject,
+ const char* theMeshName)
+ {
+ SMESH::SMESH_Mesh_var aMesh;
+ try {
+ SMESH::SMESH_Gen_var aSMESHGen = SMESH::GetSMESHGen();
+ if ( !aSMESHGen->_is_nil() && !theShapeObject->_is_nil() ) {
+ aMesh = aSMESHGen->CreateMesh( theShapeObject );
+ if ( !aMesh->_is_nil() ) {
+ SALOMEDS::SObject_var aMeshSObject = SMESH::FindSObject( aMesh.in() );
+ SMESH::SetName( aMeshSObject, theMeshName );
+ }
+ }
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {
+ QtCatchCorbaException( S_ex );
+ }
+ return aMesh._retn();
+ }
+}
+