aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d>2002-05-28 14:56:05 +0000
committertradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d>2002-05-28 14:56:05 +0000
commit425d9c7a0041e81c4ed36b58ebebfea18c679d70 (patch)
tree88b3e01a01895524f9faff7fbdd63b74748651a8
parent47c1bfa2be88af5f67b7d8f9764f6ac990909d6b (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/IOHDF5/trunk@138 4825ed28-b72c-4eae-9704-e50c059e567d
-rw-r--r--src/Output.c75
-rw-r--r--src/Startup.c2
-rw-r--r--src/ioHDF5GH.h23
3 files changed, 66 insertions, 34 deletions
diff --git a/src/Output.c b/src/Output.c
index d43d478..17fa4b0 100644
--- a/src/Output.c
+++ b/src/Output.c
@@ -13,6 +13,7 @@
#include "cctk.h"
#include "cctk_Parameters.h"
+#include "util_String.h"
#include "ioHDF5GH.h"
/* the rcs ID and its dummy function to use it */
@@ -126,7 +127,8 @@ int IOHDF5_OutputVarAs (const cGH *GH, const char *fullname, const char *alias)
oneshot = myGH->requests[vindex] == NULL;
if (oneshot)
{
- IOUtil_ParseVarsForOutput (GH, fullname, myGH->requests);
+ IOUtil_ParseVarsForOutput (GH, CCTK_THORNSTRING, "IOHDF5::out_vars",
+ fullname, 1, myGH->requests);
}
/* do the output */
@@ -180,8 +182,8 @@ int IOHDF5_TimeFor (const cGH *GH, int vindex)
/* check if this variable should be output */
myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5");
- retval = myGH->out_every > 0 && myGH->requests[vindex] &&
- GH->cctk_iteration % myGH->out_every == 0;
+ 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 */
@@ -283,44 +285,67 @@ int IOHDF5_TriggerOutput (const cGH *GH, int vindex)
@@*/
static void CheckSteerableParameters (const cGH *GH)
{
- int times_set;
+ int i;
ioHDF5GH *myGH;
- static int out_vars_lastset = -1, user_was_warned = 0;
+ char *fullname, *msg;
DECLARE_CCTK_PARAMETERS
+ /* how often to output */
myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5");
+ 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 'IOHDF5::outHDF5_every is depricated in "
- "BETA12, please use 'IOHDF5::out_every' instead");
- user_was_warned = 1;
- }
- myGH->out_every = outHDF5_every;
+ CCTK_VInfo (CCTK_THORNSTRING, "IOHDF5: Periodic output every %d "
+ "iterations", myGH->out_every_default);
}
else
{
- myGH->out_every = out_every;
+ CCTK_INFO ("IOHDF5: Periodic output turned off");
}
}
- else
- {
- myGH->out_every = io_out_every;
- }
/* re-parse the 'IOHDF5::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, "IOHDF5::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, "IOHDF5: 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 'IOHDF5::out_vars' parameter */
+ free (myGH->out_vars);
+ myGH->out_vars = strdup (out_vars);
}
}
diff --git a/src/Startup.c b/src/Startup.c
index 8913942..8897925 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -133,6 +133,8 @@ static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH)
myGH->cp_filename_list = (char **) calloc (abs (checkpoint_keep),
sizeof (char *));
myGH->cp_filename_index = 0;
+ myGH->out_vars = strdup ("");
+ myGH->out_every_default = out_every - 1;
/* get the name of IOHDF5's output directory */
if (*out_dir == 0)
diff --git a/src/ioHDF5GH.h b/src/ioHDF5GH.h
index 533085f..35c924b 100644
--- a/src/ioHDF5GH.h
+++ b/src/ioHDF5GH.h
@@ -2,7 +2,7 @@
@header ioHDF5GH.h
@date Jun 20 2000
@author Thomas Radke
- @desc
+ @desc
The extensions to the GH structure from IOHDF5.
@enddesc
@version $Header$
@@ -17,16 +17,24 @@
/* IOHDF5 GH extension structure */
typedef struct
{
+ /* default number of times to output */
+ int out_every_default;
- /* how often to output */
- int out_every;
+ /* number of times to output for each variable */
+ CCTK_INT *out_every;
+
+ /* 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 variables) */
+ ioRequest **requests;
/* directory in which to output */
char *out_dir;
- /* the last iteration output */
- int *out_last;
-
/* filename database for opened files */
pNamedData *open_output_files;
@@ -36,9 +44,6 @@ typedef struct
/* flag to indicate request for timer output */
int print_timing_info;
- /* I/O request description list (for all variables) */
- ioRequest **requests;
-
/* ring buffer for list of successfully created cp files */
int cp_filename_index;
char **cp_filename_list;