aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880>2002-03-16 22:19:30 +0000
committertradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880>2002-03-16 22:19:30 +0000
commitc2bb8f66f5839d328efb23807f52e8dc0c271fac (patch)
tree2704194138894d9330b1bc52d6d2de6f50fb0a15
parentf1d419cc71594cd0e4bb2ae426af55000712bb28 (diff)
Slightly more informative info messages.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@117 b589c3ab-70e8-4b4d-a09f-cba2dd200880
-rw-r--r--src/OutputInfo.c218
-rw-r--r--src/WriteInfo.c1
2 files changed, 24 insertions, 195 deletions
diff --git a/src/OutputInfo.c b/src/OutputInfo.c
index d737375..29580cb 100644
--- a/src/OutputInfo.c
+++ b/src/OutputInfo.c
@@ -9,7 +9,6 @@
@@*/
#include <math.h>
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
@@ -56,7 +55,6 @@ CCTK_FILEVERSION(CactusBase_IOBasic_OutputInfo_c)
******************** Internal Routines ************************
********************************************************************/
static void CheckSteerableParameters (iobasicGH *myGH);
-static void AssignReductionList (int vindex, const char *optstring, void *arg);
static void PrintHeader (iobasicGH *myGH, int num_vars);
@@ -218,8 +216,8 @@ int IOBasic_TimeForInfoOutput (const cGH *GH, int vindex)
{
fullname = CCTK_FullName (vindex);
CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Already done Info output for '%s' in current "
- "iteration (probably via triggers)", fullname);
+ "Already done Info output for '%s' in current iteration "
+ "(probably via triggers)", fullname);
free (fullname);
}
}
@@ -306,28 +304,32 @@ int IOBasic_TriggerInfoOutput (const cGH *GH, int vindex)
@@*/
static void CheckSteerableParameters (iobasicGH *myGH)
{
- DECLARE_CCTK_PARAMETERS
- int vindex, out_old, times_set, update_info_reductions_list;
+ int vindex, out_old, times_set, update_reductions_list;
iobasic_reduction_t *reduction, *next;
static int outInfo_vars_lastset = -1;
static int outInfo_reductions_lastset = -1;
+ iobasic_parseinfo_t info;
+ DECLARE_CCTK_PARAMETERS
/* how often to output */
out_old = myGH->outInfo_every;
- myGH->outInfo_every = out_every > 0 ? out_every : -1;
+ myGH->outInfo_every = out_every > 0 ? out_every : -1;
if (outInfo_every > 0)
{
myGH->outInfo_every = outInfo_every;
}
- if (myGH->outInfo_every != out_old)
+ if (myGH->outInfo_every != out_old && ! CCTK_Equals (newverbose, "none"))
{
- if (CCTK_Equals (newverbose, "standard") ||
- CCTK_Equals (newverbose, "full"))
+ if (myGH->outInfo_every > 0)
{
- CCTK_VInfo (CCTK_THORNSTRING, "Info: Output every %d iterations",
+ CCTK_VInfo (CCTK_THORNSTRING, "Info: Periodic output every %d iterations",
myGH->outInfo_every);
}
+ else
+ {
+ CCTK_INFO ("Info: Periodic output turned off");
+ }
}
/* return if there's nothing to do */
@@ -339,15 +341,15 @@ static void CheckSteerableParameters (iobasicGH *myGH)
/* check if the 'outInfo_reductions' parameter if it was changed */
times_set = CCTK_ParameterQueryTimesSet ("outInfo_reductions",
CCTK_THORNSTRING);
- update_info_reductions_list = times_set != outInfo_reductions_lastset;
+ update_reductions_list = times_set != outInfo_reductions_lastset;
outInfo_reductions_lastset = times_set;
/* check if the 'outInfo_vars' parameter if it was changed */
times_set = CCTK_ParameterQueryTimesSet ("outInfo_vars", CCTK_THORNSTRING);
- update_info_reductions_list |= times_set != outInfo_vars_lastset;
+ update_reductions_list |= times_set != outInfo_vars_lastset;
outInfo_vars_lastset = times_set;
- if (update_info_reductions_list)
+ if (update_reductions_list)
{
/* free old info output lists ... */
for (vindex = CCTK_NumVars ()-1; vindex >= 0; vindex--)
@@ -367,7 +369,9 @@ static void CheckSteerableParameters (iobasicGH *myGH)
}
/* ... and create new ones */
- if (CCTK_TraverseString (outInfo_vars, AssignReductionList, myGH,
+ info.reduction_list = myGH->info_reductions;
+ info.reductions_string = outInfo_reductions;
+ if (CCTK_TraverseString (outInfo_vars, IOBasic_AssignReductionList, &info,
CCTK_GROUP_OR_VAR) < 0)
{
CCTK_WARN (1, "Failed to parse 'IOBasic::outInfo_vars' parameter");
@@ -379,182 +383,6 @@ static void CheckSteerableParameters (iobasicGH *myGH)
/*@@
- @routine AssignReductionList
- @date Tue 31 Jul 2001
- @author Thomas Radke
- @desc
- Callback routine called by CCTK_TraverseString() to set the
- info output for a given variable.
- For CCTK_GF and CCTK_ARRAY variables, it builds a chained list
- of reduction operators according to the settings of 'optstring'
- or 'IOBasic::outInfo_reductions'.
- @enddesc
- @calls CCTK_GroupTypeFromVarI
- CCTK_ReductionHandle
-
- @var vindex
- @vdesc index of the variable to set info output
- @vtype int
- @vio in
- @endvar
- @var optstring
- @vdesc option string for this variable
- @vtype const char *
- @vio in
- @endvar
- @var arg
- @vdesc user-supplied argument to callback routine (IOBasic GH extension)
- @vtype void *
- @vio in
- @endvar
-@@*/
-static void AssignReductionList (int vindex, const char *optstring, void *arg)
-{
- DECLARE_CCTK_PARAMETERS
- iobasicGH *myGH = (iobasicGH *) arg;
- const char *string_start, *string_end;
- char *reduction_op, *reduction_op_list;
- int reduction_handle;
- iobasic_reductionlist_t *list;
- iobasic_reduction_t **new_reduction;
-
-
- list = &myGH->info_reductions[vindex];
-
- if (CCTK_GroupTypeFromVarI (vindex) == CCTK_SCALAR)
- {
- if (optstring)
- {
- CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING,
- "option list '%s' for variable '%s' ignored",
- optstring, CCTK_VarName (vindex));
- }
-
- list->reductions = (iobasic_reduction_t *)
- malloc (sizeof (iobasic_reduction_t));
- if (strncmp (CCTK_VarTypeName (CCTK_VarTypeI (vindex)),
- "CCTK_VARIABLE_COMPLEX", 21))
- {
- list->num_reductions = 1;
- list->reductions->name = strdup ("scalar value");
- list->reductions->next = NULL;
- }
- else
- {
- list->num_reductions = 2;
- list->reductions->name = strdup ("real part");
- list->reductions->next = (iobasic_reduction_t *)
- malloc (sizeof (iobasic_reduction_t));
- list->reductions->next->name = strdup ("imag part");
- list->reductions->next->next = NULL;
- }
-
-#ifdef IOBASIC_DEBUG
- printf ("Set info scalar output for variable '%s'\n", CCTK_VarName(vindex));
-#endif
-
- return;
- }
-
- /* initialize to empty list */
- list->num_reductions = 0;
- list->reductions = NULL;
-
- if (optstring)
- {
- if (strncmp (optstring, "reductions=<", 12) == 0 &&
- optstring[strlen (optstring) - 1] == '>')
- {
- reduction_op_list = strdup (optstring + 12);
- reduction_op_list[strlen (reduction_op_list) - 1] = 0;
- }
- else
- {
- CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING,
- "AssignReductionList: invalid syntax for option list '%s'",
- optstring);
- return;
- }
- }
- else
- {
- reduction_op_list = strdup (outInfo_reductions);
- }
-
- /* now loop over all reduction operators */
- string_start = reduction_op_list;
- reduction_op = (char *) malloc (strlen (string_start) + 1);
- while (string_start && *string_start)
- {
- /* skip leading spaces */
- while (isspace ((int) *string_start))
- {
- string_start++;
- }
- if (! *string_start)
- {
- break;
- }
-
- /* advance to end of the operator string */
- string_end = string_start + 1;
- while (*string_end && ! isspace ((int) *string_end))
- {
- string_end++;
- }
-
- /* copy the operator string */
- strncpy (reduction_op, string_start, string_end - string_start);
- reduction_op[string_end - string_start] = 0;
- string_start = string_end;
-
- /* get the reduction handle from the reduction operator */
- reduction_handle = CCTK_ReductionHandle (reduction_op);
- if (reduction_handle < 0)
- {
- CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING,
- "AssignReductionList: Invalid reduction operator '%s'",
- reduction_op);
- continue;
- }
-
- /* add new reduction to end of list */
- new_reduction = &list->reductions;
- while (*new_reduction)
- {
- if (strcmp ((*new_reduction)->name, reduction_op) == 0)
- {
- new_reduction = NULL;
- break;
- }
- new_reduction = &((*new_reduction)->next);
- }
- if (new_reduction == NULL)
- {
- CCTK_VWarn (3, __LINE__, __FILE__, CCTK_THORNSTRING,
- "AssignReductionList: Duplicate reduction operator '%s' will "
- "be ignored", reduction_op);
- continue;
- }
-
- *new_reduction = (iobasic_reduction_t *) malloc (sizeof (iobasic_reduction_t));
- (*new_reduction)->handle = reduction_handle;
- (*new_reduction)->name = strdup (reduction_op);
- (*new_reduction)->next = NULL;
- list->num_reductions++;
-
-#ifdef IOBASIC_DEBUG
- printf ("Set info reduction output '%s' for variable '%s'\n",
- (*new_reduction)->name, CCTK_VarName (vindex));
-#endif
- }
-
- free (reduction_op_list);
- free (reduction_op);
-}
-
-
- /*@@
@routine PrintHeader
@date Tue 31 Jul 2001
@author Thomas Radke
@@ -591,18 +419,18 @@ static void PrintHeader (iobasicGH *myGH, int num_vars)
num_columns += myGH->info_reductions[vindex].num_reductions;
if (myGH->info_reductions[vindex].num_reductions > 0 &&
- (CCTK_Equals (newverbose, "standard") ||
- CCTK_Equals (newverbose, "full")))
+ ! CCTK_Equals (newverbose, "none"))
{
fullname = CCTK_FullName (vindex);
if (! msg)
{
- Util_asprintf (&msg, "Info: Output requested for %s", fullname);
+ Util_asprintf (&msg, "Info: Periodic output requested for '%s'",
+ fullname);
}
else
{
oldmsg = msg;
- Util_asprintf (&msg, "%s %s", oldmsg, fullname);
+ Util_asprintf (&msg, "%s, '%s'", oldmsg, fullname);
free (oldmsg);
}
free (fullname);
diff --git a/src/WriteInfo.c b/src/WriteInfo.c
index 27bc3ce..977f548 100644
--- a/src/WriteInfo.c
+++ b/src/WriteInfo.c
@@ -83,6 +83,7 @@ int IOBasic_WriteInfo (const cGH *GH, int vindex)
"IOBasic_WriteInfo: No info output for '%s' (no storage)",
fullname);
free (fullname);
+
/* invalidate data buffer for this variable */
while (reduction)
{