diff --git a/examples/main.c b/examples/main.c index e439c17fe646a48aad03767a2bedead12c127ec1..5adadfd26605a5eba39f89a9ad148a09789b9224 100644 --- a/examples/main.c +++ b/examples/main.c @@ -90,8 +90,6 @@ void print_help_message(void) { printf(" %2s %14s %s\n", "-n", "{int}", "Execute a fixed number of time steps. When unset use the time_end " "parameter to stop."); - printf(" %2s %14s %s\n", "-o", "", - "Filename of the output fields parameters."); printf(" %2s %14s %s\n", "-P", "{sec:par:val}", "Set parameter value and overwrites values read from the parameters " "file. Can be used more than once."); @@ -200,12 +198,11 @@ int main(int argc, char *argv[]) { char *cmdparams[PARSER_MAX_NO_OF_PARAMS]; char paramFileName[200] = ""; char restart_file[200] = ""; - char outputFieldsFileName[200] = ""; unsigned long long cpufreq = 0; /* Parse the parameters */ int c; - while ((c = getopt(argc, argv, "acCdDef:FgGhMn:o:P:rsSt:Tv:y:Y:")) != -1) + while ((c = getopt(argc, argv, "acCdDef:FgGhMn:P:rsSt:Tv:y:Y:")) != -1) switch (c) { case 'a': #if defined(HAVE_SETAFFINITY) && defined(HAVE_LIBNUMA) @@ -262,14 +259,6 @@ int main(int argc, char *argv[]) { return 1; } break; - case 'o': - if (sscanf(optarg, "%s", outputFieldsFileName) != 1) { - if (myrank == 0) { - printf("Error parsing output fields filename"); - print_help_message(); - } - } - break; case 'P': cmdparams[nparams] = optarg; nparams++; @@ -473,6 +462,10 @@ int main(int argc, char *argv[]) { (struct swift_params *)malloc(sizeof(struct swift_params)); if (output_fields == NULL) error("Error allocating memory for the output fields file."); + + char outputFieldsFileName[200]; + parser_get_opt_param_string(params, "Snapshots:FieldsFilename", + outputFieldsFileName, ""); if (myrank == 0) { message("Reading runtime output fields from file '%s'", outputFieldsFileName); diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 791db2758290e400d4ed9ffe5b8e0d4303057874..75df3f7e86f9154030ee750dd98b5c2714185a14 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -78,6 +78,7 @@ Snapshots: UnitVelocity_in_cgs: 1 # (Optional) Unit system for the outputs (Centimeters per second) UnitCurrent_in_cgs: 1 # (Optional) Unit system for the outputs (Amperes) UnitTemp_in_cgs: 1 # (Optional) Unit system for the outputs (Kelvin) + FieldsFilename: output_fields_example.yml # (Optional) File defining output fields # Parameters governing the conserved quantities statistics Statistics: