diff options
Diffstat (limited to 'src/OutputScalar.c')
-rw-r--r-- | src/OutputScalar.c | 50 |
1 files changed, 16 insertions, 34 deletions
diff --git a/src/OutputScalar.c b/src/OutputScalar.c index 20c2695..b336f49 100644 --- a/src/OutputScalar.c +++ b/src/OutputScalar.c @@ -54,48 +54,31 @@ static void CheckSteerableParameters (iobasicGH *myGH); int IOBasic_ScalarOutputGH (const cGH *GH) { int vindex, retval; - const char *name; iobasicGH *myGH; - /* Get the GH extensions for IOBasic */ myGH = (iobasicGH *) CCTK_GHExtension (GH, "IOBasic"); - CheckSteerableParameters (myGH); - /* Return if no output is required */ + /* return if no output is required */ if (myGH->outScalar_every <= 0) { return (0); } - /* Loop over all variables */ - for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++) - { - /* Is it time for output ? */ - if (! IOBasic_TimeForScalarOutput (GH, vindex)) - { - continue; - } - - /* Get the variable name for this index (for filename) */ - name = CCTK_VarName (vindex); + retval = 0; -#ifdef IOBASIC_DEBUG - printf("\nIn IOBasic_ScalarOutputGH\n----------------\n"); - printf(" Index = %d\n",vindex); - printf(" Variable = -%s-\n",name); - printf(" Last output iteration was = %d\n",myGH->outScalar_last[vindex]); -#endif - - /* Make the IO call */ - if (IOBasic_WriteScalar (GH, vindex, name) == 0) + /* loop over all variables */ + for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--) + { + if (IOBasic_TimeForScalarOutput (GH, vindex) && + IOBasic_WriteScalar (GH, vindex, CCTK_VarName (vindex)) == 0) { - /* Register GF as having 0D output this iteration */ - myGH->outScalar_last [vindex] = GH->cctk_iteration; + /* register variable as having output this iteration */ + myGH->outScalar_last[vindex] = GH->cctk_iteration; retval++; } - } /* end of loop over all variables */ + } return (retval); } @@ -147,7 +130,7 @@ int IOBasic_TimeForScalarOutput (const cGH *GH, int vindex) else { /* Check if variable wasn't already output this iteration */ - retval = myGH->outScalar_last [vindex] != GH->cctk_iteration; + retval = myGH->outScalar_last[vindex] != GH->cctk_iteration; if (! retval) { fullname = CCTK_FullName (vindex); @@ -205,13 +188,12 @@ int IOBasic_TriggerScalarOutput (const cGH *GH, int vindex) printf (" Variable = -%s-\n", name); #endif - /* Do the Scalar output */ + /* do the Scalar output */ retval = IOBasic_WriteScalar (GH, vindex, name); - if (retval == 0) { - /* Register variable as having Scalar output this iteration */ - myGH->outScalar_last [vindex] = GH->cctk_iteration; + /* register variable as having Scalar output this iteration */ + myGH->outScalar_last[vindex] = GH->cctk_iteration; } return (retval); @@ -255,7 +237,7 @@ static void CheckSteerableParameters (iobasicGH *myGH) myGH->outScalar_every = outScalar_every >= 0 ? outScalar_every : out_every; /* report if frequency changed */ - if (myGH->outScalar_every != out_old && ! CCTK_Equals (newverbose, "none")) + if (myGH->outScalar_every != out_old && ! CCTK_Equals (verbose, "none")) { if (myGH->outScalar_every > 0) { @@ -313,7 +295,7 @@ static void CheckSteerableParameters (iobasicGH *myGH) { CCTK_WARN (1, "Failed to parse 'IOBasic::outScalar_vars' parameter"); } - else if (! CCTK_Equals (newverbose, "none")) + else if (! CCTK_Equals (verbose, "none")) { msg = NULL; for (vindex = 0; vindex < num_vars; vindex++) |