aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortradke <tradke@0888f3d4-9f52-45d2-93bc-d00801ff5e46>2000-09-25 14:28:44 +0000
committertradke <tradke@0888f3d4-9f52-45d2-93bc-d00801ff5e46>2000-09-25 14:28:44 +0000
commitff8f8ec701fa4dd6f91ce13656e0a8c86c2a0932 (patch)
tree32dc7c61ac0338dbfcee7d93871602d0d955ccae /src
parentb37ee681ec5bd1222995ae8a3f24ebe90dd3cf2e (diff)
Moved parsing of output variables into CheckParameters().
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOStreamedHDF5/trunk@38 0888f3d4-9f52-45d2-93bc-d00801ff5e46
Diffstat (limited to 'src')
-rw-r--r--src/Output.c42
-rw-r--r--src/Startup.c7
2 files changed, 29 insertions, 20 deletions
diff --git a/src/Output.c b/src/Output.c
index 8355f4b..92766da 100644
--- a/src/Output.c
+++ b/src/Output.c
@@ -62,7 +62,9 @@ int StreamedHDF5_OutputGH (cGH *GH)
CheckSteerableParameters (myGH);
if (myGH->out_every <= 0)
+ {
return (0);
+ }
/* Loop over all variables */
for (i = 0; i < CCTK_NumVars (); i++)
@@ -75,8 +77,10 @@ int StreamedHDF5_OutputGH (cGH *GH)
fullname = CCTK_FullName (i);
if (verbose)
- CCTK_VInfo (CCTK_THORNSTRING, "StreamedHDF5_OutputGH: fullname / name = "
- "%s / %s", fullname, name);
+ {
+ CCTK_VInfo (CCTK_THORNSTRING, "StreamedHDF5_OutputGH: fullname / name "
+ "= %s / %s", fullname, name);
+ }
StreamedHDF5_OutputVarAs (GH, fullname, name);
@@ -128,8 +132,10 @@ int StreamedHDF5_OutputVarAs (cGH *GH, const char *fullname, const char *alias)
index = CCTK_VarIndex (fullname);
if (verbose)
+ {
CCTK_VInfo (CCTK_THORNSTRING, "StreamedHDF5_OutputVarAs: fullname, alias, "
"index = (%s, %s, %d)", fullname, alias, index);
+ }
/* Do the output */
StreamedHDF5_Write (GH, index, alias);
@@ -176,16 +182,21 @@ int StreamedHDF5_TimeFor (cGH *GH, int index)
/* Check if any output was requested */
if(myGH->out_every <= 0)
+ {
return (0);
+ }
/* Check this variable should be output */
if (! (myGH->do_output [index] && GH->cctk_iteration % myGH->out_every == 0))
+ {
return (0);
+ }
/* Check variable not already output this iteration */
- if (myGH->out_last [index] == GH->cctk_iteration) {
- CCTK_WARN (2, "Already done output in StreamedHDF5");
- return (0);
+ if (myGH->out_last [index] == GH->cctk_iteration)
+ {
+ CCTK_WARN (2, "Already done output in StreamedHDF5");
+ return (0);
}
return (1);
@@ -226,8 +237,8 @@ int StreamedHDF5_TriggerOutput (cGH *GH, int index)
myGH = (StreamedHDF5GH *) GH->extensions [CCTK_GHExtensionHandle ("StreamedHDF5")];
if (verbose)
- CCTK_VInfo (CCTK_THORNSTRING, "StreamedHDF5_TriggerOutput: varname, index = "
- "(%s, %d)", varname, index);
+ CCTK_VInfo (CCTK_THORNSTRING, "StreamedHDF5_TriggerOutput: varname, index "
+ "= (%s, %d)", varname, index);
/* Do the output */
StreamedHDF5_Write (GH, index, varname);
@@ -243,28 +254,25 @@ int StreamedHDF5_TriggerOutput (cGH *GH, int index)
static void CheckSteerableParameters (StreamedHDF5GH *myGH)
{
DECLARE_CCTK_PARAMETERS
- const cParamData *paramdata;
- static int out_vars_lastset = 0;
+ int times_set;
+ static int out_vars_lastset = -1;
/* How often to output */
myGH->out_every = out_every > 0 ? out_every : -1;
if (outHDF5_every > 0)
+ {
myGH->out_every = outHDF5_every;
-
- /* Check the 'out_vars' parameter */
- paramdata = CCTK_ParameterData ("out_vars", CCTK_THORNSTRING);
- if (! paramdata) {
- CCTK_WARN (1, "Couldn't get info on parameter 'out_vars'");
- return;
}
/* re-parse the 'out_vars' parameter if it was changed */
- if (paramdata->n_set != out_vars_lastset) {
+ times_set = CCTK_ParameterQueryTimesSet ("out_vars", CCTK_THORNSTRING);
+ if (times_set != out_vars_lastset)
+ {
ParseVarsForOutputH5stream (myGH, out_vars);
/* Save the last setting of 'out_vars' parameter */
- out_vars_lastset = paramdata->n_set;
+ out_vars_lastset = times_set;
}
}
diff --git a/src/Startup.c b/src/Startup.c
index a04db52..1d66cbf 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -200,13 +200,14 @@ static int StreamedHDF5_InitGH (cGH *GH)
/* How often to output */
myGH->out_every = out_every > 0 ? out_every : -1;
if (outHDF5_every > 0)
+ {
myGH->out_every = outHDF5_every;
- ParseVarsForOutputH5stream (myGH, out_vars);
+ }
for (i = 0; i < CCTK_NumVars (); i++)
+ {
myGH->out_last [i] = -1;
+ }
return (0);
}
-
-