Skip to content
Snippets Groups Projects
Commit 7880ef3a authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'select_output' into 'master'

Fix generation of parameter file for selecting the output

See merge request !836
parents 11300e89 99810289
Branches
Tags
1 merge request!836Fix generation of parameter file for selecting the output
...@@ -58,8 +58,8 @@ Parameters: ...@@ -58,8 +58,8 @@ Parameters:
-n, --steps=<int> Execute a fixed number of time steps. -n, --steps=<int> Execute a fixed number of time steps.
When unset use the time_end parameter When unset use the time_end parameter
to stop. to stop.
-o, --output-params=<str> Generate a default output parameter -o, --output-params=<str> Generate a parameter file with the options
file. for selecting the output fields.
-P, --param=<str> Set parameter value, overiding the value -P, --param=<str> Set parameter value, overiding the value
read from the parameter file. Can be used read from the parameter file. Can be used
more than once {sec:par:value}. more than once {sec:par:value}.
......
...@@ -109,8 +109,8 @@ Parameters: ...@@ -109,8 +109,8 @@ Parameters:
-n, --steps=<int> Execute a fixed number of time steps. -n, --steps=<int> Execute a fixed number of time steps.
When unset use the time_end parameter When unset use the time_end parameter
to stop. to stop.
-o, --output-params=<str> Generate a default output parameter -o, --output-params=<str> Generate a parameter file with the options
file. for selecting the output fields.
-P, --param=<str> Set parameter value, overiding the value -P, --param=<str> Set parameter value, overiding the value
read from the parameter file. Can be used read from the parameter file. Can be used
more than once {sec:par:value}. more than once {sec:par:value}.
......
...@@ -52,8 +52,8 @@ can be found by typing ``./swift -h``:: ...@@ -52,8 +52,8 @@ can be found by typing ``./swift -h``::
-n, --steps=<int> Execute a fixed number of time steps. -n, --steps=<int> Execute a fixed number of time steps.
When unset use the time_end parameter When unset use the time_end parameter
to stop. to stop.
-o, --output-params=<str> Generate a default output parameter -o, --output-params=<str> Generate a parameter file with the options
file. for selecting the output fields.
-P, --param=<str> Set parameter value, overiding the value -P, --param=<str> Set parameter value, overiding the value
read from the parameter file. Can be used read from the parameter file. Can be used
more than once {sec:par:value}. more than once {sec:par:value}.
......
...@@ -242,7 +242,9 @@ int main(int argc, char *argv[]) { ...@@ -242,7 +242,9 @@ int main(int argc, char *argv[]) {
"time_end parameter to stop.", "time_end parameter to stop.",
NULL, 0, 0), NULL, 0, 0),
OPT_STRING('o', "output-params", &output_parameters_filename, 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, OPT_STRING('P', "param", &buffer,
"Set parameter value, overiding the value read from the " "Set parameter value, overiding the value read from the "
"parameter file. Can be used more than once {sec:par:value}.", "parameter file. Can be used more than once {sec:par:value}.",
...@@ -273,6 +275,13 @@ int main(int argc, char *argv[]) { ...@@ -273,6 +275,13 @@ int main(int argc, char *argv[]) {
"example of parameter file."); "example of parameter file.");
int nargs = argparse_parse(&argparse, argc, (const char **)argv); 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. */ /* Need a parameter file. */
if (nargs != 1) { if (nargs != 1) {
if (myrank == 0) argparse_usage(&argparse); if (myrank == 0) argparse_usage(&argparse);
...@@ -332,13 +341,6 @@ int main(int argc, char *argv[]) { ...@@ -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 (!with_self_gravity && !with_hydro && !with_external_gravity) {
if (myrank == 0) { if (myrank == 0) {
argparse_usage(&argparse); argparse_usage(&argparse);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment