aboutsummaryrefslogtreecommitdiff
path: root/src/Output.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Output.c')
-rw-r--r--src/Output.c109
1 files changed, 52 insertions, 57 deletions
diff --git a/src/Output.c b/src/Output.c
index 6e7e6f1..1a68fac 100644
--- a/src/Output.c
+++ b/src/Output.c
@@ -2,10 +2,10 @@
@file Output.c
@date Tue Jan 9 1999
@author Gabrielle Allen
- @desc
+ @desc
Functions to deal with streaming output of variables
in HDF5 format.
- @enddesc
+ @enddesc
@version $Id$
@@*/
@@ -24,7 +24,7 @@ CCTK_FILEVERSION(BetaThorns_IOStreamedHDF5_Output_c)
/********************************************************************
******************** Internal Routines ************************
********************************************************************/
-static void CheckSteerableParameters (ioStreamedHDF5GH *myGH);
+static void CheckSteerableParameters (const cGH *GH);
/*@@
@@ -59,36 +59,33 @@ int IOStreamedHDF5_OutputGH (const cGH *GH)
DECLARE_CCTK_PARAMETERS
- /* Get the GH extension for IOStreamedHDF5 */
myGH = (ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5");
- CheckSteerableParameters (myGH);
+ CheckSteerableParameters (GH);
if (myGH->out_every <= 0)
{
return (0);
}
- /* Loop over all variables */
+ /* loop over all variables */
for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++)
{
-
if (IOStreamedHDF5_TimeFor (GH, vindex))
{
-
name = CCTK_VarName (vindex);
fullname = CCTK_FullName (vindex);
if (verbose)
{
CCTK_VInfo (CCTK_THORNSTRING, "IOStreamedHDF5_OutputGH: "
- "output of variable (fullname / name) "
- "= ('%s' / '%s')", fullname, name);
+ "output of variable (fullname, name) = "
+ "('%s', '%s')", fullname, name);
}
if (IOStreamedHDF5_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++;
}
@@ -106,8 +103,8 @@ int IOStreamedHDF5_OutputGH (const cGH *GH)
@date Sat March 6 1999
@author Gabrielle Allen
@desc
- Unconditional output of a variable
- using the IOStreamedHDF5 output method.
+ Unconditional output of a variable using
+ the IOStreamedHDF5 I/O method.
@enddesc
@calls IOStreamedHDF5_Write
@@ -134,8 +131,7 @@ int IOStreamedHDF5_OutputGH (const cGH *GH)
return code of @seeroutine IOStreamedHDF5_Write
@endreturndesc
@@*/
-int IOStreamedHDF5_OutputVarAs (const cGH *GH,
- const char *fullname,
+int IOStreamedHDF5_OutputVarAs (const cGH *GH, const char *fullname,
const char *alias)
{
int vindex, retval;
@@ -147,11 +143,11 @@ int IOStreamedHDF5_OutputVarAs (const cGH *GH,
if (verbose)
{
CCTK_VInfo (CCTK_THORNSTRING, "IOStreamedHDF5_OutputVarAs: "
- "output of variable (fullname / alias) "
- "= ('%s' / '%s')", fullname, alias);
+ "output of variable (fullname, alias) = "
+ "('%s', '%s')", fullname, alias);
}
- /* Do the output */
+ /* do the output */
retval = IOStreamedHDF5_Write (GH, vindex, alias);
return (retval);
@@ -164,7 +160,7 @@ int IOStreamedHDF5_OutputVarAs (const cGH *GH,
@author Gabrielle Allen
@desc
Decides if it is time to output a variable
- using the IOStreamedHDF5 output method.
+ using the IOStreamedHDF5 I/O method.
@enddesc
@calls CheckSteerableParameters
@@ -182,41 +178,38 @@ int IOStreamedHDF5_OutputVarAs (const cGH *GH,
@returntype int
@returndesc
- 1 if output should take place
+ 1 if output should take place at this iteration, or<BR>
0 if not
@endreturndesc
@@*/
-int IOStreamedHDF5_TimeFor (const cGH *GH,
- int vindex)
+int IOStreamedHDF5_TimeFor (const cGH *GH, int vindex)
{
+ int retval;
+ char *fullname;
ioStreamedHDF5GH *myGH;
- /* Get the GH extension for IOStreamedHDF5 */
- myGH = (ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5");
-
- CheckSteerableParameters (myGH);
-
- /* Check if any output was requested */
- if(myGH->out_every <= 0)
- {
- return (0);
- }
-
- /* Check this variable should be output */
- if (! (myGH->geo_output[vindex] && GH->cctk_iteration % myGH->out_every == 0))
- {
- return (0);
- }
+ CheckSteerableParameters (GH);
- /* Check variable not already output this iteration */
- if (myGH->out_last[vindex] == GH->cctk_iteration)
+ /* check if this variable should be output */
+ myGH = (ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5");
+ retval = myGH->out_every > 0 && myGH->slablist[vindex] &&
+ GH->cctk_iteration % myGH->out_every == 0;
+ if (retval)
{
- CCTK_WARN (2, "Already done output in IOStreamedHDF5");
- 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 IOStreamedHDF5 output for variable '%s' in "
+ "current iteration (probably via triggers)", fullname);
+ free (fullname);
+ retval = 0;
+ }
}
- return (1);
+ return (retval);
}
@@ -226,7 +219,7 @@ int IOStreamedHDF5_TimeFor (const cGH *GH,
@author Gabrielle Allen
@desc
Triggers the output of a variable
- using the IOStreamedHDF5 output.
+ using the IOStreamedHDF5 I/O method.
@enddesc
@calls IOStreamedHDF5_Write
@@ -247,8 +240,7 @@ int IOStreamedHDF5_TimeFor (const cGH *GH,
return code of @seeroutine IOStreamedHDF5_Write
@endreturndesc
@@*/
-int IOStreamedHDF5_TriggerOutput (const cGH *GH,
- int vindex)
+int IOStreamedHDF5_TriggerOutput (const cGH *GH, int vindex)
{
int retval;
ioStreamedHDF5GH *myGH;
@@ -265,17 +257,17 @@ int IOStreamedHDF5_TriggerOutput (const cGH *GH,
{
fullname = CCTK_FullName (vindex);
CCTK_VInfo (CCTK_THORNSTRING, "IOStreamedHDF5_TriggerOutput: "
- "output of (varname, fullname) "
- "= ('%s', '%s')", varname, fullname);
+ "output of (varname, fullname) = "
+ "('%s', '%s')", varname, fullname);
free (fullname);
}
- /* Do the output */
+ /* do the output */
retval = IOStreamedHDF5_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;
}
@@ -297,20 +289,23 @@ int IOStreamedHDF5_TriggerOutput (const cGH *GH,
@calls IOHDF5Util_ParseVarsForOutput
- @var myGH
- @vdesc Pointer to IOStreamedHDF5 GH
- @vtype ioStreamedHDF5GH *
+ @var GH
+ @vdesc Pointer to CCTK grid hierarchy
+ @vtype const cGH *
@vio in
@endvar
@@*/
-static void CheckSteerableParameters (ioStreamedHDF5GH *myGH)
+static void CheckSteerableParameters (const cGH *GH)
{
- int type, times_set;
+ int times_set;
+ ioStreamedHDF5GH *myGH;
static int out_vars_lastset = -1, user_was_warned = 0;
DECLARE_CCTK_PARAMETERS
- /* How often to output */
+ myGH = (ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5");
+
+ /* how often to output */
if (out_every >= 0 || outHDF5_every >= 0)
{
if (out_every < 0)
@@ -340,7 +335,7 @@ static void CheckSteerableParameters (ioStreamedHDF5GH *myGH)
times_set = CCTK_ParameterQueryTimesSet ("out_vars", CCTK_THORNSTRING);
if (times_set != out_vars_lastset)
{
- IOHDF5Util_ParseVarsForOutput (out_vars, myGH->geo_output);
+ IOHDF5Util_ParseVarsForOutput (GH, out_vars, myGH->slablist);
/* Save the last setting of 'out_vars' parameter */
out_vars_lastset = times_set;