aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Utils.c26
-rw-r--r--src/ioutil_Utils.h3
2 files changed, 29 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;
diff --git a/src/ioutil_Utils.h b/src/ioutil_Utils.h
index 655ee7d..3840e65 100644
--- a/src/ioutil_Utils.h
+++ b/src/ioutil_Utils.h
@@ -57,6 +57,9 @@ typedef struct
/* bitmask for refinement levels to output */
CCTK_INT refinement_levels;
+ /* list of reductions to output */
+ char *reductions;
+
} ioRequest;