Skip to content
Snippets Groups Projects
Commit 2f554f12 authored by Sam Yates's avatar Sam Yates Committed by Alexander Peyser
Browse files

Restore option summary output to miniapp. (#264)

Fixes #263.

* Add 'verbose' field to command line option struct, set with '-v'.
* If verbose flag is true, emit option summary to stdout.
parent 2b2f89c4
No related branches found
No related tags found
No related merge requests found
...@@ -183,10 +183,16 @@ cl_options read_options(int argc, char** argv, bool allow_write) { ...@@ -183,10 +183,16 @@ cl_options read_options(int argc, char** argv, bool allow_write) {
false, defopts.dry_run_ranks, "positive integer", cmd); false, defopts.dry_run_ranks, "positive integer", cmd);
TCLAP::SwitchArg profile_only_zero_arg( TCLAP::SwitchArg profile_only_zero_arg(
"z", "profile-only-zero", "Only output profile information for rank 0", cmd, false); "z", "profile-only-zero", "Only output profile information for rank 0", cmd, false);
TCLAP::SwitchArg verbose_arg(
"v", "verbose", "Present more verbose information to stdout", cmd, false);
cmd.reorder_arguments(); cmd.reorder_arguments();
cmd.parse(argc, argv); cmd.parse(argc, argv);
// Handle verbosity separately from other options: it is not considered part
// of the saved option state.
options.verbose = verbose_arg.getValue();
std::string ifile_name = ifile_arg.getValue(); std::string ifile_name = ifile_arg.getValue();
if (ifile_name != "") { if (ifile_name != "") {
// Read parameters from specified JSON file first, to allow // Read parameters from specified JSON file first, to allow
...@@ -324,6 +330,12 @@ cl_options read_options(int argc, char** argv, bool allow_write) { ...@@ -324,6 +330,12 @@ cl_options read_options(int argc, char** argv, bool allow_write) {
throw usage_error("unable to write to model parameter file "+save_file); throw usage_error("unable to write to model parameter file "+save_file);
} }
} }
// If verbose output requested, emit option summary.
if (options.verbose) {
std::cout << options << "\n";
}
return options; return options;
} }
......
...@@ -57,6 +57,9 @@ struct cl_options { ...@@ -57,6 +57,9 @@ struct cl_options {
// Report (inefficiently) on number of cell compartments in sim. // Report (inefficiently) on number of cell compartments in sim.
bool report_compartments = false; bool report_compartments = false;
// Be more verbose with informational messages.
bool verbose = false;
}; };
class usage_error: public std::runtime_error { class usage_error: public std::runtime_error {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment