diff --git a/src/SMESH/SMESH_DriverMesh.cxx b/src/SMESH/SMESH_DriverMesh.cxx index 2c01523d4..470278e93 100644 --- a/src/SMESH/SMESH_DriverMesh.cxx +++ b/src/SMESH/SMESH_DriverMesh.cxx @@ -52,6 +52,12 @@ bool diffMEDFile(const std::string mesh_file1, const std::string mesh_file2, con return m0_1->isEqual(m0_2, 1e-12); } +std::string getMeshName(std::string mesh_file){ + std::unique_ptr myMedMesh=MEDFileUMesh::New(mesh_file); + + return myMedMesh->getLevel0Mesh()->getName(); +} + /** * @brief Import a mesh from a mesh file (MED) into a SMESH_Mesh object * @@ -61,9 +67,10 @@ bool diffMEDFile(const std::string mesh_file1, const std::string mesh_file2, con * * @return error code */ -int importMesh(const std::string mesh_file, SMESH_Mesh& aMesh, const std::string mesh_name){ +int importMesh(const std::string mesh_file, SMESH_Mesh& aMesh){ // TODO: change that as it depends on the language - std::cout << "Importing mesh from " << mesh_file << std::endl; + std::string mesh_name = getMeshName(mesh_file); + std::cout << "Importing mesh from " << mesh_file << " mesh " << mesh_name2 << std::endl; int ret = aMesh.MEDToMesh(mesh_file.c_str(), mesh_name.c_str()); return ret; } diff --git a/src/SMESH/SMESH_DriverMesh.hxx b/src/SMESH/SMESH_DriverMesh.hxx index eaf2ed18b..370f99515 100644 --- a/src/SMESH/SMESH_DriverMesh.hxx +++ b/src/SMESH/SMESH_DriverMesh.hxx @@ -37,8 +37,7 @@ bool diffMEDFile(const std::string mesh_file1, const std::string mesh_file2, const std::string mesh_name); int importMesh(const std::string mesh_file, - SMESH_Mesh& aMesh, - const std::string meshName); + SMESH_Mesh& aMesh); int exportMesh(const std::string mesh_file, SMESH_Mesh& aMesh, const std::string meshName); diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 556ef145e..4aae8db4e 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -291,8 +291,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, if(file_name != "") { fs::path mesh_file = fs::path(aMesh.tmp_folder) / fs::path(file_name); - // TODO: change mesh name - exportMesh(mesh_file.string(), aMesh, "Maillage_1"); + exportMesh(mesh_file.string(), aMesh, "MESH"); } //Resetting threaded pool info