aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--src/Output.c77
-rw-r--r--src/Startup.c3
-rw-r--r--src/ioStreamedHDF5GH.h23
3 files changed, 68 insertions, 35 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);
}
}
diff --git a/src/Startup.c b/src/Startup.c
index b359f81..e6b2775 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -195,7 +195,10 @@ static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH)
myGH = (ioStreamedHDF5GH *) malloc (sizeof (ioStreamedHDF5GH));
myGH->requests = (ioRequest **) calloc (numvars, sizeof (ioRequest *));
myGH->out_last = (int *) malloc (numvars * sizeof (int));
+
myGH->advertised_filename = NULL;
+ myGH->out_vars = strdup ("");
+ myGH->out_every_default = out_every - 1;
for (i = 0; i < numvars; i++)
{
diff --git a/src/ioStreamedHDF5GH.h b/src/ioStreamedHDF5GH.h
index 874610a..6f7c1b5 100644
--- a/src/ioStreamedHDF5GH.h
+++ b/src/ioStreamedHDF5GH.h
@@ -2,13 +2,14 @@
@header ioStreamedHDF5GH.h
@date Jun 20 2000
@author Thomas Radke
- @desc
+ @desc
The GH extensions structure for IOStreamedHDF5.
- @version $Id$
+ @enddesc
+ @version $Header$
@@*/
#ifndef _IOSTREAMEDHDF5_IOSTREAMEDHDF5GH_H_
-#define _IOSTREAMEDHDF5_IOSTREAMEDHDF5GH_H_
+#define _IOSTREAMEDHDF5_IOSTREAMEDHDF5GH_H_ 1
#include "SocketUtils.h"
#include "CactusPUGHIO/IOHDF5Util/src/ioHDF5UtilGH.h"
@@ -17,15 +18,21 @@
/* IOStreamedHDF5 GH extension structure */
typedef struct
{
- /* how often to output */
- int out_every;
+ /* default number of times to output */
+ int out_every_default;
- /* I/O request description list (for all CCTK variables) */
- ioRequest **requests;
+ /* number of times to output for each variable */
+ CCTK_INT *out_every;
- /* the last iteration output */
+ /* the last iteration output for each variable */
int *out_last;
+ /* list of variables to output */
+ char *out_vars;
+
+ /* I/O request description list (for all CCTK variables) */
+ ioRequest **requests;
+
/* ports to output data and checkpoint files to */
unsigned int data_port, checkpoint_port;