aboutsummaryrefslogtreecommitdiff
path: root/src/RecoverGH.c
diff options
context:
space:
mode:
authortradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>1999-09-22 15:51:54 +0000
committertradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>1999-09-22 15:51:54 +0000
commit818995d0f56ab1b5011feb70ede093241570b514 (patch)
tree803bdd69f5216c64256b6f22d6b0a060c55f4b18 /src/RecoverGH.c
parent27d628585ed18fe11f174ad4bab5e4319458317c (diff)
Checkpoint/recover iteration number, cctk_iteration, cctk_time.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@39 ebee0441-1374-4afa-a3b5-247f3ba15b9a
Diffstat (limited to 'src/RecoverGH.c')
-rw-r--r--src/RecoverGH.c51
1 files changed, 42 insertions, 9 deletions
diff --git a/src/RecoverGH.c b/src/RecoverGH.c
index 1623450..745804c 100644
--- a/src/RecoverGH.c
+++ b/src/RecoverGH.c
@@ -75,10 +75,13 @@ int IOFlexIO_RecoverGH (cGH *GH, const char *basename, int called_from)
int is_IEEEIO_file;
Long nels_stored;
int nt_stored;
- int iteration_stored;
+ int main_loop_index_stored;
+ int cctk_iteration_stored;
+ CCTK_REAL cctk_time_stored;
int file_ioproc, file_ioproc_every;
int file_nprocs, file_unchunked;
CCTK_INT4 tmpInt;
+ CCTK_REAL tmpDouble;
char msg [512];
pGH *pughGH;
ioGH *ioUtilGH;
@@ -198,6 +201,7 @@ int IOFlexIO_RecoverGH (cGH *GH, const char *basename, int called_from)
if (verbose)
printf ("Recovering from one %s file\n",
file_unchunked ? "unchunked" : "chunked");
+ file_ioproc_every = nprocs;
} else {
if (file_nprocs != nprocs) {
sprintf (msg, "Must restart on %d processors with multiple files "
@@ -213,13 +217,13 @@ int IOFlexIO_RecoverGH (cGH *GH, const char *basename, int called_from)
#ifdef MPI
/* Broadcast chunking mode to all processors from processor zero */
info [0] = is_IEEEIO_file;
- info [1] = out3D_unchunked;
+ info [1] = file_unchunked;
info [2] = file_ioproc_every;
CACTUS_MPI_ERROR (MPI_Bcast (info, 3, PUGH_MPI_INT, 0,
pughGH->PUGH_COMM_WORLD));
is_IEEEIO_file = info [0];
/* FIXME: Parameter on LHS */
- out3D_unchunked = info [1];
+ file_unchunked = info [1];
file_ioproc_every = info [2];
#endif
@@ -307,18 +311,47 @@ int IOFlexIO_RecoverGH (cGH *GH, const char *basename, int called_from)
/* Restore global variables */
+ /* Get the main loop index. */
+ if (verbose)
+ printf ("Recovering main loop index.\n");
+ index = IOreadAttributeInfo (ifp, "main loop index", &nt_stored, &nels_stored);
+
+ if (index >= 0 && nt_stored == FLEXIO_INT4 && nels_stored == 1) {
+ IOreadAttribute (ifp, index, &tmpInt);
+ main_loop_index_stored = (int) tmpInt;
+ if (verbose)
+ printf ("main loop index is %d\n", (int) main_loop_index_stored);
+ CCTK_SetMainLoopIndex (main_loop_index_stored);
+ } else
+ printf ("*Warning* Unable to restore main loop index\n");
+
/* Get the iteration number. */
if (verbose)
- printf ("Recovering iteration number.\n");
- index = IOreadAttributeInfo (ifp, "iteration", &nt_stored, &nels_stored);
+ printf ("Recovering GH->cctk_iteration.\n");
+ index = IOreadAttributeInfo (ifp, "GH$iteration", &nt_stored, &nels_stored);
if (index >= 0 && nt_stored == FLEXIO_INT4 && nels_stored == 1) {
- IOreadAttribute (ifp, index, &iteration_stored);
+ IOreadAttribute (ifp, index, &tmpInt);
+ cctk_iteration_stored = (int) tmpInt;
+ if (verbose)
+ printf ("cctk_iteration is %d\n", (int) cctk_iteration_stored);
+ GH->cctk_iteration = cctk_iteration_stored;
+ } else
+ printf ("*Warning* Unable to restore GH->cctk_iteration\n");
+
+ /* Get cctk_time. */
+ if (verbose)
+ printf ("Recovering GH->cctk_time.\n");
+ index = IOreadAttributeInfo (ifp, "GH$time", &nt_stored, &nels_stored);
+
+ if (index >= 0 && nt_stored == FLEXIO_REAL && nels_stored == 1) {
+ IOreadAttribute (ifp, index, &tmpDouble);
+ cctk_time_stored = (double) tmpDouble;
if (verbose)
- printf ("Iteration number is %d\n", (int) iteration_stored);
- GH->cctk_iteration = iteration_stored;
+ printf ("GH->cctk_time is %f\n", cctk_time_stored);
+ GH->cctk_time = cctk_time_stored;
} else
- printf ("*Warning* Unable to restore iteration number\n");
+ printf ("*Warning* Unable to restore GH->cctk_time\n");
/* Close the file. */
if (verbose)