aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Carpet/CarpetIOHDF5/doc/documentation.tex10
-rw-r--r--Carpet/CarpetIOHDF5/src/Output.cc21
2 files changed, 22 insertions, 9 deletions
diff --git a/Carpet/CarpetIOHDF5/doc/documentation.tex b/Carpet/CarpetIOHDF5/doc/documentation.tex
index c0ca6b0d9..4f449c2fd 100644
--- a/Carpet/CarpetIOHDF5/doc/documentation.tex
+++ b/Carpet/CarpetIOHDF5/doc/documentation.tex
@@ -102,12 +102,13 @@ Parameters to control the \ThisThorn\ I/O method are:
Each group/variable name can have an option string attached in which you
can specify a different output frequency for that individual variable,
- a set of individual refinement levels to be output, or an individual
- output mode, e.g.
+ a set of individual refinement levels to be output, the compression
+ level, or an individual output mode, e.g.
\begin{verbatim}
IOHDF5::out_vars = "wavetoy::phi{ out_every = 4 refinement_levels = { 1 2 } }"
\end{verbatim}
- Option strings currently supported by \ThisThorn\ are: {\tt out\_every, out\_unchunked}, and {\tt refinement\_levels}.
+ Option strings currently supported by \ThisThorn\ are: {\tt out\_every,
+ out\_unchunked}, {\tt refinement\_levels}, and {\tt compression\_level}.
\item {\tt IOHDF5::out\_dir}\\
The directory in which to place the \ThisThorn\ output files.
@@ -125,6 +126,9 @@ Parameters to control the \ThisThorn\ I/O method are:
with increasing values requesting higher compression rates (at the cost
of additional runtime for outputting HDF5 data); a value of zero
(which is the default setting for this parameter) disables compression.
+ The output compression level can also be set
+ for individual variables using the {\tt compression\_level} option in
+ an option string appended to the {\tt IOHDF5::out\_vars} parameter.
\item {\tt IO::out\_single\_precision (steerable)}\\
whether to output double-precision data in single precision
diff --git a/Carpet/CarpetIOHDF5/src/Output.cc b/Carpet/CarpetIOHDF5/src/Output.cc
index a0367ba58..6d3da697b 100644
--- a/Carpet/CarpetIOHDF5/src/Output.cc
+++ b/Carpet/CarpetIOHDF5/src/Output.cc
@@ -140,9 +140,12 @@ int WriteVarUnchunked (const cGH* const cctkGH,
// enable compression if requested
hid_t plist;
HDF5_ERROR (plist = H5Pcreate (H5P_DATASET_CREATE));
- if (compression_level) {
+ const int compression_lvl = request->compression_level >= 0 ?
+ request->compression_level :
+ compression_level;
+ if (compression_lvl) {
HDF5_ERROR (H5Pset_chunk (plist, group.dim, shape));
- HDF5_ERROR (H5Pset_deflate (plist, compression_level));
+ HDF5_ERROR (H5Pset_deflate (plist, compression_lvl));
}
HDF5_ERROR (dataset = H5Dcreate (outfile, datasetname.str().c_str(),
filedatatype, dataspace, plist));
@@ -390,9 +393,12 @@ int WriteVarChunkedSequential (const cGH* const cctkGH,
hid_t plist, dataspace, dataset;
HDF5_ERROR (plist = H5Pcreate (H5P_DATASET_CREATE));
// enable compression if requested
- if (compression_level) {
+ const int compression_lvl = request->compression_level >= 0 ?
+ request->compression_level :
+ compression_level;
+ if (compression_lvl) {
HDF5_ERROR (H5Pset_chunk (plist, group.dim, shape));
- HDF5_ERROR (H5Pset_deflate (plist, compression_level));
+ HDF5_ERROR (H5Pset_deflate (plist, compression_lvl));
}
HDF5_ERROR (dataspace = H5Screate_simple (group.dim, shape, NULL));
HDF5_ERROR (dataset = H5Dcreate (outfile, datasetname.str().c_str(),
@@ -535,9 +541,12 @@ int WriteVarChunkedParallel (const cGH* const cctkGH,
hid_t plist, dataspace, dataset;
HDF5_ERROR (plist = H5Pcreate (H5P_DATASET_CREATE));
// enable compression if requested
- if (compression_level) {
+ const int compression_lvl = request->compression_level >= 0 ?
+ request->compression_level :
+ compression_level;
+ if (compression_lvl) {
HDF5_ERROR (H5Pset_chunk (plist, group.dim, shape));
- HDF5_ERROR (H5Pset_deflate (plist, compression_level));
+ HDF5_ERROR (H5Pset_deflate (plist, compression_lvl));
}
HDF5_ERROR (dataspace = H5Screate_simple (group.dim, shape, NULL));
HDF5_ERROR (dataset = H5Dcreate (outfile, datasetname.str().c_str(),