From e2241c00717871b568fe9da330f6617bdc73767d Mon Sep 17 00:00:00 2001 From: tradke Date: Fri, 17 Nov 2006 13:21:13 +0000 Subject: Implement variable-specific output request option 'compression_level' so that users can specify eg. IOHDF5::compression_level = 1 IOHDF5::out_vars = "admbase::metric admconstraints::hamiltonian admbase::lapse{ compression_level = 0 }" to request HDF5 dataset compression for every output variable except for the lapse. This is currently supported only by PUGH's and Carpet's HDF5 I/O thorns. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@250 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a --- src/Utils.c | 29 +++++++++++++++++++++++++++++ src/ioutil_Utils.h | 3 +++ 2 files changed, 32 insertions(+) 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; -- cgit v1.2.3