aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d>2002-04-17 17:53:47 +0000
committertradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d>2002-04-17 17:53:47 +0000
commit2cc8b63d384fcbd4c06b6df338e941030aa6514a (patch)
treee2a3b72b1d21707631cccd6fb9b9fd3471160972 /src
parent522f2c28f8b871af4ae0cc1382737e2846338df1 (diff)
Some more tidying up.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5/trunk@119 4825ed28-b72c-4eae-9704-e50c059e567d
Diffstat (limited to 'src')
-rw-r--r--src/DumpGH.c20
-rw-r--r--src/Output.c50
-rw-r--r--src/Write.c10
3 files changed, 38 insertions, 42 deletions
diff --git a/src/DumpGH.c b/src/DumpGH.c
index 048c6ed..1fb342d 100644
--- a/src/DumpGH.c
+++ b/src/DumpGH.c
@@ -29,7 +29,7 @@
#endif
/* the rcs ID and its dummy function to use it */
-static const char *rcsid = "$Id$";
+static const char *rcsid = "$Header$";
CCTK_FILEVERSION(AlphaThorns_IOHDF5_DumpGH_c)
@@ -44,7 +44,7 @@ void IOHDF5_TerminationCheckpoint (cGH *GH);
/********************************************************************
******************** Internal Routines ************************
********************************************************************/
-static int IOHDF5_Checkpoint (cGH *GH, int called_from);
+static int Checkpoint (cGH *GH, int called_from);
/*@@
@@ -56,7 +56,7 @@ static int IOHDF5_Checkpoint (cGH *GH, int called_from);
It checks if initial data should be checkpointed.
@enddesc
- @calls IOHDF5_Checkpoint
+ @calls Checkpoint
@var GH
@vdesc Pointer to CCTK grid hierarchy
@@ -71,7 +71,7 @@ void IOHDF5_InitialDataCheckpoint (cGH *GH)
if (checkpoint && checkpoint_ID)
{
- IOHDF5_Checkpoint (GH, CP_INITIAL_DATA);
+ Checkpoint (GH, CP_INITIAL_DATA);
}
}
@@ -85,7 +85,7 @@ void IOHDF5_InitialDataCheckpoint (cGH *GH)
It periodically checks if it's time to checkpoint evolution data.
@enddesc
- @calls IOHDF5_Checkpoint
+ @calls Checkpoint
@var GH
@vdesc Pointer to CCTK grid hierarchy
@@ -108,7 +108,7 @@ void IOHDF5_EvolutionCheckpoint (cGH *GH)
CCTK_VInfo (CCTK_THORNSTRING, "Dumping periodic checkpoint file at "
"iteration %d", GH->cctk_iteration);
}
- IOHDF5_Checkpoint (GH, CP_EVOLUTION_DATA);
+ Checkpoint (GH, CP_EVOLUTION_DATA);
/* reset the 'checkpoint_next' parameter */
if (checkpoint_next)
@@ -128,7 +128,7 @@ void IOHDF5_EvolutionCheckpoint (cGH *GH)
It checks if the last iteration should be checkpointed.
@enddesc
- @calls IOHDF5_Checkpoint
+ @calls Checkpoint
@var GH
@vdesc Pointer to CCTK grid hierarchy
@@ -143,7 +143,7 @@ void IOHDF5_TerminationCheckpoint (cGH *GH)
if (checkpoint && checkpoint_on_terminate)
{
- IOHDF5_Checkpoint (GH, CP_EVOLUTION_DATA);
+ Checkpoint (GH, CP_EVOLUTION_DATA);
}
}
@@ -152,7 +152,7 @@ void IOHDF5_TerminationCheckpoint (cGH *GH)
******************** Internal Routines ************************
********************************************************************/
/*@@
- @routine IOHDF5_Checkpoint
+ @routine Checkpoint
@date Fri Aug 21 15:13:13 1998
@author Paul Walker
@desc
@@ -182,7 +182,7 @@ void IOHDF5_TerminationCheckpoint (cGH *GH)
or returncode of @seeroutine IOUtilHDF5_DumpGH
@endreturndesc
@@*/
-static int IOHDF5_Checkpoint (cGH *GH, int called_from)
+static int Checkpoint (cGH *GH, int called_from)
{
hid_t file;
int myproc;
diff --git a/src/Output.c b/src/Output.c
index 9f91ae0..02ef16e 100644
--- a/src/Output.c
+++ b/src/Output.c
@@ -68,7 +68,7 @@ int IOHDF5_OutputGH (const cGH *GH)
return (0);
}
- /* Loop over all variables */
+ /* loop over all variables */
for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++)
{
@@ -153,7 +153,7 @@ int IOHDF5_OutputVarAs (const cGH *GH, const char *fullname, const char *alias)
IOHDF5Util_ParseVarsForOutput (fullname, myGH->out_geo);
}
- /* Do the output */
+ /* do the output */
retval = IOHDF5_Write (GH, vindex, alias);
if (oneshot && myGH->out_geo[vindex])
@@ -171,7 +171,7 @@ int IOHDF5_OutputVarAs (const cGH *GH, const char *fullname, const char *alias)
@author Gabrielle Allen
@desc
Decides if it is time to output a variable
- using the IOHDF5 output method.
+ using the IOHDF5 I/O method.
@enddesc
@calls CheckSteerableParameters
@@ -195,38 +195,34 @@ int IOHDF5_OutputVarAs (const cGH *GH, const char *fullname, const char *alias)
@@*/
int IOHDF5_TimeFor (const cGH *GH, int vindex)
{
+ int retval;
ioHDF5GH *myGH;
char *fullname;
- /* Get the GH extension for IOHDF5 */
+ /* get the GH extension for IOHDF5 */
myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5");
CheckSteerableParameters (myGH);
- /* Check if any output was requested */
- if(myGH->out_every <= 0)
- {
- return (0);
- }
-
- /* Check this variable should be output */
- if (! (myGH->out_geo[vindex] && GH->cctk_iteration % myGH->out_every == 0))
- {
- return (0);
- }
-
- /* Check variable not already output this iteration */
- if (myGH->out_last[vindex] == GH->cctk_iteration)
+ /* check if this variable should be output */
+ retval = myGH->out_every > 0 && myGH->out_geo[vindex] &&
+ GH->cctk_iteration % myGH->out_every == 0;
+ if (retval)
{
- fullname = CCTK_FullName (vindex);
- CCTK_VWarn (6, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Already done IOHDF5 output for variable '%s'", fullname);
- free (fullname);
- return (0);
+ /* check if variable was not already output this iteration */
+ if (myGH->out_last[vindex] == GH->cctk_iteration)
+ {
+ fullname = CCTK_FullName (vindex);
+ CCTK_VWarn (6, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Already done IOHDF5 output for variable '%s' in current "
+ "iteration (probably via triggers)", fullname);
+ free (fullname);
+ retval = 0;
+ }
}
- return (1);
+ return (retval);
}
@@ -235,7 +231,7 @@ int IOHDF5_TimeFor (const cGH *GH, int vindex)
@date Sat March 6 1999
@author Gabrielle Allen
@desc
- Triggers the output of a variable using the IOHDF5 output.
+ Triggers the output of a variable using the IOHDF5 I/O method.
@enddesc
@calls IOHDF5_Write
@@ -278,12 +274,12 @@ int IOHDF5_TriggerOutput (const cGH *GH, int vindex)
free (fullname);
}
- /* Do the output */
+ /* do the output */
retval = IOHDF5_Write (GH, vindex, varname);
if (retval == 0)
{
- /* Register variable as having output this iteration */
+ /* register variable as having output this iteration */
myGH->out_last[vindex] = GH->cctk_iteration;
}
diff --git a/src/Write.c b/src/Write.c
index 8eea1bc..69454fa 100644
--- a/src/Write.c
+++ b/src/Write.c
@@ -64,7 +64,7 @@ static char *IOHDF5_GetFilename (const cGH *GH,
@returntype int
@returndesc
- 0 for success, or<BR>
+ return code of @seeroutine IOHDF5Util_DumpVar, or<BR>
-1 if no storage was assigned to variable<BR>
-2 if filename couldn't be built from alias
@endreturndesc
@@ -74,7 +74,7 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias)
ioGH *ioUtilGH;
ioHDF5GH *myGH;
hid_t file, plist;
- int is_new_file;
+ int is_new_file, retval;
char *filename, *fullname;
DECLARE_CCTK_PARAMETERS
@@ -166,8 +166,8 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias)
}
/* output the data */
- IOHDF5Util_DumpVar (GH, vindex, 0, myGH->out_geo[vindex], file,
- myGH->check_exisiting_objects[vindex]);
+ retval = IOHDF5Util_DumpVar (GH, vindex, 0, myGH->out_geo[vindex], file,
+ myGH->check_exisiting_objects[vindex]);
/* close the file */
if (file >= 0)
@@ -186,7 +186,7 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias)
free (filename);
}
- return (0);
+ return (retval);
}