aboutsummaryrefslogtreecommitdiff
path: root/src/DumpUtils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/DumpUtils.c')
-rw-r--r--src/DumpUtils.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/DumpUtils.c b/src/DumpUtils.c
index a37bb93..fd9c389 100644
--- a/src/DumpUtils.c
+++ b/src/DumpUtils.c
@@ -286,8 +286,13 @@ void IOHDF5Util_DumpCommonAttributes (const cGH *GH, const ioRequest *request,
@author Thomas Radke
@desc
Collects the parameters of all active implementations
- into a single string and writes it as an attribute
- attached to the CACTUS_PARAMETERS_GROUP group in the HDF5 file.
+ into a single string and writes it as a single dataset
+ into the CACTUS_PARAMETERS_GROUP group in the HDF5 file.
+
+ Note that we used to write the parameters string as a single
+ attribute attached to the CACTUS_PARAMETERS_GROUP group.
+ This caused problems with very long strings (HDF5 has a 16k-limit
+ on the total size of attributes).
@enddesc
@var GH
@vdesc pointer to CCTK grid hierarchy
@@ -310,7 +315,8 @@ void IOHDF5Util_DumpParameters (const cGH *GH, int all, hid_t file)
{
ioHDF5UtilGH *myGH;
char *parameters;
- hid_t group;
+ hid_t group, dataspace, dataset;
+ hsize_t size;
DECLARE_CCTK_PARAMETERS
@@ -325,9 +331,15 @@ void IOHDF5Util_DumpParameters (const cGH *GH, int all, hid_t file)
if (parameters)
{
myGH = CCTK_GHExtension (GH, "IOHDF5Util");
+ size = strlen (parameters) + 1;
HDF5_ERROR (group = H5Gcreate (file, CACTUS_PARAMETERS_GROUP, 0));
- WRITE_ATTRIBUTE (ALL_PARAMETERS, parameters, group, myGH, 0,
- myGH->HDF5_STRING);
+ HDF5_ERROR (dataspace = H5Screate_simple (1, &size, NULL));
+ HDF5_ERROR (dataset = H5Dcreate (group, ALL_PARAMETERS, H5T_NATIVE_UCHAR,
+ dataspace, H5P_DEFAULT));
+ HDF5_ERROR (H5Dwrite (dataset, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, parameters));
+ HDF5_ERROR (H5Dclose (dataset));
+ HDF5_ERROR (H5Sclose (dataspace));
HDF5_ERROR (H5Gclose (group));
free (parameters);