From fbfd90a1f8a25f69c70500cbd14aca9b37c4bff6 Mon Sep 17 00:00:00 2001 From: Yoann Audouin Date: Mon, 3 Oct 2022 18:11:35 +0200 Subject: [PATCH] Adding number of thread to netgen hypo + windows corrections --- src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx | 3 --- .../NETGENPlugin_NETGEN_3D_Remote.cxx | 8 ++++---- .../NETGENPlugin_NETGEN_3D_SA.cxx | 5 +---- .../NETGENPlugin_NETGEN_3D_SA.hxx | 5 +---- src/NETGENPlugin/NETGENPlugin_Runner_main.cxx | 19 ++++++------------- 5 files changed, 12 insertions(+), 28 deletions(-) diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx index b256eab..dd20916 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx @@ -32,9 +32,6 @@ #include "NETGENPlugin_Hypothesis.hxx" -// TODO: remove use of netgen_param -#include "NETGENPlugin_DriverParam.hxx" - #include #include #include diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.cxx index bc81359..a50073c 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.cxx @@ -220,7 +220,6 @@ bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh& aMesh, fs::path param_file=tmp_folder / fs::path("netgen3d_param.txt"); fs::path log_file=tmp_folder / fs::path("run.log"); fs::path cmd_file=tmp_folder / fs::path("cmd.log"); - //TODO: Handle variable mesh_name std::string mesh_name = "MESH"; { @@ -239,20 +238,22 @@ bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh& aMesh, } // Calling run_mesher - // TODO: check if we need to handle the .exe for windows std::string cmd; fs::path run_mesher_exe = fs::path(std::getenv("NETGENPLUGIN_ROOT_DIR"))/ fs::path("bin")/ fs::path("salome")/ +#ifdef WIN32 + fs::path("NETGENPlugin_Runner.exe"); +#else fs::path("NETGENPlugin_Runner"); +#endif cmd = run_mesher_exe.string() + " NETGEN3D " + mesh_file.string() + " " + shape_file.string() + " " + param_file.string() + " " + element_orientation_file.string() + " " - + std::to_string(aMesh.GetMesherNbThreads()) + " " + new_element_file.string() + " " + "NONE"; // Writing command in log @@ -273,7 +274,6 @@ bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh& aMesh, arguments << shape_file.c_str(); arguments << param_file.c_str(); arguments << element_orientation_file.c_str(); - arguments << std::to_string(aMesh.GetMesherNbThreads()).c_str(); arguments << new_element_file.c_str(); arguments << "NONE"; QString out_file = log_file.c_str(); diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.cxx index 6dfc100..9d2bf43 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.cxx @@ -227,8 +227,7 @@ int NETGENPlugin_NETGEN_3D_SA::run(const std::string input_mesh_file, const std::string hypo_file, const std::string element_orientation_file, const std::string new_element_file, - const std::string output_mesh_file, - int nbThreads) + const std::string output_mesh_file) { _element_orientation_file = element_orientation_file; @@ -248,8 +247,6 @@ int NETGENPlugin_NETGEN_3D_SA::run(const std::string input_mesh_file, importNetgenParams(hypo_file, myParams); fillHyp(myParams, &gen); - // Setting number of threads for netgen - myParams.nbThreads = nbThreads; MESSAGE("Meshing with netgen3d"); int ret = Compute(myShape, *myMesh, myParams, diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.hxx index 36eb266..62e9059 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.hxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.hxx @@ -57,10 +57,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D_SA: public NETGENPlugin_NETGEN_ const std::string hypo_file, const std::string element_orientation_file, const std::string new_element_file, - const std::string output_mesh_file, - int nbThreads); - - + const std::string output_mesh_file); protected: diff --git a/src/NETGENPlugin/NETGENPlugin_Runner_main.cxx b/src/NETGENPlugin/NETGENPlugin_Runner_main.cxx index 8d2e11b..95cc741 100644 --- a/src/NETGENPlugin/NETGENPlugin_Runner_main.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Runner_main.cxx @@ -42,11 +42,11 @@ */ int main(int argc, char *argv[]){ - if(argc!=9||(argc==2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help")==0))){ - std::cout << "Error in number of arguments "<< argc<<" given expected 8" <> thing; @@ -82,18 +80,13 @@ int main(int argc, char *argv[]){ new_element_file = ""; if (mesher=="NETGEN3D"){ - auto begin = std::chrono::high_resolution_clock::now(); NETGENPlugin_NETGEN_3D_SA myplugin; myplugin.run(input_mesh_file, shape_file, hypo_file, element_orientation_file, new_element_file, - output_mesh_file, - nbThreads); - auto end = std::chrono::high_resolution_clock::now(); - auto elapsed = std::chrono::duration_cast(end - begin); - std::cout << "Time elapsed: " << elapsed.count()*1e-9 << std::endl; + output_mesh_file); } else { std::cerr << "Unknown mesher:" << mesher << std::endl; }