#include "NETGENPlugin_Hypothesis.hxx"
-// TODO: remove use of netgen_param
-#include "NETGENPlugin_DriverParam.hxx"
-
#include <SMDS_MeshElement.hxx>
#include <SMDS_MeshNode.hxx>
#include <SMESHDS_Mesh.hxx>
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";
{
}
// 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
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();
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;
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,
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:
*/
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" <<std::endl;
+ if(argc!=8||(argc==2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help")==0))){
+ std::cout << "Error in number of arguments "<< argc-1<<" given expected 7" <<std::endl;
std::cout << "Syntax:"<<std::endl;
std::cout << "run_mesher MESHER INPUT_MESH_FILE SHAPE_FILE HYPO_FILE" << std::endl;
- std::cout << " ELEM_ORIENT_FILE NB_THREADS" << std::endl;
+ std::cout << " ELEM_ORIENT_FILE " << std::endl;
std::cout << " NEW_ELEMENT_FILE OUTPUT_MESH_FILE" << std::endl;
std::cout << std::endl;
std::cout << " Set argument to NONE to ignore them " << std::endl;
std::cout << " SHAPE_FILE: STEP file containing the shape to mesh" << std::endl;
std::cout << " HYPO_FILE: Ascii file containint the list of parameters" << std::endl;
std::cout << " (optional) ELEM_ORIENT_FILE: binary file containing the list of element from INPUT_MESH_FILE associated to the shape and their orientation" << std::endl;
- std::cout << " NB_THREADS: Number of thread to use for the mesher" << std::endl;
std::cout << " (optional) NEW_ELEMENT_FILE: (out) contains elements and nodes added by the meshing" << std::endl;
std::cout << " (optional) OUTPUT_MESH_FILE: (out) MED File containing the mesh after the run of the mesher" << std::endl;
return 0;
std::string shape_file=argv[3];
std::string hypo_file=argv[4];
std::string element_orientation_file=argv[5];
- int nbThreads=std::stoi(argv[6]);
- std::string new_element_file=argv[7];
- std::string output_mesh_file=argv[8];
+ std::string new_element_file=argv[6];
+ std::string output_mesh_file=argv[7];
//std::string thing;
//std::cin >> thing;
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<std::chrono::nanoseconds>(end - begin);
- std::cout << "Time elapsed: " << elapsed.count()*1e-9 << std::endl;
+ output_mesh_file);
} else {
std::cerr << "Unknown mesher:" << mesher << std::endl;
}