Removing hard coded meshname from Mesh import

This commit is contained in:
Yoann Audouin 2022-09-21 15:26:33 +02:00
parent 45f8178054
commit cc3662690d
3 changed files with 11 additions and 6 deletions

View File

@ -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<MEDFileUMesh> 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;
}

View File

@ -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);

View File

@ -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