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()) {
50 bool check(std::string input, std::string name, std::string explanation){
61 std::string msg =
"Available options are:\n";
62 for(
int j = 0; j <
options.size(); j++)
63 msg +=
"\t" +
options[j].name +
"\t" +
options[j].explanation +
"\n";
64 printf(
"%s", msg.c_str());
68 printf(
"ERROR: %s\n", msg.c_str());
84 for (
int i = 1; i < argc; ++i) {
85 std::string input = std::string(argv[i]);
88 if(
check(input,
"--test",
"Checks particles against reference data")){
91 if(
check(input,
"--update-test",
"Updates reference data used in particle test")){
94 if(
check(input,
"--debug",
"Activates extra barriered checkpoints and validity checks (not intended for production)")){
97 if(
check(input,
"--dryrun",
"Partially runs XGC setup to check for some common input errors")){
101 if(
check(input,
"-n_ranks",
"Optional input if using --dryrun: Specify the number of MPI ranks you plan to use")){
103 error(
"-n_ranks can only be used with --dryrun");
106 if(ierr!=0)
error(
"Expected integer after -n_ranks");
110 error(
"Unknown command line argument " + input);
Option
Definition: streamed_parallel_for.hpp:13