aboutsummaryrefslogtreecommitdiff
path: root/src/DumpUtils.c
diff options
context:
space:
mode:
authortradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668>2004-02-04 13:44:42 +0000
committertradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668>2004-02-04 13:44:42 +0000
commite31f3f860ae1e4163dda2325db239b4c39614e50 (patch)
treefb8f0e4867dd3f3fd38b03ef0d82b88e8d9295c9 /src/DumpUtils.c
parent8324407bddd5fc1a2bfc5bf53a09000511904c01 (diff)
Write all the Cactus parameters into a dataset rather than a single string
attribute. This fixes a problem with very many parameters to dump as HDF5 has a 16k size limit on attributes. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5Util/trunk@106 7842ec3a-9562-4be5-9c5b-06ba18f2b668
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);