From e8f24ec4a38e4056962229c37ed2e4ed8cbbc611 Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 18 Sep 2000 20:06:56 +0000 Subject: Give a more explanatory warning message if output for a given variable was already done. Increased warning level to 5. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@66 b589c3ab-70e8-4b4d-a09f-cba2dd200880 --- src/Output.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 7 deletions(-) (limited to 'src/Output.c') diff --git a/src/Output.c b/src/Output.c index bff5c34..05541f9 100644 --- a/src/Output.c +++ b/src/Output.c @@ -55,14 +55,19 @@ int IOBasic_OutputGH (cGH *GH) /* Return if no output is required */ if (myGH->outScalar_every <= 0) + { return (0); + } /* Loop over all variables */ - for (index = 0; index < CCTK_NumVars (); index++) { + for (index = 0; index < CCTK_NumVars (); index++) + { /* Is it time for output ? */ if (! IOBasic_TimeForOutput (GH, index)) + { continue; + } /* Get the variable name for this index (for filename) */ name = CCTK_VarName (index); @@ -76,9 +81,13 @@ int IOBasic_OutputGH (cGH *GH) /* Make the IO call */ if (CCTK_GroupTypeFromVarI (index) == GROUP_SCALAR) + { IOBasic_Write (GH, index, name); + } else + { IOBasic_WriteGF (GH, index, name); + } /* Register GF as having 0D output this iteration */ myGH->outScalar_last [index] = GH->cctk_iteration; @@ -86,8 +95,6 @@ int IOBasic_OutputGH (cGH *GH) } /* end of loop over all variables */ return (0); - - } @@ -133,9 +140,13 @@ int IOBasic_OutputVarAs (cGH *GH, const char *fullname, const char *alias) #endif if (CCTK_GroupTypeFromVarI (index) == GROUP_SCALAR) + { IOBasic_Write (GH, index, alias); + } else + { IOBasic_WriteGF (GH, index, alias); + } return (0); } @@ -187,25 +198,62 @@ int IOBasic_TimeForOutput (cGH *GH, int index) /* check if any output was requested */ if (myGH->outScalar_every <= 0) + { return (0); + } grouptype = CCTK_GroupTypeFromVarI (index); /* Check this GF should be output */ if (myGH->do_outScalar [index] && (grouptype == GROUP_GF || grouptype == GROUP_SCALAR) - && (GH->cctk_iteration % myGH->outScalar_every == 0)) { + && (GH->cctk_iteration % myGH->outScalar_every == 0)) + { /* Check GF not already output this iteration */ if (myGH->outScalar_last [index] == GH->cctk_iteration) - CCTK_WARN (2, "Already done Scalar output in IO"); + { + char *fullname = CCTK_FullName (index); + + + CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING, + "Already done Scalar output for variable '%s' in current " + "iteration (probably via triggers)", fullname); + free (fullname); + } else + { return_type = 1; + } } return (return_type); } + +/*@@ + @routine IOBasic_TriggerOutput + @date Sat March 6 1999 + @author Gabrielle Allen + @desc + Triggers the output a variable using IOBasic's Scalar + output method + method + @enddesc + @calledby CCTK scheduler + @var GH + @vdesc Pointer to CCTK GH + @vtype cGH + @vio in + @vcomment + @endvar + @var index + @vdesc index of variable to output + @vtype int + @vio in + @vcomment + @endvar +@@*/ int IOBasic_TriggerOutput (cGH *GH, int index) { const char *name; @@ -225,9 +273,13 @@ int IOBasic_TriggerOutput (cGH *GH, int index) /* Do the Scalar output */ if (CCTK_GroupTypeFromVarI (index) == GROUP_SCALAR) + { IOBasic_Write (GH, index, name); + } else + { IOBasic_WriteGF (GH, index, name); + } /* Register variable as having Scalar output this iteration */ myGH->outScalar_last [index] = GH->cctk_iteration; @@ -247,17 +299,21 @@ static void CheckSteerableParameters (iobasicGH *myGH) /* How often to output */ myGH->outScalar_every = out_every > 0 ? out_every : -1; if (outScalar_every > 0) + { myGH->outScalar_every = outScalar_every; + } /* Check the 'outScalar_vars' parameter */ paramdata = CCTK_ParameterData ("outScalar_vars", CCTK_THORNSTRING); - if (! paramdata) { + if (! paramdata) + { CCTK_WARN (1, "Couldn't get info on parameter 'outScalar_vars'"); return; } /* re-parse the 'outScalar_vars' parameter if it was changed */ - if (paramdata->n_set != outScalar_vars_lastset) { + if (paramdata->n_set != outScalar_vars_lastset) + { IOUtil_ParseVarsForOutput (outScalar_vars, myGH->do_outScalar); /* Save the last setting of 'outScalar_vars' parameter */ -- cgit v1.2.3