1 #ifndef COMMAND_LINE_INPUTS_HPP
2 #define COMMAND_LINE_INPUTS_HPP
16 std::string arg = argv[i+1];
19 int x = std::stoi(arg, &pos);
20 if (pos >= arg.size()) {
53 bool check(std::string input, std::string name, std::string explanation){
64 std::string msg =
"Available options are:\n";
65 for(
int j = 0; j <
options.size(); j++)
66 msg +=
"\t" +
options[j].name +
"\t" +
options[j].explanation +
"\n";
67 printf(
"%s", msg.c_str());
71 printf(
"ERROR: %s\n", msg.c_str());
90 for (
int i = 1; i < argc; ++i) {
91 std::string input = std::string(argv[i]);
94 if(
check(input,
"--test",
"Checks particles against reference data")){
97 if(
check(input,
"--update-test",
"Updates reference data used in particle test")){
100 if(
check(input,
"--moments-test",
"Checks moments against reference data")){
103 if(
check(input,
"--update-moments-test",
"Updates reference data used in moments test")){
106 if(
check(input,
"--debug",
"Activates extra barriered checkpoints and validity checks (not intended for production)")){
109 if(
check(input,
"--dryrun",
"Partially runs XGC setup to check for some common input errors")){
113 if(
check(input,
"-n_ranks",
"Optional input if using --dryrun: Specify the number of MPI ranks you plan to use")){
115 error(
"-n_ranks can only be used with --dryrun");
118 if(ierr!=0)
error(
"Expected integer after -n_ranks");
121 if(
check(input,
"--perf-barriers",
"Adds MPI barriers to top-level timers to help identify load imbalance")){
125 error(
"Unknown command line argument " + input);
Option
Definition: streamed_parallel_for.hpp:13