aboutsummaryrefslogtreecommitdiff
path: root/src/RecoverVar.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/RecoverVar.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/RecoverVar.c')
-rw-r--r--src/RecoverVar.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/src/RecoverVar.c b/src/RecoverVar.c
index 8724f7b..f8e63da 100644
--- a/src/RecoverVar.c
+++ b/src/RecoverVar.c
@@ -247,14 +247,14 @@ int IOHDF5Util_RecoverGHextensions (cGH *GH, const fileinfo_t *fileinfo)
(don't have subcommunicators yet) */
int IOHDF5Util_RecoverParameters (const fileinfo_t *fileinfo)
{
- hid_t group, attr, atype;
+ hid_t group, attr, dataset, atype;
char *parameters;
CCTK_INT4 parameterSize;
DECLARE_CCTK_PARAMETERS
/* To make the compiler happy */
- group = attr = 0;
+ group = attr = dataset = -1;
parameters = NULL;
parameterSize = 0;
@@ -267,21 +267,35 @@ int IOHDF5Util_RecoverParameters (const fileinfo_t *fileinfo)
}
/* the parameters are stored in the CACTUS_PARAMETERS_GROUP group
- in the attribute ALL_PARAMETERS */
+ in the attribute (old style) or dataset (new style) ALL_PARAMETERS */
group = H5Gopen (fileinfo->file, CACTUS_PARAMETERS_GROUP);
if (group > 0)
{
- attr = H5Aopen_name (group, ALL_PARAMETERS);
+ H5E_BEGIN_TRY
+ {
+ attr = H5Aopen_name (group, ALL_PARAMETERS);
+ dataset = H5Dopen (group, ALL_PARAMETERS);
+ } H5E_END_TRY
}
- if (group > 0 && attr > 0)
+ if (group >= 0 && (attr >= 0 || dataset >= 0))
{
- HDF5_ERROR (atype = H5Aget_type (attr));
- parameterSize = H5Tget_size (atype);
- parameters = malloc (parameterSize + 1);
- HDF5_ERROR (H5Aread (attr, atype, parameters));
- parameters[parameterSize] = 0;
- HDF5_ERROR (H5Tclose (atype));
+ if (attr >= 0)
+ {
+ HDF5_ERROR (atype = H5Aget_type (attr));
+ parameterSize = H5Tget_size (atype);
+ parameters = malloc (parameterSize + 1);
+ HDF5_ERROR (H5Aread (attr, atype, parameters));
+ parameters[parameterSize] = 0;
+ HDF5_ERROR (H5Tclose (atype));
+ }
+ else
+ {
+ parameterSize = H5Dget_storage_size (dataset);
+ parameters = malloc (parameterSize);
+ HDF5_ERROR (H5Dread (dataset, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, parameters));
+ }
}
else
{
@@ -289,11 +303,15 @@ int IOHDF5Util_RecoverParameters (const fileinfo_t *fileinfo)
"Is this really a Cactus HDF5 checkpoint file ?");
}
- if (attr > 0)
+ if (attr >= 0)
{
HDF5_ERROR (H5Aclose (attr));
}
- if (group > 0)
+ if (dataset >= 0)
+ {
+ HDF5_ERROR (H5Dclose (dataset));
+ }
+ if (group >= 0)
{
HDF5_ERROR (H5Gclose (group));
}