Compadre  1.5.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CommandLineProcessor.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Compadre: COMpatible PArticle Discretization and REmap Toolkit
4 //
5 // Copyright 2018 NTESS and the Compadre contributors.
6 // SPDX-License-Identifier: BSD-2-Clause
7 // *****************************************************************************
8 // @HEADER
9 #ifndef COMMANDLINEPROCESSOR
10 #define COMMANDLINEPROCESSOR
11 
13 
16 
17  CommandLineProcessor(int argc, char* args[], const bool print=true) {
18 
19  order = 2;
20  dimension = 3;
21  number_target_coords = 200;
23  number_of_batches = 1;
24 
25  constraint_name = "NO_CONSTRAINT"; // "NEUMANN_GRAD_SCALAR"
26  solver_name = "QR"; // LU
27  problem_name = "STANDARD"; // MANIFOLD
28 
29  for (int i = 1; i < argc; ++i) {
30  if (i + 1 < argc) { // not at end
31  if (std::string(args[i]) == "--p") {
32  order = atoi(args[i+1]);
33  } else if (std::string(args[i]) == "--d") {
34  dimension = atoi(args[i+1]);
35  } else if (std::string(args[i]) == "--nt") {
36  number_target_coords = atoi(args[i+1]);
37  } else if (std::string(args[i]) == "--ns") {
38  number_source_coords = atoi(args[i+1]);
39  } else if (std::string(args[i]) == "--nb") {
40  number_of_batches = atoi(args[i+1]);
41  } else if (std::string(args[i]) == "--solver") {
42  solver_name = std::string(args[i+1]);
43  } else if (std::string(args[i]) == "--problem") {
44  problem_name = std::string(args[i+1]);
45  } else if (std::string(args[i]) == "--constraint") {
46  constraint_name = std::string(args[i+1]);
47  }
48  }
49  }
50 
51  if (print) {
52  std::cout << "************************************************************************" << std::endl;
53  std::cout << "order: " << order << ", dimension: " << dimension << ", number_target_coords: " << number_target_coords << std::endl;
54  std::cout << "solver: " << solver_name << ", problem: " << problem_name << ", constraint: " << constraint_name << std::endl;
55  std::cout << "************************************************************************" << std::endl;
56 
57  }
58  }
59 };
60 
61 #endif
CommandLineProcessor(int argc, char *args[], const bool print=true)