diff options
Diffstat (limited to 'src/Output2D.c')
-rw-r--r-- | src/Output2D.c | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/src/Output2D.c b/src/Output2D.c index f62a635..80788a7 100644 --- a/src/Output2D.c +++ b/src/Output2D.c @@ -40,7 +40,7 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg); IOASCII_Write2D @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -54,22 +54,17 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg); int IOASCII_Output2DGH (const cGH *GH) { int vindex, retval; - asciiioGH *myGH; + const asciiioGH *myGH; - myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); + retval = 0; + myGH = (const asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); /* loop over all variables */ - for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++) + for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--) { - /* check if this variable should be output */ - if (! IOASCII_TimeFor2D (GH, vindex)) - { - continue; - } - - /* do the output */ - if (IOASCII_Write2D (GH, vindex, CCTK_VarName (vindex)) == 0) + if (IOASCII_TimeFor2D (GH, vindex) && + IOASCII_Write2D (GH, vindex, CCTK_VarName (vindex)) == 0) { /* register variable as having 2D output this iteration */ myGH->out2D_last[vindex] = GH->cctk_iteration; @@ -92,7 +87,7 @@ int IOASCII_Output2DGH (const cGH *GH) @calls IOASCII_Write2D @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -140,7 +135,7 @@ int IOASCII_Output2DVarAs (const cGH *GH, const char *fullname, const char *alia @enddesc @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -159,19 +154,17 @@ int IOASCII_Output2DVarAs (const cGH *GH, const char *fullname, const char *alia int IOASCII_TimeFor2D (const cGH *GH, int vindex) { int retval; - asciiioGH *myGH; char *fullname; + asciiioGH *myGH; - /* default is not do any output */ - retval = 0; - myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); CheckSteerableParameters (myGH); /* check if this variable should be output */ - if (myGH->out2D_every[vindex] > 0 && - GH->cctk_iteration % myGH->out2D_every[vindex] == 0) + retval = myGH->out2D_every[vindex] > 0 && + GH->cctk_iteration % myGH->out2D_every[vindex] == 0; + if (retval) { /* check if variable wasn't already output this iteration */ if (myGH->out2D_last[vindex] == GH->cctk_iteration) @@ -181,10 +174,7 @@ int IOASCII_TimeFor2D (const cGH *GH, int vindex) "Already done IOASCII 2D output for '%s' in current " "iteration (probably via triggers)", fullname); free (fullname); - } - else - { - retval = 1; + retval = 0; } } @@ -203,7 +193,7 @@ int IOASCII_TimeFor2D (const cGH *GH, int vindex) @calls IOASCII_Write2D @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -251,7 +241,7 @@ static void CheckSteerableParameters (asciiioGH *myGH) myGH->out2D_every_default = out2D_every >= 0 ? out2D_every : out_every; /* report if frequency changed */ - if (myGH->out2D_every_default != i && ! CCTK_Equals (newverbose, "none")) + if (myGH->out2D_every_default != i && ! CCTK_Equals (verbose, "none")) { if (myGH->out2D_every_default > 0) { @@ -271,7 +261,7 @@ static void CheckSteerableParameters (asciiioGH *myGH) memset (myGH->out2D_every, 0, num_vars * sizeof (int)); CCTK_TraverseString (out2D_vars, SetOutputFlag, myGH, CCTK_GROUP_OR_VAR); - if (myGH->out2D_every_default == i || ! CCTK_Equals (newverbose, "none")) + if (myGH->out2D_every_default == i || ! CCTK_Equals (verbose, "none")) { msg = NULL; for (i = 0; i < num_vars; i++) |