diff options
author | tradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d> | 2002-04-23 14:58:49 +0000 |
---|---|---|
committer | tradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d> | 2002-04-23 14:58:49 +0000 |
commit | 497188bef8ce0f21851dd3fa6ae777d58008d713 (patch) | |
tree | fad899d18c78684cd8da47f0f4c12537deb064be /src/Output.c | |
parent | 7109c2356053d465c8f920ff5fe9f82502200532 (diff) |
Code cleanup before moving into producion mode.
You must also update BetaThorns/IOHDF5Util now.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5/trunk@124 4825ed28-b72c-4eae-9704-e50c059e567d
Diffstat (limited to 'src/Output.c')
-rw-r--r-- | src/Output.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/src/Output.c b/src/Output.c index 6b6ef2c..d66dc55 100644 --- a/src/Output.c +++ b/src/Output.c @@ -2,9 +2,9 @@ @file Output.c @date Tue Jan 9 1999 @author Gabrielle Allen - @desc + @desc Functions to deal with output of variables in HDF5 file format - @enddesc + @enddesc @version $Id$ @@*/ @@ -23,7 +23,7 @@ CCTK_FILEVERSION(AlphaThorns_IOHDF5_Output_c) /******************************************************************** ******************** Internal Routines ************************ ********************************************************************/ -static void CheckSteerableParameters (ioHDF5GH *myGH); +static void CheckSteerableParameters (const cGH *GH); /*@@ @@ -58,10 +58,9 @@ int IOHDF5_OutputGH (const cGH *GH) DECLARE_CCTK_PARAMETERS - /* Get the GH extension for IOHDF5 */ myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); - CheckSteerableParameters (myGH); + CheckSteerableParameters (GH); if (myGH->out_every <= 0) { @@ -71,7 +70,6 @@ int IOHDF5_OutputGH (const cGH *GH) /* loop over all variables */ for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++) { - if (IOHDF5_TimeFor (GH, vindex)) { name = CCTK_VarName (vindex); @@ -85,7 +83,7 @@ int IOHDF5_OutputGH (const cGH *GH) if (IOHDF5_OutputVarAs (GH, fullname, name) == 0) { - /* Register variable as having output this iteration */ + /* register variable as having output this iteration */ myGH->out_last[vindex] = GH->cctk_iteration; retval++; } @@ -142,24 +140,24 @@ int IOHDF5_OutputVarAs (const cGH *GH, const char *fullname, const char *alias) if (verbose) { CCTK_VInfo (CCTK_THORNSTRING, "IOHDF5_OutputVarAs: fullname, alias, " - "index = (%s, %s, %d)", fullname, alias, vindex); + "index = (%s, %s, %d)", fullname, alias, vindex); } /* check whether the variable already has an I/O request entry */ myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); - oneshot = myGH->out_geo[vindex] == NULL; + oneshot = myGH->slablist[vindex] == NULL; if (oneshot) { - IOHDF5Util_ParseVarsForOutput (fullname, myGH->out_geo); + IOHDF5Util_ParseVarsForOutput (GH, fullname, myGH->slablist); } /* do the output */ retval = IOHDF5_Write (GH, vindex, alias); - if (oneshot && myGH->out_geo[vindex]) + if (oneshot && myGH->slablist[vindex]) { - free (myGH->out_geo[vindex]); - myGH->out_geo[vindex] = NULL; + free (myGH->slablist[vindex]); + myGH->slablist[vindex] = NULL; } return (retval); } @@ -200,13 +198,11 @@ int IOHDF5_TimeFor (const cGH *GH, int vindex) char *fullname; - /* get the GH extension for IOHDF5 */ - myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); - - CheckSteerableParameters (myGH); + CheckSteerableParameters (GH); /* check if this variable should be output */ - retval = myGH->out_every > 0 && myGH->out_geo[vindex] && + myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); + retval = myGH->out_every > 0 && myGH->slablist[vindex] && GH->cctk_iteration % myGH->out_every == 0; if (retval) { @@ -301,20 +297,23 @@ int IOHDF5_TriggerOutput (const cGH *GH, int vindex) @calls IOHDF5Util_ParseVarsForOutput - @var myGH - @vdesc Pointer to IOHDF5 GH - @vtype ioHDF5GH * + @var GH + @vdesc Pointer to CCTK grid hierarchy + @vtype const cGH * @vio in @endvar @@*/ -static void CheckSteerableParameters (ioHDF5GH *myGH) +static void CheckSteerableParameters (const cGH *GH) { int times_set; + ioHDF5GH *myGH; static int out_vars_lastset = -1, user_was_warned = 0; DECLARE_CCTK_PARAMETERS - /* How often to output */ + myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); + + /* how often to output */ if (out_every >= 0 || outHDF5_every >= 0) { if (out_every < 0) @@ -336,15 +335,14 @@ static void CheckSteerableParameters (ioHDF5GH *myGH) { myGH->out_every = *(const CCTK_INT *) CCTK_ParameterGet ("out_every", - CCTK_ImplementationThorn ("IO"), - NULL); + CCTK_ImplementationThorn ("IO"), NULL); } /* re-parse the 'IOHDF5::out_vars' parameter if it was changed */ times_set = CCTK_ParameterQueryTimesSet ("out_vars", CCTK_THORNSTRING); if (times_set != out_vars_lastset) { - IOHDF5Util_ParseVarsForOutput (out_vars, myGH->out_geo); + IOHDF5Util_ParseVarsForOutput (GH, out_vars, myGH->slablist); /* Save the last setting of 'out_vars' parameter */ out_vars_lastset = times_set; |