diff options
author | tradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880> | 2000-02-25 16:46:34 +0000 |
---|---|---|
committer | tradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880> | 2000-02-25 16:46:34 +0000 |
commit | acb671b983d62e4284a69fa4e7818e05af0b63ad (patch) | |
tree | 9f460f685252bb7a2a9ae29cf964409780ff7b5c /src/Output.c | |
parent | 1846383accf3761522ff28362bebf98a2f075ada (diff) |
Some more stuff for steering parameters.
Thomas
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@37 b589c3ab-70e8-4b4d-a09f-cba2dd200880
Diffstat (limited to 'src/Output.c')
-rw-r--r-- | src/Output.c | 102 |
1 files changed, 84 insertions, 18 deletions
diff --git a/src/Output.c b/src/Output.c index 4f0afbf..12bfc9f 100644 --- a/src/Output.c +++ b/src/Output.c @@ -19,38 +19,44 @@ #include "iobasicGH.h" +/* function prototypes */ +int IOBasic_TimeForOutput (cGH *GH, int index); +static void CheckSteerableParameters (iobasicGH *myGH); + + +/*@@ + @routine IOBasic_OutputGH + @date Sat March 6 1999 + @author Gabrielle Allen + @desc + Loops over all variables and outputs them if necessary + @enddesc + @calledby CCTK_OutputGH ("IOBasic") + @history + + @endhistory + @var GH + @vdesc Pointer to CCTK GH + @vtype cGH + @vio in + @endvar +@@*/ int IOBasic_OutputGH (cGH *GH) { - DECLARE_CCTK_PARAMETERS int index; const char *name; iobasicGH *myGH; - cParamData *paramdata; - static int outScalar_vars_lastset = 0; /* Get the GH extensions for IOBasic */ myGH = (iobasicGH *) GH->extensions [CCTK_GHExtensionHandle ("IOBasic")]; + CheckSteerableParameters (myGH); + /* Return if no output is required */ if (myGH->outScalar_every <= 0) return (0); - /* Check the 'outScalar_vars' parameter */ - paramdata = CCTK_ParameterData ("outScalar_vars", CCTK_THORNSTRING); - if (! paramdata) { - CCTK_WARN (3, "Couldn't get info on parameter 'outScalar_vars'"); - return (0); - } - - /* re-parse the 'outScalar_vars' parameter if it was changed */ - if (paramdata->n_set != outScalar_vars_lastset) { - ParseVarsForOutput (outScalar_vars, myGH->do_outScalar); - - /* Save the last setting of 'outScalar_vars' parameter */ - outScalar_vars_lastset = paramdata->n_set; - } - /* Loop over all variables */ for (index = 0; index < CCTK_NumVars (); index++) { @@ -85,6 +91,33 @@ int IOBasic_OutputGH (cGH *GH) } +/*@@ + @routine IOBasic_OutputVarAs + @date Sat March 6 1999 + @author Gabrielle Allen + @desc + unconditional output of a variable using the IOBasic output method + @enddesc + @calledby IOBasic_OutputGH, CCTK_OutputVarAsByMethod ("IOBasic") + @var GH + @vdesc Pointer to CCTK GH + @vtype cGH + @vio in + @vcomment + @endvar + @var fullname + @vdesc complete name of variable to output + @vtype const char * + @vio in + @vcomment + @endvar + @var alias + @vdesc alias name of variable to output (used to generate output filename) + @vtype const char * + @vio in + @vcomment + @endvar +@@*/ int IOBasic_OutputVarAs (cGH *GH, const char *fullname, const char *alias) { int index; @@ -150,6 +183,8 @@ int IOBasic_TimeForOutput (cGH *GH, int index) /* Get the GH extension for IOBasic */ myGH = (iobasicGH *) GH->extensions [CCTK_GHExtensionHandle ("IOBasic")]; + CheckSteerableParameters (myGH); + grouptype = CCTK_GroupTypeFromVarI (index); /* Check this GF should be output */ @@ -195,3 +230,34 @@ int IOBasic_TriggerOutput (cGH *GH, int index) return (0); } + + +/**************************** local functions ******************************/ +static void CheckSteerableParameters (iobasicGH *myGH) +{ + DECLARE_CCTK_PARAMETERS + cParamData *paramdata; + static int outScalar_vars_lastset = 0; + + + /* 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) { + 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) { + ParseVarsForOutput (outScalar_vars, myGH->do_outScalar); + + /* Save the last setting of 'outScalar_vars' parameter */ + outScalar_vars_lastset = paramdata->n_set; + } + +} |