aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880>2001-09-05 08:37:57 +0000
committertradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880>2001-09-05 08:37:57 +0000
commit0bb0f59eb8307dcf85a2b75c06e6871bab8d9738 (patch)
tree10f077e8f16069b1f6e729ae826f126774fe9f78
parentbb8612ae0c144ec379e06f6ec52f27f6a2f134a7 (diff)
Reduced number of info messages by putting all into one using Util_asprintf().
This closes PR CactusBase-IOASCII 777. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@101 b589c3ab-70e8-4b4d-a09f-cba2dd200880
-rw-r--r--src/OutputInfo.c42
-rw-r--r--src/OutputScalar.c34
2 files changed, 54 insertions, 22 deletions
diff --git a/src/OutputInfo.c b/src/OutputInfo.c
index 5145c77..1684ce0 100644
--- a/src/OutputInfo.c
+++ b/src/OutputInfo.c
@@ -15,6 +15,7 @@
#include "cctk.h"
#include "cctk_Parameters.h"
+#include "util_String.h"
#include "iobasicGH.h"
/* the rcs ID and its dummy function to use it */
@@ -190,7 +191,7 @@ int IOBasic_TimeForInfoOutput (cGH *GH, int vindex)
{
DECLARE_CCTK_PARAMETERS
int retval;
- char *vname;
+ char *fullname;
iobasicGH *myGH;
@@ -212,11 +213,11 @@ int IOBasic_TimeForInfoOutput (cGH *GH, int vindex)
retval = myGH->outInfo_last[vindex] != GH->cctk_iteration;
if (! retval)
{
- vname = CCTK_FullName (vindex);
+ fullname = CCTK_FullName (vindex);
CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING,
"Already done Info output for '%s' in current "
- "iteration (probably via triggers)", vname);
- free (vname);
+ "iteration (probably via triggers)", fullname);
+ free (fullname);
}
}
@@ -571,23 +572,38 @@ static void PrintHeader (iobasicGH *myGH, int num_vars)
{
DECLARE_CCTK_PARAMETERS
int i, num_columns, vindex;
- char *vname;
+ char *fullname, *msg;
iobasic_reduction_t *reduction;
/* count number of info values to output */
num_columns = 0;
+ msg = NULL;
for (vindex = 0; vindex < num_vars; vindex++)
{
num_columns += myGH->info_reductions[vindex].num_reductions;
if (myGH->info_reductions[vindex].num_reductions > 0 &&
- CCTK_Equals (newverbose, "full"))
+ (CCTK_Equals (newverbose, "standard") ||
+ CCTK_Equals (newverbose, "full")))
{
- CCTK_VInfo (CCTK_THORNSTRING, "Info: Output requested for variable '%s'",
- CCTK_VarName (vindex));
+ fullname = CCTK_FullName (vindex);
+ if (! msg)
+ {
+ Util_asprintf (&msg, "Info: Output requested for %s", fullname);
+ }
+ else
+ {
+ Util_asprintf (&msg, "%s %s", msg, fullname);
+ }
+ free (fullname);
}
}
+ if (msg)
+ {
+ CCTK_INFO (msg);
+ free (msg);
+ }
/* draw a horizontal delimiter line */
printf ("------------------");
@@ -607,16 +623,16 @@ static void PrintHeader (iobasicGH *myGH, int num_vars)
i = myGH->info_reductions[vindex].num_reductions;
if (i > 0)
{
- vname = CCTK_FullName (vindex);
- if (strlen (vname) > (unsigned int) 15*i - 3)
+ fullname = CCTK_FullName (vindex);
+ if (strlen (fullname) > (unsigned int) 15*i - 3)
{
- printf (" *%s |", vname + strlen (vname) - (15*i - 4));
+ printf (" *%s |", fullname + strlen (fullname) - (15*i - 4));
}
else
{
- printf (" %-*s |", 15*i - 3, vname);
+ printf (" %-*s |", 15*i - 3, fullname);
}
- free (vname);
+ free (fullname);
}
}
}
diff --git a/src/OutputScalar.c b/src/OutputScalar.c
index ed9c149..6e23774 100644
--- a/src/OutputScalar.c
+++ b/src/OutputScalar.c
@@ -15,6 +15,7 @@
#include "cctk.h"
#include "cctk_Parameters.h"
+#include "util_String.h"
#include "iobasicGH.h"
static const char *rcsid = "$Header$";
@@ -288,9 +289,9 @@ int IOBasic_TriggerScalarOutput (cGH *GH, int vindex)
static void CheckSteerableParameters (iobasicGH *myGH)
{
DECLARE_CCTK_PARAMETERS
- int out_old;
+ int i, num_vars, out_old;
int times_set;
- int i;
+ char *fullname, *msg;
static int outScalar_vars_lastset = -1;
@@ -316,20 +317,35 @@ static void CheckSteerableParameters (iobasicGH *myGH)
times_set = CCTK_ParameterQueryTimesSet ("outScalar_vars", CCTK_THORNSTRING);
if (times_set != outScalar_vars_lastset)
{
- memset (myGH->do_outScalar, 0, CCTK_NumVars ());
+ num_vars = CCTK_NumVars ();
+ memset (myGH->do_outScalar, 0, num_vars);
CCTK_TraverseString (outScalar_vars, SetOutputFlag, myGH->do_outScalar,
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_outScalar[i])
- {
- CCTK_VInfo (CCTK_THORNSTRING,
- "Scalar: Output requested for %s",CCTK_FullName(i));
- }
+ if (myGH->do_outScalar[i])
+ {
+ fullname = CCTK_FullName (i);
+ if (! msg)
+ {
+ Util_asprintf (&msg, "Scalar: Output requested for %s", fullname);
+ }
+ else
+ {
+ Util_asprintf (&msg, "%s %s", msg, fullname);
+ }
+ free (fullname);
+ }
+ }
+ if (msg)
+ {
+ CCTK_INFO (msg);
+ free (msg);
}
}