From 99810289b0600b9f13c48e7da332d6633dc92f9a Mon Sep 17 00:00:00 2001 From: Loic Hausammann <loic.hausammann@protonmail.ch> Date: Wed, 12 Jun 2019 22:01:11 +0100 Subject: [PATCH] Fix generation of parameter file for selecting the output --- README | 4 ++-- README.md | 4 ++-- doc/RTD/source/CommandLineOptions/index.rst | 4 ++-- examples/main.c | 18 ++++++++++-------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README b/README index 689386194d..274ea3dbe3 100644 --- a/README +++ b/README @@ -58,8 +58,8 @@ Parameters: -n, --steps=<int> Execute a fixed number of time steps. When unset use the time_end parameter to stop. - -o, --output-params=<str> Generate a default output parameter - file. + -o, --output-params=<str> Generate a parameter file with the options + for selecting the output fields. -P, --param=<str> Set parameter value, overiding the value read from the parameter file. Can be used more than once {sec:par:value}. diff --git a/README.md b/README.md index cc1a0ff1c9..233a2112ae 100644 --- a/README.md +++ b/README.md @@ -109,8 +109,8 @@ Parameters: -n, --steps=<int> Execute a fixed number of time steps. When unset use the time_end parameter to stop. - -o, --output-params=<str> Generate a default output parameter - file. + -o, --output-params=<str> Generate a parameter file with the options + for selecting the output fields. -P, --param=<str> Set parameter value, overiding the value read from the parameter file. Can be used more than once {sec:par:value}. diff --git a/doc/RTD/source/CommandLineOptions/index.rst b/doc/RTD/source/CommandLineOptions/index.rst index 68cf9bc824..1144477548 100644 --- a/doc/RTD/source/CommandLineOptions/index.rst +++ b/doc/RTD/source/CommandLineOptions/index.rst @@ -52,8 +52,8 @@ can be found by typing ``./swift -h``:: -n, --steps=<int> Execute a fixed number of time steps. When unset use the time_end parameter to stop. - -o, --output-params=<str> Generate a default output parameter - file. + -o, --output-params=<str> Generate a parameter file with the options + for selecting the output fields. -P, --param=<str> Set parameter value, overiding the value read from the parameter file. Can be used more than once {sec:par:value}. diff --git a/examples/main.c b/examples/main.c index 6f1341abe7..e08999bdcf 100644 --- a/examples/main.c +++ b/examples/main.c @@ -242,7 +242,9 @@ int main(int argc, char *argv[]) { "time_end parameter to stop.", NULL, 0, 0), OPT_STRING('o', "output-params", &output_parameters_filename, - "Generate a default output parameter file.", NULL, 0, 0), + "Generate a parameter file with the options for selecting the " + "output fields.", + NULL, 0, 0), OPT_STRING('P', "param", &buffer, "Set parameter value, overiding the value read from the " "parameter file. Can be used more than once {sec:par:value}.", @@ -273,6 +275,13 @@ int main(int argc, char *argv[]) { "example of parameter file."); int nargs = argparse_parse(&argparse, argc, (const char **)argv); + /* Write output parameter file */ + if (myrank == 0 && output_parameters_filename != NULL) { + io_write_output_field_parameter(output_parameters_filename); + printf("End of run.\n"); + return 0; + } + /* Need a parameter file. */ if (nargs != 1) { if (myrank == 0) argparse_usage(&argparse); @@ -332,13 +341,6 @@ int main(int argc, char *argv[]) { } } - /* Write output parameter file */ - if (myrank == 0 && output_parameters_filename != NULL) { - io_write_output_field_parameter(output_parameters_filename); - printf("End of run.\n"); - return 0; - } - if (!with_self_gravity && !with_hydro && !with_external_gravity) { if (myrank == 0) { argparse_usage(&argparse); -- GitLab