diff options
-rw-r--r-- | src/Output1D.c | 43 | ||||
-rw-r--r-- | src/Output2D.c | 38 |
2 files changed, 56 insertions, 25 deletions
diff --git a/src/Output1D.c b/src/Output1D.c index 8f1e6dc..c77df14 100644 --- a/src/Output1D.c +++ b/src/Output1D.c @@ -14,6 +14,7 @@ #include "cctk.h" #include "cctk_Parameters.h" +#include "util_String.h" #include "ioASCIIGH.h" /* the rcs ID and its dummy function to use it */ @@ -266,12 +267,12 @@ int IOASCII_TriggerOutput1D (cGH *GH, int vindex) /* check if steerable parameters have changed */ static void CheckSteerableParameters (asciiioGH *myGH) { - int i; - int out_old; - int times_set; + int i, num_vars, out_old, times_set; + char *fullname, *msg; static int out1D_vars_lastset = -1; DECLARE_CCTK_PARAMETERS + out_old = myGH->out1D_every; /* How often to output */ @@ -282,7 +283,6 @@ static void CheckSteerableParameters (asciiioGH *myGH) } /* Report if frequency changed */ - if (myGH->out1D_every != out_old) { if (CCTK_Equals (newverbose, "standard") || @@ -291,27 +291,42 @@ static void CheckSteerableParameters (asciiioGH *myGH) CCTK_VInfo (CCTK_THORNSTRING, "IOASCII_1D: Output every %d iterations", myGH->out1D_every); } - out_old = myGH->out1D_every; } /* re-parse the 'out1D_vars' parameter if it was changed */ times_set = CCTK_ParameterQueryTimesSet ("out1D_vars", CCTK_THORNSTRING); if (times_set != out1D_vars_lastset) { - memset (myGH->do_out1D, 0, CCTK_NumVars ()); + num_vars = CCTK_NumVars (); + memset (myGH->do_out1D, 0, num_vars); CCTK_TraverseString (out1D_vars, SetOutputFlag, myGH->do_out1D, CCTK_GROUP_OR_VAR); if (CCTK_Equals (newverbose, "standard") || CCTK_Equals (newverbose, "full")) { - for (i=0;i<CCTK_NumVars();i++) + msg = NULL; + for (i = 0; i < num_vars; i++) + { + if (myGH->do_out1D[i]) + { + fullname = CCTK_FullName (i); + if (! msg) + { + Util_asprintf (&msg, "IOASCII_1D: Output requested for %s", + fullname); + } + else + { + Util_asprintf (&msg, "%s %s", msg, fullname); + } + free (fullname); + } + } + if (msg) { - if (myGH->do_out1D[i]) - { - CCTK_VInfo (CCTK_THORNSTRING, "IOASCII_1D: Output requested for %s", - CCTK_FullName(i)); - } + CCTK_INFO (msg); + free (msg); } } @@ -338,7 +353,7 @@ static int CheckOutputVar (int vindex) fullname = CCTK_FullName (vindex); CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, "CheckOutputVar: No IOASCII 1D output for '%s' (not a grid " - "function or an array)", fullname); + "function or an array)", fullname); free (fullname); } @@ -362,6 +377,6 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg) { CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING, "SetOutputFlag: Optional string '%s' in variable name ignored", - optstring); + optstring); } } diff --git a/src/Output2D.c b/src/Output2D.c index c0187e3..535d711 100644 --- a/src/Output2D.c +++ b/src/Output2D.c @@ -14,6 +14,7 @@ #include "cctk.h" #include "cctk_Parameters.h" +#include "util_String.h" #include "ioASCIIGH.h" /* the rcs ID and its dummy function to use it */ @@ -266,12 +267,12 @@ int IOASCII_TriggerOutput2D (cGH *GH, int vindex) /* check if steerable parameters have changed */ static void CheckSteerableParameters (asciiioGH *myGH) { - int i; - int out_old; - int times_set; + int i, out_old, times_set, num_vars; + char *fullname, *msg; static int out2D_vars_lastset = -1; DECLARE_CCTK_PARAMETERS + out_old = myGH->out2D_every; /* How often to output */ @@ -291,27 +292,42 @@ static void CheckSteerableParameters (asciiioGH *myGH) CCTK_VInfo (CCTK_THORNSTRING, "IOASCII_2D: Output every %d iterations", myGH->out2D_every); } - out_old = myGH->out2D_every; } /* re-parse the 'out2D_vars' parameter if it was changed */ times_set = CCTK_ParameterQueryTimesSet ("out2D_vars", CCTK_THORNSTRING); if (times_set != out2D_vars_lastset) { - memset (myGH->do_out2D, 0, CCTK_NumVars ()); + num_vars = CCTK_NumVars (); + memset (myGH->do_out2D, 0, num_vars); CCTK_TraverseString (out2D_vars, SetOutputFlag, myGH->do_out2D, CCTK_GROUP_OR_VAR); if (CCTK_Equals (newverbose, "standard") || CCTK_Equals (newverbose, "full")) { - for (i=0;i<CCTK_NumVars();i++) + msg = NULL; + for (i = 0; i < num_vars; i++) + { + if (myGH->do_out2D[i]) + { + fullname = CCTK_FullName (i); + if (! msg) + { + Util_asprintf (&msg, "IOASCII_2D: Output requested for %s", + fullname); + } + else + { + Util_asprintf (&msg, "%s %s", msg, fullname); + } + free (fullname); + } + } + if (msg) { - if (myGH->do_out2D[i]) - { - CCTK_VInfo (CCTK_THORNSTRING, "IOASCII_2D: Output requested for %s", - CCTK_FullName(i)); - } + CCTK_INFO (msg); + free (msg); } } |