aboutsummaryrefslogtreecommitdiff
path: root/src/RecoverVar.c
diff options
context:
space:
mode:
authortradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668>2000-11-20 22:34:30 +0000
committertradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668>2000-11-20 22:34:30 +0000
commitb9830ecc1055b7ea9ac6e7301432a26a1d550541 (patch)
tree1d30155b213ab802dbc8134989d20c3b6295942c /src/RecoverVar.c
parenteef36f49f2764e8ead7b9eab0991ffb4beee29ce (diff)
Replaced functional dependency on PUGH by using CCTK_GroupDynamicData().
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5Util/trunk@7 7842ec3a-9562-4be5-9c5b-06ba18f2b668
Diffstat (limited to 'src/RecoverVar.c')
-rw-r--r--src/RecoverVar.c73
1 files changed, 42 insertions, 31 deletions
diff --git a/src/RecoverVar.c b/src/RecoverVar.c
index fe1e015..d6ccd01 100644
--- a/src/RecoverVar.c
+++ b/src/RecoverVar.c
@@ -333,8 +333,8 @@ int IOHDF5Util_RecoverParameters (fileinfo_t *fileinfo)
- ntimelevels
- sizes (rank, dimensions) according to chunking mode
- If there is a mismatch a warning (warning level 2) is printed and value of 1
- is returned to indicate that this dataset should be ignored.
+ If there is a mismatch a warning (warning level 2) is printed and
+ a negative value is returned to indicate that this dataset should be ignored.
If successful, the global variable index, the group type and the timelevel
to restore are stored in {*index, *gtype, *timelevel}, and 0 is returned.
*/
@@ -343,9 +343,11 @@ static int GetCommonAttributes (cGH *GH, hid_t dataset, const char *datasetname,
int unchunked, int *index, int *grouptype,
int *timelevel, int is_group)
{
- pGExtras *extras;
- cGroup groupdata;
- int i, flag, *dims;
+ cGroup group_static_data;
+ cGroupDynamicData group_dynamic_data;
+ int i, flag;
+ const int *dims;
+ int groupindex;
hid_t datatype, dataspace;
hsize_t rank_stored, *dims_stored;
int grouptype_stored, ndims_stored, numtimelevels_stored;
@@ -358,7 +360,7 @@ static int GetCommonAttributes (cGH *GH, hid_t dataset, const char *datasetname,
{
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
"Cannot parse datasetname '%s'", datasetname);
- return (1);
+ return (-1);
}
/* check if there is a matching variable */
@@ -367,7 +369,7 @@ static int GetCommonAttributes (cGH *GH, hid_t dataset, const char *datasetname,
{
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
"No matching variable found for '%s'", fullvarname);
- return (1);
+ return (-1);
}
/* read and verify the group name */
@@ -376,7 +378,7 @@ static int GetCommonAttributes (cGH *GH, hid_t dataset, const char *datasetname,
if (! CCTK_Equals (groupname_stored, groupname))
{
CCTK_WARN (2, "Groupnames don't match");
- return (1);
+ return (-1);
}
free (groupname);
@@ -384,23 +386,33 @@ static int GetCommonAttributes (cGH *GH, hid_t dataset, const char *datasetname,
READ_ATTRIBUTE (dataset, "grouptype", H5T_NATIVE_INT, &grouptype_stored);
READ_ATTRIBUTE (dataset, "ntimelevels", H5T_NATIVE_INT,&numtimelevels_stored);
- if (CCTK_GroupData (CCTK_GroupIndex (groupname_stored), &groupdata) != 0)
+ /* get the group data */
+ groupindex = CCTK_GroupIndex (groupname_stored);
+ if (CCTK_GroupData (groupindex, &group_static_data) != 0)
{
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Cannot get group data for '%s'", fullvarname);
- return (1);
+ "Cannot get static group data for '%s'", fullvarname);
+ return (-1);
}
- if (groupdata.grouptype != grouptype_stored)
+ if (CCTK_GroupDynamicData (GH, groupindex, &group_dynamic_data) != 0)
+ {
+ CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Cannot get dynamic group data for '%s'", fullvarname);
+ return (-1);
+ }
+
+ /* now check the group data against the information in the checkpoint file */
+ if (group_static_data.grouptype != grouptype_stored)
{
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
"Group types don't match for '%s'", fullvarname);
- return (1);
+ return (-1);
}
- if (groupdata.numtimelevels != numtimelevels_stored)
+ if (group_static_data.numtimelevels != numtimelevels_stored)
{
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
"Number of timelevels don't match for '%s'", fullvarname);
- return (1);
+ return (-1);
}
/* open the first chunk to determine datatype, dims and sizes
if the dataset is a chunk group */
@@ -413,20 +425,20 @@ static int GetCommonAttributes (cGH *GH, hid_t dataset, const char *datasetname,
/* The CCTK variable type defines do not correlate with the HDF5 defines
so compare them explicitely here. */
flag = (H5Tget_class (datatype) == H5T_FLOAT &&
- groupdata.vartype == CCTK_VARIABLE_REAL) ||
+ group_static_data.vartype == CCTK_VARIABLE_REAL) ||
(H5Tget_class (datatype) == H5T_INTEGER &&
- groupdata.vartype == CCTK_VARIABLE_INT) ||
+ group_static_data.vartype == CCTK_VARIABLE_INT) ||
(H5Tget_class (datatype) == H5T_INTEGER &&
- groupdata.vartype == CCTK_VARIABLE_CHAR) ||
+ group_static_data.vartype == CCTK_VARIABLE_CHAR) ||
(H5Tget_class (datatype) == H5T_COMPOUND &&
- groupdata.vartype == CCTK_VARIABLE_COMPLEX);
+ group_static_data.vartype == CCTK_VARIABLE_COMPLEX);
IOHDF5_ERROR (H5Tclose (datatype));
if (! flag)
{
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
"Variable types don't match for '%s'", fullvarname);
- return (1);
+ return (-1);
}
/* verify the dims and sizes */
@@ -443,21 +455,20 @@ static int GetCommonAttributes (cGH *GH, hid_t dataset, const char *datasetname,
IOHDF5_ERROR (H5Sclose (dataspace));
flag = 0;
- if (groupdata.dim != rank_stored)
+ if (group_static_data.dim != rank_stored)
{
flag = 1;
}
- switch (groupdata.grouptype)
+ switch (group_static_data.grouptype)
{
case CCTK_SCALAR:
break;
case CCTK_ARRAY:
case CCTK_GF:
- extras = ((pGA ***) PUGH_pGH (GH)->variables)[*index][*timelevel]->extras;
- dims = unchunked ? extras->nsize : extras->lnsize;
- for (i = 0; i < groupdata.dim; i++)
+ dims = unchunked ? group_dynamic_data.gsh : group_dynamic_data.lsh;
+ for (i = 0; i < group_static_data.dim; i++)
{
- if (dims[groupdata.dim - i - 1] != dims_stored[i])
+ if (dims[group_static_data.dim - i - 1] != dims_stored[i])
{
flag = 1;
}
@@ -470,14 +481,14 @@ static int GetCommonAttributes (cGH *GH, hid_t dataset, const char *datasetname,
{
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
"Variable sizes don't match for '%s'", fullvarname);
- return (1);
+ return (-1);
}
- if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (*index)))
+ if (! CCTK_QueryGroupStorageI (GH, groupindex))
{
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
"Can't read into variable '%s': no storage", fullvarname);
- return (1);
+ return (-1);
}
/* close the first chunk if the dataset is a chunk group */
@@ -486,7 +497,7 @@ static int GetCommonAttributes (cGH *GH, hid_t dataset, const char *datasetname,
IOHDF5_ERROR (H5Dclose (dataset));
}
- *grouptype = groupdata.grouptype;
+ *grouptype = group_static_data.grouptype;
return (0);
}
@@ -706,7 +717,7 @@ static herr_t processDataset (hid_t group,
/* read in the dataset's attributes and verify them */
if (GetCommonAttributes (it_info->GH, dataset, datasetname,
- it_info->unchunked, &index, &gtype, &timelevel, is_group))
+ it_info->unchunked, &index, &gtype, &timelevel, is_group) < 0)
{
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
"Ignoring dataset '%s'", datasetname);