aboutsummaryrefslogtreecommitdiff
path: root/src/RestoreFile.c
diff options
context:
space:
mode:
authortradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2000-01-17 15:42:59 +0000
committertradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2000-01-17 15:42:59 +0000
commitaac197b92353ee71641fc4c9ec874a60704a14d5 (patch)
tree977c995f08989cf34973546b15e13a84eb902fcc /src/RestoreFile.c
parente1b79ac32aadd14dcdc095d2bee50ef2e59e25c2 (diff)
Replaced CCTK_OldGroupData() with CCTK_GroupData().
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@76 ebee0441-1374-4afa-a3b5-247f3ba15b9a
Diffstat (limited to 'src/RestoreFile.c')
-rw-r--r--src/RestoreFile.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/src/RestoreFile.c b/src/RestoreFile.c
index 99a428a..5a5cfd2 100644
--- a/src/RestoreFile.c
+++ b/src/RestoreFile.c
@@ -50,14 +50,14 @@ static char *rcsid = "$Id$";
*/
int GetCommonAttributes (cGH *GH, IOFile ifp, int unchunked, int *index,
- int *gtype, int *timelevel)
+ int *grouptype, int *timelevel)
{
int i, flag;
int atype;
Long asize;
- int vtype_stored, rank_stored, dims_stored [MAXDIM];
- CCTK_INT4 gtype_stored, ntimelevels_stored, timelevel_stored;
- int vtype, rank, ntimelevels;
+ cGroup groupdata;
+ int vartype_stored, rank_stored, dims_stored [MAXDIM];
+ CCTK_INT4 grouptype_stored, numtimelevels_stored, timelevel_stored;
int result;
char *groupname;
char fullname [512], groupname_stored [512];
@@ -65,7 +65,7 @@ int GetCommonAttributes (cGH *GH, IOFile ifp, int unchunked, int *index,
/* read the next dataset's info from the file */
- result = IOreadInfo (ifp, &vtype_stored, &rank_stored, dims_stored, MAXDIM);
+ result = IOreadInfo (ifp, &vartype_stored, &rank_stored, dims_stored, MAXDIM);
CACTUS_IEEEIO_ERROR (result);
if (result == 0) {
CCTK_WARN (1, "Can't read dataset info");
@@ -111,7 +111,7 @@ int GetCommonAttributes (cGH *GH, IOFile ifp, int unchunked, int *index,
CCTK_WARN (2, msg);
return (1);
}
- CACTUS_IEEEIO_ERROR (IOreadAttribute (ifp, i, &gtype_stored));
+ CACTUS_IEEEIO_ERROR (IOreadAttribute (ifp, i, &grouptype_stored));
/* read the number of timelevels */
i = IOreadAttributeInfo (ifp, "ntimelevels", &atype, &asize);
@@ -120,7 +120,7 @@ int GetCommonAttributes (cGH *GH, IOFile ifp, int unchunked, int *index,
CCTK_WARN (2, msg);
return (1);
}
- CACTUS_IEEEIO_ERROR (IOreadAttribute (ifp, i, &ntimelevels_stored));
+ CACTUS_IEEEIO_ERROR (IOreadAttribute (ifp, i, &numtimelevels_stored));
/* read the timelevel to restore */
i = IOreadAttributeInfo (ifp, "timelevel", &atype, &asize);
@@ -133,14 +133,17 @@ int GetCommonAttributes (cGH *GH, IOFile ifp, int unchunked, int *index,
*timelevel = timelevel_stored;
/* verify group type, variable type, dims, sizes and ntimelevels */
- CCTK_OldGroupData (CCTK_GroupIndex (groupname_stored), gtype, &vtype, &rank,
- &i, &ntimelevels);
- if (*gtype != gtype_stored) {
+ if (CCTK_GroupData (CCTK_GroupIndex (groupname_stored), &groupdata) != 0) {
+ sprintf (msg, "Could not get group info for '%s'", fullname);
+ CCTK_WARN (2, msg);
+ return (1);
+ }
+ if (groupdata.grouptype != grouptype_stored) {
sprintf (msg, "Group types don't match for '%s'", fullname);
CCTK_WARN (2, msg);
return (1);
}
- if (ntimelevels != ntimelevels_stored) {
+ if (groupdata.numtimelevels != numtimelevels_stored) {
sprintf (msg, "Number of timelevels don't match for '%s'", fullname);
CCTK_WARN (2, msg);
return (1);
@@ -149,11 +152,11 @@ int GetCommonAttributes (cGH *GH, IOFile ifp, int unchunked, int *index,
so compare them explicitely here.
Up to now CCTK knows only REALs, but COMPLEX types aren't supported
anyway by IOFlexIO. */
- if ((vtype_stored == FLEXIO_REAL && vtype == CCTK_VARIABLE_REAL) ||
- (vtype_stored == FLEXIO_INT && vtype == CCTK_VARIABLE_INT) ||
- (vtype_stored == FLEXIO_CHAR && vtype == CCTK_VARIABLE_CHAR)) {
+ if ((vartype_stored == FLEXIO_REAL && groupdata.vartype == CCTK_VARIABLE_REAL) ||
+ (vartype_stored == FLEXIO_INT && groupdata.vartype == CCTK_VARIABLE_INT) ||
+ (vartype_stored == FLEXIO_CHAR && groupdata.vartype == CCTK_VARIABLE_CHAR)) {
#if 0
- || (vtype_stored == FLEXIO_COMPLEX && vtype == CCTK_VARIABLE_COMPLEX)) {
+ || (vtype_stored == FLEXIO_COMPLEX && groupdata.vartype == CCTK_VARIABLE_COMPLEX)) {
#endif
/* everything is okay */
} else {
@@ -164,27 +167,27 @@ int GetCommonAttributes (cGH *GH, IOFile ifp, int unchunked, int *index,
/* verify the dims and sizes */
flag = 0;
- if (rank != rank_stored)
+ if (groupdata.dim != rank_stored)
flag = 1;
- switch (*gtype) {
+ switch (groupdata.grouptype) {
case GROUP_SCALAR:
if (dims_stored [0] != 1)
flag = 1;
break;
case GROUP_ARRAY:
/*** FIXME: what's the local size of the array ?? ***/
- /* for (i = 0; i < rank; i++)
+ /* for (i = 0; i < groupdata.dim; i++)
if (*(int *) CCTK_ArrayGroupSize (GH, i, groupname_stored) != dims_stored [i])
flag = 1;
*/
break;
case GROUP_GF:
if (unchunked) {
- for (i = 0; i < rank; i++)
+ for (i = 0; i < groupdata.dim; i++)
if (GH->cctk_gsh [i] != dims_stored [i])
flag = 1;
} else {
- for (i = 0; i < rank; i++)
+ for (i = 0; i < groupdata.dim; i++)
if (GH->cctk_lsh [i] != dims_stored [i])
flag = 1;
}
@@ -196,12 +199,13 @@ int GetCommonAttributes (cGH *GH, IOFile ifp, int unchunked, int *index,
return (1);
}
- if (! CCTK_QueryGroupStorageI (GH,
- CCTK_GroupIndexFromVarI (*index))) {
+ if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (*index))) {
CCTK_WARN (2, "Can't read into variable with no storage");
return (1);
}
+ *grouptype = groupdata.grouptype;
+
return (0);
}