diff options
author | tradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a> | 2000-02-25 17:12:57 +0000 |
---|---|---|
committer | tradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a> | 2000-02-25 17:12:57 +0000 |
commit | 0e96493692789d2492379290fdbf2e4a7e72aceb (patch) | |
tree | c662ec7528fd06bda4482ae58a6669cfdf046175 /src/Output2D.c | |
parent | 5c5bb01905900966cc2aef4c9ba424694a63194b (diff) |
More stuff for steering parameters.
Thomas
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@94 ebee0441-1374-4afa-a3b5-247f3ba15b9a
Diffstat (limited to 'src/Output2D.c')
-rw-r--r-- | src/Output2D.c | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/src/Output2D.c b/src/Output2D.c index 735ae5f..efb1366 100644 --- a/src/Output2D.c +++ b/src/Output2D.c @@ -21,9 +21,10 @@ #include "ioFlexGH.h" -/* local function prototypes */ +/* function prototypes */ int IOFlexIO_Output2DVarAs (cGH *GH, const char *var, const char *alias); int IOFlexIO_TimeFor2D (cGH *GH, int index); +static void CheckSteerableParameters (flexioGH *myGH); /*@@ @@ -52,32 +53,15 @@ int IOFlexIO_Output2DGH (cGH *GH) flexioGH *myGH; const char *name; char *fullname; - cParamData *paramdata; - static int out2D_vars_lastset = 0; /* Get the GH extension for IOFlexIO */ myGH = (flexioGH *) GH->extensions [CCTK_GHExtensionHandle ("IOFlexIO")]; - if (myGH->out2D_every <= 0) - return (0); + CheckSteerableParameters (myGH); - /* Check the 'out2D_vars' parameter */ - paramdata = CCTK_ParameterData ("out2D_vars", CCTK_THORNSTRING); - if (! paramdata) - { - CCTK_WARN (2, "Couldn't get info on parameter 'out2D_vars'"); + if (myGH->out2D_every <= 0) return (0); - } - - /* re-parse the 'out2D_vars' parameter if it was changed */ - if (paramdata->n_set != out2D_vars_lastset) - { - ParseVarsForOutput (out2D_vars, myGH->do_out2D); - - /* Save the last setting of 'out2D_vars' parameter */ - out2D_vars_lastset = paramdata->n_set; - } /* Loop over all variables */ for (i = 0; i < CCTK_NumVars (); i++) { @@ -196,6 +180,8 @@ int IOFlexIO_TimeFor2D (cGH *GH, int index) /* Get the GH extension for IOUtil and IOFlexIO */ myGH = (flexioGH *) GH->extensions [CCTK_GHExtensionHandle ("IOFlexIO")]; + CheckSteerableParameters (myGH); + /* Check this GF should be output */ if (! (CCTK_GroupTypeFromVarI (index) == GROUP_GF && myGH->do_out2D [index] && GH->cctk_iteration % myGH->out2D_every == 0)) @@ -263,5 +249,37 @@ int IOFlexIO_TriggerOutput2D (cGH *GH, int index) return (0); - +} + + +/**************************** local functions ******************************/ +static void CheckSteerableParameters (flexioGH *myGH) +{ + DECLARE_CCTK_PARAMETERS + cParamData *paramdata; + static int out2D_vars_lastset = 0; + + + /* How often to output */ + myGH->out2D_every = out_every > 0 ? out_every : -1; + if (out2D_every > 0) + myGH->out2D_every = out2D_every; + + /* Check the 'out2D_vars' parameter */ + paramdata = CCTK_ParameterData ("out2D_vars", CCTK_THORNSTRING); + if (! paramdata) + { + CCTK_WARN (1, "Couldn't get info on parameter 'out2D_vars'"); + return; + } + + /* re-parse the 'out2D_vars' parameter if it was changed */ + if (paramdata->n_set != out2D_vars_lastset) + { + ParseVarsForOutput (out2D_vars, myGH->do_out2D); + + /* Save the last setting of 'out2D_vars' parameter */ + out2D_vars_lastset = paramdata->n_set; + } + } |