aboutsummaryrefslogtreecommitdiff
path: root/src/OutputInfo.c
diff options
context:
space:
mode:
authortradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880>2000-02-25 16:46:34 +0000
committertradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880>2000-02-25 16:46:34 +0000
commitacb671b983d62e4284a69fa4e7818e05af0b63ad (patch)
tree9f460f685252bb7a2a9ae29cf964409780ff7b5c /src/OutputInfo.c
parent1846383accf3761522ff28362bebf98a2f075ada (diff)
Some more stuff for steering parameters.
Thomas git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@37 b589c3ab-70e8-4b4d-a09f-cba2dd200880
Diffstat (limited to 'src/OutputInfo.c')
-rw-r--r--src/OutputInfo.c55
1 files changed, 47 insertions, 8 deletions
diff --git a/src/OutputInfo.c b/src/OutputInfo.c
index 77f6d31..bff52dd 100644
--- a/src/OutputInfo.c
+++ b/src/OutputInfo.c
@@ -28,6 +28,9 @@ CCTK_REAL IOBasic_WriteInfo (cGH *GH, int index, const char *operator,
#define DECIMAL_PRECISION 1.0e-8
#define USE_DECIMAL_NOTATION(x) ((fabs (x) > DECIMAL_PRECISION) || ((x) == 0.0))
+/* static variables */
+static int outInfo_vars_lastset = 0;
+
/*@@
@routine IOBasic_OutputInfoGH
@@ -56,12 +59,16 @@ int IOBasic_OutputInfoGH (cGH *GH)
const char *name;
iobasicGH *myGH;
cParamData *paramdata;
- static int outInfo_vars_lastset = 0;
/* Get the GH extensions for IOBasic */
myGH = (iobasicGH *) GH->extensions [CCTK_GHExtensionHandle ("IOBasic")];
+ /* How often to output */
+ myGH->outInfo_every = out_every > 0 ? out_every : -1;
+ if (outInfo_every > 0)
+ myGH->outInfo_every = outInfo_every;
+
/* Return if no output is required */
if (myGH->outInfo_every < 1 ||
GH->cctk_iteration % myGH->outInfo_every != 0)
@@ -73,7 +80,7 @@ int IOBasic_OutputInfoGH (cGH *GH)
paramdata = CCTK_ParameterData ("outInfo_vars", CCTK_THORNSTRING);
if (! paramdata)
{
- CCTK_WARN (3, "Couldn't get info on parameter 'outInfo_vars'");
+ CCTK_WARN (1, "Couldn't get info on parameter 'outInfo_vars'");
return (0);
}
@@ -81,10 +88,22 @@ int IOBasic_OutputInfoGH (cGH *GH)
and also print a header */
if (paramdata->n_set != outInfo_vars_lastset)
{
+ int do_outInfo;
char l1[1024],l2[1024],l3[1024];
ParseVarsForOutput (outInfo_vars, myGH->do_outInfo);
+ /* Save the last setting of 'outInfo_vars' parameter */
+ outInfo_vars_lastset = paramdata->n_set;
+
+ do_outInfo = 0;
+ for (i = 0; i < CCTK_NumVars (); i++)
+ do_outInfo |= myGH->do_outInfo [i];
+
+ /* suppress any output if there are no variables to output */
+ if (! do_outInfo)
+ return (0);
+
sprintf (l1," it | |");
sprintf (l2," | t |");
sprintf (l3,"----------------");
@@ -102,9 +121,6 @@ int IOBasic_OutputInfoGH (cGH *GH)
}
printf ("%s\n%s\n%s\n%s\n",l3,l1,l2,l3);
fflush(stdout);
-
- /* Save the last setting of 'outInfo_vars' parameter */
- outInfo_vars_lastset = paramdata->n_set;
}
/* Print the iteration/timestep information for all variables */
@@ -214,6 +230,9 @@ int IOBasic_TimeForInfo (cGH *GH, int var)
{
int return_type;
iobasicGH *myGH;
+ cParamData *paramdata;
+ DECLARE_CCTK_PARAMETERS
+
/* Default is do not do output */
return_type = 0;
@@ -221,6 +240,29 @@ int IOBasic_TimeForInfo (cGH *GH, int var)
/* Get the GH extensions for IOBasic */
myGH = (iobasicGH *) GH->extensions [CCTK_GHExtensionHandle ("IOBasic")];
+ /* How often to output */
+ myGH->outInfo_every = out_every > 0 ? out_every : -1;
+ if (outInfo_every > 0)
+ myGH->outInfo_every = outInfo_every;
+
+ /* Check the 'outInfo_vars' parameter */
+ paramdata = CCTK_ParameterData ("outInfo_vars", CCTK_THORNSTRING);
+ if (! paramdata)
+ {
+ CCTK_WARN (1, "Couldn't get info on parameter 'outInfo_vars'");
+ return (0);
+ }
+
+ /* re-parse the 'outInfo_vars' parameter if it was changed
+ and also print a header */
+ if (paramdata->n_set != outInfo_vars_lastset)
+ {
+ ParseVarsForOutput (outInfo_vars, myGH->do_outInfo);
+
+ /* Save the last setting of 'outInfo_vars' parameter */
+ outInfo_vars_lastset = paramdata->n_set;
+ }
+
/* Check this GF should be output */
if (myGH->do_outInfo [var] &&
(GH->cctk_iteration % myGH->outInfo_every == 0)) {
@@ -287,6 +329,3 @@ int IOBasic_TriggerOutputInfo (cGH *GH, int variable)
return 0;
}
-
-
-