aboutsummaryrefslogtreecommitdiff
path: root/src/Output3D.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Output3D.c')
-rw-r--r--src/Output3D.c44
1 files changed, 17 insertions, 27 deletions
diff --git a/src/Output3D.c b/src/Output3D.c
index c2f8dc4..4cf537f 100644
--- a/src/Output3D.c
+++ b/src/Output3D.c
@@ -40,7 +40,7 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg);
IOASCII_Write3D
@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_Output3DGH (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_TimeFor3D (GH, vindex))
- {
- continue;
- }
-
- /* do the output */
- if (IOASCII_Write3D (GH, vindex, CCTK_VarName (vindex)) == 0)
+ if (IOASCII_TimeFor3D (GH, vindex) &&
+ IOASCII_Write3D (GH, vindex, CCTK_VarName (vindex)) == 0)
{
/* register variable as having 3D output this iteration */
myGH->out3D_last[vindex] = GH->cctk_iteration;
@@ -92,7 +87,7 @@ int IOASCII_Output3DGH (const cGH *GH)
@calls IOASCII_Write3D
@var GH
- @vdesc Pointer to CCTK GH
+ @vdesc pointer to CCTK GH
@vtype const cGH *
@vio in
@endvar
@@ -141,7 +136,7 @@ int IOASCII_Output3DVarAs (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
@@ -160,19 +155,17 @@ int IOASCII_Output3DVarAs (const cGH *GH, const char *fullname, const char *alia
int IOASCII_TimeFor3D (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->out3D_every[vindex] > 0 &&
- GH->cctk_iteration % myGH->out3D_every[vindex] == 0)
+ retval = myGH->out3D_every[vindex] > 0 &&
+ GH->cctk_iteration % myGH->out3D_every[vindex] == 0;
+ if (retval)
{
/* check if variable wasn't already output this iteration */
if (myGH->out3D_last[vindex] == GH->cctk_iteration)
@@ -182,10 +175,7 @@ int IOASCII_TimeFor3D (const cGH *GH, int vindex)
"Already done IOASCII 3D output for '%s' in current "
"iteration (probably via triggers)", fullname);
free (fullname);
- }
- else
- {
- retval = 1;
+ retval = 0;
}
}
@@ -204,7 +194,7 @@ int IOASCII_TimeFor3D (const cGH *GH, int vindex)
@calls IOASCII_Write3D
@var GH
- @vdesc Pointer to CCTK GH
+ @vdesc pointer to CCTK GH
@vtype const cGH *
@vio in
@endvar
@@ -252,7 +242,7 @@ static void CheckSteerableParameters (asciiioGH *myGH)
myGH->out3D_every_default = out3D_every >= 0 ? out3D_every : out_every;
/* report if frequency changed */
- if (myGH->out3D_every_default != i && ! CCTK_Equals (newverbose, "none"))
+ if (myGH->out3D_every_default != i && ! CCTK_Equals (verbose, "none"))
{
if (myGH->out3D_every_default > 0)
{
@@ -272,7 +262,7 @@ static void CheckSteerableParameters (asciiioGH *myGH)
memset (myGH->out3D_every, 0, num_vars * sizeof (int));
CCTK_TraverseString (out3D_vars, SetOutputFlag, myGH, CCTK_GROUP_OR_VAR);
- if (myGH->out3D_every_default == i || ! CCTK_Equals (newverbose, "none"))
+ if (myGH->out3D_every_default == i || ! CCTK_Equals (verbose, "none"))
{
msg = NULL;
for (i = 0; i < num_vars; i++)