diff options
Diffstat (limited to 'src/Utils.c')
-rw-r--r-- | src/Utils.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Utils.c b/src/Utils.c index dfb3a8c..23ebba8 100644 --- a/src/Utils.c +++ b/src/Utils.c @@ -151,6 +151,7 @@ void IOUtil_ParseVarsForOutput (const cGH *GH, const char *method_name, @@*/ void IOUtil_FreeIORequest (ioRequest **request) { + free ((*request)->reductions); free ((*request)->vectors); free (*request); *request = NULL; @@ -1031,6 +1032,30 @@ static void SetOutputVar (int vindex, const char *optstring, void *arg) Util_TableDeleteKey (table, "compression_level"); } + /* check for option 'reductions' */ + if (Util_TableQueryValueInfo (table, &type, &nelems, + "reductions") > 0) + { + request->reductions = NULL; + if (type == CCTK_VARIABLE_CHAR && nelems >= 0) + { + request->reductions = malloc (nelems + 1); + Util_TableGetString (table, nelems + 1, request->reductions, + "reductions"); + } + else + { + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Invalid value for option 'reductions' in option " + "string '%s' in parameter '%s' (must be a string)", + optstring, info->parameter_name); + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Option 'reductions' will be ignored for %s output " + "of variable '%s'", info->method_name, fullname); + } + Util_TableDeleteKey (table, "compression_level"); + } + /* warn about unrecognized options */ iterator = Util_TableItCreate (table); for (iterator = Util_TableItCreate (table); @@ -1097,6 +1122,7 @@ ioRequest *IOUtil_DefaultIORequest (const cGH *GH, int vindex, request->check_exist = myGH->recovered; request->out_every = out_every_default; request->out_unchunked = out_unchunked; + request->reductions = NULL; request->with_ghostzones = 0; request->refinement_levels = -1; request->compression_level = -1; |