aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.c')
-rw-r--r--src/Utils.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Utils.c b/src/Utils.c
index 0b22bd9..7ea6e90 100644
--- a/src/Utils.c
+++ b/src/Utils.c
@@ -1003,6 +1003,34 @@ static void SetOutputVar (int vindex, const char *optstring, void *arg)
Util_TableDeleteKey (table, "refinement_levels");
}
+ /* check for option 'compression_level' */
+ if (Util_TableQueryValueInfo (table, &type, &nelems,
+ "compression_level") > 0)
+ {
+ request->compression_level = -1;
+ if (type == CCTK_VARIABLE_INT && nelems == 1)
+ {
+ Util_TableGetInt (table, &request->compression_level,
+ "compression_level");
+ if (request->compression_level < 0 || request->compression_level > 9)
+ {
+ type = -1;
+ request->compression_level = -1;
+ }
+ }
+ if (! (type == CCTK_VARIABLE_INT && nelems == 1))
+ {
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Invalid value for option 'compression_level' in option "
+ "string '%s' in parameter '%s' (must be an integer in the "
+ "range [0-9])", optstring, info->parameter_name);
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Option 'compression_level' 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);
@@ -1071,6 +1099,7 @@ ioRequest *IOUtil_DefaultIORequest (const cGH *GH, int vindex,
request->out_unchunked = out_unchunked;
request->with_ghostzones = 0;
request->refinement_levels = -1;
+ request->compression_level = -1;
/* get the I/O request datatype (will be single-precision if requested) */
request->hdatatype = CCTK_VarTypeI (vindex);