Salome HOME
#BOS 37851: cast tuple types for compilation on FD38
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPlugin_Runner_main.cxx
index e4c20a2af888d6d1530d0bb8b13c5c4233bc60d6..b31235bf95bf3dbc699280cd91ab7be7d9cef8a7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -25,8 +25,7 @@
 //  Module : NETGEN
 //
 
-
-#include "NETGENPlugin_Runner.hxx"
+#include "NETGENPlugin_NETGEN_3D_SA.hxx"
 
 #include <stdio.h>
 #include <string.h>
  */
 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;
@@ -58,19 +57,17 @@ int main(int argc, char *argv[]){
     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;
+    return 1;
   }
   std::string mesher=argv[1];
   std::string input_mesh_file=argv[2];
   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;
@@ -83,19 +80,8 @@ int main(int argc, char *argv[]){
     new_element_file = "";
 
   if (mesher=="NETGEN3D"){
-    auto begin = std::chrono::high_resolution_clock::now();
-    netgen3d(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;
-  } else if (mesher=="NETGEN2D"){
-    netgen2d(input_mesh_file,
+    NETGENPlugin_NETGEN_3D_SA myplugin;
+    myplugin.run(input_mesh_file,
              shape_file,
              hypo_file,
              element_orientation_file,
@@ -103,6 +89,7 @@ int main(int argc, char *argv[]){
              output_mesh_file);
   } else {
     std::cerr << "Unknown mesher:" << mesher << std::endl;
+    return 1;
   }
   return 0;
 }