6#include <deal.II/base/mpi.h>
10#include <prismspf/config.h>
29 for (
int i = 1; i <
argc; ++i)
31 tokens.emplace_back(argv[i]);
41#ifdef PRISMS_PF_WITH_CALIPER
50 throw std::runtime_error(
51 "Too many command line arguments. The arguments should specify "
52 "the input file name and caliper configurations, if applicable. For example, "
53 "`./main -i parameters.prm`");
57 std::string parameters_filename =
"parameters.prm";
61 throw std::runtime_error(
62 "Invalid command line option. Use `-i` to specify the input file, "
63 "e.g., `./main -i parameters.prm`.");
73 if (parameters_filename.size() < 4 ||
74 parameters_filename.substr(parameters_filename.size() - 4) !=
".prm")
76 throw std::runtime_error(
"The input file must have the `.prm` extension. Please "
77 "rename the file accordingly.");
81 const std::ifstream ifs_prm(parameters_filename);
84 throw std::runtime_error(
"The specified parameters file `" + parameters_filename +
90 <<
"Using the input parameter file: " << parameters_filename <<
"\n";
92 return parameters_filename;
95#ifdef PRISMS_PF_WITH_CALIPER
97 get_caliper_configuration()
100 const int n_args = 5;
105 throw std::runtime_error(
106 "Too many command line arguments. The arguments should specify "
107 "the input file name and caliper configurations, if applicable. For example, "
108 "`./main -i parameters.prm -P runtime-report`");
112 std::string config =
"runtime-report,mem.highwatermark";
116 throw std::runtime_error(
117 "Invalid command line option. Use `-P` to specify caliper configurations, "
118 "e.g., `./main -P runtime-report`.");
129 <<
"Using the caliper configuration: " << config <<
"\n";
139 [[nodiscard]]
const std::string &
142 auto itr = std::ranges::find(
tokens, option);
151 static const std::string empty_string;
158 return std::ranges::find(
tokens, option) !=
tokens.end();
162PRISMS_PF_END_NAMESPACE
static dealii::ConditionalOStream & pout_base()
Generic parallel output stream. Used for essential information in release and debug mode.
Definition conditional_ostreams.cc:43
std::vector< std::string > tokens
Definition parse_cmd_options.h:137
ParseCMDOptions(int &_argc, char **argv)
Definition parse_cmd_options.h:26
const std::string & get_cmd_option(const std::string &option) const
Definition parse_cmd_options.h:140
int argc
Definition parse_cmd_options.h:136
bool cmd_option_exists(const std::string &option) const
Definition parse_cmd_options.h:156
std::string get_parameters_filename()
Definition parse_cmd_options.h:38
Definition conditional_ostreams.cc:20