aboutsummaryrefslogtreecommitdiff
path: root/src/Output.c
diff options
context:
space:
mode:
authortradke <tradke@0888f3d4-9f52-45d2-93bc-d00801ff5e46>2002-05-28 14:56:08 +0000
committertradke <tradke@0888f3d4-9f52-45d2-93bc-d00801ff5e46>2002-05-28 14:56:08 +0000
commitc598dce209035ce668f4ce2f060eab95aaa7fa6d (patch)
treeee30c4f14e1343b664bfcd198a89672e0483dd6c /src/Output.c
parent7e207cbc5995c6a8ea3e4748335b0f4d09d66797 (diff)
Allow the 'out_every' option in option strings to set the output frequency
for individual variables. Allow hyperslab options 'origin', 'direction', 'extent', and 'downsample' in option strings to specify hyperslab selections for individual variables. You also need to update CactusBase/IOUtil now. See the thornguide for a description and an example. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOStreamedHDF5/trunk@91 0888f3d4-9f52-45d2-93bc-d00801ff5e46
Diffstat (limited to 'src/Output.c')
-rw-r--r--src/Output.c77
1 files changed, 50 insertions, 27 deletions
diff --git a/src/Output.c b/src/Output.c
index aca20e9..58b29bb 100644
--- a/src/Output.c
+++ b/src/Output.c
@@ -14,6 +14,7 @@
#include "cctk.h"
#include "cctk_Parameters.h"
+#include "util_String.h"
#include "ioStreamedHDF5GH.h"
/* the rcs ID and its dummy function to use it */
@@ -163,15 +164,15 @@ int IOStreamedHDF5_TimeFor (const cGH *GH, int vindex)
{
int retval;
char *fullname;
- ioStreamedHDF5GH *myGH;
+ const ioStreamedHDF5GH *myGH;
CheckSteerableParameters (GH);
/* check if this variable should be output */
- myGH = (ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5");
- retval = myGH->out_every > 0 && myGH->requests[vindex] &&
- GH->cctk_iteration % myGH->out_every == 0;
+ myGH = (const ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5");
+ retval = myGH->requests[vindex] && myGH->requests[vindex]->out_every > 0 &&
+ GH->cctk_iteration % myGH->requests[vindex]->out_every == 0;
if (retval)
{
/* check if variable was not already output this iteration */
@@ -274,45 +275,67 @@ int IOStreamedHDF5_TriggerOutput (const cGH *GH, int vindex)
@@*/
static void CheckSteerableParameters (const cGH *GH)
{
- int times_set;
+ int i;
ioStreamedHDF5GH *myGH;
- static int out_vars_lastset = -1, user_was_warned = 0;
+ char *fullname, *msg;
DECLARE_CCTK_PARAMETERS
+ /* how often to output */
myGH = (ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5");
+ i = myGH->out_every_default;
+ myGH->out_every_default = out_every >= 0 ? out_every : io_out_every;
- /* how often to output */
- if (out_every >= 0 || outHDF5_every >= 0)
+ /* report if frequency changed */
+ if (myGH->out_every_default != i && ! CCTK_Equals (verbose, "none"))
{
- if (out_every < 0)
+ if (myGH->out_every_default > 0)
{
- if (! user_was_warned)
- {
- CCTK_WARN (1, "Parameter 'IOStreamedHDF5::outHDF5_every is depricated "
- "in BETA12, please use 'IOStreamedHDF5::out_every' "
- "instead");
- user_was_warned = 1;
- }
- myGH->out_every = outHDF5_every;
+ CCTK_VInfo (CCTK_THORNSTRING, "IOStreamedHDF5: Periodic output every %d "
+ "iterations", myGH->out_every_default);
}
else
{
- myGH->out_every = out_every;
+ CCTK_INFO ("IOStreamedHDF5: Periodic output turned off");
}
}
- else
- {
- myGH->out_every = io_out_every;
- }
/* re-parse the 'IOStreamedHDF5::out_vars' parameter if it was changed */
- times_set = CCTK_ParameterQueryTimesSet ("out_vars", CCTK_THORNSTRING);
- if (times_set != out_vars_lastset)
+ if (strcmp (out_vars, myGH->out_vars) || myGH->out_every_default != i)
{
- IOUtil_ParseVarsForOutput (GH, out_vars, myGH->requests);
+ IOUtil_ParseVarsForOutput (GH, CCTK_THORNSTRING, "IOStreamedHDF5::out_vars",
+ out_vars, myGH->out_every_default,
+ myGH->requests);
+
+ if (myGH->out_every_default == i || ! CCTK_Equals (verbose, "none"))
+ {
+ msg = NULL;
+ for (i = CCTK_NumVars () - 1; i >= 0; i--)
+ {
+ if (myGH->requests[i])
+ {
+ fullname = CCTK_FullName (i);
+ if (! msg)
+ {
+ Util_asprintf (&msg, "IOStreamedHDF5: Periodic output requested "
+ "for '%s'", fullname);
+ }
+ else
+ {
+ Util_asprintf (&msg, "%s, '%s'", msg, fullname);
+ }
+ free (fullname);
+ }
+ }
+ if (msg)
+ {
+ CCTK_INFO (msg);
+ free (msg);
+ }
+ }
- /* Save the last setting of 'out_vars' parameter */
- out_vars_lastset = times_set;
+ /* save the last setting of 'IOStreamedHDF5::out_vars' parameter */
+ free (myGH->out_vars);
+ myGH->out_vars = strdup (out_vars);
}
}