aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Utils.c29
-rw-r--r--src/ioutil_Utils.h3
2 files changed, 32 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);
diff --git a/src/ioutil_Utils.h b/src/ioutil_Utils.h
index cee81d8..655ee7d 100644
--- a/src/ioutil_Utils.h
+++ b/src/ioutil_Utils.h
@@ -42,6 +42,9 @@ typedef struct
/* flag indicating whether to output in chunked or unchunked format */
int out_unchunked;
+ /* compression level */
+ CCTK_INT compression_level;
+
/* pointer to allocated buffers */
CCTK_INT *vectors;