aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d>2002-05-21 11:00:40 +0000
committertradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d>2002-05-21 11:00:40 +0000
commitf88f70b7b98e41ad4aba99743c3b5c93571d625b (patch)
treea965a08a8a3efe589bed8a1aeef93bcabded5af0
parentf5dcc1d0bc813e32abff036756b90a4b2ffe2dbd (diff)
Save the iteration number of the last checkpoint and don't dump a termination
checkpoint if it was already written as an evolution checkpoint before. This closes PR IO/1058. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5/trunk@135 4825ed28-b72c-4eae-9704-e50c059e567d
-rw-r--r--src/DumpGH.c38
-rw-r--r--src/ioHDF5GH.h9
2 files changed, 40 insertions, 7 deletions
diff --git a/src/DumpGH.c b/src/DumpGH.c
index 952cbc0..9b66404 100644
--- a/src/DumpGH.c
+++ b/src/DumpGH.c
@@ -71,6 +71,12 @@ void IOHDF5_InitialDataCheckpoint (const cGH *GH)
if (checkpoint && checkpoint_ID)
{
+ if (! CCTK_Equals (verbose, "none"))
+ {
+ CCTK_INFO ("---------------------------------------------------------");
+ CCTK_INFO ("Dumping initial data checkpoint");
+ CCTK_INFO ("---------------------------------------------------------");
+ }
Checkpoint (GH, CP_INITIAL_DATA);
}
}
@@ -104,9 +110,10 @@ void IOHDF5_EvolutionCheckpoint (const cGH *GH)
{
if (! CCTK_Equals (verbose, "none"))
{
- CCTK_INFO("------------------------------------------------------------");
- CCTK_VInfo (CCTK_THORNSTRING, "Dumping periodic checkpoint file at "
+ CCTK_INFO ("---------------------------------------------------------");
+ CCTK_VInfo (CCTK_THORNSTRING, "Dumping periodic checkpoint at "
"iteration %d", GH->cctk_iteration);
+ CCTK_INFO ("---------------------------------------------------------");
}
Checkpoint (GH, CP_EVOLUTION_DATA);
@@ -138,12 +145,32 @@ void IOHDF5_EvolutionCheckpoint (const cGH *GH)
@@*/
void IOHDF5_TerminationCheckpoint (const cGH *GH)
{
+ const ioHDF5GH *myGH;
DECLARE_CCTK_PARAMETERS
- if (checkpoint && checkpoint_on_terminate)
+ myGH = (const ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5");
+ if (checkpoint && checkpoint_on_terminate && myGH)
{
- Checkpoint (GH, CP_EVOLUTION_DATA);
+ if (myGH->last_checkpoint_iteration < GH->cctk_iteration)
+ {
+ if (! CCTK_Equals (verbose, "none"))
+ {
+ CCTK_INFO ("---------------------------------------------------------");
+ CCTK_VInfo (CCTK_THORNSTRING, "Dumping termination checkpoint at "
+ "iteration %d", GH->cctk_iteration);
+ CCTK_INFO ("---------------------------------------------------------");
+ }
+ Checkpoint (GH, CP_EVOLUTION_DATA);
+ }
+ else if (! CCTK_Equals (verbose, "none"))
+ {
+ CCTK_INFO ("---------------------------------------------------------");
+ CCTK_VInfo (CCTK_THORNSTRING, "Termination checkpoint already dumped "
+ "as last evolution checkpoint at iteration %d",
+ myGH->last_checkpoint_iteration);
+ CCTK_INFO ("---------------------------------------------------------");
+ }
}
}
@@ -321,5 +348,8 @@ static int Checkpoint (const cGH *GH, int called_from)
3, myGH->timers, timer_descriptions);
}
+ /* save the iteration number of this checkpoint */
+ myGH->last_checkpoint_iteration = GH->cctk_iteration;
+
return (retval);
}
diff --git a/src/ioHDF5GH.h b/src/ioHDF5GH.h
index 31c5fc0..533085f 100644
--- a/src/ioHDF5GH.h
+++ b/src/ioHDF5GH.h
@@ -19,13 +19,13 @@ typedef struct
{
/* how often to output */
- int out_every;
+ int out_every;
/* directory in which to output */
- char *out_dir;
+ char *out_dir;
/* the last iteration output */
- int *out_last;
+ int *out_last;
/* filename database for opened files */
pNamedData *open_output_files;
@@ -43,6 +43,9 @@ typedef struct
int cp_filename_index;
char **cp_filename_list;
+ /* iteration number of the last checkpoint */
+ int last_checkpoint_iteration;
+
} ioHDF5GH;
#ifdef __cplusplus