diff options
Diffstat (limited to 'src/DumpGH.c')
-rw-r--r-- | src/DumpGH.c | 84 |
1 files changed, 43 insertions, 41 deletions
diff --git a/src/DumpGH.c b/src/DumpGH.c index 4599a82..dcec1a4 100644 --- a/src/DumpGH.c +++ b/src/DumpGH.c @@ -35,11 +35,18 @@ static const char *rcsid = "$Id$"; CCTK_FILEVERSION(BetaThorns_IOStreamedHDF5_DumpGH_c) -/* prototypes of routines defined in this source file */ -void IOStreamedHDF5_InitialDataCheckpoint (cGH *GH); -void IOStreamedHDF5_EvolutionCheckpoint (cGH *GH); -void IOStreamedHDF5_TerminationCheckpoint (cGH *GH); -static int IOStreamedHDF5_Checkpoint (cGH *GH, int called_from); +/******************************************************************** + ******************** External Routines ************************ + ********************************************************************/ +void IOStreamedHDF5_InitialDataCheckpoint (const cGH *GH); +void IOStreamedHDF5_EvolutionCheckpoint (const cGH *GH); +void IOStreamedHDF5_TerminationCheckpoint (const cGH *GH); + + +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ +static int Checkpoint (const cGH *GH, int called_from); /*@@ @@ -51,22 +58,22 @@ static int IOStreamedHDF5_Checkpoint (cGH *GH, int called_from); It checks if initial data should be checkpointed. @enddesc - @calls IOStreamedHDF5_Checkpoint + @calls Checkpoint @var GH @vdesc Pointer to CCTK grid hierarchy to be checkpointed - @vtype cGH * + @vtype const cGH * @vio in @endvar @@*/ -void IOStreamedHDF5_InitialDataCheckpoint (cGH *GH) +void IOStreamedHDF5_InitialDataCheckpoint (const cGH *GH) { DECLARE_CCTK_PARAMETERS if (checkpoint && checkpoint_ID) { - IOStreamedHDF5_Checkpoint (GH, CP_INITIAL_DATA); + Checkpoint (GH, CP_INITIAL_DATA); } } @@ -80,15 +87,15 @@ void IOStreamedHDF5_InitialDataCheckpoint (cGH *GH) It periodically checks if it's time to checkpoint evolution data. @enddesc - @calls IOStreamedHDF5_Checkpoint + @calls Checkpoint @var GH @vdesc Pointer to CCTK grid hierarchy to be checkpointed - @vtype cGH * + @vtype const cGH * @vio in @endvar @@*/ -void IOStreamedHDF5_EvolutionCheckpoint (cGH *GH) +void IOStreamedHDF5_EvolutionCheckpoint (const cGH *GH) { DECLARE_CCTK_PARAMETERS @@ -103,7 +110,7 @@ void IOStreamedHDF5_EvolutionCheckpoint (cGH *GH) CCTK_VInfo (CCTK_THORNSTRING, "Dumping periodic checkpoint file at " "iteration %d", GH->cctk_iteration); } - IOStreamedHDF5_Checkpoint (GH, CP_EVOLUTION_DATA); + Checkpoint (GH, CP_EVOLUTION_DATA); /* reset the 'checkpoint_next' parameter */ if (checkpoint_next) @@ -123,31 +130,31 @@ void IOStreamedHDF5_EvolutionCheckpoint (cGH *GH) It checks if the last iteration should be checkpointed. @enddesc - @calls IOStreamedHDF5_Checkpoint + @calls Checkpoint @var GH @vdesc Pointer to CCTK grid hierarchy to be checkpointed - @vtype cGH * + @vtype const cGH * @vio in @endvar @@*/ -void IOStreamedHDF5_TerminationCheckpoint (cGH *GH) +void IOStreamedHDF5_TerminationCheckpoint (const cGH *GH) { DECLARE_CCTK_PARAMETERS if (checkpoint && checkpoint_on_terminate) { - IOStreamedHDF5_Checkpoint (GH, CP_EVOLUTION_DATA); + Checkpoint (GH, CP_EVOLUTION_DATA); } } -/*****************************************************************************/ -/* local routines */ -/*****************************************************************************/ +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ /*@@ - @routine IOStreamedHDF5_Checkpoint + @routine Checkpoint @date Fri Oct 6 2000 @author Thomas Radke @desc @@ -161,7 +168,7 @@ void IOStreamedHDF5_TerminationCheckpoint (cGH *GH) @var GH @vdesc Pointer to CCTK grid hierarchy to be checkpointed - @vtype cGH * + @vtype const cGH * @vio in @endvar @var called_from @@ -176,34 +183,34 @@ void IOStreamedHDF5_TerminationCheckpoint (cGH *GH) or returncode of @seeroutine IOUtilHDF5_DumpGH @endreturndesc @@*/ -static int IOStreamedHDF5_Checkpoint (cGH *GH, int called_from) +static int Checkpoint (const cGH *GH, int called_from) { - DECLARE_CCTK_PARAMETERS hid_t file; - int old_ioproc; - int old_nioprocs; - int old_ioproc_every; + int old_ioproc, old_nioprocs, old_ioproc_every; fd_set readset; struct timeval timeout; ioGH *ioUtilGH; ioStreamedHDF5GH *myGH; CCTK_INT4 retval; + const char *timer_descriptions[3] = {"Time to dump parameters: ", + "Time to dump datasets: ", + "Total time to checkpoint:"}; + DECLARE_CCTK_PARAMETERS /* suppress compiler warning about unused variables */ - called_from = called_from; + (void) (called_from + 0); retval = 0; file = -1; - /* Get the GH extensions for IOUtil and IOStreamedHDF5 */ ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO"); myGH = (ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5"); - /* check if IOStreamedHDF5 was registered as IO method */ + /* check if IOStreamedHDF5 was registered as I/O method */ if (myGH == NULL) { - CCTK_WARN (2, "No IOStreamedHDF5 IO method registered"); + CCTK_WARN (2, "No IOStreamedHDF5 I/O method registered"); return (-1); } @@ -213,11 +220,11 @@ static int IOStreamedHDF5_Checkpoint (cGH *GH, int called_from) CCTK_TimerStartI (myGH->timers[CP_TOTAL_TIMER]); } - /* for now we can only have IO mode "oneproc" */ + /* for now we can only have I/O mode "oneproc" */ if (ioUtilGH->nioprocs != 1) { CCTK_WARN (2, "Output into multiple chunked files not yet implemented. " - "Switching to IO mode \"oneproc\"."); + "Switching to I/O mode \"oneproc\"."); } old_ioproc = ioUtilGH->ioproc; ioUtilGH->ioproc = 0; @@ -226,7 +233,7 @@ static int IOStreamedHDF5_Checkpoint (cGH *GH, int called_from) old_ioproc_every = ioUtilGH->ioproc_every; ioUtilGH->ioproc_every = CCTK_nProcs (GH); - /* Now open the file */ + /* now open the file */ if (CCTK_MyProc (GH) == ioUtilGH->ioproc && myGH->checkpoint_socket >= 0) { if (verbose) @@ -285,10 +292,10 @@ static int IOStreamedHDF5_Checkpoint (cGH *GH, int called_from) CCTK_VInfo (CCTK_THORNSTRING, "Closing checkpoint file on port %d", checkpoint_port); } - IOHDF5_ERROR (H5Fclose (file)); + HDF5_ERROR (H5Fclose (file)); } - /* restore original IO mode */ + /* restore original I/O mode */ ioUtilGH->ioproc = old_ioproc; ioUtilGH->nioprocs = old_nioprocs; ioUtilGH->ioproc_every = old_ioproc_every; @@ -296,11 +303,6 @@ static int IOStreamedHDF5_Checkpoint (cGH *GH, int called_from) /* stop the CP_TOTAL_TIMER timer and print timing information */ if (myGH->print_timing_info) { - const char *timer_descriptions[3] = {"Time to dump parameters: ", - "Time to dump datasets: ", - "Total time to checkpoint:"}; - - CCTK_TimerStopI (myGH->timers[CP_TOTAL_TIMER]); IOUtil_PrintTimings ("Timing information for checkpointing " "with IOStreamedHDF5:", |