From 5fbb1a2ddf5382f7c8966c84db53678db7448c83 Mon Sep 17 00:00:00 2001 From: tradke Date: Fri, 22 Aug 2003 11:26:31 +0000 Subject: In IOBasic_ScalarOutputGH(), check only once whether steerable parameters have changed. This closes PR Cactus/1585. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@143 b589c3ab-70e8-4b4d-a09f-cba2dd200880 --- src/OutputScalar.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/OutputScalar.c b/src/OutputScalar.c index a744164..4ac6c5f 100644 --- a/src/OutputScalar.c +++ b/src/OutputScalar.c @@ -23,12 +23,22 @@ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusBase_IOBasic_OutputScalar_c) +/******************************************************************** + ******************** Static Variables ************************ + ********************************************************************/ +/* flag whether CheckSteerableParameters() needs to be called */ +static int check_steerable_parameters = 1; + + /******************************************************************** ******************** Internal Routines ************************ ********************************************************************/ static void CheckSteerableParameters (iobasicGH *myGH); +/******************************************************************** + ******************** External Routines ************************ + ********************************************************************/ /*@@ @routine IOBasic_ScalarOutputGH @date Sat March 6 1999 @@ -57,6 +67,7 @@ int IOBasic_ScalarOutputGH (const cGH *GH) iobasicGH *myGH; + /* check if any steerable parameters have changed */ myGH = CCTK_GHExtension (GH, "IOBasic"); CheckSteerableParameters (myGH); @@ -68,6 +79,9 @@ int IOBasic_ScalarOutputGH (const cGH *GH) retval = 0; + /* disable the check for steerable parameters during the following loop */ + check_steerable_parameters = 0; + /* loop over all variables */ for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--) { @@ -80,6 +94,9 @@ int IOBasic_ScalarOutputGH (const cGH *GH) } } + /* enable the check for steerable parameters for following calls */ + check_steerable_parameters = 1; + return (retval); } @@ -218,7 +235,11 @@ int IOBasic_TimeForScalarOutput (const cGH *GH, int vindex) /* Get the GH extension for IOBasic */ myGH = CCTK_GHExtension (GH, "IOBasic"); - CheckSteerableParameters (myGH); + /* only need to check steerable parameters if this flag is set */ + if (check_steerable_parameters) + { + CheckSteerableParameters (myGH); + } /* check if any output was requested */ if (myGH->outScalar_every <= 0 || GH->cctk_iteration % myGH->outScalar_every -- cgit v1.2.3