Salome HOME
updated copyright message
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPlugin_NETGEN_3D_Remote.cxx
index 16311c7212513e35a237a9d8979f350afeefab3b..ba04e35f8be88caaec6a9af004c34cb5d95ed104 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 #include <QString>
 #include <QProcess>
 
+#ifdef WIN32
+#include <filesystem>
+namespace fs = std::filesystem;
+#else
 #include <boost/filesystem.hpp>
 namespace fs = boost::filesystem;
+#endif
 
 /*
   Netgen include files
@@ -138,6 +143,7 @@ void NETGENPlugin_NETGEN_3D_Remote::fillParameters(const NETGENPlugin_Hypothesis
   // const char*
   aParams.meshsizefilename = hyp->GetMeshSizeFile();
   aParams.closeedgefac = 0;
+  aParams.nbThreads = 0;
 #endif
 }
 
@@ -226,10 +232,19 @@ bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh&         aMesh,
 
 
   // Temporary folder for run
-  fs::path tmp_folder = aMesh.tmp_folder / fs::unique_path(fs::path("Volume-%%%%-%%%%"));
+#ifdef WIN32
+  // On windows mesh does not have GetTmpFolder
+  fs::path tmp_folder = fs::path("Volume-%%%%-%%%%");
+#else
+  fs::path tmp_folder = aMesh.GetTmpFolder() / fs::unique_path(fs::path("Volume-%%%%-%%%%"));
+#endif
   fs::create_directories(tmp_folder);
   // Using MESH2D generated after all triangles where created.
-  fs::path mesh_file=aMesh.tmp_folder / fs::path("Mesh2D.med");
+#ifdef WIN32
+  fs::path mesh_file=fs::path("Mesh2D.med");
+#else
+  fs::path mesh_file=aMesh.GetTmpFolder() / fs::path("Mesh2D.med");
+#endif
   fs::path element_orientation_file=tmp_folder / fs::path("element_orientation.dat");
   fs::path new_element_file=tmp_folder / fs::path("new_elements.dat");
   fs::path tmp_mesh_file=tmp_folder / fs::path("tmp_mesh.med");
@@ -244,7 +259,7 @@ bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh&         aMesh,
   {
     SMESH_MeshLocker myLocker(&aMesh);
     //Writing Shape
-    exportShape(shape_file.string(), aShape);
+    SMESH_DriverShape::exportShape(shape_file.string(), aShape);
 
     //Writing hypo
     netgen_params aParams;
@@ -286,16 +301,16 @@ bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh&         aMesh,
 
 
   // Building arguments for QProcess
-  QString program = run_mesher_exe.c_str();
+  QString program = run_mesher_exe.string().c_str();
   QStringList arguments;
   arguments << "NETGEN3D";
-  arguments << mesh_file.c_str();
-  arguments << shape_file.c_str();
-  arguments << param_file.c_str();
-  arguments << element_orientation_file.c_str();
-  arguments << new_element_file.c_str();
+  arguments << mesh_file.string().c_str();
+  arguments << shape_file.string().c_str();
+  arguments << param_file.string().c_str();
+  arguments << element_orientation_file.string().c_str();
+  arguments << new_element_file.string().c_str();
   arguments << "NONE";
-  QString out_file = log_file.c_str();
+  QString out_file = log_file.string().c_str();
   QProcess myProcess;
   myProcess.setStandardOutputFile(out_file);